StockTreatmentWindow.xaml.cs 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Windows;
  4. using Comal.Classes;
  5. using InABox.Core;
  6. using InABox.DynamicGrid;
  7. using InABox.Wpf;
  8. using Syncfusion.UI.Xaml.Spreadsheet.Commands;
  9. namespace PRSDesktop
  10. {
  11. public class HoldingStockTreatmentEditorHost : DefaultDynamicEditorHost<StockHolding>
  12. {
  13. public override IFilter? DefineFilter(Type type) => new Filter<Product>(x => x.NonStock).IsEqualTo(true);
  14. }
  15. /// <summary>
  16. /// Interaction logic for StockTreatmentWindow.xaml
  17. /// </summary>
  18. public partial class StockTreatmentWindow : ThemableWindow
  19. {
  20. private readonly Guid _location = Guid.Empty;
  21. //public Guid ProductID { get { return (Guid)Treatments.SelectedValue; } }
  22. //public Guid SupplierID { get { return (Guid)Suppliers.SelectedValue; } }
  23. //public String SupplierName { get { return ((KeyValuePair<Guid, String>)Suppliers.SelectedItem).Value; } }
  24. public StockTreatmentWindow(Guid location)
  25. {
  26. _location = location;
  27. InitializeComponent();
  28. Product.EditorDefinition = DatabaseSchema.Property(typeof(StockHolding), "Product.ID").Editor as CodePopupEditor;
  29. Product.OtherColumns["Code"] = "Product.Code";
  30. Product.OtherColumns["Name"] = "Product.Name";
  31. Product.Host = new HoldingStockTreatmentEditorHost();
  32. ConfigureEditor(Product);
  33. Supplier.EditorDefinition = DatabaseSchema.Property(typeof(PurchaseOrder), "SupplierLink.ID").Editor as CodePopupEditor;
  34. Supplier.OtherColumns["Code"] = "SupplierLink.Code";
  35. Supplier.OtherColumns["Name"] = "SupplierLink.Name";
  36. Supplier.Host = new DefaultDynamicEditorHost<PurchaseOrder>();
  37. //Product.OnDefineFilter += (sender, type) => new Filter<Supplier>(x => x.NonStock).IsEqualTo(true);
  38. ConfigureEditor(Supplier);
  39. }
  40. private void Product_ValueChanged(IDynamicEditorControl sender, Dictionary<string, object> values)
  41. {
  42. }
  43. private void Supplier_ValueChanged(IDynamicEditorControl sender, Dictionary<string, object> values)
  44. {
  45. }
  46. private void ConfigureEditor(BaseDynamicEditorControl editor, BaseEditor definition = null)
  47. {
  48. if (definition != null)
  49. editor.EditorDefinition = definition;
  50. editor.Configure();
  51. editor.Loaded = true;
  52. }
  53. private void Window_Loaded(object sender, RoutedEventArgs e)
  54. {
  55. Items.Location = _location;
  56. Items.Refresh(true, true);
  57. //new Client<Product>().Query(
  58. // new Filter<Product>(x=>x.Group.Code)
  59. //Dictionary<Guid, String> treatsource = new Dictionary<Guid, string>();
  60. //foreach (CoreRow row in _treatments.Rows)
  61. // treatsource[row.Get<ManufacturingTreatment, Guid>(col => col.Product.ID)] = String.Format("{0}", row.Get<ManufacturingTreatment, String>(col => col.Product.Name));
  62. //Treatments.ItemsSource = treatsource;
  63. }
  64. private void OKButton_Click(object sender, RoutedEventArgs e)
  65. {
  66. }
  67. private void CancelButton_Click(object sender, RoutedEventArgs e)
  68. {
  69. }
  70. }
  71. }