コード例 #1
0
ファイル: AndroidWCFService.cs プロジェクト: hhahh2011/CH.Gps
        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="UserName">用户名</param>
        /// <param name="Password">密码</param>
        /// <returns></returns>
        public AndroidData<RUserInfo> Login(PLogin param)
        {
            AndroidData<RUserInfo> data = new AndroidData<RUserInfo>();
            try
            {
                IUserService service = new UserService();
                PES.Guanaco.Entity.Permission.EUser user = service.GetUser(param.UserName, param.Password);

                //原方法
                //if (user != null)
                //{
                //    data.ResultData = CovnertToUserInfo(user);
                //    data.Ticket = EncryptHelper.Encrypt<Ticket>(new Ticket() { UserCode = user.UserCode, UserName = user.UserName, Password = user.PassWord });
                //    data.ResultCode = ResultCodeEnum.Success;
                //}
                //else
                //{
                //    data.ResultCode = ResultCodeEnum.Fail;
                //    data.Message = "用户名或密码错误";
                //}

                data = IsInstallPermission(user);

            }
            catch (Exception ex)
            {
                data.ResultCode = ResultCodeEnum.Fail;
                data.Message = ex.Message;

                Logger.Error("Login" + ex.Message, ex);
            }

            return data;
        }
コード例 #2
0
ファイル: MobileWCFService.cs プロジェクト: hhahh2011/CH.Gps
        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="UserName">用户名</param>
        /// <param name="Password">密码</param>
        /// <returns></returns>
        public AndroidData<RUserInfo> Login(PLogin param)
        {
            AndroidData<RUserInfo> data = new AndroidData<RUserInfo>();
            try
            {
                UserService service = new UserService();
                EMUser user = service.GetUser(param.UserName, param.Password);

                if (user != null)
                {
                    data.ResultData = getReturnUserInfo(user);
                    data.Ticket = EncryptHelper.Encrypt<Ticket>(new Ticket() { UserCode = user.UserCode, UserName = user.UserName, Password = user.PassWord });
                    data.ResultCode = (int)ResultCodeEnum.Success;
                }
                else
                {
                    data.ResultCode = (int)ResultCodeEnum.Fail;
                    data.Message = "用户名或密码错误";
                }

            }
            catch (Exception ex)
            {
                data.ResultCode = (int)ResultCodeEnum.Fail;
                data.Message = ex.Message;
                Logger.Error("[Login]" + ex.Message, ex);
            }
            return data;
        }
コード例 #3
0
 private static Task <DocumentWrapper <T> > PlatformReplaceAsync <T>(string documentId, T document, string partition, WriteOptions writeOptions)
 {
     return(RunJsonTask(() =>
     {
         var future = AndroidData.Replace(documentId, ToJsonElement(document), JsonElementClass, partition, writeOptions.ToAndroidWriteOptions());
         return ToDocumentWrapper <T>(future);
     }));
 }
コード例 #4
0
        private static Task <PaginatedDocuments <T> > PlatformListAsync <T>(string partition, ReadOptions readOptions)
        {
            var future = AndroidData.List(JsonElementClass, partition, readOptions.ToAndroidReadOptions());

            return(Task.Run(() =>
            {
                var paginatedDocuments = (AndroidPaginatedDocuments)future.Get();
                return paginatedDocuments.ToPaginatedDocuments <T>();
            }));
        }
コード例 #5
0
ファイル: MobileWCFService.cs プロジェクト: hhahh2011/CH.Gps
        /// <summary>
        /// 获取租户下终端客户
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public AndroidData<RPage<List<MBTenantViewModel>>> GetPageMobileGuestList(PPage<PMobileGusetData> param)
        {
            AndroidData<RPage<List<MBTenantViewModel>>> result = new AndroidData<RPage<List<MBTenantViewModel>>>() { Message = "没有数据!", ResultCode = (int)ResultCodeEnum.Fail };
            try
            {
                EMTenantService service = new EMTenantService();
                int rowCount = 0;
                int allCount = 0;
                int freezCount = 0;
                IList<EMTenant> ltTenantAll = service.Select("", param.PageSearchEntity.OperateCode, param.RowIndex, param.PageSize, ref rowCount, ref freezCount, ref allCount);

                if(ltTenantAll.IsNullOrEmpty())
                    return result;

                RPage<List<MBTenantViewModel>> rPageListInfo = new RPage<List<MBTenantViewModel>>() {
                    PageList = ConverToMBTenantList(ltTenantAll),
                    RowCount = allCount
                };
                result.Message = string.Empty;
                result.ResultCode = (int)ResultCodeEnum.Success;
                result.ResultData = rPageListInfo;
            }
            catch (Exception ex)
            {
                result.Message = ex.Message;
                result.ResultCode = (int)ResultCodeEnum.Fail;
                Logger.Error("[GetPageMobileGuestList]:"+ex.Message,ex);
            }
            return result;
        }
