Exemplo n.º 1
0
        private void UpdatePublishedBooks(string[] selectedBooks, Publishers publisherToUpdate)
        {
            if (selectedBooks == null)
            {
                publisherToUpdate.PublishedBooks = new List <PublishedBook>();
                return;
            }
            var selectedBooksHS = new HashSet <string>(selectedBooks);
            var publishedBooks  = new HashSet <int>
                                      (publisherToUpdate.PublishedBooks.Select(c => c.Book.ID));

            foreach (var book in _context.Books)
            {
                if (selectedBooksHS.Contains(book.ID.ToString()))
                {
                    if (!publishedBooks.Contains(book.ID))
                    {
                        publisherToUpdate.PublishedBooks.Add(new PublishedBook
                        {
                            PublisherID =
                                publisherToUpdate.ID,
                            BookID = book.ID
                        });
                    }
                }
                else
                {
                    if (publishedBooks.Contains(book.ID))
                    {
                        PublishedBook bookToRemove = publisherToUpdate.PublishedBooks.FirstOrDefault(i
                                                                                                     => i.BookID == book.ID);
                        _context.Remove(bookToRemove);
                    }
                }
            }
        }
Exemplo n.º 2
0
        public ExeResult Create(PublisherModel model)
        {
            message.Clear();
            if (model.Name.Length > MaxNameSize)
            {
                message.Add($"Long name >{MaxNameSize}.");
            }

            Publishers publisherTemp = _repository.GetByName(model.Name);

            if (publisherTemp != null)
            {
                if (publisherTemp.Name == model.Name)
                {
                    message.Add("This Name already exists.");
                }
            }

            if (message.Count != 0)
            {
                return(new ExeResult(message));
            }

            var publisher = ControlTools.MapTo <PublisherModel, Publishers>(model);

            model.Id = _repository.Create(publisher);
            if (model.Id == 0)
            {
                return(new ExeResult(new List <string>()
                {
                    "Publisher not create"
                }));
            }

            return(new ExeResult(new List <string>()));;
        }
 public RoutingInfoSubscriber(UnicastRoutingTable routingTable, EndpointInstances endpointInstances, IReadOnlyCollection <Type> messageTypesHandledByThisEndpoint, Publishers publishers, TimeSpan sweepPeriod, TimeSpan heartbeatTimeout)
 {
     this.routingTable      = routingTable;
     this.endpointInstances = endpointInstances;
     this.messageTypesHandledByThisEndpoint = messageTypesHandledByThisEndpoint;
     this.publishers       = publishers;
     this.sweepPeriod      = sweepPeriod;
     this.heartbeatTimeout = heartbeatTimeout;
 }
Exemplo n.º 4
0
 public void DeletePublisher(Publisher publisher)
 {
     Publishers.Remove(publisher);
     OnPropertyChanged(nameof(Publishers));
     SaveDataBase();
 }
 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);
Exemplo n.º 6
0
        public void Apply(Publishers publishers, Conventions conventions, bool enforceBestPractices)
        {
            var entries = publisherSources.SelectMany(s => Generate(conventions, s, enforceBestPractices)).ToList();

            publishers.AddOrReplacePublishers("EndpointConfiguration", entries);
        }
Exemplo n.º 7
0
 public int Create([FromBody] Publishers publisher)
 {
     return(publisherobj.AddPublisher(publisher));
 }
Exemplo n.º 8
0
 public Publisher?GetUserPublisher(FantasyCriticUser user)
 {
     return(Publishers.SingleOrDefault(x => x.User.Id == user.Id));
 }
