/// <summary> /// 显示商品信息 /// </summary> /// <param name="productInfo">选中的某个商品信息</param> public void ShowProductInfo(ProductInformation productInfo) { ProductInformation clone = (ProductInformation)productInfo.Clone(); ProductInfoWindow wnd = new ProductInfoWindow { Owner = Application.Current.MainWindow, DataContext = clone, RawMaterialsCodeList = ProductInfoes.Select(p => p.RawMaterialsCode).Distinct().ToList(), IsNew = false }; if (wnd.ShowDialog() == true) { ErrType err = _businessService.ModifyProductInfo(_loginID, clone); if (err == GeneralErr.Success) productInfo.Sync(clone); else MessageBox.Show(err.ErrMsg, err.ErrTitle, MessageBoxButton.OK, MessageBoxImage.Warning); } }
public void AddProductInfoExecute() { ProductInformation newProductInfo = new ProductInformation(); ProductInfoWindow wnd = new ProductInfoWindow { Owner = Application.Current.MainWindow, DataContext = newProductInfo, RawMaterialsCodeList = ProductInfoes.Select(p => p.RawMaterialsCode).Distinct().ToList(), IsNew = true }; if (wnd.ShowDialog() == true) { ErrType err = _businessService.AddProductInfo(_loginID, newProductInfo); if (err == GeneralErr.Success) AddProductInfo(newProductInfo); else MessageBox.Show(err.ErrMsg, err.ErrTitle, MessageBoxButton.OK, MessageBoxImage.Warning); } }