예제 #1
0
        void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            _procMsg.Update();
            _procMsg.Close();
            _procMsg.Dispose();
            SetButtonState(true);
            if (_updatePhoneData)
            {
                MessageBox.Show(Commons.GetMessageString("CustContactInfoUpdateSuccess"));
                //Update the customer object with the updated information
                CustomerVO updatedCustomer = new CustomerVO
                {
                    NoCallFlag             = _noCalls,
                    NoEmailFlag            = _noEmails,
                    NoFaxFlag              = _noFaxes,
                    NoMailFlag             = _noMail,
                    OptOutFlag             = _optOut,
                    ReminderContact        = _remindPmtDue,
                    PreferredContactMethod = _preferContact,
                    PreferredCallTime      = _preferCallTime,
                    HearAboutUs            = _howDidYouHear,
                    ReceivePromotionOffers = _receiveOffers
                };

                //set the phone data for the customer

                if (_custPhone != null)
                {
                    foreach (DataRow contact in _custPhone.Rows)
                    {
                        ContactVO custcontact = new ContactVO
                        {
                            TelecomNumType =
                                Utilities.GetStringValue(
                                    contact.ItemArray[
                                        (int)customerphonerecord.TELECOMNUMTYPECODE], ""),
                            ContactAreaCode =
                                Utilities.GetStringValue(
                                    contact.ItemArray[(int)customerphonerecord.AREADIALNUMCODE],
                                    ""),
                            ContactPhoneNumber =
                                Utilities.GetStringValue(
                                    contact.ItemArray[(int)customerphonerecord.TELECOMNUMBER],
                                    ""),
                            ContactExtension =
                                Utilities.GetStringValue(
                                    contact.ItemArray[(int)customerphonerecord.EXTENSIONNUMBER],
                                    ""),
                            ContactType =
                                Utilities.GetStringValue(
                                    contact.ItemArray[(int)customerphonerecord.CONTACTTYPECODE],
                                    ""),
                            TeleusrDefText =
                                Utilities.GetStringValue(
                                    contact.ItemArray[(int)customerphonerecord.TELEUSRDEFTEXT],
                                    ""),
                            CountryDialNumCode =
                                Utilities.GetStringValue(
                                    contact.ItemArray[
                                        (int)customerphonerecord.COUNTRYDIALNUMCODE], "")
                        };
                        updatedCustomer.addContact(custcontact);
                    }
                }
                //Set the Email data for the customer

                if (_custEmail != null)
                {
                    foreach (DataRow email in _custEmail.Rows)
                    {
                        string          emailAddr     = Utilities.GetStringValue(email.ItemArray[(int)customeremailrecord.EMAILADDRESS], "");
                        string          emailAddrType = Utilities.GetStringValue(email.ItemArray[(int)customeremailrecord.EMAILADDRESSTYPECODE], "");
                        string          contactinfoid = Utilities.GetStringValue(email.ItemArray[(int)customeremailrecord.CONTACTINFOID], "");
                        CustomerEmailVO custemail     = new CustomerEmailVO(emailAddr, emailAddrType, contactinfoid);
                        updatedCustomer.addEmail(custemail);
                    }
                }

                Form ownerForm = this.Owner;
                if (ownerForm.GetType() == typeof(ViewCustomerInformation))
                {
                    ((ViewCustomerInformation)ownerForm).UpdatedCustomerToView = updatedCustomer;
                    ((ViewCustomerInformation)ownerForm).ShowUpdates           = true;
                }
            }
        }
