예제 #1
0
        private void ButtonStorageScuConnectClick(object sender, EventArgs e)
        {
            int port;
            if (!int.TryParse(_textBoxStorageScuRemotePort.Text,out port))
            {
                Platform.Log(LogLevel.Error, "Unable to parse port number: {0}", _textBoxStorageScuRemotePort.Text);
                return;
            }

            _storageScu = new StorageScu(_textBoxStorageScuLocalAe.Text,
                                                _textBoxStorageScuRemoteAe.Text,
                                                _textBoxStorageScuRemoteHost.Text, port);

            _storageScu.AddStorageInstanceList(_storageList);
            _storageScu.BeginSend(InstanceSent, _storageScu);
        }
예제 #2
0
        private void SendImages()
        {
            Random ran = new Random();
            textBox1.Clear();
            
                _seriesMap = new Dictionary<string, string>();
                _prevSentFiles = new List<DicomFile>();
                List<StorageScu> scuClients = new List<StorageScu>();
				StorageScu scu = new StorageScu(LocalAE.Text, ServerAE.Text, ServerHost.Text, int.Parse(ServerPort.Text));
                    scu.ImageStoreCompleted += new EventHandler<ImageStoreEventArgs>(scu_ImageStoreCompleted);
                    scuClients.Add(scu);

                int seriesCount = 0;
                do
                {
                    String seriesDescription = _seriesDesc[ran.Next(_seriesDesc.Count)];
                    string[] seriesUids = new string[_seriesToFilesMap.Count];
                    _seriesToFilesMap.Keys.CopyTo(seriesUids, 0);
                    String seriesToUse = seriesUids[ran.Next(_seriesToFilesMap.Count)];
                    List<string> files = _seriesToFilesMap[seriesToUse];

                
                    foreach (string path in files)
                    {
                        DicomFile file = new DicomFile(path);
                        file.Load();

                        RandomizeFile(file, seriesDescription);
                        _prevSentFiles.Add(file);


                        foreach (StorageScu client in scuClients)
                        {
                            client.AddStorageInstance(new StorageInstance(file));
                        }


                        if (ran.Next() % 50 == 0)
                            break; // don't use all images
                    }

                    seriesCount++;

                } while (ran.Next() % 5 != 0);

                Log(String.Format("Sending {0} images using {1} client(s)", _prevSentFiles.Count, scuClients.Count));
                    scu.BeginSend(InstanceSent, scu);
                    scu.Join();
                    scu.Dispose();
                
        }
