Пример #1
0
        public static void SetClean(IList lstSelectedItem)
        {
            foreach (ThumbItem item in lstSelectedItem)
            {
                switch (item.EType)
                {
                case EntityType.Apps:
                    Apps objApps = Dal.GetInstance.GetApps(item.Id);
                    AppServices.Clean(objApps);
                    Update(objApps);
                    break;

                case EntityType.Books:
                    Books objBooks = Dal.GetInstance.GetBooks(item.Id);
                    BookServices.Clean(objBooks);
                    Update(objBooks);
                    break;

                case EntityType.Games:
                    Gamez objGamez = Dal.GetInstance.GetGames(item.Id);
                    GameServices.Clean(objGamez);
                    Update(objGamez);
                    break;

                case EntityType.Movie:
                    Movie objMovie = Dal.GetInstance.GetMovies(item.Id);
                    MovieServices.Clean(objMovie);
                    Update(objMovie);
                    break;

                case EntityType.Music:
                    Music objMusic = Dal.GetInstance.GetMusics(item.Id);
                    MusicServices.Clean(objMusic);
                    Update(objMusic);
                    break;

                case EntityType.Nds:
                    Nds objNds = Dal.GetInstance.GetNdss(item.Id);
                    NdsServices.Clean(objNds);
                    Update(objNds);
                    break;

                case EntityType.Series:
                    SeriesSeason objSeriesSeason = Dal.GetInstance.GetSeries_Seasons(item.Id);
                    SerieServices.Clean(objSeriesSeason);
                    Update(objSeriesSeason);
                    break;

                case EntityType.XXX:
                    XXX objXxx = Dal.GetInstance.GetXxXs(item.Id);
                    XxxServices.Clean(objXxx);
                    Update(objXxx);
                    break;
                }
            }
        }
Пример #2
0
 public static void RefreshSmallCovers()
 {
     AppServices.RefreshSmallCover();
     BookServices.RefreshSmallCover();
     GameServices.RefreshSmallCover();
     MovieServices.RefreshSmallCover();
     MusicServices.RefreshSmallCover();
     NdsServices.RefreshSmallCover();
     SerieServices.RefreshSmallCover();
     XxxServices.RefreshSmallCover();
 }
Пример #3
0
        public static void DeleteSelectedListBoxItem(IList lstSelectedItems)
        {
            foreach (ListBoxItem item in lstSelectedItems)
            {
                IMyCollectionsData data = item.DataContext as IMyCollectionsData;

                if (data != null)
                {
                    switch (data.ObjectType)
                    {
                    case EntityType.Apps:
                        AppServices.Delete(data.Id);
                        break;

                    case EntityType.Artist:
                        ArtistServices.Delete(data.Id);
                        break;

                    case EntityType.Books:
                        BookServices.Delete(data.Id);
                        break;

                    case EntityType.Games:
                        GameServices.Delete(data.Id);
                        break;

                    case EntityType.Movie:
                        MovieServices.Delete(data.Id);
                        break;

                    case EntityType.Music:
                        MusicServices.Delete(data.Id);
                        break;

                    case EntityType.Nds:
                        NdsServices.Delete(data.Id);
                        break;

                    case EntityType.Series:
                        SerieServices.Delete(data.Id);
                        break;

                    case EntityType.XXX:
                        XxxServices.Delete(data.Id);
                        break;
                    }
                }
            }
        }
Пример #4
0
        public static void DeleteSelected(IList lstSelectedItems)
        {
            foreach (ThumbItem item in lstSelectedItems)
            {
                switch (item.EType)
                {
                case EntityType.Apps:
                    AppServices.Delete(item.Id);
                    break;

                case EntityType.Artist:
                    ArtistServices.Delete(item.Id);
                    break;

                case EntityType.Books:
                    BookServices.Delete(item.Id);
                    break;

                case EntityType.Games:
                    GameServices.Delete(item.Id);
                    break;

                case EntityType.Movie:
                    MovieServices.Delete(item.Id);
                    break;

                case EntityType.Music:
                    MusicServices.Delete(item.Id);
                    break;

                case EntityType.Nds:
                    NdsServices.Delete(item.Id);
                    break;

                case EntityType.Series:
                    SerieServices.Delete(item.Id);
                    break;

                case EntityType.XXX:
                    XxxServices.Delete(item.Id);
                    break;
                }
            }
        }
