private void dgvShed_CellEnter(object sender, DataGridViewCellEventArgs e) { Credential selectedCredential = CredentialService.GetCredential((int)dgvShed.CurrentCell.Tag); lblCreated.Text = "Created: " + selectedCredential.Created; lblModified.Text = "Modified: " + selectedCredential.Modified; }
public BigCommerceMarketplaceOrdersProviderTests() { AutoMapperConfig.RegisterAutoMappers(); _credentialService = new CredentialService(); _credential = _credentialService.GetCredential("BigCommerce", MarketplaceMode.TEST.ToString()); _credentialRepository = new CredentialRepository(); _credentialRepo = _credentialRepository.GetDefaultCredential("BigCommerce", MarketplaceMode.TEST.ToString()); }
public IActionResult ConfirmSelection(int credentialID) { List <SelectionConfirmationItem> selectionConfirmationItems = selectionService.GetSelectionConfirmationItems(credentialID); ViewBag.CandidateSelections = selectionConfirmationItems; CredentialItem credentialItem = credentialService.GetCredential(credentialID); return(View("ConfirmSelection", credentialItem)); }
protected override void ProcessRecord() { base.ProcessRecord(); if (Credential == null) { var cred = CredentialService.GetCredential(); Credential = new PSCredential(cred.UserName, cred.Password.ToSecureString()); } if (Credential == null) { ThrowTerminatingError(new ErrorRecord(new ParameterBindingException("Credential was null"), "", ErrorCategory.InvalidArgument, null)); } }
// traitement principal async Task Run(ILogger logger, Args args) { WebTaskMonitorFactory.MaxConcurrency = args.MaxConcurrency.Value; using (var client = new HighlightClient(args.Url.Value)) { try { var credSrv = new CredentialService(logger); await client.Authenticate(await credSrv.GetCredential(args)); } catch (Exception ex) { throw new UnauthorizedAccessException("Authentication failed", ex); } Exception appInfoServiceException = null; try { var appInfoService = new AppInfoService(logger, client, args); await appInfoService.Run(); } catch (Exception ex) { appInfoServiceException = ex; } Exception auditServiceException = null; try { var auditService = new AuditService(logger, client, args); await auditService.Run(); } catch (Exception ex) { auditServiceException = ex; } if (appInfoServiceException != null || auditServiceException != null) { if (appInfoServiceException == null) { throw auditServiceException; } if (auditServiceException == null) { throw appInfoServiceException; } throw new AggregateException(appInfoServiceException, auditServiceException); } } }
protected override void bw_DoWork(object sender, DoWorkEventArgs e) { if (_isWorkerExecuted) { return; } // set the flag the this bw_DoWork has already called _isWorkerExecuted = true; var counter = 0; var service = new CredentialService(); var credential = (eBayCredentialDto)service.GetCredential(CredentialType.EBAY, _systemJob.SupportiveParameters); _itemFeeds = readProductItemFeeds(_systemJob.Parameters); // init the eBay API RequestHelper.SetCredentials(credential); // init the context var context = new ApiContext(); context.ApiCredential = RequestHelper.ApiCredential; context.SoapApiServerUrl = RequestHelper.ServiceUrl; setTotalItemsProcessed(_itemFeeds.Count); _logger.LogInfo(LogEntryType.eBayEndListing, string.Format("{0} items for eBay EndListing has started...", _itemFeeds.Count)); // iterate and submit end item feed to the eBay for (var i = 0; i < _itemFeeds.Count; i++) { var itemFeed = _itemFeeds[i]; var percentage = (((double)i + 1) / _itemFeeds.Count) * 100.00; Console.WriteLine(string.Format("{0:#0.00}% Sending feed 1 x 1 for eBay Product EndItem...", percentage)); // report the progress counter++; _bw.ReportProgress(counter); try { if (string.IsNullOrEmpty(itemFeed.ItemId)) { itemFeed.Status = Status.NOT_PROCESSED; itemFeed.Message = "ItemId is NULL or empty"; continue; } // create the end item request var apiCall = new EndItemCall(context); apiCall.EndItem(itemFeed.ItemId, EndReasonCodeType.NotAvailable); // let's set the eBay product ItemId to null _repo.UpdateeBayEndedItem(itemFeed.EisSKU); itemFeed.Status = Status.SUCCESS; // sleep for 1 second - throttle limit Thread.Sleep(1000); } catch (Exception ex) { Console.WriteLine("Error in submitting eBay product end listing {0}. Error Message: {1}", _itemFeeds[i].EisSKU, EisHelper.GetExceptionMessage(ex)); itemFeed.Status = Status.FAILED; itemFeed.Message = string.Format("Error in sending endlisting feed. Message: {0}", EisHelper.GetExceptionMessage(ex)); } } _logger.LogInfo(LogEntryType.eBayEndListing, string.Format("{0} items for eBay EndListing has finished!", _itemFeeds.Count)); }
protected override void bw_DoWork(object sender, DoWorkEventArgs e) { if (_isWorkerExecuted) { return; } // set the flag the this bw_DoWork has already called _isWorkerExecuted = true; var counter = 0; var service = new CredentialService(); var credential = (eBayCredentialDto)service.GetCredential(CredentialType.EBAY, _systemJob.SupportiveParameters); _itemFeeds = readProductItemFeeds(_systemJob.Parameters); // init the eBay API RequestHelper.SetCredentials(credential); // init the context var context = new ApiContext(); context.ApiCredential = RequestHelper.ApiCredential; context.SoapApiServerUrl = RequestHelper.ServiceUrl; setTotalItemsProcessed(_itemFeeds.Count); _logger.LogInfo(LogEntryType.eBayEndListing, string.Format("{0} items for eBay Product ReListing has started...", _itemFeeds.Count)); // iterate and submit end item feed to the eBay for (var i = 0; i < _itemFeeds.Count; i++) { var percentage = (((double)i + 1) / _itemFeeds.Count) * 100.00; Console.WriteLine(string.Format("{0:#0.00}% Sending feed 1 x 1 for eBay Product ReListing...", percentage)); // report the progress counter++; _bw.ReportProgress(counter); var itemFeed = _itemFeeds[i]; try { // get the product detailf or the product relisting var productFeed = _service.GetProductPostFeedByEisSku(_itemFeeds[i].EisSKU); if (string.IsNullOrEmpty(itemFeed.ItemId)) { itemFeed.Status = Status.NOT_PROCESSED; itemFeed.Message = "ItemId is NULL or empty"; continue; } // build item type var itemType = RequestHelper.CreateItemType(productFeed, credential.eBayDescriptionTemplate); itemType.ItemID = productFeed.eBayProductFeed.ItemId; // submit the item for relisting var apiCall = new RelistFixedPriceItemCall(context); apiCall.Item = itemType; apiCall.Execute(); // update the product ItemId _repo.UpdateReListedeBayProduct(itemFeed.EisSKU, apiCall.ItemID); itemFeed.Status = Status.SUCCESS; itemFeed.Message = string.Format("{0} - New relisted ItemId: {1}", apiCall.ApiResponse.Ack, apiCall.ItemID); // sleep for 1 second - throttle limit Thread.Sleep(1000); } catch (Exception ex) { Console.WriteLine("Error in submitting eBay Product ReListing {0}. Error Message: {1}", _itemFeeds[i].EisSKU, EisHelper.GetExceptionMessage(ex)); itemFeed.Status = Status.FAILED; itemFeed.Message = string.Format("Error in sending relisting feed. Message: {0}", EisHelper.GetExceptionMessage(ex)); } } _logger.LogInfo(LogEntryType.eBayEndListing, string.Format("{0} items for eBay EndListing has finished!", _itemFeeds.Count)); }