Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static RegistrationPipelineState GetFirstStageState(DeclarationDocflowState declarationDocflowState)
- {
- switch (declarationDocflowState)
- {
- case DeclarationDocflowState.Unknown:
- return RegistrationPipelineState.CreatedDeclaration;
- case DeclarationDocflowState.Sent:
- case DeclarationDocflowState.HasFailedTransaction:
- case DeclarationDocflowState.HasSuccessfulTransaction:
- return RegistrationPipelineState.SentDeclaration;
- case DeclarationDocflowState.Successful:
- return RegistrationPipelineState.AcceptedDeclaration;
- case DeclarationDocflowState.Failed:
- return RegistrationPipelineState.RejectedDeclaration;
- default:
- throw new ArgumentOutOfRangeException(nameof(declarationDocflowState), declarationDocflowState, null);
- }
- }
- private static RegistrationPipelineState GetSecondStageState(DeclarationDemandDocflowState declarationDemandDocflowState)
- {
- switch (declarationDemandDocflowState)
- {
- case DeclarationDemandDocflowState.Unknown:
- return RegistrationPipelineState.SentDeclaration;
- case DeclarationDemandDocflowState.AcceptedDeclaration:
- return RegistrationPipelineState.AcceptedDeclarationDemand;
- case DeclarationDemandDocflowState.RejectedDeclaration:
- return RegistrationPipelineState.RejectedDeclarationDemand;
- default:
- throw new ArgumentOutOfRangeException(nameof(declarationDemandDocflowState), declarationDemandDocflowState, null);
- }
- }
- private static RegistrationPipelineState GetThirdStageState(ReportDocflowState reportDocflowState)
- {
- switch (reportDocflowState)
- {
- case ReportDocflowState.Unknown:
- return RegistrationPipelineState.ReportCreated;
- case ReportDocflowState.Sent:
- case ReportDocflowState.HasFailedTransaction:
- case ReportDocflowState.HasSuccessfulTransaction:
- return RegistrationPipelineState.ReportSent;
- case ReportDocflowState.Successful:
- return RegistrationPipelineState.ReportAccepted;
- case ReportDocflowState.Failed:
- return RegistrationPipelineState.ReportRejected;
- default:
- throw new ArgumentOutOfRangeException(nameof(reportDocflowState), reportDocflowState, null);
- }
- }
- private static RegistrationPipelineState GetState(
- DeclarationDocflowState declarationDocflowState,
- DeclarationDemandDocflowState declarationDemandDocflowState,
- ReportDocflowState reportDocflowState)
- {
- try
- {
- var lastStage = GetFirstStageState(declarationDocflowState);
- if (lastStage != RegistrationPipelineState.AcceptedDeclaration)
- {
- lastStage = GetSecondStageState(declarationDemandDocflowState);
- if (lastStage != RegistrationPipelineState.AcceptedDeclarationDemand)
- {
- lastStage = GetThirdStageState(reportDocflowState);
- if (lastStage != RegistrationPipelineState.ReportAccepted)
- {
- //lastStage = GetForthState(reportDemandDocflowState);
- }
- }
- }
- return lastStage;
- }
- catch (ArgumentOutOfRangeException e)
- {
- throw new IllegalProgramException("Unknown RegistrationPipelineState")
- .AddData("DeclarationDocflowState", declarationDocflowState)
- .AddData("DeclarationDemandDocflowState", declarationDemandDocflowState)
- .AddData("ReportDocflowState", reportDocflowState)
- .AddData("Exception", e);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement