Пример #1
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            var isIncludeChildren = TranslateUtils.ToBool(DdlIsIncludeChildren.SelectedValue);
            var isCreateContents  = TranslateUtils.ToBool(DdlIsCreateContents.SelectedValue);

            foreach (var channelId in TranslateUtils.StringCollectionToIntList(_channelIdCollection))
            {
                CreateManager.CreateChannel(SiteId, channelId);
                if (isCreateContents)
                {
                    CreateManager.CreateAllContent(SiteId, channelId);
                }
                if (isIncludeChildren)
                {
                    foreach (var childChannelId in DataProvider.ChannelDao.GetIdListForDescendant(channelId))
                    {
                        CreateManager.CreateChannel(SiteId, childChannelId);
                        if (isCreateContents)
                        {
                            CreateManager.CreateAllContent(SiteId, channelId);
                        }
                    }
                }
            }

            LayerUtils.CloseAndOpenPageCreateStatus(Page);
        }
Пример #2
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            var isIncludeChildren = TranslateUtils.ToBool(IsIncludeChildren.SelectedValue);
            var isCreateContents  = TranslateUtils.ToBool(IsCreateContents.SelectedValue);

            foreach (var channelID in TranslateUtils.StringCollectionToIntList(_channelIdCollection))
            {
                CreateManager.CreateChannel(PublishmentSystemId, channelID);
                if (isCreateContents)
                {
                    CreateManager.CreateAllContent(PublishmentSystemId, channelID);
                }
                if (isIncludeChildren)
                {
                    foreach (int childChannelID in DataProvider.NodeDao.GetNodeIdListForDescendant(channelID))
                    {
                        CreateManager.CreateChannel(PublishmentSystemId, childChannelID);
                        if (isCreateContents)
                        {
                            CreateManager.CreateAllContent(PublishmentSystemId, channelID);
                        }
                    }
                }
            }

            PageUtils.CloseModalPageWithoutRefresh(Page);
        }
Пример #3
0
        private void ProcessCreateContent(ICollection nodeIdArrayList)
        {
            if (nodeIdArrayList.Count == 0)
            {
                FailMessage("请首先选中希望生成内容页面的栏目!");
                return;
            }

            foreach (int nodeId in nodeIdArrayList)
            {
                CreateManager.CreateAllContent(PublishmentSystemId, nodeId);
            }

            PageCreateStatus.Redirect(PublishmentSystemId);
        }
        public IHttpActionResult Create([FromBody] CreateParameter parameter)
        {
            try
            {
                var request = new AuthenticatedRequest();
                if (!request.IsAdminLoggin ||
                    !request.AdminPermissionsImpl.HasSitePermissions(parameter.SiteId, ConfigManager.WebSitePermissions.Create))
                {
                    return(Unauthorized());
                }

                var selectedChannelIdList = new List <int>();

                if (parameter.IsAllChecked)
                {
                    selectedChannelIdList = ChannelManager.GetChannelIdList(parameter.SiteId);
                }
                else if (parameter.IsDescendent)
                {
                    foreach (var channelId in parameter.ChannelIdList)
                    {
                        selectedChannelIdList.Add(channelId);

                        var channelInfo = ChannelManager.GetChannelInfo(parameter.SiteId, channelId);
                        if (channelInfo.ChildrenCount > 0)
                        {
                            var descendentIdList = ChannelManager.GetChannelIdList(channelInfo, EScopeType.Descendant);
                            foreach (var descendentId in descendentIdList)
                            {
                                if (selectedChannelIdList.Contains(descendentId))
                                {
                                    continue;
                                }

                                selectedChannelIdList.Add(descendentId);
                            }
                        }
                    }
                }
                else
                {
                    selectedChannelIdList.AddRange(parameter.ChannelIdList);
                }

                var channelIdList = new List <int>();

                if (parameter.Scope == "1month" || parameter.Scope == "1day" || parameter.Scope == "2hours")
                {
                    var siteInfo  = SiteManager.GetSiteInfo(parameter.SiteId);
                    var tableName = siteInfo.TableName;

                    if (parameter.Scope == "1month")
                    {
                        var lastEditList = DataProvider.ContentDao.GetChannelIdListCheckedByLastEditDateHour(tableName, parameter.SiteId, 720);
                        foreach (var channelId in lastEditList)
                        {
                            if (selectedChannelIdList.Contains(channelId))
                            {
                                channelIdList.Add(channelId);
                            }
                        }
                    }
                    else if (parameter.Scope == "1day")
                    {
                        var lastEditList = DataProvider.ContentDao.GetChannelIdListCheckedByLastEditDateHour(tableName, parameter.SiteId, 24);
                        foreach (var channelId in lastEditList)
                        {
                            if (selectedChannelIdList.Contains(channelId))
                            {
                                channelIdList.Add(channelId);
                            }
                        }
                    }
                    else if (parameter.Scope == "2hours")
                    {
                        var lastEditList = DataProvider.ContentDao.GetChannelIdListCheckedByLastEditDateHour(tableName, parameter.SiteId, 2);
                        foreach (var channelId in lastEditList)
                        {
                            if (selectedChannelIdList.Contains(channelId))
                            {
                                channelIdList.Add(channelId);
                            }
                        }
                    }
                }
                else
                {
                    channelIdList = selectedChannelIdList;
                }

                foreach (var channelId in channelIdList)
                {
                    if (parameter.IsChannelPage)
                    {
                        CreateManager.CreateChannel(parameter.SiteId, channelId);
                    }
                    if (parameter.IsContentPage)
                    {
                        CreateManager.CreateAllContent(parameter.SiteId, channelId);
                    }
                }

                return(Ok(new { }));
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }
Пример #5
0
        public void Create_OnClick(object sender, EventArgs e)
        {
            if (!Page.IsPostBack || !Page.IsValid)
            {
                return;
            }

            var channelIdList = new List <int>();
            var selectedChannelIdArrayList = ControlUtils.GetSelectedListControlValueArrayList(LbChannelIdList);

            var tableName = SiteInfo.TableName;

            if (DdlScope.SelectedValue == "Month")
            {
                var lastEditList = DataProvider.ContentDao.GetChannelIdListCheckedByLastEditDateHour(tableName, SiteId, 720);
                foreach (var channelId in lastEditList)
                {
                    if (selectedChannelIdArrayList.Contains(channelId.ToString()))
                    {
                        channelIdList.Add(channelId);
                    }
                }
            }
            else if (DdlScope.SelectedValue == "Day")
            {
                var lastEditList = DataProvider.ContentDao.GetChannelIdListCheckedByLastEditDateHour(tableName, SiteId, 24);
                foreach (var channelId in lastEditList)
                {
                    if (selectedChannelIdArrayList.Contains(channelId.ToString()))
                    {
                        channelIdList.Add(channelId);
                    }
                }
            }
            else if (DdlScope.SelectedValue == "2Hour")
            {
                var lastEditList = DataProvider.ContentDao.GetChannelIdListCheckedByLastEditDateHour(tableName, SiteId, 2);
                foreach (var channelId in lastEditList)
                {
                    if (selectedChannelIdArrayList.Contains(channelId.ToString()))
                    {
                        channelIdList.Add(channelId);
                    }
                }
            }
            else
            {
                channelIdList = TranslateUtils.StringCollectionToIntList(TranslateUtils.ObjectCollectionToString(selectedChannelIdArrayList));
            }


            if (channelIdList.Count == 0)
            {
                FailMessage("请首先选中希望生成内容页面的栏目!");
                return;
            }

            foreach (var channelId in channelIdList)
            {
                CreateManager.CreateAllContent(SiteId, channelId);
            }

            PageCreateStatus.Redirect(SiteId);
        }