From ceffc1446edd712cbc57772a7bcc854c37aa7ca4 Mon Sep 17 00:00:00 2001 From: adri Date: Thu, 24 Jan 2019 22:24:05 +0100 Subject: [PATCH] Gestion repa Ok --- ProjetTheAlone/App.config | 23 +- ProjetTheAlone/Config/Settings1.Designer.cs | 8 +- ProjetTheAlone/Config/Settings1.settings | 4 +- .../Settings2.Designer.cs} | 24 +- .../Settings2.settings} | 4 +- .../Converter/BinaryImageConverter.cs | 33 +- ProjetTheAlone/MainWindow.xaml.cs | 2 + ProjetTheAlone/Model - Copie/A_Base.cs | 86 ++++ .../Model - Copie/A_T_beneficiaire.cs | 113 +++++ ProjetTheAlone/Model - Copie/A_T_equipe.cs | 104 +++++ .../Model - Copie/A_T_event-Comp-Hugues.cs | 122 +++++ ProjetTheAlone/Model - Copie/A_T_event.cs | 122 +++++ ProjetTheAlone/Model - Copie/A_T_lieu.cs | 94 ++++ .../Model - Copie/A_T_listParticipant.cs | 100 +++++ ProjetTheAlone/Model - Copie/A_T_listPlat.cs | 117 +++++ ProjetTheAlone/Model - Copie/A_T_plat.cs | 131 ++++++ ProjetTheAlone/Model - Copie/A_T_repa.cs | 157 +++++++ .../Model - Copie/A_T_typeEvenement.cs | 96 ++++ ProjetTheAlone/Model - Copie/A_T_typePlat.cs | 94 ++++ ProjetTheAlone/Model - Copie/A_T_typeRepa.cs | 94 ++++ .../Model - Copie/C_T_beneficiaire.cs | 65 +++ ProjetTheAlone/Model - Copie/C_T_equipe.cs | 58 +++ ProjetTheAlone/Model - Copie/C_T_event.cs | 70 +++ ProjetTheAlone/Model - Copie/C_T_lieu.cs | 44 ++ .../Model - Copie/C_T_listParticipant.cs | 51 +++ ProjetTheAlone/Model - Copie/C_T_listPlat.cs | 51 +++ ProjetTheAlone/Model - Copie/C_T_plat.cs | 59 +++ ProjetTheAlone/Model - Copie/C_T_repa.cs | 56 +++ .../Model - Copie/C_T_typeEvenement.cs | 44 ++ ProjetTheAlone/Model - Copie/C_T_typePlat.cs | 44 ++ ProjetTheAlone/Model - Copie/C_T_typeRepa.cs | 44 ++ ProjetTheAlone/Model - Copie/G_Base.cs | 28 ++ .../Model - Copie/G_T_beneficiaire.cs | 35 ++ ProjetTheAlone/Model - Copie/G_T_equipe.cs | 35 ++ ProjetTheAlone/Model - Copie/G_T_event.cs | 35 ++ ProjetTheAlone/Model - Copie/G_T_lieu.cs | 35 ++ .../Model - Copie/G_T_listParticipant.cs | 35 ++ ProjetTheAlone/Model - Copie/G_T_listPlat.cs | 38 ++ ProjetTheAlone/Model - Copie/G_T_plat.cs | 40 ++ ProjetTheAlone/Model - Copie/G_T_repa.cs | 48 ++ .../Model - Copie/G_T_typeEvenement.cs | 35 ++ ProjetTheAlone/Model - Copie/G_T_typePlat.cs | 35 ++ ProjetTheAlone/Model - Copie/G_T_typeRepa.cs | 35 ++ .../Model - Copie/P_T_beneficiaire.sql | 56 +++ ProjetTheAlone/Model - Copie/P_T_equipe.sql | 53 +++ ProjetTheAlone/Model - Copie/P_T_event.sql | 59 +++ ProjetTheAlone/Model - Copie/P_T_lieu.sql | 47 ++ .../Model - Copie/P_T_listParticipant.sql | 50 +++ ProjetTheAlone/Model - Copie/P_T_listPlat.sql | 50 +++ ProjetTheAlone/Model - Copie/P_T_plat.sql | 53 +++ ProjetTheAlone/Model - Copie/P_T_repa.sql | 50 +++ .../Model - Copie/P_T_typeEvenement.sql | 47 ++ ProjetTheAlone/Model - Copie/P_T_typePlat.sql | 48 ++ ProjetTheAlone/Model - Copie/P_T_typeRepa.sql | 47 ++ ProjetTheAlone/Model/A_T_beneficiaire.cs | 199 ++++----- ProjetTheAlone/Model/A_T_equipe.cs | 14 +- ProjetTheAlone/Model/A_T_event-Comp-Hugues.cs | 122 +++++ ProjetTheAlone/Model/A_T_event.cs | 12 +- ProjetTheAlone/Model/A_T_listParticipant.cs | 21 + ProjetTheAlone/Model/A_T_listPlat.cs | 40 +- ProjetTheAlone/Model/A_T_plat.cs | 28 +- ProjetTheAlone/Model/A_T_repa.cs | 17 +- ProjetTheAlone/Model/C_T_equipe.cs | 8 +- ProjetTheAlone/Model/C_T_event.cs | 2 +- ProjetTheAlone/Model/C_T_plat.cs | 23 +- ProjetTheAlone/Model/G_T_equipe.cs | 4 +- ProjetTheAlone/Model/G_T_listParticipant.cs | 4 +- ProjetTheAlone/Model/G_T_listPlat.cs | 19 +- ProjetTheAlone/Model/G_T_plat.cs | 4 +- ProjetTheAlone/Model/G_T_repa.cs | 2 +- ProjetTheAlone/Outil/picToByteArray.cs | 23 + ProjetTheAlone/Outil/toByteArray.cs | 21 + ProjetTheAlone/Outil/toNullableByteArray.cs | 21 + ProjetTheAlone/ProjetTheAlone.csproj | 53 ++- ProjetTheAlone/UserControlDIY/Plat.xaml.cs | 30 +- ProjetTheAlone/UserControlDIY/Repa.xaml | 9 +- ProjetTheAlone/UserControlDIY/Repa.xaml.cs | 22 +- ProjetTheAlone/View/Accueil.xaml.cs | 2 +- ProjetTheAlone/View/DashBoard.xaml | 123 +++-- ProjetTheAlone/View/DashBoard.xaml.cs | 24 +- .../View/FicBeneficiaireEncode.xaml | 19 +- .../View/FicBeneficiaireEncode.xaml.cs | 3 + ProjetTheAlone/View/FicDetailEvent.xaml | 45 ++ ProjetTheAlone/View/FicDetailEvent.xaml.cs | 33 ++ ProjetTheAlone/View/FicEncodePlat.xaml | 27 +- ProjetTheAlone/View/FicEncodePlat.xaml.cs | 7 +- ProjetTheAlone/View/FicEvenementEncode.xaml | 170 +++---- .../View/FicEvenementEncode.xaml.cs | 28 +- ProjetTheAlone/View/FicNewEquipe.xaml | 53 +++ ProjetTheAlone/View/FicNewEquipe.xaml.cs | 33 ++ ProjetTheAlone/View/FicNewLieu.xaml | 53 +++ ProjetTheAlone/View/FicNewLieu.xaml.cs | 33 ++ ProjetTheAlone/View/FicNewtypeEvent.xaml | 53 +++ ProjetTheAlone/View/FicNewtypeEvent.xaml.cs | 33 ++ ProjetTheAlone/View/FicRepasEncode.xaml | 88 ++-- ProjetTheAlone/View/FicRepasEncode.xaml.cs | 75 +++- .../ViewModel/EncodeBeneficiaire.cs | 11 +- ProjetTheAlone/ViewModel/EncodeEquipe.cs | 169 +++++++ ProjetTheAlone/ViewModel/EncodeEvent.cs | 420 ++++++++++++++++++ ProjetTheAlone/ViewModel/EncodeLieu.cs | 154 +++++++ .../{PlatsEncode.cs => EncodePlats.cs} | 26 +- ProjetTheAlone/ViewModel/EncodeRepas.cs | 110 +++++ ProjetTheAlone/ViewModel/EncodeTypeEvent.cs | 152 +++++++ .../ViewModel/PlatsEncode-PC-Bureau.cs | 164 ------- ProjetTheAlone/ViewModel/RepaModel.cs | 15 +- .../{EvenementEncode.cs => VM_DashBoard.cs} | 2 +- procedureMaison.sql | 30 +- 107 files changed, 5340 insertions(+), 621 deletions(-) rename ProjetTheAlone/{Settings1.Designer.cs => Config/Settings2.Designer.cs} (58%) rename ProjetTheAlone/{Settings1.settings => Config/Settings2.settings} (58%) create mode 100644 ProjetTheAlone/Model - Copie/A_Base.cs create mode 100644 ProjetTheAlone/Model - Copie/A_T_beneficiaire.cs create mode 100644 ProjetTheAlone/Model - Copie/A_T_equipe.cs create mode 100644 ProjetTheAlone/Model - Copie/A_T_event-Comp-Hugues.cs create mode 100644 ProjetTheAlone/Model - Copie/A_T_event.cs create mode 100644 ProjetTheAlone/Model - Copie/A_T_lieu.cs create mode 100644 ProjetTheAlone/Model - Copie/A_T_listParticipant.cs create mode 100644 ProjetTheAlone/Model - Copie/A_T_listPlat.cs create mode 100644 ProjetTheAlone/Model - Copie/A_T_plat.cs create mode 100644 ProjetTheAlone/Model - Copie/A_T_repa.cs create mode 100644 ProjetTheAlone/Model - Copie/A_T_typeEvenement.cs create mode 100644 ProjetTheAlone/Model - Copie/A_T_typePlat.cs create mode 100644 ProjetTheAlone/Model - Copie/A_T_typeRepa.cs create mode 100644 ProjetTheAlone/Model - Copie/C_T_beneficiaire.cs create mode 100644 ProjetTheAlone/Model - Copie/C_T_equipe.cs create mode 100644 ProjetTheAlone/Model - Copie/C_T_event.cs create mode 100644 ProjetTheAlone/Model - Copie/C_T_lieu.cs create mode 100644 ProjetTheAlone/Model - Copie/C_T_listParticipant.cs create mode 100644 ProjetTheAlone/Model - Copie/C_T_listPlat.cs create mode 100644 ProjetTheAlone/Model - Copie/C_T_plat.cs create mode 100644 ProjetTheAlone/Model - Copie/C_T_repa.cs create mode 100644 ProjetTheAlone/Model - Copie/C_T_typeEvenement.cs create mode 100644 ProjetTheAlone/Model - Copie/C_T_typePlat.cs create mode 100644 ProjetTheAlone/Model - Copie/C_T_typeRepa.cs create mode 100644 ProjetTheAlone/Model - Copie/G_Base.cs create mode 100644 ProjetTheAlone/Model - Copie/G_T_beneficiaire.cs create mode 100644 ProjetTheAlone/Model - Copie/G_T_equipe.cs create mode 100644 ProjetTheAlone/Model - Copie/G_T_event.cs create mode 100644 ProjetTheAlone/Model - Copie/G_T_lieu.cs create mode 100644 ProjetTheAlone/Model - Copie/G_T_listParticipant.cs create mode 100644 ProjetTheAlone/Model - Copie/G_T_listPlat.cs create mode 100644 ProjetTheAlone/Model - Copie/G_T_plat.cs create mode 100644 ProjetTheAlone/Model - Copie/G_T_repa.cs create mode 100644 ProjetTheAlone/Model - Copie/G_T_typeEvenement.cs create mode 100644 ProjetTheAlone/Model - Copie/G_T_typePlat.cs create mode 100644 ProjetTheAlone/Model - Copie/G_T_typeRepa.cs create mode 100644 ProjetTheAlone/Model - Copie/P_T_beneficiaire.sql create mode 100644 ProjetTheAlone/Model - Copie/P_T_equipe.sql create mode 100644 ProjetTheAlone/Model - Copie/P_T_event.sql create mode 100644 ProjetTheAlone/Model - Copie/P_T_lieu.sql create mode 100644 ProjetTheAlone/Model - Copie/P_T_listParticipant.sql create mode 100644 ProjetTheAlone/Model - Copie/P_T_listPlat.sql create mode 100644 ProjetTheAlone/Model - Copie/P_T_plat.sql create mode 100644 ProjetTheAlone/Model - Copie/P_T_repa.sql create mode 100644 ProjetTheAlone/Model - Copie/P_T_typeEvenement.sql create mode 100644 ProjetTheAlone/Model - Copie/P_T_typePlat.sql create mode 100644 ProjetTheAlone/Model - Copie/P_T_typeRepa.sql create mode 100644 ProjetTheAlone/Model/A_T_event-Comp-Hugues.cs create mode 100644 ProjetTheAlone/Outil/picToByteArray.cs create mode 100644 ProjetTheAlone/Outil/toByteArray.cs create mode 100644 ProjetTheAlone/Outil/toNullableByteArray.cs create mode 100644 ProjetTheAlone/View/FicDetailEvent.xaml create mode 100644 ProjetTheAlone/View/FicDetailEvent.xaml.cs create mode 100644 ProjetTheAlone/View/FicNewEquipe.xaml create mode 100644 ProjetTheAlone/View/FicNewEquipe.xaml.cs create mode 100644 ProjetTheAlone/View/FicNewLieu.xaml create mode 100644 ProjetTheAlone/View/FicNewLieu.xaml.cs create mode 100644 ProjetTheAlone/View/FicNewtypeEvent.xaml create mode 100644 ProjetTheAlone/View/FicNewtypeEvent.xaml.cs create mode 100644 ProjetTheAlone/ViewModel/EncodeEquipe.cs create mode 100644 ProjetTheAlone/ViewModel/EncodeEvent.cs create mode 100644 ProjetTheAlone/ViewModel/EncodeLieu.cs rename ProjetTheAlone/ViewModel/{PlatsEncode.cs => EncodePlats.cs} (88%) create mode 100644 ProjetTheAlone/ViewModel/EncodeRepas.cs create mode 100644 ProjetTheAlone/ViewModel/EncodeTypeEvent.cs delete mode 100644 ProjetTheAlone/ViewModel/PlatsEncode-PC-Bureau.cs rename ProjetTheAlone/ViewModel/{EvenementEncode.cs => VM_DashBoard.cs} (86%) diff --git a/ProjetTheAlone/App.config b/ProjetTheAlone/App.config index a66c31a..40dd99f 100644 --- a/ProjetTheAlone/App.config +++ b/ProjetTheAlone/App.config @@ -2,17 +2,34 @@ +
+
- + + + + + Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename="C:\Users\adrie\OneDrive - Haute Ecole de la ville de Liège\3is\poo\ProjetTheAlone - Copie (9)\ProjetTheAlone\ProjetThe.mdf";Integrated Security=True + + + + + Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename="C:\Users\adrie\OneDrive - Haute Ecole de la ville de Liège\3is\poo\ProjetTheAlone - Copie (9)\ProjetTheAlone\ProjetThe.mdf";Integrated Security=True + + - \ No newline at end of file + diff --git a/ProjetTheAlone/Config/Settings1.Designer.cs b/ProjetTheAlone/Config/Settings1.Designer.cs index 0c2f1ed..2a0c39c 100644 --- a/ProjetTheAlone/Config/Settings1.Designer.cs +++ b/ProjetTheAlone/Config/Settings1.Designer.cs @@ -8,7 +8,7 @@ // //------------------------------------------------------------------------------ -namespace ProjetTheAlone { +namespace ProjetTheAlone.Config { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] @@ -25,9 +25,9 @@ namespace ProjetTheAlone { [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")] + [global::System.Configuration.DefaultSettingValueAttribute("Data Source=(LocalDB)\\MSSQLLocalDB;AttachDbFilename=\"C:\\Users\\adrie\\OneDrive - Ha" + + "ute Ecole de la ville de Liège\\3is\\poo\\ProjetTheAlone - Copie (9)\\ProjetTheAlone" + + "\\ProjetThe.mdf\";Integrated Security=True")] public string schCon { get { return ((string)(this["schCon"])); diff --git a/ProjetTheAlone/Config/Settings1.settings b/ProjetTheAlone/Config/Settings1.settings index b9c37dd..00691f6 100644 --- a/ProjetTheAlone/Config/Settings1.settings +++ b/ProjetTheAlone/Config/Settings1.settings @@ -1,9 +1,9 @@  - + - 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 + Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename="C:\Users\adrie\OneDrive - Haute Ecole de la ville de Liège\3is\poo\ProjetTheAlone - Copie (9)\ProjetTheAlone\ProjetThe.mdf";Integrated Security=True \ No newline at end of file diff --git a/ProjetTheAlone/Settings1.Designer.cs b/ProjetTheAlone/Config/Settings2.Designer.cs similarity index 58% rename from ProjetTheAlone/Settings1.Designer.cs rename to ProjetTheAlone/Config/Settings2.Designer.cs index 15801e7..df36325 100644 --- a/ProjetTheAlone/Settings1.Designer.cs +++ b/ProjetTheAlone/Config/Settings2.Designer.cs @@ -1,23 +1,23 @@ //------------------------------------------------------------------------------ // -// Ce code a été généré par un outil. -// Version du runtime :4.0.30319.42000 +// This code was generated by a tool. +// Runtime Version: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é. +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. // //------------------------------------------------------------------------------ -namespace ProjetTheAlone { +namespace ProjetTheAlone.Config { [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 { + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.7.0.0")] + internal sealed partial class Settings2 : global::System.Configuration.ApplicationSettingsBase { - private static Settings1 defaultInstance = ((Settings1)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings1()))); + private static Settings2 defaultInstance = ((Settings2)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings2()))); - public static Settings1 Default { + public static Settings2 Default { get { return defaultInstance; } @@ -25,9 +25,9 @@ namespace ProjetTheAlone { [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")] + [global::System.Configuration.DefaultSettingValueAttribute("Data Source=(LocalDB)\\MSSQLLocalDB;AttachDbFilename=\"C:\\Users\\adrie\\OneDrive - Ha" + + "ute Ecole de la ville de Liège\\3is\\poo\\ProjetTheAlone - Copie (9)\\ProjetTheAlone" + + "\\ProjetThe.mdf\";Integrated Security=True")] public string schCon { get { return ((string)(this["schCon"])); diff --git a/ProjetTheAlone/Settings1.settings b/ProjetTheAlone/Config/Settings2.settings similarity index 58% rename from ProjetTheAlone/Settings1.settings rename to ProjetTheAlone/Config/Settings2.settings index b9c37dd..dbe021a 100644 --- a/ProjetTheAlone/Settings1.settings +++ b/ProjetTheAlone/Config/Settings2.settings @@ -1,9 +1,9 @@  - + - 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 + Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename="C:\Users\adrie\OneDrive - Haute Ecole de la ville de Liège\3is\poo\ProjetTheAlone - Copie (9)\ProjetTheAlone\ProjetThe.mdf";Integrated Security=True \ No newline at end of file diff --git a/ProjetTheAlone/Converter/BinaryImageConverter.cs b/ProjetTheAlone/Converter/BinaryImageConverter.cs index 77dd5c3..60fc7ca 100644 --- a/ProjetTheAlone/Converter/BinaryImageConverter.cs +++ b/ProjetTheAlone/Converter/BinaryImageConverter.cs @@ -16,11 +16,15 @@ namespace ProjetTheAlone.Converter object parameter, System.Globalization.CultureInfo culture) { - if (value != null && value is byte[]) + if (value != null && value is byte?[]) { - byte[] bytes = value as byte[]; - - MemoryStream stream = new MemoryStream(bytes); + byte?[] bytes = value as byte?[]; + byte[] bb = Array.ConvertAll(bytes, + delegate (byte? b) + { + return b.Value; + }); + MemoryStream stream = new MemoryStream(bb); BitmapImage image = new BitmapImage(); image.BeginInit(); @@ -38,7 +42,26 @@ namespace ProjetTheAlone.Converter object parameter, System.Globalization.CultureInfo culture) { - throw new Exception("The method or operation is not implemented."); + if (value != null) + { + byte?[] data; + JpegBitmapEncoder encoder = new JpegBitmapEncoder(); + encoder.Frames.Add(BitmapFrame.Create((BitmapImage)value)); + using (MemoryStream ms = new MemoryStream()) + { + encoder.Save(ms); + byte[] bb = ms.ToArray(); + data = Array.ConvertAll(bb, + delegate (byte b) + { + return b; + }); + + return data; + } + } + + return null; } } } diff --git a/ProjetTheAlone/MainWindow.xaml.cs b/ProjetTheAlone/MainWindow.xaml.cs index 81cdcdb..8bbeaf1 100644 --- a/ProjetTheAlone/MainWindow.xaml.cs +++ b/ProjetTheAlone/MainWindow.xaml.cs @@ -24,6 +24,8 @@ namespace ProjetTheAlone { InitializeComponent(); + + } } } diff --git a/ProjetTheAlone/Model - Copie/A_Base.cs b/ProjetTheAlone/Model - Copie/A_Base.cs new file mode 100644 index 0000000..815be28 --- /dev/null +++ b/ProjetTheAlone/Model - Copie/A_Base.cs @@ -0,0 +1,86 @@ +#region Ressources extérieures +using System; +using System.Collections.Generic; +using System.Text; +using System.Data; +using System.Data.SqlClient; +using System.Configuration; +#endregion + +namespace ProjetTheAlone.Acces +{ + public class ADBase + { + #region Données membres + protected SqlCommand _commande; + #endregion + #region Constructeurs (étendus) + /// + /// Constructeur par défaut + /// + /// La chaîne de connexion est récupérée en argument + public ADBase(string sChaineConnexion) + { + _commande = new SqlCommand(); + _commande.Connection = new SqlConnection(sChaineConnexion); + } + /// + /// Méthode assignant une procédure stockée + /// + /// Nom de la procédure stockée + public void CreerCommande(string sCommande) + { + _commande.CommandType = CommandType.StoredProcedure; + _commande.CommandText = sCommande; + } + /// + /// Méthode assignant une procédure stockée ET une chaîne de connexion + /// + /// Nom de la procédure stockée + /// Chaîne de connexion à utiliser + public void CreerCommande(string sCommande, string sConnexion) + { + _commande.Connection = new SqlConnection(sConnexion); + _commande.CommandType = CommandType.StoredProcedure; + _commande.CommandText = sCommande; + } + /// + /// Méthode assignant une procédure stockée et le type de requête + /// + /// Nom de la procédure stockée + /// Type de requête (Vrai=stockée, Faux=Texte) + public void CreerCommande(string sCommande, bool bTypeRequete) + { + if (bTypeRequete) _commande.CommandType = CommandType.StoredProcedure; + else _commande.CommandType = CommandType.Text; + _commande.CommandText = sCommande; + } + /// + /// Méthode assignant une procédure stockée, une chaîne de connexion et le type de requête + /// + /// Nom de la procédure stockée + /// Chaîne de connexion à utiliser + /// Type de requête (Vrai=stockée, Faux=Texte) + public void CreerCommande(string sCommande, bool bTypeRequete, string sConnexion) + { + _commande.Connection = new SqlConnection(sConnexion); + if (bTypeRequete) _commande.CommandType = CommandType.StoredProcedure; + else _commande.CommandType = CommandType.Text; + _commande.CommandText = sCommande; + } + #endregion + #region Accesseurs + public SqlCommand Commande + { + get { return _commande; } + set { _commande = value; } + } + #endregion + #region Utilitaires + public void Direction(string sParam, ParameterDirection dParam) + { Commande.Parameters[sParam].Direction = dParam; } + public string LireParametre(string sParam) + { return Commande.Parameters[sParam].Value.ToString(); } + #endregion + } +} diff --git a/ProjetTheAlone/Model - Copie/A_T_beneficiaire.cs b/ProjetTheAlone/Model - Copie/A_T_beneficiaire.cs new file mode 100644 index 0000000..84ea9ad --- /dev/null +++ b/ProjetTheAlone/Model - Copie/A_T_beneficiaire.cs @@ -0,0 +1,113 @@ +#region Ressources extérieures +using System; +using System.Collections.Generic; +using System.Text; +using System.Data; +using System.Data.SqlClient; +using System.Data.SqlTypes; +using ProjetTheAlone.Classes; +#endregion + +namespace ProjetTheAlone.Acces +{ + /// + /// Couche d'accès aux données (Data Access Layer) + /// + public class A_T_beneficiaire : ADBase + { + #region Constructeurs + public A_T_beneficiaire(string sChaineConnexion) + : base(sChaineConnexion) + { } + #endregion + public int Ajouter(string B_nom, string B_prenom, DateTime? B_anniversaire, byte?[] B_img) + { + CreerCommande("AjouterT_beneficiaire"); + int res = 0; + Commande.Parameters.Add("ID_beneficiaire", SqlDbType.Int); + Direction("ID_beneficiaire", ParameterDirection.Output); + if (B_nom == null) Commande.Parameters.AddWithValue("@B_nom", Convert.DBNull); + else Commande.Parameters.AddWithValue("@B_nom", B_nom); + if (B_prenom == null) Commande.Parameters.AddWithValue("@B_prenom", Convert.DBNull); + else Commande.Parameters.AddWithValue("@B_prenom", B_prenom); + if (B_anniversaire == null) Commande.Parameters.AddWithValue("@B_anniversaire", Convert.DBNull); + else Commande.Parameters.AddWithValue("@B_anniversaire", B_anniversaire); + if (B_img == null) Commande.Parameters.AddWithValue("@B_img", SqlDbType.Image).Value = Convert.DBNull; + else Commande.Parameters.AddWithValue("@B_img", SqlDbType.Image).Value = Outil.toByteArray.Convert(B_img); + Commande.Connection.Open(); + Commande.ExecuteNonQuery(); + res = int.Parse(LireParametre("ID_beneficiaire")); + Commande.Connection.Close(); + return res; + } + public int Modifier(int ID_beneficiaire, string B_nom, string B_prenom, DateTime? B_anniversaire, byte?[] B_img) + { + CreerCommande("ModifierT_beneficiaire"); + int res = 0; + Commande.Parameters.AddWithValue("@ID_beneficiaire", ID_beneficiaire); + if (B_nom == null) Commande.Parameters.AddWithValue("@B_nom", Convert.DBNull); + else Commande.Parameters.AddWithValue("@B_nom", B_nom); + if (B_prenom == null) Commande.Parameters.AddWithValue("@B_prenom", Convert.DBNull); + else Commande.Parameters.AddWithValue("@B_prenom", B_prenom); + if (B_anniversaire == null) Commande.Parameters.AddWithValue("@B_anniversaire", Convert.DBNull); + else Commande.Parameters.AddWithValue("@B_anniversaire", B_anniversaire); + if (B_img == null) Commande.Parameters.AddWithValue("@B_img", Convert.DBNull); + else Commande.Parameters.AddWithValue("@B_img", B_img); + Commande.Connection.Open(); + Commande.ExecuteNonQuery(); + Commande.Connection.Close(); + return res; + } + public List Lire(string Index) + { + CreerCommande("SelectionnerT_beneficiaire"); + Commande.Parameters.AddWithValue("@Index", Index); + Commande.Connection.Open(); + SqlDataReader dr = Commande.ExecuteReader(); + List res = new List(); + while (dr.Read()) + { + C_T_beneficiaire tmp = new C_T_beneficiaire(); + tmp.ID_beneficiaire = int.Parse(dr["ID_beneficiaire"].ToString()); + 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()); + if (dr["B_img"] != DBNull.Value) tmp.B_img = Outil.toNullableByteArray.Convert((byte[])dr["B_img"]); + res.Add(tmp); + } + dr.Close(); + Commande.Connection.Close(); + return res; + } + public C_T_beneficiaire Lire_ID(int ID_beneficiaire) + { + CreerCommande("SelectionnerT_beneficiaire_ID"); + Commande.Parameters.AddWithValue("@ID_beneficiaire", ID_beneficiaire); + Commande.Connection.Open(); + SqlDataReader dr = Commande.ExecuteReader(); + C_T_beneficiaire res = new C_T_beneficiaire(); + while (dr.Read()) + { + res.ID_beneficiaire = int.Parse(dr["ID_beneficiaire"].ToString()); + 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()); + if (dr["B_img"] != DBNull.Value) res.B_img = Outil.toNullableByteArray.Convert((byte[])dr["B_img"]); + res.B_img = (byte?[])dr["B_img"]; + } + dr.Close(); + Commande.Connection.Close(); + return res; + } + public int Supprimer(int ID_beneficiaire) + { + CreerCommande("SupprimerT_beneficiaire"); + int res = 0; + Commande.Parameters.AddWithValue("@ID_beneficiaire", ID_beneficiaire); + Commande.Connection.Open(); + res = Commande.ExecuteNonQuery(); + Commande.Connection.Close(); + return res; + } + } +} diff --git a/ProjetTheAlone/Model - Copie/A_T_equipe.cs b/ProjetTheAlone/Model - Copie/A_T_equipe.cs new file mode 100644 index 0000000..8d00f8c --- /dev/null +++ b/ProjetTheAlone/Model - Copie/A_T_equipe.cs @@ -0,0 +1,104 @@ +#region Ressources extérieures +using System; +using System.Collections.Generic; +using System.Text; +using System.Data; +using System.Data.SqlClient; +using System.Data.SqlTypes; +using ProjetTheAlone.Classes; +#endregion + +namespace ProjetTheAlone.Acces +{ + /// + /// Couche d'accès aux données (Data Access Layer) + /// + public class A_T_equipe : ADBase + { + #region Constructeurs + public A_T_equipe(string sChaineConnexion) + : base(sChaineConnexion) + { } + #endregion + public int Ajouter(string E_nom, int E_point, int? ID_evenement) + { + CreerCommande("AjouterT_equipe"); + int res = 0; + Commande.Parameters.Add("ID_equipe", SqlDbType.Int); + Direction("ID_equipe", ParameterDirection.Output); + if(E_nom == null) Commande.Parameters.AddWithValue("@E_nom", Convert.DBNull); + else Commande.Parameters.AddWithValue("@E_nom", E_nom); + Commande.Parameters.AddWithValue("@E_point", E_point); + if(ID_evenement == null) Commande.Parameters.AddWithValue("@ID_evenement", Convert.DBNull); + else Commande.Parameters.AddWithValue("@ID_evenement", ID_evenement); + Commande.Connection.Open(); + Commande.ExecuteNonQuery(); + res = int.Parse(LireParametre("ID_equipe")); + Commande.Connection.Close(); + return res; + } + public int Modifier(int ID_equipe, string E_nom, int E_point, int? ID_evenement) + { + CreerCommande("ModifierT_equipe"); + int res = 0; + Commande.Parameters.AddWithValue("@ID_equipe", ID_equipe); + if(E_nom == null) Commande.Parameters.AddWithValue("@E_nom", Convert.DBNull); + else Commande.Parameters.AddWithValue("@E_nom", E_nom); + Commande.Parameters.AddWithValue("@E_point", E_point); + if(ID_evenement == null) Commande.Parameters.AddWithValue("@ID_evenement", Convert.DBNull); + else Commande.Parameters.AddWithValue("@ID_evenement", ID_evenement); + Commande.Connection.Open(); + Commande.ExecuteNonQuery(); + Commande.Connection.Close(); + return res; + } + public List Lire(string Index) + { + CreerCommande("SelectionnerT_equipe"); + Commande.Parameters.AddWithValue("@Index", Index); + Commande.Connection.Open(); + SqlDataReader dr = Commande.ExecuteReader(); + List res = new List(); + while (dr.Read()) + { + C_T_equipe tmp = new C_T_equipe(); + tmp.ID_equipe = int.Parse(dr["ID_equipe"].ToString()); + tmp.E_nom = dr["E_nom"].ToString(); + tmp.E_point = int.Parse(dr["E_point"].ToString()); + if(dr["ID_evenement"] != DBNull.Value) tmp.ID_evenement = int.Parse(dr["ID_evenement"].ToString()); + res.Add(tmp); + } + dr.Close(); + Commande.Connection.Close(); + return res; + } + public C_T_equipe Lire_ID(int ID_equipe) + { + CreerCommande("SelectionnerT_equipe_ID"); + Commande.Parameters.AddWithValue("@ID_equipe", ID_equipe); + Commande.Connection.Open(); + SqlDataReader dr = Commande.ExecuteReader(); + C_T_equipe res = new C_T_equipe(); + while (dr.Read()) + { + res.ID_equipe = int.Parse(dr["ID_equipe"].ToString()); + res.E_nom = dr["E_nom"].ToString(); + res.E_point = int.Parse(dr["E_point"].ToString()); + if(dr["ID_evenement"] != DBNull.Value) res.ID_evenement = int.Parse(dr["ID_evenement"].ToString()); + } + dr.Close(); + Commande.Connection.Close(); + return res; + } + public int Supprimer(int ID_equipe) + { + CreerCommande("SupprimerT_equipe"); + int res = 0; + Commande.Parameters.AddWithValue("@ID_equipe", ID_equipe); + Commande.Connection.Open(); + res = Commande.ExecuteNonQuery(); + Commande.Connection.Close(); + return res; + } + } +} diff --git a/ProjetTheAlone/Model - Copie/A_T_event-Comp-Hugues.cs b/ProjetTheAlone/Model - Copie/A_T_event-Comp-Hugues.cs new file mode 100644 index 0000000..d7024ab --- /dev/null +++ b/ProjetTheAlone/Model - Copie/A_T_event-Comp-Hugues.cs @@ -0,0 +1,122 @@ +#region Ressources extérieures +using System; +using System.Collections.Generic; +using System.Text; +using System.Data; +using System.Data.SqlClient; +using System.Data.SqlTypes; +using ProjetTheAlone.Classes; +#endregion + +namespace ProjetTheAlone.Acces +{ + /// + /// Couche d'accès aux données (Data Access Layer) + /// + public class A_T_event : ADBase + { + #region Constructeurs + public A_T_event(string sChaineConnexion) + : base(sChaineConnexion) + { } + #endregion + public int Ajouter(DateTime? E_date, DateTime? E_duree, int? ID_typeEvenement,string E_description, int? ID_lieu, Byte?[] E_Pic) + { + CreerCommande("AjouterT_event"); + int res = 0; + Commande.Parameters.Add("ID_event", SqlDbType.Int); + Direction("ID_event", ParameterDirection.Output); + if(E_date == null) Commande.Parameters.AddWithValue("@E_date", Convert.DBNull); + else Commande.Parameters.AddWithValue("@E_date", E_date); + if(E_duree == null) Commande.Parameters.AddWithValue("@E_duree", Convert.DBNull); + else Commande.Parameters.AddWithValue("@E_duree", E_duree); + if(ID_typeEvenement == null) Commande.Parameters.AddWithValue("@ID_typeEvenement", Convert.DBNull); + else Commande.Parameters.AddWithValue("@ID_typeEvenement", ID_typeEvenement); + if(E_description == null) Commande.Parameters.AddWithValue("@E_description", Convert.DBNull); + else Commande.Parameters.AddWithValue("@E_description", E_description); + if(ID_lieu == null) Commande.Parameters.AddWithValue("@ID_lieu", Convert.DBNull); + else Commande.Parameters.AddWithValue("@ID_lieu", ID_lieu); + Commande.Parameters.AddWithValue("@E_Pic", E_Pic ?? Convert.DBNull); + Commande.Connection.Open(); + Commande.ExecuteNonQuery(); + res = int.Parse(LireParametre("ID_event")); + Commande.Connection.Close(); + return res; + } + public int Modifier(int ID_event, DateTime? E_date, DateTime? E_duree, int? ID_typeEvenement, string E_description, int? ID_lieu, Byte?[] E_Pic) + { + CreerCommande("ModifierT_event"); + int res = 0; + Commande.Parameters.AddWithValue("@ID_event", ID_event); + if(E_date == null) Commande.Parameters.AddWithValue("@E_date", Convert.DBNull); + else Commande.Parameters.AddWithValue("@E_date", E_date); + if(E_duree == null) Commande.Parameters.AddWithValue("@E_duree", Convert.DBNull); + else Commande.Parameters.AddWithValue("@E_duree", E_duree); + if(ID_typeEvenement == null) Commande.Parameters.AddWithValue("@ID_typeEvenement", Convert.DBNull); + else Commande.Parameters.AddWithValue("@ID_typeEvenement", ID_typeEvenement); + if(E_description == null) Commande.Parameters.AddWithValue("@E_description", Convert.DBNull); + else Commande.Parameters.AddWithValue("@E_description", E_description); + if(ID_lieu == null) Commande.Parameters.AddWithValue("@ID_lieu", Convert.DBNull); + else Commande.Parameters.AddWithValue("@ID_lieu", ID_lieu); + Commande.Parameters.AddWithValue("@E_Pic", E_Pic ?? Convert.DBNull); + Commande.Connection.Open(); + Commande.ExecuteNonQuery(); + Commande.Connection.Close(); + return res; + } + public List Lire(string Index) + { + CreerCommande("SelectionnerT_event"); + Commande.Parameters.AddWithValue("@Index", Index); + Commande.Connection.Open(); + SqlDataReader dr = Commande.ExecuteReader(); + List res = new List(); + while (dr.Read()) + { + C_T_event tmp = new C_T_event(); + tmp.ID_event = int.Parse(dr["ID_event"].ToString()); + if(dr["E_date"] != DBNull.Value) tmp.E_date = DateTime.Parse(dr["E_date"].ToString()); + if(dr["E_duree"] != DBNull.Value) tmp.E_duree = DateTime.Parse(dr["E_duree"].ToString()); + if(dr["ID_typeEvenement"] != DBNull.Value) tmp.ID_typeEvenement = int.Parse(dr["ID_typeEvenement"].ToString()); + if(dr["E_description"] != DBNull.Value) tmp.E_description = (dr["E_description"].ToString()); + if(dr["ID_lieu"] != DBNull.Value) tmp.ID_lieu = int.Parse(dr["ID_lieu"].ToString()); + if (dr["E_Pic"] != DBNull.Value) tmp.E_Pic = (byte?[])dr["E_Pic"]; + res.Add(tmp); + } + dr.Close(); + Commande.Connection.Close(); + return res; + } + public C_T_event Lire_ID(int ID_event) + { + CreerCommande("SelectionnerT_event_ID"); + Commande.Parameters.AddWithValue("@ID_event", ID_event); + Commande.Connection.Open(); + SqlDataReader dr = Commande.ExecuteReader(); + C_T_event res = new C_T_event(); + while (dr.Read()) + { + res.ID_event = int.Parse(dr["ID_event"].ToString()); + if(dr["E_date"] != DBNull.Value) res.E_date = DateTime.Parse(dr["E_date"].ToString()); + if(dr["E_duree"] != DBNull.Value) res.E_duree = DateTime.Parse(dr["E_duree"].ToString()); + if(dr["ID_typeEvenement"] != DBNull.Value) res.ID_typeEvenement = int.Parse(dr["ID_typeEvenement"].ToString()); + if(dr["E_description"] != DBNull.Value) res.E_description = (dr["E_description"].ToString()); + if(dr["ID_lieu"] != DBNull.Value) res.ID_lieu = int.Parse(dr["ID_lieu"].ToString()); + if (dr["E_Pic"] != DBNull.Value) res.E_Pic = (byte?[])dr["E_Pic"]; + } + dr.Close(); + Commande.Connection.Close(); + return res; + } + public int Supprimer(int ID_event) + { + CreerCommande("SupprimerT_event"); + int res = 0; + Commande.Parameters.AddWithValue("@ID_event", ID_event); + Commande.Connection.Open(); + res = Commande.ExecuteNonQuery(); + Commande.Connection.Close(); + return res; + } + } +} diff --git a/ProjetTheAlone/Model - Copie/A_T_event.cs b/ProjetTheAlone/Model - Copie/A_T_event.cs new file mode 100644 index 0000000..6bc4a33 --- /dev/null +++ b/ProjetTheAlone/Model - Copie/A_T_event.cs @@ -0,0 +1,122 @@ +#region Ressources extérieures +using System; +using System.Collections.Generic; +using System.Text; +using System.Data; +using System.Data.SqlClient; +using System.Data.SqlTypes; +using ProjetTheAlone.Classes; +#endregion + +namespace ProjetTheAlone.Acces +{ + /// + /// Couche d'accès aux données (Data Access Layer) + /// + public class A_T_event : ADBase + { + #region Constructeurs + public A_T_event(string sChaineConnexion) + : base(sChaineConnexion) + { } + #endregion + public int Ajouter(DateTime? E_date, DateTime? E_duree, int? ID_typeEvenement,string E_description, int? ID_lieu, Byte?[] E_Pic) + { + CreerCommande("AjouterT_event"); + int res = 0; + Commande.Parameters.Add("ID_event", SqlDbType.Int); + Direction("ID_event", ParameterDirection.Output); + if(E_date == null) Commande.Parameters.AddWithValue("@E_date", Convert.DBNull); + else Commande.Parameters.AddWithValue("@E_date", E_date); + if(E_duree == null) Commande.Parameters.AddWithValue("@E_duree", Convert.DBNull); + else Commande.Parameters.AddWithValue("@E_duree", E_duree); + if(ID_typeEvenement == null) Commande.Parameters.AddWithValue("@ID_typeEvenement", Convert.DBNull); + else Commande.Parameters.AddWithValue("@ID_typeEvenement", ID_typeEvenement); + if(E_description == null) Commande.Parameters.AddWithValue("@E_description", Convert.DBNull); + else Commande.Parameters.AddWithValue("@E_description", E_description); + if(ID_lieu == null) Commande.Parameters.AddWithValue("@ID_lieu", Convert.DBNull); + else Commande.Parameters.AddWithValue("@ID_lieu", ID_lieu); + Commande.Parameters.AddWithValue("@E_Pic", SqlDbType.Image).Value = (E_Pic==null ?Convert.DBNull:Outil.toByteArray.Convert(E_Pic)); + Commande.Connection.Open(); + Commande.ExecuteNonQuery(); + res = int.Parse(LireParametre("ID_event")); + Commande.Connection.Close(); + return res; + } + public int Modifier(int ID_event, DateTime? E_date, DateTime? E_duree, int? ID_typeEvenement, string E_description, int? ID_lieu, Byte?[] E_Pic) + { + CreerCommande("ModifierT_event"); + int res = 0; + Commande.Parameters.AddWithValue("@ID_event", ID_event); + if(E_date == null) Commande.Parameters.AddWithValue("@E_date", Convert.DBNull); + else Commande.Parameters.AddWithValue("@E_date", E_date); + if(E_duree == null) Commande.Parameters.AddWithValue("@E_duree", Convert.DBNull); + else Commande.Parameters.AddWithValue("@E_duree", E_duree); + if(ID_typeEvenement == null) Commande.Parameters.AddWithValue("@ID_typeEvenement", Convert.DBNull); + else Commande.Parameters.AddWithValue("@ID_typeEvenement", ID_typeEvenement); + if(E_description == null) Commande.Parameters.AddWithValue("@E_description", Convert.DBNull); + else Commande.Parameters.AddWithValue("@E_description", E_description); + if(ID_lieu == null) Commande.Parameters.AddWithValue("@ID_lieu", Convert.DBNull); + else Commande.Parameters.AddWithValue("@ID_lieu", ID_lieu); + Commande.Parameters.AddWithValue("@E_Pic", SqlDbType.Image).Value = (E_Pic == null ? Convert.DBNull : Outil.toByteArray.Convert(E_Pic)); + Commande.Connection.Open(); + Commande.ExecuteNonQuery(); + Commande.Connection.Close(); + return res; + } + public List Lire(string Index) + { + CreerCommande("SelectionnerT_event"); + Commande.Parameters.AddWithValue("@Index", Index); + Commande.Connection.Open(); + SqlDataReader dr = Commande.ExecuteReader(); + List res = new List(); + while (dr.Read()) + { + C_T_event tmp = new C_T_event(); + tmp.ID_event = int.Parse(dr["ID_event"].ToString()); + if(dr["E_date"] != DBNull.Value) tmp.E_date = DateTime.Parse(dr["E_date"].ToString()); + if(dr["E_duree"] != DBNull.Value) tmp.E_duree = DateTime.Parse(dr["E_duree"].ToString()); + if(dr["ID_typeEvenement"] != DBNull.Value) tmp.ID_typeEvenement = int.Parse(dr["ID_typeEvenement"].ToString()); + if(dr["E_description"] != DBNull.Value) tmp.E_description = (dr["E_description"].ToString()); + if(dr["ID_lieu"] != DBNull.Value) tmp.ID_lieu = int.Parse(dr["ID_lieu"].ToString()); + if (dr["E_Pic"] != DBNull.Value) tmp.E_Pic = Outil.toNullableByteArray.Convert((byte[])dr["E_Pic"]); + res.Add(tmp); + } + dr.Close(); + Commande.Connection.Close(); + return res; + } + public C_T_event Lire_ID(int ID_event) + { + CreerCommande("SelectionnerT_event_ID"); + Commande.Parameters.AddWithValue("@ID_event", ID_event); + Commande.Connection.Open(); + SqlDataReader dr = Commande.ExecuteReader(); + C_T_event res = new C_T_event(); + while (dr.Read()) + { + res.ID_event = int.Parse(dr["ID_event"].ToString()); + if(dr["E_date"] != DBNull.Value) res.E_date = DateTime.Parse(dr["E_date"].ToString()); + if(dr["E_duree"] != DBNull.Value) res.E_duree = DateTime.Parse(dr["E_duree"].ToString()); + if(dr["ID_typeEvenement"] != DBNull.Value) res.ID_typeEvenement = int.Parse(dr["ID_typeEvenement"].ToString()); + if(dr["E_description"] != DBNull.Value) res.E_description = (dr["E_description"].ToString()); + if(dr["ID_lieu"] != DBNull.Value) res.ID_lieu = int.Parse(dr["ID_lieu"].ToString()); + if (dr["E_Pic"] != DBNull.Value) res.E_Pic = Outil.toNullableByteArray.Convert((byte[])dr["E_Pic"]); + } + dr.Close(); + Commande.Connection.Close(); + return res; + } + public int Supprimer(int ID_event) + { + CreerCommande("SupprimerT_event"); + int res = 0; + Commande.Parameters.AddWithValue("@ID_event", ID_event); + Commande.Connection.Open(); + res = Commande.ExecuteNonQuery(); + Commande.Connection.Close(); + return res; + } + } +} diff --git a/ProjetTheAlone/Model - Copie/A_T_lieu.cs b/ProjetTheAlone/Model - Copie/A_T_lieu.cs new file mode 100644 index 0000000..cd955f6 --- /dev/null +++ b/ProjetTheAlone/Model - Copie/A_T_lieu.cs @@ -0,0 +1,94 @@ +#region Ressources extérieures +using System; +using System.Collections.Generic; +using System.Text; +using System.Data; +using System.Data.SqlClient; +using System.Data.SqlTypes; +using ProjetTheAlone.Classes; +#endregion + +namespace ProjetTheAlone.Acces +{ + /// + /// Couche d'accès aux données (Data Access Layer) + /// + public class A_T_lieu : ADBase + { + #region Constructeurs + public A_T_lieu(string sChaineConnexion) + : base(sChaineConnexion) + { } + #endregion + public int Ajouter(string L_nom) + { + CreerCommande("AjouterT_lieu"); + int res = 0; + Commande.Parameters.Add("ID_lieu", SqlDbType.Int); + Direction("ID_lieu", ParameterDirection.Output); + if(L_nom == null) Commande.Parameters.AddWithValue("@L_nom", Convert.DBNull); + else Commande.Parameters.AddWithValue("@L_nom", L_nom); + Commande.Connection.Open(); + Commande.ExecuteNonQuery(); + res = int.Parse(LireParametre("ID_lieu")); + Commande.Connection.Close(); + return res; + } + public int Modifier(int ID_lieu, string L_nom) + { + CreerCommande("ModifierT_lieu"); + int res = 0; + Commande.Parameters.AddWithValue("@ID_lieu", ID_lieu); + if(L_nom == null) Commande.Parameters.AddWithValue("@L_nom", Convert.DBNull); + else Commande.Parameters.AddWithValue("@L_nom", L_nom); + Commande.Connection.Open(); + Commande.ExecuteNonQuery(); + Commande.Connection.Close(); + return res; + } + public List Lire(string Index) + { + CreerCommande("SelectionnerT_lieu"); + Commande.Parameters.AddWithValue("@Index", Index); + Commande.Connection.Open(); + SqlDataReader dr = Commande.ExecuteReader(); + List res = new List(); + while (dr.Read()) + { + C_T_lieu tmp = new C_T_lieu(); + tmp.ID_lieu = int.Parse(dr["ID_lieu"].ToString()); + if(dr["L_nom"] != DBNull.Value) tmp.L_nom = (dr["L_nom"].ToString()); + res.Add(tmp); + } + dr.Close(); + Commande.Connection.Close(); + return res; + } + public C_T_lieu Lire_ID(int ID_lieu) + { + CreerCommande("SelectionnerT_lieu_ID"); + Commande.Parameters.AddWithValue("@ID_lieu", ID_lieu); + Commande.Connection.Open(); + SqlDataReader dr = Commande.ExecuteReader(); + C_T_lieu res = new C_T_lieu(); + while (dr.Read()) + { + res.ID_lieu = int.Parse(dr["ID_lieu"].ToString()); + if(dr["L_nom"] != DBNull.Value) res.L_nom = (dr["L_nom"].ToString()); + } + dr.Close(); + Commande.Connection.Close(); + return res; + } + public int Supprimer(int ID_lieu) + { + CreerCommande("SupprimerT_lieu"); + int res = 0; + Commande.Parameters.AddWithValue("@ID_lieu", ID_lieu); + Commande.Connection.Open(); + res = Commande.ExecuteNonQuery(); + Commande.Connection.Close(); + return res; + } + } +} diff --git a/ProjetTheAlone/Model - Copie/A_T_listParticipant.cs b/ProjetTheAlone/Model - Copie/A_T_listParticipant.cs new file mode 100644 index 0000000..d959f4d --- /dev/null +++ b/ProjetTheAlone/Model - Copie/A_T_listParticipant.cs @@ -0,0 +1,100 @@ +#region Ressources extérieures +using System; +using System.Collections.Generic; +using System.Text; +using System.Data; +using System.Data.SqlClient; +using System.Data.SqlTypes; +using ProjetTheAlone.Classes; +#endregion + +namespace ProjetTheAlone.Acces +{ + /// + /// Couche d'accès aux données (Data Access Layer) + /// + public class A_T_listParticipant : ADBase + { + #region Constructeurs + public A_T_listParticipant(string sChaineConnexion) + : base(sChaineConnexion) + { } + #endregion + public int Ajouter(int? ID_equipe, int? ID_benificiaire) + { + CreerCommande("AjouterT_listParticipant"); + int res = 0; + Commande.Parameters.Add("ID_LP", SqlDbType.Int); + Direction("ID_LP", ParameterDirection.Output); + if(ID_equipe == null) Commande.Parameters.AddWithValue("@ID_equipe", Convert.DBNull); + else Commande.Parameters.AddWithValue("@ID_equipe", ID_equipe); + if(ID_benificiaire == null) Commande.Parameters.AddWithValue("@ID_benificiaire", Convert.DBNull); + else Commande.Parameters.AddWithValue("@ID_benificiaire", ID_benificiaire); + Commande.Connection.Open(); + Commande.ExecuteNonQuery(); + res = int.Parse(LireParametre("ID_LP")); + Commande.Connection.Close(); + return res; + } + public int Modifier(int ID_LP, int? ID_equipe, int? ID_benificiaire) + { + CreerCommande("ModifierT_listParticipant"); + int res = 0; + Commande.Parameters.AddWithValue("@ID_LP", ID_LP); + if(ID_equipe == null) Commande.Parameters.AddWithValue("@ID_equipe", Convert.DBNull); + else Commande.Parameters.AddWithValue("@ID_equipe", ID_equipe); + if(ID_benificiaire == null) Commande.Parameters.AddWithValue("@ID_benificiaire", Convert.DBNull); + else Commande.Parameters.AddWithValue("@ID_benificiaire", ID_benificiaire); + Commande.Connection.Open(); + Commande.ExecuteNonQuery(); + Commande.Connection.Close(); + return res; + } + public List Lire(string Index) + { + CreerCommande("SelectionnerT_listParticipant"); + Commande.Parameters.AddWithValue("@Index", Index); + Commande.Connection.Open(); + SqlDataReader dr = Commande.ExecuteReader(); + List res = new List(); + while (dr.Read()) + { + C_T_listParticipant tmp = new C_T_listParticipant(); + tmp.ID_LP = int.Parse(dr["ID_LP"].ToString()); + if(dr["ID_equipe"] != DBNull.Value) tmp.ID_equipe = int.Parse(dr["ID_equipe"].ToString()); + if(dr["ID_benificiaire"] != DBNull.Value) tmp.ID_benificiaire = int.Parse(dr["ID_benificiaire"].ToString()); + res.Add(tmp); + } + dr.Close(); + Commande.Connection.Close(); + return res; + } + public C_T_listParticipant Lire_ID(int ID_LP) + { + CreerCommande("SelectionnerT_listParticipant_ID"); + Commande.Parameters.AddWithValue("@ID_LP", ID_LP); + Commande.Connection.Open(); + SqlDataReader dr = Commande.ExecuteReader(); + C_T_listParticipant res = new C_T_listParticipant(); + while (dr.Read()) + { + res.ID_LP = int.Parse(dr["ID_LP"].ToString()); + if(dr["ID_equipe"] != DBNull.Value) res.ID_equipe = int.Parse(dr["ID_equipe"].ToString()); + if(dr["ID_benificiaire"] != DBNull.Value) res.ID_benificiaire = int.Parse(dr["ID_benificiaire"].ToString()); + } + dr.Close(); + Commande.Connection.Close(); + return res; + } + public int Supprimer(int ID_LP) + { + CreerCommande("SupprimerT_listParticipant"); + int res = 0; + Commande.Parameters.AddWithValue("@ID_LP", ID_LP); + Commande.Connection.Open(); + res = Commande.ExecuteNonQuery(); + Commande.Connection.Close(); + return res; + } + } +} diff --git a/ProjetTheAlone/Model - Copie/A_T_listPlat.cs b/ProjetTheAlone/Model - Copie/A_T_listPlat.cs new file mode 100644 index 0000000..b9c0104 --- /dev/null +++ b/ProjetTheAlone/Model - Copie/A_T_listPlat.cs @@ -0,0 +1,117 @@ +#region Ressources extérieures +using System; +using System.Collections.Generic; +using System.Text; +using System.Data; +using System.Data.SqlClient; +using System.Data.SqlTypes; +using ProjetTheAlone.Classes; +#endregion + +namespace ProjetTheAlone.Acces +{ + /// + /// Couche d'accès aux données (Data Access Layer) + /// + public class A_T_listPlat : ADBase + { + #region Constructeurs + public A_T_listPlat(string sChaineConnexion) + : base(sChaineConnexion) + { } + #endregion + public int Ajouter(DateTime LP_DatePlat, int ID_plat) + { + CreerCommande("AjouterT_listPlat"); + int res = 0; + Commande.Parameters.Add("ID_listPlat", SqlDbType.Int); + Direction("ID_listPlat", ParameterDirection.Output); + Commande.Parameters.AddWithValue("@LP_DatePlat", LP_DatePlat); + Commande.Parameters.AddWithValue("@ID_plat", ID_plat); + Commande.Connection.Open(); + Commande.ExecuteNonQuery(); + res = int.Parse(LireParametre("ID_listPlat")); + Commande.Connection.Close(); + return res; + } + public int Modifier(int ID_listPlat, DateTime LP_DatePlat, int ID_plat) + { + CreerCommande("ModifierT_listPlat"); + int res = 0; + Commande.Parameters.AddWithValue("@ID_listPlat", ID_listPlat); + Commande.Parameters.AddWithValue("@LP_DatePlat", LP_DatePlat); + Commande.Parameters.AddWithValue("@ID_plat", ID_plat); + Commande.Connection.Open(); + Commande.ExecuteNonQuery(); + Commande.Connection.Close(); + return res; + } + public List Lire(string Index) + { + CreerCommande("SelectionnerT_listPlat"); + Commande.Parameters.AddWithValue("@Index", Index); + Commande.Connection.Open(); + SqlDataReader dr = Commande.ExecuteReader(); + List res = new List(); + while (dr.Read()) + { + C_T_listPlat tmp = new C_T_listPlat(); + tmp.ID_listPlat = int.Parse(dr["ID_listPlat"].ToString()); + tmp.ID_repa = int.Parse(dr["ID_repa"].ToString()); + tmp.ID_plat = int.Parse(dr["ID_plat"].ToString()); + res.Add(tmp); + } + dr.Close(); + Commande.Connection.Close(); + return res; + } + public C_T_listPlat Lire_ID(int ID_listPlat) + { + CreerCommande("SelectionnerT_listPlat_ID"); + Commande.Parameters.AddWithValue("@ID_listPlat", ID_listPlat); + Commande.Connection.Open(); + SqlDataReader dr = Commande.ExecuteReader(); + C_T_listPlat res = new C_T_listPlat(); + while (dr.Read()) + { + res.ID_listPlat = int.Parse(dr["ID_listPlat"].ToString()); + res.ID_repa = int.Parse(dr["ID_repa"].ToString()); + res.ID_plat = int.Parse(dr["ID_plat"].ToString()); + } + dr.Close(); + Commande.Connection.Close(); + return res; + } + public List Lire(DateTime LP_DateRepas) + { + CreerCommande("SelectRepaByDate"); + Commande.Parameters.AddWithValue("@dateV", LP_DateRepas); + Commande.Connection.Open(); + SqlDataReader dr = Commande.ExecuteReader(); + List res = new List(); + 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 = Outil.toNullableByteArray.Convert((byte[])dr["P_img"]); + var x = dr["ID_typePlat"]; + if (dr["ID_typePlat"] != DBNull.Value) tmp.ID_typePlat = (C_T_plat.TypePlat_E)(int.Parse(dr["ID_typePlat"].ToString())); + res.Add(tmp); + } + dr.Close(); + Commande.Connection.Close(); + return res; + } + public int Supprimer(int ID_listPlat) + { + CreerCommande("SupprimerT_listPlat"); + int res = 0; + Commande.Parameters.AddWithValue("@ID_listPlat", ID_listPlat); + Commande.Connection.Open(); + res = Commande.ExecuteNonQuery(); + Commande.Connection.Close(); + return res; + } + } +} diff --git a/ProjetTheAlone/Model - Copie/A_T_plat.cs b/ProjetTheAlone/Model - Copie/A_T_plat.cs new file mode 100644 index 0000000..7d87de3 --- /dev/null +++ b/ProjetTheAlone/Model - Copie/A_T_plat.cs @@ -0,0 +1,131 @@ +#region Ressources extérieures +using System; +using System.Collections.Generic; +using System.Text; +using System.Data; +using System.Data.SqlClient; +using System.Data.SqlTypes; +using ProjetTheAlone.Classes; +#endregion + +namespace ProjetTheAlone.Acces +{ + /// + /// Couche d'accès aux données (Data Access Layer) + /// + public class A_T_plat : ADBase + { + public enum TypePlat_E { soupe, plat, dessert} + #region Constructeurs + public A_T_plat(string sChaineConnexion) + : base(sChaineConnexion) + { } + #endregion + public int Ajouter(string P_nom, byte?[] P_img, int? ID_typePlat) + { + CreerCommande("AjouterT_plat"); + int res = 0; + Commande.Parameters.Add("ID_plat", SqlDbType.Int); + Direction("ID_plat", ParameterDirection.Output); + if(P_nom == null) Commande.Parameters.AddWithValue("@P_nom", Convert.DBNull); + else Commande.Parameters.AddWithValue("@P_nom", P_nom); + if(P_img == null) Commande.Parameters.AddWithValue("@P_img", Convert.DBNull); + else Commande.Parameters.AddWithValue("@P_img", SqlDbType.Image).Value = Outil.toByteArray.Convert(P_img); + if(ID_typePlat == null) Commande.Parameters.AddWithValue("@ID_typePlat", Convert.DBNull); + else Commande.Parameters.AddWithValue("@ID_typePlat", ID_typePlat); + Commande.Connection.Open(); + Commande.ExecuteNonQuery(); + res = int.Parse(LireParametre("ID_plat")); + Commande.Connection.Close(); + return res; + } + public int Modifier(int ID_plat, string P_nom, byte?[] P_img, int? ID_typePlat) + { + CreerCommande("ModifierT_plat"); + int res = 0; + Commande.Parameters.AddWithValue("@ID_plat", ID_plat); + if(P_nom == null) Commande.Parameters.AddWithValue("@P_nom", Convert.DBNull); + else Commande.Parameters.AddWithValue("@P_nom", P_nom); + if(P_img == null) Commande.Parameters.AddWithValue("@P_img", Convert.DBNull); + else Commande.Parameters.AddWithValue("@P_img", SqlDbType.Image).Value = Outil.toByteArray.Convert(P_img); + if (ID_typePlat == null) Commande.Parameters.AddWithValue("@ID_typePlat", Convert.DBNull); + else Commande.Parameters.AddWithValue("@ID_typePlat", ID_typePlat); + Commande.Connection.Open(); + Commande.ExecuteNonQuery(); + Commande.Connection.Close(); + return res; + } + public List Lire(string Index) + { + CreerCommande("SelectionnerT_plat"); + Commande.Parameters.AddWithValue("@Index", Index); + Commande.Connection.Open(); + SqlDataReader dr = Commande.ExecuteReader(); + List res = new List(); + 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 = Outil.toNullableByteArray.Convert((byte[])dr["P_img"]); + var x = dr["ID_typePlat"]; + if (dr["ID_typePlat"] != DBNull.Value) tmp.ID_typePlat = (C_T_plat.TypePlat_E)(int.Parse(dr["ID_typePlat"].ToString())); + res.Add(tmp); + } + dr.Close(); + Commande.Connection.Close(); + return res; + } + /// + /// Permet de récupérer la liste des plats d'un repas + /// + public List ListPlat(int ID_repa) + { + CreerCommande("ListPlat"); + Commande.Parameters.AddWithValue("@ID_repa", ID_repa); + Commande.Connection.Open(); + SqlDataReader dr = Commande.ExecuteReader(); + List res = new List(); + 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 = (byte?[])(dr["P_img"]); + if (dr["ID_typePlat"] != DBNull.Value) tmp.ID_typePlat = (C_T_plat.TypePlat_E)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); + Commande.Connection.Open(); + SqlDataReader dr = Commande.ExecuteReader(); + C_T_plat res = new C_T_plat(); + while (dr.Read()) + { + res.ID_plat = int.Parse(dr["ID_plat"].ToString()); + if(dr["P_nom"] != DBNull.Value) res.P_nom = (dr["P_nom"].ToString()); + if(dr["P_img"] != DBNull.Value) res.P_img = Outil.toNullableByteArray.Convert((byte[])dr["P_img"]); + if(dr["ID_typePlat"] != DBNull.Value) res.ID_typePlat = (C_T_plat.TypePlat_E)int.Parse(dr["ID_typePlat"].ToString()); + } + dr.Close(); + Commande.Connection.Close(); + return res; + } + public int Supprimer(int ID_plat) + { + CreerCommande("SupprimerT_plat"); + int res = 0; + Commande.Parameters.AddWithValue("@ID_plat", ID_plat); + Commande.Connection.Open(); + res = Commande.ExecuteNonQuery(); + Commande.Connection.Close(); + return res; + } + } +} diff --git a/ProjetTheAlone/Model - Copie/A_T_repa.cs b/ProjetTheAlone/Model - Copie/A_T_repa.cs new file mode 100644 index 0000000..1ccd3c6 --- /dev/null +++ b/ProjetTheAlone/Model - Copie/A_T_repa.cs @@ -0,0 +1,157 @@ +#region Ressources extérieures +using System; +using System.Collections.Generic; +using System.Text; +using System.Data; +using System.Data.SqlClient; +using System.Data.SqlTypes; +using ProjetTheAlone.Classes; +#endregion + +namespace ProjetTheAlone.Acces +{ + /// + /// Couche d'accès aux données (Data Access Layer) + /// + public class A_T_repa : ADBase + { + #region Constructeurs + public A_T_repa(string sChaineConnexion) + : base(sChaineConnexion) + { } + #endregion + public int Ajouter(int? ID_listPlat, int? ID_typeRepa, DateTime R_Date) + { + CreerCommande("AjouterT_repa"); + int res = 0; + Commande.Parameters.Add("ID_repa", SqlDbType.Int); + Direction("ID_repa", ParameterDirection.Output); + if(ID_listPlat == null) Commande.Parameters.AddWithValue("@ID_listPlat", Convert.DBNull); + else Commande.Parameters.AddWithValue("@ID_listPlat", ID_listPlat); + if(ID_typeRepa == null) Commande.Parameters.AddWithValue("@ID_typeRepa", Convert.DBNull); + else Commande.Parameters.AddWithValue("@ID_typeRepa", ID_typeRepa); + Commande.Parameters.AddWithValue("@R_Date", R_Date); + Commande.Connection.Open(); + Commande.ExecuteNonQuery(); + res = int.Parse(LireParametre("ID_repa")); + Commande.Connection.Close(); + return res; + } + public int Modifier(int ID_repa, int? ID_listPlat, int? ID_typeRepa , DateTime R_Date) + { + CreerCommande("ModifierT_repa"); + int res = 0; + Commande.Parameters.AddWithValue("@ID_repa", ID_repa); + if(ID_listPlat == null) Commande.Parameters.AddWithValue("@ID_listPlat", Convert.DBNull); + else Commande.Parameters.AddWithValue("@ID_listPlat", ID_listPlat); + if(ID_typeRepa == null) Commande.Parameters.AddWithValue("@ID_typeRepa", Convert.DBNull); + else Commande.Parameters.AddWithValue("@ID_typeRepa", ID_typeRepa); + Commande.Parameters.AddWithValue("@R_Date", R_Date); + Commande.Connection.Open(); + Commande.ExecuteNonQuery(); + Commande.Connection.Close(); + return res; + } + public List Lire(string Index) + { + CreerCommande("SelectionnerT_repa"); + Commande.Parameters.AddWithValue("@Index", Index); + Commande.Connection.Open(); + SqlDataReader dr = Commande.ExecuteReader(); + List res = new List(); + while (dr.Read()) + { + C_T_repa tmp = new C_T_repa(); + tmp.ID_repa = int.Parse(dr["ID_repa"].ToString()); + tmp.R_Date = DateTime.Parse(dr["R_Date"].ToString()); + if(dr["ID_listPlat"] != DBNull.Value) tmp.ID_listPlat = int.Parse(dr["ID_listPlat"].ToString()); + if(dr["ID_typeRepa"] != DBNull.Value) tmp.ID_typeRepa = int.Parse(dr["ID_typeRepa"].ToString()); + res.Add(tmp); + } + dr.Close(); + Commande.Connection.Close(); + return res; + } + + /// + /// Permet de récupérer les repas entre deux date + /// + /// Date filtre debut compris + /// Date fin non compris + + public List Lire(DateTime start, DateTime end) + { + CreerCommande("SelectEventBetweenTwoDateTime"); + Commande.Parameters.AddWithValue("@dateStart", start); + Commande.Parameters.AddWithValue("@dateEnd", end); + Commande.Connection.Open(); + SqlDataReader dr = Commande.ExecuteReader(); + List res = new List(); + while (dr.Read()) + { + C_T_repa tmp = new C_T_repa(); + tmp.ID_repa = int.Parse(dr["ID_repa"].ToString()); + tmp.R_Date = DateTime.Parse(dr["R_Date"].ToString()); + if (dr["ID_listPlat"] != DBNull.Value) tmp.ID_listPlat = int.Parse(dr["ID_listPlat"].ToString()); + if (dr["ID_typeRepa"] != DBNull.Value) tmp.ID_typeRepa = int.Parse(dr["ID_typeRepa"].ToString()); + res.Add(tmp); + } + dr.Close(); + Commande.Connection.Close(); + return res; + } + /// + /// Permet de récupérer les repas d'une date donnée + /// + /// Date filtre + + public List Lire(DateTime dateV) + { + CreerCommande("SelectEventBetweenTwoDateTime"); + Commande.Parameters.AddWithValue("@dateV", dateV); + Commande.Connection.Open(); + SqlDataReader dr = Commande.ExecuteReader(); + List res = new List(); + while (dr.Read()) + { + C_T_repa tmp = new C_T_repa(); + tmp.ID_repa = int.Parse(dr["ID_repa"].ToString()); + tmp.R_Date = DateTime.Parse(dr["R_Date"].ToString()); + if (dr["ID_listPlat"] != DBNull.Value) tmp.ID_listPlat = int.Parse(dr["ID_listPlat"].ToString()); + if (dr["ID_typeRepa"] != DBNull.Value) tmp.ID_typeRepa = int.Parse(dr["ID_typeRepa"].ToString()); + res.Add(tmp); + } + dr.Close(); + Commande.Connection.Close(); + return res; + } + public C_T_repa Lire_ID(int ID_repa) + { + CreerCommande("SelectionnerT_repa_ID"); + Commande.Parameters.AddWithValue("@ID_repa", ID_repa); + Commande.Connection.Open(); + SqlDataReader dr = Commande.ExecuteReader(); + C_T_repa res = new C_T_repa(); + while (dr.Read()) + { + res.R_Date = DateTime.Parse(dr["R_Date"].ToString()); + res.ID_repa = int.Parse(dr["ID_repa"].ToString()); + if(dr["ID_listPlat"] != DBNull.Value) res.ID_listPlat = int.Parse(dr["ID_listPlat"].ToString()); + if(dr["ID_typeRepa"] != DBNull.Value) res.ID_typeRepa = int.Parse(dr["ID_typeRepa"].ToString()); + } + dr.Close(); + Commande.Connection.Close(); + return res; + } + public int Supprimer(int ID_repa) + { + CreerCommande("SupprimerT_repa"); + int res = 0; + Commande.Parameters.AddWithValue("@ID_repa", ID_repa); + Commande.Connection.Open(); + res = Commande.ExecuteNonQuery(); + Commande.Connection.Close(); + return res; + } + } +} diff --git a/ProjetTheAlone/Model - Copie/A_T_typeEvenement.cs b/ProjetTheAlone/Model - Copie/A_T_typeEvenement.cs new file mode 100644 index 0000000..3b281c6 --- /dev/null +++ b/ProjetTheAlone/Model - Copie/A_T_typeEvenement.cs @@ -0,0 +1,96 @@ +#region Ressources extérieures +using System; +using System.Collections.Generic; +using System.Text; +using System.Data; +using System.Data.SqlClient; +using System.Data.SqlTypes; +using ProjetTheAlone.Classes; +#endregion + +namespace ProjetTheAlone.Acces +{ + /// + /// Couche d'accès aux données (Data Access Layer) + /// + public class A_T_typeEvenement : ADBase + { + string _TE_Nom; + public string TE_Nom { get => _TE_Nom; set => _TE_Nom = value; } + #region Constructeurs + public A_T_typeEvenement(string sChaineConnexion) + : base(sChaineConnexion) + { } + #endregion + public int Ajouter(string TE_nom) + { + CreerCommande("AjouterT_typeEvenement"); + int res = 0; + Commande.Parameters.Add("ID_typeEvenement", SqlDbType.Int); + Direction("ID_typeEvenement", ParameterDirection.Output); + if(TE_nom == null) Commande.Parameters.AddWithValue("@TE_nom", Convert.DBNull); + else Commande.Parameters.AddWithValue("@TE_nom", TE_nom); + Commande.Connection.Open(); + Commande.ExecuteNonQuery(); + res = int.Parse(LireParametre("ID_typeEvenement")); + Commande.Connection.Close(); + return res; + } + public int Modifier(int ID_typeEvenement,string TE_nom) + { + CreerCommande("ModifierT_typeEvenement"); + int res = 0; + Commande.Parameters.AddWithValue("@ID_typeEvenement", ID_typeEvenement); + if(TE_nom == null) Commande.Parameters.AddWithValue("@TE_nom", Convert.DBNull); + else Commande.Parameters.AddWithValue("@TE_nom", TE_nom); + Commande.Connection.Open(); + Commande.ExecuteNonQuery(); + Commande.Connection.Close(); + return res; + } + public List Lire(string Index) + { + CreerCommande("SelectionnerT_typeEvenement"); + Commande.Parameters.AddWithValue("@Index", Index); + Commande.Connection.Open(); + SqlDataReader dr = Commande.ExecuteReader(); + List res = new List(); + while (dr.Read()) + { + C_T_typeEvenement tmp = new C_T_typeEvenement(); + tmp.ID_typeEvenement = int.Parse(dr["ID_typeEvenement"].ToString()); + if(dr["TE_nom"] != DBNull.Value) tmp.TE_nom = (dr["TE_nom"].ToString()); + res.Add(tmp); + } + dr.Close(); + Commande.Connection.Close(); + return res; + } + public C_T_typeEvenement Lire_ID(int ID_typeEvenement) + { + CreerCommande("SelectionnerT_typeEvenement_ID"); + Commande.Parameters.AddWithValue("@ID_typeEvenement", ID_typeEvenement); + Commande.Connection.Open(); + SqlDataReader dr = Commande.ExecuteReader(); + C_T_typeEvenement res = new C_T_typeEvenement(); + while (dr.Read()) + { + res.ID_typeEvenement = int.Parse(dr["ID_typeEvenement"].ToString()); + if(dr["TE_nom"] != DBNull.Value) res.TE_nom = (dr["TE_nom"].ToString()); + } + dr.Close(); + Commande.Connection.Close(); + return res; + } + public int Supprimer(int ID_typeEvenement) + { + CreerCommande("SupprimerT_typeEvenement"); + int res = 0; + Commande.Parameters.AddWithValue("@ID_typeEvenement", ID_typeEvenement); + Commande.Connection.Open(); + res = Commande.ExecuteNonQuery(); + Commande.Connection.Close(); + return res; + } + } +} diff --git a/ProjetTheAlone/Model - Copie/A_T_typePlat.cs b/ProjetTheAlone/Model - Copie/A_T_typePlat.cs new file mode 100644 index 0000000..7bb322d --- /dev/null +++ b/ProjetTheAlone/Model - Copie/A_T_typePlat.cs @@ -0,0 +1,94 @@ +#region Ressources extérieures +using System; +using System.Collections.Generic; +using System.Text; +using System.Data; +using System.Data.SqlClient; +using System.Data.SqlTypes; +using ProjetTheAlone.Classes; +#endregion + +namespace ProjetTheAlone.Acces +{ + /// + /// Couche d'accès aux données (Data Access Layer) + /// + public class A_T_typePlat : ADBase + { + #region Constructeurs + public A_T_typePlat(string sChaineConnexion) + : base(sChaineConnexion) + { } + #endregion + public int Ajouter(string TP_nom) + { + CreerCommande("AjouterT_typePlat"); + int res = 0; + Commande.Parameters.Add("ID_typePlat", SqlDbType.Int); + Direction("ID_typePlat", ParameterDirection.Output); + if(TP_nom == null) Commande.Parameters.AddWithValue("@TP_nom", Convert.DBNull); + else Commande.Parameters.AddWithValue("@TP_nom", TP_nom); + Commande.Connection.Open(); + Commande.ExecuteNonQuery(); + res = int.Parse(LireParametre("ID_typePlat")); + Commande.Connection.Close(); + return res; + } + public int Modifier(int ID_typePlat, string TP_nom) + { + CreerCommande("ModifierT_typePlat"); + int res = 0; + Commande.Parameters.AddWithValue("@ID_typePlat", ID_typePlat); + if(TP_nom == null) Commande.Parameters.AddWithValue("@TP_nom", Convert.DBNull); + else Commande.Parameters.AddWithValue("@TP_nom", TP_nom); + Commande.Connection.Open(); + Commande.ExecuteNonQuery(); + Commande.Connection.Close(); + return res; + } + public List Lire(string Index) + { + CreerCommande("SelectionnerT_typePlat"); + Commande.Parameters.AddWithValue("@Index", Index); + Commande.Connection.Open(); + SqlDataReader dr = Commande.ExecuteReader(); + List res = new List(); + while (dr.Read()) + { + C_T_typePlat tmp = new C_T_typePlat(); + tmp.ID_typePlat = int.Parse(dr["ID_typePlat"].ToString()); + tmp.TP_nom = dr["TP_nom"].ToString(); + res.Add(tmp); + } + dr.Close(); + Commande.Connection.Close(); + return res; + } + public C_T_typePlat Lire_ID(int ID_typePlat) + { + CreerCommande("SelectionnerT_typePlat_ID"); + Commande.Parameters.AddWithValue("@ID_typePlat", ID_typePlat); + Commande.Connection.Open(); + SqlDataReader dr = Commande.ExecuteReader(); + C_T_typePlat res = new C_T_typePlat(); + while (dr.Read()) + { + res.ID_typePlat = int.Parse(dr["ID_typePlat"].ToString()); + res.TP_nom = dr["TP_nom"].ToString(); + } + dr.Close(); + Commande.Connection.Close(); + return res; + } + public int Supprimer(int ID_typePlat) + { + CreerCommande("SupprimerT_typePlat"); + int res = 0; + Commande.Parameters.AddWithValue("@ID_typePlat", ID_typePlat); + Commande.Connection.Open(); + res = Commande.ExecuteNonQuery(); + Commande.Connection.Close(); + return res; + } + } +} diff --git a/ProjetTheAlone/Model - Copie/A_T_typeRepa.cs b/ProjetTheAlone/Model - Copie/A_T_typeRepa.cs new file mode 100644 index 0000000..580161b --- /dev/null +++ b/ProjetTheAlone/Model - Copie/A_T_typeRepa.cs @@ -0,0 +1,94 @@ +#region Ressources extérieures +using System; +using System.Collections.Generic; +using System.Text; +using System.Data; +using System.Data.SqlClient; +using System.Data.SqlTypes; +using ProjetTheAlone.Classes; +#endregion + +namespace ProjetTheAlone.Acces +{ + /// + /// Couche d'accès aux données (Data Access Layer) + /// + public class A_T_typeRepa : ADBase + { + #region Constructeurs + public A_T_typeRepa(string sChaineConnexion) + : base(sChaineConnexion) + { } + #endregion + public int Ajouter(string TR_nom) + { + CreerCommande("AjouterT_typeRepa"); + int res = 0; + Commande.Parameters.Add("ID_typeRepa", SqlDbType.Int); + Direction("ID_typeRepa", ParameterDirection.Output); + if(TR_nom == null) Commande.Parameters.AddWithValue("@TR_nom", Convert.DBNull); + else Commande.Parameters.AddWithValue("@TR_nom", TR_nom); + Commande.Connection.Open(); + Commande.ExecuteNonQuery(); + res = int.Parse(LireParametre("ID_typeRepa")); + Commande.Connection.Close(); + return res; + } + public int Modifier(int ID_typeRepa, string TR_nom) + { + CreerCommande("ModifierT_typeRepa"); + int res = 0; + Commande.Parameters.AddWithValue("@ID_typeRepa", ID_typeRepa); + if(TR_nom == null) Commande.Parameters.AddWithValue("@TR_nom", Convert.DBNull); + else Commande.Parameters.AddWithValue("@TR_nom", TR_nom); + Commande.Connection.Open(); + Commande.ExecuteNonQuery(); + Commande.Connection.Close(); + return res; + } + public List Lire(string Index) + { + CreerCommande("SelectionnerT_typeRepa"); + Commande.Parameters.AddWithValue("@Index", Index); + Commande.Connection.Open(); + SqlDataReader dr = Commande.ExecuteReader(); + List res = new List(); + while (dr.Read()) + { + C_T_typeRepa tmp = new C_T_typeRepa(); + tmp.ID_typeRepa = int.Parse(dr["ID_typeRepa"].ToString()); + tmp.TR_nom = dr["TR_nom"].ToString(); + res.Add(tmp); + } + dr.Close(); + Commande.Connection.Close(); + return res; + } + public C_T_typeRepa Lire_ID(int ID_typeRepa) + { + CreerCommande("SelectionnerT_typeRepa_ID"); + Commande.Parameters.AddWithValue("@ID_typeRepa", ID_typeRepa); + Commande.Connection.Open(); + SqlDataReader dr = Commande.ExecuteReader(); + C_T_typeRepa res = new C_T_typeRepa(); + while (dr.Read()) + { + res.ID_typeRepa = int.Parse(dr["ID_typeRepa"].ToString()); + res.TR_nom = dr["TR_nom"].ToString(); + } + dr.Close(); + Commande.Connection.Close(); + return res; + } + public int Supprimer(int ID_typeRepa) + { + CreerCommande("SupprimerT_typeRepa"); + int res = 0; + Commande.Parameters.AddWithValue("@ID_typeRepa", ID_typeRepa); + Commande.Connection.Open(); + res = Commande.ExecuteNonQuery(); + Commande.Connection.Close(); + return res; + } + } +} diff --git a/ProjetTheAlone/Model - Copie/C_T_beneficiaire.cs b/ProjetTheAlone/Model - Copie/C_T_beneficiaire.cs new file mode 100644 index 0000000..2a38f34 --- /dev/null +++ b/ProjetTheAlone/Model - Copie/C_T_beneficiaire.cs @@ -0,0 +1,65 @@ +#region Ressources extérieures +using System; +using System.Collections.Generic; +using System.Text; +#endregion + +namespace ProjetTheAlone.Classes +{ + /// + /// Classe de définition des données + /// + public class C_T_beneficiaire + { + #region Données membres + private int _ID_beneficiaire; + private string _B_nom; + private string _B_prenom; + private DateTime? _B_anniversaire; + private byte?[] _B_img; + #endregion + #region Constructeurs + public C_T_beneficiaire() + { } + 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_, byte?[] B_img_) + : this(B_nom_, B_prenom_, B_anniversaire_, B_img_) + { + ID_beneficiaire = ID_beneficiaire_; + } + #endregion + #region Accesseurs + public int ID_beneficiaire + { + get { return _ID_beneficiaire; } + set { _ID_beneficiaire = value; } + } + public string B_nom + { + get { return _B_nom; } + set { _B_nom = value; } + } + public string B_prenom + { + get { return _B_prenom; } + set { _B_prenom = value; } + } + public DateTime? B_anniversaire + { + get { return _B_anniversaire; } + set { _B_anniversaire = value; } + } + public byte?[] B_img + { + get { return _B_img; } + set { _B_img = value; } + } + #endregion + } +} diff --git a/ProjetTheAlone/Model - Copie/C_T_equipe.cs b/ProjetTheAlone/Model - Copie/C_T_equipe.cs new file mode 100644 index 0000000..da314c1 --- /dev/null +++ b/ProjetTheAlone/Model - Copie/C_T_equipe.cs @@ -0,0 +1,58 @@ +#region Ressources extérieures +using System; +using System.Collections.Generic; +using System.Text; +#endregion + +namespace ProjetTheAlone.Classes +{ + /// + /// Classe de définition des données + /// + public class C_T_equipe + { + #region Données membres + private int _ID_equipe; + private string _E_nom; + private int _E_point; + private int? _ID_evenement; + #endregion + #region Constructeurs + public C_T_equipe() + { } + public C_T_equipe(string E_nom_, int E_point_, int? ID_evenement_) + { + E_nom = E_nom_; + E_point = E_point_; + ID_evenement = ID_evenement_; + } + public C_T_equipe(int ID_equipe_, string E_nom_, int E_point_, int? ID_evenement_) + : this(E_nom_, E_point_, ID_evenement_) + { + ID_equipe = ID_equipe_; + } + #endregion + #region Accesseurs + public int ID_equipe + { + get { return _ID_equipe; } + set { _ID_equipe = value; } + } + public string E_nom + { + get { return _E_nom; } + set { _E_nom = value; } + } + public int E_point + { + get { return _E_point; } + set { _E_point = value; } + } + public int? ID_evenement + { + get { return _ID_evenement; } + set { _ID_evenement = value; } + } + #endregion + } +} diff --git a/ProjetTheAlone/Model - Copie/C_T_event.cs b/ProjetTheAlone/Model - Copie/C_T_event.cs new file mode 100644 index 0000000..f2bdd8e --- /dev/null +++ b/ProjetTheAlone/Model - Copie/C_T_event.cs @@ -0,0 +1,70 @@ +#region Ressources extérieures +using System; +using System.Collections.Generic; +using System.Text; +#endregion + +namespace ProjetTheAlone.Classes +{ + /// + /// Classe de définition des données + /// + public class C_T_event + { + #region Données membres + private int _ID_event; + private DateTime? _E_date; + private DateTime? _E_duree; + private int? _ID_typeEvenement; + private string _E_description; + private int? _ID_lieu; + private byte?[] _E_Pic; + #endregion + #region Constructeurs + public C_T_event() + { } + public C_T_event(DateTime? E_date_, DateTime? E_duree_, int? ID_typeEvenement_, string E_description_, int? ID_lieu_, byte?[] E_Pic_) + { + E_date = E_date_; + E_duree = E_duree_; + ID_typeEvenement = ID_typeEvenement_; + E_description = E_description_; + ID_lieu = ID_lieu_; + E_Pic = E_Pic_; + } + public C_T_event(int ID_event_, DateTime? E_date_, DateTime? E_duree_, int? ID_typeEvenement_, string E_description_, int? ID_lieu_, byte?[] E_Pic_) + : this(E_date_, E_duree_, ID_typeEvenement_, E_description_, ID_lieu_, E_Pic_) + { + ID_event = ID_event_; + } + #endregion + #region Accesseurs + public int ID_event + { + get { return _ID_event; } + set { _ID_event = value; } + } + public DateTime? E_date + { + get { return _E_date; } + set { _E_date = value; } + } + public DateTime? E_duree + { + get { return _E_duree; } + set { _E_duree = value; } + } + public int? ID_typeEvenement + { + get { return _ID_typeEvenement; } + set { _ID_typeEvenement = value; } + } + + public string E_description { get => _E_description; set => _E_description = value; } + public int? ID_lieu { get => _ID_lieu; set => _ID_lieu = value; } + public byte?[] E_Pic { get => _E_Pic; set => _E_Pic = value; } + + + #endregion + } +} diff --git a/ProjetTheAlone/Model - Copie/C_T_lieu.cs b/ProjetTheAlone/Model - Copie/C_T_lieu.cs new file mode 100644 index 0000000..0e921a1 --- /dev/null +++ b/ProjetTheAlone/Model - Copie/C_T_lieu.cs @@ -0,0 +1,44 @@ +#region Ressources extérieures +using System; +using System.Collections.Generic; +using System.Text; +#endregion + +namespace ProjetTheAlone.Classes +{ + /// + /// Classe de définition des données + /// + public class C_T_lieu + { + #region Données membres + private int _ID_lieu; + private string _L_nom; + #endregion + #region Constructeurs + public C_T_lieu() + { } + public C_T_lieu(string L_nom_) + { + L_nom = L_nom_; + } + public C_T_lieu(int ID_lieu_,string L_nom_) + : this(L_nom_) + { + ID_lieu = ID_lieu_; + } + #endregion + #region Accesseurs + public int ID_lieu + { + get { return _ID_lieu; } + set { _ID_lieu = value; } + } + public string L_nom + { + get { return _L_nom; } + set { _L_nom = value; } + } + #endregion + } +} diff --git a/ProjetTheAlone/Model - Copie/C_T_listParticipant.cs b/ProjetTheAlone/Model - Copie/C_T_listParticipant.cs new file mode 100644 index 0000000..e9bbc6f --- /dev/null +++ b/ProjetTheAlone/Model - Copie/C_T_listParticipant.cs @@ -0,0 +1,51 @@ +#region Ressources extérieures +using System; +using System.Collections.Generic; +using System.Text; +#endregion + +namespace ProjetTheAlone.Classes +{ + /// + /// Classe de définition des données + /// + public class C_T_listParticipant + { + #region Données membres + private int _ID_LP; + private int? _ID_equipe; + private int? _ID_benificiaire; + #endregion + #region Constructeurs + public C_T_listParticipant() + { } + public C_T_listParticipant(int? ID_equipe_, int? ID_benificiaire_) + { + ID_equipe = ID_equipe_; + ID_benificiaire = ID_benificiaire_; + } + public C_T_listParticipant(int ID_LP_, int? ID_equipe_, int? ID_benificiaire_) + : this(ID_equipe_, ID_benificiaire_) + { + ID_LP = ID_LP_; + } + #endregion + #region Accesseurs + public int ID_LP + { + get { return _ID_LP; } + set { _ID_LP = value; } + } + public int? ID_equipe + { + get { return _ID_equipe; } + set { _ID_equipe = value; } + } + public int? ID_benificiaire + { + get { return _ID_benificiaire; } + set { _ID_benificiaire = value; } + } + #endregion + } +} diff --git a/ProjetTheAlone/Model - Copie/C_T_listPlat.cs b/ProjetTheAlone/Model - Copie/C_T_listPlat.cs new file mode 100644 index 0000000..ca70cc3 --- /dev/null +++ b/ProjetTheAlone/Model - Copie/C_T_listPlat.cs @@ -0,0 +1,51 @@ +#region Ressources extérieures +using System; +using System.Collections.Generic; +using System.Text; +#endregion + +namespace ProjetTheAlone.Classes +{ + /// + /// Classe de définition des données + /// + public class C_T_listPlat + { + #region Données membres + private int _ID_listPlat; + private int _ID_repa; + private int _ID_plat; + #endregion + #region Constructeurs + public C_T_listPlat() + { } + public C_T_listPlat(int ID_repa_, int ID_plat_) + { + ID_repa = ID_repa_; + ID_plat = ID_plat_; + } + public C_T_listPlat(int ID_listPlat_, int ID_repa_, int ID_plat_) + : this(ID_repa_, ID_plat_) + { + ID_listPlat = ID_listPlat_; + } + #endregion + #region Accesseurs + public int ID_listPlat + { + get { return _ID_listPlat; } + set { _ID_listPlat = value; } + } + public int ID_repa + { + get { return _ID_repa; } + set { _ID_repa = value; } + } + public int ID_plat + { + get { return _ID_plat; } + set { _ID_plat = value; } + } + #endregion + } +} diff --git a/ProjetTheAlone/Model - Copie/C_T_plat.cs b/ProjetTheAlone/Model - Copie/C_T_plat.cs new file mode 100644 index 0000000..54036b9 --- /dev/null +++ b/ProjetTheAlone/Model - Copie/C_T_plat.cs @@ -0,0 +1,59 @@ +#region Ressources extérieures +using System; +using System.Collections.Generic; +using System.Text; +#endregion + +namespace ProjetTheAlone.Classes +{ + /// + /// Classe de définition des données + /// + public class C_T_plat + { + public enum TypePlat_E { Soupe, Plat, Dessert} + #region Données membres + private int _ID_plat; + private string _P_nom; + private byte?[] _P_img; + private TypePlat_E _ID_typePlat; + #endregion + #region Constructeurs + public C_T_plat() + { } + public C_T_plat(string P_nom_, byte?[] P_img_, int? ID_typePlat_) + { + P_nom = P_nom_; + P_img = P_img_; + ID_typePlat = (C_T_plat.TypePlat_E)ID_typePlat_; + } + public C_T_plat(int ID_plat_, string P_nom_, byte?[] P_img_, int? ID_typePlat_) + : this(P_nom_, P_img_, ID_typePlat_) + { + ID_plat = ID_plat_; + } + #endregion + #region Accesseurs + public int ID_plat + { + get { return _ID_plat; } + set { _ID_plat = value; } + } + public string P_nom + { + get { return _P_nom; } + set { _P_nom = value; } + } + public byte?[] P_img + { + get { return _P_img; } + set { _P_img = value; } + } + public TypePlat_E ID_typePlat + { + get { return _ID_typePlat; } + set { _ID_typePlat = value; } + } + #endregion + } +} diff --git a/ProjetTheAlone/Model - Copie/C_T_repa.cs b/ProjetTheAlone/Model - Copie/C_T_repa.cs new file mode 100644 index 0000000..8a8c713 --- /dev/null +++ b/ProjetTheAlone/Model - Copie/C_T_repa.cs @@ -0,0 +1,56 @@ +#region Ressources extérieures +using System; +using System.Collections.Generic; +using System.Text; +#endregion + +namespace ProjetTheAlone.Classes +{ + /// + /// Classe de définition des données + /// + public class C_T_repa + { + #region Données membres + private int _ID_repa; + private int? _ID_listPlat; + private int? _ID_typeRepa; + private DateTime _R_Date; + #endregion + #region Constructeurs + public C_T_repa() + { } + public C_T_repa(int? ID_listPlat_, int? ID_typeRepa_, DateTime R_Date_) + { + ID_listPlat = ID_listPlat_; + ID_typeRepa = ID_typeRepa_; + R_Date = R_Date_; + } + public C_T_repa(int ID_repa_, int? ID_listPlat_, int? ID_typeRepa_, DateTime R_Date_) + : this(ID_listPlat_, ID_typeRepa_, R_Date_) + { + ID_repa = ID_repa_; + } + #endregion + #region Accesseurs + public int ID_repa + { + get { return _ID_repa; } + set { _ID_repa = value; } + } + public int? ID_listPlat + { + get { return _ID_listPlat; } + set { _ID_listPlat = value; } + } + public int? ID_typeRepa + { + get { return _ID_typeRepa; } + set { _ID_typeRepa = value; } + } + + + public DateTime R_Date { get => _R_Date; set => _R_Date = value; } + #endregion + } +} diff --git a/ProjetTheAlone/Model - Copie/C_T_typeEvenement.cs b/ProjetTheAlone/Model - Copie/C_T_typeEvenement.cs new file mode 100644 index 0000000..dc2d7ce --- /dev/null +++ b/ProjetTheAlone/Model - Copie/C_T_typeEvenement.cs @@ -0,0 +1,44 @@ +#region Ressources extérieures +using System; +using System.Collections.Generic; +using System.Text; +#endregion + +namespace ProjetTheAlone.Classes +{ + /// + /// Classe de définition des données + /// + public class C_T_typeEvenement + { + #region Données membres + private int _ID_typeEvenement; + private string _TE_nom; + #endregion + #region Constructeurs + public C_T_typeEvenement() + { } + public C_T_typeEvenement(string TE_nom_) + { + TE_nom = TE_nom_; + } + public C_T_typeEvenement(int ID_typeEvenement_,string TE_nom_) + : this(TE_nom_) + { + ID_typeEvenement = ID_typeEvenement_; + } + #endregion + #region Accesseurs + public int ID_typeEvenement + { + get { return _ID_typeEvenement; } + set { _ID_typeEvenement = value; } + } + public string TE_nom + { + get { return _TE_nom; } + set { _TE_nom = value; } + } + #endregion + } +} diff --git a/ProjetTheAlone/Model - Copie/C_T_typePlat.cs b/ProjetTheAlone/Model - Copie/C_T_typePlat.cs new file mode 100644 index 0000000..d2a54b9 --- /dev/null +++ b/ProjetTheAlone/Model - Copie/C_T_typePlat.cs @@ -0,0 +1,44 @@ +#region Ressources extérieures +using System; +using System.Collections.Generic; +using System.Text; +#endregion + +namespace ProjetTheAlone.Classes +{ + /// + /// Classe de définition des données + /// + public class C_T_typePlat + { + #region Données membres + private int _ID_typePlat; + private string _TP_nom; + #endregion + #region Constructeurs + public C_T_typePlat() + { } + public C_T_typePlat(string TP_nom_) + { + TP_nom = TP_nom_; + } + public C_T_typePlat(int ID_typePlat_, string TP_nom_) + : this(TP_nom_) + { + ID_typePlat = ID_typePlat_; + } + #endregion + #region Accesseurs + public int ID_typePlat + { + get { return _ID_typePlat; } + set { _ID_typePlat = value; } + } + public string TP_nom + { + get { return _TP_nom; } + set { _TP_nom = value; } + } + #endregion + } +} diff --git a/ProjetTheAlone/Model - Copie/C_T_typeRepa.cs b/ProjetTheAlone/Model - Copie/C_T_typeRepa.cs new file mode 100644 index 0000000..8b46773 --- /dev/null +++ b/ProjetTheAlone/Model - Copie/C_T_typeRepa.cs @@ -0,0 +1,44 @@ +#region Ressources extérieures +using System; +using System.Collections.Generic; +using System.Text; +#endregion + +namespace ProjetTheAlone.Classes +{ + /// + /// Classe de définition des données + /// + public class C_T_typeRepa + { + #region Données membres + private int _ID_typeRepa; + private string _TR_nom; + #endregion + #region Constructeurs + public C_T_typeRepa() + { } + public C_T_typeRepa(string TR_nom_) + { + TR_nom = TR_nom_; + } + public C_T_typeRepa(int ID_typeRepa_, string TR_nom_) + : this(TR_nom_) + { + ID_typeRepa = ID_typeRepa_; + } + #endregion + #region Accesseurs + public int ID_typeRepa + { + get { return _ID_typeRepa; } + set { _ID_typeRepa = value; } + } + public string TR_nom + { + get { return _TR_nom; } + set { _TR_nom = value; } + } + #endregion + } +} diff --git a/ProjetTheAlone/Model - Copie/G_Base.cs b/ProjetTheAlone/Model - Copie/G_Base.cs new file mode 100644 index 0000000..e5a7d1b --- /dev/null +++ b/ProjetTheAlone/Model - Copie/G_Base.cs @@ -0,0 +1,28 @@ +#region Ressources extérieures +using System; +using System.Collections.Generic; +using System.Text; +#endregion + +namespace ProjetTheAlone.Gestion +{ + public class G_Base + { + #region Données membres + string _ChaineConnexion; + #endregion + #region Constructeurs + public G_Base() + { ChaineConnexion = ""; } + public G_Base(string sChaineConnexion) + { ChaineConnexion = sChaineConnexion; } + #endregion + #region Accesseur + public string ChaineConnexion + { + get { return _ChaineConnexion; } + set { _ChaineConnexion = value; } + } + #endregion + } +} diff --git a/ProjetTheAlone/Model - Copie/G_T_beneficiaire.cs b/ProjetTheAlone/Model - Copie/G_T_beneficiaire.cs new file mode 100644 index 0000000..c0b1462 --- /dev/null +++ b/ProjetTheAlone/Model - Copie/G_T_beneficiaire.cs @@ -0,0 +1,35 @@ +#region Ressources extérieures +using System; +using System.Collections.Generic; +using System.Text; +using ProjetTheAlone.Classes; +using ProjetTheAlone.Acces; +#endregion + +namespace ProjetTheAlone.Gestion +{ + /// + /// Couche intermédiaire de gestion (Business Layer) + /// + public class G_T_beneficiaire : G_Base + { + #region Constructeurs + public G_T_beneficiaire() + : base() + { } + public G_T_beneficiaire(string sChaineConnexion) + : base(sChaineConnexion) + { } + #endregion + 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, byte?[] B_img) + { return new A_T_beneficiaire(ChaineConnexion).Modifier(ID_beneficiaire, B_nom, B_prenom, B_anniversaire, B_img); } + public List Lire(string Index) + { return new A_T_beneficiaire(ChaineConnexion).Lire(Index); } + public C_T_beneficiaire Lire_ID(int ID_beneficiaire) + { return new A_T_beneficiaire(ChaineConnexion).Lire_ID(ID_beneficiaire); } + public int Supprimer(int ID_beneficiaire) + { return new A_T_beneficiaire(ChaineConnexion).Supprimer(ID_beneficiaire); } + } +} diff --git a/ProjetTheAlone/Model - Copie/G_T_equipe.cs b/ProjetTheAlone/Model - Copie/G_T_equipe.cs new file mode 100644 index 0000000..47163ec --- /dev/null +++ b/ProjetTheAlone/Model - Copie/G_T_equipe.cs @@ -0,0 +1,35 @@ +#region Ressources extérieures +using System; +using System.Collections.Generic; +using System.Text; +using ProjetTheAlone.Classes; +using ProjetTheAlone.Acces; +#endregion + +namespace ProjetTheAlone.Gestion +{ + /// + /// Couche intermédiaire de gestion (Business Layer) + /// + public class G_T_equipe : G_Base + { + #region Constructeurs + public G_T_equipe() + : base() + { } + public G_T_equipe(string sChaineConnexion) + : base(sChaineConnexion) + { } + #endregion + public int Ajouter(string E_nom, int E_point, int? ID_evenement) + { return new A_T_equipe(ChaineConnexion).Ajouter(E_nom, E_point, ID_evenement); } + public int Modifier(int ID_equipe, string E_nom, int E_point, int? ID_evenement) + { return new A_T_equipe(ChaineConnexion).Modifier(ID_equipe, E_nom, E_point, ID_evenement); } + public List Lire(string Index) + { return new A_T_equipe(ChaineConnexion).Lire(Index); } + public C_T_equipe Lire_ID(int ID_equipe) + { return new A_T_equipe(ChaineConnexion).Lire_ID(ID_equipe); } + public int Supprimer(int ID_equipe) + { return new A_T_equipe(ChaineConnexion).Supprimer(ID_equipe); } + } +} diff --git a/ProjetTheAlone/Model - Copie/G_T_event.cs b/ProjetTheAlone/Model - Copie/G_T_event.cs new file mode 100644 index 0000000..e5ce7e2 --- /dev/null +++ b/ProjetTheAlone/Model - Copie/G_T_event.cs @@ -0,0 +1,35 @@ +#region Ressources extérieures +using System; +using System.Collections.Generic; +using System.Text; +using ProjetTheAlone.Classes; +using ProjetTheAlone.Acces; +#endregion + +namespace ProjetTheAlone.Gestion +{ + /// + /// Couche intermédiaire de gestion (Business Layer) + /// + public class G_T_event : G_Base + { + #region Constructeurs + public G_T_event() + : base() + { } + public G_T_event(string sChaineConnexion) + : base(sChaineConnexion) + { } + #endregion + public int Ajouter(DateTime? E_date, DateTime? E_duree, int? ID_typeEvenement, string E_description, int? ID_lieu, byte?[] E_Pic_) + { return new A_T_event(ChaineConnexion).Ajouter(E_date, E_duree, ID_typeEvenement,E_description, ID_lieu, E_Pic_); } + public int Modifier(int ID_event, DateTime? E_date, DateTime? E_duree, int? ID_typeEvenement, string E_description, int? ID_lieu, byte?[] E_Pic_) + { return new A_T_event(ChaineConnexion).Modifier(ID_event, E_date, E_duree, ID_typeEvenement, E_description, ID_lieu, E_Pic_); } + public List Lire(string Index) + { return new A_T_event(ChaineConnexion).Lire(Index); } + public C_T_event Lire_ID(int ID_event) + { return new A_T_event(ChaineConnexion).Lire_ID(ID_event); } + public int Supprimer(int ID_event) + { return new A_T_event(ChaineConnexion).Supprimer(ID_event); } + } +} diff --git a/ProjetTheAlone/Model - Copie/G_T_lieu.cs b/ProjetTheAlone/Model - Copie/G_T_lieu.cs new file mode 100644 index 0000000..3ff93a0 --- /dev/null +++ b/ProjetTheAlone/Model - Copie/G_T_lieu.cs @@ -0,0 +1,35 @@ +#region Ressources extérieures +using System; +using System.Collections.Generic; +using System.Text; +using ProjetTheAlone.Classes; +using ProjetTheAlone.Acces; +#endregion + +namespace ProjetTheAlone.Gestion +{ + /// + /// Couche intermédiaire de gestion (Business Layer) + /// + public class G_T_lieu : G_Base + { + #region Constructeurs + public G_T_lieu() + : base() + { } + public G_T_lieu(string sChaineConnexion) + : base(sChaineConnexion) + { } + #endregion + public int Ajouter(string L_nom) + { return new A_T_lieu(ChaineConnexion).Ajouter(L_nom); } + public int Modifier(int ID_lieu,string L_nom) + { return new A_T_lieu(ChaineConnexion).Modifier(ID_lieu, L_nom); } + public List Lire(string Index) + { return new A_T_lieu(ChaineConnexion).Lire(Index); } + public C_T_lieu Lire_ID(int ID_lieu) + { return new A_T_lieu(ChaineConnexion).Lire_ID(ID_lieu); } + public int Supprimer(int ID_lieu) + { return new A_T_lieu(ChaineConnexion).Supprimer(ID_lieu); } + } +} diff --git a/ProjetTheAlone/Model - Copie/G_T_listParticipant.cs b/ProjetTheAlone/Model - Copie/G_T_listParticipant.cs new file mode 100644 index 0000000..e4c93ce --- /dev/null +++ b/ProjetTheAlone/Model - Copie/G_T_listParticipant.cs @@ -0,0 +1,35 @@ +#region Ressources extérieures +using System; +using System.Collections.Generic; +using System.Text; +using ProjetTheAlone.Classes; +using ProjetTheAlone.Acces; +#endregion + +namespace ProjetTheAlone.Gestion +{ + /// + /// Couche intermédiaire de gestion (Business Layer) + /// + public class G_T_listParticipant : G_Base + { + #region Constructeurs + public G_T_listParticipant() + : base() + { } + public G_T_listParticipant(string sChaineConnexion) + : base(sChaineConnexion) + { } + #endregion + public int Ajouter(int? ID_equipe, int? ID_benificiaire) + { return new A_T_listParticipant(ChaineConnexion).Ajouter(ID_equipe, ID_benificiaire); } + public int Modifier(int ID_LP, int? ID_equipe, int? ID_benificiaire) + { return new A_T_listParticipant(ChaineConnexion).Modifier(ID_LP, ID_equipe, ID_benificiaire); } + public List Lire(string Index) + { return new A_T_listParticipant(ChaineConnexion).Lire(Index); } + public C_T_listParticipant Lire_ID(int ID_LP) + { return new A_T_listParticipant(ChaineConnexion).Lire_ID(ID_LP); } + public int Supprimer(int ID_LP) + { return new A_T_listParticipant(ChaineConnexion).Supprimer(ID_LP); } + } +} diff --git a/ProjetTheAlone/Model - Copie/G_T_listPlat.cs b/ProjetTheAlone/Model - Copie/G_T_listPlat.cs new file mode 100644 index 0000000..cd21774 --- /dev/null +++ b/ProjetTheAlone/Model - Copie/G_T_listPlat.cs @@ -0,0 +1,38 @@ +#region Ressources extérieures +using System; +using System.Collections.Generic; +using System.Text; +using ProjetTheAlone.Classes; +using ProjetTheAlone.Acces; +#endregion + +namespace ProjetTheAlone.Gestion +{ + /// + /// Couche intermédiaire de gestion (Business Layer) + /// + public class G_T_listPlat : G_Base + { + #region Constructeurs + public G_T_listPlat() + : base() + { } + public G_T_listPlat(string sChaineConnexion) + : base(sChaineConnexion) + { } + #endregion + public int Ajouter(DateTime LP_DatePlat, int ID_plat) + { return new A_T_listPlat(ChaineConnexion).Ajouter(LP_DatePlat, ID_plat); } + public int Modifier(int ID_listPlat, DateTime LP_DatePlat, int ID_plat) + { return new A_T_listPlat(ChaineConnexion).Modifier(ID_listPlat, LP_DatePlat, ID_plat); } + public List Lire(string Index) + { return new A_T_listPlat(ChaineConnexion).Lire(Index); } //C_T_listPlat Lire(DateTime LP_DateRepas) + public List Lire(DateTime dateV) + { return new A_T_listPlat(ChaineConnexion).Lire(dateV); } //C_T_listPlat Lire(DateTime LP_DateRepas) + + public C_T_listPlat Lire_ID(int ID_listPlat) + { return new A_T_listPlat(ChaineConnexion).Lire_ID(ID_listPlat); } + public int Supprimer(int ID_listPlat) + { return new A_T_listPlat(ChaineConnexion).Supprimer(ID_listPlat); } + } +} diff --git a/ProjetTheAlone/Model - Copie/G_T_plat.cs b/ProjetTheAlone/Model - Copie/G_T_plat.cs new file mode 100644 index 0000000..de4af84 --- /dev/null +++ b/ProjetTheAlone/Model - Copie/G_T_plat.cs @@ -0,0 +1,40 @@ +#region Ressources extérieures +using System; +using System.Collections.Generic; +using System.Text; +using ProjetTheAlone.Classes; +using ProjetTheAlone.Acces; +#endregion + +namespace ProjetTheAlone.Gestion +{ + /// + /// Couche intermédiaire de gestion (Business Layer) + /// + public class G_T_plat : G_Base + { + #region Constructeurs + public G_T_plat() + : base() + { } + public G_T_plat(string sChaineConnexion) + : base(sChaineConnexion) + { } + #endregion + public int Ajouter(string P_nom, byte?[] P_img, int? ID_typePlat) + { return new A_T_plat(ChaineConnexion).Ajouter(P_nom, P_img, ID_typePlat); } + public int Modifier(int ID_plat, string P_nom, byte?[] P_img, int? ID_typePlat) + { return new A_T_plat(ChaineConnexion).Modifier(ID_plat, P_nom, P_img, ID_typePlat); } + public List Lire(string Index) + { 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); } + /// + /// Permet de récupérer la liste des plats d'un repas + /// + public List 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); } + } +} diff --git a/ProjetTheAlone/Model - Copie/G_T_repa.cs b/ProjetTheAlone/Model - Copie/G_T_repa.cs new file mode 100644 index 0000000..73ccb3e --- /dev/null +++ b/ProjetTheAlone/Model - Copie/G_T_repa.cs @@ -0,0 +1,48 @@ +#region Ressources extérieures +using System; +using System.Collections.Generic; +using System.Text; +using ProjetTheAlone.Classes; +using ProjetTheAlone.Acces; +#endregion + +namespace ProjetTheAlone.Gestion +{ + /// + /// Couche intermédiaire de gestion (Business Layer) + /// + public class G_T_repa : G_Base + { + #region Constructeurs + public G_T_repa() + : base() + { } + public G_T_repa(string sChaineConnexion) + : base(sChaineConnexion) + { } + #endregion + public int Ajouter(int? ID_listPlat, int? ID_typeRepa, DateTime R_Date) + { return new A_T_repa(ChaineConnexion).Ajouter(ID_listPlat, ID_typeRepa , R_Date); } + public int Modifier(int ID_repa, int? ID_listPlat, int? ID_typeRepa, DateTime R_Date) + { return new A_T_repa(ChaineConnexion).Modifier(ID_repa, ID_listPlat, ID_typeRepa , R_Date); } + public List Lire(string Index) + { return new A_T_repa(ChaineConnexion).Lire(Index); } + /// + /// Permet de récupérer les repas entre deux date + /// + /// Date filtre debut compris + /// Date fin non compris + public List Lire(DateTime start, DateTime end) + { return new A_T_repa(ChaineConnexion).Lire(start, end); } + /// + /// Permet de récupérer les repas d'une date donnée + /// + /// Date filtre + public List 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) + { return new A_T_repa(ChaineConnexion).Supprimer(ID_repa); } + } +} diff --git a/ProjetTheAlone/Model - Copie/G_T_typeEvenement.cs b/ProjetTheAlone/Model - Copie/G_T_typeEvenement.cs new file mode 100644 index 0000000..522d92f --- /dev/null +++ b/ProjetTheAlone/Model - Copie/G_T_typeEvenement.cs @@ -0,0 +1,35 @@ +#region Ressources extérieures +using System; +using System.Collections.Generic; +using System.Text; +using ProjetTheAlone.Classes; +using ProjetTheAlone.Acces; +#endregion + +namespace ProjetTheAlone.Gestion +{ + /// + /// Couche intermédiaire de gestion (Business Layer) + /// + public class G_T_typeEvenement : G_Base + { + #region Constructeurs + public G_T_typeEvenement() + : base() + { } + public G_T_typeEvenement(string sChaineConnexion) + : base(sChaineConnexion) + { } + #endregion + public int Ajouter(string TE_nom) + { return new A_T_typeEvenement(ChaineConnexion).Ajouter(TE_nom); } + public int Modifier(int ID_typeEvenement, string TE_nom) + { return new A_T_typeEvenement(ChaineConnexion).Modifier(ID_typeEvenement, TE_nom); } + public List Lire(string Index) + { return new A_T_typeEvenement(ChaineConnexion).Lire(Index); } + public C_T_typeEvenement Lire_ID(int ID_typeEvenement) + { return new A_T_typeEvenement(ChaineConnexion).Lire_ID(ID_typeEvenement); } + public int Supprimer(int ID_typeEvenement) + { return new A_T_typeEvenement(ChaineConnexion).Supprimer(ID_typeEvenement); } + } +} diff --git a/ProjetTheAlone/Model - Copie/G_T_typePlat.cs b/ProjetTheAlone/Model - Copie/G_T_typePlat.cs new file mode 100644 index 0000000..230dd0c --- /dev/null +++ b/ProjetTheAlone/Model - Copie/G_T_typePlat.cs @@ -0,0 +1,35 @@ +#region Ressources extérieures +using System; +using System.Collections.Generic; +using System.Text; +using ProjetTheAlone.Classes; +using ProjetTheAlone.Acces; +#endregion + +namespace ProjetTheAlone.Gestion +{ + /// + /// Couche intermédiaire de gestion (Business Layer) + /// + public class G_T_typePlat : G_Base + { + #region Constructeurs + public G_T_typePlat() + : base() + { } + public G_T_typePlat(string sChaineConnexion) + : base(sChaineConnexion) + { } + #endregion + public int Ajouter(string TP_nom) + { return new A_T_typePlat(ChaineConnexion).Ajouter(TP_nom); } + public int Modifier(int ID_typePlat, string TP_nom) + { return new A_T_typePlat(ChaineConnexion).Modifier(ID_typePlat, TP_nom); } + public List Lire(string Index) + { return new A_T_typePlat(ChaineConnexion).Lire(Index); } + public C_T_typePlat Lire_ID(int ID_typePlat) + { return new A_T_typePlat(ChaineConnexion).Lire_ID(ID_typePlat); } + public int Supprimer(int ID_typePlat) + { return new A_T_typePlat(ChaineConnexion).Supprimer(ID_typePlat); } + } +} diff --git a/ProjetTheAlone/Model - Copie/G_T_typeRepa.cs b/ProjetTheAlone/Model - Copie/G_T_typeRepa.cs new file mode 100644 index 0000000..084e1f8 --- /dev/null +++ b/ProjetTheAlone/Model - Copie/G_T_typeRepa.cs @@ -0,0 +1,35 @@ +#region Ressources extérieures +using System; +using System.Collections.Generic; +using System.Text; +using ProjetTheAlone.Classes; +using ProjetTheAlone.Acces; +#endregion + +namespace ProjetTheAlone.Gestion +{ + /// + /// Couche intermédiaire de gestion (Business Layer) + /// + public class G_T_typeRepa : G_Base + { + #region Constructeurs + public G_T_typeRepa() + : base() + { } + public G_T_typeRepa(string sChaineConnexion) + : base(sChaineConnexion) + { } + #endregion + public int Ajouter(string TR_nom) + { return new A_T_typeRepa(ChaineConnexion).Ajouter(TR_nom); } + public int Modifier(int ID_typeRepa, string TR_nom) + { return new A_T_typeRepa(ChaineConnexion).Modifier(ID_typeRepa, TR_nom); } + public List Lire(string Index) + { return new A_T_typeRepa(ChaineConnexion).Lire(Index); } + public C_T_typeRepa Lire_ID(int ID_typeRepa) + { return new A_T_typeRepa(ChaineConnexion).Lire_ID(ID_typeRepa); } + public int Supprimer(int ID_typeRepa) + { return new A_T_typeRepa(ChaineConnexion).Supprimer(ID_typeRepa); } + } +} diff --git a/ProjetTheAlone/Model - Copie/P_T_beneficiaire.sql b/ProjetTheAlone/Model - Copie/P_T_beneficiaire.sql new file mode 100644 index 0000000..4ea8902 --- /dev/null +++ b/ProjetTheAlone/Model - Copie/P_T_beneficiaire.sql @@ -0,0 +1,56 @@ +CREATE PROCEDURE AjouterT_beneficiaire + @ID_beneficiaire int OUTPUT, + @B_nom varchar(50), + @B_prenom varchar(50), + @B_anniversaire datetime, + @B_img nchar(10) +AS + INSERT INTO T_beneficiaire(B_nom,B_prenom,B_anniversaire,B_img) + VALUES(@B_nom,@B_prenom,@B_anniversaire,@B_img) + SET @ID_beneficiaire=@@IDENTITY +RETURN +GO +CREATE PROCEDURE ModifierT_beneficiaire + @ID_beneficiaire int, + @B_nom varchar(50), + @B_prenom varchar(50), + @B_anniversaire datetime, + @B_img nchar(10) +AS + IF(@ID_beneficiaire IS NULL OR @ID_beneficiaire=0) + RAISERROR('Identifiant requis !',16,1) + ELSE UPDATE T_beneficiaire + SET B_nom=@B_nom,B_prenom=@B_prenom,B_anniversaire=@B_anniversaire,B_img=@B_img + WHERE ID_beneficiaire=@ID_beneficiaire +RETURN +GO +CREATE PROCEDURE SelectionnerT_beneficiaire + @Index VARCHAR(10) +AS + IF(@Index='B_nom') SELECT * FROM T_beneficiaire ORDER BY B_nom + ELSE IF(@Index='B_prenom') SELECT * FROM T_beneficiaire ORDER BY B_prenom + ELSE IF(@Index='B_anniversaire') SELECT * FROM T_beneficiaire ORDER BY B_anniversaire + ELSE IF(@Index='B_img') SELECT * FROM T_beneficiaire ORDER BY B_img + ELSE SELECT * FROM T_beneficiaire ORDER BY ID_beneficiaire +RETURN +GO +CREATE PROCEDURE SelectionnerT_beneficiaire_ID + @ID_beneficiaire int +AS + IF(@ID_beneficiaire IS NULL) + RAISERROR('Identifiant requis !',16,1) + ELSE + SELECT ID_beneficiaire,B_nom,B_prenom,B_anniversaire,B_img + FROM T_beneficiaire + WHERE @ID_beneficiaire=ID_beneficiaire +RETURN +GO +CREATE PROCEDURE SupprimerT_beneficiaire + @ID_beneficiaire int +AS + IF(@ID_beneficiaire IS NULL) + RAISERROR('Identifiant requis !',16,1) + ELSE + DELETE FROM T_beneficiaire WHERE @ID_beneficiaire=ID_beneficiaire +RETURN +GO diff --git a/ProjetTheAlone/Model - Copie/P_T_equipe.sql b/ProjetTheAlone/Model - Copie/P_T_equipe.sql new file mode 100644 index 0000000..9113db8 --- /dev/null +++ b/ProjetTheAlone/Model - Copie/P_T_equipe.sql @@ -0,0 +1,53 @@ +CREATE PROCEDURE AjouterT_equipe + @ID_equipe int OUTPUT, + @E_nom nchar(10), + @E_point nchar(10), + @ID_evenement int +AS + INSERT INTO T_equipe(E_nom,E_point,ID_evenement) + VALUES(@E_nom,@E_point,@ID_evenement) + SET @ID_equipe=@@IDENTITY +RETURN +GO +CREATE PROCEDURE ModifierT_equipe + @ID_equipe int, + @E_nom nchar(10), + @E_point nchar(10), + @ID_evenement int +AS + IF(@ID_equipe IS NULL OR @ID_equipe=0) + RAISERROR('Identifiant requis !',16,1) + ELSE UPDATE T_equipe + SET E_nom=@E_nom,E_point=@E_point,ID_evenement=@ID_evenement + WHERE ID_equipe=@ID_equipe +RETURN +GO +CREATE PROCEDURE SelectionnerT_equipe + @Index VARCHAR(10) +AS + IF(@Index='E_nom') SELECT * FROM T_equipe ORDER BY E_nom + ELSE IF(@Index='E_point') SELECT * FROM T_equipe ORDER BY E_point + ELSE IF(@Index='ID_evenement') SELECT * FROM T_equipe ORDER BY ID_evenement + ELSE SELECT * FROM T_equipe ORDER BY ID_equipe +RETURN +GO +CREATE PROCEDURE SelectionnerT_equipe_ID + @ID_equipe int +AS + IF(@ID_equipe IS NULL) + RAISERROR('Identifiant requis !',16,1) + ELSE + SELECT ID_equipe,E_nom,E_point,ID_evenement + FROM T_equipe + WHERE @ID_equipe=ID_equipe +RETURN +GO +CREATE PROCEDURE SupprimerT_equipe + @ID_equipe int +AS + IF(@ID_equipe IS NULL) + RAISERROR('Identifiant requis !',16,1) + ELSE + DELETE FROM T_equipe WHERE @ID_equipe=ID_equipe +RETURN +GO diff --git a/ProjetTheAlone/Model - Copie/P_T_event.sql b/ProjetTheAlone/Model - Copie/P_T_event.sql new file mode 100644 index 0000000..b1d6b06 --- /dev/null +++ b/ProjetTheAlone/Model - Copie/P_T_event.sql @@ -0,0 +1,59 @@ +CREATE PROCEDURE AjouterT_event + @ID_event int OUTPUT, + @E_date datetime, + @E_duree datetime, + @ID_typeEvenement int, + @E_description text, + @ID_lieu int +AS + INSERT INTO T_event(E_date,E_duree,ID_typeEvenement,E_description,ID_lieu) + VALUES(@E_date,@E_duree,@ID_typeEvenement,@E_description,@ID_lieu) + SET @ID_event=@@IDENTITY +RETURN +GO +CREATE PROCEDURE ModifierT_event + @ID_event int, + @E_date datetime, + @E_duree datetime, + @ID_typeEvenement int, + @E_description text, + @ID_lieu int +AS + IF(@ID_event IS NULL OR @ID_event=0) + RAISERROR('Identifiant requis !',16,1) + ELSE UPDATE T_event + SET E_date=@E_date,E_duree=@E_duree,ID_typeEvenement=@ID_typeEvenement,E_description=@E_description,ID_lieu=@ID_lieu + WHERE ID_event=@ID_event +RETURN +GO +CREATE PROCEDURE SelectionnerT_event + @Index VARCHAR(10) +AS + IF(@Index='E_date') SELECT * FROM T_event ORDER BY E_date + ELSE IF(@Index='E_duree') SELECT * FROM T_event ORDER BY E_duree + ELSE IF(@Index='ID_typeEvenement') SELECT * FROM T_event ORDER BY ID_typeEvenement + ELSE IF(@Index='E_description') SELECT * FROM T_event ORDER BY E_description + ELSE IF(@Index='ID_lieu') SELECT * FROM T_event ORDER BY ID_lieu + ELSE SELECT * FROM T_event ORDER BY ID_event +RETURN +GO +CREATE PROCEDURE SelectionnerT_event_ID + @ID_event int +AS + IF(@ID_event IS NULL) + RAISERROR('Identifiant requis !',16,1) + ELSE + SELECT ID_event,E_date,E_duree,ID_typeEvenement,E_description,ID_lieu + FROM T_event + WHERE @ID_event=ID_event +RETURN +GO +CREATE PROCEDURE SupprimerT_event + @ID_event int +AS + IF(@ID_event IS NULL) + RAISERROR('Identifiant requis !',16,1) + ELSE + DELETE FROM T_event WHERE @ID_event=ID_event +RETURN +GO diff --git a/ProjetTheAlone/Model - Copie/P_T_lieu.sql b/ProjetTheAlone/Model - Copie/P_T_lieu.sql new file mode 100644 index 0000000..5d52264 --- /dev/null +++ b/ProjetTheAlone/Model - Copie/P_T_lieu.sql @@ -0,0 +1,47 @@ +CREATE PROCEDURE AjouterT_lieu + @ID_lieu int OUTPUT, + @L_nom text +AS + INSERT INTO T_lieu(L_nom) + VALUES(@L_nom) + SET @ID_lieu=@@IDENTITY +RETURN +GO +CREATE PROCEDURE ModifierT_lieu + @ID_lieu int, + @L_nom text +AS + IF(@ID_lieu IS NULL OR @ID_lieu=0) + RAISERROR('Identifiant requis !',16,1) + ELSE UPDATE T_lieu + SET L_nom=@L_nom + WHERE ID_lieu=@ID_lieu +RETURN +GO +CREATE PROCEDURE SelectionnerT_lieu + @Index VARCHAR(10) +AS + IF(@Index='L_nom') SELECT * FROM T_lieu ORDER BY L_nom + ELSE SELECT * FROM T_lieu ORDER BY ID_lieu +RETURN +GO +CREATE PROCEDURE SelectionnerT_lieu_ID + @ID_lieu int +AS + IF(@ID_lieu IS NULL) + RAISERROR('Identifiant requis !',16,1) + ELSE + SELECT ID_lieu,L_nom + FROM T_lieu + WHERE @ID_lieu=ID_lieu +RETURN +GO +CREATE PROCEDURE SupprimerT_lieu + @ID_lieu int +AS + IF(@ID_lieu IS NULL) + RAISERROR('Identifiant requis !',16,1) + ELSE + DELETE FROM T_lieu WHERE @ID_lieu=ID_lieu +RETURN +GO diff --git a/ProjetTheAlone/Model - Copie/P_T_listParticipant.sql b/ProjetTheAlone/Model - Copie/P_T_listParticipant.sql new file mode 100644 index 0000000..c040759 --- /dev/null +++ b/ProjetTheAlone/Model - Copie/P_T_listParticipant.sql @@ -0,0 +1,50 @@ +CREATE PROCEDURE AjouterT_listParticipant + @ID_LP int OUTPUT, + @ID_equipe int, + @ID_benificiaire int +AS + INSERT INTO T_listParticipant(ID_equipe,ID_benificiaire) + VALUES(@ID_equipe,@ID_benificiaire) + SET @ID_LP=@@IDENTITY +RETURN +GO +CREATE PROCEDURE ModifierT_listParticipant + @ID_LP int, + @ID_equipe int, + @ID_benificiaire int +AS + IF(@ID_LP IS NULL OR @ID_LP=0) + RAISERROR('Identifiant requis !',16,1) + ELSE UPDATE T_listParticipant + SET ID_equipe=@ID_equipe,ID_benificiaire=@ID_benificiaire + WHERE ID_LP=@ID_LP +RETURN +GO +CREATE PROCEDURE SelectionnerT_listParticipant + @Index VARCHAR(10) +AS + IF(@Index='ID_equipe') SELECT * FROM T_listParticipant ORDER BY ID_equipe + ELSE IF(@Index='ID_benificiaire') SELECT * FROM T_listParticipant ORDER BY ID_benificiaire + ELSE SELECT * FROM T_listParticipant ORDER BY ID_LP +RETURN +GO +CREATE PROCEDURE SelectionnerT_listParticipant_ID + @ID_LP int +AS + IF(@ID_LP IS NULL) + RAISERROR('Identifiant requis !',16,1) + ELSE + SELECT ID_LP,ID_equipe,ID_benificiaire + FROM T_listParticipant + WHERE @ID_LP=ID_LP +RETURN +GO +CREATE PROCEDURE SupprimerT_listParticipant + @ID_LP int +AS + IF(@ID_LP IS NULL) + RAISERROR('Identifiant requis !',16,1) + ELSE + DELETE FROM T_listParticipant WHERE @ID_LP=ID_LP +RETURN +GO diff --git a/ProjetTheAlone/Model - Copie/P_T_listPlat.sql b/ProjetTheAlone/Model - Copie/P_T_listPlat.sql new file mode 100644 index 0000000..1ffaf5e --- /dev/null +++ b/ProjetTheAlone/Model - Copie/P_T_listPlat.sql @@ -0,0 +1,50 @@ +CREATE PROCEDURE AjouterT_listPlat + @ID_listPlat int OUTPUT, + @ID_repa int, + @ID_plat int +AS + INSERT INTO T_listPlat(ID_repa,ID_plat) + VALUES(@ID_repa,@ID_plat) + SET @ID_listPlat=@@IDENTITY +RETURN +GO +CREATE PROCEDURE ModifierT_listPlat + @ID_listPlat int, + @ID_repa int, + @ID_plat int +AS + IF(@ID_listPlat IS NULL OR @ID_listPlat=0) + RAISERROR('Identifiant requis !',16,1) + ELSE UPDATE T_listPlat + SET ID_repa=@ID_repa,ID_plat=@ID_plat + WHERE ID_listPlat=@ID_listPlat +RETURN +GO +CREATE PROCEDURE SelectionnerT_listPlat + @Index VARCHAR(10) +AS + IF(@Index='ID_repa') SELECT * FROM T_listPlat ORDER BY ID_repa + ELSE IF(@Index='ID_plat') SELECT * FROM T_listPlat ORDER BY ID_plat + ELSE SELECT * FROM T_listPlat ORDER BY ID_listPlat +RETURN +GO +CREATE PROCEDURE SelectionnerT_listPlat_ID + @ID_listPlat int +AS + IF(@ID_listPlat IS NULL) + RAISERROR('Identifiant requis !',16,1) + ELSE + SELECT ID_listPlat,ID_repa,ID_plat + FROM T_listPlat + WHERE @ID_listPlat=ID_listPlat +RETURN +GO +CREATE PROCEDURE SupprimerT_listPlat + @ID_listPlat int +AS + IF(@ID_listPlat IS NULL) + RAISERROR('Identifiant requis !',16,1) + ELSE + DELETE FROM T_listPlat WHERE @ID_listPlat=ID_listPlat +RETURN +GO diff --git a/ProjetTheAlone/Model - Copie/P_T_plat.sql b/ProjetTheAlone/Model - Copie/P_T_plat.sql new file mode 100644 index 0000000..df9b496 --- /dev/null +++ b/ProjetTheAlone/Model - Copie/P_T_plat.sql @@ -0,0 +1,53 @@ +CREATE PROCEDURE AjouterT_plat + @ID_plat int OUTPUT, + @P_nom int, + @P_img int, + @ID_typePlat int +AS + INSERT INTO T_plat(P_nom,P_img,ID_typePlat) + VALUES(@P_nom,@P_img,@ID_typePlat) + SET @ID_plat=@@IDENTITY +RETURN +GO +CREATE PROCEDURE ModifierT_plat + @ID_plat int, + @P_nom int, + @P_img int, + @ID_typePlat int +AS + IF(@ID_plat IS NULL OR @ID_plat=0) + RAISERROR('Identifiant requis !',16,1) + ELSE UPDATE T_plat + SET P_nom=@P_nom,P_img=@P_img,ID_typePlat=@ID_typePlat + WHERE ID_plat=@ID_plat +RETURN +GO +CREATE PROCEDURE SelectionnerT_plat + @Index VARCHAR(10) +AS + IF(@Index='P_nom') SELECT * FROM T_plat ORDER BY P_nom + ELSE IF(@Index='P_img') SELECT * FROM T_plat ORDER BY P_img + ELSE IF(@Index='ID_typePlat') SELECT * FROM T_plat ORDER BY ID_typePlat + ELSE SELECT * FROM T_plat ORDER BY ID_plat +RETURN +GO +CREATE PROCEDURE SelectionnerT_plat_ID + @ID_plat int +AS + IF(@ID_plat IS NULL) + RAISERROR('Identifiant requis !',16,1) + ELSE + SELECT ID_plat,P_nom,P_img,ID_typePlat + FROM T_plat + WHERE @ID_plat=ID_plat +RETURN +GO +CREATE PROCEDURE SupprimerT_plat + @ID_plat int +AS + IF(@ID_plat IS NULL) + RAISERROR('Identifiant requis !',16,1) + ELSE + DELETE FROM T_plat WHERE @ID_plat=ID_plat +RETURN +GO diff --git a/ProjetTheAlone/Model - Copie/P_T_repa.sql b/ProjetTheAlone/Model - Copie/P_T_repa.sql new file mode 100644 index 0000000..0dc3320 --- /dev/null +++ b/ProjetTheAlone/Model - Copie/P_T_repa.sql @@ -0,0 +1,50 @@ +CREATE PROCEDURE AjouterT_repa + @ID_repa int OUTPUT, + @ID_listPlat int, + @ID_typeRepa int +AS + INSERT INTO T_repa(ID_listPlat,ID_typeRepa) + VALUES(@ID_listPlat,@ID_typeRepa) + SET @ID_repa=@@IDENTITY +RETURN +GO +CREATE PROCEDURE ModifierT_repa + @ID_repa int, + @ID_listPlat int, + @ID_typeRepa int +AS + IF(@ID_repa IS NULL OR @ID_repa=0) + RAISERROR('Identifiant requis !',16,1) + ELSE UPDATE T_repa + SET ID_listPlat=@ID_listPlat,ID_typeRepa=@ID_typeRepa + WHERE ID_repa=@ID_repa +RETURN +GO +CREATE PROCEDURE SelectionnerT_repa + @Index VARCHAR(10) +AS + IF(@Index='ID_listPlat') SELECT * FROM T_repa ORDER BY ID_listPlat + ELSE IF(@Index='ID_typeRepa') SELECT * FROM T_repa ORDER BY ID_typeRepa + ELSE SELECT * FROM T_repa ORDER BY ID_repa +RETURN +GO +CREATE PROCEDURE SelectionnerT_repa_ID + @ID_repa int +AS + IF(@ID_repa IS NULL) + RAISERROR('Identifiant requis !',16,1) + ELSE + SELECT ID_repa,ID_listPlat,ID_typeRepa + FROM T_repa + WHERE @ID_repa=ID_repa +RETURN +GO +CREATE PROCEDURE SupprimerT_repa + @ID_repa int +AS + IF(@ID_repa IS NULL) + RAISERROR('Identifiant requis !',16,1) + ELSE + DELETE FROM T_repa WHERE @ID_repa=ID_repa +RETURN +GO diff --git a/ProjetTheAlone/Model - Copie/P_T_typeEvenement.sql b/ProjetTheAlone/Model - Copie/P_T_typeEvenement.sql new file mode 100644 index 0000000..f46b1ca --- /dev/null +++ b/ProjetTheAlone/Model - Copie/P_T_typeEvenement.sql @@ -0,0 +1,47 @@ +CREATE PROCEDURE AjouterT_typeEvenement + @ID_typeEvenement int OUTPUT, + @TE_nom text +AS + INSERT INTO T_typeEvenement(TE_nom) + VALUES(@TE_nom) + SET @ID_typeEvenement=@@IDENTITY +RETURN +GO +CREATE PROCEDURE ModifierT_typeEvenement + @ID_typeEvenement int, + @TE_nom text +AS + IF(@ID_typeEvenement IS NULL OR @ID_typeEvenement=0) + RAISERROR('Identifiant requis !',16,1) + ELSE UPDATE T_typeEvenement + SET TE_nom=@TE_nom + WHERE ID_typeEvenement=@ID_typeEvenement +RETURN +GO +CREATE PROCEDURE SelectionnerT_typeEvenement + @Index VARCHAR(10) +AS + IF(@Index='TE_nom') SELECT * FROM T_typeEvenement ORDER BY TE_nom + ELSE SELECT * FROM T_typeEvenement ORDER BY ID_typeEvenement +RETURN +GO +CREATE PROCEDURE SelectionnerT_typeEvenement_ID + @ID_typeEvenement int +AS + IF(@ID_typeEvenement IS NULL) + RAISERROR('Identifiant requis !',16,1) + ELSE + SELECT ID_typeEvenement,TE_nom + FROM T_typeEvenement + WHERE @ID_typeEvenement=ID_typeEvenement +RETURN +GO +CREATE PROCEDURE SupprimerT_typeEvenement + @ID_typeEvenement int +AS + IF(@ID_typeEvenement IS NULL) + RAISERROR('Identifiant requis !',16,1) + ELSE + DELETE FROM T_typeEvenement WHERE @ID_typeEvenement=ID_typeEvenement +RETURN +GO diff --git a/ProjetTheAlone/Model - Copie/P_T_typePlat.sql b/ProjetTheAlone/Model - Copie/P_T_typePlat.sql new file mode 100644 index 0000000..33ebc40 --- /dev/null +++ b/ProjetTheAlone/Model - Copie/P_T_typePlat.sql @@ -0,0 +1,48 @@ +CREATE PROCEDURE AjouterT_typePlat + @ID_typePlat int, + @TP_nom varchar(50) +AS + IF EXISTS(SELECT * FROM T_typePlat WHERE ID_typePlat=@ID_typePlat) + RAISERROR('Clé primaire existant !',16,1) + ELSE INSERT INTO T_typePlat(ID_typePlat,TP_nom) + VALUES(@ID_typePlat,@TP_nom) +RETURN +GO +CREATE PROCEDURE ModifierT_typePlat + @ID_typePlat int, + @TP_nom varchar(50) +AS + IF(@ID_typePlat IS NULL OR @ID_typePlat=0) + RAISERROR('Identifiant requis !',16,1) + ELSE UPDATE T_typePlat + SET TP_nom=@TP_nom + WHERE ID_typePlat=@ID_typePlat +RETURN +GO +CREATE PROCEDURE SelectionnerT_typePlat + @Index VARCHAR(10) +AS + IF(@Index='TP_nom') SELECT * FROM T_typePlat ORDER BY TP_nom + ELSE SELECT * FROM T_typePlat ORDER BY ID_typePlat +RETURN +GO +CREATE PROCEDURE SelectionnerT_typePlat_ID + @ID_typePlat int +AS + IF(@ID_typePlat IS NULL) + RAISERROR('Identifiant requis !',16,1) + ELSE + SELECT ID_typePlat,TP_nom + FROM T_typePlat + WHERE @ID_typePlat=ID_typePlat +RETURN +GO +CREATE PROCEDURE SupprimerT_typePlat + @ID_typePlat int +AS + IF(@ID_typePlat IS NULL) + RAISERROR('Identifiant requis !',16,1) + ELSE + DELETE FROM T_typePlat WHERE @ID_typePlat=ID_typePlat +RETURN +GO diff --git a/ProjetTheAlone/Model - Copie/P_T_typeRepa.sql b/ProjetTheAlone/Model - Copie/P_T_typeRepa.sql new file mode 100644 index 0000000..0c26e07 --- /dev/null +++ b/ProjetTheAlone/Model - Copie/P_T_typeRepa.sql @@ -0,0 +1,47 @@ +CREATE PROCEDURE AjouterT_typeRepa + @ID_typeRepa int OUTPUT, + @TR_nom varchar(50) +AS + INSERT INTO T_typeRepa(TR_nom) + VALUES(@TR_nom) + SET @ID_typeRepa=@@IDENTITY +RETURN +GO +CREATE PROCEDURE ModifierT_typeRepa + @ID_typeRepa int, + @TR_nom varchar(50) +AS + IF(@ID_typeRepa IS NULL OR @ID_typeRepa=0) + RAISERROR('Identifiant requis !',16,1) + ELSE UPDATE T_typeRepa + SET TR_nom=@TR_nom + WHERE ID_typeRepa=@ID_typeRepa +RETURN +GO +CREATE PROCEDURE SelectionnerT_typeRepa + @Index VARCHAR(10) +AS + IF(@Index='TR_nom') SELECT * FROM T_typeRepa ORDER BY TR_nom + ELSE SELECT * FROM T_typeRepa ORDER BY ID_typeRepa +RETURN +GO +CREATE PROCEDURE SelectionnerT_typeRepa_ID + @ID_typeRepa int +AS + IF(@ID_typeRepa IS NULL) + RAISERROR('Identifiant requis !',16,1) + ELSE + SELECT ID_typeRepa,TR_nom + FROM T_typeRepa + WHERE @ID_typeRepa=ID_typeRepa +RETURN +GO +CREATE PROCEDURE SupprimerT_typeRepa + @ID_typeRepa int +AS + IF(@ID_typeRepa IS NULL) + RAISERROR('Identifiant requis !',16,1) + ELSE + DELETE FROM T_typeRepa WHERE @ID_typeRepa=ID_typeRepa +RETURN +GO diff --git a/ProjetTheAlone/Model/A_T_beneficiaire.cs b/ProjetTheAlone/Model/A_T_beneficiaire.cs index d8d7317..84ea9ad 100644 --- a/ProjetTheAlone/Model/A_T_beneficiaire.cs +++ b/ProjetTheAlone/Model/A_T_beneficiaire.cs @@ -10,103 +10,104 @@ using ProjetTheAlone.Classes; namespace ProjetTheAlone.Acces { - /// - /// Couche d'accès aux données (Data Access Layer) - /// - public class A_T_beneficiaire : ADBase - { - #region Constructeurs - public A_T_beneficiaire(string sChaineConnexion) - : base(sChaineConnexion) - { } - #endregion - public int Ajouter(string B_nom, string B_prenom, DateTime? B_anniversaire, byte?[] B_img) - { - CreerCommande("AjouterT_beneficiaire"); - int res = 0; - Commande.Parameters.Add("ID_beneficiaire", SqlDbType.Int); - Direction("ID_beneficiaire", ParameterDirection.Output); - if(B_nom == null) Commande.Parameters.AddWithValue("@B_nom", Convert.DBNull); - else Commande.Parameters.AddWithValue("@B_nom", B_nom); - if(B_prenom == null) Commande.Parameters.AddWithValue("@B_prenom", Convert.DBNull); - else Commande.Parameters.AddWithValue("@B_prenom", B_prenom); - if(B_anniversaire == null) Commande.Parameters.AddWithValue("@B_anniversaire", Convert.DBNull); - else Commande.Parameters.AddWithValue("@B_anniversaire", B_anniversaire); - if(B_img == null) Commande.Parameters.AddWithValue("@B_img", Convert.DBNull); - else Commande.Parameters.AddWithValue("@B_img", B_img); - Commande.Connection.Open(); - Commande.ExecuteNonQuery(); - res = int.Parse(LireParametre("ID_beneficiaire")); - Commande.Connection.Close(); - return res; - } - public int Modifier(int ID_beneficiaire, string B_nom, string B_prenom, DateTime? B_anniversaire, byte?[] B_img) - { - CreerCommande("ModifierT_beneficiaire"); - int res = 0; - Commande.Parameters.AddWithValue("@ID_beneficiaire", ID_beneficiaire); - if(B_nom == null) Commande.Parameters.AddWithValue("@B_nom", Convert.DBNull); - else Commande.Parameters.AddWithValue("@B_nom", B_nom); - if(B_prenom == null) Commande.Parameters.AddWithValue("@B_prenom", Convert.DBNull); - else Commande.Parameters.AddWithValue("@B_prenom", B_prenom); - if(B_anniversaire == null) Commande.Parameters.AddWithValue("@B_anniversaire", Convert.DBNull); - else Commande.Parameters.AddWithValue("@B_anniversaire", B_anniversaire); - if(B_img == null) Commande.Parameters.AddWithValue("@B_img", Convert.DBNull); - else Commande.Parameters.AddWithValue("@B_img", B_img); - Commande.Connection.Open(); - Commande.ExecuteNonQuery(); - Commande.Connection.Close(); - return res; - } - public List Lire(string Index) - { - CreerCommande("SelectionnerT_beneficiaire"); - Commande.Parameters.AddWithValue("@Index", Index); - Commande.Connection.Open(); - SqlDataReader dr = Commande.ExecuteReader(); - List res = new List(); - while (dr.Read()) - { - C_T_beneficiaire tmp = new C_T_beneficiaire(); - tmp.ID_beneficiaire = int.Parse(dr["ID_beneficiaire"].ToString()); - 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"]; - res.Add(tmp); - } - dr.Close(); - Commande.Connection.Close(); - return res; - } - public C_T_beneficiaire Lire_ID(int ID_beneficiaire) - { - CreerCommande("SelectionnerT_beneficiaire_ID"); - Commande.Parameters.AddWithValue("@ID_beneficiaire", ID_beneficiaire); - Commande.Connection.Open(); - SqlDataReader dr = Commande.ExecuteReader(); - C_T_beneficiaire res = new C_T_beneficiaire(); - while (dr.Read()) - { - res.ID_beneficiaire = int.Parse(dr["ID_beneficiaire"].ToString()); - 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 = (byte?[])dr["B_img"]; - } - dr.Close(); - Commande.Connection.Close(); - return res; - } - public int Supprimer(int ID_beneficiaire) - { - CreerCommande("SupprimerT_beneficiaire"); - int res = 0; - Commande.Parameters.AddWithValue("@ID_beneficiaire", ID_beneficiaire); - Commande.Connection.Open(); - res = Commande.ExecuteNonQuery(); - Commande.Connection.Close(); - return res; - } - } + /// + /// Couche d'accès aux données (Data Access Layer) + /// + public class A_T_beneficiaire : ADBase + { + #region Constructeurs + public A_T_beneficiaire(string sChaineConnexion) + : base(sChaineConnexion) + { } + #endregion + public int Ajouter(string B_nom, string B_prenom, DateTime? B_anniversaire, byte?[] B_img) + { + CreerCommande("AjouterT_beneficiaire"); + int res = 0; + Commande.Parameters.Add("ID_beneficiaire", SqlDbType.Int); + Direction("ID_beneficiaire", ParameterDirection.Output); + if (B_nom == null) Commande.Parameters.AddWithValue("@B_nom", Convert.DBNull); + else Commande.Parameters.AddWithValue("@B_nom", B_nom); + if (B_prenom == null) Commande.Parameters.AddWithValue("@B_prenom", Convert.DBNull); + else Commande.Parameters.AddWithValue("@B_prenom", B_prenom); + if (B_anniversaire == null) Commande.Parameters.AddWithValue("@B_anniversaire", Convert.DBNull); + else Commande.Parameters.AddWithValue("@B_anniversaire", B_anniversaire); + if (B_img == null) Commande.Parameters.AddWithValue("@B_img", SqlDbType.Image).Value = Convert.DBNull; + else Commande.Parameters.AddWithValue("@B_img", SqlDbType.Image).Value = Outil.toByteArray.Convert(B_img); + Commande.Connection.Open(); + Commande.ExecuteNonQuery(); + res = int.Parse(LireParametre("ID_beneficiaire")); + Commande.Connection.Close(); + return res; + } + public int Modifier(int ID_beneficiaire, string B_nom, string B_prenom, DateTime? B_anniversaire, byte?[] B_img) + { + CreerCommande("ModifierT_beneficiaire"); + int res = 0; + Commande.Parameters.AddWithValue("@ID_beneficiaire", ID_beneficiaire); + if (B_nom == null) Commande.Parameters.AddWithValue("@B_nom", Convert.DBNull); + else Commande.Parameters.AddWithValue("@B_nom", B_nom); + if (B_prenom == null) Commande.Parameters.AddWithValue("@B_prenom", Convert.DBNull); + else Commande.Parameters.AddWithValue("@B_prenom", B_prenom); + if (B_anniversaire == null) Commande.Parameters.AddWithValue("@B_anniversaire", Convert.DBNull); + else Commande.Parameters.AddWithValue("@B_anniversaire", B_anniversaire); + if (B_img == null) Commande.Parameters.AddWithValue("@B_img", Convert.DBNull); + else Commande.Parameters.AddWithValue("@B_img", B_img); + Commande.Connection.Open(); + Commande.ExecuteNonQuery(); + Commande.Connection.Close(); + return res; + } + public List Lire(string Index) + { + CreerCommande("SelectionnerT_beneficiaire"); + Commande.Parameters.AddWithValue("@Index", Index); + Commande.Connection.Open(); + SqlDataReader dr = Commande.ExecuteReader(); + List res = new List(); + while (dr.Read()) + { + C_T_beneficiaire tmp = new C_T_beneficiaire(); + tmp.ID_beneficiaire = int.Parse(dr["ID_beneficiaire"].ToString()); + 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()); + if (dr["B_img"] != DBNull.Value) tmp.B_img = Outil.toNullableByteArray.Convert((byte[])dr["B_img"]); + res.Add(tmp); + } + dr.Close(); + Commande.Connection.Close(); + return res; + } + public C_T_beneficiaire Lire_ID(int ID_beneficiaire) + { + CreerCommande("SelectionnerT_beneficiaire_ID"); + Commande.Parameters.AddWithValue("@ID_beneficiaire", ID_beneficiaire); + Commande.Connection.Open(); + SqlDataReader dr = Commande.ExecuteReader(); + C_T_beneficiaire res = new C_T_beneficiaire(); + while (dr.Read()) + { + res.ID_beneficiaire = int.Parse(dr["ID_beneficiaire"].ToString()); + 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()); + if (dr["B_img"] != DBNull.Value) res.B_img = Outil.toNullableByteArray.Convert((byte[])dr["B_img"]); + res.B_img = (byte?[])dr["B_img"]; + } + dr.Close(); + Commande.Connection.Close(); + return res; + } + public int Supprimer(int ID_beneficiaire) + { + CreerCommande("SupprimerT_beneficiaire"); + int res = 0; + Commande.Parameters.AddWithValue("@ID_beneficiaire", ID_beneficiaire); + Commande.Connection.Open(); + res = Commande.ExecuteNonQuery(); + Commande.Connection.Close(); + return res; + } + } } diff --git a/ProjetTheAlone/Model/A_T_equipe.cs b/ProjetTheAlone/Model/A_T_equipe.cs index be0afb7..8d00f8c 100644 --- a/ProjetTheAlone/Model/A_T_equipe.cs +++ b/ProjetTheAlone/Model/A_T_equipe.cs @@ -20,7 +20,7 @@ namespace ProjetTheAlone.Acces : base(sChaineConnexion) { } #endregion - public int Ajouter(string E_nom, string E_point, int? ID_evenement) + public int Ajouter(string E_nom, int E_point, int? ID_evenement) { CreerCommande("AjouterT_equipe"); int res = 0; @@ -28,8 +28,7 @@ namespace ProjetTheAlone.Acces Direction("ID_equipe", ParameterDirection.Output); if(E_nom == null) Commande.Parameters.AddWithValue("@E_nom", Convert.DBNull); else Commande.Parameters.AddWithValue("@E_nom", E_nom); - if(E_point == null) Commande.Parameters.AddWithValue("@E_point", Convert.DBNull); - else Commande.Parameters.AddWithValue("@E_point", E_point); + Commande.Parameters.AddWithValue("@E_point", E_point); if(ID_evenement == null) Commande.Parameters.AddWithValue("@ID_evenement", Convert.DBNull); else Commande.Parameters.AddWithValue("@ID_evenement", ID_evenement); Commande.Connection.Open(); @@ -38,15 +37,14 @@ namespace ProjetTheAlone.Acces Commande.Connection.Close(); return res; } - public int Modifier(int ID_equipe, string E_nom, string E_point, int? ID_evenement) + public int Modifier(int ID_equipe, string E_nom, int E_point, int? ID_evenement) { CreerCommande("ModifierT_equipe"); int res = 0; Commande.Parameters.AddWithValue("@ID_equipe", ID_equipe); if(E_nom == null) Commande.Parameters.AddWithValue("@E_nom", Convert.DBNull); else Commande.Parameters.AddWithValue("@E_nom", E_nom); - if(E_point == null) Commande.Parameters.AddWithValue("@E_point", Convert.DBNull); - else Commande.Parameters.AddWithValue("@E_point", E_point); + Commande.Parameters.AddWithValue("@E_point", E_point); if(ID_evenement == null) Commande.Parameters.AddWithValue("@ID_evenement", Convert.DBNull); else Commande.Parameters.AddWithValue("@ID_evenement", ID_evenement); Commande.Connection.Open(); @@ -66,7 +64,7 @@ namespace ProjetTheAlone.Acces C_T_equipe tmp = new C_T_equipe(); tmp.ID_equipe = int.Parse(dr["ID_equipe"].ToString()); tmp.E_nom = dr["E_nom"].ToString(); - tmp.E_point = dr["E_point"].ToString(); + tmp.E_point = int.Parse(dr["E_point"].ToString()); if(dr["ID_evenement"] != DBNull.Value) tmp.ID_evenement = int.Parse(dr["ID_evenement"].ToString()); res.Add(tmp); } @@ -85,7 +83,7 @@ namespace ProjetTheAlone.Acces { res.ID_equipe = int.Parse(dr["ID_equipe"].ToString()); res.E_nom = dr["E_nom"].ToString(); - res.E_point = dr["E_point"].ToString(); + res.E_point = int.Parse(dr["E_point"].ToString()); if(dr["ID_evenement"] != DBNull.Value) res.ID_evenement = int.Parse(dr["ID_evenement"].ToString()); } dr.Close(); diff --git a/ProjetTheAlone/Model/A_T_event-Comp-Hugues.cs b/ProjetTheAlone/Model/A_T_event-Comp-Hugues.cs new file mode 100644 index 0000000..d7024ab --- /dev/null +++ b/ProjetTheAlone/Model/A_T_event-Comp-Hugues.cs @@ -0,0 +1,122 @@ +#region Ressources extérieures +using System; +using System.Collections.Generic; +using System.Text; +using System.Data; +using System.Data.SqlClient; +using System.Data.SqlTypes; +using ProjetTheAlone.Classes; +#endregion + +namespace ProjetTheAlone.Acces +{ + /// + /// Couche d'accès aux données (Data Access Layer) + /// + public class A_T_event : ADBase + { + #region Constructeurs + public A_T_event(string sChaineConnexion) + : base(sChaineConnexion) + { } + #endregion + public int Ajouter(DateTime? E_date, DateTime? E_duree, int? ID_typeEvenement,string E_description, int? ID_lieu, Byte?[] E_Pic) + { + CreerCommande("AjouterT_event"); + int res = 0; + Commande.Parameters.Add("ID_event", SqlDbType.Int); + Direction("ID_event", ParameterDirection.Output); + if(E_date == null) Commande.Parameters.AddWithValue("@E_date", Convert.DBNull); + else Commande.Parameters.AddWithValue("@E_date", E_date); + if(E_duree == null) Commande.Parameters.AddWithValue("@E_duree", Convert.DBNull); + else Commande.Parameters.AddWithValue("@E_duree", E_duree); + if(ID_typeEvenement == null) Commande.Parameters.AddWithValue("@ID_typeEvenement", Convert.DBNull); + else Commande.Parameters.AddWithValue("@ID_typeEvenement", ID_typeEvenement); + if(E_description == null) Commande.Parameters.AddWithValue("@E_description", Convert.DBNull); + else Commande.Parameters.AddWithValue("@E_description", E_description); + if(ID_lieu == null) Commande.Parameters.AddWithValue("@ID_lieu", Convert.DBNull); + else Commande.Parameters.AddWithValue("@ID_lieu", ID_lieu); + Commande.Parameters.AddWithValue("@E_Pic", E_Pic ?? Convert.DBNull); + Commande.Connection.Open(); + Commande.ExecuteNonQuery(); + res = int.Parse(LireParametre("ID_event")); + Commande.Connection.Close(); + return res; + } + public int Modifier(int ID_event, DateTime? E_date, DateTime? E_duree, int? ID_typeEvenement, string E_description, int? ID_lieu, Byte?[] E_Pic) + { + CreerCommande("ModifierT_event"); + int res = 0; + Commande.Parameters.AddWithValue("@ID_event", ID_event); + if(E_date == null) Commande.Parameters.AddWithValue("@E_date", Convert.DBNull); + else Commande.Parameters.AddWithValue("@E_date", E_date); + if(E_duree == null) Commande.Parameters.AddWithValue("@E_duree", Convert.DBNull); + else Commande.Parameters.AddWithValue("@E_duree", E_duree); + if(ID_typeEvenement == null) Commande.Parameters.AddWithValue("@ID_typeEvenement", Convert.DBNull); + else Commande.Parameters.AddWithValue("@ID_typeEvenement", ID_typeEvenement); + if(E_description == null) Commande.Parameters.AddWithValue("@E_description", Convert.DBNull); + else Commande.Parameters.AddWithValue("@E_description", E_description); + if(ID_lieu == null) Commande.Parameters.AddWithValue("@ID_lieu", Convert.DBNull); + else Commande.Parameters.AddWithValue("@ID_lieu", ID_lieu); + Commande.Parameters.AddWithValue("@E_Pic", E_Pic ?? Convert.DBNull); + Commande.Connection.Open(); + Commande.ExecuteNonQuery(); + Commande.Connection.Close(); + return res; + } + public List Lire(string Index) + { + CreerCommande("SelectionnerT_event"); + Commande.Parameters.AddWithValue("@Index", Index); + Commande.Connection.Open(); + SqlDataReader dr = Commande.ExecuteReader(); + List res = new List(); + while (dr.Read()) + { + C_T_event tmp = new C_T_event(); + tmp.ID_event = int.Parse(dr["ID_event"].ToString()); + if(dr["E_date"] != DBNull.Value) tmp.E_date = DateTime.Parse(dr["E_date"].ToString()); + if(dr["E_duree"] != DBNull.Value) tmp.E_duree = DateTime.Parse(dr["E_duree"].ToString()); + if(dr["ID_typeEvenement"] != DBNull.Value) tmp.ID_typeEvenement = int.Parse(dr["ID_typeEvenement"].ToString()); + if(dr["E_description"] != DBNull.Value) tmp.E_description = (dr["E_description"].ToString()); + if(dr["ID_lieu"] != DBNull.Value) tmp.ID_lieu = int.Parse(dr["ID_lieu"].ToString()); + if (dr["E_Pic"] != DBNull.Value) tmp.E_Pic = (byte?[])dr["E_Pic"]; + res.Add(tmp); + } + dr.Close(); + Commande.Connection.Close(); + return res; + } + public C_T_event Lire_ID(int ID_event) + { + CreerCommande("SelectionnerT_event_ID"); + Commande.Parameters.AddWithValue("@ID_event", ID_event); + Commande.Connection.Open(); + SqlDataReader dr = Commande.ExecuteReader(); + C_T_event res = new C_T_event(); + while (dr.Read()) + { + res.ID_event = int.Parse(dr["ID_event"].ToString()); + if(dr["E_date"] != DBNull.Value) res.E_date = DateTime.Parse(dr["E_date"].ToString()); + if(dr["E_duree"] != DBNull.Value) res.E_duree = DateTime.Parse(dr["E_duree"].ToString()); + if(dr["ID_typeEvenement"] != DBNull.Value) res.ID_typeEvenement = int.Parse(dr["ID_typeEvenement"].ToString()); + if(dr["E_description"] != DBNull.Value) res.E_description = (dr["E_description"].ToString()); + if(dr["ID_lieu"] != DBNull.Value) res.ID_lieu = int.Parse(dr["ID_lieu"].ToString()); + if (dr["E_Pic"] != DBNull.Value) res.E_Pic = (byte?[])dr["E_Pic"]; + } + dr.Close(); + Commande.Connection.Close(); + return res; + } + public int Supprimer(int ID_event) + { + CreerCommande("SupprimerT_event"); + int res = 0; + Commande.Parameters.AddWithValue("@ID_event", ID_event); + Commande.Connection.Open(); + res = Commande.ExecuteNonQuery(); + Commande.Connection.Close(); + return res; + } + } +} diff --git a/ProjetTheAlone/Model/A_T_event.cs b/ProjetTheAlone/Model/A_T_event.cs index d7024ab..df6f603 100644 --- a/ProjetTheAlone/Model/A_T_event.cs +++ b/ProjetTheAlone/Model/A_T_event.cs @@ -36,8 +36,9 @@ namespace ProjetTheAlone.Acces else Commande.Parameters.AddWithValue("@E_description", E_description); if(ID_lieu == null) Commande.Parameters.AddWithValue("@ID_lieu", Convert.DBNull); else Commande.Parameters.AddWithValue("@ID_lieu", ID_lieu); - Commande.Parameters.AddWithValue("@E_Pic", E_Pic ?? Convert.DBNull); - Commande.Connection.Open(); + if (E_Pic != null) Commande.Parameters.AddWithValue("@E_Pic", SqlDbType.Image).Value = Outil.toByteArray.Convert(E_Pic); + else Commande.Parameters.AddWithValue("@E_Pic", SqlDbType.Image).Value = new byte[] {0}; + Commande.Connection.Open(); Commande.ExecuteNonQuery(); res = int.Parse(LireParametre("ID_event")); Commande.Connection.Close(); @@ -58,7 +59,8 @@ namespace ProjetTheAlone.Acces else Commande.Parameters.AddWithValue("@E_description", E_description); if(ID_lieu == null) Commande.Parameters.AddWithValue("@ID_lieu", Convert.DBNull); else Commande.Parameters.AddWithValue("@ID_lieu", ID_lieu); - Commande.Parameters.AddWithValue("@E_Pic", E_Pic ?? Convert.DBNull); + if (E_Pic != null) Commande.Parameters.AddWithValue("@E_Pic", SqlDbType.Image).Value = Outil.toByteArray.Convert(E_Pic); + else Commande.Parameters.AddWithValue("@E_Pic", SqlDbType.Image).Value = new byte[] { 0 }; Commande.Connection.Open(); Commande.ExecuteNonQuery(); Commande.Connection.Close(); @@ -80,7 +82,7 @@ namespace ProjetTheAlone.Acces if(dr["ID_typeEvenement"] != DBNull.Value) tmp.ID_typeEvenement = int.Parse(dr["ID_typeEvenement"].ToString()); if(dr["E_description"] != DBNull.Value) tmp.E_description = (dr["E_description"].ToString()); if(dr["ID_lieu"] != DBNull.Value) tmp.ID_lieu = int.Parse(dr["ID_lieu"].ToString()); - if (dr["E_Pic"] != DBNull.Value) tmp.E_Pic = (byte?[])dr["E_Pic"]; + if (dr["E_Pic"] != DBNull.Value) tmp.E_Pic = Outil.toNullableByteArray.Convert((byte[])dr["E_Pic"]); res.Add(tmp); } dr.Close(); @@ -102,7 +104,7 @@ namespace ProjetTheAlone.Acces if(dr["ID_typeEvenement"] != DBNull.Value) res.ID_typeEvenement = int.Parse(dr["ID_typeEvenement"].ToString()); if(dr["E_description"] != DBNull.Value) res.E_description = (dr["E_description"].ToString()); if(dr["ID_lieu"] != DBNull.Value) res.ID_lieu = int.Parse(dr["ID_lieu"].ToString()); - if (dr["E_Pic"] != DBNull.Value) res.E_Pic = (byte?[])dr["E_Pic"]; + if (dr["E_Pic"] != DBNull.Value) res.E_Pic = Outil.toNullableByteArray.Convert((byte[])dr["E_Pic"]); } dr.Close(); Commande.Connection.Close(); diff --git a/ProjetTheAlone/Model/A_T_listParticipant.cs b/ProjetTheAlone/Model/A_T_listParticipant.cs index d959f4d..11e3dee 100644 --- a/ProjetTheAlone/Model/A_T_listParticipant.cs +++ b/ProjetTheAlone/Model/A_T_listParticipant.cs @@ -69,6 +69,27 @@ namespace ProjetTheAlone.Acces Commande.Connection.Close(); return res; } + public List Lire(int ID_Equipe) + { + CreerCommande("ListParticipantEquipe"); + Commande.Parameters.AddWithValue("@ID_equipe", ID_Equipe); + Commande.Connection.Open(); + SqlDataReader dr = Commande.ExecuteReader(); + List res = new List(); + while (dr.Read()) + { + C_T_beneficiaire tmp = new C_T_beneficiaire(); + tmp.ID_beneficiaire = int.Parse(dr["ID_beneficiaire"].ToString()); + 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()); + if (dr["B_img"] != DBNull.Value) tmp.B_img = Outil.toNullableByteArray.Convert((byte[])dr["B_img"]); + res.Add(tmp); + } + dr.Close(); + Commande.Connection.Close(); + return res; + } public C_T_listParticipant Lire_ID(int ID_LP) { CreerCommande("SelectionnerT_listParticipant_ID"); diff --git a/ProjetTheAlone/Model/A_T_listPlat.cs b/ProjetTheAlone/Model/A_T_listPlat.cs index 539fba3..d7ea69d 100644 --- a/ProjetTheAlone/Model/A_T_listPlat.cs +++ b/ProjetTheAlone/Model/A_T_listPlat.cs @@ -20,13 +20,13 @@ namespace ProjetTheAlone.Acces : base(sChaineConnexion) { } #endregion - public int Ajouter(int ID_repa, int ID_plat) + public int Ajouter(DateTime LP_DatePlat, int ID_plat) { CreerCommande("AjouterT_listPlat"); int res = 0; Commande.Parameters.Add("ID_listPlat", SqlDbType.Int); Direction("ID_listPlat", ParameterDirection.Output); - Commande.Parameters.AddWithValue("@ID_repa", ID_repa); + Commande.Parameters.AddWithValue("@LP_DatePlat", LP_DatePlat); Commande.Parameters.AddWithValue("@ID_plat", ID_plat); Commande.Connection.Open(); Commande.ExecuteNonQuery(); @@ -34,13 +34,13 @@ namespace ProjetTheAlone.Acces Commande.Connection.Close(); return res; } - public int Modifier(int ID_listPlat, int ID_repa, int ID_plat) + public int Modifier(int ID_listPlat, DateTime LP_DatePlat, int ID_plat) { CreerCommande("ModifierT_listPlat"); int res = 0; Commande.Parameters.AddWithValue("@ID_listPlat", ID_listPlat); - Commande.Parameters.AddWithValue("@ID_repa", ID_repa); - Commande.Parameters.AddWithValue("@ID_plat", ID_plat); + Commande.Parameters.AddWithValue("@LP_DatePlat", LP_DatePlat); + Commande.Parameters.AddWithValue("@ID_plat", ID_plat); Commande.Connection.Open(); Commande.ExecuteNonQuery(); Commande.Connection.Close(); @@ -81,13 +81,35 @@ namespace ProjetTheAlone.Acces dr.Close(); Commande.Connection.Close(); return res; - } - public int Supprimer(int ID_listPlat) + } + public List Lire(DateTime LP_DateRepas) + { + CreerCommande("SelectListPlatByDate"); + Commande.Parameters.AddWithValue("@dateV", LP_DateRepas); + Commande.Connection.Open(); + SqlDataReader dr = Commande.ExecuteReader(); + List res = new List(); + 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 = Outil.toNullableByteArray.Convert((byte[])dr["P_img"]); + var x = dr["ID_typePlat"]; + if (dr["ID_typePlat"] != DBNull.Value) tmp.ID_typePlat = (C_T_plat.TypePlat_E)(int.Parse(dr["ID_typePlat"].ToString())); + res.Add(tmp); + } + dr.Close(); + Commande.Connection.Close(); + return res; + } + public int Supprimer(int ID_Plat, DateTime dateV) { CreerCommande("SupprimerT_listPlat"); int res = 0; - Commande.Parameters.AddWithValue("@ID_listPlat", ID_listPlat); - Commande.Connection.Open(); + Commande.Parameters.AddWithValue("@ID_Plat", ID_Plat); + Commande.Parameters.AddWithValue("@dateV", SqlDbType.DateTime).Value = dateV; + Commande.Connection.Open(); res = Commande.ExecuteNonQuery(); Commande.Connection.Close(); return res; diff --git a/ProjetTheAlone/Model/A_T_plat.cs b/ProjetTheAlone/Model/A_T_plat.cs index 6c6c9f7..7d87de3 100644 --- a/ProjetTheAlone/Model/A_T_plat.cs +++ b/ProjetTheAlone/Model/A_T_plat.cs @@ -15,12 +15,13 @@ namespace ProjetTheAlone.Acces /// public class A_T_plat : ADBase { + public enum TypePlat_E { soupe, plat, dessert} #region Constructeurs public A_T_plat(string sChaineConnexion) : base(sChaineConnexion) { } #endregion - public int Ajouter(string P_nom, byte[] P_img, int? ID_typePlat) + public int Ajouter(string P_nom, byte?[] P_img, int? ID_typePlat) { CreerCommande("AjouterT_plat"); int res = 0; @@ -29,7 +30,7 @@ namespace ProjetTheAlone.Acces if(P_nom == null) Commande.Parameters.AddWithValue("@P_nom", Convert.DBNull); else Commande.Parameters.AddWithValue("@P_nom", P_nom); if(P_img == null) Commande.Parameters.AddWithValue("@P_img", Convert.DBNull); - else Commande.Parameters.AddWithValue("@P_img", P_img); + else Commande.Parameters.AddWithValue("@P_img", SqlDbType.Image).Value = Outil.toByteArray.Convert(P_img); if(ID_typePlat == null) Commande.Parameters.AddWithValue("@ID_typePlat", Convert.DBNull); else Commande.Parameters.AddWithValue("@ID_typePlat", ID_typePlat); Commande.Connection.Open(); @@ -38,7 +39,7 @@ namespace ProjetTheAlone.Acces Commande.Connection.Close(); return res; } - public int Modifier(int ID_plat, string P_nom, byte[] P_img, int? ID_typePlat) + public int Modifier(int ID_plat, string P_nom, byte?[] P_img, int? ID_typePlat) { CreerCommande("ModifierT_plat"); int res = 0; @@ -46,8 +47,8 @@ namespace ProjetTheAlone.Acces if(P_nom == null) Commande.Parameters.AddWithValue("@P_nom", Convert.DBNull); else Commande.Parameters.AddWithValue("@P_nom", P_nom); if(P_img == null) Commande.Parameters.AddWithValue("@P_img", Convert.DBNull); - else Commande.Parameters.AddWithValue("@P_img", P_img); - if(ID_typePlat == null) Commande.Parameters.AddWithValue("@ID_typePlat", Convert.DBNull); + else Commande.Parameters.AddWithValue("@P_img", SqlDbType.Image).Value = Outil.toByteArray.Convert(P_img); + if (ID_typePlat == null) Commande.Parameters.AddWithValue("@ID_typePlat", Convert.DBNull); else Commande.Parameters.AddWithValue("@ID_typePlat", ID_typePlat); Commande.Connection.Open(); Commande.ExecuteNonQuery(); @@ -66,8 +67,9 @@ namespace ProjetTheAlone.Acces 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()); + if(dr["P_img"] != DBNull.Value) tmp.P_img = Outil.toNullableByteArray.Convert((byte[])dr["P_img"]); + var x = dr["ID_typePlat"]; + if (dr["ID_typePlat"] != DBNull.Value) tmp.ID_typePlat = (C_T_plat.TypePlat_E)(int.Parse(dr["ID_typePlat"].ToString())); res.Add(tmp); } dr.Close(); @@ -77,10 +79,10 @@ namespace ProjetTheAlone.Acces /// /// Permet de récupérer la liste des plats d'un repas /// - public List ListPlat(int ID_listPlat) + public List ListPlat(int ID_repa) { CreerCommande("ListPlat"); - Commande.Parameters.AddWithValue("@ID_listPlat", ID_listPlat); + Commande.Parameters.AddWithValue("@ID_repa", ID_repa); Commande.Connection.Open(); SqlDataReader dr = Commande.ExecuteReader(); List res = new List(); @@ -89,8 +91,8 @@ namespace ProjetTheAlone.Acces 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()); + if (dr["P_img"] != DBNull.Value) tmp.P_img = (byte?[])(dr["P_img"]); + if (dr["ID_typePlat"] != DBNull.Value) tmp.ID_typePlat = (C_T_plat.TypePlat_E)int.Parse(dr["ID_typePlat"].ToString()); res.Add(tmp); } dr.Close(); @@ -108,8 +110,8 @@ namespace ProjetTheAlone.Acces { res.ID_plat = int.Parse(dr["ID_plat"].ToString()); if(dr["P_nom"] != DBNull.Value) res.P_nom = (dr["P_nom"].ToString()); - if(dr["P_img"] != DBNull.Value) res.P_img = Encoding.ASCII.GetBytes(dr["P_img"].ToString()); - if(dr["ID_typePlat"] != DBNull.Value) res.ID_typePlat = int.Parse(dr["ID_typePlat"].ToString()); + if(dr["P_img"] != DBNull.Value) res.P_img = Outil.toNullableByteArray.Convert((byte[])dr["P_img"]); + if(dr["ID_typePlat"] != DBNull.Value) res.ID_typePlat = (C_T_plat.TypePlat_E)int.Parse(dr["ID_typePlat"].ToString()); } dr.Close(); Commande.Connection.Close(); diff --git a/ProjetTheAlone/Model/A_T_repa.cs b/ProjetTheAlone/Model/A_T_repa.cs index 1ccd3c6..fe832fb 100644 --- a/ProjetTheAlone/Model/A_T_repa.cs +++ b/ProjetTheAlone/Model/A_T_repa.cs @@ -105,20 +105,21 @@ namespace ProjetTheAlone.Acces /// /// Date filtre - public List Lire(DateTime dateV) + public List Lire(DateTime dateV) { - CreerCommande("SelectEventBetweenTwoDateTime"); + CreerCommande("SelectListPlatByDate"); Commande.Parameters.AddWithValue("@dateV", dateV); Commande.Connection.Open(); SqlDataReader dr = Commande.ExecuteReader(); - List res = new List(); + List res = new List(); while (dr.Read()) { - C_T_repa tmp = new C_T_repa(); - tmp.ID_repa = int.Parse(dr["ID_repa"].ToString()); - tmp.R_Date = DateTime.Parse(dr["R_Date"].ToString()); - if (dr["ID_listPlat"] != DBNull.Value) tmp.ID_listPlat = int.Parse(dr["ID_listPlat"].ToString()); - if (dr["ID_typeRepa"] != DBNull.Value) tmp.ID_typeRepa = int.Parse(dr["ID_typeRepa"].ToString()); + 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 = Outil.toNullableByteArray.Convert((byte[])dr["P_img"]); + var x = dr["ID_typePlat"]; + if (dr["ID_typePlat"] != DBNull.Value) tmp.ID_typePlat = (C_T_plat.TypePlat_E)(int.Parse(dr["ID_typePlat"].ToString())); res.Add(tmp); } dr.Close(); diff --git a/ProjetTheAlone/Model/C_T_equipe.cs b/ProjetTheAlone/Model/C_T_equipe.cs index 538b053..da314c1 100644 --- a/ProjetTheAlone/Model/C_T_equipe.cs +++ b/ProjetTheAlone/Model/C_T_equipe.cs @@ -14,19 +14,19 @@ namespace ProjetTheAlone.Classes #region Données membres private int _ID_equipe; private string _E_nom; - private string _E_point; + private int _E_point; private int? _ID_evenement; #endregion #region Constructeurs public C_T_equipe() { } - public C_T_equipe(string E_nom_, string E_point_, int? ID_evenement_) + public C_T_equipe(string E_nom_, int E_point_, int? ID_evenement_) { E_nom = E_nom_; E_point = E_point_; ID_evenement = ID_evenement_; } - public C_T_equipe(int ID_equipe_, string E_nom_, string E_point_, int? ID_evenement_) + public C_T_equipe(int ID_equipe_, string E_nom_, int E_point_, int? ID_evenement_) : this(E_nom_, E_point_, ID_evenement_) { ID_equipe = ID_equipe_; @@ -43,7 +43,7 @@ namespace ProjetTheAlone.Classes get { return _E_nom; } set { _E_nom = value; } } - public string E_point + public int E_point { get { return _E_point; } set { _E_point = value; } diff --git a/ProjetTheAlone/Model/C_T_event.cs b/ProjetTheAlone/Model/C_T_event.cs index 03adc8d..f2bdd8e 100644 --- a/ProjetTheAlone/Model/C_T_event.cs +++ b/ProjetTheAlone/Model/C_T_event.cs @@ -18,7 +18,7 @@ namespace ProjetTheAlone.Classes private int? _ID_typeEvenement; private string _E_description; private int? _ID_lieu; - private byte?[] _E_Pic; + private byte?[] _E_Pic; #endregion #region Constructeurs public C_T_event() diff --git a/ProjetTheAlone/Model/C_T_plat.cs b/ProjetTheAlone/Model/C_T_plat.cs index fc78e0c..0474759 100644 --- a/ProjetTheAlone/Model/C_T_plat.cs +++ b/ProjetTheAlone/Model/C_T_plat.cs @@ -11,22 +11,23 @@ namespace ProjetTheAlone.Classes /// public class C_T_plat { - #region Données membres - private int _ID_plat; + public enum TypePlat_E { Soupe, Plat, Dessert} + #region Données membres + private int _ID_plat; private string _P_nom; - private byte[] _P_img; - private int? _ID_typePlat; + private byte?[] _P_img; + private TypePlat_E _ID_typePlat; #endregion #region Constructeurs public C_T_plat() { } - public C_T_plat(string P_nom_, byte[] P_img_, int? ID_typePlat_) + public C_T_plat(string P_nom_, byte?[] P_img_, int? ID_typePlat_) { P_nom = P_nom_; P_img = P_img_; - ID_typePlat = ID_typePlat_; + ID_typePlat = (C_T_plat.TypePlat_E)(ID_typePlat_==null?0:ID_typePlat_.Value); } - public C_T_plat(int ID_plat_, string P_nom_, byte[] P_img_, int? ID_typePlat_) + public C_T_plat(int ID_plat_, string P_nom_, byte?[] P_img_, int? ID_typePlat_) : this(P_nom_, P_img_, ID_typePlat_) { ID_plat = ID_plat_; @@ -43,16 +44,16 @@ namespace ProjetTheAlone.Classes get { return _P_nom; } set { _P_nom = value; } } - public byte[] P_img + public byte?[] P_img { get { return _P_img; } set { _P_img = value; } } - public int? ID_typePlat + public TypePlat_E ID_typePlat { get { return _ID_typePlat; } set { _ID_typePlat = value; } } - #endregion - } + #endregion + } } diff --git a/ProjetTheAlone/Model/G_T_equipe.cs b/ProjetTheAlone/Model/G_T_equipe.cs index 06f0df6..47163ec 100644 --- a/ProjetTheAlone/Model/G_T_equipe.cs +++ b/ProjetTheAlone/Model/G_T_equipe.cs @@ -21,9 +21,9 @@ namespace ProjetTheAlone.Gestion : base(sChaineConnexion) { } #endregion - public int Ajouter(string E_nom, string E_point, int? ID_evenement) + public int Ajouter(string E_nom, int E_point, int? ID_evenement) { return new A_T_equipe(ChaineConnexion).Ajouter(E_nom, E_point, ID_evenement); } - public int Modifier(int ID_equipe, string E_nom, string E_point, int? ID_evenement) + public int Modifier(int ID_equipe, string E_nom, int E_point, int? ID_evenement) { return new A_T_equipe(ChaineConnexion).Modifier(ID_equipe, E_nom, E_point, ID_evenement); } public List Lire(string Index) { return new A_T_equipe(ChaineConnexion).Lire(Index); } diff --git a/ProjetTheAlone/Model/G_T_listParticipant.cs b/ProjetTheAlone/Model/G_T_listParticipant.cs index e4c93ce..efa89dc 100644 --- a/ProjetTheAlone/Model/G_T_listParticipant.cs +++ b/ProjetTheAlone/Model/G_T_listParticipant.cs @@ -25,8 +25,10 @@ namespace ProjetTheAlone.Gestion { return new A_T_listParticipant(ChaineConnexion).Ajouter(ID_equipe, ID_benificiaire); } public int Modifier(int ID_LP, int? ID_equipe, int? ID_benificiaire) { return new A_T_listParticipant(ChaineConnexion).Modifier(ID_LP, ID_equipe, ID_benificiaire); } - public List Lire(string Index) + public List Lire(string Index) //List Lire(string ID_Equipe) { return new A_T_listParticipant(ChaineConnexion).Lire(Index); } + public List Lire(int ID_Equipe) //List Lire(string ID_Equipe) + { return new A_T_listParticipant(ChaineConnexion).Lire(ID_Equipe); } public C_T_listParticipant Lire_ID(int ID_LP) { return new A_T_listParticipant(ChaineConnexion).Lire_ID(ID_LP); } public int Supprimer(int ID_LP) diff --git a/ProjetTheAlone/Model/G_T_listPlat.cs b/ProjetTheAlone/Model/G_T_listPlat.cs index 1be2cd7..265a49e 100644 --- a/ProjetTheAlone/Model/G_T_listPlat.cs +++ b/ProjetTheAlone/Model/G_T_listPlat.cs @@ -21,15 +21,18 @@ namespace ProjetTheAlone.Gestion : base(sChaineConnexion) { } #endregion - public int Ajouter(int ID_repa, int ID_plat) - { return new A_T_listPlat(ChaineConnexion).Ajouter(ID_repa, ID_plat); } - public int Modifier(int ID_listPlat, int ID_repa, int ID_plat) - { return new A_T_listPlat(ChaineConnexion).Modifier(ID_listPlat, ID_repa, ID_plat); } + public int Ajouter(DateTime LP_DatePlat, int ID_plat) + { return new A_T_listPlat(ChaineConnexion).Ajouter(LP_DatePlat, ID_plat); } + public int Modifier(int ID_listPlat, DateTime LP_DatePlat, int ID_plat) + { return new A_T_listPlat(ChaineConnexion).Modifier(ID_listPlat, LP_DatePlat, ID_plat); } public List Lire(string Index) - { return new A_T_listPlat(ChaineConnexion).Lire(Index); } - public C_T_listPlat Lire_ID(int ID_listPlat) + { return new A_T_listPlat(ChaineConnexion).Lire(Index); } //C_T_listPlat Lire(DateTime LP_DateRepas) + public List Lire(DateTime dateV) + { return new A_T_listPlat(ChaineConnexion).Lire(dateV); } //C_T_listPlat Lire(DateTime LP_DateRepas) + + public C_T_listPlat Lire_ID(int ID_listPlat) { return new A_T_listPlat(ChaineConnexion).Lire_ID(ID_listPlat); } - public int Supprimer(int ID_listPlat) - { return new A_T_listPlat(ChaineConnexion).Supprimer(ID_listPlat); } + public int Supprimer(int ID_Plat, DateTime dateV) + { return new A_T_listPlat(ChaineConnexion).Supprimer(ID_Plat, dateV); } } } diff --git a/ProjetTheAlone/Model/G_T_plat.cs b/ProjetTheAlone/Model/G_T_plat.cs index ad6fdd6..de4af84 100644 --- a/ProjetTheAlone/Model/G_T_plat.cs +++ b/ProjetTheAlone/Model/G_T_plat.cs @@ -21,9 +21,9 @@ namespace ProjetTheAlone.Gestion : base(sChaineConnexion) { } #endregion - public int Ajouter(string P_nom, byte[] P_img, int? ID_typePlat) + public int Ajouter(string P_nom, byte?[] P_img, int? ID_typePlat) { return new A_T_plat(ChaineConnexion).Ajouter(P_nom, P_img, ID_typePlat); } - public int Modifier(int ID_plat, string P_nom, byte[] P_img, int? ID_typePlat) + public int Modifier(int ID_plat, string P_nom, byte?[] P_img, int? ID_typePlat) { return new A_T_plat(ChaineConnexion).Modifier(ID_plat, P_nom, P_img, ID_typePlat); } public List Lire(string Index) { return new A_T_plat(ChaineConnexion).Lire(Index); } diff --git a/ProjetTheAlone/Model/G_T_repa.cs b/ProjetTheAlone/Model/G_T_repa.cs index 73ccb3e..cc1cc49 100644 --- a/ProjetTheAlone/Model/G_T_repa.cs +++ b/ProjetTheAlone/Model/G_T_repa.cs @@ -38,7 +38,7 @@ namespace ProjetTheAlone.Gestion /// Permet de récupérer les repas d'une date donnée /// /// Date filtre - public List Lire(DateTime dateV) + public List 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); } diff --git a/ProjetTheAlone/Outil/picToByteArray.cs b/ProjetTheAlone/Outil/picToByteArray.cs new file mode 100644 index 0000000..3c96064 --- /dev/null +++ b/ProjetTheAlone/Outil/picToByteArray.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjetTheAlone.Outil +{ + class picToByteArray + { + public static byte[] Convert(string imgPath) + { + FileStream fs = new System.IO.FileStream(@".\desert.jpg", FileMode.Open, FileAccess.Read); + BinaryReader br = new BinaryReader(fs); + byte[] result = br.ReadBytes((int)fs.Length); + br.Close(); + fs.Close(); + + return result; + } + } +} diff --git a/ProjetTheAlone/Outil/toByteArray.cs b/ProjetTheAlone/Outil/toByteArray.cs new file mode 100644 index 0000000..e73cd3b --- /dev/null +++ b/ProjetTheAlone/Outil/toByteArray.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjetTheAlone.Outil +{ + class toByteArray + { + public static byte[] Convert(byte?[] bytes) + { + byte[] bb = Array.ConvertAll(bytes, + delegate (byte? b) + { + return b.Value; + }); + return bb; + } + } +} diff --git a/ProjetTheAlone/Outil/toNullableByteArray.cs b/ProjetTheAlone/Outil/toNullableByteArray.cs new file mode 100644 index 0000000..60813f7 --- /dev/null +++ b/ProjetTheAlone/Outil/toNullableByteArray.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjetTheAlone.Outil +{ + class toNullableByteArray + { + public static byte?[] Convert(byte[] bytes) + { + byte?[] bb = Array.ConvertAll(bytes, + delegate (byte b) + { + return b; + }); + return bb; + } + } +} diff --git a/ProjetTheAlone/ProjetTheAlone.csproj b/ProjetTheAlone/ProjetTheAlone.csproj index 82e0c3a..f1283ff 100644 --- a/ProjetTheAlone/ProjetTheAlone.csproj +++ b/ProjetTheAlone/ProjetTheAlone.csproj @@ -81,8 +81,25 @@ MSBuild:Compile Designer + + Settings2.settings + True + True + - + + + + + + + + + + + + FicDetailEvent.xaml + FicEncodePlat.xaml @@ -109,7 +126,7 @@ - + True True Settings1.settings @@ -142,7 +159,6 @@ Repa.xaml - Accueil.xaml @@ -158,9 +174,22 @@ FicEvenementEncode.xaml + + FicNewEquipe.xaml + + + FicNewLieu.xaml + + + FicNewtypeEvent.xaml + FicRepasEncode.xaml + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -213,6 +242,18 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -236,12 +277,16 @@ ResXFileCodeGenerator Resources.Designer.cs + + SettingsSingleFileGenerator + Settings2.Designer.cs + SettingsSingleFileGenerator Settings.Designer.cs - + SettingsSingleFileGenerator Settings1.Designer.cs diff --git a/ProjetTheAlone/UserControlDIY/Plat.xaml.cs b/ProjetTheAlone/UserControlDIY/Plat.xaml.cs index c204d85..3e4a557 100644 --- a/ProjetTheAlone/UserControlDIY/Plat.xaml.cs +++ b/ProjetTheAlone/UserControlDIY/Plat.xaml.cs @@ -19,15 +19,39 @@ namespace ProjetTheAlone.UserControlDIY /// /// Interaction logic for Plat.xaml /// + public partial class Plat : UserControl { - public C_T_plat PlatV { get { return this.DataContext as C_T_plat; } } + + public C_T_plat PlatV + { + get { return (C_T_plat)GetValue(PlatVProperty); } + set { SetValue(PlatVProperty, value); } + } + + // Using a DependencyProperty as the backing store for Property1. + // This enables animation, styling, binding, etc... + public static readonly DependencyProperty PlatVProperty + = DependencyProperty.Register( + "PlatV", + typeof(C_T_plat), + typeof(Plat), + null + ); + //public C_T_plat PlatV { get { return this.DataContext as C_T_plat; } } public Plat() { InitializeComponent(); - + this.DataContextChanged += new DependencyPropertyChangedEventHandler(updateDataContext); GridPrinc.DataContext = this ; } - + public void updateDataContext(object o, DependencyPropertyChangedEventArgs e) + { + GridPrinc.DataContext = this; + var a = this.DataContext; + //GridPrinc.DataContext = this.DataContext; + } } + } + diff --git a/ProjetTheAlone/UserControlDIY/Repa.xaml b/ProjetTheAlone/UserControlDIY/Repa.xaml index e011511..2691a29 100644 --- a/ProjetTheAlone/UserControlDIY/Repa.xaml +++ b/ProjetTheAlone/UserControlDIY/Repa.xaml @@ -4,6 +4,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:ProjetTheAlone.UserControlDIY" + xmlns:parent="clr-namespace:ProjetTheAlone.View" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" @@ -21,10 +22,10 @@ - - - - + + + + diff --git a/ProjetTheAlone/UserControlDIY/Repa.xaml.cs b/ProjetTheAlone/UserControlDIY/Repa.xaml.cs index 0696acf..28e0988 100644 --- a/ProjetTheAlone/UserControlDIY/Repa.xaml.cs +++ b/ProjetTheAlone/UserControlDIY/Repa.xaml.cs @@ -25,29 +25,19 @@ namespace ProjetTheAlone.UserControlDIY public partial class Repa : UserControl { - public RepaModel RM - { - get - { - return this.DataContext as RepaModel; - } - } - public C_T_plat Plat1 { get => ((RM==null)?new C_T_plat():RM.Plat1 ?? new C_T_plat()); } - public C_T_plat Plat2 { get => ((RM == null) ? new C_T_plat() : RM.Plat2 ?? new C_T_plat()); } - public C_T_plat Plat3 { get => ((RM == null) ? new C_T_plat() : RM.Plat3 ?? new C_T_plat()); } public Repa() { InitializeComponent(); - GridPrinc.DataContext = RM; - Plat1XML.DataContext = Plat1; + this.DataContextChanged += new DependencyPropertyChangedEventHandler(updateDataContext); } public void updateDataContext(object o, DependencyPropertyChangedEventArgs e) { - GridPrinc.DataContext = RM; - Plat1XML.DataContext = Plat1; - Plat2XML.DataContext = Plat2; - Plat3XML.DataContext = Plat3; + var a = this.DataContext; + GridPrinc.DataContext = ((RepaModel) this.DataContext); + /*Plat1XML.DataContext = ((RepaModel)this.DataContext).Plat1; + Plat2XML.DataContext = ((RepaModel)this.DataContext).Plat2; + Plat3XML.DataContext = ((RepaModel)this.DataContext).Plat3;*/ } } } diff --git a/ProjetTheAlone/View/Accueil.xaml.cs b/ProjetTheAlone/View/Accueil.xaml.cs index 0631918..81cbb58 100644 --- a/ProjetTheAlone/View/Accueil.xaml.cs +++ b/ProjetTheAlone/View/Accueil.xaml.cs @@ -22,7 +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"; + // 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; diff --git a/ProjetTheAlone/View/DashBoard.xaml b/ProjetTheAlone/View/DashBoard.xaml index 9f0d383..365a771 100644 --- a/ProjetTheAlone/View/DashBoard.xaml +++ b/ProjetTheAlone/View/DashBoard.xaml @@ -20,65 +20,106 @@ - + - - + - + + + + + + - - - - - - - - + + - - - - - + + + + + + + Demain + Après demain + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + diff --git a/ProjetTheAlone/View/DashBoard.xaml.cs b/ProjetTheAlone/View/DashBoard.xaml.cs index 9c8aa60..2380ad9 100644 --- a/ProjetTheAlone/View/DashBoard.xaml.cs +++ b/ProjetTheAlone/View/DashBoard.xaml.cs @@ -55,23 +55,14 @@ namespace ProjetTheAlone.View public DashBoard() { InitializeComponent(); - Epm = new ProjetTheAlone.Model.EventPasseModel(Cl); - EventPasse2.DataContext = EventPasse1.DataContext = Epm; - Epm.Classement = Cl; + //EventPasse2.DataContext = EventPasse1.DataContext = Epm; - FileStream fs = new System.IO.FileStream(@".\desert.jpg", FileMode.Open, FileAccess.Read); - BinaryReader br = new BinaryReader(fs); - byte[] result = br.ReadBytes((int)fs.Length); - br.Close(); - fs.Close(); - Rm.ListPlat.Add(new C_T_plat("Entrée", result, null)); - Rm.ListPlat.Add(new C_T_plat("Plat", result, null)); - Rm.ListPlat.Add(new C_T_plat("Desert", result, null)); - Rm.Quand = "Matin"; - Console.WriteLine($"~~~~~~{Rm.ListPlat[0].P_nom}~~~~~~"); - RepasMatin.DataContext = RepasMidi.DataContext = RepasSoir.DataContext = Rm; + testQuand.DataContext = RepasAjd.DataContext = new RepaModel(DateTime.Now); + RepasDemain.DataContext = new RepaModel(DateTime.Now.AddDays(1)); + RepasApresDemain.DataContext = new RepaModel(DateTime.Now.AddDays(2)); + var a = testQuand.DataContext; } @@ -79,6 +70,11 @@ namespace ProjetTheAlone.View { Accueil.Openaffichage = false; } + + private void RepasMatin_Loaded(object sender, RoutedEventArgs e) + { + + } } public class DebugDummyConverter : IValueConverter { diff --git a/ProjetTheAlone/View/FicBeneficiaireEncode.xaml b/ProjetTheAlone/View/FicBeneficiaireEncode.xaml index cfb39bf..292c09d 100644 --- a/ProjetTheAlone/View/FicBeneficiaireEncode.xaml +++ b/ProjetTheAlone/View/FicBeneficiaireEncode.xaml @@ -4,8 +4,12 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:ProjetTheAlone.View" + xmlns:convert="clr-namespace:ProjetTheAlone.Converter" mc:Ignorable="d" Title="Bénéficiaire" Height="482.167" Width="955.5" WindowStartupLocation="CenterScreen" WindowStyle="None"> + + + @@ -35,10 +39,11 @@ - + - - - - - - + + + +