Beispiel #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        EntityPage entityPage = Page as EntityPage;

        if (entityPage != null)
        {
            Type entityType = Type.GetType(entityPage.EntityTypeName);

            object[] temp = entityType.GetCustomAttributes(true);
            object[] entityArAttributes = entityType.GetCustomAttributes(typeof(ActiveRecordAttribute), true);
            if (entityArAttributes.Length > 0)
            {
                ActiveRecordAttribute arAttribute = (ActiveRecordAttribute)entityArAttributes[0];
                EntityDisplayName = arAttribute.Table;

                KeyAlias          = GroupInfo.GetTableKeyField(arAttribute.Table);
                ColumnAlias       = KeyAlias;
                ColumnDisplayName = KeyAlias;
            }

            EntityDisplayName = entityType.GetPluralDisplayName();

            object[] entityDisplayAttributes = entityType.GetCustomAttributes(typeof(DisplayValuePropertyNameAttribute), true);
            if (entityDisplayAttributes.Length > 0)
            {
                DisplayValuePropertyNameAttribute displayAttribute = (DisplayValuePropertyNameAttribute)entityDisplayAttributes[0];
                PropertyInfo displayProperty = entityType.GetProperty(displayAttribute.PropertyName);
                if (displayProperty != null)
                {
                    object[] propertyAttributes = displayProperty.GetCustomAttributes(typeof(FieldAttribute), true);
                    if (propertyAttributes.Length > 0)
                    {
                        FieldAttribute fieldAttribute = (FieldAttribute)propertyAttributes[0];
                        ColumnAlias       = fieldAttribute.Field.ToUpper();
                        ColumnDisplayName = fieldAttribute.Field.ToUpper();
                    }
                }
            }
        }

        StringBuilder resources = new StringBuilder();

        resources.AppendFormat("Sage.TaskPane.GroupListTasklet.Resources = {0};", JsonConvert.SerializeObject(new ClientResourcesRepresentation(this)));

        ScriptManager.RegisterStartupScript(Page, typeof(Page), "taskpane-grouplist-resources", resources.ToString(), true);

        /*
         * ScriptManager.RegisterClientScriptInclude(Page, typeof(Control), "Ext_BufferedGridView", ResolveUrl("~/Libraries/Ext3/ux/widgets/grid/BufferedGridView.js"));
         * ScriptManager.RegisterClientScriptInclude(Page, typeof(Control), "Ext_BufferedRowSelectionModel", ResolveUrl("~/Libraries/Ext3/ux/widgets/grid/BufferedRowSelectionModel.js"));
         * ScriptManager.RegisterClientScriptInclude(Page, typeof(Control), "Ext_BufferedStore", ResolveUrl("~/Libraries/Ext3/ux/widgets/grid/BufferedStore.js"));
         * ScriptManager.RegisterClientScriptInclude(Page, typeof(Control), "Ext_BufferedGridToolbar", ResolveUrl("~/Libraries/Ext3/ux/widgets/BufferedGridToolbar.js"));
         * ScriptManager.RegisterClientScriptInclude(Page, typeof(Control), "Ext_BufferedJsonReader", ResolveUrl("~/Libraries/Ext3/ux/data/BufferedJsonReader.js"));
         */
    }
Beispiel #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        EntityPage entityPage = Page as EntityPage;

        if (entityPage != null)
        {
            Type entityType = Type.GetType(entityPage.EntityTypeName, true);

            object[] temp = entityType.GetCustomAttributes(true);
            object[] entityArAttributes = entityType.GetCustomAttributes(typeof(ActiveRecordAttribute), true);
            if (entityArAttributes.Length > 0)
            {
                ActiveRecordAttribute arAttribute = (ActiveRecordAttribute)entityArAttributes[0];
                EntityDisplayName = arAttribute.Table;

                KeyAlias          = GroupInfo.GetTableKeyField(arAttribute.Table);
                ColumnAlias       = KeyAlias;
                ColumnDisplayName = KeyAlias;
            }

            EntityDisplayName = entityType.GetPluralDisplayName();

            object[] entityDisplayAttributes = entityType.GetCustomAttributes(typeof(DisplayValuePropertyNameAttribute), true);
            if (entityDisplayAttributes.Length > 0)
            {
                DisplayValuePropertyNameAttribute displayAttribute = (DisplayValuePropertyNameAttribute)entityDisplayAttributes[0];
                PropertyInfo displayProperty = entityType.GetProperty(displayAttribute.PropertyName);
                if (displayProperty != null)
                {
                    object[] propertyAttributes = displayProperty.GetCustomAttributes(typeof(FieldAttribute), true);
                    if (propertyAttributes.Length > 0)
                    {
                        FieldAttribute fieldAttribute = (FieldAttribute)propertyAttributes[0];
                        ColumnAlias       = fieldAttribute.Field.ToUpper();
                        ColumnDisplayName = fieldAttribute.Field.ToUpper();
                    }
                }
            }
        }
    }