internal static List <StringValue> GetStatesforReview(int PortalID, int UserID) { string CacheKey = CacheFactory.GetCacheKey(CacheFactory.Keys.Workflow + "GetStatesforReview" + "PortalID", UserID, PortalID); List <StringValue> result = CacheFactory.Get(CacheKey) as List <StringValue>; if (result == null) { Sql Query = WorkflowScript.GetStatesforPendingReview(PortalID, UserID); using (VanjaroRepo db = new VanjaroRepo()) { result = db.Fetch <StringValue>(Query).ToList(); } CacheFactory.Set(CacheKey, result); } return(result); }
internal static string GetHTMLText(ModuleInfo m) { string HtmlContent = string.Empty; Sql sql = new Sql(); sql.Append("SELECT TOP 1 * FROM " + Core.Data.Scripts.CommonScript.TablePrefix + "HtmlText WHERE ModuleID=@0 ORDER BY [Version] DESC", m.ModuleID); using (VanjaroRepo db = new VanjaroRepo()) { dynamic data = db.Fetch <dynamic>(sql).FirstOrDefault(); if (data != null && data.Content != null) { HtmlContent = data.Content; } } return(HtmlContent); }
internal static List <WorkflowPage> GetReviewPagesbyUserID(int UserID, int Page, int PageSize, int StateID) { string CacheKey = CacheFactory.GetCacheKey(CacheFactory.Keys.Workflow + "GetReviewPagesbyUserID", UserID, Page, PageSize, StateID); List <WorkflowPage> Pages = CacheFactory.Get(CacheKey) as List <WorkflowPage>; if (Pages == null) { Sql Query = WorkflowScript.GetPagesByUserID(UserID, Page, PageSize, StateID); using (VanjaroRepo db = new VanjaroRepo()) { Pages = db.Fetch <WorkflowPage>(Query).ToList(); } CacheFactory.Set(CacheKey, Pages); } return(Pages); }
internal static List <Pages> GetAllPublishedPages(int portalID, string Locale) { string CacheKey = CacheFactory.GetCacheKey(CacheFactory.Keys.Page, portalID, "AllPublishedPages", Locale); List <Pages> pages = CacheFactory.Get(CacheKey); if (pages == null || pages.Count == 0) { Sql Query = PageScript.GetAllPublishedPages(portalID, Locale); using (VanjaroRepo db = new VanjaroRepo()) { pages = db.Fetch <Pages>(Query).ToList(); } CacheFactory.Set(CacheKey, pages); } return(pages); }
internal static int GetReviewPagesCountByUserID(int UserID, int Page, int PageSize, int StateID) { string CacheKey = CacheFactory.GetCacheKey(CacheFactory.Keys.Workflow + "GetReviewPagesCountByUserID", UserID, Page, PageSize, StateID); int? Count = CacheFactory.Get(CacheKey); if (Count == null) { Count = 0; Sql Query = WorkflowScript.GetPagesCountByUserID(UserID, StateID); using (VanjaroRepo db = new VanjaroRepo()) { Count = db.Fetch <int>(Query).FirstOrDefault(); } CacheFactory.Set(CacheKey, Count); } return(Count.Value); }
internal static List <WorkflowPage> GetPagesbyUserID(int PortalID, int UserID) { string CacheKey = CacheFactory.GetCacheKey(CacheFactory.Keys.Workflow + "GetPagesbyUserID" + "PortalID", UserID, PortalID); List <WorkflowPage> WorkflowPages = CacheFactory.Get(CacheKey) as List <WorkflowPage>; if (WorkflowPages == null) { Sql Query = WorkflowScript.GetPagesByUserID(PortalID, UserID); using (VanjaroRepo db = new VanjaroRepo()) { WorkflowPages = db.Fetch <WorkflowPage>(Query).ToList(); } CacheFactory.Set(CacheKey, WorkflowPages); } return(WorkflowPages); }
public static void AddUpdateLoginModule(int TabID, int PortalId) { try { using (VanjaroRepo vrepo = new VanjaroRepo()) { LoginModule loginModule = null; ModuleDefinitionInfo moduleDefinitionInfo = ModuleDefinitionController.GetModuleDefinitionByFriendlyName(Components.Constants.AccountLogin); System.Collections.Generic.List <LoginModule> moduleInfo = vrepo.Fetch <LoginModule>("Select T.PortalID,Tabm.TabID,Tabm.ModuleID,Tabm.PaneName,Tabm.IsDeleted from TabModules Tabm inner join Tabs T On Tabm.TabID = t.TabID Where PortalID=@0 AND ModuleTitle= @1", PortalId, Components.Constants.AccountLogin); foreach (LoginModule d in moduleInfo) { loginModule = d; } if (loginModule == null) { ModuleInfo module = new ModuleInfo { PortalID = PortalId, TabID = TabID, ModuleOrder = 1, ModuleTitle = moduleDefinitionInfo.FriendlyName, PaneName = "ContentPane", ModuleDefID = moduleDefinitionInfo.ModuleDefID, CacheTime = moduleDefinitionInfo.DefaultCacheTime, InheritViewPermissions = true, AllTabs = false }; int ModuleID = ModuleController.Instance.AddModule(module); ModuleController.Instance.DeleteTabModule(TabID, ModuleID, true); } else { ModuleController.Instance.MoveModule(loginModule.ModuleID, loginModule.TabID, TabID, loginModule.PaneName); if (!loginModule.IsDeleted) { ModuleController.Instance.DeleteTabModule(TabID, loginModule.ModuleID, true); } } } } catch (Exception exc) { Exceptions.LogException(exc); } }
public static void SoftDeleteModule(int PortalId, string ModuleFriendlyName) { try { using (VanjaroRepo vrepo = new VanjaroRepo()) { ModuleDefinitionInfo moduleDefinitionInfo = ModuleDefinitionController.GetModuleDefinitionByFriendlyName(ModuleFriendlyName); System.Collections.Generic.List <ModuleSettings> moduleInfo = vrepo.Fetch <ModuleSettings>("Select T.PortalID,Tabm.TabID,Tabm.ModuleID,Tabm.PaneName,Tabm.IsDeleted from TabModules Tabm inner join Tabs T On Tabm.TabID = t.TabID Where PortalID=@0 AND ModuleTitle= @1", PortalId, ModuleFriendlyName); foreach (ModuleSettings ModuleSettings in moduleInfo) { ModuleController.Instance.DeleteTabModule(ModuleSettings.TabID, ModuleSettings.ModuleID, true); } } } catch (Exception) { } }