Grundlegene Funktionen geschrieben

This commit is contained in:
2023-06-09 15:53:11 +02:00
parent 2c4e8fb4cb
commit fd84775aa4
26 changed files with 721 additions and 4 deletions

View File

@@ -0,0 +1,39 @@
using dcnsanplanung.DAL.Services.PostgresqlData;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace dcnsanplanung.DAL.Helper
{
public class WriteToDatabase
{
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")
{
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;
}
public async Task<bool> WriteInHaltung()
{
string connectionstring = "Host = localhost; Database = sanplaner; Username = dcnsanplaner; Password = sanplaner";
HaltungDataService haltungDataService = new HaltungDataService(connectionstring);
await haltungDataService.InsertHaltungBulk(haltungen);
return true;
}
public async Task<bool> WriteInLV()
{
string connectionstring = "Host = localhost; Database = sanplaner; Username = dcnsanplaner; Password = sanplaner";
LVDataService lVDataService = new LVDataService(connectionstring);
await lVDataService.InsertLeistungsverzeichnisPositionBulk(LVPositionen);
return true;
}
}
}