Esempio n. 1
0
        private async void DeleteCancelledOrders(List <MarketplaceOrder> ordersResults)
        {
            var shipStationService = new ShipStationService();
            var orderId            = "";
            var marketPlace        = "";

            try
            {
                ordersResults = ordersResults.Where(o => o.OrderStatus == OrderStatus.Canceled).ToList();

                if (ordersResults.Count > 0)
                {
                    marketPlace = ordersResults.FirstOrDefault().Marketplace;

                    foreach (var order in ordersResults)
                    {
                        orderId = order.OrderId;

                        var shipStationTask = await shipStationService.DeleteOrderByOrderNumber(orderId);
                    }
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(LogEntryType.General,
                                 string.Format("Error in deleting orders for {1} to ShipStation. Order ID: {2},  Error message: {0}",
                                               EisHelper.GetExceptionMessage(ex),
                                               marketPlace,
                                               orderId),
                                 ex.StackTrace);

                _emailService.SendEmailAdminException(subject: string.Format("{0} - Delete ShipStation Order From Marketplaces Error", marketPlace),
                                                      exParam: ex,
                                                      useDefaultTemplate: true,
                                                      url: "DeleteCancelledOrders Method",
                                                      userName: string.Format("OrdersService , Order Id: {0}", orderId));
            }
        }
        public void DeleteShipStationOrder(string orderId)
        {
            //delete order from ship station
            try
            {
                var shipStationService = new ShipStationService();
                var shipStationTask    = shipStationService.DeleteOrderByOrderNumber(orderId);
                shipStationTask.Wait();
            }
            catch (Exception ex)
            {
                var description = string.Format("{0} - Error in submitting delete order feed to Shipstation with OrderId: {1}. \nError Message: {2}",
                                                ChannelName,
                                                orderId,
                                                (ex.InnerException != null ? string.Format("{0} <br/>Inner Message: {1}", ex.Message, ex.InnerException.Message) : ex.Message));
                _logger.Add(LogEntrySeverity.Error, LogEntryType.EshopoOrders, description, ex.StackTrace);

                _emailService.SendEmailAdminException(subject: "Eshopo - Delete ShipStation Order Error",
                                                      exParam: ex,
                                                      useDefaultTemplate: true,
                                                      url: "/orders",
                                                      userName: String.Format("Order Id: {0}", orderId));
            }
        }
Esempio n. 3
0
 public async Task <bool> DeleteOrderByOrderNumber(string orderNumber)
 {
     return(await _shipStationService.DeleteOrderByOrderNumber(orderNumber));
 }