Ejemplo n.º 1
0
        public void TestCRUDLivret1PJTest()
        {
            int nId = 0;

            nId = oCand.ID;
            Livret1 oL1 = new Livret1();

            oL1.Numero = "20190115001";

            PieceJointeL1 oPJ = new PieceJointeL1();

            oPJ.Libelle = "CNI";
            oPJ.IsRecu  = true;
            oPJ.IsOK    = false;
            oL1.lstPiecesJointes.Add(oPJ);

            oCand.lstLivrets1.Add(oL1);


            ctx.SaveChanges();

            ctx   = Context.instance;
            oCand = ctx.Candidats.Find(nId);
            Assert.AreEqual(1, oCand.lstLivrets1.Count);

            oL1 = oCand.lstLivrets1[0];
            PieceJointeL1 oPJ2 = oL1.lstPiecesJointes[0];

            Assert.AreEqual(oPJ.Libelle, oPJ2.Libelle);
            Assert.AreEqual(oPJ.IsRecu, oPJ2.IsRecu);
            Assert.AreEqual(oPJ.IsOK, oPJ2.IsOK);
        }
Ejemplo n.º 2
0
 public override void Commit()
 {
     base.Commit();
     // Validation des PiècesJointes L2
     foreach (PieceJointeLivretVM item in lstPieceJointe)
     {
         PieceJointeL1 oPJ = (PieceJointeL1)item.ThePiecejointe;
         if (item.IsDeleted)
         {
             if (!item.IsNew)
             {
                 // Il faut faire les suppression sur les DBSets !!!!
                 _ctx.PieceJointeL1.Remove(oPJ);
             }
             item.IsDeleted = false;
             item.IsNew     = false;
         }
         else
         {
             if (item.IsNew)
             {
                 oL1.lstPiecesJointes.Add(oPJ);
                 item.IsNew = false;
             }
         }
     }
 }
Ejemplo n.º 3
0
 public override void Commit()
 {
     // Validation des PiècesJointes L1
     foreach (PieceJointeLivretVM item in lstPieceJointe)
     {
         PieceJointeL1 oPJ = (PieceJointeL1)item.ThePiecejointe;
         if (_ctx.Entry <PieceJointeL1>(oPJ).State == System.Data.Entity.EntityState.Detached)
         {
             oL1.lstPiecesJointes.Add(oPJ);
         }
     }
 }