Exemplo n.º 1
0
        private bool contactInfoChanged()
        {
            bool phoneDataChanged          = false;
            bool emailDataChanged          = false;
            bool contactPreferencesChanged = false;

            //Check if any of the phone numbers changed
            if (_strTelecomNumTypeCode.Length != _custToEdit.NumberContacts)
            {
                //If the number of phone numbers now is not the same as number of contacts
                //in the customer object then phone number has changed
                phoneDataChanged = true;
            }
            else if (_strTelecomNumTypeCode[0] == "" && _custToEdit.NumberContacts > 0)
            {
                //If the type is empty but the customer object has contacts that implies
                //that we are deleting all of the phone numbers
                phoneDataChanged = true;
            }
            else
            {
                for (int i = 0; i < _strTelecomNumTypeCode.Length; i++)
                {
                    ContactVO custContInfo = _custToEdit.getContact(_strContactType[i], _strAreaCode[i],
                                                                    _strPhoneNumber[i], _strPhoneExtension[i], _strCountryCode[i], _strPrimaryPhone[i]);
                    //If contact object in the current customer's context does not match
                    //the data on the form for one of the types(home,cell,work,pager,fax)
                    //that means phone data has been changed
                    if (custContInfo == null)
                    {
                        phoneDataChanged = true;
                        break;
                    }
                }
            }
            //Check if Email address changed
            string strPrimaryEmail   = _custToEdit.getPrimaryEmail().EmailAddress;
            string strAlternateEmail = _custToEdit.getAlternateEmail().EmailAddress;

            if (strPrimaryEmail != null && strPrimaryEmail != primaryEmailTextBox.Text)
            {
                emailDataChanged = true;
            }
            else if (strPrimaryEmail == null && primaryEmailTextBox.Text.Length > 0)
            {
                emailDataChanged = true;
            }
            if (strAlternateEmail != null && strAlternateEmail != alternateEmailTextBox.Text)
            {
                emailDataChanged = true;
            }
            else if (strAlternateEmail == null && alternateEmailTextBox.Text.Length > 0)
            {
                emailDataChanged = true;
            }


            //Check if contact preferences changed
            if (_custToEdit.NoCallFlag != _noCalls || _custToEdit.NoEmailFlag != _noEmails || _custToEdit.NoFaxFlag != _noFaxes ||
                _custToEdit.NoMailFlag != _noMail || _custToEdit.OptOutFlag != _optOut || _custToEdit.ReminderContact != _remindPmtDue ||
                _custToEdit.PreferredContactMethod != _preferContact || _custToEdit.PreferredCallTime != _preferCallTime ||
                _custToEdit.HearAboutUs != _howDidYouHear || _custToEdit.ReceivePromotionOffers != _receiveOffers)
            {
                contactPreferencesChanged = true;
            }

            if (phoneDataChanged || emailDataChanged || contactPreferencesChanged)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }