コード例 #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;
                }
            }
        }