public bool AddIncident(Guid PatrolOrgId, DateTime IncidentDateTime, double Latitude, double Longitude, string MessageContent)
        {
            var tfmService = new TFMIntegration();

            var res = tfmService.AddIncident(PatrolOrgId, IncidentDateTime, Latitude, Longitude, MessageContent);

            return(res);
        }
        public long AddDuty(Guid PatrolOrgId, string MessageContent, DateTime DutyDateTime, double Latitude, double Longitude, long NotificationId, int PatrolId)
        {
            var tfmService = new TFMIntegration();

            var res = tfmService.AddDuty(PatrolOrgId, MessageContent, DutyDateTime, Latitude, Longitude);

            if (res > 0 && NotificationId > 0 && PatrolId > 0)
            {
                try
                {
                    new PatrolsDAL().RecordDispatchLog(PatrolId, NotificationId, DutyDateTime);
                }
                catch (Exception ex)
                {
                }
                //new CrsipServices().PositionsCars();
            }
            return(res);
        }
        public List <PatrolLastLocationDTO> GetPatrolsLocations()
        {
            var result       = new List <PatrolLastLocationDTO>();
            var tfmService   = new TFMIntegration();
            var allLocations = tfmService.GetAllPatrolLocation();

            if (allLocations != null)
            {
                var allStatus = new PatrolStatusDAL().GetPatrolStatusList();
                for (int i = 0; i < allLocations.Count(); i++)
                {
                    var patrolCode  = allLocations[i].Name;
                    var patrolPlate = allLocations[i].Name;
                    var patrolArr   = allLocations[i].Name.Split('/');
                    if (patrolArr.Count() == 2)
                    {
                        patrolCode  = patrolArr[0];
                        patrolPlate = patrolArr[1];
                    }

                    var patrolLastLocation = new PatrolLastLocationDTO
                    {
                        Latitude         = allLocations[i].Latitude,
                        Longitude        = allLocations[i].Longitude,
                        PatrolCode       = patrolCode,
                        Speed            = allLocations[i].Speed,
                        PatrolPlateNo    = patrolPlate,
                        LocationDate     = allLocations[i].LocationDate.AddHours(4),
                        PatrolOriginalId = allLocations[i].PatrolId,
                        isPatrol         = true,
                        StatusId         = allLocations[i].StatusId,
                    };
                    if (allStatus != null && allStatus.Any(x => x.PatrolStatusId == patrolLastLocation.StatusId))
                    {
                        patrolLastLocation.StatusName = allStatus.FirstOrDefault(x => x.PatrolStatusId == patrolLastLocation.StatusId).PatrolStatus;
                    }
                    result.Add(patrolLastLocation);
                }
            }
            return(result);
        }