Esempio n. 1
0
        public virtual ActionResult ReferenceInformation(ConvertCurrencyViewModel model)
        {
            if (model == null)
            {
                model = new ConvertCurrencyViewModel();
            }

            var modelExchanged = new ProjectedLoanModel();

            modelExchanged.ProjectedYears  = model.ProjectedYears;
            modelExchanged.ProjectedMonths = model.ProjectedMonths;
            modelExchanged.OperationNumber = model.OperationNumber;

            var referenceInformationRequest = new ReferenceInformationRequest()
            {
                OperationNumber        = model.OperationNumber,
                Model                  = modelExchanged,
                SelectedYear           = model.SelectedYear,
                LoanNumber             = model.LoanNumber,
                IsExecution            = model.IsExecution,
                ExchangeRates          = model.ExchangeRates,
                CurrentProjectionMonth = model.CurrentProjectionMonth
            };

            var referenceInformationResponse = _disbursementService
                                               .GetReferenceInformationByYear(referenceInformationRequest);

            modelExchanged.Projects = referenceInformationResponse.ReferenceInfo;

            FillProjectedYearsList(modelExchanged);
            return(PartialView("_GridReferenceInformation", (IProjectionViewModel)modelExchanged));
        }
Esempio n. 2
0
        private IProjectionViewModel MappProjectionViewModelModel(
            ConvertCurrencyViewModel projectionsModel)
        {
            OperationLevelProjectionsViewModel model = new OperationLevelProjectionsViewModel()
            {
                Balance       = projectionsModel.Balance,
                Cancellations = projectionsModel.Cancellations,
                CurrentDisbursementExpirationDate =
                    projectionsModel.CurrentDisbursementExpirationDate,
                CurrentProjectionMonth = projectionsModel.CurrentProjectionMonth,
                Disbursement           = default(decimal),
                IsExecution            = projectionsModel.IsExecution,
                IsOperationLevel       = false,
                OldProjection          = projectionsModel.OldProjection,
                OtherFinancingSources  = projectionsModel.OtherFinancingSources,
                PCMailId           = string.Empty,
                ProjectedMonths    = null,
                ProjectedYears     = projectionsModel.ProjectedYears,
                ProjectedYearsList = null,
                Projects           = null,
                RemainingBalance   = projectionsModel.RemainingBalance,
                SumofProjections   = default(decimal),
                Total = projectionsModel.Total,
                TotalProjectionFinancialPlan = default(decimal),
                UndisbursedBalance           = default(decimal)
            };

            return((IProjectionViewModel)model);
        }
