Exemple #1
0
        public IList<Core.Business.RoomRecord> GetAllRoomRecord()
        {
            IList<Core.Business.RoomRecord> roomRecordlist = new List<Core.Business.RoomRecord>();
            SqlServerUtility sql = new SqlServerUtility();

            SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllRoomRecord);

            if(reader != null)
            {
                while(reader.Read())
                {
                    Core.Business.RoomRecord roomRecord = new Core.Business.RoomRecord();

                    if (!reader.IsDBNull(0)) roomRecord.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) roomRecord.Content = reader.GetString(1);
                    if (!reader.IsDBNull(2)) roomRecord.RcdCate = reader.GetString(2);
                    if (!reader.IsDBNull(3)) roomRecord.IssueDate = reader.GetDateTime(3);
                    if (!reader.IsDBNull(4)) roomRecord.HandlerCode = reader.GetString(4);
                    if (!reader.IsDBNull(5)) roomRecord.HandlerName = reader.GetString(5);
                    if (!reader.IsDBNull(6)) roomRecord.HandlerView = reader.GetString(6);
                    if (!reader.IsDBNull(7)) roomRecord.RcdDate = reader.GetDateTime(7);
                    if (!reader.IsDBNull(8)) roomRecord.RoomCode = reader.GetString(8);

                    roomRecord.MarkOld();
                    roomRecordlist.Add(roomRecord);
                }
                reader.Close();
            }
            return roomRecordlist;
        }
Exemple #2
0
        public Core.Business.RoomRecord Select(int id)
        {
            SqlServerUtility sql = new SqlServerUtility();

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

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

                if (!reader.IsDBNull(0)) roomRecord.Id = reader.GetInt32(0);
                if (!reader.IsDBNull(1)) roomRecord.Content = reader.GetString(1);
                if (!reader.IsDBNull(2)) roomRecord.RcdCate = reader.GetString(2);
                if (!reader.IsDBNull(3)) roomRecord.IssueDate = reader.GetDateTime(3);
                if (!reader.IsDBNull(4)) roomRecord.HandlerCode = reader.GetString(4);
                if (!reader.IsDBNull(5)) roomRecord.HandlerName = reader.GetString(5);
                if (!reader.IsDBNull(6)) roomRecord.HandlerView = reader.GetString(6);
                if (!reader.IsDBNull(7)) roomRecord.RcdDate = reader.GetDateTime(7);
                if (!reader.IsDBNull(8)) roomRecord.RoomCode = reader.GetString(8);
                reader.Close();
                return roomRecord;
            }
            else
            {
                if (reader != null && !reader.IsClosed)
                    reader.Close();

                return null;
            }
        }