Esempio n. 1
0
        public IList<Core.Business.Score> GetAllScore()
        {
            IList<Core.Business.Score> scorelist = new List<Core.Business.Score>();
            SqlServerUtility sql = new SqlServerUtility();

            SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllScore);

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.Score score = new Core.Business.Score();

                    if (!reader.IsDBNull(0)) score.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) score.CourseCode = reader.GetString(1);
                    if (!reader.IsDBNull(2)) score.CourseCate = reader.GetString(2);
                    if (!reader.IsDBNull(3)) score.YearNum = reader.GetString(3);
                    if (!reader.IsDBNull(4)) score.Grade = reader.GetString(4);
                    if (!reader.IsDBNull(5)) score.Term = reader.GetInt32(5);
                    if (!reader.IsDBNull(6)) score.ClassCode = reader.GetString(6);
                    if (!reader.IsDBNull(7)) score.UsualScore = reader.GetDecimal(7);
                    if (!reader.IsDBNull(8)) score.MiddleScore = reader.GetDecimal(8);
                    if (!reader.IsDBNull(9)) score.EndScore = reader.GetDecimal(9);
                    if (!reader.IsDBNull(10)) score.TotalScore = reader.GetDecimal(10);
                    if (!reader.IsDBNull(11)) score.ScoreType = reader.GetString(11);
                    if (!reader.IsDBNull(12)) score.StdCode = reader.GetString(12);

                    score.MarkOld();
                    scorelist.Add(score);
                }
                reader.Close();
            }
            return scorelist;
        }
Esempio n. 2
0
        public IList<Core.Business.Score> PrepareScoreList(string year, int term, string grade, string coursecode, string classcode)
        {
            IList<Core.Business.Score> scorelist = new List<Core.Business.Score>();
            SqlServerUtility sql = new SqlServerUtility();

            StringBuilder sb = new StringBuilder();
            sb.Append("SELECT " + term + " AS 'Term','");
            sb.Append(year + "' AS  'YearNum','");
            sb.Append(grade + "' AS 'Grade','");
            sb.Append(coursecode + "'  AS  'CourseCode','");
            sb.Append(classcode + "' AS 'ClassCode',[StdClass].[StdCode]");
            sb.Append(" FROM [StdClass]");
            sb.Append(" WHERE [StdClass].[ClassCode]='" + classcode + "'");

            SqlDataReader reader = sql.ExecuteSqlReader(sb.ToString());

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.Score score = new Core.Business.Score();
                    if (!reader.IsDBNull(0)) score.Term = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) score.YearNum = reader.GetString(1);
                    if (!reader.IsDBNull(2)) score.Grade = reader.GetString(2);
                    if (!reader.IsDBNull(3)) score.CourseCode = reader.GetString(3);
                    if (!reader.IsDBNull(4)) score.ClassCode = reader.GetString(4);
                    if (!reader.IsDBNull(5)) score.StdCode = reader.GetString(5);

                    score.MarkOld();

                    scorelist.Add(score);
                }
                reader.Close();
            }
            return scorelist;
        }
Esempio n. 3
0
        public Core.Business.Score GetScoreByParm(string year, int term, string coursecode, string coursetype, string stdcode)
        {
            SqlServerUtility sql = new SqlServerUtility();

            StringBuilder sb = new StringBuilder();
            sb.Append(SqlSelectByParm);
            sb.Append(" WHERE YearNum='" + year + "' ");
            sb.Append(" AND Term=" + term);
            sb.Append(" AND CourseCode='" + coursecode + "' ");
            if (coursetype != "")
            {
                sb.Append(" AND CourseCate='" + coursetype + "' ");
            }
            sb.Append(" AND StdCode='" + stdcode + "'");

            SqlDataReader reader = sql.ExecuteSqlReader(sb.ToString());

            if (reader != null && !reader.IsClosed && reader.Read())
            {
                Core.Business.Score score = new Core.Business.Score();

                if (!reader.IsDBNull(0)) score.Id = reader.GetInt32(0);
                if (!reader.IsDBNull(1)) score.CourseCode = reader.GetString(1);
                if (!reader.IsDBNull(2)) score.CourseCate = reader.GetString(2);
                if (!reader.IsDBNull(3)) score.YearNum = reader.GetString(3);
                if (!reader.IsDBNull(4)) score.Grade = reader.GetString(4);
                if (!reader.IsDBNull(5)) score.Term = reader.GetInt32(5);
                if (!reader.IsDBNull(6)) score.ClassCode = reader.GetString(6);
                if (!reader.IsDBNull(7)) score.UsualScore = reader.GetDecimal(7);
                if (!reader.IsDBNull(8)) score.MiddleScore = reader.GetDecimal(8);
                if (!reader.IsDBNull(9)) score.EndScore = reader.GetDecimal(9);
                if (!reader.IsDBNull(10)) score.TotalScore = reader.GetDecimal(10);
                if (!reader.IsDBNull(11)) score.ScoreType = reader.GetString(11);
                if (!reader.IsDBNull(12)) score.StdCode = reader.GetString(12);

                reader.Close();

                score.MarkOld();

                return score;
            }
            else
            {
                if (reader != null && !reader.IsClosed)
                    reader.Close();

                return null;
            }
        }
