示例#1
0
        private void populateIdNumberAndDate()
        {
            identType        = (ComboBox)this.pwnapp_identificationtype.Controls[0];
            strIdentTypeCode = identType.SelectedValue.ToString();
            //If idissuer1 is the control added in the form that means we need to
            //pull state data for ID Issuer otherwise it is the country data
            if (tableLayoutPanel2.Controls.Contains(pwnapp_identificationstate))
            {
                identIssuer     = (ComboBox)this.pwnapp_identificationstate.Controls[0];
                strIdentIssuer  = identIssuer.GetItemText(identIssuer.SelectedItem);
                stateIDSelected = true;
            }
            else
            {
                stateIDSelected = false;
                identIssuer     = (ComboBox)this.pwnapp_identificationcountry.Controls[0];
                strIdentIssuer  = identIssuer.SelectedValue.ToString();
            }

            if (newCustomer != null)
            {
                IdentificationVO customerId = null;
                customerId = newCustomer.getIdByTypeandIssuer(strIdentTypeCode, strIdentIssuer);

                if (customerId != null)
                {
                    this.pwnapp_identificationnumber.Text = customerId.IdValue.ToString();
                    if (customerId.IdExpiryData.Date != DateTime.MaxValue.Date)
                    {
                        this.pwnapp_identificationexpirationdate.Controls[0].Text = (customerId.IdExpiryData).FormatDate();
                    }
                    else
                    {
                        this.pwnapp_identificationexpirationdate.Controls[0].Text = "";
                    }
                    this.pwnapp_identificationexpirationdate.Enabled = false;
                    this.pwnapp_identificationnumber.Enabled         = false;
                    this.SelectNextControl(this.pwnapp_identificationexpirationdate, true, true, true, true);
                }
                else
                {
                    this.pwnapp_identificationnumber.Text = "";
                    this.pwnapp_identificationexpirationdate.Controls[0].Text = "";
                    this.pwnapp_identificationexpirationdate.Enabled          = true;
                    this.pwnapp_identificationnumber.Enabled = true;
                }
            }
            else
            {
                pwnapp_identificationnumber.Enabled         = true;
                pwnapp_identificationexpirationdate.Enabled = true;
            }
        }
        public void BuildDocument(string ticketNumber /*PawnLoan pawnLoan*/, List <Common.Libraries.Objects.Business.Item> listItems, CustomerVO customerInfo, string storeName, AddressVO selectedCustomerAddress, KeyValuePair <string, string> lastIdUsed, DateTime statusDateTime, Boolean isLoan)
        {
            var pageNumber = 1;

            // Emulation specific control codes to force the police card to fit on 3x5.
            Document.AddPrinterCode(PrinterCode.LineDensity8Dpi);
            Document.AddPrinterCode(PrinterCode.HorizontalSpacing171Cpi);

            foreach (var item in listItems)
            {
                var mdls     = new MerchandiseDescriptionLineSeparator(8, RightColumnWidth);
                var descRows = mdls.SplitIntoRows(item.TicketDescription);

                // -------------------------------------------------------------
                var row = Document.CreateNewRow();
                row.WriteText("NAME OF CUSTOMER", LeftColumnWidth);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText("SERIAL NUMBER", RightColumnWidth);

                // -------------------------------------------------------------
                row = Document.CreateNewRow();

                row.WriteText(customerInfo.LastName + ", " + customerInfo.FirstName + " " + customerInfo.MiddleInitial,
                              LeftColumnWidth, RawTextFlags.ForceUpper);

                row.WriteText(HorizontalSeparatorValue);
                var serialNumber = string.Empty;
                if (item.QuickInformation.SerialNumber != null)
                {
                    serialNumber = item.QuickInformation.SerialNumber;
                }
                row.WriteText(serialNumber, RightColumnWidth);

                // -------------------------------------------------------------
                row = Document.CreateNewRow();
                row.WriteRepeatingText(VerticalSeparatorValue, 45);
                row.WriteText(IntersectingSeparatorValue);
                row.WriteRepeatingText(VerticalSeparatorValue, 28);

                // -------------------------------------------------------------
                row = Document.CreateNewRow();
                row.WriteText("CUSTOMER SIGNATURE", LeftColumnWidth);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText("ITEM", RightColumnWidth);

                // -------------------------------------------------------------
                row = Document.CreateNewRow();
                row.WriteText(string.Empty, LeftColumnWidth);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText(item.CategoryDescription, RightColumnWidth);

                // -------------------------------------------------------------
                row = Document.CreateNewRow();
                row.WriteRepeatingText(VerticalSeparatorValue, 45);
                row.WriteText(IntersectingSeparatorValue);
                row.WriteRepeatingText(VerticalSeparatorValue, 28);

                // -------------------------------------------------------------
                row = Document.CreateNewRow();
                row.WriteText("ADDRESS", LeftColumnWidth);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText("DESIGN / MODEL / MAKE / CAL /", RightColumnWidth);

                // -------------------------------------------------------------
                row = Document.CreateNewRow();
                row.WriteText(selectedCustomerAddress.Address1 + " " + selectedCustomerAddress.Address2 + " " + selectedCustomerAddress.UnitNum, LeftColumnWidth);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText("         SIZE / DESC.", RightColumnWidth);

                // -------------------------------------------------------------
                row = Document.CreateNewRow();
                row.WriteRepeatingText(VerticalSeparatorValue, 27);
                row.WriteText(IntersectingSeparatorValue);
                row.WriteRepeatingText(VerticalSeparatorValue, 10);
                row.WriteText(IntersectingSeparatorValue);
                row.WriteRepeatingText(VerticalSeparatorValue, 6);
                row.WriteText(IntersectingSeparatorValue);

                row = Document.CreateNewRow();
                row.WriteText("CITY - STATE - ZIP", 27);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText("DOB", 9);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText("EYES", 5);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText(descRows.Length >= 1 ? descRows[0].Trim() : string.Empty, RightColumnWidth);

                // -------------------------------------------------------------
                row = Document.CreateNewRow();
                var city = selectedCustomerAddress.City;
                if (city.Length > 17)
                {
                    city = city.Substring(0, 17);
                }
                row.WriteText(city + ", " + selectedCustomerAddress.State_Code + selectedCustomerAddress.ZipCode, 27);

                row.WriteText(HorizontalSeparatorValue);
                row.WriteText(customerInfo.DateOfBirth.ToString("MM/dd/yy"), 9);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText(customerInfo.EyeColor, 5);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText(descRows.Length >= 2 ? descRows[1].Trim() : string.Empty, RightColumnWidth);

                // -------------------------------------------------------------
                row = Document.CreateNewRow();
                row.WriteRepeatingText(VerticalSeparatorValue, 6);
                row.WriteText(IntersectingSeparatorValue);
                row.WriteRepeatingText(VerticalSeparatorValue, 7);
                row.WriteText(IntersectingSeparatorValue);
                row.WriteRepeatingText(VerticalSeparatorValue, 12);
                row.WriteText(IntersectingSeparatorValue);
                row.WriteRepeatingText(VerticalSeparatorValue, 7);
                row.WriteText(IntersectingSeparatorValue);
                row.WriteRepeatingText(VerticalSeparatorValue, 2);
                row.WriteText(IntersectingSeparatorValue);
                row.WriteRepeatingText(VerticalSeparatorValue, 6);
                row.WriteText(IntersectingSeparatorValue);
                row.WriteText(" ");
                //MDSE Desc Line 3
                row.WriteText(descRows.Length >= 3 ? descRows[2].Trim() : string.Empty, RightColumnWidth);

                // -------------------------------------------------------------
                row = Document.CreateNewRow();
                row.WriteText("SEX", 6);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText("HEIGHT", 6);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText("WEIGHT", 11);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText("HAIR", 6);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText("ORIGIN", 8);
                row.WriteText(HorizontalSeparatorValue);
                //MDSE Desc Line 4
                row.WriteText(descRows.Length >= 4 ? descRows[3].Trim() : string.Empty, RightColumnWidth);

                // -------------------------------------------------------------
                row = Document.CreateNewRow();
                row.WriteText(customerInfo.Gender, 6);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText(customerInfo.Height, 6);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText(customerInfo.Weight.ToString(), 11, RawTextFlags.Right);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText(customerInfo.HairColor, 6);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText(customerInfo.Race, 8);
                row.WriteText(HorizontalSeparatorValue);
                //MDSE Desc Line 5
                row.WriteText(descRows.Length >= 5 ? descRows[4].Trim() : string.Empty, RightColumnWidth);

                // -------------------------------------------------------------
                row = Document.CreateNewRow();
                row.WriteText("------");
                row.WriteText(IntersectingSeparatorValue);
                row.WriteText("-------");
                row.WriteText(IntersectingSeparatorValue);
                row.WriteText("------------");
                row.WriteText(IntersectingSeparatorValue);
                row.WriteText("-------");
                row.WriteText(IntersectingSeparatorValue);
                row.WriteText("---------");
                row.WriteText(IntersectingSeparatorValue);
                row.WriteText(" ");
                //MDSE Desc Line 6
                row.WriteText(descRows.Length >= 6 ? descRows[5].Trim() : string.Empty, RightColumnWidth);

                // -------------------------------------------------------------
                row = Document.CreateNewRow();
                row.WriteText("IDENTIFICATION TYPE DR LIC OR VALID PHOTO ID", LeftColumnWidth);
                row.WriteText(HorizontalSeparatorValue);
                //MDSE Desc Line 7
                row.WriteText(descRows.Length >= 7 ? descRows[6].Trim() : string.Empty, RightColumnWidth);

                // -------------------------------------------------------------
                row = Document.CreateNewRow();
                //row.WriteText("DL-NV-2000407563", LeftColumnWidth);

                var id     = customerInfo.getIdByTypeandIssuer(lastIdUsed.Key, lastIdUsed.Value);
                var idLine = string.Empty;
                if (id != null)
                {
                    idLine = id.IdType + "-" + id.IdIssuerCode + "-" + id.IdValue;
                    if (idLine.Length > LeftColumnWidth)
                    {
                        idLine.Substring(0, LeftColumnWidth - 1);
                    }
                }
                row.WriteText(idLine, LeftColumnWidth);

                row.WriteText(HorizontalSeparatorValue);
                //MDSE Desc Line 8
                row.WriteText(descRows.Length >= 8 ? descRows[7].Trim() : string.Empty, RightColumnWidth);

                // -------------------------------------------------------------
                row = Document.CreateNewRow();
                row.WriteText("-------");
                row.WriteText(IntersectingSeparatorValue);
                row.WriteText("-------");
                row.WriteText(IntersectingSeparatorValue);
                row.WriteText("------");
                row.WriteText(IntersectingSeparatorValue);
                row.WriteText("------");
                row.WriteText(IntersectingSeparatorValue);
                row.WriteText("------------");
                row.WriteText(IntersectingSeparatorValue);
                row.WriteText("--");
                row.WriteText(IntersectingSeparatorValue);
                row.WriteText("--------------");
                row.WriteText(IntersectingSeparatorValue);
                row.WriteText("--------------");

                // -------------------------------------------------------------
                row = Document.CreateNewRow();
                row.WriteText("CONS", 7);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText("TRADE", 6);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText("PURC", 5);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText("PAWN", 5);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText("TICKET NO.", 11);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText("DATE & TIME", 16);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText("LOAN AMOUNT", 11);

                // -------------------------------------------------------------
                row = Document.CreateNewRow();
                row.WriteText(string.Empty, 7);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText(string.Empty, 6);
                row.WriteText(HorizontalSeparatorValue);
                if (!isLoan)
                {
                    row.WriteText("X", 5);
                }
                else
                {
                    row.WriteText(string.Empty, 5);
                }
                row.WriteText(HorizontalSeparatorValue);
                if (isLoan)
                {
                    row.WriteText("X", 5);
                }
                else
                {
                    row.WriteText(string.Empty, 5);
                }

                row.WriteText(HorizontalSeparatorValue);
                row.WriteText(ticketNumber, 11);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText(statusDateTime.ToString("MM/dd/yy HH:mm"), 16);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText(String.Format("{0:0.00}", item.ItemAmount), 11);

                // -------------------------------------------------------------
                row = Document.CreateNewRow();
                row.WriteText("-------");
                row.WriteText(IntersectingSeparatorValue);
                row.WriteText("-------");
                row.WriteText(IntersectingSeparatorValue);
                row.WriteText("------");
                row.WriteText(IntersectingSeparatorValue);
                row.WriteText("------");
                row.WriteText(IntersectingSeparatorValue);
                row.WriteText("------------");
                row.WriteText(IntersectingSeparatorValue);
                row.WriteText("-----------------");
                row.WriteText(IntersectingSeparatorValue);
                row.WriteText("--------------");

                // -------------------------------------------------------------
                row = Document.CreateNewRow();
                row.WriteText(storeName, 45);
                row.WriteText("PAGE " + pageNumber + " OF " + listItems.Count, 30, RawTextFlags.Right);

                // -------------------------------------------------------------
                for (var blankRowCount = 0; blankRowCount < 2; blankRowCount++) //25
                {
                    row = Document.CreateNewRow();
                    row.WriteText(string.Empty);
                }

                /*
                 * for (var blankRowCount = 0; blankRowCount < 5; blankRowCount++)
                 * {
                 *  row = Document.CreateNewRow();
                 *  row.WriteText(PrinterCode.FormFeed.ToString() + " ");
                 * }
                 * row = Document.CreateNewRow();
                 * row.WriteText("ED1");
                 * row = Document.CreateNewRow();
                 * row.WriteText("123456789012345678901234567890123456789012345678901234567890123456789012345678\f");
                 * row = Document.CreateNewRow();
                 * row.WriteText("ED2");
                 * row = Document.CreateNewRow();
                 * row.WriteText("                                                                              \f");
                 * row = Document.CreateNewRow();
                 * row.WriteText("ED3");
                 * row = Document.CreateNewRow();
                 * row.WriteText("/f");
                 * row = Document.CreateNewRow();
                 * row.WriteText("ED4");
                 * row = Document.CreateNewRow();
                 * row.WriteText("<FF>");
                 * row = Document.CreateNewRow();
                 * row.WriteText("ED5");
                 * row = Document.CreateNewRow();
                 * row.WriteText('\xC'.ToString());
                 * row = Document.CreateNewRow();
                 * row.WriteText("ED6");
                 * row = Document.CreateNewRow();
                 * row.WriteText('\f'.ToString());
                 * row = Document.CreateNewRow();
                 * row.WriteText("ED7");
                 * row = Document.CreateNewRow();
                 * var pc = new PrinterCode("<CSI>");
                 * row.WriteText(pc.NonMtplSequence+"\f");
                 * row = Document.CreateNewRow();
                 * row.WriteText("ED8");
                 * row = Document.CreateNewRow();
                 * row.WriteText(pc.MtplSequence + "\f");
                 * row = Document.CreateNewRow();
                 * row.WriteText("ED9");
                 *
                 * row.WriteText(pc.NonMtplSequence + '\xC'.ToString());
                 * row = Document.CreateNewRow();
                 * row.WriteText("ED10");
                 * row = Document.CreateNewRow();
                 * row.WriteText(pc.MtplSequence + '\xC'.ToString());
                 * row = Document.CreateNewRow();
                 * row.WriteText("ED11");
                 */
                // -------------------------------------------------------------
                pageNumber++;
            }
        }
        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();
        }
        private void FirearmsBackgroundCheck_Load(object sender, EventArgs e)
        {
            IsBackgroundCheckRequired = CustomerProcedures.IsBackgroundCheckRequired(CashlinxDesktopSession.Instance);
            if (!IsBackgroundCheckRequired)
            {
                customLabelCWPNumber.Visible   = true;
                customTextBoxCWPNumber.Visible = true;
                customLabelCWPExpDate.Visible  = true;
                dateCWP.Visible          = true;
                customLabelState.Visible = true;
                stateCWP.Visible         = true;
            }
            else
            {
                customLabelCWPNumber.Visible   = false;
                customTextBoxCWPNumber.Visible = false;
                customLabelCWPExpDate.Visible  = false;
                dateCWP.Visible          = false;
                customLabelState.Visible = false;
                stateCWP.Visible         = false;
            }

            if (CashlinxDesktopSession.Instance.ActiveRetail != null)
            {
                _firearmItems = (from itemData in CashlinxDesktopSession.Instance.ActiveRetail.RetailItems
                                 where itemData.IsGun
                                 select itemData).ToList();
                _retailFirearmCheck  = true;
                _layawayFirearmCheck = false;
            }
            else if (CashlinxDesktopSession.Instance.ServiceLayaways != null && CashlinxDesktopSession.Instance.ServiceLayaways.Count > 0)
            {
                List <LayawayVO> pickupLayaways = CashlinxDesktopSession.Instance.ServiceLayaways.FindAll(l => l.LoanStatus == ProductStatus.PU).ToList();
                if (pickupLayaways.Count > 0)
                {
                    _firearmItems        = pickupLayaways.SelectMany(l => l.RetailItems).Where(i => i.IsGun).ToList();
                    _retailFirearmCheck  = false;
                    _layawayFirearmCheck = true;
                }
            }
            SetupDisplayForList();
            _currentCustomer = CashlinxDesktopSession.Instance.ActiveCustomer;
            string           strStoreState = CashlinxDesktopSession.Instance.CurrentSiteId.State;
            IdentificationVO custCWPID     = new IdentificationVO();
            string           idNumber      = string.Empty;
            string           idExpDate     = string.Empty;
            string           idIssuer      = string.Empty;
            bool             dateExpired   = false;

            if (!(strStoreState.Equals(string.Empty)))
            {
                List <IdentificationVO> identifications = _currentCustomer.getAllIdentifications();
                foreach (IdentificationVO id in identifications)
                {
                    if (id.IdType != null && id.IdType.Equals(CustomerIdTypes.CW.ToString()))
                    {
                        DateTime expiryDate = Utilities.GetDateTimeValue(id.IdExpiryData, DateTime.MaxValue);
                        if (expiryDate.Date < ShopDateTime.Instance.ShopDate.Date)
                        {
                            dateExpired = true;
                            break;
                        }
                    }
                }

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

            if (custCWPID != null && custCWPID.IdValue != string.Empty)
            {
                _idCwpExists = true;
                idNumber     = custCWPID.IdValue;
                idExpDate    = custCWPID.IdExpiryData.Date != DateTime.MaxValue.Date ? custCWPID.IdExpiryData.FormatDate() : string.Empty;
                idIssuer     = custCWPID.IdIssuerCode;
            }

            string CWPNum = this.customTextBoxCWPNumber.Text;

            if (_idCwpExists)
            {
                ComboBox statelist = (ComboBox)this.stateCWP.Controls[0];
                statelist.SelectedIndex = 0;

                if (dateExpired)
                {
                    this.dateExpireWarning.Visible = true;
                }
                else
                {
                    this.dateExpireWarning.Visible = false;
                }
            }
            else if (string.Empty.Equals(CWPNum))
            {
                dateCWP.Enabled  = false;
                stateCWP.Enabled = false;
            }
            else
            {
                customTextBoxCWPNumber.Enabled = true;
                dateCWP.Enabled  = true;;
                stateCWP.Enabled = true;
            }
            this.dateCWP.ErrorMessage = Commons.GetMessageString("InvalidDate");

            //BZ # 503
            if (customTextBoxBackgroundCheckFee.TextLength == 0)
            {
                customTextBoxBackgroundCheckFee.Text = "0.00";
            }
            //BZ # 503 end
        }