CustomerGrid.cs 1.9 KB

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