Ejemplo n.º 1
0
        public override void Fill(DropDownPropertyBag propertyBag, FillerParams fillerParams)
        {
            if (fillerParams.SkipSecurityFill == false)
            {
                IModelPropertyConfiguration propertyConfig = ReadPropertyConfiguration(fillerParams.ModelName, fillerParams.PropertyName, fillerParams.ConfigKey);

                if (propertyConfig != null)
                {
                    IAccessPolicy accessSecurity = GetAccess(propertyConfig.PropertyConfiguration.Security);
                    if (accessSecurity != null)
                    {
                        propertyBag.Enabled    = accessSecurity.Enabled;
                        propertyBag.ReadOnly   = accessSecurity.ReadOnly;
                        propertyBag.Visibility = accessSecurity.Visibility;
                    }
                }
                else
                {
                    setDefalutSecurity(propertyBag);
                }
            }
            else
            {
                setDefalutSecurity(propertyBag);
            }
        }
Ejemplo n.º 2
0
        public override void Fill(DropDownPropertyBag propertyBag, FillerParams fillerParam)
        {
            propertyBag.ControlName = fillerParam.ControlName;

            IControlDefaultPropertyBag controlDefault = ReadDefaultConfiguration(ControlNames.BallyDropDown);

            if (controlDefault != null)
            {
                propertyBag.CssClass = controlDefault.CssClass;
                propertyBag.ValidationErrorCssClass = controlDefault.ValidationErrorCssClass;
                propertyBag.ControlErrorCssClass    = controlDefault.ControlErrorCssClass;
            }
        }
        public override void Fill(DropDownPropertyBag propertyBag, FillerParams fillerParams)
        {
            //Filling implementation code
            if (fillerParams.OverrideSettings != null && fillerParams.OverrideSettings.Count > 0)
            {
                propertyBag.TabIndex             = Convert.ToInt16(fillerParams.OverrideSettings[ControlLibConstants.TAB_INDEX]);
                propertyBag.OnChangeFunction     = fillerParams.OverrideSettings[ControlLibConstants.ON_CHANGE_FUNCTION];
                propertyBag.CascadeInputFunction = fillerParams.OverrideSettings[ControlLibConstants.CASCADE_INPUT_FUNCTION];
                propertyBag.Attributes           = fillerParams.Attributes;

                propertyBag.TargetControlID   = fillerParams.OverrideSettings[ControlLibConstants.TARGET_CONTROL_ID];
                propertyBag.ActionURL         = fillerParams.OverrideSettings[ControlLibConstants.ACTION_URL];
                propertyBag.DropDownType      = (DropDownType)Enum.Parse(typeof(DropDownType), fillerParams.OverrideSettings[ControlLibConstants.TYPE]);
                propertyBag.ListDisplayLength = Convert.ToInt16(fillerParams.OverrideSettings[ControlLibConstants.LIST_LENGTH]);
                propertyBag.Options           = ControlHelper.GetOptions(fillerParams.List, fillerParams.ValueMember, fillerParams.DisplayMember, fillerParams.OverrideSettings[ControlLibConstants.SELECTED_VALUE], fillerParams.Disabled);

                if (propertyBag.Style == null && (fillerParams.OverrideSettings.Keys.Contains(ControlLibConstants.WIDTH) || fillerParams.OverrideSettings.Keys.Contains(ControlLibConstants.HEIGHT)))
                {
                    propertyBag.Style = new StylePropertyBag();
                }
                if (propertyBag.Style != null)
                {
                    propertyBag.Style.Width  = fillerParams.OverrideSettings.Keys.Contains(ControlLibConstants.WIDTH) ? fillerParams.OverrideSettings[ControlLibConstants.WIDTH] : string.Empty;
                    propertyBag.Style.Height = fillerParams.OverrideSettings.Keys.Contains(ControlLibConstants.HEIGHT) ? fillerParams.OverrideSettings[ControlLibConstants.HEIGHT] : string.Empty;
                }
                if (fillerParams.OverrideSettings[ControlLibConstants.CSS_CLASS] != string.Empty)
                {
                    propertyBag.CssClass = fillerParams.OverrideSettings[ControlLibConstants.CSS_CLASS];
                }

                propertyBag.DisplayMember = fillerParams.DisplayMember;
                propertyBag.ValueMember   = fillerParams.ValueMember;
            }
            propertyBag.ReadOnly = fillerParams.IsReadOnly.HasValue ? fillerParams.IsReadOnly.Value : propertyBag.ReadOnly;
            propertyBag.Enabled  = fillerParams.IsEnabled.HasValue ? fillerParams.IsEnabled.Value : propertyBag.Enabled;
            SetVisibility(propertyBag, fillerParams);
        }
Ejemplo n.º 4
0
        public static MvcHtmlString BallyCascadeDropDown <TModel, TProperty>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TProperty> > expression, NameGenerator controlId, string actionUrl, ItemDataSource dataSource, string[] disabled = null, int listLength = -1, StylePropertyBag style = null, short tabIndex = 0, string onChangeFunction = "", string cssClass = "", string cascadeInputFunction = "", IDictionary <string, object> attributes = null)
        {
            string propertyName       = string.Empty;
            string targetControlID    = controlId.ControlID;
            string modelName          = string.Empty;
            object value              = string.Empty;
            string errMsg             = string.Empty;
            string dropDownHTMLString = string.Empty;
            Dictionary <string, string> overrideSettings;
            string configKey = string.Empty;
            DropDownHTMLEmitter dropDownHTMLEmitter;

            ControlExtension.GetPropertyNameAndValue <TModel, TProperty>(htmlHelper, expression, out propertyName, out modelName, out value, out errMsg, out configKey);

            overrideSettings = GetBallyDropdownListOverrideSettings(DropDownType.CascadeSelect, listLength, targetControlID, actionUrl, style, tabIndex, onChangeFunction, value, cssClass, cascadeInputFunction);
            FillerParams fillerParams = null;

            if (dataSource != null)
            {
                fillerParams = new FillerParams(modelName, propertyName, overrideSettings, list: dataSource.DataSource, valueMember: dataSource.ValueMember, displayMember: dataSource.DisplayMember, disabled: disabled, attributes: attributes, configKey: configKey);
            }
            else
            {
                fillerParams = new FillerParams(modelName, propertyName, overrideSettings, list: null, valueMember: string.Empty, displayMember: string.Empty, disabled: disabled, attributes: attributes, configKey: configKey);
            }

            var fillers             = ControlPropertyFillerFactory.Get();
            var dropDownpropertyBag = new DropDownPropertyBag(fillerParams);

            dropDownpropertyBag.Accept(fillers);
            dropDownpropertyBag.ErrorMessage = errMsg;
            dropDownpropertyBag.IsDirty      = string.IsNullOrEmpty(errMsg) ? false : true;
            dropDownHTMLEmitter = new DropDownHTMLEmitter(value != null ? value.ToString() : string.Empty, dropDownpropertyBag);

            dropDownHTMLEmitter.Emit(out dropDownHTMLString);
            return(MvcHtmlString.Create(dropDownHTMLString));
        }
Ejemplo n.º 5
0
 public override void Fill(DropDownPropertyBag propertyBag, FillerParams fillerParams)
 {
     fillValidators(propertyBag, fillerParams);
 }
Ejemplo n.º 6
0
        public override void Fill(DropDownPropertyBag propertyBag, FillerParams fillerParams)
        {
            if (fillerParams.SkipSecurityFill == false)
            {
                IModelPropertyConfiguration propertyConfig = ReadPropertyConfiguration(fillerParams.ModelName, fillerParams.PropertyName, fillerParams.ConfigKey);

                if (propertyConfig != null)
                {
                    IAccessPolicy accessSecurity = GetAccess(propertyConfig.PropertyConfiguration.Security);
                    if (accessSecurity != null)
                    {
                        propertyBag.Enabled = accessSecurity.Enabled;
                        propertyBag.ReadOnly = accessSecurity.ReadOnly;
                        propertyBag.Visibility = accessSecurity.Visibility;
                    }
                }
                else
                {
                    setDefalutSecurity(propertyBag);
                }
            }
            else
            {
                setDefalutSecurity(propertyBag);
            }
        }
Ejemplo n.º 7
0
 public virtual void Fill(DropDownPropertyBag propertyBag, FillerParams fillerParams) { }
Ejemplo n.º 8
0
 public virtual void Fill(DropDownPropertyBag propertyBag, FillerParams fillerParams)
 {
 }
Ejemplo n.º 9
0
 public override void Fill(DropDownPropertyBag propertyBag, FillerParams fillerParams)
 {
     fillValidators(propertyBag, fillerParams);
 }
Ejemplo n.º 10
0
 public DropDownHTMLEmitter(string value, DropDownPropertyBag propertyBag)
     : base(propertyBag.Validators, propertyBag.Mandatory)
 {
     this._propertyBag = propertyBag;
     this.Value = value;
 }
Ejemplo n.º 11
0
        public override void Fill(DropDownPropertyBag propertyBag, FillerParams fillerParam)
        {
            propertyBag.ControlName = fillerParam.ControlName;

            IControlDefaultPropertyBag controlDefault = ReadDefaultConfiguration(ControlNames.BallyDropDown);
            if (controlDefault != null)
            {
                propertyBag.CssClass = controlDefault.CssClass;
                propertyBag.ValidationErrorCssClass = controlDefault.ValidationErrorCssClass;
                propertyBag.ControlErrorCssClass = controlDefault.ControlErrorCssClass;
            }
        }
Ejemplo n.º 12
0
 public DropDownHTMLEmitter(string value, DropDownPropertyBag propertyBag)
     : base(propertyBag.Validators, propertyBag.Mandatory)
 {
     this._propertyBag = propertyBag;
     this.Value        = value;
 }
        public override void Fill(DropDownPropertyBag propertyBag, FillerParams fillerParams)
        {
            //Filling implementation code
            if (fillerParams.OverrideSettings != null && fillerParams.OverrideSettings.Count > 0)
            {
                propertyBag.TabIndex = Convert.ToInt16(fillerParams.OverrideSettings[ControlLibConstants.TAB_INDEX]);
                propertyBag.OnChangeFunction = fillerParams.OverrideSettings[ControlLibConstants.ON_CHANGE_FUNCTION];
                propertyBag.CascadeInputFunction = fillerParams.OverrideSettings[ControlLibConstants.CASCADE_INPUT_FUNCTION];
                propertyBag.Attributes = fillerParams.Attributes;

                propertyBag.TargetControlID = fillerParams.OverrideSettings[ControlLibConstants.TARGET_CONTROL_ID];
                propertyBag.ActionURL = fillerParams.OverrideSettings[ControlLibConstants.ACTION_URL];
                propertyBag.DropDownType = (DropDownType)Enum.Parse(typeof(DropDownType), fillerParams.OverrideSettings[ControlLibConstants.TYPE]);
                propertyBag.ListDisplayLength = Convert.ToInt16(fillerParams.OverrideSettings[ControlLibConstants.LIST_LENGTH]);
                propertyBag.Options = ControlHelper.GetOptions(fillerParams.List, fillerParams.ValueMember, fillerParams.DisplayMember, fillerParams.OverrideSettings[ControlLibConstants.SELECTED_VALUE], fillerParams.Disabled);

                if (propertyBag.Style == null && (fillerParams.OverrideSettings.Keys.Contains(ControlLibConstants.WIDTH) || fillerParams.OverrideSettings.Keys.Contains(ControlLibConstants.HEIGHT)))
                {
                    propertyBag.Style = new StylePropertyBag();
                }
                if (propertyBag.Style != null)
                {
                    propertyBag.Style.Width = fillerParams.OverrideSettings.Keys.Contains(ControlLibConstants.WIDTH) ? fillerParams.OverrideSettings[ControlLibConstants.WIDTH] : string.Empty;
                    propertyBag.Style.Height = fillerParams.OverrideSettings.Keys.Contains(ControlLibConstants.HEIGHT) ? fillerParams.OverrideSettings[ControlLibConstants.HEIGHT] : string.Empty;
                }
                if (fillerParams.OverrideSettings[ControlLibConstants.CSS_CLASS] != string.Empty)
                {
                    propertyBag.CssClass = fillerParams.OverrideSettings[ControlLibConstants.CSS_CLASS];
                }

                propertyBag.DisplayMember = fillerParams.DisplayMember;
                propertyBag.ValueMember = fillerParams.ValueMember;
            }
            propertyBag.ReadOnly = fillerParams.IsReadOnly.HasValue ? fillerParams.IsReadOnly.Value : propertyBag.ReadOnly;
            propertyBag.Enabled = fillerParams.IsEnabled.HasValue ? fillerParams.IsEnabled.Value : propertyBag.Enabled;
            SetVisibility(propertyBag, fillerParams);
        }