private void AddPart_Click(object sender, RoutedEventArgs e) { noError = true; string[] Data = new string[4]; Data[0] = SerialNumberText.GetLineText(0); Data[1] = VINText.GetLineText(0); Data[2] = NameText.GetLineText(0); Data[3] = ManufacturerText.GetLineText(0); MakePart P = new MakePart(Data, cn); try { P.CreatePart(); } catch (OleDbException ex) { noError = false; ErrorWindow Error = new ErrorWindow(ex.Message); Error.ShowDialog(); } if (noError) { this.Close(); } }
private void AddVehicleHistoryReport_Click(object sender, RoutedEventArgs e) { noError = true; string[] Data = new string[4]; Data[0] = VINText.GetLineText(0); Data[1] = NumOwnersText.GetLineText(0); Data[2] = RatingText.GetLineText(0); Data[3] = MileageText.GetLineText(0); MakeVHR VHR = new MakeVHR(Data, cn); try { VHR.CreateVHR(); } catch (OleDbException ex) { noError = false; ErrorWindow Error = new ErrorWindow(ex.Message); Error.ShowDialog(); } if (noError) { this.Close(); } }
private void AddCarSubmit_Click(object sender, RoutedEventArgs e) { string[] Data = new string[6]; Data[0] = VINText.GetLineText(0); Data[1] = ModelText.GetLineText(0); Data[2] = YearText.GetLineText(0); Data[3] = ManufacturerText.GetLineText(0); Data[4] = SeatsText.GetLineText(0); Data[5] = PriceText.GetLineText(0); string Type = TypeText.GetLineText(0); string VIN = Data[0]; MakeVehicle V = new MakeVehicle(Data, cn); MakeCar C = new MakeCar(VIN, Type, cn); try { V.CreateVehicle(); } catch (OleDbException ex) { ErrorWindow Error = new ErrorWindow(ex.Message); Error.ShowDialog(); return; } try { C.CreateCar(); } catch (OleDbException ex) { try { V.DeleteVehicle(); } catch (OleDbException ex2) { } ErrorWindow Error = new ErrorWindow(ex.Message); Error.ShowDialog(); return; } if (used) { R = new VehicleHistoryReport(Parent, cn); R.ShowDialog(); } this.Close(); }
private void AddEngine_Click(object sender, RoutedEventArgs e) { noError = true; string[] Data = new string[4]; Data[0] = SerialNumberText.GetLineText(0); Data[1] = VINText.GetLineText(0); Data[2] = NameText.GetLineText(0); Data[3] = ManufacturerText.GetLineText(0); string SerialNumber = Data[0]; string HorsePower = HorsePowerText.GetLineText(0); string Cylinders = CylindersText.GetLineText(0); MakePart P = new MakePart(Data, cn); MakeEngine E = new MakeEngine(SerialNumber, HorsePower, Cylinders, cn); try { P.CreatePart(); } catch (OleDbException ex) { noError = false; ErrorWindow Error = new ErrorWindow(ex.Message); Error.ShowDialog(); } try { E.CreateEngine(); } catch (OleDbException ex) { try { P.DeletePart(); } catch (OleDbException ex2) { } ErrorWindow Error = new ErrorWindow(ex.Message); Error.ShowDialog(); return; } if (noError) { this.Close(); } }
private void AddTire_Click(object sender, RoutedEventArgs e) { noError = true; string[] Data = new string[4]; Data[0] = SerialNumberText.GetLineText(0); Data[1] = VINText.GetLineText(0); Data[2] = NameText.GetLineText(0); Data[3] = ManufacturerText.GetLineText(0); string SerialNumber = Data[0]; string Type = TypeText.GetLineText(0); string Size = SizeText.GetLineText(0); MakePart P = new MakePart(Data, cn); MakeTires T = new MakeTires(SerialNumber, Type, Size, cn); try { P.CreatePart(); } catch (OleDbException ex) { noError = false; ErrorWindow Error = new ErrorWindow(ex.Message); Error.ShowDialog(); } try { T.CreateTires(); } catch (OleDbException ex) { try { P.DeletePart(); } catch (OleDbException ex2) { } ErrorWindow Error = new ErrorWindow(ex.Message); Error.ShowDialog(); return; } if (noError) { this.Close(); } }