示例#1
0
        public static CompanyDayReport QueryDayReport(QF_SmokeDayReport qF_Smoke)
        {
            var reportlist = SmokeDetectorDayReportDA.QueryDayReport(qF_Smoke);

            //var result = new List<CompanyDayReport>();
            //if(qF_Smoke.CompanySysNo.HasValue&& qF_Smoke.CompanySysNo.Value > 0)
            // {
            CompanyDayReport companyDayReport = new CompanyDayReport
            {
                TotalCount    = new List <DayReport>(),
                OnlineCount   = new List <DayReport>(),
                LowPowerCount = new List <DayReport>(),
                FireCount     = new List <DayReport>(),
                OffLineCount  = new List <DayReport>()
            };

            if (qF_Smoke.CompanySysNo.HasValue && qF_Smoke.CompanySysNo.Value > 0)
            {
                companyDayReport.CompanySysNo = qF_Smoke.CompanySysNo.Value;
            }
            reportlist.ForEach(e =>
            {
                companyDayReport.TotalCount.Add(new DayReport
                {
                    DayDate = e.DayDate,
                    Count   = e.TotalCount,
                    Percent = " "
                });
                companyDayReport.OnlineCount.Add(new DayReport
                {
                    DayDate = e.DayDate,
                    Count   = e.OnlineCount,
                    Percent = "(" + Math.Round((double)e.OnlineCount / e.TotalCount, 4) * 100 + "%)"
                });
                companyDayReport.LowPowerCount.Add(new DayReport
                {
                    DayDate = e.DayDate,
                    Count   = e.LowPowerCount,
                    Percent = "(" + Math.Round((double)e.LowPowerCount / e.TotalCount, 4) * 100 + "%)"
                });
                companyDayReport.FireCount.Add(new DayReport
                {
                    DayDate = e.DayDate,
                    Count   = e.FireCount,
                    Percent = "(" + Math.Round((double)e.FireCount / e.TotalCount, 4) * 100 + "%)"
                });
                companyDayReport.OffLineCount.Add(new DayReport
                {
                    DayDate = e.DayDate,
                    Count   = (e.TotalCount - e.OnlineCount),
                    Percent = "(" + Math.Round((double)(e.TotalCount - e.OnlineCount) / e.TotalCount, 4) * 100 + "%)"
                });
            });
            // }
            return(companyDayReport);
        }
示例#2
0
 public static void BuildDayReport(DateTime?beginDate, DateTime?endDate)
 {
     if (!beginDate.HasValue)
     {
         beginDate = DateTime.Now.AddDays(-1);
     }
     if (!endDate.HasValue)
     {
         endDate = DateTime.Now;
     }
     SmokeDetectorDayReportDA.BuildDayReport(beginDate.Value, endDate.Value);
 }