예제 #1
0
        public IList<Core.Business.Grade> GetAllGrade()
        {
            IList<Core.Business.Grade> gradelist = new List<Core.Business.Grade>();
            SqlServerUtility sql = new SqlServerUtility();

            SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllGrade);

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.Grade grade = new Core.Business.Grade();

                    if (!reader.IsDBNull(0)) grade.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) grade.GradeCode = reader.GetString(1);
                    if (!reader.IsDBNull(2)) grade.Des = reader.GetString(2);
                    if (!reader.IsDBNull(3)) grade.Prefess = reader.GetString(3);

                    grade.MarkOld();
                    gradelist.Add(grade);
                }
                reader.Close();
            }
            return gradelist;
        }
예제 #2
0
        //��ѯ�����꼶
        public IList<Core.Business.Grade> GetAllGrade(CY.UME.Core.PagingInfo pagingInfo)
        {
            IList<Core.Business.Grade> gradelist = new List<Core.Business.Grade>();
            SqlServerUtility sql = new SqlServerUtility(SqlConnectionString);

            sql.AddParameter("@PageNumber", SqlDbType.Int, pagingInfo.CurrentPage);
            sql.AddParameter("@PageSize", SqlDbType.Int, pagingInfo.PageSize);

            sql.AddParameter("@Tables", SqlDbType.NVarChar, "Grade");
            sql.AddParameter("@PK", SqlDbType.NVarChar, "Id");
            sql.AddParameter("@Sort", SqlDbType.NVarChar, "Id DESC");
            sql.AddParameter("@Fields", SqlDbType.NVarChar, "[Id], [Year]");
            //sql.AddParameter("@Filter", SqlDbType.NVarChar, "");

            SqlDataReader reader = sql.ExecuteSPReader("Paging_RowCount");

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.Grade grade = new Core.Business.Grade();

                    if (!reader.IsDBNull(0)) grade.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) grade.Year = reader.GetInt32(1);

                    grade.MarkOld();
                    gradelist.Add(grade);
                }
                reader.Close();
            }
            return gradelist;
        }
예제 #3
0
        public IList<Core.Business.Grade> GetAllGrade()
        {
            IList<Core.Business.Grade> gradelist = new List<Core.Business.Grade>();
            SqlServerUtility sql = new SqlServerUtility(SqlConnectionString);
            sql.AddParameter("@ID", SqlDbType.Int, 0);
            SqlDataReader reader = sql.ExecuteSPReader("USP_Grade_Select_By_Id");

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.Grade grade = new Core.Business.Grade();

                    if (!reader.IsDBNull(0)) grade.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) grade.Year = reader.GetInt32(1);

                    grade.MarkOld();
                    gradelist.Add(grade);
                }
                reader.Close();
            }
            return gradelist;
        }
예제 #4
0
        public Core.Business.Grade Select(int id)
        {
            SqlServerUtility sql = new SqlServerUtility();

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

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

                if (!reader.IsDBNull(0)) grade.Id = reader.GetInt32(0);
                if (!reader.IsDBNull(1)) grade.GradeCode = reader.GetString(1);
                if (!reader.IsDBNull(2)) grade.Des = reader.GetString(2);
                if (!reader.IsDBNull(3)) grade.Prefess = reader.GetString(3);

                reader.Close();

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

                return null;
            }
        }
예제 #5
0
        public Grade Select(string gradecode)
        {
            if (string.IsNullOrEmpty(gradecode))
            {
                return null;
            }

            SqlServerUtility sql = new SqlServerUtility();

            sql.AddParameter("@Code", SqlDbType.NVarChar, gradecode, 30);

            SqlDataReader reader = sql.ExecuteSqlReader(SqlSelectGradeByCode);

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

                if (!reader.IsDBNull(0)) grade.Id = reader.GetInt32(0);
                if (!reader.IsDBNull(1)) grade.GradeCode = reader.GetString(1);
                if (!reader.IsDBNull(2)) grade.Des = reader.GetString(2);
                if (!reader.IsDBNull(3)) grade.Prefess = reader.GetString(3);

                reader.Close();

                grade.MarkOld();

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

                return null;
            }
        }
예제 #6
0
        public Core.Business.Grade Select(int id)
        {
            SqlServerUtility sql = new SqlServerUtility(SqlConnectionString);

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

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

                if (!reader.IsDBNull(0)) grade.Id = reader.GetInt32(0);
                if (!reader.IsDBNull(1)) grade.Year = reader.GetInt32(1);

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

                return null;
            }
        }