public static ProjectNoteUpdate Create() { var projectUpdateBatch = TestProjectUpdateBatch.Create(); var projectNoteUpdate = ProjectNoteUpdate.CreateNewBlank(projectUpdateBatch); projectNoteUpdate.Note = MakeTestProjectNoteUpdateString(); projectNoteUpdate.CreateDate = DateTime.Now; return(projectNoteUpdate); }
private PartialViewResult ViewDelete(ProjectNoteUpdate projectNoteUpdate, ConfirmDialogFormViewModel viewModel) { var canDelete = !projectNoteUpdate.HasDependentObjects(); var confirmMessage = canDelete ? $"Are you sure you want to delete this note for {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} '{projectNoteUpdate.ProjectUpdateBatch.Project.GetDisplayName()}'?" : ConfirmDialogFormViewData.GetStandardCannotDeleteMessage($"{FieldDefinitionEnum.ProjectNote.ToType().GetFieldDefinitionLabel()}"); var viewData = new ConfirmDialogFormViewData(confirmMessage, canDelete); return(RazorPartialView <ConfirmDialogForm, ConfirmDialogFormViewData, ConfirmDialogFormViewModel>(viewData, viewModel)); }
public ActionResult New(ProjectUpdateBatchPrimaryKey projectUpdateBatchPrimaryKey, EditNoteViewModel viewModel) { if (!ModelState.IsValid) { return(ViewEdit(viewModel)); } var projectUpdateBatch = projectUpdateBatchPrimaryKey.EntityObject; var projectNoteUpdate = ProjectNoteUpdate.CreateNewBlank(projectUpdateBatch); viewModel.UpdateModel(projectNoteUpdate, CurrentFirmaSession); projectNoteUpdate.ProjectUpdateBatch.TickleLastUpdateDate(CurrentFirmaSession); HttpRequestStorage.DatabaseEntities.AllProjectNoteUpdates.Add(projectNoteUpdate); return(new ModalDialogFormJsonResult()); }
public void UpdateModel(ProjectNoteUpdate projectNoteUpdate, Person currentPerson) { projectNoteUpdate.Note = Note; if (!ModelObjectHelpers.IsRealPrimaryKeyValue(projectNoteUpdate.ProjectNoteUpdateID)) { projectNoteUpdate.CreateDate = DateTime.Now; projectNoteUpdate.CreatePerson = currentPerson; } else { projectNoteUpdate.UpdateDate = DateTime.Now; projectNoteUpdate.UpdatePerson = currentPerson; } }