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,114 @@
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CoreWebAPI1.Models;
using BWPMModels;
using System.Data;
using SecuringWebApiUsingApiKey.Attributes;
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
namespace CoreWebAPI1.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class AnredeController : ControllerBase
{
// GET: api/<AnredeController>
[HttpGet]
public List<Anrede> Get()
{
dbhelper dbh = new dbhelper();
//dbh.Get_Tabledata("Select * from [Anrede]", false, true);
List<BWPMModels.Anrede> Details = new List<BWPMModels.Anrede>();
return dbh.ConvertDataTable<BWPMModels.Anrede>(dbh.Get_Tabledata("Select * from [Anrede]", false, true));
}
[HttpGet]
[Route("usersql/{sql}")]
public List<Anrede> GetLast(string sql)
{
dbhelper dbh = new dbhelper();
List<BWPMModels.Anrede> Details = new List<BWPMModels.Anrede>();
return dbh.ConvertDataTable<BWPMModels.Anrede>(dbh.Get_Tabledata(sql, false, true));
}
// GET api/<AnredeController>/5
[HttpGet("{id}")]
public List<Anrede> Get(int id)
{
dbhelper dbh = new dbhelper();
List<Anrede> Details = new List<Anrede>();
return dbh.ConvertDataTable<Anrede>(dbh.Get_Tabledata("Select * from [Anrede] where id=" + id.ToString(), false, true));
}
// POST api/<AnredeController>
[HttpPost]
public void Post([FromBody] Anrede Anrede)
{
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();
Anrede.GetType().GetProperties().ToList().ForEach(f =>
{
try
{
if (f.PropertyType == typeof(DateTime))
{
dr[f.Name] = (DateTime)f.GetValue(Anrede, null);
}
else
{
dr[f.Name] = f.GetValue(Anrede, null);
}
}
catch (Exception ex) { string s = ex.Message; }
});
dbh.dsdaten.Tables[0].Rows.Add(dr);
dbh.Update_Tabeldata();
}
// PUT api/<AnredeController>/5
[HttpPut("{id}")]
public void Put(int id, [FromBody] Anrede Anrede)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("Select top 1 * from [Anrede] where id=" + id.ToString(), false, true);
DataRow dr = dbh.dsdaten.Tables[0].Rows[0];
Anrede.GetType().GetProperties().ToList().ForEach(f =>
{
try
{
if (f.PropertyType == typeof(DateTime))
{
dr[f.Name] = (DateTime)f.GetValue(Anrede, null);
}
else
{
dr[f.Name] = f.GetValue(Anrede, null);
}
}
catch (Exception ex) { string s = ex.Message; }
});
dbh.Update_Tabeldata();
}
// DELETE api/<AnredeController>/5
[HttpDelete("{id}")]
public void Delete(int id)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("Select top 1 * from [Anrede] where id=" + id, false, true);
DataRow dr = dbh.dsdaten.Tables[0].Rows[0];
dr["Aktiv"] = false;
dr["mutiert_am"] = DateTime.Now;
dbh.Update_Tabeldata();
}
}
}

View File

