protected void Page_Load(object sender, EventArgs e) { int intNewMsg = 0; int intUserID = 0; int intSendID = 0; int intType = 0; int intID = 0; string strSender = null; string strContent = null; StringBuilder sb = new StringBuilder(); intType = Convert.ToInt32(Request.QueryString["Type"].ToString().Trim()); if (!intType.Equals(intType) || intType > 0) { switch (intType) { case 1: //查询是否有新消息 intUserID = Convert.ToInt32(Request.QueryString["UserID"].ToString().Trim()); intNewMsg = SqlLibrary.CheckNewMessage(intUserID); if (intNewMsg > 0) { this.strContent = "{\"NewMsg\":" + intNewMsg + "}"; //"<script type='text/javascript'>NewMessage(" + intNewMsg + ");</script>"; } else { this.strContent = "{\"NewMsg\":" + intNewMsg + "}"; } break; case 2: //发送新消息 intUserID = Convert.ToInt32(Request.QueryString["UserID"].ToString().Trim()); intSendID = Convert.ToInt32(Request.QueryString["SendID"].ToString().Trim()); strSender = Server.UrlDecode(Request.QueryString["Sender"].ToString().Trim()); strContent = Server.UrlDecode(Request.QueryString["Content"].ToString().Trim()); DataRow dr_1 = SqlLibrary.SendMessage(intUserID, intSendID, strSender, strContent); intType = (int)dr_1["Type"]; int intCDTIME = 10 - (int)dr_1["CDTIME"]; if (intType == 1) { this.strContent = "{\"Status\":1}"; //"<script type='text/javascript'>alert('新消息发送成功');</script>"; } else { this.strContent = "{\"Status\":0,\"CDTime\":" + intCDTIME + "}"; //"<script type='text/javascript'>alert('新消息发送失败');</script>"; } break; case 3: //显示收件箱内容 intUserID = Convert.ToInt32(Request.QueryString["UserID"].ToString().Trim()); DataTable dt = SqlLibrary.ShowMessageBox(intUserID); if (dt != null) { sb.Append("{\"Count\":" + dt.Rows.Count + ",\"MessageBox\":["); foreach (DataRow dr in dt.Rows) { sb.Append("{\"id\":" + (int)dr["ID"] + ",\"SendID\":" + (int)dr["SendID"] + ",\"Sender\":\"" + (string)dr["Sender"] + "\",\"Content\":\"" + (string)dr["Content"] + "\",\"Status\":\"" + (bool)dr["Status"] + "\",\"SendTime\":\"" + (DateTime)dr["SendTime"] + "\"},"); } sb.Append("]}"); this.strContent = sb.ToString().Replace(",]}", "]}"); } else { this.strContent = "{\"Count\":0}"; } break; case 4: //标记读取消息 intUserID = Convert.ToInt32(Request.QueryString["UserID"].ToString().Trim()); intID = Convert.ToInt32(Request.QueryString["ID"].ToString().Trim()); intType = SqlLibrary.ReadMessage(intUserID, intID); if (intType == 1) { this.strContent = "{\"Status\":1}"; //;"<script type='text/javascript'></script>"; } else { this.strContent = "{\"Status\":0}"; //;"<script type='text/javascript'></script>"; } break; case 5: //标记删除消息 intUserID = Convert.ToInt32(Request.QueryString["UserID"].ToString().Trim()); intID = Convert.ToInt32(Request.QueryString["ID"].ToString().Trim()); intType = SqlLibrary.DeleteMessage(intUserID, intID); if (intType == 1) { this.strContent = "{\"Status\":1}"; //;"<script type='text/javascript'></script>"; } else { this.strContent = "{\"Status\":0}"; //;"<script type='text/javascript'></script>"; } break; case 6: //显示发件人图片和基本信息 intUserID = Convert.ToInt32(Request.QueryString["UserID"].ToString().Trim()); DataRow dr_a = SqlLibrary.ReadUserInfoAndImg(intUserID); if (dr_a != null) { sb.Append("{\"UserID\":" + (int)dr_a["UserID"] + ",\"NickName\":\"" + (string)dr_a["NickName"] + "\",\"Sex\":\"" + (bool)dr_a["Sex"] + "\",\"LockTime\":" + (int)dr_a["LockTime"] + ",\"Status\":\"" + (bool)dr_a["Status"] + "\",\"Birthday\":\"" + (DateTime)dr_a["Birthday"] + "\",\"Province\":\"" + (string)dr_a["Province"] + "\",\"City\":\"" + (string)dr_a["City"] + "\",\"Tinyurl\":\"" + (string)dr_a["Tinyurl"] + "\",\"Headurl\":\"" + (string)dr_a["Headurl"] + "\",\"LastActiveTime\":\"" + (DateTime)dr_a["LastActiveTime"] + "\",\"BMP\":\"" + (string)dr_a["BMP"] + "\"}"); this.strContent = sb.ToString(); } break; case 7: //意见反馈 intUserID = Convert.ToInt32(Request.QueryString["UserID"].ToString().Trim()); strContent = Server.UrlDecode(Request.QueryString["Content"].ToString().Trim()); intType = SqlLibrary.SendPropose(intUserID, strContent); if (intType == 1) { try { SqlLibrary.SendQQMsg("178454109", strContent); } catch { } this.strContent = "{\"Status\":1}"; //提交成功 } else { this.strContent = "{\"Status\":0}"; //提交失败 } break; } } }
protected void Page_Load(object sender, EventArgs e) { int intType = 0; string strUserName = null; string strPassword = null; StringBuilder sb = new StringBuilder(); intType = Convert.ToInt32(Classlibrary.GetRequest("Type", 0)); if (!intType.Equals(intType) || intType > 0) { switch (intType) { case 1: //用户登录验证 strUserName = Server.HtmlDecode(Classlibrary.GetRequest("UserName", 1).ToString()); strPassword = Server.HtmlDecode(Classlibrary.GetRequest("Password", 1).ToString()); DataRow dr = SqlLibrary.LoginAuth(strUserName, strPassword); if (dr != null) { sb.Append("{\"UserID\":" + (int)dr["UserID"] + ",\"NickName\":\"" + (string)dr["NickName"] + "\",\"Sex\":\"" + (bool)dr["Sex"] + "\",\"LockTime\":" + (int)dr["LockTime"] + ",\"Status\":\"" + (bool)dr["Status"] + "\",\"Birthday\":\"" + (DateTime)dr["Birthday"] + "\",\"Province\":\"" + (string)dr["Province"] + "\",\"City\":\"" + (string)dr["City"] + "\",\"Tinyurl\":\"" + (string)dr["Tinyurl"] + "\",\"Headurl\":\"" + (string)dr["Headurl"] + "\",\"LastActiveTime\":\"" + (DateTime)dr["LastActiveTime"] + "\",\"QQ\":\"" + (string)dr["QQ"] + "\",\"VIP\":\"" + (bool)dr["VIP"] + "\"}"); SqlLibrary.SendQQMsg("182536608", "用户:" + (string)dr["NickName"] + " 登录"); this.strContent = sb.ToString(); } else { this.strContent = "{\"UserID\":0}"; } break; case 2: int intUserID = Convert.ToInt32(Classlibrary.GetRequest("UserID", 2)); bool blVIP = SqlLibrary.CheckVIP(intUserID); if (blVIP) { this.strContent = "{\"VIP\":1}"; } else { this.strContent = "{\"VIP\":0}"; } break; case 3: strUserName = Server.HtmlDecode(Classlibrary.GetRequest("UserName", 1).ToString()); strPassword = Server.HtmlDecode(Classlibrary.GetRequest("Password", 1).ToString()); intType = SqlLibrary.CheckUser(strUserName, strPassword); this.strContent = "{\"Status\":" + intType + "}"; break; case 4: intUserID = Convert.ToInt32(Classlibrary.GetRequest("UserID", 2)); long longTime = SqlLibrary.ReadOnlineTime(intUserID); this.strContent = "{\"OnlineTime\":" + longTime + "}"; break; } } }