public void LoadInfoFromDb() { TextBlockCompanyName.Text = Database.GetCompanyDetails().CompanyName; DataGridClients.ItemsSource = Database.Credentials.GetOnlyClients().Include(c => c.PersonalData).ToList(); DataGridEmployees.ItemsSource = Database.Credentials.GetOnlyEmployees().Include(c => c.PersonalData).ToList(); DataGridProducts.ItemsSource = Database.StoreItems.GetOnlyProducts().Include(c => c.AttributeProductPairs).ThenInclude(ap => ap.ProductAttribute).ToList(); DataGridServices.ItemsSource = Database.StoreItems.GetOnlyServices().Include(c => c.AttributeProductPairs).ThenInclude(ap => ap.ProductAttribute).ToList(); DataGridPurchases.ItemsSource = Database.Purchases.Include(p => p.Credentials).Include(p => p.StoreItem).ToList(); }
public LoginWindow() { InitializeComponent(); _db = new MechanicDatabase(); _db.NotifyAboutAction += (message) => { MessageBox.Show(message); }; _db.FillDefaultInfo(); _model = new LoginModel(); this.DataContext = _model; TextBlockCompanyName.Text = _db.GetCompanyDetails().CompanyName; }
private void Button_Click_ApplyChanges(object sender, RoutedEventArgs e) { if (_model.IsValid() is not true) { MessageBox.Show("ОШИБКА: проверьте правильность введённых данных"); return; } var settings = _db.GetCompanyDetails(); settings.CompanyName = _model.CompanyName; settings.Address = _model.Address; settings.Phone = _model.Phone; _db.SaveChanges(); _w.LoadInfoFromDb(); }
public SettingsWindow(MainWindow w) { InitializeComponent(); _w = w; _db = _w.Database; var settings = _db.GetCompanyDetails(); _model = new SettingsModel() { CompanyName = settings.CompanyName, Address = settings.Address, Phone = settings.Phone }; DataContext = _model; }