Ejemplo n.º 1
0
 private void AddButtonClick(object sender, RoutedEventArgs e)
 {
     using (var db = new Model.BudgetModel())
     {
         var purchase = new Purchase();
         purchase.DateTime = purchaseDataTime.SelectedDate.Value;
         var selectedSource = purchaseCmbBox.SelectedItem as ListBoxItem;
         if (selectedSource == null)
         {
             MessageBox.Show("Выберите источник");
             return;
         }
         purchase.Source = db.Sources.Find(selectedSource.Id);
         db.Purchases.Add(purchase);
         db.SaveChanges();
         ChekItemWindow chekItemWindow = new ChekItemWindow(purchase.Id);
         chekItemWindow.ShowDialog();
     }
     UpdateDataGrid();
 }
Ejemplo n.º 2
0
 private void RenameButtonClick(object sender, RoutedEventArgs e)
 {
     using (var db = new Model.BudgetModel())
     {
         Purchase purchase = purchaseDataGrid.SelectedItem as Purchase;
         ChekItemWindow chekItemWindow = new ChekItemWindow(purchase.Id);
         chekItemWindow.ShowDialog();
     }
     UpdateDataGrid();
 }