コード例 #6
0
ファイル: MobileWCFService.cs プロジェクト: hhahh2011/CH.Gps
        /// <summary>
        /// 车辆的相关信息
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public AndroidData<RVehicleInfo> GetVehicleInfo(PSearchVehicleInfo param)
        {
            AndroidData<RVehicleInfo> result = new AndroidData<RVehicleInfo>() { Message = "车辆编号不存在!", ResultCode = (int)ResultCodeEnum.Fail };
            try
            {
                PositioningWCFService service = new PositioningWCFService();
                var res = service.GetVehicleDetailInfo(param.VehicleCode, (EnumMapType)param.MapType);

                if (res != null)
                {
                    if (res.Lng.HasValue && res.Lat.HasValue)
                    {
                        PES.GPS.MapService.Entity.LatLon _marLatLon = null;
                        try
                        {
                            switch ((EnumMapType)param.MapType)
                            {
                                case EnumMapType.GoogleCN:
                                    _marLatLon = gMapSrv.LatLonToMar(new PES.GPS.MapService.Entity.LatLon { Longitude = res.Lng.Value, Latitude = res.Lat.Value });
                                    var googleLocation = gMapSrv.LatLngToAddr(_marLatLon);
                                    res.City = googleLocation.City;
                                    res.Location = googleLocation.Address;
                                    res.RoadName = googleLocation.RoadName;
                                    break;
                                case EnumMapType.BaiduMap:
                                    _marLatLon = bMapSrv.LatLonToMar(new PES.GPS.MapService.Entity.LatLon { Longitude = res.Lng.Value, Latitude = res.Lat.Value });
                                    var baiduLocation = bMapSrv.LatLngToAddr(_marLatLon);
                                    res.City = baiduLocation.City;
                                    res.Location = baiduLocation.Address;
                                    res.RoadName = baiduLocation.RoadName;
                                    break;
                            }
                        }
                        catch (Exception ex)
                        {
                            res.City = string.Empty;
                            res.Location = string.Empty;
                            res.RoadName = string.Empty;
                            Logger.Error("地图服务Http请求解析失败," + ex.Message, ex);
                        }
                        if (_marLatLon != null)
                        {
                            res.Lng = _marLatLon.Longitude;
                            res.Lat = _marLatLon.Latitude;
                        }
                        _marLatLon = null;
                    }

                    RVehicleInfo resultData = new RVehicleInfo()
                    {
                        VehicleCode = res.VehicleCode.ToGuid(),
                        LicenceNumber = res.LicenceNumber,
                        Longitude = res.Lng,
                        Latitude = res.Lat,
                        Location = string.IsNullOrEmpty(res.Location) ? " " : res.Location,
                        City = string.IsNullOrEmpty(res.City) ? " " : res.City,
                        RoadName = string.IsNullOrEmpty(res.RoadName) ? " " : res.RoadName,
                        Acc = res.Acc,
                        Speed = res.Speed,
                        ReportTime = res.ReportTime.HasValue ? res.ReportTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : " "
                    };

                    result.Message = string.Empty;
                    result.ResultCode = (int)ResultCodeEnum.Success;
                    result.ResultData = resultData;
                }
            }
            catch (Exception ex)
            {
                result.Message = ex.Message;
                result.ResultCode = (int)ResultCodeEnum.Fail;
                Logger.Error("[GetMobileGuestList]:" + ex.Message, ex);
            }
            return result;
        }
コード例 #7
0
        private static Task PlatformSetEnabledAsync(bool enabled)
        {
            var future = AndroidData.SetEnabled(enabled);

            return(Task.Run(() => future.Get()));
        }
