Beispiel #1
0
 public ReindexAllTask(ProductImporter importer, ProductManager manager, ElasticConfiguration configuration, Dictionary <string, IProductStore> stores)
 {
     _importer      = importer;
     _manager       = manager;
     _configuration = configuration;
     _stores        = stores;
 }
Beispiel #2
0
        public ImporterViewModel(ProductImporter importer, IProductServiceModel productServiceModel)
        {
            _importer            = importer;
            _productServiceModel = productServiceModel;

            // Create fake root
            CreateParameterViewModel(_importer.Parameters);
        }
    protected void uxImportButton_Click(object sender, EventArgs e)
    {
        uxMessagePanel.Controls.Clear();
        string localFilePath = Server.MapPath("~/" + uxFileNameText.Text.Trim());

        if (!File.Exists(localFilePath))
        {
            Label label = new Label();
            label.ForeColor = Color.Red;
            label.Text      = "File not found.";
            uxMessagePanel.Controls.Add(label);
            return;
        }

        Culture             culture  = DataAccessContext.CultureRepository.GetOne(uxLanguageDrop.SelectedValue);
        ProductImporter     importer = new ProductImporter(culture, new FileManager());
        ProductImportStatus status;
        TimeSpan            timeDiff;
        string storeID = CurrentStoreID;

        switch (uxModeRadioList.SelectedValue)
        {
        case "Purge":
            DataAccessContextDeluxe.PromotionProductRepository.DeleteAll();
            DataAccessContextDeluxe.ProductSubscriptionRepository.DeleteAll();
            status = importer.ImportProductPurgeAll(
                "~/" + uxFileNameText.Text.Trim(), uxImageProcessCheck.Checked, uxSkipImageProcessCheck.Checked, out timeDiff, storeID);
            UpdateMessage(status);
            UpdateTimeMessage(timeDiff, uxMessagePanel);
            break;

        case "Overwrite":
            status = importer.ImportProductOverwrite(
                "~/" + uxFileNameText.Text.Trim(), uxImageProcessCheck.Checked, uxSkipImageProcessCheck.Checked, out timeDiff, storeID);
            UpdateMessage(status);
            UpdateTimeMessage(timeDiff, uxMessagePanel);
            break;
        }

        AdminUtilities.ClearAllCache();
    }