Ejemplo n.º 1
0
        //-----------------------------------------------------------------------
        private static void itemDeleteSmartField_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem item = sender as ToolStripMenuItem;
            CTagMenu          tag  = item != null ? item.Tag as CTagMenu : null;

            if (tag != null && tag.SmartField != null)
            {
                using (CContexteDonnee ctx = new CContexteDonnee(CSc2iWin32DataClient.ContexteCourant.IdSession, true, false))
                {
                    CSmartField smartField = tag.SmartField.GetObjetInContexte(ctx) as CSmartField;
                    if (smartField != null)
                    {
                        if (MessageBox.Show(I.T("Delete SmartField @1 ?|20085", smartField.Libelle),
                                            "",
                                            MessageBoxButtons.YesNo,
                                            MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            CResultAErreur result = smartField.Delete();
                            if (!result)
                            {
                                CFormAlerte.Afficher(result.Erreur);
                            }
                        }
                    }
                }
            }
        }