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(); }
public void addlBtotitle(LB_INFO lb) { //创建一个帖子 int M_Id = -1; //这是老兵模块的初始ID值 int U_ID = 1; //这个是管理员值 BBSTITLE_TABLE newt1 = new BBSTITLE_TABLE(); newt1.M_ID = M_Id; newt1.U_ID = U_ID; newt1.T_key = lb.LBname; newt1.TITLE = lb.LBname; newt1.Context = lb.LBexperience; newt1.is_pass = 1; newt1.N_RESPONSE = 0; newt1.N_YES = 0; newt1.pass_TIME = DateTime.ParseExact("9999/12/31", "yyyy/MM/dd", null); newt1.F_TIME = DateTime.Now; newt1.Authonrity = 10; newt1.MD5 = redmomery.Common.MD5Helper.EncryptString(newt1.Authonrity + newt1.F_TIME.ToString() + newt1.M_ID.ToString() + newt1.Context + newt1.TITLE); try { int count = titledal.addNew(newt1); newt1 = titledal.getByMD5(newt1.MD5); lb.T_ID = newt1.ID; lbdal.update(lb); } catch (Exception ex) { redmomery.command.createlog.createlogs(ex.Message + "\n\r" + ex.StackTrace.ToString()); } }
//开始进行模型修改 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()); }
//List<LB_INFO> listLB = new List<LB_INFO>(); //for (int i = 0; i < result.Count; i++) //{ // LB_INFO lb = new LB_INFO(); // LB_INFO l1=result[i]; // //进行映射 // lb.LB_ID = int.Parse(l1.LBID); // lb.LB_JOB = l1.LBjob; // lb.LB_SEX = l1.LBsex; // lb.LB_NAME = l1.LBname; // lb.LB_LOCX =0;// l1.X; // lb.LB_LOCY = 0;// l1.Y; // lb.LB_IMGPTH = l1.LBPhoto; // lb.LB_EXPERIENCE = l1.LBexperience; // lb.LB_DESIGNATION = l1.designation; // lb.LB_ADDRESS = l1.LBdomicile; // lb.LB_LIFE = l1.LBlife; // #region 时间 // try // { // string times = l1.LBbirthday.Trim(); // if (times.IndexOf("年") <= 0) // { // try // { // lb.LB_BIRTHDAY = DateTime.ParseExact(times, "yyyy/MM/dd", null); // } // catch // { // try // { // lb.LB_BIRTHDAY = DateTime.ParseExact(times, "yyyy/MM", null); // } // catch // { // lb.LB_BIRTHDAY = DateTime.ParseExact(times, "yyyy", null); // } // } // } // else // { // try // { // lb.LB_BIRTHDAY = DateTime.ParseExact(times, "yyyy年MM月dd日", null); // } // catch // { // try // { // lb.LB_BIRTHDAY = DateTime.ParseExact(times, "yyyy年MM月", null); // } // catch // { // lb.LB_BIRTHDAY = DateTime.ParseExact(times, "yyyy年", null); // } // } // } // } // catch // { // lb.LB_BIRTHDAY = DateTime.ParseExact("9999/12/31", "yyyy/MM/dd", null); // } // #endregion // // listLB.Add(lb); // Console.WriteLine((test.InsertModel(lb) ? "成功{0}" : "失败{0}"), (i + 1).ToString()); // redmomery.command.createlog.createlogs((test.InsertModel(lb) ? "成功" + (i + 1).ToString() + "" : "失败" + (i + 1).ToString() + "")); // Console.WriteLine(i.ToString()); //} #endregion public LB_INFO getGecoding(LB_INFO lb1) { //获取指定的地址,开始进行查询 string[] xy = new string[2]; xy[0] = null; xy[1] = null; xy = getGecodingByAddress(lb1.LBdomicile); //下面开始针对这个模型进行更新 if (xy[0] != null && xy[0] != "" && xy[1] != null && xy[1] != "") { lb1.X = float.Parse(xy[0]); lb1.Y = float.Parse(xy[1]); // baiduGeocodingXY ba = redmomery.command.Geocodingcommand.getGeocodingByXYobject(lb1.X.ToString(), lb1.Y.ToString()); } return(lb1); }