private void PopulateFilter() { Facade.Resource facResource = new Facade.Resource(); Facade.IOrganisationLocation facOrganiastionLocation = new Facade.Organisation(); //resource types var resourceTypes = facResource.GetAllResourceTypes(); cboResourceTypes.DataSource = resourceTypes.Tables[0]; cboResourceTypes.DataTextField = "Description"; cboResourceTypes.DataValueField = "ResourceTypeId"; cboResourceTypes.DataBind(); string driverTypeName = Enum.GetName(typeof(eResourceType), eResourceType.Driver); cboResourceTypes.Items.FindByText(driverTypeName).Selected = true; //driver types var driverTypes = facResource.GetAllDriverTypes(); cboDriverTypes.DataSource = driverTypes.Tables[0]; cboDriverTypes.DataTextField = "Description"; cboDriverTypes.DataValueField = "DriverTypeID"; cboDriverTypes.DataBind(); cboDriverTypes.Items.Insert(0, new ListItem("-- all --", "0")); //depots cboDepots.DataSource = facOrganiastionLocation.GetAllDepots(Orchestrator.Globals.Configuration.IdentityId); cboDepots.DataValueField = "OrganisationLocationId"; cboDepots.DataTextField = "OrganisationLocationName"; cboDepots.DataBind(); cboDepots.Items.Insert(0, new ListItem("-- all --", "0")); }
/// <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(); }