コード例 #1
0
        /// <summary>
        /// 요청 전문
        /// </summary>
        /// <param name="patID"></param>
        /// <returns></returns>
        public static string GetRequestMessage(string patID, string serverType)
        {
            try
            {
                StringBuilder       sbDesc = new StringBuilder();
                List <StreamFormat> requestSystemHeader = GetFormat("RequestSystemHeader");
                List <StreamFormat> requestJobHeader    = GetFormat("RequestJobHeader");

                List <StreamData> requestSystemData = new List <StreamData>();
                //전문 전체 길이
                requestSystemData.Add(new StreamData("UUID", Guid.NewGuid().ToString(), "string"));
                requestSystemData.Add(new StreamData("TLGR_PRGR_NO", "1", "int"));
                requestSystemData.Add(new StreamData("TLGR_TYPE_CD", "Q", "string"));
                requestSystemData.Add(new StreamData("INRF_ID", "swd_p3ptntl_s01", "string"));
                requestSystemData.Add(new StreamData("TLGR_RQST_DT", string.Format("{0}{1}", DateTime.Now.ToString("yyyyMMddHHmmss"), DateTime.Now.Millisecond.ToString().PadLeft(3, '0')), "string"));
                requestSystemData.Add(new StreamData("TLGR_RQST_SYST_IP", NetInfo.MyIP(), "string"));
                requestSystemData.Add(new StreamData("TLGR_MEDI_DVSN_CD", "pa", "string"));
                requestSystemData.Add(new StreamData("TLGR_RQST_SYST_ID", "pa3", "string"));
                requestSystemData.Add(new StreamData("TLGR_TRNM_USER_ID", "pa3002", "string"));
                requestSystemData.Add(new StreamData("SYST_ENVR_DVSN_CD", serverType, "string"));

                string data = string.Empty;
                string type = "string";

                foreach (StreamFormat format in requestSystemHeader)
                {
                    if (format.Request == "Y")
                    {
                        var req = from R in requestSystemData
                                  where R.EngName == format.EngName
                                  select R;

                        if (req != null && req.Count() == 1)
                        {
                            data = req.First().Data;
                            type = req.First().DataType;
                        }
                        else
                        {
                            data = string.Empty;
                            type = "string";
                        }

                        if (type == "int")
                        {
                            sbDesc.Append(data.PadLeft(format.Length, '0'));
                        }
                        else
                        {
                            sbDesc.Append(data.PadRight(format.Length, ' '));
                        }
                    }
                }

                data = string.Empty;
                type = "string";
                List <StreamData> requestJobData = new List <StreamData>();
                requestJobData.Add(new StreamData("USER_ID", "pa3002", "string"));

                foreach (StreamFormat format in requestJobHeader)
                {
                    if (format.Request == "Y")
                    {
                        var req = from R in requestJobData
                                  where R.EngName == format.EngName
                                  select R;

                        if (req != null && req.Count() == 1)
                        {
                            data = req.First().Data;
                            type = req.First().DataType;
                        }
                        else
                        {
                            data = string.Empty;
                            type = "string";
                        }

                        if (type == "int")
                        {
                            sbDesc.Append(data.PadLeft(format.Length, '0'));
                        }
                        else
                        {
                            sbDesc.Append(data.PadRight(format.Length, ' '));
                        }
                    }
                }

                sbDesc.Append(patID.PadRight(8, ' '));

                string totalLen = sbDesc.ToString().Length.ToString().PadLeft(10, '0');

                return(totalLen + sbDesc.ToString());
            }
            catch
            {
                throw;
            }
        }