Ejemplo n.º 1
0
        public static List <Panel> List(int canvasId)
        {
            List <Panel> list = new List <Panel>();
            string       sql  = string.Format(
                "SELECT * FROM Panel WHERE CanvasId={0} ORDER BY 1;" +
                "SELECT TOP 1 c.*, PanelId FROM FullScreen s INNER JOIN Canvas c ON c.CanvasId=s.CanvasId WHERE s.CanvasId={0};",
                canvasId
                );

            using (DataSet ds = DataAccess.RunSql(sql))
            {
                list.Capacity = ds.Tables[0].Rows.Count;

                DataRow fs = ds.Tables[1].Rows[0];
                int     fullScreenPanelId = fs.IntOrZero("PanelId");

                // list canvas panels
                foreach (DataRow r in ds.Tables[0].Rows)
                {
                    Panel panel   = null;
                    int   panelId = r.IntOrZero("PanelId");

                    if (panelId == fullScreenPanelId)
                    {
                        panel = new FullScreenPanel()
                        {
                            PanelId    = panelId,
                            Top        = 0,
                            Left       = 0,
                            Height     = fs.IntOrZero("Height"),
                            Width      = fs.IntOrZero("Width"),
                            Name       = r.StringOrBlank("Name"),
                            FadeLength = r.DoubleOrZero("FadeLength"),
                        }
                    }
                    ;
                    else
                    {
                        panel = new Panel()
                        {
                            PanelId    = panelId,
                            Top        = r.IntOrZero("Top"),
                            Left       = r.IntOrZero("Left"),
                            Height     = r.IntOrZero("Height"),
                            Width      = r.IntOrZero("Width"),
                            Name       = r.StringOrBlank("Name"),
                            FadeLength = r.DoubleOrZero("FadeLength"),
                        }
                    };

                    if (panel.Name == "")
                    {
                        panel.Name = string.Format("Panel {0}", panelId);
                    }

                    list.Add(panel);
                }
            }
            return(list);
        }
Ejemplo n.º 2
0
        public static List <Panel> List(int canvasId)
        {
            List <Panel> list = new List <Panel>();

            using (SqlCommand cmd = new SqlCommand()
            {
                CommandType = CommandType.Text,
                CommandText =
                    "SELECT p.*, f.PanelId FsPanelId, c.Height CanvasHeight, c.Width CanvasWidth FROM Panel p " +
                    "INNER JOIN Canvas c on c.CanvasId=p.CanvasId " +
                    "LEFT JOIN FullScreen f on f.PanelId=p.PanelId WHERE p.CanvasId=@canvasId ORDER BY p.PanelId",
            })
            {
                cmd.Parameters.AddWithValue("@canvasId", canvasId);
                cmd.ExecuteReaderExt((r) =>
                {
                    Panel panel           = null;
                    int panelId           = r.IntOrZero("PanelId");
                    int fullScreenPanelId = r.IntOrZero("FsPanelId");

                    if (panelId == fullScreenPanelId)
                    {
                        panel = new FullScreenPanel()
                        {
                            PanelId    = panelId,
                            Top        = 0,
                            Left       = 0,
                            Height     = r.IntOrZero("CanvasHeight"),
                            Width      = r.IntOrZero("CanvasWidth"),
                            Name       = r.StringOrBlank("Name"),
                            FadeLength = r.ValueOrDefault <double>("FadeLength", 0),
                        }
                    }
                    ;
                    else
                    {
                        panel = new Panel()
                        {
                            PanelId    = panelId,
                            Top        = r.IntOrZero("Top"),
                            Left       = r.IntOrZero("Left"),
                            Height     = r.IntOrZero("Height"),
                            Width      = r.IntOrZero("Width"),
                            Name       = r.StringOrBlank("Name"),
                            FadeLength = r.ValueOrDefault <double>("FadeLength", 0),
                        }
                    };

                    if (panel.Name == "")
                    {
                        panel.Name = string.Format("Panel {0}", panelId);
                    }

                    list.Add(panel);
                    return(true);
                });
            }

            return(list);
        }
