Speak.aspx.cs
资源名称:mcr.rar [点击查看]
上传用户:balance_rz
上传日期:2020-04-18
资源大小:103k
文件大小:2k
源码类别:
SCSI/ASPI
开发平台:
Others
- using System;
- using System.Collections;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Web;
- using System.Web.SessionState;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.HtmlControls;
- using MyChatRoom.BusinessLogicLayer;
- //该源码下载自www.51aspx.com(51aspx.com)
- namespace MyChatRoom.WebLayer
- {
- /// <summary>
- /// Speak 的摘要说明。
- /// </summary>
- public partial class Speak : System.Web.UI.Page
- {
- protected void Page_Load(object sender, System.EventArgs e)
- {
- // 在此处放置用户代码以初始化页面
- }
- /// <summary>
- /// 用户单击“发言”时的事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected void ButtonSpeak_Click(object sender, System.EventArgs e)
- {
- //获取用户输入的发言信息
- string userName=Session["user_name"].ToString(); //用户名
- string createTime=System.DateTime.Now.ToLongTimeString();//发言时间
- string content=TextBoxContent.Text; //发言内容
- string color=DropDownListColor.SelectedItem.Value; //颜色
- string emotion=DropDownListEmotion.SelectedItem.Value; //表情
- Message message=new Message(); //实例化Message类
- message.Add(userName,createTime,content,color,emotion); //利用Message类的Add方法,向数据库添加留言
- //清空发言框
- TextBoxContent.Text="";
- }
- /// <summary>
- /// 用户单击“离开”时的事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected void ButtonExit_Click(object sender, System.EventArgs e)
- {
- Session["user_name"]=null; //销毁Session中的用户信息
- Response.Write("<Script Language=JavaScript>window.top.location="Login.aspx";</Script>");
- }
- }
- }