예제 #1
0
        /// <summary>
        /// 获取审查数据
        /// </summary>
        /// <param name="pagination"></param>
        /// <param name="queryJson"></param>
        /// <returns></returns>
        public DataTable GetIntromissionPageList(Pagination pagination, string queryJson)
        {
            DatabaseType dataType = DbHelper.DbType;
            Operator     user     = ERCHTMS.Code.OperatorProvider.Provider.Current();

            if (!string.IsNullOrEmpty(queryJson))
            {
                var queryParam = queryJson.ToJObject();
                //时间范围
                if (!queryParam["sTime"].IsEmpty() || !queryParam["eTime"].IsEmpty())
                {
                    string startTime = queryParam["sTime"].ToString();
                    string endTime   = queryParam["eTime"].ToString();
                    if (queryParam["sTime"].IsEmpty())
                    {
                        startTime = "1899-01-01";
                    }
                    if (queryParam["eTime"].IsEmpty())
                    {
                        endTime = DateTime.Now.ToString("yyyy-MM-dd");
                    }
                    pagination.conditionJson += string.Format(" and to_date(to_char(a.applytime,'yyyy-MM-dd'),'yyyy-MM-dd') between to_date('{0}','yyyy-MM-dd') and  to_date('{1}','yyyy-MM-dd')", startTime, endTime);
                }
                //查询条件
                if (!queryParam["condition"].IsEmpty() && !queryParam["txtSearch"].IsEmpty())
                {
                    pagination.conditionJson += string.Format(" and {0} like '%{1}%'", queryParam["condition"].ToString(), queryParam["txtSearch"].ToString());
                }
                if (!queryParam["indexState"].IsEmpty())//首页代办
                {
                    string strCondition = "";
                    strCondition = string.Format(" and a.createuserorgcode='{0}' and a.investigatestate !='3'", user.OrganizeCode);
                    DataTable data = BaseRepository().FindTable("select " + pagination.p_kid + "," + pagination.p_fields + " from " + pagination.p_tablename + " where " + pagination.conditionJson + strCondition);
                    for (int i = 0; i < data.Rows.Count; i++)
                    {
                        var engineerEntity  = outsouringengineerservice.GetEntity(data.Rows[i]["outengineerid"].ToString());
                        var excutdept       = departmentservice.GetEntity(engineerEntity.ENGINEERLETDEPTID).DepartmentId;
                        var outengineerdept = departmentservice.GetEntity(engineerEntity.OUTPROJECTID).DepartmentId;
                        var supervisordept  = string.IsNullOrEmpty(engineerEntity.SupervisorId) ? "" : departmentservice.GetEntity(engineerEntity.SupervisorId).DepartmentId;
                        //获取下一步审核人
                        string str = powerCheck.GetApproveUserId(data.Rows[i]["flowid"].ToString(), data.Rows[i]["id"].ToString(), "", "", excutdept, outengineerdept, "", "", "", supervisordept, data.Rows[i]["outengineerid"].ToString());
                        data.Rows[i]["approveuserids"] = str;
                    }

                    string[] applyids = data.Select(" approveuserids like '%" + user.UserId + "%'").AsEnumerable().Select(d => d.Field <string>("id")).ToArray();

                    pagination.conditionJson += string.Format(" and a.id in ('{0}') {1}", string.Join("','", applyids), strCondition);
                }
                if (!queryParam["projectid"].IsEmpty())
                {
                    pagination.conditionJson += string.Format(" and b.id ='{0}'", queryParam["projectid"].ToString());
                }
            }
            var dt = this.BaseRepository().FindTableByProcPager(pagination, dataType);

            return(dt);
        }
