Пример #1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="receiptNum"></param>
        /// <param name="rec"></param>
        public static bool LoadReceiptData(string receiptNum, out List<Common.Libraries.Utility.Shared.Receipt> rec, out string errorMessage)
        {
            errorMessage = string.Empty;
            rec = null;
            if (string.IsNullOrEmpty(receiptNum))
            {
                errorMessage = "Invalid receipt number.";
                return(false);
            }

            DataTable receiptDataTable;
            string errorCode;
            string errorText;

            if (!ProcessTenderProcedures.ExecuteGetReceiptDetails(
                0,
                GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber,
                "PAWN", receiptNum,
                out receiptDataTable,
                out errorCode,
                out errorText))
            {
                MessageBox.Show("Could not find receipt.");
                //errorMessage = "Unable to find receipt.";
                return(false);
            }
            rec = CustomerLoans.CreateReceipt(receiptDataTable);
            GlobalDataAccessor.Instance.DesktopSession.PawnReceipt = rec;
            return (true);
        }
Пример #2
0
        private bool getLoanData()
        {
            bool       retValue = false;
            string     errorCode;
            string     errorText;
            PawnLoan   pawnLoan;
            PawnAppVO  pawnApplication;
            CustomerVO customerObj;

            retValue = CustomerLoans.GetPawnLoan(GlobalDataAccessor.Instance.DesktopSession,
                                                 Utilities.GetIntegerValue(BuyStoreText.Text, 0), Utilities.GetIntegerValue(LoanNumberText.Text, 0),
                                                 "0", StateStatus.BLNK, true, out pawnLoan,
                                                 out pawnApplication, out customerObj,
                                                 out errorCode, out errorText);

            if (retValue && pawnLoan != null)
            {
                GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer = customerObj;

                GlobalDataAccessor.Instance.DesktopSession.CurrentPawnLoan = pawnLoan;

                GlobalDataAccessor.Instance.DesktopSession.TicketTypeLookedUp = ProductType.PAWN;
                GlobalDataAccessor.Instance.DesktopSession.TicketLookedUp     = Utilities.GetIntegerValue(LoanNumberText.Text, 0);
                this.NavControlBox.Action = NavBox.NavAction.SUBMIT;
            }

            return(retValue);
        }
        private void customButtonRefresh_Click(object sender, EventArgs e)
        {
            //call check for temp status on all the pfie loans
            var pfieTicketNumbers = new List <int>();
            var pfieStoreNumbers  = new List <string>();

            foreach (var pl in PFIELoans)
            {
                pfieTicketNumbers.Add(pl.TicketNumber);
                pfieStoreNumbers.Add(pl.OrgShopNumber);
            }
            DataTable currentTempStatus;
            var       errorCode       = string.Empty;
            var       errorMsg        = string.Empty;
            var       pfieLoanMessage = new StringBuilder();
            var       retval          = CustomerLoans.CheckForTempStatus(pfieTicketNumbers, pfieStoreNumbers, out currentTempStatus, out errorCode, out errorMsg);

            if (currentTempStatus != null && currentTempStatus.Rows.Count > 0)
            {
                var nonPFIETicketNumbers = new List <int>();
                foreach (DataRow dr in currentTempStatus.Rows)
                {
                    //check if the loan still has PFIE status
                    if (!(dr[Tempstatuscursor.TEMPSTATUS].ToString().Contains("PFIE")))
                    {
                        nonPFIETicketNumbers.Add(Utilities.GetIntegerValue(dr[Tempstatuscursor.TICKETNUMBER], 0));
                    }
                    else
                    {
                        pfieLoanMessage.Append(dr[Tempstatuscursor.TICKETNUMBER] + " is being processed by PFI.");
                    }
                }
                if (nonPFIETicketNumbers.Count > 0)
                {
                    foreach (var i in nonPFIETicketNumbers)
                    {
                        var i1    = i;
                        var index = PFIELoans.FindIndex(loan => loan.TicketNumber == i1);
                        if (index >= 0)
                        {
                            PFIELoans.RemoveAt(index);
                        }
                    }
                }
            }
            else
            {
                BasicExceptionHandler.Instance.AddException("Error fetching temp status for loans", new ApplicationException());
            }
            PFIELoanMessage = pfieLoanMessage.ToString();
            LoadData();
        }
        private void customButtonFind_Click(object sender, EventArgs e)
        {
            PawnLoan   pawnLoan;
            CustomerVO customerVO;

            CustNumber  = string.Empty;
            ReplacedICN = string.Empty;
            string errorCode;
            string errorText;
            var    retVal = CustomerLoans.GetPawnLoanLite(GlobalDataAccessor.Instance.DesktopSession, Utilities.GetIntegerValue(GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber),
                                                          Utilities.GetIntegerValue(customTextBoxLoanNo.Text), "0", StateStatus.BLNK, true, out pawnLoan, out customerVO, out errorCode, out errorText);

            if (!retVal || pawnLoan == null)
            {
                FileLogger.Instance.logMessage(LogLevel.ERROR, this, "Error trying to get loan data" + errorText);
                MessageBox.Show("Error trying to get loan details for the number entered.");
                return;
            }
            var itemSelectionFrm = new ChargeOffItemSelection();

            itemSelectionFrm.ReplaceLoan     = pawnLoan;
            itemSelectionFrm.ReplaceCustomer = customerVO;
            itemSelectionFrm.ShowDialog();

            if (itemSelectionFrm.ReplacedICN != null && itemSelectionFrm.ReplacedICN.Count > 0)
            {
                customLabelCustName.Text = customerVO.CustomerName;
                var rICN = new StringBuilder();
                var i    = 1;
                foreach (var s in itemSelectionFrm.ReplacedICN)
                {
                    rICN.Append(s);
                    if (i != itemSelectionFrm.ReplacedICN.Count)
                    {
                        rICN.Append(",");
                    }
                    i++;
                }
                customLabelReplacedICN.Text = rICN.ToString();
                CustNumber = customerVO.CustomerNumber;
            }
        }
        private object loadLoanKeys(object data)
        {
            DesktopSession cds =
                GlobalDataAccessor.Instance.DesktopSession;
            //Get the minimum store interest charge from business rule
            decimal         minFinanceCharge = new BusinessRulesProcedures(GlobalDataAccessor.Instance.DesktopSession).GetStoreMinimumIntCharge();
            string          errorCode;
            string          errorDesc;
            List <PawnLoan> pawnLoanKeys;

            //Check if pawn loan keys is already loaded for this customer in session
            //if yes do not call SP again
            if (cds.PawnLoanKeys.Count > 0 && cds.PawnLoanKeys[0].CustomerNumber == cds.ActiveCustomer.CustomerNumber)
            {
                return(true);
            }
            cds.PawnLoanKeys.Clear();
            bool spCallRes =
                CustomerLoans.GetLoanKeys(this.customerNumber, minFinanceCharge, ShopDateTime.Instance.ShopDate,
                                          out pawnLoanKeys, out errorCode, out errorDesc);

            cds.PawnLoanKeys.AddRange(pawnLoanKeys.AsEnumerable());
            return(spCallRes);
        }
