private void LoadOptions() { Contacts clsContact = new Contacts(); cboContact.DataTextField = "ContactName"; cboContact.DataValueField = "ContactID"; cboContact.DataSource = clsContact.CustomersDataTable(txtContactCode.Text).DefaultView; cboContact.DataBind(); cboContact.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING)); cboContact.Items.Insert(1, new ListItem(Constants.PLUSCARDMEMBERS, Constants.PLUSCARDMEMBERSID_STRING)); cboContact.Items.Insert(2, new ListItem(Constants.ICCARDMEMBERS, Constants.ICCARDMEMBERSID_STRING)); cboContact.Items.Insert(3, new ListItem(Constants.GCCARDMEMBERS, Constants.GCCARDMEMBERSID_STRING)); cboContact.SelectedIndex = 0; ProductGroup clsProductGroup = new ProductGroup(clsContact.Connection, clsContact.Transaction); cboProductGroup.DataTextField = "ProductGroupName"; cboProductGroup.DataValueField = "ProductGroupID"; cboProductGroup.DataSource = clsProductGroup.ListAsDataTable(txtProductGroupCode.Text, "ProductGroupName").DefaultView; cboProductGroup.DataBind(); cboProductGroup.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING)); cboProductGroup.SelectedIndex = 0; clsContact.CommitAndDispose(); cboProductGroup_SelectedIndexChanged(null, System.EventArgs.Empty); txtQuantity.Text = "1"; txtPromoValue.Text = "0"; }
private void LoadContactData() { Contacts clsContact = new Contacts(); try { string searchkey = "" + txtSearch.Text; System.Data.DataTable dt; if (mContactGroupCategory == ContactGroupCategory.AGENT) dt = clsContact.AgentsAsDataTable(searchkey, 100, "ContactName", SortOption.Ascending); else dt = clsContact.CustomersDataTable(searchkey, 100, HasCreditOnly, "ContactName", SortOption.Ascending); clsContact.CommitAndDispose(); this.dgStyle.MappingName = dt.TableName; dgContacts.DataSource = dt; dgContacts.Select(0); dgContacts.CurrentRowIndex=0; } catch (IndexOutOfRangeException){} catch (Exception ex) { clsContact.CommitAndDispose(); MessageBox.Show(ex.Message,"RetailPlus",MessageBoxButtons.OK,MessageBoxIcon.Error); } }
private void LoadOptions() { DataClass clsDataClass = new DataClass(); Contacts clsContact = new Contacts(); cboCustomer.DataTextField = "ContactName"; cboCustomer.DataValueField = "ContactID"; cboCustomer.DataSource = clsContact.CustomersDataTable(null).DefaultView; cboCustomer.DataBind(); clsContact.CommitAndDispose(); cboCustomer.SelectedIndex = 0; cboCustomer_SelectedIndexChanged(null, null); Branch clsBranch = new Branch(); cboBranch.DataTextField = "BranchCode"; cboBranch.DataValueField = "BranchID"; cboBranch.DataSource = clsBranch.ListAsDataTable().DefaultView; cboBranch.DataBind(); clsBranch.CommitAndDispose(); cboBranch.SelectedIndex = cboBranch.Items.IndexOf(cboBranch.Items.FindByValue(Constants.BRANCH_ID_MAIN.ToString())); cboBranch_SelectedIndexChanged(null, null); }
protected void imgContactCodeSearch_Click(object sender, System.Web.UI.ImageClickEventArgs e) { Contacts clsContact = new Contacts(); cboContact.DataTextField = "ContactName"; cboContact.DataValueField = "ContactID"; cboContact.DataSource = clsContact.CustomersDataTable(txtContactCode.Text).DefaultView; cboContact.DataBind(); cboContact.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING)); cboContact.Items.Insert(1, new ListItem(Constants.PLUSCARDMEMBERS, Constants.PLUSCARDMEMBERSID_STRING)); cboContact.Items.Insert(2, new ListItem(Constants.ICCARDMEMBERS, Constants.ICCARDMEMBERSID_STRING)); cboContact.Items.Insert(3, new ListItem(Constants.GCCARDMEMBERS, Constants.GCCARDMEMBERSID_STRING)); if (cboContact.Items.Count > 4) cboContact.SelectedIndex = 4; else cboContact.SelectedIndex = 0; clsContact.CommitAndDispose(); }
private void LoadContactData() { Contacts clsContact = new Contacts(); try { string searchkey = "" + txtSearch.Text; System.Data.DataTable dt; if (mContactGroupCategory == ContactGroupCategory.AGENT) dt = clsContact.AgentsAsDataTable(searchkey, 50, "ContactName", SortOption.Ascending); else dt = clsContact.CustomersDataTable(searchkey, 50, HasCreditOnly, "ContactName", SortOption.Ascending); if (!TerminalDetails.ShowCustomerSelection && dt.Rows.Count == 0) { Data.ContactDetails clsContactDetails = clsContact.DetailsByCreditCardNo(txtSearch.Text); //remove this coz it's slow //if (clsContactDetails.ContactID == 0 && txtSearch.Text.Length == 7) clsContactDetails = clsContact.DetailsByCreditCardNo("888880" + txtSearch.Text); //if (clsContactDetails.ContactID == 0 && txtSearch.Text.Length == 7) clsContactDetails = clsContact.DetailsByCreditCardNo("800000" + txtSearch.Text); //if (clsContactDetails.ContactID == 0 && txtSearch.Text.Length == 9) clsContactDetails = clsContact.DetailsByCreditCardNo(BarcodeHelper.GroupCreditCard_Country_Code + BarcodeHelper.GroupCreditCard_ManufacturerCode + txtSearch.Text); //if (clsContactDetails.ContactID == 0 && txtSearch.Text.Length == 9) clsContactDetails = clsContact.DetailsByCreditCardNo(BarcodeHelper.CustomerCode_Country_Code + BarcodeHelper.CustomerCode_ManufacturerCode + txtSearch.Text); //if (clsContactDetails.ContactID == 0 && txtSearch.Text.Length == 9) clsContactDetails = clsContact.DetailsByCreditCardNo(BarcodeHelper.GroupCreditCard_Country_Code + BarcodeHelper.GroupCreditCard_ManufacturerCode_Manual + txtSearch.Text); //if (clsContactDetails.ContactID == 0 && txtSearch.Text.Length == 9) clsContactDetails = clsContact.DetailsByCreditCardNo(BarcodeHelper.CreditCard_Country_Code + BarcodeHelper.CreditCard_ManufacturerCode + txtSearch.Text); if (clsContactDetails.ContactID != 0) { searchkey = clsContactDetails.ContactCode; if (mContactGroupCategory == ContactGroupCategory.AGENT) dt = clsContact.AgentsAsDataTable(searchkey, 50, "ContactName", SortOption.Ascending); else dt = clsContact.CustomersDataTable(searchkey, 50, HasCreditOnly, "ContactName", SortOption.Ascending); } } clsContact.CommitAndDispose(); this.dgStyle.MappingName = dt.TableName; dgContacts.DataSource = dt; dgContacts.Select(0); dgContacts.CurrentRowIndex=0; } catch (IndexOutOfRangeException){} catch (Exception ex) { clsContact.CommitAndDispose(); MessageBox.Show(ex.Message,"RetailPlus",MessageBoxButtons.OK,MessageBoxIcon.Error); } }
private void LoadList() { Contacts clsContact = new Contacts(); DataClass clsDataClass = new DataClass(); string SortField = "ContactID"; 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); } if (Request.QueryString["Search"]==null) { PageData.DataSource = clsContact.CustomersDataTable(null,0,false,SortField, sortoption).DefaultView; } else { string SearchKey = Common.Decrypt((string)Request.QueryString["search"],Session.SessionID); PageData.DataSource = clsContact.CustomersDataTable(SearchKey, 0, false, SortField, sortoption).DefaultView; } clsContact.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; }