コード例 #1
0
ファイル: cUtils.cs プロジェクト: jlaua/WebHomologacion
        public string strCrearDocumentoCheckListExcel(int intIdCheckList)
        {
            string docHtmlExcel = "";

            #region Definicion de Tipo y Caracteristicas del Documento
            const string strDEFDOC =
            "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">" +
            "<html xmlns=\"http://www.w3.org/1999/xhtml\">" +
            "<head>" +
            "<title> Reporte para Exportar a Excel</title>";

            #endregion

            #region Definir Hoja de Estilos Dinamica
            const string strSTYLECSS =
            "<style type=\"text/css\">" +
            "a " +
            "{ " +
            "	text-align:left; " +
            "	font-size:11.0pt;" +
            "	font-weight:400; " +
            "	font-style:normal;" +
            "	text-decoration:none; " +
            "	font-family:Calibri, sans-serif; " +
            "	}" +
            ".style0 " +
            "	{" +
            "	vertical-align:bottom;" +
            "	white-space:nowrap; " +
            "	color:black; " +
            "	font-size:11.0pt;" +
            "	font-weight:400; " +
            "	font-style:normal;" +
            "	text-decoration:none; " +
            "	font-family:Calibri, Tahoma; " +
            "	border:none; " +
            "	}" +
            ".font12 " +
            "	{color:black;" +
            "	font-size:8.0pt; " +
            "	font-weight:400; " +
            "	font-style:normal;" +
            "	text-decoration:none; " +
            "	font-family:Calibri, Tahoma, Courier New;" +
            "	}" +
            ".font13 " +
            "	{color:black;" +
            "	font-size:8.0pt; " +
            "	font-weight:700; " +
            "	font-style:normal;" +
            "	text-decoration:none; " +
            "	font-family:Calibri, Tahoma, Courier New;" +
            "	}" +
            "td" +
            "	{" +
            "	padding:0px; " +
            "	color:black; " +
            "	font-size:11.0pt;" +
            "	font-weight:400; " +
            "	font-style:normal;" +
            "	text-decoration:none; " +
            "	font-family:Calibri, sans-serif; " +
            "	vertical-align:bottom;" +
            "	border:none; " +
            "	white-space:nowrap; " +
            "	}" +

            ".columna1 " +
            "	{" +
            "	font-size:8.0pt; " +
            "	font-family:Calibri, Arial;" +
            "	}" +

            ".TituloTabla " +
            "	{" +
            "	font-size:8.0pt; " +
            "	font-weight:700; " +
            "	font-family:Calibri, Arial;" +
            "	text-align:center;" +
            "	border:.5pt solid windowtext;" +
            "	background:#E26B0A; " +
            "	white-space:normal;}" +
            ".ComentarioTituloTabla " +
            "	{" +
            "	font-size:8.0pt; " +
            "	font-weight:700; " +
            "	font-family:Calibri, Arial;" +
            "	text-align:center;" +
            "	border:.5pt solid windowtext;" +
            "	background:#E26B0A; " +
            "	color:Yellow;}" +
            ".DatosTablaReq " +
            "	{" +
            "	font-size:8.0pt; " +
            "	font-family:Calibri, Arial;" +
            "	text-align:center;" +
            "	border:.5pt solid windowtext;} " +
            ".ParrafoEntreTablas " +
            "	{" +
            "	font-size:8.0pt; " +
            "	font-family:Calibri, Arial;" +
            "	text-align:center;} " +

            ".DatosTablaNotificaciones " +
            "	{" +
            "	font-size:8.0pt; " +
            "	font-family:Calibri, Arial;" +
            "	border:.5pt solid windowtext;" +
            "   text-align:left;" +
            " } " +

            ".TituloEjecuciones " +
            "	{" +
            "	color:white; " +
            "	font-size:10.0pt;" +
            "	font-weight:700; " +
            "	font-style:italic;" +
            "	font-family:Calibri, Arial;" +
            "	text-align:center;" +
            "	background:navy; " +
            "	}" +

            ".DatosMonitoreo " +
            "	{" +
            "	font-size:8.0pt;" +
            "	font-family:Courier New;" +
            "	border:.5pt solid windowtext;" +
            "	background:#EEECE1; " +
            "	}" +

            ".EjecucionJob " +
            "	{" +
            "	color:windowtext;" +
            "	font-size:8.0pt;" +
            "   font-family:Courier New;" +
            "	border:.5pt solid windowtext;} " +

            ".ObservacionMonitoreo " +
            "	{" +
            "	color:navy;" +
            "	font-size:10.0pt;" +
            "	font-family:Calibri, Courier New;" +
            "	text-align:left; " +
            "	vertical-align:top; " +
            "	border:.5pt solid windowtext;" +
            "	background:#BFBFBF; " +
            "	}" +
            "</style>";

            #endregion

            #region Definicion de variables Header

            const string quote = "\"";
            const string barraI = "\\";
            string nombreDocumento = "CDS - Infraestructura: " + DateTime.Now.ToString();
            const string nombreTitulo = "ESTADO DE CHECKLIST DIARIO RUTINAS Y/O SERVICIOS EN CERTIFICACION";
            const string comentarioDatoObligatorio = "(*) : Dato obligatorio";

            string strObservacionMonitoreo = "";

            #endregion

            #region Definir Seccion 1 Cabecera SeccionHeadCabecera
            string SeccionHeadCabecera =
            "</head>" +
            "<body link=\"blue\" vlink=\"purple\">" +
            "<table border=\"0\"\" cellpadding=\"0\" cellspacing=\"0\">  " +
            "<col width=\"30\" /> " +
            "<col width=\"350\" />" +
            "<col width=\"150\" /> " +
            "<col width=\"80\" />" +
            "<col width=\"150\" />" +
            "<col width=\"350\" /> " +
            "<col width=\"150\" /> " +
            "<col width=\"100\" /> " +
            "<col width=\"100\" /> " +
            "<col width=\"150\" span=\"3\" />" +
            "<tr> " +
            "<td class=\"columna1\" colspan=\"2\"> " + nombreDocumento + "  </td>" +
            "</tr>" +
            "<tr> " +
            "<td class=\"xl1565\"colspan=\"7\">" + nombreTitulo + "</td>" +
            "</tr>" +
            "<tr> " +
            "<td class=\"columna1\"  colspan=\"2\"> " + comentarioDatoObligatorio + " </td>" +
            "</tr>";

            #endregion

            #region Definir Espacio Entre Tablas "ParrafoEntreTabla"
            string ParrafoEntreTabla =
            "<tr> " +
            "<td></td>" +
            "<td></td>  " +
            "<td></td>  " +
            "<td></td>  " +
            "<td></td>  " +
            "</tr>";

            #endregion

            #region Seccion 7 Titulos Tabla "ObservacionProcesoMonitoreo"
            string ObservacionMonitoreo =
            "<tr style=\"background:#BFBFBF\">" +
            "<td  style=\"background-color:White\";></td>" +
            "<td colspan=\"8\"  class=\"ObservacionMonitoreo\"> " + strObservacionMonitoreo + "</td>" +
            "</tr>";

            #endregion

            #region Seccion 8 Titulos Tabla "Monitoreo"
            string TitulosTablaMonitoreo =
            "<tr>" +
            "<td></td> " +
            "<td class=\"TituloTabla\"> TAREA (*)                           <span class=\"ComentarioTituloTabla\">" +
            "<td class=\"TituloTabla\"> FRECUENCIA (*)                      <span class=\"ComentarioTituloTabla\">" +
            "<td class=\"TituloTabla\"> COD APP (*)                         <span class=\"ComentarioTituloTabla\">" +
            "<td class=\"TituloTabla\"> NOMBRE DE APLICATIVO                <span class=\"ComentarioTituloTabla\">" +
            "<td class=\"TituloTabla\"> PRE CONDICION (*)                   <span class=\"ComentarioTituloTabla\">" +
            "<td class=\"TituloTabla\"> RESULTADO DE EJECUCION (*)          </td>  " +
            "<td class=\"TituloTabla\"> HORA DE INICIO (*)                  <span class=\"ComentarioTituloTabla\">" +
            "<td class=\"TituloTabla\"> HORA FIN (*)                        <span class=\"ComentarioTituloTabla\">" +
            "<td class=\"TituloTabla\"> FECHA DE EJECUCION (*)              <span class=\"ComentarioTituloTabla\">" + " ";

            #endregion

            #region Seccion 10 Datos Tabla "CheckList Diario Monitoreo"

            #region Obtener Lista de Tareas de CheckList
            int intEstadoOK = 0;
            int intEstadoNOK = 0;
            int intEstadoNA = 0;
            int intOtros = 0;

            cCheckList objCCheckList = new cCheckList();
            List<cCheckList> objListaCCheckList = new List<cCheckList>();
            objListaCCheckList = objCCheckList.obtenerMonitoreoCheckList(intIdCheckList);
            string DatosTablaCheckListMonitoreo = "";

            for (int i = 0; i < objListaCCheckList.Count; i++)
            {
                DatosTablaCheckListMonitoreo += "<tr>" + "<td></td> " +
                                        "<td class=\"DatosMonitoreo\"> " + objListaCCheckList[i].strTarea + "</td>" +
                                        "<td class=\"DatosMonitoreo\"> " + objListaCCheckList[i].strFrecuencia + "</td>" +
                                        "<td class=\"DatosMonitoreo\"> " + objListaCCheckList[i].strCodApp + "</td>" +
                                        "<td class=\"DatosMonitoreo\"> " + objListaCCheckList[i].strNombreApp + "</td>" +
                                        "<td class=\"DatosMonitoreo\"> " + objListaCCheckList[i].strPreCondicion + "</td>" +
                                        "<td class=\"DatosMonitoreo\"> " + "<span style=\"color:Red\"> RESULTADO : </span>" + objListaCCheckList[i].strResultadoEjecucion + "</td>" +
                                        "<td class=\"DatosMonitoreo\"> " + objListaCCheckList[i].dtHoraInicio + "</td>" +
                                        "<td class=\"DatosMonitoreo\"> " + objListaCCheckList[i].dtHoraFin + "</td>" +
                                        "<td class=\"EjecucionJob\"> " + objListaCCheckList[i].dtFechaEjecucion + " </td>" +
                                        "</tr>";

                switch (objListaCCheckList[i].strResultadoEjecucion.Trim() )
                {
                    case "OK":
                        intEstadoOK = intEstadoOK + 1;
                        break;
                    case "NOK":
                        intEstadoNOK = intEstadoNOK + 1;
                        break;
                    case "NA":
                        intEstadoNA = intEstadoNA + 1;
                        break;
                    default:
                        intOtros = intOtros + 1;
                        break;
                }

            }
            #endregion

            #region Seccion 9 Titulos de Resumen Sumatorio "CheckList Monitoreo"
            string TitulosTablaSumarizadoCheckList =
            "<tr>" +
            "<td></td> " +
            "<td></td> " +
            "<td class=\"TituloTabla\"> ESTADO                              <span class=\"ComentarioTituloTabla\">" + "</td>" +
            "<td class=\"TituloTabla\"> CANTIDAD                            <span class=\"ComentarioTituloTabla\">" + "</td>" +
            "</tr>" +

            "<tr>" +
            "<td></td> " +
            "<td></td> " +
            "<td class=\"TituloTabla\"> OK                              <span class=\"ComentarioTituloTabla\">" + "</td>" +
            "<td class=\"DatosMonitoreo\">  " + intEstadoOK + "<span class=\"ComentarioTituloTabla\">" + "</td>" +
            "</tr>" +

            "<tr>" +
            "<td></td> " +
            "<td></td> " +
            "<td class=\"TituloTabla\"> NOK                              <span class=\"ComentarioTituloTabla\">" + "</td>" +
            "<td class=\"DatosMonitoreo\"> " + intEstadoNOK + "<span class=\"ComentarioTituloTabla\">" + "</td>" +
            "</tr>" +

            "<tr>" +
            "<td></td> " +
            "<td></td> " +
            "<td class=\"TituloTabla\"> NA                              <span class=\"ComentarioTituloTabla\">" + "</td>" +
            "<td class=\"DatosMonitoreo\"> " + intEstadoNA + "<span class=\"ComentarioTituloTabla\">" + "</td>" +
            "</tr>" +

            "<tr>" +
            "<td></td> " +
            "<td></td> " +
            "<td class=\"TituloTabla\"> OTRO                              <span class=\"ComentarioTituloTabla\">" + "</td>" +
            "<td class=\"DatosMonitoreo\"> " + intOtros + " <span class=\"ComentarioTituloTabla\">" + "</td>" +
            "</tr>" +

            " ";

            #endregion

            #endregion

            #region Definir Pie de Pagina "strFOOTER"
            const string strFOOTER =
            "<hr/> " +
            "<div> <div> <div><a>[1]</a><div><font class=\"font12\">Idem al registrado en la Hoja de Compromiso<br /> " +
            "Cuando no se tenga SN o ST o TK asociado se debe de colocar SN99999999</font></div></div></div></div>" +
            "<div><div><div><a>[2]</a><div><font class=\"font12\">Ingresar comentarios al Excel de ser necesario<br />" +
            "Cuando no se tenga SN o ST o TK asociado se debe de colocar ST99999999</font></div></div></div></div>" +
            "<div><div><div><a>[3]</a><div><font class=\"font12\">Codigo en el inventario de Aplicativo</font></div></div></div></div>  " +
            "</font></div></div></div></div></div> " +
            "</body>" + "</html> ";

            #endregion

            #region Definicion de Header XLS
            docHtmlExcel =

            strDEFDOC +
            strSTYLECSS +
            SeccionHeadCabecera +
            ParrafoEntreTabla +

            ObservacionMonitoreo +
            TitulosTablaMonitoreo +

            DatosTablaCheckListMonitoreo +
            ParrafoEntreTabla +
            ParrafoEntreTabla +
            TitulosTablaSumarizadoCheckList +
            #region Pendiente de Ordenar HTML

            #endregion
             "</table>" +
            "<div> " + strFOOTER;

            #endregion

            return docHtmlExcel;
        }
