From e26277090551f9b9a150bde990c14ce70a0c94f9 Mon Sep 17 00:00:00 2001 From: adri Date: Sat, 19 Jan 2019 22:29:09 +0100 Subject: [PATCH] avent sup hu --- ProjetTheAlone/App.config | 12 +++ ProjetTheAlone/Model/A_T_event.cs | 14 +-- ProjetTheAlone/Model/A_T_repa.cs | 62 ++++++++++++-- ProjetTheAlone/Model/C_T_event.cs | 13 +-- ProjetTheAlone/Model/C_T_repa.cs | 15 ++-- ProjetTheAlone/Model/G_T_event.cs | 8 +- ProjetTheAlone/Model/G_T_repa.cs | 8 +- ProjetTheAlone/ProjetTheAlone.csproj | 47 +++++++++- ProjetTheAlone/View/DashBoard.xaml | 2 + ProjetTheAlone/View/DashBoard.xaml.cs | 2 +- .../View/FicBeneficiaireEncode.xaml | 80 ++++++++++-------- .../View/FicBeneficiaireEncode.xaml.cs | 25 ++++++ ProjetTheAlone/View/FicRepasEncode.xaml | 26 +++--- ProjetTheAlone/View/FicRepasEncode.xaml.cs | 18 ++++ script.sql | Bin 79688 -> 80764 bytes 15 files changed, 254 insertions(+), 78 deletions(-) diff --git a/ProjetTheAlone/App.config b/ProjetTheAlone/App.config index 731f6de..6fb35e6 100644 --- a/ProjetTheAlone/App.config +++ b/ProjetTheAlone/App.config @@ -1,6 +1,18 @@  + + +
+ + + + + + Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=ProjetThe;Integrated Security=True + + + \ No newline at end of file diff --git a/ProjetTheAlone/Model/A_T_event.cs b/ProjetTheAlone/Model/A_T_event.cs index df6d392..d7024ab 100644 --- a/ProjetTheAlone/Model/A_T_event.cs +++ b/ProjetTheAlone/Model/A_T_event.cs @@ -20,7 +20,7 @@ namespace ProjetTheAlone.Acces : base(sChaineConnexion) { } #endregion - public int Ajouter(DateTime? E_date, DateTime? E_duree, int? ID_typeEvenement,string E_description, int? ID_lieu) + 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; @@ -36,13 +36,14 @@ 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(); 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) + 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; @@ -57,7 +58,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.Connection.Open(); + Commande.Parameters.AddWithValue("@E_Pic", E_Pic ?? Convert.DBNull); + Commande.Connection.Open(); Commande.ExecuteNonQuery(); Commande.Connection.Close(); return res; @@ -78,7 +80,8 @@ 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()); - res.Add(tmp); + if (dr["E_Pic"] != DBNull.Value) tmp.E_Pic = (byte?[])dr["E_Pic"]; + res.Add(tmp); } dr.Close(); Commande.Connection.Close(); @@ -99,7 +102,8 @@ 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"]; + } dr.Close(); Commande.Connection.Close(); return res; diff --git a/ProjetTheAlone/Model/A_T_repa.cs b/ProjetTheAlone/Model/A_T_repa.cs index 9a6397a..4e13faf 100644 --- a/ProjetTheAlone/Model/A_T_repa.cs +++ b/ProjetTheAlone/Model/A_T_repa.cs @@ -20,7 +20,7 @@ namespace ProjetTheAlone.Acces : base(sChaineConnexion) { } #endregion - public int Ajouter(int? ID_listPlat, int? ID_typeRepa) + public int Ajouter(int? ID_listPlat, int? ID_typeRepa, DateTime R_Date) { CreerCommande("AjouterT_repa"); int res = 0; @@ -30,13 +30,14 @@ namespace ProjetTheAlone.Acces 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) + public int Modifier(int ID_repa, int? ID_listPlat, int? ID_typeRepa , DateTime R_Date) { CreerCommande("ModifierT_repa"); int res = 0; @@ -45,7 +46,8 @@ namespace ProjetTheAlone.Acces 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.Connection.Open(); + Commande.Parameters.AddWithValue("@R_Date", R_Date); + Commande.Connection.Open(); Commande.ExecuteNonQuery(); Commande.Connection.Close(); return res; @@ -61,6 +63,7 @@ namespace ProjetTheAlone.Acces { 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); @@ -69,7 +72,55 @@ namespace ProjetTheAlone.Acces Commande.Connection.Close(); return res; } - public C_T_repa Lire_ID(int ID_repa) + + /// + /// resume de Lire + /// + /// 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; + } + 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); @@ -78,7 +129,8 @@ namespace ProjetTheAlone.Acces C_T_repa res = new C_T_repa(); while (dr.Read()) { - res.ID_repa = int.Parse(dr["ID_repa"].ToString()); + 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()); } diff --git a/ProjetTheAlone/Model/C_T_event.cs b/ProjetTheAlone/Model/C_T_event.cs index 5c3fe21..03adc8d 100644 --- a/ProjetTheAlone/Model/C_T_event.cs +++ b/ProjetTheAlone/Model/C_T_event.cs @@ -18,20 +18,22 @@ namespace ProjetTheAlone.Classes 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_) + 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_) - : this(E_date_, E_duree_, ID_typeEvenement_, E_description_, ID_lieu_) + 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_; } @@ -60,8 +62,9 @@ namespace ProjetTheAlone.Classes 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 - } + #endregion + } } diff --git a/ProjetTheAlone/Model/C_T_repa.cs b/ProjetTheAlone/Model/C_T_repa.cs index 598c381..8a8c713 100644 --- a/ProjetTheAlone/Model/C_T_repa.cs +++ b/ProjetTheAlone/Model/C_T_repa.cs @@ -15,17 +15,19 @@ namespace ProjetTheAlone.Classes 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_) + 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_) - : this(ID_listPlat_, ID_typeRepa_) + 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_; } @@ -46,6 +48,9 @@ namespace ProjetTheAlone.Classes get { return _ID_typeRepa; } set { _ID_typeRepa = value; } } - #endregion - } + + + public DateTime R_Date { get => _R_Date; set => _R_Date = value; } + #endregion + } } diff --git a/ProjetTheAlone/Model/G_T_event.cs b/ProjetTheAlone/Model/G_T_event.cs index 0c8ae58..e5ce7e2 100644 --- a/ProjetTheAlone/Model/G_T_event.cs +++ b/ProjetTheAlone/Model/G_T_event.cs @@ -21,10 +21,10 @@ namespace ProjetTheAlone.Gestion : base(sChaineConnexion) { } #endregion - public int Ajouter(DateTime? E_date, DateTime? E_duree, int? ID_typeEvenement, string E_description, int? ID_lieu) - { return new A_T_event(ChaineConnexion).Ajouter(E_date, E_duree, ID_typeEvenement,E_description, ID_lieu); } - public int Modifier(int ID_event, DateTime? E_date, DateTime? E_duree, int? ID_typeEvenement, string E_description, int? ID_lieu) - { return new A_T_event(ChaineConnexion).Modifier(ID_event, E_date, E_duree, ID_typeEvenement, E_description, ID_lieu); } + 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) diff --git a/ProjetTheAlone/Model/G_T_repa.cs b/ProjetTheAlone/Model/G_T_repa.cs index e125be1..e4cd392 100644 --- a/ProjetTheAlone/Model/G_T_repa.cs +++ b/ProjetTheAlone/Model/G_T_repa.cs @@ -21,10 +21,10 @@ namespace ProjetTheAlone.Gestion : base(sChaineConnexion) { } #endregion - public int Ajouter(int? ID_listPlat, int? ID_typeRepa) - { return new A_T_repa(ChaineConnexion).Ajouter(ID_listPlat, ID_typeRepa); } - public int Modifier(int ID_repa, int? ID_listPlat, int? ID_typeRepa) - { return new A_T_repa(ChaineConnexion).Modifier(ID_repa, ID_listPlat, ID_typeRepa); } + 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); } public C_T_repa Lire_ID(int ID_repa) diff --git a/ProjetTheAlone/ProjetTheAlone.csproj b/ProjetTheAlone/ProjetTheAlone.csproj index 0dfeb02..6ca0669 100644 --- a/ProjetTheAlone/ProjetTheAlone.csproj +++ b/ProjetTheAlone/ProjetTheAlone.csproj @@ -13,6 +13,21 @@ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 4 true + false + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + true AnyCPU @@ -90,6 +105,12 @@ + + True + True + Settings1.settings + + @@ -212,15 +233,39 @@ SettingsSingleFileGenerator Settings.Designer.cs + + SettingsSingleFileGenerator + Settings1.Designer.cs + - + + + False + Microsoft .NET Framework 4.6.1 %28x86 and x64%29 + true + + + False + .NET Framework 3.5 SP1 + false + + + + + Always + + + Always + ProjetThe.mdf + + \ No newline at end of file diff --git a/ProjetTheAlone/View/DashBoard.xaml b/ProjetTheAlone/View/DashBoard.xaml index 38ec60e..9f0d383 100644 --- a/ProjetTheAlone/View/DashBoard.xaml +++ b/ProjetTheAlone/View/DashBoard.xaml @@ -53,6 +53,8 @@ --> + + diff --git a/ProjetTheAlone/View/DashBoard.xaml.cs b/ProjetTheAlone/View/DashBoard.xaml.cs index 353e5a4..9c8aa60 100644 --- a/ProjetTheAlone/View/DashBoard.xaml.cs +++ b/ProjetTheAlone/View/DashBoard.xaml.cs @@ -70,7 +70,7 @@ namespace ProjetTheAlone.View Rm.Quand = "Matin"; Console.WriteLine($"~~~~~~{Rm.ListPlat[0].P_nom}~~~~~~"); - RepasMatin.DataContext = Rm; + RepasMatin.DataContext = RepasMidi.DataContext = RepasSoir.DataContext = Rm; } diff --git a/ProjetTheAlone/View/FicBeneficiaireEncode.xaml b/ProjetTheAlone/View/FicBeneficiaireEncode.xaml index 9d0b3da..f2ad232 100644 --- a/ProjetTheAlone/View/FicBeneficiaireEncode.xaml +++ b/ProjetTheAlone/View/FicBeneficiaireEncode.xaml @@ -5,58 +5,68 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:ProjetTheAlone.View" mc:Ignorable="d" - Title="Bénéficiaire" Height="300" Width="300" WindowStartupLocation="CenterScreen"> - + Title="Bénéficiaire" Height="482.167" Width="955.5" WindowStartupLocation="CenterScreen" WindowStyle="None"> + - - - - + - +