Beispiel #1
0
        /// <summary>
        /// 增加成绩信息
        /// </summary>
        /// <param name="gradesInfo"></param>
        public void AddGradesInfo(GradesInfo gradesInfo)
        {
            string connStr = SqlHelper.GetConnString();
            string sqlText = "INSERT INTO Grades (RosterNo, Grade, Year) VALUES (@RosterNo, @Grade, @Year)";

            SqlParameter[] sqlParas = new SqlParameter[]
            {
                new SqlParameter("@RosterNo", gradesInfo.RosterNo),
                new SqlParameter("@Grade", gradesInfo.Grade),
                new SqlParameter("@Year", gradesInfo.Year)
            };

            SqlHelper.ExecuteNonQuery(connStr, CommandType.Text, sqlText, sqlParas);
        }
Beispiel #2
0
        private void AddGrades(int year)
        {
            ArrayList gradesList = new ArrayList();
            Random    ra         = new Random();

            for (int index = 0; index < 100; ++index)
            {
                GradesInfo grades = new GradesInfo();
                grades.RosterNo = Convert.ToString(index + 1);
                grades.Year     = Convert.ToString(year);
                grades.Grade    = Convert.ToString(ra.Next(101));
                gradesList.Add(grades);
            }
            gradesService.AddGradesData(gradesList);
        }