private void Registraciya_Load(object sender, EventArgs e) { UP(); panel5.Visible = false; Button.Text = "Добавить существующий товар"; Button.Width = 290; Button.Height = 27; Button.BackColor = Color.White; Button.Top = 130; Button.Left = 7; panel4.Controls.Add(Button); button2.Top = 130; button2.Left = Button.Width + 95; Button.Click += Sus_Button_Click; DataTableSQl kuda = new DataTableSQl("select Mesto_hraneniya.ID_Mesto_hraneniya, CONCAT(Nazvanie,' ',Adres) as 'sotr' from Mesto_hraneniya "); combo(comboBoxhr, kuda.Table, "ID_Mesto_hraneniya", "sotr"); DataTableSQl vid = new DataTableSQl("select * from Vid_tovara "); combo(comboBoxvid, vid.Table, "ID_Vid", "Naimenovanie"); DataTableSQl jiv = new DataTableSQl("select * from Tovar_Jivotn "); combo(comboBoxjiv, jiv.Table, "ID_Jivotnogo", "Vid_Jivotnogo"); textBoxkol.Text = Gl.summ; textBoxfirm.Text = Gl.post; }
private void comboBoxpost_SelectedIndexChanged(object sender, EventArgs e) { posft = comboBoxpost.Text; DataTableSQl pos = new DataTableSQl("select [№], Цена,Наименование, Фирма, Животное, [Тип товара] from posttovrlist where Поставщик = '" + posft + "'"); dataGridView1.DataSource = pos.Table.DefaultView; }
private void Upda() { DataTableSQl Zaвy = new DataTableSQl("SELECT Zakaz_tovara.ID_Zakaza as '№', Status_Zakaza.Naimenovanie as 'Статус', Postavhik.Nazvanie_organizacii as 'Поставщик', Postavhik.Pochta as 'Почта'," + " Zakaz_tovara.Data_zakaza as 'Дата заказа' FROM dbo.Zakaz_tovara INNER JOIN dbo.Postavhik ON dbo.Zakaz_tovara.Postavhik_ID = dbo.Postavhik.ID_Postavhik INNER JOIN dbo.Status_Zakaza ON dbo.Zakaz_tovara.Statysa_ID = dbo.Status_Zakaza.ID_Statysa "); dataGridView5.DataSource = Zaвy.Table.DefaultView; }
void zak() { string IDzak = dataGridZakk.CurrentRow.Cells[0].Value.ToString(); DataTableSQl Tovr = new DataTableSQl("SELECT Usloviya_zakaza.ID_Usloviya as '№', Tovar.Naimenovanie as 'Наименование', Tovar.Firma as 'Фирма', Tovar.Cena as 'Цена', " + "Usloviya_zakaza.Kolvo_tovara as 'Кол-во', Usloviya_zakaza.Summa as 'Сумма' from dbo.Usloviya_zakaza INNER JOIN dbo.Tovar ON dbo.Usloviya_zakaza.Tovara_ID = dbo.Tovar.ID_Tovara " + "INNER JOIN dbo.Zakaz_tovara ON dbo.Usloviya_zakaza.Zakaza_ID = dbo.Zakaz_tovara.ID_Zakaza where Zakaz_tovara.ID_Zakaza = '" + IDzak + "' "); dataGridView4.DataSource = Tovr.Table.DefaultView; }
private void button7_Click(object sender, EventArgs e) { posft = comboBoxpost.Text; DataTableSQl pos = new DataTableSQl("select [№], Цена,Наименование, Фирма, Животное, [Тип товара] from posttovrlist where Поставщик = '" + posft + "'"); dataGridView1.DataSource = pos.Table.DefaultView; panel5.Visible = false; dataGridView1.Location = new Point(10, 32); dataGridView1.Height = 315; }
private void dataGridViewpost_SelectionChanged(object sender, EventArgs e) { if (dataGridViewpost.SelectedCells.Count == 0) { return; } { string IDzak = dataGridViewpost.CurrentRow.Cells[1].Value.ToString(); DataTableSQl Zay = new DataTableSQl("select [№], Цена,Наименование, Фирма, Животное, [Тип товара] from posttovrlist where Поставщик = '" + IDzak + "'"); dataGridViewPrise.DataSource = Zay.Table.DefaultView; } }
void zagr(Label name, string tip) { tabControl2.Location = new Point(449, 6); tabControl2.Width = 643; panelknp.Visible = false; panel3.Visible = false; panel1.Visible = true; jiv = name.Text; DataTableSQl Zay = new DataTableSQl("select * from Prise where[Вид товара] = '" + tip + "' and Животное = '" + jiv + "'"); dataGridView1.DataSource = Zay.Table.DefaultView; }
private void dataGridView4_SelectionChanged(object sender, EventArgs e) { if (dataGridView4.SelectedCells.Count == 0) { return; } { string IDzak = dataGridView4.CurrentRow.Cells[0].Value.ToString(); DataTableSQl Tovr = new DataTableSQl(" select * from Zay where [№Заявки] = '" + IDzak + "' "); dataGridView1.DataSource = Tovr.Table.DefaultView; } }
private void dataGridView1_SelectionChanged(object sender, EventArgs e) { DataTableSQl Tovr = new DataTableSQl("select Pict,ID_Tovar_v_magazine_i_na_sklade from Tovar_v_magazine_i_na_sklade"); if (dataGridView1.SelectedCells.Count == 0) { return; } try { string tt = dataGridView1.CurrentRow.Cells[0].Value.ToString(); for (int i = 0; i < Tovr.Table.Rows.Count; i++) { string picth = Tovr.Table.Rows[i][1].ToString(); if (picth == tt) { Byte[] yy = (Byte[])Tovr.Table.Rows[i][0]; Byte[] imagef = (Byte[])yy; pictureBox9.BackgroundImage = ByteArrayToImage(imagef); pictureBox9.BackgroundImageLayout = ImageLayout.Zoom; } } } catch { } IDTV = dataGridView1.CurrentRow.Cells[0].Value.ToString(); nametov = dataGridView1.CurrentRow.Cells[1].Value.ToString(); cena = dataGridView1.CurrentRow.Cells[2].Value.ToString(); edinica = dataGridView1.CurrentRow.Cells[4].Value.ToString(); try { if (cena == "" || nametov == "") { return; } { int ind = cena.Length - 5; cena = cena.Remove(ind); textBoxname.Text = nametov; summa(); } } catch { } }
private void UpdateTovar() { DataTableSQl kateg = new DataTableSQl("SELECT * from Kategoriya_postavchika "); dataGridViewkategpost.DataSource = kateg.Table.DefaultView; DataTableSQl post = new DataTableSQl("SELECT * from Postavhik "); dataGridViewPost.DataSource = post.Table.DefaultView; DataTableSQl prise = new DataTableSQl("SELECT * from Tovar "); dataGridViewPrisePost.DataSource = prise.Table.DefaultView; DataTableSQl vidtv = new DataTableSQl("SELECT * from Vid_tovara "); dataGridViewVidTv.DataSource = vidtv.Table.DefaultView; DataTableSQl vidjiv = new DataTableSQl("SELECT * from Tovar_Jivotn "); dataGridViewVidJiv.DataSource = vidjiv.Table.DefaultView; DataTableSQl zak = new DataTableSQl("SELECT * from Zakaz_tovara "); dataGridViewZak.DataSource = zak.Table.DefaultView; DataTableSQl status = new DataTableSQl("SELECT * from Status_Zakaza "); dataGridViewStatus.DataSource = status.Table.DefaultView; DataTableSQl Usl = new DataTableSQl("SELECT * from Usloviya_zakaza "); dataGridViewUsl.DataSource = Usl.Table.DefaultView; DataTableSQl tovr = new DataTableSQl("SELECT * from Tovar_v_magazine_i_na_sklade "); dataGridViewTovr.DataSource = tovr.Table.DefaultView; DataTableSQl sotr = new DataTableSQl("SELECT * from Sotrudnik "); dataGridViewSotr.DataSource = sotr.Table.DefaultView; DataTableSQl mestohr = new DataTableSQl("SELECT * from Mesto_hraneniya "); dataGridViewMestohr.DataSource = mestohr.Table.DefaultView; DataTableSQl Spisanie = new DataTableSQl("SELECT * from Spisanie_tovara "); dataGridViewSpisanie.DataSource = Spisanie.Table.DefaultView; DataTableSQl Vibr = new DataTableSQl("SELECT * from Vibor "); dataGridViewVibr.DataSource = Vibr.Table.DefaultView; DataTableSQl Zay = new DataTableSQl("SELECT * from Zayzvka "); dataGridViewZaya.DataSource = Zay.Table.DefaultView; DataTableSQl Dost = new DataTableSQl("SELECT * from Dostavka "); dataGridViewDost.DataSource = Dost.Table.DefaultView; }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { if (comboBox1.Text == "Посмотреть все") { DataTableSQl Zaвy = new DataTableSQl("SELECT Zakaz_tovara.ID_Zakaza as '№', Status_Zakaza.Naimenovanie as 'Статус', Postavhik.Nazvanie_organizacii as 'Поставщик', Postavhik.Pochta as 'Почта'," + " Zakaz_tovara.Data_zakaza as 'Дата заказа' FROM dbo.Zakaz_tovara INNER JOIN dbo.Postavhik ON dbo.Zakaz_tovara.Postavhik_ID = dbo.Postavhik.ID_Postavhik INNER JOIN dbo.Status_Zakaza ON dbo.Zakaz_tovara.Statysa_ID = dbo.Status_Zakaza.ID_Statysa "); dataGridView5.DataSource = Zaвy.Table.DefaultView; } else { DataTableSQl Zaвy = new DataTableSQl("SELECT Zakaz_tovara.ID_Zakaza as '№', Status_Zakaza.Naimenovanie as 'Статус', Postavhik.Nazvanie_organizacii as 'Поставщик', Postavhik.Pochta as 'Почта'," + " Zakaz_tovara.Data_zakaza as 'Дата заказа' FROM dbo.Zakaz_tovara INNER JOIN dbo.Postavhik ON dbo.Zakaz_tovara.Postavhik_ID = dbo.Postavhik.ID_Postavhik INNER JOIN " + " dbo.Status_Zakaza ON dbo.Zakaz_tovara.Statysa_ID = dbo.Status_Zakaza.ID_Statysa where ID_Statysa = '" + comboBox1.SelectedValue.ToString() + "' "); dataGridView5.DataSource = Zaвy.Table.DefaultView; } }
private void UpdateStatus() { DataTableSQl Tovr = new DataTableSQl("SELECT ID_Postavhik as '№', Nazvanie_organizacii as 'Поставщик', Adres as 'Адрес', Telefon as 'Телефон', Pochta " + " as 'Почта', Naimenovanie as 'Категория' from dbo.Postavhik INNER JOIN dbo.Kategoriya_postavchika ON dbo.Postavhik.Kategoriya_ID =" + " dbo.Kategoriya_postavchika.ID_Kategoriya "); dataGridViewpost.DataSource = Tovr.Table.DefaultView; DataTableSQl Zay = new DataTableSQl("SELECT Zakaz_tovara.ID_Zakaza as '№', Status_Zakaza.Naimenovanie as 'Статус', Postavhik.Nazvanie_organizacii 'Поставщик', Zakaz_tovara.Summa as " + " 'Сумма', Postavhik.Pochta 'Почта', Zakaz_tovara.Data_zakaza as 'Дата заказа' FROM dbo.Zakaz_tovara INNER JOIN dbo.Postavhik ON dbo.Zakaz_tovara.Postavhik_ID = dbo.Postavhik.ID_Postavhik" + " INNER JOIN dbo.Status_Zakaza ON dbo.Zakaz_tovara.Statysa_ID = dbo.Status_Zakaza.ID_Statysa "); dataGridZakk.DataSource = Zay.Table.DefaultView; DataTableSQl imyafam = new DataTableSQl("select Postavhik.ID_Postavhik, Postavhik.Nazvanie_organizacii from Postavhik "); comboBoxpost.ValueMember = "ID_Postavhik"; comboBoxpost.DisplayMember = "Nazvanie_organizacii"; comboBoxpost.DataSource = imyafam.Table.DefaultView; DataTableSQl jiv = new DataTableSQl("select Tovar_Jivotn.ID_Jivotnogo, Tovar_Jivotn.Vid_Jivotnogo from Tovar_Jivotn "); comboBoxjiv.ValueMember = "ID_Jivotnogo"; comboBoxjiv.DisplayMember = "Vid_Jivotnogo"; comboBoxjiv.DataSource = jiv.Table.DefaultView; DataTableSQl tip = new DataTableSQl("select Vid_tovara.ID_Vid, Vid_tovara.Naimenovanie from Vid_tovara "); comboBoxtip.ValueMember = "ID_Vid"; comboBoxtip.DisplayMember = "Naimenovanie"; comboBoxtip.DataSource = tip.Table.DefaultView; DataTableSQl kategoriya = new DataTableSQl("select ID_Kategoriya, Naimenovanie from Kategoriya_postavchika "); comboBoxkategr.ValueMember = "ID_Kategoriya"; comboBoxkategr.DisplayMember = "Naimenovanie"; comboBoxkategr.DataSource = kategoriya.Table.DefaultView; DataTableSQl status = new DataTableSQl("SELECT ID_Statysa, Naimenovanie from dbo.Status_Zakaza "); DataRow rr = status.Table.NewRow(); rr[1] = "Посмотреть все"; status.Table.Rows.Add(rr); comboBoxtol.ValueMember = "ID_Statysa"; comboBoxtol.DisplayMember = "Naimenovanie"; comboBoxtol.DataSource = status.Table.DefaultView; comboBoxtol.SelectedIndex = 3; DataTableSQl izm = new DataTableSQl("SELECT ID_Statysa, Naimenovanie from dbo.Status_Zakaza "); comboBoxizm.ValueMember = "ID_Statysa"; comboBoxizm.DisplayMember = "Naimenovanie"; comboBoxizm.DataSource = izm.Table.DefaultView; }
private void button2_Click_1(object sender, EventArgs e) { string jiv = comboBoxjiv.Text; string tip = comboBoxtip.Text; string post = comboBoxpost.Text; try { DataTableSQl Zay = new DataTableSQl("select [№], Цена,Наименование, Фирма, Животное, [Тип товара] from posttovrlist where Поставщик ='" + post + "' and Животное ='" + jiv + "' and [Тип товара] ='" + tip + "'"); dataGridView1.DataSource = Zay.Table.DefaultView; } catch (Exception d) { MessageBox.Show(d.Message); } panel(panel5, dataGridView1); }
private void FormIzm_Load(object sender, EventArgs e) { DataTableSQl jiv = new DataTableSQl("select Tovar_Jivotn.ID_Jivotnogo, Tovar_Jivotn.Vid_Jivotnogo from Tovar_Jivotn "); comboBoxjiv.ValueMember = "ID_Jivotnogo"; comboBoxjiv.DisplayMember = "Vid_Jivotnogo"; comboBoxjiv.DataSource = jiv.Table.DefaultView; DataTableSQl tip = new DataTableSQl("select Vid_tovara.ID_Vid, Vid_tovara.Naimenovanie from Vid_tovara "); comboBoxkategr.ValueMember = "ID_Vid"; comboBoxkategr.DisplayMember = "Naimenovanie"; comboBoxkategr.DataSource = tip.Table.DefaultView; MessageBox.Show(Gl.tbizm.ToString()); switch (Gl.tbizm) { case 1: texbox(IDzak, Gl.ID); break; case 2: break; case 3: dataGridViewpost.Visible = false; button13.Visible = false; button14.Visible = false; this.Height = 240; textBoxfirm.Text = Gl.status; textBoxname.Text = Gl.post; textcena.Text = Gl.poch; button1.Text = "Сохранить изменения"; break; default: break; } }
private void dataGridView5_SelectionChanged(object sender, EventArgs e) { if (dataGridView5.SelectedCells.Count == 0) { return; } { string IDzakd = dataGridView5.CurrentRow.Cells[1].Value.ToString(); if (IDzakd == "Завершен" || IDzakd == "Не заказан") { button6.Enabled = false; } else { button6.Enabled = true; } string IDzak = dataGridView5.CurrentRow.Cells[0].Value.ToString(); DataTableSQl Tovr = new DataTableSQl("SELECT Zakaz_tovara.ID_Zakaza as '№',Usloviya_zakaza.Kolvo_tovara as 'Кол-во', Usloviya_zakaza.Summa as 'Сумма', Tovar.Naimenovanie as 'Наименование', " + "Tovar.Cena as 'Цена', Tovar.Firma as 'Фирма' from dbo.Usloviya_zakaza INNER JOIN dbo.Tovar ON dbo.Usloviya_zakaza.Tovara_ID = dbo.Tovar.ID_Tovara " + "INNER JOIN dbo.Zakaz_tovara ON dbo.Usloviya_zakaza.Zakaza_ID = dbo.Zakaz_tovara.ID_Zakaza where Zakaz_tovara.ID_Zakaza = '" + IDzak + "' "); dataGridView3.DataSource = Tovr.Table.DefaultView; } }
private void UpdateTovar() { DataTableSQl prise = new DataTableSQl("SELECT * from Prise "); dataGridView1.DataSource = prise.Table.DefaultView; DataTableSQl Zay = new DataTableSQl("select ID_Zayzvka as '№', Data_Zayavki as 'Дата заявки', Naimenovanie as 'Статус' from Zayzvka inner join Status_Zakaza on Zayzvka.Statys_ID = Status_Zakaza.ID_Statysa where ID_Statysa = 1"); dataGridView4.DataSource = Zay.Table.DefaultView; DataTableSQl status = new DataTableSQl("SELECT ID_Statysa, Naimenovanie from dbo.Status_Zakaza "); DataRow rr = status.Table.NewRow(); rr[1] = "Посмотреть все"; status.Table.Rows.Add(rr); comboBox1.ValueMember = "ID_Statysa"; comboBox1.DisplayMember = "Naimenovanie"; comboBox1.DataSource = status.Table.DefaultView; comboBox1.SelectedIndex = 3; DataTableSQl status2 = new DataTableSQl("SELECT ID_Statysa, Naimenovanie from dbo.Status_Zakaza "); comboBoxizm.ValueMember = "ID_Statysa"; comboBoxizm.DisplayMember = "Naimenovanie"; comboBoxizm.DataSource = status2.Table.DefaultView; }
void UP() { DataTableSQl tovari = new DataTableSQl("SELECT * from Prise"); dataGridView3.DataSource = tovari.Table.DefaultView; }
void poisk(string text) { DataTableSQl poisk = new DataTableSQl("select * From prise where concat(Наименование, Цена , [Кол-во], [ЕД.],Фирма, [Место хранение], Адрес) like '%" + text + "%'"); dataGridView1.DataSource = poisk.Table.DefaultView; }
private void UpdateTovar() { DataTableSQl Zay = new DataTableSQl("SELECT * FROM dbo.Tovar_v_magazine_i_na_sklade "); dataGridView1.DataSource = Zay.Table.DefaultView; }
void poisk(string text) { DataTableSQl poisk = new DataTableSQl("select * From prise where [Вид товара] = '" + tips + "' and Животное = '" + jiv + "' and concat([№],Наименование, Цена , [Кол-во], [ЕД.],Фирма, [Место хранение], Адрес) like '%" + text + "%'"); dataGridView1.DataSource = poisk.Table.DefaultView; }
private void button12_Click(object sender, EventArgs e) { DataTableSQl Tovr = new DataTableSQl("SELECT * from dbo.Dvijenie_na_sklade "); dataGridView1.DataSource = Tovr.Table.DefaultView; }
public void poiskSQL(string text) { DataTableSQl poisk = new DataTableSQl("select [№], Цена,Наименование, Фирма, Животное, [Тип товара] From posttovrlist where concat([№],Наименование, Цена, Фирма, Животное, [Тип товара]) like '%" + text + "%'"); dataGridView1.DataSource = poisk.Table.DefaultView; }