Пример #1
0
        public LocationResponse GetUserLocation(Guid WorkerID)
        {
            LocationResponse lresponse = new LocationResponse();
            IUserRepository  _IUserRepository;

            _IUserRepository = new UserRepository(new WorkersInMotionDB());
            UserHeartBeat UserHeartBeatList = _IUserRepository.GetUserLocation(WorkerID);

            if (UserHeartBeatList != null)
            {
                lresponse.Latitude  = Convert.ToDouble(UserHeartBeatList.Latitude);
                lresponse.Longitude = Convert.ToDouble(UserHeartBeatList.Longitude);
                lresponse.Time      = convertdate(Convert.ToDateTime(UserHeartBeatList.HeartBeatTime));// Convert.ToDateTime(item.HeartBeatTime);
                lresponse.UserGUID  = UserHeartBeatList.UserGUID;
            }
            return(lresponse);
        }
Пример #2
0
 public int PostHeartBeat(HeartBeatRequest HeartBeatRequest, Guid UserGUID)
 {
     try
     {
         int             result = 0;
         IUserRepository _IUserRepository;
         _IUserRepository = new UserRepository(new WorkersInMotionDB());
         UserHeartBeat _userHeartBeat = new UserHeartBeat();
         _userHeartBeat.HeartBeatGUID = Guid.NewGuid();
         _userHeartBeat.UserGUID      = UserGUID;
         _userHeartBeat.Latitude      = HeartBeatRequest.latitude;
         _userHeartBeat.Longitude     = HeartBeatRequest.longitude;
         _userHeartBeat.HeartBeatTime = HeartBeatRequest.time;
         _userHeartBeat.CreateDate    = DateTime.UtcNow;
         _userHeartBeat.CreateBy      = UserGUID;
         result = _IUserRepository.InsertUserHeartBeat(_userHeartBeat);
         //result = _IUserRepository.Save();
         return(result);
     }
     catch (Exception ex)
     {
         return(0);
     }
 }