Ejemplo n.º 1
0
 public void GetBlockContent(PageBlockInfo blockInfo)
 {
     ObjectPersistence persistence = new ObjectPersistence(DbAccess);
     ItemInfo item = persistence.GetByKey<ItemInfo>(blockInfo.ContentId);
     switch (item.TypeCode)
     {
         case 0:     // HTML页面
             blockInfo.ContentItem = new ItemHtmlFacade().GetItemById(blockInfo.ContentId);
             break;
         case 1:     // 列表
             blockInfo.ContentItem = new ItemCollectionFacade().GetItemById(blockInfo.ContentId);
             break;
         case 2:     // 子页面
             blockInfo.ContentItem = new ItemDetailFacade().GetItemById(blockInfo.ContentId);
             break;
         default:
             throw new ArgumentOutOfRangeException("\"" + item.ItemName + "\"的类型不支持:" + item.TypeCode + "" + item.TypeName);
     }
 }