private void ProcessResendPriceUpdateToWehkampProducts(IEnumerable <ProductInformation> products, int vendorID) { var productIDs = products.Where(p => p.ResendPriceUpdateToWehkamp != null && p.ResendPriceUpdateToWehkamp.ToLowerInvariant() == "true").Select(product => product.ProductID).ToList(); if (productIDs.Count == 0) { return; } try { using (var db = new PetaPoco.Database(Environments.Current.Connection, "System.Data.SqlClient")) { db.CommandTimeout = 600; //10 minutes var sql = string.Format("UPDATE VendorPrice SET LastUpdated = GETDATE() WHERE VendorAssortmentID IN (SELECT VendorAssortmentID FROM VendorAssortment va INNER JOIN Product p ON p.ProductID = va.ProductID WHERE p.ParentProductID IN ({0}) AND va.VendorID = {1})", string.Join(",", productIDs.ToArray()), vendorID); db.Execute(sql); sql = string.Format("DELETE FROM ProductAttributeValue WHERE AttributeID = {0} AND ProductID IN ({1})", VendorSettingsHelper.GetResendPriceUpdateToWehkampAttributeID(), string.Join(",", productIDs.ToArray())); db.Execute(sql); } } catch (Exception ex) { log.AuditError(String.Format("ProcessResendPriceUpdateToWehkampProducts. ProductID's : {0}", string.Join(",", productIDs.ToArray())), ex); } }