Пример #1
0
        protected void btnSeleccionar_onclick(object sender, System.EventArgs e)
        {
            if (usuario.Tipo_Usuario == 3)
            {
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(),
                                                    "err_msg",
                                                    "alert('Su perfil no permite editar fuentes.');",
                                                    true);
            }
            else
            {
                Button      btn    = (Button)sender;
                GridViewRow row    = (GridViewRow)btn.NamingContainer;
                string      codigo = row.Cells[1].Text;

                Fuentes fuente = new Fuentes()
                {
                    Numero_Fuente = int.Parse(codigo),
                };
                fuente.Read();
                descripcionFuente = fuente;

                Relacion x = new Relacion()
                {
                    Id_Tipo_Relacion = int.Parse(codigo),
                };
                x.Read();
                relacion = x;

                Response.BufferOutput = true;
                Response.Redirect("Mant_Fuentes.aspx");
            }
        }
Пример #2
0
 protected void btnDeleteDestino_Click(object sender, EventArgs e)
 {
     try
     {
         string[] cadena = lbDestinos.SelectedItem.Text.Split(' ');
         Relacion rel    = new Relacion()
         {
             Id_Tipo_Relacion          = 2,
             Numero_Fuente             = int.Parse(txtNumero.Text),
             Numero_Fuente_Relacionada = int.Parse(cadena[0].TrimEnd(' '))
         };
         Relacion rel2 = new Relacion()
         {
             Id_Tipo_Relacion          = 1,
             Numero_Fuente             = int.Parse(cadena[0].TrimEnd(' ')),
             Numero_Fuente_Relacionada = int.Parse(txtNumero.Text)
         };
         if (rel.Delete())
         {
             if (rel2.Read())
             {
                 rel2.Delete();
                 lblDestinos.Text = "Destino eliminado correctamente.";
                 CargarRelaciones();
             }
             else
             {
                 lblDestinos.Text = "Destino eliminado correctamente.";
                 CargarRelaciones();
             }
         }
         else
         {
             lblDestinos.Text = "Destino no eliminado.";
         }
     }
     catch (Exception ex)
     {
         lblDestinos.Text = "Error al eliminar Destino.";
     }
 }