using Central.Control.Domain; using MES.Production.Service.IService; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace MES.Production.Service.ServiceImp { /// /// 消息接口Service实现类 /// Liuzq 2015-11-17 /// public class MsgAttachManage : RepositoryBase, IService.IMsgAttachManage { #region 声明容器 /// /// 上传的附件 /// //IUploadManage UploadManage { get; set; } #endregion /// /// 保存文章附件 /// /// 消息ID /// 附件路径字符串 public bool SaveAttachs(string ID, string str) { try { //根据路径获取附件ID //var upfilelist = this.UploadManage.LoadAll(p => str.Contains(p.UPFILEPATH)).Select(p => p.ID).ToList(); //之前没有数据,新增 //if (upfilelist != null && upfilelist.Count > 0) //{ // foreach (var item in upfilelist.Select(p => new SYS_MSGATTACH() // { // MSGID =int.Parse(ID), // FK_UPLOADID = p, // CREATEDATE = DateTime.Now, // })) // { // this.dbSet.Add(item); // } // this.Context.SaveChanges(); //} } catch (Exception e) { throw e; } return true; } } }