Exemple #1
0
        void create_transaction(int OrderId, CoachOrder order, MySqlConnection connection)
        {
            using (var cmd = connection.CreateCommand())
            {
                decimal final_price = PriceCalculator.CalculateCutFromTotalPriceWithFee(PriceCalculator.PayType.PayPal, order.mc_gross);

                cmd.CommandText = "INSERT INTO esc_Transactions (Amount, Status, Date, ReceiverId, senderId, OrderId) VALUES (@amount, @status, @date, @boosterid, @buyerid, @order_id)";
                cmd.Parameters.AddWithValue("@amount", final_price);
                cmd.Parameters.AddWithValue("@status", payment_status.Pending.ToString());
                cmd.Parameters.AddWithValue("@date", DateTime.UtcNow);
                cmd.Parameters.AddWithValue("@boosterid", order.receiver_id);
                cmd.Parameters.AddWithValue("@buyerid", order.payer_account_id);
                cmd.Parameters.AddWithValue("@order_id", OrderId);

                cmd.ExecuteNonQuery();
            }
        }