|
@@ -15,21 +15,13 @@ namespace PRSDesktop
|
|
|
{
|
|
|
public class ShipmentGrid : DynamicDataGrid<Shipment>
|
|
|
{
|
|
|
- private bool bShowAll = true;
|
|
|
-
|
|
|
- private ReportTemplate template;
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
public ShipmentGrid()
|
|
|
{
|
|
|
ActionColumns.Add(new DynamicMapColumn<Shipment>(this, x => x.TrackerLink.Location));
|
|
|
HiddenColumns.Add(x => x.BarCode);
|
|
|
HiddenColumns.Add(x => x.ItemCount);
|
|
|
HiddenColumns.Add(x => x.Delivery.ID);
|
|
|
-
|
|
|
- //ActionColumns.Add(new DynamicImageColumn() { Action = DeliveryDocketClick, Image = (o) => PRSDesktop.Resources.printer.AsBitmapImage() });
|
|
|
- AddButton("Hide Empty", PRSDesktop.Resources.target.AsBitmapImage(Color.White), ToggleVisible);
|
|
|
- //AddButton("", PRSDesktop.Resources.barcode.AsBitmapImage(), PrintBarcodeClick);
|
|
|
}
|
|
|
|
|
|
protected override void DoReconfigure(FluentList<DynamicGridOption> options)
|
|
@@ -38,94 +30,10 @@ namespace PRSDesktop
|
|
|
options.AddRange(DynamicGridOption.RecordCount, DynamicGridOption.SelectColumns, DynamicGridOption.FilterRows);
|
|
|
}
|
|
|
|
|
|
- public Guid CurrentShipmentID { get; set; }
|
|
|
-
|
|
|
- protected override void SelectItems(CoreRow[] rows)
|
|
|
- {
|
|
|
- CurrentShipmentID = rows.Any() ? rows.First().Get<Shipment, Guid>(x => x.ID) : Guid.Empty;
|
|
|
- base.SelectItems(rows);
|
|
|
- }
|
|
|
-
|
|
|
- protected override bool FilterRecord(CoreRow row)
|
|
|
- {
|
|
|
- if (bShowAll)
|
|
|
- return true;
|
|
|
-
|
|
|
- if (row.Get<Shipment, int>(x => x.ItemCount) > 0)
|
|
|
- return true;
|
|
|
-
|
|
|
- if (row.Get<Shipment, Guid>(x => x.ID) == CurrentShipmentID)
|
|
|
- return true;
|
|
|
-
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- private bool ToggleVisible(Button sender, CoreRow[] rows)
|
|
|
- {
|
|
|
- if (bShowAll)
|
|
|
- {
|
|
|
- UpdateButton(sender, PRSDesktop.Resources.target.AsBitmapImage(Color.White), "Show All");
|
|
|
- bShowAll = false;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- UpdateButton(sender, PRSDesktop.Resources.target.AsBitmapImage(Color.White), "Hide Empty");
|
|
|
- bShowAll = true;
|
|
|
- }
|
|
|
-
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
protected override void Reload(Filters<Shipment> criteria, Columns<Shipment> columns, ref SortOrder<Shipment>? sort, Action<CoreTable?, Exception?> action)
|
|
|
{
|
|
|
sort = new SortOrder<Shipment>(x => x.Code);
|
|
|
base.Reload(criteria, columns, ref sort, action);
|
|
|
}
|
|
|
-
|
|
|
- private bool DeliveryDocketClick(CoreRow row)
|
|
|
- {
|
|
|
- var id = row.Get<Shipment, Guid>(x => x.ID);
|
|
|
-
|
|
|
- var model = new ShipmentDataModel(new Filter<Shipment>(x => x.ID).IsEqualTo(id));
|
|
|
-
|
|
|
- var client = new Client<ReportTemplate>();
|
|
|
- template = client.Load(
|
|
|
- new Filter<ReportTemplate>(x => x.Section).IsEqualTo("Rack List").And(x => x.Name).IsEqualTo("Delivery Docket"),
|
|
|
- new SortOrder<ReportTemplate>(x => x.Name)
|
|
|
- ).FirstOrDefault();
|
|
|
-
|
|
|
- if (template == null)
|
|
|
- template = new ReportTemplate { DataModel = model.Name, Section = "Rack List", Name = "Delivery Docket" };
|
|
|
-
|
|
|
- ReportUtils.PreviewReport(template, model, false, Security.IsAllowed<CanDesignReports>());
|
|
|
-
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- //private bool PrintBarcodeClick(Button btn, CoreRow[] rows)
|
|
|
- //{
|
|
|
- // if (rows.Length != 1)
|
|
|
- // {
|
|
|
- // MessageBox.Show("Please select a Rack first!");
|
|
|
- // return false;
|
|
|
- // }
|
|
|
- // CoreRow row = rows.First();
|
|
|
-
|
|
|
- // Guid id = row.Get<Shipment, Guid>(x => x.ID);
|
|
|
-
|
|
|
- // ShipmentDataModel model = new ShipmentDataModel(new Filter<Shipment>(x => x.ID).IsEqualTo(id));
|
|
|
-
|
|
|
- // Client<ReportTemplate> client = new Client<ReportTemplate>();
|
|
|
- // template = client.Load(
|
|
|
- // new Filter<ReportTemplate>(x => x.Section).IsEqualTo("Rack List").And(x => x.Name).IsEqualTo("Bar Code"),
|
|
|
- // new SortOrder<ReportTemplate>(x => x.Name)
|
|
|
- // ).FirstOrDefault();
|
|
|
-
|
|
|
- // if (template == null)
|
|
|
- // template = new ReportTemplate() { Section = "Rack List", Name = "Bar Code" };
|
|
|
- // ReportUtils.PreviewReport(template, model, false, Security.IsAllowed<CanDesignReports>());
|
|
|
-
|
|
|
- // return false;
|
|
|
- //}
|
|
|
}
|
|
|
}
|