132 lines
4.3 KiB
C#
132 lines
4.3 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_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;
|
|
}
|
|
}
|
|
}
|
|
}
|