Rework models

This commit is contained in:
2023-03-14 11:23:03 +01:00
parent fe185ab516
commit 3614445cff
11 changed files with 60 additions and 60 deletions

View File

@ -5,9 +5,9 @@ namespace WGneu.Models {
[Table("AT_gem"), PrimaryKey("Gkz")] [Table("AT_gem"), PrimaryKey("Gkz")]
public class AT_Gem { public class AT_Gem {
[Column("gkz")] [Column("gkz")]
public int Gkz { get; set; } public int Gkz { get; private set; }
[Column("name")] [Column("name")]
public string Name { get; set; } public string Name { get; private set; }
} }
} }

View File

@ -5,15 +5,15 @@ namespace WGneu.Models {
[Table("AT_kg"), PrimaryKey("KgNr")] [Table("AT_kg"), PrimaryKey("KgNr")]
public class AT_Kg { public class AT_Kg {
[Column("kgnr")] [Column("kgnr")]
public int KgNr { get; set; } public int KgNr { get; private set; }
[Column("gkz")] [Column("gkz")]
public int Gkz { get; set; } public int Gkz { get; private set; }
[Column("name")] [Column("name")]
public string Name { get; set; } public string Name { get; private set; }
[ForeignKey("Gkz")] [ForeignKey("Gkz")]
public virtual AT_Gem Gem { get; set; } public virtual AT_Gem Gem { get; private set; }
} }
} }

View File

@ -5,21 +5,21 @@ namespace WGneu.Models {
[Table("AT_ort"), PrimaryKey("Okz")] [Table("AT_ort"), PrimaryKey("Okz")]
public class AT_Ort { public class AT_Ort {
[Column("okz")] [Column("okz")]
public int Okz { get; set; } public int Okz { get; private set; }
[Column("gkz")] [Column("gkz")]
public int Gkz { get; set; } public int Gkz { get; private set; }
[Column("kgnr")] [Column("kgnr")]
public int? KgNr { get; set; } public int? KgNr { get; private set; }
[Column("name")] [Column("name")]
public string Name { get; set; } public string Name { get; private set; }
[ForeignKey("Gkz")] [ForeignKey("Gkz")]
public virtual AT_Gem Gem { get; set; } public virtual AT_Gem Gem { get; private set; }
[ForeignKey("KgNr")] [ForeignKey("KgNr")]
public virtual AT_Kg? Kg { get; set; } public virtual AT_Kg? Kg { get; private set; }
} }
} }

View File

@ -6,27 +6,27 @@ namespace WGneu.Models {
[Table("AT_plz"), PrimaryKey("Plz")] [Table("AT_plz"), PrimaryKey("Plz")]
public class AT_Plz { public class AT_Plz {
[Column("plz")] [Column("plz")]
public int Plz { get; set; } public int Plz { get; private set; }
[Column("ort")] [Column("ort")]
public string Ort { get; set; } public string Ort { get; private set; }
[Column("blnr")] [Column("blnr")]
public int BlNr { get; } public int BlNr { get; private set; }
[Column("type")] [Column("type")]
public string Type { get; } public string Type { get; private set; }
[Column("internal")] [Column("internal")]
public bool Internal { get; set; } public bool IsInternal { get; private set; }
[Column("addressable")] [Column("addressable")]
public bool Addressable { get; set; } public bool IsAddressable { get; private set; }
[Column("po_box")] [Column("po_box")]
public bool PoBox { get; set; } public bool IsPoBox { get; private set; }
[InverseProperty("AtPlz")] [InverseProperty("AtPlz")]
public virtual ISet<AT_PlzDest> Orte { get; set; } public virtual ISet<AT_PlzDest> Orte { get; private set; }
} }
} }

View File

@ -5,27 +5,27 @@ namespace WGneu.Models {
[Table("AT_plz_dest"), PrimaryKey("Id"), Index("Plz", "Okz", IsUnique = true)] [Table("AT_plz_dest"), PrimaryKey("Id"), Index("Plz", "Okz", IsUnique = true)]
public class AT_PlzDest { public class AT_PlzDest {
[Column("plz")] [Column("plz")]
public int Plz { get; set; } public int Plz { get; private set; }
[Column("okz")] [Column("okz")]
public int Okz { get; set; } public int Okz { get; private set; }
[Column("country")] [Column("country")]
public string CountryCode { get; } public string CountryCode { get; private set; }
[Column("id")] [Column("id")]
public string Id { get; } public string Id { get; private set; }
[Column("dest")] [Column("dest")]
public string Dest { get; set; } public string Dest { get; private set; }
[ForeignKey("Plz")] [ForeignKey("Plz")]
public virtual AT_Plz AtPlz { get; set; } public virtual AT_Plz AtPlz { get; private set; }
[ForeignKey("Okz")] [ForeignKey("Okz")]
public virtual AT_Ort Ort { get; set; } public virtual AT_Ort Ort { get; private set; }
[ForeignKey("CountryCode")] [ForeignKey("CountryCode")]
public virtual Country Country { get; set; } public virtual Country Country { get; private set; }
} }
} }

