Ejemplo n.º 1
0
        readonly CrmUserBll _crmUserBll = new CrmUserBll(); //人员信息
                                                            //
                                                            // GET: /OA/

        #region 公告通知
        public ActionResult Index()
        {
            var usersId = _crmUserBll.GetUserEntity(CurrentUser.CrmUser.Id);

            //领导权限
            var userrole = new CrmUserRoleEntity()
            {
                UserId = usersId.Id,
                RoleId = "96518d03-85c3-4ec3-a42c-ad56b9501099"
            };
            var list = new CrmUserRoleBll().GetSearchResult(userrole);

            //管理员权限
            var adminrole = new CrmUserRoleEntity()
            {
                UserId = usersId.Id,
                RoleId = "09c19ef1-77ef-4483-b7db-c09284d0deff"
            };
            var list2 = new CrmUserRoleBll().GetSearchResult(adminrole);

            ViewBag.admin  = 0;
            ViewBag.leader = 0;
            if (list.Count > 0)
            {
                ViewBag.leader = 1;
            }
            if (list2.Count > 0)
            {
                ViewBag.admin  = 1;
                ViewBag.leader = 1;
            }

            return(View());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取公告通知表数据
        /// add by lpl
        /// 2018-12-14
        /// </summary>
        /// <param name="fileId"></param>
        /// <returns></returns>
        public string GetAllDoc(string limit, string page, string Title, string datafw, string Gglx)
        {
            #region 根据当前用户ID,取出属于当前用户的通告列表
            ////取当前用户
            //var usersId = _crmUserBll.GetUserEntity(CurrentUser.CrmUser.Id);

            ////搜索当前用户接受到的所有通知
            //var personentity = new DocNotfPersonEntity()
            //{
            //    Pid = usersId.Id
            //};
            //var person = new DocNotfPersonBall().search(personentity);

            ////拼接字符串,用来通知公告表筛选
            //string jieshouGuid = "";
            //foreach (DocNotfPersonEntity doc in person)
            //{

            //    jieshouGuid +=  "'" + doc.ContentId + "',";
            //}

            //jieshouGuid = jieshouGuid.TrimEnd(',');
            ////jieshouGuid = jieshouGuid.TrimEnd('\'');
            #endregion


            var usersId = _crmUserBll.GetUserEntity(CurrentUser.CrmUser.Id);
            var entity  = new DocumentNotificationEntity()
            {
                Title    = Title,
                Category = Gglx
            };

            var personentity = new DocNotfPersonEntity()
            {
                Title    = Title,
                Category = Gglx,
                Pid      = usersId.Id
            };

            var data  = new List <DocumentNotificationEntity>();
            var data2 = new List <DocNotfPersonEntity>();
            //领导权限
            var userrole = new CrmUserRoleEntity()
            {
                UserId = usersId.Id,
                RoleId = "96518d03-85c3-4ec3-a42c-ad56b9501099"
            };
            var list = new CrmUserRoleBll().GetSearchResult(userrole);

            //管理员权限
            var adminrole = new CrmUserRoleEntity()
            {
                UserId = usersId.Id,
                RoleId = "09c19ef1-77ef-4483-b7db-c09284d0deff"
            };
            var list2 = new CrmUserRoleBll().GetSearchResult(adminrole);
            //搜索条件

            //是管理员或者领导
            if (list.Count > 0 || list2.Count > 0)
            {
                //不查询接受人,全部可以看到
                data = new DocumentNotificationBll().SearchQuery(entity, datafw);
                var pagecount = data.Count;

                //分页有空重写,linq实现的数据量过大效率会出现瓶颈
                data = data.Skip((Convert.ToInt32(page) - 1) * Convert.ToInt32(limit)).Take(Convert.ToInt32(limit)).ToList();

                var result = new LayTableModel <DocumentNotificationEntity>
                {
                    code  = 0,
                    msg   = "成功",
                    count = pagecount,
                    data  = data
                };

                return(JsonConvert.SerializeObject(result));
            }
            else
            {
                //如果不是领导,而是接收人,则需要重新绑定数据源

                data2 = new DocNotfPersonBall().search(personentity, datafw);
                //分页有空重写,linq实现的数据量过大效率会出现瓶颈
                data2 = data2.Skip((Convert.ToInt32(page) - 1) * Convert.ToInt32(limit)).Take(Convert.ToInt32(limit)).ToList();
                var pagecount = data2.Count;
                var result    = new LayTableModel <DocNotfPersonEntity>
                {
                    code  = 0,
                    msg   = "成功",
                    count = pagecount,
                    data  = data2
                };

                return(JsonConvert.SerializeObject(result));
            }
        }