Exemple #1
0
 private void ModifPlan(ModifPlan value, SqlConnection connection)
 {
     Models.RemboursementDAO rbdao = new Models.RemboursementDAO(connection);
     rbdao.Delete("WHERE pret='" + value.pret.id + "'");
     Models.Pret pret = new Models.Pret(value.pret); pret.Client = new Models.Client(); pret.Client.Id = value.pret.id;
     foreach (Remboursement r in value.remboursements)
     {
         Models.Remboursement rb = new Models.Remboursement(r); rb.Pret = pret;
         if (rb.Id == null)
         {
             rb.Id = rbdao.NextId();
         }
         rbdao.Insert(rb);
     }
 }
Exemple #2
0
        private void DefinitivePlan(Plan value, SqlConnection connection)
        {
            this.VerifierPlan(value); value.AddInteret(connection);
            Models.PretDAO          prdao = new Models.PretDAO(connection);
            Models.ClientDAO        cldao = new Models.ClientDAO(connection);
            Models.RemboursementDAO rbdao = new Models.RemboursementDAO(connection);

            Models.Pret   pret   = new Models.Pret(value.pret);
            Models.Client client = cldao.SelectOne("WHERE id='" + value.pret.client.id + "'");
            client.Solde += pret.Montant;
            pret.Id       = prdao.NextId();
            pret.Client   = client;
            prdao.Insert(pret);
            cldao.Update(client);
            foreach (Remboursement r in value.remboursements)
            {
                Models.Remboursement rb = new Models.Remboursement(r); rb.Id = rbdao.NextId(); rb.Pret = pret;
                rbdao.Insert(rb);
            }
        }