private bool Delete() { bool boRetValue = false; string stIDs = ""; foreach (DataListItem item in lstItem.Items) { HtmlInputCheckBox chkList = (HtmlInputCheckBox)item.FindControl("chkList"); if (chkList != null) { if (chkList.Checked == true) { stIDs += chkList.Value + ","; boRetValue = true; } } } if (boRetValue) { ProductUnitsMatrix clsUnitMatrix = new ProductUnitsMatrix(); clsUnitMatrix.Delete(stIDs.Substring(0, stIDs.Length - 1)); clsUnitMatrix.CommitAndDispose(); } return(boRetValue); }
private void LoadOptions() { lblMatrixID.Text = Common.Decrypt((string)Request.QueryString["matrixid"], Session.SessionID); lblProductID.Text = Common.Decrypt((string)Request.QueryString["prodid"], Session.SessionID); ProductUnitsMatrix clsUnit = new ProductUnitsMatrix(); cboUnit.DataTextField = "BottomUnitName"; cboUnit.DataValueField = "BottomUnitID"; cboUnit.DataSource = clsUnit.ListAsDataTable(Convert.ToInt64(lblProductID.Text)).DefaultView; cboUnit.DataBind(); cboUnit.SelectedIndex = cboUnit.Items.Count - 1; clsUnit.CommitAndDispose(); Products clsProduct = new Products(); ProductDetails clsDetails = clsProduct.Details(Convert.ToInt64(lblProductID.Text)); cboUnit.Items.Add(new ListItem(clsDetails.BaseUnitName, clsDetails.BaseUnitID.ToString())); cboUnit.SelectedIndex = cboUnit.Items.IndexOf(cboUnit.Items.FindByValue(clsDetails.BaseUnitID.ToString())); txtProductPrice.Text = clsDetails.Price.ToString("#,##0.#0"); txtPurchasePrice.Text = clsDetails.PurchasePrice.ToString("#,##0.#0"); txtVAT.Text = clsDetails.VAT.ToString("#,##0.#0"); txtEVAT.Text = clsDetails.EVAT.ToString("#,##0.#0"); txtLocalTax.Text = clsDetails.LocalTax.ToString("#,##0.#0"); clsProduct.CommitAndDispose(); }
private void LoadOptions() { DataClass clsDataClass = new DataClass(); lblProductID.Text = Common.Decrypt((string)Request.QueryString["prodid"], Session.SessionID); lblMatrixID.Text = Common.Decrypt(Request.QueryString["id"], Session.SessionID); ProductVariations clsProductVariation = new ProductVariations(); lstItem.DataSource = clsProductVariation.ListAsDataTable(Convert.ToInt64(lblProductID.Text)).DefaultView; lstItem.DataBind(); clsProductVariation.CommitAndDispose(); ProductUnitsMatrix clsProductUnitsMatrix = new ProductUnitsMatrix(); cboUnit.DataTextField = "BottomUnitName"; cboUnit.DataValueField = "BottomUnitID"; cboUnit.DataSource = clsProductUnitsMatrix.ListAsDataTable(Convert.ToInt64(lblProductID.Text)).DefaultView; cboUnit.DataBind(); cboUnit.SelectedIndex = cboUnit.Items.Count - 1; clsProductUnitsMatrix.CommitAndDispose(); Products clsProduct = new Products(); ProductDetails clsDetails = clsProduct.Details(Convert.ToInt64(lblProductID.Text)); cboUnit.Items.Add(new ListItem(clsDetails.BaseUnitName, clsDetails.BaseUnitID.ToString())); clsProduct.CommitAndDispose(); cboUnit.SelectedIndex = cboUnit.Items.Count - 1; lblProductSubGroupID.Text = clsDetails.ProductSubGroupID.ToString(); string stParam = "?task=" + Common.Encrypt("list", Session.SessionID) + "&prodid=" + Common.Encrypt(lblProductID.Text, Session.SessionID); lnkVariations.NavigateUrl = Constants.ROOT_DIRECTORY + "/MasterFiles/_Product/_Variations/Default.aspx" + stParam; }
private void LoadOptions() { lblProductID.Text = Common.Decrypt((string)Request.QueryString["prodid"], Session.SessionID); ProductVariations clsProductVariation = new ProductVariations(); lstItem.DataSource = clsProductVariation.ListAsDataTable(Convert.ToInt64(lblProductID.Text)).DefaultView; lstItem.DataBind(); clsProductVariation.CommitAndDispose(); ProductUnitsMatrix clsUnit = new ProductUnitsMatrix(); cboUnit.DataTextField = "BottomUnitName"; cboUnit.DataValueField = "BottomUnitID"; cboUnit.DataSource = clsUnit.ListAsDataTable(Convert.ToInt64(lblProductID.Text)).DefaultView; cboUnit.DataBind(); cboUnit.SelectedIndex = cboUnit.Items.Count - 1; clsUnit.CommitAndDispose(); Products clsProduct = new Products(); ProductDetails clsProductDetails = clsProduct.Details(Convert.ToInt64(lblProductID.Text)); lblProductSubGroupID.Text = clsProductDetails.ProductSubGroupID.ToString(); cboUnit.Items.Add(new ListItem(clsProductDetails.BaseUnitName, clsProductDetails.BaseUnitID.ToString())); cboUnit.SelectedIndex = cboUnit.Items.IndexOf(cboUnit.Items.FindByValue(clsProductDetails.BaseUnitID.ToString())); txtProductPrice.Text = clsProductDetails.Price.ToString("#,##0.#0"); txtPrice1.Text = clsProductDetails.Price1.ToString("#,##0.#0"); txtPrice2.Text = clsProductDetails.Price2.ToString("#,##0.#0"); txtPrice3.Text = clsProductDetails.Price3.ToString("#,##0.#0"); txtPrice4.Text = clsProductDetails.Price4.ToString("#,##0.#0"); txtPrice5.Text = clsProductDetails.Price5.ToString("#,##0.#0"); txtWSPrice.Text = clsProductDetails.WSPrice.ToString("#,##0.#0"); txtPurchasePrice.Text = clsProductDetails.PurchasePrice.ToString("#,##0.#0"); decimal decMargin = clsProductDetails.Price - clsProductDetails.PurchasePrice; try { decMargin = decMargin / clsProductDetails.PurchasePrice; } catch { decMargin = 1; } decMargin = decMargin * 100; txtMargin.Text = decMargin.ToString("#,##0.##0"); decMargin = clsProductDetails.WSPrice - clsProductDetails.PurchasePrice; try { decMargin = decMargin / clsProductDetails.PurchasePrice; } catch { decMargin = 1; } decMargin = decMargin * 100; txtWSPriceMarkUp.Text = decMargin.ToString("#,##0.##0"); chkIncludeInSubtotalDiscount.Checked = clsProductDetails.IncludeInSubtotalDiscount; txtVAT.Text = clsProductDetails.VAT.ToString("#,##0.#0"); txtEVAT.Text = clsProductDetails.EVAT.ToString("#,##0.#0"); clsProduct.CommitAndDispose(); string stParam = "?task=" + Common.Encrypt("list", Session.SessionID) + "&prodid=" + Common.Encrypt(lblProductID.Text, Session.SessionID); lnkVariations.NavigateUrl = Constants.ROOT_DIRECTORY + "/MasterFiles/_Product/_Variations/Default.aspx" + stParam; }
private void LoadList() { try { string SortField = "a.MatrixID"; if (Request.QueryString["sortfield"] != null) { SortField = Common.Decrypt(Request.QueryString["sortfield"].ToString(), Session.SessionID); } SortOption sortoption = SortOption.Ascending; if (Request.QueryString["sortoption"] != null) { sortoption = (SortOption)Enum.Parse(typeof(SortOption), Common.Decrypt(Request.QueryString["sortoption"], Session.SessionID), true); } ProductUnitsMatrix clsProductUnitsMatrix = new ProductUnitsMatrix(); PageData.DataSource = clsProductUnitsMatrix.ListAsDataTable(Convert.ToInt64(lblProductID.Text), SortField, sortoption).DefaultView; clsProductUnitsMatrix.CommitAndDispose(); int iPageSize = Convert.ToInt16(Session["PageSize"]); PageData.AllowPaging = true; PageData.PageSize = iPageSize; try { PageData.CurrentPageIndex = Convert.ToInt16(cboCurrentPage.SelectedItem.Value) - 1; lstItem.DataSource = PageData; lstItem.DataBind(); } catch { PageData.CurrentPageIndex = 1; lstItem.DataSource = PageData; lstItem.DataBind(); } cboCurrentPage.Items.Clear(); for (int i = 0; i < PageData.PageCount; i++) { int iValue = i + 1; cboCurrentPage.Items.Add(new ListItem(iValue.ToString(), iValue.ToString())); if (PageData.CurrentPageIndex == i) { cboCurrentPage.Items[i].Selected = true; } else { cboCurrentPage.Items[i].Selected = false; } } lblDataCount.Text = " of " + " " + PageData.PageCount; } catch { } }
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); }
protected void cboProductCode_SelectedIndexChanged(object sender, System.EventArgs e) { if (cboProductCode.Items.Count == 0) { return; } DataClass clsDataClass = new DataClass(); long ProductID = Convert.ToInt64(cboProductCode.SelectedItem.Value); if (ProductID == 0) { cboVariation.Items.Clear(); cboVariation.Items.Add(new ListItem("No Variation", "0")); return; } ProductVariationsMatrix clsProductVariationsMatrix = new ProductVariationsMatrix(); cboVariation.DataTextField = "VariationDesc"; cboVariation.DataValueField = "MatrixID"; cboVariation.DataSource = clsProductVariationsMatrix.BaseListSimpleAsDataTable(ProductID, SortField: "VariationDesc").DefaultView; cboVariation.DataBind(); if (cboVariation.Items.Count == 0) { cboVariation.Items.Add(new ListItem("No Variation", "0")); } cboVariation.SelectedIndex = cboVariation.Items.Count - 1; clsProductVariationsMatrix.CommitAndDispose(); ProductUnitsMatrix clsUnitMatrix = new ProductUnitsMatrix(); cboProductUnit.DataTextField = "BottomUnitCode"; cboProductUnit.DataValueField = "BottomUnitID"; cboProductUnit.DataSource = clsUnitMatrix.ListAsDataTable(ProductID, "a.MatrixID", SortOption.Ascending).DefaultView; cboProductUnit.DataBind(); clsUnitMatrix.CommitAndDispose(); Products clsProduct = new Products(); ProductDetails clsDetails = new ProductDetails(); clsDetails = clsProduct.Details(ProductID); clsProduct.CommitAndDispose(); cboProductUnit.Items.Add(new ListItem(clsDetails.BaseUnitCode, clsDetails.BaseUnitID.ToString())); cboProductUnit.SelectedIndex = cboProductUnit.Items.Count - 1; cboVariation_SelectedIndexChanged(null, null); }
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 iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["id"], Session.SessionID)); lblMatrixID.Text = iID.ToString(); Int64 prodID = Convert.ToInt64(Common.Decrypt(Request.QueryString["prodid"], Session.SessionID)); lblProductID.Text = prodID.ToString(); ProductUnitsMatrix clsUnitMatrix = new ProductUnitsMatrix(); cboBottomUnit.DataTextField = "UnitName"; cboBottomUnit.DataValueField = "UnitID"; cboBottomUnit.DataSource = clsUnitMatrix.AvailableUnitsForProduct(prodID).DefaultView; cboBottomUnit.DataBind(); cboBottomUnit.SelectedIndex = cboBottomUnit.Items.Count - 1; clsUnitMatrix.CommitAndDispose(); }
private void LoadOptions() { DataClass clsDataClass = new DataClass(); lblProductID.Text = Common.Decrypt((string)Request.QueryString["prodid"], Session.SessionID); lblPackageID.Text = Common.Decrypt(Request.QueryString["id"], Session.SessionID); ProductUnitsMatrix clsUnit = new ProductUnitsMatrix(); cboUnit.DataTextField = "BottomUnitName"; cboUnit.DataValueField = "BottomUnitID"; cboUnit.DataSource = clsUnit.ListAsDataTable(Convert.ToInt64(lblProductID.Text), "MatrixID", SortOption.Ascending).DefaultView; cboUnit.DataBind(); Products clsProduct = new Products(clsUnit.Connection, clsUnit.Transaction); ProductDetails clsDetails = clsProduct.Details(Convert.ToInt64(lblProductID.Text)); clsUnit.CommitAndDispose(); cboUnit.Items.Insert(0, new ListItem(clsDetails.BaseUnitName, clsDetails.BaseUnitID.ToString())); cboUnit.SelectedIndex = 0; }
private void LoadOptions() { lblMatrixID.Text = Common.Decrypt((string)Request.QueryString["matrixid"], Session.SessionID); lblProductID.Text = Common.Decrypt((string)Request.QueryString["prodid"], Session.SessionID); lblPackageID.Text = Common.Decrypt(Request.QueryString["id"], Session.SessionID); ProductUnitsMatrix clsUnit = new ProductUnitsMatrix(); cboUnit.DataTextField = "BottomUnitName"; cboUnit.DataValueField = "BottomUnitID"; cboUnit.DataSource = clsUnit.ListAsDataTable(Convert.ToInt64(lblProductID.Text)).DefaultView; cboUnit.DataBind(); cboUnit.SelectedIndex = cboUnit.Items.Count - 1; clsUnit.CommitAndDispose(); Products clsProduct = new Products(); ProductDetails clsDetails = clsProduct.Details(Convert.ToInt64(lblProductID.Text)); cboUnit.Items.Add(new ListItem(clsDetails.BaseUnitName, clsDetails.BaseUnitID.ToString())); clsProduct.CommitAndDispose(); cboUnit.SelectedIndex = cboUnit.Items.Count - 1; }
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 void LoadOptions() { lblMatrixID.Text = Common.Decrypt((string)Request.QueryString["matrixid"],Session.SessionID); lblProductID.Text = Common.Decrypt((string)Request.QueryString["prodid"],Session.SessionID); lblPackageID.Text = Common.Decrypt(Request.QueryString["id"],Session.SessionID); ProductUnitsMatrix clsUnit = new ProductUnitsMatrix(); cboUnit.DataTextField = "BottomUnitName"; cboUnit.DataValueField = "BottomUnitID"; cboUnit.DataSource = clsUnit.ListAsDataTable(Convert.ToInt64(lblProductID.Text)).DefaultView; cboUnit.DataBind(); cboUnit.SelectedIndex = cboUnit.Items.Count - 1; clsUnit.CommitAndDispose(); Products clsProduct = new Products(); ProductDetails clsDetails = clsProduct.Details(Convert.ToInt64(lblProductID.Text)); cboUnit.Items.Add(new ListItem(clsDetails.BaseUnitName, clsDetails.BaseUnitID.ToString())); clsProduct.CommitAndDispose(); cboUnit.SelectedIndex = cboUnit.Items.Count - 1; }
private bool Delete() { bool boRetValue = false; string stIDs = ""; foreach(DataListItem item in lstItem.Items) { HtmlInputCheckBox chkList = (HtmlInputCheckBox) item.FindControl("chkList"); if (chkList!=null) { if (chkList.Checked == true) { stIDs += chkList.Value + ","; boRetValue = true; } } } if (boRetValue) { ProductUnitsMatrix clsUnitMatrix = new ProductUnitsMatrix(); clsUnitMatrix.Delete(stIDs.Substring(0,stIDs.Length-1)); clsUnitMatrix.CommitAndDispose(); } return boRetValue; }
private void LoadOptions() { DataClass clsDataClass = new DataClass(); lblProductID.Text = Common.Decrypt((string)Request.QueryString["prodid"],Session.SessionID); lblPackageID.Text = Common.Decrypt(Request.QueryString["id"],Session.SessionID); ProductUnitsMatrix clsUnit = new ProductUnitsMatrix(); cboUnit.DataTextField = "BottomUnitName"; cboUnit.DataValueField = "BottomUnitID"; cboUnit.DataSource = clsUnit.ListAsDataTable(Convert.ToInt64(lblProductID.Text),"MatrixID",SortOption.Ascending).DefaultView; cboUnit.DataBind(); Products clsProduct = new Products(clsUnit.Connection, clsUnit.Transaction); ProductDetails clsDetails = clsProduct.Details(Convert.ToInt64(lblProductID.Text)); clsUnit.CommitAndDispose(); cboUnit.Items.Insert(0, new ListItem(clsDetails.BaseUnitName, clsDetails.BaseUnitID.ToString())); cboUnit.SelectedIndex = 0; }
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 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() { lblProductID.Text = Common.Decrypt((string)Request.QueryString["prodid"],Session.SessionID); ProductVariations clsProductVariation = new ProductVariations(); lstItem.DataSource = clsProductVariation.ListAsDataTable(Convert.ToInt64(lblProductID.Text)).DefaultView; lstItem.DataBind(); clsProductVariation.CommitAndDispose(); ProductUnitsMatrix clsUnit = new ProductUnitsMatrix(); cboUnit.DataTextField = "BottomUnitName"; cboUnit.DataValueField = "BottomUnitID"; cboUnit.DataSource = clsUnit.ListAsDataTable(Convert.ToInt64(lblProductID.Text)).DefaultView; cboUnit.DataBind(); cboUnit.SelectedIndex = cboUnit.Items.Count - 1; clsUnit.CommitAndDispose(); Products clsProduct = new Products(); ProductDetails clsProductDetails = clsProduct.Details(Convert.ToInt64(lblProductID.Text)); lblProductSubGroupID.Text = clsProductDetails.ProductSubGroupID.ToString(); cboUnit.Items.Add(new ListItem(clsProductDetails.BaseUnitName, clsProductDetails.BaseUnitID.ToString())); cboUnit.SelectedIndex = cboUnit.Items.IndexOf(cboUnit.Items.FindByValue(clsProductDetails.BaseUnitID.ToString())); txtProductPrice.Text = clsProductDetails.Price.ToString("#,##0.#0"); txtPrice1.Text = clsProductDetails.Price1.ToString("#,##0.#0"); txtPrice2.Text = clsProductDetails.Price2.ToString("#,##0.#0"); txtPrice3.Text = clsProductDetails.Price3.ToString("#,##0.#0"); txtPrice4.Text = clsProductDetails.Price4.ToString("#,##0.#0"); txtPrice5.Text = clsProductDetails.Price5.ToString("#,##0.#0"); txtWSPrice.Text = clsProductDetails.WSPrice.ToString("#,##0.#0"); txtPurchasePrice.Text = clsProductDetails.PurchasePrice.ToString("#,##0.#0"); decimal decMargin = clsProductDetails.Price - clsProductDetails.PurchasePrice; try { decMargin = decMargin / clsProductDetails.PurchasePrice; } catch { decMargin = 1; } decMargin = decMargin * 100; txtMargin.Text = decMargin.ToString("#,##0.##0"); decMargin = clsProductDetails.WSPrice - clsProductDetails.PurchasePrice; try { decMargin = decMargin / clsProductDetails.PurchasePrice; } catch { decMargin = 1; } decMargin = decMargin * 100; txtWSPriceMarkUp.Text = decMargin.ToString("#,##0.##0"); chkIncludeInSubtotalDiscount.Checked = clsProductDetails.IncludeInSubtotalDiscount; txtVAT.Text = clsProductDetails.VAT.ToString("#,##0.#0"); txtEVAT.Text = clsProductDetails.EVAT.ToString("#,##0.#0"); clsProduct.CommitAndDispose(); string stParam = "?task=" + Common.Encrypt("list", Session.SessionID) + "&prodid=" + Common.Encrypt(lblProductID.Text, Session.SessionID); lnkVariations.NavigateUrl = Constants.ROOT_DIRECTORY + "/MasterFiles/_Product/_Variations/Default.aspx" + stParam; }
private void LoadOptions() { Int64 iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["id"], Session.SessionID)); lblMatrixID.Text = iID.ToString(); Int64 prodID = Convert.ToInt64(Common.Decrypt(Request.QueryString["prodid"],Session.SessionID)); lblProductID.Text = prodID.ToString(); ProductUnitsMatrix clsUnitMatrix = new ProductUnitsMatrix(); cboBottomUnit.DataTextField = "UnitName"; cboBottomUnit.DataValueField = "UnitID"; cboBottomUnit.DataSource = clsUnitMatrix.AvailableUnitsForProduct(prodID).DefaultView; cboBottomUnit.DataBind(); 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; }
protected void cboProductCode_SelectedIndexChanged(object sender, System.EventArgs e) { if (cboProductCode.Items.Count == 0) return; DataClass clsDataClass = new DataClass(); long ProductID = Convert.ToInt64(cboProductCode.SelectedItem.Value); if (ProductID == 0) { cboVariation.Items.Clear(); cboVariation.Items.Add(new ListItem("No Variation", "0")); return; } ProductVariationsMatrix clsProductVariationsMatrix = new ProductVariationsMatrix(); cboVariation.DataTextField = "VariationDesc"; cboVariation.DataValueField = "MatrixID"; cboVariation.DataSource = clsProductVariationsMatrix.BaseListSimpleAsDataTable(ProductID, SortField: "VariationDesc").DefaultView; cboVariation.DataBind(); if (cboVariation.Items.Count == 0) { cboVariation.Items.Add(new ListItem("No Variation", "0")); } cboVariation.SelectedIndex = cboVariation.Items.Count - 1; clsProductVariationsMatrix.CommitAndDispose(); ProductUnitsMatrix clsUnitMatrix = new ProductUnitsMatrix(); cboProductUnit.DataTextField = "BottomUnitCode"; cboProductUnit.DataValueField = "BottomUnitID"; cboProductUnit.DataSource = clsUnitMatrix.ListAsDataTable(ProductID,"a.MatrixID",SortOption.Ascending).DefaultView; cboProductUnit.DataBind(); clsUnitMatrix.CommitAndDispose(); Products clsProduct = new Products(); ProductDetails clsDetails = new ProductDetails(); clsDetails = clsProduct.Details(ProductID); clsProduct.CommitAndDispose(); cboProductUnit.Items.Add( new ListItem(clsDetails.BaseUnitCode, clsDetails.BaseUnitID.ToString())); cboProductUnit.SelectedIndex = cboProductUnit.Items.Count - 1; cboVariation_SelectedIndexChanged(null, null); }
private void LoadOptions() { lblMatrixID.Text = Common.Decrypt((string)Request.QueryString["matrixid"],Session.SessionID); lblProductID.Text = Common.Decrypt((string)Request.QueryString["prodid"],Session.SessionID); ProductUnitsMatrix clsUnit = new ProductUnitsMatrix(); cboUnit.DataTextField = "BottomUnitName"; cboUnit.DataValueField = "BottomUnitID"; cboUnit.DataSource = clsUnit.ListAsDataTable(Convert.ToInt64(lblProductID.Text)).DefaultView; cboUnit.DataBind(); cboUnit.SelectedIndex = cboUnit.Items.Count - 1; clsUnit.CommitAndDispose(); Products clsProduct = new Products(); ProductDetails clsDetails = clsProduct.Details(Convert.ToInt64(lblProductID.Text)); cboUnit.Items.Add(new ListItem(clsDetails.BaseUnitName, clsDetails.BaseUnitID.ToString())); cboUnit.SelectedIndex = cboUnit.Items.IndexOf(cboUnit.Items.FindByValue(clsDetails.BaseUnitID.ToString())); txtProductPrice.Text = clsDetails.Price.ToString("#,##0.#0"); txtPurchasePrice.Text = clsDetails.PurchasePrice.ToString("#,##0.#0"); txtVAT.Text = clsDetails.VAT.ToString("#,##0.#0"); txtEVAT.Text = clsDetails.EVAT.ToString("#,##0.#0"); txtLocalTax.Text = clsDetails.LocalTax.ToString("#,##0.#0"); clsProduct.CommitAndDispose(); }
private void LoadOptions() { DataClass clsDataClass = new DataClass(); lblProductID.Text = Common.Decrypt((string)Request.QueryString["prodid"],Session.SessionID); lblMatrixID.Text = Common.Decrypt(Request.QueryString["id"],Session.SessionID); ProductVariations clsProductVariation = new ProductVariations(); lstItem.DataSource = clsProductVariation.ListAsDataTable(Convert.ToInt64(lblProductID.Text)).DefaultView; lstItem.DataBind(); clsProductVariation.CommitAndDispose(); ProductUnitsMatrix clsProductUnitsMatrix = new ProductUnitsMatrix(); cboUnit.DataTextField = "BottomUnitName"; cboUnit.DataValueField = "BottomUnitID"; cboUnit.DataSource = clsProductUnitsMatrix.ListAsDataTable(Convert.ToInt64(lblProductID.Text)).DefaultView; cboUnit.DataBind(); cboUnit.SelectedIndex = cboUnit.Items.Count - 1; clsProductUnitsMatrix.CommitAndDispose(); Products clsProduct = new Products(); ProductDetails clsDetails = clsProduct.Details(Convert.ToInt64(lblProductID.Text)); cboUnit.Items.Add(new ListItem(clsDetails.BaseUnitName, clsDetails.BaseUnitID.ToString())); clsProduct.CommitAndDispose(); cboUnit.SelectedIndex = cboUnit.Items.Count - 1; lblProductSubGroupID.Text = clsDetails.ProductSubGroupID.ToString(); string stParam = "?task=" + Common.Encrypt("list", Session.SessionID) + "&prodid=" + Common.Encrypt(lblProductID.Text, Session.SessionID); lnkVariations.NavigateUrl = Constants.ROOT_DIRECTORY + "/MasterFiles/_Product/_Variations/Default.aspx" + stParam; }