Beispiel #1
0
        /// <summary>
        /// 查询数据库相关列表
        /// </summary>
        /// <param name="sqlwhere"></param>
        /// <returns></returns>
        public DataTable GetDBList(List <WhereModel> list, PgsBar pgs)
        {
            DataTable dt = new DataTable();

            pgs.PgsScoroll(50, "正在查询。。。");
            dt = idefdal.GetDBList(list);
            pgs.SetMax("查询完成");
            return(dt);
        }
Beispiel #2
0
        /// <summary>
        /// 缓存数据库
        /// </summary>
        /// <param name="pgs"></param>
        /// <param name="FileName"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        public Boolean CacheTable(PgsBar pgs, string FileName, out string msg)
        {
            try
            {
                List <TableCompareModel> tblist  = new List <TableCompareModel>();
                TableCompareModel        tbmodel = new TableCompareModel();
                DataTable dt     = new DataTable();
                string    retmsg = "缓存失败";

                dt = idefdal.GetDBList(new List <WhereModel>());
                pgs.PgsScoroll(10, "源数据读取完成");
                if (dt != null)
                {
                    pgs.SetPgsMax(dt.Rows.Count + 20);
                    foreach (DataRow dr in dt.Rows)//表
                    {
                        string tbname = dr["SelName"].ToString();
                        tbmodel = new TableCompareModel();
                        tbmodel = idefdal.CreateTableModel(tbname);
                        tblist.Add(tbmodel);
                        //Thread.Sleep(500);
                        pgs.PgsScoroll(1, tbname + "缓存完成");
                    }
                }
                pgs.PgsScoroll(0, "生成缓存文件。。。");
                if (CreateXmlFile(tblist, CommonConfig.basecachepath + FileName, out retmsg))
                {
                    pgs.PgsScoroll(10, "数据缓存完成");
                }
                else
                {
                    pgs.PgsScoroll(10, "生成缓存文件失败");
                }

                msg = "数据缓存完成";
                return(true);
            }
            catch (Exception ex)
            {
                msg = ex.Message;
                pgs.PgsScoroll(0, ex.Message);
                return(false);
            }
        }
Beispiel #3
0
        /// <summary>
        /// 比对流程
        /// </summary>
        public string CompareTable(List <WhereModel> list, string tempfilename, PgsBar pgs)
        {
            try
            {
                string retmsg;
                List <TableCompareModel> source = isourcedal.GetTableListForModel(list);
                pgs.PgsScoroll(10, "源数据读取完成");
                List <TableCompareModel> target = itargetdal.GetTableListForModel(list);
                pgs.PgsScoroll(10, "目标数据读取完成");
                TableCompareList tblist = CompareTableList(source, target);
                pgs.PgsScoroll(10, "缺失表比对完成");
                pgs.SetPgsMax(tblist.tablelist.Count + 41);
                foreach (TableCompareModel model in tblist.tablelist)
                {
                    CompareColumn(model);
                    pgs.PgsScoroll(1, model.Tablename + "比对完成");
                }

                //完全匹配的表去掉
                tblist.tablelist.RemoveAll(x => x.Column.Count == 0);

                pgs.PgsScoroll(1, "正在生成比对结果");
                tblist.tablelist.AddRange(tblist.notablelist);
                if (CreateXmlFile(tblist.tablelist, GetXMLPath(tempfilename), out retmsg))
                {
                    pgs.SetMax("比对完成");
                }
                else
                {
                    pgs.PgsScoroll(0, retmsg);
                }
                return(retmsg);
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }