コード例 #1
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                serviceDAA     = new DBControllerWSClient();
                usuario        = serviceDAA.queryUserByUserName(txtUsername.Text);

                if (usuario.password != null)
                {
                    ModifyUserForm updateForm1 = new ModifyUserForm(users[1]);
                    updateForm1.currentUser = new user();
                    updateForm1.currentUser = usuario;
                    updateForm1.SetParent(this);
                    updateForm1.ShowDialog();
                    updateDataGridView();
                }
                else
                {
                    MessageBox.Show("No existe el usuario con ese username");
                }
            }
            catch
            {
                MessageBox.Show("Ocurrió un problema");
                updateDataGridView();
            }
        }
コード例 #2
0
        private bool filledValues()
        {
            //Los datos de empleados se llenan y validad?
            //Borrable, pa abajo
            if (txtEmpDNI.Text == "")
            {
                MessageBox.Show("Ingrese el DNI ");
                return(false);
            }
            if (txtEmpDNI.Text.Length != 8)
            {
                MessageBox.Show("Ingrese un DNI válido de 8 digitos numericos");
            }
            if (txtEmpDNI.Text.Length == 8)
            {
                int result = 0;
                if (!int.TryParse(txtEmpDNI.Text, out result))
                {
                    MessageBox.Show("Ha ingresado caracteres no númericos en el campo DNI, ingrese 8 dígitos númericos ");
                    return(false);
                }
                //MessageBox.Show("Ingrese un DNI válido");
            }
            if (txtEmpName.Text == "")
            {
                MessageBox.Show("Ingrese un nombre válido");
            }
            //Falta verificar que el permiso me habilite agregar un usuario
            //Hasta aquí, se puede borrar
            if (txtUserName.Text == "")
            {
                MessageBox.Show("Ingrese el nombre del usuario");
                return(false);
            }
            else if (txtUserPassword.Text == "")
            {
                MessageBox.Show("Ingrese una contraseña");
                return(false);
            }
            else if (txtPasswordConfirm.Text != txtUserPassword.Text)
            {
                MessageBox.Show("Las contraseñas deben coincidir");
                return(false);
            }
            else if (dtpUserExpirationDate.Value.Date < DateTime.Now)
            {
                MessageBox.Show("Ingrese una fecha válida");
                return(false);
            }
            Cursor.Current = Cursors.WaitCursor;
            serviceDA      = new DBControllerWSClient();
            user c = serviceDA.queryUserByUserName(txtUserName.Text);

            Cursor.Current = Cursors.Arrow;
            if (c.password != null)
            {
                MessageBox.Show("Ya existe un usuario con ese Username");
                return(false);
            }

            return(true);
        }