Example #1
0
        /// <summary>
        /// create user rule validation.
        /// </summary>
        /// <param name="request">the request to validate.</param>
        /// <returns>errors validation</returns>
        private List <string> ValidateUpdateUserRuleRangeRange(UserRuleRequest request)
        {
            var errors = new List <string>();

            if (request?.UserRuleDtoList == null)
            {
                errors.Add(UserRuleMessageResource.NullRequest);
            }
            else
            {
                foreach (var userRule in request.UserRuleDtoList.ToList())
                {
                    errors.AddRange(GenericValidationAttribute <UserRuleDto> .ValidateAttributes("UserRuleStatus", userRule.UserRuleStatus.ToString()));
                    errors.AddRange(GenericValidationAttribute <UserRuleDto> .ValidateAttributes("UserRuleId", userRule.UserRuleId.ToString()));
                    errors.AddRange(GenericValidationAttribute <UserRuleDto> .ValidateAttributes("UserId", userRule.UserId.ToString()));
                    errors.AddRange(GenericValidationAttribute <UserRuleDto> .ValidateAttributes("RuleId", userRule.RuleId.ToString()));
                }
            }
            return(errors);
        }
Example #2
0
        /// <summary>
        /// Validate create section translation.
        /// </summary>
        /// <param name="request">the request to validate.</param>
        /// <returns>errors validation</returns>
        private List <string> ValidateCreateStepParagraphTranslationRange(StepParagraphTranslationRequest request)
        {
            var errors = new List <string>();

            if (request?.StepParagraphTranslationDtoList == null)
            {
                errors.Add(StepMessageResource.NullRequest);
            }
            else
            {
                foreach (var translation in request.StepParagraphTranslationDtoList)
                {
                    errors.AddRange(GenericValidationAttribute <StepParagraphTranslationDto> .ValidateAttributes("ParagraphDescription", translation.ParagraphDescription));
                    errors.AddRange(GenericValidationAttribute <StepParagraphTranslationDto> .ValidateAttributes("ParagraphId", translation.ParagraphId.ToString()));
                    errors.AddRange(GenericValidationAttribute <StepParagraphTranslationDto> .ValidateAttributes("LanguageId", translation.LanguageId.ToString()));
                    errors.AddRange(GenericValidationAttribute <StepParagraphTranslationDto> .ValidateAttributes("ParagraphTitle", translation.ParagraphTitle));
                }
            }
            return(errors);
        }
Example #3
0
        /// <summary>
        /// Validate update occurrence translation.
        /// </summary>
        /// <param name="request">the request to validate.</param>
        /// <returns>errors validation</returns>
        private List <string> ValidateUpdateOccurrenceTranslation(OccurrenceTranslationRequest request)
        {
            var errors = new List <string>();

            if (request?.OccurrenceTranslationDto == null)
            {
                errors.Add(OccurrenceMessageResource.NullRequest);
            }
            else
            {
                errors.AddRange(GenericValidationAttribute <OccurrenceTranslationDto> .ValidateAttributes(
                                    "OccurrenceDescription", request.OccurrenceTranslationDto.OccurrenceDescription));
                errors.AddRange(GenericValidationAttribute <OccurrenceTranslationDto> .ValidateAttributes("TranslationId",
                                                                                                          request.OccurrenceTranslationDto.TranslationId.ToString()));
                errors.AddRange(
                    GenericValidationAttribute <OccurrenceTranslationDto> .ValidateAttributes("OccurrenceTitle",
                                                                                              request.OccurrenceTranslationDto.OccurrenceTitle));
            }
            return(errors);
        }
Example #4
0
        /// <summary>
        /// Validate create news translation.
        /// </summary>
        /// <param name="request">the request to validate.</param>
        /// <returns>errors validation</returns>
        private List <string> ValidateCreateNewsTranslationRange(NewsTranslationRequest request)
        {
            var errors = new List <string>();

            if (request?.NewsTranslationDtoList == null)
            {
                errors.Add(NewsMessageResource.NullRequest);
            }
            else
            {
                foreach (var translation in request.NewsTranslationDtoList)
                {
                    errors.AddRange(GenericValidationAttribute <NewsTranslationDto> .ValidateAttributes("NewsSummary", translation.NewsSummary));
                    errors.AddRange(GenericValidationAttribute <NewsTranslationDto> .ValidateAttributes("NewsDescription", translation.NewsDescription));
                    errors.AddRange(GenericValidationAttribute <NewsTranslationDto> .ValidateAttributes("LanguageId", translation.LanguageId.ToString()));
                    errors.AddRange(GenericValidationAttribute <NewsTranslationDto> .ValidateAttributes("NewsId", translation.NewsId.ToString()));
                    errors.AddRange(GenericValidationAttribute <NewsTranslationDto> .ValidateAttributes("NewsTitle", translation.NewsTitle));
                }
            }
            return(errors);
        }
