Пример #1
0
        private void LoadCustomerContactData()
        {
            //populate all phone numbers of the customer
            this.phoneData1.populatePhoneNumber(_custToEdit.CustomerContacts);

            //Populate Email Address
            //Get primary email address
            CustomerEmailVO primaryEmailObj = _custToEdit.getPrimaryEmail();
            string          custPrimaryEmail;

            if (primaryEmailObj.EmailAddress != null)
            {
                custPrimaryEmail = primaryEmailObj.EmailAddress.ToString();
            }
            else
            {
                custPrimaryEmail = string.Empty;
            }
            if (custPrimaryEmail != string.Empty)
            {
                this.primaryEmailTextBox.Text = custPrimaryEmail;
            }


            string          custAlternateEmail;
            CustomerEmailVO alternateEmailObj = _custToEdit.getAlternateEmail();

            if (alternateEmailObj.EmailAddress != null)
            {
                custAlternateEmail = alternateEmailObj.EmailAddress;
            }
            else
            {
                custAlternateEmail = string.Empty;
            }
            if (custAlternateEmail != string.Empty)
            {
                this.alternateEmailTextBox.Text = custAlternateEmail;
            }



            //Set contact permissions
            if (_custToEdit.NoCallFlag == "Y")
            {
                this.checkBoxNoCall.Checked = true;
            }
            if (_custToEdit.NoFaxFlag == "Y")
            {
                this.checkBoxNoFax.Checked = true;
            }
            if (_custToEdit.NoMailFlag == "Y")
            {
                this.checkBoxNoMail.Checked = true;
            }
            if (_custToEdit.NoEmailFlag == "Y")
            {
                this.checkBoxNoEmail.Checked = true;
            }
            if (_custToEdit.OptOutFlag == "Y")
            {
                this.checkBoxOptOut.Checked = true;
            }


            //Set contact reminder
            if (_custToEdit.ReminderContact == "Y")
            {
                this.checkBoxReminder.Checked = true;
            }

            //Set Preferred Contact
            if (_custToEdit.PreferredContactMethod != null)
            {
                string prefContMethod = _custToEdit.PreferredContactMethod;
                if (prefContMethod.Length != 0)
                {
                    foreach (ComboBoxData currData in comboBoxPrefContact.Items)
                    {
                        if (currData.Code == prefContMethod)
                        {
                            comboBoxPrefContact.SelectedIndex = comboBoxPrefContact.Items.IndexOf(currData);
                            break;
                        }
                    }
                }
                else
                {
                    comboBoxPrefContact.SelectedIndex = 0;
                }
            }

            //Set Preferred Call time
            if (_custToEdit.PreferredCallTime != null)
            {
                string prefCallTime = _custToEdit.PreferredCallTime;
                if (prefCallTime.Length != 0)
                {
                    foreach (ComboBoxData currData in comboBoxPrefCallTime.Items)
                    {
                        if (currData.Code == prefCallTime)
                        {
                            comboBoxPrefCallTime.SelectedIndex = comboBoxPrefCallTime.Items.IndexOf(currData);
                            break;
                        }
                    }
                }
                else
                {
                    comboBoxPrefCallTime.SelectedIndex = 0;
                }
            }


            //Set hear about us data
            ComboBox hearAboutUs = (ComboBox)this.hearAboutUs1.Controls[0];

            if (_custToEdit.HearAboutUs != null)
            {
                string strHearAboutUs = _custToEdit.HearAboutUs;
                if (strHearAboutUs.Length != 0)
                {
                    foreach (ComboBoxData currData in hearAboutUs.Items)
                    {
                        if (currData.Code == strHearAboutUs)
                        {
                            hearAboutUs.SelectedIndex = hearAboutUs.Items.IndexOf(currData);
                            break;
                        }
                    }
                }
                else
                {
                    hearAboutUs.SelectedIndex = 0;
                }
            }
            hearAboutUs = null;

            //Set receive promotional offers
            if (_custToEdit.ReceivePromotionOffers != null)
            {
                string promotionalOffers = _custToEdit.ReceivePromotionOffers;
                if (promotionalOffers.Length != 0)
                {
                    foreach (ComboBoxData currData in comboBoxReceivePromotions.Items)
                    {
                        if (currData.Code == promotionalOffers)
                        {
                            comboBoxReceivePromotions.SelectedIndex = comboBoxReceivePromotions.Items.IndexOf(currData);
                            break;
                        }
                    }
                }
                else
                {
                    comboBoxReceivePromotions.SelectedIndex = 0;
                }
            }
        }