Example #1
0
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                viewM = this.Main.DataContext as HotelInfoViewModel;
                viewM.SelectedData = new HotelInfo();
                InsertData view = new InsertData("AJOUT", viewM.SelectedData, viewM);
                view.ShowDialog();

                if (view.Msg == "OK")
                {
                    MessageBox.Show("Opération effectuée avec succès", "HotelInfo", MessageBoxButton.OK, MessageBoxImage.Information);
                    viewM.Refresh();
                }
                else if (view.Msg == "Error")
                {
                    MessageBox.Show("   Echec Opération    ", "HotelInfo ", MessageBoxButton.OK, MessageBoxImage.Warning);
                    viewM.Refresh();
                }
                else
                {
                    viewM.Refresh();
                }
                //}
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "HotelInfo", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
Example #2
0
        //Evenement double clic du RadGridview
        void OnGridMouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            FrameworkElement originalSender = e.OriginalSource as FrameworkElement;

            if (originalSender != null)
            {
                //var cell = originalSender.ParentOfType<GridViewCell>();
                //if (cell != null)
                //{
                //    MessageBox.Show("The double-clicked cell is " + cell.Value);
                //}

                var row = originalSender.ParentOfType <GridViewRow>();
                if (row != null)
                {
                    try
                    {
                        if (GlobalData.VerificationDroit("CanEditHotelInfo"))
                        {
                            viewM = this.Main.DataContext as HotelInfoViewModel;

                            InsertData view = new InsertData("MOD", viewM.SelectedData, viewM);
                            view.ShowDialog();

                            if (view.Msg == "OK")
                            {
                                MessageBox.Show("Opération effectuée avec succès", "HotelInfo", MessageBoxButton.OK, MessageBoxImage.Information);
                                viewM.Refresh();
                            }
                            else if (view.Msg == "Error")
                            {
                                MessageBox.Show("    Echec Opération    ", "HotelInfo", MessageBoxButton.OK, MessageBoxImage.Warning);
                                viewM.Refresh();
                            }
                            else
                            {
                                viewM.Refresh();
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message + "Veuillez fermer le formulaire puis recommencer.", "CATEGORIE", MessageBoxButton.OK, MessageBoxImage.Warning);
                    }
                }
            }
        }
Example #3
0
        private void btnEdit_Click(object sender, RoutedEventArgs e)
        {
            if (dataGrid.SelectedItem != null)
            {
                try
                {
                    //if (GlobalData.VerificationDroit("CanAddHotelInfo"))
                    //{
                    viewM = this.Main.DataContext as HotelInfoViewModel;
                    InsertData view = new InsertData("MOD", viewM.SelectedData, viewM);
                    view.ShowDialog();

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

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