コード例 #1
0
        //-------------------------------------------------------------------
        public override CResultAErreur VerifieDonnees(CObjetDonnee objet)
        {
            CResultAErreur result = CResultAErreur.True;

            try
            {
                CEOplanifiee_Acteur rel = (CEOplanifiee_Acteur)objet;
            }
            catch (Exception e)
            {
                result.EmpileErreur(new CErreurException(e));
            }
            return(result);
        }
コード例 #2
0
        public void TestUneEOPlanifieeSimple()
        {
            try
            {
                CTimosTestMetierApp.SessionClient.BeginTrans();

                using (CContexteDonnee contexte = new CContexteDonnee(CTimosTestMetierApp.SessionClient.IdSession, true, false))
                {
                    // Jour
                    CHoraireJournalier_Tranche t1 = new CHoraireJournalier_Tranche(contexte);
                    t1.CreateNew();
                    t1.TypeOccupationHoraire = (CTypeOccupationHoraire)GetEntite(typeof(CTypeOccupationHoraire), m_nIdOccupationJour, contexte);
                    t1.HeureDebut            = 8 * 60; // 8 heures
                    t1.HeureFin = 12 * 60;             // 11 heures
                    Assert.IsTrue(t1.CommitEdit());


                    CActeur acteur = (CActeur)GetEntite(typeof(CActeur), m_nIdActeur, contexte);
                    CEntiteOrganisationnelle eo = (CEntiteOrganisationnelle)GetEntite(typeof(CEntiteOrganisationnelle), m_nIdEO, contexte);
                    // Création des EO planifiées
                    CEOplanifiee_Acteur eoPlan = new CEOplanifiee_Acteur(contexte);
                    eoPlan.CreateNew();
                    eoPlan.Date   = DateTime.Today;
                    eoPlan.Acteur = acteur;
                    eoPlan.EntiteOrganisationnelle = eo;
                    eoPlan.TrancheHoraire          = t1;
                    Assert.IsTrue(eoPlan.CommitEdit());

                    // On demande les Horaires à l'acteur de maintenant à demain même heure (24 heures)
                    CTrancheHoraire[] listeTranches = acteur.GetHoraires(DateTime.Now.Date, DateTime.Now.Date.AddDays(1));
                    Assert.AreEqual(1, listeTranches.Length);
                    Assert.AreEqual(50, listeTranches[0].Priorite);
                    Assert.AreEqual(4, listeTranches[0].Duree);
                }
            }
            finally
            {
                CTimosTestMetierApp.SessionClient.RollbackTrans();
            }
        }
