private void ClickPushToDownloadImage(object sender, EventArgs e) { int countData = 0; var lstProductGroup = eventGetProductIDs(); var pa = new ProductAdapter(new SqlDb(QT.Entities.Server.ConnectionString)); MQPushDownloadImage mqPushDownloadImage = new MQPushDownloadImage(); for (int i = 0; i < lstProductGroup.Count; i++) { var lstProductIds = lstProductGroup.ElementAt(i).Value; foreach (var product in pa.GetProductEntitieBy(lstProductIds)) { countData++; mqPushDownloadImage.PushQueueChangeChangeImage(new ImageProductInfo(product.ID, product.Name, product.DetailUrl, product.ImageUrl, product.IsNews)); } } MessageBox.Show(string.Format("Pushed {0} message", countData)); }