コード例 #1
0
 private void DeleteProfessional(Professional professional, int id)
 {
     _doc = new DocumentManager(_db);
     List<Follower> follow = _db.SelectRequest.SelectFollowForPro(id);
     foreach (var f in follow)
     {
         _doc.DeleteFollowerFile(professional.ProfessionalId, f.Patient.PatientId);
     }
     _db.SuppressionRequest.ProfessionnalSuppression(professional);
 }
コード例 #2
0
ファイル: WebApiTest.cs プロジェクト: Anthaax/Archi-Vite
        public void PutFollower()
        {
            using (ArchiViteContext context = new ArchiViteContext())
            {
                _doc = new DocumentManager(context);
                FollowerCreation myNewFollow = new FollowerCreation(context.SelectRequest.SelectPatient("GuillaumeF", "GuillaumeF").PatientId,
                    context.SelectRequest.SelectProfessional("AntoineR", "AntoineR").ProfessionalId);
                _followerService.PutFollower(myNewFollow);

                Dictionary<Patient, Professional[]> allFollow = _followerService.getDocument(context.SelectRequest.SelectProfessional("ClementR", "ClementR").ProfessionalId);
                foreach (var pair in allFollow)
                {
                    Assert.AreEqual(pair.Value[0].ProfessionalId, context.SelectRequest.SelectProfessional("AntoineR", "AntoineR").ProfessionalId);
                }

                _doc.DeleteFollowerFile(context.SelectRequest.SelectProfessional("AntoineR", "AntoineR").ProfessionalId, context.SelectRequest.SelectPatient("GuillaumeF", "GuillaumeF").PatientId);
                context.SuppressionRequest.FollowerSuppression(context.SelectRequest.SelectOneFollow(context.SelectRequest.SelectPatient("GuillaumeF", "GuillaumeF").PatientId, context.SelectRequest.SelectProfessional("AntoineR", "AntoineR").ProfessionalId));
                Assert.IsNull(context.SelectRequest.SelectOneFollow(context.SelectRequest.SelectPatient("GuillaumeF", "GuillaumeF").PatientId, context.SelectRequest.SelectProfessional("AntoineR", "AntoineR").ProfessionalId));
            }
        }
コード例 #3
0
ファイル: MessageTest.cs プロジェクト: Anthaax/Archi-Vite
        public void DeleteFollow()
        {
            using (ArchiViteContext context = new ArchiViteContext())
            {
                FollowerService _followerService = new FollowerService();
                DocumentManager dm = new DocumentManager(context);
                dm.DeleteFollowerFile(context.SelectRequest.SelectProfessional("SimonF", "SimonF").ProfessionalId, context.SelectRequest.SelectPatient("GuillaumeF", "GuillaumeF").PatientId);
                context.SuppressionRequest.FollowerSuppression(context.SelectRequest.SelectOneFollow(context.SelectRequest.SelectPatient("GuillaumeF", "GuillaumeF").PatientId, context.SelectRequest.SelectProfessional("SimonF", "SimonF").ProfessionalId));
                Assert.IsNull(context.SelectRequest.SelectOneFollow(context.SelectRequest.SelectPatient("GuillaumeF", "GuillaumeF").PatientId, context.SelectRequest.SelectProfessional("SimonF", "SimonF").ProfessionalId));

                FollowerCreation myNewFollow = new FollowerCreation(context.SelectRequest.SelectPatient("GuillaumeF", "GuillaumeF").PatientId,
                    context.SelectRequest.SelectProfessional("SimonF", "Simonf").ProfessionalId);
                _followerService.PutFollower(myNewFollow);
            }
        }
コード例 #4
0
ファイル: MessageTest.cs プロジェクト: Anthaax/Archi-Vite
 public void DeleteData()
 {
     using (ArchiViteContext context = new ArchiViteContext())
     {
         DocumentManager _doc = new DocumentManager(context);
         var selectQuery1 = context.Follower.ToList();
         foreach (var follow in selectQuery1)
         {
             _doc.DeleteFollowerFile(follow.ProfessionnalId, follow.PatientId);
             context.SuppressionRequest.FollowerSuppression(follow);
             context.SaveChanges();
         }
         var selectQuery2 = context.Patient.ToList();
         foreach (var patient in selectQuery2)
         {
             _doc.DeletePatientFile(patient.PatientId);
             context.Patient.Remove(patient);
             context.SaveChanges();
         }
         var selectQuery3 = context.Professional.ToList();
         foreach (var pro in selectQuery3)
         {
             context.Professional.Remove(pro);
             context.SaveChanges();
         }
         var selectQuery4 = context.User.ToList();
         foreach (var user in selectQuery4)
         {
             context.User.Remove(user);
             context.SaveChanges();
         }
         Assert.IsFalse(context.Follower.Any());
         Assert.IsFalse(context.Patient.Any());
         Assert.IsFalse(context.Professional.Any());
         Assert.IsFalse(context.User.Any());
     }
 }