Compare commits
1 Commits
UmbauaufIC
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7a733b92d2 |
12
.gitignore
vendored
12
.gitignore
vendored
@@ -1,11 +1,5 @@
|
||||
/.vs/*
|
||||
/KanSan/bin/Debug/*
|
||||
/KanSan/obj/Debug/*
|
||||
/KanSan/obj/*
|
||||
/KanSan.Base/bin/*
|
||||
/KanSan.Base/kansan.db
|
||||
/KanSan.Base/obj/*
|
||||
/KanSan/version.txt
|
||||
/KanSan.ViewModel/bin/*
|
||||
/KanSan.ViewModel/obj/*
|
||||
*/bin/*
|
||||
*/version.txt
|
||||
*/bin/*
|
||||
*/obj/*
|
||||
|
||||
23
ConsoleClient/ConsoleClient.csproj
Normal file
23
ConsoleClient/ConsoleClient.csproj
Normal file
@@ -0,0 +1,23 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Ninject" Version="3.3.4" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\KundenManagement.Contract\KundenManagement.Contract.csproj" />
|
||||
<ProjectReference Include="..\Mappings\Mappings.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="kunden.csv">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
29
ConsoleClient/Program.cs
Normal file
29
ConsoleClient/Program.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
|
||||
using KanSan.CrossCutting.DataClasses;
|
||||
using KanSan.DependencyInjection.Mappings;
|
||||
using KundenManagement.Contract;
|
||||
using Ninject;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ConsoleClient
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
StandardKernel kernel = new StandardKernel();
|
||||
new KernelInitializer().Initialize(kernel);
|
||||
|
||||
IKundeManager manager = kernel.Get<IKundeManager>();
|
||||
|
||||
List<Kunde> kunden = manager.GetAllKunden();
|
||||
|
||||
kunden.ForEach(a => Console.WriteLine(a.Vorname + " " + a.ID));
|
||||
|
||||
Console.WriteLine("Hello World!");
|
||||
|
||||
Console.ReadKey();
|
||||
}
|
||||
}
|
||||
}
|
||||
2
ConsoleClient/kunden.csv
Normal file
2
ConsoleClient/kunden.csv
Normal file
@@ -0,0 +1,2 @@
|
||||
1,Damian,Bodde
|
||||
2,Cynthia,Schreuder
|
||||
|
8
DataClasses/DataClasses.csproj
Normal file
8
DataClasses/DataClasses.csproj
Normal file
@@ -0,0 +1,8 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<AssemblyName>KanSan.CrossCutting.DataClasses</AssemblyName>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
18
DataClasses/Kunde.cs
Normal file
18
DataClasses/Kunde.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace KanSan.CrossCutting.DataClasses
|
||||
{
|
||||
public class Kunde
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public Guid GuidNr { get; set; }
|
||||
public string Vorname { get; set; }
|
||||
public string Nachname { get; set; }
|
||||
public string Strasse { get; set; }
|
||||
public string PLZ { get; set; }
|
||||
public string Ort { get; set; }
|
||||
//public List<Projekt> Baustellen { get; } = new List<Projekt>();
|
||||
}
|
||||
}
|
||||
11
DataStoring.CSV/DataStoring.CSV.csproj
Normal file
11
DataStoring.CSV/DataStoring.CSV.csproj
Normal file
@@ -0,0 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DataStoring.Contract\DataStoring.Contract.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
23
DataStoring.CSV/KundenRepository.cs
Normal file
23
DataStoring.CSV/KundenRepository.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using KanSan.CrossCutting.DataClasses;
|
||||
using KanSan.DataStoring.Contract;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace KanSan.DataStoring.CSV
|
||||
{
|
||||
public class KundenRepository : IKundenRepository
|
||||
{
|
||||
public List<Kunde> Query => File
|
||||
.ReadAllLines("kunden.csv")
|
||||
.Select(l => l.Split(','))
|
||||
.Select(p => new Kunde
|
||||
{
|
||||
ID = int.Parse(p[0]),
|
||||
Vorname = p[1],
|
||||
Nachname = p[2]
|
||||
})
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
11
DataStoring.Contract/DataStoring.Contract.csproj
Normal file
11
DataStoring.Contract/DataStoring.Contract.csproj
Normal file
@@ -0,0 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\KanSan.DataClasses\KanSan.DataClasses.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
12
DataStoring.Contract/IKundenRepository.cs
Normal file
12
DataStoring.Contract/IKundenRepository.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using KanSan.CrossCutting.DataClasses;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace KanSan.DataStoring.Contract
|
||||
{
|
||||
public interface IKundenRepository
|
||||
{
|
||||
List<Kunde> Query { get; }
|
||||
}
|
||||
}
|
||||
24
DataStoring.Contract/IRepository.cs
Normal file
24
DataStoring.Contract/IRepository.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Text;
|
||||
|
||||
namespace KanSan.DataStoring.Contract
|
||||
{
|
||||
public interface IRepository<TEntity> where TEntity : class
|
||||
{
|
||||
void Delete(TEntity entityToDelete);
|
||||
void Delete(int id);
|
||||
IEnumerable<TEntity> GetAll(string include);
|
||||
IEnumerable<TEntity> Get(
|
||||
Expression<Func<TEntity, bool>> filter = null,
|
||||
Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBy = null,
|
||||
string includeProperties = "");
|
||||
TEntity GetByID(object id);
|
||||
void Insert(TEntity entity);
|
||||
void Update(TEntity entity);
|
||||
IQueryable<TEntity> Include(params Expression<Func<TEntity, object>>[] includes);
|
||||
IQueryable<TEntity> Query { get; }
|
||||
}
|
||||
}
|
||||
17
DataStoring.EF/DataStoring.EF.csproj
Normal file
17
DataStoring.EF/DataStoring.EF.csproj
Normal file
@@ -0,0 +1,17 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.2" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="5.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DataStoring.Contract\DataStoring.Contract.csproj" />
|
||||
<ProjectReference Include="..\KanSan.DataClasses\KanSan.DataClasses.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
31
DataStoring.EF/KanSanContext.cs
Normal file
31
DataStoring.EF/KanSanContext.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using KanSan.CrossCutting.DataClasses;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace DataStoring.EF
|
||||
{
|
||||
public class KanSanContext : DbContext
|
||||
{
|
||||
public DbSet<Projekt> Projekte { get; set; }
|
||||
public DbSet<Kunde> Kunden { get; set; }
|
||||
public DbSet<Sewer> Kanaele { get; set; }
|
||||
public DbSet<SewerPoint> SewerPoints { get; set; }
|
||||
public DbSet<Schaeden> Schaeden { get; set; }
|
||||
public DbSet<Sanierungskonzept> Sanierungskonzept { get; set; }
|
||||
public DbSet<Taetigkeiten> Taetigkeiten { get; set; }
|
||||
public DbSet<LeistungsverzeichnisPosition> LeistungsverzeichnisPositionen { get; set; }
|
||||
public DbSet<BaustelleLeistungsverzeichnisReferenz> LeistungsverzeichnisBaustellen { get; set; }
|
||||
public DbSet<Fahrzeug> Fahrzeuge { get; set; }
|
||||
public DbSet<KurzlinerSan> KurzlinerSanierung { get; set; }
|
||||
public DbSet<HutprofilSan> HutprofilSanierung { get; set; }
|
||||
|
||||
public KanSanContext()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
optionsBuilder.UseNpgsql("Host = 192.168.122.1; Database = kanSan; Username = husky; Password = bodde05");
|
||||
}
|
||||
}
|
||||
}
|
||||
111
DataStoring.EF/Repository.cs
Normal file
111
DataStoring.EF/Repository.cs
Normal file
@@ -0,0 +1,111 @@
|
||||
using KanSan.DataStoring.Contract;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Text;
|
||||
|
||||
namespace DataStoring.EF
|
||||
{
|
||||
public class Repository<TEntity> : IRepository<TEntity> where TEntity : class
|
||||
{
|
||||
private readonly KanSanContext _db;
|
||||
private readonly DbSet<TEntity> dbSet;
|
||||
|
||||
public IQueryable<TEntity> Query => dbSet;
|
||||
|
||||
public Repository(KanSanContext db)
|
||||
{
|
||||
_db = db;
|
||||
this.dbSet = db.Set<TEntity>();
|
||||
}
|
||||
public virtual void Delete(TEntity entityToDelete)
|
||||
{
|
||||
if (_db.Entry(entityToDelete).State == EntityState.Detached)
|
||||
dbSet.Attach(entityToDelete);
|
||||
dbSet.Remove(entityToDelete);
|
||||
}
|
||||
|
||||
public void Delete(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var entity = _db.Set<TEntity>().Find(id);
|
||||
if(entity == null)
|
||||
{
|
||||
throw new Exception("Id not found");
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
throw new Exception("Cant delete id");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public IEnumerable<TEntity> GetAll(string include)
|
||||
{
|
||||
return dbSet.Include(include);
|
||||
}
|
||||
|
||||
public IEnumerable<TEntity> Get(Expression<Func<TEntity, bool>> filter = null, Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBy = null, string includeProperties = "")
|
||||
{
|
||||
IQueryable<TEntity> query = dbSet;
|
||||
|
||||
|
||||
if (filter != null)
|
||||
{
|
||||
query = query.Where(filter);
|
||||
}
|
||||
|
||||
if (includeProperties != null)
|
||||
{
|
||||
foreach (var includeProperty in includeProperties.Split
|
||||
(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
query = query.Include(includeProperty);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (orderBy != null)
|
||||
{
|
||||
return orderBy(query).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
return query.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public TEntity GetByID(object id)
|
||||
{
|
||||
return dbSet.Find(id);
|
||||
}
|
||||
|
||||
public virtual void Insert(TEntity entity)
|
||||
{
|
||||
_db.Set<TEntity>().Add(entity);
|
||||
_db.SaveChanges();
|
||||
|
||||
}
|
||||
|
||||
public IQueryable<TEntity> Include(params Expression<Func<TEntity, object>>[] includeExpressions)
|
||||
{
|
||||
IQueryable<TEntity> query = null;
|
||||
foreach (var include in includeExpressions)
|
||||
{
|
||||
query = dbSet.Include(include);
|
||||
}
|
||||
return query ?? dbSet;
|
||||
}
|
||||
|
||||
public void Update(TEntity entity)
|
||||
{
|
||||
_db.Entry(entity).State = EntityState.Modified;
|
||||
_db.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace KanSan.Base.Interfaces
|
||||
{
|
||||
public interface IDialogWindowService
|
||||
{
|
||||
void showWindow(object viewModel);
|
||||
}
|
||||
}
|
||||
@@ -25,4 +25,8 @@
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Models\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace KanSan.Base
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
optionsBuilder.UseNpgsql("Host = 192.168.122.1; Database = kanSan; Username = kansan; Password = kansan");
|
||||
optionsBuilder.UseNpgsql("Host = 192.168.122.1; Database = kanSan; Username = husky; Password = bodde05");
|
||||
//optionsBuilder.UseSqlite("Data Source=kansan.db");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace KanSan.Base
|
||||
{
|
||||
class WindowService
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,10 @@
|
||||
using KanSan.Base.Interfaces;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace KanSan.Base.Models
|
||||
|
||||
namespace KanSan.CrossCutting.DataClasses
|
||||
{
|
||||
public class Baustelle : IDatabaseEntry
|
||||
public class Baustelle
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public Guid GuidNr { get; set; }
|
||||
@@ -1,11 +1,10 @@
|
||||
using KanSan.Base.Interfaces;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace KanSan.Base.Models
|
||||
namespace KanSan.CrossCutting.DataClasses
|
||||
{
|
||||
public class BaustelleLeistungsverzeichnisReferenz : IDatabaseEntry
|
||||
public class BaustelleLeistungsverzeichnisReferenz
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public Guid GuidNr { get; set; }
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace KanSan.Base.Enums
|
||||
namespace KanSan.CrossCutting.DataClasses.Enums
|
||||
{
|
||||
public enum EMaterial
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace KanSan.Base.Enums
|
||||
namespace KanSan.CrossCutting.DataClasses.Enums
|
||||
{
|
||||
public enum EPunktType
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace KanSan.Base.Enums
|
||||
namespace KanSan.CrossCutting.DataClasses.Enums
|
||||
{
|
||||
public enum ESanierung
|
||||
{
|
||||
@@ -1,9 +1,8 @@
|
||||
using KanSan.Base.Interfaces;
|
||||
using System;
|
||||
using System;
|
||||
|
||||
namespace KanSan.Base.Models
|
||||
namespace KanSan.CrossCutting.DataClasses
|
||||
{
|
||||
public class Fahrzeug : IDatabaseEntry
|
||||
public class Fahrzeug
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public Guid GuidNr { get; set; }
|
||||
@@ -1,11 +1,10 @@
|
||||
using KanSan.Base.Interfaces;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace KanSan.Base.Models
|
||||
namespace KanSan.CrossCutting.DataClasses
|
||||
{
|
||||
public abstract class GueteschutzProtokoll : IDatabaseEntry
|
||||
public abstract class GueteschutzProtokoll
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public Guid GuidNr { get; set; }
|
||||
@@ -2,7 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace KanSan.Base.Models
|
||||
namespace KanSan.CrossCutting.DataClasses
|
||||
{
|
||||
public class HutprofilSan : PHarzSanierung
|
||||
{
|
||||
7
KanSan.DataClasses/KanSan.DataClasses.csproj
Normal file
7
KanSan.DataClasses/KanSan.DataClasses.csproj
Normal file
@@ -0,0 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,11 +1,10 @@
|
||||
using KanSan.Base.Interfaces;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace KanSan.Base.Models
|
||||
namespace KanSan.CrossCutting.DataClasses
|
||||
{
|
||||
public class Kunde : IDatabaseEntry
|
||||
public class Kunde
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public Guid GuidNr { get; set; }
|
||||
@@ -2,7 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace KanSan.Base.Models
|
||||
namespace KanSan.CrossCutting.DataClasses
|
||||
{
|
||||
public class KurzlinerSan : PHarzSanierung
|
||||
{
|
||||
@@ -1,9 +1,8 @@
|
||||
using KanSan.Base.Interfaces;
|
||||
using System;
|
||||
using System;
|
||||
|
||||
namespace KanSan.Base.Models
|
||||
namespace KanSan.CrossCutting.DataClasses
|
||||
{
|
||||
public class LeistungsverzeichnisPosition : IDatabaseEntry
|
||||
public class LeistungsverzeichnisPosition
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public Guid GuidNr { get; set; }
|
||||
@@ -2,7 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace KanSan.Base.Models
|
||||
namespace KanSan.CrossCutting.DataClasses
|
||||
{
|
||||
public class PHarzSanierung : GueteschutzProtokoll
|
||||
{
|
||||
@@ -1,11 +1,10 @@
|
||||
using KanSan.Base.Interfaces;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace KanSan.Base.Models
|
||||
namespace KanSan.CrossCutting.DataClasses
|
||||
{
|
||||
public class Projekt : IDatabaseEntry
|
||||
public class Projekt
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public Guid GuidNr { get; set; }
|
||||
@@ -1,11 +1,10 @@
|
||||
using KanSan.Base.Enums;
|
||||
using KanSan.Base.Interfaces;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using KanSan.CrossCutting.DataClasses.Enums;
|
||||
|
||||
namespace KanSan.Base.Models
|
||||
namespace KanSan.CrossCutting.DataClasses
|
||||
{
|
||||
public class Sanierungskonzept : IDatabaseEntry
|
||||
public class Sanierungskonzept
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public Guid GuidNr { get; set; }
|
||||
@@ -1,10 +1,9 @@
|
||||
using KanSan.Base.Enums;
|
||||
using KanSan.Base.Interfaces;
|
||||
using KanSan.CrossCutting.DataClasses.Enums;
|
||||
using System;
|
||||
|
||||
namespace KanSan.Base.Models
|
||||
namespace KanSan.CrossCutting.DataClasses
|
||||
{
|
||||
public class Schaeden : IDatabaseEntry
|
||||
public class Schaeden
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public Guid GuidNr { get; set; }
|
||||
@@ -1,11 +1,10 @@
|
||||
using KanSan.Base.Enums;
|
||||
using KanSan.Base.Interfaces;
|
||||
using KanSan.CrossCutting.DataClasses.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace KanSan.Base.Models
|
||||
namespace KanSan.CrossCutting.DataClasses
|
||||
{
|
||||
public class Sewer : IDatabaseEntry
|
||||
public class Sewer
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public Guid GuidNr { get; set; }
|
||||
@@ -1,9 +1,8 @@
|
||||
using KanSan.Base.Interfaces;
|
||||
using System;
|
||||
using System;
|
||||
|
||||
namespace KanSan.Base.Models
|
||||
namespace KanSan.CrossCutting.DataClasses
|
||||
{
|
||||
public class SewerPoint : IDatabaseEntry
|
||||
public class SewerPoint
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public Guid GuidNr { get; set; }
|
||||
@@ -1,9 +1,8 @@
|
||||
using KanSan.Base.Interfaces;
|
||||
using System;
|
||||
using System;
|
||||
|
||||
namespace KanSan.Base.Models
|
||||
namespace KanSan.CrossCutting.DataClasses
|
||||
{
|
||||
public class Taetigkeiten : IDatabaseEntry
|
||||
public class Taetigkeiten
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public Guid GuidNr { get; set; }
|
||||
@@ -9,7 +9,7 @@ using System.Text;
|
||||
|
||||
namespace KanSan.ViewModel
|
||||
{
|
||||
public class BaustelleEditViewModel : BaseViewModel, INotifyPropertyChanged, IBaustelleEditViewModel
|
||||
public class BaustelleEditViewModel : PropertyChangedClass, INotifyPropertyChanged, IBaustelleEditViewModel
|
||||
{
|
||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||
private Baustelle baustelle;
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Text;
|
||||
|
||||
namespace KanSan.ViewModel
|
||||
{
|
||||
public class BaustellenListViewModel :BaseViewModel, IBaustelleListViewModel
|
||||
public class BaustellenListViewModel : IBaustelleListViewModel
|
||||
{
|
||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||
private List<Baustelle> baustellen;
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.Mapping;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace KanSan.ViewModel.Commands
|
||||
{
|
||||
public class RelayCommand : ICommand
|
||||
{
|
||||
private Action<object> execute;
|
||||
private Func<object, bool> canExecute;
|
||||
|
||||
public event EventHandler CanExecuteChanged;
|
||||
|
||||
public RelayCommand(Action<object> execute, Func<object, bool> canExecute = null)
|
||||
{
|
||||
this.execute = execute;
|
||||
this.canExecute = canExecute;
|
||||
}
|
||||
|
||||
public bool CanExecute(object parameter)
|
||||
{
|
||||
return this.canExecute == null || this.canExecute(parameter);
|
||||
}
|
||||
|
||||
public void Execute(object parameter)
|
||||
{
|
||||
this.execute(parameter);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,15 @@
|
||||
using KanSan.Base;
|
||||
using KanSan.Base.Interfaces;
|
||||
using KanSan.Base.Models;
|
||||
using KanSan.ViewModel.Commands;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace KanSan.ViewModel
|
||||
{
|
||||
public class KundenEditViewModel : BaseViewModel, INotifyPropertyChanged
|
||||
public class KundenEditViewModel : PropertyChangedClass, INotifyPropertyChanged
|
||||
{
|
||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||
|
||||
@@ -23,9 +20,6 @@ namespace KanSan.ViewModel
|
||||
private string plz;
|
||||
private string ort;
|
||||
|
||||
public ICommand SaveClient { get; set; }
|
||||
public ICommand RemoveClient { get; set; }
|
||||
|
||||
#region getters
|
||||
public string Vorname
|
||||
{
|
||||
@@ -94,8 +88,11 @@ namespace KanSan.ViewModel
|
||||
}
|
||||
#endregion
|
||||
|
||||
public KundenEditViewModel(Kunde kunde)
|
||||
public KundenEditViewModel(Kunde kunde = null)
|
||||
{
|
||||
if (kunde == null)
|
||||
_kunde = unitOfWork.KundenRepository.Get().First();
|
||||
else
|
||||
_kunde = kunde;
|
||||
|
||||
vorname = _kunde.Vorname;
|
||||
@@ -103,21 +100,10 @@ namespace KanSan.ViewModel
|
||||
strasse = _kunde.Strasse;
|
||||
plz = _kunde.PLZ;
|
||||
ort = _kunde.Ort;
|
||||
|
||||
SaveClient = new RelayCommand(parameter => Speichern());
|
||||
RemoveClient = new RelayCommand(parameter => Remove());
|
||||
}
|
||||
|
||||
private void Remove()
|
||||
public void Speichern()
|
||||
{
|
||||
unitOfWork.KundenRepository.Delete(_kunde);
|
||||
unitOfWork.Commit();
|
||||
Mediator.Notify("GoToListClientScreen");
|
||||
}
|
||||
|
||||
private void Speichern()
|
||||
{
|
||||
Trace.WriteLine("Speichere");
|
||||
_kunde.Vorname = Vorname;
|
||||
_kunde.Nachname = Nachname;
|
||||
_kunde.Strasse = Strasse;
|
||||
@@ -126,7 +112,6 @@ namespace KanSan.ViewModel
|
||||
|
||||
unitOfWork.KundenRepository.Update(_kunde);
|
||||
unitOfWork.Commit();
|
||||
Mediator.Notify("GoToListClientScreen");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,33 +2,19 @@
|
||||
using KanSan.Base.Interfaces;
|
||||
using KanSan.Base.Interfaces.UI;
|
||||
using KanSan.Base.Models;
|
||||
using KanSan.ViewModel.Commands;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace KanSan.ViewModel
|
||||
{
|
||||
public class KundenListViewModel : BaseViewModel, IKundenListViewModel
|
||||
public class KundenListViewModel : IKundenListViewModel
|
||||
{
|
||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||
private List<Kunde> kunden;
|
||||
|
||||
private Kunde selectedKunde;
|
||||
public Kunde SelectedKunde {
|
||||
get { return selectedKunde; }
|
||||
set {
|
||||
selectedKunde = value;
|
||||
|
||||
}
|
||||
}
|
||||
public ICommand AddNewClientCommand { get; set; }
|
||||
public ICommand EditClientCommand { get; set; }
|
||||
public ICommand SelectClientCommand { get; set; }
|
||||
|
||||
public List<Kunde> Kunden
|
||||
{
|
||||
get
|
||||
@@ -40,41 +26,22 @@ namespace KanSan.ViewModel
|
||||
public KundenListViewModel()
|
||||
{
|
||||
kunden = unitOfWork.KundenRepository.Get().ToList();
|
||||
|
||||
AddNewClientCommand = new RelayCommand(parameter => NewClient());
|
||||
EditClientCommand = new RelayCommand(parameter => EditClient());
|
||||
SelectClientCommand = new RelayCommand(parameter => SelectClient());
|
||||
}
|
||||
|
||||
private void SelectClient()
|
||||
public Kunde NeueKunde()
|
||||
{
|
||||
if (selectedKunde == null) return;
|
||||
Mediator.Notify("ClientSelected", selectedKunde);
|
||||
}
|
||||
|
||||
private void NewClient()
|
||||
{
|
||||
Kunde newClient = NeueKunde();
|
||||
Mediator.Notify("GoToEditClientScreen", newClient);
|
||||
}
|
||||
|
||||
private void EditClient()
|
||||
{
|
||||
if (SelectedKunde == null) return;
|
||||
Mediator.Notify("GoToEditClientScreen",selectedKunde);
|
||||
|
||||
}
|
||||
|
||||
private Kunde NeueKunde()
|
||||
{
|
||||
Kunde result = new Kunde()
|
||||
{
|
||||
GuidNr = Guid.NewGuid()
|
||||
};
|
||||
|
||||
Kunde result = new Kunde();
|
||||
//result.ID = 1;
|
||||
result.GuidNr = Guid.NewGuid();
|
||||
unitOfWork.KundenRepository.Insert(result);
|
||||
unitOfWork.Commit();
|
||||
return result;
|
||||
|
||||
//IEnumerable<Kunde> kunden = unitOfWork.KundenRepository.Get(d => d.GuidNr.Equals(result.GuidNr));
|
||||
//if (kunden.Count() < 1)
|
||||
// throw new Exception("Kunde konnte nicht gefunden werden");
|
||||
|
||||
//return kunden.First();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace KanSan.ViewModel
|
||||
public string Tag { get => tag; set => tag = value; }
|
||||
public bool IsActiveInBaustelle { get => isActiveInBaustelle; set => isActiveInBaustelle = value; }
|
||||
}
|
||||
public class LeistungsverzeichnisBaustelleViewModel : BaseViewModel, INotifyPropertyChanged, ILeistungsverzeichnisBaustelleViewModel
|
||||
public class LeistungsverzeichnisBaustelleViewModel : PropertyChangedClass, INotifyPropertyChanged, ILeistungsverzeichnisBaustelleViewModel
|
||||
{
|
||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ using System.Text;
|
||||
|
||||
namespace KanSan.ViewModel
|
||||
{
|
||||
public class LeistungsverzeichnisPositionenListViewModel :BaseViewModel, INotifyPropertyChanged, ILeistungsverzeichnisPositionListViewModel
|
||||
public class LeistungsverzeichnisPositionenListViewModel :PropertyChangedClass, INotifyPropertyChanged, ILeistungsverzeichnisPositionListViewModel
|
||||
{
|
||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||
List<LeistungsverzeichnisPosition> lvPositionen;
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Text;
|
||||
|
||||
namespace KanSan.ViewModel
|
||||
{
|
||||
public class LeistungsverzeichnisPositionViewModel : BaseViewModel, INotifyPropertyChanged, ILeistungsverzeichnisPositionViewModel
|
||||
public class LeistungsverzeichnisPositionViewModel : PropertyChangedClass, INotifyPropertyChanged, ILeistungsverzeichnisPositionViewModel
|
||||
{
|
||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
using KanSan.Base;
|
||||
using KanSan.Base.Interfaces;
|
||||
using KanSan.Base.Models;
|
||||
using KanSan.ViewModel.Commands;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Win32;
|
||||
using Syncfusion.XlsIO;
|
||||
using System;
|
||||
@@ -12,19 +10,13 @@ using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace KanSan.ViewModel
|
||||
{
|
||||
public class MainWindowViewModel : BaseViewModel, INotifyPropertyChanged
|
||||
public class MainWindowViewModel : PropertyChangedClass, INotifyPropertyChanged
|
||||
{
|
||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||
|
||||
BaseViewModel actualViewModel;
|
||||
|
||||
|
||||
RegistryKey registry;
|
||||
const string REGISTRYKEY = "HKEY_CURRENT_USER\\Software\\Cosysda\\KanSan";
|
||||
|
||||
@@ -34,35 +26,8 @@ namespace KanSan.ViewModel
|
||||
private Sewer _selectedObjekt;
|
||||
|
||||
public static Baustelle Baustelle;
|
||||
//public static Sewer SelectedObjekt;
|
||||
public static List<LeistungsverzeichnisPosition> LVPositionen = null;
|
||||
|
||||
public static IServiceProvider ServiceProvider { get; private set; }
|
||||
|
||||
public ICommand ListClientsCommand { get; set; }
|
||||
public ICommand ListProjectsCommand { get; set; }
|
||||
public ICommand ListBaustellenCommand { get; set; }
|
||||
public ICommand ListObjectsCommand { get; set; }
|
||||
public ICommand ShowLeistungsverzeichnisCommand { get; set; }
|
||||
public ICommand SelectLeistungsverzeichnisBaustelleCommand { get; set; }
|
||||
|
||||
|
||||
public BaseViewModel ActualViewModel
|
||||
{
|
||||
get
|
||||
{
|
||||
return actualViewModel;
|
||||
//return actualViewModel;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (actualViewModel == value) return;
|
||||
Trace.WriteLine("AktualView Geändert zu " + value);
|
||||
actualViewModel = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public string ApplicationTitle
|
||||
{
|
||||
@@ -148,7 +113,6 @@ namespace KanSan.ViewModel
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Sewer SelectedObjekt
|
||||
{
|
||||
get
|
||||
@@ -165,7 +129,6 @@ namespace KanSan.ViewModel
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveInRegistry(string key, string value)
|
||||
{
|
||||
Registry.SetValue(REGISTRYKEY, key, value);
|
||||
@@ -221,112 +184,38 @@ namespace KanSan.ViewModel
|
||||
Registry.CurrentUser.CreateSubKey("Software\\Cosysda\\KanSan");
|
||||
LadeRegistry();
|
||||
}
|
||||
|
||||
public void init()
|
||||
{
|
||||
|
||||
}
|
||||
public MainWindowViewModel()
|
||||
{
|
||||
ServiceProvider = ConfigureServiceProvider();
|
||||
//InitDB();
|
||||
LadeRegistry();
|
||||
LoadBaustellenLeistungsverzeichnis();
|
||||
|
||||
|
||||
ListClients();
|
||||
|
||||
|
||||
ListClientsCommand = new RelayCommand(parmater => ListClients());
|
||||
ListProjectsCommand = new RelayCommand(parameter => ListProjekte());
|
||||
ListBaustellenCommand = new RelayCommand(paramter => ListBaustellen());
|
||||
ListObjectsCommand = new RelayCommand(parameter => ListObjekte());
|
||||
|
||||
Mediator.Subscribe("GoToListClientScreen", OnGoToListClientScreen);
|
||||
Mediator.Subscribe("GoToEditClientScreen", OnGoToEditClientScreen);
|
||||
Mediator.Subscribe("ClientSelected", OnSelectedClient);
|
||||
|
||||
Mediator.Subscribe("GoToListProjektScreen", OnGoToListProjektScreen);
|
||||
Mediator.Subscribe("GoToEditProjektScreen", OnGoToEditProjektScreen);
|
||||
Mediator.Subscribe("ProjektSelected", OnSelectedProjekt);
|
||||
|
||||
}
|
||||
|
||||
private void OnSelectedProjekt(object obj)
|
||||
{
|
||||
if (!(obj is Projekt)) return;
|
||||
SelectedProjekt = (obj as Projekt);
|
||||
ListBaustellen();
|
||||
}
|
||||
|
||||
private void OnGoToListProjektScreen(object obj)
|
||||
{
|
||||
ListProjekte();
|
||||
}
|
||||
|
||||
private void OnGoToEditProjektScreen(object obj)
|
||||
{
|
||||
if (!(obj is Projekt)) return;
|
||||
ActualViewModel = new ProjektEditViewModel((obj as Projekt));
|
||||
}
|
||||
|
||||
private void OnSelectedClient(object obj)
|
||||
{
|
||||
if (!(obj is Kunde)) return;
|
||||
SelectedKunde = (obj as Kunde);
|
||||
ListProjekte();
|
||||
}
|
||||
|
||||
private void OnGoToEditClientScreen(object obj)
|
||||
{
|
||||
if (!(obj is Kunde)) return;
|
||||
Kunde client = (obj as Kunde);
|
||||
EditClient(client);
|
||||
}
|
||||
|
||||
private void OnGoToListClientScreen(object obj)
|
||||
{
|
||||
ListClients();
|
||||
}
|
||||
|
||||
private IServiceProvider ConfigureServiceProvider()
|
||||
{
|
||||
IServiceCollection service = new ServiceCollection();
|
||||
|
||||
service.AddSingleton<MainWindowViewModel>();
|
||||
|
||||
return service.BuildServiceProvider();
|
||||
}
|
||||
|
||||
private void ListClients()
|
||||
{
|
||||
ActualViewModel = new KundenListViewModel();
|
||||
}
|
||||
private void EditClient(Kunde client)
|
||||
{
|
||||
ActualViewModel = new KundenEditViewModel(client);
|
||||
}
|
||||
|
||||
private void ListProjekte()
|
||||
{
|
||||
if (SelectedKunde == null)
|
||||
ActualViewModel = new KundenListViewModel();
|
||||
else
|
||||
ActualViewModel = new ProjektListViewModel(SelectedKunde);
|
||||
}
|
||||
|
||||
private void ListBaustellen()
|
||||
{
|
||||
ActualViewModel = new BaustellenListViewModel(SelectedProjekt);
|
||||
}
|
||||
|
||||
private void ListObjekte()
|
||||
{
|
||||
ActualViewModel = new ObjekteListViewModel(SelectedBaustelle);
|
||||
}
|
||||
|
||||
public void GenerateExcelFile()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void InitDB()
|
||||
{
|
||||
Projekt projekt = new Projekt();
|
||||
|
||||
Kunde kunde = new Kunde();
|
||||
kunde.Vorname = "Damian";
|
||||
kunde.Nachname = "Bodde";
|
||||
|
||||
kunde.GuidNr = Guid.NewGuid();
|
||||
projekt.Kunde = kunde;
|
||||
projekt.GuidNr = Guid.NewGuid();
|
||||
|
||||
Baustelle baustelle = new Baustelle();
|
||||
baustelle.Projekt = projekt;
|
||||
baustelle.GuidNr = Guid.NewGuid();
|
||||
|
||||
|
||||
|
||||
unitOfWork.ProjekteRepository.Insert(projekt);
|
||||
unitOfWork.Commit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace KanSan.ViewModel
|
||||
{
|
||||
class Mediator
|
||||
{
|
||||
private static IDictionary<string, List<Action<object>>> pl_dict = new Dictionary<string, List<Action<object>>>();
|
||||
public static void Subscribe(string token, Action<object> callback)
|
||||
{
|
||||
if(!pl_dict.ContainsKey(token))
|
||||
{
|
||||
var list = new List<Action<object>>();
|
||||
list.Add(callback);
|
||||
pl_dict.Add(token, list);
|
||||
}
|
||||
else
|
||||
{
|
||||
bool found = false;
|
||||
foreach(var item in pl_dict[token])
|
||||
{
|
||||
if (item.Method.ToString() == callback.Method.ToString())
|
||||
found = true;
|
||||
}
|
||||
if (!found)
|
||||
pl_dict[token].Add(callback);
|
||||
}
|
||||
}
|
||||
|
||||
public static void Unsubscribe(string token, Action<object> callback)
|
||||
{
|
||||
if (pl_dict.ContainsKey(token))
|
||||
pl_dict[token].Remove(callback);
|
||||
}
|
||||
public static void Notify(string token, object args = null)
|
||||
{
|
||||
if(pl_dict.ContainsKey(token))
|
||||
{
|
||||
foreach (var callback in pl_dict[token])
|
||||
callback(args);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,12 +5,11 @@ using KanSan.Base.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace KanSan.ViewModel
|
||||
{
|
||||
public class ObjekteEditViewModel : BaseViewModel,IObjekteEditViewModel, INotifyPropertyChanged
|
||||
public class ObjekteEditViewModel : PropertyChangedClass,IObjekteEditViewModel, INotifyPropertyChanged
|
||||
{
|
||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||
string strassename;
|
||||
@@ -171,8 +170,6 @@ namespace KanSan.ViewModel
|
||||
|
||||
public void Speichern()
|
||||
{
|
||||
objekt.PunktOben = getPoint(punktOben, true);
|
||||
objekt.PunktUnten = getPoint(punktUnten, true);
|
||||
objekt.StrasseName = strassename;
|
||||
objekt.DN = durchmesser;
|
||||
objekt.Haltungslaenge = haltungslaenge;
|
||||
@@ -186,28 +183,5 @@ namespace KanSan.ViewModel
|
||||
unitOfWork.Commit();
|
||||
}
|
||||
|
||||
private SewerPoint getPoint(string objektnummer, bool createIfNotFound = false)
|
||||
{
|
||||
List<SewerPoint> sewerPoints = unitOfWork.ObjekteRepository.Get(x => x.Objektnummer.Equals(objektnummer)).ToList();
|
||||
if (sewerPoints.Count < 1)
|
||||
{
|
||||
if (createIfNotFound == false)
|
||||
return null;
|
||||
else
|
||||
{
|
||||
Guid guidNr = Guid.NewGuid();
|
||||
unitOfWork.ObjekteRepository.Update(new SewerPoint()
|
||||
{
|
||||
Objektnummer = objektnummer,
|
||||
GuidNr = guidNr
|
||||
});
|
||||
unitOfWork.Commit();
|
||||
|
||||
return unitOfWork.ObjekteRepository.Get(x => x.GuidNr.Equals(guidNr)).ToList().First();
|
||||
}
|
||||
}
|
||||
return sewerPoints.First();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,14 +2,10 @@
|
||||
using KanSan.Base.Interfaces;
|
||||
using KanSan.Base.Interfaces.UI;
|
||||
using KanSan.Base.Models;
|
||||
using KanSan.ViewModel.Commands;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace KanSan.ViewModel
|
||||
{
|
||||
@@ -18,20 +14,8 @@ namespace KanSan.ViewModel
|
||||
public string Strassename { get; set; }
|
||||
public IEnumerable<Sewer> Objekte { get; set; }
|
||||
}
|
||||
public class ObjekteListViewModel : BaseViewModel
|
||||
public class ObjekteListViewModel
|
||||
{
|
||||
private ICommand _objektSelected;
|
||||
public ICommand ObjektSelected {
|
||||
get
|
||||
{
|
||||
return _objektSelected ?? (_objektSelected = new RelayCommand(x =>
|
||||
{
|
||||
Mediator.Notify("GoTo1Screen", "");
|
||||
}));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||
|
||||
List<ObjekteTransfer> kanalObjekte = new List<ObjekteTransfer>();
|
||||
@@ -53,26 +37,9 @@ namespace KanSan.ViewModel
|
||||
}).ToList();
|
||||
kanalObjekte = x;
|
||||
|
||||
//ObjektSelected = new RelayCommand(SelectObjekt);
|
||||
|
||||
//kanalObjekte = unitOfWork.KanaeleRepository.Get(x => x.Baustelle.Equals(selectedBaustelle)).ToList();
|
||||
}
|
||||
|
||||
private void SelectObjekt(object obj)
|
||||
{
|
||||
|
||||
//Debugger.Break();
|
||||
if (!(obj is Sewer)) return;
|
||||
Sewer sewer = (Sewer)obj;
|
||||
if (sewer == null) return;
|
||||
|
||||
//MainWindowViewModel.SelectedObjekt = sewer;
|
||||
/*SewerMainWindowViewModel t = new SewerMainWindowViewModel(sewer);
|
||||
Debugger.Break();
|
||||
//throw new NotImplementedException();
|
||||
*/
|
||||
}
|
||||
|
||||
public Sewer NeueObjektHinzufügen()
|
||||
{
|
||||
Guid guid = Guid.NewGuid();
|
||||
|
||||
@@ -2,20 +2,16 @@
|
||||
using KanSan.Base.Interfaces;
|
||||
using KanSan.Base.Interfaces.UI;
|
||||
using KanSan.Base.Models;
|
||||
using KanSan.ViewModel.Commands;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Text;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace KanSan.ViewModel
|
||||
{
|
||||
public class ProjektEditViewModel : BaseViewModel,INotifyPropertyChanged, IProjektEditViewModel
|
||||
public class ProjektEditViewModel : PropertyChangedClass,INotifyPropertyChanged, IProjektEditViewModel
|
||||
{
|
||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||
public ICommand SaveProjekt { get; set; }
|
||||
public ICommand RemoveProjekt { get; set; }
|
||||
private Projekt projekt;
|
||||
string projektnummer;
|
||||
string ort;
|
||||
@@ -45,7 +41,6 @@ namespace KanSan.ViewModel
|
||||
this.projekt = projekt;
|
||||
projektnummer = projekt.Projektnummer;
|
||||
ort = projekt.Ort;
|
||||
SaveProjekt = new RelayCommand(parameter => Speichern());
|
||||
}
|
||||
|
||||
public void Speichern()
|
||||
@@ -54,7 +49,6 @@ namespace KanSan.ViewModel
|
||||
projekt.Projektnummer = Projektnummer;
|
||||
unitOfWork.ProjekteRepository.Update(projekt);
|
||||
unitOfWork.Commit();
|
||||
Mediator.Notify("GoToListProjektScreen");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,17 +2,14 @@
|
||||
using KanSan.Base.Interfaces;
|
||||
using KanSan.Base.Interfaces.UI;
|
||||
using KanSan.Base.Models;
|
||||
using KanSan.ViewModel.Commands;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace KanSan.ViewModel
|
||||
{
|
||||
public class ProjektListViewModel : BaseViewModel, IProjektListViewModel
|
||||
public class ProjektListViewModel : IProjektListViewModel
|
||||
{
|
||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||
private List<Projekt> projektevonKunde;
|
||||
@@ -25,45 +22,26 @@ namespace KanSan.ViewModel
|
||||
}
|
||||
private Kunde selectedKunde;
|
||||
|
||||
public ICommand NewProjekt { get; set; }
|
||||
public ICommand EditProjekt { get; set; }
|
||||
public ICommand SelectProjekt { get; set; }
|
||||
public Projekt SelectedProjekt { get; set; }
|
||||
|
||||
public ProjektListViewModel(Kunde client)
|
||||
{
|
||||
|
||||
this.selectedKunde = client;
|
||||
|
||||
|
||||
projektevonKunde = unitOfWork.ProjekteRepository.Get(x => x.Kunde.Equals(client)).ToList();
|
||||
|
||||
SelectProjekt = new RelayCommand(parameter => SelectActualProjekt());
|
||||
EditProjekt = new RelayCommand(parameter => EditSelectedProjekt());
|
||||
NewProjekt = new RelayCommand(parameter => AddNewProjekt());
|
||||
}
|
||||
|
||||
private void SelectActualProjekt()
|
||||
public void SelectProjekt()
|
||||
{
|
||||
if (SelectedProjekt == null) return;
|
||||
Mediator.Notify("ProjektSelected", SelectedProjekt);
|
||||
}
|
||||
|
||||
private void AddNewProjekt()
|
||||
{
|
||||
Projekt newProj = NeueProjekt();
|
||||
Mediator.Notify("GoToEditProjektScreen", newProj);
|
||||
}
|
||||
|
||||
private void EditSelectedProjekt()
|
||||
{
|
||||
Mediator.Notify("GoToEditProjektScreen", SelectedProjekt);
|
||||
}
|
||||
|
||||
public Projekt NeueProjekt()
|
||||
{
|
||||
Guid guid = Guid.NewGuid();
|
||||
Projekt newProjekt = new Projekt()
|
||||
{
|
||||
GuidNr = Guid.NewGuid(),
|
||||
GuidNr = guid,
|
||||
Kunde = selectedKunde
|
||||
};
|
||||
|
||||
@@ -71,7 +49,9 @@ namespace KanSan.ViewModel
|
||||
//unitOfWork.ProjekteRepository.Insert(newProjekt);
|
||||
unitOfWork.Commit();
|
||||
|
||||
return newProjekt;
|
||||
List<Projekt> res = unitOfWork.ProjekteRepository.Get(x => x.GuidNr.Equals(guid)).ToList();
|
||||
if (res.Count < 1) throw new Exception("Der zuvor eingefügte Projekt konnte nicht in der Datenbank gefunden werden");
|
||||
return res.First();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ using System.Text;
|
||||
|
||||
namespace KanSan.ViewModel
|
||||
{
|
||||
public class ProjektViewModel : BaseViewModel,INotifyPropertyChanged
|
||||
public class ProjektViewModel : PropertyChangedClass,INotifyPropertyChanged
|
||||
{
|
||||
private Projekt _baustelle;
|
||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
|
||||
namespace KanSan.ViewModel
|
||||
{
|
||||
public class BaseViewModel
|
||||
public class PropertyChangedClass
|
||||
{
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
protected internal void OnPropertyChanged([CallerMemberName] string propertyname = null)
|
||||
{
|
||||
Trace.WriteLine("OnPropertyChanged ()" + propertyname);
|
||||
if (PropertyChanged != null)
|
||||
PropertyChanged(this, new PropertyChangedEventArgs(propertyname));
|
||||
}
|
||||
@@ -11,7 +11,7 @@ using System.Text;
|
||||
|
||||
namespace KanSan.ViewModel
|
||||
{
|
||||
public class SchaedenEditViewModel : BaseViewModel, INotifyPropertyChanged, ISchaedenEditViewModel
|
||||
public class SchaedenEditViewModel : PropertyChangedClass, INotifyPropertyChanged, ISchaedenEditViewModel
|
||||
{
|
||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||
decimal entfernung;
|
||||
|
||||
@@ -12,7 +12,7 @@ using System.Text;
|
||||
|
||||
namespace KanSan.ViewModel
|
||||
{
|
||||
public class SchaedenListViewModel : BaseViewModel, ISchaedenListViewModel
|
||||
public class SchaedenListViewModel : ISchaedenListViewModel
|
||||
{
|
||||
private Sewer actualSelectedSewer;
|
||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||
|
||||
@@ -1,36 +1,18 @@
|
||||
using KanSan.Base.Models;
|
||||
using KanSan.ViewModel.Commands;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace KanSan.ViewModel
|
||||
{
|
||||
public class SewerMainWindowViewModel : BaseViewModel,INotifyPropertyChanged
|
||||
public class SewerMainMenuViewModel : PropertyChangedClass,INotifyPropertyChanged
|
||||
{
|
||||
private Sewer model;
|
||||
private SchaedenViewModel schadenViewModel;
|
||||
private Schaeden schaden;
|
||||
private BaseViewModel aktualView;
|
||||
|
||||
public BaseViewModel AktualView
|
||||
{
|
||||
get
|
||||
{
|
||||
return aktualView;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (aktualView == value) return;
|
||||
aktualView = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public Sewer Objekt
|
||||
{
|
||||
@@ -74,30 +56,12 @@ namespace KanSan.ViewModel
|
||||
}
|
||||
|
||||
|
||||
public ICommand StammdatenSelect { get; private set; }
|
||||
public ICommand SchädenübersichtSelect { get; private set; }
|
||||
|
||||
public SewerMainWindowViewModel(Sewer model)
|
||||
|
||||
public SewerMainMenuViewModel(Sewer model)
|
||||
{
|
||||
if (model == null) throw new ArgumentNullException();
|
||||
this.model = model;
|
||||
|
||||
StammdatenSelect = new RelayCommand(parameter => SelectStammdaten());
|
||||
SchädenübersichtSelect = new RelayCommand(parameter => SelectSchädenübersicht());
|
||||
|
||||
var x = MainWindowViewModel.ServiceProvider.GetService<MainWindowViewModel>();
|
||||
x.ActualViewModel = new ObjekteEditViewModel(model);
|
||||
|
||||
}
|
||||
|
||||
private void SelectSchädenübersicht()
|
||||
{
|
||||
AktualView = new SchaedenListViewModel(model);
|
||||
}
|
||||
|
||||
private void SelectStammdaten()
|
||||
{
|
||||
AktualView = new ObjekteEditViewModel(model);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ using System.Text;
|
||||
|
||||
namespace KanSan.ViewModel
|
||||
{
|
||||
public class TaetigkeitEditViewModel : BaseViewModel, INotifyPropertyChanged, ITaetigkeitEditViewModel
|
||||
public class TaetigkeitEditViewModel : PropertyChangedClass, INotifyPropertyChanged, ITaetigkeitEditViewModel
|
||||
{
|
||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||
Fahrzeug fahrzeug;
|
||||
|
||||
61
KanSan.sln
61
KanSan.sln
@@ -7,7 +7,27 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "KanSan", "KanSan\KanSan.csp
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "KanSan.Base", "KanSan.Base\KanSan.Base.csproj", "{2184A91C-8DFD-45DD-B83F-5D036BADEA52}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KanSan.ViewModel", "KanSan.ViewModel\KanSan.ViewModel.csproj", "{77F25493-7A1C-4F03-92CF-D0EA00328181}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "KanSan.ViewModel", "KanSan.ViewModel\KanSan.ViewModel.csproj", "{77F25493-7A1C-4F03-92CF-D0EA00328181}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KanSan.DataClasses", "KanSan.DataClasses\KanSan.DataClasses.csproj", "{6C30FBF5-D894-4055-A899-4702EDBEE224}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataStoring.Contract", "DataStoring.Contract\DataStoring.Contract.csproj", "{212025C0-50A2-4D6B-9B4E-E226CAA4E551}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataStoring.CSV", "DataStoring.CSV\DataStoring.CSV.csproj", "{5CF0EC47-9C81-40A5-8EBA-F1DA3C8BC41E}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleClient", "ConsoleClient\ConsoleClient.csproj", "{2C721355-C42E-4DBB-A3B0-31C9CE68448C}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mappings", "Mappings\Mappings.csproj", "{2FB8401E-78BE-46A5-BE51-6A67029BC43F}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KundenManagement.Contract", "KundenManagement.Contract\KundenManagement.Contract.csproj", "{CE02508A-F590-4577-A88E-AA4ED6558C4F}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KundenManagement", "KundenManagment\KundenManagement.csproj", "{CFB14A1D-14D9-42D0-B9AD-27E8CAEA761B}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Domain", "Domain", "{2ED2E266-89C3-46C9-9B4E-BB52BBD4F305}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Data", "Data", "{890D5DD6-3258-4A65-ABF3-AFDFBE115BDC}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataStoring.EF", "DataStoring.EF\DataStoring.EF.csproj", "{177643C2-502C-4613-A00C-50429922D67D}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@@ -27,10 +47,49 @@ Global
|
||||
{77F25493-7A1C-4F03-92CF-D0EA00328181}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{77F25493-7A1C-4F03-92CF-D0EA00328181}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{77F25493-7A1C-4F03-92CF-D0EA00328181}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{6C30FBF5-D894-4055-A899-4702EDBEE224}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{6C30FBF5-D894-4055-A899-4702EDBEE224}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{6C30FBF5-D894-4055-A899-4702EDBEE224}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{6C30FBF5-D894-4055-A899-4702EDBEE224}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{212025C0-50A2-4D6B-9B4E-E226CAA4E551}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{212025C0-50A2-4D6B-9B4E-E226CAA4E551}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{212025C0-50A2-4D6B-9B4E-E226CAA4E551}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{212025C0-50A2-4D6B-9B4E-E226CAA4E551}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{5CF0EC47-9C81-40A5-8EBA-F1DA3C8BC41E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{5CF0EC47-9C81-40A5-8EBA-F1DA3C8BC41E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5CF0EC47-9C81-40A5-8EBA-F1DA3C8BC41E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5CF0EC47-9C81-40A5-8EBA-F1DA3C8BC41E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{2C721355-C42E-4DBB-A3B0-31C9CE68448C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2C721355-C42E-4DBB-A3B0-31C9CE68448C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2C721355-C42E-4DBB-A3B0-31C9CE68448C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2C721355-C42E-4DBB-A3B0-31C9CE68448C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{2FB8401E-78BE-46A5-BE51-6A67029BC43F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2FB8401E-78BE-46A5-BE51-6A67029BC43F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2FB8401E-78BE-46A5-BE51-6A67029BC43F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2FB8401E-78BE-46A5-BE51-6A67029BC43F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{CE02508A-F590-4577-A88E-AA4ED6558C4F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{CE02508A-F590-4577-A88E-AA4ED6558C4F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CE02508A-F590-4577-A88E-AA4ED6558C4F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CE02508A-F590-4577-A88E-AA4ED6558C4F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{CFB14A1D-14D9-42D0-B9AD-27E8CAEA761B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{CFB14A1D-14D9-42D0-B9AD-27E8CAEA761B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CFB14A1D-14D9-42D0-B9AD-27E8CAEA761B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CFB14A1D-14D9-42D0-B9AD-27E8CAEA761B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{177643C2-502C-4613-A00C-50429922D67D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{177643C2-502C-4613-A00C-50429922D67D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{177643C2-502C-4613-A00C-50429922D67D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{177643C2-502C-4613-A00C-50429922D67D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{212025C0-50A2-4D6B-9B4E-E226CAA4E551} = {890D5DD6-3258-4A65-ABF3-AFDFBE115BDC}
|
||||
{5CF0EC47-9C81-40A5-8EBA-F1DA3C8BC41E} = {890D5DD6-3258-4A65-ABF3-AFDFBE115BDC}
|
||||
{CE02508A-F590-4577-A88E-AA4ED6558C4F} = {2ED2E266-89C3-46C9-9B4E-BB52BBD4F305}
|
||||
{CFB14A1D-14D9-42D0-B9AD-27E8CAEA761B} = {2ED2E266-89C3-46C9-9B4E-BB52BBD4F305}
|
||||
{177643C2-502C-4613-A00C-50429922D67D} = {890D5DD6-3258-4A65-ABF3-AFDFBE115BDC}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {BA021C9A-6B88-4B87-8189-93AC075F3D8F}
|
||||
EndGlobalSection
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
|
||||
xmlns:local="clr-namespace:KanSan"
|
||||
>
|
||||
StartupUri="MainWindow.xaml">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using KanSan.ViewModel;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
@@ -20,11 +18,8 @@ namespace KanSan
|
||||
{
|
||||
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("MjM0MjUzQDMxMzgyZTMxMmUzMG8wTDNQcm5mN3UxaU9MbjdkVUlQbDgzWHcvUXZCOHdaVVY3c2I5S3BvN0U9");
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static IServiceProvider ServiceProvider { get; private set; }
|
||||
|
||||
protected override void OnStartup(StartupEventArgs e)
|
||||
{
|
||||
FrameworkElement.StyleProperty.OverrideMetadata(typeof(Window), new FrameworkPropertyMetadata
|
||||
@@ -36,23 +31,6 @@ namespace KanSan
|
||||
{
|
||||
DefaultValue = FindResource(typeof(UserControl))
|
||||
});
|
||||
|
||||
ServiceProvider = CreateServiceProvider();
|
||||
|
||||
Window window = ServiceProvider.GetRequiredService<MainWindow>();
|
||||
window.Show();
|
||||
base.OnStartup(e);
|
||||
}
|
||||
|
||||
private IServiceProvider CreateServiceProvider()
|
||||
{
|
||||
IServiceCollection services = new ServiceCollection();
|
||||
services.AddSingleton<SewerMainWindowViewModel>();
|
||||
|
||||
services.AddScoped<MainWindowViewModel>();
|
||||
services.AddScoped<MainWindow>(s => new MainWindow(s.GetRequiredService<MainWindowViewModel>()));
|
||||
|
||||
return services.BuildServiceProvider();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
using KanSan.Base.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace KanSan
|
||||
{
|
||||
class DialogWindowService: IDialogWindowService
|
||||
{
|
||||
public void showWindow(object viewModel)
|
||||
{
|
||||
Window win = new Window();
|
||||
win.Content = viewModel;
|
||||
win.Show();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -61,15 +61,9 @@
|
||||
<Compile Update="UI\Güteschutz\UCGüteschutzBerichtEdit.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="UI\SewerMainWindow.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="UI\UCHarzSanierung.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="UI\SanMaßnahmen\UCSanierungOverview.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="UI\UCSewerMainWindow.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
@@ -144,15 +138,9 @@
|
||||
<Page Update="UI\Güteschutz\UCGüteschutzBerichtEdit.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="UI\SewerMainWindow.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="UI\UCHarzSanierung.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="UI\SanMaßnahmen\UCSanierungOverview.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="UI\UCSewerMainWindow.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
|
||||
xmlns:local="clr-namespace:KanSan"
|
||||
xmlns:syncfusion="clr-namespace:Syncfusion.Windows.Shared;assembly=Syncfusion.Shared.WPF" x:Class="KanSan.MainWindow"
|
||||
TitleTextAlignment="Center" TitleBarBackground="BlueViolet"
|
||||
@@ -18,7 +17,6 @@
|
||||
<ResourceDictionary Source="./my_controls.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
|
||||
</Window.Resources>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
@@ -38,10 +36,10 @@
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel Grid.Row="0" Grid.ColumnSpan="2">
|
||||
<RadioButton Name="rbKunden" Content="Kunden" Style="{StaticResource ToggelButtonList}" Command="{Binding ListClientsCommand}" />
|
||||
<RadioButton Name="rbProjekte" Content="Projekte" Style="{StaticResource ToggelButtonList}" Command="{Binding ListProjectsCommand}" />
|
||||
<RadioButton Name="rbBaustellen" Content="Baustellen" Style="{StaticResource ToggelButtonList}" Command="{Binding ListBaustellenCommand}" />
|
||||
<RadioButton x:Name="rbObjekte" Content="Objekte" Style="{StaticResource ToggelButtonList}" Command="{Binding ListObjectsCommand}" />
|
||||
<RadioButton Name="rbKunden" Content="Kunden" Style="{StaticResource ToggelButtonList}" Checked="rbKunden_Checked" />
|
||||
<RadioButton Name="rbProjekte" Content="Projekte" Style="{StaticResource ToggelButtonList}" Checked="rbProjekte_Checked" />
|
||||
<RadioButton Name="rbBaustellen" Content="Baustellen" Style="{StaticResource ToggelButtonList}" Checked="rbBaustellen_Checked" />
|
||||
<RadioButton x:Name="rbObjekte" Content="Objekte" Style="{StaticResource ToggelButtonList}" Checked="rbObjekte_Checked" />
|
||||
</StackPanel>
|
||||
<Line Grid.Row="1" Stroke="Black" Width="auto" Height="4" StrokeThickness="20" Fill="Black" Stretch="Fill" X1="9" X2="10" />
|
||||
<StackPanel Grid.Row="2">
|
||||
@@ -50,7 +48,7 @@
|
||||
<RadioButton Name="Test" Checked="Test_Checked" Content="Test" Style="{StaticResource ToggelButtonList}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<ContentControl Grid.Column="1" Name="ContentController" Content="{Binding ActualViewModel}"/>
|
||||
<ContentControl Grid.Column="1" Name="ContentController" Content="KanSan"/>
|
||||
<StatusBar Grid.ColumnSpan="2" Margin="0,1,0,0" Grid.Row="1">
|
||||
<StatusBarItem Content="{Binding SelectedKunde.Vorname}" />
|
||||
<StatusBarItem Content="{Binding SelectedProjekt.Projektnummer}" />
|
||||
|
||||
@@ -36,19 +36,52 @@ namespace KanSan
|
||||
UI.UCLeistungsverzeichnisPositionenBaustelle UCLeistungsverzeichnisPositionenBaustelle;
|
||||
UI.UCLeistungsverzeichnisPosList UCLeistungsverzeichnisPosList;
|
||||
|
||||
public MainWindow(object dataContext)
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
|
||||
DataContext = dataContext;
|
||||
//(this.DataContext as MainWindowViewModel).GenerateExcelFile();
|
||||
this.DataContext = new MainWindowViewModel();
|
||||
(this.DataContext as MainWindowViewModel).GenerateExcelFile();
|
||||
#if DEBUG
|
||||
System.Diagnostics.PresentationTraceSources.DataBindingSource.Switch.Level = SourceLevels.Critical;
|
||||
#endif
|
||||
}
|
||||
|
||||
private void UCProjektList_ProjektAdded(object sender, UI.SelectProjektEventArgs e)
|
||||
{
|
||||
if (e.projekt == null) return;
|
||||
UI.UCProjektEdit uCProjektEdit = new UI.UCProjektEdit(e.projekt);
|
||||
ContentController.Content = uCProjektEdit;
|
||||
}
|
||||
|
||||
private void UCProjektList_ProjektSelected(object sender, UI.SelectProjektEventArgs e)
|
||||
{
|
||||
(DataContext as MainWindowViewModel).SelectedProjekt = e.projekt;
|
||||
}
|
||||
|
||||
private void UCKundeList_KundeSelect(object sender, UI.KundeAddedKlickEventArgs e)
|
||||
{
|
||||
(DataContext as MainWindowViewModel).SelectedKunde = e.kunde;
|
||||
}
|
||||
|
||||
private void UCKundeList_KundeAdded(object sender, UI.KundeAddedKlickEventArgs e)
|
||||
{
|
||||
UCKundeEdit = new UI.UCKundeEdit(e.kunde);
|
||||
UCKundeEdit.SpeichernClicked += Edit_SpeichernClicked;
|
||||
ContentController.Content = UCKundeEdit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void UCProjektList_ProjektEdited(object sender, UI.SelectProjektEventArgs e)
|
||||
{
|
||||
if (e.projekt == null) return;
|
||||
UI.UCProjektEdit uCProjektEdit = new UI.UCProjektEdit(e.projekt);
|
||||
|
||||
uCProjektEdit.SpeichernClicked += Edit_SpeichernClicked;
|
||||
ContentController.Content = uCProjektEdit;
|
||||
}
|
||||
|
||||
private void Edit_SpeichernClicked(object sender, EventArgs e)
|
||||
{
|
||||
@@ -56,6 +89,88 @@ namespace KanSan
|
||||
}
|
||||
|
||||
|
||||
private void UCBaustelleList_BaustelleSelected(object sender, UI.SelectBaustelleEventArgs e)
|
||||
{
|
||||
(DataContext as MainWindowViewModel).SelectedBaustelle = e.baustelle;
|
||||
}
|
||||
|
||||
private void UCBaustelleList_BaustelleEdited(object sender, UI.SelectBaustelleEventArgs e)
|
||||
{
|
||||
if (e.baustelle == null) return;
|
||||
UI.UCBaustelleEdit uCBaustelleEdit = new UI.UCBaustelleEdit(e.baustelle);
|
||||
|
||||
uCBaustelleEdit.SpeichernClicked += Edit_SpeichernClicked;
|
||||
ContentController.Content = uCBaustelleEdit;
|
||||
|
||||
}
|
||||
|
||||
private void UCBaustelleList_BaustelleAdded(object sender, UI.SelectBaustelleEventArgs e)
|
||||
{
|
||||
if (e.baustelle == null) return;
|
||||
UI.UCBaustelleEdit uBaustelleEdit = new UI.UCBaustelleEdit(e.baustelle);
|
||||
uBaustelleEdit.SpeichernClicked += Edit_SpeichernClicked;
|
||||
ContentController.Content = uBaustelleEdit;
|
||||
}
|
||||
|
||||
|
||||
private void UCObjekteList_ObjektSelected(object sender, UI.ObjektSelectEventArgs e)
|
||||
{
|
||||
if (e.Objekt == null) return;
|
||||
(DataContext as MainWindowViewModel).SelectedObjekt = e.Objekt;
|
||||
rbObjekte.IsChecked = false;
|
||||
|
||||
uCSewerMainMenu = new UI.UCSewerMainMenu(e.Objekt);
|
||||
|
||||
ContentController.Content = uCSewerMainMenu;
|
||||
|
||||
}
|
||||
|
||||
private void rbKunden_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
rbLeistungsverzeichnis.IsChecked = false;
|
||||
rbLeistungsverzeichnisBaustellen.IsChecked = false;
|
||||
UCKundeList = new UI.UCKundeList();
|
||||
UCKundeList.KundeAdded += UCKundeList_KundeAdded;
|
||||
UCKundeList.KundeSelect += UCKundeList_KundeSelect;
|
||||
ContentController.Content = UCKundeList;
|
||||
}
|
||||
|
||||
private void rbProjekte_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
rbLeistungsverzeichnis.IsChecked = false;
|
||||
rbLeistungsverzeichnisBaustellen.IsChecked = false;
|
||||
Kunde client = (DataContext as MainWindowViewModel).SelectedKunde;
|
||||
//Debugger.Break();
|
||||
if (client == null) return;
|
||||
UCProjektList = new UI.UCProjektList(client);
|
||||
UCProjektList.ProjektSelected += UCProjektList_ProjektSelected;
|
||||
UCProjektList.ProjektAdded += UCProjektList_ProjektAdded;
|
||||
UCProjektList.ProjektEdited += UCProjektList_ProjektEdited;
|
||||
ContentController.Content = UCProjektList;
|
||||
}
|
||||
|
||||
private void rbBaustellen_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
rbLeistungsverzeichnis.IsChecked = false;
|
||||
rbLeistungsverzeichnisBaustellen.IsChecked = false;
|
||||
Projekt projekt = (DataContext as MainWindowViewModel).SelectedProjekt;
|
||||
if (projekt == null) return;
|
||||
UCBaustelleList = new UI.UCBaustelleList(projekt);
|
||||
UCBaustelleList.BaustelleAdded += UCBaustelleList_BaustelleAdded;
|
||||
UCBaustelleList.BaustelleEdited += UCBaustelleList_BaustelleEdited;
|
||||
UCBaustelleList.BaustelleSelected += UCBaustelleList_BaustelleSelected;
|
||||
ContentController.Content = UCBaustelleList;
|
||||
}
|
||||
|
||||
private void rbObjekte_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
rbLeistungsverzeichnis.IsChecked = false;
|
||||
rbLeistungsverzeichnisBaustellen.IsChecked = false;
|
||||
rbObjekte.IsChecked = true;
|
||||
UI.UCObjekteList uCObjekteList = new UI.UCObjekteList((DataContext as MainWindowViewModel).SelectedBaustelle);
|
||||
uCObjekteList.ObjektSelected += UCObjekteList_ObjektSelected;
|
||||
ContentController.Content = uCObjekteList;
|
||||
}
|
||||
|
||||
private void rbLeistungsverzeichnis_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
@@ -23,11 +23,6 @@ namespace KanSan.UI
|
||||
public event EventHandler<SelectBaustelleEventArgs> BaustelleSelected;
|
||||
public event EventHandler<SelectBaustelleEventArgs> BaustelleAdded;
|
||||
public event EventHandler<SelectBaustelleEventArgs> BaustelleEdited;
|
||||
|
||||
public UCBaustelleList()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
public UCBaustelleList(Projekt projekt)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
@@ -27,8 +26,7 @@
|
||||
<Label Grid.Column="0" Grid.Row="3">Plz</Label>
|
||||
<Label Grid.Column="0" Grid.Row="4">Ort</Label>
|
||||
|
||||
<Button Name="Speichern" Content="Speichern" Grid.Row="5" Grid.ColumnSpan="2" Command="{Binding SaveClient}" />
|
||||
<Button Content="Löschen" Grid.Row="6" Grid.ColumnSpan="2" Command="{Binding RemoveClient}" />
|
||||
<Button Name="Speichern" Content="Speichern" Grid.Row="5" Grid.ColumnSpan="2" Click="Speichern_Click" />
|
||||
|
||||
<TextBox Grid.Column="1" Grid.Row="0" Text="{Binding Vorname}" />
|
||||
<TextBox Grid.Column="1" Grid.Row="1" Text="{Binding Nachname}" />
|
||||
|
||||
@@ -22,9 +22,30 @@ namespace KanSan.UI
|
||||
/// </summary>
|
||||
public partial class UCKundeEdit : UserControl
|
||||
{
|
||||
public UCKundeEdit()
|
||||
public event EventHandler SpeichernClicked;
|
||||
|
||||
protected virtual void OnSpeichernKlicked(EventArgs e)
|
||||
{
|
||||
EventHandler handler = SpeichernClicked;
|
||||
if (handler != null)
|
||||
handler(this, e);
|
||||
}
|
||||
|
||||
//private Kunde kunde = null;
|
||||
//private UnitOfWork unitOfWork = null;
|
||||
public UCKundeEdit(Kunde kunde = null)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
|
||||
this.DataContext = new KundenEditViewModel(kunde);
|
||||
}
|
||||
|
||||
private void Speichern_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
((KundenEditViewModel)DataContext).Speichern();
|
||||
OnSpeichernKlicked(EventArgs.Empty);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,16 +17,16 @@
|
||||
<RowDefinition Height="50"/>
|
||||
<RowDefinition Height="50" />
|
||||
</Grid.RowDefinitions>
|
||||
<DataGrid IsReadOnly="True" AutoGenerateColumns="False" SelectionMode="Single" SelectedItem="{Binding SelectedKunde, Mode=TwoWay}" ItemsSource="{Binding Kunden}" Name="dgKundenList">
|
||||
<DataGrid AutoGenerateColumns="False" SelectionMode="Single" ItemsSource="{Binding Kunden}" Name="dgKundenList">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="Vorname" Binding="{Binding Vorname}" />
|
||||
<DataGridTextColumn Header="Nachname" Binding="{Binding Nachname}" />
|
||||
<DataGridTextColumn Header="Ort" Binding="{Binding Ort}" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<Button Grid.Row="1" Name="SelectKunde" Content="Kunde Auswählen" Command="{Binding SelectClientCommand}" />
|
||||
<Button Grid.Row="2" Name="EditKunde" Content="Kunde Editieren" Command="{Binding EditClientCommand}" />
|
||||
<Button Grid.Row="3" Name="NeueKunde" Content="Neue Kunde anlegen" Command="{Binding AddNewClientCommand}" />
|
||||
<Button Grid.Row="1" Name="SelectKunde" Content="Kunde Auswählen" Click="SelectKunde_Click" />
|
||||
<Button Grid.Row="2" Name="EditKunde" Content="Kunde Editieren" Click="EditKunde_Click" />
|
||||
<Button Grid.Row="3" Name="NeueKunde" Content="Neue Kunde anlegen" Click="NeueKunde_Click" />
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@@ -21,10 +21,54 @@ namespace KanSan.UI
|
||||
/// </summary>
|
||||
public partial class UCKundeList : UserControl
|
||||
{
|
||||
public event EventHandler<KundeAddedKlickEventArgs> KundeAdded;
|
||||
public event EventHandler<KundeAddedKlickEventArgs> KundeSelect;
|
||||
public UCKundeList()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.DataContext = new KundenListViewModel();
|
||||
}
|
||||
|
||||
private void NeueKunde_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
KundeAddedKlickEventArgs args = new KundeAddedKlickEventArgs();
|
||||
args.kunde = (DataContext as KundenListViewModel).NeueKunde();
|
||||
OnClickKundeAdded(args);
|
||||
|
||||
}
|
||||
protected virtual void OnClickKundeAdded(KundeAddedKlickEventArgs e)
|
||||
{
|
||||
EventHandler<KundeAddedKlickEventArgs> handler = KundeAdded;
|
||||
if (handler != null)
|
||||
handler(this, e);
|
||||
}
|
||||
|
||||
protected virtual void OnClickSelectedKunde(KundeAddedKlickEventArgs e)
|
||||
{
|
||||
EventHandler<KundeAddedKlickEventArgs> handler = KundeSelect;
|
||||
if (handler != null)
|
||||
handler(this, e);
|
||||
}
|
||||
|
||||
|
||||
private void EditKunde_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Kunde selectedKunde = (dgKundenList.SelectedItem as Kunde);
|
||||
if (selectedKunde == null) return;
|
||||
|
||||
OnClickKundeAdded(new KundeAddedKlickEventArgs() { kunde = selectedKunde });
|
||||
}
|
||||
|
||||
private void SelectKunde_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Kunde selectedKunde = (dgKundenList.SelectedItem as Kunde);
|
||||
if (selectedKunde == null) return;
|
||||
OnClickSelectedKunde(new KundeAddedKlickEventArgs() { kunde = selectedKunde });
|
||||
}
|
||||
}
|
||||
|
||||
public class KundeAddedKlickEventArgs : EventArgs
|
||||
{
|
||||
public Kunde kunde { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1" Content="Speichern" Name="Speichern" />
|
||||
<Button Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1" Content="Speichern" Name="Speichern" Click="Speichern_Click"/>
|
||||
<StackPanel Grid.Column="1">
|
||||
<CheckBox Content="Rohrleitung in Betrieb" IsChecked="{Binding Path=(iself:IObjekteEditViewModel.RohrleitungInBetrieb)}" Style="{StaticResource checkBoxCircle}"/>
|
||||
<CheckBox Content="Wasserhaltung durchgeführt" IsChecked="{Binding Path=(iself:IObjekteEditViewModel.WasserHaltungDurchgefuehrt)}" Style="{StaticResource checkBoxCircle}" />
|
||||
|
||||
@@ -20,10 +20,15 @@ namespace KanSan.UI
|
||||
/// </summary>
|
||||
public partial class UCObjektEdit : UserControl
|
||||
{
|
||||
public UCObjektEdit()
|
||||
public UCObjektEdit(Sewer objekt)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.DataContext = new ObjekteEditViewModel(objekt);
|
||||
}
|
||||
|
||||
private void Speichern_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
(DataContext as ObjekteEditViewModel).Speichern();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
<RowDefinition Height="50" />
|
||||
</Grid.RowDefinitions>
|
||||
<TreeView Name="trvItems" ItemsSource="{Binding KanalObjekte}" MouseDoubleClick="trvItems_MouseDoubleClick">
|
||||
|
||||
<TreeView.Resources>
|
||||
<HierarchicalDataTemplate DataType="{x:Type self:ObjekteTransfer}" ItemsSource="{Binding Objekte}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
@@ -45,7 +44,7 @@
|
||||
</DataTemplate>
|
||||
</TreeView.Resources>
|
||||
</TreeView>
|
||||
<Button Grid.Row="1" x:Name="ProjektSelect" Content="Objekt Auswählen" Command="{Binding ObjektSelected}" />
|
||||
<Button Grid.Row="1" x:Name="ProjektSelect" Content="Objekt Auswählen" />
|
||||
<Button Grid.Row="2" Name="ProjektEdit" Content="Objekt Editieren" />
|
||||
<Button Grid.Row="3" Name="ObjektNew" Content="Neue Objekt Hinzufügen" Click="ObjektNew_Click" />
|
||||
|
||||
|
||||
@@ -16,63 +16,13 @@ using System.Windows.Shapes;
|
||||
|
||||
namespace KanSan.UI
|
||||
{
|
||||
public class MouseLeftButtonUp
|
||||
{
|
||||
public static DependencyProperty CommandProperty = DependencyProperty.RegisterAttached("Command", typeof(ICommand), typeof(MouseLeftButtonUp), new UIPropertyMetadata(CommandChanged));
|
||||
public static DependencyProperty CommandParameterProperty =
|
||||
DependencyProperty.RegisterAttached("CommandParamter",
|
||||
typeof(object),
|
||||
typeof(MouseLeftButtonUp),
|
||||
new UIPropertyMetadata(null));
|
||||
|
||||
public static void SetCommand(DependencyObject target, ICommand value)
|
||||
{
|
||||
target.SetValue(CommandProperty, value);
|
||||
}
|
||||
public static object GetCommand(DependencyObject target, ICommand value)
|
||||
{
|
||||
return target.GetValue(CommandProperty);
|
||||
}
|
||||
public static void SetCommandParamter(DependencyObject target, object value)
|
||||
{
|
||||
target.SetValue(CommandProperty, value);
|
||||
}
|
||||
public static object GetCommandParamter(DependencyObject target)
|
||||
{
|
||||
return target.GetValue(CommandParameterProperty);
|
||||
}
|
||||
private static void CommandChanged(DependencyObject target, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
//throw new NotImplementedException();
|
||||
Control control = target as Control;
|
||||
if (control == null) return;
|
||||
if ((e.NewValue != null) && (e.OldValue == null))
|
||||
control.MouseLeftButtonUp += OnMouseLeftButtonUp;
|
||||
else if ((e.NewValue == null) && (e.OldValue != null))
|
||||
control.MouseLeftButtonUp -= OnMouseLeftButtonUp;
|
||||
|
||||
}
|
||||
private static void OnMouseLeftButtonUp(object sender, RoutedEventArgs e)
|
||||
{
|
||||
//throw new NotImplementedException();
|
||||
Control control = sender as Control;
|
||||
ICommand command = (ICommand)control.GetValue(CommandProperty);
|
||||
object commandParameter = control.GetValue(CommandParameterProperty);
|
||||
command.Execute(commandParameter);
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Interaktionslogik für UCObjekteList.xaml
|
||||
/// </summary>
|
||||
public partial class UCObjekteList : UserControl
|
||||
{
|
||||
|
||||
public event EventHandler<ObjektSelectEventArgs> ObjektSelected;
|
||||
Baustelle baustelle;
|
||||
public UCObjekteList()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
public UCObjekteList(Baustelle baustelle)
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -88,17 +38,24 @@ namespace KanSan.UI
|
||||
|
||||
private void trvItems_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
|
||||
TreeView treeView = (TreeView)sender;
|
||||
if (treeView == null) return;
|
||||
if (!(treeView.SelectedItem is Sewer)) return;
|
||||
Sewer sewer = (Sewer)treeView.SelectedItem;
|
||||
if (sewer == null) return;
|
||||
SewerMainWindow sewerMainWindow = new SewerMainWindow();
|
||||
sewerMainWindow.DataContext = new SewerMainWindowViewModel(sewer);
|
||||
sewerMainWindow.ShowDialog();
|
||||
|
||||
OnObjektSelectKlick(new ObjektSelectEventArgs() { Objekt = sewer });
|
||||
}
|
||||
|
||||
protected virtual void OnObjektSelectKlick(ObjektSelectEventArgs e)
|
||||
{
|
||||
EventHandler<ObjektSelectEventArgs> handler = ObjektSelected;
|
||||
if (handler != null)
|
||||
handler(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
public class ObjektSelectEventArgs : EventArgs
|
||||
{
|
||||
public Sewer Objekt { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
<Label Background="Beige" Grid.Column="0" Grid.Row="0" Content="Projektnummer" />
|
||||
<Label Background="Beige" Grid.Column="0" Grid.Row="1" Content="Ort" />
|
||||
<Button Grid.Row="2" Grid.ColumnSpan="2" Name="Speichern" Content="Speichern" Command="{Binding SaveProjekt}" />
|
||||
<Button Grid.Row="2" Grid.ColumnSpan="2" Name="Speichern" Content="Speichern" Click="Speichern_Click" />
|
||||
|
||||
<TextBox Grid.Column="1" Grid.Row="0" Text="{Binding Projektnummer}" />
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding Ort}" />
|
||||
|
||||
@@ -20,9 +20,25 @@ namespace KanSan.UI
|
||||
/// </summary>
|
||||
public partial class UCProjektEdit : UserControl
|
||||
{
|
||||
public UCProjektEdit()
|
||||
public event EventHandler SpeichernClicked;
|
||||
|
||||
protected virtual void OnSpeichernKlicked(EventArgs e)
|
||||
{
|
||||
EventHandler handler = SpeichernClicked;
|
||||
if (handler != null)
|
||||
handler(this, e);
|
||||
}
|
||||
public UCProjektEdit(Projekt projekt)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this.DataContext = new ProjektEditViewModel(projekt);
|
||||
}
|
||||
|
||||
private void Speichern_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
(DataContext as ProjektEditViewModel).Speichern();
|
||||
OnSpeichernKlicked(EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,14 +17,14 @@
|
||||
<RowDefinition Height="50" />
|
||||
<RowDefinition Height="50" />
|
||||
</Grid.RowDefinitions>
|
||||
<DataGrid IsReadOnly="True" ItemsSource="{Binding ProjekteVomKunde}" SelectedItem="{Binding SelectedProjekt}" Name="dgProjekte" AutoGenerateColumns="False">
|
||||
<DataGrid ItemsSource="{Binding ProjekteVomKunde}" Name="dgProjekte" AutoGenerateColumns="False">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="Projektnummer" Binding="{Binding Projektnummer}" />
|
||||
<DataGridTextColumn Header="Ort" Binding="{Binding Ort}" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<Button Grid.Row="1" x:Name="ProjektSelect" Content="Projekt Auswählen" Command="{Binding SelectProjekt}"/>
|
||||
<Button Grid.Row="2" Name="ProjektEdit" Content="Projekt Editieren" Command="{Binding EditProjekt}"/>
|
||||
<Button Grid.Row="3" Name="ProjektNew" Content="Neue Projekt Hinzufügen" Command="{Binding NewProjekt}" />
|
||||
<Button Grid.Row="1" x:Name="ProjektSelect" Content="Projekt Auswählen" Click="ProjektSelect_Click" />
|
||||
<Button Grid.Row="2" Name="ProjektEdit" Content="Projekt Editieren" Click="ProjektEdit_Click" />
|
||||
<Button Grid.Row="3" Name="ProjektNew" Content="Neue Projekt Hinzufügen" Click="ProjektNew_Click" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@@ -20,10 +20,61 @@ namespace KanSan.UI
|
||||
/// </summary>
|
||||
public partial class UCProjektList : UserControl
|
||||
{
|
||||
public event EventHandler<SelectProjektEventArgs> ProjektAdded;
|
||||
public event EventHandler<SelectProjektEventArgs> ProjektEdited;
|
||||
public event EventHandler<SelectProjektEventArgs> ProjektSelected;
|
||||
|
||||
public UCProjektList()
|
||||
public UCProjektList(Kunde selectedKunde)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.DataContext = new ProjektListViewModel(selectedKunde);
|
||||
}
|
||||
|
||||
private void ProjektSelect_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Projekt selectedProjekt = (dgProjekte.SelectedItem as Projekt);
|
||||
if (selectedProjekt == null) return;
|
||||
OnClickProjektSelect(new SelectProjektEventArgs() { projekt = selectedProjekt });
|
||||
}
|
||||
|
||||
private void ProjektEdit_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Projekt selectedProjekt = (dgProjekte.SelectedItem as Projekt);
|
||||
if (selectedProjekt == null) return;
|
||||
OnClickProjektEdit(new SelectProjektEventArgs() { projekt = selectedProjekt });
|
||||
}
|
||||
|
||||
private void ProjektNew_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
OnClickProjektAdd(
|
||||
new SelectProjektEventArgs()
|
||||
{
|
||||
projekt = (DataContext as ProjektListViewModel).NeueProjekt()
|
||||
});
|
||||
}
|
||||
|
||||
protected virtual void OnClickProjektSelect(SelectProjektEventArgs e)
|
||||
{
|
||||
EventHandler<SelectProjektEventArgs> handler = ProjektSelected;
|
||||
if (handler != null)
|
||||
handler(this, e);
|
||||
}
|
||||
protected virtual void OnClickProjektEdit(SelectProjektEventArgs e)
|
||||
{
|
||||
EventHandler<SelectProjektEventArgs> handler = ProjektEdited;
|
||||
if (handler != null)
|
||||
handler(this, e);
|
||||
}
|
||||
protected virtual void OnClickProjektAdd(SelectProjektEventArgs e)
|
||||
{
|
||||
EventHandler<SelectProjektEventArgs> handler = ProjektAdded;
|
||||
if (handler != null)
|
||||
handler(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
public class SelectProjektEventArgs : EventArgs
|
||||
{
|
||||
public Projekt projekt { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
<UserControl x:Class="KanSan.UI.UCSanierungOverview"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:KanSan.UI"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="./../../my_controls.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<ContentControl Name="Sanierungsmaßnahmen" Content="{Binding Path=Sanierungsmaßnahmen}" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -1,26 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace KanSan.UI
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für UCSanierungOverview.xaml
|
||||
/// </summary>
|
||||
public partial class UCSanierungOverview : UserControl
|
||||
{
|
||||
public UCSanierungOverview()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -52,7 +52,7 @@
|
||||
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<Button Grid.Row="1" Name="NewSchaden" Command="{Binding neueSchadenHinzufügen}" Content="Neue Schäden Hinzufügen" />
|
||||
<Button Grid.Row="1" Name="NewSchaden" Click="NewSchaden_Click" Content="Neue Schäden Hinzufügen" />
|
||||
<Button Grid.Row="2" Name="GenerateExcel" Content="Schadensbericht erstellen" Click="GenerateExcel_Click" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@@ -29,11 +29,6 @@ namespace KanSan.UI
|
||||
this.DataContext = new SchaedenListViewModel(actualSelectedSewer);
|
||||
}
|
||||
|
||||
public UCSchaedenList()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
protected virtual void OnClickSchaedenSelect(SelectSchaedenEventArgs e)
|
||||
{
|
||||
EventHandler<SelectSchaedenEventArgs> handler = SchaedenSelected;
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
<syncfusion:ChromelessWindow x:Class="KanSan.UI.SewerMainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:syncfusion="clr-namespace:Syncfusion.Windows.Shared;assembly=Syncfusion.Shared.WPF"
|
||||
xmlns:local="clr-namespace:KanSan.UI"
|
||||
mc:Ignorable="d" TitleBarBackground="BlueViolet"
|
||||
Title="SewerMainWindow" Height="450" Width="800" WindowStartupLocation="CenterScreen" WindowState="Maximized">
|
||||
<Window.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="./../my_controls.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Window.Resources>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="150" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="11*" />
|
||||
<RowDefinition Height="64*" />
|
||||
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2">
|
||||
<TextBlock Text="{Binding ObjektBezeichnung}" />
|
||||
<!--<TextBlock Text="{Binding Path=(self:SewerMainMenuViewModel.ObjektBezeichnung)}" />
|
||||
<TextBlock Text="{Binding Path=(self:SewerMainMenuViewModel.SchadenEntfernung)}" />-->
|
||||
<TextBlock Text="" />
|
||||
</StackPanel>
|
||||
<!--<TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Text="{Binding Path=(self:SewerMainMenuViewModel.ObjektBezeichnung)}" />-->
|
||||
|
||||
<StackPanel Grid.Column="0" Grid.Row="1" Name="MenuItems">
|
||||
|
||||
<RadioButton Command="{Binding StammdatenSelect}" Style="{StaticResource ToggelButtonList}" Content="Stammdaten" />
|
||||
<RadioButton Command="{Binding SchädenübersichtSelect}" Name="rbSchaeden" Style="{StaticResource ToggelButtonList}" Content="Schäden" />
|
||||
</StackPanel>
|
||||
<ContentControl Grid.Column="1" Grid.Row="1" Content="{Binding AktualView}" Name="ObjektContentcontroller" />
|
||||
</Grid>
|
||||
</syncfusion:ChromelessWindow>
|
||||
@@ -1,33 +0,0 @@
|
||||
using KanSan.Base.Models;
|
||||
using KanSan.ViewModel;
|
||||
using Syncfusion.Windows.Shared;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace KanSan.UI
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für SewerMainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class SewerMainWindow : ChromelessWindow
|
||||
{
|
||||
public SewerMainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
public SewerMainWindow(Sewer model)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.DataContext = new SewerMainWindowViewModel(model);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,6 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:self="clr-namespace:KanSan.ViewModel;assembly=KanSan.ViewModel"
|
||||
xmlns:syncfusion="clr-namespace:Syncfusion.Windows.Shared;assembly=Syncfusion.Shared.WPF"
|
||||
xmlns:local="clr-namespace:KanSan.UI"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
|
||||
@@ -24,9 +24,9 @@ namespace KanSan.UI
|
||||
public UCSewerMainMenu(Sewer objekt)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.DataContext = new SewerMainWindowViewModel(objekt);
|
||||
//UI.UCObjektEdit uCObjektEdit = new UCObjektEdit(objekt);
|
||||
//ObjektContentcontroller.Content = uCObjektEdit;
|
||||
this.DataContext = new SewerMainMenuViewModel(objekt);
|
||||
UI.UCObjektEdit uCObjektEdit = new UCObjektEdit(objekt);
|
||||
ObjektContentcontroller.Content = uCObjektEdit;
|
||||
rbStammdaten.IsChecked = true;
|
||||
|
||||
Style style = this.FindResource("ToggelButtonList") as Style;
|
||||
@@ -42,31 +42,30 @@ namespace KanSan.UI
|
||||
|
||||
private void rbSewerMenuItem_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
/*
|
||||
RadioButton btn = (RadioButton)sender;
|
||||
if (btn == null) return;
|
||||
switch(btn.Name)
|
||||
{
|
||||
case "rbStammdaten":
|
||||
UI.UCObjektEdit uCObjektEdit = new UCObjektEdit((DataContext as SewerMainWindowViewModel).Objekt);
|
||||
UI.UCObjektEdit uCObjektEdit = new UCObjektEdit((DataContext as SewerMainMenuViewModel).Objekt);
|
||||
ObjektContentcontroller.Content = uCObjektEdit;
|
||||
break;
|
||||
case "rbSchaeden":
|
||||
UI.UCSchaedenList uCSchaedenList = new UCSchaedenList((DataContext as SewerMainWindowViewModel).Objekt);
|
||||
UI.UCSchaedenList uCSchaedenList = new UCSchaedenList((DataContext as SewerMainMenuViewModel).Objekt);
|
||||
uCSchaedenList.SchaedenSelected += UCSchaedenList_SchaedenSelected;
|
||||
uCSchaedenList.SanierungsmaßnahmenSelected += UCSchaedenList_SanierungsmaßnahmenSelected;
|
||||
ObjektContentcontroller.Content = uCSchaedenList;
|
||||
break;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
}
|
||||
Schaeden aktuellSchadenSelected = null;
|
||||
private void UCSchaedenList_SanierungsmaßnahmenSelected(object sender, SelectSchaedenEventArgs e)
|
||||
{
|
||||
aktuellSchadenSelected = e.schaeden;
|
||||
UI.UCSanMaßnahmenList uCSanMaßnahmenList = new UCSanMaßnahmenList(e.schaeden);
|
||||
(DataContext as SewerMainWindowViewModel).Schaden = e.schaeden;
|
||||
(DataContext as SewerMainMenuViewModel).Schaden = e.schaeden;
|
||||
|
||||
uCSanMaßnahmenList.TaetigkeitenSelected += UCSanMaßnahmenList_TaetigkeitenSelected;
|
||||
rbSchaeden.IsChecked = false;
|
||||
@@ -104,7 +103,7 @@ namespace KanSan.UI
|
||||
|
||||
private void UCSchaedenEdit_SpeichernClicked(object sender, EventArgs e)
|
||||
{
|
||||
UI.UCSchaedenList uCSchaedenList = new UCSchaedenList((DataContext as SewerMainWindowViewModel).Objekt);
|
||||
UI.UCSchaedenList uCSchaedenList = new UCSchaedenList((DataContext as SewerMainMenuViewModel).Objekt);
|
||||
uCSchaedenList.SchaedenSelected += UCSchaedenList_SchaedenSelected;
|
||||
ObjektContentcontroller.Content = uCSchaedenList;
|
||||
}
|
||||
|
||||
@@ -1,37 +1,10 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:KanSan"
|
||||
xmlns:vm="clr-namespace:KanSan.ViewModel;assembly=KanSan.ViewModel"
|
||||
xmlns:l="clr-namespace:KanSan.UI">
|
||||
<DataTemplate x:Key="SanierungViewModelDataTemplate" DataType="{x:Type l:UCHarzSanierung }">
|
||||
<l:UCHarzSanierung />
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type vm:ProjektEditViewModel}">
|
||||
<l:UCProjektEdit />
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type vm:KundenListViewModel}">
|
||||
<l:UCKundeList/>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type vm:KundenEditViewModel}">
|
||||
<l:UCKundeEdit/>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type vm:ProjektListViewModel}">
|
||||
<l:UCProjektList/>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type vm:BaustellenListViewModel}">
|
||||
<l:UCBaustelleList/>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type vm:ObjekteListViewModel}">
|
||||
<l:UCObjekteList />
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type vm:ObjekteEditViewModel}">
|
||||
<l:UCObjektEdit />
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type vm:SchaedenListViewModel}">
|
||||
<l:UCSchaedenList />
|
||||
</DataTemplate>
|
||||
|
||||
|
||||
<DataTemplate x:Key="SelectNewTätigkeitenLVPosition">
|
||||
<Border BorderThickness="2" BorderBrush="Red">
|
||||
<ItemsControl ItemsSource="{Binding LVPositionen }">
|
||||
|
||||
11
KundenManagement.Contract/IKundeManager.cs
Normal file
11
KundenManagement.Contract/IKundeManager.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using KanSan.CrossCutting.DataClasses;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace KundenManagement.Contract
|
||||
{
|
||||
public interface IKundeManager
|
||||
{
|
||||
List<Kunde> GetAllKunden();
|
||||
}
|
||||
}
|
||||
11
KundenManagement.Contract/KundenManagement.Contract.csproj
Normal file
11
KundenManagement.Contract/KundenManagement.Contract.csproj
Normal file
@@ -0,0 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\KanSan.DataClasses\KanSan.DataClasses.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
27
KundenManagment/KundeManager.cs
Normal file
27
KundenManagment/KundeManager.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using KanSan.CrossCutting.DataClasses;
|
||||
using KanSan.DataStoring.Contract;
|
||||
using KundenManagement.Contract;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace KundenManagment
|
||||
{
|
||||
public class KundeManager : IKundeManager
|
||||
{
|
||||
|
||||
private readonly IRepository<Kunde> _repository;
|
||||
public KundeManager(IRepository<Kunde> repository)
|
||||
{
|
||||
|
||||
_repository = repository;
|
||||
}
|
||||
public List<Kunde> GetAllKunden()
|
||||
{
|
||||
return _repository
|
||||
.Query
|
||||
.Where(p => p.ID >= 0)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
12
KundenManagment/KundenManagement.csproj
Normal file
12
KundenManagment/KundenManagement.csproj
Normal file
@@ -0,0 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DataStoring.Contract\DataStoring.Contract.csproj" />
|
||||
<ProjectReference Include="..\KundenManagement.Contract\KundenManagement.Contract.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
21
Mappings/KernelInitializer.cs
Normal file
21
Mappings/KernelInitializer.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using DataStoring.EF;
|
||||
using KanSan.DataStoring.Contract;
|
||||
using KanSan.DataStoring.CSV;
|
||||
using KundenManagement.Contract;
|
||||
using KundenManagment;
|
||||
using Ninject;
|
||||
using System;
|
||||
|
||||
namespace KanSan.DependencyInjection.Mappings
|
||||
{
|
||||
public class KernelInitializer
|
||||
{
|
||||
public void Initialize(IKernel kernel)
|
||||
{
|
||||
kernel.Bind<KanSanContext>().ToSelf();
|
||||
kernel.Bind(typeof(IRepository<>)).To(typeof(Repository<>));
|
||||
//kernel.Bind<IKundenRepository>().To<KundenRepository>();
|
||||
kernel.Bind<IKundeManager>().To<KundeManager>();
|
||||
}
|
||||
}
|
||||
}
|
||||
19
Mappings/Mappings.csproj
Normal file
19
Mappings/Mappings.csproj
Normal file
@@ -0,0 +1,19 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Ninject" Version="3.3.4" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DataStoring.Contract\DataStoring.Contract.csproj" />
|
||||
<ProjectReference Include="..\DataStoring.CSV\DataStoring.CSV.csproj" />
|
||||
<ProjectReference Include="..\DataStoring.EF\DataStoring.EF.csproj" />
|
||||
<ProjectReference Include="..\KundenManagement.Contract\KundenManagement.Contract.csproj" />
|
||||
<ProjectReference Include="..\KundenManagment\KundenManagement.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user