//------------------------------------------------------------------------- public void ShowMenuAjout(Point pt) { if (!m_lnkAjouter.Visible) { return; } CObjetDonneeAIdNumerique element = m_elementsAAgenda[0]; //cherche les entrées qui collent avec des acteurs CListeObjetsDonnees liste = new CListeObjetsDonnees(element.ContexteDonnee, typeof(CTypeEntreeAgenda)); CFiltreDataAvance filtre = new CFiltreDataAvance(CTypeEntreeAgenda.c_nomTable, CRelationTypeEntreeAgenda_TypeElementAAgenda.c_nomTable + "." + CRelationTypeEntreeAgenda_TypeElementAAgenda.c_champTypeElement + "=@1 and " + CRelationTypeEntreeAgenda_TypeElementAAgenda.c_nomTable + "." + CRelationTypeEntreeAgenda_TypeElementAAgenda.c_champLienMaitre + "=@2", element.GetType().ToString(), true); liste.Filtre = filtre; if (liste.Count == 0) { CFormAlerte.Afficher(I.T("No Agenda entry type can be applied on this element type|30080"), EFormAlerteType.Exclamation); return; } m_menuAjouterAgenda.MenuItems.Clear(); foreach (CTypeEntreeAgenda typeEntree in liste) { CMenuItemATypeEntreeAgenda item = new CMenuItemATypeEntreeAgenda(typeEntree); item.Text = typeEntree.Libelle; item.Click += new EventHandler(OnMenuAjouterAgenda); m_menuAjouterAgenda.MenuItems.Add(item); } pt = PointToClient(pt); m_menuAjouterAgenda.Show(this, pt); }
//------------------------------------------------------------------------- private void OnMenuAjouterAgenda(object sender, EventArgs args) { if (OnAfficherEntreeAgenda == null) { return; } if (m_elementsAAgenda.Length != 1) { return; } if (sender is CMenuItemATypeEntreeAgenda) { CMenuItemATypeEntreeAgenda menu = (CMenuItemATypeEntreeAgenda)sender; CTypeEntreeAgenda typeEntree = menu.TypeEntree; CEntreeAgenda entree = new CEntreeAgenda(m_elementsAAgenda[0].ContexteDonnee); entree.CreateNew(); entree.DateDebut = DateEnCours.Date.AddHours(8); entree.DateFin = DateEnCours.Date.AddHours(18); typeEntree.InitEntreeManuelleFor(entree, m_elementsAAgenda[0]); OnAfficherEntreeAgenda(entree); } }