示例#1
0
        public PexaWorkspaceCreationRequested RequestPexaWorkspaceCreation(Instant eventCreatedAt, string requestedbyUserId)
        {
            // Really dodgy for demos. Always created for the given orgkey and matter.
            if (!(_orgKey == "btrcdemo" && _matterId == 30) && !(_orgKey == "trial181078920" && _matterId == 23) && !(_orgKey == "ktademo" && _matterId == 8))
            {
                if (_pexaCreationInProgress)
                {
                    throw new CannotCreatePexaWorkspaceException($"Cannot create PEXA workspace as a workspace creation request is in progress for , matter {_matterId} in Actionstep org '{_orgKey}'.");
                }

                if (!string.IsNullOrEmpty(_pexaWorkspaceId))
                {
                    // throw new CannotCreatePexaWorkspaceException($"Cannot create PEXA workspace as workspace '{_pexaWorkspaceId}' is already associated with matter {_matterId} in Actionstep org '{_orgKey}'.");
                    throw new PexaWorkspaceAlreadyExistsException(_pexaWorkspaceId, $"Cannot create PEXA workspace as workspace '{_pexaWorkspaceId}' is already associated with matter {_matterId} in Actionstep org '{_orgKey}'.");
                }
            }

            var requestedEvent = new PexaWorkspaceCreationRequested(eventCreatedAt, requestedbyUserId);

            ApplyChange(requestedEvent);
            return(requestedEvent);
        }
示例#2
0
#pragma warning disable CA1801 // Remove unused parameter: Required for event sourcing
        public void Apply(PexaWorkspaceCreationRequested pexaWorkspaceCreationRequested)
#pragma warning restore CA1801 // Remove unused parameter
        {
            _pexaCreationInProgress = true;
        }
示例#3
0
        public void MarkPexaWorkspaceCreationFailed(Instant eventCreatedAt, string message, PexaWorkspaceCreationRequested pexaWorkspaceCreationRequestInfo)
        {
            if (pexaWorkspaceCreationRequestInfo == null)
            {
                throw new ArgumentNullException(nameof(pexaWorkspaceCreationRequestInfo));
            }

            ApplyChange(new PexaWorkspaceCreationFailed(eventCreatedAt, message, pexaWorkspaceCreationRequestInfo.CorrelationId, pexaWorkspaceCreationRequestInfo.EventId));
        }