private void item_Click(object sender, EventArgs e) { if (sender is CMenuItemAfractionIntervention) { CMenuItemAfractionIntervention item = (CMenuItemAfractionIntervention)sender; if (CFormAlerte.Afficher(I.T("Retake the data '@1' ?|30188", item.Text), EFormAlerteType.Question) == DialogResult.Yes) { CIntervention intervention = new CIntervention(ElementEdite.ContexteDonnee); if (intervention.ReadIfExists(new CFiltreData(CIntervention.c_champId + "=@1", item.Id))) { CObjetDonneeAIdNumerique.Delete(intervention.Operations); Hashtable mapDonnees = new Hashtable(); CListeObjetsDonnees donneesToCopie = intervention.Operations; //donneesToCopie.Filtre = new CFiltreData ( COperation.c_champIdDonneeParente+" is null" ); foreach (COperation operation in donneesToCopie) { COperation newDonnee = (COperation)operation.Clone(false); mapDonnees[operation.Id] = newDonnee; if (operation.OperationParente != null) { newDonnee.OperationParente = (COperation)mapDonnees[operation.OperationParente.Id]; } else { newDonnee.OperationParente = null; } newDonnee.Intervention = intervention; } Init(intervention); } } } }
private void m_lnkReprendre_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e) { ContextMenu menu = new ContextMenu(); if (m_listeDerniersfractionInterventions.Count == 0) { CFormAlerte.Afficher(I.T("No history|30187"), EFormAlerteType.Exclamation); } foreach (int nId in m_listeDerniersfractionInterventions) { CIntervention intervention = new CIntervention(CSc2iWin32DataClient.ContexteCourant); if (intervention.ReadIfExists(new CFiltreData(CIntervention.c_champId + "=@1", nId))) { CMenuItemAfractionIntervention item = new CMenuItemAfractionIntervention(nId, intervention.Libelle); item.Click += new EventHandler(item_Click); menu.MenuItems.Add(item); } } //menu.Show ( m_lnkReprendre, new Point ( 0, m_lnkReprendre.Height ) ); }