/// <summary> /// 形成每一个tab /// </summary> /// <param name="users"></param> /// <param name="tableindex"></param> /// <returns></returns> protected string GetOneTableHtml(List <SoftUser> users, int tableindex) { users = users.OrderByDescending(p => p.StatDate).ToList(); var channels = HeadControl1.Channel1.ChannelValues; string tableName = string.Empty; if (QuDao) { tableName = users[0].SoftId + "_" + users[0].Platform + "_" + (int)Period + "_" + BeginTime.ToShortDateString() + "_" + EndTime.ToShortDateString() + "_" + channels[QuDaoList[tableindex]].ChannelValue + "_" + (int)channels[QuDaoList[tableindex]].ChannelType + "_" + (HeadControl1.isChecked ? 1 : 0); } else { tableName = users[0].SoftId + "_" + users[0].Platform + "_" + (int)Period + "_" + BeginTime.ToShortDateString() + "_" + EndTime.ToShortDateString() + "_" + "-1" + "_" + "-1" + "_" + (HeadControl1.isChecked ? 1 : 0); } StringBuilder sb; if (tableindex == 0) { sb = new StringBuilder(string.Format("<table id=\"tab{0}\" name=\"" + tableName + "\" class=\" tablesorter \" cellspacing=\"1\">", tableindex)); } else { sb = new StringBuilder(string.Format("<table id=\"tab{0}\" name=\"" + tableName + "\" class=\" tablesorter \" style=\"display:none\" cellspacing=\"1\">", tableindex)); } //是否是内部软件 bool isInternalSoft = AvailableSofts.FirstOrDefault(a => a.SoftType == SoftTypeOptions.InternalSoft && a.ID == users[0].SoftId) != null; return(TableTemplateHelper.BuildStatUsersTable(users[0].SoftId, (MobileOption)users[0].Platform, isInternalSoft, QuDao, Period, "active", HeadControl1.isChecked, users, false, tableindex, tableName)); }
/// <summary> /// 活跃用户留存率数据EXCEL文件下载 /// </summary> /// <param name="softId"></param> /// <param name="platform"></param> /// <param name="startDate"></param> /// <param name="endDate"></param> /// <param name="channelIds"></param> /// <param name="channelTypes"></param> /// <param name="channelTexts"></param> private void GetStatRetainedActiveUsers(int softId, int platform, DateTime startDate, DateTime endDate, int[] channelIds, ChannelTypeOptions[] channelTypes, string[] channelTexts) { //权限验证 CheckHasRight(softId, "Reports/StatRetainedActiveUsers.aspx"); if (channelIds.Length == 1) { string fileName = string.Format("活跃用户留存率{0}.xls", channelIds[0] > 0 ? "(" + channelTexts[0] + ")" : string.Empty); AddHead(fileName); List <Sjqd_StatRetainedUsers> users = new StatUsersService().GetStatRetainedActiveUsers(softId, platform, channelIds[0], channelTypes[0], startDate, endDate); ThisResponse.Write(TableTemplateHelper.BuildStatRetainedUsersTable((int)net91com.Stat.Core.PeriodOptions.Daily, users, true, string.Empty, true)); } }
/// <summary> /// 活跃用户留存率分地区数据EXCEL文件下载 /// </summary> /// <param name="softId"></param> /// <param name="platform"></param> /// <param name="startDate"></param> /// <param name="endDate"></param> /// <param name="channelIds"></param> /// <param name="channelTypes"></param> /// <param name="channelTexts"></param> private void GetStatRetainedActiveUsersByArea(int softId, int platform, DateTime startDate, DateTime endDate, int[] channelIds, ChannelTypeOptions[] channelTypes, string[] channelTexts) { //权限验证 CheckHasRight(softId, "Reports/StatRetainedActiveUsersByArea.aspx"); //地区ID string[] areaIds = string.IsNullOrEmpty(ThisRequest["AreaIds"]) ? new string[0] : ThisRequest["AreaIds"].Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).ToArray(); string[] areaNames = string.IsNullOrEmpty(ThisRequest["AreaNames"]) ? new string[0] : ThisRequest["AreaNames"].Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).ToArray(); if (areaIds.Length == 1 && areaIds.Length == areaNames.Length && channelIds.Length == 1) { string fileName = string.Format("活跃用户留存率({0}{1}).xls", channelIds[0] > 0 ? channelTexts[0] + "-" : string.Empty, areaNames[0]); AddHead(fileName); List <Sjqd_StatRetainedUsers> users = new StatUsersService().GetStatRetainedActiveUsersByArea(softId, platform, areaIds[0], channelIds[0], channelTypes[0], startDate, endDate); ThisResponse.Write(TableTemplateHelper.BuildStatRetainedUsersTable((int)net91com.Stat.Core.PeriodOptions.Daily, users, true, string.Empty, true)); } }
/// <summary> /// 新增用户留存率分版本数据EXCEL文件下载 /// </summary> /// <param name="softId"></param> /// <param name="platform"></param> /// <param name="period"></param> /// <param name="startDate"></param> /// <param name="endDate"></param> /// <param name="channelIds"></param> /// <param name="channelTypes"></param> /// <param name="channelTexts"></param> private void GetStatRetainedUsersByVersion(int softId, int platform, int period, DateTime startDate, DateTime endDate, int[] channelIds, ChannelTypeOptions[] channelTypes, string[] channelTexts) { //权限验证 CheckHasRight(softId, "Reports/StatRetainedUsersByVersion.aspx"); //版本ID string[] versionIds = string.IsNullOrEmpty(ThisRequest["VersionIds"]) ? new string[0] : ThisRequest["VersionIds"].Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).ToArray(); string[] versionNames = string.IsNullOrEmpty(ThisRequest["VersionNames"]) ? new string[0] : ThisRequest["VersionNames"].Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).ToArray(); if (versionIds.Length == 1 && versionIds.Length == versionNames.Length && channelIds.Length == 1) { string fileName = string.Format("新增用户留存率({0}{1}).xls", channelIds[0] > 0 ? channelTexts[0] + "-" : string.Empty, versionNames[0]); AddHead(fileName); List <Sjqd_StatRetainedUsers> users = new StatUsersService().GetStatRetainedUsersByVersion(softId, platform, versionIds[0], channelIds[0], channelTypes[0], period, startDate, endDate); ThisResponse.Write(TableTemplateHelper.BuildStatRetainedUsersTable(period, users, true, string.Empty)); } }
/// <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; } StatUsersService suService = new StatUsersService(); List <net91com.Reports.Entities.DataBaseEntity.Sjqd_StatRetainedUsers> users = suService.GetStatRetainedUsersByVersion(SoftID, PlatformID, HeadControl1.VersionID, channelId, channelType, (int)Period, BeginTime, EndTime); ExcelDownUrl = string.Format("/Services/ExcelDownloader.ashx?Action=GetStatRetainedUsersByVersion&SoftID={0}&Platform={1}&Period={2}&StartDate={3:yyyy-MM-dd}&EndDate={4:yyyy-MM-dd}&VersionIds={5}&VersionNames={6}&ChannelIds={7}&ChannelTypes={8}&ChannelTexts={9}&v={10}", SoftID, PlatformID, (int)Period, BeginTime, EndTime, HeadControl1.VersionID, HeadControl1.VersionID, HeadControl1.Channel1.SelectedValue, HeadControl1.Channel1.SelectedCate, HttpUtility.UrlEncode(HeadControl1.Channel1.SelectedText), DateTime.Now.Ticks); SeriesJsonStr = LineChartHelper.BuildStatRetainedUsersLine(users, Period, BeginTime, EndTime, out AxisJsonStr); TablesHtml = TableTemplateHelper.BuildStatRetainedUsersTable((int)Period, users, false, string.Empty); }
/// <summary> /// 形成每一个tab /// </summary> /// <param name="orderUsers"></param> /// <param name="tableindex"></param> /// <returns></returns> protected string GetOneTableHtml(List <SoftUser> users, int tableindex) { List <SoftUser> orderUsers = users.OrderByDescending(p => p.StatDate).ToList(); var channels = HeadControl1.Channel1.ChannelValues; string tableName = string.Empty; if (QuDao) { tableName = orderUsers[0].SoftId + "_" + orderUsers[0].Platform + "_" + (int)Period + "_" + BeginTime.ToShortDateString() + "_" + EndTime.ToShortDateString() + "_" + channels[QuDaoList[tableindex]].ChannelValue + "_" + (int)channels[QuDaoList[tableindex]].ChannelType; } else { tableName = orderUsers[0].SoftId + "_" + orderUsers[0].Platform + "_" + (int)Period + "_" + BeginTime.ToShortDateString() + "_" + EndTime.ToShortDateString() + "_" + "-1" + "_" + "-1"; } //是否是内部软件 bool isInternalSoft = SelectedSofts.FirstOrDefault(a => a.SoftType == SoftTypeOptions.InternalSoft && a.ID == orderUsers[0].SoftId) != null; return(TableTemplateHelper.BuildStatUsersTable(orderUsers[0].SoftId, (MobileOption)orderUsers[0].Platform, isInternalSoft, QuDao, Period, "new", false, orderUsers, false, tableindex, tableName)); }
/// <summary> /// 形成每一个tab /// </summary> /// <param name="users"></param> /// <param name="tableindex"></param> /// <returns></returns> protected string GetTableString(List <SoftUser> users, int tableindex) { users = users.OrderByDescending(p => p.StatDate).ToList(); string tableName = string.Empty; //没有选择渠道 if (HeadControl1.Channel1.ChannelValues.Count == 0) { tableName = users[0].SoftId + "_" + users[0].Platform + "_" + (int)Period + "_" + BeginTime.ToShortDateString() + "_" + EndTime.ToShortDateString() + "_" + 0 + "_" + 1 + "_" + (usercate.Value != "11" ? "0" : "1"); } else { var channels = HeadControl1.Channel1.ChannelValues; tableName = users[0].SoftId + "_" + users[0].Platform + "_" + (int)Period + "_" + BeginTime.ToShortDateString() + "_" + EndTime.ToShortDateString() + "_" + channels[QuDaoList[tableindex]].ChannelValue + "_" + (int)channels[QuDaoList[tableindex]].ChannelType + "_" + (usercate.Value != "11" ? "0" : "1"); } return(TableTemplateHelper.BuildStatUsersTable(users[0].SoftId, (MobileOption)users[0].Platform, false, true, Period, "new,active", true, users, false, tableindex, tableName)); }
public void GetExcelNewUser() { try { net91com.Stat.Core.PeriodOptions Period = HttpContext.Current.Request["inputzhouqi"].ToEnum <net91com.Stat.Core.PeriodOptions>(net91com.Stat.Core.PeriodOptions.Daily); DateTime begintime = Convert.ToDateTime(HttpContext.Current.Request["inputtimestart"]); DateTime endtime = Convert.ToDateTime(HttpContext.Current.Request["inputtimeend"]); int excelsoft = Convert.ToInt32(HttpContext.Current.Request["excelsoft"]); int channelcate = Convert.ToInt32(HttpContext.Current.Request["channelcate"]); int channeltype = Convert.ToInt32(HttpContext.Current.Request["channeltype"]); ///检查权限 CheckHasRight(excelsoft, "Reports/NewUserReport.aspx"); int excelplatform = Convert.ToInt32(HttpContext.Current.Request["excelplatform"]); SetStandardTime(Period, begintime, endtime); List <SoftUser> users; if (channelcate == -1) { if (Period != net91com.Stat.Core.PeriodOptions.Hours && Period != net91com.Stat.Core.PeriodOptions.TimeOfDay) { users = Sjqd_StatUsersService.GetInstance().GetSoftUserListCache(begintime, endtime, excelsoft, (int)excelplatform, Period, loginService, CacheTimeOption.TenMinutes).OrderByDescending(p => p.StatDate).ToList(); } else { //users = StatUsersByHourService.GetInstance().GetHourUserDataCache(excelsoft, excelplatform, begintime, endtime, Period, loginService,CacheTimeOption.TenMinutes).OrderByDescending(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(excelsoft, excelplatform, 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 = excelsoft; softuser.Platform = excelplatform; 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(); } } else { if (Period != net91com.Stat.Core.PeriodOptions.Hours && Period != net91com.Stat.Core.PeriodOptions.TimeOfDay) { users = Sjqd_StatUsersByChannelsService.GetInstance().GetSoftUserChanelListCache(begintime, endtime, excelsoft, excelplatform, Period, (ChannelTypeOptions)channeltype, channelcate, "", false, loginService, CacheTimeOption.TenMinutes).OrderBy(p => p.StatDate).ToList(); } else { 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(excelsoft, excelplatform, (ChannelTypeOptions)channeltype, channelcate, (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 = excelsoft; softuser.Platform = excelplatform; 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(); } } HttpResponse resp; resp = HttpContext.Current.Response; resp.ContentEncoding = System.Text.Encoding.GetEncoding("UTF-8"); string filename = "新增用户.xls"; AddHead(filename); //是否是内部软件 bool isInternalSoft = AvailableSofts.FirstOrDefault(a => a.ID == excelsoft) != null; resp.Write(TableTemplateHelper.BuildStatUsersTable(excelsoft, (MobileOption)excelplatform, isInternalSoft, channelcate != -1, Period, "new", false, users, true, 0, "")); resp.End(); } catch (Exception) { HttpContext.Current.Response.Write(""); } }