public string GetRolesOfUser(int userid, bool IsActive) { MPOEntities myen = SessionHelpers.GetContext(HttpContext.Current.Session); StoreProcedureHelpers sph = new StoreProcedureHelpers(); return(sph.GetRolesOfUser(myen, userid, IsActive)); }
protected void btnLogin_Click(object sender, EventArgs e) { lblMessage.Visible = false; MPOEntities myen = Helpers.SessionHelpers.GetContext(Session); HashHelpers hash = new HashHelpers(); StoreProcedureHelpers sph = new StoreProcedureHelpers(); string username = txtUserName.Text; string password = txtPassword.Text; string hashpass = hash.Encrypt(password); int result = 0; string message = string.Empty; result = sph.CheckLogin(myen, username, hashpass); switch (result) { case -1: //user does not exist or his online in another place message = "نام کاربری یا رمزعبور اشتباه است"; lblMessage.Text = message; lblMessage.Visible = true; return; case 0: message = "اجازه دسترسی وجود ندارد";; lblMessage.Visible = true; lblMessage.Text = message; return; } //result is user id AccessManagementService.Login newlogin = new AccessManagementService.Login(); newlogin.LoginUser(result, username, chkRemember.Checked); }
public List <Entity> GetEntities_Right(int RoleId, string ServiceName) { MPOEntities myen = SessionHelpers.GetContext(HttpContext.Current.Session); List <Entity> getright = myen.Right_EntityGet(RoleId, ServiceName).ToList <Entity>(); return(getright); }
public List <Role> Roles_Get() { global::AccessManagementService.Model.User user = SessionHelpers.GetUser(HttpContext.Current.Session); if (user == null) { return(null); } int userid = user.ID; myen = SessionHelpers.GetContext(HttpContext.Current.Session); return(myen.ListRolesOfUser(userid, true).ToList <Role>()); }
public void LoginUser(int UserId, string UserName, bool Persist) { Entity ent = new Entity(); MPOEntities myen = SessionHelpers.GetContext(HttpContext.Current.Session); User user = new User(); // myen.DoLogin(UserId, TCPIPHelpers.UserIPAddress, TCPIPHelpers.UserSessionId); string roles = user.GetRolesOfUser(UserId, true); user = user.GetUserById(UserId, new [] { "Department" }); SetSessions(roles, user); FormsAuthentication.RedirectFromLoginPage(UserName, Persist); }
public static IQueryable <OrganiztionRole> GetOrganizationRoles(MPOEntities myen) { return(myen.OrganiztionRoles); }
public List <Role> ListOfRolesOfUser(int userid, bool isactive) { MPOEntities myen = Helpers.SessionHelpers.GetContext(HttpContext.Current.Session); return(myen.ListRolesOfUser(userid, isactive).ToList <Role>()); }