public void CreateExampleMusicAndTimelineData(int accountid, List <Image> images) { try { // Copy the music for the example Music music1 = CreateExampleMusic(accountid, "Music Example 1", "musicexample1.mp3", "1B36982F-4101-4D38-AF20-FAD88A0FA9B5.mp3", "Example Music"); Music music2 = CreateExampleMusic(accountid, "Music Example 2", "musicexample2.mp3", "ADA2DBFA-D8D9-49A8-8370-8329A830667E.mp3", "Example Music"); Music music3 = CreateExampleMusic(accountid, "Music Example 3", "musicexample3.mp3", "E4B660F0-ACD3-44F1-92EE-FA23110BE5C6.mp3", "Example Music"); List <Music> musics = new List <Music> { music1, music2, music3 }; // Create the example timeline ITimelineRepository tlrep = new EntityTimelineRepository(); Timeline timeline = new Timeline(); timeline.AccountID = accountid; timeline.TimelineName = "Timeline Example"; timeline.Tags = "Examples"; timeline.IsActive = true; timeline.MuteMusicOnPlayback = true; timeline.DurationInSecs = 10; tlrep.CreateTimeline(timeline); // Create the timeline music xrefs ITimelineMusicXrefRepository mxrefrep = new EntityTimelineMusicXrefRepository(); int i = 1; foreach (Music music in musics) { TimelineMusicXref mxref = new TimelineMusicXref(); mxref.TimelineID = timeline.TimelineID; mxref.MusicID = music.MusicID; mxref.PlayOrder = i; mxrefrep.CreateTimelineMusicXref(mxref); i = +1; } // Create the timeline image xrefs ITimelineImageXrefRepository ixrefrep = new EntityTimelineImageXrefRepository(); i = 1; foreach (Image image in images) { TimelineImageXref ixref = new TimelineImageXref(); ixref.TimelineID = timeline.TimelineID; ixref.ImageID = image.ImageID; ixref.DisplayOrder = i; ixrefrep.CreateTimelineImageXref(ixref); i = +1; } } catch { } }
// // GET: /Screen/ public ActionResult Index() { try { if (Session["UserAccountID"] == null) return RedirectToAction("Validate", "Login"); User user = (User)Session["User"]; ViewData["LoginInfo"] = Utility.BuildUserAccountString(user.Username, Convert.ToString(Session["UserAccountName"])); if (user.IsAdmin) ViewData["txtIsAdmin"] = "true"; else ViewData["txtIsAdmin"] = "false"; // Initialize or get the page state using session ScreenPageState pagestate = GetPageState(); // Get the account id int accountid = 0; if (Session["UserAccountID"] != null) accountid = Convert.ToInt32(Session["UserAccountID"]); // Set and save the page state to the submitted form values if any values are passed if (Request.Form["lstAscDesc"] != null) { pagestate.AccountID = accountid; pagestate.ScreenName = Request.Form["txtScreenName"].ToString().Trim(); pagestate.Description = Request.Form["txtDescription"].ToString().Trim(); if (Request.Form["chkIncludeInactive"].ToLower().StartsWith("true")) pagestate.IncludeInactive = true; else pagestate.IncludeInactive = false; pagestate.SortBy = Request.Form["lstSortBy"].ToString().Trim(); pagestate.AscDesc = Request.Form["lstAscDesc"].ToString().Trim(); pagestate.PageNumber = Convert.ToInt32(Request.Form["txtPageNumber"].ToString().Trim()); SavePageState(pagestate); } // Add the session values to the view data so they can be populated in the form ViewData["AccountID"] = pagestate.AccountID; ViewData["ScreenName"] = pagestate.ScreenName; ViewData["Description"] = pagestate.Description; ViewData["IncludeInactive"] = pagestate.IncludeInactive; ViewData["SortBy"] = pagestate.SortBy; ViewData["SortByList"] = new SelectList(BuildSortByList(), "Value", "Text", pagestate.SortBy); ViewData["AscDescList"] = new SelectList(BuildAscDescList(), "Value", "Text", pagestate.AscDesc); // Determine asc/desc bool isdescending = false; if (pagestate.AscDesc.ToLower().StartsWith("d")) isdescending = true; // Get a Count of all filtered records int recordcount = repository.GetScreenRecordCount(pagestate.AccountID, pagestate.ScreenName, pagestate.Description, pagestate.IncludeInactive); // Determine the page count int pagecount = 1; if (recordcount > 0) { pagecount = recordcount / Constants.PageSize; if (recordcount % Constants.PageSize != 0) // Add a page if there are more records { pagecount = pagecount + 1; } } // Make sure the current page is not greater than the page count if (pagestate.PageNumber > pagecount) { pagestate.PageNumber = pagecount; SavePageState(pagestate); } // Set the page number and account in viewdata ViewData["PageNumber"] = Convert.ToString(pagestate.PageNumber); ViewData["PageCount"] = Convert.ToString(pagecount); ViewData["RecordCount"] = Convert.ToString(recordcount); // We need to add the Main Feature Type and Name, and the Screen Content Names IEnumerable<Screen> screens = repository.GetScreenPage(pagestate.AccountID, pagestate.ScreenName, pagestate.Description, pagestate.IncludeInactive, pagestate.SortBy, isdescending, pagestate.PageNumber, pagecount); List<ScreenWizardView> screenwizardviews = new List<ScreenWizardView>(); ISlideShowRepository ssrep = new EntitySlideShowRepository(); IPlayListRepository plrep = new EntityPlayListRepository(); ITimelineRepository tlrep = new EntityTimelineRepository(); IScreenScreenContentXrefRepository sscxrep = new EntityScreenScreenContentXrefRepository(); IScreenContentRepository screp = new EntityScreenContentRepository(); IScreenContentTypeRepository sctrep = new EntityScreenContentTypeRepository(); foreach (Screen screen in screens) { ScreenWizardView swv = new ScreenWizardView(); swv.ScreenID = screen.ScreenID; swv.AccountID = screen.AccountID; swv.ScreenName = screen.ScreenName; swv.ScreenDescription = screen.ScreenDescription; if (screen.SlideShowID > 0) { swv.MainFeatureType = "Slide Show"; swv.MainFeatureName = ssrep.GetSlideShow(screen.SlideShowID).SlideShowName; } else if (screen.PlayListID > 0) { swv.MainFeatureType = "Play List"; swv.MainFeatureName = plrep.GetPlayList(screen.PlayListID).PlayListName; } else if (screen.TimelineID > 0) { swv.MainFeatureType = "Media Timeline"; swv.MainFeatureName = tlrep.GetTimeline(screen.TimelineID).TimelineName; } if (screen.IsInteractive) { IEnumerable<ScreenScreenContentXref> sscxs = sscxrep.GetScreenScreenContentXrefs(screen.ScreenID); foreach (ScreenScreenContentXref sscx in sscxs) { string contentinfo = String.Empty; ScreenContent sc = screp.GetScreenContent(sscx.ScreenContentID); contentinfo = "'" + sc.ScreenContentName + "'"; ScreenContentType sctype = sctrep.GetScreenContentType(sc.ScreenContentTypeID); contentinfo += " (" + sctype.ScreenContentTypeName + ")"; if (!String.IsNullOrEmpty(swv.InteractiveContent)) swv.InteractiveContent += ", "; swv.InteractiveContent += contentinfo; } } swv.IsActive = screen.IsActive; screenwizardviews.Add(swv); } ViewResult result = View(screenwizardviews); result.ViewName = "Index"; return result; } catch (Exception ex) { Helpers.SetupApplicationError("Screen", "Index", ex.Message); return RedirectToAction("Index", "ApplicationError"); } }
public void CreateExampleMusicAndTimelineData(int accountid, List<Image> images) { try { // Copy the music for the example Music music1 = CreateExampleMusic(accountid, "Music Example 1", "musicexample1.mp3", "1B36982F-4101-4D38-AF20-FAD88A0FA9B5.mp3", "Example Music"); Music music2 = CreateExampleMusic(accountid, "Music Example 2", "musicexample2.mp3", "ADA2DBFA-D8D9-49A8-8370-8329A830667E.mp3", "Example Music"); Music music3 = CreateExampleMusic(accountid, "Music Example 3", "musicexample3.mp3", "E4B660F0-ACD3-44F1-92EE-FA23110BE5C6.mp3", "Example Music"); List<Music> musics = new List<Music> { music1, music2, music3 }; // Create the example timeline ITimelineRepository tlrep = new EntityTimelineRepository(); Timeline timeline = new Timeline(); timeline.AccountID = accountid; timeline.TimelineName = "Timeline Example"; timeline.Tags = "Examples"; timeline.IsActive = true; timeline.MuteMusicOnPlayback = true; timeline.DurationInSecs = 10; tlrep.CreateTimeline(timeline); // Create the timeline music xrefs ITimelineMusicXrefRepository mxrefrep = new EntityTimelineMusicXrefRepository(); int i = 1; foreach (Music music in musics) { TimelineMusicXref mxref = new TimelineMusicXref(); mxref.TimelineID = timeline.TimelineID; mxref.MusicID = music.MusicID; mxref.PlayOrder = i; mxrefrep.CreateTimelineMusicXref(mxref); i = +1; } // Create the timeline image xrefs ITimelineImageXrefRepository ixrefrep = new EntityTimelineImageXrefRepository(); i = 1; foreach (Image image in images) { TimelineImageXref ixref = new TimelineImageXref(); ixref.TimelineID = timeline.TimelineID; ixref.ImageID = image.ImageID; ixref.DisplayOrder = i; ixrefrep.CreateTimelineImageXref(ixref); i = +1; } } catch { } }
private List<SelectListItem> BuildTimelineList() { // Get the account id int accountid = 0; if (Session["UserAccountID"] != null) accountid = Convert.ToInt32(Session["UserAccountID"]); // Build the timeline list List<SelectListItem> items = new List<SelectListItem>(); ITimelineRepository tlrep = new EntityTimelineRepository(); IEnumerable<Timeline> tls = tlrep.GetAllTimelines(accountid); foreach (Timeline tl in tls) { SelectListItem item = new SelectListItem(); item.Text = tl.TimelineName; item.Value = tl.TimelineID.ToString(); items.Add(item); } if (items.Count == 0) { SelectListItem item = new SelectListItem(); item.Text = "No media timelines available"; item.Value = "0"; items.Add(item); } return items; }