예제 #1
0
        /// <summary>
        /// 查询药品(按拼音)
        /// </summary>
        /// <param name="pydm">拼音代码</param>
        /// <returns></returns>
        public XmlDocument Querymedicine(string pydm)
        {
            XmlDocument doc = new XmlDocument();

            try
            {
                ArrayList _list     = new ArrayList();
                string    error_msg = "";

                QueryDB pdb = new QueryDB();
                int     ret = pdb.DB_QueryMedicine(pydm, out _list, out error_msg);

                if (ret == 0)
                {
                    XmlElement root = doc.CreateElement(AppUtils.Tag_REXML_Root);
                    doc.AppendChild(root);

                    XmlElement eleMsg = doc.CreateElement(AppUtils.Tag_REXML_Message);
                    root.AppendChild(eleMsg);

                    XmlElement eleResult = doc.CreateElement(AppUtils.Tag_REXML_Result);
                    eleResult.InnerText = AppUtils.Value_Return_Success;
                    root.AppendChild(eleResult);

                    foreach (MedicineDetail pdt in _list)
                    {
                        XmlElement eleValue = doc.CreateElement(AppUtils.Tag_REXML_Value);
                        eleMsg.AppendChild(eleValue);

                        XmlElement eleYplx = doc.CreateElement(AppUtils.Tag_Payment_YPLX);
                        eleValue.AppendChild(eleYplx);
                        eleYplx.InnerText = pdt.lx;

                        XmlElement eleYpmc = doc.CreateElement(AppUtils.Tag_Payment_YPMC);
                        eleValue.AppendChild(eleYpmc);
                        eleYpmc.InnerText = pdt.mc;

                        XmlElement eleYpdw = doc.CreateElement(AppUtils.Tag_Payment_YPDW);
                        eleValue.AppendChild(eleYpdw);
                        eleYpdw.InnerText = pdt.dw;

                        XmlElement eleYpgg = doc.CreateElement(AppUtils.Tag_Payment_YPGG);
                        eleValue.AppendChild(eleYpgg);
                        eleYpgg.InnerText = pdt.gg;

                        XmlElement eleYpcd = doc.CreateElement(AppUtils.Tag_Payment_YPCD);
                        eleValue.AppendChild(eleYpcd);
                        eleYpcd.InnerText = pdt.cd;

                        XmlElement eleYpjg = doc.CreateElement(AppUtils.Tag_Payment_YPJG);
                        eleValue.AppendChild(eleYpjg);
                        eleYpjg.InnerText = pdt.jg.ToString("0.0000");
                    }
                    //eleResult.InnerText = "1";
                }
                else
                {
                    doc = ErrorReturnXml(ret, error_msg);
                }
            }
            catch (Exception ex)
            {
                doc = ReplyXmlDoc.GetExceptionXML(AppUtils.Default_Exception_Code, ex);
            }
            return(doc);
        }