private Int32 SaveRecord() { ProductUnitsMatrix clsUnitMatrix = new ProductUnitsMatrix(); ProductUnitsMatrixDetails clsDetails = new ProductUnitsMatrixDetails(); clsDetails.ProductID = Convert.ToInt64(lblProductID.Text); clsDetails.BaseUnitID = Convert.ToInt32(lblBaseUnitID.Text); clsDetails.BaseUnitValue = Convert.ToDecimal(txtBaseUnitValue.Text); clsDetails.BottomUnitID = Convert.ToInt32(cboBottomUnit.SelectedItem.Value); clsDetails.BottomUnitValue = Convert.ToDecimal(txtBottomUnitValue.Text); int id = clsUnitMatrix.Insert(clsDetails); ProductPackageDetails clsProductPackageDetails = new ProductPackageDetails(); ProductPackage clsProductPackage = new ProductPackage(clsUnitMatrix.Connection, clsUnitMatrix.Transaction); clsProductPackageDetails = clsProductPackage.DetailsByProductIDAndUnitID(Convert.ToInt64(lblProductID.Text), Convert.ToInt32(cboBottomUnit.SelectedItem.Value)); if (clsProductPackageDetails.PackageID == 0) { Products clsProduct = new Products(clsUnitMatrix.Connection, clsUnitMatrix.Transaction); ProductDetails clsProductDetails = clsProduct.Details(Convert.ToInt64(lblProductID.Text)); Terminal clsTerminal = new Terminal(clsUnitMatrix.Connection, clsUnitMatrix.Transaction); TerminalDetails clsTerminalDetails = clsTerminal.Details(Int32.Parse(Session["BranchID"].ToString()), Session["TerminalNo"].ToString()); clsProductPackageDetails.ProductID = Convert.ToInt64(lblProductID.Text); clsProductPackageDetails.UnitID = Convert.ToInt32(cboBottomUnit.SelectedItem.Value); clsProductPackageDetails.Price = clsProductDetails.Price * Convert.ToDecimal(txtBaseUnitValue.Text); clsProductPackageDetails.WSPrice = clsProductDetails.WSPrice * Convert.ToDecimal(txtBaseUnitValue.Text); clsProductPackageDetails.PurchasePrice = clsProductDetails.PurchasePrice * Convert.ToDecimal(txtBaseUnitValue.Text); clsProductPackageDetails.Quantity = 1; clsProductPackageDetails.VAT = clsTerminalDetails.VAT; clsProductPackageDetails.EVAT = clsTerminalDetails.EVAT; clsProductPackageDetails.LocalTax = clsTerminalDetails.LocalTax; if (!string.IsNullOrEmpty(clsProductDetails.BarCode1)) { clsProductPackageDetails.BarCode1 = clsProductDetails.BarCode1 + clsProductPackageDetails.UnitID.ToString() + clsProductPackageDetails.Quantity.ToString(); } if (!string.IsNullOrEmpty(clsProductDetails.BarCode2)) { clsProductPackageDetails.BarCode2 = clsProductDetails.BarCode2 + clsProductPackageDetails.UnitID.ToString() + clsProductPackageDetails.Quantity.ToString(); } if (!string.IsNullOrEmpty(clsProductDetails.BarCode3)) { clsProductPackageDetails.BarCode3 = clsProductDetails.BarCode3 + clsProductPackageDetails.UnitID.ToString() + clsProductPackageDetails.Quantity.ToString(); } clsProductPackage.Insert(clsProductPackageDetails); } clsUnitMatrix.CommitAndDispose(); return(id); }
private Int32 SaveRecord() { ProductUnitsMatrix clsUnitMatrix = new ProductUnitsMatrix(); ProductUnitsMatrixDetails clsDetails = new ProductUnitsMatrixDetails(); clsDetails.ProductID = Convert.ToInt64(lblProductID.Text); clsDetails.BaseUnitID = Convert.ToInt32(lblBaseUnitID.Text); clsDetails.BaseUnitValue = Convert.ToDecimal(txtBaseUnitValue.Text); clsDetails.BottomUnitID = Convert.ToInt32(cboBottomUnit.SelectedItem.Value); clsDetails.BottomUnitValue = Convert.ToDecimal(txtBottomUnitValue.Text); int id = clsUnitMatrix.Insert(clsDetails); ProductPackageDetails clsProductPackageDetails = new ProductPackageDetails(); ProductPackage clsProductPackage = new ProductPackage(clsUnitMatrix.Connection, clsUnitMatrix.Transaction); clsProductPackageDetails = clsProductPackage.DetailsByProductIDAndUnitID(Convert.ToInt64(lblProductID.Text), Convert.ToInt32(cboBottomUnit.SelectedItem.Value)); if (clsProductPackageDetails.PackageID == 0) { Products clsProduct = new Products(clsUnitMatrix.Connection, clsUnitMatrix.Transaction); ProductDetails clsProductDetails = clsProduct.Details(Convert.ToInt64(lblProductID.Text)); Terminal clsTerminal = new Terminal(clsUnitMatrix.Connection, clsUnitMatrix.Transaction); TerminalDetails clsTerminalDetails = clsTerminal.Details(Int32.Parse(Session["BranchID"].ToString()), Session["TerminalNo"].ToString()); clsProductPackageDetails.ProductID = Convert.ToInt64(lblProductID.Text); clsProductPackageDetails.UnitID = Convert.ToInt32(cboBottomUnit.SelectedItem.Value); clsProductPackageDetails.Price = clsProductDetails.Price * Convert.ToDecimal(txtBaseUnitValue.Text); clsProductPackageDetails.WSPrice = clsProductDetails.WSPrice * Convert.ToDecimal(txtBaseUnitValue.Text); clsProductPackageDetails.PurchasePrice = clsProductDetails.PurchasePrice * Convert.ToDecimal(txtBaseUnitValue.Text); clsProductPackageDetails.Quantity = 1; clsProductPackageDetails.VAT = clsTerminalDetails.VAT; clsProductPackageDetails.EVAT = clsTerminalDetails.EVAT; clsProductPackageDetails.LocalTax = clsTerminalDetails.LocalTax; if (!string.IsNullOrEmpty(clsProductDetails.BarCode1)) clsProductPackageDetails.BarCode1 = clsProductDetails.BarCode1 + clsProductPackageDetails.UnitID.ToString() + clsProductPackageDetails.Quantity.ToString(); if (!string.IsNullOrEmpty(clsProductDetails.BarCode2)) clsProductPackageDetails.BarCode2 = clsProductDetails.BarCode2 + clsProductPackageDetails.UnitID.ToString() + clsProductPackageDetails.Quantity.ToString(); if (!string.IsNullOrEmpty(clsProductDetails.BarCode3)) clsProductPackageDetails.BarCode3 = clsProductDetails.BarCode3 + clsProductPackageDetails.UnitID.ToString() + clsProductPackageDetails.Quantity.ToString(); clsProductPackage.Insert(clsProductPackageDetails); } clsUnitMatrix.CommitAndDispose(); return id; }
public void InheritSubGroupUnitMatrix(Int64 ProductSubGroupID, Int64 ProductID) { try { ProductSubGroupUnitsMatrix clsProductSubGroupUnitsMatrix = new ProductSubGroupUnitsMatrix(base.Connection, base.Transaction); ProductUnitsMatrix clsUnitMatrix = new ProductUnitsMatrix(base.Connection, base.Transaction); ProductUnitsMatrixDetails clsProductUnitsMatrixDetails = new ProductUnitsMatrixDetails(); MySqlDataReader clsProductSubGroupUnitsMatrixList = clsProductSubGroupUnitsMatrix.List(ProductSubGroupID,"MatrixID",SortOption.Ascending); while (clsProductSubGroupUnitsMatrixList.Read()) { clsProductUnitsMatrixDetails.ProductID = Convert.ToInt32(ProductID); clsProductUnitsMatrixDetails.BaseUnitID = Convert.ToInt32(clsProductSubGroupUnitsMatrixList.GetInt32(2)); clsProductUnitsMatrixDetails.BaseUnitValue = Convert.ToDecimal(clsProductSubGroupUnitsMatrixList.GetDecimal(4)); clsProductUnitsMatrixDetails.BottomUnitID = Convert.ToInt32(clsProductSubGroupUnitsMatrixList.GetInt32(5)); clsProductUnitsMatrixDetails.BottomUnitValue = Convert.ToDecimal(clsProductSubGroupUnitsMatrixList.GetDecimal(7)); clsUnitMatrix.Insert(clsProductUnitsMatrixDetails); } clsProductSubGroupUnitsMatrixList.Close(); } catch (Exception ex) { { } throw base.ThrowException(ex); } }