/// <summary> /// 删除标准物质 /// </summary> /// <param name="materialId"></param> /// <returns></returns> public int DeleteMaterialById(string materialId) { string img_name = GetImgPath(materialId); int ret = new MaterialService().DeleteMaterialById(materialId); if (ret > 0) { new Common().DeleteFile(img_name, fileType.ImageType); } return(ret); }
public int UpdateMaterialById(Material material) { string oldImageName = GetImgPath(material.MaterialId); material.CategoryId = new ProductCategoryManager().GetProductCategoryId(material.CategoryName); int ret = new MaterialService().UpdateMaterialById(material); if (ret > 0) { new Common().DeleteFile(oldImageName, fileType.ImageType); } return(ret); }
public int UpdateMaterial(Material material) { bool deleteFlag = true; string oldImageName = GetImgPath(material.MaterialId); if (material.Img == String.Empty) { material.Img = oldImageName; deleteFlag = false; } material.CategoryId = GetCategoryId(material.CategoryName); int ret = new MaterialService().UpdateMaterial(material); if (ret > 0 && deleteFlag) { new Common().DeleteFile(oldImageName, fileType.ImageType); } return(ret); }