Exemplo n.º 1
0
        private bool ClientFieldsOk()
        {
            bool idOk      = InputValidations.ValidateID(idText.Text, idMsg);
            bool telOk     = InputValidations.ValidatePhoneNumber(telNumberText.Text, telNumberMsg);
            bool addressOk = InputValidations.ValidateIfEmpty(addressText, addressMsg);

            return(idOk && telOk && addressOk);
        }
Exemplo n.º 2
0
        private bool CommonUserFieldsOK()
        {
            bool userNameOk = IsUserNameValid();
            bool nameOk     = InputValidations.ValidateIfEmpty(nameTxt, nameMsg);
            bool surnameOk  = InputValidations.ValidateIfEmpty(surnameText, surnameMsg);
            bool passwordOk = InputValidations.ValidateIfEmpty(passwordText, passwordMsg);

            return(userNameOk && nameOk && surnameOk && passwordOk);
        }
Exemplo n.º 3
0
        private bool DataOk()
        {
            bool  nameOk       = InputValidations.ValidateIfEmpty(nameText, msgName);
            float heightSums   = (float)(spinnerHeightAboveFloor.Value + spinnerHeight.Value);
            bool  heightSumsOk = InputValidations.ValidateStrictMinor(heightSums, Constants.WALL_HEIGHT, msgHeight,
                                                                      "height plus elevation can't be higher than wall: " + Constants.WALL_HEIGHT + " m");
            bool allOk = nameOk && heightSumsOk;

            return(allOk);
        }
        private void LogInButton_Click(object sender, EventArgs e)
        {
            bool usernameNotEmpty = InputValidations.ValidateIfEmpty(UsernameText, UserNameMsg);
            bool passwordNotEmpty = InputValidations.ValidateIfEmpty(PasswordText, PasswordMsg);

            if (usernameNotEmpty && passwordNotEmpty)
            {
                TryToLogIn();
            }
        }
        private void editButton_Click(object sender, EventArgs e)
        {
            bool selectedItem = InputValidations.IsListItemSelected(userList, errorLabel,
                                                                    "Debe seleccionar un usuario primero");

            if (selectedItem)
            {
                parent.OpenUserEditor((User)userList.SelectedItem);
            }
        }
Exemplo n.º 6
0
        private bool RepeatedUser()
        {
            bool repeated = false;

            if (permissionController.ExistsUserName(userNameText.Text))
            {
                InputValidations.ErrorMessage(userNameMsg, "This name has been taken");
                repeated = true;
            }
            return(repeated);
        }
        private void deleteButton_Click(object sender, EventArgs e)
        {
            bool selectedItem = InputValidations.IsListItemSelected(userList, errorLabel,
                                                                    "Debe seleccionar un usuario primero");

            if (selectedItem)
            {
                controller.Remove((User)userList.SelectedItem);
                FillList();
            }
        }
