예제 #1
0
 /// <summary>
 /// 获取GPS型号列表、厂商名称 FOR YWT
 /// </summary>
 /// <param name="param"></param>
 /// <returns></returns>
 public AndroidData<List<GPSTypeViewModel>> GetGPSTypeList(PES.GPS.GPSService.MobileQueryService.ViewModel.Android.Params.PGPSType param)
 {
     AndroidData<List<GPSTypeViewModel>> data = new AndroidData<List<GPSTypeViewModel>>();
     if (!param.CheckTicket())
     {
         data.Message = MessageByInvalidTicket;
         data.ResultCode = ResultCodeEnum.InvalidTicket;
     }
     else
     {
         try
         {
             AndroidInstallation business = new AndroidInstallation();
             IList<EGPSType> gpsTypeList = business.GetGPSTypeList();
             List<GPSTypeViewModel> vmList = new List<GPSTypeViewModel>();
             foreach (EGPSType info in gpsTypeList)
             {
                 GPSTypeViewModel vm = new GPSTypeViewModel();
                 vm.RecordID = info.RecordID;
                 vm.Name = info.Name;
                 vm.ManufacturerName = info.GPSManufacturer.Name;
                 vm.PrefixCode = info.PrefixCode;
                 vmList.Add(vm);
             }
             data.ResultData = vmList;
             data.ResultCode = ResultCodeEnum.Success;
         }
         catch (Exception ex)
         {
             data.ResultCode = ResultCodeEnum.Fail;
             data.Message = ex.Message;
         }
     }
     return data;
 }
예제 #2
0
        public IActionResult Registration()
        {
            Bmc     BmcModel = NewRepo.FindByKey <Bmc>(_request.organizationCode);
            dynamic data     = new ExpandoObject();

            if (BmcModel != null)
            {
                if (_request.content.mobileNo != null && _request.content.mobileNo.Trim() == BmcModel.contact_no.Trim())
                {
                    _data = new List <ModelParameter>();
                    AndroidInstallationDetails DetailModel;
                    AndroidInstallation        InstalationModel = NewRepo.FindByColumn <AndroidInstallation>(new List <ConditionParameter>
                    {
                        Condition("organization_code", BmcModel.bmc_code),
                        Condition("organization_type", "BMC"),
                    });

                    if (InstalationModel == null)
                    {
                        InstalationModel = new AndroidInstallation
                        {
                            android_installation_id = DbHelper.UniqueKey(),
                            organization_code       = BmcModel.bmc_code,
                            organization_type       = "BMC",
                        };
                        DetailModel = SetDetail(InstalationModel.android_installation_id);
                        _data.Add(new ModelParameter {
                            ValidateModel = null, SaveModel = InstalationModel
                        });
                    }
                    else
                    {
                        DetailModel = NewRepo.FindByColumn <AndroidInstallationDetails>(new List <ConditionParameter>
                        {
                            Condition("android_installation_id", InstalationModel.android_installation_id),
                            Condition("device_id", _request.deviceId),
                            Condition("mobile_no", BmcModel.contact_no.Trim()),
                            Condition("is_active", 1)
                        });
                        if (DetailModel == null)
                        {
                            DetailModel = SetDetail(InstalationModel.android_installation_id);
                        }
                        else
                        {
                            DetailModel.model_operation = "update";
                        }
                    }
                    DetailModel.hash_key   = DbHelper.UniqueKey(20);
                    DetailModel.otp_code   = 1234;
                    DetailModel.is_active  = false;
                    DetailModel.is_expired = false;
                    _data.Add(new ModelParameter {
                        ValidateModel = null, SaveModel = DetailModel
                    });
                    CustomResult result = AUDOperation(_data);
                    if (result._result.message.ToLower() == "success")
                    {
                        data.token = DetailModel.hash_key;
                        return(new CustomResult2(data));
                    }
                    return(new CustomResult2(data, "Data Not Available"));
                }
                else
                {
                    return(new CustomResult2(data, "Data Not Available"));
                }
            }
            else
            {
                return(new CustomResult2(data, "Data Not Available"));
            }
        }
예제 #3
0
 /// <summary>
 /// 根据客户名称模糊查询客户返回客户列表 FOR YWT
 /// </summary>
 /// <param name="param"></param>
 /// <returns></returns>
 /// <summary>
 public AndroidData<List<TenantViewModel>> GetTenantList(PES.GPS.GPSService.MobileQueryService.ViewModel.Android.Params.PTenantCondition param)
 {
     AndroidData<List<TenantViewModel>> data = new AndroidData<List<TenantViewModel>>();
     if (!param.CheckTicket())
     {
         data.Message = MessageByInvalidTicket;
         data.ResultCode = ResultCodeEnum.InvalidTicket;
     }
     else
     {
         try
         {
             AndroidInstallation business = new AndroidInstallation();
             IList<PES.Guanaco.Entity.Tenant.ETenant> tenantList = business.GetTenantList(param.TenantName);
             List<TenantViewModel> vmList = new List<TenantViewModel>();
             foreach (PES.Guanaco.Entity.Tenant.ETenant info in tenantList)
             {
                 TenantViewModel vm = new TenantViewModel();
                 vm.TenantCode = info.TenantCode;
                 vm.TenantName = info.TenantName;
                 vmList.Add(vm);
             }
             data.ResultData = vmList;
             data.ResultCode = ResultCodeEnum.Success;
         }
         catch (Exception ex)
         {
             data.ResultCode = ResultCodeEnum.Fail;
             data.Message = ex.Message;
         }
     }
     return data;
 }
예제 #4
0
        /// 新增GPS安装信息 FOR YWL
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public AndroidData<RResult> SaveGPS(PInstallation param) 
        {
            string GPSGode =string.Empty;
            string StrErr = string.Empty;
            string vehicleCode = string.Empty;
            AndroidData<RResult> data = new AndroidData<RResult>();
            RResult rr = new RResult();

            if (!param.CheckTicket())
            {
                data.Message = MessageByInvalidTicket;
                data.ResultCode = ResultCodeEnum.InvalidTicket;
            }
            else
            {
                try
                {
                    GPSGode = GetGPSCode(param.PrefixCode, param.GPSType.ToString(), param.SIMNumber, param.DeviceNumber);
                    if (string.IsNullOrEmpty(GPSGode))
                    {
                        data.Message = "获取GPS编号失败,不能安装";
                        data.ResultCode = ResultCodeEnum.Fail;
                        return data;
                    }
                    AndroidInstallation install = new AndroidInstallation();
                    if (param.VehicleCode == null)
                    {
                        
                        vehicleCode = install.InstallationAddVehicle(param.TenantCode, param.LicenseNumber, ref StrErr);
                        if(vehicleCode==""&&string.IsNullOrEmpty(vehicleCode))
                        {
                            data.Message = StrErr;
                            data.ResultCode = ResultCodeEnum.Fail;
                            return data;
                        }
                        param.VehicleCode = new Guid(vehicleCode);
                    }
                    EGPSInstallationInfo entity = new EGPSInstallationInfo();
                    DateTime ExportTime = new DateTime(2020, 1, 1, 23, 59, 59);//默认值:启用服务为开,服务到期为2020-1-1 23:59:59
                    entity.CreateDate = DateTime.Now;
                    entity.CreateUser = param.UserCode;
                    entity.GPSCode = GPSGode;
                    entity.DeviceNumber = param.DeviceNumber;
                    entity.SIMNumber = param.SIMNumber;
                    entity.InstallReason = param.InstallReason;
                    entity.EnableService = true;
                    entity.AbolishReason = (int)EnumAbolishReason.None;
                    entity.GPSType = new EGPSType() { RecordID = param.GPSType };
                    entity.TenantInfo = new PES.Guanaco.Entity.Tenant.ETenant() { TenantCode = param.TenantCode };
                    entity.VehicleInfo = new EVehicle() { Code = param.VehicleCode.Value };
                    
                    install.AddInsatllInfo(entity);
                    install.UpdateVehicleExpireTime(param.TenantCode, param.VehicleCode.Value, ExportTime);
                    rr.IsSuccess = true;
                    rr.Message = "恭喜您,安装成功";
                    data.ResultData = rr;
                    data.ResultCode = ResultCodeEnum.Success;
                }
                catch (Exception ex)
                {
                    data.ResultCode = ResultCodeEnum.Fail;
                    data.Message = ex.Message;
                }
            }

            return data;
        }
