예제 #1
0
        public IList<CurriculmArrange> GetCurriculmArrangeByTeacherCodeAndTime(string teachercode, string year, int term)
        {
            IList<CurriculmArrange> teacherList = new List<CurriculmArrange>();

            SqlServerUtility sql = new SqlServerUtility();
            sql.AddParameter("TeacherCode", SqlDbType.NVarChar, teachercode);
            sql.AddParameter("year", SqlDbType.NVarChar, year);
            sql.AddParameter("term", SqlDbType.Int, term);

            SqlDataReader reader = sql.ExecuteSqlReader(SQL_GET_ARRANGE_BY_TEACHERCODE_AND_TIME);

            if (reader != null && !reader.IsClosed)
            {
                while (reader.Read())
                {
                    CurriculmArrange ca = new CurriculmArrange();
                    if (!reader.IsDBNull(0)) ca.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) ca.ClassCode = reader.GetString(1);
                    if (!reader.IsDBNull(2)) ca.CourseCode = reader.GetString(2);
                    if (!reader.IsDBNull(3)) ca.TeacherCode = reader.GetString(3);
                    if (!reader.IsDBNull(4)) ca.ClassRoomCode = reader.GetString(4);
                    if (!reader.IsDBNull(5)) ca.CourseTime = reader.GetInt32(5);
                    if (!reader.IsDBNull(6)) ca.Year = reader.GetString(6);
                    if (!reader.IsDBNull(7)) ca.Term = reader.GetInt32(7);

                    ca.MarkOld();

                    teacherList.Add(ca);

                }

                reader.Close();
            }

            return teacherList;
        }
예제 #2
0
        public IList<CurriculmArrange> GetCurriculmArrangeTimeAndQuery(string year, int term, string wherestr)
        {
            IList<CurriculmArrange> classesList = new List<CurriculmArrange>();

            SqlServerUtility sql = new SqlServerUtility();

            StringBuilder querystring = new StringBuilder();
            querystring.Append(SQL_GET_ARRANGE_BY_TIME);
            if (!string.IsNullOrEmpty(wherestr))
            {
                //querystring.Append(" WHERE ");
                querystring.Append(" " + wherestr + " ");
            }
            sql.AddParameter("year", SqlDbType.NVarChar, year);
            sql.AddParameter("term", SqlDbType.Int, term);
            SqlDataReader reader = sql.ExecuteSqlReader(querystring.ToString());

            if (reader != null && !reader.IsClosed)
            {
                while (reader.Read())
                {
                    CurriculmArrange ca = new CurriculmArrange();
                    if (!reader.IsDBNull(0)) ca.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) ca.ClassCode = reader.GetString(1);
                    if (!reader.IsDBNull(2)) ca.CourseCode = reader.GetString(2);
                    if (!reader.IsDBNull(3)) ca.TeacherCode = reader.GetString(3);
                    if (!reader.IsDBNull(4)) ca.ClassRoomCode = reader.GetString(4);
                    if (!reader.IsDBNull(5)) ca.CourseTime = reader.GetInt32(5);
                    if (!reader.IsDBNull(6)) ca.Year = reader.GetString(6);
                    if (!reader.IsDBNull(7)) ca.Term = reader.GetInt32(7);

                    ca.MarkOld();

                    classesList.Add(ca);

                }

                reader.Close();
            }

            return classesList;
        }
예제 #3
0
        public List<CurriculmArrange> GetAllCurriculmArrangeByYearAndTerm(int thisYear, int thisTerm)
        {
            SqlServerUtility sql = new SqlServerUtility();
            sql.AddParameter("year", SqlDbType.NVarChar, thisYear.ToString());
            sql.AddParameter("term", SqlDbType.Int, thisTerm);

            SqlDataReader reader = sql.ExecuteSqlReader(SQL_GET_ALL_ARRANGES_BY_YEAR_AND_TERM);
            List<CurriculmArrange> list = new List<CurriculmArrange>();

            if (reader != null && !reader.IsClosed)
            {
                while (reader.Read())
                {
                    CurriculmArrange ca = new CurriculmArrange();
                    if (!reader.IsDBNull(0)) ca.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) ca.ClassCode = reader.GetString(1);
                    if (!reader.IsDBNull(2)) ca.CourseCode = reader.GetString(2);
                    if (!reader.IsDBNull(3)) ca.TeacherCode = reader.GetString(3);
                    if (!reader.IsDBNull(4)) ca.ClassRoomCode = reader.GetString(4);
                    if (!reader.IsDBNull(5)) ca.CourseTime = reader.GetInt32(5);
                    if (!reader.IsDBNull(6)) ca.Year = reader.GetString(6);
                    if (!reader.IsDBNull(7)) ca.Term = reader.GetInt32(7);

                    ca.MarkOld();

                    list.Add(ca);
                }

                reader.Close();
            }

            return list;
        }