Esempio n. 1
0
        private void LoadOptions()
        {
            DataClass clsDataClass = new DataClass();

            Contacts clsContact = new Contacts();

            cboContactCode.DataTextField  = "ContactCode";
            cboContactCode.DataValueField = "ContactCode";
            cboContactCode.DataSource     = clsContact.ListAsDataTable("ContactCode", SortOption.Ascending);
            cboContactCode.DataBind();
            cboContactCode.Items.Add(new ListItem("All Codes", "0"));
            cboContactCode.SelectedIndex = cboContactCode.Items.Count - 1;

            cboContactName.DataTextField  = "ContactName";
            cboContactName.DataValueField = "ContactName";
            cboContactName.DataSource     = clsContact.ListAsDataTable("ContactName", SortOption.Ascending);
            cboContactName.DataBind();
            cboContactName.Items.Add(new ListItem("All Contacts", "0"));
            cboContactName.SelectedIndex = cboContactName.Items.Count - 1;

            clsContact.CommitAndDispose();

            ContactGroups clsContactGroup = new ContactGroups();

            cboGroup.DataTextField  = "ContactGroupName";
            cboGroup.DataValueField = "ContactGroupID";
            cboGroup.DataSource     = clsDataClass.DataReaderToDataTable(clsContactGroup.List("ContactGroupName", SortOption.Ascending));
            cboGroup.DataBind();
            cboGroup.Items.Add(new ListItem("All Contact Groups", "0"));
            cboGroup.SelectedIndex = cboGroup.Items.Count - 1;

            clsContactGroup.CommitAndDispose();

            cboDeleted.SelectedIndex = cboDeleted.Items.Count - 1;
        }
Esempio n. 2
0
        private void LoadOptions()
        {
            ContactGroups clsContactGroup = new ContactGroups();

            cboGroup.DataTextField  = "ContactGroupName";
            cboGroup.DataValueField = "ContactGroupID";
            cboGroup.DataSource     = clsContactGroup.ListAsDataTable().DefaultView;
            cboGroup.DataBind();
            cboGroup.SelectedIndex = cboGroup.Items.Count - 1;

            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;

            clsContactGroup.CommitAndDispose();
        }
Esempio n. 3
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();
        }
Esempio n. 4
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)
            {
                ContactGroups clsContactGroup = new ContactGroups();
                clsContactGroup.Delete(stIDs.Substring(0, stIDs.Length - 1));
                clsContactGroup.CommitAndDispose();
            }

            return(boRetValue);
        }
Esempio n. 5
0
        private void LoadRecord()
        {
            Int32               iID             = Convert.ToInt32(Common.Decrypt(Request.QueryString["id"], Session.SessionID));
            ContactGroups       clsContactGroup = new ContactGroups();
            ContactGroupDetails clsDetails      = clsContactGroup.Details(iID);

            clsContactGroup.CommitAndDispose();

            lblContactGroupID.Text   = clsDetails.ContactGroupID.ToString();
            txtContactGroupCode.Text = clsDetails.ContactGroupCode;
            txtContactGroupName.Text = clsDetails.ContactGroupName;
            cboContactGroupCategory.SelectedIndex = Convert.ToInt16(clsDetails.ContactGroupCategory) - 1;
        }
Esempio n. 6
0
        private void SaveRecord()
        {
            ContactGroupDetails clsDetails = new ContactGroupDetails();

            clsDetails.ContactGroupID       = Convert.ToInt16(lblContactGroupID.Text);
            clsDetails.ContactGroupCode     = txtContactGroupCode.Text;
            clsDetails.ContactGroupName     = txtContactGroupName.Text;
            clsDetails.ContactGroupCategory = (ContactGroupCategory)Enum.Parse(typeof(ContactGroupCategory), cboContactGroupCategory.SelectedItem.Value);

            ContactGroups clsContactGroup = new ContactGroups();

            clsContactGroup.Update(clsDetails);
            clsContactGroup.CommitAndDispose();
        }
Esempio n. 7
0
        private Int32 SaveRecord()
        {
            ContactGroupDetails clsDetails = new ContactGroupDetails();

            clsDetails.ContactGroupCode     = txtContactGroupCode.Text;
            clsDetails.ContactGroupName     = txtContactGroupName.Text;
            clsDetails.ContactGroupCategory = (ContactGroupCategory)Enum.Parse(typeof(ContactGroupCategory), cboContactGroupCategory.SelectedItem.Value);

            ContactGroups clsContactGroup = new ContactGroups();
            Int32         id = clsContactGroup.Insert(clsDetails);

            clsContactGroup.CommitAndDispose();

            return(id);
        }
