Пример #1
0
        private void btnEdit_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (dtgUsers.SelectedItem != null)
                {
                    User oUser = (User)dtgUsers.SelectedItem;

                    ucAddEditUser oucAddEditUser = new ucAddEditUser(oUser, true);

                    winDialog oDialog = new winDialog(oucAddEditUser)
                    {
                        ShowInTaskbar = true,
                        WindowTitle   = "Edit User",
                        Height        = 300,
                        Width         = 390
                    };
                    oDialog.ShowDialog();

                    dtgUsers.Items.Refresh();
                }
                else
                {
                    MessageBox.Show("Please select a user from list");
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Can not edit user now");
            }
        }
Пример #2
0
        private void btnEdit_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (dtgItems.SelectedItem != null)
                {
                    PartsDetail oPartsDetail = (PartsDetail)dtgItems.SelectedItem;

                    ucAddEditPartsDetail oucAddEditPartsDetail = new ucAddEditPartsDetail(oPartsDetail, true);

                    winDialog oDialog = new winDialog(oucAddEditPartsDetail)
                    {
                        ShowInTaskbar = true,
                        WindowTitle   = "Edit Parts",
                        Height        = 240,
                        Width         = 560
                    };
                    oDialog.ShowDialog();

                    dtgItems.Items.Refresh();
                }
                else
                {
                    MessageBox.Show("Please select a parts");
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Can not add parts");
            }
        }
Пример #3
0
        private void dtgItems_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            try
            {
                if (dtgItems.SelectedItem != null)
                {
                    PartsDetail oPartsDetail = (PartsDetail)dtgItems.SelectedItem;
                    winDialog   oDialog      = new winDialog(new ucDelivery(oPartsDetail))
                    {
                        ShowInTaskbar = false,
                        Height        = 530,
                        Width         = 600
                    };
                    oDialog.ShowDialog();

                    dtgItems.Items.Refresh();
                }
                else
                {
                    MessageBox.Show("Please select a tool");
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Can not use part");
            }
        }
Пример #4
0
        private void OpenUsePartWindow()
        {
            try
            {
                if (dtgItems.SelectedItem != null)
                {
                    PartsDetail oPartsDetail = (PartsDetail)dtgItems.SelectedItem;
                    winDialog   oDialog      = new winDialog(new ucDelivery(oPartsDetail))
                    {
                        ShowInTaskbar = true,
                        WindowTitle   = "Use tool in car",
                        Height        = 530,
                        Width         = 600
                    };
                    oDialog.ShowDialog();

                    dtgItems.Items.Refresh();
                }
                else
                {
                    MessageBox.Show("Please select a part");
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Can not use part");
            }
        }
Пример #5
0
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Category oCategory= new Category();
                ucAddEditCategory oucAddEditCategory = new ucAddEditCategory(oCategory, false);
                winDialog oDialog = new winDialog(oucAddEditCategory)
                {
                    ShowInTaskbar = true,
                    WindowTitle = "Add a new Category",
                    Height = 170,
                    Width = 500
                };
                oDialog.ShowDialog();

                UpdateDataGrid();


            }
            catch (Exception)
            {

                MessageBox.Show("Can not open window to add category");
            }
        }
Пример #6
0
        private void btnEdit_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (dtgCategories.SelectedItem != null)
                {
                    Category          oCategory          = dtgCategories.SelectedItem as Category;
                    ucAddEditCategory oucAddEditCategory = new ucAddEditCategory(oCategory, true);
                    winDialog         oDialog            = new winDialog(oucAddEditCategory)
                    {
                        ShowInTaskbar = true,
                        WindowTitle   = "Edit Category",
                        Height        = 170,
                        Width         = 500
                    };
                    oDialog.ShowDialog();

                    UpdateDataGrid();
                }
                else
                {
                    MessageBox.Show("Please select a category from grid");
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Can not open window to edit category");
            }
        }
Пример #7
0
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Manufacturer oManufacturer = new Manufacturer();
                ucAddEditManufacturer oucAddEditManufacturer = new ucAddEditManufacturer(oManufacturer, false);
                winDialog oDialog = new winDialog(oucAddEditManufacturer)
                {
                    ShowInTaskbar = true,
                    WindowTitle = "Add a new Manufacturer",
                    Height = 170,
                    Width = 500
                };
                oDialog.ShowDialog();

                UpdateDataGrid();


            }
            catch (Exception)
            {

                MessageBox.Show("Can not open window to add manufacturer");
            }
        }
