public FindLoc GetPep(string name, string type)//修改为name 20180728 skl { string cookies = HttpContext.Current.Request.Cookies["guid"] == null ? "" : HttpContext.Current.Request.Cookies["guid"].Value as string; string session = Session.SessionID.ToString(); if (!cookies.Equals(session)) { return(null);//身份验证失败 } MLogin.GetExeUname(); string position = ""; string lng; //经度 string lat; //纬度 string datetime = SysTime.GetTime.ToString("yyyyMMdd"); FindLoc findLoc = new FindLoc(); findLoc.status = 0;//标记状态 0:未获取到客户位置 10:获取到客户位置 List <PersonLOC> locs = new List <PersonLOC>(); if (KFLocation.Get(name) != "") { findLoc.status = 10; position = KFLocation.Get(name); string[] strs_kf = position.Split(','); lng = strs_kf[0]; lat = strs_kf[1]; //只取当天人的最新记录 string sql = "select * from scue_user a where not exists(select 1 from scue_user b where b.userpu=a.userpu and b.id>a.id) and a.date ='" + datetime + "' "; List <scue_user> scue_s = BLL.SqlToList <scue_user>(MyGlobal.DataBase, sql); foreach (scue_user s in scue_s) { string[] strs = s.POINTS.Split(','); int count = strs.Length - 2; string newpoi = strs[count]; string[] poi = newpoi.Split(':'); PersonLOC o = new PersonLOC(); o.userId = s.USERPU; o.userName = s.TURENAME; o.lng = Convert.ToDouble(poi[0]); o.lat = Convert.ToDouble(poi[1]); o.lastTime = s.OPERATETIME.ToString(); locs.Add(o); } findLoc.kflng = Convert.ToDouble(lng); findLoc.kflat = Convert.ToDouble(lat); findLoc.list = locs; } return(findLoc); }
public static List <PersonLOC> GetPep(int id, string type, string datetime) { List <PersonLOC> locs = new List <PersonLOC>(); ClientService_kfku k = new ClientService_kfku(); List <ClientService_kfku> ts = k.Select(" and id=" + id); string position; string lng; //经度 string lat; //纬度 if (ts.Count > 0) { position = ts[0].ZF29; string[] strs = position.Split(','); lng = strs[0]; lat = strs[1]; } //只取当天人的最新记录 string sql = "select * from scue_user a where not exists(select 1 from scue_user b where b.userpu=a.userpu and b.id>a.id) and a.operatetime like ('" + datetime + "%')"; List <scue_user> scue_s = BLL.SqlToList <scue_user>(new BLL.数据库(), sql); foreach (scue_user s in scue_s) { string[] strs = s.POINTS.Split(','); int count = strs.Length - 2;//最后一个是空的 string newpoi = strs[count]; string[] poi = newpoi.Split(':'); PersonLOC o = new PersonLOC(); o.userId = s.USERPU; o.userName = s.TURENAME; o.lng = Convert.ToDouble(poi[0]); o.lat = Convert.ToDouble(poi[1]); locs.Add(o); } //if (type.Trim() == "YW") //{ //} //else if (type.Trim() == "YW") //{ //} //else //{ //} return(locs); }