Example #1
0
        private void _init()
        {
            using (SqlCommand cmd = new SqlCommand()
            {
                CommandType = CommandType.Text,
                CommandText = "SELECT TOP 1 * FROM Weather WHERE FrameId=@frameId",
            })
            {
                cmd.Parameters.AddWithValue("@frameId", this.FrameId);
                cmd.ExecuteReaderExt((dr) =>
                {
                    return false;
                });
            }

            // TODO: add own Woeid to Weather model
            /*Location location = new Location(DisplayId);
            if (location.LocationId != 0)
            {
                Woeid = location.Woeid;
                TemperatureUnit = location.TemperatureUnit;
            }
            else
            {
                Woeid = 56199578;      // Old Sacramento
                TemperatureUnit = "f";
            }*/
        }
Example #2
0
 public Panel(int panelId)
 {
     using (SqlCommand cmd = new SqlCommand()
     {
         CommandType = CommandType.Text,
         CommandText = "SELECT TOP 1 * FROM Panel WHERE PanelId=@panelId",
     })
     {
         cmd.Parameters.AddWithValue("@panelId", panelId);
         cmd.ExecuteReaderExt((dr) =>
         {
             _initFromRow(dr);
             return false;
         });
     }
 }
Example #3
0
 public Location(int displayId)
 {
     using (SqlCommand cmd = new SqlCommand()
     {
         CommandType = CommandType.Text,
         CommandText = "exec dbo.sp_GetLocationDetails @displayId",
     })
     {
         cmd.Parameters.AddWithValue("@displayId", displayId);
         cmd.ExecuteReaderExt((r) =>
         {
             _initFromRow(r);
             return false;
         });
     }
 }
Example #4
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;
        }
Example #5
0
        public static bool IsFullScreen(int panelId)
        {
            bool isFullScreen = false;

            using (SqlCommand cmd = new SqlCommand()
            {
                CommandType = CommandType.Text,
                CommandText = "SELECT TOP 1 * FROM Panel WHERE PanelId=@panelId",
            })
            {
                cmd.Parameters.AddWithValue("@panelId", panelId);
                cmd.ExecuteReaderExt((dr) =>
                {
                    isFullScreen = true;
                    return false;
                });
            }

            return isFullScreen;
        }
Example #6
0
 private void _init()
 {
     using (SqlCommand cmd = new SqlCommand()
     {
         CommandType = CommandType.Text,
         CommandText = "SELECT TOP 1 * FROM Youtube WHERE FrameId=@frameId",
     })
     {
         cmd.Parameters.AddWithValue("@frameId", this.FrameId);
         cmd.ExecuteReaderExt((dr) =>
         {
             YoutubeId = dr.StringOrBlank("YoutubeId").Trim();
             AutoLoop = dr.Boolean("AutoLoop");
             Volume = dr.IntOrZero("Volume");
             Aspect = dr.IntOrZero("Aspect");
             Quality = dr.IntOrZero("Quality");
             Start = dr.IntOrZero("Start");
             Rate = dr.IntOrZero("Rate");
             return false;
         });
     }
 }
Example #7
0
 private void _init()
 {
     using (SqlCommand cmd = new SqlCommand()
     {
         CommandType = CommandType.Text,
         CommandText = "SELECT TOP 1 f.*, t.FrameType, t.Html, t.Name TemplateName FROM Frame f inner join Template t on t.TemplateId=f.TemplateId WHERE FrameId=@frameId",
     })
     {
         cmd.Parameters.AddWithValue("@frameId", this.FrameId);
         cmd.ExecuteReaderExt((dr) =>
         {
             this._initfromRow(dr);
             return false;
         });
     }
 }
Example #8
0
	public Display(int displayId)
	{
           using (SqlCommand cmd = new SqlCommand()
           {
               CommandType = CommandType.Text,
               CommandText = "SELECT TOP 1 * FROM Display WHERE displayId=@displayId",
           })
           {
               cmd.Parameters.AddWithValue("@displayId", displayId);
               cmd.ExecuteReaderExt((r) =>
               {
                   _initFromRow(r);
                   return false;
               });
           }
       }
Example #9
0
	public Display(string host)
	{
           using (SqlCommand cmd = new SqlCommand()
           {
               CommandType = CommandType.Text,
               CommandText = "SELECT TOP 1 * FROM Display WHERE Host=@host",
           })
           {
               cmd.Parameters.AddWithValue("@host", host);
               cmd.ExecuteReaderExt((r) =>
               {
                   _initFromRow(r);
                   return false;
               });
           }
       }
