Пример #1
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();
        }