[fix:] Import with AddressPatch hasn't been called

This commit is contained in:
Elias Fierke
2025-10-04 14:29:02 +02:00
parent 47942ddd78
commit 8af9856afa

View File

@@ -317,7 +317,24 @@ public partial class MainWindow : Window
foreach (var customer in Settings._instance.customers.customers) foreach (var customer in Settings._instance.customers.customers)
if (customer.ID == Customer.GetIDByCustomerListItem(LstCustomers.SelectedItems[0].ToString())) if (customer.ID == Customer.GetIDByCustomerListItem(LstCustomers.SelectedItems[0].ToString()))
{
if (customer.patch == null) if (customer.patch == null)
{
var got = DataImport.ImportKasAddressList(selected_path);
if (!got.Item1)
{
Console.WriteLine("Error while importing. Please try another file.");
}
else
{
got.Item2.SetOwner(customer.ID);
Settings._instance.addressSets.addresses.Add(got.Item2);
}
//var customer_id = int.Parse(LstCustomers.SelectedItem.ToString().Split(" - ")[0]);
RefreshAddressSetListItems(customer.ID);
}
else
{ {
var got = DataImport.ImportKasAddressList(selected_path, customer.patch); var got = DataImport.ImportKasAddressList(selected_path, customer.patch);
if (!got.Item1) if (!got.Item1)
@@ -330,9 +347,11 @@ public partial class MainWindow : Window
Settings._instance.addressSets.addresses.Add(got.Item2); Settings._instance.addressSets.addresses.Add(got.Item2);
} }
var customer_id = int.Parse(LstCustomers.SelectedItem.ToString().Split(" - ")[0]); //var customer_id = int.Parse(LstCustomers.SelectedItem.ToString().Split(" - ")[0]);
RefreshAddressSetListItems(customer_id); RefreshAddressSetListItems(customer.ID);
} }
}
Settings.Save(); Settings.Save();
} }
@@ -386,7 +405,7 @@ public partial class MainWindow : Window
if (paths?.Count <= 0) return; if (paths?.Count <= 0) return;
if (LstSettingsCustomers.SelectedIndex < 0) return; //if (LstSettingsCustomers.SelectedIndex < 0) return;
var selected_path = paths[0].Path; var selected_path = paths[0].Path;