Esempio n. 4
0
        /// <summary>
        /// ��ȡѧ���ɼ��֣����з֣��ɼ��Ͳ��з��ܷ�
        /// </summary>
        /// <param name="year"></param>
        /// <param name="term"></param>
        /// <param name="grade"></param>
        /// <returns></returns>
        public IList<CY.GFive.Core.Business.Score> GetScoreSumList(string year, int term, string proCode, string grade)
        {
            IList<Core.Business.Score> scorelist = new List<Core.Business.Score>();
            SqlServerUtility sql = new SqlServerUtility();
            sql.AddParameter("@Year", SqlDbType.NVarChar, year);
            sql.AddParameter("@Term", SqlDbType.Int, term);
            sql.AddParameter("@Grade", SqlDbType.NVarChar, grade);
            sql.AddParameter("@Pro", SqlDbType.NVarChar, proCode);
            SqlDataReader reader = sql.ExecuteSqlReader(SqlSelectSumScoreList);

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.Score score = new Core.Business.Score();

                    if (!reader.IsDBNull(0)) score.StdCode = reader.GetString(0);
                    if (!reader.IsDBNull(1)) score.YearNum = reader.GetString(1);
                    if (!reader.IsDBNull(2)) score.Grade = reader.GetString(2);
                    if (!reader.IsDBNull(3)) score.Term = reader.GetInt32(3);
                    if (!reader.IsDBNull(4)) score.AvgScore = reader.GetDecimal(4);
                    if (!reader.IsDBNull(5)) score.AvgCndtScore = reader.GetDecimal(5);

                    score.MarkOld();

                    scorelist.Add(score);
                }
                reader.Close();
            }
            return scorelist;
        }
Esempio n. 5
0
        public IList<Core.Business.Score> GetListByQuery(string wherestr)
        {
            IList<Core.Business.Score> scorelist = new List<Core.Business.Score>();
            SqlServerUtility sql = new SqlServerUtility();

            StringBuilder sb = new StringBuilder();
            sb.Append(SqlGetAllScore);
            if (!string.IsNullOrEmpty(wherestr))
            {
                sb.Append(" Where 1=1 AND " + wherestr);
            }
            SqlDataReader reader = sql.ExecuteSqlReader(sb.ToString());

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.Score score = new Core.Business.Score();

                    if (!reader.IsDBNull(0)) score.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) score.CourseCode = reader.GetString(1);
                    if (!reader.IsDBNull(2)) score.CourseCate = reader.GetString(2);
                    if (!reader.IsDBNull(3)) score.YearNum = reader.GetString(3);
                    if (!reader.IsDBNull(4)) score.Grade = reader.GetString(4);
                    if (!reader.IsDBNull(5)) score.Term = reader.GetInt32(5);
                    if (!reader.IsDBNull(6)) score.ClassCode = reader.GetString(6);
                    if (!reader.IsDBNull(7)) score.UsualScore = reader.GetDecimal(7);
                    if (!reader.IsDBNull(8)) score.MiddleScore = reader.GetDecimal(8);
                    if (!reader.IsDBNull(9)) score.EndScore = reader.GetDecimal(9);
                    if (!reader.IsDBNull(10)) score.TotalScore = reader.GetDecimal(10);
                    if (!reader.IsDBNull(11)) score.ScoreType = reader.GetString(11);
                    if (!reader.IsDBNull(12)) score.StdCode = reader.GetString(12);

                    score.MarkOld();
                    scorelist.Add(score);
                }
                reader.Close();
            }
            return scorelist;
        }