@@ -0,0 +1,123 @@
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CoreWebAPI1.Models;
using BWPMModels;
using System.Data;
using SecuringWebApiUsingApiKey.Attributes;
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
namespace CoreWebAPI1.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class AnsprechpartnerController : ControllerBase
{
// GET: api/<AnsprechpartnerController>
[HttpGet]
public List<Ansprechpartner> Get()
{
dbhelper dbh = new dbhelper();
//dbh.Get_Tabledata("Select * from [Ansprechpartner]", false, true);
List<BWPMModels.Ansprechpartner> Details = new List<BWPMModels.Ansprechpartner>();
return dbh.ConvertDataTable<BWPMModels.Ansprechpartner>(dbh.Get_Tabledata("Select * from [Ansprechpartner]", false, true));
}
[HttpGet]
[Route("usersql/{sql}")]
public List<Ansprechpartner> GetLast(string sql)
{
dbhelper dbh = new dbhelper();
List<BWPMModels.Ansprechpartner> Details = new List<BWPMModels.Ansprechpartner>();
return dbh.ConvertDataTable<BWPMModels.Ansprechpartner>(dbh.Get_Tabledata(sql, false, true));
}
// GET api/<AnsprechpartnerController>/5
[HttpGet("{id}")]
public List<Ansprechpartner> Get(int id)
{
dbhelper dbh = new dbhelper();
List<Ansprechpartner> Details = new List<Ansprechpartner>();
return dbh.ConvertDataTable<Ansprechpartner>(dbh.Get_Tabledata("Select * from [Ansprechpartner] where id=" + id.ToString(), false, true));
}
// GET api/<AnsprechpartnerController>/5
[HttpGet]
[Route("GetByFirmaID/{firmaid}")]
public List<Ansprechpartner> GetByFirmaID(int firmaid)
{
dbhelper dbh = new dbhelper();
List<Ansprechpartner> Details = new List<Ansprechpartner>();
return dbh.ConvertDataTable<Ansprechpartner>(dbh.Get_Tabledata("Select * from [Ansprechpartner] where firmaid=" + firmaid.ToString(), false, true));
}
// POST api/<AnsprechpartnerController>
[HttpPost]
public void Post([FromBody] Ansprechpartner Ansprechpartner)
{
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();
Ansprechpartner.GetType().GetProperties().ToList().ForEach(f =>
{
try
{
if (f.PropertyType == typeof(DateTime))
{
dr[f.Name] = (DateTime)f.GetValue(Ansprechpartner, null);
}
else
{
dr[f.Name] = f.GetValue(Ansprechpartner, null);
}
}
catch (Exception ex) { string s = ex.Message; }
});
dbh.dsdaten.Tables[0].Rows.Add(dr);
dbh.Update_Tabeldata();
}
// PUT api/<AnsprechpartnerController>/5
[HttpPut("{id}")]
public void Put(int id, [FromBody] Ansprechpartner Ansprechpartner)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("Select top 1 * from [Ansprechpartner] where id=" + id.ToString(), false, true);
DataRow dr = dbh.dsdaten.Tables[0].Rows[0];
Ansprechpartner.GetType().GetProperties().ToList().ForEach(f =>
{
try
{
if (f.PropertyType == typeof(DateTime))
{
dr[f.Name] = (DateTime)f.GetValue(Ansprechpartner, null);
}
else
{
dr[f.Name] = f.GetValue(Ansprechpartner, null);
}
}
catch (Exception ex) { string s = ex.Message; }
});
dbh.Update_Tabeldata();
}
// DELETE api/<AnsprechpartnerController>/5
[HttpDelete("{id}")]
public void Delete(int id)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("Select top 1 * from [Ansprechpartner] where id=" + id, false, true);
DataRow dr = dbh.dsdaten.Tables[0].Rows[0];
dr["Aktiv"] = false;
dr["mutiert_am"] = DateTime.Now;
dbh.Update_Tabeldata();
}
}
}

View File

@@ -0,0 +1,122 @@
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CoreWebAPI1.Models;
using BWPMModels;
using System.Data;
using SecuringWebApiUsingApiKey.Attributes;
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
namespace CoreWebAPI1.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class FirmaController : ControllerBase
{
// GET: api/<FirmaController>
[HttpGet]
public List<Firma> Get()
{
dbhelper dbh = new dbhelper();
//dbh.Get_Tabledata("Select * from [Firma]", false, true);
List<BWPMModels.Firma> Details = new List<BWPMModels.Firma>();
return dbh.ConvertDataTable<BWPMModels.Firma>(dbh.Get_Tabledata("Select * from [Firma]", false, true));
}
[HttpGet]
[Route("usersql/{sql}")]
public List<Firma> GetLast(string sql)
{
dbhelper dbh = new dbhelper();
List<BWPMModels.Firma> Details = new List<BWPMModels.Firma>();
return dbh.ConvertDataTable<BWPMModels.Firma>(dbh.Get_Tabledata(sql, false, true));
}
// GET api/<FirmaController>/5
[HttpGet("{id}")]
public List<Firma> Get(int id)
{
dbhelper dbh = new dbhelper();
List<Firma> Details = new List<Firma>();
return dbh.ConvertDataTable<Firma>(dbh.Get_Tabledata("Select * from [Firma] where id=" + id.ToString(), false, true));
}
[HttpGet]
[Route("GetByUserID/{UserID}")]
public List<Firma> Get(string UserID)
{
dbhelper dbh = new dbhelper();
List<Firma> Details = new List<Firma>();
return dbh.ConvertDataTable<Firma>(dbh.Get_Tabledata("Select * from [Firma] where userid='" + UserID+"'", false, true));
}
// POST api/<FirmaController>
[HttpPost]
public void Post([FromBody] Firma Firma)
{
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();
Firma.GetType().GetProperties().ToList().ForEach(f =>
{
try
{
if (f.PropertyType == typeof(DateTime))
{
dr[f.Name] = (DateTime)f.GetValue(Firma, null);
}
else
{
dr[f.Name] = f.GetValue(Firma, null);
}
}
catch (Exception ex) { string s = ex.Message; }
});
dbh.dsdaten.Tables[0].Rows.Add(dr);
dbh.Update_Tabeldata();
}
// PUT api/<FirmaController>/5
[HttpPut("{id}")]
public void Put(int id, [FromBody] Firma Firma)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("Select top 1 * from [Firma] where id=" + id.ToString(), false, true);
DataRow dr = dbh.dsdaten.Tables[0].Rows[0];
Firma.GetType().GetProperties().ToList().ForEach(f =>
{
try
{
if (f.PropertyType == typeof(DateTime))
{
dr[f.Name] = (DateTime)f.GetValue(Firma, null);
}
else
{
dr[f.Name] = f.GetValue(Firma, null);
}
}
catch (Exception ex) { string s = ex.Message; }
});
dbh.Update_Tabeldata();
}
// DELETE api/<FirmaController>/5
[HttpDelete("{id}")]
public void Delete(int id)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("Select top 1 * from [Firma] where id=" + id, false, true);
DataRow dr = dbh.dsdaten.Tables[0].Rows[0];
dr["Aktiv"] = false;
dr["mutiert_am"] = DateTime.Now;
dbh.Update_Tabeldata();
}
}
}

