private void textBox3_TextChanged(object sender, EventArgs e) { Preparat pr = new Preparat(); Form1 f1 = this.Owner as Form1; int index = f1.dataGridView1.CurrentCell.RowIndex; int est = Convert.ToInt32(f1.dataGridView1[5, index].Value); // int kol=0; // try // { int kol = Convert.ToInt32(textBox3.Text); //} // catch { MessageBox.Show("Будьте осторожны!Неправильный формат данных."); } // MessageBox.Show(kol.ToString()); if (est < kol) { MessageBox.Show("Указанного количества нет в наличии"); } else { k++; textBox2.Text = (kol * Convert.ToInt32(textBox2.Text)).ToString(); f1.dataGridView1[5, index].Value = (Convert.ToInt32(f1.dataGridView1[5, index].Value) - kol).ToString(); f1.nalDGVBindingSource.EndEdit(); } f1.nalDGVBindingSource.EndEdit(); }
public void Update_Preparat(int id_preparat, int id_postavchik, string name, float price, int amount) { Preparat a = this.Preparat.Where(c => c.id_preparat == id_preparat).FirstOrDefault(); a.id_postavchik = id_postavchik; a.name = name; a.price = price; a.amount = amount; this.SubmitChanges(); }
public void ADD_Preparat(int id_postavchik, int id_setup, int id_group, string name, float price, int amount, DateTime srok) { Preparat a = new Preparat(); a.id_postavchik = id_postavchik; a.id_setup = id_setup; a.id_group = id_group; a.name = name; a.price = price; a.amount = amount; a.srok = srok; this.Preparat.InsertOnSubmit(a); this.SubmitChanges(); }
private void preparat_menu_Click(object sender, EventArgs e) { Preparat prep = new Preparat(); prep.Show(); }