示例#1
0
        public List <RepaymentView> ReadRepayment(TellerMobileDeposit tellerDeposit)
        {
            List <RepaymentView> repayments = new List <RepaymentView>();

            var    loanproductNames = loanProductsMgr.GetLoanCodes(db, false).ToList();
            var    investnames      = investMgr.InvestmentsCodes(db).ToList();
            String ledger           = tellerDeposit.ProductCode;

            if (ledger.Substring(0, 1) == "0")
            {
                ledger = "SAVINGS";
            }
            else
            {
                ledger = ledger.Substring(0, 1).In("A", "L") ? "LOANS" : "INVESTMENTS";
            }

            string productName = tellerDeposit.ProductCode;

            switch (ledger)
            {
            case "LOANS":
                if (loanproductNames.FirstOrDefault(x => x.LoanCode == tellerDeposit.ProductCode) != null)
                {
                    productName = ValueConverters.ConvertNullToEmptyString(
                        loanproductNames.FirstOrDefault(x => x.LoanCode == tellerDeposit.ProductCode).LoanName.ToString());
                }
                break;

            case "INVESTMENTS":
                if (investnames.FirstOrDefault(x => x.InvestmentCode == tellerDeposit.ProductCode) != null)
                {
                    productName = ValueConverters.ConvertNullToEmptyString(
                        investnames.FirstOrDefault(x => x.InvestmentCode == tellerDeposit.ProductCode).InvestmentName.ToString());
                }
                break;

            default:
                break;
            }

            repayments.Add(new RepaymentView
            {
                CustomerNo  = tellerDeposit.CustomerNo,
                ProductCode = tellerDeposit.ProductCode,
                ProductName = productName,
                Amount      = ValueConverters.ConvertDecimaltoDouble(tellerDeposit.TrxAmount),
                Ledger      = ledger,
                Section     = 1
            });

            return(repayments);
        }