Exemplo n.º 1
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     try
     {
         PSSCEntities Con = new PSSCEntities();
         List <TABELA_CONSULTATIE> TableData = Con.TABELA_CONSULTATIE.ToList();
         grd_consult.ItemsSource = TableData;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Exemplo n.º 2
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         var context = new PSSCEntities();
         var consult = new TABELA_CONSULTATIE()
         {
             NUME_PACIENT = tb_numepacient.Text,
             CABINET      = Convert.ToString(cb_cabinet.SelectedItem).Split(' ')[1],
             NUME_MEDIC   = Convert.ToString(cb_medic.SelectedItem).Split(' ')[1],
             PROBLEMA     = Convert.ToString(tb_problema.Text),
             DATA         = Convert.ToString(dt_data.SelectedDate).Split(' ')[0],
             ORA          = Convert.ToString(cb_ora.SelectedItem).Split(' ')[1]
         };
         context.TABELA_CONSULTATIE.Add(consult);
         context.SaveChanges();
         MessageBox.Show("Programare adaugata!", "Adaugat!", MessageBoxButton.OK);
     }
     catch
     {
         MessageBox.Show("Eroare la adaugare", "Eroare!", MessageBoxButton.OK);
     }
 }