GetAll()
+ {
+ throw new NotImplementedException();
+ }
+
+ public override Customer GetSingle(P pkValue)
+ {
+ throw new NotImplementedException();
+ }
+
+ public override void Update(Customer entity)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/LoggingClient/LoggingClient/ViewModel/CustomerViewModel.cs b/LoggingClient/LoggingClient/ViewModel/CustomerViewModel.cs
index 3c4c93d..d56b17e 100755
--- a/LoggingClient/LoggingClient/ViewModel/CustomerViewModel.cs
+++ b/LoggingClient/LoggingClient/ViewModel/CustomerViewModel.cs
@@ -34,6 +34,29 @@ namespace LoggingClient.ViewModel
private List _customers;
public Customer NewCustomerEntry { get; set; }
+ private bool _EfIsChecked;
+ private bool _LinqIsChecked;
+
+ public bool EfIsChecked
+ {
+ get { return _EfIsChecked; }
+ set
+ {
+ _EfIsChecked = value;
+ OnPropertyChanged(nameof(EfIsChecked));
+ }
+ }
+
+ public bool LinqIsChecked
+ {
+ get { return _LinqIsChecked; }
+ set
+ {
+ _LinqIsChecked = value;
+ OnPropertyChanged(nameof(LinqIsChecked));
+ }
+ }
+
public CustomerViewModel()
{
TxtConnectionString = "Server=localhost;Database=inventarisierungsloesung;Uid=root;Pwd=MySQLPassword1234!;";
@@ -120,28 +143,76 @@ namespace LoggingClient.ViewModel
}
private void LoadData()
{
- try
+ if (_EfIsChecked)
{
- var customerModelRepository = new CustomerRepository(TxtConnectionString);
- this.Customers = customerModelRepository.GetAll().ToList();
- PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("LocationTree"));
+
+ try
+ {
+ var customerModelRepository = new CustomerRepositoryEF(TxtConnectionString);
+ this.Customers = customerModelRepository.GetAll().ToList();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show("Error occurred: " + ex.Message);
+ }
}
- catch (Exception ex)
+ if (_LinqIsChecked)
{
- MessageBox.Show("Error occurred: " + ex.Message);
+ //TODO
+ }
+ else
+ {
+ try
+ {
+ var customerModelRepository = new CustomerRepository(TxtConnectionString);
+ this.Customers = customerModelRepository.GetAll().ToList();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show("Error occurred: " + ex.Message);
+ }
}
}
private void AddData()
{
- try
+ if (_EfIsChecked)
{
- var customerModelRepository = new CustomerRepository(TxtConnectionString);
- customerModelRepository.Add(this.NewCustomerEntry);
- this.Customers = customerModelRepository.GetAll().ToList();
+ try
+ {
+ var customerModelRepository = new CustomerRepositoryEF(TxtConnectionString);
+ customerModelRepository.Add(this.NewCustomerEntry);
+ this.Customers = customerModelRepository.GetAll().ToList();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show("Error occurred: " + ex.Message);
+ }
}
- catch (Exception ex)
+ if (_LinqIsChecked)
{
- MessageBox.Show("Error occurred: " + ex.Message);
+ try
+ {
+ var customerModelRepository = new CustomerRepository(TxtConnectionString);
+ customerModelRepository.Add(this.NewCustomerEntry);
+ this.Customers = customerModelRepository.GetAll().ToList();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show("Error occurred: " + ex.Message);
+ }
+ }
+ else
+ {
+ try
+ {
+ var customerModelRepository = new CustomerRepository(TxtConnectionString);
+ customerModelRepository.Add(this.NewCustomerEntry);
+ this.Customers = customerModelRepository.GetAll().ToList();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show("Error occurred: " + ex.Message);
+ }
}
}
private void DeleteData()
diff --git a/LoggingClient/LoggingClient/Views/CustomerView.xaml b/LoggingClient/LoggingClient/Views/CustomerView.xaml
index 2d71fc1..1ae7aec 100755
--- a/LoggingClient/LoggingClient/Views/CustomerView.xaml
+++ b/LoggingClient/LoggingClient/Views/CustomerView.xaml
@@ -149,7 +149,10 @@
-
+
+
+
+
\ No newline at end of file