예제 #2
0
        private void getContactDetailsFromForm()
        {
            List <ContactVO> customerPhoneNumbers = this.phoneData1.getPhoneData();

            if (this.phoneData1.IsValid)
            {
                _isFormValid = true;
                if (customerPhoneNumbers != null)
                {
                    _numberOfPhoneNumbers = customerPhoneNumbers.Count;
                    //Array inputs
                    _strPrimaryPhone       = new string[_numberOfPhoneNumbers];
                    _strPhoneNumber        = new string[_numberOfPhoneNumbers];
                    _strAreaCode           = new string[_numberOfPhoneNumbers];
                    _strPhoneExtension     = new string[_numberOfPhoneNumbers];
                    _strCountryCode        = new string[_numberOfPhoneNumbers];
                    _strContactType        = new string[_numberOfPhoneNumbers];
                    _strTelecomNumTypeCode = new string[_numberOfPhoneNumbers];
                    int i = 0;
                    foreach (ContactVO phone in customerPhoneNumbers)
                    {
                        _strPrimaryPhone[i]       = phone.TeleusrDefText;
                        _strContactType[i]        = phone.ContactType;
                        _strAreaCode[i]           = phone.ContactAreaCode;
                        _strPhoneNumber[i]        = phone.ContactPhoneNumber;
                        _strPhoneExtension[i]     = phone.ContactExtension;
                        _strCountryCode[i]        = phone.CountryDialNumCode;
                        _strTelecomNumTypeCode[i] = phone.TelecomNumType;
                        i++;
                    }
                }
                else
                {
                    _strPrimaryPhone          = new string[1];
                    _strPhoneNumber           = new string[1];
                    _strAreaCode              = new string[1];
                    _strPhoneExtension        = new string[1];
                    _strCountryCode           = new string[1];
                    _strContactType           = new string[1];
                    _strTelecomNumTypeCode    = new string[1];
                    _strPrimaryPhone[0]       = "";
                    _strPhoneNumber[0]        = "";
                    _strAreaCode[0]           = "";
                    _strPhoneExtension[0]     = "";
                    _strCountryCode[0]        = "";
                    _strContactType[0]        = "";
                    _strTelecomNumTypeCode[0] = "";
                }

                //Get Email Address
                string          strPrimaryEmail   = primaryEmailTextBox.Text;
                string          strAlternateEmail = alternateEmailTextBox.Text;
                CustomerEmailVO customerEmail1    = _custToEdit.getPrimaryEmail();
                CustomerEmailVO customerEmail2    = _custToEdit.getAlternateEmail();

                //When both the email address controls is empty on the form
                if (strPrimaryEmail.Equals(string.Empty) && strAlternateEmail.Equals(string.Empty))
                {
                    //The customer did not have any email address previously
                    if (customerEmail1.EmailAddress == null && customerEmail2.EmailAddress == null)
                    {
                        _custEmails       = new string[1];
                        _custEmails[0]    = "";
                        _custEmailId      = new string[1];
                        _custEmailId[0]   = "";
                        _custEmailType    = new string[1];
                        _custEmailType[0] = "";
                    }
                    //The customer had a primary email before which is being deleted now
                    else if (customerEmail1.EmailAddress != null)
                    {
                        //If the customer does not have an existing alternate email
                        //Pass only primary to delete
                        if (customerEmail2.EmailAddress == null)
                        {
                            _custEmails       = new string[1];
                            _custEmails[0]    = "@DELETE@";
                            _custEmailId      = new string[1];
                            _custEmailId[0]   = customerEmail1.ContactInfoId;
                            _custEmailType    = new string[1];
                            _custEmailType[0] = customerEmail1.EmailAddressType;
                        }
                        //If the customer has alternate email then pass both to delete
                        else
                        {
                            _custEmails       = new string[2];
                            _custEmails[0]    = "@DELETE@";
                            _custEmails[1]    = "@DELETE@";
                            _custEmailId      = new string[2];
                            _custEmailId[0]   = customerEmail1.ContactInfoId;
                            _custEmailId[1]   = customerEmail2.ContactInfoId;
                            _custEmailType    = new string[2];
                            _custEmailType[0] = customerEmail1.EmailAddressType;
                            _custEmailType[1] = customerEmail2.EmailAddressType;
                        }
                    }
                    //The customer had a secondary email but no primary email before and even the
                    //secondary email is being deleted now
                    else if (customerEmail2.EmailAddress != null)
                    {
                        _custEmails       = new string[1];
                        _custEmails[0]    = "@DELETE@";
                        _custEmailId      = new string[1];
                        _custEmailId[0]   = customerEmail2.ContactInfoId;
                        _custEmailType    = new string[1];
                        _custEmailType[0] = customerEmail2.EmailAddressType;
                    }
                }
                else //Both the email controls are not empty on the form
                {
                    //If both the email controls has values on the form pass both the values in the arrays
                    if (!strPrimaryEmail.Equals(string.Empty) && !strAlternateEmail.Equals(string.Empty))
                    {
                        _custEmails    = new string[2];
                        _custEmails[0] = strPrimaryEmail;
                        _custEmails[1] = strAlternateEmail;
                        _custEmailId   = new string[2];
                        if (customerEmail1.ContactInfoId == null)
                        {
                            _custEmailId[0] = "";
                        }
                        else
                        {
                            _custEmailId[0] = customerEmail1.ContactInfoId;
                        }
                        if (customerEmail2.ContactInfoId == null)
                        {
                            _custEmailId[1] = "";
                        }
                        else
                        {
                            _custEmailId[1] = customerEmail2.ContactInfoId;
                        }
                        _custEmailType = new string[2];
                        if (customerEmail1.EmailAddressType == null)
                        {
                            _custEmailType[0] = CustomerEmailTypes.PRIMARY_EMAIL;
                        }
                        else
                        {
                            _custEmailType[0] = customerEmail1.EmailAddressType;
                        }
                        if (customerEmail2.EmailAddressType == null)
                        {
                            _custEmailType[1] = CustomerEmailTypes.SECONDARY_EMAIL;
                        }
                        else
                        {
                            _custEmailType[1] = customerEmail2.EmailAddressType;
                        }
                    }
                    //if primary email on the form does not have value and alternate email
                    //on the form has value
                    else if (strPrimaryEmail.Equals(string.Empty) && !strAlternateEmail.Equals(string.Empty))
                    {
                        //if the customer did not have a primary email before
                        //Only the alternate email values need to be passed to be added
                        if (customerEmail1.EmailAddress == null)
                        {
                            _custEmails    = new string[1];
                            _custEmails[0] = strAlternateEmail;
                            _custEmailId   = new string[1];
                            if (customerEmail2.ContactInfoId == null)
                            {
                                _custEmailId[0] = "";
                            }
                            else
                            {
                                _custEmailId[0] = customerEmail2.ContactInfoId;
                            }
                            _custEmailType    = new string[1];
                            _custEmailType[0] = CustomerEmailTypes.PRIMARY_EMAIL;
                        }
                        //if the user had a primary email before then a value of DELETE needs to be passed
                        //along with the contactinfoid of the primary email in order to delete it
                        else
                        {
                            _custEmails     = new string[2];
                            _custEmails[0]  = "@DELETE@";
                            _custEmails[1]  = strAlternateEmail;
                            _custEmailId    = new string[2];
                            _custEmailId[0] = customerEmail1.ContactInfoId;
                            if (customerEmail2.ContactInfoId == null)
                            {
                                _custEmailId[1] = "";
                            }
                            else
                            {
                                _custEmailId[1] = customerEmail2.ContactInfoId;
                            }
                            _custEmailType    = new string[2];
                            _custEmailType[0] = customerEmail1.EmailAddressType;
                            _custEmailType[1] = CustomerEmailTypes.PRIMARY_EMAIL;
                        }
                    }
                    //if primary email on the form has value and alternate email on the form
                    //does not have value
                    else if (!strPrimaryEmail.Equals(string.Empty) && strAlternateEmail.Equals(string.Empty))
                    {
                        //If the customer did not have alternate email before only the primary email
                        //values need to be passed
                        if (customerEmail2.EmailAddress == null)
                        {
                            _custEmails    = new string[1];
                            _custEmails[0] = strPrimaryEmail;
                            _custEmailId   = new string[1];
                            if (customerEmail1.ContactInfoId == null)
                            {
                                _custEmailId[0] = "";
                            }
                            else
                            {
                                _custEmailId[0] = customerEmail1.ContactInfoId;
                            }
                            _custEmailType = new string[1];
                            if (customerEmail1.EmailAddressType == null)
                            {
                                _custEmailType[0] = CustomerEmailTypes.PRIMARY_EMAIL;
                            }
                            else
                            {
                                _custEmailType[0] = customerEmail1.EmailAddressType;
                            }
                        }
                        //if the customer did have alternate email before then the contactinfoid of that
                        //email along with a value of DELETE in the email array needs to be passed
                        //in order to get it deleted from the database
                        else
                        {
                            _custEmails    = new string[2];
                            _custEmails[0] = strPrimaryEmail;
                            _custEmails[1] = "@DELETE@";
                            _custEmailId   = new string[2];
                            if (customerEmail1.ContactInfoId == null)
                            {
                                _custEmailId[0] = "";
                            }
                            else
                            {
                                _custEmailId[0] = customerEmail1.ContactInfoId;
                            }
                            _custEmailId[1] = customerEmail2.ContactInfoId;
                            _custEmailType  = new string[2];
                            if (customerEmail1.EmailAddressType == null)
                            {
                                _custEmailType[0] = CustomerEmailTypes.PRIMARY_EMAIL;
                            }
                            else
                            {
                                _custEmailType[0] = customerEmail1.EmailAddressType;
                            }
                            _custEmailType[1] = customerEmail2.EmailAddressType;
                        }
                    }
                }
                _noCalls        = checkBoxNoCall.Checked ? "Y" : "N";
                _noEmails       = checkBoxNoEmail.Checked ? "Y" : "N";
                _noFaxes        = checkBoxNoFax.Checked ? "Y" : "N";
                _noMail         = checkBoxNoMail.Checked ? "Y" : "N";
                _optOut         = checkBoxOptOut.Checked ? "Y" : "";
                _remindPmtDue   = checkBoxReminder.Checked ? "Y" : "N";
                _preferContact  = this.comboBoxPrefContact.SelectedValue.ToString();
                _preferCallTime = this.comboBoxPrefCallTime.SelectedValue.ToString();
                ComboBox howdidyouHearAbtUs = (ComboBox)this.hearAboutUs1.Controls[0];
                _howDidYouHear = howdidyouHearAbtUs.SelectedValue.ToString();
                _receiveOffers = comboBoxReceivePromotions.SelectedValue.ToString();
            }
            else
            {
                _isFormValid = false;
            }
        }
예제 #3
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;
                }
            }
        }