Ejemplo n.º 1
0
        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
        }
Ejemplo n.º 2
0
        ///	<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 ] ---", ""));
        }
Ejemplo n.º 3
0
        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
        }
Ejemplo n.º 4
0
        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
        }
Ejemplo n.º 5
0
        ///	<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();
        }