public static AttachmentInfo Create(AttachmentInfo model) { if (model.Id == 0) { model.Id = AttachmentManage.Add(model); } else { AttachmentManage.Edit(model); } return(model); }
public static AttachmentInfo Update(AttachmentInfo model) { if (model.Id > 0) { AttachmentManage.Update(model); } else { int id = AttachmentManage.Add(model); model.Id = id; } return(model); }
/// <summary> /// 添加或编辑 /// </summary> /// <param name="model"></param> /// <returns></returns> public static AttachmentInfo Create(AttachmentInfo model) { if (model.Id == 0) { int id = AttachmentManage.Insert(model); model.Id = id; } else { AttachmentManage.Update(model); } return(model); }
private void SaveToDB() { if (allMail.Count <= 0) { return; } try { IContentManage MailContentMng = new ContentManage(); IAttachmentManage MailAttachMng = new AttachmentManage(); int mailId; int mailCount = hmail.MailCount - currMailCount; allMail.ToList().ForEach(s => { mailId = MailMng.CreateMail(HMConvert.ConvertMailEntity.ConvertToDbMailEntity((int)AppMain.currUser.Id, s)); HMConvert.ConvertMailEntity.ConvertToDbContentEntity(mailId, s).ToList().ForEach(v => { MailContentMng.CreateContent(v); }); HMConvert.ConvertMailEntity.ConvertToDbAttachEntity(mailId, s).ToList().ForEach(n => { MailAttachMng.CreateAttactment(n); }); this.Invoke(new MethodInvoker(() => { this.progressBar1.Value--; TestLaber.Text = mailCount.ToString(); mailCount--; })); }); } catch (Exception e) { AppLog.SysLog(e.ToString()); } }
public static IPageOfList <AttachmentInfo> List(SearchSetting setting) { return(AttachmentManage.List(setting)); }
public static AttachmentInfo Get(int id) { return(AttachmentManage.Get(id)); }
public static void UpdateDownloadCount(int id) { AttachmentManage.UpdateDownloadCount(id); }
/// <summary> /// 插入下载日志 /// </summary> /// <param name="model"></param> public static void InsertLog(AttachmentDownloadLogInfo model) { AttachmentManage.InsertLog(model); }
/// <summary> /// 列表 /// </summary> /// <param name="setting"></param> /// <returns></returns> public static IPageOfList <AttachmentDownloadLogInfo> ListLog(int attachId, SearchSetting setting) { return(AttachmentManage.ListLog(attachId, setting)); }
/// <summary> /// 根据GUID获得详细信息 /// </summary> /// <param name="guid"></param> /// <returns></returns> public static AttachmentInfo GetByGUID(string guid) { return(AttachmentManage.GetByGUID(guid)); }
/// <summary> /// 删除 /// </summary> /// <param name="id"></param> /// <returns></returns> public static int Delete(int id) { return(AttachmentManage.Delete(id)); }