Esempio n. 1
0
        /// <summary>
        /// Creates the child controls.
        /// </summary>
        /// <returns></returns>
        public override Control[] CreateChildControls(Type entityType, FilterField filterControl)
        {
            lp       = new LocationPicker();
            lp.ID    = filterControl.ID + "_lp";
            lp.Label = "Location";
            lp.AllowedPickerModes = LocationPickerMode.Named | LocationPickerMode.Polygon;
            lp.SetBestPickerModeForLocation(null);
            lp.CssClass = "col-lg-4";
            filterControl.Controls.Add(lp);

            Panel panel = new Panel();

            panel.CssClass = "col-lg-8";
            filterControl.Controls.Add(panel);

            ddlLocationType                = new RockDropDownList();
            ddlLocationType.ID             = filterControl.ID + "_ddlLocationType";
            ddlLocationType.Label          = "Location Type";
            ddlLocationType.DataValueField = "Id";
            ddlLocationType.DataTextField  = "Value";
            DefinedTypeCache locationDefinedType = DefinedTypeCache.Read(SystemGuid.DefinedType.GROUP_LOCATION_TYPE.AsGuid());

            ddlLocationType.BindToDefinedType(locationDefinedType);
            ddlLocationType.Items.Insert(0, new ListItem("(All Location Types)", ""));
            panel.Controls.Add(ddlLocationType);

            return(new Control[3] {
                lp, ddlLocationType, panel
            });
        }
Esempio n. 2
0
        /// <summary>
        /// Creates the child controls.
        /// </summary>
        /// <returns></returns>
        public override Control[] CreateChildControls(Type entityType, FilterField filterControl)
        {
            var lp = new LocationPicker();

            lp.ID    = filterControl.ID + "_lp";
            lp.Label = "Location";
            lp.AllowedPickerModes = LocationPickerMode.Named | LocationPickerMode.Polygon;
            lp.SetBestPickerModeForLocation(null);
            lp.CssClass = "col-lg-4";
            filterControl.Controls.Add(lp);

            Panel panel = new Panel();

            panel.CssClass = "col-lg-8";
            filterControl.Controls.Add(panel);

            var dvpLocationType = new DefinedValuePicker();

            dvpLocationType.ID             = filterControl.ID + "_dvpLocationType";
            dvpLocationType.Label          = "Location Type";
            dvpLocationType.DataValueField = "Id";
            dvpLocationType.DataTextField  = "Value";
            DefinedTypeCache locationDefinedType = DefinedTypeCache.Get(SystemGuid.DefinedType.GROUP_LOCATION_TYPE.AsGuid());

            dvpLocationType.DefinedTypeId = locationDefinedType.Id;
            panel.Controls.Add(dvpLocationType);

            return(new Control[3] {
                lp, dvpLocationType, panel
            });
        }
Esempio n. 3
0
        /// <summary>
        /// Sets the selection.
        /// </summary>
        /// <param name="entityType">Type of the entity.</param>
        /// <param name="controls">The controls.</param>
        /// <param name="selection">The selection.</param>
        public override void SetSelection(Type entityType, Control[] controls, string selection)
        {
            var  selections   = selection.SplitDelimitedValues();
            Guid locationGuid = selections[0].AsGuid();

            var location = new LocationService(new RockContext()).Get(locationGuid);

            if (location != null)
            {
                LocationPicker locationPicker = controls[0] as LocationPicker;
                locationPicker.SetBestPickerModeForLocation(location);
                locationPicker.Location = location;
            }

            if (selections.Length >= 2)
            {
                (controls[1] as RockDropDownList).SetValue(selections[1]);
            }
        }