?? index.aspx.cs
字號(hào):
?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;
using lalablog;
public partial class tongxue_index : System.Web.UI.Page
{
int userid;
protected void Page_Load(object sender, EventArgs e)
{
if (Session["userid"] != null)
{
this.userid = Convert.ToInt32(Session["userid"].ToString());
}
else
Response.Redirect("userLogin.aspx?url=" + Server.HtmlEncode(Request.RawUrl));
if (!IsPostBack)
{
istongxue();adminApplyUser();
}
if (Request.QueryString["action"] != null)
actionApplyUser();
}
private void istongxue()
{
string sql = "select tid from tongxue where tid=" + this.userid;
openDb o1 = new openDb(sql);
string result = o1.getValue();
if (result == "-1")
Response.Redirect("userinfo.aspx");
}
private void actionApplyUser()
{
string action = Request.QueryString["action"].ToString();
int tid = Convert.ToInt32(Request.QueryString["tid"].ToString());
int cid = Convert.ToInt32(Request.QueryString["cid"].ToString());
string sql;
sql="delete from tapply where tid="+tid +" and cid="+cid;
if (action == "ok")
{
sql += ";delete from tidcid where tid=" + tid + " and cid=" + cid;
sql += ";insert into tidcid(tid,cid) values(" + tid + "," + cid + ")";
}
openDb o1 = new openDb(sql);
string msg = o1.updatesuccess();
if (msg == "success")
if (action == "ok")
{
myfunc m1 = new myfunc("批準(zhǔn)已生效");
Response.Write(m1.JavaMsg("index.aspx"));
}
else
{
myfunc m1 = new myfunc(sql+"已拒絕申請");
Response.Write(m1.JavaMsg("index.aspx"));
}
else
{
myfunc m1 = new myfunc(msg );
Response.Write(m1.JavaMsg());
}
}
private void adminApplyUser()
{
bool isout=false ;
string strconn = ConfigurationManager.ConnectionStrings["dsn"].ToString();
SqlConnection cn = new SqlConnection(strconn);
cn.Open();
string sql="select tapply.tid,tapply.cid,tongxue.realname,tbanji.college,";
sql+="tbanji.comeyear,tbanji.classname";
sql+=" from tapply,tbanji,tongxue where tapply.cid=tbanji.cid";
sql+=" and tapply.tid=tongxue.tid";
sql+=" and tbanji.adminuserid="+this.userid ;
SqlCommand cm = new SqlCommand(sql, cn);
SqlDataReader dr = cm.ExecuteReader();
string str= "<table><tr><td>姓名</td><td></td>";
str+="<td>學(xué)校</td><td>批準(zhǔn)</td><td>拒絕</td>";
while (dr.Read())
{
str += "<tr>";
str += "<td>"+dr["realname"].ToString() + "</td><td>申請加入</td> ";
str += "<td>"+dr["college"].ToString();
str += dr["comeyear"].ToString();
str += dr["classname"].ToString()+"</td>";
str += "<td><a href=index.aspx?action=ok&tid=";
str += dr["tid"].ToString() + "&cid=";
str +=dr["cid"].ToString() +">批準(zhǔn)</a></td><td>";
str += "<a href=index.aspx?action=no&tid=";
str += dr["tid"].ToString() + "&cid=";
str += dr["cid"].ToString()+ ">拒絕</a></td>";
str += "</tr>";
isout = true;
}
str += "</table>";
if(isout )
adminApply.InnerHtml = str;
cn.Close();
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -