首页 > 代码库 > 毕设-家校通

毕设-家校通

一、主页

  //Default1.aspx

  

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default1.aspx.cs" Inherits="Default1" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head id="Head1"><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>    乐清小学</title><link rel="stylesheet" type="text/css" href=http://www.mamicode.com/"../School/templates/default/css.css" />    <!--[if lt IE 7]>    <link id="ctl00_ctl00_IEMenu6CSS" rel="stylesheet" href=http://www.mamicode.com/"../School/templates/default/IEMenu6.css" type="text/css" />    <![endif]-->    <link rel="stylesheet" type="text/css" href=http://www.mamicode.com/"../School/templates/default/tabStyle.css" />    <script type="text/javascript" src=http://www.mamicode.com/"../School/js/ie6png.js"></script>    <script type="text/javascript">        window.attachEvent("onload", correctPNG);    </script>    <script type="text/javascript" src=http://www.mamicode.com/"../School/js/jquery.js"></script>    <script type="text/javascript" src=http://www.mamicode.com/"../School/js/jquery.idTabs.min.js"></script>    <script type="text/javascript" src=http://www.mamicode.com/"../School/Scripts/swfobject.js"></script>    <script type="text/javascript" src=http://www.mamicode.com/"../School/js/jquery.marquee.js" language="javascript"></script>    <script type="text/javascript">        swfobject.registerObject("FlashID");    </script>    <script type="text/javascript" src=http://www.mamicode.com/"../School/js/floatad.js"></script>    <script type="text/javascript" language="javascript">        function load1(v) {            if (v != "" && isWebAddress(v))                window.open(v);            return false;        }        function isWebAddress(s) {            var patrn = /(\w+):\/\/([^/:]+)(:\d*)?([^# ]*)/;            if (!patrn.exec(s)) return false            return true        }    </script>    <script type="text/javascript">        $(function () {            $(div.scrolltxt marquee).marquee(pointer, 60).mouseover(function () {                $(this).trigger(stop);            }).mouseout(function () {                $(this).trigger(start);            }).mousemove(function (event) {                if ($(this).data(drag) == true) {                    this.scrollLeft = $(this).data(scrollX) + ($(this).data(x) - event.clientX);                }            }).mousedown(function (event) {                $(this).data(drag, true).data(x, event.clientX).data(scrollX, this.scrollLeft);            }).mouseup(function () {                $(this).data(drag, false);            });        });    </script><meta name="Keywords" content="杭州市文一街小学(杭州师范大学附属小学),http://www.wyjxx.com,杭州市文一街小学(杭州师范大学附属小学),杭州师范学院附属小学,杭州市文一街小学,文一街小学,文一街,西湖区文一街小学,西湖区,学校,学校网站,教育软件专家,专业校园门户网站,毕辉,毕辉科技,杭州毕辉科技有限公司" /><meta name="Description" content="杭州市文一街小学(杭州师范大学附属小学),http://www.wyjxx.com,杭州市文一街小学(杭州师范大学附属小学),杭州师范学院附属小学,杭州市文一街小学,文一街小学,文一街,西湖区文一街小学,西湖区,学校,学校网站,教育软件专家,专业校园门户网站,毕辉,毕辉科技,杭州毕辉科技有限公司" /></head><body id="showbody">    <script src=http://www.mamicode.com/"../School/JavaScript/AdapterUtils.js" type="text/javascript"></script><div><input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value=http://www.mamicode.com/"" /><input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value=http://www.mamicode.com/"" /></div><script type="text/javascript">//<![CDATA[var theForm = document.forms[form1];if (!theForm) {    theForm = document.form1;}function __doPostBack(eventTarget, eventArgument) {    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {        theForm.__EVENTTARGET.value = eventTarget;        theForm.__EVENTARGUMENT.value = eventArgument;        theForm.submit();    }}//]]></script><script src=http://www.mamicode.com/"/WebResource.axd?d=7rBHtJ45JbR-RqQvgJBw8MGU0yjF0Y8eCPeKjKegIA1UmCgOtKjFtVvtM_acXTD2xfTJ_QLoW863nzxY_nsgM7C0PVxPceXpm-dgA2HtAIg1&amp;t=634964947698517118" type="text/javascript"></script><script src=http://www.mamicode.com/"/ScriptResource.axd?d=MZnItr_mgm7EYfOPPPht9AT7Um2nRxQb6pYUUkhEyv8NIl5SnDN6YzDOpIeK3tnX1yAmUt7qyNpiW-vkR1Q1yKtcR-gkj8YZh2kNx-IIQc3W4sU07nAZS449Y2a0ZOZ3Y6Vpc4DsbfZjHapipPRC1g2&amp;t=150492e7" type="text/javascript"></script><script src=http://www.mamicode.com/"/ScriptResource.axd?d=sUoyqXNx8c16CZkWm0NeY6iRDp3EWQFaHzp1kkYltaaV4Pnaqdc-iIPQd_wPMjE9wCoVDLe_eLyi_8HmoGYg-9XmPGK9YySAmxyOIMXmRciLIGkz1gMz6DTD8vvQyB2HTJ1goL1W_APakgtbL8gSECOT8ej94Pcir-14c1LRJhOgvWQBRae4isxq3HQWe-TH0&amp;t=ffffffff940d030f" type="text/javascript"></script><script type="text/javascript">//<![CDATA[if (typeof(Sys) === undefined) throw new Error(ASP.NET Ajax client-side framework failed to load.);//]]></script><script src=http://www.mamicode.com/"/ScriptResource.axd?d=_9yXR1PnIaPZYsNLztXYtcbLdWnbNNgxTA8C46JU9FrSAzEI8-4_fGt5GZmOILzipWt92PwjjTWU9ki83Z_ZJNhWr_rDcWX-OYlzh0SPOoercNmiVSA4KRaIR6Rtu6qpy4JnFTjRRw1lA0eI36Oa9dsy6DrBtWbe5jbAdkr_gNMDgLrupyOs_j4LZhxSIjiz0&amp;t=ffffffff940d030f" type="text/javascript"></script><script src=http://www.mamicode.com/"/ScriptResource.axd?d=xrQaJLhFFqms61wbG2xNLkgikeXQhdzbOoWkISJHg5PiwNWOqxtsS-z9mekrYZOUHJDw70g07Qip81RJ7r3sSBBgWaGmGdsaCg-smixGHpUjiOzR1G8Ou8pi1ubXP_Wu3pg6_cMG_T7qN8ZnSnr2sCnwMoG4XjxBx7TLyOQdTm2U75w6YyGUx2pF7rbXbaiPJjhg81WiY1scESdhlUxABw2&amp;t=ffffffff940d030f" type="text/javascript"></script><script type="text/javascript">//<![CDATA[Sys.Services._AuthenticationService.DefaultWebServicePath = Authentication_JSON_AppService.axd;//]]></script><script src=http://www.mamicode.com/"WebUserInfo.asmx/jsdebug" type="text/javascript"></script>        <div id="top">        <div id="left">        </div>        <div id="right">            <div id="menu">                <a href=http://www.mamicode.com/"#Menu1_Menu1_SkipLink"><img alt="Skip Navigation Links" src=http://www.mamicode.com/"/WebResource.axd?d=aicODvREMk5ZT-xPT-u7ADwv4Ivs8FNWld0HGbVNncM64nbhWTKd2yJ4TZB69NTF0kXTrp1Gq0xdgmFuS0OZXODm73Ji4h4pC236uhy9QJE1&amp;t=634964947698517118" width="0" height="0" style="border-width:0px;" /></a><div class="menu" id="Menu1_Menu1">    <ul class="level1">        <li><a title="首页" class="level1 selected" href=http://www.mamicode.com/"../School/Default1.aspx">首页</a></li>        <li><a title="学校概况" class="level1" href=http://www.mamicode.com/"../School/Common.aspx?typeID=8" >学校概况</a>        </li>                <li><a title="校务公开"  href=http://www.mamicode.com/"../School/Common.aspx?typeID=9" >校务公开</a>        </li>                <li><a title="教师田园" href=http://www.mamicode.com/"../School/Common.aspx?typeID=10" >教师田园</a>        </li>        <li><a title="家长频道"  href=http://www.mamicode.com/"../School/Common.aspx?typeID=11" >家长频道</a>        </li>    </ul></div><a id="Menu1_Menu1_SkipLink"></a>            </div>            <div id="banner">                                <object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="699"                    height="181">                    <param name="movie" value=http://www.mamicode.com/"http://www.wyjxx.com/Templates/default/images/banner.swf" />                    <param name="quality" value=http://www.mamicode.com/"high" />                    <param name="wmode" value=http://www.mamicode.com/"opaque" />                    <param name="swfversion" value=http://www.mamicode.com/"8.0.35.0" />                    <!-- 此 param 标签提示使用 Flash Player 6.0 r65 和更高版本的用户下载最新版本的 Flash Player。如果您不想让用户看到该提示,请将其删除。 -->                    <param name="expressinstall" value=http://www.mamicode.com/"http://www.wyjxx.com/Scripts/expressInstall.swf" />                    <!-- 下一个对象标签用于非 IE 浏览器。所以使用 IECC 将其从 IE 隐藏。 -->                    <!--[if !IE]>-->                    <object type="application/x-shockwave-flash" data=http://www.mamicode.com/"http://www.wyjxx.com/Templates/default/images/banner.swf"                        width="699" height="181">                        <!--<![endif]-->                        <param name="quality" value=http://www.mamicode.com/"high" />                        <param name="wmode" value=http://www.mamicode.com/"opaque" />                        <param name="swfversion" value=http://www.mamicode.com/"8.0.35.0" />                        <param name="expressinstall" value=http://www.mamicode.com/"http://www.wyjxx.com/Scripts/expressInstall.swf" />                        <!-- 浏览器将以下替代内容显示给使用 Flash Player 6.0 和更低版本的用户。 -->                        <div>                            <h4>                                此页面上的内容需要较新版本的 Adobe Flash Player。</h4>                            <p>                                <a href=http://www.mamicode.com/"http://www.adobe.com/go/getflashplayer">                                    <img src=http://www.mamicode.com/"http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif"                                        alt="获取 Adobe Flash Player" width="112" height="33" /></a></p>                        </div>                        <!--[if !IE]>-->                    </object>                    <!--<![endif]-->                </object>            </div>        </div>    </div>    <div id="wrap">        <div style="width: 90%; height: 30px;">            <script type="text/javascript">//<![CDATA[Sys.WebForms.PageRequestManager._initialize(Login1$ScriptManager2, form1, [], [], [], 90, ‘‘);//]]></script><div id="Login1_loggedIn" style="text-align:center;display:none;" class="lg">    <span id="Login1_lbluser"></span>    <a href=http://www.mamicode.com/"Admin/mframe.aspx" id="Login1_info" style="padding-left: -25px;">        后台管理</a>    <a onclick="OnLogout();return false;" id="Login1_logout" tabindex="99" href=http://www.mamicode.com/"javascript:__doPostBack(&#39;Login1$logout&#39;,&#39;&#39;)" style="padding-left: 5px;">注销</a></div><form name="form1" method="post" action="Default1.aspx" id="form1" runat="server"><div id="Login1_login" class="lg" style="display:block;">    登录:用户名    <!--<input name="txtuser" id="txtuser" type="text" class="lginput" />-->    <asp:textbox id="tUserName" CssClass="lginput" runat="server" ></asp:textbox>    密码    <!--<input type="password" class="lginput" id="txtpassword" name="txtpassword" />-->    <asp:textbox id="tPassword"  CssClass="lginput" runat="server"  TextMode="Password"></asp:textbox>    <!--<input type="submit" name="Login1$btnLogin" value=http://www.mamicode.com/"" onclick="OnLogin();return false;" id="Login1_btnLogin" tabindex="2" class="lgbtn" />-->    <asp:button id="BLogin" runat="server" Text="登录" onclick="BLogin_Click" CssClass="lgbtn"></asp:button>    <asp:HyperLink ID="HyperLinkRegister" runat="server" NavigateUrl="Register.aspx" Visible="false">注册</asp:HyperLink>    <asp:label id="Message" runat="server" Width="208px" Height="16px"></asp:label></div></form><script type="text/javascript" language="javascript">    var username = $get("txtuser");    var password = $get("txtpassword");    var divlogin = $get("Login1_login"); //redo     var divlogged = $get("Login1_loggedIn");    var lbluser = $get("Login1_lbluser");    function OnLogin() {        Sys.Services.AuthenticationService.login(username.value, password.value, false, null, null, onLoginCompleted, OnLoginFailed, "User Context");        return false;    }    function onLoginCompleted(results, context, methodName) {        if (results == false) {            alert("请输入用户名或密码输入有误或用户已被锁定或禁用了!");        }        else {            ChangeUI(true);            username.value = "";            password.value = "";        }    }    function OnLoginFailed(results, context, methodName) {        alert("登录失败!");    }    function OnLogout() {        Sys.Services.AuthenticationService.logout(null, onLogoutComplete);        return false;    }    function onLogoutComplete() {        ChangeUI(false);    }    function ChangeUI(isLogged) {        if (isLogged == true) {            divlogin.style.display = "none";            divlogged.style.display = "";            GetRealName();        }        else {            divlogin.style.display = "";            divlogged.style.display = "none";            lbluser.innerHTML = "";        }    }    function GetRealName() {        BhEduSite.WebUserInfo.GetUserRealName(username.value, password.value, onGetUserRealNameCompleted, one rror, onTimeOut);    }    function onGetUserRealNameCompleted(result) {        if (result != null) {            lbluser.innerText = "欢迎你 " + result + " 老师!";        }    }    function one rror(result) {        alert("Error: " + result.get_message());    }    function onTimeOut()    { }</script>        </div>        <div style="width: 100%; height: auto">            <div id="side_left">                                <ul id="ico">                    <li><a href=http://www.mamicode.com/"../School/Calendar.aspx" target="_blank">                        <img src=http://www.mamicode.com/"../School/templates/default/images/ico_01.gif" alt="周行事历" /></a></li>                    <li><a href=http://www.mamicode.com/"../School/ClassCode.aspx" target="_blank">                        <img src=http://www.mamicode.com/"../School/templates/default/images/ico_02.gif" alt="班级行为规范" /></a></li>                                     <li><a href=http://www.mamicode.com/"mailto:pgg.1020@yahoo.com.cn">                        <img src=http://www.mamicode.com/"../School/Templates/default/images/ico_04.gif" alt="校长信箱" /></a></li>                </ul>            </div>            <div id="side_right">                <div id="left">                    <div class="tab" id="usual3">                        <ul>                            <li class="tabitem"><a href=http://www.mamicode.com/"#tabschool" onm ouseover="changedynamicnewslink();">校园动态</a></li>                            <li class="tabitem"><a href=http://www.mamicode.com/"#tabbackview" onm ouseover="changereviewnewslink();">精彩回眸</a></li>                        </ul>                                            </div>                    <div class="content" id="tabschool">                        <asp:Panel id="Panel1"  runat="server" style=" margin-top:38px;"></asp:Panel>                     </div>                    <div class="content" id="tabbackview">                        <asp:Panel id="Panel2"  runat="server" style=" margin-top:38px;"></asp:Panel>                    </div>                    <script type="text/javascript">                        jQuery("#usual3 ul").idTabs("!mouseover");                    </script>                </div>                <div id="right">                    <div class="ico_02">                    </div>                    <div class="title">校园公告</div>                                        <div class="content">                        <asp:Panel id="Panel3"  runat="server" style=" margin-top:38px;"></asp:Panel>                    </div>                </div>                <div id="left2">                    <div class="tab" id="usual1">                        <ul>                            <li class="tabitem"><a href=http://www.mamicode.com/"#tab1">学生天地</a></li>                            <li class="tabitem"><a href=http://www.mamicode.com/"#tab2">德育教学</a></li>                            <li class="tabitem"><a href=http://www.mamicode.com/"#tab3">科研师训</a></li>                            <li class="tabitem"><a href=http://www.mamicode.com/"#tab4">党团工会</a></li>                        </ul>                    </div>                                        <div id="tab1" class="content" style="margin-top: 5px">                        <asp:Panel id="Panel4"  runat="server" style=" margin-top:38px;"></asp:Panel>                    </div>                    <div id="tab2" class="content" style="margin-top: 5px">                        <asp:Panel id="Panel5"  runat="server" style=" margin-top:38px;"></asp:Panel>                    </div>                    <div id="tab3" class="content" style="margin-top: 5px">                        <asp:Panel id="Panel6"  runat="server" style=" margin-top:38px;"></asp:Panel>                    </div>                    <div id="tab4" class="content" style="margin-top: 5px">                        <asp:Panel id="Panel7"  runat="server" style=" margin-top:38px;"></asp:Panel>                    </div>                    <script type="text/javascript">                        jQuery("#usual1 ul").idTabs("!mouseover");                    </script>                </div>                <div id="right2">                                                        </div>            </div>            <div id="link">                <span style="color: #093; font-weight: bold; font-size: 14px;">友情链接:</span>                <select name="Links0$DDL_Links" id="Links0_DDL_Links" class="select" onChange="return load1(load1(this.value));">    <option value=http://www.mamicode.com/"省市区教育信息网站">省市区教育信息网站</option>    <option value=http://www.mamicode.com/"http://xhyx.xhedu.net">杭州西湖区教师进修学校</option>    <option value=http://www.mamicode.com/"http://dj.xhedu.net/xxfb/xjdj_index.asp?MainLanMuID=&amp;LoginMSG=&amp;UserLgID=">西湖教育党建网</option>    <option value=http://www.mamicode.com/"http://www.hzjsjy.com/cms/">杭州市教师教育网(杭州市中小学教师继续教育网)</option>    <option value=http://www.mamicode.com/"http://122.225.201.248/">浙江省中小学教师继续教育网</option>    <option value=http://www.mamicode.com/"http://www.moe.edu.cn/">中华人民共和国教育部</option>    <option value=http://www.mamicode.com/"http://tech.hzedu.net/">杭州教育技术网</option>    <option value=http://www.mamicode.com/"http://www.zjedu.gov.cn/gb/index1.html">浙江省教育厅网</option>    <option value=http://www.mamicode.com/"http://www.xhedu.org/">杭州市西湖区教育信息网</option>    <option value=http://www.mamicode.com/"http://www.hzedu.net/">杭州市教育城域网</option></select>                <select name="Links1$DDL_Links" id="Links1_DDL_Links" class="select" onChange="return load1(load1(this.value));">    <option value=http://www.mamicode.com/"中小学网站链接">中小学网站链接</option>    <option value=http://www.mamicode.com/"http://www.hzypxx.com/">袁浦小学</option>    <option value=http://www.mamicode.com/"http://www.ztxx.org/article/index.asp">转塘小学</option>    <option value=http://www.mamicode.com/"http://www.hzsdxx.com/">三墩镇中心小学</option>    <option value=http://www.mamicode.com/"http://www.hzlxxx.com/">留下小学</option>    <option value=http://www.mamicode.com/"http://www.gdyx.net/">古荡一小</option>    <option value=http://www.mamicode.com/"http://www.hzlcyhxx.com/">绿城育华小学</option>    <option value=http://www.mamicode.com/"http://www.xhschool.com/">西湖小学教育集团</option>    <option value=http://www.mamicode.com/"http://www.hzjlxx.com/">九莲小学</option>    <option value=http://www.mamicode.com/"http://www.qsedu.com/">求是教育集团</option>    <option value=http://www.mamicode.com/"http://www.hzxjxx.com/sites/main/default.aspx">学军小学</option>    <option value=http://www.mamicode.com/"http://hzcyex.vicp.net/">翠苑第二小学</option>    <option value=http://www.mamicode.com/"http://www.hzcyyx.com/">翠苑第一小学</option>    <option value=http://www.mamicode.com/"http://www.sflxx.com/">省府路小学</option>    <option value=http://www.mamicode.com/"http://www.hzwsjyjt.com/">文三教育集团</option>    <option value=http://www.mamicode.com/"http://www.hzxzxx.cn/">行知小学</option></select>                <select name="Links4$DDL_Links" id="Links4_DDL_Links" class="select" onChange="return load1(load1(this.value));">    <option value=http://www.mamicode.com/"教育教学资源网站">教育教学资源网站</option>    <option value=http://www.mamicode.com/"http://education.smartreseller.cn">SMART中国教育网</option>    <option value=http://www.mamicode.com/"http://edu.julong.com.cn">巨龙科教资源网</option>    <option value=http://www.mamicode.com/"http://www.910edu.com">鸿合资源</option>    <option value=http://www.mamicode.com/"http://www.hzjys.net/">杭州教研网</option>    <option value=http://www.mamicode.com/"http://www.zjer.cn/main.jsp">浙江教育资源网</option>    <option value=http://www.mamicode.com/"http://www.cbern.gov.cn/derscn/portal/index.html">国家基础教育资源网</option>    <option value=http://www.mamicode.com/"http://www.chinaiwb.net/">中国白板网</option></select>            </div>        </div>        <div class="footer">        </div>    </div>        <script type=text/javascript>new Sys.WebForms.Menu({ element: Menu1_Menu1, disappearAfter: 500, orientation: horizontal, tabIndex: 0, disabled: false });</script></body></html>

  //Default1.aspx.cs

  

using System;using System.Collections;using System.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Xml.Linq;using System.Data.SqlClient;public partial class Default1 : System.Web.UI.Page{    protected void Page_Load(object sender, EventArgs e)    {        LoadXiaoYuanDongTai();        LoadJingCaiHuiMou();        LoadXiaoYuanGongGao();        LoadXueShengTianDi();        LoadDeYuJiaoXue();        LoadKeYanShiXun();        LoadDuanTuanGongHui();    }    /// <summary>    /// 加载校园动态    /// </summary>    protected void LoadXiaoYuanDongTai()    {        System.Data.SqlClient.SqlDataReader dreader;        HyperLink[] Link = new HyperLink[12];        int i = 0;        String strConn = ConfigurationSettings.AppSettings["SDataBase"];        // 连接到eForum数据库        SqlConnection cn = new SqlConnection(strConn);        // 打开连接        cn.Open();        // 构造SQL语句,该语句在RegUsers表中检查昵称和密码是否正确        String strSQL = "SELECT TOP 10 * FROM News where typeID=1";        // 创建Command对象        SqlCommand cmdSave = new SqlCommand(strSQL, cn);        // 执行ExecuteReader()方法          dreader = cmdSave.ExecuteReader();        while (dreader.Read())        {            Link[i] = new HyperLink();            Link[i].Text = dreader["Title"].ToString();            Link[i].NavigateUrl = "View.aspx?id=" + dreader["id"].ToString();            Link[i].Target = "_black";            this.Panel1.Controls.Add(Link[i]);            this.Panel1.Controls.Add(new LiteralControl("<br/>"));            i++;        }        dreader.Close();        cn.Close();    }    /// <summary>    /// 加载精彩回眸    /// </summary>    protected void LoadJingCaiHuiMou()    {        System.Data.SqlClient.SqlDataReader dreader;        HyperLink[] Link = new HyperLink[12];        int i = 0;        String strConn = ConfigurationSettings.AppSettings["SDataBase"];        // 连接到eForum数据库        SqlConnection cn = new SqlConnection(strConn);        // 打开连接        cn.Open();        // 构造SQL语句,该语句在RegUsers表中检查昵称和密码是否正确        String strSQL = "SELECT TOP 10 * FROM News where typeID=2";        // 创建Command对象        SqlCommand cmdSave = new SqlCommand(strSQL, cn);        // 执行ExecuteReader()方法          dreader = cmdSave.ExecuteReader();        while (dreader.Read())        {            Link[i] = new HyperLink();            Link[i].Text = dreader["Title"].ToString();            Link[i].NavigateUrl = "View.aspx?id=" + dreader["id"].ToString();            Link[i].Target = "_black";            this.Panel2.Controls.Add(Link[i]);            this.Panel2.Controls.Add(new LiteralControl("<br/>"));            i++;        }        dreader.Close();        cn.Close();    }    /// <summary>    /// 加载校园公告    /// </summary>    protected void LoadXiaoYuanGongGao()    {        System.Data.SqlClient.SqlDataReader dreader;        HyperLink[] Link = new HyperLink[12];        int i = 0;        String strConn = ConfigurationSettings.AppSettings["SDataBase"];        // 连接到eForum数据库        SqlConnection cn = new SqlConnection(strConn);        // 打开连接        cn.Open();        // 构造SQL语句,该语句在RegUsers表中检查昵称和密码是否正确        String strSQL = "SELECT TOP 10 * FROM News where typeID=3";        // 创建Command对象        SqlCommand cmdSave = new SqlCommand(strSQL, cn);        // 执行ExecuteReader()方法          dreader = cmdSave.ExecuteReader();        while (dreader.Read())        {            Link[i] = new HyperLink();            Link[i].Text = dreader["Title"].ToString();            Link[i].NavigateUrl = "View.aspx?id=" + dreader["id"].ToString();            Link[i].Target = "_black";            this.Panel3.Controls.Add(Link[i]);            this.Panel3.Controls.Add(new LiteralControl("<br/>"));            i++;        }        dreader.Close();        cn.Close();    }    /// <summary>    /// 加载学生天地    /// </summary>    protected void LoadXueShengTianDi()    {        System.Data.SqlClient.SqlDataReader dreader;        HyperLink[] Link = new HyperLink[12];        int i = 0;        String strConn = ConfigurationSettings.AppSettings["SDataBase"];        // 连接到eForum数据库        SqlConnection cn = new SqlConnection(strConn);        // 打开连接        cn.Open();        // 构造SQL语句,该语句在RegUsers表中检查昵称和密码是否正确        String strSQL = "SELECT TOP 10 * FROM News where typeID=4";        // 创建Command对象        SqlCommand cmdSave = new SqlCommand(strSQL, cn);        // 执行ExecuteReader()方法          dreader = cmdSave.ExecuteReader();        while (dreader.Read())        {            Link[i] = new HyperLink();            Link[i].Text = dreader["Title"].ToString();            Link[i].NavigateUrl = "View.aspx?id=" + dreader["id"].ToString();            Link[i].Target = "_black";            this.Panel4.Controls.Add(Link[i]);            this.Panel4.Controls.Add(new LiteralControl("<br/>"));            i++;        }        dreader.Close();        cn.Close();    }    /// <summary>    /// 加载德育教学    /// </summary>    protected void LoadDeYuJiaoXue()    {        System.Data.SqlClient.SqlDataReader dreader;        HyperLink[] Link = new HyperLink[12];        int i = 0;        String strConn = ConfigurationSettings.AppSettings["SDataBase"];        // 连接到eForum数据库        SqlConnection cn = new SqlConnection(strConn);        // 打开连接        cn.Open();        // 构造SQL语句,该语句在RegUsers表中检查昵称和密码是否正确        String strSQL = "SELECT TOP 10 * FROM News where typeID=5";        // 创建Command对象        SqlCommand cmdSave = new SqlCommand(strSQL, cn);        // 执行ExecuteReader()方法          dreader = cmdSave.ExecuteReader();        while (dreader.Read())        {            Link[i] = new HyperLink();            Link[i].Text = dreader["Title"].ToString();            Link[i].NavigateUrl = "View.aspx?id=" + dreader["id"].ToString();            Link[i].Target = "_black";            this.Panel5.Controls.Add(Link[i]);            this.Panel5.Controls.Add(new LiteralControl("<br/>"));            i++;        }        dreader.Close();        cn.Close();    }    /// <summary>    /// 加载科研师训    /// </summary>    protected void LoadKeYanShiXun()    {        System.Data.SqlClient.SqlDataReader dreader;        HyperLink[] Link = new HyperLink[12];        int i = 0;        String strConn = ConfigurationSettings.AppSettings["SDataBase"];        // 连接到eForum数据库        SqlConnection cn = new SqlConnection(strConn);        // 打开连接        cn.Open();        // 构造SQL语句,该语句在RegUsers表中检查昵称和密码是否正确        String strSQL = "SELECT TOP 10 * FROM News where typeID=6";        // 创建Command对象        SqlCommand cmdSave = new SqlCommand(strSQL, cn);        // 执行ExecuteReader()方法          dreader = cmdSave.ExecuteReader();        while (dreader.Read())        {            Link[i] = new HyperLink();            Link[i].Text = dreader["Title"].ToString();            Link[i].NavigateUrl = "View.aspx?id=" + dreader["id"].ToString();            Link[i].Target = "_black";            this.Panel6.Controls.Add(Link[i]);            this.Panel6.Controls.Add(new LiteralControl("<br/>"));            i++;        }        dreader.Close();        cn.Close();    }    /// <summary>    /// 加载党团工会    /// </summary>    protected void LoadDuanTuanGongHui()    {        System.Data.SqlClient.SqlDataReader dreader;        HyperLink[] Link = new HyperLink[12];        int i = 0;        String strConn = ConfigurationSettings.AppSettings["SDataBase"];        // 连接到eForum数据库        SqlConnection cn = new SqlConnection(strConn);        // 打开连接        cn.Open();        // 构造SQL语句,该语句在RegUsers表中检查昵称和密码是否正确        String strSQL = "SELECT TOP 10 * FROM News where typeID=7";        // 创建Command对象        SqlCommand cmdSave = new SqlCommand(strSQL, cn);        // 执行ExecuteReader()方法          dreader = cmdSave.ExecuteReader();        while (dreader.Read())        {            Link[i] = new HyperLink();            Link[i].Text = dreader["Title"].ToString();            Link[i].NavigateUrl = "View.aspx?id=" + dreader["id"].ToString();            Link[i].Target = "_black";            this.Panel7.Controls.Add(Link[i]);            this.Panel7.Controls.Add(new LiteralControl("<br/>"));            i++;        }        dreader.Close();        cn.Close();    }    protected void BLogin_Click(object sender, System.EventArgs e)    {        if (Page.IsValid)        {            String strConn = ConfigurationSettings.AppSettings["SDataBase"];            // 连接到eForum数据库            SqlConnection cn = new SqlConnection(strConn);            // 打开连接            cn.Open();            // 构造SQL语句,该语句在RegUsers表中检查昵称和密码是否正确            //String strSQL="select * from Teacher where Name=‘"+            //    tUserName.Text+"‘ and Password=‘"+tPassword.Text+"‘";            String strSQL = " select Name,Gradeid,Class,Worker from Teacher where Name=‘" + tUserName.Text + "‘ and password=‘" + tPassword.Text + "";            // 创建Command对象            SqlCommand cm = new SqlCommand(strSQL, cn);            // 执行ExecuteReader()方法              SqlDataReader dr = cm.ExecuteReader();            Session["UserName"] = "";            Session["Gradeid"] = "";            Session["Class"] = "";            if (dr.Read())            {                Message.Text = "";                // 保存当前用户的昵称                Session["UserName"] = dr["Name"];                Session["Gradeid"] = dr["Gradeid"];                Session["Class"] = dr["Class"];                Session["Worker"] = dr["Worker"];                dr.Close();                //strSQL = "INSERT INTO RunLog(LogTime,Name,Worker,Type) Values(‘" +  System.DateTime.Now.ToShortDateString() + "  " + System.DateTime.Now.ToLongTimeString() + "‘, ‘" + Session["UserName"].ToString() +"‘, ‘" + Session["Worker"].ToString() + "‘, ‘登录‘)";                // 创建Command对象                //cm=new SqlCommand(strSQL,cn);                // 执行ExecuteReader()方法                  //dr=cm.ExecuteReader();                //dr.Close();                //cn.Close();                // 进入主画面                Response.Redirect("Teacher.aspx");            }            else            {                cn.Close();                Message.Text = "用户/密码不对,请重新注册";                //Response.Redirect("Student.aspx");            }            // 关闭连接        }    }}

 

二 、登录成功页面

  //Teacher.aspx

  

<%@ Page language="c#" Inherits="School.Teacher" CodeFile="Teacher.aspx.cs" %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" ><HTML>    <HEAD>        <title>教师档案信息管理!</title><link href=http://www.mamicode.com/"css/cww.css" rel="stylesheet" type="text/css" />        <STYLE>BODY { SCROLLBAR-FACE-COLOR: #24b4fc; SCROLLBAR-HIGHLIGHT-COLOR: #fcfcfc; SCROLLBAR-3DLIGHT-COLOR: #d8d8fc; SCROLLBAR-BASE-COLOR: #24fcfc }        </STYLE>        <style type="text/css">A:hover { COLOR: #d15b0c }    A:link { TEXT-DECORATION: none }    A:visited { TEXT-DECORATION: none }    A:active { TEXT-DECORATION: none }        </style>        <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">        <meta content="C#" name="CODE_LANGUAGE">        <meta content="JavaScript" name="vs_defaultClientScript">        <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">    </HEAD>    <body style="background-image:url(‘image/19.jpg‘);">        <form id="Form1" method="post" runat="server">            <FONT face="宋体">                <asp:label id="Label2" style="Z-INDEX: 104; LEFT: 752px; POSITION: absolute; TOP: 448px" runat="server"                    Width="48px" Height="24px" Visible="false">班级:</asp:label>                <asp:Label id="Label15" style="Z-INDEX: 137; LEFT: 440px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:Label>                <asp:Label id="Label14" style="Z-INDEX: 136; LEFT: 504px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:Label>                <asp:Label id="Label13" style="Z-INDEX: 135; LEFT: 632px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:Label>                <asp:Label id="Label12" style="Z-INDEX: 134; LEFT: 568px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:Label>                <asp:Label id="Label11" style="Z-INDEX: 133; LEFT: 824px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:Label>                <asp:Label id="Label10" style="Z-INDEX: 132; LEFT: 760px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:Label>                <asp:Label id="Label9" style="Z-INDEX: 131; LEFT: 696px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:Label>                <asp:Label id="Label8" style="Z-INDEX: 130; LEFT: 376px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:Label>                <asp:Label id="Label7" style="Z-INDEX: 129; LEFT: 312px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:Label>                <asp:Label id="Label6" style="Z-INDEX: 128; LEFT: 248px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:Label>                <asp:HyperLink id="HyperLink13" style="Z-INDEX: 127; LEFT: 512px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  NavigateUrl="Remark.aspx" Font-Size="Smaller">教师评语</asp:HyperLink>                <asp:HyperLink id="HyperLink12" style="Z-INDEX: 126; LEFT: 832px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  NavigateUrl="Help.aspx" Font-Size="Smaller">帮助说明</asp:HyperLink>                <asp:HyperLink id="HyperLink11" style="Z-INDEX: 125; LEFT: 768px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  NavigateUrl="Sysexit.aspx" Font-Size="Smaller">退出系统</asp:HyperLink>                <asp:HyperLink id="HyperLink10" style="Z-INDEX: 124; LEFT: 704px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  NavigateUrl="Runlog.aspx" Font-Size="Smaller">系统日志</asp:HyperLink>                <asp:HyperLink id="HyperLink9" style="Z-INDEX: 123; LEFT: 576px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  NavigateUrl="Query.aspx" Font-Size="Smaller">同学互评</asp:HyperLink>                <asp:HyperLink id="HyperLink8" style="Z-INDEX: 122; LEFT: 640px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  NavigateUrl="Exchange.aspx" Font-Size="Smaller">交流频道</asp:HyperLink>                <asp:HyperLink id="HyperLink7" style="Z-INDEX: 121; LEFT: 448px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  NavigateUrl="Smssend.aspx" Font-Size="Smaller">家长寄语</asp:HyperLink>                <asp:HyperLink id="HyperLink6" style="Z-INDEX: 120; LEFT: 384px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  NavigateUrl="Result.aspx" Font-Size="Smaller">成绩档案</asp:HyperLink>                <asp:HyperLink id="HyperLink5" style="Z-INDEX: 119; LEFT: 320px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  NavigateUrl="Class.aspx" Font-Size="Smaller">班级档案</asp:HyperLink>                <asp:HyperLink id="HyperLink4" style="Z-INDEX: 118; LEFT: 256px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  NavigateUrl="Grade.aspx" Font-Size="Smaller">年级档案</asp:HyperLink>                <asp:HyperLink id="HyperLink3" style="Z-INDEX: 117; LEFT: 192px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  NavigateUrl="Student.aspx" Font-Size="Smaller">学生档案</asp:HyperLink>                <asp:Label id="Label5" style="Z-INDEX: 116; LEFT: 184px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:Label>                <asp:HyperLink id="HyperLink2" style="Z-INDEX: 113; LEFT: 64px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  NavigateUrl="Default1.aspx" Font-Size="Smaller">系统首页</asp:HyperLink><asp:button id="Button3" style="Z-INDEX: 112; LEFT: 360px; POSITION: absolute; TOP: 448px" runat="server"                    Width="112px" Text="修改" onclick="Button3_Click"></asp:button><asp:label id="Label4" style="Z-INDEX: 109; LEFT: 64px; POSITION: absolute; TOP: 448px" runat="server"                    Width="48px" Height="24px">姓名:</asp:label><asp:dropdownlist id="DropDownList1" style="Z-INDEX: 108; LEFT: 104px; POSITION: absolute; TOP: 448px"                    runat="server" Width="112px" Height="24px"></asp:dropdownlist><asp:dropdownlist id="DGrade" style="Z-INDEX: 101; LEFT: 648px; POSITION: absolute; TOP: 448px" runat="server"                    Width="93px" Height="24px" Enabled="False" AutoPostBack="True" onselectedindexchanged="DGrade_SelectedIndexChanged"></asp:dropdownlist>                    <asp:dropdownlist Visible="false" id="DClass" style="Z-INDEX: 102; LEFT: 792px; POSITION: absolute; TOP: 448px" runat="server"                    Width="94px" Height="24px" Enabled="False" AutoPostBack="True" onselectedindexchanged="DClass_SelectedIndexChanged"></asp:dropdownlist>                    <asp:label id="Label1" style="Z-INDEX: 103; LEFT: 608px; POSITION: absolute; TOP: 448px" runat="server"                    Width="48px" Height="24px">年级:</asp:label><asp:linkbutton id="btnPrevious" style="Z-INDEX: 105; LEFT: 64px; POSITION: absolute; TOP: 424px"                    runat="server" Width="64px" onclick="btnPrevious_Click">前一页</asp:linkbutton><asp:linkbutton id="btnNext" style="Z-INDEX: 106; LEFT: 136px; POSITION: absolute; TOP: 424px" runat="server"                    Width="56px" onclick="btnNext_Click">下一页</asp:linkbutton><asp:datagrid id="DataGrid1" style="Z-INDEX: 107; LEFT: 64px; POSITION: absolute; TOP: 160px"                    runat="server" Height="32px" Width="816px" CellPadding="2" AutoGenerateColumns="False" AllowCustomPaging="True" AllowPaging="True">                    <HeaderStyle ForeColor="#FFFFCC" BackColor="#CC6600"></HeaderStyle>                    <Columns>                        <asp:BoundColumn DataField="id" HeaderText="序号"></asp:BoundColumn>                        <asp:BoundColumn DataField="Name" HeaderText="姓名"></asp:BoundColumn>                        <asp:BoundColumn DataField="Sex" HeaderText="性别"></asp:BoundColumn>                        <asp:BoundColumn DataField="Birthday" HeaderText="生日"></asp:BoundColumn>                        <asp:BoundColumn DataField="Diploma" HeaderText="职称"></asp:BoundColumn>                        <asp:BoundColumn DataField="Worker" HeaderText="职务" Visible="false" ></asp:BoundColumn>                        <asp:BoundColumn DataField="Grade" HeaderText="年级"></asp:BoundColumn>                        <asp:BoundColumn DataField="Class" HeaderText="班级" Visible="false"  ></asp:BoundColumn>                        <asp:BoundColumn DataField="Course" HeaderText="课目"></asp:BoundColumn>                        <asp:BoundColumn DataField="Tele" HeaderText="电话"></asp:BoundColumn>                        <asp:BoundColumn DataField="Handset" HeaderText="手机"></asp:BoundColumn>                    </Columns>                    <PagerStyle Visible="False"></PagerStyle>                </asp:datagrid><asp:button id="Button1"                 style="Z-INDEX: 110; LEFT: 232px; POSITION: absolute; TOP: 448px; right: 951px;" runat="server"                    Width="112px" Text="增加" onclick="Button1_Click"></asp:button>                <asp:HyperLink id="HyperLink1" style="Z-INDEX: 114; LEFT: 128px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px" NavigateUrl="Teacher.aspx"  Font-Size="Smaller"                    Enabled="False" CssClass="curstyle" >教师档案</asp:HyperLink>                <asp:Label id="Label3" style="Z-INDEX: 115; LEFT: 120px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:Label>                <asp:Image id="Image1" style="Z-INDEX: 138; LEFT: 64px; POSITION: absolute; TOP: 32px" runat="server"                    Height="120px" Width="816px" ImageUrl="image\top.JPG"></asp:Image>                <asp:Label id="Label16" style="Z-INDEX: 139; LEFT: 232px; POSITION: absolute; TOP: 504px" runat="server"                    Height="10px" Width="448px"></asp:Label>                <asp:Label id="Label17" style="Z-INDEX: 140; LEFT: 208px; POSITION: absolute; TOP: 528px" runat="server"                    Height="3px" Width="488px"></asp:Label></FONT></form>    </body></HTML>

  //Teacher.aspx.cs

  

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 System.Configuration;            //配置类using System.Data.SqlClient;        //数据库ADO类namespace School{    /// <summary>    /// Index 的摘要说明。    /// </summary>    public partial class Teacher : System.Web.UI.Page    {        private int CurrentPage;        private ListItem item;            protected void Page_Load(object sender, System.EventArgs e)        {            // 在此处放置用户代码以初始化页面            System.Data.SqlClient.SqlDataReader dreader;            if (Session["UserName"] == null || Session["UserName"].ToString() == "")            {                Response.Write("<hr><p><center>");                Response.Write("<h4>没有登录!点击");                Response.Write("<a href=http://www.mamicode.com/Default1.aspx>这儿");                Response.Write("进行登录</h4></center><p><hr>");                Response.End();            }                                    if (!Page.IsPostBack)            {                String strConn=ConfigurationSettings.AppSettings["SDataBase"];                // 连接到eForum数据库                SqlConnection cn=new SqlConnection(strConn);                // 打开连接                cn.Open();                // 构造SQL语句,该语句在RegUsers表中检查昵称和密码是否正确                String strSQL="SELECT TOP 10 * FROM Grade";                // 创建Command对象                SqlCommand cmdSave=new SqlCommand(strSQL,cn);                // 执行ExecuteReader()方法                  dreader=cmdSave.ExecuteReader();                DGrade.Items.Add(new ListItem("请选择","-1"));                while (dreader.Read())                 {                    DGrade.Items.Add(new ListItem(dreader["Grade"].ToString(),dreader["id"].ToString()));                }                //item = DGrade.Items.FindByValue(Session["Gradeid"].ToString());                //item.Selected = true;                dreader.Close();                /*                strSQL = "SELECT TOP 10 * FROM Class";                cmdSave=new SqlCommand(strSQL,cn);                dreader=cmdSave.ExecuteReader();                while (dreader.Read())                 {                    DClass.Items.Add(new ListItem(dreader["Class"].ToString(),dreader["id"].ToString()));                }                item = DClass.Items.FindByValue(Session["Class"].ToString());                item.Selected = true;                dreader.Close();                 */                DGrade.Enabled = true;                DClass.Enabled = true;                            if (Session["Worker"].ToString() == "1" )                {                    Button1.Enabled = true;                    Button3.Enabled = true;                            }                else                {                    Button1.Enabled = false;                    Button1.Visible = false;                    Button3.Visible = false;                }                CurrentPage = 0;                strSQL = " SELECT TOP 10 Teacher.id,Teacher.Name,Teacher.Sex,Teacher.Birthday,Teacher.Diploma,Teacher.Worker,Grade.Grade,Teacher.Class,Teacher.Course,Teacher.Tele,Teacher.Handset  FROM Teacher left join Grade on Grade.id=Teacher.Gradeid where Worker=‘1‘  ORDER BY Teacher.id asc ";                                cmdSave=new SqlCommand(strSQL,cn);                FillGrid(cmdSave);                FillList(cmdSave);                cn.Close();            }        }        private void FillGrid(System.Data.SqlClient.SqlCommand currentSqlCommand)        {            System.Data.SqlClient.SqlDataReader dr;            dr = currentSqlCommand.ExecuteReader();            DataGrid1.DataSource = dr;            DataGrid1.DataBind();            if (dr.HasRows)        //当数据记录时            {                                ViewState["CurrentPage"] = CurrentPage;                ViewState[CurrentPage.ToString()] = DataGrid1.Items[0].Cells[0].Text;                                if (DataGrid1.Items.Count < DataGrid1.PageSize)                {                    btnNext.Enabled = false;                    btnPrevious.Enabled = true;                }            }            else            {                btnNext.Enabled = false;                btnPrevious.Enabled = false;            }            dr.Close();        }        private void FillList(System.Data.SqlClient.SqlCommand currentSqlCommand)        {            System.Data.SqlClient.SqlDataReader dr;            dr = currentSqlCommand.ExecuteReader();            if (dr.HasRows)        //当数据记录时            {                DropDownList1.Items.Clear();                while (dr.Read())                {                    DropDownList1.Items.Add(new ListItem(dr["Name"].ToString(),dr["id"].ToString()));                }                                            }            dr.Close();                                }        #region Web 窗体设计器生成的代码        override protected void OnInit(EventArgs e)        {            //            // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。            //            InitializeComponent();            base.OnInit(e);        }                /// <summary>        /// 设计器支持所需的方法 - 不要使用代码编辑器修改        /// 此方法的内容。        /// </summary>        private void InitializeComponent()        {            }        #endregion        protected void btnPrevious_Click(object sender, System.EventArgs e)    //向上翻页        {            btnNext.Enabled = true;            CurrentPage = (int)(ViewState["CurrentPage"]);            CurrentPage--;            if (CurrentPage >= 0)             {                string firstid;                firstid = (string)(ViewState[CurrentPage.ToString()]);                String strConn=ConfigurationSettings.AppSettings["SDataBase"];                SqlConnection cn=new SqlConnection(strConn);                cn.Open();                string strSQL = " SELECT TOP 10 Teacher.id,Teacher.Name,Teacher.Sex,Teacher.Birthday,Teacher.Diploma,Teacher.Worker,Grade.Grade,Teacher.Class,Teacher.Course,Teacher.Tele,Teacher.Handset  FROM Teacher left join Grade on Grade.id=Teacher.Gradeid where Worker=‘1‘ "                    +"  and (Teacher.id >= ‘" + firstid + "‘) "                    +" ORDER BY Teacher.id asc ";                SqlCommand cmdSave=new SqlCommand(strSQL,cn);                FillGrid(cmdSave);                FillList(cmdSave);                cn.Close();            }            else            {                btnPrevious.Enabled = false;                btnNext.Enabled = true;            }        }        protected void btnNext_Click(object sender, System.EventArgs e)        //向下翻页        {            CurrentPage = (int)(ViewState["CurrentPage"]);            CurrentPage++;            if (DataGrid1.Items.Count >= DataGrid1.PageSize)            {                string lastid = DataGrid1.Items[9].Cells[0].Text;                String strConn=ConfigurationSettings.AppSettings["SDataBase"];                SqlConnection cn=new SqlConnection(strConn);                cn.Open();                string strSQL = " SELECT TOP 10 Teacher.id,Teacher.Name,Teacher.Sex,Teacher.Birthday,Teacher.Diploma,Teacher.Worker,Grade.Grade,Teacher.Class,Teacher.Course,Teacher.Tele,Teacher.Handset  FROM Teacher left join Grade on Grade.id=Teacher.Gradeid where Worker=‘1‘ "                    + " and  (Teacher.id >= ‘" + lastid + "‘) "                    + " ORDER BY Teacher.id asc ";                SqlCommand cmdSave=new SqlCommand(strSQL,cn);                FillGrid(cmdSave);                FillList(cmdSave);                cn.Close();            }            else            {                btnNext.Enabled = false;                btnPrevious.Enabled = true;            }        }        private void LinkButton10_Click(object sender, System.EventArgs e)        {            Session["UserName"]="";            LiteralControl lc = new LiteralControl("<script>window.close();</script>");            Page.Controls.Add(lc);        }        protected void InitSession()        {            if (DropDownList1.SelectedItem != null)            {                Session["UCode"] = DropDownList1.SelectedItem.Value;            }            else             {                Session["UCode"] = "";            }        }        protected void Button1_Click(object sender, System.EventArgs e)        {    //OperationType            Session["OperationType"] = "Add";            InitSession();            Response.Redirect("TeacherAdd.aspx");        }                protected void Button3_Click(object sender, System.EventArgs e)        {                        Session["OperationType"] = "Change";            InitSession();                    Response.Redirect("TeacherAdd.aspx");        }        protected void Button2_Click(object sender, System.EventArgs e)        {            if (DropDownList1.SelectedItem.Text != Session["UserName"].ToString() )            {                String strConn=ConfigurationSettings.AppSettings["SDataBase"];                SqlConnection cn=new SqlConnection(strConn);                cn.Open();                String strSQL = "DELETE FROM  Teacher WHERE  Name = ‘" + DropDownList1.SelectedItem.Text + "";                SqlCommand cmdSave=new SqlCommand(strSQL,cn);                System.Data.SqlClient.SqlDataReader dr;                dr = cmdSave.ExecuteReader();                dr.Close();                cn.Close();                Response.Redirect("Teacher.aspx");        //做刷新窗口使用            }            else            {                ShowClientMessage("不能删除自己!");                                    }                }        public void ShowClientMessage(String msg)        {                        String s = String.Format(                "<script language=javascript>var truthBeTold = alert(‘{0}‘);  </script>", msg);                    //alert confirm prompt             //#if(NET_2_0)            //    ClientScript.RegisterStartupScript(this.GetType(), "FFBE5E5B-1D3D-4727-AA6A-057461409FDF", s);            //#elif(NET_1_1)                this.RegisterStartupScript("FFBE5E5B-1D3D-4727-AA6A-057461409FDE", s);            //#endif        }        public void ReturnWindow(String msg)        {                        String s = String.Format(                "<script language=javascript>window.location.href(‘{0}‘);</script>", msg);            //#if(NET_2_0)            //    ClientScript.RegisterStartupScript(this.GetType(), "FFBE5E5B-1D3D-4727-AA6A-057461409FDF", s);            //#elif(NET_1_1)            this.RegisterStartupScript("FFBE5E5B-1D3E-4727-AA6A-057461409FDE", s);            //#endif                    }        protected void DGrade_SelectedIndexChanged(object sender, System.EventArgs e)        {            String strConn=ConfigurationSettings.AppSettings["SDataBase"];            SqlConnection cn=new SqlConnection(strConn);            cn.Open();            string strSQL = " SELECT TOP 10 Teacher.id,Teacher.Name,Teacher.Sex,Teacher.Birthday,Teacher.Diploma,Teacher.Worker,Grade.Grade,Teacher.Class,Teacher.Course,Teacher.Tele,Teacher.Handset  FROM Teacher left join Grade on Grade.id=Teacher.Gradeid where Worker=‘1‘ "                + " and Teacher.Gradeid=‘" + DGrade.SelectedValue + ""            + " ORDER BY Teacher.id asc ";            SqlCommand cmdSave=new SqlCommand(strSQL,cn);            FillGrid(cmdSave);            FillList(cmdSave);            cn.Close();            //btnNext.Enabled = true;            //btnPrevious.Enabled = true;        }        protected void DClass_SelectedIndexChanged(object sender, System.EventArgs e)        {            String strConn=ConfigurationSettings.AppSettings["SDataBase"];            SqlConnection cn=new SqlConnection(strConn);            cn.Open();            string strSQL = " SELECT TOP 10 Teacher.id,Teacher.Name,Teacher.Sex,Teacher.Birthday,Teacher.Diploma,Teacher.Worker,Grade.Grade,Teacher.Class,Teacher.Course,Teacher.Tele,Teacher.Handset  FROM Teacher left join Grade on Grade.id=Teacher.Gradeid where Worker=‘1‘ "                + " and Teacher.Gradeid=‘" + DClass.SelectedValue + ""            +" ORDER BY Teacher.id asc ";            SqlCommand cmdSave=new SqlCommand(strSQL,cn);            FillGrid(cmdSave);            FillList(cmdSave);            cn.Close();            //btnNext.Enabled = true;            //btnPrevious.Enabled = true;        }            }}

三、教师评语

  //Remark.aspx

<%@ Page language="c#" Inherits="School.Remark" CodeFile="Remark.aspx.cs" %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" ><HTML>    <HEAD>        <title>教师档案信息管理!</title><link href=http://www.mamicode.com/"css/cww.css" rel="stylesheet" type="text/css" />        <STYLE>BODY { SCROLLBAR-FACE-COLOR: #24b4fc; SCROLLBAR-HIGHLIGHT-COLOR: #fcfcfc; SCROLLBAR-3DLIGHT-COLOR: #d8d8fc; SCROLLBAR-BASE-COLOR: #24fcfc }        </STYLE>        <style type="text/css">A:hover { COLOR: #d15b0c }    A:link { TEXT-DECORATION: none }    A:visited { TEXT-DECORATION: none }    A:active { TEXT-DECORATION: none }        </style>        <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">        <meta content="C#" name="CODE_LANGUAGE">        <meta content="JavaScript" name="vs_defaultClientScript">        <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">    </HEAD>    <body style="background-image:url(‘image/15.jpg‘);">        <form id="Form1" method="post" runat="server">            <FONT face="宋体">                <asp:label id="Label15" style="Z-INDEX: 137; LEFT: 440px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px" Font-Size="Smaller" >|</asp:label><asp:label id="Label14" style="Z-INDEX: 136; LEFT: 504px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px" Font-Size="Smaller" >|</asp:label><asp:label id="Label13" style="Z-INDEX: 135; LEFT: 632px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px" Font-Size="Smaller" >|</asp:label><asp:label id="Label12" style="Z-INDEX: 134; LEFT: 568px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px" Font-Size="Smaller" >|</asp:label><asp:label id="Label11" style="Z-INDEX: 133; LEFT: 824px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px" Font-Size="Smaller" >|</asp:label><asp:label id="Label10" style="Z-INDEX: 132; LEFT: 760px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px" Font-Size="Smaller" >|</asp:label><asp:label id="Label9" style="Z-INDEX: 131; LEFT: 696px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px" Font-Size="Smaller" >|</asp:label><asp:label id="Label8" style="Z-INDEX: 130; LEFT: 376px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px" Font-Size="Smaller" >|</asp:label><asp:label id="Label7" style="Z-INDEX: 129; LEFT: 312px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px" Font-Size="Smaller" >|</asp:label><asp:label id="Label6" style="Z-INDEX: 128; LEFT: 248px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px" Font-Size="Smaller" >|</asp:label><asp:hyperlink id="HyperLink13" style="Z-INDEX: 127; LEFT: 512px; POSITION: absolute; TOP: 16px"                    runat="server" Height="8px" Width="56px" Font-Size="Smaller"  NavigateUrl="Remark.aspx" Enabled="False" CssClass="curstyle" >教师评语</asp:hyperlink><asp:hyperlink id="HyperLink12" style="Z-INDEX: 126; LEFT: 832px; POSITION: absolute; TOP: 16px"                    runat="server" Height="8px" Width="56px" Font-Size="Smaller"  NavigateUrl="Help.aspx">帮助说明</asp:hyperlink><asp:hyperlink id="HyperLink11" style="Z-INDEX: 125; LEFT: 768px; POSITION: absolute; TOP: 16px"                    runat="server" Height="8px" Width="56px" Font-Size="Smaller"  NavigateUrl="Sysexit.aspx">退出系统</asp:hyperlink><asp:hyperlink id="HyperLink10" style="Z-INDEX: 124; LEFT: 704px; POSITION: absolute; TOP: 16px"                    runat="server" Height="8px" Width="56px" Font-Size="Smaller"  NavigateUrl="Runlog.aspx">系统日志</asp:hyperlink><asp:hyperlink id="HyperLink9" style="Z-INDEX: 123; LEFT: 576px; POSITION: absolute; TOP: 16px"                    runat="server" Height="8px" Width="56px" Font-Size="Smaller"  NavigateUrl="Query.aspx">同学互评</asp:hyperlink><asp:hyperlink id="HyperLink8" style="Z-INDEX: 122; LEFT: 640px; POSITION: absolute; TOP: 16px"                    runat="server" Height="8px" Width="56px" Font-Size="Smaller"  NavigateUrl="Exchange.aspx">交流频道</asp:hyperlink><asp:hyperlink id="HyperLink7" style="Z-INDEX: 121; LEFT: 448px; POSITION: absolute; TOP: 16px"                    runat="server" Height="8px" Width="56px" Font-Size="Smaller"  NavigateUrl="Smssend.aspx">家长寄语</asp:hyperlink><asp:hyperlink id="HyperLink6" style="Z-INDEX: 120; LEFT: 384px; POSITION: absolute; TOP: 16px"                    runat="server" Height="8px" Width="56px" Font-Size="Smaller"  NavigateUrl="Result.aspx">成绩档案</asp:hyperlink><asp:hyperlink id="HyperLink5" style="Z-INDEX: 119; LEFT: 320px; POSITION: absolute; TOP: 16px"                    runat="server" Height="8px" Width="56px" Font-Size="Smaller"  NavigateUrl="Class.aspx">班级档案</asp:hyperlink><asp:hyperlink id="HyperLink4" style="Z-INDEX: 118; LEFT: 256px; POSITION: absolute; TOP: 16px"                    runat="server" Height="8px" Width="56px" Font-Size="Smaller"  NavigateUrl="Grade.aspx">年级档案</asp:hyperlink><asp:hyperlink id="HyperLink3" style="Z-INDEX: 117; LEFT: 192px; POSITION: absolute; TOP: 16px"                    runat="server" Height="8px" Width="56px" Font-Size="Smaller"  NavigateUrl="Student.aspx">学生档案</asp:hyperlink><asp:label id="Label5" style="Z-INDEX: 116; LEFT: 184px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px" Font-Size="Smaller" >|</asp:label><asp:hyperlink id="HyperLink2" style="Z-INDEX: 113; LEFT: 64px; POSITION: absolute; TOP: 16px"                    runat="server" Height="8px" Width="56px" Font-Size="Smaller"  NavigateUrl="Default1.aspx">系统首页</asp:hyperlink><asp:button id="Button3" style="Z-INDEX: 112; LEFT: 360px; POSITION: absolute; TOP: 448px" runat="server"                    Width="112px" Text="修改" Enabled="False" onclick="Button3_Click"></asp:button><asp:button id="Button2" style="Z-INDEX: 111; LEFT: 488px; POSITION: absolute; TOP: 448px" runat="server"                    Width="112px" Text="删除" Enabled="False" onclick="Button2_Click"></asp:button><asp:label id="Label4" style="Z-INDEX: 109; LEFT: 64px; POSITION: absolute; TOP: 448px" runat="server"                    Height="24px" Width="48px">序号:</asp:label><asp:dropdownlist id="DropDownList1" style="Z-INDEX: 108; LEFT: 104px; POSITION: absolute; TOP: 448px"                    runat="server" Height="24px" Width="112px" AutoPostBack="True" ></asp:dropdownlist><asp:linkbutton id="btnPrevious" style="Z-INDEX: 105; LEFT: 64px; POSITION: absolute; TOP: 424px"                    runat="server" Width="64px" onclick="btnPrevious_Click">前一页</asp:linkbutton><asp:linkbutton id="btnNext" style="Z-INDEX: 106; LEFT: 136px; POSITION: absolute; TOP: 424px" runat="server"                    Width="56px" onclick="btnNext_Click">下一页</asp:linkbutton><asp:datagrid id="DataGrid1" style="Z-INDEX: 107; LEFT: 64px; POSITION: absolute; TOP: 160px"                    runat="server" Height="32px" Width="816px" AllowPaging="True" AllowCustomPaging="True" AutoGenerateColumns="False" CellPadding="2">                    <HeaderStyle ForeColor="#FFFFCC" BackColor="#CC6600"></HeaderStyle>                    <Columns>                        <asp:BoundColumn DataField="id" HeaderText="序号"></asp:BoundColumn>                        <asp:BoundColumn DataField="Name" HeaderText="教师"></asp:BoundColumn>                                                <asp:BoundColumn DataField="Remark" HeaderText="评语"></asp:BoundColumn>                        <asp:BoundColumn DataField="DTime" HeaderText="时间"></asp:BoundColumn>                    </Columns>                    <PagerStyle Visible="False"></PagerStyle>                </asp:datagrid><asp:button id="Button1" style="Z-INDEX: 110; LEFT: 232px; POSITION: absolute; TOP: 448px" runat="server"                    Width="112px" Text="增加" Enabled="True" onclick="Button1_Click"></asp:button><asp:hyperlink id="HyperLink1" style="Z-INDEX: 114; LEFT: 128px; POSITION: absolute; TOP: 16px"                    runat="server" Height="8px" Width="56px" Font-Size="Smaller"  NavigateUrl="Teacher.aspx">教师档案</asp:hyperlink><asp:label id="Label3" style="Z-INDEX: 115; LEFT: 120px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px" Font-Size="Smaller" >|</asp:label><asp:image id="Image1" style="Z-INDEX: 138; LEFT: 64px; POSITION: absolute; TOP: 32px" runat="server"                    Height="120px" Width="816px" ImageUrl="image\top.JPG"></asp:image><asp:label id="Label16" style="Z-INDEX: 139; LEFT: 232px; POSITION: absolute; TOP: 504px" runat="server"                    Height="10px" Width="448px"></asp:label><asp:label id="Label17" style="Z-INDEX: 140; LEFT: 208px; POSITION: absolute; TOP: 528px" runat="server"                    Height="3px" Width="488px"></asp:label></FONT></form>    </body></HTML>

 

  //Remark.aspx.cs

  

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 System.Configuration;            //配置类using System.Data.SqlClient;        //数据库ADO类namespace School{    /// <summary>    /// Index 的摘要说明。    /// </summary>    public partial class Remark : System.Web.UI.Page    {        private int CurrentPage;        private ListItem item;            protected void Page_Load(object sender, System.EventArgs e)        {            // 在此处放置用户代码以初始化页面            System.Data.SqlClient.SqlDataReader dreader;            if (Session["UserName"] == null || Session["UserName"].ToString() == "")            {                Response.Write("<hr><p><center>");                Response.Write("<h4>没有登录!点击");                Response.Write("<a href=http://www.mamicode.com/Default1.aspx>这儿");                Response.Write("进行登录</h4></center><p><hr>");                Response.End();            }                                    if (!Page.IsPostBack)            {                String strConn=ConfigurationSettings.AppSettings["SDataBase"];                // 连接到eForum数据库                SqlConnection cn=new SqlConnection(strConn);                // 打开连接                cn.Open();                string strSQL;                if (Session["Worker"].ToString() == "1")                {                    Button1.Visible = true;                    Button3.Visible = true;                }                else                {                    Button1.Visible = false;                    Button2.Visible = false;                    Button3.Visible = false;                }                CurrentPage = 0;                strSQL = "SELECT TOP 10 * FROM Remark  ORDER BY id asc";                SqlCommand    cmdSave=new SqlCommand(strSQL,cn);                FillGrid(cmdSave);                FillList(cmdSave);                cn.Close();            }        }        private void FillGrid(System.Data.SqlClient.SqlCommand currentSqlCommand)        {            System.Data.SqlClient.SqlDataReader dr;            dr = currentSqlCommand.ExecuteReader();            DataGrid1.DataSource = dr;            DataGrid1.DataBind();            if (dr.HasRows)        //当数据记录时            {                                ViewState["CurrentPage"] = CurrentPage;                ViewState[CurrentPage.ToString()] = DataGrid1.Items[0].Cells[0].Text;                                if (DataGrid1.Items.Count < DataGrid1.PageSize)                {                    btnNext.Enabled = false;                    btnPrevious.Enabled = true;                }                Button1.Enabled = true;                Button3.Enabled = true;                Button2.Enabled = true;            }            else            {                btnNext.Enabled = false;                btnPrevious.Enabled = false;                Button3.Enabled = true;                Button3.Enabled = false;                Button2.Enabled = false;            }            dr.Close();        }        private void FillList(System.Data.SqlClient.SqlCommand currentSqlCommand)        {            System.Data.SqlClient.SqlDataReader dr;            dr = currentSqlCommand.ExecuteReader();            if (dr.HasRows)        //当数据记录时            {                DropDownList1.Items.Clear();                while (dr.Read())                {                    DropDownList1.Items.Add(new ListItem(dr["id"].ToString(),dr["id"].ToString()));                }            }            dr.Close();                    }        #region Web 窗体设计器生成的代码        override protected void OnInit(EventArgs e)        {            //            // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。            //            InitializeComponent();            base.OnInit(e);        }                /// <summary>        /// 设计器支持所需的方法 - 不要使用代码编辑器修改        /// 此方法的内容。        /// </summary>        private void InitializeComponent()        {            }        #endregion        protected void btnPrevious_Click(object sender, System.EventArgs e)    //向上翻页        {            btnNext.Enabled = true;            CurrentPage = (int)(ViewState["CurrentPage"]);            CurrentPage--;            if (CurrentPage >= 0)             {                string firstid;                firstid = (string)(ViewState[CurrentPage.ToString()]);                String strConn=ConfigurationSettings.AppSettings["SDataBase"];                SqlConnection cn=new SqlConnection(strConn);                cn.Open();                String strSQL = "SELECT TOP 10 * FROM Remark WHERE (id >= ‘" + firstid + "‘)  ORDER BY id asc";                SqlCommand cmdSave=new SqlCommand(strSQL,cn);                FillGrid(cmdSave);                FillList(cmdSave);                cn.Close();            }            else            {                btnPrevious.Enabled = false;                btnNext.Enabled = true;            }        }        protected void btnNext_Click(object sender, System.EventArgs e)        //向下翻页        {            CurrentPage = (int)(ViewState["CurrentPage"]);            CurrentPage++;            if (DataGrid1.Items.Count >= DataGrid1.PageSize)            {                string lastid = DataGrid1.Items[9].Cells[0].Text;                String strConn=ConfigurationSettings.AppSettings["SDataBase"];                SqlConnection cn=new SqlConnection(strConn);                cn.Open();                String strSQL = "SELECT TOP 10 * FROM Remark WHERE (id >= ‘" + lastid + "‘)  ORDER BY id asc";                SqlCommand cmdSave=new SqlCommand(strSQL,cn);                FillGrid(cmdSave);                FillList(cmdSave);                cn.Close();            }            else            {                btnNext.Enabled = false;                btnPrevious.Enabled = true;            }        }        private void LinkButton10_Click(object sender, System.EventArgs e)        {            Session["UserName"]="";            LiteralControl lc = new LiteralControl("<script>window.close();</script>");            Page.Controls.Add(lc);        }                protected void Button1_Click(object sender, System.EventArgs e)        {    //OperationType            Session["OperationType"] = "Add";            //Session["UCode"] = DropDownList1.SelectedItem.Text;                        Response.Redirect("RemarkAdd.aspx");        }                protected void Button3_Click(object sender, System.EventArgs e)        {                        Session["OperationType"] = "Change";            if (DropDownList1.SelectedItem != null)            {                Session["UCode"] = DropDownList1.SelectedItem.Value;            }            else            {                Session["UCode"] = "";            }            Response.Redirect("RemarkAdd.aspx");                    }        protected void Button2_Click(object sender, System.EventArgs e)        {            String strConn=ConfigurationSettings.AppSettings["SDataBase"];            SqlConnection cn=new SqlConnection(strConn);            cn.Open();            String strSQL = " DELETE FROM  Remark WHERE id=‘"+DropDownList1.SelectedValue+""  ;             SqlCommand cmdSave=new SqlCommand(strSQL,cn);            System.Data.SqlClient.SqlDataReader dr;            dr = cmdSave.ExecuteReader();            dr.Close();            cn.Close();            Response.Redirect("Remark.aspx");        //做刷新窗口使用                }        public void ShowClientMessage(String msg)        {                        String s = String.Format(                "<script language=javascript>var truthBeTold = alert(‘{0}‘);  </script>", msg);                    //alert confirm prompt             //#if(NET_2_0)            //    ClientScript.RegisterStartupScript(this.GetType(), "FFBE5E5B-1D3D-4727-AA6A-057461409FDF", s);            //#elif(NET_1_1)                this.RegisterStartupScript("FFBE5E5B-1D3D-4727-AA6A-057461409FDE", s);            //#endif        }        public void ReturnWindow(String msg)        {                        String s = String.Format(                "<script language=javascript>window.location.href(‘{0}‘);</script>", msg);            //#if(NET_2_0)            //    ClientScript.RegisterStartupScript(this.GetType(), "FFBE5E5B-1D3D-4727-AA6A-057461409FDF", s);            //#elif(NET_1_1)            this.RegisterStartupScript("FFBE5E5B-1D3E-4727-AA6A-057461409FDE", s);            //#endif                    }        protected void DGrade_SelectedIndexChanged(object sender, EventArgs e)        {        }}}

四、同学互评

  //Query.aspx

<%@ Page language="c#" Inherits="School.Query" CodeFile="Query.aspx.cs" %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" ><HTML>    <HEAD>        <title>教师档案信息管理!</title><link href=http://www.mamicode.com/"css/cww.css" rel="stylesheet" type="text/css" />        <STYLE>BODY { SCROLLBAR-FACE-COLOR: #24b4fc; SCROLLBAR-HIGHLIGHT-COLOR: #fcfcfc; SCROLLBAR-3DLIGHT-COLOR: #d8d8fc; SCROLLBAR-BASE-COLOR: #24fcfc }        </STYLE>        <style type="text/css">A:hover { COLOR: #d15b0c }    A:link { TEXT-DECORATION: none }    A:visited { TEXT-DECORATION: none }    A:active { TEXT-DECORATION: none }        </style>        <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">        <meta content="C#" name="CODE_LANGUAGE">        <meta content="JavaScript" name="vs_defaultClientScript">        <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">    </HEAD>    <body style="background-image:url(‘image/15.jpg‘);">        <form id="Form1" method="post" runat="server">            <FONT face="宋体">                <asp:label id="Label15" style="Z-INDEX: 137; LEFT: 440px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px" Font-Size="Smaller" >|</asp:label><asp:label id="Label14" style="Z-INDEX: 136; LEFT: 504px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px" Font-Size="Smaller" >|</asp:label><asp:label id="Label13" style="Z-INDEX: 135; LEFT: 632px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px" Font-Size="Smaller" >|</asp:label><asp:label id="Label12" style="Z-INDEX: 134; LEFT: 568px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px" Font-Size="Smaller" >|</asp:label><asp:label id="Label11" style="Z-INDEX: 133; LEFT: 824px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px" Font-Size="Smaller" >|</asp:label><asp:label id="Label10" style="Z-INDEX: 132; LEFT: 760px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px" Font-Size="Smaller" >|</asp:label><asp:label id="Label9" style="Z-INDEX: 131; LEFT: 696px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px" Font-Size="Smaller" >|</asp:label><asp:label id="Label8" style="Z-INDEX: 130; LEFT: 376px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px" Font-Size="Smaller" >|</asp:label><asp:label id="Label7" style="Z-INDEX: 129; LEFT: 312px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px" Font-Size="Smaller" >|</asp:label><asp:label id="Label6" style="Z-INDEX: 128; LEFT: 248px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px" Font-Size="Smaller" >|</asp:label><asp:hyperlink id="HyperLink13" style="Z-INDEX: 127; LEFT: 512px; POSITION: absolute; TOP: 16px"                    runat="server" Height="8px" Width="56px" Font-Size="Smaller"  NavigateUrl="Remark.aspx"  >教师评语</asp:hyperlink><asp:hyperlink id="HyperLink12" style="Z-INDEX: 126; LEFT: 832px; POSITION: absolute; TOP: 16px"                    runat="server" Height="8px" Width="56px" Font-Size="Smaller"  NavigateUrl="Help.aspx">帮助说明</asp:hyperlink><asp:hyperlink id="HyperLink11" style="Z-INDEX: 125; LEFT: 768px; POSITION: absolute; TOP: 16px"                    runat="server" Height="8px" Width="56px" Font-Size="Smaller"  NavigateUrl="Sysexit.aspx">退出系统</asp:hyperlink><asp:hyperlink id="HyperLink10" style="Z-INDEX: 124; LEFT: 704px; POSITION: absolute; TOP: 16px"                    runat="server" Height="8px" Width="56px" Font-Size="Smaller"  NavigateUrl="Runlog.aspx">系统日志</asp:hyperlink><asp:hyperlink id="HyperLink9" style="Z-INDEX: 123; LEFT: 576px; POSITION: absolute; TOP: 16px"                    runat="server" Height="8px" Width="56px" Font-Size="Smaller"  NavigateUrl="Query.aspx"  CssClass="curstyle" >同学互评</asp:hyperlink><asp:hyperlink id="HyperLink8" style="Z-INDEX: 122; LEFT: 640px; POSITION: absolute; TOP: 16px"                    runat="server" Height="8px" Width="56px" Font-Size="Smaller"  NavigateUrl="Exchange.aspx">交流频道</asp:hyperlink><asp:hyperlink id="HyperLink7" style="Z-INDEX: 121; LEFT: 448px; POSITION: absolute; TOP: 16px"                    runat="server" Height="8px" Width="56px" Font-Size="Smaller"  NavigateUrl="Smssend.aspx">家长寄语</asp:hyperlink><asp:hyperlink id="HyperLink6" style="Z-INDEX: 120; LEFT: 384px; POSITION: absolute; TOP: 16px"                    runat="server" Height="8px" Width="56px" Font-Size="Smaller"  NavigateUrl="Result.aspx">成绩档案</asp:hyperlink><asp:hyperlink id="HyperLink5" style="Z-INDEX: 119; LEFT: 320px; POSITION: absolute; TOP: 16px"                    runat="server" Height="8px" Width="56px" Font-Size="Smaller"  NavigateUrl="Class.aspx">班级档案</asp:hyperlink><asp:hyperlink id="HyperLink4" style="Z-INDEX: 118; LEFT: 256px; POSITION: absolute; TOP: 16px"                    runat="server" Height="8px" Width="56px" Font-Size="Smaller"  NavigateUrl="Grade.aspx">年级档案</asp:hyperlink><asp:hyperlink id="HyperLink3" style="Z-INDEX: 117; LEFT: 192px; POSITION: absolute; TOP: 16px"                    runat="server" Height="8px" Width="56px" Font-Size="Smaller"  NavigateUrl="Student.aspx">学生档案</asp:hyperlink><asp:label id="Label5" style="Z-INDEX: 116; LEFT: 184px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px" Font-Size="Smaller" >|</asp:label><asp:hyperlink id="HyperLink2" style="Z-INDEX: 113; LEFT: 64px; POSITION: absolute; TOP: 16px"                    runat="server" Height="8px" Width="56px" Font-Size="Smaller"  NavigateUrl="Default1.aspx">系统首页</asp:hyperlink><asp:button id="Button3" style="Z-INDEX: 112; LEFT: 360px; POSITION: absolute; TOP: 448px" runat="server"                    Width="112px" Text="修改" Enabled="False" onclick="Button3_Click"></asp:button><asp:button id="Button2" style="Z-INDEX: 111; LEFT: 488px; POSITION: absolute; TOP: 448px" runat="server"                    Width="112px" Text="删除" Enabled="False" onclick="Button2_Click"></asp:button><asp:label id="Label4" style="Z-INDEX: 109; LEFT: 64px; POSITION: absolute; TOP: 448px" runat="server"                    Height="24px" Width="48px">序号:</asp:label><asp:dropdownlist id="DropDownList1" style="Z-INDEX: 108; LEFT: 104px; POSITION: absolute; TOP: 448px"                    runat="server" Height="24px" Width="112px" AutoPostBack="True" ></asp:dropdownlist><asp:linkbutton id="btnPrevious" style="Z-INDEX: 105; LEFT: 64px; POSITION: absolute; TOP: 424px"                    runat="server" Width="64px" onclick="btnPrevious_Click">前一页</asp:linkbutton><asp:linkbutton id="btnNext" style="Z-INDEX: 106; LEFT: 136px; POSITION: absolute; TOP: 424px" runat="server"                    Width="56px" onclick="btnNext_Click">下一页</asp:linkbutton><asp:datagrid id="DataGrid1" style="Z-INDEX: 107; LEFT: 64px; POSITION: absolute; TOP: 160px"                    runat="server" Height="32px" Width="816px" AllowPaging="True" AllowCustomPaging="True" AutoGenerateColumns="False" CellPadding="2">                    <HeaderStyle ForeColor="#FFFFCC" BackColor="#CC6600"></HeaderStyle>                    <Columns>                        <asp:BoundColumn DataField="id" HeaderText="序号"></asp:BoundColumn>                        <asp:BoundColumn DataField="Name" HeaderText="同学"></asp:BoundColumn>                                                <asp:BoundColumn DataField="Remark" HeaderText="评语"></asp:BoundColumn>                        <asp:BoundColumn DataField="DTime" HeaderText="时间"></asp:BoundColumn>                    </Columns>                    <PagerStyle Visible="False"></PagerStyle>                </asp:datagrid><asp:button id="Button1" style="Z-INDEX: 110; LEFT: 232px; POSITION: absolute; TOP: 448px" runat="server"                    Width="112px" Text="增加" Enabled="True" onclick="Button1_Click"></asp:button><asp:hyperlink id="HyperLink1" style="Z-INDEX: 114; LEFT: 128px; POSITION: absolute; TOP: 16px"                    runat="server" Height="8px" Width="56px" Font-Size="Smaller"  NavigateUrl="Teacher.aspx">教师档案</asp:hyperlink><asp:label id="Label3" style="Z-INDEX: 115; LEFT: 120px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px" Font-Size="Smaller" >|</asp:label><asp:image id="Image1" style="Z-INDEX: 138; LEFT: 64px; POSITION: absolute; TOP: 32px" runat="server"                    Height="120px" Width="816px" ImageUrl="image\top.JPG"></asp:image><asp:label id="Label16" style="Z-INDEX: 139; LEFT: 232px; POSITION: absolute; TOP: 504px" runat="server"                    Height="10px" Width="448px"></asp:label><asp:label id="Label17" style="Z-INDEX: 140; LEFT: 208px; POSITION: absolute; TOP: 528px" runat="server"                    Height="3px" Width="488px"></asp:label></FONT></form>    </body></HTML>

 

  //Query.aspx.cs

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 System.Configuration;            //配置类using System.Data.SqlClient;        //数据库ADO类namespace School{    /// <summary>    /// Index 的摘要说明。    /// </summary>    public partial class Query : System.Web.UI.Page    {        private int CurrentPage;        private ListItem item;            protected void Page_Load(object sender, System.EventArgs e)        {            // 在此处放置用户代码以初始化页面            System.Data.SqlClient.SqlDataReader dreader;            if (Session["UserName"] == null || Session["UserName"].ToString() == "")            {                Response.Write("<hr><p><center>");                Response.Write("<h4>没有登录!点击");                Response.Write("<a href=http://www.mamicode.com/Default1.aspx>这儿");                Response.Write("进行登录</h4></center><p><hr>");                Response.End();            }                                    if (!Page.IsPostBack)            {                String strConn=ConfigurationSettings.AppSettings["SDataBase"];                // 连接到eForum数据库                SqlConnection cn=new SqlConnection(strConn);                // 打开连接                cn.Open();                string strSQL;                //学生                if (Session["Worker"].ToString() == "3")                {                    Button1.Visible = true;                    Button2.Visible = true;                    Button3.Visible = true;                }                else                {                    Button1.Visible = false;                    Button2.Visible = false;                    Button3.Visible = false;                }                //老师                if (Session["Worker"].ToString() == "1")                {                    Button2.Visible = true;                }                CurrentPage = 0;                strSQL = "SELECT TOP 10 * FROM StudentComment  ORDER BY id asc";                SqlCommand    cmdSave=new SqlCommand(strSQL,cn);                FillGrid(cmdSave);                FillList(cmdSave);                cn.Close();            }        }        private void FillGrid(System.Data.SqlClient.SqlCommand currentSqlCommand)        {            System.Data.SqlClient.SqlDataReader dr;            dr = currentSqlCommand.ExecuteReader();            DataGrid1.DataSource = dr;            DataGrid1.DataBind();            if (dr.HasRows)        //当数据记录时            {                                ViewState["CurrentPage"] = CurrentPage;                ViewState[CurrentPage.ToString()] = DataGrid1.Items[0].Cells[0].Text;                                if (DataGrid1.Items.Count < DataGrid1.PageSize)                {                    btnNext.Enabled = false;                    btnPrevious.Enabled = true;                }                Button1.Enabled = true;                Button3.Enabled = true;                Button2.Enabled = true;            }            else            {                btnNext.Enabled = false;                btnPrevious.Enabled = false;                Button3.Enabled = true;                Button3.Enabled = false;                Button2.Enabled = false;            }            dr.Close();        }        private void FillList(System.Data.SqlClient.SqlCommand currentSqlCommand)        {            System.Data.SqlClient.SqlDataReader dr;            dr = currentSqlCommand.ExecuteReader();            if (dr.HasRows)        //当数据记录时            {                DropDownList1.Items.Clear();                while (dr.Read())                {                    DropDownList1.Items.Add(new ListItem(dr["id"].ToString(),dr["id"].ToString()));                }            }            dr.Close();                    }        #region Web 窗体设计器生成的代码        override protected void OnInit(EventArgs e)        {            //            // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。            //            InitializeComponent();            base.OnInit(e);        }                /// <summary>        /// 设计器支持所需的方法 - 不要使用代码编辑器修改        /// 此方法的内容。        /// </summary>        private void InitializeComponent()        {            }        #endregion        protected void btnPrevious_Click(object sender, System.EventArgs e)    //向上翻页        {            btnNext.Enabled = true;            CurrentPage = (int)(ViewState["CurrentPage"]);            CurrentPage--;            if (CurrentPage >= 0)             {                string firstid;                firstid = (string)(ViewState[CurrentPage.ToString()]);                String strConn=ConfigurationSettings.AppSettings["SDataBase"];                SqlConnection cn=new SqlConnection(strConn);                cn.Open();                String strSQL = "SELECT TOP 10 * FROM StudentComment WHERE (id >= ‘" + firstid + "‘)  ORDER BY id asc";                SqlCommand cmdSave=new SqlCommand(strSQL,cn);                FillGrid(cmdSave);                FillList(cmdSave);                cn.Close();            }            else            {                btnPrevious.Enabled = false;                btnNext.Enabled = true;            }        }        protected void btnNext_Click(object sender, System.EventArgs e)        //向下翻页        {            CurrentPage = (int)(ViewState["CurrentPage"]);            CurrentPage++;            if (DataGrid1.Items.Count >= DataGrid1.PageSize)            {                string lastid = DataGrid1.Items[9].Cells[0].Text;                String strConn=ConfigurationSettings.AppSettings["SDataBase"];                SqlConnection cn=new SqlConnection(strConn);                cn.Open();                String strSQL = "SELECT TOP 10 * FROM StudentComment WHERE (id >= ‘" + lastid + "‘)  ORDER BY id asc";                SqlCommand cmdSave=new SqlCommand(strSQL,cn);                FillGrid(cmdSave);                FillList(cmdSave);                cn.Close();            }            else            {                btnNext.Enabled = false;                btnPrevious.Enabled = true;            }        }        private void LinkButton10_Click(object sender, System.EventArgs e)        {            Session["UserName"]="";            LiteralControl lc = new LiteralControl("<script>window.close();</script>");            Page.Controls.Add(lc);        }                protected void Button1_Click(object sender, System.EventArgs e)        {    //OperationType            Session["OperationType"] = "Add";            //Session["UCode"] = DropDownList1.SelectedItem.Text;                        Response.Redirect("QueryAdd.aspx");        }                protected void Button3_Click(object sender, System.EventArgs e)        {                        Session["OperationType"] = "Change";            if (DropDownList1.SelectedItem != null)            {                Session["UCode"] = DropDownList1.SelectedItem.Value;            }            else            {                Session["UCode"] = "";            }            Response.Redirect("QueryAdd.aspx");                    }        protected void Button2_Click(object sender, System.EventArgs e)        {            String strConn=ConfigurationSettings.AppSettings["SDataBase"];            SqlConnection cn=new SqlConnection(strConn);            cn.Open();            String strSQL = " DELETE FROM  StudentComment WHERE id=‘" + DropDownList1.SelectedValue + "";             SqlCommand cmdSave=new SqlCommand(strSQL,cn);            System.Data.SqlClient.SqlDataReader dr;            dr = cmdSave.ExecuteReader();            dr.Close();            cn.Close();            Response.Redirect("Query.aspx");        //做刷新窗口使用                }        public void ShowClientMessage(String msg)        {                        String s = String.Format(                "<script language=javascript>var truthBeTold = alert(‘{0}‘);  </script>", msg);                    //alert confirm prompt             //#if(NET_2_0)            //    ClientScript.RegisterStartupScript(this.GetType(), "FFBE5E5B-1D3D-4727-AA6A-057461409FDF", s);            //#elif(NET_1_1)                this.RegisterStartupScript("FFBE5E5B-1D3D-4727-AA6A-057461409FDE", s);            //#endif        }        public void ReturnWindow(String msg)        {                        String s = String.Format(                "<script language=javascript>window.location.href(‘{0}‘);</script>", msg);            //#if(NET_2_0)            //    ClientScript.RegisterStartupScript(this.GetType(), "FFBE5E5B-1D3D-4727-AA6A-057461409FDF", s);            //#elif(NET_1_1)            this.RegisterStartupScript("FFBE5E5B-1D3E-4727-AA6A-057461409FDE", s);            //#endif                    }        protected void DGrade_SelectedIndexChanged(object sender, EventArgs e)        {        }}}

五、交流频道

  //Exchange.aspx

<%@ Page language="c#" Inherits="School.Exchange" CodeFile="Exchange.aspx.cs" %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" ><HTML>    <HEAD>        <title>教师档案信息管理!</title><link href=http://www.mamicode.com/"css/cww.css" rel="stylesheet" type="text/css" />        <STYLE>BODY { SCROLLBAR-FACE-COLOR: #24b4fc; SCROLLBAR-HIGHLIGHT-COLOR: #fcfcfc; SCROLLBAR-3DLIGHT-COLOR: #d8d8fc; SCROLLBAR-BASE-COLOR: #24fcfc }        </STYLE>        <style type="text/css">A:hover { COLOR: #d15b0c }    A:link { TEXT-DECORATION: none }    A:visited { TEXT-DECORATION: none }    A:active { TEXT-DECORATION: none }        </style>        <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">        <meta content="C#" name="CODE_LANGUAGE">        <meta content="JavaScript" name="vs_defaultClientScript">        <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">    </HEAD>    <body style="background-image:url(‘image/4.jpg‘);">        <form id="Form1" method="post" runat="server">            <FONT face="宋体">                <asp:Label id="Label15" style="Z-INDEX: 137; LEFT: 440px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:Label>                <asp:Label id="Label14" style="Z-INDEX: 136; LEFT: 504px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:Label>                <asp:Label id="Label13" style="Z-INDEX: 135; LEFT: 632px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:Label>                <asp:Label id="Label12" style="Z-INDEX: 134; LEFT: 568px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:Label>                <asp:Label id="Label11" style="Z-INDEX: 133; LEFT: 824px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:Label>                <asp:Label id="Label10" style="Z-INDEX: 132; LEFT: 760px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:Label>                <asp:Label id="Label9" style="Z-INDEX: 131; LEFT: 696px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:Label>                <asp:Label id="Label8" style="Z-INDEX: 130; LEFT: 376px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:Label>                <asp:Label id="Label7" style="Z-INDEX: 129; LEFT: 312px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:Label>                <asp:Label id="Label6" style="Z-INDEX: 128; LEFT: 248px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:Label>                <asp:HyperLink id="HyperLink13" style="Z-INDEX: 127; LEFT: 512px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  NavigateUrl="Remark.aspx" Font-Size="Smaller">教师评语</asp:HyperLink>                <asp:HyperLink id="HyperLink12" style="Z-INDEX: 126; LEFT: 832px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  NavigateUrl="Help.aspx" Font-Size="Smaller">帮助说明</asp:HyperLink>                <asp:HyperLink id="HyperLink11" style="Z-INDEX: 125; LEFT: 768px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  NavigateUrl="Sysexit.aspx" Font-Size="Smaller">退出系统</asp:HyperLink>                <asp:HyperLink id="HyperLink10" style="Z-INDEX: 124; LEFT: 704px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  NavigateUrl="Runlog.aspx" Font-Size="Smaller">系统日志</asp:HyperLink>                <asp:HyperLink id="HyperLink9" style="Z-INDEX: 123; LEFT: 576px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  NavigateUrl="Query.aspx" Font-Size="Smaller">同学互评</asp:HyperLink>                <asp:HyperLink id="HyperLink8" style="Z-INDEX: 122; LEFT: 640px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  NavigateUrl="Exchange.aspx" Font-Size="Smaller"                    Enabled="False" CssClass="curstyle" >交流频道</asp:HyperLink>                <asp:HyperLink id="HyperLink7" style="Z-INDEX: 121; LEFT: 448px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  NavigateUrl="Smssend.aspx" Font-Size="Smaller">家长寄语</asp:HyperLink>                <asp:HyperLink id="HyperLink6" style="Z-INDEX: 120; LEFT: 384px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  NavigateUrl="Result.aspx" Font-Size="Smaller">成绩档案</asp:HyperLink>                <asp:HyperLink id="HyperLink5" style="Z-INDEX: 119; LEFT: 320px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  NavigateUrl="Class.aspx" Font-Size="Smaller">班级档案</asp:HyperLink>                <asp:HyperLink id="HyperLink4" style="Z-INDEX: 118; LEFT: 256px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  NavigateUrl="Grade.aspx" Font-Size="Smaller">年级档案</asp:HyperLink>                <asp:HyperLink id="HyperLink3" style="Z-INDEX: 117; LEFT: 192px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  NavigateUrl="Student.aspx" Font-Size="Smaller">学生档案</asp:HyperLink>                <asp:Label id="Label5" style="Z-INDEX: 116; LEFT: 184px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:Label>                <asp:HyperLink id="HyperLink2" style="Z-INDEX: 113; LEFT: 64px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  NavigateUrl="Default1.aspx" Font-Size="Smaller">系统首页</asp:HyperLink>                        <FONT face="宋体">            <asp:button id="ButtonSend"                 style="Z-INDEX: 111; POSITION: absolute; TOP: 448px;left:64px; " runat="server"                    Width="112px" Text="发布消息" onclick="ButtonSend_Click" ></asp:button></FONT><asp:linkbutton id="btnPrevious" style="Z-INDEX: 105; LEFT: 64px; POSITION: absolute; TOP: 424px"                    runat="server" Width="64px" onclick="btnPrevious_Click">前一页</asp:linkbutton><asp:linkbutton id="btnNext" style="Z-INDEX: 106; LEFT: 136px; POSITION: absolute; TOP: 424px" runat="server"                    Width="56px" onclick="btnNext_Click">下一页</asp:linkbutton><asp:datagrid id="DataGrid1" style="Z-INDEX: 107; LEFT: 64px; POSITION: absolute; TOP: 160px"                    runat="server" Height="32px" Width="816px" CellPadding="2" AutoGenerateColumns="False" AllowCustomPaging="True" AllowPaging="True">                    <HeaderStyle ForeColor="#FFFFCC" BackColor="#CC6600"></HeaderStyle>                    <Columns>                        <asp:BoundColumn DataField="id" HeaderText="序号"></asp:BoundColumn>                        <asp:BoundColumn DataField="Name" HeaderText="姓名"></asp:BoundColumn>                        <asp:BoundColumn DataField="Content" HeaderText="内容"></asp:BoundColumn>                        <asp:BoundColumn DataField="DTime" HeaderText="时间"></asp:BoundColumn>                    </Columns>                    <PagerStyle Visible="False"></PagerStyle>                </asp:datagrid>                <asp:HyperLink id="HyperLink1" style="Z-INDEX: 114; LEFT: 128px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px" NavigateUrl="Teacher.aspx"  Font-Size="Smaller">教师档案</asp:HyperLink>                <asp:Label id="Label3" style="Z-INDEX: 115; LEFT: 120px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:Label>                <asp:Image id="Image1" style="Z-INDEX: 138; LEFT: 64px; POSITION: absolute; TOP: 32px" runat="server"                    Height="120px" Width="816px" ImageUrl="image\top.JPG"></asp:Image>                <asp:Label id="Label16" style="Z-INDEX: 139; LEFT: 232px; POSITION: absolute; TOP: 504px" runat="server"                    Height="10px" Width="448px"></asp:Label>                <asp:Label id="Label17" style="Z-INDEX: 140; LEFT: 208px; POSITION: absolute; TOP: 528px" runat="server"                    Height="3px" Width="488px"></asp:Label></FONT></form>    </body></HTML>

 

  //Exchange.aspx.cs

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 System.Configuration;            //配置类using System.Data.SqlClient;        //数据库ADO类namespace School{    /// <summary>    /// Index 的摘要说明。    /// </summary>    public partial class Exchange : System.Web.UI.Page    {        private int CurrentPage;        private ListItem item;            protected void Page_Load(object sender, System.EventArgs e)        {            // 在此处放置用户代码以初始化页面            System.Data.SqlClient.SqlDataReader dreader;            if (Session["UserName"] == null || Session["UserName"].ToString() == "")            {                Response.Write("<hr><p><center>");                Response.Write("<h4>没有登录!点击");                Response.Write("<a href=http://www.mamicode.com/Default1.aspx>这儿");                Response.Write("进行登录</h4></center><p><hr>");                Response.End();            }                                    if (!Page.IsPostBack)            {                String strConn = ConfigurationSettings.AppSettings["SDataBase"];                // 连接到eForum数据库                SqlConnection cn = new SqlConnection(strConn);                // 打开连接                cn.Open();                // 构造SQL语句,该语句在RegUsers表中检查昵称和密码是否正确                String strSQL = "SELECT  Name FROM Teacher";                // 创建Command对象                SqlCommand cmdSave = new SqlCommand(strSQL, cn);                //学生                if (Session["Worker"].ToString() == "3")                {                    ButtonSend.Visible = true;                }                else                {                    ButtonSend.Visible = true;                   }                CurrentPage = 0;                strSQL = "SELECT TOP 10 * FROM Exchange  ORDER BY id asc ";                cmdSave = new SqlCommand(strSQL, cn);                FillGrid(cmdSave);                cn.Close();            }        }        private void FillGrid(System.Data.SqlClient.SqlCommand currentSqlCommand)        {            System.Data.SqlClient.SqlDataReader dr;            dr = currentSqlCommand.ExecuteReader();            DataGrid1.DataSource = dr;            DataGrid1.DataBind();            if (dr.HasRows)        //当数据记录时            {                                ViewState["CurrentPage"] = CurrentPage;                ViewState[CurrentPage.ToString()] = DataGrid1.Items[0].Cells[0].Text;                                if (DataGrid1.Items.Count < DataGrid1.PageSize)                {                    btnNext.Enabled = false;                                    }                else                {                    btnPrevious.Enabled = true;                                }            }            else            {                btnNext.Enabled = false;                btnPrevious.Enabled = false;            }            dr.Close();        }        #region Web 窗体设计器生成的代码        override protected void OnInit(EventArgs e)        {            //            // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。            //            InitializeComponent();            base.OnInit(e);        }                /// <summary>        /// 设计器支持所需的方法 - 不要使用代码编辑器修改        /// 此方法的内容。        /// </summary>        private void InitializeComponent()        {            }        #endregion        protected void btnPrevious_Click(object sender, System.EventArgs e)    //向上翻页        {            btnNext.Enabled = true;            CurrentPage = (int)(ViewState["CurrentPage"]);            CurrentPage--;            if (CurrentPage >= 0)             {                string firstid;                firstid = (string)(ViewState[CurrentPage.ToString()]);                String strConn=ConfigurationSettings.AppSettings["SDataBase"];                SqlConnection cn=new SqlConnection(strConn);                cn.Open();                String strSQL = "SELECT TOP 10 * FROM Exchange WHERE (id <= ‘" + firstid + "‘)  ORDER BY id asc";                SqlCommand cmdSave=new SqlCommand(strSQL,cn);                FillGrid(cmdSave);                                cn.Close();            }            else            {                btnPrevious.Enabled = false;                btnNext.Enabled = true;            }        }        protected void btnNext_Click(object sender, System.EventArgs e)        //向下翻页        {            CurrentPage = (int)(ViewState["CurrentPage"]);            CurrentPage++;            if (DataGrid1.Items.Count >= DataGrid1.PageSize)            {                string lastid = DataGrid1.Items[9].Cells[0].Text;                String strConn=ConfigurationSettings.AppSettings["SDataBase"];                SqlConnection cn=new SqlConnection(strConn);                cn.Open();                String strSQL = "SELECT TOP 10 * FROM Exchange WHERE (id <= ‘" + lastid + "‘)  ORDER BY id asc";                SqlCommand cmdSave=new SqlCommand(strSQL,cn);                FillGrid(cmdSave);                                cn.Close();            }            else            {                btnNext.Enabled = false;                btnPrevious.Enabled = true;            }        }        private void LinkButton10_Click(object sender, System.EventArgs e)        {            Session["UserName"]="";            LiteralControl lc = new LiteralControl("<script>window.close();</script>");            Page.Controls.Add(lc);        }                public void ShowClientMessage(String msg)        {                        String s = String.Format(                "<script language=javascript>var truthBeTold = alert(‘{0}‘);  </script>", msg);                    //alert confirm prompt             //#if(NET_2_0)            //    ClientScript.RegisterStartupScript(this.GetType(), "FFBE5E5B-1D3D-4727-AA6A-057461409FDF", s);            //#elif(NET_1_1)                this.RegisterStartupScript("FFBE5E5B-1D3D-4727-AA6A-057461409FDE", s);            //#endif        }        public void ReturnWindow(String msg)        {                        String s = String.Format(                "<script language=javascript>window.location.href(‘{0}‘);</script>", msg);            //#if(NET_2_0)            //    ClientScript.RegisterStartupScript(this.GetType(), "FFBE5E5B-1D3D-4727-AA6A-057461409FDF", s);            //#elif(NET_1_1)            this.RegisterStartupScript("FFBE5E5B-1D3E-4727-AA6A-057461409FDE", s);            //#endif                    }        protected void ButtonSend_Click(object sender, EventArgs e)        {            Response.Redirect("ExchangeAdd.aspx");        }}}

六、成绩档案

  //Result.aspx

<%@ Page language="c#" Inherits="School.Result" CodeFile="Result.aspx.cs" %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" ><HTML>    <HEAD>        <title>教师档案信息管理!</title><link href=http://www.mamicode.com/"css/cww.css" rel="stylesheet" type="text/css" />        <STYLE>BODY { SCROLLBAR-FACE-COLOR: #24b4fc; SCROLLBAR-HIGHLIGHT-COLOR: #fcfcfc; SCROLLBAR-3DLIGHT-COLOR: #d8d8fc; SCROLLBAR-BASE-COLOR: #24fcfc }        </STYLE>        <style type="text/css">A:hover { COLOR: #d15b0c }    A:link { TEXT-DECORATION: none }    A:visited { TEXT-DECORATION: none }    A:active { TEXT-DECORATION: none }        </style>        <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">        <meta content="C#" name="CODE_LANGUAGE">        <meta content="JavaScript" name="vs_defaultClientScript">        <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">    </HEAD>    <body style="background-image:url(‘image/16.jpg‘);">        <form id="Form1" method="post" runat="server">            <FONT face="宋体">                <asp:label id="Label2" style="Z-INDEX: 103; LEFT: 752px; POSITION: absolute; TOP: 448px" runat="server"                    Width="48px" Height="24px">班级:</asp:label>                <asp:button id="Button7" style="Z-INDEX: 146; LEFT: 784px; POSITION: absolute; TOP: 480px" runat="server"                    Width="100px" Text="删除成绩" Visible="false" Enabled="False" onclick="Button7_Click"></asp:button>                <asp:button id="Button6" style="Z-INDEX: 145; LEFT: 664px; POSITION: absolute; TOP: 480px" runat="server"                    Width="100px" Text="信息群发" Visible="false" Enabled="False" onclick="Button6_Click"></asp:button>                <asp:button id="Button5" style="Z-INDEX: 144; LEFT: 544px; POSITION: absolute; TOP: 480px" runat="server"                    Width="100px" Text="班级成绩通知" Visible="false" Enabled="False" onclick="Button5_Click"></asp:button>                <asp:button id="Button4" style="Z-INDEX: 143; LEFT: 424px; POSITION: absolute; TOP: 480px" runat="server"                    Width="100px" Text="建立班成绩" Enabled="False" Visible="false" onclick="Button4_Click"></asp:button>                <asp:label id="Label18" style="Z-INDEX: 142; LEFT: 65px; POSITION: absolute; TOP: 450px;" runat="server"                    Width="48px" Height="24px">序号:</asp:label>                <asp:dropdownlist id="DropDownList2" style="Z-INDEX: 141; LEFT: 106px; POSITION: absolute; TOP: 448px;"                    runat="server" Width="112px" Height="24px"></asp:dropdownlist><asp:label id="Label15" style="Z-INDEX: 137; LEFT: 440px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:label><asp:label id="Label14" style="Z-INDEX: 136; LEFT: 504px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:label><asp:label id="Label13" style="Z-INDEX: 135; LEFT: 632px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:label><asp:label id="Label12" style="Z-INDEX: 134; LEFT: 568px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:label><asp:label id="Label11" style="Z-INDEX: 133; LEFT: 824px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:label><asp:label id="Label10" style="Z-INDEX: 132; LEFT: 760px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:label><asp:label id="Label9" style="Z-INDEX: 131; LEFT: 696px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:label><asp:label id="Label8" style="Z-INDEX: 130; LEFT: 376px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:label><asp:label id="Label7" style="Z-INDEX: 129; LEFT: 312px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:label><asp:label id="Label6" style="Z-INDEX: 128; LEFT: 248px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:label><asp:hyperlink id="HyperLink13" style="Z-INDEX: 127; LEFT: 512px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  Font-Size="Smaller" NavigateUrl="Remark.aspx">教师评语</asp:hyperlink><asp:hyperlink id="HyperLink12" style="Z-INDEX: 126; LEFT: 832px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  Font-Size="Smaller" NavigateUrl="Help.aspx">帮助说明</asp:hyperlink><asp:hyperlink id="HyperLink11" style="Z-INDEX: 125; LEFT: 768px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  Font-Size="Smaller" NavigateUrl="Sysexit.aspx">退出系统</asp:hyperlink><asp:hyperlink id="HyperLink10" style="Z-INDEX: 124; LEFT: 704px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  Font-Size="Smaller" NavigateUrl="Runlog.aspx">系统日志</asp:hyperlink><asp:hyperlink id="HyperLink9" style="Z-INDEX: 123; LEFT: 576px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  Font-Size="Smaller" NavigateUrl="Query.aspx">同学互评</asp:hyperlink><asp:hyperlink id="HyperLink8" style="Z-INDEX: 122; LEFT: 640px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  Font-Size="Smaller" NavigateUrl="Exchange.aspx">交流频道</asp:hyperlink><asp:hyperlink id="HyperLink7" style="Z-INDEX: 121; LEFT: 448px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  Font-Size="Smaller" NavigateUrl="Smssend.aspx">家长寄语</asp:hyperlink><asp:hyperlink id="HyperLink6" style="Z-INDEX: 120; LEFT: 384px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  Font-Size="Smaller" NavigateUrl="Result.aspx" Enabled="False" CssClass="curstyle" >成绩档案</asp:hyperlink><asp:hyperlink id="HyperLink5" style="Z-INDEX: 119; LEFT: 320px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  Font-Size="Smaller" NavigateUrl="Class.aspx">班级档案</asp:hyperlink><asp:hyperlink id="HyperLink4" style="Z-INDEX: 118; LEFT: 256px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  Font-Size="Smaller" NavigateUrl="Grade.aspx">年级档案</asp:hyperlink><asp:hyperlink id="HyperLink3" style="Z-INDEX: 117; LEFT: 192px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  Font-Size="Smaller" NavigateUrl="Student.aspx">学生档案</asp:hyperlink><asp:label id="Label5" style="Z-INDEX: 116; LEFT: 184px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:label><asp:hyperlink id="HyperLink2" style="Z-INDEX: 113; LEFT: 64px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  Font-Size="Smaller" NavigateUrl="Default1.aspx">系统首页</asp:hyperlink><asp:button id="Button3" style="Z-INDEX: 112; LEFT: 184px; POSITION: absolute; TOP: 480px" runat="server"                    Width="100px" Text="修改" Enabled="False" onclick="Button3_Click"></asp:button><asp:button id="Button2" style="Z-INDEX: 110; LEFT: 304px; POSITION: absolute; TOP: 480px" runat="server"                    Width="100px" Text="删除学生成绩" Enabled="False" onclick="Button2_Click"></asp:button><asp:label id="Label4" style="Z-INDEX: 108; LEFT: 64px; POSITION: absolute; TOP: 448px" runat="server"                    Width="48px" Height="24px" Visible="false" >考试:</asp:label><asp:dropdownlist Visible="false" id="DropDownList1" style="Z-INDEX: 107; LEFT: 104px; POSITION: absolute; TOP: 448px"                    runat="server" Width="112px" Height="24px" AutoPostBack="True" onselectedindexchanged="DropDownList1_SelectedIndexChanged"></asp:dropdownlist><asp:dropdownlist id="DGrade" style="Z-INDEX: 100; LEFT: 648px; POSITION: absolute; TOP: 448px" runat="server"                    Width="93px" Height="24px" AutoPostBack="True" Enabled="False" onselectedindexchanged="DGrade_SelectedIndexChanged"></asp:dropdownlist><asp:dropdownlist id="DClass" style="Z-INDEX: 101; LEFT: 792px; POSITION: absolute; TOP: 448px" runat="server"                    Width="94px" Height="24px" AutoPostBack="True" Enabled="False" onselectedindexchanged="DClass_SelectedIndexChanged"></asp:dropdownlist><asp:label id="Label1" style="Z-INDEX: 102; LEFT: 608px; POSITION: absolute; TOP: 448px" runat="server"                    Width="48px" Height="24px">年级:</asp:label><asp:linkbutton id="btnPrevious" style="Z-INDEX: 104; LEFT: 64px; POSITION: absolute; TOP: 424px"                    runat="server" Width="64px" onclick="btnPrevious_Click">前一页</asp:linkbutton><asp:linkbutton id="btnNext" style="Z-INDEX: 105; LEFT: 136px; POSITION: absolute; TOP: 424px" runat="server"                    Width="56px" onclick="btnNext_Click">下一页</asp:linkbutton><asp:datagrid id="DataGrid1" style="Z-INDEX: 106; LEFT: 64px; POSITION: absolute; TOP: 160px"                    runat="server" Width="816px" Height="32px" CellPadding="2" AutoGenerateColumns="False" AllowCustomPaging="True" AllowPaging="True">                    <HeaderStyle ForeColor="#FFFFCC" BackColor="#CC6600"></HeaderStyle>                    <Columns>                        <asp:BoundColumn DataField="id" HeaderText="序号"></asp:BoundColumn>                        <asp:BoundColumn DataField="Code" HeaderText="学号"></asp:BoundColumn>                        <asp:BoundColumn DataField="Name" HeaderText="姓名"></asp:BoundColumn>                        <asp:BoundColumn DataField="YuWen" HeaderText="语文"></asp:BoundColumn>                        <asp:BoundColumn DataField="ShuXue" HeaderText="数学"></asp:BoundColumn>                        <asp:BoundColumn DataField="YingYu" HeaderText="英语"></asp:BoundColumn>                        <asp:BoundColumn DataField="ZhengZhi" HeaderText="政治"></asp:BoundColumn>                        <asp:BoundColumn DataField="DianNao" HeaderText="电脑"></asp:BoundColumn>                        <asp:BoundColumn DataField="TiYu" HeaderText="体育"></asp:BoundColumn>                        <asp:BoundColumn DataField="MeiShu" HeaderText="美术"></asp:BoundColumn>                        <asp:BoundColumn DataField="YingYue" HeaderText="音乐"></asp:BoundColumn>                    </Columns>                    <PagerStyle Visible="False"></PagerStyle>                </asp:datagrid><asp:button id="Button1" style="Z-INDEX: 109; LEFT: 64px; POSITION: absolute; TOP: 480px" runat="server"                    Width="100px" Text="增加" Enabled="False" onclick="Button1_Click"></asp:button><asp:hyperlink id="HyperLink1" style="Z-INDEX: 114; LEFT: 128px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  Font-Size="Smaller" NavigateUrl="Teacher.aspx">教师档案</asp:hyperlink><asp:label id="Label3" style="Z-INDEX: 115; LEFT: 120px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:label><asp:image id="Image1" style="Z-INDEX: 138; LEFT: 64px; POSITION: absolute; TOP: 32px" runat="server"                    Width="816px" Height="120px" ImageUrl="image\top.JPG"></asp:image><asp:label id="Label16" style="Z-INDEX: 139; LEFT: 232px; POSITION: absolute; TOP: 504px" runat="server"                    Width="448px" Height="10px"></asp:label><asp:label id="Label17" style="Z-INDEX: 140; LEFT: 208px; POSITION: absolute; TOP: 528px" runat="server"                    Width="488px" Height="3px"></asp:label></FONT></form>    </body></HTML>

 

 //Result.aspx.cs

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 System.Configuration;            //配置类using System.Data.SqlClient;        //数据库ADO类namespace School{    /// <summary>    /// Index 的摘要说明。    /// </summary>    public partial class Result : System.Web.UI.Page    {        private int CurrentPage;        private ListItem item;        private String STest;        protected void Page_Load(object sender, System.EventArgs e)        {            // 在此处放置用户代码以初始化页面            System.Data.SqlClient.SqlDataReader dreader;            System.Data.SqlClient.SqlDataReader dreaderB;            if (Session["UserName"] == null || Session["UserName"].ToString() == "")            {                Response.Write("<hr><p><center>");                Response.Write("<h4>没有登录!点击");                Response.Write("<a href=http://www.mamicode.com/Default1.aspx>这儿");                Response.Write("进行登录</h4></center><p><hr>");                Response.End();            }            if (!Page.IsPostBack)            {                STest = "";                String strConn = ConfigurationSettings.AppSettings["SDataBase"];                // 连接到eForum数据库                SqlConnection cn = new SqlConnection(strConn);                // 打开连接                cn.Open();                // 构造SQL语句,该语句在RegUsers表中检查昵称和密码是否正确                String strSQL = "SELECT  * FROM Grade";                // 创建Command对象                SqlCommand cmdSave = new SqlCommand(strSQL, cn);                // 执行ExecuteReader()方法                  dreader = cmdSave.ExecuteReader();                DGrade.Items.Add(new ListItem("请选择", "-1"));                while (dreader.Read())                {                    DGrade.Items.Add(new ListItem(dreader["Grade"].ToString(), dreader["id"].ToString()));                }                dreader.Close();                DClass.Items.Add(new ListItem("请选择", "-1"));                DGrade.Enabled = true;                DClass.Enabled = true;                if (Session["Worker"].ToString() == "1")                {                    Button1.Enabled = true;                    Button2.Enabled = true;                    Button3.Enabled = true;                    Button4.Enabled = true;                    Button5.Enabled = true;                    Button6.Enabled = true;                    Button7.Enabled = true;                }                else                {                    Button1.Enabled = false;                    Button2.Enabled = false;                    Button3.Enabled = false;                    Button4.Enabled = false;                    Button5.Enabled = false;                    Button6.Enabled = false;                    Button7.Enabled = false;                    Button1.Visible = false;                    Button2.Visible = false;                    Button3.Visible = false;                    Button4.Visible = false;                    Button5.Visible = false;                    Button6.Visible = false;                    Button7.Visible = false;                }                CurrentPage = 0;                strSQL = " SELECT TOP 10 Result.id,Result.Code,Student.Name,YuWen,ShuXue,YingYu,ZhengZhi,DianNao,TiYu,MeiShu,YingYue  FROM Result "+ " left join Student on Student.Code=Result.Code "+ " order by Result.id asc ";                cmdSave = new SqlCommand(strSQL, cn);                FillGrid(cmdSave);                FillList(cmdSave);                /*                strSQL = "SELECT TOP 10 * FROM Result WHERE (id >= ‘0‘) AND (Grade = ‘" + DGrade.SelectedItem.Text +"‘) AND (Test = ‘" + STest + "‘) AND (Class =‘" + DClass.SelectedItem.Text + "‘) ORDER BY id";                cmdSave=new SqlCommand(strSQL,cn);                FillGrid(cmdSave);                                FillListCode(cmdSave);                */                cn.Close();            }        }        private void FillGrid(System.Data.SqlClient.SqlCommand currentSqlCommand)        {            System.Data.SqlClient.SqlDataReader dr;            dr = currentSqlCommand.ExecuteReader();            DataGrid1.DataSource = dr;            DataGrid1.DataBind();            if (dr.HasRows)        //当数据记录时            {                ViewState["CurrentPage"] = CurrentPage;                ViewState[CurrentPage.ToString()] = DataGrid1.Items[0].Cells[0].Text;                if (DataGrid1.Items.Count < DataGrid1.PageSize)                {                    btnNext.Enabled = false;                    btnPrevious.Enabled = true;                }                Button1.Enabled = true;                Button2.Enabled = true;                Button3.Enabled = true;                Button4.Enabled = true;                Button5.Enabled = true;                Button6.Enabled = true;                Button7.Enabled = true;            }            else            {                btnNext.Enabled = false;                btnPrevious.Enabled = false;                Button1.Enabled = true;                Button2.Enabled = false;                Button3.Enabled = false;                Button4.Enabled = true;                Button5.Enabled = false;                Button6.Enabled = false;                Button7.Enabled = false;            }            dr.Close();        }        private void FillList(System.Data.SqlClient.SqlCommand currentSqlCommand)        {            System.Data.SqlClient.SqlDataReader dr;            dr = currentSqlCommand.ExecuteReader();            if (dr.HasRows)        //当数据记录时            {                DropDownList2.Items.Clear();                while (dr.Read())                {                    DropDownList2.Items.Add(new ListItem(dr["id"].ToString(), dr["id"].ToString()));                }            }            dr.Close();        }        private void FillListCode(System.Data.SqlClient.SqlCommand currentSqlCommand)        {            System.Data.SqlClient.SqlDataReader dr;            dr = currentSqlCommand.ExecuteReader();            if (dr.HasRows)        //当数据记录时            {                DropDownList2.Items.Clear();                while (dr.Read())                {                    DropDownList2.Items.Add(new ListItem(dr["Code"].ToString()));                }            }            dr.Close();        }        #region Web 窗体设计器生成的代码        override protected void OnInit(EventArgs e)        {            //            // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。            //            InitializeComponent();            base.OnInit(e);        }        /// <summary>        /// 设计器支持所需的方法 - 不要使用代码编辑器修改        /// 此方法的内容。        /// </summary>        private void InitializeComponent()        {        }        #endregion        protected void btnPrevious_Click(object sender, System.EventArgs e)    //向上翻页        {            btnNext.Enabled = true;            CurrentPage = (int)(ViewState["CurrentPage"]);            CurrentPage--;            if (CurrentPage >= 0)            {                string firstid;                firstid = (string)(ViewState[CurrentPage.ToString()]);                String strConn = ConfigurationSettings.AppSettings["SDataBase"];                SqlConnection cn = new SqlConnection(strConn);                cn.Open();                //String strSQL = "SELECT Distinct Test FROM Result WHERE (Grade = ‘" + DGrade.SelectedItem.Text +"‘) AND (Class =‘" + DClass.SelectedItem.Text + "‘)";                //SqlCommand cmdSave=new SqlCommand(strSQL,cn);                //FillList(cmdSave);                string strSQL = " SELECT TOP 10 Result.id,Result.Code,Student.Name,YuWen,ShuXue,YingYu,ZhengZhi,DianNao,TiYu,MeiShu,YingYue  FROM Result "+ " left join Student on Student.Code=Result.Code "+ " where Result.id>=‘" + firstid + ""+ " order by Result.id asc ";                SqlCommand cmdSave = new SqlCommand(strSQL, cn);                FillGrid(cmdSave);                FillListCode(cmdSave);                cn.Close();            }            else            {                btnPrevious.Enabled = false;                btnNext.Enabled = true;            }        }        protected void btnNext_Click(object sender, System.EventArgs e)        //向下翻页        {            CurrentPage = (int)(ViewState["CurrentPage"]);            CurrentPage++;            if (DataGrid1.Items.Count >= DataGrid1.PageSize)            {                string lastid = DataGrid1.Items[9].Cells[0].Text;                String strConn = ConfigurationSettings.AppSettings["SDataBase"];                SqlConnection cn = new SqlConnection(strConn);                cn.Open();                string strSQL = " SELECT TOP 10 Result.id,Result.Code,Student.Name,YuWen,ShuXue,YingYu,ZhengZhi,DianNao,TiYu,MeiShu,YingYue  FROM Result "+ " left join Student on Student.Code=Result.Code "+ " where Result.id>=‘" + lastid + ""+ " order by Result.id asc ";                SqlCommand cmdSave = new SqlCommand(strSQL, cn);                FillGrid(cmdSave);                FillListCode(cmdSave);                cn.Close();            }            else            {                btnNext.Enabled = false;                btnPrevious.Enabled = true;            }        }        private void LinkButton10_Click(object sender, System.EventArgs e)        {            Session["UserName"] = "";            LiteralControl lc = new LiteralControl("<script>window.close();</script>");            Page.Controls.Add(lc);        }        protected void Button1_Click(object sender, System.EventArgs e)        {    //OperationType            Session["OperationType"] = "Add";            Response.Redirect("ResultAdd.aspx");        }        protected void Button3_Click(object sender, System.EventArgs e)        {            Session["OperationType"] = "Change";            if (DropDownList2.SelectedItem != null)                Session["UCode"] = DropDownList2.SelectedItem.Text;            else            {                Session["UCode"] = "";            }            Response.Redirect("ResultAdd.aspx");        }        protected void Button2_Click(object sender, System.EventArgs e)        {            String strConn = ConfigurationSettings.AppSettings["SDataBase"];            SqlConnection cn = new SqlConnection(strConn);            cn.Open();            String strSQL = " DELETE FROM  Result WHERE id=‘" + DropDownList2.SelectedValue + "";            SqlCommand cmdSave = new SqlCommand(strSQL, cn);            System.Data.SqlClient.SqlDataReader dr;            dr = cmdSave.ExecuteReader();            dr.Close();            cn.Close();            Response.Redirect("Result.aspx");        //做刷新窗口使用        }        public void ShowClientMessage(String msg)        {            String s = String.Format(                "<script language=javascript>var truthBeTold = alert(‘{0}‘);  </script>", msg);            //alert confirm prompt             //#if(NET_2_0)            //    ClientScript.RegisterStartupScript(this.GetType(), "FFBE5E5B-1D3D-4727-AA6A-057461409FDF", s);            //#elif(NET_1_1)            this.RegisterStartupScript("FFBE5E5B-1D3D-4727-AA6A-057461409FDE", s);            //#endif        }        public void ReturnWindow(String msg)        {            String s = String.Format(                "<script language=javascript>window.location.href(‘{0}‘);</script>", msg);            //#if(NET_2_0)            //    ClientScript.RegisterStartupScript(this.GetType(), "FFBE5E5B-1D3D-4727-AA6A-057461409FDF", s);            //#elif(NET_1_1)            this.RegisterStartupScript("FFBE5E5B-1D3E-4727-AA6A-057461409FDE", s);            //#endif        }        protected void DGrade_SelectedIndexChanged(object sender, System.EventArgs e)        {            String strConn = ConfigurationSettings.AppSettings["SDataBase"];            SqlConnection cn = new SqlConnection(strConn);            cn.Open();            string strSQL = " SELECT TOP 10 Result.id,Result.Code,Student.Name,YuWen,ShuXue,YingYu,ZhengZhi,DianNao,TiYu,MeiShu,YingYue  "+ " FROM Result "+ " left join Student on Student.Code=Result.Code " + " left join Class on Student.Classid=Class.id " + " left join Grade on Class.Gradeid=Grade.id " + " where Class.Gradeid=‘" + DGrade.SelectedValue + "" + " order by Result.id asc ";            SqlCommand cmdSave = new SqlCommand(strSQL, cn);            FillGrid(cmdSave);            FillList(cmdSave);            cn.Close();            FillClass(DGrade.SelectedValue);            //btnNext.Enabled = true;            //btnPrevious.Enabled = true;        }        protected void FillClass(string gradeid)        {            String strConn = ConfigurationSettings.AppSettings["SDataBase"];            // 连接到eForum数据库            SqlConnection cn = new SqlConnection(strConn);            // 打开连接            cn.Open();            // 构造SQL语句,该语句在RegUsers表中检查昵称和密码是否正确            String strSQL = "SELECT * FROM Class where gradeid=" + gradeid + " order by id asc";            // 创建Command对象            SqlCommand cmdSave = new SqlCommand(strSQL, cn);            // 执行ExecuteReader()方法              System.Data.SqlClient.SqlDataReader dreader;            dreader = cmdSave.ExecuteReader();            DClass.Items.Clear();            DClass.Items.Add(new ListItem("请选择", "-1"));            while (dreader.Read())            {                DClass.Items.Add(new ListItem(dreader["Class"].ToString(), dreader["id"].ToString()));            }            dreader.Close();        }        protected void DClass_SelectedIndexChanged(object sender, System.EventArgs e)        {            String strConn = ConfigurationSettings.AppSettings["SDataBase"];            SqlConnection cn = new SqlConnection(strConn);            cn.Open();            string strSQL = " SELECT TOP 10 Result.id,Result.Code,Student.Name,YuWen,ShuXue,YingYu,ZhengZhi,DianNao,TiYu,MeiShu,YingYue  "+ " FROM Result "+ " left join Student on Student.Code=Result.Code "+ " left join Class on Student.Classid=Class.id "+ " left join Grade on Class.Gradeid=Grade.id "  + " where Class.id=‘" + DClass.SelectedValue + ""+ " order by Result.id asc ";                       SqlCommand cmdSave = new SqlCommand(strSQL, cn);            FillGrid(cmdSave);            FillList(cmdSave);            cn.Close();            //btnNext.Enabled = true;            //btnPrevious.Enabled = true;        }        protected void DropDownList1_SelectedIndexChanged(object sender, System.EventArgs e)        {            String strConn = ConfigurationSettings.AppSettings["SDataBase"];            SqlConnection cn = new SqlConnection(strConn);            cn.Open();            String strSQL = "SELECT TOP 10 * FROM Result WHERE (id >= ‘0‘) AND (Grade = ‘" + DGrade.SelectedItem.Text + "‘) AND (Test = ‘" + DropDownList1.SelectedItem.Text + "‘) AND (Class =‘" + DClass.SelectedItem.Text + "‘) ORDER BY id";            SqlCommand cmdSave = new SqlCommand(strSQL, cn);            FillGrid(cmdSave);            FillListCode(cmdSave);            //FillList(cmdSave);            cn.Close();            //btnNext.Enabled = true;            //btnPrevious.Enabled = true;        }        protected void Button5_Click(object sender, System.EventArgs e)        {            Session["UGrade"] = DGrade.SelectedItem.Text;            Session["UClass"] = DClass.SelectedItem.Text;            Response.Redirect("ResultInform.aspx");        }        protected void Button6_Click(object sender, System.EventArgs e)        {            Session["UGrade"] = DGrade.SelectedItem.Text;            Session["UClass"] = DClass.SelectedItem.Text;            Response.Redirect("GroupInform.aspx");        }        protected void Button7_Click(object sender, System.EventArgs e)        {            String strConn = ConfigurationSettings.AppSettings["SDataBase"];            SqlConnection cn = new SqlConnection(strConn);            cn.Open();            String strSQL = "DELETE FROM  Result WHERE (Grade =‘" + DGrade.SelectedItem.Text + "‘) AND (Class =‘" + DClass.SelectedItem.Text + "‘) AND (Test =‘" + DropDownList1.SelectedItem.Text + "‘)";            SqlCommand cmdSave = new SqlCommand(strSQL, cn);            System.Data.SqlClient.SqlDataReader dr;            dr = cmdSave.ExecuteReader();            dr.Close();            cn.Close();            Response.Redirect("Result.aspx");        //做刷新窗口使用        }        protected void Button4_Click(object sender, System.EventArgs e)        {            Session["UGrade"] = DGrade.SelectedItem.Text;            Session["UClass"] = DClass.SelectedItem.Text;            Response.Redirect("ResultCrea.aspx");        }    }}

七、班级档案

  //Class.aspx

<%@ Page language="c#" Inherits="School.Class" CodeFile="Class.aspx.cs" %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" ><HTML>    <HEAD>        <title>教师档案信息管理!</title><link href=http://www.mamicode.com/"css/cww.css" rel="stylesheet" type="text/css" />        <STYLE>BODY { SCROLLBAR-FACE-COLOR: #24b4fc; SCROLLBAR-HIGHLIGHT-COLOR: #fcfcfc; SCROLLBAR-3DLIGHT-COLOR: #d8d8fc; SCROLLBAR-BASE-COLOR: #24fcfc }        </STYLE>        <style type="text/css">A:hover { COLOR: #d15b0c }    A:link { TEXT-DECORATION: none }    A:visited { TEXT-DECORATION: none }    A:active { TEXT-DECORATION: none }        </style>        <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">        <meta content="C#" name="CODE_LANGUAGE">        <meta content="JavaScript" name="vs_defaultClientScript">        <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">    </HEAD>    <body style="background-image:url(‘image/16.jpg‘);">        <form id="Form1" method="post" runat="server">            <FONT face="宋体">                <asp:Label id="Label15" style="Z-INDEX: 137; LEFT: 440px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:Label>                <asp:Label id="Label14" style="Z-INDEX: 136; LEFT: 504px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:Label>                <asp:Label id="Label13" style="Z-INDEX: 135; LEFT: 632px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:Label>                <asp:Label id="Label12" style="Z-INDEX: 134; LEFT: 568px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:Label>                <asp:Label id="Label11" style="Z-INDEX: 133; LEFT: 824px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:Label>                <asp:Label id="Label10" style="Z-INDEX: 132; LEFT: 760px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:Label>                <asp:Label id="Label9" style="Z-INDEX: 131; LEFT: 696px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:Label>                <asp:Label id="Label8" style="Z-INDEX: 130; LEFT: 376px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:Label>                <asp:Label id="Label7" style="Z-INDEX: 129; LEFT: 312px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:Label>                <asp:Label id="Label6" style="Z-INDEX: 128; LEFT: 248px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:Label>                <asp:HyperLink id="HyperLink13" style="Z-INDEX: 127; LEFT: 512px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  NavigateUrl="Remark.aspx" Font-Size="Smaller">教师评语</asp:HyperLink>                <asp:HyperLink id="HyperLink12" style="Z-INDEX: 126; LEFT: 832px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  NavigateUrl="Help.aspx" Font-Size="Smaller">帮助说明</asp:HyperLink>                <asp:HyperLink id="HyperLink11" style="Z-INDEX: 125; LEFT: 768px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  NavigateUrl="Sysexit.aspx" Font-Size="Smaller">退出系统</asp:HyperLink>                <asp:HyperLink id="HyperLink10" style="Z-INDEX: 124; LEFT: 704px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  NavigateUrl="Runlog.aspx" Font-Size="Smaller">系统日志</asp:HyperLink>                <asp:HyperLink id="HyperLink9" style="Z-INDEX: 123; LEFT: 576px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  NavigateUrl="Query.aspx" Font-Size="Smaller">同学互评</asp:HyperLink>                <asp:HyperLink id="HyperLink8" style="Z-INDEX: 122; LEFT: 640px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  NavigateUrl="Exchange.aspx" Font-Size="Smaller">交流频道</asp:HyperLink>                <asp:HyperLink id="HyperLink7" style="Z-INDEX: 121; LEFT: 448px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  NavigateUrl="Smssend.aspx" Font-Size="Smaller">家长寄语</asp:HyperLink>                <asp:HyperLink id="HyperLink6" style="Z-INDEX: 120; LEFT: 384px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  NavigateUrl="Result.aspx" Font-Size="Smaller">成绩档案</asp:HyperLink>                <asp:HyperLink id="HyperLink5" style="Z-INDEX: 119; LEFT: 320px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  NavigateUrl="Class.aspx" Font-Size="Smaller"                    Enabled="False" CssClass="curstyle" >班级档案</asp:HyperLink>                <asp:HyperLink id="HyperLink4" style="Z-INDEX: 118; LEFT: 256px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  NavigateUrl="Grade.aspx" Font-Size="Smaller">年级档案</asp:HyperLink>                <asp:HyperLink id="HyperLink3" style="Z-INDEX: 117; LEFT: 192px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  NavigateUrl="Student.aspx" Font-Size="Smaller">学生档案</asp:HyperLink>                <asp:Label id="Label5" style="Z-INDEX: 116; LEFT: 184px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:Label>                <asp:HyperLink id="HyperLink2" style="Z-INDEX: 113; LEFT: 64px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  NavigateUrl="Default1.aspx" Font-Size="Smaller">系统首页</asp:HyperLink><asp:button id="Button3" style="Z-INDEX: 112; LEFT: 360px; POSITION: absolute; TOP: 448px" runat="server"                    Width="112px" Text="修改" onclick="Button3_Click"></asp:button><asp:label id="Label4" style="Z-INDEX: 109; LEFT: 64px; POSITION: absolute; TOP: 448px" runat="server"                    Width="48px" Height="24px">班级:</asp:label><asp:dropdownlist id="DropDownList1" style="Z-INDEX: 108; LEFT: 104px; POSITION: absolute; TOP: 448px"                    runat="server" Width="112px" Height="24px"></asp:dropdownlist><asp:linkbutton id="btnPrevious" style="Z-INDEX: 105; LEFT: 64px; POSITION: absolute; TOP: 424px"                    runat="server" Width="64px" onclick="btnPrevious_Click">前一页</asp:linkbutton><asp:linkbutton id="btnNext" style="Z-INDEX: 106; LEFT: 136px; POSITION: absolute; TOP: 424px" runat="server"                    Width="56px" onclick="btnNext_Click">下一页</asp:linkbutton>                    <asp:datagrid id="DataGrid1" style="Z-INDEX: 107; LEFT: 64px; POSITION: absolute; TOP: 160px"                    runat="server" Height="32px" Width="816px" CellPadding="2" AutoGenerateColumns="False" AllowCustomPaging="True" AllowPaging="True">                    <HeaderStyle ForeColor="#FFFFCC" BackColor="#CC6600"></HeaderStyle>                    <Columns>                        <asp:BoundColumn DataField="id" HeaderText="序号"></asp:BoundColumn>                        <asp:BoundColumn DataField="Grade" HeaderText="年级"></asp:BoundColumn>                        <asp:BoundColumn DataField="Class" HeaderText="班级"></asp:BoundColumn>                        <asp:BoundColumn DataField="Count" HeaderText="总人数"></asp:BoundColumn>                        <asp:BoundColumn DataField="BoyCount" HeaderText="男生数"></asp:BoundColumn>                        <asp:BoundColumn DataField="GirlCount" HeaderText="女生数"></asp:BoundColumn>                        <asp:BoundColumn DataField="Teacher" HeaderText="班主任"></asp:BoundColumn>                        <asp:BoundColumn DataField="Phone" HeaderText="联系电话"></asp:BoundColumn>                    </Columns>                    <PagerStyle Visible="False"></PagerStyle>                </asp:datagrid><asp:button id="Button1" style="Z-INDEX: 110; LEFT: 232px; POSITION: absolute; TOP: 448px" runat="server"                    Width="112px" Text="增加" onclick="Button1_Click"></asp:button>                <asp:HyperLink id="HyperLink1" style="Z-INDEX: 114; LEFT: 128px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px" NavigateUrl="Teacher.aspx"  Font-Size="Smaller">教师档案</asp:HyperLink>                <asp:Label id="Label3" style="Z-INDEX: 115; LEFT: 120px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:Label>                <asp:Image id="Image1" style="Z-INDEX: 138; LEFT: 64px; POSITION: absolute; TOP: 32px" runat="server"                    Height="120px" Width="816px" ImageUrl="image\top.JPG"></asp:Image>                <asp:Label id="Label16" style="Z-INDEX: 139; LEFT: 232px; POSITION: absolute; TOP: 504px" runat="server"                    Height="10px" Width="448px"></asp:Label>                <asp:Label id="Label17" style="Z-INDEX: 140; LEFT: 208px; POSITION: absolute; TOP: 528px" runat="server"                    Height="3px" Width="488px"></asp:Label></FONT></form>    </body></HTML>

 

  //Class.aspx.cs

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 System.Configuration;            //配置类using System.Data.SqlClient;        //数据库ADO类namespace School{    /// <summary>    /// Index 的摘要说明。    /// </summary>    public partial class Class : System.Web.UI.Page    {        private int CurrentPage;        private ListItem item;            protected void Page_Load(object sender, System.EventArgs e)        {            // 在此处放置用户代码以初始化页面            System.Data.SqlClient.SqlDataReader dreader;            if (Session["UserName"] == null || Session["UserName"].ToString() == "")            {                Response.Write("<hr><p><center>");                Response.Write("<h4>没有登录!点击");                Response.Write("<a href=http://www.mamicode.com/Default1.aspx>这儿");                Response.Write("进行登录</h4></center><p><hr>");                Response.End();            }                                    if (!Page.IsPostBack)            {                String strConn=ConfigurationSettings.AppSettings["SDataBase"];                // 连接到eForum数据库                SqlConnection cn=new SqlConnection(strConn);                // 打开连接                cn.Open();                                                if (Session["Worker"].ToString() == "1")                {                    Button1.Enabled = true;                                        Button3.Enabled = true;                }                else                {                    Button1.Enabled = false;                                    Button3.Enabled = false;                    Button1.Visible = false;                    Button3.Visible= false;                }                CurrentPage = 0;                // 构造SQL语句,该语句在RegUsers表中检查昵称和密码是否正确                String strSQL="select Class.id as id,Grade.Grade,Class.Class,Class.id as Count,Class.id as BoyCount,"+" Class.id as GirlCount,Teacher.Name as Teacher,Teacher.Tele as Phone "+" from Class "+" left join Teacher on Teacher.id=Class.TeacherID "+" left join Grade on Grade.id=Class.Gradeid "+" order by Class.id ";                // 创建Command对象                SqlCommand cmdSave=new SqlCommand(strSQL,cn);                // 执行ExecuteReader()方法                  FillGrid(cmdSave);                FillList(cmdSave);                cn.Close();            }        }        private void FillGrid(System.Data.SqlClient.SqlCommand currentSqlCommand)        {            System.Data.SqlClient.SqlDataReader dr;            dr = currentSqlCommand.ExecuteReader();            DataGrid1.DataSource = dr;            DataGrid1.DataBind();            if (dr.HasRows)        //当数据记录时            {                ViewState["CurrentPage"] = CurrentPage;                ViewState[CurrentPage.ToString()] = DataGrid1.Items[0].Cells[0].Text;                                if (DataGrid1.Items.Count < DataGrid1.PageSize)                {                    btnNext.Enabled = false;                    btnPrevious.Enabled = true;                }            }            else            {                btnNext.Enabled = false;                btnPrevious.Enabled = false;            }            dr.Close();            for (int i = 0; i < DataGrid1.Items.Count; i++)            {                string id = DataGrid1.Items[i].Cells[0].Text.ToString();                DataGrid1.Items[i].Cells[3].Text = GetCount(id);                DataGrid1.Items[i].Cells[4].Text = GetBoyCount(id);                DataGrid1.Items[i].Cells[5].Text = GetGirlCount(id);            }        }        protected string GetCount(string id)        {            String strConn = ConfigurationSettings.AppSettings["SDataBase"];            // 连接到eForum数据库            SqlConnection cn = new SqlConnection(strConn);            // 打开连接            cn.Open();            string sql = " select count(*) from student where classid=‘" + id + "";            SqlCommand cmdSave = new SqlCommand(sql, cn);            string ret = cmdSave.ExecuteScalar().ToString();            cn.Close();            return ret;        }        protected string GetBoyCount(string id)        {            String strConn = ConfigurationSettings.AppSettings["SDataBase"];            // 连接到eForum数据库            SqlConnection cn = new SqlConnection(strConn);            // 打开连接            cn.Open();            string sql = " select count(*) from student where classid=‘" + id + "‘ and Sex=‘男‘ ";            SqlCommand cmdSave = new SqlCommand(sql, cn);            string ret = cmdSave.ExecuteScalar().ToString();            cn.Close();            return ret;        }        protected string GetGirlCount(string id)        {            String strConn = ConfigurationSettings.AppSettings["SDataBase"];            // 连接到eForum数据库            SqlConnection cn = new SqlConnection(strConn);            // 打开连接            cn.Open();            string sql = " select count(*) from student where classid=‘" + id + "‘ and Sex=‘女‘ ";            SqlCommand cmdSave = new SqlCommand(sql, cn);            string ret = cmdSave.ExecuteScalar().ToString();            cn.Close();            return ret;        }        private void FillList(System.Data.SqlClient.SqlCommand currentSqlCommand)        {            System.Data.SqlClient.SqlDataReader dr;            dr = currentSqlCommand.ExecuteReader();            if (dr.HasRows)        //当数据记录时            {                DropDownList1.Items.Clear();                while (dr.Read())                {                    DropDownList1.Items.Add(new ListItem(dr["Class"].ToString(),dr["id"].ToString()));                }                                                            }            dr.Close();                    }        #region Web 窗体设计器生成的代码        override protected void OnInit(EventArgs e)        {            //            // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。            //            InitializeComponent();            base.OnInit(e);        }                /// <summary>        /// 设计器支持所需的方法 - 不要使用代码编辑器修改        /// 此方法的内容。        /// </summary>        private void InitializeComponent()        {            }        #endregion        protected void btnPrevious_Click(object sender, System.EventArgs e)    //向上翻页        {            btnNext.Enabled = true;            CurrentPage = (int)(ViewState["CurrentPage"]);            CurrentPage--;            if (CurrentPage >= 0)             {                string firstid;                firstid = (string)(ViewState[CurrentPage.ToString()]);                String strConn=ConfigurationSettings.AppSettings["SDataBase"];                SqlConnection cn=new SqlConnection(strConn);                cn.Open();                        String strSQL = "select Class.id as id,Grade.Grade,Class.Class,Class.id as Count,Class.id as BoyCount,"+ " Class.id as GirlCount,Teacher.Name as Teacher,Teacher.Tele as Phone "+ " from Class "+ " left join Teacher on Teacher.id=Class.TeacherID "+ " left join Grade on Grade.id=Class.Gradeid "+ "  WHERE (Class.id >= ‘" + firstid + "‘) "+ " order by Class.id ";                SqlCommand cmdSave=new SqlCommand(strSQL,cn);                FillGrid(cmdSave);                FillList(cmdSave);                cn.Close();            }            else            {                btnPrevious.Enabled = false;                btnNext.Enabled = true;            }        }        protected void btnNext_Click(object sender, System.EventArgs e)        //向下翻页        {            CurrentPage = (int)(ViewState["CurrentPage"]);            CurrentPage++;            if (DataGrid1.Items.Count >= DataGrid1.PageSize)            {                string lastid = DataGrid1.Items[9].Cells[0].Text;                String strConn=ConfigurationSettings.AppSettings["SDataBase"];                SqlConnection cn=new SqlConnection(strConn);                cn.Open();                String strSQL = "select Class.id as id,Grade.Grade,Class.Class,Class.id as Count,Class.id as BoyCount,"+ " Class.id as GirlCount,Teacher.Name as Teacher,Teacher.Tele as Phone "+ " from Class "+ " left join Teacher on Teacher.id=Class.TeacherID "+ " left join Grade on Grade.id=Class.Gradeid "+ "  WHERE (Class.id >= ‘" + lastid + "‘) "+ " order by Class.id ";                SqlCommand cmdSave=new SqlCommand(strSQL,cn);                FillGrid(cmdSave);                FillList(cmdSave);                cn.Close();            }            else            {                btnNext.Enabled = false;                btnPrevious.Enabled = true;            }        }        private void LinkButton10_Click(object sender, System.EventArgs e)        {            Session["UserName"]="";            LiteralControl lc = new LiteralControl("<script>window.close();</script>");            Page.Controls.Add(lc);        }                protected void Button1_Click(object sender, System.EventArgs e)        {                Session["OperationType"] = "Add";            FillSesstion();            Response.Redirect("ClassAdd.aspx");        }                protected void Button3_Click(object sender, System.EventArgs e)        {            Session["OperationType"] = "Change";            FillSesstion();            Response.Redirect("ClassAdd.aspx");                    }        protected void FillSesstion()        {            if (DropDownList1.SelectedItem != null)            {                Session["UClassid"] = DropDownList1.SelectedItem.Value;            }            else            {                Session["UClassid"] = "";            }            if (Session["UClassid"] == "")            {                Session["UGradeid"] = "";            }            else            {                String strConn = ConfigurationSettings.AppSettings["SDataBase"];                // 连接到eForum数据库                SqlConnection cn = new SqlConnection(strConn);                // 打开连接                cn.Open();                string strSQL = "  select  id,Gradeid  from Class where id=‘"+Session["UClassid"]+"";                // 创建Command对象                SqlCommand cmdSave = new SqlCommand(strSQL, cn);                System.Data.SqlClient.SqlDataReader dr;                dr = cmdSave.ExecuteReader();                if (dr.HasRows)        //当数据记录时                {                                       if (dr.Read())                    {                       Session["UGradeid"] =dr["Gradeid"].ToString();                    }                }                dr.Close();                cn.Close();            }        }        protected void Button2_Click(object sender, System.EventArgs e)        {            String strConn=ConfigurationSettings.AppSettings["SDataBase"];            SqlConnection cn=new SqlConnection(strConn);            cn.Open();            String strSQL = "DELETE FROM  Class WHERE  Class = ‘" + DropDownList1.SelectedItem.Text + "";            SqlCommand cmdSave=new SqlCommand(strSQL,cn);            System.Data.SqlClient.SqlDataReader dr;            dr = cmdSave.ExecuteReader();            dr.Close();            cn.Close();            Response.Redirect("Class.aspx");        //做刷新窗口使用                }        public void ShowClientMessage(String msg)        {                        String s = String.Format(                "<script language=javascript>var truthBeTold = alert(‘{0}‘);  </script>", msg);                    //alert confirm prompt             //#if(NET_2_0)            //    ClientScript.RegisterStartupScript(this.GetType(), "FFBE5E5B-1D3D-4727-AA6A-057461409FDF", s);            //#elif(NET_1_1)                this.RegisterStartupScript("FFBE5E5B-1D3D-4727-AA6A-057461409FDE", s);            //#endif        }        public void ReturnWindow(String msg)        {                        String s = String.Format(                "<script language=javascript>window.location.href(‘{0}‘);</script>", msg);            //#if(NET_2_0)            //    ClientScript.RegisterStartupScript(this.GetType(), "FFBE5E5B-1D3D-4727-AA6A-057461409FDF", s);            //#elif(NET_1_1)            this.RegisterStartupScript("FFBE5E5B-1D3E-4727-AA6A-057461409FDE", s);            //#endif                    }        }}

八、退出系统

  //Sysexit.aspx

<%@ Page language="c#" Inherits="School.Sysexit" CodeFile="Sysexit.aspx.cs" %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" ><HTML>    <HEAD>        <title>教师档案信息管理!</title><link href=http://www.mamicode.com/"css/cww.css" rel="stylesheet" type="text/css" />        <STYLE>BODY { SCROLLBAR-FACE-COLOR: #24b4fc; SCROLLBAR-HIGHLIGHT-COLOR: #fcfcfc; SCROLLBAR-3DLIGHT-COLOR: #d8d8fc; SCROLLBAR-BASE-COLOR: #24fcfc }        </STYLE>        <style type="text/css">A:hover { COLOR: #d15b0c }    A:link { TEXT-DECORATION: none }    A:visited { TEXT-DECORATION: none }    A:active { TEXT-DECORATION: none }        </style>        <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">        <meta content="C#" name="CODE_LANGUAGE">        <meta content="JavaScript" name="vs_defaultClientScript">        <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">    </HEAD>    <body style="background-image:url(‘image/4.jpg‘);">        <form id="Form1" method="post" runat="server">            <FONT face="宋体">                <asp:Label id="Label19" style="Z-INDEX: 130; LEFT: 200px; POSITION: absolute; TOP: 256px" runat="server"                    Height="2px" Width="432px">正常启动退出系统,有助于保护密码的安全性,请正确使用!</asp:Label>                <asp:Label id="Label1" style="Z-INDEX: 131; LEFT: 208px; POSITION: absolute; TOP: 304px" runat="server"                    Width="416px" Height="2px">系统20分钟空闲时,将自动退出系统,此时需要重新登录!</asp:Label>                <asp:Label id="Label15" style="Z-INDEX: 124; LEFT: 440px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:Label>                <asp:Label id="Label14" style="Z-INDEX: 123; LEFT: 504px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:Label>                <asp:Label id="Label13" style="Z-INDEX: 122; LEFT: 632px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:Label>                <asp:Label id="Label12" style="Z-INDEX: 121; LEFT: 568px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:Label>                <asp:Label id="Label11" style="Z-INDEX: 120; LEFT: 824px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:Label>                <asp:Label id="Label10" style="Z-INDEX: 119; LEFT: 760px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:Label>                <asp:Label id="Label9" style="Z-INDEX: 118; LEFT: 696px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:Label>                <asp:Label id="Label8" style="Z-INDEX: 117; LEFT: 376px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:Label>                <asp:Label id="Label7" style="Z-INDEX: 116; LEFT: 312px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:Label>                <asp:Label id="Label6" style="Z-INDEX: 115; LEFT: 248px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:Label>                <asp:HyperLink id="HyperLink13" style="Z-INDEX: 114; LEFT: 512px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  NavigateUrl="Remark.aspx" Font-Size="Smaller">教师评语</asp:HyperLink>                <asp:HyperLink id="HyperLink12" style="Z-INDEX: 113; LEFT: 832px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  NavigateUrl="Help.aspx" Font-Size="Smaller">帮助说明</asp:HyperLink>                <asp:HyperLink id="HyperLink11" style="Z-INDEX: 112; LEFT: 768px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  NavigateUrl="Sysexit.aspx" Font-Size="Smaller" CssClass="curstyle" >退出系统</asp:HyperLink>                <asp:HyperLink id="HyperLink10" style="Z-INDEX: 111; LEFT: 704px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  NavigateUrl="Runlog.aspx" Font-Size="Smaller">系统日志</asp:HyperLink>                <asp:HyperLink id="HyperLink9" style="Z-INDEX: 110; LEFT: 576px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  NavigateUrl="Query.aspx" Font-Size="Smaller">同学互评</asp:HyperLink>                <asp:HyperLink id="HyperLink8" style="Z-INDEX: 109; LEFT: 640px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  NavigateUrl="Exchange.aspx" Font-Size="Smaller">交流频道</asp:HyperLink>                <asp:HyperLink id="HyperLink7" style="Z-INDEX: 108; LEFT: 448px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  NavigateUrl="Smssend.aspx" Font-Size="Smaller"                    Enabled="False">家长寄语</asp:HyperLink>                <asp:HyperLink id="HyperLink6" style="Z-INDEX: 107; LEFT: 384px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  NavigateUrl="Result.aspx" Font-Size="Smaller">成绩档案</asp:HyperLink>                <asp:HyperLink id="HyperLink5" style="Z-INDEX: 106; LEFT: 320px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  NavigateUrl="Class.aspx" Font-Size="Smaller">班级档案</asp:HyperLink>                <asp:HyperLink id="HyperLink4" style="Z-INDEX: 105; LEFT: 256px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  NavigateUrl="Grade.aspx" Font-Size="Smaller">年级档案</asp:HyperLink>                <asp:HyperLink id="HyperLink3" style="Z-INDEX: 104; LEFT: 192px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  NavigateUrl="Student.aspx" Font-Size="Smaller">学生档案</asp:HyperLink>                <asp:Label id="Label5" style="Z-INDEX: 103; LEFT: 184px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:Label>                <asp:HyperLink id="HyperLink2" style="Z-INDEX: 100; LEFT: 64px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px"  NavigateUrl="Default1.aspx" Font-Size="Smaller">系统首页</asp:HyperLink>                <asp:HyperLink id="HyperLink1" style="Z-INDEX: 101; LEFT: 128px; POSITION: absolute; TOP: 16px"                    runat="server" Width="56px" Height="8px" NavigateUrl="Teacher.aspx"  Font-Size="Smaller">教师档案</asp:HyperLink>                <asp:Label id="Label3" style="Z-INDEX: 102; LEFT: 120px; POSITION: absolute; TOP: 16px" runat="server"                    Width="8px"  Font-Size="Smaller">|</asp:Label>                <asp:Image id="Image1" style="Z-INDEX: 125; LEFT: 64px; POSITION: absolute; TOP: 32px" runat="server"                    Height="120px" Width="816px" ImageUrl="image\top.JPG"></asp:Image>                <asp:Label id="Label16" style="Z-INDEX: 126; LEFT: 232px; POSITION: absolute; TOP: 504px" runat="server"                    Height="10px" Width="448px"></asp:Label>                <asp:Label id="Label17" style="Z-INDEX: 127; LEFT: 208px; POSITION: absolute; TOP: 528px" runat="server"                    Height="3px" Width="488px"></asp:Label>                <asp:Label id="Label18" style="Z-INDEX: 128; LEFT: 264px; POSITION: absolute; TOP: 200px" runat="server"                    Height="2px" Width="304px">你已经成功退出系统,欢迎下次再次登录!</asp:Label></FONT></form>    </body></HTML>

 

  //Sysexit.aspx.cs

  

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 System.Configuration;            //配置类using System.Data.SqlClient;        //数据库ADO类namespace School{    /// <summary>    /// Index 的摘要说明。    /// </summary>    public partial class Sysexit : System.Web.UI.Page    {        private int CurrentPage;        private ListItem item;            protected void Page_Load(object sender, System.EventArgs e)        {            // 在此处放置用户代码以初始化页面            if (Session["UserName"]==null|| Session["UserName"].ToString()=="")             {                Response.Write("<hr><p><center>");                Response.Write("<h4>没有登录!点击");                Response.Write("<a href=http://www.mamicode.com/Default1.aspx>这儿");                Response.Write("进行登录</h4></center><p><hr>");                Response.End();            }                                    if (!Page.IsPostBack)            {                Session["UserName"] = "";                Session["OperationType"] = "";                Session["UTest"] = "";                Session["UCode"] = "";                Session["UGrade"] = "";                Session["UClass"] = "";                            }        }                        #region Web 窗体设计器生成的代码        override protected void OnInit(EventArgs e)        {            //            // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。            //            InitializeComponent();            base.OnInit(e);        }                /// <summary>        /// 设计器支持所需的方法 - 不要使用代码编辑器修改        /// 此方法的内容。        /// </summary>        private void InitializeComponent()        {            }        #endregion                                                                        public void ShowClientMessage(String msg)        {                        String s = String.Format(                "<script language=javascript>var truthBeTold = alert(‘{0}‘);  </script>", msg);                    //alert confirm prompt             //#if(NET_2_0)            //    ClientScript.RegisterStartupScript(this.GetType(), "FFBE5E5B-1D3D-4727-AA6A-057461409FDF", s);            //#elif(NET_1_1)                this.RegisterStartupScript("FFBE5E5B-1D3D-4727-AA6A-057461409FDE", s);            //#endif        }        public void ReturnWindow(String msg)        {                        String s = String.Format(                "<script language=javascript>window.location.href(‘{0}‘);</script>", msg);            //#if(NET_2_0)            //    ClientScript.RegisterStartupScript(this.GetType(), "FFBE5E5B-1D3D-4727-AA6A-057461409FDF", s);            //#elif(NET_1_1)            this.RegisterStartupScript("FFBE5E5B-1D3E-4727-AA6A-057461409FDE", s);            //#endif                    }            }}
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 System.Configuration;            //配置类using System.Data.SqlClient;        //数据库ADO类namespace School{    /// <summary>    /// Index 的摘要说明。    /// </summary>    public partial class Sysexit : System.Web.UI.Page    {        private int CurrentPage;        private ListItem item;            protected void Page_Load(object sender, System.EventArgs e)        {            // 在此处放置用户代码以初始化页面            if (Session["UserName"]==null|| Session["UserName"].ToString()=="")             {                Response.Write("<hr><p><center>");                Response.Write("<h4>没有登录!点击");                Response.Write("<a href=http://www.mamicode.com/Default1.aspx>这儿");                Response.Write("进行登录</h4></center><p><hr>");                Response.End();            }                                    if (!Page.IsPostBack)            {                Session["UserName"] = "";                Session["OperationType"] = "";                Session["UTest"] = "";                Session["UCode"] = "";                Session["UGrade"] = "";                Session["UClass"] = "";                            }        }                        #region Web 窗体设计器生成的代码        override protected void OnInit(EventArgs e)        {            //            // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。            //            InitializeComponent();            base.OnInit(e);        }                /// <summary>        /// 设计器支持所需的方法 - 不要使用代码编辑器修改        /// 此方法的内容。        /// </summary>        private void InitializeComponent()        {            }        #endregion                                                                        public void ShowClientMessage(String msg)        {                        String s = String.Format(                "<script language=javascript>var truthBeTold = alert(‘{0}‘);  </script>", msg);                    //alert confirm prompt             //#if(NET_2_0)            //    ClientScript.RegisterStartupScript(this.GetType(), "FFBE5E5B-1D3D-4727-AA6A-057461409FDF", s);            //#elif(NET_1_1)                this.RegisterStartupScript("FFBE5E5B-1D3D-4727-AA6A-057461409FDE", s);            //#endif        }        public void ReturnWindow(String msg)        {                        String s = String.Format(                "<script language=javascript>window.location.href(‘{0}‘);</script>", msg);            //#if(NET_2_0)            //    ClientScript.RegisterStartupScript(this.GetType(), "FFBE5E5B-1D3D-4727-AA6A-057461409FDF", s);            //#elif(NET_1_1)            this.RegisterStartupScript("FFBE5E5B-1D3E-4727-AA6A-057461409FDE", s);            //#endif                    }            }}