예제 #1
0
 protected void btnCreateMinor_Click(object sender, EventArgs e)
 {
     try
     {
         string[] cadena = ddlMinors.SelectedItem.Text.Split(' ');
         Relacion rel    = new Relacion()
         {
             Id_Tipo_Relacion          = 3,
             Numero_Fuente             = int.Parse(txtNumero.Text),
             Numero_Fuente_Relacionada = int.Parse(cadena[0].TrimEnd(' '))
         };
         if (rel.Create())
         {
             lblMinors.Text = "Minor agregada correctamente.";
             CargarRelaciones();
         }
         else
         {
             lblMinors.Text = "Minor no agregada.";
         }
     }
     catch (Exception ex)
     {
         lblMinors.Text = "Error al agregar Minor.";
     }
 }
예제 #2
0
 protected void btnCreateDestino_Click(object sender, EventArgs e)
 {
     try
     {
         string[] cadena = ddlDestinos.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.Create() && rel2.Create())
         {
             lblDestinos.Text = "Destino agregado correctamente.";
             CargarRelaciones();
         }
         else
         {
             lblDestinos.Text = "Destino no agregado.";
         }
     }
     catch (Exception ex)
     {
         lblDestinos.Text = "Error al agregar destino.";
     }
 }