Beispiel #1
0
        //public frmPaperPreview()
        //{
        //    InitializeComponent();
        //    isNew = false;
        //    dtPaperPreview = new DataTable();
        //    dtPaperPreview.Columns.Add("题干");
        //    dtPaperPreview.Columns.Add("题目类型");
        //    dtPaperPreview.Columns.Add("难度值");
        //    dtPaperPreview.Columns.Add("分值");
        //    dtPaperPreview.Columns.Add("Index");
        //    dgvPaperPreview.DataSource = dtPaperPreview;
        //    dgvPaperPreview.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
        //    dgvPaperPreview.Columns["Index"].Visible = false;
        //    dgvPaperPreview.Columns[0].FillWeight = 40;
        //    dgvPaperPreview.Columns[1].FillWeight = 15;
        //    dgvPaperPreview.Columns[2].FillWeight = 15;
        //    dgvPaperPreview.Columns[3].FillWeight = 15;
        //    dgvPaperPreview.Columns[4].FillWeight = 15;
        //    dgvPaperPreview.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;
        //    dgvPaperPreview.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable;
        //    dgvPaperPreview.Columns[2].SortMode = DataGridViewColumnSortMode.NotSortable;
        //    dgvPaperPreview.Columns[3].SortMode = DataGridViewColumnSortMode.NotSortable;
        //    NewPaper = InfoControl.TmpPaper;
        //    foreach (Problem pro in NewPaper.problemList)
        //    {
        //        dtPaperPreview.Rows.Add(new object[5] { pro.problem, Paper.GetPTypeName(pro.type), pro.Plevel, pro.score, 0 });
        //    }
        //}
        public frmPaperPreview(Paper paper)
        {
            InitializeComponent();
            isNew = (paper.paperID == -1);
            NewPaper = paper;
            tbPaperName.Text = NewPaper.paperName;
            dtPaperPreview = new DataTable();
            dtPaperPreview.Columns.Add("题干");
            dtPaperPreview.Columns.Add("题目类型");
            dtPaperPreview.Columns.Add("难度值");
            dtPaperPreview.Columns.Add("分值");
            dtPaperPreview.Columns.Add("Index");

            dgvPaperPreview.DataSource = dtPaperPreview;
            dgvPaperPreview.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            dgvPaperPreview.Columns["Index"].Visible = false;
            dgvPaperPreview.Columns[0].FillWeight = 40;
            dgvPaperPreview.Columns[1].FillWeight = 15;
            dgvPaperPreview.Columns[2].FillWeight = 15;
            dgvPaperPreview.Columns[3].FillWeight = 15;
            dgvPaperPreview.Columns[4].FillWeight = 15;

            dgvPaperPreview.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;
            dgvPaperPreview.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable;
            dgvPaperPreview.Columns[2].SortMode = DataGridViewColumnSortMode.NotSortable;
            dgvPaperPreview.Columns[3].SortMode = DataGridViewColumnSortMode.NotSortable;
            foreach (Problem pro in NewPaper.problemList)
            {
                dtPaperPreview.Rows.Add(new object[5] { pro.problem, Paper.GetPTypeName(pro.type), pro.Plevel, pro.score, 0 });
            }
            lbTScore.Text = CountScore().ToString();
        }
Beispiel #2
0
        //生成Paper的List
        private List<Paper> DataSetToListPaper(DataSet p_DataSet)
        {
            List<Paper> result = new List<Paper>();
            DataTable p_Data = p_DataSet.Tables[0];

            for (int j = 0; j < p_Data.Rows.Count; j++)
            {
                Paper paper = new Paper();
                paper.paperID = Convert.ToInt32(p_Data.Rows[j]["PaperId"]);
                paper.paperName = p_Data.Rows[j]["Title"].ToString();
                paper.author = p_Data.Rows[j]["TeacherName"].ToString();
                paper.createTime = p_Data.Rows[j]["GenerateDate"].ToString();
                result.Add(paper);
            }
            return result;
        }
Beispiel #3
0
        //修改Paper记录,参数是Paper编号和一个Paper对象
        public void UpdatePaper(string Id, Paper p)
        {
            SqlParameter[] dp = new SqlParameter[7];
            SqlParameter[] ddlparam = new SqlParameter[7];
            ddlparam[0] = CreateParam("@GenerateDate", SqlDbType.DateTime, 20, p.createTime, ParameterDirection.Input);
            ddlparam[1] = CreateParam("@TestDate", SqlDbType.DateTime, 20, p.testTime, ParameterDirection.Input);
            ddlparam[2] = CreateParam("@Paper_Path", SqlDbType.VarChar, 100, p.paperPath, ParameterDirection.Input);
            ddlparam[3] = CreateParam("@Title", SqlDbType.VarChar, 50, p.paperName, ParameterDirection.Input);
            ddlparam[4] = CreateParam("@Teacher_Id", SqlDbType.Int, 20, p.authorId, ParameterDirection.Input);
            ddlparam[5] = CreateParam("@Id", SqlDbType.Int, 9, Id, ParameterDirection.Input);
            ddlparam[6] = CreateParam("@ProgramState", SqlDbType.Int, 5, p.programState, ParameterDirection.Input);

            SqlCommand Cmd = CreateCmd("UpdatePaper", ddlparam);
            try { Cmd.ExecuteNonQuery(); }
            catch { throw; }
        }
Beispiel #4
0
 public virtual void ReLoad(Paper x)
 {
 }