Exemple #1
0
        public static DataObjectList <T> LoadByObjectID <T>(string[] objectID, QuickParameters quickParameters) where T : DataObject, new()
        {
            DataObjectList <T> list = new DataObjectList <T>();

            foreach (string strID in objectID)
            {
                if (strID.Length > 0 && strID.IsGuid())
                {
                    list.Add(DataObject.Load <T>(strID.ToNullableGuid(), quickParameters.ShowState, false));
                }
            }

            if (quickParameters.PageSize > 0)
            {
                int pageTotal = 0;
                list.ItemTotal = list.Count;
                list           = DoPaging <T>(list, quickParameters.PageNumber, quickParameters.PageSize, out pageTotal);
                list.PageTotal = pageTotal;
            }

            return(list);
        }
Exemple #2
0
        public static DataObjectList <DataObject> LoadByReflection(QuickParameters quickParameters)
        {
            string typeName = Helper.GetObjectType(quickParameters.ObjectType).Type;

            MethodInfo loadMethod = HttpRuntime.Cache["DataObjects.Load" + typeName] as MethodInfo;

            if (loadMethod == null)
            {
                Type type = null;
                if (!string.IsNullOrEmpty(Helper.GetObjectType(quickParameters.ObjectType).Assembly))
                {
                    Assembly assembly = Assembly.Load(Helper.GetObjectType(quickParameters.ObjectType).Assembly);
                    type = assembly.GetType(typeName);
                }
                else
                {
                    type = Type.GetType(typeName);
                }

                loadMethod = typeof(Data.DataObjects).GetMethod("Load", new Type[] { typeof(QuickParameters) });
                loadMethod = loadMethod.MakeGenericMethod(type);
                HttpRuntime.Cache.Insert("DataObjects.Load" + typeName, loadMethod, null, System.Web.Caching.Cache.NoAbsoluteExpiration, new TimeSpan(0, 15, 0), System.Web.Caching.CacheItemPriority.AboveNormal, null);
            }
            object list = loadMethod.Invoke(null, new object[] { quickParameters });

            MethodInfo method = HttpRuntime.Cache["DataObjectList.ConvertToListOfObjects" + typeName] as MethodInfo;

            if (method == null)
            {
                method = typeof(DataObjectList <DataObject>).GetMethod("ConvertToListOfObjects", BindingFlags.Static | BindingFlags.Public);
                Type listType = list.GetType().GetGenericArguments()[0];
                method = method.MakeGenericMethod(new[] { listType });
                HttpRuntime.Cache.Insert("DataObjectList.ConvertToListOfObjects" + typeName, method, null, System.Web.Caching.Cache.NoAbsoluteExpiration, new TimeSpan(0, 15, 0), System.Web.Caching.CacheItemPriority.AboveNormal, null);
            }
            return((DataObjectList <DataObject>)method.Invoke(null, new object[] { list }));
        }
