コード例 #1
0
        public IList<ClassRoom> Fill(string TypeCode)
        {
            if (string.IsNullOrEmpty(TypeCode))
                return GetAllClassRoom();

            IList<Core.Business.ClassRoom> classRoomlist = new List<Core.Business.ClassRoom>();
            SqlServerUtility sql = new SqlServerUtility();

            sql.AddParameter("@RoomCate", SqlDbType.NVarChar, TypeCode, 30);

            SqlDataReader reader = sql.ExecuteSqlReader(SqlFillClassRoomWithType);

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.ClassRoom classRoom = new Core.Business.ClassRoom();

                    if (!reader.IsDBNull(0)) classRoom.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) classRoom.Code = reader.GetString(1);
                    if (!reader.IsDBNull(2)) classRoom.Name = reader.GetString(2);
                    if (!reader.IsDBNull(3)) classRoom.RoomCate = reader.GetString(3);
                    if (!reader.IsDBNull(4)) classRoom.AvailNum = reader.GetInt32(4);
                    if (!reader.IsDBNull(5)) classRoom.RoomState = reader.GetString(5);
                    if (!reader.IsDBNull(6)) classRoom.Multimedia = reader.GetString(6);

                    classRoom.MarkOld();
                    classRoomlist.Add(classRoom);
                }
                reader.Close();
            }
            return classRoomlist;
        }
コード例 #2
0
        public Core.Business.ClassRoom SelectByCode(string code)
        {
            SqlServerUtility sql = new SqlServerUtility();

            sql.AddParameter("@Code", SqlDbType.NVarChar, code);
            SqlDataReader reader = sql.ExecuteSqlReader(SqlSelectByCode);

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

                if (!reader.IsDBNull(0)) classRoom.Id = reader.GetInt32(0);
                if (!reader.IsDBNull(1)) classRoom.Code = reader.GetString(1);
                if (!reader.IsDBNull(2)) classRoom.Name = reader.GetString(2);
                if (!reader.IsDBNull(3)) classRoom.RoomCate = reader.GetString(3);
                if (!reader.IsDBNull(4)) classRoom.AvailNum = reader.GetInt32(4);
                if (!reader.IsDBNull(5)) classRoom.RoomState = reader.GetString(5);
                if (!reader.IsDBNull(6)) classRoom.Multimedia = reader.GetString(6);

                reader.Close();

                classRoom.MarkOld();

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

                return null;
            }
        }
コード例 #3
0
        public IList<ClassRoom> GetList(string QueryParam)
        {
            if (string.IsNullOrEmpty(QueryParam))
            {
                return null;
            }

            IList<Core.Business.ClassRoom> classRoomlist = new List<Core.Business.ClassRoom>();
            SqlServerUtility sql = new SqlServerUtility();

            SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllClassRoom + QueryParam);

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.ClassRoom classRoom = new Core.Business.ClassRoom();

                    if (!reader.IsDBNull(0)) classRoom.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) classRoom.Code = reader.GetString(1);
                    if (!reader.IsDBNull(2)) classRoom.Name = reader.GetString(2);
                    if (!reader.IsDBNull(3)) classRoom.RoomCate = reader.GetString(3);
                    if (!reader.IsDBNull(4)) classRoom.AvailNum = reader.GetInt32(4);
                    if (!reader.IsDBNull(5)) classRoom.RoomState = reader.GetString(5);
                    if (!reader.IsDBNull(6)) classRoom.Multimedia = reader.GetString(6);

                    classRoom.MarkOld();

                    classRoomlist.Add(classRoom);
                }
                reader.Close();
            }
            return classRoomlist;
        }