private void frmPerfilPac_Load(object sender, EventArgs e) { LoadAppointments(); LoadUser(); DisableControl(false);// Disable all control in this form btnGuardar.Visible = false; User user = new User(1, "", ""); user = userRule.GetUser(User.Id); if (!string.IsNullOrEmpty(user.ImagePath)) { pbxFoto.Load(@user.ImagePath); } }
private void btnAceptar_Click(object sender, EventArgs e) { UserRule userRule = new UserRule(); if (!string.IsNullOrWhiteSpace(txtUsuario.Text) && !string.IsNullOrWhiteSpace(txtClave.Text)) { User = userRule.GetUser(txtUsuario.Text, txtClave.Text); if (!string.IsNullOrEmpty(User.UserName) && User.UserType == UserType) { DialogResult = DialogResult.OK; } else { MessageBox.Show("El usuario o la clave es incorrecta.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtUsuario.Focus(); txtUsuario.SelectAll(); txtClave.Clear(); return; } } else { MessageBox.Show("Los campos usuario y clave son requeridos para iniciar sesión en el sistema", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); txtUsuario.Focus(); return; } }