Пример #6
0
        public static bool Get_PFI_Details(
            string aStoreNumber, DateTime pfiDate,
            List <int> ticketNumber,
            out List <PawnLoan> pawnLoans,
            out List <PawnAppVO> pawnApplications,
            out List <CustomerVO> customerVOs,
            out List <PurchaseVO> purchases,
            out string errorCode,
            out string errorMsg)
        {
            errorCode        = string.Empty;
            errorMsg         = string.Empty;
            purchases        = new List <PurchaseVO>();
            pawnLoans        = new List <PawnLoan>();
            customerVOs      = new List <CustomerVO>();
            pawnApplications = new List <PawnAppVO>();

            if (GlobalDataAccessor.Instance.DesktopSession == null ||
                GlobalDataAccessor.Instance.OracleDA == null)
            {
                errorCode = "updatePawnLostTicketFlag Failed";
                errorMsg  = "Invalid desktop session or data accessor";
                return(false);
            }

            //Get data accessor object
            OracleDataAccessor dA = GlobalDataAccessor.Instance.OracleDA;

            List <OracleProcParam>            inParams   = new List <OracleProcParam>();
            List <PairType <string, string> > refCursors = new List <PairType <string, string> >();

            //Add store number as param
            inParams.Add(new OracleProcParam("p_store_nr", aStoreNumber));
            inParams.Add(new OracleProcParam("p_pfi_eligible", pfiDate));

            //Add ticket number array as param
            OracleProcParam orpmTicketNumber = new OracleProcParam(ParameterDirection.Input, DataTypeConstants.PawnDataType.LISTINT, "p_ticketList", ticketNumber.Count);

            foreach (int i in ticketNumber)
            {
                orpmTicketNumber.AddValue(i);
            }
            inParams.Add(orpmTicketNumber);

            //Add general ref cursors
            refCursors.Add(new PairType <string, string>("o_pawn_app", PAWN_APP));
            refCursors.Add(new PairType <string, string>("o_pawn_loan", PAWN_LOAN));
            refCursors.Add(new PairType <string, string>("o_pawn_mdselist", PAWN_MDSE_LIST));
            refCursors.Add(new PairType <string, string>("o_pawn_gunlist", PAWN_GUN_LIST));
            refCursors.Add(new PairType <string, string>("o_pawn_mdhistlist", PAWN_MDHIST_LIST));
            refCursors.Add(new PairType <string, string>("o_pawn_otherdsclist", PAWN_OTHERDSC_LIST));
            refCursors.Add(new PairType <string, string>("o_pawn_receiptdetlist", PAWN_RECEIPTDET_LIST));
            refCursors.Add(new PairType <string, string>("o_pawn_feelist", PAWN_FEE_LIST));
            refCursors.Add(new PairType <string, string>("o_purch", PurchaseProcedures.PURCHASE_DATA));
            refCursors.Add(new PairType <string, string>("o_pawn_partpaymentist", PAWN_PAYMENTDETAILS_LIST));

            DataSet outputDataSet;

            bool rt = false;

            if (inParams.Count > 0)
            {
                rt = dA.issueSqlStoredProcCommand(
                    "ccsowner", "pawn_mdse_procs", "get_PFIDetails_a",
                    inParams, refCursors, "o_return_code", "o_return_text",
                    out outputDataSet);
            }
            else
            {
                errorCode = "updatePawnLostTicketFlag";
                errorMsg  = "No valid input parameters given";
                return(false);
            }

            if (outputDataSet != null && rt)
            {
                if (outputDataSet.Tables != null && outputDataSet.Tables.Count > 0)
                {
                    CustomerLoans.ParseDataSet(outputDataSet, out pawnLoans, out pawnApplications);

                    // map dataSet tablenames to enable Purchase parsing
                    reassignName(outputDataSet,
                                 CustomerLoans.PAWN_MDSE_LIST,
                                 PurchaseProcedures.PAWN_MDSE_LIST);
                    reassignName(outputDataSet,
                                 CustomerLoans.PAWN_MDHIST_LIST,
                                 PurchaseProcedures.PAWN_MDHIST_LIST);
                    reassignName(outputDataSet,
                                 CustomerLoans.PAWN_RECEIPTDET_LIST,
                                 PurchaseProcedures.PAWN_RECEIPTDET_LIST);
                    reassignName(outputDataSet,
                                 CustomerLoans.PAWN_GUN_LIST,
                                 PurchaseProcedures.PAWN_GUN_LIST);

                    PurchaseProcedures.ParseDataSet(outputDataSet, out purchases);

                    /*
                     * if (CollectionUtilities.isEmpty(pawnLoans))
                     * {
                     * errorCode = "Parsing the data from the stored procedure failed";
                     * errorMsg = "loan object is null";
                     * return false;
                     * }
                     *
                     * if (CollectionUtilities.isEmpty(purchases))
                     * {
                     * errorCode = "Parsing the data from the stored procedure failed";
                     * errorMsg = "purchases object is null";
                     * return false;
                     * }
                     */
                    errorCode = "0";
                    errorMsg  = string.Empty;
                    return(true);
                }
                else
                {
                    errorCode = "1";
                    errorMsg  = "No Data Found";
                    return(true);
                }
            }

            return(rt);
        }
Пример #7
0
        /// <summary>
        /// Get all the pawn loans based on the id number passed
        /// </summary>
        /// <param name="storeNumber"></param>
        /// <param name="pawnLoanStatus"></param>
        /// <param name="TempStatus"></param>
        /// <param name="date"></param>
        /// <param name="bGetCustomerInfo"></param>
        /// <param name="pawnLoans"></param>
        /// <param name="pawnApplications"></param>
        /// <param name="customerVOs"></param>
        /// <param name="errorCode"></param>
        /// <param name="errorText"></param>
        /// <returns></returns>
        public static bool GetStoreLoans(
            string storeNumber,
            ProductStatus pawnLoanStatus,
            StateStatus TempStatus,
            DateTime date,
            bool bGetCustomerInfo,
            out List <PawnLoan> pawnLoans,
            out List <PawnAppVO> pawnApplications,
            out List <CustomerVO> customerVOs,
            out string errorCode,
            out string errorText)
        {
            //Set default output params
            pawnLoans        = new List <PawnLoan>();
            pawnApplications = new List <PawnAppVO>();
            customerVOs      = new List <CustomerVO>();
            errorCode        = string.Empty;
            errorText        = string.Empty;

            if (GlobalDataAccessor.Instance == null ||
                GlobalDataAccessor.Instance.OracleDA == null)
            {
                errorCode = "GetStoreLoansFailed";
                errorText = "Invalid desktop session or data accessor";
                return(false);
            }

            //Get data accessor object
            OracleDataAccessor     dA       = GlobalDataAccessor.Instance.OracleDA;
            List <OracleProcParam> inParams = new List <OracleProcParam>();

            //Add store number
            inParams.Add(new OracleProcParam("p_store_number", storeNumber));
            inParams.Add(new OracleProcParam("p_status", pawnLoanStatus.ToString()));
            inParams.Add(new OracleProcParam("p_date", date));
            if (TempStatus != StateStatus.BLNK)
            {
                inParams.Add(new OracleProcParam("p_temp_type", TempStatus.ToString()));
            }
            else
            {
                inParams.Add(new OracleProcParam("p_temp_type", "0"));
            }

            List <PairType <string, string> > refCursArr = new List <PairType <string, string> >();

            refCursArr.Add(new PairType <string, string>("o_pawn_app", PAWN_APP));
            refCursArr.Add(new PairType <string, string>("o_pawn_loan", PAWN_LOAN));
            refCursArr.Add(new PairType <string, string>("o_pawn_mdselist", PAWN_MDSE_LIST));
            refCursArr.Add(new PairType <string, string>("o_pawn_gunlist", PAWN_GUN_LIST));
            refCursArr.Add(new PairType <string, string>("o_pawn_mdhistlist", PAWN_MDHIST_LIST));
            refCursArr.Add(new PairType <string, string>("o_pawn_otherdsclist", PAWN_OTHERDSC_LIST));
            refCursArr.Add(new PairType <string, string>("o_pawn_receiptdetlist", PAWN_RECEIPTDET_LIST));
            refCursArr.Add(new PairType <string, string>("o_pawn_feelist", PAWN_FEE_LIST));
            DataSet outputDataSet;
            bool    retVal = false;

            try
            {
                retVal = dA.issueSqlStoredProcCommand(
                    "ccsowner", "pawn_store_procs",
                    "get_store_loans", inParams,
                    refCursArr, "o_return_code",
                    "o_return_text",
                    out outputDataSet);
            }
            catch (Exception oEx)
            {
                BasicExceptionHandler.Instance.AddException("Calling get_store_loans stored procedure", oEx);
                errorCode = " -- GetStoreLoans failed";
                errorText = " --- Exception: " + oEx.Message;
                return(false);
            }

            if (retVal == false)
            {
                errorCode = dA.ErrorCode;
                errorText = dA.ErrorDescription;
                return(false);
            }
            else
            {
                if (outputDataSet != null && outputDataSet.IsInitialized)
                {
                    if (outputDataSet.Tables != null && outputDataSet.Tables.Count > 0)
                    {
                        try
                        {
                            CustomerLoans.ParseDataSet(outputDataSet, out pawnLoans, out pawnApplications);
                            if (CollectionUtilities.isEmpty(pawnLoans) ||
                                CollectionUtilities.isEmpty(pawnApplications))
                            {
                                errorCode = "Parsing the data from the stored procedure failed";
                                errorText = "Pawn Loans or the PawnApplications object is null";
                                return(false);
                            }

                            if (bGetCustomerInfo)
                            {
                                customerVOs.AddRange(pawnLoans.Select(pLoan => CustomerProcedures.getCustomerDataByCustomerNumber(GlobalDataAccessor.Instance.DesktopSession, pLoan.CustomerNumber)));
                            }

                            return(true);
                        }
                        catch (Exception ex)
                        {
                            errorCode = "Parsing the data from the stored procedure failed";
                            errorText = ex.Message;
                            return(false);
                        }
                    }
                    else
                    {
                        errorText = "No records found.";
                        return(false);
                    }
                }
            }

            errorCode = "GETSTOREDLOANSFAIL";
            errorText = "Operation failed";
            return(false);
        }
        /// <summary>
        /// Sets the storage id from the lookup data.
        /// </summary>
        /// <returns>True upon success.</returns>
        private bool SetStorageIDFromLookup()
        {
            var productsList =
                (System.Windows.Forms.ComboBox)productTypeList1.Controls[0];
            var ticketNumber = -1;

            if (productsList.SelectedIndex == 0 ||
                !int.TryParse(txtTicketNumber.Text.Trim(), out ticketNumber))
            {
                System.Windows.Forms.MessageBox.Show(
                    "Please ensure you have selected a product and ticket number.");
                return(false);
            }

            var docInfo = new CouchDbUtils.PawnDocInfo();

            string errString;

            docInfo.StoreNumber = GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber;
            if (productsList.SelectedValue.ToString() == DocumentHelper.RECIEPT)
            {
                docInfo.ReceiptNumber = ticketNumber;
                docInfo.SetDocumentSearchType(CouchDbUtils.DocSearchType.RECEIPT);
            }
            else if (productsList.SelectedValue.ToString() == DocumentHelper.POLICE_CARD)
            {
                docInfo.ReceiptNumber = ticketNumber;
                docInfo.TicketNumber  = ticketNumber;
                docInfo.SetDocumentSearchType(CouchDbUtils.DocSearchType.POLICE_CARD);
            }
            else if (productsList.SelectedValue.ToString() == DocumentHelper.RELEASE_FINGERPRINTS)
            {
                docInfo.TicketNumber = ticketNumber;
                docInfo.SetDocumentSearchType(CouchDbUtils.DocSearchType.RELEASE_FINGERPRINTS);
            }
            else
            {
                docInfo.TicketNumber = ticketNumber;
                docInfo.SetDocumentSearchType(CouchDbUtils.DocSearchType.STORE_TICKET);
            }

            //Also set the meta tag here as well as search type.
            if (productsList.SelectedValue.Equals(DocumentHelper.CUSTOMER_BUY) ||
                productsList.SelectedValue.Equals(DocumentHelper.PURCHASE_RETURN))
            {
                if (GlobalDataAccessor.Instance.CurrentSiteId.State == States.Indiana)
                {
                    docInfo.AuxInfo = PurchaseDocumentIndiana.PURCHASE_AUXINFOTAG;
                }
                else
                {
                    docInfo.AuxInfo = PurchaseDocumentGenerator.PURCHASE_AUXINFOTAG;
                }
            }
            else if (productsList.SelectedValue.Equals(DocumentHelper.PAWN_LOAN))
            {
                PawnLoan   pawnLoan;
                PawnAppVO  pApp;
                CustomerVO customerVO;
                string     errorCode;
                string     errorText;

                if (!CustomerLoans.GetPawnLoan(GlobalDataAccessor.Instance.DesktopSession, Utilities.GetIntegerValue(GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber), ticketNumber, "0", StateStatus.BLNK, true,
                                               out pawnLoan, out pApp, out customerVO, out errorCode, out errorText))
                {
                    FileLogger.Instance.logMessage(LogLevel.ERROR, this, "Error trying to get loan data" + errorText);
                    MessageBox.Show("Error trying to get loan details for the number entered.");
                    return(false);
                }

                if (pawnLoan.DateMade.Date != ShopDateTime.Instance.FullShopDateTime.Date)
                {
                    FileLogger.Instance.logMessage(LogLevel.WARN, this, "Cannot reprint loan documents for " + ticketNumber.ToString() + " on a previous date");
                    MessageBox.Show("This document is not eligible for reprint after the loan date.");
                    return(false);
                }
            }
            else if (productsList.SelectedValue.Equals(DocumentHelper.POLICE_CARD))
            {
                this.DocumentType = Document.DocTypeNames.TEXT;
            }
            else if (productsList.SelectedValue.Equals(DocumentHelper.RECIEPT))
            {
                this.DocumentType = Document.DocTypeNames.RECEIPT;
            }
            else if (productsList.SelectedValue.Equals(DocumentHelper.RELEASE_FINGERPRINTS))
            {
                this.DocumentType = Document.DocTypeNames.PDF;
            }
            else
            {
                throw new NotImplementedException("This product has not been implemented yet.");
            }

            var lastStorageId = documentHelper.GetStorageId(Utilities.GetStringValue(productsList.SelectedValue, null), docInfo, out errString);

            if (!string.IsNullOrEmpty(lastStorageId))
            {
                this.StorageId = lastStorageId;
            }
            else
            {
                MessageBox.Show("Could not find the document.");
                return(false);
            }

            return(true);
        }
