Esempio n. 1
0
        private void AddStudio(Publisher publisher)
        {
            switch (_entityType)
            {
            case EntityType.Apps:
            case EntityType.Games:
            case EntityType.Nds:
            case EntityType.Books:
                PublisherServices.CreatePublisher("App_Editor", publisher);
                break;

            case EntityType.Series:
            case EntityType.Movie:
                PublisherServices.CreatePublisher("Movie_Studio", publisher);
                break;

            case EntityType.Music:
                PublisherServices.CreatePublisher("Music_Studio", publisher);
                break;

            case EntityType.XXX:
                PublisherServices.CreatePublisher("XXX_Studio", publisher);
                break;
            }
        }
Esempio n. 2
0
        public void InitCombo()
        {
            for (long i = 0; i < 21; i++)
            {
                cboRating.Items.Add(i);
            }

            cboMedia.ItemsSource    = MediaServices.GetNames();
            cboLanguage.ItemsSource = LanguageServices.GetLanguages();
            cboEditor.DataContext   = PublisherServices.GetPublishers("App_Editor");
            cboFormat.ItemsSource   = BookServices.GetFormats();
        }
 public void InitCombo()
 {
     try
     {
         cboRating.ItemsSource   = Enumerable.Range(1, 20);
         CboMedia.ItemsSource    = MediaServices.GetNames();
         CboLanguage.ItemsSource = LanguageServices.GetLanguages();
         CboEditor.DataContext   = PublisherServices.GetPublishers("App_Editor");
     }
     catch (Exception ex)
     {
         Util.LogException(ex);
         new MessageBoxYesNo(ex.Message, false, true).ShowDialog();
     }
 }
Esempio n. 4
0
        public void InitCombo()
        {
            try
            {
                for (int i = 0; i < 21; i++)
                {
                    cboRating.Items.Add(i);
                }

                cboMedia.ItemsSource  = MediaServices.GetNames();
                cboStudio.ItemsSource = PublisherServices.GetPublishers("Movie_Studio");
            }
            catch (Exception ex)
            {
                Util.LogException(ex);
                new MessageBoxYesNo(ex.Message, false, true).ShowDialog();
            }
        }
Esempio n. 5
0
        public void InitCombo()
        {
            try
            {
                for (int i = 0; i < 21; i++)
                {
                    cboRating.Items.Add(i);
                }

                cboMedia.ItemsSource    = MediaServices.GetNames();
                cboLanguage.ItemsSource = LanguageServices.GetLanguages();
                cboEditor.DataContext   = PublisherServices.GetPublishers("XXX_Studio");
            }
            catch (Exception ex)
            {
                Util.LogException(ex);
                new MessageBoxYesNo(ex.Message, false, true).ShowDialog();
            }
        }
Esempio n. 6
0
        private void DeleteStudio(Publisher item)
        {
            switch (_entityType)
            {
            case EntityType.Apps:
                PublisherServices.DeletePublisher(item.Id, "Apps", "Editor_Id", "App_Editor", item.Name);
                break;

            case EntityType.Books:
                PublisherServices.DeletePublisher(item.Id, "Books", "Editor_Id", "App_Editor", item.Name);
                break;

            case EntityType.Games:
                PublisherServices.DeletePublisher(item.Id, "Gamez", "Editor_Id", "App_Editor", item.Name);
                break;

            case EntityType.Movie:
                PublisherServices.DeletePublisher(item.Id, "Movie", "Studio_Id", "Movie_Studio", item.Name);
                break;

            case EntityType.Music:
                PublisherServices.DeletePublisher(item.Id, "Music", "Studio_Id", "Music_Studio", item.Name);
                break;

            case EntityType.Nds:
                PublisherServices.DeletePublisher(item.Id, "Nds", "Editor_Id", "App_Editor", item.Name);
                break;

            case EntityType.Series:
                PublisherServices.DeletePublisher(item.Id, "Series", "Studio_Id", "Movie_Studio", item.Name);
                break;

            case EntityType.XXX:
                PublisherServices.DeletePublisher(item.Id, "XXX", "Studio_Id", "XXX_Studio", item.Name);
                break;
            }
        }
Esempio n. 7
0
        private IList GetStudios()
        {
            switch (_entityType)
            {
            case EntityType.Apps:
            case EntityType.Books:
            case EntityType.Games:
            case EntityType.Nds:
                return(PublisherServices.GetPublishers("App_Editor"));

            case EntityType.Movie:
            case  EntityType.Series:
                return(PublisherServices.GetPublishers("Movie_Studio"));

            case EntityType.Music:
                return(PublisherServices.GetPublishers("Music_Studio"));

            case EntityType.XXX:
                return(PublisherServices.GetPublishers("XXX_Studio"));

            default:
                return(null);
            }
        }