View File

@@ -0,0 +1,39 @@
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CoreWebAPI1.Models;
using BWPMModels;
using System.Data;
using SecuringWebApiUsingApiKey.Attributes;
namespace CoreWebAPI1.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class MyScriptController : Controller
{
// GET: api/<BerufController>
[HttpGet]
public List<MyScriptGenerator> Get()
{
dbhelper dbh = new dbhelper();
//dbh.Get_Tabledata("Select * from [Beruf]", false, true);
List<BWPMModels.MyScriptGenerator> Details = new List<BWPMModels.MyScriptGenerator>();
return dbh.ConvertDataTable<BWPMModels.MyScriptGenerator>(dbh.Get_Tabledata("exec dbo.generate_c_code 1, 'Optionen'", false, true));
}
// GET api/<BerufController>/5
[HttpGet("{fnkt},{tablename}")]
public List<MyScriptGenerator> Get(int fnkt, string tablename)
{
dbhelper dbh = new dbhelper();
List<MyScriptGenerator> Details = new List<MyScriptGenerator>();
return dbh.ConvertDataTable<MyScriptGenerator>(dbh.Get_Tabledata("exec dbo.generate_c_code "+fnkt.ToString()+", '"+tablename+"'", false, true));
}
}
}

View File

@@ -0,0 +1,114 @@
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CoreWebAPI1.Models;
using BWPMModels;
using System.Data;
using SecuringWebApiUsingApiKey.Attributes;
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
namespace CoreWebAPI1.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class OptionenController : ControllerBase
{
// GET: api/<OptionenController>
[HttpGet]
public List<Optionen> Get()
{
dbhelper dbh = new dbhelper();
//dbh.Get_Tabledata("Select * from [Optionen]", false, true);
List<BWPMModels.Optionen> Details = new List<BWPMModels.Optionen>();
return dbh.ConvertDataTable<BWPMModels.Optionen>(dbh.Get_Tabledata("Select * from [Optionen]", false, true));
}
[HttpGet]
[Route("usersql/{sql}")]
public List<Optionen> GetLast(string sql)
{
dbhelper dbh = new dbhelper();
List<BWPMModels.Optionen> Details = new List<BWPMModels.Optionen>();
return dbh.ConvertDataTable<BWPMModels.Optionen>(dbh.Get_Tabledata(sql, false, true));
}
// GET api/<OptionenController>/5
[HttpGet("{id}")]
public List<Optionen> Get(int id)
{
dbhelper dbh = new dbhelper();
List<Optionen> Details = new List<Optionen>();
return dbh.ConvertDataTable<Optionen>(dbh.Get_Tabledata("Select * from [Optionen] where id=" + id.ToString(), false, true));
}
// POST api/<OptionenController>
[HttpPost]
public void Post([FromBody] Optionen Optionen)
{
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();
Optionen.GetType().GetProperties().ToList().ForEach(f =>
{
try
{
if (f.PropertyType == typeof(DateTime))
{
dr[f.Name] = (DateTime)f.GetValue(Optionen, null);
}
else
{
dr[f.Name] = f.GetValue(Optionen, null);
}
}
catch (Exception ex) { string s = ex.Message; }
});
dbh.dsdaten.Tables[0].Rows.Add(dr);
dbh.Update_Tabeldata();
}
// PUT api/<OptionenController>/5
[HttpPut("{id}")]
public void Put(int id, [FromBody] Optionen Optionen)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("Select top 1 * from [Optionen] where id=" + id.ToString(), false, true);
DataRow dr = dbh.dsdaten.Tables[0].Rows[0];
Optionen.GetType().GetProperties().ToList().ForEach(f =>
{
try
{
if (f.PropertyType == typeof(DateTime))
{
dr[f.Name] = (DateTime)f.GetValue(Optionen, null);
}
else
{
dr[f.Name] = f.GetValue(Optionen, null);
}
}
catch (Exception ex) { string s = ex.Message; }
});
dbh.Update_Tabeldata();
}
// DELETE api/<OptionenController>/5
[HttpDelete("{id}")]
public void Delete(int id)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("Select top 1 * from [Optionen] where id=" + id, false, true);
DataRow dr = dbh.dsdaten.Tables[0].Rows[0];
dr["Aktiv"] = false;
dr["mutiert_am"] = DateTime.Now;
dbh.Update_Tabeldata();
}
}
}