public bool AddDrivingTest(Test drivingTest) { Test TestToAdd = (Test)drivingTest.Clone(); TestToAdd.TestNumber = (++Configuration.CurrentTestNumber).ToString(); DAL.DataSource.getTests.Add(TestToAdd); //Console.WriteLine(TestToAdd); return(true); }
public bool UpdateTest(Test drivingTest) { foreach (Test item in DS.DataSource.TestsList) { if (drivingTest.codeOfTest == item.codeOfTest) { DS.DataSource.TestsList.Remove(item); //delete corente test DS.DataSource.TestsList.Add(drivingTest.Clone()); //add the update test return(true); } } throw new Exception("The current test is not in the database"); }
public bool addTest(Test test) { foreach (var item in DataSource.Tests) { if (item.TestNumber == test.TestNumber) { return(false); } } DataSource.Tests.Add(test.Clone()); return(true); }
public bool AddTest(Test drivingTest) { if (drivingTest.codeOfTest != 0) { throw new Exception("this test is already in the system"); } //initillizing the test code Test test = drivingTest.Clone(); drivingTest.codeOfTest = Configuration.CODE_OF_TEST; test.codeOfTest = Configuration.CODE_OF_TEST++; DS.DataSource.TestsList.Add(test); return(true); }
public bool UpdateDrivingTest(Test drivingTest) { var x = (from d in DAL.DataSource.getTests where (d.TestNumber == drivingTest.TestNumber) select d).FirstOrDefault(); //x.Tester_ID = drivingTest.Tester_ID; //x.StartingPoint = drivingTest.StartingPoint; DAL.DataSource.getTests.Remove(x); DAL.DataSource.getTests.Add((Test)drivingTest.Clone()); return(true); }