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();
            }
        }
Exemple #2
0
        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();
            }
        }
Exemple #3
0
        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();
            }
        }