Beispiel #1
0
        private CmdReqBase BuildCmdReqNewImage(RdetOutChannel ch, DataRow dr)
        {
            CmdReqNewImage request = new CmdReqNewImage();

            //CmdReqNewPatient request = new CmdReqNewPatient();
            foreach (RdetOutQueryResultItem item in ch.Rule.QueryResult.MappingList)
            {
                if (item.ThirdPartyDBPatamter.FieldName.Trim() == "")
                {
                    continue;
                }
                if (item.ThirdPartyDBPatamter.FieldName.Trim().ToLower() == CommandToken.CommandHeadToken.ToLower()) //'Command'
                {
                    continue;
                }
                //string FName = item.ThirdPartyDBPatamter.FieldName.Trim();
                string FName  = item.TargetField;
                string FValue = StarConvert.DBValueToString(dr[FName], "");
                if (FValue.Trim() == "")
                {
                    continue;
                }
                request.AddParameter(FName, FValue);
            }
            return(request);
        }
Beispiel #2
0
 private bool IsExist(RdetOutChannel ch, string fieldname)
 {
     foreach (RdetOutQueryResultItem item in ch.Rule.QueryResult.MappingList)
     {
         if (item.TargetField == fieldname)
         {
             return(true);
         }
     }
     return(false);
 }
Beispiel #3
0
        private void InsertDataDT(RdetOutChannel chn)
        {
            RdetOutQueryResultItem item = new RdetOutQueryResultItem();

            item.ThirdPartyDBPatamter.FieldName = "";
            item.TargetField   = "data_dt";
            item.GWDataDBField = GWDataDBField.i_DataDateTime;
            item.SourceField   = item.GWDataDBField.FieldName;

            chn.Rule.QueryResult.MappingList.Add(item);
        }
Beispiel #4
0
        public FChannel(FRdetOutConfiguration frm, XCollection <RdetOutChannel> channels)
        {
            InitializeComponent();
            parentForm   = frm;
            channelSet   = channels;
            type         = "Add";
            channel      = new RdetOutChannel();
            criteriaList = new XCollection <RdetOutQueryCriterialItem>();
            resultList   = new XCollection <RdetOutQueryResultItem>();

            this.Text = "Add Channel";
            GetChannelNameSet(channels);
        }
Beispiel #5
0
        private CmdReqBase BuildCmdReqNewPatient(RdetOutChannel ch, DataRow dr)
        {
            CmdReqNewPatient request = new CmdReqNewPatient();

            foreach (RdetOutQueryResultItem item in ch.Rule.QueryResult.MappingList)
            {
                if (item.ThirdPartyDBPatamter.FieldName.Trim() == "")
                {
                    continue;
                }
                if (item.ThirdPartyDBPatamter.FieldName.Trim().ToLower() == CommandToken.CommandHeadToken.ToLower()) //'Command'
                {
                    continue;
                }

                if (item.ThirdPartyDBPatamter.FieldName.Trim().ToUpper() == ("StudyInstanceUID").ToUpper())
                {
                    _fStudyInstanceUID = item.GWDataDBField;
                }

                string FName  = item.TargetField;
                string FValue = StarConvert.DBValueToString(dr[FName], "");
                if (FValue.Trim() == "")
                {
                    continue;
                }

                // 2007-04-02: Out DateTime format is implemented by gateway framework, here need not translate

                //if (FName.Trim().ToLower() == ("BirthDate").ToLower())
                //{
                //    FValue = Convert.ToDateTime(FValue).ToString("yyyyMMdd");
                //}

                //if (FName.Trim().ToLower() == ("StudyDate").ToLower())
                //{
                //    FValue = Convert.ToDateTime(FValue).ToString("yyyyMMdd");
                //}

                //if (FName.Trim().ToLower() == ("StudyTime").ToLower())
                //{
                //    FValue = Convert.ToDateTime(FValue).ToString("HHmmss");
                //}


                request.AddParameter(FName, FValue);
            }
            return(request);
        }
Beispiel #6
0
        public FChannel(FRdetOutConfiguration frm, XCollection <RdetOutChannel> channels, int index)
        {
            InitializeComponent();
            parentForm   = frm;
            channelSet   = channels;
            type         = "Modify";
            channel      = channels[index];
            channelIndex = index;
            criteriaList = channel.Rule.QueryCriteria.MappingList;
            resultList   = channel.Rule.QueryResult.MappingList;

            this.Text = "Modify Channel";
            GetChannelNameSet(channels);
            ShowChannel();
        }
