Example #1
0
        static void Main()
        {
            Log.Logger = new LoggerConfiguration()
                         .WriteTo.File(logPath)
                         .CreateLogger();
            Log.Information("Program started");

            try
            {
                // Pull orders in 'Awaiting Shipment' and 'Partially Shipped' status
                JArray ordersAwaitingShipment = BigCommerceController.GetOrdersByStatus(awaitingShipmentStatusId);
                JArray partiallyShippedOrders = BigCommerceController.GetOrdersByStatus(partiallyShippedStatusId);

                // Merge the two JArray's
                JArray allOrdersAwaitingShipments = MergeJArrays(ordersAwaitingShipment, partiallyShippedOrders);

                // Create shipments in Big Commerce if any new item fulfillments are found in NetSuite
                if (allOrdersAwaitingShipments.Count() == 0)
                {
                    Log.Information("No shipments to import");
                    return;
                }

                ImportShipmentsToBigCommerce(allOrdersAwaitingShipments);

                return;
            }
            catch (Exception ex)
            {
                Log.Error("Error: {@ex}", ex);
                string      title        = "Error in NestProShipments";
                string      text         = $"Error message: {ex.Message}";
                string      color        = "red";
                TeamsHelper teamsMessage = new TeamsHelper(title, text, color, teamsUrl);
                teamsMessage.LogToMicrosoftTeams(teamsMessage);
            }
        }