Prepared ViewModel for Linq, Add CustomerRepositoryLinq
This commit is contained in:
parent
d8852c59e6
commit
b67302361b
@ -16,6 +16,7 @@
|
|||||||
</userSettings>
|
</userSettings>
|
||||||
<connectionStrings>
|
<connectionStrings>
|
||||||
<add name="inventarisierungsloesungEntities" connectionString="metadata=res://*/Model.Inventar.csdl|res://*/Model.Inventar.ssdl|res://*/Model.Inventar.msl;provider=System.Data.SqlClient;provider connection string="data source=DESKTOP-8H0TJ4E;initial catalog=inventarisierungsloesung;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
|
<add name="inventarisierungsloesungEntities" connectionString="metadata=res://*/Model.Inventar.csdl|res://*/Model.Inventar.ssdl|res://*/Model.Inventar.msl;provider=System.Data.SqlClient;provider connection string="data source=DESKTOP-8H0TJ4E;initial catalog=inventarisierungsloesung;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
|
||||||
|
<add name="InventarDB" connectionString="metadata=res://*/DTO.DataAccessLayer.csdl|res://*/DTO.DataAccessLayer.ssdl|res://*/DTO.DataAccessLayer.msl;provider=System.Data.SqlClient;provider connection string="data source=DESKTOP-8H0TJ4E;initial catalog=inventarisierungsloesung;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
|
||||||
</connectionStrings>
|
</connectionStrings>
|
||||||
<entityFramework>
|
<entityFramework>
|
||||||
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
|
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
|
||||||
|
@ -86,6 +86,87 @@
|
|||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</ApplicationDefinition>
|
</ApplicationDefinition>
|
||||||
|
<Compile Include="DTO\abrechnung.cs">
|
||||||
|
<DependentUpon>DataAccessLayer.tt</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="DTO\address.cs">
|
||||||
|
<DependentUpon>DataAccessLayer.tt</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="DTO\contact.cs">
|
||||||
|
<DependentUpon>DataAccessLayer.tt</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="DTO\credentials.cs">
|
||||||
|
<DependentUpon>DataAccessLayer.tt</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="DTO\Customer.cs">
|
||||||
|
<DependentUpon>DataAccessLayer.tt</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="DTO\DataAccessLayer.Context.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
|
<DependentUpon>DataAccessLayer.Context.tt</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="DTO\DataAccessLayer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
|
<DependentUpon>DataAccessLayer.tt</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="DTO\DataAccessLayer.Designer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
|
<DependentUpon>DataAccessLayer.edmx</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="DTO\device.cs">
|
||||||
|
<DependentUpon>DataAccessLayer.tt</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="DTO\deviceport.cs">
|
||||||
|
<DependentUpon>DataAccessLayer.tt</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="DTO\devicetype.cs">
|
||||||
|
<DependentUpon>DataAccessLayer.tt</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="DTO\interface.cs">
|
||||||
|
<DependentUpon>DataAccessLayer.tt</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="DTO\kundenkonto.cs">
|
||||||
|
<DependentUpon>DataAccessLayer.tt</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="DTO\Location.cs">
|
||||||
|
<DependentUpon>DataAccessLayer.tt</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="DTO\log.cs">
|
||||||
|
<DependentUpon>DataAccessLayer.tt</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="DTO\network.cs">
|
||||||
|
<DependentUpon>DataAccessLayer.tt</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="DTO\operatingsystem.cs">
|
||||||
|
<DependentUpon>DataAccessLayer.tt</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="DTO\person.cs">
|
||||||
|
<DependentUpon>DataAccessLayer.tt</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="DTO\pointofdelivery.cs">
|
||||||
|
<DependentUpon>DataAccessLayer.tt</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="DTO\produkte.cs">
|
||||||
|
<DependentUpon>DataAccessLayer.tt</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="DTO\produktegruppe.cs">
|
||||||
|
<DependentUpon>DataAccessLayer.tt</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="DTO\softwaredienstleistung.cs">
|
||||||
|
<DependentUpon>DataAccessLayer.tt</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="DTO\town.cs">
|
||||||
|
<DependentUpon>DataAccessLayer.tt</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="DTO\transportmedium.cs">
|
||||||
|
<DependentUpon>DataAccessLayer.tt</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="DTO\v_logentries.cs">
|
||||||
|
<DependentUpon>DataAccessLayer.tt</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Model\Customer.cs">
|
<Compile Include="Model\Customer.cs">
|
||||||
<DependentUpon>Inventar.tt</DependentUpon>
|
<DependentUpon>Inventar.tt</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@ -110,6 +191,7 @@
|
|||||||
<Compile Include="Model\SeverityComboBoxItem.cs" />
|
<Compile Include="Model\SeverityComboBoxItem.cs" />
|
||||||
<Compile Include="Repository\CustomerRepository.cs" />
|
<Compile Include="Repository\CustomerRepository.cs" />
|
||||||
<Compile Include="Repository\CustomerRepositoryEF.cs" />
|
<Compile Include="Repository\CustomerRepositoryEF.cs" />
|
||||||
|
<Compile Include="Repository\CustomerRepositoryLinq.cs" />
|
||||||
<Compile Include="Repository\IRepositoryBase.cs" />
|
<Compile Include="Repository\IRepositoryBase.cs" />
|
||||||
<Compile Include="Repository\LocationRepository.cs" />
|
<Compile Include="Repository\LocationRepository.cs" />
|
||||||
<Compile Include="Repository\LoggingRepository.cs" />
|
<Compile Include="Repository\LoggingRepository.cs" />
|
||||||
@ -180,6 +262,13 @@
|
|||||||
<Generator>EntityModelCodeGenerator</Generator>
|
<Generator>EntityModelCodeGenerator</Generator>
|
||||||
<LastGenOutput>Inventar.Designer.cs</LastGenOutput>
|
<LastGenOutput>Inventar.Designer.cs</LastGenOutput>
|
||||||
</EntityDeploy>
|
</EntityDeploy>
|
||||||
|
<EntityDeploy Include="DTO\DataAccessLayer.edmx">
|
||||||
|
<Generator>EntityModelCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>DataAccessLayer.Designer.cs</LastGenOutput>
|
||||||
|
</EntityDeploy>
|
||||||
|
<None Include="DTO\DataAccessLayer.edmx.diagram">
|
||||||
|
<DependentUpon>DataAccessLayer.edmx</DependentUpon>
|
||||||
|
</None>
|
||||||
<None Include="Model\Inventar.edmx.diagram">
|
<None Include="Model\Inventar.edmx.diagram">
|
||||||
<DependentUpon>Inventar.edmx</DependentUpon>
|
<DependentUpon>Inventar.edmx</DependentUpon>
|
||||||
</None>
|
</None>
|
||||||
@ -195,6 +284,16 @@
|
|||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Content Include="DTO\DataAccessLayer.Context.tt">
|
||||||
|
<Generator>TextTemplatingFileGenerator</Generator>
|
||||||
|
<DependentUpon>DataAccessLayer.edmx</DependentUpon>
|
||||||
|
<LastGenOutput>DataAccessLayer.Context.cs</LastGenOutput>
|
||||||
|
</Content>
|
||||||
|
<Content Include="DTO\DataAccessLayer.tt">
|
||||||
|
<Generator>TextTemplatingFileGenerator</Generator>
|
||||||
|
<DependentUpon>DataAccessLayer.edmx</DependentUpon>
|
||||||
|
<LastGenOutput>DataAccessLayer.cs</LastGenOutput>
|
||||||
|
</Content>
|
||||||
<Content Include="Model\Inventar.Context.tt">
|
<Content Include="Model\Inventar.Context.tt">
|
||||||
<Generator>TextTemplatingFileGenerator</Generator>
|
<Generator>TextTemplatingFileGenerator</Generator>
|
||||||
<LastGenOutput>Inventar.Context.cs</LastGenOutput>
|
<LastGenOutput>Inventar.Context.cs</LastGenOutput>
|
||||||
|
@ -22,7 +22,6 @@ namespace LoggingClient.Repository
|
|||||||
public override string PrimaryKeyFromTable => "customer_id";
|
public override string PrimaryKeyFromTable => "customer_id";
|
||||||
|
|
||||||
public List<Customer> Customers { get; set; }
|
public List<Customer> Customers { get; set; }
|
||||||
public Customer _Customers { get; set; }
|
|
||||||
|
|
||||||
public override void Add(Customer entity)
|
public override void Add(Customer entity)
|
||||||
{
|
{
|
||||||
|
61
LoggingClient/LoggingClient/Repository/CustomerRepositoryLinq.cs
Executable file
61
LoggingClient/LoggingClient/Repository/CustomerRepositoryLinq.cs
Executable file
@ -0,0 +1,61 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace LoggingClient.Repository
|
||||||
|
{
|
||||||
|
public class CustomerRepositoryLinq<Customer> : RepositoryBase<Customer>
|
||||||
|
{
|
||||||
|
public List<Customer> Customers { get; set; }
|
||||||
|
public CustomerRepositoryLinq(string connectionString) : base(connectionString)
|
||||||
|
{
|
||||||
|
Customers = new List<Customer>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string TableName => throw new NotImplementedException();
|
||||||
|
|
||||||
|
public override string ColumnsForSelect => throw new NotImplementedException();
|
||||||
|
|
||||||
|
public override string ColumnsForAdd => throw new NotImplementedException();
|
||||||
|
|
||||||
|
public override string PrimaryKeyFromTable => throw new NotImplementedException();
|
||||||
|
|
||||||
|
public override void Add(Customer entity)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void CallStoredProcedure(Customer entity)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Delete(Customer entity)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override List<Customer> GetAll(string whereCondition, Dictionary<string, object> parameterValues)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override List<Customer> GetAll()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Customer GetSingle<P>(P pkValue)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Update(Customer entity)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -169,7 +169,15 @@ namespace LoggingClient.ViewModel
|
|||||||
}
|
}
|
||||||
if (_LinqIsChecked)
|
if (_LinqIsChecked)
|
||||||
{
|
{
|
||||||
//TODO
|
try
|
||||||
|
{
|
||||||
|
var customerModelRepositoryLinq = new CustomerRepositoryLinq<Customer>(TxtConnectionString);
|
||||||
|
Customers = customerModelRepositoryLinq.GetAll();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Error occurred: " + ex.Message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!_EfIsChecked && !_LinqIsChecked)
|
if (!_EfIsChecked && !_LinqIsChecked)
|
||||||
{
|
{
|
||||||
@ -201,7 +209,16 @@ namespace LoggingClient.ViewModel
|
|||||||
}
|
}
|
||||||
if (_LinqIsChecked)
|
if (_LinqIsChecked)
|
||||||
{
|
{
|
||||||
// TODO
|
try
|
||||||
|
{
|
||||||
|
var customerModelRepositoryLinq = new CustomerRepositoryLinq<Customer>(TxtConnectionString);
|
||||||
|
customerModelRepositoryLinq.Add(NewCustomerEntry);
|
||||||
|
Customers = customerModelRepositoryLinq.GetAll();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Error occurred: " + ex.Message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!_EfIsChecked && !_LinqIsChecked)
|
if (!_EfIsChecked && !_LinqIsChecked)
|
||||||
{
|
{
|
||||||
@ -232,6 +249,19 @@ namespace LoggingClient.ViewModel
|
|||||||
MessageBox.Show("Error occurred: " + ex.Message);
|
MessageBox.Show("Error occurred: " + ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (_LinqIsChecked)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var customerModelRepositoryLinq = new CustomerRepositoryLinq<Customer>(TxtConnectionString);
|
||||||
|
customerModelRepositoryLinq.Delete(MySelectedItem);
|
||||||
|
Customers = customerModelRepositoryLinq.GetAll();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Error occurred: " + ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!_EfIsChecked && !_LinqIsChecked)
|
if (!_EfIsChecked && !_LinqIsChecked)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -248,6 +278,31 @@ namespace LoggingClient.ViewModel
|
|||||||
}
|
}
|
||||||
private void UpdateData()
|
private void UpdateData()
|
||||||
{
|
{
|
||||||
|
if (_EfIsChecked)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//DOTO
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Error occurred: " + ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (_LinqIsChecked)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//DOTO
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Error occurred: " + ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!_EfIsChecked && !_LinqIsChecked)
|
||||||
|
{
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var customerModelRepository = new CustomerRepository(TxtConnectionString);
|
var customerModelRepository = new CustomerRepository(TxtConnectionString);
|
||||||
@ -259,6 +314,7 @@ namespace LoggingClient.ViewModel
|
|||||||
MessageBox.Show("Error occurred: " + ex.Message);
|
MessageBox.Show("Error occurred: " + ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void OnPropertyChanged(string propertyName)
|
private void OnPropertyChanged(string propertyName)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user