public static int GetTypeId(string typeName) { ProductTypeDao productTypeDao = new ProductTypeDao(); int typeId = productTypeDao.GetTypeId(typeName); if (typeId > 0) { return(typeId); } ProductTypeInfo productTypeInfo = new ProductTypeInfo(); productTypeInfo.TypeName = typeName; return((int)productTypeDao.Add(productTypeInfo, null)); }
public static int AddProductType(ProductTypeInfo productType) { if (productType == null) { return(0); } ProductTypeDao productTypeDao = new ProductTypeDao(); Globals.EntityCoding(productType, true); int num = (int)productTypeDao.Add(productType, null); if (num > 0) { if (productType.Brands.Count > 0) { productTypeDao.AddProductTypeBrands(num, productType.Brands); } EventLogs.WriteOperationLog(Privilege.AddProductType, string.Format(CultureInfo.InvariantCulture, "创建了一个新的商品类型:”{0}”", new object[1] { productType.TypeName }), false); } return(num); }