コード例 #1
0
ファイル: ClienrForm.xaml.cs プロジェクト: frakiec89/Demo2
        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();
        }
コード例 #2
0
 public void  AddServis()
 {
     try
     {
         entities.Services.AddOrUpdate(Service);
         entities.SaveChanges();
     }
     catch
     {
         throw new Exception("Ошибка сохранения в бд");
     }
 }
コード例 #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("Запись  сохранне  в бд");
        }
コード例 #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);
            }
        }
コード例 #5
0
ファイル: ServisesContoller.cs プロジェクト: frakiec89/ToDoUp
 /// <summary>
 /// Сохранияет  изменения
 /// </summary>
 public void Save()
 {
     entities.SaveChanges();
 }