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

@@ -1,37 +1,121 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using BWPMModels;
using BlazorApp.Helper;
using Newtonsoft.Json;
using System.Data;
using Microsoft.AspNetCore.Mvc;
namespace BlazorApp.Controller
{
public class AspNetUserRolleController
public class AspNetUserRolleController : ControllerBase
{
public static List<AspNetUserRolle> GetAllData()
{
Helper.HttpClientHelper httpcli = new Helper.HttpClientHelper();
httpcli.CallService("AspNetUserRolle", "", "GET", null);
return JsonConvert.DeserializeObject<List<AspNetUserRolle>>(httpcli.Results.daten);
dbhelper dbh = new dbhelper();
dbh.Get_Tabledata("Select * from AspNetUserRolle", false, true);
return dbh.ConvertDataTable<AspNetUserRolle>(dbh.dsdaten.Tables[0]);
}
public static void savedata(AspNetUserRolle AspNetUserRolledata)
public static List<AspNetUserRolle> GetByID(int ID)
{
Helper.HttpClientHelper httpcli = new Helper.HttpClientHelper();
httpcli.CallService("AspNetUserRolle", AspNetUserRolledata.Id.ToString(), "PUT", AspNetUserRolledata);
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 void savepassword(BWPMModels.AspNetUsers userdata)
public static List<AspNetUserRolle> GetLast()
{
Helper.HttpClientHelper httpcli = new Helper.HttpClientHelper();
httpcli.CallService("AspNetUserRolle", "changepassword/" + userdata.Id, "PUT", userdata);
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);
}
}
}
}