View File

@ -5,18 +5,18 @@ namespace WGneu.Models {
[Table("country"), PrimaryKey("Alpha2")] [Table("country"), PrimaryKey("Alpha2")]
public class Country { public class Country {
[Column("alpha2")] [Column("alpha2")]
public string Alpha2 { get; set; } public string Alpha2 { get; private set; }
[Column("alpha3")] [Column("alpha3")]
public string Alpha3 { get; set; } public string Alpha3 { get; private set; }
[Column("num")] [Column("num")]
public int Num { get; set; } public int Num { get; private set; }
[Column("name")] [Column("name")]
public string Name { get; set; } public string Name { get; private set; }
[Column("is_visible")] [Column("is_visible")]
public bool IsVisible { get; set; } public bool IsVisible { get; private set; }
} }
} }

View File

@ -57,16 +57,16 @@ namespace WGneu.Models {
public string? UstId { get; set; } public string? UstId { get; set; }
[Column("volllieferant")] [Column("volllieferant")]
public bool VollLieferant { get; set; } public bool IsVollLieferant { get; set; }
[Column("buchführend")] [Column("buchführend")]
public bool Buchführend { get; set; } public bool IsBuchführend { get; set; }
[Column("funktionär")] [Column("funktionär")]
public bool Funktionär { get; set; } public bool IsFunktionär { get; set; }
[Column("active")] [Column("active")]
public bool Active { get; set; } public bool IsActive { get; set; }
[Column("iban")] [Column("iban")]
public string? Iban { get; set; } public string? Iban { get; set; }
@ -78,7 +78,7 @@ namespace WGneu.Models {
public string CountryCode { get; set; } public string CountryCode { get; set; }
[Column("postal_dest")] [Column("postal_dest")]
public string PostalDestId { get; set; } public string PostalDestId { get; private set; }
[Column("address")] [Column("address")]
public string Address { get; set; } public string Address { get; set; }

View File

@ -5,15 +5,15 @@ namespace WGneu.Models {
[Table("postal_dest"), PrimaryKey("CountryCode", "Id")] [Table("postal_dest"), PrimaryKey("CountryCode", "Id")]
public class PostalDest { public class PostalDest {
[Column("country")] [Column("country")]
public string CountryCode { get; set; } public string CountryCode { get; private set; }
[Column("id")] [Column("id")]
public string Id { get; set; } public string Id { get; private set; }
[ForeignKey("CountryCode")] [ForeignKey("CountryCode")]
public virtual Country Country { get; set; } public virtual Country Country { get; private set; }
[ForeignKey("Id")] [ForeignKey("Id")]
public virtual AT_PlzDest? AtPlz { get; set; } public virtual AT_PlzDest? AtPlz { get; private set; }
} }
} }

View File

@ -5,18 +5,18 @@ namespace WGneu.Models {
[Table("wine_quality"), PrimaryKey("QualId")] [Table("wine_quality"), PrimaryKey("QualId")]
public class WineQual { public class WineQual {
[Column("qualid")] [Column("qualid")]
public string QualId { get; set; } public string QualId { get; private set; }
[Column("origin_level")] [Column("origin_level")]
public int? OriginLevel { get; set; } public int? OriginLevel { get; private set; }
[Column("name")] [Column("name")]
public string Name { get; set; } public string Name { get; private set; }
[Column("from_kmw")] [Column("from_kmw")]
public double? FromKmw { get; set; } public double? FromKmw { get; private set; }
[Column("to_kmw")] [Column("to_kmw")]
public double? ToKmw { get; set; } public double? ToKmw { get; private set; }
} }
} }

View File

@ -5,15 +5,15 @@ namespace WGneu.Models {
[Table("wine_variety"), PrimaryKey("SortId")] [Table("wine_variety"), PrimaryKey("SortId")]
public class WineVar { public class WineVar {
[Column("sortid")] [Column("sortid")]
public string SortId { get; set; } public string SortId { get; private set; }
[Column("type")] [Column("type")]
public string Type { get; set; } public string Type { get; private set; }
[Column("name")] [Column("name")]
public string Name { get; set; } public string Name { get; private set; }
[Column("comment")] [Column("comment")]
public string? Comment { get; set; } public string? Comment { get; private set; }
} }
} }

