public override void Fill(PasswordBoxPropertyBag propertyBag, FillerParams fillerParams)
        {
            if (fillerParams.OverrideSettings != null && fillerParams.OverrideSettings.Count > 0)
            {
                propertyBag.TabIndex          = Convert.ToInt16(fillerParams.OverrideSettings[ControlLibConstants.TAB_INDEX]);
                propertyBag.OnLeaveFunction   = fillerParams.OverrideSettings[ControlLibConstants.ON_LEAVE_FUNCTION];
                propertyBag.OnKeyUpFunction   = fillerParams.OverrideSettings[ControlLibConstants.ON_KEY_UP_FUNCTION];
                propertyBag.OnKeyDownFunction = fillerParams.OverrideSettings[ControlLibConstants.ON_KEY_DOWN_FUNCTION];
                propertyBag.OnChangeFunction  = fillerParams.OverrideSettings[ControlLibConstants.ON_CHANGE_FUNCTION];

                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.Attributes = fillerParams.Attributes;
            propertyBag.ReadOnly   = fillerParams.IsReadOnly.HasValue ? fillerParams.IsReadOnly.Value : propertyBag.ReadOnly;
            propertyBag.Enabled    = fillerParams.IsEnabled.HasValue ? fillerParams.IsEnabled.Value : propertyBag.Enabled;
            SetVisibility(propertyBag, fillerParams);
        }
示例#2
0
        public override void Fill(PasswordBoxPropertyBag propertyBag, FillerParams fillerParams)
        {
            if (fillerParams.SkipSecurityFill == false)
            {
                IModelPropertyConfiguration propertyConfig = ReadPropertyConfiguration(fillerParams.ModelName, fillerParams.PropertyName, fillerParams.ConfigKey);

                if (propertyConfig != null && propertyConfig.PropertyConfiguration != 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);
            }
        }
示例#3
0
        public static MvcHtmlString BallyPasswordBox <TModel, TProperty>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TProperty> > expression, StylePropertyBag style = null, short tabIndex = 0, string onLeaveFunction = "", string onKeyUpFunction = "", string onKeyDownFunction = "", string onChangeFunction = "", string cssClass = "", bool?isEnabled = null, bool?isReadOnly = null, IDictionary <string, object> attributes = null)
        {
            string propertyName          = string.Empty;
            string modelName             = string.Empty;
            object value                 = string.Empty;
            string errMsg                = string.Empty;
            string passwordBoxHTMLString = string.Empty;
            string configKey             = string.Empty;
            Dictionary <string, string> overrideSettings;

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

            overrideSettings = GetPasswordOverrideSettings(style, tabIndex, onLeaveFunction, onKeyUpFunction, onKeyDownFunction, onChangeFunction, cssClass);
            var          fillers                = ControlPropertyFillerFactory.Get();
            FillerParams fillerParams           = new FillerParams(modelName, propertyName, overrideSettings, isEnabled: isEnabled, isReadOnly: isReadOnly, attributes: attributes, configKey: configKey);
            var          passwordBoxpropertyBag = new PasswordBoxPropertyBag(fillerParams);

            passwordBoxpropertyBag.Accept(fillers);
            passwordBoxpropertyBag.ErrorMessage = errMsg;
            passwordBoxpropertyBag.IsDirty      = string.IsNullOrEmpty(errMsg) ? false : true;

            var textBoxHTMLEmitter = new PasswordBoxHTMLEmitter(value != null ? value.ToString() : string.Empty, passwordBoxpropertyBag);

            textBoxHTMLEmitter.Emit(out passwordBoxHTMLString);
            return(MvcHtmlString.Create(passwordBoxHTMLString));
        }
示例#4
0
        public override void Fill(PasswordBoxPropertyBag propertyBag, FillerParams fillerParams)
        {
            propertyBag.ControlName = fillerParams.ControlName;

            IControlDefaultPropertyBag controlDefault = ReadDefaultConfiguration(ControlNames.BallyPasswordBox);

            if (controlDefault != null)
            {
                propertyBag.CssClass = controlDefault.CssClass;
                propertyBag.ValidationErrorCssClass = controlDefault.ValidationErrorCssClass;
                propertyBag.ControlErrorCssClass    = controlDefault.ControlErrorCssClass;
            }
        }
 public override void Fill(PasswordBoxPropertyBag propertyBag, FillerParams fillerParams)
 {
     fillValidators(propertyBag, fillerParams);
 }
示例#6
0
        public override void Fill(PasswordBoxPropertyBag propertyBag, FillerParams fillerParams)
        {
            if (fillerParams.SkipSecurityFill == false)
            {
                IModelPropertyConfiguration propertyConfig = ReadPropertyConfiguration(fillerParams.ModelName, fillerParams.PropertyName, fillerParams.ConfigKey);

                if (propertyConfig != null && propertyConfig.PropertyConfiguration != 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);
            }
        }
 public PasswordBoxHTMLEmitter(string value, PasswordBoxPropertyBag propertyBag)
     : base(propertyBag.Validators, propertyBag.Mandatory)
 {
     this._propertyBag = propertyBag;
     this.Value = value;
 }
示例#8
0
 public virtual void Fill(PasswordBoxPropertyBag propertyBag, FillerParams fillerParams) { }
示例#9
0
 public PasswordBoxHTMLEmitter(string value, PasswordBoxPropertyBag propertyBag)
     : base(propertyBag.Validators, propertyBag.Mandatory)
 {
     this._propertyBag = propertyBag;
     this.Value        = value;
 }
示例#10
0
 public virtual void Fill(PasswordBoxPropertyBag propertyBag, FillerParams fillerParams)
 {
 }
示例#11
0
 public override void Fill(PasswordBoxPropertyBag propertyBag, FillerParams fillerParams)
 {
     fillValidators(propertyBag, fillerParams);
 }
示例#12
0
        public override void Fill(PasswordBoxPropertyBag propertyBag, FillerParams fillerParams)
        {
            propertyBag.ControlName = fillerParams.ControlName;

            IControlDefaultPropertyBag controlDefault = ReadDefaultConfiguration(ControlNames.BallyPasswordBox);
            if (controlDefault != null)
            {
                propertyBag.CssClass = controlDefault.CssClass;
                propertyBag.ValidationErrorCssClass = controlDefault.ValidationErrorCssClass;
                propertyBag.ControlErrorCssClass = controlDefault.ControlErrorCssClass;
            }
        }
        public override void Fill(PasswordBoxPropertyBag propertyBag, FillerParams fillerParams)
        {
            if (fillerParams.OverrideSettings != null && fillerParams.OverrideSettings.Count > 0)
            {
                propertyBag.TabIndex = Convert.ToInt16(fillerParams.OverrideSettings[ControlLibConstants.TAB_INDEX]);
                propertyBag.OnLeaveFunction = fillerParams.OverrideSettings[ControlLibConstants.ON_LEAVE_FUNCTION];
                propertyBag.OnKeyUpFunction = fillerParams.OverrideSettings[ControlLibConstants.ON_KEY_UP_FUNCTION];
                propertyBag.OnKeyDownFunction = fillerParams.OverrideSettings[ControlLibConstants.ON_KEY_DOWN_FUNCTION];
                propertyBag.OnChangeFunction = fillerParams.OverrideSettings[ControlLibConstants.ON_CHANGE_FUNCTION];

                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.Attributes = fillerParams.Attributes;
            propertyBag.ReadOnly = fillerParams.IsReadOnly.HasValue ? fillerParams.IsReadOnly.Value : propertyBag.ReadOnly;
            propertyBag.Enabled = fillerParams.IsEnabled.HasValue ? fillerParams.IsEnabled.Value : propertyBag.Enabled;
            SetVisibility(propertyBag, fillerParams);
        }