📄 testmanage.aspx.cs.svn-base
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class TestManage_TestManage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["USERSTYLE"] == "TEACHER")
{
}
else
{
Dialog("对不起,你没有权限访问这个页面!");
Response.Redirect("~/SystemManage/Login.aspx");
}
}
private void Dialog(String Str)
{
Response.Write(@"<script type='text/JavaScript'>");
Response.Write(@"alert('" + Str + "');");
//Response.Write(@"window.location='./list_logingroup.aspx';");
Response.Write(@"</script>");
}
protected void BtnReadTextInfo_Click(object sender, EventArgs e)
{
SqlData sql = new SqlData();
String[] StrAll ={ "不存在此试卷编号的信息!","你没有权限访问此试卷的信息!"};
String StrTestNo = TxtTestNo.Text.ToString();
String TableName = "TAB_TESTINFO";
String ColumnName="TESTNO";
String[] Column ={ "SETTEXTTIME", "DOTEXTTIME", "FULLMARK", "AVERAGEGRADE", "TESTSTYLE","TNO"};
//Response.Write(
//LabTname.Text = Session["USERID"].ToString();
DataRow row=sql.FindRow(TableName,ColumnName,StrTestNo);
if (row != null)
{
if (row[Column[5]].ToString() == Session["USERID"].ToString())
{
TxtSetTestTime.Text = row[Column[0]].ToString();
TxtDoTestTimeDay.Text = row[Column[1]].ToString();
LabTname.Text = Session["USERTEACHERNAME"].ToString();
LabFullMark.Text = row[Column[2]].ToString();
LabAverageGrade.Text = row[Column[3]].ToString();
//DrpTestStyle.Items.Add(row[Column[4]].ToString());
try
{
DrpTestStyle.SelectedItem.Text = row[Column[4]].ToString();
}
catch(Exception E)
{
DrpTestStyle.SelectedIndex = 0;
}
}
else
{
Dialog(StrAll[1]);
LabTname.Text = "";
LabFullMark.Text = "";
LabAverageGrade.Text = "";
}
}
else
{
Dialog(StrAll[0]);
//Dialog(StrAll[1]);
LabTname.Text = "";
LabFullMark.Text = "";
LabAverageGrade.Text = "";
}
sql.SqlDataClose();
}
protected void BtnReturn_Click(object sender, EventArgs e)
{
Response.Redirect("~/SystemManage/TeacherMain.aspx");
}
protected void GridView_TestInfo_SelectedIndexChanged(object sender, EventArgs e)
{
int Index = GridView_TestInfo.SelectedIndex;
GridViewRow GVR = GridView_TestInfo.Rows[Index];
TxtTestNo.Text = GVR.Cells[0].Text.ToString();
LabTname.Text = Session["USERTEACHERNAME"].ToString();
TxtSetTestTime.Text = GVR.Cells[1].Text.ToString();
TxtDoTestTimeDay.Text = GVR.Cells[2].Text.ToString();
LabFullMark.Text = GVR.Cells[3].Text.ToString();
LabAverageGrade.Text = GVR.Cells[4].Text.ToString();
DrpTestStyle.SelectedValue= GVR.Cells[5].Text.ToString();
//LabTname.
}
protected void BtnChangeTextInfo_Click(object sender, EventArgs e)
{
SqlData sql = new SqlData();
String[] StrAll ={ "不存在此试卷编号", "修改成功!","修改失败" };
String StrTestNo = TxtTestNo.Text.ToString();
String StrSetTestTime=TxtSetTestTime.Text.ToString();
String StrDoTestTimeDay=TxtDoTestTimeDay.Text.ToString();
String StrTestStyle=DrpTestStyle.SelectedItem.Text.ToString();
String TableName = "TAB_TESTINFO";
String ColumnName = "TESTNO";
String[] UpdateCloumn={"SETTEXTTIME", "DOTEXTTIME", "TESTSTYLE"};
String[] UpdateStr={StrSetTestTime,StrDoTestTimeDay,StrTestStyle};
if(sql.CheckStringUnique(TableName,ColumnName,StrTestNo)==1)
{
if (sql.updateRow(TableName, UpdateCloumn, UpdateStr, UpdateCloumn.Length, ColumnName, StrTestNo) == true)
{
Dialog(StrAll[1]);
GridView_TestInfo.DataSourceID = "SqlDataSource_TestInfo";
}
else{
Dialog(StrAll[2]);
}
}
else{
Dialog(StrAll[0]);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -