Exemplo n.º 1
0
        /// <summary>
        /// 外包工程列表
        /// </summary>
        /// <param name="pagination">分页参数</param>
        /// <param name="queryJson">查询参数</param>
        /// <returns>返回分页列表Json</returns>
        public ActionResult GetPageListJson(Pagination pagination, string queryJson)
        {
            pagination.p_kid       = "ProjectId";
            pagination.p_fields    = "t.CreateDate,t.CreateUserID,ProjectName,ProjectDeptName,ProjectDeptCode,ProjectStatus,ProjectStartDate,ProjectEndDate, ProjectContent,b.SendDeptID,b.OrganizeId,OrganizeCode";
            pagination.p_tablename = "bis_project t left join base_department b on b.EnCode=t.ProjectDeptCode";
            string type = new AuthorizeBLL().GetOperAuthorzeType(ERCHTMS.Code.OperatorProvider.Provider.Current(), HttpContext.Request.Cookies["currentmoduleId"].Value, "search");
            var    user = ERCHTMS.Code.OperatorProvider.Provider.Current();

            pagination.conditionJson = " 1=1 ";
            if (type == "4")
            {
                //本机构
                pagination.conditionJson = string.Format(" 1=1 and b.OrganizeId='{0}' ", user.OrganizeId);
            }
            else if (type == "3")
            {
                //本子部门
                if (user.RoleName.Contains("承包商") || user.RoleName.Contains("分包商"))
                {
                    pagination.conditionJson = string.Format(" 1=1 and ProjectDeptCode like '{0}%' ", user.DeptCode);
                }
                else
                {
                    pagination.conditionJson = string.Format(" 1=1 and SendDeptID= '{0}'", user.DeptId);
                }
            }
            else if (type == "2")
            {
                //本部门
                pagination.conditionJson = string.Format(" 1=1 and ProjectDeptCode = '{0}' ", user.DeptCode);
            }

            //参数,用于选择项目
            if (null != Request.Params["OrgArgs"])
            {
                pagination.conditionJson = string.Format(" 1=1 and b.OrganizeId='{0}' ", user.OrganizeId);
            }
            var watch = CommonHelper.TimerStart();
            //var data = projectbll.GetPageList(pagination, queryJson);
            DataTable data     = projectbll.GetPageDataTable(pagination, queryJson);
            var       JsonData = new
            {
                rows     = data,
                total    = pagination.total,
                page     = pagination.page,
                records  = pagination.records,
                costtime = CommonHelper.TimerEnd(watch)
            };

            return(Content(JsonData.ToJson()));
        }