private void OnNewPublisherOnPropertyChanged(object sender, PropertyChangedEventArgs e) { if (!Publishers.Any(NewPublisher.Equals)) { NewPublisher.Id = NewPublisherId; } NewBook.PublisherId = NewPublisher.Id; }
public string DbgString() { StringBuilder s = new StringBuilder(); s.AppendFormat("Title: {0}\n", Title); if (!string.IsNullOrEmpty(Platform.PlatformName)) { s.AppendFormat("Platform:\n{0}", Platform); } if ((Publishers != null) && Publishers.Any()) { for (int x = 0; x < Publishers.Count; x++) { s.AppendFormat("Publisher{0}:\n{1}\n", x + 1, Publishers.ElementAt(x)); } } if ((Developers != null) && Developers.Any()) { for (int x = 0; x < Developers.Count; x++) { s.AppendFormat("Developer{0}:\n{1}\n", x + 1, Developers.ElementAt(x)); } } if ((AltTitles != null) && AltTitles.Any()) { for (int x = 0; x < AltTitles.Count; x++) { s.AppendFormat("AltTitle{0}:\n{1}\n", x + 1, AltTitles.ElementAt(x)); } } if ((Accessories != null) && Accessories.Any()) { for (int x = 0; x < Accessories.Count; x++) { s.AppendFormat("Accessory{0}:\n{1}\n", x + 1, Accessories.ElementAt(x).AccessoryName); } } if ((DLCs != null) && DLCs.Any()) { for (int x = 0; x < DLCs.Count; x++) { s.AppendFormat("DLC{0}: {1}\n", x + 1, DLCs.ElementAt(x)); } } if ((Genres != null) && Genres.Any()) { for (int x = 0; x < Genres.Count; x++) { s.AppendFormat("Genre{0}: {1}\n", x + 1, Genres.ElementAt(x)); } } s.AppendFormat("Release Decade: {0}\n", ReleaseDecade); s.AppendFormat("Release Year: {0}\n", ReleaseYear); s.AppendFormat("Release Date: {0}\n", ReleaseDate); return(s.ToString()); }
private ContentPublisher CalculatePublisher(IHaveSourcePaths game) { if (!Publishers.Any()) { throw new NotSupportedException("No supported Publishers found for: " + Id); } if (Publishers.HasPublisher(Publisher.withSIX)) { return(Publishers.GetPublisher(Publisher.withSIX)); } return(Publishers.HasPublisher(Publisher.Steam) && ((Game.SteamHelper.SteamFound && game.SteamDirectories.IsValid) || (Publishers.Count == 1)) ? Publishers.GetPublisher(Publisher.Steam) : Publishers.First(x => x.Publisher != Publisher.Steam)); }
private void AddNewEntity(object sender) { using (var context = new BookOrdersContext()) { using (DbContextTransaction transaction = context.Database.BeginTransaction(IsolationLevel.RepeatableRead)) { try { if (!Publishers.Any(NewPublisher.Equals)) { context.Publishers.Add(NewPublisher); } NewBook.PublisherId = NewPublisher.Id; if (!Books.Any(NewBook.Equals)) { context.Books.Add(NewBook); } if (!Authors.Any(NewAuthor.Equals)) { NewAuthor.Id = 0; context.Authors.Add(NewAuthor); } NewBookAndAuthor.AuthorId = NewAuthor.Id; NewBookAndAuthor.ISBN = NewBook.ISBN; context.BooksAndAuthors.Add(NewBookAndAuthor); context.SaveChanges(); transaction.Commit(); } catch (Exception e) { Exception innerException = e; while (innerException?.InnerException != null) { innerException = innerException.InnerException; } transaction.Rollback(); MessageBox.Show(innerException?.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } AddedNewEntity?.Invoke(); } } }
public bool IsMatch(ModNetworkContent c) => c.Publishers.Any(x => Publishers.Any(p => p.Id == x.PublisherId && p.Type == x.Publisher)) || PackageNames.ContainsIgnoreCase(c.PackageName) || Ids.Contains(c.Id);
public bool IsMatch(ModClientApiJsonV3WithGameId c) => c.Publishers.Any(x => Publishers.Any(p => p.Id == x.Id && p.Type == x.Type)) || PackageNames.ContainsIgnoreCase(c.PackageName) || Ids.Contains(c.Id);
public bool IsSteam() => (Publishers.Count == 1) && Publishers.Any(x => x.Publisher == Publisher.Steam);