using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Reflection; using System.Data; using System.Configuration; using System.Web; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using IapDAL.EntityClasses; using IapDAL.FactoryClasses; using IapDAL.CollectionClasses; using IapDAL.HelperClasses; using IapDAL; using SD.LLBLGen.Pro.ORMSupportClasses; using SD.LLBLGen.Pro.DQE.SqlServer; namespace Iap.Controls { [ToolboxData("<{0}:InformationBlockSet runat=\"server\">"), DefaultMember("BlockType")] public class InformationBlockSet : CompositeControl { private InformationBlockSetData informationBlockSetData; public InformationBlockDataCollection InformationBlocksData { get { return this.informationBlockSetData.InformationBlockData; } set { this.informationBlockSetData.InformationBlockData = value; } } public Int32 SpaceCount { get { return this.informationBlockSetData.SpaceCount; } set { this.informationBlockSetData.SpaceCount = value; } } class InformationBlockSetData { private InformationBlockDataCollection informationBlockData; private Int32 spaceCount; public InformationBlockDataCollection InformationBlockData { get { return informationBlockData; } set { informationBlockData = value; } } public Int32 SpaceCount { get { return spaceCount; } set { spaceCount = value; } } public InformationBlockSetData( ) { } public InformationBlockDataCollection GetStickyBlockData( ) { InformationBlockDataCollection data = new InformationBlockDataCollection( ); InformationSnippetCollection blocks = new InformationSnippetCollection( ); RelationCollection relations = new RelationCollection( ); relations.Add(InformationSnippetEntity.Relations.InformationSnippetGroupEntityUsingInformationSnippetGroupId); IPredicateExpression filter = new PredicateExpression( ); filter.Add(InformationSnippetGroupFields.InformationSnippetGroupTitle == "StickyBlockData"); blocks.GetMulti(filter, relations); foreach (InformationSnippetEntity snippet in blocks) { InformationBlockData block = new InformationBlockData( ); block.DataSource = snippet.InformationSnippetDescription; data.Add(block); } return data; } public InformationBlockDataCollection GetDefaultBlockData( ) { InformationBlockDataCollection data = new InformationBlockDataCollection( ); InformationSnippetCollection blocks = new InformationSnippetCollection( ); RelationCollection relations = new RelationCollection( ); relations.Add(InformationSnippetEntity.Relations.InformationSnippetGroupEntityUsingInformationSnippetGroupId); IPredicateExpression filter = new PredicateExpression( ); filter.Add(InformationSnippetGroupFields.InformationSnippetGroupTitle == "DefaultBlockData"); blocks.GetMulti(filter, relations); foreach (InformationSnippetEntity snippet in blocks) { InformationBlockData block = new InformationBlockData( ); block.DataSource = snippet.InformationSnippetDescription; data.Add(block); } return data; } } public event EventHandler FeedBound; private void ItemFeedBound(Object sender, EventArgs e) { if (FeedBound != null) { FeedBound(this, new EventArgs( )); } } protected override void CreateChildControls( ) { InformationBlockSetData blockSetData = new InformationBlockSetData( ); InformationBlockDataCollection stickyBlocks = blockSetData.GetStickyBlockData( ); Int32 m = this.informationBlockSetData.SpaceCount; if (m < 4) { m = 4; } InformationBlockDataCollection profileData = this.informationBlockSetData.InformationBlockData; InformationBlockDataCollection defaultData; Int32 p = m - stickyBlocks.Count; if (p > 0) { defaultData = blockSetData.GetDefaultBlockData( ); } foreach (InformationBlockData block in stickyBlocks) { InfoBlock informationBlock = new InfoBlock( ); informationBlock.BlockWidth = block.BlockWidth; informationBlock.BlockHeight = block.BlockHeight; informationBlock.BlockSize = block.BlockSize; informationBlock.DataSource = block.DataSource; this.Controls.Add(informationBlock); } #if false Get Stickies (s) Get m Get Profile (p) If m-s != p then d = m - s - p Get D #endif base.CreateChildControls( ); } public InformationBlockSet( ) { this.informationBlockSetData = new InformationBlockSetData( ); } } }