Prepared ViewModel for Linq, Add CustomerRepositoryLinq
This commit is contained in:
parent
d8852c59e6
commit
b67302361b
@ -16,6 +16,7 @@
|
||||
</userSettings>
|
||||
<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="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>
|
||||
<entityFramework>
|
||||
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
|
||||
|
@ -86,6 +86,87 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</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">
|
||||
<DependentUpon>Inventar.tt</DependentUpon>
|
||||
</Compile>
|
||||
@ -110,6 +191,7 @@
|
||||
<Compile Include="Model\SeverityComboBoxItem.cs" />
|
||||
<Compile Include="Repository\CustomerRepository.cs" />
|
||||
<Compile Include="Repository\CustomerRepositoryEF.cs" />
|
||||
<Compile Include="Repository\CustomerRepositoryLinq.cs" />
|
||||
<Compile Include="Repository\IRepositoryBase.cs" />
|
||||
<Compile Include="Repository\LocationRepository.cs" />
|
||||
<Compile Include="Repository\LoggingRepository.cs" />
|
||||
@ -180,6 +262,13 @@
|
||||
<Generator>EntityModelCodeGenerator</Generator>
|
||||
<LastGenOutput>Inventar.Designer.cs</LastGenOutput>
|
||||
</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">
|
||||
<DependentUpon>Inventar.edmx</DependentUpon>
|
||||
</None>
|
||||
@ -195,6 +284,16 @@
|
||||
</None>
|
||||
</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">
|
||||
<Generator>TextTemplatingFileGenerator</Generator>
|
||||
<LastGenOutput>Inventar.Context.cs</LastGenOutput>
|
||||
|
@ -22,7 +22,6 @@ namespace LoggingClient.Repository
|
||||
public override string PrimaryKeyFromTable => "customer_id";
|
||||
|
||||
public List<Customer> Customers { get; set; }
|
||||
public Customer _Customers { get; set; }
|
||||
|
||||
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)
|
||||
{
|
||||
//TODO
|
||||
try
|
||||
{
|
||||
var customerModelRepositoryLinq = new CustomerRepositoryLinq<Customer>(TxtConnectionString);
|
||||
Customers = customerModelRepositoryLinq.GetAll();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Error occurred: " + ex.Message);
|
||||
}
|
||||
}
|
||||
if (!_EfIsChecked && !_LinqIsChecked)
|
||||
{
|
||||
@ -201,7 +209,16 @@ namespace LoggingClient.ViewModel
|
||||
}
|
||||
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)
|
||||
{
|
||||
@ -232,6 +249,19 @@ namespace LoggingClient.ViewModel
|
||||
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)
|
||||
{
|
||||
try
|
||||
@ -248,15 +278,41 @@ namespace LoggingClient.ViewModel
|
||||
}
|
||||
private void UpdateData()
|
||||
{
|
||||
try
|
||||
if (_EfIsChecked)
|
||||
{
|
||||
var customerModelRepository = new CustomerRepository(TxtConnectionString);
|
||||
customerModelRepository.Update(this.NewCustomerEntry);
|
||||
this.Customers = customerModelRepository.GetAll().ToList();
|
||||
try
|
||||
{
|
||||
//DOTO
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Error occurred: " + ex.Message);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
if (_LinqIsChecked)
|
||||
{
|
||||
MessageBox.Show("Error occurred: " + ex.Message);
|
||||
try
|
||||
{
|
||||
//DOTO
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Error occurred: " + ex.Message);
|
||||
}
|
||||
}
|
||||
if (!_EfIsChecked && !_LinqIsChecked)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
var customerModelRepository = new CustomerRepository(TxtConnectionString);
|
||||
customerModelRepository.Update(this.NewCustomerEntry);
|
||||
this.Customers = customerModelRepository.GetAll().ToList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Error occurred: " + ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user