2018-12-22 15:52:17 +01:00
|
|
|
|
using HospitalServerManager.InterfacesAndEnums;
|
|
|
|
|
using HospitalServerManager.Model.Basic;
|
|
|
|
|
using System;
|
2018-11-18 18:49:40 +01:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
2019-01-11 22:32:18 +01:00
|
|
|
|
using System.Net.Mail;
|
2018-11-18 18:49:40 +01:00
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace HospitalServerManager.ViewModel
|
|
|
|
|
{
|
2018-12-29 11:58:25 +01:00
|
|
|
|
//Zmienic interfejs na taki dla viewmodeli
|
2019-01-11 22:32:18 +01:00
|
|
|
|
class PatientViewModel : IPrimaryKeyGetable, IHasEmailAdress
|
2018-11-18 18:49:40 +01:00
|
|
|
|
{
|
2018-12-22 15:52:17 +01:00
|
|
|
|
private Patient model;
|
|
|
|
|
public string PrimaryKey { get => model.PrimaryKey; }
|
|
|
|
|
public string Name { get => model.Name; }
|
|
|
|
|
public string Surname { get => model.Surname; }
|
2019-01-11 22:32:18 +01:00
|
|
|
|
public string BirthDate { get => model.BirthDate.ToShortDateString(); }
|
2018-12-22 15:52:17 +01:00
|
|
|
|
public string PatientState { get => model.PatientState.GetEnumDescription(); }
|
|
|
|
|
public string PatientSex { get => model.PatientSex.GetEnumDescription(); }
|
2019-01-11 22:32:18 +01:00
|
|
|
|
public string EmailAdress { get => model.EmailAdress.Address; }
|
2018-11-18 18:49:40 +01:00
|
|
|
|
|
2018-12-22 15:52:17 +01:00
|
|
|
|
public PatientViewModel(Patient patient)
|
2018-11-18 18:49:40 +01:00
|
|
|
|
{
|
2018-12-22 15:52:17 +01:00
|
|
|
|
model = patient;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string GetPrimaryKey()
|
|
|
|
|
{
|
2019-01-07 19:49:48 +01:00
|
|
|
|
return PrimaryKey;
|
2018-12-22 15:52:17 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string GetPrimaryKeyName()
|
|
|
|
|
{
|
2019-01-07 19:49:48 +01:00
|
|
|
|
return model.PrimaryKeyName;
|
2018-11-18 18:49:40 +01:00
|
|
|
|
}
|
2019-01-11 22:32:18 +01:00
|
|
|
|
public override string ToString()
|
|
|
|
|
{
|
|
|
|
|
return PrimaryKey + " " + Name + " " + Surname;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool IsEmailAdressInitialized()
|
|
|
|
|
{
|
|
|
|
|
var resp = model.EmailAdress.Address != string.Empty ? true : false;
|
|
|
|
|
return true; // TODO: Po testach zmienc
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public MailAddress GetEmailAdress()
|
|
|
|
|
{
|
2019-01-12 11:25:51 +01:00
|
|
|
|
return model.EmailAdress;
|
2019-01-11 22:32:18 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
2018-11-18 18:49:40 +01:00
|
|
|
|
}
|