示例#1
0
        private void can_Submit_MouseDown(object sender, MouseButtonEventArgs e)
        {
            connect = new CTUConnection();

            try
            {
                if (txt_Serial.MaxLength != 13 || string.IsNullOrEmpty(txt_Serial.Text))
                {
                    MessageBox.Show("Please enter a serial number for the vehicle");
                }

                else if (string.IsNullOrEmpty(txt_Brand.Text))
                {
                    MessageBox.Show("Please enter the serial number of the vehicle");
                }

                else if (string.IsNullOrEmpty(txt_Color.Text))
                {
                    MessageBox.Show("Please enter the color of vehicle");
                }

                else if (string.IsNullOrEmpty(txt_Model.Text))
                {
                    MessageBox.Show("Please enter the model of the vehicle");
                }

                else if (string.IsNullOrEmpty(txt_Price.Text))
                {
                    MessageBox.Show("Please enter the price of the vehicle");
                }

                else if (string.IsNullOrEmpty(txt_Speed.Text))
                {
                    MessageBox.Show("Please enter the current speed of the vehicle");
                }

                else if (Rad_Good.IsChecked == false && Rad_Bad.IsChecked == false && Rad_Average.IsChecked == false)
                {
                    MessageBox.Show("Please select the condition of the vehicle");
                }

                else if (Rad_Used.IsChecked == false && Rad_Demo.IsChecked == false)
                {
                    MessageBox.Show("Please select the type of vehicle");
                }

                else
                {
                    connect.GetOldVehicles(txt_Brand.Text, txt_Model.Text, txt_Serial.Text, txt_Color.Text, Type, txt_Price.Text, txt_ServiceHis.Text, Convert.ToInt64(txt_Speed.Text), Condition);
                }
            }

            catch (FormatException)
            {
            }
        }