コード例 #1
0
        public IList<Core.Business.ScholarshipStep> GetSchStepBySchID(int Id)
        {
            IList<Core.Business.ScholarshipStep> scholarshipSteplist = new List<Core.Business.ScholarshipStep>();
            SqlServerUtility sql = new SqlServerUtility();
            sql.AddParameter("@ScholarshipId", SqlDbType.Int, Id);
            SqlDataReader reader = sql.ExecuteSqlReader(SqlGetScholarshipStepBySchID);

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.ScholarshipStep scholarshipStep = new Core.Business.ScholarshipStep();

                    if (!reader.IsDBNull(0)) scholarshipStep.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) scholarshipStep.ScholarshipId = reader.GetInt32(1);
                    if (!reader.IsDBNull(2)) scholarshipStep.ScholarshipMoney = reader.GetDecimal(2);
                    if (!reader.IsDBNull(3)) scholarshipStep.StdProportional = reader.GetDecimal(3);
                    if (!reader.IsDBNull(4)) scholarshipStep.ScholarStep = reader.GetString(4);

                    scholarshipStep.MarkOld();
                    scholarshipSteplist.Add(scholarshipStep);
                }
                reader.Close();
            }
            return scholarshipSteplist;
        }
コード例 #2
0
        public Core.Business.ScholarshipStep Select(int id)
        {
            SqlServerUtility sql = new SqlServerUtility();

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

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

                if (!reader.IsDBNull(0)) scholarshipStep.Id = reader.GetInt32(0);
                if (!reader.IsDBNull(1)) scholarshipStep.ScholarshipId = reader.GetInt32(1);
                if (!reader.IsDBNull(2)) scholarshipStep.ScholarshipMoney = reader.GetDecimal(2);
                if (!reader.IsDBNull(3)) scholarshipStep.StdProportional = reader.GetDecimal(3);
                if (!reader.IsDBNull(4)) scholarshipStep.ScholarStep = reader.GetString(4);

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

                return null;
            }
        }