Пример #1
0
        private void SubmitSaleButton_Click(object sender, RoutedEventArgs e)
        {
            string[] Data = new string[5];
            Data[0] = VehicleText.GetLineText(0);
            Data[1] = CustomerText.GetLineText(0);
            Data[2] = EmployeeText.GetLineText(0);
            Data[3] = DateText.GetLineText(0);
            Data[4] = PriceText.GetLineText(0);

            MakeSale S = new MakeSale(Data, cn);

            try
            {
                S.CreateSale();
            }
            catch (OleDbException ex)
            {
                ErrorWindow Error = new ErrorWindow(ex.Message);
                Error.ShowDialog();
                return;
            }

            VehicleText.Clear();
            CustomerText.Clear();
            EmployeeText.Clear();
            DateText.Clear();
            PriceText.Clear();
        }
Пример #2
0
        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();
        }