Exemplo n.º 1
0
 /// <summary>
 /// 添加聊天记录
 /// </summary>
 /// <param name="model">聊天实体</param>
 /// <returns></returns>
 public DataSet Friend_AddGroupsChat(Friends_GroupChat model)
 {
     try
     {
         List <IDataParameter> LstParam = new List <IDataParameter>();
         LstParam.Add(Common.OADBHelperSQL.CreateParameter("@Id", SqlDbType.UniqueIdentifier, model.Id));
         LstParam.Add(Common.OADBHelperSQL.CreateParameter("@GroupId", SqlDbType.UniqueIdentifier, model.GroupId));
         LstParam.Add(Common.OADBHelperSQL.CreateParameter("@SenderId", SqlDbType.UniqueIdentifier, model.SenderId));
         LstParam.Add(Common.OADBHelperSQL.CreateParameter("@ReceiverId", SqlDbType.UniqueIdentifier, model.ReceiverId));
         LstParam.Add(Common.OADBHelperSQL.CreateParameter("@SendContent", SqlDbType.VarChar, model.SendContent));
         LstParam.Add(Common.OADBHelperSQL.CreateParameter("@SendType", SqlDbType.VarChar, model.SendType));
         return(Common.OADBHelperSQL.RunProcedure("pFriend_AddGroupsChat", LstParam.ToArray(), "Data"));
     }
     catch (Exception ex)
     {
         return(Common.OADBHelperSQL.CustomDataSet(false));
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// 发送群消息
        /// </summary>
        /// <param name="ToId">接收人ID</param>
        /// <param name="message">信息</param>
        public void sendGroupMessage(string strmodel)
        {
            UserInfo = GetSignalrUserInfo();
            Friends_GroupChat model = JsonConvert.DeserializeObject <Friends_GroupChat>(strmodel);

            model.Id       = Guid.NewGuid();
            model.SenderId = UserInfo.Id;
            ReturnModel remodel = JsonConvert.DeserializeObject <ReturnModel>(oGroupsBLL.Friend_AddGroupsChat(model).ToString());

            if (remodel.Code == 1)
            {
                var obj = new { Code = 1, Msg = "发送成功", GroupId = model.GroupId, SenderId = model.SenderId, SendType = model.SendType, SendContent = model.SendContent, SenderHeadPic = UserInfo.HeadPicture, SenderName = UserInfo.UserName, UpdateTime = DateTime.Now.ToLongTimeString() };
                Clients.Group(model.GroupId.ToString()).sendGroupMessage(obj);
            }
            else
            {
                var obj = new { Code = 0, Msg = "发送失败" };
                Clients.Caller.sendMsgTips(obj);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 添加聊天记录
        /// </summary>
        /// <param name="model">聊天实体</param>
        /// <returns></returns>
        public object Friend_AddGroupsChat(Friends_GroupChat model)
        {
            DataSet ds = oGroupsDAL.Friend_AddGroupsChat(model);

            return(Common.JsonHelper.ToJson_L(ds));
        }