public ProductSearchViewModel(UserInformation userInformation) { try { this._userInformation = userInformation; _productSearchBll = new ProductSearchBll(this._userInformation); ProdSearchModel = new ProductSearchModel(); SetdropDownItems(); GetAllCombo(); this.searchCommand = new DelegateCommand(this.Search); this.selectionChangedManufacturedCommand = new DelegateCommand(this.FilterCostCentre); this.selectionChangedFamilyCommand = new DelegateCommand(this.FilterAll); this.closeCommand = new DelegateCommand(this.CloseSubmit); this.showProductInformationCommand = new DelegateCommand(this.ShowProductInformation); this.printCommand = new DelegateCommand(this.PrintProductSearch); this.previewMouseLeftButtonDownCommand = new DelegateCommand(this.ValidateApplicationCombo); ProdSearchModel.TotalRecords = "Part Details"; ProdSearchModel.HeatTreatment = "678WERER@#$%^&$#"; ProductResult = _productSearchBll.GetProductSearchDetails(ProdSearchModel); ProductResult.AddNew(); ProdSearchModel.HeatTreatment = ""; NotifyPropertyChanged("ProductResult"); } catch (Exception ex) { } }
public void Search() { try { Progress.ProcessingText = PDMsg.Search; Progress.Start(); ToolInfoViewModel tfvm = new ToolInfoViewModel(); Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait; if (ProdSearchModel.ToolCode.Length > 0) { try { ProdSearchModel.ToolCode = tfvm.Chk_Tool(ProdSearchModel.ToolCode); } catch (Exception ex) { } } NotifyPropertyChanged("ProdSearchModel"); ProductResult = _productSearchBll.GetProductSearchDetails(ProdSearchModel); if (ProductResult.Count > 0) { ProdSearchModel.PrintEnabled = true; } else { ProdSearchModel.PrintEnabled = false; } ProdSearchModel.TotalRecords = "Part Details (" + ProductResult.Count.ToString() + " Part" + (ProductResult.Count > 1 ? "s" : "") + " Found)"; if (ProductResult.Count == 0) { ProductResult.AddNew(); } Mouse.OverrideCursor = System.Windows.Input.Cursors.Arrow; Progress.End(); } catch (Exception ex) { Mouse.OverrideCursor = System.Windows.Input.Cursors.Arrow; throw ex.LogException(); } }