Exemplo n.º 1
0
        //------------------------------------------------------------
        private void m_btnAjouter_Click(object sender, EventArgs e)
        {
            if (m_elementAIntervention == null)
            {
                return;
            }
            CTypeIntervention typeIntervention = (CTypeIntervention)CFormSelectUnObjetDonnee.SelectionRechercheRapide(
                I.T("Sélectionnez une intervention|20732"),
                typeof(CTypeIntervention),
                null,
                "",
                "",
                "");

            if (typeIntervention != null)
            {
                CIntervention tache = new CIntervention(m_contexteDonnee);
                tache.CreateNewInCurrentContexte();
                tache.TypeIntervention     = typeIntervention;
                tache.ElementAIntervention = (CObjetDonneeAIdNumerique)m_elementAIntervention;
                tache.DureePrevisionnelle  = typeIntervention.DureeStandardHeures;
                CFractionIntervention fraction = new CFractionIntervention(m_contexteDonnee);
                fraction.CreateNewInCurrentContexte();
                fraction.DateDebutPlanifie = m_controlPlanning.DateDebut;
                fraction.DateFinPlanifiee  = fraction.DateDebutPlanifie.AddHours(tache.DureePrevisionnelle);
                fraction.Intervention      = tache;
                m_controlPlanning.Refresh();
                //m_controlPlanning.SelectTranche(fraction);
            }
        }
Exemplo n.º 2
0
 //--------------------------------------------------------------
 private CFractionIntervention AjouterFraction()
 {
     if (m_gestionnaireModeEdition.ModeEdition)
     {
         DateTime dateDebut = new DateTime(1900, 1, 1);
         foreach (CFractionIntervention fraction in Intervention.Fractions)
         {
             if (fraction.DateFinPlanifiee > dateDebut)
             {
                 dateDebut = fraction.DateFinPlanifiee;
             }
         }
         if (Intervention.Fractions.Count == 0)
         {
             dateDebut = DateTime.Now;
         }
         CFractionIntervention fractionNew = new CFractionIntervention(Intervention.ContexteDonnee);
         fractionNew.CreateNewInCurrentContexte();
         fractionNew.Intervention      = Intervention;
         fractionNew.DateDebutPlanifie = dateDebut;
         if (m_wndDureePrevue.UnitValue != null)
         {
             fractionNew.DateFinPlanifiee = dateDebut.AddHours((double)m_wndDureePrevue.UnitValue.ConvertTo(CClasseUniteTemps.c_idH).Valeur);
         }
         else if (Intervention.TypeIntervention != null && Intervention.TypeIntervention.DureeStandardHeures > 0)
         {
             fractionNew.DateFinPlanifiee = dateDebut.AddHours(Intervention.TypeIntervention.DureeStandardHeures);
         }
         else
         {
             fractionNew.DateFinPlanifiee = dateDebut.AddHours(1);
         }
         UpdateFractions();
         return(fractionNew);
     }
     return(null);
 }