private void GetBrand(int?brandSysNo, string brandName) { BrandQueryFacade serviceFacade = new BrandQueryFacade(CurrentPage); BrandQueryFilter queryFilter = new BrandQueryFilter(); if (!string.IsNullOrEmpty(brandName)) { queryFilter.BrandNameLocal = brandName; } if (brandSysNo.HasValue) { queryFilter.BrandSysNo = brandSysNo; } queryFilter.PagingInfo = new ECCentral.QueryFilter.Common.PagingInfo() { PageSize = 10, PageIndex = 0 }; serviceFacade.QueryBrands(queryFilter, (obj, args) => { if (args.FaultsHandle()) { return; } var vendorList = args.Result.Rows; if (vendorList != null) { List <dynamic> rows = vendorList.ToList(); if (rows.Count > 0) { var row = rows[0]; this.SelectedBrandSysNo = row.SysNo.ToString(); this.SelectedBrandName = row.BrandName_Ch; ManufacturerSysNo = row.ManufacturerSysNo; ManufacturerName = row.ManufacturerName; if (selectedBrandCompletedHandler != null) { EventArgs argse = new EventArgs(); selectedBrandCompletedHandler(obj, args); } } else { txtBrandNameLocal.Text = ""; txtBrandSysNo.Text = ""; this.SelectedBrandSysNo = ""; this.SelectedBrandName = ""; } } else { txtBrandNameLocal.Text = ""; txtBrandSysNo.Text = ""; this.SelectedBrandSysNo = ""; this.SelectedBrandName = ""; } }); }
private void txtBrandNameLocal_LostFocus(object sender, RoutedEventArgs e) { if (txtBrandNameLocal.Text.Trim() == "") { txtBrandNameLocal.Text = ""; txtBrandSysNo.Text = ""; this.SelectedBrandSysNo = null; this.SelectedBrandName = null; return; } queryFilter.BrandNameLocal = this.txtBrandNameLocal.Text.Trim(); queryFilter.PagingInfo = new ECCentral.QueryFilter.Common.PagingInfo() { PageSize = 10, PageIndex = 0 }; serviceFacade.QueryBrands(queryFilter, (obj, args) => { if (args.FaultsHandle()) { return; } var brandList = args.Result.Rows; try { this.txtBrandSysNo.Text = brandList[0]["SysNo"].ToString(); this.txtBrandNameLocal.Text = brandList[0]["BrandName_Ch"].ToString(); this.SelectedBrandSysNo = brandList[0]["SysNo"].ToString(); this.SelectedBrandName = brandList[0]["BrandName_Ch"].ToString(); } catch { SelectedBrandName = null; SelectedBrandSysNo = null; this.txtBrandNameLocal.Text = string.Empty; this.txtBrandSysNo.Text = string.Empty; return; } }); }