set_score.aspx.cs

来自「基于WEB的在线考试系统建立在系统后台的数据库的基础上」· CS 代码 · 共 82 行

CS
82
字号
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_Set_Score : System.Web.UI.Page
{
    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_ForSetScore(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 Ok_Click(object sender, EventArgs e)
    {
        Resub.Enabled = true;
        Ok.Enabled = false;
        Subject.Enabled = false;
        TopicType.Enabled = false;
        UpdatePanel1.Visible = true;
        DataBand();
    }
    protected void DataInfo_RowEditing(object sender, GridViewEditEventArgs e)
    {
        
        DataInfo.EditIndex = e.NewEditIndex;
        DataBand();
    }
    protected void DataInfo_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
    {
        DataInfo.EditIndex = -1;
       
        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[3].FindControl("getscore")).Text.ToString()))
        {
            int Getscore = int.Parse(((TextBox)DataInfo.Rows[e.RowIndex].Cells[3].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;
        
        }
    }
    protected void Resub_Click(object sender, EventArgs e)
    {
        Ok.Enabled = true;
        Resub.Enabled = false;
        Subject.Enabled = true;
        TopicType.Enabled = true;
        UpdatePanel1.Visible = false;
    }
}

⌨️ 快捷键说明

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