|
@@ -17,6 +17,7 @@ using System.Windows;
|
|
|
using Com.FirmLib.Bll;
|
|
|
using Com.FirmLib.Entity;
|
|
|
using Com.FirmLib.UI.BllCommon;
|
|
|
+using Com.FirmLib.UI.Common;
|
|
|
using Com.FirmLib.UI.Manufacturer.Model;
|
|
|
using FWindSoft.Data;
|
|
|
using FWindSoft.DataFramework;
|
|
@@ -209,13 +210,15 @@ namespace Com.FirmLib.UI.Manufacturer
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
- if (CreateProductTypes())
|
|
|
+
|
|
|
+ var result = CreateProductTypes();
|
|
|
+ if (result)
|
|
|
{
|
|
|
MessageTip.Show(this.GetWindow(), "保存成功");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- MessageTip.Show(this.GetWindow(), "保存失败");
|
|
|
+ MessageTip.Show(this.GetWindow(), $"保存失败,【{result}】");
|
|
|
}
|
|
|
}
|
|
|
catch (Exception e)
|
|
@@ -327,25 +330,34 @@ namespace Com.FirmLib.UI.Manufacturer
|
|
|
/// 保存类型信息,存在则修改,不存在则添加
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
- private bool CreateProductTypes()
|
|
|
+ private TResult CreateProductTypes()
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
+ List<bool> results = new List<bool>();
|
|
|
+ TResult result = null;
|
|
|
foreach (var item in TypeItems)
|
|
|
{
|
|
|
+ bool flag = false;
|
|
|
ProductTypeItem dataItem = ConvertDataItem(item);
|
|
|
if (string.IsNullOrEmpty(item.ProductTypeId))
|
|
|
{
|
|
|
//添加
|
|
|
dataItem.ProductId = Product.Value.ToString();
|
|
|
- BllFactory<ProductTypeBll>.Instance.Add(dataItem);
|
|
|
+ flag=BllFactory<ProductTypeBll>.Instance.Add(dataItem);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
//修改
|
|
|
- BllFactory<ProductTypeBll>.Instance.Update(dataItem);
|
|
|
+ flag = BllFactory<ProductTypeBll>.Instance.Update(dataItem);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!flag)
|
|
|
+ {
|
|
|
+ result = new TResult(flag, BllFactory<ProductTypeBll>.Instance.ErrorMessage);
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
- return true;
|
|
|
+ return result??true;
|
|
|
}
|
|
|
|
|
|
private ProductTypeItem ConvertDataItem(TypeShowItem showItem)
|