Use CountryCode as PK
This commit is contained in:
@ -11,7 +11,7 @@ namespace Elwig.Models {
|
||||
public int Okz { get; private set; }
|
||||
|
||||
[Column("country")]
|
||||
public string CountryCode { get; private set; }
|
||||
public int CountryNum { get; private set; }
|
||||
|
||||
[Column("id")]
|
||||
public string Id { get; private set; }
|
||||
@ -25,7 +25,7 @@ namespace Elwig.Models {
|
||||
[ForeignKey("Okz")]
|
||||
public virtual AT_Ort Ort { get; private set; }
|
||||
|
||||
[ForeignKey("CountryCode")]
|
||||
[ForeignKey("CountryNum")]
|
||||
public virtual Country Country { get; private set; }
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ namespace Elwig.Models {
|
||||
public string Name { get; set; }
|
||||
|
||||
[Column("country")]
|
||||
public string CountryCode { get; set; }
|
||||
public int CountryNum { get; set; }
|
||||
|
||||
[Column("postal_dest")]
|
||||
public string PostalDestId { get; set; }
|
||||
@ -22,10 +22,10 @@ namespace Elwig.Models {
|
||||
[ForeignKey("MgNr")]
|
||||
public virtual Member Member { get; private set; }
|
||||
|
||||
[ForeignKey("CountryCode")]
|
||||
[ForeignKey("CountryNum")]
|
||||
public virtual Country Country { get; private set; }
|
||||
|
||||
[ForeignKey("CountryCode, PostalDestId")]
|
||||
[ForeignKey("CountryNum, PostalDestId")]
|
||||
public virtual PostalDest PostalDest { get; private set; }
|
||||
}
|
||||
}
|
||||
|
@ -2,17 +2,17 @@ using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Elwig.Models {
|
||||
[Table("country"), PrimaryKey("Alpha2")]
|
||||
[Table("country"), PrimaryKey("Num"), Index("Alpha2", IsUnique = true), Index("Alpha3", IsUnique = true)]
|
||||
public class Country {
|
||||
[Column("num")]
|
||||
public int Num { get; private set; }
|
||||
|
||||
[Column("alpha2")]
|
||||
public string Alpha2 { get; private set; }
|
||||
|
||||
[Column("alpha3")]
|
||||
public string Alpha3 { get; private set; }
|
||||
|
||||
[Column("num")]
|
||||
public int Num { get; private set; }
|
||||
|
||||
[Column("name")]
|
||||
public string Name { get; private set; }
|
||||
|
||||
|
@ -117,7 +117,7 @@ namespace Elwig.Models {
|
||||
public string? Bic { get; set; }
|
||||
|
||||
[Column("country")]
|
||||
public string CountryCode { get; set; }
|
||||
public int CountryNum { get; set; }
|
||||
|
||||
[Column("postal_dest")]
|
||||
public string PostalDestId { get; set; }
|
||||
@ -143,10 +143,10 @@ namespace Elwig.Models {
|
||||
[ForeignKey("PredecessorMgNr")]
|
||||
public virtual Member? Predecessor { get; private set; }
|
||||
|
||||
[ForeignKey("CountryCode")]
|
||||
[ForeignKey("CountryNum")]
|
||||
public virtual Country Country { get; private set; }
|
||||
|
||||
[ForeignKey("CountryCode, PostalDestId")]
|
||||
[ForeignKey("CountryNum, PostalDestId")]
|
||||
public virtual PostalDest PostalDest { get; private set; }
|
||||
|
||||
[ForeignKey("DefaultKgNr")]
|
||||
|
@ -2,15 +2,15 @@ using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Elwig.Models {
|
||||
[Table("postal_dest"), PrimaryKey("CountryCode", "Id")]
|
||||
[Table("postal_dest"), PrimaryKey("CountryNum", "Id")]
|
||||
public class PostalDest {
|
||||
[Column("country")]
|
||||
public string CountryCode { get; private set; }
|
||||
public int CountryNum { get; private set; }
|
||||
|
||||
[Column("id")]
|
||||
public string Id { get; private set; }
|
||||
|
||||
[ForeignKey("CountryCode")]
|
||||
[ForeignKey("CountryNum")]
|
||||
public virtual Country Country { get; private set; }
|
||||
|
||||
[ForeignKey("Id")]
|
||||
|
@ -329,7 +329,7 @@ namespace Elwig.Windows {
|
||||
m.FamilyName = FamilyNameInput.Text;
|
||||
m.Suffix = (SuffixInput.Text == "") ? null : SuffixInput.Text;
|
||||
m.Birthday = (BirthdayInput.Text == "") ? null : string.Join("-", BirthdayInput.Text.Split(".").Reverse());
|
||||
m.CountryCode = "AT";
|
||||
m.CountryNum = 40; // Austria AT AUT
|
||||
m.PostalDestId = ((AT_PlzDest)OrtInput.SelectedItem).Id;
|
||||
m.Address = AddressInput.Text;
|
||||
|
||||
@ -373,7 +373,7 @@ namespace Elwig.Windows {
|
||||
b.Name = BillingNameInput.Text;
|
||||
b.Address = BillingAddressInput.Text;
|
||||
var p = (AT_PlzDest)BillingOrtInput.SelectedItem;
|
||||
b.CountryCode = p.CountryCode;
|
||||
b.CountryNum = p.CountryNum;
|
||||
b.PostalDestId = p.Id;
|
||||
if (m.BillingAddress == null) {
|
||||
b.MgNr = newMgNr;
|
||||
|
Reference in New Issue
Block a user