Beispiel #1
0
        public IList<Core.Business.ScholarInfo> GetAllScholarInfo()
        {
            IList<Core.Business.ScholarInfo> scholarInfolist = new List<Core.Business.ScholarInfo>();
            SqlServerUtility sql = new SqlServerUtility();

            SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllScholarInfo);

            if(reader != null)
            {
                while(reader.Read())
                {
                    Core.Business.ScholarInfo scholarInfo = new Core.Business.ScholarInfo();

                    if (!reader.IsDBNull(0)) scholarInfo.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) scholarInfo.Term = reader.GetInt32(1);
                    if (!reader.IsDBNull(2)) scholarInfo.SchlId = reader.GetInt32(2);
                    if (!reader.IsDBNull(3)) scholarInfo.AssDate = reader.GetDateTime(3);
                    if (!reader.IsDBNull(4)) scholarInfo.StdCode = reader.GetString(4);
                    if (!reader.IsDBNull(5)) scholarInfo.ClsCode = reader.GetString(5);
                    if (!reader.IsDBNull(6)) scholarInfo.Grade = reader.GetString(6);
                    if (!reader.IsDBNull(7)) scholarInfo.YearNum = reader.GetString(7);
                    if (!reader.IsDBNull(8)) scholarInfo.Degree = reader.GetString(8);
                    if (!reader.IsDBNull(9)) scholarInfo.AssPeerCode = reader.GetString(9);
                    if (!reader.IsDBNull(10)) scholarInfo.AssPeerName = reader.GetString(10);

                    scholarInfo.MarkOld();
                    scholarInfolist.Add(scholarInfo);
                }
                reader.Close();
            }
            return scholarInfolist;
        }
Beispiel #2
0
        public IList<CY.GFive.Core.Business.ScholarInfo> GetListByGradeTermYear(string year, int term, string grade, int SchID)
        {
            string SqlGetListByGradeTermYear = "SELECT [Id], [Term],[SchlId],[AssDate],[StdCode],[ClsCode],[Grade],[YearNum],[Degree],[AssPeerCode],[AssPeerName] FROM [ScholarInfo] where YearNum =@Year and Term=@Term and [SchlId] = @SchID";
            IList<Core.Business.ScholarInfo> scholarInfolist = new List<Core.Business.ScholarInfo>();
            SqlServerUtility sql = new SqlServerUtility();
            if (grade != "")
            {
                SqlGetListByGradeTermYear += " and [Grade]=@Grade";
                sql.AddParameter("@Grade", SqlDbType.NVarChar, grade);
            }

            sql.AddParameter("@Year", SqlDbType.NVarChar, year);
            sql.AddParameter("@Term", SqlDbType.Int, term);
            sql.AddParameter("@SchID", SqlDbType.Int, SchID);
            SqlDataReader reader = sql.ExecuteSqlReader(SqlGetListByGradeTermYear);

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.ScholarInfo scholarInfo = new Core.Business.ScholarInfo();

                    if (!reader.IsDBNull(0)) scholarInfo.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) scholarInfo.Term = reader.GetInt32(1);
                    if (!reader.IsDBNull(2)) scholarInfo.SchlId = reader.GetInt32(2);
                    if (!reader.IsDBNull(3)) scholarInfo.AssDate = reader.GetDateTime(3);
                    if (!reader.IsDBNull(4)) scholarInfo.StdCode = reader.GetString(4);
                    if (!reader.IsDBNull(5)) scholarInfo.ClsCode = reader.GetString(5);
                    if (!reader.IsDBNull(6)) scholarInfo.Grade = reader.GetString(6);
                    if (!reader.IsDBNull(7)) scholarInfo.YearNum = reader.GetString(7);
                    if (!reader.IsDBNull(8)) scholarInfo.Degree = reader.GetString(8);
                    if (!reader.IsDBNull(9)) scholarInfo.AssPeerCode = reader.GetString(9);
                    if (!reader.IsDBNull(10)) scholarInfo.AssPeerName = reader.GetString(10);

                    scholarInfo.MarkOld();
                    scholarInfolist.Add(scholarInfo);
                }
                reader.Close();
            }
            return scholarInfolist;
        }
Beispiel #3
0
        public Core.Business.ScholarInfo Select(int id)
        {
            SqlServerUtility sql = new SqlServerUtility();

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

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

                if (!reader.IsDBNull(0)) scholarInfo.Id = reader.GetInt32(0);
                if (!reader.IsDBNull(1)) scholarInfo.Term = reader.GetInt32(1);
                if (!reader.IsDBNull(2)) scholarInfo.SchlId = reader.GetInt32(2);
                if (!reader.IsDBNull(3)) scholarInfo.AssDate = reader.GetDateTime(3);
                if (!reader.IsDBNull(4)) scholarInfo.StdCode = reader.GetString(4);
                if (!reader.IsDBNull(5)) scholarInfo.ClsCode = reader.GetString(5);
                if (!reader.IsDBNull(6)) scholarInfo.Grade = reader.GetString(6);
                if (!reader.IsDBNull(7)) scholarInfo.YearNum = reader.GetString(7);
                if (!reader.IsDBNull(8)) scholarInfo.Degree = reader.GetString(8);
                if (!reader.IsDBNull(9)) scholarInfo.AssPeerCode = reader.GetString(9);
                if (!reader.IsDBNull(10)) scholarInfo.AssPeerName = reader.GetString(10);

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

                return null;
            }
        }