Ejemplo n.º 1
0
        /// <summary>
        /// 主页
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            if (CurrentUserInfo == null)
            {
                return(RedirectToAction("Login", "Login"));
            }
            var res = service.LoadEntities(r => true);

            ViewBag.LoadMenus = menuInfoService.LoadMenusInfo(CurrentUserInfo.Id);
            ViewBag.curPer    = curPerModel == null ? "" : curPerModel.UserName;
            var _per = Convert.ToString(Session["qPer"]);

            if (_per == "Manager")
            {
                ViewBag.qPer = "Admin";
            }
            if (_per == "Per")
            {
                ViewBag.qPer = "User";
            }

            #region 判断当前角色是否存在 普通人
            var roleDesc = EnumDescription <HRL.Model.Enums.Role> .GetVisaTypeEnumDescription((int)HRL.Model.Enums.Role.r_ordPer);

            if (CurrentUserInfo.RoleList.Select(r => r.RoleName).Contains(roleDesc))
            {
                ViewBag.CurRole = "1";
            }
            #endregion
            return(View());
        }
Ejemplo n.º 2
0
        public ActionResult Main()
        {
            var roleDesc = EnumDescription <HRL.Model.Enums.Role> .GetVisaTypeEnumDescription((int)HRL.Model.Enums.Role.r_ordPer);

            if (CurrentUserInfo.RoleList.Select(r => r.RoleName).Contains(roleDesc))
            {
                //普通用户
                ViewBag.role = "2";
            }
            else
            {
                //管理员角色
                ViewBag.role = "1";
            }

            return(View());
        }
        public ActionResult Index(Bus_TakeError model)
        {
            int count = 0;

            try
            {
                if (CurrentUserInfo == null)
                {
                    return(RedirectToAction("Login", "Login"));
                }
                #region 判断当前角色是否存在 普通人
                var isPerRole = false;
                var roleDesc  = EnumDescription <HRL.Model.Enums.Role> .GetVisaTypeEnumDescription((int)HRL.Model.Enums.Role.r_ordPer);

                if (CurrentUserInfo.RoleList.Select(r => r.RoleName).Contains(roleDesc))
                {
                    ViewBag.CurRole = "1";
                    isPerRole       = true;
                }
                #endregion
                if (isPerRole)
                {
                    model.UserId = CurrentUserInfo.Id;
                }
                var temp = service.GetPaging(model, out count);

                ViewBag.ShowList = temp;
                ViewBag.total    = count;
                ViewBag.Model    = model;
                return(View());
            }
            catch (Exception ex)
            {
                result.statusCode = "300";
                result.message    = GlobalLngResource.GetRes("sysException");
                return(Json(result));
            }
        }