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 Entities.TrafficSheetFilter GetDefaultFilter() { Facade.ITrafficSheetFilter facTrafficSheetFilter = new Facade.Traffic(); Entities.TrafficSheetFilter ts = facTrafficSheetFilter.GetDefault(((Entities.CustomPrincipal)Page.User).IdentityId); return(ts); }
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 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 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 LoadDefaultFilter() { int identityId = ((Entities.CustomPrincipal)Page.User).IdentityId; Facade.ITrafficSheetFilter facTrafficSheetFilter = new Facade.Traffic(); m_trafficSheetFilter = Utilities.GetFilterFromCookie(this.CookieSessionID, Request); if (m_trafficSheetFilter == null) { m_trafficSheetFilter = facTrafficSheetFilter.GetDefault(identityId); } if (m_trafficSheetFilter.LastUpdated == DateTime.MinValue || DateTime.Today.Subtract(m_trafficSheetFilter.LastUpdated).Days >= 1) { // 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; } m_trafficSheetFilter.LastUpdated = DateTime.Now; } if (m_jobSheetMode == eJobSheetMode.Completed || m_jobSheetMode == eJobSheetMode.Planning) { ConfigureDefaultFilter(); } BindData(m_trafficSheetFilter); }
private void GenerateCookie() { Facade.ITrafficSheetFilter facTrafficSheetFilter = new Facade.Traffic(); _filter = facTrafficSheetFilter.GetDefault(((Entities.CustomPrincipal)Page.User).IdentityId); // 02/05/08 : t.lunken : EH Nicols Additions _filter.OnlyShowDriversWithoutReloads = false; _filter.OnlyShowEmptyTrailers = false; _filter.SortTrailersByLastLocation = false; _filter.OnlyShowEmptyVehicles = false; #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 Utilities.SetTrafficSheetCookie(this.CookieSessionID, this.Response, _filter); cookieGenerated = true; }