Daten um Schachttyp erweitert
Wird aus CSV eingelese
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
-- Table: public.schacht
|
||||
|
||||
-- DROP TABLE IF EXISTS public.schacht;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS public.schacht
|
||||
(
|
||||
schacht_id integer NOT NULL GENERATED BY DEFAULT AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
|
||||
@@ -9,6 +13,7 @@ CREATE TABLE IF NOT EXISTS public.schacht
|
||||
sohlhochwert numeric(18,4),
|
||||
sohlhoehe numeric(18,4) NOT NULL,
|
||||
entwaesserung integer NOT NULL,
|
||||
schachtype integer,
|
||||
vermesser text COLLATE pg_catalog."default",
|
||||
aufnahmedatum text COLLATE pg_catalog."default",
|
||||
ref_projekt_id integer,
|
||||
|
||||
@@ -20,8 +20,8 @@ namespace SewerStammGen.DAL.Services.PostgresqlData
|
||||
{
|
||||
string command = "INSERT INTO " + tableName + " (" +
|
||||
"objektbezeichnung,deckelrechtswert,deckelhochwert," +
|
||||
"sohlrechtswert,sohlhochwert,sohlhoehe,deckelhoehe,entwaesserung,vermesser,aufnahmedatum,ref_projekt_id) VALUES " +
|
||||
"(@1,@2,@3,@4,@5,@6,@7,@8,@9,@10,@11) RETURNING schacht_id";
|
||||
"sohlrechtswert,sohlhochwert,sohlhoehe,deckelhoehe,entwaesserung,schachtype,vermesser,aufnahmedatum,ref_projekt_id) VALUES " +
|
||||
"(@1,@2,@3,@4,@5,@6,@7,@8,@9,@10,@11,@12) RETURNING schacht_id";
|
||||
using(var cmd = new NpgsqlCommand(command,conn))
|
||||
{
|
||||
cmd.Parameters.AddWithValue("1", entity.Objektbezeichnung);
|
||||
@@ -32,9 +32,10 @@ namespace SewerStammGen.DAL.Services.PostgresqlData
|
||||
cmd.Parameters.AddWithValue("6", entity.SohlHoehe);
|
||||
cmd.Parameters.AddWithValue("7", entity.DeckelHoehe);
|
||||
cmd.Parameters.AddWithValue("8", (int)entity.Entwaesserung);
|
||||
cmd.Parameters.AddWithValue("9", entity.Vermesser);
|
||||
cmd.Parameters.AddWithValue("10", entity.AufnahmeDatum);
|
||||
cmd.Parameters.AddWithValue("11", entity.Projekt.Id);
|
||||
cmd.Parameters.AddWithValue("9", (int)entity.SchachtType);
|
||||
cmd.Parameters.AddWithValue("10", entity.Vermesser);
|
||||
cmd.Parameters.AddWithValue("11", entity.AufnahmeDatum);
|
||||
cmd.Parameters.AddWithValue("12", entity.Projekt.Id);
|
||||
using var reader = await cmd.ExecuteReaderAsync();
|
||||
reader.Read();
|
||||
entity.Id = reader.GetInt32(0);
|
||||
@@ -65,9 +66,10 @@ namespace SewerStammGen.DAL.Services.PostgresqlData
|
||||
SohlHochWert = reader.GetDecimal(6),
|
||||
SohlHoehe = reader.GetDecimal(7),
|
||||
Entwaesserung = (EEntwaeserung)reader.GetInt32(8),
|
||||
Vermesser = reader.GetString(9),
|
||||
AufnahmeDatum = reader.GetString(10),
|
||||
Projekt = new Projekt() { Id = reader.GetInt32(11) },
|
||||
SchachtType = (ESchachtType)reader.GetInt32(9),
|
||||
Vermesser = reader.GetString(10),
|
||||
AufnahmeDatum = reader.GetString(11),
|
||||
Projekt = new Projekt() { Id = reader.GetInt32(12) },
|
||||
};
|
||||
}
|
||||
|
||||
@@ -99,7 +101,7 @@ namespace SewerStammGen.DAL.Services.PostgresqlData
|
||||
{
|
||||
string command = @"UPDATE " + tableName + " SET " +
|
||||
"objektbezeichnung=@1, deckelrechtswert=@2, deckelhochwert=@3, deckelhoehe=@4, " +
|
||||
"sohlrechtswert=@5, sohlhochwert=@6, sohlhoehe=@7, entwaesserung=@8, vermesser=@9, aufnahmedatum=@10, ref_projekt_id=@11 WHERE schacht_id=@12";
|
||||
"sohlrechtswert=@5, sohlhochwert=@6, sohlhoehe=@7, entwaesserung=@8, schachttype=@9, vermesser=@10, aufnahmedatum=@11, ref_projekt_id=@12 WHERE schacht_id=@13";
|
||||
using(var cmd = new NpgsqlCommand(command,conn))
|
||||
{
|
||||
cmd.Parameters.AddWithValue("1", entity.Objektbezeichnung);
|
||||
@@ -110,10 +112,11 @@ namespace SewerStammGen.DAL.Services.PostgresqlData
|
||||
cmd.Parameters.AddWithValue("6", entity.SohlHochWert);
|
||||
cmd.Parameters.AddWithValue("7", entity.SohlHoehe);
|
||||
cmd.Parameters.AddWithValue("8", (int)entity.Entwaesserung);
|
||||
cmd.Parameters.AddWithValue("9", entity.Vermesser);
|
||||
cmd.Parameters.AddWithValue("10", entity.AufnahmeDatum);
|
||||
cmd.Parameters.AddWithValue("11", entity.Projekt.Id);
|
||||
cmd.Parameters.AddWithValue("12", entity.Id);
|
||||
cmd.Parameters.AddWithValue("9", (int)entity.SchachtType);
|
||||
cmd.Parameters.AddWithValue("10", entity.Vermesser);
|
||||
cmd.Parameters.AddWithValue("11", entity.AufnahmeDatum);
|
||||
cmd.Parameters.AddWithValue("12", entity.Projekt.Id);
|
||||
cmd.Parameters.AddWithValue("13", entity.Id);
|
||||
|
||||
await cmd.ExecuteNonQueryAsync();
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ namespace SewerStammGen.Shared.Domain
|
||||
public decimal SohlHoehe { get; set; }
|
||||
public Projekt Projekt { get; set; } = new Projekt();
|
||||
public EEntwaeserung Entwaesserung { get; set; }
|
||||
public ESchachtType SchachtType { get; set; }
|
||||
public string Vermesser { get; set; } = String.Empty;
|
||||
public string AufnahmeDatum { get; set; } = String.Empty;
|
||||
}
|
||||
|
||||
8
SewerStammGen.Shared/Enum/ESchachtType.cs
Normal file
8
SewerStammGen.Shared/Enum/ESchachtType.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace SewerStammGen.Shared.Enum
|
||||
{
|
||||
public enum ESchachtType
|
||||
{
|
||||
Hauptkanal,
|
||||
Revisionschacht
|
||||
}
|
||||
}
|
||||
@@ -50,7 +50,17 @@ namespace WWTech_KanalSchnittstelle.Importer
|
||||
{ "3310", EEntwaeserung.Regenwasser }
|
||||
};
|
||||
|
||||
if(!File.Exists(filename))
|
||||
Dictionary<string, ESchachtType> schachtKennung = new Dictionary<string, ESchachtType>()
|
||||
{
|
||||
{ "1100", ESchachtType.Hauptkanal },
|
||||
{ "1200", ESchachtType.Hauptkanal },
|
||||
{ "1300", ESchachtType.Hauptkanal },
|
||||
{ "3110", ESchachtType.Revisionschacht },
|
||||
{ "3210", ESchachtType.Revisionschacht },
|
||||
{ "3310", ESchachtType.Revisionschacht }
|
||||
};
|
||||
|
||||
if (!File.Exists(filename))
|
||||
{
|
||||
throw new FileNotFoundException(filename);
|
||||
}
|
||||
@@ -93,10 +103,12 @@ namespace WWTech_KanalSchnittstelle.Importer
|
||||
if (parsed.Length >= 4)
|
||||
{
|
||||
schacht.Entwaesserung = entwaesserungKennung[parsed[4]];
|
||||
schacht.SchachtType = schachtKennung[parsed[4]];
|
||||
}
|
||||
else
|
||||
{
|
||||
schacht.Entwaesserung = EEntwaeserung.Schmutzwasser;
|
||||
schacht.SchachtType = ESchachtType.Hauptkanal;
|
||||
}
|
||||
schacht.Projekt = projekt;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user