public WriteClientService() { InitializeComponent(); Database.masterEntities entities = new Database.masterEntities(); cbClients.ItemsSource = entities.Client.ToList(); cbService.ItemsSource = entities.Service.ToList(); }
public EditForm(ServiceW serviceW) { InitializeComponent(); Database.masterEntities entities = new Database.masterEntities(); newServis = entities.Service.Find(serviceW.ID); mainGrid.DataContext = newServis; base.Title = "Редактиравть"; base.btSave.Content = "Edit"; }
public SerivceController() { ServiceWs = new List <ServiceW>(); Database.masterEntities entities = new Database.masterEntities(); List <Database.Service> services = entities.Service.ToList(); services = entities.Service.ToList(); foreach (var item in services) { ServiceW serviceW = new ServiceW(item); ServiceWs.Add(serviceW); } }
protected virtual void Button_Click(object sender, RoutedEventArgs e) { try { Database.masterEntities entities = new Database.masterEntities(); newServis = mainGrid.DataContext as Database.Service; entities.Service.AddOrUpdate(newServis); entities.SaveChanges(); MessageBox.Show("OK"); this.DialogResult = true; this.Close(); } catch (Exception ex) { MessageBox.Show("Ошибка " + ex.Message, "error", MessageBoxButton.OK, MessageBoxImage.Error); } }
public ClientService() { InitializeComponent(); Database.masterEntities entities = new Database.masterEntities(); dataGridMain.ItemsSource = entities.ClientService.ToList(); }