Пример #1
0
        public ActionResult AffiliatedFees(AffiliateFeesViewModel viewModel)
        {
            if (ModelState.IsValid)
            {

                db.AffiliatedFees.Add(viewModel.AffiliatedFee);
                db.SaveChanges();

                Transaction transaction = db.Transactions.Find(viewModel.TransactionId);
                transaction.AffiliatedFee = viewModel.AffiliatedFee;

                db.SaveChanges();

                CalculationFacade facade = new CalculationFacade();
                CapCalculationResult capCalcResult = facade.CalculateAffiliatedFees(viewModel, viewModel.LoanAmount);

                db.CapCalculationResults.Add(capCalcResult);
                db.SaveChanges();

                transaction.CapCalculationResult = capCalcResult;

                db.SaveChanges();

                return RedirectToAction("ShowAffiliatedFeesCalculation", new { transactionId = transaction.Id });
            }

            return View(viewModel);
        }
Пример #2
0
        public CapCalculationResult CalculateAffiliatedFees(AffiliateFeesViewModel affiliatedFees, decimal loanAmount)
        {
            CapCalculationResultInitial initial = TotalAffiliatedFees(affiliatedFees);
            CapCalculationResult capCalculationResult = CalculateInitial(initial, loanAmount);

            return capCalculationResult;
        }
Пример #3
0
        public ActionResult AffiliatedFees(int transactionId, decimal loanAmount)
        {
            AffiliateFeesViewModel viewModel = new AffiliateFeesViewModel();
            viewModel.TransactionId = transactionId;
            viewModel.LoanAmount = loanAmount;

            return View("AffiliatedFees", viewModel);
        }
Пример #4
0
        private CapCalculationResultInitial TotalAffiliatedFees(AffiliateFeesViewModel affiliatedFees)
        {
            CapCalculationResultInitial result = new CapCalculationResultInitial();

            if (IsValidField(affiliatedFees.AffiliatedFee.TotalSettlementFee))
            {
                result.Total += (decimal)affiliatedFees.AffiliatedFee.TotalSettlementFee;
                result.Summary.Add("Total Settlement Fee: $" + affiliatedFees.AffiliatedFee.TotalSettlementFee);
            }

            if (IsValidField(affiliatedFees.AffiliatedFee.LenderFee))
            {
                result.Total += (decimal)affiliatedFees.AffiliatedFee.LenderFee;
                result.Summary.Add("Lender Fee: $" + affiliatedFees.AffiliatedFee.LenderFee);
            }

            if (IsValidField(affiliatedFees.AffiliatedFee.PMI))
            {
                result.Total += (decimal)affiliatedFees.AffiliatedFee.PMI;
                result.Summary.Add("PMI: $" + affiliatedFees.AffiliatedFee.PMI);
            }

            if (IsValidField(affiliatedFees.AffiliatedFee.AppraisalFee))
            {
                result.Total += (decimal)affiliatedFees.AffiliatedFee.AppraisalFee;
                result.Summary.Add("Appraisal Fee: $" + affiliatedFees.AffiliatedFee.AppraisalFee);
            }

            if (IsValidField(affiliatedFees.AffiliatedFee.CreditFee))
            {
                result.Total += (decimal)affiliatedFees.AffiliatedFee.CreditFee;
                result.Summary.Add("Credit Fee: $" + affiliatedFees.AffiliatedFee.CreditFee);
            }

            if (IsValidField(affiliatedFees.AffiliatedFee.InspectionFee))
            {
                result.Total += (decimal)affiliatedFees.AffiliatedFee.InspectionFee;
                result.Summary.Add("Inspection Fee: $" + affiliatedFees.AffiliatedFee.InspectionFee);
            }

            if (IsValidField(affiliatedFees.AffiliatedFee.MortageOriginatorCompensationAmount))
            {
                result.Total += (decimal)affiliatedFees.AffiliatedFee.MortageOriginatorCompensationAmount;
                result.Summary.Add("Mortgage Originator Compensation Amount: $" + affiliatedFees.AffiliatedFee.MortageOriginatorCompensationAmount);
            }

            if (IsValidField(affiliatedFees.AffiliatedFee.NotaryFee))
            {
                result.Total += (decimal)affiliatedFees.AffiliatedFee.NotaryFee;
                result.Summary.Add("Notary Fee: $" + affiliatedFees.AffiliatedFee.NotaryFee);
            }

            if (IsValidField(affiliatedFees.AffiliatedFee.SurveyFee))
            {
                result.Total += (decimal)affiliatedFees.AffiliatedFee.SurveyFee;
                result.Summary.Add("Survey Fee: $" + affiliatedFees.AffiliatedFee.SurveyFee);
            }

            if (IsValidField(affiliatedFees.AffiliatedFee.EscrowFee))
            {
                result.Total += (decimal)affiliatedFees.AffiliatedFee.LenderFee;
                result.Summary.Add("Escrow Fee: $" + affiliatedFees.AffiliatedFee.LenderFee);
            }

            return result;
        }