public void AddNotice(NoticeInfo noticeInfo) { try { NoticeEntity entity = new NoticeEntity(); entity.Id = Guid.NewGuid().ToString("N"); entity.Name = noticeInfo.Name; entity.Title = noticeInfo.Title; entity.IsHasDetail = noticeInfo.IsHasDetail; entity.Message = noticeInfo.Message; entity.IsForeRed = noticeInfo.IsForeRed; entity.IsForeBold = noticeInfo.IsForeBold; entity.StartTime = noticeInfo.StartTime; entity.EndTime = noticeInfo.EndTime; entity.IsEnd = noticeInfo.IsEnd; NoticeManager manager = new NoticeManager(DbAccess); manager.AddNotice(entity); noticeInfo.Id = entity.Id; } catch (Exception ex) { throw HandleException("Notice", "Add", ex); } }
public void ModifyNotice(NoticeInfo noticeInfo) { try { using (ILHDBTran tran = BeginTran()) { NoticeManager manager = new NoticeManager(tran); NoticeEntity entity = manager.GetNotice(noticeInfo.Id); if (entity == null) { throw new ArgumentNullException("通知数据不存在!!"); } entity.Name = noticeInfo.Name; entity.Title = noticeInfo.Title; entity.IsHasDetail = noticeInfo.IsHasDetail; entity.Message = noticeInfo.Message; entity.IsForeRed = noticeInfo.IsForeRed; entity.IsForeBold = noticeInfo.IsForeBold; entity.StartTime = noticeInfo.StartTime; entity.EndTime = noticeInfo.EndTime; entity.IsEnd = noticeInfo.IsEnd; manager.ModifyNotice(entity); tran.Commit(); } } catch (Exception ex) { throw HandleException("Notice", "Modify", ex); } }