Update 07082021

This commit is contained in:
2021-08-07 09:44:37 +02:00
parent 1ff218a129
commit 4d443fdfd4
5663 changed files with 6581858 additions and 1321 deletions

View File

@@ -0,0 +1,110 @@
using System;
using System.Collections.Generic;
using System.Linq;
using BWPMModels;
using BlazorApp.Helper;
using Newtonsoft.Json;
using System.Data;
using Microsoft.AspNetCore.Mvc;
namespace BlazorApp.Controller
{
public class AnredeController : ControllerBase
{
public static List<Anrede> GetAllData()
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from Anrede", false, true);
return dbh.ConvertDataTable<Anrede>(dbh.dsdaten.Tables[0]);
}
public static List<Anrede> GetByID(int ID)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from Anrede where id=" + ID.ToString(), false, true);
return dbh.ConvertDataTable<Anrede>(dbh.dsdaten.Tables[0]);
}
public static List<Anrede> GetLast()
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select top 1 * from Anrede order by mutiert_am desc", false, true);
return dbh.ConvertDataTable<Anrede>(dbh.dsdaten.Tables[0]);
}
public static List<Anrede> GetLastByMutierer(string Mutierer)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select top 1 * from Anrede where mutierer='" + Mutierer + "' order by mutiert_am desc", false, true);
return dbh.ConvertDataTable<Anrede>(dbh.dsdaten.Tables[0]);
}
public static List<Anrede> GetbyUserSQL(string SQL)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata(SQL, false, true);
return dbh.ConvertDataTable<Anrede>(dbh.dsdaten.Tables[0]);
}
public static int POST(Anrede Anrededata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("Select top 1 * from [Anrede] where id=-1", false, true);
DataRow dr = dbh.dsdaten.Tables[0].NewRow();
Anrededata.GetType().GetProperties().ToList().ForEach(f =>
{
try
{
if (f.PropertyType == typeof(DateTime))
{
dr[f.Name] = (DateTime)f.GetValue(Anrededata, null);
}
else
{
dr[f.Name] = f.GetValue(Anrededata, null);
}
}
catch (Exception ex) { string s = ex.Message; }
});
dbh.dsdaten.Tables[0].Rows.Add(dr);
dbh.Update_Tabeldata();
List<Anrede> tmplst = GetLastByMutierer(Anrededata.mutierer);
return tmplst.First<Anrede>().ID;
}
public static void PUT(Anrede Anrededata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("Select top 1 * from [Anrede] where id=" + Anrededata.ID.ToString(), false, true);
DataRow dr = dbh.dsdaten.Tables[0].Rows[0];
Anrededata.GetType().GetProperties().ToList().ForEach(f =>
{
try
{
if (f.PropertyType == typeof(DateTime))
{
dr[f.Name] = (DateTime)f.GetValue(Anrededata, null);
}
else
{
dr[f.Name] = f.GetValue(Anrededata, null);
}
}
catch (Exception ex) { string s = ex.Message; }
});
dbh.Update_Tabeldata();
}
public static void DELETE(Anrede Anrededata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("delete from [Anrede] where id=" + Anrededata.ID.ToString(), false, true);
}
}
}

View File

@@ -1,39 +1,108 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using BWPMModels;
using BlazorApp.Helper;
using Newtonsoft.Json;
using System.Data;
using Microsoft.AspNetCore.Mvc;
namespace BlazorApp.Controller
{
public class AspNetRolesController
public class AspNetRolesController : ControllerBase
{
public static List<AspNetRoles> GetAllData()
{
Helper.HttpClientHelper httpcli = new Helper.HttpClientHelper();
httpcli.CallService("AspNetRoles", "", "GET", null);
return JsonConvert.DeserializeObject<List<AspNetRoles>>(httpcli.Results.daten);
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from AspNetRoles", false, true);
return dbh.ConvertDataTable<AspNetRoles>(dbh.dsdaten.Tables[0]);
}
public static void savedata(BWPMModels.AspNetRoles AspNetRolesdata)
public static List<AspNetRoles> GetByID(int ID)
{
Helper.HttpClientHelper httpcli = new Helper.HttpClientHelper();
httpcli.CallService("AspNetRoles", AspNetRolesdata.Id.ToString(), "PUT", AspNetRolesdata);
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from AspNetRoles where id=" + ID.ToString(), false, true);
return dbh.ConvertDataTable<AspNetRoles>(dbh.dsdaten.Tables[0]);
}
public static int InsertData(BWPMModels.AspNetRoles AspNetRolesdata)
public static List<AspNetRoles> GetLast()
{
Helper.HttpClientHelper httpcli = new Helper.HttpClientHelper();
httpcli.CallService("AspNetRoles", "", "POST", AspNetRolesdata);
List<BWPMModels.AspNetRoles> LastAspNetRoles = new List<BWPMModels.AspNetRoles>();
return 0;
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select top 1 * from AspNetRoles order by mutiert_am desc", false, true);
return dbh.ConvertDataTable<AspNetRoles>(dbh.dsdaten.Tables[0]);
}
public static List<AspNetRoles> GetLastByMutierer(string Mutierer)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select top 1 * from AspNetRoles where mutierer='" + Mutierer + "' order by mutiert_am desc", false, true);
return dbh.ConvertDataTable<AspNetRoles>(dbh.dsdaten.Tables[0]);
}
public static List<AspNetRoles> GetbyUserSQL(string SQL)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata(SQL, false, true);
return dbh.ConvertDataTable<AspNetRoles>(dbh.dsdaten.Tables[0]);
}
public static void POST(AspNetRoles AspNetRolesdata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("Select top 1 * from [AspNetRoles] where id=-1", false, true);
DataRow dr = dbh.dsdaten.Tables[0].NewRow();
AspNetRolesdata.GetType().GetProperties().ToList().ForEach(f =>
{
try
{
if (f.PropertyType == typeof(DateTime))
{
dr[f.Name] = (DateTime)f.GetValue(AspNetRolesdata, null);
}
else
{
dr[f.Name] = f.GetValue(AspNetRolesdata, null);
}
}
catch (Exception ex) { string s = ex.Message; }
});
dbh.dsdaten.Tables[0].Rows.Add(dr);
dbh.Update_Tabeldata();
}
public static void PUT(AspNetRoles AspNetRolesdata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("Select top 1 * from [AspNetRoles] where id=" + AspNetRolesdata.Id.ToString(), false, true);
DataRow dr = dbh.dsdaten.Tables[0].Rows[0];
AspNetRolesdata.GetType().GetProperties().ToList().ForEach(f =>
{
try
{
if (f.PropertyType == typeof(DateTime))
{
dr[f.Name] = (DateTime)f.GetValue(AspNetRolesdata, null);
}
else
{
dr[f.Name] = f.GetValue(AspNetRolesdata, null);
}
}
catch (Exception ex) { string s = ex.Message; }
});
dbh.Update_Tabeldata();
}
public static void DELETE(AspNetRoles AspNetRolesdata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("delete from [AspNetRoles] where id=" + AspNetRolesdata.Id.ToString(), false, true);
}
}
}
}

View File