Example #5
0
        /// <summary>
        /// Validate update Country Sheet Translation Range.
        /// </summary>
        /// <param name="request">the request to validate.</param>
        /// <returns>errors validation</returns>
        private List <string> ValidateUpdateSheetTranslationRange(SheetTranslationRequest request)
        {
            List <string> errors = new List <string>();

            if (request?.SheetTranslationDtoList == null)
            {
                errors.Add(CountryMessageResource.NullRequest);
            }
            else
            {
                foreach (var translation in request.SheetTranslationDtoList)
                {
                    errors.AddRange(GenericValidationAttribute <SheetTranslationDto> .ValidateAttributes("SheetValue", translation.SheetValue));
                    errors.AddRange(GenericValidationAttribute <SheetTranslationDto> .ValidateAttributes("TranslationId", translation.TranslationId.ToString()));
                    errors.AddRange(GenericValidationAttribute <SheetTranslationDto> .ValidateAttributes("SheetId", translation.SheetId.ToString()));
                    errors.AddRange(GenericValidationAttribute <SheetTranslationDto> .ValidateAttributes("LanguageId", translation.LanguageId.ToString()));
                    errors.AddRange(GenericValidationAttribute <SheetTranslationDto> .ValidateAttributes("SheetTitle", translation.SheetTitle));
                }
            }
            return(errors);
        }
Example #6
0
        /// <summary>
        /// validate create country.
        /// </summary>
        /// <param name="countryFormData">the countryFormData to validate.</param>
        /// <returns>true if the proportises are valide.</returns>
        public bool ValidateCreateCountryFormData(CreateCountryFormData countryFormData)
        {
            List <string> errors = new List <string>();

            if (countryFormData == null)
            {
                errors.Add(SharedResources.NullFormData);
            }
            else
            {
                if (string.IsNullOrEmpty(countryFormData.CountryImageValue))
                {
                    errors.Add(CountryResources.RequiredCountryImage);
                }
                errors.AddRange(GenericValidationAttribute <CreateCountryFormData> .ValidateAttributes("CountryShortName",
                                                                                                       countryFormData.CountryShortName));
                errors.AddRange(GenericValidationAttribute <CreateCountryFormData> .ValidateAttributes("CountryCode",
                                                                                                       countryFormData.CountryCode.ToString()));
            }
            return(errors.Count == 0);
        }
        /// <summary>
        /// validate create occurrence translation.
        /// </summary>
        /// <param name="occurrenceTranslationFormData">the occurrenceTranslationFormData to validate.</param>
        /// <returns>true if the proportises are valide.</returns>
        public bool ValidateOccurrenceTranslationFormData(OccurrenceTranslationFormData occurrenceTranslationFormData)
        {
            List <string> errors = new List <string>();

            if (occurrenceTranslationFormData == null)
            {
                errors.Add(SharedResources.NullFormData);
            }
            else
            {
                errors.AddRange(GenericValidationAttribute <OccurrenceTranslationFormData> .ValidateAttributes(
                                    "OccurrenceDescription", occurrenceTranslationFormData.OccurrenceDescription));
                errors.AddRange(
                    GenericValidationAttribute <OccurrenceTranslationFormData> .ValidateAttributes("LanguageId",
                                                                                                   occurrenceTranslationFormData.LanguageId.ToString()));
                errors.AddRange(
                    GenericValidationAttribute <OccurrenceTranslationFormData> .ValidateAttributes("OccurrenceTitle",
                                                                                                   occurrenceTranslationFormData.OccurrenceTitle));
            }
            return(errors.Count == 0);
        }
Example #8
0
        /// <summary>
        /// Validation update occurrence.
        /// </summary>
        /// <param name="request">the request to validate.</param>
        /// <returns>errors validation</returns>
        private List <string> ValidateUpdateOccurrence(OccurrenceRequest request)
        {
            var errors = new List <string>();

            if (request?.OccurrenceDto == null)
            {
                errors.Add(OccurrenceMessageResource.NullRequest);
            }
            else
            {
                errors.AddRange(GenericValidationAttribute <OccurrenceDto> .ValidateAttributes("OccurrenceStartDate",
                                                                                               request.OccurrenceDto.OccurrenceStartDate.ToString("dd/MM/yyyy")));
                errors.AddRange(GenericValidationAttribute <OccurrenceDto> .ValidateAttributes("OccurrenceEndDate",
                                                                                               request.OccurrenceDto.OccurrenceEndDate.ToString("dd/MM/yyyy")));
                errors.AddRange(GenericValidationAttribute <OccurrenceDto> .ValidateAttributes("OccurrenceId",
                                                                                               request.OccurrenceDto.OccurrenceId.ToString()));
                errors.AddRange(GenericValidationAttribute <OccurrenceDto> .ValidateAttributes("OccurrenceLink",
                                                                                               request.OccurrenceDto.OccurrenceLink));
            }
            return(errors);
        }
