예제 #1
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, 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);
            }
        }
예제 #2
0
        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();
        }
예제 #3
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);
            }
        }
예제 #4
0
        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();
        }
예제 #5
0
        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");
        }
예제 #6
0
        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));
            cboReportType.Items.Add(new ListItem(ReportTypes.MANAGEMENT_PerBranch, ReportTypes.MANAGEMENT_PerBranch));
            cboReportType.Items.Add(new ListItem(ReportTypes.MANAGEMENT_PerBranchPerMonth, ReportTypes.MANAGEMENT_PerBranchPerMonth));
            cboReportType.Items.Add(new ListItem(ReportTypes.MANAGEMENT_PerBranchPerMonthWithCovers, ReportTypes.MANAGEMENT_PerBranchPerMonthWithCovers));
            cboReportType.Items.Add(new ListItem(ReportTypes.MANAGEMENT_PerBranchPerDay, ReportTypes.MANAGEMENT_PerBranchPerDay));
            cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR));
            cboReportType.Items.Add(new ListItem(ReportTypes.MANAGEMENT_PerCustomerGroupPerDay, ReportTypes.MANAGEMENT_PerCustomerGroupPerDay));
            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().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
        }