예제 #5
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;
 }
예제 #6
0
        public AndroidData<PES.GPS.GPSService.MobileQueryService.ViewModel.Android.Return.RResult> AbolishGPS(PES.GPS.GPSService.MobileQueryService.ViewModel.Android.Params.PAbolish param)
        {
            AndroidData<PES.GPS.GPSService.MobileQueryService.ViewModel.Android.Return.RResult> data = new AndroidData<PES.GPS.GPSService.MobileQueryService.ViewModel.Android.Return.RResult>();
            PES.GPS.GPSService.MobileQueryService.ViewModel.Android.Return.RResult info = new PES.GPS.GPSService.MobileQueryService.ViewModel.Android.Return.RResult();
            try
            {
                if (!param.CheckTicket())
                {
                    data.Message = MessageByInvalidTicket;
                    data.ResultCode = ResultCodeEnum.InvalidTicket;
                    return data;
                }
                IAndroidInstallation iAndroidInstallation = new AndroidInstallation();
                string msg = string.Empty;
                info.IsSuccess = iAndroidInstallation.AbolishVehicleInstallationInfo(param.RecordID.ToString(), param.AbolishReason, param.AbolishRemark, param.UserCode,ref msg);
                info.Message = msg;

                data.ResultData = info;
                data.ResultCode = ResultCodeEnum.Success;
            }
            catch (Exception ex)
            {
                data.ResultCode = ResultCodeEnum.Fail;
                data.Message = ex.Message;
                Logger.Error(ex);
            }
            return data;
        }
예제 #7
0
        public AndroidData<PES.GPS.GPSService.MobileQueryService.ViewModel.Android.Return.RAbolish> GetInstallInfo(PVehicleInfo param)
        {
            AndroidData<PES.GPS.GPSService.MobileQueryService.ViewModel.Android.Return.RAbolish> data = new AndroidData<PES.GPS.GPSService.MobileQueryService.ViewModel.Android.Return.RAbolish>();
            PES.GPS.GPSService.MobileQueryService.ViewModel.Android.Return.RAbolish info = new PES.GPS.GPSService.MobileQueryService.ViewModel.Android.Return.RAbolish();
            try
            { 
                if (!param.CheckTicket())
                {
                    data.Message = MessageByInvalidTicket;
                    data.ResultCode = ResultCodeEnum.InvalidTicket;
                    return data;
                }

                IAndroidInstallation iAndroidInstallation = new AndroidInstallation();
                EntityGPSInstallationInfo entity = iAndroidInstallation.GetInstallationInfo(param.VehicleCode.ToString());
                
                info = new PES.GPS.GPSService.MobileQueryService.ViewModel.Android.Return.RAbolish
                {
                    DeviceNumber = entity.DeviceNumber,
                    GPSType = entity.GPSType,
                    InstallReason= entity.InstallReason,
                    LicenseNumber=entity.LicenseNumber,
                    RecordID= entity.RecordID,
                    SIMNumber= entity.SIMNumber
                };
                 
                data.ResultData = info;
                data.ResultCode = ResultCodeEnum.Success;
            }
            catch (Exception ex)
            {
                data.ResultCode = ResultCodeEnum.Fail;
                data.Message = ex.Message;
                Logger.Error(ex);
            }
            return data;
        }