Example #10
0
 private void _init()
 {
     using (SqlCommand cmd = new SqlCommand()
     {
         CommandType = CommandType.Text,
         CommandText = "SELECT TOP 1 * FROM Powerbi WHERE FrameId=@frameId",
     })
     {
         cmd.Parameters.AddWithValue("@frameId", FrameId);
         cmd.ExecuteReaderExt((dr) =>
         {
             TargetUrl = dr.StringOrBlank("Url").Trim();
             Action = (Models.PowerbiTypes)dr.IntOrZero("Type") == Models.PowerbiTypes.PowerbiType_Report ? "loadReport" : "loadTile";
             AccountId = dr.IntOrZero("AccountId");
             return false;
         });
     }
 }
Example #11
0
        public static List<Location> List(int levelId = 0)
        {
            List<Location> list = new List<Location>();

            using (SqlCommand cmd = new SqlCommand()
            {
                CommandType = CommandType.Text,
                CommandText =
                    "select l.*, v.Name Name2 from Location l inner join Level v on v.LevelId=l.LevelId " +
                    "where @levelId=0 or l.LevelId=@levelId order by v.Name, l.Name;",
            })
            {
                cmd.Parameters.AddWithValue("@levelId", levelId);
                cmd.ExecuteReaderExt((r) =>
                {
                    Location loc = new Location();
                    loc._initFromRow(r);
                    string name2 = r.StringOrBlank("Name2").Trim();
                    loc.Name = string.Format("{0} : {1}",
                        name2 == "" ? string.Format("Level {0}", loc.LevelId) : name2,
                        loc.Name
                        );
                    list.Add(loc);
                    return true;
                });
            }

            return list;
        }
Example #12
0
 private void _init()
 {
     using (SqlCommand cmd = new SqlCommand()
     {
         CommandType = CommandType.Text,
         CommandText = "SELECT TOP 1 o.*, Account, Password, Url, EwsVersion FROM Outlook o inner join ExchangeAccount x on x.AccountId=o.AccountId WHERE o.FrameId=@frameId",
     })
     {
         cmd.Parameters.AddWithValue("@frameId", FrameId);
         cmd.ExecuteReaderExt((dr) =>
         {
             Account = dr.StringOrBlank("Account").Trim();
             Password = (byte[])dr["Password"];
             Mode = dr.IntOrZero("Mode");
             EwsVersion = (ExchangeVersion)dr.IntOrZero("EwsVersion");
             ShowEvents = dr.IntOrZero("ShowEvents");
             if (ShowEvents < 0)
                 ShowEvents = 0;
             Mailbox = dr.StringOrBlank("Mailbox").Trim();
             if (string.IsNullOrWhiteSpace(Mailbox))
                 Mailbox = Account;
             Name = dr.StringOrBlank("Name").Trim();
             URL = dr.StringOrBlank("Url").Trim();
             Privacy = (DisplayMonkey.Models.OutlookPrivacy)dr.IntOrZero("Privacy");
             AllowReserve = dr.Boolean("AllowReserve");
             ShowAsFlags = dr.IntOrZero("ShowAsFlags");
             return false;
         });
     }
 }
Example #13
0
 private void _init()
 {
     using (SqlCommand cmd = new SqlCommand()
     {
         CommandType = CommandType.Text,
         CommandText = "SELECT TOP 1 i.*, Name FROM Picture i INNER JOIN Content c ON c.ContentId=i.ContentId WHERE i.FrameId=@frameId",
     })
     {
         cmd.Parameters.AddWithValue("@frameId", FrameId);
         cmd.ExecuteReaderExt((dr) =>
         {
             ContentId = dr.IntOrZero("ContentId");
             Mode = (RenderModes)dr.IntOrZero("Mode");
             Name = dr.StringOrBlank("Name");
             return false;
         });
     }
 }
Example #14
0
        private void _init()
        {
            using (SqlCommand cmd = new SqlCommand()
            {
                CommandType = CommandType.Text,
                CommandText = "SELECT TOP 1 * FROM Clock WHERE FrameId=@frameId",
            })
            {
                cmd.Parameters.AddWithValue("@frameId", this.FrameId);
                cmd.ExecuteReaderExt((dr) =>
                {
                    this.ShowDate = dr.Boolean("ShowDate");
                    this.ShowTime = dr.Boolean("ShowTime");
                    this.ShowSeconds = dr.Boolean("ShowSeconds");
                    this.Type = dr.IntOrZero("Type");
                    this.Label = dr.StringOrDefault("Label", null);

                    string szTimeZoneId = dr.StringOrDefault("TimeZone", null);
                    if (szTimeZoneId != null)
                        this.TimeZone = TimeZoneInfo.FindSystemTimeZoneById(szTimeZoneId);

                    return false;
                });
            }
        }