Ejemplo n.º 1
0
        public void bloquear(String unUsuario)
        {
            SqlCommand comandoBloquear = new SqlCommand("UPDATE LOS_BORBOTONES.Usuario SET Habilitado = 0 WHERE User_name = @usuario", conexion);

            comandoBloquear.Parameters.AddWithValue("@usuario", unUsuario);
            int cant;

            cant = comandoBloquear.ExecuteNonQuery();
            if (cant == 1)
            {
                MessageBox.Show("Estas bloqueado, intente con otro usuario...");
                acumulador = 0;
            }
            UsuarioTB.Clear();
            PassTB.Clear();
        }
Ejemplo n.º 2
0
 private void LoginBT_Click(object sender, EventArgs e)
 {
     user = UserNametb.Text.ToUpper();
     pass = PassTB.Text;
     if (new NhanVienBUS().LoginChecking(user, pass))
     {
         Workstation form = new Workstation(user, this);
         form.Show();
         UserNametb.Clear();
         PassTB.Clear();
         this.Hide();
     }
     else
     {
         UserNametb.Clear();
         PassTB.Clear();
     }
 }
Ejemplo n.º 3
0
        private void LoginMethod(String Proc)
        {
            try
            {
                String        ConnString = ConfigurationManager.ConnectionStrings["PayrollConn"].ConnectionString;
                SqlConnection conn       = new SqlConnection(ConnString);
                SqlDataReader reader;

                using (conn)
                {
                    SqlCommand cmd1 = new SqlCommand(Proc, conn);
                    cmd1.CommandType = CommandType.StoredProcedure;
                    cmd1.Parameters.AddWithValue("@UserId", UserNameTB.Text);
                    cmd1.Parameters.AddWithValue("@Pass", PassTB.Text);
                    conn.Open();
                    reader = cmd1.ExecuteReader();
                    reader.Read();
                    if (reader.HasRows)
                    {
                        if (comboBox1.SelectedIndex == 0)
                        {
                            if (AccountTypecomboBox.SelectedIndex == 0)
                            {
                                this.Hide();
                                AdminPortal Ap = new AdminPortal();
                                Ap.Show();
                            }
                            else if (AccountTypecomboBox.SelectedIndex == 1)
                            {
                                this.Hide();
                                AccountantPortal Ap = new AccountantPortal();
                                Ap.Show();
                            }
                            else if (AccountTypecomboBox.SelectedIndex == 2)
                            {
                                this.Hide();
                                ReceptionestPortal Ap = new ReceptionestPortal();
                                Ap.Show();
                            }
                            else if (AccountTypecomboBox.SelectedIndex == 3)
                            {
                                this.Hide();
                                GeneralEmployeePortal Ap = new GeneralEmployeePortal(UserNameTB.Text);
                                Ap.Show();
                            }
                        }
                        else
                        {
                            System.Diagnostics.Process.Start(Application.StartupPath + @"\inventorysystem\inventorysystem\bin\Debug\inventorysystem.exe");

                            UserNameTB.Clear();
                            PassTB.Clear();
                            UserNameTB.Focus();
                            comboBox1.SelectedIndex = 0;
                        }
                    }
                    else
                    {
                        MessageBox.Show(" Wrong User Name or Password, Try again", "Invalid User", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        UserNameTB.Focus();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                UserNameTB.Focus();
            }
        }