示例#1
0
        public IList<Core.Business.CourseArrange> GetAllCourseArrange()
        {
            IList<Core.Business.CourseArrange> courseArrangelist = new List<Core.Business.CourseArrange>();
            SqlServerUtility sql = new SqlServerUtility();

            SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllCourseArrange);

            if(reader != null)
            {
                while(reader.Read())
                {
                    Core.Business.CourseArrange courseArrange = new Core.Business.CourseArrange();

                    if (!reader.IsDBNull(0)) courseArrange.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) courseArrange.TeacherCode = reader.GetString(1);
                    if (!reader.IsDBNull(2)) courseArrange.ClassRoomCode = reader.GetString(2);
                    if (!reader.IsDBNull(3)) courseArrange.StdYear = reader.GetString(3);
                    if (!reader.IsDBNull(4)) courseArrange.Semester = reader.GetInt32(4);
                    if (!reader.IsDBNull(5)) courseArrange.GradeCode = reader.GetString(5);
                    if (!reader.IsDBNull(6)) courseArrange.ProfCode = reader.GetString(6);
                    if (!reader.IsDBNull(7)) courseArrange.ClassCode = reader.GetString(7);
                    if (!reader.IsDBNull(8)) courseArrange.WeekDay = reader.GetInt32(8);
                    if (!reader.IsDBNull(9)) courseArrange.Lesson = reader.GetInt32(9);
                    if (!reader.IsDBNull(10)) courseArrange.CourseCode = reader.GetString(10);
                    if (!reader.IsDBNull(11)) courseArrange.CourseCate = reader.GetString(11);

                    courseArrange.MarkOld();
                    courseArrangelist.Add(courseArrange);
                }
                reader.Close();
            }
            return courseArrangelist;
        }
示例#2
0
        public IList<Core.Business.CourseArrange> GetDistinctClassByQuery(string wherestr)
        {
            IList<Core.Business.CourseArrange> courseArrangelist = new List<Core.Business.CourseArrange>();
            SqlServerUtility sql = new SqlServerUtility();
            StringBuilder sb = new StringBuilder();
            sb.Append("SELECT DISTINCT [ClassCode],[GradeCode] from [CourseArrange] ");
            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.CourseArrange courseArrange = new Core.Business.CourseArrange();
                    if (!reader.IsDBNull(0)) courseArrange.ClassCode = reader.GetString(0);
                    if (!reader.IsDBNull(1)) courseArrange.GradeCode = reader.GetString(1);

                    courseArrange.MarkOld();

                    courseArrangelist.Add(courseArrange);
                }
                reader.Close();
            }
            return courseArrangelist;
        }
示例#3
0
        public IList<Core.Business.CourseArrange> GetThisListByQuery(string wherestr)
        {
            IList<Core.Business.CourseArrange> courseArrangelist = new List<Core.Business.CourseArrange>();
            SqlServerUtility sql = new SqlServerUtility();
            StringBuilder sb = new StringBuilder();
            sb.Append(SqlGetAllCourseArrange);
            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.CourseArrange courseArrange = new Core.Business.CourseArrange();

                    if (!reader.IsDBNull(0)) courseArrange.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) courseArrange.TeacherCode = reader.GetString(1);
                    if (!reader.IsDBNull(2)) courseArrange.ClassRoomCode = reader.GetString(2);
                    if (!reader.IsDBNull(3)) courseArrange.StdYear = reader.GetString(3);
                    if (!reader.IsDBNull(4)) courseArrange.Semester = reader.GetInt32(4);
                    if (!reader.IsDBNull(5)) courseArrange.GradeCode = reader.GetString(5);
                    if (!reader.IsDBNull(6)) courseArrange.ProfCode = reader.GetString(6);
                    if (!reader.IsDBNull(7)) courseArrange.ClassCode = reader.GetString(7);
                    if (!reader.IsDBNull(8)) courseArrange.WeekDay = reader.GetInt32(8);
                    if (!reader.IsDBNull(9)) courseArrange.Lesson = reader.GetInt32(9);
                    if (!reader.IsDBNull(10)) courseArrange.CourseCode = reader.GetString(10);
                    if (!reader.IsDBNull(11)) courseArrange.CourseCate = reader.GetString(11);

                    courseArrange.MarkOld();

                    courseArrangelist.Add(courseArrange);
                }
                reader.Close();
            }
            return courseArrangelist;
        }
示例#4
0
        public Core.Business.CourseArrange Select(int id)
        {
            SqlServerUtility sql = new SqlServerUtility();

            sql.AddParameter("@Id", SqlDbType.Int, id);
            SqlDataReader reader = sql.ExecuteSqlReader(SqlSelectCourseArrange);

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

                if (!reader.IsDBNull(0)) courseArrange.Id = reader.GetInt32(0);
                if (!reader.IsDBNull(1)) courseArrange.TeacherCode = reader.GetString(1);
                if (!reader.IsDBNull(2)) courseArrange.ClassRoomCode = reader.GetString(2);
                if (!reader.IsDBNull(3)) courseArrange.StdYear = reader.GetString(3);
                if (!reader.IsDBNull(4)) courseArrange.Semester = reader.GetInt32(4);
                if (!reader.IsDBNull(5)) courseArrange.GradeCode = reader.GetString(5);
                if (!reader.IsDBNull(6)) courseArrange.ProfCode = reader.GetString(6);
                if (!reader.IsDBNull(7)) courseArrange.ClassCode = reader.GetString(7);
                if (!reader.IsDBNull(8)) courseArrange.WeekDay = reader.GetInt32(8);
                if (!reader.IsDBNull(9)) courseArrange.Lesson = reader.GetInt32(9);
                if (!reader.IsDBNull(10)) courseArrange.CourseCode = reader.GetString(10);
                if (!reader.IsDBNull(11)) courseArrange.CourseCate = reader.GetString(11);

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

                return null;
            }
        }