private void btnToggleReservation_Click(object sender, RoutedEventArgs e)
        {
            var obj = ((FrameworkElement)sender).DataContext as Product;

            obj.IsReserved = !obj.IsReserved;
            BL_Products.Save(obj);
            BindData();
        }
        private void grdProducts_RowEditEnding(object sender, DataGridRowEditEndingEventArgs e)
        {
            DataGridRow _dgrow  = e.Row;
            var         _edited = _dgrow.DataContext as Product;


            BL_Products.Save(_edited);

            BindData();
        }
Esempio n. 3
0
 private void btnSave_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (BL_Products.Save(Model))
         {
             if (OnModelSaved != null)
             {
                 OnModelSaved(Model);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         throw;
     }
 }
        private void DataSourceChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            switch (e.Action)
            {
            case NotifyCollectionChangedAction.Add:
                foreach (Product p in e.NewItems)
                {
                    BL_Products.Save(p);
                }
                break;

            case NotifyCollectionChangedAction.Remove:
                foreach (Product p in e.OldItems)
                {
                    BL_Products.Delete(p);
                }
                break;
            }
        }