public ActionResult Setting(string VehicleCode, string LicenceNumber, string SIMNo, DateTime? ExpireTime, int IconType)
        {
            Guid code = new Guid(VehicleCode);
            EMVehicle vehicle = this._WebManagerWCFService.GetVehicle(code);
            if (vehicle == null)
            {
                return Json(new
                {
                    result = 0,
                    data = "关联车辆不存在!"
                });
            }
            VehicleViewModel model = new VehicleViewModel();
            model.VehicleCode = vehicle.VehicleCode;
            model.LicenceNumber = LicenceNumber;
            model.GroupID = vehicle.GroupID;
            model.GPSTypeID = vehicle.GPSTypeID;
            model.GPSTypeName = vehicle.GPSTypeName;
            model.DeviceNo = vehicle.DeviceNo;
            model.GPSCode = vehicle.GPSCode;
            model.TenantCode = vehicle.TenantCode;
            model.InitMileage = vehicle.InitMileage;
            model.InstallTime = vehicle.InstallTime;
            model.CreateTime = vehicle.CreateTime;
            model.IsStop = vehicle.IsStop;

            model.ExpireTime = ExpireTime;
            model.SIMNo = SIMNo;
            model.IconType = (EnumVehicleType)IconType;

            DBProcessResult dbResult = this._OperationsService.ModifyVehicle(model);
            return Json(new
            {
                result = dbResult.IsSuccess ? 1 : 0,
                data = dbResult.Message
            });
        }
Beispiel #2
0
 /// <summary>
 /// 根据租户编号、车牌名称、模糊车辆返回车辆列表(只包含安装GPS的车辆)FOR YWT
 /// </summary>
 /// <param name="param"></param>
 /// <returns></returns>
 public AndroidData<List<VehicleViewModel>> GetInstallVehicleList(PES.GPS.GPSService.MobileQueryService.ViewModel.Android.Params.PVehicleCondtion param)
 {
     AndroidData<List<VehicleViewModel>> data = new AndroidData<List<VehicleViewModel>>();
     if (!param.CheckTicket())
     {
         data.Message = MessageByInvalidTicket;
         data.ResultCode = ResultCodeEnum.InvalidTicket;
     }
     else
     {
         try
         {
             AndroidInstallation business = new AndroidInstallation();
             IList<PES.Guanaco.Entity.Permission.EVehicle> vehicleList = business.GetInstallVehicleList(param.TenantCode, param.LicenseNumber);
             List<VehicleViewModel> vmList = new List<VehicleViewModel>();
             foreach (PES.Guanaco.Entity.Permission.EVehicle info in vehicleList)
             {
                 VehicleViewModel vm = new VehicleViewModel();
                 vm.LicenceNumber = info.LicenceNumber;
                 vm.VehicleCode = info.Code;
                 vmList.Add(vm);
             }
             data.ResultData = vmList;
             data.ResultCode = ResultCodeEnum.Success;
         }
         catch (Exception ex)
         {
             data.ResultCode = ResultCodeEnum.Fail;
             data.Message = ex.Message;
         }
     }
     return data;
 }
        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;
        }
Beispiel #4
0
 private VehicleViewModel ConvertToVehicleViewModal(PES.GPS.Entity.MobileQuery.EBaseVehicle entity)
 {
     VehicleViewModel model = new VehicleViewModel();
     model.VehicleCode = entity.Code;
     model.LicenceNumber = entity.LicenceNumber;
     return model;
 }