Ejemplo n.º 1
0
 public NodeInfo()
 {
     NodeId                  = 0;
     NodeName                = string.Empty;
     NodeType                = ENodeType.BackgroundNormalNode;
     PublishmentSystemId     = 0;
     _contentModelId         = EContentModelTypeUtils.GetValue(EContentModelType.Content);
     ParentId                = 0;
     ParentsPath             = string.Empty;
     ParentsCount            = 0;
     ChildrenCount           = 0;
     IsLastNode              = false;
     NodeIndexName           = string.Empty;
     NodeGroupNameCollection = string.Empty;
     Taxis               = 0;
     AddDate             = DateTime.Now;
     ImageUrl            = string.Empty;
     Content             = string.Empty;
     ContentNum          = 0;
     FilePath            = string.Empty;
     ChannelFilePathRule = string.Empty;
     ContentFilePathRule = string.Empty;
     LinkUrl             = string.Empty;
     LinkType            = ELinkType.LinkNoRelatedToChannelAndContent;
     ChannelTemplateId   = 0;
     ContentTemplateId   = 0;
     Keywords            = string.Empty;
     Description         = string.Empty;
     _extendValues       = string.Empty;
 }
Ejemplo n.º 2
0
        private int Validate_PublishmentSystemInfo(out string errorMessage)
        {
            try
            {
                var isHq = TranslateUtils.ToBool(IsHeadquarters.SelectedValue); // 是否主站
                var parentPublishmentSystemId = 0;
                var publishmentSystemDir      = string.Empty;

                if (isHq == false)
                {
                    if (DirectoryUtils.IsSystemDirectory(PublishmentSystemDir.Text))
                    {
                        errorMessage = "文件夹名称不能为系统文件夹名称!";
                        return(0);
                    }

                    parentPublishmentSystemId = TranslateUtils.ToInt(ParentPublishmentSystemID.SelectedValue);
                    publishmentSystemDir      = PublishmentSystemDir.Text;

                    var list = DataProvider.NodeDao.GetLowerSystemDirList(parentPublishmentSystemId);
                    if (list.IndexOf(publishmentSystemDir.ToLower()) != -1)
                    {
                        errorMessage = "已存在相同的发布路径!";
                        return(0);
                    }

                    if (!DirectoryUtils.IsDirectoryNameCompliant(publishmentSystemDir))
                    {
                        errorMessage = "文件夹名称不符合系统要求!";
                        return(0);
                    }
                }

                var nodeInfo = new NodeInfo();

                nodeInfo.NodeName       = nodeInfo.NodeIndexName = "首页";
                nodeInfo.NodeType       = ENodeType.BackgroundPublishNode;
                nodeInfo.ContentModelId = EContentModelTypeUtils.GetValue(EContentModelTypeUtils.GetEnumTypeByPublishmentSystemType(_publishmentSystemType));

                var publishmentSystemUrl = PageUtils.Combine(WebConfigUtils.ApplicationPath, publishmentSystemDir);

                var psInfo = BaseTable.GetDefaultPublishmentSystemInfo(PageUtils.FilterXss(PublishmentSystemName.Text), _publishmentSystemType, AuxiliaryTableForContent.SelectedValue, AuxiliaryTableForGovPublic.SelectedValue, AuxiliaryTableForGovInteract.SelectedValue, AuxiliaryTableForVote.SelectedValue, AuxiliaryTableForJob.SelectedValue, publishmentSystemDir, publishmentSystemUrl, parentPublishmentSystemId);

                if (psInfo.ParentPublishmentSystemId > 0)
                {
                    var parentPublishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(psInfo.ParentPublishmentSystemId);
                    psInfo.PublishmentSystemUrl = PageUtils.Combine(parentPublishmentSystemInfo.PublishmentSystemUrl, psInfo.PublishmentSystemDir);
                }

                psInfo.IsHeadquarters = isHq;

                psInfo.Additional.Charset     = Charset.SelectedValue;
                psInfo.IsCheckContentUseLevel = TranslateUtils.ToBool(IsCheckContentUseLevel.SelectedValue);
                if (psInfo.IsCheckContentUseLevel)
                {
                    psInfo.CheckContentLevel = TranslateUtils.ToInt(CheckContentLevel.SelectedValue);
                }

                var thePublishmentSystemId = DataProvider.NodeDao.InsertPublishmentSystemInfo(nodeInfo, psInfo, Body.AdministratorName);

                if (_permissions.IsSystemAdministrator && !_permissions.IsConsoleAdministrator)
                {
                    var publishmentSystemIdList = ProductPermissionsManager.Current.PublishmentSystemIdList ?? new List <int>();
                    publishmentSystemIdList.Add(thePublishmentSystemId);
                    BaiRongDataProvider.AdministratorDao.UpdatePublishmentSystemIdCollection(Body.AdministratorName, TranslateUtils.ObjectCollectionToString(publishmentSystemIdList));
                }

                Body.AddAdminLog($"新建{EPublishmentSystemTypeUtils.GetText(_publishmentSystemType)}站点", $"站点名称:{PageUtils.FilterXss(PublishmentSystemName.Text)}");

                //if (isHQ == EBoolean.False)
                //{
                //    string configFilePath = PathUtility.MapPath(psInfo, "@/web.config");
                //    if (FileUtils.IsFileExists(configFilePath))
                //    {
                //        FileUtility.UpdateWebConfig(configFilePath, psInfo.Additional.Charset);
                //    }
                //    else
                //    {
                //        FileUtility.CreateWebConfig(configFilePath, psInfo.Additional.Charset);
                //    }
                //}
                errorMessage = string.Empty;
                return(thePublishmentSystemId);
            }
            catch (Exception e)
            {
                errorMessage = e.Message;
                return(0);
            }
        }
Ejemplo n.º 3
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            var isChanged = false;

            try
            {
                if (_channelId == 0)
                {
                    var parentId = TranslateUtils.ToInt(ParentID.SelectedValue);
                    if (parentId == 0)
                    {
                        parentId = PublishmentSystemInfo.Additional.GovInteractNodeId;
                    }
                    var nodeId = DataProvider.NodeDao.InsertNodeInfo(PublishmentSystemId, parentId, ChannelName.Text, string.Empty, EContentModelTypeUtils.GetValue(EContentModelType.GovInteract));

                    var channelInfo = new GovInteractChannelInfo(nodeId, PublishmentSystemId, 0, 0, string.Empty, Summary.Text);

                    DataProvider.GovInteractChannelDao.Insert(channelInfo);
                }
                else
                {
                    var nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, _channelId);
                    nodeInfo.NodeName = ChannelName.Text;
                    DataProvider.NodeDao.UpdateNodeInfo(nodeInfo);

                    var channelInfo = DataProvider.GovInteractChannelDao.GetChannelInfo(PublishmentSystemId, _channelId);
                    if (channelInfo == null)
                    {
                        channelInfo = new GovInteractChannelInfo(_channelId, PublishmentSystemId, 0, 0, string.Empty, Summary.Text);
                        DataProvider.GovInteractChannelDao.Insert(channelInfo);
                    }
                    else
                    {
                        channelInfo.Summary = Summary.Text;
                        DataProvider.GovInteractChannelDao.Update(channelInfo);
                    }
                }

                Body.AddAdminLog("维护分类信息");

                SuccessMessage("分类设置成功!");
                isChanged = true;
            }
            catch (Exception ex)
            {
                FailMessage(ex, "分类设置失败!");
            }

            if (isChanged)
            {
                PageUtils.CloseModalPageAndRedirect(Page, _returnUrl);
            }
        }
Ejemplo n.º 4
0
        public int GetNodeIdByInteractName(int publishmentSystemId, string interactName)
        {
            string sqlString =
                $"SELECT wcm_GovInteractChannel.NodeID FROM wcm_GovInteractChannel INNER JOIN siteserver_Node ON wcm_GovInteractChannel.NodeID = siteserver_Node.NodeID and siteserver_Node.PublishmentSystemID = {publishmentSystemId} AND siteserver_Node.ContentModelID = '{EContentModelTypeUtils.GetValue(EContentModelType.GovInteract)}' AND siteserver_Node.NodeName = @NodeName";

            var selectParms = new IDataParameter[]
            {
                GetParameter("@NodeName", EDataType.NVarChar, 255, interactName)
            };

            return(BaiRongDataProvider.DatabaseDao.GetIntResult(sqlString, selectParms));
        }