Exemple #3
0
        public virtual void FromNameValueCollection(NameValueCollection collection)
        {
            if (!string.IsNullOrEmpty(collection["OT"]))
            {
                ObjectType = Helper.GetObjectTypeNumericID(collection["OT"]);
            }
            if (!string.IsNullOrEmpty(collection["OTS"]))
            {
                ObjectType  = 0;
                ObjectTypes = QuickParameters.GetDelimitedObjectTypeIDs(collection["OTS"], ',');
            }
            string paramCtyId = string.Empty;

            if (collection["XCN"] != null)
            {
                paramCtyId = collection["XCN"];
            }
            else if (!string.IsNullOrEmpty(collection["CN"]))
            {
                paramCtyId = collection["CN"];
            }
            if (!string.IsNullOrEmpty(paramCtyId))
            {
                if (!paramCtyId.IsGuid())
                {
                    CommunityID = DataObjectCommunity.GetCommunityIDByVirtualURL(paramCtyId);
                }
                else
                {
                    CommunityID = paramCtyId.ToGuid();
                }
            }
            if (!string.IsNullOrEmpty(collection["CNS"]))
            {
                CommunityID = null;
                Communities = QuickParameters.GetDelimitedCommunityIDs(collection["CNS"], ',');
            }

            string paramUserId = string.Empty;

            if (collection["XUI"] != null)
            {
                paramUserId = collection["XUI"];
            }
            else if (!string.IsNullOrEmpty(collection["UI"]))
            {
                paramUserId = collection["UI"];
            }
            if (!string.IsNullOrEmpty(paramUserId))
            {
                if (!paramUserId.IsGuid())
                {
                    UserID = DataObjectUser.GetUserIDByNickname(paramUserId);
                }
                else
                {
                    UserID = paramUserId.ToGuid();
                }
            }

            if (!string.IsNullOrEmpty(collection["TG"]))
            {
                TagID = HttpUtility.UrlDecode(collection["TG"]).ToNullableGuid();
            }
            if (!string.IsNullOrEmpty(collection["TGL1"]))
            {
                TagID    = null;
                RawTags1 = collection["TGL1"];
                Tags1    = QuickParameters.GetDelimitedTagIds(HttpUtility.UrlDecode(collection["TGL1"]), ',');
            }
            if (!string.IsNullOrEmpty(collection["TGL2"]))
            {
                TagID    = null;
                RawTags2 = collection["TGL2"];
                Tags2    = QuickParameters.GetDelimitedTagIds(HttpUtility.UrlDecode(collection["TGL2"]), ',');
            }
            if (!string.IsNullOrEmpty(collection["TGL3"]))
            {
                TagID    = null;
                RawTags3 = collection["TGL3"];
                Tags3    = QuickParameters.GetDelimitedTagIds(HttpUtility.UrlDecode(collection["TGL3"]), ',');
            }

            if (!string.IsNullOrEmpty(collection["SO"]))
            {
                SortBy = (QuickSort)Enum.Parse(typeof(QuickSort), collection["SO"], true);
            }
            if (!string.IsNullOrEmpty(collection["SD"]))
            {
                Direction = (QuickSortDirection)Enum.Parse(typeof(QuickSortDirection), collection["SD"], true);
            }

            if (!string.IsNullOrEmpty(collection["SO2"]))
            {
                SortBySecond = (QuickSort)Enum.Parse(typeof(QuickSort), collection["SO2"], true);
            }
            if (!string.IsNullOrEmpty(collection["SD2"]))
            {
                DirectionSecond = (QuickSortDirection)Enum.Parse(typeof(QuickSortDirection), collection["SD2"], true);
            }

            if (!string.IsNullOrEmpty(collection["AM"]))
            {
                int temp;
                if (int.TryParse(collection["AM"], out temp))
                {
                    amount = temp;
                }
            }
            if (!string.IsNullOrEmpty(collection["PN"]))
            {
                int.TryParse(collection["PN"], out pageNumber);
            }
            if (!string.IsNullOrEmpty(collection["PS"]))
            {
                int.TryParse(collection["PS"], out pageSize);
                pageSize = Math.Min(pageSize, 100);
            }
            if (!string.IsNullOrEmpty(collection["SS"]))
            {
                ShowState = (ObjectShowState)Enum.Parse(typeof(ObjectShowState), collection["SS"], true);
            }
            if (!string.IsNullOrEmpty(collection["FI"]))
            {
                DateTime formInserted;
                if (DateTime.TryParse(collection["FI"], out formInserted))
                {
                    fromInserted = formInserted;
                }
            }
            if (!string.IsNullOrEmpty(collection["TI"]))
            {
                DateTime toInserted;
                if (DateTime.TryParse(collection["TI"], out toInserted))
                {
                    this.toInserted = toInserted;
                }
            }
            if (!string.IsNullOrEmpty(collection["FE"]))
            {
                int featured;
                if (int.TryParse(collection["FE"], out featured))
                {
                    this.featured = featured;
                }
            }
            if (!string.IsNullOrEmpty(collection["WC"]))
            {
                bool withCopy;
                if (bool.TryParse(collection["WC"], out withCopy))
                {
                    this.withCopy = withCopy;
                }
            }
            if (!string.IsNullOrEmpty(collection["FS"]))
            {
                DateTime fromStartDate;
                if (DateTime.TryParse(collection["FS"], out fromStartDate))
                {
                    this.fromStartDate = fromStartDate;
                }
            }
            if (!string.IsNullOrEmpty(collection["TS"]))
            {
                DateTime toEndDate;
                if (DateTime.TryParse(collection["TS"], out toEndDate))
                {
                    this.toEndDate = toEndDate;
                }
            }
            if (!string.IsNullOrEmpty(collection["TSD"]))
            {
                DateTime toStartDate;
                if (DateTime.TryParse(collection["TSD"], out toStartDate))
                {
                    this.toStartDate = toStartDate.GetStartOfDay();
                }
            }
            if (!string.IsNullOrEmpty(collection["FED"]))
            {
                DateTime fromEndDate;
                if (DateTime.TryParse(collection["FED"], out fromEndDate))
                {
                    this.fromEndDate = fromEndDate.GetEndOfDay();
                }
            }
            if (!string.IsNullOrEmpty(collection["DM"]))
            {
                DateQueryMethode = (QuickDateQueryMethode)Enum.Parse(typeof(QuickDateQueryMethode), collection["DM"], true);
            }
            if (!string.IsNullOrEmpty(collection["CO"]))
            {
                Country = collection["CO"];
            }
            if (!string.IsNullOrEmpty(collection["ZP"]))
            {
                Zip = collection["ZP"];
            }
            if (!string.IsNullOrEmpty(collection["CI"]))
            {
                City = HttpUtility.UrlDecode(collection["CI"]);
            }
            if (!string.IsNullOrEmpty(collection["GC"]))
            {
                string[] coordsList = collection["GC"].Split(new char[] { ',' });
                if (coordsList.Length == 2)
                {
                    GeoLat  = float.Parse(coordsList[0]);
                    GeoLong = float.Parse(coordsList[1]);
                }
            }
            if (!string.IsNullOrEmpty(collection["DI"]))
            {
                DistanceKm = float.Parse(collection["DI"]);
            }
            if (!string.IsNullOrEmpty(collection["OC"]))
            {
                bool onlyConverted;
                if (bool.TryParse(collection["OC"], out onlyConverted))
                {
                    this.onlyConverted = onlyConverted;
                }
            }
            if (!string.IsNullOrEmpty(collection["OI"]))
            {
                bool onlyWithImage;
                if (bool.TryParse(collection["OI"], out onlyWithImage))
                {
                    this.onlyWithImage = onlyWithImage;
                }
            }
            if (!string.IsNullOrEmpty(collection["NI"]))
            {
                Nickname = HttpUtility.UrlDecode(collection["NI"]);
            }
            if (!string.IsNullOrEmpty(collection["TL"]))
            {
                Title = HttpUtility.UrlDecode(collection["TL"]);
            }
            if (!string.IsNullOrEmpty(collection["DE"]))
            {
                Description = HttpUtility.UrlDecode(collection["DE"]);
            }
            if (!string.IsNullOrEmpty(collection["SU"]))
            {
                UserSearch = HttpUtility.UrlDecode(collection["SU"]);
            }
            if (!string.IsNullOrEmpty(collection["IG"]))
            {
                bool boolVal;
                if (bool.TryParse(collection["IG"], out boolVal))
                {
                    IncludeGroups = boolVal;
                }
            }
            if (!string.IsNullOrEmpty(collection["IC"]))
            {
                bool boolVal;
                if (bool.TryParse(collection["IC"], out boolVal))
                {
                    IgnoreCache = boolVal;
                }
            }
            if (!string.IsNullOrEmpty(collection["GT"]))
            {
                bool boolVal;
                if (bool.TryParse(collection["GT"], out boolVal))
                {
                    OnlyGeoTagged = boolVal;
                }
            }
            if (!string.IsNullOrEmpty(collection["SG"]))
            {
                GeneralSearch = HttpUtility.UrlDecode(collection["SG"]);
            }

            if (!string.IsNullOrEmpty(collection["OID"]))
            {
                ObjectID = collection["OID"].ToGuid();
            }

            if (!string.IsNullOrEmpty(collection["COID"]))
            {
                CurrentObjectID = collection["COID"].ToGuid();
            }

            if (!string.IsNullOrEmpty(collection["RPID"]))
            {
                if (RelationParams == null)
                {
                    RelationParams = new RelationParams();
                }
                RelationParams.ParentObjectID = collection["RPID"].ToGuid();
            }
        }
Exemple #4
0
        //internal int InitialCapacity
        //{
        //    get
        //    {
        //        if (amount > 0 && amount < pageSize)
        //            return amount;
        //        else if (pageSize > 0)
        //            return pageSize;
        //        else
        //            return 25;
        //    }
        //}

        public void FillFromQuickParameter(QuickParameters quickParameterToClone)
        {
            RelationParams = quickParameterToClone.RelationParams;

            MembershipParams = quickParameterToClone.MembershipParams;

            ViewLogParams = quickParameterToClone.ViewLogParams;

            Udc = quickParameterToClone.Udc;

            QuerySourceType = quickParameterToClone.QuerySourceType;

            ObjectType = quickParameterToClone.ObjectType;

            ObjectTypes = quickParameterToClone.ObjectTypes;

            CommunityID = quickParameterToClone.CommunityID;

            Communities = quickParameterToClone.Communities;

            UserID = quickParameterToClone.UserID;

            TagID = quickParameterToClone.TagID;

            Tags1 = quickParameterToClone.Tags1;

            Tags2 = quickParameterToClone.Tags2;

            Tags3 = quickParameterToClone.Tags3;

            RawTags1 = quickParameterToClone.RawTags1;

            RawTags2 = quickParameterToClone.RawTags2;

            RawTags3 = quickParameterToClone.RawTags3;

            GroupID = quickParameterToClone.GroupID;

            SortBy = quickParameterToClone.SortBy;

            Direction = quickParameterToClone.Direction;

            SortBySecond = quickParameterToClone.SortBySecond;

            DirectionSecond = quickParameterToClone.DirectionSecond;

            CatalogSearchType = quickParameterToClone.CatalogSearchType;

            Amount = quickParameterToClone.Amount;

            PageNumber = quickParameterToClone.PageNumber;

            PageSize = quickParameterToClone.PageSize;

            DisablePaging = quickParameterToClone.DisablePaging;

            CurrentObjectID = quickParameterToClone.CurrentObjectID;

            ObjectStatus = quickParameterToClone.ObjectStatus;

            ShowState = quickParameterToClone.ShowState;

            FromInserted = quickParameterToClone.FromInserted;

            ToInserted = quickParameterToClone.ToInserted;

            IgnoreCache = quickParameterToClone.IgnoreCache;

            CachingTimeInMinutes = quickParameterToClone.CachingTimeInMinutes;

            Featured = quickParameterToClone.Featured;

            WithCopy = quickParameterToClone.WithCopy;

            FromStartDate = quickParameterToClone.FromStartDate;

            ToStartDate = quickParameterToClone.ToStartDate;

            FromEndDate = quickParameterToClone.FromEndDate;

            ToEndDate = quickParameterToClone.ToEndDate;

            DateQueryMethode = quickParameterToClone.DateQueryMethode;

            Country = quickParameterToClone.Country;

            Zip = quickParameterToClone.Zip;

            City = quickParameterToClone.City;

            GeoLat = quickParameterToClone.GeoLat;

            GeoLong = quickParameterToClone.GeoLong;

            DistanceKm = quickParameterToClone.DistanceKm;

            ParentObjectID = quickParameterToClone.ParentObjectID;

            CheckUserRoleRight = quickParameterToClone.CheckUserRoleRight;

            OnlyConverted = quickParameterToClone.OnlyConverted;

            IncludeGroups = quickParameterToClone.IncludeGroups;

            OnlyGeoTagged = quickParameterToClone.OnlyGeoTagged;

            OnlyWithImage = quickParameterToClone.OnlyWithImage;

            Nickname = quickParameterToClone.Nickname;

            Title = quickParameterToClone.Title;

            TitleLeftChar = quickParameterToClone.TitleLeftChar;

            Description = quickParameterToClone.Description;

            UserSearch = quickParameterToClone.UserSearch;

            GeneralSearch = quickParameterToClone.GeneralSearch;

            ObjectID = quickParameterToClone.ObjectID;

            PageTotal = quickParameterToClone.PageTotal;

            ItemTotal = quickParameterToClone.ItemTotal;
        }
