Beispiel #1
0
        protected override void Seed(TpContext db)
        {
            // Clients
            Client cl1 = new Client(1, "Panzani", "34, avenue de corot", "13013", "Marseille", "0491609023");
            Client cl2 = new Client(2, "Heineken", "14, rue François Chardigny", "13011", "Marseille", "0491691322");

            db.Clients.Add(cl1);
            db.Clients.Add(cl2);

            //Centres
            CentreInformatique ceinfo1 = new CentreInformatique(1, "34, avenue de corot", "13013",
                                                                "Marseille", "0491609023", 1);
            CentreInformatique ceinfo2 = new CentreInformatique(2, "11, chemin du littoral", "13015",
                                                                "Marseille", "0491601462", 1);
            CentreInformatique ceinfo3 = new CentreInformatique(3, "14, rue François Chardigny", "13011",
                                                                "Marseille", "0491691322", 2);

            db.CentresInformatique.Add(ceinfo1);
            db.CentresInformatique.Add(ceinfo2);
            db.CentresInformatique.Add(ceinfo3);

            //Contrats
            Contrat ct1 = new Contrat(1, 24.65, new DateTime(2011, 02, 12), 1, cl1, ceinfo1);
            Contrat ct2 = new Contrat(2, 13.480, new DateTime(2011, 03, 13), 1, cl1, ceinfo2);
            Contrat ct3 = new Contrat(3, 32.740, new DateTime(2016, 04, 15), 1, cl2, ceinfo3);

            db.Contrats.Add(ct1);
            db.Contrats.Add(ct2);
            db.Contrats.Add(ct3);
        }
 public Contrat(int numct, double mtct, DateTime dtvalct, sbyte stct, Client clct,
                CentreInformatique cti)
 {
     num_contrat           = numct;
     montant_contrat       = mtct;
     date_validite_contrat = dtvalct;
     statut = stct;
     Client = clct;
     Centre = cti;
 }
 public bool AjoutCentre(CentreInformatique ci)
 {
     try
     {
         _centreRepository.Insert(ci);
         _centreRepository.Save();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
 public void UpdatCentre(CentreInformatique ci)
 {
     _centreRepository.Update(ci);
     _centreRepository.Save();
 }
 public void SuppCentre(CentreInformatique ci)
 {
     _centreRepository.Delete(ci);
     _centreRepository.Save();
 }