示例#1
0
        public override void Fill(TemplateDropDownPropertyBag 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);
            }
        }
 public TemplateDropDownHTMLEmitter(string value, TemplateDropDownPropertyBag propertyBag)
     : base(propertyBag.Validators, propertyBag.Mandatory)
 {
     this._propertyBag = propertyBag;
     this.Value        = value;
     getTemplateHtml(propertyBag.TemplateHTML, out _templateHtml);
     _templateScriptTagID = string.Format("template_{0}", this._propertyBag.ControlName);
 }
 public TemplateDropDownHTMLEmitter(string value, TemplateDropDownPropertyBag propertyBag)
     : base(propertyBag.Validators, propertyBag.Mandatory)
 {
     this._propertyBag = propertyBag;
     this.Value = value;
     getTemplateHtml(propertyBag.TemplateHTML, out _templateHtml);
     _templateScriptTagID = string.Format("template_{0}", this._propertyBag.ControlName);
 }
示例#4
0
        public override void Fill(TemplateDropDownPropertyBag propertyBag, FillerParams fillerParam)
        {
            propertyBag.ControlName = fillerParam.ControlName;

            IControlDefaultPropertyBag controlDefault = ReadDefaultConfiguration(ControlNames.BallyTemplateDropDown);

            if (controlDefault != null)
            {
                propertyBag.CssClass = controlDefault.CssClass;
                propertyBag.ValidationErrorCssClass = controlDefault.ValidationErrorCssClass;
                propertyBag.ControlErrorCssClass    = controlDefault.ControlErrorCssClass;
                //propertyBag.ListTemplateCssClass = controlDefault.ListTemplateCssClass;
            }
        }
        public override void Fill(TemplateDropDownPropertyBag propertyBag, FillerParams fillerParams)
        {
            //Filling implementation code
            if (fillerParams.OverrideSettings != null && fillerParams.OverrideSettings.Count > 0)
            {
                propertyBag.TabIndex          = Convert.ToInt16(fillerParams.OverrideSettings[ControlLibConstants.TAB_INDEX]);
                propertyBag.ListItem          = ControlHelper.GetListItems(fillerParams.List, fillerParams.ValueMember, fillerParams.Param);
                propertyBag.ListDisplayLength = Convert.ToInt16(fillerParams.OverrideSettings[ControlLibConstants.LIST_LENGTH]);
                propertyBag.OnChangeFunction  = fillerParams.OverrideSettings[ControlLibConstants.ON_CHANGE_FUNCTION];

                propertyBag.TemplateNameKey = fillerParams.OverrideSettings[ControlLibConstants.TEMPLATE_NAME_KEY];

                IControlTemplateConfiguration templateObject = ControlLibraryConfig.ControlConfigReader.GetTemplateConfiguration(fillerParams.TemplateNameKey);
                if (templateObject != null)
                {
                    propertyBag.TemplateHTML = templateObject.TemplateHTML;
                }

                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 static MvcHtmlString BallyTemplateDropDown <TModel, TProperty>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TProperty> > expression, string templateNameKey, ItemDataSource dataSource, int listLength = -1, StylePropertyBag style = null, short tabIndex = 0, string onChangeFunction = "", string cssClass = "")
        {
            string propertyName      = string.Empty;
            string modelName         = string.Empty;
            object value             = string.Empty;
            string errMsg            = string.Empty;
            string controlHtmlString = string.Empty;
            string configKey         = string.Empty;
            Dictionary <string, string> overrideSettings;
            TemplateDropDownHTMLEmitter controlHtmlEmitter;

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

            overrideSettings = GetBallyMultiColumnDropDownOverrideSettings(templateNameKey, listLength, style, tabIndex, onChangeFunction, value, cssClass);
            FillerParams fillerParams = null;

            if (dataSource != null)
            {
                fillerParams = new FillerParams(modelName, propertyName, overrideSettings, list: dataSource.DataSource, valueMember: dataSource.ValueMember, param: dataSource.DisplayParams, templateKeyName: templateNameKey, configKey: configKey);
            }
            else
            {
                fillerParams = new FillerParams(modelName, propertyName, overrideSettings, list: null, valueMember: string.Empty, param: null, templateKeyName: templateNameKey, configKey: configKey);
            }

            var fillers            = ControlPropertyFillerFactory.Get();
            var controlPropertyBag = new TemplateDropDownPropertyBag(fillerParams);

            controlPropertyBag.Accept(fillers);
            controlPropertyBag.ErrorMessage = errMsg;
            controlPropertyBag.IsDirty      = string.IsNullOrEmpty(errMsg) ? false : true;
            controlHtmlEmitter = new TemplateDropDownHTMLEmitter(value != null ? value.ToString() : string.Empty, controlPropertyBag);

            controlHtmlEmitter.Emit(out controlHtmlString);
            return(MvcHtmlString.Create(controlHtmlString));
        }
 public override void Fill(TemplateDropDownPropertyBag propertyBag, FillerParams fillerParams)
 {
     fillValidators(propertyBag, fillerParams);
 }
示例#8
0
        public override void Fill(TemplateDropDownPropertyBag 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);
            }
        }
示例#9
0
 public virtual void Fill(TemplateDropDownPropertyBag propertyBag, FillerParams fillerParams) { }
示例#10
0
 public virtual void Fill(TemplateDropDownPropertyBag propertyBag, FillerParams fillerParams)
 {
 }
示例#11
0
 public override void Fill(TemplateDropDownPropertyBag propertyBag, FillerParams fillerParams)
 {
     fillValidators(propertyBag, fillerParams);
 }
示例#12
0
        public override void Fill(TemplateDropDownPropertyBag propertyBag, FillerParams fillerParam)
        {
            propertyBag.ControlName = fillerParam.ControlName;

            IControlDefaultPropertyBag controlDefault = ReadDefaultConfiguration(ControlNames.BallyTemplateDropDown);
            if (controlDefault != null)
            {
                propertyBag.CssClass = controlDefault.CssClass;
                propertyBag.ValidationErrorCssClass = controlDefault.ValidationErrorCssClass;
                propertyBag.ControlErrorCssClass = controlDefault.ControlErrorCssClass;
                //propertyBag.ListTemplateCssClass = controlDefault.ListTemplateCssClass;
            }
        }
        public override void Fill(TemplateDropDownPropertyBag propertyBag, FillerParams fillerParams)
        {
            //Filling implementation code
            if (fillerParams.OverrideSettings != null && fillerParams.OverrideSettings.Count > 0)
            {
                propertyBag.TabIndex = Convert.ToInt16(fillerParams.OverrideSettings[ControlLibConstants.TAB_INDEX]);
                propertyBag.ListItem = ControlHelper.GetListItems(fillerParams.List, fillerParams.ValueMember, fillerParams.Param);
                propertyBag.ListDisplayLength = Convert.ToInt16(fillerParams.OverrideSettings[ControlLibConstants.LIST_LENGTH]);
                propertyBag.OnChangeFunction = fillerParams.OverrideSettings[ControlLibConstants.ON_CHANGE_FUNCTION];

                propertyBag.TemplateNameKey = fillerParams.OverrideSettings[ControlLibConstants.TEMPLATE_NAME_KEY];

                IControlTemplateConfiguration templateObject = ControlLibraryConfig.ControlConfigReader.GetTemplateConfiguration(fillerParams.TemplateNameKey);
                if (templateObject != null)
                {
                    propertyBag.TemplateHTML = templateObject.TemplateHTML;
                }

                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);
        }