Exemple #5
0
 public static DataObjectList <T> Load <T>(QuickParameters quickParameters) where T : Business.DataObject, new()
 {
     return(Data.DataObjects.Load <T>(quickParameters));
 }
Exemple #6
0
        public static string GetFeed(QuickParameters quickParameters, string type)
        {
            string urlPrefix = System.Configuration.ConfigurationManager.AppSettings["HostName"] + HttpContext.Current.Request.ApplicationPath;

            UserDataContext udc = UserDataContext.GetUserDataContext();

            quickParameters.Udc         = udc;
            quickParameters.ObjectTypes = QuickParameters.GetDelimitedObjectTypeIDs(rssEngineConfig.ObjectTypes, ',');
            quickParameters.SortBy      = QuickSort.StartDate;
            //quickParameters.FromStartDate = DateTime.Now - new TimeSpan(rssEngineConfig.Days, 0, 0, 0);
            quickParameters.Amount   = rssEngineConfig.MaxItems;
            quickParameters.PageSize = rssEngineConfig.MaxItems;

            StringBuilder   sb;
            List <string>   titleSegments = new List <string>();
            SyndicationFeed feed          = new SyndicationFeed();

            if (quickParameters.CommunityID.HasValue)
            {
                DataObjectCommunity channelCommunity = DataObject.Load <DataObjectCommunity>(quickParameters.CommunityID);
                if (channelCommunity.State != ObjectState.Added)
                {
                    if (channelCommunity.ObjectType == Helper.GetObjectTypeNumericID("ProfileCommunity"))
                    {
                        titleSegments.Add(string.Format("Von {0}", channelCommunity.Nickname));
                    }
                    else
                    {
                        titleSegments.Add(string.Format("Von {0}", channelCommunity.Title));
                    }
                }
            }
            else if (quickParameters.UserID.HasValue)
            {
                Business.DataObjectUser channelUser = DataObject.Load <DataObjectUser>(quickParameters.UserID);
                if (channelUser.State != ObjectState.Added)
                {
                    titleSegments.Add(string.Format("Von {0}", channelUser.Nickname));
                }
            }
            if (!string.IsNullOrEmpty(quickParameters.RawTags1) || !string.IsNullOrEmpty(quickParameters.RawTags2) || !string.IsNullOrEmpty(quickParameters.RawTags3))
            {
                titleSegments.Add(string.Format("Tags {0}", Helper.GetTagWordString(new List <string>()
                {
                    quickParameters.RawTags1, quickParameters.RawTags2, quickParameters.RawTags3
                })));
            }

            sb = new StringBuilder();
            if (titleSegments.Count > 0)
            {
                for (int i = 0; i < titleSegments.Count; i++)
                {
                    sb.Append(titleSegments[i]);
                    if (i < titleSegments.Count - 1)
                    {
                        sb.Append(", ");
                    }
                }
            }
            else
            {
                sb.Append("Alles");
            }
            string title       = string.Format("{0} Feed - {1}", siteName, sb.ToString());
            string description = "RSS Feed von " + siteName;

            feed.Title       = TextSyndicationContent.CreatePlaintextContent(title);
            feed.Description = TextSyndicationContent.CreatePlaintextContent(description);
            feed.Links.Add(new SyndicationLink(new Uri(urlPrefix)));
            feed.Language = "de-CH";

            List <SyndicationItem>      items    = new List <SyndicationItem>();
            DataObjectList <DataObject> rssItems = DataObjects.Load <DataObject>(quickParameters);

            foreach (DataObject rssItem in rssItems)
            {
                SyndicationItem item = new SyndicationItem();

                // Add prefix to title
                item.Title = TextSyndicationContent.CreatePlaintextContent("[" + Helper.GetObjectName(rssItem.ObjectType, true) + "] " + rssItem.Title);

                // Set owner as author
                SyndicationPerson author = new SyndicationPerson();
                author.Name = rssItem.Nickname;
                item.Authors.Add(author);

                // Set object's guid
                item.Id = rssItem.objectID.Value.ToString();

                // Link to the object
                string itemUrl = urlPrefix + Helper.GetDetailLink(rssItem.ObjectType, rssItem.objectID.Value.ToString());
                item.AddPermalink(new Uri(itemUrl));

                // Take start date as publish date
                item.PublishDate = rssItem.StartDate;

                // Image if available
                if (!string.IsNullOrEmpty(rssItem.GetImage(PictureVersion.S)) && rssItem.GetImage(PictureVersion.S).ToLower() != Helper.GetDefaultURLImageSmall(rssItem.ObjectType).ToLower())
                {
                    item.Content = SyndicationContent.CreateXhtmlContent("<div><a href=\"" + itemUrl + "\"><img src=\"" + System.Configuration.ConfigurationManager.AppSettings["MediaDomainName"] + rssItem.GetImage(PictureVersion.S) + "\"></a></div><div>" + rssItem.Description.StripHTMLTags().CropString(rssEngineConfig.MaxDescriptionLength) + "</div>");
                }
                else
                {
                    item.Content = TextSyndicationContent.CreatePlaintextContent(rssItem.Description.StripHTMLTags().CropString(rssEngineConfig.MaxDescriptionLength));
                }

                items.Add(item);
            }

            feed.Items = items;

            sb = new StringBuilder();
            XmlWriter xmlWriter = XmlWriter.Create(sb);

            if (type == "rss")
            {
                feed.SaveAsRss20(xmlWriter);
            }
            else if (type == "atom")
            {
                feed.SaveAsAtom10(xmlWriter);
            }
            xmlWriter.Close();

            string feedXml = sb.ToString();

            feedXml = Regex.Replace(feedXml, @"^<.*?xml.*?>\s*", "");
            return(feedXml);
        }
 public override string GetOrderBySQL(QuickParameters qParas, SqlParameterCollection parameters)
 {
     return(Data.DataObjectLocation.GetOrderBySQL());
 }
