public static MvcHtmlString BallyButton <TModel>(this HtmlHelper <TModel> htmlHelper, ButtonType buttonType, string controlName, string parentID, bool validateForm = true, StylePropertyBag style = null, short tabIndex = 0, string onClickFunction = "", string cssClass = "", bool?isEnabled = null, List <Security> taskCodes = null) { object value = string.Empty; string errMsg = string.Empty; string buttonHTMLString = string.Empty; string modelName = htmlHelper.ViewData.Model.GetType().Name; Dictionary <string, string> overrideSettings; overrideSettings = GetButtonOverrideSettings(buttonType, parentID, validateForm, string.Empty, style, tabIndex, onClickFunction, cssClass: cssClass); var fillers = ControlPropertyFillerFactory.Get(); FillerParams fillerParams = new FillerParams(modelName, controlName, overrideSettings, isEnabled: isEnabled, userTaskCodes: taskCodes); var buttonpropertyBag = new ButtonPropertyBag(fillerParams); buttonpropertyBag.ButtonCatagory = ButtonCatagory.BallyButton; buttonpropertyBag.Accept(fillers); buttonpropertyBag.ErrorMessage = errMsg; buttonpropertyBag.IsDirty = string.IsNullOrEmpty(errMsg) ? false : true; var buttonHTMLEmitter = new ButtonHTMLEmitter(value != null ? value.ToString() : string.Empty, buttonpropertyBag); buttonHTMLEmitter.Emit(out buttonHTMLString); return(MvcHtmlString.Create(buttonHTMLString)); }
public override void Fill(ButtonPropertyBag propertyBag, FillerParams fillerParams) { if (fillerParams.OverrideSettings != null && fillerParams.OverrideSettings.Count > 0) { propertyBag.TabIndex = Convert.ToInt16(fillerParams.OverrideSettings[ControlLibConstants.TAB_INDEX]); propertyBag.OnClickFunction = fillerParams.OverrideSettings[ControlLibConstants.ON_CLICK_FUNCTION]; propertyBag.ParentID = fillerParams.OverrideSettings[ControlLibConstants.PARENT_ID]; propertyBag.ValidateForm = Convert.ToBoolean(fillerParams.OverrideSettings[ControlLibConstants.VALIDATE_FORM]); propertyBag.ActionName = fillerParams.OverrideSettings[ControlLibConstants.ACTION_NAME]; propertyBag.ImagePath = fillerParams.OverrideSettings[ControlLibConstants.IMAGE_PATH]; propertyBag.ButtonType = (ButtonType)Enum.Parse(typeof(ButtonType), fillerParams.OverrideSettings[ControlLibConstants.BUTTON_TYPE]); propertyBag.AlignLeft = fillerParams.AlignLeft; 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.ReadOnly = fillerParams.IsReadOnly.HasValue ? fillerParams.IsReadOnly.Value : propertyBag.ReadOnly; propertyBag.Enabled = fillerParams.IsEnabled.HasValue ? fillerParams.IsEnabled.Value : propertyBag.Enabled; SetVisibility(propertyBag, fillerParams); }
public override void Fill(ButtonPropertyBag propertyBag, FillerParams fillerParams) { propertyBag.ControlName = fillerParams.ControlName; IControlDefaultPropertyBag controlDefault = ReadDefaultConfiguration((ControlNames)Enum.Parse(typeof(ControlNames), Convert.ToString(propertyBag.ButtonCatagory))); if (controlDefault != null) { propertyBag.CssClass = controlDefault.CssClass; if (propertyBag.ButtonCatagory == ButtonCatagory.BallyImageButton) { propertyBag.ImageButtonDisableClass = controlDefault.ImageButtonDisableClass; propertyBag.ImageButtonLabelDisableClass = controlDefault.ImageButtonLabelDisableClass; propertyBag.ImageButtonLeftAlignClass = controlDefault.ImageButtonLeftAlignClass; propertyBag.ImageClass = controlDefault.ImageClass; } } }
public override void Fill(ButtonPropertyBag propertyBag, FillerParams fillerParams) { if (fillerParams.SkipSecurityFill == false) { IAccessPolicy accessSecurity = null; if (fillerParams.UserTaskCodes != null) { accessSecurity = GetAccess(fillerParams.UserTaskCodes); if (accessSecurity != null) { propertyBag.Enabled = accessSecurity.Enabled; propertyBag.Visibility = accessSecurity.Visibility; } } else { setDefalutSecurity(propertyBag); } } else { setDefalutSecurity(propertyBag); } }
public virtual void Fill(ButtonPropertyBag propertyBag, FillerParams fillerParams) { }
public ButtonHTMLEmitter(string value, ButtonPropertyBag propertyBag) : base(propertyBag.Validators, propertyBag.Mandatory) { this._propertyBag = propertyBag; this.Value = value; }