コード例 #8
0
 private static void PlatformSetTokenExchangeUrl(string tokenExchangeUrl)
 {
     AndroidData.SetTokenExchangeUrl(tokenExchangeUrl);
 }
コード例 #9
0
        public AndroidData<OBDMessage> ClearOBDFaultreportsByVehicleCode(string arg)
        {
            if (string.IsNullOrEmpty(arg))
            {
                return new AndroidData<OBDMessage> { ResultCode = (int)ResultCodeEnum.Fail, Message = "参数为空" };
            }
            AndroidData<OBDMessage> result = new AndroidData<OBDMessage>();
            try
            {
                var param = WebIndentifyCodeHelper.ConvertToObject<OBDClearFaultParam>(arg);
                OBDMessage msg = new OBDMessage();
                msg.msg = ModelFacade.OBD.OBDModel.ClearOBDFaultreportsByVehicleCode(param.vehicleCode).ToString();
                result.ResultData = msg;
                result.ResultCode = (int)ResultCodeEnum.Success;

            }
            catch (Exception ex)
            {
                result.ResultCode = (int)ResultCodeEnum.Fail;
                result.Message = ex.Message;
            }

            return result;
        }
コード例 #10
0
ファイル: AndroidWCFService.cs プロジェクト: hhahh2011/CH.Gps
        /// <summary>
        /// 断油断电
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public AndroidData<object> BreakPowerOil(POrder param)
        {
            AndroidData<object> data = new AndroidData<object>();
            if (!param.CheckTicket())
            {
                data.Message = MessageByInvalidTicket;
                data.ResultCode = ResultCodeEnum.InvalidTicket;
            }
            else
            {
                data = SendCommand(param.VehicleCode.ToString(), 2, param.TenantCode, param.UserCode);
            }

            return data;
        }
コード例 #11
0
ファイル: AndroidWCFService.cs プロジェクト: hhahh2011/CH.Gps
        /// <summary>
        /// 获取总里程
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public AndroidData<RMileage> GetMileageByDay(PMileageByDay param)
        {
            AndroidData<RMileage> data = new AndroidData<RMileage>();

            if (!param.CheckTicket())
            {
                data.Message = MessageByInvalidTicket;
                data.ResultCode = ResultCodeEnum.InvalidTicket;
            }
            else
            {
                try
                {
                    DateTime dtStart = DateTime.Parse(DateTime.Parse(param.Day).ToString("yyyy-MM-dd"));
                    DateTime dtEnd = dtStart.AddDays(1).AddMinutes(-1);

                    decimal total = GetTotalMileage(param.VehicleCode, dtStart, dtEnd);

                    data.ResultCode = ResultCodeEnum.Success;
                    data.ResultData = new RMileage() { TotalMileage = total };
                }
                catch (Exception ex)
                {
                    data.ResultCode = ResultCodeEnum.Fail;
                    data.Message = ex.Message;
                }
            }

            return data;
        }
コード例 #12
0
ファイル: AndroidWCFService.cs プロジェクト: hhahh2011/CH.Gps
        /// <summary>
        /// 获取报警或提醒记录
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public AndroidData<List<RWebSMS>> GetWebMsmInfo(PWebMSM param)
        {
            AndroidData<List<RWebSMS>> data = new AndroidData<List<RWebSMS>>();

            if (!param.CheckTicket())
            {
                data.Message = MessageByInvalidTicket;
                data.ResultCode = ResultCodeEnum.InvalidTicket;
            }
            else
            {
                try
                {
                    IWebSMSService service = new WebSMSService();
                    List<VWebSMSInfo> list = service.GetWebMsmInfo(param.UserCode, param.VehicleCode, param.RowIndex, param.RowSize);
                    List<RWebSMS> listReturn = new List<RWebSMS>();
                    listReturn = list.Select(o => new RWebSMS()
                    {
                        Title = o.Title,
                        Content = o.Content,
                        ReceiveTime = o.ReceiveTime.ToString("yyyy-MM-dd HH:mm:ss"),
                        Sort = (o.Type == 8 || o.Type == 6) ? WebMSMSortEnum.Alert : WebMSMSortEnum.Remind
                    }).ToList<RWebSMS>();

                    data.ResultCode = ResultCodeEnum.Success;
                    data.ResultData = listReturn;
                }
                catch (Exception ex)
                {
                    data.ResultCode = ResultCodeEnum.Fail;
                    data.Message = ex.Message;
                }
            }

            return data;
        }
コード例 #13
0
ファイル: AndroidWCFService.cs プロジェクト: hhahh2011/CH.Gps
        /// <summary>
        /// 获取车辆GPS完整信息
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public AndroidData<RVehicleCurrentInfo> GetVehicleInfo(PVehicleInfo param)
        {
            AndroidData<RVehicleCurrentInfo> data = new AndroidData<RVehicleCurrentInfo>();

            if (!param.CheckTicket())
            {
                data.Message = MessageByInvalidTicket;
                data.ResultCode = ResultCodeEnum.InvalidTicket;
            }
            else
            {
                try
                {
                    CurrentInfoViewModel viewModel = GetCurrentInfo(param.VehicleCode, false);
                    RVehicleCurrentInfo currentInfo = ConvertToVehicleCurrentInfo(viewModel);

                    data.ResultCode = ResultCodeEnum.Success;
                    data.ResultData = currentInfo;
                }
                catch (Exception ex)
                {
                    data.ResultCode = ResultCodeEnum.Fail;
                    data.Message = ex.Message;
                }
            }

            return data;
        }
コード例 #14
0
ファイル: AndroidWCFService.cs プロジェクト: hhahh2011/CH.Gps
        /// <summary>
        /// 获取租户车辆列表
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public AndroidData<List<VehicleViewModel>> GetVehicleList(PVehicleList param)
        {
            AndroidData<List<VehicleViewModel>> data = new AndroidData<List<VehicleViewModel>>();

            if (!param.CheckTicket())
            {
                data.Message = MessageByInvalidTicket;
                data.ResultCode = ResultCodeEnum.InvalidTicket;
            }
            else
            {
                try
                {
                    IVehicleService vehicleServ = new PES.GPS.Service.ServiceImpl.VehicleService();
                    var list = vehicleServ.GetUsingVehilceList(param.TenantCode);
                    List<VehicleViewModel> lsReturn = ConvertToVehicleViewModal(list);

                    data.ResultCode = ResultCodeEnum.Success;
                    data.ResultData = lsReturn;
                }
                catch (Exception ex)
                {
                    Logger.Error("GetVehicleList" + ex.Message, ex);

                    data.ResultCode = ResultCodeEnum.Fail;
                    data.Message = ex.Message;
                }
            }

            return data;
        }
コード例 #15
0
ファイル: MobileWCFService.cs プロジェクト: hhahh2011/CH.Gps
        public AndroidData<GPSHistorySectionViewModel> GetHistoricalTrackList(GetHistoricalTracksParams param)
        {
            if (param.VehicleCode.Equals(Guid.Empty))
                return new AndroidData<GPSHistorySectionViewModel> { ResultCode = (int)ResultCodeEnum.Fail, Message = "车辆编号为空" };

            AndroidData<GPSHistorySectionViewModel> result = new AndroidData<GPSHistorySectionViewModel>() { Message = "此客户暂无车辆数据!", ResultCode = (int)ResultCodeEnum.Fail };

            Guid key = Guid.NewGuid();

            try
            {
                var overTime1 = new TimeSpan(0, param.OverTime, 0);
                TimeSpan? lastStopTime1 = null;

                if (param.LastStopTime != -1)
                {
                    lastStopTime1 = new TimeSpan(0, param.LastStopTime, 0);
                }

                HistoryLocusWCFService _historyLocusWCFService = new HistoryLocusWCFService();
                result.ResultData = _historyLocusWCFService.GetSectionHistoryLocus(param.VehicleCode, param.BeginTime, param.EndTime, overTime1, lastStopTime1, param.RecordNum, (EnumMapType)param.MapType);
                result.Message = string.Empty;
                result.ResultCode = (int)ResultCodeEnum.Success;
            }
            catch (Exception ex)
            {
                result.Message = ex.Message;
                result.ResultCode = (int)ResultCodeEnum.Fail;
                Logger.Error("[GetHistoricalTrackList]:" + ex.StackTrace, ex);
            }
            return result;
        }
コード例 #16
0
ファイル: AndroidWCFService.cs プロジェクト: hhahh2011/CH.Gps
        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;
        }
