コード例 #1
0
        public static void AssertState(this ApprenticeshipApplicationDetail apprenticeshipApplicationDetail, string errorMessage, params ApplicationStatuses[] allowedUserStatuses)
        {
            if (!allowedUserStatuses.Contains(apprenticeshipApplicationDetail.Status))
            {
                var expectedStatuses = string.Join(", ", allowedUserStatuses);
                var message          = string.Format("Application in invalid state for '{0}' (id: {1}, current: '{2}', expected: '{3}')",
                                                     errorMessage,
                                                     apprenticeshipApplicationDetail.EntityId,
                                                     apprenticeshipApplicationDetail.Status,
                                                     expectedStatuses);

                throw new CustomException(message, ErrorCodes.EntityStateError);
            }
        }
コード例 #2
0
 public static void RevertStateToDraft(this ApprenticeshipApplicationDetail apprenticeshipApplicationDetail)
 {
     apprenticeshipApplicationDetail.Status      = ApplicationStatuses.Draft;
     apprenticeshipApplicationDetail.DateApplied = null;
 }
コード例 #3
0
 public static void SetStateExpiredOrWithdrawn(this ApprenticeshipApplicationDetail apprenticeshipApplicationDetail)
 {
     apprenticeshipApplicationDetail.Status = ApplicationStatuses.ExpiredOrWithdrawn;
 }
コード例 #4
0
 public static void SetStateSubmitted(this ApprenticeshipApplicationDetail apprenticeshipApplicationDetail)
 {
     apprenticeshipApplicationDetail.Status = ApplicationStatuses.Submitted;
 }
コード例 #5
0
 public static void SetStateSubmitting(this ApprenticeshipApplicationDetail apprenticeshipApplicationDetail)
 {
     apprenticeshipApplicationDetail.Status      = ApplicationStatuses.Submitting;
     apprenticeshipApplicationDetail.DateApplied = DateTime.UtcNow;
 }
 public static void SetStateInProgress(this ApprenticeshipApplicationDetail apprenticeshipApplicationDetail)
 {
     apprenticeshipApplicationDetail.Status         = ApplicationStatuses.InProgress;
     apprenticeshipApplicationDetail.DateLastViewed = DateTime.UtcNow;
 }