示例#1
0
        /// <summary>
        /// 刷新存储的Session
        /// </summary>
        public void RefreshEntities(string entityName)
        {
            if (null == mlUser || mlUser.School == null)
            {
                return;
            }
            int schoolId = mlUser.School.ID;

            switch (entityName)
            {
            case "class":
            {
                List <SYS_Class> list = UnitOfWork.Repository <SYS_Class>().GetEntitiesAsync(x => x.SchoolId == schoolId && x.Status == 1).Result.OrderBy(x => x.Grade).ToList();
                HttpContextCore.SetSession(ComConst.Session_ClassList, JsonHelper.ToJson(list));
                break;
            }

            case "stu":
            {
                break;
            }

            case "staff":
            {
                List <SYS_Staff> list = UnitOfWork.Repository <SYS_Staff>().GetEntitiesAsync(x => x.SchoolId == schoolId && x.Status == (byte)StaffStatus.在职).Result.OrderBy(x => x.RoleLevel).ToList();
                HttpContextCore.SetSession(ComConst.Session_StaffList, JsonHelper.ToJson(list));
                break;
            }
            }
        }
示例#2
0
 public BaseController()
 {
     mlUser = JsonHelper.JsonToT <ModelLoginUser>(HttpContextCore.GetSession(ComConst.UserLogin));
     if (mlUser != null)
     {
         HttpContextCore.SetSession(ComConst.UserLogin, JsonHelper.ToJson(mlUser));
     }
     mjResult = new ModelJsonRet()
     {
         code    = 0,
         errMsg  = string.Empty,
         content = string.Empty
     };
 }
 public AdminBaseController()
 {
     glbAdmin = JsonHelper.JsonToT <SYS_Admin>(HttpContextCore.GetSession(ComConst.AdminLogin));
     if (glbAdmin != null)
     {
         HttpContextCore.SetSession(ComConst.AdminLogin, JsonHelper.ToJson(glbAdmin));
     }
     mjResult = new ModelJsonRet()
     {
         code    = 0,
         errMsg  = string.Empty,
         content = string.Empty
     };
 }
示例#4
0
 public BaseService()
 {
     if (null == mlUser)
     {
         mlUser = JsonHelper.JsonToT <ModelLoginUser>(HttpContextCore.GetCookie(ComConst.UserLogin));
         if (mlUser == null)
         {
             mlUser = JsonHelper.JsonToT <ModelLoginUser>(HttpContextCore.GetSession(ComConst.UserLogin));
             if (mlUser != null)
             {
                 HttpContextCore.SetSession(ComConst.UserLogin, JsonHelper.ToJson(mlUser));
             }
         }
     }
     mjRet = new ModelJsonRet
     {
         code = 0,
     };
 }
        public WxBaseController()
        {
            ViewBag.SchoolName = "陪绮在线";
            mjResult           = new ModelJsonRet()
            {
                code    = 0,
                errMsg  = string.Empty,
                content = string.Empty
            };

            mSysWxUser = JsonHelper.JsonToT <ModelSysWxUser>(HttpContextCore.GetSession(ComConst.Wx_ModelSysWxUser));
            if (mSysWxUser != null)
            {
                HttpContextCore.SetSession(ComConst.Wx_ModelSysWxUser, JsonHelper.ToJson(mSysWxUser));
                if (mSysWxUser.School != null)
                {
                    ViewBag.SchoolName = mSysWxUser.School.SchoolName;
                }
            }
        }
示例#6
0
        public ActionResult Index()
        {
            ViewBag.SchoolName = "陪绮在线";
            var mWxUserInfo = JsonHelper.JsonToT <ModelWxUserInfo>(GetSession(ComConst.Wx_ModelWxUserInfo));

            var mSysWxUser = new ModelSysWxUser()
            {
                UserType = 0,
            };

            if (mWxUserInfo != null)
            {
                Service.UpdateWxUserInfo(mWxUserInfo);//更新微信用户信息
                mSysWxUser = Service.GetSysWxUserModel(glbSchoolId, mWxUserInfo.openid);
                SetCookie(ComConst.Wx_ModelSysWxUser, JsonHelper.ToJson(mSysWxUser));
                HttpContextCore.SetSession(ComConst.Wx_ModelSysWxUser, JsonHelper.ToJson(mSysWxUser));

                if (mSysWxUser.School != null)
                {
                    ViewBag.SchoolName = mSysWxUser.School.SchoolName;
                }
            }
            return(View("Index_WxHome", mSysWxUser));
        }