View File

@ -63,7 +63,7 @@ namespace WGneu.Windows {
Context.Members.Load(); Context.Members.Load();
IQueryable<Member> memberQuery = Context.Members; IQueryable<Member> memberQuery = Context.Members;
if (ActiveMemberInput.IsChecked == true) if (ActiveMemberInput.IsChecked == true)
memberQuery = memberQuery.Where(m => m.Active); memberQuery = memberQuery.Where(m => m.IsActive);
List<Member> members = memberQuery.ToList(); List<Member> members = memberQuery.ToList();
members = members.OrderBy(m => m.FamilyName + " " + m.GivenName).ToList(); members = members.OrderBy(m => m.FamilyName + " " + m.GivenName).ToList();
@ -196,7 +196,7 @@ namespace WGneu.Windows {
m.UstId = (UstIdInput.Text == "") ? null : UstIdInput.Text; m.UstId = (UstIdInput.Text == "") ? null : UstIdInput.Text;
m.LfbisNr = (LfbisNrInput.Text == "") ? null : LfbisNrInput.Text; m.LfbisNr = (LfbisNrInput.Text == "") ? null : LfbisNrInput.Text;
m.Buchführend = BuchführendInput.IsChecked ?? false; m.IsBuchführend = BuchführendInput.IsChecked ?? false;
// TODO Rechnungsadresse // TODO Rechnungsadresse
@ -204,9 +204,9 @@ namespace WGneu.Windows {
m.ExitDate = (ExitDateInput.Text == "") ? null : string.Join("-", ExitDateInput.Text.Split(".").Reverse()); m.ExitDate = (ExitDateInput.Text == "") ? null : string.Join("-", ExitDateInput.Text.Split(".").Reverse());
m.BusinessShares = (BusinessSharesInput.Text == "") ? 0 : int.Parse(BusinessSharesInput.Text); m.BusinessShares = (BusinessSharesInput.Text == "") ? 0 : int.Parse(BusinessSharesInput.Text);
m.AccountingNr = (AccountingNrInput.Text == "") ? null : AccountingNrInput.Text; m.AccountingNr = (AccountingNrInput.Text == "") ? null : AccountingNrInput.Text;
m.Active = ActiveInput.IsChecked ?? false; m.IsActive = ActiveInput.IsChecked ?? false;
m.VollLieferant = VollLieferantInput.IsChecked ?? false; m.IsVollLieferant = VollLieferantInput.IsChecked ?? false;
m.Funktionär = FunkionärInput.IsChecked ?? false; m.IsFunktionär = FunkionärInput.IsChecked ?? false;
m.ZwstId = ((Branch)BranchInput.SelectedItem).ZwstId; m.ZwstId = ((Branch)BranchInput.SelectedItem).ZwstId;
m.DefaultKgNr = ((AT_Kg)DefaultKgInput.SelectedItem).KgNr; m.DefaultKgNr = ((AT_Kg)DefaultKgInput.SelectedItem).KgNr;
m.Comment = (CommentInput.Text == "") ? null : CommentInput.Text; m.Comment = (CommentInput.Text == "") ? null : CommentInput.Text;
@ -381,7 +381,7 @@ namespace WGneu.Windows {
UstIdInput.Text = m.UstId; UstIdInput.Text = m.UstId;
LfbisNrInput.Text = m.LfbisNr; LfbisNrInput.Text = m.LfbisNr;
BuchführendInput.IsChecked = m.Buchführend; BuchführendInput.IsChecked = m.IsBuchführend;
// TODO Rechnungsadresse // TODO Rechnungsadresse
@ -392,9 +392,9 @@ namespace WGneu.Windows {
BranchInput.SelectedItem = m.Branch; BranchInput.SelectedItem = m.Branch;
DefaultKgInput.SelectedItem = m.DefaultKg; DefaultKgInput.SelectedItem = m.DefaultKg;
CommentInput.Text = m.Comment; CommentInput.Text = m.Comment;
ActiveInput.IsChecked = m.Active; ActiveInput.IsChecked = m.IsActive;
VollLieferantInput.IsChecked = m.VollLieferant; VollLieferantInput.IsChecked = m.IsVollLieferant;
FunkionärInput.IsChecked = m.Funktionär; FunkionärInput.IsChecked = m.IsFunktionär;
switch (m.DefaultContact) { switch (m.DefaultContact) {
case "post": ContactPostInput.IsChecked = true; break; case "post": ContactPostInput.IsChecked = true; break;
case "email": ContactEmailInput.IsChecked = true; break; case "email": ContactEmailInput.IsChecked = true; break;