2025-11-30 11:51:28 +01:00

52 lines
1.5 KiB
C#

using Npgsql;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DatenDB
{
public class Views
{
public Views() { }
public static List<Views> GetArtikel_sthList()
{
DatenbankConnection.GetConnection().Open();
List<Views> resultList = new List<Views>();
NpgsqlCommand command = new NpgsqlCommand();
command.Connection = DatenbankConnection.GetConnection();
command.CommandText = $"SELECT * FROM kundenverwaltung.artikel_sth";
NpgsqlDataReader reader = command.ExecuteReader();
while (reader.Read()) resultList.Add(new Views(reader, 1));
reader.Close();
DatenbankConnection.GetConnection().Close();
return resultList;
}
public Views(NpgsqlDataReader reader, int i)
{
if (i == 1)
{
this.AuftragID = reader.GetInt32(0);
this.AuftragArtikelID = reader.GetInt32(1);
this.KundeID = reader.GetInt32(2);
this.KundeName = reader.GetString(3);
this.ArtikelName = reader.GetString(4);
this.Anzahl = reader.GetInt32(5);
this.Erledigt = reader.GetBoolean(6);
}
}
public int AuftragID { get; set; }
public int AuftragArtikelID { get; set; }
public int KundeID { get; set; }
public string KundeName { get; set; }
public string ArtikelName { get; set; }
public int Anzahl { get; set; }
public bool Erledigt { get; set; }
}
}