コード例 #2
0
ファイル: cCheckList.cs プロジェクト: jlaua/WebHomologacion
        public List<cCheckList> obtenerMonitoreoCheckList(int intIdCheckListEjecucion)
        {
            using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["dbHomologacionEntities2"].ConnectionString))
            {
                using (SqlCommand command = new SqlCommand("spObtenerListaCheckListHistoricoMonitoreo", connection))
                {
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add(new SqlParameter("@intIdCheckListEjecucion", intIdCheckListEjecucion));
                    connection.Open();
                    List<cCheckList> list = new List<cCheckList>();
                    using (SqlDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            cCheckList temp = new cCheckList(
                            (int)reader["intIdCheckListHistorico"],
                            (int)reader["intIdCheckListEjecucion"],
                            (string)reader["strTarea"],
                            (string)reader["strFrecuencia"],
                            (string)reader["strCodApp"],
                            (string)reader["strNombreApp"],
                            (string)reader["strRutaProcedimiento"],
                            (string)reader["strPreCondicion"],
                            (string)reader["strResultadoDeEjecucion"],
                            (TimeSpan)reader["dateHoraInicio"],
                            (TimeSpan)reader["dateHoraFin"],
                            (string)reader["strFinalizado"],
                            (DateTime)reader["dateFechaEjecucion"],
                            (DateTime)reader["dateFechaModificacion"]

                                );
                            list.Add(temp);
                        }
                    }
                    return list;

                }
            }
        }