Grundlegene Funktionen geschrieben
This commit is contained in:
39
dcnsanplanung.DAL/Helper/WriteToDatabase.cs
Normal file
39
dcnsanplanung.DAL/Helper/WriteToDatabase.cs
Normal 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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user