Exemplo n.º 9
0
        private void rentABookButton_Click(object sender, EventArgs e)
        {
            if (userShowcomboBox.SelectedItem == null)
            {
                MessageBox.Show("Izberite člana.");
            }
            else
            {
                databaseController dbc          = new databaseController();
                string             selectedUser = userShowcomboBox.SelectedItem.ToString();//exception needs to be handled
                selectedUser = selectedUser.Trim();
                string[]  UserID              = selectedUser.Split('|');
                int       id_u                = Convert.ToInt32(UserID[0].Trim());
                string    name                = UserID[1].Trim();//title
                string    surname             = UserID[2].Trim();
                string    tel                 = UserID[3].Trim();
                string    address             = UserID[3].Trim();
                string    location_name       = UserID[3].Trim();
                string    location_postalcode = UserID[3].Trim();
                Locations lid                 = new Locations(0, location_name, "");
                dbc.idLocations(lid);
                int location_id = 0;
                foreach (int k in dbc.idLocations(lid))
                {
                    location_id = k;
                }
                Users uid = new Users(0, name, surname, "", "", "", "", 0);
                dbc.idUsers(uid);
                int user_id = 0;
                foreach (int k in dbc.idUsers(uid))
                {
                    user_id = k;
                }
                if (userUnLendedBookslistBox.SelectedItem == null)
                {
                    MessageBox.Show("Izberite knjigo.");
                }
                else
                {
                    string selectedBook = userUnLendedBookslistBox.SelectedItem.ToString();//exception needs to be handled
                    selectedBook = selectedBook.Trim();
                    string[] BookID = selectedBook.Split('|');
                    int      id_b   = Convert.ToInt32(BookID[0].Trim());
                    selectedBook = BookID[1].Trim();//title
                    string  author_name        = BookID[2].Trim();
                    string  author_surname     = BookID[3].Trim();
                    int     lost               = Convert.ToInt32(BookID[4].Trim());
                    string  year               = BookID[5].Trim();
                    string  location_name_book = BookID[6].Trim();
                    string  publisher_name     = BookID[7].Trim();
                    string  genre_genretype    = BookID[8].Trim();
                    int     id_g               = 0;
                    Authors aid = new Authors(0, author_name, author_surname);
                    dbc.idAuthors(aid);
                    int author_id = 0;
                    foreach (int k in dbc.idAuthors(aid))
                    {
                        author_id = k;
                    }
                    Locations lid_book = new Locations(0, location_name, "");
                    dbc.idLocations(lid);
                    int location_id_book = 0;
                    foreach (int k in dbc.idLocations(lid))
                    {
                        location_id = k;
                    }
                    Publishers pid = new Publishers(0, publisher_name);
                    dbc.idPublishers(pid);
                    int publisher_id = 0;
                    foreach (int k in dbc.idPublishers(pid))
                    {
                        publisher_id = k;
                    }
                    Genres gid = new Genres(0, genre_genretype);
                    dbc.idGenres(gid);
                    int genre_id = 0;
                    foreach (int k in dbc.idGenres(gid))
                    {
                        genre_id = k;
                    }
                    Rents rid = new Rents(0, 0, "", id_b, user_id);
                    dbc.idRents(rid);
                    int rent_id = 0;
                    foreach (int k in dbc.idRents(rid))
                    {
                        rent_id = k;
                    }

                    string rent_date  = Convert.ToString(DateTime.Now);
                    int    rent_state = 1;
                    Rents  rentss     = new Rents(rent_id, rent_state, rent_date, id_b, id_u);
                    dbc.UpdateRentsLend(rentss);
                    userUnLendedBookslistBox.Items.Clear();
                    OutputBooksOnRents_UnLended();
                }
            }
        }
Exemplo n.º 10
0
 public Book(string pName, string pFN, string pSN, string pSu,
             int pP, float pPrice, Publishers pPub)
 {
     Name          = pName; AuthorFName = pFN; AuthorSName = pSN;
     AuthorSurName = pSu; Pages = pP; Price = pPrice; pub = pPub;
 }
        internal void Apply(Publishers publishers, UnicastRoutingTable unicastRoutingTable, Func<string, string> makeCanonicalAddress, Conventions conventions)
        {
            var routeTableEntries = new Dictionary<Type, RouteTableEntry>();
            var publisherTableEntries = new List<PublisherTableEntry>();

            foreach (var m in this.Cast<MessageEndpointMapping>().OrderByDescending(m => m))
            {
                m.Configure((type, endpointAddress) =>
                {
                    if (!conventions.IsMessageType(type))
                    {
                        return;
                    }
                    var canonicalForm = makeCanonicalAddress(endpointAddress);
                    var baseTypes = GetBaseTypes(type, conventions);

                    RegisterMessageRoute(type, canonicalForm, routeTableEntries, baseTypes);
                    RegisterEventRoute(type, canonicalForm, publisherTableEntries, baseTypes);
                });
            }

            publishers.AddOrReplacePublishers("MessageEndpointMappings", publisherTableEntries);
            unicastRoutingTable.AddOrReplaceRoutes("MessageEndpointMappings", routeTableEntries.Values.ToList());
        }
