public static void Approve(this ProjectUpdateBatch projectUpdateBatch, FirmaSession currentFirmaSession, DateTime transitionDate, DatabaseEntities databaseEntities) { Check.Require(projectUpdateBatch.IsSubmitted(), $"You cannot approve a {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} update that has not been submitted!"); projectUpdateBatch.CommitChangesToProject(databaseEntities); projectUpdateBatch.CreateNewTransitionRecord(ProjectUpdateState.Approved, currentFirmaSession, transitionDate); projectUpdateBatch.PushTransitionRecordsToAuditLog(); }
/// <summary> /// Only public for unit testing /// </summary> public static ProjectUpdateBatch CreateProjectUpdateBatchAndLogTransition(Project project, FirmaSession currentFirmaSession) { var projectUpdateBatch = new ProjectUpdateBatch(project, DateTime.Now, currentFirmaSession.Person, ProjectUpdateState.Created, false); // create a project update history record projectUpdateBatch.CreateNewTransitionRecord(ProjectUpdateState.Created, currentFirmaSession, DateTime.Now); return(projectUpdateBatch); }
public static void RejectSubmission(this ProjectUpdateBatch projectUpdateBatch, FirmaSession currentFirmaSession, DateTime transitionDate) { Check.Require(projectUpdateBatch.IsSubmitted(), "You cannot reject a batch that has not been submitted!"); projectUpdateBatch.CreateNewTransitionRecord(ProjectUpdateState.Returned, currentFirmaSession, transitionDate); }
public static void Return(this ProjectUpdateBatch projectUpdateBatch, FirmaSession currentFirmaSession, DateTime transitionDate) { Check.Require(projectUpdateBatch.IsSubmitted(), $"You cannot return a {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} update that has not been submitted!"); projectUpdateBatch.CreateNewTransitionRecord(ProjectUpdateState.Returned, currentFirmaSession, transitionDate); }
public static void SubmitToReviewer(this ProjectUpdateBatch projectUpdateBatch, FirmaSession currentFirmaSession, DateTime transitionDate) { Check.Require(projectUpdateBatch.IsReadyToSubmit(), $"You cannot submit a {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} update that is not ready to be submitted!"); projectUpdateBatch.CreateNewTransitionRecord(ProjectUpdateState.Submitted, currentFirmaSession, transitionDate); }