예제 #1
0
        public static MvcHtmlString BallyLabel <TModel, TProperty>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TProperty> > expression, StylePropertyBag style = null, string cssClass = "", IDictionary <string, object> attributes = null)
        {
            string propertyName    = string.Empty;
            string modelName       = string.Empty;
            object value           = string.Empty;
            string errMsg          = string.Empty;
            string labelHTMLString = 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, false);

            overrideSettings = GetLabelOverrideSettings(DisplayType.Label, style, cssClass: cssClass);

            var          fillers          = ControlPropertyFillerFactory.Get();
            FillerParams fillerParams     = new FillerParams(modelName, propertyName, overrideSettings, attributes: attributes, configKey: configKey);
            var          labelPropertyBag = new LabelPropertyBag(fillerParams);

            labelPropertyBag.Accept(fillers);

            var labelHTMLEmitter = new LabelHTMLEmitter(value != null ? value.ToString() : string.Empty, labelPropertyBag);

            labelHTMLEmitter.Emit(out labelHTMLString);
            return(MvcHtmlString.Create(labelHTMLString));
        }
        public override void Fill(LabelPropertyBag propertyBag, FillerParams fillerParams)
        {
            if (fillerParams.OverrideSettings != null && fillerParams.OverrideSettings.Count > 0)
            {
                propertyBag.DisplayType = (DisplayType)Enum.Parse(typeof(DisplayType), fillerParams.OverrideSettings[ControlLibConstants.DISPLAY_TYPE], true);
                propertyBag.IsCurrency = Convert.ToBoolean(fillerParams.OverrideSettings[ControlLibConstants.IS_CURRENCY]);

                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.OverrideToolTip = fillerParams.OverrideSettings[ControlLibConstants.OVERRIDE_TOOLTIP];
            }
            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);
        }
예제 #3
0
        public override void Fill(LabelPropertyBag 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(LabelPropertyBag propertyBag, FillerParams fillerParams)
        {
            if (fillerParams.OverrideSettings != null && fillerParams.OverrideSettings.Count > 0)
            {
                propertyBag.DisplayType = (DisplayType)Enum.Parse(typeof(DisplayType), fillerParams.OverrideSettings[ControlLibConstants.DISPLAY_TYPE], true);
                propertyBag.IsCurrency  = Convert.ToBoolean(fillerParams.OverrideSettings[ControlLibConstants.IS_CURRENCY]);

                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.OverrideToolTip = fillerParams.OverrideSettings[ControlLibConstants.OVERRIDE_TOOLTIP];
            }
            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);
        }
예제 #5
0
        public override void Fill(LabelPropertyBag propertyBag, FillerParams fillerParams)
        {
            if (fillerParams.SkipBehaviourFill == false)
            {
                IModelPropertyConfiguration propertyConfig = ReadPropertyConfiguration(fillerParams.ModelName, fillerParams.PropertyName, fillerParams.ConfigKey);
                propertyBag.Masking = false;
                if (propertyConfig != null && propertyConfig.PropertyConfiguration != null)
                {
                    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() } });
                    }
                } 
            }
        }
예제 #6
0
 public override void Fill(LabelPropertyBag propertyBag, FillerParams fillerParams)
 {
     if (fillerParams.SkipBehaviourFill == false)
     {
         IModelPropertyConfiguration propertyConfig = ReadPropertyConfiguration(fillerParams.ModelName, fillerParams.PropertyName, fillerParams.ConfigKey);
         propertyBag.Masking = false;
         if (propertyConfig != null && propertyConfig.PropertyConfiguration != null)
         {
             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() }
                 });
             }
         }
     }
 }
예제 #7
0
        public override void Fill(LabelPropertyBag propertyBag, FillerParams fillerParams)
        {
            propertyBag.ControlName = fillerParams.ControlName;

            IControlDefaultPropertyBag controlDefault = ReadDefaultConfiguration(ControlNames.BallyLabel);
            if (controlDefault != null)
            {
                propertyBag.MandatoryChar = controlDefault.MandatoryChar;
                propertyBag.MandatoryCharCssClass = controlDefault.MandatoryCssClass;
                propertyBag.CssClass = controlDefault.CssClass;

                if (propertyBag.MaskingProperties == null)
                {
                    propertyBag.MaskingProperties = new MaskingBehaviourPropertyBag(new Dictionary<string, string>() {
                    { ControlLibConstants.MASKING_CHAR, controlDefault.MaskingProperty.MaskingChar.ToString() },
                    { ControlLibConstants.MASKING_TYPE, controlDefault.MaskingProperty.MaskingType.ToString() },
                    { ControlLibConstants.MASKING_CHAR_LENGTH, controlDefault.MaskingProperty.MaskCharLength.ToString() },
                    { ControlLibConstants.MASKING_POSITION, controlDefault.MaskingProperty.MaskingPosition.ToString() } });
                }
            }
        }
