public ObservableCollection <ITitleProvider> RelatedMetaData(BookRelationType type) { ObservableCollection <ITitleProvider> objects = new ObservableCollection <ITitleProvider>(); if (type == BookRelationType.Concept) { ObservableCollection <ConceptVM> concepts = AllConcepts; foreach (ConceptVM concept in concepts) { objects.Add(concept); } } else if (type == BookRelationType.Question) { ObservableCollection <QuestionVM> questions = AllQuestions; foreach (QuestionVM question in questions) { objects.Add(question); } } else if (type == BookRelationType.Variable) { ObservableCollection <VariableVM> variables = Variables; foreach (VariableVM variable in variables) { objects.Add(variable); } } return(objects); }
public SelectMetaDataWindowVM(BookRelationType bookRelationType, string metaDataId) { this.bookRelationType = bookRelationType; bookRelationItems = new ObservableCollection<BookRelationItem>(); bookRelationItems.AddRange(BookRelationItem.All); this.allObjects = new ObservableCollection<ITitleProvider>(); this.objects = new ObservableCollection<ITitleProvider>(); this.metaDataId = metaDataId; }
public SelectMetaDataWindowVM(BookRelationType bookRelationType, string metaDataId) { this.bookRelationType = bookRelationType; bookRelationItems = new ObservableCollection <BookRelationItem>(); bookRelationItems.AddRange(BookRelationItem.All); this.allObjects = new ObservableCollection <ITitleProvider>(); this.objects = new ObservableCollection <ITitleProvider>(); this.metaDataId = metaDataId; }
public static string GetLabel(BookRelationType type) { List<BookRelationItem> items = All; foreach (BookRelationItem item in items) { if (item.Type == type) { return item.Label; } } return null; }
public static string GetLabel(BookRelationType type) { List <BookRelationItem> items = All; foreach (BookRelationItem item in items) { if (item.Type == type) { return(item.Label); } } return(null); }
private BookRelationVM SelectRelation(BookRelation selectedRelationModel) { BookRelationType type = BookRelationType.Abstract; string metaDataId = null; if (selectedRelationModel != null) { type = selectedRelationModel.BookRelationType; metaDataId = selectedRelationModel.MetadataId; } SelectMetaDataWindowVM vm = new SelectMetaDataWindowVM(type, metaDataId) { Parent = this }; vm.Init(); SelectMetaDataWindow window = new SelectMetaDataWindow(vm); window.Owner = Window; BookRelationVM relation = null; if (window.ShowDialog() == true) { BookRelation relationModel = new BookRelation(); relationModel.BookRelationType = vm.BookRelationType; ITitleProvider selectedObject = vm.SelectedObject as ITitleProvider; if (selectedObject != null) { relationModel.MetadataId = selectedObject.Id; } relation = FindExistRelation(relationModel); if (relation == null) { relation = CreateRelation(relationModel); } } return(relation); }
public BookRelationItem(BookRelationType type, string label) { Type = type; Label = label; }
private XElement CreateOtherMaterial(Book book, BookRelationType type) { XElement otherMaterial = new XElement(r + TAG_OTHER_MATERIAL, CreateIDAttribute(book.GetBookId(type)), new XAttribute(ATTR_TYPE,GetDDIBookType(book.BookTypeCode))); XElement citation = new XElement(r + TAG_CITATION, new XElement(r + TAG_TITLE, book.Title) ); otherMaterial.Add(citation); if (!string.IsNullOrEmpty(book.Author)) { citation.Add(new XElement(r + TAG_CREATOR, book.Author)); } string publisher = BuildPublisher(book); if (!string.IsNullOrEmpty(publisher)) { citation.Add(new XElement(r + TAG_PUBLISHER, publisher)); } if (!string.IsNullOrEmpty(book.Editor)) { citation.Add(new XElement(r + TAG_CONTRIBUTOR, book.Editor)); } string simpleDate = ToSimpleDate(book.AnnouncementDate); if (!string.IsNullOrEmpty(simpleDate)) { citation.Add( new XElement(r + TAG_PUBLICATION_DATE, new XElement(r + TAG_SIMPLE_DATE, simpleDate))); } if (!string.IsNullOrEmpty(book.Language)) { citation.Add(new XElement(r + TAG_LANGUAGE, book.Language)); } string identifier = BuildIdentifier(book); XElement identifierElement = null; if (!string.IsNullOrEmpty(identifier)) { identifierElement = new XElement(dc + TAG_DC_IDENTIFIER, identifier); } XElement descriptionElement = null; if (!string.IsNullOrEmpty(book.Summary)) { descriptionElement = new XElement(dc + TAG_DC_DESCRIPTION, book.Summary); } if (identifierElement != null || descriptionElement != null) { XElement dcelements = new XElement(dce + TAG_DCELEMENTS); citation.Add(dcelements); dcelements.Add(identifierElement); dcelements.Add(descriptionElement); } if (!string.IsNullOrEmpty(book.Url)) { otherMaterial.Add(new XElement(r + TAG_EXTERNAL_URL_REFERENCE, book.Url)); } foreach (BookRelation relation in book.BookRelations) { string schemeId = null; string metaDataId = relation.MetadataId; if (relation.IsBookRelationTypeAbstract) { schemeId = studyUnit.Id; metaDataId = studyUnit.Id; otherMaterial.Add(new XElement(r + TAG_RELATIONSHIP, CreateReferenceModuleID(r + TAG_RELATED_TO_REFERENCE, metaDataId, schemeId))); } else { if (relation.IsBookRelationTypeConcept) { ConceptScheme conceptScheme = studyUnit.StudyUnitModel.FindConceptSchemeByConceptId(metaDataId); schemeId = conceptScheme.Id; } else if (relation.IsBookRelationTypeQuestion) { schemeId = studyUnit.StudyUnitModel.QuestionSchemeId; } else if (relation.IsBookRelationTypeVariable) { schemeId = studyUnit.StudyUnitModel.VariableScheme.Id; } otherMaterial.Add(new XElement(r + TAG_RELATIONSHIP, CreateReferenceID(r + TAG_RELATED_TO_REFERENCE, relation.MetadataId, schemeId))); } } return otherMaterial; }
private bool IsMatchBookType(Book book, BookRelationType type) { if (book.BookRelations.Count == 0) { return BookRelationType.Abstract == type; } foreach (BookRelation relation in book.BookRelations) { if (relation.BookRelationType == type) { return true; } } return false; }
private List<Book> GetBooks(BookRelationType type) { List<Book> books = new List<Book>(); foreach (Book bookModel in studyUnit.BookModels) { if (IsMatchBookType(bookModel, type)) { //含まれる関連に従いすべての箇所で書き出す。 books.Add(bookModel); } } return books; }
private List<XElement> CreateOtherMaterials(BookRelationType type) { List<XElement> otherMaterials = new List<XElement>(); List<Book> books = GetBooks(type); foreach (Book book in books) { otherMaterials.Add(CreateOtherMaterial(book, type)); } return otherMaterials; }
public ObservableCollection<ITitleProvider> RelatedMetaData(BookRelationType type) { ObservableCollection<ITitleProvider> objects = new ObservableCollection<ITitleProvider>(); if (type == BookRelationType.Concept) { ObservableCollection<ConceptVM> concepts = AllConcepts; foreach (ConceptVM concept in concepts) { objects.Add(concept); } } else if (type == BookRelationType.Question) { ObservableCollection<QuestionVM> questions = AllQuestions; foreach (QuestionVM question in questions) { objects.Add(question); } } else if (type == BookRelationType.Variable) { ObservableCollection<VariableVM> variables = Variables; foreach (VariableVM variable in variables) { objects.Add(variable); } } return objects; }
public string GetBookId(BookRelationType type) { return IDUtils.ToId(((int)type).ToString(), Id); }
public string GetBookId(BookRelationType type) { return(IDUtils.ToId(((int)type).ToString(), Id)); }