Beispiel #1
0
 public SsoProfile()
 {
     Validation = new BaseValidation();
     ProfilesAndActiveDirectories = new List <SsoProfileAndActiveDirectory>();
     ProfilesAndServices          = new List <SsoProfileAndService>();
     ProfilesAndWorkers           = new List <SsoProfileAndWorker>();
 }
Beispiel #2
0
        private BaseValidation GetBasicValidation(Guid guid, string method)
        {
            BaseValidation result = new BaseValidation();

            if (guid == null)
            {
                result.Return = BadRequest();
            }
            else if (!CanAccess(guid, method))
            {
                result.Return = new StatusCodeResult(429);
            }
            else
            {
                var user = GetUser(guid, method);
                if (user == null)
                {
                    result.Return = new StatusCodeResult(403);
                }
                else
                {
                    result.Email = user;
                }
            }
            return(result);
        }
Beispiel #3
0
 public static void TextBoxColorTextValidation <Control>(
     Control control,
     Regex expr,
     BaseValidation baseValidation) where Control : FrameworkElement
 {
     control.LostFocus += TextBoxFocuInOutValidationHandlers.TextValidationWithTextColorChanging(expr, baseValidation);
 }
Beispiel #4
0
        public CreditCardVerificationResult Validation([FromBody] CreditCardInfo creditCardInfo)
        {
            var             cardType = CreditType.Unknown;
            var             result   = false;
            IBaseValidation bv       = new BaseValidation();

            if (bv.IsCardNumberValid(creditCardInfo.CardNumber))
            {
                if (Regex.IsMatch(creditCardInfo.CardNumber, "^(4)"))
                {
                    IVisaCardValidation vs = new VisaCardValidation();
                    result   = vs.IsCardExpiry(creditCardInfo.ExpiryDate);
                    cardType = CreditType.Visa;
                }
                else if (Regex.IsMatch(creditCardInfo.CardNumber, "^(5)"))
                {
                    IMasterCardValidation ms = new MasterCardValidation();
                    result   = ms.IsCardExpiry(creditCardInfo.ExpiryDate);
                    cardType = CreditType.MasterCard;
                }
                else if (Regex.IsMatch(creditCardInfo.CardNumber, "^(3)"))
                {
                    IJCBCardValidation jcb = new JCBCardValidation();
                    result   = jcb.IsCardExpiry(creditCardInfo.ExpiryDate);
                    cardType = CreditType.JCB;
                }
            }

            return(new CreditCardVerificationResult {
                Result = result, CardType = cardType.ToString()
            });
        }
 public SsoApplication()
 {
     HomeUrl    = string.Empty;
     Mnemonic   = string.Empty;
     IsInactive = string.Empty;
     ToolType   = string.Empty;
     Profiles   = new List <SsoProfile>();
     Validation = new BaseValidation();
 }
Beispiel #6
0
        public RoleConsistentValidation(Entities.Role person)
        {
            BaseValidation = new BaseValidation();

            var nameSpecification = new NameIsNotNullSpecification();

            BaseValidation.AddSpecification("Name-Specification",
                                            nameSpecification.IsSatisfyedBy(person),
                                            "Name is null.");
        }
        public LoginConsistentValidation(Entities.Credential credential)
        {
            BaseValidation = new BaseValidation();

            var usernameSpecification = new UsernameIsNotNullSpecification();

            BaseValidation.AddSpecification("Username-Specification", usernameSpecification.IsSatisfyedBy(credential), "Username is null.");

            var passwordSpecification = new PasswordIsNotNullSpecification();

            BaseValidation.AddSpecification("Password-Specification", passwordSpecification.IsSatisfyedBy(credential), "Password is null.");
        }
Beispiel #8
0
        public EmailGatewayLog()
        {
            Validation = new BaseValidation();

            CurrentCode        = string.Empty;
            JobSequence        = default(int);
            JobType            = string.Empty;
            ApplicationCode    = string.Empty;
            Login              = string.Empty;
            MessageCode        = string.Empty;
            MessageDescription = string.Empty;
            Subject            = string.Empty;
            To               = string.Empty;
            StartDateTime    = default(DateTime?);
            CreationDateTime = default(DateTime?);
        }
Beispiel #9
0
        public RoleDeleteConsistentValidation(Entities.Role role, IRoleRepository iRoleRepository)
        {
            RoleRepository = iRoleRepository;
            BaseValidation = new BaseValidation();

            var roleExists = new RoleExistsAtDbSpecification(RoleRepository);

            BaseValidation.AddSpecification("Role-Not-Found",
                                            roleExists.IsSatisfyedBy(role.Id),
                                            "Role does not exists in current DB.");

            var roleHaveNoPersonAssociated = new RoleHaveNoPersonAssociatedSpecification(RoleRepository);

            BaseValidation.AddSpecification("Role-Contains-Associated-Person",
                                            roleHaveNoPersonAssociated.IsSatisfyedBy(role.Id),
                                            "There is associated users to this role. Please, remove then first.");
        }
