private void AssignSessionVariables(SystemUser user, Company usersCompany, InterLinkClass.PegasusManagementApi.UserType usersRole) { //string LastLoginDateTime = bll.GetLastLoginDateTime(user.Id,user.BankCode); Session["User"] = user; Session["UsersCompany"] = usersCompany; Session["UsersRole"] = usersRole; bll.InsertIntoAuditLog("LOGIN", "", user.CompanyCode, user.UserId, "Successfull login of User with ID :" + user.UserId + " at " + DateTime.Now); Server.Transfer("LoggedInStartPage.aspx", false); }
private void SignInUser(string UserId, string Password) { String msg = ""; SystemUser user = bll.GetSystemUserByUserId(UserId); if (user.StatusCode != Globals.SUCCESS_STATUS_CODE) { msg = "FAILED: " + user.StatusDesc; bll.InsertIntoAuditLog("LOGIN", "", user.CompanyCode, UserId, "Unsuccessfull login of User with ID :" + UserId + " Error: " + msg); ShowMessage(msg, true); return; } string md5HashOfPassword = SharedCommons.SharedCommons.GenerateMD5Hash(Password); if (user.Password.ToUpper() != md5HashOfPassword.ToUpper()) { msg = "FAILED: INVALID PASSWORD SUPPLIED"; bll.InsertIntoAuditLog("LOGIN", "", user.CompanyCode, UserId, "Unsuccessfull login of User with ID :" + UserId + " Error: " + msg); ShowMessage(msg, true); return; } Company usersCompnay = bll.GetCompanyByCompanyCode(user.CompanyCode); if (usersCompnay.StatusCode != Globals.SUCCESS_STATUS_CODE) { msg = "FAILED: " + user.StatusDesc; bll.InsertIntoAuditLog("LOGIN", "", user.CompanyCode, UserId, "Unsuccessfull login of User with ID :" + UserId + " Error: " + msg); ShowMessage(msg, true); return; } InterLinkClass.PegasusManagementApi.UserType usersRole = bll.GetUserTypeById(user.CompanyCode, user.UserType); if (usersCompnay.StatusCode != Globals.SUCCESS_STATUS_CODE) { msg = "FAILED: " + user.StatusDesc; bll.InsertIntoAuditLog("LOGIN", "", user.CompanyCode, UserId, "Unsuccessfull login of User with ID :" + UserId + " Error: " + msg); ShowMessage(msg, true); return; } AssignSessionVariables(user, usersCompnay, usersRole); }