コード例 #1
0
 //Création commentaire avec l'objet "c" passé en paramètre
 public static void Create(Comment c)
 {
     //Vérification de l'objet c: il est transmis par le web service et n'est pas sûr
     if (isValid(c))
     {
         OdawaDS.commentsDataTable dt = DataProvider.GetComments();
         //Création d'une commentsRow et remplissage avec les attributs de "c"
         OdawaDS.commentsRow newRow = DataProvider.odawa.comments.NewcommentsRow();
         newRow.commentaire   = c.commentaire;
         newRow.idUtilisateur = c.idUtilisateur;
         newRow.idRestaurant  = c.idRestaurant;
         //Envoi à la DAL de la commentsRow pour ajout au DataSet
         try
         {
             DataProvider.CreateComment(newRow);
         }
         catch (System.Data.SqlClient.SqlException ex)
         {
             //si SqlException, log
             LogManager.LogSQLException(ex.Message);
         }
     }
 }
コード例 #2
0
 //Mise à jour commentaire
 public static void UpdateComment(OdawaDS.commentsRow cr)
 {
     odawa.comments.FindByid(cr.id).commentaire = cr.commentaire;
     WriteToDB("comments");
 }
コード例 #3
0
 //Création commentaire
 public static void CreateComment(OdawaDS.commentsRow c)
 {
     odawa.comments.Rows.Add(c);
     WriteToDB("comments");
 }