Esempio n. 8
0
        private void worker_DoWork_XML(object sender, DoWorkEventArgs e)
        {
            try
            {
                Total = _selectedItems.Length;

                foreach (XElement node in _selectedItems)
                {
                    //exit if the user cancels
                    if (_isCancelationPending == true)
                    {
                        return;
                    }

                    Movie movie = new Movie();
                    movie.Title         = Util.GetElementValue(node, "Title");
                    movie.OriginalTitle = Util.GetElementValue(node, "OriginalTitle");
                    movie.BarCode       = Util.GetElementValue(node, "BarCode");
                    movie.Comments      = Util.GetElementValue(node, "Comments");
                    movie.Description   = Util.GetElementValue(node, "Description");
                    movie.FileName      = Util.GetElementValue(node, "FileName");
                    movie.FilePath      = Util.GetElementValue(node, "FilePath");
                    movie.Country       = Util.GetElementValue(node, "Country");
                    movie.AlloCine      = Util.GetElementValue(node, "AlloCine");
                    movie.Imdb          = Util.GetElementValue(node, "Imdb");
                    movie.Tagline       = Util.GetElementValue(node, "Tagline");

                    DateTime dateValue;

                    if (DateTime.TryParse(Util.GetElementValue(node, "AddedDate"), out dateValue) == true)
                    {
                        movie.AddedDate = dateValue;
                    }

                    if (DateTime.TryParse(Util.GetElementValue(node, "ReleaseDate"), out dateValue) == true)
                    {
                        movie.ReleaseDate = dateValue;
                    }

                    #region Bool
                    bool boolValue;

                    if (bool.TryParse(Util.GetElementValue(node, "IsComplete"), out boolValue) == true)
                    {
                        movie.IsComplete = boolValue;
                    }

                    if (bool.TryParse(Util.GetElementValue(node, "IsDeleted"), out boolValue) == true)
                    {
                        movie.IsDeleted = boolValue;
                    }

                    if (bool.TryParse(Util.GetElementValue(node, "Seen"), out boolValue) == true)
                    {
                        movie.Watched = boolValue;
                    }

                    if (bool.TryParse(Util.GetElementValue(node, "IsWhish"), out boolValue) == true)
                    {
                        movie.IsWhish = boolValue;
                    }

                    if (bool.TryParse(Util.GetElementValue(node, "ToBeDeleted"), out boolValue) == true)
                    {
                        movie.ToBeDeleted = boolValue;
                    }
                    #endregion
                    #region Int
                    int intValue;

                    if (int.TryParse(Util.GetElementValue(node, "Rated"), out intValue) == true)
                    {
                        movie.Rated = intValue.ToString(CultureInfo.InvariantCulture);
                    }

                    if (int.TryParse(Util.GetElementValue(node, "Rating"), out intValue) == true)
                    {
                        movie.MyRating = intValue;
                    }

                    if (int.TryParse(Util.GetElementValue(node, "Runtime"), out intValue) == true)
                    {
                        movie.Runtime = intValue;
                    }
                    #endregion
                    #region Media
                    var query = from item in node.Descendants("Media")
                                select item;

                    XElement[] movieNode = query.ToArray();

                    foreach (XElement media in movieNode)
                    {
                        Media newMedia = MediaServices.Get(Util.GetElementValue(media, "Name"), true);
                        newMedia.Path = Util.GetElementValue(media, "Path");
                        movie.Media   = newMedia;
                    }
                    #endregion
                    #region AspectRatio
                    query = from item in node.Descendants("AspectRatio")
                            select item;

                    movieNode = query.ToArray();

                    foreach (XElement aspectRatio in movieNode)
                    {
                        movie.AspectRatio = MovieServices.GetAspectRatio(Util.GetElementValue(aspectRatio, "Name"));
                    }
                    #endregion
                    #region FileFormat
                    query = from item in node.Descendants("FileFormat")
                            select item;

                    movieNode = query.ToArray();

                    foreach (XElement format in movieNode)
                    {
                        movie.FileFormat = MovieServices.GetFormat(Util.GetElementValue(format, "Name"));
                    }
                    #endregion
                    #region Studio
                    query = from item in node.Descendants("Studio")
                            select item;

                    movieNode = query.ToArray();

                    foreach (XElement studio in movieNode)
                    {
                        bool isNew;
                        movie.Publisher = PublisherServices.GetPublisher(Util.GetElementValue(studio, "Name"), out isNew, "Movie_Studio");
                        if (isNew == true)
                        {
                            Dal.GetInstance.AddPublisher("Movie_Studio", movie.Publisher);
                        }
                    }
                    #endregion
                    #region Links
                    query = from item in node.Descendants("Link")
                            select item;

                    movieNode = query.ToArray();

                    foreach (XElement link in movieNode)
                    {
                        LinksServices.AddLinks(Util.GetElementValue(link, "Path"), movie, true);
                    }

                    #endregion
                    #region Types
                    query = from item in node.Descendants("Type")
                            select item;

                    movieNode = query.ToArray();

                    foreach (XElement type in movieNode)
                    {
                        MovieServices.AddTypes(Util.GetElementValue(type, "RealName"), movie);
                    }
                    #endregion
                    #region Image
                    query = from item in node.Descendants("Ressource")
                            select item;

                    movieNode = query.ToArray();

                    foreach (XElement images in movieNode)
                    {
                        if (Util.GetElementValue(images, "ResourcesType") == "Image")
                        {
                            bool   isDefault = bool.Parse(Util.GetElementValue(images, "IsDefault"));
                            byte[] cover     = Convert.FromBase64String(Util.GetElementValue(images, "Value"));

                            if (cover.Length > 0)
                            {
                                RessourcesServices.AddImage(cover, movie, isDefault);
                            }
                        }
                        if (Util.GetElementValue(images, "ResourcesType") == "Background")
                        {
                            byte[] cover = Convert.FromBase64String(Util.GetElementValue(images, "Value"));

                            if (cover.Length > 0)
                            {
                                RessourcesServices.AddBackground(cover, movie);
                            }
                        }
                    }
                    #endregion
                    #region Artist
                    query = from item in node.Descendants("Artist")
                            select item;

                    XElement[] artistNode = query.ToArray();

                    foreach (XElement artist in artistNode)
                    {
                        bool   isNew;
                        string fullname  = Util.GetElementValue(artist, "FulleName");
                        Artist newArtist = ArtistServices.Get(fullname, out isNew);

                        if (string.IsNullOrWhiteSpace(newArtist.Aka))
                        {
                            newArtist.Aka = Util.GetElementValue(artist, "Aka");
                        }

                        if (string.IsNullOrWhiteSpace(newArtist.Bio))
                        {
                            newArtist.Bio = Util.GetElementValue(artist, "Bio");
                        }

                        if (newArtist.BirthDay == null && DateTime.TryParse(Util.GetElementValue(artist, "BirthDay"), out dateValue) == true)
                        {
                            newArtist.BirthDay = dateValue;
                        }

                        if (string.IsNullOrWhiteSpace(newArtist.Breast))
                        {
                            newArtist.Breast = Util.GetElementValue(artist, "Breast");
                        }

                        if (string.IsNullOrWhiteSpace(newArtist.Ethnicity))
                        {
                            newArtist.Ethnicity = Util.GetElementValue(artist, "Ethnicity");
                        }

                        if (string.IsNullOrWhiteSpace(newArtist.FirstName))
                        {
                            newArtist.FirstName = Util.GetElementValue(artist, "FirstName");
                        }

                        if (string.IsNullOrWhiteSpace(newArtist.LastName))
                        {
                            newArtist.LastName = Util.GetElementValue(artist, "LastName");
                        }

                        if (newArtist.Picture == null)
                        {
                            newArtist.Picture = Convert.FromBase64String(Util.GetElementValue(artist, "Picture"));
                        }

                        if (string.IsNullOrWhiteSpace(newArtist.PlaceBirth))
                        {
                            newArtist.PlaceBirth = Util.GetElementValue(artist, "PlaceBirth");
                        }

                        if (string.IsNullOrWhiteSpace(newArtist.WebSite))
                        {
                            newArtist.WebSite = Util.GetElementValue(artist, "WebSite");
                        }

                        if (string.IsNullOrWhiteSpace(newArtist.YearsActive))
                        {
                            newArtist.YearsActive = Util.GetElementValue(artist, "YearsActive");
                        }

                        query = from item in artist.Descendants("Credit")
                                select item;

                        XElement[] creditsNode = query.ToArray();

                        foreach (XElement artistCredit in creditsNode)
                        {
                            ArtistCredits artistCredits = new ArtistCredits();

                            artistCredits.Title      = Util.GetElementValue(artistCredit, "Title");
                            artistCredits.BuyLink    = Util.GetElementValue(artistCredit, "BuyLink");
                            artistCredits.EntityType = EntityType.Movie;
                            artistCredits.Notes      = Util.GetElementValue(artistCredit, "Notes");

                            DateTime releaseDate;
                            if (DateTime.TryParse(Util.GetElementValue(artistCredit, "ReleaseDate"), out releaseDate) == true)
                            {
                                artistCredits.ReleaseDate = releaseDate;
                            }

                            if (string.IsNullOrWhiteSpace(artistCredits.Title) == false && string.IsNullOrWhiteSpace(newArtist.FulleName) == false)
                            {
                                if (Dal.GetInstance.GetArtistCredit(artistCredits.Title, newArtist.FulleName) == null)
                                {
                                    newArtist.ArtistCredits.Add(artistCredits);
                                }
                            }
                        }

                        ArtistServices.AddArtist(new[] { newArtist }, movie);
                    }


                    #endregion

                    Dal.GetInstance.AddMovie(movie);
                    _intAddedItem++;

                    Current++;
                }
            }
            catch (Exception ex)
            {
                Util.LogException(ex);
            }
        }
