Developer forum

Forum » Development » Unnecessary database call for AccessUserCard

Unnecessary database call for AccessUserCard

Anders Ebdrup
Anders Ebdrup
Reply

Dear Dynamicweb,

 

Can you please add an extra for the userId being greater than 0 (or equivalent) in the method below, as this database call is executed on every step in the checkout even though the user is not logged in?

        public IEnumerable<PaymentCardToken> GetByUserId(int userId)
        {
            var ret = new List<PaymentCardToken>();
            var cb = CommandBuilder.Create("SELECT * FROM AccessUserCard WHERE AccessUserCardUserID = {0} ORDER BY AccessUserCardUsedDate DESC", (object)userId);
            using (var reader = Database.CreateDataReader(cb))
            {
                while (reader.Read())
                {
                    var paymentCard = ExtractPaymentCard(reader);
                    if (string.Equals(paymentCard.CheckSum, CalculateCheckSum(paymentCard), StringComparison.OrdinalIgnoreCase))
                    {
                        ret.Add(paymentCard);
                    }
                }
            }

            return ret;
        }

 

Best regards,
Anders


Replies

 
Shiwanka Chathuranga Dynamicweb Employee
Shiwanka Chathuranga
Reply

+1 

 
Vincent Gercke
Reply

+1

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Bug #9806 - send to test.

 
Kristian Kirkholt Dynamicweb Employee
Kristian Kirkholt
Reply
This post has been marked as an answer

Hi Anders, Shiwanka and Vincent

Problem regarding #9806 has been fixed in Dynamicweb version 9.14.2 
Packages: Ecommerce 1.14.8+

Sorry for any inconvenience

Care Support
Kristian Kirkholt

 

Votes for this answer: 1

 

You must be logged in to post in the forum