private void MenuItem_Click_5(object sender, RoutedEventArgs e) { BancoDeDadosSapato_1718218 ctx = new BancoDeDadosSapato_1718218(); if (sender == Relatorio_EstoqueSapatos) { Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog(); dlg.FileName = "Relatorio_EstoqueSapato"; // Nome padrão dlg.DefaultExt = ".xlsx"; // Extensão do arquivo dlg.Filter = "Excel (.xlsx)|*.xlsx"; // Filtros Nullable <bool> result = dlg.ShowDialog(); // Somente irá salvar se o usuário selecionar um arquivo. if (result == true) { // Salvar Documento ServiceClosedXML.CriarPlanilhaSapatosEstoque(ctx.Estoques.ToList(), ctx.Sapatos.ToList(), dlg.FileName); } } else if (sender == Relatorio_PedidosCliente) { Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog(); dlg.FileName = "Relatorio_PedidoCliente"; dlg.DefaultExt = ".xlsx"; dlg.Filter = "Excel (.xlsx)|*.xlsx"; Nullable <bool> result = dlg.ShowDialog(); if (result == true) { ServiceClosedXML.CriarPlanilhaClientePedidos(ctx.Pessoas.ToList(), ctx.Pedidos.ToList(), ctx.Enderecos.ToList(), ctx.Sapatos.ToList(), dlg.FileName); } } }