예제 #1
0
        private void FillChecks(string type, string randomKey, LoanRestructureForm form)
        {
            List<ChequeModel> chequeList = new List<ChequeModel>();
            ChequeModel model = new ChequeModel();
            ChequeModel mod = new ChequeModel();
            if (type == "splitLoan")
            {
                if (form.RetrieveCheque1(randomKey) != null)
                {
                    model = form.RetrieveCheque1(randomKey);
                    mod = form.Cheques1.FirstOrDefault();
                    chequeList = form.Cheques1;
                    hdnChequeType.Value = 1;
                }
                else
                {
                    model = form.RetrieveCheque2(randomKey);
                    mod = form.Cheques2.FirstOrDefault();
                    chequeList = form.Cheques2;
                    hdnChequeType.Value = 2;
                }
            }
            else
            {
                model = form.RetrieveCheque(randomKey);
                mod = form.Cheques.FirstOrDefault();
                chequeList = form.Cheques;
                hdnChequeType.Value = 0;
            }

            if (model.RandomKey != mod.RandomKey)
            {
                //btnBankBrowse.Hidden = true;
                txtBank.Text = mod.BankName;
                hdnBankID.Value = mod.BankId;
            }
            else if (model.RandomKey == mod.RandomKey)
            {
                hdnBankID.Value = model.BankId;
                txtBank.Text = model.BankName;
            }

            txtAmount.Text = model.Amount.ToString("N");
            dtCheckDate.SelectedDate = model.ChequeDate;
            txtCheckNumber.Text = model.ChequeNumber;
            txtPaymentMethod.Text = PaymentMethodType.PersonalCheckType.Name;
        }
        protected void FillReceivables(LoanRestructureListModel model, LoanRestructureListModel model2, LoanRestructureForm oldForm)
        {
            FinancialAccount financialAccount1 = Context.FinancialAccounts.SingleOrDefault(entity => entity.Id == model.LoanID && entity.Agreement.EndDate == null);

            var loanAccount1 = financialAccount1.LoanAccount;

            var totalReceivable1 = 0M;

            totalReceivable1 = oldForm.ComputeTotalLoanReceivables(loanAccount1);

            txtCarryOverReceivables1.Text = totalReceivable1.ToString("N");
            nfReceivableAdd1.MaxValue = double.Parse(totalReceivable1.ToString());
            //if (totalReceivable1 == 0)
                nfReceivableAdd1.Number = 0;

            FinancialAccount financialAccount2 = Context.FinancialAccounts.SingleOrDefault(entity => entity.Id == model2.LoanID && entity.Agreement.EndDate == null);

            var loanAccount2 = financialAccount2.LoanAccount;

            var totalReceivable2 = 0M;

            totalReceivable2 = oldForm.ComputeTotalLoanReceivables(loanAccount2);

            txtCarryOverReceivables2.Text = totalReceivable2.ToString("N");
            nfReceivableAdd2.MaxValue = double.Parse(totalReceivable2.ToString());

            //if (totalReceivable2 == 0)
                nfReceivableAdd2.Number = 0;
        }
        private void Fill(LoanRestructureForm form)
        {
            LoanRestructureForm newForm = this.CreateOrRetrieve<LoanRestructureForm>();
            newForm.CustomerId = form.CustomerId;
            newForm.FinancialAccountId = form.FinancialAccountId;
            newForm.FinancialAccountId2 = form.FinancialAccountId2;
            newForm.ConsolidateLoanAccount = form.ConsolidateLoanAccount;
            newForm.ModifiedBy = form.ModifiedBy;
            newForm.FinancialProductId1 = form.FinancialProductId1;

            var today = DateTime.Now;
            newForm.ConsolidateLoanAmortizationSchedule.Clear();
            newForm.GenerateConsolidateLoanAmortizationSchedule(today);

            storeAmortizationSchedule.DataSource = newForm.ConsolidateLoanAmortizationSchedule.ToList();
            storeAmortizationSchedule.DataBind();

            int partyRoleId = newForm.CustomerId;
            var customer = Context.Customers.SingleOrDefault(entity => entity.PartyRoleId == partyRoleId);
            var type = customer.CurrentCustomerCategory.CustomerCategoryType1.Name;

            //if (type == CustomerCategoryType.OthersType.Name)
            //{
                newForm.Cheques.Clear();
                foreach (var items in newForm.ConsolidateLoanAmortizationSchedule)
                {
                    ChequeModel chequeModel = new ChequeModel();
                    chequeModel.BankName = "";
                    chequeModel.ChequeDate = items.ScheduledPaymentDate;
                    chequeModel.ChequeNumber = "";
                    chequeModel.Status = ChequeStatusType.ReceivedType.Name;
                    chequeModel.TransactionDate = today;
                    chequeModel.Amount = items.TotalPayment;

                    newForm.AddChequesListItem(chequeModel);
                }

                storeCheques.DataSource = newForm.AvailableCheques;
                storeCheques.DataBind();

                if (newForm.AvailableCheques.Count() != 0)
                    grdpnlCheque.Disabled = false;
            //}
        }