Exemplo n.º 1
0
        public GetDrugMdsPropertyHqResponse getDrugMdsPropertyHq(GetDrugMdsPropertyHqRequest request)
        {
            HttpContext.Current.Request.InputStream.Position = 0;

            var requestStr = new StreamReader(HttpContext.Current.Request.InputStream, Encoding.UTF8).ReadToEnd();

            WorkContext = new WorkContextSoapHeader();

            /*
             * HttpContext.Current.Request.InputStream.Position = 0;
             *
             * var jsonString = new StreamReader(HttpContext.Current.Request.InputStream, Encoding.UTF8).ReadToEnd();
             */


            try
            {
                var file = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, string.Format("bin/Data/DM/getDrugMdsPropertyHq/{0}.xml", 1));

                var relativeItemCode = request.Arg0.ItemCode[0];

                if (RuleMappingHelper.ItemCode_HKID_Mapping.ContainsKey(relativeItemCode))
                {
                    relativeItemCode = RuleMappingHelper.ItemCode_HKID_Mapping[relativeItemCode];
                }

                file = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, string.Format("bin/Data/DM/getDrugMdsPropertyHq/{0}.xml", relativeItemCode));

                var doc = XDocument.Load(file);


                XNamespace x  = "http://schemas.xmlsoap.org/soap/envelope/";
                XNamespace x2 = "http://biz.dms.pms.model.ha.org.hk/";


                var element = doc.Descendants(x + "Body")
                              .Descendants(x2 + "getDrugMdsPropertyHqResponse").First();

                var str      = element.ToString().Replace("ns2:getDrugMdsPropertyHqRespons", "getDrugMdsPropertyHqRespons");
                var response = XmlHelper.XmlDeserialize <GetDrugMdsPropertyHqResponse>(str);


                /*
                 * var element1 = doc.Descendants(x + "Body")
                 *          .Descendants(x2 + "getDrugMdsPropertyHqResponse")
                 *          .Descendants("return");
                 * var returnStrs = string.Format(@"<getDrugMdsPropertyHqResponse>{0}</getDrugMdsPropertyHqResponse>", string.Join("", element1.Select(item => item.ToString()).ToArray()));
                 * var response = XmlHelper.XmlDeserialize<GetDrugMdsPropertyHqResponse>(returnStrs);
                 */

                return(response);
            }
            catch (Exception ex)
            {
                ex = ex;
                //Logger ex

                return(new GetDrugMdsPropertyHqResponse());
            }
        }
Exemplo n.º 2
0
 public DrugMasterService()
 {
     WorkContext = null;
 }
Exemplo n.º 3
0
 public PreparationService()
 {
     WorkContext = null;
 }