Example #1
0
        /// <summary>
        /// Saves the data-type PreValue options.
        /// </summary>
        public override void Save()
        {
            // set the database data-type
            this.DataType.DBType = (umbraco.cms.businesslogic.datatype.DBTypes)Enum.Parse(typeof(umbraco.cms.businesslogic.datatype.DBTypes), this.DatabaseDataType.SelectedValue);

            // parse the integers & doubles
            double maxValue, minValue, value, value2, stepValue;

            double.TryParse(this.MaxValue.Text, out maxValue);
            double.TryParse(this.MinValue.Text, out minValue);
            double.TryParse(this.Value.Text, out value);
            double.TryParse(this.Value2.Text, out value2);
            double.TryParse(this.StepValue.Text, out stepValue);

            // set the options
            var options = new SliderOptions()
            {
                DBType      = (umbraco.cms.businesslogic.datatype.DBTypes)Enum.Parse(typeof(umbraco.cms.businesslogic.datatype.DBTypes), this.DatabaseDataType.SelectedValue),
                EnableRange = this.EnableRange.Checked,
                EnableStep  = this.EnableStep.Checked,
                MaxValue    = maxValue,
                MinValue    = minValue,
                Orientation = this.Orientation.SelectedValue,
                RangeValue  = this.RangeValue.SelectedValue,
                StepValue   = stepValue,
                Value       = value,
                Value2      = value2
            };

            // save the options as JSON
            this.SaveAsJson(options);

            // toggle the non-default fields
            this.ToggleFields();
        }
Example #2
0
        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.Load"/> event.
        /// </summary>
        /// <param name="e">The <see cref="T:System.EventArgs"/> object that contains the event data.</param>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            // get PreValues, load them into the controls.
            var options = this.GetPreValueOptions <SliderOptions>();

            // if the options are null, then load the defaults
            if (options == null)
            {
                options = new SliderOptions(true);
            }

            // set the values
            this.DatabaseDataType.SelectedValue = this.DataType.DBType.ToString();
            this.EnableRange.Checked            = options.EnableRange;
            this.EnableStep.Checked             = options.EnableStep;
            this.MinValue.Text             = options.MinValue.ToString();
            this.MaxValue.Text             = options.MaxValue.ToString();
            this.Orientation.SelectedValue = options.Orientation;
            this.RangeValue.SelectedValue  = options.RangeValue;
            this.StepValue.Text            = options.StepValue.ToString();
            this.Value.Text  = options.Value.ToString();
            this.Value2.Text = options.Value2.ToString();

            // toggle the non-default fields
            this.ToggleFields();
        }
        /// <summary>
        /// Saves the data-type PreValue options.
        /// </summary>
        public override void Save()
        {
            // set the database data-type
            this.DataType.DBType = (umbraco.cms.businesslogic.datatype.DBTypes)Enum.Parse(typeof(umbraco.cms.businesslogic.datatype.DBTypes), this.DatabaseDataType.SelectedValue);

            // parse the integers & doubles
            double maxValue, minValue, value, value2, stepValue;
            double.TryParse(this.MaxValue.Text, out maxValue);
            double.TryParse(this.MinValue.Text, out minValue);
            double.TryParse(this.Value.Text, out value);
            double.TryParse(this.Value2.Text, out value2);
            double.TryParse(this.StepValue.Text, out stepValue);

            // set the options
            var options = new SliderOptions()
            {
                DBType = (umbraco.cms.businesslogic.datatype.DBTypes)Enum.Parse(typeof(umbraco.cms.businesslogic.datatype.DBTypes), this.DatabaseDataType.SelectedValue),
                EnableRange = this.EnableRange.Checked,
                EnableStep = this.EnableStep.Checked,
                MaxValue = maxValue,
                MinValue = minValue,
                Orientation = this.Orientation.SelectedValue,
                RangeValue = this.RangeValue.SelectedValue,
                StepValue = stepValue,
                Value = value,
                Value2 = value2
            };

            // save the options as JSON
            this.SaveAsJson(options);

            // toggle the non-default fields
            this.ToggleFields();
        }
        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.Load"/> event.
        /// </summary>
        /// <param name="e">The <see cref="T:System.EventArgs"/> object that contains the event data.</param>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            // get PreValues, load them into the controls.
            var options = this.GetPreValueOptions<SliderOptions>();

            // if the options are null, then load the defaults
            if (options == null)
            {
                options = new SliderOptions(true);
            }

            // set the values
            this.DatabaseDataType.SelectedValue = this.DataType.DBType.ToString();
            this.EnableRange.Checked = options.EnableRange;
            this.EnableStep.Checked = options.EnableStep;
            this.MinValue.Text = options.MinValue.ToString();
            this.MaxValue.Text = options.MaxValue.ToString();
            this.Orientation.SelectedValue = options.Orientation;
            this.RangeValue.SelectedValue = options.RangeValue;
            this.StepValue.Text = options.StepValue.ToString();
            this.Value.Text = options.Value.ToString();
            this.Value2.Text = options.Value2.ToString();

            // toggle the non-default fields
            this.ToggleFields();
        }