protected void gridVistas_SelectedIndexChanged(object sender, EventArgs e)
        {
            string sUrlPage    = string.Empty;
            string pCodMonitor = gridVistas.SelectedDataKey.Value.ToString();
            DBConn oConn       = new DBConn();

            if (oConn.Open())
            {
                cAptMonitorPages oAptMonitorPages = new cAptMonitorPages(ref oConn);
                oAptMonitorPages.CodMonitor = pCodMonitor;
                DataTable dtmPage = oAptMonitorPages.Get();
                if (dtmPage != null)
                {
                    if (dtmPage.Rows.Count > 0)
                    {
                        if (string.IsNullOrEmpty(dtmPage.Rows[0]["cod_cliente"].ToString()))
                        {
                            Session["indexcliente"] = 0;
                        }

                        sUrlPage = dtmPage.Rows[0]["url_page"].ToString();
                        sUrlPage = sUrlPage + "?codmonitor=" + pCodMonitor;
                        sUrlPage = sUrlPage + "&codusuario=" + CodCliente.Value;
                        sUrlPage = sUrlPage + "&order=" + dtmPage.Rows[0]["order_page"].ToString();
                    }
                }
                dtmPage = null;
                oConn.Close();
            }
            Response.Redirect(sUrlPage);
        }
        protected void onCLose()
        {
            bVista.Value = string.Empty;
            btnChangeClientHolding.Text = "Por Cliente";

            tpconsulta_normal.Visible       = false;
            tdselectvista.Visible           = false;
            tpconsulta_segundonivel.Visible = false;
            //oCmbPages.Visible = false;
            lblPage.Visible  = false;
            hddCodPage.Value = string.Empty;
            hddReload.Value  = "1";

            hddMonitorCreated.Value        = string.Empty;
            btnChangeClientHolding.Visible = true;

            DBConn oConn = new DBConn();

            if (oConn.Open())
            {
                cAptMonitorPages oAptMonitorPages = new cAptMonitorPages(ref oConn);
                oAptMonitorPages.CodMonitor = CodMonitorView.Value;
                gridPages.DataSource        = oAptMonitorPages.Get();
                gridPages.DataBind();
            }
            oConn.Close();

            Page.ClientScript.RegisterStartupScript(this.GetType(), "hide", "$(function () { $('#myModal').modal('hide'); goReload(); });", true);
        }
Beispiel #3
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            Web    oWeb        = new Web();
            string sTimePage   = string.Empty;
            string sUrlPage    = string.Empty;
            string pCodMonitor = oWeb.GetData("codmonitor");
            string pCodUsuario = oWeb.GetData("codusuario");
            string pOrderPage  = oWeb.GetData("order");

            DBConn oConn = new DBConn();

            if (oConn.Open())
            {
                cAptMonitorPages oAptMonitorPages = new cAptMonitorPages(ref oConn);
                oAptMonitorPages.CodMonitor = pCodMonitor;
                oAptMonitorPages.OrderPage  = (Convert.ToInt32(pOrderPage) + 1).ToString();
                DataTable dtMPage = oAptMonitorPages.Get();
                if (dtMPage != null)
                {
                    if (dtMPage.Rows.Count > 0)
                    {
                        sUrlPage = dtMPage.Rows[0]["url_page"].ToString();
                        sUrlPage = sUrlPage + "?codmonitor=" + pCodMonitor;
                        if (!string.IsNullOrEmpty(pCodUsuario))
                        {
                            sUrlPage = sUrlPage + "&codusuario=" + pCodUsuario;
                        }
                        sUrlPage  = sUrlPage + "&order=" + dtMPage.Rows[0]["order_page"].ToString();
                        sTimePage = dtMPage.Rows[0]["time_page"].ToString();
                    }
                    else
                    {
                        oAptMonitorPages.OrderPage = string.Empty;
                        dtMPage = oAptMonitorPages.Get();
                        if (dtMPage != null)
                        {
                            if (dtMPage.Rows.Count > 0)
                            {
                                sUrlPage = dtMPage.Rows[0]["url_page"].ToString();
                                sUrlPage = sUrlPage + "?codmonitor=" + pCodMonitor;
                                if (!string.IsNullOrEmpty(pCodUsuario))
                                {
                                    sUrlPage = sUrlPage + "&codusuario=" + pCodUsuario;
                                }
                                sUrlPage  = sUrlPage + "&order=" + dtMPage.Rows[0]["order_page"].ToString();
                                sTimePage = dtMPage.Rows[0]["time_page"].ToString();
                            }
                        }
                    }
                }
                dtMPage = null;
                oConn.Close();

                Response.AppendHeader("Refresh", sTimePage + "; URL=" + sUrlPage);
                oConn.Close();
            }
        }
Beispiel #4
0
        protected void getMonitores()
        {
            StringBuilder sUrlPage;
            StringBuilder sHtml = new StringBuilder();

            dcControlPanel.Conn.DBConn oConn = new dcControlPanel.Conn.DBConn();

            if (oConn.Open())
            {
                cAppVistasCliente oAppVistasCliente = new cAppVistasCliente(ref oConn);
                oAppVistasCliente.CodCliente = oIsUsuario.CodUsuario;
                oAppVistasCliente.NotIn      = false;
                DataTable DataVista = oAppVistasCliente.Get();

                foreach (DataRow oRow in DataVista.Rows)
                {
                    cAptMonitorPages oAptMonitorPages = new cAptMonitorPages(ref oConn);
                    oAptMonitorPages.CodMonitor = oRow["cod_monitor"].ToString();
                    DataTable dtmPage = oAptMonitorPages.Get();
                    if (dtmPage != null)
                    {
                        if (dtmPage.Rows.Count > 0)
                        {
                            string indexToken = string.Empty;
                            if (string.IsNullOrEmpty(dtmPage.Rows[0]["cod_cliente"].ToString()))
                            {
                                indexToken          = oRow["cod_monitor"].ToString() + DateTime.Now.ToString("yyyyMMdd");
                                Session[indexToken] = 0;
                            }
                            sUrlPage = new StringBuilder();
                            sUrlPage.Append(dtmPage.Rows[0]["url_page"].ToString());
                            sUrlPage.Append("?codmonitor=").Append(oRow["cod_monitor"].ToString());
                            sUrlPage.Append("&codusuario=").Append(oIsUsuario.CodUsuario);
                            sUrlPage.Append("&authuser="******"&indexToken=").Append(indexToken);
                            sUrlPage.Append("&order=").Append(dtmPage.Rows[0]["order_page"].ToString());

                            sHtml.Append("<div class=\"col-md-6 wow fadeInUp\" data-wow-duration=\"4s\" data-wow-delay=\"1s\">");
                            sHtml.Append("<iframe src =\"/PaneldeControl/" + sUrlPage.ToString() + "\" width=\"600px\" height=\"300px\" scrolling=\"no\"></iframe>");
                            sHtml.Append("</div>");
                        }
                    }
                }
                idpanel.Controls.Add(new LiteralControl(sHtml.ToString()));
            }
            oConn.Close();
        }
        protected void btnGrabar2_Click(object sender, EventArgs e)
        {
            DBConn oConn = new DBConn();

            if (oConn.Open())
            {
                cAptMonitorPages oAptMonitorPages = new cAptMonitorPages(ref oConn);
                oAptMonitorPages.CodMonitor = CodMonitorView.Value;
                DataTable dtMPage = oAptMonitorPages.Get();
                oAptMonitorPages.OrderPage = (dtMPage.Rows.Count + 1).ToString();
                dtMPage = null;
                oAptMonitorPages.CodPage     = oCmbPages.SelectedValue;
                oAptMonitorPages.TimePage    = txt_time.Text;
                oAptMonitorPages.EstPage     = "V";
                oAptMonitorPages.TipoUsuario = oCmbTipoConsulta.SelectedValue;
                oAptMonitorPages.CodCliente  = (!string.IsNullOrEmpty(oCmbCliente.SelectedValue) ? oCmbCliente.SelectedValue : null);
                oAptMonitorPages.CodHolding  = (!string.IsNullOrEmpty(oCmbHolding.SelectedValue) ? oCmbHolding.SelectedValue : null);
                oAptMonitorPages.Accion      = "CREAR";
                oAptMonitorPages.Put();

                if (!string.IsNullOrEmpty(oAptMonitorPages.Error))
                {
                    Response.Write(oAptMonitorPages.Error);
                    Response.End();
                }

                oAptMonitorPages.CodPage   = string.Empty;
                oAptMonitorPages.EstPage   = string.Empty;
                oAptMonitorPages.OrderPage = string.Empty;
                gridPages.DataSource       = oAptMonitorPages.Get();
                gridPages.DataBind();

                oConn.Close();

                oCmbCliente.Items[0].Selected      = true;
                oCmbHolding.Items[0].Selected      = true;
                oCmbTipoConsulta.Items[0].Selected = true;
                oCmbPages.Items[0].Selected        = true;
                tpconsulta_normal.Visible          = false;
                tdselectvista.Visible = true;
            }
        }
Beispiel #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DBConn oConn        = new DBConn();
            Web    oWeb         = new Web();
            string pCodMonitor  = oWeb.GetData("codmonitor");
            string pCodUsuario  = oWeb.GetData("codusuario");
            string pOrderPage   = oWeb.GetData("order");
            string pCodCliente  = string.Empty;
            string pTipoUsuario = string.Empty;
            int    maxdt        = (new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMonths(1).AddDays(-1)).Day;

            firtDay.InnerText = "01-" + DateTime.Now.ToString("MM-yyyy");
            lastDay.InnerText = maxdt.ToString() + "-" + DateTime.Now.ToString("MM-yyyy");

            if (!IsPostBack)
            {
                if (oConn.Open())
                {
                    cAptMonitorPages oAptMonitorPages = new cAptMonitorPages(ref oConn);
                    oAptMonitorPages.CodMonitor = pCodMonitor;
                    oAptMonitorPages.OrderPage  = pOrderPage;
                    DataTable dtMPage = oAptMonitorPages.Get();

                    if (dtMPage != null)
                    {
                        if (dtMPage.Rows.Count > 0)
                        {
                            pTipoUsuario = dtMPage.Rows[0]["tipo_usuario"].ToString();
                            if (!string.IsNullOrEmpty(dtMPage.Rows[0]["cod_cliente"].ToString()))
                            {
                                pCodCliente = dtMPage.Rows[0]["cod_cliente"].ToString();
                            }
                            else if (!string.IsNullOrEmpty(dtMPage.Rows[0]["cod_holding"].ToString()))
                            {
                                pCodCliente  = dtMPage.Rows[0]["cod_holding"].ToString();
                                pTipoUsuario = "H";
                            }
                        }
                    }
                    dtMPage = null;

                    cAptMonitorMensaje oAptMonitorMensaje = new cAptMonitorMensaje(ref oConn);
                    oAptMonitorMensaje.CodMonitor = pCodMonitor;
                    DataTable dtMntMsj = oAptMonitorMensaje.GeMensajesByMonitor();
                    if (dtMntMsj != null)
                    {
                        if (dtMntMsj.Rows.Count > 0)
                        {
                            Label oLabel;
                            foreach (DataRow oRow in dtMntMsj.Rows)
                            {
                                oLabel          = new Label();
                                oLabel.Text     = oRow["texto_mensaje"].ToString();
                                oLabel.CssClass = "styleMensaje";
                                idMarque.Controls.Add(oLabel);
                                idMarque.Controls.Add(new LiteralControl("<br><br><br>"));
                            }
                        }
                    }
                    dtMntMsj = null;


                    oCmbTipoConsulta.Value = pTipoUsuario;
                    oCmbCliente.Value      = pCodCliente;
                    imglogo.ImageUrl       = "images/logos/logo.jpg";
                }
                oConn.Close();
            }
        }
Beispiel #7
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            Web    oWeb        = new Web();
            string sTimePage   = string.Empty;
            string sUrlPage    = string.Empty;
            string pCodMonitor = oWeb.GetData("codmonitor");
            string indexToken  = oWeb.GetData("indexToken");
            string pCodUsuario = oWeb.GetData("codusuario");
            string pOrderPage  = oWeb.GetData("order");

            DBConn oConn = new DBConn();

            if (oConn.Open())
            {
                cAptMonitorPages oAptMonitorPages = new cAptMonitorPages(ref oConn);
                oAptMonitorPages.CodMonitor = pCodMonitor;
                oAptMonitorPages.OrderPage  = (Convert.ToInt32(pOrderPage) + 1).ToString();
                DataTable dtMPage = oAptMonitorPages.Get();
                if (dtMPage != null)
                {
                    if (dtMPage.Rows.Count > 0)
                    {
                        sUrlPage = dtMPage.Rows[0]["url_page"].ToString();
                        sUrlPage = sUrlPage + "?codmonitor=" + pCodMonitor;
                        sUrlPage = sUrlPage + "&indexToken=" + indexToken;
                        if (!string.IsNullOrEmpty(pCodUsuario))
                        {
                            sUrlPage = sUrlPage + "&codusuario=" + pCodUsuario;
                        }
                        sUrlPage  = sUrlPage + "&order=" + dtMPage.Rows[0]["order_page"].ToString();
                        sTimePage = dtMPage.Rows[0]["time_page"].ToString();
                    }
                    else
                    {
                        oAptMonitorPages.OrderPage = string.Empty;
                        dtMPage = oAptMonitorPages.Get();
                        if (dtMPage != null)
                        {
                            if (dtMPage.Rows.Count > 0)
                            {
                                if ((string.IsNullOrEmpty(dtMPage.Rows[0]["cod_cliente"].ToString())) && (string.IsNullOrEmpty(dtMPage.Rows[0]["cod_holding"].ToString())))
                                {
                                    cCliente  oCliente  = new cCliente(ref oConn);
                                    DataTable dtCliente = oCliente.Get();
                                    if (!string.IsNullOrEmpty(indexToken))
                                    {
                                        if (dtCliente.Rows.Count == (Convert.ToInt32(Session[indexToken].ToString()) + 1))
                                        {
                                            Session[indexToken] = 0;
                                        }
                                        else
                                        {
                                            Session[indexToken] = Convert.ToInt32(Session[indexToken].ToString()) + 1;
                                        }
                                    }
                                    else
                                    {
                                        if (dtCliente.Rows.Count == (Convert.ToInt32(Session["indexcliente"].ToString()) + 1))
                                        {
                                            Session["indexcliente"] = 0;
                                        }
                                        else
                                        {
                                            Session["indexcliente"] = Convert.ToInt32(Session["indexcliente"].ToString()) + 1;
                                        }
                                    }
                                    dtCliente = null;
                                }

                                sUrlPage = dtMPage.Rows[0]["url_page"].ToString();
                                sUrlPage = sUrlPage + "?codmonitor=" + pCodMonitor;
                                sUrlPage = sUrlPage + "&indexToken=" + indexToken;
                                if (!string.IsNullOrEmpty(pCodUsuario))
                                {
                                    sUrlPage = sUrlPage + "&codusuario=" + pCodUsuario;
                                }
                                sUrlPage  = sUrlPage + "&order=" + dtMPage.Rows[0]["order_page"].ToString();
                                sTimePage = dtMPage.Rows[0]["time_page"].ToString();
                            }
                        }
                    }
                }
                dtMPage = null;

                Response.AppendHeader("Refresh", sTimePage + "; URL=" + sUrlPage);
            }
            oConn.Close();
        }
