Example #1
0
        public static string GetGridControlProperty(GridPropertyBag gridProperty)
        {
            StringBuilder json = new StringBuilder();

            if (gridProperty != null)
            {
                json.AppendFormat(@"{{""Pagination"": {0}, ""EnableExport"": {1}, ""EnableSorting"": {2}, ""EnableFilter"": {3}, ""PageSize"": {4},""SelectOption"": {5}, ""BodyHeight"": {6}, ""DefaultSortField"": ""{7}"", ""ImageSizeProperty"": ""{8}"", ""DisplayText"": ""{9}"", ""SelectedText"": ""{10}"", ""ExportText"": ""{11}"", ""ClearText"": ""{12}"", ""StatusProperty"": ""{13}"", ""ServerPagination"": {14} }}",
                    gridProperty.GridProperties.Pagination.ToString().ToLower(),
                    gridProperty.GridProperties.EnableExport.ToString().ToLower(),
                    gridProperty.GridProperties.EnableSorting.ToString().ToLower(),
                    gridProperty.GridProperties.EnableFilter.ToString().ToLower(),
                    gridProperty.GridProperties.PageSize,
                    gridProperty.GridProperties.SelectOption.ToString().ToLower(),
                    gridProperty.GridProperties.GridHeight,
                    gridProperty.GridProperties.DefaultSortField,
                    gridProperty.GridProperties.ImageSizeProperty,
                    ControlLibraryConfig.ResourceService.GetLiteral("Grid_DisplayText"),
                    ControlLibraryConfig.ResourceService.GetLiteral("Grid_SelectedText"),
                    ControlLibraryConfig.ResourceService.GetLiteral("Grid_ExportText"),
                    ControlLibraryConfig.ResourceService.GetLiteral("Grid_ClearText"), 
                    gridProperty.GridProperties.StatusProperty, 
                    gridProperty.GridProperties.ServerPagination.ToString().ToLower());
            }

            return json.ToString();
        }
Example #2
0
        public static string GetGridControlProperty(GridPropertyBag gridProperty)
        {
            StringBuilder json = new StringBuilder();

            if (gridProperty != null)
            {
                json.AppendFormat(@"{{""Pagination"": {0}, ""EnableExport"": {1}, ""EnableSorting"": {2}, ""EnableFilter"": {3}, ""PageSize"": {4},""SelectOption"": {5}, ""BodyHeight"": {6}, ""DefaultSortField"": ""{7}"", ""ImageSizeProperty"": ""{8}"", ""DisplayText"": ""{9}"", ""SelectedText"": ""{10}"", ""ExportText"": ""{11}"", ""ClearText"": ""{12}"", ""StatusProperty"": ""{13}"", ""ServerPagination"": {14} }}",
                                  gridProperty.GridProperties.Pagination.ToString().ToLower(),
                                  gridProperty.GridProperties.EnableExport.ToString().ToLower(),
                                  gridProperty.GridProperties.EnableSorting.ToString().ToLower(),
                                  gridProperty.GridProperties.EnableFilter.ToString().ToLower(),
                                  gridProperty.GridProperties.PageSize,
                                  gridProperty.GridProperties.SelectOption.ToString().ToLower(),
                                  gridProperty.GridProperties.GridHeight,
                                  gridProperty.GridProperties.DefaultSortField,
                                  gridProperty.GridProperties.ImageSizeProperty,
                                  ControlLibraryConfig.ResourceService.GetLiteral("Grid_DisplayText"),
                                  ControlLibraryConfig.ResourceService.GetLiteral("Grid_SelectedText"),
                                  ControlLibraryConfig.ResourceService.GetLiteral("Grid_ExportText"),
                                  ControlLibraryConfig.ResourceService.GetLiteral("Grid_ClearText"),
                                  gridProperty.GridProperties.StatusProperty,
                                  gridProperty.GridProperties.ServerPagination.ToString().ToLower());
            }

            return(json.ToString());
        }
Example #3
0
        public override void Fill(GridPropertyBag 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);
            }
        }
Example #4
0
        public static MvcHtmlString BallyGrid <TModel, TProperty>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TProperty> > expression, string valueMember, string GridDataColumnDefinitionName, IDictionary <string, object> gridParam = null, string hiddenColumns = "", string actionUrl = "", StylePropertyBag style = null, short tabIndex = 0, int pageSize = 10, int gridHeight = 400, bool enableFilter = false, bool enableSorting = false, bool enableExport = false, bool pagination = true, bool serverPagination = false, bool selectOption = true, string defaultSortField = "", string imageSizeClass = "", string statusProperty = "", string onDataRowSelectFunction = "", string onDataRowSelectionChangeFunctionName = "", 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;
            GridHTMLEmitter             controlHtmlEmitter;

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

            overrideSettings = GetGridOverrideSettings(valueMember, actionUrl, style, tabIndex, onDataRowSelectFunction, onDataRowSelectionChangeFunctionName, value, GridDataColumnDefinitionName, hiddenColumns, pageSize, gridHeight, enableFilter, enableSorting, enableExport, pagination, serverPagination, selectOption, defaultSortField, imageSizeClass, statusProperty, cssClass);

            FillerParams fillerParams = new FillerParams(modelName, propertyName, overrideSettings, inputParam: gridParam, configKey: configKey);

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

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

            controlHtmlEmitter.Emit(out controlHtmlString);
            return(MvcHtmlString.Create(controlHtmlString));
        }
Example #5
0
        public override void Fill(GridPropertyBag propertyBag, FillerParams fillerParam)
        {
            propertyBag.ControlName = fillerParam.ControlName;

            IControlDefaultPropertyBag controlDefault = ReadDefaultConfiguration(ControlNames.BallyGrid);

            if (controlDefault != null)
            {
                propertyBag.CssClass = controlDefault.CssClass;
                propertyBag.ValidationErrorCssClass = controlDefault.ValidationErrorCssClass;
                propertyBag.ControlErrorCssClass    = controlDefault.ControlErrorCssClass;
            }
        }
Example #6
0
 public static string GetGridControlColumnsProperties(GridPropertyBag gridProperty)
 {
     StringBuilder json = new StringBuilder();
     foreach (DataGridColumDefinition item in gridProperty.GridDataColumnDefinition.DataGridColumnDefinition)
     {
         if (gridProperty.HiddenColumnsList == null || false == gridProperty.HiddenColumnsList.Contains(item.ColumnName))
         {
             json.AppendFormat(@"{0},{1},{2},{3},{4},{5},{6}|",
             item.DisplayMember,
             item.ColumnDataType,
             ControlLibraryConfig.ResourceService.GetLiteral(item.HeaderName),
             item.SearchType,
             item.Alignment,
             item.Width, item.IsSortable.ToString().ToLower());
         }
     }
     return json.ToString();
 }
Example #7
0
        public static string GetGridControlColumnsProperties(GridPropertyBag gridProperty)
        {
            StringBuilder json = new StringBuilder();

            foreach (DataGridColumDefinition item in gridProperty.GridDataColumnDefinition.DataGridColumnDefinition)
            {
                if (gridProperty.HiddenColumnsList == null || false == gridProperty.HiddenColumnsList.Contains(item.ColumnName))
                {
                    json.AppendFormat(@"{0},{1},{2},{3},{4},{5},{6}|",
                                      item.DisplayMember,
                                      item.ColumnDataType,
                                      ControlLibraryConfig.ResourceService.GetLiteral(item.HeaderName),
                                      item.SearchType,
                                      item.Alignment,
                                      item.Width, item.IsSortable.ToString().ToLower());
                }
            }
            return(json.ToString());
        }
        public override void Fill(GridPropertyBag 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);
            }
        }
Example #9
0
 public GridHTMLEmitter(string value, GridPropertyBag propertyBag)
     : base(propertyBag.Validators, propertyBag.Mandatory)
 {
     this._propertyBag = propertyBag;
     this.Value        = value;
 }
Example #10
0
        public override void Fill(GridPropertyBag propertyBag, FillerParams fillerParam)
        {
            propertyBag.ControlName = fillerParam.ControlName;

            IControlDefaultPropertyBag controlDefault = ReadDefaultConfiguration(ControlNames.BallyGrid);
            if (controlDefault != null)
            {
                propertyBag.CssClass = controlDefault.CssClass;
                propertyBag.ValidationErrorCssClass = controlDefault.ValidationErrorCssClass;
                propertyBag.ControlErrorCssClass = controlDefault.ControlErrorCssClass;
            }
        }
Example #11
0
 public virtual void Fill(GridPropertyBag propertyBag, FillerParams fillerParams)
 {
 }
Example #12
0
 public GridHTMLEmitter(string value, GridPropertyBag propertyBag)
     : base(propertyBag.Validators, propertyBag.Mandatory)
 {
     this._propertyBag = propertyBag;
     this.Value = value;
 }
Example #13
0
 public override void Fill(GridPropertyBag propertyBag, FillerParams fillerParams)
 {
     fillValidators(propertyBag, fillerParams);
 }
        public override void Fill(GridPropertyBag propertyBag, FillerParams fillerParams)
        {
            //Filling implementation code
            if (fillerParams.OverrideSettings != null && fillerParams.OverrideSettings.Count > 0)
            {
                propertyBag.TabIndex = Convert.ToInt16(fillerParams.OverrideSettings[ControlLibConstants.TAB_INDEX]);
                propertyBag.OnDataRowSelectFunction = fillerParams.OverrideSettings[ControlLibConstants.ON_DATAROW_SELECT_FUNCTION];
                propertyBag.OnDataRowSelectionChangeFunctionName = fillerParams.OverrideSettings[ControlLibConstants.ON_DATAROW_SELECTION_CHANGE_FN];
                propertyBag.GridDataColumnDefinitionName         = fillerParams.OverrideSettings[ControlLibConstants.GRID_DATACOLUMN_DEFINITION_NAME];
                propertyBag.ActionUrl   = fillerParams.OverrideSettings[ControlLibConstants.ACTION_URL];
                propertyBag.ValueMember = fillerParams.OverrideSettings[ControlLibConstants.VALUE_MEMBER];

                propertyBag.GridParam = fillerParams.InputParam;

                propertyBag.GridProperties = new GridBehaviourPropertyBag(
                    Convert.ToInt16(fillerParams.OverrideSettings[ControlLibConstants.PAGESIZE]),
                    Convert.ToInt16(fillerParams.OverrideSettings[ControlLibConstants.GRIDHEIGHT]),
                    Convert.ToBoolean(fillerParams.OverrideSettings[ControlLibConstants.ENABLEFILTER]),
                    Convert.ToBoolean(fillerParams.OverrideSettings[ControlLibConstants.ENABLESORTING]),
                    Convert.ToBoolean(fillerParams.OverrideSettings[ControlLibConstants.ENABLEEXPORT]),
                    Convert.ToBoolean(fillerParams.OverrideSettings[ControlLibConstants.ENABLEPAGINATION]),
                    Convert.ToBoolean(fillerParams.OverrideSettings[ControlLibConstants.SERVERPAGINATION]),
                    Convert.ToBoolean(fillerParams.OverrideSettings[ControlLibConstants.SELECTOPTION]),
                    fillerParams.OverrideSettings[ControlLibConstants.DEFAULTSORTFIELD],
                    fillerParams.OverrideSettings[ControlLibConstants.IMAGESIZEPROPERTY],
                    fillerParams.OverrideSettings[ControlLibConstants.STATUSPROPERTY]);

                propertyBag.GridDataColumnDefinition = ControlLibraryConfig.ControlConfigReader.GetGridDataColumnDefinition(propertyBag.GridDataColumnDefinitionName);
                if (propertyBag.GridDataColumnDefinition != null && propertyBag.GridDataColumnDefinition.DataGridColumnDefinition != null && propertyBag.GridDataColumnDefinition.DataGridColumnDefinition.Count > 0)
                {
                    foreach (DataGridColumDefinition item in propertyBag.GridDataColumnDefinition.DataGridColumnDefinition)
                    {
                        if (!string.IsNullOrEmpty(item.AccessPolicyCode))
                        {
                            if (propertyBag.HiddenColumnsList == null)
                            {
                                propertyBag.HiddenColumnsList = new List <string>();
                            }

                            if (!this.IsAuthorized(item.AccessPolicyCode))
                            {
                                propertyBag.HiddenColumnsList.Add(item.ColumnName);
                            }
                        }
                    }

                    if (false == string.IsNullOrEmpty(fillerParams.OverrideSettings[ControlLibConstants.HIDEN_COUMN]))
                    {
                        if (propertyBag.HiddenColumnsList == null)
                        {
                            propertyBag.HiddenColumnsList = new List <string>();
                        }

                        foreach (var hcol in fillerParams.OverrideSettings[ControlLibConstants.HIDEN_COUMN].Split(','))
                        {
                            propertyBag.HiddenColumnsList.Add(hcol.Trim());
                        }
                    }
                }

                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;
                }
            }
            propertyBag.ReadOnly = fillerParams.IsReadOnly.HasValue ? fillerParams.IsReadOnly.Value : propertyBag.ReadOnly;
            propertyBag.Enabled  = fillerParams.IsEnabled.HasValue ? fillerParams.IsEnabled.Value : propertyBag.Enabled;
            SetVisibility(propertyBag, fillerParams);
        }
