public async void DB() { BD_Edit edit = new BD_Edit(); string connectionString = @"Data Source = DESKTOP-EPNEITS; Initial Catalog = " + Program.server + "; Integrated Security = True"; sqlConnection = new SqlConnection(connectionString); await sqlConnection.OpenAsync(); edit.LoadDataCritery(); SqlConnection connect = new SqlConnection(connectionString); string podkl = "SELECT * FROM critery"; SqlCommand com = new SqlCommand(podkl, connect); connect.Open(); SqlDataReader read = com.ExecuteReader(); tabl.Load(read); } // Подключение к БД
private async void Main_Form_Load(object sender, EventArgs e) { string path = @"C:\"; string subpath = @"Document"; DirectoryInfo dirInfo = new DirectoryInfo(path); if (!dirInfo.Exists) { dirInfo.Create(); } dirInfo.CreateSubdirectory(subpath); AuthBtn = new MaterialRaisedButton { Text = "Авторизация", Location = new Point(542, 24) }; AuthBtn.Click += new EventHandler(AuthBtn_Click); this.Controls.Add(AuthBtn); NameLbl = new MaterialLabel { Location = new Point(13, 83), Text = "Добро пожаловать: " + Program.Name + "!", AutoSize = true }; this.Controls.Add(NameLbl); DBBtn = new MaterialRaisedButton { Text = "Справочники", Location = new Point(16, 125) }; DBBtn.Click += new EventHandler(DBBtn_Click); this.Controls.Add(DBBtn); OcenkaPanelBtn = new MaterialRaisedButton { Text = "Определить рейтинг сотрудника", Location = new Point(210, 125) }; OcenkaPanelBtn.Click += new EventHandler(OcenkaPanelBtn_Click); this.Controls.Add(OcenkaPanelBtn); SettingBtn = new MaterialRaisedButton { Text = "Настройки", Location = new Point(558, 75) }; SettingBtn.Click += new EventHandler(SettingBtn_Click); this.Controls.Add(SettingBtn); ArhiveBtn = new MaterialRaisedButton { Text = "Архивация", Location = new Point(558, 125) }; ArhiveBtn.Click += new EventHandler(ArhiveBtn_Click); this.Controls.Add(ArhiveBtn); SotrComBox = new ComboBox() { Location = new Point(28, 219), Size = new Size(121, 21), }; FiltrComBox = new ComboBox() { Location = new Point(464, 561), Size = new Size(171, 21) }; OcenkaDtGrView = new DataGridView { Location = new Point(11, 451), Size = new Size(420, 176), ReadOnly = true }; OcenkaDtGrView.CellClick += OcenkaDtGrView_CellClick; LoadDataOcenka(); string connectionString = @"Data Source = DESKTOP-EPNEITS; Initial Catalog = " + Program.server + "; Integrated Security = True"; sqlConnection = new SqlConnection(connectionString); await sqlConnection.OpenAsync(); Select_name_sotr_void(); Select_ocenka_void(); d_Edit.LoadDataCritery(); SqlConnection connect = new SqlConnection(connectionString); string podkl = "SELECT * FROM critery"; SqlCommand com = new SqlCommand(podkl, connect); connect.Open(); SqlDataReader read = com.ExecuteReader(); tabl.Load(read); podkl = "SELECT * FROM factory_critery"; com = new SqlCommand(podkl, connect); read = com.ExecuteReader(); tabl2.Load(read); Height = 168; }
private async void Otchot_Load(object sender, EventArgs e) { OthDiv = new MaterialDivider { Location = new Point(-1, 168), Size = new Size(565, 11) }; this.Controls.Add(OthDiv); allCheck = new MaterialCheckBox { Text = "Выбрать все", Location = new Point(257, 193), AutoSize = true }; allCheck.CheckedChanged += new EventHandler(allcheck_CheckedChanged); this.Controls.Add(allCheck); WordChek = new MaterialCheckBox { Text = "", Location = new Point(185, 113), AutoSize = true }; this.Controls.Add(WordChek); ExcelChek = new MaterialCheckBox { Text = "", Location = new Point(311, 113), AutoSize = true }; this.Controls.Add(ExcelChek); PdfChek = new MaterialCheckBox { Text = "", Location = new Point(434, 113), AutoSize = true }; this.Controls.Add(PdfChek); Bitmap Word = new Bitmap(@"D:\Флешка\4 курс\Программа работа\Rating_sotr\Word.png"); WordImage = new PictureBox { Location = new Point(214, 88), Size = new Size(77, 67), BackgroundImage = Word, BackgroundImageLayout = ImageLayout.Zoom }; WordImage.Click += new EventHandler(WordImage_Click); this.Controls.Add(WordImage); Bitmap Excel = new Bitmap(@"D:\Флешка\4 курс\Программа работа\Rating_sotr\Excel.png"); ExcelImage = new PictureBox { Location = new Point(340, 88), Size = new Size(77, 67), BackgroundImage = Excel, BackgroundImageLayout = ImageLayout.Zoom }; ExcelImage.Click += new EventHandler(ExcelImage_Click); this.Controls.Add(ExcelImage); Bitmap Pdf = new Bitmap(@"D:\Флешка\4 курс\Программа работа\Rating_sotr\pdf.png"); PdfImage = new PictureBox { Location = new Point(463, 88), Size = new Size(77, 67), BackgroundImage = Pdf, BackgroundImageLayout = ImageLayout.Zoom }; PdfImage.Click += new EventHandler(PdfImage_Click); this.Controls.Add(PdfImage); vibvers = new MaterialLabel { Location = new Point(23, 105), Text = "Выбор формата " + "документа", AutoSize = true }; this.Controls.Add(vibvers); vibkrit = new MaterialLabel { Location = new Point(22, 197), Text = "Выбор критерий для отчета", AutoSize = true }; this.Controls.Add(vibkrit); BackBtn = new MaterialRaisedButton { Text = "Отмена", Location = new Point(276, 393) }; BackBtn.Click += new EventHandler(BackBtn_Click); this.Controls.Add(BackBtn); CompleteBtn = new MaterialRaisedButton { Text = "Сформировать отчет", Location = new Point(359, 393) }; CompleteBtn.Click += new EventHandler(CompleteBtn_Click); this.Controls.Add(CompleteBtn); string connectionString = @"Data Source = DESKTOP-EPNEITS; Initial Catalog = " + Program.server + "; Integrated Security = True"; sqlConnection = new SqlConnection(connectionString); await sqlConnection.OpenAsync(); DB.LoadDataCritery(); SqlConnection connect = new SqlConnection(connectionString); string podkl = "SELECT * FROM critery"; SqlCommand com = new SqlCommand(podkl, connect); connect.Open(); SqlDataReader read = com.ExecuteReader(); tabl.Load(read); int name = 26; int nume = 236; for (int i = 0; i < tabl.Rows.Count; i++) { MaterialCheckBox bt = new MaterialCheckBox(); bt.Text = tabl.Rows[i][1].ToString(); bt.AutoSize = true; bt.Name = tabl.Rows[i][1].ToString(); bt.Location = new Point(name, nume); Controls.Add(bt); nume = nume + 30; this.Height = nume + 45; BackBtn.Location = new Point(276, nume + 5); CompleteBtn.Location = new Point(359, nume + 5); checkBoxes.Add(bt); } this.vibvers.MaximumSize = new Size(200, 100); }