Exemplo n.º 1
0
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                viewM = this.Main.DataContext as ReservationsViewModel;
                viewM.SelectedData = new Reservations();
                InsertData view = new InsertData("AJOUT", viewM.SelectedData, viewM);
                view.ShowDialog();

                if (view.Msg == "OK")
                {
                    MessageBox.Show("Opération effectuée avec succès", "Reservations", MessageBoxButton.OK, MessageBoxImage.Information);
                    viewM.Refresh();
                }
                else if (view.Msg == "Error")
                {
                    MessageBox.Show("   Echec Opération    ", "Reservations ", MessageBoxButton.OK, MessageBoxImage.Warning);
                    viewM.Refresh();
                }
                else
                {
                    viewM.Refresh();
                }
                //}
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Reservations", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
Exemplo n.º 2
0
        private void btnEdit_Click(object sender, RoutedEventArgs e)
        {
            if (dataGrid.SelectedItem != null)
            {
                try
                {
                    //if (GlobalData.VerificationDroit("CanAddReservations"))
                    //{
                    viewM = this.Main.DataContext as ReservationsViewModel;
                    InsertData view = new InsertData("MOD", viewM.SelectedData, viewM);
                    view.ShowDialog();

                    if (view.Msg == "OK")
                    {
                        MessageBox.Show("Opération effectuée avec succès", "Reservations", MessageBoxButton.OK, MessageBoxImage.Information);
                        viewM.Refresh();
                    }
                    else if (view.Msg == "Error")
                    {
                        MessageBox.Show("    Echec Opération    ", "Reservations", MessageBoxButton.OK, MessageBoxImage.Warning);
                        viewM.Refresh();
                    }
                    else
                    {
                        viewM.Refresh();
                    }

                    //}
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Reservations", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }
            else
            {
                MessageBox.Show("Aucune ligne selectionnée dans la liste", "Reservations", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }