16 using System.Collections.Generic;
18 using erminas.SmartAPI.CMS.Project.Pages;
19 using erminas.SmartAPI.Utils;
21 namespace erminas.SmartAPI.CMS.Project
25 void DeleteAllPages();
26 void DeleteAllPagesOfLanguageVariant(
string language);
28 IEnumerable<IPage>
Pages();
29 IEnumerable<IPage> PagesOfLanguageVariant(
string language);
32 internal class RecycleBin : IRecycleBin
34 private readonly IProject _project;
36 internal RecycleBin(IProject project)
41 public void DeleteAllPages()
43 const string DELETE_ALL =
@"<PAGES action=""deleteallfinally"" alllanguages=""1""/>";
44 _project.ExecuteRQL(DELETE_ALL);
47 public void DeleteAllPagesOfLanguageVariant(
string language)
51 const string DELETE_ALL_IN_CURRENT_LANGUAGE =
@"<PAGES action=""deleteallfinally"" alllanguages=""0""/>";
52 _project.ExecuteRQL(DELETE_ALL_IN_CURRENT_LANGUAGE);
58 get {
return !
Pages().Any(); }
61 public IEnumerable<IPage>
Pages()
63 List<ResultGroup> searchForPagesExtended = CreatePageSearchForRecycleBin().Execute();
64 return searchForPagesExtended[0].Results.Select(pageResult => pageResult.Page);
67 public IEnumerable<IPage> PagesOfLanguageVariant(
string language)
72 IEnumerable<Result> results = search.
Execute()[0].Results;
73 return results.Select(pageResult => pageResult.Page);
76 public IProject Project
78 get {
return _project; }
81 public ISession Session
83 get {
return Project.Session; }
88 var search = _project.Pages.CreateExtendedSearch();