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"); } }
public List<CarModel> SelectAll() { try { List<CarModel> oCarModelList = new List<CarModel>(); CarModel oCarModel = new CarModel(); oCarModel.Id = 1; oCarModel.name = "Toyota Corolla Car EE-80-2E"; oCarModel.group = new Group().SelectAll()[0]; oCarModelList.Add(oCarModel); oCarModel = new CarModel(); oCarModel.Id = 2; oCarModel.name = "Toyota Corolla Car AE-80-2E"; oCarModel.group = new Group().SelectAll()[0]; oCarModelList.Add(oCarModel); oCarModel = new CarModel(); oCarModel.Id = 3; oCarModel.name = "Toyota Starlet Car EP-70"; oCarModel.group = new Group().SelectAll()[0]; oCarModelList.Add(oCarModel); oCarModel = new CarModel(); oCarModel.Id = 4; oCarModel.name = "Toyota Corolla Car EE-90-2E"; oCarModel.group = new Group().SelectAll()[1]; oCarModelList.Add(oCarModel); oCarModel = new CarModel(); oCarModel.Id = 5; oCarModel.name = "Toyota Corolla Car EE-101-4E"; oCarModel.group = new Group().SelectAll()[2]; oCarModelList.Add(oCarModel); return oCarModelList; } catch (Exception) { throw; } }