/// <summary> /// Wprowadź do bazy danych nowe dane pochodzącę z Tabe /// </summary> void FillDataBase(int ID) { string _IDPackage = dtableOrder.Rows[0][Title.IDPackage].ToString(); //Jezeli brak IDPackage - Insert Jezeli IDPackage =! 0 - Update if (_IDPackage == "") { int _IDOrderItem = (int)dtableOrder.Rows[0][Title.ID]; string _netPrice = dtableOrder.Rows[0][Title.netPrice].ToString(); _netPrice = Protected.Dot(_netPrice); string _amount = dtableOrder.Rows[0][Title.amount].ToString(); _amount = Protected.Dot(_amount); //Stworz nowe zamowienie Connection.Execute("INSERT INTO [Moj_Sklep].[dbo].[Package] (IDOrder, IDOrderItem, NetPrice,Amount) VALUES (" + ID + "," + _IDOrderItem + "," + _netPrice + "," + _amount + ");"); //Usun przepisany wiersz gridOrder.Rows.RemoveAt(0); } else { int _intIDPackage = (int)dtableOrder.Rows[0][Title.IDPackage]; //Edytuj int _IDOrderItem = (int)dtableOrder.Rows[0][Title.ID]; string _netPrice = dtableOrder.Rows[0][Title.netPrice].ToString(); _netPrice = Protected.Dot(_netPrice); string _amount = dtableOrder.Rows[0][Title.amount].ToString(); _amount = Protected.Dot(_amount); Connection.Execute("UPDATE [Moj_Sklep].[dbo].[Package] SET Amount=" + _amount + " WHERE IDPackage =" + _intIDPackage + " "); gridOrder.Rows.RemoveAt(0); } }
void EditProducts(int i) { Connection.Execute("UPDATE [Moj_Sklep].[dbo].[OrderItem] SET [ProductName]= '" + Protected.Apostrophe(txtProductsName.Text) + "',[Amount]='" + Protected.Dot(Protected.Apostrophe(txtAmount.Text)) + "',[NetPrice]=" + Protected.Dot(Protected.Apostrophe(txtNetPrice.Text)) + " WHERE IDOrderItem = " + ID + " "); }
void AddNewProducts() { Connection.Execute("INSERT INTO [Moj_Sklep].[dbo].[OrderItem] (ProductName,Amount,NetPrice) VALUES ('" + Protected.Apostrophe(txtProductsName.Text) + "','" + Protected.Dot(Protected.Apostrophe(txtAmount.Text)) + "', " + Protected.Dot(Protected.Apostrophe(txtNetPrice.Text)) + ")"); }