private void ValidateSavingPerMonth(decimal savingPerMonth, ErrorFound errors) { if (savingPerMonth < AMOUNT_ALLOWED) { errors.IsThereAnyError = true; errors.ErrorsFound.Add(Messages.ResourceManager.GetString("SavingCalculation_SavingPerMonthError")); } }
private void ValidateSavingGoalNull(SavingGoal savingGoal, ErrorFound errors) { if (savingGoal is null) { errors.IsThereAnyError = true; errors.ErrorsFound.Add(Messages.ResourceManager.GetString("SavingCalculation_SavingGoalNull")); } }
private void ValidateSavingGoalId(int idSavingGoal, ErrorFound errors) { if (idSavingGoal < ID_ALLOWED) { errors.IsThereAnyError = true; errors.ErrorsFound.Add(Messages.ResourceManager.GetString("SavingCalculation_IdError")); } }
private void ValidateAmount(decimal estimatedAmount, ErrorFound errors) { if (estimatedAmount < AMOUNT_ALLOWED) { errors.IsThereAnyError = true; errors.ErrorsFound.Add(Messages.ResourceManager.GetString("SavingCalculation_EstimatedAmountError")); } }
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")); } }
private void ValidateSavingGoalDescription(SavingGoal savingGoal, ErrorFound errors) { if (savingGoal.Description == string.Empty) { errors.IsThereAnyError = true; errors.ErrorsFound.Add(Messages.ResourceManager.GetString("SavingGoal_DescriptionError")); } }
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); }
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); }
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); }
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); }
private void ValidateMonthlyMovementsNull(List <MonthlyMovement> monthlyMovements, ErrorFound errors) { if (monthlyMovements is null) { errors.IsThereAnyError = true; errors.ErrorsFound.Add(Messages.ResourceManager.GetString("SavingCalculation_MonthlyMovementsNull")); } }
protected virtual void OnErrorFound(string fileName) { ErrorFound?.Invoke(this, fileName); }
internal void Error(string description) { ErrorFound?.Invoke(parameterName, description, parameterValue); }
private void ValidateMonthlyMovements(List <MonthlyMovement> monthlyMovements, ErrorFound errors) { if (monthlyMovements.Count > 0) { errors.IsThereAnyError = true; errors.ErrorsFound.Add(Messages.ResourceManager.GetString("SavingGoal_MonthlyMovements")); } }