private void buttonSubmit_Click(object sender, EventArgs e)
        {
            string  strIdentNumber = customTextBoxCWPNumber.Text;
            Boolean cancelSubmit   = false;

            //BZ # 753
            //if (!_retailFirearmCheck && !customTextBoxRefNumber.isValid)
            if (!_retailFirearmCheck && !customTextBoxRefNumber.isValid && string.IsNullOrEmpty(strIdentNumber))
            {
                MessageBox.Show(@"Background reference number must be entered");
                return;
            }

            if (!checkExpDate())
            {
                this.dateCWP.Focus();
                return;
            }

            //store the background ref check number in the customer object
            _currentCustomer.BackgroundCheckRefNumber = customTextBoxRefNumber.Text;
            //store the CWP data against the customer if he did not already
            //have a cwp and if they entered CWP data in the form
            ComboBox statelist          = (ComboBox)stateCWP.Controls[0];
            string   cwpIssuerState     = statelist.GetItemText(statelist.SelectedItem);
            string   cwpIssuerStateName = statelist.SelectedValue.ToString();
            string   strIdentExpiryDate = dateCWP.Controls[0].Text;

            if (strIdentExpiryDate.Equals("mm/dd/yyyy"))
            {
                strIdentExpiryDate = string.Empty;
            }
            string strIdentTypeCode = CustomerIdTypes.CW.ToString();

            IdentificationVO custCWPID  = new IdentificationVO();
            string           storeState = CashlinxDesktopSession.Instance.CurrentSiteId.State;

            if (_currentCustomer.HasValidConcealedWeaponsPermitInState(storeState, ShopDateTime.Instance.ShopDate))
            {
                custCWPID = _currentCustomer.getIdByTypeandIssuer(CustomerIdTypes.CW.ToString(), storeState);
            }

            if (!string.IsNullOrEmpty(custCWPID.IdValue.Trim()))
            {
                _idCwpExists = true;

                //idExpDate = custCWPID.IdExpiryData.Date != DateTime.MaxValue.Date ? custCWPID.IdExpiryData.FormatDate() : string.Empty;
                //idIssuer = custCWPID.IdIssuerCode;
            }

            decimal backgroundCheckFee;

            if (_retailFirearmCheck || _layawayFirearmCheck)
            {
                //Check if ident number and issuer and expiry date is entered if reference number was not entered
                if (!customTextBoxRefNumber.isValid && (strIdentNumber.Equals(string.Empty) || cwpIssuerState.Equals("Select One") || strIdentExpiryDate == string.Empty || strIdentExpiryDate == string.Empty))
                {
                    if (!IsBackgroundCheckRequired)
                    {
                        MessageBox.Show("Either Background reference number or all CWP data should be entered");
                        return;
                    }
                    else
                    {
                        MessageBox.Show("Background reference number should be entered");
                        return;
                    }
                }
                else if (_layawayFirearmCheck)
                {
                    //if (!decimal.TryParse(customTextBoxBackgroundCheckFee.Text, out backgroundCheckFee) || backgroundCheckFee < 0)
                    bool formatSuccess = Commons.FormatStringAsDecimal(customTextBoxBackgroundCheckFee.Text, out backgroundCheckFee);

                    //BZ # 503
                    if (formatSuccess)
                    {
                        if (backgroundCheckFee <= 0.0m)
                        {
                            string       msg = "Back ground Check Fee amount is less or equal to zero. Is that okay?";
                            DialogResult dgr = MessageBox.Show(msg, "Back ground Check Fee equals zero", MessageBoxButtons.YesNo);
                            if (dgr == DialogResult.No)
                            {
                                return;
                            }
                        }
                        else
                        {
                            CashlinxDesktopSession.Instance.BackgroundCheckFeeValue = backgroundCheckFee;
                        }
                    }
                    else
                    {
                        MessageBox.Show("Invalid background check fee");
                        return;
                    }
                    //BZ # 503 end
                }
                else
                {
                    CashlinxDesktopSession.Instance.BackgroundCheckFeeValue = 0M;
                }
            }
            else
            {
                if ((!customTextBoxRefNumber.isValid) && (strIdentNumber.Equals(string.Empty) || cwpIssuerState.Equals("Select One")))
                {
                    if (!IsBackgroundCheckRequired)
                    {
                        MessageBox.Show("Either Background reference number or all CWP data should be entered");
                        return;
                    }
                    else
                    {
                        MessageBox.Show("Background reference number should be entered");
                        return;
                    }
                }

                CashlinxDesktopSession.Instance.BackgroundCheckFeeValue = 0M;
            }

            if ((!customTextBoxRefNumber.isValid) && !IsBackgroundCheckRequired && _currentCustomer.HasConcealedWeaponsPermit())
            {
                //check to see if the object has been populated with data.
                if (custCWPID.IdExpiryData == DateTime.MaxValue)
                {
                    custCWPID = _currentCustomer.getAllIdentifications().Where(i => i.IdType == CustomerIdTypes.CW.ToString()).FirstOrDefault();
                }

                if (strIdentNumber.Trim() != custCWPID.IdValue.Trim() || cwpIssuerState != custCWPID.IdIssuerCode)
                {
                    DialogResult dgr = MessageBox.Show("This customer has the following CWP on file: " + custCWPID.IdIssuerCode + "-" + custCWPID.IdValue + ". If you continue, the CWP you entered will replace the one on file.", "Concealed Weapons Permit Already Exists", MessageBoxButtons.YesNo);
                    if (dgr == DialogResult.No)
                    {
                        return;
                    }
                }
            }

            //Check if the ID is a new id entered in this form or it already exists
            //for the customer
            //Add to the database only if its a new id
            if (!string.IsNullOrEmpty(strIdentNumber) && !cwpIssuerState.Equals("Select One"))
            {
                IdentificationVO custIdInfo = _currentCustomer.getIdentity(CustomerIdTypes.CW.ToString(), strIdentNumber, cwpIssuerState, strIdentExpiryDate);
                if (custIdInfo == null)
                {
                    DialogResult dgr;
                    do
                    {
                        string strUserId    = CashlinxDesktopSession.Instance.UserName;
                        string errorMsg     = string.Empty;
                        string errorCode    = string.Empty;
                        bool   updateIdData = new CustomerDBProcedures(CashlinxDesktopSession.Instance).UpdateCustPersonalIdentification(_currentCustomer.PartyId, strIdentNumber, strIdentExpiryDate, strIdentTypeCode, cwpIssuerState, strUserId, out errorCode, out errorMsg);
                        if (updateIdData)
                        {
                            IdentificationVO newCustId = new IdentificationVO
                            {
                                IdType         = strIdentTypeCode,
                                IdValue        = strIdentNumber,
                                IdIssuerCode   = cwpIssuerState,
                                IdIssuer       = cwpIssuerStateName,
                                DatedIdentDesc = StateIdTypeDescription.CW.ToString(),
                                IdExpiryData   =
                                    Utilities.GetDateTimeValue(strIdentExpiryDate, DateTime.MaxValue)
                            };
                            _currentCustomer.addIdentity(newCustId);

                            break;
                        }
                        dgr = MessageBox.Show(Commons.GetMessageString("CustIdentUpdateFailure"), "Error", MessageBoxButtons.RetryCancel);
                    } while (dgr == DialogResult.Retry);
                }
            }
            //If the user cancelled retrying to update the db when it failed
            //continue since the CWP can always be added later for the customer and do
            //not have to stop the pickup flow for it
            GlobalDataAccessor.Instance.DesktopSession.BackgroundCheckCompleted = true;
            GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer           = _currentCustomer;
            Close();
        }