Update 20231016
This commit is contained in:
@@ -1,124 +1,113 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Data;
|
||||
using SecuringWebApiUsingApiKey.Attributes;
|
||||
using DPMService.Models;
|
||||
|
||||
namespace DPMService.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
|
||||
public class PatChargeController : ControllerBase
|
||||
{
|
||||
|
||||
|
||||
|
||||
// GET: api/<PatChargeController>
|
||||
[HttpGet]
|
||||
public List<PatCharge> Get()
|
||||
{
|
||||
|
||||
dbhelper dbh = new dbhelper();
|
||||
//dbh.Get_Tabledata("Select * from [PatCharge]", false, true);
|
||||
|
||||
List<PatCharge> Details = new List<PatCharge>();
|
||||
return dbh.ConvertDataTable<PatCharge>(dbh.Get_Tabledata("Select * from [PatCharge]", false, true));
|
||||
}
|
||||
|
||||
|
||||
// GET api/<PatChargeController>/5
|
||||
[HttpGet("{id}")]
|
||||
public List<ViewPatCharche> Get(int id)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
List<PatCharge> Details = new List<PatCharge>();
|
||||
return dbh.ConvertDataTable<ViewPatCharche>(dbh.Get_Tabledata("Select * from [Service_View_Charge] where patid=" + id.ToString() +" order by datum desc, id desc", false, true));
|
||||
}
|
||||
|
||||
// POST api/<PatChargeController>
|
||||
[HttpPost]
|
||||
public void Post([FromBody] PatCharge PatCharge)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
dbh.Get_Tabeldata_for_Update("Select top 1 * from [PatCharge] where id=-1", false, true);
|
||||
DataRow dr = dbh.dsdaten.Tables[0].NewRow();
|
||||
PatCharge.GetType().GetProperties().ToList().ForEach(f =>
|
||||
{
|
||||
try
|
||||
{
|
||||
if (f.PropertyType == typeof(DateTime))
|
||||
{
|
||||
dr[f.Name] = (DateTime)f.GetValue(PatCharge, null);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
dr[f.Name] = f.GetValue(PatCharge, null);
|
||||
}
|
||||
}
|
||||
catch (Exception ex) { string s = ex.Message; }
|
||||
});
|
||||
dbh.dsdaten.Tables[0].Rows.Add(dr);
|
||||
dbh.Update_Tabeldata();
|
||||
}
|
||||
[HttpPost("{id}/{charge}")]
|
||||
public void Post(string id, string charge)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
dbh.Get_Tabeldata_for_Update("Select top 1 * from [PatCharge] where id=-1", false, true);
|
||||
DataRow dr = dbh.dsdaten.Tables[0].NewRow();
|
||||
dr[1] = id;
|
||||
dr[2] = charge.ToString();
|
||||
dr[3] = DateTime.Now;
|
||||
dr[4] = DateTime.Now;
|
||||
dr[5] = 1;
|
||||
dr[6] = true;
|
||||
dbh.dsdaten.Tables[0].Rows.Add(dr);
|
||||
dbh.Update_Tabeldata();
|
||||
}
|
||||
|
||||
// PUT api/<PatChargeController>/5
|
||||
[HttpPut("{id}")]
|
||||
public void Put(int id, [FromBody] PatCharge PatCharge)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
dbh.Get_Tabeldata_for_Update("Select top 1 * from [PatCharge] where id=" + id.ToString(), false, true);
|
||||
DataRow dr = dbh.dsdaten.Tables[0].Rows[0];
|
||||
PatCharge.GetType().GetProperties().ToList().ForEach(f =>
|
||||
{
|
||||
try
|
||||
{
|
||||
if (f.PropertyType == typeof(DateTime))
|
||||
{
|
||||
dr[f.Name] = (DateTime)f.GetValue(PatCharge, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
dr[f.Name] = f.GetValue(PatCharge, null);
|
||||
}
|
||||
}
|
||||
catch (Exception ex) { string s = ex.Message; }
|
||||
});
|
||||
dbh.Update_Tabeldata();
|
||||
|
||||
}
|
||||
|
||||
// DELETE api/<PatChargeController>/5
|
||||
[HttpDelete("{id}")]
|
||||
public void Delete(int id)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
dbh.Get_Tabeldata_for_Update("Select top 1 * from [PatCharge] where id=" + id, false, true);
|
||||
DataRow dr = dbh.dsdaten.Tables[0].Rows[0];
|
||||
dr["Aktiv"] = false;
|
||||
dr["mutiert_am"] = DateTime.Now;
|
||||
dbh.Update_Tabeldata();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
using DPMService.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
|
||||
namespace DPMService.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class PatChargeController : ControllerBase
|
||||
{
|
||||
// GET: api/<PatChargeController>
|
||||
[HttpGet]
|
||||
public List<PatCharge> Get()
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
//dbh.Get_Tabledata("Select * from [PatCharge]", false, true);
|
||||
|
||||
List<PatCharge> Details = new List<PatCharge>();
|
||||
return dbh.ConvertDataTable<PatCharge>(dbh.Get_Tabledata("Select * from [PatCharge]", false, true));
|
||||
}
|
||||
|
||||
// GET api/<PatChargeController>/5
|
||||
[HttpGet("{id}")]
|
||||
public List<ViewPatCharche> Get(int id)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
List<PatCharge> Details = new List<PatCharge>();
|
||||
return dbh.ConvertDataTable<ViewPatCharche>(dbh.Get_Tabledata("Select * from [Service_View_Charge] where patid=" + id.ToString() + " order by datum desc, id desc", false, true));
|
||||
}
|
||||
|
||||
// POST api/<PatChargeController>
|
||||
[HttpPost]
|
||||
public void Post([FromBody] PatCharge PatCharge)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
dbh.Get_Tabeldata_for_Update("Select top 1 * from [PatCharge] where id=-1", false, true);
|
||||
DataRow dr = dbh.dsdaten.Tables[0].NewRow();
|
||||
PatCharge.GetType().GetProperties().ToList().ForEach(f =>
|
||||
{
|
||||
try
|
||||
{
|
||||
if (f.PropertyType == typeof(DateTime))
|
||||
{
|
||||
dr[f.Name] = (DateTime)f.GetValue(PatCharge, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
dr[f.Name] = f.GetValue(PatCharge, null);
|
||||
}
|
||||
}
|
||||
catch (Exception ex) { string s = ex.Message; }
|
||||
});
|
||||
dbh.dsdaten.Tables[0].Rows.Add(dr);
|
||||
dbh.Update_Tabeldata();
|
||||
}
|
||||
|
||||
[HttpPost("{id}/{charge}")]
|
||||
public void Post(string id, string charge)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
dbh.Get_Tabeldata_for_Update("Select top 1 * from [PatCharge] where id=-1", false, true);
|
||||
DataRow dr = dbh.dsdaten.Tables[0].NewRow();
|
||||
dr[1] = id;
|
||||
dr[2] = charge.ToString();
|
||||
dr[3] = DateTime.Now;
|
||||
dr[4] = DateTime.Now;
|
||||
dr[5] = 1;
|
||||
dr[6] = true;
|
||||
dbh.dsdaten.Tables[0].Rows.Add(dr);
|
||||
dbh.Update_Tabeldata();
|
||||
}
|
||||
|
||||
// PUT api/<PatChargeController>/5
|
||||
[HttpPut("{id}")]
|
||||
public void Put(int id, [FromBody] PatCharge PatCharge)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
dbh.Get_Tabeldata_for_Update("Select top 1 * from [PatCharge] where id=" + id.ToString(), false, true);
|
||||
DataRow dr = dbh.dsdaten.Tables[0].Rows[0];
|
||||
PatCharge.GetType().GetProperties().ToList().ForEach(f =>
|
||||
{
|
||||
try
|
||||
{
|
||||
if (f.PropertyType == typeof(DateTime))
|
||||
{
|
||||
dr[f.Name] = (DateTime)f.GetValue(PatCharge, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
dr[f.Name] = f.GetValue(PatCharge, null);
|
||||
}
|
||||
}
|
||||
catch (Exception ex) { string s = ex.Message; }
|
||||
});
|
||||
dbh.Update_Tabeldata();
|
||||
}
|
||||
|
||||
// DELETE api/<PatChargeController>/5
|
||||
[HttpDelete("{id}")]
|
||||
public void Delete(int id)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
dbh.Get_Tabeldata_for_Update("Select top 1 * from [PatCharge] where id=" + id, false, true);
|
||||
DataRow dr = dbh.dsdaten.Tables[0].Rows[0];
|
||||
dr["Aktiv"] = false;
|
||||
dr["mutiert_am"] = DateTime.Now;
|
||||
dbh.Update_Tabeldata();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user