protected void btnUploadProductList_Click(object sender, EventArgs e) { var file = importFile.PostedFile; if (string.IsNullOrWhiteSpace(file.FileName)) { ShowErrorMessage("You need to choose the import file."); return; } if (SelectedSiteID == 0) { ShowErrorMessage("You need to choose the Site."); return; } var fileData = ReadFileFromRequest(file); var excelType = ImportHelper.GetExcelTypeFromFileName(file.FileName); try { ImportResult result = null; if (SelectedPageType.Equals(CampaignsProduct.CLASS_NAME)) { result = new CampaignProductImportService().ProcessProductImagesImportFile(fileData, excelType, SelectedSiteID); } else { result = new ProductImportService().ProcessProductImagesImportFile(fileData, excelType, SelectedSiteID); } if (result.ErrorMessages.Length > 0) { ShowErrorMessage(FormatImportResult(result)); } else { ShowSuccessMessage("Operation successfully completed"); } } catch (Exception ex) { EventLogProvider.LogException("Import product images", "EXCEPTION", ex); ShowErrorMessage("There was an error while processing the request. Detailed information was placed in log."); } }
public IndexModel(ProductImportService importService) { _importService = importService; }