private void RefreshExportJobs() { if (RootMap != null) { ExportServiceManager.GetExportJobsCompleted.RegisterEvent(RootMap.Id, OnGetExportJobsCompleted); ExportServiceManager.GetExportJobsAsync(RootMap.ParentId, RootMap.Id); } }
private void UserControl_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { if (e.NewValue != e.OldValue) { var rootMap = e.NewValue as RootMap; if (rootMap != null) { Visibility = Visibility.Visible; ExportServiceManager.GetExportJobsCompleted.RegisterEvent(rootMap.Id, OnGetExportJobsCompleted); ExportServiceManager.GetExportJobsAsync(rootMap.ParentId, rootMap.Id); SelectAll(); } else { Visibility = Visibility.Collapsed; } } }
/// <summary> /// Demonstrate retriving coupon codes from Promo /// </summary> /// <param name="companyKey"></param> /// <param name="couponImportKey"></param> /// <returns>result message</returns> private static string Sample_RetrieveCouponCodesFromPromo(string companyKey, string couponImportKey) { var exportService = new ExportServiceManager(ServiceTarget.EvaluationServices); var couponCodeExportRequest = SampleRequests.GetCouponCodesExportRequest(companyKey, couponImportKey); var exportResponse = exportService.ExportCouponCodes(couponCodeExportRequest); // Now look at the response and display some information in the console. if (exportResponse.Summary.ProcessedSuccessfully != true) { // Something went wrong with the import, so show the message. return(exportResponse.Summary.GetErrorDisplayText()); } else { // Get some display text from the import result. return(exportResponse.GetDisplayText()); } }
private static string Sample_RetrieveBasketPromotionsForDayByProduct(string companyKey) { // Create the export service manager - targeting the evaluation services. var exportService = new ExportServiceManager(ServiceTarget.EvaluationServices); // Get the request details. var getPromotionsRequest = SampleRequests.GetPromotionDetailsByProductRequest(companyKey); // Submit the request and get the response var promosResponse = exportService.ExportPromotionsForProducts(getPromotionsRequest); // Now look at the response and display some information in the console. if (promosResponse.Summary.ProcessingResult != true) { // Something went wrong, so show the message. return(promosResponse.Summary.GetErrorDisplayText()); } else { // Display the promotion details. return(promosResponse.Promotions.GetDisplayText()); } }
private void Cancel_OnClick(object sender, RoutedEventArgs e) { var button = sender as RadButton; if (button != null) { var exportJob = button.DataContext as IExportJob; if (exportJob != null) { SuperMessageBoxService.ShowConfirmation("Cancel Export Confirmation", "Are you sure to cancel the export?", () => { if (!IsBusy) { IsBusy = true; ExportServiceManager.DeleteExportJobCompleted.RegisterEvent(exportJob.Id, OnDeleteExportJobCompleted); ExportServiceManager.DeleteExportJobAsync(exportJob); } }); } } }
private void ExportOptionDialogOnExportOptionSelected(object sender, ExportOptionSelectedEventArgs e) { try { var exportType = e.ExportOption.ExportType; var mapType = e.ExportOption.MapType; IExportJob exist = null; #if DEBUG foreach (var exportJob in RootMap.ExportJobs) { var exportOption = new ExportOption(exportJob.ExportProperties, exportJob.Type, exportJob.MapType); if (exportOption.Equals(e.ExportOption)) { exist = exportJob; break; } } //exist = RootMap.ExportJobs.FirstOrDefault(q => new ExportOption(q.ExportProperties, q.Type, q.MapType).Equals(e.ExportOption)); #else exist = RootMap.ExportJobs.FirstOrDefault(q => new ExportOption(q.ExportProperties, q.Type, q.MapType).Equals(e.ExportOption) && q.IsCurrent); #endif if (exist != null) { switch (exist.Status) { case ExportStatus.Completed: SuperMessageBoxService.ShowInformation("Export Exists", "An existing export that matches is up-to-date and ready for download already"); break; case ExportStatus.Error: SuperMessageBoxService.ShowInformation("Export Exists", "An existing export that matches did not complete successfully, delete the failed export and try again"); break; case ExportStatus.Processing: case ExportStatus.Scheduled: SuperMessageBoxService.ShowInformation("Export Exists", string.Format("An existing export that matches is already {0}, please wait until it has completed", exist.Status.ToString().ToLower())); break; default: break; } IsBusy = false; } else { ExportServiceManager.CreateExportJobCompleted.RegisterEvent(RootMap.Id, OnCreateExportJobCompleted); ExportServiceManager.CreateExportJobAsync(RootMap.ParentId, RootMap.Id, e.ExportOption.Value, mapType, exportType); DebugLogger.Instance.LogMsg("Submitted export job details, Domain: {0}, RootMap: {1}, MapType: {2}, ExportType: {3}", RootMap.ParentId, RootMap.Id, mapType, exportType); } } catch (Exception ex) { DebugLogger.Instance.LogMsg("An error occurred processing the Export Options dialog. {0}.", ex.ToString()); SuperMessageBoxService.ShowError("Error Occurred", "You cannot export the map at the moment, please try again later."); } }