Exemple #1
0
        private object Insert(IList<Model.DataBean> list)
        {
            RunScanAndInsertHandler(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "开始导入数据……\n");

            IDaoBase<Model.DataBean> iDaoDBBase = new DataBeanDBDao();
            object result = iDaoDBBase.Save(list);
            return result;
        }
Exemple #2
0
        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();
        }
Exemple #3
0
 private IList<DataBean> getDataBeans()
 {
     RunPostDataHandler(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "开始获取要上传数据…\n");
     IDataBean iDataDbBean = new DataBeanDBDao();
     IList<DataBean> list = iDataDbBean.GetDataList();
        RunPostDataHandler(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "成功获取待上传数据" + list.Count + "条等待上传…\n");
     return list;
 }