Beispiel #1
0
        /// <summary>
        /// Gets the transactions (credit log) of a user on given user session and sends it to the session's game connection.
        /// </summary>
        /// <param name="Session">The Woodpecker.Sessions.Session object to get the transaction for and to send the message to.</param>
        public void sendTransactions(ref Session Session)
        {
            if (Session.User == null)
                return;

            serverMessage Message = new serverMessage(209); // "CQ"
            Database Database = new Database(false, true);
            Database.addParameterWithValue("userid", Session.User.ID);

            Database.Open();
            if (Database.Ready)
            {
                DataTable creditLogData = Database.getTable("SELECT moment,type,activity FROM users_creditlog WHERE userid = @userid LIMIT 50");
                foreach (DataRow dRow in creditLogData.Rows)
                {
                    DateTime Moment = (DateTime)dRow["moment"];
                    Message.appendTabbedValue(Moment.ToString("dd/MM/yyyy"));
                    Message.appendTabbedValue(Moment.ToString("hh:mm"));
                    Message.appendTabbedValue(dRow["activity"].ToString());
                    Message.appendTabbedValue("0");
                    Message.appendTabbedValue("");
                    Message.Append(dRow["type"].ToString());
                    Message.appendChar(13);
                }
            }

            Session.gameConnection.sendMessage(Message);
        }