Эх сурвалжийг харах

Improve SellerInvoiceResponse_Changed()

Snoopy 3 жил өмнө
parent
commit
923e1cb09b

+ 6 - 1
TCCInvoice/InvoiceGenerator.cs

@@ -282,7 +282,7 @@ namespace TCCInvoice
         {
             XDocument xDoc = XDocument.Load(e.FullPath);
 
-            int index = 0;
+            int index = -1;
             string status = xDoc.Descendants("Status").ElementAt(0).Value;
             string invoicenumber = xDoc.Descendants("InvoiceNumber").ElementAt(0).Value;
             foreach (InvoiceResponseItem item in invoiceResponseItemList)
@@ -292,6 +292,11 @@ namespace TCCInvoice
                     index = invoiceResponseItemList.IndexOf(item);
                 }
             }
+
+            if (index == -1)
+            {
+                return; // something wrong
+            }
             
             if (status == "1") // 上傳成功
             {