protected void btnSave_Click(object sender, EventArgs e) { Invertorycontroller inventoryCtlr = new Invertorycontroller(); Inventoryinfo inventoryInfo = new Inventoryinfo(); inventoryInfo.ProductID = ProductData.SelectedValue; inventoryInfo.UnitInStock = Convert.ToInt32(txtProductQtty.Text); inventoryCtlr.InsertInventory(inventoryInfo); inventoryhiscontroller invenHisCtlr = new inventoryhiscontroller(); inventory_history_info invenHisInfo = new inventory_history_info(); invenHisInfo.ProductID = ProductData.SelectedValue; invenHisInfo.Product_quantity = txtProductQtty.Text; invenHisCtlr.InsertInventory_History(invenHisInfo); SelectAllInventory(); }
protected void btnSave_Click(object sender, EventArgs e) { Productinfo prinfo = new Productinfo(); ProductController pcon = new ProductController(); prinfo.ProductName = txtProductName.Text.Trim(); prinfo.Product_description = txtDesc.Text.Trim(); prinfo.Color = txtColor.Text.Trim(); prinfo.Size = txtSize.Text.Trim(); prinfo.Manufacture_Country = txtMade.Text.Trim(); prinfo.UnitPrice = Convert.ToDecimal(txtSellPrice.Text.Trim()); prinfo.Manufacture_date = Convert.ToDateTime(txtManuDate.Text.Trim()); prinfo.Expired_date = Convert.ToDateTime(txtExpDate.Text.Trim()); prinfo.Product_Expired_date = Convert.ToDateTime(txtExpDate.Text.Trim()); prinfo.BrandID = ddlBrand.SelectedItem.Value; prinfo.CategoryID = ddlCateogry.SelectedItem.Value; prinfo.SupplierID = ddlSupplier.SelectedItem.Value; prinfo.UMID = ddlUM.SelectedItem.Value; //pcon.InsertProduct(prinfo); string productID = pcon.InsertProduct(prinfo); Inventoryinfo invinfo = new Inventoryinfo(); Invertorycontroller invCon = new Invertorycontroller(); invinfo.ProductID = productID; invinfo.UnitInStock = Convert.ToInt32(txtUnitStock.Text.Trim()); string invId = invCon.InsertInventory(invinfo); ReorderInfo rinfo = new ReorderInfo(); ReorderController rcon = new ReorderController(); rinfo.ProductID = productID; rinfo.InventoryID = invId; rinfo.ReorderUnit = txtReorder.Text.Trim(); rcon.InsertReorder(rinfo); Cell_Priceinfoinfo cinfo = new Cell_Priceinfoinfo(); Cell_PriceController ccon = new Cell_PriceController(); cinfo.Cell_Price1 = Convert.ToDecimal(txtBuyPrice.Text.Trim()); cinfo.Cell_Price2 = Convert.ToDecimal(txtSellPrice.Text.Trim()); cinfo.Product_id = productID; cinfo.UMID = ddlUM.SelectedItem.Value; ccon.InsertCell_Price(cinfo); if (fuMain.HasFile) { product_imageinfo piminfo = new product_imageinfo(); ProductImageController pimcon = new ProductImageController(); piminfo.ProductID = productID; piminfo.Images = fuMain.FileBytes; piminfo.MainPic = true; pimcon.InsertProductImage(piminfo); } if (fuLeft.HasFile) { product_imageinfo piminfo = new product_imageinfo(); ProductImageController pimcon = new ProductImageController(); piminfo.ProductID = productID; piminfo.Images = fuLeft.FileBytes; pimcon.InsertProductImage(piminfo); } if (FuBehind.HasFile) { product_imageinfo piminfo = new product_imageinfo(); ProductImageController pimcon = new ProductImageController(); piminfo.ProductID = productID; piminfo.Images = FuBehind.FileBytes; piminfo.MainPic = false; pimcon.InsertProductImage(piminfo); } if (fuRight.HasFile) { product_imageinfo piminfo = new product_imageinfo(); ProductImageController pimcon = new ProductImageController(); piminfo.ProductID = productID; piminfo.Images = fuRight.FileBytes; piminfo.MainPic = false; pimcon.InsertProductImage(piminfo); } if (fuFront.HasFile) { product_imageinfo piminfo = new product_imageinfo(); ProductImageController pimcon = new ProductImageController(); piminfo.ProductID = productID; piminfo.Images = fuFront.FileBytes; piminfo.MainPic = false; pimcon.InsertProductImage(piminfo); } if (fuBottom.HasFile) { product_imageinfo piminfo = new product_imageinfo(); ProductImageController pimcon = new ProductImageController(); piminfo.ProductID = productID; piminfo.Images = fuBottom.FileBytes; piminfo.MainPic = false; pimcon.InsertProductImage(piminfo); } ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('New Product Inserted Successfully!')", true); }