Ejemplo n.º 3
0
        public static List<Panel> List(int canvasId)
        {
            List<Panel> list = new List<Panel>();

            using (SqlCommand cmd = new SqlCommand()
            {
                CommandType = CommandType.Text,
                CommandText =
                    "SELECT p.*, f.PanelId FsPanelId, c.Height CanvasHeight, c.Width CanvasWidth FROM Panel p " +
                    "INNER JOIN Canvas c on c.CanvasId=p.CanvasId " +
                    "LEFT JOIN FullScreen f on f.PanelId=p.PanelId WHERE p.CanvasId=@canvasId ORDER BY p.PanelId",
            })
            {
                cmd.Parameters.AddWithValue("@canvasId", canvasId);
                cmd.ExecuteReaderExt((r) =>
                {
                    Panel panel = null;
                    int panelId = r.IntOrZero("PanelId");
                    int fullScreenPanelId = r.IntOrZero("FsPanelId");

                    if (panelId == fullScreenPanelId)
                        panel = new FullScreenPanel()
                        {
                            PanelId = panelId,
                            Top = 0,
                            Left = 0,
                            Height = r.IntOrZero("CanvasHeight"),
                            Width = r.IntOrZero("CanvasWidth"),
                            Name = r.StringOrBlank("Name"),
                            FadeLength = r.ValueOrDefault<double>("FadeLength", 0),
                        };
                    else
                        panel = new Panel()
                        {
                            PanelId = panelId,
                            Top = r.IntOrZero("Top"),
                            Left = r.IntOrZero("Left"),
                            Height = r.IntOrZero("Height"),
                            Width = r.IntOrZero("Width"),
                            Name = r.StringOrBlank("Name"),
                            FadeLength = r.ValueOrDefault<double>("FadeLength", 0),
                        };

                    if (panel.Name == "")
                        panel.Name = string.Format("Panel {0}", panelId);

                    list.Add(panel);
                    return true;
                });
            }

            return list;
        }
Ejemplo n.º 4
0
        public static List<Panel> List(int canvasId)
		{
			List<Panel> list = new List<Panel>();
			string sql = string.Format(
				"SELECT * FROM Panel WHERE CanvasId={0} ORDER BY 1;" +
				"SELECT TOP 1 c.*, PanelId FROM FullScreen s INNER JOIN Canvas c ON c.CanvasId=s.CanvasId WHERE s.CanvasId={0};",
				canvasId
				);
			using (DataSet ds = DataAccess.RunSql(sql))
			{
				list.Capacity = ds.Tables[0].Rows.Count;

				DataRow fs = ds.Tables[1].Rows[0];
				int fullScreenPanelId = fs.IntOrZero("PanelId");

				// list canvas panels
				foreach (DataRow r in ds.Tables[0].Rows)
				{
					Panel panel = null;
					int panelId = r.IntOrZero("PanelId");

					if (panelId == fullScreenPanelId)
						panel = new FullScreenPanel()
						{
							PanelId = panelId,
							Top = 0,
							Left = 0,
							Height = fs.IntOrZero("Height"),
							Width = fs.IntOrZero("Width"),
							Name = r.StringOrBlank("Name"),
                            FadeLength = r.DoubleOrZero("FadeLength"),
						};
					else
						panel = new Panel()
						{
							PanelId = panelId,
							Top = r.IntOrZero("Top"),
							Left = r.IntOrZero("Left"),
							Height = r.IntOrZero("Height"),
							Width = r.IntOrZero("Width"),
							Name = r.StringOrBlank("Name"),
                            FadeLength = r.DoubleOrZero("FadeLength"),
                        };

					if (panel.Name == "")
						panel.Name = string.Format("Panel {0}", panelId);

					list.Add(panel);
				}
			}
			return list;
		}