public ActionResult Index() { GlobalSettingManager.SetGlobalCache(); ViewData["companyName"] = GlobalSettingManager.GetGlobalCache().CompanyName; if (UserInfoManager.IfLogOn()) { ViewData["name"] = UserInfoManager.GetUserSession().Name; ViewData["userId"] = UserInfoManager.GetUserSession().ID.ToString(); string avatarString = UserInfoManager.GetUserAvatar(); ViewData["avatar"] = avatarString == "" ? "../../Upload/Avatar/DefaultAvatar.jpg" : avatarString; ViewData["visible"] = UserInfoManager.GetUserSession().IsAdmin; // 侧边栏加载系统模块菜单 ViewData["SystemModel"] = SystemModelManager.LoadAll(); // 显示签到按钮操作 Registration registrationObj = RegistrationManager.GetDayRegistration(UserInfoManager.GetUserSession().ID, DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day); if (registrationObj == null) { ViewData["registration"] = "签到"; } else { ViewData["registration"] = "下班"; } UserInfo user = UserInfoManager.GetUserSession(); ViewData["EmailReceiveUserRelation"] = EmailReceiveUserRelationManager.LoadAll().Where(f => f.ReceiveUser.ID == user.ID).Take(5); ViewData["TaskReceiveUserRelation"] = TaskReceiveUserRelationManager.LoadAll().Where(f => f.ReceiveUser.ID == user.ID).Take(5); ViewData["Notice"] = NoticeManager.LoadAll().Where(f => f.ReceiveUser.ID == user.ID); ViewData["MyEmailCount"] = ((IEnumerable <EmailReceiveUserRelation>)ViewData["EmailReceiveUserRelation"]).Count(); ViewData["MyTaskCount"] = ((IEnumerable <TaskReceiveUserRelation>)ViewData["TaskReceiveUserRelation"]).Count(); ViewData["NoticeCount"] = ((IEnumerable <Notice>)ViewData["Notice"]).Count(); return(View()); } else { return(View("LogOn")); } }
public ActionResult Index() { this.ViewData["userInfo"] = UserInfoManager.GetUserSession(); this.ViewData["avatar"] = UserInfoManager.GetUserAvatar(); return(View()); }