コード例 #1
0
        public async Task GetNewSalesOrdersAsync()
        {
            _allNewSaleOrders = new List <SalesOrder>();

            RaisePropertyChanged("FilteredSalesOrders");

            _allNewSaleOrders = await _parserService.GetSalesOrdersAsync();

            RaisePropertyChanged("FilteredSalesOrders");
            RaisePropertyChanged("ViewHeader");
        }
コード例 #2
0
        public async Task PerformTestAsync(string outputDirectory)
        {
            StatusMessage = "Scanning sales order folder....";

            var salesOrders = await _salesOrderService.GetSalesOrdersAsync();

            if (!salesOrders.Any())
            {
                StatusMessage = "No orders found!";
                return;
            }

            var failedOrders = salesOrders.Where(so => so.EarliestDeliveryDate == DateTime.MinValue);

            if (failedOrders.Any())
            {
                foreach (var so in failedOrders)
                {
                    foreach (var att in so.Mail.ExtractedAttachments)
                    {
                        var fileName = Path.Combine(outputDirectory, Path.GetFileName(att));

                        if (!File.Exists(fileName))
                        {
                            File.Copy(so.Mail.ExtractedAttachments[0], fileName);
                        }
                    }
                }

                StatusMessage = $"Failed to parse {failedOrders.Count()} orders. Orders copied to selected directory.";
            }
            else
            {
                StatusMessage = "All sales order were processed successfully!";
            }
        }