📄 navi.ascx.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 System.Data.SqlClient;
public partial class tongxue_navi : System.Web.UI.UserControl
{
int userid;
protected void Page_Load(object sender, EventArgs e)
{
if (Session["userid"] != null)
this.userid = Convert.ToInt32(Session["userid"].ToString());
loaduserinfo();
loadUserClass();
Page.Title = "欢迎光临博客同学录!";
}
private void loaduserinfo()
{
if(Session ["username"]!=null )
welcome.InnerHtml = "欢迎您!" + Session["username"].ToString();
}
private void loadUserClass()
{
int tid = userid;
string sql = "select tbanji.* from tbanji,tidcid where tidcid.cid=tbanji.cid and tid="+tid ;
string strconn = ConfigurationManager.ConnectionStrings["dsn"].ToString();
SqlConnection cn = new SqlConnection(strconn);
cn.Open();
SqlCommand cm = new SqlCommand(sql, cn);
SqlDataReader dr = cm.ExecuteReader();
bool validate = false;
string strJoin ="<table class=tclass cellspacing=2 cellpadding=5>";
strJoin += "<tr><td>您已经加入了如下班级:</td></tr>";
while (dr.Read())
{
validate = true;
string str1=dr["college"].ToString ()+"__"+dr["comeyear"].ToString ()+"__"+dr["classname"].ToString ();
string cid=dr["cid"].ToString ();
strJoin += "<tr height=30><td>" + str1+" ";
if (dr["adminuserid"].ToString() == Session["userid"].ToString())
strJoin += "<i><u>班级管理员</u></i>";
strJoin += "</td>";
strJoin += "<td><a href=liuyan.aspx?cid=" + cid + ">查看班级留言</a></td>";
strJoin += "<td><a href=commbook.aspx?cid=" + cid + ">查看班级通讯录</a></td>";
strJoin += "</tr>";
}
strJoin += "</table>";
if (validate)
joinclass.InnerHtml = strJoin;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -