Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Business/Business.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
<Reference Include="EPPlus">
<HintPath>..\packages\EPPlus.4.5.3.3\lib\net40\EPPlus.dll</HintPath>
</Reference>
<Reference Include="HtmlSanitizationLibrary">
<HintPath>..\WebLab\Bin\HtmlSanitizationLibrary.dll</HintPath>
</Reference>
<Reference Include="Iesi.Collections, Version=1.0.0.1, Culture=neutral, PublicKeyToken=154fdcb44c4484fc">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Referencias\Iesi.Collections.dll</HintPath>
Expand Down
68 changes: 53 additions & 15 deletions Business/Utility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
//using Sql.Data

using System.Security.Cryptography;
using Microsoft.Security.Application;
using OfficeOpenXml;
using System.Drawing;
using OfficeOpenXml.Style;
Expand Down Expand Up @@ -890,8 +891,8 @@ public static void ExportDataTableToXlsx(DataTable dataTable, string filename)

HttpResponse response = HttpContext.Current.Response;

// Color finalBackColor = ColorTranslator.FromHtml("#2b3e4c"); //azul-neuquen
// Color fontColor = Color.White
// Color finalBackColor = ColorTranslator.FromHtml("#2b3e4c"); //azul-neuquen
// Color fontColor = Color.White
using (ExcelPackage package = new ExcelPackage())
{
// Crear una nueva hoja de trabajo
Expand Down Expand Up @@ -1005,7 +1006,7 @@ out numero
worksheet.Cells[worksheet.Dimension.Address].AutoFitColumns();

//Todas las celdas
var range2 = worksheet.Cells[1, 1, rowCount+1, colCount]; //row+1 asi cuenta la fila del encabezado.
var range2 = worksheet.Cells[1, 1, rowCount + 1, colCount]; //row+1 asi cuenta la fila del encabezado.
ExcelBordes(range2);
// --- CONFIGURAR RESPUESTA HTTP ---
response.Clear();
Expand All @@ -1024,7 +1025,7 @@ out numero
}

}

