public ICollection <WebFleetMessage> GetRecentTextMessages(int hours, int minutes, string objectNo = "")
        {
            var result = new List <WebFleetMessage>();

            var webService        = new messagesClient();
            var showMessagesParam = new ShowMessagesParameter()
            {
                messageCategory          = MessageCategory.TEXT,
                messageCategorySpecified = true,
                dateRange = new DateRange()
                {
                    rangePattern = DateRangePattern.UD, rangePatternSpecified = true, from = DateTime.UtcNow.AddHours(-hours).AddMinutes(-minutes), fromSpecified = true, to = DateTime.UtcNow, toSpecified = true
                },
                @object = new ObjectIdentityParameter()
                {
                    objectNo = objectNo
                }
            };
            var response = webService.showMessages(GetAuthenticationParameters(), GetGeneralParameters(), showMessagesParam);

            if (HandleResult(response))
            {
                result.AddRange(response.results.Select(msg => _mappingService.Map(msg as MessageTO)));
            }

            return(result);
        }
Пример #2
0
        public ICollection <WebFleetStandStill> GetStandStills(SelectionTimeSpan dateRange, string objectNumber = "")
        {
            var result     = new List <WebFleetStandStill>();
            var webService = new tripAndTimeReportingClient();

            var standStillParams = new StandStillReportParam();

            if (objectNumber.Length > 0)
            {
                standStillParams.@object = new ObjectIdentityParameter()
                {
                    objectNo = objectNumber
                };
            }

            if (dateRange != SelectionTimeSpan.Unspecified)
            {
                standStillParams.dateRange = new DateRange()
                {
                    rangePattern          = ReportingServiceHelper.GetDateRangePattern(dateRange),
                    rangePatternSpecified = true
                };
            }


            var response = webService.showStandStillReport(GetAuthenticationParameters(), GetGeneralParameters(), standStillParams);

            if (HandleResult(response))
            {
                result.AddRange(from StandStillList obj in response.results select _mappingService.Map(obj));
            }

            return(result);
        }
        public WebFleetPosition GeocodeAddress(string city, string zip, string street, string streetNumber)
        {
            var webService = new addressClient();
            var result     = new List <WebFleetPosition>();

            var response = webService.geocodeAddress(GetAuthenticationParameters(), GetGeneralParameters(),
                                                     new GeocodingByProviderParameter()
            {
                city         = city,
                countryCode  = "US",
                postcode     = zip,
                provider     = "0",                             // 1 for new TomTom geocoding service, 0 for legacy
                street       = street,
                streetNumber = streetNumber
            });

            if (HandleResult(response))
            {
                result.AddRange(from CompleteLocationWithAdditionalInformation loc in response.results select _mappingService.Map(loc));
            }
            return(result.Count > 0 ? result[0] : null);
        }
        public ICollection <WebFleetObject> GetObjects()
        {
            var result     = new List <WebFleetObject>();
            var webService = new objectsAndPeopleReportingClient();
            var response   = webService.showObjectReport(GetAuthenticationParameters(), GetGeneralParameters(),
                                                         new ObjectFilterParameter()
            {
                filterCriterion = "",
                objectGroupName = "",
                @object         = new ObjectIdentityParameter()
                {
                    objectNo = "", objectUid = ""
                },
                ungroupedOnly          = false,
                ungroupedOnlySpecified = false
            });

            if (HandleResult(response))
            {
                result.AddRange(from ObjectReport obj in response.results select _mappingService.Map(obj));
            }

            return(result);
        }
        public WebFleetOrder GetOrder(string orderNumber)
        {
            var result           = new List <WebFleetOrder>();
            var webService       = new WebFleet.OrdersService.ordersClient();
            var ordersParameters = new OrderReportParameters()
            {
                orderNo = orderNumber
            };
            var response = webService.showOrderReport(GetAuthenticationParameters(), GetGeneralParameters(),
                                                      ordersParameters);

            if (HandleResult(response))
            {
                result.AddRange(from ReportedOrderData order in response.results select _mappingService.Map(order));
            }

            return(result.Count > 0 ? result.FirstOrDefault() : null);
        }