📄 mainlist.aspx.cs
字号:
ismanager=true;
}
}
if (s=="")
LblB.Text="大版主:暂无";
else
LblB.Text="大版主:"+s;
if (!ismanager)
{
for (int i=0;i<DL_Main.Items.Count;i++ )
{
DL_Main.Items[i].FindControl("selected").Visible=false;
}
Panel1.Visible=false;
}
else
{
DropDownList1.DataSource=DBOperate.SelectFormForum("SELECT *,Big_Class.BigClass_Name + '-' + Small_Class.SmallClass_Name AS BSName FROM Big_Class INNER JOIN Small_Class ON Big_Class.BigClass_ID = Small_Class.BigClass_ID WHERE (Big_Class.Enable = 1) AND (Small_Class.Enable = 1) ORDER BY Small_Class.BigClass_ID");
DropDownList1.DataBind();
}
}
private void Page_Load(object sender, System.EventArgs e)
{
//获得在线用户数
if (System.Convert.ToInt32(System.Configuration.ConfigurationSettings.AppSettings["BorowsArea"])>2)
{
if (User.Identity.Name.ToString()=="")
{
this.Response.Redirect("logon.aspx");
}
}
if (!this.IsPostBack)
{
int i=(int)Application.Get("logincount");
Lbl_UserCou.Text="在线人数:"+i.ToString();
//判断用户是否登录
if (Session["UserGrade"]==null)
Session["UserGrade"]=DBOperateSite.GetUserGrade(User.Identity.Name);
Lbl_UserGrade.Text="用户级别:"+ Session["UserGrade"].ToString();
if ((User.Identity.Name==null)||(User.Identity.Name==""))
{
Lbl_UserName.Text="当前用户:过客";
Lb_logon.Text="用户登录";
}
else
{
Lbl_UserName.Text="当前用户:"+User.Identity.Name.ToString();
Lb_logon.Text="重新登录";
}
Lbl_IP.Text="用户IP:"+this.Request.UserHostAddress;
HaveShortMsg();
this.DL_Main.DataSource=DBOperate.SelectFormForum("SELECT *, Big_Class.BigClass_Name + '-' + Small_Class.SmallClass_Name AS BSName FROM Big_Class INNER JOIN Small_Class ON Big_Class.BigClass_ID = Small_Class.BigClass_ID WHERE (Big_Class.Enable = 1) AND (Small_Class.Enable = 1) ORDER BY Small_Class.BigClass_ID");
BindGrid();
}
}
//计算是否有短消息
public void HaveShortMsg()
{
int intCount;
intCount=DBOperate.ShortMsgCount(this.User.Identity.Name.ToString());
if (intCount==0)
this.Panel2.Visible=false;
else
this.Panel2.Visible=true;
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.sqlSelectCommand2 = new System.Data.SqlClient.SqlCommand();
this.sqlConnection2 = new System.Data.SqlClient.SqlConnection();
this.sqlInsertCommand2 = new System.Data.SqlClient.SqlCommand();
this.sqlUpdateCommand2 = new System.Data.SqlClient.SqlCommand();
this.sqlDeleteCommand2 = new System.Data.SqlClient.SqlCommand();
this.sqlDataAdapter2 = new System.Data.SqlClient.SqlDataAdapter();
this.sqlCmddelete = new System.Data.SqlClient.SqlCommand();
this.sqlSelectCommand4 = new System.Data.SqlClient.SqlCommand();
this.sqlInsertCommand4 = new System.Data.SqlClient.SqlCommand();
this.sqlUpdateCommand4 = new System.Data.SqlClient.SqlCommand();
this.sqlDeleteCommand4 = new System.Data.SqlClient.SqlCommand();
this.sqlDataAdapter4 = new System.Data.SqlClient.SqlDataAdapter();
this.Lb_logon.Click += new System.EventHandler(this.Lb_logon_Click);
this.LinkButton1.Click += new System.EventHandler(this.LinkButton1_Click);
this.Linkbutton2.Click += new System.EventHandler(this.Linkbutton2_Click);
this.Linkbutton4.Click += new System.EventHandler(this.Linkbutton4_Click);
this.Button5.Click += new System.EventHandler(this.Button5_Click);
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Button3.Click += new System.EventHandler(this.Button3_Click);
this.Button2.Click += new System.EventHandler(this.Button2_Click);
this.Button4.Click += new System.EventHandler(this.Button4_Click);
this.BtnMove.Click += new System.EventHandler(this.BtnMove_Click);
//
// sqlSelectCommand2
//
this.sqlSelectCommand2.CommandText = "SELECT PKID, Bigclass_ID, Smallclass_ID, ManagerName FROM Managers";
this.sqlSelectCommand2.Connection = this.sqlConnection2;
//
// sqlConnection2
//
this.sqlConnection2.ConnectionString = "workstation id=GAS;packet size=4096;user id=sa;data source=localhost;persist secu" +
"rity info=True;initial catalog=doughty_BBS;password=123";
//
// sqlInsertCommand2
//
this.sqlInsertCommand2.CommandText = "INSERT INTO Managers(Bigclass_ID, Smallclass_ID, ManagerName) VALUES (@Bigclass_I" +
"D, @Smallclass_ID, @ManagerName); SELECT PKID, Bigclass_ID, Smallclass_ID, Manag" +
"erName FROM Managers WHERE (PKID = @@IDENTITY)";
this.sqlInsertCommand2.Connection = this.sqlConnection2;
this.sqlInsertCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Bigclass_ID", System.Data.SqlDbType.Int, 4, "Bigclass_ID"));
this.sqlInsertCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Smallclass_ID", System.Data.SqlDbType.Int, 4, "Smallclass_ID"));
this.sqlInsertCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@ManagerName", System.Data.SqlDbType.VarChar, 50, "ManagerName"));
//
// sqlUpdateCommand2
//
this.sqlUpdateCommand2.CommandText = @"UPDATE Managers SET Bigclass_ID = @Bigclass_ID, Smallclass_ID = @Smallclass_ID, ManagerName = @ManagerName WHERE (PKID = @Original_PKID) AND (Bigclass_ID = @Original_Bigclass_ID OR @Original_Bigclass_ID IS NULL AND Bigclass_ID IS NULL) AND (ManagerName = @Original_ManagerName OR @Original_ManagerName IS NULL AND ManagerName IS NULL) AND (Smallclass_ID = @Original_Smallclass_ID OR @Original_Smallclass_ID IS NULL AND Smallclass_ID IS NULL); SELECT PKID, Bigclass_ID, Smallclass_ID, ManagerName FROM Managers WHERE (PKID = @PKID)";
this.sqlUpdateCommand2.Connection = this.sqlConnection2;
this.sqlUpdateCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Bigclass_ID", System.Data.SqlDbType.Int, 4, "Bigclass_ID"));
this.sqlUpdateCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Smallclass_ID", System.Data.SqlDbType.Int, 4, "Smallclass_ID"));
this.sqlUpdateCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@ManagerName", System.Data.SqlDbType.VarChar, 50, "ManagerName"));
this.sqlUpdateCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_PKID", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "PKID", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_Bigclass_ID", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Bigclass_ID", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_ManagerName", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "ManagerName", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_Smallclass_ID", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Smallclass_ID", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@PKID", System.Data.SqlDbType.Int, 4, "PKID"));
//
// sqlDeleteCommand2
//
this.sqlDeleteCommand2.CommandText = @"DELETE FROM Managers WHERE (PKID = @Original_PKID) AND (Bigclass_ID = @Original_Bigclass_ID OR @Original_Bigclass_ID IS NULL AND Bigclass_ID IS NULL) AND (ManagerName = @Original_ManagerName OR @Original_ManagerName IS NULL AND ManagerName IS NULL) AND (Smallclass_ID = @Original_Smallclass_ID OR @Original_Smallclass_ID IS NULL AND Smallclass_ID IS NULL)";
this.sqlDeleteCommand2.Connection = this.sqlConnection2;
this.sqlDeleteCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_PKID", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "PKID", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_Bigclass_ID", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Bigclass_ID", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_ManagerName", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "ManagerName", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_Smallclass_ID", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Smallclass_ID", System.Data.DataRowVersion.Original, null));
//
// sqlDataAdapter2
//
this.sqlDataAdapter2.DeleteCommand = this.sqlDeleteCommand2;
this.sqlDataAdapter2.InsertCommand = this.sqlInsertCommand2;
this.sqlDataAdapter2.SelectCommand = this.sqlSelectCommand2;
this.sqlDataAdapter2.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "Managers", new System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("PKID", "PKID"),
new System.Data.Common.DataColumnMapping("Bigclass_ID", "Bigclass_ID"),
new System.Data.Common.DataColumnMapping("Smallclass_ID", "Smallclass_ID"),
new System.Data.Common.DataColumnMapping("ManagerName", "ManagerName")})});
this.sqlDataAdapter2.UpdateCommand = this.sqlUpdateCommand2;
//
// sqlSelectCommand4
//
this.sqlSelectCommand4.CommandText = "SELECT COUNT(*) AS co FROM ShortMessage WHERE (systemmsg = 0) AND (Readed = 0) AN" +
"D (UserName = @UserName)";
this.sqlSelectCommand4.Parameters.Add(new System.Data.SqlClient.SqlParameter("@UserName", System.Data.SqlDbType.VarChar, 50, "UserName"));
//
// sqlInsertCommand4
//
this.sqlInsertCommand4.CommandText = @"INSERT INTO ShortMessage(UserName, Message, Readed, SendUserName, SendTime, systemmsg) VALUES (@UserName, @Message, @Readed, @SendUserName, @SendTime, @systemmsg); SELECT PKID, UserName, Message, Readed, SendUserName, SendTime, systemmsg FROM ShortMessage WHERE (PKID = @@IDENTITY)";
this.sqlInsertCommand4.Parameters.Add(new System.Data.SqlClient.SqlParameter("@UserName", System.Data.SqlDbType.VarChar, 50, "UserName"));
this.sqlInsertCommand4.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Message", System.Data.SqlDbType.VarChar, 800, "Message"));
this.sqlInsertCommand4.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Readed", System.Data.SqlDbType.Bit, 1, "Readed"));
this.sqlInsertCommand4.Parameters.Add(new System.Data.SqlClient.SqlParameter("@SendUserName", System.Data.SqlDbType.VarChar, 50, "SendUserName"));
this.sqlInsertCommand4.Parameters.Add(new System.Data.SqlClient.SqlParameter("@SendTime", System.Data.SqlDbType.DateTime, 8, "SendTime"));
this.sqlInsertCommand4.Parameters.Add(new System.Data.SqlClient.SqlParameter("@systemmsg", System.Data.SqlDbType.Bit, 1, "systemmsg"));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -