Initial commit
This commit is contained in:
		
							
								
								
									
										110
									
								
								fivhier pata/A_Article.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										110
									
								
								fivhier pata/A_Article.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,110 @@
 | 
			
		||||
#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 Projet_GestionCommerceInfo.Classes;
 | 
			
		||||
#endregion
 | 
			
		||||
 | 
			
		||||
namespace Projet_GestionCommerceInfo.Acces
 | 
			
		||||
{
 | 
			
		||||
 /// <summary>
 | 
			
		||||
 /// Couche d'accès aux données (Data Access Layer)
 | 
			
		||||
 /// </summary>
 | 
			
		||||
 public class A_Article : ADBase
 | 
			
		||||
 {
 | 
			
		||||
  #region Constructeurs
 | 
			
		||||
  public A_Article(string sChaineConnexion)
 | 
			
		||||
  	: base(sChaineConnexion)
 | 
			
		||||
  { }
 | 
			
		||||
  #endregion
 | 
			
		||||
  public int Ajouter(string Designation, int Stock, bool Visible, bool Actif, decimal? PrixHTVA)
 | 
			
		||||
  {
 | 
			
		||||
   CreerCommande("AjouterArticle");
 | 
			
		||||
   int res = 0;
 | 
			
		||||
   Commande.Parameters.Add("ID", SqlDbType.Int);
 | 
			
		||||
   Direction("ID", ParameterDirection.Output);
 | 
			
		||||
   Commande.Parameters.AddWithValue("@Designation", Designation);
 | 
			
		||||
   Commande.Parameters.AddWithValue("@Stock", Stock);
 | 
			
		||||
   Commande.Parameters.AddWithValue("@Visible", Visible);
 | 
			
		||||
   Commande.Parameters.AddWithValue("@Actif", Actif);
 | 
			
		||||
   if(PrixHTVA == null) Commande.Parameters.AddWithValue("@PrixHTVA", Convert.DBNull);
 | 
			
		||||
   else Commande.Parameters.AddWithValue("@PrixHTVA", PrixHTVA);
 | 
			
		||||
   Commande.Connection.Open();
 | 
			
		||||
   Commande.ExecuteNonQuery();
 | 
			
		||||
   res = int.Parse(LireParametre("ID"));
 | 
			
		||||
   Commande.Connection.Close();
 | 
			
		||||
   return res;
 | 
			
		||||
  }
 | 
			
		||||
  public int Modifier(int ID, string Designation, int Stock, bool Visible, bool Actif, decimal? PrixHTVA)
 | 
			
		||||
  {
 | 
			
		||||
   CreerCommande("ModifierArticle");
 | 
			
		||||
   int res = 0;
 | 
			
		||||
   Commande.Parameters.AddWithValue("@ID", ID);
 | 
			
		||||
   Commande.Parameters.AddWithValue("@Designation", Designation);
 | 
			
		||||
   Commande.Parameters.AddWithValue("@Stock", Stock);
 | 
			
		||||
   Commande.Parameters.AddWithValue("@Visible", Visible);
 | 
			
		||||
   Commande.Parameters.AddWithValue("@Actif", Actif);
 | 
			
		||||
   if(PrixHTVA == null) Commande.Parameters.AddWithValue("@PrixHTVA", Convert.DBNull);
 | 
			
		||||
   else Commande.Parameters.AddWithValue("@PrixHTVA", PrixHTVA);
 | 
			
		||||
   Commande.Connection.Open();
 | 
			
		||||
   Commande.ExecuteNonQuery();
 | 
			
		||||
   Commande.Connection.Close();
 | 
			
		||||
   return res;
 | 
			
		||||
  }
 | 
			
		||||
  public List<C_Article> Lire(string Index)
 | 
			
		||||
  {
 | 
			
		||||
   CreerCommande("SelectionnerArticle");
 | 
			
		||||
   Commande.Parameters.AddWithValue("@Index", Index);
 | 
			
		||||
   Commande.Connection.Open();
 | 
			
		||||
   SqlDataReader dr = Commande.ExecuteReader();
 | 
			
		||||
   List<C_Article> res = new List<C_Article>();
 | 
			
		||||
   while (dr.Read())
 | 
			
		||||
   {
 | 
			
		||||
    C_Article tmp = new C_Article();
 | 
			
		||||
    tmp.ID = int.Parse(dr["ID"].ToString());
 | 
			
		||||
    tmp.Designation = dr["Designation"].ToString();
 | 
			
		||||
    tmp.Stock = int.Parse(dr["Stock"].ToString());
 | 
			
		||||
    tmp.Visible = bool.Parse(dr["Visible"].ToString());
 | 
			
		||||
    tmp.Actif = bool.Parse(dr["Actif"].ToString());
 | 
			
		||||
   if(dr["PrixHTVA"] != DBNull.Value) tmp.PrixHTVA = decimal.Parse(dr["PrixHTVA"].ToString());
 | 
			
		||||
    res.Add(tmp);
 | 
			
		||||
			}
 | 
			
		||||
			dr.Close();
 | 
			
		||||
			Commande.Connection.Close();
 | 
			
		||||
			return res;
 | 
			
		||||
		}
 | 
			
		||||
  public C_Article Lire_ID(int ID)
 | 
			
		||||
  {
 | 
			
		||||
   CreerCommande("SelectionnerArticle_ID");
 | 
			
		||||
   Commande.Parameters.AddWithValue("@ID", ID);
 | 
			
		||||
   Commande.Connection.Open();
 | 
			
		||||
   SqlDataReader dr = Commande.ExecuteReader();
 | 
			
		||||
   C_Article res = new C_Article();
 | 
			
		||||
   while (dr.Read())
 | 
			
		||||
   {
 | 
			
		||||
    res.ID = int.Parse(dr["ID"].ToString());
 | 
			
		||||
    res.Designation = dr["Designation"].ToString();
 | 
			
		||||
    res.Stock = int.Parse(dr["Stock"].ToString());
 | 
			
		||||
    res.Visible = bool.Parse(dr["Visible"].ToString());
 | 
			
		||||
    res.Actif = bool.Parse(dr["Actif"].ToString());
 | 
			
		||||
   if(dr["PrixHTVA"] != DBNull.Value) res.PrixHTVA = decimal.Parse(dr["PrixHTVA"].ToString());
 | 
			
		||||
   }
 | 
			
		||||
			dr.Close();
 | 
			
		||||
			Commande.Connection.Close();
 | 
			
		||||
			return res;
 | 
			
		||||
		}
 | 
			
		||||
  public int Supprimer(int ID)
 | 
			
		||||
  {
 | 
			
		||||
   CreerCommande("SupprimerArticle");
 | 
			
		||||
   int res = 0;
 | 
			
		||||
   Commande.Parameters.AddWithValue("@ID", ID);
 | 
			
		||||
   Commande.Connection.Open();
 | 
			
		||||
   res = Commande.ExecuteNonQuery();
 | 
			
		||||
			Commande.Connection.Close();
 | 
			
		||||
			return res;
 | 
			
		||||
		}
 | 
			
		||||
 }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										86
									
								
								fivhier pata/A_Base.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										86
									
								
								fivhier pata/A_Base.cs
									
									
									
									
									
										Normal file
									
								
							@@ -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 Projet_GestionCommerceInfo.Acces
 | 
			
		||||
{
 | 
			
		||||
 public class ADBase
 | 
			
		||||
  {
 | 
			
		||||
  #region Données membres
 | 
			
		||||
  protected SqlCommand _commande;
 | 
			
		||||
  #endregion
 | 
			
		||||
  #region Constructeurs (étendus)
 | 
			
		||||
  /// <summary>
 | 
			
		||||
  /// Constructeur par défaut
 | 
			
		||||
  /// </summary>
 | 
			
		||||
  /// <remarks>La chaîne de connexion est récupérée en argument</remarks>
 | 
			
		||||
  public ADBase(string sChaineConnexion)
 | 
			
		||||
  {
 | 
			
		||||
   _commande = new SqlCommand();
 | 
			
		||||
   _commande.Connection = new SqlConnection(sChaineConnexion);
 | 
			
		||||
  }
 | 
			
		||||
  /// <summary>
 | 
			
		||||
  /// Méthode assignant une procédure stockée
 | 
			
		||||
  /// </summary>
 | 
			
		||||
  /// <param name="sCommande">Nom de la procédure stockée</param>
 | 
			
		||||
  public void CreerCommande(string sCommande)
 | 
			
		||||
  {
 | 
			
		||||
   _commande.CommandType = CommandType.StoredProcedure;
 | 
			
		||||
   _commande.CommandText = sCommande;
 | 
			
		||||
  }
 | 
			
		||||
  /// <summary>
 | 
			
		||||
  /// Méthode assignant une procédure stockée ET une chaîne de connexion
 | 
			
		||||
  /// </summary>
 | 
			
		||||
  /// <param name="sCommande">Nom de la procédure stockée</param>
 | 
			
		||||
  /// <param name="sConnexion">Chaîne de connexion à utiliser</param>
 | 
			
		||||
  public void CreerCommande(string sCommande, string sConnexion)
 | 
			
		||||
  {
 | 
			
		||||
   _commande.Connection = new SqlConnection(sConnexion);
 | 
			
		||||
   _commande.CommandType = CommandType.StoredProcedure;
 | 
			
		||||
   _commande.CommandText = sCommande;
 | 
			
		||||
  }
 | 
			
		||||
  /// <summary>
 | 
			
		||||
  /// Méthode assignant une procédure stockée et le type de requête
 | 
			
		||||
  /// </summary>
 | 
			
		||||
  /// <param name="sCommande">Nom de la procédure stockée</param>
 | 
			
		||||
  /// <param name="bTypeProcedures">Type de requête (Vrai=stockée, Faux=Texte)</param>
 | 
			
		||||
  public void CreerCommande(string sCommande, bool bTypeRequete)
 | 
			
		||||
  {
 | 
			
		||||
   if (bTypeRequete)	_commande.CommandType = CommandType.StoredProcedure;
 | 
			
		||||
   else	_commande.CommandType = CommandType.Text;
 | 
			
		||||
   _commande.CommandText = sCommande;
 | 
			
		||||
  }
 | 
			
		||||
  /// <summary>
 | 
			
		||||
  /// Méthode assignant une procédure stockée, une chaîne de connexion et le type de requête
 | 
			
		||||
  /// </summary>
 | 
			
		||||
  /// <param name="sCommande">Nom de la procédure stockée</param>
 | 
			
		||||
  /// <param name="sConnexion">Chaîne de connexion à utiliser</param>
 | 
			
		||||
  /// <param name="bTypeProcedures">Type de requête (Vrai=stockée, Faux=Texte)</param>
 | 
			
		||||
  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
 | 
			
		||||
 }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										112
									
								
								fivhier pata/A_LSTArticle.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										112
									
								
								fivhier pata/A_LSTArticle.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,112 @@
 | 
			
		||||
#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 Projet_GestionCommerceInfo.Classes;
 | 
			
		||||
#endregion
 | 
			
		||||
 | 
			
		||||
namespace Projet_GestionCommerceInfo.Acces
 | 
			
		||||
{
 | 
			
		||||
 /// <summary>
 | 
			
		||||
 /// Couche d'accès aux données (Data Access Layer)
 | 
			
		||||
 /// </summary>
 | 
			
		||||
 public class A_LSTArticle : ADBase
 | 
			
		||||
 {
 | 
			
		||||
  #region Constructeurs
 | 
			
		||||
  public A_LSTArticle(string sChaineConnexion)
 | 
			
		||||
  	: base(sChaineConnexion)
 | 
			
		||||
  { }
 | 
			
		||||
  #endregion
 | 
			
		||||
  public int Ajouter(int PanierID, int ArticleID, int Quantite, decimal? PrixHTVA, int? TVA)
 | 
			
		||||
  {
 | 
			
		||||
   CreerCommande("AjouterLSTArticle");
 | 
			
		||||
   int res = 0;
 | 
			
		||||
   Commande.Parameters.Add("ID", SqlDbType.Int);
 | 
			
		||||
   Direction("ID", ParameterDirection.Output);
 | 
			
		||||
   Commande.Parameters.AddWithValue("@PanierID", PanierID);
 | 
			
		||||
   Commande.Parameters.AddWithValue("@ArticleID", ArticleID);
 | 
			
		||||
   Commande.Parameters.AddWithValue("@Quantite", Quantite);
 | 
			
		||||
   if(PrixHTVA == null) Commande.Parameters.AddWithValue("@PrixHTVA", Convert.DBNull);
 | 
			
		||||
   else Commande.Parameters.AddWithValue("@PrixHTVA", PrixHTVA);
 | 
			
		||||
   if(TVA == null) Commande.Parameters.AddWithValue("@TVA", Convert.DBNull);
 | 
			
		||||
   else Commande.Parameters.AddWithValue("@TVA", TVA);
 | 
			
		||||
   Commande.Connection.Open();
 | 
			
		||||
   Commande.ExecuteNonQuery();
 | 
			
		||||
   res = int.Parse(LireParametre("ID"));
 | 
			
		||||
   Commande.Connection.Close();
 | 
			
		||||
   return res;
 | 
			
		||||
  }
 | 
			
		||||
  public int Modifier(int ID, int PanierID, int ArticleID, int Quantite, decimal? PrixHTVA, int? TVA)
 | 
			
		||||
  {
 | 
			
		||||
   CreerCommande("ModifierLSTArticle");
 | 
			
		||||
   int res = 0;
 | 
			
		||||
   Commande.Parameters.AddWithValue("@ID", ID);
 | 
			
		||||
   Commande.Parameters.AddWithValue("@PanierID", PanierID);
 | 
			
		||||
   Commande.Parameters.AddWithValue("@ArticleID", ArticleID);
 | 
			
		||||
   Commande.Parameters.AddWithValue("@Quantite", Quantite);
 | 
			
		||||
   if(PrixHTVA == null) Commande.Parameters.AddWithValue("@PrixHTVA", Convert.DBNull);
 | 
			
		||||
   else Commande.Parameters.AddWithValue("@PrixHTVA", PrixHTVA);
 | 
			
		||||
   if(TVA == null) Commande.Parameters.AddWithValue("@TVA", Convert.DBNull);
 | 
			
		||||
   else Commande.Parameters.AddWithValue("@TVA", TVA);
 | 
			
		||||
   Commande.Connection.Open();
 | 
			
		||||
   Commande.ExecuteNonQuery();
 | 
			
		||||
   Commande.Connection.Close();
 | 
			
		||||
   return res;
 | 
			
		||||
  }
 | 
			
		||||
  public List<C_LSTArticle> Lire(string Index)
 | 
			
		||||
  {
 | 
			
		||||
   CreerCommande("SelectionnerLSTArticle");
 | 
			
		||||
   Commande.Parameters.AddWithValue("@Index", Index);
 | 
			
		||||
   Commande.Connection.Open();
 | 
			
		||||
   SqlDataReader dr = Commande.ExecuteReader();
 | 
			
		||||
   List<C_LSTArticle> res = new List<C_LSTArticle>();
 | 
			
		||||
   while (dr.Read())
 | 
			
		||||
   {
 | 
			
		||||
    C_LSTArticle tmp = new C_LSTArticle();
 | 
			
		||||
    tmp.ID = int.Parse(dr["ID"].ToString());
 | 
			
		||||
    tmp.PanierID = int.Parse(dr["PanierID"].ToString());
 | 
			
		||||
    tmp.ArticleID = int.Parse(dr["ArticleID"].ToString());
 | 
			
		||||
    tmp.Quantite = int.Parse(dr["Quantite"].ToString());
 | 
			
		||||
   if(dr["PrixHTVA"] != DBNull.Value) tmp.PrixHTVA = decimal.Parse(dr["PrixHTVA"].ToString());
 | 
			
		||||
   if(dr["TVA"] != DBNull.Value) tmp.TVA = int.Parse(dr["TVA"].ToString());
 | 
			
		||||
    res.Add(tmp);
 | 
			
		||||
			}
 | 
			
		||||
			dr.Close();
 | 
			
		||||
			Commande.Connection.Close();
 | 
			
		||||
			return res;
 | 
			
		||||
		}
 | 
			
		||||
  public C_LSTArticle Lire_ID(int ID)
 | 
			
		||||
  {
 | 
			
		||||
   CreerCommande("SelectionnerLSTArticle_ID");
 | 
			
		||||
   Commande.Parameters.AddWithValue("@ID", ID);
 | 
			
		||||
   Commande.Connection.Open();
 | 
			
		||||
   SqlDataReader dr = Commande.ExecuteReader();
 | 
			
		||||
   C_LSTArticle res = new C_LSTArticle();
 | 
			
		||||
   while (dr.Read())
 | 
			
		||||
   {
 | 
			
		||||
    res.ID = int.Parse(dr["ID"].ToString());
 | 
			
		||||
    res.PanierID = int.Parse(dr["PanierID"].ToString());
 | 
			
		||||
    res.ArticleID = int.Parse(dr["ArticleID"].ToString());
 | 
			
		||||
    res.Quantite = int.Parse(dr["Quantite"].ToString());
 | 
			
		||||
   if(dr["PrixHTVA"] != DBNull.Value) res.PrixHTVA = decimal.Parse(dr["PrixHTVA"].ToString());
 | 
			
		||||
   if(dr["TVA"] != DBNull.Value) res.TVA = int.Parse(dr["TVA"].ToString());
 | 
			
		||||
   }
 | 
			
		||||
			dr.Close();
 | 
			
		||||
			Commande.Connection.Close();
 | 
			
		||||
			return res;
 | 
			
		||||
		}
 | 
			
		||||
  public int Supprimer(int ID)
 | 
			
		||||
  {
 | 
			
		||||
   CreerCommande("SupprimerLSTArticle");
 | 
			
		||||
   int res = 0;
 | 
			
		||||
   Commande.Parameters.AddWithValue("@ID", ID);
 | 
			
		||||
   Commande.Connection.Open();
 | 
			
		||||
   res = Commande.ExecuteNonQuery();
 | 
			
		||||
			Commande.Connection.Close();
 | 
			
		||||
			return res;
 | 
			
		||||
		}
 | 
			
		||||
 }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										114
									
								
								fivhier pata/A_Panier.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										114
									
								
								fivhier pata/A_Panier.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,114 @@
 | 
			
		||||
#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 Projet_GestionCommerceInfo.Classes;
 | 
			
		||||
#endregion
 | 
			
		||||
 | 
			
		||||
namespace Projet_GestionCommerceInfo.Acces
 | 
			
		||||
{
 | 
			
		||||
 /// <summary>
 | 
			
		||||
 /// Couche d'accès aux données (Data Access Layer)
 | 
			
		||||
 /// </summary>
 | 
			
		||||
 public class A_Panier : ADBase
 | 
			
		||||
 {
 | 
			
		||||
  #region Constructeurs
 | 
			
		||||
  public A_Panier(string sChaineConnexion)
 | 
			
		||||
  	: base(sChaineConnexion)
 | 
			
		||||
  { }
 | 
			
		||||
  #endregion
 | 
			
		||||
  public int Ajouter(int UserId, string Nom, int? Status, DateTime? DateAchat, int Type)
 | 
			
		||||
  {
 | 
			
		||||
   CreerCommande("AjouterPanier");
 | 
			
		||||
   int res = 0;
 | 
			
		||||
   Commande.Parameters.Add("ID", SqlDbType.Int);
 | 
			
		||||
   Direction("ID", ParameterDirection.Output);
 | 
			
		||||
   Commande.Parameters.AddWithValue("@UserId", UserId);
 | 
			
		||||
   if(Nom == null) Commande.Parameters.AddWithValue("@Nom", Convert.DBNull);
 | 
			
		||||
   else Commande.Parameters.AddWithValue("@Nom", Nom);
 | 
			
		||||
   if(Status == null) Commande.Parameters.AddWithValue("@Status", Convert.DBNull);
 | 
			
		||||
   else Commande.Parameters.AddWithValue("@Status", Status);
 | 
			
		||||
   if(DateAchat == null) Commande.Parameters.AddWithValue("@DateAchat", Convert.DBNull);
 | 
			
		||||
   else Commande.Parameters.AddWithValue("@DateAchat", DateAchat);
 | 
			
		||||
   Commande.Parameters.AddWithValue("@Type", Type);
 | 
			
		||||
   Commande.Connection.Open();
 | 
			
		||||
   Commande.ExecuteNonQuery();
 | 
			
		||||
   res = int.Parse(LireParametre("ID"));
 | 
			
		||||
   Commande.Connection.Close();
 | 
			
		||||
   return res;
 | 
			
		||||
  }
 | 
			
		||||
  public int Modifier(int ID, int UserId, string Nom, int? Status, DateTime? DateAchat, int Type)
 | 
			
		||||
  {
 | 
			
		||||
   CreerCommande("ModifierPanier");
 | 
			
		||||
   int res = 0;
 | 
			
		||||
   Commande.Parameters.AddWithValue("@ID", ID);
 | 
			
		||||
   Commande.Parameters.AddWithValue("@UserId", UserId);
 | 
			
		||||
   if(Nom == null) Commande.Parameters.AddWithValue("@Nom", Convert.DBNull);
 | 
			
		||||
   else Commande.Parameters.AddWithValue("@Nom", Nom);
 | 
			
		||||
   if(Status == null) Commande.Parameters.AddWithValue("@Status", Convert.DBNull);
 | 
			
		||||
   else Commande.Parameters.AddWithValue("@Status", Status);
 | 
			
		||||
   if(DateAchat == null) Commande.Parameters.AddWithValue("@DateAchat", Convert.DBNull);
 | 
			
		||||
   else Commande.Parameters.AddWithValue("@DateAchat", DateAchat);
 | 
			
		||||
   Commande.Parameters.AddWithValue("@Type", Type);
 | 
			
		||||
   Commande.Connection.Open();
 | 
			
		||||
   Commande.ExecuteNonQuery();
 | 
			
		||||
   Commande.Connection.Close();
 | 
			
		||||
   return res;
 | 
			
		||||
  }
 | 
			
		||||
  public List<C_Panier> Lire(string Index)
 | 
			
		||||
  {
 | 
			
		||||
   CreerCommande("SelectionnerPanier");
 | 
			
		||||
   Commande.Parameters.AddWithValue("@Index", Index);
 | 
			
		||||
   Commande.Connection.Open();
 | 
			
		||||
   SqlDataReader dr = Commande.ExecuteReader();
 | 
			
		||||
   List<C_Panier> res = new List<C_Panier>();
 | 
			
		||||
   while (dr.Read())
 | 
			
		||||
   {
 | 
			
		||||
    C_Panier tmp = new C_Panier();
 | 
			
		||||
    tmp.ID = int.Parse(dr["ID"].ToString());
 | 
			
		||||
    tmp.UserId = int.Parse(dr["UserId"].ToString());
 | 
			
		||||
    tmp.Nom = dr["Nom"].ToString();
 | 
			
		||||
   if(dr["Status"] != DBNull.Value) tmp.Status = int.Parse(dr["Status"].ToString());
 | 
			
		||||
   if(dr["DateAchat"] != DBNull.Value) tmp.DateAchat = DateTime.Parse(dr["DateAchat"].ToString());
 | 
			
		||||
    tmp.Type = int.Parse(dr["Type"].ToString());
 | 
			
		||||
    res.Add(tmp);
 | 
			
		||||
			}
 | 
			
		||||
			dr.Close();
 | 
			
		||||
			Commande.Connection.Close();
 | 
			
		||||
			return res;
 | 
			
		||||
		}
 | 
			
		||||
  public C_Panier Lire_ID(int ID)
 | 
			
		||||
  {
 | 
			
		||||
   CreerCommande("SelectionnerPanier_ID");
 | 
			
		||||
   Commande.Parameters.AddWithValue("@ID", ID);
 | 
			
		||||
   Commande.Connection.Open();
 | 
			
		||||
   SqlDataReader dr = Commande.ExecuteReader();
 | 
			
		||||
   C_Panier res = new C_Panier();
 | 
			
		||||
   while (dr.Read())
 | 
			
		||||
   {
 | 
			
		||||
    res.ID = int.Parse(dr["ID"].ToString());
 | 
			
		||||
    res.UserId = int.Parse(dr["UserId"].ToString());
 | 
			
		||||
    res.Nom = dr["Nom"].ToString();
 | 
			
		||||
   if(dr["Status"] != DBNull.Value) res.Status = int.Parse(dr["Status"].ToString());
 | 
			
		||||
   if(dr["DateAchat"] != DBNull.Value) res.DateAchat = DateTime.Parse(dr["DateAchat"].ToString());
 | 
			
		||||
    res.Type = int.Parse(dr["Type"].ToString());
 | 
			
		||||
   }
 | 
			
		||||
			dr.Close();
 | 
			
		||||
			Commande.Connection.Close();
 | 
			
		||||
			return res;
 | 
			
		||||
		}
 | 
			
		||||
  public int Supprimer(int ID)
 | 
			
		||||
  {
 | 
			
		||||
   CreerCommande("SupprimerPanier");
 | 
			
		||||
   int res = 0;
 | 
			
		||||
   Commande.Parameters.AddWithValue("@ID", ID);
 | 
			
		||||
   Commande.Connection.Open();
 | 
			
		||||
   res = Commande.ExecuteNonQuery();
 | 
			
		||||
			Commande.Connection.Close();
 | 
			
		||||
			return res;
 | 
			
		||||
		}
 | 
			
		||||
 }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										130
									
								
								fivhier pata/A_Utilisateur.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										130
									
								
								fivhier pata/A_Utilisateur.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,130 @@
 | 
			
		||||
#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 Projet_GestionCommerceInfo.Classes;
 | 
			
		||||
#endregion
 | 
			
		||||
 | 
			
		||||
namespace Projet_GestionCommerceInfo.Acces
 | 
			
		||||
{
 | 
			
		||||
 /// <summary>
 | 
			
		||||
 /// Couche d'accès aux données (Data Access Layer)
 | 
			
		||||
 /// </summary>
 | 
			
		||||
 public class A_Utilisateur : ADBase
 | 
			
		||||
 {
 | 
			
		||||
  #region Constructeurs
 | 
			
		||||
  public A_Utilisateur(string sChaineConnexion)
 | 
			
		||||
  	: base(sChaineConnexion)
 | 
			
		||||
  { }
 | 
			
		||||
  #endregion
 | 
			
		||||
  public int Ajouter(string Nom, string Prenom, string Adresse, string NCompte, DateTime? DateDeNaisance, int type, bool Actif, string email)
 | 
			
		||||
  {
 | 
			
		||||
   CreerCommande("AjouterUtilisateur");
 | 
			
		||||
   int res = 0;
 | 
			
		||||
   Commande.Parameters.Add("ID", SqlDbType.Int);
 | 
			
		||||
   Direction("ID", ParameterDirection.Output);
 | 
			
		||||
   if(Nom == null) Commande.Parameters.AddWithValue("@Nom", Convert.DBNull);
 | 
			
		||||
   else Commande.Parameters.AddWithValue("@Nom", Nom);
 | 
			
		||||
   if(Prenom == null) Commande.Parameters.AddWithValue("@Prenom", Convert.DBNull);
 | 
			
		||||
   else Commande.Parameters.AddWithValue("@Prenom", Prenom);
 | 
			
		||||
   if(Adresse == null) Commande.Parameters.AddWithValue("@Adresse", Convert.DBNull);
 | 
			
		||||
   else Commande.Parameters.AddWithValue("@Adresse", Adresse);
 | 
			
		||||
   if(NCompte == null) Commande.Parameters.AddWithValue("@NCompte", Convert.DBNull);
 | 
			
		||||
   else Commande.Parameters.AddWithValue("@NCompte", NCompte);
 | 
			
		||||
   if(DateDeNaisance == null) Commande.Parameters.AddWithValue("@DateDeNaisance", Convert.DBNull);
 | 
			
		||||
   else Commande.Parameters.AddWithValue("@DateDeNaisance", DateDeNaisance);
 | 
			
		||||
   Commande.Parameters.AddWithValue("@type", type);
 | 
			
		||||
   Commande.Parameters.AddWithValue("@Actif", Actif);
 | 
			
		||||
   Commande.Parameters.AddWithValue("@email", email);
 | 
			
		||||
   Commande.Connection.Open();
 | 
			
		||||
   Commande.ExecuteNonQuery();
 | 
			
		||||
   res = int.Parse(LireParametre("ID"));
 | 
			
		||||
   Commande.Connection.Close();
 | 
			
		||||
   return res;
 | 
			
		||||
  }
 | 
			
		||||
  public int Modifier(int ID, string Nom, string Prenom, string Adresse, string NCompte, DateTime? DateDeNaisance, int type, bool Actif, string email)
 | 
			
		||||
  {
 | 
			
		||||
   CreerCommande("ModifierUtilisateur");
 | 
			
		||||
   int res = 0;
 | 
			
		||||
   Commande.Parameters.AddWithValue("@ID", ID);
 | 
			
		||||
   if(Nom == null) Commande.Parameters.AddWithValue("@Nom", Convert.DBNull);
 | 
			
		||||
   else Commande.Parameters.AddWithValue("@Nom", Nom);
 | 
			
		||||
   if(Prenom == null) Commande.Parameters.AddWithValue("@Prenom", Convert.DBNull);
 | 
			
		||||
   else Commande.Parameters.AddWithValue("@Prenom", Prenom);
 | 
			
		||||
   if(Adresse == null) Commande.Parameters.AddWithValue("@Adresse", Convert.DBNull);
 | 
			
		||||
   else Commande.Parameters.AddWithValue("@Adresse", Adresse);
 | 
			
		||||
   if(NCompte == null) Commande.Parameters.AddWithValue("@NCompte", Convert.DBNull);
 | 
			
		||||
   else Commande.Parameters.AddWithValue("@NCompte", NCompte);
 | 
			
		||||
   if(DateDeNaisance == null) Commande.Parameters.AddWithValue("@DateDeNaisance", Convert.DBNull);
 | 
			
		||||
   else Commande.Parameters.AddWithValue("@DateDeNaisance", DateDeNaisance);
 | 
			
		||||
   Commande.Parameters.AddWithValue("@type", type);
 | 
			
		||||
   Commande.Parameters.AddWithValue("@Actif", Actif);
 | 
			
		||||
   Commande.Parameters.AddWithValue("@email", email);
 | 
			
		||||
   Commande.Connection.Open();
 | 
			
		||||
   Commande.ExecuteNonQuery();
 | 
			
		||||
   Commande.Connection.Close();
 | 
			
		||||
   return res;
 | 
			
		||||
  }
 | 
			
		||||
  public List<C_Utilisateur> Lire(string Index)
 | 
			
		||||
  {
 | 
			
		||||
   CreerCommande("SelectionnerUtilisateur");
 | 
			
		||||
   Commande.Parameters.AddWithValue("@Index", Index);
 | 
			
		||||
   Commande.Connection.Open();
 | 
			
		||||
   SqlDataReader dr = Commande.ExecuteReader();
 | 
			
		||||
   List<C_Utilisateur> res = new List<C_Utilisateur>();
 | 
			
		||||
   while (dr.Read())
 | 
			
		||||
   {
 | 
			
		||||
    C_Utilisateur tmp = new C_Utilisateur();
 | 
			
		||||
    tmp.ID = int.Parse(dr["ID"].ToString());
 | 
			
		||||
    tmp.Nom = dr["Nom"].ToString();
 | 
			
		||||
    tmp.Prenom = dr["Prenom"].ToString();
 | 
			
		||||
    tmp.Adresse = dr["Adresse"].ToString();
 | 
			
		||||
    tmp.NCompte = dr["NCompte"].ToString();
 | 
			
		||||
   if(dr["DateDeNaisance"] != DBNull.Value) tmp.DateDeNaisance = DateTime.Parse(dr["DateDeNaisance"].ToString());
 | 
			
		||||
    tmp.type = int.Parse(dr["type"].ToString());
 | 
			
		||||
    tmp.Actif = bool.Parse(dr["Actif"].ToString());
 | 
			
		||||
    tmp.email = dr["email"].ToString();
 | 
			
		||||
    res.Add(tmp);
 | 
			
		||||
			}
 | 
			
		||||
			dr.Close();
 | 
			
		||||
			Commande.Connection.Close();
 | 
			
		||||
			return res;
 | 
			
		||||
		}
 | 
			
		||||
  public C_Utilisateur Lire_ID(int ID)
 | 
			
		||||
  {
 | 
			
		||||
   CreerCommande("SelectionnerUtilisateur_ID");
 | 
			
		||||
   Commande.Parameters.AddWithValue("@ID", ID);
 | 
			
		||||
   Commande.Connection.Open();
 | 
			
		||||
   SqlDataReader dr = Commande.ExecuteReader();
 | 
			
		||||
   C_Utilisateur res = new C_Utilisateur();
 | 
			
		||||
   while (dr.Read())
 | 
			
		||||
   {
 | 
			
		||||
    res.ID = int.Parse(dr["ID"].ToString());
 | 
			
		||||
    res.Nom = dr["Nom"].ToString();
 | 
			
		||||
    res.Prenom = dr["Prenom"].ToString();
 | 
			
		||||
    res.Adresse = dr["Adresse"].ToString();
 | 
			
		||||
    res.NCompte = dr["NCompte"].ToString();
 | 
			
		||||
   if(dr["DateDeNaisance"] != DBNull.Value) res.DateDeNaisance = DateTime.Parse(dr["DateDeNaisance"].ToString());
 | 
			
		||||
    res.type = int.Parse(dr["type"].ToString());
 | 
			
		||||
    res.Actif = bool.Parse(dr["Actif"].ToString());
 | 
			
		||||
    res.email = dr["email"].ToString();
 | 
			
		||||
   }
 | 
			
		||||
			dr.Close();
 | 
			
		||||
			Commande.Connection.Close();
 | 
			
		||||
			return res;
 | 
			
		||||
		}
 | 
			
		||||
  public int Supprimer(int ID)
 | 
			
		||||
  {
 | 
			
		||||
   CreerCommande("SupprimerUtilisateur");
 | 
			
		||||
   int res = 0;
 | 
			
		||||
   Commande.Parameters.AddWithValue("@ID", ID);
 | 
			
		||||
   Commande.Connection.Open();
 | 
			
		||||
   res = Commande.ExecuteNonQuery();
 | 
			
		||||
			Commande.Connection.Close();
 | 
			
		||||
			return res;
 | 
			
		||||
		}
 | 
			
		||||
 }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										72
									
								
								fivhier pata/C_Article.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										72
									
								
								fivhier pata/C_Article.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,72 @@
 | 
			
		||||
#region Ressources extérieures
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Text;
 | 
			
		||||
#endregion
 | 
			
		||||
 | 
			
		||||
namespace Projet_GestionCommerceInfo.Classes
 | 
			
		||||
{
 | 
			
		||||
 /// <summary>
 | 
			
		||||
 /// Classe de définition des données
 | 
			
		||||
 /// </summary>
 | 
			
		||||
 public class C_Article
 | 
			
		||||
 {
 | 
			
		||||
  #region Données membres
 | 
			
		||||
  private int _ID;
 | 
			
		||||
  private string _Designation;
 | 
			
		||||
  private int _Stock;
 | 
			
		||||
  private bool _Visible;
 | 
			
		||||
  private bool _Actif;
 | 
			
		||||
  private decimal? _PrixHTVA;
 | 
			
		||||
  #endregion
 | 
			
		||||
  #region Constructeurs
 | 
			
		||||
  public C_Article()
 | 
			
		||||
  { }
 | 
			
		||||
  public C_Article(string Designation_, int Stock_, bool Visible_, bool Actif_, decimal? PrixHTVA_)
 | 
			
		||||
  {
 | 
			
		||||
   Designation = Designation_;
 | 
			
		||||
   Stock = Stock_;
 | 
			
		||||
   Visible = Visible_;
 | 
			
		||||
   Actif = Actif_;
 | 
			
		||||
   PrixHTVA = PrixHTVA_;
 | 
			
		||||
  }
 | 
			
		||||
  public C_Article(int ID_, string Designation_, int Stock_, bool Visible_, bool Actif_, decimal? PrixHTVA_)
 | 
			
		||||
   : this(Designation_, Stock_, Visible_, Actif_, PrixHTVA_)
 | 
			
		||||
  {
 | 
			
		||||
   ID = ID_;
 | 
			
		||||
  }
 | 
			
		||||
  #endregion
 | 
			
		||||
  #region Accesseurs
 | 
			
		||||
  public int ID
 | 
			
		||||
  {
 | 
			
		||||
   get { return _ID; }
 | 
			
		||||
   set { _ID = value; }
 | 
			
		||||
  }
 | 
			
		||||
  public string Designation
 | 
			
		||||
  {
 | 
			
		||||
   get { return _Designation; }
 | 
			
		||||
   set { _Designation = value; }
 | 
			
		||||
  }
 | 
			
		||||
  public int Stock
 | 
			
		||||
  {
 | 
			
		||||
   get { return _Stock; }
 | 
			
		||||
   set { _Stock = value; }
 | 
			
		||||
  }
 | 
			
		||||
  public bool Visible
 | 
			
		||||
  {
 | 
			
		||||
   get { return _Visible; }
 | 
			
		||||
   set { _Visible = value; }
 | 
			
		||||
  }
 | 
			
		||||
  public bool Actif
 | 
			
		||||
  {
 | 
			
		||||
   get { return _Actif; }
 | 
			
		||||
   set { _Actif = value; }
 | 
			
		||||
  }
 | 
			
		||||
  public decimal? PrixHTVA
 | 
			
		||||
  {
 | 
			
		||||
   get { return _PrixHTVA; }
 | 
			
		||||
   set { _PrixHTVA = value; }
 | 
			
		||||
  }
 | 
			
		||||
  #endregion
 | 
			
		||||
 }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										72
									
								
								fivhier pata/C_LSTArticle.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										72
									
								
								fivhier pata/C_LSTArticle.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,72 @@
 | 
			
		||||
#region Ressources extérieures
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Text;
 | 
			
		||||
#endregion
 | 
			
		||||
 | 
			
		||||
namespace Projet_GestionCommerceInfo.Classes
 | 
			
		||||
{
 | 
			
		||||
 /// <summary>
 | 
			
		||||
 /// Classe de définition des données
 | 
			
		||||
 /// </summary>
 | 
			
		||||
 public class C_LSTArticle
 | 
			
		||||
 {
 | 
			
		||||
  #region Données membres
 | 
			
		||||
  private int _ID;
 | 
			
		||||
  private int _PanierID;
 | 
			
		||||
  private int _ArticleID;
 | 
			
		||||
  private int _Quantite;
 | 
			
		||||
  private decimal? _PrixHTVA;
 | 
			
		||||
  private int? _TVA;
 | 
			
		||||
  #endregion
 | 
			
		||||
  #region Constructeurs
 | 
			
		||||
  public C_LSTArticle()
 | 
			
		||||
  { }
 | 
			
		||||
  public C_LSTArticle(int PanierID_, int ArticleID_, int Quantite_, decimal? PrixHTVA_, int? TVA_)
 | 
			
		||||
  {
 | 
			
		||||
   PanierID = PanierID_;
 | 
			
		||||
   ArticleID = ArticleID_;
 | 
			
		||||
   Quantite = Quantite_;
 | 
			
		||||
   PrixHTVA = PrixHTVA_;
 | 
			
		||||
   TVA = TVA_;
 | 
			
		||||
  }
 | 
			
		||||
  public C_LSTArticle(int ID_, int PanierID_, int ArticleID_, int Quantite_, decimal? PrixHTVA_, int? TVA_)
 | 
			
		||||
   : this(PanierID_, ArticleID_, Quantite_, PrixHTVA_, TVA_)
 | 
			
		||||
  {
 | 
			
		||||
   ID = ID_;
 | 
			
		||||
  }
 | 
			
		||||
  #endregion
 | 
			
		||||
  #region Accesseurs
 | 
			
		||||
  public int ID
 | 
			
		||||
  {
 | 
			
		||||
   get { return _ID; }
 | 
			
		||||
   set { _ID = value; }
 | 
			
		||||
  }
 | 
			
		||||
  public int PanierID
 | 
			
		||||
  {
 | 
			
		||||
   get { return _PanierID; }
 | 
			
		||||
   set { _PanierID = value; }
 | 
			
		||||
  }
 | 
			
		||||
  public int ArticleID
 | 
			
		||||
  {
 | 
			
		||||
   get { return _ArticleID; }
 | 
			
		||||
   set { _ArticleID = value; }
 | 
			
		||||
  }
 | 
			
		||||
  public int Quantite
 | 
			
		||||
  {
 | 
			
		||||
   get { return _Quantite; }
 | 
			
		||||
   set { _Quantite = value; }
 | 
			
		||||
  }
 | 
			
		||||
  public decimal? PrixHTVA
 | 
			
		||||
  {
 | 
			
		||||
   get { return _PrixHTVA; }
 | 
			
		||||
   set { _PrixHTVA = value; }
 | 
			
		||||
  }
 | 
			
		||||
  public int? TVA
 | 
			
		||||
  {
 | 
			
		||||
   get { return _TVA; }
 | 
			
		||||
   set { _TVA = value; }
 | 
			
		||||
  }
 | 
			
		||||
  #endregion
 | 
			
		||||
 }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										72
									
								
								fivhier pata/C_Panier.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										72
									
								
								fivhier pata/C_Panier.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,72 @@
 | 
			
		||||
#region Ressources extérieures
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Text;
 | 
			
		||||
#endregion
 | 
			
		||||
 | 
			
		||||
namespace Projet_GestionCommerceInfo.Classes
 | 
			
		||||
{
 | 
			
		||||
 /// <summary>
 | 
			
		||||
 /// Classe de définition des données
 | 
			
		||||
 /// </summary>
 | 
			
		||||
 public class C_Panier
 | 
			
		||||
 {
 | 
			
		||||
  #region Données membres
 | 
			
		||||
  private int _ID;
 | 
			
		||||
  private int _UserId;
 | 
			
		||||
  private string _Nom;
 | 
			
		||||
  private int? _Status;
 | 
			
		||||
  private DateTime? _DateAchat;
 | 
			
		||||
  private int _Type;
 | 
			
		||||
  #endregion
 | 
			
		||||
  #region Constructeurs
 | 
			
		||||
  public C_Panier()
 | 
			
		||||
  { }
 | 
			
		||||
  public C_Panier(int UserId_, string Nom_, int? Status_, DateTime? DateAchat_, int Type_)
 | 
			
		||||
  {
 | 
			
		||||
   UserId = UserId_;
 | 
			
		||||
   Nom = Nom_;
 | 
			
		||||
   Status = Status_;
 | 
			
		||||
   DateAchat = DateAchat_;
 | 
			
		||||
   Type = Type_;
 | 
			
		||||
  }
 | 
			
		||||
  public C_Panier(int ID_, int UserId_, string Nom_, int? Status_, DateTime? DateAchat_, int Type_)
 | 
			
		||||
   : this(UserId_, Nom_, Status_, DateAchat_, Type_)
 | 
			
		||||
  {
 | 
			
		||||
   ID = ID_;
 | 
			
		||||
  }
 | 
			
		||||
  #endregion
 | 
			
		||||
  #region Accesseurs
 | 
			
		||||
  public int ID
 | 
			
		||||
  {
 | 
			
		||||
   get { return _ID; }
 | 
			
		||||
   set { _ID = value; }
 | 
			
		||||
  }
 | 
			
		||||
  public int UserId
 | 
			
		||||
  {
 | 
			
		||||
   get { return _UserId; }
 | 
			
		||||
   set { _UserId = value; }
 | 
			
		||||
  }
 | 
			
		||||
  public string Nom
 | 
			
		||||
  {
 | 
			
		||||
   get { return _Nom; }
 | 
			
		||||
   set { _Nom = value; }
 | 
			
		||||
  }
 | 
			
		||||
  public int? Status
 | 
			
		||||
  {
 | 
			
		||||
   get { return _Status; }
 | 
			
		||||
   set { _Status = value; }
 | 
			
		||||
  }
 | 
			
		||||
  public DateTime? DateAchat
 | 
			
		||||
  {
 | 
			
		||||
   get { return _DateAchat; }
 | 
			
		||||
   set { _DateAchat = value; }
 | 
			
		||||
  }
 | 
			
		||||
  public int Type
 | 
			
		||||
  {
 | 
			
		||||
   get { return _Type; }
 | 
			
		||||
   set { _Type = value; }
 | 
			
		||||
  }
 | 
			
		||||
  #endregion
 | 
			
		||||
 }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										93
									
								
								fivhier pata/C_Utilisateur.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										93
									
								
								fivhier pata/C_Utilisateur.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,93 @@
 | 
			
		||||
#region Ressources extérieures
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Text;
 | 
			
		||||
#endregion
 | 
			
		||||
 | 
			
		||||
namespace Projet_GestionCommerceInfo.Classes
 | 
			
		||||
{
 | 
			
		||||
 /// <summary>
 | 
			
		||||
 /// Classe de définition des données
 | 
			
		||||
 /// </summary>
 | 
			
		||||
 public class C_Utilisateur
 | 
			
		||||
 {
 | 
			
		||||
  #region Données membres
 | 
			
		||||
  private int _ID;
 | 
			
		||||
  private string _Nom;
 | 
			
		||||
  private string _Prenom;
 | 
			
		||||
  private string _Adresse;
 | 
			
		||||
  private string _NCompte;
 | 
			
		||||
  private DateTime? _DateDeNaisance;
 | 
			
		||||
  private int _type;
 | 
			
		||||
  private bool _Actif;
 | 
			
		||||
  private string _email;
 | 
			
		||||
  #endregion
 | 
			
		||||
  #region Constructeurs
 | 
			
		||||
  public C_Utilisateur()
 | 
			
		||||
  { }
 | 
			
		||||
  public C_Utilisateur(string Nom_, string Prenom_, string Adresse_, string NCompte_, DateTime? DateDeNaisance_, int type_, bool Actif_, string email_)
 | 
			
		||||
  {
 | 
			
		||||
   Nom = Nom_;
 | 
			
		||||
   Prenom = Prenom_;
 | 
			
		||||
   Adresse = Adresse_;
 | 
			
		||||
   NCompte = NCompte_;
 | 
			
		||||
   DateDeNaisance = DateDeNaisance_;
 | 
			
		||||
   type = type_;
 | 
			
		||||
   Actif = Actif_;
 | 
			
		||||
   email = email_;
 | 
			
		||||
  }
 | 
			
		||||
  public C_Utilisateur(int ID_, string Nom_, string Prenom_, string Adresse_, string NCompte_, DateTime? DateDeNaisance_, int type_, bool Actif_, string email_)
 | 
			
		||||
   : this(Nom_, Prenom_, Adresse_, NCompte_, DateDeNaisance_, type_, Actif_, email_)
 | 
			
		||||
  {
 | 
			
		||||
   ID = ID_;
 | 
			
		||||
  }
 | 
			
		||||
  #endregion
 | 
			
		||||
  #region Accesseurs
 | 
			
		||||
  public int ID
 | 
			
		||||
  {
 | 
			
		||||
   get { return _ID; }
 | 
			
		||||
   set { _ID = value; }
 | 
			
		||||
  }
 | 
			
		||||
  public string Nom
 | 
			
		||||
  {
 | 
			
		||||
   get { return _Nom; }
 | 
			
		||||
   set { _Nom = value; }
 | 
			
		||||
  }
 | 
			
		||||
  public string Prenom
 | 
			
		||||
  {
 | 
			
		||||
   get { return _Prenom; }
 | 
			
		||||
   set { _Prenom = value; }
 | 
			
		||||
  }
 | 
			
		||||
  public string Adresse
 | 
			
		||||
  {
 | 
			
		||||
   get { return _Adresse; }
 | 
			
		||||
   set { _Adresse = value; }
 | 
			
		||||
  }
 | 
			
		||||
  public string NCompte
 | 
			
		||||
  {
 | 
			
		||||
   get { return _NCompte; }
 | 
			
		||||
   set { _NCompte = value; }
 | 
			
		||||
  }
 | 
			
		||||
  public DateTime? DateDeNaisance
 | 
			
		||||
  {
 | 
			
		||||
   get { return _DateDeNaisance; }
 | 
			
		||||
   set { _DateDeNaisance = value; }
 | 
			
		||||
  }
 | 
			
		||||
  public int type
 | 
			
		||||
  {
 | 
			
		||||
   get { return _type; }
 | 
			
		||||
   set { _type = value; }
 | 
			
		||||
  }
 | 
			
		||||
  public bool Actif
 | 
			
		||||
  {
 | 
			
		||||
   get { return _Actif; }
 | 
			
		||||
   set { _Actif = value; }
 | 
			
		||||
  }
 | 
			
		||||
  public string email
 | 
			
		||||
  {
 | 
			
		||||
   get { return _email; }
 | 
			
		||||
   set { _email = value; }
 | 
			
		||||
  }
 | 
			
		||||
  #endregion
 | 
			
		||||
 }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										35
									
								
								fivhier pata/G_Article.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								fivhier pata/G_Article.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,35 @@
 | 
			
		||||
#region Ressources extérieures
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using Projet_GestionCommerceInfo.Classes;
 | 
			
		||||
using Projet_GestionCommerceInfo.Acces;
 | 
			
		||||
#endregion
 | 
			
		||||
 | 
			
		||||
namespace Projet_GestionCommerceInfo.Gestion
 | 
			
		||||
{
 | 
			
		||||
 /// <summary>
 | 
			
		||||
 /// Couche intermédiaire de gestion (Business Layer)
 | 
			
		||||
 /// </summary>
 | 
			
		||||
 public class G_Article : G_Base
 | 
			
		||||
 {
 | 
			
		||||
  #region Constructeurs
 | 
			
		||||
  public G_Article()
 | 
			
		||||
   : base()
 | 
			
		||||
  { }
 | 
			
		||||
  public G_Article(string sChaineConnexion)
 | 
			
		||||
   : base(sChaineConnexion)
 | 
			
		||||
  { }
 | 
			
		||||
  #endregion
 | 
			
		||||
  public int Ajouter(string Designation, int Stock, bool Visible, bool Actif, decimal? PrixHTVA)
 | 
			
		||||
  { return new A_Article(ChaineConnexion).Ajouter(Designation, Stock, Visible, Actif, PrixHTVA); }
 | 
			
		||||
  public int Modifier(int ID, string Designation, int Stock, bool Visible, bool Actif, decimal? PrixHTVA)
 | 
			
		||||
  { return new A_Article(ChaineConnexion).Modifier(ID, Designation, Stock, Visible, Actif, PrixHTVA); }
 | 
			
		||||
  public List<C_Article> Lire(string Index)
 | 
			
		||||
  { return new A_Article(ChaineConnexion).Lire(Index); }
 | 
			
		||||
  public C_Article Lire_ID(int ID)
 | 
			
		||||
  { return new A_Article(ChaineConnexion).Lire_ID(ID); }
 | 
			
		||||
  public int Supprimer(int ID)
 | 
			
		||||
  { return new A_Article(ChaineConnexion).Supprimer(ID); }
 | 
			
		||||
 }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										28
									
								
								fivhier pata/G_Base.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								fivhier pata/G_Base.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,28 @@
 | 
			
		||||
#region Ressources extérieures
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Text;
 | 
			
		||||
#endregion
 | 
			
		||||
 | 
			
		||||
namespace Projet_GestionCommerceInfo.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
 | 
			
		||||
 }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										35
									
								
								fivhier pata/G_LSTArticle.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								fivhier pata/G_LSTArticle.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,35 @@
 | 
			
		||||
#region Ressources extérieures
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using Projet_GestionCommerceInfo.Classes;
 | 
			
		||||
using Projet_GestionCommerceInfo.Acces;
 | 
			
		||||
#endregion
 | 
			
		||||
 | 
			
		||||
namespace Projet_GestionCommerceInfo.Gestion
 | 
			
		||||
{
 | 
			
		||||
 /// <summary>
 | 
			
		||||
 /// Couche intermédiaire de gestion (Business Layer)
 | 
			
		||||
 /// </summary>
 | 
			
		||||
 public class G_LSTArticle : G_Base
 | 
			
		||||
 {
 | 
			
		||||
  #region Constructeurs
 | 
			
		||||
  public G_LSTArticle()
 | 
			
		||||
   : base()
 | 
			
		||||
  { }
 | 
			
		||||
  public G_LSTArticle(string sChaineConnexion)
 | 
			
		||||
   : base(sChaineConnexion)
 | 
			
		||||
  { }
 | 
			
		||||
  #endregion
 | 
			
		||||
  public int Ajouter(int PanierID, int ArticleID, int Quantite, decimal? PrixHTVA, int? TVA)
 | 
			
		||||
  { return new A_LSTArticle(ChaineConnexion).Ajouter(PanierID, ArticleID, Quantite, PrixHTVA, TVA); }
 | 
			
		||||
  public int Modifier(int ID, int PanierID, int ArticleID, int Quantite, decimal? PrixHTVA, int? TVA)
 | 
			
		||||
  { return new A_LSTArticle(ChaineConnexion).Modifier(ID, PanierID, ArticleID, Quantite, PrixHTVA, TVA); }
 | 
			
		||||
  public List<C_LSTArticle> Lire(string Index)
 | 
			
		||||
  { return new A_LSTArticle(ChaineConnexion).Lire(Index); }
 | 
			
		||||
  public C_LSTArticle Lire_ID(int ID)
 | 
			
		||||
  { return new A_LSTArticle(ChaineConnexion).Lire_ID(ID); }
 | 
			
		||||
  public int Supprimer(int ID)
 | 
			
		||||
  { return new A_LSTArticle(ChaineConnexion).Supprimer(ID); }
 | 
			
		||||
 }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										35
									
								
								fivhier pata/G_Panier.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								fivhier pata/G_Panier.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,35 @@
 | 
			
		||||
#region Ressources extérieures
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using Projet_GestionCommerceInfo.Classes;
 | 
			
		||||
using Projet_GestionCommerceInfo.Acces;
 | 
			
		||||
#endregion
 | 
			
		||||
 | 
			
		||||
namespace Projet_GestionCommerceInfo.Gestion
 | 
			
		||||
{
 | 
			
		||||
 /// <summary>
 | 
			
		||||
 /// Couche intermédiaire de gestion (Business Layer)
 | 
			
		||||
 /// </summary>
 | 
			
		||||
 public class G_Panier : G_Base
 | 
			
		||||
 {
 | 
			
		||||
  #region Constructeurs
 | 
			
		||||
  public G_Panier()
 | 
			
		||||
   : base()
 | 
			
		||||
  { }
 | 
			
		||||
  public G_Panier(string sChaineConnexion)
 | 
			
		||||
   : base(sChaineConnexion)
 | 
			
		||||
  { }
 | 
			
		||||
  #endregion
 | 
			
		||||
  public int Ajouter(int UserId, string Nom, int? Status, DateTime? DateAchat, int Type)
 | 
			
		||||
  { return new A_Panier(ChaineConnexion).Ajouter(UserId, Nom, Status, DateAchat, Type); }
 | 
			
		||||
  public int Modifier(int ID, int UserId, string Nom, int? Status, DateTime? DateAchat, int Type)
 | 
			
		||||
  { return new A_Panier(ChaineConnexion).Modifier(ID, UserId, Nom, Status, DateAchat, Type); }
 | 
			
		||||
  public List<C_Panier> Lire(string Index)
 | 
			
		||||
  { return new A_Panier(ChaineConnexion).Lire(Index); }
 | 
			
		||||
  public C_Panier Lire_ID(int ID)
 | 
			
		||||
  { return new A_Panier(ChaineConnexion).Lire_ID(ID); }
 | 
			
		||||
  public int Supprimer(int ID)
 | 
			
		||||
  { return new A_Panier(ChaineConnexion).Supprimer(ID); }
 | 
			
		||||
 }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										35
									
								
								fivhier pata/G_Utilisateur.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								fivhier pata/G_Utilisateur.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,35 @@
 | 
			
		||||
#region Ressources extérieures
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using Projet_GestionCommerceInfo.Classes;
 | 
			
		||||
using Projet_GestionCommerceInfo.Acces;
 | 
			
		||||
#endregion
 | 
			
		||||
 | 
			
		||||
namespace Projet_GestionCommerceInfo.Gestion
 | 
			
		||||
{
 | 
			
		||||
 /// <summary>
 | 
			
		||||
 /// Couche intermédiaire de gestion (Business Layer)
 | 
			
		||||
 /// </summary>
 | 
			
		||||
 public class G_Utilisateur : G_Base
 | 
			
		||||
 {
 | 
			
		||||
  #region Constructeurs
 | 
			
		||||
  public G_Utilisateur()
 | 
			
		||||
   : base()
 | 
			
		||||
  { }
 | 
			
		||||
  public G_Utilisateur(string sChaineConnexion)
 | 
			
		||||
   : base(sChaineConnexion)
 | 
			
		||||
  { }
 | 
			
		||||
  #endregion
 | 
			
		||||
  public int Ajouter(string Nom, string Prenom, string Adresse, string NCompte, DateTime? DateDeNaisance, int type, bool Actif, string email)
 | 
			
		||||
  { return new A_Utilisateur(ChaineConnexion).Ajouter(Nom, Prenom, Adresse, NCompte, DateDeNaisance, type, Actif, email); }
 | 
			
		||||
  public int Modifier(int ID, string Nom, string Prenom, string Adresse, string NCompte, DateTime? DateDeNaisance, int type, bool Actif, string email)
 | 
			
		||||
  { return new A_Utilisateur(ChaineConnexion).Modifier(ID, Nom, Prenom, Adresse, NCompte, DateDeNaisance, type, Actif, email); }
 | 
			
		||||
  public List<C_Utilisateur> Lire(string Index)
 | 
			
		||||
  { return new A_Utilisateur(ChaineConnexion).Lire(Index); }
 | 
			
		||||
  public C_Utilisateur Lire_ID(int ID)
 | 
			
		||||
  { return new A_Utilisateur(ChaineConnexion).Lire_ID(ID); }
 | 
			
		||||
  public int Supprimer(int ID)
 | 
			
		||||
  { return new A_Utilisateur(ChaineConnexion).Supprimer(ID); }
 | 
			
		||||
 }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										59
									
								
								fivhier pata/P_Article.sql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										59
									
								
								fivhier pata/P_Article.sql
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,59 @@
 | 
			
		||||
CREATE PROCEDURE AjouterArticle
 | 
			
		||||
 @ID int OUTPUT,
 | 
			
		||||
 @Designation varchar(50),
 | 
			
		||||
 @Stock int,
 | 
			
		||||
 @Visible bit,
 | 
			
		||||
 @Actif bit,
 | 
			
		||||
 @PrixHTVA money
 | 
			
		||||
AS
 | 
			
		||||
 INSERT INTO Article(Designation,Stock,Visible,Actif,PrixHTVA)
 | 
			
		||||
  VALUES(@Designation,@Stock,@Visible,@Actif,@PrixHTVA)
 | 
			
		||||
 SET @ID=@@IDENTITY
 | 
			
		||||
RETURN
 | 
			
		||||
GO
 | 
			
		||||
CREATE PROCEDURE ModifierArticle
 | 
			
		||||
 @ID int,
 | 
			
		||||
 @Designation varchar(50),
 | 
			
		||||
 @Stock int,
 | 
			
		||||
 @Visible bit,
 | 
			
		||||
 @Actif bit,
 | 
			
		||||
 @PrixHTVA money
 | 
			
		||||
AS
 | 
			
		||||
 IF(@ID IS NULL OR @ID=0)
 | 
			
		||||
  RAISERROR('Identifiant requis !',16,1)
 | 
			
		||||
 ELSE  UPDATE Article
 | 
			
		||||
        SET Designation=@Designation,Stock=@Stock,Visible=@Visible,Actif=@Actif,PrixHTVA=@PrixHTVA
 | 
			
		||||
        WHERE ID=@ID
 | 
			
		||||
RETURN
 | 
			
		||||
GO
 | 
			
		||||
CREATE PROCEDURE SelectionnerArticle
 | 
			
		||||
 @Index VARCHAR(10)
 | 
			
		||||
AS
 | 
			
		||||
 IF(@Index='Designation') SELECT * FROM Article ORDER BY Designation
 | 
			
		||||
 ELSE IF(@Index='Stock') SELECT * FROM Article ORDER BY Stock
 | 
			
		||||
 ELSE IF(@Index='Visible') SELECT * FROM Article ORDER BY Visible
 | 
			
		||||
 ELSE IF(@Index='Actif') SELECT * FROM Article ORDER BY Actif
 | 
			
		||||
 ELSE IF(@Index='PrixHTVA') SELECT * FROM Article ORDER BY PrixHTVA
 | 
			
		||||
 ELSE SELECT * FROM Article ORDER BY ID
 | 
			
		||||
RETURN
 | 
			
		||||
GO
 | 
			
		||||
CREATE PROCEDURE SelectionnerArticle_ID
 | 
			
		||||
 @ID int
 | 
			
		||||
AS
 | 
			
		||||
 IF(@ID IS NULL)
 | 
			
		||||
  RAISERROR('Identifiant requis !',16,1)
 | 
			
		||||
 ELSE
 | 
			
		||||
  SELECT ID,Designation,Stock,Visible,Actif,PrixHTVA
 | 
			
		||||
  FROM Article
 | 
			
		||||
  WHERE @ID=ID
 | 
			
		||||
RETURN
 | 
			
		||||
GO
 | 
			
		||||
CREATE PROCEDURE SupprimerArticle
 | 
			
		||||
 @ID int
 | 
			
		||||
AS
 | 
			
		||||
 IF(@ID IS NULL)
 | 
			
		||||
  RAISERROR('Identifiant requis !',16,1)
 | 
			
		||||
 ELSE
 | 
			
		||||
  DELETE FROM Article WHERE @ID=ID
 | 
			
		||||
RETURN
 | 
			
		||||
GO
 | 
			
		||||
							
								
								
									
										59
									
								
								fivhier pata/P_LSTArticle.sql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										59
									
								
								fivhier pata/P_LSTArticle.sql
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,59 @@
 | 
			
		||||
CREATE PROCEDURE AjouterLSTArticle
 | 
			
		||||
 @ID int OUTPUT,
 | 
			
		||||
 @PanierID int,
 | 
			
		||||
 @ArticleID int,
 | 
			
		||||
 @Quantite int,
 | 
			
		||||
 @PrixHTVA money,
 | 
			
		||||
 @TVA int
 | 
			
		||||
AS
 | 
			
		||||
 INSERT INTO LSTArticle(PanierID,ArticleID,Quantite,PrixHTVA,TVA)
 | 
			
		||||
  VALUES(@PanierID,@ArticleID,@Quantite,@PrixHTVA,@TVA)
 | 
			
		||||
 SET @ID=@@IDENTITY
 | 
			
		||||
RETURN
 | 
			
		||||
GO
 | 
			
		||||
CREATE PROCEDURE ModifierLSTArticle
 | 
			
		||||
 @ID int,
 | 
			
		||||
 @PanierID int,
 | 
			
		||||
 @ArticleID int,
 | 
			
		||||
 @Quantite int,
 | 
			
		||||
 @PrixHTVA money,
 | 
			
		||||
 @TVA int
 | 
			
		||||
AS
 | 
			
		||||
 IF(@ID IS NULL OR @ID=0)
 | 
			
		||||
  RAISERROR('Identifiant requis !',16,1)
 | 
			
		||||
 ELSE  UPDATE LSTArticle
 | 
			
		||||
        SET PanierID=@PanierID,ArticleID=@ArticleID,Quantite=@Quantite,PrixHTVA=@PrixHTVA,TVA=@TVA
 | 
			
		||||
        WHERE ID=@ID
 | 
			
		||||
RETURN
 | 
			
		||||
GO
 | 
			
		||||
CREATE PROCEDURE SelectionnerLSTArticle
 | 
			
		||||
 @Index VARCHAR(10)
 | 
			
		||||
AS
 | 
			
		||||
 IF(@Index='PanierID') SELECT * FROM LSTArticle ORDER BY PanierID
 | 
			
		||||
 ELSE IF(@Index='ArticleID') SELECT * FROM LSTArticle ORDER BY ArticleID
 | 
			
		||||
 ELSE IF(@Index='Quantite') SELECT * FROM LSTArticle ORDER BY Quantite
 | 
			
		||||
 ELSE IF(@Index='PrixHTVA') SELECT * FROM LSTArticle ORDER BY PrixHTVA
 | 
			
		||||
 ELSE IF(@Index='TVA') SELECT * FROM LSTArticle ORDER BY TVA
 | 
			
		||||
 ELSE SELECT * FROM LSTArticle ORDER BY ID
 | 
			
		||||
RETURN
 | 
			
		||||
GO
 | 
			
		||||
CREATE PROCEDURE SelectionnerLSTArticle_ID
 | 
			
		||||
 @ID int
 | 
			
		||||
AS
 | 
			
		||||
 IF(@ID IS NULL)
 | 
			
		||||
  RAISERROR('Identifiant requis !',16,1)
 | 
			
		||||
 ELSE
 | 
			
		||||
  SELECT ID,PanierID,ArticleID,Quantite,PrixHTVA,TVA
 | 
			
		||||
  FROM LSTArticle
 | 
			
		||||
  WHERE @ID=ID
 | 
			
		||||
RETURN
 | 
			
		||||
GO
 | 
			
		||||
CREATE PROCEDURE SupprimerLSTArticle
 | 
			
		||||
 @ID int
 | 
			
		||||
AS
 | 
			
		||||
 IF(@ID IS NULL)
 | 
			
		||||
  RAISERROR('Identifiant requis !',16,1)
 | 
			
		||||
 ELSE
 | 
			
		||||
  DELETE FROM LSTArticle WHERE @ID=ID
 | 
			
		||||
RETURN
 | 
			
		||||
GO
 | 
			
		||||
							
								
								
									
										59
									
								
								fivhier pata/P_Panier.sql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										59
									
								
								fivhier pata/P_Panier.sql
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,59 @@
 | 
			
		||||
CREATE PROCEDURE AjouterPanier
 | 
			
		||||
 @ID int OUTPUT,
 | 
			
		||||
 @UserId int,
 | 
			
		||||
 @Nom varchar(50),
 | 
			
		||||
 @Status int,
 | 
			
		||||
 @DateAchat datetime,
 | 
			
		||||
 @Type int
 | 
			
		||||
AS
 | 
			
		||||
 INSERT INTO Panier(UserId,Nom,Status,DateAchat,Type)
 | 
			
		||||
  VALUES(@UserId,@Nom,@Status,@DateAchat,@Type)
 | 
			
		||||
 SET @ID=@@IDENTITY
 | 
			
		||||
RETURN
 | 
			
		||||
GO
 | 
			
		||||
CREATE PROCEDURE ModifierPanier
 | 
			
		||||
 @ID int,
 | 
			
		||||
 @UserId int,
 | 
			
		||||
 @Nom varchar(50),
 | 
			
		||||
 @Status int,
 | 
			
		||||
 @DateAchat datetime,
 | 
			
		||||
 @Type int
 | 
			
		||||
AS
 | 
			
		||||
 IF(@ID IS NULL OR @ID=0)
 | 
			
		||||
  RAISERROR('Identifiant requis !',16,1)
 | 
			
		||||
 ELSE  UPDATE Panier
 | 
			
		||||
        SET UserId=@UserId,Nom=@Nom,Status=@Status,DateAchat=@DateAchat,Type=@Type
 | 
			
		||||
        WHERE ID=@ID
 | 
			
		||||
RETURN
 | 
			
		||||
GO
 | 
			
		||||
CREATE PROCEDURE SelectionnerPanier
 | 
			
		||||
 @Index VARCHAR(10)
 | 
			
		||||
AS
 | 
			
		||||
 IF(@Index='UserId') SELECT * FROM Panier ORDER BY UserId
 | 
			
		||||
 ELSE IF(@Index='Nom') SELECT * FROM Panier ORDER BY Nom
 | 
			
		||||
 ELSE IF(@Index='Status') SELECT * FROM Panier ORDER BY Status
 | 
			
		||||
 ELSE IF(@Index='DateAchat') SELECT * FROM Panier ORDER BY DateAchat
 | 
			
		||||
 ELSE IF(@Index='Type') SELECT * FROM Panier ORDER BY Type
 | 
			
		||||
 ELSE SELECT * FROM Panier ORDER BY ID
 | 
			
		||||
RETURN
 | 
			
		||||
GO
 | 
			
		||||
CREATE PROCEDURE SelectionnerPanier_ID
 | 
			
		||||
 @ID int
 | 
			
		||||
AS
 | 
			
		||||
 IF(@ID IS NULL)
 | 
			
		||||
  RAISERROR('Identifiant requis !',16,1)
 | 
			
		||||
 ELSE
 | 
			
		||||
  SELECT ID,UserId,Nom,Status,DateAchat,Type
 | 
			
		||||
  FROM Panier
 | 
			
		||||
  WHERE @ID=ID
 | 
			
		||||
RETURN
 | 
			
		||||
GO
 | 
			
		||||
CREATE PROCEDURE SupprimerPanier
 | 
			
		||||
 @ID int
 | 
			
		||||
AS
 | 
			
		||||
 IF(@ID IS NULL)
 | 
			
		||||
  RAISERROR('Identifiant requis !',16,1)
 | 
			
		||||
 ELSE
 | 
			
		||||
  DELETE FROM Panier WHERE @ID=ID
 | 
			
		||||
RETURN
 | 
			
		||||
GO
 | 
			
		||||
							
								
								
									
										68
									
								
								fivhier pata/P_Utilisateur.sql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										68
									
								
								fivhier pata/P_Utilisateur.sql
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,68 @@
 | 
			
		||||
CREATE PROCEDURE AjouterUtilisateur
 | 
			
		||||
 @ID int OUTPUT,
 | 
			
		||||
 @Nom varchar(50),
 | 
			
		||||
 @Prenom varchar(50),
 | 
			
		||||
 @Adresse varchar(50),
 | 
			
		||||
 @NCompte varchar(50),
 | 
			
		||||
 @DateDeNaisance datetime,
 | 
			
		||||
 @type int,
 | 
			
		||||
 @Actif bit,
 | 
			
		||||
 @email varchar(50)
 | 
			
		||||
AS
 | 
			
		||||
 INSERT INTO Utilisateur(Nom,Prenom,Adresse,NCompte,DateDeNaisance,type,Actif,email)
 | 
			
		||||
  VALUES(@Nom,@Prenom,@Adresse,@NCompte,@DateDeNaisance,@type,@Actif,@email)
 | 
			
		||||
 SET @ID=@@IDENTITY
 | 
			
		||||
RETURN
 | 
			
		||||
GO
 | 
			
		||||
CREATE PROCEDURE ModifierUtilisateur
 | 
			
		||||
 @ID int,
 | 
			
		||||
 @Nom varchar(50),
 | 
			
		||||
 @Prenom varchar(50),
 | 
			
		||||
 @Adresse varchar(50),
 | 
			
		||||
 @NCompte varchar(50),
 | 
			
		||||
 @DateDeNaisance datetime,
 | 
			
		||||
 @type int,
 | 
			
		||||
 @Actif bit,
 | 
			
		||||
 @email varchar(50)
 | 
			
		||||
AS
 | 
			
		||||
 IF(@ID IS NULL OR @ID=0)
 | 
			
		||||
  RAISERROR('Identifiant requis !',16,1)
 | 
			
		||||
 ELSE  UPDATE Utilisateur
 | 
			
		||||
        SET Nom=@Nom,Prenom=@Prenom,Adresse=@Adresse,NCompte=@NCompte,DateDeNaisance=@DateDeNaisance,type=@type,Actif=@Actif,email=@email
 | 
			
		||||
        WHERE ID=@ID
 | 
			
		||||
RETURN
 | 
			
		||||
GO
 | 
			
		||||
CREATE PROCEDURE SelectionnerUtilisateur
 | 
			
		||||
 @Index VARCHAR(10)
 | 
			
		||||
AS
 | 
			
		||||
 IF(@Index='Nom') SELECT * FROM Utilisateur ORDER BY Nom
 | 
			
		||||
 ELSE IF(@Index='Prenom') SELECT * FROM Utilisateur ORDER BY Prenom
 | 
			
		||||
 ELSE IF(@Index='Adresse') SELECT * FROM Utilisateur ORDER BY Adresse
 | 
			
		||||
 ELSE IF(@Index='NCompte') SELECT * FROM Utilisateur ORDER BY NCompte
 | 
			
		||||
 ELSE IF(@Index='DateDeNaisance') SELECT * FROM Utilisateur ORDER BY DateDeNaisance
 | 
			
		||||
 ELSE IF(@Index='type') SELECT * FROM Utilisateur ORDER BY type
 | 
			
		||||
 ELSE IF(@Index='Actif') SELECT * FROM Utilisateur ORDER BY Actif
 | 
			
		||||
 ELSE IF(@Index='email') SELECT * FROM Utilisateur ORDER BY email
 | 
			
		||||
 ELSE SELECT * FROM Utilisateur ORDER BY ID
 | 
			
		||||
RETURN
 | 
			
		||||
GO
 | 
			
		||||
CREATE PROCEDURE SelectionnerUtilisateur_ID
 | 
			
		||||
 @ID int
 | 
			
		||||
AS
 | 
			
		||||
 IF(@ID IS NULL)
 | 
			
		||||
  RAISERROR('Identifiant requis !',16,1)
 | 
			
		||||
 ELSE
 | 
			
		||||
  SELECT ID,Nom,Prenom,Adresse,NCompte,DateDeNaisance,type,Actif,email
 | 
			
		||||
  FROM Utilisateur
 | 
			
		||||
  WHERE @ID=ID
 | 
			
		||||
RETURN
 | 
			
		||||
GO
 | 
			
		||||
CREATE PROCEDURE SupprimerUtilisateur
 | 
			
		||||
 @ID int
 | 
			
		||||
AS
 | 
			
		||||
 IF(@ID IS NULL)
 | 
			
		||||
  RAISERROR('Identifiant requis !',16,1)
 | 
			
		||||
 ELSE
 | 
			
		||||
  DELETE FROM Utilisateur WHERE @ID=ID
 | 
			
		||||
RETURN
 | 
			
		||||
GO
 | 
			
		||||
		Reference in New Issue
	
	Block a user