public AddTest() { InitializeComponent(); test = new BE.Test(); this.testDetails.DataContext = test; bl = BL.FactoryBL.GetBL(); DateTime a = DateTime.Now; DateTime b = a; b = b.AddMonths(2); string time = ":00"; testTime.Items.Add("09:00"); for (int i = 10; i < 15; i++) { testTime.Items.Add(i + time); } testDate.DisplayDateStart = a; testDate.DisplayDateEnd = b; this.TypeOfVehicle.ItemsSource = Enum.GetValues(typeof(BE.TypeOfVehicle)); this.TypeOfGearControl.ItemsSource = Enum.GetValues(typeof(BE.TypeOfGearControl)); }
public void Update_test(BE.Test test) { try { //Remove_test(test); //Add_test(test); TestRoot = XElement.Load(TestPath); XElement TestElement = (from item in TestRoot.Elements() where item.Element("Test_number").Value == test.Test_number select item).FirstOrDefault(); TestElement.Element("Grade").Value = test.Grade.ToString(); TestElement.Element("Tester_comment").Value = test.Tester_comment; foreach (BE.Criterion item in test.Criteria_list) { XElement Score = new XElement("Score", (int)item.Score); XElement Description = new XElement("Description", item.Description); XElement Criterion = new XElement("Criterion", Score, Description); TestElement.Element("Criteria_list").Add(Criterion); } TestRoot.Save(TestPath); } catch { throw new Exception("שגיאה בעדכון מבחן: קרתה תקלה בגישה אל קובץ הנתונים, אנא נסה שוב"); } }
/// <summary> /// Appeal Decision ctor /// </summary> /// <param name="Oldtest"></param> public AppealDecision(BE.Test Oldtest) { test = Oldtest; InitializeComponent(); this.DataContext = test; this.AppealTextBox.SelectionChanged += AppealTextBox_SelectionChanged; this.WelcomeTextBlock.Text = "פרטי הטסט:\n" + test + '\n' + "בטיחות - " + test.Indices["בטיחות"] + ", שליטה בהגה - " + test.Indices["שליטה בהגה"] + ", שליטה בהילוכים - " + test.Indices["שליטה בהילוכים"] + ", הסתכלות במראות - " + test.Indices["הסתכלות במראות"] + ", מתן זכות קדימה - " + test.Indices["מתן זכות קדימה"] + ", מהירות - " + test.Indices["מהירות"] + ", איתות - " + test.Indices["איתות"] + ", האצה והאטה בבטחה - " + test.Indices["האצה והאטה בבטחה"] + ", ציות לתמרורים - " + test.Indices["ציות לתמרורים"] + '\n' + ", שמירה רווח - " + test.Indices["שמירה רווח"] + ", בטיחות הולכי רגל - " + test.Indices["בטיחות הולכי רגל"] + ", עקיפות - " + test.Indices["עקיפות"] + ", חנייה - " + test.Indices["חנייה"] + ", פניות - " + test.Indices["פניות"] + ", השתלבות בתנועה - " + test.Indices["השתלבות בתנועה"] + ", אביזרי בטיחות - " + test.Indices["אביזרי בטיחות"] + ", נסיעה לאחור - " + test.Indices["נסיעה לאחור"] + ", שמירה על הימין - " + test.Indices["שמירה על הימין"] + ".\n" + "טענות התלמיד:\n" + test.AppealTest.TraineeNotes + '\n'; }
// ------------------------------------------------------------------------------------------ // Test functions: /// <summary> /// Add test to the DS /// </summary> /// <param name="test">Test show WITHOUT TEST NUMBER!</param> public void Add_test(BE.Test test) { BE.Configuration.Test_serial_number++; test.Test_number = BE.Configuration.Test_serial_number.ToString("X8"); DS.DataSource.Tests_list.Add(test); }
private void UpdateTestButton_Click(object sender, RoutedEventArgs e) { bool distance, park, mirrors, signals, score; if (TestDistancekeepToUpdate.Text == "True") { distance = true; } else { distance = false; } if (TestParkingInReverseToUpdate.Text == "True") { park = true; } else { park = false; } if (TestLookingAtMirrorsToUpdate.Text == "True") { mirrors = true; } else { mirrors = false; } if (TestSignalsToUpdate.Text == "True") { signals = true; } else { signals = false; } if (TestScoreToUpdate.Text == "True") { score = true; } else { score = false; } BE.Address a = new BE.Address(); a.street = TestStreetToUpdate.Text; a.buildingNumber = Convert.ToInt32(TestBuildingNumberToUpdate.Text); a.city = TestCityToUpdate.Text; try { BE.Test toUpdate = new BE.Test(Convert.ToInt32(TestNumberToUpdateTest.Text), Convert.ToString(TestTesterIdToUpdate.Text), Convert.ToString(TestTraineeIdToUpdate.Text), Convert.ToDateTime(TestdateForTestTestToUpdate.Text), Convert.ToDateTime(TestDateAndTimeForTestToUpdate.Text), a, distance, park, mirrors, signals, score, TestTesterCommentToUpdate.Text); bl.updateTestAtTheEnd(toUpdate); } catch (Exception ex) { MessageBox.Show(ex.Message); } testListBox.DataContext = bl.getTestsList(); }
private void NumbOfTestComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (this.ComboBoxTestsToUpdate.SelectedItem is BE.Test) { this.currentTest = new BE.Test((BE.Test) this.ComboBoxTestsToUpdate.SelectedItem); this.DataContext = currentTest; } }
public SetTestResult() { InitializeComponent(); test = new BE.Test(); trainee = new BE.Trainee(); this.result.DataContext = test; bl = BL.FactoryBL.GetBL(); }
private void EditTest(object sender, RoutedEventArgs e) { UpdateTestWindow window = new UpdateTestWindow(Test); window.ShowDialog(); Test = iBL_Imp.SearchTest(Test.Test_number)[0]; Fill_data(); }
public LicenseFee(BE.Test test) { InitializeComponent(); txb_Date.Text = test.Test_time.AddMonths(2).ToString("dd.MM.yyyy"); txb_Name.Text = iBL_Imp.SearchTrainee(test.Traniee_id)[0].Last_name + " " + iBL_Imp.SearchTrainee(test.Traniee_id)[0].First_name; txb_ID.Text = test.Traniee_id; txb_Car_Type.Text = new CarTypeConvertorToString().Convert(test.Student_car_Type, null, null, null) as string + " - " + new GearboxTypeConvertorToString().Convert(iBL_Imp.SearchTrainee(test.Traniee_id)[0].Gear_used, null, null, null); }
public deleteTest() { InitializeComponent(); InitializeComponent(); bl = BL.FactoryBL.getBL(); test = new BE.Test(); this.DataContext = test; TestNameComboBox.ItemsSource = from item in bl.getAllTest() select item.TestNumber; }
public void receiveTester(BE.Tester testerFromOptionsToTester) { thisTester = new BE.Tester(testerFromOptionsToTester); ourListOfTests = this.passedTestsWithoutExamination(thisTester._ID); this.ComboBoxTestsToUpdate.ItemsSource = ourListOfTests; currentTest = new BE.Test(); this.DataContext = currentTest; }
private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (comboBox.SelectedIndex != -1) { button.IsEnabled = true; TestItem = bl.FindTest(int.Parse(comboBox.SelectedValue.ToString())); grid1.DataContext = TestItem; ParametersGrid.DataContext = TestItem.Paramet; grid2.DataContext = TestItem.BeginAddress; } }
public AddTest() { InitializeComponent(); test = new BE.Test(); bl = BL.FactoryBL.getBL(); comboBox.ItemsSource = from item in bl.getAllTester() select item.id; comboBox1.ItemsSource = from item in bl.getAllTrainee() select item.id; }
public addNewTest() { InitializeComponent(); bl = BL.factoryBL.getBL(); traineeToTest = new BE.Trainee(); newTest = new BE.Test(); leavingAdress = new BE.StructTypes.Adress(); this.DataContext = newTest; isRunnig = false; }
private void GrabarFechaTest(BE.Test pTest) { try { //session.Update(pTest); session.Flush(); //session.Refresh(pTest); } catch (Exception ex) { throw ex; } }
public void DisplayResult(Object sender, EventArgs e) { BL.IBL bl = BL.FactoryBL.GetBL(); var bc = new BrushConverter(); string id = this.checkId.Text; int newid = int.Parse(id); BE.Tester isExistTester = bl.getTesterBL(newid); if (isExistTester != null) { BE.Test testOfnumber = bl.getTestByNumber((checkTestNumber.Text)); if (testOfnumber != null) { if (isExistTester.Id == testOfnumber.TesterId) { details.Foreground = (Brush)bc.ConvertFrom("#019EAA"); if (testOfnumber.PassedTheTest == true) { details.Text = ".הנבחן עבר את הטסט בהצלחה\n\n\n"; } else { details.Text = ".הנבחן נכשל בטסט\n\n\n"; } string help = ":ההערה שלך\n"; help += testOfnumber.TesterComment; details.Text += help; string help1 = "\n\n:פירוט תוצאות המבחן\n"; help1 += testOfnumber.TestReport(); details.Text += help1; } else { details.Foreground = (Brush)bc.ConvertFrom("Red"); details.Text = "הת.ז. לא מתאים למספר מבחן שהוזן "; } } else { details.Foreground = (Brush)bc.ConvertFrom("Red"); details.Text = "המספר מבחן שהוזן לא נמצא במערכת"; } } else { details.Foreground = (Brush)bc.ConvertFrom("Red"); details.Text = "הת.ז. שהוזן לא נמצא במערכת "; } }
public void Update_test(BE.Test test) { List <BE.Test> tests = SearchTest(test.Test_number, false, false, true); if (tests.Count == 0) { throw new Exception("שגיאת עדכון: המבחן לא קיים במערכת"); } if (test.Criteria_list.Count == 0 || test.Tester_comment == null) { throw new Exception("שגיאת עדכון: לא מילאת את כל הפרטים"); } Dal.Update_test(test); }
private void comboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { bl.updateTest(test); test = new BE.Test(); MessageBox.Show("the Test " + test.TestNumber + " update ", ""); this.DataContext = test; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public UpdateTestWindow(BE.Test test) { InitializeComponent(); //Comparison of the general test that is represented in the test window that the constructor received Test = test; // Start the Binding this.DataContext = Test; hour.Text = Test.Test_time.ToShortTimeString(); date.Text = Test.Test_time.ToLongDateString(); switch (Test.Student_car_Type) { case BE.Car_type.Private_car: car_type.Text = "רכב פרטי"; break; case BE.Car_type.Two_wheeled_vehicle: car_type.Text = "רכב דו-גלגלי"; break; case BE.Car_type.Medium_truck: car_type.Text = "משאית בינונית"; break; case BE.Car_type.Heavy_truck: car_type.Text = "משאית כבדה"; break; default: car_type.Text = "שגיאה לא הגיונית"; break; } // Fill out the list of criteria according to the criteria written in the XML code foreach (var item in grd_criteria.Children) { if (item is StackPanel) { foreach (var item1 in (item as StackPanel).Children) { if (item1 is TextBlock) { BE.Criterion criterion = new BE.Criterion(BE.Score.Bad, (item1 as TextBlock).Text); Criteria_list.Add(criterion); } } } } }
public void updateTestOnFinish(BE.Test test) { BE.Test t = new BE.Test(); foreach (BE.Test item in DS.DataSource.testsList) { if (item.TestNumber == test.TestNumber) { t = item; break; } } DS.DataSource.testsList.Remove(t); DS.DataSource.testsList.Add(test); }
private void deleteButton_Click(object sender, RoutedEventArgs e) { try { bl.deleteTest(test); BE.Test or = new BE.Test(); MessageBox.Show(test.TestNumber + "'s \n" + "is Deleted"); TestNameComboBox.ItemsSource = from item in bl.getAllTest() select item.TestNumber; this.DataContext = test; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void button_Click(object sender, RoutedEventArgs e) { try { bl.addTest(test); MessageBox.Show("the Test \"" + test.TestNumber + "\" added to the list", ""); test = new BE.Test(); this.gridAddTester.DataContext = test; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// adds the test to your calender /// </summary> /// <param name="test"></param> public void Add_To_Calender(BE.Test test) { string address = test.Address.ToString().Replace(' ', '+'); string details = "הטסט+שלך+יהיה+ב" + test.Test_time.ToShortTimeString() + "+" + test.Test_time.ToLongDateString().Replace(' ', '+'); details += (". נא להגיע לפחות חצי שעה לפני השעה הנקובה לכתובת ההתחלה").Replace(' ', '+'); details += (". יש להביא איתך את כל המסמכים הדרושים").Replace(' ', '+'); details += (". במידה ויש בעיה (הטסטר לא מגיע בזמן או בעיות נוספות) התקשר ל02-9999999.").Replace(' ', '+'); // 20180327T090000/2010327T160000Z string date = test.Test_time.Year.ToString("0000") + test.Test_time.Month.ToString("00") + test.Test_time.Day.ToString("00") + "T" + test.Test_time.Hour.ToString("00") + "0000" + @"/" + test.Test_time.Year.ToString("0000") + test.Test_time.Month.ToString("00") + test.Test_time.Day.ToString("00") + "T" + (test.Test_time.Hour + 1).ToString("00") + "0000"; string URL = @"https://www.google.com/calendar/render?action=TEMPLATE&text=יש+לך+טסט&dates=" + date + "&details=" + details + "&location=" + address + "&sf=true&output=xml"; System.Diagnostics.Process.Start(URL); }
void Idal.updateTestAtTheEnd(BE.Test t) { exist = false; for (int i = 0; i < DS.DataSource.testsList.Count; i++) { if (DS.DataSource.testsList[i].TestNumber == t.TestNumber) { DS.DataSource.testsList[i] = t; exist = true; } } if (!exist) { throw new Exception("test didnt exist"); } }
public void Remove_test(BE.Test test) { try { TestRoot = XElement.Load(TestPath); XElement TestElement = (from item in TestRoot.Elements() where item.Element("Test_number").Value == test.Test_number select item).FirstOrDefault(); TestElement.Remove(); TestRoot.Save(TestPath); } catch { throw new Exception("שגיאה במחיקת מבחן: לא ניתן למצוא את המבחן"); } }
void IBL.updateTestAtTheEnd(BE.Test t) { exist = false; for (int i = 0; i < dal.getTestsList().Count; i++) { if (dal.getTestsList()[i].TestNumber == t.TestNumber) { exist = true; } } if (!exist) { throw new Exception("Error: can not update test that is not exist"); } dal.updateTestAtTheEnd(t); }
/// <summary> /// add test to tests list and add test number to that test /// </summary> /// <param name="t">new test</param> void Idal.addTest(BE.Test t) { exist = false; foreach (BE.Test item in DS.DataSource.testsList) { if (t.TestNumber == item.TestNumber) { exist = true; } } if (exist) { throw new Exception("test already exist"); } t.TestNumber = BE.Configuration.RunningIDNumber++; // add test number to the new test and increse "runnigIDNumber by 1" DS.DataSource.testsList.Add(t); }
private void testListToUpdateSelectionChangedButton_Click(object sender, SelectionChangedEventArgs e) { BE.Test w = testListToUpdate.SelectedItem as BE.Test; TestNumberToUpdateTest.Text = Convert.ToString(w.TestNumber); TestTraineeIdToUpdate.Text = Convert.ToString(w.TraineeId); TestTesterIdToUpdate.Text = Convert.ToString(w.TesterId); TestdateForTestTestToUpdate.Text = Convert.ToString(w.DateForTest); TestDateAndTimeForTestToUpdate.Text = Convert.ToString(w.DateAndTimeForTest); TestStreetToUpdate.Text = Convert.ToString(w.CheckOutAddress.street); TestBuildingNumberToUpdate.Text = Convert.ToString(w.CheckOutAddress.buildingNumber); TestCityToUpdate.Text = Convert.ToString(w.CheckOutAddress.city); TestDistancekeepToUpdate.Text = (Convert.ToString(w.Distancekeep)); TestParkingInReverseToUpdate.Text = Convert.ToString(w.ParkingInReverse); TestLookingAtMirrorsToUpdate.Text = Convert.ToString(w.LookingAtMirrors); TestSignalsToUpdate.Text = Convert.ToString(w.Signals); TestScoreToUpdate.Text = Convert.ToString(w.Score); TestTesterCommentToUpdate.Text = Convert.ToString(w.TesterComment); }
public BE.Test TestFecha() { int testid = 1; BE.Test oTest = session.Get <BE.Test>(testid); oTest.Fecha = DateTime.Now; try { session.Merge(oTest); return(oTest); } catch (Exception e) { throw e; } }
public updateTest() { InitializeComponent(); bl = BL.factoryBL.getBL(); thisTester = new BE.Tester(); currentTest = new BE.Test(); newAdress = new BE.StructTypes.Adress(); testReport = new BE.StructTypes.testReport(); ourListOfTests = this.passedTestsWithoutExamination(thisTester._ID); this.ComboBoxTestsToUpdate.ItemsSource = ourListOfTests; this.ComboBoxTestsToUpdate.DisplayMemberPath = "num_of_test"; this.ComboBoxTestsToUpdate.SelectedValuePath = "num_of_test"; this.DataContext = currentTest; }