protected override Result GetDetailTable <T>(HttpContext context)
        {
            var lists = GetData <T>(context, true);
            var list  = lists.Count != 0 ? lists[0] : new List <T>();
            DataTablesRequest   param = new DataTablesRequest(context.Request);
            JQueryDataTableData dt    = new JQueryDataTableData();

            dt.sEcho         = param.sEcho;
            dt.iTotalRecords = dt.iTotalDisplayRecords = list.Count;
            dt.aaData        = ObjectParseListFillDetailTable(list);

            DateTime restime = Convert.ToDateTime(context.Request["begintime"]);
            int      period  = Convert.ToInt32(context.Request["period"]);

            if (1 == period)
            {
                dt.begintime = restime.ToString("yyyy-MM-dd");
                dt.endtime   = restime.ToString("yyyy-MM-dd");
            }
            if (3 == period)
            {
                dt.begintime = B_BaseToolService.GetWeekUpOfDate(restime, DayOfWeek.Monday, -1).ToString("yyyy-MM-dd");
                dt.endtime   = B_BaseToolService.GetWeekUpOfDate(restime, DayOfWeek.Sunday, 0).ToString("yyyy-MM-dd");
            }
            if (12 == period)
            {
                dt.begintime = restime.AddDays(-1 * (restime.Day) + 1).AddMonths(-1).ToString("yyyy-MM-dd");
                dt.endtime   = restime.AddDays(-1 * (restime.Day)).ToString("yyyy-MM-dd");
            }
            return(Result.GetSuccessedResult(dt, false));
        }
Beispiel #2
0
        protected override List <List <Dictionary <string, string> > > GetData(HttpContext context, bool flag = false)
        {
            DateTime restime           = Convert.ToDateTime(context.Request["begintime"]);
            DateTime comparebeforetime = restime.AddDays(-1);
            int      softs             = Convert.ToInt32(context.Request["softs"]);
            int      platform          = Convert.ToInt32(context.Request["plat"]);
            int      restype           = Convert.ToInt32(context.Request["restype"]);
            int      period            = Convert.ToInt32(context.Request["period"]);

            int downtype = Convert.ToInt32(context.Request["downtype"]);

            if (3 == period)
            {
                comparebeforetime = B_BaseToolService.GetWeekUpOfDate(restime, DayOfWeek.Sunday, -1);
                restime           = B_BaseToolService.GetWeekUpOfDate(restime, DayOfWeek.Sunday, 0);
            }
            if (12 == period)
            {
                comparebeforetime = restime.AddDays(-1 * (restime.Day)).AddMonths(-1);
                restime           = restime.AddDays(-1 * (restime.Day));
            }
            List <List <Dictionary <string, string> > > lists = new List <List <Dictionary <string, string> > >();

            List <Dictionary <string, string> > result = D_StatDownRank_Service.Instance.GetD_StatDownRankBySoftByCacheMap(restype, softs, platform,
                                                                                                                           comparebeforetime, restime, period, downtype);

            if (result.Count == 0)
            {
                return(new List <List <Dictionary <string, string> > >());
            }
            lists.Add(result);

            return(lists);
        }
        protected override List <List <T> > GetData <T>(HttpContext context, bool flag = false)
        {
            DateTime restime           = Convert.ToDateTime(context.Request["begintime"]);
            DateTime comparebeforetime = restime.AddDays(-1);

            int softs    = Convert.ToInt32(context.Request["softs"]);
            int platform = Convert.ToInt32(context.Request["plat"]);
            int restype  = Convert.ToInt32(context.Request["restype"]);
            int period   = Convert.ToInt32(context.Request["period"]);

            if (3 == period)
            {
                comparebeforetime = B_BaseToolService.GetWeekUpOfDate(restime, DayOfWeek.Sunday, -1);
                restime           = B_BaseToolService.GetWeekUpOfDate(restime, DayOfWeek.Sunday, 0);
            }
            if (12 == period)
            {
                comparebeforetime = restime.AddDays(-1 * (restime.Day)).AddMonths(-1);
                restime           = restime.AddDays(-1 * (restime.Day));
            }

            List <List <D_StatDownCountsByResIDEntity> > lists = new List <List <D_StatDownCountsByResIDEntity> >();

            var lstauthor = B_BaseToolService.Instance.GetAuthorEntityCache();

            var result = D_StatDownRank_Service.Instance.GetD_StatDownCountRankByAuthorIDCache(period, restype, softs, platform,
                                                                                               comparebeforetime, restime);
            var res = from item1 in result.AsEnumerable()
                      join item2 in lstauthor.AsEnumerable() on item1.AuthorID equals item2.AuthorID
                      select new D_StatDownCountsByResIDEntity()
            {
                StatDate   = item1.StatDate,
                ResID      = item1.ResID,
                AuthorID   = item1.AuthorID,
                AuthorName = item2.AuthorName,
                DownCount  = item1.DownCount,
                ResCount   = item1.ResCount,
                Rank       = item1.Rank,
                LastRank   = item1.LastRank
            };

            if (res.Count() != 0)
            {
                lists.Add(res.ToList <D_StatDownCountsByResIDEntity>());
            }

            return(lists as List <List <T> >);
        }