Пример #5
0
        public static void Update(IMyCollectionsData entity)
        {
            try
            {
                LinksServices.DeleteLinks(entity);
                #region Publisher

                if (entity.Publisher != null)
                {
                    if (String.IsNullOrWhiteSpace(entity.Publisher.Name) == false)
                    {
                        bool isNew;
                        switch (entity.ObjectType)
                        {
                        case EntityType.Nds:
                        case EntityType.Games:
                        case EntityType.Books:
                        case EntityType.Apps:
                            entity.Publisher = PublisherServices.GetPublisher(entity.Publisher.Name, out isNew, "App_Editor");
                            if (isNew == true)
                            {
                                Dal.GetInstance.AddPublisher("App_Editor", entity.Publisher);
                            }
                            break;

                        case EntityType.Series:
                        case EntityType.Movie:
                            entity.Publisher = PublisherServices.GetPublisher(entity.Publisher.Name, out isNew, "Movie_Studio");
                            if (isNew == true)
                            {
                                Dal.GetInstance.AddPublisher("Movie_Studio", entity.Publisher);
                            }
                            break;

                        case EntityType.Music:
                            entity.Publisher = PublisherServices.GetPublisher(entity.Publisher.Name, out isNew, "Music_Studio");
                            if (isNew == true)
                            {
                                Dal.GetInstance.AddPublisher("Music_Studio", entity.Publisher);
                            }
                            break;

                        case EntityType.XXX:
                            entity.Publisher = PublisherServices.GetPublisher(entity.Publisher.Name, out isNew, "XXX_Studio");
                            if (isNew == true)
                            {
                                Dal.GetInstance.AddPublisher("XXX_Studio", entity.Publisher);
                            }

                            break;
                        }
                    }
                }

                #endregion

                switch (entity.ObjectType)
                {
                case EntityType.Apps:
                    Dal.GetInstance.AddApps(entity as Apps);
                    break;

                case EntityType.Books:
                    Dal.GetInstance.AddBook(entity as Books);
                    break;

                case EntityType.Games:
                    Dal.GetInstance.AddGame(entity as Gamez);
                    break;

                case EntityType.Movie:
                    Dal.GetInstance.AddMovie(entity as Movie);
                    break;

                case EntityType.Music:
                    if (MySettings.AutoUpdateID3 == true)
                    {
                        Task.Factory.StartNew(() => MusicServices.UpdateId3(entity as Music));
                    }
                    Dal.GetInstance.AddMusic(entity as Music);
                    Dal.GetInstance.AddTracks(entity as Music);
                    break;

                case EntityType.Nds:
                    Dal.GetInstance.AddNds(entity as Nds);
                    break;

                case EntityType.Series:
                    Dal.GetInstance.AddSeriesSeason(entity as SeriesSeason);
                    break;

                case EntityType.XXX:
                    Dal.GetInstance.AddXxx(entity as XXX);
                    break;
                }

                #region Links
                LinksServices.AddLinks(entity.Links, entity, true);
                #endregion
                RessourcesServices.UpdateRessources(entity);
                #region Artist
                if (entity.Artists != null && entity.Artists.Any())
                {
                    foreach (Artist artist in entity.Artists)
                    {
                        Dal.GetInstance.UnlinkArtist(artist, entity);
                    }
                }

                if (entity.Artists != null)
                {
                    foreach (Artist artist in entity.Artists)
                    {
                        ArtistServices.SaveArtist(artist, entity);
                    }
                }
                #endregion
                #region Genres
                Dal.GetInstance.UnlinkGenre(entity);
                GenreServices.AddGenres(entity.Genres, entity, true);
                #endregion
            }
            catch (Exception ex)
            {
                Util.LogException(ex);
                throw;
            }
        }
