226 lines
8.0 KiB
C#
226 lines
8.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using ProjetTheAlone.Classes;
|
|
using ProjetTheAlone.Gestion;
|
|
using System.Collections.ObjectModel;
|
|
using System.IO;
|
|
using ProjetTheAlone.Config;
|
|
|
|
|
|
namespace ProjetTheAlone.ViewModel
|
|
{
|
|
public class VM_DetailEvent : BasePropriete
|
|
{
|
|
#region Données Écran
|
|
|
|
private string chConnexion = Settings2.Default.schCon /*@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename='C:\Users\Hugues\Haute Ecole de la ville de Liège\Adrien VAN DAMME - ProjetTheAlone\ProjetTheAlone\ProjetThe.mdf';Integrated Security = True"*/;
|
|
private bool _ActiverUneFiche;
|
|
public bool ActiverUneFiche
|
|
{
|
|
get { return _ActiverUneFiche; }
|
|
set
|
|
{
|
|
AssignerChamp<bool>(ref _ActiverUneFiche, value, System.Reflection.MethodBase.GetCurrentMethod().Name);
|
|
ActiverBcpFiche = !ActiverUneFiche;
|
|
}
|
|
}
|
|
private bool _ActiverBcpFiche;
|
|
public bool ActiverBcpFiche
|
|
{
|
|
get { return _ActiverBcpFiche; }
|
|
set { AssignerChamp<bool>(ref _ActiverBcpFiche, value, System.Reflection.MethodBase.GetCurrentMethod().Name); }
|
|
}
|
|
#endregion
|
|
#region Données Sélectionnée
|
|
|
|
private C_T_equipe _EquipeSelectionnee;
|
|
public C_T_equipe EquipeSelectionnee
|
|
{
|
|
get { return _EquipeSelectionnee; }
|
|
set { AssignerChamp<C_T_equipe>(ref _EquipeSelectionnee, value, System.Reflection.MethodBase.GetCurrentMethod().Name); }
|
|
}
|
|
|
|
|
|
#endregion
|
|
#region Données extérieures
|
|
private VM_UnEvent _UnDetailEvent;
|
|
public VM_UnEvent UnDetailEvent
|
|
{
|
|
get { return _UnDetailEvent; }
|
|
set { AssignerChamp<VM_UnEvent>(ref _UnDetailEvent, value, System.Reflection.MethodBase.GetCurrentMethod().Name); }
|
|
}
|
|
private string _Lieu;
|
|
public string Lieu
|
|
{
|
|
get { return _Lieu; }
|
|
set { AssignerChamp<string>(ref _Lieu, value, System.Reflection.MethodBase.GetCurrentMethod().Name); }
|
|
}
|
|
|
|
private string _TypeEvent;
|
|
public string TypeEvent
|
|
{
|
|
get { return _TypeEvent; }
|
|
set { AssignerChamp<string>(ref _TypeEvent, value, System.Reflection.MethodBase.GetCurrentMethod().Name); }
|
|
}
|
|
|
|
private string _Duree;
|
|
public string Duree
|
|
{
|
|
get { return _Duree; }
|
|
set { AssignerChamp<string>(ref _Duree, value, System.Reflection.MethodBase.GetCurrentMethod().Name); }
|
|
}
|
|
|
|
private VM_UneEquipe _UneEquipe;
|
|
public VM_UneEquipe UneEquipe
|
|
{
|
|
get { return _UneEquipe; }
|
|
set { AssignerChamp<VM_UneEquipe>(ref _UneEquipe, value, System.Reflection.MethodBase.GetCurrentMethod().Name); }
|
|
}
|
|
|
|
private ObservableCollection<C_T_equipe> _BcpEquipes = new ObservableCollection<C_T_equipe>();
|
|
public ObservableCollection<C_T_equipe> BcpEquipes
|
|
{
|
|
get { return _BcpEquipes; }
|
|
set { AssignerChamp<ObservableCollection<C_T_equipe>>(ref _BcpEquipes, value, System.Reflection.MethodBase.GetCurrentMethod().Name); }
|
|
}
|
|
|
|
|
|
|
|
private VM_UnJoueur _UnJoueur;
|
|
public VM_UnJoueur UnJoueur
|
|
{
|
|
get { return _UnJoueur; }
|
|
set { AssignerChamp<VM_UnJoueur>(ref _UnJoueur, value, System.Reflection.MethodBase.GetCurrentMethod().Name); }
|
|
}
|
|
private ObservableCollection<C_T_listParticipant> _BcpJoueurs = new ObservableCollection<C_T_listParticipant>();
|
|
public ObservableCollection<C_T_listParticipant> BcpJoueurs
|
|
{
|
|
get { return _BcpJoueurs; }
|
|
set { AssignerChamp<ObservableCollection<C_T_listParticipant>>(ref _BcpJoueurs, value, System.Reflection.MethodBase.GetCurrentMethod().Name); }
|
|
}
|
|
|
|
private VM_UnBeneficiaire _UnNomJoueur;
|
|
public VM_UnBeneficiaire UnNomJoueur
|
|
{
|
|
get { return _UnNomJoueur; }
|
|
set { AssignerChamp<VM_UnBeneficiaire>(ref _UnNomJoueur, value, System.Reflection.MethodBase.GetCurrentMethod().Name); }
|
|
}
|
|
private ObservableCollection<C_T_beneficiaire> _BcpNomJoueurs = new ObservableCollection<C_T_beneficiaire>();
|
|
public ObservableCollection<C_T_beneficiaire> BcpNomJoueurs
|
|
{
|
|
get { return _BcpNomJoueurs; }
|
|
set { AssignerChamp<ObservableCollection<C_T_beneficiaire>>(ref _BcpNomJoueurs, value, System.Reflection.MethodBase.GetCurrentMethod().Name); }
|
|
}
|
|
#endregion
|
|
|
|
public VM_DetailEvent(C_T_event EventSelect)
|
|
{
|
|
|
|
UnDetailEvent = new VM_UnEvent();
|
|
UnDetailEvent.ID = EventSelect.ID_event;
|
|
UnDetailEvent.Date = EventSelect.E_date.Value;
|
|
UnDetailEvent.Description = EventSelect.E_description;
|
|
UnDetailEvent.Duree = EventSelect.E_duree.Value;
|
|
Lieu = ChargerLieu(chConnexion, EventSelect);
|
|
TypeEvent = ChargerTypeEvent(chConnexion, EventSelect);
|
|
Duree = ChargerDuree(chConnexion, EventSelect).ToString();
|
|
BcpEquipes = ChargerEquipes(chConnexion,EventSelect);
|
|
|
|
cAfficherJoueur = new BaseCommande (ChargerJoueur);
|
|
|
|
|
|
|
|
}
|
|
|
|
#region Commandes
|
|
public BaseCommande cAfficherJoueur { get; set; }
|
|
#endregion
|
|
|
|
#region Chargement
|
|
|
|
private string ChargerLieu(string chConn , C_T_event EventSelect)
|
|
{
|
|
string Lieu = "";
|
|
List<C_T_lieu> lTmp = new G_T_lieu(chConn).Lire("ID_lieu");
|
|
foreach (C_T_lieu Tmp in lTmp)
|
|
{
|
|
if (EventSelect.ID_lieu == Tmp.ID_lieu)
|
|
Lieu = Tmp.L_nom;
|
|
|
|
}
|
|
|
|
return Lieu;
|
|
}
|
|
|
|
private TimeSpan ChargerDuree(string chConn, C_T_event EventSelect)
|
|
{
|
|
TimeSpan Duree ;
|
|
|
|
return Duree = EventSelect.E_duree.Value - EventSelect.E_date.Value;
|
|
}
|
|
|
|
private string ChargerTypeEvent(string chConn, C_T_event EventSelect)
|
|
{
|
|
string typeEvenement = "";
|
|
List<C_T_typeEvenement> TETmp = new G_T_typeEvenement(chConn).Lire("ID_typeEvenement");
|
|
foreach (C_T_typeEvenement Tmp in TETmp)
|
|
{
|
|
if (EventSelect.ID_typeEvenement == Tmp.ID_typeEvenement)
|
|
typeEvenement = Tmp.TE_nom;
|
|
|
|
}
|
|
|
|
return typeEvenement;
|
|
}
|
|
|
|
private ObservableCollection<C_T_equipe> ChargerEquipes(string chConn, C_T_event EventSelect)
|
|
{
|
|
ObservableCollection<C_T_equipe> rep = new ObservableCollection<C_T_equipe>();
|
|
List<C_T_equipe> lTmp = new G_T_equipe(chConn).Lire("E_nom");
|
|
foreach (C_T_equipe Tmp in lTmp)
|
|
if (Tmp.ID_evenement == EventSelect.ID_event)
|
|
rep.Add(Tmp);
|
|
return rep;
|
|
}
|
|
|
|
private void ChargerJoueur()
|
|
{
|
|
if (EquipeSelectionnee != null)
|
|
{
|
|
ObservableCollection<C_T_listParticipant> rep = new ObservableCollection<C_T_listParticipant>();
|
|
ObservableCollection<C_T_beneficiaire> rep2 = new ObservableCollection<C_T_beneficiaire>();
|
|
|
|
List<C_T_listParticipant> lTmp = new G_T_listParticipant(chConnexion).Lire("ID_beneficiaire");
|
|
foreach (C_T_listParticipant Tmp in lTmp)
|
|
if(EquipeSelectionnee.ID_equipe == Tmp.ID_equipe)
|
|
rep.Add(Tmp);
|
|
|
|
BcpJoueurs = rep;
|
|
|
|
List<C_T_beneficiaire> bTmp = new G_T_beneficiaire(chConnexion).Lire("B_nom");
|
|
foreach (C_T_listParticipant ltmp in rep)
|
|
foreach (C_T_beneficiaire Tmp in bTmp)
|
|
if (ltmp.ID_benificiaire == Tmp.ID_beneficiaire)
|
|
rep2.Add(Tmp);
|
|
BcpNomJoueurs = rep2;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|