ProjetThe/ProjetTheAlone/ViewModel/EventDGV_VM.cs

54 lines
1.7 KiB
C#

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}"; }
}
}