예제 #1
0
        public IServiceResult Validate(DateTime startDate, DateTime?endDate, double amount, TimeInterval timeInterval)
        {
            if (!endDate.HasValue)
            {
                endDate = startDate.AddYears(1);
            }

            double?auxAmount = amount;  //this can o cannot be used.
            var    result    = FieldValidations(startDate, endDate, 0f, ref auxAmount, timeInterval);

            if (result.Errors.Any())
            {
                return(new ServiceResult(null, result.Errors));
            }

            //var resultEntity = result.Result as Goal;
            var entity = new Goal
            {
                StartDate = startDate,
                EndDate   = endDate.Value,
                Amount    = amount
            };

            entity.OperationDetails = GoalEngine.CreateRecurrent(startDate, endDate.Value, amount, timeInterval);

            return(new ServiceResult(entity, result.Errors));
        }
예제 #2
0
        public override Recurrent Add(Recurrent item, TimeInterval timeInterval)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }
            if (item.Goal == null)
            {
                throw new ArgumentNullException("item", "Property item.Goal can't be Null.");
            }

            //  this should be here, since its the BL...
            item.Goal.OperationDetails = GoalEngine.Create(item.Goal, timeInterval);

            return(Add(item));
        }
예제 #3
0
        public virtual IServiceResult Validate(DateTime startDate, DateTime?endDate,
                                               double?partAmount,
                                               double?fullAmount,
                                               TimeInterval timeInterval)
        {
            var result = FieldValidations(startDate, endDate, partAmount, ref fullAmount, timeInterval);

            if (result.Errors.Any())
            {
                return(new ServiceResult(null, result.Errors));
            }

            var entity = result.Result as Goal;

            entity.OperationDetails = GoalEngine.Create(entity, timeInterval);

            return(new ServiceResult(entity, result.Errors));
        }
예제 #4
0
 public OperationExpected NextExpectedOperation(Goal goal)
 {
     return(GoalEngine.GetOperationExpected(goal));
 }