Esempio n. 9
0
        private void worker_DoWork_XML(object sender, DoWorkEventArgs e)
        {
            try
            {
                Total = _selectedItems.Length;

                foreach (XElement node in _selectedItems)
                {
                    //exit if the user cancels
                    if (_isCancelationPending == true)
                    {
                        return;
                    }

                    Apps apps = new Apps();
                    apps.Title       = Util.GetElementValue(node, "Title");
                    apps.BarCode     = Util.GetElementValue(node, "BarCode");
                    apps.Comments    = Util.GetElementValue(node, "Comments");
                    apps.Description = Util.GetElementValue(node, "Description");
                    apps.FileName    = Util.GetElementValue(node, "FileName");
                    apps.FilePath    = Util.GetElementValue(node, "FilePath");
                    apps.Version     = Util.GetElementValue(node, "Version");

                    #region DateTime
                    DateTime dateValue;

                    if (DateTime.TryParse(Util.GetElementValue(node, "AddedDate"), out dateValue) == true)
                    {
                        apps.AddedDate = dateValue;
                    }

                    if (DateTime.TryParse(Util.GetElementValue(node, "ReleaseDate"), out dateValue) == true)
                    {
                        apps.ReleaseDate = dateValue;
                    }
                    #endregion
                    #region Bool
                    bool boolValue;

                    if (bool.TryParse(Util.GetElementValue(node, "IsComplete"), out boolValue) == true)
                    {
                        apps.IsComplete = boolValue;
                    }

                    if (bool.TryParse(Util.GetElementValue(node, "IsDeleted"), out boolValue) == true)
                    {
                        apps.IsDeleted = boolValue;
                    }

                    if (bool.TryParse(Util.GetElementValue(node, "IsTested"), out boolValue) == true)
                    {
                        apps.Watched = boolValue;
                    }

                    if (bool.TryParse(Util.GetElementValue(node, "IsWhish"), out boolValue) == true)
                    {
                        apps.IsWhish = boolValue;
                    }

                    if (bool.TryParse(Util.GetElementValue(node, "ToBeDeleted"), out boolValue) == true)
                    {
                        apps.ToBeDeleted = boolValue;
                    }
                    #endregion
                    #region Long
                    int longValue;

                    if (int.TryParse(Util.GetElementValue(node, "Rating"), out longValue) == true)
                    {
                        apps.MyRating = longValue;
                    }
                    #endregion
                    #region Media
                    var query = from item in node.Descendants("Media")
                                select item;

                    XElement[] bookNode = query.ToArray();

                    foreach (XElement media in bookNode)
                    {
                        Media newMedia = MediaServices.Get(Util.GetElementValue(media, "Name"), true);
                        newMedia.Path = Util.GetElementValue(media, "Path");
                        apps.Media    = newMedia;
                    }
                    #endregion
                    #region Publisher
                    query = from item in node.Descendants("Editor")
                            select item;

                    bookNode = query.ToArray();

                    foreach (XElement editor in bookNode)
                    {
                        bool isNew;
                        apps.Publisher = PublisherServices.GetPublisher(Util.GetElementValue(editor, "Name"), out isNew, "App_Editor");
                        if (isNew == true)
                        {
                            Dal.GetInstance.AddPublisher("App_Editor", apps.Publisher);
                        }
                    }
                    #endregion
                    #region Language
                    query = from item in node.Descendants("Language")
                            select item;

                    bookNode = query.ToArray();

                    foreach (XElement languages in bookNode)
                    {
                        apps.Language = LanguageServices.GetLanguage(Util.GetElementValue(languages, "DisplayName"), true);
                    }
                    #endregion
                    #region Links
                    query = from item in node.Descendants("Link")
                            select item;

                    bookNode = query.ToArray();

                    foreach (XElement link in bookNode)
                    {
                        LinksServices.AddLinks(Util.GetElementValue(link, "Path"), apps, true);
                    }

                    #endregion
                    #region Types
                    query = from item in node.Descendants("Type")
                            select item;

                    bookNode = query.ToArray();

                    foreach (XElement type in bookNode)
                    {
                        GenreServices.AddGenres(new [] { Util.GetElementValue(type, "RealName") }, apps, true);
                    }
                    #endregion
                    #region Image
                    query = from item in node.Descendants("Ressource")
                            select item;

                    bookNode = query.ToArray();

                    foreach (XElement images in bookNode)
                    {
                        if (Util.GetElementValue(images, "ResourcesType") == "Image")
                        {
                            bool   isDefault = bool.Parse(Util.GetElementValue(images, "IsDefault"));
                            byte[] cover     = Convert.FromBase64String(Util.GetElementValue(images, "Value"));

                            if (cover.Length > 0)
                            {
                                RessourcesServices.AddImage(cover, apps, isDefault);
                            }
                        }
                        if (Util.GetElementValue(images, "ResourcesType") == "Background")
                        {
                            byte[] cover = Convert.FromBase64String(Util.GetElementValue(images, "Value"));

                            if (cover.Length > 0)
                            {
                                RessourcesServices.AddBackground(cover, apps);
                            }
                        }
                    }
                    #endregion

                    Dal.GetInstance.AddApps(apps);
                    _intAddedItem++;

                    Current++;
                }
            }
            catch (Exception ex)
            {
                Util.LogException(ex);
            }
        }
