Beispiel #1
0
 public static void UpdateSortOrder(ListEntryInfo listEntryInfo)
 {
     using (VanjaroRepo db = new VanjaroRepo())
     {
         db.Execute("UPDATE " + Core.Data.Scripts.CommonScript.TablePrefix + "LISTS SET SORTORDER=@0 WHERE ENTRYID=@1 AND LISTNAME=@2", listEntryInfo.SortOrder, listEntryInfo.EntryID, listEntryInfo.ListName);
     }
 }
            internal static void MigrateToVanjaro(PortalSettings PortalSettings)
            {
                TabInfo Tab = TabController.Instance.GetTab(PortalSettings.ActiveTab.TabID, PortalSettings.Current.PortalId);

                if (Tab != null && Tab.TabID > 0)
                {
                    try
                    {
                        Tab.SkinSrc      = "[g]skins/vanjaro/base.ascx";
                        Tab.ContainerSrc = "[g]containers/vanjaro/base.ascx";

                        using (VanjaroRepo db = new VanjaroRepo())
                        {
                            db.Execute(PortalScript.UpdateTabContainerSrc(PortalSettings.Current.PortalId, Tab.TabID));
                        }

                        //Clear Cache for all TabModules
                        foreach (ModuleInfo tabModule in ModuleController.Instance.GetTabModules(Tab.TabID).Values)
                        {
                            DataCache.RemoveCache(string.Format(DataCache.SingleTabModuleCacheKey, tabModule.TabModuleID));
                        }
                        DataCache.ClearModuleCache(Tab.TabID);

                        TabController.Instance.UpdateTab(Tab);
                    }
                    catch (Exception)
                    {
                    }
                }
            }
Beispiel #3
0
            internal static void AddUpdateProperty(List <Localization> Localizations)
            {
                VanjaroRepo db = VanjaroRepo.GetInstance();

                using (Transaction scope = db.GetTransaction())
                {
                    try
                    {
                        foreach (Localization localization in Localizations)
                        {
                            if (localization.LocalizationID > 0)
                            {
                                localization.Update();
                            }
                            else
                            {
                                localization.Insert();
                            }
                        }
                        scope.Complete();
                    }
                    catch (Exception ex)
                    {
                        Exceptions.LogException(ex);
                    }
                }
            }
Beispiel #4
0
 public static void DeleteDefaultMemberProfileProperties()
 {
     try
     {
         using (VanjaroRepo vrepo = new VanjaroRepo())
         {
             vrepo.Execute("Delete from ProfilePropertyDefinition Where PortalID Is NUll AND PropertyName !=@0", "PreferredTimeZone");
         }
     }
     catch (Exception) { }
 }
Beispiel #5
0
            private static void UpdatePortalSettings(List <StringValue> SettingNameValue, int PortalID, int UserID)
            {
                string query = string.Empty;

                foreach (StringValue setting in SettingNameValue)
                {
                    query += PortalScript.UpdatePortalSettings(setting.Text, setting.Value, PortalID, UserID);
                }

                using (VanjaroRepo db = new VanjaroRepo())
                {
                    db.Execute(query);
                }
            }
            internal static List <WorkflowPermissionInfo> GetPermissionByCode(string Code)
            {
                string CacheKey = CacheFactory.GetCacheKey(CacheFactory.Keys.Workflow + "GetPermissionByCode", Code);
                List <WorkflowPermissionInfo> _WorkflowStatePermInfo = CacheFactory.Get(CacheKey) as List <WorkflowPermissionInfo>;

                if (_WorkflowStatePermInfo == null)
                {
                    using (VanjaroRepo db = new VanjaroRepo())
                    {
                        _WorkflowStatePermInfo = db.Query <WorkflowPermissionInfo>("SELECT p.* FROM " + Data.Scripts.CommonScript.DnnTablePrefix + "Permission AS p WHERE p.PermissionCode = @0", Code).ToList();
                    }
                    CacheFactory.Set(CacheKey, _WorkflowStatePermInfo);
                }
                return(_WorkflowStatePermInfo);
            }
Beispiel #7
0
 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) { }
 }
            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 <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 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);
            }
Beispiel #14
0
            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); }
            }