Esempio n. 8
0
        private void LoadOptions()
        {
            ContactGroups clsContactGroup = new ContactGroups();

            cboGroup.DataTextField  = "ContactGroupName";
            cboGroup.DataValueField = "ContactGroupID";
            cboGroup.DataSource     = clsContactGroup.ListAsDataTable(ContactGroupCategory.CUSTOMER).DefaultView;
            cboGroup.DataBind();
            cboGroup.Items.Insert(0, new ListItem(Constants.PLEASE_SELECT, "0"));
            cboGroup.SelectedIndex = 0;

            clsContactGroup.CommitAndDispose();

            cboModeOfTerms.Items.Insert(0, new ListItem(Constants.PLEASE_SELECT, "-1"));
            cboModeOfTerms.SelectedIndex = 0;
        }
Esempio n. 9
0
        protected void imgCustomerGroupSearch_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            ContactGroups clsContactGroup = new ContactGroups();

            cboCustomerGroup.DataTextField  = "ContactGroupName";
            cboCustomerGroup.DataValueField = "ContactGroupCode";
            cboCustomerGroup.DataSource     = clsContactGroup.ListAsDataTable(ContactGroupCategory.CUSTOMER, txtCustomerGroup.Text.TrimEnd());
            cboCustomerGroup.DataBind();
            cboCustomerGroup.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING));
            if (cboCustomerGroup.Items.Count > 1 && txtCustomerGroup.Text.Trim() != string.Empty)
            {
                cboCustomerGroup.SelectedIndex = 1;
            }
            else
            {
                cboCustomerGroup.SelectedIndex = 0;
            }
            clsContactGroup.CommitAndDispose();
        }
Esempio n. 10
0
        //protected void imgTerminalNoSearch_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        //{
        //    Terminal clsTerminal = new Terminal();
        //    cboTerminalNo.DataTextField = "TerminalNo";
        //    cboTerminalNo.DataValueField = "TerminalNo";
        //    cboTerminalNo.DataSource = clsTerminal.ListAsDataTable(txtTerminalNo.Text);
        //    cboTerminalNo.DataBind();
        //    cboTerminalNo.Items.Insert(0, new ListItem(Constants.ALL, Constants.ALL));
        //    if (cboTerminalNo.Items.Count > 1 && txtTerminalNo.Text.Trim() != string.Empty) cboTerminalNo.SelectedIndex = 1; else cboTerminalNo.SelectedIndex = 0;
        //    clsTerminal.CommitAndDispose();
        //}

        protected void imgContactGroupNameSearch_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            ContactGroups clsContactGroups = new ContactGroups();

            cboContactGroupName.DataTextField  = "ContactGroupName";
            cboContactGroupName.DataValueField = "ContactGroupID";
            cboContactGroupName.DataSource     = clsContactGroups.ListAsDataTable(ContactGroupCategory.CUSTOMER, txtContactGroupName.Text);
            cboContactGroupName.DataBind();
            clsContactGroups.CommitAndDispose();
            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;
        }
Esempio n. 11
0
        protected void lstItem_ItemCommand(object sender, DataListCommandEventArgs e)
        {
            HtmlInputCheckBox chkList = (HtmlInputCheckBox)e.Item.FindControl("chkList");
            string            stParam = string.Empty;

            switch (e.CommandName)
            {
            case "imgItemDelete":
                ContactGroups clsContactGroup = new ContactGroups();
                clsContactGroup.Delete(chkList.Value);
                clsContactGroup.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;
            }
        }
