Ejemplo n.º 1
0
        private void btnNew_Click(object sender, RoutedEventArgs e)
        {
            // Create a new Insert form and show it as modal - By Mohsen
            FoodItemCU insertform = new FoodItemCU();

            if (insertform.ShowDialog() == true)  // Refresh the grid after insertion
            {
                ofosDataContext dc = new ofosDataContext();
                FoodItemGrid.ItemsSource = dc.FoodItems;
            }
            LoadData();
            //insertform.ShowDialog();
        }
Ejemplo n.º 2
0
        private void BtnEdit_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                // Getting selected row
                FoodItem selectedItem = (FoodItem)FoodItemGrid.SelectedItem;

                if (selectedItem != null)
                {
                    // Create a new Insert form and show it as modal - By Mohsen
                    FoodItemCU updateform = new FoodItemCU(selectedItem.Id, selectedItem.FoodItemName, selectedItem.FoodItemImage, selectedItem.FoodItemPrice, selectedItem.FoodItemAvailable, selectedItem.FoodItemCategory);
                    if (updateform.ShowDialog() == true)  // Refresh the grid after insertion
                    {
                        ofosDataContext dc = new ofosDataContext();
                        FoodItemGrid.ItemsSource = dc.FoodItems;
                    }
                    LoadData();
                    //insertform.ShowDialog();
                }
            }
            catch { }
        }