Example #1
0
        public IList<Core.Business.StudentRoom> GetAllStudentRoom()
        {
            IList<Core.Business.StudentRoom> studentRoomlist = new List<Core.Business.StudentRoom>();
            SqlServerUtility sql = new SqlServerUtility();

            SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllStudentRoom);

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.StudentRoom studentRoom = new Core.Business.StudentRoom();

                    if (!reader.IsDBNull(0)) studentRoom.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) studentRoom.StudentCode = reader.GetString(1);
                    if (!reader.IsDBNull(2)) studentRoom.RoomCode = reader.GetString(2);
                    if (!reader.IsDBNull(3)) studentRoom.StayStartDate = reader.GetDateTime(3);
                    if (!reader.IsDBNull(4)) studentRoom.StayEndDate = reader.GetDateTime(4);
                    if (!reader.IsDBNull(5)) studentRoom.IsState = reader.GetBoolean(5);

                    studentRoom.MarkOld();
                    studentRoomlist.Add(studentRoom);
                }
                reader.Close();
            }
            return studentRoomlist;
        }
Example #2
0
        public IList<Core.Business.StudentRoom> GetStudentRoomByRoomCodeAndState(string roomCode, bool state)
        {
            IList<Core.Business.StudentRoom> studentRoomlist = new List<Core.Business.StudentRoom>();
            SqlServerUtility sqlhelper = new SqlServerUtility();

            sqlhelper.AddParameter("@RoomCode", SqlDbType.NVarChar, roomCode);
            sqlhelper.AddParameter("@IsState", SqlDbType.Bit, state);

            SqlDataReader reader = sqlhelper.ExecuteSqlReader(SqlGetStudentRoomByRoomCodeAndState);

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.StudentRoom studentRoom = new Core.Business.StudentRoom();

                    if (!reader.IsDBNull(0)) studentRoom.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) studentRoom.StudentCode = reader.GetString(1);
                    if (!reader.IsDBNull(2)) studentRoom.RoomCode = reader.GetString(2);
                    if (!reader.IsDBNull(3)) studentRoom.StayStartDate = reader.GetDateTime(3);
                    if (!reader.IsDBNull(4)) studentRoom.StayEndDate = reader.GetDateTime(4);
                    if (!reader.IsDBNull(5)) studentRoom.IsState = reader.GetBoolean(5);

                    studentRoom.MarkOld();
                    studentRoomlist.Add(studentRoom);
                }
                reader.Close();
            }
            return studentRoomlist;
        }