/// <summary> /// 获取数据加上绑定数据 /// </summary> protected void BindData() { int channelId = 0; ChannelTypeOptions channelType = ChannelTypeOptions.Category; if (HeadControl1.Channel1.ChannelValues.Count > 0) { channelId = HeadControl1.Channel1.ChannelValues[0].ChannelValue; channelType = HeadControl1.Channel1.ChannelValues[0].ChannelType; } net91com.Reports.Services.CommonServices.SjqdUserStat.StatUsersService suService = new net91com.Reports.Services.CommonServices.SjqdUserStat.StatUsersService(); List <net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers> users = suService.GetRankOfVersions(softsid, platformsid, channelId, channelType, (int)Period, ref BeginTime, ref EndTime); if (reporttype.Value == "0") { users = users.OrderByDescending(a => a.NewUserCount).ToList(); } else { users = users.OrderByDescending(a => a.ActiveUserCount).ToList(); } HeadControl1.BeginTime = BeginTime; HeadControl1.EndTime = EndTime; reportTitle = string.Format("版本分布({0:yyyy-MM-dd}至{1:yyyy-MM-dd})", BeginTime, EndTime); ExcelDownUrl = string.Format("/Services/ExcelDownloader.ashx?Action=GetStatUsersByVersionTransverse&SoftID={0}&Platform={1}&Period={2}&StartDate={3:yyyy-MM-dd}&EndDate={4:yyyy-MM-dd}&ChannelIds={5}&ChannelTypes={6}&ChannelTexts={7}&v={8}", softsid, platformsid, (int)Period, BeginTime, EndTime, HeadControl1.Channel1.SelectedValue, HeadControl1.Channel1.SelectedCate, HttpUtility.UrlEncode(HeadControl1.Channel1.SelectedText), DateTime.Now.Ticks); GetStatUsersByVersionLineUrl = string.Format("/Services/GetMore.ashx?Action=GetStatUsersByVersionLine&SoftIds={0}&Platforms={1}&Period={2}&StartDate={3:yyyy-MM-dd}&EndDate={4:yyyy-MM-dd}&ChannelIds={5}&ChannelTypes={6}&ChannelTexts={7}&v={8}", softsid, platformsid, (int)net91com.Stat.Core.PeriodOptions.Daily, BeginTime, EndTime, HeadControl1.Channel1.SelectedValue, HeadControl1.Channel1.SelectedCate, HttpUtility.UrlEncode(HeadControl1.Channel1.SelectedText), DateTime.Now.Ticks); if (users.Count == 0) { SeriesJsonStr = "[]"; reportTitle = "无数据"; } else { SeriesJsonStr = GetYlineJson(users); } tableStr = GetTableString(users); }
/// <summary> /// 获取数据加上绑定数据 /// </summary> protected void BindData() { //进入分渠道统计 if (HeadControl1.Channel1.ChannelValues.Count != 0) { QuDao = true; var channels = HeadControl1.Channel1.ChannelValues; if (Period == net91com.Stat.Core.PeriodOptions.TimeOfDay || Period == net91com.Stat.Core.PeriodOptions.Hours) { for (int i = 0; i < channels.Count; i++) { //小时和每小时将其和到一条曲线中去了 //List<SoftUser> users = Sjqd_StatUsersByChannelsService.GetInstance().GetChannelUsersByHoursDataCache( // BeginTime, EndTime, SelectedSofts[0].ID, channels[i].Platform, Period, channels[i].ChannelType, Convert.ToInt32(channels[i].ChannelValue), channels[i].ChannelText, loginService,CacheTimeOption.TenMinutes).OrderBy(p => p.StatDate).ToList(); net91com.Reports.Services.CommonServices.SjqdUserStat.StatUsersService suService = new net91com.Reports.Services.CommonServices.SjqdUserStat.StatUsersService(); List <net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers> ssUsers; ssUsers = suService.GetStatUsersByHour(SelectedSofts[0].ID, channels[i].Platform, channels[i].ChannelType, Convert.ToInt32(channels[i].ChannelValue), (int)Period, BeginTime, EndTime); List <SoftUser> users = new List <SoftUser>(); foreach (net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers u in ssUsers) { SoftUser softuser = new SoftUser(); softuser.StatDate = u.StatDate; softuser.SoftId = SelectedSofts[0].ID; softuser.Platform = channels[i].Platform; softuser.ActiveNum = u.ActiveUserCount - u.NewUserCount; softuser.Hour = u.StatHour; softuser.NewNum = u.NewUserCount; softuser.UseNum = u.ActiveUserCount; users.Add(softuser); } users = users.OrderBy(p => p.StatDate).ToList(); if (users.Count != 0) { ListAll.Add(users); QuDaoList.Add(i); } //获取对比曲线 if (HeadControl1.CompareTimeType > 0) { //List<SoftUser> usersCompare = Sjqd_StatUsersByChannelsService.GetInstance().GetChannelUsersByHoursDataCache( //BeginCompareTime, EndCompareTime, SelectedSofts[0].ID, channels[i].Platform, Period, channels[i].ChannelType, Convert.ToInt32(channels[i].ChannelValue), channels[i].ChannelText, loginService,CacheTimeOption.TenMinutes).OrderBy(p => p.StatDate).ToList(); List <net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers> ssUsersComp; ssUsersComp = suService.GetStatUsersByHour(SelectedSofts[0].ID, channels[i].Platform, channels[i].ChannelType, Convert.ToInt32(channels[i].ChannelValue), (int)Period, BeginCompareTime, EndCompareTime); List <SoftUser> usersCompare = new List <SoftUser>(); foreach (net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers u in ssUsersComp) { SoftUser softuser = new SoftUser(); softuser.StatDate = u.StatDate; softuser.SoftId = SelectedSofts[0].ID; softuser.Platform = channels[i].Platform; softuser.ActiveNum = u.ActiveUserCount - u.NewUserCount; softuser.Hour = u.StatHour; softuser.NewNum = u.NewUserCount; softuser.UseNum = u.ActiveUserCount; usersCompare.Add(softuser); } usersCompare = usersCompare.OrderBy(p => p.StatDate).ToList(); if (usersCompare != null && usersCompare.Count != 0) { ListAllForCompare.Add(usersCompare); } } } } else { for (int i = 0; i < channels.Count; i++) { List <SoftUser> users = Sjqd_StatUsersByChannelsService.GetInstance().GetSoftUserChanelListCache(BeginTime, EndTime, SelectedSofts[0].ID, channels[i].Platform, Period, channels[i].ChannelType, Convert.ToInt32(channels[i].ChannelValue), channels[i].ChannelText, false, loginService, CacheTimeOption.TenMinutes).OrderBy(p => p.StatDate).ToList(); if (users != null && users.Count != 0) { ListAll.Add(users); QuDaoList.Add(i); } //获取对比曲线 if (HeadControl1.CompareTimeType > 0) { List <SoftUser> usersCompare = Sjqd_StatUsersByChannelsService.GetInstance().GetSoftUserChanelListCache(BeginCompareTime, EndCompareTime, SelectedSofts[0].ID, channels[i].Platform, Period, channels[i].ChannelType, Convert.ToInt32(channels[i].ChannelValue), channels[i].ChannelText, false, loginService, CacheTimeOption.TenMinutes).OrderBy(p => p.StatDate).ToList(); if (usersCompare != null && usersCompare.Count != 0) { ListAllForCompare.Add(usersCompare); } } } } } else { //选择所筛选的所有软件 for (int softid = 0; softid < SelectedSofts.Count; softid++) { Soft SingleSoftInfo = SelectedSofts[softid]; for (int i = 0; i < SelectedPlatforms.Count; i++) { foreach (MobileOption tempplat in SingleSoftInfo.Platforms) { ///他选出的平台加上和自己支持平台的交集 if (tempplat == SelectedPlatforms[i] || SelectedPlatforms[i] == 0) { List <SoftUser> users = null; if (!SuperPeriod) { users = Sjqd_StatUsersService.GetInstance().GetSoftUserListCache(BeginTime, EndTime, SingleSoftInfo.ID, (int)SelectedPlatforms[i], Period, loginService, CacheTimeOption.TenMinutes).OrderBy(p => p.StatDate).ToList(); } else { //users = StatUsersByHourService.GetInstance().GetHourUserDataCache(SingleSoftInfo.ID, (int)SelectedPlatforms[i], BeginTime, EndTime, Period, loginService,CacheTimeOption.TenMinutes).OrderBy(p => p.StatDate).ToList(); net91com.Reports.Services.CommonServices.SjqdUserStat.StatUsersService suService = new net91com.Reports.Services.CommonServices.SjqdUserStat.StatUsersService(); List <net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers> ssUsers; ssUsers = suService.GetStatUsersByHour(SingleSoftInfo.ID, (int)SelectedPlatforms[i], ChannelTypeOptions.Category, 0, (int)Period, BeginTime, EndTime); users = new List <SoftUser>(); foreach (net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers u in ssUsers) { SoftUser softuser = new SoftUser(); softuser.StatDate = u.StatDate; softuser.SoftId = SingleSoftInfo.ID; softuser.Platform = (int)SelectedPlatforms[i]; softuser.ActiveNum = u.ActiveUserCount - u.NewUserCount; softuser.Hour = u.StatHour; softuser.NewNum = u.NewUserCount; softuser.UseNum = u.ActiveUserCount; users.Add(softuser); } users = users.OrderBy(p => p.StatDate).ToList(); } if (users != null && users.Count != 0) { ListAll.Add(users); RealSoftLine.Add((int)SelectedPlatforms[i]); } //获取对比曲线 if (HeadControl1.CompareTimeType > 0) { List <SoftUser> usersCompare = null; if (!SuperPeriod) { usersCompare = Sjqd_StatUsersService.GetInstance().GetSoftUserListCache(BeginCompareTime, EndCompareTime, SingleSoftInfo.ID, (int)SelectedPlatforms[i], Period, loginService, CacheTimeOption.TenMinutes).OrderBy(p => p.StatDate).ToList(); } else { //usersCompare = StatUsersByHourService.GetInstance().GetHourUserDataCache(SingleSoftInfo.ID, (int)SelectedPlatforms[i], BeginCompareTime, EndCompareTime, Period, loginService,CacheTimeOption.TenMinutes).OrderBy(p => p.StatDate).ToList(); net91com.Reports.Services.CommonServices.SjqdUserStat.StatUsersService suService = new net91com.Reports.Services.CommonServices.SjqdUserStat.StatUsersService(); List <net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers> ssUsers; ssUsers = suService.GetStatUsersByHour(SingleSoftInfo.ID, (int)SelectedPlatforms[i], ChannelTypeOptions.Category, 0, (int)Period, BeginCompareTime, EndCompareTime); usersCompare = new List <SoftUser>(); foreach (net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers u in ssUsers) { SoftUser softuser = new SoftUser(); softuser.StatDate = u.StatDate; softuser.SoftId = SingleSoftInfo.ID; softuser.Platform = (int)SelectedPlatforms[i]; softuser.ActiveNum = u.ActiveUserCount - u.NewUserCount; softuser.Hour = u.StatHour; softuser.NewNum = u.NewUserCount; softuser.UseNum = u.ActiveUserCount; usersCompare.Add(softuser); } usersCompare = usersCompare.OrderBy(p => p.StatDate).ToList(); } if (usersCompare != null && usersCompare.Count != 0) { ListAllForCompare.Add(usersCompare); } } break; } } } } HeadControl1.Channel1.SelectedText = "选择渠道"; HeadControl1.Channel1.SelectedValue = ""; } //一条线数据都没有 if (ListAll.Count == 0) { return; } //生成所有的Table GetAllTableHtml(); //生成所有曲线的JSON GetAllLineJson(); }
/// <summary> /// 获取数据加上绑定数据 /// </summary> protected void BindData() { ///进入分渠道统计 if (HeadControl1.Channel1.ChannelValues.Count != 0) { var channels = HeadControl1.Channel1.ChannelValues; QuDao = true; if (Period == net91com.Stat.Core.PeriodOptions.TimeOfDay || Period == net91com.Stat.Core.PeriodOptions.Hours) { for (int i = 0; i < channels.Count; i++) { //List<SoftUser> users = // Sjqd_StatUsersByChannelsService.GetInstance().GetChannelUsersByHoursDataCache( // BeginTime, EndTime, SelectedSofts[0].ID, channels[i].Platform, Period, // channels[i].ChannelType, Convert.ToInt32(channels[i].ChannelValue), // channels[i].ChannelText, loginService,CacheTimeOption.TenMinutes) // .OrderBy(p => p.StatDate) // .ToList(); net91com.Reports.Services.CommonServices.SjqdUserStat.StatUsersService suService = new net91com.Reports.Services.CommonServices.SjqdUserStat.StatUsersService(); List <net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers> ssUsers; ssUsers = suService.GetStatUsersByHour(SelectedSofts[0].ID, channels[i].Platform, channels[i].ChannelType, Convert.ToInt32(channels[i].ChannelValue), (int)Period, BeginTime, EndTime); List <SoftUser> users = new List <SoftUser>(); foreach (net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers u in ssUsers) { SoftUser softuser = new SoftUser(); softuser.StatDate = u.StatDate; softuser.SoftId = SelectedSofts[0].ID; softuser.Platform = channels[i].Platform; softuser.ActiveNum = u.ActiveUserCount - u.NewUserCount; softuser.Hour = u.StatHour; softuser.NewNum = u.NewUserCount; softuser.UseNum = u.ActiveUserCount; users.Add(softuser); } users = users.OrderBy(p => p.StatDate).ToList(); if (users.Count != 0) { ListAll.Add(users); //添加里程碑列表集(若ListAll添加了,里程碑也要添加) //mileStoneDate.Add(Sjqd_MileStoneConfigService.GetInstance() // .GetMileStoneDatesByCache(SelectedSofts[0].ID, // channels[i].Platform, // BeginTime, EndTime)); QuDaoList.Add(i); } //获取对比曲线 if (HeadControl1.CompareTimeType > 0) { //List<SoftUser> usersCompare = // Sjqd_StatUsersByChannelsService.GetInstance().GetChannelUsersByHoursDataCache( // BeginCompareTime, EndCompareTime, SelectedSofts[0].ID, channels[i].Platform, Period, // channels[i].ChannelType, Convert.ToInt32(channels[i].ChannelValue), // channels[i].ChannelText, loginService,CacheTimeOption.TenMinutes) // .OrderBy(p => p.StatDate) // .ToList(); List <net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers> ssUsersComp; ssUsersComp = suService.GetStatUsersByHour(SelectedSofts[0].ID, channels[i].Platform, channels[i].ChannelType, Convert.ToInt32(channels[i].ChannelValue), (int)Period, BeginCompareTime, EndCompareTime); List <SoftUser> usersCompare = new List <SoftUser>(); foreach (net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers u in ssUsersComp) { SoftUser softuser = new SoftUser(); softuser.StatDate = u.StatDate; softuser.SoftId = SelectedSofts[0].ID; softuser.Platform = channels[i].Platform; softuser.ActiveNum = u.ActiveUserCount - u.NewUserCount; softuser.Hour = u.StatHour; softuser.NewNum = u.NewUserCount; softuser.UseNum = u.ActiveUserCount; usersCompare.Add(softuser); } usersCompare = usersCompare.OrderBy(p => p.StatDate).ToList(); if (usersCompare != null && usersCompare.Count != 0) { ListAllForCompare.Add(usersCompare); } } } } else { for (int i = 0; i < channels.Count; i++) { List <SoftUser> users = Sjqd_StatUsersByChannelsService.GetInstance() .GetSoftUserChanelListCache(BeginTime, EndTime, SelectedSofts[0].ID, channels[i].Platform, Period, channels[i].ChannelType, Convert.ToInt32( channels[i].ChannelValue), channels[i].ChannelText, false, loginService, CacheTimeOption.TenMinutes) .OrderBy(p => p.StatDate) .ToList(); if (users != null && users.Count != 0) { ListAll.Add(users); ////添加里程碑列表集(若ListAll添加了,里程碑也要添加) //mileStoneDate.Add(Sjqd_MileStoneConfigService.GetInstance() // .GetMileStoneDatesByCache(SelectedSofts[0].ID, channels[i].Platform, BeginTime, EndTime)); QuDaoList.Add(i); //if (Period == net91com.Stat.Core.PeriodOptions.Daily) //{ // ForecastSoftUser softUser = // Sjqd_StatUsersByChannelsService.GetInstance() // .GetStatUsersForRealTime(SelectedSofts[0].ID, // channels[i].Platform, // channels[i].ChannelType, // Convert.ToInt32( // channels[i].ChannelValue), // loginService, // CacheTimeOption.TenMinutes); // if (softUser != null) // ForeCastUserDatas.Add(softUser); //} } //获取对比曲线 if (HeadControl1.CompareTimeType > 0) { List <SoftUser> usersCompare = Sjqd_StatUsersByChannelsService.GetInstance() .GetSoftUserChanelListCache(BeginCompareTime, EndCompareTime, SelectedSofts[0].ID, channels[i].Platform, Period, channels[i].ChannelType, Convert.ToInt32(channels[i].ChannelValue), channels[i].ChannelText, false, loginService, CacheTimeOption.TenMinutes) .OrderBy(p => p.StatDate) .ToList(); if (usersCompare != null && usersCompare.Count != 0) { ListAllForCompare.Add(usersCompare); } } } } } else { //选择所筛选的所有软件 for (int softid = 0; softid < SelectedSofts.Count; softid++) { for (int i = 0; i < SelectedPlatforms.Count; i++) { foreach (MobileOption tempplat in SelectedSofts[softid].Platforms) { //他选出的平台加上和自己支持平台的交集 if (tempplat == SelectedPlatforms[i] || SelectedPlatforms[i] == 0) { List <SoftUser> users = null; if (Period != net91com.Stat.Core.PeriodOptions.TimeOfDay && Period != net91com.Stat.Core.PeriodOptions.Hours) { users = Sjqd_StatUsersService.GetInstance() .GetSoftUserListCache(BeginTime, EndTime, SelectedSofts[softid].ID, (int)SelectedPlatforms[i], Period, loginService, CacheTimeOption.TenMinutes) .OrderBy(p => p.StatDate) .ToList(); if (Period == net91com.Stat.Core.PeriodOptions.Daily) { //ForecastSoftUser softUser = // Sjqd_StatUsersService.GetInstance() // .GetStatUsersForRealTime(SelectedSofts[softid].ID, // (int)SelectedPlatforms[i], // loginService, // CacheTimeOption.TenMinutes); //if (softUser != null) // ForeCastUserDatas.Add(softUser); //else ForeCastUserDatas.AddRange( Sjqd_StatUsersService.GetInstance() .GetForecastSoftUserCache( SelectedSofts[softid].ID, (int)SelectedPlatforms[i], Period, loginService, CacheTimeOption.TenMinutes)); } else { //获取计算预测数据 ForeCastUserDatas.AddRange( Sjqd_StatUsersService.GetInstance() .GetForecastSoftUserCache(SelectedSofts[softid].ID, (int)SelectedPlatforms[i], Period, loginService, CacheTimeOption .TenMinutes)); } } else { //users = // StatUsersByHourService.GetInstance() // .GetHourUserDataCache(SelectedSofts[softid].ID, // (int) SelectedPlatforms[i], // BeginTime, EndTime, Period, // loginService, // CacheTimeOption.TenMinutes) // .OrderBy(p => p.StatDate) // .ToList(); net91com.Reports.Services.CommonServices.SjqdUserStat.StatUsersService suService = new net91com.Reports.Services.CommonServices.SjqdUserStat.StatUsersService(); List <net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers> ssUsers; ssUsers = suService.GetStatUsersByHour(SelectedSofts[softid].ID, (int)SelectedPlatforms[i], ChannelTypeOptions.Category, 0, (int)Period, BeginTime, EndTime); users = new List <SoftUser>(); foreach (net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers u in ssUsers) { SoftUser softuser = new SoftUser(); softuser.StatDate = u.StatDate; softuser.SoftId = SelectedSofts[softid].ID; softuser.Platform = (int)SelectedPlatforms[i]; softuser.ActiveNum = u.ActiveUserCount - u.NewUserCount; softuser.Hour = u.StatHour; softuser.NewNum = u.NewUserCount; softuser.UseNum = u.ActiveUserCount; users.Add(softuser); } users = users.OrderBy(p => p.StatDate).ToList(); } if (users != null && users.Count != 0) { ListAll.Add(users); //添加里程碑列表集(若ListAll添加了,里程碑也要添加) //mileStoneDate.Add(Sjqd_MileStoneConfigService.GetInstance() // .GetMileStoneDatesByCache( // SelectedSofts[softid].ID, // (int)SelectedPlatforms[i], // BeginTime, EndTime)); RealSoftLine.Add((int)SelectedPlatforms[i]); } //获取对比曲线 if (HeadControl1.CompareTimeType > 0) { List <SoftUser> usersCompare = null; if (Period != net91com.Stat.Core.PeriodOptions.TimeOfDay && Period != net91com.Stat.Core.PeriodOptions.Hours) { usersCompare = Sjqd_StatUsersService.GetInstance() .GetSoftUserListCache(BeginCompareTime, EndCompareTime, SelectedSofts[softid].ID, (int)SelectedPlatforms[i], Period, loginService, CacheTimeOption.TenMinutes) .OrderBy(p => p.StatDate) .ToList(); } else { //usersCompare = // StatUsersByHourService.GetInstance() // .GetHourUserDataCache(SelectedSofts[softid].ID, // (int)SelectedPlatforms[i], // BeginCompareTime, EndCompareTime, // Period, loginService, // CacheTimeOption.TenMinutes) // .OrderBy(p => p.StatDate) // .ToList(); net91com.Reports.Services.CommonServices.SjqdUserStat.StatUsersService suService = new net91com.Reports.Services.CommonServices.SjqdUserStat.StatUsersService(); List <net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers> ssUsers; ssUsers = suService.GetStatUsersByHour(SelectedSofts[softid].ID, (int)SelectedPlatforms[i], ChannelTypeOptions.Category, 0, (int)Period, BeginCompareTime, EndCompareTime); usersCompare = new List <SoftUser>(); foreach (net91com.Reports.Entities.DataBaseEntity.Sjqd_StatUsers u in ssUsers) { SoftUser softuser = new SoftUser(); softuser.StatDate = u.StatDate; softuser.SoftId = SelectedSofts[softid].ID; softuser.Platform = (int)SelectedPlatforms[i]; softuser.ActiveNum = u.ActiveUserCount - u.NewUserCount; softuser.Hour = u.StatHour; softuser.NewNum = u.NewUserCount; softuser.UseNum = u.ActiveUserCount; usersCompare.Add(softuser); } usersCompare = usersCompare.OrderBy(p => p.StatDate).ToList(); } if (usersCompare != null && usersCompare.Count != 0) { ListAllForCompare.Add(usersCompare); } } break; } } } } } if (ListAll.Count == 0) { return; } //生成所有曲线的JSON GetAllLineJson(); //生成Table的HTML GetAllTableHtml(); }