📄 byhand_full.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;
using System.Data.SqlClient;
using System.IO;
using System.Text.RegularExpressions;
public partial class AutoManage_ByHand_Full : 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 GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
string id = "" + GridView1.DataKeys[GridView1.SelectedIndex].Values[0];
string ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
SqlConnection myConnection = new SqlConnection(ConnectionString);
string sql = "SELECT TFCONTENT FROM V_TESTFULL WHERE TFNO='" + id + "'";
SqlDataAdapter command = new SqlDataAdapter(sql, myConnection);
myConnection.Open();
DataSet mydataset = new DataSet();
command.Fill(mydataset, "V_TESTFULL");
TextBox1.Text = readData(mydataset.Tables[0].Rows[0][0].ToString());
myConnection.Close();
}
protected void Button1_Click(object sender, EventArgs e)
{
int j = 0;
string[] fullth = new string[1];
for (int i = 0; i < GridView1.Rows.Count; i++)
{
bool isChecked = ((CheckBox)GridView1.Rows[i].FindControl("chkSelect")).Checked;
if (isChecked)
{
j++;
if (j > 1)
{
Dialog("你只能选择1个题目!!");
return;
}
fullth[j-1] = GridView1.Rows[i].Cells[1].Text;
}
}
Session["Fullth"] = fullth;
Server.Transfer("Auto.aspx");
}
protected void BtnReturn_Click(object sender, EventArgs e)
{
Response.Redirect("~/SystemManage/TeacherMain.aspx");
}
public String readData(String FileName)
{
String ss = "";
String A = Server.MapPath("TestFullEx.asps");
String delimStr = "Wed";
string[] sArray = Regex.Split(A, delimStr, RegexOptions.None);
int j = 0;
String[] str = new string[2];
foreach (string filePath in sArray)
{
str[j] = filePath.ToString(); j++;
}
try
{
FileStream fs = new FileStream(str[0] + "\\Wed\\SubjectManage\\Full\\" + FileName, FileMode.Open);
StreamReader sr = new StreamReader(fs);
ss = sr.ReadToEnd();
sr.Close();
}
catch (Exception ex)
{
Console.Write(ex);
}
return ss;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -