示例#1
0
        private void ChargeOffItemSelection_Load(object sender, EventArgs e)
        {
            if (ReplaceLoan.Items != null && ReplaceLoan.Items.Count > 0)
            {
                BindingSource _bindingSource1 = new BindingSource
                {
                    DataSource = ReplaceLoan.Items
                };
                customDataGridViewItems.AutoGenerateColumns = false;
                this.customDataGridViewItems.DataSource     = _bindingSource1;
                this.customDataGridViewItems.Columns[0].DataPropertyName        = "ticketdescription";
                this.customDataGridViewItems.Columns[1].DataPropertyName        = "itemamount";
                this.customDataGridViewItems.Columns[2].DataPropertyName        = "icn";
                this.customDataGridViewItems.Columns[1].DefaultCellStyle.Format = "c";
                this.customDataGridViewItems.AutoGenerateColumns = false;
            }
            if (ReplaceLoan.Items != null)
            {
                labelTotalLoanAmount.Text = ReplaceLoan.Items.Sum(i => i.ItemAmount).ToString("c");
            }

            labelCustName.Text = ReplaceCustomer.CustomerName;
            var custAddr = ReplaceCustomer.getHomeAddress();

            if (custAddr != null)
            {
                labelCustAddr.Text  = custAddr.Address2;
                labelCustAddr2.Text = custAddr.Address1;
                labelCustAddr3.Text = string.Format("{0},{1} {2}", custAddr.City, custAddr.State_Code, custAddr.ZipCode);
            }

            ReplacedICN = new List <string>();
        }
        private void LookupTicketResults_Load(object sender, EventArgs e)
        {
            _ownerfrm           = Owner;
            NavControlBox.Owner = this;
            //Show customer data using the customer object stored in session
            CustomerVO custdata = GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer;

            if (custdata != null)
            {
                customDataGridViewTicketResults.Rows.Add(1);
                customDataGridViewTicketResults.Rows[0].Cells["custlastname"].Value  = custdata.LastName;
                customDataGridViewTicketResults.Rows[0].Cells["custfirstname"].Value = custdata.FirstName;
                customDataGridViewTicketResults.Rows[0].Cells["dob"].Value           = custdata.DateOfBirth.FormatDate();
                AddressVO custAddr = custdata.getHomeAddress();
                if (custAddr != null)
                {
                    customDataGridViewTicketResults.Rows[0].Cells["address"].Value = custAddr.Address1 + " " +
                                                                                     custAddr.UnitNum + " " + custAddr.City + "," + custAddr.State_Code + " " +
                                                                                     custAddr.ZipCode;
                }
                IdentificationVO currentId = custdata.getIdentity(0);
                if (GlobalDataAccessor.Instance.DesktopSession.TicketTypeLookedUp == ProductType.LAYAWAY)
                {
                    customDataGridViewTicketResults.Rows[0].Cells["IDData"].Value = currentId.IdType + "-" +
                                                                                    currentId.IdIssuer + "-" + currentId.IdValue;

                    //Get the layaway from session to get the ticket number
                    List <LayawayVO> layaway = GlobalDataAccessor.Instance.DesktopSession.Layaways;
                    var tktNumber            = string.Empty;
                    if (layaway != null)
                    {
                        LayawayVO layawayObj = layaway.First();
                        if (layawayObj != null)
                        {
                            tktNumber = layawayObj.TicketNumber.ToString();
                        }
                    }
                    tktNumberLabel.Text = tktNumber;
                }
                else
                {
                    //Get ID data from the pawn app object
                    List <PawnAppVO> pawnApplications = GlobalDataAccessor.Instance.DesktopSession.PawnApplications;
                    long             pawnAppId;
                    try
                    {
                        pawnAppId = Convert.ToInt64(GlobalDataAccessor.Instance.DesktopSession.CurPawnAppId);
                    }
                    catch (Exception)
                    {
                        pawnAppId = 0;
                    }
                    if (pawnAppId != 0 && pawnApplications != null)
                    {
                        PawnAppVO pawnApplication = pawnApplications.First
                                                        (papp => papp.PawnAppID == pawnAppId);
                        if (pawnApplication != null)
                        {
                            customDataGridViewTicketResults.Rows[0].Cells["IDData"].Value = pawnApplication.PawnAppCustIDType + "-" +
                                                                                            pawnApplication.PawnAppCustIDIssuer + "-" + pawnApplication.PawnAppCustIDNumber;
                        }

                        //Get the pawn loan from session to get the ticket number
                        //Only 1 pawn loan for this application id
                        List <PawnLoan> pawnLoans = GlobalDataAccessor.Instance.DesktopSession.PawnLoans;
                        var             tktNumber = string.Empty;
                        if (pawnLoans != null)
                        {
                            PawnLoan pawnLoanObj = pawnLoans.First
                                                       (ploan => ploan.PawnAppId == pawnAppId.ToString());
                            if (pawnLoanObj != null)
                            {
                                tktNumber = pawnLoanObj.TicketNumber.ToString();
                            }
                        }
                        tktNumberLabel.Text = tktNumber;
                    }
                    else
                    {
                        BasicExceptionHandler.Instance.AddException("Pawn Application Data is not found in Lookup Ticket Results ", new ApplicationException());
                        NavControlBox.Action = NavBox.NavAction.CANCEL;
                    }
                }
            }
            else
            {
                BasicExceptionHandler.Instance.AddException("Customer object is missing in session ", new ApplicationException());
                //NavControlBox.Action = NavBox.NavAction.CANCEL;
            }
        }
示例#3
0
        private void ExistingCustomer_Load(object sender, EventArgs e)
        {
            try
            {
                //set the owner form
                ownerFrm = this.Owner;
                this.NavControlBox.Owner = this;

                //Pull data out of cashlinx desktop session
                var gSess    = GlobalDataAccessor.Instance;
                var dSession = gSess.DesktopSession;
                _currentCustomer   = dSession.EXCurrentCustomer;
                _existingCustomers = dSession.EXExistingCustomers;
                if (!string.IsNullOrEmpty(dSession.EXErrorMessage))
                {
                    _strMessageToShow = dSession.EXErrorMessage;
                }
                else
                {
                    _strMessageToShow = dSession.EXMessageToShow;
                }
                _nameCheck   = dSession.EXNameCheck;
                _newCustomer = dSession.EXNewCustomer;

                //Set the message to show on top
                this.labelRedHeader.Text = Commons.GetMessageString("ExistingCustomerHeader");
                this.labelMessage.Text   = _strMessageToShow;
                //Binding new customer data
                _newCustBindingSouce = new BindingSource();
                var dataTableNewCustomer = new DataTable();
                dataTableNewCustomer.Columns.Add("LastName");
                dataTableNewCustomer.Columns.Add("FirstName");
                dataTableNewCustomer.Columns.Add("CustAddress");
                dataTableNewCustomer.Columns.Add("DateOfBirth");
                dataTableNewCustomer.Columns.Add("IDData");
                dataTableNewCustomer.Columns.Add("IssuerName");
                var newCustRow = dataTableNewCustomer.NewRow();
                newCustRow["LastName"]  = _newCustomer.LastName;
                newCustRow["FirstName"] = _newCustomer.FirstName;
                if (_newCustomer.getHomeAddress() != null)
                {
                    newCustRow["CustAddress"] = _newCustomer.getHomeAddress().CustAddress;
                }
                else
                {
                    newCustRow["CustAddress"] = string.Empty;
                }
                newCustRow["DateOfBirth"] = (_newCustomer.DateOfBirth).FormatDate();
                var custId = _newCustomer.getFirstIdentity();
                if (custId != null)
                {
                    newCustRow["IDData"]     = custId.IDData;
                    newCustRow["IssuerName"] = custId.IdIssuerCode;
                }
                else
                {
                    newCustRow["IDData"]     = string.Empty;
                    newCustRow["IssuerName"] = string.Empty;
                }

                dataTableNewCustomer.Rows.Add(newCustRow);

                _newCustBindingSouce.DataSource = dataTableNewCustomer;
                this.customDataGridViewNewCustomer.AutoGenerateColumns = false;
                int newColIndex     = 0;
                var selectNewColumn = new DataGridViewCheckBoxColumn
                {
                    HeaderText = "Select",
                    ReadOnly   = false,
                    ThreeState = false,
                    FalseValue = false
                };

                newColIndex = this.customDataGridViewNewCustomer.Columns.Add(selectNewColumn);

                newColIndex = this.customDataGridViewNewCustomer.Columns.Add("LastName", "Last Name");
                this.customDataGridViewNewCustomer.Columns[newColIndex].DataPropertyName = "LastName";
                this.customDataGridViewNewCustomer.Columns[newColIndex].ReadOnly         = true;


                newColIndex = this.customDataGridViewNewCustomer.Columns.Add("FirstName", "First Name");
                this.customDataGridViewNewCustomer.Columns[newColIndex].DataPropertyName = "FirstName";
                this.customDataGridViewNewCustomer.Columns[newColIndex].ReadOnly         = true;


                newColIndex = this.customDataGridViewNewCustomer.Columns.Add("CustAddress", "Address");
                this.customDataGridViewNewCustomer.Columns[newColIndex].DataPropertyName = "CustAddress";
                this.customDataGridViewNewCustomer.Columns[newColIndex].ReadOnly         = true;



                newColIndex = this.customDataGridViewNewCustomer.Columns.Add("birthdate", "Date of Birth");
                this.customDataGridViewNewCustomer.Columns[newColIndex].DataPropertyName = "DateOfBirth";
                this.customDataGridViewNewCustomer.Columns[newColIndex].ReadOnly         = true;


                newColIndex = this.customDataGridViewNewCustomer.Columns.Add("IdTypeNumber", "ID Type & Number");
                this.customDataGridViewNewCustomer.Columns[newColIndex].DataPropertyName = "IDData";
                this.customDataGridViewNewCustomer.Columns[newColIndex].ReadOnly         = true;



                newColIndex = this.customDataGridViewNewCustomer.Columns.Add("Issuer_Name", "Issuer");
                this.customDataGridViewNewCustomer.Columns[newColIndex].DataPropertyName = "IssuerName";
                this.customDataGridViewNewCustomer.Columns[newColIndex].ReadOnly         = true;


                if (_nameCheck)
                {
                    customDataGridViewNewCustomer.Columns["LastName"].DefaultCellStyle.ForeColor  = Color.Red;
                    customDataGridViewNewCustomer.Columns["FirstName"].DefaultCellStyle.ForeColor = Color.Red;
                    customDataGridViewNewCustomer.Columns["birthdate"].DefaultCellStyle.ForeColor = Color.Red;
                }
                else
                {
                    customDataGridViewNewCustomer.Columns["IdTypeNumber"].DefaultCellStyle.ForeColor = Color.Red;
                    customDataGridViewNewCustomer.Columns["Issuer_Name"].DefaultCellStyle.ForeColor  = Color.Red;
                }
                customDataGridViewNewCustomer.DataSource = _newCustBindingSouce;
                customDataGridViewNewCustomer.AutoResizeColumns();

                //Binding existing customer data
                _existingCustomers.Columns.Add("IDData");
                _existingCustomers.Columns.Add("Address");

                string idData;
                string address;
                //Concatenate the ID type and number in the ID Data field
                //Concatenate the address fields in one
                foreach (DataRow dr in _existingCustomers.Rows)
                {
                    idData = string.Format("{0}-{1}", dr["Ident_type_code"], dr["Issued_number"]);
                    dr.SetField("idData", idData);
                    string addr2 = dr["address2_text"].ToString();
                    if (addr2.Trim().Length > 0)
                    {
                        address = string.Format("{0},{1},{2},{3},{4}", dr["address1_text"], dr["address2_text"], dr["city_name"], dr["state_province_name"], dr["postal_code_text"]);
                    }
                    else
                    {
                        address = string.Format("{0},{1},{2},{3}", dr["address1_text"], dr["city_name"], dr["state_province_name"], dr["postal_code_text"]);
                    }
                    dr.SetField("Address", address);
                }
                _existingCustBindingSource = new BindingSource();
                //Add primary key to the existing customers table
                var key = new DataColumn[1];
                key[0] = _existingCustomers.Columns["customer_number"];
                _existingCustomers.PrimaryKey = key;

                _existingCustBindingSource.DataSource = _existingCustomers;
                this.customDataGridViewExistingCustomer.AutoGenerateColumns = false;
                newColIndex = 0;

                var selectColumn = new DataGridViewCheckBoxColumn
                {
                    HeaderText = "Select",
                    ReadOnly   = false,
                    ThreeState = false,
                    FalseValue = false
                };
                newColIndex = this.customDataGridViewExistingCustomer.Columns.Add(selectColumn);
                newColIndex = this.customDataGridViewExistingCustomer.Columns.Add("family_name", "Last Name");
                this.customDataGridViewExistingCustomer.Columns[newColIndex].DataPropertyName = "family_name";
                this.customDataGridViewExistingCustomer.Columns[newColIndex].ReadOnly         = true;

                newColIndex = this.customDataGridViewExistingCustomer.Columns.Add("first_name", "First Name");
                this.customDataGridViewExistingCustomer.Columns[newColIndex].DataPropertyName = "first_name";
                this.customDataGridViewExistingCustomer.Columns[newColIndex].ReadOnly         = true;

                newColIndex = this.customDataGridViewExistingCustomer.Columns.Add("Address", "Address");
                this.customDataGridViewExistingCustomer.Columns[newColIndex].DataPropertyName = "Address";
                this.customDataGridViewExistingCustomer.Columns[newColIndex].ReadOnly         = true;

                newColIndex = this.customDataGridViewExistingCustomer.Columns.Add("birthdate", "Date of Birth");
                this.customDataGridViewExistingCustomer.Columns[newColIndex].DataPropertyName = "birthdate";
                this.customDataGridViewExistingCustomer.Columns[newColIndex].ReadOnly         = true;

                newColIndex = this.customDataGridViewExistingCustomer.Columns.Add("IdcodeNumber", "ID Type & Number");
                this.customDataGridViewExistingCustomer.Columns[newColIndex].DataPropertyName = "IDData";
                this.customDataGridViewExistingCustomer.Columns[newColIndex].ReadOnly         = true;

                newColIndex = this.customDataGridViewExistingCustomer.Columns.Add("Issuer_Name", "Issuer");
                this.customDataGridViewExistingCustomer.Columns[newColIndex].DataPropertyName = "Issuer_Name";
                this.customDataGridViewExistingCustomer.Columns[newColIndex].ReadOnly         = true;

                if (_nameCheck)
                {
                    this.customDataGridViewExistingCustomer.Columns["family_name"].DefaultCellStyle.ForeColor = Color.Red;
                    this.customDataGridViewExistingCustomer.Columns["first_name"].DefaultCellStyle.ForeColor  = Color.Red;
                    this.customDataGridViewExistingCustomer.Columns["birthdate"].DefaultCellStyle.ForeColor   = Color.Red;
                }
                else
                {
                    this.customDataGridViewExistingCustomer.Columns["IdcodeNumber"].DefaultCellStyle.ForeColor = Color.Red;
                    this.customDataGridViewExistingCustomer.Columns["Issuer_Name"].DefaultCellStyle.ForeColor  = Color.Red;
                }

                this.customButtonContinue.Enabled = false;
                this.customDataGridViewExistingCustomer.DataSource = _existingCustBindingSource;
                this.customDataGridViewNewCustomer.ClearSelection();
                this.customDataGridViewExistingCustomer.ClearSelection();
                this.customDataGridViewExistingCustomer.AutoResizeColumns();
                this.ActiveControl = labelRedHeader;
            }
            catch (SystemException ex)
            {
                BasicExceptionHandler.Instance.AddException("Error loading the existing customer screen ", ex);
                clearCustomerSessionValues();
                this.NavControlBox.Action = NavBox.NavAction.CANCEL;
            }
        }
示例#4
0
        private void CustomerReplace_Load(object sender, EventArgs e)
        {
            gunBookData = GlobalDataAccessor.Instance.DesktopSession.GunData;
            if (gunBookData != null && gunBookData.Rows.Count > 0)
            {
                if (GlobalDataAccessor.Instance.DesktopSession.GunAcquireCustomer)
                {
                    string acquireCustNumber = Utilities.GetStringValue(gunBookData.Rows[0]["acquire_customer_number"]);
                    customerNumber.Text = acquireCustNumber;
                    string acquireCustFirstName  = Utilities.GetStringValue(gunBookData.Rows[0]["acquire_first_name"]);
                    string acquireCustLastName   = Utilities.GetStringValue(gunBookData.Rows[0]["acquire_last_name"]);
                    string acquireCustMiddleName = Utilities.GetStringValue(gunBookData.Rows[0]["acquire_middle_initial"]);
                    currentName.Text = string.Format("{0} {1} {2}", acquireCustFirstName, acquireCustMiddleName, acquireCustLastName);
                    string acquireCustomerAddress1 = Utilities.GetStringValue(gunBookData.Rows[0]["acquire_address"]);
                    address1.Text = acquireCustomerAddress1;
                    string acquireCustomerCity    = Utilities.GetStringValue(gunBookData.Rows[0]["acquire_city"]);
                    string acquireCustomerState   = Utilities.GetStringValue(gunBookData.Rows[0]["acquire_state"]);
                    string acquireCustomerZipcode = Utilities.GetStringValue(gunBookData.Rows[0]["acquire_postal_code"]);
                    address2.Text = string.Format("{0},{1} {2}", acquireCustomerCity, acquireCustomerState, acquireCustomerZipcode);
                    string acquireCustIDType   = Utilities.GetStringValue(gunBookData.Rows[0]["acquire_id_type"]);
                    string acquireCustIDNumber = Utilities.GetStringValue(gunBookData.Rows[0]["acquire_id_number"]);
                    string acquireCustIDAgency = Utilities.GetStringValue(gunBookData.Rows[0]["acquire_id_agency"]);
                    id.Text = string.Format("{0} {1} {2}", acquireCustIDType, acquireCustIDAgency, acquireCustIDNumber);
                }
                else
                {
                    string dispositionCustNumber = Utilities.GetStringValue(gunBookData.Rows[0]["disposition_customer_number"]);
                    customerNumber.Text = dispositionCustNumber;

                    string dispositionCustLastName   = Utilities.GetStringValue(gunBookData.Rows[0]["disposition_last_name"]);
                    string dispositionCustFirstName  = Utilities.GetStringValue(gunBookData.Rows[0]["disposition_first_name"]);
                    string dispositionCustMiddleName = Utilities.GetStringValue(gunBookData.Rows[0]["disposition_middle_initial"]);
                    currentName.Text = string.Format("{0} {1} {2}", dispositionCustFirstName, dispositionCustMiddleName, dispositionCustLastName);

                    string dispositionCustomerAddress1 = Utilities.GetStringValue(gunBookData.Rows[0]["disposition_address"]);
                    address1.Text = dispositionCustomerAddress1;
                    string dispositionCustomerCity    = Utilities.GetStringValue(gunBookData.Rows[0]["disposition_city"]);
                    string dispositionCustomerState   = Utilities.GetStringValue(gunBookData.Rows[0]["disposition_state"]);
                    string dispositionCustomerZipcode = Utilities.GetStringValue(gunBookData.Rows[0]["disposition_postal_code"]);
                    address2.Text = string.Format("{0},{1} {2}", dispositionCustomerCity, dispositionCustomerState, dispositionCustomerZipcode);

                    string dispositionCustIDType   = Utilities.GetStringValue(gunBookData.Rows[0]["disposition_id_type"]);
                    string dispositionCustIDAgency = Utilities.GetStringValue(gunBookData.Rows[0]["disposition_id_agency"]);
                    string dispositionCustIDNumber = Utilities.GetStringValue(gunBookData.Rows[0]["disposition_id_number"]);
                    id.Text = string.Format("{0} {1} {2}", dispositionCustIDType, dispositionCustIDAgency, dispositionCustIDNumber);
                }
            }
            if (!SecurityProfileProcedures.CanUserModifyResource("EDIT RESTRICTED GUN BOOK FIELDS", GlobalDataAccessor.Instance.DesktopSession.LoggedInUserSecurityProfile, GlobalDataAccessor.Instance.DesktopSession))
            {
                tableLayoutPanel2.Visible = false;
            }
            else
            {
                idEditResource = true;
            }

            if (GlobalDataAccessor.Instance.DesktopSession.CustomerEditType == CustomerType.RECEIPT)
            {
                label1.Text = "Edit Receipt Customer Information";
            }
            else if (GlobalDataAccessor.Instance.DesktopSession.CustomerEditType == CustomerType.DISPOSITION)
            {
                label1.Text = "Edit Disposition Customer Information";
            }
            else
            {
                this.label1.Text = GlobalDataAccessor.Instance.DesktopSession.GunAcquireCustomer ? "Replace Receipt Customer Information" : "Replace Disposition Customer Information";
            }


            if (GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer != null &&
                !string.IsNullOrEmpty(GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer.CustomerNumber))
            {
                newCustomer = GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer;
                if (newCustomer.DateOfBirth != DateTime.MaxValue && newCustomer.Age <= 18)
                {
                    DialogResult dgr = MessageBox.Show("This customer does not meet the age criteria for firearm transactions. An audit event will be generated. Do you want to continue?", "Firearm Eligibility", MessageBoxButtons.YesNo);
                    if (dgr == DialogResult.No)
                    {
                        NavControlBox.Action = NavBox.NavAction.CANCEL;
                    }
                }

                labelCustNumber.Text        = newCustomer.CustomerNumber;
                customTextBoxFirstName.Text = newCustomer.FirstName;
                customTextBoxLastName.Text  = newCustomer.LastName;
                customTextBoxInitial.Text   = newCustomer.MiddleInitial;
                ComboBox  custstate = (ComboBox)state1.Controls[0];
                AddressVO custAddr  = newCustomer.getHomeAddress();
                if (custAddr != null)
                {
                    customTextBoxAddr1.Text = custAddr.Address1;
                    customTextBoxAddr2.Text = custAddr.Address2;



                    foreach (USState currstate in custstate.Items)
                    {
                        if (currstate.ShortName == custAddr.State_Code)
                        {
                            custstate.SelectedIndex = custstate.Items.IndexOf(currstate);
                            break;
                        }
                    }
                    customTextBoxCity.Text = custAddr.City;
                    zipcode1.Text          = custAddr.ZipCode;
                }
                IdentificationVO firstIdentity = newCustomer.getFirstIdentity();
                //Populate the id details if the first identity cursor is not empty
                if (firstIdentity != null)
                {
                    strIdentIssuerName = firstIdentity.IdIssuer;
                    strIdentNumber     = firstIdentity.IdValue;
                    ComboBox custId = (ComboBox)this.pwnapp_identificationtype.Controls[0];

                    foreach (ComboBoxData idtype in custId.Items)
                    {
                        if (idtype.Code == firstIdentity.IdType)
                        {
                            custId.SelectedIndex = custId.Items.IndexOf(idtype);
                            break;
                        }
                    }
                }
                else
                {
                    pwnapp_identificationexpirationdate.Enabled = false;
                    pwnapp_identificationnumber.Enabled         = false;
                }
            }
        }
        private void printAuthorizationToReleaseFingerprints(ReleaseFingerprintsInfo releaseFingerprintsInfo, CustomerVO currentCustomer, int seizeNumber)
        {
            //Call print Police seize form if print is enabled
            if (SecurityAccessor.Instance.EncryptConfig.ClientConfig.ClientConfiguration.PrintEnabled)
            {
                var address = currentCustomer.getHomeAddress();

                var releaseFingerprintsContext = new Reports.AuthorizationToReleaseFingerprints.
                                                 ReleaseFingerprintsContext()
                {
                    EmployeeNumber =
                        GlobalDataAccessor.Instance.DesktopSession.
                        UserName,
                    ShopName =
                        GlobalDataAccessor.Instance.CurrentSiteId.
                        StoreName,
                    ShopAddress =
                        GlobalDataAccessor.Instance.CurrentSiteId.
                        StoreAddress1 + " " +
                        GlobalDataAccessor.Instance.CurrentSiteId.
                        StoreAddress2,
                    ShopCity =
                        GlobalDataAccessor.Instance.CurrentSiteId.
                        StoreCityName,
                    ShopState =
                        GlobalDataAccessor.Instance.CurrentSiteId.State,
                    ShopZipCode =
                        GlobalDataAccessor.Instance.CurrentSiteId.
                        StoreZipCode,
                    CustomerName        = currentCustomer.CustomerName,
                    CustomerAddress1    = address.Address1,
                    CustomerAddress2    = address.Address2,
                    CustomerCity        = address.City,
                    CustomerState       = address.State_Code,
                    CustomerAddressUnit = address.UnitNum,
                    CustomerZipCode     = address.ZipCode,
                    TicketNumber        = releaseFingerprintsInfo.RefNumber,
                    Agency         = releaseFingerprintsInfo.Agency,
                    CaseNumber     = releaseFingerprintsInfo.CaseNumber,
                    SubpoenaNumber =
                        releaseFingerprintsInfo.SubpoenaNumber,
                    OfficerName =
                        releaseFingerprintsInfo.OfficerFirstName + " " +
                        releaseFingerprintsInfo.OfficerLastName,
                    BadgeNumber     = releaseFingerprintsInfo.BadgeNumber,
                    TransactionDate = releaseFingerprintsInfo.TransactionDate,
                    OutputPath      =
                        SecurityAccessor.Instance.EncryptConfig.
                        ClientConfig.GlobalConfiguration.
                        BaseLogPath +
                        "\\AuthorizationToReleaseFingerprints_" +
                        DateTime.Now.ToString("MMddyyyyhhmmssFFFFFFF") +
                        ".pdf"
                };

                var authorizationToReleaseFingerprints = new AuthorizationToReleaseFingerprints(
                    seizeNumber, GlobalDataAccessor.Instance.DesktopSession.TicketTypeLookedUp,
                    releaseFingerprintsContext, null);

                authorizationToReleaseFingerprints.Print();

                string strReturnMessage =
                    PrintingUtilities.printDocument(
                        releaseFingerprintsContext.OutputPath,
                        GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.IPAddress,
                        GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.Port, 2);
                if (!strReturnMessage.Contains("SUCCESS"))
                {
                    FileLogger.Instance.logMessage(LogLevel.ERROR, this,
                                                   "Authorization to release fingerprints : " +
                                                   strReturnMessage);
                }

                //---------------------------------------------------
                // Place document into couch
                var filePath = releaseFingerprintsContext.OutputPath;
                //authorizationToReleaseFingerprints.Save(policeCardFilePath);

                var pDoc = new CouchDbUtils.PawnDocInfo();
                var dA   = GlobalDataAccessor.Instance.OracleDA;
                var cC   = GlobalDataAccessor.Instance.CouchDBConnector;
                //Set document add calls
                pDoc.UseCurrentShopDateTime = true;
                pDoc.SetDocumentSearchType(CouchDbUtils.DocSearchType.POLICE_CARD);
                pDoc.StoreNumber    = GlobalDataAccessor.Instance.DesktopSession.CurrentSiteId.StoreNumber;
                pDoc.CustomerNumber = GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer.CustomerNumber;
                pDoc.TicketNumber   = seizeNumber;
                pDoc.DocumentType   = Common.Libraries.Objects.Doc.Document.DocTypeNames.PDF;
                pDoc.DocFileName    = filePath;
                //Add this document to the pawn document registry and document storage
                string errText;
                if (!CouchDbUtils.AddPawnDocument(dA, cC, GlobalDataAccessor.Instance.DesktopSession.UserName, ref pDoc, out errText))
                {
                    if (FileLogger.Instance.IsLogError)
                    {
                        FileLogger.Instance.logMessage(LogLevel.ERROR, this,
                                                       "Could not store release authorization to release fingerprints document in document storage: {0} - FileName: {1}", errText, filePath);
                    }

                    BasicExceptionHandler.Instance.AddException(
                        "Could not store police card document in document storage",
                        new ApplicationException("Could not store authorization to release fingerprints document in document storage: " + errText));
                }
            }
        }
        private void PoliceSeizeform_Load(object sender, EventArgs e)
        {
            //Populate store data
            STORE_NAME    = GlobalDataAccessor.Instance.CurrentSiteId.StoreName;
            STORE_ADDRESS = GlobalDataAccessor.Instance.CurrentSiteId.StoreAddress1;
            STORE_CITY    = GlobalDataAccessor.Instance.CurrentSiteId.StoreCityName;
            STORE_STATE   = GlobalDataAccessor.Instance.CurrentSiteId.State;
            STORE_ZIP     = GlobalDataAccessor.Instance.CurrentSiteId.StoreZipCode;
            CustomerVO currentCust = GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer;

            numofSeizeLoans = PoliceSeizeLoans.Count;
            empNo           = GlobalDataAccessor.Instance.DesktopSession.UserName.ToLowerInvariant();
            //Set all the data for printing
            transactionDate = ShopDateTime.Instance.ShopDate.FormatDate();


            foreach (HoldData seizedata in PoliceSeizeLoans)
            {
                if (currentCust != null)
                {
                    labelCustName.Text = currentCust.CustomerName;
                    var custHomeAddr = currentCust.getHomeAddress();
                    if (custHomeAddr != null)
                    {
                        labelCustAddressLine1.Text = custHomeAddr.Address1;
                        labelCustAddressLine2.Text = custHomeAddr.City + "," + custHomeAddr.State_Code + "," + custHomeAddr.ZipCode;
                    }
                    else
                    {
                        labelCustAddressLine1.Text = string.Empty;
                        labelCustAddressLine2.Text = string.Empty;
                    }
                }
                labelTranDate.Text   = "Date : " + transactionDate;
                labelStoreName.Text  = STORE_NAME;
                labelStoreAddr1.Text = STORE_ADDRESS;
                labelStoreAddr2.Text = STORE_CITY + " " + STORE_STATE + " " + STORE_ZIP;
                labelEmpNo.Text      = empNo;
                labelCaseNo.Text     = seizedata.PoliceInformation.CaseNumber;
                if (seizedata.RefType == "2")
                {
                    labelLoanNoHeading.Text = "Purchase Number:";
                }

                labelLoanNo.Text = seizedata.TicketNumber.ToString();
                labelAmt.Text    = string.Format("{0:C}", seizedata.Amount);

                if (new BusinessRulesProcedures(GlobalDataAccessor.Instance.DesktopSession).IsPartialPaymentAllowed(GlobalDataAccessor.Instance.CurrentSiteId))
                {
                    labelCurrentPrincipal.Text = String.Format("{0:C}", seizedata.CurrentPrincipalAmount);
                }
                else
                {
                    labelCurrentPrincipalHeading.Visible = false;
                    labelCurrentPrincipal.Visible        = false;
                }

                labelCurrentPrincipal.Text = string.Format("{0:C}", seizedata.CurrentPrincipalAmount);
                labelAgency.Text           = seizedata.PoliceInformation.Agency;
                labelSeizeNumber.Text      = seizedata.PoliceInformation.SeizeNumber.ToString();

                int i = 0;
                foreach (Item pawnItemData in seizedata.Items)
                {
                    i++;
                    itemDescription.Text += string.Format("{0} {1}{2}", i, pawnItemData.TicketDescription, System.Environment.NewLine);
                }
                Print();
            }
            Application.DoEvents();
            this.Close();
        }
