Kaynağa Gözat

Cleaned Up Obsoleted Code
Removed "Hide Empty" button in favour of Custom Filters

frogsoftware 1 yıl önce
ebeveyn
işleme
0a1957f52b
1 değiştirilmiş dosya ile 1 ekleme ve 93 silme
  1. 1 93
      prs.desktop/Panels/Shipments/ShipmentGrid.cs

+ 1 - 93
prs.desktop/Panels/Shipments/ShipmentGrid.cs

@@ -15,21 +15,13 @@ namespace PRSDesktop
 {
 {
     public class ShipmentGrid : DynamicDataGrid<Shipment>
     public class ShipmentGrid : DynamicDataGrid<Shipment>
     {
     {
-        private bool bShowAll = true;
-
-        private ReportTemplate template;
-
-
+        
         public ShipmentGrid()
         public ShipmentGrid()
         {
         {
             ActionColumns.Add(new DynamicMapColumn<Shipment>(this, x => x.TrackerLink.Location));
             ActionColumns.Add(new DynamicMapColumn<Shipment>(this, x => x.TrackerLink.Location));
             HiddenColumns.Add(x => x.BarCode);
             HiddenColumns.Add(x => x.BarCode);
             HiddenColumns.Add(x => x.ItemCount);
             HiddenColumns.Add(x => x.ItemCount);
             HiddenColumns.Add(x => x.Delivery.ID);
             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)
         protected override void DoReconfigure(FluentList<DynamicGridOption> options)
@@ -38,94 +30,10 @@ namespace PRSDesktop
             options.AddRange(DynamicGridOption.RecordCount, DynamicGridOption.SelectColumns, DynamicGridOption.FilterRows);
             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)
         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);
             sort = new SortOrder<Shipment>(x => x.Code);
             base.Reload(criteria, columns, ref sort, action);
             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;
-        //}
     }
     }
 }
 }