private void BCategorie_Click(object sender, EventArgs e) { ShopApp.Class.ComboBoxItem ad = (CBNameBrand.SelectedItem as ShopApp.Class.ComboBoxItem); ShopApp.Class.ComboBoxItem de = (CBNameCategorie.SelectedItem as ShopApp.Class.ComboBoxItem); if (RBAdd.Checked == true) { if (TBNameCategorie.Text == "" || CBNameBrand.Text == "") { MessageBox.Show("กรุณาอย่าเว้นช่องว่างครับ"); } else { ShopApp.SQL.InputSQLMSSQL("INSERT INTO Shop.dbo.tblCategories(Categoriename , BrandID ,ShortDesciption) \r\n" + "VALUES ('" + TBNameCategorie.Text + "'," + ad.No + ",'" + TBcategorieDesciption.Text + "'); \r\n\r\n"); MessageBox.Show("เพิ่มเสร็จเรียบร้อย."); Cleartex(); Re(); } } else { if (CBNameCategorie.Text == "") { MessageBox.Show("กรุณาใส่ข้อมูลให้ครบ."); } else { ShopApp.SQL.InputSQLMSSQL("DELETE FROM Shop.dbo.tblCategories \r\n" + "WHERE CategorieID = " + de.No + "; \r\n\r\n"); MessageBox.Show("ลบเสร็จเรียบร้อย."); Cleartex(); Re(); } } }
private void button2_Click(object sender, EventArgs e) { //ปุ่มใน Add Brand ShopApp.Class.ComboBoxItem brandid = (CBNameBrand.SelectedItem as ShopApp.Class.ComboBoxItem); if (RBAdd.Checked == true) { if (TBbrand_add__brand.Text == "") { MessageBox.Show("กรุณาอย่าเว้นช่องว่างครับ"); } else { InputBrand(); } } else { if (CBbra.Text == "") { MessageBox.Show("กรุณาอย่าเว้นช่องว่างครับ"); } else { ShopApp.SQL.InputSQLMSSQL("DELETE FROM Shop.dbo.tblBrand \r\n" + "WHERE BrandID = " + brandid.No + " ; \r\n\r\n"); MessageBox.Show("ลบแแบรนเรียบร้อยจร้า"); Cleartex(); Re(); } } }
private void button1_Click_2(object sender, EventArgs e) { if (CBTBrandname.Text == "" || CBTcategoriename.Text == "" || CBTCODE.Text == "" || CBTproductname.Text == "") { MessageBox.Show("กรุณากรอกข้อมูลให้ครบจร้า"); } else { ShopApp.Class.ComboBoxItem idproduct = (CBTproductname.SelectedItem as ShopApp.Class.ComboBoxItem); ShopApp.Class.ComboBoxItem idevent = (CBTCODE.SelectedItem as ShopApp.Class.ComboBoxItem); DataSet ds = ShopApp.SQL.InputSQLMSSQLDS(//[] INPUT: "SELECT Productname , Quantity , PriceSell \r\n" + "FROM Shop.dbo.tblProducts as a \r\n" + "LEFT JOIN Shop.dbo.tblStock as b on a.ProductID = b.ProductID \r\n" + "LEFT JOIN Shop.dbo.tblPrice as c on a.PriceID = c.PriceID \r\n" + "WHERE a.ProductID = " + idproduct.No + " ; \r\n" + "SELECT Discountpercen \r\n" + "FROM Shop.dbo.tblEventSale \r\n" + "WHERE EventSaleID = " + idevent.No + "; \r\n\r\n"); TBconsoleTestcode.Text = "Product : " + ds.Tables[0].Rows[0][0] + ". \r\n" + "Quantity : " + ds.Tables[0].Rows[0][1] + ". \r\n" + "Full Price : " + ds.Tables[0].Rows[0][2] + ". \r\n" + "Code : " + CBTCODE.SelectedItem + ". \r\n " + "DiscountPer : " + ds.Tables[1].Rows[0][0] + "% . \r\n" + "Price : " + (Convert.ToInt32(ds.Tables[0].Rows[0][2]) - (Convert.ToInt32(ds.Tables[0].Rows[0][2]) * Convert.ToInt32(ds.Tables[1].Rows[0][0]) / 100)) + "."; } }
private void CBOquantity_SelectedIndexChanged(object sender, EventArgs e) { ShopApp.Class.ComboBoxItem product = (CBOProduct.SelectedItem as ShopApp.Class.ComboBoxItem); ShopApp.Class.ComboBoxItem idevent = (CBOevnet.SelectedItem as ShopApp.Class.ComboBoxItem); if (CBOevnet.Text == "") { DataTable dt = ShopApp.SQL.InputSQLMSSQL("SELECT PriceSell \r\n" + "FROM Shop.dbo.tblPrice as a \r\n" + "LEFT JOIN Shop.dbo.tblProducts as b on a.PriceID = b.PriceID \r\n" + "WHERE ProductID = " + product.No + ";"); TBOconsole.Text = "" + (Convert.ToInt32(dt.Rows[0][0]) * Convert.ToInt32(CBOquantity.SelectedItem)); } else { DataSet ds = ShopApp.SQL.InputSQLMSSQLDS("SELECT PriceSell \r\n" + "FROM Shop.dbo.tblPrice as a \r\n" + "LEFT JOIN Shop.dbo.tblProducts as b on a.PriceID = b.PriceID \r\n" + "WHERE ProductID = " + product.No + "; \r\n\r\n" + "SELECT Discountpercen \r\n" + "FROM Shop.dbo.tblEventSale \r\n" + "WHERE EventSaleID = " + idevent.No + "; \r\n\r\n"); TBOconsole.Text = "" + (Convert.ToInt32(ds.Tables[0].Rows[0][0]) * Convert.ToInt32(CBOquantity.SelectedItem)); TBOconsole.Text = "" + (Convert.ToInt32(ds.Tables[0].Rows[0][0]) * Convert.ToInt32(CBOquantity.SelectedItem) - (Convert.ToInt32(ds.Tables[0].Rows[0][0]) * Convert.ToInt32(CBOquantity.SelectedItem) * Convert.ToInt32(ds.Tables[1].Rows[0][0]) / 100)); } }
private void B_Checked_Code_Click(object sender, EventArgs e) { ShopApp.Class.ComboBoxItem Categorie = (CB_SaleProduct_Show_Cateorie.SelectedItem as ShopApp.Class.ComboBoxItem); ShopApp.Class.ComboBoxItem brand = (CB_SaleProduct_Show_Brand.SelectedItem as ShopApp.Class.ComboBoxItem); ShopApp.Class.ComboBoxItem product = (CB_SaleProduct_Show_Product.SelectedItem as ShopApp.Class.ComboBoxItem); DataTable dt1 = ShopApp.SQL.InputSQLMSSQL(SQLDefault[3] .Replace("{Eventname}", TB_Code_UseCode.Text)); DataTable dt = ShopApp.SQL.InputSQLMSSQL(SQLDefault[2] .Replace("{Productid}", product.No)); if (dt1.Rows.Count < 1) { TB_Console_Code.Text = "Code : " + TB_Code_UseCode.Text + " . \r\n" + "Status Error . \r\n"; TB_Console_produc.Text = "Brand : " + brand.Name + " . \r\n" + "Categorie : " + Categorie.Name + ". \r\n" + "Product : " + product.Name + ". Stock : " + dt.Rows[0][1] + ". \r\n" + "Price : " + Convert.ToInt32(dt.Rows[0][0]) * Convert.ToInt32(CB_SaleProduct_Show_Quantity.SelectedItem) + " . "; } else { TB_Console_Code.Text = "Code : " + TB_Code_UseCode.Text + " . \r\n" + "Status Activate . \r\n" + "Discount : " + dt1.Rows[0][1] + " %"; TB_Console_produc.Text = ""; TB_Console_produc.Text = "Brand : " + brand.Name + " . \r\n" + "Categorie : " + Categorie.Name + ". \r\n" + "Product : " + product.Name + ". Stock : " + dt.Rows[0][1] + ". \r\n" + "Price : " + (((Convert.ToInt32(dt.Rows[0][0]) * Convert.ToInt32(CB_SaleProduct_Show_Quantity.SelectedItem)) - ((Convert.ToInt32(dt.Rows[0][0]) * Convert.ToInt32(CB_SaleProduct_Show_Quantity.SelectedItem)) * Convert.ToInt32(dt1.Rows[0][1]) / 100))) + " . "; DataTable eventid = ShopApp.SQL.InputSQLMSSQL(""); } }
private void B_Event_Save_Click(object sender, EventArgs e) { ShopApp.Class.ComboBoxItem Event = (CB_Event_Select_Name.SelectedItem as ShopApp.Class.ComboBoxItem); DataTable dt = ShopApp.SQL.InputSQLMSSQL("SELECT EventSaleName \r\n" + "From Shop.dbo.tblEventSale \r\n" + "WHERE EventSaleName = '" + TB_Event_Change_name.Text + "' "); if (TB_Event_Change_name.Text == "" || TB_Event_Change_Discount.Text == "") { if (dt.Rows.Count < 1) { SQL.InputSQLMSSQL(//[] INPUT: "UPDATE Shop.dbo.tblEventSale \r\n" + "SET EventSalename='" + TB_Event_Change_name.Text + "', Description='" + TB_Event_Change_Discount.Text + "'" + " , Description = '" + TB_Event_Change_Descliption.Text + "' \r\n" + "WHERE EventSaleID=" + Event.No + "; \r\n\r\n"); MessageBox.Show("บันทึกเสร็จสิ้น"); TB_Event_Change_Descliption.Text = ""; TB_Event_Change_Discount.Text = ""; TB_Event_Change_name.Text = ""; CB_Event_Select_Name.Items.Remove(Event.Name); CB_Event_Select_Name.Items.Add(TB_Event_Change_name.Text); } else { MessageBox.Show("ในระบบีชื่อนี้อยู่แล้วกรุณาลองชื่อใหม่ครับ"); } } else { MessageBox.Show("กรุณาอย่าเว้นว่างจ้า"); } }
private void BTransport_Click(object sender, EventArgs e) { ShopApp.Class.ComboBoxItem tranid = (CBnametran.SelectedItem as ShopApp.Class.ComboBoxItem); if (RBAdd.Checked == true) { if (TBnameTran.Text == "") { MessageBox.Show("อย่าเว้นช่องว่างนะครับ"); } else { ShopApp.SQL.InputSQLMSSQL("INSERT INTO GeneralData.dbo.tblTransport(Transportname , TransportDetail) \r\n" + "VALUES ('" + TBnameTran.Text + "','" + TBtransportDetail.Text + "'); \r\n\r\n"); MessageBox.Show("เพิ่มขนส่งเรียบร้อย."); Cleartex(); } } else { if (CBnametran.Text == "") { MessageBox.Show("อย่าเว้นช่องว่างนะครับ"); } else { ShopApp.SQL.InputSQLMSSQL("DELETE FROM GeneralData.dbo.tblTransport \r\n" + "WHERE TransportID = " + tranid.No + " ; \r\n\r\n"); MessageBox.Show("ลบขนส่งนั้นเรียบร้อย"); Cleartex(); Re(); } } }
private void CB_Product_Baradname_SelectedIndexChanged(object sender, EventArgs e) { ShopApp.Class.ComboBoxItem categorie = (CB_Product_Categoriename.SelectedItem as ShopApp.Class.ComboBoxItem); ShopApp.Class.ComboBoxItem brand = (CB_Product_Baradname.SelectedItem as ShopApp.Class.ComboBoxItem); ShopApp.SQL.LoadComboBoxInformation("SELECT Productname , ProductID \r\n" + "FROM Shop.dbo.tblProducts " + "WHERE BrandID = " + brand.No + " and Categorieid = " + categorie.No + "; \r\n\r\n", new ComboBox[] { CB_Product_Productname }); }
private void CBOCATEGORIE_SelectedIndexChanged(object sender, EventArgs e) { CBOProduct.Items.Clear(); ShopApp.Class.ComboBoxItem CategorisID = (CBOCATEGORIE.SelectedItem as ShopApp.Class.ComboBoxItem); ShopApp.SQL.LoadComboBoxInformation("SELECT Productname , Productid \r\n" + "FROM Shop.dbo.tblProducts as a \r\n" + "LEFT JOIN Shop.dbo.tblCategories as b on a.CategorieID = b.CategorieID \r\n" + "WHERE a.CategorieID = " + CategorisID.No + " ; \r\n\r\n", new ComboBox[] { CBOProduct }); }
private void CBnameeventlist_SelectedIndexChanged(object sender, EventArgs e) { ShopApp.Class.ComboBoxItem dd = (CBnameeventlist.SelectedItem as ShopApp.Class.ComboBoxItem); DataTable dt = ShopApp.SQL.InputSQLMSSQL("SELECT EVENTSALENAME , Discountpercen , Description \r\n" + "FROM Shop.dbo.tblEventSale \r\n" + "WHERE EventSaleID = " + dd.No + "; \r\n\r\n"); TBConsolenameevent.Text = "Name Event is " + dt.Rows[0][0] + ". \r\n" + "Discountpercen is " + dt.Rows[0][1] + " %. \r\n" + "Description : " + dt.Rows[0][2] + "."; }
private void CB_SaleProduct_Show_Brand_SelectedIndexChanged(object sender, EventArgs e) { if (!(CB_SaleProduct_Show_Brand.Text == "" || CB_SaleProduct_Show_Cateorie.Text == "")) { ShopApp.Class.ComboBoxItem Categorie = (CB_SaleProduct_Show_Cateorie.SelectedItem as ShopApp.Class.ComboBoxItem); ShopApp.Class.ComboBoxItem brand = (CB_SaleProduct_Show_Brand.SelectedItem as ShopApp.Class.ComboBoxItem); ShopApp.SQL.LoadComboBoxInformation(SQLDefault[0] .Replace("{Brandid}", brand.No) .Replace("{Categorieid}", Categorie.No), new ComboBox[] { CB_SaleProduct_Show_Product }); } }
private void CB_Product_Chang_Show_Brand_SelectedIndexChanged(object sender, EventArgs e) { if (!(CB_Product_Chang_Show_Brand.Text == "" || CB_Product_Chang_Show_Categorie.Text == "")) { ShopApp.Class.ComboBoxItem Categorie = (CB_Product_Chang_Show_Categorie.SelectedItem as ShopApp.Class.ComboBoxItem); ShopApp.Class.ComboBoxItem brand = (CB_Product_Chang_Show_Brand.SelectedItem as ShopApp.Class.ComboBoxItem); ShopApp.SQL.LoadComboBoxInformation("SELECT ProductName , ProductID \r\n" + "FROM Shop.dbo.tblProducts \r\n" + "WHERE Brandid =" + brand.No + " and Categorieid =" + Categorie.No + " \r\n\r\n", new ComboBox[] { CB_Product_Chang_Show_Product }); } }
private void CBstockBrandname_SelectedIndexChanged(object sender, EventArgs e) { CBstockCategorie.Items.Clear(); CBstockProduct.Items.Clear(); TBConsoleStock.Text = ""; ShopApp.Class.ComboBoxItem BrandID = (CBstockBrandname.SelectedItem as ShopApp.Class.ComboBoxItem); ShopApp.SQL.LoadComboBoxInformation("SELECT Categoriename , Categorieid \r\n" + "FROM Shop.dbo.tblCategories as a \r\n" + "LEFT JOIN Shop.dbo.tblbrand as b on a.BrandID = b.BrandID \r\n" + "WHERE a.BrandID = " + BrandID.No + " ; \r\n\r\n", new ComboBox[] { CBstockCategorie }); }
private void CBTcategoriename_SelectedIndexChanged(object sender, EventArgs e) { ShopApp.Class.ComboBoxItem dd = (CBTcategoriename.SelectedItem as ShopApp.Class.ComboBoxItem); CBTproductname.Items.Clear(); for (int a = 0; a < dd.No.Length; a++) { ShopApp.SQL.LoadComboBoxInformation("SELECT Productname , ProductID \r\n" + "FROM Shop.dbo.tblProducts as a \r\n" + "LEFT JOIN Shop.dbo.tblCategories as b on a.categorieid = b.categorieid \r\n" + "WHERE b.categorieid = " + dd.No + "; \r\n\r\n", new ComboBox[] { CBTproductname }); } }
private void CBBrandNameproduct_SelectedIndexChanged(object sender, EventArgs e) { ShopApp.Class.ComboBoxItem dd = (CBBrandNameproduct.SelectedItem as ShopApp.Class.ComboBoxItem); CBcategorieProduct.Items.Clear(); for (int a = 0; a < dd.No.Length; a++) { ShopApp.SQL.LoadComboBoxInformation("SELECT Categoriename , CategorieID \r\n" + "FROM Shop.dbo.tblCategories as a \r\n" + "LEFT JOIN Shop.dbo.tblBrand as b on a.BrandID = b.BrandID \r\n" + "WHERE b.BrandID = " + dd.No + "; \r\n\r\n", new ComboBox[] { CBcategorieProduct }); } }
private void CB_SaleProduct_Show_Product_SelectedIndexChanged(object sender, EventArgs e) { CB_SaleProduct_Show_Quantity.Items.Clear(); ShopApp.Class.ComboBoxItem product = (CB_SaleProduct_Show_Product.SelectedItem as ShopApp.Class.ComboBoxItem); DataTable dt = ShopApp.SQL.InputSQLMSSQL(SQLDefault[1] .Replace("{Productid}", product.No)); for (int a = 1; a <= Convert.ToInt32(dt.Rows[0][0]) && !(a > 15); a++) { CB_SaleProduct_Show_Quantity.Items.Add(a); } }
private void CB_SaleProduct_Show_Quantity_SelectedIndexChanged(object sender, EventArgs e) { ShopApp.Class.ComboBoxItem Categorie = (CB_SaleProduct_Show_Cateorie.SelectedItem as ShopApp.Class.ComboBoxItem); ShopApp.Class.ComboBoxItem brand = (CB_SaleProduct_Show_Brand.SelectedItem as ShopApp.Class.ComboBoxItem); ShopApp.Class.ComboBoxItem product = (CB_SaleProduct_Show_Product.SelectedItem as ShopApp.Class.ComboBoxItem); DataTable dt = ShopApp.SQL.InputSQLMSSQL(SQLDefault[2] .Replace("{Productid}", product.No)); TB_Console_produc.Text = "Brand : " + brand.Name + " . \r\n" + "Categorie : " + Categorie.Name + ". \r\n" + "Product : " + product.Name + ". Stock : " + dt.Rows[0][1] + ". \r\n" + "Price : " + Convert.ToInt32(dt.Rows[0][0]) * Convert.ToInt32(CB_SaleProduct_Show_Quantity.SelectedItem) + " . "; }
private void CBstockProduct_SelectedIndexChanged(object sender, EventArgs e) { ShopApp.Class.ComboBoxItem idproduct = (CBstockProduct.SelectedItem as ShopApp.Class.ComboBoxItem); DataTable dt = ShopApp.SQL.InputSQLMSSQL("SELECT Productname , Quantity , PriceSell \r\n" + "FROM Shop.dbo.tblProducts as a \r\n" + "LEFT JOIN Shop.dbo.tblStock as b on a.ProductID = b.ProductID \r\n" + "LEFT JOIN Shop.dbo.tblPrice as c on a.PriceID = c.PriceID \r\n" + "WHERE a.ProductID = " + idproduct.No + "; \r\n\r\n"); TBConsoleStock.Text = "name : " + dt.Rows[0][0] + " . \r\n" + "Quantity IN Stock : " + dt.Rows[0][1] + " . \r\n" + "PriceSell : " + dt.Rows[0][2] + " BTH."; }
private void CBOProduct_SelectedIndexChanged(object sender, EventArgs e) { CBOquantity.Items.Clear(); ShopApp.Class.ComboBoxItem count = (CBOProduct.SelectedItem as ShopApp.Class.ComboBoxItem); DataTable dt = ShopApp.SQL.InputSQLMSSQL("SELECT Quantity \r\n" + "FROM Shop.dbo.tblProducts as a \r\n" + "LEFT JOIN Shop.dbo.tblStock as b on a.ProductID = b.ProductID \r\n" + "WHERE a.ProductID = " + count.No + "; \r\n\r\n"); for (int a = 1; a <= Convert.ToInt32(dt.Rows[0][0]); a++) { CBOquantity.Items.Add(a); } }
private void CBOBRAND_SelectedIndexChanged(object sender, EventArgs e) { ShopApp.Class.ComboBoxItem dd = (CBOBRAND.SelectedItem as ShopApp.Class.ComboBoxItem); CBOCATEGORIE.Items.Clear(); if (RBOrder.Checked == true) { for (int a = 0; a < dd.No.Length; a++) { ShopApp.SQL.LoadComboBoxInformation("SELECT Categoriename , CategorieID \r\n" + "FROM Shop.dbo.tblCategories as a \r\n" + "LEFT JOIN Shop.dbo.tblBrand as b on a.BrandID = b.BrandID \r\n" + "WHERE b.BrandID = " + dd.No + "; \r\n\r\n", new ComboBox[] { CBOCATEGORIE }); } } }
private void button1_Click(object sender, EventArgs e) { ShopApp.Class.ComboBoxItem addbrandid = (CBBrandNameproduct.SelectedItem as ShopApp.Class.ComboBoxItem); ShopApp.Class.ComboBoxItem addcategorieid = (CBcategorieProduct.SelectedItem as ShopApp.Class.ComboBoxItem); if (RBAdd.Checked == true) { if (CBBrandNameproduct.Text == "" || CBcategorieProduct.Text == "" || TBProductName.Text == "" || TBCostProduct.Text == "" || TBSellProduct.Text == "") { MessageBox.Show("กรุณากรอกข้อมูลให้ครบ."); } else { ShopApp.SQL.InputSQLMSSQL(//[] INPUT: "DECLARE @ProductID INT; \r\n" + "DECLARE @PriceID INT; \r\n \r\n" + "INSERT INTO Shop.dbo.tblPrice(CostPrice , PriceSell , UserID) \r\n" + "VALUES ('" + TBCostProduct.Text + "','" + TBSellProduct.Text + "','" + ShopApp.Class.AccountInfo.AccountNo + "'); \r\n \r\n" + "SELECT @PriceID = SCOPE_IDENTITY(); \r\n \r\n" + "INSERT INTO Shop.dbo.tblProducts(Productname , CategorieID,PriceID) \r\n" + "VALUES ('" + TBProductName.Text + "','" + addcategorieid.No + "',@PriceID); \r\n \r\n" + "SELECT @ProductID = SCOPE_IDENTITY(); \r\n \r\n" + "INSERT INTO Shop.dbo.tblDateAddProduct(ProductID , Quantity ,PriceID) \r\n" + "VALUES (@Productid,'" + TBQuantityProduct.Text + "',@PriceID); \r\n \r\n" + "INSERT INTO Shop.dbo.tblStock(ProductID,Quantity) \r\n" + "VALUES (@ProductID,'" + TBQuantityProduct.Text + "'); \r\n\r\n"); MessageBox.Show("เพิ่มสินค้าเรียบร้อย."); Cleartex(); Re(); } } else { if (CBBrandNameproduct.Text == "" || CBcategorieProduct.Text == "" || CBProduct.Text == "") { MessageBox.Show("กรุณากรอกข้อมูลให้ครบ."); } else { MessageBox.Show("ไม่อนุญาติให้ลบ."); } } }
private void button1_Click(object sender, EventArgs e) { if (CB_Transport_name.Text == "") { MessageBox.Show("กรุณากรอกข้อมูลก่อนนะครับ"); } else { ShopApp.Class.ComboBoxItem Tran = (CB_Transport_name.SelectedItem as ShopApp.Class.ComboBoxItem); ShopApp.SQL.InputSQLMSSQL(//[] INPUT: "DELETE FROM GeneralData.dbo.tblTransport \r\n" + "WHERE TransportID = " + Tran.No + "; \r\n\r\n"); CB_Transport_name.Items.Remove(Tran.Name); MessageBox.Show("ลบขนส่งนี้เรียบร้อย"); CB_Transport_name.Text = ""; } }
private void B_Customer_Delete_Click(object sender, EventArgs e) { ShopApp.Class.ComboBoxItem Event = (CB_Event_name.SelectedItem as ShopApp.Class.ComboBoxItem); if (CB_Event_name.Text == "") { MessageBox.Show("กรุณาเลือก Event ก่อนนะครับ"); } else { ShopApp.SQL.InputSQLMSSQL(//[] INPUT: "DELETE FROM Shop.dbo.tblEventSale \r\n" + "WHERE EventSaleID = " + Event.No + "; \r\n\r\n"); CB_Event_name.Items.Remove(Event.Name); MessageBox.Show("ลบเสร็จเรียบร้อยแล้วครับ"); CB_Event_name.Text = ""; } }
private void B_save_Click(object sender, EventArgs e) { ShopApp.Class.ComboBoxItem product = (CB_Product_list.SelectedItem as ShopApp.Class.ComboBoxItem); ShopApp.SQL.InputSQLMSSQL(//[] INPUT: "DECLARE @Quantity INT; \r\n \r\n" + "SELECT @Quantity = (SELECT Quantity \r\n" + "FROM Shop.dbo.tblProducts as a \r\n" + "LEFT JOIN SHOP.dbo.tblStock as b on a.ProductID = b.ProductID \r\n" + "WHERE a.ProductID = " + product.No + "); \r\n \r\n" + "UPDATE Shop.dbo.tblStock \r\n" + "SET Quantity = @Quantity + " + TB_update_Stock.Text + "\r\n" + "WHERE ProductID = " + product.No + "; \r\n\r\n"); MessageBox.Show("บันทึกเรียบร้อยครับ"); TB_update_Stock.Text = ""; }
private void B_Categorie_Delete_Click(object sender, EventArgs e) { if (CB_Categorie_name.Text == "") { MessageBox.Show("กรุณาอย่าใส่ช่องว่างครับ"); } else { ShopApp.Class.ComboBoxItem Categorie = (CB_Categorie_name.SelectedItem as ShopApp.Class.ComboBoxItem); ShopApp.SQL.InputSQLMSSQL(//[] INPUT: Delete "DELETE FROM Shop.dbo.tblCategories \r\n" + "WHERE Categorieid = " + Categorie.No + "; \r\n\r\n"); MessageBox.Show("ลบเสร็๋จเรียบร้อยแล้วครับ"); CB_Categorie_name.Text = ""; CB_Categorie_name.Items.Remove(Categorie.Name); } }
private void B_Product_Save_Click(object sender, EventArgs e) { ShopApp.Class.ComboBoxItem product = (CB_Product_Chang_Show_Product.SelectedItem as ShopApp.Class.ComboBoxItem); ShopApp.Class.ComboBoxItem brand = (CB_Product_Change_Brand_name.SelectedItem as ShopApp.Class.ComboBoxItem); ShopApp.Class.ComboBoxItem categorie = (CB_Product_Change_Categotie_Name.SelectedItem as ShopApp.Class.ComboBoxItem); DataTable dt = ShopApp.SQL.InputSQLMSSQL(//[] INPUT: "SELECT CostPrice \r\n" + "FROM SHOP.dbo.tblPrice as a \r\n" + "LEFT JOIN SHOP.dbo.tblProducts as b on a.PriceID = b.PriceID \r\n" + "WHERE ProductID = " + product.No + "; \r\n\r\n"); if (!(CB_Product_Chang_Show_Product.Text == "" || CB_Product_Chang_Show_Categorie.Text == "" || CB_Product_Chang_Show_Brand.Text == "" || CB_Product_Change_Categotie_Name.Text == "" || CB_Product_Change_Brand_name.Text == "" || TB_Product_Change_Price.Text == "" || TB_Product_Change_Productname.Text == "")) { ShopApp.SQL.InputSQLMSSQL( //[] INPUT: "DECLARE @PriceID INT; \r\n \r\n" + "INSERT INTO SHOP.dbo.tblPrice(CostPrice, PriceSell , UserID) \r\n" + "VALUES('" + dt.Rows[0][0] + "','" + TB_Product_Change_Price.Text + "','" + ShopApp.Class.AccountInfo.AccountNo + "'); \r\n \r\n" + "SELECT @PriceID = SCOPE_IDENTITY(); \r\n \r\n" + "UPDATE Shop.dbo.tblProducts \r\n" + "SET Productname='" + TB_Product_Change_Productname.Text + "', CategorieID='" + categorie.No + "' , PriceID = @PriceID , BrandID = " + brand.No + " \r\n" + "WHERE ProductID=" + product.No + "; \r\n\r\n"); MessageBox.Show("บันทึกเรียบร้อยครับ"); CB_Product_Change_Brand_name.Text = ""; CB_Product_Change_Categotie_Name.Text = ""; CB_Product_Chang_Show_Brand.Text = ""; CB_Product_Chang_Show_Categorie.Text = ""; CB_Product_Chang_Show_Product.Text = ""; TB_Product_Change_Price.Text = ""; TB_Product_Change_Productname.Text = ""; CB_Product_Chang_Show_Product.Items.Remove(product.Name); CB_Product_Chang_Show_Product.Items.Add(TB_Product_Change_Productname.Text); } else { MessageBox.Show("กรุณากรอกข้อมูลให้ครบครับ"); } }
private void B_Product_DeleteProduct_Click(object sender, EventArgs e) { if (CB_Product_Productname.Text == "" || CB_Product_Categoriename.Text == "" || CB_Product_Baradname.Text == "") { MessageBox.Show("กรุณากรอกข้อมูลก่อนนะครับ"); } else { ShopApp.Class.ComboBoxItem Product = (CB_Product_Productname.SelectedItem as ShopApp.Class.ComboBoxItem); ShopApp.SQL.InputSQLMSSQL(//[] INPUT: "DELETE FROM Shop.dbo.tblProducts \r\n" + "WHERE ProductID = " + Product.No + "; \r\n\r\n"); CB_Product_Productname.Items.Remove(Product.Name); MessageBox.Show("ลบสินค้านี้เรียบร้อยครับ"); CB_Product_Baradname.Text = ""; CB_Product_Categoriename.Text = ""; CB_Product_Productname.Text = ""; } }
private void B_Categorie_Save_Click(object sender, EventArgs e) { ShopApp.Class.ComboBoxItem Categorie = (CB_Categorie_Show_list.SelectedItem as ShopApp.Class.ComboBoxItem); if (CB_Categorie_Show_list.Text == "" || TB_Categorie_Chage_name.Text == "") { MessageBox.Show("กรุณาอย่าเว้นว่างจ้า"); } else { ShopApp.SQL.InputSQLMSSQL(//[] INPUT: "UPDATE Shop.dbo.tblCategories \r\n" + "SET Categoriename = '" + TB_Categorie_Chage_name + "' \r\n" + "WHERE Categorieid= " + Categorie.No + "; \r\n\r\n"); MessageBox.Show("แก้ไขเรียบร้อย"); TB_Categorie_Chage_name.Text = ""; CB_Categorie_Show_list.Text = ""; CB_Categorie_Show_list.Items.Remove(Categorie.Name); CB_Categorie_Show_list.Items.Add(TB_Categorie_Chage_name.Text); } }
private void B_Confirm_Informaion_Click(object sender, EventArgs e) {// กดปุ่ม Confirm DataTable dt1 = ShopApp.SQL.InputSQLMSSQL(SQLDefault[3] .Replace("{Eventname}", TB_Code_UseCode.Text)); ShopApp.Class.ComboBoxItem product = (CB_SaleProduct_Show_Product.SelectedItem as ShopApp.Class.ComboBoxItem); ShopApp.Class.ComboBoxItem Product = (CB_SaleProduct_Show_Product.SelectedItem as ShopApp.Class.ComboBoxItem); if (!(CB_SaleProduct_Show_Product.Text == "" || CB_SaleProduct_Show_Brand.Text == "" || CB_SaleProduct_Show_Cateorie.Text == "" || CB_SaleProduct_Show_Quantity.Text == "" || CB_Select_Transport.Text == "" || TB_Show_Customer_IDcard.Text == "")) { //ShopApp.SQL.InputSQLMSSQL(SQLDefault[4] // .Replace("{Idcard}",) // .Replace("{Productid}",) // .Replace("{Quantity}",) // .Replace("{Idevent}",) // .Replace("{PriceProduct}",) // .Replace("{PriceTransport}",) // .Replace("{IdTransport}",)) } }
private void B_Transport_Save_Click(object sender, EventArgs e) { ShopApp.Class.ComboBoxItem Transprot = (CB_Transport_Change_Show_TransportName.SelectedItem as ShopApp.Class.ComboBoxItem); if (TB_Transport_Change_name.Text == "" || CB_Transport_Change_Show_TransportName.Text == "") { MessageBox.Show("กรอกข้อมูลก่อนนะครับ"); } else { ShopApp.SQL.InputSQLMSSQL(//[] INPUT: "UPDATE GeneralData.dbo.tblTransport \r\n" + "SET Transportname = '" + TB_Transport_Change_name + "', TransportDetail= '" + TB_Transport_Change_Detail + "' \r\n" + "WHERE TransportID = " + Transprot.No + "; \r\n\r\n"); MessageBox.Show("บันทึกเสร็จสิ้น"); CB_Transport_Change_Show_TransportName.Text = ""; TB_Transport_Change_Detail.Text = ""; TB_Transport_Change_name.Text = ""; CB_Transport_Change_Show_TransportName.Items.Remove(Transprot.Name); CB_Transport_Change_Show_TransportName.Items.Add(TB_Transport_Change_name.Text); } }