Exemplo n.º 1
0
        /// <summary>
        /// 保存通知信息
        /// </summary>
        /// <param name="db"></param>
        /// <param name="fromUid">发起通知的人</param>
        /// <param name="busId">内容ID</param>
        /// <param name="msgType">通知类型</param>
        /// <param name="contentType">内容类型(1:一级规划;2:二级规划;3:三级规划;4:一级评论;5:二级评论;6:修改的职业规划;7:计划)</param>
        /// <param name="content2">通知内容</param>
        public void SaveMsg(SqlSugarClient db, string fromUid, string busId, int msgType, int busType, string content2 = "")
        {
            try
            {
                DateTime now       = db.GetDate();
                int      timestamp = FunctionHelper.GetTimestamp();

                string fromUser = db.Queryable <SYS_USER_INFO>()
                                  .Where(x => x.USER_ID == fromUid && x.STATE == "A")
                                  .Select(x => x.NICK_NAME)
                                  .First();

                string        msgInfo    = "";
                ISingleBus    sb         = InterfaceArray.DicVD[busType];
                BusinessModel toInfo     = this.GetBusData(db, busId, sb);
                string        toUid      = toInfo.USER_ID;
                string        oldContent = toInfo.CONTENT;
                if (msgType == 1)
                {
                    msgInfo = fromUser + "对你的文章" + oldContent + "进行评论:" + content2;
                }
                if (msgType == 2)
                {
                    msgInfo = fromUser + "对你的评论" + oldContent + "进行回复:" + content2;
                }
                if (msgType == 3)
                {
                    msgInfo = fromUser + "赞了你的文章" + oldContent;
                }
                if (msgType == 4)
                {
                    msgInfo = fromUser + "赞了你的评论" + oldContent;
                }

                SYS_MESSAGE_INFO smi = new SYS_MESSAGE_INFO();
                smi.ID = Guid.NewGuid().ToString();
                smi.DATETIME_CREATED = now;
                smi.STATE            = "A";
                smi.TIMESTAMP_INT    = timestamp;
                smi.FROM_UID         = fromUid;
                smi.TO_UID           = toUid;
                smi.STATUS           = 0;
                smi.TYPE             = msgType;
                smi.CONTENT          = msgInfo;

                db.Insertable(smi).ExecuteCommand();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 功能描述:获取数据库时间
 /// </summary>
 /// <returns>返回值</returns>
 public DateTime GetDBTime()
 {
     return(_db.GetDate());
 }