Beispiel #1
0
        public static void UpdateSueetieUserIP(SueetieUser sueetieUser)
        {
            var provider = SueetieDataProvider.LoadProvider();

            provider.UpdateSueetieUserIP(sueetieUser);
            SueetieCache.Current.Remove(SueetieBannedIPListCacheKey());
        }
Beispiel #2
0
        public static void RemoveBannedIP(string ip)
        {
            var provider = SueetieDataProvider.LoadProvider();

            provider.RemoveBannedIP(ip);
            SueetieCache.Current.Remove(SueetieBannedIPListCacheKey());
        }
Beispiel #3
0
        public static void DeletePageRule(int pageRuleID)
        {
            var dp = SueetieDataProvider.LoadProvider();

            dp.DeletePageRule(pageRuleID);
            ClearPageRuleListCache();
        }
Beispiel #4
0
        public static string[] GetRolesForUser(string username)
        {
            if (username == null)
            {
                return(Array.Empty <string>());
            }


            username = username.ToLowerInvariant();
            if (!UserRoleCache.TryGetValue(username, out var rolesArray))
            {
                rolesArray = Array.Empty <string>();
                var roleNames = new List <string>();
                var roles     = SueetieDataProvider.LoadProvider().GetRoles(ApplicationName, username);
                if (roles != null)
                {
                    foreach (var role in roles)
                    {
                        roleNames.Add(role);
                    }

                    UserRoleCache[username] = rolesArray = roleNames.ToArray();
                }
            }

            return(rolesArray);
        }
Beispiel #5
0
        public static void DeleteSueetieApplication(int applicationId)
        {
            var dp = SueetieDataProvider.LoadProvider();

            dp.DeleteSueetieApplication(applicationId);
            ClearApplicationListCache();
        }
Beispiel #6
0
        public static void UpdateBannedIP(int bannedID, string ip)
        {
            var provider = SueetieDataProvider.LoadProvider();

            provider.UpdateBannedIP(bannedID, ip);
            SueetieCache.Current.Remove(SueetieBannedIPListCacheKey());
        }
Beispiel #7
0
        public static int CreateSueetieApplication(int applicationId, string appKey, string appDescription, int groupId, int appTypeId)
        {
            var sueetieApplication = new SueetieApplication
            {
                ApplicationID     = applicationId,
                ApplicationKey    = appKey,
                GroupID           = groupId,
                ApplicationTypeID = appTypeId,
                Description       = appDescription
            };

            var provider = SueetieDataProvider.LoadProvider();

            provider.CreateSueetieApplication(sueetieApplication);
            if (sueetieApplication.ApplicationTypeID == (int)SueetieApplicationType.Blog && sueetieApplication.GroupID == 0)
            {
                var sueetieBlog = new SueetieBlog
                {
                    ApplicationID = applicationId,
                    BlogTitle     = sueetieApplication.Description
                };
                SueetieBlogs.CreateSueetieBlog(sueetieBlog);
            }

            ClearApplicationListCache();
            return(applicationId);
        }
Beispiel #8
0
        public static List <SueetieCalendarEvent> GetSueetieCalendarEventList(int calendarId)
        {
            var key = SueetieCalendarEventListCacheKey(calendarId);

            var sueetieCalendarEvents = SueetieCache.Current[key] as List <SueetieCalendarEvent>;

            if (sueetieCalendarEvents == null)
            {
                var provider = SueetieDataProvider.LoadProvider();
                sueetieCalendarEvents = provider.GetSueetieCalendarEventList(calendarId);

                // Process Repeating Events
                var sueetieRepeatingCalendarEvents = new List <SueetieCalendarEvent>();

                foreach (var sueetieCalendarEvent in sueetieCalendarEvents)
                {
                    sueetieRepeatingCalendarEvents.Add(sueetieCalendarEvent);
                    if (!DataHelper.IsMinDate(sueetieCalendarEvent.RepeatEndDate))
                    {
                        var dateEventStart = sueetieCalendarEvent.StartDateTime;
                        var dateEventEnd   = sueetieCalendarEvent.EndDateTime;
                        var repeatEndDate  = sueetieCalendarEvent.RepeatEndDate;
                        while (dateEventStart.Date.AddDays(7) <= repeatEndDate.Date)
                        {
                            dateEventStart = dateEventStart.AddDays(7);
                            dateEventEnd   = dateEventEnd.AddDays(7);
                            var repeatingEvent = new SueetieCalendarEvent
                            {
                                EventID          = sueetieCalendarEvent.EventID,
                                EventGuid        = sueetieCalendarEvent.EventGuid,
                                CalendarID       = sueetieCalendarEvent.CalendarID,
                                EventTitle       = sueetieCalendarEvent.EventTitle,
                                EventDescription = sueetieCalendarEvent.EventDescription,
                                StartDateTime    = dateEventStart,
                                EndDateTime      = dateEventEnd,
                                AllDayEvent      = sueetieCalendarEvent.AllDayEvent,
                                RepeatEndDate    = sueetieCalendarEvent.RepeatEndDate,
                                IsActive         = sueetieCalendarEvent.IsActive,
                                SourceContentID  = sueetieCalendarEvent.SourceContentID,
                                ContentID        = sueetieCalendarEvent.ContentID,
                                Url             = sueetieCalendarEvent.Url,
                                ContentTypeID   = sueetieCalendarEvent.ContentTypeID,
                                UserID          = sueetieCalendarEvent.UserID,
                                UserName        = sueetieCalendarEvent.UserName,
                                DisplayName     = sueetieCalendarEvent.DisplayName,
                                CreatedDateTIme = sueetieCalendarEvent.CreatedDateTIme,
                                CreatedBy       = sueetieCalendarEvent.CreatedBy
                            };
                            sueetieRepeatingCalendarEvents.Add(repeatingEvent);
                        }
                    }
                }

                SueetieCache.Current.Insert(key, sueetieRepeatingCalendarEvents);
                return(sueetieRepeatingCalendarEvents);
            }

            return(sueetieCalendarEvents);
        }
Beispiel #9
0
        public static int CreateGroup(SueetieGroup sueetieGroup)
        {
            var provider = SueetieDataProvider.LoadProvider();
            var groupId  = provider.CreateGroup(sueetieGroup);

            ClearGroupListCache();
            return(groupId);
        }
        public static int UpdateSueetieContentPart(SueetieContentPart sueetieContentPart)
        {
            var provider      = SueetieDataProvider.LoadProvider();
            var contentPartId = provider.UpdateSueetieContentPart(sueetieContentPart);

            ClearContentPartCache(sueetieContentPart.ContentName);
            return(contentPartId);
        }
Beispiel #11
0
        public static void DeleteUserLogActivity(int userLogId)
        {
            var provider = SueetieDataProvider.LoadProvider();

            provider.DeleteUserLogActivity(userLogId);
            ClearUserLogActivityListCache((int)SueetieContentViewType.Unassigned);
            ClearUserLogActivityListCache((int)SueetieContentViewType.SyndicatedUserLogActivityList);
        }
Beispiel #12
0
        public static int AddForumMessage(SueetieForumContent sueetieForumContent)
        {
            var provider  = SueetieDataProvider.LoadProvider();
            var contentId = provider.AddForumMessage(sueetieForumContent);

            ClearForumMessageListCache(sueetieForumContent);
            return(contentId);
        }
Beispiel #13
0
        public static int CreateUpdateSueetieBlogPost(SueetieBlogPost sueetieBlogPost)
        {
            var provider  = SueetieDataProvider.LoadProvider();
            var contentId = provider.CreateUpdateSueetieBlogPost(sueetieBlogPost);

            ClearBlogPostListCache(sueetieBlogPost);
            return(contentId);
        }
Beispiel #14
0
        public static int CreateFavorite(UserContent userContent)
        {
            var provider   = SueetieDataProvider.LoadProvider();
            var favoriteID = provider.CreateFavorite(userContent);

            ClearFavoriteContentListCache(userContent.UserID);
            return(favoriteID);
        }
Beispiel #15
0
        public static UserContent DeleteFavorite(UserContent userContent)
        {
            var provider     = SueetieDataProvider.LoadProvider();
            var _userContent = provider.DeleteFavorite(userContent);

            ClearFavoriteContentListCache(userContent.UserID);
            return(_userContent);
        }
        public static void EnterContentPageTags(SueetieTagEntry sueetieTagEntry)
        {
            var provider = SueetieDataProvider.LoadProvider();

            provider.EnterContentPageTags(sueetieTagEntry);

            ClearSueetieContentPageListCache(GetSueetieContentPage(sueetieTagEntry.ItemID).ContentPageGroupID);
            ClearSueetieContentPageListCache(-1);
        }
Beispiel #17
0
        public static void CreatePageRule(string urlExcerpt, string urlFinal, string pageTitle, string isEqual)
        {
            var provider = SueetieDataProvider.LoadProvider();

            provider.CreatePageRule(new PageRule {
                UrlExcerpt = urlExcerpt, UrlFinal = urlFinal, PageTitle = pageTitle, IsEqual = isEqual.ToBoolean()
            });
            SueetieCache.Current.Remove(PageRuleListCacheKey());
        }
