-- mejoras en visualización de correo
This commit is contained in:
@@ -83,54 +83,53 @@ public class TareasReporteDairio : IHttpHandler
|
||||
private string ConvertDataTableToHtml(DataTable table)
|
||||
{
|
||||
StringBuilder html = new StringBuilder();
|
||||
|
||||
|
||||
string ColumnaTitulo = "Titulo";
|
||||
html.Append("<table border='1' style='border-collapse:collapse; width:100%;'>");
|
||||
if(table.Columns[0].ColumnName==ColumnaTitulo && table.Rows.Count > 0) html.AppendFormat(" <caption style='background-color:#333333;'>{0}</caption>", table.Rows[0][ColumnaTitulo]);
|
||||
|
||||
|
||||
html.Append("<thead><tr>");
|
||||
html.Append("<thead style='background-color:#DDD; padding: 0px;'><tr>");
|
||||
foreach (DataColumn column in table.Columns)
|
||||
{
|
||||
html.Append($"<th style='padding:5px; text-align:left;'>{column.ColumnName}</th>");
|
||||
if (ColumnaTitulo != column.ColumnName) html.Append($"<th style='padding:5px; text-align:left;'>{column.ColumnName}</th>");
|
||||
}
|
||||
html.Append("</tr></thead>");
|
||||
|
||||
|
||||
html.Append("<tbody>");
|
||||
foreach (DataRow row in table.Rows)
|
||||
{
|
||||
html.Append("<tr>");
|
||||
foreach (DataColumn column in table.Columns)
|
||||
{
|
||||
object value = row[column];
|
||||
string cellValue;
|
||||
|
||||
|
||||
if (column.DataType == typeof(int) || column.DataType == typeof(decimal) || column.DataType == typeof(double) || column.DataType == typeof(float))
|
||||
if (ColumnaTitulo != column.ColumnName)
|
||||
{
|
||||
if (value != DBNull.Value && decimal.TryParse(value.ToString(), out decimal numericValue))
|
||||
object value = row[column];
|
||||
string cellValue;
|
||||
if (column.DataType == typeof(int) || column.DataType == typeof(decimal) || column.DataType == typeof(double) || column.DataType == typeof(float))
|
||||
{
|
||||
if (numericValue != 0)
|
||||
if (value != DBNull.Value && decimal.TryParse(value.ToString(), out decimal numericValue))
|
||||
{
|
||||
cellValue = numericValue.ToString("N2");
|
||||
if (numericValue != 0)
|
||||
{
|
||||
cellValue = numericValue.ToString("N2");
|
||||
}
|
||||
else
|
||||
{
|
||||
cellValue = "";//0.00
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cellValue = "";//0.00
|
||||
}
|
||||
html.Append($"<td style='padding:5px; text-align:right;'>{cellValue}</td>");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
cellValue = "";//0.00
|
||||
cellValue = value?.ToString() ?? string.Empty;
|
||||
html.Append($"<td style='padding:5px; text-align:left;'>{cellValue}</td>");
|
||||
}
|
||||
html.Append($"<td style='padding:5px; text-align:right;'>{cellValue}</td>");
|
||||
}
|
||||
else
|
||||
{
|
||||
cellValue = value?.ToString() ?? string.Empty;
|
||||
html.Append($"<td style='padding:5px; text-align:left;'>{cellValue}</td>");
|
||||
}
|
||||
|
||||
}
|
||||
html.Append("</tr>");
|
||||
}
|
||||
@@ -180,15 +179,13 @@ public class TareasReporteDairio : IHttpHandler
|
||||
|
||||
private void MandaCorreo(string Cuerpo, bool PrceosoOK)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
List<ClsSisMail.ArchivoMail> ListaArchivos = new List<ClsSisMail.ArchivoMail>();
|
||||
ClsSisMail Correo = new ClsSisMail();
|
||||
//string Para = "julian@adssistemas.mx;rene.molina@adssistemas.mx;oscar.irigoyen@adssistemas.mx";
|
||||
|
||||
string Para = "oscar.irigoyen@adssistemas.mx;rene.molina@adssistemas.mx";
|
||||
string Para = "rene.molina@adssistemas.mx"; // oscar.irigoyen@adssistemas.mx;
|
||||
string Asunto = PrceosoOK ? $"Reporte Diario":"Reporte Diario Error";
|
||||
Asunto = $"{Asunto} {DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss")}";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user