public void SetContexteDonnee(CContexteDonnee contexte) { m_contexteDonnee = contexte; //Crée une nouvelle baseplanning dans ce contexte; CFournisseurEntreesPlanning newBase = new CFournisseurEntreesPlanning(contexte); if (m_basePlanning != null) { foreach (IElementAIntervention elt in m_basePlanning.ElementsAIntervention) { if (elt is CObjetDonnee) { CObjetDonnee newElt = (CObjetDonnee)Activator.CreateInstance(elt.GetType(), contexte); if (newElt.ReadIfExists(((CObjetDonnee)elt).GetValeursCles())) { newBase.AddElementAIntervention((IElementAIntervention)newElt); } } } foreach (IRessourceEntreePlanning ressource in m_basePlanning.Ressources) { if (ressource is CObjetDonnee) { CObjetDonnee newElt = (CObjetDonnee)Activator.CreateInstance(ressource.GetType(), contexte); if (newElt.ReadIfExists(((CObjetDonnee)ressource).GetValeursCles())) { newBase.AddRessource((IRessourceEntreePlanning)newElt); } } } } m_basePlanning = newBase; m_controlePlanning.BaseAffichee = m_basePlanning; FillListeInterventionsAPlanifier(); }
//------------------------------------------------------------ private void m_btnIntervenant_Click(object sender, EventArgs e) { CActeur part = (CActeur)CFormSelectUnObjetDonnee.SelectionRechercheRapide( I.T("Select an operator|20738"), typeof(CActeur), CFournisseurFiltreRapide.GetFiltreRapideForType(typeof(CActeur)), "", "", ""); if (part != null) { CActeur part2 = new CActeur(m_contexteDonnee); part2.ReadIfExists(part.Id); part = part2; m_fournisseurEntreesPlanning.AddRessource(part); m_controlPlanning.Refresh(); Refresh(); } }