Example #1
0
        public DealDC GetDealData(string dealJSON)
        {
            DealDC  dealobjDC = new DealDC();
            dynamic data      = Newtonsoft.Json.Linq.JObject.Parse(dealJSON);

            dealobjDC.CREDealID = data["CREDealID"];
            dealobjDC.DealName  = data["DealName"];
            List <ScheduleDC> _listSchedule = new List <ScheduleDC>();

            //Schedule DataContract
            var schedule = data["Funding"];

            for (int ndx = 0; ndx < schedule.Count; ndx++)
            {
                ScheduleDC schDC = new ScheduleDC();
                schDC.Period                = Convert.ToInt32(schedule[ndx].Period);
                schDC.Date                  = schedule[ndx].Date == null ? null : Convert.ToDateTime(schedule[ndx].Date);
                schDC.FixedAmort            = schedule[ndx].FixedAmort == null ? 0 : Convert.ToDecimal(schedule[ndx].FixedAmort);
                schDC.GlobalCurtailment     = schedule[ndx].Global == null? 0 : Convert.ToDecimal(schedule[ndx].Global);
                schDC.FutureFundingStandard = schedule[ndx].StandardLoan == null? 0 : Convert.ToDecimal(schedule[ndx].StandardLoan);
                _listSchedule.Add(schDC);
            }

            dealobjDC.ListSchedule = _listSchedule;
            return(dealobjDC);
        }
Example #2
0
        public void GenerateCashFlow(string dealjson)
        {
            int           ndx     = 0;
            CashflowLogic cfLogic = new CashflowLogic();
            DealDC        dealDC  = cfLogic.GetDealData(dealjson);
            TimeSpan      sp      = (dealDC.FullyExtMaturityDate - dealDC.ClosingDate).GetValueOrDefault();

            for (ndx = 0; ndx < sp.TotalDays; ndx++)
            {
                CashflowDC periodCF = new CashflowDC();
                periodCF.Period = ndx;
                periodCF.Date   = dealDC.ClosingDate.Value.Date.AddDays(ndx);

                periodCF.BeginningBalance      = ndx == 0 ? dealDC.InitialFunding.GetValueOrDefault(0) : DealCashFlow[ndx - 1].EndingBalance.GetValueOrDefault(0);
                periodCF.FundingAndCurtailment = cfLogic.GetFundingOrCurtailment(dealDC.ListSchedule, periodCF.Date);
            }
        }