private void LoadOptions() { DataClass clsDataClass = new DataClass(); Contacts clsContact = new Contacts(); cboContactCode.DataTextField = "ContactName"; cboContactCode.DataValueField = "ContactID"; cboContactCode.DataSource = clsContact.AgentsAsDataTable(null, 0, "ContactCode",SortOption.Ascending); cboContactCode.DataBind(); cboContactCode.Items.Add(new ListItem("Summarized", "0")); cboContactCode.SelectedIndex = cboContactCode.Items.Count - 1; cboReportType.Items.Add(new ListItem("Summarized Report", "0")); cboReportType.Items.Add(new ListItem("Summarized With Details", "1")); cboReportType.SelectedIndex = cboReportType.Items.Count - 1; Positions clsPosition = new Positions(clsContact.Connection, clsContact.Transaction); cboPosition.DataTextField = "PositionName"; cboPosition.DataValueField = "PositionID"; cboPosition.DataSource = clsPosition.ListAsDataTable(null, SortOption.Ascending, 0); cboPosition.DataBind(); cboPosition.Items.Add(new ListItem(Positions.DEFAULT_ALL_POSITIONS, "0")); cboPosition.SelectedIndex = cboPosition.Items.Count - 1; Department clsDepartment = new Department(clsContact.Connection, clsContact.Transaction); cboDepartment.DataTextField = "DepartmentName"; cboDepartment.DataValueField = "DepartmentID"; cboDepartment.DataSource = clsDepartment.ListAsDataTable(); cboDepartment.DataBind(); cboDepartment.Items.Add(new ListItem(Department.DEFAULT_ALL_DEPARTMENTS, "0")); cboDepartment.SelectedIndex = cboDepartment.Items.Count - 1; clsContact.CommitAndDispose(); txtStartTransactionDate.Text = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"); txtEndTransactionDate.Text = DateTime.Now.ToString("yyyy-MM-dd"); }
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); } }
protected void imgAgentSearch_Click(object sender, System.Web.UI.ImageClickEventArgs e) { cboAgent.Items.Clear(); Contacts clsContact = new Contacts(); cboAgent.DataTextField = "ContactName"; cboAgent.DataValueField = "ContactID"; cboAgent.DataSource = clsContact.AgentsAsDataTable(txtAgent.Text, 0, "ContactName", SortOption.Ascending); cboAgent.DataBind(); if (string.IsNullOrEmpty(txtAgent.Text)) cboAgent.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING)); else cboAgent.Items.Insert(0, new ListItem(Constants.ALL + " LIKE " + txtAgent.Text, Constants.ZERO_STRING)); cboAgent.SelectedIndex = 0; clsContact.CommitAndDispose(); }
private void LoadOptions() { Int64 UID = Convert.ToInt64(Session["UID"]); Security.AccessRights clsAccessRights = new Security.AccessRights(); Security.AccessRightsDetails clsDetails = clsAccessRights.Details(UID,(int) AccessTypes.SummarizedDailySalesWithTFDetailed); clsAccessRights.CommitAndDispose(); cboReportType.Items.Clear(); cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION, ReportTypes.REPORT_SELECTION)); cboReportType.Items.Add(new ListItem(ReportTypes.SummarizeDailySales, ReportTypes.SummarizeDailySales)); if (clsDetails.Read) cboReportType.Items.Add(new ListItem(ReportTypes.SalesPerDay, ReportTypes.SalesPerDay)); if (cboReportType.Items.Count == 2) cboReportType.Items.RemoveAt(cboReportType.Items.IndexOf(cboReportType.Items.FindByValue(ReportTypes.REPORT_SELECTION))); cboReportType.SelectedIndex = 0; cboConsignment.Items.Clear(); cboConsignment.Items.Add(new ListItem("Both", "-1")); cboConsignment.Items.Add(new ListItem("Yes", true.ToString())); cboConsignment.Items.Add(new ListItem("No", false.ToString())); cboTransactionStatus.Items.Clear(); foreach(string status in Enum.GetNames(typeof(TransactionStatus))) { cboTransactionStatus.Items.Add(new ListItem(status, status)); } cboTransactionStatus.SelectedIndex = cboTransactionStatus.Items.IndexOf( cboTransactionStatus.Items.FindByText(TransactionStatus.NotYetApplied.ToString())); cboPaymentType.Items.Clear(); foreach(string PaymentType in Enum.GetNames(typeof(PaymentTypes))) { cboPaymentType.Items.Add(new ListItem(PaymentType, PaymentType)); } cboPaymentType.SelectedIndex = cboPaymentType.Items.IndexOf( cboPaymentType.Items.FindByText(PaymentTypes.NotYetAssigned.ToString())); txtStartTransactionDate.Text = Common.ToShortDateString(DateTime.Now.AddDays(-1)); txtEndTransactionDate.Text = Common.ToShortDateString(DateTime.Now); Customer clsCustomer = new Customer(); cboContactName.DataTextField = "ContactName"; cboContactName.DataValueField = "ContactID"; cboContactName.DataSource = clsCustomer.CustomersDataTable(txtContactName.Text, 0, false, "ContactName", SortOption.Ascending); cboContactName.DataBind(); if (string.IsNullOrEmpty(txtContactName.Text)) cboContactName.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING)); else cboContactName.Items.Insert(0, new ListItem(Constants.ALL + " LIKE " + txtContactName.Text, Constants.ZERO_STRING)); cboContactName.SelectedIndex = 0; cboAgent.Items.Clear(); Contacts clsContact = new Contacts(clsCustomer.Connection, clsCustomer.Transaction); cboAgent.DataTextField = "ContactName"; cboAgent.DataValueField = "ContactID"; cboAgent.DataSource = clsContact.AgentsAsDataTable(txtAgent.Text, 0, "ContactName", SortOption.Ascending); cboAgent.DataBind(); if (string.IsNullOrEmpty(txtAgent.Text)) cboAgent.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING)); else cboAgent.Items.Insert(0, new ListItem(Constants.ALL + " LIKE " + txtAgent.Text, Constants.ZERO_STRING)); cboAgent.SelectedIndex = 0; Terminal clsTerminal = new Terminal(clsCustomer.Connection, clsCustomer.Transaction); cboTerminalNo.DataTextField = "TerminalNo"; cboTerminalNo.DataValueField = "TerminalNo"; cboTerminalNo.DataSource = clsTerminal.ListAsDataTable(); cboTerminalNo.DataBind(); cboTerminalNo.Items.Insert(0, new ListItem(Constants.ALL, Constants.ALL)); cboTerminalNo.SelectedIndex = 0; Branch clsBranch = new Branch(clsCustomer.Connection, clsCustomer.Transaction); cboBranch.DataTextField = "BranchCode"; cboBranch.DataValueField = "BranchID"; cboBranch.DataSource = clsBranch.ListAsDataTable(OnlyIncludeIneSales: true).DefaultView; cboBranch.DataBind(); cboBranch.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING)); cboBranch.SelectedIndex = 0; Security.AccessUser clsAccessUser = new Security.AccessUser(clsCustomer.Connection, clsCustomer.Transaction); cboCashierName.DataTextField = "Name"; cboCashierName.DataValueField = "UID"; cboCashierName.DataSource = clsAccessUser.Cashiers(txtCashierName.Text, 0); cboCashierName.DataBind(); if (string.IsNullOrEmpty(txtCashierName.Text)) cboCashierName.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING)); else cboCashierName.Items.Insert(0, new ListItem(Constants.ALL + " LIKE " + txtCashierName.Text, Constants.ZERO_STRING)); cboCashierName.SelectedIndex = 0; ProductGroup clsProductGroup = new ProductGroup(clsCustomer.Connection, clsCustomer.Transaction); cboProductGroup.DataTextField = "ProductGroupName"; cboProductGroup.DataValueField = "ProductGroupName"; cboProductGroup.DataSource = clsProductGroup.ListAsDataTable(SortField:"ProductGroupName"); cboProductGroup.DataBind(); cboProductGroup.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING)); cboProductGroup.SelectedIndex = 0; clsCustomer.CommitAndDispose(); #region Sales Per Day cboMonth.Items.Add(new ListItem("January", "1")); cboMonth.Items.Add(new ListItem("February", "2")); cboMonth.Items.Add(new ListItem("March", "3")); cboMonth.Items.Add(new ListItem("April", "4")); cboMonth.Items.Add(new ListItem("May", "5")); cboMonth.Items.Add(new ListItem("June", "6")); cboMonth.Items.Add(new ListItem("July", "7")); cboMonth.Items.Add(new ListItem("August", "8")); cboMonth.Items.Add(new ListItem("September", "9")); cboMonth.Items.Add(new ListItem("October", "10")); cboMonth.Items.Add(new ListItem("November", "11")); cboMonth.Items.Add(new ListItem("Decemeber", "12")); cboMonth.SelectedIndex = DateTime.Now.Month - 1; int x = 2007; while (x <= DateTime.Now.Year) { cboYear.Items.Add(new ListItem(x.ToString(), x.ToString())); x++; } cboYear.SelectedIndex = cboYear.Items.Count - 1; #endregion }
private void LoadOptions() { ContactGroups clsContactGroup = new ContactGroups(); cboGroup.DataTextField = "ContactGroupName"; cboGroup.DataValueField = "ContactGroupID"; cboGroup.DataSource = clsContactGroup.ListAsDataTable().DefaultView; cboGroup.DataBind(); cboGroup.SelectedIndex = 0; //cboGroup.Items.Count - 1; cboGroup.SelectedIndex = cboGroup.Items.IndexOf(cboGroup.Items.FindByValue(ContactGroupCategory.CUSTOMER.ToString("d"))); Department clsDepartment = new Department(clsContactGroup.Connection, clsContactGroup.Transaction); cboDepartment.DataTextField = "DepartmentName"; cboDepartment.DataValueField = "DepartmentID"; cboDepartment.DataSource = clsDepartment.ListAsDataTable().DefaultView; cboDepartment.DataBind(); cboDepartment.SelectedIndex = 0; Positions clsPosition = new Positions(clsContactGroup.Connection, clsContactGroup.Transaction); cboPosition.DataTextField = "PositionName"; cboPosition.DataValueField = "PositionID"; cboPosition.DataSource = clsPosition.ListAsDataTable("PositionName", SortOption.Ascending, 0).DefaultView; cboPosition.DataBind(); cboPosition.SelectedIndex = 0; Salutation clsSalutation = new Salutation(clsContactGroup.Connection, clsContactGroup.Transaction); cboSalutation.DataTextField = "SalutationName"; cboSalutation.DataValueField = "SalutationCode"; cboSalutation.DataSource = clsSalutation.ListAsDataTable().DefaultView; cboSalutation.DataBind(); cboSalutation.SelectedIndex = 0; cboSalutation.SelectedIndex = cboSalutation.Items.IndexOf(cboSalutation.Items.FindByValue("MR")); Contacts clsContacts = new Contacts(clsContactGroup.Connection, clsContactGroup.Transaction); cboSoldBy.DataTextField = "ContactName"; cboSoldBy.DataValueField = "ContactCode"; cboSoldBy.DataSource = clsContacts.AgentsAsDataTable(SortField: "ContactName").DefaultView; cboSoldBy.DataBind(); cboSoldBy.SelectedIndex = 0; Security.AccessUser clsAccessUser = new Security.AccessUser(clsContactGroup.Connection, clsContactGroup.Transaction); cboConfirmedBy.DataTextField = "Name"; cboConfirmedBy.DataValueField = "Name"; cboConfirmedBy.DataSource = clsAccessUser.ListAsDataTable(SortField: "Name").DefaultView; cboConfirmedBy.DataBind(); cboConfirmedBy.SelectedIndex = 0; Security.Country clsCountry = new Security.Country(clsContactGroup.Connection, clsContactGroup.Transaction); cboCountry.DataTextField = "CountryName"; cboCountry.DataValueField = "CountryID"; cboCountry.DataSource = clsCountry.ListAsDataTable().DefaultView; cboCountry.DataBind(); cboCountry.SelectedIndex = 0; clsContactGroup.CommitAndDispose(); }
private void LoadOptions() { Int64 UID = Convert.ToInt64(Session["UID"]); Security.AccessRights clsAccessRights = new Security.AccessRights(); cboReportType.Items.Clear(); cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION, ReportTypes.REPORT_SELECTION)); if (clsAccessRights.Details(UID, (int)AccessTypes.SummarizedDailySales).Read) { cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR)); cboReportType.Items.Add(new ListItem(ReportTypes.SummarizeDailySales, ReportTypes.SummarizeDailySales)); cboReportType.Items.Add(new ListItem(ReportTypes.SalesPerDay, ReportTypes.SalesPerDay)); } //if (clsAccessRights.Details(UID, (int)AccessTypes.SummarizedDailySalesWithTF).Read) //{ // cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR)); // cboReportType.Items.Add(new ListItem(ReportTypes.SummarizeDailySalesWithTF, ReportTypes.SummarizeDailySalesWithTF)); // cboReportType.Items.Add(new ListItem(ReportTypes.SalesPerDayWithTF, ReportTypes.SalesPerDayWithTF)); //} if (clsAccessRights.Details(UID, (int)AccessTypes.SalesTransactionReport).Read) { cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR)); cboReportType.Items.Add(new ListItem(ReportTypes.SalesPerHour, ReportTypes.SalesPerHour)); cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR)); cboReportType.Items.Add(new ListItem(ReportTypes.SalesTransactions, ReportTypes.SalesTransactions)); cboReportType.Items.Add(new ListItem(ReportTypes.SalesTransactionPerCustomer, ReportTypes.SalesTransactionPerCustomer)); cboReportType.Items.Add(new ListItem(ReportTypes.SalesTransactionPerCustomerPerGroup, ReportTypes.SalesTransactionPerCustomerPerGroup)); cboReportType.Items.Add(new ListItem(ReportTypes.SalesTransactionPerCustomerPerGroupSummarized, ReportTypes.SalesTransactionPerCustomerPerGroupSummarized)); cboReportType.Items.Add(new ListItem(ReportTypes.SalesTransactionPerCustomerWithCheque, ReportTypes.SalesTransactionPerCustomerWithCheque)); cboReportType.Items.Add(new ListItem(ReportTypes.SalesTransactionPerCustomerPerItem, ReportTypes.SalesTransactionPerCustomerPerItem)); cboReportType.Items.Add(new ListItem(ReportTypes.SalesTransactionPerCashier, ReportTypes.SalesTransactionPerCashier)); cboReportType.Items.Add(new ListItem(ReportTypes.SalesTransactionPerCashierPerCustomer, ReportTypes.SalesTransactionPerCashierPerCustomer)); cboReportType.Items.Add(new ListItem(ReportTypes.SalesTransactionPerTerminal, ReportTypes.SalesTransactionPerTerminal)); if (clsAccessRights.Details(UID, (int)AccessTypes.SalesTransactionPerItem).Read) { cboReportType.Items.Add(new ListItem(ReportTypes.SalesTransactionPerItem, ReportTypes.SalesTransactionPerItem)); } if (clsAccessRights.Details(UID, (int)AccessTypes.SalesTransactionPerItemWoutPurchaseDetails).Read) { cboReportType.Items.Add(new ListItem(ReportTypes.SalesTransactionPerItemWoutPurchaseDetails, ReportTypes.SalesTransactionPerItemWoutPurchaseDetails)); } cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR)); cboReportType.Items.Add(new ListItem(ReportTypes.CashSalesDaily, ReportTypes.CashSalesDaily)); cboReportType.Items.Add(new ListItem(ReportTypes.CashSalesMonthly, ReportTypes.CashSalesMonthly)); cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR)); cboReportType.Items.Add(new ListItem(ReportTypes.ChequePaymentList, ReportTypes.ChequePaymentList)); cboReportType.Items.Add(new ListItem(ReportTypes.ChequeSalesDaily, ReportTypes.ChequeSalesDaily)); cboReportType.Items.Add(new ListItem(ReportTypes.ChequeSalesMonthly, ReportTypes.ChequeSalesMonthly)); cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR)); cboReportType.Items.Add(new ListItem(ReportTypes.CreditCardSalesDaily, ReportTypes.CreditCardSalesDaily)); cboReportType.Items.Add(new ListItem(ReportTypes.CreditCardSalesMonthly, ReportTypes.CreditCardSalesMonthly)); cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR)); cboReportType.Items.Add(new ListItem(ReportTypes.DailySalesTransaction, ReportTypes.DailySalesTransaction)); cboReportType.Items.Add(new ListItem(ReportTypes.WeeklySalesTransaction, ReportTypes.WeeklySalesTransaction)); cboReportType.Items.Add(new ListItem(ReportTypes.MonthlySalesTransaction, ReportTypes.MonthlySalesTransaction)); } if (clsAccessRights.Details(UID, (int)AccessTypes.PaidOutDisburseROC).Read) { cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR)); cboReportType.Items.Add(new ListItem(ReportTypes.PaidOut, ReportTypes.PaidOut)); cboReportType.Items.Add(new ListItem(ReportTypes.Disburse, ReportTypes.Disburse)); cboReportType.Items.Add(new ListItem(ReportTypes.RecieveOnAccount, ReportTypes.RecieveOnAccount)); } cboReportType.SelectedIndex = 0; clsAccessRights.CommitAndDispose(); cboConsignment.Items.Clear(); cboConsignment.Items.Add(new ListItem("Both", "-1")); cboConsignment.Items.Add(new ListItem("Yes", true.ToString())); cboConsignment.Items.Add(new ListItem("No", false.ToString())); cboTransactionStatus.Items.Clear(); foreach(string status in Enum.GetNames(typeof(TransactionStatus))) { cboTransactionStatus.Items.Add(new ListItem(status, status)); } cboTransactionStatus.SelectedIndex = cboTransactionStatus.Items.IndexOf( cboTransactionStatus.Items.FindByText(TransactionStatus.NotYetApplied.ToString())); cboPaymentType.Items.Clear(); foreach(string PaymentType in Enum.GetNames(typeof(PaymentTypes))) { cboPaymentType.Items.Add(new ListItem(PaymentType, PaymentType)); } cboPaymentType.SelectedIndex = cboPaymentType.Items.IndexOf( cboPaymentType.Items.FindByText(PaymentTypes.NotYetAssigned.ToString())); txtStartValidityDate.Text = Common.ToShortDateString(DateTime.Now); txtEndValidityDate.Text = Common.ToShortDateString(DateTime.Now.AddDays(30)); txtStartTransactionDate.Text = Common.ToShortDateString(DateTime.Now.AddDays(-1)); txtEndTransactionDate.Text = Common.ToShortDateString(DateTime.Now); Customer clsCustomer = new Customer(); cboContactName.DataTextField = "ContactName"; cboContactName.DataValueField = "ContactID"; cboContactName.DataSource = clsCustomer.CustomersDataTable(txtContactName.Text, 0, false, "ContactName", SortOption.Ascending); cboContactName.DataBind(); if (string.IsNullOrEmpty(txtContactName.Text)) cboContactName.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING)); else cboContactName.Items.Insert(0, new ListItem(Constants.ALL + " LIKE " + txtContactName.Text, Constants.ZERO_STRING)); cboContactName.SelectedIndex = 0; ContactGroups clsContactGroups = new ContactGroups(clsCustomer.Connection, clsCustomer.Transaction); cboContactGroupName.DataTextField = "ContactGroupName"; cboContactGroupName.DataValueField = "ContactGroupID"; cboContactGroupName.DataSource = clsContactGroups.ListAsDataTable(ContactGroupCategory.CUSTOMER, txtContactGroupName.Text); cboContactGroupName.DataBind(); if (string.IsNullOrEmpty(txtContactName.Text)) cboContactGroupName.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING)); else cboContactGroupName.Items.Insert(0, new ListItem(Constants.ALL + " LIKE " + txtContactGroupName.Text, Constants.ZERO_STRING)); cboContactGroupName.SelectedIndex = 0; cboAgent.Items.Clear(); Contacts clsContact = new Contacts(clsCustomer.Connection, clsCustomer.Transaction); cboAgent.DataTextField = "ContactName"; cboAgent.DataValueField = "ContactID"; cboAgent.DataSource = clsContact.AgentsAsDataTable(txtAgent.Text, 0, "ContactName", SortOption.Ascending); cboAgent.DataBind(); if (string.IsNullOrEmpty(txtAgent.Text)) cboAgent.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING)); else cboAgent.Items.Insert(0, new ListItem(Constants.ALL + " LIKE " + txtAgent.Text, Constants.ZERO_STRING)); cboAgent.SelectedIndex = 0; Terminal clsTerminal = new Terminal(clsCustomer.Connection, clsCustomer.Transaction); cboTerminalNo.DataTextField = "TerminalNo"; cboTerminalNo.DataValueField = "TerminalNo"; cboTerminalNo.DataSource = clsTerminal.ListAsDataTable(); cboTerminalNo.DataBind(); cboTerminalNo.Items.Insert(0, new ListItem(Constants.ALL, Constants.ALL)); cboTerminalNo.SelectedIndex = 0; Branch clsBranch = new Branch(clsCustomer.Connection, clsCustomer.Transaction); cboBranch.DataTextField = "BranchCode"; cboBranch.DataValueField = "BranchID"; cboBranch.DataSource = clsBranch.ListAsDataTable().DefaultView; cboBranch.DataBind(); cboBranch.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING)); cboBranch.SelectedIndex = 0; Security.AccessUser clsAccessUser = new Security.AccessUser(clsCustomer.Connection, clsCustomer.Transaction); cboCashierName.DataTextField = "Name"; cboCashierName.DataValueField = "UID"; cboCashierName.DataSource = clsAccessUser.Cashiers(txtCashierName.Text, 0); cboCashierName.DataBind(); if (string.IsNullOrEmpty(txtCashierName.Text)) cboCashierName.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING)); else cboCashierName.Items.Insert(0, new ListItem(Constants.ALL + " LIKE " + txtCashierName.Text, Constants.ZERO_STRING)); cboCashierName.SelectedIndex = 0; ProductGroup clsProductGroup = new ProductGroup(clsCustomer.Connection, clsCustomer.Transaction); cboProductGroup.DataTextField = "ProductGroupName"; cboProductGroup.DataValueField = "ProductGroupName"; cboProductGroup.DataSource = clsProductGroup.ListAsDataTable(SortField:"ProductGroupName"); cboProductGroup.DataBind(); cboProductGroup.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING)); cboProductGroup.SelectedIndex = 0; clsCustomer.CommitAndDispose(); #region Sales Per Day cboMonth.Items.Add(new ListItem("January", "1")); cboMonth.Items.Add(new ListItem("February", "2")); cboMonth.Items.Add(new ListItem("March", "3")); cboMonth.Items.Add(new ListItem("April", "4")); cboMonth.Items.Add(new ListItem("May", "5")); cboMonth.Items.Add(new ListItem("June", "6")); cboMonth.Items.Add(new ListItem("July", "7")); cboMonth.Items.Add(new ListItem("August", "8")); cboMonth.Items.Add(new ListItem("September", "9")); cboMonth.Items.Add(new ListItem("October", "10")); cboMonth.Items.Add(new ListItem("November", "11")); cboMonth.Items.Add(new ListItem("Decemeber", "12")); cboMonth.SelectedIndex = DateTime.Now.Month - 1; int x = 2007; while (x <= DateTime.Now.Year) { cboYear.Items.Add(new ListItem(x.ToString(), x.ToString())); x++; } cboYear.SelectedIndex = cboYear.Items.Count - 1; #endregion }
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); } }