allDonne !
This commit is contained in:
131
ProjetTheAlone/ViewModel/EncodeClassement.cs
Normal file
131
ProjetTheAlone/ViewModel/EncodeClassement.cs
Normal file
@@ -0,0 +1,131 @@
|
||||
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_Classement : 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_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); }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
public VM_Classement(C_T_event EventSelect)
|
||||
{
|
||||
|
||||
UneEquipe = new VM_UneEquipe();
|
||||
UneEquipe.Point = 0;
|
||||
BcpEquipes = ChargerEquipes(chConnexion, EventSelect);
|
||||
ActiverUneFiche = false;
|
||||
|
||||
cConfirmer = new BaseCommande(Confirmer);
|
||||
cAnnuler = new BaseCommande(Annuler);
|
||||
cModifierPoint = new BaseCommande(ModifierPoint);
|
||||
|
||||
}
|
||||
|
||||
#region Commandes
|
||||
public BaseCommande cConfirmer { get; set; }
|
||||
public BaseCommande cAnnuler { get; set; }
|
||||
public BaseCommande cModifierPoint { get; set; }
|
||||
#endregion
|
||||
|
||||
#region Chargement
|
||||
|
||||
|
||||
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_point");
|
||||
foreach (C_T_equipe Tmp in lTmp)
|
||||
if (Tmp.ID_evenement == EventSelect.ID_event)
|
||||
rep.Add(Tmp);
|
||||
return rep;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
public void Confirmer()
|
||||
{
|
||||
new G_T_equipe(chConnexion).Modifier(UneEquipe.ID, UneEquipe.Nom, UneEquipe.Point, UneEquipe.IDEvent);
|
||||
BcpEquipes[BcpEquipes.IndexOf(EquipeSelectionnee)] = new C_T_equipe(UneEquipe.ID, UneEquipe.Nom, UneEquipe.Point, UneEquipe.IDEvent);
|
||||
|
||||
ActiverUneFiche = false;
|
||||
}
|
||||
public void Annuler()
|
||||
{ ActiverUneFiche = false; }
|
||||
|
||||
public void ModifierPoint()
|
||||
{
|
||||
if (EquipeSelectionnee != null)
|
||||
{
|
||||
C_T_equipe Tmp = new G_T_equipe(chConnexion).Lire_ID(EquipeSelectionnee.ID_equipe);
|
||||
|
||||
UneEquipe = new VM_UneEquipe();
|
||||
UneEquipe.ID = Tmp.ID_equipe;
|
||||
UneEquipe.Nom = Tmp.E_nom;
|
||||
UneEquipe.Point = Tmp.E_point;
|
||||
UneEquipe.IDEvent = Tmp.ID_evenement.Value;
|
||||
|
||||
ActiverUneFiche = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
225
ProjetTheAlone/ViewModel/EncodeDetailEvent.cs
Normal file
225
ProjetTheAlone/ViewModel/EncodeDetailEvent.cs
Normal file
@@ -0,0 +1,225 @@
|
||||
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
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
53
ProjetTheAlone/ViewModel/EventDGV_VM.cs
Normal file
53
ProjetTheAlone/ViewModel/EventDGV_VM.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ProjetTheAlone.Classes;
|
||||
using ProjetTheAlone.Gestion;
|
||||
|
||||
namespace ProjetTheAlone.ViewModel
|
||||
{
|
||||
public class EventDGV_VM : BasePropriete
|
||||
{
|
||||
string chConn = Config.Settings1.Default.schCon;
|
||||
string date;
|
||||
ObservableCollection<Classes.C_T_event> bcpEvent;
|
||||
public ObservableCollection<C_T_event> BcpEvent { get => bcpEvent; set => bcpEvent = value; }
|
||||
|
||||
public string Date { get => date; set => base.AssignerChamp<string>(ref date, value, "Date"); }
|
||||
|
||||
public EventDGV_VM()
|
||||
{
|
||||
BcpEvent = chargerEventOfTheDay(DateTime.Now);
|
||||
}
|
||||
public EventDGV_VM(DateTime date)
|
||||
{
|
||||
BcpEvent = chargerEventOfTheDay(date);
|
||||
|
||||
Date = date.ToShortDateString();
|
||||
}
|
||||
private ObservableCollection<C_T_event> chargerEventOfTheDay(DateTime date)
|
||||
{
|
||||
ObservableCollection<C_T_event> rep = new ObservableCollection<C_T_event>();
|
||||
List<C_T_event> lTmp = new G_T_event(chConn).Lire(date);
|
||||
foreach (C_T_event Tmp in lTmp)
|
||||
rep.Add(Tmp);
|
||||
return rep;
|
||||
}
|
||||
}
|
||||
public class unEvent : BasePropriete
|
||||
{
|
||||
C_T_event evenment;
|
||||
public unEvent()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
public C_T_event Evenment { get => evenment; set => evenment = value; }
|
||||
public string AffichageDetail { get => $"{new G_T_typeEvenement(Config.Settings1.Default.schCon).Lire_ID(Evenment.ID_typeEvenement.Value)} " +
|
||||
$"le {Evenment.E_date} pandant {Evenment.E_duree}"; }
|
||||
}
|
||||
}
|
||||
95
ProjetTheAlone/ViewModel/VM_FicGestionAlert.cs
Normal file
95
ProjetTheAlone/ViewModel/VM_FicGestionAlert.cs
Normal file
@@ -0,0 +1,95 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Collections.Specialized;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjetTheAlone.ViewModel
|
||||
{
|
||||
public class VM_FicGestionAlert : BasePropriete
|
||||
{
|
||||
private ObservableCollection<string> alerteList;
|
||||
public ObservableCollection<string> AlerteList {
|
||||
get {
|
||||
if (Config.Settings1.Default.alerte == null) Config.Settings1.Default.alerte = new StringCollection();
|
||||
if (alerteList == null) alerteList = new ObservableCollection<string>();
|
||||
if (alerteList.Count <= Config.Settings1.Default.alerte.Count) {
|
||||
this.alerteList = new ObservableCollection<string>();
|
||||
for (int i = 0; i < Config.Settings1.Default.alerte.Count; i++)
|
||||
alerteList.Add(Config.Settings1.Default.alerte[i]);
|
||||
}
|
||||
|
||||
return alerteList; }
|
||||
set {
|
||||
Config.Settings1.Default.alerte.Add(value.Last());
|
||||
Config.Settings1.Default.Save();
|
||||
OnPropertyChanged("AlerteList"); } }
|
||||
public BaseCommande cAjouter { get; set; }
|
||||
public BaseCommande cEditer { get; set; }
|
||||
public BaseCommande cDel { get; set; }
|
||||
public string AlertSelect { get => alertSelect; set { alertSelect = value; OnPropertyChanged("AlertSelect"); } }
|
||||
|
||||
public string NouvelleAlert { get => nouvelleAlert; set { nouvelleAlert = value; OnPropertyChanged("NouvelleAlert"); } }
|
||||
|
||||
string nouvelleAlert = "";
|
||||
|
||||
bool edit = false;
|
||||
public string btnConfirmtxt { get {if(Edit) return "Mettre à jour"; else return "Ajouter";} }
|
||||
|
||||
public bool Edit { get => edit; set { edit = value; OnPropertyChanged("btnConfirmtxt"); } }
|
||||
|
||||
public BaseCommande cSuprimer;
|
||||
string alertSelect = "";
|
||||
public VM_FicGestionAlert()
|
||||
{
|
||||
cAjouter = new BaseCommande(Ajouter);
|
||||
cEditer = new BaseCommande(EditCMD);
|
||||
cDel = new BaseCommande(Suprimer);
|
||||
}
|
||||
public void Ajouter()
|
||||
{
|
||||
if(nouvelleAlert != "")
|
||||
if(!edit)
|
||||
{
|
||||
AlerteList.Add(nouvelleAlert);
|
||||
Config.Settings1.Default.alerte.Add(nouvelleAlert);
|
||||
Config.Settings1.Default.Save();
|
||||
OnPropertyChanged("AlerteList");
|
||||
}
|
||||
else
|
||||
{
|
||||
int setingIndex = Config.Settings1.Default.alerte.IndexOf(AlertSelect);
|
||||
int alertListIndex = AlerteList.IndexOf(AlertSelect);
|
||||
AlerteList[alertListIndex] = NouvelleAlert;
|
||||
Config.Settings1.Default.alerte[setingIndex] = nouvelleAlert;
|
||||
Config.Settings1.Default.Save();
|
||||
Edit = false;
|
||||
OnPropertyChanged("AlerteList");
|
||||
}
|
||||
}
|
||||
public void Suprimer()
|
||||
{
|
||||
|
||||
int setingIndex = Config.Settings1.Default.alerte.IndexOf(AlertSelect);
|
||||
int alertListIndex = AlerteList.IndexOf(AlertSelect);
|
||||
if (setingIndex < 0 && alertListIndex <0)
|
||||
return;
|
||||
AlerteList.RemoveAt(alertListIndex);
|
||||
Config.Settings1.Default.alerte.RemoveAt(setingIndex);
|
||||
Config.Settings1.Default.Save();
|
||||
Edit = false;
|
||||
OnPropertyChanged("AlerteList");
|
||||
}
|
||||
public void EditCMD()
|
||||
{
|
||||
if (AlertSelect != "" || Edit)
|
||||
{
|
||||
Edit = (Edit ? false : true);
|
||||
NouvelleAlert = AlertSelect;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user