Пример #1
0
        public static MvcHtmlString BallyListBox <TModel, TProperty>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TProperty> > expression, ItemDataSource dataSource, int listLength = -1, StylePropertyBag style = null, short tabIndex = 0, string onClickFunction = "", string listItemTemplateCssClass = "", string listItemMouseOverCssClass = "", string listItemSelectedCssClass = "")
        {
            string propertyName      = string.Empty;
            string modelName         = string.Empty;
            object value             = string.Empty;
            string errMsg            = string.Empty;
            string controlHtmlString = string.Empty;
            Dictionary <string, string> overrideSettings;
            string             configKey = string.Empty;
            ListBoxHTMLEmitter controlHtmlEmitter;

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

            overrideSettings = GetBallyListBoxOverrideSettings(listLength, style, tabIndex, onClickFunction, value, listItemTemplateCssClass, listItemMouseOverCssClass, listItemSelectedCssClass);
            FillerParams fillerParams = null;

            if (dataSource != null)
            {
                string[] displayParam = new string[1];
                displayParam[0] = dataSource.DisplayMember;
                fillerParams    = new FillerParams(modelName, propertyName, overrideSettings, list: dataSource.DataSource, valueMember: dataSource.ValueMember, param: displayParam, templateKeyName: DefaultTemplate.SimpleListTemplate.ToString(), listType: ListBoxType.SimpleList, configKey: configKey);
            }
            else
            {
                fillerParams = new FillerParams(modelName, propertyName, overrideSettings, list: null, valueMember: string.Empty, param: null, templateKeyName: DefaultTemplate.SimpleListTemplate.ToString(), listType: ListBoxType.SimpleList, configKey: configKey);
            }

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

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

            controlHtmlEmitter.Emit(out controlHtmlString);
            return(MvcHtmlString.Create(controlHtmlString));
        }
Пример #2
0
        public static MvcHtmlString BallyCascadeDropDown <TModel, TProperty>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TProperty> > expression, NameGenerator controlId, string actionUrl, ItemDataSource dataSource, string[] disabled = null, int listLength = -1, StylePropertyBag style = null, short tabIndex = 0, string onChangeFunction = "", string cssClass = "", string cascadeInputFunction = "", IDictionary <string, object> attributes = null)
        {
            string propertyName       = string.Empty;
            string targetControlID    = controlId.ControlID;
            string modelName          = string.Empty;
            object value              = string.Empty;
            string errMsg             = string.Empty;
            string dropDownHTMLString = string.Empty;
            Dictionary <string, string> overrideSettings;
            string configKey = string.Empty;
            DropDownHTMLEmitter dropDownHTMLEmitter;

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

            overrideSettings = GetBallyDropdownListOverrideSettings(DropDownType.CascadeSelect, listLength, targetControlID, actionUrl, style, tabIndex, onChangeFunction, value, cssClass, cascadeInputFunction);
            FillerParams fillerParams = null;

            if (dataSource != null)
            {
                fillerParams = new FillerParams(modelName, propertyName, overrideSettings, list: dataSource.DataSource, valueMember: dataSource.ValueMember, displayMember: dataSource.DisplayMember, disabled: disabled, attributes: attributes, configKey: configKey);
            }
            else
            {
                fillerParams = new FillerParams(modelName, propertyName, overrideSettings, list: null, valueMember: string.Empty, displayMember: string.Empty, disabled: disabled, attributes: attributes, configKey: configKey);
            }

            var fillers             = ControlPropertyFillerFactory.Get();
            var dropDownpropertyBag = new DropDownPropertyBag(fillerParams);

            dropDownpropertyBag.Accept(fillers);
            dropDownpropertyBag.ErrorMessage = errMsg;
            dropDownpropertyBag.IsDirty      = string.IsNullOrEmpty(errMsg) ? false : true;
            dropDownHTMLEmitter = new DropDownHTMLEmitter(value != null ? value.ToString() : string.Empty, dropDownpropertyBag);

            dropDownHTMLEmitter.Emit(out dropDownHTMLString);
            return(MvcHtmlString.Create(dropDownHTMLString));
        }
Пример #3
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));
        }
Пример #4
0
        public static MvcHtmlString BallyRadioButtonList <TModel, TProperty>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TProperty> > expression, ItemDataSource dataSource, int listLength = -1, string[] disabled = null, StylePropertyBag style = null, short tabIndex = 0, string onClickFunction = "", bool isVerticalAllign = false, string cssClass = "")
        {
            string propertyName         = string.Empty;
            string modelName            = string.Empty;
            object value                = string.Empty;
            string errMsg               = string.Empty;
            string chkBoxListHTMLString = string.Empty;
            string configKey            = string.Empty;
            Dictionary <string, string> overrideSettings;
            RadioButtonListHTMLEmitter  radioListHTMLEmitter;

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

            overrideSettings = GetBallyRadioButtonListOverrideSettings(listLength, style, tabIndex, onClickFunction, isVerticalAllign, value, cssClass);
            FillerParams fillerParams = null;

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

            var fillers            = ControlPropertyFillerFactory.Get();
            var chkListpropertyBag = new RadioButtonListPropertyBag(fillerParams);

            chkListpropertyBag.Accept(fillers);
            chkListpropertyBag.ErrorMessage = errMsg;
            chkListpropertyBag.IsDirty      = string.IsNullOrEmpty(errMsg) ? false : true;
            radioListHTMLEmitter            = new RadioButtonListHTMLEmitter(value != null ? value.ToString() : string.Empty, chkListpropertyBag);

            radioListHTMLEmitter.Emit(out chkBoxListHTMLString);
            return(MvcHtmlString.Create(chkBoxListHTMLString));
        }
Пример #5
0
        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));
        }