public static Canvas InitFromDisplay(int displayId) { Canvas canvas = null; string sql = string.Format( "SELECT c.* FROM Display d INNER JOIN Canvas c on c.CanvasId=d.CanvasId WHERE DisplayId={0};", displayId ); using (DataSet ds = DataAccess.RunSql(sql)) { if (0 == ds.Tables[0].Rows.Count) throw new Exception("Canvas not found"); canvas = new Canvas() { DisplayId = displayId, } ._initFromRow(ds.Tables[0].Rows[0]) ; } canvas.Display = new Display(displayId); canvas.Location = new Location(displayId); canvas.Panels = Panel.List(canvas.CanvasId); return canvas; }