You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
208 lines
5.7 KiB
208 lines
5.7 KiB
using Business;
|
|
using Modèle;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Data;
|
|
using System.Windows.Documents;
|
|
using System.Windows.Input;
|
|
using System.Windows.Media;
|
|
using System.Windows.Media.Imaging;
|
|
using System.Windows.Navigation;
|
|
using System.Windows.Shapes;
|
|
|
|
namespace WpfApp1
|
|
{
|
|
/// <summary>
|
|
/// Logique d'interaction pour UserControlEdit.xaml
|
|
/// </summary>
|
|
public partial class UserControlEdit : UserControl
|
|
{
|
|
public UserControlEdit()
|
|
{
|
|
InitializeComponent();
|
|
Manager.LoadRequins();
|
|
|
|
DataContext = Manager;
|
|
|
|
}
|
|
|
|
public Manager Manager => (Application.Current as App).LeManager;
|
|
public ManagerUsers ManagerUser => (Application.Current as App).LeManagerUser;
|
|
|
|
private Requin _requin;
|
|
public Requin requin
|
|
{
|
|
get { return _requin; }
|
|
set
|
|
{
|
|
_requin = value;
|
|
UptadeUi(_requin);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void UptadeUi(Requin requin)
|
|
{
|
|
leNom.Contenu = requin.Nom;
|
|
nomSci.Contenu = requin.NomSci;
|
|
desc.Contenu = requin.Description;
|
|
LienPhoto.Contenu = requin.Photo;
|
|
LienVid.Contenu = requin.Video;
|
|
LienMap.Contenu = requin.PhotoCarte;
|
|
funFact.Contenu = requin.FunFact;
|
|
if (requin.StatutCons == Conservation.EX)
|
|
{
|
|
ex.IsChecked = true;
|
|
}
|
|
else if (requin.StatutCons == Conservation.EW)
|
|
{
|
|
ew.IsChecked = true;
|
|
}
|
|
else if (requin.StatutCons == Conservation.CR)
|
|
{
|
|
cr.IsChecked = true;
|
|
}
|
|
else if (requin.StatutCons == Conservation.EN)
|
|
{
|
|
en.IsChecked = true;
|
|
}
|
|
else if (requin.StatutCons == Conservation.VU)
|
|
{
|
|
vu.IsChecked = true;
|
|
}
|
|
else if (requin.StatutCons == Conservation.NT)
|
|
{
|
|
nt.IsChecked = true;
|
|
}
|
|
else if (requin.StatutCons == Conservation.LC)
|
|
{
|
|
lc.IsChecked = true;
|
|
}
|
|
else if (requin.StatutCons == Conservation.DD)
|
|
{
|
|
dd.IsChecked = true;
|
|
}
|
|
else if (requin.StatutCons == Conservation.NE)
|
|
{
|
|
ne.IsChecked = true;
|
|
}
|
|
|
|
foreach (Zone z in requin.Repartition)
|
|
{
|
|
if (z == Zone.ATLANTIQUE)
|
|
{
|
|
Atla.IsChecked = true;
|
|
}
|
|
if (z == Zone.ARCTIQUE)
|
|
{
|
|
Arct.IsChecked = true;
|
|
}
|
|
if (z == Zone.INDIEN)
|
|
{
|
|
Indi.IsChecked = true;
|
|
}
|
|
if (z == Zone.PACIFIQUE)
|
|
{
|
|
Paci.IsChecked = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
private void exit_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
((MainWindow)System.Windows.Application.Current.MainWindow).ContentControlSwapDes(requin);
|
|
}
|
|
|
|
private void submit_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
List<Zone> lesZones = new List<Zone>();
|
|
Conservation cons = new Conservation();
|
|
string nom = leNom.LeContenu.Text;
|
|
string sciNam = nomSci.LeContenu.Text;
|
|
string descri = desc.LeContenu.Text;
|
|
string photo = LienPhoto.LeContenu.Text;
|
|
string video = LienVid.LeContenu.Text;
|
|
string map = LienMap.LeContenu.Text;
|
|
string fun = funFact.LeContenu.Text;
|
|
|
|
if (ex.IsChecked == true)
|
|
{
|
|
cons = Conservation.EX;
|
|
}
|
|
else if (ew.IsChecked == true)
|
|
{
|
|
cons = Conservation.EW;
|
|
}
|
|
else if (cr.IsChecked == true)
|
|
{
|
|
cons = Conservation.CR;
|
|
}
|
|
else if (en.IsChecked == true)
|
|
{
|
|
cons = Conservation.EN;
|
|
}
|
|
else if (vu.IsChecked == true)
|
|
{
|
|
cons = Conservation.VU;
|
|
}
|
|
else if (nt.IsChecked == true)
|
|
{
|
|
cons = Conservation.NT;
|
|
}
|
|
else if (lc.IsChecked == true)
|
|
{
|
|
cons = Conservation.LC;
|
|
}
|
|
else if (dd.IsChecked == true)
|
|
{
|
|
cons = Conservation.DD;
|
|
}
|
|
else if (ne.IsChecked == true)
|
|
{
|
|
cons = Conservation.NE;
|
|
}
|
|
|
|
if (Arct.IsChecked == true)
|
|
{
|
|
lesZones.Add(Zone.ARCTIQUE);
|
|
}
|
|
if (Atla.IsChecked == true)
|
|
{
|
|
lesZones.Add(Zone.ATLANTIQUE);
|
|
}
|
|
if (Indi.IsChecked == true)
|
|
{
|
|
lesZones.Add(Zone.INDIEN);
|
|
}
|
|
if (Paci.IsChecked == true)
|
|
{
|
|
lesZones.Add(Zone.PACIFIQUE);
|
|
}
|
|
|
|
|
|
|
|
Requin requin = new Requin(nom, sciNam, descri, photo, video, map, cons, lesZones, fun);
|
|
|
|
|
|
foreach (Requin req in Manager.Requins)
|
|
{
|
|
if (req.Equals(requin))
|
|
{
|
|
Manager.ModifieRequin(req, requin);
|
|
break;
|
|
}
|
|
}
|
|
|
|
((MainWindow)System.Windows.Application.Current.MainWindow).ContentControlSwapDes(requin);
|
|
}
|
|
}
|
|
}
|