private void CancelExecute(object parameter) { Cargo = null; AddCargoWindow AddCargoWindow = parameter as AddCargoWindow; CallBack(Cargo); AddCargoWindow.Close(); }
private void AddCargoExecute(object parameter) { AddCargoWindow AddCargoWindow = new AddCargoWindow(CMContext); AddCargoWindowViewModel AddCargoWindowvm = AddCargoWindow.DataContext as AddCargoWindowViewModel; AddCargoWindowvm.CallBack = new Func <Cargo, bool>(CallBack); AddCargoWindow.Show(); }
private void ConfirmExecute(object parameter) { bool IsValid = true; string message = "存在非法输入"; string detailMessage = ""; if (string.IsNullOrWhiteSpace(Cargo.CargoName)) { detailMessage += "商品名称不允许为空\n"; IsValid = false; } if (string.IsNullOrWhiteSpace(Cargo.Material)) { detailMessage += "商品材料不允许为空\n"; IsValid = false; } if (string.IsNullOrWhiteSpace(Cargo.Size)) { detailMessage += "商品尺寸不允许为空, 若该商品无尺寸, 则输入:无\n"; IsValid = false; } if (string.IsNullOrWhiteSpace(Cargo.SizeUnit)) { detailMessage += "商品尺寸单位不允许为空, 若该商品无尺寸单位, 则输入:无\n"; IsValid = false; } if (string.IsNullOrWhiteSpace(Cargo.Category)) { detailMessage += "商品类别不允许为空\n"; IsValid = false; } if (string.IsNullOrWhiteSpace(Cargo.StdCategory)) { detailMessage += "商品标准类别不允许为空\n"; IsValid = false; } if (string.IsNullOrWhiteSpace(Cargo.StdName)) { detailMessage += "商品标准名称不允许为空\n"; IsValid = false; } if (IsValid) { AddCargoWindow AddCargoWindow = parameter as AddCargoWindow; Cargo.SetPreciseCargoName(); bool IsExist = CallBack(Cargo); if (IsExist == true) { string message2 = "已存在同名商品"; string detailMessage2 = string.Format("不同商品之间,以下六个项目应至少有一个不重复:商品类别,商品标准类别,商品标准名称,商品尺寸,商品尺寸单位,商品材料"); WarningWindow warn = new WarningWindow(message2, detailMessage2); warn.ShowDialog(); } else { AddCargoWindow.Close(); } } else { WarningWindow warn = new WarningWindow(message, detailMessage); warn.ShowDialog(); } }