private void PopulateStaticControls() { if (Orchestrator.Globals.Configuration.UseControlAreaToFilterPCVsForReport) { Facade.ITrafficSheetFilter facTrafficSheetFilter = new Facade.Traffic(); Entities.TrafficSheetFilter defaultFilter = facTrafficSheetFilter.GetDefault(((Entities.CustomPrincipal)Page.User).IdentityId); Facade.IControlArea facControlArea = new Facade.Traffic(); cboControlAreas.DataSource = facControlArea.GetAll(); cboControlAreas.DataBind(); if (defaultFilter == null) { cboControlAreas.SelectedIndex = 0; } else { cboControlAreas.SelectedValue = defaultFilter.ControlAreaId.ToString(); } } //rdiSlotDate.SelectedDate = DateTime.Today; //rdiSlotTime.SelectedDate = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, 23, 59, 0); rdiSlotDate.SelectedDate = null; rdiSlotTime.SelectedDate = null; }
private void InitialisePage() { // Retrieve the instruction. Facade.IInstruction facInstruction = new Facade.Instruction(); m_instruction = facInstruction.GetInstruction(m_instructionID); ViewState[C_Instruction_VS] = m_instruction; // Populate the control and traffic area dropdowns. Facade.IControlArea facControlArea = new Facade.Traffic(); cboControlArea.DataSource = facControlArea.GetAll(); cboControlArea.DataBind(); cboTrafficArea.DataSource = ((Facade.ITrafficArea)facControlArea).GetAll(); cboTrafficArea.DataBind(); // Select the current control and traffic area assigned to the leg. cboControlArea.Items.FindByValue(m_instruction.ControlAreaId.ToString()).Selected = true; cboTrafficArea.Items.FindByValue(m_instruction.TrafficAreaId.ToString()).Selected = true; // Enable the checkbox if this is not the last leg in the job. Facade.IJob facJob = new Facade.Job(); Entities.InstructionCollection instructions = facInstruction.GetForJobId(m_instruction.JobId); if (instructions.Count == m_instruction.InstructionOrder + 1) { chkApplyToAllFollowingInstructions.Enabled = false; } else { chkApplyToAllFollowingInstructions.Enabled = true; } }
private void PopulateStaticControls() { // Bind the control areas using (Facade.IControlArea facControlArea = new Facade.Traffic()) cboControlArea.DataSource = facControlArea.GetAll(); cboControlArea.DataBind(); cboControlArea.Items.Insert(0, new ListItem("All", "0")); // Pre-populate fields if qs elements present if (Request.QueryString["prepop"] == "true") { m_popupJobId = Request.QueryString["jid"]; cboControlArea.SelectedIndex = Convert.ToInt32(Request.QueryString["ca"]); if (Request.QueryString["oi"] != string.Empty) { using (Facade.IOrganisation facOrganisation = new Facade.Organisation()) { Entities.Organisation client = facOrganisation.GetForIdentityId(Convert.ToInt32(Request.QueryString["oi"])); cboClient.Text = client.OrganisationName; cboClient.SelectedValue = client.IdentityId.ToString(); } } } }
private void PopulateStaticControls() { Facade.IControlArea facControlArea = new Facade.Traffic(); cboControlArea.DataSource = facControlArea.GetAll(); cboControlArea.DataTextField = "Description"; cboControlArea.DataValueField = "ControlAreaId"; cboControlArea.DataBind(); }
private void PopulateStaticControls() { using (Facade.ITrafficArea facTrafficArea = new Facade.Traffic()) chkTrafficArea.DataSource = facTrafficArea.GetAll(); chkTrafficArea.DataBind(); DateTime dteStart = NextDate(DayOfWeek.Saturday); dteStartDate.SelectedDate = dteStart; dteEndDate.SelectedDate = NextDate(DayOfWeek.Monday, dteStart); }
private void InitialisePage() { // Populate the control and traffic area dropdowns. Facade.IControlArea facControlArea = new Facade.Traffic(); cboControlArea.DataSource = facControlArea.GetAll(); cboControlArea.DataBind(); cboTrafficArea.DataSource = ((Facade.ITrafficArea)facControlArea).GetAll(); cboTrafficArea.DataBind(); if (m_instructionId != 0) { Facade.IInstruction facInstruction = new Facade.Instruction(); Entities.Instruction instruction = facInstruction.GetInstruction(m_instructionId); if (instruction.Driver != null) { tdDriver.InnerText = instruction.Driver.Individual.FullName; } if (instruction.Vehicle != null) { tdVehicle.InnerText = instruction.Vehicle.RegNo; } if (instruction.Trailer != null) { tdTrailer.InnerText = instruction.Trailer.TrailerRef; } // Select the current control and traffic area assigned to the leg. cboControlArea.Items.FindByValue(instruction.ControlAreaId.ToString()).Selected = true; cboTrafficArea.Items.FindByValue(instruction.TrafficAreaId.ToString()).Selected = true; } if (m_driverResourceId != 0) { tdDriver.InnerText = m_fullName; // Select the current control and traffic area assigned to the leg. if (m_controlAreaId > 0) { cboControlArea.Items.FindByValue(m_controlAreaId.ToString()).Selected = true; } if (m_trafficAreaId > 0) { cboTrafficArea.Items.FindByValue(m_trafficAreaId.ToString()).Selected = true; } } if (m_vehicleResourceId != 0) { tdVehicle.InnerText = m_regNo; } if (m_trailerResourceId != 0) { tdTrailer.InnerText = m_trailerRef; } }
private void PopulateTrafficAreaControl() { using (Facade.ITrafficArea facTrafficArea = new Facade.Traffic()) { cboTrafficArea.DataValueField = "TrafficAreaId"; cboTrafficArea.DataTextField = "Description"; cboTrafficArea.DataSource = facTrafficArea.GetAll(); cboTrafficArea.DataBind(); cboTrafficArea.Items.Insert(0, new ListItem("Derive from postcode", "0")); } }
private void LoadFilterData() { // Load the clients var orgFacade = new Facade.Organisation(); var orgs = orgFacade.GetAllForType(2); lbAvailableClients.DataSource = orgs.Tables[0]; lbAvailableClients.DataBind(); // Load the traffic areas Facade.ITrafficArea facTrafficArea = new Facade.Traffic(); cblTrafficAreas.DataSource = facTrafficArea.GetAll(); cblTrafficAreas.DataBind(); }
private void PopulateTrafficAreaControl() { using (Facade.ITrafficArea facTrafficArea = new Facade.Traffic()) { cboTrafficArea.DataValueField = "TrafficAreaId"; cboTrafficArea.DataTextField = "Description"; cboTrafficArea.DataSource = facTrafficArea.GetAll(); cboTrafficArea.DataBind(); cboTrafficArea.Items.Insert(0, new ListItem("Derive from postcode", "0")); if (m_isUpdate) { cboTrafficArea.Items.FindByValue(point.Address.TrafficArea.TrafficAreaId.ToString()).Selected = true; } } }
public CascadingDropDownNameValue[] GetControlAreas(string knownCategoryValues, string category) { Facade.IControlArea facTrafficArea = new Facade.Traffic(); DataSet dsControlAreas = facTrafficArea.GetAll(); int selectedControlAreaId = 0; int.TryParse(category, out selectedControlAreaId); var ret = (from dr in dsControlAreas.Tables[0].AsEnumerable() select new CascadingDropDownNameValue { name = dr.Field <string>("Description"), value = (dr.Field <int>("ControlAreaId")).ToString() }).ToArray(); return(ret); }
/// <summary> /// Populate Static Controls /// </summary> private void PopulateStaticControls() { // Load the Classes Dropdown Facade.ITrailer facResource = new Facade.Resource(); DataSet dsTrailerTypes = facResource.GetAllTrailerTypes(); cboTrailerType.DataSource = dsTrailerTypes; cboTrailerType.DataTextField = "Description"; cboTrailerType.DataValueField = "TrailerTypeId"; cboTrailerType.DataBind(); cboTrailerType.Items.Insert(0, new ListItem("--- [ Please Select ] ---", "")); // Load the Manufacturers dropdown DataSet dsTrailerManufacturers = facResource.GetAllTrailerManufacturers(); cboTrailerManufacturer.DataSource = dsTrailerManufacturers; cboTrailerManufacturer.DataTextField = "Description"; cboTrailerManufacturer.DataValueField = "TrailerManufacturerId"; cboTrailerManufacturer.DataBind(); cboTrailerManufacturer.Items.Insert(0, new ListItem("--- [ Please Select ] ---", "")); // Load the Trailer Description dropdown cboTrailerDescription.DataSource = facResource.GetAllTrailerDescriptions(); cboTrailerDescription.DataTextField = "Description"; cboTrailerDescription.DataValueField = "TrailerDescriptionId"; cboTrailerDescription.DataBind(); cboTrailerDescription.Items.Insert(0, new ListItem("--- [ Please Select ] ---", "")); Facade.IControlArea facControlArea = new Facade.Traffic(); cboControlArea.DataSource = facControlArea.GetAll(); cboControlArea.DataTextField = "Description"; cboControlArea.DataValueField = "ControlAreaId"; cboControlArea.DataBind(); cboControlArea.Items.Insert(0, new ListItem("--- [ Please Select ] ---", "")); Facade.ITrafficArea facTrafficArea = (Facade.ITrafficArea)facControlArea; cboTrafficArea.DataSource = facTrafficArea.GetAll(); cboTrafficArea.DataTextField = "Description"; cboTrafficArea.DataValueField = "TrafficAreaId"; cboTrafficArea.DataBind(); cboTrafficArea.Items.Insert(0, new ListItem("--- [ Please Select ] ---", "")); }
protected void Page_Load(object sender, EventArgs e) { Security.Authorise.EnforceAuthorisation(eSystemPortion.AddEditOrder); if (!IsPostBack) { btnCreateCollection.PostBackUrl = "collectionjob.aspx"; //TODO: Replace this on Collection and Deliveries //dteStartDate.MinValue = DateTime.Today; Facade.ITrafficArea facTrafficArea = new Facade.Traffic(); cblTrafficAreas.DataSource = facTrafficArea.GetAll(); cblTrafficAreas.DataBind(); Facade.IBusinessType facBusinessType = new Facade.BusinessType(); DataSet dsBusinessTypes = facBusinessType.GetAll(); cblBusinessTypes.DataSource = dsBusinessTypes; cblBusinessTypes.DataBind(); foreach (DataRow row in dsBusinessTypes.Tables[0].Rows) { RadMenuItem rmi = new RadMenuItem(); rmi.Text = row["Description"].ToString(); rmi.Value = row["BusinessTypeID"].ToString(); RadMenu1.Items.Add(rmi); } if (Session[C_ONLYSHOWNONCOLLECTED] != null && Session[C_ONLYSHOWNONCOLLECTED] is bool) { chkShowUnPlannedOnly.Checked = (bool)Session[C_ONLYSHOWNONCOLLECTED]; } // Get the Dates from the filter if one exists GetDates(); } }
protected void Page_Load(object sender, EventArgs e) { Security.Authorise.EnforceAuthorisation(eSystemPortion.AddEditOrder); _exportOrderEnabled = bool.Parse(ConfigurationManager.AppSettings["ExportOrderEnabled"].ToLower()); if (!IsPostBack) { // Show/hide the "Export to Palletforce" button depending on whether a module id is present in the config. btnExportOrder.Visible = _exportOrderEnabled; btnCreateDelivery.PostBackUrl = "DeliveryJob.aspx?" + this.CookieSessionID; rblDateFiltering.Items.Clear(); // amended to remove the var so that I can deploy a hot fix foreach (eDateFilterType item in Enum.GetValues(typeof(eDateFilterType))) { rblDateFiltering.Items.Add(new ListItem(Enum.GetName(typeof(eDateFilterType), item).Replace("_", " "), ((int)item).ToString())); } rblDateFiltering.Items.Add(new ListItem("Trunk Date", "3")); ListItem defaultDateFiltering = rblDateFiltering.Items.FindByValue(((int)C_DEFAULT_DATE_FILTERING).ToString()); if (defaultDateFiltering != null) { defaultDateFiltering.Selected = true; } if (rblDateFiltering.Items.Count > 0 && rblDateFiltering.SelectedItem == null) { rblDateFiltering.Items[0].Selected = true; } Facade.ITrafficArea facTrafficArea = new Facade.Traffic(); cblTrafficAreas.DataSource = facTrafficArea.GetAll(); cblTrafficAreas.DataBind(); Facade.IBusinessType facBusinessType = new Facade.BusinessType(); DataSet dsBusinessTypes = facBusinessType.GetAll(); cblBusinessTypes.DataSource = dsBusinessTypes; cblBusinessTypes.DataBind(); foreach (DataRow row in dsBusinessTypes.Tables[0].Rows) { RadMenuItem rmi = new RadMenuItem(); rmi.Text = row["Description"].ToString(); rmi.Value = row["BusinessTypeID"].ToString(); RadMenu1.Items.Add(rmi); } Facade.IOrderServiceLevel facOrderServiceLevel = new Facade.Order(); cblServiceLevel.DataSource = facOrderServiceLevel.GetAll(); cblServiceLevel.DataBind(); Facade.ExtraType facExtraType = new Facade.ExtraType(); cblSurcharges.DataSource = facExtraType.GetAllForFiltering(); cblSurcharges.DataBind(); PreSelectItems(cblServiceLevel, C_SELECTED_SERVICE_LEVELS); PreSelectItems(cblSurcharges, C_SELECTED_SURCHARGES); GetDates(); } }
private void LoadCommunication() { Facade.IInstruction facInstrucion = new Facade.Instruction(); var jobInstructions = facInstrucion.GetForJobId(_jobId); var instruction = jobInstructions.Single(i => i.InstructionID == _instructionID); // Get the driver. Facade.IDriver facDriver = new Facade.Resource(); Entities.Driver driver = facDriver.GetDriverForResourceId(_driverId); var communicationTypes = Utilities.GetEnumPairs <eDriverCommunicationType>(); // We don't offer the option to communicate by Tough Touch if the driver doesn't have a passcode or the vehicle doesn't have a Tough Touch installed. if (string.IsNullOrWhiteSpace(driver.Passcode) || instruction.Vehicle == null || !instruction.Vehicle.IsTTInstalled) { communicationTypes.Remove((int)eDriverCommunicationType.ToughTouch); } cboCommunicationType.DataSource = communicationTypes; cboCommunicationType.DataBind(); cboCommunicationType.Items.Insert(0, new ListItem("-- Select a communication type --", "")); cboCommunicationType.Attributes.Add("onchange", "cboCommunicationTypeIndex_Changed();"); cboCommunicationStatus.DataSource = Utilities.UnCamelCase(Enum.GetNames(typeof(eDriverCommunicationStatus))); cboCommunicationStatus.DataBind(); RadioButton rb = null; Entities.ContactCollection contacts = new Entities.ContactCollection(); if (driver != null && driver.Individual.Contacts != null) { contacts = driver.Individual.Contacts; } // Get the vehicle the driver is currently assigned to. Facade.IJourney facJourney = new Facade.Journey(); Entities.Vehicle currentVehicle = facJourney.GetCurrentVehicleForDriver(_driverId); if (currentVehicle != null) { contacts.Add(new Entities.Contact(eContactType.MobilePhone, currentVehicle.CabPhoneNumber)); } Entities.ContactCollection cs = new Orchestrator.Entities.ContactCollection(); rb = new RadioButton(); bool numberSelected = false; foreach (Entities.Contact contact in contacts) { if (contact.ContactDetail.Length > 0) { rb = new RadioButton(); rb.GroupName = "rblNumbers"; rb.Text = contact.ContactDetail; rb.Attributes.Add("onclick", "setNumberUsed('" + contact.ContactDetail + "');"); if (contact.ContactType == eContactType.MobilePhone || contact.ContactType == eContactType.PersonalMobile || contact.ContactType == eContactType.Telephone) { if (!numberSelected) { rb.Checked = true; txtNumber.Text = contact.ContactDetail; numberSelected = true; } } plcNumbers.Controls.Add(rb); plcNumbers.Controls.Add(new LiteralControl("<br/>")); } } rb = new RadioButton(); rb.Text = "Other"; rb.GroupName = "rblNumbers"; rb.Attributes.Add("onclick", "enableOtherTextBox();"); plcNumbers.Controls.Add(rb); bool isInvolvedInLoad = false; foreach (Entities.Instruction i in jobInstructions) { if (i.Driver != null && i.Driver.ResourceId == _driverId) { if ((eInstructionType)i.InstructionTypeId == eInstructionType.Load) { isInvolvedInLoad = true; } } } trLoadOrder.Visible = isInvolvedInLoad; if (isInvolvedInLoad) { var loadComments = BuildLoadComments(_driverId, jobInstructions); lblLoadOrder.Text = loadComments; trLoadOrder.Visible = !string.IsNullOrWhiteSpace(loadComments); } var legPlan = new Facade.Instruction().GetLegPlan(jobInstructions, false); txtComments.Text = GetComments(legPlan, eDriverCommunicationType.Phone); txtSMSText.Text = GetComments(legPlan, eDriverCommunicationType.Text); var defaultCommunicationTypeID = driver.DefaultCommunicationTypeID == 0 ? (int)eDriverCommunicationType.Phone : driver.DefaultCommunicationTypeID; //lookup the communication type in the drop down, dont select if it doesnt exist - this should only happen if the driver whos default method of communitication // is tough touch but has now moved into a vechicial without one being installed if (cboCommunicationType.Items.FindByValue(defaultCommunicationTypeID.ToString()) != null) { cboCommunicationType.Items.FindByValue(defaultCommunicationTypeID.ToString()).Selected = true; } Facade.IControlArea facControlArea = new Facade.Traffic(); cboControlArea.DataSource = facControlArea.GetAll(); cboControlArea.DataBind(); for (int instructionIndex = jobInstructions.Count - 1; instructionIndex >= 0; instructionIndex--) { if (jobInstructions[instructionIndex].Driver != null && jobInstructions[instructionIndex].Driver.ResourceId == _driverId) { hidLastInstructionInvolvedWith.Value = jobInstructions[instructionIndex].InstructionOrder.ToString(); cboControlArea.ClearSelection(); cboControlArea.Items.FindByValue(jobInstructions[instructionIndex].Point.Address.TrafficArea.ControlAreaId.ToString()).Selected = true; BindTrafficAreas(Convert.ToInt32(cboControlArea.SelectedValue), jobInstructions[instructionIndex].Point.Address.TrafficArea.TrafficAreaId); break; } } ShowPCVS(); }
private void ConfigureControlAreaManipulation(eControlAreaManipulation manipulation) { pnlConfigureControlAreasTrafficAreas.Visible = false; pnlAddTrafficAreaToControlArea.Visible = false; pnlConfigureControlArea.Visible = false; // Configure the manipulation panels switch (manipulation) { case eControlAreaManipulation.ConfigureTrafficAreas: pnlConfigureControlAreasTrafficAreas.Visible = true; cboControlAreaTrafficAreas.SelectedIndex = -1; using (Facade.ITrafficArea facTrafficArea = new Facade.Traffic()) cboControlAreaTrafficAreas.DataSource = facTrafficArea.GetForControlAreaId(m_controlArea.ControlAreaId); cboControlAreaTrafficAreas.DataTextField = "Description"; cboControlAreaTrafficAreas.DataValueField = "TrafficAreaId"; cboControlAreaTrafficAreas.DataBind(); break; case eControlAreaManipulation.AddTrafficArea: pnlConfigureControlAreasTrafficAreas.Visible = true; pnlAddTrafficAreaToControlArea.Visible = true; cboAddTrafficArea.SelectedIndex = -1; using (Facade.ITrafficArea facTrafficArea = new Facade.Traffic()) cboAddTrafficArea.DataSource = facTrafficArea.GetAll(); cboAddTrafficArea.DataTextField = "Description"; cboAddTrafficArea.DataValueField = "TrafficAreaId"; cboAddTrafficArea.DataBind(); break; case eControlAreaManipulation.AddControlArea: pnlConfigureControlArea.Visible = true; if (m_controlArea != null) { txtControlAreaDescription.Text = m_controlArea.ControlAreaName; btnActionControlArea.Text = "Update"; } else { txtControlAreaDescription.Text = String.Empty; btnActionControlArea.Text = "Add"; } break; case eControlAreaManipulation.SelectControlArea: // Set the control area m_controlArea = null; ViewState[C_CONTROL_AREA_VS] = m_controlArea; // Set the drop down list cboControlArea.SelectedIndex = -1; using (Facade.IControlArea facControlArea = new Facade.Traffic()) cboControlArea.DataSource = facControlArea.GetAll(); cboControlArea.DataTextField = "Description"; cboControlArea.DataValueField = "ControlAreaId"; cboControlArea.DataBind(); cboControlArea.Items.Insert(0, new ListItem("-- Select a Control Area -- ", "-1")); break; } }
private void ConfigureTrafficAreaManupulation(eTrafficAreaManipulation manipulation) { pnlConfigureTrafficAreaUsers.Visible = false; pnlAddUserToTrafficArea.Visible = false; pnlConfigureTrafficArea.Visible = false; // Configure the manipulation panels switch (manipulation) { case eTrafficAreaManipulation.ConfigurePlanners: pnlConfigureTrafficAreaUsers.Visible = true; cboTrafficAreaUsers.SelectedIndex = -1; using (Facade.IUser facUser = new Facade.User()) cboTrafficAreaUsers.DataSource = facUser.GetUsersForTrafficAreaId(m_trafficArea.TrafficAreaId); cboTrafficAreaUsers.DataTextField = "FullName"; cboTrafficAreaUsers.DataValueField = "IdentityId"; cboTrafficAreaUsers.DataBind(); break; case eTrafficAreaManipulation.AddPlanner: pnlConfigureTrafficAreaUsers.Visible = true; pnlAddUserToTrafficArea.Visible = true; cboAddPlanner.SelectedIndex = -1; using (Facade.IUser facUser = new Facade.User()) cboAddPlanner.DataSource = facUser.GetAllUsersInRole(eUserRole.Planner); cboAddPlanner.DataTextField = "FullName"; cboAddPlanner.DataValueField = "IdentityId"; cboAddPlanner.DataBind(); break; case eTrafficAreaManipulation.AddTrafficArea: pnlConfigureTrafficArea.Visible = true; cboControlAreaForNewTrafficArea.ClearSelection(); using (Facade.IControlArea facControlArea = new Facade.Traffic()) cboControlAreaForNewTrafficArea.DataSource = facControlArea.GetAll(); cboControlAreaForNewTrafficArea.DataTextField = "Description"; cboControlAreaForNewTrafficArea.DataValueField = "ControlAreaId"; cboControlAreaForNewTrafficArea.DataBind(); if (m_trafficArea != null) { txtTrafficAreaDescription.Text = m_trafficArea.TrafficAreaName; cboControlAreaForNewTrafficArea.Items.FindByValue(m_trafficArea.ControlAreaId.ToString()).Selected = true; btnActionTrafficArea.Text = "Update"; } else { txtTrafficAreaDescription.Text = String.Empty; btnActionTrafficArea.Text = "Add"; } break; case eTrafficAreaManipulation.SelectTrafficArea: // Set the drop down list cboTrafficArea.SelectedIndex = -1; using (Facade.ITrafficArea facTrafficArea = new Facade.Traffic()) cboTrafficArea.DataSource = facTrafficArea.GetAll(); cboTrafficArea.DataTextField = "Description"; cboTrafficArea.DataValueField = "TrafficAreaId"; cboTrafficArea.DataBind(); cboTrafficArea.Items.Insert(0, new ListItem("-- Select a Traffic Area -- ", "-1")); break; } }
private void PopulateStaticControls() { #region // Configure the min and max dates. dteStartDate.MinDate = new DateTime(2000, 1, 1); dteEndDate.MaxDate = new DateTime(2036, 12, 31); #endregion #region // Populate Control Areas Facade.IControlArea facControlArea = new Facade.Traffic(); cboControlArea.DataSource = facControlArea.GetAll(); cboControlArea.DataBind(); cboControlArea.Items[0].Selected = true; #endregion #region // Populate Traffic Areas Facade.ITrafficArea facTrafficArea = (Facade.ITrafficArea)facControlArea; cboTrafficAreas.DataSource = facTrafficArea.GetAll(); cboTrafficAreas.DataBind(); if (cboTrafficAreas.Items.Count > 8) { divTrafficAreas.Attributes.Add("class", "overflowHandler"); divTrafficAreas.Attributes.Add("style", "height:100px;"); } #endregion #region // Populate Depots Facade.IOrganisationLocation facOrganisationLocation = new Facade.Organisation(); cboDepot.DataSource = facOrganisationLocation.GetAllDepots(Orchestrator.Globals.Configuration.IdentityId); cboDepot.DataBind(); cboDepot.Items.Insert(0, new ListItem("Use Control Area and Traffic Areas to determine resource pool", "0")); #endregion #region // Populate Filters for this user PopulateFilterList(); #endregion #region // Configure the default dates. // Default dates are from the start of today until: // 1) On a Saturday, until the end of Monday. // 2) On any other day, until the end of tomorrow. DateTime startOfToday = DateTime.Now; startOfToday = startOfToday.Subtract(startOfToday.TimeOfDay); DateTime endOfTomorrow = startOfToday.Add(new TimeSpan(1, 23, 59, 59)); DateTime startDate = startOfToday; DateTime endDate = endOfTomorrow; if (startOfToday.DayOfWeek == DayOfWeek.Saturday) { DateTime endOfMonday = startOfToday.Add(new TimeSpan(2, 23, 59, 59)); endDate = endOfMonday; } #endregion #region // Populate the Business Types Facade.IBusinessType facBusinessType = new Facade.BusinessType(); cblBusinessType.DataSource = facBusinessType.GetAll(); cblBusinessType.DataTextField = "Description"; cblBusinessType.DataValueField = "BusinessTypeID"; cblBusinessType.DataBind(); #endregion #region // Populate the Instruction States cblInstructionStates.DataSource = Enum.GetNames(typeof(eInstructionState)); cblInstructionStates.DataBind(); #endregion #region // Populate the In Progress Sub-States cblInProgressSubStates.DataSource = this.InProgressSubStateDescriptions.ToDictionary(kvp => (int)kvp.Key, kvp => kvp.Value); cblInProgressSubStates.DataBind(); #endregion #region // Populate the Planning Categories Types cblPlanningCategory.DataSource = DataContext.PlanningCategorySet.OrderBy(pc => pc.DisplayShort); cblPlanningCategory.DataBind(); var liAll = new ListItem("All", "-1") { Selected = true }; cblPlanningCategory.Items.Add(liAll); #endregion #region // Populate the Instruction Types cblInstructionType.Items.Clear(); var liMWF = new ListItem("MWF", "1"); liMWF.Attributes.Add("onclick", "onInstructionTypeChecked();"); var liNonMWF = new ListItem("Non-MWF", "2"); liNonMWF.Attributes.Add("onclick", "onInstructionTypeChecked();"); cblInstructionType.Items.Add(liMWF); cblInstructionType.Items.Add(liNonMWF); #endregion #region // Populate the MWF Comms Status var list = Enum.GetValues(typeof(MWFCommunicationStatusForTrafficSheetEnum)).Cast <object>().ToDictionary(v => (int)v, v => MWF_Instruction.GetCommunicationStatusForTrafficSheetDescription((int)v)); cblMWFCommsStates.DataSource = list; cblMWFCommsStates.DataBind(); #endregion #region // Populate the MWF Instruction States // Only adding the states that we use for now var list2 = new Dictionary <int, string> { { (int)MWFStatusEnum.Drive, "Drive" }, { (int)MWFStatusEnum.OnSite, "On Site" }, { (int)MWFStatusEnum.Suspend, "Suspend" }, { (int)MWFStatusEnum.Resume, "Resume" }, { (int)MWFStatusEnum.Complete, "Complete" } }; cblMWFInstructionStates.DataSource = list2; cblMWFInstructionStates.DataBind(); #endregion if (Filter == null) { Filter = Utilities.GetFilterFromCookie(this.CookieSessionID, Request); } if (Filter == null) { Filter = GetDefaultFilter(); // Configure the default dates. // Default dates are from the start of today until: // 1) On a Saturday, until the end of Monday. // 2) On any other day, until the end of tomorrow. Filter.FilterStartDate = startOfToday; if (startOfToday.DayOfWeek == DayOfWeek.Saturday) { DateTime endOfMonday = startOfToday.Add(new TimeSpan(2, 23, 59, 59)); Filter.FilterEnddate = endOfMonday; } else { Filter.FilterEnddate = endOfTomorrow; } } cboControlArea.ClearSelection(); SelectItem(cboControlArea.Items, Filter.ControlAreaId); foreach (var taid in Filter.TrafficAreaIDs) { SelectItem(cboTrafficAreas.Items, taid); } startDate = Filter.FilterStartDate; endDate = Filter.FilterEnddate; chkShowPlanned.Checked = Filter.ShowPlannedLegs; chkShowStockMovementJobs.Checked = Filter.ShowStockMovementJobs; cboDepot.ClearSelection(); cboDepot.Items.FindByValue(Filter.DepotId.ToString()).Selected = true; foreach (var i in Filter.BusinessTypes) { try { // P1 use if we try to work on different client's version of Orchestrator // the same cookie is used (domain). cblBusinessType.Items.FindByValue(i.ToString()).Selected = true; } catch { } } foreach (int i in this.Filter.InstructionStates) { cblInstructionStates.Items.FindByValue(((eInstructionState)i).ToString()).Selected = true; } foreach (var ipss in this.Filter.InProgressSubStates) { cblInProgressSubStates.Items.FindByValue(((int)ipss).ToString()).Selected = true; } if (this.Filter.PlanningCategories.Count > 0) { foreach (ListItem li in cblPlanningCategory.Items) { li.Selected = this.Filter.PlanningCategories.Contains(int.Parse(li.Value)); } } this.chkSortbyEvent.Checked = Filter.SortbyEvent; this.chkCollapseRuns.Checked = this.Filter.CollapseRuns; liMWF.Selected = Filter.IncludeMWFInstructions; liNonMWF.Selected = Filter.IncludeNonMWFInstructions; chkSelectAllInstructionTypes.Checked = (liMWF.Selected && liNonMWF.Selected); bool allSelected = false; if (Filter.MWFCommsStates.Count > 0) { allSelected = true; foreach (ListItem li in cblMWFCommsStates.Items) { li.Selected = Filter.MWFCommsStates.Contains(int.Parse(li.Value)); if (!li.Selected) { allSelected = false; } } } chkSelectAllMWFCommsStates.Checked = allSelected; var selected = false; if (Filter.MWFInstructionStates.Count > 0) { selected = true; foreach (ListItem li in cblMWFInstructionStates.Items) { li.Selected = Filter.MWFInstructionStates.Contains(int.Parse(li.Value)); if (!li.Selected) { selected = false; } } } chkSelectAllMWFInstructionStates.Checked = selected; #region // Apply the dates. dteStartDate.SelectedDate = startDate; dteEndDate.SelectedDate = endDate; #endregion }
/// <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(); }
private void PopulateStaticControls() { #region // Populate Control Areas Facade.IControlArea facControlArea = new Facade.Traffic(); cboControlArea.DataSource = facControlArea.GetAll(); cboControlArea.DataBind(); cboControlArea.Items[0].Selected = true; #endregion #region // Populate Traffic Areas Facade.ITrafficArea facTrafficArea = (Facade.ITrafficArea)facControlArea; cboTrafficAreas.DataSource = facTrafficArea.GetAll(); cboTrafficAreas.DataBind(); #endregion #region // Populate Depots Facade.IOrganisationLocation facOrganisationLocation = new Facade.Organisation(); cboDepot.DataSource = facOrganisationLocation.GetAllDepots(Orchestrator.Globals.Configuration.IdentityId); cboDepot.DataBind(); cboDepot.Items.Insert(0, new ListItem("Use Control Area and Traffic Areas to determine resource pool", "0")); #endregion #region // Populate Filters for this user PopulateFilterList(); #endregion #region // Configure the default dates. // Default dates are from the start of today until: // 1) On a Saturday, until the end of Monday. // 2) On any other day, until the end of tomorrow. DateTime startOfToday = DateTime.Now; startOfToday = startOfToday.Subtract(startOfToday.TimeOfDay); DateTime endOfTomorrow = startOfToday.Add(new TimeSpan(1, 23, 59, 59)); DateTime startDate = startOfToday; DateTime endDate = endOfTomorrow; if (startOfToday.DayOfWeek == DayOfWeek.Saturday) { DateTime endOfMonday = startOfToday.Add(new TimeSpan(2, 23, 59, 59)); endDate = endOfMonday; } #endregion #region // Cause the job states to be displayed chkJobStates.DataSource = Utilities.UnCamelCase(Enum.GetNames(typeof(eJobState))); chkJobStates.DataBind(); #endregion #region // Load the Job Types Facade.IBusinessType facBusinessType = new Facade.BusinessType(); cblBusinessType.DataSource = facBusinessType.GetAll(); cblBusinessType.DataTextField = "Description"; cblBusinessType.DataValueField = "BusinessTypeID"; cblBusinessType.DataBind(); #endregion #region React to supplied values bool haveReacted = false; try { Entities.TrafficSheetFilter m_trafficSheetFilter = Utilities.GetFilterFromCookie(this.CookieSessionID, Request); if (m_trafficSheetFilter == null) { m_trafficSheetFilter = GetDefaultFilter(); m_trafficSheetFilter.FilterStartDate = startDate; m_trafficSheetFilter.FilterEnddate = endDate; } cboControlArea.ClearSelection(); SelectItem(cboControlArea.Items, m_trafficSheetFilter.ControlAreaId); haveReacted = true; foreach (var taid in m_trafficSheetFilter.TrafficAreaIDs) { SelectItem(cboTrafficAreas.Items, taid); } for (int i = 0; i < m_trafficSheetFilter.JobStates.Count; i++) { chkJobStates.Items.FindByValue(Utilities.UnCamelCase(Enum.Parse(typeof(eJobState), m_trafficSheetFilter.JobStates[i].ToString()).ToString())).Selected = true; } cboDepot.ClearSelection(); cboDepot.Items.FindByValue(m_trafficSheetFilter.DepotId.ToString()).Selected = true; dteStartDate.SelectedDate = m_trafficSheetFilter.FilterStartDate; dteEndDate.SelectedDate = m_trafficSheetFilter.FilterEnddate; cblBusinessType.ClearSelection(); foreach (int i in m_trafficSheetFilter.BusinessTypes) { cblBusinessType.Items.FindByValue(i.ToString()).Selected = true; } } catch (Exception eX) { Entities.TrafficSheetFilter ts = GetDefaultFilter(); ts.FilterStartDate = startDate; dteStartDate.SelectedDate = startDate; ts.FilterEnddate = endDate; dteEndDate.SelectedDate = endDate; if (Request.Cookies[this.CookieSessionID] == null) { SetCookie(ts); } BindDefaultFilter(); } finally { // Apply the dates. } #endregion }
/// <summary> /// Populate Static Controls /// </summary> private void PopulateStaticControls() { if (Orchestrator.Globals.Configuration.FleetMetrikInstance) { OnlyEnableFleetMetrikFields(); } if (!Orchestrator.Globals.Configuration.ShowVehicleDepot) { vehicleDepot.Style.Add("display", "none"); cboTrafficArea.Visible = false; rfvDepot.Enabled = false; } // Load the Classes Dropdown Facade.IVehicle facResource = new Facade.Resource(); DataSet dsVehicleClasses = facResource.GetAllVehicleClasses(); cboClass.DataSource = dsVehicleClasses; cboClass.DataTextField = "Description"; cboClass.DataValueField = "VehicleClassId"; cboClass.DataBind(); cboClass.Items.Insert(0, new ListItem("--- [ Please Select ] ---", "")); // load the vehicle Types cboVehicleType.DataSource = facResource.GetAllVehicleTypes(); cboVehicleType.Items.Insert(0, new ListItem("--- [ Please Select ] ---", "")); cboVehicleType.DataBind(); // Can this system support fixed units? chkIsFixedUnit.Enabled = Configuration.InstallationSupportsFixedUnits; // Load the Manufacturers Dropdown Facade.IVehicle facVehicleMan = new Facade.Resource(); DataSet dsVehicleManufacturers = facVehicleMan.GetAllVehicleManufacturers(); cboManufacturer.DataSource = dsVehicleManufacturers; cboManufacturer.DataTextField = "Description"; cboManufacturer.DataValueField = "VehicleManufacturerId"; cboManufacturer.DataBind(); cboManufacturer.Items.Insert(0, new ListItem("--- [ Please Select ] ---", "")); cboVehicleType.DataSource = facResource.GetAllVehicleTypes(); cboVehicleType.DataBind(); cboVehicleType.Items.Insert(0, new ListItem("--- [ Please Select ] ---", "0")); // Load the Model Dropdown with relevant fields cboManufacturer_SelectedIndexChanged(cboManufacturer, EventArgs.Empty); Facade.IOrganisationLocation facOrganiastionLocation = new Facade.Organisation(); cboDepot.DataSource = facOrganiastionLocation.GetAllDepots(Configuration.IdentityId); cboDepot.DataValueField = "OrganisationLocationId"; cboDepot.DataTextField = "OrganisationLocationName"; cboDepot.DataBind(); cboDepot.Items.Insert(0, new ListItem("--- [ Please Select ] ---", "")); Facade.IControlArea facControlArea = new Facade.Traffic(); cboControlArea.DataSource = facControlArea.GetAll(); cboControlArea.DataTextField = "Description"; cboControlArea.DataValueField = "ControlAreaId"; cboControlArea.DataBind(); cboControlArea.Items.Insert(0, new ListItem("--- [ Please Select ] ---", "")); Facade.ITrafficArea facTrafficArea = (Facade.ITrafficArea)facControlArea; cboTrafficArea.DataSource = facTrafficArea.GetAll(); cboTrafficArea.DataTextField = "Description"; cboTrafficArea.DataValueField = "TrafficAreaId"; cboTrafficArea.DataBind(); cboTrafficArea.Items.Insert(0, new ListItem("--- [ Please Select ] ---", "")); // Get the nominal codes Facade.INominalCode facNominalCode = new Orchestrator.Facade.NominalCode(); DataSet dsNominalCodes = facNominalCode.GetAllActive(); cboNominalCode.Items.Insert(0, new ListItem("--- [ Please Select ] ---", "0")); foreach (DataRow row in dsNominalCodes.Tables[0].Rows) { ListItem item = new ListItem(); item.Value = row["NominalCodeId"].ToString(); item.Text = row["NominalCode"].ToString() + " - " + row["Description"].ToString(); cboNominalCode.Items.Add(item); } InitialiseTelematicsSolution(); }