Пример #1
0
        public IList<Semester> Fill(AcademicYear academicYear)
        {
            if (academicYear == null||academicYear.Id<=0)
            {
                return null;
            }

            IList<Core.Business.Semester> semesterlist = new List<Core.Business.Semester>();

            SqlServerUtility sql = new SqlServerUtility();

            sql.AddParameter("@AcademicYearId", SqlDbType.Int, academicYear.Id);

            SqlDataReader reader = sql.ExecuteSqlReader(SqlFillSemesterWithYearId);

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.Semester semester = new Core.Business.Semester();

                    if (!reader.IsDBNull(0)) semester.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) semester.AcademicYearId = reader.GetInt32(1);
                    if (!reader.IsDBNull(2)) semester.StartTime = reader.GetDateTime(2);
                    if (!reader.IsDBNull(3)) semester.EndTime = reader.GetDateTime(3);
                    if (!reader.IsDBNull(4)) semester.Name = reader.GetString(4);

                    semester.MarkOld();
                    semesterlist.Add(semester);
                }
                reader.Close();
            }
            return semesterlist;
        }
Пример #2
0
        public IList<Core.Business.Semester> GetAllSemester()
        {
            IList<Core.Business.Semester> semesterlist = new List<Core.Business.Semester>();
            SqlServerUtility sql = new SqlServerUtility();

            SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllSemester);

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.Semester semester = new Core.Business.Semester();

                    if (!reader.IsDBNull(0)) semester.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) semester.AcademicYearId = reader.GetInt32(1);
                    if (!reader.IsDBNull(2)) semester.StartTime = reader.GetDateTime(2);
                    if (!reader.IsDBNull(3)) semester.EndTime = reader.GetDateTime(3);
                    if (!reader.IsDBNull(4)) semester.Name = reader.GetString(4);

                    semester.MarkOld();
                    semesterlist.Add(semester);
                }
                reader.Close();
            }
            return semesterlist;
        }