private PagedDataList<DeviceManageViewModel> GetDeviceManageViewModel(string tenantCode, EMTenant tenant, int rowIndex, int pageSize) { //获取车辆信息 EMVehicleService vehicleService = new EMVehicleService(); int rowCount = 0; IList<EMVehicle> vehicleList = vehicleService.SelectAll(new string[] { tenantCode }.ToList(), rowIndex, pageSize, ref rowCount, "InstallTime", false); if (rowCount == 0) { return null; } //获取当前服务器时间 DateTime nowTime = DateTime.Now; //拼装ViewModel List<DeviceManageViewModel> modelList = new List<DeviceManageViewModel>(); foreach (EMVehicle vehicle in vehicleList) { DeviceManageViewModel model = GetDeviceManageVM(nowTime, vehicle, tenant); modelList.Add(model); } return new PagedDataList<DeviceManageViewModel>() { Datas = modelList, RowCount = rowCount }; }
private List<DeviceManageViewModel> GetDeviceManageViewModel(IList<EMTenant> tenantList) { //获取车辆信息 IEMVehicleService vehicleService = new EMVehicleService(); IList<EMVehicle> vehicleList = vehicleService.SelectAll(tenantList.Select(f => f.TenantCode).ToList()).OrderByDescending(f => f.InstallTime).ToList(); //获取当前服务器时间 DateTime nowTime = DateTime.Now; //拼装ViewModel List<DeviceManageViewModel> modelList = new List<DeviceManageViewModel>(); foreach (EMVehicle vehicle in vehicleList) { EMTenant tenant = tenantList.Where(f => f.TenantCode == vehicle.TenantCode).FirstOrDefault(); DeviceManageViewModel model = GetDeviceManageVM(nowTime, vehicle, tenant); modelList.Add(model); } return modelList; }
public PagedDataList<PersonalSettingViewModel> PersonalSettingSearch(PersonalSettingSearchViewModel model) { EMVehicleService service = new EMVehicleService(); PositionService positionServ = new PositionService(); try { //int rowCount = 0; //IList<EMVehicle> list = service.Select(model.userCode,model.vehilceLikeStr,true,model.ltGpsTypeID, model.rowIndex,model.pageSize, out rowCount); //IList<Guid> ltVehicleCode_Paging = list.Select(p => p.VehicleCode).ToList(); //IList<EGPSCurrentInfo> ltCurrentInfo = positionServ.GetCurrentInfoList(ltVehicleCode_Paging); //IDictionary<Guid, DateTime> CurrentInfoDic = ltCurrentInfo.ToDictionary(p => p.VehicleCode, p => p.ReportTime); //IList<EMOpenGPSInfo> listEntity = null; /////获取开启GPSCode的返回数据 //if (model.OpenGPSCodeList != null && model.OpenGPSCodeList.Count > 0) //{ // EMOpenGPSInfoService openGPSservice = new EMOpenGPSInfoService(); // listEntity = openGPSservice.GetList(list.Select(p => p.GPSCode).ToList(), 1); //} //if (list != null && list.Count > 0 && rowCount > 0) //{ // List<PersonalSettingViewModel> newList = new List<PersonalSettingViewModel>(); // PagedDataList<PersonalSettingViewModel> pdl = new PagedDataList<PersonalSettingViewModel>(); // foreach (EMVehicle emVehicle in list) // { // PersonalSettingViewModel psvModel = new PersonalSettingViewModel(); // psvModel.GpsCode = emVehicle.GPSCode; // psvModel.GpsTypeID = emVehicle.GPSTypeID; // psvModel.VehicleInfo = emVehicle.LicenceNumber; // psvModel.VehicleCode = emVehicle.VehicleCode; // if (CurrentInfoDic.ContainsKey(emVehicle.VehicleCode)) // { // TimeSpan timeSpan = DateTime.Now.Subtract(CurrentInfoDic[emVehicle.VehicleCode]); // psvModel.IsEnable = !(timeSpan.TotalMinutes > Param_OffLineTime); // } // else // psvModel.IsEnable = false; // if (listEntity != null && listEntity.Count > 0) // { // foreach (EMOpenGPSInfo gpsInfo in listEntity) // { // if (psvModel.GpsCode == gpsInfo.GPSCode) // { // psvModel.OpenResultContent = gpsInfo.Results; // psvModel.LastSetTime = gpsInfo.LastSetTime; // } // } // } // newList.Add(psvModel); // } // pdl.Datas = newList; // pdl.RowCount = rowCount; // return pdl; //代码优化 int rowCount = 0; VehicleDAL vDal = new VehicleDAL(); List<EmPersonalSetting> pelist = service.NewSelect(model.userCode, model.vehilceLikeStr, true, model.ltGpsTypeID, model.rowIndex, model.pageSize, out rowCount, 1); if (pelist != null && pelist.Count > 0 && rowCount > 0) { PagedDataList<PersonalSettingViewModel> pdl = new PagedDataList<PersonalSettingViewModel>(); pdl.Datas = GetPerSettingViewModel(pelist); pdl.RowCount = rowCount; return pdl; } return null; } catch (Exception ex) { Logger.Error(ex.Message); return null; } }
/// <summary> /// 获取客户下车辆分页 /// </summary> /// <param name="param"></param> /// <returns></returns> public AndroidData<RPage<List<RVehicleInfo>>> GetPageVehicleList(PPage<PSearchVehicleData> param) { AndroidData<RPage<List<RVehicleInfo>>> result = new AndroidData<RPage<List<RVehicleInfo>>>() { Message = "此客户暂无车辆数据!", ResultCode = (int)ResultCodeEnum.Fail }; try { int rowCount = 0; EMVehicleService service = new EMVehicleService(); IList<EMVehicle> vehicleList = service.SelectAll(new List<string>() { param.PageSearchEntity.TenantCode }, param.RowIndex, param.PageSize, ref rowCount); if (vehicleList.IsNullOrEmpty()) return result; List<RVehicleInfo> RList = new List<RVehicleInfo>(); foreach (EMVehicle vehicle in vehicleList) { RVehicleInfo info = new RVehicleInfo(); info.VehicleCode = vehicle.VehicleCode; info.LicenceNumber = vehicle.LicenceNumber; RList.Add(info); } RPage<List<RVehicleInfo>> rPageLIstInfo = new RPage<List<RVehicleInfo>>() { PageList = RList, RowCount = rowCount }; result.Message = string.Empty; result.ResultCode = (int)ResultCodeEnum.Success; result.ResultData = rPageLIstInfo; //Logger.Info("[GetPageVehicleList]:" + param.PageSearchEntity.TenantCode); } catch (Exception ex) { result.Message = ex.Message; result.ResultCode = (int)ResultCodeEnum.Fail; Logger.Error("[GetPageVehicleList]:" + ex.Message, ex); } return result; }
/// <summary> /// 客户的车辆列表 /// </summary> /// <param name="param"></param> /// <returns></returns> public AndroidData<List<RVehicleInfo>> GetVehicleList(PSearchVehicleData param) { AndroidData<List<RVehicleInfo>> result = new AndroidData<List<RVehicleInfo>>() { Message = "此客户暂无车辆数据!", ResultCode = (int)ResultCodeEnum.Fail }; try { EMVehicleService service = new EMVehicleService(); IList<EMVehicle> vehicleList = service.SelectAll(param.TenantCode); if (vehicleList.IsNullOrEmpty()) return result; List<RVehicleInfo> RList = new List<RVehicleInfo>(); foreach (EMVehicle vehicle in vehicleList) { RVehicleInfo info = new RVehicleInfo(); info.VehicleCode = vehicle.VehicleCode; info.LicenceNumber = vehicle.LicenceNumber; RList.Add(info); } result.Message = string.Empty; result.ResultCode = (int)ResultCodeEnum.Success; result.ResultData = RList; } catch (Exception ex) { result.Message = ex.Message; result.ResultCode = (int)ResultCodeEnum.Fail; Logger.Error("[GetMobileGuestList]:"+ex.Message,ex); } return result; }
/// <summary> /// 查询平台切换客户的列表 /// </summary> /// <param name="tenantCode"></param> /// <returns></returns> public List<ChangeCusWithOMViewModel> GetChangeCusOfPlat(string tenantCode) { List<ChangeCusWithOMViewModel> list = new List<ChangeCusWithOMViewModel>(); try { IList<EMTenant> ltTenantAll = new EMTenantService().GetGrandChildren(tenantCode); if (ltTenantAll.IsNullOrEmpty()) return list; string lastTenantCode = string.Empty; Dictionary<string, int> dicVehicleCount = null; //客户的车辆总数 IList<EMVehicleGroup> ltVehGroups = null; //终端用户车辆组 var ltAllCus = ltTenantAll.Where(s => s.TenantType == EnumTenantType.EndCustomer && !string.IsNullOrEmpty(s.TenantName)); if (ltAllCus.Count() > 0) { // 处理终端用户车辆总数和分组 List<string> ltCusTenantCode = ltAllCus.Select(o => o.TenantCode).ToList(); // 客户的车辆总数 dicVehicleCount = new EMVehicleService().SelectVehicleCount(ltCusTenantCode); // 终端用户车辆组 //ltVehGroups = new EMVehicleGroupService().SelectListByTenantCodes(ltCusTenantCode); EMTenant lastCreateTenant = ltAllCus.OrderByDescending(s => s.CreateTime).ElementAt(0); lastTenantCode = lastCreateTenant.TenantCode; } //递归处理租户树形数据结构 IList<ChangeCusWithOMViewModel> ltChildren = GetChildren(tenantCode, lastTenantCode, ltTenantAll, dicVehicleCount, ltVehGroups); if (!ltChildren.IsNullOrEmpty()) list.AddRange(ltChildren); } catch (Exception ex) { Logger.Error("OperateManagerWCFService.GetChangeCusOfPlat(string tenantCode) 异常:" + ex.Message, ex); } return list; }
public decimal CalculateTotalMileage(Guid vehicleCode, decimal processMileage) { IEMVehicleService manager = new EMVehicleService(); EMVehicle vehicle = manager.Select(vehicleCode); decimal initMileage = vehicle == null ? 0 : vehicle.InitMileage; return initMileage + processMileage; }
public IList<EMVehicle> GetVehicleList(List<Guid> vCodes) { EMVehicleService emvSrv = new EMVehicleService(); return emvSrv.Select(vCodes); }
public DBProcessResult ModifyVehicle(EMVehicleViewModel view) { DBProcessResult result = new DBProcessResult(); try { IEMVehicleService service = new EMVehicleService(); IEMVehicleLogService logService = new EMVehicleLogService(); IdentityNoService noService = new IdentityNoService(); IEMGpsTypeService gpsTypeService = new EMGpsTypeService(); EMVehicle entity = ConvertHelper.ConvertObj<EMVehicleViewModel, EMVehicle>(view); EMVehicle oldEntity = service.Select(view.VehicleCode); entity.ExpireTime = oldEntity.ExpireTime; entity.InstallTime = oldEntity.InstallTime; entity.CreateTime = oldEntity.CreateTime; entity.IsStop = oldEntity.IsStop; EMGpsType gpsTypeEntity = gpsTypeService.Get(entity.GPSTypeID); entity.GPSTypeName = gpsTypeEntity.TypeName; //如果设备号改变,要重新获取GPSCode,添加和修改日志 if (entity.DeviceNo != oldEntity.DeviceNo) { bool bo = service.IsExist(view.DeviceNo); if (bo != true) { EnumGPSCodeRule codeType = (EnumGPSCodeRule)gpsTypeEntity.GPSCodeRule; entity.GPSCode = GetGPSCodeHelper.GetGPSCode(gpsTypeEntity.PrefixCode, codeType, entity.SIMNo, entity.DeviceNo); if (entity.DeviceNo.Length == gpsTypeEntity.MachineCodeLength) { //修改上一个日志 DateTime now = DateTime.Now; EMVehicleLog lastLog = logService.GetLast(entity.VehicleCode); if (lastLog != null) { lastLog.EndDate = now; logService.Update(lastLog); } //新增一个日志 EMVehicleLog vehicleLog = new EMVehicleLog() { BeginDate = now, LogID = noService.GetVehicleLogID(), DeviceNo = entity.DeviceNo, EndDate = null, GPSCode = entity.GPSCode, GPSTypeID = entity.GPSTypeID, InitMileage = entity.InitMileage, LicenceNumber = entity.LicenceNumber, Operator = view.UserName, SIMNo = entity.SIMNo, TenantCode = entity.TenantCode, GroupID = entity.GroupID, VehicleCode = entity.VehicleCode }; logService.Insert(vehicleLog); entity.InstallTime = DateTime.Now; service.Update(entity); result.IsSuccess = true; } else { result.IsSuccess = false; result.Message = "GPS设备号长度,不在指定范围内,请重新填写!"; } } else { result.IsSuccess = false; result.Message = "GPS设备号已存在,请重新填写!"; } } else { service.Update(entity); result.IsSuccess = true; } } catch (Exception ex) { result.IsSuccess = false; result.Message = ex.Message; } return result; }
public DBProcessResult ChangeDeviceStopState(Guid vehicleCode, bool isStop) { DBProcessResult result = new DBProcessResult(); try { IEMVehicleService service = new EMVehicleService(); EMVehicle model = service.Select(vehicleCode); model.IsStop = isStop; service.Update(model); result.IsSuccess = true; } catch (Exception ex) { result.IsSuccess = false; result.Message = ex.Message; } return result; }
public DBProcessResult ModifyVehicle(VehicleViewModel view) { DBProcessResult result = new DBProcessResult(); try { IEMVehicleService service = new EMVehicleService(); EMVehicle entity = ConvertHelper.ConvertObj<VehicleViewModel, EMVehicle>(view); //同一租户下车牌号码不能重复 EMVehicle old = service.Select(view.VehicleCode); if (old.LicenceNumber != entity.LicenceNumber) { bool licenceNumberIsExist = service.IsExist(entity.TenantCode, entity.LicenceNumber); if (licenceNumberIsExist) { result.IsSuccess = false; result.Message = "已经有相同车牌号的车辆"; return result; } } service.Update(entity); result.IsSuccess = true; } catch (Exception ex) { result.IsSuccess = false; result.Message = ex.Message; } return result; }
public DBProcessResult DeleteCustomer(string tenantCode) { DBProcessResult result = new DBProcessResult() { IsSuccess = false, Message = "删除失败!" }; try { EMTenantService tenantServ = new EMTenantService(); UserService userService = new UserService(); EMVehicleService vehicleServ = new EMVehicleService(); IList<EMVehicle> ltEMVehicle = vehicleServ.SelectAll(tenantCode); if (ltEMVehicle != null && ltEMVehicle.Count > 0) { result.Message = "对不起,客户下还存在车辆,不能删除!"; result.IsSuccess = false; } else { EMTenant emTenant = tenantServ.Select(tenantCode); if (emTenant != null) { //EMUser emUser = userService.GetUser(emTenant.RegisterUserCode); userService.Delete(emTenant.RegisterUserCode);//删除注册账号 tenantServ.Delete(emTenant);//删除运营商信息 result.Message = "删除成功!"; result.IsSuccess = true; } //tenantServ.Delete(tenantCode); //result.Message = "删除成功!"; //result.IsSuccess = true; } } catch (Exception ex) { Logger.Error(ex.Message); } return result; }
/// <summary> /// 获取用户有权限操作的车辆信息 /// </summary> /// <param name="vehicleCode"></param> /// <returns></returns> public IList<EMVehicle> GetVehicleList(string userCode, string tenantCode) { EMVehicleService service = new EMVehicleService(); return service.SelectUserAll(userCode, tenantCode); }
/// <summary> /// 移动车辆到指定车辆组 /// </summary> /// <param name="entity"></param> /// <param name="userName"></param> /// <returns></returns> public DBProcessResult MoveVehicle(Guid vehicleCode, ulong groupID) { DBProcessResult result = new DBProcessResult(); try { IEMVehicleService service = new EMVehicleService(); EMVehicle entity = service.Select(vehicleCode); if (entity == null) { result.IsSuccess = false; result.Message = "移动失败,车辆不存在!"; return result; } entity.GroupID = groupID; service.Update(entity); result.IsSuccess = true; } catch (Exception ex) { result.IsSuccess = false; result.Message = ex.Message; } return result; }
/// <summary> /// 获取车辆信息 /// </summary> /// <param name="vehicleCode"></param> /// <returns></returns> public EMVehicle GetVehicle(Guid vehicleCode) { IEMVehicleService service = new EMVehicleService(); return service.Select(vehicleCode); }
public DBProcessResult DeleteVehicle(Guid code) { DBProcessResult result = new DBProcessResult(); try { IEMVehicleService service = new EMVehicleService(); service.Delete(code); result.IsSuccess = true; } catch (Exception ex) { result.IsSuccess = false; result.Message = ex.Message; } return result; }
public DBProcessResult AddVehicle(EMVehicleViewModel view) { DBProcessResult result = new DBProcessResult(); try { EMVehicleService service = new EMVehicleService(); EHistoryDataStoreConfigService configService = new EHistoryDataStoreConfigService(); EMGpsTypeService gpsTypeService = new EMGpsTypeService(); EMVehicleLogService logService = new EMVehicleLogService(); IdentityNoService noService = new IdentityNoService(); bool licenceNumberIsExist = service.IsExist(view.TenantCode, view.LicenceNumber); if (licenceNumberIsExist) { result.IsSuccess = false; result.Message = "已经有相同车牌号的车辆"; return result; } EMVehicle entity = ConvertHelper.ConvertObj<EMVehicleViewModel, EMVehicle>(view); EMGpsType gpsTypeEntity = gpsTypeService.Get(entity.GPSTypeID); Logger.Info("code line 290: gpsTypeService.Get(entity.GPSTypeID)"); entity.GPSTypeName = gpsTypeEntity.TypeName; bool bo = service.IsExist(view.DeviceNo); if (bo != true) { //新增车辆历史数据配置 string tableName = GetTableNameByCondition(gpsTypeEntity.PrefixCode); EHisotryDataStoreTables table = configService.GetHistoryTable(tableName); Logger.Info("code line 299: configService.GetHistoryTable(tableName)"); if (table == null) { result.IsSuccess = false; result.Message = string.Format("找不到对应的历史数据表[{0}],请联系DBA!", tableName); return result; } //新增车辆 EnumGPSCodeRule codeType = (EnumGPSCodeRule)gpsTypeEntity.GPSCodeRule; entity.GPSCode = GetGPSCodeHelper.GetGPSCode(gpsTypeEntity.PrefixCode, codeType, entity.SIMNo, entity.DeviceNo); if (entity.DeviceNo.Length == gpsTypeEntity.MachineCodeLength) { entity.CreateTime = DateTime.Now; entity.InstallTime = DateTime.Now; GetVehicleGroupID(entity); //客户管理中新增车辆时,没有车辆组,默认增加到顶级车辆组 service.Insert(entity); EHistoryDataStoreConfig configEntity = new EHistoryDataStoreConfig(); configEntity.CreateDate = DateTime.Now; configEntity.Enable = true; configEntity.StoreTable = table; configEntity.VehicleCode = entity.VehicleCode; configService.Insert(configEntity); //新增车辆Log EMVehicleLog vehicleLog = new EMVehicleLog() { BeginDate = DateTime.Now, LogID = noService.GetVehicleLogID(), DeviceNo = entity.DeviceNo, EndDate = null, GPSCode = entity.GPSCode, GPSTypeID = entity.GPSTypeID, InitMileage = entity.InitMileage, LicenceNumber = entity.LicenceNumber, Operator = view.UserName, SIMNo = entity.SIMNo, TenantCode = entity.TenantCode, VehicleCode = entity.VehicleCode, GroupID = entity.GroupID, }; logService.Insert(vehicleLog); view.VehicleCode = entity.VehicleCode; result.IsSuccess = true; } else { result.IsSuccess = false; result.Message = "GPS设备号长度,不在指定范围内,请重新填写!"; } } else { result.IsSuccess = false; result.Message = "设备号已存在,请重新填写!"; } } catch (Exception ex) { result.IsSuccess = false; result.Message = ex.Message; Logger.Info(ex.StackTrace + "【" + ex.Message + "】"); } return result; }
public DBProcessResult TransferVehicle(string vehicleCode, string newTenantCode) { DBProcessResult result = new DBProcessResult(); try { //查询新客户的默认车辆组 EMVehicleGroupService VGSev = new EMVehicleGroupService(); ulong newVehicleGroupID = VGSev.GetTopGroupID(newTenantCode); EMVehicleService VSev = new EMVehicleService(); EMVehicle vehicle = VSev.Select(new Guid(vehicleCode)); //更新车辆的车辆组和Tenantcode vehicle.GroupID = newVehicleGroupID; vehicle.TenantCode = newTenantCode; VSev.Update(vehicle); //将车辆从旧的车辆和用户组关系中删除 EMVehicleInUserGroupService VIUSev = new EMVehicleInUserGroupService(); VIUSev.DeleteByVehicleCode(vehicleCode); //删除车辆报警参数设置 MySqlHelper.TransCommand(getCmdTextList(vehicleCode)); result.IsSuccess = true; result.Message = "转移车辆成功!"; } catch { result.IsSuccess = false; result.Message = "转移车辆失败!"; } return result; }
public List<EMVehicleViewModel> SearchVehicle(string licenceNum) { EMVehicleService service = new EMVehicleService(); List<EMVehicle> list = service.Select(licenceNum, true).ToList(); List<EMVehicleViewModel> viewModelList = ConvertHelper.ConvertList<EMVehicle, EMVehicleViewModel>(list); return viewModelList; }
public List<ChangeCusCarWithOMViewModel> GetChangeCusCarOfPlat(string tenantCode, string iconSkin) { List<ChangeCusCarWithOMViewModel> list = new List<ChangeCusCarWithOMViewModel>(); try { IList<EMTenant> ltTenantAll = new EMTenantService().GetGrandChildren(tenantCode); if (ltTenantAll.IsNullOrEmpty()) return list; var ltAllCus = ltTenantAll.Where(s => s.TenantType == EnumTenantType.EndCustomer && !string.IsNullOrEmpty(s.TenantName)); if (ltAllCus.Count() == 0) return list; List<string> ltCusTenantCode = ltAllCus.Select(o => o.TenantCode).ToList(); EMVehicleService vehicleServ = new EMVehicleService(); //客户和客户的车辆总数 Dictionary<string, int> dicVehicleCount = vehicleServ.SelectVehicleCount(ltCusTenantCode); EMTenant lastCreateTenant = ltAllCus.OrderByDescending(s => s.CreateTime).ElementAt(0); IList<ChangeCusCarWithOMViewModel> ltChildren = GetCarChildren(tenantCode, lastCreateTenant.TenantCode, ltTenantAll, dicVehicleCount); if (!ltChildren.IsNullOrEmpty()) list.AddRange(ltChildren); List<ChangeCusCarWithOMViewModel> vechileList = null; for (int j = 0; j < list.Count; j++) { if (list[j].Children.Count == 0) { string stenantCode = list[j].TenantCode; List<EMVehicle> veList = new VehicleDAL().GetVehicleListByTenantCode(stenantCode); if (veList != null&&veList.Count>0) { vechileList = new List<ChangeCusCarWithOMViewModel>(); for (int a = 0; a < veList.Count; a++) { ChangeCusCarWithOMViewModel ve = new ChangeCusCarWithOMViewModel(); ve.TenantCode = veList[a].VehicleCode.ToString(); ve.TenantName = veList[a].LicenceNumber; ve.iconSkin = "CarDeviceNo"; vechileList.Add(ve); } list[j].iconSkin = iconSkin;// 值为CarDeviceNo表示是车辆的上一级可以选中,为空表示车辆的上一级不可以选中 list[j].Children.AddRange(vechileList); } } else { for (int k = 0; k < list[j].Children.Count; k++) { string stenantCode = list[j].Children[k].TenantCode; vechileList = new List<ChangeCusCarWithOMViewModel>(); List<EMVehicle> veList = new VehicleDAL().GetVehicleListByTenantCode(stenantCode); if (veList != null&&veList.Count>0) { for (int a = 0; a < veList.Count; a++) { ChangeCusCarWithOMViewModel ve = new ChangeCusCarWithOMViewModel(); ve.TenantCode = veList[a].VehicleCode.ToString(); ve.TenantName = veList[a].LicenceNumber; ve.iconSkin = "CarDeviceNo"; vechileList.Add(ve); } list[j].Children[k].iconSkin = iconSkin; list[j].Children[k].Children.AddRange(vechileList); } } } } return list; } catch (Exception ex) { Logger.Error(ex.Message, ex); return list; } }
public DBProcessResult DeleteVehicleGroup(ulong groupID) { DBProcessResult result = new DBProcessResult(); try { EMVehicleGroupService service = new EMVehicleGroupService(); IEMVehicleService vehicleService = new EMVehicleService(); EMVehicleGroup currentGourp = service.Select(groupID); IList<EMVehicleGroup> groupList = service.SelectChild(groupID); List<EMVehicle> vehicleList = vehicleService.SelectVehicleByGroupID(groupID).ToList(); foreach (EMVehicleGroup group in groupList) { IList<EMVehicle> tmpList = vehicleService.SelectVehicleByGroupID(group.GroupID); vehicleList.AddRange(tmpList); } foreach (EMVehicle vehicleEntity in vehicleList) { vehicleEntity.GroupID = currentGourp.ParentGroupID.Value; vehicleService.Update(vehicleEntity); } service.DeleteChild(groupID); service.Delete(groupID); result.IsSuccess = true; } catch (Exception ex) { result.IsSuccess = false; result.Message = ex.Message; } return result; }
public List<VehicleAreaLocusViewModel> GetAreaLocus(string tenantCode, DateTime beginTime, DateTime endTime, double minLon, double minLat, double maxLon, double maxLat, EnumMapType mapType) { IEMVehicleService vehicleServ = new EMVehicleService(); IList<EMVehicle> list = vehicleServ.SelectAll(tenantCode); if (list == null || list.Count == 0) { return null; } Dictionary<string, List<AreaLocusViewModel>> dic = new Dictionary<string, List<AreaLocusViewModel>>(); //IMapService mapService = new PES.GPS.MapService.MapSearchService.MapService(); //IList<LatLon> latlonWeb = new List<LatLon>{ new LatLon(maxLat, maxLon), new LatLon(minLat, minLon) }; //IList<LatLon> latlonReal = mapService.ConvertToRealLatLon(latlonWeb); foreach (var vehicle in list) { List<AreaLocusViewModel> listAreaLocus = GetSectionLocus(vehicle, beginTime, endTime, new LatLon(maxLat, maxLon), new LatLon(minLat, minLon),mapType); if (listAreaLocus.Count > 0) { dic.Add(vehicle.LicenceNumber, listAreaLocus); } } List<VehicleAreaLocusViewModel> listVehicleAreaLocus = dic.Select(o => new VehicleAreaLocusViewModel() { LicenceNumber = o.Key, AreaLocus = o.Value }).ToList(); return listVehicleAreaLocus; }