You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
142 lines
6.5 KiB
142 lines
6.5 KiB
using Database;
|
|
using DOCGEN;
|
|
using Model;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Configuration;
|
|
using System.Linq;
|
|
using System.Net;
|
|
using System.Net.Http;
|
|
using System.Runtime.Serialization.Formatters;
|
|
using System.Web.Http;
|
|
|
|
namespace API_NetFramework.Controllers
|
|
{
|
|
public class AntwortAdresseController : ApiController
|
|
{
|
|
string connectionstring = ConfigurationManager.ConnectionStrings["EDOKAConnectionstring"].ConnectionString;
|
|
/// <summary>
|
|
/// GetGetAll liefert alle GAS-Adressen
|
|
/// </summary>
|
|
/// <param name="OutFormat">Optional. The default value is "JSON".Optionaler Parameter: "XML"</param>
|
|
/// <returns></returns>
|
|
/// <remarks></remarks>
|
|
[HttpGet]
|
|
[Route("API/Antwortadresse/GetAll")]
|
|
|
|
public IHttpActionResult GetGetAll(string OutFormat = "JSON")
|
|
{
|
|
Database.DB db = new Database.DB(connectionstring);
|
|
string SQL = "Select * from Antwortadresse order by bezeichnung";
|
|
if (OutFormat == "JSON") { SQL = SQL + " for json path"; }
|
|
if (OutFormat == "XML") { SQL = SQL + " for xml path"; }
|
|
db.Get_Tabledata(SQL, false, true);
|
|
return Ok(db.dsdaten.Tables[0].Rows[0][0].ToString());
|
|
}
|
|
|
|
[HttpGet]
|
|
[Route("API/Antwortadresse/GetByID")]
|
|
/// <summary>
|
|
/// GetByID liefert die GAS-Adresse mit der gewünschten ID
|
|
/// </summary>
|
|
/// <param name="ID">ID der GAS-Adresse</param>
|
|
/// <param name="OutFormat">Optional. The default value is "JSON".Optionaler Parameter: "XML"</param>
|
|
/// <returns></returns>
|
|
/// <remarks></remarks>
|
|
|
|
public IHttpActionResult GetByID(string ID,string OutFormat = "JSON")
|
|
{
|
|
Database.DB db = new Database.DB(connectionstring);
|
|
string SQL = "Select * from Antwortadresse where id="+ID;
|
|
if (OutFormat == "JSON") { SQL = SQL + " for json path"; }
|
|
if (OutFormat == "XML") { SQL = SQL + " for xml path"; }
|
|
db.Get_Tabledata(SQL, false, true);
|
|
if (db.dsdaten.Tables[0].Rows.Count == 0) { return Ok(); } else { return Ok(db.dsdaten.Tables[0].Rows[0][0].ToString()); };
|
|
}
|
|
|
|
/// <summary>
|
|
/// GetAllMitarbeiterByTGNummer liefert die persönlichen Adressen eines Mitarbeiters
|
|
/// </summary>
|
|
/// <param name="tgnummer">Required. </param>
|
|
/// <param name="OutFormat">Optional. The default value is "JSON".Optionalier Parameter: "XML"</param>
|
|
/// <returns></returns>
|
|
/// <remarks></remarks>
|
|
[HttpGet]
|
|
[Route("API/API/AntwortAdresse/GetAllMitarbeiterByTGNummer")]
|
|
|
|
public IHttpActionResult GetAllMitarbeiterByTGNummer(string tgnummer, string OutFormat = "JSON")
|
|
{
|
|
|
|
|
|
Database.DB db = new Database.DB(connectionstring);
|
|
string SQL = "Select * from AntwortAdresse_Mitarbeiter where aktiv=1 and tgnummer='" + tgnummer + "' order by bezeichnung ";
|
|
if (OutFormat == "JSON") { SQL = SQL + " for json path"; }
|
|
if (OutFormat == "XML") { SQL = SQL + " for xml path"; }
|
|
db.Get_Tabledata(SQL, false, true);
|
|
if (db.dsdaten.Tables[0].Rows.Count == 0) { return Ok(); } else { return Ok(db.dsdaten.Tables[0].Rows[0][0].ToString()); };
|
|
}
|
|
[HttpGet]
|
|
[Route("API/API/AntwortAdresse/GetAllMitarbeiterByMitarbeiterNr")]
|
|
/// <summary>
|
|
/// GetAllMitarbeiterByMitarbeiternr liefert die persönlichen Adressen eines Mitarbeiters
|
|
/// </summary>
|
|
/// <param name="Mitarbeiternr">Required. </param>
|
|
/// <param name="OutFormat">Optional. The default value is "JSON".Optionalier Parameter: "XML"</param>
|
|
/// <returns></returns>
|
|
/// <remarks></remarks>
|
|
|
|
public IHttpActionResult GetAllMitarbeiterByMitarbeiterNr(string Mitarbeiternr, string OutFormat = "JSON")
|
|
{
|
|
Database.DB db = new Database.DB(connectionstring);
|
|
string SQL = "Select * from AntwortAdresse_Mitarbeiter where aktiv=1 and Mitarbeiternr='" + Mitarbeiternr + "' ";
|
|
if (OutFormat == "JSON") { SQL = SQL + " for json path"; }
|
|
if (OutFormat == "XML") { SQL = SQL + " for xml path"; }
|
|
db.Get_Tabledata(SQL, false, true);
|
|
if (db.dsdaten.Tables[0].Rows.Count == 0) {return Ok();} else {return Ok(db.dsdaten.Tables[0].Rows[0][0].ToString());};
|
|
}
|
|
|
|
|
|
[HttpGet]
|
|
[Route("API/API/AntwortAdresse/GetMitarbeiterByID")]
|
|
/// <summary>
|
|
/// GetMitarbeiterByID liefert eine Mitarbeiter-Adrsse mit der ID
|
|
/// </summary>
|
|
/// <param name="ID">Required. </param>
|
|
/// <param name="OutFormat">Optional. The default value is "JSON".Optionalier Parameter: "XML"</param>
|
|
/// <returns></returns>
|
|
/// <remarks></remarks>
|
|
|
|
public IHttpActionResult GetMitarbeiterByID(string ID, string OutFormat = "JSON")
|
|
{
|
|
Database.DB db = new Database.DB(connectionstring);
|
|
string SQL = "Select * from AntwortAdresse_Mitarbeiter where id=" + ID;
|
|
if (OutFormat == "JSON") { SQL = SQL + " for json path"; }
|
|
if (OutFormat == "XML") { SQL = SQL + " for xml path"; }
|
|
db.Get_Tabledata(SQL, false, true);
|
|
if (db.dsdaten.Tables[0].Rows.Count == 0) { return Ok(); } else { return Ok(db.dsdaten.Tables[0].Rows[0][0].ToString()); };
|
|
}
|
|
[HttpGet]
|
|
[Route("API/API/AntwortAdresse/GetMitarbeiterUndStandard")]
|
|
/// <summary>
|
|
/// GetMitarbeiterByID liefert eine Mitarbeiter-Adrsse mit der ID
|
|
/// </summary>
|
|
/// <param name="ID">Required. </param>
|
|
/// <param name="OutFormat">Optional. The default value is "JSON".Optionalier Parameter: "XML"</param>
|
|
/// <returns></returns>
|
|
/// <remarks></remarks>
|
|
/// public IHttpActionResult GetMitarbeiterByID(string ID, string OutFormat = "JSON")
|
|
public IHttpActionResult GetGASAdressen_Einzeilig(string TGNummer, string OutFormat = "JSON")
|
|
{
|
|
Database.DB db = new Database.DB(connectionstring);
|
|
db.clear_parameter();
|
|
db.add_parameter("@tgnummer", TGNummer);
|
|
db.add_parameter("@format",OutFormat);
|
|
db.Get_Tabledata("sp_get_gas_einzeilig", true, false);
|
|
if (db.dsdaten.Tables[0].Rows.Count == 0) {
|
|
return Content(HttpStatusCode.NotFound, "");
|
|
}
|
|
else {
|
|
return Content(HttpStatusCode.OK,db.dsdaten.Tables[0].Rows[0][0].ToString()); };
|
|
}
|
|
}
|
|
} |