internal static CMSSection Create(IDataStore dataStore, IApplicationSettings applicationSettings, IApplication application, CMSGroup group, Random random) { CMSSectionManager manager = new CMSSectionManager(dataStore); CMSSectionType sectionType = DebugUtility.GetRandomEnum <CMSSectionType>(random); CMSSection section = new CMSSection( application.ApplicationId , "TestSection " + random.Next(1000000, 10000000) , true , false , sectionType); if (group != null) { section.CMSGroupId = group.CMSGroupId; } BusinessObjectActionReport <DataRepositoryActionStatus> report = manager.Create(section); Assert.AreEqual(DataRepositoryActionStatus.Success, report.Status); Assert.Greater(section.CMSSectionId, 0); CMSSection dsSection = manager.GetSection(sectionType, section.CMSSectionId); Assert.IsNotNull(dsSection); if (group != null) { Assert.AreEqual(section.CMSGroupId, group.CMSGroupId); } return(dsSection); }
public void Test_Gets() { List <CMSSection> records = new List <CMSSection>(); CMSSectionManager manager = new CMSSectionManager(this.DataStore); CMSSectionType sectionType = DebugUtility.GetRandomEnum <CMSSectionType>(this.Random); for (int i = 0; i < 10; i++) { records.Add(Create(this.DataStore, Workmate.Components.InstanceContainer.ApplicationSettings, this.Application, null, this.Random)); } foreach (CMSSection record in records) { record.CMSSectionType = sectionType; manager.Update(record); } List <CMSSection> dsRecords = manager.GetAllSections(this.Application.ApplicationId, sectionType).ToList(); Assert.GreaterOrEqual(dsRecords.Count, records.Count); foreach (CMSSection record in records) { Assert.AreEqual(1, dsRecords.Count(c => c.CMSSectionId == record.CMSSectionId)); } Assert.AreEqual(0, dsRecords.Count(c => c.CMSSectionType != sectionType)); foreach (CMSSection record in records) { Delete(this.DataStore, record); } }
internal static void Delete(IDataStore dataStore, CMSThread thread, CMSSectionType sectionType) { CMSThreadManager manager = new CMSThreadManager(dataStore); BusinessObjectActionReport <DataRepositoryActionStatus> report = manager.Delete(thread, true); Assert.AreEqual(DataRepositoryActionStatus.Success, report.Status); Assert.IsNull(manager.GetThread(sectionType, thread.CMSThreadId)); Trace.WriteLine("Successfully deleted thread " + thread.CMSName); }
internal List <CMSSection> GetAllSections(int applicationId, CMSSectionType sectionType) { try { using (IDataStoreContext dataStoreContext = this._DataStore.CreateContext()) { return(dataStoreContext.cms_Sections_Get(applicationId, sectionType).ToList()); } } catch (Exception ex) { _Log.Error("Error at cms_Sections_Get", ex); throw new DataStoreException(ex, true); } }
internal CMSSection GetSection(CMSSectionType sectionType, int sectionId) { try { using (IDataStoreContext dataStoreContext = this._DataStore.CreateContext()) { return(dataStoreContext.cms_Sections_Get(sectionType, sectionId)); } } catch (Exception ex) { _Log.Error("Error at cms_Sections_Get", ex); throw new DataStoreException(ex, true); } }
internal List <CMSThread> GetAllThreads(CMSSectionType sectionType) { try { using (IDataStoreContext dataStoreContext = this._DataStore.CreateContext()) { return(dataStoreContext.cms_Threads_Get(sectionType).ToList()); } } catch (Exception ex) { _Log.Error("Error at cms_Threads_Get", ex); throw new DataStoreException(ex, true); } }
internal CMSThread GetThread(CMSSectionType sectionType, string name) { try { using (IDataStoreContext dataStoreContext = this._DataStore.CreateContext()) { return(dataStoreContext.cms_Threads_Get(sectionType, name)); } } catch (Exception ex) { _Log.Error("Error at cms_Threads_Get", ex); throw new DataStoreException(ex, true); } }
public CMSSection cms_Sections_Get(int applicationId, CMSSectionType sectionType, string name) { throw new NotImplementedException(); }
public CMSSection(int applicationId, int sectionId, int?parentSectionId, int?groupId, string name, string description, CMSSectionType sectionType, bool isActive , bool isModerated, int totalContents, int totalThreads) { this.ApplicationId = applicationId; this.CMSSectionId = sectionId; this.CMSParentSectionId = parentSectionId; this.CMSGroupId = groupId; this.Name = name; this.Description = description; this.CMSSectionType = sectionType; this.IsActive = isActive; this.IsModerated = isModerated; this.CMSTotalContents = totalContents; this.CMSTotalThreads = totalThreads; }
internal CMSSection(int applicationId, string name, bool isActive, bool isModerated, CMSSectionType sectionType) { this.ApplicationId = applicationId; this.IsActive = isActive; this.IsModerated = isModerated; this.CMSSectionType = sectionType; this.Name = name; this.CMSTotalContents = 0; this.CMSTotalThreads = 0; }