Beispiel #1
0
 /// <summary>
 /// 修改聊天信息记录(根据id)
 /// </summary>
 /// <param name="message">聊天信息</param>
 /// <returns></returns>
 public int UpdateMessage(MessageInfo message)
 {
     StringBuilder sbSql = new StringBuilder();
     sbSql.Append("update MessageInfo set ");
     sbSql.Append("ReciveTime=@ReciveTime where Id=@Id");
     SQLiteParameter[] parameters = 
     { 
         new SQLiteParameter("@Id", DbType.Int32){Value=message.Id},
         new SQLiteParameter("@ReciveTime", DbType.DateTime){Value=Convert.ToDateTime(message.ReciveTime)}
     };
     return SqliteHelper.ExecuteNonQuery(sbSql.ToString(), parameters);
 }
Beispiel #2
0
 /// <summary>
 /// 新增聊天信息记录
 /// </summary>
 /// <param name="message">聊天信息</param>
 /// <returns></returns>
 public int AddMessage(MessageInfo message)
 {
     StringBuilder sbSql = new StringBuilder();
     sbSql.Append("insert into MessageInfo values");
     sbSql.Append("(@Id,@SendUserId,@ReciveUserId,@Content,@SendTime,@ReciveTime)");
     SQLiteParameter[] parameters = 
     { 
         new SQLiteParameter("@Id", DbType.Int32){Value=DBNull.Value},
         new SQLiteParameter("@SendUserId", DbType.String){Value=message.SendUserId},
         new SQLiteParameter("@ReciveUserId", DbType.String){Value=message.ReciveUserId},
         new SQLiteParameter("@Content", DbType.Object){Value=message.Content},
         new SQLiteParameter("@SendTime", DbType.DateTime){Value=Convert.ToDateTime(message.SendTime)},
         new SQLiteParameter("@ReciveTime", DbType.DateTime){Value=Convert.ToDateTime(message.ReciveTime)}
     };
     return SqliteHelper.ExecuteNonQuery(sbSql.ToString(), parameters);
 }
 public void Send_Msg()
 {
     UserInfo user = IPublic.VerifyUser();
     if (user == null) return;
     MessageInfo message = new MessageInfo()
     {
         SendUserId = HttpContext.Current.Request["UserId"],
         ReciveUserId = HttpContext.Current.Request["ReciveUserId"],
         Content = HttpContext.Current.Request["Content"],
         SendTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
     };
     if (!messageBLL.AddMessage(message))
     {
         responseResult.ResponseDetails = "消息发送失败!";
         responseResult.ResponseStatus = 0;
     }
     else
     {
         responseResult.ResponseData = message;
         responseResult.ResponseDetails = "消息发送成功!";
         responseResult.ResponseStatus = 1;
     }
     responseResult.ResponseWrite();
 }
Beispiel #4
0
 /// <summary>
 /// 修改聊天信息记录(根据id)
 /// </summary>
 /// <param name="message">聊天信息</param>
 /// <returns></returns>
 public bool UpdateMessage(MessageInfo message)
 {
     int AffectRows = messageDAL.UpdateMessage(message);
     return AffectRows > 0;
 }
Beispiel #5
0
 /// <summary>
 /// 新增聊天信息记录
 /// </summary>
 /// <param name="message">聊天信息</param>
 /// <returns></returns>
 public bool AddMessage(MessageInfo message)
 {
     int AffectRows = messageDAL.AddMessage(message);
     return AffectRows > 0;
 }
 public void SendMsg(string Action, string strContent)
 {
     MessageInfo message = new MessageInfo()
     {
         SendUserId = m_Context.Request["UserId"],
         ReciveUserId = m_Context.Request["ReciveUserId"],
         Content = m_Context.Request["Content"]
     };
     foreach (ServerPushResult IAsyncResult in dict.Values)
     {
         //IAsyncResult.ResultXml = strContent;
         //IAsyncResult.Send(null);
     }
 }
 private void SendMsg()
 {
     MessageInfo message = new MessageInfo()
     {
         SendUserId = m_Context.Request["UserId"],
         ReciveUserId = m_Context.Request["ReciveUserId"],
         Content = m_Context.Request["Content"]
     };
     string result = sdk.Send_Msg(message);
     if (dict.ContainsKey(message.ReciveUserId))
     {
         dict[message.ReciveUserId].Result = result;
         dict[message.ReciveUserId].Send();
     }
     _IAsyncResult.Result = result;
     _IAsyncResult.Send();
 }
Beispiel #8
0
 /// <summary>
 /// 发送消息
 /// </summary>
 /// <param name="friend">发送消息</param>
 /// <returns></returns>
 public string Send_Msg(MessageInfo message)
 {
     PHPArray array = new PHPArray();
     array.Add("ReciveUserId", message.ReciveUserId);
     array.Add("Content", message.Content);
     string url = this.GetUrl(string.Format(GlobalURL.Send_Msg, GlobalURL.Version), array);
     return this.Http_Get(url);
 }