private void ShowVehicles() { lstVehiclesInProfile.Items.Clear(); lstVehicles.Items.Clear(); // Get a list of the vehicles. Facade.IVehicle facVehicle = new Facade.Resource(); DataSet dsVehicles = facVehicle.GetAllVehicles(); foreach (DataRow row in dsVehicles.Tables[0].Rows) { if (row["GPSUnitID"] != DBNull.Value && !String.IsNullOrEmpty(row["GPSUnitID"].ToString()) && this.Profile.GPSUnits.Exists(a => a == row["GPSUnitID"].ToString())) { lstVehiclesInProfile.Items.Add(new Telerik.Web.UI.RadListBoxItem() { Text = row["RegNo"].ToString(), Value = row["GPSUnitID"].ToString() }); } else { lstVehicles.Items.Add(new Telerik.Web.UI.RadListBoxItem() { Text = row["RegNo"].ToString(), Value = row["GPSUnitID"].ToString() }); } } }
private void LoadVehicles() { Facade.Resource facVehicle = new Facade.Resource(); var vehicles = facVehicle.GetAllVehicles().Tables[0].AsEnumerable(); var dropdownData = vehicles.Select(d => new { Text = d.Field <string>("RegNo"), Value = d.Field <string>("RegNo") }); this.VehiclePicker.DataSource = dropdownData; this.VehiclePicker.DataBind(); }
/// <summary> /// Populate the vehicle dropdown with all vehicles /// </summary> private void PopulateVehicleDropdown() { Facade.IVehicle vehicle = new Facade.Resource(); cboVehicle.Items.Clear(); System.Data.DataSet dsVehicles = vehicle.GetAllVehicles(); cboVehicle.DataSource = dsVehicles; cboVehicle.DataTextField = "RegNo"; cboVehicle.DataValueField = "ResourceId"; cboVehicle.DataBind(); cboVehicle.Items.Insert(0, new RadComboBoxItem("- Select -", "-1")); }
//---------------------------------------------------------------------------- private void PopulateVehicles() { Facade.IVehicle facVehicle = new Facade.Resource(); DataSet dsVehicles = facVehicle.GetAllVehicles(); cboVehicle.DataSource = dsVehicles; cboVehicle.DataTextField = "RegNo"; cboVehicle.DataValueField = "ResourceId"; cboVehicle.DataBind(); cboVehicle.Items.Insert(0, new ListItem("--- [ Please Select ] ---", "-1")); if (Request.QueryString["resourceId"] != null) { cboVehicle.SelectedValue = Request.QueryString["resourceId"].ToString(); } }
/// <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); }
/// <summary> /// Populate Static Controls /// </summary> private void PopulateStaticControls() { if (Orchestrator.Globals.Configuration.FleetMetrikInstance) { OnlyEnableFleetMetrikFields(); } cboTitle.DataSource = Utilities.UnCamelCase(Enum.GetNames(typeof(eTitle))); cboTitle.DataBind(); IDriver facDriver = new Facade.Resource(); cboDriverType.DataSource = facDriver.GetAllDriverTypes(); cboDriverType.DataTextField = "Description"; cboDriverType.DataValueField = "DriverTypeID"; cboDriverType.DataBind(); cboDriverType.Items.Insert(0, new ListItem("--- [ Please Select ] ---", "")); // Configure the attributes for the address target textboxes. txtAddressLine1.Attributes.Add("onfocus", "this.blur();" + txtPostCode.ClientID + ".focus();"); txtAddressLine2.Attributes.Add("onfocus", "this.blur();" + txtPostCode.ClientID + ".focus();"); txtAddressLine3.Attributes.Add("onfocus", "this.blur();" + txtPostCode.ClientID + ".focus();"); txtPostTown.Attributes.Add("onfocus", "this.blur();" + txtPostCode.ClientID + ".focus();"); txtCounty.Attributes.Add("onfocus", "this.blur();" + txtPostCode.ClientID + ".focus();"); IVehicle facVehicle = new Facade.Resource(); var dsVehicles = facVehicle.GetAllVehicles(); cboVehicle.DataSource = dsVehicles; cboVehicle.DataTextField = "RegNo"; cboVehicle.DataValueField = "ResourceId"; cboVehicle.DataBind(); cboVehicle.Items.Insert(0, new ListItem("--- [ Please Select ] ---", "-1")); IOrganisationLocation facOrganiastionLocation = new Facade.Organisation(); cboDepot.DataSource = facOrganiastionLocation.GetAllDepots(Configuration.IdentityId); cboDepot.DataValueField = "OrganisationLocationId"; cboDepot.DataTextField = "OrganisationLocationName"; cboDepot.DataBind(); cboDepot.Items.Insert(0, new Telerik.Web.UI.RadComboBoxItem("--- [ Please Select ] ---")); IControlArea facControlArea = new Facade.Traffic(); cboControlArea.DataSource = facControlArea.GetAll(); cboControlArea.DataTextField = "Description"; cboControlArea.DataValueField = "ControlAreaId"; cboControlArea.DataBind(); cboControlArea.Items.Insert(0, new Telerik.Web.UI.RadComboBoxItem("--- [ Please Select ] ---")); var facTrafficArea = (ITrafficArea)facControlArea; cboTrafficArea.DataSource = facTrafficArea.GetAll(); cboTrafficArea.DataTextField = "Description"; cboTrafficArea.DataValueField = "TrafficAreaId"; cboTrafficArea.DataBind(); cboTrafficArea.Items.Insert(0, new Telerik.Web.UI.RadComboBoxItem("--- [ Please Select ] ---")); this.dteDOB.MinDate = new DateTime(1900, 1, 1); IUser facUser = new Facade.User(); cboDriverPlanner.DataSource = facUser.GetAllUsersInRole(eUserRole.Planner); cboDriverPlanner.DataValueField = "IdentityID"; cboDriverPlanner.DataTextField = "FullName"; cboDriverPlanner.DataBind(); cboDriverPlanner.Items.Insert(0, new Telerik.Web.UI.RadComboBoxItem("--- [ Please Select ] ---")); //Load Agencies using (var uow = DIContainer.CreateUnitOfWork()) { var agenciesRepo = DIContainer.CreateRepository <IAgencyRepository>(uow); var agencies = agenciesRepo.GetAgencies(); foreach (var ag in agencies) { var rcItem = new Telerik.Web.UI.RadComboBoxItem(); rcItem.Text = ag.Name; rcItem.Value = ag.AgencyId.ToString(); cboAgency.Items.Add(rcItem); } } InitialiseTelematicsSolution(); BindDriverCommunicationTypes(); }