private void LoadOptions() { DataClass clsDataClass = new DataClass(); lblGroupID.Text = Common.Decrypt((string)Request.QueryString["groupid"], Session.SessionID); ProductGroupVariations clsProductGroupVariation = new ProductGroupVariations(); lstItem.DataSource = clsDataClass.DataReaderToDataTable(clsProductGroupVariation.List(Convert.ToInt32(lblGroupID.Text), "VariationType", SortOption.Ascending)).DefaultView; lstItem.DataBind(); clsProductGroupVariation.CommitAndDispose(); Data.Unit clsUnit = new Data.Unit(); cboUnit.DataTextField = "UnitName"; cboUnit.DataValueField = "UnitID"; cboUnit.DataSource = clsUnit.ListAsDataTable(SortField: "UnitName").DefaultView; cboUnit.DataBind(); cboUnit.SelectedIndex = cboUnit.Items.Count - 1; clsUnit.CommitAndDispose(); ProductGroup clsProductGroup = new ProductGroup(); ProductGroupDetails clsProductGroupDetails = clsProductGroup.Details(Convert.ToInt32(lblGroupID.Text)); clsProductGroup.CommitAndDispose(); cboUnit.SelectedIndex = cboUnit.Items.IndexOf(cboUnit.Items.FindByValue(clsProductGroupDetails.UnitDetails.UnitID.ToString())); txtProductPrice.Text = clsProductGroupDetails.Price.ToString("#,##0.#0"); txtProductPrice.Text = clsProductGroupDetails.Price.ToString("#,##0.#0"); txtPurchasePrice.Text = clsProductGroupDetails.PurchasePrice.ToString("#,##0.#0"); chkIncludeInSubtotalDiscount.Checked = clsProductGroupDetails.IncludeInSubtotalDiscount; txtVAT.Text = clsProductGroupDetails.VAT.ToString("#,##0.#0"); txtEVAT.Text = clsProductGroupDetails.EVAT.ToString("#,##0.#0"); txtLocalTax.Text = clsProductGroupDetails.LocalTax.ToString("#,##0.#0"); }
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) { ProductGroup clsProductGroup = new ProductGroup(); clsProductGroup.Delete(stIDs.Substring(0, stIDs.Length - 1)); clsProductGroup.CommitAndDispose(); } return(boRetValue); }
private void LoadOptions() { if (mboIsPriceInq) { this.lblHeader.Text = "Item: Price Inquiry"; } else { this.lblHeader.Text = "Select Item to purchase"; } ProductGroup clsProductGroup = new ProductGroup(); System.Data.DataTable dtaProductGroup = clsProductGroup.ListAsDataTable(SortField: "ProductGroupCode"); clsProductGroup.CommitAndDispose(); lstGroup.Items.Clear(); int iImgCtr = 0; foreach (System.Data.DataRow dr in dtaProductGroup.Rows) { lstGroup.Items.Add(dr["ProductGroupCode"].ToString(), dr["ProductGroupCode"].ToString(), iImgCtr); if (iImgCtr == 7) { iImgCtr = 0; } else { iImgCtr++; } } try { lstGroup.Items[0].Selected = true; }catch { } }
private void LoadOptions() { ProductGroup clsProductGroup = new ProductGroup(); cboGroup.DataTextField = "ProductGroupName"; cboGroup.DataValueField = "ProductGroupID"; cboGroup.DataSource = clsProductGroup.ListAsDataTable(); cboGroup.DataBind(); cboGroup.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING)); cboGroup.SelectedIndex = 0; ProductSubGroupColumns clsProductSubGroupColumns = new ProductSubGroupColumns() { ColumnsNameID = true }; ProductSubGroup clsSubGroup = new ProductSubGroup(clsProductGroup.Connection, clsProductGroup.Transaction); cboSubGroup.DataTextField = "ProductSubGroupName"; cboSubGroup.DataValueField = "ProductSubGroupID"; cboSubGroup.DataSource = clsSubGroup.ListAsDataTable(clsProductSubGroupColumns, SortField: "ProductSubGroupName", SortOrder: System.Data.SqlClient.SortOrder.Ascending); cboSubGroup.DataBind(); cboSubGroup.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING)); cboSubGroup.SelectedIndex = 0; clsProductGroup.CommitAndDispose(); }
private void LoadOptions() { ProductGroup clsProductGroup = new ProductGroup(); DataClass clsDataClass = new DataClass(); cboGroup.DataTextField = "ProductGroupName"; cboGroup.DataValueField = "ProductGroupID"; cboGroup.DataSource = clsProductGroup.ListAsDataTable(SortField: "ProductGroupName").DefaultView; cboGroup.DataBind(); cboGroup.SelectedIndex = cboGroup.Items.Count - 1; Data.Unit clsUnit = new Data.Unit(); cboProductSubGroupUnit.DataTextField = "UnitName"; cboProductSubGroupUnit.DataValueField = "UnitID"; cboProductSubGroupUnit.DataSource = clsUnit.ListAsDataTable(SortField: "UnitName").DefaultView; cboProductSubGroupUnit.DataBind(); cboProductSubGroupUnit.SelectedIndex = cboProductSubGroupUnit.Items.Count - 1; clsUnit.CommitAndDispose(); if (cboGroup.Items.Count != 0) { Int32 BaseUnitID = clsProductGroup.Details(Convert.ToInt32(cboGroup.SelectedItem.Value)).UnitDetails.UnitID; cboProductSubGroupUnit.SelectedIndex = cboProductSubGroupUnit.Items.IndexOf(cboProductSubGroupUnit.Items.FindByValue(BaseUnitID.ToString())); } clsProductGroup.CommitAndDispose(); }
protected void Page_Load(object sender, System.EventArgs e) { const string defaultHeading = "Master Files"; string stHeading = defaultHeading; const string defaultTitle = "List of Product Sub Group Variation Combinations"; SiteTitle.Title = defaultTitle; const SearchCategoryID defaultSearchIndex = SearchCategoryID.ProductSubGroups; SearchCategoryID SearchIndex = defaultSearchIndex; HorizontalNavBar.PageNavigatorid = HorizontalNavID.MasterFiles; if (Request.QueryString["task"] != null) { ProductGroup clsProductGroup = new ProductGroup(); ProductGroupDetails clsDetails = new ProductGroupDetails(); int id = Convert.ToInt16(Common.Decrypt(Request.QueryString["subgroupid"].ToString(), Session.SessionID)); clsDetails = clsProductGroup.Details(id); clsProductGroup.CommitAndDispose(); string groupCode = " for Product Sub Group Code : " + clsDetails.ProductGroupName; string task = Common.Decrypt(Request.QueryString["task"].ToString(), Session.SessionID); switch (task) { case "add": stHeading = "Create New Product Sub Group Variation Combination"; SearchIndex = SearchCategoryID.ProductVariations; ctrlInsert.Visible = true; break; case "edit": stHeading = "Modify Product Sub Group Variation Combination"; SearchIndex = SearchCategoryID.ProductVariations; ctrlUpdate.Visible = true; break; case "list": stHeading = "Product Sub Group Variation Combinations List"; SearchIndex = SearchCategoryID.ProductVariations; ctrlList.Visible = true; break; case "details": stHeading = "Sub Group Variation Details"; SearchIndex = SearchCategoryID.ProductVariations; ctrlDetails.Visible = true; break; default: break; } LargeHeading.Text = stHeading + groupCode; RightBodySectionSearch.SearchIDSelectedItem = SearchIndex; } }
protected void cboGroup_SelectedIndexChanged(object sender, System.EventArgs e) { if (cboGroup.Items.Count != 0) { ProductGroup clsProductGroup = new ProductGroup(); Int32 BaseUnitID = clsProductGroup.Details(Convert.ToInt32(cboGroup.SelectedItem.Value)).UnitDetails.UnitID; cboProductSubGroupUnit.SelectedIndex = cboProductSubGroupUnit.Items.IndexOf(cboProductSubGroupUnit.Items.FindByValue(BaseUnitID.ToString())); clsProductGroup.CommitAndDispose(); } }
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 void LoadOptionsProducts() { ProductGroup clsProductGroup = new ProductGroup(); cboGroup.DataTextField = "ProductGroupName"; cboGroup.DataValueField = "ProductGroupID"; cboGroup.DataSource = clsProductGroup.ListAsDataTable(); cboGroup.DataBind(); cboGroup.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING)); cboGroup.SelectedIndex = 0; clsProductGroup.CommitAndDispose(); cboGroup_SelectedIndexChanged(null, null); }
private void LoadOptions() { DataClass clsDataClass = new DataClass(); 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; 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; //// Added July 9, 2010 // Remove Nov 22, 2011 - overwritten when a subgroup is selected //Terminal clsTerminal = new Terminal(clsProductGroup.Connection, clsProductGroup.Transaction); //TerminalDetails clsTerminalDetails = clsTerminal.Details(1); //txtWSPriceMarkUp.Text = clsTerminalDetails.WSPriceMarkUp.ToString(); //txtMargin.Text = clsTerminalDetails.RETPriceMarkUp.ToString(); //txtVAT.Text = clsTerminalDetails.VAT.ToString("###.#0"); //txtEVAT.Text = clsTerminalDetails.EVAT.ToString("###.#0"); //txtLocalTax.Text = clsTerminalDetails.LocalTax.ToString("###.#0"); clsProductGroup.CommitAndDispose(); cboProductGroup_SelectedIndexChanged(null, null); }
protected void cboGroup_SelectedIndexChanged(object sender, System.EventArgs e) { if (cboGroup.Items.Count != 0) { ProductGroup clsProductGroup = new ProductGroup(); ProductGroupDetails clsProductGroupDetails = clsProductGroup.Details(Convert.ToInt32(cboGroup.SelectedItem.Value)); cboProductSubGroupUnit.SelectedIndex = cboProductSubGroupUnit.Items.IndexOf(cboProductSubGroupUnit.Items.FindByValue(clsProductGroupDetails.UnitDetails.UnitID.ToString())); txtProductPrice.Text = clsProductGroupDetails.Price.ToString("#,##0.#0"); txtPurchasePrice.Text = clsProductGroupDetails.PurchasePrice.ToString("#,##0.#0"); chkIncludeInSubtotalDiscount.Checked = clsProductGroupDetails.IncludeInSubtotalDiscount; txtVAT.Text = clsProductGroupDetails.VAT.ToString("#,##0.#0"); txtEVAT.Text = clsProductGroupDetails.EVAT.ToString("#,##0.#0"); txtLocalTax.Text = clsProductGroupDetails.LocalTax.ToString("#,##0.#0"); clsProductGroup.CommitAndDispose(); } }
private void LoadRecord() { Int64 iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["id"], Session.SessionID)); ProductGroup clsProductGroup = new ProductGroup(); ProductGroupDetails clsDetails = clsProductGroup.Details(iID); clsProductGroup.CommitAndDispose(); lblProductGroupID.Text = clsDetails.ProductGroupID.ToString(); txtProductGroupCode.Text = clsDetails.ProductGroupCode; txtProductGroupName.Text = clsDetails.ProductGroupName; cboProductGroupUnit.SelectedIndex = cboProductGroupUnit.Items.IndexOf(cboProductGroupUnit.Items.FindByText(clsDetails.UnitDetails.UnitName)); txtProductPrice.Text = clsDetails.Price.ToString("#,##0.#0"); txtPurchasePrice.Text = clsDetails.PurchasePrice.ToString("#,##0.#0"); chkIncludeInSubtotalDiscount.Checked = clsDetails.IncludeInSubtotalDiscount; txtVAT.Text = clsDetails.VAT.ToString("#,##0.#0"); txtEVAT.Text = clsDetails.EVAT.ToString("#,##0.#0"); txtLocalTax.Text = clsDetails.LocalTax.ToString("#,##0.#0"); }
protected void imgProductGroupSearch_Click(object sender, System.Web.UI.ImageClickEventArgs e) { ProductGroup clsProductGroup = new ProductGroup(); cboProductGroup.DataTextField = "ProductGroupName"; cboProductGroup.DataValueField = "ProductGroupID"; cboProductGroup.DataSource = clsProductGroup.ListAsDataTable(txtProductGroup.Text).DefaultView; cboProductGroup.DataBind(); cboProductGroup.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING)); if (cboProductGroup.Items.Count > 1 && txtProductGroup.Text.Trim() != string.Empty) { cboProductGroup.SelectedIndex = 1; } else { cboProductGroup.SelectedIndex = 0; } clsProductGroup.CommitAndDispose(); }
protected void cboProductGroup_SelectedIndexChanged(object sender, System.EventArgs e) { try { LoadSubGroup(); if (cboProductGroup.SelectedItem.Value != Constants.ZERO_STRING) { ProductGroup clsProductGroup = new ProductGroup(); ProductGroupDetails clsProductGroupDetails = clsProductGroup.Details(long.Parse(cboProductGroup.SelectedItem.Value)); clsProductGroup.CommitAndDispose(); txtVAT.Text = clsProductGroupDetails.VAT.ToString("#,##0.#0"); txtEVAT.Text = clsProductGroupDetails.EVAT.ToString("#,##0.#0"); txtLocalTax.Text = clsProductGroupDetails.LocalTax.ToString("#,##0.#0"); } } catch (Exception ex) { throw ex; } }
private void LoadOptions() { ProductGroup clsProductGroup = new ProductGroup(); cboGroup.DataTextField = "ProductGroupName"; cboGroup.DataValueField = "ProductGroupID"; cboGroup.DataSource = clsProductGroup.ListAsDataTable(); cboGroup.DataBind(); cboGroup.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING)); cboGroup.SelectedIndex = 0; ProductSubGroupColumns clsProductSubGroupColumns = new ProductSubGroupColumns() { ColumnsNameID = true }; ProductSubGroup clsSubGroup = new ProductSubGroup(clsProductGroup.Connection, clsProductGroup.Transaction); cboSubGroup.DataTextField = "ProductSubGroupName"; cboSubGroup.DataValueField = "ProductSubGroupID"; cboSubGroup.DataSource = clsSubGroup.ListAsDataTable(clsProductSubGroupColumns, SortField: "ProductSubGroupName", SortOrder: System.Data.SqlClient.SortOrder.Ascending); cboSubGroup.DataBind(); cboSubGroup.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING)); cboSubGroup.SelectedIndex = 0; Contacts clsContact = new Contacts(clsProductGroup.Connection, clsProductGroup.Transaction); cboSupplier.DataTextField = "ContactName"; cboSupplier.DataValueField = "ContactID"; cboSupplier.DataSource = clsContact.SuppliersAsDataTable(string.Empty, 0, "ContactName", SortOption.Ascending); cboSupplier.DataBind(); cboSupplier.Items.Add(new ListItem(Constants.ALL, Constants.ZERO_STRING)); cboSupplier.SelectedIndex = cboSupplier.Items.Count - 1; clsProductGroup.CommitAndDispose(); txtStartTransactionDate.Text = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"); txtEndTransactionDate.Text = DateTime.Now.ToString("yyyy-MM-dd"); }
private void SaveRecord() { ProductGroupDetails clsDetails = new ProductGroupDetails(); clsDetails.ProductGroupID = Convert.ToInt64(lblProductGroupID.Text); clsDetails.ProductGroupCode = txtProductGroupCode.Text; clsDetails.ProductGroupName = txtProductGroupName.Text; clsDetails.UnitDetails = new UnitDetails { UnitID = Convert.ToInt32(cboProductGroupUnit.SelectedItem.Value) }; clsDetails.Price = Convert.ToDecimal(txtProductPrice.Text); clsDetails.PurchasePrice = Convert.ToDecimal(txtPurchasePrice.Text); clsDetails.IncludeInSubtotalDiscount = chkIncludeInSubtotalDiscount.Checked; clsDetails.VAT = Convert.ToDecimal(txtVAT.Text); clsDetails.EVAT = Convert.ToDecimal(txtEVAT.Text); clsDetails.LocalTax = Convert.ToDecimal(txtLocalTax.Text); ProductGroup clsProductGroup = new ProductGroup(); clsProductGroup.Update(clsDetails); clsProductGroup.CommitAndDispose(); }
private void LoadOptions() { DataClass clsDataClass = new DataClass(); Int64 groupid = Convert.ToInt64(Common.Decrypt(Request.QueryString["groupid"].ToString(), Session.SessionID)); lblGroupID.Text = Convert.ToString(groupid); ProductGroupUnitsMatrix clsUnitMatrix = new ProductGroupUnitsMatrix(); ProductGroupUnitsMatrixDetails clsUnitDetails = clsUnitMatrix.LastDetails(groupid); if (clsUnitDetails.BottomUnitName == null) { ProductGroup clsProductGroup = new ProductGroup(); ProductGroupDetails clsDetails = clsProductGroup.Details(groupid); clsProductGroup.CommitAndDispose(); txtBaseUnit.Text = clsDetails.UnitDetails.UnitName; lblBaseUnitID.Text = clsDetails.UnitDetails.UnitID.ToString(); } else { txtBaseUnit.Text = clsUnitDetails.BottomUnitName; lblBaseUnitID.Text = Convert.ToString(clsUnitDetails.BottomUnitID); } cboBottomUnit.DataTextField = "UnitName"; cboBottomUnit.DataValueField = "UnitID"; cboBottomUnit.DataSource = clsDataClass.DataReaderToDataTable(clsUnitMatrix.AvailableUnitsForProduct(groupid, "UnitName", SortOption.Ascending)).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(); }
protected void lstItem_ItemCommand(object source, System.Web.UI.WebControls.DataListCommandEventArgs e) { HtmlInputCheckBox chkList = null; string stParam = string.Empty; chkList = (HtmlInputCheckBox)e.Item.FindControl("chkList"); stParam = "?task=" + Common.Encrypt("list", Session.SessionID) + "&groupid=" + Common.Encrypt(chkList.Value, Session.SessionID); switch (e.CommandName) { case "imgItemDelete": ProductGroup clsProductGroup = new ProductGroup(); clsProductGroup.Delete(chkList.Value); clsProductGroup.CommitAndDispose(); LoadList(); break; case "imgItemEdit": stParam = "?task=" + Common.Encrypt("edit", Session.SessionID) + "&id=" + Common.Encrypt(chkList.Value, Session.SessionID); Response.Redirect("Default.aspx" + stParam); break; case "imgVariationsClick": Response.Redirect(Constants.ROOT_DIRECTORY + "/MasterFiles/_ProductGroup/_Variations/Default.aspx" + stParam); break; case "imgVariationsMatrixClick": Response.Redirect(Constants.ROOT_DIRECTORY + "/MasterFiles/_ProductGroup/_VariationsMatrix/Default.aspx" + stParam); break; case "imgUnitsMatrixClick": Response.Redirect(Constants.ROOT_DIRECTORY + "/MasterFiles/_ProductGroup/_UnitsMatrix/Default.aspx" + stParam); break; } }
private void LoadOptions() { ProductGroup clsProductGroup = new ProductGroup(); DataClass clsDataClass = new DataClass(); cboGroup.DataTextField = "ProductGroupName"; cboGroup.DataValueField = "ProductGroupID"; cboGroup.DataSource = clsProductGroup.ListAsDataTable(SortField: "ProductGroupName").DefaultView; cboGroup.DataBind(); cboGroup.SelectedIndex = cboGroup.Items.Count - 1; cboGroup_SelectedIndexChanged(null, System.EventArgs.Empty); Data.Unit clsUnit = new Data.Unit(); cboProductSubGroupUnit.DataTextField = "UnitName"; cboProductSubGroupUnit.DataValueField = "UnitID"; cboProductSubGroupUnit.DataSource = clsUnit.ListAsDataTable(SortField: "UnitName").DefaultView; cboProductSubGroupUnit.DataBind(); cboProductSubGroupUnit.SelectedIndex = cboProductSubGroupUnit.Items.Count - 1; Terminal clsTerminal = new Terminal(clsUnit.Connection, clsUnit.Transaction); TerminalDetails clsTerminalDetails = clsTerminal.Details(Int32.Parse(Session["BranchID"].ToString()), Session["TerminalNo"].ToString()); txtVAT.Text = clsTerminalDetails.VAT.ToString("###.#0"); txtEVAT.Text = clsTerminalDetails.EVAT.ToString("###.#0"); txtLocalTax.Text = clsTerminalDetails.LocalTax.ToString("###.#0"); clsUnit.CommitAndDispose(); if (cboGroup.Items.Count != 0) { Int32 BaseUnitID = clsProductGroup.Details(Convert.ToInt32(cboGroup.SelectedItem.Value)).UnitDetails.UnitID; cboProductSubGroupUnit.SelectedIndex = cboProductSubGroupUnit.Items.IndexOf(cboProductSubGroupUnit.Items.FindByValue(BaseUnitID.ToString())); } clsProductGroup.CommitAndDispose(); }
private void LoadList() { ProductGroup clsProductGroup = new ProductGroup(); DataClass clsDataClass = new DataClass(); string SortField = "a.ProductGroupID"; 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); } string SearchKey = ""; if (Request.QueryString["Search"] != null) { SearchKey = Common.Decrypt((string)Request.QueryString["search"], Session.SessionID); } PageData.DataSource = clsProductGroup.ListAsDataTable(SearchKey, SortField, sortoption).DefaultView; clsProductGroup.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; }
private void SaveRecord() { long lProductGroupID = Convert.ToInt64(cboProductGroup.SelectedItem.Value); long lProductSubGroupID = Convert.ToInt64(cboProductSubGroup.SelectedItem.Value); long lProductID = Convert.ToInt64(cboProduct.SelectedItem.Value); int iChartOfAccountIDPurchase = Convert.ToInt32(cboChartOfAccountPurchase.SelectedItem.Value); int iChartOfAccountIDSold = Convert.ToInt32(cboChartOfAccountSold.SelectedItem.Value); int iChartOfAccountIDInventory = Convert.ToInt32(cboChartOfAccountInventory.SelectedItem.Value); int iChartOfAccountIDTaxPurchase = Convert.ToInt32(cboChartOfAccountIDTaxPurchase.SelectedItem.Value); int iChartOfAccountIDTaxSold = Convert.ToInt32(cboChartOfAccountIDTaxSold.SelectedItem.Value); ProductGroup clsProductGroup = new ProductGroup(); clsProductGroup.GetConnection(); ProductSubGroup clsProductSubGroup = new ProductSubGroup(clsProductGroup.Connection, clsProductGroup.Transaction); Products clsProduct = new Products(clsProductGroup.Connection, clsProductGroup.Transaction); if (lProductGroupID == 0) { clsProductGroup.UpdateFinancialInformation(iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold); if (lProductSubGroupID == 0) { clsProductSubGroup.UpdateFinancialInformation(iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold); if (lProductID == 0) { clsProduct.UpdateFinancialInformation(iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold); } else { clsProduct.UpdateFinancialInformation(lProductID, iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold); } } else if (lProductSubGroupID > 0) { clsProductSubGroup.UpdateFinancialInformation(lProductSubGroupID, iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold); if (lProductID == 0) { clsProduct.UpdateFinancialInformationBySubGroup(lProductSubGroupID, iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold); } else { clsProduct.UpdateFinancialInformation(lProductID, iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold); } } } else { clsProductGroup.UpdateFinancialInformation(lProductGroupID, iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold); if (lProductSubGroupID == 0) { clsProductSubGroup.UpdateFinancialInformationByGroup(lProductGroupID, iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold); if (lProductID == 0) { clsProduct.UpdateFinancialInformationByGroup(lProductGroupID, iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold); } else { clsProduct.UpdateFinancialInformation(lProductID, iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold); } } else if (lProductSubGroupID > 0) { clsProductSubGroup.UpdateFinancialInformation(lProductSubGroupID, iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold); if (lProductID == 0) { clsProduct.UpdateFinancialInformationBySubGroup(lProductSubGroupID, iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold); } else { clsProduct.UpdateFinancialInformation(lProductID, iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold); } } } clsProductGroup.CommitAndDispose(); }