Beispiel #18
0
        public static List <SueetieBlogComment> GetSueetieBlogCommentList(ContentQuery contentQuery)
        {
            var provider = SueetieDataProvider.LoadProvider();

            var key = BlogCommentListCacheKey(contentQuery);

            var cachedSueetieBlogComments = SueetieCache.Current[key] as List <SueetieBlogComment>;

            if (cachedSueetieBlogComments != null)
            {
                if (contentQuery.NumRecords > 0)
                {
                    return(cachedSueetieBlogComments.Take(contentQuery.NumRecords).ToList());
                }
                return(cachedSueetieBlogComments.ToList());
            }

            var sueetieBlogComments = from p in provider.GetSueetieBlogCommentList(contentQuery)
                                      select p;

            if (contentQuery.GroupID > -1)
            {
                sueetieBlogComments = from g in sueetieBlogComments where g.GroupID == contentQuery.GroupID select g;
            }

            if (contentQuery.ApplicationID > 0)
            {
                sueetieBlogComments = from a in sueetieBlogComments where a.ApplicationID == contentQuery.ApplicationID select a;
            }

            if (contentQuery.UserID > 0)
            {
                sueetieBlogComments = from u in sueetieBlogComments where u.UserID == contentQuery.UserID select u;
            }

            if (contentQuery.IsRestricted)
            {
                sueetieBlogComments = from r in sueetieBlogComments where r.IsRestricted == false select r;
            }

            if (contentQuery.NumRecords > 0)
            {
                sueetieBlogComments = from n in sueetieBlogComments.Take(contentQuery.NumRecords) select n;
            }

            if (contentQuery.CacheMinutes > 0)
            {
                SueetieCache.Current.InsertMinutes(key, sueetieBlogComments.ToList(), contentQuery.CacheMinutes);
            }
            else
            {
                SueetieCache.Current.InsertMax(key, sueetieBlogComments.ToList());
            }

            return(sueetieBlogComments.ToList());
        }
Beispiel #19
0
        public static SueetieUser GetSueetieUserFromForumId(int forumUserId)
        {
            var sueetieUser = SueetieUsers.GetSueetieUserList(SueetieUserType.RegisteredUser).Find(u => u.ForumUserID == forumUserId);

            if (sueetieUser == null)
            {
                var provider = SueetieDataProvider.LoadProvider();
                sueetieUser = provider.GetSueetieUserFromForumID(forumUserId);
            }
            return(sueetieUser);
        }
Beispiel #20
0
        public static void DeleteSueetieRole(string rolename)
        {
            var dp         = SueetieDataProvider.LoadProvider();
            var wasDeleted = dp.DeleteSueetieRole(rolename);

            if (wasDeleted)
            {
                Roles.DeleteRole(rolename);
                ClearRolesListCache();
            }
        }
Beispiel #21
0
        public static SueetieWikiMessage GetSueetieWikiMessage(string messageQueryID)
        {
            var _sueetieWikiMessage = GetSueetieWikiMessageList().Find(m => m.MessageQueryID == messageQueryID);

            if (_sueetieWikiMessage == null)
            {
                var provider = SueetieDataProvider.LoadProvider();
                _sueetieWikiMessage = provider.GetSueetieWikiMessage(messageQueryID);
            }
            return(_sueetieWikiMessage);
        }
Beispiel #22
0
        public static void AdminUpdateSueetieMediaAlbum(int albumId, int contentTypeId, int contentId)
        {
            var sueetieMediaAlbum = new SueetieMediaAlbum
            {
                AlbumID       = albumId,
                ContentTypeID = contentTypeId,
                ContentID     = contentId
            };
            var provider = SueetieDataProvider.LoadProvider();

            provider.AdminUpdateSueetieMediaAlbum(sueetieMediaAlbum);
        }
Beispiel #23
0
 public static void PerformRequestLogInsert(SueetieRequest sueetieRequest)
 {
     try
     {
         var provider = SueetieDataProvider.LoadProvider();
         provider.AddSueetieRequest(sueetieRequest);
     }
     catch (Exception ex)
     {
         SueetieLogs.LogException("Analytics Logging Error: " + HttpContext.Current.Request.RawUrl + " : " + ex.Message + " STACK TRACE: " + ex.StackTrace);
     }
 }
Beispiel #24
0
        public static SueetieForumTopic GetSueetieForumTopic(int topicId)
        {
            var content = new SueetieForumContent
            {
                TopicID       = topicId,
                ApplicationID = 2,
                ContentTypeID = (int)SueetieContentType.ForumTopic
            };
            var provider = SueetieDataProvider.LoadProvider();

            return(provider.GetSueetieForumTopic(content));
        }