private static void ExcelEstilo(ExcelRange range, Color? backColor = null, Color? fontColor = null)
{
Color finalBackColor = backColor ?? Color.Transparent;
Expand Down Expand Up @@ -1053,7 +1054,7 @@ private static void ExcelBordes(ExcelRange rango)

public static void ExportGridViewToExcel(GridView grid, string nombreArchivo)
{
if(grid.Rows.Count > 0)
if (grid.Rows.Count > 0)
{
using (var package = new ExcelPackage())
{
Expand Down Expand Up @@ -1105,7 +1106,7 @@ public static void ExportGridViewToExcel(GridView grid, string nombreArchivo)
fila++;
}
//Todas las celdas
var range2 = ws.Cells[1, 1, grid.Rows.Count + 1, grid.Columns.Count];
var range2 = ws.Cells[1, 1, grid.Rows.Count + 1, grid.Columns.Count];
ExcelBordes(range2);
// Autoajustar columnas
ws.Cells[1, 1, fila - 1, grid.Columns.Count].AutoFitColumns();
Expand All @@ -1114,7 +1115,7 @@ public static void ExportGridViewToExcel(GridView grid, string nombreArchivo)
// 2.2) Escribir filas del footer
// ================================

GridViewRow filaFooter = grid.FooterRow;
GridViewRow filaFooter = grid.FooterRow;
col = 1;

if (tieneValores(filaFooter.Cells))
Expand All @@ -1128,7 +1129,7 @@ public static void ExportGridViewToExcel(GridView grid, string nombreArchivo)
ws.Cells[fila, col].Style.Font.Color.SetColor(fontColor);
col++;
}
ExcelBordes(ws.Cells[grid.Rows.Count + 2,1, grid.Rows.Count + 2,col-1 ]);
ExcelBordes(ws.Cells[grid.Rows.Count + 2, 1, grid.Rows.Count + 2, col - 1]);
}

// ================================
Expand All @@ -1144,9 +1145,9 @@ public static void ExportGridViewToExcel(GridView grid, string nombreArchivo)
response.End();
}
}

}
private static bool tieneValores(TableCellCollection footer)
private static bool tieneValores(TableCellCollection footer)
{

foreach (TableCell cell in footer)
Expand All @@ -1161,7 +1162,7 @@ private static bool tieneValores(TableCellCollection footer)

private static void ExcelCompletarFilas(ExcelWorksheet ws, TableCell cell, int fila, int col, Color? encabezadoColor = null, Color? fontColor = null)
{

// (1) Detectar si es número
// Detectar números por TryParse
double numero;
Expand Down Expand Up @@ -1228,17 +1229,17 @@ out numero
{
ws.Cells[fila, col].Style.Font.Color.SetColor(cell.ForeColor);
}

ws.Cells[fila, col].Style.Font.Size = 9;

}

public static void GenerarColumnasGrid(GridView grid, DataTable dt)
{
if(dt.Columns.Count > 0)
if (dt.Columns.Count > 0)
{
DataColumnCollection dc = dt.Columns;
foreach(DataColumn column in dc)
foreach (DataColumn column in dc)
{
BoundField columna = new BoundField();
columna.HeaderText = column.ColumnName;
Expand All @@ -1247,5 +1248,42 @@ public static void GenerarColumnasGrid(GridView grid, DataTable dt)
}
}
#endregion
#region textoEnriquecido

/// <summary>
/// Sanitiza un texto HTML para eliminar contenido potencialmente peligroso.
/// </summary>
/// <param name="server">
/// Instancia de <see cref="HttpServerUtility"/> utilizada para decodificar el contenido HTML.
/// </param>
/// <param name="texto">
/// Texto HTML recibido desde el cliente.
/// </param>
/// <returns>
/// Devuelve el HTML sanitizado y seguro para almacenar o mostrar.
/// </returns>

public string SanitizarHTML(HttpServerUtility server, string texto)
{
// Leer HTML sin que ASP.NET lo bloquee
string html = server.UrlDecode(texto);
// Sanitizar
string limpio = Sanitizer.GetSafeHtmlFragment(html);
//Despu�s del sanitizado, decodific� entidades HTML:
limpio = HttpUtility.HtmlDecode(limpio);

return limpio;
}

public string PasarHTMLaPlano(HttpServerUtility server, string texto)
{
string html = server.UrlDecode(texto);

string textoPlano = Regex.Replace(html, "<.*?>", string.Empty);

return HttpUtility.HtmlDecode(textoPlano).Trim();
}

#endregion
}
}
103 changes: 44 additions & 59 deletions WebLab/Items/ItemEdit2.aspx
Original file line number Diff line number Diff line change
@@ -1,35 +1,45 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ItemEdit2.aspx.cs" Inherits="WebLab.Items.ItemEdit2" MasterPageFile="~/Site1.Master" %>

<%@ Register assembly="Anthem" namespace="Anthem" tagprefix="anthem" %>
<%--<%@ Register assembly="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" namespace="CrystalDecisions.Web" tagprefix="CR" %>
--%>


<asp:Content ID="content1" ContentPlaceHolderID="head" runat="server">
<link href="../script/jquery-ui-1.8.1.custom.css" rel="stylesheet" type="text/css" />


<script src="../script/jquery.min.js" type="text/javascript"></script>
<script src="../script/jquery-ui.min.js" type="text/javascript"></script>


<script src="../script/jquery-ui.min.js" type="text/javascript"></script>
<script type="text/javascript" src="../script/Mascara.js"></script>
<script type="text/javascript" src="../script/ValidaFecha.js"></script>


<link rel="stylesheet" type="text/css" href ="../script/moverfilas/moverfilas.css" />
<script type="text/javascript" src="../script/moverfilas/codigo.js"></script>
<script type="text/javascript">
$(function() {

$("#tabContainer").tabs();
var currTab = $("#<%= HFCurrTabIndex.ClientID %>").val();

$("#tabContainer").tabs({ selected: currTab });
});
</script>
<script type="text/javascript" src="../script/moverfilas/codigo.js"></script>

<!-- CKEDITOR -->
<script type="text/javascript" src="../ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="../ckeditor/ckeditor-webforms.js"></script>

<script type="text/javascript">

$(function() {

$("#tabContainer").tabs();
var currTab = $("#<%= HFCurrTabIndex.ClientID %>").val();
$("#tabContainer").tabs({ selected: currTab });
});

</script>


<!-- CKEDITOR -->
<script type="text/javascript">
// Se debe enviar un textarea (sin name ni runat) y un hidden donde se guarda el html para enviar el contenido encodeado
// toolbar: [] ==> esta vacio para no mostrar la barra del text editor

$(document).ready(function () {
CKEditorWebForms.init(
'editor1',
'<%= hfHtml.ClientID %>',{ toolbar: []}
);

});

</script>