コード例 #17
0
ファイル: AndroidWCFService.cs プロジェクト: hhahh2011/CH.Gps
        /// <summary>
        /// 发送断油断电或供油供电指令
        /// </summary>
        /// <param name="vehicleCode">车辆编号</param>
        /// <param name="commandType">2:断油断电,100:供油供电</param>
        /// <returns></returns>
        public AndroidData<object> SendCommand(string vehicleCode, int commandType, string tenantCode, string userCode)
        {
            AndroidData<object> data = new AndroidData<object>();

            IBreakOilLastRecordManager db = new BreakOilLastRecordManager();
            IBreakOilHistoryManager db2 = new MobileQueryBreakOilHistoryManager();

            IPositionService gpsTrackManager = new PositionService();

            try
            {
                //如果是断油断电,则判断车辆是否熄火5分钟以上,如果不是则不能发送指令。
                if (commandType == 2)
                {
                    bool accOff = db.IsAccOff(new Guid(vehicleCode));
                    if (!accOff)
                    {
                        data.Message = "车辆需要熄火5分钟以上才能发送断油断电";
                        data.ResultCode = ResultCodeEnum.Fail;
                        return data;
                    }
                }

                EBreakOilLastRecord record = db.Exists(new Guid(vehicleCode));

                EGPSCurrentInfo info = gpsTrackManager.GetCurrentInfoFromDB(new Guid(vehicleCode));
                EBreakOilHistoryRecord history = new EBreakOilHistoryRecord();

                TimeSpan timeSpan = DateTime.Now.Subtract(info.ReportTime);
                if (null == info || timeSpan.TotalMinutes > 10)
                {
                    data.Message = "车辆没有在线";
                    data.ResultCode = ResultCodeEnum.Fail;
                    return data;
                }
                else
                {
                    history.ACC = info.ACCState;
                    history.AntennaState = info.AntennaState;
                    history.Area = info.Area;
                    history.CommandType = commandType;
                    history.GPSCode = info.GPSCode;
                    history.IsBreakOil = commandType == 2 ? true : false;
                    history.LandMark = info.LandMark;
                    history.Latitude = Convert.ToDecimal(info.Latitude);
                    history.Longitude = Convert.ToDecimal(info.Longitude);
                    history.Oil = Convert.ToDecimal(info.OilBearing);
                    history.OilState = info.OilState;
                    history.RecordID = Guid.NewGuid();
                    history.Road = info.Road;
                    history.SerialNumber = Guid.NewGuid();
                    history.SetTime = DateTime.Now;
                    history.Speed = Convert.ToDecimal(info.Speed);
                    history.StarkMileage = Convert.ToDecimal(info.StarkMileage);
                    history.TenantCode = tenantCode;
                    history.UserCode = userCode;
                    history.VehicleCode = new Guid(vehicleCode);
                }
                if (null != record)
                {
                    db2.Add(history);
                    record.BreakOilHistoryRecord = history;
                    db.Update(record);
                }
                else
                {
                    db2.Add(history);
                    record = new EBreakOilLastRecord();
                    record.VehicleCode = new Guid(vehicleCode);
                    record.BreakOilHistoryRecord = history;
                    db.Add(record);
                }
                //发送指令待完善
                db.VehicleControl(vehicleCode, commandType, history.SerialNumber);
                data.ResultCode = ResultCodeEnum.Success;
                return data;
            }
            catch (Exception ex)
            {
                data.Message = ex.Message;
                data.ResultCode = ResultCodeEnum.Fail;
                return data;
            }
        }
コード例 #18
0
 static Data()
 {
     // Set up bridge between Java listener and .NET events/callbacks.
     AndroidData.SetRemoteOperationListener(new AndroidRemoteOperationListener());
 }
コード例 #19
0
ファイル: AndroidWCFService.cs プロジェクト: hhahh2011/CH.Gps
 /// <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;
 }
コード例 #20
0
        private static Task <bool> PlatformIsEnabledAsync()
        {
            var future = AndroidData.IsEnabled();

            return(Task.Run(() => (bool)future.Get()));
        }
コード例 #21
0
ファイル: AndroidWCFService.cs プロジェクト: hhahh2011/CH.Gps
        /// 新增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;
        }
