Esempio n. 1
0
        public static CashflowType Create(string value)
        {
            var cashflowType = new CashflowType();

            cashflowType.Value = value;
            return(cashflowType);
        }
Esempio n. 2
0
 public static string GetCashflowTypeID(CashflowType type)
 {
     if (type == CashflowType.Income)
         return Constants.CashflowTypeIncomeID;
     else
         return Constants.CashflowTypeExpenseID;
 }
Esempio n. 3
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="accStartDate">计息开始日</param>
 /// <param name="accEndDate">计息结束日</param>
 /// <param name="paymentDate">支付日</param>
 /// <param name="paymentAmount">支付金额</param>
 /// <param name="paymentCurrency">支付币种</param>
 /// <param name="cashflowType">现金流类型</param>
 /// <param name="isFixed">是否固定现金流</param>
 /// <param name="df">折现因子</param>
 /// <param name="cfCalcDetails">计算细节</param>
 /// <param name="refStartDate">参考开始日</param>
 /// <param name="refEndDate">参考结束日</param>
 /// <param name="startPrincipal">开始本金</param>
 /// <param name="couponRate">利率</param>
 public Cashflow(
     Date accStartDate,
     Date accEndDate,
     Date paymentDate,
     double paymentAmount,
     CurrencyCode paymentCurrency,
     CashflowType cashflowType,
     bool isFixed,
     double df,
     CfCalculationDetail[] cfCalcDetails,
     Date refStartDate     = null,
     Date refEndDate       = null,
     double startPrincipal = 100.0,
     double couponRate     = 0.0)
 {
     AccrualStartDate   = accStartDate;
     AccrualEndDate     = accEndDate;
     PaymentDate        = paymentDate;
     PaymentAmount      = paymentAmount;
     PaymentCurrency    = paymentCurrency;
     CashflowType       = cashflowType;
     DiscountFactor     = df;
     IsFixed            = isFixed;
     CalculationDetails = cfCalcDetails;
     RefStartDate       = refStartDate;
     RefEndDate         = refEndDate;
     CouponRate         = couponRate;
     StartPrincipal     = startPrincipal;
 }
Esempio n. 4
0
        // GET: CashflowTypes/Create
        public IActionResult Create()
        {
            //return View();
            var _view = new CashflowType();

            return(View(_view));
        }
Esempio n. 5
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Name,StatusFlag,LastUpdate")] CashflowType cashflowType)
        {
            if (id != cashflowType.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    cashflowType.LastUpdate = DateTime.Now;
                    _context.Update(cashflowType);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CashflowTypeExists(cashflowType.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(cashflowType));
        }
        /// <summary>
        /// A helper to extract properties from a namedvalueset..
        /// </summary>
        /// <param name="propertyCollection">The collection of properties.</param>
        public static CashflowType ExtractCashflowType(NamedValueSet propertyCollection)
        {
            CashflowType cashflowType   = null;
            var          dictionaryKeys = propertyCollection.ToDictionary();

            if (dictionaryKeys.ContainsKey("CashflowType"))
            {
                var result = propertyCollection.Get("CashflowType").AsValue <string>();
                cashflowType = new CashflowType {
                    Value = result
                };
            }
            return(cashflowType);
        }
Esempio n. 7
0
        public async Task <IActionResult> Create([Bind("ID,Name,StatusFlag,LastUpdate")] CashflowType cashflowType)
        {
            if (ModelState.IsValid)
            {
                var user = await _userManager.GetUserAsync(User);

                cashflowType.User = user;

                _context.Add(cashflowType);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(cashflowType));
        }
Esempio n. 8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PriceableCashflow"/> class.
        /// </summary>
        /// <param name="cashflowId">The identifier.</param>
        /// <param name="payerIsBaseParty">The is base party flag.</param>
        /// <param name="modelIdentifier">The _model identifier.</param>
        /// <param name="amount">The amount.</param>
        /// <param name="paymentDate">The payment date.</param>
        /// <param name="paymentType">Type of the payment.</param>
        /// <param name="cashflowType">Type of the cashflow.</param>
        /// <param name="includePaymentDate">if set to <c>true</c> [include payment date].</param>
        /// <param name="paymentCalendar">Type paymentCalendar.</param>
        protected PriceableCashflow
        (
            string cashflowId
            , string modelIdentifier
            , bool payerIsBaseParty
            , Money amount
            , AdjustableOrAdjustedDate paymentDate
            , PaymentType paymentType
            , CashflowType cashflowType
            , bool includePaymentDate
            , IBusinessCalendar paymentCalendar)
        {
            Multiplier = 1.0m;
            var date = AdjustedDateHelper.GetAdjustedDate(paymentCalendar, paymentDate);

            if (date != null)
            {
                PaymentDate = (DateTime)date;
            }

            var containsPaymentDateAdjustments = AdjustableOrAdjustedDateHelper.Contains(paymentDate, ItemsChoiceType.dateAdjustments, out var dateAdjustments);

            if (containsPaymentDateAdjustments && dateAdjustments != null)
            {
                PaymentDateAdjustments = (BusinessDayAdjustments)dateAdjustments;
            }
            PayerIsBaseParty = payerIsBaseParty;
            Id = cashflowId;
            ModelIdentifier               = modelIdentifier;
            PaymentType                   = paymentType;
            PaymentAmount                 = amount;
            ForecastAmount                = amount;
            CashflowType                  = cashflowType;
            PaymentDateIncluded           = includePaymentDate;
            PricingStructureEvolutionType = PricingStructureEvolutionType.ForwardToSpot;
            RiskMaturityDate              = PaymentDate;
            DiscountCurveName             = CurveNameHelpers.GetDiscountCurveName(amount.currency.Value, true);
            if (!PaymentCurrencies.Contains(amount.currency.Value))
            {
                PaymentCurrencies.Add(amount.currency.Value);
            }
        }