-
Notifications
You must be signed in to change notification settings - Fork 0
/
Form14.cs
88 lines (79 loc) · 2.58 KB
/
Form14.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace AnalizHelperSystem
{
public partial class Form14 : Form
{
DBwork dbw1 = new DBwork(SqlConnectionParametrs.DataBaseName, SqlConnectionParametrs.DataBaseServiceName);
private string c_profile_name = "";
public Form14()
{
InitializeComponent();
comboBox1.DisplayMember = "Name_prof";
comboBox1.ValueMember = "Name_prof";
groupBox1.Enabled = false;
pictureBox1.Visible = true;
backgroundWorker1.RunWorkerAsync();
}
private void button1_Click(object sender, EventArgs e)
{
groupBox1.Enabled = false;
pictureBox1.Visible = true;
c_profile_name = comboBox1.Text;
backgroundWorker2.RunWorkerAsync();
}
private void button2_Click(object sender, EventArgs e)
{
this.Close();
}
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
DataSet dataSet1 = dbw1.ReadProfiles();
comboBox1.DataSource = dataSet1.Tables[0];
}
private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
pictureBox1.Visible = false;
groupBox1.Enabled = true;
comboBox1.Focus();
if (e.Error != null)
{
MessageBox.Show(this, e.Error.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void backgroundWorker2_DoWork(object sender, DoWorkEventArgs e)
{
dbw1.DeleteProfile(c_profile_name);
}
private void backgroundWorker2_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
pictureBox1.Visible = false;
groupBox1.Enabled = true;
if (e.Error == null)
{
this.Close();
}
else
{
MessageBox.Show(this, e.Error.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void Form9_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)Keys.Enter)
{
button1.PerformClick();
}
if (e.KeyChar == (char)Keys.Escape)
{
button2.PerformClick();
}
}
}
}