ProjetThe/ProjetTheAlone/View/FicRepasEncode.xaml.cs

124 lines
3.8 KiB
C#

using ProjetTheAlone.Classes;
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.Shapes;
namespace ProjetTheAlone.View
{
/// <summary>
/// Logique d'interaction pour FicRepasEncode.xaml
/// </summary>
public partial class FicRepasEncode : Window
{
public FicRepasEncode()
{
InitializeComponent();
this.DataContext = new ViewModel.VM_Repa();
}
private void btnQuitter_Click(object sender, RoutedEventArgs e)
{
Close();
}
private void CheckSoupe_Checked(object sender, RoutedEventArgs e)
{
//CheckPlatP.IsChecked = false;
//CheckDessert.IsChecked = false;
}
private void CheckPlatP_Checked(object sender, RoutedEventArgs e)
{
//CheckDessert.IsChecked = false;
//CheckSoupe.IsChecked = false;
}
private void CheckDessert_Checked(object sender, RoutedEventArgs e)
{
//CheckPlatP.IsChecked = false;
//CheckSoupe.IsChecked = false;
}
private void btnPlat_Click(object sender, RoutedEventArgs e)
{
FicEncodePlat w = new FicEncodePlat();
w.ShowDialog();
this.DataContext = new ViewModel.VM_Repa();
}
private void btnAddPlat_Click(object sender, RoutedEventArgs e)
{
if (dgPlat.SelectedItems.Count > 0 && dgLPS.Items.Count < 3 &&DateV.SelectedDate.HasValue)
{
for (int i = 0; i < dgPlat.SelectedItems.Count; i++)
{
C_T_plat plat= (C_T_plat)dgPlat.SelectedItems[i];
if(((ViewModel.VM_Repa)dgLPS.DataContext).BcpPLatJourSelectionne.Where(ii => ii.ID_plat == plat.ID_plat).ToList().Count == 0)
{
((ViewModel.VM_Repa)dgPlat.DataContext).BcpPLatJourSelectionne.Add(plat);
new Gestion.G_T_listPlat(Config.Settings1.Default.schCon).Ajouter(DateV.SelectedDate.Value, plat.ID_plat);
}
}
}
}
private void DateV_SelectedDatesChanged(object sender, SelectionChangedEventArgs e)
{
Console.Write("");
}
private void Button_Click(object sender, RoutedEventArgs e)
{
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
}
private void Button_Click_2(object sender, RoutedEventArgs e)
{
}
private void retirerPlat_Click(object sender, RoutedEventArgs e)
{
if (dgLPS.SelectedItems.Count > 0 && DateV.SelectedDate.HasValue)
{
//((ViewModel.VM_Plat)dgPlat.DataContext).BcpPlats.Add();
for (; 0 < dgLPS.SelectedItems.Count;)
{
C_T_plat plat = (C_T_plat)dgLPS.SelectedItems[0];
((ViewModel.VM_Repa)dgLPS.DataContext).BcpPLatJourSelectionne.Remove(((ViewModel.VM_Repa)dgLPS.DataContext).BcpPLatJourSelectionne.Where(ii => ii.ID_plat == plat.ID_plat).First());
new Gestion.G_T_listPlat(Config.Settings1.Default.schCon).Supprimer(plat.ID_plat, DateV.SelectedDate.Value);
}
}
}
private void Window_MouseDown(object sender, MouseButtonEventArgs e)
{
if (e.ChangedButton == MouseButton.Left)
this.DragMove();
}
}
}