protected void Page_Load(object sender, EventArgs e) { if (Session["userid"] == null || Session["userid"].ToString() == "") { Response.Redirect("login.aspx"); } curuser = (starweibo.Model.userInfo)Session["user"]; sendname = Request.QueryString["sendname"].ToString(); sendid = Request.QueryString["sendid"].ToString(); curid = Convert.ToInt32(Session["userid"]); starweibo.BLL.chatV bllchatv = new starweibo.BLL.chatV(); starweibo.BLL.chatInfo bllchatInfo = new starweibo.BLL.chatInfo(); List <starweibo.Model.chatV> modchatV = new List <starweibo.Model.chatV>(); modchatV = bllchatv.GetModelList("(senderId=" + curid + " and receiverId=" + sendid + ") or (senderId=" + sendid + " and receiverId=" + curid + ") order by pubTime desc"); this.msgdialogue.DataSource = modchatV; this.msgdialogue.DataBind(); //starweibo.BLL.chatInfo foreach (starweibo.Model.chatV onechatV in modchatV) { bllchatInfo.myUpdate("read", onechatV.shortMsgId.ToString()); } }
public int dtmessage(int receiveId, string content) { int sendid = Convert.ToInt32(Session["userid"]); //int sendid = 1; starweibo.Model.chatInfo onechat = new starweibo.Model.chatInfo(); starweibo.BLL.chatInfo bllchat = new starweibo.BLL.chatInfo(); onechat.senderId = sendid; onechat.receiverId = receiveId; onechat.msgContent = content; onechat.msgState = "noread"; return(bllchat.Add(onechat)); }
public List <starweibo.Model.chatV> dtnoreadmessage(int sendId) { int receiveId = Convert.ToInt32(Session["userid"]); starweibo.BLL.chatInfo bllchatInfo = new starweibo.BLL.chatInfo(); //int receiveId = 1; starweibo.BLL.chatV bllchatV = new starweibo.BLL.chatV(); List <starweibo.Model.chatV> mochatV = new List <starweibo.Model.chatV>(); mochatV = bllchatV.GetModelList("senderId=" + sendId + " and receiverId=" + receiveId + " and msgState='noread'"); foreach (starweibo.Model.chatV onechatV in mochatV) { bllchatInfo.myUpdate("read", onechatV.shortMsgId.ToString()); } return(mochatV); }
//发送公告 public void SendSysMsg(string msgContent) { starweibo.BLL.chatInfo SysMsg = new starweibo.BLL.chatInfo(); starweibo.Model.chatInfo molMsg = new starweibo.Model.chatInfo(); List <starweibo.Model.userInfo> SSM = new List <starweibo.Model.userInfo>(); starweibo.BLL.userInfo bllSSM = new starweibo.BLL.userInfo(); SSM = bllSSM.GetModelList("1=1"); foreach (starweibo.Model.userInfo onessm in SSM) { if (onessm.id != 44) { molMsg.receiverId = onessm.id; molMsg.msgContent = msgContent; molMsg.senderId = 44; molMsg.msgState = "noread"; SysMsg.Add(molMsg); } } }