Add AreaCommitment area to MemberListWindow

This commit is contained in:
2023-03-14 14:08:23 +01:00
parent 3614445cff
commit 0d8f62f404
9 changed files with 48 additions and 27 deletions

View File

@ -2,10 +2,10 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace WGneu.Models {
[Table("area_commitment"), PrimaryKey("Vnr", "KgNr", "GstNr")]
public class AreaCommit {
[Table("area_commitment"), PrimaryKey("VNr", "KgNr", "GstNr")]
public class AreaCommitment {
[Column("vnr")]
public int Vnr { get; set; }
public int VNr { get; set; }
[Column("kgnr")]
public int KgNr { get; set; }
@ -14,7 +14,7 @@ namespace WGneu.Models {
public string? GstNr { get; set; }
[Column("rdnr")]
public int RdNr { get; set; }
public int? RdNr { get; set; }
[Column("area")]
public int Area { get; set; }
@ -28,19 +28,19 @@ namespace WGneu.Models {
[Column("cultid")]
public string CultId { get; set; }
[ForeignKey("Vnr")]
public virtual Contract Contract { get; set; }
[ForeignKey("VNr")]
public virtual Contract Contract { get; private set; }
[ForeignKey("SortId")]
public virtual WineVar WineVar { get; set; }
public virtual WineVar WineVar { get; private set; }
[ForeignKey("AttrId")]
public virtual WineAttr WineAttr { get; set; }
public virtual WineAttr WineAttr { get; private set; }
[ForeignKey("CultId")]
public virtual WineCult WineCult { get; set; }
public virtual WineCult WineCult { get; private set; }
[ForeignKey("KgNr, RdNr")]
public virtual WbRd WbRd { get; set; }
public virtual WbRd? WbRd { get; private set; }
}
}

View File

@ -1,4 +1,5 @@
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
namespace WGneu.Models {
@ -9,5 +10,8 @@ namespace WGneu.Models {
[Column("name")]
public string Name { get; set; }
[InverseProperty("Branch")]
public virtual ISet<Member> Members { get; private set; }
}
}

View File

@ -1,11 +1,13 @@
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
namespace WGneu.Models {
[Table("contract"), PrimaryKey("Vnr")]
[Table("contract"), PrimaryKey("VNr")]
public class Contract {
[Column("vnr")]
public int Vnr { get; set; }
public int VNr { get; set; }
[Column("mgnr")]
public int MgNr { get; set; }
@ -17,6 +19,12 @@ namespace WGneu.Models {
public int? YearTo { get; set; }
[ForeignKey("MgNr")]
public virtual Member Member { get; set; }
public virtual Member Member { get; private set; }
[InverseProperty("Contract")]
public virtual ISet<AreaCommitment> AreaCommitments { get; private set; }
[NotMapped]
public int Area => AreaCommitments.Select(a => a.Area).Sum();
}
}

View File

@ -1,5 +1,6 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
namespace WGneu.Models {
@ -78,7 +79,7 @@ namespace WGneu.Models {
public string CountryCode { get; set; }
[Column("postal_dest")]
public string PostalDestId { get; private set; }
public string PostalDestId { get; set; }
[Column("address")]
public string Address { get; set; }
@ -105,18 +106,21 @@ namespace WGneu.Models {
public string? Comment { get; set; }
[ForeignKey("PredecessorMgNr")]
public virtual Member? Predecessor { get; set; }
public virtual Member? Predecessor { get; private set; }
[ForeignKey("CountryCode")]
public virtual Country Country { get; set; }
public virtual Country Country { get; private set; }
[ForeignKey("CountryCode, PostalDestId")]
public virtual PostalDest PostalDest { get; set; }
public virtual PostalDest PostalDest { get; private set; }
[ForeignKey("DefaultKgNr")]
public virtual AT_Kg? DefaultKg { get; set; }
public virtual AT_Kg? DefaultKg { get; private set; }
[ForeignKey("ZwstId")]
public virtual Branch Branch { get; set; }
public virtual Branch? Branch { get; private set; }
[InverseProperty("Member")]
public virtual ISet<Contract> Contracts { get; private set; }
}
}

View File

@ -11,6 +11,6 @@ namespace WGneu.Models {
public int? GlNr { get; set; }
[ForeignKey("KgNr")]
public virtual AT_Kg Kg { get; set; }
public virtual AT_Kg Kg { get; private set; }
}
}

View File

@ -14,6 +14,6 @@ namespace WGneu.Models {
public string Name { get; set; }
[ForeignKey("KgNr")]
public virtual WbKg WbKg { get; set; }
public virtual WbKg WbKg { get; private set; }
}
}