Datenbankpfade angepasst.

Tabellenstruktur hinzugefügt
This commit is contained in:
2024-08-21 10:08:18 +02:00
parent 7e0105defa
commit 6f218889ee
8 changed files with 95 additions and 18 deletions

View File

@@ -11,7 +11,7 @@ namespace dcnsanplanung.DAL.Helper
{
List<shared.Model.Haltung> haltungen = new List<shared.Model.Haltung>();
List<shared.Model.LeistungsverzeichnisPosition> LVPositionen = new List<shared.Model.LeistungsverzeichnisPosition>();
public WriteToDatabase(string XMLFile, string connectionstring = "Host = localhost; Database = sanplaner; Username = dcnsanplaner; Password = sanplaner")
public WriteToDatabase(string XMLFile, string connectionstring = "Host = 10.1.0.2; Database = sanplaner; Username = sanplaner; Password = sanplaner")
{
haltungen = new shared.Helper.ImportToSoftware(XMLFile).haltungen;
//LVPositionen = new shared.Helper.ImportLVToSoftware(@"C:\Users\damia\source\repos\dcnsanplanung\BE-BS-AWN DW_0001_OOWV_Stamm_LV_Kanalsanierung_xml33.X81").LVPositionen;
@@ -21,7 +21,7 @@ namespace dcnsanplanung.DAL.Helper
public async Task<bool> WriteInHaltung()
{
string connectionstring = "Host = localhost; Database = sanplaner; Username = dcnsanplaner; Password = sanplaner";
string connectionstring = "Host = 10.1.0.2; Database = sanplaner; Username = sanplaner; Password = sanplaner";
HaltungDataService haltungDataService = new HaltungDataService(connectionstring);
await haltungDataService.InsertHaltungBulk(haltungen);
return true;
@@ -29,7 +29,7 @@ namespace dcnsanplanung.DAL.Helper
public async Task<bool> WriteInLV()
{
string connectionstring = "Host = localhost; Database = sanplaner; Username = dcnsanplaner; Password = sanplaner";
string connectionstring = "Host = 10.1.0.2; Database = sanplaner; Username = sanplaner; Password = sanplaner";
LVDataService lVDataService = new LVDataService(connectionstring);
await lVDataService.InsertLeistungsverzeichnisPositionBulk(LVPositionen);
return true;

View File

@@ -65,7 +65,7 @@ namespace dcnsanplanung.DAL.Services.PostgresqlData
{
Haltung result = new Haltung()
{
ID = reader.GetInt32(0),
//ID = reader.GetInt32(0),
Guid = Guid.Parse(reader.GetString(1)),
Ref_Projekt_Guid = Guid.Parse(reader.GetString(2)),
Objektbezeichnung = reader.GetString(3),

View File

@@ -1,7 +0,0 @@
namespace dcnsanplanung.shared
{
public class Class1
{
}
}

View File

@@ -45,13 +45,13 @@ namespace dcnsanplanung.wpf.ViewModel
private void doSpeichern()
{
SchadenDataService schadenDataService = new SchadenDataService("Host = localhost; Database = sanplaner; Username = dcnsanplaner; Password = sanplaner");
SchadenDataService schadenDataService = new SchadenDataService("Host = 10.1.0.2; Database = sanplaner; Username = sanplaner; Password = sanplaner");
schadenDataService.UpdateSchadenBuld(model.Kodierungen);
}
private async void LadeSchaeden()
{
SchadenDataService schadenDataService = new SchadenDataService("Host = localhost; Database = sanplaner; Username = dcnsanplaner; Password = sanplaner");
SchadenDataService schadenDataService = new SchadenDataService("Host = 10.1.0.2; Database = sanplaner; Username = sanplaner; Password = sanplaner");
IEnumerable<Schaden> src_kodierung = await schadenDataService.GetAllByHaltung(model);
model.Kodierungen = src_kodierung.ToList();

View File

@@ -58,10 +58,10 @@ namespace dcnsanplanung.wpf.ViewModel
private async void dooKlassifiziereAsync()
{
DAL.Services.PostgresqlData.HaltungDataService haltungDataService = new DAL.Services.PostgresqlData.HaltungDataService("Host = localhost; Database = sanplaner; Username = dcnsanplaner; Password = sanplaner");
DAL.Services.PostgresqlData.HaltungDataService haltungDataService = new DAL.Services.PostgresqlData.HaltungDataService("Host = 10.1.0.2; Database = sanplaner; Username = sanplaner; Password = sanplaner");
var s = await haltungDataService.GetAllByProjekt(0);
// Alle Haltungen laden
SchadenDataService schadenDataService = new SchadenDataService("Host = localhost; Database = sanplaner; Username = dcnsanplaner; Password = sanplaner");
SchadenDataService schadenDataService = new SchadenDataService("Host = 10.1.0.2; Database = sanplaner; Username = sanplaner; Password = sanplaner");
foreach (var item in s)
{
@@ -98,15 +98,15 @@ namespace dcnsanplanung.wpf.ViewModel
async Task dooAsync()
{
DAL.Helper.WriteToDatabase writer = new DAL.Helper.WriteToDatabase(@"D:\Airbus\Airbus Nordenham RW Viewer für Sanierungskonzept\Airbus Nordenham RW.xml");
DAL.Helper.WriteToDatabase writer = new DAL.Helper.WriteToDatabase(@"C:\Users\damia\Desktop\dev\dcnsanplanung\RW.xml");
await writer.WriteInHaltung();
//Debugger.Break();
await writer.WriteInLV();
//await writer.WriteInLV();
}
private async void LoadHaltungen()
{
DAL.Services.PostgresqlData.HaltungDataService haltungDataService = new DAL.Services.PostgresqlData.HaltungDataService("Host = localhost; Database = sanplaner; Username = dcnsanplaner; Password = sanplaner");
DAL.Services.PostgresqlData.HaltungDataService haltungDataService = new DAL.Services.PostgresqlData.HaltungDataService("Host = 10.1.0.2; Database = sanplaner; Username = sanplaner; Password = sanplaner");
var s = await haltungDataService.GetAllByProjekt(0);
foreach(var item in s)
{

49
haltung.txt Normal file
View File

@@ -0,0 +1,49 @@
-- Table: public.haltung
-- DROP TABLE IF EXISTS public.haltung;
CREATE TABLE IF NOT EXISTS public.haltung
(
id integer NOT NULL DEFAULT nextval('haltung_id_seq'::regclass),
guid text COLLATE pg_catalog."default",
ref_projekt_guid text COLLATE pg_catalog."default",
objektbezeichnung text COLLATE pg_catalog."default",
bewertungklasse integer,
dn integer,
material text COLLATE pg_catalog."default",
CONSTRAINT haltung_pkey PRIMARY KEY (id)
)
TABLESPACE pg_default;
ALTER TABLE IF EXISTS public.haltung
OWNER to sanplaner;
CREATE TABLE IF NOT EXISTS public.haltung
(
id SERIAL PRIMARY KEY,
guid text COLLATE pg_catalog."default",
ref_projekt_guid text COLLATE pg_catalog."default",
objektbezeichnung text COLLATE pg_catalog."default",
bewertungklasse integer,
dn integer,
material text COLLATE pg_catalog."default"
)
TABLESPACE pg_default;
ALTER TABLE IF EXISTS public.haltung
OWNER to sanplaner;

10
projekt.txt Normal file
View File

@@ -0,0 +1,10 @@
CREATE TABLE IF NOT EXISTS public.projekt
(
id SERIAL PRIMARY KEY,
guid text COLLATE pg_catalog."default"
)
TABLESPACE pg_default;
ALTER TABLE IF EXISTS public.projekt
OWNER to sanplaner;

25
schaden.txt Normal file
View File

@@ -0,0 +1,25 @@
-- Table: public.schaden
-- DROP TABLE IF EXISTS public.schaden;
CREATE TABLE IF NOT EXISTS public.schaden
(
id SERIAL PRIMARY KEY,
guid text COLLATE pg_catalog."default",
ref_haltung_guid text COLLATE pg_catalog."default",
entfernung numeric(8,2),
hauptcode text COLLATE pg_catalog."default",
ch1 text COLLATE pg_catalog."default",
ch2 text COLLATE pg_catalog."default",
q1 text COLLATE pg_catalog."default",
q2 text COLLATE pg_catalog."default",
kd integer,
ks integer,
kb integer,
streckenschaden text COLLATE pg_catalog."default"
)
TABLESPACE pg_default;
ALTER TABLE IF EXISTS public.schaden
OWNER to sanplaner;