예제 #2
0
        /// <summary>
        /// 获取分页数据
        /// </summary>
        /// <param name="keyValue">主键值</param>
        /// <returns>返回对象Json</returns>
        public DataTable GetPageList(Pagination pagination, string queryJson)
        {
            DatabaseType dataType   = DbHelper.DbType;
            Operator     currUser   = OperatorProvider.Provider.Current();
            var          queryParam = queryJson.ToJObject();

            if (!queryParam["name"].IsEmpty())
            {
                pagination.conditionJson += string.Format(" and (e.engineername like'%{0}%' or b.fullname like'%{1}%') ", queryParam["name"].ToString(), queryParam["name"].ToString());
            }
            if (!queryParam["orgCode"].IsEmpty())
            {
                pagination.conditionJson += string.Format(" and s.createuserorgcode='{0}' ", queryParam["orgCode"].ToString());
            }
            if (!queryParam["StartTime"].IsEmpty())
            {
                pagination.conditionJson += string.Format(" and s.applyreturntime>= to_date('{0}','yyyy-MM-dd hh24:mi:ss') ", queryParam["StartTime"].ToString());
            }
            if (!queryParam["EndTime"].IsEmpty())
            {
                pagination.conditionJson += string.Format(" and s.applyreturntime<= to_date('{0}','yyyy-MM-dd hh24:mi:ss') ", Convert.ToDateTime(queryParam["EndTime"]).AddDays(1).ToString("yyyy-MM-dd"));
            }
            //外包工程Id
            if (!queryParam["ProjectId"].IsEmpty())
            {
                pagination.conditionJson += string.Format(" and s.OUTENGINEERID='{0}'", queryParam["ProjectId"].ToString());
            }
            //外包单位Id
            if (!queryParam["UnitId"].IsEmpty())
            {
                pagination.conditionJson += string.Format(" and s.OUTPROJECTID='{0}'", queryParam["UnitId"].ToString());
            }
            //发包部门Id
            if (!queryParam["DeptId"].IsEmpty())
            {
                pagination.conditionJson += string.Format(" and e.engineerletdeptid='{0}'", queryParam["DeptId"].ToString());
            }
            if (!queryParam["indexState"].IsEmpty())//首页代办
            {
                string strCondition = "";
                strCondition = string.Format(" and s.createuserorgcode='{0}' and s.iscommit ='1' and s.isover='0'", currUser.OrganizeCode);
                DataTable data = BaseRepository().FindTable("select " + pagination.p_kid + "," + pagination.p_fields + " from " + pagination.p_tablename + " where " + pagination.conditionJson + strCondition);
                for (int i = 0; i < data.Rows.Count; i++)
                {
                    var engineerEntity  = outsouringengineerservice.GetEntity(data.Rows[i]["outengineerid"].ToString());
                    var excutdept       = departmentservice.GetEntity(engineerEntity.ENGINEERLETDEPTID).DepartmentId;
                    var outengineerdept = departmentservice.GetEntity(engineerEntity.OUTPROJECTID).DepartmentId;
                    var supervisordept  = string.IsNullOrEmpty(engineerEntity.SupervisorId) ? "" : departmentservice.GetEntity(engineerEntity.SupervisorId).DepartmentId;
                    //获取下一步审核人
                    string str = powerCheck.GetApproveUserId(data.Rows[i]["nodeid"].ToString(), data.Rows[i]["id"].ToString(), "", "", excutdept, outengineerdept, "", "", "", supervisordept, data.Rows[i]["outengineerid"].ToString());
                    data.Rows[i]["approveuserids"] = str;
                }

                string[] applyids = data.Select(" approveuserids like '%" + currUser.UserId + "%'").AsEnumerable().Select(d => d.Field <string>("id")).ToArray();

                pagination.conditionJson += string.Format(" and s.id in ('{0}') {1}", string.Join("','", applyids), strCondition);
            }
            if (!queryParam["projectid"].IsEmpty())
            {
                pagination.conditionJson += string.Format(" and e.id ='{0}'", queryParam["projectid"].ToString());
            }
            DataTable dt = this.BaseRepository().FindTableByProcPager(pagination, dataType);

            return(dt);
        }