예제 #1
0
 public DividendRules(decimal companyTaxRate, RoundingRule dividendRoundingRule, bool drpActive, DrpMethod drpMethod)
 {
     CompanyTaxRate       = companyTaxRate;
     DividendRoundingRule = dividendRoundingRule;
     DrpActive            = drpActive;
     DrpMethod            = drpMethod;
 }
예제 #2
0
 public ChangeDividendRulesEvent(Guid entityId, int version, Date changeDate, decimal companyTaxRate, RoundingRule dividendRoundingRule, bool drpActive, DrpMethod drpMethod)
     : base(entityId, version)
 {
     ChangeDate           = changeDate;
     CompanyTaxRate       = companyTaxRate;
     DividendRoundingRule = dividendRoundingRule;
     DrpActive            = drpActive;
     DrpMethod            = drpMethod;
 }
        public void AddDividendRules(Date fromDate, Date toDate, decimal companyTaxRate, RoundingRule roundingRule, bool drpActive, DrpMethod drpMethod)
        {
            var history = new HistoricDividendRules()
            {
                FromDate       = fromDate,
                ToDate         = toDate,
                CompanyTaxRate = companyTaxRate,
                RoundingRule   = roundingRule,
                DrpActive      = drpActive,
                DrpMethod      = drpMethod
            };

            DividendRules.Add(history);
        }
예제 #4
0
        public ServiceResult ChangeDividendRules(Guid id, Date changeDate, decimal companyTaxRate, RoundingRule newDividendRoundingRule, bool drpActive, DrpMethod newDrpMethod)
        {
            var stock = _StockQuery.Get(id);

            if (stock == null)
            {
                return(ServiceResult.NotFound());
            }

            if (!stock.IsEffectiveAt(changeDate))
            {
                return(ServiceResult.Error("Stock is not active at {0}", changeDate.ToShortDateString()));
            }

            if ((companyTaxRate < 0.00m) || (companyTaxRate >= 1.00m))
            {
                return(ServiceResult.Error("Company tax rate must be between 0 and 1"));
            }

            stock.ChangeDividendRules(changeDate, companyTaxRate, newDividendRoundingRule, drpActive, newDrpMethod);
            _StockRepository.Update(stock);

            return(ServiceResult.Ok());
        }
예제 #5
0
        public void ChangeDividendRules(Date changeDate, decimal companyTaxRate, RoundingRule newDividendRoundingRule, bool drpActive, DrpMethod newDrpMethod)
        {
            if (!IsEffectiveAt(changeDate))
            {
                throw new EffectiveDateException(String.Format("Stock not active at {0}", changeDate));
            }

            var properties = Properties[changeDate];

            var @event = new ChangeDividendRulesEvent(Id, Version, changeDate, companyTaxRate, newDividendRoundingRule, drpActive, newDrpMethod);

            Apply(@event);
            _Events.Add(@event);
        }