@@ -1,49 +1,108 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using BWPMModels;
using BlazorApp.Helper;
using Newtonsoft.Json;
using System.Data;
using Microsoft.AspNetCore.Mvc;
namespace BlazorApp.Controller
{
public class AspNetUserRolesController
public class AspNetUserRolesController : ControllerBase
{
public static List<AspNetUserRoles> GetAllData()
{
Helper.HttpClientHelper httpcli = new Helper.HttpClientHelper();
httpcli.CallService("AspNetUserRoles", "", "GET", null);
return JsonConvert.DeserializeObject<List<BWPMModels.AspNetUserRoles>>(httpcli.Results.daten);
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from AspNetUserRoles", false, true);
return dbh.ConvertDataTable<AspNetUserRoles>(dbh.dsdaten.Tables[0]);
}
public static void savedata(BWPMModels.AspNetUserRoles AspNetUserRolesdata)
public static List<AspNetUserRoles> GetByID(int ID)
{
Helper.HttpClientHelper httpcli = new Helper.HttpClientHelper();
httpcli.CallService("AspNetUserRoles", AspNetUserRolesdata.UserId.ToString(), "PUT", AspNetUserRolesdata);
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from AspNetUserRoles where id=" + ID.ToString(), false, true);
return dbh.ConvertDataTable<AspNetUserRoles>(dbh.dsdaten.Tables[0]);
}
public static int InsertData(BWPMModels.AspNetUserRoles AspNetUserRolesdata)
public static List<AspNetUserRoles> GetLast()
{
Helper.HttpClientHelper httpcli = new Helper.HttpClientHelper();
httpcli.CallService("AspNetUserRoles", "", "POST", AspNetUserRolesdata);
List<BWPMModels.AspNetUserRoles> LastAspNetUserRoles = new List<AspNetUserRoles>();
return 0;
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select top 1 * from AspNetUserRoles order by mutiert_am desc", false, true);
return dbh.ConvertDataTable<AspNetUserRoles>(dbh.dsdaten.Tables[0]);
}
public static void deletdata(BWPMModels.AspNetUserRoles aspNetUserRolesData)
public static List<AspNetUserRoles> GetLastByMutierer(string Mutierer)
{
Helper.HttpClientHelper httpcli = new Helper.HttpClientHelper();
httpcli.CallService("AspNetUserRoles", "", "DELETE", aspNetUserRolesData);
List<BWPMModels.AspNetUserRoles> LastAspNetUserRoles = new List<AspNetUserRoles>();
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select top 1 * from AspNetUserRoles where mutierer='" + Mutierer + "' order by mutiert_am desc", false, true);
return dbh.ConvertDataTable<AspNetUserRoles>(dbh.dsdaten.Tables[0]);
}
public static List<AspNetUserRoles> GetbyUserSQL(string SQL)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata(SQL, false, true);
return dbh.ConvertDataTable<AspNetUserRoles>(dbh.dsdaten.Tables[0]);
}
public static void POST(AspNetUserRoles AspNetUserRolesdata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("Select top 1 * from [AspNetUserRoles] where id=-1", false, true);
DataRow dr = dbh.dsdaten.Tables[0].NewRow();
AspNetUserRolesdata.GetType().GetProperties().ToList().ForEach(f =>
{
try
{
if (f.PropertyType == typeof(DateTime))
{
dr[f.Name] = (DateTime)f.GetValue(AspNetUserRolesdata, null);
}
else
{
dr[f.Name] = f.GetValue(AspNetUserRolesdata, null);
}
}
catch (Exception ex) { string s = ex.Message; }
});
dbh.dsdaten.Tables[0].Rows.Add(dr);
dbh.Update_Tabeldata();
}
public static void PUT(AspNetUserRoles AspNetUserRolesdata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("Select top 1 * from [AspNetUserRoles] where userid='" + AspNetUserRolesdata.UserId.ToString()+"'", false, true);
DataRow dr = dbh.dsdaten.Tables[0].Rows[0];
AspNetUserRolesdata.GetType().GetProperties().ToList().ForEach(f =>
{
try
{
if (f.PropertyType == typeof(DateTime))
{
dr[f.Name] = (DateTime)f.GetValue(AspNetUserRolesdata, null);
}
else
{
dr[f.Name] = f.GetValue(AspNetUserRolesdata, null);
}
}
catch (Exception ex) { string s = ex.Message; }
});
dbh.Update_Tabeldata();
}
public static void DELETE(AspNetUserRoles AspNetUserRolesdata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("delete from [AspNetUserRoles] where id=" + AspNetUserRolesdata.UserId.ToString(), false, true);
}
}
}
}

View File

@@ -1,37 +1,121 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using BWPMModels;
using BlazorApp.Helper;
using Newtonsoft.Json;
using System.Data;
using Microsoft.AspNetCore.Mvc;
namespace BlazorApp.Controller
{
public class AspNetUserRolleController
public class AspNetUserRolleController : ControllerBase
{
public static List<AspNetUserRolle> GetAllData()
{
Helper.HttpClientHelper httpcli = new Helper.HttpClientHelper();
httpcli.CallService("AspNetUserRolle", "", "GET", null);
return JsonConvert.DeserializeObject<List<AspNetUserRolle>>(httpcli.Results.daten);
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from AspNetUserRolle", false, true);
return dbh.ConvertDataTable<AspNetUserRolle>(dbh.dsdaten.Tables[0]);
}
public static void savedata(AspNetUserRolle AspNetUserRolledata)
public static List<AspNetUserRolle> GetByID(int ID)
{
Helper.HttpClientHelper httpcli = new Helper.HttpClientHelper();
httpcli.CallService("AspNetUserRolle", AspNetUserRolledata.Id.ToString(), "PUT", AspNetUserRolledata);
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from AspNetUserRolle where id=" + ID.ToString(), false, true);
return dbh.ConvertDataTable<AspNetUserRolle>(dbh.dsdaten.Tables[0]);
}
public static void savepassword(BWPMModels.AspNetUsers userdata)
public static List<AspNetUserRolle> GetLast()
{
Helper.HttpClientHelper httpcli = new Helper.HttpClientHelper();
httpcli.CallService("AspNetUserRolle", "changepassword/" + userdata.Id, "PUT", userdata);
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select top 1 * from AspNetUserRolle order by mutiert_am desc", false, true);
return dbh.ConvertDataTable<AspNetUserRolle>(dbh.dsdaten.Tables[0]);
}
public static List<AspNetUserRolle> GetLastByMutierer(string Mutierer)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select top 1 * from AspNetUserRolle where mutierer='" + Mutierer + "' order by mutiert_am desc", false, true);
return dbh.ConvertDataTable<AspNetUserRolle>(dbh.dsdaten.Tables[0]);
}
public static List<AspNetUserRolle> GetbyUserSQL(string SQL)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata(SQL, false, true);
return dbh.ConvertDataTable<AspNetUserRolle>(dbh.dsdaten.Tables[0]);
}
public static void POST(AspNetUserRolle AspNetUserRolledata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("Select top 1 * from [AspNetUserRolle] where id=-1", false, true);
DataRow dr = dbh.dsdaten.Tables[0].NewRow();
AspNetUserRolledata.GetType().GetProperties().ToList().ForEach(f =>
{
try
{
if (f.PropertyType == typeof(DateTime))
{
dr[f.Name] = (DateTime)f.GetValue(AspNetUserRolledata, null);
}
else
{
dr[f.Name] = f.GetValue(AspNetUserRolledata, null);
}
}
catch (Exception ex) { string s = ex.Message; }
});
dbh.dsdaten.Tables[0].Rows.Add(dr);
dbh.Update_Tabeldata();
}
public static void PUT(AspNetUserRolle AspNetUserRolledata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("Select top 1 * from [AspNetUserRolle] where id=" + AspNetUserRolledata.Id.ToString(), false, true);
DataRow dr = dbh.dsdaten.Tables[0].Rows[0];
AspNetUserRolledata.GetType().GetProperties().ToList().ForEach(f =>
{
try
{
if (f.PropertyType == typeof(DateTime))
{
dr[f.Name] = (DateTime)f.GetValue(AspNetUserRolledata, null);
}
else
{
dr[f.Name] = f.GetValue(AspNetUserRolledata, null);
}
}
catch (Exception ex) { string s = ex.Message; }
});
dbh.Update_Tabeldata();
}
public static void PUTPassword(AspNetUsers aspNetUser)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("Select top 1 * from [AspNetUsers] where id='" +aspNetUser.Id + "'", false, true);
DataRow dr = dbh.dsdaten.Tables[0].Rows[0];
dr["PasswordHash"] = aspNetUser.PasswordHash;
dbh.Update_Tabeldata();
}
public static void DELETE(AspNetUserRolle AspNetUserRolledata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("delete from [AspNetUserRolle] where id=" + AspNetUserRolledata.Id.ToString(), false, true);
}
}
}
}

