protected void btnGrabar1_Click(object sender, EventArgs e)
        {
            DBConn oConn = new DBConn();

            if (oConn.Open())
            {
                cAppMonitorView oAppMonitorView = new cAppMonitorView(ref oConn);
                oAppMonitorView.CodMonitor      = CodMonitorView.Value;
                oAppMonitorView.DescMonitorView = txt_nombre.Text;
                //oAppMonitorView.TipoUsuario = oCmbTipoConsulta.SelectedValue;
                oAppMonitorView.EstMonitorView = oCmbEstado.SelectedValue;
                //oAppMonitorView.CodCliente = (!string.IsNullOrEmpty(oCmbCliente.SelectedValue) ? oCmbCliente.SelectedValue : null);
                oAppMonitorView.Accion = (string.IsNullOrEmpty(CodMonitorView.Value) ? "CREAR" : "EDITAR");
                oAppMonitorView.Put();

                if (!string.IsNullOrEmpty(oAppMonitorView.Error))
                {
                    Response.Write("Error : " + oAppMonitorView.Error + "<br>");
                    Response.End();
                }

                CodMonitorView.Value = oAppMonitorView.CodMonitor;
                btnGrabar1.Visible   = false;
                txt_nombre.Enabled   = false;
                //oCmbTipoConsulta.Enabled = false;
                oCmbEstado.Enabled = false;
                //oCmbCliente.Enabled = false;
                trPagesView.Visible = true;

                oConn.Close();
            }
        }
示例#2
0
        protected void LoadGrid()
        {
            DBConn oConn = new DBConn();

            if (oConn.Open())
            {
                cAppMonitorView oAppMonitorView = new cAppMonitorView(ref oConn);
                gridVistas.DataSource = oAppMonitorView.Get();
                gridVistas.DataBind();

                oConn.Close();
            }
        }
        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;
                }
            }
        }
示例#4
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();
        }