Esempio n. 10
0
        private void worker_DoWork_XML(object sender, DoWorkEventArgs e)
        {
            try
            {
                Total = _selectedNodes.Length;

                foreach (XElement node in _selectedNodes)
                {
                    //exit if the user cancels
                    if (_isCancelationPending == true)
                    {
                        return;
                    }

                    Music music = new Music();
                    music.Title    = Util.GetElementValue(node, "Title");
                    music.Album    = Util.GetElementValue(node, "Album");
                    music.BarCode  = Util.GetElementValue(node, "BarCode");
                    music.Comments = Util.GetElementValue(node, "Comments");
                    music.FileName = Util.GetElementValue(node, "FileName");
                    music.FilePath = Util.GetElementValue(node, "FilePath");

                    #region DateTime
                    DateTime dateValue;

                    if (DateTime.TryParse(Util.GetElementValue(node, "AddedDate"), out dateValue) == true)
                    {
                        music.AddedDate = dateValue;
                    }

                    if (DateTime.TryParse(Util.GetElementValue(node, "ReleaseDate"), out dateValue) == true)
                    {
                        music.ReleaseDate = dateValue;
                    }
                    #endregion
                    #region Bool
                    bool boolValue;

                    if (bool.TryParse(Util.GetElementValue(node, "IsComplete"), out boolValue) == true)
                    {
                        music.IsComplete = boolValue;
                    }

                    if (bool.TryParse(Util.GetElementValue(node, "IsDeleted"), out boolValue) == true)
                    {
                        music.IsDeleted = boolValue;
                    }

                    if (bool.TryParse(Util.GetElementValue(node, "IsHear"), out boolValue) == true)
                    {
                        music.Watched = boolValue;
                    }

                    if (bool.TryParse(Util.GetElementValue(node, "IsWhish"), out boolValue) == true)
                    {
                        music.IsWhish = boolValue;
                    }

                    if (bool.TryParse(Util.GetElementValue(node, "ToBeDeleted"), out boolValue) == true)
                    {
                        music.ToBeDeleted = boolValue;
                    }
                    #endregion
                    #region int
                    int intValue;

                    if (int.TryParse(Util.GetElementValue(node, "BitRate"), out intValue) == true)
                    {
                        music.BitRate = intValue;
                    }

                    if (int.TryParse(Util.GetElementValue(node, "Length"), out intValue) == true)
                    {
                        music.Runtime = intValue;
                    }

                    if (int.TryParse(Util.GetElementValue(node, "Rating"), out intValue) == true)
                    {
                        music.MyRating = intValue;
                    }
                    #endregion
                    #region Media
                    var query = from item in node.Descendants("Media")
                                select item;

                    XElement[] musicNode = query.ToArray();

                    foreach (XElement media in musicNode)
                    {
                        Media newMedia = MediaServices.Get(Util.GetElementValue(media, "Name"), true);
                        newMedia.Path = Util.GetElementValue(media, "Path");
                        music.Media   = newMedia;
                    }
                    #endregion
                    #region Studio
                    query = from item in node.Descendants("Studio")
                            select item;

                    musicNode = query.ToArray();

                    foreach (XElement editor in musicNode)
                    {
                        bool isNew;
                        music.Publisher = PublisherServices.GetPublisher(Util.GetElementValue(editor, "Name"), out isNew, "Music_Studio");
                        if (isNew == true)
                        {
                            Dal.GetInstance.AddPublisher("Music_Studio", music.Publisher);
                        }
                    }
                    #endregion
                    #region Track
                    query = from item in node.Descendants("Track")
                            select item;

                    musicNode = query.ToArray();

                    foreach (XElement track in musicNode)
                    {
                        MusicServices.AddTracks(new [] { Util.GetElementValue(track, "Title") }, music);
                    }
                    #endregion
                    #region Links
                    query = from item in node.Descendants("Link")
                            select item;

                    musicNode = query.ToArray();

                    foreach (XElement link in musicNode)
                    {
                        LinksServices.AddLinks(Util.GetElementValue(link, "Path"), music, true);
                    }

                    #endregion
                    #region Types
                    query = from item in node.Descendants("Type")
                            select item;

                    musicNode = query.ToArray();

                    foreach (XElement type in musicNode)
                    {
                        GenreServices.AddGenres(new[] { Util.GetElementValue(type, "RealName") }, music, true);
                    }
                    #endregion
                    #region Image
                    query = from item in node.Descendants("Ressource")
                            select item;

                    musicNode = query.ToArray();

                    foreach (XElement images in musicNode)
                    {
                        if (Util.GetElementValue(images, "ResourcesType") == "Image")
                        {
                            bool   isDefault = bool.Parse(Util.GetElementValue(images, "IsDefault"));
                            byte[] cover     = Convert.FromBase64String(Util.GetElementValue(images, "Value"));

                            if (cover.Length > 0)
                            {
                                RessourcesServices.AddImage(cover, music, isDefault);
                            }
                        }
                        if (Util.GetElementValue(images, "ResourcesType") == "Background")
                        {
                            byte[] cover = Convert.FromBase64String(Util.GetElementValue(images, "Value"));

                            if (cover.Length > 0)
                            {
                                RessourcesServices.AddBackground(cover, music);
                            }
                        }
                    }
                    #endregion
                    #region Artist
                    query = from item in node.Descendants("Artist")
                            select item;

                    XElement[] artistNode = query.ToArray();

                    foreach (XElement artist in artistNode)
                    {
                        bool   isNew;
                        string fullname  = Util.GetElementValue(artist, "FulleName");
                        Artist newArtist = ArtistServices.Get(fullname, out isNew);

                        if (string.IsNullOrWhiteSpace(newArtist.Aka))
                        {
                            newArtist.Aka = Util.GetElementValue(artist, "Aka");
                        }

                        if (string.IsNullOrWhiteSpace(newArtist.Bio))
                        {
                            newArtist.Bio = Util.GetElementValue(artist, "Bio");
                        }

                        if (newArtist.BirthDay == null && DateTime.TryParse(Util.GetElementValue(artist, "BirthDay"), out dateValue) == true)
                        {
                            newArtist.BirthDay = dateValue;
                        }

                        if (string.IsNullOrWhiteSpace(newArtist.Breast))
                        {
                            newArtist.Breast = Util.GetElementValue(artist, "Breast");
                        }

                        if (string.IsNullOrWhiteSpace(newArtist.Ethnicity))
                        {
                            newArtist.Ethnicity = Util.GetElementValue(artist, "Ethnicity");
                        }

                        if (string.IsNullOrWhiteSpace(newArtist.FirstName))
                        {
                            newArtist.FirstName = Util.GetElementValue(artist, "FirstName");
                        }

                        if (string.IsNullOrWhiteSpace(newArtist.LastName))
                        {
                            newArtist.LastName = Util.GetElementValue(artist, "LastName");
                        }

                        if (newArtist.Picture == null)
                        {
                            newArtist.Picture = Convert.FromBase64String(Util.GetElementValue(artist, "Picture"));
                        }

                        if (string.IsNullOrWhiteSpace(newArtist.PlaceBirth))
                        {
                            newArtist.PlaceBirth = Util.GetElementValue(artist, "PlaceBirth");
                        }

                        if (string.IsNullOrWhiteSpace(newArtist.WebSite))
                        {
                            newArtist.WebSite = Util.GetElementValue(artist, "WebSite");
                        }

                        if (string.IsNullOrWhiteSpace(newArtist.YearsActive))
                        {
                            newArtist.YearsActive = Util.GetElementValue(artist, "YearsActive");
                        }

                        query = from item in artist.Descendants("Credit")
                                select item;

                        XElement[] creditsNode = query.ToArray();

                        foreach (XElement artistCredit in creditsNode)
                        {
                            ArtistCredits artistCredits = new ArtistCredits();

                            artistCredits.Title      = Util.GetElementValue(artistCredit, "Title");
                            artistCredits.BuyLink    = Util.GetElementValue(artistCredit, "BuyLink");
                            artistCredits.EntityType = EntityType.Movie;
                            artistCredits.Notes      = Util.GetElementValue(artistCredit, "Notes");

                            DateTime releaseDate;
                            if (DateTime.TryParse(Util.GetElementValue(artistCredit, "ReleaseDate"), out releaseDate) == true)
                            {
                                artistCredits.ReleaseDate = releaseDate;
                            }

                            if (string.IsNullOrWhiteSpace(artistCredits.Title) == false && string.IsNullOrWhiteSpace(newArtist.FulleName) == false)
                            {
                                if (Dal.GetInstance.GetArtistCredit(artistCredits.Title, newArtist.FulleName) == null)
                                {
                                    newArtist.ArtistCredits.Add(artistCredits);
                                }
                            }
                        }

                        ArtistServices.SaveArtist(newArtist, music);
                    }

                    #endregion

                    Dal.GetInstance.AddMusic(music);
                    _intAddedItem++;

                    Current++;
                }
            }
            catch (Exception ex)
            {
                Util.LogException(ex);
            }
        }
