private bool Filter(object obj) { var gr = (GoodsReceive)obj; if (gr.ID == 0) { if (string.IsNullOrEmpty(FilterTextBox)) { return(true); } return(gr.PurchaseOrder.StartsWith(FilterTextBox, StringComparison.OrdinalIgnoreCase) || gr.Material.StartsWith(FilterTextBox, StringComparison.OrdinalIgnoreCase) || gr.MaterialShortText.StartsWith(FilterTextBox, StringComparison.OrdinalIgnoreCase)); } else { int count = OkFilter.Where(chk => chk.IsChecked).Count(ok => ok.Item.BoolOk == gr.Ok); if (string.IsNullOrEmpty(FilterTextBox) && count > 0) { return(true); } else { if (count == 0) { return(false); } return(gr.PurchaseOrder.StartsWith(FilterTextBox, StringComparison.OrdinalIgnoreCase) || gr.Material.StartsWith(FilterTextBox, StringComparison.OrdinalIgnoreCase) || gr.MaterialShortText.StartsWith(FilterTextBox, StringComparison.OrdinalIgnoreCase)); } } }
private void ConsumeItemMessage(GRItemMessage msg) { if (msg == null) { return; } if (msg.HasValue) { ProgressValue = msg.PercentageValue; if (msg.State == "Completed") { #region refresh grid foreach (var obj in grCollection) { var gr = grServices.GetGR(obj.ID); obj.Ok = gr.Ok.GetValueOrDefault(); obj.Quantity = gr.Quantity; obj.QtyReceived = gr.QtyReceived; if (obj.QtyReceived == null) { obj.Ok = false; } else { if (obj.QtyReceived == obj.Quantity) { obj.Ok = true; } else if (obj.QtyReceived < obj.Quantity) { obj.Ok = null; } } obj.Ok2 = obj.Ok; obj.Quantity2 = obj.Quantity; obj.QtyReceived2 = obj.QtyReceived; if (OkFilter.All(x => x.Item.BoolOk != gr.Ok)) { OkFilter.Add(new CheckedListItem <OkCategory> { IsChecked = true, Item = new OkCategory { BoolOk = gr.Ok, TextOk = gr.Ok == null ? " - Partial" : (gr.Ok.ToString() == "False") ? " - NOT OK" : " - OK" } }); } } CollectionViewSource.GetDefaultView(ListBoxOk).Refresh(); #endregion refresh grid StopTimer(); ExecuteTimer(); } } }