コード例 #3
0
        public void TestCombineEOsPlanifieesEtCalendrier()
        {
            try
            {
                CTimosTestMetierApp.SessionClient.BeginTrans();

                using (CContexteDonnee contexte = new CContexteDonnee(CTimosTestMetierApp.SessionClient.IdSession, true, false))
                {
                    //******** Calendrier **************
                    // Jour
                    CHoraireJournalier_Tranche t1 = new CHoraireJournalier_Tranche(contexte);
                    t1.CreateNew();
                    t1.HoraireJournalier     = (CHoraireJournalier)GetEntite(typeof(CHoraireJournalier), m_nIdHoraireJournalier, contexte);
                    t1.TypeOccupationHoraire = (CTypeOccupationHoraire)GetEntite(typeof(CTypeOccupationHoraire), m_nIdOccupationJour, contexte);
                    t1.HeureDebut            = 8 * 60; // 8 heures
                    t1.HeureFin = 12 * 60;             // 12 heures
                    Assert.IsTrue(t1.CommitEdit());

                    // Repos
                    CHoraireJournalier_Tranche t2 = new CHoraireJournalier_Tranche(contexte);
                    t2.CreateNew();
                    t2.HoraireJournalier     = (CHoraireJournalier)GetEntite(typeof(CHoraireJournalier), m_nIdHoraireJournalier, contexte);
                    t2.TypeOccupationHoraire = (CTypeOccupationHoraire)GetEntite(typeof(CTypeOccupationHoraire), m_nIdOccupationRepos, contexte);
                    t2.HeureDebut            = 12 * 60;
                    t2.HeureFin = 13 * 60;
                    Assert.IsTrue(t2.CommitEdit());

                    // Jour
                    CHoraireJournalier_Tranche t3 = new CHoraireJournalier_Tranche(contexte);
                    t3.CreateNew();
                    t3.HoraireJournalier     = (CHoraireJournalier)GetEntite(typeof(CHoraireJournalier), m_nIdHoraireJournalier, contexte);
                    t3.TypeOccupationHoraire = (CTypeOccupationHoraire)GetEntite(typeof(CTypeOccupationHoraire), m_nIdOccupationJour, contexte);
                    t3.HeureDebut            = 13 * 60;
                    t3.HeureFin = 17 * 60;
                    Assert.IsTrue(t3.CommitEdit());

                    // Repos de nuit
                    CHoraireJournalier_Tranche t4 = new CHoraireJournalier_Tranche(contexte);
                    t4.CreateNew();
                    t4.HoraireJournalier     = (CHoraireJournalier)GetEntite(typeof(CHoraireJournalier), m_nIdHoraireJournalier, contexte);
                    t4.TypeOccupationHoraire = (CTypeOccupationHoraire)GetEntite(typeof(CTypeOccupationHoraire), m_nIdOccupationRepos, contexte);
                    t4.HeureDebut            = 17 * 60;
                    t4.HeureFin = 8 * 60;
                    Assert.IsTrue(t4.CommitEdit());

                    // ***********  EO Planifiées *****************

                    // Repos
                    CHoraireJournalier_Tranche t5 = new CHoraireJournalier_Tranche(contexte);
                    t5.CreateNew();
                    t5.TypeOccupationHoraire = (CTypeOccupationHoraire)GetEntite(typeof(CTypeOccupationHoraire), m_nIdOccupationRepos, contexte);
                    t5.HeureDebut            = 6 * 60;
                    t5.HeureFin = (int)(12.5 * 60);  // 12H30
                    Assert.IsTrue(t5.CommitEdit());

                    // Astreinte
                    CHoraireJournalier_Tranche t6 = new CHoraireJournalier_Tranche(contexte);
                    t6.CreateNew();
                    t6.TypeOccupationHoraire = (CTypeOccupationHoraire)GetEntite(typeof(CTypeOccupationHoraire), m_nIdOccupationAstreinte, contexte);
                    t6.HeureDebut            = (int)(12.5 * 60); // 12h30
                    t6.HeureFin = (int)(20.5 * 60);              // 20H30
                    Assert.IsTrue(t6.CommitEdit());

                    // Repos
                    CHoraireJournalier_Tranche t7 = new CHoraireJournalier_Tranche(contexte);
                    t7.CreateNew();
                    t7.TypeOccupationHoraire = (CTypeOccupationHoraire)GetEntite(typeof(CTypeOccupationHoraire), m_nIdOccupationRepos, contexte);
                    t7.HeureDebut            = (int)(20.5 * 60);
                    t7.HeureFin = (int)(22.5 * 60);  // 22H30
                    Assert.IsTrue(t7.CommitEdit());

                    // Astreinte
                    CHoraireJournalier_Tranche t8 = new CHoraireJournalier_Tranche(contexte);
                    t8.CreateNew();
                    t8.TypeOccupationHoraire = (CTypeOccupationHoraire)GetEntite(typeof(CTypeOccupationHoraire), m_nIdOccupationAstreinte, contexte);
                    t8.HeureDebut            = (int)(22.5 * 60); // 12h30
                    t8.HeureFin = 6 * 60;                        // 6 H le landemain
                    Assert.IsTrue(t8.CommitEdit());

                    CActeur acteur = (CActeur)GetEntite(typeof(CActeur), m_nIdActeur, contexte);
                    CEntiteOrganisationnelle eo = (CEntiteOrganisationnelle)GetEntite(typeof(CEntiteOrganisationnelle), m_nIdEO, contexte);

                    // Création EO planifiée repos
                    CEOplanifiee_Acteur eoPlan1 = new CEOplanifiee_Acteur(contexte);
                    eoPlan1.CreateNew();
                    eoPlan1.Date   = DateTime.Today;
                    eoPlan1.Acteur = acteur;
                    eoPlan1.EntiteOrganisationnelle = eo;
                    eoPlan1.TrancheHoraire          = t5;
                    Assert.IsTrue(eoPlan1.CommitEdit());

                    // Création EO planifiée Astreinte
                    CEOplanifiee_Acteur eoPlan2 = new CEOplanifiee_Acteur(contexte);
                    eoPlan2.CreateNew();
                    eoPlan2.Date   = DateTime.Today;
                    eoPlan2.Acteur = acteur;
                    eoPlan2.EntiteOrganisationnelle = eo;
                    eoPlan2.TrancheHoraire          = t6;
                    Assert.IsTrue(eoPlan2.CommitEdit());

                    // Création EO repos
                    CEOplanifiee_Acteur eoPlan3 = new CEOplanifiee_Acteur(contexte);
                    eoPlan3.CreateNew();
                    eoPlan3.Date   = DateTime.Today;
                    eoPlan3.Acteur = acteur;
                    eoPlan3.EntiteOrganisationnelle = eo;
                    eoPlan3.TrancheHoraire          = t7;
                    Assert.IsTrue(eoPlan3.CommitEdit());

                    // Création EO astreinte
                    CEOplanifiee_Acteur eoPlan4 = new CEOplanifiee_Acteur(contexte);
                    eoPlan4.CreateNew();
                    eoPlan4.Date   = DateTime.Today;
                    eoPlan4.Acteur = acteur;
                    eoPlan4.EntiteOrganisationnelle = eo;
                    eoPlan4.TrancheHoraire          = t8;
                    Assert.IsTrue(eoPlan4.CommitEdit());

                    // On demande les Horaires à l'acteur de maintenant à demain même heure (24 heures)
                    CTrancheHoraire[] listeTranches = acteur.GetHoraires(DateTime.Today, DateTime.Today.AddDays(1));

                    Assert.AreEqual(7, listeTranches.Length);
                    Assert.AreEqual(100, listeTranches[0].Priorite);
                    Assert.AreEqual(7.5, listeTranches[0].Duree);
                }
            }
            finally
            {
                CTimosTestMetierApp.SessionClient.RollbackTrans();
            }
        }
