Пример #1
0
        public ucAddEditCars(Car oCar, bool isEdit)
        {
            InitializeComponent();
            try
            {
                this.oCar = oCar;
                this.isEdit = isEdit;
                cboGroup.ItemsSource = App.oAllGroupList;
                if (isEdit)
                {
                    InitializeWindow();
                }

            }
            catch (Exception)
            {
                
                MessageBox.Show("Can not initialize add edit car");
            }
        }
Пример #2
0
        public List<Car> SelectAll()
        {
            List<Car> oCarList = new List<Car>();

            Car oCar = new Car();
            oCar.carModel = new CarModel().SelectAll()[0];
            oCar.Id = 1;
            oCar.regNo = "DHK-KA-0001";
            oCarList.Add(oCar);

            oCar = new Car();
            oCar.carModel = new CarModel().SelectAll()[0];
            oCar.Id = 2;
            oCar.regNo = "DHK-KHA-3001";
            oCarList.Add(oCar);

            oCar = new Car();
            oCar.carModel = new CarModel().SelectAll()[1];
            oCar.Id = 3;
            oCar.regNo = "KHULNA-KA-9001";
            oCarList.Add(oCar);

            return oCarList;
        }
Пример #3
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.");
            }
        }