Exemple #1
0
        public static AnalysisDetail GetAnalysisDetail(int riskId)
        {
            AnalysisDetail analysisDetail = new AnalysisDetail();

            try
            {
                analysisDetail = AnalysisDetailDAO.getInstance().GetAnalysisDetail(riskId);
            }
            catch (Exception ex)
            {
                analysisDetail = new AnalysisDetail();
            }
            return(analysisDetail);
        }
        public AnalysisDetail GetAnalysisDetail(int riskId)
        {
            AnalysisDetail analysisDetail = null;
            SqlConnection  con            = null;
            SqlCommand     cmd            = null;
            SqlDataReader  dr             = null;

            try
            {
                con             = Conexion.getInstance().ConexionBD();
                cmd             = new SqlCommand("dbo.USP_DETAIL_GET", con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@P_RISK_ID", riskId);
                con.Open();
                dr = cmd.ExecuteReader();

                while (dr.Read())
                {
                    analysisDetail = new AnalysisDetail();
                    analysisDetail.ANALYSIS_DETAIL_ID      = Convert.ToInt16(dr["ANALYSIS_DETAIL_ID"].ToString());
                    analysisDetail.IMPACT                  = Convert.ToInt16(dr["IMPACT"].ToString());
                    analysisDetail.IMPACT_DESCRIPTION      = analysisDetail.IMPACT == 1 ? "Menor" : analysisDetail.IMPACT == 2 ? "Moderado" : analysisDetail.IMPACT == 3?"Mayor":"Catastrófico";
                    analysisDetail.PROBABILITY             = Convert.ToInt16(dr["PROBABILITY"].ToString());
                    analysisDetail.PROBABILITY_DESCRIPTION = analysisDetail.PROBABILITY == 1 ? "Excepcional" : analysisDetail.PROBABILITY == 2 ? "Poco frecuente" :analysisDetail.PROBABILITY == 3 ? "Frecuente" : "Muy frecuente";
                    analysisDetail.SEVERIDAD               = dr["RISK_TYPE"].ToString();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
            }
            return(analysisDetail);
        }
Exemple #3
0
        public static string ToPdf(int projectId) //Este se acerca más
        {
            #region html
            Project     project    = ProjectDAO.getInstance().GetProjectByCode(projectId);
            List <Risk> listRisk   = RiskDAO.getInstance().ListRisks(projectId);
            string      htmlString = "<table style=\"width: 100%; border: groove;\">" +
                                     "<tr style=\"height: 100px;\">" +
                                     "  <th>" +
                                     "<img src=\"imgPronet/logo.png\" style=\"width:200px;\"/>" +
                                     "</th>" +
                                     "<th>SISTEMA DE GESTIÓN DE RIESGOS DE PROYECTO</th>" +
                                     "<th>Código: PRT - SGRP - 2017 </th>" +
                                     "</tr> " +
                                     "</table>";
            htmlString +=
                "<h2 align=\"center\">Proyecto " + project.PROCESS_NAME + "</h2>" +
                "<h3>Riesgos:</h3>" +
                "<form style=\"padding: 10px; \">"
            ;
            foreach (Risk risk in listRisk)
            {
                htmlString += "<ul>" +
                              "           <li>";
                htmlString += "<label>" + risk.RISK_NAME + "</label></br>";
                htmlString += "<label>" + "Tipo: " + risk.RISK_TYPE_NAME + "</label></br>";
                htmlString += "<label>" + "Estado: " + risk.STATUS_DESCRIPTION + "</label></br>";

                htmlString += "<div style=\"border-style:groove; padding: 10px\">";
                List <Cause> listCauses = CauseDAO.getInstance().ListCauses(risk.RISK_ID);

                if (listCauses.Count > 0)
                {
                    htmlString +=
                        "<label>Identificar: </label>" +
                        "<div style=\"border-style:groove; padding: 10px;\">" +
                        "<label>Causas: </label>" +
                        "<ul>";

                    foreach (Cause cause in listCauses)
                    {
                        htmlString +=
                            "           <li>" +
                            "               <label>" + cause.CAUSE_DESCRIPTION + "</label>" +
                            "               <br />" +
                            "               <label>" + "Tipo: " + cause.CAUSE_TYPE_NAME + "</label>" +
                            "               <br />" +
                            "               <label>" + "Porcentaje: " + cause.CAUSE_PERCENT + "%</label>";

                        List <Effect> listEffect = EffectDAO.getInstance().ListEffects(cause.CAUSE_ID);
                        if (listEffect.Count > 0)
                        {
                            htmlString += "               <br />" +
                                          "               <strong><label>Consecuencias: </label></strong>" +
                                          "               <ul>";
                            foreach (Effect effect in listEffect)
                            {
                                htmlString += "     <li> " +
                                              "                       <label>" + effect.DESCRIPTION + "</label>" +
                                              "                   </li>";
                            }
                            htmlString += "</ul>";
                        }
                        htmlString += "</li>";
                    }
                    htmlString += "       </ul>";
                    htmlString += "</div>";
                }
                //htmlString+= "</div>";

                AnalysisDetail analysisDetail = AnalysisDetailDAO.getInstance().GetAnalysisDetail(risk.RISK_ID);
                if (analysisDetail != null)
                {
                    htmlString +=
                        "<label>Detalle de Análisis: </label>" +
                        "<div style=\"border-style:groove; padding: 10px;\">";
                    htmlString += "<label>Impacto: " + analysisDetail.IMPACT_DESCRIPTION + " </label></br>";
                    htmlString += "<label>Probabilidad: " + analysisDetail.PROBABILITY_DESCRIPTION + " </label></br>";
                    htmlString += "<label>Severidad: " + analysisDetail.SEVERIDAD + " </label>";
                    htmlString += "</div>";
                }

                Treatment treatment = TreatmentDAO.getInstance().GetTreatment(risk.RISK_ID);
                if (treatment != null)
                {
                    htmlString +=
                        "<label>Tratamiento: </label>" +
                        "<div style=\"border-style:groove; padding: 10px;\">";
                    htmlString += "<label>Control: " + treatment.CONTROL_NAME + " </label></br>";
                    htmlString += "<label>Persona encargada: " + treatment.PERSON_IN_CHARGE + " </label></br>";
                    htmlString += "<label>Descripción: " + treatment.TREATMENT_DESCRIPTION + " </label></br>";
                    htmlString += "<label>Respuesta al riesgo: " + treatment.RISK_RESPONSE_DESCRIPTION + " </label>";
                    htmlString += "</div>";
                    if (treatment.DATE_IMPLEMENTATION != null)
                    {
                        htmlString +=
                            "<label>Implementación: </label>" +
                            "<div style=\"border-style:groove; padding: 10px;\">";
                        htmlString += "<label>Fecha: " + treatment.DATE_IMPLEMENTATION.ToString("dd/MM/yyyy") + " </label></br>";
                        htmlString += "</div>";
                    }
                    //htmlString += "</div>";
                }

                htmlString += "</div>";
                htmlString += "</li>";
                //fin del riesgo
                htmlString += "</ul>";
            }


            htmlString += "</form>";
            #endregion
            return(htmlString);
        }
Exemple #4
0
        public override async Task Execute(params object[] args)
        {
            using (one = new OneNote())
            {
                (backupPath, defaultPath, _) = one.GetFolders();

                if (!Directory.Exists(backupPath))
                {
                    UIHelper.ShowError(owner, Resx.AnalyzeCommand_NoBackups);
                    return;
                }

                using (var dialog = new AnalyzeDialog())
                {
                    if (dialog.ShowDialog(owner) != DialogResult.OK)
                    {
                        return;
                    }

                    showNotebookSummary = dialog.IncludeNotebookSummary;
                    showSectionSummary  = dialog.IncludeSectionSummary;
                    pageDetail          = dialog.Detail;
                    thumbnailSize       = dialog.ThumbnailSize;
                }

                one.CreatePage(one.CurrentSectionId, out var pageId);
                var page = one.GetPage(pageId);
                page.Title = Resx.AnalyzeCommand_Title;
                page.SetMeta(MetaNames.AnalysisReport, "true");

                ns = page.Namespace;
                PageNamespace.Set(ns);

                heading1Index = page.GetQuickStyle(Styles.StandardStyles.Heading1).Index;
                heading2Index = page.GetQuickStyle(Styles.StandardStyles.Heading2).Index;

                using (progress = new UI.ProgressDialog())
                {
                    progress.SetMaximum(5);
                    progress.Show(owner);

                    var container = page.EnsureContentContainer();
                    var notebooks = await one.GetNotebooks();

                    var prev = false;

                    if (showNotebookSummary)
                    {
                        ReportNotebooks(container, notebooks);
                        ReportOrphans(container, notebooks);
                        ReportCache(container);
                        prev = true;
                    }

                    if (showSectionSummary)
                    {
                        if (prev)
                        {
                            WriteHorizontalLine(page, container);
                        }

                        await ReportSections(container, notebooks);

                        prev = true;
                    }

                    if (pageDetail == AnalysisDetail.Current)
                    {
                        if (prev)
                        {
                            WriteHorizontalLine(page, container);
                        }

                        ReportPages(container, one.GetSection(), null, pageId);
                    }
                    else if (pageDetail == AnalysisDetail.All)
                    {
                        if (prev)
                        {
                            WriteHorizontalLine(page, container);
                        }

                        ReportAllPages(container, await one.GetNotebook(), null, pageId);
                    }

                    progress.SetMessage("Updating report...");
                    await one.Update(page);
                }

                await one.NavigateTo(pageId);
            }
        }