Пример #1
0
        private void webBrowser1_LoadCompleted(object sender, System.Windows.Navigation.NavigationEventArgs e)
        {
            WebBrowser browser = sender as WebBrowser;

            try
            {
                if (browser == null || browser.Document == null)
                {
                    throw new Exception("网络超时,请检查网络连接");
                }

                HTMLDocument doc     = (HTMLDocument)browser.Document;
                string       infoStr = doc.documentElement.innerText;

                if (infoStr.IndexOf(SearchCode) < 0)
                {
                    throw new Exception("网络超时,请检查网络连接");
                }

                SearchedInfo = new Common.DrugInfo();
                SearchedInfo.chemicalName = GetOneInfo(infoStr, "【药品通用名】");
                if (SearchedInfo.chemicalName == null)
                {
                    throw new Exception("药品电子监管码输入错误");
                }

                //SearchedInfo.specification = GetOneInfo(infoStr, "【制剂规格】");       //暂时不用制剂规格
                SearchedInfo.form        = GetOneInfo(infoStr, "【剂型】");
                SearchedInfo.productUnit = GetOneInfo(infoStr, "【生产企业】");

                string   tempstr = GetOneInfo(infoStr, "【生产日期】");
                DateTime temptime;
                DateTime.TryParse(tempstr, out temptime);
                SearchedInfo.productTime = temptime;

                SearchedInfo.batchNumber = GetOneInfo(infoStr, "【产品批号】");
                tempstr = GetOneInfo(infoStr, "【有效期至】");
                DateTime.TryParse(tempstr, out temptime);

                SearchedInfo.licenseCode = GetOneInfo(infoStr, "【批准文号】");
                DialogResult             = true;
            }
            catch (Exception ex)
            {
                ErrorString  = ex.Message;
                DialogResult = false;
            }
            finally
            {
                deviceTimer.Stop();
                this.Close();
            }
        }
Пример #2
0
        public void SearchOneDrug(string barCode)
        {
            SearchedInfo = null;

            string datastr = "captchaUUID=&code=" + barCode;

            datastr += "&contactNo=028-86518886&systemId=drug-web& ";
            datastr += "checkcode1=" + barCode.Substring(0, 4) + " &";
            datastr += "checkcode2=" + barCode.Substring(4, 4) + "&";
            datastr += "checkcode3=" + barCode.Substring(8, 4) + "&";
            datastr += "checkcode4=" + barCode.Substring(12, 4) + "&";
            datastr += "checkcode5=" + barCode.Substring(16) + "&";
            datastr += "areaNo=028&contactNo1=86518886&captcha=1235&searchthrough=3&Submit.x=19&Submit.y=7";

            byte[] data = Encoding.ASCII.GetBytes(datastr);
            webBrowser1.Navigate(new Uri(UriAddress), null, data, UriHeader);
        }
Пример #3
0
 private void ShowFileInfo(string filename)
 {
     Common.DrugInfo drugInfo = Common.CommonMethod.ReadDrugInfo(filename);
     gridDrugInfo.DataContext = drugInfo;
 }