Example #1
0
        public DicomCommandStatusType OnNCreate
        (
            DicomClient client,
            byte presentationID,
            int messageID,
            string affectedClass,
            string instance,
            DicomDataSet Request,
            DicomDataSet Response
        )
        {
            ClientSession             clientSession;
            NCreateClientSessionProxy sessionProxy;
            DicomCommand mediaCreateCommand;



            clientSession = new ClientSession(client);
            sessionProxy  = new NCreateClientSessionProxy(clientSession, presentationID, messageID, affectedClass, instance);

            mediaCreateCommand = DicomCommandFactory.GetInstance( ).CreateNCreateCommand(sessionProxy, Request);

            _clientSession = clientSession;
            _sessionProxy  = sessionProxy;

            clientSession.NCreateResponse += new EventHandler <NCreateResponseEventArgs>(clientSession_NCreateResponse);

            clientSession.ProcessNCreateRequest(presentationID, messageID, affectedClass, instance, mediaCreateCommand).WaitOne( );


            //TODO: use the new interface to update the instance parameter
            if (null != _status)
            {
                return(_status.Status);
            }
            else
            {
                return(DicomCommandStatusType.Failure);
            }
        }
Example #2
0
        public DicomCommandStatusType OnNCreate
        (
            DicomClient Client,
            byte presentationID,
            int messageID,
            string affectedClass,
            string instance,
            DicomDataSet Request,
            DicomDataSet Response
        )
        {
            try
            {
                ClientSession      clientSession;
                MppsNCreateCommand mppsCommand;

                if (!AddInsSession.IsLicenseValid())
                {
                    Logger.Global.SystemMessage(LogType.Information, "Worklist license not valid.  Worklist creation cannot be performed", Client.AETitle);
                    return(DicomCommandStatusType.ProcessingFailure);
                }


                clientSession = new ClientSession(Client);
                _sessionProxy = new NCreateClientSessionProxy(clientSession, presentationID, messageID, affectedClass, instance);

                if (null == DicomCommandFactory.GetInitializationService(typeof(MppsNCreateCommand)))
                {
                    DicomCommandFactory.RegisterCommandInitializationService(typeof(MppsNCreateCommand),
                                                                             new MppsCreateCommandInitializationService( ));
                }

                mppsCommand = DicomCommandFactory.GetInstance( ).CreateTypedCommand <MppsNCreateCommand> (_sessionProxy, Request);

                clientSession.NCreateResponse += new EventHandler <NCreateResponseEventArgs>(clientSession_NCreateResponse);
                mppsCommand.PPSConfiguration.ValidateRelationalAttributesAccordingToIHE = true;

                _response = Response;

                clientSession.ProcessNCreateRequest(presentationID, messageID, affectedClass, instance, mppsCommand).WaitOne( );

                return(_status);
            }
            catch (Exception exception)
            {
                Logger.Global.Log(Client.Server.AETitle,
                                  Client.Server.HostAddress,
                                  Client.Server.Port,
                                  Client.AETitle,
                                  Client.PeerAddress,
                                  Client.PeerPort,
                                  DicomCommandType.NCreate,
                                  DateTime.Now,
                                  LogType.Error,
                                  MessageDirection.Input,
                                  "NCreate Failed: " + exception.Message,
                                  Request,
                                  null);
                throw;
            }
        }