コード例 #22
0
        private static Task <DocumentWrapper <T> > PlatformReadAsync <T>(string documentId, string partition, ReadOptions readOptions)
        {
            var future = AndroidData.Read(documentId, JsonElementClass, partition, readOptions.ToAndroidReadOptions());

            return(RunDocumentWrapperTask <T>(future));
        }
コード例 #23
0
ファイル: AndroidWCFService.cs プロジェクト: hhahh2011/CH.Gps
        /// <summary>
        /// 判断权限,一个用户对应唯一机构,且机构许可具备手机客服权限判断
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        private AndroidData<RUserInfo> IsInstallPermission(EUser user)
        {
            AndroidData<RUserInfo> data = new AndroidData<RUserInfo>();            
            if (user == null)
            {
                data.ResultCode = ResultCodeEnum.Fail;
                data.Message = "用户名或密码错误";
                return data;
            }
            int count = user.TenantList != null ? user.TenantList.Count : 0; 
            if (count == 0 || count>1)
            {
                data.ResultCode = ResultCodeEnum.Fail;
                if (count == 0)
                {
                    data.Message = "请联系客服人员,尚未成为客户";
                }
                else
                {
                    data.Message = "请联系客服人员,确定帐号是否属于唯一机构";
                }
                return data;
            }
            string TenantCode = user.TenantList[0].TenantCode;
            string ProductCode = "BOSS";
            IList<LicenseEntity> lsLicense = GuanacoServiceFacade.Permission.GetLicenseByTenant(TenantCode);
            if (lsLicense == null || lsLicense.Count == 0)
            {
                data.ResultCode = ResultCodeEnum.Fail;
                data.Message = "请联系客服人员,机构尚未许可";
                return data;
            }
                        
            LicenseEntity entity = lsLicense.SingleOrDefault(o => o.RDProductCode == ProductCode);

            if (entity == null)
            {
                data.ResultCode = ResultCodeEnum.Fail;
                data.Message = "请联系客服人员,机构没有分配许可";
                return data;
            }   
      
            if (entity.HasPermissionLimit.HasValue && entity.HasPermissionLimit.Value)
            {
                IList<PermissionEntity> lsPermission = PermissionDALFacade.PermissionDAL.SelectByLicenseTypeId(entity.LicenseTypeID);
                if (lsPermission == null || lsPermission.Count == 0)
                {
                    data.ResultCode = ResultCodeEnum.Fail;
                    data.Message = "请联系客服人员,机构许可没有分配权限";
                    return data;
                }

                bool Flag = lsPermission.Any(p => p.PermissionCode == InstallPermissionCode);

                if (!Flag)
                {
                    data.ResultCode = ResultCodeEnum.Fail;
                    data.Message = "请联系客服人员,机构许可没有分配手机客服权限";
                    return data;
                }                
            }  
          
            data.ResultData = CovnertToUserInfo(user);
            data.Ticket = EncryptHelper.Encrypt<Ticket>(new Ticket() { UserCode = user.UserCode, UserName = user.UserName, Password = user.PassWord });
            data.ResultCode = ResultCodeEnum.Success;
              
            return data;
        }
コード例 #24
0
        private static Task <DocumentWrapper <T> > PlatformDeleteAsync <T>(string documentId, string partition, WriteOptions writeOptions)
        {
            var future = AndroidData.Delete(documentId, partition, writeOptions.ToAndroidWriteOptions());

            return(RunDocumentWrapperTask <T>(future));
        }
コード例 #25
0
ファイル: AndroidWCFService.cs プロジェクト: hhahh2011/CH.Gps
 /// <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;
 }
コード例 #26
0
ファイル: MobileWCFService.cs プロジェクト: hhahh2011/CH.Gps
        /// <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;
        }
コード例 #27
0
ファイル: AndroidWCFService.cs プロジェクト: hhahh2011/CH.Gps
 /// <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;
 }
コード例 #28
0
        public AndroidData<OBDInfoVM> GetOBDInfoByVehicleCode(string arg)
        {
            if (string.IsNullOrEmpty(arg))
            {
                return new AndroidData<OBDInfoVM> { ResultCode = (int)ResultCodeEnum.Fail, Message = "参数为空" };
            }

            AndroidData<OBDInfoVM> result = new AndroidData<OBDInfoVM>();
            try
            {
                var param = WebIndentifyCodeHelper.ConvertToObject<OBDInfoParam>(arg);

                if (param.type == 0)
                {
                    result.ResultData = ModelFacade.OBD.OBDModel.GetTodayOBDInfoByVehicleCode(param.vehicleCode);
                }
                else if (param.type == 1)
                {
                    result.ResultData = ModelFacade.OBD.OBDModel.GetWeekOBDInfoByVehicleCode(param.vehicleCode);
                }
                else
                {
                    result.ResultData = ModelFacade.OBD.OBDModel.GetMonthOBDInfoByVehicleCode(param.vehicleCode);
                }
                result.ResultCode = (int)ResultCodeEnum.Success;
            }
            catch (Exception ex)
            {
                result.ResultCode = (int)ResultCodeEnum.Fail;
                result.Message = ex.Message;
            }

            return result;
        }
コード例 #29
0
        public AndroidData<OBDCurrentDataStreamVM> GetOBDCurrentDataStreamByVehicleCode(string arg)
        {
            if (string.IsNullOrEmpty(arg))
            {
                return new AndroidData<OBDCurrentDataStreamVM> { ResultCode = (int)ResultCodeEnum.Fail, Message = "参数为空" };
            }
            AndroidData<OBDCurrentDataStreamVM> result = new AndroidData<OBDCurrentDataStreamVM>();
            try
            {
                var param = WebIndentifyCodeHelper.ConvertToObject<OBDCurrentDataStreamParam>(arg);
                result.ResultData = ModelFacade.OBD.OBDModel.GetOBDCurrentDataStreamValueByVehicleCode(param.vehicleCode);
                result.ResultCode = (int)ResultCodeEnum.Success;
            }
            catch (Exception ex)
            {
                result.ResultCode = (int)ResultCodeEnum.Fail;
                result.Message = ex.Message;
            }

            return result;
        }
コード例 #30
0
ファイル: MobileWCFService.cs プロジェクト: hhahh2011/CH.Gps
        /// <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;
        }
コード例 #31
0
 public AndroidData<List<EOBDFaultreport>> GeOBDFaultreports(string arg)
 {
     if (string.IsNullOrEmpty(arg))
     {
         return new AndroidData<List<EOBDFaultreport>> { ResultCode = (int)ResultCodeEnum.Fail, Message = "参数为空" };
     }
     AndroidData<List<EOBDFaultreport>> result = new AndroidData<List<EOBDFaultreport>>();
     try
     {
         var param = WebIndentifyCodeHelper.ConvertToObject<OBDFaultParam>(arg);
         result.ResultData = ModelFacade.OBD.OBDModel.GeOBDFaultreports(param.vehicleCodes, param.st, param.et);
         result.ResultCode = (int)ResultCodeEnum.Success;
     }
     catch (Exception ex)
     {
         result.ResultCode = (int)ResultCodeEnum.Fail;
         result.Message = ex.Message;
     }
     return result;
 }
コード例 #32
0
ファイル: MobileWCFService.cs プロジェクト: hhahh2011/CH.Gps
 /// <summary>
 /// 运营商下的客户列表 和 子集运营商
 /// </summary>
 /// <param name="param"></param>
 /// <returns></returns>
 public AndroidData<List<MBTenantViewModel>> GetMobileGuestList(PMobileGusetData param)
 {
     AndroidData<List<MBTenantViewModel>> result = new AndroidData<List<MBTenantViewModel>>() { Message = "此运营商没有数据!", ResultCode = (int)ResultCodeEnum.Fail };
     try
     {
         EMTenantService service = new EMTenantService();
         IList<EMTenant> ltTenantAll = service.GetGrandChildren(param.OperateCode);
         if (ltTenantAll.IsNullOrEmpty())
             return result;
         result.Message = string.Empty;
         result.ResultCode = (int)ResultCodeEnum.Success;
         result.ResultData = GetChildRenTenantInfo(param.OperateCode,ltTenantAll);
     }
     catch (Exception ex)
     {
         result.ResultCode = (int)ResultCodeEnum.Fail;
         result.Message = ex.Message;
         Logger.Error("[GetMobileGuestList]:" + ex.Message, ex);
     }
     return result;
 }
コード例 #33
0
ファイル: AndroidWCFService.cs プロジェクト: hhahh2011/CH.Gps
        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;
        }