コード例 #1
0
        private void ExportReport()
        {
            // build HTML
            DataTable dtRecords = new ReportsHelper().GetPackagesBandwidthPaged(PanelSecurity.PackageId,
                                                                                Int32.MaxValue, 0, "", litStartDate.Text, litEndDate.Text);

            StringBuilder sb = new StringBuilder();

            sb.Append("<html>");
            sb.Append("<head>");
            sb.Append("<title>Bandwidth Report for ").Append(litPeriod.Text).Append("</title>");
            sb.Append("</head>");
            sb.Append("<body><table border=\"1\">");

            sb.Append("<tr>");
            sb.Append("<th>Hosting Space</th>");
            sb.Append("<th>Allocated, MB</th>");
            sb.Append("<th>Used, MB</th>");
            sb.Append("<th>Usage, %</th>");
            sb.Append("<th>Username</th>");
            sb.Append("<th>User E-mail</th>");
            sb.Append("</tr>");

            foreach (DataRow dr in dtRecords.Rows)
            {
                sb.Append("<tr>");
                sb.Append("<td>").Append(dr["PackageName"]).Append("</td>");
                sb.Append("<td>").Append(dr["QuotaValue"]).Append("</td>");
                sb.Append("<td>").Append(dr["Bandwidth"]).Append("</td>");
                sb.Append("<td>").Append(dr["UsagePercentage"]).Append("</td>");
                sb.Append("<td>").Append(dr["Username"]).Append("</td>");
                sb.Append("<td>").Append(dr["Email"]).Append("</td>");
                sb.Append("</tr>");
            }

            sb.Append("</table></body>");
            sb.Append("</html>");

            string fileName = "BandwidthReport-" + litPeriod.Text.Replace(" ", "").Replace("/", "-") + ".htm";

            Response.Clear();
            Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName);
            Response.ContentType = "application/octet-stream";

            Response.Write(AntiXss.HtmlEncode(sb.ToString()));

            Response.End();
        }
コード例 #2
0
        private void ExportReport()
        {
            // build HTML
            DataTable dtRecords = new ReportsHelper().GetPackagesDiskspacePaged(PanelSecurity.PackageId,
                Int32.MaxValue, 0, "");

            StringBuilder sb = new StringBuilder();
            sb.Append("<html>");
            sb.Append("<head>");
            sb.Append("<title>Disk Space Report").Append("</title>");
            sb.Append("</head>");
            sb.Append("<body><table border=\"1\">");

            sb.Append("<tr>");
            sb.Append("<th>Hosting Space</th>");
            sb.Append("<th>Allocated, MB</th>");
            sb.Append("<th>Used, MB</th>");
            sb.Append("<th>Usage, %</th>");
            sb.Append("<th>Username</th>");
            sb.Append("<th>User E-mail</th>");
            sb.Append("</tr>");

            foreach (DataRow dr in dtRecords.Rows)
            {
                sb.Append("<tr>");
                sb.Append("<td>").Append(dr["PackageName"]).Append("</td>");
                sb.Append("<td>").Append(dr["QuotaValue"]).Append("</td>");
                sb.Append("<td>").Append(dr["Diskspace"]).Append("</td>");
                sb.Append("<td>").Append(dr["UsagePercentage"]).Append("</td>");
                sb.Append("<td>").Append(dr["Username"]).Append("</td>");
                sb.Append("<td>").Append(dr["Email"]).Append("</td>");
                sb.Append("</tr>");
            }

            sb.Append("</table></body>");
            sb.Append("</html>");

            string fileName = "DiskspaceReport.htm";

            Response.Clear();
            Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName);
            Response.ContentType = "application/octet-stream";

            Response.Write(AntiXss.HtmlEncode(sb.ToString()));

            Response.End();
        }
コード例 #3
0
        private void ExportReport()
        {
            // build HTML
            DataTable dtRecords = new ReportsHelper().GetPackagesDiskspacePaged(-1, Int32.MaxValue, 0, "");

            StringBuilder sb = new StringBuilder();

            sb.Append("<html>");
            sb.Append("<head>");
            sb.Append("<title>Disk Space Report").Append("</title>");
            sb.Append("</head>");
            sb.Append("<body><table border=\"1\">");

            sb.Append("<tr>");
            sb.Append("<th>Hosting Space</th>");
            sb.Append("<th>Allocated, MB</th>");
            sb.Append("<th>Used, MB</th>");
            sb.Append("<th>Usage, %</th>");
            sb.Append("<th>Username</th>");
            sb.Append("<th>User E-mail</th>");
            sb.Append("</tr>");

            foreach (DataRow dr in dtRecords.Rows)
            {
                sb.Append("<tr>");
                sb.Append("<td>").Append(dr["PackageName"]).Append("</td>");
                sb.Append("<td>").Append(dr["QuotaValue"]).Append("</td>");
                sb.Append("<td>").Append(dr["Diskspace"]).Append("</td>");
                sb.Append("<td>").Append(dr["UsagePercentage"]).Append("</td>");
                sb.Append("<td>").Append(dr["Username"]).Append("</td>");
                sb.Append("<td>").Append(dr["Email"]).Append("</td>");
                sb.Append("</tr>");
            }

            sb.Append("</table></body>");
            sb.Append("</html>");

            string fileName = "DiskspaceReport.htm";

            Response.Clear();
            Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName);
            Response.ContentType = "application/octet-stream";

            Response.Write(sb.ToString());

            Response.End();
        }
コード例 #4
0
        private void ExportReport()
        {
            // build HTML
            DataTable dtRecords = new ReportsHelper().GetPackagesBandwidthPaged(-1, Int32.MaxValue, 0, "", litStartDate.Text, litEndDate.Text);

            StringBuilder sb = new StringBuilder();
            sb.Append("<html>");
            sb.Append("<head>");
            sb.Append("<title>Bandwidth Report for ").Append(litPeriod.Text).Append("</title>");
            sb.Append("</head>");
            sb.Append("<body><table border=\"1\">");

            sb.Append("<tr>");
            sb.Append("<th>Hosting Space</th>");
            sb.Append("<th>Allocated, MB</th>");
            sb.Append("<th>Used, MB</th>");
            sb.Append("<th>Usage, %</th>");
            sb.Append("<th>Username</th>");
            sb.Append("<th>User E-mail</th>");
            sb.Append("</tr>");

            foreach (DataRow dr in dtRecords.Rows)
            {
                sb.Append("<tr>");
                sb.Append("<td>").Append(dr["PackageName"]).Append("</td>");
                sb.Append("<td>").Append(dr["QuotaValue"]).Append("</td>");
                sb.Append("<td>").Append(dr["Bandwidth"]).Append("</td>");
                sb.Append("<td>").Append(dr["UsagePercentage"]).Append("</td>");
                sb.Append("<td>").Append(dr["Username"]).Append("</td>");
                sb.Append("<td>").Append(dr["Email"]).Append("</td>");
                sb.Append("</tr>");
            }

            sb.Append("</table></body>");
            sb.Append("</html>");

            string fileName = "BandwidthReport-" + litPeriod.Text.Replace(" ", "").Replace("/", "-") + ".htm";

            Response.Clear();
            Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName);
            Response.ContentType = "application/octet-stream";

            Response.Write(sb.ToString());

            Response.End();
        }