예제 #1
0
        //////////////////
        // Edit methods //
        //////////////////

        private void CallEdit(object sender, RoutedEventArgs e)
        {
            Object selectedRow = grids[currentCategory].SelectedItem;

            if (selectedRow != null)
            {
                Type   type     = selectedRow.GetType();
                Window editForm = null;
                if (type.Equals(typeof(ClubMember)))
                {
                    editForm = new AddEditClubMember(this, false, selectedRow);
                }
                else if (type.Equals(typeof(Customer)))
                {
                    editForm = new AddEditCustomer(null, this, false, false, selectedRow);
                }
                else if (type.Equals(typeof(Department)))
                {
                    editForm = new AddEditDepartment(this, false, selectedRow);
                }
                else if (type.Equals(typeof(Employee)))
                {
                    editForm = new AddEditEmployee(this, cats[3], cats[4], false, selectedRow);
                }
                else if (type.Equals(typeof(Product)))
                {
                    editForm = new AddEditProduct(this, cats[3], false, selectedRow);
                }
                else if (type.Equals(typeof(Transaction)))
                {
                    editForm = new AddEditTransaction(this, selectedRow);
                }
                else
                {
                    editForm = new AddEditUser(this, selectedRow);
                }
                editForm.ShowDialog();
            }
            else
            {
                MessageBox.Show("You must choose a " + cats[currentCategory].GetEntityName() + " first");
            }
        }
예제 #2
0
        private void CallEdit(object sender, RoutedEventArgs e)
        {
            Window editForm = null;

            switch (currentCategory)
            {
            case 1:
                editForm = new AddEditClubMember(parentWindow, false, oldObj);
                break;

            case 2:
                editForm = new AddEditCustomer(null, parentWindow, false, false, oldObj);
                break;

            case 3:
                editForm = new AddEditDepartment(parentWindow, false, oldObj);
                break;

            case 4:
                editForm = new AddEditEmployee(parentWindow, parentWindow.cats[3], parentWindow.cats[4], false, oldObj);
                break;

            case 5:
                editForm = new AddEditProduct(parentWindow, parentWindow.cats[3], false, oldObj);
                break;

            case 6:
                editForm = new AddEditTransaction(parentWindow, oldObj);
                break;

            case 7:
                editForm = new AddEditUser(parentWindow, oldObj);
                break;
            }
            this.Close();
            editForm.ShowDialog();
        }