<style type="text/css">
.auto-style1 {
Expand Down Expand Up @@ -464,21 +474,8 @@
</td>
</tr>
</tr>
<%-- <tr>
<td class="control-label" >
Factor Producción:</td>
<td>
<anthem:Label ID="lblFactorProduccion" runat="server" Text="" Font-Bold="True"
ForeColor="#333333"></anthem:Label>
</td>
</tr>--%>
</table>

<%--</div>

</div>
</div>
</div>--%>
</td>

</tr>
Expand Down Expand Up @@ -794,9 +791,11 @@
<tr>
<td class="control-label" style="vertical-align: top">Observaciones:</td>
<td colspan="2">
<asp:TextBox ID="txtObservaciones" runat="server" class="form-control input-sm" MaxLength="300" Rows="3" TabIndex="8" TextMode="MultiLine" Width="500px" />
<%-- <asp:TextBox ID="txtObservaciones" runat="server" class="form-control input-sm" MaxLength="300" Rows="3" TabIndex="8" TextMode="MultiLine" Width="500px" />--%>
<textarea id="editor1" rows="2" cols="50" width="500px" ></textarea>
<asp:HiddenField ID="hfHtml" runat="server" />
<br />
<anthem:CustomValidator ID="cvObservaciones" runat="server" ClientValidationFunction="VerificaLargo" ControlToValidate="txtObservaciones" ErrorMessage="El límite del campo Observaciones es de 4000 caracteres. Verifique." Font-Names="Arial" Font-Size="8pt" ValidationGroup="1">El límite es de 4000 caracteres. Verifique.</anthem:CustomValidator>
<anthem:CustomValidator ID="cvObservaciones" runat="server" OnServerValidate="cvObservaciones_ServerValidate" ClientValidationFunction="VerificaLargo" ErrorMessage="El límite del campo Observaciones es de 4000 caracteres. Verifique." Font-Names="Arial" Font-Size="8pt" ValidationGroup="1">El límite es de 4000 caracteres. Verifique.</anthem:CustomValidator>
<anthem:CustomValidator ID="cvValores" runat="server" ErrorMessage="Debe ingresar los valores (minimo y maximo) o una observación" Font-Size="8pt" onservervalidate="cvValores_ServerValidate" ValidateEmptyText="True" ValidationGroup="1"></anthem:CustomValidator>
</td>
</tr>
Expand All @@ -807,7 +806,7 @@
</tr>
<tr>
<td align="right" colspan="3">
<anthem:Button ID="btGuardarVR" runat="server" CssClass="btn btn-primary" onclick="btnGuardarVR_Click" TabIndex="9" Text="Agregar a Lista" ValidationGroup="1" Width="150px" />
<anthem:Button ID="btGuardarVR" runat="server" CssClass="btn btn-primary" onclick="btnGuardarVR_Click" TabIndex="9" Text="Agregar a Lista" ValidationGroup="1" Width="150px" />
</td>
</tr>
<tr>
Expand Down Expand Up @@ -866,9 +865,13 @@
<asp:BoundField DataField="maximo" HeaderText="Valor Maximo">

</asp:BoundField>
<asp:BoundField DataField="observacion" HeaderText="Observaciones">

</asp:BoundField>

<asp:TemplateField HeaderText="Observaciones">
<ItemTemplate>
<%# Eval("observacion") %>
</ItemTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="">
<ItemTemplate>
<asp:ImageButton ID="Eliminar" runat="server" CommandName="Eliminar" ImageUrl="~/App_Themes/default/images/eliminar.jpg" OnClientClick="return PreguntoEliminar();" />
Expand Down Expand Up @@ -1308,25 +1311,7 @@
&nbsp;</td>
</tr>

<%--<tr>
<td class="myLabelDerechaGde" colspan="2" >

Si el analisis crresponde una <b>Prueba de Screening Neonatal</b>; marque que se deben
solicitar datos adicionales al paciente: Hora de nacimiento, Peso al nacer y
Semana de gestación.</td>
</tr>
<tr>
<td class="myLabelDerechaGde" colspan="2" >

&nbsp;</td>
</tr>
<tr>
<td class="myLabelDerechaGde" colspan="2" >

<asp:CheckBox ID="chkIsScreening" runat="server" CssClass="control-label"
Text="Solicitar Datos Adicionales del Paciente" />
</td>
</tr>--%>

<tr>
<td >
&nbsp;</td>
Expand Down
Loading
Loading