Example #1
0
        private void btnClient_Click(object sender, RoutedEventArgs e)
        {
            if (dataGrid.SelectedItem != null)
            {
                viewM = this.Main.DataContext as ReservationsViewModel;
                ClientsViewModel cli = new ClientsViewModel(viewM.model);
                cli.SelectedData = (dataGrid.SelectedItem as Reservations).Clients;

                ClientInsertData view = new ClientInsertData("MOD", cli.SelectedData, cli);
                view.ShowDialog();

                if (view.Msg == "OK")
                {
                    MessageBox.Show("Opération effectuée avec succès", "Clients", MessageBoxButton.OK, MessageBoxImage.Information);
                    viewM.Refresh();
                }
                else if (view.Msg == "Error")
                {
                    MessageBox.Show("    Echec Opération    ", "Clients", MessageBoxButton.OK, MessageBoxImage.Warning);
                    viewM.Refresh();
                }
                else
                {
                    viewM.Refresh();
                }
            }
        }
Example #2
0
        private void btnChambre_Click(object sender, RoutedEventArgs e)
        {
            if (dataGrid.SelectedItem != null)
            {
                viewM = this.Main.DataContext as ReservationsViewModel;

                AssigneChambre view = new AssigneChambre(dataGrid.SelectedItem as Reservations, viewM.model, "Autre");
                view.ShowDialog();

                if (view.Msg == "OK")
                {
                    MessageBox.Show("Opération effectuée avec succès", "Clients", MessageBoxButton.OK, MessageBoxImage.Information);
                    viewM.Refresh();
                }
                else if (view.Msg == "Error")
                {
                    MessageBox.Show("    Echec Opération    ", "Clients", MessageBoxButton.OK, MessageBoxImage.Warning);
                    viewM.Refresh();
                }
                else
                {
                    viewM.Refresh();
                }
            }
        }
Example #3
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);
            }
        }
Example #4
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);
            }
        }
Example #5
0
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            //if (GlobalData.VerificationDroit("CanAddReservations"))
            //{

            var result = MessageBox.Show("Voulez vous vraiment supprimer ?", "Message", MessageBoxButton.YesNo, MessageBoxImage.Question);

            if (result == MessageBoxResult.Yes)
            {
                if (dataGrid.SelectedItem != null)
                {
                    try
                    {
                        viewM = this.Main.DataContext as ReservationsViewModel;
                        Reservations ent = dataGrid.SelectedItem as Reservations;
                        ent.Etat = "SUPPRIMER";

                        viewM.model.SaveChanges();

                        viewM.Refresh();

                        MessageBox.Show("Opération effectuée avec succès", "Reservations", MessageBoxButton.OK, MessageBoxImage.Information);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "Reservations", MessageBoxButton.OK, MessageBoxImage.Warning);
                        viewM.Refresh();
                    }
                }
                else
                {
                    MessageBox.Show("Aucune ligne selectionnée dans la liste", "Reservations", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }
            //}
        }
Example #6
0
 private void btnRefresh_Click(object sender, RoutedEventArgs e)
 {
     viewM = this.Main.DataContext as ReservationsViewModel;
     viewM.Refresh();
 }