Example #1
0
        /// <summary>
        /// 获取全部账号统计报告ISMP 使用
        /// </summary>
        /// <param name="account"></param>
        /// <param name="beginTime"></param>
        /// <param name="endTime"></param>
        /// <returns></returns>
        public RPCResult <List <ReportStatistics> > GetStatisticsReportAll(DateTime beginTime, DateTime endTime)
        {
            DateTime cacheBeginTime = DateTime.MaxValue;

            if (DateTime.Compare(beginTime, endTime) > 0)
            {
                DateTime dt = beginTime;
                beginTime = endTime;
                endTime   = dt;
            }
            if (DateTime.Compare(endTime, DateTime.Now) > 0)
            {
                endTime = DateTime.Now;
            }

            List <string> list    = ReportStatisticsDB.GetTables();
            var           maxdate = list.Max(s => DateTime.Parse(s.Remove(0, 17).Insert(4, "-").Insert(7, "-")));

            if (DateTime.Compare(endTime, maxdate) > 0)
            {
                endTime = maxdate;
            }
            var mindate = list.Min(s => DateTime.Parse(s.Remove(0, 17).Insert(4, "-").Insert(7, "-")));

            if (DateTime.Compare(beginTime, mindate) < 0)
            {
                beginTime = mindate;
            }
            List <ReportStatistics> dbRS = ReportStatisticsDB.GetStatisticsByDate(beginTime, endTime);

            return(new RPCResult <List <ReportStatistics> >(true, dbRS, ""));
        }
        public void GetStatisticsByDateTest()
        {
            var r = ReportStatisticsDB.GetStatisticsByDate(new DateTime(2016, 4, 28), DateTime.Now);

            Assert.IsTrue(r.Count > 0);
        }