コード例 #1
0
        public override void Fill(DateTimePropertyBag propertyBag, FillerParams fillerParams)
        {
            if (fillerParams.SkipBehaviourFill == false)
            {
                IModelPropertyConfiguration propertyConfig = ReadPropertyConfiguration(fillerParams.ModelName, fillerParams.PropertyName, fillerParams.ConfigKey);
                propertyBag.ShowDate = false;
                propertyBag.ShowTime = false;
                if (propertyConfig != null && propertyConfig.PropertyConfiguration != null)
                {
                    if (propertyConfig.PropertyConfiguration.DateProperties != null)
                    {
                        ///******** Adding config properties to datePropertyBag **********/

                        propertyBag.DateProperties = propertyConfig.PropertyConfiguration.DateProperties;
                        propertyBag.ShowDate       = true;
                    }
                    if (propertyConfig.PropertyConfiguration.TimeProperties != null)
                    {
                        ///******** Adding config properties to datePropertyBag **********/
                        ///
                        propertyBag.TimeProperties = propertyConfig.PropertyConfiguration.TimeProperties;
                        propertyBag.ShowTime       = true;
                    }
                }
            }
        }
コード例 #2
0
        public override void Fill(DateTimePropertyBag 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);
            }
        }
コード例 #3
0
        public override void Fill(DateTimePropertyBag propertyBag, FillerParams fillerParams)
        {
            //Filling implementation code
            if (fillerParams.OverrideSettings != null && fillerParams.OverrideSettings.Count > 0)
            {
                propertyBag.DateProperties.DateFormat = fillerParams.OverrideSettings[ControlLibConstants.DATE_FORMAT];
                propertyBag.TimeProperties.ShowAmPm   = Convert.ToBoolean(fillerParams.OverrideSettings[ControlLibConstants.SHOW_AM_PM]);
                propertyBag.TimeProperties.Step       = Convert.ToInt16(fillerParams.OverrideSettings[ControlLibConstants.STEP]);
                propertyBag.TabIndex                 = Convert.ToInt16(fillerParams.OverrideSettings[ControlLibConstants.TAB_INDEX]);
                propertyBag.OnChangeFunction         = fillerParams.OverrideSettings[ControlLibConstants.ON_CHANGE_FUNCTION];
                propertyBag.ShowDate                 = Convert.ToBoolean(fillerParams.OverrideSettings[ControlLibConstants.SHOW_DATE]);
                propertyBag.ShowTime                 = Convert.ToBoolean(fillerParams.OverrideSettings[ControlLibConstants.SHOW_TIME]);
                propertyBag.DateProperties.YearRange = fillerParams.OverrideSettings[ControlLibConstants.YEAR_RANGE];
                propertyBag.DateProperties.MinDate   = fillerParams.minDate.HasValue ? fillerParams.minDate.Value.ToShortDateString() : string.Empty;
                propertyBag.DateProperties.MaxDate   = fillerParams.maxDate.HasValue ? fillerParams.maxDate.Value.ToShortDateString() : string.Empty;

                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.DATE_CSS_CLASS] != string.Empty)
                {
                    propertyBag.DateProperties.DateCssClass = fillerParams.OverrideSettings[ControlLibConstants.CSS_CLASS];
                }
                if (fillerParams.OverrideSettings[ControlLibConstants.TIME_CSS_CLASS] != string.Empty)
                {
                    propertyBag.TimeProperties.TimeCssClass = 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);
        }
コード例 #4
0
        public override void Fill(DateTimePropertyBag propertyBag, FillerParams fillerParams)
        {
            propertyBag.ControlName = fillerParams.ControlName;

            IControlDefaultPropertyBag controlDefault = ReadDefaultConfiguration(ControlNames.BallyDateTime);

            if (controlDefault != null)
            {
                propertyBag.CssClass = controlDefault.CssClass;
                propertyBag.ValidationErrorCssClass = controlDefault.ValidationErrorCssClass;
                propertyBag.ControlErrorCssClass    = controlDefault.ControlErrorCssClass;

                if (propertyBag.DateProperties == null)
                {
                    propertyBag.DateProperties = new DatePropertyBag(controlDefault.DateProperty.DateFormat,
                                                                     controlDefault.DateProperty.NumberOfMonths,
                                                                     controlDefault.DateProperty.ShowButtonPanel,
                                                                     controlDefault.DateProperty.MaxDate,
                                                                     controlDefault.DateProperty.MinDate,
                                                                     controlDefault.DateProperty.ChangeMonth,
                                                                     controlDefault.DateProperty.ChangeYear,
                                                                     controlDefault.DateProperty.ChangeDate,
                                                                     controlDefault.DateProperty.DateCssClass, string.Empty);
                }

                if (propertyBag.TimeProperties == null)
                {
                    propertyBag.TimeProperties = new TimePropertyBag(
                        controlDefault.TimeProperty.ShowAmPm,
                        controlDefault.TimeProperty.TimeFormat,
                        controlDefault.TimeProperty.ShowDuration,
                        controlDefault.TimeProperty.Step,
                        controlDefault.TimeProperty.TimeCssClass);
                }
            }
        }