Beispiel #25
0
        public static void UpdateUserLogCategory(bool isDisplayed, bool isSyndicated, int userLogCategoryId)
        {
            var userLogCategory = new UserLogCategory
            {
                UserLogCategoryID = userLogCategoryId,
                IsDisplayed       = isDisplayed,
                IsSyndicated      = isSyndicated
            };
            var provider = SueetieDataProvider.LoadProvider();

            provider.UpdateUserLogCategory(userLogCategory);
        }
Beispiel #26
0
        public static SueetieUserProfile GetSueetieUserProfile(int userID)
        {
            var userProfileCacheKey = UserProfileCacheKey(userID);
            var sueetieUserProfile  = SueetieCache.Current[userProfileCacheKey] as SueetieUserProfile;

            if (sueetieUserProfile == null)
            {
                var provider = SueetieDataProvider.LoadProvider();
                sueetieUserProfile = provider.GetSueetieUserProfile(userID);
                SueetieCache.Current.InsertMinutes(userProfileCacheKey, sueetieUserProfile, 5);
            }
            return(sueetieUserProfile);
        }
Beispiel #27
0
        public static List <ContentTypeDescription> GetAlbumContentTypeDescriptionList()
        {
            var key = AlbumContentTypeDescriptionCacheKey();
            var albumContentTypeDescriptionList = SueetieCache.Current[key] as List <ContentTypeDescription>;

            if (albumContentTypeDescriptionList == null)
            {
                var provider = SueetieDataProvider.LoadProvider();
                albumContentTypeDescriptionList = provider.GetAlbumContentTypeDescriptionList();
                SueetieCache.Current.Insert(key, albumContentTypeDescriptionList);
            }
            return(albumContentTypeDescriptionList);
        }
        public static List <SueetieContentPart> GetSueetieContentPartList(int pageId)
        {
            var key = SueetieContentPartListCacheKey(pageId);
            var sueetieContentParts = SueetieCache.Current[key] as List <SueetieContentPart>;

            if (sueetieContentParts == null)
            {
                var provider = SueetieDataProvider.LoadProvider();
                sueetieContentParts = provider.GetSueetieContentPartList(pageId);
                SueetieCache.Current.Insert(key, sueetieContentParts);
            }
            return(sueetieContentParts);
        }
        public static SueetieContentPage GetSueetieContentPage(int pageId)
        {
            var key = SueetieContentPageCacheKey(pageId);
            var sueetieContentPage = SueetieCache.Current[key] as SueetieContentPage;

            if (sueetieContentPage == null)
            {
                var provider = SueetieDataProvider.LoadProvider();
                sueetieContentPage = provider.GetSueetieContentPage(pageId);
                SueetieCache.Current.Insert(key, sueetieContentPage);
            }
            return(sueetieContentPage);
        }
Beispiel #30
0
        public static List <SueetieBlog> GetSueetieBlogList(ApplicationQuery applicationQuery)
        {
            var provider = SueetieDataProvider.LoadProvider();

            var key = BlogListCacheKey(applicationQuery);

            var cachedSueetieBlogs = SueetieCache.Current[key] as List <SueetieBlog>;

            if (cachedSueetieBlogs != null)
            {
                if (applicationQuery.NumRecords > 0)
                {
                    return(cachedSueetieBlogs.Take(applicationQuery.NumRecords).ToList());
                }
                return(cachedSueetieBlogs.ToList());
            }

            var sueetieBlogs = from p in provider.GetSueetieBlogList(applicationQuery)
                               select p;

            if (applicationQuery.GroupID > -1)
            {
                sueetieBlogs = from g in sueetieBlogs where g.GroupID == applicationQuery.GroupID select g;
            }

            if (applicationQuery.CategoryID > 0)
            {
                sueetieBlogs = from a in sueetieBlogs where a.CategoryID == applicationQuery.CategoryID select a;
            }

            if (applicationQuery.IsRestricted)
            {
                sueetieBlogs = from r in sueetieBlogs where r.BlogAccessRole == null select r;
            }

            if (applicationQuery.CacheMinutes > 0)
            {
                SueetieCache.Current.InsertMinutes(key, sueetieBlogs.ToList(), applicationQuery.CacheMinutes);
            }
            else
            {
                SueetieCache.Current.InsertMax(key, sueetieBlogs.ToList());
            }


            if (applicationQuery.NumRecords > 0)
            {
                return(sueetieBlogs.Take(applicationQuery.NumRecords).ToList());
            }
            return(sueetieBlogs.ToList());
        }