public void GetAvailableDispatchAdvices(Vendor vendor, IAuditLogAdapter log, string logPath, IUnitOfWork unit) { try { FtpManager AcknowledgementManager = new FtpManager(vendor.VendorSettings.GetValueByKey("VSNFtpUrl", string.Empty), "orderresponse/", vendor.VendorSettings.GetValueByKey("VSNUser", string.Empty), vendor.VendorSettings.GetValueByKey("VSNPassword", string.Empty), false, false, log); ProcessNotifications(AcknowledgementManager, OrderResponseTypes.Acknowledgement, log, vendor, logPath, unit); } catch (Exception ex) { log.AuditWarning("Acknowledment VSN failed", ex); } try { FtpManager ShipmentNotificationManager = new FtpManager(vendor.VendorSettings.GetValueByKey("VSNFtpUrl", string.Empty), "pakbonnen/", vendor.VendorSettings.GetValueByKey("VSNUser", string.Empty), vendor.VendorSettings.GetValueByKey("VSNPassword", string.Empty), false, false, log); ProcessNotifications(ShipmentNotificationManager, OrderResponseTypes.ShipmentNotification, log, vendor, logPath, unit); } catch (Exception ex) { log.Warn("Shipment Notification VSN failed", ex); } try { FtpManager InvoiceNotificationManager = new FtpManager(vendor.VendorSettings.GetValueByKey("VSNFtpUrl", string.Empty), vendor.VendorSettings.GetValueByKey("InvoicePath", string.Empty) + "/", vendor.VendorSettings.GetValueByKey("VSNUser", string.Empty), vendor.VendorSettings.GetValueByKey("VSNPassword", string.Empty), false, false, log); ProcessInvoiceNotifications(InvoiceNotificationManager, OrderResponseTypes.InvoiceNotification, log, vendor, logPath, unit); } catch (Exception ex) { log.AuditWarning("Invoice Notification VSN failed", ex); } try { FtpManager CancelNotificationManager = new FtpManager(vendor.VendorSettings.GetValueByKey("VSNFtpUrl", string.Empty), "cancellations/", vendor.VendorSettings.GetValueByKey("VSNUser", string.Empty), vendor.VendorSettings.GetValueByKey("VSNPassword", string.Empty), false, false, log); ProcessNotifications(CancelNotificationManager, OrderResponseTypes.CancelNotification, log, vendor, logPath, unit); } catch (Exception ex) { log.AuditWarning("Cancel Notification VSN failed", ex); } }
private bool UpdateOrderResponseLines(IEnumerable <OrderNotification> order, string htmlStatus) { var tryCounter = 0; var tryAgain = true; var successfullyUpdated = false; var listOfOrderResponseLineIDs = order .Where(x => x.OrderResponseLineID.HasValue) .Select(x => x.OrderResponseLineID.Value) .ToArray(); try { do { if (_orderRepo.UpdateHtmlOfOrderResponseLines(listOfOrderResponseLineIDs, htmlStatus)) { tryAgain = false; successfullyUpdated = true; } else { if (tryCounter < 6) { _log.AuditWarning(string.Format("Failed to update OrderResponseLines. OrderResponseLineIDs '{0}' Try #: {1}" , string.Join(", ", listOfOrderResponseLineIDs) , tryCounter)); tryCounter++; } else { tryAgain = false; } } } while (tryAgain); } catch { _log.AuditError(string.Format("Try Catch: Failed to update OrderResponseLines. OrderResponseLineIDs '{0}'", string.Join(", ", listOfOrderResponseLineIDs))); } return(successfullyUpdated); }