Esempio n. 3
0
        public virtual ActionResult RetrieveFinancialData(
            string operationNumber,
            ConvertCurrencyViewModel projectionsModel)
        {
            if (projectionsModel == null)
            {
                return(new HttpStatusCodeResult(
                           HttpStatusCode.BadRequest,
                           DisbursementValues.INVALID_REQUEST));
            }

            var financialResponse = _disbursementService
                                    .GetFinancialPlan(new FinancialPlanProjectionRequest()
            {
                ApprovedCurrency = projectionsModel.CurrCode,
                ContractNumber   = projectionsModel.LoanNumber,
                IsInExecution    = projectionsModel.IsExecution,
                OperationNumber  = projectionsModel.OperationNumber,
                ProjectionsModel = projectionsModel
            });

            string htmlStringView = string.Empty;

            if (financialResponse.IsValid)
            {
                projectionsModel.ProjectedYears = financialResponse.Projections;
                var outOfRangeProjections = projectionsModel.CurrentProjectionRequest
                                            .Where(x => x.IsOutofRange);
                foreach (var item in outOfRangeProjections)
                {
                    var months = projectionsModel.ProjectedYears
                                 .FirstOrDefault(y => y.Year == item.Year);
                    if (months == null)
                    {
                        continue;
                    }

                    var month = months.ProjectedMonths.FirstOrDefault(m => m.Month == item.Month);
                    if (month != null)
                    {
                        month.ProjectedAmount = decimal.MinValue;
                    }
                }

                IProjectionViewModel resultModel = MappProjectionViewModelModel(projectionsModel);
                htmlStringView = Helpers.ViewHelper
                                 .ViewStringify("~/Areas/Disbursement/Views/Shared/_GridProjectForm.cshtml",
                                                resultModel,
                                                this);
            }

            return(Json(
                       new
            {
                FinancialData = htmlStringView,
                MessageType = financialResponse.MessageType,
                IsValid = financialResponse.IsValid
            },
                       JsonRequestBehavior.AllowGet));
        }
        private IProjectionViewModel MappProjectionViewModelModel(
            ConvertCurrencyViewModel projectionsModel)
        {
            LoanLevelProjectionsEditViewModel loanModel = new LoanLevelProjectionsEditViewModel()
            {
                Balance       = projectionsModel.Balance,
                Cancellations = projectionsModel.Cancellations,
                CurrentDisbursementeExpirationDate = DateTime.Now,
                CurrentDisbursementExpirationDate  =
                    projectionsModel.CurrentDisbursementExpirationDate,
                OriginalExpirationDate = projectionsModel.OriginalExpirationDate,
                CurrentProjectionMonth = projectionsModel.CurrentProjectionMonth,
                Disbursement           = default(decimal),
                GroupOperations        = false,
                IsExecution            = projectionsModel.IsExecution,
                IsOperationLevel       = false,
                OldProjection          = projectionsModel.OldProjection,
                OtherFinancingSources  = projectionsModel.OtherFinancingSources,
                PCMailId           = string.Empty,
                ProjectedLoans     = null,
                ProjectedMonths    = null,
                ProjectedYears     = projectionsModel.ProjectedYears,
                ProjectedYearsList = null,
                Projects           = null,
                RemainingBalance   = projectionsModel.RemainingBalance,
                SumofProjections   = default(decimal),
                Total = projectionsModel.Total,
                TotalProjectionFinancialPlan = default(decimal),
                UndisbursedBalance           = default(decimal),
                UserId   = default(int),
                CurrCode = projectionsModel.CurrCode
            };

            return((IProjectionViewModel)loanModel);
        }
        public virtual ActionResult GridProjections(ConvertCurrencyViewModel model)
        {
            if (model == null)
            {
                model = new ConvertCurrencyViewModel();
            }

            var modelExchanged = _disbursementService.ExchangeGridProjections(model);

            return(PartialView("_GridProjections", (IProjectionViewModel)modelExchanged));
        }
        public virtual ActionResult GroupingSection(ConvertCurrencyViewModel model)
        {
            if (model == null)
            {
                model = new ConvertCurrencyViewModel();
            }

            var modelExchanged = _disbursementService.ExchangeHeaderLoanLevelSection(model);

            return(PartialView("Partials/GroupingSection", modelExchanged));
        }
        private ConvertCurrencyViewModel CreateNewConvertCurrencyViewModel(
            ProjectedLoanModel modelExchanged,
            ConvertCurrencyViewModel originalModel)
        {
            if (originalModel != null)
            {
                ConvertCurrencyViewModel model = new ConvertCurrencyViewModel()
                {
                    HasOperationLevelProjection = originalModel.HasOperationLevelProjection,
                    Balance                           = originalModel.Balance,
                    RemainingBalance                  = originalModel.RemainingBalance,
                    IsExecution                       = originalModel.IsExecution,
                    EditMode                          = originalModel.EditMode,
                    Cancellations                     = originalModel.Cancellations,
                    CurrCode                          = originalModel.CurrCode,
                    PartialEligibilityDate            = originalModel.PartialEligibilityDate,
                    TotalEligibilityDate              = originalModel.TotalEligibilityDate,
                    OriginalExpirationDate            = originalModel.OriginalExpirationDate,
                    CurrentDisbursementExpirationDate =
                        originalModel.CurrentDisbursementExpirationDate,
                    CummulativeExtensions = originalModel.CummulativeExtensions,
                    OperationNumber       = originalModel.OperationNumber,
                    LoanNumber            = originalModel.LoanNumber,
                    ProjectedYears        = originalModel.ProjectedYears,
                    ProjectedMonths       = originalModel.ProjectedMonths,
                    SelectedYear          = originalModel.SelectedYear,
                    ExchangeRate          = originalModel.ExchangeRate,

                    ActualAccumDisbCurrentAccumProj =
                        modelExchanged.Projects[DisbursementValues.LITERAL_ACTUAL],
                    AccumProjAgreedAccumProjPerc =
                        modelExchanged.Projects[DisbursementValues.LITERAL_ACTUAL_AGREED],
                    AccumProjAgreedAccumProj =
                        modelExchanged.Projects[DisbursementValues.LITERAL_ACTUAL_AGREED_ACCUM],
                    AgreedAccumProj =
                        modelExchanged.Projects[DisbursementValues.LITERAL_AGREED_ACCUM],
                    AgreedProjection =
                        modelExchanged.Projects[DisbursementValues.LITERAL_AGREED_PROJECTION],
                };

                return(model);
            }
            else
            {
                return(new ConvertCurrencyViewModel());
            }
        }
        public ActionResult Index(ConvertCurrencyViewModel cur)
        {
            if (ModelState.IsValid)
            {
                string fromcurrname = cur.fromCurrency.Name;
                string tocurrname   = cur.toCurrency.Name;

                //rate is taken by passing both dropdown currency code
                decimal rate = CurrencyClient.GetConversionRate("Currency/GetConversionRate?fromcurrname=" + fromcurrname + "&tocurrname=" + tocurrname).Result;
                ViewBag.result = cur.CurrencyToConvert * rate;
            }
            //getting this select list value form Currency client class
            var fromCurrencyList = CurrencyClient.GetFromCurrencyListAsync().Result;

            ViewBag.FromCurrencies = new SelectList(fromCurrencyList, "CurrencyCode", "Name");

            var ToCurrencyList = CurrencyClient.GetToCurrencyListAsync().Result;

            ViewBag.ToCurrencies = new SelectList(ToCurrencyList, "CurrencyCode", "Name");

            return(View());
        }