Пример #6
0
        public static void Update(IMyCollectionsData entity, string strLanguage, string strMedia, string studio, IEnumerable <string> lstGenres, IEnumerable objLinks,
                                  IEnumerable <string> artistName, string fileFormat, string aspectRatio, string platform, IEnumerable <string> metaData)
        {
            try
            {
                LinksServices.DeleteLinks(entity);
                entity.Media    = MediaServices.Get(strMedia, true);
                entity.Language = LanguageServices.GetLanguage(strLanguage, true);

                #region Publisher

                if (String.IsNullOrWhiteSpace(studio) == false)
                {
                    bool isNew;
                    switch (entity.ObjectType)
                    {
                    case EntityType.Nds:
                    case EntityType.Games:
                    case EntityType.Books:
                    case EntityType.Apps:
                        entity.Publisher = PublisherServices.GetPublisher(studio, out isNew, "App_Editor");
                        if (isNew == true)
                        {
                            Dal.GetInstance.AddPublisher("App_Editor", entity.Publisher);
                        }
                        break;

                    case EntityType.Series:
                    case EntityType.Movie:
                        entity.Publisher = PublisherServices.GetPublisher(studio, out isNew, "Movie_Studio");
                        if (isNew == true)
                        {
                            Dal.GetInstance.AddPublisher("Movie_Studio", entity.Publisher);
                        }
                        break;

                    case EntityType.Music:
                        entity.Publisher = PublisherServices.GetPublisher(studio, out isNew, "Music_Studio");
                        if (isNew == true)
                        {
                            Dal.GetInstance.AddPublisher("Music_Studio", entity.Publisher);
                        }
                        break;

                    case EntityType.XXX:
                        entity.Publisher = PublisherServices.GetPublisher(studio, out isNew, "XXX_Studio");
                        if (isNew == true)
                        {
                            Dal.GetInstance.AddPublisher("XXX_Studio", entity.Publisher);
                        }
                        break;
                    }
                }

                #endregion


                if (String.IsNullOrWhiteSpace(entity.FilePath))
                {
                    entity.FilePath = String.Empty;
                }

                switch (entity.ObjectType)
                {
                case EntityType.Apps:
                    Dal.GetInstance.AddApps(entity as Apps);
                    break;

                case EntityType.Books:
                    #region FileFormat
                    if (entity.FileFormat == null)
                    {
                        entity.FileFormat = BookServices.GetFormat(fileFormat, true);
                    }
                    else if (entity.FileFormat.Name != fileFormat)
                    {
                        entity.FileFormat = BookServices.GetFormat(fileFormat, true);
                    }
                    #endregion
                    Dal.GetInstance.AddBook(entity as Books);
                    break;

                case EntityType.Games:
                    entity.Platform = GameServices.GetPlatform(platform, true);
                    Dal.GetInstance.AddGame(entity as Gamez);
                    break;

                case EntityType.Movie:
                    #region FileFormat
                    if (entity.FileFormat == null)
                    {
                        entity.FileFormat = MovieServices.GetFormat(fileFormat);
                    }
                    else if (entity.FileFormat.Name != fileFormat)
                    {
                        entity.FileFormat = MovieServices.GetFormat(fileFormat);
                    }
                    #endregion
                    #region AspectRatio
                    if (entity.AspectRatio == null)
                    {
                        entity.AspectRatio = MovieServices.GetAspectRatio(aspectRatio);
                    }
                    else if (entity.AspectRatio.Name != aspectRatio)
                    {
                        entity.AspectRatio = MovieServices.GetAspectRatio(aspectRatio);
                    }
                    #endregion
                    Dal.GetInstance.AddMovie(entity as Movie);
                    break;

                case EntityType.Music:
                    if (MySettings.AutoUpdateID3 == true)
                    {
                        Task.Factory.StartNew(() => MusicServices.UpdateId3(entity as Music));
                    }
                    Dal.GetInstance.AddMusic(entity as Music);
                    Dal.GetInstance.AddTracks(entity as Music);
                    break;

                case EntityType.Nds:
                    Dal.GetInstance.AddNds(entity as Nds);
                    break;

                case EntityType.Series:
                    Dal.GetInstance.AddSeriesSeason(entity as SeriesSeason);
                    break;

                case EntityType.XXX:
                    Dal.GetInstance.AddXxx(entity as XXX);
                    break;
                }

                #region Genres
                Dal.GetInstance.UnlinkGenre(entity);

                GenreServices.AddGenres(lstGenres, entity, true);
                #endregion
                #region MetaData
                Dal.GetInstance.UnlinkMetaData(entity);
                MetaDataServices.Link(entity, metaData);
                #endregion

                LinksServices.AddLinks(objLinks.Cast <string>(), entity, true);
                RessourcesServices.UpdateRessources(entity);

                #region Artist

                if (entity.ObjectType != EntityType.Books && entity.ObjectType != EntityType.Music)
                {
                    Task.Factory.StartNew(() => UpdateArtist(entity, artistName));
                }
                else
                {
                    UpdateArtist(entity, artistName);
                }

                #endregion
            }
            catch (Exception ex)
            {
                Util.LogException(ex);
                throw;
            }
        }