public static bool UpdateProductType(ProductTypeInfo productType) { bool result; if (productType == null) { result = false; } else { ProductTypeDao productTypeDao = new ProductTypeDao(); Globals.EntityCoding(productType, true); bool flag = productTypeDao.UpdateProductType(productType); if (flag) { if (productTypeDao.DeleteProductTypeBrands(productType.TypeId)) { productTypeDao.AddProductTypeBrands(productType.TypeId, productType.Brands); } EventLogs.WriteOperationLog(Privilege.EditProductType, string.Format(CultureInfo.InvariantCulture, "修改了编号为”{0}”的商品类型", new object[] { productType.TypeId })); } result = flag; } return(result); }
public static int AddProductType(ProductTypeInfo productType) { int result; if (productType == null) { result = 0; } else { ProductTypeDao productTypeDao = new ProductTypeDao(); Globals.EntityCoding(productType, true); int num = productTypeDao.AddProductType(productType); if (num > 0) { if (productType.Brands.Count > 0) { productTypeDao.AddProductTypeBrands(num, productType.Brands); } EventLogs.WriteOperationLog(Privilege.AddProductType, string.Format(CultureInfo.InvariantCulture, "创建了一个新的商品类型:”{0}”", new object[] { productType.TypeName })); } result = num; } return(result); }