Beispiel #10
0
        public EmailGateway()
        {
            Validation = new BaseValidation();

            CurrentCode      = string.Empty;
            JobSequence      = default(int);
            ApplicationCode  = string.Empty;
            Login            = string.Empty;
            BodyComplement   = string.Empty;
            AttachmentOne    = string.Empty;
            AttachmentTwo    = string.Empty;
            AttachmentThree  = string.Empty;
            IsProcessed      = string.Empty;
            IsEvent          = string.Empty;
            AttemptNumber    = default(short);
            CreationDateTime = default(DateTime?);
        }
Beispiel #11
0
        public int Add(User user, IUserValidator userValidator = null)
        {
            if (userValidator == null)
            {
                userValidator = new BaseValidation();
            }

            var listOfUsers      = _userStorageService.GetAllUsers().ToList();
            var validationResult = userValidator.Validate(listOfUsers, user);

            if (validationResult.IsInvalidUser)
            {
                throw new UserCreateException(validationResult.ErrorMessage);
            }

            user.Id = _idGeneratorFunction(listOfUsers);
            _userStorageService.Add(user);

            return(user.Id);
        }
Beispiel #12
0
        public BaseResponse Edit(CrudRequest request)
        {
            BaseResponse response = null;

            try
            {
                if (!_crud.ValidateName(request.FullName).Success)
                {
                    BaseValidation validateName = _crud.ValidateName(request.FullName);
                    throw new CrudException(validateName.Message);
                }

                if (!_crud.ValidateEmail(request.EmailAddress).Success)
                {
                    BaseValidation validateEmail = _crud.ValidateEmail(request.EmailAddress);
                    throw new CrudException(validateEmail.Message);
                }

                if (!_crud.ValidatePhoneNumber(request.PhoneNumber).Success)
                {
                    BaseValidation validatePhone = _crud.ValidatePhoneNumber(request.PhoneNumber);
                    throw new CrudException(validatePhone.Message);
                }

                if (_crud.Edit(request))
                {
                    response = new BaseResponse(true, "Alteração realizada com sucesso!");
                }
            }
            catch (CrudException ex)
            {
                response = new BaseResponse(false, ex.Message);
            }
            catch (Exception ex)
            {
                response = new BaseResponse(false, "Não foi possível realizar a alteração. Erro: " + ex.Message);
            }

            return(response);
        }
Beispiel #13
0
        public RegisterConsistentValidation(Entities.Person person)
        {
            BaseValidation = new BaseValidation();

            var nameSpecification = new NameIsNotNullSpecification();

            BaseValidation.AddSpecification("Name-Specification",
                                            nameSpecification.IsSatisfyedBy(person),
                                            "Name is null.");

            var usernameSpecification = new UsernameIsNotNullSpecification();

            BaseValidation.AddSpecification("Username-Specification",
                                            usernameSpecification.IsSatisfyedBy(person.Credential),
                                            "Username is null.");

            var passwordSpecification = new PasswordIsNotNullSpecification();

            BaseValidation.AddSpecification("Password-Specification",
                                            passwordSpecification.IsSatisfyedBy(person.Credential),
                                            "Password is null.");
        }
 public SsoProfileAndWorker()
 {
     Validation = new BaseValidation();
 }
Beispiel #15
0
 public SsoGroup()
 {
     Validation = new BaseValidation();
 }
Beispiel #16
0
 public Entity()
 {
     Validator = new BaseValidation <TEntity>();
 }
Beispiel #17
0
 public ApplicationTranslation()
 {
     Validation = new BaseValidation();
 }
Beispiel #18
0
 public Worker()
 {
     Validation = new BaseValidation();
 }
Beispiel #19
0
 public ApplicationParameter()
 {
     Validation = new BaseValidation();
 }
Beispiel #20
0
 public Dept()
 {
     Validation = new BaseValidation();
 }
Beispiel #21
0
 public Site()
 {
     Validation = new BaseValidation();
 }
 public static RoutedEventHandler TextValidationWithTextColorChanging(Regex regexp, BaseValidation validation)
 {
     return((object sender, RoutedEventArgs e) =>
     {
         TextBox textBox = sender as TextBox;
         if (regexp.IsMatch(textBox.Text))
         {
             textBox.Background = new SolidColorBrush(Color.FromRgb(226, 225, 225));
             validation.ChangeControlValidationValue(textBox, true);
         }
         else
         {
             textBox.Background = new SolidColorBrush(Color.FromRgb(255, 51, 51));
             validation.ChangeControlValidationValue(textBox, false);
         }
     });
 }
Beispiel #23
0
 public WorkerHierarchy()
 {
     Validation = new BaseValidation();
 }
Beispiel #24
0
 public Lbc()
 {
     Validation = new BaseValidation();
 }
Beispiel #25
0
 public SsoProfileAndService()
 {
     Validation = new BaseValidation();
 }
Beispiel #26
0
 public BudgetCode()
 {
     Validation = new BaseValidation();
 }
Beispiel #27
0
 public SsoServices()
 {
     Validation = new BaseValidation();
 }
Beispiel #28
0
 protected BaseEntity(BaseValidation <T> validator)
 {
     _validator = validator;
 }
Beispiel #29
0
 public void BaseValidationTest()
 {
     BaseValidation.BaseElementValidation(JdiLogo);
 }
Beispiel #30
0
 public Area()
 {
     Validation = new BaseValidation();
 }