public DetailViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.DocumentLibrary documentLibrary) : base(currentFirmaSession) { DocumentLibrary = documentLibrary; PageTitle = documentLibrary.DocumentLibraryName; FieldDefinitionForDocumentLibrary = FieldDefinitionEnum.DocumentLibrary.ToType(); DocumentLibraryDisplayName = FieldDefinitionForDocumentLibrary.GetFieldDefinitionLabel(); DocumentLibraryPluralized = FieldDefinitionForDocumentLibrary.GetFieldDefinitionLabelPluralized(); EntityName = DocumentLibraryDisplayName; UserHasDocumentLibraryManagePermissions = new DocumentLibraryManageFeature().HasPermissionByFirmaSession(currentFirmaSession); EditDocumentLibraryUrl = documentLibrary.GetEditUrl(); IndexUrl = SitkaRoute<DocumentLibraryController>.BuildUrlFromExpression(c => c.Index()); DocumentLibraryDocumentGridSpec = new DocumentLibraryDocumentGridSpec(UserHasDocumentLibraryManagePermissions) { ObjectNameSingular = "Document", ObjectNamePlural = "Documents", SaveFiltersInCookie = true }; DocumentLibraryDocumentsGridName = "documentLibraryDocumentsGrid"; DocumentLibraryDocumentGridDataUrl = SitkaRoute<DocumentLibraryController>.BuildUrlFromExpression(c => c.DocumentLibraryDocumentGridJsonData(documentLibrary)); NewDocumentUrl = SitkaRoute<DocumentLibraryController>.BuildUrlFromExpression(x => x.NewDocument(documentLibrary)); EditDocumentSortOrderUrl = SitkaRoute<DocumentLibraryController>.BuildUrlFromExpression(x => x.EditDocumentSortOrder(documentLibrary)); }
public EditViewModel(ProjectFirmaModels.Models.DocumentLibrary documentLibrary) { DocumentLibraryID = documentLibrary.DocumentLibraryID; DocumentLibraryName = documentLibrary.DocumentLibraryName; Description = documentLibrary.DocumentLibraryDescription; DocumentCategoryIDs = documentLibrary.DocumentLibraryDocumentCategories.Select(x => x.DocumentCategoryID).ToList(); CustomPageIDs = documentLibrary.CustomPages.Select(x => x.CustomPageID).ToList(); }
/// <summary> /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible /// </summary> public DocumentLibraryDocumentCategory(DocumentLibrary documentLibrary, DocumentCategory documentCategory) : this() { // Mark this as a new object by setting primary key with special value this.DocumentLibraryDocumentCategoryID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue(); this.DocumentLibraryID = documentLibrary.DocumentLibraryID; this.DocumentLibrary = documentLibrary; documentLibrary.DocumentLibraryDocumentCategories.Add(this); this.DocumentCategoryID = documentCategory.DocumentCategoryID; }
/// <summary> /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible /// </summary> public DocumentLibraryDocument(DocumentLibrary documentLibrary, DocumentCategory documentCategory, string documentTitle, FileResourceInfo fileResourceInfo, DateTime lastUpdateDate, Person lastUpdatePerson) : this() { // Mark this as a new object by setting primary key with special value this.DocumentLibraryDocumentID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue(); this.DocumentLibraryID = documentLibrary.DocumentLibraryID; this.DocumentLibrary = documentLibrary; documentLibrary.DocumentLibraryDocuments.Add(this); this.DocumentCategoryID = documentCategory.DocumentCategoryID; this.DocumentTitle = documentTitle; this.FileResourceInfoID = fileResourceInfo.FileResourceInfoID; this.FileResourceInfo = fileResourceInfo; fileResourceInfo.DocumentLibraryDocuments.Add(this); this.LastUpdateDate = lastUpdateDate; this.LastUpdatePersonID = lastUpdatePerson.PersonID; this.LastUpdatePerson = lastUpdatePerson; lastUpdatePerson.DocumentLibraryDocumentsWhereYouAreTheLastUpdatePerson.Add(this); }
public void UpdateModel(ProjectFirmaModels.Models.DocumentLibrary documentLibrary, ICollection <DocumentLibraryDocumentCategory> allDocumentLibraryDocumentCategories) { documentLibrary.DocumentLibraryName = DocumentLibraryName; documentLibrary.DocumentLibraryDescription = Description; var documentCategoriesUpdated = DocumentCategoryIDs.Select(x => new DocumentLibraryDocumentCategory(documentLibrary.DocumentLibraryID, x)).ToList(); documentLibrary.DocumentLibraryDocumentCategories.Merge(documentCategoriesUpdated, allDocumentLibraryDocumentCategories, (x, y) => x.DocumentLibraryID == y.DocumentLibraryID && x.DocumentCategoryID == y.DocumentCategoryID, HttpRequestStorage.DatabaseEntities); var oldCustomPages = documentLibrary.CustomPages.Where(x => !CustomPageIDs.Contains(x.CustomPageID)); foreach (var customPage in oldCustomPages) { customPage.DocumentLibraryID = null; } var customPages = HttpRequestStorage.DatabaseEntities.CustomPages.Where(x => CustomPageIDs.Contains(x.CustomPageID)).ToList(); documentLibrary.CustomPages = customPages; }
/// <summary> /// Creates a "blank" object of this type and populates primitives with defaults /// </summary> public static DocumentLibraryDocument CreateNewBlank(DocumentLibrary documentLibrary, DocumentCategory documentCategory, FileResourceInfo fileResourceInfo, Person lastUpdatePerson) { return(new DocumentLibraryDocument(documentLibrary, documentCategory, default(string), fileResourceInfo, default(DateTime), lastUpdatePerson)); }
public NewDocumentViewModel(ProjectFirmaModels.Models.DocumentLibrary documentLibrary) { DocumentLibraryID = documentLibrary.DocumentLibraryID; }
/// <summary> /// Creates a "blank" object of this type and populates primitives with defaults /// </summary> public static DocumentLibraryDocumentCategory CreateNewBlank(DocumentLibrary documentLibrary, DocumentCategory documentCategory) { return(new DocumentLibraryDocumentCategory(documentLibrary, documentCategory)); }