当前位置: 首页>>代码示例>>C#>>正文


C# FormInfo.AddFormCategory方法代码示例

本文整理汇总了C#中FormInfo.AddFormCategory方法的典型用法代码示例。如果您正苦于以下问题:C# FormInfo.AddFormCategory方法的具体用法?C# FormInfo.AddFormCategory怎么用?C# FormInfo.AddFormCategory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FormInfo的用法示例。


在下文中一共展示了FormInfo.AddFormCategory方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InitActivityRuleControls


//.........这里部分代码省略.........

                        // Set detailed caption
                        captionKey = "activityitem." + activityType;
                        caption = GetString(captionKey);
                        if (!caption.Equals(captionKey, StringComparison.InvariantCultureIgnoreCase))
                        {
                            ffi.Caption = caption;
                        }
                    }
                    else if (String.Compare(ffi.Name, "ActivityItemDetailID", true) == 0)
                    {
                        if (ati.ActivityTypeDetailFormControl == null)
                        {
                            continue;
                        }

                        if (ati.ActivityTypeDetailFormControl != String.Empty)
                        {
                            // Check if user defined control exists
                            FormUserControlInfo fui = FormUserControlInfoProvider.GetFormUserControlInfo(ati.ActivityTypeDetailFormControl);
                            if (fui != null)
                            {
                                controlName = ati.ActivityTypeDetailFormControl;
                            }
                        }

                        // Set detailed caption
                        captionKey = "activityitemdetail." + activityType;
                        caption = GetString(captionKey);
                        if (!caption.Equals(captionKey, StringComparison.InvariantCultureIgnoreCase))
                        {
                            ffi.Caption = caption;
                        }
                    }
                    else if (String.Compare(ffi.Name, "ActivityNodeID", true) == 0)
                    {
                        // Document selector for NodeID
                        controlName = "selectdocument";
                    }
                    else if (String.Compare(ffi.Name, "ActivityCulture", true) == 0)
                    {
                        // Culture selector for culture
                        controlName = "sitecultureselector";
                    }
                    else if (String.Compare(ffi.Name, "ActivityValue", true) == 0)
                    {
                        // Show activity value only for relevant activity types
                        if (!ati.ActivityTypeIsCustom && (showActivityValueFor.IndexOf("|" + activityType + "|",  StringComparison.InvariantCultureIgnoreCase) < 0))
                        {
                            continue;
                        }
                    }

                    if (controlName != null)
                    {
                        // SKU selector for product
                        ffi.Settings["controlname"] = controlName;
                        if (String.Compare(controlName, "skuselector", StringComparison.InvariantCultureIgnoreCase) == 0)
                        {
                            ffi.Settings["allowempty"] = true;
                        }
                    }

                    // Ensure the category
                    if (newCategory != null)
                    {
                        fi.AddFormCategory(newCategory);

                        newCategory = null;

                        // // Extra fields at the beginning
                        if (!extraFieldsAtEnd && (additionalFieldsForm != null))
                        {
                            AddExtraFields(ignoredColumns, fi, additionalFieldsForm);

                            additionalFieldsForm = null;
                        }
                    }

                    fi.AddFormField(ffi);
                }
            }
        }

        // Extra fields at end
        if (extraFieldsAtEnd && (additionalFieldsForm != null))
        {
            // Ensure the category for extra fields
            if (newCategory != null)
            {
                fi.AddFormCategory(newCategory);

                newCategory = null;
            }

            AddExtraFields(ignoredColumns, fi, additionalFieldsForm);
        }

        LoadForm(activityFormCondition, fi, activityType);
    }
开发者ID:KuduApps,项目名称:Kentico,代码行数:101,代码来源:Edit.ascx.cs

示例2: InitActivitySettings

    /// <summary>
    /// Initializes controls for activity rule.
    /// </summary>
    /// <param name="selectedActivity">Activity selected in drop-down menu</param>
    private void InitActivitySettings(string selectedActivity)
    {
        // Init activity selector from  edited object if any
        LoadEditedActivityRule(ref selectedActivity);

        string[] ignoredColumns =
        {
            "activitytype",
            "activitysiteid",
            "activityguid",
            "activityactivecontactid",
            "activityoriginalcontactid",
            "pagevisitid",
            "pagevisitactivityid",
            "searchid",
            "searchactivityid"
        };

        string[] activitiesWithValue =
        {
            PredefinedActivityType.PURCHASE,
            PredefinedActivityType.PURCHASEDPRODUCT,
            PredefinedActivityType.RATING,
            PredefinedActivityType.POLL_VOTING,
            PredefinedActivityType.PRODUCT_ADDED_TO_SHOPPINGCART
        };

        // Get columns from OM_Activity (i.e. base table for all activities)
        ActivityTypeInfo ati = ActivityTypeInfoProvider.GetActivityTypeInfo(selectedActivity);
        var fi = new FormInfo();

        // Get columns from additional table (if any) according to selected activity type
        bool extraFieldsAtEnd = true;
        FormInfo additionalFieldsForm = GetActivityAdditionalFields(selectedActivity, ref extraFieldsAtEnd);

        // Get the activity form elements
        FormInfo filterFieldsForm = FormHelper.GetFormInfo(ActivityInfo.OBJECT_TYPE, true);
        IList<IField> elements = filterFieldsForm.GetFormElements(true, false);

        FormCategoryInfo newCategory = null;

        foreach (IField elem in elements)
        {
            if (elem is FormCategoryInfo)
            {
                // Form category
                newCategory = (FormCategoryInfo)elem;
            }
            else if (elem is FormFieldInfo)
            {
                // Form field
                var ffi = (FormFieldInfo)elem;

                // Skip ignored columns
                if (ignoredColumns.Contains(ffi.Name.ToLowerCSafe()))
                {
                    continue;
                }

                if ((!ffi.PrimaryKey) && (fi.GetFormField(ffi.Name) == null))
                {
                    // Skip fields with Guid data type
                    if (ffi.DataType == FieldDataType.Guid)
                    {
                        continue;
                    }

                    // Sets control name based on given datatype of field. Can be overwritten if more proper control is available
                    string controlName = GetControlNameForFieldDataType(ffi);
                    if (!GetControlNameForActivities(ffi, ati, selectedActivity, activitiesWithValue, ref controlName))
                    {
                        continue;
                    }

                    if (controlName != null)
                    {
                        // SKU selector for product
                        ffi.Settings["controlname"] = controlName;
                        ffi.Settings["allowempty"] = controlName.EqualsCSafe("skuselector", true);
                    }

                    // Ensure the category
                    if (newCategory != null)
                    {
                        fi.AddFormCategory(newCategory);
                        newCategory = null;

                        // Extra fields at the beginning
                        if ((!extraFieldsAtEnd) && (additionalFieldsForm != null))
                        {
                            AddExtraActivityFields(ignoredColumns, fi, additionalFieldsForm);
                            additionalFieldsForm = null;
                        }
                    }

                    fi.AddFormItem(ffi);
//.........这里部分代码省略.........
开发者ID:arvind-web-developer,项目名称:csharp-projects-Jemena-Kentico-CMS,代码行数:101,代码来源:Edit.ascx.cs


注:本文中的FormInfo.AddFormCategory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。