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_txtSelectElementAInterventions_OnSelectedObjectChanged(object sender, EventArgs e) { m_elementAIntervention = (IElementAIntervention)m_txtSelectElementAInterventions.ElementSelectionne; if (m_elementAIntervention != null) { CSite site = new CSite(m_contexteDonnee); site.ReadIfExists(m_elementAIntervention.Id); m_elementAIntervention = site; } m_fournisseurEntreesPlanning.ClearElementsAIntervention(); m_fournisseurEntreesPlanning.AddElementAIntervention(m_elementAIntervention); m_controlPlanning.Refresh(); }