View File

@@ -1,32 +1,109 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using BWPMModels;
using BlazorApp.Helper;
using Newtonsoft.Json;
using System.Data;
using Microsoft.AspNetCore.Mvc;
namespace BlazorApp.Controller
{
public class AspNetUsersController
public class AspNetUsersController : ControllerBase
{
public static List<AspNetUsers> GetAllData()
{
Helper.HttpClientHelper httpcli = new Helper.HttpClientHelper();
httpcli.CallService("AspNetUsers", "", "GET", null);
return JsonConvert.DeserializeObject<List<AspNetUsers>>(httpcli.Results.daten);
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from AspNetUsers", false, true);
return dbh.ConvertDataTable<AspNetUsers>(dbh.dsdaten.Tables[0]);
}
public static void savedata(AspNetUsers AspNetUsersdata)
public static List<AspNetUsers> GetByID(int ID)
{
Helper.HttpClientHelper httpcli = new Helper.HttpClientHelper();
httpcli.CallService("AspNetUsers", AspNetUsersdata.Id.ToString(), "PUT", AspNetUsersdata);
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from AspNetUsers where id=" + ID.ToString(), false, true);
return dbh.ConvertDataTable<AspNetUsers>(dbh.dsdaten.Tables[0]);
}
public static List<AspNetUsers> GetLast()
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select top 1 * from AspNetUsers order by mutiert_am desc", false, true);
return dbh.ConvertDataTable<AspNetUsers>(dbh.dsdaten.Tables[0]);
}
public static List<AspNetUsers> GetLastByMutierer(string Mutierer)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select top 1 * from AspNetUsers where mutierer='" + Mutierer + "' order by mutiert_am desc", false, true);
return dbh.ConvertDataTable<AspNetUsers>(dbh.dsdaten.Tables[0]);
}
public static List<AspNetUsers> GetbyUserSQL(string SQL)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata(SQL, false, true);
return dbh.ConvertDataTable<AspNetUsers>(dbh.dsdaten.Tables[0]);
}
public static void POST(AspNetUsers AspNetUsersdata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("Select top 1 * from [AspNetUsers] where id=-1", false, true);
DataRow dr = dbh.dsdaten.Tables[0].NewRow();
AspNetUsersdata.GetType().GetProperties().ToList().ForEach(f =>
{
try
{
if (f.PropertyType == typeof(DateTime))
{
dr[f.Name] = (DateTime)f.GetValue(AspNetUsersdata, null);
}
else
{
dr[f.Name] = f.GetValue(AspNetUsersdata, null);
}
}
catch (Exception ex) { string s = ex.Message; }
});
dbh.dsdaten.Tables[0].Rows.Add(dr);
dbh.Update_Tabeldata();
}
public static void PUT(AspNetUsers AspNetUsersdata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("Select top 1 * from [AspNetUsers] where id=" + AspNetUsersdata.Id.ToString(), false, true);
DataRow dr = dbh.dsdaten.Tables[0].Rows[0];
AspNetUsersdata.GetType().GetProperties().ToList().ForEach(f =>
{
try
{
if (f.PropertyType == typeof(DateTime))
{
dr[f.Name] = (DateTime)f.GetValue(AspNetUsersdata, null);
}
else
{
dr[f.Name] = f.GetValue(AspNetUsersdata, null);
}
}
catch (Exception ex) { string s = ex.Message; }
});
dbh.Update_Tabeldata();
}
public static void DELETE(AspNetUsers AspNetUsersdata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("delete from [AspNetUsers] where id=" + AspNetUsersdata.Id.ToString(), false, true);
}
}
}
}

View File

@@ -1,47 +1,117 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using BWPMModels;
using BlazorApp.Helper;
using Newtonsoft.Json;
using System.Data;
using Microsoft.AspNetCore.Mvc;
namespace BlazorApp.Controller
{
public class BerufController
public class BerufController : ControllerBase
{
public static List<Beruf> GetAllData()
{
Helper.HttpClientHelper httpcli = new Helper.HttpClientHelper();
httpcli.CallService("Beruf", "", "GET", null);
return JsonConvert.DeserializeObject<List<Beruf>>(httpcli.Results.daten);
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from Beruf", false, true);
return dbh.ConvertDataTable<Beruf>(dbh.dsdaten.Tables[0]);
}
public static void savedata(Beruf Berufdata)
public static List<Beruf> GetAllAktiveData()
{
Helper.HttpClientHelper httpcli = new Helper.HttpClientHelper();
httpcli.CallService("Beruf", Berufdata.ID.ToString(), "PUT", Berufdata);
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from Beruf where aktiv=1 order by bezeichnung", false, true);
return dbh.ConvertDataTable<Beruf>(dbh.dsdaten.Tables[0]);
}
public static int InsertData(Beruf Berufdata)
public static List<Beruf> GetByID(int ID)
{
Helper.HttpClientHelper httpcli = new Helper.HttpClientHelper();
httpcli.CallService("Beruf", "", "POST", Berufdata);
List<BWPMModels.Beruf> LastBeruf = new List<Beruf>();
LastBeruf = GetLast(Berufdata);
return LastBeruf.First<Beruf>().ID;
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from Beruf where id=" + ID.ToString(), false, true);
return dbh.ConvertDataTable<Beruf>(dbh.dsdaten.Tables[0]);
}
public static List<Beruf> GetLast(Beruf Berufdata)
public static List<Beruf> GetLast()
{
Helper.HttpClientHelper httpcli = new Helper.HttpClientHelper();
string sql = "Select top 1 * from Beruf where mutierer='" + Berufdata.mutierer + "' order by erstellt_am desc";
httpcli.CallService("Beruf", "usersql/" + sql, "GET", Berufdata);
return JsonConvert.DeserializeObject<List<Beruf>>(httpcli.Results.daten);
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select top 1 * from Beruf order by mutiert_am desc", false, true);
return dbh.ConvertDataTable<Beruf>(dbh.dsdaten.Tables[0]);
}
public static List<Beruf> GetLastByMutierer(string Mutierer)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select top 1 * from Beruf where mutierer='" + Mutierer + "' order by mutiert_am desc", false, true);
return dbh.ConvertDataTable<Beruf>(dbh.dsdaten.Tables[0]);
}
public static List<Beruf> GetbyUserSQL(string SQL)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata(SQL, false, true);
return dbh.ConvertDataTable<Beruf>(dbh.dsdaten.Tables[0]);
}
public static int POST(Beruf Berufdata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("Select top 1 * from [Beruf] where id=-1", false, true);
DataRow dr = dbh.dsdaten.Tables[0].NewRow();
Berufdata.GetType().GetProperties().ToList().ForEach(f =>
{
try
{
if (f.PropertyType == typeof(DateTime))
{
dr[f.Name] = (DateTime)f.GetValue(Berufdata, null);
}
else
{
dr[f.Name] = f.GetValue(Berufdata, null);
}
}
catch (Exception ex) { string s = ex.Message; }
});
dbh.dsdaten.Tables[0].Rows.Add(dr);
dbh.Update_Tabeldata();
List<Beruf> tmplst = GetLastByMutierer(Berufdata.mutierer);
return tmplst.First<Beruf>().ID;
}
public static void PUT(Beruf Berufdata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("Select top 1 * from [Beruf] where id=" + Berufdata.ID.ToString(), false, true);
DataRow dr = dbh.dsdaten.Tables[0].Rows[0];
Berufdata.GetType().GetProperties().ToList().ForEach(f =>
{
try
{
if (f.PropertyType == typeof(DateTime))
{
dr[f.Name] = (DateTime)f.GetValue(Berufdata, null);
}
else
{
dr[f.Name] = f.GetValue(Berufdata, null);
}
}
catch (Exception ex) { string s = ex.Message; }
});
dbh.Update_Tabeldata();
}
public static void DELETE(Beruf Berufdata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("delete from [Beruf] where id=" + Berufdata.ID.ToString(), false, true);
}
}
}
}

View File

@@ -0,0 +1,135 @@
using System;
using System.Collections.Generic;
using System.Linq;
using BWPMModels;
using BlazorApp.Helper;
using Newtonsoft.Json;
using System.Data;
using Microsoft.AspNetCore.Mvc;
namespace BlazorApp.Controller
{
public class AnsprechpartnerController : ControllerBase
{
public static List<Ansprechpartner> GetAllData()
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from Ansprechpartner", false, true);
return dbh.ConvertDataTable<Ansprechpartner>(dbh.dsdaten.Tables[0]);
}
public static List<ViewAnsprechpartner> GetAllAktivData()
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("SELECT ID, FirmaID, name + ' ' + vorname AS Ansprechpartner FROM dbo.Ansprechpartner WHERE aktiv = 1 ORDER BY Ansprechpartner", false, true);
return dbh.ConvertDataTable<ViewAnsprechpartner>(dbh.dsdaten.Tables[0]);
}
public static List<Ansprechpartner> GetByID(int ID)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from Ansprechpartner where id=" + ID.ToString(), false, true);
return dbh.ConvertDataTable<Ansprechpartner>(dbh.dsdaten.Tables[0]);
}
public static List<Ansprechpartner> GetByFirmaID(int ID)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from Ansprechpartner where aktiv=1 and firmaid=" + ID.ToString(), false, true);
return dbh.ConvertDataTable<Ansprechpartner>(dbh.dsdaten.Tables[0]);
}
public static List<Ansprechpartner> GetAllAktivDataByFirmaID(int firmaid)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("SELECT * from Ansprechpartner WHERE aktiv = 1 and firmaid=" + firmaid.ToString() + " ORDER BY Name, Vorname", false, true);
return dbh.ConvertDataTable<Ansprechpartner>(dbh.dsdaten.Tables[0]);
}
public static List<Ansprechpartner> GetLast()
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select top 1 * from Ansprechpartner order by mutiert_am desc", false, true);
return dbh.ConvertDataTable<Ansprechpartner>(dbh.dsdaten.Tables[0]);
}
public static List<Ansprechpartner> GetLastByMutierer(string Mutierer)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select top 1 * from Ansprechpartner where mutierer='" + Mutierer + "' order by mutiert_am desc", false, true);
return dbh.ConvertDataTable<Ansprechpartner>(dbh.dsdaten.Tables[0]);
}
public static List<Ansprechpartner> GetbyUserSQL(string SQL)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata(SQL, false, true);
return dbh.ConvertDataTable<Ansprechpartner>(dbh.dsdaten.Tables[0]);
}
public static int POST(Ansprechpartner Ansprechpartnerdata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("Select top 1 * from [Ansprechpartner] where id=-1", false, true);
DataRow dr = dbh.dsdaten.Tables[0].NewRow();
Ansprechpartnerdata.GetType().GetProperties().ToList().ForEach(f =>
{
try
{
if (f.PropertyType == typeof(DateTime))
{
dr[f.Name] = (DateTime)f.GetValue(Ansprechpartnerdata, null);
}
else
{
dr[f.Name] = f.GetValue(Ansprechpartnerdata, null);
}
}
catch (Exception ex) { string s = ex.Message; }
});
dbh.dsdaten.Tables[0].Rows.Add(dr);
dbh.Update_Tabeldata();
List<Ansprechpartner> tmplst = GetLastByMutierer(Ansprechpartnerdata.mutierer);
return tmplst.First<Ansprechpartner>().ID;
}
public static void PUT(Ansprechpartner Ansprechpartnerdata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("Select top 1 * from [Ansprechpartner] where id=" + Ansprechpartnerdata.ID.ToString(), false, true);
DataRow dr = dbh.dsdaten.Tables[0].Rows[0];
Ansprechpartnerdata.GetType().GetProperties().ToList().ForEach(f =>
{
try
{
if (f.PropertyType == typeof(DateTime))
{
dr[f.Name] = (DateTime)f.GetValue(Ansprechpartnerdata, null);
}
else
{
dr[f.Name] = f.GetValue(Ansprechpartnerdata, null);
}
}
catch (Exception ex) { string s = ex.Message; }
});
dbh.Update_Tabeldata();
}
public static void DELETE(Ansprechpartner Ansprechpartnerdata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("delete from [Ansprechpartner] where id=" + Ansprechpartnerdata.ID.ToString(), false, true);
}
}
public class ViewAnsprechpartner
{
}
}

View File

@@ -0,0 +1,131 @@
using System;
using System.Collections.Generic;
using System.Linq;
using BWPMModels;
using BlazorApp.Helper;
using Newtonsoft.Json;
using System.Data;
using Microsoft.AspNetCore.Mvc;
namespace BlazorApp.Controller
{
public class FirmaController : ControllerBase
{
public static List<Firma> GetAllData()
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from Firma", false, true);
return dbh.ConvertDataTable<Firma>(dbh.dsdaten.Tables[0]);
}
public static List<Firma> GetByID(int ID)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from Firma where id=" + ID.ToString(), false, true);
return dbh.ConvertDataTable<Firma>(dbh.dsdaten.Tables[0]);
}
public static List<Firma> GetLast()
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select top 1 * from Firma order by mutiert_am desc", false, true);
return dbh.ConvertDataTable<Firma>(dbh.dsdaten.Tables[0]);
}
public static List<Firma> GetLastByMutierer(string Mutierer)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select top 1 * from Firma where mutierer='" + Mutierer + "' order by mutiert_am desc", false, true);
return dbh.ConvertDataTable<Firma>(dbh.dsdaten.Tables[0]);
}
public static List<Firma> GetbyUserSQL(string SQL)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata(SQL, false, true);
return dbh.ConvertDataTable<Firma>(dbh.dsdaten.Tables[0]);
}
public static List<Firma> GetByUserID(string UserID)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from Firma where userid='" + UserID + "'", false, true);
if (dbh.dsdaten.Tables[0].Rows.Count==0)
{
Firma Firmadata = new Firma();
Firmadata.aktiv = true;
Firmadata.erstellt_am = DateTime.Now;
Firmadata.mutierer = UserID;
Firmadata.mutiert_am = DateTime.Now;
Firmadata.userid = UserID;
POST(Firmadata);
dbh.Get_Tabledata("Select * from Firma where userid='" + UserID + "'", false, true);
}
return dbh.ConvertDataTable<Firma>(dbh.dsdaten.Tables[0]);
}
public static int POST(Firma Firmadata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("Select top 1 * from [Firma] where id=-1", false, true);
DataRow dr = dbh.dsdaten.Tables[0].NewRow();
Firmadata.GetType().GetProperties().ToList().ForEach(f =>
{
try
{
if (f.PropertyType == typeof(DateTime))
{
dr[f.Name] = (DateTime)f.GetValue(Firmadata, null);
}
else
{
dr[f.Name] = f.GetValue(Firmadata, null);
}
}
catch (Exception ex) { string s = ex.Message; }
});
dbh.dsdaten.Tables[0].Rows.Add(dr);
dbh.Update_Tabeldata();
List<Firma> tmplst = GetLastByMutierer(Firmadata.mutierer);
return tmplst.First<Firma>().ID;
}
public static void PUT(Firma Firmadata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("Select top 1 * from [Firma] where id=" + Firmadata.ID.ToString(), false, true);
DataRow dr = dbh.dsdaten.Tables[0].Rows[0];
Firmadata.GetType().GetProperties().ToList().ForEach(f =>
{
try
{
if (f.PropertyType == typeof(DateTime))
{
dr[f.Name] = (DateTime)f.GetValue(Firmadata, null);
}
else
{
dr[f.Name] = f.GetValue(Firmadata, null);
}
}
catch (Exception ex) { string s = ex.Message; }
});
dbh.Update_Tabeldata();
}
public static void DELETE(Firma Firmadata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("delete from [Firma] where id=" + Firmadata.ID.ToString(), false, true);
}
}
}

View File

@@ -0,0 +1,116 @@
using System;
using System.Collections.Generic;
using System.Linq;
using BWPMModels;
using BlazorApp.Helper;
using Newtonsoft.Json;
using System.Data;
using Microsoft.AspNetCore.Mvc;
namespace BlazorApp.Controller
{
public class FirmaberufController : ControllerBase
{
public static List<Firmaberuf> GetAllData()
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from Firmaberuf", false, true);
return dbh.ConvertDataTable<Firmaberuf>(dbh.dsdaten.Tables[0]);
}
public static List<Firmaberuf> GetByID(int ID)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from Firmaberuf where id=" + ID.ToString(), false, true);
return dbh.ConvertDataTable<Firmaberuf>(dbh.dsdaten.Tables[0]);
}
public static List<Firmaberuf> GetAllAktiveByFirmaID(int ID)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from Firmaberuf where aktiv=1 and firmaid=" + ID.ToString(), false, true);
return dbh.ConvertDataTable<Firmaberuf>(dbh.dsdaten.Tables[0]);
}
public static List<Firmaberuf> GetLast()
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select top 1 * from Firmaberuf order by mutiert_am desc", false, true);
return dbh.ConvertDataTable<Firmaberuf>(dbh.dsdaten.Tables[0]);
}
public static List<Firmaberuf> GetLastByMutierer(string Mutierer)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select top 1 * from Firmaberuf where mutierer='" + Mutierer + "' order by mutiert_am desc", false, true);
return dbh.ConvertDataTable<Firmaberuf>(dbh.dsdaten.Tables[0]);
}
public static List<Firmaberuf> GetbyUserSQL(string SQL)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata(SQL, false, true);
return dbh.ConvertDataTable<Firmaberuf>(dbh.dsdaten.Tables[0]);
}
public static int POST(Firmaberuf Firmaberufdata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("Select top 1 * from [Firmaberuf] where id=-1", false, true);
DataRow dr = dbh.dsdaten.Tables[0].NewRow();
Firmaberufdata.GetType().GetProperties().ToList().ForEach(f =>
{
try
{
if (f.PropertyType == typeof(DateTime))
{
dr[f.Name] = (DateTime)f.GetValue(Firmaberufdata, null);
}
else
{
dr[f.Name] = f.GetValue(Firmaberufdata, null);
}
}
catch (Exception ex) { string s = ex.Message; }
});
dbh.dsdaten.Tables[0].Rows.Add(dr);
dbh.Update_Tabeldata();
List<Firmaberuf> tmplst = GetLastByMutierer(Firmaberufdata.mutierer);
return tmplst.First<Firmaberuf>().ID;
}
public static void PUT(Firmaberuf Firmaberufdata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("Select top 1 * from [Firmaberuf] where id=" + Firmaberufdata.ID.ToString(), false, true);
DataRow dr = dbh.dsdaten.Tables[0].Rows[0];
Firmaberufdata.GetType().GetProperties().ToList().ForEach(f =>
{
try
{
if (f.PropertyType == typeof(DateTime))
{
dr[f.Name] = (DateTime)f.GetValue(Firmaberufdata, null);
}
else
{
dr[f.Name] = f.GetValue(Firmaberufdata, null);
}
}
catch (Exception ex) { string s = ex.Message; }
});
dbh.Update_Tabeldata();
}
public static void DELETE(Firmaberuf Firmaberufdata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("delete from [Firmaberuf] where id=" + Firmaberufdata.ID.ToString(), false, true);
}
}
}

View File

