. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
| Server IP : 87.98.249.37 / Your IP : 216.73.216.208 [ Web Server : Microsoft-IIS/10.0 System : Windows NT NS3076740 10.0 build 17763 (Windows Server 2019) AMD64 User : IWPD_292(growel19p) ( 0) PHP Version : 8.3.12 Disable Function : NONE Domains : 0 Domains MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/Inetpub/vhosts/growel.com/httpdocs/GrowelAdmin/ |
Upload File : |
using GrowelBLL.Services;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace GrowelWeb.GrowelAdmin
{
public partial class View_UnsubscribeLog : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
BindGrid();
}
private void BindGrid()
{
AdminService enquiryService = new AdminService();
DataSet ds = enquiryService.GetUnsubscribLog();
grdData.DataSource = ds;
grdData.DataBind();
}
protected void btnexport_Click(object sender, EventArgs e)
{
StringBuilder htmlTable = new StringBuilder();
htmlTable = Generatedata();
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.Charset = "";
HttpContext.Current.Response.ContentType = "application/msexcel";
HttpContext.Current.Response.AddHeader("Content-Disposition", "filename=SearchLog.xls");
HttpContext.Current.Response.Write(htmlTable);
HttpContext.Current.Response.End();
HttpContext.Current.Response.Flush();
}
private StringBuilder WriteTitle(string reportTitle)
{
StringBuilder htmlContent;
htmlContent = new StringBuilder();
string newline = "\n";
string ReportFont = "Verdana";
htmlContent.Append("<HTML><HEAD><TITLE>Report - " + reportTitle + "</TITLE></HEAD>" + newline);
htmlContent.Append("<STYLE>" + newline);
htmlContent.Append(" body {font-family: Verdana; font-size:9pt} " + newline);
htmlContent.Append(" .TableStyle { border-collapse: collapse } " + newline);
htmlContent.Append(" .TitleStyle { font-family: " + ReportFont + "; font-size:15pt } " + newline);
htmlContent.Append(" .SectionHeader {font-family: " + ReportFont + "; font-size:10pt } " + newline);
htmlContent.Append(" .DetailHeader {font-family: " + ReportFont + "; font-size:9pt } " + newline);
htmlContent.Append(" .DetailData {font-family: Verdana; font-size:8pt ; padding-left:10px; } " + newline);
htmlContent.Append(" .DetailData6 {font-family: Verdana; font-size:6pt ; padding-left:10px; } " + newline);
htmlContent.Append(" .DetailData7 {font-family: Verdana; font-size:7pt ; padding-left:10px; } " + newline);
htmlContent.Append(" .DetailData10 {font-family: Verdana; font-size:10pt; padding-left:10px; } " + newline);
htmlContent.Append(" .DetailFields {font-family: Verdana; font-size:10pt; font-weight:bold ; padding-left:10px; } " + newline);
htmlContent.Append(" .DetailFieldsHeader {font-family: Verdana; font-size:11pt; padding-left:10px; } " + newline);
htmlContent.Append(" .DetailHeader1 {font-family: Verdana; font-size:11pt ; padding-left:10px; } " + newline);
htmlContent.Append(" .DetailHeader2 {font-family: Verdana; font-size:9pt ; padding-left:10px; } " + newline);
htmlContent.Append(" .DetailFieldsbig {font-family: Verdana; font-size:11pt; font-weight:bold ; padding-left:10px; } " + newline);
htmlContent.Append(" .DetailDatasmall {font-family: Verdana; font-size:6pt ; padding-left:5px; } " + newline);
htmlContent.Append(" .ColumnHeaderStyle {bgcolor='#FF0000' ; font-family: " + ReportFont + "; font-size:9pt; border-style:outset; border-width:1} " + newline);
htmlContent.Append(" .page {width: 210mm; min-height: 148.5mm; padding: 0.5cm; margin: 0.5cm auto;border: 1px #D3D3D3 solid; border-radius: 5px; background: white;box-shadow: 0 0 5px rgba(0, 0, 0, 0.1); }" + newline);
htmlContent.Append(" @page { size: A5; margin: 0; } " + newline);
htmlContent.Append(" @media print { " + newline);
htmlContent.Append(" table { page -break-inside : avoid }");
htmlContent.Append(" .page { margin: 0; margin-top: 1cm; margin-bottom: 2.5cm; border: initial; border-radius: initial; width: initial; min-height: initial; box-shadow: initial; background: initial; page-break-after: always;" + newline);
htmlContent.Append(" } }" + newline);
htmlContent.Append("</STYLE>" + newline);
//htmlContent.Append("<BODY TOPMARGIN=0 LEFTMARGIN=0 RIGHTMARGIN=0 BOTTOMMARGIN=0>" + newline);
//htmlContent.Append("<div class='page'><TABLE Width='100%' style='FILTER: progid:DXImageTransform.Microsoft.Gradient(gradientType=1,startColorStr=#a9d4ff,endColorStr=#ffffff)' Cellpadding=5>");
//htmlContent.Append("<TR height='180px'><TD ALIGN='Center' >");
//htmlContent.Append("</TD></TR>" + newline);
// Tax INvoice Writing
//htmlContent.Append("<TR><TD ALIGN='Center' >");
//htmlContent.Append("<font face='" + ReportFont + "' size=3><b>TAX INVOICE</b></font>");
//htmlContent.Append("</TD></TR></TABLE>" + newline);
return htmlContent;
}
private StringBuilder Generatedata()
{
StringBuilder htmlContent;
htmlContent = WriteTitle("Ledger Book");
htmlContent.Append("<BODY TOPMARGIN=15px LEFTMARGIN=0 RIGHTMARGIN=0 BOTTOMMARGIN=15px>");
htmlContent.Append(
"<div class='page'><TABLE Width='100%' style='FILTER: progid:DXImageTransform.Microsoft.Gradient(gradientType=1,startColorStr=#a9d4ff,endColorStr=#ffffff)' Cellpadding=5>");
AdminService enquiryService = new AdminService();
DataSet dsXSD = enquiryService.GetUnsubscribLog();
if (dsXSD.Tables[0].Rows.Count > 0) // Changes in >1
{
htmlContent.Append("<TABLE Width='100%' class='TableStyle' cellspacing=0 cellpadding=5 border=0>");
htmlContent.Append("<TR>");
htmlContent.Append("<TD colspan='8' ALIGN='Center' class='ColumnHeaderStyle'><b> Date : " + DateTime.Now.ToString("dd-MMM-yyyy") + "</b></TD>");
htmlContent.Append("</TR>");
htmlContent.Append("<TR>");
htmlContent.Append("<TD bgcolor='#e4e6e6' WIDTH='300px' ALIGN='LEFT' class='ColumnHeaderStyle'><b>Created On</b></TD>");
htmlContent.Append("<TD bgcolor='#e4e6e6' WIDTH='350px' ALIGN='RIGHT' class='ColumnHeaderStyle'><b>EmailId</b></TD>");
htmlContent.Append("</TR>");
foreach (DataRow dr in dsXSD.Tables[0].Rows)
{
htmlContent.Append("<TR>");
htmlContent.Append(
"<TD bgcolor='White' WIDTH='300px' ALIGN='LEFT' VALIGN='top' class='DetailData'>" +
dr["OnDate"] +
"</TD>");
htmlContent.Append("<TD bgcolor='White' WIDTH='350px' align='right' ALIGN='RIGHT' VALIGN='top' class='DetailData'>" + dr["EmailId"] + "</TD>");
htmlContent.Append("</TR>");
}
} // If condition
htmlContent.Append("</TABLE>");
htmlContent.Append("</BODY>");
htmlContent.Append("</HTML>");
return htmlContent;
}
}
}