Exemplo n.º 1
0
        private bool getData()
        {
            ConditionUtil c  = new ConditionUtil();
            DataSet       ds = new DataSet();

            string[] sqls = tranSql.Split(';');
            if (sqls.Length <= 0)
            {
                return(true);
            }
            foreach (string sql in sqls)
            {
                ds.Clear();
                string[] ss = sql.Split(',');
                try
                {
                    ds = dao.getDataSet(ss[1], c);
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        if (ss[1].Contains("tx"))
                        {
                            //处理Sqlite图像数据
                            if (dao.getDbType() == "sqllite")
                            {
                                logstr.Append("[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "] ... 获得上传数据" + ss[0] + ",数据总数为:" + ds.Tables[0].Rows.Count.ToString());
                                wirteXmlToFile(toXmlForSqlite(ds, "datas"), ss[0] + ".xml");
                            }
                            else
                            {
                                logstr.Append("[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "] ... 获得上传数据" + ss[0] + ",数据总数为:" + ds.Tables[0].Rows.Count.ToString());
                                wirteXmlToFile(DsUtil.toXml(ds, "datas"), ss[0] + ".xml");
                            }
                        }
                        else
                        {
                            logstr.Append("[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "] ... 获得上传数据" + ss[0] + ",数据总数为:" + ds.Tables[0].Rows.Count.ToString());
                            wirteXmlToFile(DsUtil.toXml(ds, "datas"), ss[0] + ".xml");
                        }
                    }
                    updateOneData(ss[2], ss[0]);
                }
                catch (Exception e)
                {
                    logstr.Append("[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "] ... 获得上传数据" + ss[0] + "失败,失败原因:" + e.Message + e.StackTrace);
                    return(false);
                }
            }
            return(true);
        }