Пример #1
0
        public void printDet(Object sender, EventArgs e)
        {
            var     bc             = new BrushConverter();
            string  id             = this.checkId.Text;
            int     newid          = int.Parse(id);
            Trainee isExistTrainee = bl.getTraineeBL(newid);

            if (isExistTrainee != null)
            {
                this.details.Foreground = (Brush)bc.ConvertFrom("#019EAA");
                string helpTrainee = isExistTrainee.ToString();
                details.Text = helpTrainee;
            }
            else
            {
                Tester isExistTester = bl.getTesterBL(newid);
                if (isExistTester != null)
                {
                    details.Foreground = (Brush)bc.ConvertFrom("#019EAA");
                    string helpTester = isExistTester.ToString();
                    details.Text = helpTester;
                }

                else
                {
                    details.Text       = "This Id dosen't exist in the system\n";
                    details.Foreground = Brushes.Red;
                }
            }
        }
 public void setTrainee(Trainee pTrainee)
 {
     trainee.SelectedValue = pTrainee;
     trainee.Text          = pTrainee.ToString();
     trainee.IsEnabled     = false;
     addLesson.Content     = pTrainee.LessonsNumber;
 }
 /// <summary>
 /// This function will insert the appropriate values into the corresponding fields when we press on the button "submit"
 /// This is a sighnup function for a click event
 /// </summary>
 /// <param name="sender">Who is sensing the event</param>
 /// <param name="e">Details of the event occurred</param>
 private void SubmitBtn_Click(object sender, RoutedEventArgs e)
 {
     MessageBox.Show(currentTrainee.ToString());
     try
     {
         BL.AddTrainee(currentTrainee);   //adds the current trainee to the list of tests
         currentTrainee = new Trainee();  //creates a new trainee for current trainee so the addition can work again well
         DataContext    = currentTrainee; //sets the current trainee in DataContext
     }
     catch (Exception exc)
     {
         MessageBox.Show(exc.Message);
     }
 }
 /// <summary>
 /// This function will insert the appropriate values into the corresponding fields when we press on the button "submit"
 /// This is a sighnup function for a click event
 /// </summary>
 /// <param name="sender">Who is sensing the event</param>
 /// <param name="e">Details of the event occurred</param>
 private void SubmitBtn_Click(object sender, RoutedEventArgs e)
 {
     MessageBox.Show(currentTrainee.ToString());
     try
     {
         BL.UpdateTrainee(currentTrainee);
         currentTrainee             = new Trainee();  //creates a new trainee for current trainee so that the update can work again well
         DataContext                = currentTrainee; //sets the current trainee in DataContext so that the update can work again well
         traineeIdTextBox.IsEnabled = true;
     }
     catch (Exception exc)
     {
         MessageBox.Show(exc.Message);
     }
 }
        private void search()
        {
            try
            {
                if (IdtextBox.Text.Length < 9)
                {
                    IdtextBox.BorderBrush = Brushes.Red;
                    label1.Content        = "";
                    button.IsEnabled      = false;
                    throw new Exception("Id - Not enough digits");
                }
                if (IdtextBox.Text.Length > 9)
                {
                    IdtextBox.BorderBrush = Brushes.Red;
                    throw new Exception("Id - To much digits");
                }
                object temp = comboBox.SelectedItem;
                if (temp == null)
                {
                    label1.Content   = "";
                    button.IsEnabled = false;
                    throw new Exception("The trainee does not lerning on this type of car");
                }

                temp_trainee = bl.SearchTrainee(IdtextBox.Text, (TypeOfCar)comboBox.SelectionBoxItem);
                if (temp_trainee == null)
                {
                    label1.Content   = "";
                    button.IsEnabled = false;
                    throw new Exception("The trainee does not exist in the database");
                }

                button.IsEnabled = true;
                label1.Content   = temp_trainee.ToString();
            }
            catch (Exception message)
            {
                MessageBox.Show(message.Message);
                IdtextBox.Text         = "";
                IdtextBox.BorderBrush  = Brushes.Black;
                comboBox.SelectedValue = TypeOfCar.PrivateCar;
            }
        }
 /// <summary>
 /// set single trainee that will be able to set set for himself only. for Trainee use.
 /// </summary>
 /// <param name="trainee">the trainee that will be use alone.</param>
 public void setTrainee(Trainee trainee)
 {
     traineeIdList.SelectedValue = trainee;
     traineeIdList.Text          = trainee.ToString();
     traineeIdList.IsEnabled     = false;
 }