private void addCustomerButton_Click(object sender, EventArgs e)
        {
            string trigger = GlobalDataAccessor.Instance.DesktopSession.HistorySession.Trigger;
            //CashlinxDesktopSession.Instance.FormState = CashlinxDesktopSession.CustomerFormStates.ADDCUSTOMER;
            //CustomerController.NavigateUser(ownerFrm);
            var newCustomer = new CustomerVO
            {
                NewCustomer = true
            };
            //get the Search criteria entered by the user
            var searchCriteria = GlobalDataAccessor.Instance.DesktopSession.ActiveLookupCriteria;

            //Get store state from desktop session
            var strStoreState = string.Empty;

            strStoreState = GlobalDataAccessor.Instance.CurrentSiteId.State;
            var newAddr = new AddressVO
            {
                State_Code         = strStoreState,
                ContactTypeCode    = CustomerAddressTypes.HOME_ADDRESS,
                ContMethodTypeCode = "POSTALADDR"
            };

            newCustomer.addAddress(newAddr);
            newCustomer.FirstName = searchCriteria.FirstName;
            newCustomer.LastName  = searchCriteria.LastName;
            if (!string.IsNullOrEmpty(searchCriteria.DOB) && searchCriteria.DOB != "mm/dd/yyyy")
            {
                newCustomer.DateOfBirth = Utilities.GetDateTimeValue(searchCriteria.DOB);
            }
            if (!string.IsNullOrEmpty(searchCriteria.IDIssuer))
            {
                var idData = new IdentificationVO
                {
                    IdIssuer     = searchCriteria.IDIssuer,
                    IdValue      = searchCriteria.IDNumber,
                    IdIssuerCode = searchCriteria.IdIssuerCode,
                    IdType       = searchCriteria.IdTypeCode
                };
                newCustomer.addIdentity(idData);
                if (!string.IsNullOrEmpty(searchCriteria.PhoneNumber))
                {
                    var phoneData = new ContactVO
                    {
                        ContactPhoneNumber = searchCriteria.PhoneNumber,
                        ContactAreaCode    = searchCriteria.PhoneAreaCode
                    };
                    newCustomer.addContact(phoneData);
                }

                newCustomer.SocialSecurityNumber = searchCriteria.SSN;
            }
            GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer = newCustomer;
            if (trigger.Equals("newpawnloan", StringComparison.OrdinalIgnoreCase))
            {
                this.NavControlBox.IsCustom     = true;
                this.NavControlBox.CustomDetail = "ManagePawnApplication";
                this.NavControlBox.Action       = NavBox.NavAction.BACKANDSUBMIT;
            }
            else
            {
                this.NavControlBox.IsCustom     = true;
                this.NavControlBox.CustomDetail = "CreateCustomer";
                this.NavControlBox.Action       = NavBox.NavAction.BACKANDSUBMIT;
            }
        }
Пример #2
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;
                }
            }
        }