This commit is contained in:
Christian
2019-09-17 17:44:57 +02:00
parent 1e5579a338
commit a896a7bfec
83 changed files with 10622 additions and 2812 deletions

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Configuration;
using System.IO;
using System.Linq;
@@ -5795,17 +5796,51 @@ namespace BeWo.Service.ServiceImplementations
{
try
{
var rawList = DAOFactory.GenericDAO.GetAll<Icf>().ToList();
string key = "2BT%eGprU\"E$!\"5Flq@l^^KZaYa\"u/icq@MMSWsy$XFo@#q3Arbnx@Plzv7s\\+$a";
string url = "https://support.bewoplaner.de/api/geticf.php?k=[TENANT]";
if (MultitenancyOperationContextExt.Current != null)
{
url = url.Replace("[TENANT]", MultitenancyOperationContextExt.Current.Tenant);
}
else
{
url = url.Replace("[TENANT]", SessionFacade.Tenant);
}
String json = "";
using (var client = new WebClient())
{
byte[] response = client.UploadValues(url, "POST", new NameValueCollection()
{
{"API-KEY", key}
});
json = System.Text.Encoding.ASCII.GetString(response);
}
//[{"Oid":"1","Code":"","Bezeichnung":"Kapitel 1: Lernen und Wissensanwendung","Beschreibung":"","ParentOID":""}
//var icfentry = new { Oid = 0, Code = "", Bezeichnung = "", Beschreibung = "", ParentOid = 0 };
var icfList = JsonConvert.DeserializeObject<List<Icf>>(json);
//var rawList = DAOFactory.GenericDAO.GetAll<Icf>().ToList();
var icfs = new List<ValueListEntryDC>
{
new ValueListEntryDC() {ParentOid = -1, TypeDescription = "ICF"}
};
icfs.AddRange(rawList.Select(x => new ValueListEntryDC()
icfs.AddRange(icfList.Select(x => new ValueListEntryDC()
{
ValueListEntryOid = x.Oid,
ParentOid = x.ParentID,
ParentOid = x.ParentOID,
TypeDescription = x.Bezeichnung,
Abbreviation = x.Code,
Notice = x.Beschreibung