コード例 #5
0
        public static MvcHtmlString BallyDateTimePicker <TModel, TProperty>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TProperty> > expression, bool showDate = true, bool showTime = true, string dateFormat = "yy-mm-dd", bool showAmPm = false, int step = 5, StylePropertyBag style = null, short tabIndex = 0, string onChangeFunction = "", string dateCssClass = "", string timeCssClass = "", int minYear = -1, int maxYear = -1, DateTime?minDate = null, DateTime?maxDate = null)//bool UTCConversion = true,
        {
            string propertyName       = string.Empty;
            string modelName          = string.Empty;
            object value              = string.Empty;
            string errMsg             = string.Empty;
            string dateTimeHTMLString = string.Empty;
            Dictionary <string, string> overrideSettings;
            string configKey = string.Empty;
            DateTimeHTMLEmitter dateTimeHTMLEmitter;

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

            overrideSettings = GetBallyDateTimePickerOverrideSettings(showDate, showTime, dateFormat, showAmPm, step, style, tabIndex, onChangeFunction, dateCssClass, timeCssClass, getYearRange(minYear, maxYear));
            var          fillers             = ControlPropertyFillerFactory.Get();
            FillerParams fillerParams        = new FillerParams(modelName, propertyName, overrideSettings, configKey: configKey, minDate: minDate, maxDate: maxDate);
            var          dateTimepropertyBag = new DateTimePropertyBag(fillerParams);

            dateTimepropertyBag.Accept(fillers);
            dateTimepropertyBag.ErrorMessage = errMsg;
            dateTimepropertyBag.IsDirty      = string.IsNullOrEmpty(errMsg) ? false : true;
            //dateTimepropertyBag.UTCDateTime = UTCValue;
            //dateTimepropertyBag.UTCConversion = UTCConversion;
            DateTime dt = DateTime.MinValue;

            if (value != null)
            {
                DateTime.TryParse(value.ToString(), out dt);
                // dateTimepropertyBag.DateTimeKind = dt.Kind; /*Check the values- UTC,LOCAL,Unspecified*/
            }

            // dateTimeHTMLEmitter = new DateTimeHTMLEmitter(!showTime ? ( default(DateTime) == dt ? string.Empty : dt.ToShortDateString()) : (!showDate ? dt.ToShortTimeString() : dt.ToString()), dateTimepropertyBag);
            dateTimeHTMLEmitter = new DateTimeHTMLEmitter(dt.ToString(), dateTimepropertyBag);
            dateTimeHTMLEmitter.Emit(out dateTimeHTMLString);
            return(MvcHtmlString.Create(dateTimeHTMLString));
        }
コード例 #6
0
 public override void Fill(DateTimePropertyBag propertyBag, FillerParams fillerParams)
 {
     fillValidators(propertyBag, fillerParams);
 }
コード例 #7
0
        public override void Fill(DateTimePropertyBag 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);
            }
        }
コード例 #8
0
ファイル: DateTimeHTMLEmitter.cs プロジェクト: kriznaraj/Code
 public DateTimeHTMLEmitter(string value, DateTimePropertyBag propertyBag)
     : base(propertyBag.Validators, propertyBag.Mandatory)
 {
     this._propertyBag = propertyBag;
     this.Value        = value;
 }
コード例 #9
0
 public virtual void Fill(DateTimePropertyBag propertyBag, FillerParams fillerParams) { }
コード例 #10
0
 public override void Fill(DateTimePropertyBag propertyBag, FillerParams fillerParams)
 {
     if (fillerParams.SkipBehaviourFill == false)
     {
         IModelPropertyConfiguration propertyConfig = ReadPropertyConfiguration(fillerParams.ModelName, fillerParams.PropertyName, fillerParams.ConfigKey);
         propertyBag.ShowDate = false;
         propertyBag.ShowTime = false;
         if (propertyConfig != null && propertyConfig.PropertyConfiguration != null)
         {
             if (propertyConfig.PropertyConfiguration.DateProperties != null)
             {
                 ///******** Adding config properties to datePropertyBag **********/
                 
                 propertyBag.DateProperties = propertyConfig.PropertyConfiguration.DateProperties;
                 propertyBag.ShowDate = true;
             }
             if (propertyConfig.PropertyConfiguration.TimeProperties != null)
             {
                 ///******** Adding config properties to datePropertyBag **********/
                 ///
                 propertyBag.TimeProperties = propertyConfig.PropertyConfiguration.TimeProperties;
                 propertyBag.ShowTime = true;
             }
         } 
     }
 }
