protected void CreateCompressUpload() { try { FeedOptions options = GetPostedOptions(); List <string> messages = new List <string>(); feedProvider = new ShoppingComFeed(); // handle using asynchronous way if (feedOperationStatus == null) { feedOperationStatus = feedProvider.FeedOperationStatus; SetApplicationVariable(KeyFeedStatus, feedOperationStatus); } feedProvider.BeginCreateCompressUploadFeed(options, new AsyncCallback(this.EndAsynFeedOperationCallBack), ""); feedOperationStatus.Messages.Add("Creating feed File."); feedOperationStatus.StatusMessage = "Creating feed File."; feedOperationStatus.Percent = 0; ProgressBar1.ProgressText = "Creating feed File."; ProgressBar1.Value = 0; FeedCreationProgressPanel.Visible = true; FeedInputPanel.Visible = false; Timer1.Enabled = true; } catch (Exception exp) { ProgressBar1.ProgressText = "Error creating, compressing uploading feed file."; feedOperationStatus.Messages.Add("Error occured : " + exp.ToString() + " " + exp.Message); ProgressBar1.Value = 100; Timer1.Enabled = false; } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { FeedOptions options = new FeedOptions(); options.Load(new ShoppingComOptionKeys()); if (!string.IsNullOrEmpty(options.FeedFileName)) { FeedFileName.Text = options.FeedFileName; } else { FeedFileName.Text = "ShoppingComFeedData.csv"; } if (options.OverwriteFeedFile) { AllowOverwrite.SelectedIndex = 1; } else { AllowOverwrite.SelectedIndex = 0; } AllProducts.Checked = options.IncludeAllProducts; MarkedProducts.Checked = !options.IncludeAllProducts; if (!string.IsNullOrEmpty(options.CompressedFeedFileName)) { CompressedFeedFileName.Text = options.CompressedFeedFileName; } else { CompressedFeedFileName.Text = "ShoppingComFeedData.csv.zip"; } if (options.OverwriteCompressedFile) { AllowOverwriteCompressed.SelectedIndex = 1; } else { AllowOverwriteCompressed.SelectedIndex = 0; } FtpHost.Text = options.FtpHost; FtpPassword.Text = options.FtpPassword; FtpUser.Text = options.FtpUser; if (string.IsNullOrEmpty(options.RemoteFileName)) { RemoteFileName.Text = "ShoppingComFeedData.csv"; } else { RemoteFileName.Text = options.RemoteFileName; } } MessagePanel.Visible = false; // initialize the feedOperationStatus from StatusContainer cache if (feedOperationStatus == null) { feedOperationStatus = StatusContainer[KeyFeedStatus] as FeedOperationStatus; // If new page is opened and feed operation in progress // then show only the progress panel if (!Page.IsPostBack && (feedOperationStatus != null || StatusContainer[KeyFeedStatusSuccess] != null)) { FeedCreationProgressPanel.Visible = true; FeedInputPanel.Visible = false; if (feedOperationStatus != null) { Timer1.Enabled = true; } UpdateStatusDisplay(); } } }