|
@@ -13,9 +13,6 @@ namespace PRSDesktop
|
|
|
{
|
|
|
internal class ProductsGrid : DynamicDataGrid<Product>
|
|
|
{
|
|
|
- private bool _includeexpired;
|
|
|
-
|
|
|
- private readonly Button ToggleExpiredButton;
|
|
|
|
|
|
public Guid[]? Groups { get; set; }
|
|
|
|
|
@@ -31,8 +28,7 @@ namespace PRSDesktop
|
|
|
HiddenColumns.Add(x => x.Image.ID);
|
|
|
HiddenColumns.Add(x => x.Image.FileName);
|
|
|
ActionColumns.Add(new DynamicImageManagerColumn<Product>(this, x => x.Image, true) { Position = DynamicActionColumnPosition.Start });
|
|
|
-
|
|
|
- ToggleExpiredButton = AddButton("Show All", null, ToggleExpired);
|
|
|
+
|
|
|
}
|
|
|
protected override void DoReconfigure(DynamicGridOptions options)
|
|
|
{
|
|
@@ -54,79 +50,6 @@ namespace PRSDesktop
|
|
|
return item;
|
|
|
}
|
|
|
|
|
|
- //#region Issues Handling
|
|
|
-
|
|
|
- //private BitmapImage issues = PRSDesktop.Resources.warning.AsBitmapImage();
|
|
|
-
|
|
|
- //private BitmapImage IssuesImage(CoreRow arg)
|
|
|
- //{
|
|
|
- // return (arg == null) ? null : String.IsNullOrWhiteSpace(arg.Get<Product, String>(x => x.Issues)) ? null : issues;
|
|
|
- //}
|
|
|
-
|
|
|
-
|
|
|
- //private bool DoFilterIssues(CoreRow row, string filter)
|
|
|
- //{
|
|
|
- // var noissues = string.IsNullOrWhiteSpace(row?.Get<Product, string>(x => x.Issues));
|
|
|
- // return string.Equals(filter, "Products without Issues") ? noissues : !noissues;
|
|
|
- //}
|
|
|
-
|
|
|
- //private ContextMenu CreateIssuesMenu(CoreRow[] rows)
|
|
|
- //{
|
|
|
- // if (!Security.CanManageIssues<Product>())
|
|
|
- // return null;
|
|
|
-
|
|
|
- // var issues = rows?.Select(r => r.Get<Product, string>(x => x.Issues)).Where(x => !String.IsNullOrWhiteSpace(x)).Any();
|
|
|
- // ContextMenu result = new ContextMenu();
|
|
|
-
|
|
|
- // if (issues != true)
|
|
|
- // {
|
|
|
- // result.Items.Add(CreateMenu("Create Issue", (o, e) => CreateIssue(rows)));
|
|
|
- // }
|
|
|
- // else
|
|
|
- // {
|
|
|
- // result.Items.Add(CreateMenu("Update Issues", (o, e) => UpdateIssues(rows)));
|
|
|
- // result.Items.Add(CreateMenu("Clear Issues", (o, e) => ClearIssues(rows)));
|
|
|
- // }
|
|
|
- // return result;
|
|
|
- //}
|
|
|
-
|
|
|
- //private void ClearIssues(CoreRow[] rows)
|
|
|
- //{
|
|
|
- // if (MessageBox.Show("This will clear the flagged issues for these products!\n\nAre you sure you wish to continue?", "Confirm", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
|
|
|
- // {
|
|
|
- // var _products = rows.Select(x => x.ToObject<Product>()).ToArray();
|
|
|
- // foreach (var product in _products)
|
|
|
- // product.Issues = "";
|
|
|
- // using (new WaitCursor())
|
|
|
- // new Client<Product>().Save(_products, "Clearing Product Issue");
|
|
|
- // Refresh(false, true);
|
|
|
- // }
|
|
|
- //}
|
|
|
-
|
|
|
- //private void UpdateIssues(CoreRow[] rows)
|
|
|
- //{
|
|
|
- // var items = rows.Select(x => x.ToObject<Product>()).ToArray();
|
|
|
- // if (new DynamicIssuesEditor(items).ShowDialog() == true)
|
|
|
- // {
|
|
|
- // Refresh(false, true);
|
|
|
- // }
|
|
|
- //}
|
|
|
-
|
|
|
- //private void CreateIssue(CoreRow[] rows)
|
|
|
- //{
|
|
|
- // if (new DynamicIssuesEditor(rows.Select(x => x.ToObject<Product>()).ToArray()).ShowDialog() == true)
|
|
|
- // Refresh(false, true);
|
|
|
- //}
|
|
|
-
|
|
|
- //#endregion
|
|
|
-
|
|
|
- private bool ToggleExpired(Button sender, CoreRow[] rows)
|
|
|
- {
|
|
|
- _includeexpired = !_includeexpired;
|
|
|
- UpdateButton(ToggleExpiredButton, null, _includeexpired ? "Hide Expired" : "Show All");
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
private readonly Column<Product> DefaultInstanceColumn = new Column<Product>(x => x.DefaultInstance.ID);
|
|
|
|
|
|
private void CustomiseEditor(IDynamicEditorForm sender, Product[]? items, DynamicGridColumn column, BaseEditor editor)
|
|
@@ -277,8 +200,7 @@ namespace PRSDesktop
|
|
|
{
|
|
|
if (Groups != null)
|
|
|
criteria.Add(new Filter<Product>(x => x.Group.ID).InList(Groups));
|
|
|
- if (!_includeexpired)
|
|
|
- criteria.Add(new Filter<Product>(x => x.Expired).IsEqualTo(DateTime.MinValue));
|
|
|
+
|
|
|
sort = new SortOrder<Product>(x => x.Code);
|
|
|
base.Reload(criteria, columns, ref sort, token, action);
|
|
|
}
|