CustomerGrid.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. using Comal.Classes;
  2. using InABox.Core;
  3. using InABox.DynamicGrid;
  4. namespace PRSDesktop
  5. {
  6. internal class CustomerGrid : DynamicDataGrid<Customer>
  7. {
  8. public CustomerGrid()
  9. {
  10. ActionColumns.Add(new DynamicScheduleEditorColumn<Customer>());
  11. HiddenColumns.Add(x => x.ActiveSchedules);
  12. ;
  13. ActionColumns.Add(new DynamicMapColumn<Customer>(this, x => x.Delivery.Location));
  14. // HiddenColumns.Add(x => x.Delivery.Location.Timestamp);
  15. //HiddenColumns.Add(x => x.Delivery.Location.Latitude);
  16. //HiddenColumns.Add(x => x.Delivery.Location.Longitude);
  17. }
  18. protected override void DoReconfigure(FluentList<DynamicGridOption> options)
  19. {
  20. base.DoReconfigure(options);
  21. options.BeginUpdate();
  22. options.AddRange(
  23. DynamicGridOption.SelectColumns,
  24. DynamicGridOption.MultiSelect,
  25. DynamicGridOption.FilterRows,
  26. DynamicGridOption.ExportData,
  27. DynamicGridOption.AddRows,
  28. DynamicGridOption.EditRows,
  29. DynamicGridOption.DeleteRows
  30. );
  31. options.EndUpdate();
  32. }
  33. public Customer[] Customers { get; private set; }
  34. //private bool HasLocation(int row)
  35. //{
  36. // if (row.Equals(-1))
  37. // return true;
  38. // DateTime dt = Data.Rows[row].Get<Customer, DateTime>(x => x.Delivery.Location.Timestamp);
  39. // return !dt.IsEmpty();
  40. //}
  41. //private BitmapImage MapImage(int row)
  42. //{
  43. // return HasLocation(row) ? PRSDesktop.Resources.milestone.AsBitmapImage() : null;
  44. //}
  45. //private bool MapClick(DataRow row)
  46. //{
  47. // int index = Data.Rows.IndexOf(row);
  48. // if (HasLocation(index))
  49. // {
  50. // MapForm form = new MapForm(row.Get<Customer, double>(x => x.Delivery.Location.Latitude), row.Get<Customer, double>(x => x.Delivery.Location.Longitude));
  51. // form.ShowDialog();
  52. // }
  53. // return false;
  54. //}
  55. }
  56. }