| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- using System;
- using System.Linq;
- using System.Windows;
- using Comal.Classes;
- using InABox.Clients;
- using InABox.Core;
- using InABox.Wpf;
- namespace PRSDesktop.Shipping
- {
- /// <summary>
- /// Interaction logic for EditShipment.xaml
- /// </summary>
- public partial class EditShipment : ThemableWindow
- {
- private readonly Shipment Shipment;
- public EditShipment(Shipment shipment)
- {
- InitializeComponent();
- Shipment = shipment;
- Code.Text = string.IsNullOrWhiteSpace(Shipment.Code) ? "" : Shipment.Code;
- Description.Text = string.IsNullOrWhiteSpace(Shipment.Description) ? "" : Shipment.Description;
- RackType.Text = string.IsNullOrWhiteSpace(Shipment.Type) ? "" : Shipment.Type;
- var trackers = new Client<GPSTracker>().Load(null, new SortOrder<GPSTracker>(x => x.Description));
- Tracker.ItemsSource = trackers.Select(x => new { x.ID, Name = string.Format("{0} ({1})", x.Description, x.DeviceID) }).ToList();
- Tracker.DisplayMemberPath = "Name";
- Tracker.SelectedValuePath = "ID";
- Tracker.SelectedValue = Shipment.TrackerLink.ID;
- Barcode.Text = Shipment.BarCode;
- }
- private void OKButton_Click(object sender, RoutedEventArgs e)
- {
- Shipment.Code = Code.Text;
- Shipment.Description = Description.Text;
- Shipment.Type = RackType.Text;
- Shipment.TrackerLink.ID = Tracker.SelectedValue != null ? (Guid)Tracker.SelectedValue : Guid.Empty;
- DialogResult = true;
- Close();
- }
- private void CancelButton_Click(object sender, RoutedEventArgs e)
- {
- DialogResult = false;
- Close();
- }
- }
- }
|