procédure ListPlat
This commit is contained in:
parent
e262770905
commit
6be830de85
|
@ -11,7 +11,7 @@
|
|||
<userSettings>
|
||||
<ProjetTheAlone.Settings1>
|
||||
<setting name="schCon" serializeAs="String">
|
||||
<value>Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=ProjetThe;Integrated Security=True</value>
|
||||
<value>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</value>
|
||||
</setting>
|
||||
</ProjetTheAlone.Settings1>
|
||||
</userSettings>
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace ProjetTheAlone {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.7.0.0")]
|
||||
internal sealed partial class Settings1 : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings1 defaultInstance = ((Settings1)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings1())));
|
||||
|
||||
public static Settings1 Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("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")]
|
||||
public string schCon {
|
||||
get {
|
||||
return ((string)(this["schCon"]));
|
||||
}
|
||||
set {
|
||||
this["schCon"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="ProjetTheAlone" GeneratedClassName="Settings1">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="schCon" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">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</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
|
@ -23,6 +23,7 @@ namespace ProjetTheAlone
|
|||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace ProjetTheAlone.Acces
|
|||
: base(sChaineConnexion)
|
||||
{ }
|
||||
#endregion
|
||||
public int Ajouter(string B_nom, string B_prenom, DateTime? B_anniversaire, string B_img)
|
||||
public int Ajouter(string B_nom, string B_prenom, DateTime? B_anniversaire, byte?[] B_img)
|
||||
{
|
||||
CreerCommande("AjouterT_beneficiaire");
|
||||
int res = 0;
|
||||
|
@ -40,7 +40,7 @@ namespace ProjetTheAlone.Acces
|
|||
Commande.Connection.Close();
|
||||
return res;
|
||||
}
|
||||
public int Modifier(int ID_beneficiaire, string B_nom, string B_prenom, DateTime? B_anniversaire, string B_img)
|
||||
public int Modifier(int ID_beneficiaire, string B_nom, string B_prenom, DateTime? B_anniversaire, byte?[] B_img)
|
||||
{
|
||||
CreerCommande("ModifierT_beneficiaire");
|
||||
int res = 0;
|
||||
|
@ -72,7 +72,7 @@ namespace ProjetTheAlone.Acces
|
|||
tmp.B_nom = dr["B_nom"].ToString();
|
||||
tmp.B_prenom = dr["B_prenom"].ToString();
|
||||
if(dr["B_anniversaire"] != DBNull.Value) tmp.B_anniversaire = DateTime.Parse(dr["B_anniversaire"].ToString());
|
||||
tmp.B_img = dr["B_img"].ToString();
|
||||
tmp.B_img = dr["B_img"];
|
||||
res.Add(tmp);
|
||||
}
|
||||
dr.Close();
|
||||
|
@ -92,7 +92,7 @@ namespace ProjetTheAlone.Acces
|
|||
res.B_nom = dr["B_nom"].ToString();
|
||||
res.B_prenom = dr["B_prenom"].ToString();
|
||||
if(dr["B_anniversaire"] != DBNull.Value) res.B_anniversaire = DateTime.Parse(dr["B_anniversaire"].ToString());
|
||||
res.B_img = dr["B_img"].ToString();
|
||||
res.B_img = (byte?[])dr["B_img"];
|
||||
}
|
||||
dr.Close();
|
||||
Commande.Connection.Close();
|
||||
|
|
|
@ -74,7 +74,30 @@ namespace ProjetTheAlone.Acces
|
|||
Commande.Connection.Close();
|
||||
return res;
|
||||
}
|
||||
public C_T_plat Lire_ID(int ID_plat)
|
||||
/// <summary>
|
||||
/// Permet de récupérer la liste des plats d'un repas
|
||||
/// </summary>
|
||||
public List<C_T_plat> ListPlat(int ID_listPlat)
|
||||
{
|
||||
CreerCommande("ListPlat");
|
||||
Commande.Parameters.AddWithValue("@ID_listPlat", ID_listPlat);
|
||||
Commande.Connection.Open();
|
||||
SqlDataReader dr = Commande.ExecuteReader();
|
||||
List<C_T_plat> res = new List<C_T_plat>();
|
||||
while (dr.Read())
|
||||
{
|
||||
C_T_plat tmp = new C_T_plat();
|
||||
tmp.ID_plat = int.Parse(dr["ID_plat"].ToString());
|
||||
if (dr["P_nom"] != DBNull.Value) tmp.P_nom = (dr["P_nom"].ToString());
|
||||
if (dr["P_img"] != DBNull.Value) tmp.P_img = Encoding.ASCII.GetBytes(dr["P_img"].ToString());
|
||||
if (dr["ID_typePlat"] != DBNull.Value) tmp.ID_typePlat = int.Parse(dr["ID_typePlat"].ToString());
|
||||
res.Add(tmp);
|
||||
}
|
||||
dr.Close();
|
||||
Commande.Connection.Close();
|
||||
return res;
|
||||
}
|
||||
public C_T_plat Lire_ID(int ID_plat)
|
||||
{
|
||||
CreerCommande("SelectionnerT_plat_ID");
|
||||
Commande.Parameters.AddWithValue("@ID_plat", ID_plat);
|
||||
|
|
|
@ -74,7 +74,7 @@ namespace ProjetTheAlone.Acces
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// resume de <c>Lire</c>
|
||||
/// Permet de récupérer les repas entre deux date
|
||||
/// </summary>
|
||||
/// <param name="start">Date filtre debut compris</param>
|
||||
/// <param name="end">Date fin non compris</param>
|
||||
|
@ -100,6 +100,11 @@ namespace ProjetTheAlone.Acces
|
|||
Commande.Connection.Close();
|
||||
return res;
|
||||
}
|
||||
/// <summary>
|
||||
/// Permet de récupérer les repas d'une date donnée
|
||||
/// </summary>
|
||||
/// <param name="dateV">Date filtre</param>
|
||||
|
||||
public List<C_T_repa> Lire(DateTime dateV)
|
||||
{
|
||||
CreerCommande("SelectEventBetweenTwoDateTime");
|
||||
|
|
|
@ -16,19 +16,19 @@ namespace ProjetTheAlone.Classes
|
|||
private string _B_nom;
|
||||
private string _B_prenom;
|
||||
private DateTime? _B_anniversaire;
|
||||
private string _B_img;
|
||||
private byte?[] _B_img;
|
||||
#endregion
|
||||
#region Constructeurs
|
||||
public C_T_beneficiaire()
|
||||
{ }
|
||||
public C_T_beneficiaire(string B_nom_, string B_prenom_, DateTime? B_anniversaire_, string B_img_)
|
||||
public C_T_beneficiaire(string B_nom_, string B_prenom_, DateTime? B_anniversaire_, byte?[] B_img_)
|
||||
{
|
||||
B_nom = B_nom_;
|
||||
B_prenom = B_prenom_;
|
||||
B_anniversaire = B_anniversaire_;
|
||||
B_img = B_img_;
|
||||
}
|
||||
public C_T_beneficiaire(int ID_beneficiaire_, string B_nom_, string B_prenom_, DateTime? B_anniversaire_, string B_img_)
|
||||
public C_T_beneficiaire(int ID_beneficiaire_, string B_nom_, string B_prenom_, DateTime? B_anniversaire_, byte?[] B_img_)
|
||||
: this(B_nom_, B_prenom_, B_anniversaire_, B_img_)
|
||||
{
|
||||
ID_beneficiaire = ID_beneficiaire_;
|
||||
|
@ -55,7 +55,7 @@ namespace ProjetTheAlone.Classes
|
|||
get { return _B_anniversaire; }
|
||||
set { _B_anniversaire = value; }
|
||||
}
|
||||
public string B_img
|
||||
public byte?[] B_img
|
||||
{
|
||||
get { return _B_img; }
|
||||
set { _B_img = value; }
|
||||
|
|
|
@ -21,9 +21,9 @@ namespace ProjetTheAlone.Gestion
|
|||
: base(sChaineConnexion)
|
||||
{ }
|
||||
#endregion
|
||||
public int Ajouter(string B_nom, string B_prenom, DateTime? B_anniversaire, string B_img)
|
||||
public int Ajouter(string B_nom, string B_prenom, DateTime? B_anniversaire, byte?[] B_img)
|
||||
{ return new A_T_beneficiaire(ChaineConnexion).Ajouter(B_nom, B_prenom, B_anniversaire, B_img); }
|
||||
public int Modifier(int ID_beneficiaire, string B_nom, string B_prenom, DateTime? B_anniversaire, string B_img)
|
||||
public int Modifier(int ID_beneficiaire, string B_nom, string B_prenom, DateTime? B_anniversaire, byte?[] B_img)
|
||||
{ return new A_T_beneficiaire(ChaineConnexion).Modifier(ID_beneficiaire, B_nom, B_prenom, B_anniversaire, B_img); }
|
||||
public List<C_T_beneficiaire> Lire(string Index)
|
||||
{ return new A_T_beneficiaire(ChaineConnexion).Lire(Index); }
|
||||
|
|
|
@ -29,7 +29,12 @@ namespace ProjetTheAlone.Gestion
|
|||
{ return new A_T_plat(ChaineConnexion).Lire(Index); }
|
||||
public C_T_plat Lire_ID(int ID_plat)
|
||||
{ return new A_T_plat(ChaineConnexion).Lire_ID(ID_plat); }
|
||||
public int Supprimer(int ID_plat)
|
||||
/// <summary>
|
||||
/// Permet de récupérer la liste des plats d'un repas
|
||||
/// </summary>
|
||||
public List<C_T_plat> ListPlat(int ID_repa)
|
||||
{ return new A_T_plat(ChaineConnexion).ListPlat(ID_repa); }
|
||||
public int Supprimer(int ID_plat)
|
||||
{ return new A_T_plat(ChaineConnexion).Supprimer(ID_plat); }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,19 @@ namespace ProjetTheAlone.Gestion
|
|||
{ return new A_T_repa(ChaineConnexion).Modifier(ID_repa, ID_listPlat, ID_typeRepa , R_Date); }
|
||||
public List<C_T_repa> Lire(string Index)
|
||||
{ return new A_T_repa(ChaineConnexion).Lire(Index); }
|
||||
/// <summary>
|
||||
/// Permet de récupérer les repas entre deux date
|
||||
/// </summary>
|
||||
/// <param name="start">Date filtre debut compris</param>
|
||||
/// <param name="end">Date fin non compris</param>
|
||||
public List<C_T_repa> Lire(DateTime start, DateTime end)
|
||||
{ return new A_T_repa(ChaineConnexion).Lire(start, end); }
|
||||
/// <summary>
|
||||
/// Permet de récupérer les repas d'une date donnée
|
||||
/// </summary>
|
||||
/// <param name="dateV">Date filtre</param>
|
||||
public List<C_T_repa> Lire(DateTime dateV)
|
||||
{ return new A_T_repa(ChaineConnexion).Lire(dateV); }
|
||||
public C_T_repa Lire_ID(int ID_repa)
|
||||
{ return new A_T_repa(ChaineConnexion).Lire_ID(ID_repa); }
|
||||
public int Supprimer(int ID_repa)
|
||||
|
|
|
@ -82,6 +82,10 @@
|
|||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="Converter\BinaryImageConverter.cs" />
|
||||
<Compile Include="ViewModel\PlatsEncode.cs" />
|
||||
<Compile Include="View\FicEncodePlat.xaml.cs">
|
||||
<DependentUpon>FicEncodePlat.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Model\A_Base.cs" />
|
||||
<Compile Include="Model\A_T_beneficiaire.cs" />
|
||||
<Compile Include="Model\A_T_equipe.cs" />
|
||||
|
@ -157,6 +161,10 @@
|
|||
<Compile Include="View\FicRepasEncode.xaml.cs">
|
||||
<DependentUpon>FicRepasEncode.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Page Include="View\FicEncodePlat.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="MainWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Ce code a été généré par un outil.
|
||||
// Version du runtime :4.0.30319.42000
|
||||
//
|
||||
// Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si
|
||||
// le code est régénéré.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace ProjetTheAlone {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.5.0.0")]
|
||||
internal sealed partial class Settings1 : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings1 defaultInstance = ((Settings1)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings1())));
|
||||
|
||||
public static Settings1 Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("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")]
|
||||
public string schCon {
|
||||
get {
|
||||
return ((string)(this["schCon"]));
|
||||
}
|
||||
set {
|
||||
this["schCon"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="ProjetTheAlone" GeneratedClassName="Settings1">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="schCon" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">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</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
|
@ -22,6 +22,7 @@ namespace ProjetTheAlone.View
|
|||
public Accueil()
|
||||
{
|
||||
InitializeComponent();
|
||||
Settings1.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 static bool openaffichage = false;
|
||||
private static bool openencodage = false;
|
||||
|
|
|
@ -29,17 +29,16 @@
|
|||
<TextBlock x:Name="tNom" Text="Nom" Grid.Row="2" VerticalAlignment="Center" />
|
||||
<TextBox x:Name="tbNom" Grid.Row="2" Grid.Column="1" Margin="3"
|
||||
Text="{Binding UnBeneficiaire.Nom, Mode=TwoWay}" />
|
||||
<TextBlock x:Name="tNai" Text="Date Naissance" Grid.Row="3" VerticalAlignment="Center" />
|
||||
<DatePicker x:Name="dpNai" Grid.Row="3" Grid.Column="1" Margin="3"
|
||||
Text="{Binding UnBeneficiaire.Nai, Mode=TwoWay}"
|
||||
DisplayDate="{Binding UnBeneficiaire.Nai, Mode=TwoWay}" />
|
||||
<TextBlock x:Name="tAnnif" Text="Date Naissance" Grid.Row="3" VerticalAlignment="Center" />
|
||||
<DatePicker x:Name="dpAnnif" Grid.Row="3" Grid.Column="1" Margin="3"
|
||||
SelectedDate="{Binding UnBeneficiaire.Annif, Mode=TwoWay}" />
|
||||
<TextBlock x:Name="tImg" Text="Photo" Grid.Row="4" VerticalAlignment="Center" Margin="0,56,0,10" />
|
||||
<DockPanel Margin="10,10,10,10" Grid.Row="4" Grid.Column="1">
|
||||
<WrapPanel HorizontalAlignment="Right" DockPanel.Dock="Top" >
|
||||
<Image x:Name="ImageFile" Height="40" HorizontalAlignment="Right" VerticalAlignment="Top" Width="90"/>
|
||||
<Button x:Name="btnOpenFile" HorizontalAlignment="Right" Click="btnOpenFile_Click" Content="Open file"/>
|
||||
</WrapPanel>
|
||||
<TextBox x:Name="txtEditor" />
|
||||
<TextBox x:Name="txtEditor" Text="{Binding UnBeneficiaire.Img, Mode=TwoWay}"/>
|
||||
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace ProjetTheAlone.View
|
|||
public FicBeneficiaireEncode()
|
||||
{
|
||||
InitializeComponent();
|
||||
// DataContext = new ViewModel.VM_Beneficiaire();
|
||||
DataContext = new ViewModel.VM_Beneficiaire();
|
||||
}
|
||||
|
||||
private void BtnQuitter_Click(object sender, RoutedEventArgs e)
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
<Window x:Class="ProjetTheAlone.FicEncodePlat"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:ProjetTheAlone"
|
||||
mc:Ignorable="d"
|
||||
Title="Plats" Height="482.167" Width="955.5" WindowStartupLocation="CenterScreen" WindowStyle="None">
|
||||
<Grid Margin="0,-3,2,2">
|
||||
<Grid.RowDefinitions>
|
||||
|
||||
</Grid.RowDefinitions>
|
||||
<Label Content="Plats" HorizontalAlignment="Left" Margin="31,20,0,0" VerticalAlignment="Top" FontFamily="Calibri" FontSize="20"/>
|
||||
<Grid x:Name="UneFiche" IsEnabled="{Binding ActiverUneFiche, Mode=OneWay}" Margin="515,82,139,258" >
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock x:Name="tNom" Text="Nom" Grid.Row="2" VerticalAlignment="Center" />
|
||||
<TextBox x:Name="tbNom" Grid.Row="2" Grid.Column="1" Margin="3"
|
||||
Text="{Binding UnPlat.Nom, Mode=TwoWay}" />
|
||||
<TextBlock x:Name="tImg" Text="Photo" Grid.Row="4" VerticalAlignment="Center" Margin="0,56,0,10" />
|
||||
<DockPanel Margin="10,10,10,10" Grid.Row="4" Grid.Column="1">
|
||||
<WrapPanel HorizontalAlignment="Right" DockPanel.Dock="Top" >
|
||||
<Image x:Name="ImageFile" Height="40" HorizontalAlignment="Right" VerticalAlignment="Top" Width="90"/>
|
||||
<Button x:Name="btnOpenFile" HorizontalAlignment="Right" Click="btnOpenFile_Click" Content="Open file"/>
|
||||
</WrapPanel>
|
||||
<TextBox x:Name="txtEditor" Text="{Binding UnPlat.Img, Mode=TwoWay}"/>
|
||||
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="678,237,78,140" Width="190">
|
||||
<Button x:Name="bConfirmer" Content="Confirmer" Margin="3" IsEnabled="{Binding ActiverUneFiche, Mode=OneWay}"
|
||||
Command="{Binding cConfirmer}" />
|
||||
<Button x:Name="bAnnuler" Content="Annuler" Margin="3,16,3,17" IsEnabled="{Binding ActiverUneFiche, Mode=OneWay}"
|
||||
Command="{Binding cAnnuler}" />
|
||||
</StackPanel>
|
||||
<DataGrid ItemsSource="{Binding BcpBeneficiaire}" VerticalScrollBarVisibility="Visible"
|
||||
IsReadOnly="True" AutoGenerateColumns="False" IsEnabled="{Binding ActiverBcpFiche, Mode=OneWay}"
|
||||
SelectedItem="{Binding BeneficiaireSelectionnee, Mode=TwoWay}" Margin="126,86,605,140" >
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Visibility="Hidden" Binding="{Binding ID}" />
|
||||
<DataGridTextColumn Header="Nom du plat" Binding="{Binding Nom}" Width="*" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="88,331,576,46" Width="282">
|
||||
<Button x:Name="bAjouter" Content="Ajouter" Margin="3" IsEnabled="{Binding ActiverBcpFiche, Mode=OneWay}"
|
||||
Command="{Binding cAjouter}" />
|
||||
<Button x:Name="bModifier" Content="Modifier" Margin="3" IsEnabled="{Binding ActiverBcpFiche, Mode=OneWay}"
|
||||
Command="{Binding cModifier}" />
|
||||
<Button x:Name="bSupprimer" Content="Supprimer" Margin="3" IsEnabled="{Binding ActiverBcpFiche, Mode=OneWay}"
|
||||
Command="{Binding cSupprimer}" />
|
||||
</StackPanel>
|
||||
<Button x:Name="BtnQuitter" Content="Quitter" HorizontalAlignment="Left" Margin="810,403,0,0" VerticalAlignment="Top" Width="92" Click="BtnQuitter_Click" Height="26"/>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
|
@ -0,0 +1,56 @@
|
|||
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;
|
||||
using System.IO;
|
||||
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace ProjetTheAlone
|
||||
{
|
||||
/// <summary>
|
||||
/// Logique d'interaction pour FicEncodePlat.xaml
|
||||
/// </summary>
|
||||
public partial class FicEncodePlat : Window
|
||||
{
|
||||
public FicEncodePlat()
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = new ViewModel.VM_Plat();
|
||||
}
|
||||
|
||||
private void BtnQuitter_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
private void btnOpenFile_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
OpenFileDialog openFileDialog = new OpenFileDialog();
|
||||
openFileDialog.Filter = "Image files (*.png;*.jpeg)|*.png;*.jpeg|All files (*.*)|*.*";
|
||||
if (openFileDialog.ShowDialog() == true)
|
||||
{
|
||||
string FileName = openFileDialog.FileName;
|
||||
|
||||
txtEditor.Text = FileName;
|
||||
|
||||
//FileStream fs = new System.IO.FileStream(@""+FileName+"", FileMode.Open, FileAccess.Read);
|
||||
//BinaryReader br = new BinaryReader(fs);
|
||||
//byte[] result = br.ReadBytes((int)fs.Length);
|
||||
|
||||
ImageFile.Source = new BitmapImage(new Uri(@"" + FileName + ""));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -10,7 +10,7 @@
|
|||
<Button x:Name="btnQuitter" Margin="974,414,29,25"
|
||||
Content="Quitter" RenderTransformOrigin="0.017,0.519" Click="btnQuitter_Click" Height="Auto"/>
|
||||
|
||||
<StackPanel Margin="544,117,444,202">
|
||||
<StackPanel Margin="574,117,414,202">
|
||||
<Label Content="Type de plat" FontFamily="Calibri" FontSize="16" Height="40"/>
|
||||
<CheckBox Name="CheckSoupe" Content="Soupe" FontFamily="Calibri" FontSize="14" Height="40" Checked="CheckSoupe_Checked"/>
|
||||
<CheckBox Name="CheckPlatP" Content="Plat principal" FontFamily="Calibri" FontSize="14" Height="40" Checked="CheckPlatP_Checked"/>
|
||||
|
@ -18,7 +18,7 @@
|
|||
</StackPanel>
|
||||
|
||||
<Calendar HorizontalAlignment="Left" Margin="51,103,0,0" VerticalAlignment="Top"/>
|
||||
<ListView x:Name="lvPlat" Margin="352,107,609,215">
|
||||
<ListView x:Name="lvPlat" Margin="382,107,579,215">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn Width="160" Header="Plats"/>
|
||||
|
@ -27,6 +27,26 @@
|
|||
</ListView.View>
|
||||
</ListView>
|
||||
<Label Content="Repas" HorizontalAlignment="Left" Margin="51,30,0,0" VerticalAlignment="Top" FontFamily="Calibri" FontSize="20"/>
|
||||
<Button x:Name="btnPlat" Margin="382,309,566,126"
|
||||
Content="Nouveau Plat" Click="btnPlat_Click" Height="Auto"/>
|
||||
<ListView x:Name="lvRepas" Margin="734,107,29,126">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn Width="120" Header="Soupe"/>
|
||||
<GridViewColumn Width="120" Header="Plat"/>
|
||||
<GridViewColumn Width="120" Header="Dessert"/>
|
||||
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="687,304,29,82" Width="414">
|
||||
<Button x:Name="bAjouter" Content="Ajouter Repas" Margin="3" IsEnabled="{Binding ActiverBcpFiche, Mode=OneWay}"
|
||||
Command="{Binding cAjouter}" />
|
||||
<Button x:Name="bModifier" Content="Modifier Repas" Margin="3" IsEnabled="{Binding ActiverBcpFiche, Mode=OneWay}"
|
||||
Command="{Binding cModifier}" />
|
||||
<Button x:Name="bSupprimer" Content="Supprimer Repas" Margin="3" IsEnabled="{Binding ActiverBcpFiche, Mode=OneWay}"
|
||||
Command="{Binding cSupprimer}" />
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
|
@ -46,5 +46,11 @@ namespace ProjetTheAlone.View
|
|||
CheckPlatP.IsChecked = false;
|
||||
CheckSoupe.IsChecked = false;
|
||||
}
|
||||
|
||||
private void btnPlat_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
FicEncodePlat w = new FicEncodePlat();
|
||||
w.ShowDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,169 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.ComponentModel;
|
||||
using ProjetTheAlone.Classes;
|
||||
using ProjetTheAlone.Gestion;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace ProjetTheAlone.ViewModel
|
||||
{
|
||||
public class VM_Beneficiaire : BasePropriete
|
||||
{
|
||||
#region Données Écran
|
||||
private string chConnexion = Settings1.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 int nAjout;
|
||||
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); }
|
||||
}
|
||||
private C_T_beneficiaire _BeneficiaireSelectionnee;
|
||||
public C_T_beneficiaire BeneficiaireSelectionnee
|
||||
{
|
||||
get { return _BeneficiaireSelectionnee; }
|
||||
set { AssignerChamp<C_T_beneficiaire>(ref _BeneficiaireSelectionnee, value, System.Reflection.MethodBase.GetCurrentMethod().Name); }
|
||||
}
|
||||
#endregion
|
||||
#region Données extérieures
|
||||
private VM_UnBeneficiaire _UnBeneficiaire;
|
||||
public VM_UnBeneficiaire UnBeneficiaire
|
||||
{
|
||||
get { return _UnBeneficiaire; }
|
||||
set { AssignerChamp<VM_UnBeneficiaire>(ref _UnBeneficiaire, value, System.Reflection.MethodBase.GetCurrentMethod().Name); }
|
||||
}
|
||||
private ObservableCollection<C_T_beneficiaire> _BcpBeneficiaires= new ObservableCollection<C_T_beneficiaire>();
|
||||
public ObservableCollection<C_T_beneficiaire> BcpBeneficiaires
|
||||
{
|
||||
get { return _BcpBeneficiaires; }
|
||||
set { _BcpBeneficiaires = value; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
public VM_Beneficiaire()
|
||||
{
|
||||
UnBeneficiaire = new VM_UnBeneficiaire();
|
||||
UnBeneficiaire.ID = 0;
|
||||
UnBeneficiaire.Pre = "Prenom";
|
||||
UnBeneficiaire.Nom = "Nom";
|
||||
UnBeneficiaire.Annif = DateTime.Now.Date;
|
||||
BcpBeneficiaires = ChargerPersonnes(chConnexion);
|
||||
ActiverUneFiche = false;
|
||||
cConfirmer = new BaseCommande(Confirmer);
|
||||
cAnnuler = new BaseCommande(Annuler);
|
||||
cAjouter = new BaseCommande(Ajouter);
|
||||
cModifier = new BaseCommande(Modifier);
|
||||
cSupprimer = new BaseCommande(Supprimer);
|
||||
}
|
||||
|
||||
#region Commandes
|
||||
public BaseCommande cConfirmer { get; set; }
|
||||
public BaseCommande cAnnuler { get; set; }
|
||||
public BaseCommande cAjouter { get; set; }
|
||||
public BaseCommande cModifier { get; set; }
|
||||
public BaseCommande cSupprimer { get; set; }
|
||||
#endregion
|
||||
|
||||
private ObservableCollection<C_T_beneficiaire> ChargerPersonnes(string chConn)
|
||||
{
|
||||
ObservableCollection<C_T_beneficiaire> rep = new ObservableCollection<C_T_beneficiaire>();
|
||||
List<C_T_beneficiaire> lTmp = new G_T_beneficiaire(chConn).Lire("B_nom");
|
||||
foreach (C_T_beneficiaire Tmp in lTmp)
|
||||
rep.Add(Tmp);
|
||||
return rep;
|
||||
}
|
||||
|
||||
public void Confirmer()
|
||||
{
|
||||
if (nAjout == -1)
|
||||
{
|
||||
UnBeneficiaire.ID = new G_T_beneficiaire(chConnexion).Ajouter(UnBeneficiaire.Nom, UnBeneficiaire.Pre, UnBeneficiaire.Annif, UnBeneficiaire.Img);
|
||||
BcpBeneficiaires.Add(new C_T_beneficiaire(UnBeneficiaire.ID, UnBeneficiaire.Nom, UnBeneficiaire.Pre, UnBeneficiaire.Annif, UnBeneficiaire.Img));
|
||||
}
|
||||
else
|
||||
{
|
||||
new G_T_beneficiaire(chConnexion).Modifier(UnBeneficiaire.ID, UnBeneficiaire.Nom, UnBeneficiaire.Pre, UnBeneficiaire.Annif, UnBeneficiaire.Img);
|
||||
BcpBeneficiaires[nAjout] = new C_T_beneficiaire(UnBeneficiaire.ID, UnBeneficiaire.Nom, UnBeneficiaire.Pre, UnBeneficiaire.Annif, UnBeneficiaire.Img);
|
||||
}
|
||||
ActiverUneFiche = false;
|
||||
}
|
||||
public void Annuler()
|
||||
{ ActiverUneFiche = false; }
|
||||
public void Ajouter()
|
||||
{
|
||||
UnBeneficiaire = new VM_UnBeneficiaire();
|
||||
nAjout = -1;
|
||||
ActiverUneFiche = true;
|
||||
}
|
||||
public void Modifier()
|
||||
{
|
||||
if (BeneficiaireSelectionnee != null)
|
||||
{
|
||||
C_T_beneficiaire Tmp = new G_T_beneficiaire(chConnexion).Lire_ID(BeneficiaireSelectionnee.ID_beneficiaire);
|
||||
|
||||
UnBeneficiaire = new VM_UnBeneficiaire();
|
||||
UnBeneficiaire.ID = Tmp.ID_beneficiaire;
|
||||
UnBeneficiaire.Pre = Tmp.B_prenom;
|
||||
UnBeneficiaire.Nom = Tmp.B_nom;
|
||||
UnBeneficiaire.Annif = Tmp.B_anniversaire.Value;
|
||||
UnBeneficiaire.Img = Tmp.B_img;
|
||||
nAjout = BcpBeneficiaires.IndexOf(BeneficiaireSelectionnee);
|
||||
ActiverUneFiche = true;
|
||||
}
|
||||
}
|
||||
public void Supprimer()
|
||||
{
|
||||
if (BeneficiaireSelectionnee != null)
|
||||
{
|
||||
new G_T_beneficiaire(chConnexion).Supprimer(BeneficiaireSelectionnee.ID_beneficiaire);
|
||||
BcpBeneficiaires.Remove(BeneficiaireSelectionnee);
|
||||
}
|
||||
}
|
||||
}
|
||||
public class VM_UnBeneficiaire : BasePropriete
|
||||
{
|
||||
private int _ID;
|
||||
private string _Nom, _Pre,_Img;
|
||||
private DateTime _Annif;
|
||||
|
||||
public int ID
|
||||
{
|
||||
get { return _ID; }
|
||||
set { AssignerChamp<int>(ref _ID, value, System.Reflection.MethodBase.GetCurrentMethod().Name); }
|
||||
}
|
||||
public string Pre
|
||||
{
|
||||
get { return _Pre; }
|
||||
set { AssignerChamp<string>(ref _Pre, value, System.Reflection.MethodBase.GetCurrentMethod().Name); }
|
||||
}
|
||||
public string Nom
|
||||
{
|
||||
get { return _Nom; }
|
||||
set { AssignerChamp<string>(ref _Nom, value, System.Reflection.MethodBase.GetCurrentMethod().Name); }
|
||||
}
|
||||
public DateTime Annif
|
||||
{
|
||||
get { return _Annif; }
|
||||
set { AssignerChamp<DateTime>(ref _Annif, value, System.Reflection.MethodBase.GetCurrentMethod().Name); }
|
||||
}
|
||||
|
||||
public string Img
|
||||
{
|
||||
get { return _Img; }
|
||||
set { AssignerChamp<string>(ref _Img, value, System.Reflection.MethodBase.GetCurrentMethod().Name); }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,164 @@
|
|||
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;
|
||||
|
||||
namespace ProjetTheAlone.ViewModel
|
||||
{
|
||||
|
||||
public class VM_Plat : BasePropriete
|
||||
{
|
||||
#region Données Écran
|
||||
private string chConnexion = Settings1.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 int nAjout;
|
||||
private int typeplat=0;
|
||||
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); }
|
||||
}
|
||||
private C_T_plat _PlatSelectionnee;
|
||||
public C_T_plat PlatSelectionnee
|
||||
{
|
||||
get { return _PlatSelectionnee; }
|
||||
set { AssignerChamp<C_T_plat>(ref _PlatSelectionnee, value, System.Reflection.MethodBase.GetCurrentMethod().Name); }
|
||||
}
|
||||
#endregion
|
||||
#region Données extérieures
|
||||
private VM_UnPlat _UnPlat;
|
||||
public VM_UnPlat UnPlat
|
||||
{
|
||||
get { return _UnPlat; }
|
||||
set { AssignerChamp<VM_UnPlat>(ref _UnPlat, value, System.Reflection.MethodBase.GetCurrentMethod().Name); }
|
||||
}
|
||||
private ObservableCollection<C_T_plat> _BcpPlats = new ObservableCollection<C_T_plat>();
|
||||
public ObservableCollection<C_T_plat> BcpPlats
|
||||
{
|
||||
get { return _BcpPlats; }
|
||||
set { _BcpPlats = value; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
public VM_Plat()
|
||||
{
|
||||
UnPlat = new VM_UnPlat();
|
||||
UnPlat.ID = 0;
|
||||
UnPlat.Nom = "Nom du plat";
|
||||
BcpPlats = ChargerPersonnes(chConnexion);
|
||||
ActiverUneFiche = false;
|
||||
cConfirmer = new BaseCommande(Confirmer);
|
||||
cAnnuler = new BaseCommande(Annuler);
|
||||
cAjouter = new BaseCommande(Ajouter);
|
||||
cModifier = new BaseCommande(Modifier);
|
||||
cSupprimer = new BaseCommande(Supprimer);
|
||||
}
|
||||
|
||||
#region Commandes
|
||||
public BaseCommande cConfirmer { get; set; }
|
||||
public BaseCommande cAnnuler { get; set; }
|
||||
public BaseCommande cAjouter { get; set; }
|
||||
public BaseCommande cModifier { get; set; }
|
||||
public BaseCommande cSupprimer { get; set; }
|
||||
#endregion
|
||||
|
||||
private ObservableCollection<C_T_plat> ChargerPersonnes(string chConn)
|
||||
{
|
||||
ObservableCollection<C_T_plat> rep = new ObservableCollection<C_T_plat>();
|
||||
List<C_T_plat> lTmp = new G_T_plat(chConn).Lire("B_nom");
|
||||
foreach (C_T_plat Tmp in lTmp)
|
||||
rep.Add(Tmp);
|
||||
return rep;
|
||||
}
|
||||
|
||||
public void Confirmer()
|
||||
{
|
||||
if (nAjout == -1)
|
||||
{
|
||||
UnPlat.ID = new G_T_plat(chConnexion).Ajouter(UnPlat.Nom, UnPlat.Img,typeplat);
|
||||
BcpPlats.Add(new C_T_plat(UnPlat.ID, UnPlat.Nom, UnPlat.Img,typeplat));
|
||||
}
|
||||
else
|
||||
{
|
||||
new G_T_plat(chConnexion).Modifier(UnPlat.ID, UnPlat.Nom, UnPlat.Img,typeplat);
|
||||
BcpPlats[nAjout] = new C_T_plat(UnPlat.ID, UnPlat.Nom, UnPlat.Img, typeplat);
|
||||
}
|
||||
ActiverUneFiche = false;
|
||||
}
|
||||
public void Annuler()
|
||||
{ ActiverUneFiche = false; }
|
||||
public void Ajouter()
|
||||
{
|
||||
UnPlat = new VM_UnPlat();
|
||||
nAjout = -1;
|
||||
ActiverUneFiche = true;
|
||||
}
|
||||
public void Modifier()
|
||||
{
|
||||
if (PlatSelectionnee != null)
|
||||
{
|
||||
C_T_plat Tmp = new G_T_plat(chConnexion).Lire_ID(PlatSelectionnee.ID_plat);
|
||||
|
||||
UnPlat = new VM_UnPlat();
|
||||
UnPlat.ID = Tmp.ID_plat;
|
||||
UnPlat.Nom = Tmp.P_nom;
|
||||
UnPlat.Img = Tmp.P_img;
|
||||
nAjout = BcpPlats.IndexOf(PlatSelectionnee);
|
||||
ActiverUneFiche = true;
|
||||
}
|
||||
}
|
||||
public void Supprimer()
|
||||
{
|
||||
if (PlatSelectionnee != null)
|
||||
{
|
||||
new G_T_plat(chConnexion).Supprimer(PlatSelectionnee.ID_plat);
|
||||
BcpPlats.Remove(PlatSelectionnee);
|
||||
}
|
||||
}
|
||||
}
|
||||
public class VM_UnPlat : BasePropriete
|
||||
{
|
||||
private int _ID,_TypePlat;
|
||||
private string _Nom;
|
||||
private byte[] _Img;
|
||||
|
||||
public int ID
|
||||
{
|
||||
get { return _ID; }
|
||||
set { AssignerChamp<int>(ref _ID, value, System.Reflection.MethodBase.GetCurrentMethod().Name); }
|
||||
}
|
||||
|
||||
public string Nom
|
||||
{
|
||||
get { return _Nom; }
|
||||
set { AssignerChamp<string>(ref _Nom, value, System.Reflection.MethodBase.GetCurrentMethod().Name); }
|
||||
}
|
||||
|
||||
public byte[] Img
|
||||
{
|
||||
get { return _Img; }
|
||||
set { AssignerChamp<byte[]> (ref _Img, value, System.Reflection.MethodBase.GetCurrentMethod().Name); }
|
||||
}
|
||||
|
||||
public int TypePlat
|
||||
{
|
||||
get { return _TypePlat; }
|
||||
set { AssignerChamp<int>(ref _TypePlat, value, System.Reflection.MethodBase.GetCurrentMethod().Name); }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,165 @@
|
|||
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;
|
||||
|
||||
namespace ProjetTheAlone.ViewModel
|
||||
{
|
||||
|
||||
public class VM_Plat : BasePropriete
|
||||
{
|
||||
#region Données Écran
|
||||
|
||||
private string chConnexion = Settings1.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 int nAjout;
|
||||
private int typeplat=0;
|
||||
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); }
|
||||
}
|
||||
private C_T_plat _PlatSelectionnee;
|
||||
public C_T_plat PlatSelectionnee
|
||||
{
|
||||
get { return _PlatSelectionnee; }
|
||||
set { AssignerChamp<C_T_plat>(ref _PlatSelectionnee, value, System.Reflection.MethodBase.GetCurrentMethod().Name); }
|
||||
}
|
||||
#endregion
|
||||
#region Données extérieures
|
||||
private VM_UnPlat _UnPlat;
|
||||
public VM_UnPlat UnPlat
|
||||
{
|
||||
get { return _UnPlat; }
|
||||
set { AssignerChamp<VM_UnPlat>(ref _UnPlat, value, System.Reflection.MethodBase.GetCurrentMethod().Name); }
|
||||
}
|
||||
private ObservableCollection<C_T_plat> _BcpPlats = new ObservableCollection<C_T_plat>();
|
||||
public ObservableCollection<C_T_plat> BcpPlats
|
||||
{
|
||||
get { return _BcpPlats; }
|
||||
set { _BcpPlats = value; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
public VM_Plat()
|
||||
{
|
||||
UnPlat = new VM_UnPlat();
|
||||
UnPlat.ID = 0;
|
||||
UnPlat.Nom = "Nom du plat";
|
||||
BcpPlats = ChargerPersonnes(chConnexion);
|
||||
ActiverUneFiche = false;
|
||||
cConfirmer = new BaseCommande(Confirmer);
|
||||
cAnnuler = new BaseCommande(Annuler);
|
||||
cAjouter = new BaseCommande(Ajouter);
|
||||
cModifier = new BaseCommande(Modifier);
|
||||
cSupprimer = new BaseCommande(Supprimer);
|
||||
}
|
||||
|
||||
#region Commandes
|
||||
public BaseCommande cConfirmer { get; set; }
|
||||
public BaseCommande cAnnuler { get; set; }
|
||||
public BaseCommande cAjouter { get; set; }
|
||||
public BaseCommande cModifier { get; set; }
|
||||
public BaseCommande cSupprimer { get; set; }
|
||||
#endregion
|
||||
|
||||
private ObservableCollection<C_T_plat> ChargerPersonnes(string chConn)
|
||||
{
|
||||
ObservableCollection<C_T_plat> rep = new ObservableCollection<C_T_plat>();
|
||||
List<C_T_plat> lTmp = new G_T_plat(chConn).Lire("B_nom");
|
||||
foreach (C_T_plat Tmp in lTmp)
|
||||
rep.Add(Tmp);
|
||||
return rep;
|
||||
}
|
||||
|
||||
public void Confirmer()
|
||||
{
|
||||
if (nAjout == -1)
|
||||
{
|
||||
UnPlat.ID = new G_T_plat(chConnexion).Ajouter(UnPlat.Nom, UnPlat.Img,typeplat);
|
||||
BcpPlats.Add(new C_T_plat(UnPlat.ID, UnPlat.Nom, UnPlat.Img,typeplat));
|
||||
}
|
||||
else
|
||||
{
|
||||
new G_T_plat(chConnexion).Modifier(UnPlat.ID, UnPlat.Nom, UnPlat.Img,typeplat);
|
||||
BcpPlats[nAjout] = new C_T_plat(UnPlat.ID, UnPlat.Nom, UnPlat.Img, typeplat);
|
||||
}
|
||||
ActiverUneFiche = false;
|
||||
}
|
||||
public void Annuler()
|
||||
{ ActiverUneFiche = false; }
|
||||
public void Ajouter()
|
||||
{
|
||||
UnPlat = new VM_UnPlat();
|
||||
nAjout = -1;
|
||||
ActiverUneFiche = true;
|
||||
}
|
||||
public void Modifier()
|
||||
{
|
||||
if (PlatSelectionnee != null)
|
||||
{
|
||||
C_T_plat Tmp = new G_T_plat(chConnexion).Lire_ID(PlatSelectionnee.ID_plat);
|
||||
|
||||
UnPlat = new VM_UnPlat();
|
||||
UnPlat.ID = Tmp.ID_plat;
|
||||
UnPlat.Nom = Tmp.P_nom;
|
||||
UnPlat.Img = Tmp.P_img;
|
||||
nAjout = BcpPlats.IndexOf(PlatSelectionnee);
|
||||
ActiverUneFiche = true;
|
||||
}
|
||||
}
|
||||
public void Supprimer()
|
||||
{
|
||||
if (PlatSelectionnee != null)
|
||||
{
|
||||
new G_T_plat(chConnexion).Supprimer(PlatSelectionnee.ID_plat);
|
||||
BcpPlats.Remove(PlatSelectionnee);
|
||||
}
|
||||
}
|
||||
}
|
||||
public class VM_UnPlat : BasePropriete
|
||||
{
|
||||
private int _ID,_TypePlat;
|
||||
private string _Nom;
|
||||
private byte[] _Img;
|
||||
|
||||
public int ID
|
||||
{
|
||||
get { return _ID; }
|
||||
set { AssignerChamp<int>(ref _ID, value, System.Reflection.MethodBase.GetCurrentMethod().Name); }
|
||||
}
|
||||
|
||||
public string Nom
|
||||
{
|
||||
get { return _Nom; }
|
||||
set { AssignerChamp<string>(ref _Nom, value, System.Reflection.MethodBase.GetCurrentMethod().Name); }
|
||||
}
|
||||
|
||||
public byte[] Img
|
||||
{
|
||||
get { return _Img; }
|
||||
set { AssignerChamp<byte[]> (ref _Img, value, System.Reflection.MethodBase.GetCurrentMethod().Name); }
|
||||
}
|
||||
|
||||
public int TypePlat
|
||||
{
|
||||
get { return _TypePlat; }
|
||||
set { AssignerChamp<int>(ref _TypePlat, value, System.Reflection.MethodBase.GetCurrentMethod().Name); }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
/*
|
||||
EEEEEEEEEEEEEEEEEEEEEEVVVVVVVV VVVVVVVVEEEEEEEEEEEEEEEEEEEEEENNNNNNNN NNNNNNNNTTTTTTTTTTTTTTTTTTTTTTT
|
||||
E::::::::::::::::::::EV::::::V V::::::VE::::::::::::::::::::EN:::::::N N::::::NT:::::::::::::::::::::T
|
||||
E::::::::::::::::::::EV::::::V V::::::VE::::::::::::::::::::EN::::::::N N::::::NT:::::::::::::::::::::T
|
||||
EE::::::EEEEEEEEE::::EV::::::V V::::::VEE::::::EEEEEEEEE::::EN:::::::::N N::::::NT:::::TT:::::::TT:::::T
|
||||
E:::::E EEEEEE V:::::V V:::::V E:::::E EEEEEEN::::::::::N N::::::NTTTTTT T:::::T TTTTTT
|
||||
E:::::E V:::::V V:::::V E:::::E N:::::::::::N N::::::N T:::::T
|
||||
E::::::EEEEEEEEEE V:::::V V:::::V E::::::EEEEEEEEEE N:::::::N::::N N::::::N T:::::T
|
||||
E:::::::::::::::E V:::::V V:::::V E:::::::::::::::E N::::::N N::::N N::::::N T:::::T
|
||||
E:::::::::::::::E V:::::V V:::::V E:::::::::::::::E N::::::N N::::N:::::::N T:::::T
|
||||
E::::::EEEEEEEEEE V:::::V V:::::V E::::::EEEEEEEEEE N::::::N N:::::::::::N T:::::T
|
||||
E:::::E V:::::V:::::V E:::::E N::::::N N::::::::::N T:::::T
|
||||
E:::::E EEEEEE V:::::::::V E:::::E EEEEEEN::::::N N:::::::::N T:::::T
|
||||
EE::::::EEEEEEEE:::::E V:::::::V EE::::::EEEEEEEE:::::EN::::::N N::::::::N TT:::::::TT
|
||||
E::::::::::::::::::::E V:::::V E::::::::::::::::::::EN::::::N N:::::::N T:::::::::T
|
||||
E::::::::::::::::::::E V:::V E::::::::::::::::::::EN::::::N N::::::N T:::::::::T
|
||||
EEEEEEEEEEEEEEEEEEEEEE VVV EEEEEEEEEEEEEEEEEEEEEENNNNNNNN NNNNNNN TTTTTTTTTTT*/
|
||||
IF OBJECT_ID ( 'SelectEventByDate', 'P' ) IS NOT NULL
|
||||
DROP PROCEDURE SelectEventByDate;
|
||||
GO
|
||||
CREATE PROCEDURE SelectEventByDate
|
||||
@dateV date
|
||||
AS
|
||||
SELECT * FROM [ProjetThe].[dbo].[T_event] Where CAST(E_date AS DATE) = @dateV;
|
||||
RETURN
|
||||
GO
|
||||
IF OBJECT_ID ( 'SelectEventBetweenTwoDateTime', 'P' ) IS NOT NULL
|
||||
DROP PROCEDURE SelectEventBetweenTwoDateTime;
|
||||
GO
|
||||
CREATE PROCEDURE SelectEventBetweenTwoDateTime
|
||||
@dateStart datetime,
|
||||
@dateEnd datetime
|
||||
AS
|
||||
SELECT * FROM [ProjetThe].[dbo].[T_event] Where E_Date>=@dateStart AND E_Date<@dateEnd;
|
||||
RETURN
|
||||
GO
|
||||
/*
|
||||
RRRRRRRRRRRRRRRRR EEEEEEEEEEEEEEEEEEEEEEPPPPPPPPPPPPPPPPP AAA
|
||||
R::::::::::::::::R E::::::::::::::::::::EP::::::::::::::::P A:::A
|
||||
R::::::RRRRRR:::::R E::::::::::::::::::::EP::::::PPPPPP:::::P A:::::A
|
||||
RR:::::R R:::::REE::::::EEEEEEEEE::::EPP:::::P P:::::P A:::::::A
|
||||
R::::R R:::::R E:::::E EEEEEE P::::P P:::::P A:::::::::A
|
||||
R::::R R:::::R E:::::E P::::P P:::::PA:::::A:::::A
|
||||
R::::RRRRRR:::::R E::::::EEEEEEEEEE P::::PPPPPP:::::PA:::::A A:::::A
|
||||
R:::::::::::::RR E:::::::::::::::E P:::::::::::::PPA:::::A A:::::A
|
||||
R::::RRRRRR:::::R E:::::::::::::::E P::::PPPPPPPPP A:::::A A:::::A
|
||||
R::::R R:::::R E::::::EEEEEEEEEE P::::P A:::::AAAAAAAAA:::::A
|
||||
R::::R R:::::R E:::::E P::::P A:::::::::::::::::::::A
|
||||
R::::R R:::::R E:::::E EEEEEE P::::P A:::::AAAAAAAAAAAAA:::::A
|
||||
RR:::::R R:::::REE::::::EEEEEEEE:::::EPP::::::PP A:::::A A:::::A
|
||||
R::::::R R:::::RE::::::::::::::::::::EP::::::::P A:::::A A:::::A
|
||||
R::::::R R:::::RE::::::::::::::::::::EP::::::::P A:::::A A:::::A
|
||||
RRRRRRRR RRRRRRREEEEEEEEEEEEEEEEEEEEEEPPPPPPPPPPAAAAAAA AAAAAAA*/
|
||||
IF OBJECT_ID ( 'SelectRepaByDate', 'P' ) IS NOT NULL
|
||||
DROP PROCEDURE SelectRepaByDate;
|
||||
GO
|
||||
CREATE PROCEDURE SelectRepaByDate
|
||||
@dateV date
|
||||
AS
|
||||
SELECT * FROM [ProjetThe].[dbo].[T_repa] Where CAST(R_Date AS DATE) = @dateV;
|
||||
RETURN
|
||||
GO
|
||||
IF OBJECT_ID ( 'SelectRepaBetweenTwoDateTime', 'P' ) IS NOT NULL
|
||||
DROP PROCEDURE SelectRepaBetweenTwoDateTime;
|
||||
GO
|
||||
CREATE PROCEDURE SelectRepaBetweenTwoDateTime
|
||||
@dateStart datetime,
|
||||
@dateEnd datetime
|
||||
AS
|
||||
SELECT * FROM [ProjetThe].[dbo].[T_repas] Where R_Date>=@dateStart AND R_Date<@dateEnd;
|
||||
RETURN
|
||||
GO
|
||||
|
||||
IF OBJECT_ID ( 'SelectRepaBetweenTwoDateTime', 'P' ) IS NOT NULL
|
||||
DROP PROCEDURE SelectRepaBetweenTwoDateTime;
|
||||
GO
|
||||
CREATE PROCEDURE SelectRepaBetweenTwoDateTime
|
||||
@ID_repa int
|
||||
AS
|
||||
SELECT T_plat.ID_plat, T_plat.P_nom, T_plat.P_img, T_plat.ID_typePlat FROM [ProjetThe].[dbo].[T_listPlat] RIGHT JOIN T_plat ON T_listPlat.ID_repa=@ID_repa;
|
||||
RETURN
|
||||
GO
|
BIN
script.sql
BIN
script.sql
Binary file not shown.
Loading…
Reference in New Issue