public bool UpdateLiveVideos(LiveVideo lv)
    {
        DataClassesDBDataContext db = new DataClassesDBDataContext();
        db.LiveVideos.Attach(lv, GetLiveVideoById(lv.id));
        db.SubmitChanges();

        return true;
    }
    public bool UpdateLiveVideosDesc(String desc, int id)
    {
        DataClassesDBDataContext db = new DataClassesDBDataContext();
        LiveVideo lv = new LiveVideo();
        lv.desc = desc;
        lv.id = id;
        
        db.LiveVideos.Attach(lv, GetLiveVideoById(id));
        db.SubmitChanges();

        return true;
    }
Beispiel #3
0
        protected override void ProcessHTML()
        {
            if (HtmlDoc != null && HtmlDoc.HasData)
            {
                string               firstItem  = string.Empty;
                List <LiveVideo>     items      = new List <LiveVideo>();
                List <ParseDataItem> components = null;
                // if the 2 lines below are Andrea's doing - they don't work or function as she intended
                //IEnumerable<ParseDataItem> htmlItems = HtmlDoc.Items.Where(x => !x.Header.ToUpper().Contains("DEFINITION"));
                //IEnumerable<ParseDataItem> toSearch = htmlItems.Count() > 1 ? htmlItems : htmlItems.ElementAt(0).Children;
                IEnumerable <ParseDataItem> toSearch = HtmlDoc.Items.Count() > 1 ? HtmlDoc.Items : HtmlDoc.Items.ElementAt(0).Children;
                if (toSearch != null && toSearch.Any())
                {
                    foreach (ParseDataItem item in toSearch)
                    {
                        if (!item.Header.Trim().ToUpper().Equals("MEDIA"))
                        {
                            if (string.IsNullOrEmpty(firstItem))
                            {
                                firstItem = item.Header;
                            }

                            if (item.Header.Equals(firstItem) && components != null && components.Any())
                            {
                                LiveVideo newItem = new LiveVideo(Logger, DisplaySectionName, components);
                                if (newItem.HasData)
                                {
                                    items.Add(newItem);
                                }
                                components = null;
                            }
                            if (components == null)
                            {
                                components = new List <ParseDataItem>();
                            }
                            components.Add(item);
                        }
                    }

                    if (components != null && components.Any())
                    {
                        LiveVideo newItem = new LiveVideo(Logger, DisplaySectionName, components);
                        if (newItem.HasData)
                        {
                            items.Add(newItem);
                        }
                    }

                    if (items.Count == 0)
                    {
                        throw new SectionEmptyException(DisplaySectionName);
                    }

                    Items = items;
                }
            }

            if (!HasData)
            {
                throw new SectionEmptyException(DisplaySectionName);
            }
        }