public void ContentFormSubmited(int siteId, int channelId, IContentInfo contentInfo, IDictionary <string, object> form)
        {
            var categoryChannelId    = TranslateUtils.Get <int>(form, "categoryChannelId");
            var categoryDepartmentId = TranslateUtils.Get <int>(form, "categoryDepartmentId");

            if (categoryChannelId == 0)
            {
                throw new Exception("请选择正确的主题分类");
            }
            contentInfo.ChannelId = categoryChannelId;
            if (categoryDepartmentId == 0)
            {
                throw new Exception("请选择正确的机构分类");
            }
            contentInfo.Set(ContentAttribute.DepartmentId, categoryDepartmentId.ToString());

            var classInfoList = Main.CategoryClassRepository.GetCategoryClassInfoList(siteId);

            foreach (var classInfo in classInfoList)
            {
                if (classInfo.IsSystem || !classInfo.IsEnabled)
                {
                    continue;
                }

                var attributeName  = PublicManager.GetCategoryContentAttributeName(classInfo.ClassCode);
                var attributeValue = TranslateUtils.Get <int>(form, attributeName);

                contentInfo.Set(attributeName, attributeValue.ToString());

                //if (attributeValue > 0)
                //{
                //    CategoryDao.UpdateContentNum(PublishmentSystemInfo, categoryClassInfo.ContentAttributeName, categoryId);
                //}
            }

            if (contentInfo.Id == 0)
            {
                var identifier = PublicManager.GetIdentifier(siteId, categoryChannelId,
                                                             categoryDepartmentId, contentInfo);
                contentInfo.Set(nameof(ContentAttribute.Identifier), identifier);
            }
            else
            {
                var effectDate = contentInfo.Get <DateTime>(ContentAttribute.EffectDate);
                if (string.IsNullOrEmpty(contentInfo.Get <string>(ContentAttribute.Identifier)) || PublicManager.IsIdentifierChanged(siteId, categoryChannelId, categoryDepartmentId, effectDate, contentInfo))
                {
                    var identifier = PublicManager.GetIdentifier(siteId, categoryChannelId,
                                                                 categoryDepartmentId, contentInfo);
                    contentInfo.Set(nameof(ContentAttribute.Identifier), identifier);
                }
            }
        }
        public string GetCategoriesHtml(int siteId, int channelId, IDictionary <string, object> attributes)
        {
            var pairList = new List <KeyValuePair <string, DropDownList> >();

            var ddlChannelId = new DropDownList
            {
                ID       = "categoryChannelId",
                CssClass = "form-control"
            };
            var channelIdList   = Context.ChannelApi.GetChannelIdList(siteId);
            var nodeCount       = channelIdList.Count;
            var isLastNodeArray = new bool[nodeCount];

            foreach (var theChannelId in channelIdList)
            {
                var nodeInfo = Context.ChannelApi.GetChannelInfo(siteId, theChannelId);
                var listItem = new ListItem(Utils.GetSelectOptionText(nodeInfo.ChannelName, nodeInfo.ParentsCount, nodeInfo.LastNode, isLastNodeArray),
                                            nodeInfo.Id.ToString());
                if (nodeInfo.ContentModelPluginId != Utils.PluginId)
                {
                    listItem.Value = "0";
                    listItem.Attributes.Add("disabled", "disabled");
                    listItem.Attributes.Add("style", "background-color:#f0f0f0;color:#9e9e9e");
                }
                ddlChannelId.Items.Add(listItem);
            }
            Utils.SelectSingleItem(ddlChannelId, channelId.ToString());
            pairList.Add(new KeyValuePair <string, DropDownList>("主题", ddlChannelId));

            var ddlDepartmentId = new DropDownList
            {
                ID       = "categoryDepartmentId",
                CssClass = "form-control"
            };
            var departmentIdList = DepartmentManager.GetDepartmentIdList(siteId);

            foreach (var departmentId in departmentIdList)
            {
                var departmentInfo = DepartmentManager.GetDepartmentInfo(siteId, departmentId);
                var listItem       = new ListItem(departmentInfo.DepartmentName, departmentInfo.Id.ToString());
                ddlDepartmentId.Items.Add(listItem);
            }

            Utils.SelectSingleItem(ddlDepartmentId, TranslateUtils.Get <int>(attributes, ContentAttribute.DepartmentId).ToString());
            pairList.Add(new KeyValuePair <string, DropDownList>("机构", ddlDepartmentId));


            var classInfoList = Main.CategoryClassRepository.GetCategoryClassInfoList(siteId);

            foreach (var classInfo in classInfoList)
            {
                if (classInfo.IsSystem || !classInfo.IsEnabled)
                {
                    continue;
                }

                var attributeName  = PublicManager.GetCategoryContentAttributeName(classInfo.ClassCode);
                var attributeValue = TranslateUtils.Get <string>(attributes, attributeName);

                var ddlCategoryId = new DropDownList
                {
                    ID       = attributeName,
                    CssClass = "form-control"
                };
                var categoryIdList = Main.CategoryRepository.GetCategoryIdList(siteId, classInfo.ClassCode);
                isLastNodeArray = new bool[categoryIdList.Count];
                foreach (var categoryId in categoryIdList)
                {
                    var categoryInfo = Main.CategoryRepository.GetCategoryInfo(categoryId);
                    var listItem     = new ListItem(Utils.GetSelectOptionText(categoryInfo.CategoryName, categoryInfo.ParentsCount, categoryInfo.IsLastNode, isLastNodeArray), categoryInfo.Id.ToString());
                    ddlCategoryId.Items.Add(listItem);
                }
                Utils.SelectSingleItem(ddlCategoryId, attributeValue);
                pairList.Add(new KeyValuePair <string, DropDownList>(classInfo.ClassName, ddlCategoryId));
            }

            var builder = new StringBuilder();

            builder.Append(@"<div class=""row"">");
            var count = 0;

            foreach (var keyValuePair in pairList)
            {
                if (keyValuePair.Value.Items.Count == 0)
                {
                    continue;
                }

                if (count > 1)
                {
                    builder.Append(@"</div><div class=""row m-t-10"">");
                    count = 0;
                }
                builder.Append($@"
<div class=""col-xs-2 control-label mt-2"">{keyValuePair.Key}分类</div>
<div class=""col-xs-4"">
    {Utils.GetControlRenderHtml(keyValuePair.Value)}
</div>
");
                count++;
            }
            builder.Append("</div>");

            builder.Append(@"<script>
$(document).ready(function () {
    if ($('#Publisher').val().length == 0) $('#Publisher').val($('#categoryDepartmentId').find('option:selected').text().replace(/[ │└├]/g,''));
    $('#categoryDepartmentId').change(function(){
        $('#Publisher').val($(this).children('option:selected').text().replace(/[ │└├]/g,''));
    });
    $('input[type=""radio""][name=""IsAbolition""]').change(function(){
        var isAbolition = $('input[type=""radio""][name=""IsAbolition""]:checked').val();
        isAbolition == 'True' ? $('#AbolitionDate').parent().parent().show() : $('#AbolitionDate').parent().parent().hide();
    });
    var isAbolition = $('input[type=""radio""][name=""IsAbolition""]:checked').val();
    isAbolition == 'True' ? $('#AbolitionDate').parent().parent().show() : $('#AbolitionDate').parent().parent().hide();
});
</script>");

            return(builder.ToString());
        }