public DataTable GetPagedArchives(int siteId, int?categoryId, string author, string[,] flags, string orderByField, bool orderAsc, int pageSize, int currentPageIndex, out int recordCount, out int pages) { // //TODO:moduleId暂时去掉 // int lft = -1, rgt = -1; if (categoryId.HasValue) { ISite site = this._siteRep.GetSiteById(siteId); if (site != null) { ICategory category = site.GetCategory(categoryId.Value); if (category != null) { lft = category.Lft; rgt = category.Rgt; } } } return(this._archiveQuery.GetPagedArchives(siteId, lft, rgt, author, flags, orderByField, orderAsc, pageSize, currentPageIndex, out recordCount, out pages)); }
private void ItrCloneCate(ISite toSite, ICategory fromCate, int parentCateId, bool includeExtend, bool includeTemplateBind) { ICategory newCategory = toSite.GetCategory(parentCateId); foreach (var cate in fromCate.NextLevelChilds) { int id = CloneCategoryDetails(toSite.Id, cate, newCategory.Lft, includeExtend, includeTemplateBind); ItrCloneCate(toSite, cate, id, includeExtend, includeTemplateBind); } }
private void ItrCloneCate(ISite toSite, ICategory fromCate, int parentCateId, bool includeExtend, bool includeTemplateBind) { ICategory newCategory = toSite.GetCategory(parentCateId); foreach (var cate in fromCate.NextLevelChilds) { Result r = CloneCategoryDetails(toSite.GetAggregaterootId(), cate, newCategory.GetDomainId(), includeExtend, includeTemplateBind); int catId = Convert.ToInt32(r.Data["CategoryId"]); ItrCloneCate(toSite, cate, catId, includeExtend, includeTemplateBind); } }
private void ItrCloneCate(ISite toSite, ICategory fromCate, int parentCateId, bool includeExtend, bool includeTemplateBind) { var newCategory = toSite.GetCategory(parentCateId); foreach (var cate in fromCate.NextLevelChildren) { var r = CloneCategoryDetails(toSite.GetAggregateRootId(), cate, newCategory.GetDomainId(), includeExtend, includeTemplateBind); var mp = r.Data as IDictionary <String, String>; var catId = Convert.ToInt32(mp["CategoryId"]); ItrCloneCate(toSite, cate, catId, includeExtend, includeTemplateBind); } }
public int SaveArchive(int siteId, ArchiveDto archiveDto) { IContentContainer ic = this._contentRep.GetContent(siteId); IArchive archive; if (archiveDto.Id <= 0) { archive = ic.CreateArchive(-1, archiveDto.StrId, archiveDto.Category.Id, archiveDto.Title); } else { archive = ic.GetArchiveById(archiveDto.Id); //修改栏目 if (archiveDto.Category.Id != archive.Category.Id) { ISite site = this._siteRep.GetSiteById(siteId); archive.Category = site.GetCategory(archiveDto.Category.Id); } } archive.LastModifyDate = DateTime.Now; archive.Content = archiveDto.Content; archive.Alias = archiveDto.Alias; archive.Author = archiveDto.Author; archive.Flags = archiveDto.Flags; archive.Outline = archiveDto.Outline; archive.Source = archiveDto.Source; archive.Tags = archiveDto.Tags; archive.Thumbnail = archiveDto.Thumbnail; archive.Title = archiveDto.Title; archive.SmallTitle = archiveDto.SmallTitle; archive.Location = archiveDto.Location; archive.ExtendValues = archiveDto.ExtendValues; //只更新自己的模板 if (archiveDto.IsSelfTemplate || (archive.Id == -1 && !String.IsNullOrEmpty(archiveDto.TemplatePath)) ) { archive.UpdateTemplateBind(archiveDto.TemplatePath); } return(archive.Save()); }
public void CloneCategory(int sourceSiteId, int targetSiteId, int fromCid, int toCid, bool includeChild, bool includeExtend, bool includeTemplateBind) { ISite fromSite = this.repo.GetSiteById(sourceSiteId); ISite toSite = this.repo.GetSiteById(targetSiteId); if (fromSite == null || toSite == null) { throw new ArgumentException("no such site"); } ICategory toCate = toSite.GetCategory(toCid); ICategory fromCate = fromSite.GetCategory(fromCid); Result r = CloneCategoryDetails(targetSiteId, fromCate, toCate.GetDomainId(), includeExtend, includeTemplateBind); int newCateId = Convert.ToInt32(r.Data["CategoryId"]); if (includeChild) { ItrCloneCate(toSite, fromCate, newCateId, includeExtend, includeTemplateBind); } }
public void CloneCategory(int sourceSiteId, int targetSiteId, int fromCid, int toCid, bool includeChild, bool includeExtend, bool includeTemplateBind) { ISite fromSite = this._resp.GetSiteById(sourceSiteId); ISite toSite = this._resp.GetSiteById(targetSiteId); if (fromSite == null || toSite == null) { throw new ArgumentException("no such site"); } ICategory toCate = toSite.GetCategory(toCid); ICategory fromCate = fromSite.GetCategory(fromCid); int newCateId = CloneCategoryDetails(targetSiteId, fromCate, toCate.Lft, includeExtend, includeTemplateBind); if (includeChild) { ItrCloneCate(toSite, fromCate, newCateId, includeExtend, includeTemplateBind); } }
/// <summary> /// 移动栏目排序编号 /// </summary> /// <param name="siteId"></param> /// <param name="id"></param> /// <param name="direction"></param> public void MoveCategorySortNumber(int siteId, int id, int direction) { ISite site = this.repo.GetSiteById(siteId); if (site == null) { throw new ArgumentException("no such site"); } ICategory c = site.GetCategory(id); if (c == null) { throw new ArgumentException("no such category"); } if (direction == 1) { c.MoveSortUp(); } else if (direction == 2) { c.MoveSortDown(); } }
public CategoryDto GetCategory(int siteId, int categoryId) { ISite site = this._resp.GetSiteById(siteId); return(CategoryDto.ConvertFrom(site.GetCategory(categoryId))); }
public Result SaveCategory(int siteId, int parentId, CategoryDto category) { ISite site = this.repo.GetSiteById(siteId); ICategory ic = null; if (category.ID > 0) { ic = site.GetCategory(category.ID); } if (ic == null) { ic = _categoryRep.CreateCategory(new CmsCategoryEntity()); } CmsCategoryEntity cat = new CmsCategoryEntity(); cat.SiteId = siteId; cat.Keywords = category.Keywords; cat.Description = category.Description; cat.ParentId = parentId; cat.Tag = category.Tag; cat.Icon = category.Icon; cat.Name = category.Name; cat.Title = category.PageTitle; cat.SortNumber = category.SortNumber; cat.ModuleId = category.ModuleId; cat.Location = category.Location; Error err = ic.Set(cat); if (err == null) { // 保存模板 List <TemplateBind> binds = new List <TemplateBind>(); if (!String.IsNullOrEmpty(category.CategoryTemplate)) { binds.Add(new TemplateBind(0, TemplateBindType.CategoryTemplate, category.CategoryTemplate)); } if (!String.IsNullOrEmpty(category.CategoryArchiveTemplate)) { binds.Add(new TemplateBind(0, TemplateBindType.CategoryArchiveTemplate, category.CategoryArchiveTemplate)); } err = ic.SetTemplates(binds.ToArray()); if (err == null) { // 扩展属性 if (category.ExtendFields != null) { ic.ExtendFields = category.ExtendFields; } if (err == null) { err = ic.Save(); } } } #region 扩展属性 #endregion Result r = new Result(); if (err == null) { r.Data = new Dictionary <String, String>(); r.Data["CategoryId"] = ic.GetDomainId().ToString(); } else { r.ErrCode = 1; r.ErrMsg = err.Message; } return(r); }