Пример #1
0
        public IList<Core.Business.Scholarship> GetAllScholarship()
        {
            IList<Core.Business.Scholarship> scholarshiplist = new List<Core.Business.Scholarship>();
            SqlServerUtility sql = new SqlServerUtility();

            SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllScholarship);

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.Scholarship scholarship = new Core.Business.Scholarship();

                    if (!reader.IsDBNull(0)) scholarship.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) scholarship.ScoreProportional = reader.GetDecimal(1);
                    if (!reader.IsDBNull(2)) scholarship.ConductProportional = reader.GetDecimal(2);
                    if (!reader.IsDBNull(3)) scholarship.Name = reader.GetString(3);
                    if (!reader.IsDBNull(4)) scholarship.Type = reader.GetString(4);
                    if (!reader.IsDBNull(5)) scholarship.Origin = reader.GetString(5);
                    if (!reader.IsDBNull(6)) scholarship.IsHighLevel = reader.GetInt32(6);

                    scholarship.MarkOld();
                    scholarshiplist.Add(scholarship);
                }
                reader.Close();
            }
            return scholarshiplist;
        }
Пример #2
0
        public IList<Core.Business.Scholarship> GetAllScholarshipByQueryString(string wherestr)
        {
            IList<Core.Business.Scholarship> scholarshiplist = new List<Core.Business.Scholarship>();
            SqlServerUtility sql = new SqlServerUtility();
            StringBuilder querystring = new StringBuilder();
            querystring.Append(SqlGetAllScholarship);
            if (!string.IsNullOrEmpty(wherestr))
            {
                querystring.Append(" WHERE ");
                querystring.Append(" " + wherestr + " ");
            }
            SqlDataReader reader = sql.ExecuteSqlReader(querystring.ToString());

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.Scholarship scholarship = new Core.Business.Scholarship();

                    if (!reader.IsDBNull(0)) scholarship.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) scholarship.ScoreProportional = reader.GetDecimal(1);
                    if (!reader.IsDBNull(2)) scholarship.ConductProportional = reader.GetDecimal(2);
                    if (!reader.IsDBNull(3)) scholarship.Name = reader.GetString(3);
                    if (!reader.IsDBNull(4)) scholarship.Type = reader.GetString(4);
                    if (!reader.IsDBNull(5)) scholarship.Origin = reader.GetString(5);
                    if (!reader.IsDBNull(6)) scholarship.IsHighLevel = reader.GetInt32(6);

                    scholarship.MarkOld();
                    scholarshiplist.Add(scholarship);
                }
                reader.Close();
            }
            else
                return null;
            return scholarshiplist;
        }
Пример #3
0
        public Core.Business.Scholarship SelectByName(string name)
        {
            SqlServerUtility sql = new SqlServerUtility();

            sql.AddParameter("@Name", SqlDbType.NVarChar, name);
            SqlDataReader reader = sql.ExecuteSqlReader(SqlSelectScholarshipByName);

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

                if (!reader.IsDBNull(0)) scholarship.Id = reader.GetInt32(0);
                if (!reader.IsDBNull(1)) scholarship.ScoreProportional = reader.GetDecimal(1);
                if (!reader.IsDBNull(2)) scholarship.ConductProportional = reader.GetDecimal(2);
                if (!reader.IsDBNull(3)) scholarship.Name = reader.GetString(3);
                if (!reader.IsDBNull(4)) scholarship.Type = reader.GetString(4);
                if (!reader.IsDBNull(5)) scholarship.Origin = reader.GetString(5);
                if (!reader.IsDBNull(6)) scholarship.IsHighLevel = reader.GetInt32(6);

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

                return null;
            }
        }