public VerifyResponse Verify(VerifyRequest request)
        {
            try
            {
                var verify = new VerificationScu();

                var result = verify.Verify(request.LocalApplicationEntity, request.RemoteApplicationEntity.AETitle, request.RemoteApplicationEntity.ScpParameters.HostName, request.RemoteApplicationEntity.ScpParameters.Port);

                if (result == VerificationResult.AssociationRejected)
                {
                    var fault = new VerificationFailedFault
                    {
                        Description = SR.VerifyAssociationRejected,
                        Result      = result
                    };
                    throw new FaultException <VerificationFailedFault>(fault, fault.Description);
                }
                if (result == VerificationResult.Failed)
                {
                    var fault = new VerificationFailedFault
                    {
                        Description = SR.VerifyFailed,
                        Result      = result
                    };
                    throw new FaultException <VerificationFailedFault>(fault, fault.Description);
                }
                if (result == VerificationResult.Canceled)
                {
                    var fault = new VerificationFailedFault
                    {
                        Description = SR.VerifyCanceled,
                        Result      = result
                    };
                    throw new FaultException <VerificationFailedFault>(fault, fault.Description);
                }
                if (result == VerificationResult.TimeoutExpired)
                {
                    var fault = new VerificationFailedFault
                    {
                        Description = SR.VerifyTimeoutExpired,
                        Result      = result
                    };
                    throw new FaultException <VerificationFailedFault>(fault, fault.Description);
                }

                return(new VerifyResponse
                {
                    Result = verify.Result
                });
            }
            catch (Exception e)
            {
                Platform.Log(LogLevel.Info, "User DICOM Verification not understood: {0}", e.Message);
                var fault = new VerificationFailedFault
                {
                    Description = e.Message,
                    Result      = VerificationResult.Failed
                };
                throw new FaultException <VerificationFailedFault>(fault, fault.Description);
            }
        }
Esempio n. 2
0
		public VerifyResponse Verify(VerifyRequest request)
		{
			try
			{
				var verify = new VerificationScu();

				var result = verify.Verify(request.LocalApplicationEntity, request.RemoteApplicationEntity.AETitle, request.RemoteApplicationEntity.ScpParameters.HostName, request.RemoteApplicationEntity.ScpParameters.Port);

				if (result == VerificationResult.AssociationRejected)
				{
					var fault = new VerificationFailedFault
						{
							Description = SR.VerifyAssociationRejected,
							Result = result
						};
					throw new FaultException<VerificationFailedFault>(fault, fault.Description);
				}
				if (result == VerificationResult.Failed)
				{
					var fault = new VerificationFailedFault
						{
							Description = SR.VerifyFailed,
							Result =  result
						};
					throw new FaultException<VerificationFailedFault>(fault, fault.Description);
				}
				if (result == VerificationResult.Canceled)
				{
					var fault = new VerificationFailedFault
						{
							Description = SR.VerifyCanceled,
							Result = result
						};
					throw new FaultException<VerificationFailedFault>(fault, fault.Description);
				}
				if (result == VerificationResult.TimeoutExpired)
				{
					var fault = new VerificationFailedFault
						{
							Description = SR.VerifyTimeoutExpired,
							Result = result
						};
					throw new FaultException<VerificationFailedFault>(fault, fault.Description);
				}

				return new VerifyResponse
					{
						Result = verify.Result
					};
			}
			catch (Exception e)
			{
				Platform.Log(LogLevel.Info, "User DICOM Verification not understood: {0}", e.Message);
				var fault = new VerificationFailedFault
				{
					Description = e.Message,
					Result = VerificationResult.Failed
				};
				throw new FaultException<VerificationFailedFault>(fault, fault.Description);
			}
		}