Esempio n. 11
0
 public PublishersController(PublisherServices publisherServices)
 {
     _publisherServices = publisherServices;
 }
Esempio n. 12
0
        private void worker_DoWork_XML(object sender, DoWorkEventArgs e)
        {
            try
            {
                Total = _selectedItems.Length;

                foreach (XElement node in _selectedItems)
                {
                    //exit if the user cancels
                    if (_isCancelationPending == true)
                    {
                        return;
                    }

                    Books books = new Books();
                    books.Title       = Util.GetElementValue(node, "Title");
                    books.BarCode     = Util.GetElementValue(node, "BarCode");
                    books.Comments    = Util.GetElementValue(node, "Comments");
                    books.Description = Util.GetElementValue(node, "Description");
                    books.FileName    = Util.GetElementValue(node, "FileName");
                    books.FilePath    = Util.GetElementValue(node, "FilePath");
                    books.Isbn        = Util.GetElementValue(node, "ISBN");

                    #region DateTime
                    DateTime dateValue;

                    if (DateTime.TryParse(Util.GetElementValue(node, "AddedDate"), out dateValue) == true)
                    {
                        books.AddedDate = dateValue;
                    }

                    if (DateTime.TryParse(Util.GetElementValue(node, "ReleaseDate"), out dateValue) == true)
                    {
                        books.ReleaseDate = dateValue;
                    }
                    #endregion
                    #region Bool
                    bool boolValue;

                    if (bool.TryParse(Util.GetElementValue(node, "IsComplete"), out boolValue) == true)
                    {
                        books.IsComplete = boolValue;
                    }

                    if (bool.TryParse(Util.GetElementValue(node, "IsDeleted"), out boolValue) == true)
                    {
                        books.IsDeleted = boolValue;
                    }

                    if (bool.TryParse(Util.GetElementValue(node, "IsRead"), out boolValue) == true)
                    {
                        books.Watched = boolValue;
                    }

                    if (bool.TryParse(Util.GetElementValue(node, "IsWhish"), out boolValue) == true)
                    {
                        books.IsWhish = boolValue;
                    }

                    if (bool.TryParse(Util.GetElementValue(node, "ToBeDeleted"), out boolValue) == true)
                    {
                        books.ToBeDeleted = boolValue;
                    }
                    #endregion
                    #region Long
                    int longValue;

                    if (int.TryParse(Util.GetElementValue(node, "NbrPages"), out longValue) == true)
                    {
                        books.NbrPages = longValue;
                    }

                    if (int.TryParse(Util.GetElementValue(node, "Rated"), out longValue) == true)
                    {
                        books.Rated = longValue.ToString(CultureInfo.InvariantCulture);
                    }

                    if (int.TryParse(Util.GetElementValue(node, "Rating"), out longValue) == true)
                    {
                        books.MyRating = longValue;
                    }
                    #endregion
                    #region Media
                    var query = from item in node.Descendants("Media")
                                select item;

                    XElement[] bookNode = query.ToArray();

                    foreach (XElement media in bookNode)
                    {
                        Media newMedia = MediaServices.Get(Util.GetElementValue(media, "Name"), true);
                        newMedia.Path = Util.GetElementValue(media, "Path");
                        books.Media   = newMedia;
                    }
                    #endregion
                    #region Format
                    query = from item in node.Descendants("Format")
                            select item;

                    bookNode = query.ToArray();

                    foreach (XElement format in bookNode)
                    {
                        books.FileFormat = BookServices.GetFormat(Util.GetElementValue(format, "Name"), true);
                    }
                    #endregion
                    #region Artist
                    query = from item in node.Descendants("Artist")
                            select item;

                    XElement[] artistNode = query.ToArray();

                    Job objJob = ArtistServices.GetJob("Author");
                    foreach (XElement artist in artistNode)
                    {
                        bool   isNew;
                        string fullname  = Util.GetElementValue(artist, "FulleName");
                        Artist newArtist = ArtistServices.Get(fullname, out isNew);

                        if (string.IsNullOrWhiteSpace(newArtist.Aka))
                        {
                            newArtist.Aka = Util.GetElementValue(artist, "Aka");
                        }

                        if (string.IsNullOrWhiteSpace(newArtist.Bio))
                        {
                            newArtist.Bio = Util.GetElementValue(artist, "Bio");
                        }

                        if (newArtist.BirthDay == null && DateTime.TryParse(Util.GetElementValue(artist, "BirthDay"), out dateValue) == true)
                        {
                            newArtist.BirthDay = dateValue;
                        }

                        if (string.IsNullOrWhiteSpace(newArtist.Breast))
                        {
                            newArtist.Breast = Util.GetElementValue(artist, "Breast");
                        }

                        if (string.IsNullOrWhiteSpace(newArtist.Ethnicity))
                        {
                            newArtist.Ethnicity = Util.GetElementValue(artist, "Ethnicity");
                        }

                        if (string.IsNullOrWhiteSpace(newArtist.FirstName))
                        {
                            newArtist.FirstName = Util.GetElementValue(artist, "FirstName");
                        }

                        if (string.IsNullOrWhiteSpace(newArtist.LastName))
                        {
                            newArtist.LastName = Util.GetElementValue(artist, "LastName");
                        }

                        if (newArtist.Picture == null)
                        {
                            newArtist.Picture = Convert.FromBase64String(Util.GetElementValue(artist, "Picture"));
                        }

                        if (string.IsNullOrWhiteSpace(newArtist.PlaceBirth))
                        {
                            newArtist.PlaceBirth = Util.GetElementValue(artist, "PlaceBirth");
                        }

                        if (string.IsNullOrWhiteSpace(newArtist.WebSite))
                        {
                            newArtist.WebSite = Util.GetElementValue(artist, "WebSite");
                        }

                        if (string.IsNullOrWhiteSpace(newArtist.YearsActive))
                        {
                            newArtist.YearsActive = Util.GetElementValue(artist, "YearsActive");
                        }

                        query = from item in artist.Descendants("Credit")
                                select item;

                        XElement[] creditsNode = query.ToArray();

                        foreach (XElement artistCredit in creditsNode)
                        {
                            ArtistCredits artistCredits = new ArtistCredits();

                            artistCredits.Title      = Util.GetElementValue(artistCredit, "Title");
                            artistCredits.BuyLink    = Util.GetElementValue(artistCredit, "BuyLink");
                            artistCredits.EntityType = EntityType.Movie;
                            artistCredits.Notes      = Util.GetElementValue(artistCredit, "Notes");

                            DateTime releaseDate;
                            if (DateTime.TryParse(Util.GetElementValue(artistCredit, "ReleaseDate"), out releaseDate) == true)
                            {
                                artistCredits.ReleaseDate = releaseDate;
                            }

                            if (string.IsNullOrWhiteSpace(artistCredits.Title) == false && string.IsNullOrWhiteSpace(newArtist.FulleName) == false)
                            {
                                if (Dal.GetInstance.GetArtistCredit(artistCredits.Title, newArtist.FulleName) == null)
                                {
                                    newArtist.ArtistCredits.Add(artistCredits);
                                }
                            }
                        }
                        newArtist.Job = objJob;
                        books.Artists.Add(newArtist);
                        if (isNew == true)
                        {
                            Dal.GetInstance.AddArtist(newArtist, books);
                        }
                    }


                    #endregion
                    #region Editor
                    query = from item in node.Descendants("Editor")
                            select item;

                    bookNode = query.ToArray();

                    foreach (XElement editor in bookNode)
                    {
                        bool isNew;
                        books.Publisher = PublisherServices.GetPublisher(Util.GetElementValue(editor, "Name"), out isNew, "App_Editor");
                        if (isNew == true)
                        {
                            Dal.GetInstance.AddPublisher("App_Editor", books.Publisher);
                        }
                    }
                    #endregion
                    #region Language
                    query = from item in node.Descendants("Language")
                            select item;

                    bookNode = query.ToArray();

                    foreach (XElement languages in bookNode)
                    {
                        books.Language = LanguageServices.GetLanguage(Util.GetElementValue(languages, "DisplayName"), true);
                    }
                    #endregion
                    #region Links
                    query = from item in node.Descendants("Link")
                            select item;

                    bookNode = query.ToArray();

                    foreach (XElement link in bookNode)
                    {
                        LinksServices.AddLinks(Util.GetElementValue(link, "Path"), books, true);
                    }

                    #endregion
                    #region Types
                    query = from item in node.Descendants("Type")
                            select item;

                    bookNode = query.ToArray();

                    foreach (XElement type in bookNode)
                    {
                        GenreServices.AddGenre(Util.GetElementValue(type, "RealName"), books, true);
                    }
                    #endregion
                    #region Image
                    query = from item in node.Descendants("Ressource")
                            select item;

                    bookNode = query.ToArray();

                    foreach (XElement images in bookNode)
                    {
                        if (Util.GetElementValue(images, "ResourcesType") == "Image")
                        {
                            bool   isDefault = bool.Parse(Util.GetElementValue(images, "IsDefault"));
                            byte[] cover     = Convert.FromBase64String(Util.GetElementValue(images, "Value"));

                            if (cover.Length > 0)
                            {
                                RessourcesServices.AddImage(cover, books, isDefault);
                            }
                        }
                        if (Util.GetElementValue(images, "ResourcesType") == "Background")
                        {
                            byte[] cover = Convert.FromBase64String(Util.GetElementValue(images, "Value"));

                            if (cover.Length > 0)
                            {
                                RessourcesServices.AddBackground(cover, books);
                            }
                        }
                    }
                    #endregion

                    Dal.GetInstance.AddBook(books);
                    _intAddedItem++;

                    Current++;
                }
            }
            catch (Exception ex)
            {
                Util.LogException(ex);
            }
        }