예제 #3
0
파일: DROC.cs 프로젝트: khaha2210/radio
        void S2S_CC_All()
        {
            try
            {
               

                isS2Sing = true;
                SetTextWithErr(lblS2Smsg, "", false);

                if (grdStudyList.RowCount <= 0 ) return;
                //Save to Server
                DataTable dtServerList = GetServerList();
                if (dtServerList.Rows.Count <= 0)
                {
                    Utility.ShowMsg("Chưa tồn tại danh sách các PACS Server nên bạn không thể thực hiện thao tác gửi ảnh tới Server.\nBạn hãy vào mục cấu hình và khai báo các Servers.", "Thông báo");
                    return;
                }
                int TotalPatient = m_dtStudyListDataSource.Rows.Count;
                int idx = 0;
                //Duyệt qua danh sách các BN
                //Lấy về danh sách các StoreServer
                foreach (DataRow dr1 in dtServerList.Rows)
                {
                    if (Convert.ToInt32(dr1["isActive"]) == 1)//Nếu StoreServer đang được kích hoạt
                    {
                        idx = 0;
                        string LocalAETitle = dr1["CallingAETitle"].ToString();
                        string LocalAddress = dr1["LocalAddress"].ToString();
                        string RemoteAETitle = dr1["CalledAETitle"].ToString();
                        string RemoteHost = dr1["IPAddress"].ToString();
                        int Port = Convert.ToInt32(dr1["Port"]);
                        int LocalPort = Convert.ToInt32(dr1["LocalPort"]);

                        List<StorageInstance> _storageList = new List<StorageInstance>();
                        StorageScu _storageScu = new StorageScu(LocalAETitle, RemoteAETitle, RemoteHost, Port);
                        _storageScu.ImageStoreCompleted += new EventHandler<StorageInstance>(_storageScu_ImageStoreCompleted);
                        //Lấy danh sách các ảnh để đóng gói gửi vào Server
                        foreach (DataRow dr in m_dtStudyListDataSource.Rows)
                        {
                            idx++;
                            SetTextWithErr(lblS2Smsg, "Đang gửi: " + idx.ToString() + " / " + TotalPatient.ToString(), false);
                            if (dr["CHON"].ToString() == "1")//Nếu Bn đó chọn để gửi
                            {
                                long RegID = Convert.ToInt64(dr["Reg_ID"]);
                                DataTable _dtAcquisitionDataSource = new RegDetailController().GetAllData(RegID).Tables[0];
                                if (_dtAcquisitionDataSource != null && _dtAcquisitionDataSource.Rows.Count > 0)
                                {   
                                    #region Add file để gửi tới Store Server
                                    foreach (DataRow drimage in _dtAcquisitionDataSource.Rows)
                                    {
                                        string RegNumber2 = dr["Reg_NUMBER"].ToString();
                                        string sourceimgfile = txtImgDir.Text.Trim() + @"\" + SubDirLv1(RegNumber2) + @"\" + SubDirLv2_Patient(Utility.sDbnull(dr["Patient_Code"]), Utility.sDbnull(dr["Patient_Name"]), Utility.sDbnull(dr["Age"])) + @"\" + RegNumber2 + "_" + Utility.Int32Dbnull(drimage["DETAIL_ID"]).ToString() + "_" + Utility.sDbnull(drimage["ANATOMY_CODE"], "") + "_" + Utility.sDbnull(drimage["PROJECTION_CODE"], "") + ".DCM";
                                        if (File.Exists(sourceimgfile))
                                        {
                                            string ErrorMsg = "";
                                            string SuccessConnect = "";
                                            try
                                            {
                                                if (_storageScu == null) return;
                                                _storageList.Add(new StorageInstance(sourceimgfile));
                                                AppLogger.LogAction.AddLog2List(lstFPD560, "CC-->CStore Added file:" + sourceimgfile);

                                            }
                                            catch (Exception ex)
                                            {
                                                AppLogger.LogAction.AddLog2List(lstFPD560, "CC-->Exception:" + ex.Message);
                                            }
                                        }

                                    }
                                    #endregion

                                    //_storageScu.Send(LocalAETitle, RemoteAETitle, RemoteHost, Port);
                                        AppLogger.LogAction.AddLog2List(lstFPD560, "CC-->Send OK");

                                        if (new RegController().UpdateStatus(RegID, 3) == ActionResult.Success)
                                        {
                                            DataRow[] arrDr = m_dtStudyListDataSource.Select("REG_ID=" + RegID);
                                            if (arrDr.GetLength(0) > 0)
                                            {
                                                if (arrDr[0]["REGSTATUS"].ToString() != "2")
                                                    arrDr[0]["REGSTATUS"] = 3;
                                            }
                                            arrDr = m_dtWLDataSource.Select("REG_ID=" + RegID);
                                            if (arrDr.GetLength(0) > 0)
                                            {
                                                if (arrDr[0]["REGSTATUS"].ToString() != "2")
                                                    arrDr[0]["REGSTATUS"] = 3;
                                            }
                                            arrDr = m_dtWLDataSource_Suspending.Select("REG_ID=" + RegID);
                                            if (arrDr.GetLength(0) > 0)
                                            {
                                                if (arrDr[0]["REGSTATUS"].ToString() != "2")
                                                    arrDr[0]["REGSTATUS"] = 3;
                                            }
                                            m_dtStudyListDataSource.AcceptChanges();
                                            m_dtWLDataSource.AcceptChanges();
                                            m_dtWLDataSource_Suspending.AcceptChanges();

                                        }
                                }

                            }
                        }
                        if (_storageList.Count > 0)
                        {
                            while (!canbeContinued)
                            {
                            }
                            canbeContinued = false;
                            _storageScu.AddStorageInstanceList(_storageList);
                            _storageScu.BeginSend(InstanceSent, _storageScu);
                        }
                    }
                }
                //Update Datasource and reg Status
                SetTextWithErr(lblS2Smsg, "Đã gửi dữ liệu thành công!", false);
            }
            catch (Exception ex1)
            {
                AppLogger.LogAction.AddLog2List(lstFPD560, "CC-->Exception:" + ex1.Message);
            }
            finally
            {
                isS2Sing = false;
            }
        }
