123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- using System;
- using System.Windows;
- using Comal.Classes;
- using InABox.Core;
- using InABox.DynamicGrid;
- namespace PRSDesktop
- {
- public class CustomerActivityGrid : DynamicDataGrid<CustomerActivity>, ICustomerGrid
- {
- protected override void DoReconfigure(FluentList<DynamicGridOption> options)
- {
- base.DoReconfigure(options);
- options.AddRange(
- DynamicGridOption.AddRows,
- DynamicGridOption.EditRows,
- DynamicGridOption.SelectColumns,
- DynamicGridOption.DeleteRows
- );
- }
- public Customer Customer { get; set; }
- protected override void Reload(Filters<CustomerActivity> criteria, Columns<CustomerActivity> columns, ref SortOrder<CustomerActivity>? sort, Action<CoreTable?, Exception?> action)
- {
- criteria.Add(new Filter<CustomerActivity>(x => x.Customer).LinkValid(Customer.ID));
- base.Reload(criteria, columns, ref sort, action);
- }
- protected override CustomerActivity CreateItem()
- {
- var result = base.CreateItem();
- result.Customer.ID = Customer.ID;
- result.Customer.Synchronise(Customer);
- return result;
- }
- protected override BaseEditor? GetEditor(object item, DynamicGridColumn column)
- {
- if (column.ColumnName.Equals("Customer.ID"))
- return new NullEditor();
- return base.GetEditor(item, column);
- }
- protected override void DoAdd(bool OpenEditorOnDirectEdit = false)
- {
- if (Customer.ID == Guid.Empty)
- MessageBox.Show("Please select a Customer first!");
- else
- base.DoAdd();
- }
- }
- }
|