コード例 #4
0
        public void TestTroisEOsPlanifieesLeMemeJour()
        {
            try
            {
                CTimosTestMetierApp.SessionClient.BeginTrans();

                using (CContexteDonnee contexte = new CContexteDonnee(CTimosTestMetierApp.SessionClient.IdSession, true, false))
                {
                    // Repos
                    CHoraireJournalier_Tranche t2 = new CHoraireJournalier_Tranche(contexte);
                    t2.CreateNew();
                    t2.TypeOccupationHoraire = (CTypeOccupationHoraire)GetEntite(typeof(CTypeOccupationHoraire), m_nIdOccupationRepos, contexte);
                    t2.HeureDebut            = 8 * 60; // 8 heures
                    t2.HeureFin = 12 * 60;             // 12 heures
                    Assert.IsTrue(t2.CommitEdit());

                    // Jour
                    CHoraireJournalier_Tranche t3 = new CHoraireJournalier_Tranche(contexte);
                    t3.CreateNew();
                    t3.TypeOccupationHoraire = (CTypeOccupationHoraire)GetEntite(typeof(CTypeOccupationHoraire), m_nIdOccupationJour, contexte);
                    t3.HeureDebut            = 14 * 60;
                    t3.HeureFin = 19 * 60;
                    Assert.IsTrue(t3.CommitEdit());

                    // Astreinte
                    CHoraireJournalier_Tranche t4 = new CHoraireJournalier_Tranche(contexte);
                    t4.CreateNew();
                    t4.TypeOccupationHoraire = (CTypeOccupationHoraire)GetEntite(typeof(CTypeOccupationHoraire), m_nIdOccupationAstreinte, contexte);
                    t4.HeureDebut            = 19 * 60; // de 19 heures
                    t4.HeureFin = 8 * 60;               // à 8 heures le lendemain
                    Assert.IsTrue(t4.CommitEdit());

                    CActeur acteur = (CActeur)GetEntite(typeof(CActeur), m_nIdActeur, contexte);
                    CEntiteOrganisationnelle eo = (CEntiteOrganisationnelle)GetEntite(typeof(CEntiteOrganisationnelle), m_nIdEO, contexte);

                    // Création des EO planifiées
                    CEOplanifiee_Acteur eoPlan1 = new CEOplanifiee_Acteur(contexte);
                    eoPlan1.CreateNew();
                    eoPlan1.Date   = DateTime.Today.AddDays(-1);
                    eoPlan1.Acteur = acteur;
                    eoPlan1.EntiteOrganisationnelle = eo;
                    eoPlan1.TrancheHoraire          = t4; // Astreinte de la veille
                    Assert.IsTrue(eoPlan1.CommitEdit());

                    // Création des EO planifiées
                    CEOplanifiee_Acteur eoPlan2 = new CEOplanifiee_Acteur(contexte);
                    eoPlan2.CreateNew();
                    eoPlan2.Date   = DateTime.Today;
                    eoPlan2.Acteur = acteur;
                    eoPlan2.EntiteOrganisationnelle = eo;
                    eoPlan2.TrancheHoraire          = t2;
                    Assert.IsTrue(eoPlan2.CommitEdit());

                    // Création des EO planifiées
                    CEOplanifiee_Acteur eoPlan3 = new CEOplanifiee_Acteur(contexte);
                    eoPlan3.CreateNew();
                    eoPlan3.Date   = DateTime.Today;
                    eoPlan3.Acteur = acteur;
                    eoPlan3.EntiteOrganisationnelle = eo;
                    eoPlan3.TrancheHoraire          = t3;
                    Assert.IsTrue(eoPlan3.CommitEdit());

                    // Création des EO planifiées
                    CEOplanifiee_Acteur eoPlan4 = new CEOplanifiee_Acteur(contexte);
                    eoPlan4.CreateNew();
                    eoPlan4.Date   = DateTime.Today;
                    eoPlan4.Acteur = acteur;
                    eoPlan4.EntiteOrganisationnelle = eo;
                    eoPlan4.TrancheHoraire          = t4;
                    Assert.IsTrue(eoPlan4.CommitEdit());

                    // On demande les Horaires à l'acteur de maintenant à demain même heure (24 heures)
                    CTrancheHoraire[] listeTranches = acteur.GetHoraires(DateTime.Today, DateTime.Today.AddDays(1));

                    Assert.AreEqual(4, listeTranches.Length);
                    Assert.AreEqual(100, listeTranches[0].Priorite);
                    Assert.AreEqual(13, listeTranches[0].Duree);
                    Assert.AreEqual(100, listeTranches[1].Priorite);
                    Assert.AreEqual(13, listeTranches[1].Duree);
                    Assert.AreEqual(50, listeTranches[2].Priorite);
                    Assert.AreEqual(5, listeTranches[2].Duree);
                    Assert.AreEqual(10, listeTranches[3].Priorite);
                    Assert.AreEqual(4, listeTranches[3].Duree);
                }
            }
            finally
            {
                CTimosTestMetierApp.SessionClient.RollbackTrans();
            }
        }