public void SetValues(ChartData chartData, string state) { this.InitializeComponent(); _values = new ChartValues <GanttPoint>(); _values.Clear(); var labels = new List <string>(); foreach (Activity activity in chartData.GetActivities()) { if (activity.State == state || state == "all") { _values.Add(new GanttPoint(activity.StartDate.Ticks, activity.EndDate.Ticks)); labels.Add(activity.Name); } } Series = new SeriesCollection { new RowSeries { Values = _values, DataLabels = true, } }; ResetZoomOnClick(null, null); Formatter = value => new DateTime((long)value).ToString("dd/MM HH:mm"); Labels = labels.ToArray(); DataContext = new SeriesViewModel(); DataContext = this; }
public ActionResult Edit(int id) { var series = db.Series.Find(id); List<Role> characters = db.Characters.Where(x => x.SeriesId == id).ToList(); string actorList = ToActorList(characters); var model = new SeriesViewModel() { Series = series, ActorList = actorList }; var seriesGenres = db.SeriesGenres.Where(x => x.SeriesId == id).ToList(); var genres = new List<Genre>(); foreach (var seriesGenre in seriesGenres) { var genre = db.Genres.Find(seriesGenre.GenreName); genres.Add(genre); } var allGenres = GetAllGenres(); var checkBoxListItems = new List<CheckBoxListItem>(); foreach (var genre in allGenres) { checkBoxListItems.Add(new CheckBoxListItem() { ID = 0, Display = genre.Name, //We should have already-selected genres be checked IsChecked = genres.Where(x => x.Name == genre.Name).Any() }); } model.Genres = checkBoxListItems; return View(model); }
public VideoCreatorPage(SeriesViewModel series) : this() { this.DataContext = this.CreatorViewModel = new VideoCreatorViewModel(series); this.EditVideoUserControl.ViewModel.Parent = series; this.EditVideoUserControl.ViewModel.CreateMode(); this.EditVideoUserControl.ViewModel.Created += this.ViewModel_Created; }
public SeriesEditorWindow Initialize(SeriesViewModel series) { JasilyDebug.Pointer(); this.EditSeriesUserControl.ViewModel.Updated += this.ViewModel_Updated; JasilyDebug.Pointer(); this.EditSeriesUserControl.ViewModel.ModifyMode(series); JasilyDebug.Pointer(); return(this); }
public SeriesEditorWindow Initialize(SeriesViewModel series) { JasilyDebug.Pointer(); this.EditSeriesUserControl.ViewModel.Updated += this.ViewModel_Updated; JasilyDebug.Pointer(); this.EditSeriesUserControl.ViewModel.ModifyMode(series); JasilyDebug.Pointer(); return this; }
public IActionResult Index() { // Get all series from the database SeriesViewModel movieViewModel = new SeriesViewModel(); movieViewModel.allSeries = _seriesRepository.GetAll; return(View(movieViewModel)); }
public ActionResult Edit(SeriesViewModel model) { var selectedGenres = model.Genres.Where(x => x.IsChecked).Select(x => x.Display).ToList(); try { Series series = db.Series.Find(model.Series.SeriesId); if (TryUpdateModel(series)) { var toDelete = db.SeriesGenres.Where(x => selectedGenres.Contains(x.GenreName) == false && x.SeriesId == series.SeriesId).ToList(); foreach (var item in toDelete) { db.SeriesGenres.Remove(item); } var alreadyIn = db.SeriesGenres.Where(x => selectedGenres.Contains(x.GenreName) == true && x.SeriesId == series.SeriesId).ToList(); var genresAlreadyIn = alreadyIn.Select(x => x.GenreName).ToList(); foreach (var genre in selectedGenres) { if (genresAlreadyIn.Contains(genre)) continue; SeriesGenre seriesGenre = new SeriesGenre() { SeriesId = model.Series.SeriesId, GenreName = genre }; db.SeriesGenres.Add(seriesGenre); } foreach (var chr in db.Characters.Where(x => x.SeriesId == model.Series.SeriesId)) { db.Characters.Remove(chr); } List<Role> characers = GetCharacters(model.Series.SeriesId, model.ActorList); foreach (Role role in characers) { db.Characters.Add(role); } series.Title = model.Series.Title; series.NumberOfEpisodes = model.Series.NumberOfEpisodes; series.NumberOfSeasons = model.Series.NumberOfSeasons; db.SaveChanges(); } else { return RedirectToAction("Show", "Series", new { @id = model.Series.SeriesId}); } } catch (Exception e) { return RedirectToAction("Show", "Series", new { @id = model.Series.SeriesId }); } return RedirectToAction("Show", "Series", new { @id = model.Series.SeriesId }); }
public SeriesViewModel GetSeriesById(int id, int?seasonNumber, int?episodeNumber) { Series series = itemRepo.GetSeriesById(id); //If the series is not found in the database, get the series from the API if (series == null) { series = GetSeriesByIdFromApi(id); itemRepo.InsertItem(series); } IEnumerable <CastMember> castMembers = series.ItemCastMembers.Select(ic => ic.CastMember).Distinct().Take(5); IEnumerable <Genre> genres = series.ItemGenres.Select(ig => ig.Genre); IEnumerable <CrewMember> directors = series.ItemCrewMembers.Where(ic => ic.Job == "Director").Select(ic => ic.CrewMember).Distinct(); SeriesViewModel seriesViewModel = null; if (seasonNumber != null) { Season selectedSeason = series.Seasons.Where(s => s.SeasonNumber == seasonNumber).FirstOrDefault(); if (episodeNumber != null) { selectedSeason.Episodes = selectedSeason.Episodes.Where(e => e.EpisodeNumber == episodeNumber).ToList(); } seriesViewModel = new SeriesViewModel { Title = series.Title, Description = series.Description, ReleaseDate = series.ReleaseDate, PosterURL = selectedSeason.PosterPath, BackdropURL = series.BackdropURL, Genres = genres, CastMembers = castMembers, Directors = directors, Seasons = new Season[] { selectedSeason } }; } else { seriesViewModel = new SeriesViewModel { Title = series.Title, Description = series.Description, ReleaseDate = series.ReleaseDate, PosterURL = series.PosterPath, BackdropURL = series.BackdropURL, Genres = genres, CastMembers = castMembers, Directors = directors, Seasons = series.Seasons }; } return(seriesViewModel); }
public async Task <IActionResult> Index() { var series = await seriesLookupDataService.GetSeriesLookupAsync(nameof(SeriesViewModel)); var vm = new SeriesViewModel() { Series = series }; return(View(vm)); }
private void NavigateToSeriesItemViewerPage(SeriesViewModel series) { this.TitleTextBlock.Text = "sure video was not exists"; this.LastButton.Visibility = this.NextButton.Visibility = Visibility.Visible; if (this.seriesItemViewerPage == null || this.seriesItemViewerPage.ViewModel.Source != series.Source) { this.seriesItemViewerPage = new SeriesItemViewerPage(series.Source); } this.ContentFrame.Navigate(this.seriesItemViewerPage); }
public ViewModelLocator() { JoueursViewModel = new JoueursViewModel(); ClubsViewModel = new ClubsViewModel(); SexesViewModel = new SexesViewModel(); TabViewModel = new TabViewModel(); SeriesViewModel = new SeriesViewModel(); ClassementsViewModel = new ClassementsViewModel(); EquipesViewModel = new EquipesViewModel(); MatchsViewModel = new MatchsViewModel(); TableauBordViewModel = new TableauBordViewModel(); }
private void NavigateToCreateVideoPage(SeriesViewModel series) { this.TitleTextBlock.Text = "create video"; this.NextButton.Visibility = Visibility.Hidden; if (this.videoCreatorPage == null || this.videoCreatorPage.CreatorViewModel.Source != series) { this.videoCreatorPage = new VideoCreatorPage(series); } this.ContentFrame.Navigate(this.videoCreatorPage); }
void EditSeriesUserControl_ViewModel_Created(object sender, Series e) { if (this.GetUIDispatcher().CheckAccessOrBeginInvoke(this.EditSeriesUserControl_ViewModel_Created, sender, e)) { if (this.SelectorViewModel != null) { var vm = new SeriesViewModel(e); this.SelectorViewModel.Items.Collection.Add(vm); this.SelectorViewModel.Items.Selected = vm; this.SeriesListView.ScrollIntoView(vm); } } }
public static SelectResult<JryVideoInfo> Select(Window parent, SeriesViewModel source, JryVideoInfo without = null, string defaultId = null) { var dialog = new VideoSelectorWindow() { Owner = parent }; if (without != null) { dialog.SelectVideoControl.ViewModel.Withouts.Add(without.Id); } dialog.SelectVideoControl.Initialize(source, defaultId); return dialog.ShowDialog() == true ? SelectResult<JryVideoInfo>.Selected(dialog.SelectVideoControl.ViewModel.Items.Selected?.Source) : SelectResult<JryVideoInfo>.NonAccept; }
public ActionResult Edit(SeriesViewModel seriesEdit) { Series dbSeries = seriesRepository.GetByID(seriesEdit.ID); if (dbSeries == null) { dbSeries = new Series(); } dbSeries.Name = seriesEdit.Name; seriesRepository.Save(dbSeries); return(RedirectToAction("Index")); }
public IActionResult ListSeries() { var seriesViewModel = new SeriesViewModel() { Series = _context.Series .Include(s => s.Admin) .Include(s => s.District) .Include(s => s.SeriesStatus) .ToList() }; return(View(seriesViewModel)); }
private async Task NavigateToCreateVideoPage(SeriesViewModel series) { this.TitleTextBlock.Text = "create video"; this.NextButton.Visibility = Visibility.Hidden; if (this.videoCreatorPage == null || this.videoCreatorPage.CreatorViewModel.Source != series.Source) { this.videoCreatorPage = new VideoCreatorPage(series.Source); } this.ContentFrame.Navigate(this.videoCreatorPage); await this.videoCreatorPage.CreatorViewModel.LoadAsync(); }
public static SeriesViewModel ConvertToViewModel(Series dbModel) { var viewModel = new SeriesViewModel { SeriesName = dbModel.SeriesName }; foreach (var dbBook in dbModel.BookSeries.OrderBy(bs => bs.Ordinal)) { viewModel.BookNames.Add(dbBook.Book.BookName ?? string.Empty); } return(viewModel); }
public ActionResult Show(int id) { Series series = db.Series.Find(id); ViewBag.Series = series; ViewBag.afisareButoane = false; ViewBag.Reviews = db.Reviews.Where(x => x.SeriesId == id); var genres = db.SeriesGenres.Where(x => x.SeriesId == id); ViewBag.Genres = ""; foreach (var genre in genres) { if (ViewBag.Genres == "") ViewBag.Genres = genre.GenreName; else ViewBag.Genres += ", " + genre.GenreName; } if (User.IsInRole("Editor") || User.IsInRole("Administrator")) { ViewBag.afisareButoane = true; } ViewBag.esteAdmin = User.IsInRole("Administrator"); ViewBag.Episodes = GetAllEpisodes(id); SeriesViewModel model = new SeriesViewModel { Series = series, Genres = new List<CheckBoxListItem>(), ActorList = "", IsFavourite = false }; string currentUserId = User.Identity.GetUserId(); if (db.FavouriteSeries.Any(u => u.SeriesId == series.SeriesId && currentUserId.Equals(u.UserId))) { model.IsFavourite = true; } else { model.IsFavourite = false; } List<Role> characters = db.Characters.Where(x => x.SeriesId == id).OrderBy(x => x.CharacterName).ToList(); ViewBag.Cast = new List<Tuple<int, string, string>>(); foreach (Role character in characters) { Actor actor = db.Actors.Find(character.ActorId); string actorName = actor.FirstName + " " + actor.LastName; ViewBag.Cast.Add(new Tuple<int, string, string>(character.ActorId, actorName, character.CharacterName)); } return View(model); }
public ActionResult Edit(int id = 0) { Series series = seriesRepository.GetByID(id); SeriesViewModel model = new SeriesViewModel(); if (series != null) { model = new SeriesViewModel { Name = series.Name, ID = series.ID }; } return(View(model)); }
public async Task <ResponseModel> AddSeries(SeriesViewModel series) { await _context.Series.AddAsync(new Series { SeriesName = series.SeriesName.Trim().ToLower(), ReleaseDate = series.ReleaseDate, SeriesDescription = series.SeriesDescription, NumberEpisodes = series.NumberEpisodes, Category = series.Category, SeriesThumbnail = series.SeriesThumbnail }, cancellationToken); await _context.SaveChangesAsync(cancellationToken); return(ResponseModel.ReturnSuccess()); }
private void NavigateToSeriesItemViewerPage(SeriesViewModel series) { Debug.Assert(series != null); this.TitleTextBlock.Text = "sure video was not exists"; this.LastButton.Visibility = this.NextButton.Visibility = Visibility.Visible; if (this.seriesItemViewerPage?.GetCurrentSeriesViewModel() != series) { var page = new SeriesItemViewerPage(); page.SelectVideoControl.OnCommited += this.SelectVideoControl_OnCommited; page.Initialize(series); this.seriesItemViewerPage = page; } this.ContentFrame.Navigate(this.seriesItemViewerPage); }
public ActionResult New() { SeriesViewModel model = new SeriesViewModel(); var allGenres = GetAllGenres(); //returns List<Genre> var checkBoxListItems = new List<CheckBoxListItem>(); foreach (var genre in allGenres) { checkBoxListItems.Add(new CheckBoxListItem() { ID = 0, Display = genre.Name, IsChecked = false //On the add view, no genres are selected by default }); } model.Genres = checkBoxListItems; return View(model); }
private void SetupSeries(S series, string title, List <V> data) { ChartValues <V> values = new ChartValues <V>(); values.AddRange(data); series.Values = values; series.Title = title; Chart.Series.Add(series); SeriesViewModel legendSeries = new SeriesViewModel(); legendSeries.Fill = series.Fill; legendSeries.PointGeometry = series.PointGeometry; legendSeries.Stroke = series.Stroke; legendSeries.StrokeThickness = series.StrokeThickness; legendSeries.Title = series.Title; ((DefaultLegend)Chart.ChartLegend).Series.Add(new SeriesViewModel()); }
public static SelectResult <JryVideoInfo> Select(Window parent, SeriesViewModel source, JryVideoInfo without = null, string defaultId = null) { var dialog = new VideoSelectorWindow() { Owner = parent }; if (without != null) { dialog.SelectVideoControl.ViewModel.Withouts.Add(without.Id); } dialog.SelectVideoControl.Initialize(source, defaultId); return(dialog.ShowDialog() == true ? SelectResult <JryVideoInfo> .Selected(dialog.SelectVideoControl.ViewModel.Items.Selected?.Source) : SelectResult <JryVideoInfo> .NonAccept); }
public ActionResult Index(string searchString) { var model = new SeriesViewModel(); var series = db.Series.OrderBy(x => x.Title).ToList(); if (!String.IsNullOrEmpty(searchString)) { series = db.Series.Where(s => s.Title.Contains(searchString)).ToList(); } ViewBag.Series = series; ViewBag.afisareButoane = false; if (User.IsInRole("Editor") || User.IsInRole("Administrator")) { ViewBag.afisareButoane = true; } return View(model); }
public ActionResult Index() { List <Series> allSeries = new List <Series>(); List <SeriesViewModel> model = new List <SeriesViewModel>(); allSeries = seriesRepository.GetAll(); foreach (var series in allSeries) { SeriesViewModel seriesViewModel = new SeriesViewModel() { Name = series.Name, ID = series.ID }; model.Add(seriesViewModel); } return(View(model)); }
public SeriesViewModelTests() { eventAggregatorMock = new Mock <IEventAggregator>(); seriesLookupServiceMock = new Mock <ISeriesLookupDataService>(); seriesLookupServiceMock.Setup(dp => dp.GetSeriesLookupAsync(nameof(SeriesDetailViewModel))) .ReturnsAsync(new List <LookupItem> { new LookupItem { Id = Guid.NewGuid(), DisplayMember = "A Song of Ice and Fire" }, new LookupItem { Id = Guid.NewGuid(), DisplayMember = "The Powder Mage Trilogy" } }); viewModel = new SeriesViewModel(eventAggregatorMock.Object, seriesLookupServiceMock.Object); }
public ViewResult Detail(int id, int?seasonNumber, int?episodeNumber) { Logger.Log.InfoFormat(Logger.Format + "Request for details for series id: " + id, GetType().ToString()); SeriesViewModel series = seriesManager.GetSeriesById(id, seasonNumber, episodeNumber); if (seasonNumber != null) { ViewBag.Season = true; } if (episodeNumber != null) { ViewBag.Episode = true; } return(View("~/Views/Item/Detail.cshtml", series)); }
public CoreSize LoadLegend() { if (ChartLegend == null || LegendLocation == LegendLocation.None) { return(new CoreSize()); } if (ChartLegend.Parent == null) { Canvas.Children.Add(ChartLegend); } var l = new List <SeriesViewModel>(); for (var i = 0; i < Series.Count; i++) { var item = new SeriesViewModel(); var series = (Series.Series)Series[i]; item.Title = series.Title; item.StrokeThickness = series.StrokeThickness; item.Stroke = series.Stroke ?? new SolidColorBrush(GetDefaultColor(i)); item.Fill = series.Fill ?? new SolidColorBrush(GetDefaultColor(i)) { Opacity = series.DefaultFillOpacity }; l.Add(item); } ChartLegend.Series = l; ChartLegend.InternalOrientation = LegendLocation == LegendLocation.Bottom || LegendLocation == LegendLocation.Top ? Orientation.Horizontal : Orientation.Vertical; ChartLegend.UpdateLayout(); ChartLegend.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity)); return(new CoreSize(ChartLegend.DesiredSize.Width, ChartLegend.DesiredSize.Height)); }
public void Dispose() { if (SpotlightViewModel != null) { SpotlightViewModel.Dispose(); } if (MoviesViewModel != null) { MoviesViewModel.Dispose(); } if (SeriesViewModel != null) { SeriesViewModel.Dispose(); } if (EpisodesViewModel != null) { EpisodesViewModel.Dispose(); } if (GamesViewModel != null) { GamesViewModel.Dispose(); } if (AlbumsViewModel != null) { AlbumsViewModel.Dispose(); } if (SongsViewModel != null) { SongsViewModel.Dispose(); } if (ArtistsViewModel != null) { ArtistsViewModel.Dispose(); } if (MiniSpotlightsViewModel != null) { MiniSpotlightsViewModel.Dispose(); } if (MiniSpotlightsViewModel2 != null) { MiniSpotlightsViewModel2.Dispose(); } }
// GET: View public ActionResult View(int?id, int?videoID) { SeriesViewModel seriesViewModel = null; if (id != null && id > 0) { using (program_phstudiosEntities ctx = new program_phstudiosEntities()) { Series s = ctx.Series.FirstOrDefault(series => series.ID == id); if (s == null) { return(RedirectToAction("Index", "Series")); } List <Resource> seriesResources = (from sr in ctx.SeriesResources join r in ctx.Resources on sr.Resource_ID equals r.ID where sr.Series_ID == s.ID select r).ToList(); List <VideoDetailsModel> videos = ctx.Videos.Where(v => v.Series_ID == s.ID).Select(v => new VideoDetailsModel { Video = v }).ToList(); foreach (VideoDetailsModel videoDetails in videos) { videoDetails.Resources = ctx.VideoResources.Where(vr => vr.Video_ID == videoDetails.Video.ID).Select(vr => vr.Resource).ToList(); } seriesViewModel = new SeriesViewModel { Series = s, SeriesResources = seriesResources, VideoDetails = videos.OrderBy(v => v.Video.Order).ToList() }; } } else { return(RedirectToAction("Index", "Series")); } return(base.View(seriesViewModel)); }
public ActionResult Index() { if (Session["login"] == null) { Response.Redirect("~/"); return(View()); } else { var seriesViewModel = new SeriesViewModel { Series = WatchTimeQueries.GetSeries(), ToWatch = WatchTimeQueries.GetToWatchSeries(Session["login"].ToString()), Watched = WatchTimeQueries.GetWatchedSeries(Session["login"].ToString()), Suggested = WatchTimeQueries.GetSuggestedSeries(Session["login"].ToString(), 5) }; return(View(seriesViewModel)); } }
public VideoCreatorViewModel(SeriesViewModel source) { this.Source = source; this.VideoCollection.AddRange(source.VideoViewModels); }
public CoreSize LoadLegend() { if (ChartLegend == null || LegendLocation == LegendLocation.None) return new CoreSize(); if (ChartLegend.Parent == null) Canvas.Children.Add(ChartLegend); var l = new List<SeriesViewModel>(); foreach (var t in Series) { var item = new SeriesViewModel(); var series = (Series.Series) t; item.Title = series.Title; item.StrokeThickness = series.StrokeThickness; item.Stroke = series.Stroke; item.Fill = series.Fill; l.Add(item); } ChartLegend.Series = l; ChartLegend.InternalOrientation = LegendLocation == LegendLocation.Bottom || LegendLocation == LegendLocation.Top ? Orientation.Horizontal : Orientation.Vertical; ChartLegend.UpdateLayout(); ChartLegend.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity)); return new CoreSize(ChartLegend.DesiredSize.Width, ChartLegend.DesiredSize.Height); }
public TrafficLightChartViewModel() { Series = new SeriesViewModel(); PlotBands = new List<PlotBand>(); }
public void Initialize(SeriesViewModel series, string defaultId = null) => this.SelectVideoControl.Initialize(series, defaultId);
public SpeedometerChartViewModel() { Series = new SeriesViewModel(); PlotBands = new List<PlotBand>(); }
/// <summary> /// Loads the legend. /// </summary> /// <returns></returns> /// <exception cref="LiveCharts.Helpers.LiveChartsException">The current legend is not valid, ensure it implements IChartLegend</exception> public CoreSize LoadLegend() { if (ChartLegend == null || LegendLocation == LegendLocation.None) return new CoreSize(); if (ChartLegend.Parent == null) Canvas.Children.Add(ChartLegend); var l = new List<SeriesViewModel>(); foreach (var t in ActualSeries) { var item = new SeriesViewModel(); var series = (Series) t; item.Title = series.Title; item.StrokeThickness = series.StrokeThickness; item.Stroke = series.Stroke; item.Fill = ((Series) t) is IFondeable && !(t is IVerticalStackedAreaSeriesView || t is IStackedAreaSeriesView) ? ((IFondeable) t).PointForeround : ((Series) t).Fill; item.PointGeometry = series.PointGeometry == DefaultGeometries.None ? new PointGeometry("M 0, 0.5 h 1, 0.5 Z").Parse() : series.PointGeometry.Parse(); l.Add(item); } var iChartLegend = ChartLegend as IChartLegend; if (iChartLegend == null) throw new LiveChartsException("The current legend is not valid, ensure it implements IChartLegend"); iChartLegend.Series = l; var defaultLegend = ChartLegend as DefaultLegend; if (defaultLegend != null) { defaultLegend.InternalOrientation = LegendLocation == LegendLocation.Bottom || LegendLocation == LegendLocation.Top ? Orientation.Horizontal : Orientation.Vertical; defaultLegend.MaxWidth = defaultLegend.InternalOrientation == Orientation.Horizontal ? ActualWidth : double.PositiveInfinity; defaultLegend.MaxHeight = defaultLegend.InternalOrientation == Orientation.Vertical ? ActualHeight : double.PositiveInfinity; } ChartLegend.UpdateLayout(); ChartLegend.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity)); return new CoreSize(ChartLegend.DesiredSize.Width, ChartLegend.DesiredSize.Height); }
public void Initialize(SeriesViewModel series, string defaultId = null) => this.ViewModel.Initialize(series, defaultId);