private void NewButton_Click(object sender, RoutedEventArgs e)
        {
            FrmRedevance Newfrm = new FrmRedevance();

            Newfrm.CallBack += Newfrm_CallBack;
            Newfrm.Show();
        }
Esempio n. 2
0
        private void NewButton_Click(object sender, RoutedEventArgs e)
        {
            FrmRedevance Newfrm = new FrmRedevance();

            Newfrm.CallBack += Newfrm_CallBack;
            Newfrm.Closed   += Newfrm_Closed;
            this.IsEnabled   = false;
            Newfrm.Show();
        }
Esempio n. 3
0
        void mnitem_Click(object sender, RoutedEventArgs e)
        {
            MenuItem mnitem = (MenuItem)sender;

            switch (mnitem.Header.ToString())
            {
            case "Créer":
                FrmRedevance Newfrm = new FrmRedevance();
                Newfrm.CallBack += Newfrm_CallBack;
                this.IsEnabled   = false;
                Newfrm.Show();
                break;

            case "Consultation":
                new FrmRedevance((CsRedevance)dgListeRedevence.SelectedItem).Show();
                break;

            case "Modification":
                FrmRedevance Updatefrm = new FrmRedevance((CsRedevance)dgListeRedevence.SelectedItem, true);
                Updatefrm.CallBack += Updatefrm_CallBack;
                Updatefrm.Show();
                break;

            case "Supprimer":
                var messageBox = new MessageBoxControl.MessageBoxChildWindow("Attention", "Êtes-vous sûr de vouloir supprimer la ligne?", MessageBoxControl.MessageBoxButtons.OkCancel, MessageBoxControl.MessageBoxIcon.Information);
                messageBox.OnMessageBoxClosed += (_, result) =>
                {
                    if (messageBox.Result == MessageBoxResult.OK)
                    {
                        CsRedevance LotsScelleRecuToDelete = (CsRedevance)dgListeRedevence.SelectedItem;
                        RedevanceRecuToDelete.Add(LotsScelleRecuToDelete);
                        ListeRedevence.Remove(LotsScelleRecuToDelete);
                        LoadDatagrid();
                    }
                    else
                    {
                        return;
                    }
                };
                messageBox.Show();
                break;

            default:
                break;
            }
        }
        private void UpdateButton_Click(object sender, RoutedEventArgs e)
        {
            FrmRedevance Updatefrm = new FrmRedevance((CsRedevance)dgListeRedevence.SelectedItem, true);
            CsRedevance  Redevance = ((CsRedevance)dgListeRedevence.SelectedItem);

            //On verifie que l'element actuelement selectionner a jamais été insérer en base en s'assurant que PK_ID est different de 0
            if (Redevance.PK_ID != 0)
            {
                Updatefrm.CallBack += Updatefrm_CallBack;
            }
            else
            {
                //Sinon on la considere comme une nouvelle insertion
                Updatefrm.CallBack += Newfrm_CallBack;
                ListeRedevence.Remove(Redevance);
                RedevanceRecuToInserte.Remove(Redevance);
            }
            Updatefrm.Show();
        }