public override void Fill(TextBoxPropertyBag 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.Masking = accessSecurity.Masking; propertyBag.Visibility = accessSecurity.Visibility; } } else { setDefalutSecurity(propertyBag); } } else { setDefalutSecurity(propertyBag); } }
public override void Fill(TextBoxPropertyBag 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]; propertyBag.AutoCompleteInputFunction = fillerParams.OverrideSettings[ControlLibConstants.AUTOCOMPLETE_INPUT_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); }
public static MvcHtmlString BallyTextBox <TModel, TProperty>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TProperty> > expression, bool isAutoComplete = false, StylePropertyBag style = null, short tabIndex = 0, string onLeaveFunction = "", string onKeyUpFunction = "", string onKeyDownFunction = "", string onChangeFunction = "", string cssClass = "", string autoCompleteInputFunction = "", IDictionary <string, object> attributes = null, bool?isEnabled = null, bool?isReadOnly = null) { string propertyName = string.Empty; string modelName = string.Empty; object value = string.Empty; string errMsg = string.Empty; string textBoxHTMLString = string.Empty; string configKey = string.Empty; Dictionary <string, string> overrideSettings; TextBoxHTMLEmitter textBoxHTMLEmitter; ControlExtension.GetPropertyNameAndValue <TModel, TProperty>(htmlHelper, expression, out propertyName, out modelName, out value, out errMsg, out configKey); overrideSettings = GetTextBoxOverrideSettings(style, tabIndex, onLeaveFunction, onKeyUpFunction, onKeyDownFunction, onChangeFunction, cssClass, autoCompleteInputFunction); var fillers = ControlPropertyFillerFactory.Get(); FillerParams fillerParams = new FillerParams(modelName, propertyName, overrideSettings, attributes: attributes, isEnabled: isEnabled, isReadOnly: isReadOnly, configKey: configKey); var textBoxpropertyBag = new TextBoxPropertyBag(fillerParams); // THe below line of code needs to be placed before calling the Accept() method - dont change this textBoxpropertyBag.AutoComplete = isAutoComplete; textBoxpropertyBag.Accept(fillers); textBoxpropertyBag.ErrorMessage = errMsg; textBoxpropertyBag.IsDirty = string.IsNullOrEmpty(errMsg) ? false : true; value = GetTextBoxMaskingData <TModel>(value, textBoxpropertyBag); textBoxHTMLEmitter = new TextBoxHTMLEmitter(value != null ? value.ToString() : string.Empty, textBoxpropertyBag); textBoxHTMLEmitter.Emit(out textBoxHTMLString); return(MvcHtmlString.Create(textBoxHTMLString)); }
public override void Fill(TextBoxPropertyBag propertyBag, FillerParams fillerParams) { propertyBag.ControlName = fillerParams.ControlName; IControlDefaultPropertyBag controlDefault = ReadDefaultConfiguration(ControlNames.BallyTextBox); if (controlDefault != null) { propertyBag.CssClass = controlDefault.CssClass; propertyBag.ValidationErrorCssClass = controlDefault.ValidationErrorCssClass; propertyBag.ControlErrorCssClass = controlDefault.ControlErrorCssClass; if (propertyBag.AutoCompleteProperties == null) { propertyBag.AutoCompleteProperties = new AutoCompleteBehaviourPropertyBag(new Dictionary<string, string>() { { ControlLibConstants.ACTION_URL, controlDefault.AutoCompleteProperty.ActionURL }, { ControlLibConstants.ACTION_NAME, controlDefault.AutoCompleteProperty.ActionName }, { ControlLibConstants.CONTROLLER_NAME, controlDefault.AutoCompleteProperty.ControllerName}, { ControlLibConstants.MIN_CHAR_REQUIRED, controlDefault.AutoCompleteProperty.MinCharRequired.ToString() }, { ControlLibConstants.MAX_RESULT_COUNT, controlDefault.AutoCompleteProperty.MaxResultCount.ToString() }, { ControlLibConstants.ORDER_BY, controlDefault.AutoCompleteProperty.OrderBy.ToString() }, { ControlLibConstants.SEARCH_TYPE, controlDefault.AutoCompleteProperty.SearchType.ToString() }}); } if (propertyBag.MaskingProperties == null) { propertyBag.MaskingProperties = new MaskingBehaviourPropertyBag(new Dictionary<string, string>() { { "MaskingChar", controlDefault.MaskingProperty.MaskingChar.ToString() }, { "MaskingType", controlDefault.MaskingProperty.MaskingType.ToString() }, { "MaskCharLength", controlDefault.MaskingProperty.MaskCharLength.ToString() }, { "MaskingPosition", controlDefault.MaskingProperty.MaskingPosition.ToString() } }); } } }
private static object GetTextBoxMaskingData <TModel>(object value, TextBoxPropertyBag textBoxpropertyBag) { if (textBoxpropertyBag.Masking && textBoxpropertyBag.MaskingProperties != null) { string ciphetText = ControlLibraryConfig.EncryptionService.Encrypt(Convert.ToString(value)); textBoxpropertyBag.EncryptedValue = ciphetText; string maskedData = GetMaskedString(Convert.ToString(value), textBoxpropertyBag.MaskingProperties); textBoxpropertyBag.ReadOnly = true; value = maskedData; } return(value); }
public override void Fill(TextBoxPropertyBag propertyBag, FillerParams fillerParams) { if (fillerParams.SkipBehaviourFill == false) { IModelPropertyConfiguration propertyConfig = ReadPropertyConfiguration(fillerParams.ModelName, fillerParams.PropertyName, fillerParams.ConfigKey); //propertyBag.AutoComplete = false; propertyBag.Masking = false; if (propertyConfig != null && propertyConfig.PropertyConfiguration != null) { if (propertyConfig.PropertyConfiguration.AutoCompleteProperties != null && propertyBag.AutoComplete) { propertyBag.AutoCompleteProperties = new AutoCompleteBehaviourPropertyBag(new Dictionary <string, string>() { { ControlLibConstants.ACTION_URL, propertyConfig.PropertyConfiguration.AutoCompleteProperties.ActionURL }, { ControlLibConstants.ACTION_NAME, propertyConfig.PropertyConfiguration.AutoCompleteProperties.ActionName }, { ControlLibConstants.CONTROLLER_NAME, propertyConfig.PropertyConfiguration.AutoCompleteProperties.ControllerName }, { ControlLibConstants.MIN_CHAR_REQUIRED, propertyConfig.PropertyConfiguration.AutoCompleteProperties.MinCharRequired > 0 ? propertyConfig.PropertyConfiguration.AutoCompleteProperties.MinCharRequired.ToString() : propertyBag.AutoCompleteProperties.MinCharRequired.ToString() }, { ControlLibConstants.MAX_RESULT_COUNT, propertyConfig.PropertyConfiguration.AutoCompleteProperties.MaxResultCount > 0 ? propertyConfig.PropertyConfiguration.AutoCompleteProperties.MaxResultCount.ToString() : propertyBag.AutoCompleteProperties.MaxResultCount.ToString() }, { ControlLibConstants.ORDER_BY, propertyConfig.PropertyConfiguration.AutoCompleteProperties.OrderBy.ToString() }, { ControlLibConstants.SEARCH_TYPE, propertyConfig.PropertyConfiguration.AutoCompleteProperties.SearchType.ToString() } }); //propertyBag.AutoComplete = true; } if (propertyConfig.PropertyConfiguration.MaskingProperties != null) { propertyBag.MaskingProperties = new MaskingBehaviourPropertyBag(new Dictionary <string, string>() { { ControlLibConstants.MASKING_CHAR, !string.IsNullOrEmpty(propertyConfig.PropertyConfiguration.MaskingProperties.MaskingChar.ToString()) ? propertyConfig.PropertyConfiguration.MaskingProperties.MaskingChar.ToString() : propertyBag.MaskingProperties.MaskingChar.ToString() }, { ControlLibConstants.MASKING_TYPE, propertyConfig.PropertyConfiguration.MaskingProperties.MaskingType.ToString() }, { ControlLibConstants.MASKING_CHAR_LENGTH, propertyConfig.PropertyConfiguration.MaskingProperties.MaskCharLength > 0 ? propertyConfig.PropertyConfiguration.MaskingProperties.MaskCharLength.ToString() : propertyBag.MaskingProperties.MaskCharLength.ToString() }, { ControlLibConstants.MASKING_POSITION, propertyConfig.PropertyConfiguration.MaskingProperties.MaskingPosition.ToString() } }); } } } }
public override void Fill(TextBoxPropertyBag propertyBag, FillerParams fillerParams) { propertyBag.ControlName = fillerParams.ControlName; IControlDefaultPropertyBag controlDefault = ReadDefaultConfiguration(ControlNames.BallyTextBox); if (controlDefault != null) { propertyBag.CssClass = controlDefault.CssClass; propertyBag.ValidationErrorCssClass = controlDefault.ValidationErrorCssClass; propertyBag.ControlErrorCssClass = controlDefault.ControlErrorCssClass; if (propertyBag.AutoCompleteProperties == null) { propertyBag.AutoCompleteProperties = new AutoCompleteBehaviourPropertyBag(new Dictionary <string, string>() { { ControlLibConstants.ACTION_URL, controlDefault.AutoCompleteProperty.ActionURL }, { ControlLibConstants.ACTION_NAME, controlDefault.AutoCompleteProperty.ActionName }, { ControlLibConstants.CONTROLLER_NAME, controlDefault.AutoCompleteProperty.ControllerName }, { ControlLibConstants.MIN_CHAR_REQUIRED, controlDefault.AutoCompleteProperty.MinCharRequired.ToString() }, { ControlLibConstants.MAX_RESULT_COUNT, controlDefault.AutoCompleteProperty.MaxResultCount.ToString() }, { ControlLibConstants.ORDER_BY, controlDefault.AutoCompleteProperty.OrderBy.ToString() }, { ControlLibConstants.SEARCH_TYPE, controlDefault.AutoCompleteProperty.SearchType.ToString() } }); } if (propertyBag.MaskingProperties == null) { propertyBag.MaskingProperties = new MaskingBehaviourPropertyBag(new Dictionary <string, string>() { { "MaskingChar", controlDefault.MaskingProperty.MaskingChar.ToString() }, { "MaskingType", controlDefault.MaskingProperty.MaskingType.ToString() }, { "MaskCharLength", controlDefault.MaskingProperty.MaskCharLength.ToString() }, { "MaskingPosition", controlDefault.MaskingProperty.MaskingPosition.ToString() } }); } } }
public override void Fill(TextBoxPropertyBag propertyBag, FillerParams fillerParams) { if (fillerParams.SkipBehaviourFill == false) { IModelPropertyConfiguration propertyConfig = ReadPropertyConfiguration(fillerParams.ModelName, fillerParams.PropertyName, fillerParams.ConfigKey); //propertyBag.AutoComplete = false; propertyBag.Masking = false; if (propertyConfig != null && propertyConfig.PropertyConfiguration != null) { if (propertyConfig.PropertyConfiguration.AutoCompleteProperties != null && propertyBag.AutoComplete) { propertyBag.AutoCompleteProperties = new AutoCompleteBehaviourPropertyBag(new Dictionary<string, string>() { {ControlLibConstants.ACTION_URL, propertyConfig.PropertyConfiguration.AutoCompleteProperties.ActionURL }, { ControlLibConstants.ACTION_NAME, propertyConfig.PropertyConfiguration.AutoCompleteProperties.ActionName }, { ControlLibConstants.CONTROLLER_NAME, propertyConfig.PropertyConfiguration.AutoCompleteProperties.ControllerName}, {ControlLibConstants.MIN_CHAR_REQUIRED, propertyConfig.PropertyConfiguration.AutoCompleteProperties.MinCharRequired > 0 ? propertyConfig.PropertyConfiguration.AutoCompleteProperties.MinCharRequired.ToString() : propertyBag.AutoCompleteProperties.MinCharRequired.ToString()}, { ControlLibConstants.MAX_RESULT_COUNT, propertyConfig.PropertyConfiguration.AutoCompleteProperties.MaxResultCount > 0 ? propertyConfig.PropertyConfiguration.AutoCompleteProperties.MaxResultCount.ToString() : propertyBag.AutoCompleteProperties.MaxResultCount.ToString() }, { ControlLibConstants.ORDER_BY, propertyConfig.PropertyConfiguration.AutoCompleteProperties.OrderBy.ToString() }, { ControlLibConstants.SEARCH_TYPE, propertyConfig.PropertyConfiguration.AutoCompleteProperties.SearchType.ToString() }}); //propertyBag.AutoComplete = true; } if (propertyConfig.PropertyConfiguration.MaskingProperties != null) { propertyBag.MaskingProperties = new MaskingBehaviourPropertyBag(new Dictionary<string, string>() { { ControlLibConstants.MASKING_CHAR, !string.IsNullOrEmpty(propertyConfig.PropertyConfiguration.MaskingProperties.MaskingChar.ToString()) ? propertyConfig.PropertyConfiguration.MaskingProperties.MaskingChar.ToString() : propertyBag.MaskingProperties.MaskingChar.ToString() }, { ControlLibConstants.MASKING_TYPE, propertyConfig.PropertyConfiguration.MaskingProperties.MaskingType.ToString() }, {ControlLibConstants.MASKING_CHAR_LENGTH, propertyConfig.PropertyConfiguration.MaskingProperties.MaskCharLength > 0 ? propertyConfig.PropertyConfiguration.MaskingProperties.MaskCharLength.ToString() : propertyBag.MaskingProperties.MaskCharLength.ToString() }, { ControlLibConstants.MASKING_POSITION, propertyConfig.PropertyConfiguration.MaskingProperties.MaskingPosition.ToString() } }); } } } }
public override void Fill(TextBoxPropertyBag propertyBag, FillerParams fillerParams) { fillValidators(propertyBag, fillerParams); }
public TextBoxHTMLEmitter(string value, TextBoxPropertyBag propertyBag) : base(propertyBag.Validators, propertyBag.Mandatory) { this._propertyBag = propertyBag; this.Value = value; }
public virtual void Fill(TextBoxPropertyBag propertyBag, FillerParams fillerParams) { }