update nach Schuelererfassung

This commit is contained in:
2021-08-10 16:53:27 +02:00
parent 595cd0edea
commit e16ec943e1
1318 changed files with 1538825 additions and 389 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

@@ -0,0 +1,108 @@
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 AspNetRolesController : ControllerBase
{
public static List<AspNetRoles> GetAllData()
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from AspNetRoles", false, true);
return dbh.ConvertDataTable<AspNetRoles>(dbh.dsdaten.Tables[0]);
}
public static List<AspNetRoles> GetByID(int ID)
{
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 List<AspNetRoles> GetLast()
{
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

@@ -0,0 +1,108 @@
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 AspNetUserRolesController : ControllerBase
{
public static List<AspNetUserRoles> GetAllData()
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from AspNetUserRoles", false, true);
return dbh.ConvertDataTable<AspNetUserRoles>(dbh.dsdaten.Tables[0]);
}
public static List<AspNetUserRoles> GetByID(int ID)
{
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 List<AspNetUserRoles> GetLast()
{
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 List<AspNetUserRoles> GetLastByMutierer(string Mutierer)
{
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

@@ -0,0 +1,121 @@
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 AspNetUserRolleController : ControllerBase
{
public static List<AspNetUserRolle> GetAllData()
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from AspNetUserRolle", false, true);
return dbh.ConvertDataTable<AspNetUserRolle>(dbh.dsdaten.Tables[0]);
}
public static List<AspNetUserRolle> GetByID(int ID)
{
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 List<AspNetUserRolle> GetLast()
{
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

@@ -0,0 +1,109 @@
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 AspNetUsersController : ControllerBase
{
public static List<AspNetUsers> GetAllData()
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from AspNetUsers", false, true);
return dbh.ConvertDataTable<AspNetUsers>(dbh.dsdaten.Tables[0]);
}
public static List<AspNetUsers> GetByID(int ID)
{
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

@@ -0,0 +1,125 @@
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 BerufController : ControllerBase
{
public static List<Beruf> GetAllData()
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from Beruf", false, true);
return dbh.ConvertDataTable<Beruf>(dbh.dsdaten.Tables[0]);
}
public static List<Beruf> GetAllAktiveData()
{
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 List<Beruf> GetByID(int 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()
{
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);
}
public static List<Beruf> GetBerufsangebot()
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select Beruf.* from dbo.FirmaBeruf INNER JOIN dbo.Firma ON dbo.FirmaBeruf.ID = dbo.Firma.ID INNER JOIN dbo.Beruf ON dbo.FirmaBeruf.ID = dbo.Beruf.ID WHERE(dbo.Beruf.aktiv = 1) AND(dbo.FirmaBeruf.aktiv = 1) AND(dbo.Firma.aktiv = 1) AND(dbo.Firma.aktuell = 1)", false, true);
return dbh.ConvertDataTable<Beruf>(dbh.dsdaten.Tables[0]);
}
}
}

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

@@ -0,0 +1,117 @@
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 SchuelerBerufController : ControllerBase
{
public static List<SchuelerBeruf> GetAllData()
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from SchuelerBeruf", false, true);
return dbh.ConvertDataTable<SchuelerBeruf>(dbh.dsdaten.Tables[0]);
}
public static List<SchuelerBeruf> GetByID(int ID)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from SchuelerBeruf where id=" + ID.ToString(), false, true);
return dbh.ConvertDataTable<SchuelerBeruf>(dbh.dsdaten.Tables[0]);
}
public static List<SchuelerBeruf> GetLast()
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select top 1 * from SchuelerBeruf order by mutiert_am desc", false, true);
return dbh.ConvertDataTable<SchuelerBeruf>(dbh.dsdaten.Tables[0]);
}
public static List<SchuelerBeruf> GetLastByMutierer(string Mutierer)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select top 1 * from SchuelerBeruf where mutierer='" + Mutierer + "' order by mutiert_am desc", false, true);
return dbh.ConvertDataTable<SchuelerBeruf>(dbh.dsdaten.Tables[0]);
}
public static List<SchuelerBeruf> GetbyUserSQL(string SQL)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata(SQL, false, true);
return dbh.ConvertDataTable<SchuelerBeruf>(dbh.dsdaten.Tables[0]);
}
public static int POST(SchuelerBeruf SchuelerBerufdata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("Select top 1 * from [SchuelerBeruf] where id=-1", false, true);
DataRow dr = dbh.dsdaten.Tables[0].NewRow();
SchuelerBerufdata.GetType().GetProperties().ToList().ForEach(f =>
{
try
{
if (f.PropertyType == typeof(DateTime))
{
dr[f.Name] = (DateTime)f.GetValue(SchuelerBerufdata, null);
}
else
{
dr[f.Name] = f.GetValue(SchuelerBerufdata, null);
}
}
catch (Exception ex) { string s = ex.Message; }
});
dbh.dsdaten.Tables[0].Rows.Add(dr);
dbh.Update_Tabeldata();
List<SchuelerBeruf> tmplst = GetLastByMutierer(SchuelerBerufdata.mutierer);
return tmplst.First<SchuelerBeruf>().ID;
}
public static void PUT(SchuelerBeruf SchuelerBerufdata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("Select top 1 * from [SchuelerBeruf] where id=" + SchuelerBerufdata.ID.ToString(), false, true);
DataRow dr = dbh.dsdaten.Tables[0].Rows[0];
SchuelerBerufdata.GetType().GetProperties().ToList().ForEach(f =>
{
try
{
if (f.PropertyType == typeof(DateTime))
{
dr[f.Name] = (DateTime)f.GetValue(SchuelerBerufdata, null);
}
else
{
dr[f.Name] = f.GetValue(SchuelerBerufdata, null);
}
}
catch (Exception ex) { string s = ex.Message; }
});
dbh.Update_Tabeldata();
}
public static void DeleteBerufswunsch(int schuelerid, string userid)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("update [SchuelerBeruf] set aktiv=0,mutiert_am=getdate(), mutierer='"+userid+"' where schuelerid=" + schuelerid.ToString(), false, true);
}
public static void DELETE(SchuelerBeruf SchuelerBerufdata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("delete from [SchuelerBeruf] where id=" + SchuelerBerufdata.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 SchuelerController : ControllerBase
{
public static List<Schueler> GetAllData()
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from Schueler", false, true);
return dbh.ConvertDataTable<Schueler>(dbh.dsdaten.Tables[0]);
}
public static List<Schueler> GetByID(int ID)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from Schueler where id=" + ID.ToString(), false, true);
return dbh.ConvertDataTable<Schueler>(dbh.dsdaten.Tables[0]);
}
public static List<Schueler> GetByKlasseID(int ID)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from Schueler where aktiv=1 and klasseid=" + ID.ToString()+" order by name, vorname", false, true);
return dbh.ConvertDataTable<Schueler>(dbh.dsdaten.Tables[0]);
}
public static List<Schueler> GetLast()
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select top 1 * from Schueler order by mutiert_am desc", false, true);
return dbh.ConvertDataTable<Schueler>(dbh.dsdaten.Tables[0]);
}
public static List<Schueler> GetLastByMutierer(string Mutierer)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select top 1 * from Schueler where mutierer='" + Mutierer + "' order by mutiert_am desc", false, true);
return dbh.ConvertDataTable<Schueler>(dbh.dsdaten.Tables[0]);
}
public static List<Schueler> GetbyUserSQL(string SQL)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata(SQL, false, true);
return dbh.ConvertDataTable<Schueler>(dbh.dsdaten.Tables[0]);
}
public static int POST(Schueler Schuelerdata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("Select top 1 * from [Schueler] where id=-1", false, true);
DataRow dr = dbh.dsdaten.Tables[0].NewRow();
Schuelerdata.GetType().GetProperties().ToList().ForEach(f =>
{
try
{
if (f.PropertyType == typeof(DateTime))
{
dr[f.Name] = (DateTime)f.GetValue(Schuelerdata, null);
}
else
{
dr[f.Name] = f.GetValue(Schuelerdata, null);
}
}
catch (Exception ex) { string s = ex.Message; }
});
dbh.dsdaten.Tables[0].Rows.Add(dr);
dbh.Update_Tabeldata();
List<Schueler> tmplst = GetLastByMutierer(Schuelerdata.mutierer);
return tmplst.First<Schueler>().ID;
}
public static void PUT(Schueler Schuelerdata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("Select top 1 * from [Schueler] where id=" + Schuelerdata.ID.ToString(), false, true);
DataRow dr = dbh.dsdaten.Tables[0].Rows[0];
Schuelerdata.GetType().GetProperties().ToList().ForEach(f =>
{
try
{
if (f.PropertyType == typeof(DateTime))
{
dr[f.Name] = (DateTime)f.GetValue(Schuelerdata, null);
}
else
{
dr[f.Name] = f.GetValue(Schuelerdata, null);
}
}
catch (Exception ex) { string s = ex.Message; }
});
dbh.Update_Tabeldata();
}
public static void DELETE(Schueler Schuelerdata)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("delete from [Schueler] where id=" + Schuelerdata.ID.ToString(), false, true);
}
}
}

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 SchulhausController : ControllerBase
{
public static List<Schulhaus> GetAllData()
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from Schulhaus", false, true);
return dbh.ConvertDataTable<Schulhaus>(dbh.dsdaten.Tables[0]);
}
public static List<Schulhaus> GetByID(int ID)
{
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 List<Schulhaus> GetLast()
{
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> GetLastByMutierer(string Mutierer)
{
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

@@ -0,0 +1,32 @@
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 UserController
{
public static List<User> GetAllData()
{
Helper.HttpClientHelper httpcli = new Helper.HttpClientHelper();
httpcli.CallService("user", "", "GET", null);
return JsonConvert.DeserializeObject<List<User>>(httpcli.Results.daten);
}
public static void savedata( User userdata)
{
Helper.HttpClientHelper httpcli = new Helper.HttpClientHelper();
httpcli.CallService("user", userdata.ID.ToString(), "PUT", userdata);
}
}
}

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 ZeitenController : ControllerBase
{
public static List<Zeiten> GetAllData()
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from Zeiten", false, true);
return dbh.ConvertDataTable<Zeiten>(dbh.dsdaten.Tables[0]);
}
public static List<Zeiten> GetAllAktiveData()
{
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 List<Zeiten> GetByID(int 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()
{
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);
}
}
}