Exemplo n.º 1
0
        private Player CreateExamplePlayer(int accountid, int playergroupid, string playername)
        {
            try
            {
                IPlayerRepository playerrep = new EntityPlayerRepository();

                Player player = new Player();
                player.AccountID         = accountid;
                player.PlayerGroupID     = playergroupid;
                player.PlayerName        = playername;
                player.PlayerLocation    = String.Empty;
                player.PlayerDescription = String.Empty;
                player.IsActive          = true;
                playerrep.CreatePlayer(player);

                return(player);
            }
            catch { return(null); }
        }
Exemplo n.º 2
0
        private Player CreateExamplePlayer(int accountid, int playergroupid, string playername)
        {
            try
            {
                IPlayerRepository playerrep = new EntityPlayerRepository();

                Player player = new Player();
                player.AccountID = accountid;
                player.PlayerGroupID = playergroupid;
                player.PlayerName = playername;
                player.PlayerLocation = String.Empty;
                player.PlayerDescription = String.Empty;
                player.IsActive = true;
                playerrep.CreatePlayer(player);

                return player;
            }
            catch { return null; }
        }
Exemplo n.º 3
0
        private string BuildPlayerHeartbeatTable()
        {
            try
            {
                int accountid = 0;
                if (Session["UserAccountID"] != null)
                    accountid = Convert.ToInt32(Session["UserAccountID"]);
                StringBuilder sb = new StringBuilder();

                IPlayerRepository playerrep = new EntityPlayerRepository();
                IEnumerable<Player> players = playerrep.GetAllPlayers(accountid);

                if (players == null || players.Count() == 0) return String.Empty;

                IActivityLogRepository alrep = new EntityActivityLogRepository();

                sb.AppendLine("<table style=\"border-spacing:0;border-collapse:collapse;\" class=\"gridtable\">");
                sb.AppendLine("<tr>");
                sb.AppendLine("<td class=\"gridheader\">Player Name</td>");
                sb.AppendLine("<td class=\"gridheader\">Last Heartbeat (UTC)</td>");
                sb.AppendLine("<td class=\"gridheader\"># Hours/Minutes Ago</td>");
                sb.AppendLine("</tr>");

                foreach (Player player in players)
                {
                    sb.AppendLine("<tr class=\"gridrow\">");
                    sb.AppendLine("<td class=\"gridtext\">" + player.PlayerName + "</td>");
                    DateTime dt = alrep.GetLastPlayerHeartbeat(player.PlayerID);
                    if (dt != DateTime.MinValue)
                    {
                        sb.AppendLine("<td class=\"gridtext\">" + dt.ToShortDateString() + " " + dt.ToShortTimeString() + "</td>");
                        TimeSpan ts = DateTime.UtcNow.Subtract(dt);
                        sb.AppendLine("<td class=\"gridtext\">" + String.Format("{0:00}", ts.TotalHours) + ":" + String.Format("{0:00}", ts.Minutes) + "</td>");
                    }
                    else
                    {
                        sb.AppendLine("<td class=\"gridtext\"></td>");
                        sb.AppendLine("<td class=\"gridtext\"></td>");
                    }
                    sb.AppendLine("</tr>");

                }

                sb.Append("</table>");

                return sb.ToString();
            }
            catch { return String.Empty; }
        }