Ejemplo n.º 1
0
        private void addModel_Click(object sender, RoutedEventArgs e)
        {
            AddModel main = new AddModel();

            main.Show();
            this.Close();
        }
Ejemplo n.º 2
0
        private void submitCar_Click(object sender, RoutedEventArgs e)
        {
            if (Utility.validEmptyFields(grid1))
            {
                IndividualCar car = new IndividualCar
                {
                    Body_Type        = body_TypeTextBox.Text,
                    Colour           = colourTextBox.Text,
                    Current_Mileage  = current_MileageTextBox.Text,
                    Date_Imported    = date_ImportedTextBox.Text,
                    Manufacture_Year = Convert.ToInt16(manufacture_YearTextBox.Text),
                    //CarID = Convert.ToInt16(carIDTextBox.Text),
                    Model_ID     = Convert.ToInt16(model_IDTextBox.Text),
                    Status       = statusTextBox.Text,
                    Transmission = transmissionTextBox.Text
                };
                var resp = DataStore.AddObject(car, "IndividualCars");

                if (resp.Item1)
                {
                    MessageBox.Show("Successfully Added New Car");
                }
                else
                if (!resp.Item2.Contains("CarModel"))
                {
                    MessageBox.Show("Something went wrong please try again later.", resp.Item2);
                }
                else
                {
                    MessageBox.Show("Please Add a model before adding the Cars for it.", resp.Item2);
                    AddModel main = new AddModel();
                    main.Show();
                    this.Close();
                }
            }
        }