Infört Observable Property överallt, där tillämpligt
This commit is contained in:
@ -3,95 +3,40 @@ using SQLite;
|
||||
|
||||
namespace GreadyPoang.EntityLayer;
|
||||
[Table("GamePoint")]
|
||||
public class GamePoint : ObservableObject
|
||||
public partial class GamePoint : ObservableObject
|
||||
{
|
||||
public GamePoint()
|
||||
{
|
||||
_gamePointId = 0;
|
||||
_participantId = 0;
|
||||
_gameRoundId = 0;
|
||||
_gameDate = DateTime.Now;
|
||||
_gameRoundRegNr = 0;
|
||||
_gameRegPoints = 0;
|
||||
GamePointId = 0;
|
||||
ParticipantId = 0;
|
||||
GameRoundId = 0;
|
||||
GameDate = DateTime.Now;
|
||||
GameRoundRegNr = 0;
|
||||
GameRegPoints = 0;
|
||||
}
|
||||
|
||||
private int _gamePointId;
|
||||
private int _participantId;
|
||||
private int _gameRoundId;
|
||||
private DateTime _gameDate;
|
||||
private int _gameRoundRegNr;
|
||||
private int _gameRegPoints;
|
||||
[ObservableProperty]
|
||||
[property: PrimaryKey, AutoIncrement, Column("GamePointId")]
|
||||
private int gamePointId;
|
||||
|
||||
[PrimaryKey]
|
||||
[AutoIncrement]
|
||||
[Column("GamePointId")]
|
||||
public int GamePointId
|
||||
{
|
||||
get { return _gamePointId; }
|
||||
set
|
||||
{
|
||||
_gamePointId = value;
|
||||
OnPropertyChanged(nameof(GamePointId));
|
||||
}
|
||||
}
|
||||
[ObservableProperty]
|
||||
[property: Column("ParticipantId")]
|
||||
private int participantId;
|
||||
|
||||
[Column("ParticipantId")]
|
||||
public int ParticipantId
|
||||
{
|
||||
get { return _participantId; }
|
||||
set
|
||||
{
|
||||
_participantId = value;
|
||||
OnPropertyChanged(nameof(ParticipantId));
|
||||
}
|
||||
}
|
||||
[Column("GameRoundId")]
|
||||
public int GameRoundId
|
||||
{
|
||||
get { return _gameRoundId; }
|
||||
set
|
||||
{
|
||||
_gameRoundId = value;
|
||||
OnPropertyChanged(nameof(GameRoundId));
|
||||
}
|
||||
}
|
||||
[ObservableProperty]
|
||||
[property: Column("GameRoundId")]
|
||||
private int gameRoundId;
|
||||
|
||||
[Column("GameDate")]
|
||||
public DateTime GameDate
|
||||
{
|
||||
get { return _gameDate; }
|
||||
set
|
||||
{
|
||||
_gameDate = value;
|
||||
OnPropertyChanged(nameof(GameDate));
|
||||
}
|
||||
}
|
||||
|
||||
// GameRoundRegNr räknas upp när en spelare får en ny gamepoint inlagd
|
||||
// Alltså hans/hennes senaste i samma runda uppräknad med 1
|
||||
|
||||
[Column("GameRoundRegNr")]
|
||||
public int GameRoundRegNr
|
||||
{
|
||||
get { return _gameRoundRegNr; }
|
||||
set
|
||||
{
|
||||
_gameRoundRegNr = value;
|
||||
OnPropertyChanged(nameof(GameRoundRegNr));
|
||||
}
|
||||
}
|
||||
|
||||
[Column("GameRegPoints")]
|
||||
public int GameRegPoints
|
||||
{
|
||||
get { return _gameRegPoints; }
|
||||
set
|
||||
{
|
||||
_gameRegPoints = value;
|
||||
OnPropertyChanged(nameof(GameRegPoints));
|
||||
}
|
||||
}
|
||||
[ObservableProperty]
|
||||
[property: Column("GameDate")]
|
||||
private DateTime gameDate;
|
||||
|
||||
[ObservableProperty]
|
||||
[property: Column("GameRoundRegNr")]
|
||||
private int gameRoundRegNr;
|
||||
|
||||
[ObservableProperty]
|
||||
[property: Column("GameRegPoints")]
|
||||
private int gameRegPoints;
|
||||
|
||||
}
|
||||
|
||||
@ -6,72 +6,34 @@ namespace GreadyPoang.EntityLayer;
|
||||
|
||||
[Table("GameRound")]
|
||||
|
||||
public class GameRound : ObservableObject
|
||||
public partial class GameRound : ObservableObject
|
||||
{
|
||||
public GameRound()
|
||||
{
|
||||
_gameRoundId = 0;
|
||||
_gameRoundStartDate = DateTime.Now;
|
||||
_gameStatus = GamePointStatus.New;
|
||||
_gameRoundFinished = null;
|
||||
GameRoundId = 0;
|
||||
GameRoundStartDate = DateTime.Now;
|
||||
GameStatus = GamePointStatus.New;
|
||||
GameRoundFinished = null;
|
||||
}
|
||||
|
||||
private int _gameRoundId;
|
||||
private DateTime _gameRoundStartDate;
|
||||
private GamePointStatus _gameStatus;
|
||||
private DateTime? _gameRoundFinished;
|
||||
[ObservableProperty]
|
||||
[property: PrimaryKey, AutoIncrement, Column("GameRoundId")]
|
||||
private int gameRoundId;
|
||||
|
||||
[Column("GameRoundFinished")]
|
||||
public DateTime? GameRoundFinished
|
||||
{
|
||||
get { return _gameRoundFinished; }
|
||||
set
|
||||
{
|
||||
_gameRoundFinished = value;
|
||||
OnPropertyChanged(nameof(GameRoundFinished));
|
||||
}
|
||||
}
|
||||
[ObservableProperty]
|
||||
[property: Column("GameRoundStartDate")]
|
||||
private DateTime gameRoundStartDate;
|
||||
|
||||
[Column("GameRoundStartDate")]
|
||||
public DateTime GameRoundStartDate
|
||||
{
|
||||
get { return _gameRoundStartDate; }
|
||||
set
|
||||
{
|
||||
_gameRoundStartDate = value;
|
||||
OnPropertyChanged(nameof(GameRoundStartDate));
|
||||
}
|
||||
}
|
||||
[ObservableProperty]
|
||||
[property: Column("GameStatus")]
|
||||
private GamePointStatus gameStatus;
|
||||
|
||||
[Column("GameStatus")]
|
||||
public GamePointStatus GameStatus
|
||||
{
|
||||
get { return _gameStatus; }
|
||||
set
|
||||
{
|
||||
_gameStatus = value;
|
||||
OnPropertyChanged(nameof(GameStatus));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[PrimaryKey]
|
||||
[AutoIncrement]
|
||||
[Column("GameRoundId")]
|
||||
public int GameRoundId
|
||||
{
|
||||
get { return _gameRoundId; }
|
||||
set
|
||||
{
|
||||
_gameRoundId = value;
|
||||
OnPropertyChanged(nameof(GameRoundId));
|
||||
}
|
||||
}
|
||||
[ObservableProperty]
|
||||
[property: Column("GameRoundFinished")]
|
||||
private DateTime? gameRoundFinished;
|
||||
|
||||
public string GameRoundStartDateString
|
||||
{
|
||||
get { return _gameRoundStartDate.ToString("yyyy-MM-dd"); }
|
||||
get { return GameRoundStartDate.ToString("yyyy-MM-dd"); }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -3,65 +3,30 @@ using SQLite;
|
||||
|
||||
namespace GreadyPoang.EntityLayer;
|
||||
[Table("Participants")]
|
||||
public class Participant : ObservableObject
|
||||
public partial class Participant : ObservableObject
|
||||
{
|
||||
public Participant()
|
||||
{
|
||||
_firstName = string.Empty;
|
||||
_lastName = string.Empty;
|
||||
_email = string.Empty;
|
||||
FirstName = string.Empty;
|
||||
LastName = string.Empty;
|
||||
Email = string.Empty;
|
||||
}
|
||||
|
||||
private int _participantId;
|
||||
private string _firstName;
|
||||
private string _lastName;
|
||||
private string _email;
|
||||
[ObservableProperty]
|
||||
[property: PrimaryKey, AutoIncrement, Column("ParticipantId")]
|
||||
private int participantId;
|
||||
|
||||
[PrimaryKey]
|
||||
[AutoIncrement]
|
||||
[Column("ParticipantId")]
|
||||
public int ParticipantId
|
||||
{
|
||||
get { return _participantId; }
|
||||
set
|
||||
{
|
||||
_participantId = value;
|
||||
OnPropertyChanged(nameof(ParticipantId));
|
||||
}
|
||||
}
|
||||
[ObservableProperty]
|
||||
[property: Column("FirstName")]
|
||||
private string firstName;
|
||||
|
||||
[Column("FirstName")]
|
||||
public string FirstName
|
||||
{
|
||||
get { return _firstName; }
|
||||
set
|
||||
{
|
||||
_firstName = value;
|
||||
OnPropertyChanged(nameof(FirstName));
|
||||
}
|
||||
}
|
||||
[ObservableProperty]
|
||||
[property: Column("LastName")]
|
||||
private string lastName;
|
||||
|
||||
[Column("LastName")]
|
||||
public string LastName
|
||||
{
|
||||
get { return _lastName; }
|
||||
set
|
||||
{
|
||||
_lastName = value;
|
||||
OnPropertyChanged(nameof(LastName));
|
||||
}
|
||||
}
|
||||
|
||||
[Column("Email")]
|
||||
public string Email
|
||||
{
|
||||
get { return _email; }
|
||||
set
|
||||
{
|
||||
_email = value;
|
||||
OnPropertyChanged(nameof(Email));
|
||||
}
|
||||
}
|
||||
[ObservableProperty]
|
||||
[property: Column("Email")]
|
||||
private string email;
|
||||
|
||||
public string FullName
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user