private void UpdatePhysicalDesc_Load(object sender, EventArgs e)
        {
            ownerFrm = this.Owner;
            this.NavControlBox.Owner = this;
            if (CustToView == null)
            {
                _checkRequiredFields          = false;
                this.customButtonBack.Visible = true;
                this.labelHeading.Text        = "Physical Description";
                this.customButtonReset.Text   = "Clear";
                //CustToView = GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer;
                CustToView = Support.Logic.CashlinxPawnSupportSession.Instance.ActiveCustomer;
                if (CustToView == null)
                //if the customer object is still null there is something wrong
                //so take the user to desktop
                {
                    BasicExceptionHandler.Instance.AddException("Customer object is missing from session ", new ApplicationException());
                    //CashlinxDesktop.Desktop.CashlinxDesktopSession.Instance.HistorySession.Desktop();
                    NavControlBox.Action = NavBox.NavAction.CANCEL;
                }
            }
            else
            {
                _checkRequiredFields = true;
                showRequiredFields();

                LoadCustData();
            }
        }
        private void DispositionEdit_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            LoadItemData();

            gunBookCustomer               = new CustomerVOForSupportApp();
            gunBookCustomer.FirstName     = dispositionCustFirstName;
            gunBookCustomer.LastName      = dispositionCustLastName;
            gunBookCustomer.MiddleInitial = dispositionCustMiddleName;
            AddressVO addr1 = new AddressVO();

            addr1.Address1           = dispositionCustomerAddress1;
            addr1.City               = dispositionCustomerCity;
            addr1.State_Code         = dispositionCustomerState;
            addr1.ZipCode            = dispositionCustomerZipcode;
            addr1.ContactTypeCode    = CustomerAddressTypes.HOME_ADDRESS;
            addr1.ContMethodTypeCode = "POSTALADDR";
            gunBookCustomer.addAddress(addr1);
            gunBookCustomer.CustomerNumber = dispositionCustNumber;
            IdentificationVO id = new IdentificationVO();

            id.IdType       = dispositionCustIDType;
            id.IdValue      = dispositionCustIDNumber;
            id.IdIssuerCode = dispositionCustIDAgency;
            id.IsLatest     = true;
            gunBookCustomer.addIdentity(id);
            CashlinxPawnSupportSession.Instance.ActiveCustomer     = gunBookCustomer;
            CashlinxPawnSupportSession.Instance.GunAcquireCustomer = false;
            CashlinxPawnSupportSession.Instance.CustomerEditType   = CustomerType.DISPOSITION;
            NavControlBox.IsCustom     = true;
            NavControlBox.CustomDetail = "EditCustomer";
            NavControlBox.Action       = NavBox.NavAction.BACKANDSUBMIT;
        }
        /*__________________________________________________________________________________________*/
        private void AddViewSupportCustomerComment_Load(object sender, EventArgs e)
        {
            ownerfrm = this.Owner;
            this.NavControlBox.Owner = this;

            CustToEdit = Support.Logic.CashlinxPawnSupportSession.Instance.ActiveCustomer;
            SetFormDisplay();
        }
        /*__________________________________________________________________________________________*/
        private void GetCustomerStatusData()
        {
            _custToEdit = Support.Logic.CashlinxPawnSupportSession.Instance.ActiveCustomer;
            //MapCustomerStatusFormData();

            CustomerNumber        = _custToEdit.CustomerNumber;
            CurrentCustomerStatus = _custToEdit.Status;
            CurrentReasonCode     = _custToEdit.ReasonCode;
            //CurrentReasonCode = "";
            ChangeReasonTo = "";

            MapCustomerStatusFormData();
        }
        /*__________________________________________________________________________________________*/
        private void LoadSelectedCustomer()
        {
            //Get the selected row from the grid and get the corresponding data from the customer table
            //for the selected customer
            DataRowView drv = (DataRowView)(_bindingSource1.Current);
            DataRow     selectedCustomerRow = _customers.Rows.Find(drv.Row["party_id"]);
            string      selectedPartyId     = selectedCustomerRow.ItemArray[(int)customerrecord.PARTY_ID].ToString();

            _customerObject = Support.Controllers.Database.Procedures.CustomerProcedures.getCustomerDataInObject(selectedPartyId, _customerIdentities,
                                                                                                                 _customerPhoneNumbers, _customerAddresses, _customerEmails,
                                                                                                                 _customerNotes, _customerStoreCredit, selectedCustomerRow);

            //return _customerObject;
        }
        /*__________________________________________________________________________________________*/
        private void showCustomer()
        {
            var dgr = DialogResult.Retry;

            do
            {
                try
                {
                    LoadSelectedCustomer();


                    if (_customerObject != null)
                    {
                        //Set the selected customer in the desktop session as the ActiveCustomer
                        //GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer = _customerObject;
                        Support.Logic.CashlinxPawnSupportSession.Instance.ActiveCustomer = _customerObject;
                        this.NavControlBox.IsCustom     = true;
                        this.NavControlBox.CustomDetail = "Controller_ProductServices"; // "ViewCustomerInformationReadOnly";
                        this.NavControlBox.Action       = NavBox.NavAction.SUBMIT;      //BACKANDSUBMIT;

                        break;
                    }
                    GlobalDataAccessor.Instance.DesktopSession.ClearPawnLoan();
                    this.NavControlBox.Action = NavBox.NavAction.CANCEL;
                }
                catch (Exception ex)
                {
                    BasicExceptionHandler.Instance.AddException(Commons.GetMessageString("SelectedCustomerLoadError"), ex);
                    dgr = MessageBox.Show(Commons.GetMessageString("ProcessingError"), "Error", MessageBoxButtons.RetryCancel);
                    if (dgr == DialogResult.Retry)
                    {
                        continue;
                    }
                    else
                    {
                        _customerObject = null;
                        break;
                    }
                }
            } while (dgr == DialogResult.Retry);
        }
