Example #1
0
        public IList<Core.Business.TeacherProjectItem> GetAllTeacherProjectItem()
        {
            IList<Core.Business.TeacherProjectItem> teacherProjectItemlist = new List<Core.Business.TeacherProjectItem>();
            SqlServerUtility sql = new SqlServerUtility();

            SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllTeacherProjectItem);

            if(reader != null)
            {
                while(reader.Read())
                {
                    Core.Business.TeacherProjectItem teacherProjectItem = new Core.Business.TeacherProjectItem();

                    if (!reader.IsDBNull(0)) teacherProjectItem.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) teacherProjectItem.ProjectItemCode = reader.GetString(1);
                    if (!reader.IsDBNull(2)) teacherProjectItem.TeacherCode = reader.GetString(2);

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

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

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

                if (!reader.IsDBNull(0)) teacherProjectItem.Id = reader.GetInt32(0);
                if (!reader.IsDBNull(1)) teacherProjectItem.ProjectItemCode = reader.GetString(1);
                if (!reader.IsDBNull(2)) teacherProjectItem.TeacherCode = reader.GetString(2);
                reader.Close();
                return teacherProjectItem;
            }
            else
            {
                if (reader != null && !reader.IsClosed)
                    reader.Close();

                return null;
            }
        }