コード例 #11
0
 public virtual void Fill(DateTimePropertyBag propertyBag, FillerParams fillerParams)
 {
 }
コード例 #12
0
 public DateTimeHTMLEmitter(string value, DateTimePropertyBag propertyBag)
     : base(propertyBag.Validators, propertyBag.Mandatory)
 {
     this._propertyBag = propertyBag;
     this.Value = value;
 }
コード例 #13
0
 public override void Fill(DateTimePropertyBag propertyBag, FillerParams fillerParams)
 {
     fillValidators(propertyBag, fillerParams);
 }
コード例 #14
0
        public override void Fill(DateTimePropertyBag propertyBag, FillerParams fillerParams)
        {
            propertyBag.ControlName = fillerParams.ControlName;

            IControlDefaultPropertyBag controlDefault = ReadDefaultConfiguration(ControlNames.BallyDateTime);
            if (controlDefault != null)
            {
                propertyBag.CssClass = controlDefault.CssClass;
                propertyBag.ValidationErrorCssClass = controlDefault.ValidationErrorCssClass;
                propertyBag.ControlErrorCssClass = controlDefault.ControlErrorCssClass;

                if (propertyBag.DateProperties == null)
                {
                    propertyBag.DateProperties = new DatePropertyBag(controlDefault.DateProperty.DateFormat,
                        controlDefault.DateProperty.NumberOfMonths,
                        controlDefault.DateProperty.ShowButtonPanel,
                        controlDefault.DateProperty.MaxDate,
                        controlDefault.DateProperty.MinDate,
                        controlDefault.DateProperty.ChangeMonth,
                        controlDefault.DateProperty.ChangeYear,
                        controlDefault.DateProperty.ChangeDate,
                        controlDefault.DateProperty.DateCssClass, string.Empty);
                }

                if (propertyBag.TimeProperties == null)
                {
                    propertyBag.TimeProperties = new TimePropertyBag(
                        controlDefault.TimeProperty.ShowAmPm,
                        controlDefault.TimeProperty.TimeFormat,
                        controlDefault.TimeProperty.ShowDuration,
                        controlDefault.TimeProperty.Step,
                        controlDefault.TimeProperty.TimeCssClass);
                }
            }
        }
コード例 #15
0
        public override void Fill(DateTimePropertyBag propertyBag, FillerParams fillerParams)
        {
            //Filling implementation code
            if (fillerParams.OverrideSettings != null && fillerParams.OverrideSettings.Count > 0)
            {
                propertyBag.DateProperties.DateFormat = fillerParams.OverrideSettings[ControlLibConstants.DATE_FORMAT];
                propertyBag.TimeProperties.ShowAmPm = Convert.ToBoolean(fillerParams.OverrideSettings[ControlLibConstants.SHOW_AM_PM]);
                propertyBag.TimeProperties.Step = Convert.ToInt16(fillerParams.OverrideSettings[ControlLibConstants.STEP]);
                propertyBag.TabIndex = Convert.ToInt16(fillerParams.OverrideSettings[ControlLibConstants.TAB_INDEX]);
                propertyBag.OnChangeFunction = fillerParams.OverrideSettings[ControlLibConstants.ON_CHANGE_FUNCTION];
                propertyBag.ShowDate = Convert.ToBoolean(fillerParams.OverrideSettings[ControlLibConstants.SHOW_DATE]);
                propertyBag.ShowTime = Convert.ToBoolean(fillerParams.OverrideSettings[ControlLibConstants.SHOW_TIME]);
                propertyBag.DateProperties.YearRange = fillerParams.OverrideSettings[ControlLibConstants.YEAR_RANGE];
                propertyBag.DateProperties.MinDate = fillerParams.minDate.HasValue ? fillerParams.minDate.Value.ToShortDateString() : string.Empty;
                propertyBag.DateProperties.MaxDate = fillerParams.maxDate.HasValue ? fillerParams.maxDate.Value.ToShortDateString() : string.Empty;

                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.DATE_CSS_CLASS] != string.Empty)
                {
                    propertyBag.DateProperties.DateCssClass = fillerParams.OverrideSettings[ControlLibConstants.CSS_CLASS];
                }
                if (fillerParams.OverrideSettings[ControlLibConstants.TIME_CSS_CLASS] != string.Empty)
                {
                    propertyBag.TimeProperties.TimeCssClass = 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);
        }