static void Main(string[] args) { List <trajectory> list = new List <trajectory>(); trajectoryDAL dal = new trajectoryDAL(); list = dal.getByLBID((141).ToString()); //dal.AddNew(model); //dal.Update(model); for (int i = 0; i < list.Count; i++) { trajectory model = list[i]; LBTRACK mo = new LBTRACK(); mo.ID = int.Parse(model.ID.ToString()); mo.T_time = model.T_time; mo.Timetext = model.Timetext; mo.Local = model.Local; mo.context = model.context; mo.x = model.x; mo.y = model.y; mo.LBID = model.LBID;//..... mo.isCurrent = model.isCurrent; LB_INFO lb = new LB_INFO(); LB_INFODAL lbdal = new LB_INFODAL(); lb = lbdal.get(mo.LBID); mo.name = lb.LBname; LBTRACKDAL tdal = new LBTRACKDAL(); tdal.AddNew(mo); } Console.WriteLine("程序结束"); Console.Read(); }
///------------------数据提取代码----------------------- 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()); }