Exemplo n.º 1
0
        public void ActivityLog_Create(int accountid, int userid, string entitytype, string entityaction, DateTime activitydatetime, string activitydetails)
        {
            try
            {
                IActivityLogRepository activityrep = new EntityActivityLogRepository();

                ActivityLog activitylog = new ActivityLog();
                activitylog.AccountID = accountid;
                activitylog.UserID = userid;
                activitylog.Username = "******";
                activitylog.EntityType = entitytype;
                activitylog.EntityAction = entityaction;
                activitylog.ActivityDateTime = activitydatetime;
                activitylog.ActivityDetails = activitydetails;

                activityrep.CreateActivityLog(activitylog);
            }
            catch { }
        }
Exemplo n.º 2
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; }
        }