public void load_sotr() { _CC = new podklclss(); _CC.Set_Connection(); SqlCommand load_sotr = new SqlCommand("select * from [dbo].[sotr_dolzh]", _CC.conection); _CC.conection.Open(); SqlDataReader dr = load_sotr.ExecuteReader(); DataTable dt = new DataTable(); dt.Load(dr); dataGridView1.DataSource = dt; dataGridView1.Columns[0].Visible = false; dataGridView1.Columns[1].HeaderText = "Табельный"; dataGridView1.Columns[2].HeaderText = "Фамилия"; dataGridView1.Columns[3].HeaderText = "Имя"; dataGridView1.Columns[4].HeaderText = "Отчетсво"; dataGridView1.Columns[5].HeaderText = "Дата рождения"; dataGridView1.Columns[6].HeaderText = "Серия паспорта"; dataGridView1.Columns[7].HeaderText = "Номер паспорта"; dataGridView1.Columns[8].HeaderText = "Номер трудовой книжки"; dataGridView1.Columns[9].HeaderText = "Дата получения трудовой"; dataGridView1.Columns[10].HeaderText = "Логин"; dataGridView1.Columns[11].HeaderText = "Пароль"; dataGridView1.Columns[12].HeaderText = "СНИЛС"; dataGridView1.Columns[13].HeaderText = "Кодовое слово"; dataGridView1.Columns[14].HeaderText = "Должность"; _CC.conection.Close(); }
private void button1_Click(object sender, EventArgs e) { if (textBox1.Text != "" && textBox2.Text != "" && textBox3.Text != "") { try { _CC = new podklclss(); _CC.Set_Connection(); SqlCommand insert_sotr = new SqlCommand("insert into [dbo].[dolzhn](naim_dolzh, oklad, rab_chas) " + "values(@naim_dolzh, @oklad, @rab_chas)", _CC.conection); _CC.conection.Open(); insert_sotr.Parameters.AddWithValue("naim_dolzh", textBox1.Text); insert_sotr.Parameters.AddWithValue("oklad", textBox2.Text); insert_sotr.Parameters.AddWithValue("rab_chas", textBox3.Text); insert_sotr.ExecuteNonQuery(); _CC.conection.Close(); load_dolzhn(); } catch { MessageBox.Show("Ошибка добавления"); } } else { MessageBox.Show("Заполните все поля"); } }
private void button3_Click_1(object sender, EventArgs e) { if (maskedTextBox5.Text == " -" || maskedTextBox4.Text == "") { MessageBox.Show("Не все поля заполнены!"); } else { _CC = new podklclss(); _CC.Set_Connection(); _CC.conection.Open(); SqlCommand newCMD = new SqlCommand("Select * from [dbo].[sotrud] where [login] ='" + maskedTextBox5.Text + "' and [slovo] = '" + maskedTextBox4.Text + "'", _CC.conection); SqlDataAdapter sda = new SqlDataAdapter(newCMD); DataTable dt = new DataTable(); sda.Fill(dt); if (dt.Rows.Count == 1) { panel1.Visible = true; _CC = new podklclss(); _CC.Set_Connection(); _CC.conection.Open(); SqlCommand cmd = new SqlCommand("Select * from [dbo].[sotrud](parol) where [login] ='" + maskedTextBox5.Text + _CC.conection); int result = ((int)cmd.ExecuteScalar()); _CC.conection.Close(); maskedTextBox3.Text = Convert.ToString(result); } else { MessageBox.Show("Неверные данные"); } } }
private void button1_Click(object sender, EventArgs e) { if (maskedTextBox1.Text == " -" || maskedTextBox2.Text == "") { MessageBox.Show("Не все поля заполнены!"); } else { _CC = new podklclss(); _CC.Set_Connection(); _CC.conection.Open(); SqlCommand newCMD = new SqlCommand("Select * from [dbo].[sotrud] where [login] ='" + maskedTextBox1.Text + "' and [parol] = '" + maskedTextBox2.Text + "'", _CC.conection); SqlDataAdapter sda = new SqlDataAdapter(newCMD); DataTable dt = new DataTable(); sda.Fill(dt); if (dt.Rows.Count == 1) { Program.user_login = maskedTextBox1.Text; MessageBox.Show("Вы успешно вошли в систему.", "Информация", MessageBoxButtons.OK, MessageBoxIcon.Information); glav_menu glav_menu = new glav_menu(); this.Hide(); glav_menu.Show(); } else { MessageBox.Show("Неправильный логин или пароль." + "\n" + "Повторите попытку входа!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void button1_Click(object sender, EventArgs e) { try { _CC = new podklclss(); _CC.Set_Connection(); SqlCommand insert_sotr = new SqlCommand("insert into [dbo].[sotrud](tabel,familia,imya,otchestvo,data_rozh,seria_pas,nomer_pas,nomer_TK,data_pr_TK,login,parol,slovo,snils,dolzh_id) " + "values(@tabel,@familia,@imya,@otchestvo,@data_rozh,@seria_pas,@nomer_pas,@nomer_TK,@data_pr_TK,@login,@parol,@slovo,@snils,@dolzh_id)", _CC.conection); _CC.conection.Open(); insert_sotr.Parameters.AddWithValue("tabel", tabel_num); insert_sotr.Parameters.AddWithValue("familia", textBox1.Text); insert_sotr.Parameters.AddWithValue("imya", textBox2.Text); insert_sotr.Parameters.AddWithValue("otchestvo", textBox3.Text); insert_sotr.Parameters.AddWithValue("data_rozh", Convert.ToDateTime(maskedTextBox1.Text)); insert_sotr.Parameters.AddWithValue("seria_pas", maskedTextBox7.Text); insert_sotr.Parameters.AddWithValue("nomer_pas", maskedTextBox8.Text); insert_sotr.Parameters.AddWithValue("nomer_TK", maskedTextBox5.Text); insert_sotr.Parameters.AddWithValue("data_pr_TK", maskedTextBox2.Text); insert_sotr.Parameters.AddWithValue("login", maskedTextBox4.Text); insert_sotr.Parameters.AddWithValue("parol", maskedTextBox6.Text); insert_sotr.Parameters.AddWithValue("slovo", textBox4.Text); insert_sotr.Parameters.AddWithValue("snils", maskedTextBox3.Text); insert_sotr.Parameters.AddWithValue("dolzh_id", comboBox1.SelectedValue); insert_sotr.ExecuteNonQuery(); _CC.conection.Close(); load_sotr(); } catch { MessageBox.Show("Заполните все поля"); } }
private void button10_Click(object sender, EventArgs e) { try { _CC = new podklclss(); _CC.Set_Connection(); SqlCommand otp_c = new SqlCommand("select datediff(day,data_s,data_po) from otpysk where id_otpyska='" + id_otpyska + "'", _CC.conection); _CC.conection.Open(); otp = Convert.ToInt32(otp_c.ExecuteScalar().ToString()); _CC.conection.Close(); rab = Convert.ToInt32(textBox3.Text); otrab = (rab - otp); if (otrab < 0) { if (otrab > (-20)) { rab = 40; otrab = (rab - otp); MessageBox.Show("Результаты показаны за 2 месяца"); } } textBox6.Text = otp.ToString(); textBox5.Text = otrab.ToString(); } catch (Exception ex) { MessageBox.Show("Выберите должность и данные об отпуске " + ex.Message); } }
private void button2_Click(object sender, EventArgs e) { try { _CC = new podklclss(); _CC.Set_Connection(); SqlCommand update_sotr = new SqlCommand("update [dbo].[sotrud] set [familia] = @familia,[imya] = @imya,[otchestvo] = @otchestvo,[data_rozh] = @data_rozh, " + "[seria_pas] = @seria_pas, [nomer_pas] = @nomer_pas, [nomer_TK] = @nomer_TK,[data_pr_TK]=@data_pr_TK,[login]=@login,[parol]=@parol,[slovo]=@slovo, " + "[snils]=@snils,[dolzh_id] = @dolzh_id where [id_sotr] = @id_sotr", _CC.conection); _CC.conection.Open(); update_sotr.Parameters.AddWithValue("id_sotr", id_sotr); update_sotr.Parameters.AddWithValue("tabel", tabel_num); update_sotr.Parameters.AddWithValue("familia", textBox1.Text); update_sotr.Parameters.AddWithValue("imya", textBox2.Text); update_sotr.Parameters.AddWithValue("otchestvo", textBox3.Text); update_sotr.Parameters.AddWithValue("data_rozh", Convert.ToDateTime(maskedTextBox1.Text)); update_sotr.Parameters.AddWithValue("seria_pas", maskedTextBox7.Text); update_sotr.Parameters.AddWithValue("nomer_pas", maskedTextBox8.Text); update_sotr.Parameters.AddWithValue("nomer_TK", maskedTextBox5.Text); update_sotr.Parameters.AddWithValue("data_pr_TK", maskedTextBox2.Text); update_sotr.Parameters.AddWithValue("login", maskedTextBox4.Text); update_sotr.Parameters.AddWithValue("parol", maskedTextBox6.Text); update_sotr.Parameters.AddWithValue("slovo", textBox4.Text); update_sotr.Parameters.AddWithValue("snils", maskedTextBox3.Text); update_sotr.Parameters.AddWithValue("dolzh_id", comboBox1.SelectedValue); update_sotr.ExecuteNonQuery(); _CC.conection.Close(); load_sotr(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void button2_Click(object sender, EventArgs e) { if (textBox10.Text != "") { _CC = new podklclss(); _CC.Set_Connection(); SqlCommand insert_tov_zal = new SqlCommand("insert into [dbo].[tov_zal](artikyl,naim_tov_zal, kol_tov_zal, cena, post_zal_id) values(@artikyl,@naim_tov_zal,@kol_tov_zal,@cena,@post_zal_id)", _CC.conection); _CC.conection.Open(); insert_tov_zal.Parameters.AddWithValue("artikyl", textBox10.Text); insert_tov_zal.Parameters.AddWithValue("naim_tov_zal", textBox1.Text); insert_tov_zal.Parameters.AddWithValue("kol_tov_zal", textBox2.Text); insert_tov_zal.Parameters.AddWithValue("cena", textBox5.Text); insert_tov_zal.Parameters.AddWithValue("post_zal_id", post_id); insert_tov_zal.ExecuteNonQuery(); _CC.conection.Close(); SqlConnection con = new SqlConnection("Data Source=DESKTOP-AG8AKLU;initial catalog=Zara_base;Persist Security info = True; User ID = SA; Password = qweqweqwe123"); con.Open(); SqlCommand delete_tov_sklad = new SqlCommand("[dbo].delete_tov_sklad", con); delete_tov_sklad.CommandType = CommandType.StoredProcedure; delete_tov_sklad.Parameters.AddWithValue("@id_tov_skld", Convert.ToInt32(id_tov_skld)); delete_tov_sklad.ExecuteNonQuery(); MessageBox.Show("Товар перемещен"); textBox10.Text = ""; textBox1.Text = ""; textBox2.Text = ""; textBox5.Text = ""; textBox9.Text = ""; tov_sklad(); try { _CC = new podklclss(); _CC.Set_Connection(); SqlCommand update_org_sklad = new SqlCommand("update org_sklad set [stat_id] = @stat_id where [id_mest_skl] = @id_mest_skl", _CC.conection); _CC.conection.Open(); update_org_sklad.Parameters.AddWithValue("id_mest_skl", mestop); update_org_sklad.Parameters.AddWithValue("stat_id", 1); update_org_sklad.ExecuteNonQuery(); _CC.conection.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } tov_sklad(); tov_zal(); } else { MessageBox.Show("Товар не выбран"); } }
public void get_nom_post() { _CC = new podklclss(); _CC.Set_Connection(); SqlCommand cmd = new SqlCommand("select count([nom_post])+1 from post", _CC.conection); _CC.conection.Open(); maskedTextBox3.Text = cmd.ExecuteScalar().ToString(); nom_pst = Convert.ToInt32(cmd.ExecuteScalar().ToString()); _CC.conection.Close(); }
public void get_nom_chek() { _CC = new podklclss(); _CC.Set_Connection(); SqlCommand cmd = new SqlCommand("select count([nom_chek])+1 from [dbo].[chek]", _CC.conection); _CC.conection.Open(); textBox5.Text = cmd.ExecuteScalar().ToString(); nom_chek = Convert.ToInt32(cmd.ExecuteScalar().ToString()); _CC.conection.Close(); }
public void get_tabel() { _CC = new podklclss(); _CC.Set_Connection(); SqlCommand cmd = new SqlCommand("select count([tabel])+1 from [dbo].[sotrud]", _CC.conection); _CC.conection.Open(); maskedTextBox9.Text = cmd.ExecuteScalar().ToString(); tabel_num = Convert.ToInt32(cmd.ExecuteScalar().ToString()); _CC.conection.Close(); }
public void get_level_access_user() { _CC = new podklclss(); _CC.Set_Connection(); SqlCommand get_level_access = new SqlCommand("select dolzh_id from sotrud where login ='******'", _CC.conection); _CC.conection.Open(); SqlDataReader read_level = get_level_access.ExecuteReader(); read_level.Close(); Program.level_access = Convert.ToInt32(get_level_access.ExecuteScalar()); _CC.conection.Close(); }
private void button2_Click(object sender, EventArgs e) { if (comboBox1.Text != "" && textBox1.Text != "" && textBox2.Text != "" && comboBox2.Text != "") { _CCC = new podklclss(); _CCC.Register_set(comboBox1.Text, textBox1.Text, textBox2.Text, comboBox2.Text); avtoriz avtoriz = new avtoriz(); this.Hide(); avtoriz.Show(); } else { MessageBox.Show("Заполните все данные"); } }
public void post() { _CC = new podklclss(); _CC.Set_Connection(); SqlCommand post = new SqlCommand("select * from post", _CC.conection); _CC.conection.Open(); SqlDataReader pst = post.ExecuteReader(); DataTable dt = new DataTable(); dt.Load(pst); dataGridView3.DataSource = dt; dataGridView3.Columns[0].Visible = false; dataGridView3.Columns[1].HeaderText = "Номер поставки"; dataGridView3.Columns[2].HeaderText = "Дата поставки"; _CC.conection.Close(); }
public void load_dolzhn() { _CC = new podklclss(); _CC.Set_Connection(); SqlCommand load_dolzh = new SqlCommand("select * from [dbo].[dolzhn]", _CC.conection); _CC.conection.Open(); SqlDataReader dr = load_dolzh.ExecuteReader(); System.Data.DataTable dt = new System.Data.DataTable(); dt.Load(dr); dataGridView1.DataSource = dt; dataGridView1.Columns[0].Visible = false; dataGridView1.Columns[1].HeaderText = "Должность"; dataGridView1.Columns[2].HeaderText = "Оклад"; dataGridView1.Columns[3].HeaderText = "Рабочие часы"; _CC.conection.Close(); }
public void prod_ch() { _CC = new podklclss(); _CC.Set_Connection(); SqlCommand tov_prod = new SqlCommand("select artikyl, naim_tov_prod, kol_tov_prod, cena from tov_prod where chek_id = '" + id_ch + "'", _CC.conection); _CC.conection.Open(); SqlDataReader tov = tov_prod.ExecuteReader(); System.Data.DataTable dt = new System.Data.DataTable(); dt.Load(tov); dataGridView1.DataSource = dt; dataGridView1.Columns[0].HeaderText = "Артикул"; dataGridView1.Columns[1].HeaderText = "Наименование товара"; dataGridView1.Columns[2].HeaderText = "Количество"; dataGridView1.Columns[3].HeaderText = "Цена"; _CC.conection.Close(); }
public void load_otpysk() { _CC = new podklclss(); _CC.Set_Connection(); SqlCommand load_otpysk = new SqlCommand("select * from [dbo].[sotr_otp]", _CC.conection); _CC.conection.Open(); SqlDataReader dr = load_otpysk.ExecuteReader(); System.Data.DataTable dt = new System.Data.DataTable(); dt.Load(dr); dataGridView2.DataSource = dt; dataGridView2.Columns[0].Visible = false; dataGridView2.Columns[1].HeaderText = "Табельный номер"; dataGridView2.Columns[2].HeaderText = "Дата с"; dataGridView2.Columns[3].HeaderText = "Дата по"; _CC.conection.Close(); }
private void button8_Click(object sender, EventArgs e) { try { _CC = new podklclss(); _CC.Set_Connection(); SqlCommand update_post = new SqlCommand("update post set [nom_post] = @nom_post,[data_post] = @data_post where [id_post] = @id_post", _CC.conection); _CC.conection.Open(); update_post.Parameters.AddWithValue("id_post", id_post); update_post.Parameters.AddWithValue("nom_post", maskedTextBox3.Text); update_post.Parameters.AddWithValue("data_post", maskedTextBox4.Text); update_post.ExecuteNonQuery(); _CC.conection.Close(); post(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void chek() { string id_sotr; _CC = new podklclss(); _CC.Set_Connection(); SqlCommand get_tab_user = new SqlCommand("select id_sotr from sotrud where login ='******'", _CC.conection); SqlCommand insert_chek = new SqlCommand("insert into [dbo].[chek](nom_chek, data_chek, sotr_chek_id) values(@nom_chek, @data_chek, @sotr_chek_id)", _CC.conection); _CC.conection.Open(); SqlDataReader tab_user = get_tab_user.ExecuteReader(); tab_user.Close(); id_sotr = Convert.ToString(get_tab_user.ExecuteScalar()); insert_chek.Parameters.AddWithValue("nom_chek", Convert.ToInt32(textBox5.Text)); insert_chek.Parameters.AddWithValue("data_chek", maskedTextBox1.Text); insert_chek.Parameters.AddWithValue("sotr_chek_id", Convert.ToInt32(id_sotr)); insert_chek.ExecuteNonQuery(); _CC.conection.Close(); }
private void prod_tov() { _CC = new podklclss(); _CC.Set_Connection(); SqlCommand tov_prod = new SqlCommand("select * from prod_tov", _CC.conection); _CC.conection.Open(); SqlDataReader tov = tov_prod.ExecuteReader(); DataTable dt = new DataTable(); dt.Load(tov); dataGridView1.DataSource = dt; dataGridView1.Columns[0].HeaderText = "Артикул"; dataGridView1.Columns[1].HeaderText = "Наименование товара"; dataGridView1.Columns[2].HeaderText = "Количество"; dataGridView1.Columns[3].HeaderText = "Цена за шт"; dataGridView1.Columns[4].HeaderText = "Номер чека"; _CC.conection.Close(); }
public void mest_skld() { _CC = new podklclss(); _CC.Set_Connection(); SqlCommand mest_skld = new SqlCommand("select * from mst_skld", _CC.conection); _CC.conection.Open(); SqlDataReader mest = mest_skld.ExecuteReader(); DataTable dt = new DataTable(); dt.Load(mest); dataGridView2.DataSource = dt; dataGridView2.Columns[0].Visible = false; dataGridView2.Columns[1].HeaderText = "Номер места"; dataGridView2.Columns[2].HeaderText = "Номер стелажа"; dataGridView2.Columns[3].HeaderText = "Номер по верт"; dataGridView2.Columns[4].HeaderText = "Номер по гор"; dataGridView2.Columns[5].HeaderText = "Статус"; _CC.conection.Close(); }
private void button1_Click(object sender, EventArgs e) { if (textBox5.Text != "" && textBox1.Text != "" && textBox2.Text != "" && textBox4.Text != "") { _CC = new podklclss(); _CC.Set_Connection(); SqlCommand insert_tov_skld = new SqlCommand("insert into [dbo].[tov_sklad](artikyl,naim_tov_skld, kol_tov_skld, cena, mest_skl_id, post_id) values(@artikyl,@naim_tov_skld,@kol_tov_skld,@cena,@mest_skl_id,@post_id)", _CC.conection); _CC.conection.Open(); insert_tov_skld.Parameters.AddWithValue("artikyl", textBox5.Text); insert_tov_skld.Parameters.AddWithValue("naim_tov_skld", textBox1.Text); insert_tov_skld.Parameters.AddWithValue("kol_tov_skld", textBox2.Text); insert_tov_skld.Parameters.AddWithValue("cena", textBox4.Text); insert_tov_skld.Parameters.AddWithValue("mest_skl_id", comboBox2.SelectedValue); insert_tov_skld.Parameters.AddWithValue("post_id", comboBox1.SelectedValue); insert_tov_skld.ExecuteNonQuery(); _CC.conection.Close(); tov_sklad(); try { int m = 2; _CC = new podklclss(); _CC.Set_Connection(); SqlCommand update_org_sklad = new SqlCommand("update org_sklad set [stat_id] = @stat_id where [id_mest_skl] = @id_mest_skl", _CC.conection); _CC.conection.Open(); update_org_sklad.Parameters.AddWithValue("id_mest_skl", comboBox2.SelectedValue); update_org_sklad.Parameters.AddWithValue("stat_id", m); update_org_sklad.ExecuteNonQuery(); _CC.conection.Close(); mest_skld(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } else { MessageBox.Show("Заполните данные о товаре"); } }
private void button4_Click(object sender, EventArgs e) { try { _CC = new podklclss(); _CC.Set_Connection(); SqlCommand insert_otp = new SqlCommand("insert into [dbo].[otpysk](data_s, data_po, sotr_otp_id) " + "values(@data_s, @data_po, @sotr_otp_id)", _CC.conection); _CC.conection.Open(); insert_otp.Parameters.AddWithValue("data_s", maskedTextBox1.Text); insert_otp.Parameters.AddWithValue("data_po", maskedTextBox2.Text); insert_otp.Parameters.AddWithValue("sotr_otp_id", comboBox1.SelectedValue); insert_otp.ExecuteNonQuery(); _CC.conection.Close(); load_otpysk(); } catch { MessageBox.Show("Заполните все поля"); } }
public void tov_sklad() { _CC = new podklclss(); _CC.Set_Connection(); SqlCommand tov_skld = new SqlCommand("select * from tov_skld_post", _CC.conection); _CC.conection.Open(); SqlDataReader tov = tov_skld.ExecuteReader(); DataTable dt = new DataTable(); dt.Load(tov); dataGridView1.DataSource = dt; dataGridView1.Columns[0].Visible = false; dataGridView1.Columns[1].HeaderText = "Артикул"; dataGridView1.Columns[2].HeaderText = "Наименование товара"; dataGridView1.Columns[3].HeaderText = "Количество"; dataGridView1.Columns[4].HeaderText = "Цена"; dataGridView1.Columns[5].HeaderText = "Место на складе"; dataGridView1.Columns[6].HeaderText = "Номер поставки"; _CC.conection.Close(); }
private void button5_Click_1(object sender, EventArgs e) { try { _CC = new podklclss(); _CC.Set_Connection(); SqlCommand update_dolzh = new SqlCommand("update [dbo].[otpysk] set [data_s] = @data_s,[data_po] = @data_po," + "[sotr_otp_id] = @sotr_otp_id where [id_otpyska] = @id_otpyska", _CC.conection); _CC.conection.Open(); update_dolzh.Parameters.AddWithValue("id_otpyska", id_otpyska); update_dolzh.Parameters.AddWithValue("data_s", maskedTextBox1.Text); update_dolzh.Parameters.AddWithValue("data_po", maskedTextBox2.Text); update_dolzh.Parameters.AddWithValue("sotr_otp_id", comboBox1.SelectedValue); update_dolzh.ExecuteNonQuery(); _CC.conection.Close(); load_otpysk(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void button2_Click(object sender, EventArgs e) { try { _CC = new podklclss(); _CC.Set_Connection(); SqlCommand update_dolzh = new SqlCommand("update [dbo].[dolzhn] set [naim_dolzh] = @naim_dolzh,[oklad] = @oklad," + "[rab_chas] = @rab_chas where [id_dolzh] = @id_dolzh", _CC.conection); _CC.conection.Open(); update_dolzh.Parameters.AddWithValue("id_dolzh", id_dolzh); update_dolzh.Parameters.AddWithValue("naim_dolzh", textBox1.Text); update_dolzh.Parameters.AddWithValue("oklad", textBox2.Text); update_dolzh.Parameters.AddWithValue("rab_chas", textBox3.Text); update_dolzh.ExecuteNonQuery(); _CC.conection.Close(); load_dolzhn(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void button7_Click(object sender, EventArgs e) { try { _CC = new podklclss(); _CC.Set_Connection(); SqlCommand insert_post = new SqlCommand("insert into [dbo].[post](nom_post,data_post) values(@nom_post, @data_post)", _CC.conection); _CC.conection.Open(); insert_post.Parameters.AddWithValue("nom_post", nom_pst); insert_post.Parameters.AddWithValue("data_post", maskedTextBox4.Text); insert_post.ExecuteNonQuery(); _CC.conection.Close(); maskedTextBox4.Text = ""; get_nom_post(); post(); com_post(); } catch { MessageBox.Show("Заполните дату поставки"); } }
private void button4_Click(object sender, EventArgs e) { try { SqlConnection con = new SqlConnection("Data Source=DESKTOP-AG8AKLU;initial catalog=Zara_base;Persist Security info = True; User ID = SA; Password = qweqweqwe123"); con.Open(); SqlCommand delete_tov_sklad = new SqlCommand("[dbo].delete_tov_sklad", con); delete_tov_sklad.CommandType = CommandType.StoredProcedure; delete_tov_sklad.Parameters.AddWithValue("@id_tov_skld", Convert.ToInt32(id_tov_skld)); delete_tov_sklad.ExecuteNonQuery(); MessageBox.Show("Товар удален"); textBox5.Text = ""; textBox1.Text = ""; textBox4.Text = ""; comboBox1.Text = ""; comboBox2.Text = ""; tov_sklad(); try { _CC = new podklclss(); _CC.Set_Connection(); SqlCommand update_org_sklad = new SqlCommand("update org_sklad set [stat_id] = @stat_id where [id_mest_skl] = @id_mest_skl", _CC.conection); _CC.conection.Open(); update_org_sklad.Parameters.AddWithValue("id_mest_skl", mestop); update_org_sklad.Parameters.AddWithValue("stat_id", 1); update_org_sklad.ExecuteNonQuery(); _CC.conection.Close(); mest_skld(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } catch { MessageBox.Show("Выберите удаляемый товар"); } }
public void get_name_user() { _CC = new podklclss(); _CC.Set_Connection(); SqlCommand get_fam_user = new SqlCommand("select familia from sotrud where login ='******'", _CC.conection); SqlCommand get_name_user = new SqlCommand("select imya from sotrud where login ='******'", _CC.conection); SqlCommand get_otch_user = new SqlCommand("select otchestvo from sotrud where login ='******'", _CC.conection); _CC.conection.Open(); SqlDataReader fam_user = get_fam_user.ExecuteReader(); fam_user.Close(); Program.fam_user = Convert.ToString(get_fam_user.ExecuteScalar()); SqlDataReader name_user = get_name_user.ExecuteReader(); name_user.Close(); Program.name_user = Convert.ToString(get_name_user.ExecuteScalar()); SqlDataReader otch_user = get_otch_user.ExecuteReader(); otch_user.Close(); Program.otch_user = Convert.ToString(get_otch_user.ExecuteScalar()); _CC.conection.Close(); }
private void button2_Click(object sender, EventArgs e) { try { _CC = new podklclss(); _CC.Set_Connection(); SqlCommand update_tov_sklad = new SqlCommand("update tov_sklad set [artikyl] = @artikyl, [naim_tov_skld] = @naim_tov_skld, [kol_tov_skld]=@kol_tov_skld, [cena]=@cena, [mest_skl_id]=@mest_skl_id, [post_id]=@post_id where [id_tov_skld] = @id_tov_skld", _CC.conection); _CC.conection.Open(); update_tov_sklad.Parameters.AddWithValue("id_tov_skld", id_tov_skld); update_tov_sklad.Parameters.AddWithValue("artikyl", textBox5.Text); update_tov_sklad.Parameters.AddWithValue("naim_tov_skld", textBox1.Text); update_tov_sklad.Parameters.AddWithValue("kol_tov_skld", textBox2.Text); update_tov_sklad.Parameters.AddWithValue("cena", textBox4.Text); update_tov_sklad.Parameters.AddWithValue("mest_skl_id", comboBox2.SelectedValue); update_tov_sklad.Parameters.AddWithValue("post_id", comboBox1.SelectedValue); update_tov_sklad.ExecuteNonQuery(); _CC.conection.Close(); tov_sklad(); } catch (Exception ex) { MessageBox.Show(ex.Message); } if (mesto != comboBox2.Text) { try { int m = 2; _CC = new podklclss(); _CC.Set_Connection(); SqlCommand update_org_sklad = new SqlCommand("update org_sklad set [stat_id] = @stat_id where [id_mest_skl] = @id_mest_skl", _CC.conection); _CC.conection.Open(); update_org_sklad.Parameters.AddWithValue("id_mest_skl", comboBox2.SelectedValue); update_org_sklad.Parameters.AddWithValue("stat_id", m); update_org_sklad.ExecuteNonQuery(); _CC.conection.Close(); mest_skld(); } catch (Exception ex) { MessageBox.Show(ex.Message); } try { int m = 1; _CC = new podklclss(); _CC.Set_Connection(); SqlCommand update_org_sklad = new SqlCommand("update org_sklad set [stat_id] = @stat_id where [id_mest_skl] = @id_mest_skl", _CC.conection); _CC.conection.Open(); update_org_sklad.Parameters.AddWithValue("id_mest_skl", mestop); update_org_sklad.Parameters.AddWithValue("stat_id", 1); update_org_sklad.ExecuteNonQuery(); _CC.conection.Close(); mest_skld(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }