Example #1
0
        public IList<Core.Business.TeacherEducation> GetAllTeacherEducation()
        {
            IList<Core.Business.TeacherEducation> teacherEducationlist = new List<Core.Business.TeacherEducation>();
            SqlServerUtility sql = new SqlServerUtility();

            SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllTeacherEducation);

            if(reader != null)
            {
                while(reader.Read())
                {
                    Core.Business.TeacherEducation teacherEducation = new Core.Business.TeacherEducation();

                    if (!reader.IsDBNull(0)) teacherEducation.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) teacherEducation.TeacherCode = reader.GetString(1);
                    if (!reader.IsDBNull(2)) teacherEducation.EducationSchool = reader.GetString(2);
                    if (!reader.IsDBNull(3)) teacherEducation.StartDate = reader.GetDateTime(3);
                    if (!reader.IsDBNull(4)) teacherEducation.EndDate = reader.GetDateTime(4);
                    if (!reader.IsDBNull(5)) teacherEducation.ProfessName = reader.GetString(5);
                    if (!reader.IsDBNull(6)) teacherEducation.EducationType = reader.GetString(6);

                    teacherEducation.MarkOld();
                    teacherEducationlist.Add(teacherEducation);
                }
                reader.Close();
            }
            return teacherEducationlist;
        }
Example #2
0
        public Core.Business.TeacherEducation Select(int id)
        {
            SqlServerUtility sql = new SqlServerUtility();

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

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

                if (!reader.IsDBNull(0)) teacherEducation.Id = reader.GetInt32(0);
                if (!reader.IsDBNull(1)) teacherEducation.TeacherCode = reader.GetString(1);
                if (!reader.IsDBNull(2)) teacherEducation.EducationSchool = reader.GetString(2);
                if (!reader.IsDBNull(3)) teacherEducation.StartDate = reader.GetDateTime(3);
                if (!reader.IsDBNull(4)) teacherEducation.EndDate = reader.GetDateTime(4);
                if (!reader.IsDBNull(5)) teacherEducation.ProfessName = reader.GetString(5);
                if (!reader.IsDBNull(6)) teacherEducation.EducationType = reader.GetString(6);
                reader.Close();
                return teacherEducation;
            }
            else
            {
                if (reader != null && !reader.IsClosed)
                    reader.Close();

                return null;
            }
        }