コード例 #1
0
 private void ValidateSavingPerMonth(decimal savingPerMonth, ErrorFound errors)
 {
     if (savingPerMonth < AMOUNT_ALLOWED)
     {
         errors.IsThereAnyError = true;
         errors.ErrorsFound.Add(Messages.ResourceManager.GetString("SavingCalculation_SavingPerMonthError"));
     }
 }
コード例 #2
0
 private void ValidateSavingGoalNull(SavingGoal savingGoal, ErrorFound errors)
 {
     if (savingGoal is null)
     {
         errors.IsThereAnyError = true;
         errors.ErrorsFound.Add(Messages.ResourceManager.GetString("SavingCalculation_SavingGoalNull"));
     }
 }
コード例 #3
0
 private void ValidateSavingGoalId(int idSavingGoal, ErrorFound errors)
 {
     if (idSavingGoal < ID_ALLOWED)
     {
         errors.IsThereAnyError = true;
         errors.ErrorsFound.Add(Messages.ResourceManager.GetString("SavingCalculation_IdError"));
     }
 }
コード例 #4
0
 private void ValidateAmount(decimal estimatedAmount, ErrorFound errors)
 {
     if (estimatedAmount < AMOUNT_ALLOWED)
     {
         errors.IsThereAnyError = true;
         errors.ErrorsFound.Add(Messages.ResourceManager.GetString("SavingCalculation_EstimatedAmountError"));
     }
 }
コード例 #5
0
 private void ValidateSavingGoalAmountSaved(SavingGoal savingGoal, ErrorFound errors)
 {
     if (savingGoal.MonthlyMovements[0].SavedAmount < decimal.Zero)
     {
         errors.IsThereAnyError = true;
         errors.ErrorsFound.Add(Messages.ResourceManager.GetString("SavingGoal_AmountSavedError"));
     }
 }
コード例 #6
0
 private void ValidateSavingGoalDescription(SavingGoal savingGoal, ErrorFound errors)
 {
     if (savingGoal.Description == string.Empty)
     {
         errors.IsThereAnyError = true;
         errors.ErrorsFound.Add(Messages.ResourceManager.GetString("SavingGoal_DescriptionError"));
     }
 }
コード例 #7
0
        public ErrorFound ValidateSavingCalculation(SavingGoal savingGoal, decimal estimatedAmount, decimal savingPerMonth)
        {
            ErrorFound errors = new ErrorFound();

            ValidateSavingGoalNull(savingGoal, errors);
            ValidateMonthlyMovementsNull(savingGoal.MonthlyMovements, errors);
            ValidateAmount(estimatedAmount, errors);
            ValidateSavingPerMonth(savingPerMonth, errors);

            return(errors);
        }
コード例 #8
0
        public ErrorFound ValidateEstimatedAmount(decimal estimatedAmount, decimal totalAmount)
        {
            ErrorFound errors = new ErrorFound();

            if (estimatedAmount <= totalAmount)
            {
                errors.IsThereAnyError = true;
                errors.ErrorsFound.Add(Messages.ResourceManager.GetString("SavingCalculation_TargetAmountError"));
            }

            return(errors);
        }
コード例 #9
0
        public ErrorFound ValidateSavingGoalId(int idSavingGoal)
        {
            ErrorFound errors = new ErrorFound();

            if (idSavingGoal < ID_ALLOWED)
            {
                errors.IsThereAnyError = true;
                errors.ErrorsFound.Add(Messages.ResourceManager.GetString("SavingGoal_IdError"));
            }

            return(errors);
        }
コード例 #10
0
        public ErrorFound ValidateSavingGoal(SavingGoal savingGoal)
        {
            ErrorFound errors = new ErrorFound();

            ValidateSavingGoalNull(savingGoal, errors);
            if (errors.IsThereAnyError)
            {
                return(errors);
            }
            ValidateSavingGoalDescription(savingGoal, errors);
            ValidateMonthlyMovementsNull(savingGoal.MonthlyMovements, errors);
            if (errors.IsThereAnyError)
            {
                return(errors);
            }
            ValidateMonthlyMovements(savingGoal.MonthlyMovements, errors);
            ValidateSavingGoalAmountSaved(savingGoal, errors);

            return(errors);
        }
コード例 #11
0
 private void ValidateMonthlyMovementsNull(List <MonthlyMovement> monthlyMovements, ErrorFound errors)
 {
     if (monthlyMovements is null)
     {
         errors.IsThereAnyError = true;
         errors.ErrorsFound.Add(Messages.ResourceManager.GetString("SavingCalculation_MonthlyMovementsNull"));
     }
 }
コード例 #12
0
 protected virtual void OnErrorFound(string fileName)
 {
     ErrorFound?.Invoke(this, fileName);
 }
コード例 #13
0
 internal void Error(string description)
 {
     ErrorFound?.Invoke(parameterName, description, parameterValue);
 }
コード例 #14
0
 private void ValidateMonthlyMovements(List <MonthlyMovement> monthlyMovements, ErrorFound errors)
 {
     if (monthlyMovements.Count > 0)
     {
         errors.IsThereAnyError = true;
         errors.ErrorsFound.Add(Messages.ResourceManager.GetString("SavingGoal_MonthlyMovements"));
     }
 }