Example #9
0
        /// <summary>
        /// Validate find news translation.
        /// </summary>
        /// <param name="request">the request to validate.</param>
        /// <returns>errors validation</returns>
        private List <string> ValidateFindNewsTranslations(NewsTranslationRequest request)
        {
            var errors = new List <string>();

            if (request?.NewsTranslationDto == null)
            {
                errors.Add(NewsMessageResource.NullRequest);
            }
            else
            {
                switch (request.FindNewsTranslationDto)
                {
                case FindNewsTranslationDto.NewsId:
                    errors.AddRange(GenericValidationAttribute <NewsTranslationDto> .ValidateAttributes("NewsId", request.NewsTranslationDto.NewsId.ToString()));
                    break;

                case FindNewsTranslationDto.NewsTranslationId:
                    errors.AddRange(GenericValidationAttribute <NewsTranslationDto> .ValidateAttributes("TranslationId", request.NewsTranslationDto.TranslationId.ToString()));
                    break;
                }
            }
            return(errors);
        }
Example #10
0
        /// <summary>
        /// Validate find country translation.
        /// </summary>
        /// <param name="request">the request to validate.</param>
        /// <returns>errors validation</returns>
        private List <string> ValidateFindSheet(SheetRequest request)
        {
            List <string> errors = new List <string>();

            if (request?.SheetDto == null)
            {
                errors.Add(CountryMessageResource.NullRequest);
            }
            else
            {
                switch (request.FindSheetDto)
                {
                case FindSheetDto.CountryId:
                    errors.AddRange(GenericValidationAttribute <CountryTranslationDto> .ValidateAttributes("CountryId", request.SheetDto.CountryId.ToString()));
                    break;

                case FindSheetDto.SheetId:
                    errors.AddRange(GenericValidationAttribute <SheetDto> .ValidateAttributes("SheetId", request.SheetDto.SheetId.ToString()));
                    break;
                }
            }
            return(errors);
        }
Example #11
0
        /// <summary>
        /// create user rule validation.
        /// </summary>
        /// <param name="request">the request to validate.</param>
        /// <returns>errors validation</returns>
        private List <string> ValidateFindUserRule(UserRuleRequest request)
        {
            var errors = new List <string>();

            if (request?.UserRuleDto == null)
            {
                errors.Add(UserRuleMessageResource.NullRequest);
            }
            else
            {
                switch (request.FindUserRuleDto)
                {
                case FindUserRuleDto.UserRuleId:
                    errors.AddRange(GenericValidationAttribute <UserRuleDto> .ValidateAttributes("UserRuleId", request.UserRuleDto.UserRuleId.ToString()));
                    break;

                case FindUserRuleDto.UserId:
                    errors.AddRange(GenericValidationAttribute <UserRuleDto> .ValidateAttributes("UserId", request.UserRuleDto.UserId.ToString()));
                    break;
                }
            }
            return(errors);
        }
Example #12
0
        /// <summary>
        /// Validate find section translation.
        /// </summary>
        /// <param name="request">the request to validate.</param>
        /// <returns>errors validation</returns>
        private List <string> ValidateFindStepParagraphTranslation(StepParagraphTranslationRequest request)
        {
            List <string> errors = new List <string>();

            if (request?.StepParagraphTranslationDto == null)
            {
                errors.Add(StepMessageResource.NullRequest);
            }
            else
            {
                switch (request.FindStepParagraphTranslationDto)
                {
                case FindStepParagraphTranslationDto.StepParagraphId:
                    errors.AddRange(GenericValidationAttribute <StepParagraphTranslationDto> .ValidateAttributes("ParagraphId", request.StepParagraphTranslationDto.ParagraphId.ToString()));
                    break;

                case FindStepParagraphTranslationDto.StepParagraphTranslationId:
                    errors.AddRange(GenericValidationAttribute <StepParagraphTranslationDto> .ValidateAttributes("TranslationId", request.StepParagraphTranslationDto.TranslationId.ToString()));
                    break;
                }
            }
            return(errors);
        }