Пример #9
0
        private void TicketsDataGridView_CellMouseUp(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.ColumnIndex == TicketsDataGridView.Columns["FindColumn"].Index && e.RowIndex >= 0)
            {
                if (TicketsDataGridView["FindColumn", e.RowIndex].ReadOnly)
                {
                    return;
                }

                string sStoreNumber  = Utilities.GetStringValue(TicketsDataGridView["StoreColumn", e.RowIndex].Value, string.Empty);
                int    iTicketNumber = Utilities.GetIntegerValue(TicketsDataGridView["TicketColumn", e.RowIndex].Value, 0);

                //Duplicate check -- Madhu - BZ # 147 - prevent adding if it already exists in the grid
                bool exists            = false;
                int  existingTicketNum = 0;
                foreach (DataGridViewRow dr in TicketsDataGridView.Rows)
                {
                    existingTicketNum = Utilities.GetIntegerValue(dr.Cells["TicketColumn"].Value, 0);
                    if (dr.Index != e.RowIndex && existingTicketNum != 0 && iTicketNumber != 0 &&
                        existingTicketNum == iTicketNumber)
                    {
                        MessageBox.Show("Loan Number " + existingTicketNum + " has already been added in this list.");
                        exists = true;
                        break;
                    }
                }
                if (!exists)
                {
                    if (!string.IsNullOrEmpty(iTicketNumber.ToString()))
                    {
                        exists = parentWindow.SearchGrid(iTicketNumber.ToString());
                        if (exists)
                        {
                            MessageBox.Show("Loan Number " + iTicketNumber + " has already been added.");
                        }
                    }
                }

                if (exists)
                {
                    return;
                }
                //duplicate check end

                //no ticket - S. Murphy need store to default to current store if none is entered
                if (string.IsNullOrEmpty(sStoreNumber))
                {
                    sStoreNumber = GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber;
                }

                // Place Holder for Stored Proc call
                PawnLoan   pawnLoan   = new PawnLoan();
                PawnAppVO  pawnAppVO  = new PawnAppVO();
                CustomerVO customerVO = new CustomerVO();
                var        sErrorCode = string.Empty;
                var        sErrorText = string.Empty;

                if (CustomerLoans.GetPawnLoan(GlobalDataAccessor.Instance.DesktopSession, Convert.ToInt32(sStoreNumber), iTicketNumber, "0", StateStatus.BLNK, true,
                                              out pawnLoan, out pawnAppVO, out customerVO, out sErrorCode, out sErrorText))
                {
                    if (pawnLoan != null && pawnLoan.LoanStatus != ProductStatus.IP)
                    {
                        //TicketsDataGridView["NameColumn", e.RowIndex].Style.ForeColor = Color.Red;
                        DataGridViewCellStyle style = new DataGridViewCellStyle();
                        style.ForeColor = Color.Red;
                        TicketsDataGridView["NameColumn", e.RowIndex].Style.ApplyStyle(style);

                        TicketsDataGridView["NameColumn", e.RowIndex].Value = "Invalid Ticket";
                        //Madhu fix for BZ # 147
                        addButton.Enabled = false;
                    }
                    else
                    {
                        //Madhu fix for BZ # 147
                        EnableAddButton();
                        //addButton.Enabled = true;

                        if (customerVO.LastName != "")
                        {
                            TicketsDataGridView["NameColumn", e.RowIndex].Value = (
                                customerVO.FirstName
                                + " "
                                + customerVO.MiddleInitial + " "
                                + customerVO.LastName
                                ).Replace("  ", " ");
                            if (pawnLoan != null)
                            {
                                if (_AddedPawnLoans.FindIndex(delegate(PawnLoan pl)
                                {
                                    return(pl.TicketNumber == pawnLoan.TicketNumber);
                                }) < 0)
                                {
                                    _AddedPawnLoans.Add(pawnLoan);
                                }
                            }
                        }
                    }
                    if (TicketsDataGridView.CurrentRow != null)
                    {
                        //no ticket - S. Murphy need store to default to current store if none is entered
                        if (string.IsNullOrEmpty(sStoreNumber))
                        {
                            sStoreNumber = GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber;
                        }
                    }

                    if (TicketsDataGridView.CurrentRow.Index == e.RowIndex &&
                        TicketsDataGridView.Rows.Count - 1 == e.RowIndex &&
                        sStoreNumber != "" && iTicketNumber != 0)
                    {
                        TicketsDataGridView.Rows.Add();
                        //Madhu BZ # 147
                        TicketsDataGridView.EditingControlShowing += new DataGridViewEditingControlShowingEventHandler(TicketsDataGridView_EditingControlShowing);
                        foreach (DataGridViewRow dr in TicketsDataGridView.Rows)
                        {
                            string sStoreNum  = Utilities.GetStringValue(dr.Cells["StoreColumn"].Value);
                            int    iTicketNum = Utilities.GetIntegerValue(dr.Cells["TicketColumn"].Value);

                            if (string.IsNullOrEmpty(sStoreNum) || iTicketNum == 0)
                            {
                                dr.Cells["FindColumn"].ReadOnly = true;
                            }
                        }
                    }
                }
                else
                {
                    //Madhu fix for BZ # 147
                    if (TicketsDataGridView != null && TicketsDataGridView.Rows.Count <= 1)
                    {
                        addButton.Enabled = false;
                    }

                    MessageBox.Show("A Ticket Number was not found using the Store Number entered.", "Lookup Ticket Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }
Пример #10
0
        private void loadReceiptData()
        {
            //this.receiptDataTextBox.Text;
            DesktopSession cds = GlobalDataAccessor.Instance.DesktopSession;
            StringBuilder  sb  = new StringBuilder();

            sb.AppendLine(StringUtilities.centerString(CASHAMERICATXT, TXTBOXWIDTH));
            sb.AppendLine(StringUtilities.centerString(ProcessTenderController.STORE_NAME, TXTBOXWIDTH));
            this.store_short_name     = ProcessTenderController.STORE_NAME;
            this.store_street_address = ProcessTenderController.STORE_ADDRESS;
            this.store_city_state_zip = ProcessTenderController.STORE_CITY + ", " +
                                        ProcessTenderController.STORE_STATE + ProcessTenderController.STORE_ZIP;
            this.store_phone = ProcessTenderController.STORE_PHONE;
            sb.AppendLine(StringUtilities.centerString(ProcessTenderController.STORE_ADDRESS, TXTBOXWIDTH));
            sb.AppendLine(StringUtilities.centerString(ProcessTenderController.STORE_CITY
                                                       + ", "
                                                       + ProcessTenderController.STORE_STATE
                                                       + " "
                                                       + ProcessTenderController.STORE_ZIP, TXTBOXWIDTH));

            sb.AppendLine();
            sb.AppendLine(StringUtilities.centerString(ProcessTenderController.STORE_PHONE, TXTBOXWIDTH));
            if (CollectionUtilities.isNotEmpty(cds.PawnReceipt))
            {
                Common.Libraries.Utility.Shared.Receipt pReceipt = cds.PawnReceipt[0];
                DateTime receiptDt = pReceipt.Date;

                //Load loan
                PawnLoan   pLoan;
                PawnAppVO  pApp;
                CustomerVO custVO;
                string     errorCode;
                string     errorText;
                try
                {
                    int receiptStore = Int32.Parse(pReceipt.StoreNumber);
                    int ticketNum    = Int32.Parse(pReceipt.RefNumber);
                    if (!CustomerLoans.GetPawnLoan(GlobalDataAccessor.Instance.DesktopSession, receiptStore, ticketNum, "0", StateStatus.BLNK, true,
                                                   out pLoan, out pApp, out custVO, out errorCode, out errorText))
                    {
                        //Do something about the error here
                        MessageBox.Show("Cannot find loan associated with receipt.");
                        NavControlBox.Action = NavBox.NavAction.CANCEL;
                        return;
                    }
                    this.pwnLoan = pLoan;
                    this.pwnApp  = pApp;

                    if (custVO == null)
                    {
                        //Do something about the error here
                        MessageBox.Show("Cannot find customer associated with receipt");
                        NavControlBox.Action = NavBox.NavAction.CANCEL;
                        return;
                    }

                    /* this.voidReceiptButton.Enabled =
                     * (this.pwnLoan.LoanStatus == PawnLoanStatus.IP);*/
                    this.printButton.Enabled = true;
                    this.f_date_and_time     = receiptDt.ToString("d", DateTimeFormatInfo.InvariantInfo) + " " +
                                               this.pwnLoan.MadeTime.ToShortTimeString();
                    sb.AppendLine(StringUtilities.centerString(this.f_date_and_time, TXTBOXWIDTH));
                    this.receipt_number = "" + pReceipt.ReceiptNumber;
                    sb.AppendLine(StringUtilities.centerString(RECEIPTNUM + pReceipt.ReceiptNumber, TXTBOXWIDTH));
                    sb.AppendLine();
                    sb.AppendLine(StringUtilities.centerString(CUSTOMERLABEL +
                                                               custVO.LastName + ", " + custVO.FirstName, TXTBOXWIDTH));
                    this.f_cust_name = custVO.LastName + ", " + custVO.FirstName.Substring(0, 1);
                    sb.AppendLine(StringUtilities.centerString(LOANLABEL +
                                                               pLoan.OrgShopNumber + pLoan.TicketNumber, TXTBOXWIDTH));
                    sb.AppendLine();
                    this.ticketAmount = this.pwnLoan.Amount.ToString("C");
                    this.ticketNumber = this.pwnLoan.TicketNumber.ToString();
                    if (this.pwnLoan.LoanStatus == ProductStatus.IP)
                    {
                        sb.AppendLine("1 Pawn Loan");
                        sb.AppendLine(BARDATA);
                        sb.AppendLine("Cash Paid TO Customer          " + pReceipt.Amount.ToString("C"));
                    }
                    else if (this.pwnLoan.LoanStatus == ProductStatus.PU)
                    {
                        sb.AppendLine("Pickup Pawn Loan");
                        sb.AppendLine(BARDATA);
                        sb.AppendLine("Cash Received FROM Customer    " + pReceipt.Amount.ToString("C"));
                    }
                    sb.AppendLine();
                    sb.AppendLine();
                    sb.AppendLine(StringUtilities.centerString(EMPLOYEELABEL + pReceipt.EntID, 40));
                    this.emp_number = pReceipt.EntID;
                    sb.AppendLine(TBARDATA);

                    //Add receipt information to text box
                    this.receiptDataTextBox.Text = sb.ToString();
                    this.receiptDataTextBox.Update();
                }
                catch (Exception)
                {
                    MessageBox.Show("Cannot find receipt.");
                    this.NavControlBox.Action = NavBox.NavAction.CANCEL;
                    this.Close();
                }
            }
        }
Пример #11
0
 void bwLookupPawnTicket_DoWork(object sender, DoWorkEventArgs e)
 {
     _retValue = CustomerLoans.GetPawnLoan(GlobalDataAccessor.Instance.DesktopSession, _storeNumber, _ticketNumber, idType, StateStatus.BLNK, true, out _pawnLoan,
                                           out _pawnApplication, out _custObject, out _errorCode, out _errorText);
 }