示例#7
0
 /*__________________________________________________________________________________________*/
 private void LoadIDDataInObject()
 {
     //_updatedCustomer = new CustomerVOForSupportApp();
     _updatedCustomer = Support.Logic.CashlinxPawnSupportSession.Instance.ActiveCustomer;
     _updatedCustomer.removeIdentities();
     if (_custIdentities != null)
     {
         foreach (DataRow cust in _custIdentities.Rows)
         {
             IdentificationVO custid = new IdentificationVO
             {
                 IdType =
                     Utilities.GetStringValue(
                         cust.ItemArray[(int)customeridrecord.IDENTTYPECODE], ""),
                 IdValue =
                     Utilities.GetStringValue(
                         cust.ItemArray[(int)customeridrecord.ISSUEDNUMBER], ""),
                 IdIssuer =
                     Utilities.GetStringValue(
                         cust.ItemArray[(int)customeridrecord.STATE_NAME], ""),
                 IdIssuerCode =
                     Utilities.GetStringValue(
                         cust.ItemArray[(int)customeridrecord.ISSUERNAME], ""),
                 DatedIdentDesc =
                     Utilities.GetStringValue(
                         cust.ItemArray[(int)customeridrecord.DATEDIDENTTYPEDESC], ""),
                 IdExpiryData =
                     Utilities.GetDateTimeValue(
                         cust.ItemArray[(int)customeridrecord.EXPIRYDATE],
                         DateTime.MaxValue),
                 IdentId =
                     Utilities.GetStringValue(
                         cust.ItemArray[(int)customeridrecord.IDENTID], "")
             };
             _updatedCustomer.addIdentity(custid);
         }
     }
 }
        private void buttonSubmit_Click(object sender, EventArgs e)
        {
            bool newCustCreated = false;
            var  partyId        = string.Empty;
            var  custNumber     = string.Empty;
            bool updatePhysData = false;

            if (isFormValid())
            {
                getFormData();
                if (string.IsNullOrEmpty(CustToView.PartyId) || physDescDataChanged())
                {
                    _strUserId      = GlobalDataAccessor.Instance.DesktopSession.UserName;
                    _strStoreNumber = GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber;
                    _strCustNumber  = CustToView.CustomerNumber;

                    DateTime     noteDate  = ShopDateTime.Instance.ShopDate;
                    DialogResult dgr       = DialogResult.Retry;
                    bool         retVal    = false;
                    var          errorDesc = string.Empty;
                    //The following is true when this form is called in the Manage customer use case
                    if (CustToView.PartyId == string.Empty)
                    {
                        do
                        {
                            retVal = CustomerProcedures.AddCustomer(GlobalDataAccessor.Instance.DesktopSession, CustToView, _strUserId, _strStoreNumber, out custNumber, out partyId, out errorDesc);
                            if (retVal)
                            {
                                break;
                            }
                            else
                            {
                                dgr = MessageBox.Show(Commons.GetMessageString("CustDataAddFailure"), "Error", MessageBoxButtons.RetryCancel);
                            }
                        }while (dgr == DialogResult.Retry);

                        if (retVal)
                        {
                            newCustCreated            = true;
                            _strCustNumber            = custNumber;
                            CustToView.CustomerNumber = _strCustNumber;
                            CustToView.PartyId        = partyId;
                            do
                            {
                                retVal = CustomerProcedures.AddCustomerAddress(GlobalDataAccessor.Instance.DesktopSession, CustToView, _strUserId, _strStoreNumber);
                                if (retVal)
                                {
                                    break;
                                }
                                else
                                {
                                    dgr = MessageBox.Show(Commons.GetMessageString("CustDataAddFailure"), "Error", MessageBoxButtons.RetryCancel);
                                }
                            }while (dgr == DialogResult.Retry);
                        }
                        else
                        {
                            //the call to add customer failed and the user pressed cancel when asked
                            //if they would like to keep trying so go to desktop
                            //CashlinxDesktopSession.Instance.FormState = CashlinxDesktopSession.CustomerFormStates.CANCEL;
                            //CustomerController.NavigateUser(ownerFrm);
                            NavControlBox.Action = NavBox.NavAction.CANCEL;
                        }
                    }
                    else
                    {
                        retVal = true;
                    }

                    if (retVal)
                    {
                        do
                        {
                            updatePhysData = new CustomerDBProcedures(GlobalDataAccessor.Instance.DesktopSession).UpdateCustPhysicalDescription(_strRace, _strGender, _strHairColor, _strEyeColor, _strHeight,
                                                                                                                                                _strWeight, _strUserId, CustToView.PartyId, _strCustNumber, _strOthers, _strContactProductNoteId,
                                                                                                                                                _strStoreNumber, out _strNewContactProductNoteId, out _errorCode, out _errorMsg);
                            if (updatePhysData)
                            {
                                Form ownerForm = this.Owner;
                                if (ownerForm.GetType() == typeof(ViewCustomerInformation))
                                {
                                    CustomerVOForSupportApp updatedCustomer = new CustomerVOForSupportApp();
                                    updatedCustomer.addNotes(CustToView.getPhysicalDescNote());
                                    updatedCustomer.Race      = _strRace;
                                    updatedCustomer.Gender    = _strGender;
                                    updatedCustomer.HairColor = _strHairColor;
                                    updatedCustomer.EyeColor  = _strEyeColor;
                                    updatedCustomer.Height    = _strHeight;
                                    if (_strNewContactProductNoteId.Equals(string.Empty))
                                    {
                                        _strNewContactProductNoteId = _strContactProductNoteId;
                                    }
                                    try
                                    {
                                        updatedCustomer.Weight = Convert.ToInt32(_strWeight);
                                    }
                                    catch (Exception)
                                    {
                                        updatedCustomer.Weight = 0;
                                    }
                                    updatedCustomer.updatePhysicalDescNote(_strOthers, _strStoreNumber, noteDate, _strUserId, _strNewContactProductNoteId);

                                    ((ViewCustomerInformation)ownerForm).UpdatedCustomerToView = updatedCustomer;
                                    ((ViewCustomerInformation)ownerForm).ShowUpdates           = true;
                                }
                                break;
                            }
                            else
                            {
                                dgr = MessageBox.Show(Commons.GetMessageString("CustPhysicalDescUpdateFailure"), "Error", MessageBoxButtons.RetryCancel);
                            }
                        }while (dgr == DialogResult.Retry);
                    }
                    else
                    {
                        //Adding customer address was a failure and the user pressed cancel when asked
                        //if they would like to retry so take them to desktop
                        //CashlinxDesktopSession.Instance.FormState = CashlinxDesktopSession.CustomerFormStates.CANCEL;
                        //CustomerController.NavigateUser(ownerFrm);
                        NavControlBox.Action = NavBox.NavAction.CANCEL;
                    }
                }
                else if (CustToView.PartyId != string.Empty)
                {
                    MessageBox.Show(Commons.GetMessageString("NoChangesInForm"));
                }
            }
            else
            {
                MessageBox.Show(Commons.GetMessageString("FormRequiredFieldsFilledError"));
                return;
            }
            if (newCustCreated)
            {
                MessageBox.Show(Commons.GetMessageString("CustCreationSuccess") + " " + custNumber);
                CustomerVO customerObj = CustomerProcedures.getCustomerDataByCustomerNumber(GlobalDataAccessor.Instance.DesktopSession, custNumber);
                if (customerObj != null)
                {
                    GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer = customerObj;
                }
                //CashlinxDesktopSession.Instance.FormState = CashlinxDesktopSession.CustomerFormStates.ADDCUSTOMERCOMPLETE;
                //CustomerController.NavigateUser(ownerFrm);
                NavControlBox.Action = NavBox.NavAction.BACKANDSUBMIT;
            }
            else
            {
                if (updatePhysData)
                {
                    MessageBox.Show("Physical details updated");
                }
                this.Close();
                this.Dispose(true);
            }
        }
        /*__________________________________________________________________________________________*/
        private void LoadDataInForm()
        {
            //_custToEdit = GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer;
            _custToEdit = Support.Logic.CashlinxPawnSupportSession.Instance.ActiveCustomer;

            CustToEdit = Support.Logic.CashlinxPawnSupportSession.Instance.ActiveCustomer;
            //this.custFirstName.Text = _firstName;
            //this.custLastName.Text = _lastName;
            //this.custMiddleInitial.Text = _middleInitial;
            //this.custSSN.Controls[0].Text = _ssn;
            ////this.custDateOfBirth.Controls[0].Text = _dob.FormatDate();

            mapSupportAppFields();

            this.custFirstName.Text               = _custToEdit.FirstName;
            this.custLastName.Text                = _custToEdit.LastName;
            this.custMiddleInitial.Text           = _custToEdit.MiddleInitial;
            this.custSSN.Controls[0].Text         = _custToEdit.SocialSecurityNumber;
            this.custDateOfBirth.Controls[0].Text = _custToEdit.DateOfBirth.FormatDate();

            ComboBox custTitle = (ComboBox)this.title1.Controls[0];

            Console.WriteLine("_title-->" + _title);
            if (_title.Length != 0)
            {
                Console.WriteLine("after title..");
                foreach (ComboBoxData currTitle in custTitle.Items)
                {
                    Console.WriteLine("after title..for -->" + currTitle.Code);
                    if (currTitle.Code == _title)
                    {
                        custTitle.SelectedIndex = custTitle.Items.IndexOf(currTitle);
                        break;
                    }
                }
            }
            else
            {
                custTitle.SelectedIndex = 0;
            }

            custTitle = null;
            ComboBox custTitSuffix = (ComboBox)this.titleSuffix1.Controls[0];

            if (_titleSuffix.Length != 0)
            {
                foreach (ComboBoxData currTitleSuffix in custTitSuffix.Items)
                {
                    if (currTitleSuffix.Code == _titleSuffix)
                    {
                        custTitSuffix.SelectedIndex = custTitSuffix.Items.IndexOf(currTitleSuffix);
                        break;
                    }
                }
            }
            else
            {
                custTitSuffix.SelectedIndex = 0;
            }
            custTitSuffix = null;


            if (_language.Length != 0)
            {
                foreach (ComboBoxData currData in comboBoxLanguage.Items)
                {
                    if (currData.Code == _language)
                    {
                        comboBoxLanguage.SelectedIndex = comboBoxLanguage.Items.IndexOf(currData);
                        break;
                    }
                }
            }
        }