public void Display() { Visibilities = new BoundVisibilities(); BoundVehicleObject = new BoundVehicle(this, _entityManager); ShiftNames = new BoundShiftNames(); SelectedVehicle = null; SelectedTrace = null; VehicleList = _entityQuery.Where <Vehicle>().ToList().OrderBy(x => x.Name).ToList(); TraceList = _entityQuery.Where <Trace>().ToList().OrderBy(x => x.Name).ToList(); _shellViewModel.ActivateItem(this); }
private List <TestResult> GetTestResults() { IEnumerable <TestResult> testResults = EntityQuery.Where <TestResult>(); testResults = testResults.OrderByDescending(x => x.Created); return(testResults.ToList()); }
private void QueryResourcesOnLoop(int testCount, string testName, int fuelCount, string fuelName, int vehicleCount, string vehicleName) { string[] uniqueProperties = { "Name", "ID", "Properties", "Created", "SoftwareVersion" }; string newTestName = null; string newFuelName = null; string newVehicleName = null; for (int i = 0; i < 100; i++) { if (testName != null && _entityQuery.Where <Test>().Count() != testCount && (fuelName == null || newFuelName != null) && (vehicleName == null || newVehicleName != null)) { Test vtsTest = GetVetsTest(Config.TestResourceName); newTestName = _entityQuery.Where <Test>().OrderByDescending(x => x.Created).First().Name; Test newTest = GetVetsTest(newTestName); foreach (PropertyInfo property in vtsTest.GetType().GetProperties()) { if (!uniqueProperties.Contains(property.Name)) { newTest.GetType().GetProperty(property.Name).SetValue(newTest, property.GetValue(vtsTest, null), null); } } if (fuelName != null) { newTest.FuelName = newFuelName; } if (vehicleName != null) { newTest.VehicleName = newVehicleName; } _entityManagerView.Lookup(ResourceType.Test).Value.Update(newTest.ID, newTest.Properties); _logger.AddLogEntry(TraceEventType.Information, SystemLogSources.DataAccess, String.Format("Test resource '{0}' was successfully created.", newTestName)); return; } if (fuelName != null && newFuelName == null && _entityQuery.Where <Fuel>().Count() != fuelCount) { Fuel vtsFuel = GetVetsFuel(Config.FuelResourceName); string newName = _entityQuery.Where <Fuel>().OrderByDescending(x => x.Created).First().Name; Fuel newFuel = GetVetsFuel(newName); foreach (PropertyInfo property in vtsFuel.GetType().GetProperties()) { if (!uniqueProperties.Contains(property.Name)) { newFuel.GetType().GetProperty(property.Name).SetValue(newFuel, property.GetValue(vtsFuel, null), null); } } _entityManagerView.Lookup(ResourceType.Fuel).Value.Update(newFuel.ID, newFuel.Properties); _logger.AddLogEntry(TraceEventType.Information, SystemLogSources.DataAccess, String.Format("Fuel resource '{0}' was successfully created.", newName)); newFuelName = newName; if ((testName == null && vehicleName == null) || (testName == null && newVehicleName != null)) { return; } } if (vehicleName != null && newVehicleName == null && _entityQuery.Where <Vehicle>().Count() != vehicleCount) { Vehicle vtsVehicle = GetVetsVehicle(Config.VehicleResourceName); string newName = _entityQuery.Where <Vehicle>().OrderByDescending(x => x.Created).First().Name; Vehicle newVehicle = GetVetsVehicle(newName); foreach (PropertyInfo property in vtsVehicle.GetType().GetProperties()) { if (!uniqueProperties.Contains(property.Name)) { newVehicle.GetType().GetProperty(property.Name).SetValue(newVehicle, property.GetValue(vtsVehicle, null), null); } } _entityManagerView.Lookup(ResourceType.Vehicle).Value.Update(newVehicle.ID, newVehicle.Properties); _logger.AddLogEntry(TraceEventType.Information, SystemLogSources.DataAccess, String.Format("Vehicle resource '{0}' was successfully created.", newName)); newVehicleName = newName; if ((testName == null && fuelName == null) || (testName == null && newFuelName != null)) { return; } } Thread.Sleep(100); } }