コード例 #1
0
        public DicomCommandStatusType OnNAction(DicomClient Client, byte PresentationId, int MessageId, string AffectedClass, string Instance, int Action, DicomDataSet Request, DicomDataSet Response)
        {
            DicomDataSet ds = new DicomDataSet(Client.Server.TemporaryDirectory);
            string       ConnectionString = "Data Source='" + Client.Server.ServerDirectory + @"\Dicom.sdf'";
            string       DBFile           = Client.Server.ServerDirectory + @"\Dicom.sdf";

            if (!File.Exists(DBFile))
            {
                return(DicomCommandStatusType.ResourceLimitation);
            }

            ds.Copy(Request, null, null);

            MyParameters parameters = new MyParameters();

            parameters._client           = Client;
            parameters._ds               = ds;
            parameters._connectionString = ConnectionString;
            parameters._presentationId   = PresentationId;
            parameters._messageId        = MessageId;
            parameters.ServerAE          = Client.Server.AETitle;
            result = AsyncHelper.Execute <MyParameters>(new Action <MyParameters>(this.MyDelegate), parameters);

            Response = null;
            return(DicomCommandStatusType.Success);
        }
コード例 #2
0
        public void MyDelegate(MyParameters p)
        {
            Leadtools.AddIn.StorageCommit.StorageCommit commit = new Leadtools.AddIn.StorageCommit.StorageCommit();
            DicomRequest request = new DicomRequest(p._client);

            this.AddCommitItem(p._ds, DicomTag.ReferencedPerformedProcedureStepSequence, commit);
            this.AddCommitItem(p._ds, DicomTag.ReferencedSOPSequence, commit);
            foreach (StorageCommitItem item in commit.Items)
            {
                string          sql = string.Format("SELECT * FROM Images WHERE SOPInstanceUID = '{0}'", item.SOPInstanceUID);
                SqlCeDataReader r   = SqlCeHelper.ExecuteReader(p._connectionString, sql);
                if (r.Read())
                {
                    if (r["SOPClassUID"].ToString() == item.SOPClassUID)
                    {
                        string referencedFile = r["referencedFile"].ToString();
                        if (File.Exists(referencedFile))
                        {
                            item.Status = DicomCommandStatusType.Success;
                        }
                        else
                        {
                            item.Status = DicomCommandStatusType.NoSuchObjectInstance;
                        }
                    }
                    else
                    {
                        item.Status = DicomCommandStatusType.ClaseInstanceConflict;
                    }
                    item.StudyInstanceUID = r["StudyInstanceUID"].ToString();
                }
                else
                {
                    item.Status = DicomCommandStatusType.NoSuchObjectInstance;
                }
                r.Close();
            }
            DicomDataSet        commitDS = BuildDataset(p._client, commit, p.ServerAE);
            PresentationContext pc       = new PresentationContext();

            pc.AbstractSyntax = DicomUidType.StorageCommitmentPushModelClass;
            pc.TransferSyntaxes.Add(DicomUidType.ImplicitVRLittleEndian);
            request.PresentationContexts.Add(pc);
            request.RequireMessagePump = true;

            request.ReceiveNReportResponse += new ReceiveNReportResponseDelegate(request_ReceiveNReportResponse);
            request.ConnectType             = ConnectType.Conditional;

            _DicomRequest.SendNReportRequest(request, p._presentationId, p._messageId, DicomUidType.StorageCommitmentPushModelClass,
                                             DicomUidType.StorageCommitmentPushModelInstance,
                                             commit.FailedCount > 0 ? 2 : 1, commitDS);
        }