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;
            }
        }
        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();
        }
Beispiel #3
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();
        }