Ejemplo n.º 5
0
        public static void Initialize(PublishmentSystemInfo publishmentSystemInfo)
        {
            if (publishmentSystemInfo.Additional.GovPublicNodeId > 0)
            {
                if (!DataProvider.NodeDao.IsExists(publishmentSystemInfo.Additional.GovPublicNodeId))
                {
                    publishmentSystemInfo.Additional.GovPublicNodeId = 0;
                }
            }
            if (publishmentSystemInfo.Additional.GovPublicNodeId == 0)
            {
                var govPublicNodeId = DataProvider.NodeDao.GetNodeIdByContentModelType(publishmentSystemInfo.PublishmentSystemId, EContentModelType.GovPublic);
                if (govPublicNodeId == 0)
                {
                    govPublicNodeId = DataProvider.NodeDao.InsertNodeInfo(publishmentSystemInfo.PublishmentSystemId, publishmentSystemInfo.PublishmentSystemId, "信息公开", string.Empty, EContentModelTypeUtils.GetValue(EContentModelType.GovPublic));
                }
                publishmentSystemInfo.Additional.GovPublicNodeId = govPublicNodeId;
                DataProvider.PublishmentSystemDao.Update(publishmentSystemInfo);
            }

            GovPublicCategoryManager.Initialize(publishmentSystemInfo);

            if (DataProvider.GovPublicIdentifierRuleDao.GetCount(publishmentSystemInfo.PublishmentSystemId) == 0)
            {
                var ruleInfoArrayList = new ArrayList
                {
                    new GovPublicIdentifierRuleInfo(0, "机构分类代码", publishmentSystemInfo.PublishmentSystemId,
                                                    EGovPublicIdentifierType.Department, 5, "-", string.Empty, string.Empty, 0, 0, string.Empty),
                    new GovPublicIdentifierRuleInfo(0, "主题分类代码", publishmentSystemInfo.PublishmentSystemId,
                                                    EGovPublicIdentifierType.Channel, 5, "-", string.Empty, string.Empty, 0, 0, string.Empty),
                    new GovPublicIdentifierRuleInfo(0, "生效日期", publishmentSystemInfo.PublishmentSystemId,
                                                    EGovPublicIdentifierType.Attribute, 0, "-", "yyyy", GovPublicContentAttribute.EffectDate, 0, 0,
                                                    string.Empty),
                    new GovPublicIdentifierRuleInfo(0, "顺序号", publishmentSystemInfo.PublishmentSystemId,
                                                    EGovPublicIdentifierType.Sequence, 5, string.Empty, string.Empty, string.Empty, 0, 0,
                                                    string.Empty)
                };

                foreach (GovPublicIdentifierRuleInfo ruleInfo in ruleInfoArrayList)
                {
                    DataProvider.GovPublicIdentifierRuleDao.Insert(ruleInfo);
                }
            }
        }
Ejemplo n.º 6
0
 public static void Initialize(PublishmentSystemInfo publishmentSystemInfo)
 {
     if (publishmentSystemInfo.Additional.GovInteractNodeId > 0)
     {
         if (!DataProvider.NodeDao.IsExists(publishmentSystemInfo.Additional.GovInteractNodeId))
         {
             publishmentSystemInfo.Additional.GovInteractNodeId = 0;
         }
     }
     if (publishmentSystemInfo.Additional.GovInteractNodeId == 0)
     {
         var govInteractNodeId = DataProvider.NodeDao.GetNodeIdByContentModelType(publishmentSystemInfo.PublishmentSystemId, EContentModelType.GovInteract);
         if (govInteractNodeId == 0)
         {
             govInteractNodeId = DataProvider.NodeDao.InsertNodeInfo(publishmentSystemInfo.PublishmentSystemId, publishmentSystemInfo.PublishmentSystemId, "互动交流", string.Empty, EContentModelTypeUtils.GetValue(EContentModelType.GovInteract));
         }
         publishmentSystemInfo.Additional.GovInteractNodeId = govInteractNodeId;
         DataProvider.PublishmentSystemDao.Update(publishmentSystemInfo);
     }
 }