Esempio n. 13
0
        private void worker_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                Total = _selectedItems.Length;

                foreach (XElement item in _selectedItems)
                {
                    //exit if the user cancels
                    if (_isCancelationPending == true)
                    {
                        return;
                    }

                    BibTex bibtex = BibTex.XmlToBibTex(item);
                    if (bibtex != null)
                    {
                        Books books = new Books();
                        books.Title         = bibtex.title;
                        books.FileFormat    = new FileFormat();
                        books.FileFormat.Id = _formatId;
                        books.Media         = new Media();
                        books.Media.Id      = _mediaId;
                        books.AddedDate     = DateTime.Now;

                        #region Publisher

                        bool isNew;
                        books.Publisher = PublisherServices.GetPublisher(bibtex.editor, out isNew, "App_Editor");
                        if (isNew == true)
                        {
                            Dal.GetInstance.AddPublisher("App_Editor", books.Publisher);
                        }

                        #endregion
                        #region Artist

                        Artist artist = ArtistServices.Get(bibtex.author.Trim(), out isNew);
                        books.Artists.Add(artist);
                        if (isNew == true)
                        {
                            Dal.GetInstance.AddArtist(artist, books);
                        }

                        #endregion
                        books.Description = bibtex.booktitle;
                        books.Isbn        = bibtex.isbn;

                        int pages;
                        if (int.TryParse(bibtex.pages, out pages))
                        {
                            books.NbrPages = pages;
                        }

                        int year;
                        if (int.TryParse(bibtex.year, out year))
                        {
                            books.ReleaseDate = new DateTime(year, 1, 1);
                        }

                        Books bExist = Dal.GetInstance.GetBooks(_mediaName, books.Title);
                        if (bExist == null)
                        {
                            Dal.GetInstance.AddBook(books);
                            _intAddedItem++;
                        }
                        else
                        {
                            _intNotAddedItem++;
                        }
                    }
                    Current++;
                }
            }
            catch (Exception ex)
            {
                Util.LogException(ex);
            }
        }