Пример #8
0
        private void btnEdit_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (dtgCarModels.SelectedItem != null)
                {
                    CarModel          oCarModel          = dtgCarModels.SelectedItem as CarModel;
                    ucAddEditCarModel oucAddEditCarModel = new ucAddEditCarModel(oCarModel, true);
                    winDialog         oDialog            = new winDialog(oucAddEditCarModel)
                    {
                        ShowInTaskbar = true,
                        WindowTitle   = "Edit Car Model",
                        Height        = 200,
                        Width         = 500
                    };
                    oDialog.ShowDialog();

                    UpdateDataGrid();
                }

                else
                {
                    MessageBox.Show("Please select a car model");
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Can not open window to edit car model");
            }
        }
Пример #9
0
        private void btnEdit_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (dtgManufacturer.SelectedItem != null)
                {
                    Manufacturer          oManufacturer          = dtgManufacturer.SelectedItem as Manufacturer;
                    ucAddEditManufacturer oucAddEditManufacturer = new ucAddEditManufacturer(oManufacturer, true);
                    winDialog             oDialog = new winDialog(oucAddEditManufacturer)
                    {
                        ShowInTaskbar = true,
                        WindowTitle   = "Edit Manufacturer",
                        Height        = 170,
                        Width         = 500
                    };
                    oDialog.ShowDialog();

                    UpdateDataGrid();
                }
                else
                {
                    MessageBox.Show("Please select a manufacturer from grid");
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Can not open window to edit manufacturer");
            }
        }
Пример #10
0
    public static winDialog CreateDialog(string name, string caption, string content, string[] choices, Action<winDialog, int> callback)
    {
        winDialog dlg = null;
        if (Windows.ContainsKey(name))
        {
            dlg = (winDialog)Windows[name];
            dlg.Initialize(caption, content, choices, callback);
            dlg.Show();
        }
        else
        {
            dlg = new winDialog(name, caption, content, choices, callback);

            Windows.Add(name, dlg);
        }

        return dlg;
    }
Пример #11
0
        private void btnAddCar_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Car           oCar           = new Car();
                ucAddEditCars oucAddEditCars = new ucAddEditCars(oCar, false);
                winDialog     oDialog        = new winDialog(oucAddEditCars)
                {
                    ShowInTaskbar = true,
                    WindowTitle   = "Add a new Car",
                    Height        = 235,
                    Width         = 510
                };
                oDialog.ShowDialog();

                UpdateGrid();
            }
            catch (Exception)
            {
                MessageBox.Show("Can not open window to add car.");
            }
        }
Пример #12
0
        private void btnEdit_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Car           oCar           = dtgCars.SelectedItem as Car;
                ucAddEditCars oucAddEditCars = new ucAddEditCars(oCar, true);
                winDialog     oDialog        = new winDialog(oucAddEditCars)
                {
                    ShowInTaskbar = true,
                    WindowTitle   = "Edit a Car",
                    Height        = 235,
                    Width         = 510
                };
                oDialog.ShowDialog();

                UpdateGrid();
            }
            catch (Exception)
            {
                MessageBox.Show("Can not open window to edit car.");
            }
        }
Пример #13
0
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Category          oCategory          = new Category();
                ucAddEditCategory oucAddEditCategory = new ucAddEditCategory(oCategory, false);
                winDialog         oDialog            = new winDialog(oucAddEditCategory)
                {
                    ShowInTaskbar = true,
                    WindowTitle   = "Add a new Category",
                    Height        = 170,
                    Width         = 500
                };
                oDialog.ShowDialog();

                UpdateDataGrid();
            }
            catch (Exception)
            {
                MessageBox.Show("Can not open window to add category");
            }
        }
Пример #14
0
        private void btnAddCarModel_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                CarModel          oCarModel          = new CarModel();
                ucAddEditCarModel oucAddEditCarModel = new ucAddEditCarModel(oCarModel, false);
                winDialog         oDialog            = new winDialog(oucAddEditCarModel)
                {
                    ShowInTaskbar = true,
                    WindowTitle   = "Add a new Car Model",
                    Height        = 200,
                    Width         = 500
                };
                oDialog.ShowDialog();

                UpdateDataGrid();
            }
            catch (Exception)
            {
                MessageBox.Show("Can not open window to add car model");
            }
        }
Пример #15
0
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Manufacturer          oManufacturer          = new Manufacturer();
                ucAddEditManufacturer oucAddEditManufacturer = new ucAddEditManufacturer(oManufacturer, false);
                winDialog             oDialog = new winDialog(oucAddEditManufacturer)
                {
                    ShowInTaskbar = true,
                    WindowTitle   = "Add a new Manufacturer",
                    Height        = 170,
                    Width         = 500
                };
                oDialog.ShowDialog();

                UpdateDataGrid();
            }
            catch (Exception)
            {
                MessageBox.Show("Can not open window to add manufacturer");
            }
        }
Пример #16
0
        private void btnAddPartsDetail_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                PartsDetail oPartsDetail = new PartsDetail();

                ucAddEditPartsDetail oucAddEditPartsDetail = new ucAddEditPartsDetail(oPartsDetail, false);

                winDialog oDialog = new winDialog(oucAddEditPartsDetail)
                {
                    ShowInTaskbar = true,
                    WindowTitle   = "Add a new Parts",
                    Height        = 240,
                    Width         = 560
                };
                oDialog.ShowDialog();

                dtgItems.Items.Refresh();
            }
            catch (Exception)
            {
                MessageBox.Show("Can not add parts");
            }
        }
Пример #17
0
        private void btnAddUser_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                User oUser = new User();

                ucAddEditUser oucAddEditUser = new ucAddEditUser(oUser, false);

                winDialog oDialog = new winDialog(oucAddEditUser)
                {
                    ShowInTaskbar = true,
                    WindowTitle   = "Add a new User",
                    Height        = 300,
                    Width         = 390
                };
                oDialog.ShowDialog();

                dtgUsers.Items.Refresh();
            }
            catch (Exception)
            {
                MessageBox.Show("Can not add user now");
            }
        }
Пример #18
0
        private void btnAddCarModel_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                CarModel oCarModel = new CarModel();
                ucAddEditCarModel oucAddEditCarModel = new ucAddEditCarModel(oCarModel, false);
                winDialog oDialog = new winDialog(oucAddEditCarModel)
                {
                    ShowInTaskbar = true,
                    WindowTitle = "Add a new Car Model",
                    Height = 200,
                    Width = 500
                };
                oDialog.ShowDialog();

                UpdateDataGrid();


            }
            catch (Exception)
            {
                
                MessageBox.Show("Can not open window to add car model");
            }
        }
Пример #19
0
        private void dtgItems_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            try
            {
                if (dtgItems.SelectedItem != null)
                {
                    PartsDetail oPartsDetail = (PartsDetail)dtgItems.SelectedItem;
                    winDialog oDialog = new winDialog(new ucDelivery(oPartsDetail))
                    {
                        ShowInTaskbar = false,
                        Height = 530,
                        Width = 600
                    };
                    oDialog.ShowDialog();

                    dtgItems.Items.Refresh();
                }
                else
                {
                    MessageBox.Show("Please select a tool");
                }

            }
            catch (Exception)
            {

                MessageBox.Show("Can not use part");
            }
        }
Пример #20
0
        private void btnEdit_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Car oCar = dtgCars.SelectedItem as Car;
                ucAddEditCars oucAddEditCars = new ucAddEditCars(oCar, true);
                winDialog oDialog = new winDialog(oucAddEditCars)
                {
                    ShowInTaskbar = true,
                    WindowTitle = "Edit a Car",
                    Height = 235,
                    Width = 510
                };
                oDialog.ShowDialog();

                UpdateGrid();


            }
            catch (Exception)
            {

                MessageBox.Show("Can not open window to edit car.");
            }
        }
Пример #21
0
        private void btnAddCar_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Car oCar = new Car();
                ucAddEditCars oucAddEditCars = new ucAddEditCars(oCar, false);
                winDialog oDialog = new winDialog(oucAddEditCars)
                {
                    ShowInTaskbar = true,
                    WindowTitle = "Add a new Car",
                    Height = 235,
                    Width = 510
                };
                oDialog.ShowDialog();

                UpdateGrid();


            }
            catch (Exception)
            {

                MessageBox.Show("Can not open window to add car.");
            }
        }       
Пример #22
0
        private void btnAddUser_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                User oUser= new User();

                ucAddEditUser oucAddEditUser = new ucAddEditUser(oUser, false);

                winDialog oDialog = new winDialog(oucAddEditUser)
                {
                    ShowInTaskbar = true,
                    WindowTitle = "Add a new User",
                    Height = 300,
                    Width = 390
                };
                oDialog.ShowDialog();

                dtgUsers.Items.Refresh();
                
            }
            catch (Exception)
            {
                
                MessageBox.Show("Can not add user now");
            }
        }
Пример #23
0
        private void btnEdit_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (dtgUsers.SelectedItem != null)
                {
                    User oUser = (User)dtgUsers.SelectedItem;

                    ucAddEditUser oucAddEditUser = new ucAddEditUser(oUser, true);

                    winDialog oDialog = new winDialog(oucAddEditUser)
                    {
                        ShowInTaskbar = true,
                        WindowTitle = "Edit User",
                        Height = 300,
                        Width = 390
                    };
                    oDialog.ShowDialog();

                    dtgUsers.Items.Refresh();
                }
                else
                {
                    MessageBox.Show("Please select a user from list");
                }

            }
            catch (Exception)
            {

                MessageBox.Show("Can not edit user now");
            }
        }
Пример #24
0
        private void OpenUsePartWindow()
        {
            try
            {
                if (dtgItems.SelectedItem != null)
                {
                    PartsDetail oPartsDetail = (PartsDetail)dtgItems.SelectedItem;
                    winDialog oDialog = new winDialog(new ucDelivery(oPartsDetail))
                    {
                        ShowInTaskbar = true,
                        WindowTitle = "Use tool in car",
                        Height = 530,
                        Width = 600
                    };
                    oDialog.ShowDialog();

                    dtgItems.Items.Refresh();
                }
                else
                {
                    MessageBox.Show("Please select a part");
                }

            }
            catch (Exception)
            {

                MessageBox.Show("Can not use part");
            }
        }
Пример #25
0
        private void btnEdit_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (dtgManufacturer.SelectedItem != null)
                {
                    Manufacturer oManufacturer = dtgManufacturer.SelectedItem as Manufacturer;
                    ucAddEditManufacturer oucAddEditManufacturer = new ucAddEditManufacturer(oManufacturer, true);
                    winDialog oDialog = new winDialog(oucAddEditManufacturer)
                    {
                        ShowInTaskbar = true,
                        WindowTitle = "Edit Manufacturer",
                        Height = 170,
                        Width = 500
                    };
                    oDialog.ShowDialog();

                    UpdateDataGrid();
                }
                else
                    MessageBox.Show("Please select a manufacturer from grid");

            }
            catch (Exception)
            {

                MessageBox.Show("Can not open window to edit manufacturer");
            }
        }
Пример #26
0
        private void btnAddPartsDetail_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                PartsDetail oPartsDetail = new PartsDetail();

                ucAddEditPartsDetail oucAddEditPartsDetail = new ucAddEditPartsDetail(oPartsDetail,false);

                winDialog oDialog = new winDialog(oucAddEditPartsDetail)
                {
                    ShowInTaskbar = true,
                    WindowTitle = "Add a new Parts",
                    Height = 240,
                    Width = 560
                };
                oDialog.ShowDialog();

                dtgItems.Items.Refresh();

            }
            catch (Exception)
            {

                MessageBox.Show("Can not add parts");
            }
        }
Пример #27
0
        private void btnEdit_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (dtgItems.SelectedItem != null)
                {
                    PartsDetail oPartsDetail = (PartsDetail)dtgItems.SelectedItem;

                    ucAddEditPartsDetail oucAddEditPartsDetail = new ucAddEditPartsDetail(oPartsDetail, true);

                    winDialog oDialog = new winDialog(oucAddEditPartsDetail)
                    {
                        ShowInTaskbar = true,
                        WindowTitle = "Edit Parts",
                        Height = 240,
                        Width = 560
                    };
                    oDialog.ShowDialog();

                    dtgItems.Items.Refresh();
                }
                else
                {
                    MessageBox.Show("Please select a parts");
                }

            }
            catch (Exception)
            {

                MessageBox.Show("Can not add parts");
            }
        }
Пример #28
0
        private void btnEdit_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (dtgCategories.SelectedItem != null)
                {
                    Category oCategory = dtgCategories.SelectedItem as Category;
                    ucAddEditCategory oucAddEditCategory = new ucAddEditCategory(oCategory, true);
                    winDialog oDialog = new winDialog(oucAddEditCategory)
                    {
                        ShowInTaskbar = true,
                        WindowTitle = "Edit Category",
                        Height = 170,
                        Width = 500
                    };
                    oDialog.ShowDialog();

                    UpdateDataGrid();
                }
                else
                    MessageBox.Show("Please select a category from grid");

            }
            catch (Exception)
            {

                MessageBox.Show("Can not open window to edit category");
            }
        }
Пример #29
0
        private void btnEdit_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (dtgCarModels.SelectedItem != null)
                {
                    CarModel oCarModel = dtgCarModels.SelectedItem as CarModel;
                    ucAddEditCarModel oucAddEditCarModel = new ucAddEditCarModel(oCarModel, true);
                    winDialog oDialog = new winDialog(oucAddEditCarModel)
                    {
                        ShowInTaskbar = true,
                        WindowTitle = "Edit Car Model",
                        Height = 200,
                        Width = 500
                    };
                    oDialog.ShowDialog();

                    UpdateDataGrid();
                }

                else
                {
                    MessageBox.Show("Please select a car model");
                }
            }
            catch (Exception)
            {

                MessageBox.Show("Can not open window to edit car model");
            }
        }