private void EditButton_Click(object sender, EventArgs e)
 {
     CommBase.ExecuteNoReturn("UPDATE Product SET name = '" + NameTxT.Text + "' , price = " + PriceTxT.Text + " , quantity = " + QuantityTxT.Text + " , type = '" + TypeTxT.Text + "' WHERE id = " + item.ID + ";");
     SuspendLayout();
     ParentForm.CleanUp();
     ParentForm.ListItems();
     ResumeLayout();
     Close();
 }
 private void RemoveButton_Click(object sender, EventArgs e)
 {
     CommBase.ExecuteNoReturn("DELETE FROM Product WHERE name = '" + item.name + "';");
     SuspendLayout();
     ParentForm.CleanUp();
     ParentForm.ListItems();
     ResumeLayout();
     Close();
 }
Esempio n. 3
0
 private void button3_Click(object sender, EventArgs e)
 {
     if (!int.TryParse(Product_Quantity.Text, out int x) || x == 0)
     {
         MessageBox.Show("Please Enter a number that is bigger than zero ", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     if (x > ActiveItem.Quantity)
     {
         MessageBox.Show("Quantity bigger than stock", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     CommBase.ExecuteNoReturn("UPDATE Product SET quantity = quantity - " + x.ToString() + " WHERE name = '" + ActiveItem.name + "';");
     ActiveItem.Quantity = ActiveItem.Quantity - x;
     Transmitter.PlaceOrders(User.ActiveUser, ActiveItem);
     SuspendLayout();
     CleanUp();
     ListItems(Receiver.ReadFromProduct("SELECT * FROM Product;"));
     ResumeLayout();
     show_home();
 }