public bool IsPublisherUnique(Publisher publisher) { bool result = true; foreach (Publisher item in (List<Publisher>)_publishers.CollectionView.SourceCollection) { if (item.Title == publisher.Title && item.InstitutionId == publisher.InstitutionId) result = false; } return result; }
private void SelectInstitutionOwningPublisher(Publisher publisher) { if (Institutions.MoveCurrentToFirst()) { while (!Institutions.IsCurrentAfterLast) { if (SelectedInstitution.Id == publisher.InstitutionId) return; Institutions.MoveCurrentToNext(); } } InstitutionFilteringString = ""; if (Institutions.MoveCurrentToFirst()) { while (!Institutions.IsCurrentAfterLast) { if (SelectedInstitution.Id == publisher.InstitutionId) return; Institutions.MoveCurrentToNext(); } } }
public abstract bool DeletePublisher(Publisher publisher);
public void AddAndSelectPublisher(Publisher publisher) { ((List<Publisher>)_publishers.CollectionView.SourceCollection).Add(publisher); ((List<Publisher>)_publishers.CollectionView.SourceCollection).Sort((x, y) => x.Title.CompareTo(y.Title)); _publishers.CollectionView.Refresh(); }
public abstract string SavePublisher(Publisher publisher);
public abstract bool UpdatePublisher(Publisher publisher);
public abstract Issue GetIssueByNumberWithinPublisher(Publisher publisher, int number);
public abstract IEnumerable<ResearchJournal> GetJournalsForPublisher(Publisher publisher);
private ResearchJournal ChooseJournal(Article article, Publisher publisher) { IEnumerable<ResearchJournal> jaournals = db.GetJournalsForPublisher(publisher); foreach (var journal in jaournals) { if (journal.IdWithinPublisher == article.JournalId) return journal; } return null; }
private bool savePublisher() { bool result = false; if (publisherNameTextBox.Text.Length != 0 && choosenInstitution != null) { Publisher publisher = new Publisher(choosenInstitution.Id.ToString(),"", publisherNameTextBox.Text); if (viewModel.IsPublisherUnique(publisher)) { if ((publisher.IdWithinInstitution = CentralRepository.Instance.SavePublisher(publisher)) != "") { viewModel.AddAndSelectPublisher(publisher); selectFirstPublisher(); result = true; } else { MessageBox.Show("Przy dodawaniu nowego wydawnictwa do bazy wystąpił błąd!"); } } else { MessageBox.Show("W bazie istnieje już dla określonej instytucji wydawnictwo o podanej nazwie!"); } } else { MessageBox.Show("Aby dodać nowe wydawnictwo, należy podać jej nazwę!"); } return result; }
public void AddPublisher(Publisher publisher) { XmlNode node = this.CreateDatafield("902"); XmlNode title = this.CreateSubfield(publisher.Title, "a"); node.AppendChild(title); record.AppendChild(node); }
public override bool UpdatePublisher(Publisher publisher) { throw new NotImplementedException(); }
public override string SavePublisher(Publisher publisher) { throw new NotImplementedException(); }
public override IEnumerable<ResearchJournal> GetJournalsForPublisher(Publisher publisher) { if (publisher == null || publisher.IdWithinInstitution == null) return Enumerable.Empty<ResearchJournal>(); return _journals.Where(journal => journal.PublisherId == publisher.IdWithinInstitution && journal.InstitutionId == publisher.InstitutionId); }
public override Issue GetIssueByNumberWithinPublisher(Publisher publisher, int number) { return _issues.Where(issue => issue.InstitutionId == publisher.InstitutionId && issue.PublisherId == publisher.IdWithinInstitution && issue.NumberWithinPublisher == number).FirstOrDefault(); }