/// <summary> /// 添加用户成绩信息 /// </summary> /// <param name="score">成绩实体集</param> public void Add(Score score) { string str = "select count(*) from score"; SH.SqlCom(str, CommandType.Text); string ID = ((int)SH.SqlES()+1).ToString(); str = "insert score values(@ID,@PaperID,@userID,@Score,@examTime,@JudgeTime)"; SH.SqlCom(str, CommandType.Text); string[] str0 = { "@ID", "@PaperID", "@userID", "@Score", "@examTime", "@JudgeTime" }; string[] str1 = { ID, score.PaperID.ToString(), score.UserID,score.Score0.ToString(), score.ExamTime.ToString(), score.JudgeTime.ToString() }; SH.SqlPar(str0, str1); SH.SqlENQ(); }
private void btnSave_Click(object sender, EventArgs e) { if (txtSum.Text!="") { Score score = new Score(); score.PaperID = ScoreBll.GetPaperID(lblPaper.Text); score.ExamTime = Convert.ToDateTime(lblTime.Text); score.JudgeTime = DateTime.Now; score.Score0 = Convert.ToDouble(txtSum.Text); score.UserID = UserID; ScoreBll.ScoreAdd(score); MessageBox.Show("保存成功!"); this.Close(); } else { MessageBox.Show("请计算总分!"); } }
/// <summary> /// 添加用户成绩信息 /// </summary> /// <param name="score">成绩实体集</param> public static void ScoreAdd(Score score) { sd.Add(score); }