Exemplo n.º 1
0
 private void btnLogin_Click(object sender, EventArgs e)
 {
     if (user == null)
     {
         user = new Users();
     }
     try
     {
         if (ValidateFields())
         {
             UsersData();
             if (user.AuthenticateUser())
             {
                 PayrollMDI mDI = new PayrollMDI();
                 this.Hide();
                 mDI.Show();
             }
             else
             {
                 MessageBox.Show(Constants.MSG_UNAUTHORIZED_USER_ERROR, Constants.MSG_LOG_IN_FAILED_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Warning);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(Constants.MSG_ERROR + ex.Message, Constants.MSG_DATA_ENTRY_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     finally
     {
         user = null;
     }
 }
Exemplo n.º 2
0
 private void btnSignIn_Click(object sender, EventArgs e)
 {
     objUser2 = new Users();
     UserData();
     try
     {
         if (objUser2.AuthorisedUser())
         {
             PayrollMDI objPayrollMDI = new PayrollMDI();
             this.Hide();
             objPayrollMDI.Show();
         }
         else
         {
             MessageBox.Show("Unauthorised Credentials Provided!!", "Unauthorised User", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error:" + ex.Message);
     }
 }