示例#7
0
        public void Print(PawnLoan pawnLoan)
        {
            if (pawnLoan != null)
            {
                //Get all the data to print from the desktop session
                CustomerVO currentCust = GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer;
                if (pawnLoan.CustomerNumber != currentCust.CustomerNumber)
                {
                    currentCust = CustomerProcedures.getCustomerDataByCustomerNumber(GlobalDataAccessor.Instance.DesktopSession, pawnLoan.CustomerNumber);
                }
                if (currentCust != null)
                {
                    //Set all the date for printing
                    transactionDate   = ShopDateTime.Instance.ShopDate.FormatDate();
                    tktNo             = pawnLoan.TicketNumber;
                    customerName      = currentCust.LastName + "," + currentCust.FirstName;
                    custMiddleInitial = currentCust.MiddleInitial.ToUpper();

                    loanAmount = pawnLoan.Amount;
                    AddressVO custAddress = currentCust.getHomeAddress();
                    if (custAddress != null)
                    {
                        custAddr      = custAddress.Address1 + " " + custAddress.Address2;
                        custAddrLine2 = custAddress.City + "," + custAddress.State_Code + " " + custAddress.ZipCode;
                    }
                    IdentificationVO custId = currentCust.getFirstIdentity();
                    if (custId != null)
                    {
                        idData = custId.IdType + "-" + custId.IdIssuerCode + "-" + custId.IdValue;
                    }
                    loanDate    = pawnLoan.OriginationDate.FormatDate();
                    loanDueDate = pawnLoan.DueDate.FormatDate();
                    lostTktFee  = pawnLoan.LostTicketInfo.LostTicketFee;
                    //Get the interest amount
                    decimal interestCharges = 0.0M;
                    var     finCharges      = (from feeData in pawnLoan.Fees
                                               where feeData.FeeType == FeeTypes.INTEREST
                                               select feeData).FirstOrDefault();

                    if (finCharges.Value != 0)
                    {
                        interestCharges = finCharges.Value;
                    }

                    //Get the late fees
                    //If it is negative then it is a refund else it is a late fee
                    var lateFee = (from feeData in pawnLoan.Fees
                                   where feeData.FeeType == FeeTypes.LATE
                                   select feeData).FirstOrDefault();

                    if (lateFee.Value < 0)
                    {
                        refundAmt = lateFee.Value;
                    }
                    else
                    {
                        lateCharges = lateFee.Value;
                    }
                    totalPayments = loanAmount + interestCharges + refundAmt + lateCharges + lostTktFee;
                    apr           = pawnLoan.InterestRate.ToString();

                    //Open the pdf file
                    try
                    {
                        var fileName = SecurityAccessor.Instance.EncryptConfig.ClientConfig.GlobalConfiguration.BaseTemplatePath + "\\" + "lostticket.pdf";

                        if (GlobalDataAccessor.Instance.CurrentSiteId.State.Equals(States.Ohio))
                        {
                            fileName = SecurityAccessor.Instance.EncryptConfig.ClientConfig.GlobalConfiguration.BaseTemplatePath + "\\" + "lostticketOH.pdf";
                        }

                        PDFITextSharpUtilities.PdfSharpTools pdfTools;//=new PawnUtilities.ISharp.PDFITextSharpUtilities.PdfSharpTools(fileName);
                        PDFITextSharpUtilities.OpenPDFFile(fileName, out pdfTools);

                        //Generate output file name
                        string timeStamp      = DateTime.Now.ToString("yyMMddHHmmssf");
                        string genDocsDir     = SecurityAccessor.Instance.EncryptConfig.ClientConfig.GlobalConfiguration.BaseLogPath + "\\";
                        string outputFileName = genDocsDir + "LostTicketStatement" + "-" + timeStamp + ".pdf";
                        if (pdfTools == null)
                        {
                            if (FileLogger.Instance.IsLogError)
                            {
                                FileLogger.Instance.logMessage(LogLevel.ERROR, "LostTicketStatementPrint", "Could not get PDF tools instance for lost ticket statement");
                            }
                            return;
                        }
                        pdfTools.PrepForStamping(outputFileName);
                        Dictionary <string, string> lostTicketData = new Dictionary <string, string>();
                        lostTicketData.Add("TransactionDate", transactionDate);
                        lostTicketData.Add("CustomerName", customerName);
                        lostTicketData.Add("CustomerMiddleInitial", custMiddleInitial);
                        lostTicketData.Add("CustomerAddrLine1", custAddr);
                        lostTicketData.Add("CustomerAddrLine2", custAddrLine2);
                        lostTicketData.Add("CustomerIdData", idData);
                        lostTicketData.Add("DateMade", loanDate);
                        lostTicketData.Add("DateDue", loanDueDate);
                        lostTicketData.Add("TicketNumber", tktNo.ToString());
                        lostTicketData.Add("VerifyTicketNumber", tktNo.ToString());
                        lostTicketData.Add("CustomerGender", currentCust.Gender);
                        lostTicketData.Add("CustomerRace", currentCust.Race);
                        lostTicketData.Add("CustomerDOB", currentCust.DateOfBirth.FormatDate());
                        lostTicketData.Add("CustomerHeight", currentCust.Height);
                        if (currentCust.Weight > 0)
                        {
                            lostTicketData.Add("CustomerWeight", currentCust.Weight.ToString() + " lbs");
                        }
                        lostTicketData.Add("CustomerHairColor", currentCust.HairColor);
                        lostTicketData.Add("CustomerEyeColor", currentCust.EyeColor);
                        lostTicketData.Add("LostType", Commons.GetLostTicketType(pawnLoan.LostTicketInfo.LSDTicket));
                        lostTicketData.Add("AmtFinanced", String.Format("{0:C}", pawnLoan.Amount));
                        lostTicketData.Add("AmtFinanceCharges", String.Format("{0:C}", pawnLoan.InterestAmount));
                        lostTicketData.Add("AmtLateCharges", String.Format("{0:C}", lateCharges));
                        lostTicketData.Add("AmtRefunds", String.Format("{0:C}", refundAmt));
                        lostTicketData.Add("AmtTotalPayments", String.Format("{0:C}", totalPayments));
                        lostTicketData.Add("APR", apr);
                        lostTicketData.Add("LostTicketFee", String.Format("{0:0.00}", lostTktFee));

                        if (GlobalDataAccessor.Instance.CurrentSiteId.State.Equals(States.Ohio))
                        {
                            lostTicketData.Add("CurPrinAmount", pawnLoan.CurrentPrincipalAmount.ToString("c"));
                        }

                        //Add the data to the pdf file
                        if (!(PDFITextSharpUtilities.StampSimplePDFWithFormFields(pdfTools, outputFileName, false, lostTicketData)))
                        {
                            if (FileLogger.Instance.IsLogError)
                            {
                                FileLogger.Instance.logMessage(LogLevel.ERROR, "ProcessTenderController", "Could not stamp PDF document for wipe drive");
                            }
                        }
                        //Get the printer details for the form
                        string storeNumber = GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber;

                        //03/18/2010 GJL - Change for pawn sec to allow development to continue and to facilitate
                        //real machine names in the pawn sec database instead of 47-byte GUID values
                        //Printing lostticket.pdf
                        const string formName = "lostticket.pdf";
                        if (SecurityAccessor.Instance.EncryptConfig.ClientConfig.ClientConfiguration.PrintEnabled &&
                            GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.IsValid)
                        {
                            if (FileLogger.Instance.IsLogInfo)
                            {
                                FileLogger.Instance.logMessage(LogLevel.INFO, this, "Printing lost ticket statement on: {0}",
                                                               GlobalDataAccessor.Instance.DesktopSession.LaserPrinter);
                            }
                            if (!(PDFITextSharpUtilities.PrintOutputPDFFile(
                                      GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.IPAddress,
                                      GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.Port.ToString(), 1, pdfTools)))
                            {
                                if (FileLogger.Instance.IsLogError)
                                {
                                    FileLogger.Instance.logMessage(LogLevel.ERROR, "LostTicketStatement",
                                                                   "Could not print lost ticket statement PDF file");
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        BasicExceptionHandler.Instance.AddException("Error in printing lost ticket statement", new ApplicationException(ex.Message));
                        return;
                    }
                }
            }
        }