Пример #1
0
        public Dictionary <string, VideoGalleryItem> GetRecentlyAddedVideos()
        {
            int counter = VideosCountToFetch;

            Dictionary <string, VideoGalleryItem> recentlyAddedVideos = new Dictionary <string, VideoGalleryItem>();
            VideoGalleryItem videoToBeFound = null;
            VideoGalleryItem videoItem;

            foreach (IGalleryItem video in m_RecentlyAddedVideos)
            {
                videoItem = video as VideoGalleryItem;

                recentlyAddedVideos.TryGetValue(videoItem.PictureURL, out videoToBeFound);
                if (videoToBeFound == null)
                {
                    recentlyAddedVideos.Add(videoItem.PictureURL, videoItem);
                    counter--;
                }

                if (counter == 0)
                {
                    break;
                }
            }

            return(recentlyAddedVideos);
        }
Пример #2
0
        private void SortVideosByDate()
        {
            if (m_RecentlyAddedVideos == null)
            {
                m_RecentlyAddedVideos = new List <IGalleryItem>();

                foreach (IGalleryItem video in GalleryItems)
                {
                    VideoGalleryItem videoItem = video as VideoGalleryItem;

                    if (videoItem.PictureURL != null && videoItem.VideoURL != null)
                    {
                        m_RecentlyAddedVideos.Add(videoItem);
                    }
                }

                m_RecentlyAddedVideos = m_RecentlyAddedVideos.OrderByDescending(x => (x as VideoGalleryItem).CreatedTime).ToList();
            }
        }
Пример #3
0
    public VideoGalleryItem SaveSingle(string WebVideoID, int CatgoryID, string txtTags, string txtTitle, string txtCaption, bool DoDelete, string strIndex, bool MakePrivate)
    {
        VideoGalleryItem galleryItem = new VideoGalleryItem();

        galleryItem.Index = strIndex;

        member = (Member)Session["Member"];
        bool Update = false;

        if (member != null)
        {
            Video video = Video.GetVideoByWebVideoIDWithJoin(WebVideoID);

            if (video != null)
            {
                if (video.MemberID == member.MemberID)
                {
                    if (DoDelete)
                    {
                        video.Delete();
                        galleryItem.IsRemoved = true;
                    }
                    else
                    {
                        if (video.Category != CatgoryID)
                        {
                            video.Category = CatgoryID;
                            Update         = true;
                        }

                        if (video.Tags != txtTags)
                        {
                            video.Tags = txtTags;
                            Update     = true;

                            video.UpdateTags();

                            galleryItem.Tags = video.Tags;
                        }

                        if (video.Title != txtTitle)
                        {
                            video.Title = txtTitle;
                            Update      = true;
                        }

                        if (video.Description != txtCaption)
                        {
                            video.Description = txtCaption;
                            Update            = true;
                        }

                        PrivacyType pt = PrivacyType.Public;
                        if (MakePrivate)
                        {
                            pt = PrivacyType.Network;
                        }

                        if (video.PrivacyFlag != (int)pt)
                        {
                            video.PrivacyFlag = (int)pt;
                            Update            = true;
                        }

                        if (Update)
                        {
                            video.Save();
                        }
                    }
                }
            }
        }

        return(galleryItem);
    }
    public VideoGalleryItem SaveSingle(string WebVideoID, int CatgoryID, string txtTags, string txtTitle, string txtCaption, bool DoDelete, string strIndex,bool MakePrivate)
    {
        VideoGalleryItem galleryItem = new VideoGalleryItem();
        galleryItem.Index = strIndex;

        member = (Member)Session["Member"];
        bool Update = false;

        if (member != null)
        {
                Video video = Video.GetVideoByWebVideoIDWithJoin(WebVideoID);

                if (video != null)
                {
                    
                

                if (video.MemberID == member.MemberID)
                {

                    if (DoDelete)
                    {
                        video.Delete();
                        galleryItem.IsRemoved = true;
                    }
                    else
                    {

                        if (video.Category != CatgoryID)
                        {
                            video.Category = CatgoryID;
                            Update = true;
                        }

                        if (video.Tags != txtTags)
                        {
                            video.Tags = txtTags;
                            Update = true;

                            video.UpdateTags();

                            galleryItem.Tags = video.Tags;
                        }

                        if (video.Title != txtTitle)
                        {
                            video.Title = txtTitle;
                            Update = true;
                        }

                        if (video.Description != txtCaption)
                        {
                            video.Description = txtCaption;
                            Update = true;
                        }

                        PrivacyType pt = PrivacyType.Public;
                        if (MakePrivate)
                            pt = PrivacyType.Network;

                        if (video.PrivacyFlag != (int)pt)
                        {
                            video.PrivacyFlag = (int)pt;
                            Update = true;
                        }

                        if (Update)
                        {
                            video.Save();
                        }
                    }
                }
                }
        }

        return galleryItem;
   }