Пример #1
0
        /// <summary>
        /// 保存聊天信息
        /// </summary>
        /// <param name="receiveMessage">消息集合</param>
        /// <param name="log"></param>
        public void AddChatMessage(ReceiveMessage receiveMessage, Log log)
        {
            var orgNo = "";
            var bgNo  = "";
            var id    = "";//判定消息所属机构

            if (receiveMessage.userId.IndexOf("o") > -1)
            {
                id = receiveMessage.toUserId;
            }
            else
            {
                id = receiveMessage.userId;
            }
            GetStoreNo(id, ref orgNo, ref bgNo);
            log.Write("BU_NO:" + orgNo + ",BG_NO=" + bgNo + "");
            var eva = new CrmEvaMstr();

            eva.Id            = Guid.NewGuid().ToString("N");
            eva.EVA_TYPE      = "服务咨询";
            eva.EVA_OBJ_TYPE  = "咨询";
            eva.EVA_DATE      = DateTime.Now;
            eva.EVA_CONTENT   = receiveMessage.message;
            eva.CREATE_ORG_NO = orgNo;
            eva.CREATE_PSN    = 0;
            eva.CREATE_DATE   = DateTime.Now;
            eva.UPDATE_PSN    = 0;
            eva.UPDATE_DATE   = DateTime.Now;
            eva.EVA_REF_NO    = receiveMessage.userId;
            eva.UDF2          = receiveMessage.userName;
            eva.UDF1          = "未读";//消息是否已读
            eva.DEL_FLAG      = 1;
            eva.EVA_OBJ_NO    = receiveMessage.toUserId;
            eva.EVA_OBJ_NAME  = receiveMessage.toUserName;
            eva.BG_NO         = bgNo;
            eva.BRAND_ID      = receiveMessage.brandId;
            eva.BRAND_NAME    = receiveMessage.brandName;
            eva.CLASS_ID      = receiveMessage.classId;
            eva.CLASS_NAME    = receiveMessage.className;
            eva.CAR_TYPE_ID   = receiveMessage.carTypeId;
            eva.CAR_TYPE_NAME = receiveMessage.carTypeName;
            _crmEvaMstrRepository.Insert(eva);
        }