Esempio n. 14
0
 public PublisherController(PublisherServices services)
 {
     publisherServices = services;
 }
Esempio n. 15
0
        private void worker_DoWork_XML(object sender, DoWorkEventArgs e)
        {
            try
            {
                Total = _selectedItems.Length;

                foreach (XElement node in _selectedItems)
                {
                    Gamez games = new Gamez();
                    games.Title       = Util.GetElementValue(node, "Title");
                    games.BarCode     = Util.GetElementValue(node, "BarCode");
                    games.Comments    = Util.GetElementValue(node, "Comments");
                    games.Description = Util.GetElementValue(node, "Description");
                    games.FileName    = Util.GetElementValue(node, "FileName");
                    games.FilePath    = Util.GetElementValue(node, "FilePath");

                    DateTime dateValue;

                    if (DateTime.TryParse(Util.GetElementValue(node, "AddedDate"), out dateValue) == true)
                    {
                        games.AddedDate = dateValue;
                    }

                    if (DateTime.TryParse(Util.GetElementValue(node, "ReleaseDate"), out dateValue) == true)
                    {
                        games.ReleaseDate = dateValue;
                    }

                    #region Bool
                    bool boolValue;

                    if (bool.TryParse(Util.GetElementValue(node, "IsComplete"), out boolValue) == true)
                    {
                        games.IsComplete = boolValue;
                    }

                    if (bool.TryParse(Util.GetElementValue(node, "IsDeleted"), out boolValue) == true)
                    {
                        games.IsDeleted = boolValue;
                    }

                    if (bool.TryParse(Util.GetElementValue(node, "IsTested"), out boolValue) == true)
                    {
                        games.Watched = boolValue;
                    }

                    if (bool.TryParse(Util.GetElementValue(node, "IsWhish"), out boolValue) == true)
                    {
                        games.IsWhish = boolValue;
                    }

                    if (bool.TryParse(Util.GetElementValue(node, "ToBeDeleted"), out boolValue) == true)
                    {
                        games.ToBeDeleted = boolValue;
                    }

                    #endregion
                    #region Long
                    int longValue;

                    if (int.TryParse(Util.GetElementValue(node, "Price"), out longValue) == true)
                    {
                        games.Price = longValue;
                    }

                    if (int.TryParse(Util.GetElementValue(node, "Rated"), out longValue) == true)
                    {
                        games.Rated = longValue.ToString(CultureInfo.InvariantCulture);
                    }

                    #endregion
                    #region int
                    int intValue;

                    if (int.TryParse(Util.GetElementValue(node, "Rating"), out intValue) == true)
                    {
                        games.MyRating = intValue;
                    }
                    #endregion
                    #region Media
                    var query = from item in node.Descendants("Media")
                                select item;

                    XElement[] mediaNode = query.ToArray();

                    foreach (XElement media in mediaNode)
                    {
                        Media newMedia = MediaServices.Get(Util.GetElementValue(media, "Name"), true);
                        newMedia.Path = Util.GetElementValue(media, "Path");
                        games.Media   = newMedia;
                    }
                    #endregion
                    #region Links
                    query = from item in node.Descendants("Link")
                            select item;

                    XElement[] linksNode = query.ToArray();

                    foreach (XElement link in linksNode)
                    {
                        LinksServices.AddLinks(Util.GetElementValue(link, "Path"), games, true);
                    }
                    #endregion
                    #region Types
                    query = from item in node.Descendants("Type")
                            select item;

                    XElement[] typekNode = query.ToArray();

                    foreach (XElement type in typekNode)
                    {
                        GenreServices.AddGenres(new[] { Util.GetElementValue(type, "RealName") }, games, true);
                    }
                    #endregion
                    #region Platform
                    query = from item in node.Descendants("Platform")
                            select item;

                    XElement[] platformNode = query.ToArray();

                    foreach (XElement type in platformNode)
                    {
                        games.Platform = GameServices.GetPlatform(Util.GetElementValue(type, "Name"), true);
                    }
                    #endregion
                    #region Image
                    query = from item in node.Descendants("Ressource")
                            select item;

                    XElement[] imagesNode = query.ToArray();

                    foreach (XElement images in imagesNode)
                    {
                        if (Util.GetElementValue(images, "ResourcesType") == "Image")
                        {
                            bool   isDefault = bool.Parse(Util.GetElementValue(images, "IsDefault"));
                            byte[] cover     = Convert.FromBase64String(Util.GetElementValue(images, "Value"));

                            if (cover.Length > 0)
                            {
                                RessourcesServices.AddImage(cover, games, isDefault);
                            }
                        }
                        if (Util.GetElementValue(images, "ResourcesType") == "Background")
                        {
                            byte[] cover = Convert.FromBase64String(Util.GetElementValue(images, "Value"));

                            if (cover.Length > 0)
                            {
                                RessourcesServices.AddBackground(cover, games);
                            }
                        }
                    }
                    #endregion
                    #region Publisher
                    query = from item in node.Descendants("Editor")
                            select item;

                    XElement[] editorNode = query.ToArray();

                    foreach (XElement editor in editorNode)
                    {
                        bool isNew;
                        games.Publisher = PublisherServices.GetPublisher(Util.GetElementValue(editor, "Name"), out isNew, "App_Editor");
                        if (isNew == true)
                        {
                            Dal.GetInstance.AddPublisher("App_Editor", games.Publisher);
                        }
                    }
                    #endregion
                    #region Language
                    query = from item in node.Descendants("Language")
                            select item;

                    XElement[] languageNode = query.ToArray();

                    foreach (XElement languages in languageNode)
                    {
                        games.Language = LanguageServices.GetLanguage(Util.GetElementValue(languages, "DisplayName"), true);
                    }
                    #endregion
                    Dal.GetInstance.AddGame(games);
                    _intAddedItem++;

                    Current++;
                }
            }
            catch (Exception ex)
            {
                Util.LogException(ex);
            }
        }