@@ -0,0 +1,118 @@
using System;
using System.Collections.Generic;
using System.Linq;
using BWPMModels;
using BlazorApp.Helper;
using Newtonsoft.Json;
using System.Data;
using Microsoft.AspNetCore.Mvc;
namespace BlazorApp.Controller
{
public class KlasseController : ControllerBase
{
public static List<Klasse> GetAllData()
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from Klasse", false, true);
return dbh.ConvertDataTable<Klasse>(dbh.dsdaten.Tables[0]);
}
public static List<Klasse> GetByID(int ID)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from Klasse where id=" + ID.ToString(), false, true);
return dbh.ConvertDataTable<Klasse>(dbh.dsdaten.Tables[0]);
}
public static List<Klasse> GetByLehrerID(int ID)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from Klasse where lehrerid=" + ID.ToString(), false, true);
return dbh.ConvertDataTable<Klasse>(dbh.dsdaten.Tables[0]);
}
public static List<Klasse> GetLast()
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select top 1 * from Klasse order by mutiert_am desc", false, true);
return dbh.ConvertDataTable<Klasse>(dbh.dsdaten.Tables[0]);
}
public static List<Klasse> GetLastByMutierer(string Mutierer)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select top 1 * from Klasse where mutierer='" + Mutierer + "' order by mutiert_am desc", false, true);
return dbh.ConvertDataTable<Klasse>(dbh.dsdaten.Tables[0]);
}
public static List<Klasse> GetbyUserSQL(string SQL)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata(SQL, false, true);
return dbh.ConvertDataTable<Klasse>(dbh.dsdaten.Tables[0]);
}
public static int POST(Klasse Klassedata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("Select top 1 * from [Klasse] where id=-1", false, true);
DataRow dr = dbh.dsdaten.Tables[0].NewRow();
Klassedata.GetType().GetProperties().ToList().ForEach(f =>
{
try
{
if (f.PropertyType == typeof(DateTime))
{
dr[f.Name] = (DateTime)f.GetValue(Klassedata, null);
}
else
{
dr[f.Name] = f.GetValue(Klassedata, null);
}
}
catch (Exception ex) { string s = ex.Message; }
});
dbh.dsdaten.Tables[0].Rows.Add(dr);
dbh.Update_Tabeldata();
List<Klasse> tmplst = GetLastByMutierer(Klassedata.mutierer);
return tmplst.First<Klasse>().ID;
}
public static void PUT(Klasse Klassedata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("Select top 1 * from [Klasse] where id=" + Klassedata.ID.ToString(), false, true);
DataRow dr = dbh.dsdaten.Tables[0].Rows[0];
Klassedata.GetType().GetProperties().ToList().ForEach(f =>
{
try
{
if (f.PropertyType == typeof(DateTime))
{
dr[f.Name] = (DateTime)f.GetValue(Klassedata, null);
}
else
{
dr[f.Name] = f.GetValue(Klassedata, null);
}
}
catch (Exception ex) { string s = ex.Message; }
});
dbh.Update_Tabeldata();
}
public static void DELETE(Klasse Klassedata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("delete from [Klasse] where id=" + Klassedata.ID.ToString(), false, true);
}
}
}

View File

@@ -0,0 +1,114 @@
using System;
using System.Collections.Generic;
using System.Linq;
using BWPMModels;
using BlazorApp.Helper;
using Newtonsoft.Json;
using System.Data;
using Microsoft.AspNetCore.Mvc;
namespace BlazorApp.Controller
{
public class KlassentypController : ControllerBase
{
public static List<Klassentyp> GetAllData()
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from Klassentyp", false, true);
return dbh.ConvertDataTable<Klassentyp>(dbh.dsdaten.Tables[0]);
}
public static List<Klassentyp> GetAllAktiveData()
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from Klassentyp where aktiv=1", false, true);
return dbh.ConvertDataTable<Klassentyp>(dbh.dsdaten.Tables[0]);
}
public static List<Klassentyp> GetByID(int ID)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from Klassentyp where id=" + ID.ToString(), false, true);
return dbh.ConvertDataTable<Klassentyp>(dbh.dsdaten.Tables[0]);
}
public static List<Klassentyp> GetLast()
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select top 1 * from Klassentyp order by mutiert_am desc", false, true);
return dbh.ConvertDataTable<Klassentyp>(dbh.dsdaten.Tables[0]);
}
public static List<Klassentyp> GetLastByMutierer(string Mutierer)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select top 1 * from Klassentyp where mutierer='" + Mutierer + "' order by mutiert_am desc", false, true);
return dbh.ConvertDataTable<Klassentyp>(dbh.dsdaten.Tables[0]);
}
public static List<Klassentyp> GetbyUserSQL(string SQL)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata(SQL, false, true);
return dbh.ConvertDataTable<Klassentyp>(dbh.dsdaten.Tables[0]);
}
public static int POST(Klassentyp Klassentypdata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("Select top 1 * from [Klassentyp] where id=-1", false, true);
DataRow dr = dbh.dsdaten.Tables[0].NewRow();
Klassentypdata.GetType().GetProperties().ToList().ForEach(f =>
{
try
{
if (f.PropertyType == typeof(DateTime))
{
dr[f.Name] = (DateTime)f.GetValue(Klassentypdata, null);
}
else
{
dr[f.Name] = f.GetValue(Klassentypdata, null);
}
}
catch (Exception ex) { string s = ex.Message; }
});
dbh.dsdaten.Tables[0].Rows.Add(dr);
dbh.Update_Tabeldata();
List<Klassentyp> tmplst = GetLastByMutierer(Klassentypdata.mutierer);
return tmplst.First<Klassentyp>().ID;
}
public static void PUT(Klassentyp Klassentypdata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("Select top 1 * from [Klassentyp] where id=" + Klassentypdata.ID.ToString(), false, true);
DataRow dr = dbh.dsdaten.Tables[0].Rows[0];
Klassentypdata.GetType().GetProperties().ToList().ForEach(f =>
{
try
{
if (f.PropertyType == typeof(DateTime))
{
dr[f.Name] = (DateTime)f.GetValue(Klassentypdata, null);
}
else
{
dr[f.Name] = f.GetValue(Klassentypdata, null);
}
}
catch (Exception ex) { string s = ex.Message; }
});
dbh.Update_Tabeldata();
}
public static void DELETE(Klassentyp Klassentypdata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("delete from [Klassentyp] where id=" + Klassentypdata.ID.ToString(), false, true);
}
}
}

View File

@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using BWPMModels;
using BlazorApp.Helper;
using Newtonsoft.Json;
namespace BlazorApp.Controller
{
public class MyScriptController
{
public static List<MyScriptGenerator> GetAllData()
{
Helper.HttpClientHelper httpcli = new Helper.HttpClientHelper();
httpcli.CallService("Optionen", "", "GET", null);
return JsonConvert.DeserializeObject<List<MyScriptGenerator>>(httpcli.Results.daten);
}
public static List<MyScriptGenerator> GetData(int fnkt, string tablename)
{
Helper.HttpClientHelper httpcli = new Helper.HttpClientHelper();
httpcli.CallService("MyScript", fnkt.ToString()+","+tablename+"", "GET", null);
return JsonConvert.DeserializeObject<List<MyScriptGenerator>>(httpcli.Results.daten);
}
}
}

View File

@@ -0,0 +1,13 @@
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace BlazorApp.Controller
{
public class NewAnredeController : ControllerBase
{
}
}

View File

