Exemplo n.º 1
0
        private void SubmitPart_Click(object sender, RoutedEventArgs e)
        {
            if (Tires)
            {
                string[] data = new string[6];
                data[0] = PartSerialNumberBox.GetLineText(0);
                data[1] = PartVINBox.GetLineText(0);
                data[2] = PartNameBox.GetLineText(0);
                data[3] = PartManufacturerBox.GetLineText(0);
                data[4] = PartOther2Box.GetLineText(0);
                data[5] = PartOther1Box.GetLineText(0);

                MC.ModifyTires(data);

                PartSerialNumberBox.Clear();
                PartVINBox.Clear();
                PartNameBox.Clear();
                PartManufacturerBox.Clear();
                PartOther1Box.Clear();
                PartOther2Box.Clear();

                Tires = false;
                TiresCheck.IsChecked       = false;
                EngineCheck.Visibility     = Visibility.Visible;
                OtherPartCheck.Visibility  = Visibility.Visible;
                PartOther1Box.Visibility   = Visibility.Collapsed;
                PartOther1Label.Visibility = Visibility.Collapsed;
                PartOther2Box.Visibility   = Visibility.Collapsed;
                PartOther2Label.Visibility = Visibility.Collapsed;
            }
            else if (Engine)
            {
                string[] data = new string[6];
                data[0] = PartSerialNumberBox.GetLineText(0);
                data[1] = PartVINBox.GetLineText(0);
                data[2] = PartNameBox.GetLineText(0);
                data[3] = PartManufacturerBox.GetLineText(0);
                data[4] = PartOther2Box.GetLineText(0);
                data[5] = PartOther1Box.GetLineText(0);

                MC.ModifyEngine(data);

                PartSerialNumberBox.Clear();
                PartVINBox.Clear();
                PartNameBox.Clear();
                PartManufacturerBox.Clear();
                PartOther1Box.Clear();
                PartOther2Box.Clear();

                Engine = false;
                EngineCheck.IsChecked      = false;
                TiresCheck.Visibility      = Visibility.Visible;
                OtherPartCheck.Visibility  = Visibility.Visible;
                PartOther1Box.Visibility   = Visibility.Collapsed;
                PartOther1Label.Visibility = Visibility.Collapsed;
                PartOther2Box.Visibility   = Visibility.Collapsed;
                PartOther2Label.Visibility = Visibility.Collapsed;
            }
            else if (Part)
            {
                string[] data = new string[6];
                data[0] = PartSerialNumberBox.GetLineText(0);
                data[1] = PartVINBox.GetLineText(0);
                data[2] = PartNameBox.GetLineText(0);
                data[3] = PartManufacturerBox.GetLineText(0);

                MC.ModifyPart(data);

                PartSerialNumberBox.Clear();
                PartVINBox.Clear();
                PartNameBox.Clear();
                PartManufacturerBox.Clear();

                Part = false;
                OtherPartCheck.IsChecked = false;
                TiresCheck.Visibility    = Visibility.Visible;
                EngineCheck.Visibility   = Visibility.Visible;
            }
        }
Exemplo n.º 2
0
        private void SubmitPart_Click(object sender, RoutedEventArgs e)
        {
            if (Tires)
            {
                string[] data = new string[6];
                data[0] = PartSerialNumberBox.GetLineText(0);
                data[1] = PartVINBox.GetLineText(0);
                data[2] = PartNameBox.GetLineText(0);
                data[3] = PartManufacturerBox.GetLineText(0);
                data[4] = PartOther2Box.GetLineText(0);
                data[5] = PartOther1Box.GetLineText(0);

                try
                {
                    try
                    {
                        MC.ModifyTires(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();
                }

                PartSerialNumberBox.Clear();
                PartVINBox.Clear();
                PartNameBox.Clear();
                PartManufacturerBox.Clear();
                PartOther1Box.Clear();
                PartOther2Box.Clear();

                Tires = false;
                TiresCheck.IsChecked       = false;
                EngineCheck.Visibility     = Visibility.Visible;
                OtherPartCheck.Visibility  = Visibility.Visible;
                PartOther1Box.Visibility   = Visibility.Collapsed;
                PartOther1Label.Visibility = Visibility.Collapsed;
                PartOther2Box.Visibility   = Visibility.Collapsed;
                PartOther2Label.Visibility = Visibility.Collapsed;
            }
            else if (Engine)
            {
                string[] data = new string[6];
                data[0] = PartSerialNumberBox.GetLineText(0);
                data[1] = PartVINBox.GetLineText(0);
                data[2] = PartNameBox.GetLineText(0);
                data[3] = PartManufacturerBox.GetLineText(0);
                data[4] = PartOther2Box.GetLineText(0);
                data[5] = PartOther1Box.GetLineText(0);

                try
                {
                    try
                    {
                        MC.ModifyEngine(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();
                }

                PartSerialNumberBox.Clear();
                PartVINBox.Clear();
                PartNameBox.Clear();
                PartManufacturerBox.Clear();
                PartOther1Box.Clear();
                PartOther2Box.Clear();

                Engine = false;
                EngineCheck.IsChecked      = false;
                TiresCheck.Visibility      = Visibility.Visible;
                OtherPartCheck.Visibility  = Visibility.Visible;
                PartOther1Box.Visibility   = Visibility.Collapsed;
                PartOther1Label.Visibility = Visibility.Collapsed;
                PartOther2Box.Visibility   = Visibility.Collapsed;
                PartOther2Label.Visibility = Visibility.Collapsed;
            }
            else if (Part)
            {
                string[] data = new string[6];
                data[0] = PartSerialNumberBox.GetLineText(0);
                data[1] = PartVINBox.GetLineText(0);
                data[2] = PartNameBox.GetLineText(0);
                data[3] = PartManufacturerBox.GetLineText(0);

                try
                {
                    try
                    {
                        MC.ModifyPart(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();
                }

                PartSerialNumberBox.Clear();
                PartVINBox.Clear();
                PartNameBox.Clear();
                PartManufacturerBox.Clear();

                Part = false;
                OtherPartCheck.IsChecked = false;
                TiresCheck.Visibility    = Visibility.Visible;
                EngineCheck.Visibility   = Visibility.Visible;
            }
        }