Ejemplo n.º 1
0
        private void CMI_Modify_Click(object sender, RoutedEventArgs e)
        {
            switch (DG_Info.SelectedItem.GetType().Name)
            {
            case nameof(Products):
                Products selectedPr = DG_Info.SelectedItem as Products;
                if (selectedPr != null)
                {
                    ProductInfoWindow piw = new ProductInfoWindow(selectedPr, _uow);
                    if (piw.ShowDialog() == true)
                    {
                        _uow.Repository <Products>().Update(piw.Product);
                    }
                }
                break;

            case nameof(Categories):
                Categories selectedCat = DG_Info.SelectedItem as Categories;
                if (selectedCat != null)
                {
                    CategoryInfoWindow ciw = new CategoryInfoWindow(selectedCat, _uow);
                    if (ciw.ShowDialog() == true)
                    {
                        _uow.Repository <Categories>().Update(ciw.Category);
                    }
                }
                break;
            }
            UpdateTableItems();
        }
Ejemplo n.º 2
0
        private void Bttn_NewCategory_Click(object sender, RoutedEventArgs e)
        {
            CategoryInfoWindow ncw = new CategoryInfoWindow(null, _uow);

            if (ncw.ShowDialog() == true)
            {
                _uow.Repository <Categories>().Insert(ncw.Category);
                CB_Category.ItemsSource = _uow.Repository <Categories>().GetEntities();
            }
        }
Ejemplo n.º 3
0
 private void Bttn_NewItem_Click(object sender, RoutedEventArgs e)
 {
     if (CB_ItemstoShow.SelectedItem.ToString() == nameof(Products))
     {
         ProductInfoWindow piw = new ProductInfoWindow(null, _uow);
         if (piw.ShowDialog() == true)
         {
             _uow.Repository <Products>().Insert(piw.Product);
         }
     }
     else
     {
         CategoryInfoWindow ncw = new CategoryInfoWindow(null, _uow);
         if (ncw.ShowDialog() == true)
         {
             _uow.Repository <Categories>().Insert(ncw.Category);
         }
     }
     UpdateTableItems();
 }