Exemplo n.º 8
0
 private void createButton_Click(object sender, EventArgs e)
 {
     try
     {
         CreateTemplateAndSave();
     }
     catch (InvalidTemplateException ex) {
         InputValidations.ErrorMessage(msgLabel, ex.ToString());
     }
     catch (TemplateAlreadyExistsException ex) {
         InputValidations.ErrorMessage(msgLabel, ex.ToString());
     }
 }
 private void TryToLogIn()
 {
     try
     {
         IUserRepository users = new UserRepository();
         mother.CurrentSession = connector.LogIn(UsernameText.Text, PasswordText.Text, users);
         mother.GoToMenu();
     }
     catch (WrongPasswordException)
     {
         InputValidations.ErrorMessage(PasswordMsg, "Wrong Password!");
     }
     catch (UserNotFoundException)
     {
         InputValidations.ErrorMessage(UserNameMsg, "User doesn't exist!");
     }
 }
        private void createButton_Click(object sender, EventArgs e)
        {
            if (InputValidations.IsListItemSelected(usersList, listMsg, "You must choose a user first"))
            {
                bool validWidth = InputValidations.ValidateGreaterThanZero(widthField.Text, widthMsg,
                                                                           "width must be greater than zero")
                                  &&
                                  InputValidations.ValidateStrictMinor(Convert.ToInt32(widthField.Text), 101, widthMsg,
                                                                       "width must be lower than 100");

                bool validLength = InputValidations.ValidateGreaterThanZero(widthField.Text, lengthMsg,
                                                                            "length must be greater than zero")
                                   &&
                                   InputValidations.ValidateStrictMinor(Convert.ToInt32(lengthField.Text), 101, lengthMsg,
                                                                        "length must be lower than 100");
                bool validName = InputValidations.ValidateIfEmpty(nameText, nameMsg);

                if (validName && validWidth && validLength)
                {
                    CreateAndEditBlueprint();
                }
            }
        }
 private void nameText_Enter(object sender, EventArgs e)
 {
     InputValidations.ClearField(nameMsg);
 }
 private void lengthField_Enter(object sender, EventArgs e)
 {
     InputValidations.ClearField(lengthMsg);
 }
 private void lengthField_Leave(object sender, EventArgs e)
 {
     InputValidations.ValidateGreaterThanZero(lengthField.Text, lengthMsg, "length must be greater than zero");
     InputValidations.ValidateStrictMinor(Convert.ToInt32(lengthField.Text), 101, lengthMsg, "length must be lower than 100");
 }
Exemplo n.º 14
0
 private void spinnerLength_Enter(object sender, EventArgs e)
 {
     InputValidations.ClearField(msgHeight);
 }
Exemplo n.º 15
0
 private void telNumberText_Leave(object sender, EventArgs e)
 {
     InputValidations.ValidatePhoneNumber(telNumberText.Text, telNumberMsg);
 }
Exemplo n.º 16
0
 private void telNumberText_Enter(object sender, EventArgs e)
 {
     InputValidations.ClearField(telNumberMsg);
 }
 private void PasswordText_TextChanged(object sender, EventArgs e)
 {
     InputValidations.ClearField(PasswordMsg);
 }
Exemplo n.º 18
0
 private void surnameText_Leave(object sender, EventArgs e)
 {
     InputValidations.ValidateIfEmpty(surnameText, surnameMsg);
 }
Exemplo n.º 19
0
 private void addressText_Enter(object sender, EventArgs e)
 {
     InputValidations.ClearField(addressMsg);
 }
Exemplo n.º 20
0
 private void nameTxt_Leave(object sender, EventArgs e)
 {
     InputValidations.ValidateIfEmpty(nameTxt, nameMsg);
 }
Exemplo n.º 21
0
 private void addressText_Leave(object sender, EventArgs e)
 {
     InputValidations.ValidateIfEmpty(addressText, addressMsg);
 }
Exemplo n.º 22
0
 private void idText_Leave(object sender, EventArgs e)
 {
     InputValidations.ValidateID(idText.Text, idMsg);
 }
Exemplo n.º 23
0
 private void nameText_Enter(object sender, EventArgs e)
 {
     ClearMessages();
     InputValidations.ClearField(msgName);
 }
Exemplo n.º 24
0
        private bool IsUserNameValid()
        {
            bool isValid = InputValidations.ValidateIfEmpty(userNameText, userNameMsg) && !RepeatedUser();

            return(isValid);
        }
Exemplo n.º 25
0
 private void nameText_Leave(object sender, EventArgs e)
 {
     InputValidations.ValidateIfEmpty(nameText, msgName);
 }
 private void UsernameText_TextChanged(object sender, EventArgs e)
 {
     InputValidations.ClearField(UserNameMsg);
 }
Exemplo n.º 27
0
 private void passwordText_Leave(object sender, EventArgs e)
 {
     InputValidations.ValidateIfEmpty(passwordText, passwordMsg);
 }
Exemplo n.º 28
0
 private void passwordText_Enter(object sender, EventArgs e)
 {
     InputValidations.ClearField(passwordMsg);
 }