예제 #4
0
파일: DROC.cs 프로젝트: khaha2210/radio
        void S2S_CC()
        {
            try
            {
                isS2Sing = true;
                Utility.SetMsg(lblS2Smsg, "", false);

                if (grdStudyList.RowCount <= 0 || grdStudyList.SelectedRows == null) return;
                //Save to Server
                DataTable dtServerList = GetServerList();
                if (dtServerList.Rows.Count <= 0)
                {
                    Utility.ShowMsg("Chưa tồn tại danh sách các PACS Server nên bạn không thể thực hiện thao tác gửi ảnh tới Server.\nBạn hãy vào mục cấu hình và khai báo các Servers.", "Thông báo");
                    return;
                }
                DataRow dr = ((DataRowView)grdStudyList.CurrentRow.DataBoundItem).Row;
                long RegID = Convert.ToInt64(dr["Reg_ID"]);

                string ErrorMsg = "";
                string SuccessConnect = "";
                foreach (DataRow dr1 in dtServerList.Rows)
                {
                    try
                    {
                        if (Convert.ToInt32(dr1["isActive"]) == 1)
                        {
                            string LocalAETitle = dr1["CallingAETitle"].ToString();
                            string LocalAddress = dr1["LocalAddress"].ToString();
                            string RemoteAETitle = dr1["CalledAETitle"].ToString();
                            string RemoteHost = dr1["IPAddress"].ToString();
                            int Port = Convert.ToInt32(dr1["Port"]);
                            int LocalPort = Convert.ToInt32(dr1["LocalPort"]);
                            AppLogger.LogAction.AddLog2List(lstFPD560, "LocalAETitle=" + LocalAETitle);
                            AppLogger.LogAction.AddLog2List(lstFPD560, "RemoteAETitle=" + RemoteAETitle);
                            AppLogger.LogAction.AddLog2List(lstFPD560, "RemoteHost=" + RemoteHost);
                            AppLogger.LogAction.AddLog2List(lstFPD560, "Port=" + Port);

                            StorageScu _storageScu = new StorageScu(LocalAETitle, RemoteAETitle, RemoteHost, Port);
                            AddFiles4Store_CC(_storageScu);

                            _storageScu.BeginSend(InstanceSent, _storageScu);
                            //_storageScu.Send(LocalAETitle, RemoteAETitle, RemoteHost, Port);
                            AppLogger.LogAction.AddLog2List(lstFPD560, "CC-->Send OK");
                        }
                    }
                    catch (Exception ex)
                    {
                        AppLogger.LogAction.AddLog2List(lstFPD560, "CC-->Exception:" + ex.Message);
                    }
                }
                //Update Datasource and reg Status

                if (new RegController().UpdateStatus(RegID, 3) == ActionResult.Success)
                {
                    DataRow[] arrDr = m_dtStudyListDataSource.Select("REG_ID=" + RegID);
                    if (arrDr.GetLength(0) > 0)
                    {
                        if (arrDr[0]["REGSTATUS"].ToString() != "2")
                            arrDr[0]["REGSTATUS"] = 3;
                    }
                    arrDr = m_dtWLDataSource.Select("REG_ID=" + RegID);
                    if (arrDr.GetLength(0) > 0)
                    {
                        if (arrDr[0]["REGSTATUS"].ToString() != "2")
                            arrDr[0]["REGSTATUS"] = 3;
                    }
                    arrDr = m_dtWLDataSource_Suspending.Select("REG_ID=" + RegID);
                    if (arrDr.GetLength(0) > 0)
                    {
                        if (arrDr[0]["REGSTATUS"].ToString() != "2")
                            arrDr[0]["REGSTATUS"] = 3;
                    }
                    m_dtStudyListDataSource.AcceptChanges();
                    m_dtWLDataSource.AcceptChanges();
                    m_dtWLDataSource_Suspending.AcceptChanges();
                    if (ErrorMsg.Trim() == "") Utility.SetMsg(lblS2Smsg, "Đã gửi dữ liệu thành công!", false);
                    else Utility.SetMsg(lblS2Smsg, ErrorMsg, true);
                }

            }
            catch (Exception ex1)
            {
                AppLogger.LogAction.AddLog2List(lstFPD560, "CC-->Exception:" + ex1.Message);
            }
            finally
            {
                isS2Sing = false;
            }
        }
예제 #5
0
파일: DROC.cs 프로젝트: khaha2210/radio
        void AutoSend2miPACS_CC()
        {
            try
            {
                //if (!_DicomMedicalViewer.IsValidCell()) return;
               // CreateCStoreObject(false);
                //Save to Server
                DataTable dtServerList = GetServerList();
                if (dtServerList.Rows.Count <= 0)
                {
                    return;
                }
                string ErrorMsg = "";
                string SuccessConnect = "";
                foreach (DataRow dr1 in dtServerList.Rows)
                {
                    try
                    {
                        if (Convert.ToInt32(dr1["isActive"]) == 1)
                        {
                            string LocalAddress = Utility.sDbnull(dr1["LocalAddress"].ToString(), "");
                            string LocalAETitle = dr1["CallingAETitle"].ToString();
                            string RemoteAETitle = dr1["CalledAETitle"].ToString();
                            string RemoteHost = dr1["IPAddress"].ToString();
                            int Port = Utility.Int32Dbnull(dr1["Port"], 104);
                            int LocalPort = Utility.Int32Dbnull(dr1["LocalPort"], 0);
                            StorageScu _storageScu = new StorageScu(LocalAETitle, RemoteAETitle, RemoteHost, Port);
                            AutoAddFiles2StoreWhenFinish_CC(_storageScu);                            
                            _storageScu.BeginSend(InstanceSent, _storageScu);
                            //_storageScu.Send(LocalAETitle, RemoteAETitle, RemoteHost, Port);
                            AppLogger.LogAction.AddLog2List(lstFPD560, "CC-->Send OK");
                        }

                    }
                    catch (Exception ex)
                    {
                        AppLogger.LogAction.AddLog2List(lstFPD560, "CC-->Exception:" + ex.Message);
                    }
                }
                pnlScheduled.Controls.Clear();
                //Update Datasource and reg Status

                if (new RegController().UpdateStatus(currREGID, 3) == ActionResult.Success)
                {
                    DataRow[] arrDr = m_dtStudyListDataSource.Select("REG_ID=" + currREGID);
                    if (arrDr.GetLength(0) > 0)
                    {
                        if (arrDr[0]["REGSTATUS"].ToString() != "2")
                            arrDr[0]["REGSTATUS"] = 3;
                    }
                    arrDr = m_dtWLDataSource.Select("REG_ID=" + currREGID);
                    if (arrDr.GetLength(0) > 0)
                    {
                        if (arrDr[0]["REGSTATUS"].ToString() != "2")
                            arrDr[0]["REGSTATUS"] = 3;
                    }
                    arrDr = m_dtWLDataSource_Suspending.Select("REG_ID=" + currREGID);
                    if (arrDr.GetLength(0) > 0)
                    {
                        if (arrDr[0]["REGSTATUS"].ToString() != "2")
                            arrDr[0]["REGSTATUS"] = 3;
                    }
                    m_dtStudyListDataSource.AcceptChanges();
                    m_dtWLDataSource.AcceptChanges();
                    m_dtWLDataSource_Suspending.AcceptChanges();
                }

            }
            catch (Exception ex)
            {
                AppLogger.LogAction.AddLog2List(lstFPD560, "CC-->Exception:" + ex.Message);
            }
        }