private void LoadOptions() { DataClass clsDataClass = new DataClass(); Int32 iID = Convert.ToInt32(Common.Decrypt(Request.QueryString["id"], Session.SessionID)); ProductGroup clsProductGroup = new ProductGroup(); cboProductGroup.DataTextField = "ProductGroupName"; cboProductGroup.DataValueField = "ProductGroupID"; cboProductGroup.DataSource = clsProductGroup.ListAsDataTable(SortField: "ProductGroupName").DefaultView; cboProductGroup.DataBind(); cboProductGroup.SelectedIndex = cboProductGroup.Items.Count - 1; Data.Unit clsUnit = new Data.Unit(clsProductGroup.Connection, clsProductGroup.Transaction); cboProductUnit.DataTextField = "UnitName"; cboProductUnit.DataValueField = "UnitID"; cboProductUnit.DataSource = clsUnit.ListAsDataTable(SortField: "UnitName").DefaultView; cboProductUnit.DataBind(); cboProductUnit.SelectedIndex = cboProductUnit.Items.Count - 1; clsUnit.CommitAndDispose(); ContactColumns clsContactColumns = new ContactColumns(); clsContactColumns.ContactID = true; clsContactColumns.ContactName = true; ContactColumns clsContactSearchColumns = new ContactColumns(); Contacts clsContact = new Contacts(clsProductGroup.Connection, clsProductGroup.Transaction); cboSupplier.DataTextField = "ContactName"; cboSupplier.DataValueField = "ContactID"; cboSupplier.DataSource = clsContact.Suppliers(clsContactColumns, 0, System.Data.SqlClient.SortOrder.Ascending, clsContactSearchColumns, string.Empty, 0, false, "ContactName", System.Data.SqlClient.SortOrder.Ascending).DefaultView; cboSupplier.DataBind(); cboSupplier.SelectedIndex = cboSupplier.Items.Count - 1; ProductUnitsMatrix clsUnitMatrix = new ProductUnitsMatrix(clsProductGroup.Connection, clsProductGroup.Transaction); ProductUnitsMatrixDetails clsUnitDetails = clsUnitMatrix.LastDetails(iID); if (clsUnitDetails.BottomUnitName == null) { cboProductUnit.Enabled = true; } // Added July 9, 2010 Terminal clsTerminal = new Terminal(clsProductGroup.Connection, clsProductGroup.Transaction); TerminalDetails clsTerminalDetails = clsTerminal.Details(Int32.Parse(Session["BranchID"].ToString()), Session["TerminalNo"].ToString()); txtWSPriceMarkUp.Text = clsTerminalDetails.WSPriceMarkUp.ToString(); txtMargin.Text = clsTerminalDetails.RETPriceMarkUp.ToString(); clsProductGroup.CommitAndDispose(); }
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 void SaveRecord() { ProductUnitsMatrix clsUnitMatrix = new ProductUnitsMatrix(); ProductUnitsMatrixDetails clsDetails = new ProductUnitsMatrixDetails(); clsDetails.MatrixID = Convert.ToInt64(lblMatrixID.Text); clsDetails.ProductID = Convert.ToInt64(lblProductID.Text); clsDetails.BaseUnitID = Convert.ToInt16(lblBaseUnitID.Text); clsDetails.BaseUnitValue = Convert.ToDecimal(txtBaseUnitValue.Text); clsDetails.BottomUnitID = Convert.ToInt16(cboBottomUnit.SelectedItem.Value); clsDetails.BottomUnitValue = Convert.ToDecimal(txtBottomUnitValue.Text); clsUnitMatrix.Update(clsDetails); clsUnitMatrix.CommitAndDispose(); }
private void LoadRecord() { long iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["id"], Session.SessionID)); ProductUnitsMatrix clsUnitMatrix = new ProductUnitsMatrix(); ProductUnitsMatrixDetails clsDetails = clsUnitMatrix.Details(iID); lblBaseUnitID.Text = clsDetails.BaseUnitID.ToString(); txtBaseUnit.Text = Convert.ToString(clsDetails.BaseUnitName); txtBaseUnitValue.Text = clsDetails.BaseUnitValue.ToString(); // cboBottomUnit.Items.RemoveAt( cboBottomUnit.Items.IndexOf(cboBottomUnit.Items.FindByValue(lblBaseUnitID.Text))); cboBottomUnit.SelectedIndex = cboBottomUnit.Items.IndexOf(cboBottomUnit.Items.FindByValue(clsDetails.BottomUnitID.ToString())); txtBottomUnitValue.Text = clsDetails.BottomUnitValue.ToString(); clsUnitMatrix.CommitAndDispose(); }
private void LoadOptions() { Int64 prodid = Convert.ToInt64(Common.Decrypt(Request.QueryString["prodid"].ToString(), Session.SessionID)); lblProductID.Text = Convert.ToString(prodid); ProductUnitsMatrix clsUnitMatrix = new ProductUnitsMatrix(); ProductUnitsMatrixDetails clsUnitDetails = clsUnitMatrix.LastDetails(prodid); if (clsUnitDetails.BottomUnitName == null) { Products clsProduct = new Products(); ProductDetails clsDetails = new ProductDetails(); clsDetails = clsProduct.Details(prodid); clsProduct.CommitAndDispose(); txtBaseUnit.Text = clsDetails.BaseUnitName; lblBaseUnitID.Text = Convert.ToString(clsDetails.BaseUnitID); } else { txtBaseUnit.Text = clsUnitDetails.BottomUnitName; lblBaseUnitID.Text = Convert.ToString(clsUnitDetails.BottomUnitID); } cboBottomUnit.DataTextField = "UnitName"; cboBottomUnit.DataValueField = "UnitID"; cboBottomUnit.DataSource = clsUnitMatrix.AvailableUnitsForProduct(prodid).DefaultView; cboBottomUnit.DataBind(); if (cboBottomUnit.Items.Contains(new ListItem(txtBaseUnit.Text, lblBaseUnitID.Text))) { cboBottomUnit.Items.RemoveAt(cboBottomUnit.Items.IndexOf(cboBottomUnit.Items.FindByValue(lblBaseUnitID.Text))); } cboBottomUnit.SelectedIndex = cboBottomUnit.Items.Count - 1; clsUnitMatrix.CommitAndDispose(); }
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 void SaveRecord() { ProductUnitsMatrix clsUnitMatrix = new ProductUnitsMatrix(); ProductUnitsMatrixDetails clsDetails = new ProductUnitsMatrixDetails(); clsDetails.MatrixID = Convert.ToInt64(lblMatrixID.Text); clsDetails.ProductID = Convert.ToInt64(lblProductID.Text); clsDetails.BaseUnitID = Convert.ToInt16(lblBaseUnitID.Text); clsDetails.BaseUnitValue = Convert.ToDecimal(txtBaseUnitValue.Text); clsDetails.BottomUnitID = Convert.ToInt16(cboBottomUnit.SelectedItem.Value); clsDetails.BottomUnitValue = Convert.ToDecimal(txtBottomUnitValue.Text); clsUnitMatrix.Update(clsDetails); clsUnitMatrix.CommitAndDispose(); }
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); } }