Merge branch 'dev' for IoC
This commit is contained in:
commit
b17d79e5ac
@ -6,7 +6,7 @@ using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace WpfControlNugget
|
||||
namespace LoggingClient
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
|
31
LoggingClient/LoggingClient/Container/Builder.cs
Normal file
31
LoggingClient/LoggingClient/Container/Builder.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using Autofac;
|
||||
using LoggingClient.Model;
|
||||
using LoggingClient.Repository;
|
||||
using LoggingClient.ViewModel;
|
||||
|
||||
namespace LoggingClient.Container
|
||||
{
|
||||
public class Builder
|
||||
{
|
||||
public static IContainer BuildAutofacContainer()
|
||||
{
|
||||
var builder = new ContainerBuilder();
|
||||
|
||||
// ViewModel
|
||||
builder.RegisterType<CustomerViewModel>().As<CustomerViewModel>();
|
||||
builder.RegisterType<LogViewModel>().As<LogViewModel>();
|
||||
builder.RegisterType<LocationViewModel>().As<LocationViewModel>();
|
||||
builder.RegisterType<NavigationViewModel>().As<NavigationViewModel>();
|
||||
|
||||
|
||||
// Repositories
|
||||
builder.RegisterType<LoggingRepository>().As<IRepositoryBase<Logging>>();
|
||||
builder.RegisterType<LocationRepository>().As<IRepositoryBase<Location>>();
|
||||
builder.RegisterType<CustomerRepository>().As<IRepositoryBase<Customer>>();
|
||||
builder.RegisterType<CustomerRepositoryLinq>().As<IRepositoryBase<Customer>>();
|
||||
builder.RegisterType<CustomerRepositoryEF>().As<IRepositoryBase<Customer>>();
|
||||
|
||||
return builder.Build();
|
||||
}
|
||||
}
|
||||
}
|
@ -38,6 +38,9 @@
|
||||
<StartupObject />
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Autofac, Version=5.2.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.5.2.0\lib\net461\Autofac.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="BouncyCastle.Crypto, Version=1.8.3.0, Culture=neutral, PublicKeyToken=0e99375e54769942">
|
||||
<HintPath>..\packages\BouncyCastle.1.8.3.1\lib\BouncyCastle.Crypto.dll</HintPath>
|
||||
</Reference>
|
||||
@ -53,11 +56,15 @@
|
||||
<Reference Include="Google.Protobuf, Version=3.6.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Google.Protobuf.3.6.1\lib\net45\Google.Protobuf.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.1.1.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MySql.Data, Version=8.0.16.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MySql.Data.8.0.16\lib\net452\MySql.Data.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel" />
|
||||
<Reference Include="System.ComponentModel.Composition" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Configuration.Install" />
|
||||
@ -66,8 +73,14 @@
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Drawing.Design" />
|
||||
<Reference Include="System.Management" />
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.Security" />
|
||||
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.2\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Transactions" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
@ -87,10 +100,35 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="Container\Builder.cs" />
|
||||
<Compile Include="Model\abrechnung.cs">
|
||||
<DependentUpon>Inventar.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Model\address.cs">
|
||||
<DependentUpon>Inventar.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Model\contact.cs">
|
||||
<DependentUpon>Inventar.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Model\credentials.cs">
|
||||
<DependentUpon>Inventar.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Model\Customer.cs">
|
||||
<DependentUpon>Inventar.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Model\CustomerLinq.cs" />
|
||||
<Compile Include="Model\device.cs">
|
||||
<DependentUpon>Inventar.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Model\deviceport.cs">
|
||||
<DependentUpon>Inventar.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Model\devicetype.cs">
|
||||
<DependentUpon>Inventar.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Model\interface.cs">
|
||||
<DependentUpon>Inventar.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Model\Inventar.Context.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
@ -106,17 +144,54 @@
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Inventar.edmx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Model\kundenkonto.cs">
|
||||
<DependentUpon>Inventar.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Model\log.cs">
|
||||
<DependentUpon>Inventar.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Model\Model.cs" />
|
||||
<Compile Include="Model\Location.cs" />
|
||||
<Compile Include="Model\Location.cs">
|
||||
<DependentUpon>Inventar.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Model\network.cs">
|
||||
<DependentUpon>Inventar.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Model\Node.cs" />
|
||||
<Compile Include="Model\operatingsystem.cs">
|
||||
<DependentUpon>Inventar.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Model\person.cs">
|
||||
<DependentUpon>Inventar.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Model\pointofdelivery.cs">
|
||||
<DependentUpon>Inventar.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Model\produkte.cs">
|
||||
<DependentUpon>Inventar.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Model\produktegruppe.cs">
|
||||
<DependentUpon>Inventar.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Model\SeverityComboBoxItem.cs" />
|
||||
<Compile Include="Model\softwaredienstleistung.cs">
|
||||
<DependentUpon>Inventar.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Model\town.cs">
|
||||
<DependentUpon>Inventar.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Model\transportmedium.cs">
|
||||
<DependentUpon>Inventar.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Model\v_logentries.cs">
|
||||
<DependentUpon>Inventar.tt</DependentUpon>
|
||||
</Compile>
|
||||
<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" />
|
||||
<Compile Include="Repository\RepositoryBase.cs" />
|
||||
<Compile Include="Validators\CustomerNumberValidationRule.cs" />
|
||||
<Compile Include="Validators\EmailValidationRule.cs" />
|
||||
<Compile Include="Validators\IntRangeValidationRule.cs" />
|
||||
|
@ -1,5 +1,5 @@
|
||||
using System.Windows;
|
||||
using WpfControlNugget.ViewModel;
|
||||
using LoggingClient.ViewModel;
|
||||
|
||||
namespace LoggingClient
|
||||
{
|
||||
@ -11,7 +11,9 @@ namespace LoggingClient
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.DataContext = new NavigationViewModel();
|
||||
//Container = Builder.BuildAutofacContainer();
|
||||
//DataContext = Container.Resolve<NavigationViewModel>();
|
||||
DataContext = new NavigationViewModel();
|
||||
}
|
||||
}
|
||||
}
|
@ -9,8 +9,17 @@
|
||||
|
||||
namespace LoggingClient.Model
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class Customer
|
||||
{
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
|
||||
public Customer()
|
||||
{
|
||||
this.pointofdelivery = new HashSet<pointofdelivery>();
|
||||
}
|
||||
|
||||
public long customer_id { get; set; }
|
||||
public string firstname { get; set; }
|
||||
public string lastname { get; set; }
|
||||
@ -21,7 +30,9 @@ namespace LoggingClient.Model
|
||||
public string url { get; set; }
|
||||
public string password { get; set; }
|
||||
|
||||
public Customer() { }
|
||||
public virtual kundenkonto kundenkonto { get; set; }
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
|
||||
public virtual ICollection<pointofdelivery> pointofdelivery { get; set; }
|
||||
|
||||
public Customer(long Id, string FirstName, string LastName, string CustomerNumber, long Customer_fk, string PhoneNumber, string EMail, string URL, string Password)
|
||||
{
|
||||
@ -35,5 +46,6 @@ namespace LoggingClient.Model
|
||||
this.url = URL;
|
||||
this.password = Password;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ namespace LoggingClient.Model
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity;
|
||||
using System.Data.Entity.Core.Objects;
|
||||
using System.Data.Entity.Infrastructure;
|
||||
|
||||
public partial class inventarisierungsloesungEntities : DbContext
|
||||
@ -26,5 +27,26 @@ namespace LoggingClient.Model
|
||||
}
|
||||
|
||||
public virtual DbSet<Customer> Customer { get; set; }
|
||||
public virtual DbSet<abrechnung> abrechnung { get; set; }
|
||||
public virtual DbSet<address> address { get; set; }
|
||||
public virtual DbSet<contact> contact { get; set; }
|
||||
public virtual DbSet<credentials> credentials { get; set; }
|
||||
public virtual DbSet<device> device { get; set; }
|
||||
public virtual DbSet<deviceport> deviceport { get; set; }
|
||||
public virtual DbSet<devicetype> devicetype { get; set; }
|
||||
public virtual DbSet<@interface> @interface { get; set; }
|
||||
public virtual DbSet<kundenkonto> kundenkonto { get; set; }
|
||||
public virtual DbSet<Location> Location { get; set; }
|
||||
public virtual DbSet<log> log { get; set; }
|
||||
public virtual DbSet<network> network { get; set; }
|
||||
public virtual DbSet<operatingsystem> operatingsystem { get; set; }
|
||||
public virtual DbSet<person> person { get; set; }
|
||||
public virtual DbSet<pointofdelivery> pointofdelivery { get; set; }
|
||||
public virtual DbSet<produkte> produkte { get; set; }
|
||||
public virtual DbSet<produktegruppe> produktegruppe { get; set; }
|
||||
public virtual DbSet<softwaredienstleistung> softwaredienstleistung { get; set; }
|
||||
public virtual DbSet<town> town { get; set; }
|
||||
public virtual DbSet<transportmedium> transportmedium { get; set; }
|
||||
public virtual DbSet<v_logentries> v_logentries { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
// T4 code generation is enabled for model 'Z:\Workspace\zbw\pa\pa2.Testat\LoggingClient\LoggingClient\Model\Inventar.edmx'.
|
||||
// T4 code generation is enabled for model 'C:\Workspace\pa2.Testat\LoggingClient\LoggingClient\Model\Inventar.edmx'.
|
||||
// To enable legacy code generation, change the value of the 'Code Generation Strategy' designer
|
||||
// property to 'Legacy ObjectContext'. This property is available in the Properties Window when the model
|
||||
// is open in the designer.
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -5,7 +5,51 @@
|
||||
<!-- Diagram content (shape and connector positions) -->
|
||||
<edmx:Diagrams>
|
||||
<Diagram DiagramId="551c3bcd88d246f39b2988233805b98e" Name="Diagram1">
|
||||
<EntityTypeShape EntityType="inventarisierungsloesungModel.Customer" Width="1.5" PointX="0.75" PointY="0.75" IsExpanded="true" />
|
||||
<EntityTypeShape EntityType="inventarisierungsloesungModel.Customer" PointX="0.75" PointY="0.75" Width="1.5" IsExpanded="true" />
|
||||
<EntityTypeShape EntityType="inventarisierungsloesungModel.abrechnung" Width="1.5" PointX="10.125" PointY="6.25" />
|
||||
<EntityTypeShape EntityType="inventarisierungsloesungModel.address" Width="1.5" PointX="3.375" PointY="6.75" />
|
||||
<EntityTypeShape EntityType="inventarisierungsloesungModel.contact" Width="1.5" PointX="5.625" PointY="14.125" />
|
||||
<EntityTypeShape EntityType="inventarisierungsloesungModel.credentials" Width="1.5" PointX="10.125" PointY="22.25" />
|
||||
<EntityTypeShape EntityType="inventarisierungsloesungModel.device" Width="1.5" PointX="7.875" PointY="10.125" />
|
||||
<EntityTypeShape EntityType="inventarisierungsloesungModel.deviceport" Width="1.5" PointX="13.125" PointY="11" />
|
||||
<EntityTypeShape EntityType="inventarisierungsloesungModel.devicetype" Width="1.5" PointX="5.625" PointY="11" />
|
||||
<EntityTypeShape EntityType="inventarisierungsloesungModel.interface" Width="1.5" PointX="10.125" PointY="10.375" />
|
||||
<EntityTypeShape EntityType="inventarisierungsloesungModel.kundenkonto" Width="1.5" PointX="0.75" PointY="1.5" />
|
||||
<EntityTypeShape EntityType="inventarisierungsloesungModel.Location" Width="1.5" PointX="5.625" PointY="6.625" />
|
||||
<EntityTypeShape EntityType="inventarisierungsloesungModel.log" Width="1.5" PointX="10.125" PointY="24.875" />
|
||||
<EntityTypeShape EntityType="inventarisierungsloesungModel.network" Width="1.5" PointX="7.875" PointY="7" />
|
||||
<EntityTypeShape EntityType="inventarisierungsloesungModel.operatingsystem" Width="1.5" PointX="7.875" PointY="17" />
|
||||
<EntityTypeShape EntityType="inventarisierungsloesungModel.person" Width="1.5" PointX="3.375" PointY="14.25" />
|
||||
<EntityTypeShape EntityType="inventarisierungsloesungModel.pointofdelivery" Width="1.5" PointX="7.875" PointY="2.625" />
|
||||
<EntityTypeShape EntityType="inventarisierungsloesungModel.produkte" Width="1.5" PointX="14.625" PointY="5.5" />
|
||||
<EntityTypeShape EntityType="inventarisierungsloesungModel.produktegruppe" Width="1.5" PointX="12.375" PointY="5.375" />
|
||||
<EntityTypeShape EntityType="inventarisierungsloesungModel.softwaredienstleistung" Width="1.5" PointX="12.375" PointY="8.5" />
|
||||
<EntityTypeShape EntityType="inventarisierungsloesungModel.town" Width="1.5" PointX="3.375" PointY="11.25" />
|
||||
<EntityTypeShape EntityType="inventarisierungsloesungModel.transportmedium" Width="1.5" PointX="10.875" PointY="15.25" />
|
||||
<EntityTypeShape EntityType="inventarisierungsloesungModel.v_logentries" Width="1.5" PointX="10.625" PointY="0.75" />
|
||||
<AssociationConnector Association="inventarisierungsloesungModel.abrechnung_abrechnung_ibfk_1" />
|
||||
<AssociationConnector Association="inventarisierungsloesungModel.abrechnung_abrechnung_ibfk_2" />
|
||||
<AssociationConnector Association="inventarisierungsloesungModel.abrechnung_abrechnung_ibfk_3" />
|
||||
<AssociationConnector Association="inventarisierungsloesungModel.abrechnung_abrechnung_ibfk_4" />
|
||||
<AssociationConnector Association="inventarisierungsloesungModel.produktegruppe_produktegruppe_ibfk_1" />
|
||||
<AssociationConnector Association="inventarisierungsloesungModel.softwaredienstleistung_softwaredienstleistung_ibfk_1" />
|
||||
<AssociationConnector Association="inventarisierungsloesungModel.address_address_ibfk_1" />
|
||||
<AssociationConnector Association="inventarisierungsloesungModel.location_location_ibfk_1" />
|
||||
<AssociationConnector Association="inventarisierungsloesungModel.contact_contact_ibfk_1" />
|
||||
<AssociationConnector Association="inventarisierungsloesungModel.pointofdelivery_pointofdelivery_ibfk_2" />
|
||||
<AssociationConnector Association="inventarisierungsloesungModel.customer_customer_ibfk_1" />
|
||||
<AssociationConnector Association="inventarisierungsloesungModel.pointofdelivery_pointofdelivery_ibfk_1" />
|
||||
<AssociationConnector Association="inventarisierungsloesungModel.device_device_ibfk_1" />
|
||||
<AssociationConnector Association="inventarisierungsloesungModel.device_device_ibfk_2" />
|
||||
<AssociationConnector Association="inventarisierungsloesungModel.deviceport_deviceport_ibfk_1" />
|
||||
<AssociationConnector Association="inventarisierungsloesungModel.interface_interface_ibfk_2" />
|
||||
<AssociationConnector Association="inventarisierungsloesungModel.log_log_ibfk_1" />
|
||||
<AssociationConnector Association="inventarisierungsloesungModel.deviceport_deviceport_ibfk_2" />
|
||||
<AssociationConnector Association="inventarisierungsloesungModel.interface_interface_ibfk_1" />
|
||||
<AssociationConnector Association="inventarisierungsloesungModel.pointofdelivery_pointofdelivery_ibfk_3" />
|
||||
<AssociationConnector Association="inventarisierungsloesungModel.produkte_produkte_ibfk_1" />
|
||||
<AssociationConnector Association="inventarisierungsloesungModel.devices_has_credentials" />
|
||||
<AssociationConnector Association="inventarisierungsloesungModel.devicetype_has_operatingsystem" />
|
||||
</Diagram>
|
||||
</edmx:Diagrams>
|
||||
</edmx:Designer>
|
||||
|
@ -1,79 +1,52 @@
|
||||
using System;
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace LoggingClient.Model
|
||||
{
|
||||
public class Location : Model<Location>
|
||||
{
|
||||
public new int Id { get; set; }
|
||||
public int ParentId { get; set; }
|
||||
public int AddressId { get; set; }
|
||||
public string Designation { get; set; }
|
||||
public int BuildingNr { get; set; }
|
||||
public int RoomNr { get; set; }
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class Location
|
||||
{
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
|
||||
public Location()
|
||||
{
|
||||
|
||||
this.abrechnung = new HashSet<abrechnung>();
|
||||
this.device = new HashSet<device>();
|
||||
this.pointofdelivery = new HashSet<pointofdelivery>();
|
||||
}
|
||||
|
||||
public Location(int id, int parentId, int addressId, string designation, int buildingNr, int roomNr)
|
||||
{
|
||||
this.Id = id;
|
||||
this.ParentId = parentId;
|
||||
this.AddressId = addressId;
|
||||
this.Designation = designation;
|
||||
this.BuildingNr = buildingNr;
|
||||
this.RoomNr = roomNr;
|
||||
}
|
||||
public bool Equals(Location location)
|
||||
{
|
||||
if (Object.ReferenceEquals(null, location)) return false;
|
||||
if (Object.ReferenceEquals(this, location)) return true;
|
||||
|
||||
return String.Equals(Designation, location.Designation) && String.Equals(BuildingNr, location.BuildingNr) && String.Equals(RoomNr, location.RoomNr);
|
||||
}
|
||||
public override bool Equals(object value)
|
||||
{
|
||||
return Equals(value as Location);
|
||||
}
|
||||
public override int GetHashCode()
|
||||
{
|
||||
unchecked
|
||||
{
|
||||
// Choose large primes to avoid hashing collisions
|
||||
const int hashingBase = (int)2166136261;
|
||||
const int hashingMultiplier = 16777619;
|
||||
|
||||
int hash = hashingBase;
|
||||
hash = (hash * hashingMultiplier) ^ (!Object.ReferenceEquals(null, Designation) ? Designation.GetHashCode() : 0);
|
||||
hash = (hash * hashingMultiplier) ^ (!Object.ReferenceEquals(null, BuildingNr) ? BuildingNr.GetHashCode() : 0);
|
||||
hash = (hash * hashingMultiplier) ^ (!Object.ReferenceEquals(null, RoomNr) ? RoomNr.GetHashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
public static bool operator ==(Location locA, Location locB)
|
||||
{
|
||||
if (Object.ReferenceEquals(locA, locB))
|
||||
{
|
||||
return true;
|
||||
this.location_id = id;
|
||||
this.parentid = parentId;
|
||||
this.address_fk = addressId;
|
||||
this.designation = designation;
|
||||
this.building = buildingNr;
|
||||
this.room = roomNr;
|
||||
}
|
||||
|
||||
//Ensure that A isnt Null
|
||||
if (Object.ReferenceEquals(null, locA))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
public long location_id { get; set; }
|
||||
public Nullable<long> parentid { get; set; }
|
||||
public long address_fk { get; set; }
|
||||
public string designation { get; set; }
|
||||
public long building { get; set; }
|
||||
public long room { get; set; }
|
||||
|
||||
return (locA.Equals(locB));
|
||||
}
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
|
||||
public virtual ICollection<abrechnung> abrechnung { get; set; }
|
||||
public virtual address address { get; set; }
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
|
||||
public virtual ICollection<device> device { get; set; }
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
|
||||
public virtual ICollection<pointofdelivery> pointofdelivery { get; set; }
|
||||
|
||||
public static bool operator !=(Location locA, Location locB)
|
||||
{
|
||||
return !(locA == locB);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Designation;
|
||||
}
|
||||
}
|
||||
}
|
39
LoggingClient/LoggingClient/Model/abrechnung.cs
Normal file
39
LoggingClient/LoggingClient/Model/abrechnung.cs
Normal file
@ -0,0 +1,39 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace LoggingClient.Model
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class abrechnung
|
||||
{
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
|
||||
public abrechnung()
|
||||
{
|
||||
this.produktegruppe = new HashSet<produktegruppe>();
|
||||
this.softwaredienstleistung = new HashSet<softwaredienstleistung>();
|
||||
}
|
||||
|
||||
public long abrechnung_id { get; set; }
|
||||
public long kundenkonto_fk { get; set; }
|
||||
public long location_fk { get; set; }
|
||||
public long device_fk { get; set; }
|
||||
public long interface_fk { get; set; }
|
||||
|
||||
public virtual kundenkonto kundenkonto { get; set; }
|
||||
public virtual Location Location { get; set; }
|
||||
public virtual device device { get; set; }
|
||||
public virtual @interface @interface { get; set; }
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
|
||||
public virtual ICollection<produktegruppe> produktegruppe { get; set; }
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
|
||||
public virtual ICollection<softwaredienstleistung> softwaredienstleistung { get; set; }
|
||||
}
|
||||
}
|
35
LoggingClient/LoggingClient/Model/address.cs
Normal file
35
LoggingClient/LoggingClient/Model/address.cs
Normal file
@ -0,0 +1,35 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace LoggingClient.Model
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class address
|
||||
{
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
|
||||
public address()
|
||||
{
|
||||
this.Location = new HashSet<Location>();
|
||||
}
|
||||
|
||||
public long address_id { get; set; }
|
||||
public long town_fk { get; set; }
|
||||
public string streetname { get; set; }
|
||||
public string streetnumber { get; set; }
|
||||
public string country { get; set; }
|
||||
public string additive { get; set; }
|
||||
public Nullable<long> po_box { get; set; }
|
||||
|
||||
public virtual town town { get; set; }
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
|
||||
public virtual ICollection<Location> Location { get; set; }
|
||||
}
|
||||
}
|
31
LoggingClient/LoggingClient/Model/contact.cs
Normal file
31
LoggingClient/LoggingClient/Model/contact.cs
Normal file
@ -0,0 +1,31 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace LoggingClient.Model
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class contact
|
||||
{
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
|
||||
public contact()
|
||||
{
|
||||
this.pointofdelivery = new HashSet<pointofdelivery>();
|
||||
}
|
||||
|
||||
public long contact_id { get; set; }
|
||||
public long person_fk { get; set; }
|
||||
public string priority { get; set; }
|
||||
|
||||
public virtual person person { get; set; }
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
|
||||
public virtual ICollection<pointofdelivery> pointofdelivery { get; set; }
|
||||
}
|
||||
}
|
31
LoggingClient/LoggingClient/Model/credentials.cs
Normal file
31
LoggingClient/LoggingClient/Model/credentials.cs
Normal file
@ -0,0 +1,31 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace LoggingClient.Model
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class credentials
|
||||
{
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
|
||||
public credentials()
|
||||
{
|
||||
this.device = new HashSet<device>();
|
||||
}
|
||||
|
||||
public long credentials_id { get; set; }
|
||||
public string benutzername { get; set; }
|
||||
public string passwort { get; set; }
|
||||
public string snmp { get; set; }
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
|
||||
public virtual ICollection<device> device { get; set; }
|
||||
}
|
||||
}
|
49
LoggingClient/LoggingClient/Model/device.cs
Normal file
49
LoggingClient/LoggingClient/Model/device.cs
Normal file
@ -0,0 +1,49 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace LoggingClient.Model
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class device
|
||||
{
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
|
||||
public device()
|
||||
{
|
||||
this.abrechnung = new HashSet<abrechnung>();
|
||||
this.deviceport = new HashSet<deviceport>();
|
||||
this.@interface = new HashSet<@interface>();
|
||||
this.log = new HashSet<log>();
|
||||
this.credentials = new HashSet<credentials>();
|
||||
}
|
||||
|
||||
public long device_id { get; set; }
|
||||
public long location_fk { get; set; }
|
||||
public long devicetype_fk { get; set; }
|
||||
public System.DateTime inventorydate { get; set; }
|
||||
public System.DateTime deactivatedate { get; set; }
|
||||
public string hostname { get; set; }
|
||||
public string domain { get; set; }
|
||||
public string description { get; set; }
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
|
||||
public virtual ICollection<abrechnung> abrechnung { get; set; }
|
||||
public virtual Location Location { get; set; }
|
||||
public virtual devicetype devicetype { get; set; }
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
|
||||
public virtual ICollection<deviceport> deviceport { get; set; }
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
|
||||
public virtual ICollection<@interface> @interface { get; set; }
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
|
||||
public virtual ICollection<log> log { get; set; }
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
|
||||
public virtual ICollection<credentials> credentials { get; set; }
|
||||
}
|
||||
}
|
25
LoggingClient/LoggingClient/Model/deviceport.cs
Normal file
25
LoggingClient/LoggingClient/Model/deviceport.cs
Normal file
@ -0,0 +1,25 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace LoggingClient.Model
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class deviceport
|
||||
{
|
||||
public int deviceport_id { get; set; }
|
||||
public string description { get; set; }
|
||||
public long device_fk { get; set; }
|
||||
public long transportmedium_fk { get; set; }
|
||||
|
||||
public virtual device device { get; set; }
|
||||
public virtual transportmedium transportmedium { get; set; }
|
||||
}
|
||||
}
|
34
LoggingClient/LoggingClient/Model/devicetype.cs
Normal file
34
LoggingClient/LoggingClient/Model/devicetype.cs
Normal file
@ -0,0 +1,34 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace LoggingClient.Model
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class devicetype
|
||||
{
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
|
||||
public devicetype()
|
||||
{
|
||||
this.device = new HashSet<device>();
|
||||
this.operatingsystem = new HashSet<operatingsystem>();
|
||||
}
|
||||
|
||||
public long devicetype_id { get; set; }
|
||||
public string manufacturer { get; set; }
|
||||
public string model { get; set; }
|
||||
public string version { get; set; }
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
|
||||
public virtual ICollection<device> device { get; set; }
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
|
||||
public virtual ICollection<operatingsystem> operatingsystem { get; set; }
|
||||
}
|
||||
}
|
38
LoggingClient/LoggingClient/Model/interface.cs
Normal file
38
LoggingClient/LoggingClient/Model/interface.cs
Normal file
@ -0,0 +1,38 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace LoggingClient.Model
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class @interface
|
||||
{
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
|
||||
public @interface()
|
||||
{
|
||||
this.abrechnung = new HashSet<abrechnung>();
|
||||
}
|
||||
|
||||
public long interface_id { get; set; }
|
||||
public int network_fk { get; set; }
|
||||
public long device_fk { get; set; }
|
||||
public string ip_adress_v4 { get; set; }
|
||||
public string mac_adresse { get; set; }
|
||||
public short isfullduplex { get; set; }
|
||||
public Nullable<int> bandwith { get; set; }
|
||||
public Nullable<short> is_in_use { get; set; }
|
||||
public string description { get; set; }
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
|
||||
public virtual ICollection<abrechnung> abrechnung { get; set; }
|
||||
public virtual device device { get; set; }
|
||||
public virtual network network { get; set; }
|
||||
}
|
||||
}
|
31
LoggingClient/LoggingClient/Model/kundenkonto.cs
Normal file
31
LoggingClient/LoggingClient/Model/kundenkonto.cs
Normal file
@ -0,0 +1,31 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace LoggingClient.Model
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class kundenkonto
|
||||
{
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
|
||||
public kundenkonto()
|
||||
{
|
||||
this.abrechnung = new HashSet<abrechnung>();
|
||||
this.Customer = new HashSet<Customer>();
|
||||
}
|
||||
|
||||
public long kundenkonto_id { get; set; }
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
|
||||
public virtual ICollection<abrechnung> abrechnung { get; set; }
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
|
||||
public virtual ICollection<Customer> Customer { get; set; }
|
||||
}
|
||||
}
|
26
LoggingClient/LoggingClient/Model/log.cs
Normal file
26
LoggingClient/LoggingClient/Model/log.cs
Normal file
@ -0,0 +1,26 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace LoggingClient.Model
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class log
|
||||
{
|
||||
public long log_id { get; set; }
|
||||
public long device_fk { get; set; }
|
||||
public System.DateTime timestamp { get; set; }
|
||||
public string logmessage { get; set; }
|
||||
public string level { get; set; }
|
||||
public Nullable<short> is_acknowledged { get; set; }
|
||||
|
||||
public virtual device device { get; set; }
|
||||
}
|
||||
}
|
32
LoggingClient/LoggingClient/Model/network.cs
Normal file
32
LoggingClient/LoggingClient/Model/network.cs
Normal file
@ -0,0 +1,32 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace LoggingClient.Model
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class network
|
||||
{
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
|
||||
public network()
|
||||
{
|
||||
this.@interface = new HashSet<@interface>();
|
||||
}
|
||||
|
||||
public int network_id { get; set; }
|
||||
public string subnet { get; set; }
|
||||
public string mask { get; set; }
|
||||
public int vlan { get; set; }
|
||||
public string description { get; set; }
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
|
||||
public virtual ICollection<@interface> @interface { get; set; }
|
||||
}
|
||||
}
|
31
LoggingClient/LoggingClient/Model/operatingsystem.cs
Normal file
31
LoggingClient/LoggingClient/Model/operatingsystem.cs
Normal file
@ -0,0 +1,31 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace LoggingClient.Model
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class operatingsystem
|
||||
{
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
|
||||
public operatingsystem()
|
||||
{
|
||||
this.devicetype = new HashSet<devicetype>();
|
||||
}
|
||||
|
||||
public long operatingsystem_id { get; set; }
|
||||
public string operatingsystemname { get; set; }
|
||||
public string model { get; set; }
|
||||
public string version { get; set; }
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
|
||||
public virtual ICollection<devicetype> devicetype { get; set; }
|
||||
}
|
||||
}
|
30
LoggingClient/LoggingClient/Model/person.cs
Normal file
30
LoggingClient/LoggingClient/Model/person.cs
Normal file
@ -0,0 +1,30 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace LoggingClient.Model
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class person
|
||||
{
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
|
||||
public person()
|
||||
{
|
||||
this.contact = new HashSet<contact>();
|
||||
}
|
||||
|
||||
public long person_id { get; set; }
|
||||
public string firstname { get; set; }
|
||||
public string lastname { get; set; }
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
|
||||
public virtual ICollection<contact> contact { get; set; }
|
||||
}
|
||||
}
|
30
LoggingClient/LoggingClient/Model/pointofdelivery.cs
Normal file
30
LoggingClient/LoggingClient/Model/pointofdelivery.cs
Normal file
@ -0,0 +1,30 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace LoggingClient.Model
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class pointofdelivery
|
||||
{
|
||||
public long pod_id { get; set; }
|
||||
public long customer_id_fk { get; set; }
|
||||
public long contact_id_fk { get; set; }
|
||||
public long location_fk { get; set; }
|
||||
public string designation { get; set; }
|
||||
public System.TimeSpan timezone { get; set; }
|
||||
public short timezonepositiv { get; set; }
|
||||
public string ntpserverip { get; set; }
|
||||
|
||||
public virtual contact contact { get; set; }
|
||||
public virtual Customer Customer { get; set; }
|
||||
public virtual Location Location { get; set; }
|
||||
}
|
||||
}
|
24
LoggingClient/LoggingClient/Model/produkte.cs
Normal file
24
LoggingClient/LoggingClient/Model/produkte.cs
Normal file
@ -0,0 +1,24 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace LoggingClient.Model
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class produkte
|
||||
{
|
||||
public int artikelnummer_id { get; set; }
|
||||
public string artikelname { get; set; }
|
||||
public decimal preis { get; set; }
|
||||
public int produktegruppe_fk { get; set; }
|
||||
|
||||
public virtual produktegruppe produktegruppe { get; set; }
|
||||
}
|
||||
}
|
33
LoggingClient/LoggingClient/Model/produktegruppe.cs
Normal file
33
LoggingClient/LoggingClient/Model/produktegruppe.cs
Normal file
@ -0,0 +1,33 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace LoggingClient.Model
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class produktegruppe
|
||||
{
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
|
||||
public produktegruppe()
|
||||
{
|
||||
this.produkte = new HashSet<produkte>();
|
||||
}
|
||||
|
||||
public int produktegruppe_id { get; set; }
|
||||
public string hardware { get; set; }
|
||||
public string software { get; set; }
|
||||
public string sonstigeartikel { get; set; }
|
||||
public long abrechung_fk { get; set; }
|
||||
|
||||
public virtual abrechnung abrechnung { get; set; }
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
|
||||
public virtual ICollection<produkte> produkte { get; set; }
|
||||
}
|
||||
}
|
23
LoggingClient/LoggingClient/Model/softwaredienstleistung.cs
Normal file
23
LoggingClient/LoggingClient/Model/softwaredienstleistung.cs
Normal file
@ -0,0 +1,23 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace LoggingClient.Model
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class softwaredienstleistung
|
||||
{
|
||||
public int software_id { get; set; }
|
||||
public int stundenaufwand { get; set; }
|
||||
public long abrechung_fk { get; set; }
|
||||
|
||||
public virtual abrechnung abrechnung { get; set; }
|
||||
}
|
||||
}
|
30
LoggingClient/LoggingClient/Model/town.cs
Normal file
30
LoggingClient/LoggingClient/Model/town.cs
Normal file
@ -0,0 +1,30 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace LoggingClient.Model
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class town
|
||||
{
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
|
||||
public town()
|
||||
{
|
||||
this.address = new HashSet<address>();
|
||||
}
|
||||
|
||||
public long town_id { get; set; }
|
||||
public long zip { get; set; }
|
||||
public string town1 { get; set; }
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
|
||||
public virtual ICollection<address> address { get; set; }
|
||||
}
|
||||
}
|
29
LoggingClient/LoggingClient/Model/transportmedium.cs
Normal file
29
LoggingClient/LoggingClient/Model/transportmedium.cs
Normal file
@ -0,0 +1,29 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace LoggingClient.Model
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class transportmedium
|
||||
{
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
|
||||
public transportmedium()
|
||||
{
|
||||
this.deviceport = new HashSet<deviceport>();
|
||||
}
|
||||
|
||||
public long transportmedium_id { get; set; }
|
||||
public string description { get; set; }
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
|
||||
public virtual ICollection<deviceport> deviceport { get; set; }
|
||||
}
|
||||
}
|
25
LoggingClient/LoggingClient/Model/v_logentries.cs
Normal file
25
LoggingClient/LoggingClient/Model/v_logentries.cs
Normal file
@ -0,0 +1,25 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace LoggingClient.Model
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class v_logentries
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string pod { get; set; }
|
||||
public string location { get; set; }
|
||||
public string hostname { get; set; }
|
||||
public Nullable<int> severity { get; set; }
|
||||
public Nullable<System.DateTime> timestamp { get; set; }
|
||||
public string message { get; set; }
|
||||
}
|
||||
}
|
@ -6,44 +6,56 @@ using System.Windows;
|
||||
|
||||
namespace LoggingClient.Repository
|
||||
{
|
||||
public class CustomerRepository : RepositoryBase<Customer>
|
||||
public class CustomerRepository : IRepositoryBase<Customer>
|
||||
{
|
||||
public CustomerRepository(string connectionString) : base(connectionString)
|
||||
public CustomerRepository(string connectionString)
|
||||
{
|
||||
this.ConnectionString = connectionString;
|
||||
Customers = new List<Customer>();
|
||||
}
|
||||
protected string ConnectionString { get; }
|
||||
|
||||
public override string TableName => "customer";
|
||||
public string TableName => "customer";
|
||||
|
||||
public override string ColumnsForSelect => "customer_id, firstname, lastname, customernumber, kundenkonto_fk, tel, email, url, password";
|
||||
public string ColumnsForSelect => "customer_id, firstname, lastname, customernumber, kundenkonto_fk, tel, email, url, password";
|
||||
|
||||
public override string ColumnsForAdd => "firstname, lastname, customernumber, kundenkonto_fk, tel, email, url, password";
|
||||
public string ColumnsForAdd => "firstname, lastname, customernumber, kundenkonto_fk, tel, email, url, password";
|
||||
|
||||
public override string PrimaryKeyFromTable => "customer_id";
|
||||
public string PrimaryKeyFromTable => "customer_id";
|
||||
|
||||
public List<Customer> Customers { get; set; }
|
||||
|
||||
public override void Add(Customer entity)
|
||||
public void Add(Customer entity)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public override void CallStoredProcedure(Customer entity)
|
||||
public void CallStoredProcedure(Customer entity)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public override void Delete(Customer entity)
|
||||
public long Count(string whereCondition, Dictionary<string, object> parameterValues)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public long Count()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Delete(Customer entity)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public override List<Customer> GetAll(string whereCondition, Dictionary<string, object> parameterValues)
|
||||
public List<Customer> GetAll(string whereCondition, Dictionary<string, object> parameterValues)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public override List<Customer> GetAll()
|
||||
public List<Customer> GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -78,12 +90,12 @@ namespace LoggingClient.Repository
|
||||
return Customers;
|
||||
}
|
||||
|
||||
public override Customer GetSingle<P>(P pkValue)
|
||||
public Customer GetSingle<P>(P pkValue)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public override void Update(Customer entity)
|
||||
public void Update(Customer entity)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ using System.Linq;
|
||||
|
||||
namespace LoggingClient.Repository
|
||||
{
|
||||
public class CustomerRepositoryEF
|
||||
public class CustomerRepositoryEF : IRepositoryBase<Customer>
|
||||
{
|
||||
public CustomerRepositoryEF()
|
||||
{
|
||||
|
@ -3,23 +3,26 @@ using MySql.Data.MySqlClient;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
using System.Linq;
|
||||
|
||||
namespace LoggingClient.Repository
|
||||
{
|
||||
public class LocationRepository : RepositoryBase<Location>
|
||||
public class LocationRepository : IRepositoryBase<Location>
|
||||
{
|
||||
public override string TableName => "Location";
|
||||
public override string ColumnsForSelect => "location_id, parentId, address_fk, designation, building, room";
|
||||
public override string ColumnsForAdd => "parentId, address_fk, designation, building, room";
|
||||
public override string PrimaryKeyFromTable => "location_id";
|
||||
public string TableName => "Location";
|
||||
public string ColumnsForSelect => "location_id, parentId, address_fk, designation, building, room";
|
||||
public string ColumnsForAdd => "parentId, address_fk, designation, building, room";
|
||||
public string PrimaryKeyFromTable => "location_id";
|
||||
|
||||
public List<Location> Locations { get; set; }
|
||||
public Location _Locations { get; set; }
|
||||
public LocationRepository(string connectionString) : base(connectionString)
|
||||
protected string ConnectionString { get; }
|
||||
public LocationRepository(string connectionString)
|
||||
{
|
||||
this.ConnectionString = connectionString;
|
||||
Locations = new List<Location>();
|
||||
}
|
||||
public override void Add(Location location)
|
||||
public void Add(Location location)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -31,7 +34,7 @@ namespace LoggingClient.Repository
|
||||
cmd.CommandText =
|
||||
$"INSERT INTO {TableName} ({ColumnsForAdd}) " +
|
||||
$"VALUES " +
|
||||
$"(parentId = {location.ParentId}, address_fk = {location.AddressId} , designation = '{location.Designation}', building = {location.BuildingNr} , room = {location.RoomNr} )";
|
||||
$"(parentId = {location.parentid}, address_fk = {location.address_fk} , designation = '{location.designation}', building = {location.building} , room = {location.room} )";
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
@ -42,7 +45,7 @@ namespace LoggingClient.Repository
|
||||
}
|
||||
}
|
||||
|
||||
public override void Delete(Location location)
|
||||
public void Delete(Location location)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -51,7 +54,7 @@ namespace LoggingClient.Repository
|
||||
conn.Open();
|
||||
using (MySqlCommand cmd = conn.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = $"DELETE FROM {TableName} WHERE location_id = {location.Id}";
|
||||
cmd.CommandText = $"DELETE FROM {TableName} WHERE location_id = {location.location_id}";
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
@ -62,7 +65,7 @@ namespace LoggingClient.Repository
|
||||
}
|
||||
}
|
||||
|
||||
public override List<Location> GetAll(string whereCondition, Dictionary<string, object> parameterValues)
|
||||
public List<Location> GetAll(string whereCondition, Dictionary<string, object> parameterValues)
|
||||
{
|
||||
var whereCon = whereCondition;
|
||||
if (parameterValues.Count > 0 && whereCondition != null)
|
||||
@ -103,30 +106,13 @@ namespace LoggingClient.Repository
|
||||
return Locations;
|
||||
}
|
||||
|
||||
public override List<Location> GetAll()
|
||||
public List<Location> GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var conn = new MySqlConnection(ConnectionString))
|
||||
using (var context = new inventarisierungsloesungEntities())
|
||||
{
|
||||
conn.Open();
|
||||
using (MySqlCommand cmd = conn.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = $"SELECT {ColumnsForSelect} FROM {TableName}";
|
||||
var reader = cmd.ExecuteReader();
|
||||
while (reader.Read())
|
||||
{
|
||||
Locations.Add(new Location(
|
||||
|
||||
reader.GetInt32("location_id"),
|
||||
reader.GetInt32("parentId"),
|
||||
reader.GetInt32("address_fk"),
|
||||
reader.GetValue(reader.GetOrdinal("designation")) as string,
|
||||
reader.GetInt32("building"),
|
||||
reader.GetInt32("room")
|
||||
));
|
||||
}
|
||||
}
|
||||
return context.Location.ToList();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -136,12 +122,12 @@ namespace LoggingClient.Repository
|
||||
return Locations;
|
||||
}
|
||||
|
||||
public override void CallStoredProcedure(Location entity)
|
||||
public void CallStoredProcedure(Location entity)
|
||||
{
|
||||
throw new System.NotSupportedException();
|
||||
}
|
||||
|
||||
public override Location GetSingle<P>(P pkValue)
|
||||
public Location GetSingle<P>(P pkValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -174,7 +160,7 @@ namespace LoggingClient.Repository
|
||||
return _Locations;
|
||||
}
|
||||
|
||||
public override void Update(Location location)
|
||||
public void Update(Location location)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -184,7 +170,7 @@ namespace LoggingClient.Repository
|
||||
using (MySqlCommand cmd = conn.CreateCommand())
|
||||
{
|
||||
cmd.CommandText =
|
||||
$"UPDATE {TableName} SET address_fk = {location.Id} , designation = '{location.Designation}', building = {location.BuildingNr} , room = {location.RoomNr} WHERE location_id = {location.Id}";
|
||||
$"UPDATE {TableName} SET address_fk = {location.location_id} , designation = '{location.designation}', building = {location.building} , room = {location.room} WHERE location_id = {location.location_id}";
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
@ -194,5 +180,38 @@ namespace LoggingClient.Repository
|
||||
MessageBox.Show("Error occurred: " + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public long Count(string whereCondition, Dictionary<string, object> parameterValues)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public long Count()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public List<Location> GetLocationsWithCte()
|
||||
{
|
||||
var ctx = new inventarisierungsloesungEntities();
|
||||
var locationsList = new List<Location>();
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = ctx.Database.SqlQuery<Location>("inventarisierungsloesung.cte_locations");
|
||||
foreach (Location loc in result)
|
||||
{
|
||||
locationsList.Add(loc);
|
||||
}
|
||||
}
|
||||
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show("Error occurred: " + e.Message);
|
||||
}
|
||||
ctx.Dispose();
|
||||
return locationsList;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -12,22 +12,25 @@ using LoggingClient.Model;
|
||||
|
||||
namespace LoggingClient.Repository
|
||||
{
|
||||
class LoggingRepository : RepositoryBase<Logging>
|
||||
class LoggingRepository : IRepositoryBase<Logging>
|
||||
{
|
||||
public override string TableName => "v_logentries";
|
||||
public override string ColumnsForSelect => "id, pod, location, hostname, severity, timestamp, message";
|
||||
public override string ColumnsForAdd { get; }
|
||||
public override string PrimaryKeyFromTable => "id";
|
||||
public string TableName => "v_logentries";
|
||||
public string ColumnsForSelect => "id, pod, location, hostname, severity, timestamp, message";
|
||||
public string ColumnsForAdd { get; }
|
||||
public string PrimaryKeyFromTable => "id";
|
||||
|
||||
public List<Logging> Logs { get; set; }
|
||||
public Logging _Logs { get; set; }
|
||||
|
||||
public LoggingRepository(string connectionString) : base(connectionString)
|
||||
protected string ConnectionString { get; }
|
||||
|
||||
public LoggingRepository(string connectionString)
|
||||
{
|
||||
ConnectionString = connectionString;
|
||||
Logs = new List<Logging>();
|
||||
}
|
||||
|
||||
public override Logging GetSingle<P>(P pkValue)
|
||||
public Logging GetSingle<P>(P pkValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -60,7 +63,7 @@ namespace LoggingClient.Repository
|
||||
}
|
||||
return _Logs;
|
||||
}
|
||||
public override void Add(Logging newLogModelEntry)
|
||||
public void Add(Logging newLogModelEntry)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -86,15 +89,15 @@ namespace LoggingClient.Repository
|
||||
MessageBox.Show("Error occurred: " + ex.Message);
|
||||
}
|
||||
}
|
||||
public override void Delete(Logging entity)
|
||||
public void Delete(Logging entity)
|
||||
{
|
||||
throw new System.NotSupportedException();
|
||||
}
|
||||
public override void Update(Logging entity)
|
||||
public void Update(Logging entity)
|
||||
{
|
||||
throw new System.NotSupportedException();
|
||||
}
|
||||
public override List<Logging> GetAll(string whereCondition, Dictionary<string, object> parameterValues)
|
||||
public List<Logging> GetAll(string whereCondition, Dictionary<string, object> parameterValues)
|
||||
{
|
||||
var whereCon = whereCondition;
|
||||
if (parameterValues.Count > 0 && whereCondition != null)
|
||||
@ -135,7 +138,7 @@ namespace LoggingClient.Repository
|
||||
}
|
||||
return Logs;
|
||||
}
|
||||
public override List<Logging> GetAll()
|
||||
public List<Logging> GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -168,7 +171,7 @@ namespace LoggingClient.Repository
|
||||
}
|
||||
return Logs;
|
||||
}
|
||||
public override void CallStoredProcedure(Logging logModelEntry)
|
||||
public void CallStoredProcedure(Logging logModelEntry)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -189,5 +192,55 @@ namespace LoggingClient.Repository
|
||||
MessageBox.Show(ex.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public long Count(string whereCondition, Dictionary<string, object> parameterValues)
|
||||
{
|
||||
var whereCon = whereCondition;
|
||||
if (parameterValues.Count > 0 && whereCondition != null)
|
||||
{
|
||||
foreach (KeyValuePair<string, object> p in parameterValues)
|
||||
{
|
||||
whereCon = whereCon.Replace($"@{p.Key}", p.Value.ToString());
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
using (var conn = new MySqlConnection(this.ConnectionString))
|
||||
{
|
||||
using (var cmd = conn.CreateCommand())
|
||||
{
|
||||
conn.Open();
|
||||
cmd.CommandText = $"select count(*) from {this.TableName} where {whereCon}";
|
||||
return (long)cmd.ExecuteScalar();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Error occurred: " + ex.Message);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public long Count()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var conn = new MySqlConnection(this.ConnectionString))
|
||||
{
|
||||
using (var cmd = conn.CreateCommand())
|
||||
{
|
||||
conn.Open();
|
||||
cmd.CommandText = $"select count(*) from {this.TableName}";
|
||||
return (long)cmd.ExecuteScalar();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Error occurred: " + ex.Message);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,86 +0,0 @@
|
||||
using MySql.Data.MySqlClient;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
|
||||
namespace LoggingClient.Repository
|
||||
{
|
||||
public abstract class RepositoryBase<M> : IRepositoryBase<M>
|
||||
{
|
||||
protected RepositoryBase(string connectionString)
|
||||
{
|
||||
this.ConnectionString = connectionString;
|
||||
}
|
||||
protected string ConnectionString { get; }
|
||||
public abstract M GetSingle<P>(P pkValue);
|
||||
|
||||
public abstract void Add(M entity);
|
||||
|
||||
public abstract void Delete(M entity);
|
||||
|
||||
public abstract void Update(M entity);
|
||||
public abstract List<M> GetAll(string whereCondition, Dictionary<string, object> parameterValues);
|
||||
|
||||
public abstract List<M> GetAll();
|
||||
|
||||
public abstract void CallStoredProcedure(M entity);
|
||||
|
||||
public IQueryable<M> Query(string whereCondition, Dictionary<string, object> parameterValues)
|
||||
{
|
||||
throw new System.NotSupportedException();
|
||||
}
|
||||
public long Count(string whereCondition, Dictionary<string, object> parameterValues)
|
||||
{
|
||||
var whereCon = whereCondition;
|
||||
if (parameterValues.Count > 0 && whereCondition != null)
|
||||
{
|
||||
foreach (KeyValuePair<string, object> p in parameterValues)
|
||||
{
|
||||
whereCon = whereCon.Replace($"@{p.Key}", p.Value.ToString());
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
using (var conn = new MySqlConnection(this.ConnectionString))
|
||||
{
|
||||
using (var cmd = conn.CreateCommand())
|
||||
{
|
||||
conn.Open();
|
||||
cmd.CommandText = $"select count(*) from {this.TableName} where {whereCon}";
|
||||
return (long)cmd.ExecuteScalar();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Error occurred: " + ex.Message);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
public long Count()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var conn = new MySqlConnection(this.ConnectionString))
|
||||
{
|
||||
using (var cmd = conn.CreateCommand())
|
||||
{
|
||||
conn.Open();
|
||||
cmd.CommandText = $"select count(*) from {this.TableName}";
|
||||
return (long)cmd.ExecuteScalar();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Error occurred: " + ex.Message);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
public abstract string TableName { get; }
|
||||
public abstract string ColumnsForSelect { get; }
|
||||
public abstract string ColumnsForAdd { get; }
|
||||
public abstract string PrimaryKeyFromTable { get; }
|
||||
}
|
||||
}
|
@ -1,11 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace WpfControlNugget.ViewModel.Commands
|
||||
namespace LoggingClient.ViewModel.Commands
|
||||
{
|
||||
public class BaseCommand : ICommand
|
||||
{
|
||||
|
@ -20,7 +20,7 @@ namespace LoggingClient.ViewModel
|
||||
|
||||
private void BuildTree(Node<Location> locationNode, List<Location> descendants)
|
||||
{
|
||||
var children = descendants.Where(node => node.ParentId == locationNode.ValueObject.Id).ToArray();
|
||||
var children = descendants.Where(node => node.parentid == locationNode.ValueObject.location_id).ToArray();
|
||||
foreach (var child in children)
|
||||
{
|
||||
var branch = Map(child, locationNode);
|
||||
@ -35,7 +35,7 @@ namespace LoggingClient.ViewModel
|
||||
|
||||
private Node<Location> FindTreeRoot(List<Location> nodes)
|
||||
{
|
||||
var rootNodes = nodes.Where(node => node.ParentId == 0);
|
||||
var rootNodes = nodes.Where(node => node.parentid == 0);
|
||||
if (rootNodes.Count() != 1) return new Node<Location>();
|
||||
var rootNode = rootNodes.Single();
|
||||
nodes.Remove(rootNode);
|
||||
|
@ -109,7 +109,8 @@ namespace LoggingClient.ViewModel
|
||||
try
|
||||
{
|
||||
var locationModelRepository = new LocationRepository(TxtConnectionString);
|
||||
this.Locations = locationModelRepository.GetAll();
|
||||
//this.Locations = locationModelRepository.GetAll();
|
||||
this.Locations = locationModelRepository.GetLocationsWithCte();
|
||||
this.LocationTree = new List<Node<Location>>();
|
||||
GenerateLocationTreeFromList(Locations);
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("LocationTree"));
|
||||
@ -164,8 +165,6 @@ namespace LoggingClient.ViewModel
|
||||
{
|
||||
var locationModelRepository = new LocationRepository(TxtConnectionString);
|
||||
this.Locations = locationModelRepository.GetAll();
|
||||
this.LocationTree = new List<Node<Location>>();
|
||||
GenerateLocationTreeFromList(Locations);
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("LocationTree"));
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -178,7 +177,8 @@ namespace LoggingClient.ViewModel
|
||||
{
|
||||
var treeBuilder = new LocationTreeBuilder();
|
||||
var locationNode = treeBuilder.BuildTree(locationList);
|
||||
this.LocationTree.Add(locationNode);
|
||||
LocationTree = new List<Node<Location>>();
|
||||
LocationTree.Add(locationNode);
|
||||
}
|
||||
|
||||
private void OnPropertyChanged(string propertyName)
|
||||
|
@ -1,9 +1,11 @@
|
||||
using LoggingClient.ViewModel;
|
||||
using LoggingClient.Container;
|
||||
using LoggingClient.ViewModel.Commands;
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Input;
|
||||
using WpfControlNugget.ViewModel.Commands;
|
||||
using Autofac;
|
||||
using IContainer = Autofac.IContainer;
|
||||
|
||||
namespace WpfControlNugget.ViewModel
|
||||
namespace LoggingClient.ViewModel
|
||||
{
|
||||
class NavigationViewModel : INotifyPropertyChanged
|
||||
{
|
||||
@ -17,26 +19,27 @@ namespace WpfControlNugget.ViewModel
|
||||
get => _selectedViewModel;
|
||||
set { _selectedViewModel = value; OnPropertyChanged("SelectedViewModel"); }
|
||||
}
|
||||
|
||||
private IContainer container;
|
||||
public NavigationViewModel()
|
||||
{
|
||||
LogsCommand = new BaseCommand(OpenLogs);
|
||||
LocationsCommand = new BaseCommand(OpenLocations);
|
||||
CustomersCommand = new BaseCommand(OpenCustomers);
|
||||
container = Builder.BuildAutofacContainer();
|
||||
}
|
||||
|
||||
private void OpenLogs(object obj)
|
||||
{
|
||||
SelectedViewModel = new LogViewModel();
|
||||
SelectedViewModel = container.Resolve<LogViewModel>();
|
||||
}
|
||||
|
||||
private void OpenLocations(object obj)
|
||||
{
|
||||
SelectedViewModel = new LocationViewModel();
|
||||
SelectedViewModel = container.Resolve<LocationViewModel>();
|
||||
}
|
||||
private void OpenCustomers(object obj)
|
||||
{
|
||||
SelectedViewModel = new CustomerViewModel();
|
||||
SelectedViewModel = container.Resolve<CustomerViewModel>();
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
@ -18,18 +18,18 @@
|
||||
<Grid HorizontalAlignment="Left" Height="416" VerticalAlignment="Top" Width="773">
|
||||
<DataGrid Validation.ErrorTemplate="{x:Null}" CanUserAddRows="False" AutoGenerateColumns="False" HorizontalAlignment="Left" SelectedItem="{Binding MySelectedItem, Mode=TwoWay}" Margin="10,196,0,76" x:Name="DataGridLocations" Width="763" ItemsSource="{Binding Path=Locations}" CanUserResizeRows="False">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Binding="{Binding Path=Id}" Header="id" Width="1*" IsReadOnly="True" />
|
||||
<DataGridTextColumn Binding="{Binding Path=ParentId}" Header="ParentId" Width="1*" IsReadOnly="True" />
|
||||
<DataGridTextColumn Binding="{Binding Path=AddressId}" Header="AddressId" Width="1*" IsReadOnly="True" />
|
||||
<DataGridTextColumn Binding="{Binding Path=Designation}" Header="Designation" Width="1*" IsReadOnly="True" />
|
||||
<DataGridTextColumn Binding="{Binding Path=BuildingNr}" Header="BuildingNr" Width="1*" IsReadOnly="True" />
|
||||
<DataGridTextColumn Binding="{Binding Path=RoomNr}" Header="RoomNr" Width="1*" IsReadOnly="True" />
|
||||
<DataGridTextColumn Binding="{Binding Path=location_id}" Header="id" Width="1*" IsReadOnly="True" />
|
||||
<DataGridTextColumn Binding="{Binding Path=parentid}" Header="ParentId" Width="1*" IsReadOnly="True" />
|
||||
<DataGridTextColumn Binding="{Binding Path=address_fk}" Header="AddressId" Width="1*" IsReadOnly="True" />
|
||||
<DataGridTextColumn Binding="{Binding Path=designation}" Header="Designation" Width="1*" IsReadOnly="True" />
|
||||
<DataGridTextColumn Binding="{Binding Path=building}" Header="BuildingNr" Width="1*" IsReadOnly="True" />
|
||||
<DataGridTextColumn Binding="{Binding Path=room}" Header="RoomNr" Width="1*" IsReadOnly="True" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<TreeView Grid.Row="0" Margin="10,51,0,225" ItemsSource="{Binding LocationTree, UpdateSourceTrigger=PropertyChanged, NotifyOnSourceUpdated=true, Mode=TwoWay}">
|
||||
<TreeView.ItemTemplate>
|
||||
<HierarchicalDataTemplate ItemsSource="{Binding ChildNodesList, UpdateSourceTrigger=PropertyChanged, NotifyOnSourceUpdated=true, Mode=TwoWay}">
|
||||
<TreeViewItem Header="{Binding}"/>
|
||||
<TreeViewItem Header="{Binding Path=ValueObject.designation}"/>
|
||||
</HierarchicalDataTemplate>
|
||||
</TreeView.ItemTemplate>
|
||||
</TreeView>
|
||||
|
@ -1,7 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Autofac" version="5.2.0" targetFramework="net461" />
|
||||
<package id="BouncyCastle" version="1.8.3.1" targetFramework="net461" />
|
||||
<package id="EntityFramework" version="6.2.0" targetFramework="net461" />
|
||||
<package id="Google.Protobuf" version="3.6.1" targetFramework="net461" />
|
||||
<package id="Microsoft.Bcl.AsyncInterfaces" version="1.1.0" targetFramework="net461" />
|
||||
<package id="MySql.Data" version="8.0.16" targetFramework="net461" />
|
||||
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.2" targetFramework="net461" />
|
||||
<package id="System.Threading.Tasks.Extensions" version="4.5.2" targetFramework="net461" />
|
||||
</packages>
|
Loading…
Reference in New Issue
Block a user