您目前尚未登陆,请选择【登陆】或【注册
首页->聊天计数->NChat简易聊天室源码(.Net 3.5,LINQ,AJAX)>>Web/Room.aspx.cs>>代码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,不能展示项目的全部,如果想更进一步了解该代码请下载:NChat简易聊天室源码(.Net 3.5,LINQ,AJAX)


当前文件路径:NChat/Web/Room.aspx.cs 文件类型
普通视图
		            
1using System; 2using System.Collections; 3using System.Configuration; 4using System.Data; 5using System.Linq; 6using System.Web; 7using System.Web.Security; 8using System.Web.UI; 9using System.Web.UI.HtmlControls; 10using System.Web.UI.WebControls; 11using System.Web.UI.WebControls.WebParts; 12using System.Xml.Linq; 13 14using DB = NChart.DBHelper; 15using System.Collections.Generic; 16using NChat.Common; 17//该源码下载自www.51aspx.com(51aspx.com) 18 19namespace NChat.Web 20{ 21 public partial class Room : System.Web.UI.Page 22 { 23 DB::User u; 24 protected void Page_Load(object sender, EventArgs e) 25 { 26 if (Session.Count > 0 && Session["SUser"] != null) 27 { 28 u = (DB::User)Session["SUser"]; 29 if (u.ID < 1) 30 { 31 Session.RemoveAll(); 32 Response.Redirect("Default.aspx"); 33 } 34 } 35 else 36 Response.Redirect("Default.aspx"); 37 38 if (!Page.IsPostBack) 39 { 40 StaticHelper.OnlineUserClear(); 41 ListInit(); 42 } 43 } 44 45 protected void Button1_Click(object sender, EventArgs e) 46 { 47 StaticHelper.ActiveUserUpdate(new ActiveUserModel(u.Name, DateTime.Now)); 48 if (!string.IsNullOrEmpty(TextBox1.Text)) 49 { 50 string msg = TextBox1.Text.Trim(); 51 msg = msg.Replace("|", "&{/}$"); 52 string to = "大家"; 53 if (UserList.SelectedItem != null && !string.IsNullOrEmpty(UserList.SelectedItem.Text)) 54 { 55 to = UserList.SelectedItem.Text; 56 UserList.SelectedItem.Selected = false; 57 } 58 msg = u.Name + "|" + to + "|" + msg; 59 StaticHelper.MsgListAdd(msg); 60 61 TextBox1.Text = ""; 62 } 63 } 64 65 protected void Timer1_Tick(object sender, EventArgs e) 66 { 67 IEnumerable<string> list = StaticHelper.MsgList(u.ID); 68 69 foreach (var item in list) 70 { 71 string[] items = item.Split('|'); 72 items[2] = items[2].Replace("&{/}$", "|"); 73 if (items[1] == u.Name || items[1] == "大家" || items[0] == u.Name) 74 { 75 if (items[0] == u.Name) 76 items[0] = "<font color=\"blue\">你</font>"; 77 if (items[1] == u.Name) 78 items[1] = "<font color=\"blue\">你</font>"; 79 MsgText.Text = "<strong>" + items[0] + "</strong>对<strong>" + items[1] + "</strong>说:" + items[2] + "<br/>" + MsgText.Text; 80 } 81 } 82 } 83 84 protected void Timer2_Tick(object sender, EventArgs e) 85 { 86 if (!StaticHelper.UserListStatic.Contains(u.Name)) 87 Session.RemoveAll(); 88 89 ListInit(); 90 } 91 92 void ListInit() 93 { 94 UserList.Items.Clear(); 95 UserList.Items.Add("大家"); 96 foreach (var item in StaticHelper.UserListStatic) 97 { 98 //string temp = "<a href=\"javascript:;\" onserverclick=\"BulletedList1_Click\" runat=\"server\">" + item + "</a>"; 99 UserList.Items.Add(item); 100 } 101 } 102 103 104 protected void UserList_SelectedIndexChanged(object sender, EventArgs e) 105 { 106 //CheckBoxList list = (CheckBoxList)sender; 107 //if (list.SelectedItem != null) 108 // DropDownListAdd(list.SelectedItem.Text); 109 } 110 } 111} 112
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:NChat简易聊天室源码(.Net 3.5,LINQ,AJAX)

- 固定资产管理系统源码

- 简单文章管理系统

- 51aspx日期控件演示及源码

- 科信客户关系管理系统源码

- 简单入门新闻发布系统源码

- 某大学学生管理系统(毕业设..

- DotNetTextBoxVer3.4.0在线编..

- jimmyNews(Asp.net新闻系统)..

51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号