Example #15
0
 public virtual void Fill(GridPropertyBag propertyBag, FillerParams fillerParams) { }
 public override void Fill(GridPropertyBag propertyBag, FillerParams fillerParams)
 {
     fillValidators(propertyBag, fillerParams);
 }
        public override void Fill(GridPropertyBag propertyBag, FillerParams fillerParams)
        {
            //Filling implementation code
            if (fillerParams.OverrideSettings != null && fillerParams.OverrideSettings.Count > 0)
            {
                propertyBag.TabIndex = Convert.ToInt16(fillerParams.OverrideSettings[ControlLibConstants.TAB_INDEX]);
                propertyBag.OnDataRowSelectFunction = fillerParams.OverrideSettings[ControlLibConstants.ON_DATAROW_SELECT_FUNCTION];
                propertyBag.OnDataRowSelectionChangeFunctionName = fillerParams.OverrideSettings[ControlLibConstants.ON_DATAROW_SELECTION_CHANGE_FN];
                propertyBag.GridDataColumnDefinitionName = fillerParams.OverrideSettings[ControlLibConstants.GRID_DATACOLUMN_DEFINITION_NAME];
                propertyBag.ActionUrl = fillerParams.OverrideSettings[ControlLibConstants.ACTION_URL];
                propertyBag.ValueMember = fillerParams.OverrideSettings[ControlLibConstants.VALUE_MEMBER];

                propertyBag.GridParam = fillerParams.InputParam;

                propertyBag.GridProperties = new GridBehaviourPropertyBag(
                    Convert.ToInt16(fillerParams.OverrideSettings[ControlLibConstants.PAGESIZE]),
                Convert.ToInt16(fillerParams.OverrideSettings[ControlLibConstants.GRIDHEIGHT]),
                Convert.ToBoolean(fillerParams.OverrideSettings[ControlLibConstants.ENABLEFILTER]),
                Convert.ToBoolean(fillerParams.OverrideSettings[ControlLibConstants.ENABLESORTING]),
                Convert.ToBoolean(fillerParams.OverrideSettings[ControlLibConstants.ENABLEEXPORT]),
                Convert.ToBoolean(fillerParams.OverrideSettings[ControlLibConstants.ENABLEPAGINATION]),
                Convert.ToBoolean(fillerParams.OverrideSettings[ControlLibConstants.SERVERPAGINATION]),
                Convert.ToBoolean(fillerParams.OverrideSettings[ControlLibConstants.SELECTOPTION]),
                fillerParams.OverrideSettings[ControlLibConstants.DEFAULTSORTFIELD],
                fillerParams.OverrideSettings[ControlLibConstants.IMAGESIZEPROPERTY],
                fillerParams.OverrideSettings[ControlLibConstants.STATUSPROPERTY]);

                propertyBag.GridDataColumnDefinition = ControlLibraryConfig.ControlConfigReader.GetGridDataColumnDefinition(propertyBag.GridDataColumnDefinitionName);
                if (propertyBag.GridDataColumnDefinition != null && propertyBag.GridDataColumnDefinition.DataGridColumnDefinition != null && propertyBag.GridDataColumnDefinition.DataGridColumnDefinition.Count > 0)
                {
                    foreach (DataGridColumDefinition item in propertyBag.GridDataColumnDefinition.DataGridColumnDefinition)
                    {
                        if (!string.IsNullOrEmpty(item.AccessPolicyCode))
                        {
                            if (propertyBag.HiddenColumnsList == null)
                            {
                                propertyBag.HiddenColumnsList = new List<string>();
                            }

                            if (!this.IsAuthorized(item.AccessPolicyCode))
                            {
                                propertyBag.HiddenColumnsList.Add(item.ColumnName);
                            }
                        }
                    }

                    if (false == string.IsNullOrEmpty(fillerParams.OverrideSettings[ControlLibConstants.HIDEN_COUMN]))
                    {
                        if (propertyBag.HiddenColumnsList == null)
                        {
                            propertyBag.HiddenColumnsList = new List<string>();
                        }

                        foreach (var hcol in fillerParams.OverrideSettings[ControlLibConstants.HIDEN_COUMN].Split(','))
                        {
                            propertyBag.HiddenColumnsList.Add(hcol.Trim());
                        }
                    }
                }

                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;
                }
            }
            propertyBag.ReadOnly = fillerParams.IsReadOnly.HasValue ? fillerParams.IsReadOnly.Value : propertyBag.ReadOnly;
            propertyBag.Enabled = fillerParams.IsEnabled.HasValue ? fillerParams.IsEnabled.Value : propertyBag.Enabled;
            SetVisibility(propertyBag, fillerParams);
        }