12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- using System;
- using System.Collections.Generic;
- using System.Windows;
- using Comal.Classes;
- using InABox.Core;
- using InABox.DynamicGrid;
- using InABox.Wpf;
- using Syncfusion.UI.Xaml.Spreadsheet.Commands;
- namespace PRSDesktop
- {
- public class HoldingStockTreatmentEditorHost : DefaultDynamicEditorHost<StockHolding>
- {
- public override IFilter? DefineFilter(Type type) => new Filter<Product>(x => x.NonStock).IsEqualTo(true);
- }
- /// <summary>
- /// Interaction logic for StockTreatmentWindow.xaml
- /// </summary>
- public partial class StockTreatmentWindow : ThemableWindow
- {
- private readonly Guid _location = Guid.Empty;
- //public Guid ProductID { get { return (Guid)Treatments.SelectedValue; } }
- //public Guid SupplierID { get { return (Guid)Suppliers.SelectedValue; } }
- //public String SupplierName { get { return ((KeyValuePair<Guid, String>)Suppliers.SelectedItem).Value; } }
- public StockTreatmentWindow(Guid location)
- {
- _location = location;
- InitializeComponent();
- Product.EditorDefinition = DatabaseSchema.Property(typeof(StockHolding), "Product.ID").Editor as CodePopupEditor;
- Product.OtherColumns["Code"] = "Product.Code";
- Product.OtherColumns["Name"] = "Product.Name";
- Product.Host = new HoldingStockTreatmentEditorHost();
- ConfigureEditor(Product);
- Supplier.EditorDefinition = DatabaseSchema.Property(typeof(PurchaseOrder), "SupplierLink.ID").Editor as CodePopupEditor;
- Supplier.OtherColumns["Code"] = "SupplierLink.Code";
- Supplier.OtherColumns["Name"] = "SupplierLink.Name";
- Supplier.Host = new DefaultDynamicEditorHost<PurchaseOrder>();
- //Product.OnDefineFilter += (sender, type) => new Filter<Supplier>(x => x.NonStock).IsEqualTo(true);
- ConfigureEditor(Supplier);
- }
- private void Product_ValueChanged(IDynamicEditorControl sender, Dictionary<string, object> values)
- {
- }
- private void Supplier_ValueChanged(IDynamicEditorControl sender, Dictionary<string, object> values)
- {
- }
- private void ConfigureEditor(BaseDynamicEditorControl editor, BaseEditor definition = null)
- {
- if (definition != null)
- editor.EditorDefinition = definition;
- editor.Configure();
- editor.Loaded = true;
- }
- private void Window_Loaded(object sender, RoutedEventArgs e)
- {
- Items.Location = _location;
- Items.Refresh(true, true);
- //new Client<Product>().Query(
- // new Filter<Product>(x=>x.Group.Code)
- //Dictionary<Guid, String> treatsource = new Dictionary<Guid, string>();
- //foreach (CoreRow row in _treatments.Rows)
- // treatsource[row.Get<ManufacturingTreatment, Guid>(col => col.Product.ID)] = String.Format("{0}", row.Get<ManufacturingTreatment, String>(col => col.Product.Name));
- //Treatments.ItemsSource = treatsource;
- }
- private void OKButton_Click(object sender, RoutedEventArgs e)
- {
- }
- private void CancelButton_Click(object sender, RoutedEventArgs e)
- {
- }
- }
- }
|