Beispiel #1
0
 //Select
 public void LoadDataGrid()
 {
     try
     {
         implhorario          = new HorarioImpl();
         dgvDatos.ItemsSource = null;
         dgvDatos.ItemsSource = implhorario.Select().DefaultView;
         MessageBox.Show("a");
     }
     catch (Exception ex) { MessageBox.Show(ex.Message); }
 }
Beispiel #2
0
 private void AceptarInsert_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         horario     = new Horario(comboday.Text, TimeInicio.SelectedTime.Value, TimeFin.SelectedTime.Value);
         implhorario = new HorarioImpl();
         int res = implhorario.Insert(horario);
         if (res > 0)
         {
             MessageBox.Show("Teacher insert successfully!!!");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Beispiel #3
0
        private void DgvDatos_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e)
        {
            if (dgvDatos.Items.Count > 0 && dgvDatos.SelectedItem != null)
            {
                try
                {
                    DataRowView dataRow = (DataRowView)dgvDatos.SelectedItem;
                    byte        id      = byte.Parse(dataRow.Row.ItemArray[0].ToString());

                    implhorario = new HorarioImpl();
                    horario     = implhorario.Get(id);
                    MessageBox.Show(horario.estado.ToString());
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
Beispiel #4
0
 private void AceptarEliminar_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         int id = int.Parse(txtIdDel.Text);
         horario     = new Horario(short.Parse(txtIdDel.Text));
         implhorario = new HorarioImpl();
         int res = implhorario.Delete(horario);
         if (res > 0)
         {
             MessageBox.Show("Horario eliminado con éxito");
         }
         else
         {
             MessageBox.Show("Horario no eliminado");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Beispiel #5
0
 private void AceptarModif_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         int id = int.Parse(txtId.Text);
         horario     = new Horario(TimeInicioModif.SelectedTime.Value, TimeFinModif.SelectedTime.Value, ComboModif.Text, short.Parse(txtId.Text));
         implhorario = new HorarioImpl();
         int res = implhorario.Update(horario);
         if (res > 0)
         {
             MessageBox.Show("Horario modificado con éxito");
         }
         else
         {
             MessageBox.Show("Horario no modificado");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }