Example #1
0
 public void AddJournal(Journal journal)
 {
     using (var presseContext = new PresseDataContext())
     {
         if (presseContext.Journaux.Count() == 0)
         {
             presseContext.Journaux.InsertOnSubmit(journal);
         }
         else
         {
             foreach (Journal j in presseContext.Journaux)
             {
                 if (j.Nom != journal.Nom)
                 {
                     presseContext.Journaux.InsertOnSubmit(journal);
                 }
                 else
                 {
                     Messenger.Default.Send(WindowMessages.ErreurInsert);
                 }
             }
         }
         presseContext.SubmitChanges();
     }
 }
Example #2
0
 public void AddRetour(Retour retour)
 {
     using (var presseContext = new PresseDataContext())
     {
         if (presseContext.Retours.Count() == 0)
         {
             presseContext.Retours.InsertOnSubmit(retour);
         }
         else
         {
             foreach (Retour r in presseContext.Retours)
             {
                 if (r.Date != retour.Date)
                 {
                     presseContext.Retours.InsertOnSubmit(retour);
                 }
                 else
                 {
                     Messenger.Default.Send(WindowMessages.ErreurInsert);
                 }
             }
         }
         presseContext.SubmitChanges();
     }
 }
Example #3
0
        public void DeleteJournal(int journalId)
        {
            using (var presseContext = new PresseDataContext())
            {
                var journalQuery =
                           from b in presseContext.Journaux
                           where b.Id == journalId
                           select b;

                var journal = journalQuery.First();

                presseContext.Journaux.DeleteOnSubmit(journal);
                presseContext.SubmitChanges();
            }
        }
Example #4
0
        public void DeleteRetour(int retourId)
        {
            using (var presseContext = new PresseDataContext())
            {
                var retourQuery =
                           from b in presseContext.Retours
                           where b.Id == retourId
                           select b;

                var retour = retourQuery.First();

                presseContext.Retours.DeleteOnSubmit(retour);
                presseContext.SubmitChanges();
            }
        }
Example #5
0
        public void UpdateJournal(Journal journal)
        {
            using (var presseContext = new PresseDataContext())
            {
                  var journalQuery =
                           from b in presseContext.Journaux
                           where b.Id == journal.Id
                           select b;
                  var journaldel = journalQuery.First();

                  presseContext.Journaux.DeleteOnSubmit(journaldel);
                presseContext.Journaux.InsertOnSubmit(journal);
                presseContext.SubmitChanges();
            }
        }
Example #6
0
        public void UpdateRetour(Retour retour)
        {
            using (var presseContext = new PresseDataContext())
            {
                var retourQuery =
                         from r in presseContext.Retours
                         where r.Id == retour.Id
                         select r;

                var retourdel = retourQuery.First();

                presseContext.Retours.DeleteOnSubmit(retourdel);
                presseContext.Retours.InsertOnSubmit(retour);
                presseContext.SubmitChanges();
            }
        }