public DispatchNoteSummaries() { var summary = new DispatchNoteSummary { DispatchNoteId = 1, Haulier = "BlueWhale", LastActivity = "23-May-2013 @ 14:31 - Tracking Event", Status = StatusEnum.InTransit, TrackingInfo = "Distance: 233 kms ETA in: 2 hrs 33 mins", Truck = "131D0982" }; summary.SetImage(summary.StatusImageName(), DispatchNoteSummary.ImageEnum.Main); _allSummaries.Add(summary); summary = new DispatchNoteSummary { DispatchNoteId = 2, Haulier = "BlueWhale", LastActivity = "25-May-2013 @ 14:31 - Dispatch was created", Status = StatusEnum.New, TrackingInfo = "Has not started trip", Truck = "11D9827" }; summary.SetImage(summary.StatusImageName(), DispatchNoteSummary.ImageEnum.Main); _allSummaries.Add(summary); }
public static DispatchNoteSummary Create(DispatchNoteDto dto) { var instance = new DispatchNoteSummary(); instance.DispatchNoteId = dto.Id; instance.Haulier = dto.Haulier; instance.Truck = dto.TruckReg; instance.Status = dto.DispatchStatus.Equals("New") ? StatusEnum.New : StatusEnum.InTransit; instance.LastActivity = dto.LastUpdate.ToString("dd-MMM-yyyy @ hh:mm"); instance.Latitude = dto.Latitude; instance.Longitude = dto.Longitude; if (instance.Status == StatusEnum.InTransit) { instance.LastActivity += " - Tracking Event"; instance.TrackingInfo = dto.LastTrackingNotification; } else { instance.LastActivity += " - Dispatch was created"; instance.TrackingInfo = "Has not started trip yet"; } instance.SetImage(instance.StatusImageName(), ImageEnum.Main); instance.DispatchLineSummaries = new ObservableCollection <DispatchLineSummary>(); foreach (var dispatchLineDto in dto.DispatchLineSet) { var line = new DispatchLineSummary(); line.DispatchNoteId = instance.DispatchNoteId; line.Line = 0; line.Product = dispatchLineDto.Product; line.ProductType = dispatchLineDto.ProductType; line.SetImage(line.GetImagePath()); line.QuantityDescription = string.Format("{0} {1}{2}", dispatchLineDto.Quantity, dispatchLineDto.Metric, dispatchLineDto.Quantity > 1 ? "s" : string.Empty); line.ClientDescription = string.Format("{0} (Shop: {1}{2})", dispatchLineDto.Client, dispatchLineDto.ShopId, dispatchLineDto.ShopLetter); instance.DispatchLineSummaries.Add(line); } return(instance); }
public void RefreshMap(DispatchNoteSummary selectedItem) { var location = new Location(selectedItem.Latitude, selectedItem.Longitude); if (location.Latitude == 0 && location.Longitude == 0) return; SetRoute(location, new Location(52.516071, 13.37698)); var image = new Image { Source = new BitmapImage(new Uri(_baseUri, "/images/truck_map.png")), Width = 40, Height = 40 }; MapLayer.SetPosition(image, location); _mapTrucks.SetView(location); _mapTrucks.Children.Add(image); }
public static DispatchNoteSummary Create(DispatchNoteDto dto) { var instance = new DispatchNoteSummary(); instance.DispatchNoteId = dto.Id; instance.Haulier = dto.Haulier; instance.Truck = dto.TruckReg; instance.Status = dto.DispatchStatus.Equals("New") ? StatusEnum.New : StatusEnum.InTransit; instance.LastActivity = dto.LastUpdate.ToString("dd-MMM-yyyy @ hh:mm"); instance.Latitude = dto.Latitude; instance.Longitude = dto.Longitude; if (instance.Status == StatusEnum.InTransit) { instance.LastActivity += " - Tracking Event"; instance.TrackingInfo = dto.LastTrackingNotification; } else { instance.LastActivity += " - Dispatch was created"; instance.TrackingInfo = "Has not started trip yet"; } instance.SetImage(instance.StatusImageName(), ImageEnum.Main); instance.DispatchLineSummaries = new ObservableCollection<DispatchLineSummary>(); foreach (var dispatchLineDto in dto.DispatchLineSet) { var line = new DispatchLineSummary(); line.DispatchNoteId = instance.DispatchNoteId; line.Line = 0; line.Product = dispatchLineDto.Product; line.ProductType = dispatchLineDto.ProductType; line.SetImage(line.GetImagePath()); line.QuantityDescription = string.Format("{0} {1}{2}", dispatchLineDto.Quantity, dispatchLineDto.Metric, dispatchLineDto.Quantity > 1 ? "s" : string.Empty); line.ClientDescription = string.Format("{0} (Shop: {1}{2})", dispatchLineDto.Client, dispatchLineDto.ShopId, dispatchLineDto.ShopLetter); instance.DispatchLineSummaries.Add(line); } return instance; }