Exemple #8
0
        public static string GetPlaylistFeed(Guid?objectId, VideoFormat videoFormat, VideoVersion videoVersion)
        {
            UserDataContext udc = UserDataContext.GetUserDataContext();

            DataObjectVideo     dataObjectVideo = DataObject.Load <DataObjectVideo>(objectId);
            DataObjectCommunity community       = DataObject.Load <DataObjectCommunity>(dataObjectVideo.CommunityID);

            QuickParameters quickParameters = new QuickParameters();

            quickParameters.Udc        = udc;
            quickParameters.ObjectType = Helper.GetObjectTypeNumericID("Video");
            quickParameters.SortBy     = QuickSort.StartDate;
            quickParameters.Amount     = 100;
            quickParameters.PageSize   = 100;
            quickParameters.PageNumber = 1;
            quickParameters.ShowState  = ObjectShowState.Published;
            if (community.ObjectType == Helper.GetObjectTypeNumericID("Community"))
            {
                quickParameters.CommunityID = community.ObjectID;
            }
            else if (community.ObjectType == Helper.GetObjectTypeNumericID("ProfileCommunity"))
            {
                quickParameters.UserID = community.UserID;
            }

            MediaSyndicationFeed feed = new MediaSyndicationFeed();

            string title = string.Empty;

            if (community.ObjectType == Helper.GetObjectTypeNumericID("Community"))
            {
                title = "Video aus " + community.Title;
            }
            else if (community.ObjectType == Helper.GetObjectTypeNumericID("ProfileCommunity"))
            {
                title = "Videos von " + community.Nickname;
            }

            feed.Title = TextSyndicationContent.CreatePlaintextContent(title);

            //feed.Description = TextSyndicationContent.CreatePlaintextContent("");
            string feedUrl = SiteConfig.SiteURL + Helper.GetDetailLink(community.ObjectType, community.ObjectID.Value.ToString());

            feed.Links.Add(new SyndicationLink(new Uri(feedUrl)));
            feed.Language = "de-CH";

            List <SyndicationItem>           items  = new List <SyndicationItem>();
            DataObjectList <DataObjectVideo> videos = DataObjects.Load <DataObjectVideo>(quickParameters);

            foreach (DataObjectVideo video in videos)
            {
                MediaSyndicationItem item = new MediaSyndicationItem();

                item.MediaContentUrl      = new Uri(string.Format("{0}{1}", Helper.GetVideoBaseURL(), video.GetLocation(videoFormat, videoVersion)));
                item.MediaContentDuration = video.DurationSecond;
                item.MediaContentType     = "video/x-flv";
                item.MediaThumbnailUrl    = new Uri(string.Format("{0}{1}", SiteConfig.MediaDomainName, video.GetImage(PictureVersion.S)));
                item.MediaKeywords        = video.TagList.Replace(Constants.TAG_DELIMITER.ToString(), ", ");
                item.MediaCredit          = video.Nickname;

                item.Title = TextSyndicationContent.CreatePlaintextContent(video.Title.StripHTMLTags());

                item.Id = video.ObjectID.Value.ToString();

                string itemUrl = SiteConfig.SiteURL + Helper.GetDetailLink(video.ObjectType, video.ObjectID.Value.ToString());
                item.AddPermalink(new Uri(itemUrl));

                item.PublishDate = video.StartDate;

                items.Add(item);
            }

            feed.Items = items;

            StringBuilder     sb       = new StringBuilder();
            XmlWriterSettings settings = new XmlWriterSettings();

            settings.Indent = true;
            XmlWriter xmlWriter = XmlWriter.Create(sb, settings);

            feed.SaveAsRss20(xmlWriter);
            xmlWriter.Close();

            string feedXml = sb.ToString();

            feedXml = Regex.Replace(feedXml, @"^<.*?xml.*?>\s*", "");
            return(feedXml);
        }