Beispiel #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DBConn oConn          = new DBConn();
            Web    oWeb           = new Web();
            string pCodMonitor    = oWeb.GetData("codmonitor");
            string pCodUsuario    = oWeb.GetData("codusuario");
            string pAuthenCodUser = oWeb.GetData("authuser");
            string indexToken     = oWeb.GetData("indexToken");

            string pCodPage     = string.Empty;
            string pOrderPage   = oWeb.GetData("order");
            string pCodCliente  = string.Empty;
            string pTipoUsuario = string.Empty;
            string sIdFecha     = string.Empty;
            int    maxdt        = (new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMonths(1).AddDays(-1)).Day;

            firtDay.InnerText = "01-" + DateTime.Now.ToString("MM-yyyy");
            lastDay.InnerText = maxdt.ToString() + "-" + DateTime.Now.ToString("MM-yyyy");

            if (!string.IsNullOrEmpty(pAuthenCodUser))
            {
                AuthenticUser(pAuthenCodUser);
            }

            oWeb.ValidaUserPanel();

            if (!IsPostBack)
            {
                if (oConn.Open())
                {
                    cAptMonitorPages oAptMonitorPages = new cAptMonitorPages(ref oConn);
                    oAptMonitorPages.CodMonitor = pCodMonitor;
                    oAptMonitorPages.OrderPage  = pOrderPage;
                    DataTable dtMPage = oAptMonitorPages.Get();

                    if (dtMPage != null)
                    {
                        if (dtMPage.Rows.Count > 0)
                        {
                            pCodPage     = dtMPage.Rows[0]["cod_page"].ToString();
                            pTipoUsuario = dtMPage.Rows[0]["tipo_usuario"].ToString();
                            if (!string.IsNullOrEmpty(dtMPage.Rows[0]["cod_cliente"].ToString()))
                            {
                                pCodCliente = dtMPage.Rows[0]["cod_cliente"].ToString();
                            }
                            else if (!string.IsNullOrEmpty(dtMPage.Rows[0]["cod_holding"].ToString()))
                            {
                                pCodCliente  = dtMPage.Rows[0]["cod_holding"].ToString();
                                pTipoUsuario = "H";
                            }
                            else
                            {
                                cCliente  oCliente  = new cCliente(ref oConn);
                                DataTable dtCliente = oCliente.Get();
                                if (!string.IsNullOrEmpty(indexToken))
                                {
                                    pCodCliente = dtCliente.Rows[Convert.ToInt32(Session[indexToken].ToString())]["nkey_cliente"].ToString();
                                }
                                else
                                {
                                    pCodCliente = dtCliente.Rows[Convert.ToInt32(Session["indexcliente"].ToString())]["nkey_cliente"].ToString();
                                }
                                dtCliente = null;
                            }
                        }
                    }
                    dtMPage = null;

                    oCmbTipoConsulta.Value = pTipoUsuario;
                    oCmbCliente.Value      = pCodCliente;
                    if (!string.IsNullOrEmpty(oCmbCliente.Value))
                    {
                        cAppLogoCliente oAppLogoCliente = new cAppLogoCliente(ref oConn);
                        oAppLogoCliente.NKey_cliente = pCodCliente;
                        oAppLogoCliente.Tipo         = (pTipoUsuario == "H" ? pTipoUsuario : "C");
                        DataTable dtlogo = oAppLogoCliente.Get();
                        if (dtlogo != null)
                        {
                            if (dtlogo.Rows.Count > 0)
                            {
                                imglogo.ImageUrl = "images/logos/" + dtlogo.Rows[0]["logo_cliente"].ToString();
                            }
                        }
                    }
                    else
                    {
                        imglogo.Visible = false;
                    }
                }
                oConn.Close();
            }

            if (oConn.Open())
            {
                cIndejecucion oIndejecucion = new cIndejecucion(ref oConn);
                DataTable     tblEjecucion  = oIndejecucion.Get();
                if (tblEjecucion != null)
                {
                    if (tblEjecucion.Rows.Count > 0)
                    {
                        sIdFecha = tblEjecucion.Rows[0]["idfecha"].ToString();
                    }
                    tblEjecucion.Dispose();
                }
                tblEjecucion = null;

                DateTime idFechaMesAnterior = new DateTime(Int32.Parse(sIdFecha.Substring(0, 4)), Int32.Parse(sIdFecha.Substring(4, 2)), Int32.Parse(sIdFecha.Substring(6, 2)), Int32.Parse(sIdFecha.Substring(8, 2)), Int32.Parse(sIdFecha.Substring(10, 2)), 0);
                idFechaMesAnterior = idFechaMesAnterior.AddMonths(-1);

                cAptPagesKpi oAptPagesKpi = new cAptPagesKpi(ref oConn);
                oAptPagesKpi.CodCliente = pCodUsuario;
                oAptPagesKpi.CodPage    = pCodPage;
                DataTable dtKPIs = oAptPagesKpi.Get();
                if (dtKPIs != null)
                {
                    cIndresultado oIndResultado = new cIndresultado(ref oConn);
                    DataTable     tblColumn1    = null;
                    cIndumbral    oIndumbral    = null;
                    HtmlTableCell oCell;

                    HtmlTableCell      oCelldataColumn;
                    HtmlGenericControl dynDiv;

                    HtmlTableCell      oCelldataAceptacion;
                    HtmlGenericControl oDivAceptacion;

                    HtmlTableCell      oCellSLA;
                    HtmlGenericControl oDivSLA;

                    HtmlTableCell      oCellMesAnterior;
                    HtmlGenericControl oDivImg;
                    Image oImage;

                    foreach (DataRow oRow in dtKPIs.Rows)
                    {
                        string iDato    = "0";
                        string sKeyTipo = string.Empty;

                        oCell    = new HtmlTableCell();
                        oCell.ID = "tdCell_" + oRow["identificador_kpi"].ToString();
                        oCell.Controls.Add(new LiteralControl("<div align=\"center\" class=\"tbTit\">" + oRow["nombrekpi"].ToString() + "</div>"));
                        HeaderId.Controls.Add(oCell);

                        oCelldataColumn    = new HtmlTableCell();
                        oCelldataColumn.ID = "tdCell_dataColumn" + oRow["identificador_kpi"].ToString();
                        oCelldataColumn.Attributes.Add("class", "clDtPanel");

                        dynDiv    = new HtmlGenericControl("div");
                        dynDiv.ID = "divControl_" + oRow["identificador_kpi"].ToString();

                        oIndResultado.Tipo       = oCmbTipoConsulta.Value;
                        oIndResultado.KeyCliente = oCmbCliente.Value;
                        oIndResultado.IdFecha    = sIdFecha;
                        oIndResultado.Indicador  = oRow["identificador_kpi"].ToString();
                        tblColumn1 = oIndResultado.Get();
                        if (tblColumn1 != null)
                        {
                            if (tblColumn1.Rows.Count > 0)
                            {
                                iDato            = (!string.IsNullOrEmpty(tblColumn1.Rows[0]["valor"].ToString()) ? tblColumn1.Rows[0]["valor"].ToString() : "0");
                                sKeyTipo         = tblColumn1.Rows[0]["nkey_tipo"].ToString();
                                dynDiv.InnerText = String.Format("{0:0}", double.Parse(iDato));
                                //oColumn1.InnerText = String.Format("{0:0}", double.Parse(iDato));
                            }
                            tblColumn1.Dispose();
                        }
                        tblColumn1 = null;

                        oCellMesAnterior    = new HtmlTableCell();
                        oCellMesAnterior.ID = "tdCell_mesanterior" + oRow["identificador_kpi"].ToString();
                        oCellMesAnterior.Attributes.Add("class", "clDtPanel");

                        /*******************************************************/
                        /***************** Mes Anterior ************************/
                        /*******************************************************/
                        oIndResultado.IdFecha = idFechaMesAnterior.ToString("yyyyMMddHHmm");
                        tblColumn1            = oIndResultado.GetMesAnterior();
                        if (tblColumn1 != null)
                        {
                            if (tblColumn1.Rows.Count > 0)
                            {
                                oDivImg = new HtmlGenericControl("div");
                                oDivImg.Attributes.Add("class", "tbDat");

                                oImage          = new Image();
                                oImage.ImageUrl = oWeb.getColorArrowCalidad(double.Parse(iDato), double.Parse(tblColumn1.Rows[0]["valor"].ToString()));

                                oDivImg.Controls.Add(oImage);
                                oCellMesAnterior.Controls.Add(oDivImg);
                                //oColumnMesAnt1.ImageUrl = oWeb.getColorArrowCalidad(double.Parse(iDato), double.Parse(tblColumn1.Rows[0]["valor"].ToString()));
                            }
                            tblColumn1.Dispose();
                        }
                        tblColumn1 = null;

                        oCelldataAceptacion    = new HtmlTableCell();
                        oCelldataAceptacion.ID = "tdCell_aceptacion" + oRow["identificador_kpi"].ToString();
                        oCelldataAceptacion.Attributes.Add("class", "clDtPanel");

                        oDivAceptacion    = new HtmlGenericControl("div");
                        oDivAceptacion.ID = "divAceptacion_" + oRow["identificador_kpi"].ToString();
                        oDivAceptacion.Attributes.Add("class", "tbDat");

                        oCellSLA    = new HtmlTableCell();
                        oCellSLA.ID = "tdCell_SLA" + oRow["identificador_kpi"].ToString();
                        oCellSLA.Attributes.Add("class", "clDtPanel");

                        oDivSLA    = new HtmlGenericControl("div");
                        oDivSLA.ID = "divSLA_" + oRow["identificador_kpi"].ToString();
                        oDivSLA.Attributes.Add("class", "tbDat");

                        oIndumbral            = new cIndumbral(ref oConn);
                        oIndumbral.KeyCliente = oCmbCliente.Value;
                        oIndumbral.Tipo       = oCmbTipoConsulta.Value;
                        oIndumbral.Indicador  = oRow["identificador_kpi"].ToString();
                        oIndumbral.KeyTipo    = sKeyTipo;
                        tblColumn1            = oIndumbral.Get();
                        if (tblColumn1 != null)
                        {
                            if (tblColumn1.Rows.Count > 0)
                            {
                                oDivAceptacion.InnerText = tblColumn1.Rows[0]["criterio_aceptacion"].ToString() + tblColumn1.Rows[0]["unidad"].ToString();
                                oCelldataAceptacion.Controls.Add(oDivAceptacion);
                                //oCAceptacion1.InnerHtml = tblColumn1.Rows[0]["criterio_aceptacion"].ToString() + tblColumn1.Rows[0]["unidad"].ToString();

                                oDivSLA.InnerText = tblColumn1.Rows[0]["sla"].ToString();
                                oCellSLA.Controls.Add(oDivSLA);
                                //oSLA1.InnerHtml = tblColumn1.Rows[0]["sla"].ToString();

                                dynDiv.Attributes.Add("class", oWeb.getColorNumAvance(double.Parse(iDato), tblColumn1));
                                oCelldataColumn.Controls.Add(dynDiv);
                                //oColumn1.Attributes.Add("class", oWeb.getColorNumAvance(double.Parse(iDato), tblColumn1));
                            }
                            tblColumn1.Dispose();
                        }
                        tblColumn1 = null;

                        dataColumn.Controls.Add(oCelldataColumn);
                        dataAceptacion.Controls.Add(oCelldataAceptacion);
                        dataSLA.Controls.Add(oCellSLA);
                        dataMesAnterior.Controls.Add(oCellMesAnterior);
                    }
                }
                dtKPIs = null;

                oConn.Close();
            }
        }
