//读取实时数据 public void InitData() { int ComId = PuHua.Common.PhRequest.GetQueryInt("ComId", 0); if (ComId != 0) { object o = DynamicWebServices.InvokeWebService(WebServiceURL.BasInfoeWebService, "GetOnlineVechicleInfoByComIdWebService", new object[] { ComId, PageIndex, PageSize }); Result dr = PuHua.Common.JsonHelper.Deserialize <Result>(Convert.ToString(o)); if (JsonHelp.IsJson(dr.Info.ToString())) { glist = PuHua.Common.JsonHelper.Deserialize <List <GPSOnlineInfo> >(dr.Info.ToString()); if (glist.Count > 0) { foreach (GPSOnlineInfo gInfo in glist) { //计算未上线时长 TimeSpan ts = DateTime.Now - Convert.ToDateTime(gInfo.SendTime); gInfo.UnOnlineTime = ts.Days.ToString(); //格式化时间 //DateTime dt; //DateTime.TryParse(gInfo.SendTime, dt); gInfo.SendTime = Convert.ToDateTime(gInfo.SendTime).ToString("yyyy-MM-dd HH:mm:ss"); } } } rowCount = dr.RowNumber; AspNetPager1.RecordCount = Convert.ToInt32(rowCount); AspNetPager1.PageSize = 30; } }
public void InitAllData() { int ComId = PuHua.Common.PhRequest.GetQueryInt("ComId", 0); if (ComId != 0) { object o = DynamicWebServices.InvokeWebService(WebServiceURL.BasInfoeWebService, "GetOnlineDataByComIdWebService", new object[] { ComId }); Result dr = PuHua.Common.JsonHelper.Deserialize <Result>(Convert.ToString(o)); if (JsonHelp.IsJson(dr.Info.ToString())) { gpslist = PuHua.Common.JsonHelper.Deserialize <List <GPSOnlineInfo> >(dr.Info.ToString()); if (glist.Count > 0) { foreach (GPSOnlineInfo gInfo in gpslist) { //计算未上线时长 TimeSpan ts = DateTime.Now - Convert.ToDateTime(gInfo.SendTime); gInfo.UnOnlineTime = ts.Days.ToString(); //格式化时间 gInfo.SendTime = Convert.ToDateTime(gInfo.SendTime).ToString("yyyy-MM-dd HH:mm:ss"); } } } } }
protected void InitOrgInfo() { var userInfo = LM.Common.DotNetBean.RequestSession.GetSessionUser(); if (this.ComList == null) { if (userInfo.User_Account == "system") { object s = DynamicWebServices.InvokeWebService(WebServiceURL.BasInfoeWebService, "GetCompanyListByPageWebService", new object[] { }); Result o = PuHua.Common.JsonHelper.Deserialize <Result>(Convert.ToString(s)); if (JsonHelp.IsJson(o.Info.ToString())) { ComList = PuHua.Common.JsonHelper.Deserialize <List <Company> >(o.Info.ToString()); } } else { object s = DynamicWebServices.InvokeWebService(WebServiceURL.BasInfoeWebService, "GetCompanyListByPageWebService", new object[] { }); Result o = PuHua.Common.JsonHelper.Deserialize <Result>(Convert.ToString(s)); if (JsonHelp.IsJson(o.Info.ToString())) { ComList = PuHua.Common.JsonHelper.Deserialize <List <Company> >(o.Info.ToString()); } object s2 = DynamicWebServices.InvokeWebService(WebServiceURL.BasInfoeWebService, "GetCompanyByIdWebService", new object[] { Convert.ToInt32(userInfo.ComIds) }); Result o2 = PuHua.Common.JsonHelper.Deserialize <Result>(Convert.ToString(s2)); if (JsonHelp.IsJson(o2.Info.ToString())) { cList = PuHua.Common.JsonHelper.NewtonsoftDeserialize <List <Company> >("[" + o2.Info.ToString() + "]"); } foreach (Company cInfo in cList) { sb.Append("{ id:\"" + cInfo.Id + "\", pId:\"" + cInfo.ParentId + "\", name:\"" + cInfo.ComName + "\"}"); } } } }
protected void InitDataDicInfo(StringBuilder sb) { var userInfo = LM.Common.DotNetBean.RequestSession.GetSessionUser(); string ids = userInfo.ComIds; if (this.ComList == null) { if (userInfo.User_Account == "system") { object s = DynamicWebServices.InvokeWebService(WebServiceURL.BasInfoeWebService, "GetCompanyListByPageWebService", new object[] { }); Result o = PuHua.Common.JsonHelper.Deserialize <Result>(Convert.ToString(s)); if (JsonHelp.IsJson(o.Info.ToString())) { ComList = PuHua.Common.JsonHelper.Deserialize <List <Company> >(o.Info.ToString()); } } else { object s = DynamicWebServices.InvokeWebService(WebServiceURL.BasInfoeWebService, "GetCompanyByIdSWebService", new object[] { ids }); Result o = PuHua.Common.JsonHelper.Deserialize <Result>(Convert.ToString(s)); if (JsonHelp.IsJson(o.Info.ToString())) { ComList = PuHua.Common.JsonHelper.Deserialize <List <Company> >(o.Info.ToString()); } } int outsideCount = 0; foreach (Company ComIds in ComList) { int ComId = ComIds.Id; object os = DynamicWebServices.InvokeWebService(WebServiceURL.BasInfoeWebService, "GetVehicleInfoByComIdWebService", new object[] { ComId }); Result re = PuHua.Common.JsonHelper.Deserialize <Result>(Convert.ToString(os)); if (JsonHelp.IsJson(re.Info.ToString())) { vList = PuHua.Common.JsonHelper.Deserialize <List <VehicleEntity> >(re.Info.ToString()); if (outsideCount > 0) { sb.Append(",{ id:" + ComIds.Id + ", pId:" + ComIds.ParentId + ", name:\"" + ComIds.ComName + "\"}"); } else { sb.Append("{ id:" + ComIds.Id + ", pId:" + ComIds.ParentId + ", name:\"" + ComIds.ComName + "\"}"); } foreach (VehicleEntity vinfo in vList) { if (!string.IsNullOrEmpty(sb.ToString())) { sb.Append(",{ id:" + vinfo.imei + ", pId:" + ComIds.Id + ", name:\"" + vinfo.PlateNo + "\"}"); } else { sb.Append(",{ id:" + vinfo.imei + ", pId:" + ComIds.Id + ", name:\"" + vinfo.PlateNo + "\"}"); } } } outsideCount++; } } }