Beispiel #7
0
        /// <summary>
        /// Copy Channel
        /// </summary>
        /// <param name="frm"></param>
        /// <param name="channels"></param>
        /// <param name="copyChannel"></param>
        public FChannel(FRdetOutConfiguration frm, XCollection <RdetOutChannel> channels, RdetOutChannel copyChannel)
        {
            InitializeComponent();
            parentForm = frm;
            channelSet = channels;
            type       = "Add";

            channel      = copyChannel;
            criteriaList = channel.Rule.QueryCriteria.MappingList;
            resultList   = channel.Rule.QueryResult.MappingList;

            this.Text = "Add Channel";
            GetChannelNameSet(channels);
            ShowChannel();
        }
Beispiel #8
0
        private void btnChannelCopy_Click(object sender, EventArgs e)
        {
            int count = channelSet.Count;

            RdetOutChannel copyChannel = channelSet[channelIndex].Clone();

            copyChannel.ChannelName += "_copy";

            FChannel frm = new FChannel(this, channelSet, copyChannel);

            frm.ShowDialog(pMain);

            if (channelSet.Count > count)
            {  // Add successfully
                channelIndex = count;
                lstvChannel.Items[channelIndex].Selected = true;
            }
        }
Beispiel #9
0
        private void SendCommand2Server(RdetOutChannel ch, DataSet ds)
        {
            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                // build command
                if (!ds.Tables[0].Columns.Contains("Command"))
                {
                    Program.Log.Write(LogType.Error, "Configuration File error!Cannot find column 'Command'!\r\n" +
                                      "channel name:" + ch.ChannelName + "\r\n");

                    return;
                    //throw new Exception("");
                }

                try
                {
                    CmdReqBase request = null;

                    if (CommandToken.IsNewPatient(dr["Command"].ToString()))
                    {
                        request = BuildCmdReqNewPatient(ch, dr);
                    }
                    else if (CommandToken.IsUpdatePatient(dr["Command"].ToString()))
                    {
                        request = BuildCmdReqUpdatePatient(ch, dr);
                    }
                    else if (CommandToken.IsNewImage(Convert.ToString(dr["Command"])))
                    {
                        request = BuildCmdReqNewImage(ch, dr);
                    }

                    if (request == null)
                    {
                        Program.Log.Write("Invalid DataRow! Command=" + dr["Command"].ToString() + " \r\n");
                        continue;
                    }



                    // Send Command
                    CmdRespBase resp;
                    if (Program.bStandalone)
                    {
                        resp = new CmdRespBase();
                        resp.AddParameter(CommandToken.StudyInstanceUID, "StudyInstenceUID001");
                        resp.ErrorCode = "0";
                    }
                    else
                    {
                        resp = _ClientSocket.SendCommand(request);
                    }

                    _ClientSocket.DisConnect(false);
                    if (resp == null)
                    {
                        Program.Log.Write("There is no correct response or no response data to request ! \r\n");
                        continue;
                    }

                    if (Convert.ToInt32(resp.ErrorCode) == 0)
                    {
                        if (OnDataDischarge != null)
                        {
                            this.OnDataDischarge(new string[] { Convert.ToString(dr["Data_ID"]) });
                        }

                        //Write StudyinstanceUID
                        if (CommandToken.IsNewPatient(request.Command))
                        {
                            UpdateStudyInstanceUID(Convert.ToString(dr["Data_ID"]), resp.GetParamValue(CommandToken.StudyInstanceUID), _fStudyInstanceUID);
                        }
                    }
                    else
                    {
                        RdetError Err = RdetErrorMgt.GetRdetError(Convert.ToInt32(resp.ErrorCode.Trim()));
                        Program.Log.Write(LogType.Error, "------------Error Exist! ----------------------------------------\r\n"
                                          + "ErrorCode=" + Err.Code.ToString() + "\r\n"
                                          + "Error Description: " + Err.ErrorDescription + "\r\n"
                                          + "Error Resolution : " + Err.ErrorDescription + "\r\n"
                                          + "----------------------------------------------------------------\r\n", true);
                    }
                }
                catch (Exception ex)
                {
                    Program.Log.Write(LogType.Error, "Unknow Error:" + ex.Message + "\r\n" +
                                      "channel Name:" + ch.ChannelName + "\r\n");
                }
            }
        }