void btnAdd_Click(object sender, System.EventArgs e) { if (Page.IsValid) { Button currentButton = sender as Button; Facade.IPCV facPCV = new Facade.PCV(); Facade.ITrafficArea facTrafficArea = new Facade.Traffic(); Entities.PCV newPCV = LoadPCV(); int pcvID = facPCV.Create(newPCV, ((Entities.CustomPrincipal)Page.User).UserName); //Do reset if specified switch (currentButton.CommandArgument.ToLower()) { case "add_reset": ConfigureDisplay(); break; } //Popup PCV Details if (pcvID > 0) { ShowConfirmationWindow(newPCV.ScannedFormId, pcvID); } LoadPCVList(); } }
private Entities.TrafficSheetFilter GetDefaultFilter() { Facade.ITrafficSheetFilter facTrafficSheetFilter = new Facade.Traffic(); Entities.TrafficSheetFilter ts = facTrafficSheetFilter.GetDefault(((Entities.CustomPrincipal)Page.User).IdentityId); return(ts); }
private void UseDefaultFilter() { Facade.ITrafficSheetFilter facTrafficSheetFilter = new Facade.Traffic(); m_trafficSheetFilter = facTrafficSheetFilter.GetDefault(((Entities.CustomPrincipal)Page.User).IdentityId); // 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)); m_trafficSheetFilter.FilterStartDate = startOfToday; if (startOfToday.DayOfWeek == DayOfWeek.Saturday) { DateTime endOfMonday = startOfToday.Add(new TimeSpan(2, 23, 59, 59)); m_trafficSheetFilter.FilterEnddate = endOfMonday; } else { m_trafficSheetFilter.FilterEnddate = endOfTomorrow; } BindJobData(); }
private void PopulateStaticControls() { #region // Populate Control Areas Facade.IControlArea facControlArea = new Facade.Traffic(); #endregion #region // Populate Traffic Areas Facade.ITrafficArea facTrafficArea = (Facade.ITrafficArea)facControlArea; cblTrafficAreas.DataSource = facTrafficArea.GetAll(); cblTrafficAreas.DataBind(); if (cblTrafficAreas.Items.Count > 8) { divTrafficAreas.Attributes.Add("class", "overflowHandler"); divTrafficAreas.Attributes.Add("style", "height:100px;"); } for (int i = 0; i < cblTrafficAreas.Items.Count; i++) { cblTrafficAreas.Items[i].Selected = true; } #endregion #region // Cause the job states to be displayed cblJobStates.DataSource = Utilities.GetEnumPairs <eJobState>(); cblJobStates.DataBind(); #endregion }
private void btnSelectTrafficArea_Click(object sender, EventArgs e) { btnSelectTrafficArea.DisableServerSideValidation(); if (Page.IsValid) { // Add this traffic area to this control area. int trafficAreaId = Convert.ToInt32(cboAddTrafficArea.SelectedValue); bool success = false; using (Facade.ITrafficArea facTrafficArea = new Facade.Traffic()) { Entities.TrafficArea trafficArea = facTrafficArea.GetForTrafficAreaId(trafficAreaId); trafficArea.ControlAreaId = m_controlArea.ControlAreaId; success = facTrafficArea.Update(trafficArea, ((Entities.CustomPrincipal)Page.User).UserName); } if (success) { lblConfirmation.Text = "The traffic area has been added."; ConfigureControlAreaManipulation(eControlAreaManipulation.ConfigureTrafficAreas); } else { lblConfirmation.Text = "The traffic area has not been added."; } lblConfirmation.Visible = true; } }
public static Entities.TrafficSheetFilter GenerateCookie(string sessionID, HttpResponse response, int identityID) { Entities.TrafficSheetFilter _filter = new Orchestrator.Entities.TrafficSheetFilter(); Facade.ITrafficSheetFilter facTrafficSheetFilter = new Facade.Traffic(); _filter = facTrafficSheetFilter.GetDefault(identityID); #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)); _filter.FilterStartDate = startOfToday; //ViewState["m_startDate"] = startOfToday; if (startOfToday.DayOfWeek == DayOfWeek.Saturday) { DateTime endOfMonday = startOfToday.Add(new TimeSpan(2, 23, 59, 59)); //ViewState["m_endDate"] = endOfMonday; _filter.FilterEnddate = endOfMonday; } else { _filter.FilterEnddate = endOfTomorrow; } //ViewState["m_endDate"] = endOfTomorrow; #endregion return(_filter); }
private void ConfigureDefaultFilter() { Facade.ITrafficSheetFilter facFilters = new Facade.Traffic(); m_trafficSheetFilter = facFilters.GetDefault(((Entities.CustomPrincipal)Page.User).IdentityId); if (m_isJobSheet && m_jobSheetMode != eJobSheetMode.Normal) { switch (m_jobSheetMode) { case eJobSheetMode.Planning: m_trafficSheetFilter.JobStates.Add(eJobState.Booked); break; case eJobSheetMode.Completed: m_trafficSheetFilter.JobStates.Add(eJobState.Completed); m_trafficSheetFilter.JobStates.Add(eJobState.BookingInComplete); m_trafficSheetFilter.JobStates.Add(eJobState.BookingInIncomplete); m_trafficSheetFilter.JobStates.Add(eJobState.ReadyToInvoice); m_trafficSheetFilter.JobStates.Add(eJobState.Invoiced); break; } } else { m_trafficSheetFilter.JobStates.Add(eJobState.Booked); m_trafficSheetFilter.JobStates.Add(eJobState.Planned); m_trafficSheetFilter.JobStates.Add(eJobState.InProgress); } BindData(); }
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; } }
void btnRefresh_Click(object sender, EventArgs e) { CaptureOrderIDs(); Entities.TrafficSheetFilter _filter = Utilities.GetFilterFromCookie(this.CookieSessionID, Request); _filter.FilterStartDate = dteStartDate.SelectedDate.Value.Subtract(dteStartDate.SelectedDate.Value.TimeOfDay); _filter.FilterEnddate = dteEndDate.SelectedDate.Value; _filter.BusinessTypes.Clear(); foreach (ListItem li in cblBusinessTypes.Items) { if (li.Selected) { _filter.BusinessTypes.Add(int.Parse(li.Value)); } } _filter.TrafficAreaIDs.Clear(); Facade.ITrafficArea facTrafficArea = new Facade.Traffic(); foreach (ListItem li in cblTrafficAreas.Items) { if (li.Selected) { _filter.TrafficAreaIDs.Add(int.Parse(li.Value)); } } SetCookie(_filter); // Persist the checkbox selection value to session. Session[C_ONLYSHOWNONCOLLECTED] = chkShowUnPlannedOnly.Checked; grdOrders.Rebind(); }
private void btnSelectUser_Click(object sender, EventArgs e) { btnSelectTrafficArea.DisableServerSideValidation(); if (Page.IsValid) { // Add this planner to this traffic area. int identityId = Convert.ToInt32(cboAddPlanner.SelectedValue); bool success = false; using (Facade.ITrafficArea facTrafficArea = new Facade.Traffic()) success = facTrafficArea.CreateUser(m_trafficArea, identityId, ((Entities.CustomPrincipal)Page.User).UserName); if (success) { lblConfirmation.Text = "The planner is now attached to the traffic area."; ConfigureTrafficAreaManupulation(eTrafficAreaManipulation.ConfigurePlanners); } else { lblConfirmation.Text = "The planner could not be attached to the traffic area."; } lblConfirmation.Visible = true; } }
public CascadingDropDownNameValue[] GetTrafficAreas(string knownCategoryValues, string category, string contextKey) { int controlAreaID; //this stringdictionary contains has table with key value //pair of cooountry and countryID StringDictionary countryValues = AjaxControlToolkit.CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues); controlAreaID = Convert.ToInt32(countryValues["ControlArea"]); Facade.ITrafficArea facTrafficArea = new Facade.Traffic(); DataSet dsTrafficAreas = facTrafficArea.GetForControlAreaId(controlAreaID); var ret = (from dr in dsTrafficAreas.Tables[0].AsEnumerable() select new CascadingDropDownNameValue { name = dr.Field <string>("Description"), value = (dr.Field <int>("TrafficAreaId")).ToString() }).ToArray(); foreach (var v in ret) { if (v.value == contextKey) { v.isDefaultValue = true; break; } } return(ret); }
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 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(); } } } }
void grdFilters_ItemCommand(object source, GridCommandEventArgs e) { int filterID = int.Parse(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["FilterId"].ToString()); Entities.CustomPrincipal principal = (Entities.CustomPrincipal)Page.User; switch (e.CommandName.ToLower()) { case "setdefault": using (Facade.ITrafficSheetFilter facTrafficSheetFilter = new Facade.Traffic()) facTrafficSheetFilter.SetDefault(filterID, principal.IdentityId, principal.UserName); grdFilters.Rebind(); break; case "switchactivity": GridDataItem gdi = e.Item as GridDataItem; bool isActive = (gdi["IsActive"] as TableCell).Text == "Yes" ? true : false; using (Facade.ITrafficSheetFilter facTrafficSheetFilter = new Facade.Traffic()) if (isActive) { facTrafficSheetFilter.Deactivate(filterID, principal.UserName); } else if (e.Item.Cells[5].Text.ToLower() == "no") { facTrafficSheetFilter.Activate(filterID, principal.UserName); } grdFilters.Rebind(); break; } }
void grdFilters_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) { using (Facade.ITrafficSheetFilter facTrafficSheetFilter = new Facade.Traffic()) { grdFilters.DataSource = facTrafficSheetFilter.GetForUser(((Entities.CustomPrincipal)Page.User).IdentityId, chkShowDeactivated.Checked); } }
private void PopulateStaticControls() { Facade.IControlArea facControlArea = new Facade.Traffic(); cboControlArea.DataSource = facControlArea.GetAll(); cboControlArea.DataTextField = "Description"; cboControlArea.DataValueField = "ControlAreaId"; cboControlArea.DataBind(); }
private void PopulateFilterList() { int identityId = ((Entities.CustomPrincipal)Page.User).IdentityId; Facade.ITrafficSheetFilter facTrafficSheetFilter = new Facade.Traffic(); cboFilters.DataSource = facTrafficSheetFilter.GetForUser(identityId, false); cboFilters.DataBind(); cboFilters.Items.Insert(0, new ListItem("-- Blank Filter --", "0")); }
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 BindTrafficAreas(int controlAreaId) { cboControlArea.ClearSelection(); cboControlArea.Items.FindByValue(controlAreaId.ToString()).Selected = true; Facade.ITrafficArea facTrafficArea = new Facade.Traffic(); cboTrafficArea.DataSource = facTrafficArea.GetForControlAreaId(controlAreaId); cboTrafficArea.DataBind(); cboTrafficArea.ClearSelection(); }
private void cboTrafficArea_SelectedIndexChanged(object sender, EventArgs e) { int trafficAreaId = Convert.ToInt32(cboTrafficArea.SelectedValue); using (Facade.ITrafficArea facTrafficArea = new Facade.Traffic()) { m_trafficArea = facTrafficArea.GetForTrafficAreaId(trafficAreaId); ViewState[C_TRAFFIC_AREA_VS] = m_trafficArea; } ConfigureTrafficAreaManupulation(eTrafficAreaManipulation.ConfigurePlanners); }
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")); } }
/// <summary> /// The user has selected a control area to configure traffic areas for. /// </summary> private void cboControlArea_SelectedIndexChanged(object sender, EventArgs e) { int controlAreaId = Convert.ToInt32(cboControlArea.SelectedValue); using (Facade.IControlArea facControlArea = new Facade.Traffic()) { m_controlArea = facControlArea.GetForControlAreaId(controlAreaId); ViewState[C_CONTROL_AREA_VS] = m_controlArea; } ConfigureControlAreaManipulation(eControlAreaManipulation.ConfigureTrafficAreas); }
/// <summary> /// The users wishes to save the filter. /// </summary> void btnSaveFilter_Click(object sender, EventArgs e) { btnSaveFilter.DisableServerSideValidation(); if (Page.IsValid) { Facade.ITrafficSheetFilter facTrafficSheetFilter = new Facade.Traffic(); var user = (Entities.CustomPrincipal)Page.User; Entities.TrafficSheetFilter filter = null; var isUpdate = false; if (cboFilters.SelectedValue != "0" && cboFilters.SelectedItem.Text == txtFilterName.Text) { // We are going to update the old version of the filter. isUpdate = true; filter = facTrafficSheetFilter.GetForTrafficSheetFilterId(Convert.ToInt32(cboFilters.SelectedValue)); } else { filter = new Entities.TrafficSheetFilter(user.IdentityId) { FilterName = txtFilterName.Text }; } filter.FilterOutExcludedPoints = false; filter.TrafficSheetGrouping = eTrafficSheetGrouping.None; filter.TrafficSheetSorting = eTrafficSheetSorting.EarliestLeg; this.PopulateFilter(filter); Facade.ITrafficArea facTrafficArea = new Facade.Traffic(); if (isUpdate) { ((Facade.ITrafficSheetFilter)facTrafficArea).Update(filter, user.UserName); } else { filter.FilterId = ((Facade.ITrafficSheetFilter)facTrafficArea).Create(filter, user.UserName); } PopulateFilterList(); cboFilters.ClearSelection(); SelectItem(cboFilters.Items, filter.FilterId); Filter = filter; SetCookie(); ReturnValue = "filterupdated"; } }
private void SetFilter() { m_trafficSheetFilter = Utilities.GetFilterFromCookie(this.CookieSessionID, this.Request); if (m_trafficSheetFilter == null) { Facade.ITrafficSheetFilter facFilter = new Facade.Traffic(); m_trafficSheetFilter = facFilter.GetDefault(((Entities.CustomPrincipal)Page.User).IdentityId); } // Configure the filter m_trafficSheetFilter.ControlAreaId = Convert.ToInt32(cboControlArea.SelectedValue); m_trafficSheetFilter.TrafficAreaIDs.Clear(); foreach (ListItem item in cboTrafficAreas.Items) { if (item.Selected) { m_trafficSheetFilter.TrafficAreaIDs.Add(Convert.ToInt32(item.Value)); } } m_trafficSheetFilter.FilterOutExcludedPoints = false; m_trafficSheetFilter.JobStates.Clear(); foreach (ListItem item in chkJobStates.Items) { if (item.Selected) { m_trafficSheetFilter.JobStates.Add(Enum.Parse(typeof(eJobState), item.Value.Replace(" ", ""))); } } m_trafficSheetFilter.OnlyShowMyJobs = false; m_trafficSheetFilter.OnlyShowJobsWithDemurrage = chkOnlyShowJobsWithDemurrage.Checked; m_trafficSheetFilter.OnlyShowJobsWithDemurrageAwaitingAcceptance = chkOnlyShowJobsWithDemurrageAwaitingAcceptance.Checked; m_trafficSheetFilter.FilterStartDate = (DateTime)dteStartDate.SelectedDate; m_trafficSheetFilter.FilterEnddate = ((DateTime)dteEndDate.SelectedDate).Add(new TimeSpan(23, 59, 59)); m_trafficSheetFilter.DepotId = int.Parse(cboDepot.SelectedValue); m_trafficSheetFilter.BusinessTypes.Clear(); foreach (ListItem li in cblBusinessType.Items) { if (li.Selected) { m_trafficSheetFilter.BusinessTypes.Add(int.Parse(li.Value)); } } SetCookie(m_trafficSheetFilter); }
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 btnAlterTrafficArea_Click(object sender, EventArgs e) { btnAlterTrafficArea.DisableServerSideValidation(); if (Page.IsValid) { int trafficAreaId = Convert.ToInt32(cboTrafficArea.SelectedValue); using (Facade.ITrafficArea facTrafficArea = new Facade.Traffic()) { m_trafficArea = facTrafficArea.GetForTrafficAreaId(trafficAreaId); ViewState[C_TRAFFIC_AREA_VS] = m_trafficArea; } ConfigureTrafficAreaManupulation(eTrafficAreaManipulation.AddTrafficArea); } }
/// <summary> /// The user has selected a control area to alter - allow them to change the description and code. /// </summary> private void btnAlterControlArea_Click(object sender, EventArgs e) { btnAlterControlArea.DisableServerSideValidation(); if (Page.IsValid) { int controlAreaId = Convert.ToInt32(cboControlArea.SelectedValue); using (Facade.IControlArea facControlArea = new Facade.Traffic()) { m_controlArea = facControlArea.GetForControlAreaId(controlAreaId); ViewState[C_CONTROL_AREA_VS] = m_controlArea; } ConfigureControlAreaManipulation(eControlAreaManipulation.AddControlArea); } }
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); }