Exemplo n.º 12
0
        public void SaveData()
        {
            XmlDataBase xmldata = new XmlDataBase(NewsPapers.ToArray(), Publishers.ToArray());

            data.SaveDataBase(xmldata);
        }
Exemplo n.º 13
0
        public void can_configured_publishers_load_in_configured_assemblies()
        {
            Publishers p = Publishers.Current;

            Assert.IsTrue(p.AssembliesToSearch.Any());
        }
Exemplo n.º 14
0
        public void AddPublisherWithWrongStreetNumber()
        {
            Publishers publisher = new Publishers();

            bookshopAPI.AddPublisher(PublisherList, publisher, "waneko", "podkarpacka", -13, "bialystok", BookList);
        }
Exemplo n.º 15
0
 public static Publishers WithAssembly <T>(this Publishers publishers)
 {
     return(publishers.WithAssembly(typeof(T).Assembly));
 }
Exemplo n.º 16
0
        public static void Initialize(LibraryContext context)
        {
            context.Database.EnsureCreated();
            if (context.Books.Any())
            {
                return;
            }
            var books = new Book[] {
                new Book {
                    Title  = "Baltagul",
                    Author = "Mihail Sadoveanu",
                    Price  = Decimal.Parse("22")
                },
                new Book {
                    Title  = "Enigma Otiliei",
                    Author = "George Calinescu",
                    Price  = Decimal.Parse("18")
                },
                new Book {
                    Title  = "Maytrei",
                    Author = "Mircea Eliade",
                    Price  = Decimal.Parse("27")
                },
                new Book {
                    Title  = "Panza de paianjen",
                    Author = "Cella Serghi",
                    Price  = Decimal.Parse("45")
                },
                new Book {
                    Title  = "Fata de hartie",
                    Author = "Guillame Musso",
                    Price  = Decimal.Parse("38")
                },
                new Book {
                    Title  = "De veghe in lanul de secara",
                    Author = "J.D.Salinger",
                    Price  = Decimal.Parse("28")
                },
            };

            foreach (Book b in books)
            {
                context.Books.Add(b);
            }
            context.SaveChanges();
            var customers = new Customer[] {
                new Customer {
                    CustomerID = 1050,
                    Name       = "Popescu Marcela",
                    BirthDate  = DateTime.Parse("1979-09-01")
                },
                new Customer {
                    CustomerID = 1045,
                    Name       = "Mihailescu Cornel",
                    BirthDate  = DateTime.Parse("1969-07-08")
                },
            };

            foreach (Customer c in customers)
            {
                context.Customers.Add(c);
            }
            context.SaveChanges();
            var orders = new Order[] {
                new Order {
                    BookID     = 1,
                    CustomerID = 1050,
                    OrderDate  = DateTime.Parse("02-25-2020")
                },
                new Order {
                    BookID     = 3,
                    CustomerID = 1045,
                    OrderDate  = DateTime.Parse("09-28-2020")
                },
                new Order {
                    BookID     = 1,
                    CustomerID = 1045,
                    OrderDate  = DateTime.Parse("10-28-2020")
                },
                new Order {
                    BookID     = 2,
                    CustomerID = 1050,
                    OrderDate  = DateTime.Parse("09-28-2020")
                },
                new Order {
                    BookID     = 4,
                    CustomerID = 1050,
                    OrderDate  = DateTime.Parse("09-28-2020")
                },
                new Order {
                    BookID     = 6,
                    CustomerID = 1050,
                    OrderDate  = DateTime.Parse("10-28-2020")
                },
            };

            foreach (Order e in orders)
            {
                context.Orders.Add(e);
            }
            context.SaveChanges();
            var publishers = new Publishers[] {
                new Publishers {
                    PublisherName = "Humanitas",
                    Adress        = "Str. Aviatorilor, nr. 40,Bucuresti"
                },
                new Publishers {
                    PublisherName = "Nemira",
                    Adress        = "Str. Plopilor, nr. 35,Ploiesti"
                },
                new Publishers {
                    PublisherName = "Paralela 45",
                    Adress        = "Str. Cascadelor, nr.22, Cluj-Napoca"
                },
            };

            foreach (Publishers p in publishers)
            {
                context.Publishers.Add(p);
            }
            context.SaveChanges();
            var publishedbooks = new PublishedBook[] {
                new PublishedBook {
                    BookID      = books.Single(c => c.Title == "Maytrei").ID,
                    PublisherID = publishers.Single(i => i.PublisherName == "Humanitas").ID
                },
                new PublishedBook {
                    BookID      = books.Single(c => c.Title == "Enigma Otiliei").ID,
                    PublisherID = publishers.Single(i => i.PublisherName == "Humanitas").ID
                },
                new PublishedBook {
                    BookID      = books.Single(c => c.Title == "Baltagul").ID,
                    PublisherID = publishers.Single(i => i.PublisherName == "Nemira").ID
                },
                new PublishedBook {
                    BookID      = books.Single(c => c.Title == "Fata de hartie").ID,
                    PublisherID = publishers.Single(i => i.PublisherName == "Paralela45").ID
                },
                new PublishedBook {
                    BookID      = books.Single(c => c.Title == "Panza de paianjen").ID,
                    PublisherID = publishers.Single(i => i.PublisherName == "Paralela45").ID
                },
                new PublishedBook {
                    BookID      = books.Single(c => c.Title == "De veghe in lanul de secara").ID,
                    PublisherID = publishers.Single(i => i.PublisherName == "Paralela 45").ID
                },
            };

            foreach (PublishedBook pb in publishedbooks)
            {
                context.PublishedBooks.Add(pb);
            }
            context.SaveChanges();
        }
Exemplo n.º 17
0
        private void booksDeleteButton_Click(object sender, EventArgs e)
        {
            if (bookslistBox.SelectedItem == null)
            {
                MessageBox.Show("Nobena knjiga ni izbrana.");
            }
            else
            {
                databaseController dbc          = new databaseController();
                string             selectedBook = bookslistBox.SelectedItem.ToString();//exception needs to be handled
                selectedBook = selectedBook.Trim();
                string[] BookID = selectedBook.Split('|');
                int      id_b   = Convert.ToInt32(BookID[0].Trim());
                selectedBook = BookID[1].Trim();//title
                string author_name     = BookID[2].Trim();
                string author_surname  = BookID[3].Trim();
                int    lost            = Convert.ToInt32(BookID[4].Trim());
                string year            = BookID[5].Trim();
                string location_name   = BookID[6].Trim();
                string publisher_name  = BookID[7].Trim();
                string genre_genretype = BookID[8].Trim();
                int    id_g            = 0;

                Authors aid = new Authors(0, author_name, author_surname);
                dbc.idAuthors(aid);
                int author_id = 0;
                foreach (int k in dbc.idAuthors(aid))
                {
                    author_id = k;
                }

                Locations lid = new Locations(0, location_name, "");
                dbc.idLocations(lid);
                int location_id = 0;
                foreach (int k in dbc.idLocations(lid))
                {
                    location_id = k;
                }

                Publishers pid = new Publishers(0, publisher_name);
                dbc.idPublishers(pid);
                int publisher_id = 0;
                foreach (int k in dbc.idPublishers(pid))
                {
                    publisher_id = k;
                }

                Genres gid = new Genres(0, genre_genretype);
                dbc.idGenres(gid);
                int genre_id = 0;
                foreach (int k in dbc.idGenres(gid))
                {
                    genre_id = k;
                }


                Books b = new Books(id_b, selectedBook, "", year, lost, genre_id, publisher_id, location_id);
                #region author_id
                Book_Authors id = new Book_Authors(0, id_b);
                dbc.ReadAuthorsID(id);
                int id_a = 0;
                foreach (int k in dbc.ReadAuthorsID(id))
                {
                    id_a = k;
                }

                /*string selectedAuthor = authorsBooksCombobox.SelectedItem.ToString();//exception needs to be handled
                 * selectedAuthor = selectedAuthor.Trim();
                 * string[] AuthorID = selectedAuthor.Split('|');
                 * selectedAuthor = AuthorID[1].Trim();
                 * string surname = AuthorID[2].Trim();
                 * int id_a = Convert.ToInt32(AuthorID[0].Trim());*/
                #endregion



                Book_Authors ba = new Book_Authors(author_id, id_b);
                //MessageBox.Show("author"+Convert.ToString(author_id), "book" + Convert.ToString(id_b));
                dbc.DeleteBooksAuthors(ba);
                dbc.DeleteBooks(b);
                bookslistBox.Items.Clear();
                OutputBooks();
                userUnLendedBookslistBox.Items.Clear();
                userLendedBookslistBox.Items.Clear();
                //OutputBooksOnRents_Lended();
                OutputBooksOnRents_UnLended();
            }
        }
Exemplo n.º 18
0
 public override void OverrideSource(Publisher publisher)
 => _publisher = Publishers.First(x => x.Publisher == publisher);
Exemplo n.º 19
0
 public void Apply(Publishers publishers, Conventions conventions, bool enforceBestPractices)
 {
     var entries = publisherSources.SelectMany(s => Generate(conventions, s, enforceBestPractices)).ToList();
     publishers.AddOrReplacePublishers("EndpointConfiguration", entries);
 }
Exemplo n.º 20
0
 public IActionResult Update_Post(Publishers pub)
 {
     _context.Publishers.Update(pub);
     _context.SaveChanges();
     return(RedirectToAction("Index"));
 }
Exemplo n.º 21
0
 public IReadOnlyList <Publisher> GetAllPublishersExcept(Publisher publisher)
 {
     return(Publishers.Where(x => x.PublisherID != publisher.PublisherID).ToList());
 }
 public Publishers Add([FromForm] Publishers Publisher)
 {
     _PublishersRepository.Add(Publisher);
     return(Publisher);
 }
Exemplo n.º 23
0
 public int Edit([FromBody] Publishers publisher)
 {
     return(publisherobj.UpdatePublishers(publisher));
 }
Exemplo n.º 24
0
 private void onPublisherAdd(Publisher publisher)
 {
     Publishers.Add(publisher);
 }
Exemplo n.º 25
0
 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 void AddPublisher(Publisher publisher)
 {
     Publishers.Add(publisher);
     SaveChanges();
 }
Exemplo n.º 27
0
 private void SaveDataBase()
 {
     database.SaveDataBase(new XmlDataBase(NewsPapers.ToArray(), Publishers.ToArray()));
 }
Exemplo n.º 28
0
 public SubscriptionRouter(Publishers publishers, EndpointInstances endpointInstances, Func<EndpointInstance, string> transportAddressTranslation)
 {
     this.publishers = publishers;
     this.endpointInstances = endpointInstances;
     this.transportAddressTranslation = transportAddressTranslation;
 }
Exemplo n.º 29
0
 public SubscriptionRouter(Publishers publishers, EndpointInstances endpointInstances, Func <EndpointInstance, string> transportAddressTranslation)
 {
     this.publishers                  = publishers;
     this.endpointInstances           = endpointInstances;
     this.transportAddressTranslation = transportAddressTranslation;
 }
Exemplo n.º 30
0
 public bool IsSteam() => (Publishers.Count == 1) &&
 Publishers.Any(x => x.Publisher == Publisher.Steam);
Exemplo n.º 31
0
 public RoutingComponent(UnicastRoutingTable unicastRoutingTable, DistributionPolicy distributionPolicy, EndpointInstances endpointInstances, Publishers publishers)
 {
     UnicastRoutingTable = unicastRoutingTable;
     DistributionPolicy  = distributionPolicy;
     EndpointInstances   = endpointInstances;
     Publishers          = publishers;
 }
Exemplo n.º 32
0
 public static Publishers WithCreator(this Publishers publishers, ICreator creator)
 {
     publishers.Creator = creator;
     return(publishers);
 }