예제 #8
0
        public static MvcHtmlString BallyLabel(this HtmlHelper htmlHelper, string controlID, string externalizationKey, bool isMandatory = false, StylePropertyBag style = null, string cssClass = "", IDictionary <string, object> attributes = null)
        {
            string propertyName    = controlID;
            string modelName       = string.Empty;
            string labelHTMLString = string.Empty;
            Dictionary <string, string> overrideSettings;

            overrideSettings = GetLabelOverrideSettings(DisplayType.Label, style, cssClass: cssClass);

            var          fillers          = ControlPropertyFillerFactory.Get();
            FillerParams fillerParams     = new FillerParams(modelName, propertyName, overrideSettings, skipBehaviourFill: true, skipSecurityFill: true, skipValidationFill: true, isBindingControl: false, externalizationKey: externalizationKey, attributes: attributes);
            var          labelPropertyBag = new LabelPropertyBag(fillerParams);

            labelPropertyBag.Accept(fillers);

            labelPropertyBag.IsMandatory      = isMandatory;
            labelPropertyBag.IsBindingControl = false;
            var labelHTMLEmitter = new LabelHTMLEmitter(string.Empty, labelPropertyBag);

            labelHTMLEmitter.Emit(out labelHTMLString);
            return(MvcHtmlString.Create(labelHTMLString));
        }
예제 #9
0
        public override void Fill(LabelPropertyBag propertyBag, FillerParams fillerParams)
        {
            propertyBag.ControlName = fillerParams.ControlName;

            IControlDefaultPropertyBag controlDefault = ReadDefaultConfiguration(ControlNames.BallyLabel);

            if (controlDefault != null)
            {
                propertyBag.MandatoryChar         = controlDefault.MandatoryChar;
                propertyBag.MandatoryCharCssClass = controlDefault.MandatoryCssClass;
                propertyBag.CssClass = controlDefault.CssClass;

                if (propertyBag.MaskingProperties == null)
                {
                    propertyBag.MaskingProperties = new MaskingBehaviourPropertyBag(new Dictionary <string, string>()
                    {
                        { ControlLibConstants.MASKING_CHAR, controlDefault.MaskingProperty.MaskingChar.ToString() },
                        { ControlLibConstants.MASKING_TYPE, controlDefault.MaskingProperty.MaskingType.ToString() },
                        { ControlLibConstants.MASKING_CHAR_LENGTH, controlDefault.MaskingProperty.MaskCharLength.ToString() },
                        { ControlLibConstants.MASKING_POSITION, controlDefault.MaskingProperty.MaskingPosition.ToString() }
                    });
                }
            }
        }
예제 #10
0
        public static MvcHtmlString BallyTextBlock(this HtmlHelper htmlHelper, object value, string controlID, string externalizationKey, bool isCurrency = false, bool masking = false, StylePropertyBag style = null, string cssClass = "", IDictionary <string, object> attributes = null, string toolTip = "")
        {
            string propertyName    = controlID;
            string modelName       = string.Empty;
            string labelHTMLString = string.Empty;
            Dictionary <string, string> overrideSettings;

            overrideSettings = GetLabelOverrideSettings(DisplayType.TextBlock, style, isCurrency: isCurrency, cssClass: cssClass, overrideToolTip: toolTip);

            var          fillers          = ControlPropertyFillerFactory.Get();
            FillerParams fillerParams     = new FillerParams(modelName, propertyName, overrideSettings, skipBehaviourFill: true, skipSecurityFill: true, skipValidationFill: true, isBindingControl: false, externalizationKey: externalizationKey, attributes: attributes);
            var          labelPropertyBag = new LabelPropertyBag(fillerParams);

            labelPropertyBag.Accept(fillers);

            labelPropertyBag.IsBindingControl = false;
            labelPropertyBag.Masking          = masking;
            value = GetLabelMaskingData(propertyName, modelName, value, labelPropertyBag);

            var labelHTMLEmitter = new LabelHTMLEmitter(value != null ? value.ToString() : string.Empty, labelPropertyBag);

            labelHTMLEmitter.Emit(out labelHTMLString);
            return(MvcHtmlString.Create(labelHTMLString));
        }
예제 #11
0
 public override void Fill(LabelPropertyBag propertyBag, FillerParams fillerParams)
 {
     fillValidators(propertyBag, fillerParams);
 }
예제 #12
0
        public override void Fill(LabelPropertyBag 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);
            }
        }
예제 #13
0
 public virtual void Fill(LabelPropertyBag propertyBag, FillerParams fillerParams) { }
예제 #14
0
 public LabelHTMLEmitter(string value, LabelPropertyBag propertyBag)
     : base(null, null)
 {
     this._propertyBag = propertyBag;
     this.Value = value;
 }
예제 #15
0
 public virtual void Fill(LabelPropertyBag propertyBag, FillerParams fillerParams)
 {
 }
예제 #16
0
 public LabelHTMLEmitter(string value, LabelPropertyBag propertyBag)
     : base(null, null)
 {
     this._propertyBag = propertyBag;
     this.Value        = value;
 }
예제 #17
0
 public override void Fill(LabelPropertyBag propertyBag, FillerParams fillerParams)
 {
     fillValidators(propertyBag, fillerParams);
 }
예제 #18
0
 private static object GetLabelMaskingData(string propertyName, string modelName, object value, LabelPropertyBag labelPropertyBag)
 {
     if (labelPropertyBag.Masking && labelPropertyBag.MaskingProperties != null)
     {
         string maskedData = GetMaskedString(Convert.ToString(value), labelPropertyBag.MaskingProperties);
         value = maskedData;
     }
     return(value);
 }