Beispiel #1
0
        public IList<Core.Business.SubsidyForStudent> GetAllSubsidyForStudent()
        {
            IList<Core.Business.SubsidyForStudent> subsidyForStudentlist = new List<Core.Business.SubsidyForStudent>();
            SqlServerUtility sql = new SqlServerUtility();

            SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllSubsidyForStudent);

            if(reader != null)
            {
                while(reader.Read())
                {
                    Core.Business.SubsidyForStudent subsidyForStudent = new Core.Business.SubsidyForStudent();

                    if (!reader.IsDBNull(0)) subsidyForStudent.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) subsidyForStudent.SubsidyName = reader.GetString(1);
                    if (!reader.IsDBNull(2)) subsidyForStudent.SubsidyDescription = reader.GetString(2);
                    if (!reader.IsDBNull(3)) subsidyForStudent.BeginDate = reader.GetDateTime(3);

                    subsidyForStudent.MarkOld();
                    subsidyForStudentlist.Add(subsidyForStudent);
                }
                reader.Close();
            }
            return subsidyForStudentlist;
        }
Beispiel #2
0
        public IList<SubsidyForStudent> IsExists(int id, string typeName)
        {
            IList<Core.Business.SubsidyForStudent> subsidyForStudentlist = new List<Core.Business.SubsidyForStudent>();
            SqlServerUtility sql = new SqlServerUtility();

            SqlDataReader reader;
            if (id > 0)
            {
                sql.AddParameter("@Id",SqlDbType.Int,id);
                sql.AddParameter("@SubsidyName", SqlDbType.NVarChar, typeName);
                reader = sql.ExecuteSqlReader(sqlUpdateIsExists);
            }
            else {
                sql.AddParameter("@SubsidyName", SqlDbType.NVarChar, typeName);
                reader = sql.ExecuteSqlReader(sqlInsertIsExists);
            }

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.SubsidyForStudent subsidyForStudent = new Core.Business.SubsidyForStudent();

                    if (!reader.IsDBNull(0)) subsidyForStudent.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) subsidyForStudent.SubsidyName = reader.GetString(1);
                    if (!reader.IsDBNull(2)) subsidyForStudent.SubsidyDescription = reader.GetString(2);
                    if (!reader.IsDBNull(3)) subsidyForStudent.BeginDate = reader.GetDateTime(3);

                    subsidyForStudent.MarkOld();
                    subsidyForStudentlist.Add(subsidyForStudent);
                }
                reader.Close();
            }
            return subsidyForStudentlist;
        }