private DataView GetVehicleData() { Facade.IVehicle facVehicle = new Facade.Resource(); DataSet dataSet = facVehicle.GetAllWithGPS(); DataView retVal = dataSet.Tables[0].DefaultView; // Get a list of the Vehicle Controllers from the dataset if (this.VehicleControllers == null) { VehicleControllers = retVal.ToTable(true, "CurrentVehicleController"); } // Do we need to apply any filter? if (int.Parse(cboFilter.SelectedValue) > -1) { if (int.Parse(cboFilter.SelectedValue) == 0) { // Filter by GPS Status (Red, Amber, Green) retVal.RowFilter = string.Format("GPSStatus = '{0}'", rblGPSStatus.SelectedValue); } if (int.Parse(cboFilter.SelectedValue) == 1) { // Fulter by GPS Mapping Status (has a device been mapped) retVal.RowFilter = string.Format("GPSUnitID {0}", rblMappingStatus.SelectedValue == "0" ? "Is NULL OR GPSUnitID = ''" : "IS NOT NULL AND GPSUnitID <> ''"); } if (int.Parse(cboFilter.SelectedValue) == 2) { // Filter by Vehicle Controller retVal.RowFilter = string.Format("CurrentVehicleController= '{0}'", cboVehicleController.SelectedValue); } if (int.Parse(cboFilter.SelectedValue) == 3) { // Filter by Search string search = txtSearch.Text; if (search.StartsWith("T")) { search = search.Substring(1); } retVal.RowFilter = string.Format("RegNo= '{0}' OR GPSUnitID='{0}'", search); } // Set the record count this.litVehicleCount.Text = string.Format("{0} of {1} Vehicles", retVal.Count, dataSet.Tables[0].Rows.Count); } else { // Set the record count this.litVehicleCount.Text = retVal.Table.Rows.Count + " Vehicles"; } return(retVal); }
public List <Vehicle> GetVehicleData() { Facade.IVehicle facResource = new Facade.Resource(); DataSet dsVehicles = null; // get all of the drivers and convert to a Driver Resource dsVehicles = facResource.GetAllWithGPS(); List <Vehicle> vehicles = new List <Vehicle>(); foreach (DataRow row in dsVehicles.Tables[0].Rows) { vehicles.Add(new Vehicle(row)); } return(vehicles); }
/// <summary> /// Data Set Get Vehicle Data /// </summary private DataSet GetVehicleData(bool inlcudeDeleted) { Facade.IVehicle facResource = new Facade.Resource(); DataSet dsVehicles = null; Facade.IResource facTrailer = new Facade.Resource(); if (Request.QueryString["showAvailable"] != null) { DateTime startDate = rdiStartDate.SelectedDate.Value; startDate = startDate.Subtract(startDate.TimeOfDay); DateTime endDate = rdiEndDate.SelectedDate.Value; endDate = endDate.Subtract(endDate.TimeOfDay).Add(new TimeSpan(23, 59, 59)); dsVehicles = facTrailer.GetAvailableForDateRange(eResourceType.Vehicle, startDate, endDate); if (Orchestrator.Globals.Configuration.FleetMetrikInstance) { dsVehicles.Tables[0].Columns.Add("CurrentLocation", typeof(string)); } } else if (Orchestrator.Globals.Configuration.FleetMetrikInstance) { dsVehicles = facResource.GetAllWithGPS(inlcudeDeleted); dsVehicles.Tables[0].Columns.Add("CurrentLocation", typeof(string)); } else { dsVehicles = facResource.GetAllVehicles(); if (Orchestrator.Globals.Configuration.FleetMetrikInstance) { dsVehicles.Tables[0].Columns.Add("CurrentLocation", typeof(string)); } } return(dsVehicles); }