⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 byhand_read.aspx.cs.svn-base

📁 大学英语学习系统
💻 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_Read : 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 BtnCommit_Click(object sender, EventArgs e)
    {
        int j = 0;
        bool check =true;
        string[] readth=new string[5];
        for (int i = 0; i < GridView1.Rows.Count; i++)
        {
            bool isChecked = ((CheckBox)GridView1.Rows[i].FindControl("chkSelect")).Checked;
            if (isChecked)
            {
                j++;
                if (j > 5)
                {
                    Dialog("你最多只能选择5个题目!!");
                    return;
                }
                readth[j-1]= GridView1.Rows[i].Cells[1].Text;
            }    
        }
        Session["CheckRead"] =check.ToString();
        Session["Readth"] = readth;
        Server.Transfer("Auto.aspx");
    }
    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 TRCONTENT FROM V_TESTREAD WHERE TRNO='" + id + "'";
        SqlDataAdapter command = new SqlDataAdapter(sql, myConnection);
        myConnection.Open();
        DataSet mydataset = new DataSet();
        command.Fill(mydataset, "V_TESTREAD");
        TextBox1.Text =readData(mydataset.Tables[0].Rows[0][0].ToString());
        
        myConnection.Close();
    }
    protected void BtnReturn_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/SystemManage/TeacherMain.aspx");
    }
    public String readData(String FileName)
    {
        String ss = "";
        String A = Server.MapPath("Exercise.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\\Read\\" + 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 + -