Example #1
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");
            }
        }
Example #2
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");
            }
        }
Example #3
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");
            }
        }
Example #4
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");
            }
        }