📄 body.aspx.cs
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using UserInfoLib;
public partial class body : System.Web.UI.Page
{
private void BindTODataGrid(int me)
{
DataSet table = UserInfo.Sele();
DataView dv = table.Tables[0].DefaultView;
dv.RowFilter = "TextID = "+me+"";
this.DataGrid1.DataSource = dv;
this.DataGrid1.DataBind();
}
private void BindTODataGrid()
{
DataSet table = UserInfo.Sele();
DataView dv = table.Tables[0].DefaultView;
this.DataGrid1.DataSource = dv;
this.DataGrid1.DataBind();
}
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
if (this.Session["TitleID"] != null)
{
BindTODataGrid(int.Parse(this.Session["TitleID"].ToString()));
}
else
{
BindTODataGrid();
}
}
}
protected void DataGrid1_ItemCommand(object source, DataGridCommandEventArgs e)
{
if (e.CommandName == "修 改")
{
if (this.Session["Root"] != null && this.Session["Root"].ToString() != "0")
{
this.DataGrid1.EditItemIndex = e.Item.ItemIndex;
if (this.Session["TitleID"] != null)
{
this.BindTODataGrid(int.Parse(this.Session["TitleID"].ToString()));
return;
}
}
else
{
this.Response.Write("<script>alert('没有权限');</script>");
}
}
else if (e.CommandName == "deleteID")
{
UserInfo user = new UserInfo();
user.TextID = int.Parse(((Label)e.Item.Cells[0].FindControl("LabelID")).Text);
user.DeleText();
}
else if (e.CommandName == "更 新")
{
UserInfo user = new UserInfo();
user.TextID = int.Parse(((Label)e.Item.Cells[0].FindControl("LabelID")).Text);
user.UserText = ((TextBox)e.Item.Cells[0].FindControl("TextBoxModifyBody")).Text;
user.Time = DateTime.Now;
user.UpdateText();
this.DataGrid1.EditItemIndex = -1;
if (this.Session["TitleID"] != null)
{
this.BindTODataGrid(int.Parse(this.Session["TitleID"].ToString()));
return;
}
}
else if (e.CommandName == "回复")
{
if ((Session["User"] != null) && (Session["Root"] != null) && (Session["Root"].ToString()) != "0")
{
Session["TextID"] = int.Parse(((Label)e.Item.Cells[0].FindControl("LabelID")).Text);
this.Response.Write("<script>window.open(' AddBack.aspx ','_blank','toolbar=no,width=490,height=260,status=no,scrollbars=no,resizable=no,menubar=no');</script>");
}
else
{
this.Response.Write("<script>alert('请登陆后再回复!');</script>");
this.Server.Transfer("index.aspx");
}
if (this.Session["TitleID"] != null)
{
this.BindTODataGrid(int.Parse(this.Session["TitleID"].ToString()));
return;
}
}
this.BindTODataGrid();
}
protected void DataGrid1_PageIndexChanged(object source, DataGridPageChangedEventArgs e)
{
this.DataGrid1.CurrentPageIndex = e.NewPageIndex;
this.BindTODataGrid();
}
public string StringFormatBody( string body )
{
body = body.Replace("[/呲牙]", "<img-src=images/facepic/face0.gif>");
body = body.Replace("[/微笑]", "<img-src=images/facepic/face1.gif>");
body = body.Replace("[/偷笑]", "<img-src=images/facepic/face2.gif>");
body = body.Replace("[/害羞]", "<img-src=images/facepic/face3.gif>");
body = body.Replace("[/色]", "<img-src=images/facepic/face4.gif>");
body = body.Replace("[/调皮]", "<img-src=images/facepic/face5.gif>");
body = body.Replace("[/大兵]", "<img-src=images/facepic/face6.gif>");
body = body.Replace("[/饥饿]", "<img-src=images/facepic/face7.gif>");
body = body.Replace("[/睡]", "<img-src=images/facepic/face8.gif>");
body = body.Replace("[/惊讶]", "<img-src=images/facepic/face9.gif>");
body = body.Replace("[/疑问]", "<img-src=images/facepic/face10.gif>");
body = body.Replace("[/咒骂]", "<img-src=images/facepic/face11.gif>");
body = body.Replace("[/大哭]", "<img-src=images/facepic/face12.gif>");
body = body.Replace("[/抓狂]", "<img-src=images/facepic/face13.gif>");
body = body.Replace("[/流汗]", "<img-src=images/facepic/face14.gif>");
body = body.Replace("[/衰]", "<img-src=images/facepic/face15.gif>");
body = body.Replace("[/难过]", "<img-src=images/facepic/face16.gif>");
body = body.Replace("[/敲打]", "<img-src=images/facepic/face17.gif>");
body = body.Replace("[/发怒]", "<img-src=images/facepic/face18.gif>");
body = body.Replace("[/尴尬]", "<img-src=images/facepic/face19.gif>");
body = body.Replace("[/困]", "<img-src=images/facepic/face20.gif>");
body = body.Replace("[/嘘]", "<img-src=images/facepic/face21.gif>");
body = body.Replace("[/晕]", "<img-src=images/facepic/face22.gif>");
body = body.Replace("[/折磨]", "<img-src=images/facepic/face23.gif>");
body = body.Replace("[/骷髅]", "<img-src=images/facepic/face24.gif>");
body = body.Replace("[/再见]", "<img-src=images/facepic/face25.gif>");
body = body.Replace("[/得意]", "<img-src=images/facepic/face26.gif>");
body = body.Replace("[/奋斗]", "<img-src=images/facepic/face27.gif>");
body = body.Replace("[/玫瑰]", "<img-src=images/facepic/face28.gif>");
body = body.Replace("[/猪头]", "<img-src=images/facepic/face29.gif>");
body = body.Replace("[/吻]", "<img-src=images/facepic/face30.gif>");
body = body.Replace("[/爱心]", "<img-src=images/facepic/face31.gif>");
body = body.Replace("[/心碎]", "<img-src=images/facepic/face32.gif>");
body = body.Replace("[/电话]", "<img-src=images/facepic/face33.gif>");
body = body.Replace("[/邮件]", "<img-src=images/facepic/face34.gif>");
body = body.Replace("[/强]", "<img-src=images/facepic/face35.gif>");
body = body.Replace("[/弱]", "<img-src=images/facepic/face36.gif>");
body = body.Replace("[/握手]", "<img-src=images/facepic/face37.gif>");
body = body.Replace("[/胜利]", "<img-src=images/facepic/face38.gif>");
body = body.Replace("[/礼物]", "<img-src=images/facepic/face39.gif>");
body = body.Replace("[/蛋糕]", "<img-src=images/facepic/face40.gif>");
body = body.Replace("[/钱]", "<img-src=images/facepic/face41.gif>");
body = body.Replace("\n", "<br>");
body = body.Replace(" ", " ");
return body.Replace("-", " ");
}
protected void DataGrid1_ItemDataBound(object sender, DataGridItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
DataGrid DataGrid2 = (DataGrid)e.Item.FindControl("DataGrid2");
//DataGrid2.ItemDataBound += new System.Web.UI.WebControls.DataGridItemEventHandler(this.DataGrid2_ItemDataBound);
//DataGrid2.ItemCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.DataGrid2_ItemCommand);
DataSet tab = new DataSet();
UserInfo user = new UserInfo();
Label tton = (Label)e.Item.Cells[0].FindControl("LabelID");
user.TextID = int.Parse(tton.Text);
tab = user.SeleBack();
DataView dv = tab.Tables[0].DefaultView;
DataGrid2.DataSource = dv;
DataGrid2.DataBind();
//当前的信息是否是作者自己写的。
Label LabelAuthor = (Label)e.Item.Cells[0].FindControl("LabelAuthor");
if (Session["User"] != null && LabelAuthor.Text == Session["User"].ToString())
{
Button ButtonModify = (Button)e.Item.Cells[0].FindControl("ButtonModify");
ButtonModify.Visible = true;
}
}
}
protected void DataGrid2_ItemCreated(object sender, DataGridItemEventArgs e)
{
}
protected void DataGrid1_ItemCreated(object sender, DataGridItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
if (Session["Root"] !=null && Session["Root"].ToString() == "1")
{
Button ButtonModify = (Button)e.Item.Cells[0].FindControl("ButtonModify");
ButtonModify.Visible = true;
Button ButtonDele = (Button)e.Item.Cells[0].FindControl("ButtonDele");
ButtonDele.Visible = true;
}
}
}
public string SizeFont(string str)
{
return ("<b><font size=2>" + str + "<font></b>");
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
this.Session.Remove("TitleID");
BindTODataGrid();
}
public string stringUser(string str)
{
return "<font color=white>个性签明:</font>" + str;
}
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
this.Session.Remove("TitleID");
this.Server.Transfer("index.aspx");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -