예제 #1
0
        private void btnIngresar_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txtUsername.Text) || string.IsNullOrEmpty(txtPassword.Text))
                {
                    Utility.ShowInfo("Advertencia", "No puede estar vacio el username o el password");
                    return;
                }

                UsuarioDTO usuario = Sesion.login(txtUsername.Text, txtPassword.Text);

                if (usuario.rolesList.Count > 1)
                {
                    this.Hide();
                    SelectRolLogin selectRolLogin = new SelectRolLogin(usuario.rolesList);
                    selectRolLogin.ShowDialog();
                    Close();
                }
                else
                {
                    Sesion.RolActual = usuario.rolesList.First();
                    this.Hide();
                    MenuHome menu = new MenuHome();
                    menu.ShowDialog();
                    Close();
                }
            }
            catch (ApplicationException ex)
            {
                Utility.ShowError("Error", ex);
            }
        }
예제 #2
0
 private void buttonIngresar_Click(object sender, EventArgs e)
 {
     if (comboBoxRoles.SelectedIndex == -1)
     {
         MessageBox.Show("Seleccione algun rol para ingresar");
     }
     else
     {
         Sesion.RolActual = (RolDTO)comboBoxRoles.SelectedItem;
         this.Hide();
         MenuHome menu = new MenuHome();
         menu.ShowDialog();
         Close();
     }
 }