예제 #1
0
 public static bool DeleteProductType(int typeId)
 {
     ManagerHelper.CheckPrivilege(Privilege.DeleteProductType);
     bool flag = new ProductTypeDao().DeleteProducType(typeId);
     if (flag)
     {
         EventLogs.WriteOperationLog(Privilege.DeleteProductType, string.Format(CultureInfo.InvariantCulture, "删除了编号为”{0}”的商品类型", new object[] { typeId }));
     }
     return flag;
 }
예제 #2
0
 public static int AddProductType(ProductTypeInfo productType)
 {
     if (productType == null)
     {
         return 0;
     }
     Globals.EntityCoding(productType, true);
     int typeId = new ProductTypeDao().AddProductType(productType);
     if (typeId > 0)
     {
         if (productType.Brands.Count > 0)
         {
             new ProductTypeDao().AddProductTypeBrands(typeId, productType.Brands);
         }
         EventLogs.WriteOperationLog(Privilege.AddProductType, string.Format(CultureInfo.InvariantCulture, "创建了一个新的商品类型:”{0}”", new object[] { productType.TypeName }));
     }
     return typeId;
 }
예제 #3
0
 public static bool UpdateProductType(ProductTypeInfo productType)
 {
     if (productType == null)
     {
         return false;
     }
     Globals.EntityCoding(productType, true);
     bool flag = new ProductTypeDao().UpdateProductType(productType);
     if (flag)
     {
         if (new ProductTypeDao().DeleteProductTypeBrands(productType.TypeId))
         {
             new ProductTypeDao().AddProductTypeBrands(productType.TypeId, productType.Brands);
         }
         EventLogs.WriteOperationLog(Privilege.EditProductType, string.Format(CultureInfo.InvariantCulture, "修改了编号为”{0}”的商品类型", new object[] { productType.TypeId }));
     }
     return flag;
 }
예제 #4
0
 public static int GetTypeId(string typeName)
 {
     int typeId = new ProductTypeDao().GetTypeId(typeName);
     if (typeId > 0)
     {
         return typeId;
     }
     ProductTypeInfo productType = new ProductTypeInfo {
         TypeName = typeName
     };
     return new ProductTypeDao().AddProductType(productType);
 }