///------------------数据提取代码----------------------- void premanage() { LB_INFODAL dal = new LB_INFODAL(); lblist = dal.ListAll() as List <redmomery.Model.LB_INFO>; //开始进行多线程处理 int theatcount = lblist.Count / 50; Thread[] ts = new Thread[theatcount + 1]; for (int i = 0; i < ts.Length; i++) { ts[i] = new Thread(Extract); ts[i].Start(); } while (LB_library.Count != lblist.Count) { Console.Write("\r线程程序执行中..."); } Console.WriteLine("数据提取完成,开始提取数据"); string result = ""; for (int i = 0; i < LB_library.Count; i++) { result += LB_library[i].text + "\n\r"; } redmomery.command.createlog.createlogs(result); Console.WriteLine("数据提取完成。"); }
//开始进行模型修改 public void testgeogecoding() { //开始从指定的对象中获取地址,并将其保存会 //也就是取出所有模型 string[] lbs = new string[1000]; //赋值 for (int i = 0; i < lbs.Length; i++) { lbs[i] = i.ToString(); } redmomery.DAL.LB_INFODAL lt = new LB_INFODAL(); List <LB_INFO> result = new List <LB_INFO>(); Console.WriteLine("正在读取数据。。。。"); List <LB_INFO> temp = (List <LB_INFO>)lt.ListAll(); if (temp != null) { result.AddRange(temp); } Console.WriteLine("正在转换数据。。。"); for (int i = 0; i < result.Count; i++) { if (i == 343) { Console.WriteLine(); } //进行获取数据库 LB_INFO temp1 = getGecoding(result[i]); result[i] = temp1; //开始进行WKT的生成 result[i].T_ID = -1; if (result[i].X.ToString() != "" && result[i].Y.ToString() != "") { result[i].Location = lt.localtiontoWKT(result[i]); } Console.Write((i + 1).ToString() + "/"); } //现在开始逐行更改 int count = 0; Console.WriteLine("正在提交数据"); for (int i = 0; i < result.Count; i++) { count += lt.update(result[i] as LB_INFO) ? 1 : -1; Console.Write((i + 1).ToString() + "/"); } Console.WriteLine(); Console.WriteLine("\n\r有{0}行受到了影响,共计{1}", count, result.Count.ToString()); }