示例#1
0
        public string GetRolesOfUser(int userid, bool IsActive)
        {
            MPOEntities           myen = SessionHelpers.GetContext(HttpContext.Current.Session);
            StoreProcedureHelpers sph  = new StoreProcedureHelpers();

            return(sph.GetRolesOfUser(myen, userid, IsActive));
        }
示例#2
0
        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);
        }
示例#3
0
 public bool ValidEntity_Right(string roles, string ServiceName, string EntityName)
 {
     using  (var myen = SessionHelpers.GetContext(HttpContext.Current.Session))
     {
         int result = myen.Right_EntityValidRoles(roles, ServiceName, EntityName).FirstOrDefault().Value;
         return(result == 1 ? true : false);
     }
 }
示例#4
0
        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>());
        }
示例#5
0
 public void LogOutUser()
 {
     using (var myen = SessionHelpers.GetContext(HttpContext.Current.Session))
     {
         User user = Helpers.SessionHelpers.GetUser(HttpContext.Current.Session);
         if (user != null)
         {
             myen.DoLogout(user.ID);
             HttpContext.Current.Session.RemoveAll();
         }
         FormsAuthentication.RedirectToLoginPage();
     }
 }
示例#6
0
        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);
        }