Ejemplo n.º 1
0
 private void btnSignIn_Click(object sender, EventArgs e)
 {
     if (f)
     {
         if ((txtUsername.Text != "" && txtPass.Text != "") &&
             (txtUsername.Text != "Enter User Name" && txtPass.Text != "Enter Your Password"))
         {
             int x = db.SignIn(txtUsername.Text, txtPass.Text, ref error);
             //MessageBox.Show(x.ToString(), "Welcome to Software", MessageBoxButtons.OK, MessageBoxIcon.None);
             if (x == 0)
             {
                 lbIncorrected.Text = "Account or Password is Not Correct";
                 txtUsername.ResetText();
                 txtPass.ResetText();
                 txtUsername.Focus();
             }
             else
             {
                 MessageBox.Show("Congratulation", "Welcome to Software", MessageBoxButtons.OK, MessageBoxIcon.None);
                 this.Hide();
                 if (x == 1)
                 {
                     Form frm = new frmMain();
                     frm.ShowDialog();
                     frm.Dispose();
                 }
                 else
                 {
                     Form frm = new frmEmployee();
                     frm.ShowDialog();
                     frm.Dispose();
                 }
             }
         }
         else
         {
             MessageBox.Show("Please enter all info", "", MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning);
         }
     }
 }