예제 #1
0
파일: Gen.cs 프로젝트: pjjwpc/SCZYDJGJK
        public void DoSubmit()
        {
            try
            {
               RunPostDataHandler(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "开始上传数据…\n");
                IList<DataBean> list = this.getDataBeans();
                if (list.Count > 0)
                {
                    try
                    {
                        IDataBean iDataXmlBean = new DataBeanXMLDao();
                        LsjService.MainService m = new MainService();
                        string xml = m.Request(iDataXmlBean.BuildXml(list));
                        string msg = "";
                        string code = "";
                        XmlDocument xmlDocument = new XmlDocument();
                        xmlDocument.LoadXml(xml);
                        XmlNode xmlNode = (XmlNode)xmlDocument["lsjPackage"];
                        XmlNode xmlBc = (XmlNode)xmlNode["businessContent"];
                        XmlNode xmlConte = (XmlNode)xmlBc["subPackage"];
                        string strXml = xmlConte.ChildNodes[1].InnerText.ToString().Trim();
                        XmlDocument xmlTemp = new XmlDocument();
                        xmlTemp.LoadXml(strXml);
                        XmlNode xmlNodeList = xmlTemp.SelectSingleNode("/cpXML/xsjls");
                        msg = xmlNodeList.InnerText;
                        if (msg.Contains("成功"))
                        {
                            RunPostDataHandler(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "成功上传数据到服务器…\n");
                            RunPostDataHandler(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "开始修改数据状态…\n");
                            IDataBean iBean = new DataBeanDBDao();
                            if (iBean.UpdateState(list) > 0)
                            {
                                RunPostDataHandler(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "修改数据状态成功!…\n");
                            }
                            else
                            {
                                StringBuilder sb = new StringBuilder();
                                foreach (var temp in list)
                                {
                                    sb.Append(temp.ID + ",");
                                }
                                RunPostDataHandler(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "修改数据状态失败记录ID号(" + sb.ToString() +
                                                ")!…\n");
                            }
                        }
                        else
                        {
                            RunPostDataHandler(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "上传数据失败:" + msg + "!…\n");
                        }
                    }
                    catch (Exception ex)
                    {
                        RunPostDataHandler(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "应用程序异常:" + ex.Message + "!…\n");
                    }
                }
                else
                {
                    RunPostDataHandler(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "没有未上传的数据\n");
                }
            }
            catch (Exception e)
            {
                RunPostDataHandler(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "应用程序异常:" + e.Message);

            }
            thScThread.Abort();
        }
예제 #2
0
파일: Gen.cs 프로젝트: pjjwpc/SCZYDJGJK
 public bool RequestPrice()
 {
     string zydbh = ConfigurationManager.AppSettings["ZydBh"];
     IDataBean iDaoBase = new DataBeanXMLDao();
     LsjService.MainService m = new MainService();
     string xml = m.Request(iDaoBase.BuildXml(zydbh));
     try
     {
         JxXml(xml);
         return true;
     }
     catch (Exception)
     {
         return false;
     }
 }