Beispiel #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);
        }
        public List <CustomerBalances> GetCustomerBalances(string customerNo, DateTime endDate, List <CustomerBalances> custBalances)
        {
            custBalances = custBalances ?? new List <CustomerBalances>();
            custBalances.Clear();
            try
            {
                string       sqlstatement = " CustomerBalances '" + ValueConverters.format_sql_string(customerNo) + "','" + ValueConverters.FormatSqlDate(endDate, true) + "'";
                DbDataReader reader = DbConnector.GetSqlReader(sqlstatement);
                double       balance, interest, insurance, penalty, appraisal;
                while (reader.Read())
                {
                    balance   = ValueConverters.StringtoDouble(reader["Balance"].ToString());
                    interest  = ValueConverters.StringtoDouble(reader["IntBalance"].ToString());
                    insurance = ValueConverters.StringtoDouble(reader["InsBalance"].ToString());
                    penalty   = ValueConverters.StringtoDouble(reader["PenBalance"].ToString());
                    appraisal = ValueConverters.StringtoDouble(reader["AppBalance"].ToString());

                    custBalances.Add(new CustomerBalances
                    {
                        CustomerNo   = ValueConverters.ConvertNullToEmptyString(reader["CustomerNo"].ToString()),
                        AccountNo    = ValueConverters.ConvertNullToEmptyString(reader["AccountNo"].ToString()),
                        CustomerName = ValueConverters.ConvertNullToEmptyString(reader["CustomerName"].ToString()),
                        Category     = ValueConverters.ConvertNullToEmptyString(reader["Category"].ToString()),
                        Ttype        = ValueConverters.ConvertNullToEmptyString(reader["ttype"].ToString()),
                        ProductName  = ValueConverters.ConvertNullToEmptyString(reader["ProductName"].ToString()),
                        Balance      = balance,
                        IntBalance   = interest,
                        InsBalance   = insurance,
                        PenBalance   = penalty,
                        AppBalance   = appraisal,
                        TotalBalance = ValueConverters.Round05(balance + interest + insurance + penalty + appraisal),
                        OtherCharges = insurance + penalty + appraisal
                    });
                }
                reader.Close();
            }
            catch (Exception ex)
            {
                Utility.WriteErrorLog(ref ex);
            }
            return(custBalances);
        }
Beispiel #3
0
        private void GetAccountClosureHistory(CustomerAccountsView customerAccountsDetails)
        {
            customerAccountsDetails.ClosedAccountDetails = new List <PostingJournalsHeaderViewModel>();
            var closeDetails = mainDb.tbl_PostingJournals
                               .Where(x => (x.PostingDocid == "ACRS" || x.PostingDocid == "ACLS") &&
                                      x.AccountNo == customerAccountsDetails.AccountNo)
                               .ToList();


            if (closeDetails != null)
            {
                foreach (var item in closeDetails)
                {
                    PostingJournalsHeaderViewModel lineItem = new PostingJournalsHeaderViewModel();

                    lineItem.PostingDescription = ValueConverters.ConvertNullToEmptyString(item.PostingDescription);
                    lineItem.PostDate           = ValueConverters.ConvertNullToDatetime(item.PostDate);
                    lineItem.PostedBy           = ValueConverters.ConvertNullToEmptyString(item.PostedBy);
                    lineItem.CreateDate         = ValueConverters.ConvertNullToDatetime(item.CreateDate);
                    lineItem.CreatedBy          = ValueConverters.ConvertNullToEmptyString(item.CreatedBy);
                    lineItem.PaymentMethodName  = item.PostingDocid == "ACLS" ? "Closure" : "Rejoin";

                    var opennedBy = mainDb.tbl_users.FirstOrDefault(x => x.LoginCode == lineItem.PostedBy);
                    if (opennedBy != null)
                    {
                        lineItem.PostedByName = ValueConverters.ConvertNullToEmptyString(opennedBy.LoginName);
                    }
                    opennedBy = mainDb.tbl_users.FirstOrDefault(x => x.LoginCode == lineItem.CreatedBy);
                    if (opennedBy != null)
                    {
                        lineItem.CreatedByName = ValueConverters.ConvertNullToEmptyString(opennedBy.LoginName);
                    }
                    customerAccountsDetails.ClosedAccountDetails.Add(lineItem);
                }
            }
        }
Beispiel #4
0
        public CustomerAccountsView GetAccountByAccountNumber(string accountNumber, bool closureDetails = false)
        {
            customerAccounts = new List <CustomerAccountsView>();


            var account = mainDb.tbl_CustomerAccounts.Where(x => x.AccountNo == accountNumber).ToList();

            if (account != null && account.Count != 0)
            {
                GetAccountDetails(account.FirstOrDefault().CustomerNo, account, false);
            }


            var customerAccountsDetails = (from accounts in account
                                           select new CustomerAccountsView
            {
                AccountNo = accounts.AccountNo,
                OpenedBy = accounts.OpenedBy,
                AccountComments = accounts.AccountComments,
                AccountRemarks = accounts.AccountRemarks,
                AccountType = accounts.AccountType,
                Locked = accounts.Locked,
                OpenedDate = accounts.OpenedDate,
                AuthorisedBy = accounts.AuthorisedBy,
                AuthorisedDate = accounts.AuthorisedDate,
                DateClosed = accounts.DateClosed,
                ClosedBy = accounts.ClosedBy,
                CustomerNo = accounts.CustomerNo,
                ReasonClosed = string.Empty
            }).FirstOrDefault();

            if (customerAccountsDetails != null && customerAccountsDetails.AuthorisedBy != null)
            {
                var opennedBy = mainDb.tbl_users.FirstOrDefault(x => x.LoginCode == customerAccountsDetails.AuthorisedBy);
                if (opennedBy != null)
                {
                    customerAccountsDetails.AuthorisedBy = ValueConverters.ConvertNullToEmptyString(opennedBy.LoginName);
                }
            }

            if (customerAccountsDetails != null && customerAccountsDetails.OpenedBy != null)
            {
                var opennedBy = mainDb.tbl_users.FirstOrDefault(x => x.LoginCode == customerAccountsDetails.OpenedBy);
                if (opennedBy != null)
                {
                    customerAccountsDetails.OpenedBy = ValueConverters.ConvertNullToEmptyString(opennedBy.LoginName);
                }
            }
            if (customerAccountsDetails != null)
            {
                var accountTypeDetails = accounttypes.FirstOrDefault(x => x.code == customerAccountsDetails.AccountType);
                if (accountTypeDetails == null)
                {
                    accountTypeDetails = new tbl_accounttypes();
                }
                customerAccountsDetails.AccountTypeSettings = accountTypeDetails;
                customerAccountsDetails.GlMemSav            = accountTypeDetails.glmemsav;
                customerAccountsDetails.MinimumBalance      = accountTypeDetails.minimum_bal;

                if (closureDetails)
                {
                    GetAccountClosureHistory(customerAccountsDetails);
                    var lastTr = customerAccountsDetails.ClosedAccountDetails.OrderByDescending(x => x.CreateDate).FirstOrDefault();
                    if (lastTr != null)
                    {
                        customerAccountsDetails.ReasonClosed = ValueConverters.ConvertNullToEmptyString(lastTr.PostingDescription);
                    }
                }
            }

            customerAccountsDetails = customerAccountsDetails == null ? new CustomerAccountsView() : customerAccountsDetails;
            return(customerAccountsDetails);

            //  return customerAccounts.FirstOrDefault();
        }