示例#1
0
 private void UpdateGroupAndSeriesForEpisode(AnimeEpisodeVM ep)
 {
     try
     {
         // update the attached series
         JMMServerBinary.Contract_AnimeSeries serContract = JMMServerVM.Instance.clientBinaryHTTP.GetSeries(ep.AnimeSeriesID, JMMServerVM.Instance.CurrentUser.JMMUserID.Value);
         AnimeSeriesVM ser = AllSeriesDictionary.SureGet(serContract.AnimeSeriesID);
         if (ser != null)
         {
             ser.Populate(serContract);
             // TODO update the episode list
         }
         List <JMMServerBinary.Contract_AnimeGroup> grps = JMMServerVM.Instance.clientBinaryHTTP.GetAllGroupsAboveSeries(ep.AnimeSeriesID, JMMServerVM.Instance.CurrentUser.JMMUserID.Value);
         foreach (JMMServerBinary.Contract_AnimeGroup grpContract in grps)
         {
             AnimeGroupVM agrp = AllGroupsDictionary.SureGet(grpContract.AnimeGroupID);
             agrp?.Populate(grpContract);
             agrp?.PopulateSerieInfo(AllGroupsDictionary, AllSeriesDictionary);
         }
     }
     catch (Exception ex)
     {
         Utils.ShowErrorMessage(ex);
     }
 }
示例#2
0
        public AnimeSeriesVM GetSeriesForEpisode(AnimeEpisodeVM ep)
        {
            try
            {
                return(AllSeriesDictionary.SureGet(ep.AnimeSeriesID));
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }

            return(null);
        }
示例#3
0
 private void UpdateGroupAndSeriesForEpisode(VM_AnimeEpisode_User ep)
 {
     try
     {
         UpdateAll();
         VM_AnimeSeries_User ser = AllSeriesDictionary.SureGet(ep.AnimeSeriesID);
         if (ser != null)
         {
             UpdateAboveGroups(ser);
         }
     }
     catch (Exception ex)
     {
         Utils.ShowErrorMessage(ex);
     }
 }
示例#4
0
        public void UpdateHeirarchy(VideoDetailedVM vid)
        {
            try
            {
                // get the episodes that this file applies to
                List <JMMServerBinary.Contract_AnimeEpisode> eps = JMMServerVM.Instance.clientBinaryHTTP.GetEpisodesForFile(vid.VideoLocalID,
                                                                                                                            JMMServerVM.Instance.CurrentUser.JMMUserID.Value);
                foreach (JMMServerBinary.Contract_AnimeEpisode epcontract in eps)
                {
                    AnimeSeriesVM thisSeries = AllSeriesDictionary.SureGet(epcontract.AnimeSeriesID);

                    // update the episodes
                    if (thisSeries != null && thisSeries.AnimeSeriesID.HasValue && thisSeries.AnimeSeriesID.Value == epcontract.AnimeSeriesID)
                    {
                        foreach (AnimeEpisodeVM ep in thisSeries.AllEpisodes)
                        {
                            if (ep.AnimeEpisodeID == epcontract.AnimeEpisodeID)
                            {
                                ep.Populate(epcontract);

                                // update the attached videos
                                List <JMMServerBinary.Contract_VideoDetailed> contracts = JMMServerVM.Instance.clientBinaryHTTP.GetFilesForEpisode(ep.AnimeEpisodeID,
                                                                                                                                                   JMMServerVM.Instance.CurrentUser.JMMUserID.Value);
                                foreach (JMMServerBinary.Contract_VideoDetailed vidcontract in contracts)
                                {
                                    if (vid.VideoLocalID == vidcontract.VideoLocalID)
                                    {
                                        vid.Populate(vidcontract);
                                        break;
                                    }
                                }

                                // update all the attached groups
                                UpdateGroupAndSeriesForEpisode(ep);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
        }
示例#5
0
        public void UpdateHeirarchy(VM_VideoDetailed vid)
        {
            try
            {
                // get the episodes that this file applies to
                List <VM_AnimeEpisode_User> eps = VM_ShokoServer.Instance.ShokoServices.GetEpisodesForFile(vid.VideoLocalID,
                                                                                                           VM_ShokoServer.Instance.CurrentUser.JMMUserID).CastList <VM_AnimeEpisode_User>();
                foreach (VM_AnimeEpisode_User epcontract in eps)
                {
                    VM_AnimeSeries_User thisSeries = AllSeriesDictionary.SureGet(epcontract.AnimeSeriesID);

                    // update the episodes
                    if (thisSeries != null && thisSeries.AnimeSeriesID != 0 && thisSeries.AnimeSeriesID == epcontract.AnimeSeriesID)
                    {
                        foreach (VM_AnimeEpisode_User ep in thisSeries.AllEpisodes)
                        {
                            if (ep.AnimeEpisodeID == epcontract.AnimeEpisodeID)
                            {
                                ep.Populate(epcontract);

                                // update the attached videos
                                IEnumerable <VM_VideoDetailed> vids = VM_ShokoServer.Instance.ShokoServices.GetFilesForEpisode(ep.AnimeEpisodeID, VM_ShokoServer.Instance.CurrentUser.JMMUserID).Cast <VM_VideoDetailed>();
                                foreach (VM_VideoDetailed vidcontract in vids)
                                {
                                    if (vid.VideoLocalID == vidcontract.VideoLocalID)
                                    {
                                        vid.Populate(vidcontract);
                                        break;
                                    }
                                }

                                // update all the attached groups
                                UpdateGroupAndSeriesForEpisode(ep);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
        }
示例#6
0
        public VM_AnimeSeries_User GetSeriesForVideo(int videoLocalID)
        {
            try
            {
                // get the episodes that this file applies to
                foreach (CL_AnimeEpisode_User epcontract in VM_ShokoServer.Instance.ShokoServices.GetEpisodesForFile(videoLocalID, VM_ShokoServer.Instance.CurrentUser.JMMUserID))
                {
                    VM_AnimeSeries_User thisSeries = AllSeriesDictionary.SureGet(epcontract.AnimeSeriesID);
                    if (thisSeries != null)
                    {
                        return(thisSeries);
                    }
                }
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }

            return(null);
        }
示例#7
0
        public AnimeSeriesVM GetSeriesForVideo(int videoLocalID)
        {
            try
            {
                // get the episodes that this file applies to
                List <JMMServerBinary.Contract_AnimeEpisode> eps = JMMServerVM.Instance.clientBinaryHTTP.GetEpisodesForFile(videoLocalID, JMMServerVM.Instance.CurrentUser.JMMUserID.Value);
                foreach (JMMServerBinary.Contract_AnimeEpisode epcontract in eps)
                {
                    AnimeSeriesVM thisSeries = AllSeriesDictionary.SureGet(epcontract.AnimeSeriesID);
                    if (thisSeries != null)
                    {
                        return(thisSeries);
                    }
                }
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }

            return(null);
        }