Esempio n. 1
0
        public List <WorkReport> GetWorkReportList(WRQueryFilter filterCondition)
        {
            List <WorkReport> reports         = new List <WorkReport>();
            StringBuilder     queryStr        = new StringBuilder($@"Select distinct a.id, a.wrtypeid, a.dateoffilling, a.location, a.creator, a.createdtime, a.lastmodifier, a.lastmodifiedtime, b.name as wrtypename, b.code as wrtypecode from WorkReport a join wrtype b on a.wrtypeid = b.id and b.tenantid='{Utils.GetTenantId()}' left join wrrecipients c on c.wrid = a.id and c.tenantid='{Utils.GetTenantId()}' where a.tenantid='{Utils.GetTenantId()}' ");
            DateTime          defaultDateTime = new DateTime();

            if (filterCondition.StartTime != null && !filterCondition.StartTime.Equals(defaultDateTime))
            {
                queryStr.Append($@" AND a.dateoffilling >= '{filterCondition.StartTime}' ");
            }

            if (filterCondition.EndTime != null && !filterCondition.EndTime.Equals(defaultDateTime))
            {
                queryStr.Append($@" AND a.dateoffilling <= '{filterCondition.EndTime}' ");
            }

            if (filterCondition.WorkReportSenders != null && filterCondition.WorkReportSenders.Count > 0)
            {
                queryStr.Append(@" AND a.creator in ('");
                queryStr.Append(string.Join("','", filterCondition.WorkReportSenders.ToArray()));
                queryStr.Append(@"') ");
                queryStr.Replace("'self'", "'" + PlanState.UserId + "'");
            }
            if (filterCondition.WorkReportRecipients != null && filterCondition.WorkReportRecipients.Count > 0)
            {
                queryStr.Append(@" AND c.recipientid in ('");
                queryStr.Append(string.Join("','", filterCondition.WorkReportRecipients.ToArray()));
                queryStr.Append(@"') ");
                queryStr.Replace("'self'", "'" + PlanState.UserId + "'");
            }
            queryStr.Append(@" order by a.createdtime desc");
            using (var dbReader = db.ExecuteReader(queryStr.ToString()))
            {
                //将数据库信息封装到实体类
                while (dbReader.Read())
                {
                    reports.Add(AssemblyWorkReport(dbReader));
                }
            }

            return(reports);
        }
Esempio n. 2
0
        public List <WorkReport> GetWorkReportList(WRQueryFilter filterCondition)
        {
            if (filterCondition == null)
            {
                return(null);
            }
            PlanDac           planDac = new PlanDac();
            List <WorkReport> reports = planDac.GetWorkReportList(filterCondition);

            if (reports != null && reports.Count > 0)
            {
                for (int i = 0; i < reports.Count; i++)
                {
                    WorkReport wr = reports[i];
                    if (!string.IsNullOrEmpty(wr.Creator))
                    {
                        SysUser user = userService.GetUserByID(wr.Creator);
                        wr.CreatorName = user == null? "某某" : user.Name;
                    }
                }
            }
            return(reports);
        }
Esempio n. 3
0
 public List <WorkReport> Get([FromQuery] WRQueryFilter filterCondition)
 {
     return(PlanService.Current.GetWorkReportList(filterCondition));
 }
Esempio n. 4
0
 public List <WorkReport> GetWorkReportList(WRQueryFilter filterCondition)
 {
     return(manager.GetWorkReportList(filterCondition));
 }