Update 20231515
This commit is contained in:
@@ -1,172 +1,183 @@
|
||||
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> GetBySchuelerID(int ID)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
dbh.Get_Tabledata("Select * from SchuelerBeruf where aktiv=1 and schuelerid=" + ID.ToString()+" order by prioritaet asc", 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 Get_Prio(int SchuelerID)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
dbh.Get_Tabledata("Select top 1 prioritaet from schuelerberuf where aktiv=1 and schuelerid="+SchuelerID.ToString()+" order by prioritaet desc", false, true);
|
||||
if (dbh.dsdaten.Tables[0].Rows.Count==0) {
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Convert.ToInt32(dbh.dsdaten.Tables[0].Rows[0][0]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static int Get_Anzahl(int SchuelerID)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
dbh.Get_Tabledata("Select count(*) from schuelerberuf where aktiv=1 and schuelerid=" + SchuelerID.ToString(), false, true);
|
||||
if (dbh.dsdaten.Tables[0].Rows.Count == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Convert.ToInt32(dbh.dsdaten.Tables[0].Rows[0][0]);
|
||||
}
|
||||
}
|
||||
|
||||
public static Boolean Has_Prio1(int SchuelerID)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
dbh.Get_Tabledata("Select count(*) from schuelerberuf where prioritaet=1 and aktiv=1 and schuelerid=" + SchuelerID.ToString(), false, true);
|
||||
if (dbh.dsdaten.Tables[0].Rows.Count == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dbh.dsdaten.Tables[0].Rows[0][0].ToString() == "0")
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
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> GetBySchuelerID(int ID)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
dbh.Get_Tabledata("Select * from SchuelerBeruf where aktiv=1 and schuelerid=" + ID.ToString()+" order by prioritaet asc", 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 Get_Prio(int SchuelerID)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
dbh.Get_Tabledata("Select top 1 prioritaet from schuelerberuf where aktiv=1 and schuelerid="+SchuelerID.ToString()+" order by prioritaet desc", false, true);
|
||||
if (dbh.dsdaten.Tables[0].Rows.Count==0) {
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Convert.ToInt32(dbh.dsdaten.Tables[0].Rows[0][0]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static int Get_Anzahl(int SchuelerID)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
dbh.Get_Tabledata("Select count(*) from schuelerberuf where aktiv=1 and schuelerid=" + SchuelerID.ToString(), false, true);
|
||||
if (dbh.dsdaten.Tables[0].Rows.Count == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Convert.ToInt32(dbh.dsdaten.Tables[0].Rows[0][0]);
|
||||
}
|
||||
}
|
||||
|
||||
public static Boolean Has_Prio1(int SchuelerID)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
dbh.Get_Tabledata("Select count(*) from schuelerberuf where prioritaet=1 and aktiv=1 and schuelerid=" + SchuelerID.ToString(), false, true);
|
||||
if (dbh.dsdaten.Tables[0].Rows.Count == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dbh.dsdaten.Tables[0].Rows[0][0].ToString() == "0")
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Boolean Has_Dublicates(int SchuelerID)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
dbh.Get_Tabledata("SELECT berufid, COUNT(*) FROM SchuelerBeruf where aktiv=1 and schuelerID="+SchuelerID.ToString()+" GROUP BY berufID HAVING COUNT(*) > 1" , false, true);
|
||||
if (dbh.dsdaten.Tables[0].Rows.Count > 0)
|
||||
{ return true; }
|
||||
else
|
||||
{ return false; }
|
||||
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,116 +1,122 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
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> GetAllActiveData()
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
dbh.Get_Tabledata("Select * from Schueler where aktiv=1", 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
148
BlazorApp/Controller/Schueler/ZuteilungController.cs
Normal file
148
BlazorApp/Controller/Schueler/ZuteilungController.cs
Normal file
@@ -0,0 +1,148 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BWPMModels;
|
||||
using BlazorApp.Helper;
|
||||
using Newtonsoft.Json;
|
||||
using System.Data;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Net.NetworkInformation;
|
||||
|
||||
namespace BlazorApp.Controller
|
||||
{
|
||||
public class ZuteilungController : ControllerBase
|
||||
{
|
||||
public static List<Zuteilung> GetAllData()
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
dbh.Get_Tabledata("Select * from Zuteilung", false, true);
|
||||
return dbh.ConvertDataTable<Zuteilung>(dbh.dsdaten.Tables[0]);
|
||||
}
|
||||
public static List<Zuteilung> GetByID(int ID)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
dbh.Get_Tabledata("Select * from Zuteilung where id=" + ID.ToString(), false, true);
|
||||
return dbh.ConvertDataTable<Zuteilung>(dbh.dsdaten.Tables[0]);
|
||||
}
|
||||
public static List<ZuteilungView> GetZuteilungBySchuelerID(int ID)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
dbh.Get_Tabledata("Select * from View_Schuelerzuteilung where schuelerid=" + ID.ToString() + " order by prioritaet", false, true);
|
||||
return dbh.ConvertDataTable<ZuteilungView>(dbh.dsdaten.Tables[0]);
|
||||
}
|
||||
|
||||
public static List<View_Zuteilung> GetZuteilungen(string SchuelerNr, string BerufID)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
dbh.Get_Tabledata("Select * from View_Zugeteilt where BerufID=" + BerufID + " and id<>" + SchuelerNr, false, true);
|
||||
return dbh.ConvertDataTable<View_Zuteilung>(dbh.dsdaten.Tables[0]);
|
||||
|
||||
}
|
||||
public static List<Zuteilung> GetLast()
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
dbh.Get_Tabledata("Select top 1 * from Zuteilung order by mutiert_am desc", false, true);
|
||||
return dbh.ConvertDataTable<Zuteilung>(dbh.dsdaten.Tables[0]);
|
||||
}
|
||||
public static List<Zuteilung> GetLastByMutierer(string Mutierer)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
dbh.Get_Tabledata("Select top 1 * from Zuteilung where mutierer='" + Mutierer + "' order by mutiert_am desc", false, true);
|
||||
return dbh.ConvertDataTable<Zuteilung>(dbh.dsdaten.Tables[0]);
|
||||
}
|
||||
public static List<Zuteilung> GetbyUserSQL(string SQL)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
dbh.Get_Tabledata(SQL, false, true);
|
||||
return dbh.ConvertDataTable<Zuteilung>(dbh.dsdaten.Tables[0]);
|
||||
}
|
||||
public static int POST(Zuteilung Zuteilungdata)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
dbh.Get_Tabeldata_for_Update("Select top 1 * from [Zuteilung] where id=-1", false, true);
|
||||
DataRow dr = dbh.dsdaten.Tables[0].NewRow();
|
||||
Zuteilungdata.GetType().GetProperties().ToList().ForEach(f =>
|
||||
{
|
||||
try
|
||||
{
|
||||
if (f.PropertyType == typeof(DateTime))
|
||||
{
|
||||
dr[f.Name] = (DateTime)f.GetValue(Zuteilungdata, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
dr[f.Name] = f.GetValue(Zuteilungdata, null);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string s = ex.Message;
|
||||
}
|
||||
});
|
||||
dbh.dsdaten.Tables[0].Rows.Add(dr);
|
||||
dbh.Update_Tabeldata();
|
||||
List<Zuteilung> tmplst = GetLastByMutierer(Zuteilungdata.mutierer);
|
||||
return tmplst.First<Zuteilung>().ID;
|
||||
}
|
||||
public static void PUT(Zuteilung Zuteilungdata)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
dbh.Get_Tabeldata_for_Update("Select top 1 * from [Zuteilung] where id=" + Zuteilungdata.ID.ToString(), false, true);
|
||||
DataRow dr = dbh.dsdaten.Tables[0].Rows[0];
|
||||
Zuteilungdata.GetType().GetProperties().ToList().ForEach(f =>
|
||||
{
|
||||
try
|
||||
{
|
||||
if (f.PropertyType == typeof(DateTime))
|
||||
{
|
||||
dr[f.Name] = (DateTime)f.GetValue(Zuteilungdata, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
dr[f.Name] = f.GetValue(Zuteilungdata, null);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string s = ex.Message;
|
||||
}
|
||||
});
|
||||
dbh.Update_Tabeldata();
|
||||
}
|
||||
public static void DELETE(Zuteilung Zuteilungdata)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
dbh.Get_Tabeldata_for_Update("delete from [Zuteilung] where id=" + Zuteilungdata.ID.ToString(), false, true);
|
||||
}
|
||||
|
||||
public static void Inaktivate(int ZuteilungID, string mutierer)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
dbh.Exec_SQL("update zuteilung set aktiv=0, mutierer='" + mutierer + "', mutiert_am=getdate() where ID=" + ZuteilungID.ToString());
|
||||
}
|
||||
|
||||
public static List<View_Offene_Plaetze> GetOffenePlaetze(int Berufid, int KlasseTypID)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
dbh.add_sp_param("berufnr", Berufid.ToString());
|
||||
dbh.add_sp_param("klassentyp", KlasseTypID.ToString());
|
||||
|
||||
dbh.Get_Tabledata("get_offene_plaetze", true, false);
|
||||
return dbh.ConvertDataTable<View_Offene_Plaetze>(dbh.dsdaten.Tables[0]);
|
||||
}
|
||||
|
||||
public static void insert_zuteilung(int schuelerid, int berufid)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
dbh.add_sp_param("schuelerid", schuelerid.ToString());
|
||||
dbh.add_sp_param("berufid", berufid.ToString());
|
||||
|
||||
dbh.Get_Tabledata("Zuteilung_Manuell", true, false);
|
||||
}
|
||||
|
||||
//public static Zuteilen(int firmaberufid, int schuelerid)
|
||||
//{
|
||||
|
||||
//}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user