/// <summary> /// 删除指定附件id列表的附件信息及其物理文件 /// </summary> /// <param name="aidList">附件id列表</param> /// <returns>删除附件数</returns> public static int DeleteGoodsAttachment(string aidList) { GoodsattachmentinfoCollection goodsAttchmentInfoColl = DTO.GetGoodsAttachmentInfoList(DbProvider.GetInstance().GetGoodsAttachmentListByAidList(aidList)); int goodsId = 0; if (goodsAttchmentInfoColl != null) { foreach (Goodsattachmentinfo goodsattachmentinfo in goodsAttchmentInfoColl) { if (goodsattachmentinfo.Filename.Trim().ToLower().IndexOf("http") < 0) { string attachmentFilePath = Utils.GetMapPath(BaseConfigs.GetForumPath + "upload/" + goodsattachmentinfo.Filename); if (Utils.FileExists(attachmentFilePath)) { File.Delete(attachmentFilePath); } } goodsId = Utils.StrToInt(goodsattachmentinfo.Goodsid, 0); } } return(DbProvider.GetInstance().DeleteGoodsAttachment(aidList)); }
/// <summary> /// 获取指定商品id的所有附件信息 /// </summary> /// <param name="goodsid">商品id</param> /// <returns>附件信息集合</returns> public static GoodsattachmentinfoCollection GetGoodsAttachmentsByGoodsid(int goodsId) { return(DTO.GetGoodsAttachmentInfoList(DbProvider.GetInstance().GetGoodsAttachmentsByGoodsid(goodsId))); }