private void showAllPapers() { DBHelper db = new DBHelper(); string sql = "select a.id,a.name,b.name,c.name from papers a,users b,majors c where a.teacherId=b.id and a.majorId=c.id and a.majorId=" + UserHelper.currentMajorId; DbCommand cmd = db.GetSqlStringCommand(sql); DataTable dt = db.ExecuteDataTable(cmd); dgvPaperInfo.DataSource = dt; //对记录数列填充数据 updateColumns(); //记录列 //按钮列 dgvPaperInfo.Columns[1].FillWeight = 10; //id //试卷名称 dgvPaperInfo.Columns[3].FillWeight = 50; //出题人 dgvPaperInfo.Columns[4].FillWeight = 30; //专业 dgvPaperInfo.Columns[5].FillWeight = 10; QuestionInfoForm.setColor(dgvPaperInfo); }
private void showAllScores() { DBHelper db = new DBHelper(); string sql = "select a.id,a.sname,a.pname,a.score,a.examTime,c.name as mname,b.name as tname from (select a.id,a.score,a.examTime,c.name as sname,b.name as pname,b.majorId,b.teacherId from scores a,papers b,users c where a.paperId=b.id and a.studentId=c.id and a.studentId=" + UserHelper.user.id + " and b.majorId=" + UserHelper.currentMajorId + " and a.state=1) a,users b,majors c where a.majorId=c.id and a.teacherId=b.id"; DbCommand cmd = db.GetSqlStringCommand(sql); DataTable dt = db.ExecuteDataTable(cmd); dgvScoreInfo.DataSource = dt; //id //姓名 dgvScoreInfo.Columns[1].FillWeight = 10; //试卷名称 dgvScoreInfo.Columns[2].FillWeight = 40; //总分 dgvScoreInfo.Columns[3].FillWeight = 10; //考试时间 dgvScoreInfo.Columns[4].FillWeight = 20; //专业 dgvScoreInfo.Columns[5].FillWeight = 10; //评分人 dgvScoreInfo.Columns[6].FillWeight = 10; QuestionInfoForm.setColor(dgvScoreInfo); }
private void showAllPapers() { DBHelper db = new DBHelper(); string sql = "select a.id,a.name,a.publishTime,b.name from papers a,majors b where a.majorId=b.id and teacherId=" + UserHelper.user.id + " and a.majorId=" + UserHelper.currentMajorId; DbCommand cmd = db.GetSqlStringCommand(sql); DataTable dt = db.ExecuteDataTable(cmd); dgvPaperInfo.DataSource = dt; //对考生人数列填充数据 fillColumnExamineeNum(); //考生人数列 dgvPaperInfo.Columns[0].FillWeight = 20; //按钮列 dgvPaperInfo.Columns[1].FillWeight = 5; //试卷id //试卷名称 dgvPaperInfo.Columns[3].FillWeight = 50; //发布时间 dgvPaperInfo.Columns[4].FillWeight = 20; //专业 dgvPaperInfo.Columns[5].FillWeight = 5; QuestionInfoForm.setColor(dgvPaperInfo); }
private void showAllScores(int paperId) { DBHelper db = new DBHelper(); string sql = "select a.id,b.id,b.name,a.score,c.name,a.state from scores a,users b,majors c where a.studentId=b.id and b.majorId=c.id and a.paperId=" + paperId; DbCommand cmd = db.GetSqlStringCommand(sql); DataTable dt = db.ExecuteDataTable(cmd); dgvScoreInfo.DataSource = dt; //对总分列与按钮列进行更新 updateColumns(); //按钮列 dgvScoreInfo.Columns[0].FillWeight = 10; //成绩id列 //学员id列 //姓名列 dgvScoreInfo.Columns[3].FillWeight = 35; //总分列 dgvScoreInfo.Columns[4].FillWeight = 35; //学员来自列 dgvScoreInfo.Columns[5].FillWeight = 20; //状态列 QuestionInfoForm.setColor(dgvScoreInfo); }
private void dgvPaperInfo_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) { updateColumns(); QuestionInfoForm.setColor(dgvPaperInfo); }
private void dgvScoreInfo_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) { QuestionInfoForm.setColor(dgvScoreInfo); }