Example #1
0
 private void btnCrear_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (!(String.IsNullOrEmpty(txtNombre.Text) || String.IsNullOrEmpty(txtCupos.Text) || String.IsNullOrEmpty(txtAlumMax.Text) ||
               String.IsNullOrEmpty(txtAlumMin.Text)) || String.IsNullOrEmpty(dp_fecha_inicio.Text) || String.IsNullOrEmpty(dp_fecha_termino.Text))
         {
             Biblioteca.Programa programa = new Biblioteca.Programa()
             {
                 Id_programa   = 0,
                 Nombre        = txtNombre.Text,
                 Fecha_inicio  = DateTime.Parse(dp_fecha_inicio.Text),
                 Fecha_termino = DateTime.Parse(dp_fecha_termino.Text),
                 Alum_max      = int.Parse(txtAlumMax.Text),
                 Alum_min      = int.Parse(txtAlumMin.Text),
                 Cupos         = int.Parse(txtCupos.Text),
                 Estado        = "D"
             };
             lblMsj.Content = programa.crud(1);
         }
         else
         {
             lblMsj.Content = "Llene todos los campos.";
         }
     }
     catch (Exception ex)
     {
         lblMsj.Content = "Error: " + ex;
     }
 }
 private void btnPublicar_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         Biblioteca.Programa programa = new Biblioteca.Programa()
         {
             Id_programa = int.Parse(cbprogramas.SelectedItem.ToString().Split()[0])
         };
         programa.publicar();
         lblMsj.Content = programa.publicar();
     }
     catch (Exception ex)
     {
         lblMsj.Content = "Error: " + ex;
     }
 }
Example #3
0
 private void btnAgregarRamo_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         Biblioteca.Programa programa = new Biblioteca.Programa()
         {
             Id_programa = int.Parse(cbprogramas.SelectedItem.ToString().Split()[0])
         };
         lblMsj.Content = programa.agregarRamo(int.Parse(cbRamos.SelectedItem.ToString().Split()[0]));
         programa.read();
         listbox.ItemsSource = programa.listaRamos;
     }
     catch (Exception ex)
     {
         lblMsj.Content = "Error: " + ex;
     }
 }
 private void cbprogramas_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     try
     {
         Biblioteca.Programa programa = new Biblioteca.Programa()
         {
             Id_programa = int.Parse(cbprogramas.SelectedItem.ToString().Split()[0])
         };
         programa.read();
         txtNombre.Text        = programa.Nombre;
         txtCupos.Text         = programa.Cupos.ToString();
         txtAlumMax.Text       = programa.Alum_max.ToString();
         txtAlumMin.Text       = programa.Alum_min.ToString();
         dp_fecha_inicio.Text  = programa.Fecha_inicio.ToString();
         dp_fecha_termino.Text = programa.Fecha_termino.ToString();
     }
     catch (Exception ex)
     {
         lblMsj.Content = "Error: " + ex;
     }
 }
Example #5
0
        private void cbprogramas_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                Biblioteca.Programa programa = new Biblioteca.Programa()
                {
                    Id_programa = int.Parse(cbprogramas.SelectedItem.ToString().Split()[0])
                };

                programa.read();
                listbox.ItemsSource = programa.listaRamos;
                listbox.IsEnabled   = true;
                llenarRamos();
                cbRamos.IsEnabled        = true;
                btnAgregarRamo.IsEnabled = true;
            }
            catch (Exception ex)
            {
                lblMsj.Content = "Error: " + ex;
            }
        }