Exemplo n.º 1
0
        private void MainGrid_RowEditEnding(object sender, DataGridRowEditEndingEventArgs e)
        {
            var s = e.Row;
            var c = s.Item as DB.Client;

            entities.Clients.AddOrUpdate(c);
            entities.SaveChanges();
            Refresh();
        }
Exemplo n.º 2
0
 public void  AddServis()
 {
     try
     {
         entities.Services.AddOrUpdate(Service);
         entities.SaveChanges();
     }
     catch
     {
         throw new Exception("Ошибка сохранения в бд");
     }
 }
Exemplo n.º 3
0
        private void add_Click(object sender, RoutedEventArgs e)
        {
            var      cl     = cbClient.SelectedItem as DB.Client;
            var      servis = cbServis.SelectedItem as DB.Service;
            DateTime date   = dtMaim.Value.GetValueOrDefault();


            DB.DETLT2020Entities entities = new DB.DETLT2020Entities();

            var s = new DB.ClientService();

            s.ServiceID = servis.ID;
            s.ClientID  = cl.ID;

            s.StartTime = date;

            s.Comment = "lyalya";


            entities.ClientServices.Add(s);

            entities.SaveChanges();

            MessageBox.Show("Запись  сохранне  в бд");
        }
Exemplo n.º 4
0
        private void add_Click(object sender, RoutedEventArgs e)
        {
            newClient = mainGrid.DataContext as DB.Client;

            var gender = cbGender.SelectedItem as DB.Gender;

            newClient.GenderCode = gender.Code;

            newClient.RegistrationDate = dt2.DisplayDate;

            newClient.Birthday = dt.SelectedDate;


            try
            {
                DB.DETLT2020Entities entities = new DB.DETLT2020Entities();
                entities.Clients.Add(newClient);

                entities.SaveChanges();

                MessageBox.Show("сохранение прошло  успешно");

                DialogResult = true;
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// Сохранияет  изменения
 /// </summary>
 public void Save()
 {
     entities.SaveChanges();
 }