コード例 #1
0
        public bool RecordEvent(UserImEvent ev)
        {
            m_log.DebugFormat(
                "[EVENT RECORDER]: Notified of avatar {0} {1} IM to {2} {3} {4} \"{5}\" in {6}",
                ev.UserName, ev.UserId, ev.IsReceiverGroup ? "group" : "user", ev.ReceiverId, ev.ReceiverName, ev.RegionName);

            return true;
        }
コード例 #2
0
        public bool RecordEvent(UserImEvent ev)
        {
            try
            {
                using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
                {
                    dbcon.Open();

                    using (MySqlCommand cmd = new MySqlCommand(
                        "insert into UserImEvents (UserId, UserName, ReceiverId, ReceiverName, ReceiverType, Text, GridId, RegionName, DateTime) values (?UserId, ?UserName, ?ReceiverId, ?ReceiverName, ?ReceiverType, ?Text, ?GridId, ?RegionName, ?DateTime)",
                        dbcon))
                    {
                        cmd.Parameters.AddWithValue("?UserId", ev.UserId);
                        cmd.Parameters.AddWithValue("?UserName", ev.UserName);
                        cmd.Parameters.AddWithValue("?ReceiverId", ev.ReceiverId);
                        cmd.Parameters.AddWithValue("?ReceiverName", ev.ReceiverName);
                        cmd.Parameters.AddWithValue("?ReceiverType", ev.IsReceiverGroup ? "group" : "user");
                        cmd.Parameters.AddWithValue("?Text", ev.Text);
                        cmd.Parameters.AddWithValue("?GridId", ev.GridId);
                        cmd.Parameters.AddWithValue("?RegionName", ev.RegionName);
                        cmd.Parameters.AddWithValue("?DateTime", ev.DateTime);
                        cmd.ExecuteNonQuery();
                    }
                }
            }
            catch (Exception e)
            {
                m_log.ErrorFormat("[MYSQL EVENT RECORDER]: Could not record {0}, error {1}", ev, e);

                return false;
            }

            return true;
        }