예제 #1
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);
        }
예제 #2
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);
        }