/// <summary>
        /// This function is responsible for the process of receiving and checking the input
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Travel_Update_Click(object sender, RoutedEventArgs e)
        {
            string textRange = MyTextBox0.Text;
            float  result    = 0;

            if (float.TryParse(textRange, out result))
            {
                kM = result;
                try
                {
                    bl.UpdateBusKM(kM, managingBus.LicenseNumber);
                    MessageBox.Show("input submited  " + result + "      to exit click X", "input", MessageBoxButton.OK, MessageBoxImage.Information);

                    MyTextBox0.Clear();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Exception", MessageBoxButton.OK, MessageBoxImage.Information);
                    MyTextBox0.Clear();
                }
            }
            else
            {
                MessageBox.Show("wrong input!!!!", "Operation Failure", MessageBoxButton.OK, MessageBoxImage.Error);
                MyTextBox1.Clear();
            }
        }
        /// <summary>
        /// Defines actions to be performed when a  button is pressed
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Name_Click(object sender, RoutedEventArgs e)
        {
            if (!input0 && amount != 3)
            {
                string textRange = MyTextBox0.Text;
                try
                {
                    BLImp.Validator.GetGoodString(textRange);
                }
                catch (ArgumentNullException ex)
                {
                    MessageBox.Show(ex.Message, "Operation Failure", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }
                stopName = textRange;
                MessageBox.Show("input submited  " + textRange + "      to exit click X", "input", MessageBoxButton.OK, MessageBoxImage.Information);
                NameLabel.Content = stopName;
                MyTextBox0.Clear();
                if (!input0)
                {
                    input0 = true;
                    amount++;
                }
            }

            else
            {
                MessageBox.Show("wrong input!!!!", "Operation Failure", MessageBoxButton.OK, MessageBoxImage.Error);
                MyTextBox2.Clear();
            }
        }
Exemple #3
0
        /// <summary>
        /// This function is responsible for the series of actions that will be performed when this button is clicked
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void LicenseNumber_Click(object sender, RoutedEventArgs e)
        {
            string textRange = MyTextBox0.Text;
            long   result    = 0;

            if (long.TryParse(textRange, out result))
            {
                try
                {
                    valid.GoodPositiveLicenseNumber(result);
                }
                catch (BO.BOBusException)
                {
                    MessageBox.Show("Wrong LicenseNumber format", "Operation Failure", MessageBoxButton.OK, MessageBoxImage.Error);
                    MyTextBox0.Clear();
                    return;
                }
                try
                {
                    valid.GoodLicenseDigits(result);
                }
                catch (BO.BOBadBusIdException)
                {
                    MessageBox.Show("amount of digits not enough!", "Operation Failure", MessageBoxButton.OK, MessageBoxImage.Error);
                    MyTextBox0.Clear();
                    return;
                }
                if (input1)
                {
                    try
                    {
                        valid.GoodLicense(result, licenseDate);
                    }
                    catch (BO.BOBadBusIdException)
                    {
                        MessageBox.Show("licesne and date time don't match until 2018 7 digits from then and on 8 digits", "Operation Failure", MessageBoxButton.OK, MessageBoxImage.Error);
                        MyTextBox0.Clear();
                    }
                }


                if (amount != 5)
                {
                    licenseNumber = result;
                    MessageBox.Show("input submited  " + result + "      to exit click X", "input", MessageBoxButton.OK, MessageBoxImage.Information);
                    LicenseNumberLabel.Content = result;
                    MyTextBox0.Clear();
                    if (!input0)
                    {
                        input0 = true;
                        amount++;
                    }
                }
            }
            else
            {
                MessageBox.Show("wrong input!!!", " Operation Failure ", MessageBoxButton.OK, MessageBoxImage.Error);
                MyTextBox0.Clear();
            }
        }
Exemple #4
0
        /// <summary>
        /// This function is responsible for the process of receiving and checking the input
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Name_Click(object sender, RoutedEventArgs e)
        {
            string textRange = MyTextBox0.Text;

            name = textRange;
            try
            {
                bl.UpdateStopName(name, managingStop.StopCode);
                MessageBox.Show("input submited" + textRange + "      to exit click X", "input", MessageBoxButton.OK, MessageBoxImage.Information);

                MyTextBox0.Clear();
            }
            catch (BO.BODOStopBadIdException ex)
            {
                MessageBox.Show(ex.Message, "Operation Failure", MessageBoxButton.OK, MessageBoxImage.Error);
                MyTextBox0.Clear();
                return;
            }
        }
        /// <summary>
        /// Defines actions to be performed when the user enters input
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Number_Click(object sender, RoutedEventArgs e)
        {
            string textRange = MyTextBox0.Text;
            long   result    = 0;

            if (long.TryParse(textRange, out result))
            {
                try
                {
                    valid.GoodLinePositiveLong(result);
                }
                catch (BO.BOBadLineIdException ex)
                {
                    MessageBox.Show("Wrong LicenseNumber format : " + ex.Message, "Operation Failure", MessageBoxButton.OK, MessageBoxImage.Error);
                    MyTextBox0.Clear();
                    return;
                }

                if (amount != 3)
                {
                    number = result;
                    MessageBox.Show("input submited  " + textRange + "      to exit click X", "input", MessageBoxButton.OK, MessageBoxImage.Information);
                    NumberLabel.Content = result;
                    MyTextBox0.Clear();
                    if (!input0)
                    {
                        input0 = true;
                        amount++;
                    }
                }
            }
            else
            {
                MessageBox.Show("wrong input!!!!", "input", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }