Ejemplo n.º 1
0
        private void SubmitVehicle_Click(object sender, RoutedEventArgs e)
        {
            if (Car)
            {
                string[] data = new string[6];
                data[0] = VINBox.GetLineText(0);
                data[1] = VehicleModelBox.GetLineText(0);
                data[2] = VehicleYearBox.GetLineText(0);
                data[3] = VehicleMakerBox.GetLineText(0);
                data[4] = VehicleSeatsBox.GetLineText(0);
                data[5] = VehiclePriceBox.GetLineText(0);
                data[6] = VehicleOther1Box.GetLineText(0);

                MC.ModifyCar(data);

                VINBox.Clear();
                VehicleModelBox.Clear();
                VehicleYearBox.Clear();
                VehicleMakerBox.Clear();
                VehicleSeatsBox.Clear();
                VehiclePriceBox.Clear();
                VehicleOther1Box.Clear();

                Car = false;
                CarCheck.IsChecked            = false;
                TruckCheck.Visibility         = Visibility.Visible;
                VehicleOther1Box.Visibility   = Visibility.Collapsed;
                VehicleOther1Label.Visibility = Visibility.Collapsed;
            }
            else if (Truck)
            {
                string[] data = new string[6];
                data[0] = VINBox.GetLineText(0);
                data[1] = VehicleModelBox.GetLineText(0);
                data[2] = VehicleYearBox.GetLineText(0);
                data[3] = VehicleMakerBox.GetLineText(0);
                data[4] = VehicleSeatsBox.GetLineText(0);
                data[5] = VehiclePriceBox.GetLineText(0);
                data[6] = VehicleOther1Box.GetLineText(0);

                MC.ModifyTruck(data);

                VINBox.Clear();
                VehicleModelBox.Clear();
                VehicleYearBox.Clear();
                VehicleMakerBox.Clear();
                VehicleSeatsBox.Clear();
                VehiclePriceBox.Clear();
                VehicleOther1Box.Clear();

                Truck = false;
                TruckCheck.IsChecked          = false;
                CarCheck.Visibility           = Visibility.Visible;
                VehicleOther1Box.Visibility   = Visibility.Collapsed;
                VehicleOther1Label.Visibility = Visibility.Collapsed;
            }
        }
Ejemplo n.º 2
0
        private void SubmitVehicle_Click(object sender, RoutedEventArgs e)
        {
            if (Car)
            {
                string[] data = new string[6];
                data[0] = VINBox.GetLineText(0);
                data[1] = VehicleModelBox.GetLineText(0);
                data[2] = VehicleYearBox.GetLineText(0);
                data[3] = VehicleMakerBox.GetLineText(0);
                data[4] = VehicleSeatsBox.GetLineText(0);
                data[5] = VehiclePriceBox.GetLineText(0);
                data[6] = VehicleOther1Box.GetLineText(0);

                try
                {
                    try
                    {
                        MC.ModifyCar(data);
                    }
                    catch (ArgumentException AE)
                    {
                        ErrorWindow Error = new ErrorWindow(AE.Message);
                        Error.Title = "Data Field Error";
                        Error.ShowDialog();
                    }
                }
                catch (OleDbException ex)
                {
                    ErrorWindow Error = new ErrorWindow(ex.Message);
                    Error.Title = "Data Field Error";
                    Error.ShowDialog();
                }

                VINBox.Clear();
                VehicleModelBox.Clear();
                VehicleYearBox.Clear();
                VehicleMakerBox.Clear();
                VehicleSeatsBox.Clear();
                VehiclePriceBox.Clear();
                VehicleOther1Box.Clear();

                Car = false;
                CarCheck.IsChecked            = false;
                TruckCheck.Visibility         = Visibility.Visible;
                VehicleOther1Box.Visibility   = Visibility.Collapsed;
                VehicleOther1Label.Visibility = Visibility.Collapsed;
            }
            else if (Truck)
            {
                string[] data = new string[6];
                data[0] = VINBox.GetLineText(0);
                data[1] = VehicleModelBox.GetLineText(0);
                data[2] = VehicleYearBox.GetLineText(0);
                data[3] = VehicleMakerBox.GetLineText(0);
                data[4] = VehicleSeatsBox.GetLineText(0);
                data[5] = VehiclePriceBox.GetLineText(0);
                data[6] = VehicleOther1Box.GetLineText(0);

                try
                {
                    try
                    {
                        MC.ModifyTruck(data);
                    }
                    catch (ArgumentException AE)
                    {
                        ErrorWindow Error = new ErrorWindow(AE.Message);
                        Error.Title = "Data Field Error";
                        Error.ShowDialog();
                    }
                }
                catch (OleDbException ex)
                {
                    ErrorWindow Error = new ErrorWindow(ex.Message);
                    Error.Title = "Data Field Error";
                    Error.ShowDialog();
                }

                VINBox.Clear();
                VehicleModelBox.Clear();
                VehicleYearBox.Clear();
                VehicleMakerBox.Clear();
                VehicleSeatsBox.Clear();
                VehiclePriceBox.Clear();
                VehicleOther1Box.Clear();

                Truck = false;
                TruckCheck.IsChecked          = false;
                CarCheck.Visibility           = Visibility.Visible;
                VehicleOther1Box.Visibility   = Visibility.Collapsed;
                VehicleOther1Label.Visibility = Visibility.Collapsed;
            }
        }