Beispiel #4
0
        protected override List <List <T> > GetData <T>(HttpContext context, bool flag = false)
        {
            DateTime restime           = Convert.ToDateTime(context.Request["begintime"]);
            DateTime comparebeforetime = restime.AddDays(-1);
            int      softs             = Convert.ToInt32(context.Request["softs"]);
            int      platform          = Convert.ToInt32(context.Request["plat"]);
            int      restype           = Convert.ToInt32(context.Request["restype"]);
            int      period            = Convert.ToInt32(context.Request["period"]);
            int      pcid = Convert.ToInt32(context.Request["pcid"]);
            int      cid  = Convert.ToInt32(context.Request["cid"]);

            int downtype = Convert.ToInt32(context.Request["downtype"]);

            if (3 == period)
            {
                comparebeforetime = B_BaseToolService.GetWeekUpOfDate(restime, DayOfWeek.Sunday, -1);
                restime           = B_BaseToolService.GetWeekUpOfDate(restime, DayOfWeek.Sunday, 0);
            }
            if (12 == period)
            {
                comparebeforetime = restime.AddDays(-1 * (restime.Day)).AddMonths(-1);
                restime           = restime.AddDays(-1 * (restime.Day));
            }
            List <List <D_StatDownRank_SUM> > lists = new List <List <D_StatDownRank_SUM> >();



            List <D_StatDownRank_SUM> resultbefore = D_StatDownRank_Service.Instance.GetD_StatDownRankByClassByCache(restype, softs, platform,
                                                                                                                     comparebeforetime, period, pcid, cid, downtype);

            List <D_StatDownRank_SUM> resultrestime = D_StatDownRank_Service.Instance.GetD_StatDownRankByClassByCache(restype, softs, platform,
                                                                                                                      restime, period, pcid, cid, downtype);

            var resulttemp = (from itrestime in resultrestime
                              join itbefore in resultbefore on itrestime.ResIdentifier equals itbefore.ResIdentifier into os
                              from t in os.DefaultIfEmpty()
                              select new D_StatDownRank_SUM
            {
                StatDate = itrestime.StatDate,
                SoftID = itrestime.SoftID,
                Platform = itrestime.Platform,
                ResType = itrestime.ResType,
                DownCount = itrestime.DownCount,
                ResIdentifier = itrestime.ResIdentifier,
                Rank = itrestime.Rank,
                LastRank = t == null?"--":t.Rank.ToString()
            }).OrderBy(p => p.Rank).ToList();

            var reslst = resulttemp.Select(p => p.ResIdentifier).ToList();

            int projectsourcetype       = new B_BaseTool_DataAccess().GetProjectSourceTypeBySoftId2(softs);
            List <B_ResInfo> lstresinfo = new B_BaseToolService().GetResInfo(restype, projectsourcetype, reslst);
            var result = (from item in resulttemp
                          join itemresinfo in lstresinfo on item.ResIdentifier equals itemresinfo.ResIdentifier into os
                          from t in os.DefaultIfEmpty()
                          select new D_StatDownRank_SUM
            {
                StatDate = item.StatDate,
                SoftID = item.SoftID,
                Platform = item.Platform,
                ResType = item.ResType,
                ResIdentifier = item.ResIdentifier,
                Rank = item.Rank,
                DownCount = item.DownCount,
                LastRank = item.LastRank,
                ResName = t == null ? "" : t.ResName
            }).ToList();

            if (result.Count == 0)
            {
                return(new List <List <D_StatDownRank_SUM> >() as List <List <T> >);
            }
            lists.Add(result);

            return(lists as List <List <T> >);
        }