Esempio n. 12
0
        private void LoadOptions()
        {
            lblContactID.Text = Common.Decrypt(Request.QueryString["id"], Session.SessionID);

            ContactGroups clsContactGroup = new ContactGroups();

            cboGroup.DataTextField  = "ContactGroupName";
            cboGroup.DataValueField = "ContactGroupID";
            cboGroup.DataSource     = clsContactGroup.ListAsDataTable().DefaultView;
            cboGroup.DataBind();
            cboGroup.SelectedIndex = cboGroup.Items.Count - 1;

            Department clsDepartment = new Department(clsContactGroup.Connection, clsContactGroup.Transaction);

            cboDepartment.DataTextField  = "DepartmentName";
            cboDepartment.DataValueField = "DepartmentID";
            cboDepartment.DataSource     = clsDepartment.ListAsDataTable("DepartmentName", SortOption.Ascending, 0).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;


            Billing clsBilling = new Billing(clsContactGroup.Connection, clsContactGroup.Transaction);

            cboBillingDate.DataTextField  = "BillingDate";
            cboBillingDate.DataValueField = "BillingFile";
            cboBillingDate.DataSource     = clsBilling.ListBillingDateAsDataTable(long.Parse(lblContactID.Text)).DefaultView;
            cboBillingDate.DataBind();
            cboBillingDate.Items.Insert(0, new ListItem(Constants.PLEASE_SELECT, Constants.PLEASE_SELECT));
            cboBillingDate.SelectedIndex = 0;

            clsContactGroup.CommitAndDispose();
        }
Esempio n. 13
0
        private void LoadOptions()
        {
            Int64 iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["id"], Session.SessionID));

            lblContactID.Text = iID.ToString();

            ContactGroups clsContactGroup = new ContactGroups();

            cboGroup.DataTextField  = "ContactGroupName";
            cboGroup.DataValueField = "ContactGroupID";
            cboGroup.DataSource     = clsContactGroup.ListAsDataTable(ContactGroupCategory.CUSTOMER).DefaultView;
            cboGroup.DataBind();
            cboGroup.SelectedIndex = cboGroup.Items.Count - 1;

            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;

            cboCreditCardStatus.Items.Clear();
            foreach (CreditCardStatus selection in Enum.GetValues(typeof(CreditCardStatus)))
            {
                cboCreditCardStatus.Items.Add(new ListItem(selection.ToString("G"), selection.ToString("d")));
            }
            cboCreditCardStatus.SelectedIndex = cboCreditCardStatus.Items.IndexOf(cboCreditCardStatus.Items.FindByValue(CreditCardStatus.All.ToString("d")));

            Data.CardType clsCardType = new Data.CardType(clsContactGroup.Connection, clsContactGroup.Transaction);
            cboCreditCardType.Items.Clear();
            cboCreditCardType.DataTextField  = "CardTypeName";
            cboCreditCardType.DataValueField = "CardTypeID";
            cboCreditCardType.DataSource     = clsCardType.ListAsDataTable(new CardTypeDetails(CreditCardTypes.Internal)).DefaultView;
            cboCreditCardType.DataBind();
            cboCreditCardType.SelectedIndex = 0;

            Billing clsBilling = new Billing(clsContactGroup.Connection, clsContactGroup.Transaction);

            cboBillingDate.DataTextField  = "BillingDate";
            cboBillingDate.DataValueField = "BillingFile";
            cboBillingDate.DataSource     = clsBilling.ListBillingDateAsDataTable(CreditType.Group, long.Parse(lblContactID.Text), limit: 10).DefaultView;
            cboBillingDate.DataBind();
            cboBillingDate.Items.Insert(0, new ListItem(Constants.PLEASE_SELECT, Constants.PLEASE_SELECT));
            cboBillingDate.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"));

            clsContactGroup.CommitAndDispose();

            if (Request.QueryString["showbills"] != null)
            {
                if (!bool.Parse(Common.Decrypt(Request.QueryString["showbills"].ToString(), Session.SessionID)))
                {
                    lblBillingSeparator.Visible = false;
                    labelBilling.Visible        = false;
                    cboBillingDate.Visible      = false;
                    imgPrintBilling.Visible     = false;
                    cmdPrintBilling.Visible     = false;
                }
            }
        }
Esempio n. 14
0
        private void LoadList()
        {
            ContactGroups clsContactGroup = new ContactGroups();
            DataClass     clsDataClass    = new DataClass();

            string SortField = "ContactGroupID";

            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 = clsDataClass.DataReaderToDataTable(clsContactGroup.List(SortField, sortoption)).DefaultView;
            }
            else
            {
                string SearchKey = Common.Decrypt((string)Request.QueryString["search"], Session.SessionID);
                PageData.DataSource = clsDataClass.DataReaderToDataTable(clsContactGroup.Search(SearchKey, SortField, sortoption)).DefaultView;
            }

            clsContactGroup.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;
        }