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

📄 check_set_score.aspx.cs

📁 基于WEB的在线考试系统建立在系统后台的数据库的基础上
💻 CS
字号:
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 Teacher_Check_Set_Score : System.Web.UI.Page
{
    BLL.Teacher.CommonOp Op = new BLL.Teacher.CommonOp();
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    private void DataBand()
    {
        int SubjectID = Convert.ToInt32(Subject.SelectedValue.ToString());
        int TypeID = Convert.ToInt32(TopicType.SelectedValue.ToString());
        BLL.Teacher.CommonOp cp = new BLL.Teacher.CommonOp();
        DataSet dd = cp.get_Data_ForCheckScore(SubjectID, TypeID);
        DataInfo.DataSource = dd.Tables["dd"].DefaultView;
        DataInfo.DataKeyNames = new string[] { "ID" };
        totalNumber.Text = dd.Tables["dd"].Rows.Count.ToString();
        DataInfo.DataBind();

    }


    protected void selectAll_CheckedChanged(object sender, EventArgs e)
    {
        for (int i = 0; i <= DataInfo.Rows.Count - 1; i++)
        {
            CheckBox cbox = (CheckBox)DataInfo.Rows[i].FindControl("CheckBox1");
            if (this.selectAll.Checked == true)
            {
                cbox.Checked = true;
            }
            else
            {
                cbox.Checked = false;
            }
        }
    }
    protected void delete_Click(object sender, EventArgs e)
    {
       
        int TypeID = Convert.ToInt32(TopicType.SelectedValue.ToString());
        ArrayList AL = new ArrayList();
        ArrayList AR = new ArrayList();
        for (int i = 0; i <= DataInfo.Rows.Count - 1; i++)
        {
            CheckBox cbox = (CheckBox)DataInfo.Rows[i].FindControl("CheckBox1");
            if (cbox.Checked == true)
            {
                AL.Add(i);
            }
        }
        if (AL.Count > 0)
        {
            for (int i = 0; i < AL.Count; i++)
            {

                int id = Convert.ToInt32(DataInfo.DataKeys[(int)AL[i]].Value.ToString());
                AR.Add(id);

            }
            string TableName;
            if (0 == TypeID)
                TableName = "StudentFill";
            else if (1 == TypeID)
                TableName = "StudentJianda";
               else
                TableName = "StudentAnswer";
            Op.confirm_SetScore_More(AR, TableName);
            AR.Clear();
            AL.Clear();
        }
        DataBand();
    }
    #region 编辑/更新/
    protected void DataInfo_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
    {
        DataInfo.EditIndex = -1;
        DataBand();
    }
    protected void DataInfo_RowEditing(object sender, GridViewEditEventArgs e)
    {
        DataInfo.EditIndex = e.NewEditIndex;
        DataBand();

    }
    protected void DataInfo_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        int ID = int.Parse(DataInfo.DataKeys[e.RowIndex]["ID"].ToString());
        if (PageCommon.VldInt(((TextBox)DataInfo.Rows[e.RowIndex].Cells[4].FindControl("getscore")).Text.ToString()))
        {
            int Getscore = int.Parse(((TextBox)DataInfo.Rows[e.RowIndex].Cells[4].FindControl("getscore")).Text.ToString());
            BLL.Teacher.CommonOp op = new BLL.Teacher.CommonOp();
            op.set_Score_ForTopic(ID, Getscore, int.Parse(TopicType.SelectedValue.ToString()));

            DataInfo.EditIndex = -1;
            DataBand();


        }
        else
        {
            DataInfo.EditIndex = -1;
            DataBand();
            return;

        }
    }

    #endregion


    protected void Ok_Click(object sender, EventArgs e)
    {
        Resub.Enabled = true;
        Ok.Enabled = false;
        Subject.Enabled = false;
        TopicType.Enabled = false;
        UpdatePanel1.Visible = true;
        DataBand();
    }
    protected void Resub_Click(object sender, EventArgs e)
    {
        Ok.Enabled = true;
        Resub.Enabled = false;
        Subject.Enabled = true;
        TopicType.Enabled = true;
        UpdatePanel1.Visible = false;
    }
    /// <summary>
    /// 
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Back_Click(object sender, EventArgs e)
    {
        int TypeID = Convert.ToInt32(TopicType.SelectedValue.ToString());
        ArrayList AL = new ArrayList();
        ArrayList AR = new ArrayList();
        for (int i = 0; i <= DataInfo.Rows.Count - 1; i++)
        {
            CheckBox cbox = (CheckBox)DataInfo.Rows[i].FindControl("CheckBox1");
            if (cbox.Checked == true)
            {
                AL.Add(i);
            }
        }
        if (AL.Count > 0)
        {
            for (int i = 0; i < AL.Count; i++)
            {

                int id = Convert.ToInt32(DataInfo.DataKeys[(int)AL[i]].Value.ToString());
                AR.Add(id);

            }

            Op.return_SetScore_More(AR, TypeID);
            AR.Clear();
            AL.Clear();

        }
        DataBand();

    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -