/// <summary> /// Searches for a document that contains a single object view model editing entity with a specified primary key. /// </summary> /// <param name="documentManagerService">An instance of the IDocumentManager interface used to find a document.</param> /// <param name="primaryKey">An entity primary key.</param> public static IDocument FindEntityDocument <TEntity, TPrimaryKey>(this IDocumentManagerService documentManagerService, TPrimaryKey primaryKey, string title = "") { if (documentManagerService == null) { return(null); } foreach (IDocument document in documentManagerService.Documents) { if (title != string.Empty) { if (document.Title == null) { return(null); } //BluePrints Customization Start if (document.Title.ToString() == title) { return(document); } //BluePrints Customization End } else { ISingleObjectViewModel <TEntity, TPrimaryKey> entityViewModel = document.Content as ISingleObjectViewModel <TEntity, TPrimaryKey>; if (entityViewModel != null && object.Equals(entityViewModel.PrimaryKey, primaryKey)) { return(document); } } } return(null); }
protected IDocument FindEntityDocument <TViewModel>(TPrimaryKey key) { if (DocumentManagerService == null) { return(null); } foreach (IDocument document in DocumentManagerService.Documents) { ISingleObjectViewModel <TEntity, TPrimaryKey> entityViewModel = document.Content as ISingleObjectViewModel <TEntity, TPrimaryKey>; if (entityViewModel != null && entityViewModel is TViewModel && object.Equals(entityViewModel.PrimaryKey, key)) { return(document); } } return(null); }
/// <summary> /// Searches for a document that contains a single object view model editing entity with a specified primary key. /// </summary> /// <param name="documentManagerService">An instance of the IDocumentManager interface used to find a document.</param> /// <param name="primaryKey">An entity primary key.</param> public static IDocument FindEntityDocument <TEntity, TPrimaryKey>(this IDocumentManagerService documentManagerService, TPrimaryKey primaryKey) { if (documentManagerService == null) { return(null); } foreach (IDocument document in documentManagerService.Documents) { ISingleObjectViewModel <TEntity, TPrimaryKey> entityViewModel = document.Content as ISingleObjectViewModel <TEntity, TPrimaryKey>; if (entityViewModel != null && object.Equals(entityViewModel.PrimaryKey, primaryKey)) { return(document); } } return(null); }