Exemplo n.º 1
0
        private void PrintBtn_Click(object sender, RoutedEventArgs e)
        {
            if (!(DishesDgd.SelectedItem is LocalDishes localDishes))
            {
                return;
            }
            var dish = _dishesDb.SingleOrDefault(x => x.Id == localDishes.Id);

            SaveFileDialog saveDialog = new SaveFileDialog
            {
                Filter = "PDF file (*.pdf)|*.pdf"
            };

            if (saveDialog.ShowDialog() == true)
            {
                var s           = saveDialog.FileName;
                var fileCreated = DocumentsCreator.Dish(dish, saveDialog.FileName);
                if (fileCreated)
                {
                    ParentView.Show_MessageView("El documento ha sido creado con éxito",
                                                //affirmative action
                                                delegate
                    {
                        ParentView.Show_DishesView();
                    },
                                                "Aceptar",
                                                //negative action
                                                null,
                                                null,
                                                FontAwesome.WPF.FontAwesomeIcon.CheckCircle
                                                );
                }
                else
                {
                    ParentView.Show_MessageView("Hubo un problema al crear el documento\nComuniquese a soporte técnico",
                                                //affirmative action
                                                delegate
                    {
                        ParentView.Show_DishesView();
                    },
                                                "Aceptar",
                                                //negative action
                                                null,
                                                null,
                                                FontAwesome.WPF.FontAwesomeIcon.ExclamationCircle
                                                );
                }
            }
        }
Exemplo n.º 2
0
        private void PrintBtn_Click(object sender, RoutedEventArgs e)
        {
            SaveFileDialog saveDialog = new SaveFileDialog
            {
                Filter = "PDF file (*.pdf)|*.pdf"
            };

            if (saveDialog.ShowDialog() == true)
            {
                var s           = saveDialog.FileName;
                var fileCreated = DocumentsCreator.ProductsList(_productsOc, saveDialog.FileName);
                if (fileCreated)
                {
                    ParentView.Show_MessageView("El documento ha sido creado con éxito",
                                                //affirmative action
                                                delegate
                    {
                        ParentView.Show_ProductsView();
                    },
                                                "Aceptar",
                                                //negative action
                                                null,
                                                null,
                                                FontAwesome.WPF.FontAwesomeIcon.CheckCircle
                                                );
                }
                else
                {
                    ParentView.Show_MessageView("Hubo un problema al crear el documento\nComuniquese a soporte técnico",
                                                //affirmative action
                                                delegate
                    {
                        ParentView.Show_ProductsView();
                    },
                                                "Aceptar",
                                                //negative action
                                                null,
                                                null,
                                                FontAwesome.WPF.FontAwesomeIcon.ExclamationCircle
                                                );
                }
            }
        }