/// <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> private void GetStatUsersByVersionTransverse(int softId, int platform, int period, DateTime startDate, DateTime endDate, int[] channelIds, ChannelTypeOptions[] channelTypes) { //权限验证 CheckHasRight(softId, "Reports/StatUsersByVersionTransverse.aspx"); AddHead("版本分布.xls"); StatUsersService suService = new StatUsersService(); List <Sjqd_StatUsers> users = suService.GetRankOfVersions(softId, platform, channelIds[0], channelTypes[0], period, ref startDate, ref endDate); users = users.OrderByDescending(a => a.NewUserCount).ToList(); StringBuilder sb = new StringBuilder(); sb.Append("<table border=\"1\">"); sb.Append(@"<thead><tr style=""text-align:center;""><th>排名</th><th>版本</th><th>新增用户</th><th>新增占比</th><th>涨跌量</th><th>活跃用户</th><th>活跃占比</th><th>留存率</th></tr></thead><tbody>"); for (int i = 0; i < users.Count; i++) { sb.AppendFormat(@"<tr style=""text-align:right;""><td>{0}</td><td style=""text-align:left;"">{1}</td><td>{2:N0}</td> <td>{3:0.00}%</td><td>{4:N0}</td><td>{5:N0}</td><td>{6:0.00}%</td><td>{7:0.00}</td></tr>", i + 1 , users[i].Name , users[i].NewUserCount , users[i].NewUserPercent * 100 , users[i].NewUserCount - users[i].LastNewUserCount , users[i].ActiveUserCount , users[i].ActiveUserPercent * 100 , users[i].OriginalNewUserCount > 0 ? (((double)users[i].RetainedUserCount) / users[i].OriginalNewUserCount).ToString("0.00") + "%" : ""); } sb.Append("</tbody></table>"); ThisResponse.Write(sb.ToString()); }