private bool SaveRecord() { long lngUID = long.Parse(Session["UID"].ToString()); DateTime dteChangeDate = DateTime.Now; ProductPackage clsProductPackage = new ProductPackage(); ProductPackageDetails clsDetails = new ProductPackageDetails(); clsDetails.PackageID = Convert.ToInt64(lblPackageID.Text); clsDetails.MatrixID = Convert.ToInt64(lblMatrixID.Text); clsDetails.ProductID = Convert.ToInt64(lblProductID.Text); clsDetails.UnitID = Convert.ToInt32(cboUnit.SelectedItem.Value); clsDetails.Price = Convert.ToDecimal(txtProductPrice.Text); clsDetails.Price1 = Convert.ToDecimal(txtPrice1.Text); clsDetails.Price2 = Convert.ToDecimal(txtPrice2.Text); clsDetails.Price3 = Convert.ToDecimal(txtPrice3.Text); clsDetails.Price4 = Convert.ToDecimal(txtPrice4.Text); clsDetails.Price5 = Convert.ToDecimal(txtPrice5.Text); clsDetails.WSPrice = Convert.ToDecimal(txtWSPrice.Text); clsDetails.PurchasePrice = Convert.ToDecimal(txtPurchasePrice.Text); clsDetails.Quantity = Convert.ToDecimal(txtQuantity.Text); clsDetails.VAT = Convert.ToDecimal(txtVAT.Text); clsDetails.EVAT = Convert.ToDecimal(txtEVAT.Text); clsDetails.LocalTax = Convert.ToDecimal(txtLocalTax.Text); clsDetails.BarCode1 = txtBarCode1.Text; clsDetails.BarCode2 = txtBarCode2.Text; clsDetails.BarCode3 = txtBarCode3.Text; clsProductPackage.Update(clsDetails, lngUID, dteChangeDate, "Product Package Update."); clsProductPackage.CommitAndDispose(); return(true); }
private void SaveRecord() { long lngUID = long.Parse(Session["UID"].ToString()); DateTime dteChangeDate = DateTime.Now; ProductPackage clsProductPackage = new ProductPackage(); clsProductPackage.GetConnection(); bool boIsFirstRecord = true; ProductPackageDetails clsProductPackageDetails; foreach (DataListItem e in lstProductPackages.Items) { if (boIsFirstRecord == true) { TextBox txtCommision = (TextBox)e.FindControl("txtCommision"); Products clsProduct = new Products(clsProductPackage.Connection, clsProductPackage.Transaction); clsProduct.UpdateCommision(long.Parse(cboProductCode.SelectedValue), Convert.ToDecimal(txtCommision.Text)); boIsFirstRecord = false; } HtmlInputCheckBox chkProductPackageID = (HtmlInputCheckBox)e.FindControl("chkProductPackageID"); TextBox txtBarCode1 = (TextBox)e.FindControl("txtBarCode1"); TextBox txtBarCode2 = (TextBox)e.FindControl("txtBarCode2"); TextBox txtBarCode3 = (TextBox)e.FindControl("txtBarCode3"); Label lblUnitName = (Label)e.FindControl("lblUnitName"); TextBox txtQuantity = (TextBox)e.FindControl("txtQuantity"); TextBox txtPurchasePrice = (TextBox)e.FindControl("txtPurchasePrice"); TextBox txtSellingPrice = (TextBox)e.FindControl("txtSellingPrice"); TextBox txtPrice1 = (TextBox)e.FindControl("txtPrice1"); TextBox txtPrice2 = (TextBox)e.FindControl("txtPrice2"); TextBox txtPrice3 = (TextBox)e.FindControl("txtPrice3"); TextBox txtPrice4 = (TextBox)e.FindControl("txtPrice4"); TextBox txtPrice5 = (TextBox)e.FindControl("txtPrice5"); TextBox txtWSPrice = (TextBox)e.FindControl("txtWSPrice"); Label lblVAT = (Label)e.FindControl("lblVAT"); Label lblEVAT = (Label)e.FindControl("lblEVAT"); Label lblLocalTax = (Label)e.FindControl("lblLocalTax"); clsProductPackageDetails = new ProductPackageDetails(); clsProductPackageDetails.PackageID = Convert.ToInt64(chkProductPackageID.Value); clsProductPackageDetails.ProductID = Convert.ToInt64(cboProductCode.SelectedValue); clsProductPackageDetails.UnitID = Convert.ToInt32(lblUnitName.ToolTip); clsProductPackageDetails.Price = Convert.ToDecimal(txtSellingPrice.Text); clsProductPackageDetails.Price1 = Convert.ToDecimal(txtPrice1.Text); clsProductPackageDetails.Price2 = Convert.ToDecimal(txtPrice2.Text); clsProductPackageDetails.Price3 = Convert.ToDecimal(txtPrice3.Text); clsProductPackageDetails.Price4 = Convert.ToDecimal(txtPrice4.Text); clsProductPackageDetails.Price5 = Convert.ToDecimal(txtPrice5.Text); clsProductPackageDetails.WSPrice = Convert.ToDecimal(txtWSPrice.Text); clsProductPackageDetails.PurchasePrice = Convert.ToDecimal(txtPurchasePrice.Text); clsProductPackageDetails.Quantity = Convert.ToDecimal(txtQuantity.Text); clsProductPackageDetails.VAT = Convert.ToDecimal(lblVAT.Text); clsProductPackageDetails.EVAT = Convert.ToDecimal(lblEVAT.Text); clsProductPackageDetails.LocalTax = Convert.ToDecimal(lblLocalTax.Text); clsProductPackageDetails.BarCode1 = txtBarCode1.Text; clsProductPackageDetails.BarCode2 = txtBarCode2.Text; clsProductPackageDetails.BarCode3 = txtBarCode3.Text; clsProductPackage.Update(clsProductPackageDetails, lngUID, dteChangeDate, "Change price adjustment."); } clsProductPackage.CommitAndDispose(); }