示例#1
0
        /// <summary>
        /// 创建新的 MD_Message 对象。
        /// </summary>
        /// <param name="id">ID 属性的初始值。</param>
        public static MD_Message CreateMD_Message(global::System.Guid id)
        {
            MD_Message mD_Message = new MD_Message();

            mD_Message.ID = id;
            return(mD_Message);
        }
示例#2
0
文件: DBOperate.cs 项目: MM1314/QG
        /// <summary>
        /// 更新消息状态,写入发送记录
        /// </summary>
        /// <param name="msg"></param>
        public static void SaveMessageLog(MessageEntity msg, string sendType, string exception)
        {
            using (MSGEntities db = new MSGEntities())
            {
                MD_Message md = db.MD_Message.SingleOrDefault(o => o.ID == msg.ID);
                if (md == null)
                {
                    throw new Exception(string.Format("消息{0}不存在。", msg.ID));
                }
                md.IsSended = md.IsSended.Value || msg.IsSended;

                MD_MessageLog log = db.MD_MessageLog.SingleOrDefault(o => o.MessageID == msg.ID && o.SendType.Equals(sendType));
                if (log == null)
                {
                    log           = new MD_MessageLog();
                    log.ID        = Guid.NewGuid();
                    log.MessageID = msg.ID;
                    log.SendType  = sendType;

                    db.MD_MessageLog.AddObject(log);
                }

                log.IsSuccess = msg.IsSended;
                log.Exception = exception;
                log.SendTime  = DateTime.Now;


                db.SaveChanges();
            }
        }
示例#3
0
 /// <summary>
 /// 用于向 MD_Message EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet&lt;T&gt; 属性的 .Add 方法。
 /// </summary>
 public void AddToMD_Message(MD_Message mD_Message)
 {
     base.AddObject("MD_Message", mD_Message);
 }