public CommunicationObject AddNotify(string xml) { try { CommunicationObject notifyInfo = XmlAnalyzer.AnalyseXmlToCommunicationObject<CommunicationObject>(xml); NoticeEntity noticeEntity = new NoticeEntity(); noticeEntity.NoticeId = notifyInfo.Id; noticeEntity.NoticeVersion = notifyInfo.Version; noticeEntity.MessengerId = notifyInfo.MessengerId; noticeEntity.Timestamp = notifyInfo.Timestamp; noticeEntity.TranType = (int)notifyInfo.TransactionType; noticeEntity.Digest = notifyInfo.Digest; noticeEntity.ResponseText = xml; noticeEntity.NotifyTime = DateTime.Now; noticeEntity.XmlHeader = notifyInfo.XmlHeader; NoticeManager noticeManager = new NoticeManager(DbAccess); noticeManager.AddNotice(noticeEntity); return notifyInfo; } catch (Exception ex) { string errMsg = "添加通知XML到数据库失败!" + xml; throw HandleException(LogCategory.Notice, errMsg, ex); } }
public void AddNotice(NoticeEntity entity) { entity.NotifyTime = DateTime.Now; persistence.Add(entity); }