예제 #1
0
파일: NewUser.cs 프로젝트: G0VA/littlerp
        private bool checkAdd()
        {
            bool correct = true;

            if (string.IsNullOrEmpty(txtUser.Text))
            {
                correct = false;
            }
            if (string.IsNullOrEmpty(txtPassword.Text))
            {
                correct = false;
            }
            if (string.IsNullOrEmpty(txtRepPass.Text))
            {
                correct = false;
            }
            if (string.IsNullOrEmpty(cmbRol.Text))
            {
                correct = false;
            }
            if (!txtPassword.Text.Equals(txtRepPass.Text))
            {
                correct = false;
            }
            if (GestorUsers.existsUser(txtUser.Text))
            {
                correct = false;
            }
            return(correct);
        }
예제 #2
0
파일: NewUser.cs 프로젝트: G0VA/littlerp
        private String errorDialog()
        {
            if (this.idioma == "ESPAÑOL")
            {
                String error = "Se han encontrado algunos errores: \n";

                if (string.IsNullOrEmpty(txtUser.Text))
                {
                    error += "\t - El campo \"Usuario\" no puede estar vacio. \n";
                }
                if (string.IsNullOrEmpty(txtPassword.Text))
                {
                    error += "\t - El campo \"Contraseña\" no puede estar vacio. \n";
                }
                if (string.IsNullOrEmpty(txtRepPass.Text))
                {
                    error += "\t - El campo \"Rpetir contraseña\" no puede estar vacio. \n";
                }
                if (string.IsNullOrEmpty(cmbRol.Text))
                {
                    error += "\t - El campo \"Rol\" no puede estar vacio. \n";
                }
                if (GestorUsers.existsUser(txtUser.Text))
                {
                    error += "\t - Este usuario ya existe. \n";
                }
                if (!txtPassword.Text.Equals(txtRepPass.Text))
                {
                    error += "\t - Las contraseñas no coinciden.";
                }
                return(error);
            }
            else
            {
                String error = "Some Errors have been found: \n";

                if (string.IsNullOrEmpty(txtUser.Text))
                {
                    error += "\t - The field \"User\" can't be empty. \n";
                }
                if (string.IsNullOrEmpty(txtPassword.Text))
                {
                    error += "\t - The field \"Password\" can't be empty. \n";
                }
                if (string.IsNullOrEmpty(txtRepPass.Text))
                {
                    error += "\t - The field \"Repeat Password\" can't be empty. \n";
                }
                if (string.IsNullOrEmpty(cmbRol.Text))
                {
                    error += "\t - The field \"Role\" can't be empty. \n";
                }
                if (GestorUsers.existsUser(txtUser.Text))
                {
                    error += "\t - This user already exists. \n";
                }
                if (!txtPassword.Text.Equals(txtRepPass.Text))
                {
                    error += "\t - Passwords do not match.";
                }
                return(error);
            }
        }