Beispiel #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DBConn oConn          = new DBConn();
            Web    oWeb           = new Web();
            string pCodMonitor    = oWeb.GetData("codmonitor");
            string pCodUsuario    = oWeb.GetData("codusuario");
            string pAuthenCodUser = oWeb.GetData("authuser");
            string indexToken     = oWeb.GetData("indexToken");

            string pCodPage     = string.Empty;
            string pOrderPage   = oWeb.GetData("order");
            string pCodCliente  = string.Empty;
            string pTipoUsuario = string.Empty;
            string sIdFecha     = string.Empty;
            int    maxdt        = (new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMonths(1).AddDays(-1)).Day;

            firtDay.InnerText = "01-" + DateTime.Now.ToString("MM-yyyy");
            lastDay.InnerText = maxdt.ToString() + "-" + DateTime.Now.ToString("MM-yyyy");

            if (!string.IsNullOrEmpty(pAuthenCodUser))
            {
                AuthenticUser(pAuthenCodUser);
            }

            oWeb.ValidaUserPanel();

            if (oConn.Open())
            {
                if (!IsPostBack)
                {
                    cAptMonitorPages oAptMonitorPages = new cAptMonitorPages(ref oConn);
                    oAptMonitorPages.CodMonitor = pCodMonitor;
                    oAptMonitorPages.OrderPage  = pOrderPage;
                    DataTable dtMPage = oAptMonitorPages.Get();

                    if (dtMPage != null)
                    {
                        if (dtMPage.Rows.Count > 0)
                        {
                            pCodPage         = dtMPage.Rows[0]["cod_page"].ToString();
                            pTipoUsuario     = dtMPage.Rows[0]["tipo_usuario"].ToString();
                            lblSubTitle.Text = dtMPage.Rows[0]["nom_page"].ToString();
                        }
                    }
                    dtMPage = null;

                    oCmbTipoConsulta.Value = pTipoUsuario;
                }

                cIndejecucion oIndejecucion = new cIndejecucion(ref oConn);
                DataTable     tblEjecucion  = oIndejecucion.Get();
                if (tblEjecucion != null)
                {
                    if (tblEjecucion.Rows.Count > 0)
                    {
                        sIdFecha = tblEjecucion.Rows[0]["idfecha"].ToString();
                    }
                    tblEjecucion.Dispose();
                }
                tblEjecucion = null;

                DateTime idFechaMesAnterior = new DateTime(Int32.Parse(sIdFecha.Substring(0, 4)), Int32.Parse(sIdFecha.Substring(4, 2)), Int32.Parse(sIdFecha.Substring(6, 2)), Int32.Parse(sIdFecha.Substring(8, 2)), Int32.Parse(sIdFecha.Substring(10, 2)), 0);
                idFechaMesAnterior = idFechaMesAnterior.AddMonths(-1);

                cAptPagesKpi oAptPagesKpi = new cAptPagesKpi(ref oConn);
                oAptPagesKpi.CodCliente = pCodUsuario;
                oAptPagesKpi.CodPage    = pCodPage;
                DataTable dtKPIs = oAptPagesKpi.Get();
                if (dtKPIs != null)
                {
                    HtmlTableCell oCell;
                    foreach (DataRow oRow in dtKPIs.Rows)
                    {
                        string iDato    = "0";
                        string sKeyTipo = string.Empty;
                        oCell    = new HtmlTableCell();
                        oCell.ID = "tdCell_" + oRow["identificador_kpi"].ToString();
                        oCell.Controls.Add(new LiteralControl("<div align=\"center\" class=\"tbTit\">" + oRow["nombrekpi"].ToString() + "</div>"));
                        HeaderId.Controls.Add(oCell);
                    }
                }
                dtKPIs = null;

                cAnalista oAnalista;
                DataTable tblAnalista = null;

                switch (pTipoUsuario)
                {
                case "A":
                    oAnalista            = new cAnalista(ref oConn);
                    oAnalista.CodMonitor = pCodMonitor;
                    oAnalista.CodPage    = pCodPage;
                    tblAnalista          = oAnalista.GetBySecLevelSoc();

                    break;

                case "G":
                    oAnalista            = new cAnalista(ref oConn);
                    oAnalista.CodMonitor = pCodMonitor;
                    oAnalista.CodPage    = pCodPage;
                    tblAnalista          = oAnalista.GetBySecLevelHol();

                    break;

                case "P":
                    cAplicador oAplicador = new cAplicador(ref oConn);
                    oAplicador.CodMonitor = pCodMonitor;
                    oAplicador.CodPage    = pCodPage;
                    tblAnalista           = oAplicador.Get();

                    break;

                case "R":
                    cCobrador oCobrador = new cCobrador(ref oConn);
                    oCobrador.CodMonitor = pCodMonitor;
                    oCobrador.CodPage    = pCodPage;
                    tblAnalista          = oCobrador.Get();

                    break;

                case "D":
                    cDigitador oDigitador = new cDigitador(ref oConn);
                    oDigitador.CodMonitor = pCodMonitor;
                    oDigitador.CodPage    = pCodPage;
                    tblAnalista           = oDigitador.Get();

                    break;
                }


                if (tblAnalista != null)
                {
                    HtmlTableRow  oTbRow;
                    HtmlTableCell oCell;
                    foreach (DataRow oRow in tblAnalista.Rows)
                    {
                        oTbRow    = new HtmlTableRow();
                        oTbRow.ID = oRow["nKey_Cliente"].ToString() + "row";

                        oCell = new HtmlTableCell();
                        oCell.Attributes.Add("class", "clPanel");
                        cAppLogoCliente oAppLogoCliente = new cAppLogoCliente(ref oConn);
                        oAppLogoCliente.NKey_cliente = oRow["nKey_Cliente"].ToString();
                        //oAppLogoCliente.Tipo = "C";
                        DataTable dtlogo = oAppLogoCliente.Get();
                        if (dtlogo != null)
                        {
                            if (dtlogo.Rows.Count > 0)
                            {
                                Image oImage = new Image();
                                oImage.CssClass = "imgLogoPanel";
                                oImage.ImageUrl = "images/logos/" + dtlogo.Rows[0]["logo_cliente"].ToString();
                                oCell.Controls.Add(oImage);
                            }
                        }
                        oTbRow.Controls.Add(oCell);

                        oCell = new HtmlTableCell();
                        oCell.Attributes.Add("class", "clPanel");
                        oCell.Controls.Add(new LiteralControl("<div class=\"tbTitRow\">" + oRow["nombre_analista"].ToString() + "</div>"));
                        oTbRow.Controls.Add(oCell);


                        oAptPagesKpi = new cAptPagesKpi(ref oConn);
                        //oAptPagesKpi.CodCliente = oRow["nKey_Cliente"].ToString();
                        oAptPagesKpi.CodPage = pCodPage;
                        dtKPIs = oAptPagesKpi.Get();

                        if (dtKPIs != null)
                        {
                            foreach (DataRow oRowKPIs in dtKPIs.Rows)
                            {
                                cIndresultado oIndResultado = new cIndresultado(ref oConn);
                                oIndResultado.Tipo       = oCmbTipoConsulta.Value;
                                oIndResultado.KeyCliente = oRow["nKey_Cliente"].ToString();
                                oIndResultado.KeyTipo    = oRow["nKey_Analista"].ToString();
                                oIndResultado.Indicador  = oRowKPIs["identificador_kpi"].ToString();
                                oIndResultado.IdFecha    = sIdFecha;
                                DataTable tblColumn1 = oIndResultado.Get();
                                if (tblColumn1 != null)
                                {
                                    if (tblColumn1.Rows.Count > 0)
                                    {
                                        string iDato    = (!string.IsNullOrEmpty(tblColumn1.Rows[0]["valor"].ToString()) ? tblColumn1.Rows[0]["valor"].ToString() : "0");
                                        string sKeyTipo = tblColumn1.Rows[0]["nkey_tipo"].ToString();

                                        cIndumbral oIndumbral = new cIndumbral(ref oConn);
                                        oIndumbral.KeyCliente = oRow["nKey_Cliente"].ToString();
                                        oIndumbral.Indicador  = oRowKPIs["identificador_kpi"].ToString();
                                        oIndumbral.KeyTipo    = sKeyTipo;
                                        DataTable tblColumn2 = oIndumbral.Get();
                                        if (tblColumn2 != null)
                                        {
                                            if (tblColumn2.Rows.Count > 0)
                                            {
                                                StringBuilder sNAvance = new StringBuilder();
                                                sNAvance.Append("<div class=\"").Append(oWeb.getColorNumAvance(double.Parse(iDato), tblColumn2));
                                                sNAvance.Append("\">").Append(String.Format("{0:0}", double.Parse(iDato))).Append("</div>");

                                                oCell = new HtmlTableCell();
                                                oCell.Attributes.Add("align", "center");
                                                oCell.Attributes.Add("class", "clDtPanel");
                                                oCell.Controls.Add(new LiteralControl(sNAvance.ToString()));
                                                oTbRow.Controls.Add(oCell);
                                            }
                                        }
                                        tblColumn2 = null;
                                    }
                                    else
                                    {
                                        oCell = new HtmlTableCell();
                                        oCell.Attributes.Add("align", "center");
                                        oCell.Attributes.Add("class", "clDtPanel");
                                        //oCell.Controls.Add(new LiteralControl(""));
                                        oTbRow.Controls.Add(oCell);
                                    }
                                }
                            }
                        }
                        idTblSegNiv.Controls.Add(oTbRow);
                    }
                }
            }
            oConn.Close();
        }
        protected void GridClientes_SelectedIndexChanged(object sender, EventArgs e)
        {
            string pCliente    = GridClientes.SelectedDataKey.Value.ToString();
            string pCodMonitor = CodMonitorView.Value;
            //string pCodPage = hddCodPage.Value;
            string pCodPage = oCmbPages.SelectedValue.ToString();

            DBConn oConn = new DBConn();

            if (oConn.Open())
            {
                string TipoConsulta = "A";
                if (string.IsNullOrEmpty(hddMonitorCreated.Value))
                {
                    cAppPages oAppPages = new cAppPages(ref oConn);
                    oAppPages.CodPage = pCodPage;
                    DataTable dtPage = oAppPages.Get();
                    if (dtPage != null)
                    {
                        if (dtPage.Rows.Count > 0)
                        {
                            if (!string.IsNullOrEmpty(dtPage.Rows[0]["tipo_consulta"].ToString()))
                            {
                                TipoConsulta = dtPage.Rows[0]["tipo_consulta"].ToString();
                            }
                        }
                    }
                    dtPage = null;

                    cAptMonitorPages oAptMonitorPages = new cAptMonitorPages(ref oConn);
                    oAptMonitorPages.CodMonitor = CodMonitorView.Value;
                    DataTable dtMPage = oAptMonitorPages.Get();
                    oAptMonitorPages.OrderPage = (dtMPage.Rows.Count + 1).ToString();
                    dtMPage = null;
                    oAptMonitorPages.CodPage  = pCodPage;
                    oAptMonitorPages.TimePage = txt_time.Text;
                    oAptMonitorPages.EstPage  = "V";
                    if (TipoConsulta != "N")
                    {
                        oAptMonitorPages.TipoUsuario = TipoConsulta;
                    }
                    else
                    {
                        if (string.IsNullOrEmpty(bVista.Value))
                        {
                            oAptMonitorPages.TipoUsuario = "A";
                        }
                        else
                        {
                            oAptMonitorPages.TipoUsuario = "G";
                        }
                    }
                    oAptMonitorPages.Accion = "CREAR";
                    oAptMonitorPages.Put();

                    if (!string.IsNullOrEmpty(oAptMonitorPages.Error))
                    {
                        Response.Write(oAptMonitorPages.Error);
                        Response.End();
                    }

                    hddMonitorCreated.Value = "1";
                }

                cAptClientesMonitorpages oAptClientesMonitorpages = new cAptClientesMonitorpages(ref oConn);
                oAptClientesMonitorpages.CodCliente = pCliente;
                oAptClientesMonitorpages.CodMonitor = pCodMonitor;
                oAptClientesMonitorpages.CodPage    = pCodPage;
                oAptClientesMonitorpages.Accion     = "CREAR";
                oAptClientesMonitorpages.Put();

                btnChangeClientHolding.Visible = false;
            }
            oConn.Close();
            LoadGrid();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            oWeb.ValidaSessionAdm();
            if (!IsPostBack)
            {
                CodMonitorView.Value = oWeb.GetData("CodMonitorView");
                DBConn oConn = new DBConn();
                if (oConn.Open())
                {
                    if (string.IsNullOrEmpty(CodMonitorView.Value))
                    {
                        cAppTipoConnsulta oAppTipoConnsulta = new cAppTipoConnsulta(ref oConn);
                        DataTable         dtTipoConsulta    = oAppTipoConnsulta.Get();

                        if (dtTipoConsulta != null)
                        {
                            if (dtTipoConsulta.Rows.Count > 0)
                            {
                                oCmbTipoConsulta.Items.Add(new RadComboBoxItem("Seleccione Tipo Consulta", ""));
                                foreach (DataRow oRow in dtTipoConsulta.Rows)
                                {
                                    oCmbTipoConsulta.Items.Add(new RadComboBoxItem(oRow["nom_tipo"].ToString(), oRow["cod_tipo"].ToString()));
                                }
                            }
                        }
                        dtTipoConsulta = null;
                    }
                    else
                    {
                        cAppTipoConnsulta oAppTipoConnsulta = new cAppTipoConnsulta(ref oConn);
                        oAppTipoConnsulta.CodMonitor = CodMonitorView.Value;
                        DataTable dtTipoConsulta = oAppTipoConnsulta.GetByMonitor();

                        if (dtTipoConsulta != null)
                        {
                            if (dtTipoConsulta.Rows.Count > 0)
                            {
                                oCmbTipoConsulta.Items.Add(new RadComboBoxItem("Seleccione Tipo Consulta", ""));
                                foreach (DataRow oRow in dtTipoConsulta.Rows)
                                {
                                    oCmbTipoConsulta.Items.Add(new RadComboBoxItem(oRow["nom_tipo"].ToString(), oRow["cod_tipo"].ToString()));
                                }
                            }
                        }
                        dtTipoConsulta = null;

                        btnGrabar1.Visible = false;
                        cAppMonitorView oAppMonitorView = new cAppMonitorView(ref oConn);
                        oAppMonitorView.CodMonitor = CodMonitorView.Value;
                        DataTable dtMonitorView = oAppMonitorView.Get();
                        if (dtMonitorView != null)
                        {
                            if (dtMonitorView.Rows.Count > 0)
                            {
                                txt_nombre.Text = dtMonitorView.Rows[0]["desc_monitor_view"].ToString();
                                oCmbEstado.Items.FindByValue(dtMonitorView.Rows[0]["est_monitor_view"].ToString()).Selected = true;
                            }
                            dtMonitorView.Dispose();
                        }
                        dtMonitorView = null;

                        txt_nombre.Enabled  = false;
                        oCmbEstado.Enabled  = false;
                        trPagesView.Visible = true;

                        cAptMonitorPages oAptMonitorPages = new cAptMonitorPages(ref oConn);
                        oAptMonitorPages.CodMonitor = CodMonitorView.Value;
                        gridPages.DataSource        = oAptMonitorPages.Get();
                        gridPages.DataBind();

                        hddMonitorCreated.Value = "1";
                    }

                    oConn.Close();
                }
            }
            else
            {
                if (!string.IsNullOrEmpty(oWeb.GetData("hddReload")))
                {
                    hddReload.Value = string.Empty;
                    oCmbTipoConsulta.FindItemByValue("").Selected = true;
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            DBConn        oConn = new DBConn();
            Web           oWeb  = new Web();
            StringBuilder sNAvance;
            string        pCodMonitor    = oWeb.GetData("codmonitor");
            string        pCodUsuario    = oWeb.GetData("codusuario");
            string        pAuthenCodUser = oWeb.GetData("authuser");
            string        indexToken     = oWeb.GetData("indexToken");

            string pCodPage      = string.Empty;
            string pOrderPage    = oWeb.GetData("order");
            string pCodCliente   = string.Empty;
            string pTipoConsulta = string.Empty;
            string pTipoCliente  = string.Empty;
            string sIdFecha      = string.Empty;
            string iDato         = "0";
            string sKeyTipo      = string.Empty;

            if (!string.IsNullOrEmpty(pAuthenCodUser))
            {
                AuthenticUser(pAuthenCodUser);
            }

            oWeb.ValidaUserPanel();

            int maxdt = (new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMonths(1).AddDays(-1)).Day;

            firtDay.InnerText = "01-" + DateTime.Now.ToString("MM-yyyy");
            lastDay.InnerText = maxdt.ToString() + "-" + DateTime.Now.ToString("MM-yyyy");

            if (!IsPostBack)
            {
                if (oConn.Open())
                {
                    cAptMonitorPages oAptMonitorPages = new cAptMonitorPages(ref oConn);
                    oAptMonitorPages.CodMonitor = pCodMonitor;
                    oAptMonitorPages.OrderPage  = pOrderPage;
                    DataTable dtMPage = oAptMonitorPages.Get();

                    if (dtMPage != null)
                    {
                        if (dtMPage.Rows.Count > 0)
                        {
                            pCodPage      = dtMPage.Rows[0]["cod_page"].ToString();
                            pTipoConsulta = dtMPage.Rows[0]["tipo_usuario"].ToString();
                            if (!string.IsNullOrEmpty(dtMPage.Rows[0]["cod_cliente"].ToString()))
                            {
                                pCodCliente  = dtMPage.Rows[0]["cod_cliente"].ToString();
                                pTipoCliente = "C";
                            }
                            else if (!string.IsNullOrEmpty(dtMPage.Rows[0]["cod_holding"].ToString()))
                            {
                                pCodCliente  = dtMPage.Rows[0]["cod_holding"].ToString();
                                pTipoCliente = "H";
                            }
                            else
                            {
                                cCliente  oCliente  = new cCliente(ref oConn);
                                DataTable dtCliente = oCliente.Get();
                                if (!string.IsNullOrEmpty(indexToken))
                                {
                                    pCodCliente = dtCliente.Rows[Convert.ToInt32(Session[indexToken].ToString())]["nkey_cliente"].ToString();
                                }
                                else
                                {
                                    pCodCliente = dtCliente.Rows[Convert.ToInt32(Session["indexcliente"].ToString())]["nkey_cliente"].ToString();
                                }
                                dtCliente = null;
                            }
                        }
                    }
                    dtMPage = null;

                    oCmbTipoConsulta.Value = pTipoConsulta;
                    oCmbCliente.Value      = pCodCliente;

                    if (oCmbTipoConsulta.Value == "S")
                    {
                        pie.Attributes.Add("class", "tdPieManagers");
                        lblSubTitle.Text = "Medición de Managers";
                    }
                    else
                    {
                        pie.Attributes.Add("class", "tdPieEjecutivos");
                        lblSubTitle.Text = "Medición de Ejecutivos";
                    }

                    if (!string.IsNullOrEmpty(oCmbCliente.Value))
                    {
                        cAppLogoCliente oAppLogoCliente = new cAppLogoCliente(ref oConn);
                        oAppLogoCliente.NKey_cliente = pCodCliente;
                        oAppLogoCliente.Tipo         = (pTipoCliente == "H" ? pTipoCliente : "C");
                        DataTable dtlogo = oAppLogoCliente.Get();
                        if (dtlogo != null)
                        {
                            if (dtlogo.Rows.Count > 0)
                            {
                                imglogo.ImageUrl = "images/logos/" + dtlogo.Rows[0]["logo_cliente"].ToString();
                            }
                        }
                    }
                    else
                    {
                        imglogo.Visible = false;
                    }
                }
                oConn.Close();
            }

            if (oConn.Open())
            {
                if (!IsPostBack)
                {
                    cCliente oCliente = new cCliente(ref oConn);
                    oCliente.NKey_cliente = oCmbCliente.Value;
                    DataTable tblCliente = oCliente.Get();
                    if (!string.IsNullOrEmpty(oCliente.Error))
                    {
                        Response.Write(oCliente.Query);
                        Response.End();
                    }
                    if (tblCliente != null)
                    {
                        if (tblCliente.Rows.Count > 0)
                        {
                            hddNCod.Value = tblCliente.Rows[0]["ncod"].ToString();
                        }
                    }
                    tblCliente.Dispose();
                    tblCliente = null;
                }
                cIndejecucion oIndejecucion = new cIndejecucion(ref oConn);
                DataTable     tblEjecucion  = oIndejecucion.Get();
                if (tblEjecucion != null)
                {
                    if (tblEjecucion.Rows.Count > 0)
                    {
                        sIdFecha = tblEjecucion.Rows[0]["idfecha"].ToString();
                    }
                    tblEjecucion.Dispose();
                }
                tblEjecucion = null;

                DateTime idFechaMesAnterior = new DateTime(Int32.Parse(sIdFecha.Substring(0, 4)), Int32.Parse(sIdFecha.Substring(4, 2)), Int32.Parse(sIdFecha.Substring(6, 2)), Int32.Parse(sIdFecha.Substring(8, 2)), Int32.Parse(sIdFecha.Substring(10, 2)), 0);
                idFechaMesAnterior = idFechaMesAnterior.AddMonths(-1);

                HtmlTableCell htmlTblCell;
                cAnalista     oAnalista = new cAnalista(ref oConn);
                oAnalista.NCod         = hddNCod.Value;
                oAnalista.TipoAnalista = oCmbTipoConsulta.Value;
                DataTable tblAnalista = oAnalista.Get();
                if (tblAnalista != null)
                {
                    foreach (DataRow oRow in tblAnalista.Rows)
                    {
                        htmlTblCell = new HtmlTableCell();
                        htmlTblCell.Controls.Add(new LiteralControl("<div class=\"tbTit\">" + oRow["snombre"].ToString() + "</div>"));
                        trCabecera.Controls.Add(htmlTblCell);
                    }
                }
                tblAnalista.Dispose();
                tblAnalista = null;
                DataTable tblColumn2;

                HtmlGenericControl oDivImg;
                DataTable          tblColumn1;
                cIndresultado      oIndResultado;
                cIndumbral         oIndumbral;

                cAptPagesKpi oAptPagesKpi = new cAptPagesKpi(ref oConn);
                oAptPagesKpi.CodCliente = pCodUsuario;
                oAptPagesKpi.CodPage    = pCodPage;
                DataTable dtKPIs = oAptPagesKpi.Get();
                if (dtKPIs != null)
                {
                    foreach (DataRow oRowKpi in dtKPIs.Rows)
                    {
                        iDato    = string.Empty;
                        sKeyTipo = string.Empty;
                        HtmlTableCell HtmlTablecell;

                        HtmlTablecell = new HtmlTableCell();
                        StringBuilder sNomKpi = new StringBuilder();
                        sNomKpi.Append("<td class=\"clPanel\"><div class=\"tbTTitRow\">");
                        sNomKpi.Append(oRowKpi["nombrekpi"].ToString());
                        sNomKpi.Append("</div></td>");
                        HtmlTablecell.Controls.Add(new LiteralControl(sNomKpi.ToString()));
                        HtmlTableRow htmlTblRowKpi = new HtmlTableRow();
                        htmlTblRowKpi.ID = oRowKpi["cod_kpi"].ToString() + "_KPI";
                        htmlTblRowKpi.Controls.Add(HtmlTablecell);
                        tbl.Controls.Add(htmlTblRowKpi);

                        HtmlTablecell = new HtmlTableCell();
                        StringBuilder sCriterioAceptacion = new StringBuilder();
                        sCriterioAceptacion.Append("<td class=\"clPanel\"><div class=\"tbTitRow\">Criterio Aceptación</div></td>");
                        HtmlTablecell.Controls.Add(new LiteralControl(sCriterioAceptacion.ToString()));
                        HtmlTableRow htmlTblRowCriAcep = new HtmlTableRow();
                        htmlTblRowCriAcep.ID = oRowKpi["cod_kpi"].ToString() + "_CriAcept";
                        htmlTblRowCriAcep.Controls.Add(HtmlTablecell);
                        tbl.Controls.Add(htmlTblRowCriAcep);

                        HtmlTablecell = new HtmlTableCell();
                        StringBuilder sCriterioSLA = new StringBuilder();
                        sCriterioSLA.Append("<td class=\"clPanel\"><div class=\"tbTitRow\">SLA</div></td>");
                        HtmlTablecell.Controls.Add(new LiteralControl(sCriterioSLA.ToString()));
                        HtmlTableRow htmlTblRowSLA = new HtmlTableRow();
                        htmlTblRowSLA.ID = oRowKpi["cod_kpi"].ToString() + "_SLA";
                        htmlTblRowSLA.Controls.Add(HtmlTablecell);
                        tbl.Controls.Add(htmlTblRowSLA);

                        HtmlTablecell = new HtmlTableCell();
                        StringBuilder sCriterioMesAnte = new StringBuilder();
                        sCriterioMesAnte.Append("<td class=\"clPanel\"><div class=\"tbTitRow\">Mes Anterior</div></td>");
                        HtmlTablecell.Controls.Add(new LiteralControl(sCriterioMesAnte.ToString()));
                        HtmlTableRow htmlTblRowMesAnt = new HtmlTableRow();
                        htmlTblRowMesAnt.ID = oRowKpi["cod_kpi"].ToString() + "_MesAnt";
                        htmlTblRowMesAnt.Controls.Add(HtmlTablecell);
                        tbl.Controls.Add(htmlTblRowMesAnt);

                        HtmlTableRow htmlTblRow = new HtmlTableRow();
                        htmlTblRow.ID = oRowKpi["cod_kpi"].ToString() + "row";
                        HtmlTablecell = new HtmlTableCell();
                        HtmlTablecell.Controls.Add(new LiteralControl("<td colspan=\"20\" style=\"height: 10px; \"></td>"));
                        htmlTblRow.Controls.Add(HtmlTablecell);
                        tbl.Controls.Add(htmlTblRow);

                        oAnalista              = new cAnalista(ref oConn);
                        oAnalista.NCod         = hddNCod.Value;
                        oAnalista.TipoAnalista = oCmbTipoConsulta.Value;
                        tblAnalista            = oAnalista.Get();

                        if (tblAnalista != null)
                        {
                            foreach (DataRow oRow in tblAnalista.Rows)
                            {
                                oIndResultado            = new cIndresultado(ref oConn);
                                oIndResultado.Tipo       = oCmbTipoConsulta.Value;
                                oIndResultado.KeyCliente = oCmbCliente.Value;
                                oIndResultado.KeyTipo    = oRow["nKey_Analista"].ToString();
                                oIndResultado.Indicador  = oRowKpi["identificador_kpi"].ToString();
                                oIndResultado.IdFecha    = sIdFecha;
                                tblColumn1 = oIndResultado.Get();
                                if (tblColumn1 != null)
                                {
                                    if (tblColumn1.Rows.Count > 0)
                                    {
                                        iDato    = (!string.IsNullOrEmpty(tblColumn1.Rows[0]["valor"].ToString()) ? tblColumn1.Rows[0]["valor"].ToString() : "0");
                                        sKeyTipo = tblColumn1.Rows[0]["nkey_tipo"].ToString();

                                        oIndumbral            = new cIndumbral(ref oConn);
                                        oIndumbral.KeyCliente = oCmbCliente.Value;
                                        oIndumbral.Indicador  = oRowKpi["identificador_kpi"].ToString();
                                        oIndumbral.KeyTipo    = sKeyTipo;
                                        tblColumn2            = oIndumbral.Get();
                                        if (tblColumn2 != null)
                                        {
                                            if (tblColumn2.Rows.Count > 0)
                                            {
                                                sNAvance = new StringBuilder();
                                                sNAvance.Append("<div class=\"").Append(oWeb.getColorNumAvance(double.Parse(iDato), tblColumn2));
                                                sNAvance.Append("\">").Append(String.Format("{0:0}", double.Parse(iDato))).Append("</div>");

                                                htmlTblCell = new HtmlTableCell();
                                                htmlTblCell.Attributes.Add("align", "center");
                                                htmlTblCell.Attributes.Add("class", "clDtPanel");
                                                htmlTblCell.Controls.Add(new LiteralControl(sNAvance.ToString()));
                                                htmlTblRowKpi.Controls.Add(htmlTblCell);

                                                htmlTblCell = new HtmlTableCell();
                                                htmlTblCell.Attributes.Add("class", "clDtPanel");
                                                htmlTblCell.Controls.Add(new LiteralControl("<div class=\"tbDat\">" + tblColumn2.Rows[0]["criterio_aceptacion"].ToString() + " " + tblColumn2.Rows[0]["unidad"].ToString() + "</div>"));
                                                htmlTblRowCriAcep.Controls.Add(htmlTblCell);

                                                htmlTblCell = new HtmlTableCell();
                                                htmlTblCell.Attributes.Add("class", "clDtPanel");
                                                htmlTblCell.Controls.Add(new LiteralControl("<div class=\"tbDat\">" + tblColumn2.Rows[0]["sla"].ToString() + "</div>"));
                                                htmlTblRowSLA.Controls.Add(htmlTblCell);
                                            }
                                            tblColumn2.Dispose();
                                        }
                                        tblColumn2 = null;
                                    }
                                    tblColumn1.Dispose();
                                }
                                tblColumn1            = null;
                                oIndResultado.IdFecha = idFechaMesAnterior.ToString("yyyyMMddHHmm");
                                tblColumn1            = oIndResultado.GetMesAnterior();
                                if (tblColumn1 != null)
                                {
                                    if (tblColumn1.Rows.Count > 0)
                                    {
                                        htmlTblCell = new HtmlTableCell();
                                        htmlTblCell.Attributes.Add("class", "clDtPanel");

                                        oDivImg = new HtmlGenericControl("div");
                                        oDivImg.Attributes.Add("class", "tbDat");

                                        oDivImg.Controls.Add(new LiteralControl("<img src=\"" + oWeb.getColorArrowCalidad(double.Parse(iDato), double.Parse(tblColumn1.Rows[0]["valor"].ToString())) + "\" border=\"0\">"));

                                        htmlTblCell.Controls.Add(oDivImg);
                                        htmlTblRowMesAnt.Controls.Add(htmlTblCell);
                                    }
                                    tblColumn1.Dispose();
                                }
                                tblColumn1 = null;
                            }
                            oIndResultado = null;
                        }
                    }
                    tblAnalista = null;
                }
                dtKPIs = null;
            }
            oConn.Close();
        }
Beispiel #13
0
        protected void gridPages_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            try
            {
                DBConn oConn = new DBConn();
                if (oConn.Open())
                {
                    string pCodMonitor = gridPages.DataKeys[e.RowIndex].Value.ToString();

                    cAptMonitorMensaje oAptMonitorMensaje = new cAptMonitorMensaje(ref oConn);
                    oAptMonitorMensaje.CodMonitor = pCodMonitor;
                    oAptMonitorMensaje.Accion     = "ELIMINAR";
                    oAptMonitorMensaje.Put();

                    if (!string.IsNullOrEmpty(oAptMonitorMensaje.Error))
                    {
                        Response.Write(oAptMonitorMensaje.Error);
                        Response.End();
                    }

                    cAptClientesMonitorpages oAptClientesMonitorpages = new cAptClientesMonitorpages(ref oConn);
                    oAptClientesMonitorpages.CodMonitor = pCodMonitor;
                    oAptClientesMonitorpages.Accion     = "ELIMINAR";
                    oAptClientesMonitorpages.Put();
                    if (!string.IsNullOrEmpty(oAptClientesMonitorpages.Error))
                    {
                        Response.Write(oAptClientesMonitorpages.Error);
                        Response.End();
                    }

                    cAptMonitorPages oAptMonitorPages = new cAptMonitorPages(ref oConn);
                    oAptMonitorPages.CodMonitor = pCodMonitor;
                    oAptMonitorPages.Accion     = "ELIMINAR";
                    oAptMonitorPages.Put();

                    if (!string.IsNullOrEmpty(oAptMonitorPages.Error))
                    {
                        Response.Write(oAptMonitorPages.Error);
                        Response.End();
                    }

                    cAppVistasCliente oAppVistasCliente = new cAppVistasCliente(ref oConn);
                    oAppVistasCliente.CodMonitor = pCodMonitor;
                    oAppVistasCliente.Accion     = "ELIMINAR";
                    oAppVistasCliente.Put();

                    if (!string.IsNullOrEmpty(oAppVistasCliente.Error))
                    {
                        Response.Write(oAppVistasCliente.Error);
                        Response.End();
                    }

                    cAppMonitorView oAppMonitorView = new cAppMonitorView(ref oConn);
                    oAppMonitorView.CodMonitor = pCodMonitor;
                    oAppMonitorView.Accion     = "ELIMINAR";
                    oAppMonitorView.Put();

                    if (!string.IsNullOrEmpty(oAptMonitorPages.Error))
                    {
                        Response.Write(oAptMonitorPages.Error);
                        Response.End();
                    }

                    oConn.Close();
                }
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message + "; " + ex.InnerException.ToString());
            }
            LoadGrid();
        }