예제 #1
0
        /// <summary>
        /// Creates list of properties of selected ResourceType
        /// </summary>
        /// <returns>List of properties of Resource</returns>
        private Collection <ScalarProperty> GetResourceProperties()
        {
            Collection <ScalarProperty> scalarProperties = null;

            if (!this.DesignMode)
            {
                using (ResourceDataAccess dataAccess = new ResourceDataAccess(this.CreateContext()))
                {
                    scalarProperties = dataAccess.GetScalarProperties(this.Page.Cache, EntityType);
                }
            }

            if (scalarProperties != null)
            {
                //Since ID property and properties having data type is binary should not be exposed, remove it from the property list
                List <ScalarProperty> removeProperties = scalarProperties.Where(
                    property => property.Name.Equals(_PropertyId,
                                                     StringComparison.OrdinalIgnoreCase) || property.DataType == DataTypes.Binary).ToList();

                foreach (ScalarProperty property in removeProperties)
                {
                    scalarProperties.Remove(property);
                }
            }

            return(scalarProperties);
        }
예제 #2
0
        /// <summary>
        /// Adds columns to be displayed in the column collection.
        /// </summary>
        protected override void AddDisplayColumns()
        {
            if (!this.DesignMode)
            {
                Collection <ScalarProperty> propertyList = null;
                using (ResourceDataAccess dataAccess = new ResourceDataAccess(this.CreateContext()))
                {
                    propertyList = dataAccess.GetScalarProperties(this.Page.Cache, EntityType);
                }

                //Add View Column.
                if (!string.IsNullOrEmpty(ViewColumn))
                {
                    AddViewColumn(propertyList);
                }

                //If user column list is been provided.
                if (DisplayColumns != null && DisplayColumns.Count > 0)
                {
                    AddCustomColumns(propertyList);
                }
                else
                {
                    //Add default columns based on Resource type
                    AddDefaultColumns(propertyList);
                }
            }
            else
            {
                //Add View Column
                base.AddViewColumn(GlobalResource.TitleText, GlobalResource.TitleText,
                                   GlobalResource.TitleText);
            }
        }