Ejemplo n.º 1
0
        public IList<Core.Business.StudentStatus> GetAllStudentStatus()
        {
            IList<Core.Business.StudentStatus> studentStatuslist = new List<Core.Business.StudentStatus>();
            SqlServerUtility sql = new SqlServerUtility();

            SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllStudentStatus);

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.StudentStatus studentStatus = new Core.Business.StudentStatus();

                    if (!reader.IsDBNull(0)) studentStatus.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) studentStatus.StdStatus = reader.GetString(1);
                    if (!reader.IsDBNull(2)) studentStatus.YearNum = reader.GetString(2);
                    if (!reader.IsDBNull(3)) studentStatus.Terminal = reader.GetInt32(3);
                    if (!reader.IsDBNull(4)) studentStatus.StdCode = reader.GetString(4);

                    studentStatus.MarkOld();
                    studentStatuslist.Add(studentStatus);
                }
                reader.Close();
            }
            return studentStatuslist;
        }
Ejemplo n.º 2
0
        public IList<Core.Business.StudentStatus> GetListByQuery(string wherestr)
        {
            IList<Core.Business.StudentStatus> studentStatuslist = new List<Core.Business.StudentStatus>();
            SqlServerUtility sql = new SqlServerUtility();
            StringBuilder sb = new StringBuilder();
            sb.Append(SqlGetListByQuery);
            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.StudentStatus studentStatus = new Core.Business.StudentStatus();

                    if (!reader.IsDBNull(0)) studentStatus.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) studentStatus.StdStatus = reader.GetString(1);
                    if (!reader.IsDBNull(2)) studentStatus.YearNum = reader.GetString(2);
                    if (!reader.IsDBNull(3)) studentStatus.Terminal = reader.GetInt32(3);
                    if (!reader.IsDBNull(4)) studentStatus.StdCode = reader.GetString(4);

                    studentStatus.MarkOld();
                    studentStatuslist.Add(studentStatus);
                }
                reader.Close();
            }
            return studentStatuslist;
        }
Ejemplo n.º 3
0
        public Core.Business.StudentStatus GetStudentStatus(Core.Business.Student student, Core.Business.Semester semester)
        {
            SqlServerUtility sql = new SqlServerUtility();

            sql.AddParameter("@StdCode", SqlDbType.NVarChar, student.Code);
            sql.AddParameter("@SemesterId", SqlDbType.Int, semester.Id);

            SqlDataReader reader = sql.ExecuteSqlReader(SqlSelectStudentStatusByStudentCodeAndSemesterId);

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

                if (!reader.IsDBNull(0)) studentStatus.Id = reader.GetInt32(0);
                if (!reader.IsDBNull(1)) studentStatus.StdStatus = reader.GetString(1);
                if (!reader.IsDBNull(2)) studentStatus.YearNum = reader.GetString(2);
                if (!reader.IsDBNull(3)) studentStatus.Terminal = reader.GetInt32(3);
                if (!reader.IsDBNull(4)) studentStatus.StdCode = reader.GetString(4);

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

                return null;
            }
        }