Example #1
0
 private void loginUserAutomatically(string email, string hashedpassword)
 {
     ADTeam4EF.LoginController loginCtr = new ADTeam4EF.LoginController();
     ADTeam4EF.Employee        user     = loginCtr.authenticateUser(email, hashedpassword);
     if (user != null)
     {
         {
             userName = user.EmployeeName.ToString();
             role     = user.Role.RoleName.ToString();
             storeSession(userName, role);
             redirectToPage(Session["role"].ToString());
         }
     }
 }
 private void loginUser(string email, string password)
 {
     ADTeam4EF.Employee user = loginCtr.authenticateUser(email, password);
     if (user != null)
     {
         if ((int)user.RoleID == 3)
         {
             employeeid = user.EmployeeID;
             DateTime today = System.DateTime.Today;
             if (loginCtr.checkDelegate(employeeid, today) != null)
             {
                 role = user.Role.RoleName.ToString();
             }
             else
             {
                 role = "Employee";
             }
         }
         else
         {
             role = user.Role.RoleName.ToString();
         }
         userName     = user.EmployeeName.ToString();
         departmentid = user.DepartmentID.ToString();
         employeeid   = Convert.ToInt32(user.EmployeeID.ToString());
         storeSession(userName, role, employeeid, departmentid);
         if (chkRememberMe.Checked == true)
         {
             Response.Cookies["LogicUniversityUserInfo"]["email"]    = email;
             Response.Cookies["LogicUniversityUserInfo"]["identity"] = hashedPassword;
         }
         redirectToPage(Session["role"].ToString());
     }
     else
     {
         lblLoginStatus.Text     = "Login Failed!";
         btnSubmitLogin.CssClass = "btn btn-danger btn-block";
         lblLoginStatus.Visible  = true;
         Session.Clear();
         Response.Cookies.Clear();
     }
 }