@@ -0,0 +1,110 @@
using System;
using System.Collections.Generic;
using System.Linq;
using BWPMModels;
using BlazorApp.Helper;
using Newtonsoft.Json;
using System.Data;
using Microsoft.AspNetCore.Mvc;
namespace BlazorApp.Controller
{
public class OptionenController : ControllerBase
{
public static List<Optionen> GetAllData()
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from Optionen", false, true);
return dbh.ConvertDataTable<Optionen>(dbh.dsdaten.Tables[0]);
}
public static List<Optionen> GetByID(int ID)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from Optionen where id=" + ID.ToString(), false, true);
return dbh.ConvertDataTable<Optionen>(dbh.dsdaten.Tables[0]);
}
public static List<Optionen> GetLast()
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select top 1 * from Optionen order by mutiert_am desc", false, true);
return dbh.ConvertDataTable<Optionen>(dbh.dsdaten.Tables[0]);
}
public static List<Optionen> GetLastByMutierer(string Mutierer)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select top 1 * from Optionen where mutierer='" + Mutierer + "' order by mutiert_am desc", false, true);
return dbh.ConvertDataTable<Optionen>(dbh.dsdaten.Tables[0]);
}
public static List<Optionen> GetbyUserSQL(string SQL)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata(SQL, false, true);
return dbh.ConvertDataTable<Optionen>(dbh.dsdaten.Tables[0]);
}
public static int POST(Optionen Optionendata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("Select top 1 * from [Optionen] where id=-1", false, true);
DataRow dr = dbh.dsdaten.Tables[0].NewRow();
Optionendata.GetType().GetProperties().ToList().ForEach(f =>
{
try
{
if (f.PropertyType == typeof(DateTime))
{
dr[f.Name] = (DateTime)f.GetValue(Optionendata, null);
}
else
{
dr[f.Name] = f.GetValue(Optionendata, null);
}
}
catch (Exception ex) { string s = ex.Message; }
});
dbh.dsdaten.Tables[0].Rows.Add(dr);
dbh.Update_Tabeldata();
List<Optionen> tmplst = GetLastByMutierer(Optionendata.mutierer);
return tmplst.First<Optionen>().ID;
}
public static void PUT(Optionen Optionendata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("Select top 1 * from [Optionen] where id=" + Optionendata.ID.ToString(), false, true);
DataRow dr = dbh.dsdaten.Tables[0].Rows[0];
Optionendata.GetType().GetProperties().ToList().ForEach(f =>
{
try
{
if (f.PropertyType == typeof(DateTime))
{
dr[f.Name] = (DateTime)f.GetValue(Optionendata, null);
}
else
{
dr[f.Name] = f.GetValue(Optionendata, null);
}
}
catch (Exception ex) { string s = ex.Message; }
});
dbh.Update_Tabeldata();
}
public static void DELETE(Optionen Optionendata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("delete from [Optionen] where id=" + Optionendata.ID.ToString(), false, true);
}
}
}

View File

@@ -1,47 +1,110 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using BWPMModels;
using BlazorApp.Helper;
using Newtonsoft.Json;
using System.Data;
using Microsoft.AspNetCore.Mvc;
namespace BlazorApp.Controller
{
public class SchulhausController
public class SchulhausController : ControllerBase
{
public static List<Schulhaus> GetAllData()
{
Helper.HttpClientHelper httpcli = new Helper.HttpClientHelper();
httpcli.CallService("Schulhaus", "", "GET", null);
return JsonConvert.DeserializeObject<List<Schulhaus>>(httpcli.Results.daten);
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from Schulhaus", false, true);
return dbh.ConvertDataTable<Schulhaus>(dbh.dsdaten.Tables[0]);
}
public static void savedata(Schulhaus Schulhausdata)
public static List<Schulhaus> GetByID(int ID)
{
Helper.HttpClientHelper httpcli = new Helper.HttpClientHelper();
httpcli.CallService("Schulhaus", Schulhausdata.ID.ToString(), "PUT", Schulhausdata);
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from Schulhaus where id=" + ID.ToString(), false, true);
return dbh.ConvertDataTable<Schulhaus>(dbh.dsdaten.Tables[0]);
}
public static int InsertData(Schulhaus Schulhausdata)
public static List<Schulhaus> GetLast()
{
Helper.HttpClientHelper httpcli = new Helper.HttpClientHelper();
httpcli.CallService("Schulhaus", "", "POST", Schulhausdata);
List<BWPMModels.Schulhaus> LastSchulhaus = new List<Schulhaus>();
LastSchulhaus = GetLast(Schulhausdata);
return LastSchulhaus.First<Schulhaus>().ID;
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select top 1 * from Schulhaus order by mutiert_am desc", false, true);
return dbh.ConvertDataTable<Schulhaus>(dbh.dsdaten.Tables[0]);
}
public static List<Schulhaus> GetLast(Schulhaus Schulhausdata)
public static List<Schulhaus> GetLastByMutierer(string Mutierer)
{
Helper.HttpClientHelper httpcli = new Helper.HttpClientHelper();
string sql = "Select top 1 * from Schulhaus where mutierer='" + Schulhausdata.mutierer + "' order by erstellt_am desc";
httpcli.CallService("Schulhaus", "usersql/" + sql, "GET", Schulhausdata);
return JsonConvert.DeserializeObject<List<Schulhaus>>(httpcli.Results.daten);
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select top 1 * from Schulhaus where mutierer='" + Mutierer + "' order by mutiert_am desc", false, true);
return dbh.ConvertDataTable<Schulhaus>(dbh.dsdaten.Tables[0]);
}
public static List<Schulhaus> GetbyUserSQL(string SQL)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata(SQL, false, true);
return dbh.ConvertDataTable<Schulhaus>(dbh.dsdaten.Tables[0]);
}
public static int POST(Schulhaus Schulhausdata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("Select top 1 * from [Schulhaus] where id=-1", false, true);
DataRow dr = dbh.dsdaten.Tables[0].NewRow();
Schulhausdata.GetType().GetProperties().ToList().ForEach(f =>
{
try
{
if (f.PropertyType == typeof(DateTime))
{
dr[f.Name] = (DateTime)f.GetValue(Schulhausdata, null);
}
else
{
dr[f.Name] = f.GetValue(Schulhausdata, null);
}
}
catch (Exception ex) { string s = ex.Message; }
});
dbh.dsdaten.Tables[0].Rows.Add(dr);
dbh.Update_Tabeldata();
List<Schulhaus> tmplst = GetLastByMutierer(Schulhausdata.mutierer);
return tmplst.First<Schulhaus>().ID;
}
public static void PUT(Schulhaus Schulhausdata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("Select top 1 * from [Schulhaus] where id=" + Schulhausdata.ID.ToString(), false, true);
DataRow dr = dbh.dsdaten.Tables[0].Rows[0];
Schulhausdata.GetType().GetProperties().ToList().ForEach(f =>
{
try
{
if (f.PropertyType == typeof(DateTime))
{
dr[f.Name] = (DateTime)f.GetValue(Schulhausdata, null);
}
else
{
dr[f.Name] = f.GetValue(Schulhausdata, null);
}
}
catch (Exception ex) { string s = ex.Message; }
});
dbh.Update_Tabeldata();
}
public static void DELETE(Schulhaus Schulhausdata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("delete from [Schulhaus] where id=" + Schulhausdata.ID.ToString(), false, true);
}
}
}
}

View File

@@ -0,0 +1,131 @@
using System;
using System.Collections.Generic;
using System.Linq;
using BWPMModels;
using BlazorApp.Helper;
using Newtonsoft.Json;
using System.Data;
using Microsoft.AspNetCore.Mvc;
namespace BlazorApp.Controller
{
public class LehrerController : ControllerBase
{
public static List<Lehrer> GetAllData()
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from Lehrer", false, true);
return dbh.ConvertDataTable<Lehrer>(dbh.dsdaten.Tables[0]);
}
public static List<Lehrer> GetByID(int ID)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from Lehrer where id=" + ID.ToString(), false, true);
return dbh.ConvertDataTable<Lehrer>(dbh.dsdaten.Tables[0]);
}
public static List<Lehrer> GetByUserID(string UserID)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from Lehrer where userid='" + UserID + "'", false, true);
if (dbh.dsdaten.Tables[0].Rows.Count == 0)
{
Lehrer Lehrerdata = new Lehrer();
Lehrerdata.aktiv = true;
Lehrerdata.erstellt_am = DateTime.Now;
Lehrerdata.mutierer = UserID;
Lehrerdata.mutiert_am = DateTime.Now;
Lehrerdata.userid = UserID;
POST(Lehrerdata);
dbh.Get_Tabledata("Select * from Lehrer where userid='" + UserID + "'", false, true);
}
return dbh.ConvertDataTable<Lehrer>(dbh.dsdaten.Tables[0]);
}
public static List<Lehrer> GetLast()
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select top 1 * from Lehrer order by mutiert_am desc", false, true);
return dbh.ConvertDataTable<Lehrer>(dbh.dsdaten.Tables[0]);
}
public static List<Lehrer> GetLastByMutierer(string Mutierer)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select top 1 * from Lehrer where mutierer='" + Mutierer + "' order by mutiert_am desc", false, true);
return dbh.ConvertDataTable<Lehrer>(dbh.dsdaten.Tables[0]);
}
public static List<Lehrer> GetbyUserSQL(string SQL)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata(SQL, false, true);
return dbh.ConvertDataTable<Lehrer>(dbh.dsdaten.Tables[0]);
}
public static int POST(Lehrer Lehrerdata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("Select top 1 * from [Lehrer] where id=-1", false, true);
DataRow dr = dbh.dsdaten.Tables[0].NewRow();
Lehrerdata.GetType().GetProperties().ToList().ForEach(f =>
{
try
{
if (f.PropertyType == typeof(DateTime))
{
dr[f.Name] = (DateTime)f.GetValue(Lehrerdata, null);
}
else
{
dr[f.Name] = f.GetValue(Lehrerdata, null);
}
}
catch (Exception ex) { string s = ex.Message; }
});
dbh.dsdaten.Tables[0].Rows.Add(dr);
dbh.Update_Tabeldata();
List<Lehrer> tmplst = GetLastByMutierer(Lehrerdata.mutierer);
return tmplst.First<Lehrer>().ID;
}
public static void PUT(Lehrer Lehrerdata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("Select top 1 * from [Lehrer] where id=" + Lehrerdata.ID.ToString(), false, true);
DataRow dr = dbh.dsdaten.Tables[0].Rows[0];
Lehrerdata.GetType().GetProperties().ToList().ForEach(f =>
{
try
{
if (f.PropertyType == typeof(DateTime))
{
dr[f.Name] = (DateTime)f.GetValue(Lehrerdata, null);
}
else
{
dr[f.Name] = f.GetValue(Lehrerdata, null);
}
}
catch (Exception ex) { string s = ex.Message; }
});
dbh.Update_Tabeldata();
}
public static void DELETE(Lehrer Lehrerdata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("delete from [Lehrer] where id=" + Lehrerdata.ID.ToString(), false, true);
}
}
}

View File

@@ -1,47 +1,116 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using BWPMModels;
using BlazorApp.Helper;
using Newtonsoft.Json;
using System.Data;
using Microsoft.AspNetCore.Mvc;
namespace BlazorApp.Controller
{
public class ZeitenController
public class ZeitenController : ControllerBase
{
public static List<Zeiten> GetAllData()
{
Helper.HttpClientHelper httpcli = new Helper.HttpClientHelper();
httpcli.CallService("Zeiten", "", "GET", null);
return JsonConvert.DeserializeObject<List<Zeiten>>(httpcli.Results.daten);
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from Zeiten", false, true);
return dbh.ConvertDataTable<Zeiten>(dbh.dsdaten.Tables[0]);
}
public static void savedata(Zeiten Zeitendata)
public static List<Zeiten> GetAllAktiveData()
{
Helper.HttpClientHelper httpcli = new Helper.HttpClientHelper();
httpcli.CallService("Zeiten", Zeitendata.ID.ToString(), "PUT", Zeitendata);
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from Zeiten where aktiv=1 order by reihenfolge", false, true);
return dbh.ConvertDataTable<Zeiten>(dbh.dsdaten.Tables[0]);
}
public static int InsertData(Zeiten Zeitendata)
public static List<Zeiten> GetByID(int ID)
{
Helper.HttpClientHelper httpcli = new Helper.HttpClientHelper();
httpcli.CallService("Zeiten", "", "POST", Zeitendata);
List<BWPMModels.Zeiten> LastZeiten = new List<Zeiten>();
LastZeiten = GetLast(Zeitendata);
return LastZeiten.First<Zeiten>().ID;
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from Zeiten where id=" + ID.ToString(), false, true);
return dbh.ConvertDataTable<Zeiten>(dbh.dsdaten.Tables[0]);
}
public static List<Zeiten> GetLast(Zeiten Zeitendata)
public static List<Zeiten> GetLast()
{
Helper.HttpClientHelper httpcli = new Helper.HttpClientHelper();
string sql = "Select top 1 * from Zeiten where mutierer='" + Zeitendata.mutierer + "' order by erstellt_am desc";
httpcli.CallService("Zeiten", "usersql/" + sql, "GET", Zeitendata);
return JsonConvert.DeserializeObject<List<Zeiten>>(httpcli.Results.daten);
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select top 1 * from Zeiten order by mutiert_am desc", false, true);
return dbh.ConvertDataTable<Zeiten>(dbh.dsdaten.Tables[0]);
}
public static List<Zeiten> GetLastByMutierer(string Mutierer)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select top 1 * from Zeiten where mutierer='" + Mutierer + "' order by mutiert_am desc", false, true);
return dbh.ConvertDataTable<Zeiten>(dbh.dsdaten.Tables[0]);
}
public static List<Zeiten> GetbyUserSQL(string SQL)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata(SQL, false, true);
return dbh.ConvertDataTable<Zeiten>(dbh.dsdaten.Tables[0]);
}
public static int POST(Zeiten Zeitendata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("Select top 1 * from [Zeiten] where id=-1", false, true);
DataRow dr = dbh.dsdaten.Tables[0].NewRow();
Zeitendata.GetType().GetProperties().ToList().ForEach(f =>
{
try
{
if (f.PropertyType == typeof(DateTime))
{
dr[f.Name] = (DateTime)f.GetValue(Zeitendata, null);
}
else
{
dr[f.Name] = f.GetValue(Zeitendata, null);
}
}
catch (Exception ex) { string s = ex.Message; }
});
dbh.dsdaten.Tables[0].Rows.Add(dr);
dbh.Update_Tabeldata();
List<Zeiten> tmplst = GetLastByMutierer(Zeitendata.mutierer);
return tmplst.First<Zeiten>().ID;
}
public static void PUT(Zeiten Zeitendata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("Select top 1 * from [Zeiten] where id=" + Zeitendata.ID.ToString(), false, true);
DataRow dr = dbh.dsdaten.Tables[0].Rows[0];
Zeitendata.GetType().GetProperties().ToList().ForEach(f =>
{
try
{
if (f.PropertyType == typeof(DateTime))
{
dr[f.Name] = (DateTime)f.GetValue(Zeitendata, null);
}
else
{
dr[f.Name] = f.GetValue(Zeitendata, null);
}
}
catch (Exception ex) { string s = ex.Message; }
});
dbh.Update_Tabeldata();
}
public static void DELETE(Zeiten Zeitendata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("delete from [Zeiten] where id=" + Zeitendata.ID.ToString(), false, true);
}
}
}
}