From 225aa1499e37faf9d38257caabbadc68d78b427e Mon Sep 17 00:00:00 2001 From: Lucas Faria Mendes Date: Mon, 30 Mar 2026 12:29:41 -0300 Subject: decompiler.com --- Decompiler/Gestor.Application.Actions/Actions.cs | 80 + .../CalculoControl.cs | 2279 +++ .../CoberturaView.cs | 128 + .../Gestor.Application.Componentes/ContasDialog.cs | 72 + .../CustomIsReadOnlyControl.cs | 64 + .../CustomItemControl.cs | 39 + .../CustomItemValidation.cs | 5 + .../CustomLegendChart.cs | 133 + .../CustomPasswordBox.cs | 199 + .../CustomSenhaLoginBox.cs | 343 + .../CustomSeriesViewModel.cs | 55 + .../DefaultDialog.cs | 39 + .../DialogAdvertising.cs | 106 + .../DialogAnaliticoBi.cs | 469 + .../Gestor.Application.Componentes/DialogAnexar.cs | 112 + .../Gestor.Application.Componentes/DialogCopia.cs | 159 + .../DialogCopiarCliente.cs | 97 + .../DialogCopiarPermissao.cs | 78 + .../DialogDetalheExtrato.cs | 90 + .../DialogEditarParcelas.cs | 174 + .../DialogEnviarEmails.cs | 67 + .../DialogExportarPermissao.cs | 119 + .../DialogExtratoComissao.cs | 210 + .../DialogGrafico.cs | 46 + .../Gestor.Application.Componentes/DialogHoster.cs | 81 + .../DialogInstalacoes.cs | 118 + .../DialogLogAcesso.cs | 72 + .../DialogMedalha.cs | 44 + .../DialogObservacao.cs | 90 + .../DialogPesquisaAvancada.cs | 124 + .../Gestor.Application.Componentes/DialogPrint.cs | 172 + .../DialogProtocolo.cs | 46 + .../DialogReordenarItens.cs | 69 + .../DialogSelecionarItens.cs | 44 + .../DialogSenhaAdm.cs | 132 + .../Gestor.Application.Componentes/DialogTarefa.cs | 398 + .../DialogTransferencia.cs | 116 + .../Gestor.Application.Componentes/DialogTrilha.cs | 143 + .../DialogVinculo.cs | 86 + .../Gestor.Application.Componentes/ErrorDialog.cs | 39 + .../GridRelatorio.cs | 607 + .../Gestor.Application.Componentes/Loading.cs | 39 + .../NRecoHtmlToPdfConverter.cs | 11 + .../Gestor.Application.Componentes/PassBox.cs | 208 + .../ProgressDialog.cs | 39 + .../ProspeccaoDialog.cs | 334 + .../VincularLancamentoDialog.cs | 84 + .../Gestor.Application.Componentes/WebBrowser.cs | 199 + .../Gestor.Application.Componentes/WebEditor.cs | 633 + .../ActualHeightConverter.cs | 28 + .../ArquivoDigitalVisibilityConverter.cs | 25 + .../AssinaturasVisibilityConverter.cs | 27 + .../AssistenciaVisibilityConverter.cs | 32 + .../AtivoToColorConverter.cs | 36 + .../AtivoToStringConverter.cs | 28 + .../BaixarVisibilityConverter.cs | 37 + .../BoletosNotasConverter.cs | 26 + .../BoolToGridHeightOneStarConverter.cs | 37 + .../CalculoIconConverter.cs | 36 + .../ColorStatusConverter.cs | 83 + .../ContatoSeguradoraVisibiltyConverter.cs | 32 + .../DesconsiderarVisibilityConverter.cs | 39 + .../DiasPentendesConverter.cs | 28 + .../DocumentoEtiquetaConverter.cs | 32 + .../EmpresaNomeConverter.cs | 32 + .../EnderecoConverter.cs | 40 + .../EnviadoColorConverter.cs | 78 + .../EnviadoConverter.cs | 32 + .../EnviadoIconConverter.cs | 61 + .../EnviadoTooTipConverter.cs | 55 + .../EqualToCollapsedConverter.cs | 19 + .../ExcluidoStringConverter.cs | 28 + .../ExcluirVendedorLabelConverter.cs | 28 + .../ExpanderHeaderConverter.cs | 36 + .../ExtensaoVisibilityConverter.cs | 51 + .../FaturaVisibilityConverter.cs | 28 + .../FilialStringConverter.cs | 28 + .../IdVisibilityConverter.cs | 25 + .../IncluirApoliceEnabledConverter.cs | 31 + .../IntToMedalConverter.cs | 55 + .../IntToMedalTextConverter.cs | 36 + .../IntToVisibilityConverter.cs | 29 + .../InvertedBoolToGridHeightOneStarConverter.cs | 27 + .../IsNamedObjectVisibilityConverter.cs | 82 + .../ManutencaoPagamentoGroupHeaderConverter.cs | 37 + .../MenosZeroVirgulaZeroUmConverter.cs | 24 + .../MimeIconConverter.cs | 213 + .../ModeloExisteTooltipConverter.cs | 32 + .../MultiBoolReadOnly.cs | 26 + .../MultiBoolToVisibilityConverter.cs | 27 + .../MultiVisibilityConverter.cs | 27 + .../NullToFalseConverter.cs | 28 + .../NullToTrueConverter.cs | 32 + .../PackIconToImage.cs | 55 + .../PackIconToImageConverter.cs | 35 + .../RamoToImageConverter.cs | 135 + .../ResultadoToBoolConverter.cs | 32 + .../StatusComissaoAutomaticaTooltipConverter.cs | 52 + .../StatusIconConverter.cs | 51 + .../StatusPagamentoColorConverter.cs | 47 + .../StatusPagamentoVisibilityConverter.cs | 31 + .../StringToFontWeightConverter.cs | 31 + .../StringToStringFontWeightCleanConverter.cs | 28 + .../SubTipoEnableConverter.cs | 27 + .../TelaRelatorioConverter.cs | 33 + .../TelefoneToVisibilityConverter.cs | 30 + .../TextInputToVisibilityConverter.cs | 31 + .../TipoDependenteToVisibilityConverter.cs | 32 + .../TipoEmailVisibilityConverter.cs | 27 + .../TipoRepasseGlobalFilterConverter.cs | 30 + .../TipoRepasseVendedorVisibilityConverter.cs | 41 + .../TipoRepasseVisibilityConverter.cs | 59 + .../TipoSinistroConverter.cs | 27 + .../TipoTelefoneVisibilityConverter.cs | 40 + .../TootipStatusConverter.cs | 59 + .../TypeVisibilityConverter.cs | 30 + .../ValorTipoConverter.cs | 42 + .../VariavelExisteColorConverter.cs | 42 + .../VariavelExisteTooltipConverter.cs | 32 + .../VerApoliceComissaoConverter.cs | 34 + .../BoletosNotasDrawerView.cs | 165 + .../ContratosDrawerView.cs | 69 + .../InstalacaoDrawerView.cs | 175 + .../ConfiguracoesDrawer.cs | 161 + .../ConfiguracaoRelatorio.cs | 324 + .../FiltroRelatorio.cs | 155 + .../AdiantamentoDrawerView.cs | 255 + .../Gestor.Application.Drawers/AgendaDrawer.cs | 605 + .../ArquivoDigitalDrawer.cs | 712 + .../Gestor.Application.Drawers/ExpedicaoDrawer.cs | 289 + .../Gestor.Application.Drawers/ExtratosDrawer.cs | 246 + .../Gestor.Application.Drawers/ImpostoDrawer.cs | 274 + .../InclusaoArquivoDigitalDrawer.cs | 182 + .../Gestor.Application.Drawers/InfoDrawer.cs | 196 + Decompiler/Gestor.Application.Drawers/LogDrawer.cs | 92 + .../Gestor.Application.Drawers/LogEmailDrawer.cs | 80 + .../Gestor.Application.Drawers/LogSistemaAntigo.cs | 71 + .../LogUtilizacaoDrawer.cs | 70 + .../MetaSeguradoraView.cs | 226 + .../Gestor.Application.Drawers/MetaVendedorView.cs | 231 + .../ObservacoesDrawer.cs | 239 + .../PermissaoUsuarioDrawer.cs | 738 + .../Gestor.Application.Drawers/TarefaDrawer.cs | 555 + .../ValoresApoliceDrawer.cs | 62 + .../ValoresParcelaDrawer.cs | 70 + .../VinculoVendedorDrawer.cs | 135 + .../ApplicationHelper.cs | 54 + .../Gestor.Application.Helpers/ArquivoDigital.cs | 38 + .../Gestor.Application.Helpers/AssinadorHelper.cs | 183 + .../BindingEnumHelper.cs | 45 + .../Gestor.Application.Helpers/BindingHelper.cs | 327 + .../Gestor.Application.Helpers/Connection.cs | 544 + .../Gestor.Application.Helpers/ConnectionHelper.cs | 470 + .../Gestor.Application.Helpers/CustomLinq.cs | 55 + .../DataGridExtensions.cs | 83 + Decompiler/Gestor.Application.Helpers/Erro.cs | 25 + Decompiler/Gestor.Application.Helpers/Funcoes.cs | 4086 ++++++ .../Gestor.Application.Helpers/HttpHelper.cs | 83 + Decompiler/Gestor.Application.Helpers/Instancia.cs | 53 + .../InstanciaAssinador.cs | 22 + .../Gestor.Application.Helpers/LicenseHelper.cs | 455 + .../Gestor.Application.Helpers/MailHelper.cs | 746 + .../NotifyPropertyChangedExtension.cs | 18 + .../ObrigatorioValidationRule.cs | 26 + .../PasswordBoxAssistant.cs | 92 + .../Gestor.Application.Helpers/PipeClient.cs | 41 + .../Gestor.Application.Helpers/PipeServer.cs | 96 + .../Gestor.Application.Helpers/QueryableHelper.cs | 24 + Decompiler/Gestor.Application.Helpers/Recursos.cs | 70 + .../Gestor.Application.Helpers/TipoToggle.cs | 13 + .../Gestor.Application.Helpers/ViewHelper.cs | 878 ++ ...tor.Application.Migration.Files.20200219_01.SQL | 192 + ...tor.Application.Migration.Files.20200219_02.SQL | 116 + ...tor.Application.Migration.Files.20200219_03.SQL | 468 + ...tor.Application.Migration.Files.20200219_04.SQL | 4 + ...tor.Application.Migration.Files.20200219_05.SQL | 768 + ...tor.Application.Migration.Files.20200219_06.SQL | 544 + ...tor.Application.Migration.Files.20200311_07.SQL | 14 + ...tor.Application.Migration.Files.20200311_08.SQL | 8 + ...tor.Application.Migration.Files.20200403_09.SQL | 24 + ...tor.Application.Migration.Files.20200403_10.SQL | 16 + ...tor.Application.Migration.Files.20200403_11.SQL | 29 + ...tor.Application.Migration.Files.20200403_12.SQL | 19 + ...tor.Application.Migration.Files.20200403_13.SQL | 19 + ...tor.Application.Migration.Files.20200403_14.SQL | 29 + ...tor.Application.Migration.Files.20200403_15.SQL | 19 + ...tor.Application.Migration.Files.20200403_16.SQL | 19 + ...tor.Application.Migration.Files.20200403_17.SQL | 19 + ...tor.Application.Migration.Files.20200403_18.SQL | 4 + ...tor.Application.Migration.Files.20200403_19.SQL | 14 + ...tor.Application.Migration.Files.20200403_20.SQL | 4 + ...tor.Application.Migration.Files.20200403_21.SQL | 19 + ...tor.Application.Migration.Files.20200403_22.SQL | 4 + ...tor.Application.Migration.Files.20200403_23.SQL | 19 + ...tor.Application.Migration.Files.20200406_24.SQL | 38 + ...tor.Application.Migration.Files.20200406_25.SQL | 4 + ...tor.Application.Migration.Files.20200406_26.SQL | 4 + ...tor.Application.Migration.Files.20200408_27.SQL | 19 + ...tor.Application.Migration.Files.20200408_28.SQL | 19 + ...tor.Application.Migration.Files.20200408_29.SQL | 40 + ...tor.Application.Migration.Files.20200408_30.SQL | 19 + ...tor.Application.Migration.Files.20200408_31.SQL | 28 + ...tor.Application.Migration.Files.20200408_32.SQL | 34 + ...tor.Application.Migration.Files.20200419_33.SQL | 4 + ...tor.Application.Migration.Files.20200419_34.SQL | 4 + ...tor.Application.Migration.Files.20200430_35.SQL | 4 + ...tor.Application.Migration.Files.20200505_36.SQL | 4 + ...tor.Application.Migration.Files.20200505_37.SQL | 4 + ...tor.Application.Migration.Files.20200505_38.SQL | 9 + ...tor.Application.Migration.Files.20200505_39.SQL | 14 + ...tor.Application.Migration.Files.20200506_40.SQL | 12 + ...tor.Application.Migration.Files.20200512_41.SQL | 62 + ...tor.Application.Migration.Files.20200512_42.SQL | 19 + ...tor.Application.Migration.Files.20200512_43.SQL | 4 + ...tor.Application.Migration.Files.20200514_44.SQL | 4 + ...tor.Application.Migration.Files.20200514_45.SQL | 109 + ...tor.Application.Migration.Files.20200520_46.SQL | 4 + ...tor.Application.Migration.Files.20200520_47.SQL | 8 + ...tor.Application.Migration.Files.20200525_48.SQL | 4 + ...tor.Application.Migration.Files.20200527_49.SQL | 39 + ...tor.Application.Migration.Files.20200527_50.SQL | 5 + ...tor.Application.Migration.Files.20200612_51.SQL | 4 + ...tor.Application.Migration.Files.20200702_52.SQL | 4 + ...tor.Application.Migration.Files.20200709_53.SQL | 4 + ...tor.Application.Migration.Files.20200714_54.SQL | 4 + ...tor.Application.Migration.Files.20200714_55.SQL | 4 + ...tor.Application.Migration.Files.20200716_56.SQL | 4 + ...tor.Application.Migration.Files.20200730_57.SQL | 9 + ...tor.Application.Migration.Files.20200811_58.SQL | 4 + ...tor.Application.Migration.Files.20200817_59.SQL | 9 + ...tor.Application.Migration.Files.20200818_60.SQL | 16 + ...tor.Application.Migration.Files.20200820_61.SQL | 16 + ...tor.Application.Migration.Files.20200820_62.SQL | 16 + ...tor.Application.Migration.Files.20200820_63.SQL | 4 + ...tor.Application.Migration.Files.20200825_64.SQL | 4 + ...tor.Application.Migration.Files.20200831_65.SQL | 4 + ...tor.Application.Migration.Files.20200914_66.SQL | 4 + ...tor.Application.Migration.Files.20200915_67.SQL | 4 + ...tor.Application.Migration.Files.20200924_68.SQL | 4 + ...tor.Application.Migration.Files.20200925_69.SQL | 4 + ...tor.Application.Migration.Files.20200929_70.SQL | 4 + ...tor.Application.Migration.Files.20201001_71.SQL | 4 + ...tor.Application.Migration.Files.20201007_72.SQL | 4 + ...tor.Application.Migration.Files.20201007_73.SQL | 4 + ...tor.Application.Migration.Files.20201008_74.SQL | 4 + ...tor.Application.Migration.Files.20201015_75.SQL | 8 + ...tor.Application.Migration.Files.20201026_76.SQL | 4 + ...tor.Application.Migration.Files.20201027_77.SQL | 4 + ...tor.Application.Migration.Files.20201028_78.SQL | 174 + ...tor.Application.Migration.Files.20201030_79.SQL | 13 + ...tor.Application.Migration.Files.20201104_80.SQL | 4 + ...tor.Application.Migration.Files.20201112_81.SQL | 9 + ...tor.Application.Migration.Files.20201113_82.SQL | 4 + ...tor.Application.Migration.Files.20201117_83.SQL | 4 + ...tor.Application.Migration.Files.20201127_84.SQL | 5 + ...tor.Application.Migration.Files.20201127_85.SQL | 4 + ...tor.Application.Migration.Files.20201127_86.SQL | 4 + ...tor.Application.Migration.Files.20201127_87.SQL | 4 + ...tor.Application.Migration.Files.20201127_88.SQL | 4 + ...tor.Application.Migration.Files.20201127_89.SQL | 6 + ...tor.Application.Migration.Files.20201201_90.SQL | 14 + ...tor.Application.Migration.Files.20201203_91.SQL | 6 + ...tor.Application.Migration.Files.20201203_92.SQL | 4 + ...tor.Application.Migration.Files.20201210_93.SQL | 4 + ...tor.Application.Migration.Files.20201230_94.SQL | 5 + ...tor.Application.Migration.Files.20210107_95.SQL | 4 + ...tor.Application.Migration.Files.20210118_96.SQL | 9 + ...tor.Application.Migration.Files.20210209_97.SQL | 9 + ...tor.Application.Migration.Files.20210217_98.SQL | 9 + ...tor.Application.Migration.Files.20210217_99.SQL | 5 + ...or.Application.Migration.Files.20210301_100.SQL | 4 + ...or.Application.Migration.Files.20210302_101.SQL | 4 + ...or.Application.Migration.Files.20210302_102.SQL | 10 + ...or.Application.Migration.Files.20210302_103.SQL | 4 + ...or.Application.Migration.Files.20210309_104.SQL | 9 + ...or.Application.Migration.Files.20210309_105.SQL | 4 + ...or.Application.Migration.Files.20210315_106.SQL | 4 + ...r.Application.Migration.Files.20210315_107-.SQL | 15 + ...or.Application.Migration.Files.20210323_108.SQL | 4 + ...or.Application.Migration.Files.20210323_109.SQL | 4 + ...or.Application.Migration.Files.20210324_110.SQL | 6 + ...or.Application.Migration.Files.20210324_111.SQL | 4 + ...or.Application.Migration.Files.20210329_112.SQL | 9 + ...or.Application.Migration.Files.20210408_113.SQL | 9 + ...r.Application.Migration.Files.20210415_114-.SQL | 15 + ...r.Application.Migration.Files.20210415_115-.SQL | 16 + ...or.Application.Migration.Files.20210415_116.SQL | 4 + ...or.Application.Migration.Files.20210426_117.SQL | 14 + ...or.Application.Migration.Files.20210510_118.SQL | 8 + ...or.Application.Migration.Files.20210512_119.SQL | 4 + ...or.Application.Migration.Files.20210524_120.SQL | 9 + ...or.Application.Migration.Files.20210525_121.SQL | 4 + ...or.Application.Migration.Files.20210607_122.SQL | 11 + ...or.Application.Migration.Files.20210610_123.SQL | 4 + ...or.Application.Migration.Files.20210610_124.SQL | 25 + ...or.Application.Migration.Files.20210610_125.SQL | 4 + ...or.Application.Migration.Files.20210610_126.SQL | 20 + ...or.Application.Migration.Files.20210610_127.SQL | 4 + ...or.Application.Migration.Files.20210610_128.SQL | 24 + ...or.Application.Migration.Files.20210610_129.SQL | 4 + ...or.Application.Migration.Files.20210610_130.SQL | 26 + ...or.Application.Migration.Files.20210610_131.SQL | 4 + ...or.Application.Migration.Files.20210610_132.SQL | 23 + ...r.Application.Migration.Files.20210614_133-.SQL | 4 + ...or.Application.Migration.Files.20210614_134.SQL | 16 + ...or.Application.Migration.Files.20210614_135.SQL | 4 + ...or.Application.Migration.Files.20210614_136.SQL | 20 + ...or.Application.Migration.Files.20210614_137.SQL | 4 + ...or.Application.Migration.Files.20210614_138.SQL | 16 + ...or.Application.Migration.Files.20210614_139.SQL | 4 + ...or.Application.Migration.Files.20210614_140.SQL | 18 + ...or.Application.Migration.Files.20210614_141.SQL | 4 + ...or.Application.Migration.Files.20210614_142.SQL | 23 + ...or.Application.Migration.Files.20210614_143.SQL | 4 + ...or.Application.Migration.Files.20210614_144.SQL | 27 + ...or.Application.Migration.Files.20210614_145.SQL | 4 + ...or.Application.Migration.Files.20210614_146.SQL | 18 + ...or.Application.Migration.Files.20210615_147.SQL | 4 + ...or.Application.Migration.Files.20210615_148.SQL | 17 + ...or.Application.Migration.Files.20210615_149.SQL | 4 + ...or.Application.Migration.Files.20210615_150.SQL | 10 + ...or.Application.Migration.Files.20210615_151.SQL | 4 + ...or.Application.Migration.Files.20210615_152.SQL | 16 + ...or.Application.Migration.Files.20210615_153.SQL | 4 + ...or.Application.Migration.Files.20210615_154.SQL | 14 + ...or.Application.Migration.Files.20210615_155.SQL | 4 + ...or.Application.Migration.Files.20210615_156.SQL | 13 + ...or.Application.Migration.Files.20210615_157.SQL | 4 + ...or.Application.Migration.Files.20210615_158.SQL | 21 + ...or.Application.Migration.Files.20210615_159.SQL | 4 + ...or.Application.Migration.Files.20210615_160.SQL | 23 + ...or.Application.Migration.Files.20210622_161.SQL | 4 + ...or.Application.Migration.Files.20210622_162.SQL | 16 + ...or.Application.Migration.Files.20210622_163.SQL | 4 + ...or.Application.Migration.Files.20210622_164.SQL | 28 + ...or.Application.Migration.Files.20210629_165.SQL | 4 + ...r.Application.Migration.Files.20210708_166-.SQL | 4 + ...or.Application.Migration.Files.20210708_167.SQL | 30 + ...r.Application.Migration.Files.20210708_168-.SQL | 4 + ...or.Application.Migration.Files.20210722_169.SQL | 5 + ...or.Application.Migration.Files.20210819_170.SQL | 5 + ...or.Application.Migration.Files.20210820_171.SQL | 14 + ...or.Application.Migration.Files.20210823_172.SQL | 4 + ...or.Application.Migration.Files.20210825_173.SQL | 6 + ...or.Application.Migration.Files.20210825_174.SQL | 9 + ...or.Application.Migration.Files.20210910_175.SQL | 4 + ...or.Application.Migration.Files.20210916_176.SQL | 16 + ...or.Application.Migration.Files.20210916_177.SQL | 4 + ...or.Application.Migration.Files.20211104_178.SQL | 1 + ...or.Application.Migration.Files.20211223_179.SQL | 12 + ...or.Application.Migration.Files.20211230_180.SQL | 4 + ...or.Application.Migration.Files.20211230_181.SQL | 4 + ...or.Application.Migration.Files.20220104_182.SQL | 4 + ...or.Application.Migration.Files.20220105_183.SQL | 4 + ...or.Application.Migration.Files.20220112_184.SQL | 4 + ...or.Application.Migration.Files.20220119_185.SQL | 4 + ...or.Application.Migration.Files.20220119_186.SQL | 4 + ...or.Application.Migration.Files.20220131_187.SQL | 4 + ...or.Application.Migration.Files.20220225_190.SQL | 4 + ...or.Application.Migration.Files.20220225_191.SQL | 9 + ...or.Application.Migration.Files.20220307_192.SQL | 16 + ...or.Application.Migration.Files.20220315_193.SQL | 4 + ...or.Application.Migration.Files.20220321_194.SQL | 7 + ...or.Application.Migration.Files.20220325_195.SQL | 4 + ...or.Application.Migration.Files.20220329_196.SQL | 24 + ...or.Application.Migration.Files.20220330_197.SQL | 4 + ...or.Application.Migration.Files.20220404_198.SQL | 4 + ...or.Application.Migration.Files.20220404_199.SQL | 4 + ...or.Application.Migration.Files.20220408_200.SQL | 5 + ...or.Application.Migration.Files.20220413_201.SQL | 4 + ...or.Application.Migration.Files.20220419_202.SQL | 6 + ...or.Application.Migration.Files.20220419_203.SQL | 6 + ...or.Application.Migration.Files.20220429_204.SQL | 4 + ...r.Application.Migration.Files.20220502_205-.SQL | 5 + ...r.Application.Migration.Files.20220502_206-.SQL | 4 + ...or.Application.Migration.Files.20220603_207.SQL | 4 + ...or.Application.Migration.Files.20220608_208.SQL | 4 + ...or.Application.Migration.Files.20220726_209.SQL | 4 + ...or.Application.Migration.Files.20220804_210.SQL | 4 + ...or.Application.Migration.Files.20220817_211.SQL | 4 + ...r.Application.Migration.Files.20220926_212-.SQL | 4 + ...r.Application.Migration.Files.20220929_213-.SQL | 4 + ...r.Application.Migration.Files.20221007_214-.SQL | 4 + ...r.Application.Migration.Files.20221018_215-.SQL | 4 + ...or.Application.Migration.Files.20221028_216.SQL | 4 + ...or.Application.Migration.Files.20221110_217.SQL | 4 + ...or.Application.Migration.Files.20221110_218.SQL | 4 + ...or.Application.Migration.Files.20230208_219.SQL | 4 + ...or.Application.Migration.Files.20230301_220.SQL | 4 + ...or.Application.Migration.Files.20230308_221.SQL | 4 + ...or.Application.Migration.Files.20230502_222.SQL | 4 + ...or.Application.Migration.Files.20230619_223.SQL | 8 + ...or.Application.Migration.Files.20230619_224.SQL | 4 + ...or.Application.Migration.Files.20230705_225.SQL | 4 + ...or.Application.Migration.Files.20230718_226.SQL | 9 + ...or.Application.Migration.Files.20230727_227.SQL | 4 + ...r.Application.Migration.Files.20230807_228-.SQL | 4 + ...r.Application.Migration.Files.20230829_229-.SQL | 4 + ...or.Application.Migration.Files.20231011_230.SQL | 4 + ...or.Application.Migration.Files.20231024_231.SQL | 4 + ...or.Application.Migration.Files.20231031_232.SQL | 4 + ...or.Application.Migration.Files.20240131_233.SQL | 11 + ...or.Application.Migration.Files.20240131_234.SQL | 11 + ...or.Application.Migration.Files.20240322_235.SQL | 6 + ...or.Application.Migration.Files.20240322_236.SQL | 4 + ...or.Application.Migration.Files.20240325_237.SQL | 4 + ...or.Application.Migration.Files.20240415_238.SQL | 4 + ...or.Application.Migration.Files.20240422_239.SQL | 4 + ...or.Application.Migration.Files.20240521_240.SQL | 4 + ...or.Application.Migration.Files.20240522_241.SQL | 4 + ...or.Application.Migration.Files.20240604_242.SQL | 9 + ...or.Application.Migration.Files.20240708_243.SQL | 4 + ...or.Application.Migration.Files.20240722_244.SQL | 7 + ...or.Application.Migration.Files.20240723_245.SQL | 4 + ...or.Application.Migration.Files.20240724_246.SQL | 4 + ...or.Application.Migration.Files.20240729_247.SQL | 4 + ...or.Application.Migration.Files.20240816_248.SQL | 1 + ...or.Application.Migration.Files.20240821_249.SQL | 7 + ...or.Application.Migration.Files.20240821_250.SQL | 4 + ...or.Application.Migration.Files.20240826_251.SQL | 8 + ...or.Application.Migration.Files.20240902_252.SQL | 4 + ...or.Application.Migration.Files.20240919_253.SQL | 7 + ...or.Application.Migration.Files.20241015_254.SQL | 4 + ...or.Application.Migration.Files.20250204_255.SQL | 4 + ...or.Application.Migration.Files.20250210_256.SQL | 4 + ...r.Application.Migration.Files.20250307_257-.SQL | 4 + ...r.Application.Migration.Files.20250314_258-.SQL | 4 + ...r.Application.Migration.Files.20250314_259-.SQL | 4 + ...or.Application.Migration.Files.20250328_260.SQL | 4 + ...or.Application.Migration.Files.20250331_261.SQL | 6 + ...r.Application.Migration.Files.20250401_262-.SQL | 11 + ...or.Application.Migration.Files.20250423_263.SQL | 4 + ...or.Application.Migration.Files.20250424_264.SQL | 4 + ...or.Application.Migration.Files.20250425_265.SQL | 4 + ...or.Application.Migration.Files.20250523_266.SQL | 6 + ...or.Application.Migration.Files.20250625_267.SQL | 4 + ...or.Application.Migration.Files.20250625_268.SQL | 4 + ...or.Application.Migration.Files.20250728_269.SQL | 4 + ...or.Application.Migration.Files.20250815_270.SQL | 4 + ...or.Application.Migration.Files.20250905_271.SQL | 9 + ...or.Application.Migration.Files.20250908_272.SQL | 4 + ...or.Application.Migration.Files.20250909_273.SQL | 14 + ...or.Application.Migration.Files.20250919_274.SQL | 4 + ...or.Application.Migration.Files.20250926_275.SQL | 4 + ...or.Application.Migration.Files.20251002_276.SQL | 4 + ...or.Application.Migration.Files.20251010_277.SQL | 4 + ...or.Application.Migration.Files.20251014_278.SQL | 4 + ...or.Application.Migration.Files.20251030_279.SQL | 4 + .../Gestor.Application.Migration/Migrator.cs | 170 + .../Gestor.Application.Model.Ajuda/Atendimento.cs | 68 + .../Gestor.Application.Model.Ajuda/Boleto.cs | 18 + .../Gestor.Application.Model.Ajuda/Contrato.cs | 8 + .../EmailAtendimento.cs | 25 + .../Gestor.Application.Model.Ajuda/Instalacao.cs | 22 + .../Gestor.Application.Model/AnaliticoSource.cs | 8 + .../Gestor.Application.Model/Configuracoes.cs | 8 + Decompiler/Gestor.Application.Model/Grafico.cs | 11 + .../Gestor.Application.Model/RelacaoItens.cs | 113 + .../Gestor.Application.Model/SinteticoSource.cs | 42 + .../Gestor.Application.Properties.Resources.resx | 219 + .../Gestor.Application.Properties/Resources.cs | 70 + .../Gestor.Application.Properties/Settings.cs | 14 + .../AjudaServico.cs | 114 + .../ConfuguracoesServico.cs | 479 + .../AdiantamentoServico.cs | 269 + .../AgendaServico.cs | 224 + .../EmailServico.cs | 126 + .../EmpresaServico.cs | 323 + .../EstipulanteServico.cs | 125 + .../ImpostoServico.cs | 175 + .../MetaSeguradoraServico.cs | 169 + .../MetaVendedorServico.cs | 169 + .../NotaFiscalServico.cs | 179 + .../ProdutoServico.cs | 91 + .../QualificacaoServico.cs | 53 + .../RamoServico.cs | 191 + .../ReciboServico.cs | 122 + .../SeguradoraServico.cs | 374 + .../SocioServico.cs | 94 + .../StatusProspeccaoServico.cs | 90 + .../StatusServico.cs | 125 + .../TipoTarefaServico.cs | 90 + .../TipoVendedorServico.cs | 131 + .../UsuarioServico.cs | 317 + .../VendedorServico.cs | 825 ++ .../BancosContasServico.cs | 387 + .../CentroServico.cs | 89 + .../FinanceiroServico.cs | 789 + .../FornecedorServico.cs | 127 + .../PlanoServico.cs | 119 + .../PlanosServico.cs | 90 + .../BaseServico.cs | 2412 +++ .../AeronauticoServico.cs | 118 + .../AutoServico.cs | 286 + .../ConsorcioServico.cs | 154 + .../GranizoServico.cs | 154 + .../ItemServico.cs | 1624 +++ .../PatrimonialServico.cs | 207 + .../RiscosDiversosServico.cs | 154 + .../VidaServico.cs | 154 + .../ApoliceServico.cs | 1842 +++ .../AtividadeServico.cs | 76 + .../ClienteServico.cs | 1082 ++ .../CriticaApoliceServico.cs | 302 + .../ExpedicaoServico.cs | 178 + .../PerfilEmpresaServico.cs | 178 + .../PerfilServico.cs | 167 + .../ProfissaoServico.cs | 76 + .../SinistroServico.cs | 385 + .../ArquivoDigitalServico.cs | 594 + .../AssinaturaServico.cs | 209 + .../Gestor.Application.Servicos/CepService.cs | 85 + .../Gestor.Application.Servicos/LogServico.cs | 267 + .../MalaDiretaServico.cs | 185 + .../Gestor.Application.Servicos/ParceiroServico.cs | 124 + .../Gestor.Application.Servicos/ParcelaServico.cs | 994 ++ .../PermissaoArquivoDigitalServico.cs | 181 + .../PermissaoUsuarioServico.cs | 160 + .../ProspeccaoServico.cs | 340 + .../RestricaoUsuarioServico.cs | 222 + .../Gestor.Application.Servicos/ServicoExtrato.cs | 310 + .../Gestor.Application.Servicos/TarefaServico.cs | 817 ++ .../VendedorUsuarioServico.cs | 175 + .../BISeriesViewModel.cs | 61 + .../NotasViewModel.cs | 265 + .../PainelBiViewModel.cs | 1563 ++ .../ProspeccaoViewModel.cs | 503 + .../TarefaBIViewModel.cs | 1146 ++ .../ComissaoViewModel.cs | 2497 ++++ .../RelayCommand.cs | 28 + .../ConfiguracoesViewModel.cs | 171 + .../AtendimentosViewModel.cs | 472 + .../BoletosNotasViewModel.cs | 100 + .../ContratosViewModel.cs | 109 + .../InstalacaoViewModel.cs | 201 + .../AdiantamentoViewModel.cs | 248 + .../AgendaViewModel.cs | 406 + .../ArquivoDigitalViewModel.cs | 1229 ++ .../ExpedicaoViewModel.cs | 164 + .../ExtratosViewModel.cs | 2773 ++++ .../ImpostoViewModel.cs | 314 + .../InfoViewModel.cs | 175 + .../LogAcaoViewModel.cs | 97 + .../LogEmailViewModel.cs | 161 + .../LogSistemaAntigoViewModel.cs | 36 + .../LogViewModel.cs | 1458 ++ .../MetaSeguradoraViewModel.cs | 212 + .../MetaVendedorViewModel.cs | 209 + .../PermissaoUsuarioViewModel.cs | 1704 +++ .../TarefaDrawerViewModel.cs | 1064 ++ .../ValoresApoliceViewModel.cs | 306 + .../ValoresParcelaViewModel.cs | 490 + .../VinculoVendedorViewModel.cs | 258 + .../CadastroEmailViewModel.cs | 285 + .../CadastroParceiroViewModel.cs | 273 + .../ComboModelo.cs | 37 + .../ComboVariavel.cs | 47 + .../DownloadViewModel.cs | 482 + .../EmpresaViewModel.cs | 444 + .../EstipulanteViewModel.cs | 316 + .../EtiquetaViewModel.cs | 792 + .../IncluirRamoViewModel.cs | 103 + .../IncluirSeguradoraViewModel.cs | 103 + .../MalaDiretaViewModel.cs | 660 + .../ManutencaoPagamentosViewModel.cs | 756 + .../NotaFiscalViewModel.cs | 348 + .../ProdutoViewModel.cs | 245 + .../ProtocoloDocumentosViewModel.cs | 278 + .../ProtocoloEtiqueta.cs | 11 + .../QualificacaoViewModel.cs | 122 + .../RamoViewModel.cs | 284 + .../ReciboViewModel.cs | 537 + .../SeguradoraViewModel.cs | 535 + .../SocioViewModel.cs | 301 + .../StatusProspeccaoViewModel.cs | 263 + .../StatusViewModel.cs | 295 + .../TipoTarefaViewModel.cs | 263 + .../TipoVendedorViewModel.cs | 294 + .../UsuarioViewModel.cs | 684 + .../VendedorViewModel.cs | 698 + .../FechamentoFinanceiroViewModel.cs | 974 ++ .../BancosContasViewModel.cs | 542 + .../CentroDeCustoViewmodel.cs | 219 + .../ContasDialogModel.cs | 46 + .../CopiarClienteViewModel.cs | 22 + .../ExtratoContaViewModel.cs | 408 + .../FinanceiroViewModel.cs | 4400 ++++++ .../FornecedorViewModel.cs | 477 + .../InfoExtratoViewModel.cs | 64 + .../MenuFinanceiroViewModel.cs | 24 + .../PlanoViewModel.cs | 129 + .../PlanosViewModel.cs | 252 + .../TranferenciaViewModel.cs | 66 + .../BaseApoliceViewModel.cs | 4483 ++++++ .../BaseDialogViewModel.cs | 5 + .../BaseFinanceiroViewModel.cs | 371 + .../BaseSegurosViewModel.cs | 656 + .../BaseTarefaViewModel.cs | 105 + .../BaseViewModel.cs | 2102 +++ .../DialogAdvertisingViewModel.cs | 225 + .../DialogAnexarViewModel.cs | 35 + .../DialogCopiaViewModel.cs | 162 + .../DialogCopiarPermissaoViewModel.cs | 320 + .../DialogEditarParcelasViewModel.cs | 245 + .../DialogEnviarEmailsViewModel.cs | 273 + .../DialogExportarPermissaoViewModel.cs | 109 + .../DialogGraficoViewModel.cs | 38 + .../DialogMedalhaViewModel.cs | 72 + .../DialogPesquisaAvancadaViewModel.cs | 503 + .../DialogProspeccaoViewModel.cs | 315 + .../DialogTarefaViewModel.cs | 300 + .../DialogTrilhaViewModel.cs | 95 + .../DialogViewModel.cs | 78 + .../DialogVinculoViewModel.cs | 177 + .../ErrorDialogViewModel.cs | 38 + .../ExtratoComissaoViewModel.cs | 137 + .../ItemViewModel.cs | 682 + .../ProtocoloViewModel.cs | 28 + .../ReordenarItensViewModel.cs | 63 + .../SelecionarItensViewModel.cs | 82 + .../DialogPrintViewModel.cs | 176 + .../RelatorioViewModel.cs | 14605 +++++++++++++++++++ .../SinteticoViewModel.cs | 445 + .../AeronauticoViewModel.cs | 435 + .../AutoViewModel.cs | 1266 ++ .../BuscarModeloViewModel.cs | 91 + .../ConsorcioViewModel.cs | 399 + .../GranizoViewModel.cs | 380 + .../PatrimonialViewModel.cs | 530 + .../RiscosDiversosViewModel.cs | 449 + .../VidaViewModel.cs | 438 + .../ApoliceViewModel.cs | 73 + .../ClienteViewModel.cs | 1343 ++ .../ConsultaViewModel.cs | 1685 +++ .../CriticaApoliceViewModel.cs | 1109 ++ .../PerfilEmpresaViewModel.cs | 256 + .../PerfilViewModel.cs | 168 + .../SinistroViewModel.cs | 1337 ++ .../TrocarClienteViewModel.cs | 75 + .../AnaliticoViewModel.cs | 172 + .../Gestor.Application.ViewModels/Arquivo.cs | 8 + .../CoberturaViewModel.cs | 179 + .../DashboardViewModel.cs | 925 ++ .../ImportViewModel.cs | 103 + .../LoginImageModel.cs | 8 + .../LoginViewModel.cs | 866 ++ .../Gestor.Application.ViewModels/MainViewModel.cs | 1061 ++ .../MenuBIViewModel.cs | 7 + .../MenuFerramentasViewModel.cs | 79 + .../MenuItemViewModel.cs | 798 + .../TrilhaViewModel.cs | 259 + .../TutorialViewModel.cs | 480 + .../AtendimentosView.cs | 299 + .../AcompanhamentoView.cs | 369 + .../Gestor.Application.Views.BI/AgendaBIView.cs | 81 + .../Gestor.Application.Views.BI/NotasView.cs | 275 + .../Gestor.Application.Views.BI/PainelBiView.cs | 450 + .../Gestor.Application.Views.BI/ProspeccaoView.cs | 403 + .../Gestor.Application.Views.BI/TarefaView.cs | 601 + .../CadastroEmailView.cs | 407 + .../CadastroParceiroView.cs | 442 + .../DownloadWindow.cs | 217 + .../EmpresaView.cs | 469 + .../EstipulanteView.cs | 448 + .../EtiquetaView.cs | 164 + .../IncluirRamoView.cs | 137 + .../IncluirSeguradoraView.cs | 137 + .../MalaDiretaView.cs | 308 + .../ManutencaoPagamentosView.cs | 266 + .../NotaFiscalView.cs | 352 + .../ProdutoView.cs | 256 + .../ProtocoloDocumentosView.cs | 196 + .../QualificacaoView.cs | 210 + .../RamoView.cs | 351 + .../ReciboView.cs | 334 + .../SeguradoraView.cs | 665 + .../SocioView.cs | 277 + .../StatusProspeccaoView.cs | 225 + .../StatusView.cs | 274 + .../TipoTarefaView.cs | 225 + .../TipoVendedorView.cs | 267 + .../UsuarioView.cs | 570 + .../VendedorView.cs | 896 ++ .../FechamentoFinanceiroView.cs | 319 + .../BancosContasView.cs | 411 + .../CentroDeCustoView.cs | 237 + .../ExtratoWindow.cs | 562 + .../FinanceiroView.cs | 1548 ++ .../FornecedorView.cs | 432 + .../InfoExtratoView.cs | 148 + .../PlanoView.cs | 116 + .../PlanosView.cs | 326 + .../BaseUserControl.cs | 102 + .../DragOverPopup.cs | 61 + .../ErrorWindow.cs | 110 + .../HosterWindow.cs | 524 + .../DashboardView.cs | 926 ++ .../MenuItensView.cs | 374 + .../RelatorioView.cs | 1116 ++ .../SinteticoView.cs | 509 + .../AeronauticoView.cs | 373 + .../AutoView.cs | 660 + .../BuscarModeloView.cs | 83 + .../ConsorcioView.cs | 312 + .../GranizoView.cs | 378 + .../PatrimonialView.cs | 480 + .../RiscosDiversosView.cs | 670 + .../VidaView.cs | 690 + .../ApoliceView.cs | 3255 +++++ .../ClienteView.cs | 1261 ++ .../ComissaoView.cs | 1028 ++ .../ConsultaOriginalView.cs | 1317 ++ .../CriticaApoliceView.cs | 1658 +++ .../PerfilEmpresaView.cs | 261 + .../Gestor.Application.Views.Seguros/PerfilView.cs | 363 + .../SinistroView.cs | 862 ++ .../TrocarClienteView.cs | 160 + .../ConnectionRetryView.cs | 267 + Decompiler/Gestor.Application.Views/ImportView.cs | 72 + Decompiler/Gestor.Application.Views/LoginWindow.cs | 752 + .../Gestor.Application.Views/TutorialView.cs | 395 + Decompiler/Gestor.Application.csproj | 949 ++ Decompiler/Gestor.Application/App.cs | 241 + Decompiler/Gestor.Application/MainWindow.cs | 2788 ++++ Decompiler/IWshRuntimeLibrary/IWshShell.cs | 12 + Decompiler/IWshRuntimeLibrary/IWshShell2.cs | 12 + Decompiler/IWshRuntimeLibrary/IWshShell3.cs | 18 + Decompiler/IWshRuntimeLibrary/IWshShortcut.cs | 102 + Decompiler/IWshRuntimeLibrary/WshShell.cs | 13 + .../Microsoft.Office.Interop.Excel/AppEvents.cs | 13 + .../AppEvents_Event.cs | 12 + .../Microsoft.Office.Interop.Excel/Application.cs | 13 + .../Microsoft.Office.Interop.Excel/DocEvents.cs | 13 + .../DocEvents_Event.cs | 12 + Decompiler/Microsoft.Office.Interop.Excel/Range.cs | 63 + .../Microsoft.Office.Interop.Excel/Sheets.cs | 21 + .../Microsoft.Office.Interop.Excel/Workbook.cs | 13 + .../WorkbookEvents.cs | 13 + .../WorkbookEvents_Event.cs | 12 + .../Microsoft.Office.Interop.Excel/Workbooks.cs | 22 + .../Microsoft.Office.Interop.Excel/Worksheet.cs | 13 + .../Microsoft.Office.Interop.Excel/_Application.cs | 41 + .../Microsoft.Office.Interop.Excel/_Workbook.cs | 22 + .../Microsoft.Office.Interop.Excel/_Worksheet.cs | 23 + Decompiler/Properties/AssemblyInfo.cs | 27 + Decompiler/app.baml | Bin 0 -> 82575 bytes Decompiler/app.ico | Bin 0 -> 120561 bytes .../assets/images/aggilizadordimgrayicon.png | Bin 0 -> 2993 bytes Decompiler/assets/images/aggilizadoricon.png | Bin 0 -> 1056 bytes Decompiler/assets/images/appstore.png | Bin 0 -> 6699 bytes .../assets/images/background_novo_gestor.png | Bin 0 -> 91606 bytes Decompiler/assets/images/backgroung_gestor.png | Bin 0 -> 150388 bytes Decompiler/assets/images/calculoicon.png | Bin 0 -> 96863 bytes Decompiler/assets/images/calculoiconoff.png | Bin 0 -> 95787 bytes Decompiler/assets/images/calculoiconok.png | Bin 0 -> 133556 bytes Decompiler/assets/images/gestor_loading.gif | Bin 0 -> 237509 bytes Decompiler/assets/images/gestor_splash_branco.gif | Bin 0 -> 340864 bytes Decompiler/assets/images/loading.gif | Bin 0 -> 141943 bytes Decompiler/assets/images/logo_novo_agger.png | Bin 0 -> 6537 bytes .../assets/images/logo_novo_gestor_branco.png | Bin 0 -> 13084 bytes Decompiler/assets/images/playstore.png | Bin 0 -> 15329 bytes Decompiler/assets/images/siggner_logo.png | Bin 0 -> 25021 bytes Decompiler/componentes/calculocontrol.baml | Bin 0 -> 2059 bytes Decompiler/componentes/coberturaview.baml | Bin 0 -> 6182 bytes Decompiler/componentes/contasdialog.baml | Bin 0 -> 2084 bytes Decompiler/componentes/customlegendchart.baml | Bin 0 -> 1363 bytes Decompiler/componentes/custompasswordbox.baml | Bin 0 -> 2322 bytes Decompiler/componentes/customsenhaloginbox.baml | Bin 0 -> 2528 bytes Decompiler/componentes/defaultdialog.baml | Bin 0 -> 1838 bytes Decompiler/componentes/dialogadvertising.baml | Bin 0 -> 2494 bytes Decompiler/componentes/dialoganaliticobi.baml | Bin 0 -> 3698 bytes Decompiler/componentes/dialoganexar.baml | Bin 0 -> 2084 bytes Decompiler/componentes/dialogcopia.baml | Bin 0 -> 3525 bytes Decompiler/componentes/dialogcopiarcliente.baml | Bin 0 -> 3094 bytes Decompiler/componentes/dialogcopiarpermissao.baml | Bin 0 -> 3042 bytes Decompiler/componentes/dialogdetalheextrato.baml | Bin 0 -> 4133 bytes Decompiler/componentes/dialogeditarparcelas.baml | Bin 0 -> 4197 bytes Decompiler/componentes/dialogenviaremails.baml | Bin 0 -> 3263 bytes .../componentes/dialogexportarpermissao.baml | Bin 0 -> 4595 bytes Decompiler/componentes/dialogextratocomissao.baml | Bin 0 -> 4288 bytes Decompiler/componentes/dialoggrafico.baml | Bin 0 -> 2828 bytes Decompiler/componentes/dialoghoster.baml | Bin 0 -> 1831 bytes Decompiler/componentes/dialoginstalacoes.baml | Bin 0 -> 3006 bytes Decompiler/componentes/dialoglogacesso.baml | Bin 0 -> 2918 bytes Decompiler/componentes/dialogmedalha.baml | Bin 0 -> 4295 bytes Decompiler/componentes/dialogobservacao.baml | Bin 0 -> 1742 bytes Decompiler/componentes/dialogpesquisaavancada.baml | Bin 0 -> 5853 bytes Decompiler/componentes/dialogprint.baml | Bin 0 -> 4295 bytes Decompiler/componentes/dialogprotocolo.baml | Bin 0 -> 4067 bytes Decompiler/componentes/dialogreordenaritens.baml | Bin 0 -> 3540 bytes Decompiler/componentes/dialogselecionaritens.baml | Bin 0 -> 3624 bytes Decompiler/componentes/dialogsenhaadm.baml | Bin 0 -> 2292 bytes Decompiler/componentes/dialogtarefa.baml | Bin 0 -> 8997 bytes Decompiler/componentes/dialogtransferencia.baml | Bin 0 -> 3576 bytes Decompiler/componentes/dialogtrilha.baml | Bin 0 -> 3844 bytes Decompiler/componentes/dialogvinculo.baml | Bin 0 -> 5062 bytes Decompiler/componentes/errordialog.baml | Bin 0 -> 2223 bytes Decompiler/componentes/gridrelatorio.baml | Bin 0 -> 6741 bytes Decompiler/componentes/loading.baml | Bin 0 -> 1216 bytes Decompiler/componentes/passbox.baml | Bin 0 -> 2391 bytes Decompiler/componentes/progressdialog.baml | Bin 0 -> 1276 bytes Decompiler/componentes/prospeccaodialog.baml | Bin 0 -> 12301 bytes .../componentes/vincularlancamentodialog.baml | Bin 0 -> 4672 bytes Decompiler/componentes/webbrowser.baml | Bin 0 -> 872 bytes Decompiler/componentes/webeditor.baml | Bin 0 -> 6688 bytes Decompiler/drawers/adiantamentodrawerview.baml | Bin 0 -> 8328 bytes Decompiler/drawers/agendadrawer.baml | Bin 0 -> 12388 bytes .../drawers/ajuda/boletosnotasdrawerview.baml | Bin 0 -> 5080 bytes Decompiler/drawers/ajuda/contratosdrawerview.baml | Bin 0 -> 3690 bytes Decompiler/drawers/ajuda/instalacaodrawerview.baml | Bin 0 -> 7040 bytes Decompiler/drawers/arquivodigitaldrawer.baml | Bin 0 -> 11267 bytes .../drawers/configuracoes/configuracoesdrawer.baml | Bin 0 -> 5119 bytes Decompiler/drawers/expedicaodrawer.baml | Bin 0 -> 6655 bytes Decompiler/drawers/extratosdrawer.baml | Bin 0 -> 9166 bytes Decompiler/drawers/impostodrawer.baml | Bin 0 -> 8360 bytes .../drawers/inclusaoarquivodigitaldrawer.baml | Bin 0 -> 4315 bytes Decompiler/drawers/infodrawer.baml | Bin 0 -> 9449 bytes Decompiler/drawers/logdrawer.baml | Bin 0 -> 10421 bytes Decompiler/drawers/logemaildrawer.baml | Bin 0 -> 6428 bytes Decompiler/drawers/logsistemaantigo.baml | Bin 0 -> 2037 bytes Decompiler/drawers/logutilizacaodrawer.baml | Bin 0 -> 3430 bytes Decompiler/drawers/metaseguradoraview.baml | Bin 0 -> 6647 bytes Decompiler/drawers/metavendedorview.baml | Bin 0 -> 6419 bytes Decompiler/drawers/observacoesdrawer.baml | Bin 0 -> 3440 bytes Decompiler/drawers/permissaousuariodrawer.baml | Bin 0 -> 18388 bytes .../drawers/relatorios/configuracaorelatorio.baml | Bin 0 -> 6818 bytes Decompiler/drawers/relatorios/filtrorelatorio.baml | Bin 0 -> 7373 bytes Decompiler/drawers/tarefadrawer.baml | Bin 0 -> 13069 bytes Decompiler/drawers/valoresapolicedrawer.baml | Bin 0 -> 5701 bytes Decompiler/drawers/valoresparceladrawer.baml | Bin 0 -> 9352 bytes Decompiler/drawers/vinculovendedordrawer.baml | Bin 0 -> 4913 bytes Decompiler/iconesistema.ico | Bin 0 -> 120561 bytes Decompiler/iconesistema2024.ico | Bin 0 -> 39418 bytes Decompiler/mainwindow.baml | Bin 0 -> 28978 bytes Decompiler/mshtml/DispHTMLDocument.cs | 85 + Decompiler/mshtml/HTMLDocument.cs | 13 + Decompiler/mshtml/HTMLDocumentEvents.cs | 13 + Decompiler/mshtml/HTMLDocumentEvents_Event.cs | 12 + Decompiler/mshtml/IHTMLElement.cs | 41 + Decompiler/mshtml/IHTMLSelectionObject.cs | 16 + Decompiler/mshtml/IHTMLTxtRange.cs | 26 + Decompiler/styles/buttons.baml | Bin 0 -> 1294 bytes Decompiler/styles/colors.baml | Bin 0 -> 2169 bytes Decompiler/styles/fonts.baml | Bin 0 -> 1268 bytes Decompiler/styles/texts.baml | Bin 0 -> 1015 bytes Decompiler/views/ajuda/atendimentosview.baml | Bin 0 -> 8137 bytes Decompiler/views/bi/acompanhamentoview.baml | Bin 0 -> 4156 bytes Decompiler/views/bi/agendabiview.baml | Bin 0 -> 1198 bytes Decompiler/views/bi/notasview.baml | Bin 0 -> 6968 bytes Decompiler/views/bi/painelbiview.baml | Bin 0 -> 14132 bytes Decompiler/views/bi/prospeccaoview.baml | Bin 0 -> 8050 bytes Decompiler/views/bi/tarefaview.baml | Bin 0 -> 14571 bytes Decompiler/views/connectionretryview.baml | Bin 0 -> 3412 bytes .../views/ferramentas/cadastroemailview.baml | Bin 0 -> 10116 bytes .../views/ferramentas/cadastroparceiroview.baml | Bin 0 -> 9052 bytes Decompiler/views/ferramentas/downloadwindow.baml | Bin 0 -> 3602 bytes Decompiler/views/ferramentas/empresaview.baml | Bin 0 -> 14324 bytes Decompiler/views/ferramentas/estipulanteview.baml | Bin 0 -> 9951 bytes Decompiler/views/ferramentas/etiquetaview.baml | Bin 0 -> 7962 bytes Decompiler/views/ferramentas/incluirramoview.baml | Bin 0 -> 3301 bytes .../views/ferramentas/incluirseguradoraview.baml | Bin 0 -> 3331 bytes Decompiler/views/ferramentas/maladiretaview.baml | Bin 0 -> 10795 bytes .../ferramentas/manutencaopagamentosview.baml | Bin 0 -> 11413 bytes Decompiler/views/ferramentas/notafiscalview.baml | Bin 0 -> 9921 bytes Decompiler/views/ferramentas/produtoview.baml | Bin 0 -> 5995 bytes .../views/ferramentas/protocolodocumentosview.baml | Bin 0 -> 7325 bytes Decompiler/views/ferramentas/qualificacaoview.baml | Bin 0 -> 9707 bytes Decompiler/views/ferramentas/ramoview.baml | Bin 0 -> 7874 bytes Decompiler/views/ferramentas/reciboview.baml | Bin 0 -> 9960 bytes Decompiler/views/ferramentas/seguradoraview.baml | Bin 0 -> 17523 bytes Decompiler/views/ferramentas/socioview.baml | Bin 0 -> 7126 bytes .../views/ferramentas/statusprospeccaoview.baml | Bin 0 -> 6574 bytes Decompiler/views/ferramentas/statusview.baml | Bin 0 -> 6399 bytes Decompiler/views/ferramentas/tipotarefaview.baml | Bin 0 -> 6497 bytes Decompiler/views/ferramentas/tipovendedorview.baml | Bin 0 -> 6356 bytes Decompiler/views/ferramentas/usuarioview.baml | Bin 0 -> 18379 bytes Decompiler/views/ferramentas/vendedorview.baml | Bin 0 -> 21084 bytes Decompiler/views/financeiro/bancoscontasview.baml | Bin 0 -> 10712 bytes Decompiler/views/financeiro/centrodecustoview.baml | Bin 0 -> 5631 bytes Decompiler/views/financeiro/extratowindow.baml | Bin 0 -> 7351 bytes Decompiler/views/financeiro/financeiroview.baml | Bin 0 -> 28407 bytes Decompiler/views/financeiro/fornecedorview.baml | Bin 0 -> 12757 bytes Decompiler/views/financeiro/infoextratoview.baml | Bin 0 -> 2554 bytes Decompiler/views/financeiro/planosview.baml | Bin 0 -> 7321 bytes Decompiler/views/financeiro/planoview.baml | Bin 0 -> 3353 bytes .../relatorios/fechamentofinanceiroview.baml | Bin 0 -> 7018 bytes Decompiler/views/generic/dragoverpopup.baml | Bin 0 -> 1362 bytes Decompiler/views/generic/errorwindow.baml | Bin 0 -> 2067 bytes Decompiler/views/generic/hosterwindow.baml | Bin 0 -> 3175 bytes Decompiler/views/importview.baml | Bin 0 -> 1585 bytes Decompiler/views/loginwindow.baml | Bin 0 -> 10058 bytes Decompiler/views/menus/dashboardview.baml | Bin 0 -> 17950 bytes Decompiler/views/menus/menuitensview.baml | Bin 0 -> 7003 bytes Decompiler/views/relatorios/relatorioview.baml | Bin 0 -> 21701 bytes Decompiler/views/relatorios/sinteticoview.baml | Bin 0 -> 5791 bytes Decompiler/views/seguros/apoliceview.baml | Bin 0 -> 39821 bytes Decompiler/views/seguros/clienteview.baml | Bin 0 -> 28913 bytes Decompiler/views/seguros/comissaoview.baml | Bin 0 -> 24736 bytes Decompiler/views/seguros/consultaoriginalview.baml | Bin 0 -> 20585 bytes Decompiler/views/seguros/criticaapoliceview.baml | Bin 0 -> 28348 bytes .../views/seguros/itens/aeronauticoview.baml | Bin 0 -> 9100 bytes Decompiler/views/seguros/itens/autoview.baml | Bin 0 -> 14613 bytes .../views/seguros/itens/buscarmodeloview.baml | Bin 0 -> 4850 bytes Decompiler/views/seguros/itens/consorcioview.baml | Bin 0 -> 7526 bytes Decompiler/views/seguros/itens/granizoview.baml | Bin 0 -> 8131 bytes .../views/seguros/itens/patrimonialview.baml | Bin 0 -> 12635 bytes .../views/seguros/itens/riscosdiversosview.baml | Bin 0 -> 17580 bytes Decompiler/views/seguros/itens/vidaview.baml | Bin 0 -> 19664 bytes Decompiler/views/seguros/perfilempresaview.baml | Bin 0 -> 8068 bytes Decompiler/views/seguros/perfilview.baml | Bin 0 -> 10141 bytes Decompiler/views/seguros/sinistroview.baml | Bin 0 -> 23404 bytes Decompiler/views/seguros/trocarclienteview.baml | Bin 0 -> 3259 bytes Decompiler/views/tutorialview.baml | Bin 0 -> 9804 bytes 913 files changed, 168761 insertions(+) create mode 100644 Decompiler/Gestor.Application.Actions/Actions.cs create mode 100644 Decompiler/Gestor.Application.Componentes/CalculoControl.cs create mode 100644 Decompiler/Gestor.Application.Componentes/CoberturaView.cs create mode 100644 Decompiler/Gestor.Application.Componentes/ContasDialog.cs create mode 100644 Decompiler/Gestor.Application.Componentes/CustomIsReadOnlyControl.cs create mode 100644 Decompiler/Gestor.Application.Componentes/CustomItemControl.cs create mode 100644 Decompiler/Gestor.Application.Componentes/CustomItemValidation.cs create mode 100644 Decompiler/Gestor.Application.Componentes/CustomLegendChart.cs create mode 100644 Decompiler/Gestor.Application.Componentes/CustomPasswordBox.cs create mode 100644 Decompiler/Gestor.Application.Componentes/CustomSenhaLoginBox.cs create mode 100644 Decompiler/Gestor.Application.Componentes/CustomSeriesViewModel.cs create mode 100644 Decompiler/Gestor.Application.Componentes/DefaultDialog.cs create mode 100644 Decompiler/Gestor.Application.Componentes/DialogAdvertising.cs create mode 100644 Decompiler/Gestor.Application.Componentes/DialogAnaliticoBi.cs create mode 100644 Decompiler/Gestor.Application.Componentes/DialogAnexar.cs create mode 100644 Decompiler/Gestor.Application.Componentes/DialogCopia.cs create mode 100644 Decompiler/Gestor.Application.Componentes/DialogCopiarCliente.cs create mode 100644 Decompiler/Gestor.Application.Componentes/DialogCopiarPermissao.cs create mode 100644 Decompiler/Gestor.Application.Componentes/DialogDetalheExtrato.cs create mode 100644 Decompiler/Gestor.Application.Componentes/DialogEditarParcelas.cs create mode 100644 Decompiler/Gestor.Application.Componentes/DialogEnviarEmails.cs create mode 100644 Decompiler/Gestor.Application.Componentes/DialogExportarPermissao.cs create mode 100644 Decompiler/Gestor.Application.Componentes/DialogExtratoComissao.cs create mode 100644 Decompiler/Gestor.Application.Componentes/DialogGrafico.cs create mode 100644 Decompiler/Gestor.Application.Componentes/DialogHoster.cs create mode 100644 Decompiler/Gestor.Application.Componentes/DialogInstalacoes.cs create mode 100644 Decompiler/Gestor.Application.Componentes/DialogLogAcesso.cs create mode 100644 Decompiler/Gestor.Application.Componentes/DialogMedalha.cs create mode 100644 Decompiler/Gestor.Application.Componentes/DialogObservacao.cs create mode 100644 Decompiler/Gestor.Application.Componentes/DialogPesquisaAvancada.cs create mode 100644 Decompiler/Gestor.Application.Componentes/DialogPrint.cs create mode 100644 Decompiler/Gestor.Application.Componentes/DialogProtocolo.cs create mode 100644 Decompiler/Gestor.Application.Componentes/DialogReordenarItens.cs create mode 100644 Decompiler/Gestor.Application.Componentes/DialogSelecionarItens.cs create mode 100644 Decompiler/Gestor.Application.Componentes/DialogSenhaAdm.cs create mode 100644 Decompiler/Gestor.Application.Componentes/DialogTarefa.cs create mode 100644 Decompiler/Gestor.Application.Componentes/DialogTransferencia.cs create mode 100644 Decompiler/Gestor.Application.Componentes/DialogTrilha.cs create mode 100644 Decompiler/Gestor.Application.Componentes/DialogVinculo.cs create mode 100644 Decompiler/Gestor.Application.Componentes/ErrorDialog.cs create mode 100644 Decompiler/Gestor.Application.Componentes/GridRelatorio.cs create mode 100644 Decompiler/Gestor.Application.Componentes/Loading.cs create mode 100644 Decompiler/Gestor.Application.Componentes/NRecoHtmlToPdfConverter.cs create mode 100644 Decompiler/Gestor.Application.Componentes/PassBox.cs create mode 100644 Decompiler/Gestor.Application.Componentes/ProgressDialog.cs create mode 100644 Decompiler/Gestor.Application.Componentes/ProspeccaoDialog.cs create mode 100644 Decompiler/Gestor.Application.Componentes/VincularLancamentoDialog.cs create mode 100644 Decompiler/Gestor.Application.Componentes/WebBrowser.cs create mode 100644 Decompiler/Gestor.Application.Componentes/WebEditor.cs create mode 100644 Decompiler/Gestor.Application.Converters/ActualHeightConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/ArquivoDigitalVisibilityConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/AssinaturasVisibilityConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/AssistenciaVisibilityConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/AtivoToColorConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/AtivoToStringConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/BaixarVisibilityConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/BoletosNotasConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/BoolToGridHeightOneStarConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/CalculoIconConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/ColorStatusConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/ContatoSeguradoraVisibiltyConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/DesconsiderarVisibilityConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/DiasPentendesConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/DocumentoEtiquetaConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/EmpresaNomeConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/EnderecoConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/EnviadoColorConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/EnviadoConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/EnviadoIconConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/EnviadoTooTipConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/EqualToCollapsedConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/ExcluidoStringConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/ExcluirVendedorLabelConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/ExpanderHeaderConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/ExtensaoVisibilityConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/FaturaVisibilityConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/FilialStringConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/IdVisibilityConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/IncluirApoliceEnabledConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/IntToMedalConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/IntToMedalTextConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/IntToVisibilityConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/InvertedBoolToGridHeightOneStarConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/IsNamedObjectVisibilityConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/ManutencaoPagamentoGroupHeaderConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/MenosZeroVirgulaZeroUmConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/MimeIconConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/ModeloExisteTooltipConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/MultiBoolReadOnly.cs create mode 100644 Decompiler/Gestor.Application.Converters/MultiBoolToVisibilityConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/MultiVisibilityConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/NullToFalseConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/NullToTrueConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/PackIconToImage.cs create mode 100644 Decompiler/Gestor.Application.Converters/PackIconToImageConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/RamoToImageConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/ResultadoToBoolConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/StatusComissaoAutomaticaTooltipConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/StatusIconConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/StatusPagamentoColorConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/StatusPagamentoVisibilityConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/StringToFontWeightConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/StringToStringFontWeightCleanConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/SubTipoEnableConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/TelaRelatorioConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/TelefoneToVisibilityConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/TextInputToVisibilityConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/TipoDependenteToVisibilityConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/TipoEmailVisibilityConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/TipoRepasseGlobalFilterConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/TipoRepasseVendedorVisibilityConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/TipoRepasseVisibilityConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/TipoSinistroConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/TipoTelefoneVisibilityConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/TootipStatusConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/TypeVisibilityConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/ValorTipoConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/VariavelExisteColorConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/VariavelExisteTooltipConverter.cs create mode 100644 Decompiler/Gestor.Application.Converters/VerApoliceComissaoConverter.cs create mode 100644 Decompiler/Gestor.Application.Drawers.Ajuda/BoletosNotasDrawerView.cs create mode 100644 Decompiler/Gestor.Application.Drawers.Ajuda/ContratosDrawerView.cs create mode 100644 Decompiler/Gestor.Application.Drawers.Ajuda/InstalacaoDrawerView.cs create mode 100644 Decompiler/Gestor.Application.Drawers.Configuracoes/ConfiguracoesDrawer.cs create mode 100644 Decompiler/Gestor.Application.Drawers.Relatorios/ConfiguracaoRelatorio.cs create mode 100644 Decompiler/Gestor.Application.Drawers.Relatorios/FiltroRelatorio.cs create mode 100644 Decompiler/Gestor.Application.Drawers/AdiantamentoDrawerView.cs create mode 100644 Decompiler/Gestor.Application.Drawers/AgendaDrawer.cs create mode 100644 Decompiler/Gestor.Application.Drawers/ArquivoDigitalDrawer.cs create mode 100644 Decompiler/Gestor.Application.Drawers/ExpedicaoDrawer.cs create mode 100644 Decompiler/Gestor.Application.Drawers/ExtratosDrawer.cs create mode 100644 Decompiler/Gestor.Application.Drawers/ImpostoDrawer.cs create mode 100644 Decompiler/Gestor.Application.Drawers/InclusaoArquivoDigitalDrawer.cs create mode 100644 Decompiler/Gestor.Application.Drawers/InfoDrawer.cs create mode 100644 Decompiler/Gestor.Application.Drawers/LogDrawer.cs create mode 100644 Decompiler/Gestor.Application.Drawers/LogEmailDrawer.cs create mode 100644 Decompiler/Gestor.Application.Drawers/LogSistemaAntigo.cs create mode 100644 Decompiler/Gestor.Application.Drawers/LogUtilizacaoDrawer.cs create mode 100644 Decompiler/Gestor.Application.Drawers/MetaSeguradoraView.cs create mode 100644 Decompiler/Gestor.Application.Drawers/MetaVendedorView.cs create mode 100644 Decompiler/Gestor.Application.Drawers/ObservacoesDrawer.cs create mode 100644 Decompiler/Gestor.Application.Drawers/PermissaoUsuarioDrawer.cs create mode 100644 Decompiler/Gestor.Application.Drawers/TarefaDrawer.cs create mode 100644 Decompiler/Gestor.Application.Drawers/ValoresApoliceDrawer.cs create mode 100644 Decompiler/Gestor.Application.Drawers/ValoresParcelaDrawer.cs create mode 100644 Decompiler/Gestor.Application.Drawers/VinculoVendedorDrawer.cs create mode 100644 Decompiler/Gestor.Application.Helpers/ApplicationHelper.cs create mode 100644 Decompiler/Gestor.Application.Helpers/ArquivoDigital.cs create mode 100644 Decompiler/Gestor.Application.Helpers/AssinadorHelper.cs create mode 100644 Decompiler/Gestor.Application.Helpers/BindingEnumHelper.cs create mode 100644 Decompiler/Gestor.Application.Helpers/BindingHelper.cs create mode 100644 Decompiler/Gestor.Application.Helpers/Connection.cs create mode 100644 Decompiler/Gestor.Application.Helpers/ConnectionHelper.cs create mode 100644 Decompiler/Gestor.Application.Helpers/CustomLinq.cs create mode 100644 Decompiler/Gestor.Application.Helpers/DataGridExtensions.cs create mode 100644 Decompiler/Gestor.Application.Helpers/Erro.cs create mode 100644 Decompiler/Gestor.Application.Helpers/Funcoes.cs create mode 100644 Decompiler/Gestor.Application.Helpers/HttpHelper.cs create mode 100644 Decompiler/Gestor.Application.Helpers/Instancia.cs create mode 100644 Decompiler/Gestor.Application.Helpers/InstanciaAssinador.cs create mode 100644 Decompiler/Gestor.Application.Helpers/LicenseHelper.cs create mode 100644 Decompiler/Gestor.Application.Helpers/MailHelper.cs create mode 100644 Decompiler/Gestor.Application.Helpers/NotifyPropertyChangedExtension.cs create mode 100644 Decompiler/Gestor.Application.Helpers/ObrigatorioValidationRule.cs create mode 100644 Decompiler/Gestor.Application.Helpers/PasswordBoxAssistant.cs create mode 100644 Decompiler/Gestor.Application.Helpers/PipeClient.cs create mode 100644 Decompiler/Gestor.Application.Helpers/PipeServer.cs create mode 100644 Decompiler/Gestor.Application.Helpers/QueryableHelper.cs create mode 100644 Decompiler/Gestor.Application.Helpers/Recursos.cs create mode 100644 Decompiler/Gestor.Application.Helpers/TipoToggle.cs create mode 100644 Decompiler/Gestor.Application.Helpers/ViewHelper.cs create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200219_01.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200219_02.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200219_03.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200219_04.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200219_05.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200219_06.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200311_07.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200311_08.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200403_09.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200403_10.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200403_11.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200403_12.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200403_13.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200403_14.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200403_15.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200403_16.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200403_17.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200403_18.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200403_19.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200403_20.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200403_21.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200403_22.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200403_23.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200406_24.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200406_25.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200406_26.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200408_27.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200408_28.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200408_29.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200408_30.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200408_31.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200408_32.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200419_33.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200419_34.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200430_35.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200505_36.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200505_37.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200505_38.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200505_39.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200506_40.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200512_41.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200512_42.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200512_43.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200514_44.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200514_45.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200520_46.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200520_47.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200525_48.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200527_49.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200527_50.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200612_51.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200702_52.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200709_53.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200714_54.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200714_55.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200716_56.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200730_57.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200811_58.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200817_59.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200818_60.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200820_61.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200820_62.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200820_63.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200825_64.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200831_65.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200914_66.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200915_67.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200924_68.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200925_69.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20200929_70.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20201001_71.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20201007_72.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20201007_73.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20201008_74.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20201015_75.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20201026_76.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20201027_77.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20201028_78.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20201030_79.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20201104_80.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20201112_81.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20201113_82.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20201117_83.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20201127_84.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20201127_85.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20201127_86.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20201127_87.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20201127_88.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20201127_89.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20201201_90.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20201203_91.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20201203_92.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20201210_93.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20201230_94.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210107_95.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210118_96.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210209_97.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210217_98.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210217_99.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210301_100.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210302_101.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210302_102.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210302_103.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210309_104.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210309_105.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210315_106.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210315_107-.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210323_108.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210323_109.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210324_110.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210324_111.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210329_112.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210408_113.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210415_114-.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210415_115-.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210415_116.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210426_117.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210510_118.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210512_119.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210524_120.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210525_121.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210607_122.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210610_123.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210610_124.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210610_125.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210610_126.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210610_127.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210610_128.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210610_129.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210610_130.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210610_131.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210610_132.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210614_133-.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210614_134.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210614_135.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210614_136.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210614_137.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210614_138.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210614_139.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210614_140.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210614_141.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210614_142.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210614_143.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210614_144.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210614_145.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210614_146.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210615_147.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210615_148.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210615_149.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210615_150.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210615_151.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210615_152.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210615_153.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210615_154.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210615_155.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210615_156.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210615_157.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210615_158.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210615_159.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210615_160.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210622_161.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210622_162.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210622_163.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210622_164.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210629_165.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210708_166-.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210708_167.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210708_168-.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210722_169.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210819_170.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210820_171.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210823_172.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210825_173.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210825_174.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210910_175.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210916_176.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20210916_177.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20211104_178.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20211223_179.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20211230_180.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20211230_181.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20220104_182.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20220105_183.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20220112_184.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20220119_185.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20220119_186.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20220131_187.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20220225_190.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20220225_191.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20220307_192.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20220315_193.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20220321_194.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20220325_195.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20220329_196.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20220330_197.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20220404_198.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20220404_199.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20220408_200.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20220413_201.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20220419_202.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20220419_203.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20220429_204.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20220502_205-.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20220502_206-.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20220603_207.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20220608_208.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20220726_209.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20220804_210.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20220817_211.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20220926_212-.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20220929_213-.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20221007_214-.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20221018_215-.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20221028_216.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20221110_217.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20221110_218.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20230208_219.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20230301_220.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20230308_221.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20230502_222.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20230619_223.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20230619_224.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20230705_225.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20230718_226.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20230727_227.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20230807_228-.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20230829_229-.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20231011_230.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20231024_231.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20231031_232.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20240131_233.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20240131_234.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20240322_235.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20240322_236.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20240325_237.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20240415_238.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20240422_239.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20240521_240.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20240522_241.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20240604_242.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20240708_243.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20240722_244.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20240723_245.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20240724_246.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20240729_247.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20240816_248.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20240821_249.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20240821_250.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20240826_251.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20240902_252.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20240919_253.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20241015_254.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20250204_255.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20250210_256.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20250307_257-.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20250314_258-.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20250314_259-.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20250328_260.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20250331_261.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20250401_262-.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20250423_263.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20250424_264.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20250425_265.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20250523_266.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20250625_267.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20250625_268.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20250728_269.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20250815_270.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20250905_271.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20250908_272.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20250909_273.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20250919_274.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20250926_275.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20251002_276.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20251010_277.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20251014_278.SQL create mode 100644 Decompiler/Gestor.Application.Migration.Files.20251030_279.SQL create mode 100644 Decompiler/Gestor.Application.Migration/Migrator.cs create mode 100644 Decompiler/Gestor.Application.Model.Ajuda/Atendimento.cs create mode 100644 Decompiler/Gestor.Application.Model.Ajuda/Boleto.cs create mode 100644 Decompiler/Gestor.Application.Model.Ajuda/Contrato.cs create mode 100644 Decompiler/Gestor.Application.Model.Ajuda/EmailAtendimento.cs create mode 100644 Decompiler/Gestor.Application.Model.Ajuda/Instalacao.cs create mode 100644 Decompiler/Gestor.Application.Model/AnaliticoSource.cs create mode 100644 Decompiler/Gestor.Application.Model/Configuracoes.cs create mode 100644 Decompiler/Gestor.Application.Model/Grafico.cs create mode 100644 Decompiler/Gestor.Application.Model/RelacaoItens.cs create mode 100644 Decompiler/Gestor.Application.Model/SinteticoSource.cs create mode 100644 Decompiler/Gestor.Application.Properties.Resources.resx create mode 100644 Decompiler/Gestor.Application.Properties/Resources.cs create mode 100644 Decompiler/Gestor.Application.Properties/Settings.cs create mode 100644 Decompiler/Gestor.Application.Servicos.Ajuda/AjudaServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos.Configuracoes/ConfuguracoesServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos.Ferramentas/AdiantamentoServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos.Ferramentas/AgendaServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos.Ferramentas/EmailServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos.Ferramentas/EmpresaServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos.Ferramentas/EstipulanteServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos.Ferramentas/ImpostoServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos.Ferramentas/MetaSeguradoraServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos.Ferramentas/MetaVendedorServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos.Ferramentas/NotaFiscalServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos.Ferramentas/ProdutoServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos.Ferramentas/QualificacaoServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos.Ferramentas/RamoServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos.Ferramentas/ReciboServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos.Ferramentas/SeguradoraServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos.Ferramentas/SocioServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos.Ferramentas/StatusProspeccaoServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos.Ferramentas/StatusServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos.Ferramentas/TipoTarefaServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos.Ferramentas/TipoVendedorServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos.Ferramentas/UsuarioServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos.Ferramentas/VendedorServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos.Financeiro/BancosContasServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos.Financeiro/CentroServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos.Financeiro/FinanceiroServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos.Financeiro/FornecedorServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos.Financeiro/PlanoServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos.Financeiro/PlanosServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos.Generic/BaseServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos.Seguros.Itens/AeronauticoServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos.Seguros.Itens/AutoServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos.Seguros.Itens/ConsorcioServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos.Seguros.Itens/GranizoServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos.Seguros.Itens/ItemServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos.Seguros.Itens/PatrimonialServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos.Seguros.Itens/RiscosDiversosServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos.Seguros.Itens/VidaServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos.Seguros/ApoliceServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos.Seguros/AtividadeServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos.Seguros/ClienteServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos.Seguros/CriticaApoliceServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos.Seguros/ExpedicaoServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos.Seguros/PerfilEmpresaServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos.Seguros/PerfilServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos.Seguros/ProfissaoServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos.Seguros/SinistroServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos/ArquivoDigitalServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos/AssinaturaServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos/CepService.cs create mode 100644 Decompiler/Gestor.Application.Servicos/LogServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos/MalaDiretaServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos/ParceiroServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos/ParcelaServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos/PermissaoArquivoDigitalServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos/PermissaoUsuarioServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos/ProspeccaoServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos/RestricaoUsuarioServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos/ServicoExtrato.cs create mode 100644 Decompiler/Gestor.Application.Servicos/TarefaServico.cs create mode 100644 Decompiler/Gestor.Application.Servicos/VendedorUsuarioServico.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.BI/BISeriesViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.BI/NotasViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.BI/PainelBiViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.BI/ProspeccaoViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.BI/TarefaBIViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Comissao/ComissaoViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Command/RelayCommand.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Configuracoes/ConfiguracoesViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Drawer.Ajuda/AtendimentosViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Drawer.Ajuda/BoletosNotasViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Drawer.Ajuda/ContratosViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Drawer.Ajuda/InstalacaoViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Drawer/AdiantamentoViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Drawer/AgendaViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Drawer/ArquivoDigitalViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Drawer/ExpedicaoViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Drawer/ExtratosViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Drawer/ImpostoViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Drawer/InfoViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Drawer/LogAcaoViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Drawer/LogEmailViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Drawer/LogSistemaAntigoViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Drawer/LogViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Drawer/MetaSeguradoraViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Drawer/MetaVendedorViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Drawer/PermissaoUsuarioViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Drawer/TarefaDrawerViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Drawer/ValoresApoliceViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Drawer/ValoresParcelaViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Drawer/VinculoVendedorViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Ferramentas/CadastroEmailViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Ferramentas/CadastroParceiroViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Ferramentas/ComboModelo.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Ferramentas/ComboVariavel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Ferramentas/DownloadViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Ferramentas/EmpresaViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Ferramentas/EstipulanteViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Ferramentas/EtiquetaViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Ferramentas/IncluirRamoViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Ferramentas/IncluirSeguradoraViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Ferramentas/MalaDiretaViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Ferramentas/ManutencaoPagamentosViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Ferramentas/NotaFiscalViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Ferramentas/ProdutoViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Ferramentas/ProtocoloDocumentosViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Ferramentas/ProtocoloEtiqueta.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Ferramentas/QualificacaoViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Ferramentas/RamoViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Ferramentas/ReciboViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Ferramentas/SeguradoraViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Ferramentas/SocioViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Ferramentas/StatusProspeccaoViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Ferramentas/StatusViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Ferramentas/TipoTarefaViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Ferramentas/TipoVendedorViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Ferramentas/UsuarioViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Ferramentas/VendedorViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Financeiro.Relatorios/FechamentoFinanceiroViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Financeiro/BancosContasViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Financeiro/CentroDeCustoViewmodel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Financeiro/ContasDialogModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Financeiro/CopiarClienteViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Financeiro/ExtratoContaViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Financeiro/FinanceiroViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Financeiro/FornecedorViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Financeiro/InfoExtratoViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Financeiro/MenuFinanceiroViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Financeiro/PlanoViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Financeiro/PlanosViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Financeiro/TranferenciaViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Generic/BaseApoliceViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Generic/BaseDialogViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Generic/BaseFinanceiroViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Generic/BaseSegurosViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Generic/BaseTarefaViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Generic/BaseViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Generic/DialogAdvertisingViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Generic/DialogAnexarViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Generic/DialogCopiaViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Generic/DialogCopiarPermissaoViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Generic/DialogEditarParcelasViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Generic/DialogEnviarEmailsViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Generic/DialogExportarPermissaoViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Generic/DialogGraficoViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Generic/DialogMedalhaViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Generic/DialogPesquisaAvancadaViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Generic/DialogProspeccaoViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Generic/DialogTarefaViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Generic/DialogTrilhaViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Generic/DialogViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Generic/DialogVinculoViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Generic/ErrorDialogViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Generic/ExtratoComissaoViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Generic/ItemViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Generic/ProtocoloViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Generic/ReordenarItensViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Generic/SelecionarItensViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Relatorios/DialogPrintViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Relatorios/RelatorioViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Relatorios/SinteticoViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Seguros.Itens/AeronauticoViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Seguros.Itens/AutoViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Seguros.Itens/BuscarModeloViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Seguros.Itens/ConsorcioViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Seguros.Itens/GranizoViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Seguros.Itens/PatrimonialViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Seguros.Itens/RiscosDiversosViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Seguros.Itens/VidaViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Seguros/ApoliceViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Seguros/ClienteViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Seguros/ConsultaViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Seguros/CriticaApoliceViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Seguros/PerfilEmpresaViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Seguros/PerfilViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Seguros/SinistroViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels.Seguros/TrocarClienteViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels/AnaliticoViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels/Arquivo.cs create mode 100644 Decompiler/Gestor.Application.ViewModels/CoberturaViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels/DashboardViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels/ImportViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels/LoginImageModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels/LoginViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels/MainViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels/MenuBIViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels/MenuFerramentasViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels/MenuItemViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels/TrilhaViewModel.cs create mode 100644 Decompiler/Gestor.Application.ViewModels/TutorialViewModel.cs create mode 100644 Decompiler/Gestor.Application.Views.Ajuda/AtendimentosView.cs create mode 100644 Decompiler/Gestor.Application.Views.BI/AcompanhamentoView.cs create mode 100644 Decompiler/Gestor.Application.Views.BI/AgendaBIView.cs create mode 100644 Decompiler/Gestor.Application.Views.BI/NotasView.cs create mode 100644 Decompiler/Gestor.Application.Views.BI/PainelBiView.cs create mode 100644 Decompiler/Gestor.Application.Views.BI/ProspeccaoView.cs create mode 100644 Decompiler/Gestor.Application.Views.BI/TarefaView.cs create mode 100644 Decompiler/Gestor.Application.Views.Ferramentas/CadastroEmailView.cs create mode 100644 Decompiler/Gestor.Application.Views.Ferramentas/CadastroParceiroView.cs create mode 100644 Decompiler/Gestor.Application.Views.Ferramentas/DownloadWindow.cs create mode 100644 Decompiler/Gestor.Application.Views.Ferramentas/EmpresaView.cs create mode 100644 Decompiler/Gestor.Application.Views.Ferramentas/EstipulanteView.cs create mode 100644 Decompiler/Gestor.Application.Views.Ferramentas/EtiquetaView.cs create mode 100644 Decompiler/Gestor.Application.Views.Ferramentas/IncluirRamoView.cs create mode 100644 Decompiler/Gestor.Application.Views.Ferramentas/IncluirSeguradoraView.cs create mode 100644 Decompiler/Gestor.Application.Views.Ferramentas/MalaDiretaView.cs create mode 100644 Decompiler/Gestor.Application.Views.Ferramentas/ManutencaoPagamentosView.cs create mode 100644 Decompiler/Gestor.Application.Views.Ferramentas/NotaFiscalView.cs create mode 100644 Decompiler/Gestor.Application.Views.Ferramentas/ProdutoView.cs create mode 100644 Decompiler/Gestor.Application.Views.Ferramentas/ProtocoloDocumentosView.cs create mode 100644 Decompiler/Gestor.Application.Views.Ferramentas/QualificacaoView.cs create mode 100644 Decompiler/Gestor.Application.Views.Ferramentas/RamoView.cs create mode 100644 Decompiler/Gestor.Application.Views.Ferramentas/ReciboView.cs create mode 100644 Decompiler/Gestor.Application.Views.Ferramentas/SeguradoraView.cs create mode 100644 Decompiler/Gestor.Application.Views.Ferramentas/SocioView.cs create mode 100644 Decompiler/Gestor.Application.Views.Ferramentas/StatusProspeccaoView.cs create mode 100644 Decompiler/Gestor.Application.Views.Ferramentas/StatusView.cs create mode 100644 Decompiler/Gestor.Application.Views.Ferramentas/TipoTarefaView.cs create mode 100644 Decompiler/Gestor.Application.Views.Ferramentas/TipoVendedorView.cs create mode 100644 Decompiler/Gestor.Application.Views.Ferramentas/UsuarioView.cs create mode 100644 Decompiler/Gestor.Application.Views.Ferramentas/VendedorView.cs create mode 100644 Decompiler/Gestor.Application.Views.Financeiro.Relatorios/FechamentoFinanceiroView.cs create mode 100644 Decompiler/Gestor.Application.Views.Financeiro/BancosContasView.cs create mode 100644 Decompiler/Gestor.Application.Views.Financeiro/CentroDeCustoView.cs create mode 100644 Decompiler/Gestor.Application.Views.Financeiro/ExtratoWindow.cs create mode 100644 Decompiler/Gestor.Application.Views.Financeiro/FinanceiroView.cs create mode 100644 Decompiler/Gestor.Application.Views.Financeiro/FornecedorView.cs create mode 100644 Decompiler/Gestor.Application.Views.Financeiro/InfoExtratoView.cs create mode 100644 Decompiler/Gestor.Application.Views.Financeiro/PlanoView.cs create mode 100644 Decompiler/Gestor.Application.Views.Financeiro/PlanosView.cs create mode 100644 Decompiler/Gestor.Application.Views.Generic/BaseUserControl.cs create mode 100644 Decompiler/Gestor.Application.Views.Generic/DragOverPopup.cs create mode 100644 Decompiler/Gestor.Application.Views.Generic/ErrorWindow.cs create mode 100644 Decompiler/Gestor.Application.Views.Generic/HosterWindow.cs create mode 100644 Decompiler/Gestor.Application.Views.Menus/DashboardView.cs create mode 100644 Decompiler/Gestor.Application.Views.Menus/MenuItensView.cs create mode 100644 Decompiler/Gestor.Application.Views.Relatorios/RelatorioView.cs create mode 100644 Decompiler/Gestor.Application.Views.Relatorios/SinteticoView.cs create mode 100644 Decompiler/Gestor.Application.Views.Seguros.Itens/AeronauticoView.cs create mode 100644 Decompiler/Gestor.Application.Views.Seguros.Itens/AutoView.cs create mode 100644 Decompiler/Gestor.Application.Views.Seguros.Itens/BuscarModeloView.cs create mode 100644 Decompiler/Gestor.Application.Views.Seguros.Itens/ConsorcioView.cs create mode 100644 Decompiler/Gestor.Application.Views.Seguros.Itens/GranizoView.cs create mode 100644 Decompiler/Gestor.Application.Views.Seguros.Itens/PatrimonialView.cs create mode 100644 Decompiler/Gestor.Application.Views.Seguros.Itens/RiscosDiversosView.cs create mode 100644 Decompiler/Gestor.Application.Views.Seguros.Itens/VidaView.cs create mode 100644 Decompiler/Gestor.Application.Views.Seguros/ApoliceView.cs create mode 100644 Decompiler/Gestor.Application.Views.Seguros/ClienteView.cs create mode 100644 Decompiler/Gestor.Application.Views.Seguros/ComissaoView.cs create mode 100644 Decompiler/Gestor.Application.Views.Seguros/ConsultaOriginalView.cs create mode 100644 Decompiler/Gestor.Application.Views.Seguros/CriticaApoliceView.cs create mode 100644 Decompiler/Gestor.Application.Views.Seguros/PerfilEmpresaView.cs create mode 100644 Decompiler/Gestor.Application.Views.Seguros/PerfilView.cs create mode 100644 Decompiler/Gestor.Application.Views.Seguros/SinistroView.cs create mode 100644 Decompiler/Gestor.Application.Views.Seguros/TrocarClienteView.cs create mode 100644 Decompiler/Gestor.Application.Views/ConnectionRetryView.cs create mode 100644 Decompiler/Gestor.Application.Views/ImportView.cs create mode 100644 Decompiler/Gestor.Application.Views/LoginWindow.cs create mode 100644 Decompiler/Gestor.Application.Views/TutorialView.cs create mode 100644 Decompiler/Gestor.Application.csproj create mode 100644 Decompiler/Gestor.Application/App.cs create mode 100644 Decompiler/Gestor.Application/MainWindow.cs create mode 100644 Decompiler/IWshRuntimeLibrary/IWshShell.cs create mode 100644 Decompiler/IWshRuntimeLibrary/IWshShell2.cs create mode 100644 Decompiler/IWshRuntimeLibrary/IWshShell3.cs create mode 100644 Decompiler/IWshRuntimeLibrary/IWshShortcut.cs create mode 100644 Decompiler/IWshRuntimeLibrary/WshShell.cs create mode 100644 Decompiler/Microsoft.Office.Interop.Excel/AppEvents.cs create mode 100644 Decompiler/Microsoft.Office.Interop.Excel/AppEvents_Event.cs create mode 100644 Decompiler/Microsoft.Office.Interop.Excel/Application.cs create mode 100644 Decompiler/Microsoft.Office.Interop.Excel/DocEvents.cs create mode 100644 Decompiler/Microsoft.Office.Interop.Excel/DocEvents_Event.cs create mode 100644 Decompiler/Microsoft.Office.Interop.Excel/Range.cs create mode 100644 Decompiler/Microsoft.Office.Interop.Excel/Sheets.cs create mode 100644 Decompiler/Microsoft.Office.Interop.Excel/Workbook.cs create mode 100644 Decompiler/Microsoft.Office.Interop.Excel/WorkbookEvents.cs create mode 100644 Decompiler/Microsoft.Office.Interop.Excel/WorkbookEvents_Event.cs create mode 100644 Decompiler/Microsoft.Office.Interop.Excel/Workbooks.cs create mode 100644 Decompiler/Microsoft.Office.Interop.Excel/Worksheet.cs create mode 100644 Decompiler/Microsoft.Office.Interop.Excel/_Application.cs create mode 100644 Decompiler/Microsoft.Office.Interop.Excel/_Workbook.cs create mode 100644 Decompiler/Microsoft.Office.Interop.Excel/_Worksheet.cs create mode 100644 Decompiler/Properties/AssemblyInfo.cs create mode 100644 Decompiler/app.baml create mode 100644 Decompiler/app.ico create mode 100644 Decompiler/assets/images/aggilizadordimgrayicon.png create mode 100644 Decompiler/assets/images/aggilizadoricon.png create mode 100644 Decompiler/assets/images/appstore.png create mode 100644 Decompiler/assets/images/background_novo_gestor.png create mode 100644 Decompiler/assets/images/backgroung_gestor.png create mode 100644 Decompiler/assets/images/calculoicon.png create mode 100644 Decompiler/assets/images/calculoiconoff.png create mode 100644 Decompiler/assets/images/calculoiconok.png create mode 100644 Decompiler/assets/images/gestor_loading.gif create mode 100644 Decompiler/assets/images/gestor_splash_branco.gif create mode 100644 Decompiler/assets/images/loading.gif create mode 100644 Decompiler/assets/images/logo_novo_agger.png create mode 100644 Decompiler/assets/images/logo_novo_gestor_branco.png create mode 100644 Decompiler/assets/images/playstore.png create mode 100644 Decompiler/assets/images/siggner_logo.png create mode 100644 Decompiler/componentes/calculocontrol.baml create mode 100644 Decompiler/componentes/coberturaview.baml create mode 100644 Decompiler/componentes/contasdialog.baml create mode 100644 Decompiler/componentes/customlegendchart.baml create mode 100644 Decompiler/componentes/custompasswordbox.baml create mode 100644 Decompiler/componentes/customsenhaloginbox.baml create mode 100644 Decompiler/componentes/defaultdialog.baml create mode 100644 Decompiler/componentes/dialogadvertising.baml create mode 100644 Decompiler/componentes/dialoganaliticobi.baml create mode 100644 Decompiler/componentes/dialoganexar.baml create mode 100644 Decompiler/componentes/dialogcopia.baml create mode 100644 Decompiler/componentes/dialogcopiarcliente.baml create mode 100644 Decompiler/componentes/dialogcopiarpermissao.baml create mode 100644 Decompiler/componentes/dialogdetalheextrato.baml create mode 100644 Decompiler/componentes/dialogeditarparcelas.baml create mode 100644 Decompiler/componentes/dialogenviaremails.baml create mode 100644 Decompiler/componentes/dialogexportarpermissao.baml create mode 100644 Decompiler/componentes/dialogextratocomissao.baml create mode 100644 Decompiler/componentes/dialoggrafico.baml create mode 100644 Decompiler/componentes/dialoghoster.baml create mode 100644 Decompiler/componentes/dialoginstalacoes.baml create mode 100644 Decompiler/componentes/dialoglogacesso.baml create mode 100644 Decompiler/componentes/dialogmedalha.baml create mode 100644 Decompiler/componentes/dialogobservacao.baml create mode 100644 Decompiler/componentes/dialogpesquisaavancada.baml create mode 100644 Decompiler/componentes/dialogprint.baml create mode 100644 Decompiler/componentes/dialogprotocolo.baml create mode 100644 Decompiler/componentes/dialogreordenaritens.baml create mode 100644 Decompiler/componentes/dialogselecionaritens.baml create mode 100644 Decompiler/componentes/dialogsenhaadm.baml create mode 100644 Decompiler/componentes/dialogtarefa.baml create mode 100644 Decompiler/componentes/dialogtransferencia.baml create mode 100644 Decompiler/componentes/dialogtrilha.baml create mode 100644 Decompiler/componentes/dialogvinculo.baml create mode 100644 Decompiler/componentes/errordialog.baml create mode 100644 Decompiler/componentes/gridrelatorio.baml create mode 100644 Decompiler/componentes/loading.baml create mode 100644 Decompiler/componentes/passbox.baml create mode 100644 Decompiler/componentes/progressdialog.baml create mode 100644 Decompiler/componentes/prospeccaodialog.baml create mode 100644 Decompiler/componentes/vincularlancamentodialog.baml create mode 100644 Decompiler/componentes/webbrowser.baml create mode 100644 Decompiler/componentes/webeditor.baml create mode 100644 Decompiler/drawers/adiantamentodrawerview.baml create mode 100644 Decompiler/drawers/agendadrawer.baml create mode 100644 Decompiler/drawers/ajuda/boletosnotasdrawerview.baml create mode 100644 Decompiler/drawers/ajuda/contratosdrawerview.baml create mode 100644 Decompiler/drawers/ajuda/instalacaodrawerview.baml create mode 100644 Decompiler/drawers/arquivodigitaldrawer.baml create mode 100644 Decompiler/drawers/configuracoes/configuracoesdrawer.baml create mode 100644 Decompiler/drawers/expedicaodrawer.baml create mode 100644 Decompiler/drawers/extratosdrawer.baml create mode 100644 Decompiler/drawers/impostodrawer.baml create mode 100644 Decompiler/drawers/inclusaoarquivodigitaldrawer.baml create mode 100644 Decompiler/drawers/infodrawer.baml create mode 100644 Decompiler/drawers/logdrawer.baml create mode 100644 Decompiler/drawers/logemaildrawer.baml create mode 100644 Decompiler/drawers/logsistemaantigo.baml create mode 100644 Decompiler/drawers/logutilizacaodrawer.baml create mode 100644 Decompiler/drawers/metaseguradoraview.baml create mode 100644 Decompiler/drawers/metavendedorview.baml create mode 100644 Decompiler/drawers/observacoesdrawer.baml create mode 100644 Decompiler/drawers/permissaousuariodrawer.baml create mode 100644 Decompiler/drawers/relatorios/configuracaorelatorio.baml create mode 100644 Decompiler/drawers/relatorios/filtrorelatorio.baml create mode 100644 Decompiler/drawers/tarefadrawer.baml create mode 100644 Decompiler/drawers/valoresapolicedrawer.baml create mode 100644 Decompiler/drawers/valoresparceladrawer.baml create mode 100644 Decompiler/drawers/vinculovendedordrawer.baml create mode 100644 Decompiler/iconesistema.ico create mode 100644 Decompiler/iconesistema2024.ico create mode 100644 Decompiler/mainwindow.baml create mode 100644 Decompiler/mshtml/DispHTMLDocument.cs create mode 100644 Decompiler/mshtml/HTMLDocument.cs create mode 100644 Decompiler/mshtml/HTMLDocumentEvents.cs create mode 100644 Decompiler/mshtml/HTMLDocumentEvents_Event.cs create mode 100644 Decompiler/mshtml/IHTMLElement.cs create mode 100644 Decompiler/mshtml/IHTMLSelectionObject.cs create mode 100644 Decompiler/mshtml/IHTMLTxtRange.cs create mode 100644 Decompiler/styles/buttons.baml create mode 100644 Decompiler/styles/colors.baml create mode 100644 Decompiler/styles/fonts.baml create mode 100644 Decompiler/styles/texts.baml create mode 100644 Decompiler/views/ajuda/atendimentosview.baml create mode 100644 Decompiler/views/bi/acompanhamentoview.baml create mode 100644 Decompiler/views/bi/agendabiview.baml create mode 100644 Decompiler/views/bi/notasview.baml create mode 100644 Decompiler/views/bi/painelbiview.baml create mode 100644 Decompiler/views/bi/prospeccaoview.baml create mode 100644 Decompiler/views/bi/tarefaview.baml create mode 100644 Decompiler/views/connectionretryview.baml create mode 100644 Decompiler/views/ferramentas/cadastroemailview.baml create mode 100644 Decompiler/views/ferramentas/cadastroparceiroview.baml create mode 100644 Decompiler/views/ferramentas/downloadwindow.baml create mode 100644 Decompiler/views/ferramentas/empresaview.baml create mode 100644 Decompiler/views/ferramentas/estipulanteview.baml create mode 100644 Decompiler/views/ferramentas/etiquetaview.baml create mode 100644 Decompiler/views/ferramentas/incluirramoview.baml create mode 100644 Decompiler/views/ferramentas/incluirseguradoraview.baml create mode 100644 Decompiler/views/ferramentas/maladiretaview.baml create mode 100644 Decompiler/views/ferramentas/manutencaopagamentosview.baml create mode 100644 Decompiler/views/ferramentas/notafiscalview.baml create mode 100644 Decompiler/views/ferramentas/produtoview.baml create mode 100644 Decompiler/views/ferramentas/protocolodocumentosview.baml create mode 100644 Decompiler/views/ferramentas/qualificacaoview.baml create mode 100644 Decompiler/views/ferramentas/ramoview.baml create mode 100644 Decompiler/views/ferramentas/reciboview.baml create mode 100644 Decompiler/views/ferramentas/seguradoraview.baml create mode 100644 Decompiler/views/ferramentas/socioview.baml create mode 100644 Decompiler/views/ferramentas/statusprospeccaoview.baml create mode 100644 Decompiler/views/ferramentas/statusview.baml create mode 100644 Decompiler/views/ferramentas/tipotarefaview.baml create mode 100644 Decompiler/views/ferramentas/tipovendedorview.baml create mode 100644 Decompiler/views/ferramentas/usuarioview.baml create mode 100644 Decompiler/views/ferramentas/vendedorview.baml create mode 100644 Decompiler/views/financeiro/bancoscontasview.baml create mode 100644 Decompiler/views/financeiro/centrodecustoview.baml create mode 100644 Decompiler/views/financeiro/extratowindow.baml create mode 100644 Decompiler/views/financeiro/financeiroview.baml create mode 100644 Decompiler/views/financeiro/fornecedorview.baml create mode 100644 Decompiler/views/financeiro/infoextratoview.baml create mode 100644 Decompiler/views/financeiro/planosview.baml create mode 100644 Decompiler/views/financeiro/planoview.baml create mode 100644 Decompiler/views/financeiro/relatorios/fechamentofinanceiroview.baml create mode 100644 Decompiler/views/generic/dragoverpopup.baml create mode 100644 Decompiler/views/generic/errorwindow.baml create mode 100644 Decompiler/views/generic/hosterwindow.baml create mode 100644 Decompiler/views/importview.baml create mode 100644 Decompiler/views/loginwindow.baml create mode 100644 Decompiler/views/menus/dashboardview.baml create mode 100644 Decompiler/views/menus/menuitensview.baml create mode 100644 Decompiler/views/relatorios/relatorioview.baml create mode 100644 Decompiler/views/relatorios/sinteticoview.baml create mode 100644 Decompiler/views/seguros/apoliceview.baml create mode 100644 Decompiler/views/seguros/clienteview.baml create mode 100644 Decompiler/views/seguros/comissaoview.baml create mode 100644 Decompiler/views/seguros/consultaoriginalview.baml create mode 100644 Decompiler/views/seguros/criticaapoliceview.baml create mode 100644 Decompiler/views/seguros/itens/aeronauticoview.baml create mode 100644 Decompiler/views/seguros/itens/autoview.baml create mode 100644 Decompiler/views/seguros/itens/buscarmodeloview.baml create mode 100644 Decompiler/views/seguros/itens/consorcioview.baml create mode 100644 Decompiler/views/seguros/itens/granizoview.baml create mode 100644 Decompiler/views/seguros/itens/patrimonialview.baml create mode 100644 Decompiler/views/seguros/itens/riscosdiversosview.baml create mode 100644 Decompiler/views/seguros/itens/vidaview.baml create mode 100644 Decompiler/views/seguros/perfilempresaview.baml create mode 100644 Decompiler/views/seguros/perfilview.baml create mode 100644 Decompiler/views/seguros/sinistroview.baml create mode 100644 Decompiler/views/seguros/trocarclienteview.baml create mode 100644 Decompiler/views/tutorialview.baml (limited to 'Decompiler') diff --git a/Decompiler/Gestor.Application.Actions/Actions.cs b/Decompiler/Gestor.Application.Actions/Actions.cs new file mode 100644 index 0000000..bc521cc --- /dev/null +++ b/Decompiler/Gestor.Application.Actions/Actions.cs @@ -0,0 +1,80 @@ +using System; +using System.Windows; +using Assinador.Model.Common; +using Gestor.Model.Common; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Actions; + +public static class Actions +{ + public static Action Resize { get; set; } + + public static Action NomeTela { get; set; } + + public static Action AcessaTela { get; set; } + + public static Action EnableMainMenu { get; set; } + + public static Action EnablePesquisarClientes { get; set; } + + public static Action EnableMenu { get; set; } + + public static Action RecarregarDocumentos { get; set; } + + public static Action RecarregarParcelas { get; set; } + + public static Action UpdateDocumento { get; set; } + + public static Action ScrollDocumento { get; set; } + + public static Action UpdateItem { get; set; } + + public static Action SelectCliente { get; set; } + + public static Action LimparCliente { get; set; } + + public static Action SubstituirItem { get; set; } + + public static Action ManterItem { get; set; } + + public static Action AcessoApolice { get; set; } + + public static Action EnableItens { get; set; } + + public static Action EnableDocumento { get; set; } + + public static Action OcultarTogglesArquivoDigital { get; set; } + + public static Action OcultarTogglesFerramentas { get; set; } + + public static Action OcultarTogglesSeguros { get; set; } + + public static Action AtualizaBadges { get; set; } + + public static Action AtualizaContatos { get; set; } + + public static Action AtualizaTrilhas { get; set; } + + public static Action CloseHoster { get; set; } + + public static Action UpdateRadioApolice { get; set; } + + public static Action SortLancamentos { get; set; } + + public static Action SaveSortLancamentos { get; set; } + + public static Action Redimencionar { get; set; } + + public static Action AcessarHoster { get; set; } + + public static Action AcionarSnackbar { get; set; } + + public static Action RecarregarRelatorios { get; set; } + + public static Action ScrollToItem { get; set; } + + public static Action IniciarAggilizador { get; set; } + + public static Action AtualizaUsuario { get; set; } +} diff --git a/Decompiler/Gestor.Application.Componentes/CalculoControl.cs b/Decompiler/Gestor.Application.Componentes/CalculoControl.cs new file mode 100644 index 0000000..03c81ec --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/CalculoControl.cs @@ -0,0 +1,2279 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Markup; +using Agger.Registro; +using CsQuery.ExtensionMethods.Internal; +using Gestor.Application.Actions; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.Servicos.Seguros.Itens; +using Gestor.Application.ViewModels; +using Gestor.Common.Helpers; +using Gestor.Model.CalculoWeb; +using Gestor.Model.CalculoWeb.Auto; +using Gestor.Model.CalculoWeb.Condominio; +using Gestor.Model.CalculoWeb.Empresa; +using Gestor.Model.CalculoWeb.Residencia; +using Gestor.Model.CalculoWeb.VidaIndividual; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.License; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace Gestor.Application.Componentes; + +public class CalculoControl : UserControl, IComponentConnector +{ + [StructLayout(LayoutKind.Auto)] + [CompilerGenerated] + private struct _003CIniciarPipe_003Ed__29 : IAsyncStateMachine + { + private static class _003C_003Eo__29 + { + public static CallSite> _003C_003Ep__0; + + public static CallSite> _003C_003Ep__1; + + public static CallSite> _003C_003Ep__2; + + public static CallSite> _003C_003Ep__3; + } + + public int _003C_003E1__state; + + public AsyncVoidMethodBuilder _003C_003Et__builder; + + public CalculoControl _003C_003E4__this; + + public object message; + + private object _003C_003Eu__1; + + private TaskAwaiter _003C_003Eu__2; + + private void MoveNext() + { + int num = _003C_003E1__state; + CalculoControl calculoControl = _003C_003E4__this; + try + { + TaskAwaiter awaiter; + dynamic awaiter2; + if (num != 0) + { + if (num == 1) + { + awaiter = _003C_003Eu__2; + _003C_003Eu__2 = default(TaskAwaiter); + num = (_003C_003E1__state = -1); + goto IL_02b9; + } + awaiter2 = calculoControl.CallPipe((dynamic)message).GetAwaiter(); + if (!(bool)awaiter2.IsCompleted) + { + num = (_003C_003E1__state = 0); + _003C_003Eu__1 = awaiter2; + ICriticalNotifyCompletion awaiter3 = awaiter2 as ICriticalNotifyCompletion; + if (awaiter3 == null) + { + INotifyCompletion awaiter4 = (INotifyCompletion)(object)awaiter2; + _003C_003Et__builder.AwaitOnCompleted(ref awaiter4, ref this); + awaiter4 = null; + } + else + { + _003C_003Et__builder.AwaitUnsafeOnCompleted(ref awaiter3, ref this); + } + awaiter3 = null; + return; + } + } + else + { + awaiter2 = _003C_003Eu__1; + _003C_003Eu__1 = null; + num = (_003C_003E1__state = -1); + } + dynamic result = awaiter2.GetResult(); + if (!(result ? true : false)) + { + awaiter = new DashboardViewModel().ShowMessage(calculoControl.MessageAggilizador).GetAwaiter(); + if (!awaiter.IsCompleted) + { + num = (_003C_003E1__state = 1); + _003C_003Eu__2 = awaiter; + _003C_003Et__builder.AwaitUnsafeOnCompleted(ref awaiter, ref this); + return; + } + goto IL_02b9; + } + goto end_IL_000e; + IL_02b9: + awaiter.GetResult(); + end_IL_000e:; + } + catch (Exception exception) + { + _003C_003E1__state = -2; + _003C_003Et__builder.SetException(exception); + return; + } + _003C_003E1__state = -2; + _003C_003Et__builder.SetResult(); + } + + void IAsyncStateMachine.MoveNext() + { + //ILSpy generated this explicit interface implementation from .override directive in MoveNext + this.MoveNext(); + } + + [DebuggerHidden] + private void SetStateMachine(IAsyncStateMachine stateMachine) + { + _003C_003Et__builder.SetStateMachine(stateMachine); + } + + void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine stateMachine) + { + //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine + this.SetStateMachine(stateMachine); + } + } + + public static readonly DependencyProperty DocumentoIdProperty = DependencyProperty.Register("DocumentoId", typeof(object), typeof(CalculoControl), (PropertyMetadata)new FrameworkPropertyMetadata((object)null, (FrameworkPropertyMetadataOptions)256)); + + public static readonly DependencyProperty ClienteIdProperty = DependencyProperty.Register("ClienteId", typeof(object), typeof(CalculoControl), (PropertyMetadata)new FrameworkPropertyMetadata((object)null, (FrameworkPropertyMetadataOptions)256)); + + public static readonly DependencyProperty RamoIdProperty = DependencyProperty.Register("RamoId", typeof(object), typeof(CalculoControl), (PropertyMetadata)new FrameworkPropertyMetadata((object)null, (FrameworkPropertyMetadataOptions)256)); + + public static readonly DependencyProperty DocumentoProperty = DependencyProperty.Register("Documento", typeof(object), typeof(CalculoControl), (PropertyMetadata)new FrameworkPropertyMetadata((object)string.Empty, (FrameworkPropertyMetadataOptions)256)); + + private string _messageAggilizadorWeb = "CRIADO COM SUCESSO!" + Environment.NewLine + "DESEJA ACESSAR A PAGINA DO AGGILIZADOR AGORA?"; + + private string MessageAggilizador = "NÃO FOI POSSÍVEL INICIAR A FUNÇÃO NO AGGILIZADOR DE CÁLCULOS." + Environment.NewLine + "CERTIFIQUE-SE QUE O AGGILIZADOR ESTÁ DEVIDAMENTE ATUALIZADO ANTES DE TENTAR NOVAMENTE."; + + internal Grid LayoutRoot; + + internal Button CalculoButton; + + private bool _contentLoaded; + + public object DocumentoId + { + get + { + return ((DependencyObject)this).GetValue(DocumentoIdProperty); + } + set + { + ((DependencyObject)this).SetValue(DocumentoIdProperty, value); + } + } + + public object ClienteId + { + get + { + return ((DependencyObject)this).GetValue(ClienteIdProperty); + } + set + { + ((DependencyObject)this).SetValue(ClienteIdProperty, value); + } + } + + public object RamoId + { + get + { + return ((DependencyObject)this).GetValue(RamoIdProperty); + } + set + { + ((DependencyObject)this).SetValue(RamoIdProperty, value); + } + } + + public string Documento + { + get + { + return (string)((DependencyObject)this).GetValue(DocumentoProperty); + } + set + { + ((DependencyObject)this).SetValue(DocumentoProperty, (object)value); + } + } + + public CalculoControl() + { + InitializeComponent(); + ((FrameworkElement)LayoutRoot).DataContext = this; + } + + private async void Calcular_OnClick(object sender, RoutedEventArgs e) + { + if (!(await VerificarPermissao())) + { + return; + } + if (DocumentoId == null) + { + Prospectar(); + } + else if (LicenseHelper.Produtos.Any((Licenca produto) => (int)produto.Produto == 91)) + { + if (string.IsNullOrEmpty(Recursos.Usuario.Email)) + { + await new DashboardViewModel().ShowMessage("USUÁRIO SEM E-MAIL CADASTRADO! O E-MAIL CADASTRADO DEVE SER O MESMO DO AGGILIZADOR."); + return; + } + string linkCalculo = await CalculoWeb(DocumentoId.ToString()); + if (!ExtensionMethods.IsNullOrEmpty((IEnumerable)linkCalculo) && await new DashboardViewModel().ShowMessage(_messageAggilizadorWeb, "SIM", "NÃO")) + { + try + { + Process.Start(new ProcessStartInfo(linkCalculo) + { + UseShellExecute = true + }); + } + catch + { + await new DashboardViewModel().ShowMessage("ERRO AO ABRIR CALCULO"); + } + } + } + else + { + await Iniciar(trazerParaFrente: true); + Documento val = await new ApoliceServico().BuscarApoliceAsync(long.Parse(DocumentoId.ToString()), itens: true); + long id = ((DomainBase)val.Controle.Cliente).Id; + long id2 = ((DomainBase)val).Id; + long id3 = ((DomainBase)val.Controle).Id; + List itensAtivo = val.ItensAtivo; + long? itemId; + if (itensAtivo == null) + { + itemId = null; + } + else + { + Item? obj2 = itensAtivo.FirstOrDefault(); + itemId = ((obj2 != null) ? new long?(((DomainBase)obj2).Id) : null); + } + dynamic val2 = new + { + ClientId = id, + DocumentId = id2, + ControlId = id3, + ItemId = itemId, + Branch = ((DomainBase)val.Controle.Ramo).Id + }; + IniciarPipe(val2); + } + } + + private async Task CalculoWeb(string idDocumento) + { + long id = long.Parse(idDocumento); + Documento val = await new ApoliceServico().BuscarApoliceAsync(id, itens: true); + long id2 = ((DomainBase)val.Controle.Ramo).Id; + new Calculo(); + long num = id2 - 1; + if ((ulong)num <= 5uL) + { + Calculo val2; + List list; + Resultados item; + switch (num) + { + case 0L: + val2 = await ResidenciaCalculo(val); + goto IL_036e; + case 1L: + val2 = await EmpresaCalculo(val); + goto IL_036e; + case 2L: + val2 = await CondominioCalculo(val); + goto IL_036e; + case 4L: + val2 = await AutoCalculo(val); + goto IL_036e; + case 5L: + { + val2 = await VidaIndividualCalculo(val); + goto IL_036e; + } + IL_036e: + list = new List(); + item = new Resultados + { + Erros = null + }; + list.Add(item); + return await EnviaCalculoWeb(JsonConvert.SerializeObject((object)new Calculo + { + SerialNumber = Recursos.Empresa.Serial, + Usuario = new Usuario + { + Email = Recursos.Usuario.Email + }, + Resultados = list, + Auto = (val2.Auto ?? null), + Residencia = (val2.Residencia ?? null), + Empresa = (val2.Empresa ?? null), + Condominio = (val2.Condominio ?? null), + Vida = (val2.Vida ?? null) + })); + } + } + await new DashboardViewModel().ShowMessage("NÃO FOI POSSÍVEL CONCLUIR A INTEGRAÇÃO"); + return null; + } + + public static async Task EnviaCalculoWeb(string body) + { + _ = 2; + try + { + HttpClient client = new HttpClient(); + try + { + string text = "qN7vHy58kLTm4PXEbUgfzMAKrZye2GVn3sdJx9oRWcl71tbvQMF3cU6A8xn5"; + Uri uri = Address.ApiCalculoWeb.Append("calculo").Append("negocio").Append("integracao"); + ((HttpHeaders)client.DefaultRequestHeaders).Clear(); + ((HttpHeaders)client.DefaultRequestHeaders).Add("Authorization", text); + StringContent val = new StringContent(body, (Encoding)null, "application/json"); + HttpResponseMessage val2 = await client.PostAsync(uri, (HttpContent)(object)val); + if (val2.StatusCode == HttpStatusCode.Unauthorized) + { + await new DashboardViewModel().ShowMessage("O E-MAIL CADASTRADO NO GESTOR É DIFERENTE DO E-MAIL CADASTRADO NO AGGILIZADOR!"); + return string.Empty; + } + string obj = await val2.Content.ReadAsStringAsync(); + JObject val3 = JObject.Parse(obj); + if (obj.Contains("erro")) + { + return ""; + } + return ((object)val3["url"])?.ToString(); + } + finally + { + ((IDisposable)client)?.Dispose(); + } + } + catch + { + return ""; + } + } + + private async Task AutoCalculo(Documento doc) + { + try + { + Cliente cliente = await BuscaClienteCompleto(((DomainBase)doc.Controle.Cliente).Id); + ObservableCollection emails = cliente.Emails; + object obj; + if (emails == null) + { + obj = null; + } + else + { + ClienteEmail? obj2 = emails.FirstOrDefault(); + obj = ((obj2 != null) ? ((EmailBase)obj2).Email : null); + } + if (obj == null) + { + obj = string.Empty; + } + string email = (string)obj; + ClienteTelefone fone = cliente.Telefones?.FirstOrDefault() ?? null; + ClienteEndereco endereco = cliente.Enderecos?.FirstOrDefault() ?? null; + string s = (((cliente != null) ? cliente.PrimeiraHabilitacao : null) ?? DateTime.MinValue).ConvertTempoHabilitacaoCalculo(); + TempoHabilitacao tempoHabilitacao = Funcoes.ConvertTempoHabilitacao(int.Parse(s)); + List list = await new PerfilServico().BuscarPerfis(((DomainBase)doc.Controle).Id); + bool existPerfil = list.Count > 0; + Perfil perfilPrincipal = ((IEnumerable)list).FirstOrDefault((Func)((Perfil p) => ((DomainBase)p.Controle).Id == ((DomainBase)doc.Controle).Id)); + Item? obj3 = doc.ItensAtivo.FirstOrDefault(); + long num = ((obj3 != null) ? ((DomainBase)obj3).Id : 0); + decimal num2 = default(decimal); + decimal num3 = default(decimal); + decimal num4 = default(decimal); + decimal num5 = default(decimal); + Auto automovel = new Auto(); + Item item = new Item(); + if (num > 0) + { + item = await new ItemServico().BuscarItemPorIdAsync(num); + automovel = await new ItemServico().BuscaAuto(((DomainBase)item).Id); + List source = (await new ItemServico().BuscarCoberturasPorItemAsync(((DomainBase)item).Id)).ToList(); + source = source.Where((Cobertura cobertura) => cobertura.CoberturaPadrao != null).ToList(); + Cobertura? obj4 = ((IEnumerable)source).FirstOrDefault((Func)delegate(Cobertura x) + { + CoberturaPadrao coberturaPadrao5 = x.CoberturaPadrao; + return coberturaPadrao5 != null && coberturaPadrao5.IdRamo == 17; + }); + num2 = ((obj4 != null) ? obj4.Lmi : 0m); + Cobertura? obj5 = ((IEnumerable)source).FirstOrDefault((Func)delegate(Cobertura x) + { + CoberturaPadrao coberturaPadrao4 = x.CoberturaPadrao; + return coberturaPadrao4 != null && ((DomainBase)coberturaPadrao4).Id == 2; + }); + num3 = ((obj5 != null) ? obj5.Lmi : 0m); + Cobertura? obj6 = ((IEnumerable)source).FirstOrDefault((Func)delegate(Cobertura x) + { + CoberturaPadrao coberturaPadrao3 = x.CoberturaPadrao; + return coberturaPadrao3 != null && ((DomainBase)coberturaPadrao3).Id == 3; + }); + num4 = ((obj6 != null) ? obj6.Lmi : 0m); + Cobertura? obj7 = ((IEnumerable)source).FirstOrDefault((Func)delegate(Cobertura x) + { + CoberturaPadrao coberturaPadrao2 = x.CoberturaPadrao; + return coberturaPadrao2 != null && ((DomainBase)coberturaPadrao2).Id == 4; + }); + decimal obj9; + if (obj7 == null) + { + Cobertura? obj8 = ((IEnumerable)source).FirstOrDefault((Func)delegate(Cobertura x) + { + CoberturaPadrao coberturaPadrao = x.CoberturaPadrao; + return coberturaPadrao != null && ((DomainBase)coberturaPadrao).Id == 719; + }); + obj9 = ((obj8 != null) ? obj8.Lmi : 0m); + } + else + { + obj9 = obj7.Lmi; + } + num5 = obj9; + } + Calculo val = new Calculo(); + CalculoAuto val2 = new CalculoAuto(); + Segurado val3 = new Segurado + { + Email = email + }; + Telefone val4 = new Telefone(); + val4.Ddd = ((fone != null) ? ((TelefoneBase)fone).Prefixo : null) ?? string.Empty; + val4.Numero = ((fone != null) ? ((TelefoneBase)fone).Numero : null) ?? string.Empty; + val4.Id = ((fone != null) ? ((DomainBase)fone).Id : 0); + val3.TelefoneResidencial = val4; + Telefone val5 = new Telefone(); + val5.Ddd = ((fone != null) ? ((TelefoneBase)fone).Prefixo : null) ?? string.Empty; + val5.Numero = ((fone != null) ? ((TelefoneBase)fone).Numero : null) ?? string.Empty; + val5.Id = ((fone != null) ? ((DomainBase)fone).Id : 0); + val3.TelefoneCelular = val5; + val3.Cep = ((endereco != null) ? ((EnderecoBase)endereco).Cep : null); + val3.RelacaoSeguradoCondutor = null; + val3.Perfil = existPerfil; + val3.Uf = ((endereco != null) ? ((EnderecoBase)endereco).Estado : null) ?? null; + val3.NomeCompleto = cliente.Nome; + val3.CpfCnpj = cliente.Documento; + val3.DataNascimento = cliente.Nascimento; + val3.Sexo = ((cliente != null) ? EnumHelper.Value(cliente.Sexo) : null); + val3.DataHabilitacao = cliente.PrimeiraHabilitacao; + val3.TempoHabilitacao = EnumHelper.Value(tempoHabilitacao); + val3.EstadoCivil = ((cliente != null) ? EnumHelper.Value(cliente.EstadoCivil) : null); + val3.NumeroHabilitacao = ((cliente != null) ? cliente.Habilitacao : null) ?? null; + val3.Id = ((cliente != null) ? ((DomainBase)cliente).Id : 0); + val2.Segurado = val3; + CondutorPrincipal val6 = new CondutorPrincipal(); + val6.NomeCompleto = ((perfilPrincipal != null) ? perfilPrincipal.Nome : null) ?? null; + val6.CpfCnpj = ((perfilPrincipal != null) ? perfilPrincipal.Cpf : null) ?? null; + val6.DataNascimento = ((perfilPrincipal != null) ? perfilPrincipal.Nascimento : null); + val6.Sexo = ((perfilPrincipal != null) ? EnumHelper.Value(perfilPrincipal.Sexo) : null); + val6.DataHabilitacao = null; + val6.TempoHabilitacao = ((perfilPrincipal != null) ? EnumHelper.Value(perfilPrincipal.TempoHabilitacao) : null) ?? null; + val6.EstadoCivil = ((perfilPrincipal != null) ? EnumHelper.Value(perfilPrincipal.EstadoCivil) : null) ?? null; + val6.NumeroHabilitacao = ((perfilPrincipal != null) ? perfilPrincipal.Habilitacao : null); + val6.Id = ((perfilPrincipal != null) ? ((DomainBase)perfilPrincipal).Id : 0); + val2.CondutorPrincipal = val6; + object veiculo; + if (automovel != null) + { + Veiculo val7 = new Veiculo(); + Auto obj10 = automovel; + val7.NumeroChassi = ((obj10 != null) ? obj10.Chassi : null); + Auto obj11 = automovel; + val7.Placa = ((obj11 != null) ? obj11.Placa : null); + val7.Uf = null; + Auto obj12 = automovel; + val7.Modelo = ((obj12 != null) ? obj12.Modelo : null); + Auto obj13 = automovel; + object fabricante; + if (obj13 == null) + { + fabricante = null; + } + else + { + Fabricante fabricante2 = obj13.Fabricante; + fabricante = ((fabricante2 != null) ? fabricante2.Descricao : null); + } + val7.Fabricante = (string)fabricante; + Auto obj14 = automovel; + val7.AnoFabricacao = ((obj14 != null) ? obj14.AnoFabricacao : null); + Auto obj15 = automovel; + val7.AnoModelo = ((obj15 != null) ? obj15.AnoModelo : null); + Auto obj16 = automovel; + val7.CodigoFipe = ((obj16 != null) ? obj16.Fipe : null); + Auto obj17 = automovel; + val7.Rastreador = ((obj17 != null) ? EnumHelper.Value(obj17.Rastreador) : null) ?? "0"; + val7.Antifurto = ((perfilPrincipal != null) ? EnumHelper.Value(perfilPrincipal.AntiFurto) : null); + Auto obj18 = automovel; + val7.KitGas = ((obj18 == null) ? null : obj18.KitGas?.BoolToString()) ?? "0"; + Auto obj19 = automovel; + val7.ZeroKm = ((obj19 == null) ? null : obj19.ZeroKm?.BoolToString()) ?? "0"; + Auto obj20 = automovel; + val7.Alienado = ((obj20 == null) ? null : obj20.Financiado?.BoolToString()); + Auto obj21 = automovel; + object combustivel; + if (obj21 == null) + { + combustivel = null; + } + else + { + Combustivel? combustivel2 = obj21.Combustivel; + combustivel = (combustivel2.HasValue ? EnumHelper.Value(combustivel2.GetValueOrDefault()) : null); + } + val7.Combustivel = (string)combustivel; + Auto obj22 = automovel; + val7.CepPernoite = ((obj22 != null) ? obj22.CepPernoite : null); + Fipe val8 = new Fipe(); + Auto obj23 = automovel; + val8.Codigo = ((obj23 != null) ? obj23.Fipe : null); + Auto obj24 = automovel; + val8.Modelo = ((obj24 != null) ? obj24.Modelo : null); + Auto obj25 = automovel; + object obj26; + if (obj25 == null) + { + obj26 = null; + } + else + { + Fabricante fabricante3 = obj25.Fabricante; + obj26 = ((fabricante3 != null) ? fabricante3.Descricao : null); + } + if (obj26 == null) + { + obj26 = string.Empty; + } + val8.Marca = (string)obj26; + Auto obj27 = automovel; + val8.AnoMaximo = ((obj27 != null) ? obj27.AnoFabricacao : null); + Auto obj28 = automovel; + val8.AnoMinimo = ((obj28 != null) ? obj28.AnoModelo : null); + Auto obj29 = automovel; + object combustivel3; + if (obj29 == null) + { + combustivel3 = null; + } + else + { + Combustivel? combustivel2 = obj29.Combustivel; + combustivel3 = (combustivel2.HasValue ? EnumHelper.Value(combustivel2.GetValueOrDefault()) : null); + } + val8.Combustivel = (string)combustivel3; + val8.Valor = 0m; + val8.ValorAntigo = 0m; + Auto obj30 = automovel; + val8.AnoModelo = ((obj30 != null) ? obj30.AnoModelo : null); + val8.TipoVeiculo = 0; + Auto obj31 = automovel; + val8.ZeroKm = ((obj31 != null) ? obj31.ZeroKm : null).GetValueOrDefault(); + val8.Id = 0; + val7.Fipe = val8; + Auto obj32 = automovel; + val7.Blindado = ((obj32 == null) ? null : obj32.Blindagem?.BoolToString()) ?? string.Empty; + Auto obj33 = automovel; + val7.Id = ((obj33 != null) ? ((DomainBase)obj33).Id : 0); + veiculo = (object)val7; + } + else + { + veiculo = null; + } + val2.Veiculo = (Veiculo)veiculo; + QuestionarioAuto val9 = new QuestionarioAuto(); + val9.QuilometragemMensal = ((perfilPrincipal != null) ? perfilPrincipal.KmMensal : null); + Auto obj34 = automovel; + object obj35; + if (obj34 == null) + { + obj35 = null; + } + else + { + UsoVeiculo? usoVeiculo = obj34.UsoVeiculo; + obj35 = (usoVeiculo.HasValue ? EnumHelper.Value(usoVeiculo.GetValueOrDefault()) : null); + } + if (obj35 == null) + { + obj35 = null; + } + val9.UsoVeiculo = (string)obj35; + val9.GaragemEstudo = ((perfilPrincipal == null) ? null : perfilPrincipal.GaragemEstudo?.ConvertGaragemTrabalhoEstudoCalculo()) ?? null; + object obj36; + if (perfilPrincipal == null || (int)perfilPrincipal.GaragemResidencia.GetValueOrDefault() != 4) + { + if (perfilPrincipal == null) + { + obj36 = null; + } + else + { + GaragemResidencia? garagemResidencia = perfilPrincipal.GaragemResidencia; + obj36 = (garagemResidencia.HasValue ? EnumHelper.Value(garagemResidencia.GetValueOrDefault()) : null); + } + if (obj36 == null) + { + obj36 = null; + } + } + else + { + obj36 = null; + } + val9.GaragemResidencia = (string)obj36; + object obj37; + if (perfilPrincipal == null) + { + obj37 = null; + } + else + { + TipoResidencia? tipoResidencia = perfilPrincipal.TipoResidencia; + obj37 = (tipoResidencia.HasValue ? EnumHelper.Value(tipoResidencia.GetValueOrDefault()) : null); + } + if (obj37 == null) + { + obj37 = null; + } + val9.TipoResidencia = (string)obj37; + object obj38; + if (perfilPrincipal == null) + { + obj38 = null; + } + else + { + UsoDependetes? usoDependentes = perfilPrincipal.UsoDependentes; + obj38 = (usoDependentes.HasValue ? EnumHelper.Value(usoDependentes.GetValueOrDefault()) : null); + } + if (obj38 == null) + { + obj38 = null; + } + val9.UsoDependentes = (string)obj38; + val9.FaixaEtariaDependentes = null; + val9.IsencaoFiscal = null; + Auto obj39 = automovel; + val9.Pcd = ((obj39 == null) ? null : obj39.Pcd?.BoolToString()) ?? string.Empty; + val9.PeriodoUso = null; + val9.Associado = null; + Auto obj40 = automovel; + val9.Id = ((obj40 != null) ? ((DomainBase)obj40).Id : 0); + val2.Questionario = val9; + val2.Caminhao = new Caminhao + { + Carga = null, + Carroceria = null, + Equipamento = null, + GerenciamentoRisco = null, + Uso = null, + RegiaoCirculacao = null, + SeguroCarga = null, + Garagem = null, + ProprioEstado = null, + Periodo = null, + Id = 0 + }; + val2.Cobertura = new CoberturaAuto + { + DanosMorais = num2.ToString(), + DanosMateriais = num3.ToString(), + DanosCorporais = num4.ToString(), + MorteInvalidez = num5.ToString(), + FatorAjuste = 0m, + TipoCobertura = "", + TipoFranquia = "", + Assistencia = "", + CarroReserva = "", + Vidros = "", + DespesasExtras = "", + KitGas = 0m, + Carroceria = 0m, + Equipamento = 0m, + Blindagem = 0m, + ArCondicionado = "", + GarantiaZero = "", + ReparoRapido = "", + ProtecaoBuracos = "", + Id = 0 + }; + Seguro val10 = new Seguro + { + Comissao = doc.Comissao, + Agenciamento = 0m, + ComissaoSeguradora = new List() + }; + Documento obj41 = doc; + val10.VigenciaInicial = ((obj41 != null) ? obj41.Vigencia2 : null) ?? DateTime.MinValue; + Documento obj42 = doc; + val10.VigenciaFinal = ((obj42 != null) ? obj42.Vigencia2.Value.AddYears(1) : DateTime.MinValue); + Documento obj43 = doc; + val10.VigenciaFinalAnterior = ((obj43 != null) ? obj43.Vigencia2 : null) ?? DateTime.MinValue; + Documento obj44 = doc; + val10.TipoSeguro = ((obj44 != null) ? obj44.Situacao.ConvertTipoSeguroCalculo() : null); + val10.Banco = null; + Auto obj45 = automovel; + val10.Bonus = ((obj45 != null) ? obj45.Bonus.ToString() : null); + Documento obj46 = doc; + val10.SeguradoraAnterior = ((obj46 != null) ? obj46.Controle.Seguradora.Nome : null); + val10.CodigoIdentificacao = ""; + val10.NumeroApoliceAnterior = doc.Apolice; + val10.Sinistros = item.Sinistrado.BoolToString(); + val10.RenovacaoGarantida = false; + val10.Observacoes = doc.Observacao; + val10.Id = ((DomainBase)doc).Id; + val2.Seguro = val10; + val2.TipoVeiculo = 0; + val.Auto = val2; + return val; + } + catch (Exception) + { + return null; + } + } + + public static async Task BuscaClienteCompleto(long idCliente) + { + Cliente cliente = await new ClienteServico().BuscarCliente(idCliente); + ObservableCollection telefones = await new ClienteServico().BuscarTelefonesAsync(idCliente); + ObservableCollection emails = await new ClienteServico().BuscarEmailsAsync(idCliente); + ObservableCollection collection = await new ClienteServico().BuscarEnderecosAsync(idCliente); + cliente.Telefones = new ObservableCollection(telefones); + cliente.Emails = new ObservableCollection(emails); + cliente.Enderecos = new ObservableCollection(collection); + return cliente; + } + + private async Task ResidenciaCalculo(Documento doc) + { + Cliente cliente = await BuscaClienteCompleto(((DomainBase)doc.Controle.Cliente).Id); + ObservableCollection emails = cliente.Emails; + object obj; + if (emails == null) + { + obj = null; + } + else + { + ClienteEmail? obj2 = emails.FirstOrDefault(); + obj = ((obj2 != null) ? ((EmailBase)obj2).Email : null); + } + if (obj == null) + { + obj = string.Empty; + } + string email = (string)obj; + ClienteTelefone fone = cliente.Telefones?.FirstOrDefault() ?? null; + ClienteEndereco endereco = cliente.Enderecos?.FirstOrDefault() ?? null; + string s = (((cliente != null) ? cliente.PrimeiraHabilitacao : null) ?? DateTime.MinValue).ConvertTempoHabilitacaoCalculo(); + TempoHabilitacao tempoHabilitacao = Funcoes.ConvertTempoHabilitacao(int.Parse(s)); + PerfilEmpresa perfilPrincipal = await new PerfilEmpresaServico().BuscarPerfis(((DomainBase)doc.Controle).Id); + bool existPerfil = perfilPrincipal != null; + Item? obj3 = doc.ItensAtivo.FirstOrDefault(); + Item item = ((((obj3 != null) ? ((DomainBase)obj3).Id : 0) != 0L) ? (await new ItemServico().BuscarItems(((DomainBase)doc).Id, (StatusItem)2)).ToList() : null)?.FirstOrDefault(); + Patrimonial patrimonial = new Patrimonial(); + decimal basica = default(decimal); + decimal danosMorais = default(decimal); + decimal responsabilidadeCivilFamiliar = default(decimal); + decimal danosEletricos = default(decimal); + decimal equipamentos = default(decimal); + decimal impactoVeiculos = default(decimal); + decimal aluguel = default(decimal); + decimal vidros = default(decimal); + decimal rouboFurto = default(decimal); + decimal vazamentos = default(decimal); + decimal vendaval = default(decimal); + decimal desmoronamento = default(decimal); + decimal tumultoGreve = default(decimal); + decimal recomposicaoDocumento = default(decimal); + decimal bike = default(decimal); + decimal num = default(decimal); + decimal placasSolares = default(decimal); + if (item != null) + { + patrimonial = item.Patrimonial; + List source = (await new ItemServico().BuscarCoberturasPorItemAsync(((DomainBase)item).Id)).ToList(); + source = source.Where((Cobertura cobertura) => cobertura.CoberturaPadrao != null).ToList(); + Cobertura? obj4 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 8)); + basica = ((obj4 != null) ? obj4.Lmi : 0m); + Cobertura? obj5 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 262)); + danosMorais = ((obj5 != null) ? obj5.Lmi : 0m); + Cobertura? obj6 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 13)); + decimal obj8; + if (obj6 == null) + { + Cobertura? obj7 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 313)); + obj8 = ((obj7 != null) ? obj7.Lmi : 0m); + } + else + { + obj8 = obj6.Lmi; + } + responsabilidadeCivilFamiliar = obj8; + Cobertura? obj9 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 9)); + decimal obj12; + if (obj9 == null) + { + Cobertura? obj10 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 241)); + if (obj10 == null) + { + Cobertura? obj11 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 487)); + obj12 = ((obj11 != null) ? obj11.Lmi : 0m); + } + else + { + obj12 = obj10.Lmi; + } + } + else + { + obj12 = obj9.Lmi; + } + danosEletricos = obj12; + Cobertura? obj13 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 252)); + equipamentos = ((obj13 != null) ? obj13.Lmi : 0m); + Cobertura? obj14 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 26)); + decimal obj17; + if (obj14 == null) + { + Cobertura? obj15 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 260)); + if (obj15 == null) + { + Cobertura? obj16 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 275)); + obj17 = ((obj16 != null) ? obj16.Lmi : 0m); + } + else + { + obj17 = obj15.Lmi; + } + } + else + { + obj17 = obj14.Lmi; + } + impactoVeiculos = obj17; + Cobertura? obj18 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 27)); + aluguel = ((obj18 != null) ? obj18.Lmi : 0m); + Cobertura? obj19 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 12)); + vidros = ((obj19 != null) ? obj19.Lmi : 0m); + Cobertura? obj20 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 10)); + rouboFurto = ((obj20 != null) ? obj20.Lmi : 0m); + Cobertura? obj21 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 240)); + vazamentos = ((obj21 != null) ? obj21.Lmi : 0m); + Cobertura? obj22 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 11)); + vendaval = ((obj22 != null) ? obj22.Lmi : 0m); + Cobertura? obj23 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 39)); + desmoronamento = ((obj23 != null) ? obj23.Lmi : 0m); + Cobertura? obj24 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 151)); + tumultoGreve = ((obj24 != null) ? obj24.Lmi : 0m); + Cobertura? obj25 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 277)); + recomposicaoDocumento = ((obj25 != null) ? obj25.Lmi : 0m); + Cobertura? obj26 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1720)); + bike = ((obj26 != null) ? obj26.Lmi : 0m); + Cobertura? obj27 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1719)); + num = ((obj27 != null) ? obj27.Lmi : 0m); + Cobertura? obj28 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1667)); + placasSolares = ((obj28 != null) ? obj28.Lmi : 0m); + } + Calculo val = new Calculo(); + CalculoResidencia val2 = new CalculoResidencia(); + Segurado val3 = new Segurado + { + Email = email + }; + Telefone val4 = new Telefone(); + val4.Ddd = ((fone != null) ? ((TelefoneBase)fone).Prefixo : null) ?? string.Empty; + val4.Numero = ((fone != null) ? ((TelefoneBase)fone).Numero : null) ?? string.Empty; + val4.Id = ((fone != null) ? ((DomainBase)fone).Id : 0); + val3.TelefoneResidencial = val4; + Telefone val5 = new Telefone(); + val5.Ddd = ((fone != null) ? ((TelefoneBase)fone).Prefixo : null) ?? string.Empty; + val5.Numero = ((fone != null) ? ((TelefoneBase)fone).Numero : null) ?? string.Empty; + val5.Id = ((fone != null) ? ((DomainBase)fone).Id : 0); + val3.TelefoneCelular = val5; + val3.Cep = ((endereco != null) ? ((EnderecoBase)endereco).Cep : null); + val3.RelacaoSeguradoCondutor = null; + val3.Perfil = existPerfil; + val3.Uf = ((endereco != null) ? ((EnderecoBase)endereco).Estado : null) ?? null; + val3.NomeCompleto = cliente.Nome; + val3.CpfCnpj = cliente.Documento; + val3.DataNascimento = cliente.Nascimento; + val3.Sexo = ((cliente != null) ? EnumHelper.Value(cliente.Sexo) : null); + val3.DataHabilitacao = cliente.PrimeiraHabilitacao; + val3.TempoHabilitacao = EnumHelper.Value(tempoHabilitacao); + val3.EstadoCivil = EnumHelper.Value(cliente.EstadoCivil); + val3.NumeroHabilitacao = ((cliente != null) ? cliente.Habilitacao : null) ?? string.Empty; + val3.Id = ((cliente != null) ? ((DomainBase)cliente).Id : 0); + val2.Segurado = val3; + object imovel; + if (patrimonial != null) + { + Imovel val6 = new Imovel(); + EnderecoResidencia val7 = new EnderecoResidencia(); + Patrimonial obj29 = patrimonial; + val7.Cep = ((obj29 != null) ? ((EnderecoBase)obj29).Cep : null); + Patrimonial obj30 = patrimonial; + val7.Cidade = ((obj30 != null) ? ((EnderecoBase)obj30).Cidade : null); + Patrimonial obj31 = patrimonial; + val7.Estado = ((obj31 != null) ? ((EnderecoBase)obj31).Estado : null); + Patrimonial obj32 = patrimonial; + val7.Numero = ((obj32 != null) ? ((EnderecoBase)obj32).Numero : null); + Patrimonial obj33 = patrimonial; + val7.Logradouro = ((obj33 != null) ? ((EnderecoBase)obj33).Endereco : null); + Patrimonial obj34 = patrimonial; + val7.Complemento = ((obj34 != null) ? ((EnderecoBase)obj34).Complemento : null); + Patrimonial obj35 = patrimonial; + val7.Bairro = ((obj35 != null) ? ((EnderecoBase)obj35).Bairro : null); + val7.Id = 0; + val6.Endereco = val7; + val6.TipoOcupacao = null; + Patrimonial obj36 = patrimonial; + val6.TipoMoradia = ((obj36 != null) ? EnumHelper.Value(obj36.TipoMoradia) : null); + val6.TipoConstrucao = null; + val6.Id = 0; + imovel = (object)val6; + } + else + { + imovel = null; + } + val2.Imovel = (Imovel)imovel; + Seguro val8 = new Seguro + { + Comissao = doc.Comissao, + Agenciamento = 0m, + ComissaoSeguradora = new List() + }; + val8.VigenciaInicial = ((doc != null) ? doc.Vigencia2 : null) ?? DateTime.MinValue; + val8.VigenciaFinal = ((doc != null) ? doc.Vigencia2.Value.AddYears(1) : DateTime.MinValue); + val8.VigenciaFinalAnterior = ((doc != null) ? doc.Vigencia2 : null) ?? DateTime.MinValue; + val8.TipoSeguro = doc.Situacao.ConvertTipoSeguroCalculo(); + val8.Banco = null; + val8.Bonus = null; + val8.SeguradoraAnterior = ((doc != null) ? doc.Controle.Seguradora.Nome : null); + val8.CodigoIdentificacao = ""; + val8.NumeroApoliceAnterior = ((doc != null) ? doc.Apolice : null); + val8.Sinistros = ((item != null) ? item.Sinistrado.BoolToString() : null); + val8.RenovacaoGarantida = false; + val8.Observacoes = doc.Observacao; + val8.Id = ((DomainBase)doc).Id; + val2.Seguro = val8; + QuestionarioResidencia val9 = new QuestionarioResidencia + { + ImovelDesocupado = "", + AreaRisco = "", + ZonaRural = "", + CondominioFechado = "", + SeguradoProprietario = "", + ImovelTombado = "" + }; + val9.AtividadeProfissional = ((perfilPrincipal != null) ? perfilPrincipal.AtividadePrincipal : null) ?? ""; + val9.EquipamentoSeguranca = ((perfilPrincipal != null) ? perfilPrincipal.EquipamentoSeguranca : null) ?? ""; + val9.Id = 0; + val2.Questionario = val9; + val2.Cobertura = new CoberturaResidencia + { + Basica = basica, + DanosMorais = danosMorais, + ResponsabilidadeCivilFamiliar = responsabilidadeCivilFamiliar, + DanosEletricos = danosEletricos, + Equipamentos = equipamentos, + ImpactoVeiculos = impactoVeiculos, + Aluguel = aluguel, + Vidros = vidros, + RouboFurto = rouboFurto, + Vazamentos = vazamentos, + Vendaval = vendaval, + Desmoronamento = desmoronamento, + TumultoGreve = tumultoGreve, + RecomposicaoDocumento = recomposicaoDocumento, + Bike = bike, + Assistencia = num.ToString(), + Verba = "0", + ValorNovo = "0", + Alagamento = 0m, + PlacasSolares = placasSolares, + Id = 0 + }; + val.Residencia = val2; + return val; + } + + private async Task EmpresaCalculo(Documento doc) + { + Cliente cliente = await BuscaClienteCompleto(((DomainBase)doc.Controle.Cliente).Id); + ObservableCollection emails = cliente.Emails; + object obj; + if (emails == null) + { + obj = null; + } + else + { + ClienteEmail? obj2 = emails.FirstOrDefault(); + obj = ((obj2 != null) ? ((EmailBase)obj2).Email : null); + } + if (obj == null) + { + obj = string.Empty; + } + string email = (string)obj; + ClienteTelefone fone = cliente.Telefones?.FirstOrDefault() ?? null; + ClienteEndereco endereco = cliente.Enderecos?.FirstOrDefault() ?? null; + string s = (((cliente != null) ? cliente.PrimeiraHabilitacao : null) ?? DateTime.MinValue).ConvertTempoHabilitacaoCalculo(); + TempoHabilitacao tempoHabilitacao = Funcoes.ConvertTempoHabilitacao(int.Parse(s)); + PerfilEmpresa perfilPrincipal = await new PerfilEmpresaServico().BuscarPerfis(((DomainBase)doc.Controle).Id); + bool existPerfil = perfilPrincipal != null; + Item? obj3 = doc.ItensAtivo.FirstOrDefault(); + Item item = ((((obj3 != null) ? ((DomainBase)obj3).Id : 0) != 0L) ? (await new ItemServico().BuscarItems(((DomainBase)doc).Id, (StatusItem)2)).ToList() : null)?.FirstOrDefault(); + Patrimonial patrimonial = new Patrimonial(); + decimal value = default(decimal); + decimal value2 = default(decimal); + decimal value3 = default(decimal); + decimal value4 = default(decimal); + decimal value5 = default(decimal); + decimal value6 = default(decimal); + decimal value7 = default(decimal); + decimal value8 = default(decimal); + decimal value9 = default(decimal); + decimal value10 = default(decimal); + decimal value11 = default(decimal); + decimal value12 = default(decimal); + decimal value13 = default(decimal); + if (item != null) + { + patrimonial = item.Patrimonial; + List source = (await new ItemServico().BuscarCoberturasPorItemAsync(((DomainBase)item).Id)).ToList(); + source = source.Where((Cobertura cobertura) => cobertura.CoberturaPadrao != null).ToList(); + Cobertura? obj4 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 28)); + decimal obj8; + if (obj4 == null) + { + Cobertura? obj5 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 469)); + if (obj5 == null) + { + Cobertura? obj6 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 488)); + if (obj6 == null) + { + Cobertura? obj7 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 720)); + obj8 = ((obj7 != null) ? obj7.Lmi : 0m); + } + else + { + obj8 = obj6.Lmi; + } + } + else + { + obj8 = obj5.Lmi; + } + } + else + { + obj8 = obj4.Lmi; + } + value = obj8; + Cobertura? obj9 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 29)); + value2 = ((obj9 != null) ? obj9.Lmi : 0m); + Cobertura? obj10 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 33)); + decimal obj12; + if (obj10 == null) + { + Cobertura? obj11 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 467)); + obj12 = ((obj11 != null) ? obj11.Lmi : 0m); + } + else + { + obj12 = obj10.Lmi; + } + value3 = obj12; + Cobertura? obj13 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 41)); + value4 = ((obj13 != null) ? obj13.Lmi : 0m); + Cobertura? obj14 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 30)); + value5 = ((obj14 != null) ? obj14.Lmi : 0m); + Cobertura? obj15 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 44)); + value6 = ((obj15 != null) ? obj15.Lmi : 0m); + Cobertura? obj16 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 46)); + value7 = ((obj16 != null) ? obj16.Lmi : 0m); + Cobertura? obj17 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 31)); + decimal obj19; + if (obj17 == null) + { + Cobertura? obj18 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 289)); + obj19 = ((obj18 != null) ? obj18.Lmi : 0m); + } + else + { + obj19 = obj17.Lmi; + } + value8 = obj19; + Cobertura? obj20 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 276)); + value9 = ((obj20 != null) ? obj20.Lmi : 0m); + Cobertura? obj21 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 274)); + decimal obj23; + if (obj21 == null) + { + Cobertura? obj22 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 492)); + obj23 = ((obj22 != null) ? obj22.Lmi : 0m); + } + else + { + obj23 = obj21.Lmi; + } + value10 = obj23; + Cobertura? obj24 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 43)); + value11 = ((obj24 != null) ? obj24.Lmi : 0m); + Cobertura? obj25 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 186)); + value12 = ((obj25 != null) ? obj25.Lmi : 0m); + Cobertura? obj26 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 579)); + value13 = ((obj26 != null) ? obj26.Lmi : 0m); + } + Calculo val = new Calculo(); + CalculoEmpresa val2 = new CalculoEmpresa(); + Segurado val3 = new Segurado + { + Email = email + }; + Telefone val4 = new Telefone(); + val4.Ddd = ((fone != null) ? ((TelefoneBase)fone).Prefixo : null) ?? string.Empty; + val4.Numero = ((fone != null) ? ((TelefoneBase)fone).Numero : null) ?? string.Empty; + val4.Id = ((fone != null) ? ((DomainBase)fone).Id : 0); + val3.TelefoneResidencial = val4; + Telefone val5 = new Telefone(); + val5.Ddd = ((fone != null) ? ((TelefoneBase)fone).Prefixo : null) ?? string.Empty; + val5.Numero = ((fone != null) ? ((TelefoneBase)fone).Numero : null) ?? string.Empty; + val5.Id = ((fone != null) ? ((DomainBase)fone).Id : 0); + val3.TelefoneCelular = val5; + val3.Cep = ((endereco != null) ? ((EnderecoBase)endereco).Cep : null); + val3.RelacaoSeguradoCondutor = null; + val3.Perfil = existPerfil; + val3.Uf = ((endereco != null) ? ((EnderecoBase)endereco).Estado : null) ?? null; + val3.NomeCompleto = cliente.Nome; + val3.CpfCnpj = cliente.Documento; + val3.DataNascimento = cliente.Nascimento; + val3.Sexo = ((cliente != null) ? EnumHelper.Value(cliente.Sexo) : null); + val3.DataHabilitacao = cliente.PrimeiraHabilitacao; + val3.TempoHabilitacao = EnumHelper.Value(tempoHabilitacao); + val3.EstadoCivil = EnumHelper.Value(cliente.EstadoCivil); + val3.NumeroHabilitacao = ((cliente != null) ? cliente.Habilitacao : null) ?? string.Empty; + val3.Id = ((cliente != null) ? ((DomainBase)cliente).Id : 0); + val2.Segurado = val3; + object endereco2; + if (patrimonial != null) + { + EnderecoEmpresa val6 = new EnderecoEmpresa(); + Patrimonial obj27 = patrimonial; + val6.Cep = ((obj27 != null) ? ((EnderecoBase)obj27).Cep : null); + Patrimonial obj28 = patrimonial; + val6.Cidade = ((obj28 != null) ? ((EnderecoBase)obj28).Cidade : null); + Patrimonial obj29 = patrimonial; + val6.Estado = ((obj29 != null) ? ((EnderecoBase)obj29).Estado : null); + Patrimonial obj30 = patrimonial; + val6.Numero = ((obj30 != null) ? ((EnderecoBase)obj30).Numero : null); + Patrimonial obj31 = patrimonial; + val6.Logradouro = ((obj31 != null) ? ((EnderecoBase)obj31).Endereco : null); + Patrimonial obj32 = patrimonial; + val6.Complemento = ((obj32 != null) ? ((EnderecoBase)obj32).Complemento : null); + Patrimonial obj33 = patrimonial; + val6.Bairro = ((obj33 != null) ? ((EnderecoBase)obj33).Bairro : null); + endereco2 = (object)val6; + } + else + { + endereco2 = null; + } + val2.Endereco = (EnderecoEmpresa)endereco2; + Seguro val7 = new Seguro + { + Comissao = doc.Comissao, + Agenciamento = 0m, + ComissaoSeguradora = new List() + }; + val7.VigenciaInicial = ((doc != null) ? doc.Vigencia2 : null) ?? DateTime.MinValue; + val7.VigenciaFinal = ((doc != null) ? doc.Vigencia2.Value.AddYears(1) : DateTime.MinValue); + val7.VigenciaFinalAnterior = ((doc != null) ? doc.Vigencia2 : null) ?? DateTime.MinValue; + val7.TipoSeguro = doc.Situacao.ConvertTipoSeguroCalculo(); + val7.Banco = null; + val7.Bonus = null; + val7.SeguradoraAnterior = ((doc != null) ? doc.Controle.Seguradora.Nome : null); + val7.CodigoIdentificacao = ""; + val7.NumeroApoliceAnterior = ((doc != null) ? doc.Apolice : null); + val7.Sinistros = ((item != null) ? item.Sinistrado.BoolToString() : null); + val7.RenovacaoGarantida = false; + val7.Observacoes = doc.Observacao; + val7.Id = ((DomainBase)doc).Id; + val2.Seguro = val7; + QuestionarioEmpresa val8 = new QuestionarioEmpresa(); + val8.Atividade = ((perfilPrincipal != null) ? perfilPrincipal.AtividadePrincipal : null) ?? ""; + object obj34; + if (perfilPrincipal == null) + { + obj34 = null; + } + else + { + TipoConstrucao? tipoConstrucao = perfilPrincipal.TipoConstrucao; + obj34 = (tipoConstrucao.HasValue ? EnumHelper.Value(tipoConstrucao.GetValueOrDefault()) : null); + } + if (obj34 == null) + { + obj34 = ""; + } + val8.TipoConstrucao = (string)obj34; + object obj35; + if (perfilPrincipal == null) + { + obj35 = null; + } + else + { + Localizacao? localizacao = perfilPrincipal.Localizacao; + obj35 = (localizacao.HasValue ? EnumHelper.Value(localizacao.GetValueOrDefault()) : null); + } + if (obj35 == null) + { + obj35 = ""; + } + val8.Localizacao = (string)obj35; + val8.EquipamentoSeguranca = ((perfilPrincipal != null) ? perfilPrincipal.EquipamentoSeguranca : null) ?? ""; + val8.EquipamentoIncendio = ((perfilPrincipal != null) ? perfilPrincipal.EquipamentoIncendio : null) ?? ""; + object obj36; + if (perfilPrincipal == null) + { + obj36 = null; + } + else + { + TipoPavimentacao? tipoPavimento = perfilPrincipal.TipoPavimento; + obj36 = (tipoPavimento.HasValue ? EnumHelper.Value(tipoPavimento.GetValueOrDefault()) : null); + } + if (obj36 == null) + { + obj36 = ""; + } + val8.Pavimento = (string)obj36; + val8.AnoConstrucao = ((perfilPrincipal != null) ? perfilPrincipal.AnoConstrucao : null) ?? DateTime.MinValue; + val8.Isopainel = ((perfilPrincipal == null) ? null : perfilPrincipal.Isopainel?.BoolToString()) ?? ""; + val8.EstruturaMetal = ""; + val8.TerrenoBaldio = ((perfilPrincipal == null) ? null : perfilPrincipal.DivisaTerrenoBaldio?.BoolToString()) ?? ""; + val8.ImovelTombado = ""; + val8.Deposito = ((perfilPrincipal == null) ? null : perfilPrincipal.ExclusivoDeposito?.BoolToString()) ?? ""; + val8.CaixaEletronico = ((perfilPrincipal == null) ? null : perfilPrincipal.CaixasEletronicos?.BoolToString()) ?? ""; + val8.Construcao = ((perfilPrincipal == null) ? null : perfilPrincipal.ConstrucaoReforma?.BoolToString()) ?? ""; + val8.Id = 0; + val2.Questionario = val8; + val2.Cobertura = new CoberturaEmpresa + { + Basica = value, + DanoEletrico = value2, + Vidro = value5, + RouboFurto = value3, + RouboValor = default(decimal), + Equipamento = value7, + Vendaval = value4, + ImpactoVeiculo = value10, + Desmoronamento = value11, + Anuncio = value12, + Aluguel = value8, + TumultoGreve = value6, + RecomposicaoDocumento = value9, + ResponsabilidadeCivil = value13, + DanoMoral = default(decimal), + DespesaFixa = default(decimal), + LucroCessante = default(decimal), + Empregador = default(decimal), + Vazamento = default(decimal), + Sprinkler = default(decimal), + Fidelidade = default(decimal), + Assistencia = "", + Verba = "", + ValorNovo = "", + Alagamento = default(decimal), + PlacasSolares = default(decimal), + ResponsabilidadeCivilGaragista = default(decimal), + ContaminacaoDeterioracao = default(decimal) + }; + val.Empresa = val2; + return val; + } + + private async Task CondominioCalculo(Documento doc) + { + Cliente cliente = await BuscaClienteCompleto(((DomainBase)doc.Controle.Cliente).Id); + ObservableCollection emails = cliente.Emails; + object obj; + if (emails == null) + { + obj = null; + } + else + { + ClienteEmail? obj2 = emails.FirstOrDefault(); + obj = ((obj2 != null) ? ((EmailBase)obj2).Email : null); + } + if (obj == null) + { + obj = string.Empty; + } + string email = (string)obj; + ClienteTelefone fone = cliente.Telefones?.FirstOrDefault() ?? null; + ClienteEndereco endereco = cliente.Enderecos?.FirstOrDefault() ?? null; + string s = (((cliente != null) ? cliente.PrimeiraHabilitacao : null) ?? DateTime.MinValue).ConvertTempoHabilitacaoCalculo(); + TempoHabilitacao tempoHabilitacao = Funcoes.ConvertTempoHabilitacao(int.Parse(s)); + Item? obj3 = doc.ItensAtivo.FirstOrDefault(); + Item item = ((((obj3 != null) ? ((DomainBase)obj3).Id : 0) != 0L) ? (await new ItemServico().BuscarItems(((DomainBase)doc).Id, (StatusItem)2)).ToList() : null)?.FirstOrDefault(); + Patrimonial patrimonial = new Patrimonial(); + decimal value = default(decimal); + decimal value2 = default(decimal); + decimal value3 = default(decimal); + decimal value4 = default(decimal); + decimal value5 = default(decimal); + decimal value6 = default(decimal); + decimal value7 = default(decimal); + decimal value8 = default(decimal); + decimal value9 = default(decimal); + decimal value10 = default(decimal); + decimal value11 = default(decimal); + decimal value12 = default(decimal); + decimal value13 = default(decimal); + decimal value14 = default(decimal); + decimal value15 = default(decimal); + decimal value16 = default(decimal); + decimal value17 = default(decimal); + decimal value18 = default(decimal); + decimal value19 = default(decimal); + decimal value20 = default(decimal); + decimal value21 = default(decimal); + decimal value22 = default(decimal); + if (item != null) + { + patrimonial = item.Patrimonial; + List source = (await new ItemServico().BuscarCoberturasPorItemAsync(((DomainBase)item).Id)).ToList(); + source = source.Where((Cobertura cobertura) => cobertura.CoberturaPadrao != null).ToList(); + Cobertura? obj4 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 64)); + decimal obj6; + if (obj4 == null) + { + Cobertura? obj5 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 245)); + obj6 = ((obj5 != null) ? obj5.Lmi : 0m); + } + else + { + obj6 = obj4.Lmi; + } + value = obj6; + Cobertura? obj7 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 65)); + value2 = ((obj7 != null) ? obj7.Lmi : 0m); + Cobertura? obj8 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 374)); + decimal obj12; + if (obj8 == null) + { + Cobertura? obj9 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1017)); + if (obj9 == null) + { + Cobertura? obj10 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1066)); + if (obj10 == null) + { + Cobertura? obj11 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1074)); + obj12 = ((obj11 != null) ? obj11.Lmi : 0m); + } + else + { + obj12 = obj10.Lmi; + } + } + else + { + obj12 = obj9.Lmi; + } + } + else + { + obj12 = obj8.Lmi; + } + value3 = obj12; + Cobertura? obj13 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 152)); + value4 = ((obj13 != null) ? obj13.Lmi : 0m); + Cobertura? obj14 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 69)); + decimal obj17; + if (obj14 == null) + { + Cobertura? obj15 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 601)); + if (obj15 == null) + { + Cobertura? obj16 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 709)); + obj17 = ((obj16 != null) ? obj16.Lmi : 0m); + } + else + { + obj17 = obj15.Lmi; + } + } + else + { + obj17 = obj14.Lmi; + } + value5 = obj17; + Cobertura? obj18 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 66)); + decimal obj21; + if (obj18 == null) + { + Cobertura? obj19 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 710)); + if (obj19 == null) + { + Cobertura? obj20 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1091)); + obj21 = ((obj20 != null) ? obj20.Lmi : 0m); + } + else + { + obj21 = obj19.Lmi; + } + } + else + { + obj21 = obj18.Lmi; + } + value6 = obj21; + Cobertura? obj22 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 477)); + decimal obj24; + if (obj22 == null) + { + Cobertura? obj23 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 710)); + obj24 = ((obj23 != null) ? obj23.Lmi : 0m); + } + else + { + obj24 = obj22.Lmi; + } + value7 = obj24; + Cobertura? obj25 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 295)); + decimal obj28; + if (obj25 == null) + { + Cobertura? obj26 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 788)); + if (obj26 == null) + { + Cobertura? obj27 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1062)); + obj28 = ((obj27 != null) ? obj27.Lmi : 0m); + } + else + { + obj28 = obj26.Lmi; + } + } + else + { + obj28 = obj25.Lmi; + } + value8 = obj28; + Cobertura? obj29 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1063)); + decimal obj31; + if (obj29 == null) + { + Cobertura? obj30 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1624)); + obj31 = ((obj30 != null) ? obj30.Lmi : 0m); + } + else + { + obj31 = obj29.Lmi; + } + value9 = obj31; + Cobertura? obj32 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 71)); + value10 = ((obj32 != null) ? obj32.Lmi : 0m); + Cobertura? obj33 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 375)); + value11 = ((obj33 != null) ? obj33.Lmi : 0m); + Cobertura? obj34 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 417)); + decimal obj36; + if (obj34 == null) + { + Cobertura? obj35 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1625)); + obj36 = ((obj35 != null) ? obj35.Lmi : 0m); + } + else + { + obj36 = obj34.Lmi; + } + value12 = obj36; + Cobertura? obj37 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 223)); + decimal obj42; + if (obj37 == null) + { + Cobertura? obj38 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 282)); + if (obj38 == null) + { + Cobertura? obj39 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1070)); + if (obj39 == null) + { + Cobertura? obj40 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1085)); + if (obj40 == null) + { + Cobertura? obj41 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1626)); + obj42 = ((obj41 != null) ? obj41.Lmi : 0m); + } + else + { + obj42 = obj40.Lmi; + } + } + else + { + obj42 = obj39.Lmi; + } + } + else + { + obj42 = obj38.Lmi; + } + } + else + { + obj42 = obj37.Lmi; + } + value13 = obj42; + Cobertura? obj43 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 222)); + decimal obj49; + if (obj43 == null) + { + Cobertura? obj44 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 282)); + if (obj44 == null) + { + Cobertura? obj45 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1046)); + if (obj45 == null) + { + Cobertura? obj46 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1070)); + if (obj46 == null) + { + Cobertura? obj47 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1085)); + if (obj47 == null) + { + Cobertura? obj48 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1627)); + obj49 = ((obj48 != null) ? obj48.Lmi : 0m); + } + else + { + obj49 = obj47.Lmi; + } + } + else + { + obj49 = obj46.Lmi; + } + } + else + { + obj49 = obj45.Lmi; + } + } + else + { + obj49 = obj44.Lmi; + } + } + else + { + obj49 = obj43.Lmi; + } + value14 = obj49; + Cobertura? obj50 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 474)); + value15 = ((obj50 != null) ? obj50.Lmi : 0m); + Cobertura? obj51 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 70)); + decimal obj55; + if (obj51 == null) + { + Cobertura? obj52 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1047)); + if (obj52 == null) + { + Cobertura? obj53 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1075)); + if (obj53 == null) + { + Cobertura? obj54 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1554)); + obj55 = ((obj54 != null) ? obj54.Lmi : 0m); + } + else + { + obj55 = obj53.Lmi; + } + } + else + { + obj55 = obj52.Lmi; + } + } + else + { + obj55 = obj51.Lmi; + } + value16 = obj55; + Cobertura? obj56 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1065)); + decimal obj59; + if (obj56 == null) + { + Cobertura? obj57 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1071)); + if (obj57 == null) + { + Cobertura? obj58 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1429)); + obj59 = ((obj58 != null) ? obj58.Lmi : 0m); + } + else + { + obj59 = obj57.Lmi; + } + } + else + { + obj59 = obj56.Lmi; + } + value17 = obj59; + Cobertura? obj60 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 601)); + decimal obj62; + if (obj60 == null) + { + Cobertura? obj61 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 709)); + obj62 = ((obj61 != null) ? obj61.Lmi : 0m); + } + else + { + obj62 = obj60.Lmi; + } + value18 = obj62; + Cobertura? obj63 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 86)); + decimal obj66; + if (obj63 == null) + { + Cobertura? obj64 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1108)); + if (obj64 == null) + { + Cobertura? obj65 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1628)); + obj66 = ((obj65 != null) ? obj65.Lmi : 0m); + } + else + { + obj66 = obj64.Lmi; + } + } + else + { + obj66 = obj63.Lmi; + } + value19 = obj66; + Cobertura? obj67 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 67)); + value20 = ((obj67 != null) ? obj67.Lmi : 0m); + Cobertura? obj68 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1064)); + decimal obj70; + if (obj68 == null) + { + Cobertura? obj69 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1071)); + obj70 = ((obj69 != null) ? obj69.Lmi : 0m); + } + else + { + obj70 = obj68.Lmi; + } + value21 = obj70; + Cobertura? obj71 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 526)); + decimal obj73; + if (obj71 == null) + { + Cobertura? obj72 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1073)); + obj73 = ((obj72 != null) ? obj72.Lmi : 0m); + } + else + { + obj73 = obj71.Lmi; + } + value22 = obj73; + } + Calculo val = new Calculo(); + CalculoCondominio val2 = new CalculoCondominio(); + Segurado val3 = new Segurado + { + Email = email + }; + Telefone val4 = new Telefone(); + val4.Ddd = ((fone != null) ? ((TelefoneBase)fone).Prefixo : null) ?? string.Empty; + val4.Numero = ((fone != null) ? ((TelefoneBase)fone).Numero : null) ?? string.Empty; + val4.Id = ((fone != null) ? ((DomainBase)fone).Id : 0); + val3.TelefoneResidencial = val4; + Telefone val5 = new Telefone(); + val5.Ddd = ((fone != null) ? ((TelefoneBase)fone).Prefixo : null) ?? string.Empty; + val5.Numero = ((fone != null) ? ((TelefoneBase)fone).Numero : null) ?? string.Empty; + val5.Id = ((fone != null) ? ((DomainBase)fone).Id : 0); + val3.TelefoneCelular = val5; + val3.Cep = ((endereco != null) ? ((EnderecoBase)endereco).Cep : null); + val3.RelacaoSeguradoCondutor = null; + val3.Uf = ((endereco != null) ? ((EnderecoBase)endereco).Estado : null) ?? null; + val3.NomeCompleto = cliente.Nome; + val3.CpfCnpj = cliente.Documento; + val3.DataNascimento = cliente.Nascimento; + val3.Sexo = ((cliente != null) ? EnumHelper.Value(cliente.Sexo) : null); + val3.DataHabilitacao = cliente.PrimeiraHabilitacao; + val3.TempoHabilitacao = EnumHelper.Value(tempoHabilitacao); + val3.EstadoCivil = EnumHelper.Value(cliente.EstadoCivil); + val3.NumeroHabilitacao = ((cliente != null) ? cliente.Habilitacao : null) ?? string.Empty; + val3.Id = ((cliente != null) ? ((DomainBase)cliente).Id : 0); + val2.Segurado = val3; + object endereco2; + if (patrimonial != null) + { + EnderecoEmpresa val6 = new EnderecoEmpresa(); + Patrimonial obj74 = patrimonial; + val6.Cep = ((obj74 != null) ? ((EnderecoBase)obj74).Cep : null); + Patrimonial obj75 = patrimonial; + val6.Cidade = ((obj75 != null) ? ((EnderecoBase)obj75).Cidade : null); + Patrimonial obj76 = patrimonial; + val6.Estado = ((obj76 != null) ? ((EnderecoBase)obj76).Estado : null); + Patrimonial obj77 = patrimonial; + val6.Numero = ((obj77 != null) ? ((EnderecoBase)obj77).Numero : null); + Patrimonial obj78 = patrimonial; + val6.Logradouro = ((obj78 != null) ? ((EnderecoBase)obj78).Endereco : null); + Patrimonial obj79 = patrimonial; + val6.Complemento = ((obj79 != null) ? ((EnderecoBase)obj79).Complemento : null); + Patrimonial obj80 = patrimonial; + val6.Bairro = ((obj80 != null) ? ((EnderecoBase)obj80).Bairro : null); + endereco2 = (object)val6; + } + else + { + endereco2 = null; + } + val2.Endereco = (EnderecoEmpresa)endereco2; + Seguro val7 = new Seguro + { + Comissao = doc.Comissao, + Agenciamento = 0m, + ComissaoSeguradora = new List() + }; + val7.VigenciaInicial = ((doc != null) ? doc.Vigencia2 : null) ?? DateTime.MinValue; + val7.VigenciaFinal = ((doc != null) ? doc.Vigencia2.Value.AddYears(1) : DateTime.MinValue); + val7.VigenciaFinalAnterior = ((doc != null) ? doc.Vigencia2 : null) ?? DateTime.MinValue; + val7.TipoSeguro = doc.Situacao.ConvertTipoSeguroCalculo(); + val7.Banco = null; + val7.Bonus = null; + val7.SeguradoraAnterior = ((doc != null) ? doc.Controle.Seguradora.Nome : null); + val7.CodigoIdentificacao = ""; + val7.NumeroApoliceAnterior = ((doc != null) ? doc.Apolice : null); + val7.Sinistros = ((item != null) ? item.Sinistrado.BoolToString() : null); + val7.RenovacaoGarantida = false; + val7.Observacoes = doc.Observacao; + val7.Id = ((DomainBase)doc).Id; + val2.Seguro = val7; + val2.Questionario = new QuestionarioCondominio + { + Ocupacao = "", + Estrutura = "", + AreaComercial = "", + ImovelTombado = "", + AreaConstruida = "", + AnoConstrucao = "", + Funcionarios = "", + Blocos = "", + Elevadores = "", + Pavimentos = "", + EquipamentoSeguranca = "", + EquipamentoIncendio = "", + Desmoronamento = "", + Id = 0 + }; + val2.Cobertura = new CoberturaCondominio + { + Basica = value, + DanosEletricos = value2, + DanosMorais = value3, + TumultoGreve = value4, + RouboBens = value5, + Vidros = value6, + Anuncios = value7, + Portoes = value8, + Alagamento = value9, + Desmoronamento = value10, + ImpactoVeiculo = value11, + DespesasFixas = value12, + Sindico = value13, + Condominio = value14, + Garagista = value15, + GaragistaExclusiva = default(decimal), + Vendaval = value16, + Vazamento = value17, + IncendioBens = default(decimal), + RouboCondominio = value18, + VidaFuncionario = value19, + Aluguel = value20, + Chuveiro = value21, + Empregador = value22, + Equipamento = default(decimal), + Assistencia = "", + ValorNovo = "", + PlacasSolares = default(decimal) + }; + val.Condominio = val2; + return val; + } + + private async Task VidaIndividualCalculo(Documento doc) + { + Cliente cliente = await BuscaClienteCompleto(((DomainBase)doc.Controle.Cliente).Id); + ObservableCollection emails = cliente.Emails; + object obj; + if (emails == null) + { + obj = null; + } + else + { + ClienteEmail? obj2 = emails.FirstOrDefault(); + obj = ((obj2 != null) ? ((EmailBase)obj2).Email : null); + } + if (obj == null) + { + obj = string.Empty; + } + string email = (string)obj; + ClienteTelefone fone = cliente.Telefones?.FirstOrDefault() ?? null; + ClienteEndereco endereco = cliente.Enderecos?.FirstOrDefault() ?? null; + string s = (((cliente != null) ? cliente.PrimeiraHabilitacao : null) ?? DateTime.MinValue).ConvertTempoHabilitacaoCalculo(); + TempoHabilitacao tempoHabilitacao = Funcoes.ConvertTempoHabilitacao(int.Parse(s)); + Item? obj3 = doc.ItensAtivo.FirstOrDefault(); + Item item = ((((obj3 != null) ? ((DomainBase)obj3).Id : 0) != 0L) ? (await new ItemServico().BuscarItems(((DomainBase)doc).Id, (StatusItem)2)).ToList() : null)?.FirstOrDefault(); + Patrimonial vidaIndividual = new Patrimonial(); + decimal value = default(decimal); + decimal num = default(decimal); + decimal num2 = default(decimal); + decimal num3 = default(decimal); + decimal num4 = default(decimal); + decimal num5 = default(decimal); + decimal num6 = default(decimal); + decimal num7 = default(decimal); + decimal num8 = default(decimal); + if (item != null) + { + vidaIndividual = item.Patrimonial; + List source = (await new ItemServico().BuscarCoberturasPorItemAsync(((DomainBase)item).Id)).ToList(); + source = source.Where((Cobertura cobertura) => cobertura.CoberturaPadrao != null).ToList(); + Cobertura? obj4 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1535)); + value = ((obj4 != null) ? obj4.Lmi : 0m); + Cobertura? obj5 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 56)); + num = ((obj5 != null) ? obj5.Lmi : 0m); + Cobertura? obj6 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 57)); + num2 = ((obj6 != null) ? obj6.Lmi : 0m); + Cobertura? obj7 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 58)); + num3 = ((obj7 != null) ? obj7.Lmi : 0m); + Cobertura? obj8 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 193)); + num4 = ((obj8 != null) ? obj8.Lmi : 0m); + Cobertura? obj9 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 62)); + decimal obj12; + if (obj9 == null) + { + Cobertura? obj10 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1069)); + if (obj10 == null) + { + Cobertura? obj11 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1647)); + obj12 = ((obj11 != null) ? obj11.Lmi : 0m); + } + else + { + obj12 = obj10.Lmi; + } + } + else + { + obj12 = obj9.Lmi; + } + num5 = obj12; + Cobertura? obj13 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 189)); + num6 = ((obj13 != null) ? obj13.Lmi : 0m); + Cobertura? obj14 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 59)); + decimal obj19; + if (obj14 == null) + { + Cobertura? obj15 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 463)); + if (obj15 == null) + { + Cobertura? obj16 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 464)); + if (obj16 == null) + { + Cobertura? obj17 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1170)); + if (obj17 == null) + { + Cobertura? obj18 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1200)); + obj19 = ((obj18 != null) ? obj18.Lmi : 0m); + } + else + { + obj19 = obj17.Lmi; + } + } + else + { + obj19 = obj16.Lmi; + } + } + else + { + obj19 = obj15.Lmi; + } + } + else + { + obj19 = obj14.Lmi; + } + num7 = obj19; + Cobertura? obj20 = ((IEnumerable)source).FirstOrDefault((Func)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 63)); + num8 = ((obj20 != null) ? obj20.Lmi : 0m); + } + Calculo val = new Calculo(); + CalculoVidaIndividual val2 = new CalculoVidaIndividual(); + Segurado val3 = new Segurado + { + Email = email + }; + Telefone val4 = new Telefone(); + val4.Ddd = ((fone != null) ? ((TelefoneBase)fone).Prefixo : null) ?? string.Empty; + val4.Numero = ((fone != null) ? ((TelefoneBase)fone).Numero : null) ?? string.Empty; + val4.Id = ((fone != null) ? ((DomainBase)fone).Id : 0); + val3.TelefoneResidencial = val4; + Telefone val5 = new Telefone(); + val5.Ddd = ((fone != null) ? ((TelefoneBase)fone).Prefixo : null) ?? string.Empty; + val5.Numero = ((fone != null) ? ((TelefoneBase)fone).Numero : null) ?? string.Empty; + val5.Id = ((fone != null) ? ((DomainBase)fone).Id : 0); + val3.TelefoneCelular = val5; + val3.Cep = ((endereco != null) ? ((EnderecoBase)endereco).Cep : null); + val3.RelacaoSeguradoCondutor = null; + val3.Uf = ((endereco != null) ? ((EnderecoBase)endereco).Estado : null) ?? null; + val3.NomeCompleto = cliente.Nome; + val3.CpfCnpj = cliente.Documento; + val3.DataNascimento = cliente.Nascimento; + val3.Sexo = ((cliente != null) ? EnumHelper.Value(cliente.Sexo) : null); + val3.DataHabilitacao = cliente.PrimeiraHabilitacao; + val3.TempoHabilitacao = EnumHelper.Value(tempoHabilitacao); + val3.EstadoCivil = EnumHelper.Value(cliente.EstadoCivil); + val3.NumeroHabilitacao = ((cliente != null) ? cliente.Habilitacao : null) ?? string.Empty; + val3.Id = ((cliente != null) ? ((DomainBase)cliente).Id : 0); + val2.Segurado = val3; + object endereco2; + if (vidaIndividual != null) + { + EnderecoEmpresa val6 = new EnderecoEmpresa(); + Patrimonial obj21 = vidaIndividual; + val6.Cep = ((obj21 != null) ? ((EnderecoBase)obj21).Cep : null); + Patrimonial obj22 = vidaIndividual; + val6.Cidade = ((obj22 != null) ? ((EnderecoBase)obj22).Cidade : null); + Patrimonial obj23 = vidaIndividual; + val6.Estado = ((obj23 != null) ? ((EnderecoBase)obj23).Estado : null); + Patrimonial obj24 = vidaIndividual; + val6.Numero = ((obj24 != null) ? ((EnderecoBase)obj24).Numero : null); + Patrimonial obj25 = vidaIndividual; + val6.Logradouro = ((obj25 != null) ? ((EnderecoBase)obj25).Endereco : null); + Patrimonial obj26 = vidaIndividual; + val6.Complemento = ((obj26 != null) ? ((EnderecoBase)obj26).Complemento : null); + Patrimonial obj27 = vidaIndividual; + val6.Bairro = ((obj27 != null) ? ((EnderecoBase)obj27).Bairro : null); + endereco2 = (object)val6; + } + else + { + endereco2 = null; + } + val2.Endereco = (EnderecoEmpresa)endereco2; + Seguro val7 = new Seguro + { + Comissao = doc.Comissao, + Agenciamento = 0m, + ComissaoSeguradora = new List() + }; + val7.VigenciaInicial = ((doc != null) ? doc.Vigencia2 : null) ?? DateTime.MinValue; + val7.VigenciaFinal = ((doc != null) ? doc.Vigencia2.Value.AddYears(1) : DateTime.MinValue); + val7.VigenciaFinalAnterior = ((doc != null) ? doc.Vigencia2 : null) ?? DateTime.MinValue; + val7.TipoSeguro = doc.Situacao.ConvertTipoSeguroCalculo(); + val7.Banco = null; + val7.Bonus = null; + val7.SeguradoraAnterior = ((doc != null) ? doc.Controle.Seguradora.Nome : null); + val7.CodigoIdentificacao = ""; + val7.NumeroApoliceAnterior = ((doc != null) ? doc.Apolice : null); + val7.Sinistros = ((item != null) ? item.Sinistrado.BoolToString() : null); + val7.RenovacaoGarantida = false; + val7.Observacoes = doc.Observacao; + val7.Id = ((DomainBase)doc).Id; + val2.Seguro = val7; + val2.Questionario = new QuestionarioVidaIndividual + { + Peso = 0, + Altura = 0f, + RendaMensal = default(decimal), + Fumante = "", + Esporte = "", + Aposentado = "", + Profissoes = null, + Profissao = null + }; + val2.Cobertura = new CoberturaVidaIndividual + { + Capital = value, + CapitalDoenca = default(decimal), + CapitalDit = default(decimal), + CapitalDih = 0m, + Morte = num.ToString(), + MorteAcidental = num2.ToString(), + Ipa = num3.ToString(), + Ifpd = num4.ToString(), + AssistenciaFuneral = num7.ToString(), + CapitalIpa = default(decimal), + CapitalIfpd = default(decimal), + CapitalMorteAcidental = default(decimal), + DoencaGrave = num5.ToString(), + Dit = num6.ToString(), + Dih = num8.ToString() + }; + val.Vida = val2; + return val; + } + + private async Task VidaGlobalCalculo(Documento doc) + { + Cliente obj = await BuscaClienteCompleto(((DomainBase)doc.Controle.Cliente).Id); + ObservableCollection emails = obj.Emails; + object obj2; + if (emails == null) + { + obj2 = null; + } + else + { + ClienteEmail? obj3 = emails.FirstOrDefault(); + obj2 = ((obj3 != null) ? ((EmailBase)obj3).Email : null); + } + if (obj2 == null) + { + _ = string.Empty; + } + obj.Telefones?.FirstOrDefault(); + obj.Enderecos?.FirstOrDefault(); + Funcoes.ConvertTempoHabilitacao(int.Parse((((obj != null) ? obj.PrimeiraHabilitacao : null) ?? DateTime.MinValue).ConvertTempoHabilitacaoCalculo())); + return new Calculo(); + } + + private async Task Iniciar(bool trazerParaFrente = false) + { + if (!"Aggilizador.Application".ProgramaEmExecucao()) + { + Gestor.Application.Actions.Actions.IniciarAggilizador?.Invoke(); + await Task.Delay(8000); + } + if (trazerParaFrente) + { + "Aggilizador.Application".BringToFront(); + } + } + + private unsafe async void IniciarPipe(dynamic message) + { + dynamic awaiter = CallPipe(message).GetAwaiter(); + if (!(bool)awaiter.IsCompleted) + { + ICriticalNotifyCompletion awaiter2 = awaiter as ICriticalNotifyCompletion; + AsyncVoidMethodBuilder asyncVoidMethodBuilder = default(AsyncVoidMethodBuilder); + if (awaiter2 == null) + { + INotifyCompletion awaiter3 = (INotifyCompletion)(object)awaiter; + asyncVoidMethodBuilder.AwaitOnCompleted(ref awaiter3, ref *(_003CIniciarPipe_003Ed__29*)/*Error near IL_017c: stateMachine*/); + } + else + { + asyncVoidMethodBuilder.AwaitUnsafeOnCompleted(ref awaiter2, ref *(_003CIniciarPipe_003Ed__29*)/*Error near IL_018f: stateMachine*/); + } + /*Error near IL_0198: leave MoveNext - await not detected correctly*/; + } + dynamic result = awaiter.GetResult(); + if (!(result ? true : false)) + { + await new DashboardViewModel().ShowMessage(MessageAggilizador); + } + } + + private async void Prospectar() + { + if (ClienteId != null && RamoId != null) + { + await Iniciar(trazerParaFrente: true); + dynamic val = new + { + ClientId = long.Parse(ClienteId.ToString()), + DocumentId = 0, + ControlId = 0, + ItemId = 0, + Branch = long.Parse(RamoId.ToString()) + }; + IniciarPipe(val); + } + } + + private async Task VerificarPermissao() + { + if (!Recursos.Usuario.PermissaoAggilizador.HasValue) + { + await new DashboardViewModel().ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR O AGGILIZADOR"); + return false; + } + if (LicenseHelper.Produtos.All((Licenca x) => (int)x.Produto != 79 && (int)x.Produto != 81 && (int)x.Produto != 91)) + { + await new DashboardViewModel().ShowMessage("VOCÊ AINDA NÃO POSSUI AGGILIZADOR DE CÁLCULOS, ENTRE EM CONTATO COM comercial@agger.com.br PARA SABER MAIS"); + return false; + } + return true; + } + + private async void VisualizarCalculos_OnClick(object sender, RoutedEventArgs e) + { + if (await VerificarPermissao() && !string.IsNullOrEmpty(Documento)) + { + Documento val = await new ApoliceServico().BuscarApoliceAsync(long.Parse(DocumentoId.ToString()), itens: true); + string chassi = null; + if (RamoId != null && long.Parse(RamoId.ToString()) == 5) + { + string text = ((val.ItensAtivo == null || val.ItensAtivo.Count <= 0) ? null : (await new AutoServico().BuscarChassi(((DomainBase)val.ItensAtivo.First()).Id))); + chassi = text; + } + await Iniciar(); + dynamic val2 = new + { + CpfCnpj = Documento.Clear() + }; + if (RamoId != null) + { + val2 = new + { + CpfCnpj = Documento.Clear(), + Branch = long.Parse(RamoId.ToString()) + }; + } + if (chassi != null && RamoId != null) + { + val2 = new + { + CpfCnpj = Documento.Clear(), + Branch = long.Parse(RamoId.ToString()), + Chassi = chassi + }; + } + IniciarPipe(val2); + } + } + + private async Task CallPipe(dynamic message) + { + int tries = 7; + PipeClient pipe = new PipeClient("AggilizadorPIPE"); + dynamic val = pipe.Send(message); + while (!val && tries > 0) + { + await Task.Delay(2000); + val = pipe.Send(message); + tries--; + } + return val; + } + + private void DropContextMenu_OnClick(object sender, RoutedEventArgs e) + { + if (string.IsNullOrEmpty(Documento)) + { + Calcular_OnClick(sender, e); + return; + } + Button val = (Button)((sender is Button) ? sender : null); + ContextMenu contextMenu = ((FrameworkElement)val).ContextMenu; + contextMenu.PlacementTarget = (UIElement)(object)val; + contextMenu.Placement = (PlacementMode)10; + contextMenu.IsOpen = true; + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/calculocontrol.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0026: Expected O, but got Unknown + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_0033: Expected O, but got Unknown + //IL_0040: Unknown result type (might be due to invalid IL or missing references) + //IL_004a: Expected O, but got Unknown + //IL_004c: Unknown result type (might be due to invalid IL or missing references) + //IL_0058: Unknown result type (might be due to invalid IL or missing references) + //IL_0062: Expected O, but got Unknown + //IL_0064: Unknown result type (might be due to invalid IL or missing references) + //IL_0070: Unknown result type (might be due to invalid IL or missing references) + //IL_007a: Expected O, but got Unknown + switch (connectionId) + { + case 1: + LayoutRoot = (Grid)target; + break; + case 2: + CalculoButton = (Button)target; + ((ButtonBase)CalculoButton).Click += new RoutedEventHandler(DropContextMenu_OnClick); + break; + case 3: + ((MenuItem)target).Click += new RoutedEventHandler(Calcular_OnClick); + break; + case 4: + ((MenuItem)target).Click += new RoutedEventHandler(VisualizarCalculos_OnClick); + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/CoberturaView.cs b/Decompiler/Gestor.Application.Componentes/CoberturaView.cs new file mode 100644 index 0000000..3ab59c9 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/CoberturaView.cs @@ -0,0 +1,128 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Markup; +using Gestor.Application.ViewModels; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Componentes; + +public class CoberturaView : BaseUserControl, IComponentConnector, IStyleConnector +{ + internal DataGrid CoberturaGrid; + + private bool _contentLoaded; + + public CoberturaViewModel ViewModel { get; set; } + + public CoberturaView(CoberturaViewModel viewModel) + { + ViewModel = viewModel ?? new CoberturaViewModel(); + InitializeComponent(); + ((FrameworkElement)CoberturaGrid).DataContext = ViewModel; + } + + private void ExcluirCobertura_OnClick(object sender, RoutedEventArgs e) + { + //IL_0040: Unknown result type (might be due to invalid IL or missing references) + //IL_004a: Expected O, but got Unknown + DataGrid coberturaGrid = CoberturaGrid; + if (coberturaGrid == null || ((Selector)coberturaGrid).SelectedIndex >= 0) + { + CoberturaViewModel viewModel = ViewModel; + DataGrid coberturaGrid2 = CoberturaGrid; + viewModel.ExcluirCobertura((Cobertura)((coberturaGrid2 != null) ? ((ItemsControl)coberturaGrid2).Items[((Selector)CoberturaGrid).SelectedIndex] : null)); + } + } + + private void AdicionaCobertura_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AdicionaCobertura(); + } + + private void AutoCompleteBox_Populating(object sender, PopulatingEventArgs e) + { + if (!ViewModel.IsEnabled || e.Parameter.Trim().Length < 3) + { + return; + } + e.Cancel = true; + ViewModel.BuscarCobertura(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/coberturaview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + //IL_0021: Expected O, but got Unknown + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((MenuItem)target).Click += new RoutedEventHandler(AdicionaCobertura_OnClick); + break; + case 2: + CoberturaGrid = (DataGrid)target; + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_000a: Unknown result type (might be due to invalid IL or missing references) + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Expected O, but got Unknown + //IL_0022: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_0038: Expected O, but got Unknown + switch (connectionId) + { + case 3: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBox_Populating); + break; + case 4: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirCobertura_OnClick); + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/ContasDialog.cs b/Decompiler/Gestor.Application.Componentes/ContasDialog.cs new file mode 100644 index 0000000..bca8893 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/ContasDialog.cs @@ -0,0 +1,72 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; +using Gestor.Application.ViewModels.Financeiro; +using Gestor.Model.Domain.Financeiro; + +namespace Gestor.Application.Componentes; + +public class ContasDialog : UserControl, IComponentConnector +{ + internal Button ImportarButton; + + internal Button CancelarButton; + + private bool _contentLoaded; + + private ContasDialogModel ViewModel { get; set; } + + public ContasDialog(List contas) + { + ViewModel = new ContasDialogModel(contas); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/contasdialog.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_0016: Expected O, but got Unknown + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_0023: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ImportarButton = (Button)target; + break; + case 2: + CancelarButton = (Button)target; + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/CustomIsReadOnlyControl.cs b/Decompiler/Gestor.Application.Componentes/CustomIsReadOnlyControl.cs new file mode 100644 index 0000000..b5a43b1 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/CustomIsReadOnlyControl.cs @@ -0,0 +1,64 @@ +using System.Windows; + +namespace Gestor.Application.Componentes; + +public class CustomIsReadOnlyControl : CustomItemControl +{ + public static readonly DependencyProperty IsReadOnlyProperty = DependencyProperty.Register("IsReadOnly", typeof(bool), typeof(CustomIsReadOnlyControl), (PropertyMetadata)new FrameworkPropertyMetadata((object)false, (FrameworkPropertyMetadataOptions)256)); + + public static readonly DependencyProperty HasValidationProperty = DependencyProperty.Register("HasValidation", typeof(bool), typeof(CustomIsReadOnlyControl), (PropertyMetadata)new FrameworkPropertyMetadata((object)false, (FrameworkPropertyMetadataOptions)256)); + + public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(CustomIsReadOnlyControl), (PropertyMetadata)new FrameworkPropertyMetadata((object)string.Empty, (FrameworkPropertyMetadataOptions)256)); + + public static readonly DependencyProperty TextAlignmentProperty = DependencyProperty.Register("TextAlignment", typeof(TextAlignment), typeof(CustomIsReadOnlyControl), (PropertyMetadata)new FrameworkPropertyMetadata((object)(TextAlignment)0, (FrameworkPropertyMetadataOptions)256)); + + public bool IsReadOnly + { + get + { + return (bool)((DependencyObject)this).GetValue(IsReadOnlyProperty); + } + set + { + ((DependencyObject)this).SetValue(IsReadOnlyProperty, (object)value); + } + } + + public bool HasValidation + { + get + { + return (bool)((DependencyObject)this).GetValue(HasValidationProperty); + } + set + { + ((DependencyObject)this).SetValue(HasValidationProperty, (object)value); + } + } + + public string Text + { + get + { + return (string)((DependencyObject)this).GetValue(TextProperty); + } + set + { + ((DependencyObject)this).SetValue(TextProperty, (object)value); + } + } + + public TextAlignment TextAlignment + { + get + { + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + return (TextAlignment)((DependencyObject)this).GetValue(TextAlignmentProperty); + } + set + { + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + ((DependencyObject)this).SetValue(TextAlignmentProperty, (object)value); + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/CustomItemControl.cs b/Decompiler/Gestor.Application.Componentes/CustomItemControl.cs new file mode 100644 index 0000000..12adba1 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/CustomItemControl.cs @@ -0,0 +1,39 @@ +using System.Windows; +using System.Windows.Controls; + +namespace Gestor.Application.Componentes; + +public class CustomItemControl : ItemsControl +{ + public static readonly DependencyProperty LabelProperty = DependencyProperty.Register("Label", typeof(string), typeof(CustomItemControl), (PropertyMetadata)new FrameworkPropertyMetadata((object)string.Empty, (FrameworkPropertyMetadataOptions)256)); + + public static readonly DependencyProperty LabelVisibilityProperty = DependencyProperty.Register("LabelVisibility", typeof(Visibility), typeof(CustomItemControl), (PropertyMetadata)new FrameworkPropertyMetadata((object)(Visibility)0, (FrameworkPropertyMetadataOptions)256)); + + public bool Entered { get; set; } + + public string Label + { + get + { + return (string)((DependencyObject)this).GetValue(LabelProperty); + } + set + { + ((DependencyObject)this).SetValue(LabelProperty, (object)value); + } + } + + public Visibility LabelVisibility + { + get + { + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + return (Visibility)((DependencyObject)this).GetValue(LabelVisibilityProperty); + } + set + { + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + ((DependencyObject)this).SetValue(LabelVisibilityProperty, (object)value); + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/CustomItemValidation.cs b/Decompiler/Gestor.Application.Componentes/CustomItemValidation.cs new file mode 100644 index 0000000..be7b958 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/CustomItemValidation.cs @@ -0,0 +1,5 @@ +namespace Gestor.Application.Componentes; + +public class CustomItemValidation : CustomItemControl +{ +} diff --git a/Decompiler/Gestor.Application.Componentes/CustomLegendChart.cs b/Decompiler/Gestor.Application.Componentes/CustomLegendChart.cs new file mode 100644 index 0000000..5bf30bc --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/CustomLegendChart.cs @@ -0,0 +1,133 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; +using System.Windows.Media; +using LiveCharts.Definitions.Series; +using LiveCharts.Wpf; +using LiveCharts.Wpf.Charts.Base; + +namespace Gestor.Application.Componentes; + +public class CustomLegendChart : UserControl, IChartLegend, INotifyPropertyChanged, IComponentConnector +{ + public static readonly DependencyProperty OrientationProperty = DependencyProperty.Register("Orientation", typeof(Orientation), typeof(CustomLegendChart), new PropertyMetadata((object)(Orientation)0)); + + internal ItemsControl itemsControl; + + private bool _contentLoaded; + + public Orientation Orientation + { + get + { + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + return (Orientation)((DependencyObject)this).GetValue(OrientationProperty); + } + set + { + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + ((DependencyObject)this).SetValue(OrientationProperty, (object)value); + } + } + + public ObservableCollection LegendEntries { get; } = new ObservableCollection(); + + + public List Series + { + get + { + return LegendEntries.Select((CustomSeriesViewModel x) => x.SeriesViewModel).ToList(); + } + set + { + Chart ownerChart = GetOwnerChart(); + foreach (CustomSeriesViewModel item in LegendEntries.Where((CustomSeriesViewModel x) => !((IEnumerable)ownerChart.Series).Any((ISeriesView s) => s == x.View)).ToList()) + { + LegendEntries.Remove(item); + } + foreach (SeriesViewModel svm in value) + { + if (LegendEntries.All((CustomSeriesViewModel x) => x.Title != svm.Title)) + { + ISeriesView view = ((IEnumerable)ownerChart.Series).FirstOrDefault((Func)((ISeriesView x) => x.Title == svm.Title)); + LegendEntries.Add(new CustomSeriesViewModel(svm, view)); + } + } + OnPropertyChanged("Series"); + } + } + + public event PropertyChangedEventHandler PropertyChanged; + + public CustomLegendChart() + { + InitializeComponent(); + ((FrameworkElement)itemsControl).DataContext = this; + } + + private Chart GetOwnerChart() + { + return CustomLegendChart.FindParent((DependencyObject)(object)this); + } + + protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = "") + { + if (this.PropertyChanged != null) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + public static T FindParent(DependencyObject child) where T : DependencyObject + { + DependencyObject parent = VisualTreeHelper.GetParent(child); + if (parent == null) + { + return default(T); + } + T val = (T)(object)((parent is T) ? parent : null); + if (val != null) + { + return val; + } + return FindParent(parent); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/customlegendchart.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_0010: Expected O, but got Unknown + if (connectionId == 1) + { + itemsControl = (ItemsControl)target; + } + else + { + _contentLoaded = true; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/CustomPasswordBox.cs b/Decompiler/Gestor.Application.Componentes/CustomPasswordBox.cs new file mode 100644 index 0000000..39b5a0b --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/CustomPasswordBox.cs @@ -0,0 +1,199 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Markup; + +namespace Gestor.Application.Componentes; + +public class CustomPasswordBox : UserControl, IComponentConnector +{ + public static readonly DependencyProperty IsReadOnlyProperty = DependencyProperty.Register("IsReadOnly", typeof(bool), typeof(CustomPasswordBox), new PropertyMetadata((object)false, new PropertyChangedCallback(OnBoundIsReadOnlyChanged))); + + public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(CustomPasswordBox), new PropertyMetadata((object)string.Empty, new PropertyChangedCallback(OnBoundPasswordChanged))); + + public static readonly DependencyProperty PasswordViewProperty = DependencyProperty.Register("PasswordViewProperty", typeof(bool), typeof(CustomPasswordBox), new PropertyMetadata((object)false, new PropertyChangedCallback(OnBoundPasswordViewChanged))); + + private bool _typing; + + internal Grid LayoutRoot; + + internal TextBox TextRead; + + internal TextBox TextMask; + + internal PasswordBox PasswordBox; + + private bool _contentLoaded; + + public bool IsReadOnly + { + get + { + return (bool)((DependencyObject)this).GetValue(IsReadOnlyProperty); + } + set + { + ((DependencyObject)this).SetValue(IsReadOnlyProperty, (object)value); + } + } + + public string Text + { + get + { + return (string)((DependencyObject)this).GetValue(TextProperty); + } + set + { + ((DependencyObject)this).SetValue(TextProperty, (object)value); + } + } + + public bool PasswordView + { + get + { + return (bool)((DependencyObject)this).GetValue(PasswordViewProperty); + } + set + { + ((DependencyObject)this).SetValue(PasswordViewProperty, (object)value); + } + } + + private static void OnBoundIsReadOnlyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + CustomPasswordBox customPasswordBox = d as CustomPasswordBox; + if (d != null && customPasswordBox != null) + { + bool flag = (bool)((DependencyPropertyChangedEventArgs)(ref e)).NewValue; + ((UIElement)customPasswordBox.PasswordBox).Visibility = (Visibility)(flag ? 2 : 0); + ((UIElement)customPasswordBox.TextRead).Visibility = (Visibility)((!flag) ? 2 : 0); + ((UIElement)customPasswordBox.TextMask).Visibility = (Visibility)((!flag) ? 2 : 0); + } + } + + private static void OnBoundPasswordChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + CustomPasswordBox customPasswordBox = d as CustomPasswordBox; + if (d != null && customPasswordBox != null) + { + string text = ((string)((DependencyPropertyChangedEventArgs)(ref e)).NewValue) ?? ""; + if (!customPasswordBox._typing) + { + customPasswordBox.TextMask.Text = "".PadLeft(text.Length, '•'); + customPasswordBox.PasswordBox.Password = text; + } + } + } + + private static void OnBoundPasswordViewChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + //IL_007c: Unknown result type (might be due to invalid IL or missing references) + CustomPasswordBox customPasswordBox = d as CustomPasswordBox; + if (d != null && customPasswordBox != null) + { + bool flag = (bool)((DependencyPropertyChangedEventArgs)(ref e)).NewValue; + if (flag) + { + customPasswordBox.TextRead.Text = customPasswordBox.PasswordBox.Password; + } + else + { + customPasswordBox.PasswordBox.Password = customPasswordBox.TextRead.Text; + } + ((UIElement)customPasswordBox.PasswordBox).Visibility = (Visibility)(flag ? 2 : 0); + ((UIElement)customPasswordBox.TextRead).Visibility = (Visibility)((!flag) ? 2 : 0); + ((UIElement)customPasswordBox.TextMask).Visibility = ((UIElement)customPasswordBox.PasswordBox).Visibility; + } + } + + public CustomPasswordBox() + { + InitializeComponent(); + ((FrameworkElement)LayoutRoot).DataContext = this; + PasswordView = false; + } + + private void PasswordBox_PasswordChanged(object sender, RoutedEventArgs e) + { + _typing = true; + Text = PasswordBox.Password; + _typing = false; + TextMask.Text = "".PadLeft(PasswordBox.Password.Length, '•'); + } + + private void Eye_Click(object sender, RoutedEventArgs e) + { + if (!IsReadOnly) + { + PasswordView = !PasswordView; + } + } + + private void TextRead_PasswordChanged(object sender, TextChangedEventArgs e) + { + Text = TextRead.Text; + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/custompasswordbox.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0020: Unknown result type (might be due to invalid IL or missing references) + //IL_002a: Expected O, but got Unknown + //IL_002d: Unknown result type (might be due to invalid IL or missing references) + //IL_0037: Expected O, but got Unknown + //IL_0044: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Expected O, but got Unknown + //IL_0051: Unknown result type (might be due to invalid IL or missing references) + //IL_005b: Expected O, but got Unknown + //IL_005e: Unknown result type (might be due to invalid IL or missing references) + //IL_0068: Expected O, but got Unknown + //IL_0075: Unknown result type (might be due to invalid IL or missing references) + //IL_007f: Expected O, but got Unknown + //IL_0081: Unknown result type (might be due to invalid IL or missing references) + //IL_008d: Unknown result type (might be due to invalid IL or missing references) + //IL_0097: Expected O, but got Unknown + switch (connectionId) + { + case 1: + LayoutRoot = (Grid)target; + break; + case 2: + TextRead = (TextBox)target; + ((TextBoxBase)TextRead).TextChanged += new TextChangedEventHandler(TextRead_PasswordChanged); + break; + case 3: + TextMask = (TextBox)target; + break; + case 4: + PasswordBox = (PasswordBox)target; + PasswordBox.PasswordChanged += new RoutedEventHandler(PasswordBox_PasswordChanged); + break; + case 5: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Eye_Click); + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/CustomSenhaLoginBox.cs b/Decompiler/Gestor.Application.Componentes/CustomSenhaLoginBox.cs new file mode 100644 index 0000000..90b1761 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/CustomSenhaLoginBox.cs @@ -0,0 +1,343 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Markup; +using System.Windows.Media; +using ControlzEx; +using MaterialDesignThemes.Wpf; + +namespace Gestor.Application.Componentes; + +public class CustomSenhaLoginBox : UserControl, IComponentConnector +{ + public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(CustomSenhaLoginBox), new PropertyMetadata((object)string.Empty, new PropertyChangedCallback(OnBoundPasswordChanged))); + + public static readonly DependencyProperty IsReadOnlyProperty = DependencyProperty.Register("IsReadOnly", typeof(bool), typeof(CustomSenhaLoginBox), new PropertyMetadata((object)false, new PropertyChangedCallback(OnBoundIsReadOnlyChanged))); + + public static readonly DependencyProperty PlaceHolderProperty = DependencyProperty.Register("PlaceHolder", typeof(string), typeof(CustomSenhaLoginBox), (PropertyMetadata)new FrameworkPropertyMetadata((object)"SENHA", (FrameworkPropertyMetadataOptions)256)); + + public static readonly DependencyProperty BackgroundProperty = DependencyProperty.Register("Background", typeof(Brush), typeof(CustomSenhaLoginBox), new PropertyMetadata((object)null, new PropertyChangedCallback(OnBackgroundChanged))); + + public static readonly DependencyProperty ForegroundProperty = DependencyProperty.Register("Foreground", typeof(Brush), typeof(CustomSenhaLoginBox), new PropertyMetadata((object)null, new PropertyChangedCallback(OnForegroundChanged))); + + public static readonly DependencyProperty CaretBrushProperty = DependencyProperty.Register("CaretBrush", typeof(Brush), typeof(CustomSenhaLoginBox), new PropertyMetadata((object)null, new PropertyChangedCallback(OnCaretBrushChanged))); + + public static readonly DependencyProperty FontFamilyProperty = DependencyProperty.Register("FontFamily", typeof(FontFamily), typeof(CustomSenhaLoginBox), new PropertyMetadata((object)null, new PropertyChangedCallback(OnFontFamilyChanged))); + + public static readonly DependencyProperty FontSizeProperty = DependencyProperty.Register("FontSize", typeof(int), typeof(CustomSenhaLoginBox), new PropertyMetadata((object)10, new PropertyChangedCallback(OnFontSizeChanged))); + + public static readonly DependencyProperty BorderThicknessProperty = DependencyProperty.Register("BorderThickness", typeof(Thickness), typeof(CustomSenhaLoginBox), new PropertyMetadata((object)new Thickness(1.0), new PropertyChangedCallback(OnBorderThicknessChanged))); + + internal Grid LayoutRoot; + + internal TextBox TextRead; + + internal PasswordBox PasswordBox; + + internal Button ButtonEye; + + private bool _contentLoaded; + + private static bool _typing { get; set; } + + public string Text + { + get + { + return (string)((DependencyObject)this).GetValue(TextProperty); + } + set + { + ((DependencyObject)this).SetValue(TextProperty, (object)value); + } + } + + public bool IsReadOnly + { + get + { + return (bool)((DependencyObject)this).GetValue(IsReadOnlyProperty); + } + set + { + ((DependencyObject)this).SetValue(IsReadOnlyProperty, (object)value); + } + } + + public string PlaceHolder + { + get + { + return (string)((DependencyObject)this).GetValue(PlaceHolderProperty); + } + set + { + ((DependencyObject)this).SetValue(PlaceHolderProperty, (object)value); + } + } + + public Brush Background + { + get + { + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Expected O, but got Unknown + return (Brush)((DependencyObject)this).GetValue(BackgroundProperty); + } + set + { + ((DependencyObject)this).SetValue(BackgroundProperty, (object)value); + } + } + + public Brush Foreground + { + get + { + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Expected O, but got Unknown + return (Brush)((DependencyObject)this).GetValue(ForegroundProperty); + } + set + { + ((DependencyObject)this).SetValue(ForegroundProperty, (object)value); + } + } + + public Brush CaretBrush + { + get + { + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Expected O, but got Unknown + return (Brush)((DependencyObject)this).GetValue(CaretBrushProperty); + } + set + { + ((DependencyObject)this).SetValue(CaretBrushProperty, (object)value); + } + } + + public FontFamily FontFamily + { + get + { + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Expected O, but got Unknown + return (FontFamily)((DependencyObject)this).GetValue(FontFamilyProperty); + } + set + { + ((DependencyObject)this).SetValue(FontFamilyProperty, (object)value); + } + } + + public int FontSize + { + get + { + return (int)((DependencyObject)this).GetValue(FontSizeProperty); + } + set + { + ((DependencyObject)this).SetValue(FontSizeProperty, (object)value); + } + } + + public Thickness BorderThickness + { + get + { + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + return (Thickness)((DependencyObject)this).GetValue(BorderThicknessProperty); + } + set + { + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + ((DependencyObject)this).SetValue(BorderThicknessProperty, (object)value); + } + } + + private static void OnCaretBrushChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Expected O, but got Unknown + CustomSenhaLoginBox customSenhaLoginBox = d as CustomSenhaLoginBox; + if (d != null && customSenhaLoginBox != null) + { + customSenhaLoginBox.CaretBrush = (Brush)((DependencyPropertyChangedEventArgs)(ref e)).NewValue; + } + } + + private static void OnBorderThicknessChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + CustomSenhaLoginBox customSenhaLoginBox = d as CustomSenhaLoginBox; + if (d != null && customSenhaLoginBox != null) + { + customSenhaLoginBox.BorderThickness = (Thickness)((DependencyPropertyChangedEventArgs)(ref e)).NewValue; + } + } + + private static void OnFontSizeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + CustomSenhaLoginBox customSenhaLoginBox = d as CustomSenhaLoginBox; + if (d != null && customSenhaLoginBox != null) + { + customSenhaLoginBox.FontSize = (int)((DependencyPropertyChangedEventArgs)(ref e)).NewValue; + } + } + + private static void OnFontFamilyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Expected O, but got Unknown + CustomSenhaLoginBox customSenhaLoginBox = d as CustomSenhaLoginBox; + if (d != null && customSenhaLoginBox != null) + { + customSenhaLoginBox.FontFamily = (FontFamily)((DependencyPropertyChangedEventArgs)(ref e)).NewValue; + } + } + + private static void OnForegroundChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Expected O, but got Unknown + CustomSenhaLoginBox customSenhaLoginBox = d as CustomSenhaLoginBox; + if (d != null && customSenhaLoginBox != null) + { + customSenhaLoginBox.Foreground = (Brush)((DependencyPropertyChangedEventArgs)(ref e)).NewValue; + } + } + + private static void OnBackgroundChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Expected O, but got Unknown + CustomSenhaLoginBox customSenhaLoginBox = d as CustomSenhaLoginBox; + if (d != null && customSenhaLoginBox != null) + { + customSenhaLoginBox.Background = (Brush)((DependencyPropertyChangedEventArgs)(ref e)).NewValue; + } + } + + private static void OnBoundPasswordChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + CustomSenhaLoginBox customSenhaLoginBox = d as CustomSenhaLoginBox; + if (d != null && customSenhaLoginBox != null) + { + string password = ((string)((DependencyPropertyChangedEventArgs)(ref e)).NewValue) ?? ""; + if (!_typing) + { + customSenhaLoginBox.PasswordBox.Password = password; + } + } + } + + private static void OnBoundIsReadOnlyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + CustomPasswordBox customPasswordBox = d as CustomPasswordBox; + if (d != null && customPasswordBox != null) + { + bool flag = (bool)((DependencyPropertyChangedEventArgs)(ref e)).NewValue; + ((UIElement)customPasswordBox.PasswordBox).Visibility = (Visibility)(flag ? 2 : 0); + ((UIElement)customPasswordBox.TextRead).Visibility = (Visibility)((!flag) ? 2 : 0); + } + } + + public CustomSenhaLoginBox() + { + InitializeComponent(); + ((FrameworkElement)LayoutRoot).DataContext = this; + } + + private void PasswordBox_PasswordChanged(object sender, RoutedEventArgs e) + { + _typing = true; + Text = PasswordBox.Password; + _typing = false; + } + + private void Eye_Click(object sender, RoutedEventArgs e) + { + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Invalid comparison between Unknown and I4 + //IL_0039: Unknown result type (might be due to invalid IL or missing references) + //IL_003f: Invalid comparison between Unknown and I4 + //IL_0085: Unknown result type (might be due to invalid IL or missing references) + //IL_005b: Unknown result type (might be due to invalid IL or missing references) + //IL_0066: Unknown result type (might be due to invalid IL or missing references) + //IL_006c: Invalid comparison between Unknown and I4 + //IL_007f: Expected O, but got Unknown + if (!IsReadOnly) + { + Button val = (Button)((sender is Button) ? sender : null); + ((UIElement)TextRead).Visibility = (Visibility)(((int)((UIElement)TextRead).Visibility != 2) ? 2 : 0); + ((UIElement)PasswordBox).Visibility = (Visibility)(((int)((UIElement)TextRead).Visibility != 2) ? 2 : 0); + if (val != null && ((ContentControl)val).Content != null) + { + ((PackIconBase)(PackIcon)((ContentControl)val).Content).Kind = (PackIconKind)(((int)((UIElement)TextRead).Visibility == 2) ? 1492 : 1497); + } + if ((int)((UIElement)PasswordBox).Visibility == 0) + { + ((UIElement)PasswordBox).Focus(); + PasswordBox.SelectAll(); + } + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/customsenhaloginbox.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0026: Expected O, but got Unknown + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_0033: Expected O, but got Unknown + //IL_0036: Unknown result type (might be due to invalid IL or missing references) + //IL_0040: Expected O, but got Unknown + //IL_004d: Unknown result type (might be due to invalid IL or missing references) + //IL_0057: Expected O, but got Unknown + //IL_005a: Unknown result type (might be due to invalid IL or missing references) + //IL_0064: Expected O, but got Unknown + //IL_0071: Unknown result type (might be due to invalid IL or missing references) + //IL_007b: Expected O, but got Unknown + switch (connectionId) + { + case 1: + LayoutRoot = (Grid)target; + break; + case 2: + TextRead = (TextBox)target; + break; + case 3: + PasswordBox = (PasswordBox)target; + PasswordBox.PasswordChanged += new RoutedEventHandler(PasswordBox_PasswordChanged); + break; + case 4: + ButtonEye = (Button)target; + ((ButtonBase)ButtonEye).Click += new RoutedEventHandler(Eye_Click); + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/CustomSeriesViewModel.cs b/Decompiler/Gestor.Application.Componentes/CustomSeriesViewModel.cs new file mode 100644 index 0000000..30af3ef --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/CustomSeriesViewModel.cs @@ -0,0 +1,55 @@ +using System.ComponentModel; +using System.Runtime.CompilerServices; +using System.Windows; +using System.Windows.Media; +using LiveCharts.Definitions.Series; +using LiveCharts.Wpf; + +namespace Gestor.Application.Componentes; + +public class CustomSeriesViewModel : INotifyPropertyChanged +{ + public string Title => SeriesViewModel.Title; + + public Brush Fill => SeriesViewModel.Fill ?? SeriesViewModel.Stroke; + + public SeriesViewModel SeriesViewModel { get; } + + public ISeriesView View { get; } + + public bool IsVisible + { + get + { + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Invalid comparison between Unknown and I4 + return (int)((UIElement)View).Visibility == 0; + } + set + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + if (IsVisible != value) + { + ((UIElement)View).Visibility = (Visibility)(!value); + OnPropertyChanged("IsVisible"); + } + } + } + + public event PropertyChangedEventHandler PropertyChanged; + + public CustomSeriesViewModel(SeriesViewModel svm, ISeriesView view) + { + SeriesViewModel = svm; + View = view; + } + + protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = "") + { + if (this.PropertyChanged != null) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DefaultDialog.cs b/Decompiler/Gestor.Application.Componentes/DefaultDialog.cs new file mode 100644 index 0000000..f02d882 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DefaultDialog.cs @@ -0,0 +1,39 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Markup; +using Gestor.Application.Views.Generic; + +namespace Gestor.Application.Componentes; + +public class DefaultDialog : BaseUserControl, IComponentConnector +{ + private bool _contentLoaded; + + public DefaultDialog() + { + InitializeComponent(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/defaultdialog.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + _contentLoaded = true; + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogAdvertising.cs b/Decompiler/Gestor.Application.Componentes/DialogAdvertising.cs new file mode 100644 index 0000000..4c2f5f8 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogAdvertising.cs @@ -0,0 +1,106 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using System.Windows.Markup; +using Gestor.Application.ViewModels.Generic; +using MaterialDesignThemes.Wpf; +using Newtonsoft.Json.Linq; + +namespace Gestor.Application.Componentes; + +public class DialogAdvertising : UserControl, IComponentConnector +{ + private DialogAdvertisingViewModel ViewModel; + + private readonly bool _isPromocao; + + internal Label Titulo; + + private bool _contentLoaded; + + public DialogAdvertising(JObject jsonAd, bool isPromo = true) + { + ViewModel = new DialogAdvertisingViewModel(jsonAd, isPromo); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + private void LinkImage_MouseDown(object sender, MouseButtonEventArgs e) + { + try + { + if (!_isPromocao) + { + ViewModel.EnviarPesquisa(); + } + Process.Start(ViewModel.Url); + } + catch + { + } + } + + private void Lido_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.SalvaEditarArquivoConfig(visto: true); + DialogHost.CloseDialogCommand.Execute((object)null, (IInputElement)null); + } + + private void CloseOnClick(object sender, RoutedEventArgs e) + { + DialogHost.CloseDialogCommand.Execute((object)null, (IInputElement)null); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialogadvertising.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0026: Expected O, but got Unknown + //IL_0028: Unknown result type (might be due to invalid IL or missing references) + //IL_0034: Unknown result type (might be due to invalid IL or missing references) + //IL_003e: Expected O, but got Unknown + //IL_0040: Unknown result type (might be due to invalid IL or missing references) + //IL_004c: Unknown result type (might be due to invalid IL or missing references) + //IL_0056: Expected O, but got Unknown + //IL_0058: Unknown result type (might be due to invalid IL or missing references) + //IL_0064: Unknown result type (might be due to invalid IL or missing references) + //IL_006e: Expected O, but got Unknown + switch (connectionId) + { + case 1: + Titulo = (Label)target; + break; + case 2: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(CloseOnClick); + break; + case 3: + ((UIElement)(Image)target).MouseDown += new MouseButtonEventHandler(LinkImage_MouseDown); + break; + case 4: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Lido_OnClick); + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogAnaliticoBi.cs b/Decompiler/Gestor.Application.Componentes/DialogAnaliticoBi.cs new file mode 100644 index 0000000..6c50ba7 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogAnaliticoBi.cs @@ -0,0 +1,469 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Reflection; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Data; +using System.Windows.Input; +using System.Windows.Markup; +using Gestor.Application.Helpers; +using Gestor.Application.ViewModels; +using Gestor.Application.Views.Ferramentas; +using Gestor.Application.Views.Generic; +using Gestor.Application.Views.Seguros; +using Gestor.Model.Attributes; +using Gestor.Model.Common; +using Gestor.Model.Domain.BI; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.MalaDireta; +using Gestor.Model.Domain.Seguros; +using MaterialDesignThemes.Wpf; + +namespace Gestor.Application.Componentes; + +public class DialogAnaliticoBi : BaseUserControl, IComponentConnector, IStyleConnector +{ + internal AnaliticoViewModel ViewModel; + + internal Grid MainGrid; + + internal DataGrid Grid; + + internal DataGridTemplateColumn InfoButton; + + internal TextBlock Totalizacao; + + private bool _contentLoaded; + + public List Lista { get; set; } + + public List Campos { get; set; } + + public DialogAnaliticoBi(string titulo, List analitico, string tipo, List campos) + { + ViewModel = new AnaliticoViewModel(tipo); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + ViewModel.Head = titulo; + Lista = analitico; + Campos = campos; + ConstruirLista(); + } + + private void ConstruirLista() + { + ViewModel.Loading(isLoading: true); + PropertyInfo[] properties = ((object)Lista.First()).GetType().GetProperties(); + Campos.ForEach(delegate(string x) + { + //IL_00ad: Unknown result type (might be due to invalid IL or missing references) + //IL_00b4: Expected O, but got Unknown + //IL_00c8: Unknown result type (might be due to invalid IL or missing references) + //IL_00cf: Expected O, but got Unknown + //IL_0086: Unknown result type (might be due to invalid IL or missing references) + //IL_014c: Unknown result type (might be due to invalid IL or missing references) + //IL_0153: Expected O, but got Unknown + //IL_0167: Unknown result type (might be due to invalid IL or missing references) + //IL_016e: Expected O, but got Unknown + //IL_0237: Unknown result type (might be due to invalid IL or missing references) + //IL_023c: Unknown result type (might be due to invalid IL or missing references) + //IL_0243: Unknown result type (might be due to invalid IL or missing references) + //IL_024a: Unknown result type (might be due to invalid IL or missing references) + //IL_024b: Unknown result type (might be due to invalid IL or missing references) + //IL_0250: Unknown result type (might be due to invalid IL or missing references) + //IL_025c: Unknown result type (might be due to invalid IL or missing references) + //IL_0266: Expected O, but got Unknown + //IL_0266: Unknown result type (might be due to invalid IL or missing references) + //IL_026e: Unknown result type (might be due to invalid IL or missing references) + //IL_027a: Expected O, but got Unknown + //IL_027a: Unknown result type (might be due to invalid IL or missing references) + //IL_0282: Unknown result type (might be due to invalid IL or missing references) + //IL_028f: Expected O, but got Unknown + //IL_018e: Unknown result type (might be due to invalid IL or missing references) + //IL_0195: Expected O, but got Unknown + //IL_01a9: Unknown result type (might be due to invalid IL or missing references) + //IL_01b0: Expected O, but got Unknown + //IL_01cd: Unknown result type (might be due to invalid IL or missing references) + //IL_01d4: Expected O, but got Unknown + //IL_01e8: Unknown result type (might be due to invalid IL or missing references) + //IL_01ef: Expected O, but got Unknown + //IL_0205: Unknown result type (might be due to invalid IL or missing references) + //IL_020c: Expected O, but got Unknown + //IL_0220: Unknown result type (might be due to invalid IL or missing references) + //IL_0227: Expected O, but got Unknown + PropertyInfo propertyInfo = properties.FirstOrDefault((PropertyInfo p) => p.Name == x); + if (!(propertyInfo == null)) + { + object obj = propertyInfo.GetCustomAttributes(typeof(DescriptionAttribute), inherit: true).FirstOrDefault(); + string header = propertyInfo.Name.ToUpper(); + if (obj != null) + { + header = ((DescriptionAttribute)obj).Description; + } + object obj2 = propertyInfo.GetCustomAttributes(typeof(TipoAttribute), inherit: true).FirstOrDefault(); + string text = ""; + if (obj2 != null) + { + text = ((TipoAttribute)obj2).Description; + } + string stringFormat = ""; + Style elementStyle = (Style)Application.Current.Resources[(object)"VerticalCenterStyle3"]; + Style headerStyle = (Style)Application.Current.Resources[(object)"MaterialDesignDataGridColumnHeader"]; + switch (text) + { + case "DATA": + case "DATA?": + stringFormat = "d"; + elementStyle = (Style)Application.Current.Resources[(object)"HorizontalCenterStyle2"]; + headerStyle = (Style)Application.Current.Resources[(object)"HorizontalCenterHeaderStyle"]; + break; + case "PERCENTUAL": + stringFormat = "{0:0.00}%"; + elementStyle = (Style)Application.Current.Resources[(object)"HorizontalRightStyle"]; + headerStyle = (Style)Application.Current.Resources[(object)"HorizontalRightHeaderStyle"]; + break; + case "VALOR": + case "VALOR?": + stringFormat = "c"; + elementStyle = (Style)Application.Current.Resources[(object)"HorizontalRightStyle"]; + headerStyle = (Style)Application.Current.Resources[(object)"HorizontalRightHeaderStyle"]; + break; + case "QUANTIDADE": + elementStyle = (Style)Application.Current.Resources[(object)"HorizontalCenterStyle2"]; + headerStyle = (Style)Application.Current.Resources[(object)"HorizontalCenterHeaderStyle"]; + break; + } + Grid.Columns.Add((DataGridColumn)new MaterialDataGridTextColumn + { + IsReadOnly = true, + Header = header, + Binding = (BindingBase)new Binding + { + Path = new PropertyPath(propertyInfo.Name, Array.Empty()), + StringFormat = stringFormat, + UpdateSourceTrigger = (UpdateSourceTrigger)1 + }, + ElementStyle = elementStyle, + HeaderStyle = headerStyle + }); + } + }); + ((ItemsControl)Grid).ItemsSource = Lista; + Totalizar(); + ViewModel.Loading(isLoading: false); + } + + private void Totalizar() + { + switch (ViewModel.Tipo) + { + case "CLIENTES": + Totalizacao.Text = $"TOTAL DE {Lista.Count} CLIENTES"; + break; + default: + Totalizacao.Text = $"TOTAL DE {Lista.Count} SEGUROS SOMANDO O VALOR DE {Lista.Sum((Analitico x) => x.PremioLiquido):c}"; + break; + case "PARCELAS": + Totalizacao.Text = $"TOTAL DE {Lista.Count} SEGUROS SOMANDO O VALOR DE {Lista.Sum((Analitico x) => x.Valor):c}"; + break; + case "COMISSÃO": + Totalizacao.Text = $"TOTAL DE {Lista.Count} SEGUROS SOMANDO O VALOR DE COMISSÃO RECEBIDA DE {Lista.Sum((Analitico x) => x.ValorComissao):c}"; + break; + } + } + + private void CheckBox_Checked(object sender, RoutedEventArgs e) + { + Lista.ForEach(delegate(Analitico x) + { + x.Selecionado = !x.Selecionado; + }); + ((ItemsControl)Grid).ItemsSource = null; + ((ItemsControl)Grid).ItemsSource = Lista; + } + + private async void Tarefas_OnClick(object sender, RoutedEventArgs e) + { + Tarefa data = new Tarefa + { + Entidade = (TipoTarefa)1, + Titulo = ViewModel.Head, + Usuario = Recursos.Usuario, + Agendamento = Funcoes.GetNetworkTime() + }; + await AbrirTarefa(data); + List second = Lista.Where((Analitico x) => x.Selecionado).ToList(); + Lista = Lista.Except(second).ToList(); + ((ItemsControl)Grid).ItemsSource = null; + ((ItemsControl)Grid).ItemsSource = Lista; + Totalizar(); + } + + private async Task AbrirTarefa(Tarefa data) + { + ViewModel.Loading(isLoading: true); + Tarefa tarefa; + while (true) + { + tarefa = await ViewModel.ShowTarefaDialog(data, nota: true); + List> list = new List>(); + if (tarefa == null) + { + ViewModel.Loading(isLoading: false); + return; + } + tarefa.AgendamentoRetroativo = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 45); + List> list2 = tarefa.Validate(); + if (list2 == null || list2.Count == 0) + { + break; + } + if (list2.Count > 0) + { + list.AddRange(list2); + } + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + if (tarefa.Usuario == null) + { + tarefa.Usuario = tarefa.UsuariosVinculados.FirstOrDefault(); + } + List responsaveis = ((IEnumerable)tarefa.UsuariosVinculados).Select((Func)((Usuario x) => new ResponsavelTarefa + { + IdTarefa = ((DomainBase)tarefa).Id, + Usuario = x + })).ToList(); + List source = Lista.Where((Analitico x) => x.Selecionado).ToList(); + List list3; + switch (ViewModel.Tipo) + { + case "CLIENTES": + list3 = ((IEnumerable)source).Select((Func)((Analitico x) => new Tarefa + { + Entidade = (TipoTarefa)2, + IdEntidade = x.Cliente.Id, + Agendamento = tarefa.Agendamento, + Titulo = tarefa.Titulo, + Descricao = tarefa.Anotacoes, + Usuario = tarefa.Usuario, + UsuarioCadastro = Recursos.Usuario, + Cliente = x.Nome, + IdCliente = x.Cliente.Id, + Responsaveis = responsaveis + })).ToList(); + break; + default: + list3 = ((IEnumerable)source).Select((Func)((Analitico x) => new Tarefa + { + Entidade = (TipoTarefa)0, + IdEntidade = ((DomainBase)x.Documento).Id, + Agendamento = tarefa.Agendamento, + Titulo = tarefa.Titulo, + Descricao = tarefa.Anotacoes, + Usuario = tarefa.Usuario, + UsuarioCadastro = Recursos.Usuario, + Cliente = x.Nome, + IdCliente = ((DomainBase)x.Documento.Controle.Cliente).Id, + Referencia = ((x.Documento.Tipo == 0 && !string.IsNullOrWhiteSpace(x.Documento.Apolice)) ? ("APÓLICE NÚMERO " + x.Documento.Apolice) : ((x.Documento.Tipo > 0) ? ("APÓLICE NÚMERO " + x.Documento.Apolice + " ENDOSSO " + x.Documento.Endosso) : ("PROPOSTA NÚMERO " + x.Documento.Proposta))), + Responsaveis = responsaveis + })).ToList(); + break; + case "PARCELAS": + case "COMISSÃO": + list3 = ((IEnumerable)source).Select((Func)((Analitico x) => new Tarefa + { + Entidade = (TipoTarefa)3, + IdEntidade = ((DomainBase)x.Parcela).Id, + Agendamento = tarefa.Agendamento, + Titulo = tarefa.Titulo, + Descricao = tarefa.Anotacoes, + Usuario = tarefa.Usuario, + UsuarioCadastro = Recursos.Usuario, + Cliente = x.Nome, + IdCliente = ((DomainBase)x.Parcela.Documento.Controle.Cliente).Id, + Referencia = ((x.Parcela.Documento.Tipo == 0 && !string.IsNullOrWhiteSpace(x.Parcela.Documento.Apolice)) ? $"PARCELA {x.NumeroParcela} DA APÓLICE {x.Parcela.Documento.Apolice}" : ((x.Documento.Tipo > 0) ? $"PARCELA {x.NumeroParcela} DA APÓLICE {x.Parcela.Documento.Apolice} ENDOSSO {x.Parcela.Documento.Endosso}" : $"PARCELA {x.NumeroParcela} DA PROPOSTA {x.Parcela.Documento.Proposta}")), + Responsaveis = responsaveis + })).ToList(); + break; + } + if (list3.Count == 0) + { + ViewModel.Loading(isLoading: false); + await ViewModel.ShowMessage("FALHA AO CRIAR TAREFA."); + return; + } + await ViewModel.Save(list3); + ViewModel.ToggleSnackBar("TAREFA SALVA COM SUCESSO."); + ViewModel.Alterar(alterar: false); + ViewModel.Loading(isLoading: false); + } + + private async void Email_OnClick(object sender, RoutedEventArgs e) + { + if (!Lista.Any((Analitico x) => x.Selecionado)) + { + await ViewModel.ShowMessage("NECESSÁRIO SELECIONAR AO MENOS UM CLIENTE PARA PROSSEGUIR"); + return; + } + if (Funcoes.IsWindowOpen("ENVIO DE E-MAIL")) + { + Funcoes.Destroy("ENVIO DE E-MAIL"); + } + ((Window)new HosterWindow((ContentControl)(object)new MalaDiretaView(Lista.Where((Analitico x) => x.Selecionado).Select((Func)((Analitico x) => new MalaDireta + { + Cliente = new Cliente + { + Id = x.Cliente.Id, + Nome = x.Cliente.Nome, + Nascimento = x.Cliente.Nascimento, + VencimentoHabilitacao = x.Cliente.VencimentoCnh + }, + Apolice = x.Documento, + Parcela = x.Parcela, + Tela = ViewModel.Tela + })).ToList()), "ENVIO DE E-MAIL", 1200.0, 600.0, canMaximize: true)).Show(); + } + + private async void Grid_OnMouseDoubleClick(object sender, MouseButtonEventArgs e) + { + if (((Selector)Grid).SelectedItem != null && (!(ViewModel.Tipo == "PARCELAS") || !(ViewModel.Tipo == "APOLICES"))) + { + if (ViewModel.Tipo == "CLIENTES") + { + Analitico val = (Analitico)((Selector)Grid).SelectedItem; + Cliente val2 = await ViewModel.CarregaCliente(val.Cliente.Id); + ((Window)new HosterWindow((ContentControl)(object)new ClienteView(val2, lockInsert: true), "CADASTRO DE CLIENTE - " + val2.Nome)).Show(); + } + else + { + Analitico val3 = (Analitico)((Selector)Grid).SelectedItem; + ((Window)new HosterWindow((ContentControl)(object)new ApoliceView(val3.Documento, lockInsert: true, invoke: false, (AcessoApolice)0, 0L), "CADASTRO DE APÓLICES - " + val3.Cliente.Nome)).Show(); + } + } + } + + private async void Print_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + await ViewModel.Print(Grid); + ViewModel.Loading(isLoading: false); + } + + private async void Open_OnClick(object sender, RoutedEventArgs e) + { + if (((Selector)Grid).SelectedItem != null && (!(ViewModel.Tipo == "PARCELAS") || !(ViewModel.Tipo == "APOLICES"))) + { + if (ViewModel.Tipo == "CLIENTES") + { + Analitico val = (Analitico)((Selector)Grid).SelectedItem; + Cliente val2 = await ViewModel.CarregaCliente(val.Cliente.Id); + ((Window)new HosterWindow((ContentControl)(object)new ClienteView(val2, lockInsert: true), "CADASTRO DE CLIENTE - " + val2.Nome)).Show(); + } + else + { + Analitico val3 = (Analitico)((Selector)Grid).SelectedItem; + ((Window)new HosterWindow((ContentControl)(object)new ApoliceView(val3.Documento, lockInsert: true, invoke: false, (AcessoApolice)0, 0L), "CADASTRO DE APÓLICES - " + val3.Cliente.Nome)).Show(); + } + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialoganaliticobi.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0033: Unknown result type (might be due to invalid IL or missing references) + //IL_003d: Expected O, but got Unknown + //IL_0040: Unknown result type (might be due to invalid IL or missing references) + //IL_004a: Expected O, but got Unknown + //IL_0057: Unknown result type (might be due to invalid IL or missing references) + //IL_0061: Expected O, but got Unknown + //IL_0064: Unknown result type (might be due to invalid IL or missing references) + //IL_006e: Expected O, but got Unknown + //IL_0071: Unknown result type (might be due to invalid IL or missing references) + //IL_007b: Expected O, but got Unknown + //IL_007d: Unknown result type (might be due to invalid IL or missing references) + //IL_0089: Unknown result type (might be due to invalid IL or missing references) + //IL_0093: Expected O, but got Unknown + //IL_0095: Unknown result type (might be due to invalid IL or missing references) + //IL_00a1: Unknown result type (might be due to invalid IL or missing references) + //IL_00ab: Expected O, but got Unknown + //IL_00ad: Unknown result type (might be due to invalid IL or missing references) + //IL_00b9: Unknown result type (might be due to invalid IL or missing references) + //IL_00c3: Expected O, but got Unknown + switch (connectionId) + { + case 1: + MainGrid = (Grid)target; + break; + case 2: + Grid = (DataGrid)target; + ((Control)Grid).MouseDoubleClick += new MouseButtonEventHandler(Grid_OnMouseDoubleClick); + break; + case 4: + InfoButton = (DataGridTemplateColumn)target; + break; + case 6: + Totalizacao = (TextBlock)target; + break; + case 7: + ((MenuItem)target).Click += new RoutedEventHandler(Tarefas_OnClick); + break; + case 8: + ((MenuItem)target).Click += new RoutedEventHandler(Email_OnClick); + break; + case 9: + ((MenuItem)target).Click += new RoutedEventHandler(Print_OnClick); + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_000a: Unknown result type (might be due to invalid IL or missing references) + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Expected O, but got Unknown + //IL_0021: Unknown result type (might be due to invalid IL or missing references) + //IL_002d: Unknown result type (might be due to invalid IL or missing references) + //IL_0037: Expected O, but got Unknown + //IL_0039: Unknown result type (might be due to invalid IL or missing references) + //IL_0045: Unknown result type (might be due to invalid IL or missing references) + //IL_004f: Expected O, but got Unknown + switch (connectionId) + { + case 3: + ((ToggleButton)(CheckBox)target).Checked += new RoutedEventHandler(CheckBox_Checked); + ((ToggleButton)(CheckBox)target).Unchecked += new RoutedEventHandler(CheckBox_Checked); + break; + case 5: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Open_OnClick); + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogAnexar.cs b/Decompiler/Gestor.Application.Componentes/DialogAnexar.cs new file mode 100644 index 0000000..09cadae --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogAnexar.cs @@ -0,0 +1,112 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Markup; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Domain.Common; +using MaterialDesignThemes.Wpf; + +namespace Gestor.Application.Componentes; + +public class DialogAnexar : UserControl, IComponentConnector, IStyleConnector +{ + private DialogAnexarViewModel ViewModel; + + internal Button SalvarButton; + + internal Button CancelarButton; + + private bool _contentLoaded; + + public DialogAnexar(List arquivos) + { + ViewModel = new DialogAnexarViewModel(arquivos); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + private void Excluir_OnClick(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Expected O, but got Unknown + Button val = (Button)sender; + if (val != null && ((FrameworkElement)val).DataContext != null) + { + ArquivoDigital removido = (ArquivoDigital)((FrameworkElement)val).DataContext; + ViewModel.Remover(removido); + } + } + + private void SalvarButton_OnClick(object sender, RoutedEventArgs e) + { + DialogHost.CloseDialogCommand.Execute((object)ViewModel.Arquivos.ToList(), (IInputElement)(object)SalvarButton); + } + + private void CancelarButton_OnClick(object sender, RoutedEventArgs e) + { + DialogHost.CloseDialogCommand.Execute((object)null, (IInputElement)(object)CancelarButton); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialoganexar.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_0016: Expected O, but got Unknown + //IL_0023: Unknown result type (might be due to invalid IL or missing references) + //IL_002d: Expected O, but got Unknown + //IL_0030: Unknown result type (might be due to invalid IL or missing references) + //IL_003a: Expected O, but got Unknown + //IL_0047: Unknown result type (might be due to invalid IL or missing references) + //IL_0051: Expected O, but got Unknown + switch (connectionId) + { + case 2: + SalvarButton = (Button)target; + ((ButtonBase)SalvarButton).Click += new RoutedEventHandler(SalvarButton_OnClick); + break; + case 3: + CancelarButton = (Button)target; + ((ButtonBase)CancelarButton).Click += new RoutedEventHandler(CancelarButton_OnClick); + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Expected O, but got Unknown + if (connectionId == 1) + { + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Excluir_OnClick); + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogCopia.cs b/Decompiler/Gestor.Application.Componentes/DialogCopia.cs new file mode 100644 index 0000000..d4ecb7b --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogCopia.cs @@ -0,0 +1,159 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Markup; +using System.Windows.Threading; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Domain.MalaDireta; +using MaterialDesignThemes.Wpf; + +namespace Gestor.Application.Componentes; + +public class DialogCopia : UserControl, IComponentConnector, IStyleConnector +{ + internal TextBox CopiaBox; + + internal Snackbar Snackbar; + + private bool _contentLoaded; + + public DialogCopiaViewModel ViewModel { get; set; } + + public DialogCopia(Copia copia) + { + ViewModel = new DialogCopiaViewModel(copia); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + private void AdicionarCopia(object sender, RoutedEventArgs e) + { + ViewModel.AdicionarCopia(); + ToggleSnackBar(ViewModel.Erro); + } + + private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e) + { + Snackbar.IsActive = false; + } + + public void ToggleSnackBar(string message, bool active = true) + { + ((ContentControl)Snackbar.Message).Content = message; + Snackbar.IsActive = active; + if (active) + { + Task.Factory.StartNew(CloseSlackBar); + } + } + + private void CloseSlackBar() + { + Thread.Sleep(3000); + Dispatcher dispatcher = ((DispatcherObject)App.ProgressRing).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)4, (Delegate)(Action)delegate + { + ToggleSnackBar("", active: false); + }); + } + } + + private void ExcluirComum_OnDeleteClick(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + Chip val = (Chip)sender; + ViewModel.ExcluirCopia("CÓPIA COMUM", (string)((FrameworkElement)val).DataContext); + } + + private void ExcluirOculta_OnDeleteClick(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + Chip val = (Chip)sender; + ViewModel.ExcluirCopia("CÓPIA OCULTA", (string)((FrameworkElement)val).DataContext); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialogcopia.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0028: Unknown result type (might be due to invalid IL or missing references) + //IL_0032: Expected O, but got Unknown + //IL_0034: Unknown result type (might be due to invalid IL or missing references) + //IL_0040: Unknown result type (might be due to invalid IL or missing references) + //IL_004a: Expected O, but got Unknown + //IL_004c: Unknown result type (might be due to invalid IL or missing references) + //IL_0058: Unknown result type (might be due to invalid IL or missing references) + //IL_0062: Expected O, but got Unknown + //IL_0065: Unknown result type (might be due to invalid IL or missing references) + //IL_006f: Expected O, but got Unknown + //IL_0071: Unknown result type (might be due to invalid IL or missing references) + //IL_007d: Unknown result type (might be due to invalid IL or missing references) + //IL_0087: Expected O, but got Unknown + switch (connectionId) + { + case 1: + CopiaBox = (TextBox)target; + break; + case 2: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AdicionarCopia); + break; + case 5: + ((MenuItem)target).Click += new RoutedEventHandler(AdicionarCopia); + break; + case 6: + Snackbar = (Snackbar)target; + break; + case 7: + ((SnackbarMessage)target).ActionClick += new RoutedEventHandler(SnackbarMessage_ActionClick); + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_000a: Unknown result type (might be due to invalid IL or missing references) + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Expected O, but got Unknown + //IL_0022: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_0038: Expected O, but got Unknown + switch (connectionId) + { + case 3: + ((Chip)target).DeleteClick += new RoutedEventHandler(ExcluirComum_OnDeleteClick); + break; + case 4: + ((Chip)target).DeleteClick += new RoutedEventHandler(ExcluirOculta_OnDeleteClick); + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogCopiarCliente.cs b/Decompiler/Gestor.Application.Componentes/DialogCopiarCliente.cs new file mode 100644 index 0000000..beba697 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogCopiarCliente.cs @@ -0,0 +1,97 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; +using Gestor.Application.ViewModels.Financeiro; +using Gestor.Model.Common; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Componentes; + +public class DialogCopiarCliente : UserControl, IComponentConnector +{ + internal CopiarClienteViewModel ViewModel; + + internal AutoCompleteBox PesquisaCliente; + + internal Loading LoadingAutoComplete; + + private bool _contentLoaded; + + public DialogCopiarCliente() + { + InitializeComponent(); + ViewModel = new CopiarClienteViewModel(); + ((FrameworkElement)this).DataContext = ViewModel; + } + + private void AutoCompleteBox_Populating(object sender, PopulatingEventArgs e) + { + if (e.Parameter.Trim().Length < 3) + { + return; + } + e.Cancel = true; + ((UIElement)LoadingAutoComplete).Visibility = (Visibility)0; + ViewModel.BuscarCliente(e.Parameter.Trim(), null, (TipoFiltroCliente)2).ContinueWith(delegate(Task> searchResult) + { + //IL_0020: Unknown result type (might be due to invalid IL or missing references) + //IL_0025: Unknown result type (might be due to invalid IL or missing references) + ((UIElement)LoadingAutoComplete).Visibility = (Visibility)2; + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialogcopiarcliente.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_0016: Expected O, but got Unknown + //IL_0023: Unknown result type (might be due to invalid IL or missing references) + //IL_002d: Expected O, but got Unknown + switch (connectionId) + { + case 1: + PesquisaCliente = (AutoCompleteBox)target; + PesquisaCliente.Populating += new PopulatingEventHandler(AutoCompleteBox_Populating); + break; + case 2: + LoadingAutoComplete = (Loading)target; + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogCopiarPermissao.cs b/Decompiler/Gestor.Application.Componentes/DialogCopiarPermissao.cs new file mode 100644 index 0000000..67c1e86 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogCopiarPermissao.cs @@ -0,0 +1,78 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Componentes; + +public class DialogCopiarPermissao : UserControl, IComponentConnector +{ + public DialogCopiarPermissaoViewModel ViewModel; + + private bool _contentLoaded; + + public DialogCopiarPermissao(DialogCopiarPermissaoViewModel viewModel) + { + ViewModel = viewModel; + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + private void AutoCompleteBox_Populating(object sender, PopulatingEventArgs e) + { + if (e.Parameter.Length < 3) + { + return; + } + e.Cancel = true; + ViewModel.BuscarUsuario(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialogcopiarpermissao.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Expected O, but got Unknown + if (connectionId == 1) + { + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBox_Populating); + } + else + { + _contentLoaded = true; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogDetalheExtrato.cs b/Decompiler/Gestor.Application.Componentes/DialogDetalheExtrato.cs new file mode 100644 index 0000000..7e19050 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogDetalheExtrato.cs @@ -0,0 +1,90 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Markup; +using Gestor.Application.Servicos; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.ViewModels.Comissao; +using Gestor.Application.Views.Generic; +using Gestor.Application.Views.Seguros; +using Gestor.Model.Common; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Componentes; + +public class DialogDetalheExtrato : UserControl, IComponentConnector, IStyleConnector +{ + internal DataGrid DetalhesGrid; + + private bool _contentLoaded; + + public ComissaoViewModel ViewModel { get; set; } + + public DialogDetalheExtrato(List detalhes) + { + InitializeComponent(); + ((ItemsControl)DetalhesGrid).ItemsSource = detalhes; + } + + private async void AcessarApolice_OnClick(object sender, RoutedEventArgs e) + { + DetalheExtrato val = (DetalheExtrato)((FrameworkElement)(Button)sender).DataContext; + if (((val != null && val.Documento.HasValue) || (val != null && val.Parcela.HasValue)) && val.Parcela.HasValue) + { + Documento val2 = ((!val.Documento.HasValue) ? (await new ParcelaServico().BuscarApolice(val.Parcela.Value)) : (await new ApoliceServico().BuscarApoliceAsync(val.Documento.Value))); + Documento val3 = val2; + if (val3 != null) + { + ((Window)new HosterWindow((ContentControl)(object)new ApoliceView(val3, lockInsert: true, invoke: false, (AcessoApolice)0, 0L), "CADASTRO DE APÓLICE - " + val3.Controle.Cliente.Nome + " - " + val3.Apolice)).Show(); + } + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialogdetalheextrato.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_0010: Expected O, but got Unknown + if (connectionId == 1) + { + DetalhesGrid = (DataGrid)target; + } + else + { + _contentLoaded = true; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Expected O, but got Unknown + if (connectionId == 2) + { + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AcessarApolice_OnClick); + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogEditarParcelas.cs b/Decompiler/Gestor.Application.Componentes/DialogEditarParcelas.cs new file mode 100644 index 0000000..c0bbe85 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogEditarParcelas.cs @@ -0,0 +1,174 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Markup; +using Gestor.Application.Actions; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Domain.Seguros; +using MaterialDesignThemes.Wpf; + +namespace Gestor.Application.Componentes; + +public class DialogEditarParcelas : UserControl, IComponentConnector +{ + internal Snackbar Snackbar; + + internal DataGrid ParcelaGrid; + + internal DataGridTextColumn ParcelaColumn; + + internal Label LabelStatus; + + internal Button SalvarButton; + + internal Button FecharButton; + + private bool _contentLoaded; + + public DialogEditarParcelasViewModel ViewModel { get; set; } + + public DialogEditarParcelas(Documento documento) + { + ViewModel = new DialogEditarParcelasViewModel(documento); + ((FrameworkElement)this).DataContext = ViewModel; + Gestor.Application.Actions.Actions.AcionarSnackbar = (Action)Delegate.Remove(Gestor.Application.Actions.Actions.AcionarSnackbar, new Action(AcionarSnackBar)); + Gestor.Application.Actions.Actions.AcionarSnackbar = (Action)Delegate.Combine(Gestor.Application.Actions.Actions.AcionarSnackbar, new Action(AcionarSnackBar)); + InitializeComponent(); + } + + private void AcionarSnackBar(string message) + { + Snackbar.IsActive = true; + ((ContentControl)Snackbar.Message).Content = message; + } + + private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e) + { + Snackbar.IsActive = false; + } + + private async void SalvarButton_OnClick(object sender, RoutedEventArgs e) + { + if (await ViewModel.SalvarParcelas()) + { + DialogHost.CloseDialogCommand.Execute((object)null, (IInputElement)(object)SalvarButton); + } + } + + private void FecharButton_OnClick(object sender, RoutedEventArgs e) + { + DialogHost.CloseDialogCommand.Execute((object)null, (IInputElement)(object)SalvarButton); + } + + private void ParcelaGrid_OnCellEditEnding(object sender, DataGridCellEditEndingEventArgs e) + { + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Expected O, but got Unknown + //IL_00f5: Unknown result type (might be due to invalid IL or missing references) + //IL_00ff: Expected O, but got Unknown + if (!(e.EditingElement is TextBox)) + { + return; + } + Parcela val = (Parcela)((FrameworkElement)e.Row).DataContext; + FrameworkElement editingElement = e.EditingElement; + TextBox val2 = (TextBox)(object)((editingElement is TextBox) ? editingElement : null); + if (val2 == null) + { + return; + } + if (e.Column.ClipboardContentBinding.StringFormat == "d") + { + val2.Text = ValidationHelper.FormatDate(val2.Text); + if (e.Column.Header.ToString() == "VENCIMENTO") + { + val.Vencimento = ((string.IsNullOrWhiteSpace(val2.Text) || !DateTime.TryParse(val2.Text, out var _)) ? DateTime.MinValue : DateTime.Parse(val2.Text)); + } + } + string text = e.Column.Header.ToString(); + if (!(text == "VALOR")) + { + if (text == "VENCIMENTO") + { + ViewModel.AlterandoVencimento((Parcela)((FrameworkElement)e.Row).DataContext); + } + } + else + { + ViewModel.AlterandoValor(); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialogeditarparcelas.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_002b: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Expected O, but got Unknown + //IL_0037: Unknown result type (might be due to invalid IL or missing references) + //IL_0043: Unknown result type (might be due to invalid IL or missing references) + //IL_004d: Expected O, but got Unknown + //IL_0050: Unknown result type (might be due to invalid IL or missing references) + //IL_005a: Expected O, but got Unknown + //IL_0074: Unknown result type (might be due to invalid IL or missing references) + //IL_007e: Expected O, but got Unknown + //IL_0081: Unknown result type (might be due to invalid IL or missing references) + //IL_008b: Expected O, but got Unknown + //IL_008e: Unknown result type (might be due to invalid IL or missing references) + //IL_0098: Expected O, but got Unknown + //IL_00a5: Unknown result type (might be due to invalid IL or missing references) + //IL_00af: Expected O, but got Unknown + //IL_00b2: Unknown result type (might be due to invalid IL or missing references) + //IL_00bc: Expected O, but got Unknown + //IL_00c9: Unknown result type (might be due to invalid IL or missing references) + //IL_00d3: Expected O, but got Unknown + switch (connectionId) + { + case 1: + Snackbar = (Snackbar)target; + break; + case 2: + ((SnackbarMessage)target).ActionClick += new RoutedEventHandler(SnackbarMessage_ActionClick); + break; + case 3: + ParcelaGrid = (DataGrid)target; + ParcelaGrid.CellEditEnding += ParcelaGrid_OnCellEditEnding; + break; + case 4: + ParcelaColumn = (DataGridTextColumn)target; + break; + case 5: + LabelStatus = (Label)target; + break; + case 6: + SalvarButton = (Button)target; + ((ButtonBase)SalvarButton).Click += new RoutedEventHandler(SalvarButton_OnClick); + break; + case 7: + FecharButton = (Button)target; + ((ButtonBase)FecharButton).Click += new RoutedEventHandler(FecharButton_OnClick); + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogEnviarEmails.cs b/Decompiler/Gestor.Application.Componentes/DialogEnviarEmails.cs new file mode 100644 index 0000000..e9f94ad --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogEnviarEmails.cs @@ -0,0 +1,67 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; +using Gestor.Application.ViewModels.Generic; + +namespace Gestor.Application.Componentes; + +public class DialogEnviarEmails : UserControl, IComponentConnector +{ + public DialogEnviarEmailsViewModel ViewModel; + + internal ProgressBar ProgressBar; + + private bool _contentLoaded; + + public DialogEnviarEmails(DialogEnviarEmailsViewModel viewModel) + { + ViewModel = viewModel; + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + private void Enviar_Click(object sender, RoutedEventArgs e) + { + ViewModel.Enviar(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialogenviaremails.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_0016: Expected O, but got Unknown + //IL_0018: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ProgressBar = (ProgressBar)target; + break; + case 2: + ((MenuItem)target).Click += new RoutedEventHandler(Enviar_Click); + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogExportarPermissao.cs b/Decompiler/Gestor.Application.Componentes/DialogExportarPermissao.cs new file mode 100644 index 0000000..0c24154 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogExportarPermissao.cs @@ -0,0 +1,119 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Markup; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Componentes; + +public class DialogExportarPermissao : UserControl, IComponentConnector, IStyleConnector +{ + public DialogExportarPermissaoViewModel ViewModel; + + internal DataGrid UsuarioGrid; + + private bool _contentLoaded; + + public DialogExportarPermissao(DialogExportarPermissaoViewModel viewModel) + { + ViewModel = viewModel; + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + private void AutoCompleteBoxUsuario_Populating(object sender, PopulatingEventArgs e) + { + e.Cancel = true; + ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void AutoCompleteBox_OnTextChanged(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + if (string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).Text)) + { + ViewModel.FiltrarUsuario(""); + } + } + + private void CheckBox_Checked(object sender, RoutedEventArgs e) + { + ViewModel.Selecionar(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialogexportarpermissao.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + //IL_0021: Expected O, but got Unknown + //IL_0022: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_0038: Expected O, but got Unknown + //IL_003b: Unknown result type (might be due to invalid IL or missing references) + //IL_0045: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBoxUsuario_Populating); + ((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBox_OnTextChanged); + break; + case 2: + UsuarioGrid = (DataGrid)target; + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Expected O, but got Unknown + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0028: Unknown result type (might be due to invalid IL or missing references) + //IL_0032: Expected O, but got Unknown + if (connectionId == 3) + { + ((ToggleButton)(CheckBox)target).Checked += new RoutedEventHandler(CheckBox_Checked); + ((ToggleButton)(CheckBox)target).Unchecked += new RoutedEventHandler(CheckBox_Checked); + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogExtratoComissao.cs b/Decompiler/Gestor.Application.Componentes/DialogExtratoComissao.cs new file mode 100644 index 0000000..5d07bf8 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogExtratoComissao.cs @@ -0,0 +1,210 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Threading; +using Gestor.Application.ViewModels.Generic; +using Gestor.Application.Views.Generic; +using Gestor.Model.Domain.Seguros; +using MaterialDesignThemes.Wpf; + +namespace Gestor.Application.Componentes; + +public class DialogExtratoComissao : BaseUserControl, IComponentConnector, IStyleConnector +{ + public ExtratoComissaoViewModel ViewModel; + + internal ComboBox SeguradoraBox; + + internal ComboBox SeguradoraSocialBox; + + internal DatePicker InicioBox; + + internal DatePicker FimBox; + + internal ProgressBar ProgressBar; + + internal DataGrid ExtratoGrid; + + internal Button ImportarButton; + + internal Button FecharButton; + + private bool _contentLoaded; + + public DialogExtratoComissao(List seguradoras) + { + InitializeComponent(); + ViewModel = new ExtratoComissaoViewModel(seguradoras); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + } + + private void ContentLoad() + { + //IL_003b: Unknown result type (might be due to invalid IL or missing references) + //IL_0045: Expected O, but got Unknown + //IL_0052: Unknown result type (might be due to invalid IL or missing references) + //IL_005c: Expected O, but got Unknown + InicioBox.SelectedDateChanged += DataBox_SelectedDateChanged; + FimBox.SelectedDateChanged += DataBox_SelectedDateChanged; + ((Selector)SeguradoraBox).SelectionChanged += new SelectionChangedEventHandler(SeguradoraBox_SelectionChanged); + ((Selector)SeguradoraSocialBox).SelectionChanged += new SelectionChangedEventHandler(SeguradoraSicialBox_SelectionChanged); + } + + private void SeguradoraSicialBox_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + ((Selector)SeguradoraBox).SelectedItem = ((Selector)SeguradoraSocialBox).SelectedItem; + CarregarExtratos(); + } + + private void SeguradoraBox_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + CarregarExtratos(); + } + + private void Importar_OnClick(object sender, RoutedEventArgs e) + { + DialogHost.CloseDialogCommand.Execute((object)ViewModel.Selecionar(), (IInputElement)(object)ImportarButton); + } + + private void Fechar_OnClick(object sender, RoutedEventArgs e) + { + DialogHost.CloseDialogCommand.Execute((object)null, (IInputElement)(object)FecharButton); + } + + private void DataBox_SelectedDateChanged(object sender, SelectionChangedEventArgs e) + { + CarregarExtratos(); + } + + private async void CarregarExtratos() + { + if (((Selector)SeguradoraBox).SelectedItem != null && InicioBox.SelectedDate.HasValue && FimBox.SelectedDate.HasValue) + { + ViewModel.IsEnabled = false; + ((UIElement)ProgressBar).Visibility = (Visibility)0; + await ViewModel.CarregarExtratos((Seguradora)((Selector)SeguradoraBox).SelectedItem, InicioBox.SelectedDate.Value, FimBox.SelectedDate.Value); + ((UIElement)ProgressBar).Visibility = (Visibility)2; + ViewModel.IsEnabled = true; + } + } + + private void CheckBox_Checked(object sender, RoutedEventArgs e) + { + ViewModel.SelecionarTudo(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialogextratocomissao.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0033: Unknown result type (might be due to invalid IL or missing references) + //IL_003d: Expected O, but got Unknown + //IL_0040: Unknown result type (might be due to invalid IL or missing references) + //IL_004a: Expected O, but got Unknown + //IL_004d: Unknown result type (might be due to invalid IL or missing references) + //IL_0057: Expected O, but got Unknown + //IL_0064: Unknown result type (might be due to invalid IL or missing references) + //IL_006e: Expected O, but got Unknown + //IL_0071: Unknown result type (might be due to invalid IL or missing references) + //IL_007b: Expected O, but got Unknown + //IL_0088: Unknown result type (might be due to invalid IL or missing references) + //IL_0092: Expected O, but got Unknown + //IL_0095: Unknown result type (might be due to invalid IL or missing references) + //IL_009f: Expected O, but got Unknown + //IL_00a2: Unknown result type (might be due to invalid IL or missing references) + //IL_00ac: Expected O, but got Unknown + //IL_00af: Unknown result type (might be due to invalid IL or missing references) + //IL_00b9: Expected O, but got Unknown + //IL_00c6: Unknown result type (might be due to invalid IL or missing references) + //IL_00d0: Expected O, but got Unknown + //IL_00d3: Unknown result type (might be due to invalid IL or missing references) + //IL_00dd: Expected O, but got Unknown + //IL_00ea: Unknown result type (might be due to invalid IL or missing references) + //IL_00f4: Expected O, but got Unknown + switch (connectionId) + { + case 1: + SeguradoraBox = (ComboBox)target; + break; + case 2: + SeguradoraSocialBox = (ComboBox)target; + break; + case 3: + InicioBox = (DatePicker)target; + ((UIElement)InicioBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + break; + case 4: + FimBox = (DatePicker)target; + ((UIElement)FimBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + break; + case 5: + ProgressBar = (ProgressBar)target; + break; + case 6: + ExtratoGrid = (DataGrid)target; + break; + case 8: + ImportarButton = (Button)target; + ((ButtonBase)ImportarButton).Click += new RoutedEventHandler(Importar_OnClick); + break; + case 9: + FecharButton = (Button)target; + ((ButtonBase)FecharButton).Click += new RoutedEventHandler(Fechar_OnClick); + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Expected O, but got Unknown + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0028: Unknown result type (might be due to invalid IL or missing references) + //IL_0032: Expected O, but got Unknown + if (connectionId == 7) + { + ((ToggleButton)(CheckBox)target).Checked += new RoutedEventHandler(CheckBox_Checked); + ((ToggleButton)(CheckBox)target).Unchecked += new RoutedEventHandler(CheckBox_Checked); + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogGrafico.cs b/Decompiler/Gestor.Application.Componentes/DialogGrafico.cs new file mode 100644 index 0000000..7543980 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogGrafico.cs @@ -0,0 +1,46 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; + +namespace Gestor.Application.Componentes; + +public class DialogGrafico : UserControl, IComponentConnector +{ + private bool _contentLoaded; + + public DialogGrafico() + { + InitializeComponent(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialoggrafico.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + _contentLoaded = true; + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogHoster.cs b/Decompiler/Gestor.Application.Componentes/DialogHoster.cs new file mode 100644 index 0000000..c144ee5 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogHoster.cs @@ -0,0 +1,81 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Media; + +namespace Gestor.Application.Componentes; + +public class DialogHoster : UserControl, IComponentConnector +{ + internal TextBlock Head; + + internal Button CloseButton; + + internal ContentControl Content; + + private bool _contentLoaded; + + public DialogHoster(object view, string head) + { + InitializeComponent(); + Content.Content = view; + Head.Text = head; + } + + private void TopControls_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Unknown result type (might be due to invalid IL or missing references) + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_001d: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Unknown result type (might be due to invalid IL or missing references) + //IL_0038: Expected O, but got Unknown + ((Control)(Button)sender).Background = (Brush)((((FrameworkElement)(Button)sender).Name == "CloseButton") ? new SolidColorBrush(Colors.Red) : new SolidColorBrush(Colors.DimGray)); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialoghoster.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0018: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Expected O, but got Unknown + //IL_0025: Unknown result type (might be due to invalid IL or missing references) + //IL_002f: Expected O, but got Unknown + //IL_0032: Unknown result type (might be due to invalid IL or missing references) + //IL_003c: Expected O, but got Unknown + switch (connectionId) + { + case 1: + Head = (TextBlock)target; + break; + case 2: + CloseButton = (Button)target; + break; + case 3: + Content = (ContentControl)target; + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogInstalacoes.cs b/Decompiler/Gestor.Application.Componentes/DialogInstalacoes.cs new file mode 100644 index 0000000..2fc1403 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogInstalacoes.cs @@ -0,0 +1,118 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Markup; +using Gestor.Model.License; +using MaterialDesignThemes.Wpf; + +namespace Gestor.Application.Componentes; + +public class DialogInstalacoes : UserControl, IComponentConnector +{ + internal DataGrid InstalacoesView; + + internal Button ValidarButton; + + internal Button FecharButton; + + internal Snackbar Snackbar; + + private bool _contentLoaded; + + public DialogInstalacoes(List instalacoes) + { + InitializeComponent(); + ((ItemsControl)InstalacoesView).ItemsSource = instalacoes.Where((Instalacao i) => !string.IsNullOrEmpty(i.Gerenciador))?.ToList(); + ((Selector)InstalacoesView).SelectedIndex = -1; + } + + private void ValidarButton_OnClick(object sender, RoutedEventArgs e) + { + //IL_0037: Unknown result type (might be due to invalid IL or missing references) + //IL_0047: Expected O, but got Unknown + object selectedItem = ((Selector)InstalacoesView).SelectedItem; + if (selectedItem == null) + { + ((ContentControl)Snackbar.Message).Content = "SELECIONE A INSTALAÇÃO A SER SUBSTITUÍDA"; + Snackbar.IsActive = true; + } + else + { + DialogHost.CloseDialogCommand.Execute((object)(Instalacao)selectedItem, (IInputElement)(object)ValidarButton); + } + } + + private void FecharButton_OnClick(object sender, RoutedEventArgs e) + { + DialogHost.CloseDialogCommand.Execute((object)null, (IInputElement)(object)FecharButton); + } + + private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e) + { + ((ContentControl)Snackbar.Message).Content = ""; + Snackbar.IsActive = false; + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialoginstalacoes.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0020: Unknown result type (might be due to invalid IL or missing references) + //IL_002a: Expected O, but got Unknown + //IL_002d: Unknown result type (might be due to invalid IL or missing references) + //IL_0037: Expected O, but got Unknown + //IL_0044: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Expected O, but got Unknown + //IL_0051: Unknown result type (might be due to invalid IL or missing references) + //IL_005b: Expected O, but got Unknown + //IL_0068: Unknown result type (might be due to invalid IL or missing references) + //IL_0072: Expected O, but got Unknown + //IL_0075: Unknown result type (might be due to invalid IL or missing references) + //IL_007f: Expected O, but got Unknown + //IL_0081: Unknown result type (might be due to invalid IL or missing references) + //IL_008d: Unknown result type (might be due to invalid IL or missing references) + //IL_0097: Expected O, but got Unknown + switch (connectionId) + { + case 1: + InstalacoesView = (DataGrid)target; + break; + case 2: + ValidarButton = (Button)target; + ((ButtonBase)ValidarButton).Click += new RoutedEventHandler(ValidarButton_OnClick); + break; + case 3: + FecharButton = (Button)target; + ((ButtonBase)FecharButton).Click += new RoutedEventHandler(FecharButton_OnClick); + break; + case 4: + Snackbar = (Snackbar)target; + break; + case 5: + ((SnackbarMessage)target).ActionClick += new RoutedEventHandler(SnackbarMessage_ActionClick); + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogLogAcesso.cs b/Decompiler/Gestor.Application.Componentes/DialogLogAcesso.cs new file mode 100644 index 0000000..7b6e940 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogLogAcesso.cs @@ -0,0 +1,72 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; +using Gestor.Application.ViewModels.Drawer; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.Validation; + +namespace Gestor.Application.Componentes; + +public class DialogLogAcesso : UserControl, IComponentConnector +{ + internal ProgressBar ProgressBar; + + internal TextBlock TitleText; + + private bool _contentLoaded; + + public LogViewModel ViewModel { get; set; } + + public DialogLogAcesso(TipoTela tela, Usuario usuario) + { + //IL_0007: Unknown result type (might be due to invalid IL or missing references) + //IL_0053: Unknown result type (might be due to invalid IL or missing references) + //IL_0069: Unknown result type (might be due to invalid IL or missing references) + ViewModel = new LogViewModel(tela, ((DomainBase)usuario).Id); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + ViewModel.RegistrarAcao($"ACESSOU LOG DE ACESSO DO USUÁRIO {usuario.Nome}, ID \"{((DomainBase)usuario).Id}\"", ((DomainBase)usuario).Id, tela, $"ID ENTIDADE: {((DomainBase)usuario).Id}\nTIPO: {Funcoes.GetDescription((Enum)(object)tela)}"); + TitleText.Text = $"LOG DE ACESSO DO USUARIO: {usuario.Nome}, ID {((DomainBase)usuario).Id}"; + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialoglogacesso.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_0016: Expected O, but got Unknown + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_0023: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ProgressBar = (ProgressBar)target; + break; + case 2: + TitleText = (TextBlock)target; + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogMedalha.cs b/Decompiler/Gestor.Application.Componentes/DialogMedalha.cs new file mode 100644 index 0000000..a5a01fc --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogMedalha.cs @@ -0,0 +1,44 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; +using Gestor.Application.ViewModels.Generic; + +namespace Gestor.Application.Componentes; + +public class DialogMedalha : UserControl, IComponentConnector +{ + private bool _contentLoaded; + + private DialogMedalhaViewModel ViewModel { get; } + + public DialogMedalha(int liquido, int comissao, int resultado, int media) + { + ViewModel = new DialogMedalhaViewModel(liquido, comissao, resultado, media); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialogmedalha.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + _contentLoaded = true; + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogObservacao.cs b/Decompiler/Gestor.Application.Componentes/DialogObservacao.cs new file mode 100644 index 0000000..ba3c0a4 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogObservacao.cs @@ -0,0 +1,90 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Markup; +using MaterialDesignThemes.Wpf; + +namespace Gestor.Application.Componentes; + +public class DialogObservacao : UserControl, IComponentConnector +{ + internal TextBox TextBox; + + internal Button SalvarButton; + + internal Button CancelarButton; + + private bool _contentLoaded; + + public DialogObservacao() + { + InitializeComponent(); + } + + private void SalvarButton_OnClick(object sender, RoutedEventArgs e) + { + DialogHost.CloseDialogCommand.Execute((object)TextBox.Text, (IInputElement)(object)SalvarButton); + } + + private void CancelarButton_OnClick(object sender, RoutedEventArgs e) + { + DialogHost.CloseDialogCommand.Execute((object)null, (IInputElement)(object)CancelarButton); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialogobservacao.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0018: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Expected O, but got Unknown + //IL_0025: Unknown result type (might be due to invalid IL or missing references) + //IL_002f: Expected O, but got Unknown + //IL_003c: Unknown result type (might be due to invalid IL or missing references) + //IL_0046: Expected O, but got Unknown + //IL_0049: Unknown result type (might be due to invalid IL or missing references) + //IL_0053: Expected O, but got Unknown + //IL_0060: Unknown result type (might be due to invalid IL or missing references) + //IL_006a: Expected O, but got Unknown + switch (connectionId) + { + case 1: + TextBox = (TextBox)target; + break; + case 2: + SalvarButton = (Button)target; + ((ButtonBase)SalvarButton).Click += new RoutedEventHandler(SalvarButton_OnClick); + break; + case 3: + CancelarButton = (Button)target; + ((ButtonBase)CancelarButton).Click += new RoutedEventHandler(CancelarButton_OnClick); + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogPesquisaAvancada.cs b/Decompiler/Gestor.Application.Componentes/DialogPesquisaAvancada.cs new file mode 100644 index 0000000..8c99bef --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogPesquisaAvancada.cs @@ -0,0 +1,124 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; +using System.Windows.Threading; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using MaterialDesignThemes.Wpf; + +namespace Gestor.Application.Componentes; + +public class DialogPesquisaAvancada : UserControl, IComponentConnector +{ + internal DataGrid Grid; + + internal Snackbar Snackbar; + + private bool _contentLoaded; + + public DialogPesquisaAvancadaViewModel ViewModel { get; set; } + + public DialogPesquisaAvancada(DialogPesquisaAvancadaViewModel viewModel) + { + ViewModel = viewModel; + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + ViewModel.GetTipoTela(); + ViewModel.HabilitarBusca(); + } + + private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e) + { + Snackbar.IsActive = false; + } + + public void ToggleSnackBar(string message, bool active = true) + { + ((ContentControl)Snackbar.Message).Content = message; + Snackbar.IsActive = active; + if (active) + { + Task.Factory.StartNew(CloseSlackBar); + } + } + + private void CloseSlackBar() + { + Thread.Sleep(3000); + Dispatcher dispatcher = ((DispatcherObject)App.ProgressRing).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)4, (Delegate)(Action)delegate + { + ToggleSnackBar("", active: false); + }); + } + } + + private async void Pesquisar_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.Pesquisa == null) + { + ToggleSnackBar("INFORME QUAL " + ValidationHelper.GetDescription((Enum)(object)ViewModel.Tipo) + " DESEJA PROCURAR"); + return; + } + await ViewModel.Pesquisar(); + if (ViewModel.Pesquisas.Count == 0) + { + ToggleSnackBar("NÃO HÁ DOCUMENTOS ENCONTRADOS."); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialogpesquisaavancada.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_001b: Unknown result type (might be due to invalid IL or missing references) + //IL_0027: Unknown result type (might be due to invalid IL or missing references) + //IL_0031: Expected O, but got Unknown + //IL_0034: Unknown result type (might be due to invalid IL or missing references) + //IL_003e: Expected O, but got Unknown + //IL_0041: Unknown result type (might be due to invalid IL or missing references) + //IL_004b: Expected O, but got Unknown + //IL_004d: Unknown result type (might be due to invalid IL or missing references) + //IL_0059: Unknown result type (might be due to invalid IL or missing references) + //IL_0063: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((MenuItem)target).Click += new RoutedEventHandler(Pesquisar_OnClick); + break; + case 2: + Grid = (DataGrid)target; + break; + case 3: + Snackbar = (Snackbar)target; + break; + case 4: + ((SnackbarMessage)target).ActionClick += new RoutedEventHandler(SnackbarMessage_ActionClick); + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogPrint.cs b/Decompiler/Gestor.Application.Componentes/DialogPrint.cs new file mode 100644 index 0000000..31ece9d --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogPrint.cs @@ -0,0 +1,172 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Markup; +using System.Windows.Threading; +using Gestor.Application.ViewModels.Relatorios; +using Gestor.Model.Common; +using Gestor.Model.Domain.Relatorios; +using MaterialDesignThemes.Wpf; + +namespace Gestor.Application.Componentes; + +public class DialogPrint : UserControl, IComponentConnector, IStyleConnector +{ + internal ProgressBar ProgressBar; + + internal CheckBox Landscape; + + internal CheckBox Portrait; + + internal Button ValidarButton; + + internal Button FecharButton; + + private bool _contentLoaded; + + public DialogPrintViewModel ViewModel { get; set; } + + public DialogPrint(Relatorio relatorio, Type tipo) + { + //IL_0007: Unknown result type (might be due to invalid IL or missing references) + ViewModel = new DialogPrintViewModel(relatorio, tipo); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + } + + private async void ContentLoad() + { + ViewModel.Carregando = true; + await ViewModel.Carregar(); + ((ToggleButton)Landscape).IsChecked = true; + ViewModel.Carregando = false; + } + + private void ToggleButton_OnChecked(object sender, RoutedEventArgs e) + { + ViewModel.Selecionar(); + } + + private void ImprimirButton_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Configuracoes.Campos = ViewModel.Configuracoes.Campos.Where((ParametrosRelatorio x) => x.Selecionado).ToList(); + DialogHost.CloseDialogCommand.Execute((object)ViewModel.Configuracoes, (IInputElement)(object)ValidarButton); + ViewModel.Configuracoes.OrientacaoImpressao = ViewModel.OrientacaoImpressao; + } + + private void CancelarButton_OnClick(object sender, RoutedEventArgs e) + { + DialogHost.CloseDialogCommand.Execute((object)null, (IInputElement)(object)FecharButton); + } + + private void ToggleButtonLandscape_OnChecked(object sender, RoutedEventArgs e) + { + ViewModel.OrientacaoImpressao = false; + ViewModel.OrientacaoImpressaoPortrait = false; + ((ToggleButton)Portrait).IsChecked = false; + } + + private void ToggleButtonPortrait_OnChecked(object sender, RoutedEventArgs e) + { + ViewModel.OrientacaoImpressao = true; + ViewModel.OrientacaoImpressaoLandscape = false; + ((ToggleButton)Landscape).IsChecked = false; + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialogprint.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0027: Unknown result type (might be due to invalid IL or missing references) + //IL_0031: Expected O, but got Unknown + //IL_0034: Unknown result type (might be due to invalid IL or missing references) + //IL_003e: Expected O, but got Unknown + //IL_004b: Unknown result type (might be due to invalid IL or missing references) + //IL_0055: Expected O, but got Unknown + //IL_0058: Unknown result type (might be due to invalid IL or missing references) + //IL_0062: Expected O, but got Unknown + //IL_006f: Unknown result type (might be due to invalid IL or missing references) + //IL_0079: Expected O, but got Unknown + //IL_007c: Unknown result type (might be due to invalid IL or missing references) + //IL_0086: Expected O, but got Unknown + //IL_0093: Unknown result type (might be due to invalid IL or missing references) + //IL_009d: Expected O, but got Unknown + //IL_00a0: Unknown result type (might be due to invalid IL or missing references) + //IL_00aa: Expected O, but got Unknown + //IL_00b7: Unknown result type (might be due to invalid IL or missing references) + //IL_00c1: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ProgressBar = (ProgressBar)target; + break; + case 3: + Landscape = (CheckBox)target; + ((ToggleButton)Landscape).Checked += new RoutedEventHandler(ToggleButtonLandscape_OnChecked); + break; + case 4: + Portrait = (CheckBox)target; + ((ToggleButton)Portrait).Checked += new RoutedEventHandler(ToggleButtonPortrait_OnChecked); + break; + case 5: + ValidarButton = (Button)target; + ((ButtonBase)ValidarButton).Click += new RoutedEventHandler(ImprimirButton_OnClick); + break; + case 6: + FecharButton = (Button)target; + ((ButtonBase)FecharButton).Click += new RoutedEventHandler(CancelarButton_OnClick); + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Expected O, but got Unknown + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0028: Unknown result type (might be due to invalid IL or missing references) + //IL_0032: Expected O, but got Unknown + if (connectionId == 2) + { + ((ToggleButton)(CheckBox)target).Checked += new RoutedEventHandler(ToggleButton_OnChecked); + ((ToggleButton)(CheckBox)target).Unchecked += new RoutedEventHandler(ToggleButton_OnChecked); + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogProtocolo.cs b/Decompiler/Gestor.Application.Componentes/DialogProtocolo.cs new file mode 100644 index 0000000..1a033de --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogProtocolo.cs @@ -0,0 +1,46 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Componentes; + +public class DialogProtocolo : UserControl, IComponentConnector +{ + private bool _contentLoaded; + + private ProtocoloViewModel ViewModel { get; } + + public DialogProtocolo(List itens) + { + ViewModel = new ProtocoloViewModel(itens); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialogprotocolo.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + _contentLoaded = true; + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogReordenarItens.cs b/Decompiler/Gestor.Application.Componentes/DialogReordenarItens.cs new file mode 100644 index 0000000..f5a1e4b --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogReordenarItens.cs @@ -0,0 +1,69 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Markup; +using Gestor.Application.ViewModels.Generic; + +namespace Gestor.Application.Componentes; + +public class DialogReordenarItens : UserControl, IComponentConnector +{ + internal ProgressBar ProgressRing; + + private bool _contentLoaded; + + private ReordenarItensViewModel ViewModel { get; } + + public DialogReordenarItens(List ids) + { + ViewModel = new ReordenarItensViewModel(ids); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + private void ReordenarAutomaticamente_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.ReordenarAutomaticamente(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialogreordenaritens.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + //IL_0021: Expected O, but got Unknown + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ReordenarAutomaticamente_OnClick); + break; + case 2: + ProgressRing = (ProgressBar)target; + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogSelecionarItens.cs b/Decompiler/Gestor.Application.Componentes/DialogSelecionarItens.cs new file mode 100644 index 0000000..6261190 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogSelecionarItens.cs @@ -0,0 +1,44 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; +using Gestor.Application.ViewModels.Generic; + +namespace Gestor.Application.Componentes; + +public class DialogSelecionarItens : UserControl, IComponentConnector +{ + private bool _contentLoaded; + + private SelecionarItensViewModel ViewModel { get; } + + public DialogSelecionarItens(long id) + { + ViewModel = new SelecionarItensViewModel(id); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialogselecionaritens.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + _contentLoaded = true; + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogSenhaAdm.cs b/Decompiler/Gestor.Application.Componentes/DialogSenhaAdm.cs new file mode 100644 index 0000000..863b0ac --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogSenhaAdm.cs @@ -0,0 +1,132 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using System.Windows.Markup; +using Gestor.Application.Servicos.Ferramentas; +using Gestor.Common.Helpers; +using MaterialDesignThemes.Wpf; + +namespace Gestor.Application.Componentes; + +public class DialogSenhaAdm : UserControl, IComponentConnector +{ + internal TextBlock MensagemBlock; + + internal CustomPasswordBox SenhaBox; + + internal TextBlock MensagemErro; + + internal Button ValidarButton; + + internal Button FecharButton; + + private bool _contentLoaded; + + public DialogSenhaAdm(string mensagem) + { + InitializeComponent(); + MensagemBlock.Text = mensagem; + } + + private void PasswordBox_OnKeyDown(object sender, KeyEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Invalid comparison between Unknown and I4 + if ((int)e.Key == 6) + { + DialogHost.CloseDialogCommand.Execute((object)Validar(), (IInputElement)(object)ValidarButton); + } + } + + private void ValidarButton_OnClick(object sender, RoutedEventArgs e) + { + if (!Validar()) + { + ((UIElement)MensagemErro).Visibility = (Visibility)0; + } + else + { + DialogHost.CloseDialogCommand.Execute((object)Validar(), (IInputElement)(object)ValidarButton); + } + } + + private void FecharButton_OnClick(object sender, RoutedEventArgs e) + { + DialogHost.CloseDialogCommand.Execute((object)null, (IInputElement)(object)FecharButton); + } + + private bool Validar() + { + return SenhaBox.Text == EncryptionHelper.Decrypt(new EmpresaServico().BuscarSenhaAdm()); + } + + private void PasswordBox_LostFocus(object sender, RoutedEventArgs e) + { + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialogsenhaadm.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0020: Unknown result type (might be due to invalid IL or missing references) + //IL_002a: Expected O, but got Unknown + //IL_003a: Unknown result type (might be due to invalid IL or missing references) + //IL_0044: Expected O, but got Unknown + //IL_0047: Unknown result type (might be due to invalid IL or missing references) + //IL_0051: Expected O, but got Unknown + //IL_005e: Unknown result type (might be due to invalid IL or missing references) + //IL_0068: Expected O, but got Unknown + //IL_006b: Unknown result type (might be due to invalid IL or missing references) + //IL_0075: Expected O, but got Unknown + //IL_0082: Unknown result type (might be due to invalid IL or missing references) + //IL_008c: Expected O, but got Unknown + switch (connectionId) + { + case 1: + MensagemBlock = (TextBlock)target; + break; + case 2: + SenhaBox = (CustomPasswordBox)target; + break; + case 3: + MensagemErro = (TextBlock)target; + break; + case 4: + ValidarButton = (Button)target; + ((ButtonBase)ValidarButton).Click += new RoutedEventHandler(ValidarButton_OnClick); + break; + case 5: + FecharButton = (Button)target; + ((ButtonBase)FecharButton).Click += new RoutedEventHandler(FecharButton_OnClick); + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogTarefa.cs b/Decompiler/Gestor.Application.Componentes/DialogTarefa.cs new file mode 100644 index 0000000..a177436 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogTarefa.cs @@ -0,0 +1,398 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Data; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Threading; +using Gestor.Application.Helpers; +using Gestor.Application.ViewModels.Generic; +using Gestor.Application.Views.Generic; +using Gestor.Application.Views.Seguros; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using MaterialDesignThemes.Wpf; +using Xceed.Wpf.AvalonDock.Controls; + +namespace Gestor.Application.Componentes; + +public class DialogTarefa : UserControl, IComponentConnector, IStyleConnector +{ + internal Button ClienteButton; + + internal Button ApoliceButton; + + internal Button SinistroButton; + + internal TextBox TituloBox; + + internal DatePicker AgendamentoBox; + + internal RadioButton AnotacoesButton; + + internal TextBox AnotacoesBox; + + internal ComboBox ResponsavelBox; + + internal DatePicker ConclusaoBox; + + internal MenuItem SalvarButton; + + internal Snackbar Snackbar; + + private bool _contentLoaded; + + private DialogTarefaViewModel ViewModel { get; } + + public DialogTarefa(Tarefa tarefa, List telefones, bool nota = false, bool agendamento = false) + { + ViewModel = new DialogTarefaViewModel(tarefa, telefones, nota, agendamento); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + } + + private void ContentLoad() + { + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Expected O, but got Unknown + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Expected O, but got Unknown + //IL_0051: Unknown result type (might be due to invalid IL or missing references) + //IL_0056: Unknown result type (might be due to invalid IL or missing references) + //IL_0057: Unknown result type (might be due to invalid IL or missing references) + //IL_0071: Expected I4, but got Unknown + //IL_010d: Unknown result type (might be due to invalid IL or missing references) + //IL_0117: Expected O, but got Unknown + ((UIElement)AgendamentoBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(DatePicker_OnLostKeyboardFocus); + ((UIElement)AgendamentoBox).PreviewKeyDown += new KeyEventHandler(DatePicker_PreviewKeyDown); + ViewModel.PermissaoWhatsapp = ViewModel.Restricao((TipoRestricao)32); + TipoTarefa entidade = ViewModel.Tarefa.Entidade; + switch ((int)entidade) + { + default: + ((UIElement)ClienteButton).Visibility = (Visibility)2; + ((UIElement)ApoliceButton).Visibility = (Visibility)2; + break; + case 0: + ((UIElement)ClienteButton).Visibility = (Visibility)0; + ((UIElement)ApoliceButton).Visibility = (Visibility)0; + break; + case 3: + ((UIElement)ClienteButton).Visibility = (Visibility)0; + ((UIElement)ApoliceButton).Visibility = (Visibility)0; + break; + case 2: + ((UIElement)ClienteButton).Visibility = (Visibility)0; + break; + case 4: + ((UIElement)ClienteButton).Visibility = (Visibility)0; + ((UIElement)SinistroButton).Visibility = (Visibility)0; + break; + } + ((ToggleButton)AnotacoesButton).IsChecked = ViewModel.IsAnotacoes; + ((ToggleButton)AnotacoesButton).Checked += new RoutedEventHandler(Anotacoes_OnChecked); + } + + private void Anotacoes_OnChecked(object sender, RoutedEventArgs e) + { + ViewModel.IsAnotacoes = true; + } + + private void AnotacoesInternas_OnChecked(object sender, RoutedEventArgs e) + { + ViewModel.IsAnotacoes = false; + } + + private void CopyTelefoneToClipBoard_Click(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Expected O, but got Unknown + TelefoneBase val = (TelefoneBase)((FrameworkElement)(Button)sender).DataContext; + (val.Prefixo + val.Numero).CopyToClipboard(); + ToggleSnackBar("NÚMERO COPIADO COM SUCESSO"); + } + + private async void WhatsAppMessage_Click(object sender, RoutedEventArgs e) + { + TelefoneBase val = (TelefoneBase)((FrameworkElement)(Button)sender).DataContext; + if (!((val.Tipo.HasValue && (int)val.Tipo.GetValueOrDefault() == 8) ? (val.Prefixo + val.Numero).Clear() : ("55" + val.Prefixo + val.Numero.Clear())).EnviarWhatsapp()) + { + await ViewModel.ShowMessage("HOUVE UM PROBLEMA AO ABRIR LINK DO WHATSAPP, O LINK FOI COPIADO EM SUA MAQUINA, BASTA ABRIR O NAVEGADOR DE INTERNET E COLAR NA BARRA DE ENDEREÇOS"); + } + } + + private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e) + { + Snackbar.IsActive = false; + } + + public void ToggleSnackBar(string message, bool active = true) + { + ((ContentControl)Snackbar.Message).Content = message; + Snackbar.IsActive = active; + if (active) + { + Task.Factory.StartNew(CloseSlackBar); + } + } + + private void CloseSlackBar() + { + Thread.Sleep(3000); + Dispatcher dispatcher = ((DispatcherObject)App.ProgressRing).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)4, (Delegate)(Action)delegate + { + ToggleSnackBar("", active: false); + }); + } + } + + private void DatePicker_PreviewKeyDown(object sender, KeyEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Invalid comparison between Unknown and I4 + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + if ((int)e.Key == 6) + { + ((DatePicker)sender).Text = Funcoes.GetNetworkTime().Date.ToString("dd/MM/yyyy"); + } + } + + private void DatePicker_OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + DatePicker val = (DatePicker)sender; + val.Text = ValidationHelper.FormatDate(val.Text); + } + + private void TimePicker_OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + TimePicker val = (TimePicker)sender; + val.TextBox.Text = ValidationHelper.FormatTime(val.TextBox.Text); + } + + private async void AcessarApolice_OnClick(object sender, RoutedEventArgs e) + { + Documento documentoSelecionado = (((int)ViewModel.Tarefa.Entidade != 3) ? (await ViewModel.CarregaApolice(ViewModel.Tarefa.IdEntidade)) : (await ViewModel.CarregaApoliceParcela(ViewModel.Tarefa.IdEntidade))); + ((Window)new HosterWindow((ContentControl)(object)new ApoliceView(documentoSelecionado, lockInsert: true, invoke: false, (AcessoApolice)0, 0L), "CADASTRO DE APÓLICES - " + ViewModel.Tarefa.Cliente)).Show(); + } + + private async void AcessarCliente_OnClick(object sender, RoutedEventArgs e) + { + ((Window)new HosterWindow((ContentControl)(object)new ClienteView(await ViewModel.CarregaCliente(ViewModel.Tarefa.IdCliente), lockInsert: true), "CADASTRO DE CLIENTE - " + ViewModel.Tarefa.Cliente)).Show(); + } + + private async void AcessarSinistro_OnClick(object sender, RoutedEventArgs e) + { + Sinistro val = await ViewModel.CarregaSinistroApolice(ViewModel.Tarefa.IdEntidade); + ((Window)new HosterWindow((ContentControl)(object)new SinistroView(val.ControleSinistro.Item, attached: false), "CADASTRO DE SINISTRO - " + val.ControleSinistro.Item.Descricao)).Show(); + } + + private void DataAtual_OnDoubleClick(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + ((DatePicker)sender).SelectedDate = Funcoes.GetNetworkTime().Date; + } + + private void AdicionarResponsavel_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AdcionarResponsavel(); + } + + private void ExcluirResponsavel_OnClick(object sender, RoutedEventArgs e) + { + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_0034: Expected O, but got Unknown + Chip val = (Chip)((sender is Chip) ? sender : null); + if (val != null) + { + ListBox val2 = Extentions.FindVisualAncestor((DependencyObject)(object)val); + Usuario val3 = (Usuario)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)]; + if (val3 != null) + { + ViewModel.RemoverResponsavel(val3); + } + } + } + + private void MenuItem_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.Tarefa.UsuariosVinculados == null) + { + ViewModel.Tarefa.UsuariosVinculados = new List(); + } + DialogHost.CloseDialogCommand.Execute((object)ViewModel.Tarefa, (IInputElement)(object)SalvarButton); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialogtarefa.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_004f: Unknown result type (might be due to invalid IL or missing references) + //IL_0059: Expected O, but got Unknown + //IL_0066: Unknown result type (might be due to invalid IL or missing references) + //IL_0070: Expected O, but got Unknown + //IL_0073: Unknown result type (might be due to invalid IL or missing references) + //IL_007d: Expected O, but got Unknown + //IL_008a: Unknown result type (might be due to invalid IL or missing references) + //IL_0094: Expected O, but got Unknown + //IL_0097: Unknown result type (might be due to invalid IL or missing references) + //IL_00a1: Expected O, but got Unknown + //IL_00ae: Unknown result type (might be due to invalid IL or missing references) + //IL_00b8: Expected O, but got Unknown + //IL_00bb: Unknown result type (might be due to invalid IL or missing references) + //IL_00c5: Expected O, but got Unknown + //IL_00c8: Unknown result type (might be due to invalid IL or missing references) + //IL_00d2: Expected O, but got Unknown + //IL_00df: Unknown result type (might be due to invalid IL or missing references) + //IL_00e9: Expected O, but got Unknown + //IL_00f6: Unknown result type (might be due to invalid IL or missing references) + //IL_0100: Expected O, but got Unknown + //IL_0103: Unknown result type (might be due to invalid IL or missing references) + //IL_010d: Expected O, but got Unknown + //IL_0110: Unknown result type (might be due to invalid IL or missing references) + //IL_011a: Expected O, but got Unknown + //IL_011d: Unknown result type (might be due to invalid IL or missing references) + //IL_0127: Expected O, but got Unknown + //IL_0129: Unknown result type (might be due to invalid IL or missing references) + //IL_0135: Unknown result type (might be due to invalid IL or missing references) + //IL_013f: Expected O, but got Unknown + //IL_0142: Unknown result type (might be due to invalid IL or missing references) + //IL_014c: Expected O, but got Unknown + //IL_0159: Unknown result type (might be due to invalid IL or missing references) + //IL_0163: Expected O, but got Unknown + //IL_0170: Unknown result type (might be due to invalid IL or missing references) + //IL_017a: Expected O, but got Unknown + //IL_017d: Unknown result type (might be due to invalid IL or missing references) + //IL_0187: Expected O, but got Unknown + //IL_0194: Unknown result type (might be due to invalid IL or missing references) + //IL_019e: Expected O, but got Unknown + //IL_01a1: Unknown result type (might be due to invalid IL or missing references) + //IL_01ab: Expected O, but got Unknown + //IL_01ad: Unknown result type (might be due to invalid IL or missing references) + //IL_01b9: Unknown result type (might be due to invalid IL or missing references) + //IL_01c3: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ClienteButton = (Button)target; + ((ButtonBase)ClienteButton).Click += new RoutedEventHandler(AcessarCliente_OnClick); + break; + case 2: + ApoliceButton = (Button)target; + ((ButtonBase)ApoliceButton).Click += new RoutedEventHandler(AcessarApolice_OnClick); + break; + case 3: + SinistroButton = (Button)target; + ((ButtonBase)SinistroButton).Click += new RoutedEventHandler(AcessarSinistro_OnClick); + break; + case 6: + TituloBox = (TextBox)target; + break; + case 7: + AgendamentoBox = (DatePicker)target; + ((UIElement)AgendamentoBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(DatePicker_OnLostKeyboardFocus); + ((Control)AgendamentoBox).MouseDoubleClick += new MouseButtonEventHandler(DataAtual_OnDoubleClick); + break; + case 8: + AnotacoesButton = (RadioButton)target; + break; + case 9: + AnotacoesBox = (TextBox)target; + break; + case 10: + ResponsavelBox = (ComboBox)target; + break; + case 11: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AdicionarResponsavel_OnClick); + break; + case 13: + ConclusaoBox = (DatePicker)target; + ((UIElement)ConclusaoBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(DatePicker_OnLostKeyboardFocus); + ((Control)ConclusaoBox).MouseDoubleClick += new MouseButtonEventHandler(DataAtual_OnDoubleClick); + break; + case 14: + SalvarButton = (MenuItem)target; + SalvarButton.Click += new RoutedEventHandler(MenuItem_OnClick); + break; + case 15: + Snackbar = (Snackbar)target; + break; + case 16: + ((SnackbarMessage)target).ActionClick += new RoutedEventHandler(SnackbarMessage_ActionClick); + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Unknown result type (might be due to invalid IL or missing references) + //IL_0025: Expected O, but got Unknown + //IL_0027: Unknown result type (might be due to invalid IL or missing references) + //IL_0033: Unknown result type (might be due to invalid IL or missing references) + //IL_003d: Expected O, but got Unknown + //IL_003f: Unknown result type (might be due to invalid IL or missing references) + //IL_004b: Unknown result type (might be due to invalid IL or missing references) + //IL_0055: Expected O, but got Unknown + switch (connectionId) + { + case 4: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(CopyTelefoneToClipBoard_Click); + break; + case 5: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(WhatsAppMessage_Click); + break; + case 12: + ((Chip)target).DeleteClick += new RoutedEventHandler(ExcluirResponsavel_OnClick); + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogTransferencia.cs b/Decompiler/Gestor.Application.Componentes/DialogTransferencia.cs new file mode 100644 index 0000000..f07e81b --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogTransferencia.cs @@ -0,0 +1,116 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using System.Windows.Markup; +using Assinador.Infrastructure.Helpers; +using CurrencyTextBoxControl; +using Gestor.Application.ViewModels.Financeiro; +using Gestor.Common.Validation; +using Gestor.Model.Domain.Financeiro; + +namespace Gestor.Application.Componentes; + +public class DialogTransferencia : UserControl, IComponentConnector +{ + internal ComboBox ContaOrigemBox; + + internal CurrencyTextBox ValorBox; + + internal DatePicker VencimentoBox; + + internal ComboBox ContaDestinoBox; + + private bool _contentLoaded; + + private TranferenciaViewModel ViewModel { get; } + + public DialogTransferencia(Transferencia transferencia) + { + ViewModel = new TranferenciaViewModel(transferencia); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + public void DatePicker_OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + DatePicker val = (DatePicker)sender; + val.Text = ValidationHelper.FormatDate(val.Text); + } + + public void DatePicker_PreviewKeyDown(object sender, KeyEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Invalid comparison between Unknown and I4 + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + if ((int)e.Key == 6) + { + ((DatePicker)sender).Text = Functions.GetNetworkTime().Date.ToString("dd/MM/yyyy"); + } + } + + private void DataAtual_OnDoubleClick(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + ((DatePicker)sender).SelectedDate = Functions.GetNetworkTime().Date; + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialogtransferencia.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0026: Expected O, but got Unknown + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_0033: Expected O, but got Unknown + //IL_0036: Unknown result type (might be due to invalid IL or missing references) + //IL_0040: Expected O, but got Unknown + //IL_004d: Unknown result type (might be due to invalid IL or missing references) + //IL_0057: Expected O, but got Unknown + //IL_0064: Unknown result type (might be due to invalid IL or missing references) + //IL_006e: Expected O, but got Unknown + //IL_007b: Unknown result type (might be due to invalid IL or missing references) + //IL_0085: Expected O, but got Unknown + //IL_0088: Unknown result type (might be due to invalid IL or missing references) + //IL_0092: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ContaOrigemBox = (ComboBox)target; + break; + case 2: + ValorBox = (CurrencyTextBox)target; + break; + case 3: + VencimentoBox = (DatePicker)target; + ((UIElement)VencimentoBox).PreviewKeyDown += new KeyEventHandler(DatePicker_PreviewKeyDown); + ((UIElement)VencimentoBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(DatePicker_OnLostKeyboardFocus); + ((Control)VencimentoBox).MouseDoubleClick += new MouseButtonEventHandler(DataAtual_OnDoubleClick); + break; + case 4: + ContaDestinoBox = (ComboBox)target; + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogTrilha.cs b/Decompiler/Gestor.Application.Componentes/DialogTrilha.cs new file mode 100644 index 0000000..cb766eb --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogTrilha.cs @@ -0,0 +1,143 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Markup; +using System.Windows.Media; +using Gestor.Application.Helpers; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Domain.Ferramentas; + +namespace Gestor.Application.Componentes; + +public class DialogTrilha : UserControl, IComponentConnector, IStyleConnector +{ + private bool _contentLoaded; + + public DialogTrilhaViewModel ViewModel { get; set; } + + public DialogTrilha(DialogTrilhaViewModel viewModel) + { + ViewModel = viewModel; + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + private void UIElement_OnGotFocus(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_000b: Expected O, but got Unknown + //IL_0021: Unknown result type (might be due to invalid IL or missing references) + //IL_0027: Expected O, but got Unknown + DependencyObject parent = VisualTreeHelper.GetParent((DependencyObject)(UIElement)sender); + while (!(parent is ListBoxItem)) + { + if (parent != null) + { + parent = VisualTreeHelper.GetParent(parent); + } + } + ListBoxItem val = (ListBoxItem)parent; + if (!val.IsSelected) + { + val.IsSelected = true; + } + } + + private void AdicionarFase_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AdicionarFase(); + } + + private void ExcluirFase_OnClick(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + object dataContext = ((FrameworkElement)(Button)sender).DataContext; + Fase val = (Fase)((dataContext is Fase) ? dataContext : null); + if (val != null) + { + ViewModel.ExcluirFase(val); + } + } + + private void UIElement_OnLostFocus(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_000b: Expected O, but got Unknown + ListBox val = ((DependencyObject)(TextBox)sender).FindAncestor().FirstOrDefault(); + if (val != null) + { + ViewModel.UpdateFase(((Selector)val).SelectedIndex); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialogtrilha.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Expected O, but got Unknown + if (connectionId == 1) + { + ((MenuItem)target).Click += new RoutedEventHandler(AdicionarFase_OnClick); + } + else + { + _contentLoaded = true; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Unknown result type (might be due to invalid IL or missing references) + //IL_002c: Expected O, but got Unknown + //IL_002d: Unknown result type (might be due to invalid IL or missing references) + //IL_0039: Unknown result type (might be due to invalid IL or missing references) + //IL_0043: Expected O, but got Unknown + //IL_0045: Unknown result type (might be due to invalid IL or missing references) + //IL_0051: Unknown result type (might be due to invalid IL or missing references) + //IL_005b: Expected O, but got Unknown + //IL_005c: Unknown result type (might be due to invalid IL or missing references) + //IL_0068: Unknown result type (might be due to invalid IL or missing references) + //IL_0072: Expected O, but got Unknown + //IL_0074: Unknown result type (might be due to invalid IL or missing references) + //IL_0080: Unknown result type (might be due to invalid IL or missing references) + //IL_008a: Expected O, but got Unknown + switch (connectionId) + { + case 2: + ((UIElement)(TextBox)target).GotFocus += new RoutedEventHandler(UIElement_OnGotFocus); + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(UIElement_OnLostFocus); + break; + case 3: + ((UIElement)(TextBox)target).GotFocus += new RoutedEventHandler(UIElement_OnGotFocus); + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(UIElement_OnLostFocus); + break; + case 4: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirFase_OnClick); + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogVinculo.cs b/Decompiler/Gestor.Application.Componentes/DialogVinculo.cs new file mode 100644 index 0000000..cfeb995 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogVinculo.cs @@ -0,0 +1,86 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Componentes; + +public class DialogVinculo : UserControl, IComponentConnector +{ + internal TextBlock TitleBox; + + internal ComboBox TipoVendedorBox; + + internal ComboBox VendedorBox; + + internal ComboBox TipoVendedorVinculoBox; + + internal ComboBox RepasseVinculoBox; + + private bool _contentLoaded; + + private DialogVinculoViewModel ViewModel { get; } + + public DialogVinculo(VinculoRepasse vinculo, List repasses, Repasse repasse) + { + ViewModel = new DialogVinculoViewModel(vinculo, repasses, repasse); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialogvinculo.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0020: Unknown result type (might be due to invalid IL or missing references) + //IL_002a: Expected O, but got Unknown + //IL_002d: Unknown result type (might be due to invalid IL or missing references) + //IL_0037: Expected O, but got Unknown + //IL_003a: Unknown result type (might be due to invalid IL or missing references) + //IL_0044: Expected O, but got Unknown + //IL_0047: Unknown result type (might be due to invalid IL or missing references) + //IL_0051: Expected O, but got Unknown + //IL_0054: Unknown result type (might be due to invalid IL or missing references) + //IL_005e: Expected O, but got Unknown + switch (connectionId) + { + case 1: + TitleBox = (TextBlock)target; + break; + case 2: + TipoVendedorBox = (ComboBox)target; + break; + case 3: + VendedorBox = (ComboBox)target; + break; + case 4: + TipoVendedorVinculoBox = (ComboBox)target; + break; + case 5: + RepasseVinculoBox = (ComboBox)target; + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/ErrorDialog.cs b/Decompiler/Gestor.Application.Componentes/ErrorDialog.cs new file mode 100644 index 0000000..44875f5 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/ErrorDialog.cs @@ -0,0 +1,39 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Markup; +using Gestor.Application.Views.Generic; + +namespace Gestor.Application.Componentes; + +public class ErrorDialog : BaseUserControl, IComponentConnector +{ + private bool _contentLoaded; + + public ErrorDialog() + { + InitializeComponent(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/errordialog.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + _contentLoaded = true; + } +} diff --git a/Decompiler/Gestor.Application.Componentes/GridRelatorio.cs b/Decompiler/Gestor.Application.Componentes/GridRelatorio.cs new file mode 100644 index 0000000..9a107ae --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/GridRelatorio.cs @@ -0,0 +1,607 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Data; +using System.Windows.Markup; +using Gestor.Application.Drawers; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.ViewModels.Generic; +using Gestor.Application.ViewModels.Relatorios; +using Gestor.Application.Views.Generic; +using Gestor.Application.Views.Seguros; +using Gestor.Application.Views.Seguros.Itens; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Relatorios.ApolicePendente; +using Gestor.Model.Domain.Relatorios.Log; +using Gestor.Model.Domain.Relatorios.LogsEnvio; +using Gestor.Model.Domain.Relatorios.Sinistro; +using Gestor.Model.Domain.Relatorios.Tarefa; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Componentes; + +public class GridRelatorio : UserControl, IComponentConnector, IStyleConnector +{ + internal Grid LayoutRoot; + + internal DataGrid DataGrid; + + internal DataGridTemplateColumn InfoButton; + + internal DataGridTemplateColumn ArquivoButton; + + internal DataGridTemplateColumn VinculoButton; + + internal DataGridTemplateColumn CalculoButton; + + internal DataGridTemplateColumn AssinaturaButton; + + internal Expander Totalizacao; + + internal ItemsControl SinteticoGrid; + + private bool _contentLoaded; + + private RelatorioViewModel ViewModel { get; } + + private int _index { get; set; } = -1; + + + private ListSortDirection _sortDirection { get; set; } + + public GridRelatorio(RelatorioViewModel viewModel) + { + ViewModel = viewModel; + ((FrameworkElement)this).DataContext = ViewModel; + ViewModel.Totalizacao = true; + InitializeComponent(); + ((FrameworkElement)LayoutRoot).DataContext = this; + TipoRelatorio(); + } + + private void TipoRelatorio() + { + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Invalid comparison between Unknown and I4 + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_002f: Invalid comparison between Unknown and I4 + //IL_0046: Unknown result type (might be due to invalid IL or missing references) + //IL_004c: Invalid comparison between Unknown and I4 + //IL_005d: Unknown result type (might be due to invalid IL or missing references) + //IL_010f: Unknown result type (might be due to invalid IL or missing references) + //IL_0114: Unknown result type (might be due to invalid IL or missing references) + //IL_0115: Unknown result type (might be due to invalid IL or missing references) + //IL_0118: Invalid comparison between Unknown and I4 + //IL_0127: Unknown result type (might be due to invalid IL or missing references) + //IL_012a: Unknown result type (might be due to invalid IL or missing references) + //IL_012c: Invalid comparison between Unknown and I4 + //IL_011a: Unknown result type (might be due to invalid IL or missing references) + //IL_011c: Invalid comparison between Unknown and I4 + //IL_012e: Unknown result type (might be due to invalid IL or missing references) + //IL_0131: Invalid comparison between Unknown and I4 + //IL_011e: Unknown result type (might be due to invalid IL or missing references) + //IL_0121: Unknown result type (might be due to invalid IL or missing references) + //IL_0123: Invalid comparison between Unknown and I4 + ((DataGridColumn)AssinaturaButton).Visibility = (Visibility)(((int)ViewModel.Relatorio != 2) ? 2 : 0); + ((DataGridColumn)VinculoButton).Visibility = (Visibility)(((int)ViewModel.Relatorio != 3) ? 2 : 0); + ((DataGridColumn)CalculoButton).Visibility = (Visibility)(((int)ViewModel.Relatorio != 4) ? 2 : 0); + string tipo = ValidationHelper.GetTipo((Enum)(object)ViewModel.Relatorio); + switch (tipo) + { + case "FECHAMENTO": + case "NOTA FISCAL": + ((DataGridColumn)InfoButton).Visibility = (Visibility)2; + ((DataGridColumn)ArquivoButton).Visibility = (Visibility)2; + break; + case "TAREFA": + ((DataGridColumn)InfoButton).Visibility = (Visibility)0; + ((DataGridColumn)ArquivoButton).Visibility = (Visibility)2; + break; + case "EXTRATO": + ((DataGridColumn)InfoButton).Visibility = (Visibility)2; + ((DataGridColumn)ArquivoButton).Visibility = (Visibility)0; + break; + default: + ((DataGridColumn)InfoButton).Visibility = (Visibility)0; + ((DataGridColumn)ArquivoButton).Visibility = (Visibility)0; + break; + } + Relatorio relatorio = ViewModel.Relatorio; + if ((int)relatorio <= 15) + { + if ((int)relatorio != 8) + { + if (relatorio - 14 <= 1) + { + goto IL_014f; + } + } + else + { + ((DataGridColumn)InfoButton).Visibility = (Visibility)0; + ((DataGridColumn)ArquivoButton).Visibility = (Visibility)0; + } + } + else if (relatorio - 24 > 1) + { + if ((int)relatorio == 26) + { + goto IL_014f; + } + } + else + { + ((DataGridColumn)InfoButton).Visibility = (Visibility)0; + ((DataGridColumn)ArquivoButton).Visibility = (Visibility)2; + } + goto IL_0181; + IL_0181: + ((UIElement)Totalizacao).Visibility = (Visibility)((!ViewModel.Totais) ? 2 : 0); + if (string.IsNullOrWhiteSpace(tipo)) + { + ((DataGridColumn)InfoButton).Visibility = (Visibility)2; + ((DataGridColumn)ArquivoButton).Visibility = (Visibility)2; + } + return; + IL_014f: + ((DataGridColumn)InfoButton).Visibility = (Visibility)2; + ((DataGridColumn)ArquivoButton).Visibility = (Visibility)2; + goto IL_0181; + } + + private async void ArquivoDigital_OnClick(object sender, RoutedEventArgs e) + { + Button val = (Button)sender; + object dataContext = ((FrameworkElement)val).DataContext; + FiltroArquivoDigital val2 = null; + switch (ValidationHelper.GetTipo((Enum)(object)ViewModel.Relatorio)) + { + case "CLIENTE": + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)1).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)1) + "."); + return; + } + if ((int)ViewModel.Relatorio == 17) + { + Item item = dataContext.GetValueFromType(); + Documento valueFromType3 = ((FrameworkElement)val).DataContext.GetValueFromType(); + if (item == null) + { + return; + } + item.Documento = await new ApoliceServico().BuscarApoliceAsync(((DomainBase)valueFromType3).Id); + val2 = new FiltroArquivoDigital + { + Id = ((DomainBase)item).Id, + Tipo = (TipoArquivoDigital)4, + Parente = item + }; + } + else + { + Cliente valueFromType4 = dataContext.GetValueFromType(); + if (valueFromType4 == null) + { + return; + } + val2 = new FiltroArquivoDigital + { + Id = ((DomainBase)valueFromType4).Id, + Tipo = (TipoArquivoDigital)1, + Parente = valueFromType4 + }; + } + break; + case "FECHAMENTO": + case "DOCUMENTO": + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)2).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)2) + "."); + return; + } + Documento valueFromType5 = dataContext.GetValueFromType(); + if (valueFromType5 == null) + { + return; + } + val2 = new FiltroArquivoDigital + { + Id = ((DomainBase)valueFromType5).Id, + Tipo = (TipoArquivoDigital)2, + Parente = valueFromType5 + }; + break; + } + case "PARCELA": + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)3).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)3) + "."); + return; + } + Parcela valueFromType2 = dataContext.GetValueFromType(); + if (valueFromType2 == null) + { + return; + } + val2 = new FiltroArquivoDigital + { + Id = ((DomainBase)valueFromType2).Id, + IdApolice = ((DomainBase)valueFromType2.Documento).Id, + Tipo = (TipoArquivoDigital)3, + Parente = valueFromType2 + }; + break; + } + case "SINISTRO": + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)5).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)5) + "."); + return; + } + Sinistro valueFromType6 = dataContext.GetValueFromType(); + if (valueFromType6 == null) + { + return; + } + val2 = new FiltroArquivoDigital + { + Id = ((DomainBase)valueFromType6).Id, + IdApolice = ((DomainBase)valueFromType6.ControleSinistro.Item.Documento).Id, + Tipo = (TipoArquivoDigital)5, + Parente = valueFromType6 + }; + break; + } + case "EXTRATO": + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)7).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)7) + "."); + return; + } + Extrato valueFromType = dataContext.GetValueFromType(); + if (valueFromType == null) + { + return; + } + val2 = new FiltroArquivoDigital + { + Id = ((DomainBase)valueFromType).Id, + Tipo = (TipoArquivoDigital)7, + Parente = valueFromType + }; + break; + } + } + if (val2 == null) + { + await ViewModel.ShowMessage("ESSE TIPO DE RELATÓRIO NÃO POSSUI ARQUIVO DIGITAL"); + } + else + { + new BaseSegurosViewModel().ShowDrawer(new ArquivoDigitalDrawer(val2), 0, close: false); + } + } + + private async void CheckBox_Checked(object sender, RoutedEventArgs e) + { + ViewModel.Carregando = true; + ViewModel.IsEnabled = false; + await ViewModel.Selecionar(); + ViewModel.IsEnabled = true; + ViewModel.Carregando = false; + } + + private async void MaisInformacoes_OnClick(object sender, RoutedEventArgs e) + { + Button val = (Button)sender; + if (((FrameworkElement)val).DataContext == null) + { + return; + } + string tipo = ValidationHelper.GetTipo((Enum)(object)ViewModel.Relatorio); + if ((int)ViewModel.Relatorio == 17) + { + Item valueFromType = ((FrameworkElement)val).DataContext.GetValueFromType(); + Documento valueFromType2 = ((FrameworkElement)val).DataContext.GetValueFromType(); + if (valueFromType != null) + { + valueFromType.Documento = valueFromType2; + ((Window)new HosterWindow((ContentControl)(object)new AutoView(null, lockInsert: true, substituir: false, null, valueFromType, valueFromType2.Controle.Ramo), "CADASTRO DE ITENS DO CLIENTE - " + valueFromType2.Controle.Cliente.Nome)).ShowDialog(); + } + } + else if ((int)ViewModel.Relatorio == 4 && ((FrameworkElement)val).DataContext.GetValueFromType() != null) + { + TipoDocumento valueFromType3 = ((FrameworkElement)val).DataContext.GetValueFromType(); + if (((object)(TipoDocumento)(ref valueFromType3)).ToString() == "PROSPECÇÃO") + { + return; + } + Prospeccao val2 = await ViewModel.ShowProspeccaoDialog(((FrameworkElement)val).DataContext.GetValueFromType()); + if (val2 != null) + { + List> list = await ViewModel.SalvarProspeccao(val2); + if (list != null && list.Count >= 1) + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + } + } + else + { + if (tipo == null) + { + return; + } + Documento valueFromType4; + switch (tipo.Length) + { + case 7: + switch (tipo[0]) + { + case 'C': + if (tipo == "CLIENTE") + { + Cliente valueFromType7 = ((FrameworkElement)val).DataContext.GetValueFromType(); + if (valueFromType7 != null) + { + valueFromType7 = await new ClienteServico().BuscarClienteAsync(((DomainBase)valueFromType7).Id); + ((Window)new HosterWindow((ContentControl)(object)new ClienteView(valueFromType7, lockInsert: true), "CADASTRO DE CLIENTES - " + valueFromType7.Nome)).ShowDialog(); + } + } + break; + case 'P': + { + if (!(tipo == "PARCELA")) + { + break; + } + Documento valueFromType5 = ((FrameworkElement)val).DataContext.GetValueFromType(); + if (valueFromType5 != null) + { + Parcela valueFromType6 = ((FrameworkElement)val).DataContext.GetValueFromType(); + if (valueFromType6 != null) + { + ((Window)new HosterWindow((ContentControl)(object)new ApoliceView(valueFromType5, lockInsert: true, invoke: false, (AcessoApolice)1, ((DomainBase)valueFromType6).Id), "CADASTRO DE APÓLICES - " + valueFromType5.Controle.Cliente.Nome)).Show(); + } + } + break; + } + } + break; + case 10: + if (!(tipo == "FECHAMENTO")) + { + break; + } + goto IL_0453; + case 9: + if (!(tipo == "DOCUMENTO")) + { + break; + } + goto IL_0453; + case 8: + if (tipo == "SINISTRO") + { + Sinistro sinistroInfo = (Sinistro)((FrameworkElement)val).DataContext; + Sinistro valueFromType8 = ((FrameworkElement)val).DataContext.GetValueFromType(); + if (valueFromType8 != null) + { + ((Window)new HosterWindow((ContentControl)(object)new SinistroView((await ViewModel.CarregaSinistroApolice(((DomainBase)valueFromType8).Id)).ControleSinistro.Item, attached: false), "CADASTRO DE SINISTROS - " + sinistroInfo.Nome + " - " + sinistroInfo.Apolice + " " + sinistroInfo.Endosso)).Show(); + } + } + break; + case 6: + if (tipo == "TAREFA") + { + Tarefa val4 = (Tarefa)((FrameworkElement)val).DataContext; + Tarefa tarefa = new Tarefa + { + Id = val4.Id, + IdCliente = val4.IdCliente, + Cliente = val4.Cliente, + IdEntidade = val4.IdEntidade, + Entidade = val4.Entidade, + Conclusao = val4.Conclusao + }; + ViewModel.ShowDrawer(new TarefaDrawer(tarefa, enableMenu: false), 0, close: false); + } + break; + case 4: + { + if (tipo == "LOGS") + { + if (((FrameworkElement)val).DataContext is LogAcaoRelatorio) + { + ViewModel.ShowDrawer(new LogUtilizacaoDrawer(((LogAcaoRelatorio)((FrameworkElement)val).DataContext).RegistroEntity, ViewModel.Relatorio), 0, close: false); + break; + } + LogsEnvio val3 = (LogsEnvio)((FrameworkElement)val).DataContext; + ViewModel.ShowDrawer(new LogEmailDrawer((TipoTela)17, val3.Id, singleMode: true), 0, close: false); + } + break; + } + IL_0453: + valueFromType4 = ((FrameworkElement)val).DataContext.GetValueFromType(); + if (valueFromType4 != null) + { + valueFromType4 = await new ApoliceServico().BuscarApoliceAsync(((DomainBase)valueFromType4).Id); + ((Window)new HosterWindow((ContentControl)(object)new ApoliceView(valueFromType4, lockInsert: true, invoke: false, (AcessoApolice)0, 0L), "CADASTRO DE APÓLICES - " + valueFromType4.Controle.Cliente.Nome)).Show(); + } + break; + } + } + } + + private void Totalizacao_OnCollapsedExpanded(object sender, RoutedEventArgs e) + { + ViewModel.Totalizacao = Totalizacao.IsExpanded; + } + + private async void Vinculo_OnClick(object sender, RoutedEventArgs e) + { + Button val = (Button)sender; + if (((FrameworkElement)val).DataContext != null) + { + ApolicePendente pendencia = (ApolicePendente)((FrameworkElement)val).DataContext; + await ViewModel.RemoverVinculo(pendencia); + } + } + + private void Grid_Sorting(object sender, DataGridSortingEventArgs e) + { + _index = ((DataGridColumnEventArgs)e).Column.DisplayIndex; + _sortDirection = ((((DataGridColumnEventArgs)e).Column.SortDirection == ListSortDirection.Ascending) ? ListSortDirection.Descending : ListSortDirection.Ascending); + } + + public void SortDataGrid() + { + //IL_0048: Unknown result type (might be due to invalid IL or missing references) + DataGridColumn val = DataGrid.Columns[_index]; + ((Collection)(object)((CollectionView)((ItemsControl)DataGrid).Items).SortDescriptions).Clear(); + ((Collection)(object)((CollectionView)((ItemsControl)DataGrid).Items).SortDescriptions).Add(new SortDescription(val.SortMemberPath, _sortDirection)); + foreach (DataGridColumn column in DataGrid.Columns) + { + column.SortDirection = null; + } + val.SortDirection = _sortDirection; + ((CollectionView)((ItemsControl)DataGrid).Items).Refresh(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/gridrelatorio.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0043: Unknown result type (might be due to invalid IL or missing references) + //IL_004d: Expected O, but got Unknown + //IL_0050: Unknown result type (might be due to invalid IL or missing references) + //IL_005a: Expected O, but got Unknown + //IL_0067: Unknown result type (might be due to invalid IL or missing references) + //IL_0071: Expected O, but got Unknown + //IL_0074: Unknown result type (might be due to invalid IL or missing references) + //IL_007e: Expected O, but got Unknown + //IL_0081: Unknown result type (might be due to invalid IL or missing references) + //IL_008b: Expected O, but got Unknown + //IL_008e: Unknown result type (might be due to invalid IL or missing references) + //IL_0098: Expected O, but got Unknown + //IL_009b: Unknown result type (might be due to invalid IL or missing references) + //IL_00a5: Expected O, but got Unknown + //IL_00a8: Unknown result type (might be due to invalid IL or missing references) + //IL_00b2: Expected O, but got Unknown + //IL_00b5: Unknown result type (might be due to invalid IL or missing references) + //IL_00bf: Expected O, but got Unknown + //IL_00cc: Unknown result type (might be due to invalid IL or missing references) + //IL_00d6: Expected O, but got Unknown + //IL_00e3: Unknown result type (might be due to invalid IL or missing references) + //IL_00ed: Expected O, but got Unknown + //IL_00f0: Unknown result type (might be due to invalid IL or missing references) + //IL_00fa: Expected O, but got Unknown + switch (connectionId) + { + case 1: + LayoutRoot = (Grid)target; + break; + case 2: + DataGrid = (DataGrid)target; + DataGrid.Sorting += new DataGridSortingEventHandler(Grid_Sorting); + break; + case 4: + InfoButton = (DataGridTemplateColumn)target; + break; + case 6: + ArquivoButton = (DataGridTemplateColumn)target; + break; + case 8: + VinculoButton = (DataGridTemplateColumn)target; + break; + case 10: + CalculoButton = (DataGridTemplateColumn)target; + break; + case 11: + AssinaturaButton = (DataGridTemplateColumn)target; + break; + case 12: + Totalizacao = (Expander)target; + Totalizacao.Collapsed += new RoutedEventHandler(Totalizacao_OnCollapsedExpanded); + Totalizacao.Expanded += new RoutedEventHandler(Totalizacao_OnCollapsedExpanded); + break; + case 13: + SinteticoGrid = (ItemsControl)target; + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_0026: Unknown result type (might be due to invalid IL or missing references) + //IL_0032: Unknown result type (might be due to invalid IL or missing references) + //IL_003c: Expected O, but got Unknown + //IL_003d: Unknown result type (might be due to invalid IL or missing references) + //IL_0049: Unknown result type (might be due to invalid IL or missing references) + //IL_0053: Expected O, but got Unknown + //IL_0055: Unknown result type (might be due to invalid IL or missing references) + //IL_0061: Unknown result type (might be due to invalid IL or missing references) + //IL_006b: Expected O, but got Unknown + //IL_006d: Unknown result type (might be due to invalid IL or missing references) + //IL_0079: Unknown result type (might be due to invalid IL or missing references) + //IL_0083: Expected O, but got Unknown + //IL_0085: Unknown result type (might be due to invalid IL or missing references) + //IL_0091: Unknown result type (might be due to invalid IL or missing references) + //IL_009b: Expected O, but got Unknown + switch (connectionId) + { + case 3: + ((ToggleButton)(CheckBox)target).Checked += new RoutedEventHandler(CheckBox_Checked); + ((ToggleButton)(CheckBox)target).Unchecked += new RoutedEventHandler(CheckBox_Checked); + break; + case 5: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(MaisInformacoes_OnClick); + break; + case 7: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ArquivoDigital_OnClick); + break; + case 9: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Vinculo_OnClick); + break; + case 4: + case 6: + case 8: + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/Loading.cs b/Decompiler/Gestor.Application.Componentes/Loading.cs new file mode 100644 index 0000000..eed4f86 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/Loading.cs @@ -0,0 +1,39 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; + +namespace Gestor.Application.Componentes; + +public class Loading : UserControl, IComponentConnector +{ + private bool _contentLoaded; + + public Loading() + { + InitializeComponent(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/loading.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + _contentLoaded = true; + } +} diff --git a/Decompiler/Gestor.Application.Componentes/NRecoHtmlToPdfConverter.cs b/Decompiler/Gestor.Application.Componentes/NRecoHtmlToPdfConverter.cs new file mode 100644 index 0000000..6c4e8a3 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/NRecoHtmlToPdfConverter.cs @@ -0,0 +1,11 @@ +using NReco.PdfGenerator; + +namespace Gestor.Application.Componentes; + +public class NRecoHtmlToPdfConverter : HtmlToPdfConverter +{ + public NRecoHtmlToPdfConverter() + { + ((HtmlToPdfConverter)this).License.SetLicenseKey("PDF_Generator_Src_Examples_Pack_255474111334", "UN0G/w7zqQQlt19OtYHW14aK3o8N3sZ5gRq2SELQQjGKYV3luQETgIdsDxPl8e9ZYkRKlglzhNvxi7abVpvWeNYrTp45eL2lRgSIhMhV9Atpy1C12yBt/zG7141kzYD7hT9dmayX5d98MB0DPPlFL3A8b15f6w1qZ9ZVqBFE0w0="); + } +} diff --git a/Decompiler/Gestor.Application.Componentes/PassBox.cs b/Decompiler/Gestor.Application.Componentes/PassBox.cs new file mode 100644 index 0000000..7c25773 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/PassBox.cs @@ -0,0 +1,208 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using System.Windows.Markup; +using Gestor.Common.Validation; + +namespace Gestor.Application.Componentes; + +public class PassBox : UserControl, IComponentConnector +{ + public static readonly DependencyProperty ValueProperty = DependencyProperty.Register("Value", typeof(string), typeof(PassBox), (PropertyMetadata)new FrameworkPropertyMetadata((object)null, (FrameworkPropertyMetadataOptions)256)); + + public static readonly DependencyProperty HintProperty = DependencyProperty.Register("Hint", typeof(string), typeof(PassBox), (PropertyMetadata)new FrameworkPropertyMetadata((object)"SENHA", (FrameworkPropertyMetadataOptions)256)); + + public static readonly DependencyProperty PasswordWidthProperty = DependencyProperty.Register("PasswordWidth", typeof(string), typeof(PassBox), new PropertyMetadata((object)null, new PropertyChangedCallback(OnBoundWidthChanged))); + + private bool _hidePasswordView; + + internal Grid LayoutRoot; + + internal Button ShowHidePassword; + + internal PasswordBox TextPassword; + + internal TextBox TextPasswordVisible; + + private bool _contentLoaded; + + public bool Visible { get; set; } + + public string Value + { + get + { + return (string)((DependencyObject)this).GetValue(ValueProperty); + } + set + { + ((DependencyObject)this).SetValue(ValueProperty, (object)value); + } + } + + public string Hint + { + get + { + return (string)((DependencyObject)this).GetValue(HintProperty); + } + set + { + ((DependencyObject)this).SetValue(HintProperty, (object)value); + } + } + + public string PasswordWidth + { + get + { + return (string)((DependencyObject)this).GetValue(PasswordWidthProperty); + } + set + { + ((DependencyObject)this).SetValue(PasswordWidthProperty, (object)value); + } + } + + public bool HidePasswordView + { + get + { + return _hidePasswordView; + } + set + { + if (value) + { + HidePassword(); + } + } + } + + private static void OnBoundWidthChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + PassBox passBox = d as PassBox; + if (d != null && passBox != null) + { + string text = (string)((DependencyPropertyChangedEventArgs)(ref e)).NewValue; + if (ValidationHelper.ValidateDouble(text)) + { + ((FrameworkElement)passBox.TextPassword).MinWidth = double.Parse(text); + ((FrameworkElement)passBox.TextPasswordVisible).MinWidth = double.Parse(text); + } + } + } + + public PassBox() + { + InitializeComponent(); + ((FrameworkElement)LayoutRoot).DataContext = this; + } + + public void ShowPassword() + { + ((UIElement)TextPasswordVisible).Visibility = (Visibility)0; + ((UIElement)TextPassword).Visibility = (Visibility)1; + ((UIElement)TextPasswordVisible).Focus(); + Visible = true; + } + + public void HidePassword() + { + ((UIElement)TextPasswordVisible).Visibility = (Visibility)1; + ((UIElement)TextPassword).Visibility = (Visibility)0; + ((UIElement)TextPassword).Focus(); + Visible = false; + } + + private void TextPassword_PasswordChanged(object sender, RoutedEventArgs e) + { + } + + private void ShowHidePassword_OnClick(object sender, RoutedEventArgs e) + { + if (Visible) + { + HidePassword(); + } + else + { + ShowPassword(); + } + } + + private void ShowHidePassword_OnMouseDown(object sender, MouseButtonEventArgs e) + { + ShowPassword(); + } + + private void ShowHidePassword_OnMouseUp(object sender, MouseButtonEventArgs e) + { + HidePassword(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/passbox.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0026: Expected O, but got Unknown + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_0033: Expected O, but got Unknown + //IL_0040: Unknown result type (might be due to invalid IL or missing references) + //IL_004a: Expected O, but got Unknown + //IL_0057: Unknown result type (might be due to invalid IL or missing references) + //IL_0061: Expected O, but got Unknown + //IL_0064: Unknown result type (might be due to invalid IL or missing references) + //IL_006e: Expected O, but got Unknown + //IL_007b: Unknown result type (might be due to invalid IL or missing references) + //IL_0085: Expected O, but got Unknown + //IL_0088: Unknown result type (might be due to invalid IL or missing references) + //IL_0092: Expected O, but got Unknown + switch (connectionId) + { + case 1: + LayoutRoot = (Grid)target; + break; + case 2: + ShowHidePassword = (Button)target; + ((UIElement)ShowHidePassword).PreviewMouseDown += new MouseButtonEventHandler(ShowHidePassword_OnMouseDown); + ((UIElement)ShowHidePassword).PreviewMouseUp += new MouseButtonEventHandler(ShowHidePassword_OnMouseUp); + break; + case 3: + TextPassword = (PasswordBox)target; + TextPassword.PasswordChanged += new RoutedEventHandler(TextPassword_PasswordChanged); + break; + case 4: + TextPasswordVisible = (TextBox)target; + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/ProgressDialog.cs b/Decompiler/Gestor.Application.Componentes/ProgressDialog.cs new file mode 100644 index 0000000..14474a7 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/ProgressDialog.cs @@ -0,0 +1,39 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Markup; +using Gestor.Application.Views.Generic; + +namespace Gestor.Application.Componentes; + +public class ProgressDialog : BaseUserControl, IComponentConnector +{ + private bool _contentLoaded; + + public ProgressDialog() + { + InitializeComponent(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/progressdialog.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + _contentLoaded = true; + } +} diff --git a/Decompiler/Gestor.Application.Componentes/ProspeccaoDialog.cs b/Decompiler/Gestor.Application.Componentes/ProspeccaoDialog.cs new file mode 100644 index 0000000..e74440f --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/ProspeccaoDialog.cs @@ -0,0 +1,334 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Input; +using System.Windows.Markup; +using Gestor.Application.ViewModels.Generic; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using MaterialDesignThemes.Wpf; +using Xceed.Wpf.AvalonDock.Controls; + +namespace Gestor.Application.Componentes; + +public class ProspeccaoDialog : BaseUserControl, IComponentConnector, IStyleConnector +{ + public DialogProspeccaoViewModel ViewModel; + + internal TextBox DocumentoBox; + + internal DatePicker NascimentoBox; + + internal TextBox Prefixo1Box; + + internal TextBox Telefone1Box; + + internal TextBox Prefixo2Box; + + internal TextBox Telefone2Box; + + internal TextBox EmailBox; + + internal MenuItem SalvarButton; + + private bool _contentLoaded; + + public ProspeccaoDialog(Prospeccao prospeccao) + { + ViewModel = new DialogProspeccaoViewModel(prospeccao); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + private void DocumentoBox_OnLostFocus(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + TextBox val = (TextBox)sender; + val.Text = ValidationHelper.FormatDocument(val.Text); + } + + private void AutoCompleteBox_Populating(object sender, PopulatingEventArgs e) + { + if (e.Parameter.Trim().Length < 3) + { + return; + } + e.Cancel = true; + ViewModel.BuscarCliente(ValidationHelper.RemoveDiacritics(e.Parameter.Trim()), null, (TipoFiltroCliente)2).ContinueWith(delegate(Task> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private async void AutoCompleteBox_LostFocus(object sender, RoutedEventArgs e) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + if (val.SelectedItem == null) + { + return; + } + Cliente val2 = await ViewModel.BuscarInfoCliente((Cliente)val.SelectedItem); + DocumentoBox.Text = val2.Documento; + NascimentoBox.SelectedDate = val2.Nascimento; + ObservableCollection telefones = val2.Telefones; + ClienteTelefone val3 = ((telefones != null && telefones.Count > 0) ? val2.Telefones[0] : null); + if (val3 != null && ((TelefoneBase)val3).Prefixo != null) + { + Prefixo1Box.Text = ((val3 != null) ? ((TelefoneBase)val3).Prefixo : null); + } + if (val3 != null && ((TelefoneBase)val3).Numero != null) + { + Telefone1Box.Text = ((val3 != null) ? ((TelefoneBase)val3).Numero : null); + } + ObservableCollection telefones2 = val2.Telefones; + ClienteTelefone val4 = ((telefones2 != null && telefones2.Count > 1) ? val2.Telefones[1] : null); + if (val4 != null && ((TelefoneBase)val4).Prefixo != null) + { + Prefixo2Box.Text = ((val4 != null) ? ((TelefoneBase)val4).Prefixo : null); + } + if (val4 != null && ((TelefoneBase)val4).Numero != null) + { + Telefone2Box.Text = ((val4 != null) ? ((TelefoneBase)val4).Numero : null); + } + ObservableCollection emails = val2.Emails; + object obj; + if (emails == null) + { + obj = null; + } + else + { + ClienteEmail? obj2 = emails.FirstOrDefault(); + obj = ((obj2 != null) ? ((EmailBase)obj2).Email : null); + } + if (obj != null) + { + TextBox emailBox = EmailBox; + ObservableCollection emails2 = val2.Emails; + object text; + if (emails2 == null) + { + text = null; + } + else + { + ClienteEmail? obj3 = emails2.FirstOrDefault(); + text = ((obj3 != null) ? ((EmailBase)obj3).Email : null); + } + emailBox.Text = (string)text; + } + } + + private void DeleteArquivo_OnDeleteClick(object sender, RoutedEventArgs e) + { + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_0034: Expected O, but got Unknown + Chip val = (Chip)((sender is Chip) ? sender : null); + if (val != null) + { + ListBox val2 = Extentions.FindVisualAncestor((DependencyObject)(object)val); + ArquivoDigital val3 = (ArquivoDigital)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)]; + if (val3 != null) + { + ViewModel.Delete(val3); + } + } + } + + private void AnexarArquivos_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Anexar(); + } + + private void SalvarButton_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.SelectedProspeccao.Anexos = ViewModel.ArquivosAnexados?.ToList(); + DialogHost.CloseDialogCommand.Execute((object)ViewModel.SelectedProspeccao, (IInputElement)(object)SalvarButton); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/prospeccaodialog.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0042: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_0058: Expected O, but got Unknown + //IL_0059: Unknown result type (might be due to invalid IL or missing references) + //IL_0065: Unknown result type (might be due to invalid IL or missing references) + //IL_006f: Expected O, but got Unknown + //IL_0072: Unknown result type (might be due to invalid IL or missing references) + //IL_007c: Expected O, but got Unknown + //IL_008a: Unknown result type (might be due to invalid IL or missing references) + //IL_0094: Expected O, but got Unknown + //IL_00a1: Unknown result type (might be due to invalid IL or missing references) + //IL_00ab: Expected O, but got Unknown + //IL_00ae: Unknown result type (might be due to invalid IL or missing references) + //IL_00b8: Expected O, but got Unknown + //IL_00c5: Unknown result type (might be due to invalid IL or missing references) + //IL_00cf: Expected O, but got Unknown + //IL_00dc: Unknown result type (might be due to invalid IL or missing references) + //IL_00e6: Expected O, but got Unknown + //IL_00f3: Unknown result type (might be due to invalid IL or missing references) + //IL_00fd: Expected O, but got Unknown + //IL_0100: Unknown result type (might be due to invalid IL or missing references) + //IL_010a: Expected O, but got Unknown + //IL_0118: Unknown result type (might be due to invalid IL or missing references) + //IL_0122: Expected O, but got Unknown + //IL_0125: Unknown result type (might be due to invalid IL or missing references) + //IL_012f: Expected O, but got Unknown + //IL_013d: Unknown result type (might be due to invalid IL or missing references) + //IL_0147: Expected O, but got Unknown + //IL_0155: Unknown result type (might be due to invalid IL or missing references) + //IL_015f: Expected O, but got Unknown + //IL_0162: Unknown result type (might be due to invalid IL or missing references) + //IL_016c: Expected O, but got Unknown + //IL_017a: Unknown result type (might be due to invalid IL or missing references) + //IL_0184: Expected O, but got Unknown + //IL_0187: Unknown result type (might be due to invalid IL or missing references) + //IL_0191: Expected O, but got Unknown + //IL_019f: Unknown result type (might be due to invalid IL or missing references) + //IL_01a9: Expected O, but got Unknown + //IL_01b7: Unknown result type (might be due to invalid IL or missing references) + //IL_01c1: Expected O, but got Unknown + //IL_01c4: Unknown result type (might be due to invalid IL or missing references) + //IL_01ce: Expected O, but got Unknown + //IL_01d0: Unknown result type (might be due to invalid IL or missing references) + //IL_01dc: Unknown result type (might be due to invalid IL or missing references) + //IL_01e6: Expected O, but got Unknown + //IL_01e7: Unknown result type (might be due to invalid IL or missing references) + //IL_01f3: Unknown result type (might be due to invalid IL or missing references) + //IL_01fd: Expected O, but got Unknown + //IL_01fe: Unknown result type (might be due to invalid IL or missing references) + //IL_020a: Unknown result type (might be due to invalid IL or missing references) + //IL_0214: Expected O, but got Unknown + //IL_0216: Unknown result type (might be due to invalid IL or missing references) + //IL_0222: Unknown result type (might be due to invalid IL or missing references) + //IL_022c: Expected O, but got Unknown + //IL_022d: Unknown result type (might be due to invalid IL or missing references) + //IL_0239: Unknown result type (might be due to invalid IL or missing references) + //IL_0243: Expected O, but got Unknown + //IL_0244: Unknown result type (might be due to invalid IL or missing references) + //IL_0250: Unknown result type (might be due to invalid IL or missing references) + //IL_025a: Expected O, but got Unknown + //IL_025c: Unknown result type (might be due to invalid IL or missing references) + //IL_0268: Unknown result type (might be due to invalid IL or missing references) + //IL_0272: Expected O, but got Unknown + //IL_0275: Unknown result type (might be due to invalid IL or missing references) + //IL_027f: Expected O, but got Unknown + //IL_028c: Unknown result type (might be due to invalid IL or missing references) + //IL_0296: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBox_Populating); + ((UIElement)(AutoCompleteBox)target).LostFocus += new RoutedEventHandler(AutoCompleteBox_LostFocus); + break; + case 2: + DocumentoBox = (TextBox)target; + ((UIElement)DocumentoBox).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + ((UIElement)DocumentoBox).LostFocus += new RoutedEventHandler(DocumentoBox_OnLostFocus); + break; + case 3: + NascimentoBox = (DatePicker)target; + ((UIElement)NascimentoBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((Control)NascimentoBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + ((UIElement)NascimentoBox).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + break; + case 4: + Prefixo1Box = (TextBox)target; + ((UIElement)Prefixo1Box).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 5: + Telefone1Box = (TextBox)target; + ((UIElement)Telefone1Box).LostFocus += new RoutedEventHandler(FormatarTelefone); + ((UIElement)Telefone1Box).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 6: + Prefixo2Box = (TextBox)target; + ((UIElement)Prefixo2Box).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 7: + Telefone2Box = (TextBox)target; + ((UIElement)Telefone2Box).LostFocus += new RoutedEventHandler(FormatarTelefone); + ((UIElement)Telefone2Box).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 8: + EmailBox = (TextBox)target; + break; + case 9: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + break; + case 10: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + break; + case 12: + ((MenuItem)target).Click += new RoutedEventHandler(AnexarArquivos_OnClick); + break; + case 13: + SalvarButton = (MenuItem)target; + SalvarButton.Click += new RoutedEventHandler(SalvarButton_OnClick); + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Unknown result type (might be due to invalid IL or missing references) + //IL_001c: Expected O, but got Unknown + if (connectionId == 11) + { + ((Chip)target).DeleteClick += new RoutedEventHandler(DeleteArquivo_OnDeleteClick); + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/VincularLancamentoDialog.cs b/Decompiler/Gestor.Application.Componentes/VincularLancamentoDialog.cs new file mode 100644 index 0000000..498557e --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/VincularLancamentoDialog.cs @@ -0,0 +1,84 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Markup; +using Gestor.Application.ViewModels.Financeiro; +using MaterialDesignThemes.Wpf; + +namespace Gestor.Application.Componentes; + +public class VincularLancamentoDialog : UserControl, IComponentConnector, IStyleConnector +{ + internal DataGrid LancamentoGrid; + + internal Button CancelarButton; + + private bool _contentLoaded; + + public FinanceiroViewModel ViewModel { get; set; } + + public VincularLancamentoDialog(FinanceiroViewModel viewModel) + { + ViewModel = viewModel; + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + private void Button_Click(object sender, RoutedEventArgs e) + { + DialogHost.CloseDialogCommand.Execute((object)ViewModel.LancamentoVinculo, (IInputElement)(object)CancelarButton); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/vincularlancamentodialog.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_0016: Expected O, but got Unknown + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_0023: Expected O, but got Unknown + switch (connectionId) + { + case 1: + LancamentoGrid = (DataGrid)target; + break; + case 3: + CancelarButton = (Button)target; + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Expected O, but got Unknown + if (connectionId == 2) + { + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Button_Click); + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/WebBrowser.cs b/Decompiler/Gestor.Application.Componentes/WebBrowser.cs new file mode 100644 index 0000000..57a468f --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/WebBrowser.cs @@ -0,0 +1,199 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Net; +using System.Reflection; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using System.Windows.Interop; +using System.Windows.Markup; +using System.Windows.Navigation; +using System.Windows.Threading; +using Gestor.Application.Properties; +using HtmlAgilityPack; +using mshtml; + +namespace Gestor.Application.Componentes; + +public class WebBrowser : UserControl, IComponentConnector +{ + public HTMLDocument HtmlDocument; + + public WebBrowser Browser; + + public static readonly DependencyProperty IsReadOnlyProperty = DependencyProperty.Register("IsReadOnly", typeof(bool), typeof(WebBrowser), new PropertyMetadata((object)false)); + + internal Grid GridWebBrowser; + + private bool _contentLoaded; + + public bool IsReadOnly + { + get + { + return (bool)((DependencyObject)this).GetValue(IsReadOnlyProperty); + } + set + { + ((DependencyObject)this).SetValue(IsReadOnlyProperty, (object)value); + } + } + + public WebBrowser() + { + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + } + + private void ContentLoad() + { + //IL_0008: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Expected O, but got Unknown + ((UIElement)this).PreviewKeyDown += new KeyEventHandler(Browser_PreviewKeyDown); + } + + private void Browser_PreviewKeyDown(object sender, KeyEventArgs e) + { + if (IsReadOnly) + { + ((RoutedEventArgs)e).Handled = true; + } + } + + public void InstanciateNew(string htmlData = null) + { + //IL_0015: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Expected O, but got Unknown + //IL_0052: Unknown result type (might be due to invalid IL or missing references) + //IL_0057: Unknown result type (might be due to invalid IL or missing references) + //IL_0063: Expected O, but got Unknown + //IL_0070: Unknown result type (might be due to invalid IL or missing references) + //IL_007a: Expected O, but got Unknown + if (Browser != null) + { + Browser.LoadCompleted -= new LoadCompletedEventHandler(Completed); + ((HwndHost)Browser).Dispose(); + ((Panel)GridWebBrowser).Children.Remove((UIElement)(object)Browser); + } + HtmlDocument?.clear(); + Browser = new WebBrowser + { + IsEnabled = true + }; + Browser.LoadCompleted += new LoadCompletedEventHandler(Completed); + ((Panel)GridWebBrowser).Children.Add((UIElement)(object)Browser); + HideScriptErrors(); + htmlData = HtmlEncode(htmlData); + Browser.NavigateToString(string.IsNullOrEmpty(htmlData) ? Resources.New : htmlData); + HtmlDocument = Browser.Document as HTMLDocument; + if (HtmlDocument != null) + { + HtmlDocument.charset = "ISO-8859-1"; + HtmlDocument.designMode = "On"; + } + } + + public static string HtmlEncode(string html) + { + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_000a: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Unknown result type (might be due to invalid IL or missing references) + //IL_0018: Unknown result type (might be due to invalid IL or missing references) + if (html == null) + { + return null; + } + HtmlDocument val = new HtmlDocument(); + val.LoadHtml(html); + val.OptionWriteEmptyNodes = true; + EncodeNode(val.DocumentNode); + return val.DocumentNode.InnerHtml; + } + + private static void EncodeNode(HtmlNode node) + { + //IL_0054: Unknown result type (might be due to invalid IL or missing references) + //IL_005a: Invalid comparison between Unknown and I4 + //IL_001e: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Invalid comparison between Unknown and I4 + if (node.HasChildNodes) + { + foreach (HtmlNode item in (IEnumerable)node.ChildNodes) + { + if ((int)item.NodeType == 3) + { + item.InnerHtml = WebUtility.HtmlEncode(item.InnerHtml); + } + else + { + EncodeNode(item); + } + } + return; + } + if ((int)node.NodeType == 3) + { + node.InnerHtml = WebUtility.HtmlEncode(node.InnerHtml); + } + } + + private void HideScriptErrors() + { + FieldInfo field = typeof(WebBrowser).GetField("_axIWebBrowser2", BindingFlags.Instance | BindingFlags.NonPublic); + if (!(field == null)) + { + object value = field.GetValue(Browser); + value?.GetType().InvokeMember("Silent", BindingFlags.SetProperty, null, value, new object[1] { true }); + } + } + + private void Completed(object sender, NavigationEventArgs e) + { + HtmlDocument = Browser.Document as HTMLDocument; + if (HtmlDocument != null) + { + HtmlDocument.designMode = "On"; + } + } + + public void ReadOnly(bool isReadOnly) + { + IsReadOnly = isReadOnly; + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/webbrowser.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_0010: Expected O, but got Unknown + if (connectionId == 1) + { + GridWebBrowser = (Grid)target; + } + else + { + _contentLoaded = true; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/WebEditor.cs b/Decompiler/Gestor.Application.Componentes/WebEditor.cs new file mode 100644 index 0000000..1957f8e --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/WebEditor.cs @@ -0,0 +1,633 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.IO; +using System.Net; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Forms; +using System.Windows.Markup; +using System.Windows.Media; +using HtmlAgilityPack; +using Microsoft.Win32; +using mshtml; + +namespace Gestor.Application.Componentes; + +public class WebEditor : UserControl, IComponentConnector +{ + private ColorDialog ColorDialog; + + public static readonly DependencyProperty ImageVisibilityProperty = DependencyProperty.Register("ImageVisibility", typeof(Visibility), typeof(WebEditor), (PropertyMetadata)new FrameworkPropertyMetadata((object)(Visibility)2, (FrameworkPropertyMetadataOptions)256)); + + public static readonly DependencyProperty BarVisibilityProperty = DependencyProperty.Register("BarVisibility", typeof(Visibility), typeof(WebEditor), (PropertyMetadata)new FrameworkPropertyMetadata((object)(Visibility)0, (FrameworkPropertyMetadataOptions)256)); + + public static readonly DependencyProperty BodyProperty = DependencyProperty.Register("Body", typeof(string), typeof(WebEditor), (PropertyMetadata)new FrameworkPropertyMetadata((object)string.Empty, new PropertyChangedCallback(OnBoundBodyChanged))); + + public static readonly DependencyProperty IsReadOnlyProperty = DependencyProperty.Register("IsReadOnly", typeof(bool), typeof(WebEditor), (PropertyMetadata)new FrameworkPropertyMetadata((object)false, new PropertyChangedCallback(OnBoundReadOnlyChanged))); + + internal WrapPanel PanelControls; + + internal ComboBox ComboTextFormat; + + internal ComboBox ComboFontFamily; + + internal ComboBox ComboFontSize; + + internal Button SettingsBold; + + internal Button SettingsItalic; + + internal Button SettingsUnderLine; + + internal Button SettingsFontColor; + + internal Button SettingsBullets; + + internal Button SettingsNumbered; + + internal Button SettingsLeftAlign; + + internal Button SettingsCenter; + + internal Button SettingsRightAlign; + + internal Button SettingsJustifyFull; + + internal Button SettingsLink; + + internal TextBox ImagemLink; + + internal WebBrowser WebBrowserEditor; + + internal ItemsControl LinkPanel; + + internal TextBox HrefLink; + + internal CustomItemControl DescricaoBox; + + internal TextBox DescricaoLink; + + private bool _contentLoaded; + + public Visibility ImageVisibility + { + get + { + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + return (Visibility)((DependencyObject)this).GetValue(ImageVisibilityProperty); + } + set + { + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + ((DependencyObject)this).SetValue(ImageVisibilityProperty, (object)value); + } + } + + public Visibility BarVisibility + { + get + { + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + return (Visibility)((DependencyObject)this).GetValue(BarVisibilityProperty); + } + set + { + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + ((DependencyObject)this).SetValue(BarVisibilityProperty, (object)value); + } + } + + public string Body + { + get + { + return (string)((DependencyObject)this).GetValue(BodyProperty); + } + set + { + ((DependencyObject)this).SetValue(BodyProperty, (object)value); + } + } + + public bool IsReadOnly + { + get + { + return (bool)((DependencyObject)this).GetValue(IsReadOnlyProperty); + } + set + { + ((DependencyObject)this).SetValue(IsReadOnlyProperty, (object)value); + } + } + + public WebEditor() + { + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Expected O, but got Unknown + InitializeComponent(); + ColorDialog = new ColorDialog(); + } + + private void SettingsBold_Click(object sender, RoutedEventArgs e) + { + WebBrowserEditor.HtmlDocument?.execCommand("Bold", showUI: false, Type.Missing); + } + + private void SettingsItalic_Click(object sender, RoutedEventArgs e) + { + WebBrowserEditor.HtmlDocument?.execCommand("Italic", showUI: false, Type.Missing); + } + + private void SettingsUnderLine_Click(object sender, RoutedEventArgs e) + { + WebBrowserEditor.HtmlDocument?.execCommand("Underline", showUI: false, Type.Missing); + } + + private void SettingsRightAlign_Click(object sender, RoutedEventArgs e) + { + WebBrowserEditor.HtmlDocument?.execCommand("JustifyRight", showUI: false, Type.Missing); + } + + private void SettingsLeftAlign_Click(object sender, RoutedEventArgs e) + { + WebBrowserEditor.HtmlDocument?.execCommand("JustifyLeft", showUI: false, Type.Missing); + } + + private void SettingsCenter_Click(object sender, RoutedEventArgs e) + { + WebBrowserEditor.HtmlDocument?.execCommand("JustifyCenter", showUI: false, Type.Missing); + } + + private void SettingsJustifyFull_Click(object sender, RoutedEventArgs e) + { + WebBrowserEditor.HtmlDocument?.execCommand("JustifyFull", showUI: false, Type.Missing); + } + + private void SettingsInsertOrderedList_Click(object sender, RoutedEventArgs e) + { + WebBrowserEditor.HtmlDocument?.execCommand("InsertOrderedList", showUI: false, Type.Missing); + } + + private void SettingsBullets_Click(object sender, RoutedEventArgs e) + { + WebBrowserEditor.HtmlDocument?.execCommand("InsertUnorderedList", showUI: false, Type.Missing); + } + + public void InsertText(string textToInsert) + { + ((dynamic)WebBrowserEditor.HtmlDocument?.selection?.createRange())?.pasteHTML(textToInsert); + } + + private void SettingsFontColor_Click(object sender, RoutedEventArgs e) + { + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0034: Unknown result type (might be due to invalid IL or missing references) + WebBrowserEditor.HtmlDocument = WebBrowserEditor.Browser.Document as HTMLDocument; + if (WebBrowserEditor.HtmlDocument != null) + { + Color val = Pick(); + string value = $"#{((Color)(ref val)).R:X2}{((Color)(ref val)).G:X2}{((Color)(ref val)).B:X2}"; + WebBrowserEditor.HtmlDocument.execCommand("ForeColor", showUI: false, value); + } + } + + public Color Pick() + { + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + //IL_0026: Unknown result type (might be due to invalid IL or missing references) + //IL_002c: Invalid comparison between Unknown and I4 + //IL_0098: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + Color result = default(Color); + ColorDialog.AllowFullOpen = true; + ColorDialog.FullOpen = true; + if ((int)((CommonDialog)ColorDialog).ShowDialog() != 1) + { + return result; + } + ((Color)(ref result)).A = ColorDialog.Color.A; + ((Color)(ref result)).B = ColorDialog.Color.B; + ((Color)(ref result)).G = ColorDialog.Color.G; + ((Color)(ref result)).R = ColorDialog.Color.R; + return result; + } + + private void ComboFontFamily_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + WebBrowserEditor.HtmlDocument = WebBrowserEditor.Browser.Document as HTMLDocument; + string value = ((Selector)ComboFontFamily).SelectedItem.ToString(); + WebBrowserEditor.HtmlDocument?.execCommand("FontName", showUI: false, value); + } + + private void ComboFontSize_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + WebBrowserEditor.HtmlDocument = WebBrowserEditor.Browser.Document as HTMLDocument; + WebBrowserEditor.HtmlDocument?.execCommand("FontSize", showUI: false, ((Selector)ComboFontSize).SelectedItem); + } + + private void ComboTextFormat_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + string value = ((Selector)ComboTextFormat).SelectedValue.ToString(); + WebBrowserEditor.HtmlDocument = WebBrowserEditor.Browser.Document as HTMLDocument; + WebBrowserEditor.HtmlDocument?.execCommand("FormatBlock", showUI: false, value); + } + + private void Window_Loaded(object sender, RoutedEventArgs e) + { + if (WebBrowserEditor.Browser == null) + { + WebBrowserEditor.InstanciateNew(); + } + FontFamilyInitialize(); + FontSizeInitialize(); + FontFormatInitialize(); + } + + private void FontFamilyInitialize() + { + ((ItemsControl)ComboFontFamily).ItemsSource = Fonts.SystemFontFamilies; + ComboFontFamily.Text = "Times New Roman"; + } + + private void FontFormatInitialize() + { + ((ItemsControl)ComboTextFormat).ItemsSource = new List> + { + new KeyValuePair("

", "Parágrafo"), + new KeyValuePair("

", "Título 1"), + new KeyValuePair("

", "Título 2"), + new KeyValuePair("

", "Título 3"), + new KeyValuePair("

", "Título 4"), + new KeyValuePair("
", "Título 5"), + new KeyValuePair("
", "Título 6"), + new KeyValuePair("
", "Endereço"), + new KeyValuePair("
", "Pré-formatação")
+		};
+		((Selector)ComboTextFormat).SelectedValuePath = "Key";
+		((ItemsControl)ComboTextFormat).DisplayMemberPath = "Value";
+		((Selector)ComboTextFormat).SelectedIndex = 0;
+	}
+
+	public string GetHtml()
+	{
+		string innerHTML = WebBrowserEditor.HtmlDocument.documentElement.innerHTML;
+		innerHTML = innerHTML.Replace("about:", string.Empty);
+		return HtmlDecode(innerHTML);
+	}
+
+	public string GetText()
+	{
+		if (!(WebBrowserEditor.HtmlDocument.documentElement.innerText.Trim() == "new"))
+		{
+			return WebBrowserEditor.HtmlDocument.documentElement.innerText;
+		}
+		return "";
+	}
+
+	public string HtmlDecode(string html)
+	{
+		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
+		//IL_000b: Expected O, but got Unknown
+		if (html == null)
+		{
+			return null;
+		}
+		HtmlDocument val = new HtmlDocument();
+		val.LoadHtml(html);
+		val.OptionWriteEmptyNodes = true;
+		DecodeNode(val.DocumentNode);
+		return val.DocumentNode.InnerHtml;
+	}
+
+	private void DecodeNode(HtmlNode node)
+	{
+		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
+		//IL_005b: Invalid comparison between Unknown and I4
+		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0024: Invalid comparison between Unknown and I4
+		if (node.HasChildNodes)
+		{
+			foreach (HtmlNode item in (IEnumerable)node.ChildNodes)
+			{
+				if ((int)item.NodeType == 3)
+				{
+					item.InnerHtml = WebUtility.HtmlDecode(item.InnerHtml);
+				}
+				else
+				{
+					DecodeNode(item);
+				}
+			}
+			return;
+		}
+		if ((int)node.NodeType == 3)
+		{
+			node.InnerHtml = WebUtility.HtmlDecode(node.InnerHtml);
+		}
+	}
+
+	public void Initialize(string htmlData = null)
+	{
+		WebBrowserEditor.InstanciateNew(htmlData);
+	}
+
+	private void FontSizeInitialize()
+	{
+		List list = new List();
+		for (int i = 1; i <= 7; i++)
+		{
+			list.Add(i.ToString());
+		}
+		((ItemsControl)ComboFontSize).ItemsSource = list;
+		ComboFontSize.Text = "3";
+	}
+
+	private void SettingsImage_Click(object sender, RoutedEventArgs e)
+	{
+		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
+		//IL_001c: Expected O, but got Unknown
+		OpenFileDialog val = new OpenFileDialog
+		{
+			Title = "Selecione a imagem",
+			Filter = "Todos os formatos|*.jpg;*.jpeg;*.png|JPEG (*.jpg;*.jpeg)|*.jpg;*.jpeg|Portable Network Graphic (*.png)|*.png"
+		};
+		if (((CommonDialog)val).ShowDialog().GetValueOrDefault())
+		{
+			string text = Path.GetExtension(((FileDialog)val).FileName).ToLower().Substring(1);
+			string text2 = Convert.ToBase64String(File.ReadAllBytes(((FileDialog)val).FileName));
+			string text3 = "data:image/" + text + ";base64," + text2;
+			object obj = WebBrowserEditor.HtmlDocument?.selection?.createRange();
+			string text4 = "\"Imagem\"";
+			if (!string.IsNullOrEmpty(ImagemLink.Text.Trim()))
+			{
+				text4 = "" + text4 + "";
+			}
+			((dynamic)obj)?.pasteHTML(text4);
+		}
+	}
+
+	private static void OnBoundBodyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+	{
+		string htmlData = (string)((DependencyPropertyChangedEventArgs)(ref e)).NewValue;
+		if (d != null && d is WebEditor webEditor)
+		{
+			webEditor.WebBrowserEditor.InstanciateNew(htmlData);
+		}
+	}
+
+	private static void OnBoundReadOnlyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+	{
+		bool flag = (bool)((DependencyPropertyChangedEventArgs)(ref e)).NewValue;
+		if (d != null && d is WebEditor webEditor)
+		{
+			webEditor.WebBrowserEditor.ReadOnly(flag);
+			((UIElement)webEditor.PanelControls).IsEnabled = !flag;
+		}
+	}
+
+	private void SettingsLink_OnClick(object sender, RoutedEventArgs e)
+	{
+		HTMLDocument htmlDocument = WebBrowserEditor.HtmlDocument;
+		((UIElement)DescricaoBox).Visibility = (Visibility)0;
+		IHTMLSelectionObject selection = htmlDocument.selection;
+		if (selection != null && selection.createRange() is IHTMLTxtRange iHTMLTxtRange)
+		{
+			((UIElement)DescricaoBox).Visibility = (Visibility)((!string.IsNullOrEmpty(iHTMLTxtRange.htmlText)) ? 2 : 0);
+		}
+		((UIElement)LinkPanel).Visibility = (Visibility)0;
+		((UIElement)WebBrowserEditor).Visibility = (Visibility)1;
+	}
+
+	private void InsertLink_OnClick(object sender, RoutedEventArgs e)
+	{
+		if (string.IsNullOrWhiteSpace(HrefLink.Text))
+		{
+			return;
+		}
+		IHTMLSelectionObject selection = WebBrowserEditor.HtmlDocument.selection;
+		if (selection != null && selection.createRange() is IHTMLTxtRange iHTMLTxtRange)
+		{
+			if (!string.IsNullOrEmpty(iHTMLTxtRange.htmlText))
+			{
+				iHTMLTxtRange.pasteHTML("" + iHTMLTxtRange.htmlText + "");
+			}
+			else
+			{
+				iHTMLTxtRange.pasteHTML("" + DescricaoLink.Text + "");
+			}
+		}
+		((UIElement)LinkPanel).Visibility = (Visibility)2;
+		((UIElement)WebBrowserEditor).Visibility = (Visibility)0;
+	}
+
+	private void CancelLink_OnClick(object sender, RoutedEventArgs e)
+	{
+		((UIElement)LinkPanel).Visibility = (Visibility)2;
+		((UIElement)WebBrowserEditor).Visibility = (Visibility)0;
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	public void InitializeComponent()
+	{
+		if (!_contentLoaded)
+		{
+			_contentLoaded = true;
+			Uri uri = new Uri("/Gestor.Application;component/componentes/webeditor.xaml", UriKind.Relative);
+			Application.LoadComponent((object)this, uri);
+		}
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	internal Delegate _CreateDelegate(Type delegateType, string handler)
+	{
+		return Delegate.CreateDelegate(delegateType, this, handler);
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	[EditorBrowsable(EditorBrowsableState.Never)]
+	void IComponentConnector.Connect(int connectionId, object target)
+	{
+		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0088: Expected O, but got Unknown
+		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0095: Expected O, but got Unknown
+		//IL_0098: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00a2: Expected O, but got Unknown
+		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00b9: Expected O, but got Unknown
+		//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00c6: Expected O, but got Unknown
+		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00dd: Expected O, but got Unknown
+		//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00ea: Expected O, but got Unknown
+		//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0101: Expected O, but got Unknown
+		//IL_0104: Unknown result type (might be due to invalid IL or missing references)
+		//IL_010e: Expected O, but got Unknown
+		//IL_011b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0125: Expected O, but got Unknown
+		//IL_0128: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0132: Expected O, but got Unknown
+		//IL_013f: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0149: Expected O, but got Unknown
+		//IL_014c: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0156: Expected O, but got Unknown
+		//IL_0163: Unknown result type (might be due to invalid IL or missing references)
+		//IL_016d: Expected O, but got Unknown
+		//IL_0170: Unknown result type (might be due to invalid IL or missing references)
+		//IL_017a: Expected O, but got Unknown
+		//IL_0187: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0191: Expected O, but got Unknown
+		//IL_0194: Unknown result type (might be due to invalid IL or missing references)
+		//IL_019e: Expected O, but got Unknown
+		//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
+		//IL_01b5: Expected O, but got Unknown
+		//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
+		//IL_01c2: Expected O, but got Unknown
+		//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
+		//IL_01d9: Expected O, but got Unknown
+		//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
+		//IL_01e6: Expected O, but got Unknown
+		//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
+		//IL_01fd: Expected O, but got Unknown
+		//IL_0200: Unknown result type (might be due to invalid IL or missing references)
+		//IL_020a: Expected O, but got Unknown
+		//IL_0217: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0221: Expected O, but got Unknown
+		//IL_0224: Unknown result type (might be due to invalid IL or missing references)
+		//IL_022e: Expected O, but got Unknown
+		//IL_023b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0245: Expected O, but got Unknown
+		//IL_0248: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0252: Expected O, but got Unknown
+		//IL_025f: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0269: Expected O, but got Unknown
+		//IL_026c: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0276: Expected O, but got Unknown
+		//IL_0283: Unknown result type (might be due to invalid IL or missing references)
+		//IL_028d: Expected O, but got Unknown
+		//IL_0290: Unknown result type (might be due to invalid IL or missing references)
+		//IL_029a: Expected O, but got Unknown
+		//IL_029c: Unknown result type (might be due to invalid IL or missing references)
+		//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
+		//IL_02b2: Expected O, but got Unknown
+		//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
+		//IL_02cc: Expected O, but got Unknown
+		//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
+		//IL_02da: Unknown result type (might be due to invalid IL or missing references)
+		//IL_02e4: Expected O, but got Unknown
+		//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
+		//IL_02f1: Expected O, but got Unknown
+		//IL_0301: Unknown result type (might be due to invalid IL or missing references)
+		//IL_030b: Expected O, but got Unknown
+		//IL_030d: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0319: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0323: Expected O, but got Unknown
+		switch (connectionId)
+		{
+		case 1:
+			((FrameworkElement)(WebEditor)target).Loaded += new RoutedEventHandler(Window_Loaded);
+			break;
+		case 2:
+			PanelControls = (WrapPanel)target;
+			break;
+		case 3:
+			ComboTextFormat = (ComboBox)target;
+			((Selector)ComboTextFormat).SelectionChanged += new SelectionChangedEventHandler(ComboTextFormat_SelectionChanged);
+			break;
+		case 4:
+			ComboFontFamily = (ComboBox)target;
+			((Selector)ComboFontFamily).SelectionChanged += new SelectionChangedEventHandler(ComboFontFamily_SelectionChanged);
+			break;
+		case 5:
+			ComboFontSize = (ComboBox)target;
+			((Selector)ComboFontSize).SelectionChanged += new SelectionChangedEventHandler(ComboFontSize_SelectionChanged);
+			break;
+		case 6:
+			SettingsBold = (Button)target;
+			((ButtonBase)SettingsBold).Click += new RoutedEventHandler(SettingsBold_Click);
+			break;
+		case 7:
+			SettingsItalic = (Button)target;
+			((ButtonBase)SettingsItalic).Click += new RoutedEventHandler(SettingsItalic_Click);
+			break;
+		case 8:
+			SettingsUnderLine = (Button)target;
+			((ButtonBase)SettingsUnderLine).Click += new RoutedEventHandler(SettingsUnderLine_Click);
+			break;
+		case 9:
+			SettingsFontColor = (Button)target;
+			((ButtonBase)SettingsFontColor).Click += new RoutedEventHandler(SettingsFontColor_Click);
+			break;
+		case 10:
+			SettingsBullets = (Button)target;
+			((ButtonBase)SettingsBullets).Click += new RoutedEventHandler(SettingsBullets_Click);
+			break;
+		case 11:
+			SettingsNumbered = (Button)target;
+			((ButtonBase)SettingsNumbered).Click += new RoutedEventHandler(SettingsInsertOrderedList_Click);
+			break;
+		case 12:
+			SettingsLeftAlign = (Button)target;
+			((ButtonBase)SettingsLeftAlign).Click += new RoutedEventHandler(SettingsLeftAlign_Click);
+			break;
+		case 13:
+			SettingsCenter = (Button)target;
+			((ButtonBase)SettingsCenter).Click += new RoutedEventHandler(SettingsCenter_Click);
+			break;
+		case 14:
+			SettingsRightAlign = (Button)target;
+			((ButtonBase)SettingsRightAlign).Click += new RoutedEventHandler(SettingsRightAlign_Click);
+			break;
+		case 15:
+			SettingsJustifyFull = (Button)target;
+			((ButtonBase)SettingsJustifyFull).Click += new RoutedEventHandler(SettingsJustifyFull_Click);
+			break;
+		case 16:
+			SettingsLink = (Button)target;
+			((ButtonBase)SettingsLink).Click += new RoutedEventHandler(SettingsLink_OnClick);
+			break;
+		case 17:
+			ImagemLink = (TextBox)target;
+			break;
+		case 18:
+			((MenuItem)target).Click += new RoutedEventHandler(SettingsImage_Click);
+			break;
+		case 19:
+			WebBrowserEditor = (WebBrowser)target;
+			break;
+		case 20:
+			LinkPanel = (ItemsControl)target;
+			break;
+		case 21:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(CancelLink_OnClick);
+			break;
+		case 22:
+			HrefLink = (TextBox)target;
+			break;
+		case 23:
+			DescricaoBox = (CustomItemControl)target;
+			break;
+		case 24:
+			DescricaoLink = (TextBox)target;
+			break;
+		case 25:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(InsertLink_OnClick);
+			break;
+		default:
+			_contentLoaded = true;
+			break;
+		}
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/ActualHeightConverter.cs b/Decompiler/Gestor.Application.Converters/ActualHeightConverter.cs
new file mode 100644
index 0000000..b48c8e4
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/ActualHeightConverter.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Globalization;
+using System.Windows.Data;
+using System.Windows.Markup;
+
+namespace Gestor.Application.Converters;
+
+public class ActualHeightConverter : MarkupExtension, IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		if (value == null)
+		{
+			return 0;
+		}
+		return (double)value - 20.0;
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/ArquivoDigitalVisibilityConverter.cs b/Decompiler/Gestor.Application.Converters/ArquivoDigitalVisibilityConverter.cs
new file mode 100644
index 0000000..cd991aa
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/ArquivoDigitalVisibilityConverter.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Globalization;
+using System.Windows;
+using System.Windows.Data;
+using System.Windows.Markup;
+
+namespace Gestor.Application.Converters;
+
+public class ArquivoDigitalVisibilityConverter : MarkupExtension, IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return (object)(Visibility)((value == null) ? 2 : 0);
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/AssinaturasVisibilityConverter.cs b/Decompiler/Gestor.Application.Converters/AssinaturasVisibilityConverter.cs
new file mode 100644
index 0000000..00ff6f6
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/AssinaturasVisibilityConverter.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Windows;
+using System.Windows.Data;
+using System.Windows.Markup;
+using Gestor.Model.Common;
+
+namespace Gestor.Application.Converters;
+
+public class AssinaturasVisibilityConverter : MarkupExtension, IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return (object)(Visibility)((value == null || ((List)value).Count == 0) ? 2 : 0);
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/AssistenciaVisibilityConverter.cs b/Decompiler/Gestor.Application.Converters/AssistenciaVisibilityConverter.cs
new file mode 100644
index 0000000..a9a00ac
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/AssistenciaVisibilityConverter.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Globalization;
+using System.Windows;
+using System.Windows.Data;
+using System.Windows.Markup;
+using Gestor.Model.Common;
+
+namespace Gestor.Application.Converters;
+
+public class AssistenciaVisibilityConverter : MarkupExtension, IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0011: Invalid comparison between Unknown and I4
+		if (value == null)
+		{
+			return (object)(Visibility)2;
+		}
+		return (object)(Visibility)(((int)(TipoContatoSeguradora)value != 1) ? 2 : 0);
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/AtivoToColorConverter.cs b/Decompiler/Gestor.Application.Converters/AtivoToColorConverter.cs
new file mode 100644
index 0000000..2aa6b61
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/AtivoToColorConverter.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Globalization;
+using System.Windows;
+using System.Windows.Data;
+using System.Windows.Markup;
+using System.Windows.Media;
+
+namespace Gestor.Application.Converters;
+
+public class AtivoToColorConverter : MarkupExtension, IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
+		//IL_003b: Expected O, but got Unknown
+		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
+		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0030: Expected O, but got Unknown
+		if (((bool?)value).GetValueOrDefault(true))
+		{
+			return (object)new SolidColorBrush(Colors.Red);
+		}
+		return (object)new SolidColorBrush((Color)Application.Current.Resources[(object)"AggerBlue"]);
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/AtivoToStringConverter.cs b/Decompiler/Gestor.Application.Converters/AtivoToStringConverter.cs
new file mode 100644
index 0000000..cad9a10
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/AtivoToStringConverter.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Globalization;
+using System.Windows.Data;
+using System.Windows.Markup;
+
+namespace Gestor.Application.Converters;
+
+public class AtivoToStringConverter : MarkupExtension, IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		if (!((bool?)value).GetValueOrDefault(true))
+		{
+			return "ATIVAR";
+		}
+		return "INATIVAR";
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/BaixarVisibilityConverter.cs b/Decompiler/Gestor.Application.Converters/BaixarVisibilityConverter.cs
new file mode 100644
index 0000000..2e39617
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/BaixarVisibilityConverter.cs
@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Windows;
+using System.Windows.Data;
+using System.Windows.Markup;
+using Gestor.Model.Common;
+
+namespace Gestor.Application.Converters;
+
+public class BaixarVisibilityConverter : MarkupExtension, IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
+		if (value == null)
+		{
+			return (object)(Visibility)2;
+		}
+		return (object)(Visibility)(new List
+		{
+			(StatusParcela)1,
+			(StatusParcela)13,
+			(StatusParcela)10
+		}.Contains((StatusParcela)value) ? 2 : 0);
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/BoletosNotasConverter.cs b/Decompiler/Gestor.Application.Converters/BoletosNotasConverter.cs
new file mode 100644
index 0000000..ca5b144
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/BoletosNotasConverter.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Globalization;
+using System.Windows;
+using System.Windows.Data;
+using System.Windows.Markup;
+using Gestor.Application.Model.Ajuda;
+
+namespace Gestor.Application.Converters;
+
+public class BoletosNotasConverter : MarkupExtension, IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return (object)(Visibility)(string.IsNullOrEmpty(((Boleto)value).Nota) ? 1 : 0);
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/BoolToGridHeightOneStarConverter.cs b/Decompiler/Gestor.Application.Converters/BoolToGridHeightOneStarConverter.cs
new file mode 100644
index 0000000..5f761a1
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/BoolToGridHeightOneStarConverter.cs
@@ -0,0 +1,37 @@
+using System;
+using System.Globalization;
+using System.Windows;
+using System.Windows.Data;
+using System.Windows.Markup;
+
+namespace Gestor.Application.Converters;
+
+public class BoolToGridHeightOneStarConverter : MarkupExtension, IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
+		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
+		int num = 1;
+		if (parameter != null && int.TryParse(parameter.ToString(), out var result))
+		{
+			num = result;
+		}
+		if (value != null && (bool)value && num == 1000)
+		{
+			return (object)new GridLength(1.0, (GridUnitType)0);
+		}
+		return (object)((value != null && (bool)value) ? new GridLength((double)num, (GridUnitType)2) : new GridLength(0.0));
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/CalculoIconConverter.cs b/Decompiler/Gestor.Application.Converters/CalculoIconConverter.cs
new file mode 100644
index 0000000..579f79b
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/CalculoIconConverter.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Windows.Data;
+using System.Windows.Markup;
+using Gestor.Model.Domain.Aggilizador;
+
+namespace Gestor.Application.Converters;
+
+public class CalculoIconConverter : MarkupExtension, IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		Uri result = new Uri("pack://application:,,,Gestor.Application;component/Assets/Images/CalculoIcon.png");
+		if (value != null)
+		{
+			if (!((List)value).Any((Calculo x) => (int)x.Status == 2))
+			{
+				return new Uri("pack://application:,,,Gestor.Application;component/Assets/Images/CalculoIcon.png");
+			}
+			return new Uri("pack://application:,,,Gestor.Application;component/Assets/Images/CalculoIconOk.png");
+		}
+		return result;
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return value;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/ColorStatusConverter.cs b/Decompiler/Gestor.Application.Converters/ColorStatusConverter.cs
new file mode 100644
index 0000000..394b892
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/ColorStatusConverter.cs
@@ -0,0 +1,83 @@
+using System;
+using System.Globalization;
+using System.Windows.Data;
+using System.Windows.Media;
+using Gestor.Model.Common;
+using Gestor.Model.Validation;
+
+namespace Gestor.Application.Converters;
+
+public class ColorStatusConverter : IMultiValueConverter
+{
+	public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
+	{
+		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
+		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0043: Expected O, but got Unknown
+		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
+		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
+		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0068: Expected I4, but got Unknown
+		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
+		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0024: Expected O, but got Unknown
+		//IL_00de: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00e9: Expected O, but got Unknown
+		//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00d3: Expected O, but got Unknown
+		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00de: Expected O, but got Unknown
+		//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00f4: Expected O, but got Unknown
+		//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00ff: Expected O, but got Unknown
+		//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00c8: Expected O, but got Unknown
+		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00bd: Expected O, but got Unknown
+		if (values[2] != null && values[2] is bool && (bool)values[2])
+		{
+			return (object)new SolidColorBrush(Colors.Red);
+		}
+		object obj = values[0];
+		if (obj != null)
+		{
+			if (obj is TipoSeguro)
+			{
+				TipoSeguro val = (TipoSeguro)values[0];
+				switch (val - 3)
+				{
+				default:
+					if (values[1] != null && !((DateTime?)values[1] >= Funcoes.GetNetworkTime().Date.AddDays(-6.0)))
+					{
+						return (object)new SolidColorBrush(Colors.Goldenrod);
+					}
+					return (object)new SolidColorBrush(Colors.Green);
+				case 2:
+					return (object)new SolidColorBrush(Colors.DarkBlue);
+				case 3:
+					return (object)new SolidColorBrush(Colors.Gray);
+				case 0:
+					return (object)new SolidColorBrush(Colors.Red);
+				case 4:
+					return (object)new SolidColorBrush(Colors.DimGray);
+				}
+			}
+			return (object)new SolidColorBrush(Colors.White);
+		}
+		return (object)new SolidColorBrush(Colors.White);
+	}
+
+	public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/ContatoSeguradoraVisibiltyConverter.cs b/Decompiler/Gestor.Application.Converters/ContatoSeguradoraVisibiltyConverter.cs
new file mode 100644
index 0000000..c9bdc2f
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/ContatoSeguradoraVisibiltyConverter.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Globalization;
+using System.Windows;
+using System.Windows.Data;
+using System.Windows.Markup;
+using Gestor.Model.Common;
+
+namespace Gestor.Application.Converters;
+
+public class ContatoSeguradoraVisibiltyConverter : MarkupExtension, IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0011: Invalid comparison between Unknown and I4
+		if (value == null)
+		{
+			return (object)(Visibility)0;
+		}
+		return (object)(Visibility)(((int)(TipoContatoSeguradora)value == 1) ? 2 : 0);
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/DesconsiderarVisibilityConverter.cs b/Decompiler/Gestor.Application.Converters/DesconsiderarVisibilityConverter.cs
new file mode 100644
index 0000000..7cded32
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/DesconsiderarVisibilityConverter.cs
@@ -0,0 +1,39 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Windows;
+using System.Windows.Data;
+using System.Windows.Markup;
+using Gestor.Model.Common;
+
+namespace Gestor.Application.Converters;
+
+public class DesconsiderarVisibilityConverter : MarkupExtension, IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
+		if (value == null)
+		{
+			return (object)(Visibility)2;
+		}
+		return (object)(Visibility)(new List
+		{
+			(StatusParcela)8,
+			(StatusParcela)6,
+			(StatusParcela)1,
+			(StatusParcela)13,
+			(StatusParcela)10
+		}.Contains((StatusParcela)value) ? 2 : 0);
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/DiasPentendesConverter.cs b/Decompiler/Gestor.Application.Converters/DiasPentendesConverter.cs
new file mode 100644
index 0000000..806d6dc
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/DiasPentendesConverter.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Globalization;
+using System.Windows.Data;
+using System.Windows.Markup;
+
+namespace Gestor.Application.Converters;
+
+public class DiasPentendesConverter : MarkupExtension, IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		if (value != null)
+		{
+			return $"{value} DIAS";
+		}
+		return "";
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/DocumentoEtiquetaConverter.cs b/Decompiler/Gestor.Application.Converters/DocumentoEtiquetaConverter.cs
new file mode 100644
index 0000000..e25573b
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/DocumentoEtiquetaConverter.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Globalization;
+using System.Windows.Data;
+using Gestor.Model.Common;
+
+namespace Gestor.Application.Converters;
+
+public class DocumentoEtiquetaConverter : IMultiValueConverter
+{
+	public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
+	{
+		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0014: Invalid comparison between Unknown and I4
+		try
+		{
+			if (values == null)
+			{
+				return "";
+			}
+			return ((int)(TipoProtocoloEtiqueta)values[0] == 1) ? " - " : values[1];
+		}
+		catch
+		{
+			return "";
+		}
+	}
+
+	public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/EmpresaNomeConverter.cs b/Decompiler/Gestor.Application.Converters/EmpresaNomeConverter.cs
new file mode 100644
index 0000000..f41e7dd
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/EmpresaNomeConverter.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Globalization;
+using System.Linq;
+using System.Windows.Data;
+using System.Windows.Markup;
+using Gestor.Application.Helpers;
+using Gestor.Model.Domain.Common;
+using Gestor.Model.Domain.Generic;
+
+namespace Gestor.Application.Converters;
+
+public class EmpresaNomeConverter : MarkupExtension, IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		if (value != null && (long)value != 0L)
+		{
+			return Recursos.Empresas.First((Empresa x) => ((DomainBase)x).Id == (long)value).Nome;
+		}
+		return Recursos.Empresas.First((Empresa x) => ((DomainBase)x).Id == 1).Nome;
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/EnderecoConverter.cs b/Decompiler/Gestor.Application.Converters/EnderecoConverter.cs
new file mode 100644
index 0000000..f72accd
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/EnderecoConverter.cs
@@ -0,0 +1,40 @@
+using System;
+using System.Collections.ObjectModel;
+using System.Globalization;
+using System.Windows.Data;
+using System.Windows.Markup;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Domain.Seguros;
+
+namespace Gestor.Application.Converters;
+
+public class EnderecoConverter : MarkupExtension, IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		if (value == null)
+		{
+			return "";
+		}
+		if (!(value is ObservableCollection))
+		{
+			return "";
+		}
+		ObservableCollection observableCollection = (ObservableCollection)value;
+		if (!string.IsNullOrWhiteSpace(((EnderecoBase)observableCollection[0]).Complemento))
+		{
+			return ((EnderecoBase)observableCollection[0]).Endereco?.Trim() + ", " + ((EnderecoBase)observableCollection[0]).Numero?.Trim() + ", " + ((EnderecoBase)observableCollection[0]).Complemento.Trim() + ", " + ((EnderecoBase)observableCollection[0]).Bairro?.Trim() + " - " + ((EnderecoBase)observableCollection[0]).Cidade?.Trim() + "/" + ((EnderecoBase)observableCollection[0]).Estado?.Trim() + " - " + ((EnderecoBase)observableCollection[0]).Cep?.Trim();
+		}
+		return ((EnderecoBase)observableCollection[0]).Endereco?.Trim() + ", " + ((EnderecoBase)observableCollection[0]).Numero?.Trim() + ", " + ((EnderecoBase)observableCollection[0]).Bairro?.Trim() + " - " + ((EnderecoBase)observableCollection[0]).Cidade?.Trim() + "/" + ((EnderecoBase)observableCollection[0]).Estado?.Trim() + " - " + ((EnderecoBase)observableCollection[0]).Cep?.Trim();
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/EnviadoColorConverter.cs b/Decompiler/Gestor.Application.Converters/EnviadoColorConverter.cs
new file mode 100644
index 0000000..9890192
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/EnviadoColorConverter.cs
@@ -0,0 +1,78 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Windows;
+using System.Windows.Data;
+using System.Windows.Markup;
+using System.Windows.Media;
+using Gestor.Model.Common;
+
+namespace Gestor.Application.Converters;
+
+public class EnviadoColorConverter : MarkupExtension, IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0016: Expected O, but got Unknown
+		//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00bf: Expected O, but got Unknown
+		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00ce: Expected O, but got Unknown
+		//IL_0136: Unknown result type (might be due to invalid IL or missing references)
+		//IL_013b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0141: Expected O, but got Unknown
+		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00e3: Expected O, but got Unknown
+		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0106: Unknown result type (might be due to invalid IL or missing references)
+		//IL_010c: Expected O, but got Unknown
+		//IL_012b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0130: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0136: Expected O, but got Unknown
+		if (value != null && value is List)
+		{
+			List source = (List)value;
+			int num = source.Count((StatusDocumentoAssinado x) => (int)x.Status == 1 || (int)x.Status == 4);
+			int num2 = source.Count((StatusDocumentoAssinado x) => (int)x.Status == 0);
+			int num3 = source.Count((StatusDocumentoAssinado x) => (int)x.Status == 2);
+			if (!source.All((StatusDocumentoAssinado x) => (int)x.Status == 3))
+			{
+				if (num3 <= 0)
+				{
+					if (num > 0 && num2 == 0 && num3 == 0)
+					{
+						return (object)new SolidColorBrush(Colors.ForestGreen);
+					}
+					if (num == 0 && num2 > 0 && num3 == 0)
+					{
+						return (object)new SolidColorBrush((Color)Application.Current.Resources[(object)"AggerBlue"]);
+					}
+					if (num > 0 && num2 > 0 && num3 == 0)
+					{
+						return (object)new SolidColorBrush((Color)Application.Current.Resources[(object)"AggerYellow100"]);
+					}
+					return (object)new SolidColorBrush(Colors.IndianRed);
+				}
+				return (object)new SolidColorBrush(Colors.Red);
+			}
+			return (object)new SolidColorBrush(Colors.IndianRed);
+		}
+		return (object)new SolidColorBrush(Colors.IndianRed);
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/EnviadoConverter.cs b/Decompiler/Gestor.Application.Converters/EnviadoConverter.cs
new file mode 100644
index 0000000..dea1750
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/EnviadoConverter.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Globalization;
+using System.Linq;
+using System.Windows;
+using System.Windows.Data;
+
+namespace Gestor.Application.Converters;
+
+public class EnviadoConverter : IMultiValueConverter
+{
+	public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
+	{
+		if (values.Any((object x) => x == null))
+		{
+			return (object)(Visibility)2;
+		}
+		if (values[0] is bool && (bool)values[0])
+		{
+			return (object)(Visibility)2;
+		}
+		if (values[1] is bool && (bool)values[1])
+		{
+			return (object)(Visibility)0;
+		}
+		return (object)(Visibility)2;
+	}
+
+	public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
+	{
+		throw new NotImplementedException();
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/EnviadoIconConverter.cs b/Decompiler/Gestor.Application.Converters/EnviadoIconConverter.cs
new file mode 100644
index 0000000..00a1b14
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/EnviadoIconConverter.cs
@@ -0,0 +1,61 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Windows.Data;
+using System.Windows.Markup;
+using ControlzEx;
+using Gestor.Model.Common;
+using MaterialDesignThemes.Wpf;
+
+namespace Gestor.Application.Converters;
+
+public class EnviadoIconConverter : MarkupExtension, IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0006: Expected O, but got Unknown
+		PackIcon val = new PackIcon();
+		if (value == null || !(value is List))
+		{
+			((PackIconBase)(object)val).Kind = (PackIconKind)2689;
+			return val;
+		}
+		List source = (List)value;
+		int num = source.Count((StatusDocumentoAssinado x) => (int)x.Status == 1);
+		int num2 = source.Count((StatusDocumentoAssinado x) => (int)x.Status == 0);
+		int num3 = source.Count((StatusDocumentoAssinado x) => (int)x.Status == 2);
+		if (source.All((StatusDocumentoAssinado x) => (int)x.Status == 3))
+		{
+			((PackIconBase)(object)val).Kind = (PackIconKind)2689;
+		}
+		if (num3 > 0)
+		{
+			((PackIconBase)(object)val).Kind = (PackIconKind)789;
+		}
+		if (num > 0 && num2 == 0 && num3 == 0)
+		{
+			((PackIconBase)(object)val).Kind = (PackIconKind)2685;
+		}
+		if (num == 0 && num2 > 0 && num3 == 0)
+		{
+			((PackIconBase)(object)val).Kind = (PackIconKind)2685;
+		}
+		if (num > 0 && num2 > 0 && num3 == 0)
+		{
+			((PackIconBase)(object)val).Kind = (PackIconKind)95;
+		}
+		return val;
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/EnviadoTooTipConverter.cs b/Decompiler/Gestor.Application.Converters/EnviadoTooTipConverter.cs
new file mode 100644
index 0000000..709759d
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/EnviadoTooTipConverter.cs
@@ -0,0 +1,55 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Windows.Data;
+using System.Windows.Markup;
+using Gestor.Model.Common;
+
+namespace Gestor.Application.Converters;
+
+public class EnviadoTooTipConverter : MarkupExtension, IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		if (value == null || !(value is List))
+		{
+			return "";
+		}
+		List source = (List)value;
+		int num = source.Count((StatusDocumentoAssinado x) => (int)x.Status == 1 || (int)x.Status == 4);
+		int num2 = source.Count((StatusDocumentoAssinado x) => (int)x.Status == 0);
+		int num3 = source.Count((StatusDocumentoAssinado x) => (int)x.Status == 2);
+		if (source.All((StatusDocumentoAssinado x) => (int)x.Status == 3))
+		{
+			return "ASSINAR SELECIONADOS";
+		}
+		if (num3 > 0)
+		{
+			return "HÁ ASSINATURAS REJEITADAS PARA ESSE DOCUMENTO";
+		}
+		if (num > 0 && num2 == 0 && num3 == 0)
+		{
+			return "DOCUMENTO ASSINADO";
+		}
+		if (num == 0 && num2 > 0 && num3 == 0)
+		{
+			return "ASSINATURA PENDENTE";
+		}
+		if (num > 0 && num2 > 0 && num3 == 0)
+		{
+			return "CLIQUE PARA VERIFICAR O STATUS DAS ASSINATURAS";
+		}
+		return "ASSINAR DOCUMENTOS";
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/EqualToCollapsedConverter.cs b/Decompiler/Gestor.Application.Converters/EqualToCollapsedConverter.cs
new file mode 100644
index 0000000..d146d34
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/EqualToCollapsedConverter.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Globalization;
+using System.Windows;
+using System.Windows.Data;
+
+namespace Gestor.Application.Converters;
+
+public class EqualToCollapsedConverter : IMultiValueConverter
+{
+	public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
+	{
+		return (object)(Visibility)((values[0] is long num && values[1] is long num2) ? ((num == num2) ? 2 : 0) : 0);
+	}
+
+	public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/ExcluidoStringConverter.cs b/Decompiler/Gestor.Application.Converters/ExcluidoStringConverter.cs
new file mode 100644
index 0000000..3009569
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/ExcluidoStringConverter.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Globalization;
+using System.Windows.Data;
+using System.Windows.Markup;
+
+namespace Gestor.Application.Converters;
+
+public class ExcluidoStringConverter : MarkupExtension, IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		if (!(value is bool) || !(bool)value)
+		{
+			return "";
+		}
+		return "EXCLUÍDO";
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/ExcluirVendedorLabelConverter.cs b/Decompiler/Gestor.Application.Converters/ExcluirVendedorLabelConverter.cs
new file mode 100644
index 0000000..2bb0972
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/ExcluirVendedorLabelConverter.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Globalization;
+using System.Windows.Data;
+using System.Windows.Markup;
+
+namespace Gestor.Application.Converters;
+
+public class ExcluirVendedorLabelConverter : MarkupExtension, IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		if (((DateTime?)value).HasValue)
+		{
+			return "EXCLUIR PAGAMENTO";
+		}
+		return "EXCLUIR VENDEDOR";
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/ExpanderHeaderConverter.cs b/Decompiler/Gestor.Application.Converters/ExpanderHeaderConverter.cs
new file mode 100644
index 0000000..490c2fc
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/ExpanderHeaderConverter.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Globalization;
+using System.Windows.Data;
+using System.Windows.Markup;
+
+namespace Gestor.Application.Converters;
+
+public class ExpanderHeaderConverter : MarkupExtension, IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		if (value == null)
+		{
+			return "";
+		}
+		if (value is bool)
+		{
+			if (!(bool)value)
+			{
+				return $"MOSTRAR {parameter}";
+			}
+			return $"OCULTAR {parameter}";
+		}
+		return "";
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/ExtensaoVisibilityConverter.cs b/Decompiler/Gestor.Application.Converters/ExtensaoVisibilityConverter.cs
new file mode 100644
index 0000000..91e2dbc
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/ExtensaoVisibilityConverter.cs
@@ -0,0 +1,51 @@
+using System;
+using System.Globalization;
+using System.Windows;
+using System.Windows.Data;
+
+namespace Gestor.Application.Converters;
+
+public class ExtensaoVisibilityConverter : IMultiValueConverter
+{
+	public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
+	{
+		try
+		{
+			if (values[0] == null || values[1] == null)
+			{
+				return (object)(Visibility)2;
+			}
+			if (values[0] != null && (long)values[0] > 0)
+			{
+				return (object)(Visibility)2;
+			}
+			if (!(values[1].ToString().ToLower() == ".pdf"))
+			{
+				return (object)(Visibility)2;
+			}
+			return (object)(Visibility)0;
+		}
+		catch (Exception)
+		{
+			return (object)(Visibility)2;
+		}
+	}
+
+	public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		if (value == null)
+		{
+			return (object)(Visibility)2;
+		}
+		if (!(value.ToString().ToLower() == ".pdf"))
+		{
+			return (object)(Visibility)2;
+		}
+		return (object)(Visibility)0;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/FaturaVisibilityConverter.cs b/Decompiler/Gestor.Application.Converters/FaturaVisibilityConverter.cs
new file mode 100644
index 0000000..c9be252
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/FaturaVisibilityConverter.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Globalization;
+using System.Windows;
+using System.Windows.Data;
+using System.Windows.Markup;
+using Gestor.Model.Common;
+
+namespace Gestor.Application.Converters;
+
+public class FaturaVisibilityConverter : MarkupExtension, IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
+		//IL_000a: Invalid comparison between Unknown and I4
+		return (object)(Visibility)((value != null && (int)(TipoRecebimento)value == 1) ? 2 : 0);
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/FilialStringConverter.cs b/Decompiler/Gestor.Application.Converters/FilialStringConverter.cs
new file mode 100644
index 0000000..e9fa2f8
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/FilialStringConverter.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Globalization;
+using System.Windows.Data;
+using System.Windows.Markup;
+
+namespace Gestor.Application.Converters;
+
+public class FilialStringConverter : MarkupExtension, IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		if (!(value is long) || (long)value != 1)
+		{
+			return $"FILIAL {value}";
+		}
+		return "";
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/IdVisibilityConverter.cs b/Decompiler/Gestor.Application.Converters/IdVisibilityConverter.cs
new file mode 100644
index 0000000..6445a29
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/IdVisibilityConverter.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Globalization;
+using System.Windows;
+using System.Windows.Data;
+using System.Windows.Markup;
+
+namespace Gestor.Application.Converters;
+
+public class IdVisibilityConverter : MarkupExtension, IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return (object)(Visibility)((value == null || (long)value == 0L) ? 2 : 0);
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/IncluirApoliceEnabledConverter.cs b/Decompiler/Gestor.Application.Converters/IncluirApoliceEnabledConverter.cs
new file mode 100644
index 0000000..d15054e
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/IncluirApoliceEnabledConverter.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Globalization;
+using System.Windows.Data;
+
+namespace Gestor.Application.Converters;
+
+public class IncluirApoliceEnabledConverter : IMultiValueConverter
+{
+	public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
+	{
+		if (values[0] == null || values[1] == null)
+		{
+			return false;
+		}
+		object obj = values[0];
+		if (obj is bool && !(bool)obj)
+		{
+			return false;
+		}
+		if (!(values[1] is bool flag))
+		{
+			return false;
+		}
+		return flag;
+	}
+
+	public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/IntToMedalConverter.cs b/Decompiler/Gestor.Application.Converters/IntToMedalConverter.cs
new file mode 100644
index 0000000..69a65ef
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/IntToMedalConverter.cs
@@ -0,0 +1,55 @@
+using System;
+using System.Globalization;
+using System.Windows.Data;
+using System.Windows.Markup;
+using System.Windows.Media;
+
+namespace Gestor.Application.Converters;
+
+public class IntToMedalConverter : MarkupExtension, IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
+		//IL_007d: Expected O, but got Unknown
+		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
+		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0041: Expected O, but got Unknown
+		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0036: Expected O, but got Unknown
+		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
+		//IL_002b: Expected O, but got Unknown
+		if (value != null)
+		{
+			switch ((int)value)
+			{
+			case 3:
+				return (object)new SolidColorBrush(Colors.Gold);
+			case 2:
+				return (object)new SolidColorBrush(Colors.Silver);
+			case 1:
+				return (object)new SolidColorBrush(Colors.SaddleBrown);
+			}
+		}
+		Color val = default(Color);
+		((Color)(ref val)).A = 64;
+		((Color)(ref val)).R = 200;
+		((Color)(ref val)).G = 200;
+		((Color)(ref val)).B = 200;
+		return (object)new SolidColorBrush(val);
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return value;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/IntToMedalTextConverter.cs b/Decompiler/Gestor.Application.Converters/IntToMedalTextConverter.cs
new file mode 100644
index 0000000..7121baf
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/IntToMedalTextConverter.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Globalization;
+using System.Windows.Data;
+using System.Windows.Markup;
+
+namespace Gestor.Application.Converters;
+
+public class IntToMedalTextConverter : MarkupExtension, IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		if (value != null)
+		{
+			switch ((int)value)
+			{
+			case 3:
+				return "OURO";
+			case 2:
+				return "PRATA";
+			case 1:
+				return "BRONZE";
+			}
+		}
+		return "SEM QUALIFICAÇÃO";
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return value;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/IntToVisibilityConverter.cs b/Decompiler/Gestor.Application.Converters/IntToVisibilityConverter.cs
new file mode 100644
index 0000000..f0954e4
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/IntToVisibilityConverter.cs
@@ -0,0 +1,29 @@
+using System;
+using System.Globalization;
+using System.Windows;
+using System.Windows.Data;
+using System.Windows.Markup;
+
+namespace Gestor.Application.Converters;
+
+public class IntToVisibilityConverter : MarkupExtension, IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		if (value == null || (int.TryParse(value.ToString(), out var result) && result == 0))
+		{
+			return (object)(Visibility)2;
+		}
+		return (object)(Visibility)0;
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return value;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/InvertedBoolToGridHeightOneStarConverter.cs b/Decompiler/Gestor.Application.Converters/InvertedBoolToGridHeightOneStarConverter.cs
new file mode 100644
index 0000000..aabf8f0
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/InvertedBoolToGridHeightOneStarConverter.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Globalization;
+using System.Windows;
+using System.Windows.Data;
+using System.Windows.Markup;
+
+namespace Gestor.Application.Converters;
+
+public class InvertedBoolToGridHeightOneStarConverter : MarkupExtension, IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
+		return (object)((value != null && !(bool)value) ? new GridLength(1.0, (GridUnitType)2) : new GridLength(0.0));
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/IsNamedObjectVisibilityConverter.cs b/Decompiler/Gestor.Application.Converters/IsNamedObjectVisibilityConverter.cs
new file mode 100644
index 0000000..a008f60
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/IsNamedObjectVisibilityConverter.cs
@@ -0,0 +1,82 @@
+using System;
+using System.Globalization;
+using System.Windows;
+using System.Windows.Data;
+using System.Windows.Markup;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Seguros;
+
+namespace Gestor.Application.Converters;
+
+public class IsNamedObjectVisibilityConverter : MarkupExtension, IValueConverter
+{
+	private static int column;
+
+	private static TipoTela tela;
+
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0007: Expected O, but got Unknown
+		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
+		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
+		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
+		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
+		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0031: Invalid comparison between Unknown and I4
+		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
+		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0038: Invalid comparison between Unknown and I4
+		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
+		//IL_003d: Invalid comparison between Unknown and I4
+		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
+		PermissaoUsuario val = (PermissaoUsuario)value;
+		Visibility val2 = (Visibility)0;
+		if (val.Tela != tela)
+		{
+			tela = val.Tela;
+			column = 1;
+		}
+		TipoTela val3 = val.Tela;
+		if ((int)val3 == 10)
+		{
+			goto IL_0055;
+		}
+		if (val3 - 12 > 1)
+		{
+			if ((int)val3 == 18)
+			{
+				goto IL_0055;
+			}
+		}
+		else if (column == 1 || column == 3)
+		{
+			val2 = (Visibility)1;
+		}
+		goto IL_005f;
+		IL_0055:
+		if (column == 3)
+		{
+			val2 = (Visibility)1;
+		}
+		goto IL_005f;
+		IL_005f:
+		column++;
+		return val2;
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/ManutencaoPagamentoGroupHeaderConverter.cs b/Decompiler/Gestor.Application.Converters/ManutencaoPagamentoGroupHeaderConverter.cs
new file mode 100644
index 0000000..a63b746
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/ManutencaoPagamentoGroupHeaderConverter.cs
@@ -0,0 +1,37 @@
+using System;
+using System.Globalization;
+using System.Windows.Data;
+using System.Windows.Markup;
+using Gestor.Model.Domain.Ferramentas;
+
+namespace Gestor.Application.Converters;
+
+public class ManutencaoPagamentoGroupHeaderConverter : MarkupExtension, IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0020: Expected O, but got Unknown
+		if (value == null || parameter == null)
+		{
+			return null;
+		}
+		if (!(parameter is string))
+		{
+			return null;
+		}
+		string name = parameter.ToString();
+		ManutencaoPagamentos val = (ManutencaoPagamentos)value;
+		return ((object)val).GetType().GetProperty(name).GetValue(val, null);
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/MenosZeroVirgulaZeroUmConverter.cs b/Decompiler/Gestor.Application.Converters/MenosZeroVirgulaZeroUmConverter.cs
new file mode 100644
index 0000000..93f75e3
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/MenosZeroVirgulaZeroUmConverter.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Globalization;
+using System.Windows.Data;
+using System.Windows.Markup;
+
+namespace Gestor.Application.Converters;
+
+public class MenosZeroVirgulaZeroUmConverter : MarkupExtension, IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return ((decimal?)value - (decimal?)0.01m).GetValueOrDefault();
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return ((decimal?)value + (decimal?)0.01m).GetValueOrDefault();
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/MimeIconConverter.cs b/Decompiler/Gestor.Application.Converters/MimeIconConverter.cs
new file mode 100644
index 0000000..60beec5
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/MimeIconConverter.cs
@@ -0,0 +1,213 @@
+using System;
+using System.Globalization;
+using System.Windows.Data;
+using System.Windows.Markup;
+using ControlzEx;
+using MaterialDesignThemes.Wpf;
+
+namespace Gestor.Application.Converters;
+
+public class MimeIconConverter : MarkupExtension, IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0013: Expected O, but got Unknown
+		//IL_0014: Expected O, but got Unknown
+		//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
+		//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
+		//IL_01be: Expected O, but got Unknown
+		//IL_01bf: Expected O, but got Unknown
+		//IL_0225: Unknown result type (might be due to invalid IL or missing references)
+		//IL_022a: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0235: Expected O, but got Unknown
+		//IL_0236: Expected O, but got Unknown
+		//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
+		//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
+		//IL_01cf: Expected O, but got Unknown
+		//IL_01d0: Expected O, but got Unknown
+		//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
+		//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0202: Expected O, but got Unknown
+		//IL_0203: Expected O, but got Unknown
+		//IL_0203: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0208: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0213: Expected O, but got Unknown
+		//IL_0214: Expected O, but got Unknown
+		//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
+		//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
+		//IL_01f1: Expected O, but got Unknown
+		//IL_01f2: Expected O, but got Unknown
+		//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
+		//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
+		//IL_01e0: Expected O, but got Unknown
+		//IL_01e1: Expected O, but got Unknown
+		//IL_0214: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0219: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0224: Expected O, but got Unknown
+		//IL_0225: Expected O, but got Unknown
+		if (value == null)
+		{
+			PackIcon val = new PackIcon();
+			((PackIconBase)val).Kind = (PackIconKind)1529;
+			return (object)val;
+		}
+		string text = value.ToString().ToLower();
+		if (text != null)
+		{
+			int length = text.Length;
+			if (length != 4)
+			{
+				if (length == 5)
+				{
+					switch (text[2])
+					{
+					case 'o':
+						break;
+					case 'l':
+						goto IL_0183;
+					case 'p':
+						goto IL_0192;
+					case 's':
+						if (text == ".json")
+						{
+							PackIcon val2 = new PackIcon();
+							((PackIconBase)val2).Kind = (PackIconKind)2156;
+							return (object)val2;
+						}
+						goto IL_01ae;
+					default:
+						goto IL_01ae;
+					}
+					if (text == ".docx")
+					{
+						goto IL_01e1;
+					}
+				}
+			}
+			else
+			{
+				PackIcon val3;
+				switch (text[2])
+				{
+				case 'd':
+				{
+					if (!(text == ".pdf"))
+					{
+						goto IL_01ae;
+					}
+					PackIcon val5 = new PackIcon();
+					((PackIconBase)val5).Kind = (PackIconKind)1580;
+					return (object)val5;
+				}
+				case 'x':
+				{
+					if (!(text == ".txt"))
+					{
+						goto IL_01ae;
+					}
+					PackIcon val4 = new PackIcon();
+					((PackIconBase)val4).Kind = (PackIconKind)3399;
+					return (object)val4;
+				}
+				case 'o':
+					break;
+				case 'l':
+					goto IL_0102;
+				case 'p':
+					goto IL_0117;
+				case 'n':
+					goto IL_012c;
+				case 'm':
+					goto IL_013e;
+				case 'i':
+					if (!(text == ".zip"))
+					{
+						goto IL_01ae;
+					}
+					goto IL_0225;
+				case 'a':
+					if (!(text == ".rar"))
+					{
+						goto IL_01ae;
+					}
+					goto IL_0225;
+				default:
+					goto IL_01ae;
+					IL_0225:
+					val3 = new PackIcon();
+					((PackIconBase)val3).Kind = (PackIconKind)301;
+					return (object)val3;
+				}
+				if (text == ".doc")
+				{
+					goto IL_01e1;
+				}
+			}
+		}
+		goto IL_01ae;
+		IL_0183:
+		if (!(text == ".xlsx"))
+		{
+			goto IL_01ae;
+		}
+		goto IL_01f2;
+		IL_0117:
+		if (!(text == ".jpg"))
+		{
+			goto IL_01ae;
+		}
+		goto IL_0203;
+		IL_0203:
+		PackIcon val6 = new PackIcon();
+		((PackIconBase)val6).Kind = (PackIconKind)2102;
+		return (object)val6;
+		IL_012c:
+		if (!(text == ".png"))
+		{
+			goto IL_01ae;
+		}
+		goto IL_0203;
+		IL_0192:
+		if (!(text == ".jpge"))
+		{
+			goto IL_01ae;
+		}
+		goto IL_0203;
+		IL_01e1:
+		PackIcon val7 = new PackIcon();
+		((PackIconBase)val7).Kind = (PackIconKind)1605;
+		return (object)val7;
+		IL_01ae:
+		PackIcon val8 = new PackIcon();
+		((PackIconBase)val8).Kind = (PackIconKind)1529;
+		return (object)val8;
+		IL_01f2:
+		PackIcon val9 = new PackIcon();
+		((PackIconBase)val9).Kind = (PackIconKind)1563;
+		return (object)val9;
+		IL_0102:
+		if (!(text == ".xls"))
+		{
+			goto IL_01ae;
+		}
+		goto IL_01f2;
+		IL_013e:
+		if (!(text == ".bmp"))
+		{
+			goto IL_01ae;
+		}
+		goto IL_0203;
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/ModeloExisteTooltipConverter.cs b/Decompiler/Gestor.Application.Converters/ModeloExisteTooltipConverter.cs
new file mode 100644
index 0000000..359e56f
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/ModeloExisteTooltipConverter.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Globalization;
+using System.Windows.Data;
+using System.Windows.Markup;
+
+namespace Gestor.Application.Converters;
+
+public class ModeloExisteTooltipConverter : MarkupExtension, IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		if (value == null)
+		{
+			return "NEM TODOS OS DOCUMENTOS SELECIONADOS\nPARA ENVIO POSSUEM AS VARIÁVEIS DESSE MODELO";
+		}
+		if (!(bool)value)
+		{
+			return "TODOS OS DOCUMENTOS SELECIONADOS PARA\nENVIO POSSUEM AS VARIÁVEIS DESSE MODELO";
+		}
+		return "NEM TODOS OS DOCUMENTOS SELECIONADOS\nPARA ENVIO POSSUEM AS VARIÁVEIS DESSE MODELO";
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/MultiBoolReadOnly.cs b/Decompiler/Gestor.Application.Converters/MultiBoolReadOnly.cs
new file mode 100644
index 0000000..e5d3af1
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/MultiBoolReadOnly.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Globalization;
+using System.Linq;
+using System.Windows.Data;
+
+namespace Gestor.Application.Converters;
+
+public class MultiBoolReadOnly : IMultiValueConverter
+{
+	public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
+	{
+		try
+		{
+			return !values.All((object value) => (bool)value);
+		}
+		catch
+		{
+			return false;
+		}
+	}
+
+	public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/MultiBoolToVisibilityConverter.cs b/Decompiler/Gestor.Application.Converters/MultiBoolToVisibilityConverter.cs
new file mode 100644
index 0000000..0d97cc3
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/MultiBoolToVisibilityConverter.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Globalization;
+using System.Linq;
+using System.Windows;
+using System.Windows.Data;
+
+namespace Gestor.Application.Converters;
+
+public class MultiBoolToVisibilityConverter : IMultiValueConverter
+{
+	public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
+	{
+		try
+		{
+			return (object)(Visibility)((!values.All((object value) => (bool)value)) ? 2 : 0);
+		}
+		catch
+		{
+			return false;
+		}
+	}
+
+	public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/MultiVisibilityConverter.cs b/Decompiler/Gestor.Application.Converters/MultiVisibilityConverter.cs
new file mode 100644
index 0000000..06e32a4
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/MultiVisibilityConverter.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Globalization;
+using System.Linq;
+using System.Windows;
+using System.Windows.Data;
+
+namespace Gestor.Application.Converters;
+
+public class MultiVisibilityConverter : IMultiValueConverter
+{
+	public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
+	{
+		try
+		{
+			return (object)(Visibility)((!values.All((object value) => (int)(Visibility)value == 0)) ? 2 : 0);
+		}
+		catch
+		{
+			return false;
+		}
+	}
+
+	public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/NullToFalseConverter.cs b/Decompiler/Gestor.Application.Converters/NullToFalseConverter.cs
new file mode 100644
index 0000000..28e4d64
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/NullToFalseConverter.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Globalization;
+using System.Windows.Data;
+using System.Windows.Markup;
+
+namespace Gestor.Application.Converters;
+
+public class NullToFalseConverter : MarkupExtension, IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		if (value == null)
+		{
+			return false;
+		}
+		return true;
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return value;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/NullToTrueConverter.cs b/Decompiler/Gestor.Application.Converters/NullToTrueConverter.cs
new file mode 100644
index 0000000..cd129a1
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/NullToTrueConverter.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Globalization;
+using System.Windows.Data;
+using System.Windows.Markup;
+
+namespace Gestor.Application.Converters;
+
+public class NullToTrueConverter : MarkupExtension, IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		if (value == null)
+		{
+			return true;
+		}
+		return (bool)value;
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		if (value == null)
+		{
+			return true;
+		}
+		return (bool)value;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/PackIconToImage.cs b/Decompiler/Gestor.Application.Converters/PackIconToImage.cs
new file mode 100644
index 0000000..6ef2f02
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/PackIconToImage.cs
@@ -0,0 +1,55 @@
+using System.Windows.Media;
+using ControlzEx;
+using MaterialDesignThemes.Wpf;
+
+namespace Gestor.Application.Converters;
+
+public class PackIconToImage
+{
+	public static ImageSource CreateImageSource(object value, Brush foregroundBrush, double penThickness)
+	{
+		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0030: Expected O, but got Unknown
+		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0031: Expected O, but got Unknown
+		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
+		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
+		//IL_005b: Expected O, but got Unknown
+		//IL_005c: Expected O, but got Unknown
+		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
+		//IL_006e: Expected O, but got Unknown
+		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
+		//IL_007b: Expected O, but got Unknown
+		_003F val;
+		if (!(value.GetType() == typeof(PackIconKind)))
+		{
+			val = (PackIcon)value;
+		}
+		else
+		{
+			val = new PackIcon();
+			((PackIconBase)val).Kind = (PackIconKind)value;
+		}
+		PackIcon val2 = (PackIcon)val;
+		GeometryDrawing val3 = new GeometryDrawing
+		{
+			Geometry = Geometry.Parse(((PackIconBase)(object)val2).Data),
+			Brush = foregroundBrush,
+			Pen = new Pen(foregroundBrush, penThickness)
+		};
+		DrawingGroup val4 = new DrawingGroup();
+		val4.Children.Add((Drawing)(object)val3);
+		DrawingGroup drawing = val4;
+		return (ImageSource)new DrawingImage
+		{
+			Drawing = (Drawing)(object)drawing
+		};
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/PackIconToImageConverter.cs b/Decompiler/Gestor.Application.Converters/PackIconToImageConverter.cs
new file mode 100644
index 0000000..6e19632
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/PackIconToImageConverter.cs
@@ -0,0 +1,35 @@
+using System;
+using System.Globalization;
+using System.Windows.Data;
+using System.Windows.Markup;
+using System.Windows.Media;
+
+namespace Gestor.Application.Converters;
+
+public class PackIconToImageConverter : MarkupExtension, IValueConverter
+{
+	public double Thickness { get; set; } = 0.25;
+
+
+	public Brush Brush { get; set; } = (Brush)(object)Brushes.White;
+
+
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		if (value == null)
+		{
+			return null;
+		}
+		return PackIconToImage.CreateImageSource(value, Brush, Thickness);
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/RamoToImageConverter.cs b/Decompiler/Gestor.Application.Converters/RamoToImageConverter.cs
new file mode 100644
index 0000000..ffaa08d
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/RamoToImageConverter.cs
@@ -0,0 +1,135 @@
+using System;
+using System.Globalization;
+using System.Windows.Data;
+using System.Windows.Markup;
+using MaterialDesignThemes.Wpf;
+
+namespace Gestor.Application.Converters;
+
+public class RamoToImageConverter : MarkupExtension, IValueConverter
+{
+	public double Thickness { get; set; } = 0.25;
+
+
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		if (value == null)
+		{
+			return null;
+		}
+		long num = (long)value;
+		long num2 = num - 1;
+		if ((ulong)num2 <= 61uL)
+		{
+			switch (num2)
+			{
+			case 0L:
+			case 2L:
+			case 14L:
+			case 17L:
+				return (object)(PackIconKind)2040;
+			case 1L:
+				return (object)(PackIconKind)1515;
+			case 4L:
+				return (object)(PackIconKind)794;
+			case 5L:
+			case 8L:
+			case 60L:
+				return (object)(PackIconKind)2010;
+			case 6L:
+			case 9L:
+			case 11L:
+			case 52L:
+				return (object)(PackIconKind)33;
+			case 46L:
+				return (object)(PackIconKind)3465;
+			case 7L:
+			case 15L:
+			case 48L:
+				return (object)(PackIconKind)3514;
+			case 23L:
+				return (object)(PackIconKind)720;
+			case 10L:
+			case 31L:
+				return (object)(PackIconKind)25;
+			case 12L:
+			case 22L:
+				return (object)(PackIconKind)77;
+			case 13L:
+				return (object)(PackIconKind)3;
+			case 16L:
+				return (object)(PackIconKind)3012;
+			case 18L:
+			case 26L:
+			case 28L:
+			case 30L:
+			case 40L:
+			case 58L:
+				return (object)(PackIconKind)4;
+			case 19L:
+				return (object)(PackIconKind)3694;
+			case 20L:
+			case 21L:
+			case 41L:
+				return (object)(PackIconKind)859;
+			case 24L:
+				return (object)(PackIconKind)844;
+			case 25L:
+				return (object)(PackIconKind)1528;
+			case 27L:
+			case 55L:
+				return (object)(PackIconKind)3762;
+			case 29L:
+				return (object)(PackIconKind)2756;
+			case 32L:
+			case 43L:
+			case 53L:
+				return (object)(PackIconKind)3248;
+			case 33L:
+				return (object)(PackIconKind)2680;
+			case 34L:
+				return (object)(PackIconKind)1616;
+			case 35L:
+				return (object)(PackIconKind)41;
+			case 36L:
+				return (object)(PackIconKind)705;
+			case 37L:
+				return (object)(PackIconKind)920;
+			case 38L:
+				return (object)(PackIconKind)1462;
+			case 39L:
+				return (object)(PackIconKind)1013;
+			case 42L:
+				return (object)(PackIconKind)3372;
+			case 44L:
+				return (object)(PackIconKind)88;
+			case 45L:
+				return (object)(PackIconKind)3464;
+			case 47L:
+			case 56L:
+				return (object)(PackIconKind)870;
+			case 50L:
+				return (object)(PackIconKind)3040;
+			case 51L:
+				return (object)(PackIconKind)2433;
+			case 54L:
+				return (object)(PackIconKind)2719;
+			case 57L:
+				return (object)(PackIconKind)1101;
+			case 61L:
+				return (object)(PackIconKind)450;
+			}
+		}
+		return (object)(PackIconKind)196;
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/ResultadoToBoolConverter.cs b/Decompiler/Gestor.Application.Converters/ResultadoToBoolConverter.cs
new file mode 100644
index 0000000..93d9506
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/ResultadoToBoolConverter.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Globalization;
+using System.Windows.Data;
+using System.Windows.Markup;
+using Gestor.Model.Domain.Common;
+
+namespace Gestor.Application.Converters;
+
+public class ResultadoToBoolConverter : MarkupExtension, IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0011: Expected O, but got Unknown
+		if (value == null)
+		{
+			return false;
+		}
+		PesquisaAvancada val = (PesquisaAvancada)value;
+		return val.IdCliente != 0L || val.IdDocumento != 0L || val.IdItem != 0L || val.IdSinistro != 0L || !string.IsNullOrWhiteSpace(val.Nome) || !string.IsNullOrWhiteSpace(val.Pesquisa);
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return value;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/StatusComissaoAutomaticaTooltipConverter.cs b/Decompiler/Gestor.Application.Converters/StatusComissaoAutomaticaTooltipConverter.cs
new file mode 100644
index 0000000..d7bf2c5
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/StatusComissaoAutomaticaTooltipConverter.cs
@@ -0,0 +1,52 @@
+using System;
+using System.Globalization;
+using System.Windows.Data;
+using Gestor.Model.Common;
+
+namespace Gestor.Application.Converters;
+
+public class StatusComissaoAutomaticaTooltipConverter : IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
+		//IL_006e: Expected I4, but got Unknown
+		if (value is StatusParcela val)
+		{
+			return (val - 1) switch
+			{
+				0 => "", 
+				1 => "CLIENTE NÃO CADASTRADO NO SISTEMA OU DIVERGÊNCIA NO NÚMERO DA APÓLICE", 
+				2 => "O NÚMERO DA PARCELA NÃO FOI LOCALIZADO NO SISTEMA", 
+				3 => "OCORRE ANTES DE BAIXAR O EXTRATO, QUANDO O PERCENTUAL DE COMISSÃO CADASTRADO NA APÓLICE É DIFERENTE DO INFORMADO NO EXTRATO", 
+				4 => "A PARCELA JÁ FOI BAIXADA MANUALMENTE; O SISTEMA CONFERE A DATA DE RECEBIMENTO", 
+				5 => "O USUÁRIO OPTOU POR NÃO REALIZAR MANUTENÇÃO", 
+				6 => "É NECESSÁRIO FAZER MANUTENÇÃO NAS PARCELAS ANTERIORES", 
+				7 => "O SISTEMA DESCONSIDERA QUANDO NÃO EXISTE VALOR DE COMISSÃO NA PARCELA", 
+				8 => "NÃO HÁ MANUTENÇÃO PENDENTE, APENAS REALIZAR A BAIXA", 
+				9 => "OCORRE APÓS A BAIXA DO EXTRATO, MESMO HAVENDO DIFERENÇA NO PERCENTUAL DE COMISSÃO", 
+				10 => "APÓLICES COM NÚMEROS SIMILARES LOCALIZADAS NO SISTEMA", 
+				11 => "INDICA QUE O EXTRATO FOI BAIXADO MANUALMENTE NO SISTEMA", 
+				12 => "FOI NECESSÁRIO LOCALIZAR O CLIENTE OU DOCUMENTO POR MEIO DA CRÍTICA PARA REALIZAR A BAIXA DA PARCELA", 
+				13 => "", 
+				14 => "O NÚMERO DA FATURA NÃO FOI LOCALIZADO NO SISTEMA", 
+				15 => "O SISTEMA TENTARÁ REALIZAR A BAIXA POR APROXIMAÇÃO, ATRAVÉS DO N° DA APÓLICE", 
+				16 => "HÁ PARCELA NO EXTRATO SEM VÍNCULO; IRÁ SER CRIADA AUTOMATICAMENTE", 
+				17 => "", 
+				18 => "O CAMPO DE COMISSÃO ESTÁ EM BRANCO", 
+				19 => "A FATURA CRIADA POSSUI O CAMPO DE COMISSÃO EM BRANCO", 
+				20 => "INDICA QUE A PARCELA ESPECIAL CRIADA JÁ HAVIA SIDO BAIXADA ANTERIORMENTE", 
+				_ => "", 
+			};
+		}
+		return null;
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return Binding.DoNothing;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/StatusIconConverter.cs b/Decompiler/Gestor.Application.Converters/StatusIconConverter.cs
new file mode 100644
index 0000000..3d2225b
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/StatusIconConverter.cs
@@ -0,0 +1,51 @@
+using System;
+using System.Globalization;
+using System.Windows.Data;
+using System.Windows.Media;
+using Gestor.Model.Common;
+using Gestor.Model.Validation;
+using MaterialDesignThemes.Wpf;
+
+namespace Gestor.Application.Converters;
+
+public class StatusIconConverter : IMultiValueConverter
+{
+	public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
+	{
+		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
+		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
+		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0068: Expected I4, but got Unknown
+		//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00fb: Expected O, but got Unknown
+		if (values[2] != null && values[2] is bool && (bool)values[2])
+		{
+			return (object)(PackIconKind)1280;
+		}
+		object obj = values[0];
+		if (obj != null)
+		{
+			if (!(obj is TipoSeguro))
+			{
+				return (object)new SolidColorBrush(Colors.White);
+			}
+			TipoSeguro val = (TipoSeguro)values[0];
+			return (val - 3) switch
+			{
+				2 => (object)(PackIconKind)2901, 
+				3 => (object)(PackIconKind)1554, 
+				0 => (object)(PackIconKind)1058, 
+				4 => (object)(PackIconKind)789, 
+				_ => (object)(PackIconKind)((values[1] == null || (DateTime?)values[1] >= Funcoes.GetNetworkTime().Date.AddDays(-6.0)) ? 1545 : 1044), 
+			};
+		}
+		return (object)(PackIconKind)1543;
+	}
+
+	public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/StatusPagamentoColorConverter.cs b/Decompiler/Gestor.Application.Converters/StatusPagamentoColorConverter.cs
new file mode 100644
index 0000000..224990e
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/StatusPagamentoColorConverter.cs
@@ -0,0 +1,47 @@
+using System;
+using System.Globalization;
+using System.Windows;
+using System.Windows.Data;
+using System.Windows.Markup;
+using System.Windows.Media;
+using Gestor.Model.Common;
+
+namespace Gestor.Application.Converters;
+
+public class StatusPagamentoColorConverter : MarkupExtension, IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0016: Expected O, but got Unknown
+		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
+		//IL_001d: Invalid comparison between Unknown and I4
+		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0049: Expected O, but got Unknown
+		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
+		//IL_002a: Expected O, but got Unknown
+		if (value != null && (int)(StatusPagamento)value != 0)
+		{
+			if ((int)(StatusPagamento)value == 2)
+			{
+				return (object)new SolidColorBrush((Color)Application.Current.Resources[(object)"AggerBlue"]);
+			}
+			return (object)new SolidColorBrush(Colors.Red);
+		}
+		return (object)new SolidColorBrush(Colors.Gray);
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/StatusPagamentoVisibilityConverter.cs b/Decompiler/Gestor.Application.Converters/StatusPagamentoVisibilityConverter.cs
new file mode 100644
index 0000000..152faf7
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/StatusPagamentoVisibilityConverter.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Globalization;
+using System.Windows;
+using System.Windows.Data;
+using System.Windows.Markup;
+using Gestor.Model.Common;
+
+namespace Gestor.Application.Converters;
+
+public class StatusPagamentoVisibilityConverter : MarkupExtension, IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
+		if (value == null)
+		{
+			return (object)(Visibility)2;
+		}
+		return (object)(Visibility)(((int)(StatusPagamento)value == 0) ? 2 : 0);
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/StringToFontWeightConverter.cs b/Decompiler/Gestor.Application.Converters/StringToFontWeightConverter.cs
new file mode 100644
index 0000000..9ddee88
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/StringToFontWeightConverter.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Globalization;
+using System.Windows;
+using System.Windows.Data;
+using System.Windows.Markup;
+
+namespace Gestor.Application.Converters;
+
+public class StringToFontWeightConverter : MarkupExtension, IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
+		if (value == null || !((string)value).Contains("$"))
+		{
+			return FontWeights.SemiBold;
+		}
+		return FontWeights.Bold;
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return value;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/StringToStringFontWeightCleanConverter.cs b/Decompiler/Gestor.Application.Converters/StringToStringFontWeightCleanConverter.cs
new file mode 100644
index 0000000..989d179
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/StringToStringFontWeightCleanConverter.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Globalization;
+using System.Windows.Data;
+using System.Windows.Markup;
+
+namespace Gestor.Application.Converters;
+
+public class StringToStringFontWeightCleanConverter : MarkupExtension, IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		if (value == null || !((string)value).Contains("$"))
+		{
+			return (string)value;
+		}
+		return ((string)value).Replace("$", "");
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return value;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/SubTipoEnableConverter.cs b/Decompiler/Gestor.Application.Converters/SubTipoEnableConverter.cs
new file mode 100644
index 0000000..9c4d3c9
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/SubTipoEnableConverter.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Globalization;
+using System.Windows.Data;
+using System.Windows.Markup;
+using Gestor.Model.Common;
+
+namespace Gestor.Application.Converters;
+
+public class SubTipoEnableConverter : MarkupExtension, IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
+		//IL_000a: Invalid comparison between Unknown and I4
+		return value != null && (int)(SubTipo)value != 1;
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return value;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/TelaRelatorioConverter.cs b/Decompiler/Gestor.Application.Converters/TelaRelatorioConverter.cs
new file mode 100644
index 0000000..a112dbe
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/TelaRelatorioConverter.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Globalization;
+using System.Windows.Data;
+using Gestor.Common.Validation;
+using Gestor.Model.Common;
+
+namespace Gestor.Application.Converters;
+
+public class TelaRelatorioConverter : IMultiValueConverter
+{
+	public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
+	{
+		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
+		try
+		{
+			if (values == null)
+			{
+				return "";
+			}
+			return (values[0] == null) ? ValidationHelper.GetDescription((Enum)(object)(Relatorio)values[1]) : ValidationHelper.GetDescription((Enum)(object)(TipoTela)values[0]);
+		}
+		catch
+		{
+			return "";
+		}
+	}
+
+	public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/TelefoneToVisibilityConverter.cs b/Decompiler/Gestor.Application.Converters/TelefoneToVisibilityConverter.cs
new file mode 100644
index 0000000..7f228fb
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/TelefoneToVisibilityConverter.cs
@@ -0,0 +1,30 @@
+using System;
+using System.Globalization;
+using System.Text.RegularExpressions;
+using System.Windows;
+using System.Windows.Data;
+using System.Windows.Markup;
+
+namespace Gestor.Application.Converters;
+
+public class TelefoneToVisibilityConverter : MarkupExtension, IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		if (value == null || (string)value == "")
+		{
+			return (object)(Visibility)0;
+		}
+		return (object)(Visibility)(Regex.Match((string)value, "^[0-9]{4} [0-9]{3} [0-9]{4}$").Success ? 2 : 0);
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return value;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/TextInputToVisibilityConverter.cs b/Decompiler/Gestor.Application.Converters/TextInputToVisibilityConverter.cs
new file mode 100644
index 0000000..087f3a2
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/TextInputToVisibilityConverter.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Globalization;
+using System.Windows;
+using System.Windows.Data;
+
+namespace Gestor.Application.Converters;
+
+public class TextInputToVisibilityConverter : IMultiValueConverter
+{
+	public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
+	{
+		if (values[0] == null && values[1] is bool && (bool)values[1])
+		{
+			return (object)(Visibility)2;
+		}
+		if (values[0] is string && values[1] is bool)
+		{
+			bool flag = !string.IsNullOrEmpty((string)values[0]);
+			if ((bool)values[1] || flag)
+			{
+				return (object)(Visibility)2;
+			}
+		}
+		return (object)(Visibility)0;
+	}
+
+	public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
+	{
+		throw new NotImplementedException();
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/TipoDependenteToVisibilityConverter.cs b/Decompiler/Gestor.Application.Converters/TipoDependenteToVisibilityConverter.cs
new file mode 100644
index 0000000..91e4272
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/TipoDependenteToVisibilityConverter.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Globalization;
+using System.Windows;
+using System.Windows.Data;
+using System.Windows.Markup;
+using Gestor.Model.Common;
+
+namespace Gestor.Application.Converters;
+
+public class TipoDependenteToVisibilityConverter : MarkupExtension, IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0011: Invalid comparison between Unknown and I4
+		if (value == null)
+		{
+			return (object)(Visibility)2;
+		}
+		return (object)(Visibility)(((int)(TipoTitular)value != 2) ? 2 : 0);
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return value;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/TipoEmailVisibilityConverter.cs b/Decompiler/Gestor.Application.Converters/TipoEmailVisibilityConverter.cs
new file mode 100644
index 0000000..17d3ccd
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/TipoEmailVisibilityConverter.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Globalization;
+using System.Windows;
+using System.Windows.Data;
+using System.Windows.Markup;
+using Gestor.Model.Common;
+
+namespace Gestor.Application.Converters;
+
+public class TipoEmailVisibilityConverter : MarkupExtension, IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
+		return (object)(Visibility)((value != null && (int)(TipoEmail)value != 0) ? 2 : 0);
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/TipoRepasseGlobalFilterConverter.cs b/Decompiler/Gestor.Application.Converters/TipoRepasseGlobalFilterConverter.cs
new file mode 100644
index 0000000..17c916c
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/TipoRepasseGlobalFilterConverter.cs
@@ -0,0 +1,30 @@
+using System;
+using System.Globalization;
+using System.Linq;
+using System.Windows.Data;
+using Gestor.Application.Helpers;
+using Gestor.Model.Attributes;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Configuracoes;
+
+namespace Gestor.Application.Converters;
+
+public class TipoRepasseGlobalFilterConverter : IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		bool ativa = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 56);
+		return Enum.GetValues(typeof(TipoRepasse)).Cast().Where(delegate(TipoRepasse tipo)
+		{
+			object? obj = typeof(TipoRepasse).GetField(((object)(TipoRepasse)(ref tipo)).ToString())?.GetCustomAttributes(typeof(TipoAttribute), inherit: false).FirstOrDefault();
+			TipoAttribute val = (TipoAttribute)((obj is TipoAttribute) ? obj : null);
+			return ((val != null) ? val.Tipo : null) == "0" || (((val != null) ? val.Tipo : null) == "1" && ativa);
+		})
+			.ToList();
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		throw new NotImplementedException();
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/TipoRepasseVendedorVisibilityConverter.cs b/Decompiler/Gestor.Application.Converters/TipoRepasseVendedorVisibilityConverter.cs
new file mode 100644
index 0000000..f17f23b
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/TipoRepasseVendedorVisibilityConverter.cs
@@ -0,0 +1,41 @@
+using System;
+using System.Globalization;
+using System.Linq;
+using System.Windows;
+using System.Windows.Data;
+using Gestor.Application.Helpers;
+using Gestor.Model.Domain.Configuracoes;
+
+namespace Gestor.Application.Converters;
+
+public class TipoRepasseVendedorVisibilityConverter : IMultiValueConverter
+{
+	public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
+	{
+		if (parameter == null || values == null)
+		{
+			return (object)(Visibility)2;
+		}
+		string text = parameter.ToString().ToLower();
+		object obj = ((values.Count() != 0) ? values[0] : ((object)false));
+		switch (text)
+		{
+		default:
+			return (object)(Visibility)0;
+		case "cocorretagemtoogle":
+			return (object)(Visibility)((!Recursos.Configuracoes.Any((ConfiguracaoSistema config) => (int)config.Configuracao == 56)) ? 2 : 0);
+		case "formaincidenciabox":
+		case "tipovendedorbox":
+		case "valorrepassebox":
+		case "repassevendedor":
+		case "comissaorenovacaocombobox":
+		case "formarecebidabox":
+			return (object)(Visibility)((obj is bool && (bool)obj) ? 2 : 0);
+		}
+	}
+
+	public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/TipoRepasseVisibilityConverter.cs b/Decompiler/Gestor.Application.Converters/TipoRepasseVisibilityConverter.cs
new file mode 100644
index 0000000..c696b11
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/TipoRepasseVisibilityConverter.cs
@@ -0,0 +1,59 @@
+using System;
+using System.Globalization;
+using System.Windows;
+using System.Windows.Data;
+using Gestor.Model.Common;
+
+namespace Gestor.Application.Converters;
+
+public class TipoRepasseVisibilityConverter : IMultiValueConverter
+{
+	public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
+	{
+		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
+		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0082: Invalid comparison between Unknown and I4
+		//IL_008e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0090: Invalid comparison between Unknown and I4
+		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0098: Invalid comparison between Unknown and I4
+		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0094: Invalid comparison between Unknown and I4
+		//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00ae: Invalid comparison between Unknown and I4
+		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00a0: Invalid comparison between Unknown and I4
+		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
+		//IL_009c: Invalid comparison between Unknown and I4
+		//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00bc: Invalid comparison between Unknown and I4
+		//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00ca: Invalid comparison between Unknown and I4
+		//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00d8: Invalid comparison between Unknown and I4
+		if (parameter == null || values == null)
+		{
+			return (object)(Visibility)2;
+		}
+		TipoRepasse val = (TipoRepasse)values[0];
+		FormaRepasse val2 = (FormaRepasse)values[1];
+		return parameter.ToString().ToLower() switch
+		{
+			"incidenciabox" => (object)(Visibility)(((int)val != 2) ? 2 : 0), 
+			"basepagtobox" => (object)(Visibility)(((((int)val != 1 || (int)val2 == 1) && (int)val2 != 2 && (int)val2 != 3) || (int)val == 3) ? 2 : 0), 
+			"formapagtobox" => (object)(Visibility)(((int)val == 3) ? 2 : 0), 
+			"valorbox" => (object)(Visibility)(((int)val == 3) ? 2 : 0), 
+			"renovacoesbox" => (object)(Visibility)(((int)val == 3) ? 2 : 0), 
+			"cocorretagembox" => (object)(Visibility)(((int)val != 3) ? 2 : 0), 
+			_ => (object)(Visibility)0, 
+		};
+	}
+
+	public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/TipoSinistroConverter.cs b/Decompiler/Gestor.Application.Converters/TipoSinistroConverter.cs
new file mode 100644
index 0000000..13cd9ff
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/TipoSinistroConverter.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Globalization;
+using System.Windows.Data;
+using System.Windows.Markup;
+using Gestor.Model.Common;
+
+namespace Gestor.Application.Converters;
+
+public class TipoSinistroConverter : MarkupExtension, IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
+		//IL_000a: Invalid comparison between Unknown and I4
+		return value == null || (int)(TipoSinistro)value > 0;
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/TipoTelefoneVisibilityConverter.cs b/Decompiler/Gestor.Application.Converters/TipoTelefoneVisibilityConverter.cs
new file mode 100644
index 0000000..e12e7e7
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/TipoTelefoneVisibilityConverter.cs
@@ -0,0 +1,40 @@
+using System;
+using System.Globalization;
+using System.Windows;
+using System.Windows.Data;
+using System.Windows.Markup;
+using Gestor.Model.Common;
+
+namespace Gestor.Application.Converters;
+
+public class TipoTelefoneVisibilityConverter : MarkupExtension, IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
+		//IL_000b: Invalid comparison between Unknown and I4
+		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0014: Invalid comparison between Unknown and I4
+		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
+		//IL_001d: Invalid comparison between Unknown and I4
+		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0026: Invalid comparison between Unknown and I4
+		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
+		//IL_002f: Invalid comparison between Unknown and I4
+		if (value == null || ((int)(TipoTelefone)value != 9 && (int)(TipoTelefone)value != 3 && (int)(TipoTelefone)value != 2 && (int)(TipoTelefone)value != 5 && (int)(TipoTelefone)value != 1))
+		{
+			return (object)(Visibility)2;
+		}
+		return (object)(Visibility)0;
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/TootipStatusConverter.cs b/Decompiler/Gestor.Application.Converters/TootipStatusConverter.cs
new file mode 100644
index 0000000..7010093
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/TootipStatusConverter.cs
@@ -0,0 +1,59 @@
+using System;
+using System.Globalization;
+using System.Windows.Data;
+using System.Windows.Media;
+using Gestor.Model.Common;
+using Gestor.Model.Validation;
+
+namespace Gestor.Application.Converters;
+
+public class TootipStatusConverter : IMultiValueConverter
+{
+	public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
+	{
+		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
+		//IL_005e: Expected I4, but got Unknown
+		//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00d7: Expected O, but got Unknown
+		if (values[2] != null && values[2] is bool && (bool)values[2])
+		{
+			return "DOCUMENTO EXCLUÍDO";
+		}
+		object obj = values[0];
+		if (obj != null)
+		{
+			if (obj is TipoSeguro)
+			{
+				TipoSeguro val = (TipoSeguro)values[0];
+				switch (val - 3)
+				{
+				default:
+					if (values[1] != null && !((DateTime?)values[1] >= Funcoes.GetNetworkTime().Date.AddDays(-6.0)))
+					{
+						return "DOCUMENTO VENCIDO";
+					}
+					return "DOCUMENTO VIGENTE";
+				case 2:
+					return "DOCUMENTO RENOVADO";
+				case 3:
+					return "DOCUMENTO PERDIDO";
+				case 0:
+					return "DOCUMENTO CANCELADO";
+				case 4:
+					return "DOCUMENTO RECUSADO";
+				}
+			}
+			return (object)new SolidColorBrush(Colors.White);
+		}
+		return "";
+	}
+
+	public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/TypeVisibilityConverter.cs b/Decompiler/Gestor.Application.Converters/TypeVisibilityConverter.cs
new file mode 100644
index 0000000..210a741
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/TypeVisibilityConverter.cs
@@ -0,0 +1,30 @@
+using System;
+using System.Globalization;
+using System.Windows;
+using System.Windows.Data;
+
+namespace Gestor.Application.Converters;
+
+public class TypeVisibilityConverter : IMultiValueConverter
+{
+	public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
+	{
+		try
+		{
+			if (values[0] == null || values[1] == null)
+			{
+				return (object)(Visibility)2;
+			}
+			return (object)(Visibility)((!((Type)values[0] == (Type)values[1])) ? 2 : 0);
+		}
+		catch (Exception)
+		{
+			return (object)(Visibility)2;
+		}
+	}
+
+	public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/ValorTipoConverter.cs b/Decompiler/Gestor.Application.Converters/ValorTipoConverter.cs
new file mode 100644
index 0000000..cf2719e
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/ValorTipoConverter.cs
@@ -0,0 +1,42 @@
+using System;
+using System.Globalization;
+using System.Windows;
+using System.Windows.Data;
+using System.Windows.Markup;
+
+namespace Gestor.Application.Converters;
+
+public class ValorTipoConverter : MarkupExtension, IMultiValueConverter
+{
+	object IMultiValueConverter.Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
+	{
+		if (values == null || values[1] == null || values[0] == DependencyProperty.UnsetValue)
+		{
+			return null;
+		}
+		if (values[0] != null)
+		{
+			string text = values[0].ToString();
+			if (!(text == "VALOR"))
+			{
+				if (!(text == "PERCENTUAL"))
+				{
+					return values[1].ToString();
+				}
+				return ((decimal)values[1]).ToString("p2");
+			}
+			return ((decimal)values[1]).ToString("c2");
+		}
+		return values[1].ToString();
+	}
+
+	object[] IMultiValueConverter.ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
+	{
+		throw new NotImplementedException();
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/VariavelExisteColorConverter.cs b/Decompiler/Gestor.Application.Converters/VariavelExisteColorConverter.cs
new file mode 100644
index 0000000..89c1775
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/VariavelExisteColorConverter.cs
@@ -0,0 +1,42 @@
+using System;
+using System.Globalization;
+using System.Windows.Data;
+using System.Windows.Markup;
+using System.Windows.Media;
+
+namespace Gestor.Application.Converters;
+
+public class VariavelExisteColorConverter : MarkupExtension, IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
+		//IL_000e: Expected O, but got Unknown
+		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
+		//IL_002c: Expected O, but got Unknown
+		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
+		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0021: Expected O, but got Unknown
+		if (value != null)
+		{
+			if ((bool)value)
+			{
+				return (object)new SolidColorBrush(Colors.Red);
+			}
+			return (object)new SolidColorBrush(Colors.Black);
+		}
+		return (object)new SolidColorBrush(Colors.Red);
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/VariavelExisteTooltipConverter.cs b/Decompiler/Gestor.Application.Converters/VariavelExisteTooltipConverter.cs
new file mode 100644
index 0000000..45245f2
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/VariavelExisteTooltipConverter.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Globalization;
+using System.Windows.Data;
+using System.Windows.Markup;
+
+namespace Gestor.Application.Converters;
+
+public class VariavelExisteTooltipConverter : MarkupExtension, IValueConverter
+{
+	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		if (value == null)
+		{
+			return "CAMPO FALTANDO EM, PELO MENOS, UM\nDOS DOCUMENTOS SELECIONADOS PARA ENVIO";
+		}
+		if (!(bool)value)
+		{
+			return "CAMPO PRESENTE EM TODOS\nOS DOCUMENTOS SELECIONADOS PARA ENVIO";
+		}
+		return "CAMPO FALTANDO EM, PELO MENOS, UM\nDOS DOCUMENTOS SELECIONADOS PARA ENVIO";
+	}
+
+	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+
+	public override object ProvideValue(IServiceProvider serviceProvider)
+	{
+		return this;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Converters/VerApoliceComissaoConverter.cs b/Decompiler/Gestor.Application.Converters/VerApoliceComissaoConverter.cs
new file mode 100644
index 0000000..74eee1a
--- /dev/null
+++ b/Decompiler/Gestor.Application.Converters/VerApoliceComissaoConverter.cs
@@ -0,0 +1,34 @@
+using System;
+using System.Globalization;
+using System.Windows;
+using System.Windows.Data;
+
+namespace Gestor.Application.Converters;
+
+public class VerApoliceComissaoConverter : IMultiValueConverter
+{
+	public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
+	{
+		try
+		{
+			if (values[0] == null && values[1] == null)
+			{
+				return (object)(Visibility)2;
+			}
+			if ((long?)values[0] == 0 && (long?)values[1] == 0)
+			{
+				return (object)(Visibility)2;
+			}
+			return (object)(Visibility)0;
+		}
+		catch (Exception)
+		{
+			return (object)(Visibility)2;
+		}
+	}
+
+	public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
+	{
+		return null;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Drawers.Ajuda/BoletosNotasDrawerView.cs b/Decompiler/Gestor.Application.Drawers.Ajuda/BoletosNotasDrawerView.cs
new file mode 100644
index 0000000..98f8d04
--- /dev/null
+++ b/Decompiler/Gestor.Application.Drawers.Ajuda/BoletosNotasDrawerView.cs
@@ -0,0 +1,165 @@
+using System;
+using System.CodeDom.Compiler;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Markup;
+using Agger.Registro;
+using Gestor.Application.Helpers;
+using Gestor.Application.Model.Ajuda;
+using Gestor.Application.ViewModels.Drawer.Ajuda;
+using Gestor.Application.Views.Generic;
+
+namespace Gestor.Application.Drawers.Ajuda;
+
+public class BoletosNotasDrawerView : BaseUserControl, IComponentConnector, IStyleConnector
+{
+	internal ProgressBar ProgressBar;
+
+	internal ComboBox StatusCbo;
+
+	internal DataGrid BoletosGrid;
+
+	internal DataGridTemplateColumn BaixarBoletoColumn;
+
+	internal DataGridTextColumn PagamentoColumn;
+
+	internal ItemsControl BoletoDisponivel;
+
+	internal TextBlock TxtBoletoDisponivel;
+
+	private bool _contentLoaded;
+
+	public BoletosNotasViewModel ViewModel { get; set; }
+
+	public BoletosNotasDrawerView()
+	{
+		ViewModel = new BoletosNotasViewModel();
+		((FrameworkElement)this).DataContext = ViewModel;
+		InitializeComponent();
+		((Selector)StatusCbo).SelectedIndex = 0;
+	}
+
+	private void Fechar_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.CloseDrawer();
+	}
+
+	private void ExibirBoleto_OnClick(object sender, RoutedEventArgs e)
+	{
+		Boleto boleto = (Boleto)((Selector)BoletosGrid).SelectedItem;
+		if (!((boleto.Vencimento - Funcoes.GetNetworkTime()).TotalDays > 10.0))
+		{
+			Process.Start($"{Address.ApiBoletoAgger}billet/id/{boleto.IdBoleto}");
+		}
+	}
+
+	private void ExibirNota_OnClick(object sender, RoutedEventArgs e)
+	{
+		Process.Start(((Boleto)((Selector)BoletosGrid).SelectedItem).Nota ?? "");
+	}
+
+	private void SelectedStatus_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
+	{
+		if (((Selector)StatusCbo).SelectedItem != null)
+		{
+			ViewModel.WorkOnSelectedStatus(((Selector)StatusCbo).SelectedItem.ToString());
+			((DataGridColumn)PagamentoColumn).Visibility = (Visibility)((((Selector)StatusCbo).SelectedItem.ToString() == "PENDENTES") ? 2 : 0);
+			((DataGridColumn)BaixarBoletoColumn).Visibility = (Visibility)((!(((Selector)StatusCbo).SelectedItem.ToString() == "PENDENTES")) ? 2 : 0);
+			((UIElement)BoletoDisponivel).Visibility = (Visibility)((!(((Selector)StatusCbo).SelectedItem.ToString() == "PENDENTES")) ? 2 : 0);
+		}
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	public void InitializeComponent()
+	{
+		if (!_contentLoaded)
+		{
+			_contentLoaded = true;
+			Uri uri = new Uri("/Gestor.Application;component/drawers/ajuda/boletosnotasdrawerview.xaml", UriKind.Relative);
+			Application.LoadComponent((object)this, uri);
+		}
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	[EditorBrowsable(EditorBrowsableState.Never)]
+	void IComponentConnector.Connect(int connectionId, object target)
+	{
+		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0041: Expected O, but got Unknown
+		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
+		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0059: Expected O, but got Unknown
+		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0066: Expected O, but got Unknown
+		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
+		//IL_007d: Expected O, but got Unknown
+		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
+		//IL_008a: Expected O, but got Unknown
+		//IL_008d: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0097: Expected O, but got Unknown
+		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00a4: Expected O, but got Unknown
+		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00b1: Expected O, but got Unknown
+		//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00be: Expected O, but got Unknown
+		switch (connectionId)
+		{
+		case 1:
+			ProgressBar = (ProgressBar)target;
+			break;
+		case 2:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(Fechar_OnClick);
+			break;
+		case 3:
+			StatusCbo = (ComboBox)target;
+			((Selector)StatusCbo).SelectionChanged += new SelectionChangedEventHandler(SelectedStatus_OnSelectionChanged);
+			break;
+		case 4:
+			BoletosGrid = (DataGrid)target;
+			break;
+		case 5:
+			BaixarBoletoColumn = (DataGridTemplateColumn)target;
+			break;
+		case 8:
+			PagamentoColumn = (DataGridTextColumn)target;
+			break;
+		case 9:
+			BoletoDisponivel = (ItemsControl)target;
+			break;
+		case 10:
+			TxtBoletoDisponivel = (TextBlock)target;
+			break;
+		default:
+			_contentLoaded = true;
+			break;
+		}
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	[EditorBrowsable(EditorBrowsableState.Never)]
+	void IStyleConnector.Connect(int connectionId, object target)
+	{
+		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0020: Expected O, but got Unknown
+		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
+		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0038: Expected O, but got Unknown
+		switch (connectionId)
+		{
+		case 6:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExibirBoleto_OnClick);
+			break;
+		case 7:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExibirNota_OnClick);
+			break;
+		}
+	}
+}
diff --git a/Decompiler/Gestor.Application.Drawers.Ajuda/ContratosDrawerView.cs b/Decompiler/Gestor.Application.Drawers.Ajuda/ContratosDrawerView.cs
new file mode 100644
index 0000000..a75ade7
--- /dev/null
+++ b/Decompiler/Gestor.Application.Drawers.Ajuda/ContratosDrawerView.cs
@@ -0,0 +1,69 @@
+using System;
+using System.CodeDom.Compiler;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Markup;
+using Gestor.Application.ViewModels.Drawer.Ajuda;
+using Gestor.Application.Views.Generic;
+
+namespace Gestor.Application.Drawers.Ajuda;
+
+public class ContratosDrawerView : BaseUserControl, IComponentConnector
+{
+	internal DataGrid ContratosGrid;
+
+	private bool _contentLoaded;
+
+	public ContratosViewModel ViewModel { get; set; }
+
+	public ContratosDrawerView()
+	{
+		ViewModel = new ContratosViewModel();
+		((FrameworkElement)this).DataContext = ViewModel;
+		InitializeComponent();
+	}
+
+	private void Fechar_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.CloseDrawer();
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	public void InitializeComponent()
+	{
+		if (!_contentLoaded)
+		{
+			_contentLoaded = true;
+			Uri uri = new Uri("/Gestor.Application;component/drawers/ajuda/contratosdrawerview.xaml", UriKind.Relative);
+			Application.LoadComponent((object)this, uri);
+		}
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	[EditorBrowsable(EditorBrowsableState.Never)]
+	void IComponentConnector.Connect(int connectionId, object target)
+	{
+		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0021: Expected O, but got Unknown
+		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
+		//IL_002e: Expected O, but got Unknown
+		switch (connectionId)
+		{
+		case 1:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(Fechar_OnClick);
+			break;
+		case 2:
+			ContratosGrid = (DataGrid)target;
+			break;
+		default:
+			_contentLoaded = true;
+			break;
+		}
+	}
+}
diff --git a/Decompiler/Gestor.Application.Drawers.Ajuda/InstalacaoDrawerView.cs b/Decompiler/Gestor.Application.Drawers.Ajuda/InstalacaoDrawerView.cs
new file mode 100644
index 0000000..81ecca5
--- /dev/null
+++ b/Decompiler/Gestor.Application.Drawers.Ajuda/InstalacaoDrawerView.cs
@@ -0,0 +1,175 @@
+using System;
+using System.CodeDom.Compiler;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Markup;
+using Gestor.Application.Model.Ajuda;
+using Gestor.Application.ViewModels.Drawer.Ajuda;
+using Gestor.Application.Views.Generic;
+using Gestor.Common.Validation;
+
+namespace Gestor.Application.Drawers.Ajuda;
+
+public class InstalacaoDrawerView : BaseUserControl, IComponentConnector, IStyleConnector
+{
+	internal ProgressBar ProgressBar;
+
+	internal DataGrid GestorGrid;
+
+	internal DataGrid AggilizadorGrid;
+
+	private bool _contentLoaded;
+
+	public InstalacaoViewModel ViewModel { get; set; }
+
+	public InstalacaoDrawerView()
+	{
+		ViewModel = new InstalacaoViewModel();
+		((FrameworkElement)this).DataContext = ViewModel;
+		InitializeComponent();
+	}
+
+	private void Fechar_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.CloseDrawer();
+	}
+
+	private async void ExcluirInstalacaoGestorGrid_OnClick(object sender, RoutedEventArgs e)
+	{
+		if (((Selector)GestorGrid).SelectedItem != null)
+		{
+			Instalacao instalacao = (Instalacao)((Selector)GestorGrid).SelectedItem;
+			if (await ViewModel.ShowMessage("DESEJA REALMENTE EXCLUIR A INSTALAÇÃO DA MÁQUINA " + instalacao.Maquina.ToUpper(), "SIM", "NÃO"))
+			{
+				ViewModel.Excluir(instalacao.Id);
+			}
+		}
+	}
+
+	private async void ExcluirInstalacaoAggilizadorGrid_OnClick(object sender, RoutedEventArgs e)
+	{
+		if (((Selector)AggilizadorGrid).SelectedItem != null)
+		{
+			Instalacao instalacao = (Instalacao)((Selector)AggilizadorGrid).SelectedItem;
+			if (await ViewModel.ShowMessage("DESEJA REALMENTE EXCLUIR A INSTALAÇÃO DA MÁQUINA " + instalacao.Maquina.ToUpper(), "SIM", "NÃO"))
+			{
+				ViewModel.Excluir(instalacao.Id);
+			}
+		}
+	}
+
+	private void AutoCompleteBox_Populating(object sender, PopulatingEventArgs e)
+	{
+		e.Cancel = true;
+		ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task> searchResult)
+		{
+			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
+			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
+			if (searchResult.Result != null)
+			{
+				AutoCompleteBox val = (AutoCompleteBox)sender;
+				val.ItemsSource = searchResult.Result;
+				val.PopulateComplete();
+			}
+		}, TaskScheduler.FromCurrentSynchronizationContext());
+	}
+
+	private void AutoCompleteBox_OnTextChanged(object sender, RoutedEventArgs e)
+	{
+		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
+		if (string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).Text))
+		{
+			ViewModel.FiltrarInstalacao("");
+		}
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	public void InitializeComponent()
+	{
+		if (!_contentLoaded)
+		{
+			_contentLoaded = true;
+			Uri uri = new Uri("/Gestor.Application;component/drawers/ajuda/instalacaodrawerview.xaml", UriKind.Relative);
+			Application.LoadComponent((object)this, uri);
+		}
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	internal Delegate _CreateDelegate(Type delegateType, string handler)
+	{
+		return Delegate.CreateDelegate(delegateType, this, handler);
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	[EditorBrowsable(EditorBrowsableState.Never)]
+	void IComponentConnector.Connect(int connectionId, object target)
+	{
+		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
+		//IL_002e: Expected O, but got Unknown
+		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
+		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0046: Expected O, but got Unknown
+		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
+		//IL_005e: Expected O, but got Unknown
+		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
+		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0075: Expected O, but got Unknown
+		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0082: Expected O, but got Unknown
+		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
+		//IL_008f: Expected O, but got Unknown
+		switch (connectionId)
+		{
+		case 1:
+			ProgressBar = (ProgressBar)target;
+			break;
+		case 2:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(Fechar_OnClick);
+			break;
+		case 3:
+			((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBox_Populating);
+			((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBox_OnTextChanged);
+			break;
+		case 4:
+			GestorGrid = (DataGrid)target;
+			break;
+		case 6:
+			AggilizadorGrid = (DataGrid)target;
+			break;
+		default:
+			_contentLoaded = true;
+			break;
+		}
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	[EditorBrowsable(EditorBrowsableState.Never)]
+	void IStyleConnector.Connect(int connectionId, object target)
+	{
+		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0020: Expected O, but got Unknown
+		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
+		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0038: Expected O, but got Unknown
+		switch (connectionId)
+		{
+		case 5:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirInstalacaoGestorGrid_OnClick);
+			break;
+		case 7:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirInstalacaoAggilizadorGrid_OnClick);
+			break;
+		}
+	}
+}
diff --git a/Decompiler/Gestor.Application.Drawers.Configuracoes/ConfiguracoesDrawer.cs b/Decompiler/Gestor.Application.Drawers.Configuracoes/ConfiguracoesDrawer.cs
new file mode 100644
index 0000000..97204df
--- /dev/null
+++ b/Decompiler/Gestor.Application.Drawers.Configuracoes/ConfiguracoesDrawer.cs
@@ -0,0 +1,161 @@
+using System;
+using System.CodeDom.Compiler;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Markup;
+using System.Windows.Threading;
+using Gestor.Application.ViewModels.Configuracoes;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Configuracoes;
+
+namespace Gestor.Application.Drawers.Configuracoes;
+
+public class ConfiguracoesDrawer : UserControl, IComponentConnector, IStyleConnector
+{
+	internal ProgressBar ProgressBar;
+
+	internal DataGrid VendedorGrid;
+
+	private bool _contentLoaded;
+
+	private ConfiguracoesViewModel ViewModel { get; }
+
+	public ConfiguracoesDrawer()
+	{
+		ViewModel = new ConfiguracoesViewModel();
+		((FrameworkElement)this).DataContext = ViewModel;
+		InitializeComponent();
+		Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher;
+		if (dispatcher != null)
+		{
+			dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad));
+		}
+	}
+
+	private async void ContentLoad()
+	{
+		ViewModel.Carregando = true;
+		await ViewModel.BuscarConfiguracoes();
+		ViewModel.Carregando = false;
+	}
+
+	private void Fechar_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.CloseDrawer();
+	}
+
+	private async void AdicionarConfiguracao_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.Carregando = true;
+		if ((int)ViewModel.SelectedConfiguracao == 15 || (int)ViewModel.SelectedConfiguracao == 26 || (int)ViewModel.SelectedConfiguracao == 34 || (int)ViewModel.SelectedConfiguracao == 53)
+		{
+			bool? flag = await ViewModel.ShowSenha("OPÇÃO RESTRITA A ADMINISTRADORES DO SISTEMA, PREENCHA A SENHA ADM PARA PROSSEGUIR.");
+			if (!flag.HasValue)
+			{
+				ViewModel.Carregando = false;
+				return;
+			}
+			if (!flag.GetValueOrDefault())
+			{
+				await ViewModel.ShowMessage("SENHA INVÁLIDA");
+				ViewModel.Carregando = false;
+				return;
+			}
+		}
+		await ViewModel.Salvar();
+		ViewModel.Carregando = false;
+	}
+
+	private async void ExcluirConfiguracao_OnClick(object sender, RoutedEventArgs e)
+	{
+		Button val = (Button)sender;
+		if (val != null && ((FrameworkElement)val).DataContext != null)
+		{
+			ViewModel.Carregando = true;
+			await ViewModel.Excluir((ConfiguracaoSistema)((FrameworkElement)val).DataContext);
+			ViewModel.Carregando = false;
+		}
+	}
+
+	private void AbrirLog_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.AbrirLog((TipoTela)50, 0L);
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	public void InitializeComponent()
+	{
+		if (!_contentLoaded)
+		{
+			_contentLoaded = true;
+			Uri uri = new Uri("/Gestor.Application;component/drawers/configuracoes/configuracoesdrawer.xaml", UriKind.Relative);
+			Application.LoadComponent((object)this, uri);
+		}
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	internal Delegate _CreateDelegate(Type delegateType, string handler)
+	{
+		return Delegate.CreateDelegate(delegateType, this, handler);
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	[EditorBrowsable(EditorBrowsableState.Never)]
+	void IComponentConnector.Connect(int connectionId, object target)
+	{
+		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
+		//IL_002a: Expected O, but got Unknown
+		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0042: Expected O, but got Unknown
+		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
+		//IL_005a: Expected O, but got Unknown
+		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0072: Expected O, but got Unknown
+		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
+		//IL_007f: Expected O, but got Unknown
+		switch (connectionId)
+		{
+		case 1:
+			ProgressBar = (ProgressBar)target;
+			break;
+		case 2:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(Fechar_OnClick);
+			break;
+		case 3:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(AbrirLog_OnClick);
+			break;
+		case 4:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(AdicionarConfiguracao_OnClick);
+			break;
+		case 5:
+			VendedorGrid = (DataGrid)target;
+			break;
+		default:
+			_contentLoaded = true;
+			break;
+		}
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	[EditorBrowsable(EditorBrowsableState.Never)]
+	void IStyleConnector.Connect(int connectionId, object target)
+	{
+		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
+		//IL_001b: Expected O, but got Unknown
+		if (connectionId == 6)
+		{
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirConfiguracao_OnClick);
+		}
+	}
+}
diff --git a/Decompiler/Gestor.Application.Drawers.Relatorios/ConfiguracaoRelatorio.cs b/Decompiler/Gestor.Application.Drawers.Relatorios/ConfiguracaoRelatorio.cs
new file mode 100644
index 0000000..afe9d1c
--- /dev/null
+++ b/Decompiler/Gestor.Application.Drawers.Relatorios/ConfiguracaoRelatorio.cs
@@ -0,0 +1,324 @@
+using System;
+using System.CodeDom.Compiler;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Markup;
+using System.Windows.Threading;
+using Gestor.Application.ViewModels.Relatorios;
+using Gestor.Model.Domain.Relatorios;
+using MaterialDesignThemes.Wpf;
+
+namespace Gestor.Application.Drawers.Relatorios;
+
+public class ConfiguracaoRelatorio : UserControl, IComponentConnector, IStyleConnector
+{
+	internal ProgressBar ProgressBar;
+
+	internal RadioButton CampoButton;
+
+	internal RadioButton TotalizacaoButton;
+
+	internal ComboBox CampoComboBox;
+
+	internal ComboBox TotalizacaoComboBox;
+
+	internal DataGrid ParametrosGrid;
+
+	internal DataGrid TotalizacaoGrid;
+
+	internal Snackbar SnackbarArquivoDigital;
+
+	private bool _contentLoaded;
+
+	public RelatorioViewModel ViewModel { get; set; }
+
+	public ConfiguracaoRelatorio(RelatorioViewModel viewModel)
+	{
+		ViewModel = viewModel;
+		((FrameworkElement)this).DataContext = ViewModel;
+		InitializeComponent();
+		Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher;
+		if (dispatcher != null)
+		{
+			dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad));
+		}
+	}
+
+	private async void ContentLoad()
+	{
+		((ToggleButton)CampoButton).IsChecked = ViewModel.IsCampo;
+		((ToggleButton)TotalizacaoButton).IsChecked = !ViewModel.IsCampo;
+		((ToggleButton)CampoButton).Checked += new RoutedEventHandler(Campo_OnChecked);
+		((ToggleButton)TotalizacaoButton).Checked += new RoutedEventHandler(Totalizacao_OnChecked);
+		ViewModel.IsEnabled = false;
+		await ViewModel.CarregarConfiguracoes();
+		ViewModel.IsEnabled = true;
+	}
+
+	private void Campo_OnChecked(object sender, RoutedEventArgs e)
+	{
+		ViewModel.IsCampo = true;
+	}
+
+	private void Totalizacao_OnChecked(object sender, RoutedEventArgs e)
+	{
+		ViewModel.IsCampo = false;
+	}
+
+	private void Fechar_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.CloseDrawer();
+	}
+
+	private async void Salvar_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.IsEnabled = false;
+		bool num = await ViewModel.SalvarParametros();
+		ViewModel.IsEnabled = true;
+		if (num)
+		{
+			Toggle("CONFIGURAÇÕES SALVAS.");
+		}
+	}
+
+	private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e)
+	{
+		SnackbarArquivoDigital.IsActive = false;
+	}
+
+	public void Toggle(string message, bool active = true)
+	{
+		((ContentControl)SnackbarArquivoDigital.Message).Content = message;
+		SnackbarArquivoDigital.IsActive = active;
+		if (active)
+		{
+			Task.Factory.StartNew(CloseSlackBar);
+		}
+	}
+
+	private void CloseSlackBar()
+	{
+		Thread.Sleep(5000);
+		Dispatcher dispatcher = ((DispatcherObject)App.ProgressRing).Dispatcher;
+		if (dispatcher != null)
+		{
+			dispatcher.BeginInvoke((DispatcherPriority)4, (Delegate)(Action)delegate
+			{
+				Toggle("", active: false);
+			});
+		}
+	}
+
+	private void AdicionarParametro_OnClick(object sender, RoutedEventArgs e)
+	{
+		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0032: Expected O, but got Unknown
+		RelatorioViewModel viewModel = ViewModel;
+		ComboBox campoComboBox = CampoComboBox;
+		viewModel.AdicionarParametro((ParametrosRelatorio)((campoComboBox != null) ? ((ItemsControl)campoComboBox).Items[((Selector)CampoComboBox).SelectedIndex] : null));
+	}
+
+	private void ExcluirParametro_OnClick(object sender, RoutedEventArgs e)
+	{
+		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
+		//IL_004a: Expected O, but got Unknown
+		DataGrid parametrosGrid = ParametrosGrid;
+		if (parametrosGrid == null || ((Selector)parametrosGrid).SelectedIndex >= 0)
+		{
+			RelatorioViewModel viewModel = ViewModel;
+			DataGrid parametrosGrid2 = ParametrosGrid;
+			viewModel.ExcluirParametro((ParametrosRelatorio)((parametrosGrid2 != null) ? ((ItemsControl)parametrosGrid2).Items[((Selector)ParametrosGrid).SelectedIndex] : null));
+		}
+	}
+
+	private void SubirParametro_OnClick(object sender, RoutedEventArgs e)
+	{
+		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
+		//IL_004a: Expected O, but got Unknown
+		DataGrid parametrosGrid = ParametrosGrid;
+		if (parametrosGrid == null || ((Selector)parametrosGrid).SelectedIndex >= 0)
+		{
+			RelatorioViewModel viewModel = ViewModel;
+			DataGrid parametrosGrid2 = ParametrosGrid;
+			viewModel.SubirParametro((ParametrosRelatorio)((parametrosGrid2 != null) ? ((ItemsControl)parametrosGrid2).Items[((Selector)ParametrosGrid).SelectedIndex] : null));
+		}
+	}
+
+	private void DescerParametro_OnClick(object sender, RoutedEventArgs e)
+	{
+		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
+		//IL_004a: Expected O, but got Unknown
+		DataGrid parametrosGrid = ParametrosGrid;
+		if (parametrosGrid == null || ((Selector)parametrosGrid).SelectedIndex >= 0)
+		{
+			RelatorioViewModel viewModel = ViewModel;
+			DataGrid parametrosGrid2 = ParametrosGrid;
+			viewModel.DescerParametro((ParametrosRelatorio)((parametrosGrid2 != null) ? ((ItemsControl)parametrosGrid2).Items[((Selector)ParametrosGrid).SelectedIndex] : null));
+		}
+	}
+
+	private void AdicionarTotalizacao_OnClick(object sender, RoutedEventArgs e)
+	{
+		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0032: Expected O, but got Unknown
+		RelatorioViewModel viewModel = ViewModel;
+		ComboBox totalizacaoComboBox = TotalizacaoComboBox;
+		viewModel.AdicionarTotalizacao((ParametrosTotalizacao)((totalizacaoComboBox != null) ? ((ItemsControl)totalizacaoComboBox).Items[((Selector)TotalizacaoComboBox).SelectedIndex] : null));
+	}
+
+	private void ExcluirTotalizacao_OnClick(object sender, RoutedEventArgs e)
+	{
+		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
+		//IL_004a: Expected O, but got Unknown
+		DataGrid totalizacaoGrid = TotalizacaoGrid;
+		if (totalizacaoGrid == null || ((Selector)totalizacaoGrid).SelectedIndex >= 0)
+		{
+			RelatorioViewModel viewModel = ViewModel;
+			DataGrid totalizacaoGrid2 = TotalizacaoGrid;
+			viewModel.ExcluirTotalizacao((ParametrosTotalizacao)((totalizacaoGrid2 != null) ? ((ItemsControl)totalizacaoGrid2).Items[((Selector)TotalizacaoGrid).SelectedIndex] : null));
+		}
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	public void InitializeComponent()
+	{
+		if (!_contentLoaded)
+		{
+			_contentLoaded = true;
+			Uri uri = new Uri("/Gestor.Application;component/drawers/relatorios/configuracaorelatorio.xaml", UriKind.Relative);
+			Application.LoadComponent((object)this, uri);
+		}
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	internal Delegate _CreateDelegate(Type delegateType, string handler)
+	{
+		return Delegate.CreateDelegate(delegateType, this, handler);
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	[EditorBrowsable(EditorBrowsableState.Never)]
+	void IComponentConnector.Connect(int connectionId, object target)
+	{
+		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
+		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0068: Expected O, but got Unknown
+		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0075: Expected O, but got Unknown
+		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0082: Expected O, but got Unknown
+		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
+		//IL_008f: Expected O, but got Unknown
+		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
+		//IL_009c: Expected O, but got Unknown
+		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00b4: Expected O, but got Unknown
+		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00c1: Expected O, but got Unknown
+		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00d9: Expected O, but got Unknown
+		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00e6: Expected O, but got Unknown
+		//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00f3: Expected O, but got Unknown
+		//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
+		//IL_010b: Expected O, but got Unknown
+		//IL_010e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0118: Expected O, but got Unknown
+		//IL_011a: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0126: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0130: Expected O, but got Unknown
+		switch (connectionId)
+		{
+		case 1:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(Fechar_OnClick);
+			break;
+		case 2:
+			ProgressBar = (ProgressBar)target;
+			break;
+		case 3:
+			CampoButton = (RadioButton)target;
+			break;
+		case 4:
+			TotalizacaoButton = (RadioButton)target;
+			break;
+		case 5:
+			CampoComboBox = (ComboBox)target;
+			break;
+		case 6:
+			((MenuItem)target).Click += new RoutedEventHandler(AdicionarParametro_OnClick);
+			break;
+		case 7:
+			TotalizacaoComboBox = (ComboBox)target;
+			break;
+		case 8:
+			((MenuItem)target).Click += new RoutedEventHandler(AdicionarTotalizacao_OnClick);
+			break;
+		case 9:
+			ParametrosGrid = (DataGrid)target;
+			break;
+		case 13:
+			TotalizacaoGrid = (DataGrid)target;
+			break;
+		case 15:
+			((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick);
+			break;
+		case 16:
+			SnackbarArquivoDigital = (Snackbar)target;
+			break;
+		case 17:
+			((SnackbarMessage)target).ActionClick += new RoutedEventHandler(SnackbarMessage_ActionClick);
+			break;
+		default:
+			_contentLoaded = true;
+			break;
+		}
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	[EditorBrowsable(EditorBrowsableState.Never)]
+	void IStyleConnector.Connect(int connectionId, object target)
+	{
+		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
+		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0035: Expected O, but got Unknown
+		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
+		//IL_004d: Expected O, but got Unknown
+		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
+		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0065: Expected O, but got Unknown
+		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
+		//IL_007d: Expected O, but got Unknown
+		switch (connectionId)
+		{
+		case 10:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(SubirParametro_OnClick);
+			break;
+		case 11:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(DescerParametro_OnClick);
+			break;
+		case 12:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirParametro_OnClick);
+			break;
+		case 14:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirTotalizacao_OnClick);
+			break;
+		case 13:
+			break;
+		}
+	}
+}
diff --git a/Decompiler/Gestor.Application.Drawers.Relatorios/FiltroRelatorio.cs b/Decompiler/Gestor.Application.Drawers.Relatorios/FiltroRelatorio.cs
new file mode 100644
index 0000000..72c0994
--- /dev/null
+++ b/Decompiler/Gestor.Application.Drawers.Relatorios/FiltroRelatorio.cs
@@ -0,0 +1,155 @@
+using System;
+using System.CodeDom.Compiler;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Markup;
+using Gestor.Application.ViewModels.Relatorios;
+using Gestor.Model.Common;
+using MaterialDesignThemes.Wpf;
+
+namespace Gestor.Application.Drawers.Relatorios;
+
+public class FiltroRelatorio : UserControl, IComponentConnector
+{
+	private RelatorioViewModel ViewModel;
+
+	internal MaterialDataGridTextColumn IdField;
+
+	internal MaterialDataGridTextColumn NomeField;
+
+	internal MaterialDataGridTextColumn ApelidoField;
+
+	internal DataGrid RamosGrid;
+
+	internal DataGrid VendedorGrid;
+
+	internal DataGrid TipoSeguroGrid;
+
+	internal DataGrid TipoVendedorGrid;
+
+	internal DataGrid NegocioGrid;
+
+	internal DataGrid ProdutoGrid;
+
+	internal DataGrid EstipulanteGrid;
+
+	private bool _contentLoaded;
+
+	public FiltroRelatorio(RelatorioViewModel viewModel, Relatorio relatorio)
+	{
+		//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00d3: Invalid comparison between Unknown and I4
+		ViewModel = viewModel;
+		((FrameworkElement)this).DataContext = ViewModel;
+		InitializeComponent();
+		viewModel.ReloadVendedores();
+		((UIElement)VendedorGrid).Visibility = (Visibility)((viewModel.Vendedores.Count <= 0) ? 2 : 0);
+		((UIElement)EstipulanteGrid).Visibility = (Visibility)((viewModel.Estipulantes.Count <= 0) ? 2 : 0);
+		((UIElement)ProdutoGrid).Visibility = (Visibility)((viewModel.Produtos.Count <= 0) ? 2 : 0);
+		((DataGridColumn)IdField).Visibility = (Visibility)(ViewModel.Apelido ? 2 : 0);
+		((DataGridColumn)NomeField).Visibility = (Visibility)(ViewModel.Apelido ? 2 : 0);
+		((DataGridColumn)ApelidoField).Visibility = (Visibility)((!ViewModel.Apelido) ? 2 : 0);
+		if ((int)relatorio == 19)
+		{
+			((UIElement)RamosGrid).Visibility = (Visibility)2;
+			((UIElement)TipoSeguroGrid).Visibility = (Visibility)2;
+			((UIElement)VendedorGrid).Visibility = (Visibility)2;
+			((UIElement)EstipulanteGrid).Visibility = (Visibility)2;
+			((UIElement)ProdutoGrid).Visibility = (Visibility)2;
+			((UIElement)TipoVendedorGrid).Visibility = (Visibility)2;
+			((UIElement)NegocioGrid).Visibility = (Visibility)2;
+		}
+		ViewModel.EnableMenu = true;
+	}
+
+	private void Fechar_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.Filtro = "";
+		ViewModel.AdicionarFiltros();
+		ViewModel.CloseDrawer();
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	public void InitializeComponent()
+	{
+		if (!_contentLoaded)
+		{
+			_contentLoaded = true;
+			Uri uri = new Uri("/Gestor.Application;component/drawers/relatorios/filtrorelatorio.xaml", UriKind.Relative);
+			Application.LoadComponent((object)this, uri);
+		}
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	[EditorBrowsable(EditorBrowsableState.Never)]
+	void IComponentConnector.Connect(int connectionId, object target)
+	{
+		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0050: Expected O, but got Unknown
+		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
+		//IL_005d: Expected O, but got Unknown
+		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
+		//IL_006a: Expected O, but got Unknown
+		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0077: Expected O, but got Unknown
+		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0084: Expected O, but got Unknown
+		//IL_0087: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0091: Expected O, but got Unknown
+		//IL_0094: Unknown result type (might be due to invalid IL or missing references)
+		//IL_009e: Expected O, but got Unknown
+		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00ab: Expected O, but got Unknown
+		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00b8: Expected O, but got Unknown
+		//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00c5: Expected O, but got Unknown
+		//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00d2: Expected O, but got Unknown
+		switch (connectionId)
+		{
+		case 1:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(Fechar_OnClick);
+			break;
+		case 2:
+			IdField = (MaterialDataGridTextColumn)target;
+			break;
+		case 3:
+			NomeField = (MaterialDataGridTextColumn)target;
+			break;
+		case 4:
+			ApelidoField = (MaterialDataGridTextColumn)target;
+			break;
+		case 5:
+			RamosGrid = (DataGrid)target;
+			break;
+		case 6:
+			VendedorGrid = (DataGrid)target;
+			break;
+		case 7:
+			TipoSeguroGrid = (DataGrid)target;
+			break;
+		case 8:
+			TipoVendedorGrid = (DataGrid)target;
+			break;
+		case 9:
+			NegocioGrid = (DataGrid)target;
+			break;
+		case 10:
+			ProdutoGrid = (DataGrid)target;
+			break;
+		case 11:
+			EstipulanteGrid = (DataGrid)target;
+			break;
+		default:
+			_contentLoaded = true;
+			break;
+		}
+	}
+}
diff --git a/Decompiler/Gestor.Application.Drawers/AdiantamentoDrawerView.cs b/Decompiler/Gestor.Application.Drawers/AdiantamentoDrawerView.cs
new file mode 100644
index 0000000..74ea3b8
--- /dev/null
+++ b/Decompiler/Gestor.Application.Drawers/AdiantamentoDrawerView.cs
@@ -0,0 +1,255 @@
+using System;
+using System.CodeDom.Compiler;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Data;
+using System.Windows.Input;
+using System.Windows.Markup;
+using System.Windows.Threading;
+using CurrencyTextBoxControl;
+using Gestor.Application.Helpers;
+using Gestor.Application.ViewModels.Drawer;
+using Gestor.Application.Views.Generic;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Domain.Seguros;
+using MaterialDesignThemes.Wpf;
+
+namespace Gestor.Application.Drawers;
+
+public class AdiantamentoDrawerView : BaseUserControl, IComponentConnector
+{
+	internal ProgressBar ProgressBar;
+
+	internal DataGrid AdiantamentoGrid;
+
+	internal CurrencyTextBox RendaMensalBox;
+
+	internal Snackbar Snackbar;
+
+	private bool _contentLoaded;
+
+	public AdiantamentoViewModel ViewModel { get; set; }
+
+	public AdiantamentoDrawerView(Vendedor vendedor)
+	{
+		ViewModel = new AdiantamentoViewModel(vendedor);
+		((FrameworkElement)this).DataContext = ViewModel;
+		InitializeComponent();
+	}
+
+	private async void MenuList_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
+	{
+		ListBox val = (ListBox)sender;
+		if (((Selector)val).SelectedItem != null)
+		{
+			await ViewModel.CarregarAdiantamento(((Selector)val).SelectedIndex);
+		}
+	}
+
+	private void Fechar_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.CloseDrawer();
+	}
+
+	private void Incluir_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.Incluir();
+	}
+
+	private void Alterar_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.Alterar(alterar: true);
+	}
+
+	private async void Salvar_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.Carregando = true;
+		List> list = await ViewModel.Salvar();
+		((DependencyObject)(object)this).ValidateFields(list);
+		bool num = list == null || list.Count == 0;
+		((CollectionView)((ItemsControl)AdiantamentoGrid).Items).Refresh();
+		ViewModel.Carregando = false;
+		ViewModel.Loading(isLoading: false);
+		if (num)
+		{
+			ToggleSnackBar("ADIANTAMENTO SALVO COM SUCESSO");
+		}
+		else
+		{
+			await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK");
+		}
+	}
+
+	public void ToggleSnackBar(string message, bool active = true)
+	{
+		((ContentControl)Snackbar.Message).Content = message;
+		Snackbar.IsActive = active;
+		if (active)
+		{
+			Task.Factory.StartNew(CloseSlackBar);
+		}
+	}
+
+	private void CloseSlackBar()
+	{
+		Thread.Sleep(5000);
+		Dispatcher dispatcher = ((DispatcherObject)ProgressBar).Dispatcher;
+		if (dispatcher != null)
+		{
+			dispatcher.BeginInvoke((DispatcherPriority)4, (Delegate)(Action)delegate
+			{
+				ToggleSnackBar("", active: false);
+			});
+		}
+	}
+
+	private void Cancelar_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.CancelarAlteracao();
+	}
+
+	private async void Excluir_OnClick(object sender, RoutedEventArgs e)
+	{
+		if (await ViewModel.Excluir())
+		{
+			ToggleSnackBar("ADIANTAMENTO EXCLUÍDO COM SUCESSO");
+		}
+	}
+
+	private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e)
+	{
+		Snackbar.IsActive = false;
+	}
+
+	private void AbrirLog_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.AbrirLog((TipoTela)36, ((DomainBase)ViewModel.SelectedAdiantamento).Id);
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	public void InitializeComponent()
+	{
+		if (!_contentLoaded)
+		{
+			_contentLoaded = true;
+			Uri uri = new Uri("/Gestor.Application;component/drawers/adiantamentodrawerview.xaml", UriKind.Relative);
+			Application.LoadComponent((object)this, uri);
+		}
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	internal Delegate _CreateDelegate(Type delegateType, string handler)
+	{
+		return Delegate.CreateDelegate(delegateType, this, handler);
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	[EditorBrowsable(EditorBrowsableState.Never)]
+	void IComponentConnector.Connect(int connectionId, object target)
+	{
+		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0051: Expected O, but got Unknown
+		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
+		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0069: Expected O, but got Unknown
+		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0081: Expected O, but got Unknown
+		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
+		//IL_008e: Expected O, but got Unknown
+		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
+		//IL_009c: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00a6: Expected O, but got Unknown
+		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00be: Expected O, but got Unknown
+		//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00d6: Expected O, but got Unknown
+		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00ee: Expected O, but got Unknown
+		//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0106: Expected O, but got Unknown
+		//IL_0108: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0114: Unknown result type (might be due to invalid IL or missing references)
+		//IL_011e: Expected O, but got Unknown
+		//IL_0120: Unknown result type (might be due to invalid IL or missing references)
+		//IL_012c: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0136: Expected O, but got Unknown
+		//IL_0137: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0143: Unknown result type (might be due to invalid IL or missing references)
+		//IL_014d: Expected O, but got Unknown
+		//IL_014e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_015a: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0164: Expected O, but got Unknown
+		//IL_0167: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0171: Expected O, but got Unknown
+		//IL_0174: Unknown result type (might be due to invalid IL or missing references)
+		//IL_017e: Expected O, but got Unknown
+		//IL_0180: Unknown result type (might be due to invalid IL or missing references)
+		//IL_018c: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0196: Expected O, but got Unknown
+		switch (connectionId)
+		{
+		case 1:
+			ProgressBar = (ProgressBar)target;
+			break;
+		case 2:
+			((Selector)(ListBox)target).SelectionChanged += new SelectionChangedEventHandler(MenuList_OnSelectionChanged);
+			break;
+		case 3:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(Fechar_OnClick);
+			break;
+		case 4:
+			AdiantamentoGrid = (DataGrid)target;
+			break;
+		case 5:
+			((MenuItem)target).Click += new RoutedEventHandler(Incluir_OnClick);
+			break;
+		case 6:
+			((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick);
+			break;
+		case 7:
+			((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick);
+			break;
+		case 8:
+			((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick);
+			break;
+		case 9:
+			((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick);
+			break;
+		case 10:
+			((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick);
+			break;
+		case 11:
+			((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus);
+			((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick);
+			((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown);
+			break;
+		case 12:
+			RendaMensalBox = (CurrencyTextBox)target;
+			break;
+		case 13:
+			Snackbar = (Snackbar)target;
+			break;
+		case 14:
+			((SnackbarMessage)target).ActionClick += new RoutedEventHandler(SnackbarMessage_ActionClick);
+			break;
+		default:
+			_contentLoaded = true;
+			break;
+		}
+	}
+}
diff --git a/Decompiler/Gestor.Application.Drawers/AgendaDrawer.cs b/Decompiler/Gestor.Application.Drawers/AgendaDrawer.cs
new file mode 100644
index 0000000..3880f6e
--- /dev/null
+++ b/Decompiler/Gestor.Application.Drawers/AgendaDrawer.cs
@@ -0,0 +1,605 @@
+using System;
+using System.CodeDom.Compiler;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Linq;
+using System.Runtime.CompilerServices;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Data;
+using System.Windows.Input;
+using System.Windows.Markup;
+using System.Windows.Threading;
+using Gestor.Application.Componentes;
+using Gestor.Application.Helpers;
+using Gestor.Application.ViewModels.Drawer;
+using Gestor.Application.Views.Generic;
+using Gestor.Common.Helpers;
+using Gestor.Common.Validation;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Ferramentas;
+using Gestor.Model.Domain.Generic;
+using MaterialDesignThemes.Wpf;
+using Xceed.Wpf.AvalonDock.Controls;
+
+namespace Gestor.Application.Drawers;
+
+public class AgendaDrawer : BaseUserControl, IComponentConnector, IStyleConnector
+{
+	[Serializable]
+	[CompilerGenerated]
+	private sealed class _003C_003Ec
+	{
+		public static readonly _003C_003Ec _003C_003E9 = new _003C_003Ec();
+
+		public static MouseButtonEventHandler _003C_003E9__4_0;
+
+		internal void _003CContentLoad_003Eb__4_0(object sender, MouseButtonEventArgs args)
+		{
+		}
+	}
+
+	internal ProgressBar ProgressBar;
+
+	internal DataGrid AgendaGrid;
+
+	internal MenuItem MaisOpcoesButton;
+
+	internal TextBox NomeBox;
+
+	internal TextBox CepBox;
+
+	internal ProgressBar ProgressCep;
+
+	internal TextBox EnderecoBox;
+
+	internal TextBox BairroBox;
+
+	internal TextBox CidadeBox;
+
+	internal TextBox EstadoBox;
+
+	internal TextBox ObsBox;
+
+	internal ListBox TelefoneListBox;
+
+	internal ListBox EmailListBox;
+
+	internal Snackbar Snackbar;
+
+	private bool _contentLoaded;
+
+	private AgendaViewModel ViewModel { get; }
+
+	public AgendaDrawer()
+	{
+		ViewModel = new AgendaViewModel();
+		((FrameworkElement)this).DataContext = ViewModel;
+		InitializeComponent();
+		Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher;
+		if (dispatcher != null)
+		{
+			dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad));
+		}
+	}
+
+	private void ContentLoad()
+	{
+		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0023: Expected O, but got Unknown
+		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0048: Expected O, but got Unknown
+		((Selector)AgendaGrid).SelectedIndex = 0;
+		((Selector)AgendaGrid).SelectionChanged += new SelectionChangedEventHandler(AgendaGrid_OnSelectionChanged);
+		DataGrid agendaGrid = AgendaGrid;
+		object obj = _003C_003Ec._003C_003E9__4_0;
+		if (obj == null)
+		{
+			MouseButtonEventHandler val = delegate
+			{
+			};
+			_003C_003Ec._003C_003E9__4_0 = val;
+			obj = (object)val;
+		}
+		((Control)agendaGrid).MouseDoubleClick += (MouseButtonEventHandler)obj;
+		ViewModel.PermissaoWhatsapp = ViewModel.Restricao((TipoRestricao)32);
+	}
+
+	private void Fechar_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.CloseDrawer();
+	}
+
+	private void Incluir_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.Incluir();
+		List> errorMessages = ViewModel.SelectedAgenda.Validate();
+		((DependencyObject)(object)this).ValidateFields(errorMessages);
+	}
+
+	private void IncluirEmail_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.IncluirEmail();
+	}
+
+	private void ExcluirEmail_OnClick(object sender, RoutedEventArgs e)
+	{
+		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0034: Expected O, but got Unknown
+		Button val = (Button)((sender is Button) ? sender : null);
+		if (val != null)
+		{
+			ListBox val2 = Extentions.FindVisualAncestor((DependencyObject)(object)val);
+			AgendaEmail email = (AgendaEmail)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)];
+			ViewModel.ExcluirEmail(email);
+		}
+	}
+
+	private void IncluirTelefone_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.IncluirTelefone();
+	}
+
+	private void ExcluirTelefone_OnClick(object sender, RoutedEventArgs e)
+	{
+		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0034: Expected O, but got Unknown
+		Button val = (Button)((sender is Button) ? sender : null);
+		if (val != null)
+		{
+			ListBox val2 = Extentions.FindVisualAncestor((DependencyObject)(object)val);
+			AgendaTelefone telefone = (AgendaTelefone)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)];
+			ViewModel.ExcluirTelefone(telefone);
+		}
+	}
+
+	private async void Salvar_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.Carregando = true;
+		List> list = await ViewModel.Salvar();
+		((DependencyObject)(object)this).ValidateFields(list);
+		bool num = list == null || list.Count == 0;
+		ViewModel.Carregando = false;
+		if (num)
+		{
+			ToggleSnackBar("AGENDA SALVA COM SUCESSO");
+		}
+		else
+		{
+			await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK");
+		}
+	}
+
+	private void Alterar_OnClick(object sender, RoutedEventArgs e)
+	{
+		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0020: Expected O, but got Unknown
+		ViewModel.CancelAgenda = (Agenda)((DomainBase)ViewModel.SelectedAgenda).Clone();
+		ViewModel.Alterar(alterar: true);
+	}
+
+	private void Cancelar_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.CancelarAlteracao();
+	}
+
+	private async void Excluir_OnClick(object sender, RoutedEventArgs e)
+	{
+		if (await ViewModel.Excluir())
+		{
+			ToggleSnackBar("AGENDA EXCLUÍDA COM SUCESSO");
+		}
+	}
+
+	private async void PostcodeBox_OnLostFocus(object sender, RoutedEventArgs e)
+	{
+		string text = ValidationHelper.FormatPostCode(((TextBox)sender).Text);
+		CepBox.Text = text;
+		if (ValidationHelper.ValidatePostCode(text))
+		{
+			EnderecoBase val = await ViewModel.BuscaCep(text);
+			if (val != null)
+			{
+				EnderecoBox.Text = val.Endereco;
+				CidadeBox.Text = val.Cidade;
+				EstadoBox.Text = val.Estado;
+				BairroBox.Text = val.Bairro;
+			}
+		}
+	}
+
+	private void AutoCompleteBox_Populating(object sender, PopulatingEventArgs e)
+	{
+		if (e.Parameter.Length < 3)
+		{
+			return;
+		}
+		e.Cancel = true;
+		ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task> searchResult)
+		{
+			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
+			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
+			if (searchResult.Result != null)
+			{
+				AutoCompleteBox val = (AutoCompleteBox)sender;
+				val.ItemsSource = searchResult.Result;
+				val.PopulateComplete();
+			}
+		}, TaskScheduler.FromCurrentSynchronizationContext());
+	}
+
+	private void AutoCompleteBox_OnTextChanged(object sender, RoutedEventArgs e)
+	{
+		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
+		if (string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).Text))
+		{
+			ViewModel.FiltrarAgenda("");
+		}
+	}
+
+	private async void AgendaGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
+	{
+		DataGrid val = (DataGrid)sender;
+		if (val == null || ((Selector)val).SelectedIndex >= 0)
+		{
+			await ViewModel.SelecionaAgenda((Agenda)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null));
+		}
+	}
+
+	private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e)
+	{
+		Snackbar.IsActive = false;
+	}
+
+	public void ToggleSnackBar(string message, bool active = true)
+	{
+		((ContentControl)Snackbar.Message).Content = message;
+		Snackbar.IsActive = active;
+		if (active)
+		{
+			Task.Factory.StartNew(CloseSlackBar);
+		}
+	}
+
+	private void CloseSlackBar()
+	{
+		Thread.Sleep(5000);
+		Dispatcher dispatcher = ((DispatcherObject)ProgressBar).Dispatcher;
+		if (dispatcher != null)
+		{
+			dispatcher.BeginInvoke((DispatcherPriority)4, (Delegate)(Action)delegate
+			{
+				ToggleSnackBar("", active: false);
+			});
+		}
+	}
+
+	private async void WhatsAppMessage_Click(object sender, RoutedEventArgs e)
+	{
+		Button val = (Button)sender;
+		ListBox val2 = Extentions.FindVisualAncestor((DependencyObject)(object)val);
+		TelefoneBase val3 = (TelefoneBase)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)];
+		if (!((val3.Tipo.HasValue && (int)val3.Tipo.GetValueOrDefault() == 8) ? (val3.Prefixo + val3.Numero).Clear() : ("55" + val3.Prefixo + val3.Numero.Clear())).EnviarWhatsapp())
+		{
+			await ViewModel.ShowMessage("HOUVE UM PROBLEMA AO ABRIR LINK DO WHATSAPP, O LINK FOI COPIADO EM SUA MAQUINA, BASTA ABRIR O NAVEGADOR DE INTERNET E COLAR NA BARRA DE ENDEREÇOS");
+		}
+	}
+
+	private void CopyTelefoneToClipBoard_Click(object sender, RoutedEventArgs e)
+	{
+		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0007: Expected O, but got Unknown
+		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0030: Expected O, but got Unknown
+		Button val = (Button)sender;
+		ListBox val2 = Extentions.FindVisualAncestor((DependencyObject)(object)val);
+		TelefoneBase val3 = (TelefoneBase)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)];
+		(val3.Prefixo + ValidationHelper.OnlyNumber(val3.Numero)).CopyToClipboard();
+		ToggleSnackBar("COPIADO - " + val3.Prefixo + ValidationHelper.OnlyNumber(val3.Numero));
+	}
+
+	private void CopyEmailToClipBoard_Click(object sender, RoutedEventArgs e)
+	{
+		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0007: Expected O, but got Unknown
+		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0030: Expected O, but got Unknown
+		Button val = (Button)sender;
+		ListBox val2 = Extentions.FindVisualAncestor((DependencyObject)(object)val);
+		EmailBase val3 = (EmailBase)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)];
+		val3.Email.CopyToClipboard();
+		ToggleSnackBar("COPIADO - " + val3.Email);
+	}
+
+	private void AbrirLog_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.AbrirLog((TipoTela)34, ((DomainBase)ViewModel.SelectedAgenda).Id);
+	}
+
+	private void TipoComboBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
+	{
+		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0007: Expected O, but got Unknown
+		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0046: Expected O, but got Unknown
+		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00a3: Invalid comparison between Unknown and I4
+		ComboBox val = (ComboBox)sender;
+		CustomIsReadOnlyControl customIsReadOnlyControl = Extentions.FindVisualAncestor((DependencyObject)(object)val);
+		if (customIsReadOnlyControl == null)
+		{
+			return;
+		}
+		WrapPanel val2 = Extentions.FindVisualAncestor((DependencyObject)(object)customIsReadOnlyControl);
+		ListBox val3 = Extentions.FindVisualAncestor((DependencyObject)(object)val2);
+		ContentPresenter val4 = FindVisualChild.Find((DependencyObject)(ListBoxItem)((ItemsControl)val3).ItemContainerGenerator.ContainerFromIndex(((CollectionView)((ItemsControl)val3).Items).IndexOf(((FrameworkElement)val2).DataContext)));
+		DataTemplate contentTemplate = val4.ContentTemplate;
+		CustomItemValidation customItemValidation = (CustomItemValidation)((FrameworkTemplate)contentTemplate).FindName("Prefixo", (FrameworkElement)(object)val4);
+		CustomItemValidation depObj = (CustomItemValidation)((FrameworkTemplate)contentTemplate).FindName("Telefone", (FrameworkElement)(object)val4);
+		TextBox? obj = ((DependencyObject)(object)customItemValidation).FindChildren().FirstOrDefault();
+		TextBox val5 = ((DependencyObject)(object)depObj).FindChildren().FirstOrDefault();
+		if (obj != null && val5 != null)
+		{
+			if ((int)(TipoTelefone)((Selector)val).SelectedValue != 8)
+			{
+				((UIElement)customItemValidation).Visibility = (Visibility)0;
+				val5.MaxLength = 10;
+				int length = ((val5.Text.Length >= 10) ? 10 : val5.Text.Length);
+				val5.Text = val5.Text.Substring(0, length);
+			}
+			else
+			{
+				((UIElement)customItemValidation).Visibility = (Visibility)2;
+				val5.MaxLength = 20;
+			}
+		}
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	public void InitializeComponent()
+	{
+		if (!_contentLoaded)
+		{
+			_contentLoaded = true;
+			Uri uri = new Uri("/Gestor.Application;component/drawers/agendadrawer.xaml", UriKind.Relative);
+			Application.LoadComponent((object)this, uri);
+		}
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	internal Delegate _CreateDelegate(Type delegateType, string handler)
+	{
+		return Delegate.CreateDelegate(delegateType, this, handler);
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	[EditorBrowsable(EditorBrowsableState.Never)]
+	void IComponentConnector.Connect(int connectionId, object target)
+	{
+		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
+		//IL_009d: Expected O, but got Unknown
+		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00b5: Expected O, but got Unknown
+		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00cd: Expected O, but got Unknown
+		//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00da: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00e4: Expected O, but got Unknown
+		//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00f1: Expected O, but got Unknown
+		//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0109: Expected O, but got Unknown
+		//IL_010b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0117: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0121: Expected O, but got Unknown
+		//IL_0123: Unknown result type (might be due to invalid IL or missing references)
+		//IL_012f: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0139: Expected O, but got Unknown
+		//IL_013b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0147: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0151: Expected O, but got Unknown
+		//IL_0153: Unknown result type (might be due to invalid IL or missing references)
+		//IL_015f: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0169: Expected O, but got Unknown
+		//IL_016c: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0176: Expected O, but got Unknown
+		//IL_0178: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0184: Unknown result type (might be due to invalid IL or missing references)
+		//IL_018e: Expected O, but got Unknown
+		//IL_0191: Unknown result type (might be due to invalid IL or missing references)
+		//IL_019b: Expected O, but got Unknown
+		//IL_019e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_01a8: Expected O, but got Unknown
+		//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
+		//IL_01bf: Expected O, but got Unknown
+		//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
+		//IL_01d7: Expected O, but got Unknown
+		//IL_01da: Unknown result type (might be due to invalid IL or missing references)
+		//IL_01e4: Expected O, but got Unknown
+		//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
+		//IL_01f1: Expected O, but got Unknown
+		//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
+		//IL_01fe: Expected O, but got Unknown
+		//IL_0201: Unknown result type (might be due to invalid IL or missing references)
+		//IL_020b: Expected O, but got Unknown
+		//IL_020e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0218: Expected O, but got Unknown
+		//IL_021b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0225: Expected O, but got Unknown
+		//IL_0227: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0233: Unknown result type (might be due to invalid IL or missing references)
+		//IL_023d: Expected O, but got Unknown
+		//IL_0240: Unknown result type (might be due to invalid IL or missing references)
+		//IL_024a: Expected O, but got Unknown
+		//IL_024c: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0258: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0262: Expected O, but got Unknown
+		//IL_0265: Unknown result type (might be due to invalid IL or missing references)
+		//IL_026f: Expected O, but got Unknown
+		//IL_0272: Unknown result type (might be due to invalid IL or missing references)
+		//IL_027c: Expected O, but got Unknown
+		//IL_027e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_028a: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0294: Expected O, but got Unknown
+		switch (connectionId)
+		{
+		case 1:
+			ProgressBar = (ProgressBar)target;
+			break;
+		case 2:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(Fechar_OnClick);
+			break;
+		case 3:
+			((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBox_Populating);
+			((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBox_OnTextChanged);
+			break;
+		case 4:
+			AgendaGrid = (DataGrid)target;
+			break;
+		case 5:
+			((MenuItem)target).Click += new RoutedEventHandler(Incluir_OnClick);
+			break;
+		case 6:
+			((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick);
+			break;
+		case 7:
+			((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick);
+			break;
+		case 8:
+			((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick);
+			break;
+		case 9:
+			((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick);
+			break;
+		case 10:
+			MaisOpcoesButton = (MenuItem)target;
+			break;
+		case 11:
+			((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick);
+			break;
+		case 12:
+			NomeBox = (TextBox)target;
+			break;
+		case 13:
+			CepBox = (TextBox)target;
+			((UIElement)CepBox).LostFocus += new RoutedEventHandler(PostcodeBox_OnLostFocus);
+			((UIElement)CepBox).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros);
+			break;
+		case 14:
+			ProgressCep = (ProgressBar)target;
+			break;
+		case 15:
+			EnderecoBox = (TextBox)target;
+			break;
+		case 16:
+			BairroBox = (TextBox)target;
+			break;
+		case 17:
+			CidadeBox = (TextBox)target;
+			break;
+		case 18:
+			EstadoBox = (TextBox)target;
+			break;
+		case 19:
+			ObsBox = (TextBox)target;
+			break;
+		case 20:
+			((MenuItem)target).Click += new RoutedEventHandler(IncluirTelefone_OnClick);
+			break;
+		case 21:
+			TelefoneListBox = (ListBox)target;
+			break;
+		case 28:
+			((MenuItem)target).Click += new RoutedEventHandler(IncluirEmail_OnClick);
+			break;
+		case 29:
+			EmailListBox = (ListBox)target;
+			break;
+		case 32:
+			Snackbar = (Snackbar)target;
+			break;
+		case 33:
+			((SnackbarMessage)target).ActionClick += new RoutedEventHandler(SnackbarMessage_ActionClick);
+			break;
+		default:
+			_contentLoaded = true;
+			break;
+		}
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	[EditorBrowsable(EditorBrowsableState.Never)]
+	void IStyleConnector.Connect(int connectionId, object target)
+	{
+		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
+		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0049: Expected O, but got Unknown
+		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0062: Expected O, but got Unknown
+		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
+		//IL_007b: Expected O, but got Unknown
+		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0093: Expected O, but got Unknown
+		//IL_0095: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00ab: Expected O, but got Unknown
+		//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00c3: Expected O, but got Unknown
+		//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00db: Expected O, but got Unknown
+		//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00f3: Expected O, but got Unknown
+		//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
+		//IL_010b: Expected O, but got Unknown
+		switch (connectionId)
+		{
+		case 22:
+			((Selector)(ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(TipoComboBox_OnSelectionChanged);
+			break;
+		case 23:
+			((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros);
+			break;
+		case 24:
+			((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(FormatarTelefone);
+			((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros);
+			break;
+		case 25:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirTelefone_OnClick);
+			break;
+		case 26:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(CopyTelefoneToClipBoard_Click);
+			break;
+		case 27:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(WhatsAppMessage_Click);
+			break;
+		case 30:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirEmail_OnClick);
+			break;
+		case 31:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(CopyEmailToClipBoard_Click);
+			break;
+		case 28:
+		case 29:
+			break;
+		}
+	}
+}
diff --git a/Decompiler/Gestor.Application.Drawers/ArquivoDigitalDrawer.cs b/Decompiler/Gestor.Application.Drawers/ArquivoDigitalDrawer.cs
new file mode 100644
index 0000000..c745586
--- /dev/null
+++ b/Decompiler/Gestor.Application.Drawers/ArquivoDigitalDrawer.cs
@@ -0,0 +1,712 @@
+using System;
+using System.CodeDom.Compiler;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Data;
+using System.Windows.Input;
+using System.Windows.Markup;
+using System.Windows.Threading;
+using Gestor.Application.Helpers;
+using Gestor.Application.ViewModels.Drawer;
+using Gestor.Application.Views.Ferramentas;
+using Gestor.Application.Views.Generic;
+using Gestor.Common.Security;
+using Gestor.Common.Validation;
+using Gestor.Model.API;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Domain.MalaDireta;
+using Gestor.Model.Domain.Seguros;
+using Gestor.Model.License;
+using MaterialDesignThemes.Wpf;
+using Xceed.Wpf.AvalonDock.Controls;
+
+namespace Gestor.Application.Drawers;
+
+public class ArquivoDigitalDrawer : UserControl, IComponentConnector, IStyleConnector
+{
+	internal ProgressBar ProgressBar;
+
+	internal TextBlock TitleBox;
+
+	internal DataGrid ArquivoGrid;
+
+	internal TextBox DocumentoBox;
+
+	internal Snackbar SnackbarArquivoDigital;
+
+	private bool _contentLoaded;
+
+	public ArquivoDigitalViewModel ViewModel { get; set; }
+
+	private FiltroArquivoDigital Filtro { get; }
+
+	public ArquivoDigitalDrawer(FiltroArquivoDigital filtro)
+	{
+		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
+		ViewModel = new ArquivoDigitalViewModel(filtro);
+		Filtro = filtro;
+		((FrameworkElement)this).DataContext = ViewModel;
+		InitializeComponent();
+		Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher;
+		if (dispatcher != null)
+		{
+			dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad));
+		}
+		ViewModel.RegistrarAcao("ACESSOU ARQUIVO DIGITAL DE " + ((filtro != null) ? ValidationHelper.GetDescription((Enum)(object)filtro.Tipo) : null) + ((filtro == null || filtro.Id != 0) ? $" DO DOCUMENTO DE ID \"{((filtro != null) ? new long?(filtro.Id) : null)}\"" : ""), (filtro != null) ? filtro.Id : 0, (TipoTela)6, "TIPO: " + ((filtro != null) ? ValidationHelper.GetDescription((Enum)(object)filtro.Tipo) : null) + ((filtro == null || filtro.Id != 0) ? $"\nID APÓLICE: {((filtro != null) ? new long?(filtro.Id) : null)}" : ""));
+	}
+
+	private void ContentLoad()
+	{
+		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
+		//IL_002e: Expected O, but got Unknown
+		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0045: Expected O, but got Unknown
+		ArquivoGrid.CellEditEnding += ArquivoGrid_CellEditEnding;
+		((UIElement)DocumentoBox).LostFocus += new RoutedEventHandler(DocumentBox_OnLostFocus);
+		((UIElement)DocumentoBox).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros);
+	}
+
+	private static void SomenteNumeros(object sender, TextCompositionEventArgs e)
+	{
+		Regex regex = new Regex("[^0-9]+");
+		((RoutedEventArgs)e).Handled = regex.IsMatch(e.Text);
+	}
+
+	private static void DocumentBox_OnLostFocus(object sender, RoutedEventArgs e)
+	{
+		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0007: Expected O, but got Unknown
+		TextBox val = (TextBox)sender;
+		if (!(val.Text == string.Empty))
+		{
+			val.Text = ValidationHelper.FormatDocument(val.Text);
+		}
+	}
+
+	private void ArquivoGrid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
+	{
+		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0007: Invalid comparison between Unknown and I4
+		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0087: Expected O, but got Unknown
+		if ((int)e.EditAction != 1)
+		{
+			return;
+		}
+		DataGridColumn column = e.Column;
+		DataGridBoundColumn val = (DataGridBoundColumn)(object)((column is DataGridBoundColumn) ? column : null);
+		if (val == null)
+		{
+			return;
+		}
+		BindingBase binding = val.Binding;
+		BindingBase obj = ((binding is Binding) ? binding : null);
+		if (((obj != null) ? ((Binding)obj).Path.Path : null) != "Descricao")
+		{
+			return;
+		}
+		int index = e.Row.GetIndex();
+		FrameworkElement editingElement = e.EditingElement;
+		TextBox val2 = (TextBox)(object)((editingElement is TextBox) ? editingElement : null);
+		if (val2 != null)
+		{
+			val2.Text = val2.Text.ToUpper();
+			IndiceArquivoDigital val3 = (IndiceArquivoDigital)((ItemsControl)ArquivoGrid).Items[index];
+			if (!(val3.Descricao == val2.Text))
+			{
+				((DomainBase)val3).Initialize();
+				val3.Descricao = val2.Text;
+				ViewModel.Editar(val3);
+			}
+		}
+	}
+
+	private void Baixar_OnClick(object sender, RoutedEventArgs e)
+	{
+		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0034: Expected O, but got Unknown
+		Button val = (Button)((sender is Button) ? sender : null);
+		if (val != null)
+		{
+			DataGrid val2 = Extentions.FindVisualAncestor((DependencyObject)(object)val);
+			IndiceArquivoDigital arquivo = (IndiceArquivoDigital)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)];
+			ViewModel.Baixar(arquivo);
+		}
+	}
+
+	private async void BaixarTodos_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.Activated = false;
+		if (await ViewModel.BaixarTodos())
+		{
+			await ViewModel.ShowMessage("ARQUIVOS BAIXADOS COM SUCESSO!");
+		}
+		ViewModel.Activated = true;
+	}
+
+	private void Abrir_OnClick(object sender, RoutedEventArgs e)
+	{
+		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0040: Expected O, but got Unknown
+		Button val = (Button)((sender is Button) ? sender : null);
+		if (val != null)
+		{
+			ViewModel.Activated = false;
+			DataGrid val2 = Extentions.FindVisualAncestor((DependencyObject)(object)val);
+			IndiceArquivoDigital arquivo = (IndiceArquivoDigital)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)];
+			ViewModel.Baixar(arquivo, abrir: true);
+			ViewModel.Activated = true;
+		}
+	}
+
+	private async void Excluir_OnClick(object sender, RoutedEventArgs e)
+	{
+		Button val = (Button)((sender is Button) ? sender : null);
+		if (val == null)
+		{
+			return;
+		}
+		DataGrid val2 = Extentions.FindVisualAncestor((DependencyObject)(object)val);
+		IndiceArquivoDigital arquivo = (IndiceArquivoDigital)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)];
+		if (arquivo != null)
+		{
+			ViewModel.VerificarEnables(((DomainBase)arquivo).Id);
+			if (!ViewModel.EnableExcluir)
+			{
+				await ViewModel.ShowMessage("VOCÊ NÃO TEM PERMISSÃO PARA EXCLUIR ARQUIVO DIGITAL DO TIPO " + ValidationHelper.GetDescription((Enum)(object)Filtro.Tipo) + "!");
+			}
+			else if (arquivo.NaoExcluir)
+			{
+				await ViewModel.ShowMessage("O ARQUIVO " + arquivo.Descricao + " NÃO PODE SER EXCLUÍDO!");
+			}
+			else if (await ViewModel.ShowMessage("DESEJA REALMENTE EXCLUIR O ARQUIVO " + arquivo.Descricao, "SIM", "NÃO"))
+			{
+				await ViewModel.Excluir(arquivo);
+			}
+		}
+	}
+
+	private void CopyTelefoneToClipBoard_Click(object sender, RoutedEventArgs e)
+	{
+		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0007: Expected O, but got Unknown
+		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0030: Expected O, but got Unknown
+		Button val = (Button)sender;
+		ListBox val2 = Extentions.FindVisualAncestor((DependencyObject)(object)val);
+		ClienteTelefone val3 = (ClienteTelefone)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)];
+		(((TelefoneBase)val3).Prefixo + ((TelefoneBase)val3).Numero).CopyToClipboard();
+		Toggle("COPIADO - " + ((TelefoneBase)val3).Prefixo + ValidationHelper.OnlyNumber(((TelefoneBase)val3).Numero));
+	}
+
+	private async void WhatsAppMessage_Click(object sender, RoutedEventArgs e)
+	{
+		if (ViewModel.Restricao((TipoRestricao)32))
+		{
+			await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ESSE MENU.");
+			return;
+		}
+		Button val = (Button)sender;
+		ListBox val2 = Extentions.FindVisualAncestor((DependencyObject)(object)val);
+		ClienteTelefone val3 = (ClienteTelefone)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)];
+		if (!((((TelefoneBase)val3).Tipo.HasValue && (int)((TelefoneBase)val3).Tipo.GetValueOrDefault() == 8) ? (((TelefoneBase)val3).Prefixo + ((TelefoneBase)val3).Numero).Clear() : ("55" + ((TelefoneBase)val3).Prefixo + ((TelefoneBase)val3).Numero.Clear())).EnviarWhatsapp())
+		{
+			await ViewModel.ShowMessage("HOUVE UM PROBLEMA AO ABRIR LINK DO WHATSAPP, O LINK FOI COPIADO EM SUA MAQUINA, BASTA ABRIR O NAVEGADOR DE INTERNET E COLAR NA BARRA DE ENDEREÇOS");
+		}
+	}
+
+	private void DeleteArquivo_OnDeleteClick(object sender, RoutedEventArgs e)
+	{
+		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0034: Expected O, but got Unknown
+		Chip val = (Chip)((sender is Chip) ? sender : null);
+		if (val != null)
+		{
+			ListBox val2 = Extentions.FindVisualAncestor((DependencyObject)(object)val);
+			ArquivoDigital val3 = (ArquivoDigital)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)];
+			if (val3 != null)
+			{
+				ViewModel.Delete(val3);
+			}
+		}
+	}
+
+	private void AnexarArquivos_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.Anexar();
+	}
+
+	private async void SalvarAnexos_OnClick(object sender, RoutedEventArgs e)
+	{
+		await ViewModel.SalvarAnexos();
+	}
+
+	private async void EnviarPorWhatsApp_OnClick(object sender, RoutedEventArgs e)
+	{
+		if (ViewModel.Restricao((TipoRestricao)32))
+		{
+			await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR O WHATSAPP");
+			return;
+		}
+		Button val = (Button)sender;
+		if (((FrameworkElement)val).DataContext != null)
+		{
+			object dataContext = ((FrameworkElement)val).DataContext;
+			ClienteTelefone val2 = (ClienteTelefone)((dataContext is ClienteTelefone) ? dataContext : null);
+			if (val2 != null && !((((TelefoneBase)val2).Tipo.HasValue && (int)((TelefoneBase)val2).Tipo.GetValueOrDefault() == 8) ? (((TelefoneBase)val2).Prefixo + ((TelefoneBase)val2).Numero).Clear() : ("55" + ((TelefoneBase)val2).Prefixo + ((TelefoneBase)val2).Numero.Clear())).EnviarWhatsapp(ViewModel.Anotacoes))
+			{
+				await ViewModel.ShowMessage("HOUVE UM PROBLEMA AO ABRIR LINK DO WHATSAPP, O LINK FOI COPIADO EM SUA MAQUINA, BASTA ABRIR O NAVEGADOR DE INTERNET E COLAR NA BARRA DE ENDEREÇOS");
+			}
+		}
+	}
+
+	private void LimparLista_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.LimparAnexos();
+	}
+
+	private void AlteraEventoEnviarOnClick(MenuItem enviarMenu, bool adiciona = true)
+	{
+		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0028: Expected O, but got Unknown
+		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0015: Expected O, but got Unknown
+		if (adiciona)
+		{
+			enviarMenu.Click += new RoutedEventHandler(Enviar_OnClick);
+		}
+		else
+		{
+			enviarMenu.Click -= new RoutedEventHandler(Enviar_OnClick);
+		}
+	}
+
+	private async void Enviar_OnClick(object sender, RoutedEventArgs e)
+	{
+		MenuItem enviarMenu = (MenuItem)sender;
+		AlteraEventoEnviarOnClick(enviarMenu, adiciona: false);
+		if (ViewModel.Restricao((TipoRestricao)60))
+		{
+			await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ASSINATURA.\nCONTINUANDO COM O ENVIO APENAS.");
+		}
+		else if (ViewModel.ArquivosTela.Any((IndiceArquivoDigital x) => x.Assinar))
+		{
+			if (LicenseHelper.Produtos.All((Licenca x) => (int)x.Produto != 86))
+			{
+				string arguments = new Token().Encrypt(string.Format("{0}:{1}:{2}:{3}", ApplicationHelper.NumeroSerial, ApplicationHelper.IdFornecedor, ((DomainBase)Recursos.Usuario).Id, ApplicationHelper.Beta ? "1" : "0"));
+				((Window)new DownloadWindow(new Parameters
+				{
+					Beta = ApplicationHelper.Beta,
+					Type = 8,
+					Application = "Assinador.Application.exe",
+					Directory = "Assinador.Application",
+					Arguments = arguments,
+					Run = true
+				})).Show();
+				AlteraEventoEnviarOnClick(enviarMenu);
+				return;
+			}
+			if (!(await ViewModel.EnviarParaAssinatura()))
+			{
+				AlteraEventoEnviarOnClick(enviarMenu);
+				return;
+			}
+		}
+		MalaDireta val = await ViewModel.PrepararEnvio();
+		if (val == null)
+		{
+			AlteraEventoEnviarOnClick(enviarMenu);
+			return;
+		}
+		if (Funcoes.IsWindowOpen("ENVIO DE E-MAIL"))
+		{
+			Funcoes.Destroy("ENVIO DE E-MAIL");
+		}
+		((Window)new HosterWindow((ContentControl)(object)new MalaDiretaView(new List { val }, ViewModel.Assunto, ViewModel.Corpo, Filtro), "ENVIO DE E-MAIL", 1200.0, 600.0, canMaximize: true)).Show();
+		AlteraEventoEnviarOnClick(enviarMenu);
+	}
+
+	private void Fechar_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.CloseDrawer();
+	}
+
+	private void AlteraEventoAssinarOnClick(Button assinarButton, bool adiciona = true)
+	{
+		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0028: Expected O, but got Unknown
+		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0015: Expected O, but got Unknown
+		if (adiciona)
+		{
+			((ButtonBase)assinarButton).Click += new RoutedEventHandler(Assinar_OnClick);
+		}
+		else
+		{
+			((ButtonBase)assinarButton).Click -= new RoutedEventHandler(Assinar_OnClick);
+		}
+	}
+
+	private async void Assinar_OnClick(object sender, RoutedEventArgs e)
+	{
+		Button assinarButton = (Button)sender;
+		AlteraEventoAssinarOnClick(assinarButton, adiciona: false);
+		if (ViewModel.Restricao((TipoRestricao)60))
+		{
+			await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ASSINATURA.");
+			AlteraEventoAssinarOnClick(assinarButton);
+		}
+		else if (LicenseHelper.Produtos.All((Licenca x) => (int)x.Produto != 86))
+		{
+			string arguments = new Token().Encrypt(string.Format("{0}:{1}:{2}:{3}", ApplicationHelper.NumeroSerial, ApplicationHelper.IdFornecedor, ((DomainBase)Recursos.Usuario).Id, ApplicationHelper.Beta ? "1" : "0"));
+			((Window)new DownloadWindow(new Parameters
+			{
+				Beta = ApplicationHelper.Beta,
+				Type = 8,
+				Application = "Assinador.Application.exe",
+				Directory = "Assinador.Application",
+				Arguments = arguments,
+				Run = true
+			})).Show();
+			AlteraEventoAssinarOnClick(assinarButton);
+		}
+		else
+		{
+			await ViewModel.EnviarParaAssinatura();
+			AlteraEventoAssinarOnClick(assinarButton);
+		}
+	}
+
+	private void TextBoxBase_OnTextChanged(object sender, TextChangedEventArgs e)
+	{
+		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
+		string text = ((TextBox)sender).Text;
+		if (text.Length < 3)
+		{
+			ViewModel.ArquivosTela = ViewModel.Arquivos;
+			return;
+		}
+		List list = ViewModel.Arquivos.Where((IndiceArquivoDigital x) => x.Descricao.Contains(text)).ToList();
+		if (list.Count > 0)
+		{
+			ViewModel.ArquivosTela = new ObservableCollection();
+			list.ForEach(delegate(IndiceArquivoDigital x)
+			{
+				ViewModel.ArquivosTela.Add(x);
+			});
+		}
+		else
+		{
+			ViewModel.ArquivosTela = new ObservableCollection();
+		}
+	}
+
+	private async void PopupBox_OnOpened(object sender, RoutedEventArgs e)
+	{
+		if (ViewModel.Telefones.Count == 0)
+		{
+			ViewModel.Telefones.Add(new ClienteTelefone
+			{
+				Prefixo = Recursos.Empresa.PrimeiroPrefixo,
+				Numero = Recursos.Empresa.PrimeiroTelefone
+			});
+		}
+		IndiceArquivoDigital indice = (IndiceArquivoDigital)((FrameworkElement)(PopupBox)sender).DataContext;
+		ArquivoDigitalViewModel viewModel = ViewModel;
+		viewModel.Anotacoes = await CreateWhatsappMessage(indice);
+	}
+
+	private async Task CreateWhatsappMessage(IndiceArquivoDigital indice)
+	{
+		StringBuilder links = new StringBuilder((await ViewModel.CreateLink(indice)).ToString());
+		StringBuilder assinaturas = new StringBuilder(indice.Assinado ? "" : (indice.EnviadoAssinatura ? ("LINK PARA ASSINATURA" + Environment.NewLine + indice.UrlAssinatura + Environment.NewLine + Environment.NewLine) : ""));
+		foreach (IndiceArquivoDigital indiceArquivoDigital in ViewModel.Arquivos)
+		{
+			if (indiceArquivoDigital.Selecionado && indiceArquivoDigital.IdArquivoDigital != indice.IdArquivoDigital)
+			{
+				if (links.Length > 0)
+				{
+					links.AppendLine("\r\n");
+					assinaturas.AppendLine();
+				}
+				StringBuilder stringBuilder = links;
+				stringBuilder.AppendLine((await ViewModel.CreateLink(indiceArquivoDigital)).ToString());
+				assinaturas.AppendLine(indiceArquivoDigital.Assinado ? "" : (indiceArquivoDigital.EnviadoAssinatura ? ("LINK PARA ASSINATURA" + Environment.NewLine + indiceArquivoDigital.UrlAssinatura + Environment.NewLine + Environment.NewLine) : ""));
+			}
+		}
+		return ViewModel.CarregarMensagem().Replace("[*LINK*]", $"LINK(S) PARA BAIXAR O(S) DOCUMENTO(S) (VÁLIDO(S) POR 7 DIAS){Environment.NewLine}{links}").Replace("<|LINKASSINATURA|>", assinaturas.ToString());
+	}
+
+	private void CopiarLinkAssinatura_OnClick(object sender, RoutedEventArgs e)
+	{
+		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
+		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0011: Expected O, but got Unknown
+		IndiceArquivoDigital val = (IndiceArquivoDigital)((FrameworkElement)(Button)sender).DataContext;
+		if (val != null && !string.IsNullOrWhiteSpace(val.UrlAssinatura))
+		{
+			val.UrlAssinatura.CopyToClipboard();
+			Toggle("LINK COPIADO - " + val.UrlAssinatura);
+		}
+	}
+
+	private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e)
+	{
+		SnackbarArquivoDigital.IsActive = false;
+	}
+
+	public void Toggle(string message, bool active = true)
+	{
+		((ContentControl)SnackbarArquivoDigital.Message).Content = message;
+		SnackbarArquivoDigital.IsActive = active;
+		if (active)
+		{
+			Task.Factory.StartNew(CloseSlackBar);
+		}
+	}
+
+	private void CloseSlackBar()
+	{
+		Thread.Sleep(5000);
+		Dispatcher dispatcher = ((DispatcherObject)App.ProgressRing).Dispatcher;
+		if (dispatcher != null)
+		{
+			dispatcher.BeginInvoke((DispatcherPriority)4, (Delegate)(Action)delegate
+			{
+				Toggle("", active: false);
+			});
+		}
+	}
+
+	public void ScrollViewer_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
+	{
+		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
+		ScrollViewer val = (ScrollViewer)sender;
+		val.ScrollToVerticalOffset(val.VerticalOffset - (double)e.Delta);
+		((RoutedEventArgs)e).Handled = true;
+	}
+
+	private void Log_OnClick(object sender, RoutedEventArgs e)
+	{
+		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0017: Expected O, but got Unknown
+		Button val = (Button)((sender is Button) ? sender : null);
+		if (val != null)
+		{
+			IndiceArquivoDigital val2 = (IndiceArquivoDigital)((FrameworkElement)val).DataContext;
+			if (val2 != null && ((DomainBase)val2).Id != 0L)
+			{
+				ViewModel.AbrirLog((TipoTela)6, ((DomainBase)val2).Id);
+			}
+		}
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	public void InitializeComponent()
+	{
+		if (!_contentLoaded)
+		{
+			_contentLoaded = true;
+			Uri uri = new Uri("/Gestor.Application;component/drawers/arquivodigitaldrawer.xaml", UriKind.Relative);
+			Application.LoadComponent((object)this, uri);
+		}
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	internal Delegate _CreateDelegate(Type delegateType, string handler)
+	{
+		return Delegate.CreateDelegate(delegateType, this, handler);
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	[EditorBrowsable(EditorBrowsableState.Never)]
+	void IComponentConnector.Connect(int connectionId, object target)
+	{
+		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
+		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0088: Expected O, but got Unknown
+		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0095: Expected O, but got Unknown
+		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00ad: Expected O, but got Unknown
+		//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00ba: Expected O, but got Unknown
+		//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00d2: Expected O, but got Unknown
+		//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00df: Expected O, but got Unknown
+		//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00f7: Expected O, but got Unknown
+		//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0105: Unknown result type (might be due to invalid IL or missing references)
+		//IL_010f: Expected O, but got Unknown
+		//IL_0111: Unknown result type (might be due to invalid IL or missing references)
+		//IL_011d: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0127: Expected O, but got Unknown
+		//IL_012a: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0134: Expected O, but got Unknown
+		//IL_0136: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0142: Unknown result type (might be due to invalid IL or missing references)
+		//IL_014c: Expected O, but got Unknown
+		//IL_014e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_015a: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0164: Expected O, but got Unknown
+		//IL_0166: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0172: Unknown result type (might be due to invalid IL or missing references)
+		//IL_017c: Expected O, but got Unknown
+		//IL_017f: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0189: Expected O, but got Unknown
+		//IL_018b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0197: Unknown result type (might be due to invalid IL or missing references)
+		//IL_01a1: Expected O, but got Unknown
+		switch (connectionId)
+		{
+		case 1:
+			((UIElement)(ScrollViewer)target).PreviewMouseWheel += new MouseWheelEventHandler(ScrollViewer_PreviewMouseWheel);
+			break;
+		case 2:
+			ProgressBar = (ProgressBar)target;
+			break;
+		case 3:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(Fechar_OnClick);
+			break;
+		case 4:
+			TitleBox = (TextBlock)target;
+			break;
+		case 7:
+			((TextBoxBase)(TextBox)target).TextChanged += new TextChangedEventHandler(TextBoxBase_OnTextChanged);
+			break;
+		case 8:
+			ArquivoGrid = (DataGrid)target;
+			break;
+		case 16:
+			((MenuItem)target).Click += new RoutedEventHandler(AnexarArquivos_OnClick);
+			break;
+		case 17:
+			((MenuItem)target).Click += new RoutedEventHandler(BaixarTodos_OnClick);
+			break;
+		case 18:
+			((MenuItem)target).Click += new RoutedEventHandler(Enviar_OnClick);
+			break;
+		case 19:
+			DocumentoBox = (TextBox)target;
+			break;
+		case 20:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(Assinar_OnClick);
+			break;
+		case 22:
+			((MenuItem)target).Click += new RoutedEventHandler(SalvarAnexos_OnClick);
+			break;
+		case 23:
+			((MenuItem)target).Click += new RoutedEventHandler(LimparLista_OnClick);
+			break;
+		case 24:
+			SnackbarArquivoDigital = (Snackbar)target;
+			break;
+		case 25:
+			((SnackbarMessage)target).ActionClick += new RoutedEventHandler(SnackbarMessage_ActionClick);
+			break;
+		default:
+			_contentLoaded = true;
+			break;
+		}
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	[EditorBrowsable(EditorBrowsableState.Never)]
+	void IStyleConnector.Connect(int connectionId, object target)
+	{
+		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0064: Expected O, but got Unknown
+		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
+		//IL_007c: Expected O, but got Unknown
+		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0094: Expected O, but got Unknown
+		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00ac: Expected O, but got Unknown
+		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00c4: Expected O, but got Unknown
+		//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00dc: Expected O, but got Unknown
+		//IL_00de: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00f4: Expected O, but got Unknown
+		//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0102: Unknown result type (might be due to invalid IL or missing references)
+		//IL_010c: Expected O, but got Unknown
+		//IL_010e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_011a: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0124: Expected O, but got Unknown
+		//IL_0126: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0132: Unknown result type (might be due to invalid IL or missing references)
+		//IL_013c: Expected O, but got Unknown
+		switch (connectionId)
+		{
+		case 5:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(CopyTelefoneToClipBoard_Click);
+			break;
+		case 6:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(WhatsAppMessage_Click);
+			break;
+		case 9:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(CopiarLinkAssinatura_OnClick);
+			break;
+		case 10:
+			((PopupBox)target).Opened += new RoutedEventHandler(PopupBox_OnOpened);
+			break;
+		case 11:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(EnviarPorWhatsApp_OnClick);
+			break;
+		case 12:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(Abrir_OnClick);
+			break;
+		case 13:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(Baixar_OnClick);
+			break;
+		case 14:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(Log_OnClick);
+			break;
+		case 15:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(Excluir_OnClick);
+			break;
+		case 21:
+			((Chip)target).DeleteClick += new RoutedEventHandler(DeleteArquivo_OnDeleteClick);
+			break;
+		case 7:
+		case 8:
+		case 16:
+		case 17:
+		case 18:
+		case 19:
+		case 20:
+			break;
+		}
+	}
+}
diff --git a/Decompiler/Gestor.Application.Drawers/ExpedicaoDrawer.cs b/Decompiler/Gestor.Application.Drawers/ExpedicaoDrawer.cs
new file mode 100644
index 0000000..831c5e0
--- /dev/null
+++ b/Decompiler/Gestor.Application.Drawers/ExpedicaoDrawer.cs
@@ -0,0 +1,289 @@
+using System;
+using System.CodeDom.Compiler;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Data;
+using System.Windows.Input;
+using System.Windows.Markup;
+using System.Windows.Threading;
+using Gestor.Application.ViewModels.Drawer;
+using Gestor.Application.Views.Generic;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Domain.Seguros;
+using MaterialDesignThemes.Wpf;
+
+namespace Gestor.Application.Drawers;
+
+public class ExpedicaoDrawer : BaseUserControl, IComponentConnector
+{
+	internal ProgressBar ProgressBar;
+
+	internal TextBox DocumentoBox;
+
+	internal TextBox DestinoBox;
+
+	internal DatePicker EnvioBox;
+
+	internal DatePicker RecebimentoBox;
+
+	internal TextBox ResponsavelBox;
+
+	internal DataGrid ExpedicaoGrid;
+
+	internal Snackbar Snackbar;
+
+	private bool _contentLoaded;
+
+	public ExpedicaoViewModel ViewModel { get; set; }
+
+	public ExpedicaoDrawer(Documento documento)
+	{
+		ViewModel = new ExpedicaoViewModel(documento);
+		((FrameworkElement)this).DataContext = ViewModel;
+		InitializeComponent();
+		Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher;
+		if (dispatcher != null)
+		{
+			dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad));
+		}
+	}
+
+	private void ContentLoad()
+	{
+		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0017: Expected O, but got Unknown
+		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
+		//IL_002e: Expected O, but got Unknown
+		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0045: Expected O, but got Unknown
+		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
+		//IL_005c: Expected O, but got Unknown
+		((UIElement)EnvioBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus);
+		((UIElement)EnvioBox).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown);
+		((UIElement)RecebimentoBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus);
+		((UIElement)RecebimentoBox).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown);
+	}
+
+	private void Incluir_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.Incluir();
+	}
+
+	private void Alterar_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.Alterar(alterar: true);
+	}
+
+	private async void Salvar_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.Carregando = true;
+		List> list = await ViewModel.Salvar();
+		((CollectionView)((ItemsControl)ExpedicaoGrid).Items).Refresh();
+		bool num = list == null || list.Count == 0;
+		ViewModel.Carregando = false;
+		if (num)
+		{
+			ToggleSnackBar("EXPEDIÇÃO SALVA COM SUCESSO");
+		}
+		else
+		{
+			await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK");
+		}
+	}
+
+	private void Cancelar_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.CancelarAlteracao();
+	}
+
+	private async void Excluir_OnClick(object sender, RoutedEventArgs e)
+	{
+		if (await ViewModel.Excluir())
+		{
+			ToggleSnackBar("EXPEDIÇÃO EXCLUÍDA COM SUCESSO");
+		}
+	}
+
+	private void Fechar_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.CloseDrawer();
+	}
+
+	private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e)
+	{
+		Snackbar.IsActive = false;
+	}
+
+	public void ToggleSnackBar(string message, bool active = true)
+	{
+		((ContentControl)Snackbar.Message).Content = message;
+		Snackbar.IsActive = active;
+		if (active)
+		{
+			Task.Factory.StartNew(CloseSlackBar);
+		}
+	}
+
+	private void CloseSlackBar()
+	{
+		Thread.Sleep(5000);
+		Dispatcher dispatcher = ((DispatcherObject)ProgressBar).Dispatcher;
+		if (dispatcher != null)
+		{
+			dispatcher.BeginInvoke((DispatcherPriority)4, (Delegate)(Action)delegate
+			{
+				ToggleSnackBar("", active: false);
+			});
+		}
+	}
+
+	private void Log_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.AbrirLog((TipoTela)46, ((DomainBase)ViewModel.SelectedExpedicao).Id);
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	public void InitializeComponent()
+	{
+		if (!_contentLoaded)
+		{
+			_contentLoaded = true;
+			Uri uri = new Uri("/Gestor.Application;component/drawers/expedicaodrawer.xaml", UriKind.Relative);
+			Application.LoadComponent((object)this, uri);
+		}
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	internal Delegate _CreateDelegate(Type delegateType, string handler)
+	{
+		return Delegate.CreateDelegate(delegateType, this, handler);
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	[EditorBrowsable(EditorBrowsableState.Never)]
+	void IComponentConnector.Connect(int connectionId, object target)
+	{
+		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0059: Expected O, but got Unknown
+		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0071: Expected O, but got Unknown
+		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
+		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0089: Expected O, but got Unknown
+		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00a1: Expected O, but got Unknown
+		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00b9: Expected O, but got Unknown
+		//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00d1: Expected O, but got Unknown
+		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00df: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00e9: Expected O, but got Unknown
+		//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0101: Expected O, but got Unknown
+		//IL_0104: Unknown result type (might be due to invalid IL or missing references)
+		//IL_010e: Expected O, but got Unknown
+		//IL_0111: Unknown result type (might be due to invalid IL or missing references)
+		//IL_011b: Expected O, but got Unknown
+		//IL_011e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0128: Expected O, but got Unknown
+		//IL_0135: Unknown result type (might be due to invalid IL or missing references)
+		//IL_013f: Expected O, but got Unknown
+		//IL_014c: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0156: Expected O, but got Unknown
+		//IL_0163: Unknown result type (might be due to invalid IL or missing references)
+		//IL_016d: Expected O, but got Unknown
+		//IL_0170: Unknown result type (might be due to invalid IL or missing references)
+		//IL_017a: Expected O, but got Unknown
+		//IL_0187: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0191: Expected O, but got Unknown
+		//IL_019e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_01a8: Expected O, but got Unknown
+		//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
+		//IL_01bf: Expected O, but got Unknown
+		//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
+		//IL_01cc: Expected O, but got Unknown
+		//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
+		//IL_01d9: Expected O, but got Unknown
+		//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
+		//IL_01e6: Expected O, but got Unknown
+		//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
+		//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
+		//IL_01fe: Expected O, but got Unknown
+		switch (connectionId)
+		{
+		case 1:
+			ProgressBar = (ProgressBar)target;
+			break;
+		case 2:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(Fechar_OnClick);
+			break;
+		case 3:
+			((MenuItem)target).Click += new RoutedEventHandler(Incluir_OnClick);
+			break;
+		case 4:
+			((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick);
+			break;
+		case 5:
+			((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick);
+			break;
+		case 6:
+			((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick);
+			break;
+		case 7:
+			((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick);
+			break;
+		case 8:
+			((MenuItem)target).Click += new RoutedEventHandler(Log_OnClick);
+			break;
+		case 9:
+			DocumentoBox = (TextBox)target;
+			break;
+		case 10:
+			DestinoBox = (TextBox)target;
+			break;
+		case 11:
+			EnvioBox = (DatePicker)target;
+			((UIElement)EnvioBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus);
+			((UIElement)EnvioBox).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown);
+			((Control)EnvioBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick);
+			break;
+		case 12:
+			RecebimentoBox = (DatePicker)target;
+			((UIElement)RecebimentoBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus);
+			((UIElement)RecebimentoBox).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown);
+			((Control)RecebimentoBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick);
+			break;
+		case 13:
+			ResponsavelBox = (TextBox)target;
+			break;
+		case 14:
+			ExpedicaoGrid = (DataGrid)target;
+			break;
+		case 15:
+			Snackbar = (Snackbar)target;
+			break;
+		case 16:
+			((SnackbarMessage)target).ActionClick += new RoutedEventHandler(SnackbarMessage_ActionClick);
+			break;
+		default:
+			_contentLoaded = true;
+			break;
+		}
+	}
+}
diff --git a/Decompiler/Gestor.Application.Drawers/ExtratosDrawer.cs b/Decompiler/Gestor.Application.Drawers/ExtratosDrawer.cs
new file mode 100644
index 0000000..1dd3f48
--- /dev/null
+++ b/Decompiler/Gestor.Application.Drawers/ExtratosDrawer.cs
@@ -0,0 +1,246 @@
+using System;
+using System.CodeDom.Compiler;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Input;
+using System.Windows.Markup;
+using Gestor.Application.ViewModels.Drawer;
+using Gestor.Application.Views.Generic;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Relatorios.ClientesAtivosInativos;
+using Gestor.Model.Domain.Seguros;
+using MaterialDesignThemes.Wpf;
+
+namespace Gestor.Application.Drawers;
+
+public class ExtratosDrawer : BaseUserControl, IComponentConnector
+{
+	internal ProgressBar ProgressBar;
+
+	internal StackPanel Tipo;
+
+	internal StackPanel Cliente;
+
+	internal ToggleButton ClienteToggle;
+
+	internal StackPanel Documento;
+
+	internal StackPanel Endosso;
+
+	internal StackPanel Item;
+
+	internal StackPanel Perfil;
+
+	internal Snackbar Snackbar;
+
+	private bool _contentLoaded;
+
+	public ExtratosViewModel ViewModel { get; set; }
+
+	private static List Documentos { get; set; }
+
+	private static List Prospeccoes { get; set; }
+
+	private static List Selecionados { get; set; }
+
+	private static List SelecionadosPros { get; set; }
+
+	private static List Clientes { get; set; }
+
+	private static Relatorio? TipoRelatorio { get; set; }
+
+	public ExtratosDrawer(List clientes = null, List documentos = null, Relatorio? tipoRelatorio = null, List selecionados = null, List selecionadosPros = null, List prospeccaos = null)
+	{
+		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
+		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
+		//IL_006a: Expected I4, but got Unknown
+		//IL_0108: Unknown result type (might be due to invalid IL or missing references)
+		Documentos = documentos;
+		Prospeccoes = prospeccaos;
+		Selecionados = selecionados;
+		Clientes = clientes;
+		TipoRelatorio = tipoRelatorio;
+		SelecionadosPros = selecionadosPros;
+		ViewModel = new ExtratosViewModel
+		{
+			TipoDeRelatorio = tipoRelatorio
+		};
+		switch (tipoRelatorio)
+		{
+		case 2L:
+		case 4L:
+			ViewModel.TipoExtratoEnabled = false;
+			ViewModel.SelectedTipoExtrato = (TipoExtrato)1;
+			ViewModel.ClientePorPaginaVisibility = (Visibility)0;
+			ViewModel.SelecionarItensVisibility = (Visibility)2;
+			break;
+		case null:
+			ViewModel.TipoExtratoEnabled = true;
+			ViewModel.ClientePorPaginaVisibility = (Visibility)2;
+			break;
+		case 0L:
+			ViewModel.TipoExtratoEnabled = false;
+			ViewModel.SelectedTipoExtrato = (TipoExtrato)0;
+			ViewModel.SelecionarItensVisibility = (Visibility)2;
+			break;
+		default:
+			ViewModel.SelectedTipoExtrato = (TipoExtrato)1;
+			ViewModel.SelecionarItensVisibility = (Visibility)2;
+			ViewModel.SelecionarItensVisibility = (Visibility)2;
+			break;
+		}
+		if ((int)ViewModel.SelectedTipoExtrato == 0)
+		{
+			ViewModel.EsconderResumido = true;
+			ViewModel.ClienteVisibility = true;
+		}
+		((FrameworkElement)this).DataContext = ViewModel;
+		InitializeComponent();
+	}
+
+	private async void Gerar_OnClick(object sender, RoutedEventArgs e)
+	{
+		if (Clientes != null)
+		{
+			await ViewModel.PrepararExtrato(Clientes, null, null, TipoRelatorio);
+		}
+		else if (Documentos != null || Prospeccoes != null)
+		{
+			await ViewModel.PrepararExtrato(null, Documentos, Prospeccoes, TipoRelatorio, Selecionados, SelecionadosPros);
+		}
+	}
+
+	private async void GerarPDF_OnClick(object sender, RoutedEventArgs e)
+	{
+		if (Clientes != null)
+		{
+			await ViewModel.PrepararExtrato(Clientes, null, null, TipoRelatorio, null, null, pdf: true);
+		}
+		else if (Documentos != null || Prospeccoes != null)
+		{
+			await ViewModel.PrepararExtrato(null, Documentos, Prospeccoes, TipoRelatorio, Selecionados, SelecionadosPros, pdf: true);
+		}
+	}
+
+	private void Fechar_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.CloseDrawer();
+	}
+
+	private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e)
+	{
+		Snackbar.IsActive = false;
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	public void InitializeComponent()
+	{
+		if (!_contentLoaded)
+		{
+			_contentLoaded = true;
+			Uri uri = new Uri("/Gestor.Application;component/drawers/extratosdrawer.xaml", UriKind.Relative);
+			Application.LoadComponent((object)this, uri);
+		}
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	internal Delegate _CreateDelegate(Type delegateType, string handler)
+	{
+		return Delegate.CreateDelegate(delegateType, this, handler);
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	[EditorBrowsable(EditorBrowsableState.Never)]
+	void IComponentConnector.Connect(int connectionId, object target)
+	{
+		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
+		//IL_005c: Expected O, but got Unknown
+		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0069: Expected O, but got Unknown
+		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0081: Expected O, but got Unknown
+		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
+		//IL_008e: Expected O, but got Unknown
+		//IL_0091: Unknown result type (might be due to invalid IL or missing references)
+		//IL_009b: Expected O, but got Unknown
+		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00a8: Expected O, but got Unknown
+		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00b5: Expected O, but got Unknown
+		//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00c2: Expected O, but got Unknown
+		//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00cf: Expected O, but got Unknown
+		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00dc: Expected O, but got Unknown
+		//IL_00de: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00f4: Expected O, but got Unknown
+		//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0102: Unknown result type (might be due to invalid IL or missing references)
+		//IL_010c: Expected O, but got Unknown
+		//IL_010f: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0119: Expected O, but got Unknown
+		//IL_011b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0127: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0131: Expected O, but got Unknown
+		switch (connectionId)
+		{
+		case 1:
+			((UIElement)(ScrollViewer)target).PreviewMouseWheel += new MouseWheelEventHandler(base.ScrollViewer_PreviewMouseWheel);
+			break;
+		case 2:
+			ProgressBar = (ProgressBar)target;
+			break;
+		case 3:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(Fechar_OnClick);
+			break;
+		case 4:
+			Tipo = (StackPanel)target;
+			break;
+		case 5:
+			Cliente = (StackPanel)target;
+			break;
+		case 6:
+			ClienteToggle = (ToggleButton)target;
+			break;
+		case 7:
+			Documento = (StackPanel)target;
+			break;
+		case 8:
+			Endosso = (StackPanel)target;
+			break;
+		case 9:
+			Item = (StackPanel)target;
+			break;
+		case 10:
+			Perfil = (StackPanel)target;
+			break;
+		case 11:
+			((MenuItem)target).Click += new RoutedEventHandler(Gerar_OnClick);
+			break;
+		case 12:
+			((MenuItem)target).Click += new RoutedEventHandler(GerarPDF_OnClick);
+			break;
+		case 13:
+			Snackbar = (Snackbar)target;
+			break;
+		case 14:
+			((SnackbarMessage)target).ActionClick += new RoutedEventHandler(SnackbarMessage_ActionClick);
+			break;
+		default:
+			_contentLoaded = true;
+			break;
+		}
+	}
+}
diff --git a/Decompiler/Gestor.Application.Drawers/ImpostoDrawer.cs b/Decompiler/Gestor.Application.Drawers/ImpostoDrawer.cs
new file mode 100644
index 0000000..99f9755
--- /dev/null
+++ b/Decompiler/Gestor.Application.Drawers/ImpostoDrawer.cs
@@ -0,0 +1,274 @@
+using System;
+using System.CodeDom.Compiler;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Markup;
+using System.Windows.Threading;
+using Gestor.Application.Helpers;
+using Gestor.Application.ViewModels.Drawer;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Generic;
+using MaterialDesignThemes.Wpf;
+
+namespace Gestor.Application.Drawers;
+
+public class ImpostoDrawer : UserControl, IComponentConnector
+{
+	private readonly int _tipo;
+
+	private readonly long _id;
+
+	internal ProgressBar ProgressBar;
+
+	internal TextBlock TitleBox;
+
+	internal ComboBox SeguradoraBox;
+
+	internal ComboBox SeguradoraAlternativaBox;
+
+	internal ComboBox RamoBox;
+
+	internal DataGrid ArquivoGrid;
+
+	internal Snackbar SnackbarImposto;
+
+	private bool _contentLoaded;
+
+	public ImpostoViewModel ViewModel { get; set; }
+
+	public ImpostoDrawer(int tipo, long id)
+	{
+		_tipo = tipo;
+		_id = id;
+		ViewModel = new ImpostoViewModel();
+		((FrameworkElement)this).DataContext = ViewModel;
+		InitializeComponent();
+		Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher;
+		if (dispatcher != null)
+		{
+			dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad));
+		}
+	}
+
+	private async void ContentLoad()
+	{
+		ViewModel.Carregando = true;
+		await ViewModel.Carregar(_tipo, _id);
+		((Selector)SeguradoraBox).SelectionChanged += new SelectionChangedEventHandler(Indice_OnSelectionChanged);
+		((Selector)SeguradoraAlternativaBox).SelectionChanged += new SelectionChangedEventHandler(Indice_OnSelectionChanged);
+		((Selector)RamoBox).SelectionChanged += new SelectionChangedEventHandler(Indice_OnSelectionChanged);
+		ViewModel.Carregando = false;
+	}
+
+	private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e)
+	{
+		SnackbarImposto.IsActive = false;
+	}
+
+	public void Toggle(string message, bool active = true)
+	{
+		((ContentControl)SnackbarImposto.Message).Content = message;
+		SnackbarImposto.IsActive = active;
+		if (active)
+		{
+			Task.Factory.StartNew(CloseSlackBar);
+		}
+	}
+
+	private void CloseSlackBar()
+	{
+		Thread.Sleep(5000);
+		Dispatcher dispatcher = ((DispatcherObject)App.ProgressRing).Dispatcher;
+		if (dispatcher != null)
+		{
+			dispatcher.BeginInvoke((DispatcherPriority)4, (Delegate)(Action)delegate
+			{
+				Toggle("", active: false);
+			});
+		}
+	}
+
+	private async void Status_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
+	{
+		ListBox val = (ListBox)sender;
+		if (((Selector)val).SelectedItem != null)
+		{
+			ViewModel.Ativo = ((((Selector)val).SelectedIndex == 0) ? new bool?(true) : ((((Selector)val).SelectedIndex == 1) ? new bool?(false) : null));
+			TitleBox.Text = ((((Selector)val).SelectedIndex == 0) ? "IMPOSTOS ATIVOS" : ((((Selector)val).SelectedIndex == 1) ? "IMPOSTOS INATIVOS" : "TODOS IMPOSTOS"));
+			await ViewModel.Carregar(0L);
+		}
+	}
+
+	private void Fechar_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.CloseDrawer();
+	}
+
+	private void Incluir_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.Incluir();
+	}
+
+	private void Alterar_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.AlterarImposto();
+	}
+
+	private async void Salvar_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.Carregando = true;
+		List> list = await ViewModel.Salvar();
+		((DependencyObject)(object)this).ValidateFields(list);
+		bool num = list == null || list.Count == 0;
+		ViewModel.Carregando = false;
+		if (num)
+		{
+			Toggle("PARÂMETRO SALVO COM SUCESSO.");
+		}
+		else
+		{
+			await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK");
+		}
+	}
+
+	private async void Cancelar_OnClick(object sender, RoutedEventArgs e)
+	{
+		await ViewModel.Cancelar();
+	}
+
+	private void Log_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.AbrirLog((TipoTela)56, ((DomainBase)ViewModel.SelectedImposto).Id);
+	}
+
+	private async void Indice_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
+	{
+		if (!ViewModel.Carregando)
+		{
+			ViewModel.Carregando = true;
+			await ViewModel.Carregar(0L);
+			ViewModel.Carregando = false;
+		}
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	public void InitializeComponent()
+	{
+		if (!_contentLoaded)
+		{
+			_contentLoaded = true;
+			Uri uri = new Uri("/Gestor.Application;component/drawers/impostodrawer.xaml", UriKind.Relative);
+			Application.LoadComponent((object)this, uri);
+		}
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	internal Delegate _CreateDelegate(Type delegateType, string handler)
+	{
+		return Delegate.CreateDelegate(delegateType, this, handler);
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	[EditorBrowsable(EditorBrowsableState.Never)]
+	void IComponentConnector.Connect(int connectionId, object target)
+	{
+		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0055: Expected O, but got Unknown
+		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
+		//IL_006d: Expected O, but got Unknown
+		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
+		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0085: Expected O, but got Unknown
+		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0092: Expected O, but got Unknown
+		//IL_0095: Unknown result type (might be due to invalid IL or missing references)
+		//IL_009f: Expected O, but got Unknown
+		//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00ac: Expected O, but got Unknown
+		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00b9: Expected O, but got Unknown
+		//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00d1: Expected O, but got Unknown
+		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00df: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00e9: Expected O, but got Unknown
+		//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0101: Expected O, but got Unknown
+		//IL_0103: Unknown result type (might be due to invalid IL or missing references)
+		//IL_010f: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0119: Expected O, but got Unknown
+		//IL_011b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0127: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0131: Expected O, but got Unknown
+		//IL_0134: Unknown result type (might be due to invalid IL or missing references)
+		//IL_013e: Expected O, but got Unknown
+		//IL_0141: Unknown result type (might be due to invalid IL or missing references)
+		//IL_014b: Expected O, but got Unknown
+		//IL_014d: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0159: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0163: Expected O, but got Unknown
+		switch (connectionId)
+		{
+		case 1:
+			ProgressBar = (ProgressBar)target;
+			break;
+		case 2:
+			((Selector)(ListBox)target).SelectionChanged += new SelectionChangedEventHandler(Status_OnSelectionChanged);
+			break;
+		case 3:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(Fechar_OnClick);
+			break;
+		case 4:
+			TitleBox = (TextBlock)target;
+			break;
+		case 5:
+			SeguradoraBox = (ComboBox)target;
+			break;
+		case 6:
+			SeguradoraAlternativaBox = (ComboBox)target;
+			break;
+		case 7:
+			RamoBox = (ComboBox)target;
+			break;
+		case 8:
+			((MenuItem)target).Click += new RoutedEventHandler(Incluir_OnClick);
+			break;
+		case 9:
+			((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick);
+			break;
+		case 10:
+			((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick);
+			break;
+		case 11:
+			((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick);
+			break;
+		case 12:
+			((MenuItem)target).Click += new RoutedEventHandler(Log_OnClick);
+			break;
+		case 13:
+			ArquivoGrid = (DataGrid)target;
+			break;
+		case 14:
+			SnackbarImposto = (Snackbar)target;
+			break;
+		case 15:
+			((SnackbarMessage)target).ActionClick += new RoutedEventHandler(SnackbarMessage_ActionClick);
+			break;
+		default:
+			_contentLoaded = true;
+			break;
+		}
+	}
+}
diff --git a/Decompiler/Gestor.Application.Drawers/InclusaoArquivoDigitalDrawer.cs b/Decompiler/Gestor.Application.Drawers/InclusaoArquivoDigitalDrawer.cs
new file mode 100644
index 0000000..eb909b1
--- /dev/null
+++ b/Decompiler/Gestor.Application.Drawers/InclusaoArquivoDigitalDrawer.cs
@@ -0,0 +1,182 @@
+using System;
+using System.CodeDom.Compiler;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Data;
+using System.Windows.Markup;
+using System.Windows.Threading;
+using Gestor.Application.ViewModels.Drawer;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Common;
+using MaterialDesignThemes.Wpf;
+using Xceed.Wpf.AvalonDock.Controls;
+
+namespace Gestor.Application.Drawers;
+
+public class InclusaoArquivoDigitalDrawer : UserControl, IComponentConnector, IStyleConnector
+{
+	internal ProgressBar ProgressBar;
+
+	internal Snackbar SnackbarArquivoDigital;
+
+	private bool _contentLoaded;
+
+	public TarefaDrawerViewModel ViewModel { get; set; }
+
+	public InclusaoArquivoDigitalDrawer(TarefaDrawerViewModel viewModel)
+	{
+		ViewModel = viewModel;
+		((FrameworkElement)this).DataContext = ViewModel;
+		InitializeComponent();
+		ViewModel.RegistrarAcao("ACESSOU ANEXO ARQUIVO DIGITAL", 0L, (TipoTela)6);
+	}
+
+	private void DeleteArquivo_OnDeleteClick(object sender, RoutedEventArgs e)
+	{
+		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0034: Expected O, but got Unknown
+		Chip val = (Chip)((sender is Chip) ? sender : null);
+		if (val != null)
+		{
+			ListBox val2 = Extentions.FindVisualAncestor((DependencyObject)(object)val);
+			ArquivoDigital val3 = (ArquivoDigital)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)];
+			if (val3 != null)
+			{
+				ViewModel.Delete(val3);
+			}
+		}
+	}
+
+	private void AnexarArquivos_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.Anexar();
+	}
+
+	private void SalvarAnexos_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.SalvarAnexos();
+		ViewModel.CloseDrawer();
+	}
+
+	private void LimparLista_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.LimparAnexos();
+	}
+
+	private void Fechar_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.CloseDrawer();
+	}
+
+	private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e)
+	{
+		SnackbarArquivoDigital.IsActive = false;
+	}
+
+	public void Toggle(string message, bool active = true)
+	{
+		((ContentControl)SnackbarArquivoDigital.Message).Content = message;
+		SnackbarArquivoDigital.IsActive = active;
+		if (active)
+		{
+			Task.Factory.StartNew(CloseSlackBar);
+		}
+	}
+
+	private void CloseSlackBar()
+	{
+		Thread.Sleep(5000);
+		Dispatcher dispatcher = ((DispatcherObject)App.ProgressRing).Dispatcher;
+		if (dispatcher != null)
+		{
+			dispatcher.BeginInvoke((DispatcherPriority)4, (Delegate)(Action)delegate
+			{
+				Toggle("", active: false);
+			});
+		}
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	public void InitializeComponent()
+	{
+		if (!_contentLoaded)
+		{
+			_contentLoaded = true;
+			Uri uri = new Uri("/Gestor.Application;component/drawers/inclusaoarquivodigitaldrawer.xaml", UriKind.Relative);
+			Application.LoadComponent((object)this, uri);
+		}
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	[EditorBrowsable(EditorBrowsableState.Never)]
+	void IComponentConnector.Connect(int connectionId, object target)
+	{
+		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0039: Expected O, but got Unknown
+		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0051: Expected O, but got Unknown
+		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
+		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0069: Expected O, but got Unknown
+		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0081: Expected O, but got Unknown
+		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
+		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0099: Expected O, but got Unknown
+		//IL_009c: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00a6: Expected O, but got Unknown
+		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00be: Expected O, but got Unknown
+		switch (connectionId)
+		{
+		case 1:
+			ProgressBar = (ProgressBar)target;
+			break;
+		case 2:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(Fechar_OnClick);
+			break;
+		case 3:
+			((MenuItem)target).Click += new RoutedEventHandler(AnexarArquivos_OnClick);
+			break;
+		case 5:
+			((MenuItem)target).Click += new RoutedEventHandler(SalvarAnexos_OnClick);
+			break;
+		case 6:
+			((MenuItem)target).Click += new RoutedEventHandler(LimparLista_OnClick);
+			break;
+		case 7:
+			SnackbarArquivoDigital = (Snackbar)target;
+			break;
+		case 8:
+			((SnackbarMessage)target).ActionClick += new RoutedEventHandler(SnackbarMessage_ActionClick);
+			break;
+		default:
+			_contentLoaded = true;
+			break;
+		}
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	[EditorBrowsable(EditorBrowsableState.Never)]
+	void IStyleConnector.Connect(int connectionId, object target)
+	{
+		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
+		//IL_001b: Expected O, but got Unknown
+		if (connectionId == 4)
+		{
+			((Chip)target).DeleteClick += new RoutedEventHandler(DeleteArquivo_OnDeleteClick);
+		}
+	}
+}
diff --git a/Decompiler/Gestor.Application.Drawers/InfoDrawer.cs b/Decompiler/Gestor.Application.Drawers/InfoDrawer.cs
new file mode 100644
index 0000000..0d8eb03
--- /dev/null
+++ b/Decompiler/Gestor.Application.Drawers/InfoDrawer.cs
@@ -0,0 +1,196 @@
+using System;
+using System.CodeDom.Compiler;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Data;
+using System.Windows.Markup;
+using Gestor.Application.Helpers;
+using Gestor.Application.ViewModels.Drawer;
+using Gestor.Application.Views.Generic;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Domain.Seguros;
+using MaterialDesignThemes.Wpf;
+using Xceed.Wpf.AvalonDock.Controls;
+
+namespace Gestor.Application.Drawers;
+
+public class InfoDrawer : BaseUserControl, IComponentConnector, IStyleConnector
+{
+	internal ProgressBar ProgressBar;
+
+	internal DataGrid ParcelaGrid;
+
+	internal DataGridTextColumn ParcelasValorColumn;
+
+	internal DataGridTextColumn ParcelasRealizadoColumn;
+
+	internal DataGridTextColumn ParcelasComissaoColumn;
+
+	internal DataGridTextColumn ParcelasReciboColumn;
+
+	internal DataGrid ItemGrid;
+
+	internal Snackbar Snackbar;
+
+	private bool _contentLoaded;
+
+	public InfoViewModel ViewModel { get; set; }
+
+	public InfoDrawer(Documento documento, bool ocultarInfos = false)
+	{
+		ViewModel = new InfoViewModel(documento, ocultarInfos);
+		((FrameworkElement)this).DataContext = ViewModel;
+		InitializeComponent();
+		ViewModel.RegistrarAcao("ACESSOU INFORMAÇÕES" + ((documento == null || ((DomainBase)documento).Id != 0) ? $" DO DOCUMENTO DE ID \"{((documento != null) ? new long?(((DomainBase)documento).Id) : null)}\"" : ""), (documento != null) ? ((DomainBase)documento).Id : 0, (TipoTela)2, ViewModel.GerarObs(documento));
+	}
+
+	private void Fechar_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.CloseDrawer();
+	}
+
+	private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e)
+	{
+		Snackbar.IsActive = false;
+	}
+
+	private void CopyTelefoneToClipBoard_Click(object sender, RoutedEventArgs e)
+	{
+		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0007: Expected O, but got Unknown
+		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0030: Expected O, but got Unknown
+		Button val = (Button)sender;
+		ListBox val2 = Extentions.FindVisualAncestor((DependencyObject)(object)val);
+		Contato val3 = (Contato)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)];
+		val3.Numero.CopyToClipboard();
+		ViewModel.ToggleSnackBar("COPIADO - " + val3.Numero);
+	}
+
+	private async void WhatsAppMessage_Click(object sender, RoutedEventArgs e)
+	{
+		if (ViewModel.Restricao((TipoRestricao)32))
+		{
+			await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR O WHATSAPP");
+			return;
+		}
+		Button val = (Button)sender;
+		ListBox val2 = Extentions.FindVisualAncestor((DependencyObject)(object)val);
+		Contato val3 = (Contato)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)];
+		if (!("55" + val3.Numero.Clear()).EnviarWhatsapp())
+		{
+			await ViewModel.ShowMessage("HOUVE UM PROBLEMA AO ABRIR LINK DO WHATSAPP, O LINK FOI COPIADO EM SUA MAQUINA, BASTA ABRIR O NAVEGADOR DE INTERNET E COLAR NA BARRA DE ENDEREÇOS");
+		}
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	public void InitializeComponent()
+	{
+		if (!_contentLoaded)
+		{
+			_contentLoaded = true;
+			Uri uri = new Uri("/Gestor.Application;component/drawers/infodrawer.xaml", UriKind.Relative);
+			Application.LoadComponent((object)this, uri);
+		}
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	internal Delegate _CreateDelegate(Type delegateType, string handler)
+	{
+		return Delegate.CreateDelegate(delegateType, this, handler);
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	[EditorBrowsable(EditorBrowsableState.Never)]
+	void IComponentConnector.Connect(int connectionId, object target)
+	{
+		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0049: Expected O, but got Unknown
+		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0061: Expected O, but got Unknown
+		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
+		//IL_006e: Expected O, but got Unknown
+		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
+		//IL_007b: Expected O, but got Unknown
+		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0088: Expected O, but got Unknown
+		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0095: Expected O, but got Unknown
+		//IL_0098: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00a2: Expected O, but got Unknown
+		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00af: Expected O, but got Unknown
+		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00bc: Expected O, but got Unknown
+		//IL_00be: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00d4: Expected O, but got Unknown
+		switch (connectionId)
+		{
+		case 1:
+			ProgressBar = (ProgressBar)target;
+			break;
+		case 2:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(Fechar_OnClick);
+			break;
+		case 5:
+			ParcelaGrid = (DataGrid)target;
+			break;
+		case 6:
+			ParcelasValorColumn = (DataGridTextColumn)target;
+			break;
+		case 7:
+			ParcelasRealizadoColumn = (DataGridTextColumn)target;
+			break;
+		case 8:
+			ParcelasComissaoColumn = (DataGridTextColumn)target;
+			break;
+		case 9:
+			ParcelasReciboColumn = (DataGridTextColumn)target;
+			break;
+		case 10:
+			ItemGrid = (DataGrid)target;
+			break;
+		case 11:
+			Snackbar = (Snackbar)target;
+			break;
+		case 12:
+			((SnackbarMessage)target).ActionClick += new RoutedEventHandler(SnackbarMessage_ActionClick);
+			break;
+		default:
+			_contentLoaded = true;
+			break;
+		}
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	[EditorBrowsable(EditorBrowsableState.Never)]
+	void IStyleConnector.Connect(int connectionId, object target)
+	{
+		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0020: Expected O, but got Unknown
+		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
+		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0038: Expected O, but got Unknown
+		switch (connectionId)
+		{
+		case 3:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(CopyTelefoneToClipBoard_Click);
+			break;
+		case 4:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(WhatsAppMessage_Click);
+			break;
+		}
+	}
+}
diff --git a/Decompiler/Gestor.Application.Drawers/LogDrawer.cs b/Decompiler/Gestor.Application.Drawers/LogDrawer.cs
new file mode 100644
index 0000000..544485c
--- /dev/null
+++ b/Decompiler/Gestor.Application.Drawers/LogDrawer.cs
@@ -0,0 +1,92 @@
+using System;
+using System.CodeDom.Compiler;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Markup;
+using Assinador.Infrastructure.Helpers;
+using Gestor.Application.ViewModels.Drawer;
+using Gestor.Application.Views.Generic;
+using Gestor.Model.Common;
+
+namespace Gestor.Application.Drawers;
+
+public class LogDrawer : BaseUserControl, IComponentConnector
+{
+	private bool _contentLoaded;
+
+	public LogViewModel ViewModel { get; set; }
+
+	public LogDrawer(TipoTela tela, long id, List parcelas = null, int numParcela = 0)
+	{
+		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
+		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
+		ViewModel = new LogViewModel(tela, id, parcelas, numParcela);
+		((FrameworkElement)this).DataContext = ViewModel;
+		InitializeComponent();
+		string description = Functions.GetDescription((Enum)(object)tela);
+		ViewModel.RegistrarAcao($"ACESSOU LOG DE ALTERAÇÕES DE {description} DO ID \"{id}\"", id, tela, $"ID ENTIDADE: {id}\nTIPO: {description}");
+	}
+
+	private void Fechar_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.CloseDrawer();
+	}
+
+	private void MostrarCampos_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.MostrarCampos();
+	}
+
+	private void Imprimir_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.Imprimir();
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	public void InitializeComponent()
+	{
+		if (!_contentLoaded)
+		{
+			_contentLoaded = true;
+			Uri uri = new Uri("/Gestor.Application;component/drawers/logdrawer.xaml", UriKind.Relative);
+			Application.LoadComponent((object)this, uri);
+		}
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	[EditorBrowsable(EditorBrowsableState.Never)]
+	void IComponentConnector.Connect(int connectionId, object target)
+	{
+		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
+		//IL_002d: Expected O, but got Unknown
+		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
+		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0045: Expected O, but got Unknown
+		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
+		//IL_005d: Expected O, but got Unknown
+		switch (connectionId)
+		{
+		case 1:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(Fechar_OnClick);
+			break;
+		case 2:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(Imprimir_OnClick);
+			break;
+		case 3:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(MostrarCampos_OnClick);
+			break;
+		default:
+			_contentLoaded = true;
+			break;
+		}
+	}
+}
diff --git a/Decompiler/Gestor.Application.Drawers/LogEmailDrawer.cs b/Decompiler/Gestor.Application.Drawers/LogEmailDrawer.cs
new file mode 100644
index 0000000..d3d581d
--- /dev/null
+++ b/Decompiler/Gestor.Application.Drawers/LogEmailDrawer.cs
@@ -0,0 +1,80 @@
+using System;
+using System.CodeDom.Compiler;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Markup;
+using Assinador.Infrastructure.Helpers;
+using Gestor.Application.ViewModels.Drawer;
+using Gestor.Application.Views.Generic;
+using Gestor.Model.Common;
+
+namespace Gestor.Application.Drawers;
+
+public class LogEmailDrawer : BaseUserControl, IComponentConnector
+{
+	private bool _contentLoaded;
+
+	public LogEmailViewModel ViewModel { get; set; }
+
+	public LogEmailDrawer(TipoTela tela, long id, bool singleMode = false)
+	{
+		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
+		ViewModel = new LogEmailViewModel(tela, id, singleMode);
+		((FrameworkElement)this).DataContext = ViewModel;
+		InitializeComponent();
+		ViewModel.RegistrarAcao($"ACESSOU LOG DE E-MAIL DE {Functions.GetDescription((Enum)(object)tela)} DO ID \"{id}\"", id, tela, $"ID ENTIDADE: {id}\nTIPO: {Functions.GetDescription((Enum)(object)tela)}");
+	}
+
+	private void Fechar_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.CloseDrawer();
+	}
+
+	private void Imprimir_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.Imprimir();
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	public void InitializeComponent()
+	{
+		if (!_contentLoaded)
+		{
+			_contentLoaded = true;
+			Uri uri = new Uri("/Gestor.Application;component/drawers/logemaildrawer.xaml", UriKind.Relative);
+			Application.LoadComponent((object)this, uri);
+		}
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	[EditorBrowsable(EditorBrowsableState.Never)]
+	void IComponentConnector.Connect(int connectionId, object target)
+	{
+		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0021: Expected O, but got Unknown
+		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
+		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0039: Expected O, but got Unknown
+		switch (connectionId)
+		{
+		case 1:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(Fechar_OnClick);
+			break;
+		case 2:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(Imprimir_OnClick);
+			break;
+		default:
+			_contentLoaded = true;
+			break;
+		}
+	}
+}
diff --git a/Decompiler/Gestor.Application.Drawers/LogSistemaAntigo.cs b/Decompiler/Gestor.Application.Drawers/LogSistemaAntigo.cs
new file mode 100644
index 0000000..cc8c54e
--- /dev/null
+++ b/Decompiler/Gestor.Application.Drawers/LogSistemaAntigo.cs
@@ -0,0 +1,71 @@
+using System;
+using System.CodeDom.Compiler;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Markup;
+using Gestor.Application.ViewModels.Drawer;
+using Gestor.Model.Common;
+
+namespace Gestor.Application.Drawers;
+
+public class LogSistemaAntigo : UserControl, IComponentConnector
+{
+	private readonly LogSistemaAntigoViewModel _viewModel;
+
+	private bool _contentLoaded;
+
+	public LogSistemaAntigo(long id, string log)
+	{
+		_viewModel = new LogSistemaAntigoViewModel();
+		((FrameworkElement)this).DataContext = _viewModel;
+		InitializeComponent();
+		_viewModel.Descricao = $"LOG DO DOCUMENTO {id}";
+		_viewModel.Log = log;
+		_viewModel.RegistrarAcao($"ACESSOU LOG DO SISTEMA ANTIGO DO ID \"{id}\"", id, (TipoTela)2, $"ID ENTIDADE: {id}");
+	}
+
+	private void Fechar_OnClick(object sender, RoutedEventArgs e)
+	{
+		_viewModel.CloseDrawer();
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	public void InitializeComponent()
+	{
+		if (!_contentLoaded)
+		{
+			_contentLoaded = true;
+			Uri uri = new Uri("/Gestor.Application;component/drawers/logsistemaantigo.xaml", UriKind.Relative);
+			Application.LoadComponent((object)this, uri);
+		}
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	internal Delegate _CreateDelegate(Type delegateType, string handler)
+	{
+		return Delegate.CreateDelegate(delegateType, this, handler);
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	[EditorBrowsable(EditorBrowsableState.Never)]
+	void IComponentConnector.Connect(int connectionId, object target)
+	{
+		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
+		//IL_001b: Expected O, but got Unknown
+		if (connectionId == 1)
+		{
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(Fechar_OnClick);
+		}
+		else
+		{
+			_contentLoaded = true;
+		}
+	}
+}
diff --git a/Decompiler/Gestor.Application.Drawers/LogUtilizacaoDrawer.cs b/Decompiler/Gestor.Application.Drawers/LogUtilizacaoDrawer.cs
new file mode 100644
index 0000000..51b58f2
--- /dev/null
+++ b/Decompiler/Gestor.Application.Drawers/LogUtilizacaoDrawer.cs
@@ -0,0 +1,70 @@
+using System;
+using System.CodeDom.Compiler;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Markup;
+using Gestor.Application.ViewModels.Drawer;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Common;
+
+namespace Gestor.Application.Drawers;
+
+public class LogUtilizacaoDrawer : UserControl, IComponentConnector
+{
+	private readonly LogAcaoViewModel _viewModel;
+
+	private bool _contentLoaded;
+
+	public LogUtilizacaoDrawer(RegistroAcao registro, Relatorio relatorio)
+	{
+		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
+		_viewModel = new LogAcaoViewModel(registro, relatorio);
+		((FrameworkElement)this).DataContext = _viewModel;
+		InitializeComponent();
+	}
+
+	private void Fechar_OnClick(object sender, RoutedEventArgs e)
+	{
+		_viewModel.CloseDrawer();
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	public void InitializeComponent()
+	{
+		if (!_contentLoaded)
+		{
+			_contentLoaded = true;
+			Uri uri = new Uri("/Gestor.Application;component/drawers/logutilizacaodrawer.xaml", UriKind.Relative);
+			Application.LoadComponent((object)this, uri);
+		}
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	internal Delegate _CreateDelegate(Type delegateType, string handler)
+	{
+		return Delegate.CreateDelegate(delegateType, this, handler);
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	[EditorBrowsable(EditorBrowsableState.Never)]
+	void IComponentConnector.Connect(int connectionId, object target)
+	{
+		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
+		//IL_001b: Expected O, but got Unknown
+		if (connectionId == 1)
+		{
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(Fechar_OnClick);
+		}
+		else
+		{
+			_contentLoaded = true;
+		}
+	}
+}
diff --git a/Decompiler/Gestor.Application.Drawers/MetaSeguradoraView.cs b/Decompiler/Gestor.Application.Drawers/MetaSeguradoraView.cs
new file mode 100644
index 0000000..3151de6
--- /dev/null
+++ b/Decompiler/Gestor.Application.Drawers/MetaSeguradoraView.cs
@@ -0,0 +1,226 @@
+using System;
+using System.CodeDom.Compiler;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Data;
+using System.Windows.Markup;
+using System.Windows.Threading;
+using Gestor.Application.Componentes;
+using Gestor.Application.Helpers;
+using Gestor.Application.ViewModels.Drawer;
+using Gestor.Application.Views.Generic;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Domain.Seguros;
+using MaterialDesignThemes.Wpf;
+
+namespace Gestor.Application.Drawers;
+
+public class MetaSeguradoraView : BaseUserControl, IComponentConnector
+{
+	internal ProgressBar ProgressBar;
+
+	internal CustomItemValidation FaturaField;
+
+	internal DataGrid MetasGrid;
+
+	internal Snackbar Snackbar;
+
+	private bool _contentLoaded;
+
+	public MetaSeguradoraViewModel ViewModel { get; set; }
+
+	public MetaSeguradoraView(Seguradora seguradora)
+	{
+		ViewModel = new MetaSeguradoraViewModel(seguradora);
+		((FrameworkElement)this).DataContext = ViewModel;
+		InitializeComponent();
+		ViewModel.RegistrarAcao("ACESSOU METAS DE VENDA DA SEGURADORA \"" + seguradora.Nome + "\"", ((DomainBase)seguradora).Id, (TipoTela)31, $"ID: {((DomainBase)seguradora).Id}");
+	}
+
+	private void Incluir_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.Incluir();
+	}
+
+	private void Alterar_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.Alterar(alterar: true);
+	}
+
+	private async void Salvar_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.Carregando = true;
+		List> list = await ViewModel.Salvar();
+		((CollectionView)((ItemsControl)MetasGrid).Items).Refresh();
+		((DependencyObject)(object)this).ValidateFields(list);
+		bool num = list == null || list.Count == 0;
+		ViewModel.Carregando = false;
+		if (num)
+		{
+			ToggleSnackBar("META DE VENDA SALVA COM SUCESSO");
+		}
+		else
+		{
+			await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK");
+		}
+	}
+
+	private void Cancelar_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.CancelarAlteracao();
+	}
+
+	private async void Excluir_OnClick(object sender, RoutedEventArgs e)
+	{
+		if (await ViewModel.Excluir())
+		{
+			ToggleSnackBar("META DE VENDA EXCLUÍDA COM SUCESSO");
+		}
+	}
+
+	private void Fechar_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.CloseDrawer();
+	}
+
+	private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e)
+	{
+		Snackbar.IsActive = false;
+	}
+
+	public void ToggleSnackBar(string message, bool active = true)
+	{
+		((ContentControl)Snackbar.Message).Content = message;
+		Snackbar.IsActive = active;
+		if (active)
+		{
+			Task.Factory.StartNew(CloseSlackBar);
+		}
+	}
+
+	private void CloseSlackBar()
+	{
+		Thread.Sleep(5000);
+		Dispatcher dispatcher = ((DispatcherObject)ProgressBar).Dispatcher;
+		if (dispatcher != null)
+		{
+			dispatcher.BeginInvoke((DispatcherPriority)4, (Delegate)(Action)delegate
+			{
+				ToggleSnackBar("", active: false);
+			});
+		}
+	}
+
+	private void Log_OnClick(object sender, RoutedEventArgs e)
+	{
+		if (ViewModel.SelectedMetaSeguradora != null)
+		{
+			ViewModel.AbrirLog((TipoTela)31, ((DomainBase)ViewModel.SelectedMetaSeguradora).Id);
+		}
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	public void InitializeComponent()
+	{
+		if (!_contentLoaded)
+		{
+			_contentLoaded = true;
+			Uri uri = new Uri("/Gestor.Application;component/drawers/metaseguradoraview.xaml", UriKind.Relative);
+			Application.LoadComponent((object)this, uri);
+		}
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	internal Delegate _CreateDelegate(Type delegateType, string handler)
+	{
+		return Delegate.CreateDelegate(delegateType, this, handler);
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	[EditorBrowsable(EditorBrowsableState.Never)]
+	void IComponentConnector.Connect(int connectionId, object target)
+	{
+		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0049: Expected O, but got Unknown
+		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0061: Expected O, but got Unknown
+		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
+		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0079: Expected O, but got Unknown
+		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0087: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0091: Expected O, but got Unknown
+		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
+		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00a9: Expected O, but got Unknown
+		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00c1: Expected O, but got Unknown
+		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00d9: Expected O, but got Unknown
+		//IL_00db: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00f1: Expected O, but got Unknown
+		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
+		//IL_010b: Expected O, but got Unknown
+		//IL_010e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0118: Expected O, but got Unknown
+		//IL_011a: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0126: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0130: Expected O, but got Unknown
+		switch (connectionId)
+		{
+		case 1:
+			ProgressBar = (ProgressBar)target;
+			break;
+		case 2:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(Fechar_OnClick);
+			break;
+		case 3:
+			((MenuItem)target).Click += new RoutedEventHandler(Incluir_OnClick);
+			break;
+		case 4:
+			((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick);
+			break;
+		case 5:
+			((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick);
+			break;
+		case 6:
+			((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick);
+			break;
+		case 7:
+			((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick);
+			break;
+		case 8:
+			((MenuItem)target).Click += new RoutedEventHandler(Log_OnClick);
+			break;
+		case 9:
+			FaturaField = (CustomItemValidation)target;
+			break;
+		case 10:
+			MetasGrid = (DataGrid)target;
+			break;
+		case 11:
+			Snackbar = (Snackbar)target;
+			break;
+		case 12:
+			((SnackbarMessage)target).ActionClick += new RoutedEventHandler(SnackbarMessage_ActionClick);
+			break;
+		default:
+			_contentLoaded = true;
+			break;
+		}
+	}
+}
diff --git a/Decompiler/Gestor.Application.Drawers/MetaVendedorView.cs b/Decompiler/Gestor.Application.Drawers/MetaVendedorView.cs
new file mode 100644
index 0000000..f519211
--- /dev/null
+++ b/Decompiler/Gestor.Application.Drawers/MetaVendedorView.cs
@@ -0,0 +1,231 @@
+using System;
+using System.CodeDom.Compiler;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Data;
+using System.Windows.Markup;
+using System.Windows.Threading;
+using CurrencyTextBoxControl;
+using Gestor.Application.Helpers;
+using Gestor.Application.ViewModels.Drawer;
+using Gestor.Application.Views.Generic;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Domain.Seguros;
+using MaterialDesignThemes.Wpf;
+
+namespace Gestor.Application.Drawers;
+
+public class MetaVendedorView : BaseUserControl, IComponentConnector
+{
+	internal ProgressBar ProgressBar;
+
+	internal CurrencyTextBox ValorMetaBox;
+
+	internal TextBox AnoBox;
+
+	internal DataGrid MetasGrid;
+
+	internal Snackbar Snackbar;
+
+	private bool _contentLoaded;
+
+	public MetaVendedorViewModel ViewModel { get; set; }
+
+	public MetaVendedorView(Vendedor vendedor)
+	{
+		ViewModel = new MetaVendedorViewModel(vendedor);
+		((FrameworkElement)this).DataContext = ViewModel;
+		InitializeComponent();
+	}
+
+	private void Incluir_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.Incluir();
+	}
+
+	private void Alterar_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.Alterar(alterar: true);
+	}
+
+	private async void Salvar_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.Carregando = true;
+		List> list = await ViewModel.Salvar();
+		((CollectionView)((ItemsControl)MetasGrid).Items).Refresh();
+		((DependencyObject)(object)this).ValidateFields(list);
+		bool num = list == null || list.Count == 0;
+		ViewModel.Carregando = false;
+		if (num)
+		{
+			ToggleSnackBar("META DE VENDA SALVA COM SUCESSO");
+		}
+		else
+		{
+			await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK");
+		}
+	}
+
+	private void Cancelar_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.CancelarAlteracao();
+	}
+
+	private async void Excluir_OnClick(object sender, RoutedEventArgs e)
+	{
+		if (await ViewModel.Excluir())
+		{
+			ToggleSnackBar("META DE VENDA EXCLUÍDA COM SUCESSO");
+		}
+	}
+
+	private void Fechar_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.CloseDrawer();
+	}
+
+	private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e)
+	{
+		Snackbar.IsActive = false;
+	}
+
+	public void ToggleSnackBar(string message, bool active = true)
+	{
+		((ContentControl)Snackbar.Message).Content = message;
+		Snackbar.IsActive = active;
+		if (active)
+		{
+			Task.Factory.StartNew(CloseSlackBar);
+		}
+	}
+
+	private void CloseSlackBar()
+	{
+		Thread.Sleep(5000);
+		Dispatcher dispatcher = ((DispatcherObject)ProgressBar).Dispatcher;
+		if (dispatcher != null)
+		{
+			dispatcher.BeginInvoke((DispatcherPriority)4, (Delegate)(Action)delegate
+			{
+				ToggleSnackBar("", active: false);
+			});
+		}
+	}
+
+	private void Log_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.AbrirLog((TipoTela)30, ((DomainBase)ViewModel.SelectedMetaVendedor).Id);
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	public void InitializeComponent()
+	{
+		if (!_contentLoaded)
+		{
+			_contentLoaded = true;
+			Uri uri = new Uri("/Gestor.Application;component/drawers/metavendedorview.xaml", UriKind.Relative);
+			Application.LoadComponent((object)this, uri);
+		}
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	internal Delegate _CreateDelegate(Type delegateType, string handler)
+	{
+		return Delegate.CreateDelegate(delegateType, this, handler);
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	[EditorBrowsable(EditorBrowsableState.Never)]
+	void IComponentConnector.Connect(int connectionId, object target)
+	{
+		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
+		//IL_004d: Expected O, but got Unknown
+		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
+		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0065: Expected O, but got Unknown
+		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
+		//IL_007d: Expected O, but got Unknown
+		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
+		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0095: Expected O, but got Unknown
+		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00ad: Expected O, but got Unknown
+		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00c5: Expected O, but got Unknown
+		//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00dd: Expected O, but got Unknown
+		//IL_00df: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00f5: Expected O, but got Unknown
+		//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0102: Expected O, but got Unknown
+		//IL_0105: Unknown result type (might be due to invalid IL or missing references)
+		//IL_010f: Expected O, but got Unknown
+		//IL_0112: Unknown result type (might be due to invalid IL or missing references)
+		//IL_011c: Expected O, but got Unknown
+		//IL_011f: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0129: Expected O, but got Unknown
+		//IL_012b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0137: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0141: Expected O, but got Unknown
+		switch (connectionId)
+		{
+		case 1:
+			ProgressBar = (ProgressBar)target;
+			break;
+		case 2:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(Fechar_OnClick);
+			break;
+		case 3:
+			((MenuItem)target).Click += new RoutedEventHandler(Incluir_OnClick);
+			break;
+		case 4:
+			((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick);
+			break;
+		case 5:
+			((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick);
+			break;
+		case 6:
+			((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick);
+			break;
+		case 7:
+			((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick);
+			break;
+		case 8:
+			((MenuItem)target).Click += new RoutedEventHandler(Log_OnClick);
+			break;
+		case 9:
+			ValorMetaBox = (CurrencyTextBox)target;
+			break;
+		case 10:
+			AnoBox = (TextBox)target;
+			break;
+		case 11:
+			MetasGrid = (DataGrid)target;
+			break;
+		case 12:
+			Snackbar = (Snackbar)target;
+			break;
+		case 13:
+			((SnackbarMessage)target).ActionClick += new RoutedEventHandler(SnackbarMessage_ActionClick);
+			break;
+		default:
+			_contentLoaded = true;
+			break;
+		}
+	}
+}
diff --git a/Decompiler/Gestor.Application.Drawers/ObservacoesDrawer.cs b/Decompiler/Gestor.Application.Drawers/ObservacoesDrawer.cs
new file mode 100644
index 0000000..20e17db
--- /dev/null
+++ b/Decompiler/Gestor.Application.Drawers/ObservacoesDrawer.cs
@@ -0,0 +1,239 @@
+using System;
+using System.CodeDom.Compiler;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Markup;
+using System.Windows.Threading;
+using Gestor.Application.Helpers;
+using Gestor.Application.Servicos;
+using Gestor.Application.Servicos.Seguros;
+using Gestor.Application.ViewModels.Generic;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Generic;
+
+namespace Gestor.Application.Drawers;
+
+public class ObservacoesDrawer : UserControl, IComponentConnector
+{
+	private readonly BaseSegurosViewModel _viewModel;
+
+	private readonly long _id;
+
+	private TipoTela _tipo;
+
+	private ApoliceServico _apoliceServico;
+
+	private ParcelaServico _parcelaServico;
+
+	private ClienteServico _clienteServico;
+
+	internal Grid GridMainObservacao;
+
+	internal TextBlock Observacaotxt;
+
+	internal TextBox ObservacaoBox;
+
+	private bool _contentLoaded;
+
+	public ObservacoesDrawer(long id, TipoTela tipo)
+	{
+		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
+		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
+		_apoliceServico = new ApoliceServico();
+		_parcelaServico = new ParcelaServico();
+		_clienteServico = new ClienteServico();
+		_viewModel = new BaseSegurosViewModel();
+		((FrameworkElement)this).DataContext = _viewModel;
+		InitializeComponent();
+		_id = id;
+		_tipo = tipo;
+		double windowHeight = _viewModel.GetWindowHeight();
+		((FrameworkElement)GridMainObservacao).Height = windowHeight;
+		Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher;
+		if (dispatcher != null)
+		{
+			dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad));
+		}
+	}
+
+	private async void ContentLoad()
+	{
+		await LoadObservacao(_id, _tipo, salvar: false);
+	}
+
+	private async Task LoadObservacao(long id, TipoTela tipo, bool salvar)
+	{
+		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
+		string observacao2 = $"{Recursos.Usuario.Nome}, ID: {((DomainBase)Recursos.Usuario).Id}, {Funcoes.GetNetworkTime():g}{Environment.NewLine}{_viewModel.Anotacoes}{Environment.NewLine}{Environment.NewLine}{ObservacaoBox.Text}";
+		_viewModel.VerificarEnables(id);
+		switch (tipo - 1)
+		{
+		case 0:
+		{
+			Observacaotxt.Text = "OBSERVAÇÃO CLIENTE";
+			TextBox observacaoBox;
+			if (!salvar)
+			{
+				observacaoBox = ObservacaoBox;
+				observacaoBox.Text = (await _clienteServico.BuscarClienteAsync(id)).Observacao;
+				break;
+			}
+			observacaoBox = ObservacaoBox;
+			observacaoBox.Text = await _clienteServico.SalvarObservacoes(_id, observacao2);
+			if (_clienteServico.Sucesso)
+			{
+				ObservacaoBox.Text = observacao2;
+			}
+			break;
+		}
+		case 1:
+			Observacaotxt.Text = "OBSERVAÇÃO APÓLICE";
+			if (!salvar)
+			{
+				TextBox observacaoBox = ObservacaoBox;
+				observacaoBox.Text = (await _apoliceServico.BuscarApoliceAsync(id)).Observacao;
+				break;
+			}
+			observacao2 = await _apoliceServico.Save(_id, observacao2);
+			if (_apoliceServico.Sucesso)
+			{
+				ObservacaoBox.Text = observacao2;
+			}
+			break;
+		case 4:
+		{
+			Observacaotxt.Text = "OBSERVAÇÃO PARCELA";
+			TextBox observacaoBox;
+			if (!salvar)
+			{
+				observacaoBox = ObservacaoBox;
+				observacaoBox.Text = (await _parcelaServico.BuscarParcela(id)).Observacao;
+				break;
+			}
+			observacaoBox = ObservacaoBox;
+			observacaoBox.Text = await _parcelaServico.SalvarObservacoes(_id, observacao2);
+			if (_parcelaServico.Sucesso)
+			{
+				ObservacaoBox.Text = observacao2;
+			}
+			break;
+		}
+		case 2:
+		case 3:
+			break;
+		}
+	}
+
+	private void Alterar_OnClick(object sender, RoutedEventArgs e)
+	{
+		_viewModel.Alterar(alterar: true);
+	}
+
+	private async void Salvar_OnClick(object sender, RoutedEventArgs e)
+	{
+		if (!string.IsNullOrWhiteSpace(_viewModel.Anotacoes))
+		{
+			await LoadObservacao(_id, _tipo, salvar: true);
+			_viewModel.Anotacoes = string.Empty;
+			_viewModel.Alterar(alterar: false);
+		}
+	}
+
+	private void Fechar_OnClick(object sender, RoutedEventArgs e)
+	{
+		_viewModel.CloseDrawer();
+	}
+
+	private void Cancelar_OnClick(object sender, RoutedEventArgs e)
+	{
+		_viewModel.Alterar(alterar: false);
+		_viewModel.Anotacoes = string.Empty;
+	}
+
+	private async void ObservacoesDrawer_OnLoaded(object sender, RoutedEventArgs e)
+	{
+		await _viewModel.PermissaoTela((TipoTela)2);
+		_viewModel.Alterar(alterar: false);
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	public void InitializeComponent()
+	{
+		if (!_contentLoaded)
+		{
+			_contentLoaded = true;
+			Uri uri = new Uri("/Gestor.Application;component/drawers/observacoesdrawer.xaml", UriKind.Relative);
+			Application.LoadComponent((object)this, uri);
+		}
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	internal Delegate _CreateDelegate(Type delegateType, string handler)
+	{
+		return Delegate.CreateDelegate(delegateType, this, handler);
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	[EditorBrowsable(EditorBrowsableState.Never)]
+	void IComponentConnector.Connect(int connectionId, object target)
+	{
+		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0044: Expected O, but got Unknown
+		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0051: Expected O, but got Unknown
+		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
+		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0069: Expected O, but got Unknown
+		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0076: Expected O, but got Unknown
+		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
+		//IL_008e: Expected O, but got Unknown
+		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
+		//IL_009c: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00a6: Expected O, but got Unknown
+		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00be: Expected O, but got Unknown
+		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00cb: Expected O, but got Unknown
+		switch (connectionId)
+		{
+		case 1:
+			((FrameworkElement)(ObservacoesDrawer)target).Loaded += new RoutedEventHandler(ObservacoesDrawer_OnLoaded);
+			break;
+		case 2:
+			GridMainObservacao = (Grid)target;
+			break;
+		case 3:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(Fechar_OnClick);
+			break;
+		case 4:
+			Observacaotxt = (TextBlock)target;
+			break;
+		case 5:
+			((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick);
+			break;
+		case 6:
+			((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick);
+			break;
+		case 7:
+			((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick);
+			break;
+		case 8:
+			ObservacaoBox = (TextBox)target;
+			break;
+		default:
+			_contentLoaded = true;
+			break;
+		}
+	}
+}
diff --git a/Decompiler/Gestor.Application.Drawers/PermissaoUsuarioDrawer.cs b/Decompiler/Gestor.Application.Drawers/PermissaoUsuarioDrawer.cs
new file mode 100644
index 0000000..bb9a2da
--- /dev/null
+++ b/Decompiler/Gestor.Application.Drawers/PermissaoUsuarioDrawer.cs
@@ -0,0 +1,738 @@
+using System;
+using System.CodeDom.Compiler;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Data;
+using System.Windows.Input;
+using System.Windows.Markup;
+using System.Windows.Threading;
+using Gestor.Application.Actions;
+using Gestor.Application.Helpers;
+using Gestor.Application.ViewModels.Drawer;
+using Gestor.Application.Views.Generic;
+using Gestor.Common.Validation;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Domain.Seguros;
+using MaterialDesignThemes.Wpf;
+
+namespace Gestor.Application.Drawers;
+
+public class PermissaoUsuarioDrawer : BaseUserControl, IComponentConnector, IStyleConnector
+{
+	public PermissaoUsuarioViewModel ViewModel;
+
+	private bool _filtrado;
+
+	internal ProgressBar ProgressBar;
+
+	internal ToggleButton AtivoBox;
+
+	internal ScrollViewer ScrollPermissoes;
+
+	internal MenuItem DesativarPermissoes;
+
+	internal MenuItem AtivarPermissoes;
+
+	internal MenuItem MaisOpcoesButton;
+
+	internal DataGrid SegurosGrid;
+
+	internal DataGrid FerramentasGrid;
+
+	internal DataGrid ArquivoDigitalGrid;
+
+	internal MenuItem AtivarRestricoes;
+
+	internal MenuItem DesativarRestricoes;
+
+	internal DataGrid RestricoesBiGrid;
+
+	internal DataGrid RestricoesSegurosGrid;
+
+	internal DataGrid RestricoesRelatoriosGrid;
+
+	internal DataGrid RestricoesCamposRelatoriosGrid;
+
+	internal DataGrid RestricoesTotalizacoesRelatoriosGrid;
+
+	internal DataGrid RestricoesFinanceiroGrid;
+
+	internal DataGrid RestricoesFerramentasGrid;
+
+	internal DataGrid RestricoesAjudaGrid;
+
+	internal Snackbar Snackbar;
+
+	private bool _contentLoaded;
+
+	public PermissaoUsuarioDrawer(Usuario usuario)
+	{
+		ViewModel = new PermissaoUsuarioViewModel(usuario);
+		((FrameworkElement)this).DataContext = ViewModel;
+		InitializeComponent();
+		Gestor.Application.Actions.Actions.OcultarTogglesSeguros = (Action)Delegate.Combine(Gestor.Application.Actions.Actions.OcultarTogglesSeguros, new Action(OcultarTogglesSeguros));
+		Gestor.Application.Actions.Actions.OcultarTogglesFerramentas = (Action)Delegate.Combine(Gestor.Application.Actions.Actions.OcultarTogglesFerramentas, new Action(OcultarTogglesFerramentas));
+		Gestor.Application.Actions.Actions.OcultarTogglesArquivoDigital = (Action)Delegate.Combine(Gestor.Application.Actions.Actions.OcultarTogglesArquivoDigital, new Action(OcultarTogglesArquivoDigital));
+	}
+
+	private void Fechar_OnClick(object sender, RoutedEventArgs e)
+	{
+		Gestor.Application.Actions.Actions.AtualizaUsuario?.Invoke();
+		ViewModel.CloseDrawer();
+	}
+
+	private void AutoCompleteBox_Populating(object sender, PopulatingEventArgs e)
+	{
+		if (e.Parameter.Length >= 3)
+		{
+			_filtrado = true;
+			e.Cancel = true;
+			ViewModel.FiltrarRestricoesBi(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate
+			{
+				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
+				((AutoCompleteBox)sender).PopulateComplete();
+			}, TaskScheduler.FromCurrentSynchronizationContext());
+			ViewModel.FiltrarRestricoesSeguro(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate
+			{
+				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
+				((AutoCompleteBox)sender).PopulateComplete();
+			}, TaskScheduler.FromCurrentSynchronizationContext());
+			ViewModel.FiltrarRestricoesRelatorio(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate
+			{
+				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
+				((AutoCompleteBox)sender).PopulateComplete();
+			}, TaskScheduler.FromCurrentSynchronizationContext());
+			ViewModel.FiltrarRestricoesTotalizacoesRelatorio(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate
+			{
+				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
+				((AutoCompleteBox)sender).PopulateComplete();
+			}, TaskScheduler.FromCurrentSynchronizationContext());
+			ViewModel.FiltrarRestricoesCamposRelatorio(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate
+			{
+				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
+				((AutoCompleteBox)sender).PopulateComplete();
+			}, TaskScheduler.FromCurrentSynchronizationContext());
+			ViewModel.FiltrarRestricoesFinanceiro(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate
+			{
+				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
+				((AutoCompleteBox)sender).PopulateComplete();
+			}, TaskScheduler.FromCurrentSynchronizationContext());
+			ViewModel.FiltrarRestricoesFerramenta(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate
+			{
+				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
+				((AutoCompleteBox)sender).PopulateComplete();
+			}, TaskScheduler.FromCurrentSynchronizationContext());
+			ViewModel.FiltrarRestricoesAjuda(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate
+			{
+				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
+				((AutoCompleteBox)sender).PopulateComplete();
+			}, TaskScheduler.FromCurrentSynchronizationContext());
+		}
+	}
+
+	private void AutoCompleteBox_OnTextChanged(object sender, RoutedEventArgs e)
+	{
+		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
+		if (((AutoCompleteBox)sender).Text.Length < 3 && _filtrado)
+		{
+			_filtrado = false;
+			ViewModel.FiltrarRestricoesBis("");
+			ViewModel.FiltrarRestricoesSeguros("");
+			ViewModel.FiltrarRestricoesRelatorios("");
+			ViewModel.FiltrarRestricoesTotalizacoesRelatorios("");
+			ViewModel.FiltrarRestricoesCamposRelatorios("");
+			ViewModel.FiltrarRestricoesFinanceiros("");
+			ViewModel.FiltrarRestricoesFerramentas("");
+			ViewModel.FiltrarRestricoesAjudas("");
+		}
+	}
+
+	private async void SalvarPermissoes_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.Carregando = true;
+		if (await ViewModel.Salvar())
+		{
+			ToggleSnackBar("PERMISSÕES/RESTRIÇÕES SALVAS COM SUCESSO.");
+		}
+		ViewModel.Carregando = false;
+	}
+
+	private async void CopiarUsuario_OnClick(object sender, RoutedEventArgs e)
+	{
+		await AbrirCopiarPermiss();
+	}
+
+	private async void ExportarUsuario_OnClick(object sender, RoutedEventArgs e)
+	{
+		await AbrirExportarPermiss();
+	}
+
+	private async Task AbrirCopiarPermiss()
+	{
+		Tuple, Usuario, List, List, List> tuple;
+		do
+		{
+			tuple = await ViewModel.ShowCopiarPermissaoDialog();
+			if (tuple == null)
+			{
+				return;
+			}
+		}
+		while (!ViewModel.CopiarPermissoes(tuple));
+		((CollectionView)((ItemsControl)SegurosGrid).Items).Refresh();
+		((CollectionView)((ItemsControl)FerramentasGrid).Items).Refresh();
+		((CollectionView)((ItemsControl)ArquivoDigitalGrid).Items).Refresh();
+		((CollectionView)((ItemsControl)RestricoesBiGrid).Items).Refresh();
+		((CollectionView)((ItemsControl)RestricoesSegurosGrid).Items).Refresh();
+		((CollectionView)((ItemsControl)RestricoesFinanceiroGrid).Items).Refresh();
+		((CollectionView)((ItemsControl)RestricoesFerramentasGrid).Items).Refresh();
+		((CollectionView)((ItemsControl)RestricoesRelatoriosGrid).Items).Refresh();
+		((CollectionView)((ItemsControl)RestricoesTotalizacoesRelatoriosGrid).Items).Refresh();
+		((CollectionView)((ItemsControl)RestricoesCamposRelatoriosGrid).Items).Refresh();
+		FerramentasGrid.EsconderToggles((TipoTela)18, TipoToggle.Incluir | TipoToggle.Excluir);
+		FerramentasGrid.EsconderToggles((TipoTela)10, TipoToggle.Excluir);
+		FerramentasGrid.EsconderToggles((TipoTela)12, TipoToggle.Incluir | TipoToggle.Excluir);
+		FerramentasGrid.EsconderToggles((TipoTela)13, TipoToggle.Incluir | TipoToggle.Excluir);
+		SegurosGrid.EsconderToggles((TipoTela)21, TipoToggle.Incluir | TipoToggle.Alterar | TipoToggle.Excluir);
+		SegurosGrid.EsconderToggles((TipoTela)5, TipoToggle.Consultar);
+	}
+
+	private async Task AbrirExportarPermiss()
+	{
+		bool num;
+		do
+		{
+			List list = await ViewModel.ShowExportarPermissaoDialog(((DomainBase)ViewModel.SelectedUsuario).Id);
+			if (list == null)
+			{
+				return;
+			}
+			ViewModel.Carregando = true;
+			num = await ViewModel.ExportarPermissoes(list);
+			ViewModel.Carregando = false;
+		}
+		while (!num);
+		ToggleSnackBar("PERMISSÕES/RESTRIÇÕES EXPORTADAS COM SUCESSO.");
+	}
+
+	private void PermissoesGrid_OnPreviewMouseWheel(object sender, MouseWheelEventArgs e)
+	{
+		ScrollPermissoes.ScrollToVerticalOffset(ScrollPermissoes.VerticalOffset - (double)e.Delta);
+	}
+
+	private void AtivarDesativarPermissoes_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.AtivarDesativarPermissoes(ViewModel.AtivarDesativarPermissoesBool);
+	}
+
+	private void AtivarDesativarRestricoes_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.AtivarDesativarRestricoes(ViewModel.AtivarDesativarRestricoesBool);
+	}
+
+	private void UnToggleArquivosDigitais_OnChecked(object sender, RoutedEventArgs e)
+	{
+		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0015: Expected O, but got Unknown
+		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
+		//IL_002f: Expected O, but got Unknown
+		if (ViewModel.Carregado)
+		{
+			DataGridCell val = (DataGridCell)sender;
+			if (val != null)
+			{
+				ViewModel.DesabilitarArquivoDigital((PermissaoArquivoDigital)((FrameworkElement)val).DataContext);
+			}
+		}
+	}
+
+	private void ToggleArquivosDigitais_OnChecked(object sender, RoutedEventArgs e)
+	{
+		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0015: Expected O, but got Unknown
+		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
+		//IL_002f: Expected O, but got Unknown
+		if (ViewModel.Carregado)
+		{
+			DataGridCell val = (DataGridCell)sender;
+			if (val != null)
+			{
+				ViewModel.HabilitarArquivoDigital((PermissaoArquivoDigital)((FrameworkElement)val).DataContext);
+			}
+		}
+	}
+
+	private void UnToggleFerramentas_OnChecked(object sender, RoutedEventArgs e)
+	{
+		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0015: Expected O, but got Unknown
+		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0034: Expected O, but got Unknown
+		if (ViewModel.Carregado)
+		{
+			DataGridCell val = (DataGridCell)sender;
+			if (val != null)
+			{
+				ViewModel.DesabilitarConsulta((PermissaoUsuario)((FrameworkElement)val).DataContext, "Ferramentas");
+			}
+		}
+	}
+
+	private void ToggleFerramentas_OnChecked(object sender, RoutedEventArgs e)
+	{
+		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0015: Expected O, but got Unknown
+		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0034: Expected O, but got Unknown
+		if (ViewModel.Carregado)
+		{
+			DataGridCell val = (DataGridCell)sender;
+			if (val != null)
+			{
+				ViewModel.HabilitarConsulta((PermissaoUsuario)((FrameworkElement)val).DataContext, "Ferramentas");
+			}
+		}
+	}
+
+	private void UnToggleSeguros_OnChecked(object sender, RoutedEventArgs e)
+	{
+		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0015: Expected O, but got Unknown
+		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0034: Expected O, but got Unknown
+		if (ViewModel.Carregado)
+		{
+			DataGridCell val = (DataGridCell)sender;
+			if (val != null)
+			{
+				ViewModel.DesabilitarConsulta((PermissaoUsuario)((FrameworkElement)val).DataContext, "Seguros");
+			}
+		}
+	}
+
+	private void ToggleSeguros_OnChecked(object sender, RoutedEventArgs e)
+	{
+		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0015: Expected O, but got Unknown
+		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0034: Expected O, but got Unknown
+		if (ViewModel.Carregado)
+		{
+			DataGridCell val = (DataGridCell)sender;
+			if (val != null)
+			{
+				ViewModel.HabilitarConsulta((PermissaoUsuario)((FrameworkElement)val).DataContext, "Seguros");
+			}
+		}
+	}
+
+	private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e)
+	{
+		Snackbar.IsActive = false;
+	}
+
+	public void ToggleSnackBar(string message, bool active = true)
+	{
+		((ContentControl)Snackbar.Message).Content = message;
+		Snackbar.IsActive = active;
+		if (active)
+		{
+			Task.Factory.StartNew(CloseSlackBar);
+		}
+	}
+
+	private void CloseSlackBar()
+	{
+		Thread.Sleep(5000);
+		Dispatcher dispatcher = ((DispatcherObject)ProgressBar).Dispatcher;
+		if (dispatcher != null)
+		{
+			dispatcher.BeginInvoke((DispatcherPriority)4, (Delegate)(Action)delegate
+			{
+				ToggleSnackBar("", active: false);
+			});
+		}
+	}
+
+	private static void OcultarTogglesArquivoDigital()
+	{
+	}
+
+	private void OcultarTogglesFerramentas()
+	{
+		FerramentasGrid.EsconderToggles((TipoTela)18, TipoToggle.Incluir | TipoToggle.Excluir);
+		FerramentasGrid.EsconderToggles((TipoTela)10, TipoToggle.Excluir);
+		FerramentasGrid.EsconderToggles((TipoTela)12, TipoToggle.Incluir | TipoToggle.Excluir);
+		FerramentasGrid.EsconderToggles((TipoTela)13, TipoToggle.Excluir);
+	}
+
+	private void OcultarTogglesSeguros()
+	{
+		SegurosGrid.EsconderToggles((TipoTela)21, TipoToggle.Incluir | TipoToggle.Alterar | TipoToggle.Excluir);
+		SegurosGrid.EsconderToggles((TipoTela)5, TipoToggle.Consultar);
+	}
+
+	private void AbrirLogPermissoes_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.AbrirLog((TipoTela)43, ((DomainBase)ViewModel.SelectedUsuario).Id);
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	public void InitializeComponent()
+	{
+		if (!_contentLoaded)
+		{
+			_contentLoaded = true;
+			Uri uri = new Uri("/Gestor.Application;component/drawers/permissaousuariodrawer.xaml", UriKind.Relative);
+			Application.LoadComponent((object)this, uri);
+		}
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	[EditorBrowsable(EditorBrowsableState.Never)]
+	void IComponentConnector.Connect(int connectionId, object target)
+	{
+		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00b1: Expected O, but got Unknown
+		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00c9: Expected O, but got Unknown
+		//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00d6: Expected O, but got Unknown
+		//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00e3: Expected O, but got Unknown
+		//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00f0: Expected O, but got Unknown
+		//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0107: Expected O, but got Unknown
+		//IL_010a: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0114: Expected O, but got Unknown
+		//IL_0121: Unknown result type (might be due to invalid IL or missing references)
+		//IL_012b: Expected O, but got Unknown
+		//IL_012e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0138: Expected O, but got Unknown
+		//IL_013a: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0146: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0150: Expected O, but got Unknown
+		//IL_0153: Unknown result type (might be due to invalid IL or missing references)
+		//IL_015d: Expected O, but got Unknown
+		//IL_016a: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0174: Expected O, but got Unknown
+		//IL_0177: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0181: Expected O, but got Unknown
+		//IL_018e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0198: Expected O, but got Unknown
+		//IL_019b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_01a5: Expected O, but got Unknown
+		//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
+		//IL_01bc: Expected O, but got Unknown
+		//IL_01be: Unknown result type (might be due to invalid IL or missing references)
+		//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
+		//IL_01d4: Expected O, but got Unknown
+		//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
+		//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
+		//IL_01eb: Expected O, but got Unknown
+		//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
+		//IL_01f8: Expected O, but got Unknown
+		//IL_0205: Unknown result type (might be due to invalid IL or missing references)
+		//IL_020f: Expected O, but got Unknown
+		//IL_0212: Unknown result type (might be due to invalid IL or missing references)
+		//IL_021c: Expected O, but got Unknown
+		//IL_0229: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0233: Expected O, but got Unknown
+		//IL_0236: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0240: Expected O, but got Unknown
+		//IL_0243: Unknown result type (might be due to invalid IL or missing references)
+		//IL_024d: Expected O, but got Unknown
+		//IL_0250: Unknown result type (might be due to invalid IL or missing references)
+		//IL_025a: Expected O, but got Unknown
+		//IL_025d: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0267: Expected O, but got Unknown
+		//IL_0274: Unknown result type (might be due to invalid IL or missing references)
+		//IL_027e: Expected O, but got Unknown
+		//IL_0281: Unknown result type (might be due to invalid IL or missing references)
+		//IL_028b: Expected O, but got Unknown
+		//IL_028e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0298: Expected O, but got Unknown
+		//IL_029b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_02a5: Expected O, but got Unknown
+		//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
+		//IL_02b2: Expected O, but got Unknown
+		//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
+		//IL_02bf: Expected O, but got Unknown
+		//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
+		//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
+		//IL_02d7: Expected O, but got Unknown
+		//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
+		//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
+		//IL_02ef: Expected O, but got Unknown
+		//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
+		//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0307: Expected O, but got Unknown
+		//IL_0309: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0315: Unknown result type (might be due to invalid IL or missing references)
+		//IL_031f: Expected O, but got Unknown
+		switch (connectionId)
+		{
+		case 1:
+			ProgressBar = (ProgressBar)target;
+			break;
+		case 2:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(Fechar_OnClick);
+			break;
+		case 3:
+			AtivoBox = (ToggleButton)target;
+			break;
+		case 4:
+			ScrollPermissoes = (ScrollViewer)target;
+			break;
+		case 5:
+			DesativarPermissoes = (MenuItem)target;
+			DesativarPermissoes.Click += new RoutedEventHandler(AtivarDesativarPermissoes_OnClick);
+			break;
+		case 6:
+			AtivarPermissoes = (MenuItem)target;
+			AtivarPermissoes.Click += new RoutedEventHandler(AtivarDesativarPermissoes_OnClick);
+			break;
+		case 7:
+			MaisOpcoesButton = (MenuItem)target;
+			break;
+		case 8:
+			((MenuItem)target).Click += new RoutedEventHandler(AbrirLogPermissoes_OnClick);
+			break;
+		case 9:
+			SegurosGrid = (DataGrid)target;
+			((UIElement)SegurosGrid).PreviewMouseWheel += new MouseWheelEventHandler(PermissoesGrid_OnPreviewMouseWheel);
+			break;
+		case 14:
+			FerramentasGrid = (DataGrid)target;
+			((UIElement)FerramentasGrid).PreviewMouseWheel += new MouseWheelEventHandler(PermissoesGrid_OnPreviewMouseWheel);
+			break;
+		case 19:
+			ArquivoDigitalGrid = (DataGrid)target;
+			((UIElement)ArquivoDigitalGrid).PreviewMouseWheel += new MouseWheelEventHandler(PermissoesGrid_OnPreviewMouseWheel);
+			break;
+		case 23:
+			((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBox_Populating);
+			((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBox_OnTextChanged);
+			break;
+		case 24:
+			AtivarRestricoes = (MenuItem)target;
+			AtivarRestricoes.Click += new RoutedEventHandler(AtivarDesativarRestricoes_OnClick);
+			break;
+		case 25:
+			DesativarRestricoes = (MenuItem)target;
+			DesativarRestricoes.Click += new RoutedEventHandler(AtivarDesativarRestricoes_OnClick);
+			break;
+		case 26:
+			RestricoesBiGrid = (DataGrid)target;
+			break;
+		case 27:
+			RestricoesSegurosGrid = (DataGrid)target;
+			break;
+		case 28:
+			RestricoesRelatoriosGrid = (DataGrid)target;
+			break;
+		case 29:
+			RestricoesCamposRelatoriosGrid = (DataGrid)target;
+			((UIElement)RestricoesCamposRelatoriosGrid).PreviewMouseWheel += new MouseWheelEventHandler(PermissoesGrid_OnPreviewMouseWheel);
+			break;
+		case 30:
+			RestricoesTotalizacoesRelatoriosGrid = (DataGrid)target;
+			break;
+		case 31:
+			RestricoesFinanceiroGrid = (DataGrid)target;
+			break;
+		case 32:
+			RestricoesFerramentasGrid = (DataGrid)target;
+			break;
+		case 33:
+			RestricoesAjudaGrid = (DataGrid)target;
+			break;
+		case 34:
+			Snackbar = (Snackbar)target;
+			break;
+		case 35:
+			((SnackbarMessage)target).ActionClick += new RoutedEventHandler(SnackbarMessage_ActionClick);
+			break;
+		case 36:
+			((MenuItem)target).Click += new RoutedEventHandler(SalvarPermissoes_OnClick);
+			break;
+		case 37:
+			((MenuItem)target).Click += new RoutedEventHandler(CopiarUsuario_OnClick);
+			break;
+		case 38:
+			((MenuItem)target).Click += new RoutedEventHandler(ExportarUsuario_OnClick);
+			break;
+		default:
+			_contentLoaded = true;
+			break;
+		}
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	[EditorBrowsable(EditorBrowsableState.Never)]
+	void IStyleConnector.Connect(int connectionId, object target)
+	{
+		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0044: Expected O, but got Unknown
+		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0061: Expected O, but got Unknown
+		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0079: Expected O, but got Unknown
+		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0096: Expected O, but got Unknown
+		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00ae: Expected O, but got Unknown
+		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00cb: Expected O, but got Unknown
+		//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00e3: Expected O, but got Unknown
+		//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0100: Expected O, but got Unknown
+		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0112: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0118: Expected O, but got Unknown
+		//IL_012b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0135: Expected O, but got Unknown
+		//IL_0136: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0147: Unknown result type (might be due to invalid IL or missing references)
+		//IL_014d: Expected O, but got Unknown
+		//IL_0160: Unknown result type (might be due to invalid IL or missing references)
+		//IL_016a: Expected O, but got Unknown
+		//IL_016b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_017c: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0182: Expected O, but got Unknown
+		//IL_0195: Unknown result type (might be due to invalid IL or missing references)
+		//IL_019f: Expected O, but got Unknown
+		//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
+		//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
+		//IL_01b7: Expected O, but got Unknown
+		//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
+		//IL_01d4: Expected O, but got Unknown
+		//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
+		//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
+		//IL_01ec: Expected O, but got Unknown
+		//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0209: Expected O, but got Unknown
+		//IL_020a: Unknown result type (might be due to invalid IL or missing references)
+		//IL_021b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0221: Expected O, but got Unknown
+		//IL_0234: Unknown result type (might be due to invalid IL or missing references)
+		//IL_023e: Expected O, but got Unknown
+		//IL_023f: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0250: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0256: Expected O, but got Unknown
+		//IL_0269: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0273: Expected O, but got Unknown
+		//IL_0274: Unknown result type (might be due to invalid IL or missing references)
+		switch (connectionId)
+		{
+		case 10:
+		{
+			EventSetter val = new EventSetter();
+			val.Event = ToggleButton.UncheckedEvent;
+			val.Handler = (Delegate)new RoutedEventHandler(UnToggleSeguros_OnChecked);
+			((Collection)(object)((Style)target).Setters).Add((SetterBase)(object)val);
+			break;
+		}
+		case 11:
+		{
+			EventSetter val = new EventSetter();
+			val.Event = ToggleButton.CheckedEvent;
+			val.Handler = (Delegate)new RoutedEventHandler(ToggleSeguros_OnChecked);
+			((Collection)(object)((Style)target).Setters).Add((SetterBase)(object)val);
+			break;
+		}
+		case 12:
+		{
+			EventSetter val = new EventSetter();
+			val.Event = ToggleButton.CheckedEvent;
+			val.Handler = (Delegate)new RoutedEventHandler(ToggleSeguros_OnChecked);
+			((Collection)(object)((Style)target).Setters).Add((SetterBase)(object)val);
+			break;
+		}
+		case 13:
+		{
+			EventSetter val = new EventSetter();
+			val.Event = ToggleButton.CheckedEvent;
+			val.Handler = (Delegate)new RoutedEventHandler(ToggleSeguros_OnChecked);
+			((Collection)(object)((Style)target).Setters).Add((SetterBase)(object)val);
+			break;
+		}
+		case 15:
+		{
+			EventSetter val = new EventSetter();
+			val.Event = ToggleButton.UncheckedEvent;
+			val.Handler = (Delegate)new RoutedEventHandler(UnToggleFerramentas_OnChecked);
+			((Collection)(object)((Style)target).Setters).Add((SetterBase)(object)val);
+			break;
+		}
+		case 16:
+		{
+			EventSetter val = new EventSetter();
+			val.Event = ToggleButton.CheckedEvent;
+			val.Handler = (Delegate)new RoutedEventHandler(ToggleFerramentas_OnChecked);
+			((Collection)(object)((Style)target).Setters).Add((SetterBase)(object)val);
+			break;
+		}
+		case 17:
+		{
+			EventSetter val = new EventSetter();
+			val.Event = ToggleButton.CheckedEvent;
+			val.Handler = (Delegate)new RoutedEventHandler(ToggleFerramentas_OnChecked);
+			((Collection)(object)((Style)target).Setters).Add((SetterBase)(object)val);
+			break;
+		}
+		case 18:
+		{
+			EventSetter val = new EventSetter();
+			val.Event = ToggleButton.CheckedEvent;
+			val.Handler = (Delegate)new RoutedEventHandler(ToggleFerramentas_OnChecked);
+			((Collection)(object)((Style)target).Setters).Add((SetterBase)(object)val);
+			break;
+		}
+		case 20:
+		{
+			EventSetter val = new EventSetter();
+			val.Event = ToggleButton.UncheckedEvent;
+			val.Handler = (Delegate)new RoutedEventHandler(UnToggleArquivosDigitais_OnChecked);
+			((Collection)(object)((Style)target).Setters).Add((SetterBase)(object)val);
+			break;
+		}
+		case 21:
+		{
+			EventSetter val = new EventSetter();
+			val.Event = ToggleButton.CheckedEvent;
+			val.Handler = (Delegate)new RoutedEventHandler(ToggleArquivosDigitais_OnChecked);
+			((Collection)(object)((Style)target).Setters).Add((SetterBase)(object)val);
+			break;
+		}
+		case 22:
+		{
+			EventSetter val = new EventSetter();
+			val.Event = ToggleButton.CheckedEvent;
+			val.Handler = (Delegate)new RoutedEventHandler(ToggleArquivosDigitais_OnChecked);
+			((Collection)(object)((Style)target).Setters).Add((SetterBase)(object)val);
+			break;
+		}
+		case 14:
+		case 19:
+			break;
+		}
+	}
+}
diff --git a/Decompiler/Gestor.Application.Drawers/TarefaDrawer.cs b/Decompiler/Gestor.Application.Drawers/TarefaDrawer.cs
new file mode 100644
index 0000000..acd4341
--- /dev/null
+++ b/Decompiler/Gestor.Application.Drawers/TarefaDrawer.cs
@@ -0,0 +1,555 @@
+using System;
+using System.CodeDom.Compiler;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Data;
+using System.Windows.Input;
+using System.Windows.Markup;
+using System.Windows.Threading;
+using Gestor.Application.Componentes;
+using Gestor.Application.Helpers;
+using Gestor.Application.Servicos;
+using Gestor.Application.ViewModels.Drawer;
+using Gestor.Common.Validation;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Common;
+using Gestor.Model.Domain.Configuracoes;
+using Gestor.Model.Domain.Ferramentas;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Domain.Seguros;
+using MaterialDesignThemes.Wpf;
+using Xceed.Wpf.AvalonDock.Controls;
+
+namespace Gestor.Application.Drawers;
+
+public class TarefaDrawer : UserControl, IComponentConnector, IStyleConnector
+{
+	internal ProgressBar ProgressBar;
+
+	internal TextBlock TitleBox;
+
+	internal DatePicker AgendamentoBox;
+
+	internal ToggleButton AtivoBox;
+
+	internal RadioButton AnotacoesButton;
+
+	internal RadioButton AnotacoesInternasButton;
+
+	internal WebEditor Anotacoes;
+
+	internal WebEditor Historico;
+
+	internal WebEditor AnotacoesInternas;
+
+	internal WebEditor HistoricoInterno;
+
+	internal DatePicker ConclusaoBox;
+
+	internal ComboBox CboResponsavel;
+
+	internal Snackbar Snackbar;
+
+	private bool _contentLoaded;
+
+	private TarefaDrawerViewModel ViewModel { get; }
+
+	public TarefaDrawer(Tarefa tarefa, bool enableMenu = true)
+	{
+		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
+		ViewModel = new TarefaDrawerViewModel(tarefa, enableMenu);
+		((FrameworkElement)this).DataContext = ViewModel;
+		InitializeComponent();
+		Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher;
+		if (dispatcher != null)
+		{
+			dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad));
+		}
+		ViewModel.RegistrarAcao($"ACESSOU TAREFA DE {((tarefa != null) ? ValidationHelper.GetDescription((Enum)(object)tarefa.Entidade) : null)} DO DOCUMENTO DE ID \"{((tarefa != null) ? new long?(tarefa.IdEntidade) : null)}\"", (tarefa != null) ? tarefa.IdEntidade : 0, (TipoTela)38, string.Format("TIPO DE TAREFA: {0}{1}\nID DOCUMENTO: {2}", (tarefa != null) ? ValidationHelper.GetDescription((Enum)(object)tarefa.Entidade) : null, (tarefa == null || tarefa.IdCliente != 0) ? $"\nID CLIENTE: {((tarefa != null) ? new long?(tarefa.IdCliente) : null)}" : "", (tarefa != null) ? new long?(tarefa.IdEntidade) : null));
+	}
+
+	private void ContentLoad()
+	{
+		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0050: Expected O, but got Unknown
+		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0067: Expected O, but got Unknown
+		((ToggleButton)AnotacoesButton).IsChecked = ViewModel.IsAnotacoes;
+		((ToggleButton)AnotacoesInternasButton).IsChecked = !ViewModel.IsAnotacoes;
+		((ToggleButton)AnotacoesButton).Checked += new RoutedEventHandler(Anotacoes_OnChecked);
+		((ToggleButton)AnotacoesInternasButton).Checked += new RoutedEventHandler(AnotacoesInternas_OnChecked);
+	}
+
+	private void Anotacoes_OnChecked(object sender, RoutedEventArgs e)
+	{
+		ViewModel.IsAnotacoes = true;
+	}
+
+	private void AnotacoesInternas_OnChecked(object sender, RoutedEventArgs e)
+	{
+		ViewModel.IsAnotacoes = false;
+	}
+
+	private void Validar()
+	{
+		if (ViewModel.SelectedTarefa != null)
+		{
+			ViewModel.SelectedTarefa.AgendamentoRetroativo = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 45);
+			List> errorMessages = ViewModel.SelectedTarefa.Validate();
+			((DependencyObject)(object)this).ValidateFields(errorMessages, focusField: false);
+		}
+	}
+
+	private async void ExcluirTarefa_OnClick(object sender, RoutedEventArgs e)
+	{
+		Grid val = Extentions.FindVisualAncestor((DependencyObject)(Button)sender);
+		ListBox val2 = Extentions.FindVisualAncestor((DependencyObject)(object)val);
+		Tarefa item = (Tarefa)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)];
+		if (!(await ViewModel.ValidaPermissaoParaExcluirTarefa(item)))
+		{
+			await ViewModel.ShowMessage("VOCÊ NÃO TEM PERMISSÃO PARA EXCLUIR ESSA TAREFA");
+		}
+		else if (await ViewModel.Excluir(item))
+		{
+			ToggleSnackBar("TAREFA EXCLUÍDA COM SUCESSO.");
+		}
+	}
+
+	public void ToggleSnackBar(string message, bool active = true)
+	{
+		((ContentControl)Snackbar.Message).Content = message;
+		Snackbar.IsActive = active;
+		if (active)
+		{
+			Task.Factory.StartNew(CloseSlackBar);
+		}
+	}
+
+	private void CloseSlackBar()
+	{
+		Thread.Sleep(5000);
+		Dispatcher dispatcher = ((DispatcherObject)ProgressBar).Dispatcher;
+		if (dispatcher != null)
+		{
+			dispatcher.BeginInvoke((DispatcherPriority)4, (Delegate)(Action)delegate
+			{
+				ToggleSnackBar("", active: false);
+			});
+		}
+	}
+
+	private void IncluirTarefa_OnClick(object sender, RoutedEventArgs e)
+	{
+		((ToggleButton)AnotacoesButton).IsChecked = true;
+		Anotacoes.Initialize();
+		AnotacoesInternas.Initialize();
+		ViewModel.Incluir();
+		Validar();
+	}
+
+	private async void MenuList_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
+	{
+		ListBox val = (ListBox)sender;
+		if (((Selector)val).SelectedItem != null)
+		{
+			ViewModel.TituloTarefas = ((Selector)val).SelectedItem.ToString().Replace("System.Windows.Controls.ListBoxItem: ", "");
+			await ViewModel.CarregarTarefas(((Selector)val).SelectedIndex);
+		}
+	}
+
+	private void Status_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
+	{
+		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0007: Expected O, but got Unknown
+		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0025: Invalid comparison between Unknown and I4
+		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0038: Invalid comparison between Unknown and I4
+		ComboBox val = (ComboBox)sender;
+		if (val != null && ((Selector)val).SelectedItem != null)
+		{
+			ViewModel.Concluido = (int)(StatusTarefa)((Selector)val).SelectedItem == 2;
+			if ((int)(StatusTarefa)((Selector)val).SelectedItem == 2)
+			{
+				ConclusaoBox.SelectedDate = ViewModel.SelectedTarefa.Conclusao ?? Funcoes.GetNetworkTime();
+			}
+		}
+	}
+
+	private async void SalvarTarefa_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.Carregando = true;
+		ViewModel.SelectedTarefa.Anotacoes = Anotacoes.GetHtml();
+		ViewModel.SelectedTarefa.AnotacoesInternas = AnotacoesInternas.GetHtml();
+		List> list = await ViewModel.Salvar(Anotacoes.GetText(), AnotacoesInternas.GetText());
+		bool num = list == null || list.Count == 0;
+		ViewModel.Carregando = false;
+		if (num)
+		{
+			ToggleSnackBar("TAREFA SALVA COM SUCESSO.");
+			ViewModel.Alterar(alterar: false);
+			Anotacoes.Initialize();
+			AnotacoesInternas.Initialize();
+		}
+		else
+		{
+			await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK");
+		}
+	}
+
+	private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e)
+	{
+		Snackbar.IsActive = false;
+	}
+
+	private void Fechar_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.CloseDrawer();
+	}
+
+	private void Alterar_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.AlterarTarefa();
+		Anotacoes.Initialize();
+		Validar();
+	}
+
+	private void CopyTelefoneToClipBoard_Click(object sender, RoutedEventArgs e)
+	{
+		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0007: Expected O, but got Unknown
+		Button val = (Button)sender;
+		if (((FrameworkElement)val).DataContext != null)
+		{
+			object dataContext = ((FrameworkElement)val).DataContext;
+			TelefoneBase val2 = (TelefoneBase)((dataContext is TelefoneBase) ? dataContext : null);
+			if (val2 != null)
+			{
+				(val2.Prefixo + ValidationHelper.OnlyNumber(val2.Numero)).CopyToClipboard();
+				ToggleSnackBar("COPIADO - " + val2.Prefixo + ValidationHelper.OnlyNumber(val2.Numero));
+			}
+		}
+	}
+
+	private async void WhatsAppMessage_Click(object sender, RoutedEventArgs e)
+	{
+		Button val = (Button)sender;
+		if (((FrameworkElement)val).DataContext != null)
+		{
+			object dataContext = ((FrameworkElement)val).DataContext;
+			TelefoneBase val2 = (TelefoneBase)((dataContext is TelefoneBase) ? dataContext : null);
+			if (val2 != null && !((val2.Tipo.HasValue && (int)val2.Tipo.GetValueOrDefault() == 8) ? (val2.Prefixo + val2.Numero).Clear() : ("55" + val2.Prefixo + val2.Numero.Clear())).EnviarWhatsapp())
+			{
+				await ViewModel.ShowMessage("HOUVE UM PROBLEMA AO ABRIR LINK DO WHATSAPP, O LINK FOI COPIADO EM SUA MAQUINA, BASTA ABRIR O NAVEGADOR DE INTERNET E COLAR NA BARRA DE ENDEREÇOS");
+			}
+		}
+	}
+
+	private async void Cancelar_OnClick(object sender, RoutedEventArgs e)
+	{
+		await ViewModel.Cancelar();
+		Anotacoes.Initialize();
+		AnotacoesInternas.Initialize();
+	}
+
+	private void DatePicker_OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
+	{
+		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
+		DatePicker val = (DatePicker)sender;
+		val.Text = ValidationHelper.FormatDate(val.Text);
+	}
+
+	private void DataAtual_OnDoubleClick(object sender, RoutedEventArgs e)
+	{
+		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
+		((DatePicker)sender).SelectedDate = Funcoes.GetNetworkTime().Date;
+	}
+
+	private void AdicionarResponsavel_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.AdcionarResponsavel();
+	}
+
+	private async void ExcluirResponsavel_OnClick(object sender, RoutedEventArgs e)
+	{
+		Chip chip = (Chip)((sender is Chip) ? sender : null);
+		if (chip == null)
+		{
+			return;
+		}
+		if (!(await ViewModel.ValidaPermissaoParaEditarTarefa()))
+		{
+			await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA EXCLUIR RESPONSÁVEL.");
+			return;
+		}
+		ResponsavelTarefa val = (ResponsavelTarefa)((FrameworkElement)chip).DataContext;
+		if (val != null)
+		{
+			ViewModel.Responsaveis.Remove(val);
+			ViewModel.Usuarios.Add(val.Usuario);
+			ViewModel.Usuarios = new ObservableCollection(ViewModel.Usuarios.OrderBy((Usuario x) => x.Nome));
+		}
+	}
+
+	private async void AnexoTarefa_OnClick(object sender, RoutedEventArgs e)
+	{
+		if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)15).Consultar)
+		{
+			await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)15) + ".");
+			return;
+		}
+		Button val = (Button)sender;
+		if (((FrameworkElement)val).DataContext != null)
+		{
+			Tarefa val2 = (Tarefa)((FrameworkElement)val).DataContext;
+			FiltroArquivoDigital filtro = new FiltroArquivoDigital
+			{
+				Id = ((DomainBase)val2).Id,
+				Tipo = (TipoArquivoDigital)15,
+				Parente = val2
+			};
+			ViewModel.ShowDrawer(new ArquivoDigitalDrawer(filtro), 0, close: false);
+		}
+	}
+
+	private void InxlusaoAnexoTarefa_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.ArquivosAnexados = new ObservableCollection(ViewModel.ArquivosFinais);
+		ViewModel.ShowDrawer(new InclusaoArquivoDigitalDrawer(ViewModel), 0, close: false);
+	}
+
+	private void Imprimir_OnClick(object sender, RoutedEventArgs e)
+	{
+		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0007: Expected O, but got Unknown
+		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
+		//IL_001c: Expected O, but got Unknown
+		Button val = (Button)sender;
+		if (((FrameworkElement)val).DataContext != null)
+		{
+			Tarefa val2 = (Tarefa)((FrameworkElement)val).DataContext;
+			if (((DomainBase)val2).Id != 0L)
+			{
+				ViewModel.SelectedTarefa = val2;
+				ViewModel.Print();
+			}
+		}
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	public void InitializeComponent()
+	{
+		if (!_contentLoaded)
+		{
+			_contentLoaded = true;
+			Uri uri = new Uri("/Gestor.Application;component/drawers/tarefadrawer.xaml", UriKind.Relative);
+			Application.LoadComponent((object)this, uri);
+		}
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	internal Delegate _CreateDelegate(Type delegateType, string handler)
+	{
+		return Delegate.CreateDelegate(delegateType, this, handler);
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	[EditorBrowsable(EditorBrowsableState.Never)]
+	void IComponentConnector.Connect(int connectionId, object target)
+	{
+		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
+		//IL_008d: Expected O, but got Unknown
+		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
+		//IL_009b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00a5: Expected O, but got Unknown
+		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00bd: Expected O, but got Unknown
+		//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00ca: Expected O, but got Unknown
+		//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00e2: Expected O, but got Unknown
+		//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00fa: Expected O, but got Unknown
+		//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0108: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0112: Expected O, but got Unknown
+		//IL_0114: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0120: Unknown result type (might be due to invalid IL or missing references)
+		//IL_012a: Expected O, but got Unknown
+		//IL_012c: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0138: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0142: Expected O, but got Unknown
+		//IL_0145: Unknown result type (might be due to invalid IL or missing references)
+		//IL_014f: Expected O, but got Unknown
+		//IL_015c: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0166: Expected O, but got Unknown
+		//IL_0173: Unknown result type (might be due to invalid IL or missing references)
+		//IL_017d: Expected O, but got Unknown
+		//IL_0180: Unknown result type (might be due to invalid IL or missing references)
+		//IL_018a: Expected O, but got Unknown
+		//IL_018d: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0197: Expected O, but got Unknown
+		//IL_019a: Unknown result type (might be due to invalid IL or missing references)
+		//IL_01a4: Expected O, but got Unknown
+		//IL_01da: Unknown result type (might be due to invalid IL or missing references)
+		//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
+		//IL_01f0: Expected O, but got Unknown
+		//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
+		//IL_01fd: Expected O, but got Unknown
+		//IL_020a: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0214: Expected O, but got Unknown
+		//IL_0221: Unknown result type (might be due to invalid IL or missing references)
+		//IL_022b: Expected O, but got Unknown
+		//IL_022e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0238: Expected O, but got Unknown
+		//IL_023a: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0246: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0250: Expected O, but got Unknown
+		//IL_0253: Unknown result type (might be due to invalid IL or missing references)
+		//IL_025d: Expected O, but got Unknown
+		//IL_025f: Unknown result type (might be due to invalid IL or missing references)
+		//IL_026b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0275: Expected O, but got Unknown
+		switch (connectionId)
+		{
+		case 1:
+			ProgressBar = (ProgressBar)target;
+			break;
+		case 2:
+			((Selector)(ListBox)target).SelectionChanged += new SelectionChangedEventHandler(MenuList_OnSelectionChanged);
+			break;
+		case 3:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(Fechar_OnClick);
+			break;
+		case 4:
+			TitleBox = (TextBlock)target;
+			break;
+		case 7:
+			((MenuItem)target).Click += new RoutedEventHandler(IncluirTarefa_OnClick);
+			break;
+		case 8:
+			((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick);
+			break;
+		case 9:
+			((MenuItem)target).Click += new RoutedEventHandler(SalvarTarefa_OnClick);
+			break;
+		case 10:
+			((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick);
+			break;
+		case 11:
+			((MenuItem)target).Click += new RoutedEventHandler(InxlusaoAnexoTarefa_OnClick);
+			break;
+		case 15:
+			AgendamentoBox = (DatePicker)target;
+			((UIElement)AgendamentoBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(DatePicker_OnLostKeyboardFocus);
+			((Control)AgendamentoBox).MouseDoubleClick += new MouseButtonEventHandler(DataAtual_OnDoubleClick);
+			break;
+		case 16:
+			AtivoBox = (ToggleButton)target;
+			break;
+		case 17:
+			AnotacoesButton = (RadioButton)target;
+			break;
+		case 18:
+			AnotacoesInternasButton = (RadioButton)target;
+			break;
+		case 19:
+			Anotacoes = (WebEditor)target;
+			break;
+		case 20:
+			Historico = (WebEditor)target;
+			break;
+		case 21:
+			AnotacoesInternas = (WebEditor)target;
+			break;
+		case 22:
+			HistoricoInterno = (WebEditor)target;
+			break;
+		case 23:
+			((Selector)(ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(Status_OnSelectionChanged);
+			break;
+		case 24:
+			ConclusaoBox = (DatePicker)target;
+			((UIElement)ConclusaoBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(DatePicker_OnLostKeyboardFocus);
+			((Control)ConclusaoBox).MouseDoubleClick += new MouseButtonEventHandler(DataAtual_OnDoubleClick);
+			break;
+		case 25:
+			CboResponsavel = (ComboBox)target;
+			break;
+		case 26:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(AdicionarResponsavel_OnClick);
+			break;
+		case 28:
+			Snackbar = (Snackbar)target;
+			break;
+		case 29:
+			((SnackbarMessage)target).ActionClick += new RoutedEventHandler(SnackbarMessage_ActionClick);
+			break;
+		default:
+			_contentLoaded = true;
+			break;
+		}
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	[EditorBrowsable(EditorBrowsableState.Never)]
+	void IStyleConnector.Connect(int connectionId, object target)
+	{
+		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
+		//IL_006f: Expected O, but got Unknown
+		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
+		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0087: Expected O, but got Unknown
+		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0095: Unknown result type (might be due to invalid IL or missing references)
+		//IL_009f: Expected O, but got Unknown
+		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
+		//IL_003f: Expected O, but got Unknown
+		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00b7: Expected O, but got Unknown
+		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
+		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0057: Expected O, but got Unknown
+		switch (connectionId)
+		{
+		case 5:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(CopyTelefoneToClipBoard_Click);
+			break;
+		case 6:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(WhatsAppMessage_Click);
+			break;
+		case 12:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirTarefa_OnClick);
+			break;
+		case 13:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(AnexoTarefa_OnClick);
+			break;
+		case 14:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(Imprimir_OnClick);
+			break;
+		case 27:
+			((Chip)target).DeleteClick += new RoutedEventHandler(ExcluirResponsavel_OnClick);
+			break;
+		}
+	}
+}
diff --git a/Decompiler/Gestor.Application.Drawers/ValoresApoliceDrawer.cs b/Decompiler/Gestor.Application.Drawers/ValoresApoliceDrawer.cs
new file mode 100644
index 0000000..cd893d3
--- /dev/null
+++ b/Decompiler/Gestor.Application.Drawers/ValoresApoliceDrawer.cs
@@ -0,0 +1,62 @@
+using System;
+using System.CodeDom.Compiler;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Markup;
+using Gestor.Application.ViewModels.Drawer;
+using Gestor.Application.Views.Generic;
+using Gestor.Model.Domain.Seguros;
+
+namespace Gestor.Application.Drawers;
+
+public class ValoresApoliceDrawer : BaseUserControl, IComponentConnector
+{
+	private bool _contentLoaded;
+
+	public ValoresApoliceViewModel ViewModel { get; set; }
+
+	public ValoresApoliceDrawer(Documento documento)
+	{
+		ViewModel = new ValoresApoliceViewModel(documento);
+		((FrameworkElement)this).DataContext = ViewModel;
+		InitializeComponent();
+	}
+
+	private void Fechar_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.CloseDrawer();
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	public void InitializeComponent()
+	{
+		if (!_contentLoaded)
+		{
+			_contentLoaded = true;
+			Uri uri = new Uri("/Gestor.Application;component/drawers/valoresapolicedrawer.xaml", UriKind.Relative);
+			Application.LoadComponent((object)this, uri);
+		}
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	[EditorBrowsable(EditorBrowsableState.Never)]
+	void IComponentConnector.Connect(int connectionId, object target)
+	{
+		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
+		//IL_001b: Expected O, but got Unknown
+		if (connectionId == 1)
+		{
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(Fechar_OnClick);
+		}
+		else
+		{
+			_contentLoaded = true;
+		}
+	}
+}
diff --git a/Decompiler/Gestor.Application.Drawers/ValoresParcelaDrawer.cs b/Decompiler/Gestor.Application.Drawers/ValoresParcelaDrawer.cs
new file mode 100644
index 0000000..9ef95f3
--- /dev/null
+++ b/Decompiler/Gestor.Application.Drawers/ValoresParcelaDrawer.cs
@@ -0,0 +1,70 @@
+using System;
+using System.CodeDom.Compiler;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Markup;
+using Gestor.Application.ViewModels.Drawer;
+using Gestor.Application.Views.Generic;
+using Gestor.Model.Domain.Seguros;
+
+namespace Gestor.Application.Drawers;
+
+public class ValoresParcelaDrawer : BaseUserControl, IComponentConnector
+{
+	internal DockPanel pnlStatusParcelaExtrato;
+
+	private bool _contentLoaded;
+
+	public ValoresParcelaViewModel ViewModel { get; set; }
+
+	public ValoresParcelaDrawer(Parcela parcela, Documento documento)
+	{
+		ViewModel = new ValoresParcelaViewModel(parcela, documento);
+		((FrameworkElement)this).DataContext = ViewModel;
+		InitializeComponent();
+	}
+
+	private void Fechar_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.CloseDrawer();
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	public void InitializeComponent()
+	{
+		if (!_contentLoaded)
+		{
+			_contentLoaded = true;
+			Uri uri = new Uri("/Gestor.Application;component/drawers/valoresparceladrawer.xaml", UriKind.Relative);
+			Application.LoadComponent((object)this, uri);
+		}
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	[EditorBrowsable(EditorBrowsableState.Never)]
+	void IComponentConnector.Connect(int connectionId, object target)
+	{
+		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0021: Expected O, but got Unknown
+		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
+		//IL_002e: Expected O, but got Unknown
+		switch (connectionId)
+		{
+		case 1:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(Fechar_OnClick);
+			break;
+		case 2:
+			pnlStatusParcelaExtrato = (DockPanel)target;
+			break;
+		default:
+			_contentLoaded = true;
+			break;
+		}
+	}
+}
diff --git a/Decompiler/Gestor.Application.Drawers/VinculoVendedorDrawer.cs b/Decompiler/Gestor.Application.Drawers/VinculoVendedorDrawer.cs
new file mode 100644
index 0000000..1e570a0
--- /dev/null
+++ b/Decompiler/Gestor.Application.Drawers/VinculoVendedorDrawer.cs
@@ -0,0 +1,135 @@
+using System;
+using System.CodeDom.Compiler;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Markup;
+using Gestor.Application.ViewModels.Drawer;
+using Gestor.Application.Views.Generic;
+using Gestor.Common.Validation;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Domain.Seguros;
+
+namespace Gestor.Application.Drawers;
+
+public class VinculoVendedorDrawer : BaseUserControl, IComponentConnector
+{
+	public VinculoVendedorViewModel ViewModel;
+
+	internal DataGrid VendedorGrid;
+
+	internal DataGrid VinculadoGrid;
+
+	private bool _contentLoaded;
+
+	public VinculoVendedorDrawer(Usuario usuario)
+	{
+		ViewModel = new VinculoVendedorViewModel(usuario);
+		((FrameworkElement)this).DataContext = ViewModel;
+		InitializeComponent();
+	}
+
+	private void AutoCompleteBox_Populating(object sender, PopulatingEventArgs e)
+	{
+		if (e.Parameter.Length >= 3)
+		{
+			e.Cancel = true;
+			ViewModel.BuscarVinculoVendedor(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate
+			{
+				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
+				((AutoCompleteBox)sender).PopulateComplete();
+			}, TaskScheduler.FromCurrentSynchronizationContext());
+		}
+	}
+
+	private async void AutoCompleteBox_OnTextChanged(object sender, RoutedEventArgs e)
+	{
+		if (!(((AutoCompleteBox)sender).Text != string.Empty))
+		{
+			await ViewModel.BuscarVinculoVendedor("");
+		}
+	}
+
+	private async void SalvarVinculo_OnClick(object sender, RoutedEventArgs e)
+	{
+		await ViewModel.Salvar();
+		ViewModel.ToggleSnackBar("VÍNCULO DE USUÁRIO SALVO COM SUCESSO.");
+	}
+
+	private void Fechar_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.CloseDrawer();
+	}
+
+	private void AbrirLog_OnClick(object sender, RoutedEventArgs e)
+	{
+		ViewModel.AbrirLog((TipoTela)45, ((DomainBase)ViewModel.SelectedUsuario).Id);
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	public void InitializeComponent()
+	{
+		if (!_contentLoaded)
+		{
+			_contentLoaded = true;
+			Uri uri = new Uri("/Gestor.Application;component/drawers/vinculovendedordrawer.xaml", UriKind.Relative);
+			Application.LoadComponent((object)this, uri);
+		}
+	}
+
+	[DebuggerNonUserCode]
+	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+	[EditorBrowsable(EditorBrowsableState.Never)]
+	void IComponentConnector.Connect(int connectionId, object target)
+	{
+		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
+		//IL_003c: Expected O, but got Unknown
+		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0054: Expected O, but got Unknown
+		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
+		//IL_006b: Expected O, but got Unknown
+		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0079: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0083: Expected O, but got Unknown
+		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0090: Expected O, but got Unknown
+		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
+		//IL_009d: Expected O, but got Unknown
+		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00b5: Expected O, but got Unknown
+		switch (connectionId)
+		{
+		case 1:
+			((ButtonBase)(Button)target).Click += new RoutedEventHandler(Fechar_OnClick);
+			break;
+		case 2:
+			((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBox_Populating);
+			((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBox_OnTextChanged);
+			break;
+		case 3:
+			((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick);
+			break;
+		case 4:
+			VendedorGrid = (DataGrid)target;
+			break;
+		case 5:
+			VinculadoGrid = (DataGrid)target;
+			break;
+		case 6:
+			((MenuItem)target).Click += new RoutedEventHandler(SalvarVinculo_OnClick);
+			break;
+		default:
+			_contentLoaded = true;
+			break;
+		}
+	}
+}
diff --git a/Decompiler/Gestor.Application.Helpers/ApplicationHelper.cs b/Decompiler/Gestor.Application.Helpers/ApplicationHelper.cs
new file mode 100644
index 0000000..97acd7d
--- /dev/null
+++ b/Decompiler/Gestor.Application.Helpers/ApplicationHelper.cs
@@ -0,0 +1,54 @@
+using System;
+using Agger.Registro;
+using Gestor.Common.Helpers;
+
+namespace Gestor.Application.Helpers;
+
+public class ApplicationHelper
+{
+	private static string _numeroSerial;
+
+	private const string ChaveSerial = "NS";
+
+	public static string NumeroSerial
+	{
+		get
+		{
+			return _numeroSerial ?? GetSerialNumber();
+		}
+		set
+		{
+			_numeroSerial = value;
+		}
+	}
+
+	public static bool Conectado { get; set; } = true;
+
+
+	public static bool Beta { get; set; } = false;
+
+
+	public static long IdFornecedor { get; set; }
+
+	public static string Subkey { get; set; }
+
+	public static DateTime ChecagemVersao { get; set; } = Funcoes.GetNetworkTime();
+
+
+	public static Version Versao { get; set; }
+
+	internal static string GetSerialNumber()
+	{
+		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
+		try
+		{
+			string text = new RegistryHelper(Subkey).Read("NS", true);
+			NumeroSerial = (string.IsNullOrEmpty(text) ? null : EncryptionHelper.Decrypt(text));
+			return NumeroSerial;
+		}
+		catch (Exception)
+		{
+			return null;
+		}
+	}
+}
diff --git a/Decompiler/Gestor.Application.Helpers/ArquivoDigital.cs b/Decompiler/Gestor.Application.Helpers/ArquivoDigital.cs
new file mode 100644
index 0000000..4926944
--- /dev/null
+++ b/Decompiler/Gestor.Application.Helpers/ArquivoDigital.cs
@@ -0,0 +1,38 @@
+using ArquivoDigital.Infrastructure.UnitOfWork.Logic;
+using Gestor.Application.Servicos.Generic;
+using Gestor.Model.Domain.Common;
+
+namespace Gestor.Application.Helpers;
+
+public static class ArquivoDigital
+{
+	public static string ConexaoAd = null;
+
+	public static UnitOfWork Commited => UnitOfWork();
+
+	public static UnitOfWork Read => UnitOfWork(withTransaction: false);
+
+	public static string Banco { get; set; }
+
+	public static string Tabela { get; set; } = "arquivodigital";
+
+
+	private static UnitOfWork UnitOfWork(bool withTransaction = true, bool reconect = false)
+	{
+		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0022: Expected O, but got Unknown
+		if (ConexaoAd == null)
+		{
+			SetConnection();
+		}
+		return new UnitOfWork(ConexaoAd, Tabela, withTransaction);
+	}
+
+	public static void SetConnection(string banco = "")
+	{
+		ControleArquivoDigital val = (string.IsNullOrEmpty(banco) ? new BaseServico().ArquivoDigital().Result : new BaseServico().ArquivoDigital(banco).Result);
+		Banco = val.Catalogo;
+		Tabela = (string.IsNullOrWhiteSpace(val.Tabela) ? "arquivodigital" : val.Tabela);
+		ConexaoAd = "Server=" + Connection.Server + ";initial catalog=" + val.Catalogo + ";user=" + Connection.User + ";password=" + Connection.Password + ";";
+	}
+}
diff --git a/Decompiler/Gestor.Application.Helpers/AssinadorHelper.cs b/Decompiler/Gestor.Application.Helpers/AssinadorHelper.cs
new file mode 100644
index 0000000..ecc002f
--- /dev/null
+++ b/Decompiler/Gestor.Application.Helpers/AssinadorHelper.cs
@@ -0,0 +1,183 @@
+using System;
+using System.Net;
+using System.Net.Http;
+using System.Net.Http.Headers;
+using System.Text;
+using System.Threading.Tasks;
+using Agger.Registro;
+using Assinador.Model.Domain;
+using Newtonsoft.Json;
+using Sign.Modelos;
+
+namespace Gestor.Application.Helpers;
+
+public static class AssinadorHelper
+{
+	private static ParametrosAssinaturaAssinador _parametros;
+
+	public const string Authorization = "Authorization";
+
+	public const string Server = "Server";
+
+	public const string Contrato = "Purchase";
+
+	public const string Adquirir = "Purchase/BuyPackage";
+
+	public const string Disponiveis = "Sign/Availble";
+
+	public const string Contratadas = "Sign/Purchased";
+
+	private static string ApiKey { get; set; }
+
+	public static Remetente Remetente { get; set; }
+
+	public static ParametrosAssinaturaAssinador Parametros
+	{
+		get
+		{
+			return _parametros;
+		}
+		set
+		{
+			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
+			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
+			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
+			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
+			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
+			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
+			//IL_004e: Expected O, but got Unknown
+			_parametros = value;
+			if (value != null)
+			{
+				Remetente = new Remetente
+				{
+					Id = ApplicationHelper.IdFornecedor,
+					Documento = value.Documento,
+					Email = value.Email,
+					Nome = value.Nome,
+					Serial = ApplicationHelper.NumeroSerial
+				};
+			}
+		}
+	}
+
+	public static async Task Key()
+	{
+		string key = null;
+		try
+		{
+			key = await string.Format("{0}{1}/86", Address.AssinadorApi(), "Authorization").Get(ApplicationHelper.NumeroSerial.BasicKey(), basic: true);
+		}
+		catch (Exception)
+		{
+		}
+		return key;
+	}
+
+	public static async Task Licencas(string key)
+	{
+		if (key == null)
+		{
+			return 0;
+		}
+		int licencas = 0;
+		try
+		{
+			licencas = int.Parse(await string.Format("{0}{1}/{2}", Address.AssinadorApi(), "Sign/Availble", ApplicationHelper.IdFornecedor).Get(key));
+		}
+		catch (Exception)
+		{
+		}
+		return licencas;
+	}
+
+	public static async Task Contratado(long id)
+	{
+		return await string.Format("{0}{1}/{2}/86", Address.GestorApi(), "Purchase", id).Get(ApplicationHelper.NumeroSerial.BasicKey(), basic: true) == "true";
+	}
+
+	public static string BasicKey(this string serial)
+	{
+		return Base64EncodeBasic($"{serial}:{Funcoes.GetNetworkTime().ToUniversalTime().Ticks}");
+	}
+
+	private static string Base64EncodeBasic(string plainText)
+	{
+		return Convert.ToBase64String(Encoding.UTF8.GetBytes(plainText));
+	}
+
+	public static async Task Get(this string command, string token = null, bool basic = false)
+	{
+		string text = (basic ? "Basic" : "Token");
+		Uri uri = new Uri(Address.GestorApi(), command);
+		HttpClient val = new HttpClient();
+		if (!string.IsNullOrWhiteSpace(token))
+		{
+			val.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(text, token);
+		}
+		ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
+		HttpResponseMessage val2;
+		try
+		{
+			val2 = await val.GetAsync(uri).ConfigureAwait(continueOnCapturedContext: false);
+		}
+		catch (Exception)
+		{
+			return HttpStatusCode.InternalServerError;
+		}
+		return val2.StatusCode;
+	}
+
+	internal static async Task Get(this string command, string token = null, bool basic = false) where T : class
+	{
+		string text = (basic ? "Basic" : "Token");
+		Uri uri = new Uri(command);
+		HttpClient val = new HttpClient();
+		if (!string.IsNullOrWhiteSpace(token))
+		{
+			val.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(text, token);
+		}
+		ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
+		HttpResponseMessage val2;
+		try
+		{
+			val2 = await val.GetAsync(uri).ConfigureAwait(continueOnCapturedContext: false);
+		}
+		catch (Exception)
+		{
+			return null;
+		}
+		if (val2.StatusCode != HttpStatusCode.OK)
+		{
+			return null;
+		}
+		_ = val2.Content.ReadAsStringAsync().Result;
+		return JsonConvert.DeserializeObject(val2.Content.ReadAsStringAsync().Result);
+	}
+
+	internal static async Task Put(this string command, T keyValues, string token = null, bool basic = false) where T : class
+	{
+		string text = (basic ? "Basic" : "Token");
+		Uri uri = new Uri(command);
+		StringContent val = new StringContent(JsonConvert.SerializeObject((object)keyValues, (Formatting)1, new JsonSerializerSettings
+		{
+			ReferenceLoopHandling = (ReferenceLoopHandling)1
+		}), Encoding.UTF8, "application/json");
+		HttpClient val2 = new HttpClient();
+		ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
+		if (!string.IsNullOrWhiteSpace(token))
+		{
+			val2.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(text, token);
+		}
+		HttpResponseMessage val3 = await val2.PutAsync(uri, (HttpContent)(object)val);
+		if (val3.StatusCode != HttpStatusCode.OK && val3.StatusCode != HttpStatusCode.NoContent)
+		{
+			return null;
+		}
+		if (val3.StatusCode == HttpStatusCode.NoContent)
+		{
+			return null;
+		}
+		return JsonConvert.DeserializeObject(val3.Content.ReadAsStringAsync().Result);
+	}
+}
diff --git a/Decompiler/Gestor.Application.Helpers/BindingEnumHelper.cs b/Decompiler/Gestor.Application.Helpers/BindingEnumHelper.cs
new file mode 100644
index 0000000..aa28e3a
--- /dev/null
+++ b/Decompiler/Gestor.Application.Helpers/BindingEnumHelper.cs
@@ -0,0 +1,45 @@
+using System;
+using System.ComponentModel;
+using System.Text;
+
+namespace Gestor.Application.Helpers;
+
+public class BindingEnumHelper
+{
+	public static string ConcatenarDescricoesEnum(string valores) where TEnum : Enum
+	{
+		if (valores == null)
+		{
+			return null;
+		}
+		return ConcatenarDescricoesEnum(Array.ConvertAll(valores.Split(new char[1] { ',' }), int.Parse));
+	}
+
+	private static string ConcatenarDescricoesEnum(int[] valores) where TEnum : Enum
+	{
+		StringBuilder stringBuilder = new StringBuilder();
+		foreach (int num in valores)
+		{
+			if (Enum.IsDefined(typeof(TEnum), num))
+			{
+				string text = ObterDescricaoEnum((TEnum)Enum.ToObject(typeof(TEnum), num));
+				stringBuilder.Append(text + ", ");
+			}
+			else
+			{
+				stringBuilder.Append("Valor desconhecido, ");
+			}
+		}
+		return stringBuilder.ToString().TrimEnd(',', ' ');
+	}
+
+	private static string ObterDescricaoEnum(TEnum valor) where TEnum : Enum
+	{
+		DescriptionAttribute[] array = (DescriptionAttribute[])valor.GetType().GetField(valor.ToString()).GetCustomAttributes(typeof(DescriptionAttribute), inherit: false);
+		if (array != null && array.Length != 0)
+		{
+			return array[0].Description;
+		}
+		return valor.ToString();
+	}
+}
diff --git a/Decompiler/Gestor.Application.Helpers/BindingHelper.cs b/Decompiler/Gestor.Application.Helpers/BindingHelper.cs
new file mode 100644
index 0000000..cece7c8
--- /dev/null
+++ b/Decompiler/Gestor.Application.Helpers/BindingHelper.cs
@@ -0,0 +1,327 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Data;
+using CurrencyTextBoxControl;
+using Gestor.Common.Helpers;
+using Gestor.Common.Validation;
+using Gestor.Model.Helper;
+
+namespace Gestor.Application.Helpers;
+
+public static class BindingHelper
+{
+	public static void DeleteValidationRule(object control)
+	{
+		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0047: Expected O, but got Unknown
+		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
+		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_008d: Expected O, but got Unknown
+		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0091: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
+		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00d3: Expected O, but got Unknown
+		//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
+		switch (control.GetType().Name)
+		{
+		case "TextBox":
+		{
+			Binding val = (Binding)(((object)BindingOperations.GetBinding((DependencyObject)(TextBox)control, TextBox.TextProperty)) ?? ((object)new Binding
+			{
+				Mode = (BindingMode)0,
+				UpdateSourceTrigger = (UpdateSourceTrigger)1
+			}));
+			val.ValidationRules.Clear();
+			((FrameworkElement)(TextBox)control).SetBinding(TextBox.TextProperty, (BindingBase)(object)val);
+			break;
+		}
+		case "DatePicker":
+		{
+			Binding val = (Binding)(((object)BindingOperations.GetBinding((DependencyObject)(DatePicker)control, DatePicker.SelectedDateProperty)) ?? ((object)new Binding
+			{
+				Mode = (BindingMode)0,
+				UpdateSourceTrigger = (UpdateSourceTrigger)1
+			}));
+			val.ValidationRules.Clear();
+			((FrameworkElement)(DatePicker)control).SetBinding(DatePicker.SelectedDateProperty, (BindingBase)(object)val);
+			break;
+		}
+		case "CurrencyTextBox":
+		{
+			Binding val = (Binding)(((object)BindingOperations.GetBinding((DependencyObject)(CurrencyTextBox)control, CurrencyTextBox.NumberProperty)) ?? ((object)new Binding
+			{
+				Mode = (BindingMode)0,
+				UpdateSourceTrigger = (UpdateSourceTrigger)1
+			}));
+			val.ValidationRules.Clear();
+			((FrameworkElement)(CurrencyTextBox)control).SetBinding(CurrencyTextBox.NumberProperty, (BindingBase)(object)val);
+			break;
+		}
+		}
+	}
+
+	public static string GetPath(object control)
+	{
+		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0069: Expected O, but got Unknown
+		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
+		//IL_008f: Expected O, but got Unknown
+		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00b2: Expected O, but got Unknown
+		//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00d5: Expected O, but got Unknown
+		//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00f8: Expected O, but got Unknown
+		PropertyPath path;
+		switch (control.GetType().Name)
+		{
+		default:
+			return "";
+		case "TextBox":
+		{
+			Binding binding = BindingOperations.GetBinding((DependencyObject)(TextBox)control, TextBox.TextProperty);
+			if (binding == null)
+			{
+				return "";
+			}
+			path = binding.Path;
+			break;
+		}
+		case "DatePicker":
+		{
+			Binding binding = BindingOperations.GetBinding((DependencyObject)(DatePicker)control, DatePicker.SelectedDateProperty);
+			if (binding == null)
+			{
+				return "";
+			}
+			path = binding.Path;
+			break;
+		}
+		case "CurrencyTextBox":
+		{
+			Binding binding = BindingOperations.GetBinding((DependencyObject)(CurrencyTextBox)control, CurrencyTextBox.NumberProperty);
+			if (binding == null)
+			{
+				return "";
+			}
+			path = binding.Path;
+			break;
+		}
+		case "ComboBox":
+		{
+			Binding binding = BindingOperations.GetBinding((DependencyObject)(ComboBox)control, Selector.SelectedItemProperty);
+			if (binding == null)
+			{
+				return "";
+			}
+			path = binding.Path;
+			break;
+		}
+		case "AutoCompleteBox":
+		{
+			Binding binding = BindingOperations.GetBinding((DependencyObject)(AutoCompleteBox)control, AutoCompleteBox.SelectedItemProperty);
+			if (binding == null)
+			{
+				return "";
+			}
+			path = binding.Path;
+			break;
+		}
+		}
+		return path.Path;
+	}
+
+	public static void AddValidationRule(object control, ValidationRule rule = null)
+	{
+		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
+		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
+		//IL_001a: Expected O, but got Unknown
+		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
+		//IL_005e: Expected O, but got Unknown
+		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00d2: Expected O, but got Unknown
+		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
+		//IL_008f: Expected O, but got Unknown
+		//IL_013d: Unknown result type (might be due to invalid IL or missing references)
+		//IL_014c: Expected O, but got Unknown
+		//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0109: Expected O, but got Unknown
+		//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
+		//IL_012a: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0179: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0183: Expected O, but got Unknown
+		//IL_0163: Unknown result type (might be due to invalid IL or missing references)
+		//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
+		Type type = control.GetType();
+		Binding val = new Binding
+		{
+			Mode = (BindingMode)0,
+			UpdateSourceTrigger = (UpdateSourceTrigger)1
+		};
+		switch (type.Name)
+		{
+		case "TextBox":
+		{
+			Binding binding = BindingOperations.GetBinding((DependencyObject)(TextBox)control, TextBox.TextProperty);
+			if (binding != null)
+			{
+				PropertyPath path = binding.Path;
+				if (rule != null)
+				{
+					val.ValidationRules.Add(rule);
+				}
+				val.Path = new PropertyPath(path.Path, Array.Empty());
+				if (val.ValidationRules.Count > 0)
+				{
+					val.ValidationRules[0].ValidatesOnTargetUpdated = true;
+				}
+				((FrameworkElement)(TextBox)control).SetBinding(TextBox.TextProperty, (BindingBase)(object)val);
+			}
+			break;
+		}
+		case "DatePicker":
+		{
+			Binding binding = BindingOperations.GetBinding((DependencyObject)(DatePicker)control, DatePicker.SelectedDateProperty);
+			if (binding != null)
+			{
+				PropertyPath path = binding.Path;
+				val.ValidationRules.Add((ValidationRule)(((object)rule) ?? ((object)new ValidacaoData())));
+				val.Path = new PropertyPath(path.Path, Array.Empty());
+				if (val.ValidationRules.Count > 0)
+				{
+					val.ValidationRules[0].ValidatesOnTargetUpdated = true;
+				}
+				((FrameworkElement)(DatePicker)control).SetBinding(DatePicker.SelectedDateProperty, (BindingBase)(object)val);
+			}
+			break;
+		}
+		case "CurrencyTextBox":
+		{
+			Binding binding = BindingOperations.GetBinding((DependencyObject)(CurrencyTextBox)control, CurrencyTextBox.NumberProperty);
+			if (binding != null)
+			{
+				PropertyPath path = binding.Path;
+				val.ValidationRules.Add((ValidationRule)(((object)rule) ?? ((object)new ValidacaoDouble())));
+				val.Path = new PropertyPath(path.Path, Array.Empty());
+				if (val.ValidationRules.Count > 0)
+				{
+					val.ValidationRules[0].ValidatesOnTargetUpdated = true;
+				}
+				((FrameworkElement)(CurrencyTextBox)control).SetBinding(CurrencyTextBox.NumberProperty, (BindingBase)(object)val);
+			}
+			break;
+		}
+		}
+	}
+
+	public static void AddBinding(object control, string path, ValidationRule rule = null)
+	{
+		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
+		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
+		//IL_002a: Expected O, but got Unknown
+		//IL_002b: Expected O, but got Unknown
+		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_008e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
+		Type type = control.GetType();
+		Binding val = new Binding
+		{
+			Mode = (BindingMode)0,
+			UpdateSourceTrigger = (UpdateSourceTrigger)1,
+			Path = new PropertyPath(path, Array.Empty())
+		};
+		if (rule != null)
+		{
+			val.ValidationRules.Add(rule);
+			val.ValidationRules[0].ValidatesOnTargetUpdated = true;
+		}
+		switch (type.Name)
+		{
+		case "TextBox":
+			((FrameworkElement)(TextBox)control).SetBinding(TextBox.TextProperty, (BindingBase)(object)val);
+			break;
+		case "DatePicker":
+			((FrameworkElement)(DatePicker)control).SetBinding(DatePicker.SelectedDateProperty, (BindingBase)(object)val);
+			break;
+		case "CurrencyTextBox":
+			((FrameworkElement)(CurrencyTextBox)control).SetBinding(CurrencyTextBox.NumberProperty, (BindingBase)(object)val);
+			break;
+		}
+	}
+
+	public static List> BindingData(bool withSelect = true, bool enumDefault = true, string defaultValue = "", string defaultText = "", bool orderByLabel = false, bool showAll = false, bool orderbyAttr = false)
+	{
+		List> comboData = BeforeTreatment(defaultValue, defaultText);
+		Type enumType = typeof(T);
+		List> comboValues = Enum.GetNames(enumType).AsEnumerable().Where(delegate(string x)
+		{
+			if (showAll)
+			{
+				return true;
+			}
+			T obj = (T)Enum.Parse(enumType, x);
+			bool? @default = EnumHelper.GetDefault(obj);
+			bool hidden = EnumHelper.GetHidden(obj);
+			return (!@default.HasValue || @default.Value == enumDefault) && !hidden;
+		})
+			.Select(delegate(string x)
+			{
+				T val = (T)Enum.Parse(enumType, x);
+				return new KeyValuePair(EnumHelper.Value(val), EnumHelper.GetDescription(val));
+			})
+			.ToList();
+		return AfterTreatment(withSelect, orderByLabel, comboData, comboValues, orderbyAttr);
+	}
+
+	private static List> BeforeTreatment(string defaultValue, string defaultText)
+	{
+		defaultText = ((defaultText == string.Empty) ? "Selecione" : defaultText);
+		return new List>
+		{
+			new KeyValuePair(defaultValue, defaultText)
+		};
+	}
+
+	private static List> AfterTreatment(bool withSelect, bool orderByLabel, List> comboData, List> comboValues, bool orderbyAttr = false)
+	{
+		if (!withSelect)
+		{
+			comboData.RemoveAt(0);
+		}
+		comboData.AddRange(comboValues);
+		if (orderbyAttr)
+		{
+			Type enumType = typeof(T);
+			comboData = comboData.OrderBy((KeyValuePair s) => (s.Key == string.Empty) ? new int?(0) : EnumHelper.GetOrder((T)Enum.Parse(enumType, s.Key))).ToList();
+			return comboData;
+		}
+		if (!orderByLabel)
+		{
+			return comboData;
+		}
+		comboData = (from x in comboData
+			orderby Math.Sign(ValidationHelper.ToFloat(x.Key)), Math.Abs(ValidationHelper.ToFloat(x.Key))
+			select x).ToList();
+		comboData = (from s in comboData
+			orderby comboData.IndexOf(s) != 0, s.Value
+			select s).ToList();
+		return comboData;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Helpers/Connection.cs b/Decompiler/Gestor.Application.Helpers/Connection.cs
new file mode 100644
index 0000000..20ca14c
--- /dev/null
+++ b/Decompiler/Gestor.Application.Helpers/Connection.cs
@@ -0,0 +1,544 @@
+using System;
+using System.Collections.Generic;
+using System.Data.Common;
+using System.Data.SqlClient;
+using System.IO;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Net.Http.Headers;
+using System.Text;
+using System.Threading.Tasks;
+using Agger.Registro;
+using Gestor.Common.Security;
+using Gestor.Common.Validation;
+using Gestor.Model.API;
+using Newtonsoft.Json;
+
+namespace Gestor.Application.Helpers;
+
+public static class Connection
+{
+	private const bool defaultUsaAzureStorage = false;
+
+	private const string defaultAzureStorage = "ad1";
+
+	public static string Server;
+
+	public static string Catalog;
+
+	public static string User;
+
+	public static string Password;
+
+	public static string Pool;
+
+	public static string Type;
+
+	public static ConnectionAddress ConnectionAddress { get; set; }
+
+	public static string LinkAggilizador { get; set; }
+
+	public static string UrlCentralSegurado { get; set; }
+
+	public static string BasicKey()
+	{
+		return $"{ApplicationHelper.NumeroSerial}:{Funcoes.GetNetworkTime().ToUniversalTime().Ticks}".Base64Encode();
+	}
+
+	public static string Base64Encode(this string plainText)
+	{
+		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
+		return new Token().Encrypt(plainText);
+	}
+
+	public static string EncodeBase64(this string plainText)
+	{
+		try
+		{
+			return Convert.ToBase64String(Encoding.UTF8.GetBytes(plainText));
+		}
+		catch
+		{
+		}
+		return string.Empty;
+	}
+
+	public static async Task GetPool()
+	{
+		ConnectionAddress val = await Get("Server/Pool");
+		if (val == null)
+		{
+			return "";
+		}
+		Pool = new Token().Decrypt(val.Pool);
+		return Pool;
+	}
+
+	public static string GetConnection(bool tryconnect = true)
+	{
+		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0006: Expected O, but got Unknown
+		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0011: Expected O, but got Unknown
+		//IL_03a5: Unknown result type (might be due to invalid IL or missing references)
+		//IL_03aa: Unknown result type (might be due to invalid IL or missing references)
+		//IL_03b5: Unknown result type (might be due to invalid IL or missing references)
+		//IL_03c0: Unknown result type (might be due to invalid IL or missing references)
+		//IL_03cb: Unknown result type (might be due to invalid IL or missing references)
+		//IL_03d6: Unknown result type (might be due to invalid IL or missing references)
+		//IL_03e1: Unknown result type (might be due to invalid IL or missing references)
+		//IL_03ec: Unknown result type (might be due to invalid IL or missing references)
+		//IL_03f7: Unknown result type (might be due to invalid IL or missing references)
+		//IL_03fe: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0405: Unknown result type (might be due to invalid IL or missing references)
+		//IL_042d: Expected O, but got Unknown
+		try
+		{
+			Token val = new Token();
+			RegistryHelper val2 = new RegistryHelper(ApplicationHelper.Subkey);
+			bool flag = false;
+			string azureStorage = "ad1";
+			if (ApplicationHelper.Conectado)
+			{
+				List result = Get>($"Server/{ApplicationHelper.IdFornecedor}").Result;
+				for (int i = 0; i < result.Count; i++)
+				{
+					string text = val.AggerEncrypt(val.Decrypt(result[i].Server));
+					string text2 = val.AggerEncrypt(val.Decrypt(result[i].Catalog));
+					string text3 = val.AggerEncrypt(val.Decrypt(result[i].User));
+					string text4 = val.AggerEncrypt(val.Decrypt(result[i].Password));
+					string text5 = val.AggerEncrypt(val.Decrypt(result[i].Pool));
+					string text6 = result[i].Type.ToString();
+					LinkAggilizador = (string.IsNullOrEmpty(result[i].Aggilizador) ? null : result[i].Aggilizador);
+					UrlCentralSegurado = (string.IsNullOrEmpty(result[i].UrlCentralSegurado) ? null : result[0].UrlCentralSegurado);
+					flag = result[i].UsaAzureStorage;
+					azureStorage = (string.IsNullOrEmpty(result[i].AzureStorage) ? "ad1" : val.Decrypt(result[i].AzureStorage));
+					val2.Write($"SERVER{i + 1}", text, true);
+					val2.Write($"DB{i + 1}", text2, true);
+					val2.Write($"USER{i + 1}", text3, true);
+					val2.Write($"PASSWORD{i + 1}", text4, true);
+					val2.Write($"POOL{i + 1}", text5, true);
+					val2.Write($"TYPE{i + 1}", text6, true);
+				}
+			}
+			string result2 = "";
+			for (int j = 0; j < 3 && val2.Read($"SERVER{j + 1}", true) != null; j++)
+			{
+				if (val2.Read($"TYPE{j + 1}", true) == "4")
+				{
+					continue;
+				}
+				Server = val.AggerDecrypt(val2.Read($"SERVER{j + 1}", true));
+				Catalog = val.AggerDecrypt(val2.Read($"DB{j + 1}", true));
+				User = val.AggerDecrypt(val2.Read($"USER{j + 1}", true));
+				Password = val.AggerDecrypt(val2.Read($"PASSWORD{j + 1}", true));
+				Pool = val.AggerDecrypt(val2.Read($"POOL{j + 1}", true));
+				Type = val2.Read($"TYPE{j + 1}", true);
+				if (!flag)
+				{
+					flag = Task.Run(async () => await SaveInAzureStorage()).Result;
+				}
+				ConnectionAddress = new ConnectionAddress
+				{
+					Server = Server,
+					Catalog = Catalog,
+					User = User,
+					Password = Password,
+					Pool = Pool,
+					Aggilizador = LinkAggilizador,
+					UrlCentralSegurado = UrlCentralSegurado,
+					UsaAzureStorage = flag,
+					AzureStorage = azureStorage,
+					Type = int.Parse(ValidationHelper.IsNotNullOrEmpty(Type) ? "0" : Type)
+				};
+				string connectionString = GetConnectionString();
+				if (!tryconnect || TryConnect(connectionString))
+				{
+					result2 = connectionString;
+					break;
+				}
+			}
+			return result2;
+		}
+		catch (Exception)
+		{
+			return null;
+		}
+	}
+
+	public static string GetConnectionString()
+	{
+		return "Server=" + Server + ";initial catalog=" + Catalog + ";user=" + User + ";password=" + Password + ";";
+	}
+
+	internal static bool TryConnect(string connectionString, int retryCount = 1)
+	{
+		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0012: Expected O, but got Unknown
+		List list = new List();
+		for (int i = 0; i < retryCount; i++)
+		{
+			try
+			{
+				SqlConnection val = new SqlConnection(connectionString);
+				try
+				{
+					((DbConnection)(object)val).Open();
+				}
+				finally
+				{
+					((IDisposable)val)?.Dispose();
+				}
+				return true;
+			}
+			catch (Exception item)
+			{
+				list.Add(item);
+			}
+		}
+		return list.Count == 0;
+	}
+
+	public static string GetAdConnection(string serial)
+	{
+		ApplicationHelper.NumeroSerial = serial;
+		if (string.IsNullOrWhiteSpace(Server))
+		{
+			GetAdConnection(serial);
+		}
+		return "Server=" + Server + ";initial catalog=" + Catalog + "AD;user=" + User + ";password=" + Password + ";";
+	}
+
+	public static async Task Get(string command, bool autorizar = true, bool verificarConexao = false) where T : class
+	{
+		Uri uri = new Uri(Address.GestorApi(), command);
+		HttpClient val = new HttpClient();
+		if (autorizar)
+		{
+			val.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Token", BasicKey());
+		}
+		ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
+		HttpResponseMessage val2;
+		try
+		{
+			val2 = await val.GetAsync(uri).ConfigureAwait(continueOnCapturedContext: false);
+		}
+		catch (Exception)
+		{
+			ApplicationHelper.Conectado = false;
+			return null;
+		}
+		if (verificarConexao)
+		{
+			ApplicationHelper.Conectado = true;
+		}
+		if (val2.StatusCode == HttpStatusCode.NoContent)
+		{
+			return null;
+		}
+		if (val2.StatusCode != HttpStatusCode.OK)
+		{
+			throw new Exception("Api connection Error " + Environment.NewLine + " " + command, null);
+		}
+		return JsonConvert.DeserializeObject(val2.Content.ReadAsStringAsync().Result);
+	}
+
+	public static async Task Get(string command, bool autorizar = true)
+	{
+		Uri uri = new Uri(Address.GestorApi(), command);
+		HttpClient val = new HttpClient();
+		if (autorizar)
+		{
+			val.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Token", BasicKey());
+		}
+		ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
+		HttpResponseMessage val2;
+		try
+		{
+			val2 = await val.GetAsync(uri).ConfigureAwait(continueOnCapturedContext: false);
+		}
+		catch (Exception)
+		{
+			return HttpStatusCode.InternalServerError;
+		}
+		return val2.StatusCode;
+	}
+
+	public static async Task Post(string command, T keyValues) where T : class
+	{
+		Uri uri = new Uri(Address.GestorApi(), command);
+		StringContent val = new StringContent(JsonConvert.SerializeObject((object)keyValues, (Formatting)1, new JsonSerializerSettings
+		{
+			ReferenceLoopHandling = (ReferenceLoopHandling)1,
+			MissingMemberHandling = (MissingMemberHandling)0
+		}), Encoding.UTF8, "application/json");
+		HttpClient val2 = new HttpClient();
+		val2.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Token", BasicKey());
+		ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
+		HttpResponseMessage val3 = await val2.PostAsync(uri, (HttpContent)(object)val);
+		if (val3.StatusCode == HttpStatusCode.NoContent)
+		{
+			return null;
+		}
+		if (val3.StatusCode != HttpStatusCode.OK)
+		{
+			throw new Exception("Api connection Error " + Environment.NewLine + " " + command, null);
+		}
+		return JsonConvert.DeserializeObject(val3.Content.ReadAsStringAsync().Result);
+	}
+
+	public static async Task Post(string command, object keyValues) where T : class
+	{
+		Uri uri = new Uri(Address.GestorApi(), command);
+		StringContent val = new StringContent(JsonConvert.SerializeObject(keyValues, (Formatting)1, new JsonSerializerSettings
+		{
+			ReferenceLoopHandling = (ReferenceLoopHandling)1,
+			MissingMemberHandling = (MissingMemberHandling)0
+		}), Encoding.UTF8, "application/json");
+		HttpClient val2 = new HttpClient();
+		val2.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Token", BasicKey());
+		ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
+		HttpResponseMessage val3 = await val2.PostAsync(uri, (HttpContent)(object)val);
+		if (val3.StatusCode == HttpStatusCode.NoContent)
+		{
+			return null;
+		}
+		if (val3.StatusCode != HttpStatusCode.OK)
+		{
+			throw new Exception("Api connection Error " + Environment.NewLine + " " + command, null);
+		}
+		return JsonConvert.DeserializeObject(val3.Content.ReadAsStringAsync().Result);
+	}
+
+	public static async Task Put(string command, T keyValues) where T : class
+	{
+		Uri uri = new Uri(Address.GestorApi(), command);
+		StringContent val = new StringContent(JsonConvert.SerializeObject((object)keyValues, (Formatting)1, new JsonSerializerSettings
+		{
+			ReferenceLoopHandling = (ReferenceLoopHandling)1
+		}), Encoding.UTF8, "application/json");
+		HttpClient val2 = new HttpClient();
+		ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
+		val2.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Token", BasicKey());
+		HttpResponseMessage obj = await val2.PutAsync(uri, (HttpContent)(object)val);
+		if (obj.StatusCode != HttpStatusCode.OK)
+		{
+			throw new Exception("Api connection Error " + Environment.NewLine + " " + command, null);
+		}
+		return JsonConvert.DeserializeObject(obj.Content.ReadAsStringAsync().Result);
+	}
+
+	public static async Task Put(string command, object keyValues) where T : class
+	{
+		Uri uri = new Uri(Address.GestorApi(), command);
+		StringContent val = new StringContent(JsonConvert.SerializeObject(keyValues, (Formatting)1, new JsonSerializerSettings
+		{
+			ReferenceLoopHandling = (ReferenceLoopHandling)1
+		}), Encoding.UTF8, "application/json");
+		HttpClient val2 = new HttpClient();
+		ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
+		val2.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Token", BasicKey());
+		HttpResponseMessage val3 = await val2.PutAsync(uri, (HttpContent)(object)val);
+		if (val3.StatusCode == HttpStatusCode.NoContent)
+		{
+			return null;
+		}
+		if (val3.StatusCode != HttpStatusCode.OK)
+		{
+			throw new Exception("Api connection Error " + Environment.NewLine + " " + command, null);
+		}
+		return JsonConvert.DeserializeObject(val3.Content.ReadAsStringAsync().Result);
+	}
+
+	public static async void PutError(T keyValues) where T : class
+	{
+		Uri uri = new Uri(Address.GestorApi(), "Error/Objeto");
+		StringContent val = new StringContent(JsonConvert.SerializeObject((object)keyValues, (Formatting)1, new JsonSerializerSettings
+		{
+			ReferenceLoopHandling = (ReferenceLoopHandling)1
+		}), Encoding.UTF8, "application/json");
+		HttpClient val2 = new HttpClient();
+		ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
+		val2.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Token", BasicKey());
+		if ((await val2.PutAsync(uri, (HttpContent)(object)val)).StatusCode != HttpStatusCode.NoContent)
+		{
+			throw new Exception("Api connection Error " + Environment.NewLine + " Error", null);
+		}
+	}
+
+	public static async Task Delete(string command)
+	{
+		Uri uri = new Uri(Address.GestorApi(), command);
+		HttpClient val = new HttpClient();
+		ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
+		val.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Token", BasicKey());
+		if ((await val.DeleteAsync(uri)).StatusCode != HttpStatusCode.OK)
+		{
+			throw new Exception("Api connection Error " + Environment.NewLine + " " + command, null);
+		}
+		return true;
+	}
+
+	internal static async Task DownloadFile(string azureStorage, int ano, Guid id, string extensao, string path = "ad", bool forceDownload = false)
+	{
+		azureStorage = (string.IsNullOrEmpty(azureStorage) ? "ad1" : azureStorage);
+		Uri uri = Address.ApiAD.Append(AdApiV2(azureStorage)).Append(path).Append(ano.ToString())
+			.Append(id.ToString())
+			.Append(extensao.Replace(".", string.Empty));
+		try
+		{
+			string path2 = $"{Path.GetTempPath()}{id}{extensao}";
+			if (!forceDownload && File.Exists(path2))
+			{
+				return File.ReadAllBytes(path2);
+			}
+			HttpClient client = new HttpClient();
+			try
+			{
+				ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
+				((HttpHeaders)client.DefaultRequestHeaders).Clear();
+				((HttpHeaders)client.DefaultRequestHeaders).Add("Authorization", "Token " + BasicKey());
+				HttpResponseMessage val = await client.GetAsync(uri);
+				if (val.IsSuccessStatusCode && val.StatusCode != HttpStatusCode.NotFound)
+				{
+					return await val.Content.ReadAsByteArrayAsync();
+				}
+			}
+			finally
+			{
+				((IDisposable)client)?.Dispose();
+			}
+		}
+		catch
+		{
+		}
+		return null;
+	}
+
+	internal static async Task SaveInAzureStorage()
+	{
+		string text = $"{Address.GestorApi()}Data";
+		try
+		{
+			HttpClient client = new HttpClient();
+			try
+			{
+				((HttpHeaders)client.DefaultRequestHeaders).Clear();
+				((HttpHeaders)client.DefaultRequestHeaders).Add("Authorization", "Token " + BasicKey());
+				HttpResponseMessage val = await client.GetAsync(text);
+				if (val.IsSuccessStatusCode)
+				{
+					return await val.Content.ReadAsStringAsync() == "true";
+				}
+			}
+			finally
+			{
+				((IDisposable)client)?.Dispose();
+			}
+		}
+		catch
+		{
+		}
+		return false;
+	}
+
+	internal static async Task UploadFile(UploadFile upload, string path = "ad")
+	{
+		Uri uri = Address.ApiAD.Append(AdApiV2(ConnectionAddress.AzureStorage)).Append(path);
+		try
+		{
+			HttpClient client = new HttpClient();
+			try
+			{
+				ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
+				((HttpHeaders)client.DefaultRequestHeaders).Clear();
+				((HttpHeaders)client.DefaultRequestHeaders).Add("Authorization", "Token " + BasicKey());
+				HttpResponseMessage val = await client.PutAsync(uri, (HttpContent)new StringContent(JsonConvert.SerializeObject((object)upload), Encoding.UTF8, "application/json"));
+				return val.IsSuccessStatusCode && val.StatusCode != HttpStatusCode.NoContent;
+			}
+			finally
+			{
+				((IDisposable)client)?.Dispose();
+			}
+		}
+		catch
+		{
+		}
+		return false;
+	}
+
+	internal static async Task DeleteFile(string azureStorage, int ano, Guid id, string extensao, string path = "ad")
+	{
+		azureStorage = (string.IsNullOrEmpty(azureStorage) ? "ad1" : azureStorage);
+		Uri uri = Address.ApiAD.Append(AdApiV2(azureStorage)).Append(path).Append(ano.ToString())
+			.Append(id.ToString())
+			.Append(extensao.Replace(".", string.Empty));
+		try
+		{
+			HttpClient client = new HttpClient();
+			try
+			{
+				ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
+				((HttpHeaders)client.DefaultRequestHeaders).Clear();
+				((HttpHeaders)client.DefaultRequestHeaders).Add("Authorization", "Token " + BasicKey());
+				HttpResponseMessage val = await client.DeleteAsync(uri);
+				return val.IsSuccessStatusCode && val.StatusCode != HttpStatusCode.NoContent;
+			}
+			finally
+			{
+				((IDisposable)client)?.Dispose();
+			}
+		}
+		catch
+		{
+		}
+		return false;
+	}
+
+	internal static async Task EspacoUsadoAzureInBytes(string path = "")
+	{
+		Uri uri = Address.ApiAD.Append(AdApiV2(ConnectionAddress.AzureStorage)).Append("tamanho");
+		if (!string.IsNullOrEmpty(path))
+		{
+			uri.Append(path);
+		}
+		try
+		{
+			HttpClient client = new HttpClient();
+			try
+			{
+				ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
+				((HttpHeaders)client.DefaultRequestHeaders).Clear();
+				((HttpHeaders)client.DefaultRequestHeaders).Add("Authorization", "Token " + BasicKey());
+				HttpResponseMessage val = await client.GetAsync(uri);
+				if (val.IsSuccessStatusCode && val.StatusCode != HttpStatusCode.NoContent)
+				{
+					return double.Parse(await val.Content.ReadAsStringAsync());
+				}
+			}
+			finally
+			{
+				((IDisposable)client)?.Dispose();
+			}
+		}
+		catch
+		{
+		}
+		return 0.0;
+	}
+
+	private static string AdApiV2(string storage)
+	{
+		if (Address.ApiAD.ToString().Contains("/api/v1"))
+		{
+			return string.Empty;
+		}
+		return storage;
+	}
+
+	internal static Uri Append(this Uri uri, params string[] paths)
+	{
+		return new Uri(paths.Aggregate(uri.AbsoluteUri, (string current, string path) => current.TrimEnd(new char[1] { '/' }) + "/" + path.TrimStart(new char[1] { '/' })));
+	}
+}
diff --git a/Decompiler/Gestor.Application.Helpers/ConnectionHelper.cs b/Decompiler/Gestor.Application.Helpers/ConnectionHelper.cs
new file mode 100644
index 0000000..8bb8e98
--- /dev/null
+++ b/Decompiler/Gestor.Application.Helpers/ConnectionHelper.cs
@@ -0,0 +1,470 @@
+using System;
+using System.Collections.Generic;
+using System.Data.Common;
+using System.Data.SqlClient;
+using System.IO;
+using System.Net;
+using System.Net.Http;
+using System.Net.Http.Headers;
+using System.Threading;
+using System.Threading.Tasks;
+using Agger.Registro;
+using Gestor.Application.Migration;
+using Gestor.Common.Exceptions;
+
+namespace Gestor.Application.Helpers;
+
+public class ConnectionHelper
+{
+	public static bool BancoAtualizado { get; set; }
+
+	private static async Task Get(string command, bool autorizar = true)
+	{
+		Uri uri = new Uri(Address.GestorApi(), command);
+		HttpClient val = new HttpClient
+		{
+			Timeout = new TimeSpan(0, 2, 0)
+		};
+		if (autorizar)
+		{
+			val.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Token", Connection.BasicKey());
+		}
+		ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
+		try
+		{
+			HttpResponseMessage val2 = await val.GetAsync(uri).ConfigureAwait(continueOnCapturedContext: false);
+			if (val2.StatusCode != HttpStatusCode.OK)
+			{
+				return await val2.Content.ReadAsStringAsync();
+			}
+			return null;
+		}
+		catch (Exception)
+		{
+			return "ERRO INTERNO";
+		}
+	}
+
+	private static async Task Post(string command)
+	{
+		Uri uri = new Uri(Address.GestorApi(), command);
+		HttpClient val = new HttpClient();
+		val.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Token", Connection.BasicKey());
+		ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
+		try
+		{
+			HttpResponseMessage val2 = await val.PostAsync(uri, (HttpContent)null);
+			if (val2.StatusCode != HttpStatusCode.OK)
+			{
+				return await val2.Content.ReadAsStringAsync();
+			}
+			return null;
+		}
+		catch (Exception)
+		{
+			return "ERRO INTERNO";
+		}
+	}
+
+	private static async Task DatabaseTest()
+	{
+		return await Get("Data/Verify");
+	}
+
+	public async Task AtualizarBanco()
+	{
+		bool num = await new Migrator().Execute();
+		BancoAtualizado = num;
+		return num ? null : "HOUVE UM PROBLEMA AO ATUALIZAR O BANCO DE DADOS.";
+	}
+
+	internal static async Task TryConnect(string connectionString, int retryCount = 1)
+	{
+		return await Task.Run(delegate
+		{
+			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
+			//IL_0021: Expected O, but got Unknown
+			List list = new List();
+			for (int i = 0; i < retryCount; i++)
+			{
+				try
+				{
+					SqlConnection val = new SqlConnection(connectionString + "Connection Timeout=5");
+					try
+					{
+						((DbConnection)(object)val).Open();
+					}
+					finally
+					{
+						((IDisposable)val)?.Dispose();
+					}
+					return true;
+				}
+				catch (Exception item)
+				{
+					list.Add(item);
+				}
+			}
+			return list.Count == 0;
+		});
+	}
+
+	internal static async Task HasLogin(string connectionString)
+	{
+		return await Task.Run(delegate
+		{
+			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
+			//IL_0012: Expected O, but got Unknown
+			List list = new List();
+			try
+			{
+				SqlConnection val = new SqlConnection(connectionString);
+				try
+				{
+					((DbConnection)(object)val).Open();
+					SqlCommand val2 = val.CreateCommand();
+					try
+					{
+						((DbCommand)(object)val2).CommandText = "SELECT 1 FROM [dbo].[usuario] WHERE [removido] IS NULL OR [removido] = '0'";
+						SqlDataReader val3 = val2.ExecuteReader();
+						if (!((DbDataReader)(object)val3).HasRows)
+						{
+							return false;
+						}
+						((DbDataReader)(object)val3).Close();
+						((DbCommand)(object)val2).CommandText = "SELECT 1 FROM [dbo].[empresa] WHERE [idempresa] = 1";
+						val3 = val2.ExecuteReader();
+						if (!((DbDataReader)(object)val3).HasRows)
+						{
+							return false;
+						}
+						((DbDataReader)(object)val3).Close();
+						((DbCommand)(object)val2).CommandText = "SELECT 1 FROM [dbo].[vendedor] WHERE [corretora] = '1'";
+						val3 = val2.ExecuteReader();
+						if (!((DbDataReader)(object)val3).HasRows)
+						{
+							return false;
+						}
+						((DbDataReader)(object)val3).Close();
+						return true;
+					}
+					finally
+					{
+						((IDisposable)val2)?.Dispose();
+					}
+				}
+				finally
+				{
+					((IDisposable)val)?.Dispose();
+				}
+			}
+			catch (Exception item)
+			{
+				list.Add(item);
+			}
+			return list.Count == 0;
+		});
+	}
+
+	public async Task> PrimeiroAcesso()
+	{
+		string conn = Connection.GetConnection(tryconnect: false);
+		if (!(await TryConnect(conn)))
+		{
+			if (!(await DatabaseExists()))
+			{
+				return new Tuple(item1: false, item2: false);
+			}
+			bool flag = !(await LoginExists());
+			if (flag)
+			{
+				flag = !(await CreateLogin());
+			}
+			if (flag)
+			{
+				return new Tuple(item1: false, item2: false);
+			}
+			flag = !(await UserExists());
+			if (flag)
+			{
+				flag = !(await CreateUser());
+			}
+			if (flag)
+			{
+				return new Tuple(item1: false, item2: false);
+			}
+		}
+		return (!(await HasLogin(conn))) ? new Tuple(item1: true, item2: false) : new Tuple(item1: true, item2: true);
+	}
+
+	public bool BDConvertido()
+	{
+		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
+		//IL_000c: Expected O, but got Unknown
+		try
+		{
+			SqlConnection val = new SqlConnection(Connection.GetConnection(tryconnect: false));
+			try
+			{
+				((DbConnection)(object)val).Open();
+				SqlCommand val2 = val.CreateCommand();
+				try
+				{
+					((DbCommand)(object)val2).CommandText = "SELECT OBJECT_ID('dbo.AtualizacaoDados', 'U')";
+					if (((DbCommand)(object)val2).ExecuteScalar() == DBNull.Value)
+					{
+						return true;
+					}
+				}
+				finally
+				{
+					((IDisposable)val2)?.Dispose();
+				}
+				SqlCommand val3 = val.CreateCommand();
+				try
+				{
+					((DbCommand)(object)val3).CommandText = "SELECT COUNT(IdArquivo) FROM AtualizacaoDados";
+					return (int)((DbCommand)(object)val3).ExecuteScalar() == 0;
+				}
+				finally
+				{
+					((IDisposable)val3)?.Dispose();
+				}
+			}
+			finally
+			{
+				((IDisposable)val)?.Dispose();
+			}
+		}
+		catch
+		{
+		}
+		return true;
+	}
+
+	public bool ExisteEmpresa()
+	{
+		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
+		//IL_000c: Expected O, but got Unknown
+		try
+		{
+			SqlConnection val = new SqlConnection(Connection.GetConnection(tryconnect: false));
+			try
+			{
+				((DbConnection)(object)val).Open();
+				SqlCommand val2 = val.CreateCommand();
+				try
+				{
+					((DbCommand)(object)val2).CommandText = "SELECT OBJECT_ID (N'empresa', N'U')";
+					if (((DbCommand)(object)val2).ExecuteScalar() == DBNull.Value)
+					{
+						return false;
+					}
+				}
+				finally
+				{
+					((IDisposable)val2)?.Dispose();
+				}
+				SqlCommand val3 = val.CreateCommand();
+				try
+				{
+					((DbCommand)(object)val3).CommandText = "SELECT COUNT(idempresa) FROM empresa WHERE idempresa = 1";
+					return (int)((DbCommand)(object)val3).ExecuteScalar() > 0;
+				}
+				finally
+				{
+					((IDisposable)val3)?.Dispose();
+				}
+			}
+			finally
+			{
+				((IDisposable)val)?.Dispose();
+			}
+		}
+		catch
+		{
+		}
+		return true;
+	}
+
+	public async Task VerifyConnection()
+	{
+		_ = 3;
+		try
+		{
+			if (await TryConnect(Connection.GetConnection(tryconnect: false)))
+			{
+				return null;
+			}
+			string text = await DatabaseTest();
+			if (text != null)
+			{
+				return text;
+			}
+			string text2 = Connection.ConnectionAddress.Catalog + ".cfg";
+			string path = AppDomain.CurrentDomain.BaseDirectory + "Data_" + text2;
+			string path2 = AppDomain.CurrentDomain.BaseDirectory + "Files_" + text2;
+			string path3 = AppDomain.CurrentDomain.BaseDirectory + "Sign_" + text2;
+			if (File.Exists(path))
+			{
+				File.Delete(path);
+			}
+			if (File.Exists(path2))
+			{
+				File.Delete(path2);
+			}
+			if (File.Exists(path3))
+			{
+				File.Delete(path3);
+			}
+			string returnMessage = await CheckDatabase();
+			await Task.Delay(2000);
+			return returnMessage;
+		}
+		catch (Exception)
+		{
+			return "ERRO AO CONECTAR NO BANCO DE DADOS DA CORRETORA";
+		}
+	}
+
+	public static async Task CheckDatabase()
+	{
+		_ = 5;
+		try
+		{
+			bool hasDatabase = await DatabaseExists();
+			bool hasLogin = await LoginExists();
+			bool hasUser = await UserExists();
+			bool created = false;
+			if (hasDatabase && hasLogin && hasUser)
+			{
+				return null;
+			}
+			if (!hasDatabase)
+			{
+				hasDatabase = await CreateDatabase();
+			}
+			if (!hasDatabase)
+			{
+				return "ERRO AO CRIAR BANCO DE DADOS";
+			}
+			if (!hasLogin)
+			{
+				bool num = await CreateLogin();
+				bool flag = num;
+				created = num;
+				hasLogin = flag;
+			}
+			if (!hasLogin)
+			{
+				return "ERRO AO CRIAR LOGIN";
+			}
+			if (!hasUser)
+			{
+				hasUser = await CreateUser();
+			}
+			if (created)
+			{
+				int num2 = 10;
+				while (num2 > 1)
+				{
+					try
+					{
+						SqlConnection val = new SqlConnection(Connection.GetConnection());
+						try
+						{
+							((DbConnection)(object)val).Open();
+						}
+						finally
+						{
+							((IDisposable)val)?.Dispose();
+						}
+					}
+					catch
+					{
+						Thread.Sleep(10000);
+						num2--;
+						continue;
+					}
+					break;
+				}
+			}
+			return (!hasUser) ? "ERRO AO CRIAR USUÁRIO" : null;
+		}
+		catch (ValidationException val2)
+		{
+			return ((Exception)val2).Message;
+		}
+		catch (Exception)
+		{
+			return "ERRO AO CRIAR BANCO DE DADOS";
+		}
+	}
+
+	private static async Task CreateDatabase()
+	{
+		string text = Uri.EscapeDataString(ApplicationHelper.NumeroSerial);
+		if (await Post("Data/CreateData?token=" + text) == "ERRO INTERNO")
+		{
+			return false;
+		}
+		int tries = 0;
+		bool flag = false;
+		while (tries < 24 && !flag)
+		{
+			await Task.Delay(5000);
+			tries++;
+			flag = await DatabaseExists();
+		}
+		return flag;
+	}
+
+	private static async Task CreateLogin()
+	{
+		if (await Post("Data/CreateLogin") == "ERRO INTERNO")
+		{
+			return false;
+		}
+		int tries = 0;
+		bool flag = false;
+		while (tries < 24 && !flag)
+		{
+			await Task.Delay(5000);
+			tries++;
+			flag = await Get("Data/ServerLoginExists") == null;
+		}
+		return flag;
+	}
+
+	private static async Task CreateUser()
+	{
+		if (await Post("Data/CreateUser") == "ERRO INTERNO")
+		{
+			return false;
+		}
+		int tries = 0;
+		bool flag = false;
+		while (tries < 24 && !flag)
+		{
+			await Task.Delay(5000);
+			tries++;
+			flag = await Get("Data/UserExists") == null;
+		}
+		return flag;
+	}
+
+	private static async Task DatabaseExists()
+	{
+		return await Get("Data/DataExists") == null;
+	}
+
+	private static async Task LoginExists()
+	{
+		return await Get("Data/ServerLoginExists") == null;
+	}
+
+	private static async Task UserExists()
+	{
+		return await Get("Data/UserExists") == null;
+	}
+}
diff --git a/Decompiler/Gestor.Application.Helpers/CustomLinq.cs b/Decompiler/Gestor.Application.Helpers/CustomLinq.cs
new file mode 100644
index 0000000..b07854b
--- /dev/null
+++ b/Decompiler/Gestor.Application.Helpers/CustomLinq.cs
@@ -0,0 +1,55 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using Gestor.Common.Validation;
+using Gestor.Model.Domain.Relatorios;
+
+namespace Gestor.Application.Helpers;
+
+public static class CustomLinq
+{
+	public static List CustomWhere(this List list, string propertyName, string query) where T : class
+	{
+		PropertyInfo pi = typeof(T).GetProperty(propertyName);
+		return list.Where((T x) => pi.GetValue(x).ToString().ToLower()
+			.Contains(query.ToLower())).ToList();
+	}
+
+	public static List CustomWhere(this List list, List property, bool buscaIgual = false) where T : class
+	{
+		if (property == null || property.Count == 0)
+		{
+			return list;
+		}
+		return list.Where((T x) => (from p in property
+			group p by p.Propriedade).ToList().All((IGrouping p) => (!p.Any((FiltroPersonalizado s) => s.SemValor)) ? ((!(p.First().Tipo == typeof(DateTime))) ? ((!(p.First().Tipo == typeof(long))) ? ((!(p.First().Tipo == typeof(int))) ? ((!(p.First().Tipo == typeof(decimal))) ? ((!(p.First().Tipo == typeof(Enum))) ? p.Any(delegate(FiltroPersonalizado v)
+		{
+			if (!buscaIgual)
+			{
+				if (typeof(T).GetProperty(v.Propriedade)?.GetValue(x) != null)
+				{
+					return ValidationHelper.AlphanumericAndSpace(typeof(T).GetProperty(v.Propriedade).GetValue(x).ToString()
+						.ToLower()
+						.Trim()).Contains(ValidationHelper.AlphanumericAndSpace(v.ValorIncial.ToLower().Trim()));
+				}
+				return false;
+			}
+			return typeof(T).GetProperty(v.Propriedade)?.GetValue(x) != null && ValidationHelper.AlphanumericAndSpace(typeof(T).GetProperty(v.Propriedade).GetValue(x).ToString()
+				.ToLower()
+				.Trim()).Equals(ValidationHelper.AlphanumericAndSpace(v.ValorIncial.ToLower().Trim()));
+		}) : p.Any((FiltroPersonalizado v) => typeof(T).GetProperty(v.Propriedade)?.GetValue(x) != null && ValidationHelper.GetDescription((Enum)typeof(T).GetProperty(v.Propriedade).GetValue(x)).ToLower().Equals(v.ValorIncial.ToLower()))) : p.Any((FiltroPersonalizado v) => typeof(T).GetProperty(v.Propriedade)?.GetValue(x) != null && (decimal)typeof(T).GetProperty(v.Propriedade).GetValue(x) >= decimal.Parse(v.ValorIncial) && (decimal)typeof(T).GetProperty(v.Propriedade).GetValue(x) <= decimal.Parse(v.ValorFinal))) : p.Any((FiltroPersonalizado v) => typeof(T).GetProperty(v.Propriedade)?.GetValue(x) != null && (int)typeof(T).GetProperty(v.Propriedade).GetValue(x) >= int.Parse(v.ValorIncial) && (int)typeof(T).GetProperty(v.Propriedade).GetValue(x) <= int.Parse(v.ValorFinal))) : p.Any((FiltroPersonalizado v) => typeof(T).GetProperty(v.Propriedade)?.GetValue(x) != null && (long)typeof(T).GetProperty(v.Propriedade).GetValue(x) >= long.Parse(v.ValorIncial) && (long)typeof(T).GetProperty(v.Propriedade).GetValue(x) <= long.Parse(v.ValorFinal))) : p.Any((FiltroPersonalizado v) => typeof(T).GetProperty(v.Propriedade)?.GetValue(x) != null && (DateTime)typeof(T).GetProperty(v.Propriedade).GetValue(x) >= DateTime.Parse(v.ValorIncial) && (DateTime)typeof(T).GetProperty(v.Propriedade).GetValue(x) <= DateTime.Parse(v.ValorFinal).AddDays(1.0).AddSeconds(-1.0))) : p.Any((FiltroPersonalizado v) => typeof(T).GetProperty(v.Propriedade)?.GetValue(x) == null || string.IsNullOrWhiteSpace(typeof(T).GetProperty(v.Propriedade)?.GetValue(x).ToString()) || string.IsNullOrEmpty(typeof(T).GetProperty(v.Propriedade)?.GetValue(x).ToString())))).ToList();
+	}
+
+	public static List CustomNot(this List list, List property) where T : class
+	{
+		if (property == null || property.Count == 0)
+		{
+			return list;
+		}
+		return list.Where((T x) => (from p in property
+			group p by p.Propriedade).ToList().All((IGrouping p) => (!p.Any((FiltroPersonalizado s) => s.SemValor)) ? ((!(p.First().Tipo == typeof(DateTime))) ? ((!(p.First().Tipo == typeof(long))) ? ((!(p.First().Tipo == typeof(int))) ? ((!(p.First().Tipo == typeof(decimal))) ? ((!(p.First().Tipo == typeof(Enum))) ? p.All((FiltroPersonalizado v) => typeof(T).GetProperty(v.Propriedade)?.GetValue(x) != null && !ValidationHelper.AlphanumericAndSpace(typeof(T).GetProperty(v.Propriedade).GetValue(x).ToString()
+			.ToLower()
+			.Trim()).Contains(ValidationHelper.AlphanumericAndSpace(v.ValorIncial.ToLower().Trim()))) : p.All((FiltroPersonalizado v) => typeof(T).GetProperty(v.Propriedade)?.GetValue(x) != null && !ValidationHelper.GetDescription((Enum)typeof(T).GetProperty(v.Propriedade).GetValue(x)).ToLower().Contains(v.ValorIncial.ToLower()))) : p.All((FiltroPersonalizado v) => typeof(T).GetProperty(v.Propriedade)?.GetValue(x) != null && (decimal)typeof(T).GetProperty(v.Propriedade).GetValue(x) != decimal.Parse(v.ValorIncial))) : p.All((FiltroPersonalizado v) => typeof(T).GetProperty(v.Propriedade)?.GetValue(x) != null && (int)typeof(T).GetProperty(v.Propriedade).GetValue(x) != int.Parse(v.ValorIncial))) : p.All((FiltroPersonalizado v) => typeof(T).GetProperty(v.Propriedade)?.GetValue(x) != null && (long)typeof(T).GetProperty(v.Propriedade).GetValue(x) != long.Parse(v.ValorIncial))) : p.All((FiltroPersonalizado v) => typeof(T).GetProperty(v.Propriedade)?.GetValue(x) != null && (DateTime)typeof(T).GetProperty(v.Propriedade).GetValue(x) != DateTime.Parse(v.ValorIncial))) : p.All((FiltroPersonalizado v) => typeof(T).GetProperty(v.Propriedade)?.GetValue(x) == null || string.IsNullOrWhiteSpace(typeof(T).GetProperty(v.Propriedade)?.GetValue(x).ToString())))).ToList();
+	}
+}
diff --git a/Decompiler/Gestor.Application.Helpers/DataGridExtensions.cs b/Decompiler/Gestor.Application.Helpers/DataGridExtensions.cs
new file mode 100644
index 0000000..0ddd601
--- /dev/null
+++ b/Decompiler/Gestor.Application.Helpers/DataGridExtensions.cs
@@ -0,0 +1,83 @@
+using System;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Media;
+using Gestor.Common.Validation;
+using Gestor.Model.Common;
+
+namespace Gestor.Application.Helpers;
+
+public static class DataGridExtensions
+{
+	public static T GetVisualChild(Visual parent) where T : Visual
+	{
+		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0020: Expected O, but got Unknown
+		T val = default(T);
+		int childrenCount = VisualTreeHelper.GetChildrenCount((DependencyObject)(object)parent);
+		for (int i = 0; i < childrenCount; i++)
+		{
+			Visual val2 = (Visual)VisualTreeHelper.GetChild((DependencyObject)(object)parent, i);
+			val = ((T)(object)((val2 is T) ? val2 : null)) ?? GetVisualChild(val2);
+			if (val != null)
+			{
+				break;
+			}
+		}
+		return val;
+	}
+
+	public static void EsconderToggles(this DataGrid grid, TipoTela tela, TipoToggle toggles)
+	{
+		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0048: Expected O, but got Unknown
+		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0081: Expected O, but got Unknown
+		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0117: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0141: Unknown result type (might be due to invalid IL or missing references)
+		try
+		{
+			foreach (object item in ((ItemsControl)grid).ItemContainerGenerator.Items)
+			{
+				grid.ScrollIntoView(item, grid.Columns[0]);
+				((UIElement)grid).UpdateLayout();
+				DataGridRow val = (DataGridRow)((ItemsControl)grid).ItemContainerGenerator.ContainerFromItem(item);
+				if (val == null)
+				{
+					continue;
+				}
+				grid.ScrollIntoView((object)val, grid.Columns[4]);
+				((UIElement)grid).UpdateLayout();
+				DataGridCellsPresenter visualChild = DataGridExtensions.GetVisualChild((Visual)(object)val);
+				DataGridCell val2 = (DataGridCell)((ItemsControl)visualChild).ItemContainerGenerator.ContainerFromIndex(0);
+				if (val2 != null && ((object)val2).ToString().Contains(ValidationHelper.GetDescription((Enum)(object)tela)))
+				{
+					if (toggles.HasFlag(TipoToggle.Consultar))
+					{
+						((UIElement)(DataGridCell)((ItemsControl)visualChild).ItemContainerGenerator.ContainerFromIndex(1)).Visibility = (Visibility)1;
+					}
+					if (toggles.HasFlag(TipoToggle.Incluir))
+					{
+						((UIElement)(DataGridCell)((ItemsControl)visualChild).ItemContainerGenerator.ContainerFromIndex(2)).Visibility = (Visibility)1;
+					}
+					if (toggles.HasFlag(TipoToggle.Alterar))
+					{
+						((UIElement)(DataGridCell)((ItemsControl)visualChild).ItemContainerGenerator.ContainerFromIndex(3)).Visibility = (Visibility)1;
+					}
+					if (toggles.HasFlag(TipoToggle.Excluir))
+					{
+						((UIElement)(DataGridCell)((ItemsControl)visualChild).ItemContainerGenerator.ContainerFromIndex(4)).Visibility = (Visibility)1;
+					}
+					break;
+				}
+			}
+		}
+		catch (Exception)
+		{
+		}
+	}
+}
diff --git a/Decompiler/Gestor.Application.Helpers/Erro.cs b/Decompiler/Gestor.Application.Helpers/Erro.cs
new file mode 100644
index 0000000..485c8c2
--- /dev/null
+++ b/Decompiler/Gestor.Application.Helpers/Erro.cs
@@ -0,0 +1,25 @@
+using System;
+using System.IO;
+using System.Windows;
+using System.Windows.Threading;
+using Gestor.Application.Views.Generic;
+using Gestor.Model.API;
+
+namespace Gestor.Application.Helpers;
+
+public static class Erro
+{
+	public static void RegistrarErro(LogError log, bool abrirTela = true)
+	{
+		string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Gestor.Exceptions.log");
+		string contents = string.Format("CORRETORA: {1} - {2}{0} USUÁRIO LOGADO: {3}{0} VERSÃO: {4}{0} DATA: {5}{0} ERRO: {6} - {7}{0} HRESULT: {8}{0} HELPLINK: {9}{0}  MESSAGE: {10}{0} SOURCE: {11}{0} STACKTRACE: {12}{0} MAQUINA: {13}{0} USUARIO MAQUINA: {14}{0} LINHA: {15}{0} OBJETO: {16}{0} {0}", Environment.NewLine, log.IdFornecedor, log.Fornecedor, log.UsuarioLogado, log.Versao, log.Data, log.IdErro, log.Erro, log.HResult, log.HelpLink, log.Message, log.Source, log.StackTrace, log.Maquina, log.UsuarioMaquina, log.Linha, log.Objeto);
+		File.AppendAllText(path, contents);
+		if (abrirTela)
+		{
+			((DispatcherObject)Application.Current).Dispatcher.BeginInvoke((DispatcherPriority)4, (Delegate)(Action)delegate
+			{
+				((Window)new ErrorWindow((TipoErro)log.IdErro)).ShowDialog();
+			});
+		}
+	}
+}
diff --git a/Decompiler/Gestor.Application.Helpers/Funcoes.cs b/Decompiler/Gestor.Application.Helpers/Funcoes.cs
new file mode 100644
index 0000000..8088254
--- /dev/null
+++ b/Decompiler/Gestor.Application.Helpers/Funcoes.cs
@@ -0,0 +1,4086 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Globalization;
+using System.Linq;
+using System.Net;
+using System.Net.Sockets;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Web;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Input;
+using System.Windows.Threading;
+using Agger.Registro;
+using ClosedXML.Excel;
+using CsQuery.ExtensionMethods;
+using Gestor.Application.Actions;
+using Gestor.Application.Properties;
+using Gestor.Application.Servicos;
+using Gestor.Application.Servicos.Configuracoes;
+using Gestor.Application.Servicos.Ferramentas;
+using Gestor.Application.Servicos.Generic;
+using Gestor.Application.Servicos.Seguros;
+using Gestor.Application.Servicos.Seguros.Itens;
+using Gestor.Application.ViewModels.Generic;
+using Gestor.Application.Views.Generic;
+using Gestor.Common.Validation;
+using Gestor.Infrastructure.UnitOfWork.Generic;
+using Gestor.Infrastructure.UnitOfWork.Logic;
+using Gestor.Model.API;
+using Gestor.Model.Attributes;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Card;
+using Gestor.Model.Domain.Common;
+using Gestor.Model.Domain.Configuracoes;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Domain.MalaDireta;
+using Gestor.Model.Domain.Relatorios;
+using Gestor.Model.Domain.Seguros;
+using HtmlAgilityPack;
+using MaterialDesignThemes.Wpf;
+using Newtonsoft.Json;
+using OfxSharpLib;
+using Xceed.Wpf.AvalonDock.Controls;
+
+namespace Gestor.Application.Helpers;
+
+public static class Funcoes
+{
+	[CompilerGenerated]
+	private sealed class _003CDistinctBy_003Ed__55 : IEnumerable, IEnumerable, IEnumerator, IDisposable, IEnumerator
+	{
+		private int _003C_003E1__state;
+
+		private TSource _003C_003E2__current;
+
+		private int _003C_003El__initialThreadId;
+
+		private IEnumerable source;
+
+		public IEnumerable _003C_003E3__source;
+
+		private Func keySelector;
+
+		public Func _003C_003E3__keySelector;
+
+		private HashSet _003CseenKeys_003E5__2;
+
+		private IEnumerator _003C_003E7__wrap2;
+
+		TSource IEnumerator.Current
+		{
+			[DebuggerHidden]
+			get
+			{
+				return _003C_003E2__current;
+			}
+		}
+
+		object IEnumerator.Current
+		{
+			[DebuggerHidden]
+			get
+			{
+				return _003C_003E2__current;
+			}
+		}
+
+		[DebuggerHidden]
+		public _003CDistinctBy_003Ed__55(int _003C_003E1__state)
+		{
+			this._003C_003E1__state = _003C_003E1__state;
+			_003C_003El__initialThreadId = Environment.CurrentManagedThreadId;
+		}
+
+		[DebuggerHidden]
+		void IDisposable.Dispose()
+		{
+			int num = _003C_003E1__state;
+			if (num == -3 || num == 1)
+			{
+				try
+				{
+				}
+				finally
+				{
+					_003C_003Em__Finally1();
+				}
+			}
+			_003CseenKeys_003E5__2 = null;
+			_003C_003E7__wrap2 = null;
+			_003C_003E1__state = -2;
+		}
+
+		private bool MoveNext()
+		{
+			try
+			{
+				switch (_003C_003E1__state)
+				{
+				default:
+					return false;
+				case 0:
+					_003C_003E1__state = -1;
+					_003CseenKeys_003E5__2 = new HashSet();
+					_003C_003E7__wrap2 = source.GetEnumerator();
+					_003C_003E1__state = -3;
+					break;
+				case 1:
+					_003C_003E1__state = -3;
+					break;
+				}
+				while (_003C_003E7__wrap2.MoveNext())
+				{
+					TSource current = _003C_003E7__wrap2.Current;
+					if (_003CseenKeys_003E5__2.Add(keySelector(current)))
+					{
+						_003C_003E2__current = current;
+						_003C_003E1__state = 1;
+						return true;
+					}
+				}
+				_003C_003Em__Finally1();
+				_003C_003E7__wrap2 = null;
+				return false;
+			}
+			catch
+			{
+				//try-fault
+				((IDisposable)this).Dispose();
+				throw;
+			}
+		}
+
+		bool IEnumerator.MoveNext()
+		{
+			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
+			return this.MoveNext();
+		}
+
+		private void _003C_003Em__Finally1()
+		{
+			_003C_003E1__state = -1;
+			if (_003C_003E7__wrap2 != null)
+			{
+				_003C_003E7__wrap2.Dispose();
+			}
+		}
+
+		[DebuggerHidden]
+		void IEnumerator.Reset()
+		{
+			throw new NotSupportedException();
+		}
+
+		[DebuggerHidden]
+		IEnumerator IEnumerable.GetEnumerator()
+		{
+			_003CDistinctBy_003Ed__55 _003CDistinctBy_003Ed__;
+			if (_003C_003E1__state == -2 && _003C_003El__initialThreadId == Environment.CurrentManagedThreadId)
+			{
+				_003C_003E1__state = 0;
+				_003CDistinctBy_003Ed__ = this;
+			}
+			else
+			{
+				_003CDistinctBy_003Ed__ = new _003CDistinctBy_003Ed__55(0);
+			}
+			_003CDistinctBy_003Ed__.source = _003C_003E3__source;
+			_003CDistinctBy_003Ed__.keySelector = _003C_003E3__keySelector;
+			return _003CDistinctBy_003Ed__;
+		}
+
+		[DebuggerHidden]
+		IEnumerator IEnumerable.GetEnumerator()
+		{
+			return ((IEnumerable)this).GetEnumerator();
+		}
+	}
+
+	public static Stopwatch Stopwatch;
+
+	public static DateTime? StartTime;
+
+	public static async Task VerificarPagamento(long id)
+	{
+		bool[] pagamento = new bool[2];
+		if ((await new ParcelaServico().BuscarParcelas(id)).Any((Parcela x) => x.DataRecebimento.HasValue))
+		{
+			pagamento[0] = true;
+		}
+		if ((await new VendedorServico().BuscaRepasse(id)).Any((VendedorParcela x) => x.DataPagamento.HasValue))
+		{
+			pagamento[1] = true;
+		}
+		return pagamento;
+	}
+
+	public static decimal CalculaPagamento(VendedorParcela pagamento, Parcela parcela, decimal comissaoPrevista)
+	{
+		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0041: Invalid comparison between Unknown and I4
+		//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00c8: Invalid comparison between Unknown and I4
+		//IL_0109: Unknown result type (might be due to invalid IL or missing references)
+		//IL_010f: Invalid comparison between Unknown and I4
+		//IL_0129: Unknown result type (might be due to invalid IL or missing references)
+		//IL_012f: Invalid comparison between Unknown and I4
+		decimal num = pagamento.PorcentagemRepasse.GetValueOrDefault();
+		decimal valueOrDefault = pagamento.ValorRepasse.GetValueOrDefault();
+		decimal num2 = parcela.ValorComDesconto;
+		Repasse repasse = pagamento.Repasse;
+		if (repasse != null && (int)repasse.Incidencia.GetValueOrDefault() == 2)
+		{
+			decimal num3 = parcela.Documento.Comissao * parcela.Documento.PremioLiquido * 0.01m;
+			decimal num4 = ((parcela.ValorComissao != 0m) ? (parcela.ValorComissao / num3) : 0m);
+			num2 = parcela.Documento.PremioLiquido * num4;
+		}
+		Repasse repasse2 = pagamento.Repasse;
+		if (repasse2 == null || (int)repasse2.Tipo.GetValueOrDefault() != 1)
+		{
+			num = num2 * pagamento.PorcentagemRepasse.GetValueOrDefault() * 0.01m;
+		}
+		Repasse repasse3 = pagamento.Repasse;
+		if (repasse3 != null && (int)repasse3.Tipo.GetValueOrDefault() == 1)
+		{
+			Repasse repasse4 = pagamento.Repasse;
+			if (repasse4 != null && (int)repasse4.Forma.GetValueOrDefault() == 1 && Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 25))
+			{
+				decimal num5 = ((comissaoPrevista == 0m) ? 1m : (parcela.ValorComissao / comissaoPrevista));
+				num *= num5;
+			}
+		}
+		if (!(Math.Abs(num) > Math.Abs(valueOrDefault)))
+		{
+			return num;
+		}
+		return valueOrDefault;
+	}
+
+	public static async Task BaixarComissao(Parcela parcela, List parcelas, List repasses, decimal tolerancia = 2m, bool comissaoAuto = false)
+	{
+		ParcelaServico servico = new ParcelaServico();
+		parcela.ValorComDesconto = ((parcela.ValorComDesconto == 0m && Math.Abs(parcela.ValorComDesconto) < Math.Abs(parcela.ValorComissao)) ? parcela.ValorComissao : parcela.ValorComDesconto);
+		var source = from x in repasses
+			group x by new
+			{
+				Id = ((DomainBase)x.Parcela).Id,
+				vendedor = ((DomainBase)x.Vendedor).Id,
+				tipovendedor = ((DomainBase)x.TipoVendedor).Id
+			};
+		BaseDialogViewModel viewmodel = new BaseDialogViewModel();
+		if (source.Any(g => g.Count() > 1))
+		{
+			Documento documento = parcela.Documento;
+			object obj;
+			if (!string.IsNullOrWhiteSpace((documento != null) ? documento.Apolice : null))
+			{
+				Documento documento2 = parcela.Documento;
+				obj = ((documento2 != null) ? documento2.Proposta : null);
+			}
+			else
+			{
+				Documento documento3 = parcela.Documento;
+				obj = ((documento3 != null) ? documento3.Apolice : null);
+			}
+			string arg = (string)obj;
+			await viewmodel.ShowMessage($"HÁ VENDEDORES DUPLICADOS PARA A PARCELA {parcela.NumeroParcela} DO DOCUMENTO {arg}, BAIXA DE COMISSÃO INTERROMPIDA.{Environment.NewLine}REALIZE A CORREÇÃO DOS VENDEDORES E TENTE NOVAMENTE.");
+			parcela.DataRecebimento = null;
+			parcela.ValorComissao = 0m;
+			parcela.ValorComDesconto = 0m;
+			parcela.Irr = 0m;
+			parcela.Iss = 0m;
+			parcela.Outros = 0m;
+			parcela.Desconto = 0m;
+			return parcela;
+		}
+		DateTime now = GetNetworkTime();
+		if ((int)parcela.SubTipo == 1 && (int)parcela.Documento.TipoRecebimento.GetValueOrDefault() == 1)
+		{
+			decimal num = (parcela.Documento.AdicionalComiss ? (parcela.Documento.PremioLiquido + parcela.Documento.PremioAdicional) : parcela.Documento.PremioLiquido);
+			decimal comissaoPrevista = num * parcela.Documento.Comissao * 0.01m;
+			decimal comissaoRecebida = parcelas.Where((Parcela x) => (int)x.SubTipo == 1 && x.DataRecebimento.HasValue).Sum((Parcela x) => x.ValorComissao);
+			decimal diferenca = Math.Abs(comissaoPrevista) - Math.Abs(comissaoRecebida);
+			bool flag = diferenca <= tolerancia || diferenca < 0.01m;
+			bool baixarProximas = (int)parcela.Documento.TipoRecebimento.GetValueOrDefault() == 1 && flag;
+			bool esgotarParcelas = true;
+			if (baixarProximas && Recursos.Configuracoes.Any((ConfiguracaoSistema c) => (int)c.Configuracao == 54))
+			{
+				Parcela obj2 = parcela;
+				object obj3;
+				if (obj2 == null)
+				{
+					obj3 = null;
+				}
+				else
+				{
+					Documento documento4 = obj2.Documento;
+					if (documento4 == null)
+					{
+						obj3 = null;
+					}
+					else
+					{
+						Controle controle = documento4.Controle;
+						if (controle == null)
+						{
+							obj3 = null;
+						}
+						else
+						{
+							Cliente cliente = controle.Cliente;
+							obj3 = ((cliente != null) ? cliente.Nome : null);
+						}
+					}
+				}
+				if (obj3 == null)
+				{
+					obj3 = string.Empty;
+				}
+				string text = (string)obj3;
+				if (string.IsNullOrEmpty(text))
+				{
+					Documento documento5 = parcela.Documento;
+					int num2;
+					if (documento5 == null)
+					{
+						num2 = 0;
+					}
+					else
+					{
+						Controle controle2 = documento5.Controle;
+						long? obj4;
+						if (controle2 == null)
+						{
+							obj4 = null;
+						}
+						else
+						{
+							Cliente cliente2 = controle2.Cliente;
+							obj4 = ((cliente2 != null) ? new long?(((DomainBase)cliente2).Id) : null);
+						}
+						num2 = ((obj4 > 0) ? 1 : 0);
+					}
+					if (num2 != 0)
+					{
+						Cliente obj5 = await new ClienteServico().BuscarClienteAsync(((DomainBase)parcela.Documento.Controle.Cliente).Id);
+						text = ((obj5 != null) ? obj5.Nome : null) ?? string.Empty;
+					}
+				}
+				if (!string.IsNullOrEmpty(text))
+				{
+					text = ", DO CLIENTE " + text;
+				}
+				Parcela obj6 = parcela;
+				object obj7;
+				if (obj6 == null)
+				{
+					obj7 = null;
+				}
+				else
+				{
+					Documento documento6 = obj6.Documento;
+					obj7 = ((documento6 != null) ? documento6.Apolice : null);
+				}
+				if (obj7 == null)
+				{
+					obj7 = string.Empty;
+				}
+				string text2 = (string)obj7;
+				if (!string.IsNullOrEmpty(text2))
+				{
+					text2 = " - APÓLICE " + text2;
+				}
+				if (parcela.Documento.NumeroParcelas != (decimal)parcela.NumeroParcela)
+				{
+					bool flag2;
+					baixarProximas = (flag2 = await viewmodel.ShowMessage($"AINDA RESTA {diferenca:c}{text}{text2} QUE NÃO SERÁ REPASSADO, CONTINUAR A BAIXA POR ESGOTAMENTO?", "SIM, BAIXAR POR ESGOMENTO", "NÃO"));
+					esgotarParcelas = flag2;
+				}
+			}
+			List list = repasses.Where(delegate(VendedorParcela x)
+			{
+				//IL_002d: Unknown result type (might be due to invalid IL or missing references)
+				//IL_0033: Invalid comparison between Unknown and I4
+				if (((DomainBase)x.Parcela).Id == ((DomainBase)parcela).Id)
+				{
+					Repasse repasse4 = x.Repasse;
+					if (repasse4 != null && (int)repasse4.Forma.GetValueOrDefault() == 1)
+					{
+						return !x.DataPagamento.HasValue;
+					}
+				}
+				return false;
+			}).ToList();
+			List demaisRepasses = new List();
+			Parcela proximaParcela = ((IEnumerable)parcelas).FirstOrDefault((Func)((Parcela x) => (int)x.SubTipo == 1 && x.NumeroParcela == parcela.NumeroParcela + 1));
+			Parcela parcela2 = parcela;
+			ExtensionMethods.ForEach(from g in list
+				group g by new
+				{
+					Id = ((DomainBase)g.Parcela).Id,
+					vendedor = ((DomainBase)g.Vendedor).Id,
+					tipovendedor = ((DomainBase)g.TipoVendedor).Id
+				}, x =>
+			{
+				//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
+				//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
+				//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
+				//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
+				//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
+				//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
+				//IL_0110: Unknown result type (might be due to invalid IL or missing references)
+				//IL_0121: Unknown result type (might be due to invalid IL or missing references)
+				//IL_0132: Unknown result type (might be due to invalid IL or missing references)
+				//IL_0143: Unknown result type (might be due to invalid IL or missing references)
+				//IL_0155: Expected O, but got Unknown
+				if (!x.First().CoCorretagem)
+				{
+					decimal valueOrDefault = x.First().ValorRepasse.GetValueOrDefault();
+					decimal num4 = CalculaPagamento(x.First(), parcela2, comissaoPrevista);
+					x.First().ValorRepasse = ((Math.Abs(valueOrDefault) > Math.Abs(num4)) ? num4 : valueOrDefault);
+					x.First().DataPrePagamento = parcela2.DataRecebimento;
+					if ((!esgotarParcelas || !(Math.Abs(comissaoPrevista) - Math.Abs(comissaoRecebida) <= Math.Abs(tolerancia))) && proximaParcela != null)
+					{
+						VendedorParcela item = new VendedorParcela
+						{
+							Repasse = x.First().Repasse,
+							Parcela = proximaParcela,
+							Documento = parcela2.Documento,
+							ValorRepasse = valueOrDefault - num4,
+							Vendedor = x.First().Vendedor,
+							ValorTotal = x.First().ValorTotal,
+							PorcentagemRepasse = x.First().PorcentagemRepasse,
+							TipoVendedor = x.First().TipoVendedor,
+							CoCorretagem = x.First().CoCorretagem
+						};
+						demaisRepasses.Add(item);
+					}
+				}
+			});
+			if (demaisRepasses.Count > 0)
+			{
+				list.AddRange(demaisRepasses);
+			}
+			if (!(await servico.SaveRange(list)))
+			{
+				await MostrarErro((TipoErro)24);
+				return parcela;
+			}
+			Parcela val = await servico.Save(parcela, parcelas, null, abrirTela: false);
+			parcela = val;
+			if (!servico.Sucesso)
+			{
+				await MostrarErro((TipoErro)24);
+				return parcela;
+			}
+			if (baixarProximas)
+			{
+				List list2 = parcelas.Where((Parcela x) => !x.DataRecebimento.HasValue && (int)x.SubTipo == 1).ToList();
+				List baixarRepasses = new List();
+				list2.ForEach(delegate(Parcela x)
+				{
+					x.Documento = parcela.Documento;
+					x.DataRecebimento = parcela.DataRecebimento;
+					x.DataCredito = parcela.DataRecebimento;
+					x.ValorRealizado = 0m;
+					x.ValorComissao = 0m;
+					x.ValorComDesconto = 0m;
+					x.Irr = 0m;
+					x.Iss = 0m;
+					List list4 = repasses.Where(delegate(VendedorParcela p)
+					{
+						//IL_002d: Unknown result type (might be due to invalid IL or missing references)
+						//IL_0033: Invalid comparison between Unknown and I4
+						//IL_004b: Unknown result type (might be due to invalid IL or missing references)
+						//IL_0051: Invalid comparison between Unknown and I4
+						if (((DomainBase)p.Parcela).Id == ((DomainBase)x).Id)
+						{
+							Repasse repasse2 = p.Repasse;
+							if (repasse2 != null && (int)repasse2.Forma.GetValueOrDefault() == 1)
+							{
+								Repasse repasse3 = p.Repasse;
+								if (repasse3 == null)
+								{
+									return true;
+								}
+								return (int)repasse3.Tipo.GetValueOrDefault() != 3;
+							}
+						}
+						return false;
+					}).ToList();
+					list4.ForEach(delegate(VendedorParcela p)
+					{
+						p.Parcela = x;
+						p.Documento = parcela.Documento;
+						p.DataPrePagamento = now;
+						decimal? valorRepasse = p.ValorRepasse;
+						decimal num3 = tolerancia;
+						p.ValorRepasse = (((valorRepasse.GetValueOrDefault() > num3) & valorRepasse.HasValue) ? new decimal?(default(decimal)) : p.ValorRepasse);
+					});
+					baixarRepasses.AddRange(list4);
+				});
+				await servico.SaveRange(parcelas);
+				if (!servico.Sucesso)
+				{
+					await MostrarErro((TipoErro)24);
+					return parcela;
+				}
+				if (!(await servico.SaveRange(baixarRepasses)))
+				{
+					await MostrarErro((TipoErro)24);
+					return parcela;
+				}
+			}
+		}
+		else
+		{
+			List list3 = repasses.Where(delegate(VendedorParcela x)
+			{
+				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
+				//IL_0050: Invalid comparison between Unknown and I4
+				if (((DomainBase)x.Parcela).Id == ((DomainBase)parcela).Id && !x.DataPagamento.HasValue)
+				{
+					if (x == null)
+					{
+						return false;
+					}
+					Repasse repasse = x.Repasse;
+					return (int)((repasse != null) ? repasse.Forma : null).GetValueOrDefault() == 1;
+				}
+				return false;
+			}).ToList();
+			list3.ForEach(delegate(VendedorParcela x)
+			{
+				x.DataPrePagamento = parcela.DataRecebimento;
+				x.ValorRepasse = CalculaRepasse(x.Repasse, parcela, apolice: false);
+			});
+			parcela = await servico.Save(parcela, parcelas, list3, abrirTela: false);
+			if (!servico.Sucesso)
+			{
+				await MostrarErro((TipoErro)24);
+				return parcela;
+			}
+		}
+		if (!comissaoAuto)
+		{
+			RegistrarLogBaixa(((DomainBase)parcela.Documento).Id, now);
+		}
+		return parcela;
+	}
+
+	private static async void RegistrarLogBaixa(long id, DateTime now)
+	{
+		ApoliceServico apoliceServico = new ApoliceServico();
+		ParcelaServico parcelaServico = new ParcelaServico();
+		VendedorServico vendedoresServico = new VendedorServico();
+		Documento apolice = await apoliceServico.BuscarApoliceAsync(id);
+		Documento val = apolice;
+		val.Parcelas = await parcelaServico.BuscarParcelasAsync(((DomainBase)apolice).Id);
+		List list = await vendedoresServico.BuscaRepasse(((DomainBase)apolice).Id);
+		foreach (Parcela parcela in apolice.Parcelas)
+		{
+			foreach (VendedorParcela item in list)
+			{
+				if (((DomainBase)item.Parcela).Id == ((DomainBase)parcela).Id)
+				{
+					if (parcela.Vendedores == null)
+					{
+						parcela.Vendedores = new ObservableCollection();
+					}
+					parcela.Vendedores.Add(item);
+				}
+			}
+		}
+		IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName());
+		RegistroLog val2 = new RegistroLog
+		{
+			Acao = (TipoAcao)1,
+			Usuario = Recursos.Usuario,
+			DataHora = now,
+			Descricao = JsonConvert.SerializeObject((object)apolice, new JsonSerializerSettings
+			{
+				ReferenceLoopHandling = (ReferenceLoopHandling)1
+			}),
+			EntidadeId = ((DomainBase)apolice).Id,
+			Tela = (TipoTela)2,
+			NomeMaquina = Environment.MachineName,
+			UsuarioMaquina = Environment.UserName,
+			Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString()
+		};
+		UnitOfWork commited = Instancia.Commited;
+		try
+		{
+			commited.RegistroLogRepository.SaveOrUpdate(val2);
+			((GenericUnitOfWork)commited).Commit();
+		}
+		finally
+		{
+			((IDisposable)commited)?.Dispose();
+		}
+	}
+
+	public static async Task MostrarErro(TipoErro erro)
+	{
+		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
+		await ((DispatcherObject)Application.Current).Dispatcher.BeginInvoke((DispatcherPriority)4, (Delegate)(Action)delegate
+		{
+			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
+			((Window)new ErrorWindow(erro, fecharSistema: true)).ShowDialog();
+		});
+	}
+
+	public static async Task RecusarApolice(Documento documento, string motivo, bool estorno)
+	{
+		ApoliceServico servico = new ApoliceServico();
+		CriticaApoliceServico criticaServico = new CriticaApoliceServico();
+		string label = ((documento.Tipo == 0 && string.IsNullOrEmpty(documento.Apolice)) ? "PROPOSTA RECUSADA" : ((documento.Tipo == 0 && !string.IsNullOrEmpty(documento.Apolice)) ? "APÓLICE RECUSADA" : "ENDOSSO RECUSADO"));
+		if (!string.IsNullOrWhiteSpace(motivo))
+		{
+			documento.Observacao = $"{Recursos.Usuario.Nome}, ID: {((DomainBase)Recursos.Usuario).Id}, {GetNetworkTime():g}{Environment.NewLine}RECUSA: {motivo}{Environment.NewLine}{Environment.NewLine}{documento.Observacao}";
+		}
+		bool flag;
+		if (documento.Tipo == 0)
+		{
+			await servico.Save(documento, updateParcelas: false, criarParcelas: false);
+			Controle controle = await servico.BuscarControleAsync(((DomainBase)documento.Controle).Id);
+			if (((DomainBase)controle).Id == 0L)
+			{
+				return;
+			}
+			foreach (Documento documento2 in controle.Documentos)
+			{
+				if (!documento2.NegocioCorretora.HasValue)
+				{
+					documento2.NegocioCorretora = (NegocioCorretora)((documento2.Negocio.HasValue && (int)documento2.Negocio.GetValueOrDefault() == 1) ? 1 : 0);
+				}
+				documento2.Situacao = (TipoSeguro)7;
+				documento2.Apolice = "RECUSADA";
+				if (!(await servico.BaixarParcelasCancelamento(documento2, estorno)))
+				{
+					Gestor.Application.Actions.Actions.AcessaTela?.Invoke((TipoTela)21, "");
+				}
+			}
+			flag = await servico.UpdateRange(controle);
+		}
+		else
+		{
+			if (!documento.NegocioCorretora.HasValue)
+			{
+				documento.NegocioCorretora = (NegocioCorretora)((documento.Negocio.HasValue && (int)documento.Negocio.GetValueOrDefault() == 1) ? 1 : 0);
+			}
+			documento.Situacao = (TipoSeguro)7;
+			documento.Apolice = "RECUSADA";
+			documento.Endosso = "RECUSADA";
+			if (!(await servico.BaixarParcelasCancelamento(documento, estorno)))
+			{
+				Gestor.Application.Actions.Actions.AcessaTela?.Invoke((TipoTela)21, "");
+			}
+			await servico.Save(documento, updateParcelas: false, criarParcelas: false);
+			if (!servico.Sucesso)
+			{
+				Gestor.Application.Actions.Actions.AcessaTela?.Invoke((TipoTela)21, "");
+			}
+			if (!servico.Sucesso)
+			{
+				Gestor.Application.Actions.Actions.AcessaTela?.Invoke((TipoTela)21, "");
+			}
+			flag = await InativarItens(((DomainBase)documento).Id, ((DomainBase)documento.Controle.Ramo).Id, delete: false);
+			if (!flag)
+			{
+				Gestor.Application.Actions.Actions.AcessaTela?.Invoke((TipoTela)21, "");
+			}
+		}
+		if (!flag)
+		{
+			Gestor.Application.Actions.Actions.AcessaTela?.Invoke((TipoTela)21, "");
+		}
+		List list = await criticaServico.BuscarCritica(((DomainBase)documento).Id);
+		if (list != null)
+		{
+			foreach (CriticaApolice item in list)
+			{
+				item.Critica = true;
+				await criticaServico.Save(item);
+			}
+		}
+		Gestor.Application.Actions.Actions.AcessaTela?.Invoke((TipoTela)21, "");
+		ToggleSnackBar(label + " COM SUCESSO");
+	}
+
+	public static void ToggleSnackBar(string message, bool active = true)
+	{
+		((ContentControl)App.SnackBar.Message).Content = message;
+		App.SnackBar.IsActive = active;
+		if (active)
+		{
+			Task.Factory.StartNew(CloseSlackBar);
+		}
+	}
+
+	private static void CloseSlackBar()
+	{
+		Thread.Sleep(5000);
+		Dispatcher dispatcher = ((DispatcherObject)App.ProgressRing).Dispatcher;
+		if (dispatcher != null)
+		{
+			dispatcher.BeginInvoke((DispatcherPriority)4, (Delegate)(Action)delegate
+			{
+				ToggleSnackBar("", active: false);
+			});
+		}
+	}
+
+	public static decimal CalculaRepasse(Repasse repasse, Parcela parcela, bool apolice = true)
+	{
+		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
+		//IL_001e: Invalid comparison between Unknown and I4
+		//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
+		//IL_00ef: Invalid comparison between Unknown and I4
+		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
+		//IL_003c: Invalid comparison between Unknown and I4
+		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0048: Invalid comparison between Unknown and I4
+		//IL_010b: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0111: Invalid comparison between Unknown and I4
+		//IL_0170: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0176: Invalid comparison between Unknown and I4
+		//IL_018e: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0194: Invalid comparison between Unknown and I4
+		//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
+		//IL_01d0: Invalid comparison between Unknown and I4
+		//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
+		//IL_01ef: Invalid comparison between Unknown and I4
+		//IL_0280: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0286: Invalid comparison between Unknown and I4
+		//IL_0289: Unknown result type (might be due to invalid IL or missing references)
+		//IL_028f: Invalid comparison between Unknown and I4
+		//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
+		//IL_02a6: Invalid comparison between Unknown and I4
+		if (repasse == null)
+		{
+			return 0m;
+		}
+		bool flag = (int)parcela.Documento.NegocioCorretora.GetValueOrDefault() == 1;
+		decimal num2;
+		decimal num3;
+		decimal num;
+		if (apolice && (int)parcela.Documento.TipoRecebimento.GetValueOrDefault() != 2 && (int)parcela.SubTipo == 1)
+		{
+			num = (parcela.Documento.AdicionalComiss ? (parcela.Documento.PremioLiquido + parcela.Documento.PremioAdicional) : parcela.Documento.PremioLiquido);
+			num2 = (parcela.Documento.AdicionalComiss ? (parcela.Documento.PremioLiquido + parcela.Documento.PremioAdicional) : parcela.Documento.PremioLiquido);
+			num3 = parcela.Documento.Comissao * 0.01m;
+		}
+		else
+		{
+			decimal num4 = (((int)parcela.Documento.TipoRecebimento.GetValueOrDefault() == 2) ? parcela.ValorLiquidoFatura : parcela.Valor);
+			num = (((int)repasse.Incidencia.GetValueOrDefault() == 2) ? num4 : ((parcela.ValorComDesconto == 0m) ? num4 : parcela.ValorComDesconto));
+			num2 = num;
+			num3 = ((parcela.ValorComDesconto == 0m) ? (parcela.Comissao * 0.01m) : 1m);
+		}
+		num = (((int)repasse.Incidencia.GetValueOrDefault() == 2) ? num : (num * num3));
+		num = (((int)repasse.Tipo.GetValueOrDefault() == 1) ? num : (num * (flag ? repasse.ValorRenovacao : repasse.ValorNovo) * 0.01m));
+		decimal num5 = (((int)repasse.Incidencia.GetValueOrDefault() == 2) ? num2 : (num2 * num3));
+		decimal num6;
+		if ((int)repasse.Tipo.GetValueOrDefault() == 1)
+		{
+			num6 = (flag ? repasse.ValorRenovacao : repasse.ValorNovo);
+			if (Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 24) && parcela.Valor < 0m)
+			{
+				num6 = -num6;
+			}
+		}
+		else
+		{
+			num6 = num5 * (flag ? repasse.ValorRenovacao : repasse.ValorNovo) * 0.01m;
+		}
+		if ((int)parcela.Documento.TipoRecebimento.GetValueOrDefault() != 2 && (int)parcela.SubTipo == 1 && (int)parcela.Documento.TipoEndosso.GetValueOrDefault() != 2)
+		{
+			if (Math.Abs(num6) > Math.Abs(num))
+			{
+				new BaseDialogViewModel().ShowMessage("OS VALORES DE REPASSE ULTRAPASSARAM O VALOR DE COMISSÃO FECHADA. REVEJA OS VALORES.");
+			}
+			if (!(Math.Abs(num6) > Math.Abs(num)))
+			{
+				return num6;
+			}
+			return num;
+		}
+		if (!(parcela.ValorComDesconto != 0m) || !(Math.Abs(num6) > Math.Abs(parcela.ValorComDesconto)) || !Recursos.Configuracoes.All((ConfiguracaoSistema x) => (int)x.Configuracao != 15))
+		{
+			return num6;
+		}
+		return parcela.ValorComDesconto;
+	}
+
+	public static async Task ExcluirBaixa(Parcela parcela, List repasses, List parcelas = null)
+	{
+		ParcelaServico servico = new ParcelaServico();
+		if ((int)parcela.SubTipo == 1 && (int)parcela.Documento.TipoRecebimento.GetValueOrDefault() == 1)
+		{
+			List source = repasses.Where(delegate(VendedorParcela x)
+			{
+				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
+				//IL_000c: Invalid comparison between Unknown and I4
+				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
+				//IL_0029: Invalid comparison between Unknown and I4
+				if ((int)x.Parcela.SubTipo == 1)
+				{
+					Repasse repasse4 = x.Repasse;
+					if (repasse4 != null && (int)repasse4.Forma.GetValueOrDefault() == 1)
+					{
+						if (((DomainBase)x.Parcela).Id != ((DomainBase)parcela).Id)
+						{
+							return !x.DataPrePagamento.HasValue;
+						}
+						return true;
+					}
+				}
+				return false;
+			}).ToList();
+			decimal comiss = (parcela.Documento.PremioLiquido + (parcela.Documento.AdicionalComiss ? parcela.Documento.PremioAdicional : 0m)) * parcela.Documento.Comissao * 0.01m;
+			List refazerRepasses = (from x in source
+				group x by ((DomainBase)x.Vendedor).Id).Select((Func, VendedorParcela>)delegate(IGrouping x)
+			{
+				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
+				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
+				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
+				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
+				//IL_003d: Unknown result type (might be due to invalid IL or missing references)
+				//IL_0067: Unknown result type (might be due to invalid IL or missing references)
+				//IL_006d: Invalid comparison between Unknown and I4
+				//IL_013e: Unknown result type (might be due to invalid IL or missing references)
+				//IL_014f: Unknown result type (might be due to invalid IL or missing references)
+				//IL_0160: Unknown result type (might be due to invalid IL or missing references)
+				//IL_0171: Unknown result type (might be due to invalid IL or missing references)
+				//IL_0183: Expected O, but got Unknown
+				VendedorParcela val2 = new VendedorParcela
+				{
+					Repasse = x.First().Repasse,
+					Parcela = parcela,
+					Documento = parcela.Documento
+				};
+				VendedorParcela obj = x.First();
+				decimal? valorTotal;
+				if (obj != null)
+				{
+					Repasse repasse3 = obj.Repasse;
+					if ((int)((repasse3 != null) ? repasse3.Tipo : null).GetValueOrDefault() == 3)
+					{
+						valorTotal = x.First().ValorRepasse;
+						goto IL_0139;
+					}
+				}
+				VendedorParcela obj2 = x.First();
+				if (obj2 == null || !obj2.ValorTotal.HasValue)
+				{
+					goto IL_00d5;
+				}
+				VendedorParcela obj3 = x.First();
+				decimal? valorTotal2;
+				if (obj3 != null)
+				{
+					valorTotal2 = obj3.ValorTotal;
+					if ((valorTotal2.GetValueOrDefault() == default(decimal)) & valorTotal2.HasValue)
+					{
+						goto IL_00d5;
+					}
+				}
+				VendedorParcela obj4 = x.First();
+				valorTotal = ((obj4 != null) ? obj4.ValorTotal : null);
+				goto IL_0139;
+				IL_0139:
+				val2.ValorTotal = valorTotal;
+				val2.Vendedor = x.First().Vendedor;
+				val2.PorcentagemRepasse = x.First().PorcentagemRepasse;
+				val2.TipoVendedor = x.First().TipoVendedor;
+				val2.CoCorretagem = x.First().CoCorretagem;
+				return val2;
+				IL_00d5:
+				decimal value = comiss;
+				valorTotal2 = x.First().PorcentagemRepasse;
+				valorTotal = (decimal?)value * valorTotal2 * (decimal?)0.01m;
+				goto IL_0139;
+			}).ToList();
+			List parcelasAnteriores = ((parcelas != null) ? parcelas.Where((Parcela x) => (int)x.SubTipo == 1 && x.NumeroParcela < parcela.NumeroParcela).ToList() : new List());
+			refazerRepasses.ForEach(delegate(VendedorParcela y)
+			{
+				y.ValorRepasse = y.ValorTotal - repasses.Where(delegate(VendedorParcela x)
+				{
+					//IL_0006: Unknown result type (might be due to invalid IL or missing references)
+					//IL_000c: Invalid comparison between Unknown and I4
+					//IL_0026: Unknown result type (might be due to invalid IL or missing references)
+					//IL_002c: Invalid comparison between Unknown and I4
+					if ((int)x.Parcela.SubTipo == 1)
+					{
+						Repasse repasse2 = x.Repasse;
+						if (repasse2 != null && (int)repasse2.Forma.GetValueOrDefault() == 1 && ((DomainBase)x.Vendedor).Id == ((DomainBase)y.Vendedor).Id)
+						{
+							return parcelasAnteriores.Select((Parcela z) => ((DomainBase)z).Id).ToList().Contains(((DomainBase)x.Parcela).Id);
+						}
+					}
+					return false;
+				}).Sum((VendedorParcela x) => x.ValorRepasse);
+			});
+			List demaisParcelas3 = ((parcelas != null) ? parcelas.Where((Parcela x) => (int)x.SubTipo == 1 && x.NumeroParcela > parcela.NumeroParcela).ToList() : new List());
+			demaisParcelas3.Add(parcela);
+			List repasses2 = repasses.Where(delegate(VendedorParcela x)
+			{
+				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
+				//IL_000c: Invalid comparison between Unknown and I4
+				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
+				//IL_0029: Invalid comparison between Unknown and I4
+				if ((int)x.Parcela.SubTipo == 1)
+				{
+					Repasse repasse = x.Repasse;
+					if (repasse != null && (int)repasse.Forma.GetValueOrDefault() == 1)
+					{
+						if (x.Parcela.NumeroParcela < parcela.NumeroParcela)
+						{
+							return !x.DataPrePagamento.HasValue;
+						}
+						return true;
+					}
+				}
+				return false;
+			}).ToList();
+			if (!(await servico.DeletePagamentoRange(repasses2)))
+			{
+				await MostrarErro((TipoErro)191);
+				return parcela;
+			}
+			if (!(await servico.SaveRange(refazerRepasses)))
+			{
+				await MostrarErro((TipoErro)191);
+				return parcela;
+			}
+			demaisParcelas3 = demaisParcelas3.Where((Parcela dParcela) => dParcela.ValorComissao != 0m || dParcela.ValorComissao != 0m || dParcela.DataRecebimento.HasValue || dParcela.DataCredito.HasValue || dParcela.ValorRealizado != 0m).ToList();
+			if (demaisParcelas3 != null && demaisParcelas3.Count > 0)
+			{
+				demaisParcelas3.ForEach(delegate(Parcela dParcela)
+				{
+					dParcela.Documento = parcela.Documento;
+					dParcela.ValorComissao = 0m;
+					dParcela.ValorComDesconto = 0m;
+					dParcela.DataRecebimento = null;
+					dParcela.DataCredito = null;
+					dParcela.ValorRealizado = 0m;
+				});
+				demaisParcelas3 = await servico.UpdateRange(demaisParcelas3);
+				if (!servico.Sucesso)
+				{
+					await MostrarErro((TipoErro)191);
+					return parcela;
+				}
+				parcela = ((IEnumerable)demaisParcelas3).FirstOrDefault((Func)((Parcela x) => ((DomainBase)x).Id == ((DomainBase)parcela).Id));
+			}
+		}
+		else
+		{
+			List list = repasses.Where((VendedorParcela x) => ((DomainBase)x.Parcela).Id == ((DomainBase)parcela).Id && !x.DataPagamento.HasValue).ToList();
+			list.ForEach(delegate(VendedorParcela x)
+			{
+				x.DataPrePagamento = null;
+				x.ValorRepasse = x.ValorTotal ?? CalculaPagamento(x, x.Parcela, 0m);
+			});
+			parcela.ValorComissao = 0m;
+			parcela.ValorComDesconto = 0m;
+			parcela.DataRecebimento = null;
+			parcela.DataCredito = null;
+			parcela.ValorRealizado = 0m;
+			parcela = await servico.Save(parcela, parcelas, list, abrirTela: false);
+			if (!servico.Sucesso)
+			{
+				await MostrarErro((TipoErro)191);
+				return parcela;
+			}
+		}
+		ApoliceServico apoliceServico = new ApoliceServico();
+		ParcelaServico parcelaServico = new ParcelaServico();
+		VendedorServico vendedoresServico = new VendedorServico();
+		if (parcela != null)
+		{
+			Documento apolice = await apoliceServico.BuscarApoliceAsync(((DomainBase)parcela.Documento).Id);
+			Documento val = apolice;
+			val.Parcelas = await parcelaServico.BuscarParcelasAsync(((DomainBase)apolice).Id);
+			List list2 = await vendedoresServico.BuscaRepasse(((DomainBase)apolice).Id);
+			foreach (Parcela parcela2 in apolice.Parcelas)
+			{
+				foreach (VendedorParcela item in list2)
+				{
+					if (((DomainBase)item.Parcela).Id == ((DomainBase)parcela2).Id)
+					{
+						if (parcela2.Vendedores == null)
+						{
+							parcela2.Vendedores = new ObservableCollection();
+						}
+						parcela2.Vendedores.Add(item);
+					}
+				}
+			}
+			IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName());
+			RegistroLog registroLog = new RegistroLog
+			{
+				Acao = (TipoAcao)2,
+				Usuario = Recursos.Usuario,
+				DataHora = GetNetworkTime(),
+				Descricao = JsonConvert.SerializeObject((object)apolice, new JsonSerializerSettings
+				{
+					ReferenceLoopHandling = (ReferenceLoopHandling)1
+				}),
+				EntidadeId = ((DomainBase)apolice).Id,
+				Tela = (TipoTela)2,
+				NomeMaquina = Environment.MachineName,
+				UsuarioMaquina = Environment.UserName,
+				Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString()
+			};
+			await Task.Run(delegate
+			{
+				UnitOfWork commited = Instancia.Commited;
+				try
+				{
+					commited.RegistroLogRepository.SaveOrUpdate(registroLog);
+					((GenericUnitOfWork)commited).Commit();
+				}
+				finally
+				{
+					((IDisposable)commited)?.Dispose();
+				}
+			});
+		}
+		return parcela;
+	}
+
+	public static void DatePicker_OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
+	{
+		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
+		DatePicker val = (DatePicker)sender;
+		val.Text = ValidationHelper.FormatDate(val.Text);
+	}
+
+	public static void DatePicker_PreviewKeyDown(object sender, KeyEventArgs e)
+	{
+		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
+		//IL_0007: Invalid comparison between Unknown and I4
+		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
+		if ((int)e.Key == 6)
+		{
+			((DatePicker)sender).Text = GetNetworkTime().Date.ToString("dd/MM/yyyy");
+		}
+	}
+
+	public static async Task OrganizarDocumentos(long id)
+	{
+		ApoliceServico servico = new ApoliceServico();
+		Controle val = await servico.BuscarControleAsync(id);
+		int ordem = 1;
+		(from x in val.Documentos
+			where !x.Excluido
+			orderby x.Vigencia1
+			select x).ToList().ForEach(delegate(Documento x)
+		{
+			if (x.Tipo == 0)
+			{
+				x.Ordem = 0;
+			}
+			else
+			{
+				x.Ordem = ordem;
+				ordem++;
+			}
+		});
+		await servico.UpdateRange(val);
+	}
+
+	public static async Task ReativarItens(List ids)
+	{
+		ItemServico servico = new ItemServico();
+		List list = await servico.BuscarItems(ids);
+		list.ForEach(delegate(Item x)
+		{
+			x.Substituido = null;
+			x.Cancelado = false;
+			x.Status = x.StatusInclusao;
+		});
+		await servico.SaveRange(list);
+		return servico.Sucesso;
+	}
+
+	public static async Task InativarItens(long id, long ramo, bool delete = true)
+	{
+		ItemServico servico = new ItemServico();
+		ObservableCollection itens = await servico.BuscarItens(id);
+		if (!(await ReativarItens((from x in itens
+			where x.Substituicao.HasValue
+			select x.Substituicao.Value).ToList())))
+		{
+			return false;
+		}
+		if (delete)
+		{
+			await servico.DeleteRange(itens.ToList(), ramo);
+		}
+		else
+		{
+			itens.ToList().ForEach(delegate(Item x)
+			{
+				x.Cancelado = true;
+			});
+			await servico.SaveRange(itens.ToList());
+		}
+		return servico.Sucesso;
+	}
+
+	public static string ExportarHtml(TipoRelatorio tipo, string dados, string porcentagem = "60", string orientation = "landscape", bool search = false, string grafico = "")
+	{
+		string newValue = $"DATA DE EMISSÃO DO RELATÓRIO EM {GetNetworkTime():G}";
+		if (tipo.Inicio != DateTime.MinValue && tipo.Nome != "RELATÓRIO DE CLIENTE")
+		{
+			newValue = $"PERÍODO DE {tipo.Inicio:d} ATÉ {tipo.Fim:d}. DATA DE EMISSÃO DO RELATÓRIO EM {GetNetworkTime():G}";
+		}
+		string newValue2 = ((!search) ? "" : "");
+		StringBuilder stringBuilder = new StringBuilder();
+		stringBuilder.Append(Resources.RelatorioTemplate.Replace("{style}", newValue2).Replace("Orientation", orientation).Replace("{NomeRelatorio}", Recursos.Empresa.NomeSocial + " - " + tipo.Nome)
+			.Replace("{EmissaoRelatorio}", newValue)
+			.Replace("{Grafico}", grafico)
+			.Replace("{DadosRelatorio}", dados));
+		return stringBuilder.ToString();
+	}
+
+	public static string ExportarMultipleHtml(TipoRelatorio tipo, string dados, string porcentagem = "60", string orientation = "landscape", bool search = false, string grafico = "")
+	{
+		string newValue = $"DATA DE EMISSÃO DO RELATÓRIO EM {GetNetworkTime():G}";
+		if (tipo.Inicio != DateTime.MinValue && tipo.Nome != "RELATÓRIO DE CLIENTE")
+		{
+			newValue = $"PERÍODO DE {tipo.Inicio:d} ATÉ {tipo.Fim:d}. DATA DE EMISSÃO DO RELATÓRIO EM {GetNetworkTime():G}";
+		}
+		string newValue2 = ((!search) ? "" : "");
+		StringBuilder stringBuilder = new StringBuilder();
+		stringBuilder.Append(Resources.RelatorioMultipleTemplate.Replace("{style}", newValue2).Replace("Orientation", orientation).Replace("{NomeRelatorio}", Recursos.Empresa.NomeSocial + " - " + tipo.Nome)
+			.Replace("{EmissaoRelatorio}", newValue)
+			.Replace("{Grafico}", grafico)
+			.Replace("{DadosRelatorio}", dados));
+		return stringBuilder.ToString();
+	}
+
+	public static string CriarRecibo(Vendedor vendedor, decimal valor, Filtros filtro, bool segundavia)
+	{
+		string text = (segundavia ? " acima listados" : $" no periodo de {filtro.Inicio:d} até {filtro.Fim:d}");
+		string text2 = "CPF";
+		if (vendedor.Documento != null && ValidationHelper.OnlyNumber(vendedor.Documento).Length > 12)
+		{
+			text2 = "CNPJ";
+		}
+		return $"    
\r\n
RECIBO DE PAGAMENTO
\r\n
\r\n
Declaração de recebimento de Comissão
\r\n

Eu {vendedor.Nome}, portador(a) do {text2} {vendedor.Documento} declaro que recebi de {Recursos.Empresa.Nome} o valor de {valor:c} referente a comissão dos seguros{text}.

\r\n\r\n

Para maior clareza firmo(a) o presente recibo para que produza os seus efeitos, dando plena, rasa e irrevogável quitação, pelo valor recebido.

\r\n\r\n

_____________________________________________________________
{GetNetworkTime().Date:d}

\r\n
\r\n
"; + } + + public static string CreateCard(string title, string body, bool pageBreak = false) + { + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.Append(pageBreak ? "
" : "
"); + stringBuilder.Append("
"); + stringBuilder.Append("
" + title + "
"); + stringBuilder.Append(body); + stringBuilder.Append("
"); + stringBuilder.Append("
"); + return stringBuilder.ToString(); + } + + public static async Task GenerateTableSintetic(List sintetic, int fontSize = 0) + { + if (sintetic == null || sintetic.Count == 0) + { + return ""; + } + string classSize = ((fontSize == 0) ? "" : $"fs-{fontSize}'"); + return await Task.Run(delegate + { + StringBuilder stringBuilder = new StringBuilder(); + StringBuilder stringBuilder2 = new StringBuilder(); + StringBuilder headerContent = new StringBuilder(); + StringBuilder stringBuilder3 = new StringBuilder(); + StringBuilder content = new StringBuilder(); + sintetic.ForEach(delegate(SinteticModel x) + { + headerContent.Append(Resources.HeaderTemplate.Replace("{Align}", "text-center").Replace("{Size}", classSize).Replace("{FontWeight}", "fw-bold") + .Replace("{Content}", x.Hint)); + content.Append(Resources.ColumnTemplate.Replace("{Align}", "text-center").Replace("{Size}", classSize).Replace("{FontWeight}", "") + .Replace("{Content}", (x.Value == null) ? "" : x.Value.ToString())); + }); + stringBuilder2.Append(Resources.RowTemplate.Replace("{Content}", headerContent.ToString()).Replace("{Color}", "")); + stringBuilder3.Append(Resources.RowTemplate.Replace("{Content}", content.ToString()).Replace("{Color}", "")); + stringBuilder.Append(Resources.TableTemplate.Replace("{Head}", stringBuilder2.ToString()).Replace("{Body}", stringBuilder3.ToString()).Replace("{Footer}", "")); + return stringBuilder.ToString(); + }); + } + + public static async Task GenerateTableSintetic(List sintetic, int fontSize = 0) + { + if (sintetic == null || sintetic.Count == 0) + { + return ""; + } + string classSize = ((fontSize == 0) ? "" : $"fs-{fontSize}'"); + return await Task.Run(delegate + { + StringBuilder stringBuilder = new StringBuilder(); + StringBuilder stringBuilder2 = new StringBuilder(); + StringBuilder headerContent = new StringBuilder(); + StringBuilder stringBuilder3 = new StringBuilder(); + sintetic.ForEach(delegate(SinteticModelList x) + { + headerContent.Append(Resources.HeaderTemplate.Replace("{Align}", "text-center").Replace("{Size}", classSize).Replace("{FontWeight}", "fw-bold") + .Replace("{Content}", x.Hint)); + }); + stringBuilder2.Append(Resources.RowTemplate.Replace("{Content}", headerContent.ToString()).Replace("{Color}", "")); + for (int i = 0; i < sintetic.First().Value.Count; i++) + { + StringBuilder stringBuilder4 = new StringBuilder(); + bool flag = false; + foreach (SinteticModelList item in sintetic) + { + flag = flag || (item.Value[0] != null && item.Value[i].ToString() == "TOTAL"); + stringBuilder4.Append(Resources.ColumnTemplate.Replace("{Align}", "text-center").Replace("{Size}", classSize).Replace("{FontWeight}", flag ? "fw-bold" : "") + .Replace("{Content}", $"{item.Value[i]}")); + } + stringBuilder3.Append(Resources.RowTemplate.Replace("{Content}", stringBuilder4.ToString()).Replace("{Color}", "")); + } + stringBuilder.Append(Resources.TableTemplate.Replace("{Head}", stringBuilder2.ToString()).Replace("{Body}", stringBuilder3.ToString()).Replace("{Footer}", "")); + return stringBuilder.ToString(); + }); + } + + public static async Task GenerateTable(List analitico, List colunasOcultas, bool grafico = false, bool propertyName = false, string footer = "", ConfiguracaoImpressao config = null) + { + if (analitico == null) + { + return ""; + } + if (analitico.Count == 0) + { + return ""; + } + int num = 0; + if (config != null) + { + num = config.TamanhoFonte; + } + string classSize = ((num == 0) ? "" : $"fs-{num}'"); + return await Task.Run(delegate + { + //IL_0112: Unknown result type (might be due to invalid IL or missing references) + StringBuilder stringBuilder = new StringBuilder(); + StringBuilder stringBuilder2 = new StringBuilder(); + StringBuilder rowContent = new StringBuilder(); + Type type = analitico[0].GetType(); + PropertyInfo[] properties = type.GetProperties(); + int num2 = 0; + PropertyInfo[] array = properties; + foreach (PropertyInfo propertyInfo in array) + { + if (!(propertyInfo.Name == "ValidationEvent")) + { + object obj = propertyInfo.GetCustomAttributes(typeof(DescriptionAttribute), inherit: true).FirstOrDefault(); + if (obj != null) + { + string description = ((DescriptionAttribute)obj).Description; + if ((!propertyName || !colunasOcultas.Contains(propertyInfo.Name)) && (propertyName || !colunasOcultas.Contains(description))) + { + object obj2 = propertyInfo.GetCustomAttributes(typeof(TipoAttribute), inherit: true).FirstOrDefault(); + string text = ""; + if (obj2 != null) + { + text = ((TipoAttribute)obj2).Description; + } + string newValue = "text-start"; + switch (text) + { + case "PERCENTUAL": + case "VALOR": + newValue = "text-center"; + break; + case "QUANTIDADE": + case "DATA": + newValue = "text-end"; + break; + } + stringBuilder2.Append(Resources.HeaderTemplate.Replace("{Align}", newValue).Replace("{Size}", classSize).Replace("{FontWeight}", "fw-bold") + .Replace("{Content}", description)); + num2++; + } + } + } + } + stringBuilder.Append(Resources.RowTemplate.Replace("{Content}", stringBuilder2.ToString()).Replace("{Color}", "")); + analitico.ForEach(delegate(T x) + { + //IL_00ca: Unknown result type (might be due to invalid IL or missing references) + //IL_00cd: Invalid comparison between Unknown and I4 + //IL_01d8: Unknown result type (might be due to invalid IL or missing references) + type = x.GetType(); + properties = type.GetProperties(); + PropertyInfo propertyInfo2 = properties.FirstOrDefault((PropertyInfo b) => b.Name == "Bold"); + bool flag = propertyInfo2 != null && (bool)propertyInfo2.GetValue(x); + PropertyInfo propertyInfo3 = properties.FirstOrDefault((PropertyInfo b) => b.Name == "Sinal"); + Sinal result; + string text2 = ((propertyInfo3 != null && propertyInfo3.GetValue(x) != null && Enum.TryParse(propertyInfo3.GetValue(x).ToString(), ignoreCase: true, out result) && (int)result == 1) ? "color: red;" : "color: black;"); + if (!flag) + { + _ = ""; + } + else + { + _ = ""; + } + StringBuilder stringBuilder4 = new StringBuilder(); + PropertyInfo[] array2 = properties; + foreach (PropertyInfo propertyInfo4 in array2) + { + if (!(propertyInfo4.Name == "ValidationEvent")) + { + object obj3 = propertyInfo4.GetCustomAttributes(typeof(DescriptionAttribute), inherit: true).FirstOrDefault(); + if (obj3 != null) + { + string description2 = ((DescriptionAttribute)obj3).Description; + if ((!propertyName || !colunasOcultas.Contains(propertyInfo4.Name)) && (propertyName || !colunasOcultas.Contains(description2))) + { + object obj4 = propertyInfo4.GetCustomAttributes(typeof(TipoAttribute), inherit: true).FirstOrDefault(); + string text3 = ""; + if (obj4 != null) + { + text3 = ((TipoAttribute)obj4).Description; + } + string newValue2 = "text-start"; + string newValue3; + switch (text3) + { + default: + newValue3 = ((propertyInfo4.GetValue(x) != null) ? $"{propertyInfo4.GetValue(x)}" : ""); + break; + case "PERCENTUAL": + newValue2 = "text-end"; + newValue3 = ((propertyInfo4.GetValue(x) != null) ? $"{(decimal)propertyInfo4.GetValue(x) * 0.01m:p2}" : ""); + break; + case "VALOR": + newValue2 = "text-end"; + newValue3 = ((propertyInfo4.GetValue(x) != null) ? $"{(decimal)propertyInfo4.GetValue(x):c2}" : ""); + break; + case "VALORDECIMAL2": + newValue2 = "text-end"; + newValue3 = ((propertyInfo4.GetValue(x) != null) ? $"{(decimal)propertyInfo4.GetValue(x):n2}" : ""); + break; + case "DATA": + newValue2 = "text-center"; + newValue3 = ((propertyInfo4.GetValue(x) == null || (DateTime)propertyInfo4.GetValue(x) == DateTime.MinValue) ? "" : $"{(DateTime)propertyInfo4.GetValue(x):d}"); + break; + case "QUANTIDADE": + newValue2 = "text-center"; + newValue3 = ((propertyInfo4.GetValue(x) != null) ? $"{propertyInfo4.GetValue(x)}" : ""); + break; + case "ENUM": + newValue3 = ((propertyInfo4.GetValue(x) != null) ? (ValidationHelper.GetDescription((Enum)propertyInfo4.GetValue(x)) ?? "") : ""); + break; + case "DATA/TIME?": + case "DATA/TIME": + newValue2 = "text-center"; + newValue3 = ((propertyInfo4.GetValue(x) != null) ? $"{(DateTime?)propertyInfo4.GetValue(x):G}" : ""); + break; + case "DATA?": + newValue2 = "text-center"; + newValue3 = ((propertyInfo4.GetValue(x) != null) ? $"{(DateTime?)propertyInfo4.GetValue(x):d}" : ""); + break; + case "VALOR?": + newValue2 = "text-end"; + newValue3 = ((propertyInfo4.GetValue(x) != null) ? $"{(decimal?)propertyInfo4.GetValue(x):c2}" : ""); + break; + } + stringBuilder4.Append(Resources.ColumnTemplate.Replace("{Align}", newValue2).Replace("{Size}", classSize).Replace("{FontWeight}", flag ? "fw-bold" : "") + .Replace("{Content}", newValue3)); + } + } + } + } + rowContent.Append(Resources.RowTemplate.Replace("{Content}", stringBuilder4.ToString()).Replace("{Color}", "style='" + text2 + "'")); + }); + StringBuilder stringBuilder3 = new StringBuilder(); + if (grafico) + { + rowContent.Append(""); + rowContent.Append("
"); + rowContent.Append("
*VALORES NEGATIVOS NÃO SÃO REPRESENTADOS NO GRÁFICO DE PIZZA.
"); + rowContent.Append(""); + } + stringBuilder3.Append(Resources.TableTemplate.Replace("{Head}", stringBuilder.ToString()).Replace("{Body}", rowContent.ToString()).Replace("{Footer}", (!string.IsNullOrEmpty(footer)) ? Resources.FooterTemplate.Replace("{Content}", $"{footer}") : "")); + return stringBuilder3.ToString(); + }); + } + + public static async Task GenerateMultipleTable(List> analiticos, List colunasOcultas, bool grafico = false, bool propertyName = false, string footer = "", ConfiguracaoImpressao config = null) + { + if (analiticos == null) + { + return ""; + } + if (analiticos.Count == 0) + { + return ""; + } + int num = 0; + if (config != null) + { + num = config.TamanhoFonte; + } + string classSize = ((num == 0) ? "" : $"fs-{num}'"); + return await Task.Run(delegate + { + StringBuilder stringBuilder = new StringBuilder(); + int num2 = 0; + foreach (List analitico in analiticos) + { + StringBuilder stringBuilder2 = new StringBuilder(); + StringBuilder stringBuilder3 = new StringBuilder(); + StringBuilder stringBuilder4 = new StringBuilder(); + int num3 = 0; + stringBuilder3.Append(Resources.HeaderTemplate.Replace("{Align}", "text-start").Replace("{Size}", "").Replace("{FontWeight}", "fw-bold") + .Replace("{Content}", analitico[0].NomeRelatorio)); + stringBuilder2.Append(Resources.RowTemplate.Replace("{Content}", stringBuilder3.ToString()).Replace("{Color}", "")); + analitico.ForEach(delegate(Listagem x) + { + //IL_0098: Unknown result type (might be due to invalid IL or missing references) + //IL_009b: Invalid comparison between Unknown and I4 + //IL_018c: Unknown result type (might be due to invalid IL or missing references) + PropertyInfo[] properties = ((object)x).GetType().GetProperties(); + PropertyInfo propertyInfo = properties.FirstOrDefault((PropertyInfo b) => b.Name == "Bold"); + bool flag = propertyInfo != null && (bool)propertyInfo.GetValue(x); + PropertyInfo propertyInfo2 = properties.FirstOrDefault((PropertyInfo b) => b.Name == "Sinal"); + Sinal result; + string text = ((propertyInfo2 != null && propertyInfo2.GetValue(x) != null && Enum.TryParse(propertyInfo2.GetValue(x).ToString(), ignoreCase: true, out result) && (int)result == 1) ? "color: red;" : "color: black;"); + if (!flag) + { + _ = ""; + } + else + { + _ = ""; + } + StringBuilder stringBuilder6 = new StringBuilder(); + PropertyInfo[] array = properties; + foreach (PropertyInfo propertyInfo3 in array) + { + if (!(propertyInfo3.Name == "ValidationEvent")) + { + object obj = propertyInfo3.GetCustomAttributes(typeof(DescriptionAttribute), inherit: true).FirstOrDefault(); + if (obj != null) + { + string description = ((DescriptionAttribute)obj).Description; + if ((!propertyName || !colunasOcultas.Contains(propertyInfo3.Name)) && (propertyName || !colunasOcultas.Contains(description))) + { + object obj2 = propertyInfo3.GetCustomAttributes(typeof(TipoAttribute), inherit: true).FirstOrDefault(); + string text2 = ""; + if (obj2 != null) + { + text2 = ((TipoAttribute)obj2).Description; + } + string newValue = "text-start"; + string newValue2; + switch (text2) + { + default: + newValue2 = ((propertyInfo3.GetValue(x) != null) ? $"{propertyInfo3.GetValue(x)}" : ""); + break; + case "PERCENTUAL": + newValue = "text-end"; + newValue2 = ((propertyInfo3.GetValue(x) != null) ? $"{(decimal)propertyInfo3.GetValue(x) * 0.01m:p2}" : ""); + break; + case "VALOR": + newValue = "text-end"; + newValue2 = ((propertyInfo3.GetValue(x) != null) ? $"{(decimal)propertyInfo3.GetValue(x):c2}" : ""); + break; + case "DATA": + newValue = "text-center"; + newValue2 = ((propertyInfo3.GetValue(x) == null || (DateTime)propertyInfo3.GetValue(x) == DateTime.MinValue) ? "" : $"{(DateTime)propertyInfo3.GetValue(x):d}"); + break; + case "QUANTIDADE": + newValue = "text-center"; + newValue2 = ((propertyInfo3.GetValue(x) != null) ? $"{propertyInfo3.GetValue(x)}" : ""); + break; + case "ENUM": + newValue2 = ((propertyInfo3.GetValue(x) != null) ? (ValidationHelper.GetDescription((Enum)propertyInfo3.GetValue(x)) ?? "") : ""); + break; + case "DATA/TIME?": + case "DATA/TIME": + newValue = "text-center"; + newValue2 = ((propertyInfo3.GetValue(x) != null) ? $"{(DateTime?)propertyInfo3.GetValue(x):G}" : ""); + break; + case "DATA?": + newValue = "text-center"; + newValue2 = ((propertyInfo3.GetValue(x) != null) ? $"{(DateTime?)propertyInfo3.GetValue(x):d}" : ""); + break; + case "VALOR?": + newValue = "text-end"; + newValue2 = ((propertyInfo3.GetValue(x) != null) ? $"{(decimal?)propertyInfo3.GetValue(x):c2}" : ""); + break; + } + stringBuilder6.Append(Resources.ColumnTemplate.Replace("{Align}", newValue).Replace("{Size}", classSize).Replace("{FontWeight}", flag ? "fw-bold" : "") + .Replace("{Content}", newValue2)); + } + } + } + } + }); + StringBuilder stringBuilder5 = new StringBuilder(); + if (grafico) + { + stringBuilder4.Append($"
"); + } + num2++; + stringBuilder5.Append(Resources.TableMultipleTemplate.Replace("{Head}", stringBuilder2.ToString()).Replace("{Body}", stringBuilder4.ToString()).Replace("{Footer}", (!string.IsNullOrEmpty(footer)) ? Resources.FooterTemplate.Replace("{Content}", $"{footer}") : "")); + stringBuilder.Append(stringBuilder5.ToString()); + } + return stringBuilder.ToString(); + }); + } + + public static async Task GerarXlsSintetico(XLWorkbook xlWorkbook, string nome, List sintetic) + { + return await Task.Run((Func)delegate + { + try + { + nome = nome.ValidaNomePlanilha(); + IXLWorksheet xlWorksheet = xlWorkbook.Worksheets.Add(nome); + int indexColumn = 1; + sintetic.ForEach(delegate(SinteticModel x) + { + xlWorksheet.Cell(1, indexColumn).Value = x.Hint; + xlWorksheet.Cell(2, indexColumn).Value = x.Value; + indexColumn++; + }); + ((IXLFontBase)((IXLRangeBase)xlWorksheet.Row(1)).Style.Font).Bold = true; + xlWorksheet.Columns().AdjustToContents(); + return xlWorkbook; + } + catch (Exception) + { + return (XLWorkbook)null; + } + }); + } + + public static async Task GenerateTable(List analitico, Relatorio relatorio, bool grafico = false, bool verificarColunas = true, string footer = "", ConfiguracaoImpressao config = null) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + int fontSize = 0; + List parametros; + if (config == null) + { + List list = ((!verificarColunas) ? null : (await new ConfuguracoesServico().BuscarParametros(relatorio))); + parametros = list; + if (parametros == null || parametros.Count == 0) + { + PropertyInfo[] properties = typeof(T).GetProperties(BindingFlags.Instance | BindingFlags.Public); + parametros = ((IEnumerable)properties).Select((Func)((PropertyInfo x) => new ParametrosRelatorio + { + Campo = x.Name, + Header = x.GetDescriptionAttribute(), + Tipo = x.GetTypeAttribute(), + Relatorio = relatorio, + Width = 0, + Ordem = 0 + })).ToList(); + } + } + else + { + parametros = config.Campos; + fontSize = config.TamanhoFonte; + } + string classSize = ((fontSize == 0) ? "" : $"fs-{fontSize}'"); + parametros = await GetRestricoesColunas(parametros); + if (analitico == null) + { + return ""; + } + if (analitico.Count == 0) + { + return ""; + } + return await Task.Run(delegate + { + StringBuilder stringBuilder = new StringBuilder(); + StringBuilder headerContent = new StringBuilder(); + StringBuilder rowContent = new StringBuilder(); + Type type = analitico[0].GetType(); + PropertyInfo[] properties2 = type.GetProperties(); + int columnsCount = 0; + ExtensionMethods.ForEach((IEnumerable)(from x in parametros + orderby x.Ordem, x.Header + select x), (Action)delegate(ParametrosRelatorio x) + { + if (!(x.Tipo == "INVALID")) + { + PropertyInfo propertyInfo4 = properties2.FirstOrDefault((PropertyInfo p) => p.Name == x.Campo); + if (!(propertyInfo4 == null)) + { + string descriptionAttribute = propertyInfo4.GetDescriptionAttribute(); + string newValue3 = "text-start"; + switch (x.Tipo) + { + case "PERCENTUAL": + case "VALOR": + newValue3 = "text-center"; + break; + case "QUANTIDADE": + case "DATA": + newValue3 = "text-end"; + break; + } + headerContent.Append(Resources.HeaderTemplate.Replace("{Align}", newValue3).Replace("{Size}", classSize).Replace("{FontWeight}", "fw-bold") + .Replace("{Content}", descriptionAttribute)); + columnsCount++; + } + } + }); + stringBuilder.Append(Resources.RowTemplate.Replace("{Content}", headerContent.ToString()).Replace("{Color}", "")); + analitico.ForEach(delegate(T a) + { + //IL_0101: Unknown result type (might be due to invalid IL or missing references) + //IL_0104: Invalid comparison between Unknown and I4 + StringBuilder content = new StringBuilder(); + type = a.GetType(); + properties2 = type.GetProperties(); + PropertyInfo propertyInfo = properties2.FirstOrDefault((PropertyInfo b) => b.Name == "Bold"); + bool bold = propertyInfo != null && (bool)propertyInfo.GetValue(a); + PropertyInfo propertyInfo2 = properties2.FirstOrDefault((PropertyInfo b) => b.Name == "Sinal"); + Sinal result; + string text = ((propertyInfo2 != null && propertyInfo2.GetValue(a) != null && Enum.TryParse(propertyInfo2.GetValue(a).ToString(), ignoreCase: true, out result) && (int)result == 1) ? "color: red;" : "color: black;"); + if (!bold) + { + _ = ""; + } + else + { + _ = ""; + } + ExtensionMethods.ForEach((IEnumerable)(from x in parametros + orderby x.Ordem, x.Header + select x), (Action)delegate(ParametrosRelatorio x) + { + if (!(x.Tipo == "INVALID")) + { + PropertyInfo propertyInfo3 = properties2.FirstOrDefault((PropertyInfo p) => p.Name == x.Campo); + if (!(propertyInfo3 == null)) + { + string newValue = "text-start"; + string newValue2; + switch (x.Tipo) + { + default: + newValue2 = ((propertyInfo3.GetValue(a) != null) ? $"{propertyInfo3.GetValue(a)}" : ""); + break; + case "PERCENTUAL": + newValue = "text-end"; + newValue2 = ((propertyInfo3.GetValue(a) != null) ? $"{(decimal)propertyInfo3.GetValue(a) * 0.01m:p2}" : ""); + break; + case "VALOR": + newValue = "text-end"; + newValue2 = ((propertyInfo3.GetValue(a) != null) ? $"{(decimal)propertyInfo3.GetValue(a):c2}" : ""); + break; + case "VALORDECIMAL2": + newValue = "text-end"; + newValue2 = ((propertyInfo3.GetValue(a) != null) ? $"{(decimal)propertyInfo3.GetValue(a):n2}" : ""); + break; + case "DATA": + newValue = "text-center"; + newValue2 = ((propertyInfo3.GetValue(a) == null || (DateTime)propertyInfo3.GetValue(a) == DateTime.MinValue) ? "" : $"{(DateTime)propertyInfo3.GetValue(a):d}"); + break; + case "QUANTIDADE": + newValue = "text-center"; + newValue2 = ((propertyInfo3.GetValue(a) != null) ? $"{propertyInfo3.GetValue(a)}" : ""); + break; + case "ENUM": + newValue2 = ((propertyInfo3.GetValue(a) != null && Convert.ToInt32(propertyInfo3.GetValue(a)) != 0) ? (ValidationHelper.GetDescription((Enum)propertyInfo3.GetValue(a)) ?? "") : ""); + break; + case "DATA/TIME?": + case "DATA/TIME": + newValue = "text-center"; + newValue2 = ((propertyInfo3.GetValue(a) != null) ? $"{(DateTime?)propertyInfo3.GetValue(a):G}" : ""); + break; + case "DATA?": + newValue = "text-center"; + newValue2 = ((propertyInfo3.GetValue(a) != null) ? $"{(DateTime?)propertyInfo3.GetValue(a):d}" : ""); + break; + case "VALOR?": + newValue = "text-end"; + newValue2 = ((propertyInfo3.GetValue(a) != null) ? $"{(decimal?)propertyInfo3.GetValue(a):c2}" : ""); + break; + } + content.Append(Resources.ColumnTemplate.Replace("{Align}", newValue).Replace("{Size}", classSize).Replace("{FontWeight}", bold ? "fw-bold" : "") + .Replace("{Content}", newValue2)); + } + } + }); + rowContent.Append(Resources.RowTemplate.Replace("{Content}", content.ToString()).Replace("{Color}", "style='" + text + "'")); + }); + StringBuilder stringBuilder2 = new StringBuilder(); + stringBuilder2.Append(Resources.TableTemplate.Replace("{Head}", stringBuilder.ToString()).Replace("{Body}", rowContent.ToString()).Replace("{Footer}", (!string.IsNullOrEmpty(footer)) ? Resources.FooterTemplate.Replace("{Content}", $"{footer}") : "")); + return stringBuilder2.ToString(); + }); + } + + public static async Task GerarXls(XLWorkbook xlWorkbook, string nome, List analitico, Relatorio relatorio, bool verificarColunas = true) + { + //IL_0026: Unknown result type (might be due to invalid IL or missing references) + //IL_0027: Unknown result type (might be due to invalid IL or missing references) + nome = nome.ValidaNomePlanilha(); + List list = ((!verificarColunas) ? null : (await new ConfuguracoesServico().BuscarParametros(relatorio))); + List parametros = list; + if (parametros == null || parametros.Count == 0) + { + PropertyInfo[] properties = typeof(T).GetProperties(BindingFlags.Instance | BindingFlags.Public); + parametros = ((IEnumerable)properties).Select((Func)((PropertyInfo x) => new ParametrosRelatorio + { + Campo = x.Name, + Header = x.GetDescriptionAttribute(), + Tipo = x.GetTypeAttribute(), + Relatorio = relatorio, + Width = 0, + Ordem = 0 + })).ToList(); + } + parametros = await GetRestricoesColunas(parametros); + return await Task.Run((Func)delegate + { + try + { + IXLWorksheet xlWorksheet = xlWorkbook.Worksheets.Add(nome); + Type type = analitico[0].GetType(); + PropertyInfo[] properties2 = type.GetProperties(); + int indexColumn = 1; + ExtensionMethods.ForEach((IEnumerable)(from x in parametros + orderby x.Ordem, x.Header + select x), (Action)delegate(ParametrosRelatorio x) + { + if (!(x.Tipo == "INVALID")) + { + PropertyInfo propertyInfo2 = properties2.FirstOrDefault((PropertyInfo p) => p.Name == x.Campo || (p.Name.ToUpper().Equals("NOME") && x.Campo.ToUpper().Equals("VENDEDOR") && nome.Equals("SINTÉTICO POR VENDEDOR") && (int)relatorio == 7) || (p.Name.ToUpper().Equals("NOME") && x.Campo.ToUpper().Equals("SEGURADORA") && nome.Equals("SINTÉTICO POR SEGURADORA") && (int)relatorio == 7) || (p.Name.ToUpper().Equals("NOME") && x.Campo.ToUpper().Equals("RAMO") && nome.Equals("SINTÉTICO POR RAMO") && (int)relatorio == 7)); + if (!(propertyInfo2 == null)) + { + xlWorksheet.Cell(1, indexColumn).Value = propertyInfo2.GetDescriptionAttribute(); + indexColumn++; + } + } + }); + int indexRow = 2; + analitico.ForEach(delegate(T a) + { + indexColumn = 1; + int row = indexRow; + ExtensionMethods.ForEach((IEnumerable)(from x in parametros + orderby x.Ordem, x.Header + select x), (Action)delegate(ParametrosRelatorio x) + { + if (!(x.Tipo == "INVALID")) + { + PropertyInfo propertyInfo = properties2.FirstOrDefault((PropertyInfo p) => p.Name == x.Campo || (p.Name.ToUpper().Equals("NOME") && x.Campo.ToUpper().Equals("VENDEDOR") && nome.Equals("SINTÉTICO POR VENDEDOR") && (int)relatorio == 7) || (p.Name.ToUpper().Equals("NOME") && x.Campo.ToUpper().Equals("SEGURADORA") && nome.Equals("SINTÉTICO POR SEGURADORA") && (int)relatorio == 7) || (p.Name.ToUpper().Equals("NOME") && x.Campo.ToUpper().Equals("RAMO") && nome.Equals("SINTÉTICO POR RAMO") && (int)relatorio == 7)); + if (!(propertyInfo == null)) + { + Regex regex = new Regex("\\<[^\\>]*\\>"); + object obj = propertyInfo.GetValue(a); + if (obj != null && obj.ToString().Contains(">") && obj.ToString().Contains("<")) + { + obj = regex.Replace(obj.ToString(), ""); + } + switch (x.Tipo) + { + default: + ((IXLNumberFormatBase)xlWorksheet.Cell(row, indexColumn).Style.NumberFormat).Format = "@"; + xlWorksheet.Cell(row, indexColumn).Value = $"{obj}"; + break; + case "DATA/TIME?": + case "DATA/TIME": + ((IXLNumberFormatBase)xlWorksheet.Cell(row, indexColumn).Style.NumberFormat).Format = "dd/MM/yyyy HH:mm:ss"; + xlWorksheet.Cell(row, indexColumn).Value = $"{obj}"; + break; + case "DATA?": + case "DATA": + ((IXLNumberFormatBase)xlWorksheet.Cell(row, indexColumn).Style.NumberFormat).Format = "dd/MM/yyyy"; + xlWorksheet.Cell(row, indexColumn).Value = $"{obj}"; + break; + case "VALOR": + xlWorksheet.Cell(row, indexColumn).Style.NumberFormat.SetNumberFormatId(2); + xlWorksheet.Cell(row, indexColumn).Value = ((decimal?)obj).GetValueOrDefault(); + break; + case "QUANTIDADE": + xlWorksheet.Cell(row, indexColumn).Style.NumberFormat.SetNumberFormatId(1); + xlWorksheet.Cell(row, indexColumn).Value = obj; + break; + case "PERCENTUAL": + xlWorksheet.Cell(row, indexColumn).Style.NumberFormat.SetNumberFormatId(10); + xlWorksheet.Cell(row, indexColumn).Value = ((decimal?)obj).GetValueOrDefault() * 0.01m; + break; + } + int num = indexColumn; + indexColumn = num + 1; + } + } + }); + indexRow++; + }); + ((IXLFontBase)((IXLRangeBase)xlWorksheet.Row(1)).Style.Font).Bold = true; + xlWorksheet.Columns().AdjustToContents(); + return xlWorkbook; + } + catch (Exception) + { + return (XLWorkbook)null; + } + }); + } + + public static async Task GerarXls(XLWorkbook xlWorkbook, string nome, List analitico, List colunasOcultas = null) + { + return await Task.Run((Func)delegate + { + try + { + nome = nome.ValidaNomePlanilha(); + IXLWorksheet xlWorksheet = xlWorkbook.Worksheets.Add(nome); + Type type = analitico[0].GetType(); + PropertyInfo[] properties = type.GetProperties(); + int indexColumn = 1; + PropertyInfo[] array = properties; + foreach (PropertyInfo propertyInfo in array) + { + if (!(propertyInfo.Name == "ValidationEvent")) + { + object obj = propertyInfo.GetCustomAttributes(typeof(DescriptionAttribute), inherit: true).FirstOrDefault(); + if (obj != null) + { + string description = ((DescriptionAttribute)obj).Description; + if (colunasOcultas == null || !colunasOcultas.Contains(description)) + { + xlWorksheet.Cell(1, indexColumn).Value = description; + indexColumn++; + } + } + } + } + int indexRow = 2; + analitico.ForEach(delegate(T x) + { + indexColumn = 1; + type = x.GetType(); + properties = type.GetProperties(); + PropertyInfo[] array2 = properties; + foreach (PropertyInfo propertyInfo2 in array2) + { + if (propertyInfo2.Name == "ValidationEvent") + { + continue; + } + object obj2 = propertyInfo2.GetCustomAttributes(typeof(DescriptionAttribute), inherit: true).FirstOrDefault(); + if (obj2 == null) + { + continue; + } + string description2 = ((DescriptionAttribute)obj2).Description; + if (colunasOcultas != null && colunasOcultas.Contains(description2)) + { + continue; + } + string name = propertyInfo2.Name; + if (!name.Contains("Fipe")) + { + switch (name) + { + case "NumeroProposta": + case "NumeroApolice": + case "NumeroPedidoEndosso": + break; + default: + goto IL_010f; + } + } + ((IXLNumberFormatBase)xlWorksheet.Cell(indexRow, indexColumn).Style.NumberFormat).Format = "@"; + goto IL_010f; + IL_010f: + xlWorksheet.Cell(indexRow, indexColumn).Value = propertyInfo2.GetValue(x); + indexColumn++; + } + indexRow++; + }); + ((IXLFontBase)((IXLRangeBase)xlWorksheet.Row(1)).Style.Font).Bold = true; + xlWorksheet.Columns().AdjustToContents(); + return xlWorkbook; + } + catch (Exception) + { + return (XLWorkbook)null; + } + }); + } + + public static bool IsWindowOpen(string title) where T : Window + { + return ((IEnumerable)Application.Current.Windows).OfType().Any((T x) => ((Window)x).Title == title); + } + + public static void Destroy() where T : Window + { + object obj = ((IEnumerable)Application.Current.Windows).OfType().FirstOrDefault(); + if (obj != null) + { + ((Window)obj).Close(); + } + } + + public static void Destroy(string title) where T : Window + { + object obj = ((IEnumerable)Application.Current.Windows).OfType().FirstOrDefault((T x) => ((Window)x).Title == title); + if (obj != null) + { + ((Window)obj).Close(); + } + } + + public static T GetValueFromType(this object objeto) + { + Type typeFromHandle = typeof(T); + PropertyInfo[] properties = objeto.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public); + foreach (PropertyInfo propertyInfo in properties) + { + if (!(propertyInfo.PropertyType != typeFromHandle)) + { + return (T)propertyInfo.GetValue(objeto); + } + } + return default(T); + } + + private static async Task> GetRestricoesColunas(List parametros) + { + List restricoes = await new RestricaoUsuarioServico().BuscarRestricoesCamposRelatorios(((DomainBase)Recursos.Usuario).Id); + restricoes = restricoes.Where((RestricaoUsuarioCamposRelatorios x) => x.Restricao).ToList(); + return parametros.Where((ParametrosRelatorio x) => restricoes.Where((RestricaoUsuarioCamposRelatorios y) => x.Relatorio == y.Relatorio).All((RestricaoUsuarioCamposRelatorios y) => x.Header != y.Campo)).ToList(); + } + + public static async Task ContruirLista(this DataGrid grid, Relatorio relatorio) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + List list = await new ConfuguracoesServico().BuscarParametros(relatorio); + if (list == null || list.Count == 0) + { + list = ((IEnumerable)typeof(T).GetProperties(BindingFlags.Instance | BindingFlags.Public)).Select((Func)((PropertyInfo x) => new ParametrosRelatorio + { + Campo = x.Name, + Header = x.GetDescriptionAttribute(), + Tipo = x.GetTypeAttribute(), + Relatorio = relatorio, + Width = 0, + Ordem = 0 + })).ToList(); + } + if (!Recursos.Usuario.Administrador) + { + list = await GetRestricoesColunas(list); + } + (from x in list + orderby x.Ordem, x.Header + select x).ToList().ForEach(delegate(ParametrosRelatorio x) + { + //IL_0077: Unknown result type (might be due to invalid IL or missing references) + //IL_007d: Expected O, but got Unknown + //IL_0091: Unknown result type (might be due to invalid IL or missing references) + //IL_0097: Expected O, but got Unknown + //IL_0335: Unknown result type (might be due to invalid IL or missing references) + //IL_033a: Unknown result type (might be due to invalid IL or missing references) + //IL_021a: Unknown result type (might be due to invalid IL or missing references) + //IL_0220: Expected O, but got Unknown + //IL_0234: Unknown result type (might be due to invalid IL or missing references) + //IL_023a: Expected O, but got Unknown + //IL_01db: Unknown result type (might be due to invalid IL or missing references) + //IL_01e1: Expected O, but got Unknown + //IL_01f5: Unknown result type (might be due to invalid IL or missing references) + //IL_01fb: Expected O, but got Unknown + //IL_0361: Unknown result type (might be due to invalid IL or missing references) + //IL_0362: Unknown result type (might be due to invalid IL or missing references) + //IL_0367: Unknown result type (might be due to invalid IL or missing references) + //IL_0373: Unknown result type (might be due to invalid IL or missing references) + //IL_037d: Expected O, but got Unknown + //IL_037d: Unknown result type (might be due to invalid IL or missing references) + //IL_0384: Unknown result type (might be due to invalid IL or missing references) + //IL_038b: Unknown result type (might be due to invalid IL or missing references) + //IL_0397: Expected O, but got Unknown + //IL_0397: Unknown result type (might be due to invalid IL or missing references) + //IL_02d4: Unknown result type (might be due to invalid IL or missing references) + //IL_02da: Expected O, but got Unknown + //IL_02ee: Unknown result type (might be due to invalid IL or missing references) + //IL_02f4: Expected O, but got Unknown + //IL_03b8: Unknown result type (might be due to invalid IL or missing references) + //IL_03a7: Unknown result type (might be due to invalid IL or missing references) + //IL_0298: Unknown result type (might be due to invalid IL or missing references) + //IL_029e: Expected O, but got Unknown + //IL_02b2: Unknown result type (might be due to invalid IL or missing references) + //IL_02b8: Expected O, but got Unknown + //IL_0259: Unknown result type (might be due to invalid IL or missing references) + //IL_025f: Expected O, but got Unknown + //IL_0273: Unknown result type (might be due to invalid IL or missing references) + //IL_0279: Expected O, but got Unknown + //IL_03c2: Unknown result type (might be due to invalid IL or missing references) + //IL_03c9: Unknown result type (might be due to invalid IL or missing references) + //IL_03d5: Expected O, but got Unknown + //IL_030a: Unknown result type (might be due to invalid IL or missing references) + //IL_0310: Expected O, but got Unknown + //IL_0324: Unknown result type (might be due to invalid IL or missing references) + //IL_032a: Expected O, but got Unknown + if (!(x.Tipo == "INVALID") && (!(x.Campo == "DataControle") || Recursos.Usuario.Administrador || !Recursos.Configuracoes.Any((ConfiguracaoSistema c) => (int)c.Configuracao == 33))) + { + string stringFormat = ""; + Style elementStyle = (Style)Application.Current.Resources[(object)"VerticalCenterStyle3"]; + Style headerStyle = (Style)Application.Current.Resources[(object)"MaterialDesignDataGridColumnHeaderNew"]; + switch (x.Tipo) + { + case "DATA/TIME?": + case "DATA/TIME": + stringFormat = "G"; + elementStyle = (Style)Application.Current.Resources[(object)"HorizontalCenterStyle2"]; + headerStyle = (Style)Application.Current.Resources[(object)"HorizontalCenterHeaderStyleNew"]; + break; + case "DATA?": + case "DATA": + stringFormat = "d"; + elementStyle = (Style)Application.Current.Resources[(object)"HorizontalCenterStyle2"]; + headerStyle = (Style)Application.Current.Resources[(object)"HorizontalCenterHeaderStyleNew"]; + break; + case "PERCENTUAL": + stringFormat = "{0:0.00}%"; + elementStyle = (Style)Application.Current.Resources[(object)"HorizontalRightStyle"]; + headerStyle = (Style)Application.Current.Resources[(object)"HorizontalRightHeaderStyleNew"]; + break; + case "VALOR": + stringFormat = "c"; + elementStyle = (Style)Application.Current.Resources[(object)"HorizontalRightStyle"]; + headerStyle = (Style)Application.Current.Resources[(object)"HorizontalRightHeaderStyleNew"]; + break; + case "VALORDECIMAL2": + stringFormat = "n2"; + elementStyle = (Style)Application.Current.Resources[(object)"HorizontalRightStyle"]; + headerStyle = (Style)Application.Current.Resources[(object)"HorizontalRightHeaderStyleNew"]; + break; + case "QUANTIDADE": + elementStyle = (Style)Application.Current.Resources[(object)"HorizontalCenterStyle2"]; + headerStyle = (Style)Application.Current.Resources[(object)"HorizontalCenterHeaderStyleNew"]; + break; + } + grid.Columns.Add((DataGridColumn)new MaterialDataGridTextColumn + { + Header = (x.Header?.ToUpper() ?? x.Campo.ToUpper()), + Binding = (BindingBase)new Binding + { + Path = new PropertyPath(x.Campo, Array.Empty()), + StringFormat = stringFormat, + Mode = (BindingMode)0, + UpdateSourceTrigger = (UpdateSourceTrigger)1 + }, + Width = (DataGridLength)((x.Width == 0) ? new DataGridLength(1.0, (DataGridLengthUnitType)0) : DataGridLength.op_Implicit((double)x.Width)), + ElementStyle = elementStyle, + HeaderStyle = headerStyle + }); + } + }); + } + + public static List ConstruirSintetico(this List sintetico, Relatorio relatorio) + { + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + if (sintetico == null) + { + return null; + } + List sintetics = new List(); + typeof(Sintetico).GetProperties(BindingFlags.Instance | BindingFlags.Public).ToList().ForEach(delegate(PropertyInfo props) + { + //IL_0744: Unknown result type (might be due to invalid IL or missing references) + //IL_0724: Unknown result type (might be due to invalid IL or missing references) + //IL_078d: Unknown result type (might be due to invalid IL or missing references) + //IL_0792: Unknown result type (might be due to invalid IL or missing references) + //IL_0799: Unknown result type (might be due to invalid IL or missing references) + //IL_07a9: Expected O, but got Unknown + if (props.GetValue(sintetico.First()) != null) + { + string descriptionAttribute = props.GetDescriptionAttribute(); + TipoRestricao? val = null; + switch (descriptionAttribute) + { + case "PRÊMIO TOTAL": + val = (TipoRestricao)65; + break; + case "TOTAL DE CLIENTES": + case "TOTAL DE CLIENTES ATIVOS": + case "TOTAL DE CLIENTES INATIVOS": + val = (TipoRestricao)66; + break; + case "PRÊMIO LÍQUIDO": + val = (TipoRestricao)67; + break; + case "MÉDIA DE COMISSÃO GERADA": + case "MÉDIA DE COMISSÃO PONDERADA": + case "MÉDIA DE COMISSÃO FECHADA": + val = (TipoRestricao)68; + break; + case "QUANTIDADE DE NOVOS NEGÓCIOS": + case "QUANTIDADE DE NEGÓCIOS PRÓPRIOS": + val = (TipoRestricao)69; + break; + case "QUANTIDADE DE RENOVAÇÕES": + case "QUANTIDADE DE SEGUROS NOVOS": + val = (TipoRestricao)70; + break; + case "QUANTIDADE DE CANCELAMENTOS": + val = (TipoRestricao)71; + break; + case "QUANTIDADE DE APÓLICES": + val = (TipoRestricao)72; + break; + case "QUANTIDADE DE ENDOSSOS": + val = (TipoRestricao)73; + break; + case "QUANTIDADE DE FATURAS": + val = (TipoRestricao)74; + break; + case "TOTAL GERAL": + val = (TipoRestricao)75; + break; + case "TOTAL DE LÍQUIDO": + val = (TipoRestricao)76; + break; + case "QUANTIDADE DE PROSPECÇÕES": + val = (TipoRestricao)77; + break; + case "TOTAL DE COMISSÃO GERADA": + val = (TipoRestricao)78; + break; + case "COMISSÃO RECEBIDA BRUTA": + val = (TipoRestricao)79; + break; + case "COMISSÃO RECEBIDA LÍQUIDA": + val = (TipoRestricao)92; + break; + case "IMPOSTOS": + val = (TipoRestricao)93; + break; + case "COMISSÃO PREVISTA": + val = (TipoRestricao)80; + break; + case "REPASSE": + val = (TipoRestricao)81; + break; + case "TOTAL PREVISTO": + val = (TipoRestricao)82; + break; + case "TOTAL DE TERCEIROS": + val = (TipoRestricao)83; + break; + case "QUANTIDADE LIQUIDADO": + val = (TipoRestricao)84; + break; + case "QUANTIDADE PENDENTE": + val = (TipoRestricao)85; + break; + case "VALOR LIQUIDADO": + val = (TipoRestricao)86; + break; + case "VALOR": + val = (TipoRestricao)100; + break; + case "VALOR ORÇADO": + val = (TipoRestricao)101; + break; + case "VALOR LIBERADO": + val = (TipoRestricao)103; + break; + case "VALOR PAGO": + val = (TipoRestricao)104; + break; + case "VALOR SALVADO": + val = (TipoRestricao)105; + break; + case "VALOR FRANQUIA": + val = (TipoRestricao)106; + break; + case "COMISSÃO PENDENTE": + val = (TipoRestricao)87; + break; + case "META ATINGIR": + val = (TipoRestricao)88; + break; + case "META CUMPRIDA": + val = (TipoRestricao)89; + break; + case "TOTAL PARCELAS": + val = (TipoRestricao)102; + break; + } + if (val.HasValue) + { + RestricaoUsuario val2 = new RestricaoUsuarioServico().BuscarRestricao(Recursos.Usuario, val.Value); + if (val2 != null && val2.Restricao) + { + return; + } + } + List list = new ConfuguracoesServico().BuscarParametroTotalizacao(relatorio); + if (list == null || list.Count <= 0 || !list.All((ParametrosTotalizacao y) => y.Campo != props.Name) || props.Name.ToUpperInvariant().Contains("AGRUPAMENTO")) + { + SinteticModelList sintetic = new SinteticModelList + { + Hint = descriptionAttribute, + Value = new List() + }; + string tipo = props.GetTypeAttribute(); + sintetico.ForEach(delegate(Sintetico s) + { + object item; + switch (tipo) + { + default: + item = $"{props.GetValue(s)}"; + break; + case "DATA/TIME": + case "DATA/TIME?": + item = ((DateTime?)props.GetValue(s))?.ToString("G"); + break; + case "DATA": + case "DATA?": + item = ((DateTime?)props.GetValue(s))?.ToString("d"); + break; + case "PERCENTUAL": + item = $"{props.GetValue(s):n2} %"; + break; + case "VALOR": + item = ((decimal)props.GetValue(s)).ToString("c2"); + break; + } + sintetic.Value.Add(item); + }); + sintetics.Add(sintetic); + } + } + }); + return sintetics; + } + + public static List ConstruirSintetico(this Sintetico sintetico, Relatorio relatorio) + { + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + if (sintetico == null) + { + return null; + } + List sintetics = new List(); + typeof(Sintetico).GetProperties(BindingFlags.Instance | BindingFlags.Public).ToList().ForEach(delegate(PropertyInfo x) + { + //IL_074d: Unknown result type (might be due to invalid IL or missing references) + //IL_072d: Unknown result type (might be due to invalid IL or missing references) + //IL_077d: Unknown result type (might be due to invalid IL or missing references) + //IL_0782: Unknown result type (might be due to invalid IL or missing references) + //IL_0789: Unknown result type (might be due to invalid IL or missing references) + //IL_0792: Expected O, but got Unknown + if (x.GetValue(sintetico) != null) + { + string descriptionAttribute = x.GetDescriptionAttribute(); + TipoRestricao? val = null; + string descriptionField = null; + switch (descriptionAttribute) + { + case "PRÊMIO TOTAL": + val = (TipoRestricao)65; + break; + case "TOTAL DE CLIENTES": + case "TOTAL DE CLIENTES ATIVOS": + case "TOTAL DE CLIENTES INATIVOS": + val = (TipoRestricao)66; + break; + case "PRÊMIO LÍQUIDO": + val = (TipoRestricao)67; + break; + case "MÉDIA DE COMISSÃO GERADA": + case "MÉDIA DE COMISSÃO PONDERADA": + case "MÉDIA DE COMISSÃO FECHADA": + val = (TipoRestricao)68; + break; + case "QUANTIDADE DE NOVOS NEGÓCIOS": + case "QUANTIDADE DE NEGÓCIOS PRÓPRIOS": + val = (TipoRestricao)69; + break; + case "QUANTIDADE DE RENOVAÇÕES": + case "QUANTIDADE DE SEGUROS NOVOS": + val = (TipoRestricao)70; + break; + case "QUANTIDADE DE CANCELAMENTOS": + val = (TipoRestricao)71; + break; + case "QUANTIDADE DE APÓLICES": + val = (TipoRestricao)72; + break; + case "QUANTIDADE DE ENDOSSOS": + val = (TipoRestricao)73; + break; + case "QUANTIDADE DE FATURAS": + val = (TipoRestricao)74; + break; + case "TOTAL GERAL": + val = (TipoRestricao)75; + descriptionField = "CONTAGEM GERAL DE DOCUMENTOS"; + break; + case "TOTAL DE LÍQUIDO": + val = (TipoRestricao)76; + descriptionField = "CONTAGEM GERAL DOS DOCUMENTOS ATIVOS"; + break; + case "QUANTIDADE DE PROSPECÇÕES": + val = (TipoRestricao)77; + break; + case "TOTAL DE COMISSÃO GERADA": + val = (TipoRestricao)78; + break; + case "COMISSÃO RECEBIDA BRUTA": + val = (TipoRestricao)79; + break; + case "COMISSÃO RECEBIDA LÍQUIDA": + val = (TipoRestricao)92; + break; + case "IMPOSTOS": + val = (TipoRestricao)93; + break; + case "COMISSÃO PREVISTA": + val = (TipoRestricao)80; + break; + case "REPASSE": + val = (TipoRestricao)81; + break; + case "TOTAL PREVISTO": + val = (TipoRestricao)82; + break; + case "TOTAL DE TERCEIROS": + val = (TipoRestricao)83; + break; + case "QUANTIDADE LIQUIDADO": + val = (TipoRestricao)84; + break; + case "QUANTIDADE PENDENTE": + val = (TipoRestricao)85; + break; + case "VALOR LIQUIDADO": + val = (TipoRestricao)86; + break; + case "VALOR": + val = (TipoRestricao)100; + break; + case "VALOR ORÇADO": + val = (TipoRestricao)101; + break; + case "VALOR LIBERADO": + val = (TipoRestricao)103; + break; + case "VALOR PAGO": + val = (TipoRestricao)104; + break; + case "VALOR SALVADO": + val = (TipoRestricao)105; + break; + case "VALOR FRANQUIA": + val = (TipoRestricao)106; + break; + case "COMISSÃO PENDENTE": + val = (TipoRestricao)87; + break; + case "META ATINGIR": + val = (TipoRestricao)88; + break; + case "META CUMPRIDA": + val = (TipoRestricao)89; + break; + case "TOTAL PARCELAS": + val = (TipoRestricao)102; + break; + } + if (val.HasValue) + { + RestricaoUsuario val2 = new RestricaoUsuarioServico().BuscarRestricao(Recursos.Usuario, val.Value); + if (val2 != null && val2.Restricao) + { + return; + } + } + List list = new ConfuguracoesServico().BuscarParametroTotalizacao(relatorio); + if (list == null || list.Count <= 0 || !list.All((ParametrosTotalizacao y) => y.Campo != x.Name)) + { + SinteticModel val3 = new SinteticModel + { + Hint = descriptionAttribute, + DescriptionField = descriptionField + }; + switch (x.GetTypeAttribute()) + { + default: + val3.Value = $"{x.GetValue(sintetico)}"; + break; + case "DATA/TIME?": + case "DATA/TIME": + val3.Value = ((DateTime?)x.GetValue(sintetico))?.ToString("G"); + break; + case "DATA?": + case "DATA": + val3.Value = ((DateTime?)x.GetValue(sintetico))?.ToString("d"); + break; + case "PERCENTUAL": + val3.Value = $"{x.GetValue(sintetico)} %"; + break; + case "VALOR": + val3.Value = ((decimal)x.GetValue(sintetico)).ToString("c2"); + break; + case "VALORDECIMAL2": + val3.Value = ((decimal)x.GetValue(sintetico)).ToString("n2"); + break; + } + sintetics.Add(val3); + } + } + }); + return sintetics; + } + + public static string GetTypeAttribute(this PropertyInfo pi) + { + //IL_0021: Unknown result type (might be due to invalid IL or missing references) + object obj = pi.GetCustomAttributes(typeof(TipoAttribute), inherit: true).FirstOrDefault(); + if (obj == null) + { + return ""; + } + return ((TipoAttribute)obj).Description; + } + + public static string GetDescriptionAttribute(this PropertyInfo pi) + { + object obj = pi.GetCustomAttributes(typeof(DescriptionAttribute), inherit: true).FirstOrDefault(); + if (obj == null) + { + return pi.Name.ToUpper(); + } + return ((DescriptionAttribute)obj).Description; + } + + public static List OcultarColunasDescricao(Type type, string categoria) + { + List list = new List(); + PropertyInfo[] properties = type.GetProperties(); + foreach (PropertyInfo propertyInfo in properties) + { + if (propertyInfo.Name == "ValidationEvent") + { + continue; + } + object obj = propertyInfo.GetCustomAttributes(typeof(CategoryAttribute), inherit: true).FirstOrDefault(); + if (obj != null && !(((CategoryAttribute)obj).Category == categoria)) + { + object obj2 = propertyInfo.GetCustomAttributes(typeof(DescriptionAttribute), inherit: true).FirstOrDefault(); + if (obj2 != null) + { + string description = ((DescriptionAttribute)obj2).Description; + list.Add(description); + } + } + } + return list; + } + + public static string SubstituirVariaveis(string corpo, MalaDireta envio) + { + //IL_0025: Unknown result type (might be due to invalid IL or missing references) + //IL_002d: Unknown result type (might be due to invalid IL or missing references) + //IL_0097: Expected I4, but got Unknown + //IL_009d: Unknown result type (might be due to invalid IL or missing references) + //IL_00c6: Unknown result type (might be due to invalid IL or missing references) + //IL_0108: Unknown result type (might be due to invalid IL or missing references) + //IL_012b: Unknown result type (might be due to invalid IL or missing references) + //IL_05ce: Unknown result type (might be due to invalid IL or missing references) + //IL_0655: Unknown result type (might be due to invalid IL or missing references) + //IL_068d: Unknown result type (might be due to invalid IL or missing references) + //IL_06c5: Unknown result type (might be due to invalid IL or missing references) + //IL_070e: Unknown result type (might be due to invalid IL or missing references) + //IL_078a: Unknown result type (might be due to invalid IL or missing references) + //IL_023a: Unknown result type (might be due to invalid IL or missing references) + //IL_0268: Unknown result type (might be due to invalid IL or missing references) + //IL_034c: Unknown result type (might be due to invalid IL or missing references) + //IL_0388: Unknown result type (might be due to invalid IL or missing references) + //IL_03d9: Unknown result type (might be due to invalid IL or missing references) + //IL_0415: Unknown result type (might be due to invalid IL or missing references) + //IL_0451: Unknown result type (might be due to invalid IL or missing references) + //IL_047f: Unknown result type (might be due to invalid IL or missing references) + //IL_04ad: Unknown result type (might be due to invalid IL or missing references) + //IL_018a: Unknown result type (might be due to invalid IL or missing references) + //IL_01e9: Unknown result type (might be due to invalid IL or missing references) + //IL_050d: Unknown result type (might be due to invalid IL or missing references) + //IL_05f0: Unknown result type (might be due to invalid IL or missing references) + //IL_06f2: Unknown result type (might be due to invalid IL or missing references) + //IL_02d0: Unknown result type (might be due to invalid IL or missing references) + //IL_0314: Unknown result type (might be due to invalid IL or missing references) + //IL_063b: Unknown result type (might be due to invalid IL or missing references) + //IL_0753: Unknown result type (might be due to invalid IL or missing references) + //IL_0759: Invalid comparison between Unknown and I4 + //IL_058f: Unknown result type (might be due to invalid IL or missing references) + //IL_07e6: Unknown result type (might be due to invalid IL or missing references) + //IL_07ec: Invalid comparison between Unknown and I4 + DateTime networkTime = GetNetworkTime(); + VariaveisMalaDireta[] array = (VariaveisMalaDireta[])Enum.GetValues(typeof(VariaveisMalaDireta)); + foreach (VariaveisMalaDireta val in array) + { + switch ((int)val) + { + case 0: + corpo = corpo.Replace(ValidationHelper.GetEntity((Enum)(object)val), networkTime.ToString(new CultureInfo("pt-BR"))); + break; + case 1: + corpo = corpo.Replace(ValidationHelper.GetEntity((Enum)(object)val), ValidationHelper.IsNotNullOrEmpty(envio.Cliente.NomeSocialRg) ? envio.Cliente.NomeSocialRg : envio.Cliente.Nome); + break; + case 2: + corpo = corpo.Replace(ValidationHelper.GetEntity((Enum)(object)val), envio.Cliente.Documento); + break; + case 16: + corpo = corpo.Replace(ValidationHelper.GetEntity((Enum)(object)val), envio.Cliente.VencimentoHabilitacao?.ToString("d")); + break; + case 14: + if (envio.Cliente.Nascimento.HasValue) + { + corpo = corpo.Replace(ValidationHelper.GetEntity((Enum)(object)val), envio.Cliente.Nascimento?.ToString("dd/MM")); + } + break; + case 15: + if (envio.Cliente.Nascimento.HasValue) + { + corpo = corpo.Replace(ValidationHelper.GetEntity((Enum)(object)val), envio.Cliente.Nascimento?.ToString("d")); + } + break; + case 3: + if (envio.Apolice != null) + { + corpo = corpo.Replace(ValidationHelper.GetEntity((Enum)(object)val), envio.Apolice.Proposta); + } + break; + case 4: + if (envio.Apolice != null) + { + corpo = corpo.Replace(ValidationHelper.GetEntity((Enum)(object)val), envio.Apolice.Apolice + ((envio.Apolice.Tipo != 0) ? (", endosso de número: " + envio.Apolice.Endosso) : "")); + } + break; + case 5: + { + Documento apolice9 = envio.Apolice; + if (((apolice9 != null) ? apolice9.Controle : null) != null) + { + corpo = corpo.Replace(ValidationHelper.GetEntity((Enum)(object)val), envio.Apolice.Controle.Ramo.Nome); + } + break; + } + case 6: + { + Documento apolice3 = envio.Apolice; + if (((apolice3 != null) ? apolice3.Controle : null) != null) + { + corpo = corpo.Replace(ValidationHelper.GetEntity((Enum)(object)val), envio.Apolice.Controle.Seguradora.Nome); + } + break; + } + case 7: + if (envio.Apolice != null) + { + corpo = corpo.Replace(ValidationHelper.GetEntity((Enum)(object)val), envio.Apolice.Vigencia1.ToString("d")); + } + break; + case 8: + if (envio.Apolice != null) + { + corpo = corpo.Replace(ValidationHelper.GetEntity((Enum)(object)val), envio.Apolice.Vigencia2?.ToString("d")); + } + break; + case 9: + if (envio.Parcela != null) + { + corpo = corpo.Replace(ValidationHelper.GetEntity((Enum)(object)val), envio.Parcela.Vencimento.ToString("d")); + } + break; + case 10: + if (envio.Parcela != null) + { + corpo = corpo.Replace(ValidationHelper.GetEntity((Enum)(object)val), envio.Parcela.Valor.ToString("c2")); + } + break; + case 11: + if (envio.Item != null) + { + corpo = corpo.Replace(ValidationHelper.GetEntity((Enum)(object)val), envio.Item.Descricao); + } + break; + case 12: + if (envio.Sinistro != null) + { + corpo = corpo.Replace(ValidationHelper.GetEntity((Enum)(object)val), envio.Sinistro.Numero); + } + break; + case 13: + if (envio.Parcela != null) + { + corpo = corpo.Replace(ValidationHelper.GetEntity((Enum)(object)val), envio.Parcela.NumeroParcela.ToString()); + } + break; + case 17: + { + if (envio.ArquivoDigital == null || envio.ArquivoDigital.All((IndiceArquivoDigital x) => string.IsNullOrWhiteSpace(x.UrlAssinatura))) + { + corpo = corpo.Replace(ValidationHelper.GetEntity((Enum)(object)val), string.Empty); + break; + } + string links = ""; + envio.ArquivoDigital.Where((IndiceArquivoDigital x) => !string.IsNullOrWhiteSpace(x.UrlAssinatura)).ToList().ForEach(delegate(IndiceArquivoDigital x) + { + links = links + ""; + }); + links += "
ABAIXO OS DOCUMENTOS PARA ASSINATURA
" + x.Descricao + "
"; + corpo = corpo.Replace(ValidationHelper.GetEntity((Enum)(object)val), links); + break; + } + case 18: + { + string newValue3 = $"ABAIXO O LINK PARA MEU CARTÃO DE VISITA.
CARTÃO DE VISITA ELETRÔNICO"; + corpo = corpo.Replace(ValidationHelper.GetEntity((Enum)(object)val), newValue3); + break; + } + case 19: + { + if (envio.Apolice == null) + { + corpo = corpo.Replace(ValidationHelper.GetEntity((Enum)(object)val), string.Empty); + break; + } + Uri assistance = Address.Assistance; + object arg; + if (envio == null) + { + arg = null; + } + else + { + Documento apolice7 = envio.Apolice; + arg = ((apolice7 != null) ? ((DomainBase)apolice7).Id.GeraAssistencia() : null); + } + string newValue2 = $"ABAIXO O LINK PARA O SEU CARTÃO ASSISTÊNCIA.
CARTÃO ASSISTÊNCIA"; + corpo = corpo.Replace(ValidationHelper.GetEntity((Enum)(object)val), newValue2); + break; + } + case 20: + { + string text3 = corpo; + string entity3 = ValidationHelper.GetEntity((Enum)(object)val); + Documento apolice4 = envio.Apolice; + corpo = text3.Replace(entity3, (apolice4 != null) ? apolice4.PremioLiquido.ToString("c") : null); + break; + } + case 21: + { + string text2 = corpo; + string entity2 = ValidationHelper.GetEntity((Enum)(object)val); + Documento apolice2 = envio.Apolice; + corpo = text2.Replace(entity2, (apolice2 != null) ? apolice2.PremioTotal.ToString("c") : null); + break; + } + case 22: + { + string text5 = corpo; + string entity5 = ValidationHelper.GetEntity((Enum)(object)val); + Documento apolice8 = envio.Apolice; + object newValue4; + if (apolice8 == null) + { + newValue4 = null; + } + else + { + FormaPagamento? formaPagamento = apolice8.FormaPagamento; + newValue4 = (formaPagamento.HasValue ? ValidationHelper.GetDescription((Enum)(object)formaPagamento.GetValueOrDefault()) : null); + } + corpo = text5.Replace(entity5, (string?)newValue4); + break; + } + case 23: + { + string text4 = corpo; + string entity4 = ValidationHelper.GetEntity((Enum)(object)val); + Documento apolice5 = envio.Apolice; + object newValue; + if (((apolice5 != null) ? new decimal?(apolice5.NumeroParcelas) : null).HasValue && (int)envio.Apolice.TipoRecebimento.GetValueOrDefault() != 2) + { + Documento apolice6 = envio.Apolice; + newValue = ((apolice6 != null) ? apolice6.NumeroParcelas.ToString() : null); + } + else + { + newValue = "Indefinido"; + } + corpo = text4.Replace(entity4, (string?)newValue); + break; + } + case 24: + { + string text = corpo; + string entity = ValidationHelper.GetEntity((Enum)(object)val); + Documento apolice = envio.Apolice; + corpo = text.Replace(entity, (!((apolice != null) ? new decimal?(apolice.NumeroParcelas) : null).HasValue || envio.Apolice.NumeroParcelas == 0m || (int)envio.Apolice.TipoRecebimento.GetValueOrDefault() == 2) ? "Verificar documento anexado" : (envio.Apolice.PremioTotal / envio.Apolice.NumeroParcelas).ToString()); + break; + } + } + } + return corpo; + } + + public static string GetText(string html) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + HtmlDocument val = new HtmlDocument(); + val.LoadHtml(html); + return NodeText(val.DocumentNode); + } + + private static string NodeText(HtmlNode node) + { + //IL_0056: Unknown result type (might be due to invalid IL or missing references) + //IL_005c: Invalid comparison between Unknown and I4 + //IL_0025: Unknown result type (might be due to invalid IL or missing references) + //IL_002b: Invalid comparison between Unknown and I4 + string text = ""; + if (node.HasChildNodes) + { + foreach (HtmlNode item in (IEnumerable)node.ChildNodes) + { + text += (((int)item.NodeType == 3) ? item.InnerText : NodeText(item)); + } + } + else if ((int)node.NodeType == 3) + { + text = node.InnerText; + } + return text; + } + + public static string AdicionarLog(string html) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + HtmlDocument val = new HtmlDocument(); + val.LoadHtml(html); + DateTime networkTime = GetNetworkTime(); + foreach (HtmlNode item in (IEnumerable)val.DocumentNode.ChildNodes) + { + if (!(item.Name != "body")) + { + item.InnerHtml = $"

{Recursos.Usuario.Nome} ID-{((DomainBase)Recursos.Usuario).Id} {networkTime:g}

{item.InnerHtml}
"; + return item.InnerHtml; + } + } + return ""; + } + + public static List PopularFiltroPersonalizado() + { + //IL_0062: Unknown result type (might be due to invalid IL or missing references) + //IL_0067: Unknown result type (might be due to invalid IL or missing references) + //IL_0073: Unknown result type (might be due to invalid IL or missing references) + //IL_0080: Expected O, but got Unknown + List list = new List(); + foreach (PropertyInfo item in from x in typeof(T).GetProperties(BindingFlags.Instance | BindingFlags.Public) + orderby ValidationHelper.DescriptionAttribute(x) + select x) + { + if (item.Name == "ValidationEvent") + { + continue; + } + FiltroPersonalizado val = new FiltroPersonalizado + { + Propriedade = item.Name, + Nome = item.GetDescriptionAttribute() + }; + if (!(item.GetTypeAttribute() == "INVALID")) + { + Type type = item.PropertyType; + if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>)) + { + type = type.GetGenericArguments()[0]; + } + val.Tipo = ((type.BaseType == typeof(Enum)) ? type.BaseType : type); + list.Add(val); + } + } + return list; + } + + public static List PopularFiltroFinanceiro() + { + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0021: Unknown result type (might be due to invalid IL or missing references) + //IL_0036: Expected O, but got Unknown + //IL_0037: Unknown result type (might be due to invalid IL or missing references) + //IL_003c: Unknown result type (might be due to invalid IL or missing references) + //IL_0047: Unknown result type (might be due to invalid IL or missing references) + //IL_0052: Unknown result type (might be due to invalid IL or missing references) + //IL_0067: Expected O, but got Unknown + //IL_0068: Unknown result type (might be due to invalid IL or missing references) + //IL_006d: Unknown result type (might be due to invalid IL or missing references) + //IL_0078: Unknown result type (might be due to invalid IL or missing references) + //IL_0083: Unknown result type (might be due to invalid IL or missing references) + //IL_0098: Expected O, but got Unknown + //IL_0099: Unknown result type (might be due to invalid IL or missing references) + //IL_009e: Unknown result type (might be due to invalid IL or missing references) + //IL_00a9: Unknown result type (might be due to invalid IL or missing references) + //IL_00b4: Unknown result type (might be due to invalid IL or missing references) + //IL_00c9: Expected O, but got Unknown + //IL_00ca: Unknown result type (might be due to invalid IL or missing references) + //IL_00cf: Unknown result type (might be due to invalid IL or missing references) + //IL_00da: Unknown result type (might be due to invalid IL or missing references) + //IL_00e5: Unknown result type (might be due to invalid IL or missing references) + //IL_00fa: Expected O, but got Unknown + //IL_00fb: Unknown result type (might be due to invalid IL or missing references) + //IL_0100: Unknown result type (might be due to invalid IL or missing references) + //IL_010b: Unknown result type (might be due to invalid IL or missing references) + //IL_0116: Unknown result type (might be due to invalid IL or missing references) + //IL_012b: Expected O, but got Unknown + //IL_012c: Unknown result type (might be due to invalid IL or missing references) + //IL_0131: Unknown result type (might be due to invalid IL or missing references) + //IL_013c: Unknown result type (might be due to invalid IL or missing references) + //IL_0147: Unknown result type (might be due to invalid IL or missing references) + //IL_015c: Expected O, but got Unknown + //IL_015d: Unknown result type (might be due to invalid IL or missing references) + //IL_0162: Unknown result type (might be due to invalid IL or missing references) + //IL_016d: Unknown result type (might be due to invalid IL or missing references) + //IL_0178: Unknown result type (might be due to invalid IL or missing references) + //IL_018d: Expected O, but got Unknown + //IL_018e: Unknown result type (might be due to invalid IL or missing references) + //IL_0193: Unknown result type (might be due to invalid IL or missing references) + //IL_019e: Unknown result type (might be due to invalid IL or missing references) + //IL_01a9: Unknown result type (might be due to invalid IL or missing references) + //IL_01be: Expected O, but got Unknown + //IL_01bf: Unknown result type (might be due to invalid IL or missing references) + //IL_01c4: Unknown result type (might be due to invalid IL or missing references) + //IL_01cf: Unknown result type (might be due to invalid IL or missing references) + //IL_01da: Unknown result type (might be due to invalid IL or missing references) + //IL_01ef: Expected O, but got Unknown + //IL_01f0: Unknown result type (might be due to invalid IL or missing references) + //IL_01f5: Unknown result type (might be due to invalid IL or missing references) + //IL_0200: Unknown result type (might be due to invalid IL or missing references) + //IL_020b: Unknown result type (might be due to invalid IL or missing references) + //IL_0220: Expected O, but got Unknown + //IL_0221: Unknown result type (might be due to invalid IL or missing references) + //IL_0226: Unknown result type (might be due to invalid IL or missing references) + //IL_0231: Unknown result type (might be due to invalid IL or missing references) + //IL_023c: Unknown result type (might be due to invalid IL or missing references) + //IL_0251: Expected O, but got Unknown + //IL_0252: Unknown result type (might be due to invalid IL or missing references) + //IL_0257: Unknown result type (might be due to invalid IL or missing references) + //IL_0262: Unknown result type (might be due to invalid IL or missing references) + //IL_026d: Unknown result type (might be due to invalid IL or missing references) + //IL_0282: Expected O, but got Unknown + //IL_0283: Unknown result type (might be due to invalid IL or missing references) + //IL_0288: Unknown result type (might be due to invalid IL or missing references) + //IL_0293: Unknown result type (might be due to invalid IL or missing references) + //IL_029e: Unknown result type (might be due to invalid IL or missing references) + //IL_02b3: Expected O, but got Unknown + //IL_02b4: Unknown result type (might be due to invalid IL or missing references) + //IL_02b9: Unknown result type (might be due to invalid IL or missing references) + //IL_02c4: Unknown result type (might be due to invalid IL or missing references) + //IL_02cf: Unknown result type (might be due to invalid IL or missing references) + //IL_02e4: Expected O, but got Unknown + //IL_02e5: Unknown result type (might be due to invalid IL or missing references) + //IL_02ea: Unknown result type (might be due to invalid IL or missing references) + //IL_02f5: Unknown result type (might be due to invalid IL or missing references) + //IL_0300: Unknown result type (might be due to invalid IL or missing references) + //IL_0315: Expected O, but got Unknown + //IL_0316: Unknown result type (might be due to invalid IL or missing references) + //IL_031b: Unknown result type (might be due to invalid IL or missing references) + //IL_0326: Unknown result type (might be due to invalid IL or missing references) + //IL_0331: Unknown result type (might be due to invalid IL or missing references) + //IL_0346: Expected O, but got Unknown + //IL_0347: Unknown result type (might be due to invalid IL or missing references) + //IL_034c: Unknown result type (might be due to invalid IL or missing references) + //IL_0357: Unknown result type (might be due to invalid IL or missing references) + //IL_0362: Unknown result type (might be due to invalid IL or missing references) + //IL_0377: Expected O, but got Unknown + //IL_0378: Unknown result type (might be due to invalid IL or missing references) + //IL_037d: Unknown result type (might be due to invalid IL or missing references) + //IL_0388: Unknown result type (might be due to invalid IL or missing references) + //IL_0393: Unknown result type (might be due to invalid IL or missing references) + //IL_03a8: Expected O, but got Unknown + //IL_03a9: Unknown result type (might be due to invalid IL or missing references) + //IL_03ae: Unknown result type (might be due to invalid IL or missing references) + //IL_03b9: Unknown result type (might be due to invalid IL or missing references) + //IL_03c4: Unknown result type (might be due to invalid IL or missing references) + //IL_03d9: Expected O, but got Unknown + return new List + { + new FiltroPersonalizado + { + Propriedade = "Id", + Nome = "ID", + Tipo = typeof(long) + }, + new FiltroPersonalizado + { + Propriedade = "Controle.Fornecedor.NomeSocial", + Nome = "FORNECEDOR", + Tipo = typeof(string) + }, + new FiltroPersonalizado + { + Propriedade = "Controle.Fornecedor.Ativo", + Nome = "FORNECEDOR ATIVO", + Tipo = typeof(string) + }, + new FiltroPersonalizado + { + Propriedade = "Historico", + Nome = "HISTÓRICO", + Tipo = typeof(string) + }, + new FiltroPersonalizado + { + Propriedade = "Parcela", + Nome = "PARCELA", + Tipo = typeof(int) + }, + new FiltroPersonalizado + { + Propriedade = "Documento", + Nome = "DOCUMENTO", + Tipo = typeof(string) + }, + new FiltroPersonalizado + { + Propriedade = "Competencia", + Nome = "COMPETÊNCIA", + Tipo = typeof(string) + }, + new FiltroPersonalizado + { + Propriedade = "Complemento", + Nome = "COMPLEMENTO", + Tipo = typeof(string) + }, + new FiltroPersonalizado + { + Propriedade = "Vencimento", + Nome = "VENCIMENTO", + Tipo = typeof(DateTime) + }, + new FiltroPersonalizado + { + Propriedade = "Valor", + Nome = "VALOR", + Tipo = typeof(decimal) + }, + new FiltroPersonalizado + { + Propriedade = "Baixa", + Nome = "DATA BAIXA", + Tipo = typeof(DateTime) + }, + new FiltroPersonalizado + { + Propriedade = "ValorPago", + Nome = "VALOR PAGO", + Tipo = typeof(decimal) + }, + new FiltroPersonalizado + { + Propriedade = "Pagamento", + Nome = "PAGAMENTO", + Tipo = typeof(DateTime) + }, + new FiltroPersonalizado + { + Propriedade = "Conta.Descricao", + Nome = "CONTA", + Tipo = typeof(string) + }, + new FiltroPersonalizado + { + Propriedade = "Controle.Plano.Descricao", + Nome = "PLANO DE CONTAS", + Tipo = typeof(string) + }, + new FiltroPersonalizado + { + Propriedade = "Controle.Centro.Descricao", + Nome = "CENTRO DE CUSTO", + Tipo = typeof(string) + }, + new FiltroPersonalizado + { + Propriedade = "Sinal", + Nome = "SINAL", + Tipo = typeof(Enum) + }, + new FiltroPersonalizado + { + Propriedade = "TipoPagamento", + Nome = "FORMA PAGAMENTO", + Tipo = typeof(Enum) + }, + new FiltroPersonalizado + { + Propriedade = "Observacao", + Nome = "OBSERVAÇÃO", + Tipo = typeof(string) + }, + new FiltroPersonalizado + { + Propriedade = "Controle.Plano.Nome", + Nome = "PLANO", + Tipo = typeof(string) + } + }; + } + + public static List ColunasRelatorio(Relatorio relatorio, List parametrosAdicionados) + { + //IL_00a3: Unknown result type (might be due to invalid IL or missing references) + //IL_00a8: Unknown result type (might be due to invalid IL or missing references) + //IL_00cd: Unknown result type (might be due to invalid IL or missing references) + //IL_00de: Unknown result type (might be due to invalid IL or missing references) + //IL_00ef: Unknown result type (might be due to invalid IL or missing references) + //IL_00ff: Unknown result type (might be due to invalid IL or missing references) + //IL_0100: Unknown result type (might be due to invalid IL or missing references) + //IL_0106: Unknown result type (might be due to invalid IL or missing references) + //IL_0117: Unknown result type (might be due to invalid IL or missing references) + //IL_011e: Unknown result type (might be due to invalid IL or missing references) + //IL_0143: Expected O, but got Unknown + List list = new List(); + foreach (PropertyInfo pi in from x in typeof(T).GetProperties(BindingFlags.Instance | BindingFlags.Public) + orderby x.GetDescriptionAttribute() + select x) + { + if (!(pi.Name == "ValidationEvent") && !(pi.GetTypeAttribute() == "INVALID") && !parametrosAdicionados.Any((ParametrosRelatorio x) => x.Campo == pi.Name)) + { + ParametrosRelatorio val = new ParametrosRelatorio(); + ParametrosRelatorio? obj = ((IEnumerable)parametrosAdicionados).FirstOrDefault((Func)((ParametrosRelatorio x) => x.IdUsuario != 0L && x.Campo == pi.Name)); + val.Id = ((obj != null) ? obj.Id : 0); + val.Campo = pi.Name; + val.Header = pi.GetDescriptionAttribute(); + val.IdUsuario = ((DomainBase)Recursos.Usuario).Id; + val.Relatorio = relatorio; + val.Tipo = pi.GetTypeAttribute(); + val.Width = 0; + ParametrosRelatorio? obj2 = ((IEnumerable)parametrosAdicionados).FirstOrDefault((Func)((ParametrosRelatorio x) => x.Campo == pi.Name)); + val.Ordem = ((obj2 != null) ? obj2.Ordem : 0); + ParametrosRelatorio item = val; + list.Add(item); + } + } + return list; + } + + public static List TotalizacoesRelatorio(Relatorio relatorio, List parametrosAdicionados) + { + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + //IL_0050: Expected I4, but got Unknown + //IL_0395: Unknown result type (might be due to invalid IL or missing references) + //IL_039a: Unknown result type (might be due to invalid IL or missing references) + //IL_03bf: Unknown result type (might be due to invalid IL or missing references) + //IL_03d0: Unknown result type (might be due to invalid IL or missing references) + //IL_03e1: Unknown result type (might be due to invalid IL or missing references) + //IL_03f1: Unknown result type (might be due to invalid IL or missing references) + //IL_03f2: Unknown result type (might be due to invalid IL or missing references) + //IL_03fa: Expected O, but got Unknown + List list = new List(); + List list2 = new List(); + switch (relatorio - 2) + { + case 0: + case 1: + list2.Add("PremioTotal"); + list2.Add("PremioLiquido"); + list2.Add("MediaComissao"); + list2.Add("ComissaoGerada"); + list2.Add("Cancelamentos"); + list2.Add("Novos"); + list2.Add("NegociosProprios"); + list2.Add("Renovacoes"); + list2.Add("SegurosNovos"); + list2.Add("Apolices"); + list2.Add("Endossos"); + list2.Add("Faturas"); + list2.Add("TotalGeral"); + list2.Add("MediaPonderada"); + break; + case 2: + list2.Add("Cancelamentos"); + list2.Add("Novos"); + list2.Add("Renovacoes"); + list2.Add("Apolices"); + list2.Add("Endossos"); + list2.Add("Faturas"); + list2.Add("TotalProspeccao"); + list2.Add("TotalGeral"); + list2.Add("PremioTotal"); + list2.Add("PremioLiquido"); + list2.Add("ComissaoGerada"); + break; + case 3: + list2.Add("ComissaoRecebidaBruta"); + list2.Add("ComissaoRecebidaLiquida"); + list2.Add("ComissaoPrevista"); + list2.Add("Repasse"); + list2.Add("Impostos"); + list2.Add("PremioTotal"); + list2.Add("PremioLiquido"); + break; + case 4: + case 14: + list2.Add("ComissaoPrevista"); + list2.Add("TotalPrevista"); + list2.Add("TotalGeral"); + list2.Add("TotalParcela"); + break; + case 7: + case 8: + list2.Add("Liquidado"); + list2.Add("ValorLiquidado"); + list2.Add("Pendente"); + list2.Add("TotalGeral"); + list2.Add("TotalClientes"); + list2.Add("TotalTerceiros"); + break; + case 6: + list2.Add("PremioTotal"); + list2.Add("PremioLiquido"); + list2.Add("ComissaoRecebidaBruta"); + list2.Add("MediaComissao"); + list2.Add("TotalPrevista"); + list2.Add("ComissaoGerada"); + list2.Add("Cancelamentos"); + list2.Add("Novos"); + list2.Add("Renovacoes"); + list2.Add("Apolices"); + list2.Add("Endossos"); + list2.Add("Faturas"); + list2.Add("TotalGeral"); + break; + } + foreach (PropertyInfo pi in from x in typeof(T).GetProperties(BindingFlags.Instance | BindingFlags.Public) + orderby x.GetDescriptionAttribute() + select x) + { + if (!(pi.Name == "ValidationEvent") && !(pi.GetTypeAttribute() == "INVALID") && list2.Contains(pi.Name) && !(pi.Name == "Agrupamento") && !parametrosAdicionados.Any((ParametrosTotalizacao x) => x.Campo == pi.Name)) + { + ParametrosTotalizacao val = new ParametrosTotalizacao(); + ParametrosTotalizacao? obj = ((IEnumerable)parametrosAdicionados).FirstOrDefault((Func)((ParametrosTotalizacao x) => x.IdUsuario != 0L && x.Campo == pi.Name)); + val.Id = ((obj != null) ? obj.Id : 0); + val.Campo = pi.Name; + val.Header = pi.GetDescriptionAttribute(); + val.IdUsuario = ((DomainBase)Recursos.Usuario).Id; + val.Relatorio = relatorio; + ParametrosTotalizacao item = val; + list.Add(item); + } + } + return list; + } + + public static async Task> OcultarColunas(Relatorio relatorio) + { + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + List filtros = new List(); + List list = await new ConfuguracoesServico().BuscarParametros(relatorio); + if (list == null || list.Count == 0) + { + return filtros; + } + list = await GetRestricoesColunas(list); + PropertyInfo[] properties = typeof(T).GetProperties(BindingFlags.Instance | BindingFlags.Public); + foreach (PropertyInfo pi in properties) + { + object obj = pi.GetCustomAttributes(typeof(TipoAttribute), inherit: true).FirstOrDefault(); + string text = ""; + if (obj != null) + { + text = ((TipoAttribute)obj).Description; + } + string descriptionAttribute = pi.GetDescriptionAttribute(); + if (text == "INVALID") + { + filtros.Add(descriptionAttribute); + } + if (!list.Any((ParametrosRelatorio x) => x.Campo == pi.Name) && !(pi.Name == "ValidationEvent")) + { + filtros.Add(descriptionAttribute); + } + } + return filtros; + } + + public static async Task ExcluirPagamento(VendedorParcela pagamento) + { + pagamento.DataPagamento = null; + ParcelaServico servico = new ParcelaServico + { + Sucesso = true + }; + await servico.Save(pagamento); + return servico.Sucesso; + } + + public static TipoTela? ConvertTela(string name) + { + //IL_0032: Unknown result type (might be due to invalid IL or missing references) + return ((IEnumerable)((TipoTela[])Enum.GetValues(typeof(TipoTela))).ToList()).FirstOrDefault((Func)((TipoTela x) => ValidationHelper.GetEntity((Enum)(object)x) == name)); + } + + public static string PlacaVencimento(string placa, Categoria? categoria) + { + //IL_007b: Unknown result type (might be due to invalid IL or missing references) + //IL_0081: Invalid comparison between Unknown and I4 + //IL_009a: Unknown result type (might be due to invalid IL or missing references) + //IL_00a0: Invalid comparison between Unknown and I4 + //IL_00b9: Unknown result type (might be due to invalid IL or missing references) + //IL_00bf: Invalid comparison between Unknown and I4 + //IL_00d8: Unknown result type (might be due to invalid IL or missing references) + //IL_00de: Invalid comparison between Unknown and I4 + //IL_00f7: Unknown result type (might be due to invalid IL or missing references) + //IL_00fd: Invalid comparison between Unknown and I4 + //IL_0116: Unknown result type (might be due to invalid IL or missing references) + //IL_011c: Invalid comparison between Unknown and I4 + //IL_0135: Unknown result type (might be due to invalid IL or missing references) + //IL_013b: Invalid comparison between Unknown and I4 + //IL_0154: Unknown result type (might be due to invalid IL or missing references) + //IL_015a: Invalid comparison between Unknown and I4 + //IL_0173: Unknown result type (might be due to invalid IL or missing references) + //IL_0179: Invalid comparison between Unknown and I4 + if (string.IsNullOrEmpty(placa)) + { + return ""; + } + switch (placa.Substring(placa.Length - 1, 1)) + { + case "1": + if (!categoria.HasValue || (int)categoria.GetValueOrDefault() != 4) + { + return "ABRIL"; + } + return "SETEMBRO"; + case "2": + if (!categoria.HasValue || (int)categoria.GetValueOrDefault() != 4) + { + return "MAIO"; + } + return "SETEMBRO"; + case "3": + if (!categoria.HasValue || (int)categoria.GetValueOrDefault() != 4) + { + return "JUNHO"; + } + return "OUTUBRO"; + case "4": + if (!categoria.HasValue || (int)categoria.GetValueOrDefault() != 4) + { + return "JULHO"; + } + return "OUTUBRO"; + case "5": + if (!categoria.HasValue || (int)categoria.GetValueOrDefault() != 4) + { + return "AGOSTO"; + } + return "OUTUBRO"; + case "6": + if (!categoria.HasValue || (int)categoria.GetValueOrDefault() != 4) + { + return "AGOSTO"; + } + return "NOVEMBRO"; + case "7": + if (!categoria.HasValue || (int)categoria.GetValueOrDefault() != 4) + { + return "SETEMBRO"; + } + return "NOVEMBRO"; + case "8": + if (!categoria.HasValue || (int)categoria.GetValueOrDefault() != 4) + { + return "OUTUBRO"; + } + return "NOVEMBRO"; + case "9": + if (!categoria.HasValue || (int)categoria.GetValueOrDefault() != 4) + { + return "NOVEMBRO"; + } + return "DEZEMBRO"; + case "0": + return "DEZEMBRO"; + default: + return ""; + } + } + + public static ParentescoVinculo? ParentescoInverso(ParentescoVinculo? parentesco) + { + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + //IL_0013: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + //IL_0076: Expected I4, but got Unknown + return parentesco switch + { + 0L => (ParentescoVinculo)1, + 1L => (ParentescoVinculo)0, + 3L => (ParentescoVinculo)4, + 4L => (ParentescoVinculo)3, + 5L => (ParentescoVinculo)6, + 6L => (ParentescoVinculo)5, + 7L => (ParentescoVinculo)8, + 8L => (ParentescoVinculo)7, + 10L => (ParentescoVinculo)11, + 11L => (ParentescoVinculo)10, + 13L => (ParentescoVinculo)14, + 14L => (ParentescoVinculo)13, + 19L => (ParentescoVinculo)20, + 20L => (ParentescoVinculo)19, + 22L => (ParentescoVinculo)21, + 21L => (ParentescoVinculo)22, + _ => parentesco, + }; + } + + public static string DiaDaSemana(this int? dia) + { + if (!dia.HasValue) + { + return ""; + } + return (DayOfWeek)dia.Value switch + { + DayOfWeek.Sunday => "DOMINGO", + DayOfWeek.Monday => "SEGUNDA-FEIRA", + DayOfWeek.Tuesday => "TERÇA-FEIRA", + DayOfWeek.Wednesday => "QUARTA-FEIRA", + DayOfWeek.Thursday => "QUINTA-FEIRA", + DayOfWeek.Friday => "SEXTA-FEIRA", + DayOfWeek.Saturday => "SABADO", + _ => "", + }; + } + + public static string GetBody(this string html) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + HtmlDocument val = new HtmlDocument(); + val.LoadHtml(html); + HtmlNode obj = val.DocumentNode.SelectSingleNode("//body"); + if (obj == null) + { + return null; + } + return obj.InnerHtml; + } + + public static string GerarGrafico(List sinteticoLista) + { + string rows = "['NOME', 'VALOR'], "; + sinteticoLista.ForEach(delegate(ValorSintetico x) + { + if (x.Indice != "TOTAL" && x.Valor > 0m) + { + rows = rows + "[`" + x.Indice + " " + x.Porcentagem + "`, " + x.Valor.ToString("F2", CultureInfo.InvariantCulture) + "], "; + } + }); + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.Append(""); + stringBuilder.Append(""); + return stringBuilder.ToString(); + } + + public static string GerarGraficoUnico(List> sinteticosListas) + { + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.Append(""); + stringBuilder.Append(""); + return stringBuilder.ToString(); + } + + [IteratorStateMachine(typeof(_003CDistinctBy_003Ed__55<, >))] + public static IEnumerable DistinctBy(this IEnumerable source, Func keySelector) + { + //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() + return new _003CDistinctBy_003Ed__55(-2) + { + _003C_003E3__source = source, + _003C_003E3__keySelector = keySelector + }; + } + + public static string Clear(this string stringToClean) + { + if (stringToClean != null) + { + return Regex.Replace(stringToClean, "[^\\d]", string.Empty); + } + return null; + } + + public static string RemoverAcentos(string text) + { + string source = text.Normalize(NormalizationForm.FormD); + StringBuilder stringBuilder = new StringBuilder(); + foreach (char item in from c in source + let unicodeCategory = CharUnicodeInfo.GetUnicodeCategory(c) + where unicodeCategory != UnicodeCategory.NonSpacingMark + select c) + { + stringBuilder.Append(item); + } + return stringBuilder.ToString().Normalize(NormalizationForm.FormC); + } + + public static Cor? GetCor(string text) + { + //IL_0031: Unknown result type (might be due to invalid IL or missing references) + if (text.Contains("outro")) + { + return (Cor)16; + } + if (Enum.TryParse(text, ignoreCase: true, out Cor _)) + { + return (Cor)Enum.Parse(typeof(Cor), text, ignoreCase: true); + } + return null; + } + + public static Correcao? GetCorrecao(string text) + { + if (text.Contains("mercado")) + { + return (Correcao)0; + } + if (text.Contains("determinado")) + { + return (Correcao)1; + } + return null; + } + + public static TabelaReferencia? GetTabelaReferencia(string text) + { + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + if (Enum.TryParse(text, ignoreCase: true, out TabelaReferencia _)) + { + return (TabelaReferencia)Enum.Parse(typeof(TabelaReferencia), text, ignoreCase: true); + } + return null; + } + + public static Categoria? GetCategoria(string text) + { + //IL_0094: Unknown result type (might be due to invalid IL or missing references) + if (text.Contains("caminhao") || text.Contains("caminhão")) + { + return (Categoria)4; + } + if (text.Contains("onibus") || text.Contains("ônibus")) + { + return (Categoria)6; + } + if (text.Contains("utilitario") || text.Contains("utilitário")) + { + return (Categoria)6; + } + if (text.Contains("moto")) + { + return (Categoria)9; + } + if (Enum.TryParse(text, ignoreCase: true, out Categoria _)) + { + return (Categoria)Enum.Parse(typeof(Categoria), text, ignoreCase: true); + } + return null; + } + + public static TipoCobertura? GetTipoCobertura(string text) + { + //IL_0086: Unknown result type (might be due to invalid IL or missing references) + if (text.Contains("incendio") || text.Contains("incêndio")) + { + return (TipoCobertura)2; + } + if (text.Contains("roubo") && text.Contains("furto")) + { + return (TipoCobertura)5; + } + if (text.Contains("terceiros")) + { + return (TipoCobertura)3; + } + if (text.Contains("compreensiva")) + { + return (TipoCobertura)1; + } + if (Enum.TryParse(text, ignoreCase: true, out TipoCobertura _)) + { + return (TipoCobertura)Enum.Parse(typeof(TipoCobertura), text, ignoreCase: true); + } + return null; + } + + public static Isencao? GetIsencao(string text) + { + if (text.Contains("sem")) + { + return (Isencao)0; + } + if (text.Contains("ipi") && text.Contains("icms")) + { + return (Isencao)3; + } + if (text.Contains("ipi")) + { + return (Isencao)2; + } + if (text.Contains("icms")) + { + return (Isencao)1; + } + return null; + } + + public static Combustivel? GetCombustivel(string text) + { + //IL_015d: Unknown result type (might be due to invalid IL or missing references) + if (text.Contains("flex")) + { + return (Combustivel)4; + } + if (text.Contains("gasolina") && (text.Contains("alcool") || text.Contains("álcool"))) + { + if (text.Contains("gnv")) + { + return (Combustivel)8; + } + if (text.Contains("eletrico") || text.Contains("elétrico")) + { + return (Combustivel)12; + } + return (Combustivel)4; + } + if (text.Contains("gasolina") && text.Contains("gnv")) + { + return (Combustivel)7; + } + if (text.Contains("gasolina") && (text.Contains("eletrico") || text.Contains("elétrico"))) + { + return (Combustivel)9; + } + if (text.Contains("eletrico") || text.Contains("elétrico")) + { + return (Combustivel)11; + } + if (text.Contains("alcool") || text.Contains("álcool")) + { + return (Combustivel)1; + } + if (text.Contains("hibrido") || text.Contains("híbrido")) + { + return (Combustivel)10; + } + if (text.Contains("outro")) + { + return (Combustivel)6; + } + if (Enum.TryParse(text, ignoreCase: true, out Combustivel _)) + { + return (Combustivel)Enum.Parse(typeof(Combustivel), text, ignoreCase: true); + } + return null; + } + + public static async Task GetFabricante(string text) + { + List list = await new BaseServico().BuscarFabricante(text); + return (list.Count < 1) ? null : list.First(); + } + + public static string ValidaNomePlanilha(this string nome, string agrupamento = "", int index = 0) + { + if (string.IsNullOrWhiteSpace(nome)) + { + nome = agrupamento; + } + nome = nome.Replace("/", "_").Replace(":", " ").Replace("*", " ") + .Replace("?", "") + .Trim(); + if (index > 0) + { + nome = $"{index} {nome}"; + } + if (nome.Length > 30) + { + nome = nome.Substring(0, 30); + } + return nome; + } + + public static bool IsEmpty(this string html) + { + int count = Regex.Matches(html, "").Count; + bool flag = true; + int startIndex = 0; + for (int i = 0; i < count; i++) + { + int num = html.IndexOf("", startIndex, StringComparison.Ordinal) + 6; + if (num == 5) + { + break; + } + int num2 = html.IndexOf("", startIndex, StringComparison.Ordinal); + startIndex = num2 + 7; + flag = string.IsNullOrWhiteSpace(html.Substring(num, num2 - num)); + if (!flag) + { + break; + } + } + return flag; + } + + public static Window IsHosterOpen(string name) + { + return (Window)(object)((IEnumerable)Application.Current.Windows).OfType().ToList().FirstOrDefault(delegate(HosterWindow x) + { + ContentControl? obj = Extentions.FindVisualChildren((DependencyObject)(object)x).FirstOrDefault(); + return ((obj != null) ? ((FrameworkElement)obj).Tag.ToString() : null) == name; + }); + } + + public static DateTime GetNetworkTime() + { + try + { + if (StartTime.HasValue) + { + return StartTime.Value.AddMilliseconds(Stopwatch.ElapsedMilliseconds); + } + byte[] array = new byte[48]; + array[0] = 27; + IPEndPoint remoteEP = new IPEndPoint(Dns.GetHostEntry("time.google.com").AddressList.First((IPAddress a) => a.AddressFamily == AddressFamily.InterNetwork), 123); + using (Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp)) + { + socket.Connect(remoteEP); + socket.ReceiveTimeout = 3000; + socket.Send(array); + socket.Receive(array); + socket.Close(); + } + ulong num = ((ulong)array[40] << 24) | ((ulong)array[41] << 16) | ((ulong)array[42] << 8) | array[43]; + ulong num2 = ((ulong)array[44] << 24) | ((ulong)array[45] << 16) | ((ulong)array[46] << 8) | array[47]; + ulong num3 = num * 1000 + num2 * 1000 / 4294967296L; + DateTime value = new DateTime(1900, 1, 1).AddMilliseconds((long)num3).ToLocalTime(); + StartTime = value; + Stopwatch = Stopwatch.StartNew(); + return StartTime.Value; + } + catch (Exception) + { + StartTime = DateTime.Now; + Stopwatch = Stopwatch.StartNew(); + return StartTime.Value; + } + } + + public static TipoPagamento ParseTransactionType(this OfxTransactionType type) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0042: Expected I4, but got Unknown + switch ((int)type) + { + default: + return (TipoPagamento)12; + case 0: + return (TipoPagamento)5; + case 1: + case 4: + return (TipoPagamento)7; + case 11: + return (TipoPagamento)15; + case 6: + case 13: + return (TipoPagamento)8; + case 7: + case 12: + return (TipoPagamento)10; + case 14: + return (TipoPagamento)6; + case 10: + return (TipoPagamento)4; + } + } + + public static string GeraCartaoVisita(this long id) + { + try + { + return HttpUtility.UrlEncode($"{DateTime.Now.Ticks}:{ApplicationHelper.IdFornecedor}:V:{id}".Base64Encode()); + } + catch + { + } + return ""; + } + + public static string GeraAssistencia(this long id) + { + try + { + return HttpUtility.UrlEncode($"{DateTime.Now.Ticks}:{ApplicationHelper.IdFornecedor}:A:{id}".Base64Encode()); + } + catch + { + } + return ""; + } + + public static long UnixTimeStamp() + { + return (long)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds; + } + + public static async Task CriarCartao(this Card card) + { + return await Connection.Post("Card", card); + } + + public static async Task AtualizarCartao(this Card card, string id) + { + return (await Connection.Put("Card/" + id, card) == null) ? id : null; + } + + public static async Task CriarAssistencia(this Assistance assistance) + { + return await Connection.Post("Assistance", assistance); + } + + public static async Task Criarlogo(this Logo logo) + { + return await Connection.Post("Card/Logo", logo); + } + + public static async Task Atualizarlogo(this Logo logo, string id) + { + return await Connection.Put("Card/Logo/" + id, logo); + } + + public static async Task CriarSeguradora(this AssistenciaCia cia) + { + return await Connection.Post("Assistance/Seguradora", cia); + } + + public static async Task AtualizarSeguradora(this AssistenciaCia cia, string id) + { + return await Connection.Put("Assistance/Seguradora/" + id, cia); + } + + public static async Task AtualizarAssistencia(this Assistance assistance, string id) + { + return (await Connection.Put("Assistance/" + id, assistance) == null) ? id : null; + } + + public static bool EnviarWhatsapp(this string numero, string anotacoes = null) + { + Uri uri = (string.IsNullOrEmpty(anotacoes) ? Recursos.WhatsAppLink.SetQuery("phone", numero) : Recursos.WhatsAppLink.AddQuery("phone", numero).SetQuery("text", anotacoes)); + try + { + Process.Start(new ProcessStartInfo(uri.AbsoluteUri)); + return true; + } + catch (Exception) + { + uri.AbsoluteUri.CopyToClipboard(); + return false; + } + } + + public static bool ProgramaEmExecucao(this string programName) + { + return Process.GetProcessesByName(programName).Length != 0; + } + + [DllImport("user32.dll")] + private static extern bool SetForegroundWindow(IntPtr hWnd); + + [DllImport("user32.dll")] + private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); + + public static void BringToFront(this string programName) + { + try + { + Process[] processesByName = Process.GetProcessesByName(programName); + if (processesByName.Length != 0) + { + IntPtr mainWindowHandle = processesByName[0].MainWindowHandle; + ShowWindow(mainWindowHandle, 5); + ShowWindow(mainWindowHandle, 9); + SetForegroundWindow(mainWindowHandle); + } + } + catch (Exception) + { + } + } + + public static List LogList(this List valores, bool restricaoComissao = false) + { + //IL_0030: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Unknown result type (might be due to invalid IL or missing references) + //IL_004b: Expected O, but got Unknown + List> tuples = new List>(); + valores.ForEach(delegate(ValorOriginal x) + { + if (!restricaoComissao || !x.Campo.ToUpper().Contains("COMISSÃO")) + { + tuples.Add(new Tuple(x.Descricao, string.IsNullOrEmpty(x.ValorAtual) ? "NÃO PREENCHIDO" : ((x.ValorAtual == "True") ? "SIM" : ((x.ValorAtual == "False") ? "NÃO" : x.ValorAtual)), "")); + } + }); + return new List + { + new TupleList + { + Tuples = new ObservableCollection>(tuples) + } + }; + } + + public static List LogList(this List valores, bool restricaoComissao = false) + { + //IL_0030: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Unknown result type (might be due to invalid IL or missing references) + //IL_004b: Expected O, but got Unknown + List> tuples = new List>(); + valores.ForEach(delegate(Diferenca x) + { + if (!restricaoComissao || !x.Campo.ToUpper().Contains("COMISSÃO")) + { + tuples.Add(new Tuple(x.Descricao, string.IsNullOrEmpty(x.ValorAtual) ? "NÃO PREENCHIDO" : ((x.ValorAtual == "True") ? "SIM" : ((x.ValorAtual == "False") ? "NÃO" : x.ValorAtual)), string.IsNullOrEmpty(x.ValorAnterior) ? "NÃO PREENCHIDO" : ((x.ValorAnterior == "True") ? "SIM" : ((x.ValorAnterior == "False") ? "NÃO" : x.ValorAnterior)))); + } + }); + return new List + { + new TupleList + { + Tuples = new ObservableCollection>(tuples) + } + }; + } + + public static void CopyToClipboard(this string text) + { + try + { + Clipboard.SetText(text); + } + catch (Exception) + { + } + } + + public static async Task GerarCsv(List Conteudo, IEnumerable colunasExportacao) + { + PropertyInfo[] source = (from p in typeof(T).GetProperties() + where colunasExportacao.Contains(p.Name) + select p).ToArray(); + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.AppendLine(string.Join(";", source.Select((PropertyInfo p) => p.Name))); + foreach (T item in Conteudo) + { + IEnumerable values = source.Select((PropertyInfo p) => p.GetValue(item, null)?.ToString() ?? string.Empty); + stringBuilder.AppendLine(string.Join(";", values)); + } + return stringBuilder.ToString(); + } + + public static UsoVeiculo? GetUsoveiculo(string text) + { + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + UsoVeiculo result; + return (UsoVeiculo)(Enum.TryParse(text, ignoreCase: true, out result) ? ((int)result) : 0); + } + + public static string BoolToString(this bool boolean) + { + if (!boolean) + { + return "0"; + } + return "1"; + } + + public static string ConvertGaragemTrabalhoEstudoCalculo(this GaragemTrabalhoEstudo garagemTrabalhoEstudo) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_001e: Expected I4, but got Unknown + switch ((int)garagemTrabalhoEstudo) + { + case 0: + return "0"; + case 1: + return "1"; + case 2: + return "2"; + case 4: + case 5: + return "3"; + default: + return string.Empty; + } + } + + public static string ConvertTipoSeguroCalculo(this TipoSeguro tipoSeguro) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + //IL_0004: Invalid comparison between Unknown and I4 + if (tipoSeguro - 1 <= 1) + { + return "1"; + } + return "0"; + } + + public static string ConvertTempoHabilitacaoCalculo(this DateTime tempoHabilitacao) + { + if (tempoHabilitacao == DateTime.MinValue) + { + return "0"; + } + int num = DateTime.Now.Year - tempoHabilitacao.Year; + if (num >= 11) + { + return "11"; + } + return num.ToString(); + } + + public static TempoHabilitacao ConvertTempoHabilitacao(int tempoHabilitacao = 0) + { + if (tempoHabilitacao != 1) + { + if (tempoHabilitacao != 2) + { + if (tempoHabilitacao != 3) + { + if (tempoHabilitacao != 4) + { + if (tempoHabilitacao != 5) + { + if (tempoHabilitacao != 6) + { + if (tempoHabilitacao != 7) + { + if (tempoHabilitacao != 8) + { + if (tempoHabilitacao != 9) + { + if (tempoHabilitacao != 10) + { + if (tempoHabilitacao < 11) + { + return (TempoHabilitacao)0; + } + return (TempoHabilitacao)10; + } + return (TempoHabilitacao)9; + } + return (TempoHabilitacao)8; + } + return (TempoHabilitacao)7; + } + return (TempoHabilitacao)6; + } + return (TempoHabilitacao)5; + } + return (TempoHabilitacao)4; + } + return (TempoHabilitacao)3; + } + return (TempoHabilitacao)2; + } + return (TempoHabilitacao)1; + } + return (TempoHabilitacao)0; + } +} diff --git a/Decompiler/Gestor.Application.Helpers/HttpHelper.cs b/Decompiler/Gestor.Application.Helpers/HttpHelper.cs new file mode 100644 index 0000000..d552c84 --- /dev/null +++ b/Decompiler/Gestor.Application.Helpers/HttpHelper.cs @@ -0,0 +1,83 @@ +using System; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.Linq; +using System.Net.Http; +using System.Text; +using System.Web; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace Gestor.Application.Helpers; + +public static class HttpHelper +{ + public static Uri AddQuery(this Uri uri, string name, T value) + { + UriBuilder uriBuilder = new UriBuilder(uri); + NameValueCollection nameValueCollection = HttpUtility.ParseQueryString(uri.Query); + nameValueCollection.Add(name, value?.ToString()); + uriBuilder.Query = nameValueCollection.ToString(); + return uriBuilder.Uri; + } + + public static Uri SetQuery(this Uri uri, string name, string value, bool escapeValue = true) + { + UriBuilder uriBuilder = new UriBuilder(uri); + Dictionary dictionary = uri.ParseQueryString(); + string value2 = (escapeValue ? Uri.EscapeDataString(value) : value); + if (dictionary.ContainsKey(name)) + { + dictionary.Remove(name); + } + dictionary.Add(name, value2); + List values = dictionary.Select((KeyValuePair x) => x.Key + "=" + x.Value).ToList(); + string query = string.Join("&", values); + uriBuilder.Query = query; + return uriBuilder.Uri; + } + + public static Dictionary ParseQueryString(this Uri uri) + { + int startIndex = uri.Query.IndexOf('?') + 1; + return (from o in uri.Query.Substring(startIndex).Split(new char[1] { '&' }) + select o.Split(new char[1] { '=' }) into items + where items.Length == 2 + select items).ToDictionary((string[] pair) => pair[0], (string[] pair) => pair[1]); + } + + public static Uri ToUri(this string uri) + { + Uri.TryCreate(uri, UriKind.Absolute, out Uri result); + return result; + } + + public static StringContent ToHttpContent(this T content, Encoding encoding = null, string mediaType = "application/json") + { + //IL_0011: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Expected O, but got Unknown + return new StringContent(JsonConvert.SerializeObject((object)content), Encoding.UTF8, mediaType); + } + + public static JObject ToJObject(this string jsonString) + { + try + { + return JObject.Parse(jsonString); + } + catch (Exception) + { + return null; + } + } + + public static JObject ToJObject(this HttpContent content) + { + return content.ReadAsStringAsync().Result.ToJObject(); + } + + public static string ToBase64BasicEncode(this string value) + { + return "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes(value)); + } +} diff --git a/Decompiler/Gestor.Application.Helpers/Instancia.cs b/Decompiler/Gestor.Application.Helpers/Instancia.cs new file mode 100644 index 0000000..b67323b --- /dev/null +++ b/Decompiler/Gestor.Application.Helpers/Instancia.cs @@ -0,0 +1,53 @@ +using System; +using System.IO; +using Gestor.Common.Helpers; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; + +namespace Gestor.Application.Helpers; + +public class Instancia +{ + public static string Conexao; + + public static App App { get; set; } + + public static UnitOfWork Commited => UnitOfWork(); + + public static UnitOfWork Read => UnitOfWork(withTransaction: false); + + private static UnitOfWork UnitOfWork(bool withTransaction = true) + { + //IL_0037: Unknown result type (might be due to invalid IL or missing references) + //IL_003d: Expected O, but got Unknown + DataBaseParameters.NovoGestor = true; + Conexao = Conexao ?? Connection.GetConnection(); + if (Conexao == null) + { + return App.ConnectionRetry().Result; + } + UnitOfWork val = new UnitOfWork(Conexao, withTransaction); + if (!((GenericUnitOfWork)val).HasSession) + { + return App.ConnectionRetry().Result; + } + return val; + } + + public static void ExcluirCfg() + { + File.Delete("Data_" + Connection.Catalog + ".cfg"); + File.Delete("File_" + Connection.Catalog + ".cfg"); + File.Delete("Sign_" + Connection.Catalog + ".cfg"); + } + + public static void DeleteCfg() + { + string text = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Data"); + string text2 = Connection.Catalog + ".cfg"; + if (File.Exists(text + text2)) + { + File.Delete(text + text2); + } + } +} diff --git a/Decompiler/Gestor.Application.Helpers/InstanciaAssinador.cs b/Decompiler/Gestor.Application.Helpers/InstanciaAssinador.cs new file mode 100644 index 0000000..4a48b08 --- /dev/null +++ b/Decompiler/Gestor.Application.Helpers/InstanciaAssinador.cs @@ -0,0 +1,22 @@ +using Assinador.Infrastructure.UnitOfWork.Logic; + +namespace Gestor.Application.Helpers; + +public class InstanciaAssinador +{ + public static string EnderecoConexao; + + public static App App { get; set; } + + public static UnitOfWork Commited => UnitOfWork(); + + public static UnitOfWork Read => UnitOfWork(withTransaction: false); + + private static UnitOfWork UnitOfWork(bool withTransaction = true) + { + //IL_001a: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Expected O, but got Unknown + EnderecoConexao = EnderecoConexao ?? Connection.GetConnection(); + return new UnitOfWork(EnderecoConexao, withTransaction); + } +} diff --git a/Decompiler/Gestor.Application.Helpers/LicenseHelper.cs b/Decompiler/Gestor.Application.Helpers/LicenseHelper.cs new file mode 100644 index 0000000..65b9dee --- /dev/null +++ b/Decompiler/Gestor.Application.Helpers/LicenseHelper.cs @@ -0,0 +1,455 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.NetworkInformation; +using System.Net.Sockets; +using System.Threading.Tasks; +using Agger.Registro; +using Gestor.Common.Helpers; +using Gestor.Common.Validation; +using Gestor.Model.API; +using Gestor.Model.Domain.Generic; +using Gestor.Model.License; +using Microsoft.Win32; +using Newtonsoft.Json; + +namespace Gestor.Application.Helpers; + +public class LicenseHelper +{ + public static int? DiasRestantes { get; set; } + + public static StatusLicenca Status { get; set; } = (StatusLicenca)1; + + + public static List Produtos { get; set; } + + public static Instalacao Instalacao { get; set; } + + public static DateTime DataAtual { get; private set; } + + private string _guid { get; set; } + + public async Task VerificarRegistro() + { + return await Task.Run(delegate + { + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_000b: Expected O, but got Unknown + RegistryHelper val = new RegistryHelper(ApplicationHelper.Subkey); + if (string.IsNullOrEmpty(val.Read("NS", true))) + { + return false; + } + string s = EncryptionHelper.Decrypt(val.Read("CUSTOMER", true)); + if (!long.TryParse(s, out var _)) + { + ApplicationHelper.IdFornecedor = long.Parse(Connection.Get("Configuration/Customer").Result); + val.Write("CUSTOMER", EncryptionHelper.Encrypt(ApplicationHelper.IdFornecedor.ToString()), true); + } + else + { + ApplicationHelper.IdFornecedor = long.Parse(s); + } + string text = Connection.Get("Installation/Time", autorizar: false).Result ?? Funcoes.GetNetworkTime().ToString("d"); + DataAtual = DateTime.Parse(text); + val.Write("CURRENTDATE", EncryptionHelper.Encrypt(text), true); + val.Write("DATE", text, true); + ApplicationHelper.Beta = Connection.Get>($"Configuration/Customer/{ApplicationHelper.IdFornecedor}").Result?.Any((object x) => x.ToString().Contains("\"Tipo\": 45")) ?? false; + Address.Beta = ApplicationHelper.Beta; + return true; + }); + } + + public async Task> VerificarAcesso() + { + return await Task.Run(delegate + { + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Expected O, but got Unknown + //IL_053f: Unknown result type (might be due to invalid IL or missing references) + //IL_0545: Invalid comparison between Unknown and I4 + //IL_0547: Unknown result type (might be due to invalid IL or missing references) + //IL_0555: Unknown result type (might be due to invalid IL or missing references) + //IL_02d4: Unknown result type (might be due to invalid IL or missing references) + //IL_035e: Unknown result type (might be due to invalid IL or missing references) + //IL_0363: Unknown result type (might be due to invalid IL or missing references) + //IL_036f: Expected O, but got Unknown + //IL_03b1: Unknown result type (might be due to invalid IL or missing references) + //IL_040b: Unknown result type (might be due to invalid IL or missing references) + //IL_03d7: Unknown result type (might be due to invalid IL or missing references) + //IL_03dc: Unknown result type (might be due to invalid IL or missing references) + //IL_03e3: Unknown result type (might be due to invalid IL or missing references) + //IL_03ef: Unknown result type (might be due to invalid IL or missing references) + //IL_03f7: Unknown result type (might be due to invalid IL or missing references) + //IL_03fe: Unknown result type (might be due to invalid IL or missing references) + //IL_040a: Expected O, but got Unknown + RegistryHelper val = new RegistryHelper(ApplicationHelper.Subkey); + DateTime now = Funcoes.GetNetworkTime(); + DateTime today = now.Date; + if (ApplicationHelper.Conectado) + { + List result = Connection.Get>($"Access/Customer/{ApplicationHelper.IdFornecedor}").Result; + List liberados = new List { 2L, 3L, 4L, 5L, 24L, 10024L }; + Produtos = (from x in result + group x by new { x.ProductId, x.Status }).Select(x => + { + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_0038: Unknown result type (might be due to invalid IL or missing references) + //IL_00b0: Unknown result type (might be due to invalid IL or missing references) + //IL_00cd: Unknown result type (might be due to invalid IL or missing references) + //IL_0102: Unknown result type (might be due to invalid IL or missing references) + //IL_0127: Expected O, but got Unknown + Licenca val2 = new Licenca + { + Produto = (Produto)x.Key.ProductId.GetValueOrDefault() + }; + AccessControl? obj2 = (from l in x.SelectMany((Access c) => c.Control) + orderby l.Expiration descending + select l).FirstOrDefault(); + val2.Liberacao = ((obj2 != null) ? obj2.Expiration : now.AddDays(-1.0)); + val2.AcessoLiberado = x.All(delegate(Access l) + { + if (!l.AgreementId.HasValue || !liberados.Contains(l.AgreementId.Value)) + { + AccessControl? obj3 = (from d in x.SelectMany((Access c) => c.Control) + orderby d.Expiration descending + select d).FirstOrDefault(); + if (obj3 == null) + { + return false; + } + return obj3.Expiration >= today; + } + return true; + }); + val2.Quantidade = (int)x.Sum((Access l) => l.Ammount.GetValueOrDefault()); + val2.Status = int.Parse(x.Key.Status ?? "1"); + return val2; + }).ToList(); + if (Produtos == null || Produtos.Count == 0 || Produtos.All((Licenca x) => x.Status == 3)) + { + val.Write("EXPIRATION", EncryptionHelper.Encrypt(now.AddDays(-1.0).ToString("d")), true); + val.Write("BLOCK", EncryptionHelper.Encrypt("TRUE"), true); + Status = (StatusLicenca)3; + return new Tuple(item1: false, ""); + } + Licenca? obj = ((IEnumerable)Produtos.OrderBy((Licenca x) => x.Liberacao)).FirstOrDefault((Func)((Licenca x) => !x.AcessoLiberado && x.Status == 1)); + DateTime dateTime = ((obj != null) ? obj.Liberacao : now); + DiasRestantes = (int)(dateTime - today).TotalDays; + val.Write("EXPIRATION", EncryptionHelper.Encrypt(dateTime.ToString("d")), true); + val.Write("BLOCK", (dateTime >= today) ? EncryptionHelper.Encrypt("FALSE") : EncryptionHelper.Encrypt("TRUE"), true); + bool flag = Produtos.Any((Licenca x) => (int)x.Produto == 1 && x.Status == 4); + val.Write("CONSULTA", EncryptionHelper.Encrypt(flag.ToString().ToUpper()), true); + if (flag) + { + Status = (StatusLicenca)2; + } + Status = (StatusLicenca)((dateTime < today) ? 1 : 0); + if (Produtos.Any((Licenca x) => (int)x.Produto == 1) && (int)Status == 0) + { + val.Write("P1", EncryptionHelper.Encrypt("1$P1#" + ApplicationHelper.NumeroSerial), true); + val.Write("P5", EncryptionHelper.Encrypt("1$P1#" + ApplicationHelper.NumeroSerial), true); + val.Write("M1", EncryptionHelper.Encrypt("TRUE"), true); + } + string text = JsonConvert.SerializeObject((object)Produtos.Where((Licenca x) => x.Status == 1), (Formatting)1, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }); + val.Write("PRODUTOS", EncryptionHelper.Encrypt(text), true); + if (Produtos.Find((Licenca p) => (int)p.Produto == 86) != null) + { + return new Tuple(item1: true, EnumHelper.GetDescription(Status)); + } + if (ValidationHelper.IsNotNullOrEmpty(AssinadorHelper.Key().Result)) + { + Produtos.Add(new Licenca + { + AcessoLiberado = true, + Liberacao = today, + Produto = (Produto)86, + Quantidade = 0, + Status = 1 + }); + } + return new Tuple(item1: true, EnumHelper.GetDescription(Status)); + } + if ((today - DataAtual).TotalDays > 2.0) + { + return new Tuple(item1: true, "DATA INVÁLIDA"); + } + DiasRestantes = (int)(DateTime.Parse(EncryptionHelper.Decrypt(val.Read("EXPIRATION", true))).AddDays(5.0) - DataAtual).TotalDays; + if (DiasRestantes < 1) + { + return new Tuple(item1: true, "SISTEMA BLOQUEADO"); + } + if (EncryptionHelper.Decrypt(val.Read("BLOCK", true)) == "TRUE") + { + return new Tuple(item1: true, "SISTEMA BLOQUEADO"); + } + if (EncryptionHelper.Decrypt(val.Read("CONSULTA", true)) == "TRUE") + { + Status = (StatusLicenca)2; + } + string text2 = EncryptionHelper.Decrypt(val.Read("PRODUTOS", true)); + if (string.IsNullOrEmpty(text2)) + { + Status = (StatusLicenca)3; + return new Tuple(item1: false, "SISTEMA CANCELADO"); + } + Produtos = JsonConvert.DeserializeObject>(text2); + Status = (StatusLicenca)(((int)Status == 2) ? ((int)Status) : 0); + return new Tuple(item1: true, EnumHelper.GetDescription(Status)); + }); + } + + public async Task VerificarMaquina() + { + return await Task.Run(delegate + { + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_000b: Expected O, but got Unknown + //IL_029d: Unknown result type (might be due to invalid IL or missing references) + //IL_02a2: Unknown result type (might be due to invalid IL or missing references) + //IL_02ad: Unknown result type (might be due to invalid IL or missing references) + //IL_02b8: Unknown result type (might be due to invalid IL or missing references) + //IL_02c0: Unknown result type (might be due to invalid IL or missing references) + //IL_02cb: Unknown result type (might be due to invalid IL or missing references) + //IL_02d6: Unknown result type (might be due to invalid IL or missing references) + //IL_02e6: Unknown result type (might be due to invalid IL or missing references) + //IL_02f6: Unknown result type (might be due to invalid IL or missing references) + //IL_0301: Unknown result type (might be due to invalid IL or missing references) + //IL_0346: Expected O, but got Unknown + RegistryHelper val = new RegistryHelper(ApplicationHelper.Subkey); + string macAddress = GetMacAddress(); + string value = val.Read("MACHINEID", false); + if (string.IsNullOrEmpty(value)) + { + value = GetMachineSerial(); + val.Write("MACHINEID", EncryptionHelper.Encrypt(macAddress + " " + value), false); + } + string[] array = EncryptionHelper.Decrypt(val.Read("MACHINEID", false)).Split(new char[1] { ' ' }); + string text = ((array.Length > 1) ? array[1] : array[0]); + if (ApplicationHelper.Conectado) + { + List result = Connection.Get>("Installation/Machine/" + text + "/GerenciadorList").Result; + if (!Guid.TryParse(text, out var _)) + { + text = GetMachineSerial(); + } + _guid = text; + Instalacao = result?.FirstOrDefault((Func)((Instalacao x) => x.IdFornecedor == ApplicationHelper.IdFornecedor)); + if (Instalacao != null && Instalacao.IdFornecedor != ApplicationHelper.IdFornecedor) + { + Instalacao = null; + } + if (Instalacao != null) + { + Instalacao.Gerenciador = text; + Instalacao.UsuarioId = ((DomainBase)Recursos.Usuario).Id; + Instalacao.UsuarioSistema = Recursos.Usuario.Nome; + Instalacao.Ip = Recursos.Host.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString(); + Instalacao.UltimoAcesso = DateTime.Now; + Instalacao.OSInfo = string.Format("P={0};V={1};x64={2};N={3}", (Environment.OSVersion.Platform == PlatformID.Win32NT) ? "W" : "O", Environment.OSVersion.Version, Environment.Is64BitOperatingSystem ? "1" : "0", GetFrameworkVersion()); + Instalacao = Connection.Put("Installation/Machine", Instalacao).Result; + val.Write("MACHINEID", EncryptionHelper.Encrypt(macAddress + " " + Instalacao.Gerenciador), false); + } + val.Write("ACCESS", (Instalacao != null || RegistrarMaquina().Result) ? EncryptionHelper.Encrypt("TRUE") : EncryptionHelper.Encrypt("FALSE"), false); + } + else if (EncryptionHelper.Decrypt(val.Read("ACCESS", false)) == "TRUE") + { + Instalacao = new Instalacao + { + IdFornecedor = ApplicationHelper.IdFornecedor, + Data = DataAtual, + Gerenciador = text, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + UsuarioId = ((DomainBase)Recursos.Usuario).Id, + UsuarioSistema = Recursos.Usuario.Nome, + UltimoAcesso = DateTime.Now, + Ip = Recursos.Host.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + } + return Produtos.Any((Licenca x) => (int)x.Produto == 1) && (Instalacao != null || RegistrarMaquina().Result); + }); + } + + public async Task Registrar(string chave) + { + return await Task.Run(delegate + { + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + //IL_0029: Expected O, but got Unknown + if (string.IsNullOrEmpty(chave)) + { + return "false"; + } + RegistryHelper helper = new RegistryHelper(""); + string[] array = EncryptionHelper.Decrypt(chave).Split(new char[1] { ' ' }); + if (array.Length < 2) + { + return "false"; + } + string text = helper.Verificar(array[0], EncryptionHelper.Encrypt(array[0])); + if (text != "false") + { + if (text == "root") + { + return "root"; + } + ApplicationHelper.NumeroSerial = array[0]; + ApplicationHelper.IdFornecedor = long.Parse(Connection.Get("Maintenance/Customer").Result); + Instancia.Conexao = null; + ApplicationHelper.Subkey = array[0]; + return "true"; + } + DateTime networkTime = Funcoes.GetNetworkTime(); + string text2 = Connection.Get("Installation/Time", autorizar: false, verificarConexao: true).Result ?? networkTime.ToString("d"); + if (!ApplicationHelper.Conectado) + { + return "false"; + } + DataAtual = DateTime.Parse($"{text2} {networkTime.Hour}:{networkTime.Minute}:{networkTime.Second}"); + DateTime dateTime = DateTime.Parse(array[1]); + if (Math.Abs((DataAtual - dateTime).TotalDays) > 1.0) + { + return "false"; + } + string text3 = EncryptionHelper.Decrypt(helper.Read("NS", true)); + string text4 = helper.Read("SERIALS", false); + if (string.IsNullOrWhiteSpace(text4) && !string.IsNullOrWhiteSpace(text3)) + { + helper.Write("SERIALS", EncryptionHelper.Encrypt(text3), false); + text4 = helper.Read("SERIALS", false); + } + List source = ((text4 != null) ? EncryptionHelper.Decrypt(text4).Split(new char[1] { ':' }).ToList() : new List()); + List seriais = new List(); + source.Distinct().ToList().ForEach(delegate(string x) + { + if (!(helper.Verificar(x, EncryptionHelper.Encrypt(x)) == "false")) + { + seriais.Add(x); + } + }); + seriais.Add(array[0]); + helper.Write("SERIALS", EncryptionHelper.Encrypt(string.Join(":", seriais.Distinct())), false); + helper.Serial = ((seriais.Count > 1) ? ("\\" + array[0]) : ""); + ApplicationHelper.Subkey = ((seriais.Count > 1) ? array[0] : ""); + ApplicationHelper.NumeroSerial = array[0]; + string result = Connection.Get("Customer/Name/" + array[0]).Result; + helper.Write("PERFIL", result, true); + helper.Write("CURRENTDATE", EncryptionHelper.Encrypt(text2), true); + helper.Write("DATE", text2, true); + helper.Write("NS", EncryptionHelper.Encrypt(array[0]), true); + helper.Write("INSTALL", EncryptionHelper.Encrypt(array[0]), true); + ApplicationHelper.IdFornecedor = long.Parse(Connection.Get("Maintenance/Customer").Result); + helper.Write("CUSTOMER", EncryptionHelper.Encrypt(ApplicationHelper.IdFornecedor.ToString()), true); + Instancia.Conexao = null; + return "true"; + }); + } + + public async Task> GetInstalacoes() + { + return await Connection.Get>($"Installation/Machine/{ApplicationHelper.IdFornecedor}"); + } + + private string GetMachineSerial() + { + if (string.IsNullOrEmpty(_guid)) + { + _guid = Guid.NewGuid().ToString(); + } + return _guid; + } + + public async Task RegistrarMaquina() + { + return await Task.Run(delegate + { + //IL_007e: Unknown result type (might be due to invalid IL or missing references) + //IL_0084: Expected O, but got Unknown + //IL_00ac: Unknown result type (might be due to invalid IL or missing references) + //IL_00b3: Expected O, but got Unknown + if (!ApplicationHelper.Conectado) + { + return false; + } + List result = GetInstalacoes().Result; + Licenca? obj = ((IEnumerable)Produtos).FirstOrDefault((Func)((Licenca x) => (int)x.Produto == 1)); + if (((obj != null) ? obj.Quantidade : 0) <= result.Count((Instalacao x) => x.Gerenciador != null)) + { + return false; + } + string text = ""; + RegistryHelper val = new RegistryHelper(""); + if (Instalacao == null) + { + string machineSerial = GetMachineSerial(); + text = EncryptionHelper.Encrypt(GetMacAddress() + " " + machineSerial); + Instalacao val2 = new Instalacao(); + val2.IdFornecedor = ApplicationHelper.IdFornecedor; + val2.Data = DataAtual; + val2.Gerenciador = machineSerial; + val2.NomeMaquina = Environment.MachineName; + val2.UsuarioMaquina = Environment.UserName; + val2.UsuarioId = ((DomainBase)Recursos.Usuario).Id; + val2.UsuarioSistema = Recursos.Usuario.Nome; + val2.UltimoAcesso = DateTime.Now; + val2.Ip = Recursos.Host.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString(); + val2.OSInfo = string.Format("P={0};V={1};x64={2};N={3}", (Environment.OSVersion.Platform == PlatformID.Win32NT) ? "W" : "O", Environment.OSVersion.Version, Environment.Is64BitOperatingSystem ? "1" : "0", GetFrameworkVersion()); + Instalacao = val2; + } + val.Write("MACHINEID", text, false); + Instalacao = Connection.Put("Installation/Machine", Instalacao).Result; + return true; + }); + } + + public string GetMacAddress() + { + IEnumerable values = from ni in NetworkInterface.GetAllNetworkInterfaces() + where ni.NetworkInterfaceType == NetworkInterfaceType.Ethernet || ni.NetworkInterfaceType == NetworkInterfaceType.Wireless80211 + orderby ni.Id descending + select ni into x + select x.GetPhysicalAddress().ToString(); + return string.Join("", values); + } + + public NetworkInterface FindMacAddress(string macToSearch) + { + string[] macList = macToSearch.Split(new char[1] { '|' }); + return NetworkInterface.GetAllNetworkInterfaces().FirstOrDefault((NetworkInterface ni) => macList.Contains(ni.GetPhysicalAddress().ToString())); + } + + public async Task> VerificarVersao() + { + return new Tuple(bool.Parse(await Connection.Get($"Installation/Version/{ApplicationHelper.IdFornecedor}")), "VERSÃO INDISPONÍVEL"); + } + + public async Task FindKey() + { + string text = EncryptionHelper.Decrypt(new RegistryHelper(ApplicationHelper.Subkey).ForceRead("MACHINEID", false)); + string text2 = (string.IsNullOrEmpty(text) ? (GetMacAddress() + GetMachineSerial()) : text); + return await Connection.Get("Installation/Serial/" + text2, autorizar: false); + } + + private string GetFrameworkVersion() + { + try + { + using RegistryKey registryKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32).OpenSubKey("SOFTWARE\\Microsoft\\NET Framework Setup\\NDP\\v4\\Full\\"); + if (registryKey != null && registryKey.GetValue("Version") != null) + { + return registryKey.GetValue("Version").ToString(); + } + } + catch + { + } + return "<4.5"; + } +} diff --git a/Decompiler/Gestor.Application.Helpers/MailHelper.cs b/Decompiler/Gestor.Application.Helpers/MailHelper.cs new file mode 100644 index 0000000..8a56cdc --- /dev/null +++ b/Decompiler/Gestor.Application.Helpers/MailHelper.cs @@ -0,0 +1,746 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.IO; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Net.Mail; +using System.Net.Mime; +using System.Net.Sockets; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading; +using System.Threading.Tasks; +using CsQuery.ExtensionMethods.Internal; +using Gestor.Application.ViewModels; +using Gestor.Common.Helpers; +using Gestor.Common.Validation; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.MalaDireta; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.Helper; +using Google.Apis.Auth.OAuth2; +using Google.Apis.Gmail.v1; +using Google.Apis.Gmail.v1.Data; +using Google.Apis.Http; +using Google.Apis.Requests; +using Google.Apis.Services; +using Google.Apis.Util.Store; +using Microsoft.Identity.Client; +using MimeKit; + +namespace Gestor.Application.Helpers; + +public class MailHelper +{ + public async Task SendAsync(Credencial credencial, Destinatario destinatario, FiltroArquivoDigital filtro = null, List maladireta = null, TipoTela tela = 0, bool confirmarLeitura = false) + { + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0031: Unknown result type (might be due to invalid IL or missing references) + IPHostEntry host = Dns.GetHostEntry(Dns.GetHostName()); + TipoTela telaEmail; + return await Task.Run((Func)delegate + { + //IL_0007: Unknown result type (might be due to invalid IL or missing references) + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_0018: Unknown result type (might be due to invalid IL or missing references) + //IL_0029: Expected O, but got Unknown + //IL_03ba: Unknown result type (might be due to invalid IL or missing references) + //IL_03c1: Expected O, but got Unknown + //IL_053e: Unknown result type (might be due to invalid IL or missing references) + //IL_0545: Invalid comparison between Unknown and I4 + //IL_0607: Unknown result type (might be due to invalid IL or missing references) + //IL_060c: Unknown result type (might be due to invalid IL or missing references) + //IL_060e: Unknown result type (might be due to invalid IL or missing references) + //IL_0611: Unknown result type (might be due to invalid IL or missing references) + //IL_064b: Expected I4, but got Unknown + //IL_0658: Unknown result type (might be due to invalid IL or missing references) + //IL_064f: Unknown result type (might be due to invalid IL or missing references) + //IL_0661: Unknown result type (might be due to invalid IL or missing references) + //IL_066a: Unknown result type (might be due to invalid IL or missing references) + //IL_0673: Unknown result type (might be due to invalid IL or missing references) + //IL_067d: Unknown result type (might be due to invalid IL or missing references) + //IL_0687: Unknown result type (might be due to invalid IL or missing references) + //IL_0691: Unknown result type (might be due to invalid IL or missing references) + //IL_069b: Unknown result type (might be due to invalid IL or missing references) + //IL_06a5: Unknown result type (might be due to invalid IL or missing references) + //IL_06af: Unknown result type (might be due to invalid IL or missing references) + //IL_06b9: Unknown result type (might be due to invalid IL or missing references) + //IL_06c3: Unknown result type (might be due to invalid IL or missing references) + //IL_0e32: Unknown result type (might be due to invalid IL or missing references) + //IL_0e37: Unknown result type (might be due to invalid IL or missing references) + //IL_0e43: Unknown result type (might be due to invalid IL or missing references) + //IL_0e4e: Unknown result type (might be due to invalid IL or missing references) + //IL_0e56: Unknown result type (might be due to invalid IL or missing references) + //IL_0e58: Unknown result type (might be due to invalid IL or missing references) + //IL_0e62: Unknown result type (might be due to invalid IL or missing references) + //IL_0e74: Unknown result type (might be due to invalid IL or missing references) + //IL_0e86: Unknown result type (might be due to invalid IL or missing references) + //IL_0e97: Unknown result type (might be due to invalid IL or missing references) + //IL_0ea8: Unknown result type (might be due to invalid IL or missing references) + //IL_0eba: Unknown result type (might be due to invalid IL or missing references) + //IL_0ec5: Unknown result type (might be due to invalid IL or missing references) + //IL_0ed0: Unknown result type (might be due to invalid IL or missing references) + //IL_0edb: Unknown result type (might be due to invalid IL or missing references) + //IL_06cc: Unknown result type (might be due to invalid IL or missing references) + //IL_0204: Unknown result type (might be due to invalid IL or missing references) + //IL_0209: Unknown result type (might be due to invalid IL or missing references) + //IL_020b: Unknown result type (might be due to invalid IL or missing references) + //IL_020e: Invalid comparison between Unknown and I4 + //IL_021d: Unknown result type (might be due to invalid IL or missing references) + //IL_0222: Unknown result type (might be due to invalid IL or missing references) + //IL_022d: Unknown result type (might be due to invalid IL or missing references) + //IL_025d: Expected O, but got Unknown + //IL_0263: Unknown result type (might be due to invalid IL or missing references) + //IL_0268: Unknown result type (might be due to invalid IL or missing references) + //IL_0285: Expected O, but got Unknown + //IL_0285: Unknown result type (might be due to invalid IL or missing references) + //IL_028a: Unknown result type (might be due to invalid IL or missing references) + //IL_0291: Unknown result type (might be due to invalid IL or missing references) + //IL_02a1: Expected O, but got Unknown + //IL_029c: Unknown result type (might be due to invalid IL or missing references) + //IL_0210: Unknown result type (might be due to invalid IL or missing references) + //IL_0213: Invalid comparison between Unknown and I4 + //IL_0828: Unknown result type (might be due to invalid IL or missing references) + //IL_082e: Invalid comparison between Unknown and I4 + //IL_06e8: Unknown result type (might be due to invalid IL or missing references) + //IL_06ed: Unknown result type (might be due to invalid IL or missing references) + //IL_06f9: Unknown result type (might be due to invalid IL or missing references) + //IL_070a: Unknown result type (might be due to invalid IL or missing references) + //IL_0715: Unknown result type (might be due to invalid IL or missing references) + //IL_071d: Unknown result type (might be due to invalid IL or missing references) + //IL_071f: Unknown result type (might be due to invalid IL or missing references) + //IL_0729: Unknown result type (might be due to invalid IL or missing references) + //IL_073b: Unknown result type (might be due to invalid IL or missing references) + //IL_074d: Unknown result type (might be due to invalid IL or missing references) + //IL_075e: Unknown result type (might be due to invalid IL or missing references) + //IL_076f: Unknown result type (might be due to invalid IL or missing references) + //IL_0781: Unknown result type (might be due to invalid IL or missing references) + //IL_078c: Unknown result type (might be due to invalid IL or missing references) + //IL_0797: Unknown result type (might be due to invalid IL or missing references) + //IL_07a2: Unknown result type (might be due to invalid IL or missing references) + //IL_02f8: Unknown result type (might be due to invalid IL or missing references) + //IL_02ff: Expected O, but got Unknown + //IL_030e: Unknown result type (might be due to invalid IL or missing references) + //IL_0313: Unknown result type (might be due to invalid IL or missing references) + //IL_031f: Expected O, but got Unknown + //IL_0f1e: Expected O, but got Unknown + //IL_0955: Unknown result type (might be due to invalid IL or missing references) + //IL_095b: Invalid comparison between Unknown and I4 + //IL_0833: Unknown result type (might be due to invalid IL or missing references) + //IL_0838: Unknown result type (might be due to invalid IL or missing references) + //IL_0844: Unknown result type (might be due to invalid IL or missing references) + //IL_084f: Unknown result type (might be due to invalid IL or missing references) + //IL_0861: Unknown result type (might be due to invalid IL or missing references) + //IL_0869: Unknown result type (might be due to invalid IL or missing references) + //IL_086c: Unknown result type (might be due to invalid IL or missing references) + //IL_0876: Unknown result type (might be due to invalid IL or missing references) + //IL_0888: Unknown result type (might be due to invalid IL or missing references) + //IL_089a: Unknown result type (might be due to invalid IL or missing references) + //IL_08ab: Unknown result type (might be due to invalid IL or missing references) + //IL_08bc: Unknown result type (might be due to invalid IL or missing references) + //IL_08ce: Unknown result type (might be due to invalid IL or missing references) + //IL_08d9: Unknown result type (might be due to invalid IL or missing references) + //IL_08e4: Unknown result type (might be due to invalid IL or missing references) + //IL_08ef: Unknown result type (might be due to invalid IL or missing references) + //IL_0a82: Unknown result type (might be due to invalid IL or missing references) + //IL_0a88: Invalid comparison between Unknown and I4 + //IL_0960: Unknown result type (might be due to invalid IL or missing references) + //IL_0965: Unknown result type (might be due to invalid IL or missing references) + //IL_0971: Unknown result type (might be due to invalid IL or missing references) + //IL_097c: Unknown result type (might be due to invalid IL or missing references) + //IL_098e: Unknown result type (might be due to invalid IL or missing references) + //IL_0996: Unknown result type (might be due to invalid IL or missing references) + //IL_0999: Unknown result type (might be due to invalid IL or missing references) + //IL_09a3: Unknown result type (might be due to invalid IL or missing references) + //IL_09b5: Unknown result type (might be due to invalid IL or missing references) + //IL_09c7: Unknown result type (might be due to invalid IL or missing references) + //IL_09d8: Unknown result type (might be due to invalid IL or missing references) + //IL_09e9: Unknown result type (might be due to invalid IL or missing references) + //IL_09fb: Unknown result type (might be due to invalid IL or missing references) + //IL_0a06: Unknown result type (might be due to invalid IL or missing references) + //IL_0a11: Unknown result type (might be due to invalid IL or missing references) + //IL_0a1c: Unknown result type (might be due to invalid IL or missing references) + //IL_0baf: Unknown result type (might be due to invalid IL or missing references) + //IL_0bb5: Invalid comparison between Unknown and I4 + //IL_0a8d: Unknown result type (might be due to invalid IL or missing references) + //IL_0a92: Unknown result type (might be due to invalid IL or missing references) + //IL_0a9e: Unknown result type (might be due to invalid IL or missing references) + //IL_0aa9: Unknown result type (might be due to invalid IL or missing references) + //IL_0abb: Unknown result type (might be due to invalid IL or missing references) + //IL_0ac3: Unknown result type (might be due to invalid IL or missing references) + //IL_0ac6: Unknown result type (might be due to invalid IL or missing references) + //IL_0ad0: Unknown result type (might be due to invalid IL or missing references) + //IL_0ae2: Unknown result type (might be due to invalid IL or missing references) + //IL_0af4: Unknown result type (might be due to invalid IL or missing references) + //IL_0b05: Unknown result type (might be due to invalid IL or missing references) + //IL_0b16: Unknown result type (might be due to invalid IL or missing references) + //IL_0b28: Unknown result type (might be due to invalid IL or missing references) + //IL_0b33: Unknown result type (might be due to invalid IL or missing references) + //IL_0b3e: Unknown result type (might be due to invalid IL or missing references) + //IL_0b49: Unknown result type (might be due to invalid IL or missing references) + //IL_07e5: Expected O, but got Unknown + //IL_0cdc: Unknown result type (might be due to invalid IL or missing references) + //IL_0bba: Unknown result type (might be due to invalid IL or missing references) + //IL_0bbf: Unknown result type (might be due to invalid IL or missing references) + //IL_0bcb: Unknown result type (might be due to invalid IL or missing references) + //IL_0bd6: Unknown result type (might be due to invalid IL or missing references) + //IL_0be8: Unknown result type (might be due to invalid IL or missing references) + //IL_0bf0: Unknown result type (might be due to invalid IL or missing references) + //IL_0bf3: Unknown result type (might be due to invalid IL or missing references) + //IL_0bfd: Unknown result type (might be due to invalid IL or missing references) + //IL_0c0f: Unknown result type (might be due to invalid IL or missing references) + //IL_0c21: Unknown result type (might be due to invalid IL or missing references) + //IL_0c32: Unknown result type (might be due to invalid IL or missing references) + //IL_0c43: Unknown result type (might be due to invalid IL or missing references) + //IL_0c55: Unknown result type (might be due to invalid IL or missing references) + //IL_0c60: Unknown result type (might be due to invalid IL or missing references) + //IL_0c6b: Unknown result type (might be due to invalid IL or missing references) + //IL_0c76: Unknown result type (might be due to invalid IL or missing references) + //IL_0930: Unknown result type (might be due to invalid IL or missing references) + //IL_0933: Unknown result type (might be due to invalid IL or missing references) + //IL_093f: Expected O, but got Unknown + //IL_0ce6: Unknown result type (might be due to invalid IL or missing references) + //IL_0ceb: Unknown result type (might be due to invalid IL or missing references) + //IL_0cf7: Unknown result type (might be due to invalid IL or missing references) + //IL_0d02: Unknown result type (might be due to invalid IL or missing references) + //IL_0a5d: Unknown result type (might be due to invalid IL or missing references) + //IL_0a60: Unknown result type (might be due to invalid IL or missing references) + //IL_0a6c: Expected O, but got Unknown + //IL_0b8a: Unknown result type (might be due to invalid IL or missing references) + //IL_0b8d: Unknown result type (might be due to invalid IL or missing references) + //IL_0b99: Expected O, but got Unknown + //IL_0d1c: Unknown result type (might be due to invalid IL or missing references) + //IL_0d24: Unknown result type (might be due to invalid IL or missing references) + //IL_0d2b: Unknown result type (might be due to invalid IL or missing references) + //IL_0d3d: Unknown result type (might be due to invalid IL or missing references) + //IL_0d4f: Unknown result type (might be due to invalid IL or missing references) + //IL_0d60: Unknown result type (might be due to invalid IL or missing references) + //IL_0d71: Unknown result type (might be due to invalid IL or missing references) + //IL_0d83: Unknown result type (might be due to invalid IL or missing references) + //IL_0d8e: Unknown result type (might be due to invalid IL or missing references) + //IL_0d99: Unknown result type (might be due to invalid IL or missing references) + //IL_0da4: Unknown result type (might be due to invalid IL or missing references) + //IL_0cb7: Unknown result type (might be due to invalid IL or missing references) + //IL_0cba: Unknown result type (might be due to invalid IL or missing references) + //IL_0cc6: Expected O, but got Unknown + //IL_0de5: Unknown result type (might be due to invalid IL or missing references) + //IL_0de8: Unknown result type (might be due to invalid IL or missing references) + //IL_0df4: Expected O, but got Unknown + LogEnvio log = new LogEnvio + { + Credencial = credencial, + Destinatario = destinatario + }; + AlternateView item = CreateAlternateView(destinatario.Corpo); + try + { + MailMessage message = new MailMessage + { + From = new MailAddress(credencial.Email, string.IsNullOrWhiteSpace(credencial.Header) ? Recursos.Empresa.Nome : credencial.Header), + BodyEncoding = Encoding.UTF8, + Subject = destinatario.Assunto, + AlternateViews = { item }, + ReplyToList = + { + new MailAddress(string.IsNullOrWhiteSpace(credencial.Replyto) ? credencial.Email : credencial.Replyto) + }, + DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure, + IsBodyHtml = true + }; + if (confirmarLeitura) + { + message.Headers.Add("Disposition-Notification-To", credencial.Email); + } + destinatario.Email.Split(new char[1] { ';' }).ToList().ForEach(delegate(string s) + { + if (ValidationHelper.ValidacaoEmail(s)) + { + message.To.Add(new MailAddress(s)); + } + }); + List listaCopia = new List(); + destinatario.EncaminharOculto?.ForEach(delegate(string x) + { + if (!string.IsNullOrEmpty(x)) + { + if (!x.Contains(";")) + { + if (ValidationHelper.ValidacaoEmail(x)) + { + listaCopia.Add(x); + } + } + else + { + x.Split(new char[1] { ';' }).ToList().ForEach(delegate(string s) + { + if (ValidationHelper.ValidacaoEmail(s)) + { + listaCopia.Add(s); + } + }); + } + } + }); + destinatario.Encaminhar?.ForEach(delegate(string x) + { + if (!string.IsNullOrEmpty(x)) + { + if (!x.Contains(";")) + { + if (ValidationHelper.ValidacaoEmail(x)) + { + listaCopia.Add(x); + } + } + else + { + x.Split(new char[1] { ';' }).ToList().ForEach(delegate(string s) + { + if (ValidationHelper.ValidacaoEmail(s)) + { + listaCopia.Add(s); + } + }); + } + } + }); + listaCopia.ForEach(delegate(string x) + { + message.Bcc.Add(new MailAddress(x)); + }); + destinatario.Anexos?.ForEach(delegate(ArquivoDigital x) + { + Attachment item2 = new Attachment(new MemoryStream(x.Arquivo), x.Descricao + ValidationHelper.GetDefaultExtension(x.Extensao)); + message.Attachments.Add(item2); + }); + if (credencial.Email.Contains("@gmail.com")) + { + credencial.Tipo = (TipoEmail)1; + } + TipoEmail tipo = credencial.Tipo; + if ((int)tipo != 1) + { + if ((int)tipo == 2) + { + StringContent val = new StringContent(""); + IPublicClientApplication val2 = ((AbstractApplicationBuilder)(object)PublicClientApplicationBuilder.Create("8d1c32fe-4c17-4d5b-a21b-55b5529c3e12").WithDefaultRedirectUri()).WithCacheOptions(new CacheOptions + { + UseSharedCache = true + }).Build(); + string[] array = new string[2] { "user.read", "https://graph.microsoft.com/Mail.Send" }; + AuthenticationResult val3; + try + { + val = ConverteMailMessageParaStringContent(message); + IEnumerable result = ((IClientApplicationBase)val2).GetAccountsAsync().Result; + val3 = ((result != null && result.Count() != 0) ? ((AbstractAcquireTokenParameterBuilder)(object)((IClientApplicationBase)val2).AcquireTokenSilent((IEnumerable)array, result?.FirstOrDefault())).ExecuteAsync().Result : ((AbstractAcquireTokenParameterBuilder)(object)val2.AcquireTokenInteractive((IEnumerable)array)).ExecuteAsync().Result); + } + catch + { + val3 = ((AbstractAcquireTokenParameterBuilder)(object)val2.AcquireTokenInteractive((IEnumerable)array)).ExecuteAsync().Result; + } + HttpClient val4 = new HttpClient(); + try + { + ((HttpHeaders)val4.DefaultRequestHeaders).Clear(); + ((HttpHeaders)val4.DefaultRequestHeaders).Add("Authorization", "Bearer " + ((val3 != null) ? val3.AccessToken : null)); + HttpResponseMessage result2 = val4.PostAsync("https://graph.microsoft.com/v1.0/me/sendMail", (HttpContent)(object)val).Result; + log.Enviado = result2.IsSuccessStatusCode; + } + finally + { + ((IDisposable)val4)?.Dispose(); + } + } + else + { + string password = EncryptionHelper.Decrypt(credencial.Senha); + NetworkCredential credentials = new NetworkCredential + { + Password = password, + UserName = (credencial.Usuario ?? credencial.Email) + }; + SmtpClient smtpClient = new SmtpClient(); + smtpClient.EnableSsl = credencial.Seguro; + smtpClient.Host = credencial.Dominio; + smtpClient.Port = credencial.Porta.GetValueOrDefault(587); + smtpClient.UseDefaultCredentials = false; + smtpClient.Credentials = credentials; + smtpClient.SendCompleted += delegate(object sender, AsyncCompletedEventArgs args) + { + log.Enviado = !args.Cancelled || args.Error != null; + if (args.Error != null) + { + log.Erro = args.Error.ToString(); + } + }; + smtpClient.Send(message); + log.Enviado = true; + } + } + else + { + UserCredential result3 = GoogleWebAuthorizationBroker.AuthorizeAsync(new ClientSecrets + { + ClientId = "378618252089-fm92uqgnk2jivf25mk2tv9s735n4nf6u.apps.googleusercontent.com", + ClientSecret = "kUiTfSuwZLLfteqwX7x6glsu" + }, (IEnumerable)new string[1] { Scope.GmailSend }, credencial.Email, CancellationToken.None, (IDataStore)null, (ICodeReceiver)null).Result; + Message val5 = new Message + { + Raw = Encode(((object)MimeMessage.CreateFromMailMessage(message)).ToString()) + }; + SendRequest obj2 = new GmailService(new Initializer + { + HttpClientInitializer = (IConfigurableHttpClientInitializer)(object)result3, + ApplicationName = "AGGER GESTOR" + }).Users.Messages.Send(val5, credencial.Email); + log.Enviado = false; + if (((ClientServiceRequest)(object)obj2).Execute().LabelIds.Contains("SENT")) + { + log.Enviado = true; + } + } + } + catch (Exception ex) + { + log.Enviado = false; + string erro = ((ex.InnerException == null) ? ex.Message : (ex.Message + " | " + ex.InnerException.Message)); + log.Erro = erro; + } + if ((int)tela == 40) + { + return log; + } + UnitOfWork commited = Instancia.Commited; + try + { + List list = new List { destinatario.Email }; + if (destinatario.Encaminhar != null) + { + list.AddRange(destinatario.Encaminhar); + } + List list2 = new List(); + if (destinatario.EncaminharOculto != null) + { + list2.AddRange(destinatario.EncaminharOculto); + } + List list3 = destinatario.Anexos?.Select((ArquivoDigital x) => x.Descricao + ValidationHelper.GetDefaultExtension(x.Extensao)).ToList(); + DateTime networkTime = Funcoes.GetNetworkTime(); + if (filtro != null) + { + TipoArquivoDigital tipo2 = filtro.Tipo; + switch (tipo2 - 1) + { + case 1: + telaEmail = (TipoTela)2; + break; + case 0: + telaEmail = (TipoTela)1; + break; + case 2: + telaEmail = (TipoTela)5; + break; + case 3: + telaEmail = (TipoTela)3; + break; + case 4: + telaEmail = (TipoTela)7; + break; + case 5: + telaEmail = (TipoTela)15; + break; + case 6: + telaEmail = (TipoTela)23; + break; + case 7: + telaEmail = (TipoTela)13; + break; + case 8: + telaEmail = (TipoTela)25; + break; + case 9: + telaEmail = (TipoTela)24; + break; + case 10: + telaEmail = (TipoTela)33; + break; + case 11: + telaEmail = (TipoTela)16; + break; + case 12: + telaEmail = (TipoTela)18; + break; + default: + telaEmail = (TipoTela)0; + break; + } + if (list3 != null && log.Enviado) + { + LogEmail val6 = new LogEmail + { + Credencial = credencial, + EntityId = filtro.Id, + Usuario = Recursos.Usuario, + Data = networkTime, + Tela = telaEmail, + Destinatarios = string.Join(";", list), + Cco = string.Join(";", list2), + Assunto = destinatario.Assunto, + Corpo = destinatario.Corpo, + Anexos = string.Join(";", list3), + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = host.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + commited.RegistroLogRepository.SaveOrUpdate(val6); + } + ((GenericUnitOfWork)commited).Commit(); + } + else if (maladireta != null) + { + foreach (MalaDireta maladiretum in maladireta) + { + if ((int)maladiretum.Tela == 1) + { + LogEmail val7 = new LogEmail + { + Credencial = credencial, + Usuario = Recursos.Usuario, + EntityId = ((DomainBase)maladiretum.Cliente).Id, + Data = networkTime, + Tela = maladiretum.Tela, + Destinatarios = string.Join(";", list), + Cco = string.Join(";", list2), + Assunto = destinatario.Assunto, + Corpo = destinatario.Corpo, + Anexos = string.Join(";", list3), + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = host.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString(), + Relatorio = maladiretum.Relatorio + }; + commited.RegistroLogRepository.SaveOrUpdate(val7); + } + else if ((int)maladiretum.Tela == 2) + { + LogEmail val8 = new LogEmail + { + Credencial = credencial, + Usuario = Recursos.Usuario, + EntityId = ((DomainBase)maladiretum.Apolice).Id, + Data = networkTime, + Tela = maladiretum.Tela, + Destinatarios = string.Join(";", list), + Cco = string.Join(";", list2), + Assunto = destinatario.Assunto, + Corpo = destinatario.Corpo, + Anexos = string.Join(";", list3), + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = host.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString(), + Relatorio = maladiretum.Relatorio + }; + commited.RegistroLogRepository.SaveOrUpdate(val8); + } + else if ((int)maladiretum.Tela == 5) + { + LogEmail val9 = new LogEmail + { + Credencial = credencial, + Usuario = Recursos.Usuario, + EntityId = ((DomainBase)maladiretum.Parcela).Id, + Data = networkTime, + Tela = maladiretum.Tela, + Destinatarios = string.Join(";", list), + Cco = string.Join(";", list2), + Assunto = destinatario.Assunto, + Corpo = destinatario.Corpo, + Anexos = string.Join(";", list3), + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = host.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString(), + Relatorio = maladiretum.Relatorio + }; + commited.RegistroLogRepository.SaveOrUpdate(val9); + } + else if ((int)maladiretum.Tela == 7) + { + LogEmail val10 = new LogEmail + { + Credencial = credencial, + Usuario = Recursos.Usuario, + EntityId = ((DomainBase)maladiretum.Sinistro).Id, + Data = networkTime, + Tela = maladiretum.Tela, + Destinatarios = string.Join(";", list), + Cco = string.Join(";", list2), + Assunto = destinatario.Assunto, + Corpo = destinatario.Corpo, + Anexos = string.Join(";", list3), + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = host.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString(), + Relatorio = maladiretum.Relatorio + }; + commited.RegistroLogRepository.SaveOrUpdate(val10); + } + else if ((int)maladiretum.Tela == 0) + { + LogEmail val11 = new LogEmail + { + Credencial = credencial, + Usuario = Recursos.Usuario + }; + Documento apolice = maladiretum.Apolice; + val11.EntityId = ((apolice != null) ? ((DomainBase)apolice).Id : 0); + val11.Data = networkTime; + val11.Tela = (TipoTela)2; + val11.Destinatarios = string.Join(";", list); + val11.Cco = string.Join(";", list2); + val11.Assunto = destinatario.Assunto; + val11.Corpo = destinatario.Corpo; + val11.Anexos = string.Join(";", list3); + val11.Versao = LoginViewModel.VersaoAtual; + val11.NomeMaquina = Environment.MachineName; + val11.UsuarioMaquina = Environment.UserName; + val11.Ip = host.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString(); + val11.Relatorio = maladiretum.Relatorio; + LogEmail val12 = val11; + commited.RegistroLogRepository.SaveOrUpdate(val12); + } + } + ((GenericUnitOfWork)commited).Commit(); + } + else + { + if (list3 != null) + { + LogEmail val13 = new LogEmail + { + Credencial = credencial, + Usuario = Recursos.Usuario, + Data = networkTime, + Tela = tela, + Destinatarios = string.Join(";", list), + Cco = string.Join(";", list2), + Assunto = destinatario.Assunto, + Corpo = destinatario.Corpo, + Anexos = string.Join(";", list3), + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = host.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + commited.RegistroLogRepository.SaveOrUpdate(val13); + } + ((GenericUnitOfWork)commited).Commit(); + } + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + return log; + }); + } + + private static StringContent ConverteMailMessageParaStringContent(MailMessage message) + { + //IL_004f: Unknown result type (might be due to invalid IL or missing references) + //IL_0056: Expected O, but got Unknown + MimeMessage val = (MimeMessage)message; + using MemoryStream memoryStream = new MemoryStream(); + val.WriteTo((Stream)memoryStream, default(CancellationToken)); + memoryStream.Position = 0L; + using StreamReader streamReader = new StreamReader(memoryStream); + string s = streamReader.ReadToEnd(); + return new StringContent(Convert.ToBase64String(Encoding.ASCII.GetBytes(s)), Encoding.UTF8, "text/plain"); + } + + public static string Encode(string text) + { + return Convert.ToBase64String(Encoding.UTF8.GetBytes(text)).Replace('+', '-').Replace('/', '_') + .Replace("=", ""); + } + + public static AlternateView CreateAlternateView(string mailBody) + { + List list = new List(); + string[] array = (from Match m in Regex.Matches(mailBody, "", RegexOptions.IgnoreCase) + select m.Groups[0].Value).ToArray(); + for (int i = 0; i < array.Length; i++) + { + string value = Regex.Match(array[i], "(?<=src=\")(.*?)(?=\")", RegexOptions.IgnoreCase).Value; + string text = Regex.Match(value, "file:(///).*\\.(.*)", RegexOptions.IgnoreCase).Groups[2].Value; + if (text == "jpg") + { + text = "jpeg"; + } + if (Uri.IsWellFormedUriString(value, UriKind.Absolute)) + { + Uri uri = new Uri(value); + if (File.Exists(uri.LocalPath)) + { + mailBody = mailBody.Replace(value, "data:image/" + text + ";base64," + Convert.ToBase64String(File.ReadAllBytes(uri.LocalPath))); + } + } + } + array = (from Match m in Regex.Matches(mailBody, "", RegexOptions.IgnoreCase) + select m.Groups[0].Value).ToArray(); + foreach (string text2 in array) + { + string value2 = Regex.Match(text2, "(?<=src=\").*(?=\")", RegexOptions.IgnoreCase).Value; + string value3 = Regex.Match(value2, "(?<=data:).*(?=;)", RegexOptions.IgnoreCase).Value; + if (ValidationHelper.IsNullOrEmpty(value3) || ValidationHelper.IsNullOrEmpty(value2)) + { + mailBody = mailBody.Replace(text2, string.Empty); + continue; + } + byte[] buffer = Convert.FromBase64String(Regex.Match(value2, "(?<=base64,)[^\"]*", RegexOptions.IgnoreCase).Value); + string text3 = Guid.NewGuid().ToString(); + LinkedResource item = new LinkedResource(new MemoryStream(buffer), value3) + { + ContentId = text3, + TransferEncoding = TransferEncoding.Base64 + }; + list.Add(item); + string newValue = "cid:" + text3; + mailBody = mailBody.Replace(value2, newValue); + } + AlternateView alternateView = AlternateView.CreateAlternateViewFromString(mailBody, null, "text/html"); + ExtensionMethods.AddRange((ICollection)alternateView.LinkedResources, (IEnumerable)list); + return alternateView; + } + + public List Send(Credencial credencial, List destinatarios, TipoTela tela, long id) + { + List logs = new List(); + int count = 100; + destinatarios.ForEach(async delegate(Destinatario i) + { + if (count == 0) + { + count = 100; + await Task.Delay(1000); + } + List list = logs; + list.Add(await SendAsync(credencial, i, null, null, (TipoTela)0)); + count--; + }); + return logs; + } +} diff --git a/Decompiler/Gestor.Application.Helpers/NotifyPropertyChangedExtension.cs b/Decompiler/Gestor.Application.Helpers/NotifyPropertyChangedExtension.cs new file mode 100644 index 0000000..2eb1bf4 --- /dev/null +++ b/Decompiler/Gestor.Application.Helpers/NotifyPropertyChangedExtension.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Runtime.CompilerServices; + +namespace Gestor.Application.Helpers; + +public static class NotifyPropertyChangedExtension +{ + public static void MutateVerbose(this INotifyPropertyChanged instance, ref TField field, TField newValue, Action raise, [CallerMemberName] string propertyName = null) + { + if (!EqualityComparer.Default.Equals(field, newValue)) + { + field = newValue; + raise?.Invoke(new PropertyChangedEventArgs(propertyName)); + } + } +} diff --git a/Decompiler/Gestor.Application.Helpers/ObrigatorioValidationRule.cs b/Decompiler/Gestor.Application.Helpers/ObrigatorioValidationRule.cs new file mode 100644 index 0000000..45cc3b6 --- /dev/null +++ b/Decompiler/Gestor.Application.Helpers/ObrigatorioValidationRule.cs @@ -0,0 +1,26 @@ +using System.Globalization; +using System.Windows.Controls; + +namespace Gestor.Application.Helpers; + +public class ObrigatorioValidationRule : ValidationRule +{ + public bool IsRequired { get; set; } + + public override ValidationResult Validate(object value, CultureInfo cultureInfo) + { + //IL_0010: Unknown result type (might be due to invalid IL or missing references) + //IL_0016: Expected O, but got Unknown + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Expected O, but got Unknown + if (!(value is string text)) + { + return new ValidationResult(false, (object)"OBRIGATÓRIO"); + } + if (text != null && IsRequired && string.IsNullOrWhiteSpace(text)) + { + return new ValidationResult(false, (object)"OBRIGATÓRIO"); + } + return ValidationResult.ValidResult; + } +} diff --git a/Decompiler/Gestor.Application.Helpers/PasswordBoxAssistant.cs b/Decompiler/Gestor.Application.Helpers/PasswordBoxAssistant.cs new file mode 100644 index 0000000..46104bd --- /dev/null +++ b/Decompiler/Gestor.Application.Helpers/PasswordBoxAssistant.cs @@ -0,0 +1,92 @@ +using System.Windows; +using System.Windows.Controls; + +namespace Gestor.Application.Helpers; + +public static class PasswordBoxAssistant +{ + public static readonly DependencyProperty BoundPassword = DependencyProperty.RegisterAttached("BoundPassword", typeof(string), typeof(PasswordBoxAssistant), new PropertyMetadata((object)string.Empty, new PropertyChangedCallback(OnBoundPasswordChanged))); + + public static readonly DependencyProperty BindPassword = DependencyProperty.RegisterAttached("BindPassword", typeof(bool), typeof(PasswordBoxAssistant), new PropertyMetadata((object)false, new PropertyChangedCallback(OnBindPasswordChanged))); + + private static readonly DependencyProperty UpdatingPassword = DependencyProperty.RegisterAttached("UpdatingPassword", typeof(bool), typeof(PasswordBoxAssistant), new PropertyMetadata((object)false)); + + private static void OnBoundPasswordChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + //IL_001b: Unknown result type (might be due to invalid IL or missing references) + //IL_0025: Expected O, but got Unknown + //IL_0049: Unknown result type (might be due to invalid IL or missing references) + //IL_0053: Expected O, but got Unknown + PasswordBox val = (PasswordBox)(object)((d is PasswordBox) ? d : null); + if (d != null && GetBindPassword(d)) + { + val.PasswordChanged -= new RoutedEventHandler(HandlePasswordChanged); + string password = (string)((DependencyPropertyChangedEventArgs)(ref e)).NewValue; + if (!GetUpdatingPassword((DependencyObject)(object)val)) + { + val.Password = password; + } + val.PasswordChanged += new RoutedEventHandler(HandlePasswordChanged); + } + } + + private static void OnBindPasswordChanged(DependencyObject dp, DependencyPropertyChangedEventArgs e) + { + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_0038: Expected O, but got Unknown + //IL_0043: Unknown result type (might be due to invalid IL or missing references) + //IL_004d: Expected O, but got Unknown + PasswordBox val = (PasswordBox)(object)((dp is PasswordBox) ? dp : null); + if (val != null) + { + bool num = (bool)((DependencyPropertyChangedEventArgs)(ref e)).OldValue; + bool flag = (bool)((DependencyPropertyChangedEventArgs)(ref e)).NewValue; + if (num) + { + val.PasswordChanged -= new RoutedEventHandler(HandlePasswordChanged); + } + if (flag) + { + val.PasswordChanged += new RoutedEventHandler(HandlePasswordChanged); + } + } + } + + private static void HandlePasswordChanged(object sender, RoutedEventArgs e) + { + PasswordBox val = (PasswordBox)((sender is PasswordBox) ? sender : null); + SetUpdatingPassword((DependencyObject)(object)val, value: true); + SetBoundPassword((DependencyObject)(object)val, val.Password); + SetUpdatingPassword((DependencyObject)(object)val, value: false); + } + + public static void SetBindPassword(DependencyObject dp, bool value) + { + dp.SetValue(BindPassword, (object)value); + } + + public static bool GetBindPassword(DependencyObject dp) + { + return (bool)dp.GetValue(BindPassword); + } + + public static string GetBoundPassword(DependencyObject dp) + { + return (string)dp.GetValue(BoundPassword); + } + + public static void SetBoundPassword(DependencyObject dp, string value) + { + dp.SetValue(BoundPassword, (object)value); + } + + private static bool GetUpdatingPassword(DependencyObject dp) + { + return (bool)dp.GetValue(UpdatingPassword); + } + + private static void SetUpdatingPassword(DependencyObject dp, bool value) + { + dp.SetValue(UpdatingPassword, (object)value); + } +} diff --git a/Decompiler/Gestor.Application.Helpers/PipeClient.cs b/Decompiler/Gestor.Application.Helpers/PipeClient.cs new file mode 100644 index 0000000..a0d49eb --- /dev/null +++ b/Decompiler/Gestor.Application.Helpers/PipeClient.cs @@ -0,0 +1,41 @@ +using System; +using System.IO; +using System.IO.Pipes; +using Newtonsoft.Json; + +namespace Gestor.Application.Helpers; + +public class PipeClient +{ + private string _pipeName; + + private NamedPipeClientStream Pipe { get; set; } + + public PipeClient(string pipeName) + { + _pipeName = pipeName; + } + + public bool Send(dynamic message) + { + try + { + Pipe = new NamedPipeClientStream(".", _pipeName, PipeDirection.Out, PipeOptions.Asynchronous); + Pipe.Connect(1000); + if (!Pipe.IsConnected) + { + return false; + } + using StreamWriter streamWriter = new StreamWriter(Pipe); + streamWriter.AutoFlush = true; + dynamic val = JsonConvert.SerializeObject(message); + streamWriter.WriteLine(val); + Pipe.WaitForPipeDrain(); + } + catch (TimeoutException) + { + return false; + } + return true; + } +} diff --git a/Decompiler/Gestor.Application.Helpers/PipeServer.cs b/Decompiler/Gestor.Application.Helpers/PipeServer.cs new file mode 100644 index 0000000..36c40c3 --- /dev/null +++ b/Decompiler/Gestor.Application.Helpers/PipeServer.cs @@ -0,0 +1,96 @@ +using System; +using System.IO; +using System.IO.Pipes; +using System.Security.AccessControl; +using System.Security.Principal; +using Assinador.Model.Common; +using Gestor.Application.Actions; +using Newtonsoft.Json; + +namespace Gestor.Application.Helpers; + +public class PipeServer : IDisposable +{ + private string _pipeName; + + private NamedPipeServerStream Pipe { get; set; } + + public bool CreateServer(string name) + { + _pipeName = name; + return Create(); + } + + private bool Create() + { + bool flag = true; + try + { + new NamedPipeClientStream(".", _pipeName, PipeDirection.Out, PipeOptions.Asynchronous).Connect(1000); + } + catch (TimeoutException) + { + flag = false; + } + catch (Exception) + { + return false; + } + if (flag) + { + return true; + } + try + { + PipeSecurity pipeSecurity = new PipeSecurity(); + SecurityIdentifier securityIdentifier = new SecurityIdentifier(WellKnownSidType.AuthenticatedUserSid, null); + securityIdentifier.Translate(typeof(NTAccount)); + pipeSecurity.SetAccessRule(new PipeAccessRule(securityIdentifier, PipeAccessRights.ReadWrite, AccessControlType.Allow)); + Pipe = new NamedPipeServerStream(_pipeName, PipeDirection.In, 1, PipeTransmissionMode.Message, PipeOptions.Asynchronous, 1, 1, pipeSecurity); + Pipe.BeginWaitForConnection(WaitForConnectionCallBack, Pipe); + } + catch (Exception) + { + return false; + } + return true; + } + + private void WaitForConnectionCallBack(IAsyncResult iar) + { + try + { + NamedPipeServerStream namedPipeServerStream = (NamedPipeServerStream)iar.AsyncState; + namedPipeServerStream.EndWaitForConnection(iar); + using (StreamReader streamReader = new StreamReader(Pipe)) + { + string text = streamReader.ReadLine(); + if (text != null && text.IndexOf("exit", StringComparison.InvariantCultureIgnoreCase) > -1) + { + Dispose(); + } + Handle(text); + } + namedPipeServerStream.Close(); + namedPipeServerStream = null; + Create(); + } + catch + { + } + } + + public void Dispose() + { + Pipe.Dispose(); + } + + private void Handle(string message) + { + if (message != null) + { + PipeMessageResult obj = JsonConvert.DeserializeObject(message); + Gestor.Application.Actions.Actions.AcessarHoster?.Invoke(obj); + } + } +} diff --git a/Decompiler/Gestor.Application.Helpers/QueryableHelper.cs b/Decompiler/Gestor.Application.Helpers/QueryableHelper.cs new file mode 100644 index 0000000..a93ebd5 --- /dev/null +++ b/Decompiler/Gestor.Application.Helpers/QueryableHelper.cs @@ -0,0 +1,24 @@ +using System; +using System.Linq; +using System.Linq.Expressions; + +namespace Gestor.Application.Helpers; + +public static class QueryableHelper +{ + public static IOrderedQueryable OrderBy(this IQueryable source, string propertyName) + { + return source.OrderBy(ToLambda(propertyName)); + } + + public static IOrderedQueryable OrderByDescending(this IQueryable source, string propertyName) + { + return source.OrderByDescending(ToLambda(propertyName)); + } + + private static Expression> ToLambda(string propertyName) + { + ParameterExpression parameterExpression = Expression.Parameter(typeof(T)); + return Expression.Lambda>(Expression.Convert(Expression.Property(parameterExpression, propertyName), typeof(object)), new ParameterExpression[1] { parameterExpression }); + } +} diff --git a/Decompiler/Gestor.Application.Helpers/Recursos.cs b/Decompiler/Gestor.Application.Helpers/Recursos.cs new file mode 100644 index 0000000..2c62785 --- /dev/null +++ b/Decompiler/Gestor.Application.Helpers/Recursos.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; +using System.Net; +using Agger.Registro; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Financeiro; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Helpers; + +public static class Recursos +{ + public const string AppStore = "https://apps.apple.com/br/app/agger-mobile/id1463091598"; + + public const string PlayStore = "https://play.google.com/store/apps/details?id=br.com.aggermobile&hl=pt&gl=US"; + + public const int DefaultMaxSize = 14336; + + public static List Parametros { get; set; } + + public static Usuario Usuario { get; set; } + + public static Empresa Empresa { get; set; } + + public static List Empresas { get; set; } + + public static List Seguradoras { get; set; } + + public static List Parceiros { get; set; } + + public static List Descricao { get; set; } + + public static List Estipulantes { get; set; } + + public static List Ramos { get; set; } + + public static List Produtos { get; set; } + + public static List Status { get; set; } + + public static List Coberturas { get; set; } + + public static List TipoVendedor { get; set; } + + public static List Vendedores { get; set; } + + public static List BancosContas { get; set; } + + public static List Usuarios { get; set; } + + public static List TiposTarefa { get; set; } + + public static List StatusProspeccao { get; set; } + + public static Uri WhatsAppLink { get; } = new Uri("https://api.whatsapp.com/send?"); + + + public static Uri ApiArquivo { get; } = Address.ApiArquivo; + + + public static List Fabricantes { get; set; } + + public static List Configuracoes { get; set; } + + public static IPHostEntry Host { get; set; } + + public static string Registrar { get; set; } +} diff --git a/Decompiler/Gestor.Application.Helpers/TipoToggle.cs b/Decompiler/Gestor.Application.Helpers/TipoToggle.cs new file mode 100644 index 0000000..a0be782 --- /dev/null +++ b/Decompiler/Gestor.Application.Helpers/TipoToggle.cs @@ -0,0 +1,13 @@ +using System; + +namespace Gestor.Application.Helpers; + +[Flags] +public enum TipoToggle +{ + None = 0, + Consultar = 1, + Incluir = 2, + Alterar = 4, + Excluir = 8 +} diff --git a/Decompiler/Gestor.Application.Helpers/ViewHelper.cs b/Decompiler/Gestor.Application.Helpers/ViewHelper.cs new file mode 100644 index 0000000..f4c38e6 --- /dev/null +++ b/Decompiler/Gestor.Application.Helpers/ViewHelper.cs @@ -0,0 +1,878 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.Dynamic; +using System.Linq; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Data; +using System.Windows.Media; +using CurrencyTextBoxControl; +using Gestor.Application.Componentes; +using Gestor.Model.Helper; +using Xceed.Wpf.Toolkit; +using Xceed.Wpf.Toolkit.Primitives; + +namespace Gestor.Application.Helpers; + +public static class ViewHelper +{ + [CompilerGenerated] + private sealed class _003CFindAncestor_003Ed__11 : IEnumerable, IEnumerable, IEnumerator, IDisposable, IEnumerator where T : DependencyObject + { + private int _003C_003E1__state; + + private T _003C_003E2__current; + + private int _003C_003El__initialThreadId; + + private DependencyObject dependencyObject; + + public DependencyObject _003C_003E3__dependencyObject; + + private DependencyObject _003CparentReference_003E5__2; + + T IEnumerator.Current + { + [DebuggerHidden] + get + { + return _003C_003E2__current; + } + } + + object IEnumerator.Current + { + [DebuggerHidden] + get + { + return _003C_003E2__current; + } + } + + [DebuggerHidden] + public _003CFindAncestor_003Ed__11(int _003C_003E1__state) + { + this._003C_003E1__state = _003C_003E1__state; + _003C_003El__initialThreadId = Environment.CurrentManagedThreadId; + } + + [DebuggerHidden] + void IDisposable.Dispose() + { + _003CparentReference_003E5__2 = null; + _003C_003E1__state = -2; + } + + private bool MoveNext() + { + int num = _003C_003E1__state; + if (num != 0) + { + if (num != 1) + { + return false; + } + _003C_003E1__state = -1; + goto IL_005a; + } + _003C_003E1__state = -1; + _003CparentReference_003E5__2 = VisualTreeHelper.GetParent(dependencyObject); + goto IL_006b; + IL_005a: + _003CparentReference_003E5__2 = VisualTreeHelper.GetParent(_003CparentReference_003E5__2); + goto IL_006b; + IL_006b: + if (_003CparentReference_003E5__2 == null) + { + return false; + } + DependencyObject obj = _003CparentReference_003E5__2; + T val = (T)(object)((obj is T) ? obj : null); + if (val != null) + { + _003C_003E2__current = val; + _003C_003E1__state = 1; + return true; + } + goto IL_005a; + } + + bool IEnumerator.MoveNext() + { + //ILSpy generated this explicit interface implementation from .override directive in MoveNext + return this.MoveNext(); + } + + [DebuggerHidden] + void IEnumerator.Reset() + { + throw new NotSupportedException(); + } + + [DebuggerHidden] + IEnumerator IEnumerable.GetEnumerator() + { + _003CFindAncestor_003Ed__11 _003CFindAncestor_003Ed__; + if (_003C_003E1__state == -2 && _003C_003El__initialThreadId == Environment.CurrentManagedThreadId) + { + _003C_003E1__state = 0; + _003CFindAncestor_003Ed__ = this; + } + else + { + _003CFindAncestor_003Ed__ = new _003CFindAncestor_003Ed__11(0); + } + _003CFindAncestor_003Ed__.dependencyObject = _003C_003E3__dependencyObject; + return _003CFindAncestor_003Ed__; + } + + [DebuggerHidden] + IEnumerator IEnumerable.GetEnumerator() + { + return ((IEnumerable)this).GetEnumerator(); + } + } + + [CompilerGenerated] + private sealed class _003CFindChildren_003Ed__2 : IEnumerable, IEnumerable, IEnumerator, IDisposable, IEnumerator where T : DependencyObject + { + private int _003C_003E1__state; + + private T _003C_003E2__current; + + private int _003C_003El__initialThreadId; + + private DependencyObject depObj; + + public DependencyObject _003C_003E3__depObj; + + private IEnumerator _003C_003E7__wrap1; + + private object _003Cchild_003E5__3; + + private IEnumerator _003C_003E7__wrap3; + + T IEnumerator.Current + { + [DebuggerHidden] + get + { + return _003C_003E2__current; + } + } + + object IEnumerator.Current + { + [DebuggerHidden] + get + { + return _003C_003E2__current; + } + } + + [DebuggerHidden] + public _003CFindChildren_003Ed__2(int _003C_003E1__state) + { + this._003C_003E1__state = _003C_003E1__state; + _003C_003El__initialThreadId = Environment.CurrentManagedThreadId; + } + + [DebuggerHidden] + void IDisposable.Dispose() + { + int num = _003C_003E1__state; + if ((uint)(num - -4) <= 1u || (uint)(num - 1) <= 1u) + { + try + { + if (num == -4 || num == 2) + { + try + { + } + finally + { + _003C_003Em__Finally2(); + } + } + } + finally + { + _003C_003Em__Finally1(); + } + } + _003C_003E7__wrap1 = null; + _003Cchild_003E5__3 = null; + _003C_003E7__wrap3 = null; + _003C_003E1__state = -2; + } + + private bool MoveNext() + { + try + { + object obj; + DependencyObject val; + switch (_003C_003E1__state) + { + default: + return false; + case 0: + _003C_003E1__state = -1; + if (depObj == null) + { + return false; + } + _003C_003E7__wrap1 = LogicalTreeHelper.GetChildren(depObj).GetEnumerator(); + _003C_003E1__state = -3; + goto IL_012e; + case 1: + _003C_003E1__state = -3; + goto IL_00be; + case 2: + { + _003C_003E1__state = -4; + goto IL_010d; + } + IL_010d: + if (_003C_003E7__wrap3.MoveNext()) + { + T current = _003C_003E7__wrap3.Current; + _003C_003E2__current = current; + _003C_003E1__state = 2; + return true; + } + _003C_003Em__Finally2(); + _003C_003E7__wrap3 = null; + _003Cchild_003E5__3 = null; + goto IL_012e; + IL_00be: + obj = _003Cchild_003E5__3; + val = (DependencyObject)((obj is DependencyObject) ? obj : null); + _003C_003E7__wrap3 = val.FindChildren().GetEnumerator(); + _003C_003E1__state = -4; + goto IL_010d; + IL_012e: + if (_003C_003E7__wrap1.MoveNext()) + { + _003Cchild_003E5__3 = _003C_003E7__wrap1.Current; + object obj2 = _003Cchild_003E5__3; + T val2 = (T)((obj2 is T) ? obj2 : null); + if (val2 != null) + { + object obj3 = val2; + object obj4 = ((obj3 is ContentControl) ? obj3 : null); + object obj5 = val2; + UserControl val3 = (UserControl)((obj5 is UserControl) ? obj5 : null); + if (obj4 == null || val3 != null) + { + _003C_003E2__current = val2; + _003C_003E1__state = 1; + return true; + } + } + goto IL_00be; + } + _003C_003Em__Finally1(); + _003C_003E7__wrap1 = null; + return false; + } + } + catch + { + //try-fault + ((IDisposable)this).Dispose(); + throw; + } + } + + bool IEnumerator.MoveNext() + { + //ILSpy generated this explicit interface implementation from .override directive in MoveNext + return this.MoveNext(); + } + + private void _003C_003Em__Finally1() + { + _003C_003E1__state = -1; + if (_003C_003E7__wrap1 is IDisposable disposable) + { + disposable.Dispose(); + } + } + + private void _003C_003Em__Finally2() + { + _003C_003E1__state = -3; + if (_003C_003E7__wrap3 != null) + { + _003C_003E7__wrap3.Dispose(); + } + } + + [DebuggerHidden] + void IEnumerator.Reset() + { + throw new NotSupportedException(); + } + + [DebuggerHidden] + IEnumerator IEnumerable.GetEnumerator() + { + _003CFindChildren_003Ed__2 _003CFindChildren_003Ed__; + if (_003C_003E1__state == -2 && _003C_003El__initialThreadId == Environment.CurrentManagedThreadId) + { + _003C_003E1__state = 0; + _003CFindChildren_003Ed__ = this; + } + else + { + _003CFindChildren_003Ed__ = new _003CFindChildren_003Ed__2(0); + } + _003CFindChildren_003Ed__.depObj = _003C_003E3__depObj; + return _003CFindChildren_003Ed__; + } + + [DebuggerHidden] + IEnumerator IEnumerable.GetEnumerator() + { + return ((IEnumerable)this).GetEnumerator(); + } + } + + [CompilerGenerated] + private sealed class _003CFindParent_003Ed__3 : IEnumerable, IEnumerable, IEnumerator, IDisposable, IEnumerator where T : DependencyObject + { + private int _003C_003E1__state; + + private T _003C_003E2__current; + + private int _003C_003El__initialThreadId; + + private DependencyObject depObj; + + public DependencyObject _003C_003E3__depObj; + + private DependencyObject _003CfirstParent_003E5__2; + + private IEnumerator _003C_003E7__wrap2; + + T IEnumerator.Current + { + [DebuggerHidden] + get + { + return _003C_003E2__current; + } + } + + object IEnumerator.Current + { + [DebuggerHidden] + get + { + return _003C_003E2__current; + } + } + + [DebuggerHidden] + public _003CFindParent_003Ed__3(int _003C_003E1__state) + { + this._003C_003E1__state = _003C_003E1__state; + _003C_003El__initialThreadId = Environment.CurrentManagedThreadId; + } + + [DebuggerHidden] + void IDisposable.Dispose() + { + int num = _003C_003E1__state; + if (num == -3 || num == 2) + { + try + { + } + finally + { + _003C_003Em__Finally1(); + } + } + _003CfirstParent_003E5__2 = null; + _003C_003E7__wrap2 = null; + _003C_003E1__state = -2; + } + + private bool MoveNext() + { + try + { + DependencyObject val2; + switch (_003C_003E1__state) + { + default: + return false; + case 0: + { + _003C_003E1__state = -1; + if (depObj == null) + { + return false; + } + _003CfirstParent_003E5__2 = LogicalTreeHelper.GetParent(depObj); + DependencyObject obj = _003CfirstParent_003E5__2; + T val = (T)(object)((obj is T) ? obj : null); + if (val != null) + { + _003C_003E2__current = val; + _003C_003E1__state = 1; + return true; + } + goto IL_0079; + } + case 1: + _003C_003E1__state = -1; + goto IL_0079; + case 2: + { + _003C_003E1__state = -3; + break; + } + IL_0079: + val2 = _003CfirstParent_003E5__2; + _003C_003E7__wrap2 = val2.FindParent().GetEnumerator(); + _003C_003E1__state = -3; + break; + } + if (_003C_003E7__wrap2.MoveNext()) + { + T current = _003C_003E7__wrap2.Current; + _003C_003E2__current = current; + _003C_003E1__state = 2; + return true; + } + _003C_003Em__Finally1(); + _003C_003E7__wrap2 = null; + return false; + } + catch + { + //try-fault + ((IDisposable)this).Dispose(); + throw; + } + } + + bool IEnumerator.MoveNext() + { + //ILSpy generated this explicit interface implementation from .override directive in MoveNext + return this.MoveNext(); + } + + private void _003C_003Em__Finally1() + { + _003C_003E1__state = -1; + if (_003C_003E7__wrap2 != null) + { + _003C_003E7__wrap2.Dispose(); + } + } + + [DebuggerHidden] + void IEnumerator.Reset() + { + throw new NotSupportedException(); + } + + [DebuggerHidden] + IEnumerator IEnumerable.GetEnumerator() + { + _003CFindParent_003Ed__3 _003CFindParent_003Ed__; + if (_003C_003E1__state == -2 && _003C_003El__initialThreadId == Environment.CurrentManagedThreadId) + { + _003C_003E1__state = 0; + _003CFindParent_003Ed__ = this; + } + else + { + _003CFindParent_003Ed__ = new _003CFindParent_003Ed__3(0); + } + _003CFindParent_003Ed__.depObj = _003C_003E3__depObj; + return _003CFindParent_003Ed__; + } + + [DebuggerHidden] + IEnumerator IEnumerable.GetEnumerator() + { + return ((IEnumerable)this).GetEnumerator(); + } + } + + public static void ControlLostFocus(object sender, RoutedEventArgs e) + { + //IL_00a2: Unknown result type (might be due to invalid IL or missing references) + //IL_0675: Unknown result type (might be due to invalid IL or missing references) + //IL_0680: Expected O, but got Unknown + //IL_067b: Unknown result type (might be due to invalid IL or missing references) + //IL_0680: Unknown result type (might be due to invalid IL or missing references) + //IL_068a: Expected O, but got Unknown + Control val = null; + if (sender is CustomItemValidation) + { + val = ((DependencyObject)(object)(sender as CustomItemValidation)).FindChildren().FirstOrDefault((Func)((Control currentControl) => currentControl is PasswordBox || currentControl is TextBox || currentControl is ToggleButton || currentControl is DatePicker || currentControl is ComboBox || currentControl is AutoCompleteBox || currentControl is CheckComboBox || currentControl is Button || currentControl is CustomPasswordBox)); + } + if (sender is CustomIsReadOnlyControl) + { + CustomIsReadOnlyControl customIsReadOnlyControl = sender as CustomIsReadOnlyControl; + val = ((!customIsReadOnlyControl.HasValidation) ? null : ((DependencyObject)(object)customIsReadOnlyControl).FindChildren().LastOrDefault((Func)((Control currentControl) => currentControl is PasswordBox || currentControl is TextBox || currentControl is ToggleButton || currentControl is DatePicker || currentControl is ComboBox || currentControl is AutoCompleteBox || currentControl is CheckComboBox || currentControl is Button))); + } + if (val == null) + { + return; + } + ComboBox val2 = (ComboBox)(object)((val is ComboBox) ? val : null); + if ((val2 != null && val2.IsDropDownOpen) || (val is TextBox && ((TextBoxBase)(TextBox)val).IsReadOnly)) + { + return; + } + DependencyProperty dependencyProperty = GetDependencyProperty(val); + if (dependencyProperty == null) + { + return; + } + BindingExpression bindingExpression = ((FrameworkElement)val).GetBindingExpression(dependencyProperty); + if (bindingExpression == null) + { + return; + } + Validation.ClearInvalid((BindingExpressionBase)(object)bindingExpression); + List list = bindingExpression.ParentBinding.Path.Path.Split(new char[1] { '.' }).ToList(); + Type type = bindingExpression.DataItem.GetType(); + if (!list.Any()) + { + return; + } + PropertyInfo property = type.GetProperty(list.First()); + if (property == null) + { + return; + } + dynamic value = property.GetValue(bindingExpression.DataItem, null); + List> list2 = new List>(); + if ((!ViewHelper.HasMethod(value, "ValidationEvent"))) + { + dynamic resolvedSource = bindingExpression.ResolvedSource; + if (resolvedSource is Control || ((!ViewHelper.HasMethod(resolvedSource, "ValidationEvent"))) || ((resolvedSource?.ValidationEvent == null) ? true : false)) + { + return; + } + if (resolvedSource.ValidationEvent is Func>> func) + { + list2 = func(); + } + if (list2.Count == 0) + { + return; + } + } + if (list2.Count == 0) + { + if (value?.ValidationEvent == null) + { + return; + } + if (value.ValidationEvent is Func>> func2) + { + list2 = func2(); + } + } + if (list2 == null || !list2.Any()) + { + return; + } + string text = ((list.Last() == "Id") ? list[list.Count - 2] : list.Last()); + string valueExact = ValidationHelper.GetValueExact(list2, text); + if (string.IsNullOrEmpty(valueExact)) + { + valueExact = ValidationHelper.GetValueExact(list2, text); + if (string.IsNullOrEmpty(valueExact)) + { + return; + } + } + ValidationError val3 = new ValidationError((ValidationRule)new ExceptionValidationRule(), (object)bindingExpression) + { + ErrorContent = valueExact + }; + Validation.MarkInvalid((BindingExpressionBase)(object)bindingExpression, val3); + } + + public static bool IsPropertyExist(dynamic settings, string name) + { + if (settings is ExpandoObject) + { + return ((IDictionary)settings).ContainsKey(name); + } + return settings.GetType().GetProperty(name) != null; + } + + [IteratorStateMachine(typeof(_003CFindChildren_003Ed__2<>))] + public static IEnumerable FindChildren(this DependencyObject depObj) where T : DependencyObject + { + //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() + return new _003CFindChildren_003Ed__2(-2) + { + _003C_003E3__depObj = depObj + }; + } + + [IteratorStateMachine(typeof(_003CFindParent_003Ed__3<>))] + public static IEnumerable FindParent(this DependencyObject depObj) where T : DependencyObject + { + //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() + return new _003CFindParent_003Ed__3(-2) + { + _003C_003E3__depObj = depObj + }; + } + + public static T Window() where T : Window + { + return ((IEnumerable)Application.Current.Windows).OfType().FirstOrDefault(); + } + + public static void ValidateFields(this DependencyObject dependencyObject, List> errorMessages, bool focusField = true) + { + if (errorMessages == null || !errorMessages.Any()) + { + dependencyObject.ClearInvalid(); + return; + } + Control val = null; + foreach (Control item in dependencyObject.FindChildren()) + { + Control val2 = item.SetInvalid(errorMessages); + if (val == null && val2 != null) + { + val = val2; + } + } + if (focusField && val != null) + { + ((UIElement)val).Focus(); + } + } + + public static Control SetInvalid(this Control currentControl, List> errorMessages = null, string specificKey = null) + { + //IL_0320: Unknown result type (might be due to invalid IL or missing references) + //IL_032b: Expected O, but got Unknown + //IL_0326: Unknown result type (might be due to invalid IL or missing references) + //IL_032b: Unknown result type (might be due to invalid IL or missing references) + //IL_0335: Expected O, but got Unknown + DependencyProperty dependencyProperty = GetDependencyProperty(currentControl); + if (dependencyProperty == null) + { + return null; + } + BindingExpression bindingExpression = ((FrameworkElement)currentControl).GetBindingExpression(dependencyProperty); + if (errorMessages == null) + { + dynamic val = ((bindingExpression != null) ? bindingExpression.ResolvedSource : null); + if (val is Control) + { + return null; + } + if ((!ViewHelper.HasMethod(val, "ValidationEvent"))) + { + return null; + } + if (val?.ValidationEvent == null) + { + return null; + } + if (val.ValidationEvent is Func>> func) + { + errorMessages = func(); + } + } + if (bindingExpression == null) + { + return null; + } + BindingExpressionBase bindingExpressionBase = BindingOperations.GetBindingExpressionBase((DependencyObject)(object)currentControl, dependencyProperty); + if (bindingExpressionBase == null) + { + return null; + } + Validation.ClearInvalid(bindingExpressionBase); + if (errorMessages == null || !errorMessages.Any()) + { + return null; + } + string[] array = bindingExpression.ParentBinding.Path.Path.Split(new char[1] { '.' }); + string text = specificKey ?? ((array.Last() == "Id") ? array[^2] : array.Last()); + string valueExact = ValidationHelper.GetValueExact(errorMessages, text); + if (string.IsNullOrEmpty(valueExact)) + { + valueExact = ValidationHelper.GetValueExact(errorMessages, text); + if (string.IsNullOrEmpty(valueExact)) + { + return null; + } + } + ValidationError val2 = new ValidationError((ValidationRule)new ExceptionValidationRule(), (object)bindingExpression) + { + ErrorContent = valueExact + }; + Validation.MarkInvalid(bindingExpressionBase, val2); + return currentControl; + } + + private static DependencyProperty GetDependencyProperty(Control currentControl) + { + DependencyProperty result = null; + if (currentControl is CheckComboBox) + { + result = Selector.SelectedValueProperty; + } + if (currentControl is DatePicker) + { + result = DatePicker.SelectedDateProperty; + } + if (currentControl is AutoCompleteBox) + { + result = AutoCompleteBox.SelectedItemProperty; + } + if (currentControl is TextBox) + { + result = TextBox.TextProperty; + } + if (currentControl is MaskedTextBox) + { + result = TextBox.TextProperty; + } + if (currentControl is ComboBox) + { + result = Selector.SelectedValueProperty; + } + if (currentControl is CurrencyTextBox) + { + result = CurrencyTextBox.NumberProperty; + } + if (currentControl is ToggleButton) + { + result = ToggleButton.IsCheckedProperty; + } + if (currentControl is CustomPasswordBox) + { + result = CustomPasswordBox.TextProperty; + } + return result; + } + + public static bool HasMethod(object objectToCheck, string methodName) + { + if (objectToCheck == null) + { + return false; + } + return objectToCheck.GetType().GetProperty(methodName) != null; + } + + public static bool IsValid(this DependencyObject obj) + { + if (!Validation.GetHasError(obj)) + { + return LogicalTreeHelper.GetChildren(obj).OfType().All(IsValid); + } + return false; + } + + public static void ClearInvalid(this DependencyObject dependencyObject) + { + foreach (Control item in dependencyObject.FindChildren()) + { + item.SetInvalid(); + } + } + + [IteratorStateMachine(typeof(_003CFindAncestor_003Ed__11<>))] + public static IEnumerable FindAncestor(this DependencyObject dependencyObject) where T : DependencyObject + { + //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() + return new _003CFindAncestor_003Ed__11(-2) + { + _003C_003E3__dependencyObject = dependencyObject + }; + } + + private static bool Compare(Control currentControl) + { + DependencyProperty dependencyProperty = GetDependencyProperty(currentControl); + if (dependencyProperty == null) + { + return false; + } + BindingExpression bindingExpression = ((FrameworkElement)currentControl).GetBindingExpression(dependencyProperty); + dynamic val = ((bindingExpression != null) ? bindingExpression.ResolvedSource : null); + return val != null && (bool)val.HasChange(); + } + + public static bool IsWindowOpen(string name = "") where T : Window + { + if (!string.IsNullOrEmpty(name)) + { + return ((IEnumerable)Application.Current.Windows).OfType().Any((T w) => ((FrameworkElement)(object)w).Name.Equals(name)); + } + return ((IEnumerable)Application.Current.Windows).OfType().Any(); + } + + public static void SetInvalid(Control control, string error, bool valid) + { + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Expected O, but got Unknown + //IL_001d: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Unknown result type (might be due to invalid IL or missing references) + //IL_002a: Expected O, but got Unknown + DependencyProperty dependencyProperty = GetDependencyProperty(control); + if (dependencyProperty == null) + { + return; + } + BindingExpression bindingExpression = ((FrameworkElement)control).GetBindingExpression(dependencyProperty); + if (bindingExpression == null) + { + return; + } + ValidationError val = new ValidationError((ValidationRule)new ExceptionValidationRule(), (object)bindingExpression) + { + ErrorContent = error + }; + BindingExpressionBase bindingExpressionBase = BindingOperations.GetBindingExpressionBase((DependencyObject)(object)control, dependencyProperty); + if (bindingExpressionBase != null) + { + Validation.ClearInvalid(bindingExpressionBase); + if (!valid) + { + Validation.MarkInvalid(bindingExpressionBase, val); + } + } + } + + internal static void BindData(this CheckComboBox comboBox, bool withSelect = true, bool enumDefault = true, string defaultValue = "", bool orderByLabel = false) + { + DefaultBinding(comboBox, withSelect, enumDefault, defaultValue, string.Empty, orderByLabel); + } + + private static void DefaultBinding(CheckComboBox comboBox, bool withSelect, bool enumDefault, string defaultValue = "", string defaultText = "", bool orderByLabel = false) + { + List> source = (List>)(((ItemsControl)comboBox).ItemsSource = BindingHelper.BindingData(withSelect, enumDefault, defaultValue, defaultText, orderByLabel)); + ((Selector)comboBox).ValueMemberPath = "Key"; + ((ItemsControl)comboBox).DisplayMemberPath = "Value"; + ((Selector)comboBox).SelectedItem = source.First(); + } +} diff --git a/Decompiler/Gestor.Application.Migration.Files.20200219_01.SQL b/Decompiler/Gestor.Application.Migration.Files.20200219_01.SQL new file mode 100644 index 0000000..0511b35 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200219_01.SQL @@ -0,0 +1,192 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 112) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (112, N'CAPEMISA CAPITALIZAÇÃO S/A', 1, 2); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 131) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (131, N'CHUBB DO BRASIL CIA DE SEGUROS', 1, 2); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 14) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (14, N'ALFA SEGURADORA S.A.', 1, 2); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 182) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (182, N'COMPANHIA EXCELSIOR DE SEGUROS', 1, 2); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 19) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (19, N'ALLIANZ SEGUROS S.A.', 1, 2); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 192) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (192, N'CONFIANÇA CIA DE SEGUROS', 1, 2); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 216) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (216, N'ESSOR SEGUROS S.A.', 1, 2); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 228) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (228, N'FAIRFAX BRASIL SEGUROS CORPORATIVOS S.A.', 1, 2); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 244) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (244, N'GENERALI BRASIL SEGUROS S.A.', 1, 2); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 245) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (245, N'GENTE SEGURADORA S.A.', 1, 2); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 259) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (259, N'HDI SEGUROS S.A.', 1, 2); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 276) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (276, N'INDIANA SEGUROS S/A', 1, 2); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 285) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (285, N'INVESTPREV SEGURADORA S.A', 1, 2); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 292) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (292, N'ITAU SEGUROS S/A', 1, 2); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 310) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (310, N'LIBERTY SEGUROS S/A', 1, 2); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 311) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (311, N'LIDERANÇA CAPITALIZAÇÃO S/A', 0, 2); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 328) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (328, N'MAPFRE SEGUROS GERAIS S/A', 1, 2); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 331) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (331, N'MARITIMA SEGUROS S/A', 1, 2); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 338) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (338, N'MBM SEGURADORA S/A', 1, 2); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 341) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (341, N'METLIFE VIDA E PREVIDÊNCIA S/A', 1, 2); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 348) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (348, N'MITSUI SUMITOMO SEGUROS S/A', 1, 2); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 372) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (372, N'NOBRE SEGURADORA DO BRASIL S/A', 1, 2); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 4) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (4, N'ACE SEGURADORA S.A.', 1, 2); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 400) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (400, N'PORTO SEGURO CIA DE SEGUROS GERAIS', 1, 2); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 42) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (42, N'ARGO SEGUROS BRASIL S.A', 1, 2); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 480) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (480, N'SULAMÉRICA CIA NACIONAL DE SEGUROS', 1, 2); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 491) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (491, N'SWISS RE CORPORATE SOLUTIONS BRASIL SE S', 1, 2); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 501) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (501, N'TOKIO MARINE SEGURADORA S.A.', 1, 2); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 522) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (522, N'UNIMED SEGURADORA S/A', 1, 2); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 543) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (543, N'YASUDA SEGUROS S.A', 1, 2); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 548) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (548, N'ZURICH MINAS BRASIL SEGUROS S/A', 1, 2); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 557) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (557, N'SUHAI SEGUROS S.A.', 1, 2); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 559) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (559, N'SANCOR SEGUROS DO BRASIL S.A.', 1, 2); +END +--IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 560) +--BEGIN +-- INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (560, N'AGROBRASIL - CORRETORA DE SEGUROS LTDA - ME ', 1, 2); +--END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 561) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (561, N'RSA SEGUROS', 1, 2); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 562) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (562, N'YASUDA MARITIMA SEGUROS S.A.', 1, 2); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 578) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (578, N'NOTRE DAME INTERMÉDICA', 1, 2); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 595) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (595, N'SOMPO SEGUROS', 1, 2); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 600) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (600, N'ASSIST CARD SEGURO VIAGEM', 1, 2); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 603) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (603, N'AXA SEGUROS', 1, 2); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 639) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (639, N'ALIRO SEGUROS S.A.', 1, 2); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 642) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (642, N'SURA SEGUROS S/A', 1, 2); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 647) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (647, N'PREVISUL SEGURADORA', 1, 2); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 695) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (695, N'ARUANA SEGURADORA', 1, 2); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 70) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (70, N'AZUL COMPANHIA DE SEGUROS GERAIS', 1, 2); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 9) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (9, N'AIG SEGUROS BRASIL S.A', 1, 2); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 92) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (92, N'BRADESCO SEGUROS S.A', 1, 2); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 614) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (614, N'TOO SEGUROS S.A.', 1, 2); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200219_02.SQL b/Decompiler/Gestor.Application.Migration.Files.20200219_02.SQL new file mode 100644 index 0000000..27f9797 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200219_02.SQL @@ -0,0 +1,116 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[ramo] WHERE [IDRAMO] = 1) +BEGIN + INSERT INTO [dbo].[ramo] ([IDRAMO],[NOME],[IOF],[FATURA],[ATIVO]) VALUES (1, N'RESIDÊNCIA',0.0738,0,1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ramo] WHERE [IDRAMO] = 2) +BEGIN + INSERT INTO [dbo].[ramo] ([IDRAMO],[NOME],[IOF],[FATURA],[ATIVO]) VALUES (2, N'EMPRESA',0.0738,0,1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ramo] WHERE [IDRAMO] = 3) +BEGIN + INSERT INTO [dbo].[ramo] ([IDRAMO],[NOME],[IOF],[FATURA],[ATIVO]) VALUES (3, N'CONDOMÍNIO',0.0738,0,1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ramo] WHERE [IDRAMO] = 4) +BEGIN + INSERT INTO [dbo].[ramo] ([IDRAMO],[NOME],[IOF],[FATURA],[ATIVO]) VALUES (4, N'RISCOS DIVERSOS',0.0738,1,1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ramo] WHERE [IDRAMO] = 5) +BEGIN + INSERT INTO [dbo].[ramo] ([IDRAMO],[NOME],[IOF],[FATURA],[ATIVO]) VALUES (5, N'AUTOMOVEL',0.0738,0,1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ramo] WHERE [IDRAMO] = 6) +BEGIN + INSERT INTO [dbo].[ramo] ([IDRAMO],[NOME],[IOF],[FATURA],[ATIVO]) VALUES (6, N'VIDA INDIVIDUAL',0.0738,1,1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ramo] WHERE [IDRAMO] = 7) +BEGIN + INSERT INTO [dbo].[ramo] ([IDRAMO],[NOME],[IOF],[FATURA],[ATIVO]) VALUES (7, N'VG/APC',0.0738,1,1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ramo] WHERE [IDRAMO] = 8) +BEGIN + INSERT INTO [dbo].[ramo] ([IDRAMO],[NOME],[IOF],[FATURA],[ATIVO]) VALUES (8, N'TRANSPORTES',0.0738,1,1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ramo] WHERE [IDRAMO] = 14) +BEGIN + INSERT INTO [dbo].[ramo] ([IDRAMO],[NOME],[IOF],[FATURA],[ATIVO]) VALUES (14, N'DPVAT',0.0738,0,0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ramo] WHERE [IDRAMO] = 15) +BEGIN + INSERT INTO [dbo].[ramo] ([IDRAMO],[NOME],[IOF],[FATURA],[ATIVO]) VALUES (15, N'FIANÇA LOCATÍCIA',0.0738,0,1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ramo] WHERE [IDRAMO] = 18) +BEGIN + INSERT INTO [dbo].[ramo] ([IDRAMO],[NOME],[IOF],[FATURA],[ATIVO]) VALUES (18, N'IMOBILIÁRIO',0.0738,1,1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ramo] WHERE [IDRAMO] = 20) +BEGIN + INSERT INTO [dbo].[ramo] ([IDRAMO],[NOME],[IOF],[FATURA],[ATIVO]) VALUES (20, N'GRANIZO',0.0738,0,1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ramo] WHERE [IDRAMO] = 23) +BEGIN + INSERT INTO [dbo].[ramo] ([IDRAMO],[NOME],[IOF],[FATURA],[ATIVO]) VALUES (23, N'SEGURO VIAGEM',0.0738,0,0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ramo] WHERE [IDRAMO] = 24) +BEGIN + INSERT INTO [dbo].[ramo] ([IDRAMO],[NOME],[IOF],[FATURA],[ATIVO]) VALUES (24, N'SEGURO DE EVENTOS',0.0738,0,1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ramo] WHERE [IDRAMO] = 25) +BEGIN + INSERT INTO [dbo].[ramo] ([IDRAMO],[NOME],[IOF],[FATURA],[ATIVO]) VALUES (25, N'AGRÍCOLA',0.0738,1,0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ramo] WHERE [IDRAMO] = 28) +BEGIN + INSERT INTO [dbo].[ramo] ([IDRAMO],[NOME],[IOF],[FATURA],[ATIVO]) VALUES (28, N'RC PROFISSIONAL',0.0738,0,0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ramo] WHERE [IDRAMO] = 30) +BEGIN + INSERT INTO [dbo].[ramo] ([IDRAMO],[NOME],[IOF],[FATURA],[ATIVO]) VALUES (30, N'RC AMBIENTAL',0.0738,0,0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ramo] WHERE [IDRAMO] = 31) +BEGIN + INSERT INTO [dbo].[ramo] ([IDRAMO],[NOME],[IOF],[FATURA],[ATIVO]) VALUES (31, N'ACIDENTES PESSOAIS',0.0738,0,1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ramo] WHERE [IDRAMO] = 32) +BEGIN + INSERT INTO [dbo].[ramo] ([IDRAMO],[NOME],[IOF],[FATURA],[ATIVO]) VALUES (32, N'RESP. CIVIL GERAL',0.0738,0,1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ramo] WHERE [IDRAMO] = 33) +BEGIN + INSERT INTO [dbo].[ramo] ([IDRAMO],[NOME],[IOF],[FATURA],[ATIVO]) VALUES (33, N'MULTIRISCO RURAL',0.0738,0,1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ramo] WHERE [IDRAMO] = 34) +BEGIN + INSERT INTO [dbo].[ramo] ([IDRAMO],[NOME],[IOF],[FATURA],[ATIVO]) VALUES (34, N'ANIMAIS',0.0738,0,0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ramo] WHERE [IDRAMO] = 37) +BEGIN + INSERT INTO [dbo].[ramo] ([IDRAMO],[NOME],[IOF],[FATURA],[ATIVO]) VALUES (37, N'RESP. CIVIL ÔNIBUS',0.0738,0,1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ramo] WHERE [IDRAMO] = 38) +BEGIN + INSERT INTO [dbo].[ramo] ([IDRAMO],[NOME],[IOF],[FATURA],[ATIVO]) VALUES (38, N'SEGURO GARANTIA',0.0738,0,0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ramo] WHERE [IDRAMO] = 39) +BEGIN + INSERT INTO [dbo].[ramo] ([IDRAMO],[NOME],[IOF],[FATURA],[ATIVO]) VALUES (39, N'RISCOS DE ENGENHARIA',0.0738,0,1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ramo] WHERE [IDRAMO] = 41) +BEGIN + INSERT INTO [dbo].[ramo] ([IDRAMO],[NOME],[IOF],[FATURA],[ATIVO]) VALUES (41, N'ACIDENTES PESSOAIS COLETIVOS',0.0738,0,1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ramo] WHERE [IDRAMO] = 44) +BEGIN + INSERT INTO [dbo].[ramo] ([IDRAMO],[NOME],[IOF],[FATURA],[ATIVO]) VALUES (44, N'PENHOR RURAL',0.0738,0,0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ramo] WHERE [IDRAMO] = 49) +BEGIN + INSERT INTO [dbo].[ramo] ([IDRAMO],[NOME],[IOF],[FATURA],[ATIVO]) VALUES (49, N'RCTR-C',0.0738,1,0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ramo] WHERE [IDRAMO] = 54) +BEGIN + INSERT INTO [dbo].[ramo] ([IDRAMO],[NOME],[IOF],[FATURA],[ATIVO]) VALUES (54, N'BENFEITORIA RURAL',0.0738,0,0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ramo] WHERE [IDRAMO] = 56) +BEGIN + INSERT INTO [dbo].[ramo] ([IDRAMO],[NOME],[IOF],[FATURA],[ATIVO]) VALUES (56, N'RC PRESTAÇÃO DE SERVIÇO',0.0738,0,1); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200219_03.SQL b/Decompiler/Gestor.Application.Migration.Files.20200219_03.SQL new file mode 100644 index 0000000..17e1099 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200219_03.SQL @@ -0,0 +1,468 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 1) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (1,1, N'BANCO DO BRASIL S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 10) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (10,41, N'BANCO DO ESTADO DO RIO GRANDE DO SUL S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 100) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (100,738, N'BANCO MORADA S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 101) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (101,739, N'BANCO BGN S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 102) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (102,740, N'BANCO BARCLAYS S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 103) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (103,741, N'BANCO RIBEIRAO PRETO S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 104) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (104,743, N'BANCO EMBLEMA S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 105) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (105,745, N'BANCO CITIBANK S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 106) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (106,746, N'BANCO MODAL S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 107) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (107,747, N'BANCO RABOBANK INTERNATIONAL BRASIL S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 108) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (108,748, N'BANCO COOPERATIVO SICREDI S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 109) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (109,749, N'BANCO SIMPLES S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 11) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (11,44, N'BANCO BVA S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 110) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (110,751, N'DRESDNER BANK BRASIL S.A. BANCO MULTIPLO'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 111) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (111,752, N'BANCO BNP PARIBAS BRASIL S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 112) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (112,753, N'NBC BANK BRASIL S. A. - BANCO M?LTIPLO'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 113) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (113,756, N'BANCO COOPERATIVO DO BRASIL S.A. - BANCOOB'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 114) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (114,757, N'BANCO KEB DO BRASIL S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 115) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (115,0, N'NENHUM'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 116) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (116,85, N'BANCO CECRED'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 117) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (117,290, N'PAGSEGURO INTERNET S.A'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 12) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (12,45, N'BANCO OPPORTUNITY S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 13) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (13,47, N'BANCO DO ESTADO DE SERGIPE S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 14) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (14,62, N'HIPERCARD BANCO M?LTIPLO S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 15) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (15,63, N'BANCO IBI S.A. - BANCO M?LTIPLO'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 16) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (16,65, N'BANCO LEMON S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 17) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (17,66, N'BANCO MORGAN STANLEY S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 18) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (18,69, N'BPN BRASIL BANCO M?LTIPLO S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 19) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (19,70, N'BRB - BANCO DE BRASILIA S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 2) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (2,3, N'BANCO DA AMAZONIA S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 20) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (20,72, N'BANCO RURAL MAIS S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 21) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (21,73, N'BB BANCO POPULAR DO BRASIL S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 22) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (22,74, N'BANCO J. SAFRA S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 23) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (23,75, N'BANCO CR2 S/A'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 24) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (24,76, N'BANCO KDB DO BRASIL S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 25) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (25,77, N'BANCO INTERMEDIUM S/A'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 26) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (26,79, N'JBS BANCO S/A'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 27) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (27,81, N'CONC?RDIA BANCO S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 28) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (28,96, N'BANCO BM&F DE SERVI?OS DE LIQUIDA??O E CUST?DIA S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 29) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (29,104, N'CAIXA ECONOMICA FEDERAL'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 3) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (3,4, N'BANCO DO NORDESTE DO BRASIL S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 30) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (30,107, N'BANCO BBM S/A'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 31) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (31,151, N'BANCO NOSSA CAIXA S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 32) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (32,208, N'BANCO UBS PACTUAL S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 33) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (33,212, N'BANCO MATONE S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 34) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (34,213, N'BANCO ARBI S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 35) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (35,214, N'BANCO DIBENS S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 36) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (36,217, N'BANCO JOHN DEERE S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 37) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (37,218, N'BANCO BONSUCESSO S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 38) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (38,222, N'BANCO CALYON BRASIL S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 39) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (39,224, N'BANCO FIBRA S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 4) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (4,19, N'BANCO AZTECA DO BRASIL S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 40) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (40,225, N'BANCO BRASCAN S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 41) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (41,229, N'BANCO CRUZEIRO DO SUL S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 42) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (42,230, N'UNICARD BANCO M?LTIPLO S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 43) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (43,233, N'BANCO GE CAPITAL S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 44) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (44,237, N'BANCO BRADESCO S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 45) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (45,241, N'BANCO CLASSICO S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 46) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (46,243, N'BANCO M?XIMA S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 47) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (47,246, N'BANCO ABC BRASIL S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 48) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (48,248, N'BANCO BOAVISTA INTERATLANTICO S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 49) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (49,249, N'BANCO INVESTCRED UNIBANCO S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 5) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (5,21, N'BANESTES S.A. BANCO DO ESTADO DO ESPIRITO SANTO'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 50) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (50,250, N'BANCO SCHAHIN S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 51) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (51,254, N'PARAN? BANCO S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 52) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (52,263, N'BANCO CACIQUE S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 53) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (53,265, N'BANCO FATOR S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 54) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (54,266, N'BANCO CEDULA S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 55) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (55,300, N'BANCO DE LA NACION ARGENTINA'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 56) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (56,318, N'BANCO BMG S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 57) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (57,341, N'BANCO ITAU S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 58) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (58,356, N'BANCO ABN AMRO REAL S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 59) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (59,366, N'BANCO SOCIETE GENERALE BRASIL S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 6) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (6,25, N'BANCO ALFA S.A'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 60) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (60,370, N'BANCO WESTLB DO BRASIL S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 61) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (61,376, N'BANCO J.P. MORGAN S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 62) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (62,389, N'BANCO MERCANTIL DO BRASIL S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 63) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (63,394, N'BANCO FINASA BMC S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 64) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (64,399, N'HSBC BANK BRASIL S.A. - BANCO MULTIPLO'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 65) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (65,409, N'UNIBANCO-UNIAO DE BANCOS BRASILEIROS S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 66) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (66,412, N'BANCO CAPITAL S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 67) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (67,422, N'BANCO SAFRA S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 68) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (68,453, N'BANCO RURAL S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 69) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (69,456, N'BANCO DE TOKYO-MITSUBISHI UFJ BRASIL S/A'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 7) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (7,33, N'BANCO SANTANDER BANESPA S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 70) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (70,464, N'BANCO SUMITOMO MITSUI BRASILEIRO S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 71) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (71,477, N'CITIBANK N.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 72) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (72,487, N'DEUTSCHE BANK S.A. - BANCO ALEMAO'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 73) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (73,488, N'JPMORGAN CHASE BANK, NATIONAL ASSOCIATION'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 74) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (74,492, N'ING BANK N.V.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 75) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (75,494, N'BANCO DE LA REPUBLICA ORIENTAL DEL URUGUAY'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 76) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (76,495, N'BANCO DE LA PROVINCIA DE BUENOS AIRES'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 77) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (77,505, N'BANCO CREDIT SUISSE (BRASIL) S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 78) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (78,600, N'BANCO LUSO BRASILEIRO S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 79) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (79,604, N'BANCO INDUSTRIAL DO BRASIL S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 8) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (8,37, N'BANCO DO ESTADO DO PAR? S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 80) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (80,610, N'BANCO VR S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 81) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (81,611, N'BANCO PAULISTA S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 82) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (82,612, N'BANCO GUANABARA S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 83) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (83,613, N'BANCO PECUNIA S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 84) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (84,623, N'BANCO PANAMERICANO S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 85) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (85,626, N'BANCO FICSA S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 86) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (86,630, N'BANCO INTERCAP S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 87) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (87,633, N'BANCO RENDIMENTO S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 88) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (88,634, N'BANCO TRIANGULO S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 89) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (89,637, N'BANCO SOFISA S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 9) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (9,40, N'BANCO CARGILL S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 90) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (90,638, N'BANCO PROSPER S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 91) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (91,643, N'BANCO PINE S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 92) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (92,653, N'BANCO INDUSVAL S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 93) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (93,654, N'BANCO A.J. RENNER S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 94) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (94,655, N'BANCO VOTORANTIM S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 95) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (95,707, N'BANCO DAYCOVAL S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 96) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (96,719, N'BANIF - BANCO INTERNACIONAL DO FUNCHAL (BRASIL), S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 97) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (97,721, N'BANCO CREDIBEL S.A.'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 98) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (98,734, N'BANCO GERDAU S.A'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 99) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (99,735, N'BANCO POTTENCIAL S.A.'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200219_04.SQL b/Decompiler/Gestor.Application.Migration.Files.20200219_04.SQL new file mode 100644 index 0000000..16c421c --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200219_04.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[TIPOVENDEDOR] WHERE [IDTIPOVENDEDOR] = 1) +BEGIN + INSERT INTO [dbo].[TIPOVENDEDOR] ([IDTIPOVENDEDOR],[DESCRICAO]) VALUES (1, N'VENDEDOR'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200219_05.SQL b/Decompiler/Gestor.Application.Migration.Files.20200219_05.SQL new file mode 100644 index 0000000..fcd9539 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200219_05.SQL @@ -0,0 +1,768 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 1) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (1, N'ACURA'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 2) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (2, N'AGRALE'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 3) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (3, N'AGRALE'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 5) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (5, N'AUDI'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 6) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (6, N'BMW'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 7) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (7, N'BRM'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 8) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (8, N'BUGGY'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 9) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (9, N'CADILLAC'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 11) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (11, N'CHEVROLET'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 12) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (12, N'CHRYSLER'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 13) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (13, N'CITROEN'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 14) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (14, N'DAEWOO'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 15) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (15, N'DAIHATSU'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 16) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (16, N'DODGE'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 17) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (17, N'ENGESA'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 18) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (18, N'ENVEMO'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 19) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (19, N'FERRARI'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 20) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (20, N'FIAT'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 21) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (21, N'FORD'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 23) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (23, N'GMC'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 24) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (24, N'GURGEL'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 25) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (25, N'HONDA'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 26) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (26, N'HYUNDAI'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 28) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (28, N'ISUZU'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 29) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (29, N'IVECO'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 30) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (30, N'JAGUAR'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 31) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (31, N'JEEP'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 32) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (32, N'JPX'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 34) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (34, N'LADA'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 35) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (35, N'LAND ROVER'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 36) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (36, N'LEXUS'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 38) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (38, N'MARCOPOLO'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 39) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (39, N'MASERATI'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 40) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (40, N'MATRA'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 41) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (41, N'MAZDA'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 42) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (42, N'MERCEDES-BENZ'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 43) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (43, N'MERCURY'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 44) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (44, N'MINI'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 45) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (45, N'MITSUBISHI'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 46) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (46, N'MIURA'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 47) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (47, N'NAVISTAR'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 48) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (48, N'NISSAN'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 49) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (49, N'PEUGEOT'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 50) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (50, N'PLYMOUTH'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 51) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (51, N'PONTIAC'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 52) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (52, N'PORSCHE'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 53) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (53, N'PUMA-ALFA'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 54) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (54, N'RENAULT'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 55) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (55, N'ROVER'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 56) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (56, N'SAAB'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 57) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (57, N'SCANIA'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 58) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (58, N'SATURN'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 61) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (61, N'SEAT'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 62) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (62, N'SMART'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 63) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (63, N'SSANGYONG'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 64) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (64, N'SUBARU'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 65) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (65, N'SUZUKI'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 66) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (66, N'TOYOTA'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 67) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (67, N'TROLLER'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 68) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (68, N'VOLKSWAGEN'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 69) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (69, N'VOLVO'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 72) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (72, N'SEMI-REBOQUE'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 74) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (74, N'APRILIA'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 75) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (75, N'ATALA'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 76) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (76, N'BRANDY'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 77) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (77, N'BUELL'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 79) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (79, N'CAGIVA'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 80) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (80, N'CALOI'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 81) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (81, N'DAELIM'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 82) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (82, N'DUCATI'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 83) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (83, N'EMME'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 85) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (85, N'HARLEY-DAVIDSON'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 86) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (86, N'HUSQVARNA'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 88) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (88, N'KAHENA'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 89) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (89, N'KASINSKI'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 90) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (90, N'KAWASAKI'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 91) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (91, N'KTM'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 92) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (92, N'L AQUILA'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 93) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (93, N'MOTO GUZZI'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 95) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (95, N'MV AGUSTA'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 96) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (96, N'MVK'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 98) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (98, N'ORCA'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 99) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (99, N'PIAGGIO'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 100) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (100, N'RSANYANG'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 101) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (101, N'SUNDOWN'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 102) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (102, N'TRAXX'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 103) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (103, N'TRIUMPH'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 104) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (104, N'VENTO'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 105) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (105, N'YAMAHA'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 108) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (108, N'MIZA'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 109) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (109, N'GREEN'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 110) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (110, N'SHINERAY'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 111) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (111, N'MAHINDRA'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 112) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (112, N'CHANA'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 113) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (113, N'MALAGUTI'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 114) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (114, N'DAFRA'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 117) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (117, N'HUSABERG'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 118) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (118, N'AMAZONAS'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 119) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (119, N'FYM'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 120) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (120, N'BIMOTA'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 121) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (121, N'BRP'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 123) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (123, N'LAMBORGHINI'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 124) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (124, N'LOBINI'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 125) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (125, N'HAFEI'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 126) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (126, N'JINBEI'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 128) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (128, N'CHERY'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 129) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (129, N'SINOTRUK'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 130) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (130, N'TAC'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 131) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (131, N'DAYUN'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 132) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (132, N'LIFAN'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 133) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (133, N'ASTON MARTIN'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 134) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (134, N'JAC'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 135) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (135, N'JOHNNYPAG'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 137) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (137, N'CHANGAN'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 139) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (139, N'MAN'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 140) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (140, N'RELY'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 141) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (141, N'RAM'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 142) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (142, N'MOTORINO'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 144) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (144, N'GEELY'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 145) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (145, N'DAF'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 147) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (147, N'INDIAN'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 148) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (148, N'FOTON'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 150) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (150, N'ROYAL ENFIELD'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 151) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (151, N'KYMCO'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 152) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (152, N'MG'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 153) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (153, N'HAOJUE'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 154) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (154, N'AM GEN'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 155) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (155, N'ASIA MOTORS'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 156) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (156, N'CROSS LANDER'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 157) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (157, N'FIBRAVAN'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 158) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (158, N'FYBER'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 159) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (159, N'GREAT WALL'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 160) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (160, N'KIA MOTORS'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 161) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (161, N'LOTUS'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 162) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (162, N'ROLLS-ROYCE'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 163) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (163, N'WAKE'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 164) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (164, N'WALK'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 165) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (165, N'ADLY'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 166) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (166, N'BUGGY'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 167) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (167, N'CBT JIPE'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 168) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (168, N'BAJAJ'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 169) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (169, N'BEE'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 170) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (170, N'BENELLI'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 171) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (171, N'BETA'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 172) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (172, N'BRAVA'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 173) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (173, N'BUENO'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 174) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (174, N'BYCRISTO'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 175) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (175, N'DAYANG'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 176) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (176, N'DERBI'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 177) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (177, N'FOX'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 178) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (178, N'GARINNI'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 179) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (179, N'GAS GAS'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 180) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (180, N'HAOBAO'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 181) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (181, N'HARTFORD'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 182) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (182, N'HERO'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 183) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (183, N'IROS'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 184) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (184, N'JIAPENG VOLCANO'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 185) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (185, N'JONNY'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 186) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (186, N'LANDUM'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 187) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (187, N'LAVRALE'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 188) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (188, N'LERIVO'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 189) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (189, N'LON-V'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 190) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (190, N'MAGRAO TRICICLOS'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 191) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (191, N'MOTOCAR'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 192) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (192, N'MRX'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 193) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (193, N'PEGASSI'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 194) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (194, N'REGAL RAPTOR'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 195) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (195, N'RIGUETE'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 196) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (196, N'SIAMOTO'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 197) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (197, N'TARGOS'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 198) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (198, N'TIGER'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 199) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (199, N'WUYANG'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 200) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (200, N'CICCOBUS'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 201) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (201, N'EFFA-JMC'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 202) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (202, N'MASCARELLO'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 203) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (203, N'MAXIBUS'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 204) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (204, N'NEOBUS'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 205) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (205, N'SAAB-SCANIA'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 206) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (206, N'SHACMAN'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 207) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (207, N'SINOTRUK'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 208) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (208, N'ITAPEMIRIM'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 209) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (209, N'RANDON'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 210) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (210, N'ALFA ROMEO'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 211) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (211, N'FACCHINI'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 212) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (212, N'MASSEY FERGUSON'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 213) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (213, N'NEW HOLLAN'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 214) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (214, N'NOMA'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 215) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (215, N'CATERPILLAR'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 216) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (216, N'GUERRA'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 217) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (217, N'RECRUSUL'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 218) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (218, N'GUERRA'); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 219) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (219, N'GLOOV'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200219_06.SQL b/Decompiler/Gestor.Application.Migration.Files.20200219_06.SQL new file mode 100644 index 0000000..cde991c --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200219_06.SQL @@ -0,0 +1,544 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 1) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (1,5, N'Veiculo (Casco)', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 10) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (10,1, N'Roubo e/ou Furto Qualificado de Bens', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 1062) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (1062,3, N'PORTOES', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 1063) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (1063,3, N'ALAGAMENTO', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 1064) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (1064,3, N'CHUVEIROS', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 1065) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (1065,3, N'VAZAMENTO', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 1066) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (1066,3, N'DANOS MORAIS', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 1097) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (1097,5, N'Extensão Perímetro-Auto', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 11) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (11,1, N'Vendaval, Furacão, Ciclone, Tornado,...', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 12) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (12,1, N'Vidros, Espelhos e Mármores', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 1257) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (1257,37, N'Danos Estéticos Causados a Passageiros', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 1258) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (1258,37, N'Danos Estéticos Causados a Terceiros não Transportados', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 1299) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (1299,39, N'BÁSICA', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 13) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (13,1, N'Responsabilidade Civil Familiar', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 1300) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (1300,39, N'DESPESAS EXTRAORDINÁRIAS', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 1302) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (1302,39, N'DESPESAS COM DESENTULHO', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 1304) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (1304,39, N'OBRAS TEMPORÁRIAS', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 1306) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (1306,39, N'DESPESAS COM SALVAMENTO E CONTENÇÃO', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 1307) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (1307,39, N'DANOS MORAIS DECORRENTES DE RESPONSABILIDADE', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 1308) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (1308,39, N'RESPONSABILIDADE CIVIL SEM FUNDAÇÃO E CRUZADA', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 1309) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (1309,39, N'PROPRIEDADE PRÉ EXISTENTE NO CANTEIRO DE OBRA', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 1310) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (1310,39, N'EQUIPAMENTOS MÓVEIS E ESTACIONÁRIOS', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 1315) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (1315,39, N'RESPONSABILIDADE CIVIL EMPREGADOR', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 134) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (134,4, N'Roubo e/ou Furto Qualificado de Bens', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 135) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (135,4, N'Danos Materiais', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 136) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (136,4, N'Danos Corporais', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 137) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (137,4, N'Responsabilidade Civil', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 138) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (138,4, N'Danos Elétricos', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 14) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (14,1, N'Salvamento, Limpeza e/ou Desentulho', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 140) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (140,4, N'Básica', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 1422) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (1422,27, N'Básica – Obras Civis em Construção e Instalação e Montagem', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 16) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (16,5, N'Objetos Transportados', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 1609) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (1609,28, N'Notários e Registradores', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 1611) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (1611,28, N'Danos a Reputação', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 17) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (17,5, N'Danos Morais', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 18) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (18,5, N'Decessos', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 182) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (182,19, N'Propriedades Circunvizinhas', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 19) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (19,5, N'Assistência (Guincho)', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 193) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (193,6, N'Invalidez Permanente Por Doença Funcional', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 2) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (2,5, N'Danos Materiais', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 20) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (20,5, N'Assistência (Casa)', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 204) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (204,15, N'Incêndio', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 205) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (205,15, N'Danos Elétricos', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 21) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (21,5, N'Kit Gás', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 218) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (218,15, N'Aluguel', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 22) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (22,5, N'Blindagem', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 220) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (220,15, N'Energia Elétrica / Luz', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 224) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (224,18, N'Pinturas Interna', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 228) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (228,18, N'Danos ao Imovel', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 23) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (23,5, N'Acessórios', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 230) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (230,15, N'I.P.T.U.', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 232) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (232,15, N'Multa p/Resc.Contratual', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 233) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (233,15, N'Danos ao Imovel', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 234) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (234,4, N'Complemento Pagamento', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 24) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (24,5, N'Despesas Extras', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 240) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (240,1, N'Danos Rompimento de Tubulações', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 25) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (25,5, N'Carroceria', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 250) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (250,18, N'Luz', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 255) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (255,5, N'TETO SOLAR', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 256) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (256,6, N'Indenização Especial por Acidente', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 26) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (26,1, N'Danos causados por Veículos', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 264) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (264,4, N'Morte Acidental', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 265) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (265,4, N'Invalidez Permanente por Acidente', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 266) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (266,4, N'Despesas Médicas/Hospitalares', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 267) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (267,4, N'Extravio de bagagem', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 27) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (27,1, N'Despesas com Aluguel', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 28) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (28,2, N'Incêndio, Raio, Explosão, Tumultos', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 280) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (280,5, N'Roubo/Furto', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 29) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (29,2, N'Danos Elétricos', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 3) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (3,5, N'Danos Corporais', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 30) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (30,2, N'Vidros, Espelhos e Mármores', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 304) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (304,23, N'Cancelamento de Viagem', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 305) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (305,23, N'Interrupção de Viagem', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 31) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (31,2, N'Despesas com Aluguel', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 313) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (313,1, N'RC - Familiar', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 315) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (315,1, N'Ruptura de Tubulacoes', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 316) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (316,1, N'Impacto de Veiculo', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 317) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (317,1, N'Fumaca', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 32) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (32,2, N'Responsabilidade Civil', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 33) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (33,2, N'Roubo e/ou Furto Qualificado de Bens', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 34) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (34,1, N'Danos causados por Água', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 35) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (35,1, N'Perda de Documentos', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 351) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (351,23, N'Traslado de Corpo', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 352) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (352,23, N'Traslado Médico ', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 353) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (353,23, N'Regresso Sanitário', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 354) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (354,23, N'Hospedagem após Alta Hospitalar', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 357) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (357,23, N'Despesas Farmacêuticas Despesas Jurídicas', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 358) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (358,23, N'Pagamento de Fiança', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 36) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (36,5, N'Garantia 0KM', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 361) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (361,23, N'Despesas Médico Hospitalares e Odontológicas', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 362) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (362,23, N'Assistência Funeral Viagem', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 37) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (37,5, N'Despesas Médicas/Hospitalares', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 381) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (381,23, N'Hospedagem Acompanhante – Hospitalização Prolongada', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 39) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (39,1, N'Desmoronamento', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 4) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (4,5, N'Morte', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 40) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (40,1, N'Acidentes Domésticos', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 408) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (408,3, N'IPA', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 41) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (41,2, N'Vendaval, Furacão, Ciclone, Tornado,...', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 42) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (42,2, N'Despesas Fixas', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 432) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (432,18, N'Conteúdo', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 44) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (44,2, N'Tumultos, Greves, Lock-Out, ...', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 46) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (46,2, N'Equipamentos Eletrônicos', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 47) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (47,2, N'Equipamentos Estacionários', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 475) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (475,3, N'Auxílio Alimentação', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 48) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (48,2, N'Equipamentos Móveis', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 49) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (49,2, N'Assistência Empresarial', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 5) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (5,5, N'Invalidez', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 50) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (50,2, N'Perda de Documentos', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 51) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (51,2, N'Danos causados por Veículos', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 53) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (53,5, N'Acidentes Pessoais', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 54) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (54,5, N'Equipamentos', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 56) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (56,6, N'Morte', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 561) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (561,2, N'RESP. CIVIL GUARDA DE VEICULO', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 565) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (565,28, N'Propriedade Intelectual', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 569) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (569,28, N'Comparecimento ao Tribunal', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 57) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (57,6, N'Morte Acidental', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 58) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (58,6, N'Invalidez Permanente por Acidente', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 59) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (59,6, N'Funeral - Decessos', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 6) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (6,5, N'Vidros', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 64) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (64,3, N'Incêndio, Raio, Explosão', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 65) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (65,3, N'Danos Elétricos', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 66) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (66,3, N'Vidros, Espelhos e Mármores', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 69) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (69,3, N'Roubo e/ou Furto Qualificado de Bens', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 7) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (7,5, N'Carro Reserva', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 70) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (70,3, N'Vendaval, Furacão, Ciclone, Tornado,...', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 8) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (8,1, N'Incêndio, Raio, Explosão', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 80) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (80,1, N'Assistência 24 horas', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 819) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (819,28, N'Responsabilidade Civil Profissional', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 82) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (82,2, N'Operações', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 821) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (821,28, N'Ato Desonesto de Empregados', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 83) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (83,2, N'Empregador', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 85) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (85,2, N'Lucros Cessantes', 0); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 875) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (875,8, N'COBERTURA BÁSICA AMPLA A', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 9) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (9,1, N'Danos Elétricos', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 904) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (904,8, N'COBERTURA ADICIONAL DE RISCOS DE GREVES', 1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 909) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (909,8, N'COBERTURA ADICIONAL PARA MERCADORIAS TRANSPORTADAS EM VEÍCULOS DO SEGURADO', 1); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200311_07.SQL b/Decompiler/Gestor.Application.Migration.Files.20200311_07.SQL new file mode 100644 index 0000000..99220f5 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200311_07.SQL @@ -0,0 +1,14 @@ +IF EXISTS(SELECT 1 FROM [dbo].[cliente] WHERE [idempresa] IS NULL) +BEGIN + UPDATE [dbo].[cliente] SET [idempresa] = 1 WHERE [idempresa] IS NULL; +END + +IF EXISTS(SELECT 1 FROM [dbo].[parcela] WHERE [idempresa] IS NULL) +BEGIN + UPDATE [dbo].[parcela] SET [idempresa] = 1 WHERE [idempresa] IS NULL; +END + +IF EXISTS(SELECT 1 FROM [dbo].[parcela] WHERE [idempresa] IS NULL) +BEGIN + UPDATE [dbo].[parcela] SET [idempresa] = 1 WHERE [idempresa] IS NULL; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200311_08.SQL b/Decompiler/Gestor.Application.Migration.Files.20200311_08.SQL new file mode 100644 index 0000000..0c1d85c --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200311_08.SQL @@ -0,0 +1,8 @@ +IF EXISTS(SELECT 1 FROM [dbo].[item] WHERE [cancelado] IS NULL) +BEGIN + UPDATE [dbo].[item] SET [cancelado] = 0 WHERE [cancelado] IS NULL; +END +IF EXISTS(SELECT 1 FROM [dbo].[item] WHERE [sinistrado] IS NULL) +BEGIN + UPDATE [dbo].[item] SET [sinistrado] = 0 WHERE [sinistrado] IS NULL; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200403_09.SQL b/Decompiler/Gestor.Application.Migration.Files.20200403_09.SQL new file mode 100644 index 0000000..b201157 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200403_09.SQL @@ -0,0 +1,24 @@ +IF COL_LENGTH('[dbo].[cliente]', 'inativo') IS NULL +BEGIN + ALTER TABLE [dbo].[cliente] ADD inativo CHAR(1) NULL; +END + +IF COL_LENGTH('[dbo].[cliente]', 'cri_data') IS NULL +BEGIN + ALTER TABLE [dbo].[cliente] ADD cri_data DATETIME2 NULL; +END + +IF COL_LENGTH('[dbo].[cliente]', 'usuariocriacao') IS NULL +BEGIN + ALTER TABLE [dbo].[cliente] ADD usuariocriacao BIGINT NULL; +END + +IF COL_LENGTH('[dbo].[cliente]', 'atu_data') IS NULL +BEGIN + ALTER TABLE [dbo].[cliente] ADD atu_data DATETIME2 NULL; +END + +IF COL_LENGTH('[dbo].[cliente]', 'usuarioalteracao') IS NULL +BEGIN + ALTER TABLE [dbo].[cliente] ADD usuarioalteracao BIGINT NULL; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200403_10.SQL b/Decompiler/Gestor.Application.Migration.Files.20200403_10.SQL new file mode 100644 index 0000000..ee55f30 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200403_10.SQL @@ -0,0 +1,16 @@ +IF COL_LENGTH('[dbo].[documento]', 'banco') IS NULL +BEGIN + ALTER TABLE [dbo].[documento] ADD banco VARCHAR(255) NULL; +END +IF COL_LENGTH('[dbo].[documento]', 'idresponsavel') IS NULL +BEGIN + ALTER TABLE [dbo].[documento] ADD idresponsavel BIGINT NULL; +END +IF COL_LENGTH('[dbo].[documento]', 'recto') IS NULL +BEGIN + ALTER TABLE [dbo].[documento] ADD recto CHAR(1) NULL; +END +IF COL_LENGTH('[dbo].[documento]', 'final_vig') IS NULL +BEGIN + ALTER TABLE [dbo].[documento] ADD final_vig CHAR(1) NULL; +END diff --git a/Decompiler/Gestor.Application.Migration.Files.20200403_11.SQL b/Decompiler/Gestor.Application.Migration.Files.20200403_11.SQL new file mode 100644 index 0000000..5e9ef96 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200403_11.SQL @@ -0,0 +1,29 @@ +IF COL_LENGTH('[dbo].[item]', 'idramo') IS NULL +BEGIN + ALTER TABLE [dbo].[item] ADD idramo BIGINT NULL; +END + +IF COL_LENGTH('[dbo].[item]', 'datacriacao') IS NULL +BEGIN + ALTER TABLE [dbo].[item] ADD datacriacao DATETIME2 NULL; +END + +IF COL_LENGTH('[dbo].[item]', 'usuariocriacao') IS NULL +BEGIN + ALTER TABLE [dbo].[item] ADD usuariocriacao BIGINT NULL; +END + +IF COL_LENGTH('[dbo].[item]', 'dataalteracao') IS NULL +BEGIN + ALTER TABLE [dbo].[item] ADD dataalteracao DATETIME2 NULL; +END + +IF COL_LENGTH('[dbo].[item]', 'usuarioalteracao') IS NULL +BEGIN + ALTER TABLE [dbo].[item] ADD usuarioalteracao BIGINT NULL; +END + +IF COL_LENGTH('[dbo].[item]', 'tipoendosso') IS NULL +BEGIN + ALTER TABLE [dbo].[item] ADD tipoendosso INTEGER NULL; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200403_12.SQL b/Decompiler/Gestor.Application.Migration.Files.20200403_12.SQL new file mode 100644 index 0000000..83c76e7 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200403_12.SQL @@ -0,0 +1,19 @@ +IF COL_LENGTH('[dbo].[parcela]', 'cri_data') IS NULL +BEGIN + ALTER TABLE [dbo].[parcela] ADD cri_data DATETIME2 NULL; +END + +IF COL_LENGTH('[dbo].[parcela]', 'usuariocriacao') IS NULL +BEGIN + ALTER TABLE [dbo].[parcela] ADD usuariocriacao BIGINT NULL; +END + +IF COL_LENGTH('[dbo].[parcela]', 'atu_data') IS NULL +BEGIN + ALTER TABLE [dbo].[parcela] ADD atu_data DATETIME2 NULL; +END + +IF COL_LENGTH('[dbo].[parcela]', 'usuarioalteracao') IS NULL +BEGIN + ALTER TABLE [dbo].[parcela] ADD usuarioalteracao BIGINT NULL; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200403_13.SQL b/Decompiler/Gestor.Application.Migration.Files.20200403_13.SQL new file mode 100644 index 0000000..bf2c0e4 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200403_13.SQL @@ -0,0 +1,19 @@ +IF COL_LENGTH('[dbo].[auto]', 'datacriacao') IS NULL +BEGIN + ALTER TABLE [dbo].[auto] ADD datacriacao DATETIME2 NULL; +END + +IF COL_LENGTH('[dbo].[auto]', 'usuariocriacao') IS NULL +BEGIN + ALTER TABLE [dbo].[auto] ADD usuariocriacao BIGINT NULL; +END + +IF COL_LENGTH('[dbo].[auto]', 'dataalteracao') IS NULL +BEGIN + ALTER TABLE [dbo].[auto] ADD dataalteracao DATETIME2 NULL; +END + +IF COL_LENGTH('[dbo].[auto]', 'usuarioalteracao') IS NULL +BEGIN + ALTER TABLE [dbo].[auto] ADD usuarioalteracao BIGINT NULL; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200403_14.SQL b/Decompiler/Gestor.Application.Migration.Files.20200403_14.SQL new file mode 100644 index 0000000..44da860 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200403_14.SQL @@ -0,0 +1,29 @@ +IF COL_LENGTH('[dbo].[resempco]', 'tiporesidencia') IS NULL +BEGIN + ALTER TABLE [dbo].[resempco] ADD tiporesidencia NUMERIC(1,0) NULL; +END + +IF COL_LENGTH('[dbo].[resempco]', 'obs') IS NULL +BEGIN + ALTER TABLE [dbo].[resempco] ADD obs VARCHAR(MAX) NULL; +END + +IF COL_LENGTH('[dbo].[resempco]', 'datacriacao') IS NULL +BEGIN + ALTER TABLE [dbo].[resempco] ADD datacriacao DATETIME2 NULL; +END + +IF COL_LENGTH('[dbo].[resempco]', 'usuariocriacao') IS NULL +BEGIN + ALTER TABLE [dbo].[resempco] ADD usuariocriacao BIGINT NULL; +END + +IF COL_LENGTH('[dbo].[resempco]', 'dataalteracao') IS NULL +BEGIN + ALTER TABLE [dbo].[resempco] ADD dataalteracao DATETIME2 NULL; +END + +IF COL_LENGTH('[dbo].[resempco]', 'usuarioalteracao') IS NULL +BEGIN + ALTER TABLE [dbo].[resempco] ADD usuarioalteracao BIGINT NULL; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200403_15.SQL b/Decompiler/Gestor.Application.Migration.Files.20200403_15.SQL new file mode 100644 index 0000000..f67a88f --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200403_15.SQL @@ -0,0 +1,19 @@ +IF COL_LENGTH('[dbo].[sinistro]', 'datacriacao') IS NULL +BEGIN + ALTER TABLE [dbo].[sinistro] ADD datacriacao DATETIME2 NULL; +END + +IF COL_LENGTH('[dbo].[sinistro]', 'usuariocriacao') IS NULL +BEGIN + ALTER TABLE [dbo].[sinistro] ADD usuariocriacao BIGINT NULL; +END + +IF COL_LENGTH('[dbo].[sinistro]', 'dataalteracao') IS NULL +BEGIN + ALTER TABLE [dbo].[sinistro] ADD dataalteracao DATETIME2 NULL; +END + +IF COL_LENGTH('[dbo].[sinistro]', 'usuarioalteracao') IS NULL +BEGIN + ALTER TABLE [dbo].[sinistro] ADD usuarioalteracao BIGINT NULL; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200403_16.SQL b/Decompiler/Gestor.Application.Migration.Files.20200403_16.SQL new file mode 100644 index 0000000..4be0a0c --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200403_16.SQL @@ -0,0 +1,19 @@ +IF COL_LENGTH('[dbo].[cobertura]', 'datacriacao') IS NULL +BEGIN + ALTER TABLE [dbo].[cobertura] ADD datacriacao DATETIME2 NULL; +END + +IF COL_LENGTH('[dbo].[cobertura]', 'usuariocriacao') IS NULL +BEGIN + ALTER TABLE [dbo].[cobertura] ADD usuariocriacao BIGINT NULL; +END + +IF COL_LENGTH('[dbo].[cobertura]', 'dataalteracao') IS NULL +BEGIN + ALTER TABLE [dbo].[cobertura] ADD dataalteracao DATETIME2 NULL; +END + +IF COL_LENGTH('[dbo].[cobertura]', 'usuarioalteracao') IS NULL +BEGIN + ALTER TABLE [dbo].[cobertura] ADD usuarioalteracao BIGINT NULL; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200403_17.SQL b/Decompiler/Gestor.Application.Migration.Files.20200403_17.SQL new file mode 100644 index 0000000..46884ac --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200403_17.SQL @@ -0,0 +1,19 @@ +IF COL_LENGTH('[dbo].[extrato]', 'datacriacao') IS NULL +BEGIN + ALTER TABLE [dbo].[extrato] ADD datacriacao DATETIME2 NULL; +END + +IF COL_LENGTH('[dbo].[extrato]', 'usuariocriacao') IS NULL +BEGIN + ALTER TABLE [dbo].[extrato] ADD usuariocriacao BIGINT NULL; +END + +IF COL_LENGTH('[dbo].[extrato]', 'dataalteracao') IS NULL +BEGIN + ALTER TABLE [dbo].[extrato] ADD dataalteracao DATETIME2 NULL; +END + +IF COL_LENGTH('[dbo].[extrato]', 'usuarioalteracao') IS NULL +BEGIN + ALTER TABLE [dbo].[extrato] ADD usuarioalteracao BIGINT NULL; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200403_18.SQL b/Decompiler/Gestor.Application.Migration.Files.20200403_18.SQL new file mode 100644 index 0000000..976212a --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200403_18.SQL @@ -0,0 +1,4 @@ +IF COL_LENGTH('[dbo].[cliendereco]', 'padrao') IS NULL +BEGIN + ALTER TABLE [dbo].[cliendereco] ADD padrao CHAR(1) NULL; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200403_19.SQL b/Decompiler/Gestor.Application.Migration.Files.20200403_19.SQL new file mode 100644 index 0000000..2cd86f2 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200403_19.SQL @@ -0,0 +1,14 @@ +IF COL_LENGTH('[dbo].[clitelefone]', 'padrao') IS NULL +BEGIN + ALTER TABLE [dbo].[clitelefone] ADD padrao CHAR(1) NULL; +END + +IF COL_LENGTH('[dbo].[clitelefone]', 'operadora') IS NULL +BEGIN + ALTER TABLE [dbo].[clitelefone] ADD operadora NUMERIC(5,0) NULL; +END + +IF COL_LENGTH('[dbo].[clitelefone]', 'ramal') IS NULL +BEGIN + ALTER TABLE [dbo].[clitelefone] ADD ramal VARCHAR(5) NULL; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200403_20.SQL b/Decompiler/Gestor.Application.Migration.Files.20200403_20.SQL new file mode 100644 index 0000000..3fa84a4 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200403_20.SQL @@ -0,0 +1,4 @@ +IF COL_LENGTH('[dbo].[climail]', 'padrao') IS NULL +BEGIN + ALTER TABLE [dbo].[climail] ADD padrao CHAR(1) NULL; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200403_21.SQL b/Decompiler/Gestor.Application.Migration.Files.20200403_21.SQL new file mode 100644 index 0000000..df4427a --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200403_21.SQL @@ -0,0 +1,19 @@ +IF COL_LENGTH('[dbo].[vendedorparcela]', 'cri_data') IS NULL +BEGIN + ALTER TABLE [dbo].[vendedorparcela] ADD cri_data DATETIME2 NULL; +END + +IF COL_LENGTH('[dbo].[vendedorparcela]', 'usuariocriacao') IS NULL +BEGIN + ALTER TABLE [dbo].[vendedorparcela] ADD usuariocriacao BIGINT NULL; +END + +IF COL_LENGTH('[dbo].[vendedorparcela]', 'atu_data') IS NULL +BEGIN + ALTER TABLE [dbo].[vendedorparcela] ADD atu_data DATETIME2 NULL; +END + +IF COL_LENGTH('[dbo].[vendedorparcela]', 'usuarioalteracao') IS NULL +BEGIN + ALTER TABLE [dbo].[vendedorparcela] ADD usuarioalteracao BIGINT NULL; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200403_22.SQL b/Decompiler/Gestor.Application.Migration.Files.20200403_22.SQL new file mode 100644 index 0000000..8e42802 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200403_22.SQL @@ -0,0 +1,4 @@ +IF COL_LENGTH('[dbo].[perfil]', 'banco') IS NULL +BEGIN + ALTER TABLE [dbo].[perfil] ADD banco VARCHAR(3) NULL; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200403_23.SQL b/Decompiler/Gestor.Application.Migration.Files.20200403_23.SQL new file mode 100644 index 0000000..76c5ccc --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200403_23.SQL @@ -0,0 +1,19 @@ +IF COL_LENGTH('[dbo].[newarquivodigital]', 'datacriacao') IS NULL +BEGIN + ALTER TABLE [dbo].[newarquivodigital] ADD datacriacao DATETIME2 NULL; +END + +IF COL_LENGTH('[dbo].[newarquivodigital]', 'usuariocriacao') IS NULL +BEGIN + ALTER TABLE [dbo].[newarquivodigital] ADD usuariocriacao BIGINT NULL; +END + +IF COL_LENGTH('[dbo].[newarquivodigital]', 'dataalteracao') IS NULL +BEGIN + ALTER TABLE [dbo].[newarquivodigital] ADD dataalteracao DATETIME2 NULL; +END + +IF COL_LENGTH('[dbo].[newarquivodigital]', 'usuarioalteracao') IS NULL +BEGIN + ALTER TABLE [dbo].[newarquivodigital] ADD usuarioalteracao BIGINT NULL; +END diff --git a/Decompiler/Gestor.Application.Migration.Files.20200406_24.SQL b/Decompiler/Gestor.Application.Migration.Files.20200406_24.SQL new file mode 100644 index 0000000..393e57c --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200406_24.SQL @@ -0,0 +1,38 @@ +IF (NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'controlelog')) +BEGIN + +CREATE TABLE [dbo].[controlelog]( +[idcontrolelog] [bigint] IDENTITY(1,1) NOT NULL PRIMARY KEY, +[bdname] [varchar](255) NULL, +[tabela] [varchar](255) NULL); + +DECLARE @banco VARCHAR(255) = (SELECT DB_NAME()); + +INSERT INTO [dbo].[controlelog] VALUES (@banco, N'oldbacklog'); + +CREATE TABLE [dbo].[actionlog]( +[IDACTION] [bigint] IDENTITY(1,1) NOT NULL PRIMARY KEY, +[IDEMPRESA] [bigint] NULL, +[FORM] [varchar](30) NULL, +[DESCRICAO] [varchar](50) NULL, +[ACAO] [varchar](200) NULL, +[IDNAME] [varchar](30) NULL, +[ID] [bigint] NULL, +[IDUSUARIO] [bigint] NULL, +[DATA] [datetime] NULL, +[historico] [VARCHAR](MAX) NULL, +[maquina] [VARCHAR](100) NULL); + +CREATE TABLE [dbo].[oldbacklog]( +[IDBACKLOG] [bigint] IDENTITY(1,1) NOT NULL PRIMARY KEY, +[IDEMPRESA] [bigint] NULL, +[FORM] [varchar](30) NULL, +[DESCRICAO] [varchar](50) NULL, +[HISTORICO] [text] NULL, +[IDNAME] [varchar](30) NULL, +[ID] [bigint] NULL, +[INCLUINDO] [numeric](1, 0) NULL, +[IDUSUARIO] [bigint] NULL, +[DATA] [datetime] NULL); + +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200406_25.SQL b/Decompiler/Gestor.Application.Migration.Files.20200406_25.SQL new file mode 100644 index 0000000..cd14e5c --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200406_25.SQL @@ -0,0 +1,4 @@ +IF COL_LENGTH('[dbo].[empresa]', 'newad') IS NULL +BEGIN + ALTER TABLE [dbo].[empresa] ADD [newad] varchar(1) NULL; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200406_26.SQL b/Decompiler/Gestor.Application.Migration.Files.20200406_26.SQL new file mode 100644 index 0000000..531011c --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200406_26.SQL @@ -0,0 +1,4 @@ +IF COL_LENGTH('[dbo].[empresa]', 'newad') IS NOT NULL +BEGIN + UPDATE [dbo].[empresa] SET newad='1'; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200408_27.SQL b/Decompiler/Gestor.Application.Migration.Files.20200408_27.SQL new file mode 100644 index 0000000..7cd1ee1 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200408_27.SQL @@ -0,0 +1,19 @@ +IF COL_LENGTH('[dbo].[parcelaextrato]', 'datacriacao') IS NULL +BEGIN + ALTER TABLE [dbo].[parcelaextrato] ADD datacriacao DATETIME2 NULL; +END + +IF COL_LENGTH('[dbo].[parcelaextrato]', 'usuariocriacao') IS NULL +BEGIN + ALTER TABLE [dbo].[parcelaextrato] ADD usuariocriacao BIGINT NULL; +END + +IF COL_LENGTH('[dbo].[parcelaextrato]', 'dataalteracao') IS NULL +BEGIN + ALTER TABLE [dbo].[parcelaextrato] ADD dataalteracao DATETIME2 NULL; +END + +IF COL_LENGTH('[dbo].[parcelaextrato]', 'usuarioalteracao') IS NULL +BEGIN + ALTER TABLE [dbo].[parcelaextrato] ADD usuarioalteracao BIGINT NULL; +END diff --git a/Decompiler/Gestor.Application.Migration.Files.20200408_28.SQL b/Decompiler/Gestor.Application.Migration.Files.20200408_28.SQL new file mode 100644 index 0000000..2ea9c61 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200408_28.SQL @@ -0,0 +1,19 @@ +IF COL_LENGTH('[dbo].[granizo]', 'datacriacao') IS NULL +BEGIN + ALTER TABLE [dbo].[granizo] ADD datacriacao DATETIME2 NULL; +END + +IF COL_LENGTH('[dbo].[granizo]', 'usuariocriacao') IS NULL +BEGIN + ALTER TABLE [dbo].[granizo] ADD usuariocriacao BIGINT NULL; +END + +IF COL_LENGTH('[dbo].[granizo]', 'dataalteracao') IS NULL +BEGIN + ALTER TABLE [dbo].[granizo] ADD dataalteracao DATETIME2 NULL; +END + +IF COL_LENGTH('[dbo].[granizo]', 'usuarioalteracao') IS NULL +BEGIN + ALTER TABLE [dbo].[granizo] ADD usuarioalteracao BIGINT NULL; +END diff --git a/Decompiler/Gestor.Application.Migration.Files.20200408_29.SQL b/Decompiler/Gestor.Application.Migration.Files.20200408_29.SQL new file mode 100644 index 0000000..3419e2d --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200408_29.SQL @@ -0,0 +1,40 @@ +IF COL_LENGTH('[dbo].[coberturagranizo]', 'datacriacao') IS NULL +BEGIN + ALTER TABLE [dbo].[coberturagranizo] ADD datacriacao DATETIME2 NULL; +END + +IF COL_LENGTH('[dbo].[coberturagranizo]', 'usuariocriacao') IS NULL +BEGIN + ALTER TABLE [dbo].[coberturagranizo] ADD usuariocriacao BIGINT NULL; +END + +IF COL_LENGTH('[dbo].[coberturagranizo]', 'dataalteracao') IS NULL +BEGIN + ALTER TABLE [dbo].[coberturagranizo] ADD dataalteracao DATETIME2 NULL; +END + +IF COL_LENGTH('[dbo].[coberturagranizo]', 'usuarioalteracao') IS NULL +BEGIN + ALTER TABLE [dbo].[coberturagranizo] ADD usuarioalteracao BIGINT NULL; +END + +IF COL_LENGTH('[dbo].[riscosdiversos]', 'datacriacao') IS NULL +BEGIN + ALTER TABLE [dbo].[riscosdiversos] ADD datacriacao DATETIME2 NULL; +END + +IF COL_LENGTH('[dbo].[riscosdiversos]', 'usuariocriacao') IS NULL +BEGIN + ALTER TABLE [dbo].[riscosdiversos] ADD usuariocriacao BIGINT NULL; +END + +IF COL_LENGTH('[dbo].[riscosdiversos]', 'dataalteracao') IS NULL +BEGIN + ALTER TABLE [dbo].[riscosdiversos] ADD dataalteracao DATETIME2 NULL; +END + +IF COL_LENGTH('[dbo].[riscosdiversos]', 'usuarioalteracao') IS NULL +BEGIN + ALTER TABLE [dbo].[riscosdiversos] ADD usuarioalteracao BIGINT NULL; +END + diff --git a/Decompiler/Gestor.Application.Migration.Files.20200408_30.SQL b/Decompiler/Gestor.Application.Migration.Files.20200408_30.SQL new file mode 100644 index 0000000..4d4c039 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200408_30.SQL @@ -0,0 +1,19 @@ +IF COL_LENGTH('[dbo].[vida]', 'datacriacao') IS NULL +BEGIN + ALTER TABLE [dbo].[vida] ADD datacriacao DATETIME2 NULL; +END + +IF COL_LENGTH('[dbo].[vida]', 'usuariocriacao') IS NULL +BEGIN + ALTER TABLE [dbo].[vida] ADD usuariocriacao BIGINT NULL; +END + +IF COL_LENGTH('[dbo].[vida]', 'dataalteracao') IS NULL +BEGIN + ALTER TABLE [dbo].[vida] ADD dataalteracao DATETIME2 NULL; +END + +IF COL_LENGTH('[dbo].[vida]', 'usuarioalteracao') IS NULL +BEGIN + ALTER TABLE [dbo].[vida] ADD usuarioalteracao BIGINT NULL; +END diff --git a/Decompiler/Gestor.Application.Migration.Files.20200408_31.SQL b/Decompiler/Gestor.Application.Migration.Files.20200408_31.SQL new file mode 100644 index 0000000..4b03778 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200408_31.SQL @@ -0,0 +1,28 @@ +IF (NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'titular')) +BEGIN + +CREATE TABLE [dbo].[titular]( + [IDTITULAR] [bigint] IDENTITY(1,1) NOT NULL PRIMARY KEY, + [idvida] [bigint] NULL, + [plano] [varchar](120) NULL, + [nome] [varchar](120) NULL, + [nascimento] [date] NULL, + [CGCCPF] [varchar](18) NULL, + [certificado] [varchar](30) NULL, + [matricula] [varchar](30) NULL, + [capital] [numeric](12, 2) NULL, + [premio] [numeric](8, 2) NULL, + [usuariocriacao] [bigint] NULL, + [usuarioalteracao] [bigint] NULL, + [datacriacao] [datetime] NULL, + [dataalteracao] [datetime] NULL, + [idtitularcopiado] [bigint] NULL, + [saida] [date] NULL, + [obs] [varchar](max) NULL, + [RG] [varchar](13) NULL, + [emissao] [date] NULL, + [rguf] [varchar](2) NULL, + [entrada] [date] NULL); + +END + diff --git a/Decompiler/Gestor.Application.Migration.Files.20200408_32.SQL b/Decompiler/Gestor.Application.Migration.Files.20200408_32.SQL new file mode 100644 index 0000000..027e5a0 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200408_32.SQL @@ -0,0 +1,34 @@ + +IF (NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'beneficiario')) +BEGIN + +CREATE TABLE [dbo].[beneficiario]( + [IDBENEFICIARIO] [bigint] IDENTITY(1,1) NOT NULL PRIMARY KEY, + [idtitular] [bigint] NULL, + [idparentesco] [bigint] NULL, + [nome] [varchar](120) NULL, + [CEP] [varchar](10) NULL, + [ENDERECO] [varchar](60) NULL, + [NUMERO] [varchar](5) NULL, + [CIDADE] [varchar](30) NULL, + [UF] [varchar](2) NULL, + [BAIRRO] [varchar](60) NULL, + [CGCCPF] [varchar](18) NULL, + [RG] [varchar](13) NULL, + [emissao] [date] NULL, + [rguf] [varchar](2) NULL, + [beneficio] [numeric](6, 2) NULL, + [usuariocriacao] [bigint] NULL, + [usuarioalteracao] [bigint] NULL, + [datacriacao] [datetime] NULL, + [dataalteracao] [datetime] NULL, + [complemento] [varchar](30) NULL, + [saida] [date] NULL, + [obs] [varchar](max) NULL, + [idprofissao] [bigint] NULL, + [iditem] [bigint] NULL, + [entrada] [date] NULL, + [porcentagem] [numeric](6, 2) NULL, + [dtnasc] [date] NULL); + +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200419_33.SQL b/Decompiler/Gestor.Application.Migration.Files.20200419_33.SQL new file mode 100644 index 0000000..7b6fe28 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200419_33.SQL @@ -0,0 +1,4 @@ +IF COL_LENGTH('[dbo].[controledbad]', 'tabela') IS NULL +BEGIN + ALTER TABLE [dbo].[controledbad] ADD tabela VARCHAR(255) NULL; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200419_34.SQL b/Decompiler/Gestor.Application.Migration.Files.20200419_34.SQL new file mode 100644 index 0000000..a9761dd --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200419_34.SQL @@ -0,0 +1,4 @@ +IF EXISTS(SELECT 1 FROM [dbo].[controledbad] WHERE [tabela] IS NULL) +BEGIN + UPDATE [controledbad] SET [tabela] = N'arquivodigital' WHERE [tabela] IS NULL; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200430_35.SQL b/Decompiler/Gestor.Application.Migration.Files.20200430_35.SQL new file mode 100644 index 0000000..e6f919d --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200430_35.SQL @@ -0,0 +1,4 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Meta') AND COL_LENGTH('[dbo].[Meta]', 'IdSeguradora') IS NOT NULL +BEGIN + ALTER TABLE [dbo].[Meta] ALTER COLUMN IdSeguradora BIGINT NULL; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200505_36.SQL b/Decompiler/Gestor.Application.Migration.Files.20200505_36.SQL new file mode 100644 index 0000000..35fffa4 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200505_36.SQL @@ -0,0 +1,4 @@ +IF COL_LENGTH('[dbo].[extratoconfig]', 'codigocia') IS NULL +BEGIN + ALTER TABLE [dbo].[extratoconfig] ADD codigocia VARCHAR(20) NULL; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200505_37.SQL b/Decompiler/Gestor.Application.Migration.Files.20200505_37.SQL new file mode 100644 index 0000000..b0bf10e --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200505_37.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 291) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (291, N'ITAU SEGUROS DE AUTO E RESIDNCIA S/A', 1, 2); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200505_38.SQL b/Decompiler/Gestor.Application.Migration.Files.20200505_38.SQL new file mode 100644 index 0000000..c5eb8f8 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200505_38.SQL @@ -0,0 +1,9 @@ +IF COL_LENGTH('[dbo].[documento]', 'atu_data') IS NULL +BEGIN + ALTER TABLE [dbo].[documento] ADD atu_data DATETIME2 NULL; +END + +IF COL_LENGTH('[dbo].[documento]', 'usuarioalteracao') IS NULL +BEGIN + ALTER TABLE [dbo].[documento] ADD usuarioalteracao BIGINT NULL; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200505_39.SQL b/Decompiler/Gestor.Application.Migration.Files.20200505_39.SQL new file mode 100644 index 0000000..4b55cf6 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200505_39.SQL @@ -0,0 +1,14 @@ +IF (NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'averbacao')) +BEGIN + CREATE TABLE [dbo].[averbacao]( + [idaverbacao] [bigint] IDENTITY(1,1) NOT NULL PRIMARY KEY, + [idparcela] [bigint] NULL, + [origem] [varchar](250) NULL, + [destino] [varchar](250) NULL, + [movimento] [numeric](20, 2) NULL, + [premio] [numeric](15, 2) NULL, + [usuariocriacao] [bigint] NULL, + [usuarioalteracao] [bigint] NULL, + [datacriacao] [datetime] NULL, + [dataalteracao] [datetime] NULL); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200506_40.SQL b/Decompiler/Gestor.Application.Migration.Files.20200506_40.SQL new file mode 100644 index 0000000..5df5db0 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200506_40.SQL @@ -0,0 +1,12 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 272) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (272, N'ICATU CAPITALIZAÇÃO S.A.', 1, 2); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 484) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (484, N'SUL AMERICA SEGUROS DE PESSOAS E PREVID', 1, 2); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ramo] WHERE [IDRAMO] = 62) +BEGIN + INSERT INTO [dbo].[ramo] ([IDRAMO],[NOME],[IOF],[FATURA],[ATIVO]) VALUES (62, N'PRESTAMISTA',0.0738,0,0); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200512_41.SQL b/Decompiler/Gestor.Application.Migration.Files.20200512_41.SQL new file mode 100644 index 0000000..b92048a --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200512_41.SQL @@ -0,0 +1,62 @@ +IF (NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'mensagempadrao')) +BEGIN + + CREATE TABLE [dbo].[mensagempadrao] ( + [id] int NOT NULL PRIMARY KEY, + [conteudo] nvarchar(max) NULL, + [titulo] nvarchar(255) NULL, + [filter] nvarchar(max) NULL, + [field] nvarchar(100) NULL); + +END + +IF (NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'mensagem')) +BEGIN + + CREATE TABLE [dbo].[mensagem] ( + [id] bigint IDENTITY(1,1) NOT NULL PRIMARY KEY, + [conteudo] nvarchar(max) NULL, + [titulo] nvarchar(255) NULL, + [envio] datetime2 NULL, + [lido] bit NULL, + [idcliente] bigint NULL, + [idusuario] int NULL, + [idpadrao] int NULL); + +END + +IF (NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Device')) +BEGIN + + CREATE TABLE [dbo].[Device] ( + [Id] bigint IDENTITY(1,1) NOT NULL PRIMARY KEY, + [DeviceId] nvarchar(255) NULL, + [IdCliente] bigint NULL); + +END + +IF (NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'logconvite')) +BEGIN + + CREATE TABLE [dbo].[logconvite] ( + [id] int IDENTITY(1,1) NOT NULL, + [idcliente] bigint NULL, + [email] nvarchar(250) NULL, + [sent] bit NULL, + [idusuario] bigint NULL, + [data] datetime2 NULL); + +END + +IF (NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'mensagemenviada')) +BEGIN + + CREATE TABLE [dbo].[mensagemenviada] ( + [id] int IDENTITY(1,1) NOT NULL PRIMARY KEY, + [resposta] nvarchar(max) NULL, + [idusuario] int NULL, + [idpadrao] int NULL, + [data] datetime2 NULL); + + +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200512_42.SQL b/Decompiler/Gestor.Application.Migration.Files.20200512_42.SQL new file mode 100644 index 0000000..07585f9 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200512_42.SQL @@ -0,0 +1,19 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[mensagempadrao] WHERE [id] = 1) +BEGIN + INSERT INTO [dbo].[mensagempadrao] ([id], [conteudo], [titulo], [filter], [field]) VALUES (N'1', N'Prezado Cliente, informamos que sua apólice de seguro foi emitida. Acesse seu aplicativo e faça o download da sua Apólice. Obrigado.', N'Aviso de Apólice Emitida', N'SELECT DISTINCT c.idcliente FROM documento d INNER JOIN controle c on c.idcontrole = d.idcontrole WHERE (d.excluido IS NULL OR d.excluido != 1)', N'd.emissao'); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[mensagempadrao] WHERE [id] = 2) +BEGIN +INSERT INTO [dbo].[mensagempadrao] ([id], [conteudo], [titulo], [filter], [field]) VALUES (N'2', N'Prezado Cliente, informamos que seu seguros está prestes a vencer. Pedimos gentilmente que aguarde nosso contato para realizarmos sua renovação. Obrigado.', N'Aviso de Renovações', N'SELECT DISTINCT c.idcliente FROM controle c CROSS APPLY (SELECT TOP 1 excluido, vigencia2, iddocumento FROM documento WHERE idcontrole = c.idcontrole AND excluido IS NULL ORDER BY IDDOCUMENTO) d WHERE (d.excluido IS NULL OR d.excluido != 1)', N'd.vigencia2'); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[mensagempadrao] WHERE [id] = 3) +BEGIN +INSERT INTO [dbo].[mensagempadrao] ([id], [conteudo], [titulo], [filter], [field]) VALUES (N'3', N'Prezado Cliente, informamos que a parcela do seu seguro esta prestes a vencer. Pedimos atenção aos clientes que optaram pelo pagamento em boleto. Se optou por débito automático ou cartão, fique tranquilo o débito deve ser efetuado automaticamente.', N'Aviso de Vencimento de Parcela', N'SELECT DISTINCT c.idcliente FROM parcela p INNER JOIN documento d on d.iddocumento = p.iddocumento INNER JOIN controle c on c.idcontrole = d.idcontrole WHERE (d.excluido IS NULL OR d.excluido != 1)', N'p.vencto'); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[mensagempadrao] WHERE [id] = 4) +BEGIN +INSERT INTO [dbo].[mensagempadrao] ([id], [conteudo], [titulo], [filter], [field]) VALUES (N'4', NULL, N'Aviso Personalizado', N'SELECT DISTINCT c.idcliente FROM documento d INNER JOIN controle c on c.idcontrole = d.idcontrole WHERE (d.excluido IS NULL OR d.excluido != 1) AND c.IDCLIENTE IS NOT NULL', NULL) +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200512_43.SQL b/Decompiler/Gestor.Application.Migration.Files.20200512_43.SQL new file mode 100644 index 0000000..956b889 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200512_43.SQL @@ -0,0 +1,4 @@ +IF COL_LENGTH('[dbo].[usuario]', 'inativo') IS NULL +BEGIN + ALTER TABLE [dbo].[usuario] ADD inativo nvarchar(1) NULL; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200514_44.SQL b/Decompiler/Gestor.Application.Migration.Files.20200514_44.SQL new file mode 100644 index 0000000..10f93cd --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200514_44.SQL @@ -0,0 +1,4 @@ +IF COL_LENGTH('[dbo].[extratoconfig]', 'descricao') IS NULL +BEGIN + ALTER TABLE [dbo].[extratoconfig] ADD descricao nvarchar(255) NULL; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200514_45.SQL b/Decompiler/Gestor.Application.Migration.Files.20200514_45.SQL new file mode 100644 index 0000000..7ef7b2f --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200514_45.SQL @@ -0,0 +1,109 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[extratoconfig] WHERE [idciaseg] = 400 AND [codigocia] = '35') +BEGIN + INSERT INTO [dbo].[extratoconfig] ([idciaseg], [codigocia], [descricao], [ativo]) VALUES (400, N'35', N'Defasagem de Cheque', 1); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[extratoconfig] WHERE [idciaseg] = 400 AND [codigocia] = '45') +BEGIN +INSERT INTO [dbo].[extratoconfig] ([idciaseg], [codigocia], [descricao], [ativo]) VALUES (400, N'45', N'Comissão Fracionada', 1); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[extratoconfig] WHERE [idciaseg] = 400 AND [codigocia] = '69') +BEGIN +INSERT INTO [dbo].[extratoconfig] ([idciaseg], [codigocia], [descricao], [ativo]) VALUES (400, N'69', N'Comissão Total', 1); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[extratoconfig] WHERE [idciaseg] = 400 AND [codigocia] = '70') +BEGIN +INSERT INTO [dbo].[extratoconfig] ([idciaseg], [codigocia], [descricao], [ativo]) VALUES (400, N'70', N'Comissão Total Endosso', 1); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[extratoconfig] WHERE [idciaseg] = 400 AND [codigocia] = '107') +BEGIN +INSERT INTO [dbo].[extratoconfig] ([idciaseg], [codigocia], [descricao], [ativo]) VALUES (400, N'107' , N'Emissão Cartão Porto Seguro', 1); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[extratoconfig] WHERE [idciaseg] = 400 AND [codigocia] = '150') +BEGIN +INSERT INTO [dbo].[extratoconfig] ([idciaseg], [codigocia], [descricao], [ativo]) VALUES (400, N'150' , N'Cartão Porto Seguro', 1); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[extratoconfig] WHERE [idciaseg] = 400 AND [codigocia] = '5') +BEGIN +INSERT INTO [dbo].[extratoconfig] ([idciaseg], [codigocia], [descricao], [ativo]) VALUES (400, N'5', N'Acerto Taxa', 1); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[extratoconfig] WHERE [idciaseg] = 400 AND [codigocia] = '1') +BEGIN +INSERT INTO [dbo].[extratoconfig] ([idciaseg], [codigocia], [descricao], [ativo]) VALUES (400, N'1', N'Antecipação', 0); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[extratoconfig] WHERE [idciaseg] = 400 AND [codigocia] = '2') +BEGIN +INSERT INTO [dbo].[extratoconfig] ([idciaseg], [codigocia], [descricao], [ativo]) VALUES (400, N'2', N'Recuperação Antecipação', 0); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[extratoconfig] WHERE [idciaseg] = 400 AND [codigocia] = '21') +BEGIN +INSERT INTO [dbo].[extratoconfig] ([idciaseg], [codigocia], [descricao], [ativo]) VALUES (400, N'21', N'Acerto Fracionado', 0); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[extratoconfig] WHERE [idciaseg] = 259 AND [codigocia] = '1') +BEGIN +INSERT INTO [dbo].[extratoconfig] ([idciaseg], [codigocia], [descricao], [ativo]) VALUES (259, N'1', N'Parcela Especial', 0); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[extratoconfig] WHERE [idciaseg] = 400 AND [codigocia] = '149') +BEGIN +INSERT INTO [dbo].[extratoconfig] ([idciaseg], [codigocia], [descricao], [ativo]) VALUES (400, N'149', N'Cartão Porto Seguro',0); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[extratoconfig] WHERE [idciaseg] = 400 AND [codigocia] = '1391rv') +BEGIN +INSERT INTO [dbo].[extratoconfig] ([idciaseg], [codigocia], [descricao], [ativo]) VALUES (400, N'1391rv', N'Desconsiderar Nº Endosso Vida',0); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[extratoconfig] WHERE [idciaseg] = 501 AND [codigocia] = '1') +BEGIN +INSERT INTO [dbo].[extratoconfig] ([idciaseg], [codigocia], [descricao], [ativo]) VALUES (501, N'1', N'Bônus "PLUS AUTO”', 1); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[extratoconfig] WHERE [idciaseg] = 19 AND [codigocia] = '1') +BEGIN +INSERT INTO [dbo].[extratoconfig] ([idciaseg], [codigocia], [descricao], [ativo]) VALUES (19, N'1', N'Bônus "PLUS”', 1); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[extratoconfig] WHERE [idciaseg] = 595 AND [codigocia] = 'viacorretor') +BEGIN +INSERT INTO [dbo].[extratoconfig] ([idciaseg], [codigocia], [descricao], [ativo]) VALUES (595, N'viacorretor', N'Importar Via Corretor', 0); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[extratoconfig] WHERE [idciaseg] = 216 AND [codigocia] = 'Fed999') +BEGIN +INSERT INTO [dbo].[extratoconfig] ([idciaseg], [codigocia], [descricao], [ativo]) VALUES (216, N'Fed999', N'Importar Sub. Fed. como 999', 0); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[extratoconfig] WHERE [idciaseg] = 216 AND [codigocia] = 'Est999') +BEGIN +INSERT INTO [dbo].[extratoconfig] ([idciaseg], [codigocia], [descricao], [ativo]) VALUES (216, N'Est999', N'Importar Sub. Est. como 999', 0); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[extratoconfig] WHERE [idciaseg] = 92 AND [codigocia] = '1') +BEGIN +INSERT INTO [dbo].[extratoconfig] ([idciaseg], [codigocia], [descricao], [ativo]) VALUES (92, N'1', N'Parcela Especial', 0); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[extratoconfig] WHERE [idciaseg] = 400 AND [codigocia] = '72') +BEGIN +INSERT INTO [dbo].[extratoconfig] ([idciaseg], [codigocia], [descricao], [ativo]) VALUES (400, N'72', N'Cancelamento da Apólice', 1); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[extratoconfig] WHERE [idciaseg] = 70 AND [codigocia] = '1') +BEGIN +INSERT INTO [dbo].[extratoconfig] ([idciaseg], [codigocia], [descricao], [ativo]) VALUES (70, N'1', N'Parcela Especial', 1); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[extratoconfig] WHERE [idciaseg] = 400 AND [codigocia] = '148') +BEGIN +INSERT INTO [dbo].[extratoconfig] ([idciaseg], [codigocia], [descricao], [ativo]) VALUES (400, N'148', N'Cartão Porto Seguro', 1); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200520_46.SQL b/Decompiler/Gestor.Application.Migration.Files.20200520_46.SQL new file mode 100644 index 0000000..e8cefcf --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200520_46.SQL @@ -0,0 +1,4 @@ +IF EXISTS(SELECT 1 FROM [dbo].[perfil] WHERE [sexo] = '0') +BEGIN + UPDATE [dbo].[perfil] SET [sexo] = '1' WHERE [sexo] = '0'; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200520_47.SQL b/Decompiler/Gestor.Application.Migration.Files.20200520_47.SQL new file mode 100644 index 0000000..a746d63 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200520_47.SQL @@ -0,0 +1,8 @@ +IF (NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'ciavend')) +BEGIN + CREATE TABLE [dbo].[ciavend] ( + [idciavend] [bigint] IDENTITY(1,1) NOT NULL PRIMARY KEY, + [idciaseg] [bigint] NOT NULL, + [idramo] [bigint] NOT NULL, + [idvendedor] [bigint] NOT NULL); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200525_48.SQL b/Decompiler/Gestor.Application.Migration.Files.20200525_48.SQL new file mode 100644 index 0000000..d38b146 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200525_48.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 403) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (403, N'POTTENCIAL SEGURADORA SA', 1, 2); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200527_49.SQL b/Decompiler/Gestor.Application.Migration.Files.20200527_49.SQL new file mode 100644 index 0000000..f39021c --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200527_49.SQL @@ -0,0 +1,39 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[controledbad]) +BEGIN + DECLARE @banco VARCHAR(255) = (SELECT DB_NAME()); + INSERT INTO [dbo].[controledbad] (bdname, tabela) VALUES (@banco, N'Arquivos'); + + CREATE TABLE [dbo].[Arquivos]( + [IDARQUIVODIGITAL] [bigint] IDENTITY(1,1) NOT NULL PRIMARY KEY, + [IDCLIENTE] [bigint] NULL, + [IDDOCUMENTO] [bigint] NULL, + [IDATENDIMENTO] [bigint] NULL, + [IDITEM] [bigint] NULL, + [IDPARCELA] [bigint] NULL, + [IDSINISTRO] [bigint] NULL, + [IDVENCTOALEATORIO] [bigint] NULL, + [IDMALADIRETA] [bigint] NULL, + [IDFORNECEDOR] [bigint] NULL, + [IDCIASEG] [bigint] NULL, + [IDORCCLI] [bigint] NULL, + [IDORCAMEN] [bigint] NULL, + [IDORCITEM] [bigint] NULL, + [IDVENDEDOR] [bigint] NULL, + [IDEXTRATO] [bigint] NULL, + [IDLANCAMEN] [bigint] NULL, + [IDEMPRESA] [bigint] NULL, + [IDSOCIO] [bigint] NULL, + [DESCRICAO] [varchar](300) NULL, + [IMGBLOB] [varbinary](max) NULL, + [EXTENSION] [varchar](5) NULL, + [USUARIOCRIACAO] [bigint] NULL, + [USUARIOALTERACAO] [bigint] NULL, + [DATACRIACAO] [datetime] NULL, + [DATAALTERACAO] [datetime] NULL, + [idrecibofiscal] [bigint] NULL, + [idprojeto] [bigint] NULL, + [idagsproduto] [bigint] NULL, + [excluido] [varchar](1) NULL, + [idnota] [bigint] NULL, + [idguiaremessa] [bigint] NULL); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200527_50.SQL b/Decompiler/Gestor.Application.Migration.Files.20200527_50.SQL new file mode 100644 index 0000000..8cc12f1 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200527_50.SQL @@ -0,0 +1,5 @@ +IF EXISTS(SELECT 1 FROM [dbo].[empresa]) AND NOT EXISTS(SELECT 1 FROM [dbo].[vendedor]) +BEGIN + DECLARE @nomeempresa VARCHAR(255) = (SELECT nome from empresa); + INSERT INTO [dbo].[vendedor] (idempresa,nome,corretora,ativo) VALUES (1,@nomeempresa,'1','1'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200612_51.SQL b/Decompiler/Gestor.Application.Migration.Files.20200612_51.SQL new file mode 100644 index 0000000..8665529 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200612_51.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 230) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (230, N'FATOR SEGURADORA', 1, 2); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200702_52.SQL b/Decompiler/Gestor.Application.Migration.Files.20200702_52.SQL new file mode 100644 index 0000000..8a60cf8 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200702_52.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'ConfigSistema' ) +BEGIN + CREATE TABLE [dbo].[ConfigSistema] ( Id BIGINT IDENTITY ( 1, 1 ) PRIMARY KEY NOT NULL, Codigo INTEGER NOT NULL ); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200709_53.SQL b/Decompiler/Gestor.Application.Migration.Files.20200709_53.SQL new file mode 100644 index 0000000..185cf12 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200709_53.SQL @@ -0,0 +1,4 @@ +IF COL_LENGTH('[dbo].[sinistro]', 'descricao') IS NOT NULL +BEGIN +ALTER TABLE sinistro ALTER COLUMN descricao varchar(MAX); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200714_54.SQL b/Decompiler/Gestor.Application.Migration.Files.20200714_54.SQL new file mode 100644 index 0000000..59daa9b --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200714_54.SQL @@ -0,0 +1,4 @@ +IF COL_LENGTH('[dbo].[controle]', 'idestipulante') IS NULL +BEGIN + ALTER TABLE controle ADD idestipulante BIGINT NULL; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200714_55.SQL b/Decompiler/Gestor.Application.Migration.Files.20200714_55.SQL new file mode 100644 index 0000000..103e060 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200714_55.SQL @@ -0,0 +1,4 @@ +IF COL_LENGTH('[dbo].[documento]', 'idestipulante') IS NOT NULL AND COL_LENGTH('[dbo].[controle]', 'idestipulante') IS NOT NULL +BEGIN + UPDATE documento SET idestipulante = c.idestipulante FROM documento d INNER JOIN controle c on c.idcontrole = d.idcontrole WHERE d.idestipulante is null and c.idestipulante IS NOT NULL; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200716_56.SQL b/Decompiler/Gestor.Application.Migration.Files.20200716_56.SQL new file mode 100644 index 0000000..9c6e7fe --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200716_56.SQL @@ -0,0 +1,4 @@ +IF EXISTS(SELECT 1 FROM [dbo].[enviosmtp] WHERE [Excluido] IS NULL) +BEGIN + UPDATE [dbo].[enviosmtp] SET Excluido = 0 WHERE [Excluido] IS NULL; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200730_57.SQL b/Decompiler/Gestor.Application.Migration.Files.20200730_57.SQL new file mode 100644 index 0000000..56600f1 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200730_57.SQL @@ -0,0 +1,9 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'clitelefone') AND COL_LENGTH('[dbo].[clitelefone]', 'fone') IS NOT NULL +BEGIN + ALTER TABLE [dbo].[clitelefone] ALTER COLUMN fone VARCHAR(20) NULL; +END + +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'clicontato') AND COL_LENGTH('[dbo].[clicontato]', 'fone') IS NOT NULL +BEGIN + ALTER TABLE [dbo].[clicontato] ALTER COLUMN fone VARCHAR(20) NULL; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200811_58.SQL b/Decompiler/Gestor.Application.Migration.Files.20200811_58.SQL new file mode 100644 index 0000000..6da82e3 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200811_58.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 28) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (28, N'AMIL SEGURADORA S/A', 1, 2); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200817_59.SQL b/Decompiler/Gestor.Application.Migration.Files.20200817_59.SQL new file mode 100644 index 0000000..4f46df2 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200817_59.SQL @@ -0,0 +1,9 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'ArquivoParaAssinatura') AND COL_LENGTH('[dbo].[ArquivoParaAssinatura]', 'Enviado') IS NULL +BEGIN + ALTER TABLE [dbo].[ArquivoParaAssinatura] ADD Enviado DATETIME2 NULL; +END + +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'ArquivoParaAssinatura') AND COL_LENGTH('[dbo].[ArquivoParaAssinatura]', 'UsuarioId') IS NULL +BEGIN + ALTER TABLE [dbo].[ArquivoParaAssinatura] ADD UsuarioId BIGINT NULL; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200818_60.SQL b/Decompiler/Gestor.Application.Migration.Files.20200818_60.SQL new file mode 100644 index 0000000..efd8526 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200818_60.SQL @@ -0,0 +1,16 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND NOT EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 2 AND [IdUsuario] = 0) +BEGIN + INSERT INTO [dbo].[CamposRelatorios] +VALUES + ( 0, 2, 'Cliente', NULL, 0, NULL, 1 ), + ( 0, 2, 'Apolice', 'APÓLICE', 0, NULL, 2 ), + ( 0, 2, 'Endosso', NULL, 0, NULL, 3 ), + ( 0, 2, 'Status', NULL, 0, NULL, 4 ), + ( 0, 2, 'VigenciaInicial', 'VIGÊNCIA INICIAL', 0, 'DATA?', 5 ), + ( 0, 2, 'Comissao', 'COMISSÃO', 0, 'PERCENTUAL', 6 ), + ( 0, 2, 'PremioLiquido', 'PRÊMIO LÍQUIDO', 0, 'VALOR', 7 ), + ( 0, 2, 'Seguradora', NULL, 0, NULL, 8 ), + ( 0, 2, 'Ramo', NULL, 0, NULL, 9 ), + ( 0, 2, 'Vendedor', 'VENDEDOR PRINCIPAL', 0, NULL, 10 ), + ( 0, 2, 'Item', NULL, 0, NULL, 11 ); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200820_61.SQL b/Decompiler/Gestor.Application.Migration.Files.20200820_61.SQL new file mode 100644 index 0000000..8638e5c --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200820_61.SQL @@ -0,0 +1,16 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND NOT EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 0 AND [IdUsuario] = 0) +BEGIN + INSERT INTO [dbo].[CamposRelatorios] +VALUES + ( 0, 0, 'Nome', NULL, 0, NULL, 1 ), + ( 0, 0, 'Documento', 'CPF/CNPJ', 0, NULL, 2 ), + ( 0, 0, 'TipoPessoa', 'TIPO DE PESSOA', 0, NULL, 3 ), + ( 0, 0, 'Nascimento', NULL, 0, 'DATA?', 4 ), + ( 0, 0, 'Telefone', NULL, 0, NULL, 5 ), + ( 0, 0, 'Email', 'E-MAIL', 0, NULL, 6 ), + ( 0, 0, 'Cep', NULL, 0, NULL, 7 ), + ( 0, 0, 'Cidade', NULL, 0, NULL, 8 ), + ( 0, 0, 'Estado', NULL, 0, NULL, 9 ), + ( 0, 0, 'Ativo', null, 0, NULL, 10 ), + ( 0, 0, 'Ramo', NULL, 0, NULL, 11 ); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200820_62.SQL b/Decompiler/Gestor.Application.Migration.Files.20200820_62.SQL new file mode 100644 index 0000000..e94f321 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200820_62.SQL @@ -0,0 +1,16 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND NOT EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 1 AND [IdUsuario] = 0) +BEGIN + INSERT INTO [dbo].[CamposRelatorios] +VALUES + ( 0, 1, 'Aniversario', 'ANIVERSÁRIO', 0, NULL, 0 ), + ( 0, 1, 'Nome', NULL, 0, NULL, 1 ), + ( 0, 1, 'Documento', 'CPF/CNPJ', 0, NULL, 2 ), + ( 0, 1, 'TipoPessoa', 'TIPO DE PESSOA', 0, NULL, 3 ), + ( 0, 1, 'Nascimento', NULL, 0, 'DATA?', 4 ), + ( 0, 1, 'Telefone', NULL, 0, NULL, 5 ), + ( 0, 1, 'Email', 'E-MAIL', 0, NULL, 6 ), + ( 0, 1, 'Cep', NULL, 0, NULL, 7 ), + ( 0, 1, 'Cidade', NULL, 0, NULL, 8 ), + ( 0, 1, 'Estado', NULL, 0, NULL, 9 ), + ( 0, 1, 'Ativo', null, 0, NULL, 10 ); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200820_63.SQL b/Decompiler/Gestor.Application.Migration.Files.20200820_63.SQL new file mode 100644 index 0000000..54804d8 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200820_63.SQL @@ -0,0 +1,4 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Meta') AND COL_LENGTH('[dbo].[Meta]', 'IdCiaSeg') IS NOT NULL +BEGIN + ALTER TABLE [dbo].[Meta] ALTER COLUMN IdCiaSeg BIGINT NULL; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200825_64.SQL b/Decompiler/Gestor.Application.Migration.Files.20200825_64.SQL new file mode 100644 index 0000000..2d9c594 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200825_64.SQL @@ -0,0 +1,4 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Meta') AND COL_LENGTH('[dbo].[Meta]', 'IdSeguradora') IS NOT NULL +BEGIN + ALTER TABLE [dbo].[Meta] ALTER COLUMN IdSeguradora BIGINT NULL; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200831_65.SQL b/Decompiler/Gestor.Application.Migration.Files.20200831_65.SQL new file mode 100644 index 0000000..42d4e01 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200831_65.SQL @@ -0,0 +1,4 @@ +IF EXISTS(SELECT 1 FROM [dbo].[estipulante] WHERE [idempresa] IS NULL) +BEGIN + UPDATE [estipulante] SET [idempresa] = 1 WHERE [idempresa] IS NULL; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200914_66.SQL b/Decompiler/Gestor.Application.Migration.Files.20200914_66.SQL new file mode 100644 index 0000000..9dac066 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200914_66.SQL @@ -0,0 +1,4 @@ +IF COL_LENGTH('[dbo].[usuario]', 'inativo') IS NOT NULL +BEGIN + UPDATE usuario SET INATIVO = 0 WHERE INATIVO IS NULL OR LTRIM(RTRIM(INATIVO)) = ''; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200915_67.SQL b/Decompiler/Gestor.Application.Migration.Files.20200915_67.SQL new file mode 100644 index 0000000..9e8a535 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200915_67.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 122) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (122,085, N'TRANSPOCRED'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200924_68.SQL b/Decompiler/Gestor.Application.Migration.Files.20200924_68.SQL new file mode 100644 index 0000000..4bde4f6 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200924_68.SQL @@ -0,0 +1,4 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'recibo') AND COL_LENGTH('[dbo].[recibo]', 'DATARECIBO') IS NOT NULL +BEGIN + ALTER TABLE [dbo].[recibo] ALTER COLUMN DATARECIBO datetime; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200925_69.SQL b/Decompiler/Gestor.Application.Migration.Files.20200925_69.SQL new file mode 100644 index 0000000..7966142 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200925_69.SQL @@ -0,0 +1,4 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND NOT EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 2 AND [IdUsuario] = 0 AND [Campo] = 'ComissaoGerada') +BEGIN + INSERT INTO [dbo].[CamposRelatorios] VALUES ( 0, 2, 'ComissaoGerada', 'COMISSÃO GERADA', 0, 'VALOR', 7 ); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20200929_70.SQL b/Decompiler/Gestor.Application.Migration.Files.20200929_70.SQL new file mode 100644 index 0000000..709b52d --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20200929_70.SQL @@ -0,0 +1,4 @@ +IF COL_LENGTH('[dbo].[resempco]', 'CEP') = 9 +BEGIN + ALTER TABLE [dbo].[resempco] ALTER COLUMN cep VARCHAR(10); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20201001_71.SQL b/Decompiler/Gestor.Application.Migration.Files.20201001_71.SQL new file mode 100644 index 0000000..585516b --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20201001_71.SQL @@ -0,0 +1,4 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND NOT EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 2 AND [IdUsuario] = 0 AND [Campo] = 'TipoPagamento') +BEGIN + INSERT INTO [dbo].[CamposRelatorios] VALUES ( 0, 2, 'TipoPagamento', 'TIPO PAGAMENTO', 0, NULL, 15 ); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20201007_72.SQL b/Decompiler/Gestor.Application.Migration.Files.20201007_72.SQL new file mode 100644 index 0000000..0205c52 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20201007_72.SQL @@ -0,0 +1,4 @@ +IF COL_LENGTH('[dbo].[documento]', 'pasta') IS NOT NULL +BEGIN + ALTER TABLE [dbo].[documento] ALTER COLUMN pasta VARCHAR(15); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20201007_73.SQL b/Decompiler/Gestor.Application.Migration.Files.20201007_73.SQL new file mode 100644 index 0000000..5c8a2e8 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20201007_73.SQL @@ -0,0 +1,4 @@ +IF EXISTS ( SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'repasse' ) +BEGIN + INSERT INTO repasse ( tipo, incidencia, forma, vlrnovo, vlrrenovacao, ativo, idvendedor ) SELECT 2, 1, 1, 0, 0, 1, v.idvendedor FROM vendedor v LEFT OUTER JOIN repasse r ON r.idvendedor = v.idvendedor WHERE v.corretora = '1' AND r.idrepasse IS NULL; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20201008_74.SQL b/Decompiler/Gestor.Application.Migration.Files.20201008_74.SQL new file mode 100644 index 0000000..59ff52a --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20201008_74.SQL @@ -0,0 +1,4 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND NOT EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 2 AND [IdUsuario] = 0 AND [Campo] = 'DataCriacao') +BEGIN + INSERT INTO [dbo].[CamposRelatorios] VALUES ( 0, 2, 'DataCriacao', 'DATA DE CADASTRO', 0, 'DATA?', 16 ); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20201015_75.SQL b/Decompiler/Gestor.Application.Migration.Files.20201015_75.SQL new file mode 100644 index 0000000..6a04cc2 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20201015_75.SQL @@ -0,0 +1,8 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 801) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (801, N'CABERJ', 1, 2); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 802) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (802, N'INFINITI', 1, 2); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20201026_76.SQL b/Decompiler/Gestor.Application.Migration.Files.20201026_76.SQL new file mode 100644 index 0000000..9d370d2 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20201026_76.SQL @@ -0,0 +1,4 @@ +IF EXISTS(SELECT 1 FROM [dbo].[Tarefa] WHERE [IdUsuarioCadastro] IS NULL) +BEGIN + UPDATE [dbo].[Tarefa] SET [IdUsuarioCadastro] = [IdUsuario] WHERE [IdUsuarioCadastro] IS NULL +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20201027_77.SQL b/Decompiler/Gestor.Application.Migration.Files.20201027_77.SQL new file mode 100644 index 0000000..ae54143 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20201027_77.SQL @@ -0,0 +1,4 @@ +IF COL_LENGTH('[dbo].[documento]', 'NegocioCorretora') IS NOT NULL AND EXISTS(SELECT 1 FROM [dbo].[documento] WHERE [NegocioCorretora] IS NULL) +BEGIN + UPDATE [dbo].[documento] SET [NegocioCorretora] = CASE WHEN(situacao = 2 AND idnegocio IS NOT NULL AND idnegocio = 1) THEN 1 ELSE 0 END WHERE [NegocioCorretora] IS NULL +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20201028_78.SQL b/Decompiler/Gestor.Application.Migration.Files.20201028_78.SQL new file mode 100644 index 0000000..98b05e8 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20201028_78.SQL @@ -0,0 +1,174 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 469) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (469,2, N'Básica - Inc, raio, Explosão/Implosão', 1); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 488) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (488,2, N'Básica - Incêndio, Raio, Explosão/Implosão', 1); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 720) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (720,2, N'Incêndio, Raio, Explosão', 1); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 467) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (467,2, N'Roubo/Furto Qualificado', 1); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 289) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (289,2, N'Perda/Pagamento de Aluguel', 1); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 276) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (276,2, N'Recomposição de Documentos', 1); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 274) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (274,2, N'Impacto de Veiculos e Queda de Aeronaves', 1); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 492) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (492,2, N'Impacto de veículos/Queda de Aeronaves', 1); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 43) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (43,2, N'Desmoronamento', 1); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 186) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (186,2, N'Anúncios / Letreiros Luminosos ', 1); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 246) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (246,2, N'Anúncios / Letreiros Luminosos ', 1); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 1056) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (1056,2, N'INC/RAIO/EXPL/QUEDA AERON/FUM', 1); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 374) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (374,2, N'Danos Morais', 1); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 1017) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (1017,2, N'R.C. Portoes', 1); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 1074) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (1074,2, N'R C DANOS MORAIS', 1); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 283) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (283,2, N'Portões', 1); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 556) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (556,2, N'PORTÕES E CANCELAS', 1); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 1107) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (1107,2, N'RC Portões', 1); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 1091) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (1091,2, N'Quebra de vidros/espelhos/mármores', 1); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 709) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (709,2, N'Furto/Roubo de Bens-condomínio', 1); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 152) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (152,2, N'Tumultos / Greve / Lock-Out', 1); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 417) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (417,2, N'Despesas Fixas', 1); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 375) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (375,2, N'Impacto de veiculos terrestres', 1); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 71) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (71,2, N'Desmoronamento', 1); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 223) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (223,2, N'RC Síndico', 1); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 222) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (222,2, N'RC Condomínio', 1); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 474) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (474,2, N'RC Garagista Incêndio e Roubo', 1); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 477) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (477,2, N'Anúncios Luminosos / Letreiros / Antenas', 1); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 241) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (241,2, N'Cobertura Básica', 1); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 487) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (487,2, N'Básica - Incêndio, Raio, Explosão/Implosão', 1); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 260) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (260,2, N'Impacto de Veiculos', 1); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 275) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (275,2, N'Impacto de Veiculos e Queda de Aeronaves', 1); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 151) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (151,2, N'Tumultos / Greve / Lock-Out', 1); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 262) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (262,2, N'Resp. Civil Danos Morais', 1); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[coberturapadrao] WHERE [idcoberturapadrao] = 252) +BEGIN + INSERT INTO [dbo].[coberturapadrao] ([idcoberturapadrao],[idramo],[descricao],[padrao]) VALUES (252,2, N'Equipamentos Portáteis', 1); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20201030_79.SQL b/Decompiler/Gestor.Application.Migration.Files.20201030_79.SQL new file mode 100644 index 0000000..b4ca119 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20201030_79.SQL @@ -0,0 +1,13 @@ +IF COL_LENGTH( '[dbo].[documento]', 'banco' ) IS NOT NULL AND COL_LENGTH( '[dbo].[documento]', 'idbanco' ) IS NOT NULL +BEGIN + IF (SELECT DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'documento' AND COLUMN_NAME = 'idbanco' AND DATA_TYPE = 'int') IS NOT NULL + BEGIN + UPDATE [dbo].[documento] + SET idbanco = TRY_CAST ( banco AS INT ) + WHERE + ( + SELECT idcodigobanco FROM codigobanco + WHERE idcodigobanco = TRY_CAST ( banco AS INT ) + ) IS NOT NULL AND banco IS NOT NULL AND banco != '' AND idbanco IS NULL; + END +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20201104_80.SQL b/Decompiler/Gestor.Application.Migration.Files.20201104_80.SQL new file mode 100644 index 0000000..13d6784 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20201104_80.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 123) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (123,756, N'SICOOB'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20201112_81.SQL b/Decompiler/Gestor.Application.Migration.Files.20201112_81.SQL new file mode 100644 index 0000000..27eb4f1 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20201112_81.SQL @@ -0,0 +1,9 @@ +IF COL_LENGTH('[dbo].[usuario]', 'AdmGestor') IS NOT NULL AND EXISTS(SELECT 1 FROM [dbo].[usuario] WHERE [AdmGestor] IS NULL) +BEGIN + UPDATE [dbo].[usuario] SET [AdmGestor] = '0' WHERE [AdmGestor] IS NULL; +END + +IF COL_LENGTH('[dbo].[usuario]', 'Removido') IS NOT NULL AND EXISTS(SELECT 1 FROM [dbo].[usuario] WHERE [Removido] IS NULL) +BEGIN + UPDATE [dbo].[usuario] SET [Removido] = '0' WHERE [Removido] IS NULL; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20201113_82.SQL b/Decompiler/Gestor.Application.Migration.Files.20201113_82.SQL new file mode 100644 index 0000000..d0b8b4b --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20201113_82.SQL @@ -0,0 +1,4 @@ +IF COL_LENGTH('[dbo].[cobertura]', 'observacao') < 255 AND COL_LENGTH('[dbo].[cobertura]', 'observacao') > -1 +BEGIN + ALTER TABLE [dbo].[cobertura] ALTER COLUMN observacao VARCHAR(max); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20201117_83.SQL b/Decompiler/Gestor.Application.Migration.Files.20201117_83.SQL new file mode 100644 index 0000000..323ec27 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20201117_83.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 121) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (121,260, N'NUBANK'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20201127_84.SQL b/Decompiler/Gestor.Application.Migration.Files.20201127_84.SQL new file mode 100644 index 0000000..0911593 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20201127_84.SQL @@ -0,0 +1,5 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') +BEGIN + UPDATE CamposRelatorios SET Tipo = 'DATA/TIME' WHERE Relatorio = 18 AND Campo = 'Agendamento'; + UPDATE CamposRelatorios SET Tipo = 'DATA/TIME?' WHERE Relatorio = 18 AND Campo = 'Conclusao'; +END diff --git a/Decompiler/Gestor.Application.Migration.Files.20201127_85.SQL b/Decompiler/Gestor.Application.Migration.Files.20201127_85.SQL new file mode 100644 index 0000000..0f9a71d --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20201127_85.SQL @@ -0,0 +1,4 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'recibo') AND COL_LENGTH('[dbo].[recibo]', 'tipopagamento') IS NULL +BEGIN + ALTER TABLE [dbo].[recibo] ADD tipopagamento VARCHAR(250) NULL; +END diff --git a/Decompiler/Gestor.Application.Migration.Files.20201127_86.SQL b/Decompiler/Gestor.Application.Migration.Files.20201127_86.SQL new file mode 100644 index 0000000..606f144 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20201127_86.SQL @@ -0,0 +1,4 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'recibo') AND COL_LENGTH('[dbo].[recibo]', 'tipopagamento') IS NOT NULL AND COL_LENGTH('[dbo].[recibo]', 'IdTipoRecibo') IS NULL +BEGIN + ALTER TABLE [dbo].[recibo] ADD IdTipoRecibo INTEGER; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20201127_87.SQL b/Decompiler/Gestor.Application.Migration.Files.20201127_87.SQL new file mode 100644 index 0000000..c256b8c --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20201127_87.SQL @@ -0,0 +1,4 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'recibo') AND COL_LENGTH('[dbo].[recibo]', 'tipopagamento') IS NOT NULL AND COL_LENGTH('[dbo].[recibo]', 'IdTipoRecibo') IS NOT NULL +BEGIN + UPDATE [dbo].[recibo] SET IdTipoRecibo = CASE WHEN(tipopagamento = 'PAGAMENTO') THEN 0 ELSE 1 END; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20201127_88.SQL b/Decompiler/Gestor.Application.Migration.Files.20201127_88.SQL new file mode 100644 index 0000000..a5f9da7 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20201127_88.SQL @@ -0,0 +1,4 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'recibo') AND COL_LENGTH('[dbo].[recibo]', 'tipopagamento') IS NOT NULL +BEGIN + ALTER TABLE [dbo].[recibo] ALTER COLUMN tipopagamento VARCHAR(250) NULL; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20201127_89.SQL b/Decompiler/Gestor.Application.Migration.Files.20201127_89.SQL new file mode 100644 index 0000000..611068d --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20201127_89.SQL @@ -0,0 +1,6 @@ + + +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 807) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (807, N'SANTANDER AUTO S.A.', 1, 2); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20201201_90.SQL b/Decompiler/Gestor.Application.Migration.Files.20201201_90.SQL new file mode 100644 index 0000000..ff1baf5 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20201201_90.SQL @@ -0,0 +1,14 @@ +IF EXISTS ( SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'sinistroauto' ) AND COL_LENGTH('[dbo].[sinistroauto]', 'culpado') IS NOT NULL +BEGIN + UPDATE [dbo].[sinistroauto] + SET culpado = 2 + WHERE culpado is null OR culpado = 1; + + UPDATE [dbo].[sinistroauto] + SET culpado = 1 + WHERE culpado = 0; + + UPDATE [dbo].[sinistroauto] + SET culpado = 0 + WHERE culpado = 2; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20201203_91.SQL b/Decompiler/Gestor.Application.Migration.Files.20201203_91.SQL new file mode 100644 index 0000000..72b0253 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20201203_91.SQL @@ -0,0 +1,6 @@ + + +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 813) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (813, N'LEVE SAUDE OPERADORA DE PLANOS DE SAUDE LTDA', 1, 2); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20201203_92.SQL b/Decompiler/Gestor.Application.Migration.Files.20201203_92.SQL new file mode 100644 index 0000000..53e770e --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20201203_92.SQL @@ -0,0 +1,4 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'vendedorparcela') AND EXISTS(SELECT 1 FROM [dbo].[vendedorparcela] vp INNER JOIN [dbo].[parcela] p on p.idparcela = vp.idparcela INNER JOIN [dbo].[repasse] r on r.idrepasse = vp.idrepasse WHERE p.datarec IS NOT NULL AND vp.dataprepagto IS NOT NULL AND r.forma = 1 AND vp.datapgt IS NULL AND vp.dataprepagto != p.datarec) +BEGIN + update [dbo].[vendedorparcela] set dataprepagto = p.datarec FROM [dbo].[vendedorparcela] vp INNER JOIN [dbo].[parcela] p on p.idparcela = vp.idparcela INNER JOIN [dbo].[repasse] r on r.idrepasse = vp.idrepasse WHERE p.datarec IS NOT NULL AND vp.dataprepagto IS NOT NULL AND r.forma = 1 AND vp.datapgt IS NULL AND vp.dataprepagto != p.datarec +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20201210_93.SQL b/Decompiler/Gestor.Application.Migration.Files.20201210_93.SQL new file mode 100644 index 0000000..1e96b49 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20201210_93.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [IDCIASEG] = 791) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (791, N'JUNTO SEGUROS', 1, 2); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20201230_94.SQL b/Decompiler/Gestor.Application.Migration.Files.20201230_94.SQL new file mode 100644 index 0000000..717598e --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20201230_94.SQL @@ -0,0 +1,5 @@ +IF EXISTS(SELECT 1 FROM [dbo].[cliente] WHERE sexo = 'F' OR sexo = 'M') +BEGIN + UPDATE [dbo].[cliente] SET sexo=1 WHERE sexo = 'F'; + UPDATE [dbo].[cliente] SET sexo=0 WHERE sexo = 'M'; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210107_95.SQL b/Decompiler/Gestor.Application.Migration.Files.20210107_95.SQL new file mode 100644 index 0000000..f32bf50 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210107_95.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [idciaseg] = 818) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (818, N'MAPFRE VERA CRUZ PREVIDÊNCIA SA', 1, 2); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210118_96.SQL b/Decompiler/Gestor.Application.Migration.Files.20210118_96.SQL new file mode 100644 index 0000000..034ce3d --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210118_96.SQL @@ -0,0 +1,9 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [idciaseg] = 819) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (819, N'SAMOC', 0, 2); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [idciaseg] = 820) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (820, N'PEVENT SENIOR', 0, 2); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210209_97.SQL b/Decompiler/Gestor.Application.Migration.Files.20210209_97.SQL new file mode 100644 index 0000000..daa9ab2 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210209_97.SQL @@ -0,0 +1,9 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [idciaseg] = 835) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (835, N'LINCX', 0, 2); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [idciaseg] = 836) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (836, N'ONE HEALTH', 0, 2); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210217_98.SQL b/Decompiler/Gestor.Application.Migration.Files.20210217_98.SQL new file mode 100644 index 0000000..b1d17c0 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210217_98.SQL @@ -0,0 +1,9 @@ +DECLARE @index_name NVARCHAR(MAX), @table_name NVARCHAR(MAX) +SET @table_name = 'documento' + +SELECT TOP 1 @index_name = ind.name FROM sys.indexes ind INNER JOIN sys.index_columns ic ON ind.object_id = ic.object_id and ind.index_id = ic.index_id INNER JOIN sys.columns col ON ic.object_id = col.object_id and ic.column_id = col.column_id INNER JOIN sys.tables t ON ind.object_id = t.object_id WHERE ind.is_primary_key = 0 AND ind.is_unique = 0 AND ind.is_unique_constraint = 0 AND t.is_ms_shipped = 0 AND col.name = 'contrato' AND t.name = @table_name + +DECLARE @sql NVARCHAR(MAX) = N'DROP INDEX dbo.' + @table_name + '.' + @index_name + +IF @index_name IS NOT NULL + exec sp_executesql @sql diff --git a/Decompiler/Gestor.Application.Migration.Files.20210217_99.SQL b/Decompiler/Gestor.Application.Migration.Files.20210217_99.SQL new file mode 100644 index 0000000..22f7cbe --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210217_99.SQL @@ -0,0 +1,5 @@ +IF COL_LENGTH('[dbo].[documento]', 'contrato') IS NOT NULL +BEGIN + ALTER TABLE [dbo].[documento] ALTER COLUMN contrato VARCHAR(50) NULL; + ALTER TABLE [dbo].[documento] ALTER COLUMN apol_antes VARCHAR(50) NULL; +END diff --git a/Decompiler/Gestor.Application.Migration.Files.20210301_100.SQL b/Decompiler/Gestor.Application.Migration.Files.20210301_100.SQL new file mode 100644 index 0000000..2b7fd94 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210301_100.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [idciaseg] = 837) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (837, N'W DENTAL', 0, 2); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210302_101.SQL b/Decompiler/Gestor.Application.Migration.Files.20210302_101.SQL new file mode 100644 index 0000000..1c962e3 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210302_101.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 128) --ID ANTERIOR 124 AJUSTADO CONFORME O BANCO OFICIAL +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (128,336, N'BANCO C6 S.A.'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210302_102.SQL b/Decompiler/Gestor.Application.Migration.Files.20210302_102.SQL new file mode 100644 index 0000000..40a967c --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210302_102.SQL @@ -0,0 +1,10 @@ +DECLARE @fk_name NVARCHAR(MAX) + +SELECT TOP 1 @fk_name = name +FROM sys.foreign_keys +WHERE parent_object_id = object_id('adiantamento') AND object_name(referenced_object_id) = 'tipopagto' + +DECLARE @sql NVARCHAR(MAX) = N'ALTER TABLE adiantamento DROP CONSTRAINT ' + @fk_name + +IF @fk_name IS NOT NULL + exec sp_executesql @sql \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210302_103.SQL b/Decompiler/Gestor.Application.Migration.Files.20210302_103.SQL new file mode 100644 index 0000000..faed352 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210302_103.SQL @@ -0,0 +1,4 @@ +IF COL_LENGTH('[dbo].[sinistro]', 'observacaoint') IS NOT NULL +BEGIN + ALTER TABLE [dbo].sinistro ALTER COLUMN observacaoint VARCHAR(max) NULL; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210309_104.SQL b/Decompiler/Gestor.Application.Migration.Files.20210309_104.SQL new file mode 100644 index 0000000..c7bcfc4 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210309_104.SQL @@ -0,0 +1,9 @@ +DECLARE @index_name NVARCHAR(MAX), @table_name NVARCHAR(MAX) +SET @table_name = 'agendatelefone' + +SELECT TOP 1 @index_name = ind.name FROM sys.indexes ind INNER JOIN sys.index_columns ic ON ind.object_id = ic.object_id and ind.index_id = ic.index_id INNER JOIN sys.columns col ON ic.object_id = col.object_id and ic.column_id = col.column_id INNER JOIN sys.tables t ON ind.object_id = t.object_id WHERE ind.is_primary_key = 0 AND ind.is_unique = 0 AND ind.is_unique_constraint = 0 AND t.is_ms_shipped = 0 AND col.name = 'ddd' AND t.name = @table_name + +DECLARE @sql NVARCHAR(MAX) = N'DROP INDEX dbo.' + @table_name + '.' + @index_name + +IF @index_name IS NOT NULL + exec sp_executesql @sql diff --git a/Decompiler/Gestor.Application.Migration.Files.20210309_105.SQL b/Decompiler/Gestor.Application.Migration.Files.20210309_105.SQL new file mode 100644 index 0000000..50ba4ca --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210309_105.SQL @@ -0,0 +1,4 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'agendatelefone') AND COL_LENGTH('[dbo].[agendatelefone]', 'ddd') IS NOT NULL +BEGIN + ALTER TABLE [dbo].[agendatelefone] ALTER COLUMN ddd VARCHAR(20) NULL; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210315_106.SQL b/Decompiler/Gestor.Application.Migration.Files.20210315_106.SQL new file mode 100644 index 0000000..f9503c4 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210315_106.SQL @@ -0,0 +1,4 @@ +IF EXISTS(SELECT 1 FROM [dbo].[documento] WHERE apoconferida is null) +BEGIN + UPDATE [dbo].[documento] SET apoconferida=0 WHERE apoconferida is null; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210315_107-.SQL b/Decompiler/Gestor.Application.Migration.Files.20210315_107-.SQL new file mode 100644 index 0000000..b3cdba9 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210315_107-.SQL @@ -0,0 +1,15 @@ +DECLARE @index_name_Entidade NVARCHAR(MAX), @index_name_Tela NVARCHAR(MAX) + +SELECT TOP 1 @index_name_Entidade = ind.name FROM sys.indexes ind INNER JOIN sys.index_columns ic ON ind.object_id = ic.object_id and ind.index_id = ic.index_id INNER JOIN sys.columns col ON ic.object_id = col.object_id and ic.column_id = col.column_id INNER JOIN sys.tables t ON ind.object_id = t.object_id WHERE ind.is_primary_key = 0 AND ind.is_unique = 0 AND ind.is_unique_constraint = 0 AND t.is_ms_shipped = 0 AND col.name = 'EntidadeId' AND t.name = 'RegistroLog' + +DECLARE @sqlEntidade NVARCHAR(MAX) = N'CREATE INDEX idx_EntidadeId ON RegistroLog (EntidadeId)' + +IF @index_name_Entidade IS NULL + exec sp_executesql @sqlEntidade + +SELECT TOP 1 @index_name_Tela = ind.name FROM sys.indexes ind INNER JOIN sys.index_columns ic ON ind.object_id = ic.object_id and ind.index_id = ic.index_id INNER JOIN sys.columns col ON ic.object_id = col.object_id and ic.column_id = col.column_id INNER JOIN sys.tables t ON ind.object_id = t.object_id WHERE ind.is_primary_key = 0 AND ind.is_unique = 0 AND ind.is_unique_constraint = 0 AND t.is_ms_shipped = 0 AND col.name = 'Tela' AND t.name = 'RegistroLog' + +DECLARE @sqlTela NVARCHAR(MAX) = N'CREATE INDEX idx_Tela ON RegistroLog (Tela)' + +IF @index_name_Tela IS NULL + exec sp_executesql @sqlTela \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210323_108.SQL b/Decompiler/Gestor.Application.Migration.Files.20210323_108.SQL new file mode 100644 index 0000000..5411c35 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210323_108.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [idciaseg] = 838) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (838, N'BEST DOCTORS INSURANCE', 0, 2); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210323_109.SQL b/Decompiler/Gestor.Application.Migration.Files.20210323_109.SQL new file mode 100644 index 0000000..4133dd2 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210323_109.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [idciaseg] = 839) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (839, N'STARR INSURANCE COMPANIES', 0, 2); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210324_110.SQL b/Decompiler/Gestor.Application.Migration.Files.20210324_110.SQL new file mode 100644 index 0000000..f9bbc9d --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210324_110.SQL @@ -0,0 +1,6 @@ +DECLARE @index_name NVARCHAR(MAX), @table_name NVARCHAR(MAX) +SET @table_name = 'TitularesVida' +SELECT TOP 1 @index_name = ind.name FROM sys.indexes ind INNER JOIN sys.index_columns ic ON ind.object_id = ic.object_id and ind.index_id = ic.index_id INNER JOIN sys.columns col ON ic.object_id = col.object_id and ic.column_id = col.column_id INNER JOIN sys.tables t ON ind.object_id = t.object_id WHERE ind.is_primary_key = 0 AND ind.is_unique = 0 AND ind.is_unique_constraint = 0 AND t.is_ms_shipped = 0 AND col.name = 'Cpf' AND t.name = @table_name +DECLARE @sql NVARCHAR(MAX) = N'DROP INDEX dbo.' + @table_name + '.' + @index_name +IF @index_name IS NOT NULL + exec sp_executesql @sql \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210324_111.SQL b/Decompiler/Gestor.Application.Migration.Files.20210324_111.SQL new file mode 100644 index 0000000..3b92cc2 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210324_111.SQL @@ -0,0 +1,4 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'TitularesVida') AND COL_LENGTH('[dbo].[TitularesVida]', 'Cpf') IS NOT NULL +BEGIN + ALTER TABLE [dbo].[TitularesVida] ALTER COLUMN Cpf VARCHAR(255) NULL; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210329_112.SQL b/Decompiler/Gestor.Application.Migration.Files.20210329_112.SQL new file mode 100644 index 0000000..654923c --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210329_112.SQL @@ -0,0 +1,9 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [idciaseg] = 840) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (840, N'CAOA - CONVEF ADMINISTRADORA DE CONSORCIOS LTDA', 0, 2); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [idciaseg] = 841) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (841, N'CLUBCARE – ADMINISTRADORA DE BENEFICIOS – PLANO DE SAÚDE ADESÃO', 0, 2); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210408_113.SQL b/Decompiler/Gestor.Application.Migration.Files.20210408_113.SQL new file mode 100644 index 0000000..2388cc2 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210408_113.SQL @@ -0,0 +1,9 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [idciaseg] = 843) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (843, N'AMHEMED ASSITENCIA Á SAÚDE', 0, 2); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [idciaseg] = 844) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (844, N'UNIMED VITÓRIA', 0, 2); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210415_114-.SQL b/Decompiler/Gestor.Application.Migration.Files.20210415_114-.SQL new file mode 100644 index 0000000..92d711f --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210415_114-.SQL @@ -0,0 +1,15 @@ +--DECLARE @index_name_Entidade NVARCHAR(MAX), @index_name_Tela NVARCHAR(MAX) + +--SELECT TOP 1 @index_name_Entidade = ind.name FROM sys.indexes ind INNER JOIN sys.index_columns ic ON ind.object_id = ic.object_id and ind.index_id = ic.index_id INNER JOIN sys.columns col ON ic.object_id = col.object_id and ic.column_id = col.column_id INNER JOIN sys.tables t ON ind.object_id = t.object_id WHERE ind.is_primary_key = 0 AND ind.is_unique = 0 AND ind.is_unique_constraint = 0 AND t.is_ms_shipped = 0 AND col.name = 'idmepresa' AND t.name = 'enviosmtp' + +--DECLARE @sqlEntidade NVARCHAR(MAX) = N'CREATE INDEX idx_IdEmpresa ON enviosmtp (idempresa)' + +--IF @index_name_Entidade IS NULL +-- exec sp_executesql @sqlEntidade + +--SELECT TOP 1 @index_name_Tela = ind.name FROM sys.indexes ind INNER JOIN sys.index_columns ic ON ind.object_id = ic.object_id and ind.index_id = ic.index_id INNER JOIN sys.columns col ON ic.object_id = col.object_id and ic.column_id = col.column_id INNER JOIN sys.tables t ON ind.object_id = t.object_id WHERE ind.is_primary_key = 0 AND ind.is_unique = 0 AND ind.is_unique_constraint = 0 AND t.is_ms_shipped = 0 AND col.name = 'excluido' AND t.name = 'enviosmtp' + +--DECLARE @sqlTela NVARCHAR(MAX) = N'CREATE INDEX idx_Excluido ON enviosmtp (excluido)' + +--IF @index_name_Tela IS NULL +-- exec sp_executesql @sqlTela \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210415_115-.SQL b/Decompiler/Gestor.Application.Migration.Files.20210415_115-.SQL new file mode 100644 index 0000000..72bca36 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210415_115-.SQL @@ -0,0 +1,16 @@ +DECLARE @constraint_name NVARCHAR(MAX), @table_name NVARCHAR(MAX), @column_name NVARCHAR(MAX) + +SET @table_name = 'ciacontato' +SET @column_name = 'idfonetipo' + +select TOP 1 @constraint_name = fk.name +from sys.tables tab + inner join sys.columns col on col.object_id = tab.object_id + inner join sys.foreign_key_columns fk_cols on fk_cols.parent_object_id = tab.object_id and fk_cols.parent_column_id = col.column_id + inner join sys.foreign_keys fk on fk.object_id = fk_cols.constraint_object_id + WHERE tab.name = @table_name and col.name = @column_name; + +DECLARE @sqlDrop NVARCHAR(MAX) = N'ALTER TABLE ' + @table_name + ' DROP CONSTRAINT ' + @constraint_name + ';' + +IF @constraint_name IS NOT NULL + exec sp_executesql @sqlDrop diff --git a/Decompiler/Gestor.Application.Migration.Files.20210415_116.SQL b/Decompiler/Gestor.Application.Migration.Files.20210415_116.SQL new file mode 100644 index 0000000..ba58310 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210415_116.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 226) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (226, N'POLARIS'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210426_117.SQL b/Decompiler/Gestor.Application.Migration.Files.20210426_117.SQL new file mode 100644 index 0000000..40ff23e --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210426_117.SQL @@ -0,0 +1,14 @@ +IF EXISTS(SELECT 1 FROM [dbo].[vendedorparcela] WHERE [valortotal] = 0) +BEGIN + UPDATE vendedorparcela + SET valortotal = +CASE + WHEN ( d.ADINACOMIS = 1 ) THEN + ( d.PR_LIQ + PR_ADIC ) * ( d.com01 * 0.01 ) * ( vrep * 0.01 ) ELSE d.PR_LIQ * ( d.com01 * 0.01 ) * ( vrep * 0.01 ) +END +FROM + vendedorparcela vp + INNER JOIN documento d ON d.iddocumento = vp.iddocumento +WHERE +vp.valortotal = 0; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210510_118.SQL b/Decompiler/Gestor.Application.Migration.Files.20210510_118.SQL new file mode 100644 index 0000000..3cc72dc --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210510_118.SQL @@ -0,0 +1,8 @@ +DECLARE @col_length nvarchar(max) + +SELECT @col_length = COL_LENGTH('[dbo].[adiantamento]', 'datapgt') + +DECLARE @sql NVARCHAR(MAX) = N'UPDATE adiantamento SET Pagamento = datapgt WHERE Pagamento IS NULL AND datapgt IS NOT NULL;' + +IF @col_length IS NOT NULL + exec sp_executesql @sql \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210512_119.SQL b/Decompiler/Gestor.Application.Migration.Files.20210512_119.SQL new file mode 100644 index 0000000..b86c25e --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210512_119.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[ConfigSistema] WHERE [codigo] = 17) +BEGIN + DELETE FROM [dbo].[ConfigSistema] WHERE [codigo] = 17 +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210524_120.SQL b/Decompiler/Gestor.Application.Migration.Files.20210524_120.SQL new file mode 100644 index 0000000..51af9ac --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210524_120.SQL @@ -0,0 +1,9 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'vendedorparcela') +BEGIN + UPDATE vendedorparcela + SET dataprepagto = p.datarec + FROM vendedorparcela vp + INNER JOIN repasse r on r.idrepasse = vp.idrepasse + INNER JOIN parcela p on p.idparcela = vp.idparcela + WHERE vp.datapgt IS NULL AND r.forma = 1 AND p.datarec IS NOT NULL AND vp.DATAPREPAGTO != p.DATAREC; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210525_121.SQL b/Decompiler/Gestor.Application.Migration.Files.20210525_121.SQL new file mode 100644 index 0000000..f710845 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210525_121.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 126) --ID ANTERIOR 125 AJUSTADO CONFORME O BANCO OFICIAL +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (126,102, N'BANCO XP INVESTIMENTOS'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210607_122.SQL b/Decompiler/Gestor.Application.Migration.Files.20210607_122.SQL new file mode 100644 index 0000000..e9ef686 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210607_122.SQL @@ -0,0 +1,11 @@ +DECLARE @has_column NVARCHAR(MAX), @table_name NVARCHAR(MAX), @column_name NVARCHAR(MAX), @column_type NVARCHAR(MAX) +SET @table_name = '[dbo].[recibo]' +SET @column_name = 'tiporecibo' +SELECT @has_column = COL_LENGTH(@table_name, 'tiporecibo') + +SELECT @column_type = DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'recibo' AND COLUMN_NAME = 'tiporecibo' + +DECLARE @sql NVARCHAR(MAX) = N'ALTER TABLE ' + @table_name + N' ALTER COLUMN ' + @column_name + N' ' + CASE WHEN(@column_type = 'nvarchar' OR @column_type = 'varchar') THEN 'NVARCHAR(255)' ELSE 'INTEGER' END + N' NULL;' + +IF @has_column IS NOT NULL + exec sp_executesql @sql \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210610_123.SQL b/Decompiler/Gestor.Application.Migration.Files.20210610_123.SQL new file mode 100644 index 0000000..b9ba4db --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210610_123.SQL @@ -0,0 +1,4 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 2 AND [IdUsuario] = 0) +BEGIN + DELETE FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 2 AND [IdUsuario] = 0; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210610_124.SQL b/Decompiler/Gestor.Application.Migration.Files.20210610_124.SQL new file mode 100644 index 0000000..78adb40 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210610_124.SQL @@ -0,0 +1,25 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND NOT EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 2 AND [IdUsuario] = 0) +BEGIN + INSERT INTO [dbo].[CamposRelatorios] +VALUES +(0, 2, N'Cliente', N'CLIENTE', 0, N'', 0), +(0, 2, N'TipoDocumento', N'TIPO DOCUMENTO', 0, N'', 1), +(0, 2, N'VigenciaInicial', N'VIGNCIA INICIAL', 0, N'DATA', 2), +(0, 2, N'PremioLiquido', N'PRMIO LQUIDO', 0, N'VALOR', 3), +(0, 2, N'Comissao', N'COMISSO', 0, N'PERCENTUAL', 4), +(0, 2, N'ComissaoGerada', N'COMISSO GERADA', 0, N'VALOR', 5), +(0, 2, N'NumeroParcelas', N'QUANTIDADE PARCELAS', 0, N'QUANTIDADE', 6), +(0, 2, N'TipoPagamento', N'TIPO PAGAMENTO', 0, N'', 7), +(0, 2, N'Seguradora', N'SEGURADORA', 0, N'', 8), +(0, 2, N'Ramo', N'RAMO', 0, N'', 9), +(0, 2, N'Produto', N'PRODUTO', 0, N'', 10), +(0, 2, N'Status', N'STATUS', 0, N'', 11), +(0, 2, N'Negocio', N'NEGCIO CORRETORA', 0, N'', 12), +(0, 2, N'Item', N'ITEM', 0, N'', 13), +(0, 2, N'Vendedor', N'VENDEDOR PRINCIPAL', 0, N'', 14), +(0, 2, N'TodosVendedores', N'TODOS VENDEDORES', 0, N'', 15), +(0, 2, N'Proposta', N'PROPOSTA', 0, N'', 16), +(0, 2, N'Apolice', N'APLICE', 0, N'', 17), +(0, 2, N'PropostaEndosso', N'PROPOSTA ENDOSSO', 0, N'', 18), +(0, 2, N'Endosso', N'ENDOSSO', 0, N'', 19) +END diff --git a/Decompiler/Gestor.Application.Migration.Files.20210610_125.SQL b/Decompiler/Gestor.Application.Migration.Files.20210610_125.SQL new file mode 100644 index 0000000..182c368 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210610_125.SQL @@ -0,0 +1,4 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 8 AND [IdUsuario] = 0) +BEGIN + DELETE FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 8 AND [IdUsuario] = 0; +END diff --git a/Decompiler/Gestor.Application.Migration.Files.20210610_126.SQL b/Decompiler/Gestor.Application.Migration.Files.20210610_126.SQL new file mode 100644 index 0000000..849d697 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210610_126.SQL @@ -0,0 +1,20 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND NOT EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 8 AND [IdUsuario] = 0) +BEGIN + INSERT INTO [dbo].[CamposRelatorios] +VALUES +(0, 8, N'Cliente', N'CLIENTE', 0, N'', 0), +(0, 8, N'PremioLiquido', N'PRMIO LQUIDO', 0, N'VALOR', 1), +(0, 8, N'Comissao', N'COMISSO', 0, N'PERCENTUAL', 2), +(0, 8, N'ComissaoPrevista', N'COMISSO PREVISTA', 0, N'VALOR', 3), +(0, 8, N'ComissaoRecebida', N'COMISSO RECEBIDA', 0, N'VALOR', 4), +(0, 8, N'ComissaoPendente', N'COMISSO PENDENTE', 0, N'VALOR', 5), +(0, 8, N'Completo', N'RECEBIDO POR COMPLETO', 0, N'', 6), +(0, 8, N'Seguradora', N'SEGURADORA', 0, N'', 7), +(0, 8, N'Ramo', N'RAMO', 0, N'', 8), +(0, 8, N'Apolice', N'APLICE', 0, N'', 9), +(0, 8, N'Endosso', N'ENDOSSO', 0, N'', 10), +(0, 8, N'Vendedor', N'VENDEDOR PRINCIPAL', 0, N'', 13), +(0, 8, N'VigenciaInicial', N'VIGNCIA INICIAL', 0, N'DATA', 12), +(0, 8, N'Status', N'STATUS', 0, N'', 11), +(0, 8, N'Item', N'ITEM', 0, N'', 14) +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210610_127.SQL b/Decompiler/Gestor.Application.Migration.Files.20210610_127.SQL new file mode 100644 index 0000000..d400115 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210610_127.SQL @@ -0,0 +1,4 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 4 AND [IdUsuario] = 0) +BEGIN + DELETE FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 4 AND [IdUsuario] = 0; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210610_128.SQL b/Decompiler/Gestor.Application.Migration.Files.20210610_128.SQL new file mode 100644 index 0000000..8098fbe --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210610_128.SQL @@ -0,0 +1,24 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND NOT EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 4 AND [IdUsuario] = 0) +BEGIN + INSERT INTO [dbo].[CamposRelatorios] +VALUES +(0, 4, N'VigenciaFinal', N'VIGNCIA FINAL', 0, N'DATA?', 0), +(0, 4, N'Cliente', N'CLIENTE', 0, N'', 1), +(0, 4, N'DocumentoCliente', N'DOCUMENTO DO CLIENTE', 0, N'', 2), +(0, 4, N'Telefone', N'TELEFONE', 0, N'', 17), +(0, 4, N'Seguradora', N'SEGURADORA', 0, N'', 3), +(0, 4, N'Ramo', N'RAMO', 0, N'', 4), +(0, 4, N'Produto', N'PRODUTO', 0, N'', 5), +(0, 4, N'PremioLiquido', N'PRMIO LQUIDO', 0, N'VALOR', 6), +(0, 4, N'PremioTotal', N'PRMIO TOTAL', 0, N'VALOR', 7), +(0, 4, N'Comissao', N'COMISSO', 0, N'PERCENTUAL', 8), +(0, 4, N'Apolice', N'APLICE', 0, N'', 9), +(0, 4, N'Sinistro', N'SINISTRO', 0, N'', 10), +(0, 4, N'QtdSinistro', N'QUANTIDADE DE SINISTRO', 0, N'INT', 11), +(0, 4, N'Item', N'ITEM', 0, N'', 12), +(0, 4, N'TipoDocumento', N'TIPO DOCUMENTO', 0, N'', 13), +(0, 4, N'Negocio', N'TIPO RENOVAO', 0, N'', 14), +(0, 4, N'Vendedor', N'VENDEDOR PRINCIPAL', 0, N'', 15), +(0, 4, N'TodosVendedores', N'TODOS VENDEDORES', 0, N'', 16), +(0, 4, N'Status', N'STATUS', 0, N'', 18) +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210610_129.SQL b/Decompiler/Gestor.Application.Migration.Files.20210610_129.SQL new file mode 100644 index 0000000..c83ae86 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210610_129.SQL @@ -0,0 +1,4 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 10 AND [IdUsuario] = 0) +BEGIN + DELETE FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 10 AND [IdUsuario] = 0; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210610_130.SQL b/Decompiler/Gestor.Application.Migration.Files.20210610_130.SQL new file mode 100644 index 0000000..a4b2ca5 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210610_130.SQL @@ -0,0 +1,26 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND NOT EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 10 AND [IdUsuario] = 0) +BEGIN + INSERT INTO [dbo].[CamposRelatorios] +VALUES +(0, 10, N'Pendencia', N'PENDNCIA', 0, N'', 0), +(0, 10, N'Reclamacao', N'RECLAMAO', 0, N'DATA/TIME', 1), +(0, 10, N'DataSinistro', N'DATA OCORRNCIA', 0, N'DATA/TIME', 2), +(0, 10, N'TipoSinistro', N'TIPO', 0, N'ENUM', 3), +(0, 10, N'Nome', N'NOME', 0, N'', 4), +(0, 10, N'CpfCnpj', N'CPF/CNPJ', 0, N'', 5), +(0, 10, N'NumeroSinistro', N'NMERO SINISTRO', 0, N'', 6), +(0, 10, N'Ramo', N'RAMO', 0, N'', 7), +(0, 10, N'Item', N'ITEM', 0, N'', 8), +(0, 10, N'Seguradora', N'SEGURADORA', 0, N'', 9), +(0, 10, N'Apolice', N'APLICE', 0, N'', 10), +(0, 10, N'ValorFranquia', N'VALOR FRANQUIA', 0, N'VALOR', 11), +(0, 10, N'TipoPerda', N'TIPO PERDA', 0, N'', 12), +(0, 10, N'ValorOrcado', N'VALOR ORADO', 0, N'VALOR', 13), +(0, 10, N'ValorLiberado', N'VALOR LIBERADO', 0, N'VALOR', 14), +(0, 10, N'ValorSalvado', N'VALOR SALVADO', 0, N'VALOR', 15), +(0, 10, N'ValorPago', N'VALOR PAGO', 0, N'VALOR', 16), +(0, 10, N'Vendedor', N'VENDEDOR PRINCIPAL', 0, N'', 17), +(0, 10, N'VigenciaFinal', N'VIGNCIA FINAL', 0, N'DATA?', 19), +(0, 10, N'StatusSinistro', N'STATUS', 0, N'ENUM', 20), +(0, 10, N'Liquidacao', N'LIQUIDAO', 0, N'DATA?', 18) +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210610_131.SQL b/Decompiler/Gestor.Application.Migration.Files.20210610_131.SQL new file mode 100644 index 0000000..4385c66 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210610_131.SQL @@ -0,0 +1,4 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 9 AND [IdUsuario] = 0) +BEGIN + DELETE FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 9 AND [IdUsuario] = 0; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210610_132.SQL b/Decompiler/Gestor.Application.Migration.Files.20210610_132.SQL new file mode 100644 index 0000000..5544da7 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210610_132.SQL @@ -0,0 +1,23 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND NOT EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 9 AND [IdUsuario] = 0) +BEGIN + INSERT INTO [dbo].[CamposRelatorios] +VALUES +(0, 9, 'Pendencia', 'PENDNCIA', 0, '', 0), +(0, 9, 'Reclamacao', 'RECLAMAO', 0, 'DATA/TIME', 1), +(0, 9, 'DataSinistro', 'DATA OCORRNCIA', 0, 'DATA/TIME', 2), +(0, 9, 'TipoSinistro', 'TIPO', 0, 'ENUM', 3), +(0, 9, 'Nome', 'NOME', 0, '', 4), +(0, 9, 'CpfCnpj', 'CPF/CNPJ', 0, '', 5), +(0, 9, 'NumeroSinistro', 'NMERO SINISTRO', 0, '', 6), +(0, 9, 'Auxiliar', 'AUXILIAR', 0, '', 7), +(0, 9, 'Ramo', 'RAMO', 0, '', 8), +(0, 9, 'Item', 'ITEM', 0, '', 9), +(0, 9, 'Seguradora', 'SEGURADORA', 0, '', 10), +(0, 9, 'Apolice', 'APLICE', 0, '', 11), +(0, 9, 'TipoPerda', 'TIPO PERDA', 0, '', 12), +(0, 9, 'Mecanica', 'MECNICA', 0, '', 13), +(0, 9, 'Funilaria', 'FUNILARIA', 0, '', 14), +(0, 9, 'Vendedor', 'VENDEDOR PRINCIPAL', 0, '', 15), +(0, 9, 'VigenciaFinal', 'VIGNCIA FINAL', 0, 'DATA?', 16), +(0, 9, 'StatusSinistro', 'STATUS', 0, 'ENUM', 17) +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210614_133-.SQL b/Decompiler/Gestor.Application.Migration.Files.20210614_133-.SQL new file mode 100644 index 0000000..503c52d --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210614_133-.SQL @@ -0,0 +1,4 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 1 AND [IdUsuario] = 0) +BEGIN + DELETE FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 1 AND [IdUsuario] = 0; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210614_134.SQL b/Decompiler/Gestor.Application.Migration.Files.20210614_134.SQL new file mode 100644 index 0000000..f88a557 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210614_134.SQL @@ -0,0 +1,16 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND NOT EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 1 AND [IdUsuario] = 0) +BEGIN + INSERT INTO [dbo].[CamposRelatorios] +VALUES +(0, 1, 'Nascimento', 'NASCIMENTO', NULL, 'DATA?', 0), +(0, 1, 'Idade', 'ANOS DE IDADE', NULL, '', 1), +(0, 1, 'Nome', 'CLIENTE', NULL, '', 2), +(0, 1, 'TipoPessoa', 'TIPO DE PESSOA', NULL, '', 3), +(0, 1, 'Ativo', 'ATIVO', NULL, '', 4), +(0, 1, 'Telefone', 'TELEFONE', NULL, '', 5), +(0, 1, 'Email', 'E-MAIL', NULL, '', 6), +(0, 1, 'Cidade', 'CIDADE', NULL, '', 7), +(0, 1, 'Estado', 'ESTADO', NULL, '', 8), +(0, 1, 'Ramo', 'RAMO', NULL, '', 9), +(0, 1, 'Vendedor', 'VENDEDOR', NULL, '', 10) +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210614_135.SQL b/Decompiler/Gestor.Application.Migration.Files.20210614_135.SQL new file mode 100644 index 0000000..c40fc81 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210614_135.SQL @@ -0,0 +1,4 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 0 AND [IdUsuario] = 0) +BEGIN + DELETE FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 0 AND [IdUsuario] = 0; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210614_136.SQL b/Decompiler/Gestor.Application.Migration.Files.20210614_136.SQL new file mode 100644 index 0000000..a10e58f --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210614_136.SQL @@ -0,0 +1,20 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND NOT EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 0 AND [IdUsuario] = 0) +BEGIN + INSERT INTO [dbo].[CamposRelatorios] +VALUES +(0, 0, N'Nome', N'CLIENTE', NULL, N'', 0), +(0, 0, N'TipoPessoa', N'TIPO DE PESSOA', NULL, N'', 1), +(0, 0, N'Documento', N'CPF/CNPJ', NULL, N'', 2), +(0, 0, N'Ativo', N'ATIVO', NULL, N'', 3), +(0, 0, N'Sexo', N'SEXO', NULL, N'', 4), +(0, 0, N'Cidade', N'CIDADE', NULL, N'', 5), +(0, 0, N'Estado', N'ESTADO', NULL, N'', 6), +(0, 0, N'Telefone', N'TELEFONE', NULL, N'', 7), +(0, 0, N'Email', N'E-MAIL', NULL, N'', 8), +(0, 0, N'Nascimento', N'NASCIMENTO', NULL, N'DATA?', 9), +(0, 0, N'Idade', N'ANOS DE IDADE', NULL, N'', 10), +(0, 0, N'Profissao', N'PROFISSO', NULL, N'', 11), +(0, 0, N'Ramo', N'RAMO', NULL, N'', 12), +(0, 0, N'VencimentoCnh', N'VENCIMENTO CNH', NULL, N'DATA?', 13), +(0, 0, N'Vendedor', N'VENDEDOR', NULL, N'', 14) +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210614_137.SQL b/Decompiler/Gestor.Application.Migration.Files.20210614_137.SQL new file mode 100644 index 0000000..83dfb41 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210614_137.SQL @@ -0,0 +1,4 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 17 AND [IdUsuario] = 0) +BEGIN + DELETE FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 17 AND [IdUsuario] = 0; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210614_138.SQL b/Decompiler/Gestor.Application.Migration.Files.20210614_138.SQL new file mode 100644 index 0000000..fd7be84 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210614_138.SQL @@ -0,0 +1,16 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND NOT EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 17 AND [IdUsuario] = 0) +BEGIN + INSERT INTO [dbo].[CamposRelatorios] +VALUES +(0, 17, N'Vencimento', N'VENCIMENTO', NULL, N'', 0), +(0, 17, N'Cliente', N'CLIENTE', NULL, N'', 1), +(0, 17, N'Telefone', N'TELEFONE', NULL, N'', 2), +(0, 17, N'Email', N'E-MAIL', NULL, N'', 3), +(0, 17, N'Categoria', N'CATEGORIA', NULL, N'', 5), +(0, 17, N'Ramo', N'RAMO', NULL, N'', 4), +(0, 17, N'Item', N'ITEM', NULL, N'', 6), +(0, 17, N'Placa', N'PLACA', NULL, N'', 7), +(0, 17, N'Seguradora', N'SEGURADORA', NULL, N'', 8), +(0, 17, N'Vendedor', N'VENDEDOR PRINCIPAL', NULL, N'', 9), +(0, 17, N'TodosVendedores', N'TODOS VENDEDORES', NULL, N'', 10) +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210614_139.SQL b/Decompiler/Gestor.Application.Migration.Files.20210614_139.SQL new file mode 100644 index 0000000..b1b4486 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210614_139.SQL @@ -0,0 +1,4 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 26 AND [IdUsuario] = 0) +BEGIN + DELETE FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 26 AND [IdUsuario] = 0; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210614_140.SQL b/Decompiler/Gestor.Application.Migration.Files.20210614_140.SQL new file mode 100644 index 0000000..4820498 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210614_140.SQL @@ -0,0 +1,18 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND NOT EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 26 AND [IdUsuario] = 0) +BEGIN + INSERT INTO [dbo].[CamposRelatorios] +VALUES +(0, 26, N'VigenciaInicial', N'VIGNCIA INICIAL', NULL, N'DATA', 2), +(0, 26, N'Cliente', N'CLIENTE', NULL, N'', 1), +(0, 26, N'Importado', N'DATA IMPORTAO', NULL, N'DATA', 0), +(0, 26, N'Criticado', N'DATA CRTICA', NULL, N'DATA?', 3), +(0, 26, N'Tipo', N'TIPO DOCUMENTO', NULL, N'', 4), +(0, 26, N'Ramo', N'RAMO', NULL, N'', 5), +(0, 26, N'Seguradora', N'SEGURADORA', NULL, N'', 6), +(0, 26, N'Proposta', N'PROPOSTA', NULL, N'', 7), +(0, 26, N'Apolice', N'APLICE', NULL, N'', 8), +(0, 26, N'PropostaEndosso', N'PROPOSTA ENDOSSO', NULL, N'', 9), +(0, 26, N'UsuarioImportacao', N'USURIO IMPORTAO', NULL, N'', 10), +(0, 26, N'UsuarioCritica', N'USURIO CRTICA', NULL, N'', 11), +(0, 26, N'Pendencia', N'PENDNCIA', NULL, N'', 12) +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210614_141.SQL b/Decompiler/Gestor.Application.Migration.Files.20210614_141.SQL new file mode 100644 index 0000000..e7c640e --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210614_141.SQL @@ -0,0 +1,4 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 6 AND [IdUsuario] = 0) +BEGIN + DELETE FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 6 AND [IdUsuario] = 0; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210614_142.SQL b/Decompiler/Gestor.Application.Migration.Files.20210614_142.SQL new file mode 100644 index 0000000..22c3c91 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210614_142.SQL @@ -0,0 +1,23 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND NOT EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 6 AND [IdUsuario] = 0) +BEGIN + INSERT INTO [dbo].[CamposRelatorios] +VALUES +(0, 6, N'Pendencia', N'PENDNCIA', NULL, N'', 0), +(0, 6, N'Vencimento', N'VENCIMENTO', NULL, N'DATA', 1), +(0, 6, N'Cliente', N'CLIENTE', NULL, N'', 2), +(0, 6, N'Pendentes', N'PARCELA', NULL, N'', 3), +(0, 6, N'ValorParcela', N'VALOR PARCELA', NULL, N'VALOR', 4), +(0, 6, N'ComissaoPerc', N'COMISSO', NULL, N'PERCENTUAL', 5), +(0, 6, N'ComissaoPrevista', N'COMISSO PREVISTA', NULL, N'VALOR', 6), +(0, 6, N'Ramo', N'RAMO', NULL, N'', 8), +(0, 6, N'Seguradora', N'SEGURADORA', NULL, N'', 9), +(0, 6, N'TipoDocumento', N'TIPO DOCUMENTO', NULL, N'', 10), +(0, 6, N'ComissaoGerada', N'COMISSO GERADA', NULL, N'VALOR', 7), +(0, 6, N'Apolice', N'APLICE', NULL, N'', 12), +(0, 6, N'Endosso', N'ENDOSSO', NULL, N'', 13), +(0, 6, N'Vendedor', N'VENDEDOR PRINCIPAL', NULL, N'', 14), +(0, 6, N'TodosVendedores', N'TODOS VENDEDORES', NULL, N'', 15), +(0, 6, N'VigenciaFinal', N'VIGNCIA FINAL', NULL, N'DATA?', 16), +(0, 6, N'Status', N'STATUS', NULL, N'', 11) + +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210614_143.SQL b/Decompiler/Gestor.Application.Migration.Files.20210614_143.SQL new file mode 100644 index 0000000..619eacd --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210614_143.SQL @@ -0,0 +1,4 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 7 AND [IdUsuario] = 0) +BEGIN + DELETE FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 7 AND [IdUsuario] = 0; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210614_144.SQL b/Decompiler/Gestor.Application.Migration.Files.20210614_144.SQL new file mode 100644 index 0000000..c64ae79 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210614_144.SQL @@ -0,0 +1,27 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND NOT EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 7 AND [IdUsuario] = 0) +BEGIN + INSERT INTO [dbo].[CamposRelatorios] +VALUES +(0, 7, N'Recebimento', N'RECEBIMENTO', NULL, N'DATA?', 0), +(0, 7, N'Cliente', N'CLIENTE', NULL, N'', 1), +(0, 7, N'ComissaoRepasse', N'% REPASSE', NULL, N'PERCENTUAL', 5), +(0, 7, N'Repasse', N'REPASSE', NULL, N'VALOR', 6), +(0, 7, N'ValorLiquido', N'VALOR LQUIDO', NULL, N'VALOR', 7), +(0, 7, N'PremioLiquido', N'PRMIO LQUIDO', NULL, N'VALOR?', 2), +(0, 7, N'PremioTotal', N'PRMIO TOTAL', NULL, N'VALOR?', 3), +(0, 7, N'Comissao', N'COMISSO', NULL, N'PERCENTUAL', 4), +(0, 7, N'Parcela', N'PARCELA', NULL, N'', 8), +(0, 7, N'ValorParcela', N'VALOR PARCELA', NULL, N'VALOR?', 9), +(0, 7, N'Ramo', N'RAMO', NULL, N'', 10), +(0, 7, N'Seguradora', N'SEGURADORA', NULL, N'', 11), +(0, 7, N'Status', N'STATUS', NULL, N'', 12), +(0, 7, N'Negocio', N'TIPO RENOVAO', NULL, N'', 13), +(0, 7, N'Proposta', N'PROPOSTA', NULL, N'', 14), +(0, 7, N'Apolice', N'APLICE', NULL, N'', 15), +(0, 7, N'PedidoEndosso', N'PEDIDO ENDOSSO', NULL, N'', 16), +(0, 7, N'Endosso', N'ENDOSSO', NULL, N'', 17), +(0, 7, N'DataPagamento', N'DATA PAGAMENTO', NULL, N'DATA?', 21), +(0, 7, N'Vendedor', N'VENDEDOR', NULL, N'', 18), +(0, 7, N'VigenciaIncial', N'VIGNCIA INICIAL', NULL, N'DATA?', 19), +(0, 7, N'VigenciaFinal', N'VIGNCIA FINAL', NULL, N'DATA?', 20) +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210614_145.SQL b/Decompiler/Gestor.Application.Migration.Files.20210614_145.SQL new file mode 100644 index 0000000..80c7bc7 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210614_145.SQL @@ -0,0 +1,4 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 20 AND [IdUsuario] = 0) +BEGIN + DELETE FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 20 AND [IdUsuario] = 0; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210614_146.SQL b/Decompiler/Gestor.Application.Migration.Files.20210614_146.SQL new file mode 100644 index 0000000..2e39761 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210614_146.SQL @@ -0,0 +1,18 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND NOT EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 20 AND [IdUsuario] = 0) +BEGIN + INSERT INTO [dbo].[CamposRelatorios] +VALUES +(0, 20, N'VencimentoParcela', N'VENCIMENTO PARCELA', NULL, N'DATA', 0), +(0, 20, N'Nome', N'NOME', NULL, N'', 1), +(0, 20, N'Repasse', N'REPASSE', NULL, N'VALOR', 2), +(0, 20, N'RepasseLiquido', N'REPASSE LQUIDO', NULL, N'VALOR', 3), +(0, 20, N'Parcela', N'PARCELA', NULL, N'', 4), +(0, 20, N'PremioLiquido', N'PRMIO LQUIDO', NULL, N'VALOR', 5), +(0, 20, N'NomeRamo', N'RAMO', NULL, N'', 6), +(0, 20, N'NomeSeguradora', N'SEGURADORA', NULL, N'', 7), +(0, 20, N'TipoDocumento', N'TIPO DOCUMENTO', NULL, N'', 8), +(0, 20, N'Status', N'STATUS', NULL, N'', 9), +(0, 20, N'Apolice', N'APLICE', NULL, N'', 10), +(0, 20, N'Endosso', N'ENDOSSO', NULL, N'', 11), +(0, 20, N'VigenciaInicial', N'VIGNCIA INICIAL', NULL, N'DATA', 12) +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210615_147.SQL b/Decompiler/Gestor.Application.Migration.Files.20210615_147.SQL new file mode 100644 index 0000000..3d1d2bc --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210615_147.SQL @@ -0,0 +1,4 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 13 AND [IdUsuario] = 0) +BEGIN + DELETE FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 13 AND [IdUsuario] = 0; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210615_148.SQL b/Decompiler/Gestor.Application.Migration.Files.20210615_148.SQL new file mode 100644 index 0000000..46c6c61 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210615_148.SQL @@ -0,0 +1,17 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND NOT EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 13 AND [IdUsuario] = 0) +BEGIN + INSERT INTO [dbo].[CamposRelatorios] +VALUES +(0, 13, N'Numero', N'NMERO', NULL, N'', 0), +(0, 13, N'Data', N'DATA', NULL, N'DATA?', 1), +(0, 13, N'DataCredito', N'DATA DE CRDITO', NULL, N'DATA?', 2), +(0, 13, N'Seguradora', N'SEGURADORA', NULL, N'', 3), +(0, 13, N'Liquido', N'LQUIDO', NULL, N'VALOR', 4), +(0, 13, N'Bruto', N'BRUTO', NULL, N'VALOR', 5), +(0, 13, N'Iss', N'ISS', NULL, N'VALOR', 6), +(0, 13, N'Ir', N'IR', NULL, N'VALOR', 7), +(0, 13, N'Outro', N'OUTRO', NULL, N'VALOR', 8), +(0, 13, N'Status', N'STATUS', NULL, N'', 9), +(0, 13, N'Historico', N'HISTRICO', NULL, N'', 10), +(0, 13, N'Observacao', N'OBSERVAO', NULL, N'', 11) +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210615_149.SQL b/Decompiler/Gestor.Application.Migration.Files.20210615_149.SQL new file mode 100644 index 0000000..bad972a --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210615_149.SQL @@ -0,0 +1,4 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 19 AND [IdUsuario] = 0) +BEGIN + DELETE FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 19 AND [IdUsuario] = 0; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210615_150.SQL b/Decompiler/Gestor.Application.Migration.Files.20210615_150.SQL new file mode 100644 index 0000000..d236e99 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210615_150.SQL @@ -0,0 +1,10 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND NOT EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 19 AND [IdUsuario] = 0) +BEGIN + INSERT INTO [dbo].[CamposRelatorios] +VALUES +(0, 19, N'Data', N'DATA', NULL, N'DATA?', 0), +(0, 19, N'Seguradora', N'SEGURADORA', NULL, N'', 1), +(0, 19, N'Bruto', N'VALOR BRUTO', NULL, N'VALOR', 2), +(0, 19, N'Liquido', N'VALOR LQUIDO', NULL, N'VALOR', 3), +(0, 19, N'Iss', N'ISS', NULL, N'VALOR', 4) +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210615_151.SQL b/Decompiler/Gestor.Application.Migration.Files.20210615_151.SQL new file mode 100644 index 0000000..0e432be --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210615_151.SQL @@ -0,0 +1,4 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 23 AND [IdUsuario] = 0) +BEGIN + DELETE FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 23 AND [IdUsuario] = 0; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210615_152.SQL b/Decompiler/Gestor.Application.Migration.Files.20210615_152.SQL new file mode 100644 index 0000000..2213c2a --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210615_152.SQL @@ -0,0 +1,16 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND NOT EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 23 AND [IdUsuario] = 0) +BEGIN + INSERT INTO [dbo].[CamposRelatorios] +VALUES +(0, 23, N'Data', N'DATA', NULL, N'DATA', 0), +(0, 23, N'UsuarioAgger', N'USURIO AGGER', NULL, N'', 1), +(0, 23, N'Remetente', N'REMETENTE', NULL, N'', 2), +(0, 23, N'Assunto', N'ASSUNTO', NULL, N'', 3), +(0, 23, N'Destinatarios', N'DESTINATRIOS', NULL, N'', 4), +(0, 23, N'Cco', N'CCO', NULL, N'', 5), +(0, 23, N'Tela', N'TELA', NULL, N'', 6), +(0, 23, N'Ip', N'IP', NULL, N'', 7), +(0, 23, N'Maquina', N'MQUINA', NULL, N'', 8), +(0, 23, N'UsuarioMaquina', N'USURIO DA MQUINA', NULL, N'', 9), +(0, 23, N'Versao', N'VERSO', NULL, N'', 10) +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210615_153.SQL b/Decompiler/Gestor.Application.Migration.Files.20210615_153.SQL new file mode 100644 index 0000000..f3058b8 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210615_153.SQL @@ -0,0 +1,4 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 24 AND [IdUsuario] = 0) +BEGIN + DELETE FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 24 AND [IdUsuario] = 0; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210615_154.SQL b/Decompiler/Gestor.Application.Migration.Files.20210615_154.SQL new file mode 100644 index 0000000..aa74cf2 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210615_154.SQL @@ -0,0 +1,14 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND NOT EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 24 AND [IdUsuario] = 0) +BEGIN + INSERT INTO [dbo].[CamposRelatorios] +VALUES +(0, 24, N'Data', N'DATA', NULL, N'DATA/TIME', 0), +(0, 24, N'UsuarioAgger', N'USURIO AGGER', NULL, N'', 1), +(0, 24, N'EntidadeId', N'CDIGO', NULL, N'', 2), +(0, 24, N'Acesso', N'ACESSO', NULL, N'', 3), +(0, 24, N'Descricao', N'DESCRIO', NULL, N'', 4), +(0, 24, N'Ip', N'IP', NULL, N'', 5), +(0, 24, N'Maquina', N'MQUINA', NULL, N'', 6), +(0, 24, N'UsuarioMaquina', N'USURIO DA MQUINA', NULL, N'', 7), +(0, 24, N'Versao', N'VERSO SISTEMA', NULL, N'', 8) +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210615_155.SQL b/Decompiler/Gestor.Application.Migration.Files.20210615_155.SQL new file mode 100644 index 0000000..9d17f22 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210615_155.SQL @@ -0,0 +1,4 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 18 AND [IdUsuario] = 0) +BEGIN + DELETE FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 18 AND [IdUsuario] = 0; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210615_156.SQL b/Decompiler/Gestor.Application.Migration.Files.20210615_156.SQL new file mode 100644 index 0000000..94e7f03 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210615_156.SQL @@ -0,0 +1,13 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND NOT EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 18 AND [IdUsuario] = 0) +BEGIN + INSERT INTO [dbo].[CamposRelatorios] +VALUES +(0, 18, N'Agendamento', N'AGENDAMENTO', NULL, N'DATA/TIME', 0), +(0, 18, N'Usuario', N'USURIO', NULL, N'', 1), +(0, 18, N'Cliente', N'CLIENTE', NULL, N'', 2), +(0, 18, N'Titulo', N'TTULO', NULL, N'', 3), +(0, 18, N'Status', N'STATUS', NULL, N'', 4), +(0, 18, N'Conclusao', N'CONCLUSO', NULL, N'DATA/TIME?', 5), +(0, 18, N'Referencia', N'REFERNCIA', NULL, N'', 6), +(0, 18, N'TipoTarefa', N'TIPO DE TAREFA', NULL, N'', 7) +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210615_157.SQL b/Decompiler/Gestor.Application.Migration.Files.20210615_157.SQL new file mode 100644 index 0000000..15b0b48 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210615_157.SQL @@ -0,0 +1,4 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 5 AND [IdUsuario] = 0) +BEGIN + DELETE FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 5 AND [IdUsuario] = 0; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210615_158.SQL b/Decompiler/Gestor.Application.Migration.Files.20210615_158.SQL new file mode 100644 index 0000000..0576b8c --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210615_158.SQL @@ -0,0 +1,21 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND NOT EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 5 AND [IdUsuario] = 0) +BEGIN + INSERT INTO [dbo].[CamposRelatorios] +VALUES +(0, 5, N'Recebimento', N'RECEBIMENTO', NULL, N'DATA?', 0), +(0, 5, N'Cliente', N'CLIENTE', NULL, N'', 1), +(0, 5, N'ComissaoBruta', N'RECEBIMENTO BRUTO', NULL, N'VALOR', 2), +(0, 5, N'ComissaoRecebida', N'COMISSO RECEBIDA', NULL, N'VALOR', 3), +(0, 5, N'Repasse', N'REPASSE', NULL, N'VALOR', 4), +(0, 5, N'Vendedor', N'VENDEDOR PRINCIPAL', NULL, N'', 5), +(0, 5, N'Parcela', N'PARCELA', NULL, N'', 6), +(0, 5, N'SubTipo', N'TIPO DE PARCELA', NULL, N'ENUM', 7), +(0, 5, N'Ramo', N'RAMO', NULL, N'', 8), +(0, 5, N'Seguradora', N'SEGURADORA', NULL, N'', 9), +(0, 5, N'TipoDocumento', N'TIPO', NULL, N'', 10), +(0, 5, N'Status', N'STATUS', NULL, N'', 11), +(0, 5, N'TodosVendedores', N'TODOS VENDEDORES', NULL, N'', 12), +(0, 5, N'Apolice', N'APLICE', NULL, N'', 13), +(0, 5, N'Endosso', N'ENDOSSO', NULL, N'', 14), +(0, 5, N'VigenciaInicial', N'VIGNCIA INICIAL', NULL, N'DATA', 15) +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210615_159.SQL b/Decompiler/Gestor.Application.Migration.Files.20210615_159.SQL new file mode 100644 index 0000000..7336ed5 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210615_159.SQL @@ -0,0 +1,4 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 16 AND [IdUsuario] = 0) +BEGIN + DELETE FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 16 AND [IdUsuario] = 0; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210615_160.SQL b/Decompiler/Gestor.Application.Migration.Files.20210615_160.SQL new file mode 100644 index 0000000..2fa6740 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210615_160.SQL @@ -0,0 +1,23 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND NOT EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 16 AND [IdUsuario] = 0) +BEGIN + INSERT INTO [dbo].[CamposRelatorios] +VALUES +(0, 16, N'Vencimento', N'VENCIMENTO', NULL, N'DATA', 0), +(0, 16, N'Cliente', N'CLIENTE', NULL, N'', 1), +(0, 16, N'ValorParcela', N'VALOR PARCELA', NULL, N'VALOR', 2), +(0, 16, N'ComissaoPerc', N'COMISSO', NULL, N'PERCENTUAL', 3), +(0, 16, N'ComissaoPrevista', N'COMISSO PREVISTA', NULL, N'VALOR', 4), +(0, 16, N'ComissaoGerada', N'COMISSO GERADA', NULL, N'VALOR', 5), +(0, 16, N'Pendentes', N'PARCELA', NULL, N'', 6), +(0, 16, N'SubTipo', N'TIPO DE PARCELA', NULL, N'ENUM', 7), +(0, 16, N'FormaPagamento', N'FORMA DE PAGAMENTO', NULL, N'', 8), +(0, 16, N'Pendencia', N'PENDNCIA', NULL, N'', 9), +(0, 16, N'Ramo', N'RAMO', NULL, N'', 10), +(0, 16, N'Seguradora', N'SEGURADORA', NULL, N'', 11), +(0, 16, N'TipoDocumento', N'TIPO DOCUMENTO', NULL, N'', 12), +(0, 16, N'Apolice', N'APLICE', NULL, N'', 13), +(0, 16, N'Endosso', N'ENDOSSO', NULL, N'', 14), +(0, 16, N'Vendedor', N'VENDEDOR PRINCIPAL', NULL, N'', 15), +(0, 16, N'TodosVendedores', N'TODOS VENDEDORES', NULL, N'', 16), +(0, 16, N'VigenciaInicial', N'VIGNCIA INICIAL', NULL, N'DATA', 17) +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210622_161.SQL b/Decompiler/Gestor.Application.Migration.Files.20210622_161.SQL new file mode 100644 index 0000000..e4f3d79 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210622_161.SQL @@ -0,0 +1,4 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 12 AND [IdUsuario] = 0) +BEGIN + DELETE FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 12 AND [IdUsuario] = 0; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210622_162.SQL b/Decompiler/Gestor.Application.Migration.Files.20210622_162.SQL new file mode 100644 index 0000000..efc7af3 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210622_162.SQL @@ -0,0 +1,16 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND NOT EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 12 AND [IdUsuario] = 0) +BEGIN + INSERT INTO [dbo].[CamposRelatorios] +VALUES +(0, 12, N'Pendencia', N'PENDNCIA', NULL, N'', 0), +(0, 12, N'VigenciaFinalFatura', N'FINAL FATURA', NULL, N'DATA?', 1), +(0, 12, N'Cliente', N'CLIENTE', NULL, N'', 2), +(0, 12, N'Apolice', N'APLICE', NULL, N'', 3), +(0, 12, N'Fatura', N'ULTIMA FATURA', NULL, N'', 4), +(0, 12, N'Ramo', N'RAMO', NULL, N'', 5), +(0, 12, N'Seguradora', N'SEGURADORA', NULL, N'', 6), +(0, 12, N'Status', N'STATUS', NULL, N'', 7), +(0, 12, N'Vendedor', N'VENDEDOR PRINCIPAL', NULL, N'', 8), +(0, 12, N'VigenciaInicial', N'VIGNCIA INICIAL', NULL, N'DATA', 9), +(0, 12, N'Item', N'ITEM', NULL, N'', 10) +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210622_163.SQL b/Decompiler/Gestor.Application.Migration.Files.20210622_163.SQL new file mode 100644 index 0000000..649e3e6 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210622_163.SQL @@ -0,0 +1,4 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 11 AND [IdUsuario] = 0) +BEGIN + DELETE FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 11 AND [IdUsuario] = 0; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210622_164.SQL b/Decompiler/Gestor.Application.Migration.Files.20210622_164.SQL new file mode 100644 index 0000000..1e4ebb4 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210622_164.SQL @@ -0,0 +1,28 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND NOT EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 11 AND [IdUsuario] = 0) +BEGIN + INSERT INTO [dbo].[CamposRelatorios] +VALUES +(0, 11, N'Nome', N'NOME', NULL, N'', 1), +(0, 11, N'Gerada', N'COMISSO GERADA', NULL, N'VALOR', 2), +(0, 11, N'GeradaAnterior', N'COMISSO GERADA ANTERIOR', NULL, N'VALOR', 3), +(0, 11, N'Paga', N'COMISSO PAGA', NULL, N'VALOR', 4), +(0, 11, N'PagaAnterior', N'COMISSO PAGA ANTERIOR', NULL, N'VALOR', 5), +(0, 11, N'Recebida', N'COMISSO RECEBIDA', NULL, N'VALOR', 6), +(0, 11, N'RecebidaAnterior', N'COMISSO RECEBIDA ANTERIOR', NULL, N'VALOR', 7), +(0, 11, N'Fechada', N'MDIA FECHADA', NULL, N'PERCENTUAL', 8), +(0, 11, N'FechadaAnterior', N'MDIA FECHADA ANTERIOR', NULL, N'PERCENTUAL', 9), +(0, 11, N'Mix', N'MDIA MIX %', NULL, N'PERCENTUAL', 10), +(0, 11, N'MixAnterior', N'MDIA MIX % ANTERIOR', NULL, N'PERCENTUAL', 11), +(0, 11, N'PremioLiquido', N'PRMIO LQUIDO', NULL, N'VALOR', 12), +(0, 11, N'PremioLiquidoAnterior', N'PRMIO LQUIDO ANTERIOR', NULL, N'VALOR', 13), +(0, 11, N'PremioTotal', N'PRMIO TOTAL', NULL, N'VALOR', 14), +(0, 11, N'PremioTotalAnterior', N'PRMIO TOTAL ANTERIOR', NULL, N'VALOR', 15), +(0, 11, N'Apolice', N'QTD APLICE', NULL, N'QUANTIDADE', 16), +(0, 11, N'ApoliceAnterior', N'QTD APLICE ANTERIOR', NULL, N'QUANTIDADE', 17), +(0, 11, N'Endosso', N'QTD ENDOSSO', NULL, N'QUANTIDADE', 18), +(0, 11, N'Fatura', N'QTD FATURA', NULL, N'QUANTIDADE', 19), +(0, 11, N'EndossoAnterior', N'QTD ENDOSSO ANTERIOR', NULL, N'QUANTIDADE', 20), +(0, 11, N'FaturaAnterior', N'QTD FATURA ANTERIOR', NULL, N'QUANTIDADE', 21), +(0, 11, N'Itens', N'QTD ITENS', NULL, N'QUANTIDADE', 22), +(0, 11, N'ItensAnterior', N'QTD ITENS ANTERIOR', NULL, N'QUANTIDADE', 23) +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210629_165.SQL b/Decompiler/Gestor.Application.Migration.Files.20210629_165.SQL new file mode 100644 index 0000000..1c61c3b --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210629_165.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [idciaseg] = 602) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (602, N'ITURAN SERVIOS LTDA.', 0, 2); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210708_166-.SQL b/Decompiler/Gestor.Application.Migration.Files.20210708_166-.SQL new file mode 100644 index 0000000..649e3e6 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210708_166-.SQL @@ -0,0 +1,4 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 11 AND [IdUsuario] = 0) +BEGIN + DELETE FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 11 AND [IdUsuario] = 0; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210708_167.SQL b/Decompiler/Gestor.Application.Migration.Files.20210708_167.SQL new file mode 100644 index 0000000..0820982 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210708_167.SQL @@ -0,0 +1,30 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND NOT EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 11 AND [IdUsuario] = 0) +BEGIN + INSERT INTO [dbo].[CamposRelatorios] +VALUES +(0, 11, N'Nome', N'NOME', NULL, N'', 1), +(0, 11, N'Gerada', N'COMISSO GERADA', NULL, N'VALOR', 2), +(0, 11, N'GeradaAnterior', N'COMISSO GERADA ANTERIOR', NULL, N'VALOR', 3), +(0, 11, N'Paga', N'COMISSO PAGA', NULL, N'VALOR', 4), +(0, 11, N'PagaAnterior', N'COMISSO PAGA ANTERIOR', NULL, N'VALOR', 5), +(0, 11, N'Recebida', N'COMISSO RECEBIDA', NULL, N'VALOR', 6), +(0, 11, N'RecebidaAnterior', N'COMISSO RECEBIDA ANTERIOR', NULL, N'VALOR', 7), +(0, 11, N'Pendente', N'COMISSO PENDENTE', NULL, N'VALOR', 8), +(0, 11, N'PendenteAnterior', N'COMISSO PENDENTE ANTERIOR', NULL, N'VALOR', 9), +(0, 11, N'Fechada', N'MDIA FECHADA', NULL, N'PERCENTUAL', 10), +(0, 11, N'FechadaAnterior', N'MDIA FECHADA ANTERIOR', NULL, N'PERCENTUAL', 11), +(0, 11, N'Mix', N'MDIA MIX %', NULL, N'PERCENTUAL', 12), +(0, 11, N'MixAnterior', N'MDIA MIX % ANTERIOR', NULL, N'PERCENTUAL', 13), +(0, 11, N'PremioLiquido', N'PRMIO LQUIDO', NULL, N'VALOR', 14), +(0, 11, N'PremioLiquidoAnterior', N'PRMIO LQUIDO ANTERIOR', NULL, N'VALOR', 15), +(0, 11, N'PremioTotal', N'PRMIO TOTAL', NULL, N'VALOR', 16), +(0, 11, N'PremioTotalAnterior', N'PRMIO TOTAL ANTERIOR', NULL, N'VALOR', 17), +(0, 11, N'Apolice', N'QTD APLICE', NULL, N'QUANTIDADE', 18), +(0, 11, N'ApoliceAnterior', N'QTD APLICE ANTERIOR', NULL, N'QUANTIDADE', 19), +(0, 11, N'Endosso', N'QTD ENDOSSO', NULL, N'QUANTIDADE', 20), +(0, 11, N'Fatura', N'QTD FATURA', NULL, N'QUANTIDADE', 21), +(0, 11, N'EndossoAnterior', N'QTD ENDOSSO ANTERIOR', NULL, N'QUANTIDADE', 22), +(0, 11, N'FaturaAnterior', N'QTD FATURA ANTERIOR', NULL, N'QUANTIDADE', 23), +(0, 11, N'Itens', N'QTD ITENS', NULL, N'QUANTIDADE', 24), +(0, 11, N'ItensAnterior', N'QTD ITENS ANTERIOR', NULL, N'QUANTIDADE', 25) +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210708_168-.SQL b/Decompiler/Gestor.Application.Migration.Files.20210708_168-.SQL new file mode 100644 index 0000000..b5fb925 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210708_168-.SQL @@ -0,0 +1,4 @@ +IF EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [idciaseg] = 285) +BEGIN + UPDATE [dbo].[ciaseg] SET [NOME] = N'KOVR SEGURADORA' WHERE [IDCIASEG] = 285; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210722_169.SQL b/Decompiler/Gestor.Application.Migration.Files.20210722_169.SQL new file mode 100644 index 0000000..e4b21af --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210722_169.SQL @@ -0,0 +1,5 @@ +DECLARE @sql NVARCHAR(MAX) = N'ALTER TABLE cliente ADD MalaDireta BIT' +IF COL_LENGTH('[dbo].[cliente]', 'MalaDireta') IS NULL +BEGIN + exec sp_executesql @sql +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210819_170.SQL b/Decompiler/Gestor.Application.Migration.Files.20210819_170.SQL new file mode 100644 index 0000000..9b54e10 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210819_170.SQL @@ -0,0 +1,5 @@ +DECLARE @sql NVARCHAR(MAX) = N'ALTER TABLE empresa ADD LogoId VARCHAR(255);' +IF COL_LENGTH('[dbo].[empresa]', 'LogoId') IS NULL +BEGIN + exec sp_executesql @sql +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210820_171.SQL b/Decompiler/Gestor.Application.Migration.Files.20210820_171.SQL new file mode 100644 index 0000000..32b42b7 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210820_171.SQL @@ -0,0 +1,14 @@ +IF COL_LENGTH('[dbo].[vendedor]', 'idtipoconta') IS NULL +BEGIN + ALTER TABLE [dbo].vendedor ADD idtipoconta INT NULL; +END + +IF COL_LENGTH('[dbo].[vendedor]', 'titularconta') IS NULL +BEGIN + ALTER TABLE [dbo].vendedor ADD titularconta NVARCHAR NULL; +END + +IF COL_LENGTH('[dbo].[vendedor]', 'cpfcnpjtitular') IS NULL +BEGIN + ALTER TABLE [dbo].vendedor ADD cpfcnpjtitular NVARCHAR NULL; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210823_172.SQL b/Decompiler/Gestor.Application.Migration.Files.20210823_172.SQL new file mode 100644 index 0000000..0339fbc --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210823_172.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [idciaseg] = 402) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (402, N'PORTO SEGURO-SEGURO SADE S/A', 0, 2); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210825_173.SQL b/Decompiler/Gestor.Application.Migration.Files.20210825_173.SQL new file mode 100644 index 0000000..522ad8a --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210825_173.SQL @@ -0,0 +1,6 @@ +DECLARE @sql NVARCHAR(MAX) = N'ALTER TABLE [dbo].[vida] ADD obs VARCHAR(MAX) NULL;' + +IF COL_LENGTH('[dbo].[vida]', 'obs') IS NULL +BEGIN + exec sp_executesql @sql +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210825_174.SQL b/Decompiler/Gestor.Application.Migration.Files.20210825_174.SQL new file mode 100644 index 0000000..3776d35 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210825_174.SQL @@ -0,0 +1,9 @@ +DECLARE @sql NVARCHAR(MAX) = N'INSERT INTO vida (iditem, plano, obs) SELECT i.iditem, i.descricao, r.obs FROM item i INNER JOIN documento d on d.iddocumento = i.iddocumento INNER JOIN controle c on c.idcontrole = d.idcontrole INNER JOIN riscosdiversos r on r.iditem = i.iditem WHERE c.idramo = 47;' + +DECLARE @sqlDelete NVARCHAR(MAX) = N'DELETE FROM riscosdiversos WHERE iditem in (SELECT i.iditem FROM item i INNER JOIN documento d on d.iddocumento = i.iddocumento INNER JOIN controle c on c.idcontrole = d.idcontrole INNER JOIN riscosdiversos r on r.iditem = i.iditem WHERE c.idramo = 47);' + +IF EXISTS(SELECT 1 FROM item i INNER JOIN documento d on d.iddocumento = i.iddocumento INNER JOIN controle c on c.idcontrole = d.idcontrole INNER JOIN riscosdiversos r on r.iditem = i.iditem WHERE c.idramo = 47) +BEGIN + exec sp_executesql @sql + exec sp_executesql @sqlDelete +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210910_175.SQL b/Decompiler/Gestor.Application.Migration.Files.20210910_175.SQL new file mode 100644 index 0000000..f4043fe --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210910_175.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [idciaseg] = 27) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (27, N'AMERICAN LIFE COMPANHIA DE SEGUROS', 0, 2); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210916_176.SQL b/Decompiler/Gestor.Application.Migration.Files.20210916_176.SQL new file mode 100644 index 0000000..eaa4b59 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210916_176.SQL @@ -0,0 +1,16 @@ +DECLARE @constraint_name NVARCHAR(MAX), @table_name NVARCHAR(MAX), @column_name NVARCHAR(MAX) + +SET @table_name = 'origemcliente' +SET @column_name = 'idtipoorigemcli' + +select TOP 1 @constraint_name = fk.name +from sys.tables tab + inner join sys.columns col on col.object_id = tab.object_id + inner join sys.foreign_key_columns fk_cols on fk_cols.parent_object_id = tab.object_id and fk_cols.parent_column_id = col.column_id + inner join sys.foreign_keys fk on fk.object_id = fk_cols.constraint_object_id + WHERE tab.name = @table_name and col.name = @column_name; + +DECLARE @sqlDrop NVARCHAR(MAX) = N'ALTER TABLE ' + @table_name + ' DROP CONSTRAINT ' + @constraint_name + ';' + +IF @constraint_name IS NOT NULL + exec sp_executesql @sqlDrop \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20210916_177.SQL b/Decompiler/Gestor.Application.Migration.Files.20210916_177.SQL new file mode 100644 index 0000000..809eeab --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20210916_177.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 228) +BEGIN + INSERT INTO [dbo].[fabricante] ([IDFABRICANTE],[DESCRICAO]) VALUES (228, N'CFMOTO'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20211104_178.SQL b/Decompiler/Gestor.Application.Migration.Files.20211104_178.SQL new file mode 100644 index 0000000..bcc8d83 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20211104_178.SQL @@ -0,0 +1 @@ +UPDATE documento SET situacao = 5, situant = SITUACAO FROM documento d CROSS APPLY(select idcontrole FROMdocumento WHERE situacao = 5 AND idcontrole = d.idcontrole and tipo = 0) c WHERE d.situacao NOT IN (5,3,7) AND d.tipo = 1; \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20211223_179.SQL b/Decompiler/Gestor.Application.Migration.Files.20211223_179.SQL new file mode 100644 index 0000000..ea47ee1 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20211223_179.SQL @@ -0,0 +1,12 @@ +DECLARE @SQL NVARCHAR ( MAX ) = N'INSERT INTO auto (iditem, obs) SELECT i.iditem, r.obs FROM item i INNER JOIN documento d on d.iddocumento = i.iddocumento INNER JOIN controle c on c.idcontrole = d.idcontrole INNER JOIN riscosdiversos r on r.iditem = i.iditem WHERE c.idramo = 37;' +DECLARE @sqlDelete NVARCHAR ( MAX ) = N'DELETE FROM riscosdiversos WHERE iditem in (SELECT i.iditem FROM item i INNER JOIN documento d on d.iddocumento = i.iddocumento INNER JOIN controle c on c.idcontrole = d.idcontrole INNER JOIN riscosdiversos r on r.iditem = i.iditem WHERE c.idramo = 37);' +IF + EXISTS ( +SELECT 1 FROM item i INNER JOIN documento d ON d.iddocumento = i.iddocumento + INNER JOIN controle c ON c.idcontrole = d.idcontrole + INNER JOIN riscosdiversos r ON r.iditem = i.iditem +WHERE + c.idramo = 37 + ) BEGIN + EXEC sp_executesql @SQL EXEC sp_executesql @sqlDelete +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20211230_180.SQL b/Decompiler/Gestor.Application.Migration.Files.20211230_180.SQL new file mode 100644 index 0000000..bfd26fa --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20211230_180.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [idciaseg] = 885) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (885, N'SICOOB SEGURADORA DE VIDA E PREVIDENCIA SA', 0, 2); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20211230_181.SQL b/Decompiler/Gestor.Application.Migration.Files.20211230_181.SQL new file mode 100644 index 0000000..c2f4bc9 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20211230_181.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 129) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (129, 403, N'BANCO CORA'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20220104_182.SQL b/Decompiler/Gestor.Application.Migration.Files.20220104_182.SQL new file mode 100644 index 0000000..717461e --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20220104_182.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 229) +BEGIN + INSERT INTO [dbo].[fabricante] ([IDFABRICANTE],[DESCRICAO]) VALUES (229, N'PASTRE'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20220105_183.SQL b/Decompiler/Gestor.Application.Migration.Files.20220105_183.SQL new file mode 100644 index 0000000..84b5d4d --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20220105_183.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [idciaseg] = 886) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (886, N'UNIMED DE SANTOS COOPERATIVA DE TRABALHO MEDICO', 0, 2); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20220112_184.SQL b/Decompiler/Gestor.Application.Migration.Files.20220112_184.SQL new file mode 100644 index 0000000..d0cbf19 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20220112_184.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [idciaseg] = 887) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (887, N'COLUMBIA INVESTIMENTOS E PARTICIPAES LTDA', 0, 2); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20220119_185.SQL b/Decompiler/Gestor.Application.Migration.Files.20220119_185.SQL new file mode 100644 index 0000000..2931cc3 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20220119_185.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [idciaseg] = 888) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (888, N'RECON ADMINISTRADORA DE CONSORCIOS LTDA', 0, 2); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20220119_186.SQL b/Decompiler/Gestor.Application.Migration.Files.20220119_186.SQL new file mode 100644 index 0000000..0b567c0 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20220119_186.SQL @@ -0,0 +1,4 @@ +IF EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 128 AND descricao = 'CHERY') +BEGIN + UPDATE [dbo].[fabricante] SET [DESCRICAO] = N'CAOA CHERY' WHERE [idfabricante] = 128; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20220131_187.SQL b/Decompiler/Gestor.Application.Migration.Files.20220131_187.SQL new file mode 100644 index 0000000..4967c6d --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20220131_187.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 230) +BEGIN + INSERT INTO [dbo].[fabricante] ([IDFABRICANTE],[DESCRICAO]) VALUES (230, N'TESLA'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20220225_190.SQL b/Decompiler/Gestor.Application.Migration.Files.20220225_190.SQL new file mode 100644 index 0000000..85d05ea --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20220225_190.SQL @@ -0,0 +1,4 @@ +IF EXISTS (SELECT * FROM [dbo].[CamposRelatorios] WHERE [Header] like 'PARENTESCO') +BEGIN + DELETE FROM [dbo].[CamposRelatorios] WHERE [Header] like 'PARENTESCO'; +END diff --git a/Decompiler/Gestor.Application.Migration.Files.20220225_191.SQL b/Decompiler/Gestor.Application.Migration.Files.20220225_191.SQL new file mode 100644 index 0000000..0a03082 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20220225_191.SQL @@ -0,0 +1,9 @@ +IF NOT EXISTS (SELECT 1 FROM [dbo].[ciaseg] WHERE [idciaseg] = 891) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (891, N'PROPULSAO PLANOS ODONTOLOGICOS LTDA', 0, 2); +END + +IF NOT EXISTS (SELECT 1 FROM [dbo].[ciaseg] WHERE [idciaseg] = 890) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (890, N'SMILE SAUDE', 0, 2); +END diff --git a/Decompiler/Gestor.Application.Migration.Files.20220307_192.SQL b/Decompiler/Gestor.Application.Migration.Files.20220307_192.SQL new file mode 100644 index 0000000..5f9e187 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20220307_192.SQL @@ -0,0 +1,16 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[ramo] WHERE [IDRAMO] = 13) +BEGIN + INSERT INTO [dbo].[ramo] ([IDRAMO],[NOME],[IOF],[FATURA],[ATIVO]) VALUES (13, N'AERONÁUTICO',0.0738,0,1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ramo] WHERE [IDRAMO] = 20) +BEGIN + INSERT INTO [dbo].[ramo] ([IDRAMO],[NOME],[IOF],[FATURA],[ATIVO]) VALUES (20, N'GRANIZO',0.0738,0,1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ramo] WHERE [IDRAMO] = 26) +BEGIN + INSERT INTO [dbo].[ramo] ([IDRAMO],[NOME],[IOF],[FATURA],[ATIVO]) VALUES (26, N'NÁUTICO',0.0738,0,1); +END +IF NOT EXISTS(SELECT 1 FROM [dbo].[ramo] WHERE [IDRAMO] = 50) +BEGIN + INSERT INTO [dbo].[ramo] ([IDRAMO],[NOME],[IOF],[FATURA],[ATIVO]) VALUES (50, N'RCF-DC',0.0738,1,1); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20220315_193.SQL b/Decompiler/Gestor.Application.Migration.Files.20220315_193.SQL new file mode 100644 index 0000000..9b8a1cd --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20220315_193.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS (SELECT 1 FROM [dbo].[ciaseg] WHERE [idciaseg] = 243) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (243, N'GENERAL REINSURANCE AG', 0, 2); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20220321_194.SQL b/Decompiler/Gestor.Application.Migration.Files.20220321_194.SQL new file mode 100644 index 0000000..fce2aa4 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20220321_194.SQL @@ -0,0 +1,7 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Usuario') +BEGIN + IF COL_LENGTH('usuario','cgccpf') < 18 + BEGIN + ALTER TABLE [dbo].[Usuario] ALTER COLUMN CgcCpf NVARCHAR(18) NULL; + END +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20220325_195.SQL b/Decompiler/Gestor.Application.Migration.Files.20220325_195.SQL new file mode 100644 index 0000000..80ae92b --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20220325_195.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS (SELECT 1 FROM [dbo].[ciaseg] WHERE [idciaseg] = 893) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (893, N'ELO ADMINISTRADORA DE BENEFICIOS LTDA', 0, 2); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20220329_196.SQL b/Decompiler/Gestor.Application.Migration.Files.20220329_196.SQL new file mode 100644 index 0000000..ddd6f15 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20220329_196.SQL @@ -0,0 +1,24 @@ +IF NOT EXISTS (SELECT 1 FROM [dbo].[ciaseg] WHERE [idciaseg] = 894) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[CGCCPF],[ATIVO],[TOLERANCIA]) VALUES (894, N'OPERADORA UNICENTRAL DE PLANOS DE SAUDE LTDA', '02.888.465/0001-56', 0, 2); +END +--IF NOT EXISTS (SELECT 1 FROM [dbo].[ciaseg] WHERE [idciaseg] = 895) +--BEGIN +-- INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[CGCCPF],[ATIVO],[TOLERANCIA]) VALUES (895, N'BEPLUS SAUDE CORRETORA DE SEGUROS LTDA', '12.402.717/0001-49', 0, 2); +--END +--IF NOT EXISTS (SELECT 1 FROM [dbo].[ciaseg] WHERE [idciaseg] = 896) +--BEGIN +-- INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[CGCCPF],[ATIVO],[TOLERANCIA]) VALUES (896, N'HEBROM CORRETORA DE SEGUROS LTDA', '08.179.439/0001-35', 0, 2); +--END +--IF NOT EXISTS (SELECT 1 FROM [dbo].[ciaseg] WHERE [idciaseg] = 898) +--BEGIN +-- INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[CGCCPF],[ATIVO],[TOLERANCIA]) VALUES (898, N'RAMED 4YOU CORRETORA DE SEGUROS LTDA', '36.454.780/0001-97', 0, 2); +--END +--IF NOT EXISTS (SELECT 1 FROM [dbo].[ciaseg] WHERE [idciaseg] = 899) +--BEGIN +-- INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[CGCCPF],[ATIVO],[TOLERANCIA]) VALUES (899, N'DINASTY CORRETORA DE SEGUROS UNIPESSOAL LTDA', '40.514.996/0001-78', 0, 2); +--END +--IF NOT EXISTS (SELECT 1 FROM [dbo].[ciaseg] WHERE [idciaseg] = 900) +--BEGIN +-- INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[CGCCPF],[ATIVO],[TOLERANCIA]) VALUES (900, N'RAMED MIX CORRETORA DE SEGUROS LTDA', '12.346.564.0001-60', 0, 2); +--END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20220330_197.SQL b/Decompiler/Gestor.Application.Migration.Files.20220330_197.SQL new file mode 100644 index 0000000..a7e4ebc --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20220330_197.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS (SELECT 1 FROM [dbo].[ciaseg] WHERE [idciaseg] = 901) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[CGCCPF],[ATIVO],[TOLERANCIA]) VALUES (901, N'OABPREV-GO', '01.715.394/0001-27', 0, 2); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20220404_198.SQL b/Decompiler/Gestor.Application.Migration.Files.20220404_198.SQL new file mode 100644 index 0000000..4daf2d4 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20220404_198.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS (SELECT 1 FROM [dbo].[ciaseg] WHERE [idciaseg] = 902) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[CGCCPF],[ATIVO],[TOLERANCIA]) VALUES (902, N'UNIMED NORDESTE RS SOCIEDADE COOP DE SERV MEDICOS LTDA', '87.827.689/0001-00', 0, 2); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20220404_199.SQL b/Decompiler/Gestor.Application.Migration.Files.20220404_199.SQL new file mode 100644 index 0000000..7785010 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20220404_199.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS (SELECT 1 FROM [dbo].[ciaseg] WHERE [idciaseg] = 903) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[CGCCPF],[ATIVO],[TOLERANCIA]) VALUES (903, N'SERVIX ADMINISTRADORA DE BENEFICIOS SOCIEDADE', '10.495.931/0001-61', 0, 2); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20220408_200.SQL b/Decompiler/Gestor.Application.Migration.Files.20220408_200.SQL new file mode 100644 index 0000000..02b5975 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20220408_200.SQL @@ -0,0 +1,5 @@ +IF EXISTS (SELECT 1 FROM [dbo].[ciaseg] WHERE [idciaseg] = 699) +BEGIN + UPDATE controle SET idciaseg = 699 WHERE IDCIASEG = 791; + UPDATE ciaseg SET NOME = 'SEGURADORA DESATIVADA' WHERE IDCIASEG IN (791); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20220413_201.SQL b/Decompiler/Gestor.Application.Migration.Files.20220413_201.SQL new file mode 100644 index 0000000..8f7166a --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20220413_201.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS (SELECT 1 FROM [dbo].[ciaseg] WHERE [idciaseg] = 904) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[CGCCPF],[ATIVO],[TOLERANCIA]) VALUES (904, N'SEGURADORA DESATIVADA', '05.538.968/0001-90', 0, 2); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20220419_202.SQL b/Decompiler/Gestor.Application.Migration.Files.20220419_202.SQL new file mode 100644 index 0000000..34f2407 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20220419_202.SQL @@ -0,0 +1,6 @@ +DECLARE @sql NVARCHAR(MAX) = N'UPDATE fornecedor SET ativo = 1 WHERE ativo IS NULL;' + +IF COL_LENGTH('[dbo].[fornecedor]', 'ativo') IS NOT NULL +BEGIN + exec sp_executesql @sql +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20220419_203.SQL b/Decompiler/Gestor.Application.Migration.Files.20220419_203.SQL new file mode 100644 index 0000000..d778462 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20220419_203.SQL @@ -0,0 +1,6 @@ +UPDATE [dbo].[ciaseg] SET NOME = 'SEGURADORA DESATIVADA' WHERE IDCIASEG = 820; +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [idciaseg] = 665) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (665, N'PREVENT SENIOR PRIVATE OPERADORA DE SAUDE', 0, 2); +END +UPDATE CONTROLE SET IDCIASEG = 665 WHERE IDCIASEG = 820; \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20220429_204.SQL b/Decompiler/Gestor.Application.Migration.Files.20220429_204.SQL new file mode 100644 index 0000000..78dacc2 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20220429_204.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [idciaseg] = 905) +BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA]) VALUES (905, N'IDEAL SAUDE', 0, 2); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20220502_205-.SQL b/Decompiler/Gestor.Application.Migration.Files.20220502_205-.SQL new file mode 100644 index 0000000..7324289 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20220502_205-.SQL @@ -0,0 +1,5 @@ +IF EXISTS(SELECT 1 FROM [dbo].[ramo] WHERE [idramo] = 52) +BEGIN + UPDATE controle SET IDRAMO = 4 WHERE IDRAMO = 52; + DELETE FROM ramo WHERE IDRAMO = 52; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20220502_206-.SQL b/Decompiler/Gestor.Application.Migration.Files.20220502_206-.SQL new file mode 100644 index 0000000..83dfb41 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20220502_206-.SQL @@ -0,0 +1,4 @@ +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CamposRelatorios') AND EXISTS(SELECT 1 FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 17 AND [IdUsuario] = 0) +BEGIN + DELETE FROM [dbo].[CamposRelatorios] WHERE [Relatorio] = 17 AND [IdUsuario] = 0; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20220603_207.SQL b/Decompiler/Gestor.Application.Migration.Files.20220603_207.SQL new file mode 100644 index 0000000..81c8fa3 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20220603_207.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 222) +BEGIN + INSERT INTO [dbo].[fabricante] ([IDFABRICANTE],[DESCRICAO]) VALUES (222, N'VOLTZ'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20220608_208.SQL b/Decompiler/Gestor.Application.Migration.Files.20220608_208.SQL new file mode 100644 index 0000000..baaeba0 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20220608_208.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 231) +BEGIN + INSERT INTO [dbo].[fabricante] ([IDFABRICANTE],[DESCRICAO]) VALUES (231, N'APOLO'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20220726_209.SQL b/Decompiler/Gestor.Application.Migration.Files.20220726_209.SQL new file mode 100644 index 0000000..ad414a3 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20220726_209.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 119) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (119, 77, N'BANCO INTER SA'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20220804_210.SQL b/Decompiler/Gestor.Application.Migration.Files.20220804_210.SQL new file mode 100644 index 0000000..19d05d3 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20220804_210.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 232) +BEGIN + INSERT INTO [dbo].[fabricante] ([IDFABRICANTE],[DESCRICAO]) VALUES (232, N'BULL'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20220817_211.SQL b/Decompiler/Gestor.Application.Migration.Files.20220817_211.SQL new file mode 100644 index 0000000..bac799e --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20220817_211.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 233) +BEGIN + INSERT INTO [dbo].[fabricante] ([IDFABRICANTE],[DESCRICAO]) VALUES (233, N'BYD'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20220926_212-.SQL b/Decompiler/Gestor.Application.Migration.Files.20220926_212-.SQL new file mode 100644 index 0000000..c27ce2d --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20220926_212-.SQL @@ -0,0 +1,4 @@ +IF EXISTS (SELECT * FROM [dbo].[CamposRelatorios] WHERE [Header] LIKE 'VENDEDOR PRINCIPAL') +BEGIN + DELETE FROM [dbo].[CamposRelatorios] WHERE [Header] LIKE 'VENDEDOR PRINCIPAL'; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20220929_213-.SQL b/Decompiler/Gestor.Application.Migration.Files.20220929_213-.SQL new file mode 100644 index 0000000..adf3aa6 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20220929_213-.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 234) +BEGIN + INSERT INTO [dbo].[fabricante] ([IDFABRICANTE],[DESCRICAO]) VALUES (234, N'CITYCOCO'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20221007_214-.SQL b/Decompiler/Gestor.Application.Migration.Files.20221007_214-.SQL new file mode 100644 index 0000000..f37e120 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20221007_214-.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 131) +BEGIN + INSERT INTO [dbo].[CODIGOBANCO] ([IDCODIGOBANCO],[CODIGO],[NOMEBANCO]) VALUES (131, 218, N'Banco BS2 S.A.'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20221018_215-.SQL b/Decompiler/Gestor.Application.Migration.Files.20221018_215-.SQL new file mode 100644 index 0000000..72967ce --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20221018_215-.SQL @@ -0,0 +1,4 @@ +IF EXISTS (SELECT * FROM [dbo].[CamposRelatorios] WHERE [Header] LIKE 'REPASSE VENDEDOR') +BEGIN + DELETE FROM [dbo].[CamposRelatorios] WHERE [Header] LIKE 'REPASSE VENDEDOR'; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20221028_216.SQL b/Decompiler/Gestor.Application.Migration.Files.20221028_216.SQL new file mode 100644 index 0000000..42ac739 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20221028_216.SQL @@ -0,0 +1,4 @@ +IF EXISTS (SELECT 1 FROM [dbo].[ciaseg] WHERE [idciaseg] = 42) +BEGIN + UPDATE ciaseg SET NOME = 'AKAD SEGUROS S.A.', NOMESOCIAL = 'AKAD SEGUROS S.A.' WHERE IDCIASEG IN (42); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20221110_217.SQL b/Decompiler/Gestor.Application.Migration.Files.20221110_217.SQL new file mode 100644 index 0000000..6556bc2 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20221110_217.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 118) +BEGIN + INSERT INTO codigobanco (IDCODIGOBANCO,CODIGO,NOMEBANCO) VALUES (118, 212, N'BANCO ORIGINAL'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20221110_218.SQL b/Decompiler/Gestor.Application.Migration.Files.20221110_218.SQL new file mode 100644 index 0000000..7f4fd1f --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20221110_218.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 235) +BEGIN + INSERT INTO [dbo].[fabricante] ([IDFABRICANTE],[DESCRICAO]) VALUES (235, N'VINCENZI'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20230208_219.SQL b/Decompiler/Gestor.Application.Migration.Files.20230208_219.SQL new file mode 100644 index 0000000..0fc72f8 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20230208_219.SQL @@ -0,0 +1,4 @@ +IF ((SELECT DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = 'clitelefone' AND COLUMN_NAME = 'TIPO') = 'numeric') +BEGIN +ALTER TABLE [dbo].[clitelefone] ALTER COLUMN TIPO INT; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20230301_220.SQL b/Decompiler/Gestor.Application.Migration.Files.20230301_220.SQL new file mode 100644 index 0000000..b2c72d5 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20230301_220.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 236) +BEGIN + INSERT INTO [dbo].[fabricante] ([IDFABRICANTE],[DESCRICAO]) VALUES (236, N'FORTCAR'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20230308_221.SQL b/Decompiler/Gestor.Application.Migration.Files.20230308_221.SQL new file mode 100644 index 0000000..a33757b --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20230308_221.SQL @@ -0,0 +1,4 @@ +IF ((SELECT character_maximum_length FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = 'parceiro' AND COLUMN_NAME = 'EMAIL') < 100) +BEGIN +ALTER TABLE parceiro ALTER COLUMN EMAIL VARCHAR(100) NULL; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20230502_222.SQL b/Decompiler/Gestor.Application.Migration.Files.20230502_222.SQL new file mode 100644 index 0000000..925c569 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20230502_222.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 237) +BEGIN + INSERT INTO [dbo].[fabricante] ([IDFABRICANTE],[DESCRICAO]) VALUES (237, N'GWM'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20230619_223.SQL b/Decompiler/Gestor.Application.Migration.Files.20230619_223.SQL new file mode 100644 index 0000000..1238ef1 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20230619_223.SQL @@ -0,0 +1,8 @@ +IF ((SELECT character_maximum_length FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = 'perfil' AND COLUMN_NAME = 'ceppernoite') <= 9 ) +BEGIN +ALTER TABLE perfil ALTER COLUMN ceppernoite VARCHAR(10) NULL; +END +IF ((SELECT character_maximum_length FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = 'perfil' AND COLUMN_NAME = 'cepcirculacao') <= 9 ) +BEGIN +ALTER TABLE perfil ALTER COLUMN cepcirculacao VARCHAR(10) NULL; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20230619_224.SQL b/Decompiler/Gestor.Application.Migration.Files.20230619_224.SQL new file mode 100644 index 0000000..7820279 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20230619_224.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 238) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (238, N'ZONTES'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20230705_225.SQL b/Decompiler/Gestor.Application.Migration.Files.20230705_225.SQL new file mode 100644 index 0000000..a54a934 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20230705_225.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 239) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (239, N'SCHIFFER'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20230718_226.SQL b/Decompiler/Gestor.Application.Migration.Files.20230718_226.SQL new file mode 100644 index 0000000..3b30e8b --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20230718_226.SQL @@ -0,0 +1,9 @@ +IF (object_id( 'Permissao' ) IS NOT NULL) +BEGIN + IF NOT EXISTS(SELECT 1 FROM [dbo].[Permissao] WHERE [idpermissao] = 0) + BEGIN + SET IDENTITY_INSERT Permissao ON + INSERT INTO Permissao (idpermissao,Nome,Tipo) VALUES (0,'Sem Acesso',0) + SET IDENTITY_INSERT Permissao OFF + END +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20230727_227.SQL b/Decompiler/Gestor.Application.Migration.Files.20230727_227.SQL new file mode 100644 index 0000000..9f73f4b --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20230727_227.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 130) +BEGIN + INSERT INTO codigobanco (IDCODIGOBANCO,CODIGO,NOMEBANCO) VALUES (130, 136, N'UNICRED'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20230807_228-.SQL b/Decompiler/Gestor.Application.Migration.Files.20230807_228-.SQL new file mode 100644 index 0000000..ef0d25c --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20230807_228-.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 127) +BEGIN + INSERT INTO codigobanco (IDCODIGOBANCO,CODIGO,NOMEBANCO) VALUES (127, 208, N'BANCO BTG PACTUAL S.A'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20230829_229-.SQL b/Decompiler/Gestor.Application.Migration.Files.20230829_229-.SQL new file mode 100644 index 0000000..6f604f8 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20230829_229-.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[CODIGOBANCO] WHERE [IDCODIGOBANCO] = 132) +BEGIN + INSERT INTO codigobanco (IDCODIGOBANCO,CODIGO,NOMEBANCO) VALUES (132, 396, N'HUB PAGAMENTOS S.A'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20231011_230.SQL b/Decompiler/Gestor.Application.Migration.Files.20231011_230.SQL new file mode 100644 index 0000000..6a662fc --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20231011_230.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 240) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (240, N'CAOA CHERY/CHERY'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20231024_231.SQL b/Decompiler/Gestor.Application.Migration.Files.20231024_231.SQL new file mode 100644 index 0000000..c38942a --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20231024_231.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 241) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (241, N'TRAILER'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20231031_232.SQL b/Decompiler/Gestor.Application.Migration.Files.20231031_232.SQL new file mode 100644 index 0000000..61c4c61 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20231031_232.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 242) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (242, N'JCB'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20240131_233.SQL b/Decompiler/Gestor.Application.Migration.Files.20240131_233.SQL new file mode 100644 index 0000000..9df1c24 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20240131_233.SQL @@ -0,0 +1,11 @@ +IF (object_id( 'fonetipo' ) IS NOT NULL) + BEGIN + declare @sql nvarchar(max) = (select + 'alter table ' + quotename(schema_name(schema_id)) + '.' + + quotename(object_name(parent_object_id)) + + ' drop constraint '+quotename(name) + ';' + from sys.foreign_keys s + where object_name(referenced_object_id) = 'fonetipo' for xml path('') + ) + EXEC sp_executesql @sql; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20240131_234.SQL b/Decompiler/Gestor.Application.Migration.Files.20240131_234.SQL new file mode 100644 index 0000000..9eed697 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20240131_234.SQL @@ -0,0 +1,11 @@ +IF (object_id( 'tipopagto' ) IS NOT NULL) + BEGIN + declare @sql nvarchar(max) = (select + 'alter table ' + quotename(schema_name(schema_id)) + '.' + + quotename(object_name(parent_object_id)) + + ' drop constraint '+quotename(name) + ';' + from sys.foreign_keys s + where object_name(referenced_object_id) = 'tipopagto' for xml path('') + ) + EXEC sp_executesql @sql; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20240322_235.SQL b/Decompiler/Gestor.Application.Migration.Files.20240322_235.SQL new file mode 100644 index 0000000..a2fcd41 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20240322_235.SQL @@ -0,0 +1,6 @@ +IF (EXISTS ( SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME = 'ToleranciaPremio' AND TABLE_NAME = 'ciaseg') +AND EXISTS ( SELECT DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME = 'ToleranciaPremio' AND DATA_TYPE = 'nvarchar' AND TABLE_NAME = 'ciaseg')) +BEGIN + UPDATE ciaseg SET ToleranciaPremio = NULL; + ALTER TABLE ciaseg ALTER COLUMN ToleranciaPremio numeric(8,2) NULL; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20240322_236.SQL b/Decompiler/Gestor.Application.Migration.Files.20240322_236.SQL new file mode 100644 index 0000000..18078dd --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20240322_236.SQL @@ -0,0 +1,4 @@ +IF (EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME = 'ToleranciaPremio' AND TABLE_NAME = 'ciaseg')) +BEGIN + UPDATE ciaseg SET ToleranciaPremio = tolerancia WHERE ToleranciaPremio IS NULL; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20240325_237.SQL b/Decompiler/Gestor.Application.Migration.Files.20240325_237.SQL new file mode 100644 index 0000000..25e64c7 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20240325_237.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 243) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (243, N'NEXT ELETRIC'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20240415_238.SQL b/Decompiler/Gestor.Application.Migration.Files.20240415_238.SQL new file mode 100644 index 0000000..c4d7172 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20240415_238.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 244) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (244, N'VENTANE MOTORS'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20240422_239.SQL b/Decompiler/Gestor.Application.Migration.Files.20240422_239.SQL new file mode 100644 index 0000000..40addbe --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20240422_239.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 245) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (245, N'ROSSETTI'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20240521_240.SQL b/Decompiler/Gestor.Application.Migration.Files.20240521_240.SQL new file mode 100644 index 0000000..bbcb307 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20240521_240.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 246) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (246, N'LIESS'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20240522_241.SQL b/Decompiler/Gestor.Application.Migration.Files.20240522_241.SQL new file mode 100644 index 0000000..cc9dabc --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20240522_241.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 247) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (247, N'MCLAREN'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20240604_242.SQL b/Decompiler/Gestor.Application.Migration.Files.20240604_242.SQL new file mode 100644 index 0000000..f8c217e --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20240604_242.SQL @@ -0,0 +1,9 @@ +IF EXISTS (SELECT 1 FROM Ciaseg WHERE IdCiaSeg = 851) +BEGIN + IF NOT EXISTS(SELECT 1 FROM ciaseg WHERE idciaseg = 285) + BEGIN + INSERT INTO [dbo].[ciaseg] ([IDCIASEG],[NOME],[ATIVO],[TOLERANCIA],[ToleranciaPremio]) VALUES (285, N'KOVR SEGURADORA', 1, 2,2); + END + UPDATE controle SET idciaseg = 285 WHERE idciaseg = 851; + UPDATE ciaseg set nome = 'SEGURADORA DESATIVADA' WHERE idciaseg = 851; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20240708_243.SQL b/Decompiler/Gestor.Application.Migration.Files.20240708_243.SQL new file mode 100644 index 0000000..f0f6814 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20240708_243.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 248) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (248, N'DUACT'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20240722_244.SQL b/Decompiler/Gestor.Application.Migration.Files.20240722_244.SQL new file mode 100644 index 0000000..efa9260 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20240722_244.SQL @@ -0,0 +1,7 @@ +IF EXISTS (SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'lancamen' AND COLUMN_NAME = 'documento') +BEGIN + IF ((SELECT CHARACTER_MAXIMUM_LENGTH FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'lancamen' AND COLUMN_NAME = 'documento') < 255) + BEGIN + ALTER TABLE lancamen ALTER COLUMN documento VARCHAR(255) + END +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20240723_245.SQL b/Decompiler/Gestor.Application.Migration.Files.20240723_245.SQL new file mode 100644 index 0000000..f6e310b --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20240723_245.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM fabricante WHERE idfabricante = 249) +BEGIN + INSERT INTO fabricante (idfabricante, descricao) VALUES (249, N'AVELLOZ'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20240724_246.SQL b/Decompiler/Gestor.Application.Migration.Files.20240724_246.SQL new file mode 100644 index 0000000..81cbed3 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20240724_246.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM CODIGOBANCO WHERE IDCODIGOBANCO = 133) +BEGIN + INSERT INTO codigobanco (IDCODIGOBANCO,CODIGO,NOMEBANCO) VALUES (133, 301, N'CONTABILIZEI'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20240729_247.SQL b/Decompiler/Gestor.Application.Migration.Files.20240729_247.SQL new file mode 100644 index 0000000..676b81a --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20240729_247.SQL @@ -0,0 +1,4 @@ +IF EXISTS(SELECT 1 FROM ciaseg WHERE IDCIASEG = 310) +BEGIN + UPDATE ciaseg SET NOME = 'YELUM SEGUROS' WHERE IDCIASEG = 310; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20240816_248.SQL b/Decompiler/Gestor.Application.Migration.Files.20240816_248.SQL new file mode 100644 index 0000000..d9829db --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20240816_248.SQL @@ -0,0 +1 @@ +--UPDATE usuario SET identif = CONCAT(identif, '_REMOVIDO') WHERE Removido = 1 and identif NOT LIKE '%_REMOVIDO'; \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20240821_249.SQL b/Decompiler/Gestor.Application.Migration.Files.20240821_249.SQL new file mode 100644 index 0000000..1770521 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20240821_249.SQL @@ -0,0 +1,7 @@ +IF EXISTS (SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'usuario' AND COLUMN_NAME = 'identif') +BEGIN + IF ((SELECT CHARACTER_MAXIMUM_LENGTH FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'usuario' AND COLUMN_NAME = 'identif') < 255) + BEGIN + ALTER TABLE usuario ALTER COLUMN identif VARCHAR(255) + END +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20240821_250.SQL b/Decompiler/Gestor.Application.Migration.Files.20240821_250.SQL new file mode 100644 index 0000000..ecd8381 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20240821_250.SQL @@ -0,0 +1,4 @@ +IF EXISTS (SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'usuario' AND COLUMN_NAME = 'identif') +BEGIN + UPDATE usuario SET identif = CONCAT(identif, '_REM') WHERE Removido = 1 and (identif NOT LIKE '%_REM' AND identif NOT LIKE '%_REMOVIDO'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20240826_251.SQL b/Decompiler/Gestor.Application.Migration.Files.20240826_251.SQL new file mode 100644 index 0000000..bbad7a6 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20240826_251.SQL @@ -0,0 +1,8 @@ +IF NOT EXISTS(SELECT 1 FROM fabricante WHERE idfabricante = 250) +BEGIN + INSERT INTO fabricante (idfabricante, descricao) VALUES (250, N'JLRP'); +END +IF NOT EXISTS(SELECT 1 FROM fabricante WHERE idfabricante = 251) +BEGIN + INSERT INTO fabricante (idfabricante, descricao) VALUES (251, N'TRUCKVAN'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20240902_252.SQL b/Decompiler/Gestor.Application.Migration.Files.20240902_252.SQL new file mode 100644 index 0000000..67688be --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20240902_252.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM fabricante WHERE idfabricante = 253) +BEGIN + INSERT INTO fabricante (idfabricante, descricao) VALUES (253, N'LIUGONG'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20240919_253.SQL b/Decompiler/Gestor.Application.Migration.Files.20240919_253.SQL new file mode 100644 index 0000000..a627e4c --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20240919_253.SQL @@ -0,0 +1,7 @@ +IF EXISTS (SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'usuario' AND COLUMN_NAME = 'cgccpf') +BEGIN + IF ((SELECT CHARACTER_MAXIMUM_LENGTH FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'usuario' AND COLUMN_NAME = 'cgccpf') < 20) + BEGIN + ALTER TABLE usuario ALTER COLUMN cgccpf VARCHAR(20) + END +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20241015_254.SQL b/Decompiler/Gestor.Application.Migration.Files.20241015_254.SQL new file mode 100644 index 0000000..247f1f8 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20241015_254.SQL @@ -0,0 +1,4 @@ +IF EXISTS (SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'usuario' AND COLUMN_NAME ='inativo') +BEGIN + UPDATE usuario SET identif = identif + '_REM', Removido = 1 WHERE inativo = 1 AND Removido != 1; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20250204_255.SQL b/Decompiler/Gestor.Application.Migration.Files.20250204_255.SQL new file mode 100644 index 0000000..fa5d701 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20250204_255.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM fabricante WHERE idfabricante = 254) +BEGIN + INSERT INTO fabricante (idfabricante, descricao) VALUES (254, N'MOTTU'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20250210_256.SQL b/Decompiler/Gestor.Application.Migration.Files.20250210_256.SQL new file mode 100644 index 0000000..3f57d55 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20250210_256.SQL @@ -0,0 +1,4 @@ +IF EXISTS (SELECT Id FROM CamposRelatorios WHERE relatorio = 27 and campo = 'VENCIMENTO') +BEGIN + DELETE FROM CamposRelatorios WHERE id in (SELECT Id FROM CamposRelatorios WHERE relatorio = 27 and campo = 'VENCIMENTO'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20250307_257-.SQL b/Decompiler/Gestor.Application.Migration.Files.20250307_257-.SQL new file mode 100644 index 0000000..712b1b9 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20250307_257-.SQL @@ -0,0 +1,4 @@ +IF EXISTS (SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 201) +BEGIN + UPDATE fabricante SET descricao = 'EFFA' WHERE idfabricante = 201; +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20250314_258-.SQL b/Decompiler/Gestor.Application.Migration.Files.20250314_258-.SQL new file mode 100644 index 0000000..66df67c --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20250314_258-.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 255) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (255, N'WATTS'); +END diff --git a/Decompiler/Gestor.Application.Migration.Files.20250314_259-.SQL b/Decompiler/Gestor.Application.Migration.Files.20250314_259-.SQL new file mode 100644 index 0000000..155c4e1 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20250314_259-.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 256) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (256, N'GALEGO'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20250328_260.SQL b/Decompiler/Gestor.Application.Migration.Files.20250328_260.SQL new file mode 100644 index 0000000..fbe201f --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20250328_260.SQL @@ -0,0 +1,4 @@ +IF EXISTS(SELECT 1 FROM [dbo].[ciaseg] WHERE [idciaseg] = 27) +BEGIN + UPDATE [dbo].[ciaseg] SET NOME = 'ALLSEG' WHERE IDCIASEG IN(27); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20250331_261.SQL b/Decompiler/Gestor.Application.Migration.Files.20250331_261.SQL new file mode 100644 index 0000000..4fd824f --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20250331_261.SQL @@ -0,0 +1,6 @@ +IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'parceiro' + AND COLUMN_NAME = 'complemento' + AND CHARACTER_MAXIMUM_LENGTH < 255) +BEGIN + ALTER TABLE parceiro ALTER COLUMN complemento VARCHAR(255); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20250401_262-.SQL b/Decompiler/Gestor.Application.Migration.Files.20250401_262-.SQL new file mode 100644 index 0000000..d8f9b23 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20250401_262-.SQL @@ -0,0 +1,11 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 257) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (257, N'MOB'); +END + + +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 258) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (258, N'MOTOCHEFE'); + +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20250423_263.SQL b/Decompiler/Gestor.Application.Migration.Files.20250423_263.SQL new file mode 100644 index 0000000..f77d11e --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20250423_263.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 259) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (259, N'TURISCAR'); +END diff --git a/Decompiler/Gestor.Application.Migration.Files.20250424_264.SQL b/Decompiler/Gestor.Application.Migration.Files.20250424_264.SQL new file mode 100644 index 0000000..f4227a6 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20250424_264.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM CODIGOBANCO WHERE IDCODIGOBANCO = 134) +BEGIN + INSERT INTO codigobanco (IDCODIGOBANCO,CODIGO,NOMEBANCO) VALUES (134, 197, N'STONE PAGAMENTOS S.A.'); +END diff --git a/Decompiler/Gestor.Application.Migration.Files.20250425_265.SQL b/Decompiler/Gestor.Application.Migration.Files.20250425_265.SQL new file mode 100644 index 0000000..7633b72 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20250425_265.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM CODIGOBANCO WHERE IDCODIGOBANCO = 135) +BEGIN + INSERT INTO codigobanco (IDCODIGOBANCO,CODIGO,NOMEBANCO) VALUES (135, 133, N'CRESOL CONFEDERAÇÃO'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20250523_266.SQL b/Decompiler/Gestor.Application.Migration.Files.20250523_266.SQL new file mode 100644 index 0000000..f9ab813 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20250523_266.SQL @@ -0,0 +1,6 @@ +CREATE TABLE ImportacaoJsonPdf ( +[Id] INT IDENTITY(1,1) PRIMARY KEY, +[JsonPdf] VARCHAR(MAX), +[AzureGuid] [uniqueidentifier] NULL, +[AzureStorage] [varchar](100) NULL +); \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20250625_267.SQL b/Decompiler/Gestor.Application.Migration.Files.20250625_267.SQL new file mode 100644 index 0000000..1adc7dd --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20250625_267.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 260) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (260, N'OMODA'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20250625_268.SQL b/Decompiler/Gestor.Application.Migration.Files.20250625_268.SQL new file mode 100644 index 0000000..9ea15d6 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20250625_268.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 261) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (261, N'JAECOO'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20250728_269.SQL b/Decompiler/Gestor.Application.Migration.Files.20250728_269.SQL new file mode 100644 index 0000000..9729a63 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20250728_269.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 262) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (262, N'GAC'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20250815_270.SQL b/Decompiler/Gestor.Application.Migration.Files.20250815_270.SQL new file mode 100644 index 0000000..9f398a4 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20250815_270.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 263) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (263, N'NANJING XCMG'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20250905_271.SQL b/Decompiler/Gestor.Application.Migration.Files.20250905_271.SQL new file mode 100644 index 0000000..c05aa5c --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20250905_271.SQL @@ -0,0 +1,9 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 264) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (264, N'VESPA'); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 265) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (265, N'LEVA MOTORS'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20250908_272.SQL b/Decompiler/Gestor.Application.Migration.Files.20250908_272.SQL new file mode 100644 index 0000000..68e2f0e --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20250908_272.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 266) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (266, N'DUOS'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20250909_273.SQL b/Decompiler/Gestor.Application.Migration.Files.20250909_273.SQL new file mode 100644 index 0000000..8c94f69 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20250909_273.SQL @@ -0,0 +1,14 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 267) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (267, N'LIBRELATO S.A. IMPLEMENTOS RODOVIARIOS'); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 268) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (268, N'ZEEKR PARTICIPACOES LTDA'); +END + +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 269) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (269, N'CONDUZZA AUTOPROPELIDOS CURITIBA LTDA'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20250919_274.SQL b/Decompiler/Gestor.Application.Migration.Files.20250919_274.SQL new file mode 100644 index 0000000..786640c --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20250919_274.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 270) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (270, N'CARVALHO CARRETAS RODOVIÁRIAS'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20250926_275.SQL b/Decompiler/Gestor.Application.Migration.Files.20250926_275.SQL new file mode 100644 index 0000000..018c54f --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20250926_275.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 271) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (271, N'RDK'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20251002_276.SQL b/Decompiler/Gestor.Application.Migration.Files.20251002_276.SQL new file mode 100644 index 0000000..4370186 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20251002_276.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 272) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (272, N'SUDU'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20251010_277.SQL b/Decompiler/Gestor.Application.Migration.Files.20251010_277.SQL new file mode 100644 index 0000000..67d9a12 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20251010_277.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM CODIGOBANCO WHERE IDCODIGOBANCO = 136) +BEGIN + INSERT INTO codigobanco (IDCODIGOBANCO,CODIGO,NOMEBANCO) VALUES (136, 323, N'MERCADO PAGO'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20251014_278.SQL b/Decompiler/Gestor.Application.Migration.Files.20251014_278.SQL new file mode 100644 index 0000000..7b6f6b4 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20251014_278.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[fabricante] WHERE [idfabricante] = 273) +BEGIN + INSERT INTO [dbo].[fabricante] ([idfabricante],[descricao]) VALUES (273, N'FERCAR'); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration.Files.20251030_279.SQL b/Decompiler/Gestor.Application.Migration.Files.20251030_279.SQL new file mode 100644 index 0000000..cda3cb6 --- /dev/null +++ b/Decompiler/Gestor.Application.Migration.Files.20251030_279.SQL @@ -0,0 +1,4 @@ +IF NOT EXISTS(SELECT 1 FROM [dbo].[ramo] WHERE [IDRAMO] = 71) +BEGIN + INSERT INTO [dbo].[ramo] ([IDRAMO],[NOME],[IOF],[FATURA],[ATIVO]) VALUES (71, N'PECUÁRIO SEM FESR',0.00,1,1); +END \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Migration/Migrator.cs b/Decompiler/Gestor.Application.Migration/Migrator.cs new file mode 100644 index 0000000..1d7984f --- /dev/null +++ b/Decompiler/Gestor.Application.Migration/Migrator.cs @@ -0,0 +1,170 @@ +using System; +using System.Collections.Generic; +using System.Data.Common; +using System.Data.SqlClient; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.Helper; + +namespace Gestor.Application.Migration; + +public class Migrator +{ + private readonly Assembly _executingAssembly; + + private static string _connection { get; set; } + + public Migrator() + { + _executingAssembly = Assembly.GetExecutingAssembly(); + } + + public async Task Execute() + { + _ = 1; + try + { + return await ExecuteFiles(await GetAllFiles()); + } + catch (Exception) + { + } + return false; + } + + private async Task GetAllFiles() + { + string folderName = _executingAssembly.GetName().Name + ".Migration.Files"; + long lastUpdate = await LastUpdate(); + return _executingAssembly.GetManifestResourceNames().Where(delegate(string r) + { + long num = 0L; + if (r.StartsWith(folderName) && r.EndsWith(".SQL")) + { + num = ValidationHelper.ToInt(ValidationHelper.Clear(ValidationHelper.Index(r.Split(new char[1] { '_' }), 1))); + } + return num > lastUpdate; + }).ToArray(); + } + + private async Task ExecuteFiles(IEnumerable filesToExecute) + { + foreach (string fileName in filesToExecute.OrderBy((string x) => x)) + { + using Stream resourceStream = _executingAssembly.GetManifestResourceStream(fileName); + if (resourceStream == null) + { + continue; + } + Encoding encoding = Encoding.GetEncoding("ISO-8859-1"); + Encoding uTF = Encoding.UTF8; + using StreamReader streamReader = new StreamReader(resourceStream); + string s = streamReader.ReadToEnd(); + byte[] bytes = uTF.GetBytes(s); + byte[] bytes2 = Encoding.Convert(uTF, encoding, bytes); + s = encoding.GetString(bytes2); + if (!(await ExecuteScript(s))) + { + return false; + } + if (!(await SaveUpdate(ValidationHelper.ToInt(ValidationHelper.Clear(ValidationHelper.Index(fileName.Split(new char[1] { '_' }), 1)))))) + { + return false; + } + } + return true; + } + + private static async Task ExecuteScript(string scriptText) + { + return await Task.Run(delegate + { + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_0034: Expected O, but got Unknown + IEnumerable enumerable = Regex.Split(scriptText, "^\\s*GO\\s*$", RegexOptions.IgnoreCase | RegexOptions.Multiline); + try + { + if (string.IsNullOrEmpty(_connection)) + { + _connection = Connection.GetConnection(); + } + SqlConnection val = new SqlConnection(_connection); + try + { + ((DbConnection)(object)val).Open(); + SqlCommand val2 = val.CreateCommand(); + try + { + foreach (string item in enumerable) + { + if (!(item.Trim() == "")) + { + ((DbCommand)(object)val2).CommandText = item; + ((DbCommand)(object)val2).ExecuteNonQuery(); + } + } + } + finally + { + ((IDisposable)val2)?.Dispose(); + } + } + finally + { + ((IDisposable)val)?.Dispose(); + } + return true; + } + catch (Exception) + { + return false; + } + }); + } + + private static async Task SaveUpdate(long fileId) + { + return await Task.Run(delegate + { + UnitOfWork commited = Instancia.Commited; + try + { + commited.AtualizacaoRepository.Save(fileId); + ((GenericUnitOfWork)commited).Commit(); + } + catch (Exception) + { + ((GenericUnitOfWork)commited).Rollback(); + return false; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + return true; + }); + } + + private static async Task LastUpdate() + { + return await Task.Run(delegate + { + UnitOfWork commited = Instancia.Commited; + try + { + return commited.AtualizacaoRepository.FindLastUpdate(); + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + }); + } +} diff --git a/Decompiler/Gestor.Application.Model.Ajuda/Atendimento.cs b/Decompiler/Gestor.Application.Model.Ajuda/Atendimento.cs new file mode 100644 index 0000000..4b9d991 --- /dev/null +++ b/Decompiler/Gestor.Application.Model.Ajuda/Atendimento.cs @@ -0,0 +1,68 @@ +using System; + +namespace Gestor.Application.Model.Ajuda; + +public class Atendimento +{ + private string _solicitante; + + private string _assunto; + + private string _status; + + private string _corpo; + + public long IdAtendimento { get; set; } + + public DateTime? Abertura { get; set; } + + public string Solicitante + { + get + { + return _solicitante?.ToUpper().Trim(); + } + set + { + _solicitante = value; + } + } + + public string Assunto + { + get + { + return _assunto?.ToUpper().Trim(); + } + set + { + _assunto = value; + } + } + + public DateTime? Solucao { get; set; } + + public string Status + { + get + { + return _status?.ToUpper().Trim(); + } + set + { + _status = value; + } + } + + public string Corpo + { + get + { + return _corpo?.ToUpper().Trim(); + } + set + { + _corpo = value; + } + } +} diff --git a/Decompiler/Gestor.Application.Model.Ajuda/Boleto.cs b/Decompiler/Gestor.Application.Model.Ajuda/Boleto.cs new file mode 100644 index 0000000..d232dbe --- /dev/null +++ b/Decompiler/Gestor.Application.Model.Ajuda/Boleto.cs @@ -0,0 +1,18 @@ +using System; + +namespace Gestor.Application.Model.Ajuda; + +public class Boleto +{ + public long IdBoleto { get; set; } + + public DateTime Vencimento { get; set; } + + public DateTime? Pagamento { get; set; } + + public decimal Valor { get; set; } + + public string Historico { get; set; } + + public string Nota { get; set; } +} diff --git a/Decompiler/Gestor.Application.Model.Ajuda/Contrato.cs b/Decompiler/Gestor.Application.Model.Ajuda/Contrato.cs new file mode 100644 index 0000000..c35e402 --- /dev/null +++ b/Decompiler/Gestor.Application.Model.Ajuda/Contrato.cs @@ -0,0 +1,8 @@ +namespace Gestor.Application.Model.Ajuda; + +public class Contrato +{ + public long IdModulo { get; set; } + + public string HtmlContrato { get; set; } +} diff --git a/Decompiler/Gestor.Application.Model.Ajuda/EmailAtendimento.cs b/Decompiler/Gestor.Application.Model.Ajuda/EmailAtendimento.cs new file mode 100644 index 0000000..24d1c34 --- /dev/null +++ b/Decompiler/Gestor.Application.Model.Ajuda/EmailAtendimento.cs @@ -0,0 +1,25 @@ +using System.Collections.ObjectModel; +using Gestor.Model.Domain.Common; + +namespace Gestor.Application.Model.Ajuda; + +public class EmailAtendimento +{ + public string Nome { get; set; } + + public string DDD { get; set; } + + public string Telefone { get; set; } + + public string EMail { get; set; } + + public string Assunto { get; set; } + + public string IDAcesso { get; set; } + + public string SenhaAcesso { get; set; } + + public string Corpo { get; set; } + + public ObservableCollection ArquivosAnexados { get; set; } +} diff --git a/Decompiler/Gestor.Application.Model.Ajuda/Instalacao.cs b/Decompiler/Gestor.Application.Model.Ajuda/Instalacao.cs new file mode 100644 index 0000000..c89095e --- /dev/null +++ b/Decompiler/Gestor.Application.Model.Ajuda/Instalacao.cs @@ -0,0 +1,22 @@ +using System; + +namespace Gestor.Application.Model.Ajuda; + +public class Instalacao +{ + public long Id { get; set; } + + public long IdFornecedor { get; set; } + + public DateTime? DataIntalacao { get; set; } + + public DateTime? DataAtualizacaoAggilizador { get; set; } + + public string Maquina { get; set; } + + public string Usuario { get; set; } + + public string IdAggilizador { get; set; } + + public string IdGerenciador { get; set; } +} diff --git a/Decompiler/Gestor.Application.Model/AnaliticoSource.cs b/Decompiler/Gestor.Application.Model/AnaliticoSource.cs new file mode 100644 index 0000000..02f65a4 --- /dev/null +++ b/Decompiler/Gestor.Application.Model/AnaliticoSource.cs @@ -0,0 +1,8 @@ +namespace Gestor.Application.Model; + +public class AnaliticoSource +{ + public long Id { get; set; } + + public string Agrupamento { get; set; } +} diff --git a/Decompiler/Gestor.Application.Model/Configuracoes.cs b/Decompiler/Gestor.Application.Model/Configuracoes.cs new file mode 100644 index 0000000..528d99a --- /dev/null +++ b/Decompiler/Gestor.Application.Model/Configuracoes.cs @@ -0,0 +1,8 @@ +namespace Gestor.Application.Model; + +public class Configuracoes +{ + public string LinkPromo { get; set; } + + public bool NaoverPromo { get; set; } +} diff --git a/Decompiler/Gestor.Application.Model/Grafico.cs b/Decompiler/Gestor.Application.Model/Grafico.cs new file mode 100644 index 0000000..8e8f1aa --- /dev/null +++ b/Decompiler/Gestor.Application.Model/Grafico.cs @@ -0,0 +1,11 @@ +using System; +using LiveCharts; + +namespace Gestor.Application.Model; + +public class Grafico +{ + public SeriesCollection Series { get; set; } + + public Func Formatter { get; set; } +} diff --git a/Decompiler/Gestor.Application.Model/RelacaoItens.cs b/Decompiler/Gestor.Application.Model/RelacaoItens.cs new file mode 100644 index 0000000..ba0cbc5 --- /dev/null +++ b/Decompiler/Gestor.Application.Model/RelacaoItens.cs @@ -0,0 +1,113 @@ +using System; +using System.ComponentModel; +using Gestor.Model.Common; + +namespace Gestor.Application.Model; + +public class RelacaoItens +{ + [Description("Nome")] + public string Nome { get; set; } + + [Description("Documento")] + public string Documento { get; set; } + + [Description("Apólice")] + public string Apolice { get; set; } + + [Description("Vigência Inicial")] + public DateTime VigenciaInicial { get; set; } + + [Description("Vigência Final")] + public DateTime? VigenciaFinal { get; set; } + + [Description("Ordem")] + public int? Ordem { get; set; } + + [Description("Fabricante")] + public string Fabricante { get; set; } + + [Description("Modelo")] + public string Modelo { get; set; } + + [Description("Ano Fabricação")] + public string AnoFab { get; set; } + + [Description("Ano Modelo")] + public string AnoMod { get; set; } + + [Description("Chassi")] + public string Chassi { get; set; } + + [Description("Placa")] + public string Placa { get; set; } + + [Description("Região Circulação")] + public string RegiaoCirculacao { get; set; } + + [Description("Fipe")] + public string Fipe { get; set; } + + [Description("Bônus")] + public int? Bonus { get; set; } + + [Description("Data Sinistro")] + public DateTime? DataSinistro { get; set; } + + [Description("Número Sinistro")] + public string NumSinistro { get; set; } + + [Description("Status Sinistro")] + public StatusSinistro? StatusSinistro { get; set; } + + [Description("Item Sinistrado")] + public string ItemSinistrado { get; set; } + + [Description("Valor")] + public decimal? Valor { get; set; } + + [Description("Data Liquidação")] + public DateTime? DataLiq { get; set; } + + [Description("Data Reclamação")] + public DateTime? DataRec { get; set; } + + [Description("Motivo")] + public string Motivo { get; set; } + + [Description("Sinistrado")] + public string Sinistrado { get; set; } + + [Description("Endereço")] + public string Endereco { get; set; } + + [Description("Número")] + public string Numero { get; set; } + + [Description("Bairro")] + public string Bairro { get; set; } + + [Description("Cidade")] + public string Cidade { get; set; } + + [Description("Estado")] + public string Estado { get; set; } + + [Description("CEP")] + public string Cep { get; set; } + + [Description("Complemento")] + public string Complemento { get; set; } + + [Description("Bens")] + public string Bens { get; set; } + + [Description("Descrição")] + public string Descricao { get; set; } + + [Description("Status")] + public string Status { get; set; } + + [Description("Cobertura")] + public string Cobertura { get; set; } +} diff --git a/Decompiler/Gestor.Application.Model/SinteticoSource.cs b/Decompiler/Gestor.Application.Model/SinteticoSource.cs new file mode 100644 index 0000000..4e179a7 --- /dev/null +++ b/Decompiler/Gestor.Application.Model/SinteticoSource.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Runtime.CompilerServices; +using Gestor.Model.Domain.Relatorios; +using Gestor.Model.Domain.Seguros; +using LiveCharts; + +namespace Gestor.Application.Model; + +public class SinteticoSource : INotifyPropertyChanged +{ + public bool Mostrar { get; set; } + + public string Titulo { get; set; } + + public ObservableCollection Lista { get; set; } + + public SeriesCollection Colecao { get; set; } + + public string Quantidade { get; set; } + + public string Valor { get; set; } + + public List Documentos { get; set; } + + public List Parcelas { get; set; } + + public List Clientes { get; set; } + + public DateTime? DateStart { get; set; } + + public DateTime? DateFinal { get; set; } + + public event PropertyChangedEventHandler PropertyChanged; + + public void OnPropertyChanged([CallerMemberName] string name = "") + { + this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name)); + } +} diff --git a/Decompiler/Gestor.Application.Properties.Resources.resx b/Decompiler/Gestor.Application.Properties.Resources.resx new file mode 100644 index 0000000..f273a37 --- /dev/null +++ b/Decompiler/Gestor.Application.Properties.Resources.resx @@ -0,0 +1,219 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +text/microsoft-resx1.3System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089<th class='{Align} {Size} {FontWeight}'>{Content}</th> + <div class="col-6"> + <div class="table-responsive-sm"> + <table class='table table-bordered'> + <thead> + {Head} + </thead> + {Footer} + </table> + + {Body} + </div> +</div> + <td class='{Align} {Size} {FontWeight}'>{Content}</td> + <html> + +<head> + <meta charset='utf-8'> + {style} + + <script> + function ready() { + alert('PODERÁ SER NECESSÁRIO ALTERAR A ESCALA DE IMPRESSÃO DEVIDO A QUANTIDADE DE CAMPOS, VOCÊ PODERÁ FAZER ISSO NAS CONFIGURAÇÕES DE IMPRESSÃO, ALTERE O VALOR ESCALA (%) ATÉ QUE O CONTEÚDO COMPLETO DO RELATÓRIO CAIBA NA FOLHA.'); + self.print(); + }; + </script> + + <style> + @media print { + @page { + size: A4 Orientation + } + + body { + -webkit-print-color-adjust: exact; + } + + .pagebreak { + page-break-before: always; + } + + .table { + zoom: 80%; + } + } + + .fs-7 { + font-size: 0.6rem !important; + } + </style> + <title>{NomeRelatorio}</title> + {Grafico} +</head> + +<body onload='ready()'> + <div class='card'> + <h5 class='card-header'>{NomeRelatorio}<br> + <spam style='color:gray;' class='fs-6'>{EmissaoRelatorio}</spam> + </h5> + </div> + + {DadosRelatorio} + + <script src='https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js' + integrity='ha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p' + crossorigin='anonymous'></script> + <script src='https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.min.js' + integrity='sha384-cVKIPhGWiC2Al4u+LWgxfKTRIcfu0JTxR+EQDz/bgldoEyl4H0zUF0QKbrJ0EcQF' + crossorigin='anonymous'></script> +</body> + +</html> + <tr {Color}> + {Content} +</tr> + <tfoot> + {Content} +</tfoot> + <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> + <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"> + <title>new</title> + + <style type="text/css"> + p { + margin-bottom: 0; + margin-top: 0; + } + </style> +</head> +<body> +</body> +</html> + <html> + +<head> + <meta charset='utf-8'> + {style} + + <script> + function ready() { + alert('PODERÁ SER NECESSÁRIO ALTERAR A ESCALA DE IMPRESSÃO DEVIDO A QUANTIDADE DE CAMPOS, VOCÊ PODERÁ FAZER ISSO NAS CONFIGURAÇÕES DE IMPRESSÃO, ALTERE O VALOR ESCALA (%) ATÉ QUE O CONTEÚDO COMPLETO DO RELATÓRIO CAIBA NA FOLHA.'); + self.print(); + }; + </script> + + <style> + @media print { + @page { + size: A4 Orientation + } + + body { + -webkit-print-color-adjust: exact; + } + + .pagebreak { + page-break-before: always; + } + + .table { + zoom: 80%; + } + } + + .fs-7 { + font-size: 0.6rem !important; + } + </style> + <title>{NomeRelatorio}</title> + {Grafico} +</head> + +<body onload='ready()'> + <div class='card'> + <h5 class='card-header'> + {NomeRelatorio}<br> + <spam style='color:gray;' class='fs-6'>{EmissaoRelatorio}</spam> + </h5> + </div> + + <div class="row"> + {DadosRelatorio} + </div> + + <script src='https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js' + integrity='ha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p' + crossorigin='anonymous'></script> + <script src='https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.min.js' + integrity='sha384-cVKIPhGWiC2Al4u+LWgxfKTRIcfu0JTxR+EQDz/bgldoEyl4H0zUF0QKbrJ0EcQF' + crossorigin='anonymous'></script> +</body> + +</html> + <div align='justify' style='height:{Tamanho}; max-height:{Tamanho}; overflow-y: hidden'> + <p style="text-align:center;"> + <b>{Nome}</b> + </p> + <p {DisplayContatos}><span style="margin-left:1cm;"></span> {Telefones} {Email} <b>{Endereço}</b>.</p> + <p><span style="margin-left:1cm;"></span>Está sendo recepcionado o documento listado abaixo do seguro do ramo <b>{Ramo}</b>, sob a apólice de n° <b>{Apolice}</b> {Endosso} da Seguradora <b>{Seguradora}</b>, <b>{Vigencias}</b>.</p> + <p><span style="margin-left:1cm;"></span>Item garantido: <b>{Item}</b> {Parcelas}.</p> + <p><span style="margin-left:1cm;"></span>Em caso de apólice, declaro estar ciente das Condições Gerais que regem este documento, bem como de todas suas coberturas e suas respectivas franquias, por quando da contratação. Estou ciente também que devo comunicar toda e qualquer mudança que ocorra nos dados informados, referentes ao item segurado ou proprietário, no ato da contratação.</p> + <p style="text-align:center;"><span style="margin-left:1cm;"></span>Em caso de parcelamento, também segue anexo o carnê de pagamento. Agradecemos a preferência e nos colocamos a disposição caso seja necessario.</p> + <p style="text-align:center; margin-top: 1cm;">{NomeCorretora}</p> + <p {DisplayVendedor}> Pasta: <b>{Pasta}</b> <br />Vendedor: <b>{Vendedor}</b> <br /> </p> <p> <b>{Observacao}</b></p>. + <p style="text-align:center; margin-top:1cm;">Recebido em ___/___/___ por:___________________________________________, RG:____________________</p> +</div> + <p>Emitido pelo usuário: {Usuario}, data e hora: {Emissao}.</p> + <hr style='border: 1px dashed black;' /> + <div class="table-responsive-sm"> + <table class='table table-bordered'> + <thead> + {Head} + </thead> + <tbody> + {Body} + </tbody> + {Footer} + </table> +</div> + <html> +<head> + <title>PROTOCOLOS</title> +</head> +<body style='font-size: 12px; font-family: Arial, Helvetica, sans-serif; margin-left: 50px; margin-right: 50px;' onload='self.print();'> + {Protocolos} +</body> +</html> + \ No newline at end of file diff --git a/Decompiler/Gestor.Application.Properties/Resources.cs b/Decompiler/Gestor.Application.Properties/Resources.cs new file mode 100644 index 0000000..8bf597c --- /dev/null +++ b/Decompiler/Gestor.Application.Properties/Resources.cs @@ -0,0 +1,70 @@ +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Globalization; +using System.Resources; +using System.Runtime.CompilerServices; + +namespace Gestor.Application.Properties; + +[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "18.0.0.0")] +[DebuggerNonUserCode] +[CompilerGenerated] +internal class Resources +{ + private static ResourceManager resourceMan; + + private static CultureInfo resourceCulture; + + [EditorBrowsable(EditorBrowsableState.Advanced)] + internal static ResourceManager ResourceManager + { + get + { + if (resourceMan == null) + { + resourceMan = new ResourceManager("Gestor.Application.Properties.Resources", typeof(Resources).Assembly); + } + return resourceMan; + } + } + + [EditorBrowsable(EditorBrowsableState.Advanced)] + internal static CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + + internal static string ColumnTemplate => ResourceManager.GetString("ColumnTemplate", resourceCulture); + + internal static string FooterTemplate => ResourceManager.GetString("FooterTemplate", resourceCulture); + + internal static string HeaderTemplate => ResourceManager.GetString("HeaderTemplate", resourceCulture); + + internal static string New => ResourceManager.GetString("New", resourceCulture); + + internal static string ProtocoloPageTemplate => ResourceManager.GetString("ProtocoloPageTemplate", resourceCulture); + + internal static string ProtocoloTemplate => ResourceManager.GetString("ProtocoloTemplate", resourceCulture); + + internal static string RelatorioMultipleTemplate => ResourceManager.GetString("RelatorioMultipleTemplate", resourceCulture); + + internal static string RelatorioTemplate => ResourceManager.GetString("RelatorioTemplate", resourceCulture); + + internal static string RowTemplate => ResourceManager.GetString("RowTemplate", resourceCulture); + + internal static string TableMultipleTemplate => ResourceManager.GetString("TableMultipleTemplate", resourceCulture); + + internal static string TableTemplate => ResourceManager.GetString("TableTemplate", resourceCulture); + + internal Resources() + { + } +} diff --git a/Decompiler/Gestor.Application.Properties/Settings.cs b/Decompiler/Gestor.Application.Properties/Settings.cs new file mode 100644 index 0000000..e14706a --- /dev/null +++ b/Decompiler/Gestor.Application.Properties/Settings.cs @@ -0,0 +1,14 @@ +using System.CodeDom.Compiler; +using System.Configuration; +using System.Runtime.CompilerServices; + +namespace Gestor.Application.Properties; + +[CompilerGenerated] +[GeneratedCode("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.14.0.0")] +internal sealed class Settings : ApplicationSettingsBase +{ + private static Settings defaultInstance = (Settings)(object)SettingsBase.Synchronized((SettingsBase)(object)new Settings()); + + public static Settings Default => defaultInstance; +} diff --git a/Decompiler/Gestor.Application.Servicos.Ajuda/AjudaServico.cs b/Decompiler/Gestor.Application.Servicos.Ajuda/AjudaServico.cs new file mode 100644 index 0000000..7805918 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Ajuda/AjudaServico.cs @@ -0,0 +1,114 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Threading.Tasks; +using CsQuery.ExtensionMethods.Internal; +using Gestor.Application.Helpers; +using Gestor.Application.Model.Ajuda; +using Gestor.Application.Servicos.Generic; +using Gestor.Model.API; +using Gestor.Model.License; + +namespace Gestor.Application.Servicos.Ajuda; + +public class AjudaServico : BaseServico +{ + internal async Task> BuscarAtendimentos(string status) + { + return await Task.Run(delegate + { + try + { + int num = ((status == "PENDENTES") ? 1 : 2); + return Connection.Get>($"Attendance/{num}").Result; + } + catch (Exception) + { + return (ObservableCollection)null; + } + }); + } + + internal async Task BuscarCorpoAtendimentos(long id) + { + return await Task.Run(delegate + { + try + { + return Connection.Get($"Attendance/Body/{id}").Result; + } + catch (Exception) + { + return (string)null; + } + }); + } + + internal async Task> BuscarBoletosNotas(string status) + { + return await Task.Run(delegate + { + try + { + return Connection.Get>(string.Format("Billet/{0}", status == "BAIXADOS")).Result; + } + catch (Exception) + { + return (List)null; + } + }); + } + + internal async Task BuscarContrato(Produto produto) + { + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + return await Task.Run(delegate + { + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + try + { + return Connection.Get($"Contract/{ExtensionMethods.GetValue((Enum)(object)produto)}").Result; + } + catch (Exception) + { + return (Contrato)null; + } + }); + } + + internal async Task> BuscarLicencas() + { + return await Task.Run(delegate + { + try + { + return Connection.Get>($"License/{ApplicationHelper.IdFornecedor}").Result; + } + catch (Exception) + { + return (ObservableCollection)null; + } + }); + } + + internal async Task ExcluirInstalacao(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + return Connection.Delete($"License/{id}").Result; + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)273, tries, id); + } + } + return false; + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Configuracoes/ConfuguracoesServico.cs b/Decompiler/Gestor.Application.Servicos.Configuracoes/ConfuguracoesServico.cs new file mode 100644 index 0000000..a9b2290 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Configuracoes/ConfuguracoesServico.cs @@ -0,0 +1,479 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Sockets; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Relatorios; +using Gestor.Model.Validation; +using Newtonsoft.Json; + +namespace Gestor.Application.Servicos.Configuracoes; + +public class ConfuguracoesServico : BaseServico +{ + public async Task> Buscar() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ConfiguracaoRepository.BuscarConfiguracoes(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)297, tries); + } + } + return (List)null; + }); + } + + public async Task Salvar(ConfiguracaoSistema configuracao) + { + int tries = 3; + return await Task.Run((Func)delegate + { + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0034: Unknown result type (might be due to invalid IL or missing references) + //IL_003b: Unknown result type (might be due to invalid IL or missing references) + //IL_0046: Unknown result type (might be due to invalid IL or missing references) + //IL_004d: Unknown result type (might be due to invalid IL or missing references) + //IL_0064: Unknown result type (might be due to invalid IL or missing references) + //IL_007d: Unknown result type (might be due to invalid IL or missing references) + //IL_0089: Unknown result type (might be due to invalid IL or missing references) + //IL_0091: Unknown result type (might be due to invalid IL or missing references) + //IL_009c: Unknown result type (might be due to invalid IL or missing references) + //IL_00a7: Unknown result type (might be due to invalid IL or missing references) + //IL_00b2: Unknown result type (might be due to invalid IL or missing references) + //IL_00f0: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork commited = Instancia.Commited; + try + { + ConfiguracaoSistema val = commited.ConfiguracaoRepository.SaveOrUpdate(configuracao); + DateTime networkTime = Funcoes.GetNetworkTime(); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog keyValues = new RegistroLog + { + Acao = (TipoAcao)0, + Usuario = Recursos.Usuario, + DataHora = networkTime, + Descricao = $"O USUÁRIO {Recursos.Usuario.Nome} ADICIONOU, EM {networkTime}, A CONFIGURAÇÃO {Funcoes.GetDescription((Enum)(object)val.Configuracao)} ", + EntidadeId = ((DomainBase)val).Id, + Tela = (TipoTela)50, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return val; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)298, tries, configuracao); + } + } + return configuracao; + }); + } + + public async Task Excluir(ConfiguracaoSistema configuracao) + { + int tries = 3; + return await Task.Run(delegate + { + //IL_0033: Unknown result type (might be due to invalid IL or missing references) + //IL_0038: Unknown result type (might be due to invalid IL or missing references) + //IL_003f: Unknown result type (might be due to invalid IL or missing references) + //IL_004a: Unknown result type (might be due to invalid IL or missing references) + //IL_0051: Unknown result type (might be due to invalid IL or missing references) + //IL_006d: Unknown result type (might be due to invalid IL or missing references) + //IL_0086: Unknown result type (might be due to invalid IL or missing references) + //IL_0097: Unknown result type (might be due to invalid IL or missing references) + //IL_009f: Unknown result type (might be due to invalid IL or missing references) + //IL_00aa: Unknown result type (might be due to invalid IL or missing references) + //IL_00b5: Unknown result type (might be due to invalid IL or missing references) + //IL_00c0: Unknown result type (might be due to invalid IL or missing references) + //IL_00fd: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork commited = Instancia.Commited; + try + { + commited.ConfiguracaoRepository.Delete(((DomainBase)configuracao).Id); + DateTime networkTime = Funcoes.GetNetworkTime(); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog keyValues = new RegistroLog + { + Acao = (TipoAcao)2, + Usuario = Recursos.Usuario, + DataHora = networkTime, + Descricao = $"O USUÁRIO {Recursos.Usuario.Nome} EXCLUIU, EM {networkTime}, A CONFIGURAÇÃO {Funcoes.GetDescription((Enum)(object)configuracao.Configuracao)} ", + EntidadeId = ((DomainBase)configuracao).Id, + Tela = (TipoTela)50, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)298, tries, configuracao); + } + } + return false; + }); + } + + public async Task> BuscarParametros(Relatorio relatorio) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + int tries = 3; + return await Task.Run(delegate + { + //IL_0050: Unknown result type (might be due to invalid IL or missing references) + //IL_001a: Unknown result type (might be due to invalid IL or missing references) + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ParametrosRelatorioRepository.Find(((DomainBase)Recursos.Usuario).Id, relatorio); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)301, tries, new + { + ((DomainBase)Recursos.Usuario).Id, + relatorio + }); + } + } + return (List)null; + }); + } + + public List BuscarParametroTotalizacao(Relatorio relatorio) + { + //IL_0041: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Unknown result type (might be due to invalid IL or missing references) + int num = 3; + while (num > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ParametrosTotalizacaoRepository.Find(((DomainBase)Recursos.Usuario).Id, relatorio); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + num = Registrar(e, (TipoErro)302, num, new + { + ((DomainBase)Recursos.Usuario).Id, + relatorio + }); + } + } + return null; + } + + public async Task> BuscarParametroTotalizacaoAsync(Relatorio relatorio) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + int tries = 3; + return await Task.Run(delegate + { + //IL_0050: Unknown result type (might be due to invalid IL or missing references) + //IL_001a: Unknown result type (might be due to invalid IL or missing references) + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ParametrosTotalizacaoRepository.Find(((DomainBase)Recursos.Usuario).Id, relatorio); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)302, tries, new + { + ((DomainBase)Recursos.Usuario).Id, + relatorio + }); + } + } + return (List)null; + }); + } + + public async Task Salvar(List parametrosSalvar, List parametrosDelete) + { + int tries = 3; + DateTime dateHora = Funcoes.GetNetworkTime(); + return await Task.Run(delegate + { + //IL_006e: Unknown result type (might be due to invalid IL or missing references) + //IL_0094: Unknown result type (might be due to invalid IL or missing references) + //IL_0099: Unknown result type (might be due to invalid IL or missing references) + //IL_009a: Unknown result type (might be due to invalid IL or missing references) + //IL_00a1: Unknown result type (might be due to invalid IL or missing references) + //IL_00ac: Unknown result type (might be due to invalid IL or missing references) + //IL_00b8: Unknown result type (might be due to invalid IL or missing references) + //IL_00c5: Unknown result type (might be due to invalid IL or missing references) + //IL_00d2: Unknown result type (might be due to invalid IL or missing references) + //IL_00da: Unknown result type (might be due to invalid IL or missing references) + //IL_00e5: Unknown result type (might be due to invalid IL or missing references) + //IL_00f0: Unknown result type (might be due to invalid IL or missing references) + //IL_00fb: Unknown result type (might be due to invalid IL or missing references) + //IL_019b: Unknown result type (might be due to invalid IL or missing references) + //IL_01a0: Unknown result type (might be due to invalid IL or missing references) + //IL_01a7: Unknown result type (might be due to invalid IL or missing references) + //IL_01b2: Unknown result type (might be due to invalid IL or missing references) + //IL_01be: Unknown result type (might be due to invalid IL or missing references) + //IL_01cb: Unknown result type (might be due to invalid IL or missing references) + //IL_01d8: Unknown result type (might be due to invalid IL or missing references) + //IL_01e0: Unknown result type (might be due to invalid IL or missing references) + //IL_01eb: Unknown result type (might be due to invalid IL or missing references) + //IL_01f6: Unknown result type (might be due to invalid IL or missing references) + //IL_0201: Unknown result type (might be due to invalid IL or missing references) + //IL_0139: Expected O, but got Unknown + //IL_023f: Expected O, but got Unknown + while (tries > 0) + { + try + { + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + UnitOfWork commited = Instancia.Commited; + try + { + foreach (ParametrosRelatorio item in parametrosSalvar) + { + if (item.IdUsuario == 0L) + { + item.Id = 0L; + item.IdUsuario = ((DomainBase)Recursos.Usuario).Id; + } + item.Ordem = parametrosSalvar.IndexOf(item); + TipoAcao acao = (TipoAcao)(item.Id != 0L); + ParametrosRelatorio val = ((item.Id == 0L) ? commited.ParametrosRelatorioRepository.SaveOrUpdate(item) : commited.ParametrosRelatorioRepository.Merge(item)); + RegistroLog keyValues = new RegistroLog + { + Acao = acao, + Usuario = Recursos.Usuario, + DataHora = dateHora, + Descricao = JsonConvert.SerializeObject((object)val), + EntidadeId = val.Id, + Tela = (TipoTela)50, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, commited); + } + foreach (ParametrosRelatorio item2 in parametrosDelete) + { + if (item2.Id != 0L) + { + commited.ParametrosRelatorioRepository.Delete(item2.Id); + RegistroLog keyValues2 = new RegistroLog + { + Acao = (TipoAcao)2, + Usuario = Recursos.Usuario, + DataHora = dateHora, + Descricao = JsonConvert.SerializeObject((object)item2), + EntidadeId = item2.Id, + Tela = (TipoTela)50, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues2, commited); + } + } + ((GenericUnitOfWork)commited).Commit(); + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + return true; + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)303, tries, parametrosSalvar); + } + } + return false; + }); + } + + public async Task SalvarTotalizacoes(List parametrosSalvar, List parametrosDeletar) + { + int tries = 3; + DateTime dateHora = Funcoes.GetNetworkTime(); + return await Task.Run(delegate + { + //IL_0063: Unknown result type (might be due to invalid IL or missing references) + //IL_0089: Unknown result type (might be due to invalid IL or missing references) + //IL_008e: Unknown result type (might be due to invalid IL or missing references) + //IL_008f: Unknown result type (might be due to invalid IL or missing references) + //IL_0096: Unknown result type (might be due to invalid IL or missing references) + //IL_00a1: Unknown result type (might be due to invalid IL or missing references) + //IL_00ad: Unknown result type (might be due to invalid IL or missing references) + //IL_00ba: Unknown result type (might be due to invalid IL or missing references) + //IL_00c7: Unknown result type (might be due to invalid IL or missing references) + //IL_00cf: Unknown result type (might be due to invalid IL or missing references) + //IL_00da: Unknown result type (might be due to invalid IL or missing references) + //IL_00e5: Unknown result type (might be due to invalid IL or missing references) + //IL_00f0: Unknown result type (might be due to invalid IL or missing references) + //IL_0190: Unknown result type (might be due to invalid IL or missing references) + //IL_0195: Unknown result type (might be due to invalid IL or missing references) + //IL_019c: Unknown result type (might be due to invalid IL or missing references) + //IL_01a7: Unknown result type (might be due to invalid IL or missing references) + //IL_01b3: Unknown result type (might be due to invalid IL or missing references) + //IL_01c0: Unknown result type (might be due to invalid IL or missing references) + //IL_01cd: Unknown result type (might be due to invalid IL or missing references) + //IL_01d5: Unknown result type (might be due to invalid IL or missing references) + //IL_01e0: Unknown result type (might be due to invalid IL or missing references) + //IL_01eb: Unknown result type (might be due to invalid IL or missing references) + //IL_01f6: Unknown result type (might be due to invalid IL or missing references) + //IL_012e: Expected O, but got Unknown + //IL_0234: Expected O, but got Unknown + while (tries > 0) + { + try + { + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + UnitOfWork commited = Instancia.Commited; + try + { + foreach (ParametrosTotalizacao item in parametrosSalvar) + { + if (item.IdUsuario == 0L) + { + item.Id = 0L; + item.IdUsuario = ((DomainBase)Recursos.Usuario).Id; + } + item.Ativa = true; + TipoAcao acao = (TipoAcao)(item.Id != 0L); + ParametrosTotalizacao val = ((item.Id == 0L) ? commited.ParametrosTotalizacaoRepository.SaveOrUpdate(item) : commited.ParametrosTotalizacaoRepository.Merge(item)); + RegistroLog keyValues = new RegistroLog + { + Acao = acao, + Usuario = Recursos.Usuario, + DataHora = dateHora, + Descricao = JsonConvert.SerializeObject((object)val), + EntidadeId = val.Id, + Tela = (TipoTela)50, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, commited); + } + foreach (ParametrosTotalizacao item2 in parametrosDeletar) + { + if (item2.Id != 0L) + { + commited.ParametrosTotalizacaoRepository.Delete(item2.Id); + RegistroLog keyValues2 = new RegistroLog + { + Acao = (TipoAcao)2, + Usuario = Recursos.Usuario, + DataHora = dateHora, + Descricao = JsonConvert.SerializeObject((object)item2), + EntidadeId = item2.Id, + Tela = (TipoTela)50, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues2, commited); + } + } + ((GenericUnitOfWork)commited).Commit(); + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + return true; + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)304, tries, parametrosSalvar); + } + } + return false; + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Ferramentas/AdiantamentoServico.cs b/Decompiler/Gestor.Application.Servicos.Ferramentas/AdiantamentoServico.cs new file mode 100644 index 0000000..07b5444 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Ferramentas/AdiantamentoServico.cs @@ -0,0 +1,269 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Sockets; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Relatorios; +using Gestor.Model.Domain.Seguros; +using Newtonsoft.Json; + +namespace Gestor.Application.Servicos.Ferramentas; + +public class AdiantamentoServico : BaseServico +{ + public async Task Save(Adiantamento adiatamento) + { + int tries = 3; + base.Sucesso = true; + Adiantamento adiantamentoOriginal = adiatamento; + DateTime now = Funcoes.GetNetworkTime(); + return await Task.Run((Func)delegate + { + //IL_0028: Unknown result type (might be due to invalid IL or missing references) + //IL_009a: Unknown result type (might be due to invalid IL or missing references) + //IL_009f: Unknown result type (might be due to invalid IL or missing references) + //IL_00a0: Unknown result type (might be due to invalid IL or missing references) + //IL_00a6: Unknown result type (might be due to invalid IL or missing references) + //IL_00b1: Unknown result type (might be due to invalid IL or missing references) + //IL_00bd: Unknown result type (might be due to invalid IL or missing references) + //IL_00c4: Unknown result type (might be due to invalid IL or missing references) + //IL_00c9: Unknown result type (might be due to invalid IL or missing references) + //IL_00d5: Expected O, but got Unknown + //IL_00da: Unknown result type (might be due to invalid IL or missing references) + //IL_00eb: Unknown result type (might be due to invalid IL or missing references) + //IL_00f3: Unknown result type (might be due to invalid IL or missing references) + //IL_00fe: Unknown result type (might be due to invalid IL or missing references) + //IL_0109: Unknown result type (might be due to invalid IL or missing references) + //IL_0114: Unknown result type (might be due to invalid IL or missing references) + //IL_0151: Expected O, but got Unknown + while (tries > 0) + { + adiatamento = adiantamentoOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + TipoAcao acao = (TipoAcao)(((DomainBase)adiatamento).Id != 0L); + adiatamento.Pagamento = (adiatamento.Pago ? new DateTime?(now) : null); + adiatamento = ((((DomainBase)adiatamento).Id == 0L) ? commited.AdiantamentoRepository.SaveOrUpdate(adiatamento) : commited.AdiantamentoRepository.Merge(adiatamento)); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog keyValues = new RegistroLog + { + Acao = acao, + Usuario = Recursos.Usuario, + DataHora = now, + Descricao = JsonConvert.SerializeObject((object)adiatamento, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)adiatamento).Id, + Tela = (TipoTela)36, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return adiatamento; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)209, tries, adiatamento); + } + } + return adiantamentoOriginal; + }); + } + + public async Task Delete(Adiantamento adiantamento) + { + int tries = 3; + DateTime dateHora = Funcoes.GetNetworkTime(); + return await Task.Run(delegate + { + //IL_002d: Unknown result type (might be due to invalid IL or missing references) + //IL_0033: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork commited = Instancia.Commited; + try + { + commited.AdiantamentoRepository.Delete(((DomainBase)adiantamento).Id); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog val = new RegistroLog(); + val.Acao = (TipoAcao)2; + val.Usuario = Recursos.Usuario; + val.DataHora = dateHora; + val.Descricao = $"O USUÁRIO {Recursos.Usuario.Nome} EXCLUIU, EM {dateHora}, O PARCEIRO DE " + $"ID: '{((DomainBase)adiantamento).Id}'" + ", HISTÓRICO: '" + (string.IsNullOrWhiteSpace(adiantamento.Historico) ? "" : (adiantamento.Historico ?? "")) + "', DATA DO ADIANTAMENTO: '" + ((!adiantamento.Data.HasValue) ? "" : (adiantamento.Data?.ToShortDateString() ?? "")) + "'" + $", VALOR DO ADIANTAMENTO: 'R${adiantamento.Valor}'."; + val.EntidadeId = ((DomainBase)adiantamento).Id; + val.Versao = LoginViewModel.VersaoAtual; + val.Tela = (TipoTela)36; + val.NomeMaquina = Environment.MachineName; + val.UsuarioMaquina = Environment.UserName; + val.Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString(); + RegistroLog keyValues = val; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)210, tries, adiantamento); + } + } + return false; + }); + } + + public async Task> BuscarPorData(Filtros filtro, bool segundavia = false) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.AdiantamentoRepository.FindByDate(filtro.Inicio, filtro.Fim, filtro.Vendedores, segundavia); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)15, tries, filtro); + } + } + return new List(); + }); + } + + public async Task> BuscarAdiantamentos(long id, bool concluido) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.AdiantamentoRepository.BuscarAdiantamentos(id, concluido); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)16, tries, new { id, concluido }); + } + } + return new List(); + }); + } + + public async Task GerarPagamento(List adiantamentos) + { + int tries = 3; + DateTime now = Funcoes.GetNetworkTime(); + await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork unitOfWork = Instancia.Commited; + try + { + adiantamentos.ForEach(delegate(Adiantamento x) + { + //IL_0051: Unknown result type (might be due to invalid IL or missing references) + //IL_0056: Unknown result type (might be due to invalid IL or missing references) + //IL_005d: Unknown result type (might be due to invalid IL or missing references) + //IL_0068: Unknown result type (might be due to invalid IL or missing references) + //IL_0079: Unknown result type (might be due to invalid IL or missing references) + //IL_007b: Unknown result type (might be due to invalid IL or missing references) + //IL_0080: Unknown result type (might be due to invalid IL or missing references) + //IL_008c: Expected O, but got Unknown + //IL_0091: Unknown result type (might be due to invalid IL or missing references) + //IL_009d: Unknown result type (might be due to invalid IL or missing references) + //IL_00a5: Unknown result type (might be due to invalid IL or missing references) + //IL_00b0: Unknown result type (might be due to invalid IL or missing references) + //IL_00bb: Unknown result type (might be due to invalid IL or missing references) + //IL_00c6: Unknown result type (might be due to invalid IL or missing references) + //IL_0103: Expected O, but got Unknown + Adiantamento val = unitOfWork.AdiantamentoRepository.FindById(((DomainBase)x).Id); + val.Pago = true; + val.Pagamento = now; + val = unitOfWork.AdiantamentoRepository.Merge(val); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog keyValues = new RegistroLog + { + Acao = (TipoAcao)1, + Usuario = Recursos.Usuario, + DataHora = now, + Descricao = JsonConvert.SerializeObject((object)val, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)val).Id, + Tela = (TipoTela)36, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, unitOfWork); + }); + ((GenericUnitOfWork)unitOfWork).Commit(); + break; + } + finally + { + if (unitOfWork != null) + { + ((IDisposable)unitOfWork).Dispose(); + } + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)194, tries, adiantamentos); + } + } + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Ferramentas/AgendaServico.cs b/Decompiler/Gestor.Application.Servicos.Ferramentas/AgendaServico.cs new file mode 100644 index 0000000..855f036 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Ferramentas/AgendaServico.cs @@ -0,0 +1,224 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net; +using System.Net.Sockets; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Newtonsoft.Json; + +namespace Gestor.Application.Servicos.Ferramentas; + +internal class AgendaServico : BaseServico +{ + public async Task Save(Agenda agenda) + { + int tries = 3; + base.Sucesso = true; + Agenda agendaOriginal = agenda; + return await Task.Run((Func)delegate + { + //IL_0022: Unknown result type (might be due to invalid IL or missing references) + //IL_0144: Unknown result type (might be due to invalid IL or missing references) + //IL_0149: Unknown result type (might be due to invalid IL or missing references) + //IL_014a: Unknown result type (might be due to invalid IL or missing references) + //IL_0150: Unknown result type (might be due to invalid IL or missing references) + //IL_015b: Unknown result type (might be due to invalid IL or missing references) + //IL_0166: Unknown result type (might be due to invalid IL or missing references) + //IL_016d: Unknown result type (might be due to invalid IL or missing references) + //IL_0172: Unknown result type (might be due to invalid IL or missing references) + //IL_017e: Expected O, but got Unknown + //IL_0183: Unknown result type (might be due to invalid IL or missing references) + //IL_0194: Unknown result type (might be due to invalid IL or missing references) + //IL_019c: Unknown result type (might be due to invalid IL or missing references) + //IL_01a7: Unknown result type (might be due to invalid IL or missing references) + //IL_01b2: Unknown result type (might be due to invalid IL or missing references) + //IL_01bd: Unknown result type (might be due to invalid IL or missing references) + //IL_01fc: Expected O, but got Unknown + while (tries > 0) + { + agenda = agendaOriginal; + try + { + TipoAcao acao = (TipoAcao)(((DomainBase)agenda).Id != 0L); + List list = agenda.Telefones?.ToList(); + List list2 = agenda.Emails?.ToList(); + agenda.Telefones = null; + agenda.Emails = null; + UnitOfWork commited = Instancia.Commited; + try + { + if (((DomainBase)agenda).Id == 0) + { + agenda = commited.AgendaRepository.SaveOrUpdate(agenda); + if (list != null) + { + list = commited.AgendaTelefoneRepository.Inserir(list, agenda); + } + if (list2 != null) + { + list2 = commited.AgendaEmailRepository.Inserir(list2, agenda); + } + } + else + { + if (list != null) + { + list = commited.AgendaTelefoneRepository.Merge(list, agenda); + } + if (list2 != null) + { + list2 = commited.AgendaEmailRepository.Merge(list2, agenda); + } + agenda = commited.AgendaRepository.Merge(agenda); + } + agenda.Telefones = ((list == null) ? null : new ObservableCollection(list)); + agenda.Emails = ((list2 == null) ? null : new ObservableCollection(list2)); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog keyValues = new RegistroLog + { + Acao = acao, + Usuario = Recursos.Usuario, + DataHora = Funcoes.GetNetworkTime(), + Descricao = JsonConvert.SerializeObject((object)agenda, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)agenda).Id, + Tela = (TipoTela)34, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return agenda; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)215, tries, agenda); + } + } + return agendaOriginal; + }); + } + + public async Task Delete(Agenda agenda) + { + int tries = 3; + return await Task.Run(delegate + { + //IL_0033: Unknown result type (might be due to invalid IL or missing references) + //IL_003a: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork commited = Instancia.Commited; + try + { + commited.AgendaRepository.Delete(((DomainBase)agenda).Id); + DateTime networkTime = Funcoes.GetNetworkTime(); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog val = new RegistroLog(); + val.Acao = (TipoAcao)2; + val.Usuario = Recursos.Usuario; + val.DataHora = networkTime; + val.Descricao = $"O USUÁRIO {Recursos.Usuario.Nome} EXCLUIU, EM {networkTime}, O CONTATO DE " + $"ID: '{((DomainBase)agenda).Id}'" + ", NOME: '" + (string.IsNullOrWhiteSpace(agenda.Nome) ? "" : (agenda.Nome ?? "")) + "', ENDEREÇO: '" + agenda.Endereco + ", " + agenda.Numero + ", " + (string.IsNullOrWhiteSpace(agenda.Complemento) ? "-" : (agenda.Complemento ?? "")) + ", " + agenda.Bairro + ", " + agenda.Cidade + "/" + agenda.Estado + " - " + agenda.Cep + "', OBSERVAÇÃO: '" + (string.IsNullOrWhiteSpace(agenda.Observacao) ? "" : (agenda.Observacao ?? "")) + "'."; + val.EntidadeId = ((DomainBase)agenda).Id; + val.Tela = (TipoTela)34; + val.Versao = LoginViewModel.VersaoAtual; + val.NomeMaquina = Environment.MachineName; + val.UsuarioMaquina = Environment.UserName; + val.Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString(); + RegistroLog keyValues = val; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)216, tries, agenda); + } + } + return false; + }); + } + + internal async Task> BuscarTelefonesAsync(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new ObservableCollection(read.AgendaTelefoneRepository.FindByAgendaId(id)); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)107, tries, id); + } + } + return new ObservableCollection(); + }); + } + + internal async Task> BuscarEmailsAsync(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new ObservableCollection(read.AgendaEmailRepository.FindByAgendaId(id)); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)108, tries, id); + } + } + return new ObservableCollection(); + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Ferramentas/EmailServico.cs b/Decompiler/Gestor.Application.Servicos.Ferramentas/EmailServico.cs new file mode 100644 index 0000000..1a9c528 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Ferramentas/EmailServico.cs @@ -0,0 +1,126 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Common.Helpers; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Servicos.Ferramentas; + +internal class EmailServico : BaseServico +{ + public async Task Save(Credencial credencial) + { + int tries = 3; + base.Sucesso = true; + Credencial credencialOriginal = credencial; + return await Task.Run((Func)delegate + { + List list = new List(); + credencial = credencialOriginal; + while (tries > 0) + { + credencial = credencialOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + bool num = ((DomainBase)credencial).Id != 0L; + credencial.Senha = EncryptionHelper.Encrypt(credencial.Senha); + if (num) + { + list.Add(CreateLog(((DomainBase)credencial).Id, credencial, (TipoTela)17)); + } + credencial = ((((DomainBase)credencial).Id == 0L) ? commited.CredencialRepository.SaveOrUpdate(credencial) : commited.CredencialRepository.Merge(credencial)); + if (!num) + { + list.Add(CreateLog(((DomainBase)credencial).Id, ((DomainBase)credencial).GetValorOriginal(), (TipoTela)17, (TipoAcao)0)); + } + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return credencial; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)217, tries, credencial); + } + } + return credencialOriginal; + }); + } + + public async Task Delete(Credencial email) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + List list = new List(); + try + { + UnitOfWork commited = Instancia.Commited; + try + { + list.Add(CreateLog(((DomainBase)email).Id, ((DomainBase)email).GetValorOriginal(), (TipoTela)17, (TipoAcao)2)); + commited.CredencialRepository.Delete(((DomainBase)email).Id); + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)218, tries, email); + } + } + return false; + }); + } + + internal async Task> BuscarEmail(string email) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ClienteEmailRepository.FindEmailCliente(email, (Recursos.Usuario.IdEmpresa == 1) ? 0 : Recursos.Usuario.IdEmpresa); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)109, tries, email); + } + } + return new List(); + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Ferramentas/EmpresaServico.cs b/Decompiler/Gestor.Application.Servicos.Ferramentas/EmpresaServico.cs new file mode 100644 index 0000000..4f47cdf --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Ferramentas/EmpresaServico.cs @@ -0,0 +1,323 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Sockets; +using System.Threading.Tasks; +using ArquivoDigital.Infrastructure.UnitOfWork.Logic; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Newtonsoft.Json; + +namespace Gestor.Application.Servicos.Ferramentas; + +internal class EmpresaServico : BaseServico +{ + internal async Task> BuscarEmpresas() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.EmpresaRepository.Find((Recursos.Usuario.IdEmpresa == 1) ? 0 : Recursos.Usuario.IdEmpresa); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)113, tries); + } + } + return new List(); + }); + } + + internal async Task BuscarEmpresaPorId(long id) + { + int tries = 3; + return await Task.Run((Func)delegate + { + //IL_0059: Unknown result type (might be due to invalid IL or missing references) + //IL_005f: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.EmpresaRepository.FindById(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)114, tries, id); + } + } + return new Empresa(); + }); + } + + internal async Task Save(Customer customer) + { + int tries = 3; + base.Sucesso = true; + Customer customerOriginal = customer; + return await Task.Run((Func)delegate + { + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_002d: Unknown result type (might be due to invalid IL or missing references) + //IL_003e: Unknown result type (might be due to invalid IL or missing references) + //IL_004f: Unknown result type (might be due to invalid IL or missing references) + //IL_0060: Unknown result type (might be due to invalid IL or missing references) + //IL_0071: Unknown result type (might be due to invalid IL or missing references) + //IL_0082: Unknown result type (might be due to invalid IL or missing references) + //IL_0093: Unknown result type (might be due to invalid IL or missing references) + //IL_00a4: Unknown result type (might be due to invalid IL or missing references) + //IL_00b5: Unknown result type (might be due to invalid IL or missing references) + //IL_00c6: Unknown result type (might be due to invalid IL or missing references) + //IL_00d7: Unknown result type (might be due to invalid IL or missing references) + //IL_00e8: Unknown result type (might be due to invalid IL or missing references) + //IL_00f9: Unknown result type (might be due to invalid IL or missing references) + //IL_0104: Unknown result type (might be due to invalid IL or missing references) + //IL_0116: Expected O, but got Unknown + while (tries > 0) + { + customer = customerOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + Empresa val = new Empresa + { + Nome = customer.Name, + Documento = customer.Document, + Bairro = customer.District, + Cidade = customer.City, + Complemento = customer.Adjunct, + Numero = customer.Number, + Cep = customer.PostCode, + Estado = customer.State, + Email = customer.Mail, + PrimeiroPrefixo = customer.AreaCode, + PrimeiroTelefone = customer.Phone, + SegundoPrefixo = customer.SecondAreaCode, + SegundoTelefone = customer.SecondPhone, + Serial = ApplicationHelper.NumeroSerial, + Site = customer.Site + }; + commited.EmpresaRepository.SaveOrUpdate(val); + ((GenericUnitOfWork)commited).Commit(); + return customer; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)277, tries, customer); + } + } + return customerOriginal; + }); + } + + public async Task Save(Empresa empresa) + { + int tries = 3; + base.Sucesso = true; + Empresa empresaOriginal = empresa; + return await Task.Run((Func)delegate + { + //IL_0028: Unknown result type (might be due to invalid IL or missing references) + //IL_007a: Unknown result type (might be due to invalid IL or missing references) + //IL_007f: Unknown result type (might be due to invalid IL or missing references) + //IL_0080: Unknown result type (might be due to invalid IL or missing references) + //IL_0086: Unknown result type (might be due to invalid IL or missing references) + //IL_0091: Unknown result type (might be due to invalid IL or missing references) + //IL_009c: Unknown result type (might be due to invalid IL or missing references) + //IL_00a3: Unknown result type (might be due to invalid IL or missing references) + //IL_00a8: Unknown result type (might be due to invalid IL or missing references) + //IL_00b4: Expected O, but got Unknown + //IL_00b9: Unknown result type (might be due to invalid IL or missing references) + //IL_00ca: Unknown result type (might be due to invalid IL or missing references) + //IL_00d2: Unknown result type (might be due to invalid IL or missing references) + //IL_00dd: Unknown result type (might be due to invalid IL or missing references) + //IL_00e8: Unknown result type (might be due to invalid IL or missing references) + //IL_00f3: Unknown result type (might be due to invalid IL or missing references) + //IL_0130: Expected O, but got Unknown + while (tries > 0) + { + empresa = empresaOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + TipoAcao acao = (TipoAcao)(((DomainBase)empresa).Id != 0L); + empresa = ((((DomainBase)empresa).Id == 0L) ? commited.EmpresaRepository.SaveOrUpdate(empresa) : commited.EmpresaRepository.Merge(empresa)); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + if (((DomainBase)Recursos.Usuario).Id != 0L) + { + RegistroLog keyValues = new RegistroLog + { + Acao = acao, + Usuario = Recursos.Usuario, + DataHora = Funcoes.GetNetworkTime(), + Descricao = JsonConvert.SerializeObject((object)empresa, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)empresa).Id, + Tela = (TipoTela)18, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, commited); + } + ((GenericUnitOfWork)commited).Commit(); + return empresa; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)277, tries, empresa); + } + } + return empresaOriginal; + }); + } + + public string BuscarSenhaAdm() + { + int num = 3; + while (num > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.EmpresaRepository.BuscarSenhaAdm(1L); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + num = Registrar(e, (TipoErro)115, num); + } + } + return null; + } + + public async void AtualizarLogoId(long id, string idLogo) + { + await Task.Run(delegate + { + try + { + UnitOfWork commited = Instancia.Commited; + try + { + Empresa val = commited.EmpresaRepository.FindById(id); + val.LogoId = idLogo; + commited.EmpresaRepository.Merge(val); + ((GenericUnitOfWork)commited).Commit(); + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception) + { + } + }); + } + + public async Task ConsultaEspacoBancoInGb() + { + return await Task.Run(delegate + { + try + { + UnitOfWork read = Instancia.Read; + try + { + double num = read.EmpresaRepository.ConsultaEspacoBancoInGb(); + double num2 = 0.0; + try + { + foreach (ControleArquivoDigital item in read.IndiceArquivoDigitalRepository.BuscarBancos()) + { + if (!(item.Tabela.ToLower() == "arquivos")) + { + try + { + Gestor.Application.Helpers.ArquivoDigital.SetConnection(item.Catalogo); + UnitOfWork read2 = Gestor.Application.Helpers.ArquivoDigital.Read; + try + { + num2 += read2.ArquivoDigitalRepository.ConsultaEspacoBancoInGb(); + } + finally + { + ((IDisposable)read2)?.Dispose(); + } + } + catch + { + } + } + } + } + catch + { + } + return num + num2; + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception) + { + } + return 0.0; + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Ferramentas/EstipulanteServico.cs b/Decompiler/Gestor.Application.Servicos.Ferramentas/EstipulanteServico.cs new file mode 100644 index 0000000..126c369 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Ferramentas/EstipulanteServico.cs @@ -0,0 +1,125 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Servicos.Ferramentas; + +internal class EstipulanteServico : BaseServico +{ + internal async Task BuscarEstipulantePorId(long id) + { + int tries = 3; + return await Task.Run((Func)delegate + { + //IL_0059: Unknown result type (might be due to invalid IL or missing references) + //IL_005f: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.EstipulanteRepository.FindById(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)110, tries, id); + } + } + return new Estipulante(); + }); + } + + public async Task Save(Estipulante estipulante) + { + int tries = 3; + base.Sucesso = true; + Estipulante estipulanteOriginal = estipulante; + return await Task.Run((Func)delegate + { + while (tries > 0) + { + List list = new List(); + estipulante = estipulanteOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + estipulante.IdEmpresa = ((DomainBase)Recursos.Empresa).Id; + bool num = ((DomainBase)estipulante).Id != 0L; + if (num) + { + list.Add(CreateLog(((DomainBase)estipulante).Id, estipulante, (TipoTela)9)); + } + estipulante = ((((DomainBase)estipulante).Id == 0L) ? commited.EstipulanteRepository.SaveOrUpdate(estipulante) : commited.EstipulanteRepository.Merge(estipulante)); + if (!num) + { + list.Add(CreateLog(((DomainBase)estipulante).Id, ((DomainBase)estipulante).GetValorOriginal(), (TipoTela)9, (TipoAcao)0)); + } + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return estipulante; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)219, tries, estipulante); + } + } + return estipulanteOriginal; + }); + } + + public async Task Delete(Estipulante estipulante) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + List list = new List(); + try + { + UnitOfWork commited = Instancia.Commited; + try + { + list.Add(CreateLog(((DomainBase)estipulante).Id, ((DomainBase)estipulante).GetValorOriginal(), (TipoTela)9, (TipoAcao)2)); + commited.EstipulanteRepository.Delete(((DomainBase)estipulante).Id); + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)220, tries, estipulante); + } + } + return false; + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Ferramentas/ImpostoServico.cs b/Decompiler/Gestor.Application.Servicos.Ferramentas/ImpostoServico.cs new file mode 100644 index 0000000..45b5b7b --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Ferramentas/ImpostoServico.cs @@ -0,0 +1,175 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Sockets; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Newtonsoft.Json; + +namespace Gestor.Application.Servicos.Ferramentas; + +public class ImpostoServico : BaseServico +{ + public async Task> Buscar(bool? ativo) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ImpostoRepository.DefaultSelect(ativo); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)317, tries, ativo); + } + } + return new List(); + }); + } + + public async Task> BuscarPorSeguradora(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ImpostoRepository.FindBySeguradora(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)317, tries, id); + } + } + return new List(); + }); + } + + public async Task> BuscarPorRamo(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ImpostoRepository.FindByRamo(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)317, tries, id); + } + } + return new List(); + }); + } + + public async Task Salvar(Imposto imposto) + { + int tries = 3; + return await Task.Run((Func)delegate + { + //IL_0028: Unknown result type (might be due to invalid IL or missing references) + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_005c: Unknown result type (might be due to invalid IL or missing references) + //IL_0061: Unknown result type (might be due to invalid IL or missing references) + //IL_0062: Unknown result type (might be due to invalid IL or missing references) + //IL_0068: Unknown result type (might be due to invalid IL or missing references) + //IL_0073: Unknown result type (might be due to invalid IL or missing references) + //IL_007e: Unknown result type (might be due to invalid IL or missing references) + //IL_0080: Unknown result type (might be due to invalid IL or missing references) + //IL_0085: Unknown result type (might be due to invalid IL or missing references) + //IL_0091: Expected O, but got Unknown + //IL_0096: Unknown result type (might be due to invalid IL or missing references) + //IL_00a2: Unknown result type (might be due to invalid IL or missing references) + //IL_00aa: Unknown result type (might be due to invalid IL or missing references) + //IL_00b5: Unknown result type (might be due to invalid IL or missing references) + //IL_00c0: Unknown result type (might be due to invalid IL or missing references) + //IL_00cb: Unknown result type (might be due to invalid IL or missing references) + //IL_0109: Expected O, but got Unknown + while (tries > 0) + { + base.Sucesso = true; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + TipoAcao val = (TipoAcao)(((DomainBase)imposto).Id != 0L); + Imposto val2 = (((int)val == 0) ? commited.ImpostoRepository.SaveOrUpdate(imposto) : commited.ImpostoRepository.Merge(imposto)); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog keyValues = new RegistroLog + { + Acao = val, + Usuario = Recursos.Usuario, + DataHora = Funcoes.GetNetworkTime(), + Descricao = JsonConvert.SerializeObject((object)val2, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)val2).Id, + Tela = (TipoTela)56, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return val2; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + base.Sucesso = false; + tries = Registrar(e, (TipoErro)318, tries, imposto, abrirTela: false); + } + } + return imposto; + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Ferramentas/MetaSeguradoraServico.cs b/Decompiler/Gestor.Application.Servicos.Ferramentas/MetaSeguradoraServico.cs new file mode 100644 index 0000000..e7afb7b --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Ferramentas/MetaSeguradoraServico.cs @@ -0,0 +1,169 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Sockets; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels; +using Gestor.Common.Validation; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Relatorios; +using Gestor.Model.Domain.Seguros; +using Newtonsoft.Json; + +namespace Gestor.Application.Servicos.Ferramentas; + +internal class MetaSeguradoraServico : BaseServico +{ + public async Task Save(MetaSeguradora metaSeguradora) + { + int tries = 3; + base.Sucesso = true; + MetaSeguradora metaSeguradoraOriginal = metaSeguradora; + return await Task.Run((Func)delegate + { + //IL_0028: Unknown result type (might be due to invalid IL or missing references) + //IL_006b: Unknown result type (might be due to invalid IL or missing references) + //IL_0070: Unknown result type (might be due to invalid IL or missing references) + //IL_0071: Unknown result type (might be due to invalid IL or missing references) + //IL_0077: Unknown result type (might be due to invalid IL or missing references) + //IL_0082: Unknown result type (might be due to invalid IL or missing references) + //IL_008d: Unknown result type (might be due to invalid IL or missing references) + //IL_0094: Unknown result type (might be due to invalid IL or missing references) + //IL_0099: Unknown result type (might be due to invalid IL or missing references) + //IL_00a5: Expected O, but got Unknown + //IL_00aa: Unknown result type (might be due to invalid IL or missing references) + //IL_00bb: Unknown result type (might be due to invalid IL or missing references) + //IL_00c3: Unknown result type (might be due to invalid IL or missing references) + //IL_00ce: Unknown result type (might be due to invalid IL or missing references) + //IL_00d9: Unknown result type (might be due to invalid IL or missing references) + //IL_00e4: Unknown result type (might be due to invalid IL or missing references) + //IL_0121: Expected O, but got Unknown + while (tries > 0) + { + metaSeguradora = metaSeguradoraOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + TipoAcao acao = (TipoAcao)(((DomainBase)metaSeguradora).Id != 0L); + metaSeguradora = ((((DomainBase)metaSeguradora).Id == 0L) ? commited.MetaSeguradoraRepository.SaveOrUpdate(metaSeguradora) : commited.MetaSeguradoraRepository.Merge(metaSeguradora)); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog keyValues = new RegistroLog + { + Acao = acao, + Usuario = Recursos.Usuario, + DataHora = Funcoes.GetNetworkTime(), + Descricao = JsonConvert.SerializeObject((object)metaSeguradora, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)metaSeguradora).Id, + Tela = (TipoTela)31, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return metaSeguradora; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)222, tries, metaSeguradora); + } + } + return metaSeguradoraOriginal; + }); + } + + public async Task Delete(MetaSeguradora meta) + { + int tries = 3; + return await Task.Run(delegate + { + //IL_0033: Unknown result type (might be due to invalid IL or missing references) + //IL_003a: Expected O, but got Unknown + //IL_00a8: Unknown result type (might be due to invalid IL or missing references) + while (tries > 0) + { + try + { + UnitOfWork commited = Instancia.Commited; + try + { + commited.MetaSeguradoraRepository.Delete(((DomainBase)meta).Id); + DateTime networkTime = Funcoes.GetNetworkTime(); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog val = new RegistroLog(); + val.Acao = (TipoAcao)2; + val.Usuario = Recursos.Usuario; + val.DataHora = networkTime; + val.Descricao = $"O USUÁRIO {Recursos.Usuario.Nome} EXCLUIU, EM {networkTime}, A META DE" + $"ID: '{((DomainBase)meta).Id}'" + ", MÊS: '" + ValidationHelper.GetDescription((Enum)(object)meta.Mes) + "'" + $", ANO: '{meta.Ano}'" + $", VALOR: 'R${meta.Valor}'."; + val.EntidadeId = ((DomainBase)meta).Id; + val.Tela = (TipoTela)31; + val.Versao = LoginViewModel.VersaoAtual; + val.NomeMaquina = Environment.MachineName; + val.UsuarioMaquina = Environment.UserName; + val.Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString(); + RegistroLog keyValues = val; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)223, tries, meta); + } + } + return false; + }); + } + + public async Task> BuscarMetasSeguradoras(Filtros filtro) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.MetaSeguradoraRepository.FindByMeta(filtro); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)284, tries, filtro); + } + } + return new List(); + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Ferramentas/MetaVendedorServico.cs b/Decompiler/Gestor.Application.Servicos.Ferramentas/MetaVendedorServico.cs new file mode 100644 index 0000000..f5aac7b --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Ferramentas/MetaVendedorServico.cs @@ -0,0 +1,169 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Sockets; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels; +using Gestor.Common.Validation; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Relatorios; +using Gestor.Model.Domain.Seguros; +using Newtonsoft.Json; + +namespace Gestor.Application.Servicos.Ferramentas; + +internal class MetaVendedorServico : BaseServico +{ + public async Task Save(MetaVendedor metaVendedor) + { + int tries = 3; + base.Sucesso = true; + MetaVendedor metaVendedorOriginal = metaVendedor; + return await Task.Run((Func)delegate + { + //IL_0028: Unknown result type (might be due to invalid IL or missing references) + //IL_006b: Unknown result type (might be due to invalid IL or missing references) + //IL_0070: Unknown result type (might be due to invalid IL or missing references) + //IL_0071: Unknown result type (might be due to invalid IL or missing references) + //IL_0077: Unknown result type (might be due to invalid IL or missing references) + //IL_0082: Unknown result type (might be due to invalid IL or missing references) + //IL_008d: Unknown result type (might be due to invalid IL or missing references) + //IL_0094: Unknown result type (might be due to invalid IL or missing references) + //IL_0099: Unknown result type (might be due to invalid IL or missing references) + //IL_00a5: Expected O, but got Unknown + //IL_00aa: Unknown result type (might be due to invalid IL or missing references) + //IL_00bb: Unknown result type (might be due to invalid IL or missing references) + //IL_00c3: Unknown result type (might be due to invalid IL or missing references) + //IL_00ce: Unknown result type (might be due to invalid IL or missing references) + //IL_00d9: Unknown result type (might be due to invalid IL or missing references) + //IL_00e4: Unknown result type (might be due to invalid IL or missing references) + //IL_0121: Expected O, but got Unknown + while (tries > 0) + { + metaVendedor = metaVendedorOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + TipoAcao acao = (TipoAcao)(((DomainBase)metaVendedor).Id != 0L); + metaVendedor = ((((DomainBase)metaVendedor).Id == 0L) ? commited.MetaVendedorRepository.SaveOrUpdate(metaVendedor) : commited.MetaVendedorRepository.Merge(metaVendedor)); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog keyValues = new RegistroLog + { + Acao = acao, + Usuario = Recursos.Usuario, + DataHora = Funcoes.GetNetworkTime(), + Descricao = JsonConvert.SerializeObject((object)metaVendedor, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)metaVendedor).Id, + Tela = (TipoTela)30, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return metaVendedor; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)224, tries, metaVendedor); + } + } + return metaVendedorOriginal; + }); + } + + public async Task Delete(MetaVendedor meta) + { + int tries = 3; + return await Task.Run(delegate + { + //IL_0033: Unknown result type (might be due to invalid IL or missing references) + //IL_003a: Expected O, but got Unknown + //IL_00a8: Unknown result type (might be due to invalid IL or missing references) + while (tries > 0) + { + try + { + UnitOfWork commited = Instancia.Commited; + try + { + commited.MetaVendedorRepository.Delete(((DomainBase)meta).Id); + DateTime networkTime = Funcoes.GetNetworkTime(); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog val = new RegistroLog(); + val.Acao = (TipoAcao)2; + val.Usuario = Recursos.Usuario; + val.DataHora = networkTime; + val.Descricao = $"O USUÁRIO {Recursos.Usuario.Nome} EXCLUIU, EM {networkTime}, A META DE" + $"ID: '{((DomainBase)meta).Id}'" + ", MÊS: '" + ValidationHelper.GetDescription((Enum)(object)meta.Mes) + "'" + $", ANO: '{meta.Ano}'" + $", VALOR: 'R${meta.Valor}'."; + val.EntidadeId = ((DomainBase)meta).Id; + val.Tela = (TipoTela)30; + val.Versao = LoginViewModel.VersaoAtual; + val.NomeMaquina = Environment.MachineName; + val.UsuarioMaquina = Environment.UserName; + val.Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString(); + RegistroLog keyValues = val; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)225, tries, meta); + } + } + return false; + }); + } + + public async Task> BuscarMetasVendedores(Filtros filtro) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.MetaVendedorRepository.FindByMeta(filtro); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)285, tries, filtro); + } + } + return new List(); + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Ferramentas/NotaFiscalServico.cs b/Decompiler/Gestor.Application.Servicos.Ferramentas/NotaFiscalServico.cs new file mode 100644 index 0000000..eede45d --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Ferramentas/NotaFiscalServico.cs @@ -0,0 +1,179 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Relatorios; + +namespace Gestor.Application.Servicos.Ferramentas; + +internal class NotaFiscalServico : BaseServico +{ + internal async Task> BuscarNotasFiscais() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.NotaFiscalRepository.FindAll(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)312, tries); + } + } + return new List(); + }); + } + + internal async Task Save(NotaFiscal notaFiscal) + { + int tries = 3; + base.Sucesso = true; + NotaFiscal notaFiscalOriginal = notaFiscal; + return await Task.Run((Func)delegate + { + while (tries > 0) + { + List list = new List(); + notaFiscal = notaFiscalOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + bool num = ((DomainBase)notaFiscal).Id != 0L; + if (num) + { + list.Add(CreateLog(((DomainBase)notaFiscal).Id, notaFiscal, (TipoTela)55)); + } + notaFiscal = ((((DomainBase)notaFiscal).Id == 0L) ? commited.NotaFiscalRepository.SaveOrUpdate(notaFiscal) : commited.NotaFiscalRepository.Merge(notaFiscal)); + if (!num) + { + list.Add(CreateLog(((DomainBase)notaFiscal).Id, ((DomainBase)notaFiscal).GetValorOriginal(), (TipoTela)55, (TipoAcao)0)); + } + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return notaFiscal; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)313, tries, notaFiscal); + } + } + return notaFiscalOriginal; + }); + } + + public async Task Delete(NotaFiscal notaFiscal) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + List list = new List(); + try + { + UnitOfWork commited = Instancia.Commited; + try + { + list.Add(CreateLog(((DomainBase)notaFiscal).Id, ((DomainBase)notaFiscal).GetValorOriginal(), (TipoTela)55, (TipoAcao)2)); + commited.NotaFiscalRepository.Delete(((DomainBase)notaFiscal).Id); + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)314, tries, notaFiscal); + } + } + return false; + }); + } + + internal async Task Cadatrada(long idExtrato) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.NotaFiscalRepository.FindByExtrato(idExtrato); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)315, tries, idExtrato); + } + } + return false; + }); + } + + public async Task> BuscarNotasFiscais(Filtros filtro) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.NotaFiscalRepository.FindByDatas(filtro); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)315, tries, filtro); + } + } + return new List(); + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Ferramentas/ProdutoServico.cs b/Decompiler/Gestor.Application.Servicos.Ferramentas/ProdutoServico.cs new file mode 100644 index 0000000..4289f60 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Ferramentas/ProdutoServico.cs @@ -0,0 +1,91 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Servicos.Ferramentas; + +internal class ProdutoServico : BaseServico +{ + internal async Task BuscarProdutoPorId(long id) + { + int tries = 3; + return await Task.Run((Func)delegate + { + //IL_0059: Unknown result type (might be due to invalid IL or missing references) + //IL_005f: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ProdutoRepository.FindById(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)116, tries, id); + } + } + return new Produto(); + }); + } + + public async Task Save(Produto produto) + { + int tries = 3; + base.Sucesso = true; + Produto produtoOriginal = produto; + return await Task.Run((Func)delegate + { + while (tries > 0) + { + List list = new List(); + produto = produtoOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + bool num = ((DomainBase)produto).Id != 0L; + if (num) + { + list.Add(CreateLog(((DomainBase)produto).Id, produto, (TipoTela)10)); + } + produto = ((((DomainBase)produto).Id == 0L) ? commited.ProdutoRepository.SaveOrUpdate(produto) : commited.ProdutoRepository.Merge(produto)); + if (!num) + { + list.Add(CreateLog(((DomainBase)produto).Id, ((DomainBase)produto).GetValorOriginal(), (TipoTela)10, (TipoAcao)0)); + } + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return produto; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)226, tries, produto); + } + } + return produtoOriginal; + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Ferramentas/QualificacaoServico.cs b/Decompiler/Gestor.Application.Servicos.Ferramentas/QualificacaoServico.cs new file mode 100644 index 0000000..c3e5138 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Ferramentas/QualificacaoServico.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Servicos.Ferramentas; + +internal class QualificacaoServico : BaseServico +{ + internal async Task Save(Qualificacao qualificacao) + { + int tries = 3; + base.Sucesso = true; + Qualificacao qualificacaoOriginal = qualificacao; + return await Task.Run((Func)delegate + { + while (tries > 0) + { + List list = new List(); + qualificacao = qualificacaoOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + list.Add(CreateLog(((DomainBase)qualificacao).Id, qualificacao, (TipoTela)48)); + Qualificacao result = commited.QualificacaoRepository.SaveOrUpdate(qualificacao); + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return result; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)229, tries, qualificacao); + } + } + return qualificacaoOriginal; + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Ferramentas/RamoServico.cs b/Decompiler/Gestor.Application.Servicos.Ferramentas/RamoServico.cs new file mode 100644 index 0000000..fc0dbe7 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Ferramentas/RamoServico.cs @@ -0,0 +1,191 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Sockets; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Newtonsoft.Json; + +namespace Gestor.Application.Servicos.Ferramentas; + +internal class RamoServico : BaseServico +{ + internal async Task Save(Ramo ramo, List coberturas) + { + int tries = 3; + base.Sucesso = true; + DateTime now = Funcoes.GetNetworkTime(); + Ramo ramoOriginal = ramo; + return await Task.Run((Func)delegate + { + //IL_0060: Unknown result type (might be due to invalid IL or missing references) + //IL_0065: Unknown result type (might be due to invalid IL or missing references) + //IL_006c: Unknown result type (might be due to invalid IL or missing references) + //IL_0077: Unknown result type (might be due to invalid IL or missing references) + //IL_0083: Unknown result type (might be due to invalid IL or missing references) + //IL_008a: Unknown result type (might be due to invalid IL or missing references) + //IL_008f: Unknown result type (might be due to invalid IL or missing references) + //IL_009b: Expected O, but got Unknown + //IL_00a0: Unknown result type (might be due to invalid IL or missing references) + //IL_00b1: Unknown result type (might be due to invalid IL or missing references) + //IL_00b9: Unknown result type (might be due to invalid IL or missing references) + //IL_00c4: Unknown result type (might be due to invalid IL or missing references) + //IL_00cf: Unknown result type (might be due to invalid IL or missing references) + //IL_00da: Unknown result type (might be due to invalid IL or missing references) + //IL_0117: Expected O, but got Unknown + while (tries > 0) + { + ramo = ramoOriginal; + try + { + UnitOfWork unitOfWork = Instancia.Commited; + try + { + Ramo result = unitOfWork.RamoRepository.SaveOrUpdate(ramo); + coberturas?.ForEach(delegate(CoberturaPadrao x) + { + unitOfWork.CoberturaPadraoRepository.Merge(x); + }); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog keyValues = new RegistroLog + { + Acao = (TipoAcao)1, + Usuario = Recursos.Usuario, + DataHora = now, + Descricao = JsonConvert.SerializeObject((object)ramo, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)ramo).Id, + Tela = (TipoTela)12, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, unitOfWork); + ((GenericUnitOfWork)unitOfWork).Commit(); + return result; + } + finally + { + if (unitOfWork != null) + { + ((IDisposable)unitOfWork).Dispose(); + } + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)228, tries, new { ramo, coberturas }); + } + } + return ramoOriginal; + }); + } + + public async Task> BuscarRamos() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork commited = Instancia.Commited; + try + { + return commited.RamoRepository.Find(); + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)169, tries); + } + } + return (List)null; + }); + } + + public async Task Insert(Ramo ramo) + { + int tries = 3; + base.Sucesso = true; + DateTime now = Funcoes.GetNetworkTime(); + Ramo ramoOriginal = ramo; + return await Task.Run((Func)delegate + { + //IL_0039: Unknown result type (might be due to invalid IL or missing references) + //IL_003e: Unknown result type (might be due to invalid IL or missing references) + //IL_0045: Unknown result type (might be due to invalid IL or missing references) + //IL_0050: Unknown result type (might be due to invalid IL or missing references) + //IL_005c: Unknown result type (might be due to invalid IL or missing references) + //IL_0063: Unknown result type (might be due to invalid IL or missing references) + //IL_0068: Unknown result type (might be due to invalid IL or missing references) + //IL_0074: Expected O, but got Unknown + //IL_0079: Unknown result type (might be due to invalid IL or missing references) + //IL_008a: Unknown result type (might be due to invalid IL or missing references) + //IL_0092: Unknown result type (might be due to invalid IL or missing references) + //IL_009d: Unknown result type (might be due to invalid IL or missing references) + //IL_00a8: Unknown result type (might be due to invalid IL or missing references) + //IL_00b3: Unknown result type (might be due to invalid IL or missing references) + //IL_00f0: Expected O, but got Unknown + while (tries > 0) + { + ramo = ramoOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + ramo = commited.RamoRepository.SaveOrUpdate(ramo); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog keyValues = new RegistroLog + { + Acao = (TipoAcao)0, + Usuario = Recursos.Usuario, + DataHora = now, + Descricao = JsonConvert.SerializeObject((object)ramo, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)ramo).Id, + Tela = (TipoTela)12, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return ramo; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)230, tries, ramo); + } + } + return ramoOriginal; + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Ferramentas/ReciboServico.cs b/Decompiler/Gestor.Application.Servicos.Ferramentas/ReciboServico.cs new file mode 100644 index 0000000..4fb8220 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Ferramentas/ReciboServico.cs @@ -0,0 +1,122 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; + +namespace Gestor.Application.Servicos.Ferramentas; + +internal class ReciboServico : BaseServico +{ + internal async Task> BuscarRecibos() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ReciboRepository.BuscarRecibos(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)123, tries); + } + } + return new List(); + }); + } + + public async Task Save(Recibo recibo) + { + int tries = 3; + base.Sucesso = true; + Recibo reciboOriginal = recibo; + return await Task.Run((Func)delegate + { + while (tries > 0) + { + List list = new List(); + recibo = reciboOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + bool num = ((DomainBase)recibo).Id != 0L; + if (num) + { + list.Add(CreateLog(((DomainBase)recibo).Id, recibo, (TipoTela)42)); + } + recibo = ((((DomainBase)recibo).Id == 0L) ? commited.ReciboRepository.SaveOrUpdate(recibo) : commited.ReciboRepository.Merge(recibo)); + if (!num) + { + list.Add(CreateLog(((DomainBase)recibo).Id, ((DomainBase)recibo).GetValorOriginal(), (TipoTela)42, (TipoAcao)0)); + } + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return recibo; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)231, tries, recibo); + } + } + return reciboOriginal; + }); + } + + public async Task Delete(Recibo recibo) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + List list = new List(); + try + { + UnitOfWork commited = Instancia.Commited; + try + { + list.Add(CreateLog(((DomainBase)recibo).Id, ((DomainBase)recibo).GetValorOriginal(), (TipoTela)42, (TipoAcao)2)); + commited.ReciboRepository.Delete(((DomainBase)recibo).Id); + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)232, tries, recibo); + } + } + return false; + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Ferramentas/SeguradoraServico.cs b/Decompiler/Gestor.Application.Servicos.Ferramentas/SeguradoraServico.cs new file mode 100644 index 0000000..c8de222 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Ferramentas/SeguradoraServico.cs @@ -0,0 +1,374 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net; +using System.Net.Sockets; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Newtonsoft.Json; + +namespace Gestor.Application.Servicos.Ferramentas; + +internal class SeguradoraServico : BaseServico +{ + public async Task Save(Seguradora seguradora, List config, bool primeiroAcesso = false) + { + int tries = 3; + base.Sucesso = true; + DateTime now = Funcoes.GetNetworkTime(); + Seguradora seguradoraOriginal = seguradora; + return await Task.Run((Func)delegate + { + //IL_0033: Unknown result type (might be due to invalid IL or missing references) + //IL_0127: Unknown result type (might be due to invalid IL or missing references) + //IL_012c: Unknown result type (might be due to invalid IL or missing references) + //IL_012d: Unknown result type (might be due to invalid IL or missing references) + //IL_0133: Unknown result type (might be due to invalid IL or missing references) + //IL_013e: Unknown result type (might be due to invalid IL or missing references) + //IL_014a: Unknown result type (might be due to invalid IL or missing references) + //IL_0151: Unknown result type (might be due to invalid IL or missing references) + //IL_0156: Unknown result type (might be due to invalid IL or missing references) + //IL_0162: Expected O, but got Unknown + //IL_0167: Unknown result type (might be due to invalid IL or missing references) + //IL_0178: Unknown result type (might be due to invalid IL or missing references) + //IL_0180: Unknown result type (might be due to invalid IL or missing references) + //IL_018b: Unknown result type (might be due to invalid IL or missing references) + //IL_0196: Unknown result type (might be due to invalid IL or missing references) + //IL_01a1: Unknown result type (might be due to invalid IL or missing references) + //IL_01e0: Expected O, but got Unknown + while (tries > 0) + { + seguradora = seguradoraOriginal; + try + { + UnitOfWork unitOfWork = Instancia.Commited; + try + { + TipoAcao acao = (TipoAcao)(((DomainBase)seguradora).Id != 0L); + List list = seguradora.Contatos; + if (list != null) + { + list.ForEach(delegate(SeguradoraContato x) + { + x.Seguradora = seguradora; + }); + list = unitOfWork.SeguradoraContatoRepository.Merge(list, seguradora, ((DomainBase)Recursos.Empresa).Id); + } + List list2 = seguradora.Enderecos; + if (list != null) + { + list2 = unitOfWork.SeguradoraEnderecoRepository.Merge(list2, seguradora, ((DomainBase)Recursos.Empresa).Id); + } + if (list != null || primeiroAcesso) + { + seguradora = unitOfWork.SeguradoraRepository.Merge(seguradora); + } + seguradora.Contatos = list; + seguradora.Enderecos = list2; + config?.ForEach(delegate(ConfigExtratoImport x) + { + unitOfWork.ConfigExtratoImportRepository.Merge(x); + }); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog keyValues = new RegistroLog + { + Acao = acao, + Usuario = Recursos.Usuario, + DataHora = now, + Descricao = JsonConvert.SerializeObject((object)seguradora, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)seguradora).Id, + Tela = (TipoTela)13, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, unitOfWork); + ((GenericUnitOfWork)unitOfWork).Commit(); + return seguradora; + } + finally + { + if (unitOfWork != null) + { + ((IDisposable)unitOfWork).Dispose(); + } + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)233, tries, new { seguradora, config }); + } + } + return seguradoraOriginal; + }); + } + + public async Task Insert(Seguradora seguradora) + { + int tries = 3; + base.Sucesso = true; + DateTime now = Funcoes.GetNetworkTime(); + Seguradora seguradoraOriginal = seguradora; + return await Task.Run((Func)delegate + { + //IL_0039: Unknown result type (might be due to invalid IL or missing references) + //IL_003e: Unknown result type (might be due to invalid IL or missing references) + //IL_0045: Unknown result type (might be due to invalid IL or missing references) + //IL_0050: Unknown result type (might be due to invalid IL or missing references) + //IL_005c: Unknown result type (might be due to invalid IL or missing references) + //IL_0063: Unknown result type (might be due to invalid IL or missing references) + //IL_0068: Unknown result type (might be due to invalid IL or missing references) + //IL_0074: Expected O, but got Unknown + //IL_0079: Unknown result type (might be due to invalid IL or missing references) + //IL_008a: Unknown result type (might be due to invalid IL or missing references) + //IL_0092: Unknown result type (might be due to invalid IL or missing references) + //IL_009d: Unknown result type (might be due to invalid IL or missing references) + //IL_00a8: Unknown result type (might be due to invalid IL or missing references) + //IL_00b3: Unknown result type (might be due to invalid IL or missing references) + //IL_00f0: Expected O, but got Unknown + while (tries > 0) + { + seguradora = seguradoraOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + seguradora = commited.SeguradoraRepository.SaveOrUpdate(seguradora); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog keyValues = new RegistroLog + { + Acao = (TipoAcao)0, + Usuario = Recursos.Usuario, + DataHora = now, + Descricao = JsonConvert.SerializeObject((object)seguradora, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)seguradora).Id, + Tela = (TipoTela)13, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return seguradora; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)234, tries, seguradora); + } + } + return seguradoraOriginal; + }); + } + + internal async Task> BuscarConfig(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return (from x in read.ConfigExtratoImportRepository.FindBySeguradora(id) + orderby x.Descricao + select x).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)124, tries, id); + } + } + return new List(); + }); + } + + public async Task> BuscarContatos(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new ObservableCollection(from x in read.SeguradoraContatoRepository.FindBySeguradora(((DomainBase)Recursos.Empresa).Id, id) + orderby x.NomeContato + select x); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)125, tries, new + { + ((DomainBase)Recursos.Empresa).Id, + id + }); + } + } + return new ObservableCollection(); + }); + } + + public async Task> BuscarEnderecos(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new ObservableCollection(from x in read.SeguradoraEnderecoRepository.FindBySeguradora(((DomainBase)Recursos.Empresa).Id, id) + orderby ((DomainBase)x).Id + select x); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)126, tries, new + { + ((DomainBase)Recursos.Empresa).Id, + id + }); + } + } + return new ObservableCollection(); + }); + } + + public async Task> BuscarAssistencias(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.SeguradoraContatoRepository.FindAssistencia(((DomainBase)Recursos.Empresa).Id, id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)125, tries, new + { + ((DomainBase)Recursos.Empresa).Id, + id + }); + } + } + return new List(); + }); + } + + public async Task> BuscarSeguradoras() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.SeguradoraRepository.Find(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)127, tries); + } + } + return new List(); + }); + } + + public async Task BuscarSeguradora(long id) + { + int tries = 3; + return await Task.Run((Func)delegate + { + //IL_0052: Unknown result type (might be due to invalid IL or missing references) + //IL_0058: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.SeguradoraRepository.FindById(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)128, tries); + } + } + return new Seguradora(); + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Ferramentas/SocioServico.cs b/Decompiler/Gestor.Application.Servicos.Ferramentas/SocioServico.cs new file mode 100644 index 0000000..1b3a52c --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Ferramentas/SocioServico.cs @@ -0,0 +1,94 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; + +namespace Gestor.Application.Servicos.Ferramentas; + +internal class SocioServico : BaseServico +{ + public async Task Save(Socio socio) + { + int tries = 3; + base.Sucesso = true; + Socio socioOriginal = socio; + return await Task.Run((Func)delegate + { + List list = new List(); + socio = socioOriginal; + while (tries > 0) + { + socio = socioOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + bool num = ((DomainBase)socio).Id != 0L; + if (num) + { + list.Add(CreateLog(((DomainBase)socio).Id, socio, (TipoTela)19)); + } + socio = ((((DomainBase)socio).Id == 0L) ? commited.SocioRepository.SaveOrUpdate(socio) : commited.SocioRepository.Merge(socio)); + if (!num) + { + list.Add(CreateLog(((DomainBase)socio).Id, ((DomainBase)socio).GetValorOriginal(), (TipoTela)19, (TipoAcao)0)); + } + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return socio; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)235, tries, socio); + } + } + return socioOriginal; + }); + } + + public async Task Delete(Socio socio) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + List list = new List(); + try + { + UnitOfWork commited = Instancia.Commited; + try + { + list.Add(CreateLog(((DomainBase)socio).Id, ((DomainBase)socio).GetValorOriginal(), (TipoTela)19, (TipoAcao)2)); + commited.SocioRepository.Delete(((DomainBase)socio).Id); + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)236, tries, socio); + } + } + return false; + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Ferramentas/StatusProspeccaoServico.cs b/Decompiler/Gestor.Application.Servicos.Ferramentas/StatusProspeccaoServico.cs new file mode 100644 index 0000000..0801f13 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Ferramentas/StatusProspeccaoServico.cs @@ -0,0 +1,90 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; + +namespace Gestor.Application.Servicos.Ferramentas; + +internal class StatusProspeccaoServico : BaseServico +{ + internal async Task> BuscarProspeccoes() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.StatusProspeccaoRepository.FindAll(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)308, tries); + } + } + return new List(); + }); + } + + internal async Task Save(StatusDeProspeccao statusProspeccao) + { + int tries = 3; + base.Sucesso = true; + StatusDeProspeccao statusProspeccaoOriginal = statusProspeccao; + return await Task.Run((Func)delegate + { + List list = new List(); + statusProspeccao = statusProspeccaoOriginal; + while (tries > 0) + { + statusProspeccao = statusProspeccaoOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + bool num = ((DomainBase)statusProspeccao).Id != 0L; + if (num) + { + list.Add(CreateLog(((DomainBase)statusProspeccao).Id, statusProspeccao, (TipoTela)57)); + } + statusProspeccao = ((((DomainBase)statusProspeccao).Id == 0L) ? commited.StatusProspeccaoRepository.SaveOrUpdate(statusProspeccao) : commited.StatusProspeccaoRepository.Merge(statusProspeccao)); + if (!num) + { + list.Add(CreateLog(((DomainBase)statusProspeccao).Id, ((DomainBase)statusProspeccao).GetValorOriginal(), (TipoTela)57, (TipoAcao)0)); + } + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return statusProspeccao; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)307, tries, statusProspeccao); + } + } + return statusProspeccaoOriginal; + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Ferramentas/StatusServico.cs b/Decompiler/Gestor.Application.Servicos.Ferramentas/StatusServico.cs new file mode 100644 index 0000000..b7a6068 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Ferramentas/StatusServico.cs @@ -0,0 +1,125 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Servicos.Ferramentas; + +internal class StatusServico : BaseServico +{ + internal async Task BuscarStatusPorId(long id) + { + int tries = 3; + return await Task.Run((Func)delegate + { + //IL_0059: Unknown result type (might be due to invalid IL or missing references) + //IL_005f: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.StatusRepository.FindById(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)119, tries, id); + } + } + return new Status(); + }); + } + + public async Task Save(Status status) + { + int tries = 3; + base.Sucesso = true; + Status statusOriginal = status; + return await Task.Run((Func)delegate + { + List list = new List(); + status = statusOriginal; + while (tries > 0) + { + status = statusOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + bool num = ((DomainBase)status).Id != 0L; + if (num) + { + list.Add(CreateLog(((DomainBase)status).Id, status, (TipoTela)11)); + } + status = ((((DomainBase)status).Id == 0L) ? commited.StatusRepository.SaveOrUpdate(status) : commited.StatusRepository.Merge(status)); + if (!num) + { + list.Add(CreateLog(((DomainBase)status).Id, ((DomainBase)status).GetValorOriginal(), (TipoTela)11, (TipoAcao)0)); + } + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return status; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)227, tries, status); + } + } + return statusOriginal; + }); + } + + public async Task Delete(Status status) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + List list = new List(); + try + { + UnitOfWork commited = Instancia.Commited; + try + { + list.Add(CreateLog(((DomainBase)status).Id, ((DomainBase)status).GetValorOriginal(), (TipoTela)11, (TipoAcao)2)); + commited.StatusRepository.Delete(((DomainBase)status).Id); + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)221, tries, status); + } + } + return false; + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Ferramentas/TipoTarefaServico.cs b/Decompiler/Gestor.Application.Servicos.Ferramentas/TipoTarefaServico.cs new file mode 100644 index 0000000..9c49d4a --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Ferramentas/TipoTarefaServico.cs @@ -0,0 +1,90 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; + +namespace Gestor.Application.Servicos.Ferramentas; + +internal class TipoTarefaServico : BaseServico +{ + internal async Task> BuscarTarefas() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.TipoTarefaRepository.FindAll(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)308, tries); + } + } + return new List(); + }); + } + + internal async Task Save(TipoDeTarefa tipoTarefa) + { + int tries = 3; + base.Sucesso = true; + TipoDeTarefa tipoTarefaOriginal = tipoTarefa; + return await Task.Run((Func)delegate + { + List list = new List(); + tipoTarefa = tipoTarefaOriginal; + while (tries > 0) + { + tipoTarefa = tipoTarefaOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + bool num = ((DomainBase)tipoTarefa).Id != 0L; + if (num) + { + list.Add(CreateLog(((DomainBase)tipoTarefa).Id, tipoTarefa, (TipoTela)52)); + } + tipoTarefa = ((((DomainBase)tipoTarefa).Id == 0L) ? commited.TipoTarefaRepository.SaveOrUpdate(tipoTarefa) : commited.TipoTarefaRepository.Merge(tipoTarefa)); + if (!num) + { + list.Add(CreateLog(((DomainBase)tipoTarefa).Id, ((DomainBase)tipoTarefa).GetValorOriginal(), (TipoTela)52, (TipoAcao)0)); + } + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return tipoTarefa; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)306, tries, tipoTarefa); + } + } + return tipoTarefaOriginal; + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Ferramentas/TipoVendedorServico.cs b/Decompiler/Gestor.Application.Servicos.Ferramentas/TipoVendedorServico.cs new file mode 100644 index 0000000..76349c2 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Ferramentas/TipoVendedorServico.cs @@ -0,0 +1,131 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Servicos.Ferramentas; + +internal class TipoVendedorServico : BaseServico +{ + internal async Task Save(TipoVendedor tipoVendedor) + { + int tries = 3; + base.Sucesso = true; + TipoVendedor tipoVendedorOriginal = tipoVendedor; + return await Task.Run(async delegate + { + while (tries > 0) + { + List logs = new List(); + tipoVendedor = tipoVendedorOriginal; + try + { + UnitOfWork unitOfWork = Instancia.Commited; + try + { + TipoAcao acao = (TipoAcao)(((DomainBase)tipoVendedor).Id != 0L); + if (((DomainBase)tipoVendedor).Id == 0L) + { + TipoVendedor val = tipoVendedor; + ((DomainBase)val).Id = await FindLastId() + 1; + } + TipoAcao val2 = acao; + if ((int)val2 != 0) + { + if ((int)val2 == 1) + { + logs.Add(CreateLog(((DomainBase)tipoVendedor).Id, tipoVendedor, (TipoTela)14)); + } + } + else + { + logs.Add(CreateLog(((DomainBase)tipoVendedor).Id, ((DomainBase)tipoVendedor).GetValorOriginal(), (TipoTela)14, (TipoAcao)0)); + } + tipoVendedor = (((int)acao == 0) ? unitOfWork.TipoVendedorRepository.SaveOrUpdate(tipoVendedor) : unitOfWork.TipoVendedorRepository.Merge(tipoVendedor)); + SaveLog(logs, unitOfWork); + ((GenericUnitOfWork)unitOfWork).Commit(); + return tipoVendedor; + } + finally + { + ((IDisposable)unitOfWork)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)237, tries, tipoVendedor); + } + } + return tipoVendedorOriginal; + }); + } + + public async Task Delete(TipoVendedor tipoVendedor) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + List list = new List(); + try + { + UnitOfWork commited = Instancia.Commited; + try + { + list.Add(CreateLog(((DomainBase)tipoVendedor).Id, ((DomainBase)tipoVendedor).GetValorOriginal(), (TipoTela)14, (TipoAcao)2)); + commited.TipoVendedorRepository.Delete(((DomainBase)tipoVendedor).Id); + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)238, tries, tipoVendedor); + } + } + return false; + }); + } + + public async Task FindLastId() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.TipoVendedorRepository.FindLastId(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)17, tries); + } + } + return 0L; + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Ferramentas/UsuarioServico.cs b/Decompiler/Gestor.Application.Servicos.Ferramentas/UsuarioServico.cs new file mode 100644 index 0000000..1ee95e1 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Ferramentas/UsuarioServico.cs @@ -0,0 +1,317 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Common.Security; +using Gestor.Common.Validation; +using Gestor.Infrastructure.Mappers; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Servicos.Ferramentas; + +internal class UsuarioServico : BaseServico +{ + internal async Task BuscarUsuarioPorId(long id) + { + int tries = 3; + return await Task.Run((Func)delegate + { + //IL_005c: Unknown result type (might be due to invalid IL or missing references) + //IL_0062: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.UsuarioRepository.FindById(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)130, tries, id); + } + } + return new Usuario(); + }); + } + + public async Task Save(Usuario usuario) + { + int tries = 3; + base.Sucesso = true; + Usuario usuarioOriginal = usuario; + return await Task.Run((Func)delegate + { + //IL_007d: Unknown result type (might be due to invalid IL or missing references) + List list = new List(); + while (tries > 0) + { + usuario = usuarioOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + Usuario usuario2 = Recursos.Usuario; + string text = ((usuario2 != null) ? usuario2.TokenSso : null); + Empresa empresa = Recursos.Empresa; + string documentoEmpresa = ((empresa != null) ? empresa.Documento : null); + if (ValidationHelper.IsNullOrEmpty(text)) + { + Empresa val = commited.EmpresaRepository.FindBySerial(ApplicationHelper.NumeroSerial); + string password = usuario.Senha; + if (ValidationHelper.IsNotNullOrEmpty(usuario.SenhaAnterior)) + { + if (new Token().AggerDecrypt(usuario.SenhaAnterior).ToUpper().Contains("AGGER@")) + { + Usuario result = BuscarLogin(usuario.Login).Result; + usuario.SenhaAnterior = result.Senha; + } + password = usuario.SenhaAnterior; + } + AuthSso result2 = BuscaUsuarioSso(usuario.Login, password, val.Documento).Result; + if (result2 == null || result2.Code == 401) + { + base.Sucesso = false; + return usuarioOriginal; + } + text = result2.Data.Token; + documentoEmpresa = val.Documento; + } + Usuario obj = usuario; + long? permissaoAggilizador2; + if (usuario.PermissaoAggilizador.HasValue) + { + long? num = (usuario.PermissaoAggilizador = usuario.PermissaoAggilizador); + permissaoAggilizador2 = num; + } + else + { + long? num = (usuario.PermissaoAggilizador = 2L); + permissaoAggilizador2 = num; + } + obj.PermissaoAggilizador = permissaoAggilizador2; + bool num3 = ((DomainBase)usuario).Id != 0L; + if (num3) + { + list.Add(CreateLog(((DomainBase)usuario).Id, usuario, (TipoTela)16)); + } + usuario = ((((DomainBase)usuario).Id == 0L) ? commited.UsuarioRepository.SaveOrUpdate(usuario) : commited.UsuarioRepository.Merge(usuario)); + if (!num3) + { + list.Add(CreateLog(((DomainBase)usuario).Id, ((DomainBase)usuario).GetValorOriginal(), (TipoTela)16, (TipoAcao)0)); + } + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + usuario.TokenSso = text; + AddOrUpdateUsuarioSso(usuario, documentoEmpresa, usuario.SsoId).Wait(); + return usuario; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)239, tries, usuario); + } + } + return usuarioOriginal; + }); + } + + public async Task Delete(Usuario usuario) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + List list = new List(); + try + { + UnitOfWork commited = Instancia.Commited; + try + { + list.Add(CreateLog(((DomainBase)usuario).Id, ((DomainBase)usuario).GetValorOriginal(), (TipoTela)16, (TipoAcao)2)); + commited.UsuarioRepository.Delete(((DomainBase)usuario).Id); + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + usuario.TokenSso = Recursos.Usuario.TokenSso; + DeleteUsuarioSso(usuario, Recursos.Empresa.Documento).Wait(); + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)240, tries, usuario); + } + } + return false; + }); + } + + public async Task> BuscarPermissaoAggilizador() + { + return await Task.Run(delegate + { + //IL_0025: Unknown result type (might be due to invalid IL or missing references) + //IL_002a: Unknown result type (might be due to invalid IL or missing references) + //IL_0032: Unknown result type (might be due to invalid IL or missing references) + //IL_0042: Expected O, but got Unknown + //IL_0043: Unknown result type (might be due to invalid IL or missing references) + //IL_0048: Unknown result type (might be due to invalid IL or missing references) + //IL_0050: Unknown result type (might be due to invalid IL or missing references) + //IL_0060: Expected O, but got Unknown + //IL_0061: Unknown result type (might be due to invalid IL or missing references) + //IL_0066: Unknown result type (might be due to invalid IL or missing references) + //IL_006e: Unknown result type (might be due to invalid IL or missing references) + //IL_007e: Expected O, but got Unknown + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.UsuarioRepository.PermissaoAggilizador(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception) + { + return new List + { + new PermissaoAggilizador + { + Id = 1L, + Descricao = "ADMINISTRADOR" + }, + new PermissaoAggilizador + { + Id = 2L, + Descricao = "NORMAL" + }, + new PermissaoAggilizador + { + Id = 3L, + Descricao = "LIMITADO" + } + }; + } + }); + } + + public async Task BuscarLogin(string login) + { + int tries = 3; + return await Task.Run((Func)delegate + { + //IL_00c9: Unknown result type (might be due to invalid IL or missing references) + //IL_00cf: Expected O, but got Unknown + //IL_004a: Unknown result type (might be due to invalid IL or missing references) + //IL_0051: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + Empresa val = read.EmpresaRepository.FindBySerial(ApplicationHelper.NumeroSerial); + AuthSso result = VerificaUsuarioSso(login, val.Documento).Result; + if (result == null || result.Code == 401) + { + return new Usuario(); + } + Usuario val2 = read.UsuarioRepository.FindUsuario(login); + return (result.Code == 404) ? val2 : CustomMap.FromUserSso(val2, result.Data.User); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)134, tries, login); + } + } + return new Usuario(); + }); + } + + public async Task AddCentralSegurado(long id, bool update = true) + { + await Task.Run(delegate + { + UnitOfWork commited = Instancia.Commited; + try + { + commited.ClienteRepository.AddCentralSegurado(id, update); + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + }); + } + + public async Task BuscaUsuarioInicial(string usuario, string senha) + { + return await Task.Run((Func)delegate + { + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + //IL_007c: Unknown result type (might be due to invalid IL or missing references) + //IL_0083: Expected O, but got Unknown + UnitOfWork read = Instancia.Read; + try + { + Empresa val = read.EmpresaRepository.FindBySerial(ApplicationHelper.NumeroSerial); + string password = new Token().AggerEncrypt(senha); + AuthSso result = BuscaUsuarioSso(usuario, password, val.Documento).Result; + if (result.Code == 401) + { + return (Usuario)null; + } + Usuario val2 = read.UsuarioRepository.FindUsuario(usuario); + if (result.Code == 404 && val2 == null) + { + return new Usuario(); + } + if (result.Data == null && val2 != null) + { + return val2; + } + if (val2 == null && result.Data != null) + { + return CustomMap.ToUsuario(result.Data.User, ((DomainBase)val).Id); + } + return val2; + } + finally + { + ((IDisposable)read)?.Dispose(); + } + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Ferramentas/VendedorServico.cs b/Decompiler/Gestor.Application.Servicos.Ferramentas/VendedorServico.cs new file mode 100644 index 0000000..b9327fb --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Ferramentas/VendedorServico.cs @@ -0,0 +1,825 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net; +using System.Net.Sockets; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels; +using Gestor.Common.Validation; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Relatorios; +using Gestor.Model.Domain.Seguros; +using Newtonsoft.Json; + +namespace Gestor.Application.Servicos.Ferramentas; + +public class VendedorServico : BaseServico +{ + internal async Task> BuscarVendedoresAtivosAsync() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new List(from x in read.VendedorRepository.Find(true, (Recursos.Usuario.IdEmpresa == 1) ? 0 : Recursos.Usuario.IdEmpresa) + orderby x.Nome + select x); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)135, tries); + } + } + return new List(); + }); + } + + public async Task> BuscarPagos(Filtros filtro) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.VendedorParcelaRepository.FindByDate(filtro).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)80, tries); + } + } + return new List(); + }); + } + + public async Task BuscarVendedorParcelaCompleto(long id) + { + int tries = 3; + return await Task.Run((Func)delegate + { + //IL_004f: Unknown result type (might be due to invalid IL or missing references) + //IL_0055: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.VendedorParcelaRepository.FindById(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)81, tries); + } + } + return new VendedorParcela(); + }); + } + + public async Task> BuscaRepasse(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return (from x in read.VendedorParcelaRepository.FindByDocumentId(id) + orderby ((DomainBase)x.TipoVendedor).Id + select x).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)136, tries, id); + } + } + return new List(); + }); + } + + public async Task> BuscaRepasseParcela(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.VendedorParcelaRepository.FindByParcela(id).OrderBy(delegate(VendedorParcela x) + { + TipoVendedor tipoVendedor = x.TipoVendedor; + return (tipoVendedor == null) ? null : new long?(((DomainBase)tipoVendedor).Id); + }).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)137, tries, id); + } + } + return new List(); + }); + } + + internal async Task> BuscarTelefonesAsync(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new ObservableCollection(from x in read.VendedorTelefoneRepository.FindByVendedorId(id) + orderby x.Nome + select x); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)138, tries, id); + } + } + return new ObservableCollection(); + }); + } + + internal async Task BuscarVendedorPorId(long id) + { + int tries = 3; + return await Task.Run((Func)delegate + { + //IL_005c: Unknown result type (might be due to invalid IL or missing references) + //IL_0062: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.VendedorRepository.FindById(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)139, tries, id); + } + } + return new Vendedor(); + }); + } + + public async Task> BuscaRepasses() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.RepasseRepository.DefaultSelect(0L); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)142, tries); + } + } + return new List(); + }); + } + + public async Task Save(Vendedor vendedor, Repasse repasse) + { + int tries = 3; + base.Sucesso = true; + Vendedor vendedorOriginal = vendedor; + return await Task.Run((Func)delegate + { + while (tries > 0) + { + vendedor = vendedorOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + vendedor.IdEmpresa = ((vendedor.IdEmpresa == 0L) ? ((DomainBase)Recursos.Empresa).Id : vendedor.IdEmpresa); + vendedor = commited.VendedorRepository.SaveOrUpdate(vendedor); + repasse.Vendedor = vendedor; + repasse = commited.RepasseRepository.SaveOrUpdate(repasse); + ((GenericUnitOfWork)commited).Commit(); + return vendedor; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)241, tries, new { vendedor, repasse }); + } + } + return vendedorOriginal; + }); + } + + public async Task Save(VinculoRepasse vinculo) + { + int tries = 3; + base.Sucesso = true; + DateTime now = Funcoes.GetNetworkTime(); + return await Task.Run((Func)delegate + { + //IL_001e: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + //IL_0048: Unknown result type (might be due to invalid IL or missing references) + //IL_004d: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_0054: Unknown result type (might be due to invalid IL or missing references) + //IL_005f: Unknown result type (might be due to invalid IL or missing references) + //IL_006b: Unknown result type (might be due to invalid IL or missing references) + //IL_006d: Unknown result type (might be due to invalid IL or missing references) + //IL_0072: Unknown result type (might be due to invalid IL or missing references) + //IL_007e: Expected O, but got Unknown + //IL_0083: Unknown result type (might be due to invalid IL or missing references) + //IL_008f: Unknown result type (might be due to invalid IL or missing references) + //IL_0097: Unknown result type (might be due to invalid IL or missing references) + //IL_00a2: Unknown result type (might be due to invalid IL or missing references) + //IL_00ad: Unknown result type (might be due to invalid IL or missing references) + //IL_00b8: Unknown result type (might be due to invalid IL or missing references) + //IL_00f6: Expected O, but got Unknown + while (tries > 0) + { + VinculoRepasse val = vinculo; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + TipoAcao val2 = (TipoAcao)(((DomainBase)val).Id != 0L); + val = (((int)val2 == 0) ? commited.RepasseRepository.SaveOrUpdate(val) : commited.RepasseRepository.Merge(val)); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog keyValues = new RegistroLog + { + Acao = val2, + Usuario = Recursos.Usuario, + DataHora = now, + Descricao = JsonConvert.SerializeObject((object)val, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)val).Id, + Tela = (TipoTela)53, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return val; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)311, tries, vinculo); + } + } + return vinculo; + }); + } + + public async Task Delete(VinculoRepasse vinculo) + { + int tries = 3; + base.Sucesso = true; + DateTime now = Funcoes.GetNetworkTime(); + return await Task.Run(delegate + { + //IL_002d: Unknown result type (might be due to invalid IL or missing references) + //IL_0032: Unknown result type (might be due to invalid IL or missing references) + //IL_0039: Unknown result type (might be due to invalid IL or missing references) + //IL_0044: Unknown result type (might be due to invalid IL or missing references) + //IL_0050: Unknown result type (might be due to invalid IL or missing references) + //IL_0057: Unknown result type (might be due to invalid IL or missing references) + //IL_005c: Unknown result type (might be due to invalid IL or missing references) + //IL_0068: Expected O, but got Unknown + //IL_006d: Unknown result type (might be due to invalid IL or missing references) + //IL_007e: Unknown result type (might be due to invalid IL or missing references) + //IL_0086: Unknown result type (might be due to invalid IL or missing references) + //IL_0091: Unknown result type (might be due to invalid IL or missing references) + //IL_009c: Unknown result type (might be due to invalid IL or missing references) + //IL_00a7: Unknown result type (might be due to invalid IL or missing references) + //IL_00e4: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork commited = Instancia.Commited; + try + { + commited.RepasseRepository.DeleteVinculo(((DomainBase)vinculo).Id); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog keyValues = new RegistroLog + { + Acao = (TipoAcao)2, + Usuario = Recursos.Usuario, + DataHora = now, + Descricao = JsonConvert.SerializeObject((object)vinculo, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)vinculo).Id, + Tela = (TipoTela)53, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)311, tries, vinculo); + } + } + return false; + }); + } + + public async Task Save(Vendedor vendedor, List repasses) + { + int tries = 3; + base.Sucesso = true; + DateTime now = Funcoes.GetNetworkTime(); + Vendedor vendedorOriginal = vendedor; + return await Task.Run((Func)delegate + { + //IL_00c9: Unknown result type (might be due to invalid IL or missing references) + //IL_0228: Unknown result type (might be due to invalid IL or missing references) + //IL_022d: Unknown result type (might be due to invalid IL or missing references) + //IL_022e: Unknown result type (might be due to invalid IL or missing references) + //IL_0234: Unknown result type (might be due to invalid IL or missing references) + //IL_023f: Unknown result type (might be due to invalid IL or missing references) + //IL_024b: Unknown result type (might be due to invalid IL or missing references) + //IL_0252: Unknown result type (might be due to invalid IL or missing references) + //IL_0257: Unknown result type (might be due to invalid IL or missing references) + //IL_0263: Expected O, but got Unknown + //IL_0268: Unknown result type (might be due to invalid IL or missing references) + //IL_0279: Unknown result type (might be due to invalid IL or missing references) + //IL_0281: Unknown result type (might be due to invalid IL or missing references) + //IL_028c: Unknown result type (might be due to invalid IL or missing references) + //IL_0297: Unknown result type (might be due to invalid IL or missing references) + //IL_02a2: Unknown result type (might be due to invalid IL or missing references) + //IL_02e0: Expected O, but got Unknown + //IL_0309: Unknown result type (might be due to invalid IL or missing references) + //IL_030e: Unknown result type (might be due to invalid IL or missing references) + //IL_030f: Unknown result type (might be due to invalid IL or missing references) + //IL_0315: Unknown result type (might be due to invalid IL or missing references) + //IL_0320: Unknown result type (might be due to invalid IL or missing references) + //IL_032c: Unknown result type (might be due to invalid IL or missing references) + //IL_032f: Unknown result type (might be due to invalid IL or missing references) + //IL_0334: Unknown result type (might be due to invalid IL or missing references) + //IL_0340: Expected O, but got Unknown + //IL_0345: Unknown result type (might be due to invalid IL or missing references) + //IL_0352: Unknown result type (might be due to invalid IL or missing references) + //IL_035a: Unknown result type (might be due to invalid IL or missing references) + //IL_0365: Unknown result type (might be due to invalid IL or missing references) + //IL_0370: Unknown result type (might be due to invalid IL or missing references) + //IL_037b: Unknown result type (might be due to invalid IL or missing references) + //IL_03b9: Expected O, but got Unknown + while (tries > 0) + { + vendedor = vendedorOriginal; + try + { + List list = vendedor.Telefones; + UnitOfWork commited = Instancia.Commited; + try + { + foreach (Repasse item in repasses.Where(delegate(Repasse r) + { + Ramo ramo = r.Ramo; + return ramo != null && ((DomainBase)ramo).Id == 0; + })) + { + item.Ramo = null; + } + bool num = ((DomainBase)vendedor).Id == 0; + vendedor.IdEmpresa = ((vendedor.IdEmpresa == 0L) ? ((DomainBase)Recursos.Empresa).Id : vendedor.IdEmpresa); + TipoAcao acao = (TipoAcao)(((DomainBase)vendedor).Id != 0L); + if (num) + { + vendedor = commited.VendedorRepository.SaveOrUpdate(vendedor); + if (list != null) + { + list = commited.VendedorTelefoneRepository.Inserir(list, vendedor); + } + if (repasses != null && repasses.Count > 0) + { + foreach (Repasse repass in repasses) + { + repass.Vendedor = vendedor; + commited.RepasseRepository.SaveOrUpdate(repass); + } + } + } + else + { + vendedor = commited.VendedorRepository.Merge(vendedor); + if (list != null) + { + list = commited.VendedorTelefoneRepository.Merge(list, vendedor); + } + if (repasses != null && repasses.Count > 0) + { + foreach (Repasse repass2 in repasses) + { + if (((DomainBase)repass2).Id == 0L) + { + commited.RepasseRepository.SaveOrUpdate(repass2); + } + else + { + commited.RepasseRepository.Merge(repass2); + } + } + } + } + vendedor.Telefones = list; + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + if (((DomainBase)Recursos.Usuario).Id != 0L) + { + RegistroLog keyValues = new RegistroLog + { + Acao = acao, + Usuario = Recursos.Usuario, + DataHora = now, + Descricao = JsonConvert.SerializeObject((object)vendedor, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)vendedor).Id, + Tela = (TipoTela)15, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, commited); + foreach (Repasse repass3 in repasses) + { + keyValues = new RegistroLog + { + Acao = acao, + Usuario = Recursos.Usuario, + DataHora = now, + Descricao = JsonConvert.SerializeObject((object)repass3, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)repass3).Id, + Tela = (TipoTela)54, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, commited); + } + } + ((GenericUnitOfWork)commited).Commit(); + return vendedor; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)241, tries, new { vendedor, repasses }); + } + } + return vendedorOriginal; + }); + } + + public async Task Save(Repasse repasse) + { + int tries = 3; + base.Sucesso = true; + DateTime now = Funcoes.GetNetworkTime(); + Repasse repasseSave = repasse; + return await Task.Run((Func)delegate + { + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_0033: Unknown result type (might be due to invalid IL or missing references) + //IL_003a: Unknown result type (might be due to invalid IL or missing references) + //IL_0045: Unknown result type (might be due to invalid IL or missing references) + //IL_0051: Unknown result type (might be due to invalid IL or missing references) + //IL_0058: Unknown result type (might be due to invalid IL or missing references) + //IL_005d: Unknown result type (might be due to invalid IL or missing references) + //IL_0069: Expected O, but got Unknown + //IL_006e: Unknown result type (might be due to invalid IL or missing references) + //IL_007f: Unknown result type (might be due to invalid IL or missing references) + //IL_0087: Unknown result type (might be due to invalid IL or missing references) + //IL_0092: Unknown result type (might be due to invalid IL or missing references) + //IL_009d: Unknown result type (might be due to invalid IL or missing references) + //IL_00a8: Unknown result type (might be due to invalid IL or missing references) + //IL_00e5: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork commited = Instancia.Commited; + try + { + repasseSave = commited.RepasseRepository.Merge(repasseSave); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog keyValues = new RegistroLog + { + Acao = (TipoAcao)1, + Usuario = Recursos.Usuario, + DataHora = now, + Descricao = JsonConvert.SerializeObject((object)repasse, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)repasse).Id, + Tela = (TipoTela)54, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return repasseSave; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)241, tries, new { repasse }); + } + } + return repasse; + }); + } + + public async Task Delete(Vendedor vendedor) + { + int tries = 3; + DateTime dateHora = Funcoes.GetNetworkTime(); + return await Task.Run(delegate + { + //IL_002d: Unknown result type (might be due to invalid IL or missing references) + //IL_0033: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork commited = Instancia.Commited; + try + { + commited.VendedorRepository.Delete(((DomainBase)vendedor).Id); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog val = new RegistroLog(); + val.Acao = (TipoAcao)2; + val.Usuario = Recursos.Usuario; + val.DataHora = dateHora; + val.Descricao = $"O USUÁRIO {Recursos.Usuario.Nome} EXCLUIU, EM {dateHora}, O VENDEDOR DE " + $"ID: '{((DomainBase)vendedor).Id}'" + ", NOME: '" + (string.IsNullOrWhiteSpace(vendedor.Nome) ? "" : (vendedor.Nome ?? "")) + "', DOCUMENTO: '" + (string.IsNullOrWhiteSpace(vendedor.Documento) ? "" : (vendedor.Documento ?? "")) + "', BANCO: '" + ((vendedor.Banco == null) ? "" : (vendedor.Banco.Nome ?? "")) + "', CONTA: '" + (string.IsNullOrWhiteSpace(vendedor.Conta) ? "" : (vendedor.Conta ?? "")) + "'."; + val.EntidadeId = ((DomainBase)vendedor).Id; + val.Tela = (TipoTela)15; + val.Versao = LoginViewModel.VersaoAtual; + val.NomeMaquina = Environment.MachineName; + val.UsuarioMaquina = Environment.UserName; + val.Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString(); + RegistroLog val2 = val; + if (vendedor.Telefones != null && vendedor.Telefones.Count != 0) + { + foreach (VendedorTelefone telefone in vendedor.Telefones) + { + val2.Descricao += string.Format(", TELEFONE {0}: {1} ({2}) {3}", vendedor.Telefones.IndexOf(telefone), (!((TelefoneBase)telefone).Tipo.HasValue) ? "-" : ValidationHelper.GetDescription((Enum)(object)((TelefoneBase)telefone).Tipo), string.IsNullOrWhiteSpace(((TelefoneBase)telefone).Prefixo) ? "" : (((TelefoneBase)telefone).Prefixo ?? ""), string.IsNullOrWhiteSpace(((TelefoneBase)telefone).Numero) ? "" : (((TelefoneBase)telefone).Numero ?? "")); + } + } + val2.Descricao += "."; + SaveLog(val2, commited); + ((GenericUnitOfWork)commited).Commit(); + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)242, tries, vendedor); + } + } + return false; + }); + } + + public async Task> BuscaRepassesPorIdVendedor(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new ObservableCollection(read.RepasseRepository.FindByIdVendedor(id)); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)143, tries, id); + } + } + return new ObservableCollection(); + }); + } + + public async Task> BuscarVendedorParcela(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.RepasseRepository.FindByIdRepasse(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)143, tries, id); + } + } + return new List(); + }); + } + + public async Task BuscarCorretora() + { + return await Task.Run((Func)delegate + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.VendedorRepository.FindCorretora(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception) + { + return (Vendedor)null; + } + }); + } + + public async Task> BuscarVinculosCliente(long idCliente) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + if (Recursos.Usuario.IdEmpresa != 1) + { + _ = Recursos.Usuario.IdEmpresa; + } + return read.VendedorParcelaRepository.FindVinculoByIdCliente(idCliente); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)143, tries); + } + } + return (List)null; + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Financeiro/BancosContasServico.cs b/Decompiler/Gestor.Application.Servicos.Financeiro/BancosContasServico.cs new file mode 100644 index 0000000..a42dbf6 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Financeiro/BancosContasServico.cs @@ -0,0 +1,387 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Financeiro; +using Gestor.Model.Domain.Generic; + +namespace Gestor.Application.Servicos.Financeiro; + +internal class BancosContasServico : BaseServico +{ + public async Task Save(BancosContas bancosContas) + { + int tries = 3; + base.Sucesso = true; + BancosContas bancosContasOriginal = bancosContas; + return await Task.Run((Func)delegate + { + while (tries > 0) + { + List list = new List(); + bancosContas = bancosContasOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + bool num = ((DomainBase)bancosContas).Id != 0L; + if (num) + { + list.Add(CreateLog(((DomainBase)bancosContas).Id, bancosContas, (TipoTela)26)); + } + bancosContas = ((((DomainBase)bancosContas).Id == 0L) ? commited.BancosContasRepository.SaveOrUpdate(bancosContas) : commited.BancosContasRepository.Merge(bancosContas)); + if (!num) + { + list.Add(CreateLog(((DomainBase)bancosContas).Id, ((DomainBase)bancosContas).GetValorOriginal(), (TipoTela)26, (TipoAcao)0)); + } + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return bancosContas; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)245, tries, bancosContas); + } + } + return bancosContasOriginal; + }); + } + + public async Task Save(Saldo saldo) + { + int tries = 3; + base.Sucesso = true; + Saldo saldoOriginal = saldo; + return await Task.Run((Func)delegate + { + while (tries > 0) + { + List list = new List(); + saldo = saldoOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + bool num = ((DomainBase)saldo).Id != 0L; + if (num) + { + list.Add(CreateLog(((DomainBase)saldo.Conta).Id, saldo, (TipoTela)26)); + } + saldo = ((((DomainBase)saldo).Id == 0L) ? commited.SaldoRepository.SaveOrUpdate(saldo) : commited.SaldoRepository.Merge(saldo)); + if (!num) + { + list.Add(CreateLog(((DomainBase)saldo.Conta).Id, ((DomainBase)saldo).GetValorOriginal(), (TipoTela)26, (TipoAcao)0)); + } + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return saldo; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)247, tries, saldo); + } + } + return saldoOriginal; + }); + } + + public async Task Delete(BancosContas bancosContas) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + List list = new List(); + try + { + UnitOfWork commited = Instancia.Commited; + try + { + list.Add(CreateLog(((DomainBase)bancosContas).Id, ((DomainBase)bancosContas).GetValorOriginal(), (TipoTela)26, (TipoAcao)2)); + commited.BancosContasRepository.Delete(((DomainBase)bancosContas).Id); + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)246, tries, bancosContas); + } + } + return false; + }); + } + + public async Task DeleteSaldo(Saldo saldo) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + List list = new List(); + try + { + UnitOfWork commited = Instancia.Commited; + try + { + list.Add(CreateLog(((DomainBase)saldo).Id, ((DomainBase)saldo).GetValorOriginal(), (TipoTela)26, (TipoAcao)2)); + commited.SaldoRepository.Delete(((DomainBase)saldo).Id); + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)248, tries, saldo); + } + } + return false; + }); + } + + public async Task> BuscarBancos() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.BancosContasRepository.Find(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)145, tries); + } + } + return new List(); + }); + } + + public async Task BuscarSaldoAberto(long id) + { + int tries = 3; + return await Task.Run((Func)delegate + { + //IL_005c: Unknown result type (might be due to invalid IL or missing references) + //IL_0062: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.SaldoRepository.BuscarAberto(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)147, tries, id); + } + } + return new Saldo(); + }); + } + + public async Task> BuscarSaldoAberto(List ids) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + List saldos = new List(); + UnitOfWork unitOfWork = Instancia.Read; + try + { + ids.ForEach(delegate(long id) + { + Saldo val = unitOfWork.SaldoRepository.BuscarAberto(id); + if (val != null) + { + saldos.Add(val); + } + }); + } + finally + { + if (unitOfWork != null) + { + ((IDisposable)unitOfWork).Dispose(); + } + } + return saldos; + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)148, tries, ids); + } + } + return new List(); + }); + } + + public async Task FecharSaldo(Saldo saldo) + { + int tries = 3; + return await Task.Run((Func)delegate + { + //IL_0057: Unknown result type (might be due to invalid IL or missing references) + //IL_005d: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.LancamentoRepository.FecharSaldo(saldo); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)149, tries, saldo); + } + } + return new Saldo(); + }); + } + + public async Task> BuscarSaldos(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.SaldoRepository.BuscarPorConta(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)150, tries, id); + } + } + return new List(); + }); + } + + public async Task BuscarSaldo(DateTime inicio, long id) + { + int tries = 3; + return await Task.Run((Func)delegate + { + //IL_0068: Unknown result type (might be due to invalid IL or missing references) + //IL_006e: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.SaldoRepository.BuscarPorData(inicio, id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)151, tries, new { inicio, id }); + } + } + return new Saldo(); + }); + } + + public async Task BuscarSaldoInicial(long id) + { + int tries = 3; + return await Task.Run((Func)delegate + { + //IL_005c: Unknown result type (might be due to invalid IL or missing references) + //IL_0062: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.SaldoRepository.BuscarPorMenorData(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)151, tries, new { id }); + } + } + return new Saldo(); + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Financeiro/CentroServico.cs b/Decompiler/Gestor.Application.Servicos.Financeiro/CentroServico.cs new file mode 100644 index 0000000..0323595 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Financeiro/CentroServico.cs @@ -0,0 +1,89 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Financeiro; +using Gestor.Model.Domain.Generic; + +namespace Gestor.Application.Servicos.Financeiro; + +internal class CentroServico : BaseServico +{ + public async Task Save(Centro centro) + { + int tries = 3; + base.Sucesso = true; + Centro centroOriginal = centro; + return await Task.Run((Func)delegate + { + while (tries > 0) + { + List list = new List(); + centro = centroOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + bool num = ((DomainBase)centro).Id != 0L; + if (num) + { + list.Add(CreateLog(((DomainBase)centro).Id, centro, (TipoTela)29)); + } + centro = ((((DomainBase)centro).Id == 0L) ? commited.CentroRepository.SaveOrUpdate(centro) : commited.CentroRepository.Merge(centro)); + if (!num) + { + list.Add(CreateLog(((DomainBase)centro).Id, ((DomainBase)centro).GetValorOriginal(), (TipoTela)29, (TipoAcao)0)); + } + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return centro; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)249, tries, centro); + } + } + return centroOriginal; + }); + } + + public async Task> BuscarCentros() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.CentroRepository.Find(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)153, tries); + } + } + return new List(); + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Financeiro/FinanceiroServico.cs b/Decompiler/Gestor.Application.Servicos.Financeiro/FinanceiroServico.cs new file mode 100644 index 0000000..e57fb32 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Financeiro/FinanceiroServico.cs @@ -0,0 +1,789 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Financeiro; +using Gestor.Model.Domain.Financeiro.Relatorios; +using Gestor.Model.Domain.Generic; + +namespace Gestor.Application.Servicos.Financeiro; + +public class FinanceiroServico : BaseServico +{ + public async Task TemLancamentosPorFornecedor(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.LancamentoRepository.HasByFornecedor(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)154, tries, id); + } + } + return false; + }); + } + + public async Task> BuscarLancamentosPorFornecedor(long id, StatusLancamento status) + { + //IL_001e: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + int tries = 3; + return await Task.Run(delegate + { + //IL_0074: Unknown result type (might be due to invalid IL or missing references) + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return (from x in read.LancamentoRepository.FindByFornecedor(id, status) + orderby x.Vencimento descending + select x).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)157, tries, new { id, status }); + } + } + return new List(); + }); + } + + public async Task> BuscarLancamentosPorFornecedor(long id, DateTime date, Sinal sinal) + { + //IL_0026: Unknown result type (might be due to invalid IL or missing references) + //IL_0027: Unknown result type (might be due to invalid IL or missing references) + int tries = 3; + return await Task.Run(delegate + { + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return (from x in read.LancamentoRepository.FindByFornecedor(id, date, sinal) + orderby x.Vencimento descending + select x).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)157, tries, new { id, date }); + } + } + return new List(); + }); + } + + public async Task> BuscarLancamentosPorControle(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.LancamentoRepository.FindByControle(id, (StatusLancamento)2); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)158, tries, new { id }); + } + } + return new List(); + }); + } + + public async Task> BuscarLancamentos(DateTime inicio, DateTime fim, StatusLancamento status) + { + //IL_0026: Unknown result type (might be due to invalid IL or missing references) + //IL_0027: Unknown result type (might be due to invalid IL or missing references) + int tries = 3; + return await Task.Run(delegate + { + //IL_0080: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return (from x in read.LancamentoRepository.Find(inicio, fim, status) + orderby x.Vencimento descending + select x).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)160, tries, new { inicio, fim, status }); + } + } + return new List(); + }); + } + + public async Task> BuscarLancamentosPorLancamento(DateTime inicio, DateTime fim, StatusLancamento status) + { + //IL_0026: Unknown result type (might be due to invalid IL or missing references) + //IL_0027: Unknown result type (might be due to invalid IL or missing references) + int tries = 3; + return await Task.Run(delegate + { + //IL_0080: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return (from x in read.LancamentoRepository.FindByLancamento(inicio, fim, status) + orderby x.DataLancamento descending + select x).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)329, tries, new { inicio, fim, status }); + } + } + return new List(); + }); + } + + public async Task> BuscarLancamentos(DateTime inicio, DateTime fim, long conta) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return (from x in read.LancamentoRepository.FindLancamentosByConta(inicio, fim, conta) + orderby x.Vencimento descending + select x).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)165, tries, new { inicio, fim, conta }); + } + } + return new List(); + }); + } + + public async Task> BuscarLancamentosPersonalizados(DateTime inicio, DateTime fim, StatusLancamento status, FiltroLancamentoData filtrodata) + { + //IL_0026: Unknown result type (might be due to invalid IL or missing references) + //IL_0027: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_0030: Unknown result type (might be due to invalid IL or missing references) + int tries = 3; + return await Task.Run(delegate + { + //IL_0086: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + //IL_0025: Unknown result type (might be due to invalid IL or missing references) + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return (from x in read.LancamentoRepository.FindPersonalizado(inicio, fim, status, filtrodata) + orderby x.Vencimento descending + select x).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)160, tries, new { inicio, fim, status }); + } + } + return new List(); + }); + } + + public async Task> BuscarLancamentosPorBaixa(DateTime inicio, DateTime fim) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return (from x in read.LancamentoRepository.FindByBaixa(inicio, fim) + orderby x.Baixa descending + select x).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)161, tries, new { inicio, fim }); + } + } + return new List(); + }); + } + + public async Task> BuscarLancamentosPorPagamento(DateTime inicio, DateTime fim) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return (from x in read.LancamentoRepository.FindByPagamento(inicio, fim) + orderby x.Pagamento + select x).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)162, tries, new { inicio, fim }); + } + } + return new List(); + }); + } + + public async Task Save(Lancamento lancamento) + { + int tries = 3; + base.Sucesso = true; + DateTime now = Funcoes.GetNetworkTime(); + Lancamento lancamentoOriginal = lancamento; + return await Task.Run((Func)delegate + { + while (tries > 0) + { + List list = new List(); + lancamento = lancamentoOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + int num; + if (((DomainBase)lancamento).Id != 0L) + { + num = 1; + if (num != 0) + { + goto IL_0047; + } + } + else + { + num = 0; + } + lancamento.DataLancamento = now; + goto IL_0047; + IL_0047: + if (num == 1) + { + list.Add(CreateLog(((DomainBase)lancamento).Id, lancamento, (TipoTela)25)); + } + ControleFinanceiro controle = lancamento.Controle; + controle = ((((DomainBase)controle).Id == 0L) ? commited.ControleFinanceiroRepository.SaveOrUpdate(controle) : commited.ControleFinanceiroRepository.Merge(controle)); + lancamento.Controle = controle; + lancamento = ((((DomainBase)lancamento).Id == 0L) ? commited.LancamentoRepository.SaveOrUpdate(lancamento) : commited.LancamentoRepository.Merge(lancamento)); + if (num == 0) + { + list.Add(CreateLog(((DomainBase)lancamento).Id, ((DomainBase)lancamento).GetValorOriginal(), (TipoTela)25, (TipoAcao)0)); + } + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return lancamento; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)279, tries, lancamento); + } + } + return lancamentoOriginal; + }); + } + + public async Task> AddRange(List lancamentos) + { + int tries = 3; + base.Sucesso = true; + DateTime now = Funcoes.GetNetworkTime(); + List lancamentosOriginal = lancamentos; + return await Task.Run(delegate + { + while (tries > 0) + { + List logs = new List(); + lancamentos = lancamentosOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + ControleFinanceiro controle = lancamentos.First().Controle; + controle = ((((DomainBase)controle).Id == 0L) ? commited.ControleFinanceiroRepository.SaveOrUpdate(controle) : commited.ControleFinanceiroRepository.Merge(controle)); + lancamentos.ForEach(delegate(Lancamento x) + { + x.Controle = controle; + x.DataLancamento = now; + }); + lancamentos = commited.LancamentoRepository.AddRange(lancamentos); + lancamentos.ForEach(delegate(Lancamento x) + { + logs.Add(CreateLog(((DomainBase)x).Id, ((DomainBase)x).GetValorOriginal(), (TipoTela)25, (TipoAcao)0)); + }); + SaveLog(logs, commited); + ((GenericUnitOfWork)commited).Commit(); + return lancamentos; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)279, tries, lancamentos); + } + } + return lancamentosOriginal; + }); + } + + public async Task> Atualizar(List lancamentos) + { + int tries = 3; + base.Sucesso = true; + Funcoes.GetNetworkTime(); + List lancamentosOriginal = lancamentos; + return await Task.Run(delegate + { + while (tries > 0) + { + List logs = new List(); + lancamentos = lancamentosOriginal; + try + { + UnitOfWork unitOfWork = Instancia.Commited; + try + { + lancamentos.ForEach(delegate(Lancamento lancamento) + { + logs.Add(CreateLog(((DomainBase)lancamento).Id, lancamento, (TipoTela)25)); + lancamento.Controle = unitOfWork.ControleFinanceiroRepository.Merge(lancamento.Controle); + lancamento = unitOfWork.LancamentoRepository.Merge(lancamento); + }); + SaveLog(logs, unitOfWork); + ((GenericUnitOfWork)unitOfWork).Commit(); + return lancamentos; + } + finally + { + if (unitOfWork != null) + { + ((IDisposable)unitOfWork).Dispose(); + } + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)280, tries, lancamentos); + } + } + return lancamentosOriginal; + }); + } + + public async Task> IncluirRange(List lancamentos) + { + int tries = 3; + base.Sucesso = true; + Funcoes.GetNetworkTime(); + List lancamentosOriginal = lancamentos; + return await Task.Run(delegate + { + while (tries > 0) + { + List logs = new List(); + lancamentos = lancamentosOriginal; + try + { + UnitOfWork unitOfWork = Instancia.Commited; + try + { + lancamentos.ForEach(delegate(Lancamento lancamento) + { + lancamento.Controle = unitOfWork.ControleFinanceiroRepository.Merge(lancamento.Controle); + lancamento = unitOfWork.LancamentoRepository.SaveOrUpdate(lancamento); + logs.Add(CreateLog(((DomainBase)lancamento).Id, ((DomainBase)lancamento).GetValorOriginal(), (TipoTela)25, (TipoAcao)0)); + }); + SaveLog(logs, unitOfWork); + ((GenericUnitOfWork)unitOfWork).Commit(); + return lancamentos; + } + finally + { + if (unitOfWork != null) + { + ((IDisposable)unitOfWork).Dispose(); + } + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)281, tries, lancamentos); + } + } + return lancamentosOriginal; + }); + } + + public async Task BuscarLancamento(long id, int parcela) + { + int tries = 3; + return await Task.Run((Func)delegate + { + //IL_0068: Unknown result type (might be due to invalid IL or missing references) + //IL_006e: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.LancamentoRepository.FindByControle(id, parcela); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)163, tries, new { id, parcela }); + } + } + return new Lancamento(); + }); + } + + public async Task BuscarLancamento(long id) + { + int tries = 3; + return await Task.Run((Func)delegate + { + //IL_005c: Unknown result type (might be due to invalid IL or missing references) + //IL_0062: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.LancamentoRepository.FindById(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)164, tries, id); + } + } + return new Lancamento(); + }); + } + + public async Task Excluir(List lancamentos) + { + int tries = 3; + Funcoes.GetNetworkTime(); + return await Task.Run(delegate + { + while (tries > 0) + { + List logs = new List(); + try + { + UnitOfWork unitOfWork = Instancia.Commited; + try + { + lancamentos.ForEach(delegate(Lancamento x) + { + bool num = unitOfWork.LancamentoRepository.FindByControle(((DomainBase)x.Controle).Id, (StatusLancamento)2).Count == 1; + logs.Add(CreateLog(((DomainBase)x).Id, ((DomainBase)x).GetValorOriginal(), (TipoTela)25, (TipoAcao)2)); + if (num) + { + unitOfWork.ControleFinanceiroRepository.Delete(((DomainBase)x.Controle).Id); + } + else + { + x.Controle.Parcelas = x.Controle.Parcelas - 1; + unitOfWork.ControleFinanceiroRepository.Merge(x.Controle); + unitOfWork.LancamentoRepository.Delete(((DomainBase)x).Id); + } + }); + SaveLog(logs, unitOfWork); + ((GenericUnitOfWork)unitOfWork).Commit(); + } + finally + { + if (unitOfWork != null) + { + ((IDisposable)unitOfWork).Dispose(); + } + } + return true; + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)282, tries, lancamentos); + } + } + return false; + }); + } + + public async Task Excluir(Lancamento lancamento) + { + int tries = 3; + Funcoes.GetNetworkTime(); + return await Task.Run(delegate + { + while (tries > 0) + { + List list = new List(); + try + { + UnitOfWork commited = Instancia.Commited; + try + { + bool num = commited.LancamentoRepository.FindByControle(((DomainBase)lancamento.Controle).Id, (StatusLancamento)2).Count == 1; + list.Add(CreateLog(((DomainBase)lancamento).Id, ((DomainBase)lancamento).GetValorOriginal(), (TipoTela)25, (TipoAcao)2)); + if (num) + { + commited.ControleFinanceiroRepository.Delete(((DomainBase)lancamento.Controle).Id); + } + else + { + lancamento.Controle.Parcelas = lancamento.Controle.Parcelas - 1; + commited.ControleFinanceiroRepository.Merge(lancamento.Controle); + commited.LancamentoRepository.Delete(((DomainBase)lancamento).Id); + } + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)282, tries, lancamento); + } + } + return false; + }); + } + + public async Task> BuscarLancamentosPorConta(DateTime inicio, DateTime fim, long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.LancamentoRepository.FindByConta(inicio, fim, id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)165, tries, new { inicio, fim, id }); + } + } + return new List(); + }); + } + + public async Task Transferir(Lancamento lancamentoOrigem, Lancamento lancamentoDestino) + { + int tries = 3; + Lancamento lancamentoOrigemOriginal = lancamentoOrigem; + Lancamento lancamentoDestinoOriginal = lancamentoDestino; + Funcoes.GetNetworkTime(); + return await Task.Run(delegate + { + while (tries > 0) + { + List list = new List(); + lancamentoOrigem = lancamentoOrigemOriginal; + lancamentoDestino = lancamentoDestinoOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + ControleFinanceiro controle = lancamentoOrigem.Controle; + controle = commited.ControleFinanceiroRepository.SaveOrUpdate(controle); + lancamentoOrigem.Controle = controle; + lancamentoDestino.Controle = controle; + lancamentoOrigem = commited.LancamentoRepository.SaveOrUpdate(lancamentoOrigem); + lancamentoDestino = commited.LancamentoRepository.SaveOrUpdate(lancamentoDestino); + list.Add(CreateLog(((DomainBase)lancamentoOrigem).Id, ((DomainBase)lancamentoOrigem).GetValorOriginal(), (TipoTela)25, (TipoAcao)0)); + list.Add(CreateLog(((DomainBase)lancamentoDestino).Id, ((DomainBase)lancamentoDestino).GetValorOriginal(), (TipoTela)25, (TipoAcao)0)); + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)283, tries, new { lancamentoOrigem, lancamentoDestino }); + } + } + return false; + }); + } + + public async Task> BuscarFechamento(FiltroFinanceiro filtro) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.LancamentoRepository.Fechamento(filtro); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)294, tries, filtro); + } + } + return new List(); + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Financeiro/FornecedorServico.cs b/Decompiler/Gestor.Application.Servicos.Financeiro/FornecedorServico.cs new file mode 100644 index 0000000..f26bc53 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Financeiro/FornecedorServico.cs @@ -0,0 +1,127 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Financeiro; +using Gestor.Model.Domain.Generic; + +namespace Gestor.Application.Servicos.Financeiro; + +public class FornecedorServico : BaseServico +{ + public async Task Save(Fornecedor fornecedor) + { + int tries = 3; + base.Sucesso = true; + Fornecedor fornecedorOriginal = fornecedor; + return await Task.Run((Func)delegate + { + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0031: Invalid comparison between Unknown and I4 + //IL_0058: Unknown result type (might be due to invalid IL or missing references) + //IL_0084: Unknown result type (might be due to invalid IL or missing references) + while (tries > 0) + { + List list = new List(); + fornecedor = fornecedorOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + TipoAcao val = (TipoAcao)(fornecedor.Id != 0L); + if ((int)val == 1) + { + list.Add(CreateLog(fornecedor.Id, fornecedor, (TipoTela)24)); + } + fornecedor = (((int)val == 0) ? commited.FornecedorRepository.SaveOrUpdate(fornecedor) : commited.FornecedorRepository.Merge(fornecedor)); + if ((int)val == 0) + { + list.Add(CreateLog(fornecedor.Id, ((DomainBase)fornecedor).GetValorOriginal(), (TipoTela)24, (TipoAcao)0)); + } + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return fornecedor; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)243, tries, fornecedor); + } + } + return fornecedorOriginal; + }); + } + + public async Task Delete(Fornecedor fornecedor) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + List list = new List(); + try + { + UnitOfWork commited = Instancia.Commited; + try + { + list.Add(CreateLog(fornecedor.Id, ((DomainBase)fornecedor).GetValorOriginal(), (TipoTela)24, (TipoAcao)2)); + commited.FornecedorRepository.Delete(fornecedor.Id); + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)244, tries, fornecedor); + } + } + return false; + }); + } + + public async Task> BuscarFornecedores() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.FornecedorRepository.Find(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)166, tries); + } + } + return new List(); + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Financeiro/PlanoServico.cs b/Decompiler/Gestor.Application.Servicos.Financeiro/PlanoServico.cs new file mode 100644 index 0000000..166690d --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Financeiro/PlanoServico.cs @@ -0,0 +1,119 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Sockets; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Financeiro; +using Gestor.Model.Domain.Generic; +using Newtonsoft.Json; + +namespace Gestor.Application.Servicos.Financeiro; + +internal class PlanoServico : BaseServico +{ + public async Task Save(Plano plano) + { + int tries = 3; + base.Sucesso = true; + Plano planoOriginal = plano; + return await Task.Run((Func)delegate + { + //IL_0028: Unknown result type (might be due to invalid IL or missing references) + //IL_006b: Unknown result type (might be due to invalid IL or missing references) + //IL_0070: Unknown result type (might be due to invalid IL or missing references) + //IL_0071: Unknown result type (might be due to invalid IL or missing references) + //IL_0077: Unknown result type (might be due to invalid IL or missing references) + //IL_0082: Unknown result type (might be due to invalid IL or missing references) + //IL_008d: Unknown result type (might be due to invalid IL or missing references) + //IL_0094: Unknown result type (might be due to invalid IL or missing references) + //IL_0099: Unknown result type (might be due to invalid IL or missing references) + //IL_00a5: Expected O, but got Unknown + //IL_00aa: Unknown result type (might be due to invalid IL or missing references) + //IL_00bb: Unknown result type (might be due to invalid IL or missing references) + //IL_00c3: Unknown result type (might be due to invalid IL or missing references) + //IL_00ce: Unknown result type (might be due to invalid IL or missing references) + //IL_00d9: Unknown result type (might be due to invalid IL or missing references) + //IL_00e4: Unknown result type (might be due to invalid IL or missing references) + //IL_0121: Expected O, but got Unknown + while (tries > 0) + { + plano = planoOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + TipoAcao acao = (TipoAcao)(((DomainBase)plano).Id != 0L); + plano = ((((DomainBase)plano).Id == 0L) ? commited.PlanoRepository.SaveOrUpdate(plano) : commited.PlanoRepository.Merge(plano)); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog keyValues = new RegistroLog + { + Acao = acao, + Usuario = Recursos.Usuario, + DataHora = Funcoes.GetNetworkTime(), + Descricao = JsonConvert.SerializeObject((object)plano, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)plano).Id, + Tela = (TipoTela)27, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return plano; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)250, tries, plano); + } + } + return planoOriginal; + }); + } + + public async Task> BuscarPlanos() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.PlanosRepository.Find(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)167, tries); + } + } + return new List(); + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Financeiro/PlanosServico.cs b/Decompiler/Gestor.Application.Servicos.Financeiro/PlanosServico.cs new file mode 100644 index 0000000..1fbab43 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Financeiro/PlanosServico.cs @@ -0,0 +1,90 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Financeiro; +using Gestor.Model.Domain.Generic; + +namespace Gestor.Application.Servicos.Financeiro; + +internal class PlanosServico : BaseServico +{ + internal async Task> BuscarPlanos() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new ObservableCollection(read.PlanosRepository.Find()); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)168, tries); + } + } + return new ObservableCollection(); + }); + } + + public async Task Save(Planos planos) + { + int tries = 3; + base.Sucesso = true; + Planos planosOriginal = planos; + return await Task.Run((Func)delegate + { + while (tries > 0) + { + List list = new List(); + planos = planosOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + bool num = ((DomainBase)planos).Id != 0L; + if (num) + { + list.Add(CreateLog(((DomainBase)planos).Id, planos, (TipoTela)28)); + } + planos = ((((DomainBase)planos).Id == 0L) ? commited.PlanosRepository.SaveOrUpdate(planos) : commited.PlanosRepository.Merge(planos)); + if (!num) + { + list.Add(CreateLog(((DomainBase)planos).Id, ((DomainBase)planos).GetValorOriginal(), (TipoTela)28, (TipoAcao)0)); + } + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return planos; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)251, tries, planos); + } + } + return planosOriginal; + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Generic/BaseServico.cs b/Decompiler/Gestor.Application.Servicos.Generic/BaseServico.cs new file mode 100644 index 0000000..be9b6fb --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Generic/BaseServico.cs @@ -0,0 +1,2412 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Net.Sockets; +using System.Threading.Tasks; +using Agger.Registro; +using Gestor.Application.Helpers; +using Gestor.Application.ViewModels; +using Gestor.Common.Security; +using Gestor.Common.Validation; +using Gestor.Infrastructure.Helpers; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Aggilizador; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Financeiro; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Relatorios; +using Gestor.Model.Domain.Seguros; +using Newtonsoft.Json; + +namespace Gestor.Application.Servicos.Generic; + +public class BaseServico +{ + private const int UnathorizedSsoCode = 401; + + private const int NotFoundSsoCode = 404; + + public bool Sucesso { get; set; } + + public int Registrar(Exception e, TipoErro erro, int tries, object objeto = null, bool abrirTela = true) + { + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_003a: Expected O, but got Unknown + //IL_003b: Unknown result type (might be due to invalid IL or missing references) + //IL_0040: Unknown result type (might be due to invalid IL or missing references) + //IL_004b: Unknown result type (might be due to invalid IL or missing references) + //IL_0062: Unknown result type (might be due to invalid IL or missing references) + //IL_0079: Unknown result type (might be due to invalid IL or missing references) + //IL_0091: Unknown result type (might be due to invalid IL or missing references) + //IL_00a1: Unknown result type (might be due to invalid IL or missing references) + //IL_00ac: Unknown result type (might be due to invalid IL or missing references) + //IL_00ad: Unknown result type (might be due to invalid IL or missing references) + //IL_00b3: Expected I4, but got Unknown + //IL_00b3: Unknown result type (might be due to invalid IL or missing references) + //IL_00b4: Unknown result type (might be due to invalid IL or missing references) + //IL_00c4: Unknown result type (might be due to invalid IL or missing references) + //IL_00d0: Unknown result type (might be due to invalid IL or missing references) + //IL_00e8: Unknown result type (might be due to invalid IL or missing references) + //IL_00f4: Unknown result type (might be due to invalid IL or missing references) + //IL_0100: Unknown result type (might be due to invalid IL or missing references) + //IL_010c: Unknown result type (might be due to invalid IL or missing references) + //IL_0118: Unknown result type (might be due to invalid IL or missing references) + //IL_0123: Unknown result type (might be due to invalid IL or missing references) + //IL_012e: Unknown result type (might be due to invalid IL or missing references) + //IL_013b: Unknown result type (might be due to invalid IL or missing references) + //IL_0149: Expected O, but got Unknown + tries--; + if (tries > 0) + { + return tries; + } + try + { + int fileLineNumber = new StackTrace(e, fNeedFileInfo: true).GetFrame(0).GetFileLineNumber(); + string objeto2 = ((objeto != null) ? JsonConvert.SerializeObject(objeto, (Formatting)1, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }) : null); + LogError val = new LogError + { + IdFornecedor = ApplicationHelper.IdFornecedor + }; + Empresa empresa = Recursos.Empresa; + val.Fornecedor = ((empresa != null) ? empresa.Nome : null); + Usuario usuario = Recursos.Usuario; + val.UsuarioLogado = ((usuario != null) ? usuario.Nome : null); + Usuario usuario2 = Recursos.Usuario; + val.IdUsuarioLogado = ((usuario2 != null) ? ((DomainBase)usuario2).Id : 0); + val.Versao = ApplicationHelper.Versao.ToString(); + val.Data = Funcoes.GetNetworkTime(); + val.IdErro = (int)erro; + val.Erro = ValidationHelper.GetDescription((Enum)(object)erro); + val.HResult = e.HResult; + val.InnerException = e.InnerException?.ToString(); + val.HelpLink = e.HelpLink; + val.Message = e.Message; + val.Source = e.Source; + val.StackTrace = e.StackTrace; + val.Maquina = Environment.MachineName; + val.UsuarioMaquina = Environment.UserName; + val.Linha = fileLineNumber.ToString(); + val.Objeto = objeto2; + Erro.RegistrarErro(val, abrirTela); + Sucesso = false; + } + catch (Exception) + { + } + return 0; + } + + public RegistroLog CreateLog(long id, dynamic obj, TipoTela tela) + { + //IL_0092: Unknown result type (might be due to invalid IL or missing references) + //IL_0097: Unknown result type (might be due to invalid IL or missing references) + //IL_009e: Unknown result type (might be due to invalid IL or missing references) + //IL_00a9: Unknown result type (might be due to invalid IL or missing references) + //IL_00b0: Unknown result type (might be due to invalid IL or missing references) + //IL_00bd: Unknown result type (might be due to invalid IL or missing references) + //IL_00c2: Unknown result type (might be due to invalid IL or missing references) + //IL_00ce: Expected O, but got Unknown + //IL_00d6: Unknown result type (might be due to invalid IL or missing references) + //IL_00dd: Unknown result type (might be due to invalid IL or missing references) + //IL_00de: Unknown result type (might be due to invalid IL or missing references) + //IL_00e4: Unknown result type (might be due to invalid IL or missing references) + //IL_00ef: Unknown result type (might be due to invalid IL or missing references) + //IL_00fa: Unknown result type (might be due to invalid IL or missing references) + //IL_0105: Unknown result type (might be due to invalid IL or missing references) + //IL_0145: Unknown result type (might be due to invalid IL or missing references) + //IL_014d: Expected O, but got Unknown + try + { + List list = obj.Compare(); + DateTime networkTime = Funcoes.GetNetworkTime(); + return new RegistroLog + { + Acao = (TipoAcao)1, + Usuario = Recursos.Usuario, + DataHora = networkTime, + Descricao = ((list != null && list.Count == 0) ? null : JsonConvert.SerializeObject((object)list, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + })), + EntidadeId = id, + Tela = tela, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = Recursos.Host.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString(), + ModeloNovo = true + }; + } + catch (Exception) + { + return null; + } + } + + public RegistroLog CreateDynamicLog(long id, dynamic lista, TipoTela tela) + { + //IL_063f: Unknown result type (might be due to invalid IL or missing references) + //IL_0644: Unknown result type (might be due to invalid IL or missing references) + //IL_0650: Expected O, but got Unknown + //IL_0682: Unknown result type (might be due to invalid IL or missing references) + //IL_0687: Unknown result type (might be due to invalid IL or missing references) + //IL_0693: Expected O, but got Unknown + //IL_06ba: Unknown result type (might be due to invalid IL or missing references) + //IL_06bf: Unknown result type (might be due to invalid IL or missing references) + //IL_06c6: Unknown result type (might be due to invalid IL or missing references) + //IL_06d1: Unknown result type (might be due to invalid IL or missing references) + //IL_06d8: Unknown result type (might be due to invalid IL or missing references) + //IL_0704: Unknown result type (might be due to invalid IL or missing references) + //IL_070b: Unknown result type (might be due to invalid IL or missing references) + //IL_070c: Unknown result type (might be due to invalid IL or missing references) + //IL_0712: Unknown result type (might be due to invalid IL or missing references) + //IL_071d: Unknown result type (might be due to invalid IL or missing references) + //IL_0728: Unknown result type (might be due to invalid IL or missing references) + //IL_0733: Unknown result type (might be due to invalid IL or missing references) + //IL_0773: Unknown result type (might be due to invalid IL or missing references) + //IL_077c: Expected O, but got Unknown + try + { + List list = new List(); + List list2 = new List(); + foreach (dynamic listum in lista) + { + if (listum == null) + { + continue; + } + if (listum.GetType().Name.ToUpper().StartsWith("LIST")) + { + foreach (dynamic item in listum) + { + try + { + if (!((item.Id == 0) ? true : false)) + { + list.AddRange(DynamicObjeto(item)); + } + else + { + list2.AddRange(item.GetValorOriginal()); + } + } + catch + { + } + } + } + else + { + try + { + list.AddRange(DynamicObjeto(listum)); + } + catch + { + } + } + } + DateTime networkTime = Funcoes.GetNetworkTime(); + string text = ((list != null && list.Count == 0) ? "" : JsonConvert.SerializeObject((object)list, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }).Replace("]", ",").Replace("[", "")); + string text2 = ((list2 != null && list2.Count == 0) ? "" : JsonConvert.SerializeObject((object)list2, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }).Replace("]", "").Replace("[", "")); + return new RegistroLog + { + Acao = (TipoAcao)1, + Usuario = Recursos.Usuario, + DataHora = networkTime, + Descricao = ((string.IsNullOrEmpty(text) && string.IsNullOrEmpty(text2)) ? null : ("[" + text + text2 + "]")), + EntidadeId = id, + Tela = tela, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = Recursos.Host.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString(), + ModeloNovo = true + }; + } + catch (Exception) + { + return null; + } + } + + public List DynamicObjeto(dynamic objeto) + { + dynamic val = objeto.Compare(); + if (val.Count > 0) + { + return val; + } + return new List(); + } + + public RegistroLog CreateLog(long id, List diferenca, TipoTela tela) + { + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Unknown result type (might be due to invalid IL or missing references) + //IL_001d: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_0026: Unknown result type (might be due to invalid IL or missing references) + //IL_002b: Unknown result type (might be due to invalid IL or missing references) + //IL_0037: Expected O, but got Unknown + //IL_003c: Unknown result type (might be due to invalid IL or missing references) + //IL_0043: Unknown result type (might be due to invalid IL or missing references) + //IL_0044: Unknown result type (might be due to invalid IL or missing references) + //IL_004a: Unknown result type (might be due to invalid IL or missing references) + //IL_0055: Unknown result type (might be due to invalid IL or missing references) + //IL_0060: Unknown result type (might be due to invalid IL or missing references) + //IL_006b: Unknown result type (might be due to invalid IL or missing references) + //IL_00ab: Unknown result type (might be due to invalid IL or missing references) + //IL_00b3: Expected O, but got Unknown + try + { + DateTime networkTime = Funcoes.GetNetworkTime(); + return new RegistroLog + { + Acao = (TipoAcao)1, + Usuario = Recursos.Usuario, + DataHora = networkTime, + Descricao = JsonConvert.SerializeObject((object)diferenca, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = id, + Tela = tela, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = Recursos.Host.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString(), + ModeloNovo = true + }; + } + catch (Exception) + { + return null; + } + } + + public RegistroLog CreateLog(long id, List diferenca, TipoTela tela, TipoAcao acao) + { + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_0013: Unknown result type (might be due to invalid IL or missing references) + //IL_001e: Unknown result type (might be due to invalid IL or missing references) + //IL_0025: Unknown result type (might be due to invalid IL or missing references) + //IL_0027: Unknown result type (might be due to invalid IL or missing references) + //IL_002c: Unknown result type (might be due to invalid IL or missing references) + //IL_0038: Expected O, but got Unknown + //IL_003d: Unknown result type (might be due to invalid IL or missing references) + //IL_0044: Unknown result type (might be due to invalid IL or missing references) + //IL_0045: Unknown result type (might be due to invalid IL or missing references) + //IL_004b: Unknown result type (might be due to invalid IL or missing references) + //IL_0056: Unknown result type (might be due to invalid IL or missing references) + //IL_0061: Unknown result type (might be due to invalid IL or missing references) + //IL_006c: Unknown result type (might be due to invalid IL or missing references) + //IL_00ac: Unknown result type (might be due to invalid IL or missing references) + //IL_00b4: Expected O, but got Unknown + try + { + DateTime networkTime = Funcoes.GetNetworkTime(); + return new RegistroLog + { + Acao = acao, + Usuario = Recursos.Usuario, + DataHora = networkTime, + Descricao = JsonConvert.SerializeObject((object)diferenca, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = id, + Tela = tela, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = Recursos.Host.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString(), + ModeloNovo = true + }; + } + catch (Exception) + { + return null; + } + } + + public RegistroLog CreateLog(long id, List valor, TipoTela tela, TipoAcao acao) + { + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_0013: Unknown result type (might be due to invalid IL or missing references) + //IL_001e: Unknown result type (might be due to invalid IL or missing references) + //IL_0025: Unknown result type (might be due to invalid IL or missing references) + //IL_0027: Unknown result type (might be due to invalid IL or missing references) + //IL_002c: Unknown result type (might be due to invalid IL or missing references) + //IL_0038: Expected O, but got Unknown + //IL_003d: Unknown result type (might be due to invalid IL or missing references) + //IL_0044: Unknown result type (might be due to invalid IL or missing references) + //IL_0045: Unknown result type (might be due to invalid IL or missing references) + //IL_004b: Unknown result type (might be due to invalid IL or missing references) + //IL_0056: Unknown result type (might be due to invalid IL or missing references) + //IL_0061: Unknown result type (might be due to invalid IL or missing references) + //IL_006c: Unknown result type (might be due to invalid IL or missing references) + //IL_00ac: Unknown result type (might be due to invalid IL or missing references) + //IL_00b4: Expected O, but got Unknown + try + { + DateTime networkTime = Funcoes.GetNetworkTime(); + return new RegistroLog + { + Acao = acao, + Usuario = Recursos.Usuario, + DataHora = networkTime, + Descricao = JsonConvert.SerializeObject((object)valor, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = id, + Tela = tela, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = Recursos.Host.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString(), + ModeloNovo = true + }; + } + catch (Exception) + { + return null; + } + } + + public void SaveLog(RegistroLog keyValues, UnitOfWork unitOfWork) + { + if (keyValues == null) + { + return; + } + try + { + unitOfWork.RegistroLogRepository.SaveOrUpdate(keyValues); + } + catch (Exception) + { + } + } + + public void SaveLog(List keyValues, UnitOfWork unitOfWork) + { + if (keyValues == null) + { + return; + } + try + { + List list = keyValues.Where((RegistroLog x) => !string.IsNullOrEmpty((x != null) ? x.Descricao : null) && !string.IsNullOrEmpty(x.Versao)).ToList(); + unitOfWork.RegistroLogRepository.AddRange(list); + } + catch (Exception) + { + } + } + + internal async Task> BuscarProfissao(string value) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return (from x in read.ProfissaoRepository.Find(value) + orderby x.Nome + select x).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)180, tries, value); + } + } + return new List(); + }); + } + + internal async Task> BuscarAtividade(string value) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return (from x in read.AtividadeRepository.Find(value) + orderby x.Nome + select x).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)181, tries, value); + } + } + return new List(); + }); + } + + internal async Task> BuscarBanco(string value) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return (from x in read.BancoRepository.Find(value) + orderby x.Nome + select x).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)144, tries, value); + } + } + return new List(); + }); + } + + internal async Task> BuscarBancosContas(string value) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return (from x in read.BancosContasRepository.Find(value) + orderby x.Descricao + select x).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)146, tries, value); + } + } + return new List(); + }); + } + + internal async Task> BuscarFabricante(string value) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return (from x in read.FabricanteRepository.Find(value) + orderby x.Descricao + select x).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)182, tries, value); + } + } + return new List(); + }); + } + + internal Empresa BuscarEmpresa(long id) + { + //IL_003d: Unknown result type (might be due to invalid IL or missing references) + //IL_0043: Expected O, but got Unknown + int num = 3; + while (num > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.EmpresaRepository.FindById(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + num = Registrar(e, (TipoErro)114, num, id); + } + } + return new Empresa(); + } + + internal async Task> BuscarVendedor(string value) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return (from x in read.VendedorRepository.Find((Recursos.Usuario.IdEmpresa == 1) ? 0 : Recursos.Usuario.IdEmpresa) + orderby x.Nome + select x).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)140, tries, value); + } + } + return new List(); + }); + } + + public async Task> BuscarEstipulante(string value) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return (from x in read.EstipulanteRepository.Find(value, (Recursos.Usuario.IdEmpresa == 1) ? 0 : Recursos.Usuario.IdEmpresa) + orderby x.Nome + select x).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)111, tries, value); + } + } + return new List(); + }); + } + + public async Task> BuscarEstipulantesAsync() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new List(from x in read.EstipulanteRepository.Find() + orderby ((DomainBase)x).Id + select x); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)112, tries); + } + } + return new List(); + }); + } + + public async Task> BuscarUsuariosAsync() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new List(from x in read.UsuarioRepository.Find((Recursos.Usuario.IdEmpresa == 1) ? 0 : Recursos.Usuario.IdEmpresa) + orderby ((DomainBase)x).Id + select x); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)131, tries); + } + } + return new List(); + }); + } + + public async Task> BuscarEmpresasAsync() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new List(from x in read.EmpresaRepository.Find(0L) + orderby ((DomainBase)x).Id + select x); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)113, tries); + } + } + return new List(); + }); + } + + public async Task> BuscarSociosAsync(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.SocioRepository.FindByEmpresa(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)122, tries, id); + } + } + return new List(); + }); + } + + internal async Task> BuscarUsuario(string value) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return (from x in read.UsuarioRepository.Find(value, 0L) + orderby x.Nome + select x).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)132, tries, value); + } + } + return new List(); + }); + } + + internal async Task BuscaUsuarioSso(string login, string password, string documentoEmpresa) + { + HttpClient client = new HttpClient(); + try + { + ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; + Uri uri = Address.ApiSso.Append("auth"); + string text = $"{login}:{password}:{ApplicationHelper.NumeroSerial}:{documentoEmpresa}:{Funcoes.GetNetworkTime().ToUniversalTime().Ticks}".ToBase64BasicEncode(); + ((HttpHeaders)client.DefaultRequestHeaders).TryAddWithoutValidation("Authorization", text); + HttpResponseMessage val = await client.GetAsync(uri); + return (!val.IsSuccessStatusCode) ? null : JsonConvert.DeserializeObject(await val.Content.ReadAsStringAsync()); + } + finally + { + ((IDisposable)client)?.Dispose(); + } + } + + internal async Task VerificaUsuarioSso(string login, string documentoEmpresa) + { + HttpClient client = new HttpClient(); + try + { + ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; + Uri uri = Address.ApiSso.Append("exist"); + string text = $"{login}:{login}:{ApplicationHelper.NumeroSerial}:{documentoEmpresa}:{Funcoes.GetNetworkTime().ToUniversalTime().Ticks}".ToBase64BasicEncode(); + ((HttpHeaders)client.DefaultRequestHeaders).TryAddWithoutValidation("Authorization", text); + HttpResponseMessage val = await client.GetAsync(uri); + return (!val.IsSuccessStatusCode) ? null : JsonConvert.DeserializeObject(await val.Content.ReadAsStringAsync()); + } + finally + { + ((IDisposable)client)?.Dispose(); + } + } + + internal async Task AddOrUpdateUsuarioSso(Usuario usuario, string documentoEmpresa, string ssoId = null) + { + HttpClient client = new HttpClient(); + try + { + ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; + Uri uri = Address.ApiSso.Append("user"); + ((HttpHeaders)client.DefaultRequestHeaders).TryAddWithoutValidation("Authorization", "Bearer " + usuario.TokenSso); + UserSso val = usuario.ToUserSso(ApplicationHelper.NumeroSerial, documentoEmpresa, ssoId); + HttpResponseMessage val2 = ((val.Id != null) ? (await client.PutAsync(uri, (HttpContent)(object)val.ToHttpContent())) : (await client.PostAsync(uri, (HttpContent)(object)val.ToHttpContent()))); + HttpResponseMessage val3 = val2; + return (!val3.IsSuccessStatusCode) ? null : JsonConvert.DeserializeObject(await val3.Content.ReadAsStringAsync()); + } + finally + { + ((IDisposable)client)?.Dispose(); + } + } + + internal async Task DeleteUsuarioSso(Usuario usuario, string documentoEmpresa) + { + HttpClient client = new HttpClient(); + try + { + ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; + Uri uri = Address.ApiSso.Append("user").AddQuery("userId", usuario.SsoId); + ((HttpHeaders)client.DefaultRequestHeaders).TryAddWithoutValidation("Authorization", "Bearer " + usuario.TokenSso); + HttpResponseMessage val = await client.DeleteAsync(uri); + return (!val.IsSuccessStatusCode) ? null : JsonConvert.DeserializeObject(await val.Content.ReadAsStringAsync()); + } + finally + { + ((IDisposable)client)?.Dispose(); + } + } + + private async Task BuscaUsuarioByToken(Usuario usuario) + { + HttpClient client = new HttpClient(); + try + { + ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; + Uri uri = Address.ApiSso.Append("user"); + ((HttpHeaders)client.DefaultRequestHeaders).TryAddWithoutValidation("Authorization", "Bearer " + usuario.TokenSso); + JsonConvert.DeserializeObject(await (await client.GetAsync(uri)).Content.ReadAsStringAsync()); + return true; + } + finally + { + ((IDisposable)client)?.Dispose(); + } + } + + internal async Task BuscarUsuario(string login, string password) + { + int tries = 3; + Token val = new Token(); + string encryptedPassword = val.AggerEncrypt(password); + return await Task.Run((Func)delegate + { + //IL_02a9: Unknown result type (might be due to invalid IL or missing references) + //IL_02af: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + Empresa val2 = read.EmpresaRepository.FindBySerial(ApplicationHelper.NumeroSerial); + AuthSso result = BuscaUsuarioSso(login, encryptedPassword, val2.Documento).Result; + if (result == null || result.Code == 401) + { + return (Usuario)null; + } + Usuario val3; + if (result.Code == 404) + { + val3 = read.UsuarioRepository.ValidateLogin(login, encryptedPassword); + if (val3 == null) + { + return (Usuario)null; + } + val3.TokenSso = result.Data.Token; + UserSso result2 = AddOrUpdateUsuarioSso(val3, val2.Documento).Result; + if (result2 == null) + { + return val3; + } + UnitOfWork commited = Instancia.Commited; + try + { + val3.SsoId = result2.Id; + commited.UsuarioRepository.Merge(val3); + ((GenericUnitOfWork)commited).Commit(); + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + AuthSso result3 = BuscaUsuarioSso(login, encryptedPassword, val2.Documento).Result; + val3.TokenSso = result3.Data.Token; + return val3; + } + val3 = read.UsuarioRepository.SsoId(result) ?? read.UsuarioRepository.FindFromSso(result.Data.User); + if (val3 == null) + { + UnitOfWork commited2 = Instancia.Commited; + try + { + val3 = commited2.UsuarioRepository.AddUsuarioFromSso(result.Data.User); + ((GenericUnitOfWork)commited2).Commit(); + } + finally + { + ((IDisposable)commited2)?.Dispose(); + } + val3.TokenSso = result.Data.Token; + return val3; + } + if (val3.Excluido) + { + UnitOfWork commited3 = Instancia.Commited; + try + { + val3.Excluido = false; + commited3.UsuarioRepository.Merge(val3); + ((GenericUnitOfWork)commited3).Commit(); + } + finally + { + ((IDisposable)commited3)?.Dispose(); + } + } + val3.TokenSso = result.Data.Token; + if (ValidationHelper.IsNotNullOrEmpty(val3.SsoId) && val3.SsoId.Equals(result.Data.User.Id)) + { + return val3; + } + UnitOfWork commited4 = Instancia.Commited; + try + { + val3.SsoId = result.Data.User.Id; + commited4.UsuarioRepository.Merge(val3); + ((GenericUnitOfWork)commited4).Commit(); + } + finally + { + ((IDisposable)commited4)?.Dispose(); + } + return val3; + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)134, tries); + } + } + return new Usuario(); + }); + } + + public async Task> BuscarUsuariosSso() + { + _ = 1; + try + { + HttpClient client = new HttpClient(); + try + { + ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; + Uri uri = Address.ApiSso.Append("user").Append("onlyempresa").Append("list"); + ((HttpHeaders)client.DefaultRequestHeaders).TryAddWithoutValidation("Authorization", "Bearer " + Recursos.Usuario.TokenSso); + HttpResponseMessage val = await client.GetAsync(uri); + return (!val.IsSuccessStatusCode) ? null : JsonConvert.DeserializeObject>(await val.Content.ReadAsStringAsync()); + } + finally + { + ((IDisposable)client)?.Dispose(); + } + } + catch + { + return new List(); + } + } + + public async Task> BuscarParceirosAsync() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new List(from x in read.ParceiroRepository.Find() + orderby ((DomainBase)x).Id + select x); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)72, tries); + } + } + return new List(); + }); + } + + public async Task> BuscarMetaVendedorAsync(Vendedor vendedor) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new List(from x in read.MetaVendedorRepository.Find(((DomainBase)vendedor).Id) + orderby ((DomainBase)x).Id + select x); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)183, tries, vendedor); + } + } + return new List(); + }); + } + + public async Task> BuscarAdiantamentoAsync(Vendedor vendedor) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new List(from x in read.AdiantamentoRepository.Find(((DomainBase)vendedor).Id) + orderby ((DomainBase)x).Id + select x); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)185, tries, vendedor); + } + } + return new List(); + }); + } + + public async Task> BuscarMetaSeguradoraAsync(Seguradora seguradora) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new List(from x in read.MetaSeguradoraRepository.Find(((DomainBase)seguradora).Id) + orderby ((DomainBase)x).Id + select x); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)184, tries, seguradora); + } + } + return new List(); + }); + } + + internal async Task> BuscarUsuarioPorLoginInteiro(string value) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return (from x in read.UsuarioRepository.FindByLoginInteiro(value) + orderby x.Nome + select x).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)134, tries, value); + } + } + return new List(); + }); + } + + internal async Task BuscarUsuarioMesmoDocumento(string value, long id, long idempresa) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.UsuarioRepository.FindDocUsedByDocumento(value, id, idempresa); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)134, tries, value); + } + } + return false; + }); + } + + public async Task> BuscarProduto(string value) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return (from x in read.ProdutoRepository.Find(value) + orderby x.Nome + select x).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)117, tries, value); + } + } + return new List(); + }); + } + + public async Task> BuscarStatus(string value) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return (from x in read.StatusRepository.Find(value) + orderby x.Nome + select x).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)120, tries, value); + } + } + return new List(); + }); + } + + public async Task> BuscarRamosAsync() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new List(from x in read.RamoRepository.Find() + orderby x.Nome + select x); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)169, tries); + } + } + return new List(); + }); + } + + public async Task BuscarQualificacaoAsync() + { + int tries = 3; + return await Task.Run((Func)delegate + { + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_0054: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.QualificacaoRepository.FindById(1L); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)170, tries); + } + } + return new Qualificacao(); + }); + } + + public async Task> BuscarSeguradorasAsync() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new List(from x in read.SeguradoraRepository.Find() + orderby ((DomainBase)x).Id + select x); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)127, tries); + } + } + return new List(); + }); + } + + public async Task> BuscarAgendasAsync() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new List(from x in read.AgendaRepository.Find() + orderby ((DomainBase)x).Id + select x); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)129, tries); + } + } + return new List(); + }); + } + + public async Task> BuscarVendedoresAsync() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new List(from x in read.VendedorRepository.Find((Recursos.Usuario.IdEmpresa == 1) ? 0 : Recursos.Usuario.IdEmpresa) + orderby ((DomainBase)x).Id + select x); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)140, tries); + } + } + return new List(); + }); + } + + public async Task> BuscarTipoVendedoresAsync() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return (from x in read.TipoVendedorRepository.Find() + orderby ((DomainBase)x).Id + select x).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)141, tries); + } + } + return new List(); + }); + } + + public async Task> BuscarProdutosAsync() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new List(from x in read.ProdutoRepository.Find() + orderby x.Nome + select x); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)118, tries); + } + } + return new List(); + }); + } + + public async Task> BuscarStatusAsync() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new List(from x in read.StatusRepository.Find() + orderby x.Nome + select x); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)121, tries); + } + } + return new List(); + }); + } + + internal async Task> BuscaCoberturas() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return (from x in read.CoberturaPadraoRepository.Find() + orderby x.Descricao + select x).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)58, tries); + } + } + return new List(); + }); + } + + public async Task LoadInicialParameters() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + Recursos.Parceiros = new List(from x in read.ParceiroRepository.Find() + orderby ((DomainBase)x).Id + select x); + Recursos.Fabricantes = (from x in read.FabricanteRepository.Select() + orderby x.Descricao + select x).ToList(); + Recursos.Configuracoes = read.ConfiguracaoRepository.BuscarConfiguracoes(); + read.CriarAuxiliar(false); + Recursos.Empresas = Auxiliar.Empresas; + Recursos.Ramos = Auxiliar.Ramos; + Recursos.Seguradoras = Auxiliar.Seguradoras; + Recursos.Produtos = Auxiliar.Produtos; + Recursos.Status = Auxiliar.StatusApolice; + Recursos.TipoVendedor = Auxiliar.TipoVendedores; + Recursos.Estipulantes = Auxiliar.Estipulantes; + Recursos.Vendedores = Auxiliar.Vendedores; + Recursos.Usuarios = Auxiliar.Usuarios; + Recursos.TiposTarefa = Auxiliar.TiposTarefa; + Recursos.StatusProspeccao = Auxiliar.StatusProspeccao; + Recursos.Coberturas = Auxiliar.CoberturasPadrao; + } + finally + { + ((IDisposable)read)?.Dispose(); + } + return true; + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)186, tries); + } + } + return false; + }); + } + + public async Task ReloadAuxiliar() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + read.CriarAuxiliar(true); + Recursos.Empresas = Auxiliar.Empresas; + Recursos.Ramos = Auxiliar.Ramos; + Recursos.Seguradoras = Auxiliar.Seguradoras; + Recursos.Produtos = Auxiliar.Produtos; + Recursos.Status = Auxiliar.StatusApolice; + Recursos.TipoVendedor = Auxiliar.TipoVendedores; + Recursos.Estipulantes = Auxiliar.Estipulantes; + Recursos.Vendedores = Auxiliar.Vendedores; + Recursos.Usuarios = Auxiliar.Usuarios; + Recursos.TiposTarefa = Auxiliar.TiposTarefa; + Recursos.StatusProspeccao = Auxiliar.StatusProspeccao; + } + finally + { + ((IDisposable)read)?.Dispose(); + } + return true; + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)186, tries); + } + } + return false; + }); + } + + public async Task> BuscarDocumentosPorEstipulante(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.DocumentoRepository.BuscarDocumentoPorEstipulante(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)11, tries, id); + } + } + return new List(); + }); + } + + public async Task> BuscarDocumentosPorStatus(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.DocumentoRepository.BuscarDocumentoPorStatus(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)12, tries, id); + } + } + return new List(); + }); + } + + public async Task TipoVendedorUtilizado(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.VendedorParcelaRepository.TipoVendedorUtilizado(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)155, tries, id); + } + } + return false; + }); + } + + public async Task BancosContasUtilizado(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.LancamentoRepository.BancosContasUtilizado(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)155, tries, id); + } + } + return false; + }); + } + + public async Task ParceiroUtilizado(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.SinistroAutoRepository.ParceiroUtilizado(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)156, tries, id); + } + } + return false; + }); + } + + public async Task> BuscarCredenciais() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.CredencialRepository.Find(((DomainBase)Recursos.Empresa).Id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)187, tries); + } + } + return new List(); + }); + } + + public async Task> BuscarCentroAsync() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return (from x in read.CentroRepository.Find() + orderby x.Descricao + select x).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)153, tries); + } + } + return new List(); + }); + } + + public async Task> BuscarPlanoAsync() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new List(from x in read.PlanoRepository.Find() + orderby x.Descricao + select x); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)167, tries); + } + } + return new List(); + }); + } + + public async Task> BuscarPlanosAsync() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new List(read.PlanosRepository.Find()); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)168, tries); + } + } + return new List(); + }); + } + + public async Task> BuscarFornecedor(string value, bool ativo = false) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return (from x in read.FornecedorRepository.Find(value, ativo) + orderby x.Nome + select x).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)159, tries, value); + } + } + return new List(); + }); + } + + public async Task> BuscarFornecedor() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return (from x in read.FornecedorRepository.Find() + orderby x.Nome + select x).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)166, tries); + } + } + return new List(); + }); + } + + public async Task ArquivoDigital() + { + int tries = 3; + return await Task.Run((Func)delegate + { + //IL_004c: Unknown result type (might be due to invalid IL or missing references) + //IL_0052: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.IndiceArquivoDigitalRepository.BuscarBanco(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)188, tries); + } + } + return new ControleArquivoDigital(); + }); + } + + public async Task ArquivoDigital(string banco) + { + int tries = 3; + return await Task.Run((Func)delegate + { + //IL_0057: Unknown result type (might be due to invalid IL or missing references) + //IL_005d: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.IndiceArquivoDigitalRepository.ConsultarBanco(banco); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)188, tries, banco); + } + } + return new ControleArquivoDigital(); + }); + } + + public async Task SalvarControle(ControleArquivoDigital controle) + { + int tries = 3; + await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork commited = Instancia.Commited; + try + { + commited.IndiceArquivoDigitalRepository.SaveOrUpdate(controle); + ((GenericUnitOfWork)commited).Commit(); + break; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)179, tries, controle); + } + } + }); + } + + public async Task BuscarControle() + { + return await Task.Run((Func)delegate + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.IndiceArquivoDigitalRepository.BuscarBanco(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception) + { + return (ControleArquivoDigital)null; + } + }); + } + + public async Task> BuscarEstipulantes() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + Recursos.Estipulantes = read.EstipulanteRepository.Find(); + return Recursos.Estipulantes; + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)186, tries); + } + } + return Recursos.Estipulantes; + }); + } + + public async Task Sincronizar(List dados, Filtros filtros) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork commited = Instancia.Commited; + try + { + int result = commited.VinculoDocumentoRepository.Sincronize(filtros.Inicio, dados); + ((GenericUnitOfWork)commited).Commit(); + return result; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)293, tries); + } + } + return 0; + }); + } + + public async Task Sincronizar(DateTime data, List ids = null) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork commited = Instancia.Commited; + try + { + int[] result = commited.ParcelaRepository.SincronizarPendencia(data, ids); + ((GenericUnitOfWork)commited).Commit(); + return result; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)300, tries, false); + } + } + return new int[2]; + }); + } + + public async Task> ArquivoVinculo(List ids, TipoArquivoVinculo type) + { + //IL_001e: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + int tries = 3; + return await Task.Run(delegate + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.VinculoDocumentoRepository.BuscarArquivos(ids, type); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)293, tries); + } + } + return (List)null; + }); + } + + internal async Task> BuscarClienteEmpresa(string value) + { + if (string.IsNullOrWhiteSpace(value)) + { + return new List(); + } + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + List list = (from x in read.ClienteRepository.Find(value, 0L, false, false) + orderby x.Nome + select x).ToList(); + list.AddRange((from x in read.EmpresaRepository.FindAsCliente(value) + orderby x.Nome + select x).ToList()); + return list; + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)29, tries, value); + } + } + return new List(); + }); + } + + public async Task BuscarParcelaPendente(long id) + { + int tries = 3; + return await Task.Run((Func)delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ParcelaRepository.BuscarPendencia(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)299, tries, id); + } + } + return (ParcelaPendente)null; + }); + } + + public void SalvarAcao(RegistroAcao log, object obs = null) + { + //IL_00af: Unknown result type (might be due to invalid IL or missing references) + //IL_00b4: Unknown result type (might be due to invalid IL or missing references) + //IL_00c0: Expected O, but got Unknown + if (log == null || ((DomainBase)Recursos.Usuario).Id == 0L) + { + return; + } + try + { + UnitOfWork commited = Instancia.Commited; + try + { + log.Usuario = Recursos.Usuario; + log.DataHora = Funcoes.GetNetworkTime(); + log.Versao = LoginViewModel.VersaoAtual; + log.NomeMaquina = Environment.MachineName; + log.UsuarioMaquina = Environment.UserName; + log.Ip = Dns.GetHostEntry(Dns.GetHostName()).AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString(); + log.Observacao = ((obs == null) ? "" : ((!(obs is string)) ? JsonConvert.SerializeObject(obs, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }) : obs.ToString())); + commited.RegistroAcaoRepository.SaveOrUpdate(log); + ((GenericUnitOfWork)commited).Commit(); + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + Registrar(e, (TipoErro)0, 3, log); + } + } + + public async Task> CarregarUsuarios() + { + await AtualizarUsuarios(); + return await BuscarUsuariosAsync(); + } + + private async Task AtualizarUsuarios() + { + _ = 1; + try + { + if (ValidationHelper.IsNullOrEmpty(Recursos.Usuario.TokenSso)) + { + return; + } + List ssoUsuarios = await BuscarUsuariosSso(); + if ((ssoUsuarios != null && ssoUsuarios.Count == 0) || ssoUsuarios == null) + { + return; + } + List source = await BuscarUsuariosAsync(); + foreach (UserSso ssoUsuario in ssoUsuarios) + { + Usuario val = ((IEnumerable)source).FirstOrDefault((Func)((Usuario u) => (u.SsoId != null) ? (ssoUsuario.Id == u.SsoId) : (u.Login == ssoUsuario.Username))); + if (val != null && (ssoUsuario.IsDeleted != val.Excluido || ValidationHelper.NotEquals(ssoUsuario.Password, val.Senha) || ValidationHelper.NotEquals(ssoUsuario.Name, val.Nome) || (ValidationHelper.IsNotNullOrEmpty(ssoUsuario.Email) && ValidationHelper.NotEquals(ssoUsuario.Email, val.Email)) || (ValidationHelper.IsNotNullOrEmpty(ssoUsuario.Document) && ValidationHelper.NotEquals(ssoUsuario.Document, val.Documento.Clear())) || (ValidationHelper.IsNotNullOrEmpty(ssoUsuario.Phone) && ValidationHelper.NotEquals(ssoUsuario.Phone, (val.Prefixo + val.Telefone).Clear())) || ValidationHelper.IsNullOrEmpty(val.SsoId))) + { + string phone = ssoUsuario.Phone; + val.Nome = ssoUsuario.Name; + val.Documento = ssoUsuario.Document; + if (ValidationHelper.IsNotNullOrEmpty(phone) && phone.Length > 3) + { + val.Prefixo = phone.Substring(0, 2); + val.Telefone = phone.Substring(2, phone.Length - 2); + } + val.Login = ssoUsuario.Username; + val.Senha = ssoUsuario.Password; + val.Email = ssoUsuario.Email; + val.Excluido = ssoUsuario.IsDeleted; + val.SsoId = ssoUsuario.Id; + UnitOfWork commited = Instancia.Commited; + try + { + commited.UsuarioRepository.Merge(val); + ((GenericUnitOfWork)commited).Commit(); + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + if (val != null) + { + continue; + } + UnitOfWork read = Instancia.Read; + try + { + Empresa val2 = read.EmpresaRepository.FindByDocumento(ssoUsuario.CustomerDocument); + val = new Usuario + { + IdEmpresa = ((DomainBase)val2).Id, + Nome = ssoUsuario.Name, + Documento = ssoUsuario.Document, + Login = ssoUsuario.Username, + Senha = ssoUsuario.Password, + Email = ssoUsuario.Email, + SsoId = ssoUsuario.Id, + Excluido = ssoUsuario.IsDeleted, + Administrador = false, + PermissaoAggilizador = 1L + }; + string phone2 = ssoUsuario.Phone; + if (ValidationHelper.IsNotNullOrEmpty(phone2) && phone2.Length > 3) + { + val.Prefixo = phone2.Substring(0, 2); + val.Telefone = phone2.Substring(2, phone2.Length - 2); + } + } + finally + { + ((IDisposable)read)?.Dispose(); + } + UnitOfWork commited2 = Instancia.Commited; + try + { + commited2.UsuarioRepository.SaveOrUpdate(val); + ((GenericUnitOfWork)commited2).Commit(); + } + finally + { + ((IDisposable)commited2)?.Dispose(); + } + } + } + catch (Exception e) + { + Registrar(e, (TipoErro)239, 1); + } + } + + private static async Task AtualizaUsuariosSso(List usuarios) + { + usuarios = usuarios.Where((Usuario usuario) => !usuario.Excluido)?.ToList(); + foreach (Usuario usuarioBanco in usuarios) + { + new UserSso + { + Name = usuarioBanco.Nome, + Username = usuarioBanco.Login, + Password = usuarioBanco.Senha, + Email = usuarioBanco.Email, + Phone = usuarioBanco.Telefone, + IsDeleted = usuarioBanco.Excluido, + Id = usuarioBanco.SsoId + }; + string documento = ((IEnumerable)Recursos.Empresas).FirstOrDefault((Func)((Empresa x) => ((DomainBase)x).Id == usuarioBanco.IdEmpresa)).Documento; + await new BaseServico().AddOrUpdateUsuarioSso(usuarioBanco, documento, usuarioBanco.SsoId); + } + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Seguros.Itens/AeronauticoServico.cs b/Decompiler/Gestor.Application.Servicos.Seguros.Itens/AeronauticoServico.cs new file mode 100644 index 0000000..8e32f88 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Seguros.Itens/AeronauticoServico.cs @@ -0,0 +1,118 @@ +using System; +using System.Linq; +using System.Net; +using System.Net.Sockets; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Newtonsoft.Json; + +namespace Gestor.Application.Servicos.Seguros.Itens; + +internal class AeronauticoServico : BaseServico +{ + public async Task Save(Aeronautico aeronautico) + { + return await Task.Run((Func)delegate + { + try + { + UnitOfWork commited = Instancia.Commited; + try + { + aeronautico = ((((DomainBase)aeronautico).Id == 0L) ? commited.AeronauticoRepository.SaveOrUpdate(aeronautico) : commited.AeronauticoRepository.Merge(aeronautico)); + ((GenericUnitOfWork)commited).Commit(); + return aeronautico; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception) + { + return (Aeronautico)null; + } + }); + } + + public async Task Delete(Item item) + { + int tries = 3; + return await Task.Run(delegate + { + //IL_009b: Unknown result type (might be due to invalid IL or missing references) + //IL_00a0: Unknown result type (might be due to invalid IL or missing references) + //IL_00a7: Unknown result type (might be due to invalid IL or missing references) + //IL_00b2: Unknown result type (might be due to invalid IL or missing references) + //IL_00b9: Unknown result type (might be due to invalid IL or missing references) + //IL_00c0: Unknown result type (might be due to invalid IL or missing references) + //IL_00c5: Unknown result type (might be due to invalid IL or missing references) + //IL_00d1: Expected O, but got Unknown + //IL_00d6: Unknown result type (might be due to invalid IL or missing references) + //IL_00f4: Unknown result type (might be due to invalid IL or missing references) + //IL_00fb: Unknown result type (might be due to invalid IL or missing references) + //IL_0106: Unknown result type (might be due to invalid IL or missing references) + //IL_0111: Unknown result type (might be due to invalid IL or missing references) + //IL_011c: Unknown result type (might be due to invalid IL or missing references) + //IL_0159: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork commited = Instancia.Commited; + try + { + if (item.Aeronautico != null && ((DomainBase)item.Aeronautico).Id > 0) + { + commited.AeronauticoRepository.Delete(((DomainBase)item.Aeronautico).Id); + } + commited.CoberturaRepository.DeletebyItem(((DomainBase)item).Id); + commited.ControleSinistroRepository.DeleteByItem(((DomainBase)item).Id); + commited.ItemRepository.Delete(((DomainBase)item).Id); + DateTime networkTime = Funcoes.GetNetworkTime(); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog val = new RegistroLog + { + Acao = (TipoAcao)2, + Usuario = Recursos.Usuario, + DataHora = networkTime, + Descricao = JsonConvert.SerializeObject((object)item, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }) + }; + Aeronautico aeronautico = item.Aeronautico; + val.EntidadeId = ((aeronautico != null) ? ((DomainBase)aeronautico).Id : 0); + val.Tela = (TipoTela)3; + val.Versao = LoginViewModel.VersaoAtual; + val.NomeMaquina = Environment.MachineName; + val.UsuarioMaquina = Environment.UserName; + val.Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString(); + RegistroLog keyValues = val; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)203, tries, item); + } + } + return false; + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Seguros.Itens/AutoServico.cs b/Decompiler/Gestor.Application.Servicos.Seguros.Itens/AutoServico.cs new file mode 100644 index 0000000..d3adcbc --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Seguros.Itens/AutoServico.cs @@ -0,0 +1,286 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Sockets; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Newtonsoft.Json; + +namespace Gestor.Application.Servicos.Seguros.Itens; + +internal class AutoServico : BaseServico +{ + internal async Task BuscarAuto(string value, long id, DateTime vigencia1, DateTime? vigencia2, long idSeguradora) + { + int tries = 3; + return await Task.Run((Func)delegate + { + //IL_0077: Unknown result type (might be due to invalid IL or missing references) + //IL_007d: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.AutoRepository.FindByChassi(value, id, vigencia1, vigencia2, idSeguradora); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)50, tries, new { value, id }); + } + } + return new Documento(); + }); + } + + public async Task Save(Auto auto) + { + return await Task.Run((Func)delegate + { + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + //IL_005a: Unknown result type (might be due to invalid IL or missing references) + //IL_005f: Unknown result type (might be due to invalid IL or missing references) + //IL_0060: Unknown result type (might be due to invalid IL or missing references) + //IL_0066: Unknown result type (might be due to invalid IL or missing references) + //IL_0071: Unknown result type (might be due to invalid IL or missing references) + //IL_007c: Unknown result type (might be due to invalid IL or missing references) + //IL_0083: Unknown result type (might be due to invalid IL or missing references) + //IL_0088: Unknown result type (might be due to invalid IL or missing references) + //IL_0094: Expected O, but got Unknown + //IL_0099: Unknown result type (might be due to invalid IL or missing references) + //IL_00aa: Unknown result type (might be due to invalid IL or missing references) + //IL_00b1: Unknown result type (might be due to invalid IL or missing references) + //IL_00bc: Unknown result type (might be due to invalid IL or missing references) + //IL_00c7: Unknown result type (might be due to invalid IL or missing references) + //IL_00d2: Unknown result type (might be due to invalid IL or missing references) + //IL_010f: Expected O, but got Unknown + try + { + UnitOfWork commited = Instancia.Commited; + try + { + TipoAcao acao = (TipoAcao)(((DomainBase)auto).Id != 0L); + auto = ((((DomainBase)auto).Id == 0L) ? commited.AutoRepository.SaveOrUpdate(auto) : commited.AutoRepository.Merge(auto)); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog keyValues = new RegistroLog + { + Acao = acao, + Usuario = Recursos.Usuario, + DataHora = Funcoes.GetNetworkTime(), + Descricao = JsonConvert.SerializeObject((object)auto, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)auto).Id, + Tela = (TipoTela)3, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return auto; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception) + { + return (Auto)null; + } + }); + } + + public async Task Delete(Item item) + { + int tries = 3; + return await Task.Run(delegate + { + //IL_009b: Unknown result type (might be due to invalid IL or missing references) + //IL_00a0: Unknown result type (might be due to invalid IL or missing references) + //IL_00a7: Unknown result type (might be due to invalid IL or missing references) + //IL_00b2: Unknown result type (might be due to invalid IL or missing references) + //IL_00b9: Unknown result type (might be due to invalid IL or missing references) + //IL_00c0: Unknown result type (might be due to invalid IL or missing references) + //IL_00c5: Unknown result type (might be due to invalid IL or missing references) + //IL_00d1: Expected O, but got Unknown + //IL_00d6: Unknown result type (might be due to invalid IL or missing references) + //IL_00f4: Unknown result type (might be due to invalid IL or missing references) + //IL_00fb: Unknown result type (might be due to invalid IL or missing references) + //IL_0106: Unknown result type (might be due to invalid IL or missing references) + //IL_0111: Unknown result type (might be due to invalid IL or missing references) + //IL_011c: Unknown result type (might be due to invalid IL or missing references) + //IL_0159: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork commited = Instancia.Commited; + try + { + if (item.Auto != null && ((DomainBase)item.Auto).Id > 0) + { + commited.AutoRepository.Delete(((DomainBase)item.Auto).Id); + } + commited.CoberturaRepository.DeletebyItem(((DomainBase)item).Id); + commited.ControleSinistroRepository.DeleteByItem(((DomainBase)item).Id); + commited.ItemRepository.Delete(((DomainBase)item).Id); + DateTime networkTime = Funcoes.GetNetworkTime(); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog val = new RegistroLog + { + Acao = (TipoAcao)2, + Usuario = Recursos.Usuario, + DataHora = networkTime, + Descricao = JsonConvert.SerializeObject((object)item, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }) + }; + Auto auto = item.Auto; + val.EntidadeId = ((auto != null) ? ((DomainBase)auto).Id : 0); + val.Tela = (TipoTela)3; + val.Versao = LoginViewModel.VersaoAtual; + val.NomeMaquina = Environment.MachineName; + val.UsuarioMaquina = Environment.UserName; + val.Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString(); + RegistroLog keyValues = val; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)205, tries, item); + } + } + return false; + }); + } + + internal async Task> BuscarPlaca(string placa, FiltroStatusDocumento status, List vendedorVinculado, bool tipobusca = false) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + return await Task.Run(delegate + { + //IL_0013: Unknown result type (might be due to invalid IL or missing references) + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.AutoRepository.FindAuto(placa, status, vendedorVinculado, (TipoPesquisa)14, tipobusca); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception) + { + return (List)null; + } + }); + } + + internal async Task> BuscarChassi(string chassi, FiltroStatusDocumento status, List vendedorVinculado, bool tipobusca = false) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + return await Task.Run(delegate + { + //IL_0013: Unknown result type (might be due to invalid IL or missing references) + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.AutoRepository.FindAuto(chassi, status, vendedorVinculado, (TipoPesquisa)0, tipobusca); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception) + { + return (List)null; + } + }); + } + + public async Task> BuscarItem(string item, FiltroStatusDocumento status, List vendedorVinculado, bool tipobusca = false) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + return await Task.Run(delegate + { + //IL_0013: Unknown result type (might be due to invalid IL or missing references) + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.AutoRepository.FindAuto(item, status, vendedorVinculado, (TipoPesquisa)6, tipobusca); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception) + { + return (List)null; + } + }); + } + + public async Task BuscarChassi(long id) + { + return await Task.Run(delegate + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.AutoRepository.FindChassi(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception) + { + return (string)null; + } + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Seguros.Itens/ConsorcioServico.cs b/Decompiler/Gestor.Application.Servicos.Seguros.Itens/ConsorcioServico.cs new file mode 100644 index 0000000..b3bffbf --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Seguros.Itens/ConsorcioServico.cs @@ -0,0 +1,154 @@ +using System; +using System.Linq; +using System.Net; +using System.Net.Sockets; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Newtonsoft.Json; + +namespace Gestor.Application.Servicos.Seguros.Itens; + +internal class ConsorcioServico : BaseServico +{ + public async Task Save(Consorcio Consorcio) + { + return await Task.Run((Func)delegate + { + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + //IL_005a: Unknown result type (might be due to invalid IL or missing references) + //IL_005f: Unknown result type (might be due to invalid IL or missing references) + //IL_0060: Unknown result type (might be due to invalid IL or missing references) + //IL_0066: Unknown result type (might be due to invalid IL or missing references) + //IL_0071: Unknown result type (might be due to invalid IL or missing references) + //IL_007c: Unknown result type (might be due to invalid IL or missing references) + //IL_0083: Unknown result type (might be due to invalid IL or missing references) + //IL_0088: Unknown result type (might be due to invalid IL or missing references) + //IL_0094: Expected O, but got Unknown + //IL_0099: Unknown result type (might be due to invalid IL or missing references) + //IL_00aa: Unknown result type (might be due to invalid IL or missing references) + //IL_00b1: Unknown result type (might be due to invalid IL or missing references) + //IL_00bc: Unknown result type (might be due to invalid IL or missing references) + //IL_00c7: Unknown result type (might be due to invalid IL or missing references) + //IL_00d2: Unknown result type (might be due to invalid IL or missing references) + //IL_010f: Expected O, but got Unknown + try + { + UnitOfWork commited = Instancia.Commited; + try + { + TipoAcao acao = (TipoAcao)(((DomainBase)Consorcio).Id != 0L); + Consorcio = ((((DomainBase)Consorcio).Id == 0L) ? commited.ConsorcioRepository.SaveOrUpdate(Consorcio) : commited.ConsorcioRepository.Merge(Consorcio)); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog keyValues = new RegistroLog + { + Acao = acao, + Usuario = Recursos.Usuario, + DataHora = Funcoes.GetNetworkTime(), + Descricao = JsonConvert.SerializeObject((object)Consorcio, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)Consorcio).Id, + Tela = (TipoTela)3, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return Consorcio; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception) + { + return (Consorcio)null; + } + }); + } + + public async Task Delete(Item item) + { + int tries = 3; + return await Task.Run(delegate + { + //IL_009b: Unknown result type (might be due to invalid IL or missing references) + //IL_00a0: Unknown result type (might be due to invalid IL or missing references) + //IL_00a7: Unknown result type (might be due to invalid IL or missing references) + //IL_00b2: Unknown result type (might be due to invalid IL or missing references) + //IL_00b9: Unknown result type (might be due to invalid IL or missing references) + //IL_00c0: Unknown result type (might be due to invalid IL or missing references) + //IL_00c5: Unknown result type (might be due to invalid IL or missing references) + //IL_00d1: Expected O, but got Unknown + //IL_00d6: Unknown result type (might be due to invalid IL or missing references) + //IL_00f4: Unknown result type (might be due to invalid IL or missing references) + //IL_00fb: Unknown result type (might be due to invalid IL or missing references) + //IL_0106: Unknown result type (might be due to invalid IL or missing references) + //IL_0111: Unknown result type (might be due to invalid IL or missing references) + //IL_011c: Unknown result type (might be due to invalid IL or missing references) + //IL_0159: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork commited = Instancia.Commited; + try + { + if (item.Consorcio != null && ((DomainBase)item.Consorcio).Id > 0) + { + commited.ConsorcioRepository.Delete(((DomainBase)item.Consorcio).Id); + } + commited.CoberturaRepository.DeletebyItem(((DomainBase)item).Id); + commited.ControleSinistroRepository.DeleteByItem(((DomainBase)item).Id); + commited.ItemRepository.Delete(((DomainBase)item).Id); + DateTime networkTime = Funcoes.GetNetworkTime(); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog val = new RegistroLog + { + Acao = (TipoAcao)2, + Usuario = Recursos.Usuario, + DataHora = networkTime, + Descricao = JsonConvert.SerializeObject((object)item, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }) + }; + Consorcio consorcio = item.Consorcio; + val.EntidadeId = ((consorcio != null) ? ((DomainBase)consorcio).Id : 0); + val.Tela = (TipoTela)3; + val.Versao = LoginViewModel.VersaoAtual; + val.NomeMaquina = Environment.MachineName; + val.UsuarioMaquina = Environment.UserName; + val.Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString(); + RegistroLog keyValues = val; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)332, tries); + } + } + return false; + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Seguros.Itens/GranizoServico.cs b/Decompiler/Gestor.Application.Servicos.Seguros.Itens/GranizoServico.cs new file mode 100644 index 0000000..d9ec595 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Seguros.Itens/GranizoServico.cs @@ -0,0 +1,154 @@ +using System; +using System.Linq; +using System.Net; +using System.Net.Sockets; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Newtonsoft.Json; + +namespace Gestor.Application.Servicos.Seguros.Itens; + +internal class GranizoServico : BaseServico +{ + public async Task Save(Granizo granizo) + { + return await Task.Run((Func)delegate + { + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + //IL_005a: Unknown result type (might be due to invalid IL or missing references) + //IL_005f: Unknown result type (might be due to invalid IL or missing references) + //IL_0060: Unknown result type (might be due to invalid IL or missing references) + //IL_0066: Unknown result type (might be due to invalid IL or missing references) + //IL_0071: Unknown result type (might be due to invalid IL or missing references) + //IL_007c: Unknown result type (might be due to invalid IL or missing references) + //IL_0083: Unknown result type (might be due to invalid IL or missing references) + //IL_0088: Unknown result type (might be due to invalid IL or missing references) + //IL_0094: Expected O, but got Unknown + //IL_0099: Unknown result type (might be due to invalid IL or missing references) + //IL_00aa: Unknown result type (might be due to invalid IL or missing references) + //IL_00b1: Unknown result type (might be due to invalid IL or missing references) + //IL_00bc: Unknown result type (might be due to invalid IL or missing references) + //IL_00c7: Unknown result type (might be due to invalid IL or missing references) + //IL_00d2: Unknown result type (might be due to invalid IL or missing references) + //IL_010f: Expected O, but got Unknown + try + { + UnitOfWork commited = Instancia.Commited; + try + { + TipoAcao acao = (TipoAcao)(((DomainBase)granizo).Id != 0L); + granizo = ((((DomainBase)granizo).Id == 0L) ? commited.GranizoRepository.SaveOrUpdate(granizo) : commited.GranizoRepository.Merge(granizo)); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog keyValues = new RegistroLog + { + Acao = acao, + Usuario = Recursos.Usuario, + DataHora = Funcoes.GetNetworkTime(), + Descricao = JsonConvert.SerializeObject((object)granizo, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)granizo).Id, + Tela = (TipoTela)3, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return granizo; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception) + { + return (Granizo)null; + } + }); + } + + public async Task Delete(Item item) + { + int tries = 3; + return await Task.Run(delegate + { + //IL_009b: Unknown result type (might be due to invalid IL or missing references) + //IL_00a0: Unknown result type (might be due to invalid IL or missing references) + //IL_00a7: Unknown result type (might be due to invalid IL or missing references) + //IL_00b2: Unknown result type (might be due to invalid IL or missing references) + //IL_00b9: Unknown result type (might be due to invalid IL or missing references) + //IL_00c0: Unknown result type (might be due to invalid IL or missing references) + //IL_00c5: Unknown result type (might be due to invalid IL or missing references) + //IL_00d1: Expected O, but got Unknown + //IL_00d6: Unknown result type (might be due to invalid IL or missing references) + //IL_00f4: Unknown result type (might be due to invalid IL or missing references) + //IL_00fb: Unknown result type (might be due to invalid IL or missing references) + //IL_0106: Unknown result type (might be due to invalid IL or missing references) + //IL_0111: Unknown result type (might be due to invalid IL or missing references) + //IL_011c: Unknown result type (might be due to invalid IL or missing references) + //IL_0159: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork commited = Instancia.Commited; + try + { + if (item.Granizo != null && ((DomainBase)item.Granizo).Id > 0) + { + commited.GranizoRepository.Delete(((DomainBase)item.Granizo).Id); + } + commited.CoberturaRepository.DeletebyItem(((DomainBase)item).Id); + commited.ControleSinistroRepository.DeleteByItem(((DomainBase)item).Id); + commited.ItemRepository.Delete(((DomainBase)item).Id); + DateTime networkTime = Funcoes.GetNetworkTime(); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog val = new RegistroLog + { + Acao = (TipoAcao)2, + Usuario = Recursos.Usuario, + DataHora = networkTime, + Descricao = JsonConvert.SerializeObject((object)item, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }) + }; + Granizo granizo = item.Granizo; + val.EntidadeId = ((granizo != null) ? ((DomainBase)granizo).Id : 0); + val.Tela = (TipoTela)3; + val.Versao = LoginViewModel.VersaoAtual; + val.NomeMaquina = Environment.MachineName; + val.UsuarioMaquina = Environment.UserName; + val.Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString(); + RegistroLog keyValues = val; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)207, tries, item); + } + } + return false; + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Seguros.Itens/ItemServico.cs b/Decompiler/Gestor.Application.Servicos.Seguros.Itens/ItemServico.cs new file mode 100644 index 0000000..d028b46 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Seguros.Itens/ItemServico.cs @@ -0,0 +1,1624 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Net.Sockets; +using System.Text; +using System.Threading.Tasks; +using Agger.Registro; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels; +using Gestor.Common.Validation; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Newtonsoft.Json; + +namespace Gestor.Application.Servicos.Seguros.Itens; + +public class ItemServico : BaseServico +{ + private const string GuidGestorFipe = "bbbf4f03-01fc-4300-b430-33e007753578"; + + internal async Task BuscarItemPorIdAsync(long id) + { + int tries = 3; + return await Task.Run((Func)delegate + { + //IL_0059: Unknown result type (might be due to invalid IL or missing references) + //IL_005f: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ItemRepository.FindById(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)51, tries, id); + } + } + return new Item(); + }); + } + + internal async Task> BuscarItems(long id, StatusItem status = 2, bool sinsitroCompleto = false) + { + //IL_001e: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + int tries = 3; + return await Task.Run(delegate + { + //IL_0050: Unknown result type (might be due to invalid IL or missing references) + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new ObservableCollection(read.ItemRepository.FindByDocumentsIds(id, status, sinsitroCompleto)); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)52, tries, new { id, status }); + } + } + return new ObservableCollection(); + }); + } + + internal async Task> BuscarItems(List ids) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ItemRepository.FindByIds(ids); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)52, tries, ids); + } + } + return new List(); + }); + } + + public async Task BuscarProximoItem(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ItemRepository.FindNextItem(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)54, tries, id); + } + } + return 0; + }); + } + + internal async Task BuscaAuto(long id) + { + int tries = 3; + return await Task.Run((Func)delegate + { + //IL_0059: Unknown result type (might be due to invalid IL or missing references) + //IL_005f: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.AutoRepository.Find(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)55, tries, id); + } + } + return new Auto(); + }); + } + + internal async Task BuscaGranizo(long id) + { + int tries = 3; + return await Task.Run((Func)delegate + { + //IL_0059: Unknown result type (might be due to invalid IL or missing references) + //IL_005f: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.GranizoRepository.Find(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)56, tries, id); + } + } + return new Granizo(); + }); + } + + internal async Task> BuscarCoberturasPorItemAsync(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new ObservableCollection(read.CoberturaRepository.FindByItemId(id)); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)57, tries, id); + } + } + return new ObservableCollection(); + }); + } + + public async Task BuscaPatrimonial(long id) + { + int tries = 3; + return await Task.Run((Func)delegate + { + //IL_0059: Unknown result type (might be due to invalid IL or missing references) + //IL_005f: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.PatrimonialRepository.Find(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)59, tries, id); + } + } + return new Patrimonial(); + }); + } + + public async Task BuscaVida(long id) + { + int tries = 3; + return await Task.Run((Func)delegate + { + //IL_0059: Unknown result type (might be due to invalid IL or missing references) + //IL_005f: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.VidaRepository.Find(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)60, tries, id); + } + } + return new Vida(); + }); + } + + public async Task> BuscaTitularesVida(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.TitularesVidaRepository.Find(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)61, tries, id); + } + } + return new List(); + }); + } + + public async Task BuscaRiscosDiversos(long id) + { + int tries = 3; + return await Task.Run((Func)delegate + { + //IL_0059: Unknown result type (might be due to invalid IL or missing references) + //IL_005f: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.RiscosDiversosRepository.Find(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)62, tries, id); + } + } + return new RiscosDiversos(); + }); + } + + public async Task BuscaAeronautico(long id) + { + int tries = 3; + return await Task.Run((Func)delegate + { + //IL_0059: Unknown result type (might be due to invalid IL or missing references) + //IL_005f: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.AeronauticoRepository.Find(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)63, tries, id); + } + } + return new Aeronautico(); + }); + } + + public async Task BuscaConsorcio(long id) + { + int tries = 3; + return await Task.Run((Func)delegate + { + //IL_005c: Unknown result type (might be due to invalid IL or missing references) + //IL_0062: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ConsorcioRepository.Find(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)330, tries, id); + } + } + return new Consorcio(); + }); + } + + public async Task BuscarModelo(string fipe) + { + try + { + return await FipeCode(fipe); + } + catch (Exception) + { + return null; + } + } + + public async Task> BuscarPorModelo(string modelo) + { + try + { + return await FipeModel(modelo); + } + catch (Exception) + { + return null; + } + } + + private async Task FipeCode(string code) + { + HttpClient client = new HttpClient(); + try + { + ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; + string text = await FipeAuthentication(); + if (ValidationHelper.IsNotNullOrEmpty(text)) + { + ((HttpHeaders)client.DefaultRequestHeaders).TryAddWithoutValidation("Authorization", "Bearer " + text); + } + Uri uri = Address.ApiFipe.Append("v1").Append("fipe").AddQuery("fipeCode", code); + HttpResponseMessage val = await client.GetAsync(uri); + return (Fipe)((!val.IsSuccessStatusCode) ? ((object)new Fipe()) : ((object)JsonConvert.DeserializeObject(await val.Content.ReadAsStringAsync()))); + } + finally + { + ((IDisposable)client)?.Dispose(); + } + } + + private async Task> FipeModel(string model) + { + HttpClient client = new HttpClient(); + try + { + ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; + string text = await FipeAuthentication(); + if (ValidationHelper.IsNotNullOrEmpty(text)) + { + ((HttpHeaders)client.DefaultRequestHeaders).TryAddWithoutValidation("Authorization", "Bearer " + text); + } + Uri uri = Address.ApiFipe.Append("v1").Append("fipe").Append("modelo") + .Append(model); + HttpResponseMessage val = await client.GetAsync(uri); + return (!val.IsSuccessStatusCode) ? new List() : JsonConvert.DeserializeObject>(await val.Content.ReadAsStringAsync()); + } + finally + { + ((IDisposable)client)?.Dispose(); + } + } + + private async Task FipeAuthentication() + { + HttpClient client = new HttpClient(); + try + { + ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; + string arg = DateTime.Now.ToString("yyyy-MM-dd"); + string content = Convert.ToBase64String(Encoding.UTF8.GetBytes(string.Format("{0}|{1}|{2}", ApplicationHelper.IdFornecedor, "bbbf4f03-01fc-4300-b430-33e007753578", arg))); + Uri uri = Address.ApiFipe.Append("api").Append("auth"); + HttpResponseMessage val = await client.PostAsync(uri, (HttpContent)(object)content.ToHttpContent()); + return (!val.IsSuccessStatusCode) ? string.Empty : ((object)val.Content.ToJObject()["token"])?.ToString(); + } + finally + { + ((IDisposable)client)?.Dispose(); + } + } + + private static async Task Get(string command) where T : class + { + Uri uri = new Uri(command); + HttpResponseMessage obj = await new HttpClient().GetAsync(uri).ConfigureAwait(continueOnCapturedContext: false); + if (obj.StatusCode != HttpStatusCode.OK) + { + throw new Exception("Api connection Error " + Environment.NewLine + " " + command, null); + } + return JsonConvert.DeserializeObject(obj.Content.ReadAsStringAsync().Result); + } + + public async Task Cancelar(Item item, string descricao, long idDocumento) + { + return await Task.Run((Func)delegate + { + //IL_007d: Unknown result type (might be due to invalid IL or missing references) + //IL_0084: Expected O, but got Unknown + try + { + UnitOfWork commited = Instancia.Commited; + try + { + item = commited.ItemRepository.FindById(((DomainBase)item).Id); + item.Cancelado = true; + item.Status = descricao; + item.IdDocumentoCancelado = idDocumento; + item = commited.ItemRepository.Merge(item); + DateTime networkTime = Funcoes.GetNetworkTime(); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog val = new RegistroLog(); + val.Acao = (TipoAcao)1; + val.Usuario = Recursos.Usuario; + val.DataHora = networkTime; + val.Descricao = $"O USUÁRIO {Recursos.Usuario.Nome} CANCELOU, EM {networkTime}, O ITEM DE " + $"ID: '{((DomainBase)item).Id}'" + ", DESCRIÇÃO: '" + (string.IsNullOrWhiteSpace(item.Descricao) ? "" : (item.Descricao ?? "")) + "', OBSERVAÇÃO: '" + (string.IsNullOrWhiteSpace(item.Observacao) ? "" : (item.Observacao ?? "")) + "', STATUS: '" + (string.IsNullOrWhiteSpace(item.Status) ? "" : (item.Status ?? "")) + "' - " + descricao + "."; + val.EntidadeId = ((DomainBase)item).Id; + val.Tela = (TipoTela)3; + val.Versao = LoginViewModel.VersaoAtual; + val.NomeMaquina = Environment.MachineName; + val.UsuarioMaquina = Environment.UserName; + val.Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString(); + RegistroLog keyValues = val; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return item; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception) + { + return (Item)null; + } + }); + } + + public async Task Reativar(Item item, string descricao) + { + return await Task.Run((Func)delegate + { + //IL_0091: Unknown result type (might be due to invalid IL or missing references) + //IL_0098: Expected O, but got Unknown + try + { + UnitOfWork commited = Instancia.Commited; + try + { + item = commited.ItemRepository.FindById(((DomainBase)item).Id); + item.Cancelado = false; + item.Substituido = null; + item.IdDocumentoCancelado = null; + item.Status = descricao; + item = commited.ItemRepository.Merge(item); + DateTime networkTime = Funcoes.GetNetworkTime(); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog val = new RegistroLog(); + val.Acao = (TipoAcao)1; + val.Usuario = Recursos.Usuario; + val.DataHora = networkTime; + val.Descricao = $"O USUÁRIO {Recursos.Usuario.Nome} REATIVOU, EM {networkTime}, O ITEM DE" + $"ID: '{((DomainBase)item).Id}'" + ", DESCRIÇÃO: '" + (string.IsNullOrWhiteSpace(item.Descricao) ? "" : (item.Descricao ?? "")) + "', OBSERVAÇÃO: '" + (string.IsNullOrWhiteSpace(item.Observacao) ? "" : (item.Observacao ?? "")) + "', STATUS: '" + (string.IsNullOrWhiteSpace(item.Status) ? "" : (item.Status ?? "")) + "' - " + descricao + "."; + val.EntidadeId = ((DomainBase)item).Id; + val.Tela = (TipoTela)3; + val.Versao = LoginViewModel.VersaoAtual; + val.NomeMaquina = Environment.MachineName; + val.UsuarioMaquina = Environment.UserName; + val.Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString(); + RegistroLog keyValues = val; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return item; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception) + { + return (Item)null; + } + }); + } + + public async Task Substituir(Item item, long substituido, string descricao) + { + return await Task.Run((Func)delegate + { + //IL_0071: Unknown result type (might be due to invalid IL or missing references) + //IL_0078: Expected O, but got Unknown + try + { + UnitOfWork commited = Instancia.Commited; + try + { + item = commited.ItemRepository.FindById(((DomainBase)item).Id); + item.Substituido = substituido; + item.Status = descricao; + item = commited.ItemRepository.Merge(item); + DateTime networkTime = Funcoes.GetNetworkTime(); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog val = new RegistroLog(); + val.Acao = (TipoAcao)1; + val.Usuario = Recursos.Usuario; + val.DataHora = networkTime; + val.Descricao = $"O USUÁRIO {Recursos.Usuario.Nome} SUBSTITUIU, EM {networkTime}, O ITEM DE" + $"ID: '{((DomainBase)item).Id}'" + ", DESCRIÇÃO: '" + (string.IsNullOrWhiteSpace(item.Descricao) ? "" : (item.Descricao ?? "")) + "', OBSERVAÇÃO: '" + (string.IsNullOrWhiteSpace(item.Observacao) ? "" : (item.Observacao ?? "")) + "', STATUS: '" + (string.IsNullOrWhiteSpace(item.Status) ? "" : (item.Status ?? "")) + "' - " + descricao + "."; + val.EntidadeId = ((DomainBase)item).Id; + val.Tela = (TipoTela)3; + val.Versao = LoginViewModel.VersaoAtual; + val.NomeMaquina = Environment.MachineName; + val.UsuarioMaquina = Environment.UserName; + val.Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString(); + RegistroLog keyValues = val; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return item; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception) + { + return (Item)null; + } + }); + } + + public async Task Save(Item item) + { + int tries = 3; + Item itemOriginal = item; + base.Sucesso = true; + IPHostEntry host = Dns.GetHostEntry(Dns.GetHostName()); + DateTime now = Funcoes.GetNetworkTime(); + return await Task.Run((Func)delegate + { + //IL_0094: Unknown result type (might be due to invalid IL or missing references) + //IL_0250: Unknown result type (might be due to invalid IL or missing references) + //IL_0256: Invalid comparison between Unknown and I4 + //IL_05ed: Unknown result type (might be due to invalid IL or missing references) + //IL_0465: Unknown result type (might be due to invalid IL or missing references) + //IL_06f0: Unknown result type (might be due to invalid IL or missing references) + //IL_03e9: Unknown result type (might be due to invalid IL or missing references) + //IL_04e7: Unknown result type (might be due to invalid IL or missing references) + //IL_056a: Unknown result type (might be due to invalid IL or missing references) + //IL_07cd: Unknown result type (might be due to invalid IL or missing references) + //IL_07cf: Unknown result type (might be due to invalid IL or missing references) + //IL_07d4: Unknown result type (might be due to invalid IL or missing references) + //IL_07d5: Unknown result type (might be due to invalid IL or missing references) + //IL_07dc: Unknown result type (might be due to invalid IL or missing references) + //IL_07e7: Unknown result type (might be due to invalid IL or missing references) + //IL_07f3: Unknown result type (might be due to invalid IL or missing references) + //IL_07fa: Unknown result type (might be due to invalid IL or missing references) + //IL_07ff: Unknown result type (might be due to invalid IL or missing references) + //IL_080b: Expected O, but got Unknown + //IL_0810: Unknown result type (might be due to invalid IL or missing references) + //IL_0821: Unknown result type (might be due to invalid IL or missing references) + //IL_0823: Unknown result type (might be due to invalid IL or missing references) + //IL_082d: Unknown result type (might be due to invalid IL or missing references) + //IL_0838: Unknown result type (might be due to invalid IL or missing references) + //IL_0843: Unknown result type (might be due to invalid IL or missing references) + //IL_084e: Unknown result type (might be due to invalid IL or missing references) + //IL_0670: Unknown result type (might be due to invalid IL or missing references) + //IL_0891: Expected O, but got Unknown + while (tries > 0) + { + item = itemOriginal; + try + { + UnitOfWork unitOfWork = Instancia.Commited; + try + { + bool flag = ((DomainBase)item).Id == 0; + Auto val = item.Auto; + Patrimonial val2 = item.Patrimonial; + Granizo val3 = item.Granizo; + Aeronautico val4 = item.Aeronautico; + Vida val5 = item.Vida; + RiscosDiversos val6 = item.RiscosDiversos; + Consorcio val7 = item.Consorcio; + TipoTela tipoTela = (TipoTela)3; + IList list = item.Coberturas; + item.StatusInclusao = ((item.Documento.Tipo == 0) ? "ITEM DA APÓLICE" : "ITEM DO ENDOSSO"); + if (flag) + { + item.Coberturas = null; + } + if (!flag && list != null && list.Count > 0) + { + try + { + list.ToList().ForEach(delegate(Cobertura x) + { + x.Item = item; + }); + List list2 = list.Where((Cobertura c) => ((DomainBase)c).Id == 0).ToList(); + if (list2.Count > 0) + { + list2 = unitOfWork.CoberturaRepository.AddRange(list2.ToList()); + list2.ForEach(delegate(Cobertura c) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + //IL_0028: Unknown result type (might be due to invalid IL or missing references) + //IL_002a: Unknown result type (might be due to invalid IL or missing references) + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_003b: Expected O, but got Unknown + //IL_0040: Unknown result type (might be due to invalid IL or missing references) + //IL_004c: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_0058: Unknown result type (might be due to invalid IL or missing references) + //IL_0063: Unknown result type (might be due to invalid IL or missing references) + //IL_006e: Unknown result type (might be due to invalid IL or missing references) + //IL_0079: Unknown result type (might be due to invalid IL or missing references) + //IL_00c0: Expected O, but got Unknown + RegistroLog keyValues3 = new RegistroLog + { + Acao = (TipoAcao)0, + Usuario = Recursos.Usuario, + DataHora = now, + Descricao = JsonConvert.SerializeObject((object)c, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)c).Id, + Tela = tipoTela, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = host.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues3, unitOfWork); + }); + } + List list3 = list.Where((Cobertura c) => ((DomainBase)c).Id > 0).ToList(); + if (list3.Count > 0) + { + list3 = unitOfWork.CoberturaRepository.MergeRange(list3); + list3.ForEach(delegate(Cobertura c) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + //IL_0028: Unknown result type (might be due to invalid IL or missing references) + //IL_002a: Unknown result type (might be due to invalid IL or missing references) + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_003b: Expected O, but got Unknown + //IL_0040: Unknown result type (might be due to invalid IL or missing references) + //IL_004c: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_0058: Unknown result type (might be due to invalid IL or missing references) + //IL_0063: Unknown result type (might be due to invalid IL or missing references) + //IL_006e: Unknown result type (might be due to invalid IL or missing references) + //IL_0079: Unknown result type (might be due to invalid IL or missing references) + //IL_00c0: Expected O, but got Unknown + RegistroLog keyValues2 = new RegistroLog + { + Acao = (TipoAcao)1, + Usuario = Recursos.Usuario, + DataHora = now, + Descricao = JsonConvert.SerializeObject((object)c, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)c).Id, + Tela = tipoTela, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = host.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues2, unitOfWork); + }); + } + list3.AddRange(list2); + item.Coberturas = list3; + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)208, tries, list); + goto end_IL_0029; + } + } + if (!item.Documento.Sinistro && item.Sinistrado && (int)item.Documento.Situacao == 2 && item.Status != null && !item.Status.Contains("ALTERADO")) + { + item.Sinistrado = false; + } + item = (flag ? unitOfWork.ItemRepository.SaveOrUpdate(item) : unitOfWork.ItemRepository.Merge(item)); + long id = ((DomainBase)item.Documento.Controle.Ramo).Id; + if (id <= 38) + { + long num = id - 1; + if ((ulong)num <= 19uL) + { + switch (num) + { + case 4L: + goto IL_039f; + case 0L: + case 1L: + case 2L: + case 14L: + case 17L: + goto IL_041b; + case 12L: + goto IL_0497; + case 19L: + goto IL_051a; + case 5L: + case 6L: + case 8L: + case 9L: + goto IL_059d; + case 3L: + case 7L: + case 10L: + case 11L: + case 13L: + case 15L: + case 16L: + case 18L: + goto IL_06a3; + } + } + if (id == 30) + { + goto IL_041b; + } + long num2 = id - 36; + if ((ulong)num2 <= 2uL) + { + switch (num2) + { + case 1L: + break; + case 2L: + goto IL_041b; + case 0L: + goto IL_0620; + default: + goto IL_06a3; + } + goto IL_039f; + } + } + else if (id == 47 || id == 53 || id == 66) + { + goto IL_059d; + } + goto IL_06a3; + IL_06a3: + try + { + if (val6 != null) + { + val6.Item = item; + val6 = (flag ? unitOfWork.RiscosDiversosRepository.SaveOrUpdate(val6) : unitOfWork.RiscosDiversosRepository.Merge(val6)); + item.RiscosDiversos = val6; + tipoTela = (TipoTela)3; + } + } + catch (Exception e2) + { + tries = Registrar(e2, (TipoErro)198, tries, val6); + goto end_IL_0029; + } + goto IL_071f; + IL_039f: + try + { + if (val != null) + { + val.Item = item; + val = (flag ? unitOfWork.AutoRepository.SaveOrUpdate(val) : unitOfWork.AutoRepository.Merge(val)); + item.Auto = val; + tipoTela = (TipoTela)3; + } + } + catch (Exception e3) + { + tries = Registrar(e3, (TipoErro)204, tries, val); + goto end_IL_0029; + } + goto IL_071f; + IL_0620: + try + { + if (val7 != null) + { + val7.Item = item; + val7 = (flag ? unitOfWork.ConsorcioRepository.SaveOrUpdate(val7) : unitOfWork.ConsorcioRepository.Merge(val7)); + item.Consorcio = val7; + tipoTela = (TipoTela)3; + } + } + catch (Exception e4) + { + tries = Registrar(e4, (TipoErro)331, tries, val7); + goto end_IL_0029; + } + goto IL_071f; + IL_041b: + try + { + if (val2 != null) + { + val2.Item = item; + val2 = (flag ? unitOfWork.PatrimonialRepository.SaveOrUpdate(val2) : unitOfWork.PatrimonialRepository.Merge(val2)); + item.Patrimonial = val2; + tipoTela = (TipoTela)3; + } + } + catch (Exception e5) + { + tries = Registrar(e5, (TipoErro)196, tries, val2); + goto end_IL_0029; + } + goto IL_071f; + IL_071f: + if (flag && list != null && list.Count > 0) + { + try + { + item.Coberturas = new List(); + list.ToList().ForEach(delegate(Cobertura x) + { + ((DomainBase)x).Id = 0L; + x.Item = item; + }); + list = unitOfWork.CoberturaRepository.AddRange(list.ToList()); + item.Coberturas = list; + } + catch (Exception e6) + { + tries = Registrar(e6, (TipoErro)208, tries, list); + goto end_IL_0029; + } + } + TipoAcao acao = (TipoAcao)(!flag); + RegistroLog keyValues = new RegistroLog + { + Acao = acao, + Usuario = Recursos.Usuario, + DataHora = now, + Descricao = JsonConvert.SerializeObject((object)item, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)item).Id, + Tela = tipoTela, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = host.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, unitOfWork); + ((GenericUnitOfWork)unitOfWork).Commit(); + return item; + IL_059d: + try + { + if (val5 != null) + { + val5.Item = item; + val5 = (flag ? unitOfWork.VidaRepository.SaveOrUpdate(val5) : unitOfWork.VidaRepository.Merge(val5)); + item.Vida = val5; + tipoTela = (TipoTela)3; + } + } + catch (Exception e7) + { + tries = Registrar(e7, (TipoErro)200, tries, val5); + goto end_IL_0029; + } + goto IL_071f; + IL_051a: + try + { + if (val3 != null) + { + val3.Item = item; + val3 = (flag ? unitOfWork.GranizoRepository.SaveOrUpdate(val3) : unitOfWork.GranizoRepository.Merge(val3)); + item.Granizo = val3; + tipoTela = (TipoTela)3; + } + } + catch (Exception e8) + { + tries = Registrar(e8, (TipoErro)206, tries, val3); + goto end_IL_0029; + } + goto IL_071f; + IL_0497: + try + { + if (val4 != null) + { + val4.Item = item; + val4 = (flag ? unitOfWork.AeronauticoRepository.SaveOrUpdate(val4) : unitOfWork.AeronauticoRepository.Merge(val4)); + item.Aeronautico = val4; + tipoTela = (TipoTela)3; + } + } + catch (Exception e9) + { + tries = Registrar(e9, (TipoErro)202, tries, val4); + goto end_IL_0029; + } + goto IL_071f; + end_IL_0029:; + } + finally + { + if (unitOfWork != null) + { + ((IDisposable)unitOfWork).Dispose(); + } + } + } + catch (Exception e10) + { + tries = Registrar(e10, (TipoErro)195, tries, item); + } + } + return itemOriginal; + }); + } + + public async Task Delete(Item item) + { + int tries = 3; + DateTime dateHora = Funcoes.GetNetworkTime(); + await Task.Run(delegate + { + //IL_0059: Unknown result type (might be due to invalid IL or missing references) + //IL_005f: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork commited = Instancia.Commited; + try + { + commited.CoberturaRepository.DeletebyItem(((DomainBase)item).Id); + commited.ControleSinistroRepository.Delete(((DomainBase)item).Id); + commited.ItemRepository.Delete(((DomainBase)item).Id); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog val = new RegistroLog(); + val.Acao = (TipoAcao)2; + val.Usuario = Recursos.Usuario; + val.DataHora = dateHora; + val.Descricao = $"O USUÁRIO {Recursos.Usuario.Nome} SUBSTITUIU, EM {dateHora}, O ITEM DE" + $"ID: '{((DomainBase)item).Id}'" + ", DESCRIÇÃO: '" + (string.IsNullOrWhiteSpace(item.Descricao) ? "" : (item.Descricao ?? "")) + "', OBSERVAÇÃO: '" + (string.IsNullOrWhiteSpace(item.Observacao) ? "" : (item.Observacao ?? "")) + "', STATUS: '" + (string.IsNullOrWhiteSpace(item.Status) ? "" : (item.Status ?? "")) + "'."; + val.EntidadeId = ((DomainBase)item).Id; + val.Tela = (TipoTela)3; + val.Versao = LoginViewModel.VersaoAtual; + val.NomeMaquina = Environment.MachineName; + val.UsuarioMaquina = Environment.UserName; + val.Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString(); + RegistroLog keyValues = val; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)274, tries, item); + } + } + }); + } + + public async Task DeleteRange(List itens, long ramo) + { + if (itens == null || itens.Count == 0) + { + return; + } + int tries = 3; + DateTime dateHora = Funcoes.GetNetworkTime(); + await Task.Run(delegate + { + //IL_014d: Unknown result type (might be due to invalid IL or missing references) + //IL_0251: Unknown result type (might be due to invalid IL or missing references) + //IL_018e: Unknown result type (might be due to invalid IL or missing references) + //IL_02cd: Unknown result type (might be due to invalid IL or missing references) + //IL_01cf: Unknown result type (might be due to invalid IL or missing references) + //IL_0210: Unknown result type (might be due to invalid IL or missing references) + //IL_028f: Unknown result type (might be due to invalid IL or missing references) + //IL_032e: Unknown result type (might be due to invalid IL or missing references) + //IL_0335: Expected O, but got Unknown + //IL_0465: Unknown result type (might be due to invalid IL or missing references) + while (tries > 0) + { + try + { + UnitOfWork commited = Instancia.Commited; + try + { + commited.CoberturaRepository.DeleteRange(itens.Select((Item x) => ((DomainBase)x).Id).ToList()); + commited.ControleSinistroRepository.DeleteRange(itens.Select((Item x) => ((DomainBase)x).Id).ToList()); + long num = ramo; + TipoTela tela; + if (num <= 36) + { + long num2 = num - 1; + if ((ulong)num2 <= 19uL) + { + switch (num2) + { + case 4L: + goto IL_0112; + case 0L: + case 1L: + case 2L: + case 14L: + case 17L: + goto IL_0153; + case 12L: + goto IL_0194; + case 19L: + goto IL_01d5; + case 5L: + case 6L: + case 8L: + case 9L: + goto IL_0216; + case 3L: + case 7L: + case 10L: + case 11L: + case 13L: + case 15L: + case 16L: + case 18L: + goto IL_0292; + } + } + if (num == 36) + { + commited.ConsorcioRepository.DeleteRange(itens.Select((Item x) => ((DomainBase)x).Id).ToList()); + tela = (TipoTela)3; + goto IL_02ce; + } + } + else + { + if (num == 37) + { + goto IL_0112; + } + if (num == 53) + { + goto IL_0216; + } + } + goto IL_0292; + IL_0112: + commited.AutoRepository.DeleteRange(itens.Select((Item x) => ((DomainBase)x).Id).ToList()); + tela = (TipoTela)3; + goto IL_02ce; + IL_0194: + commited.AeronauticoRepository.DeleteRange(itens.Select((Item x) => ((DomainBase)x).Id).ToList()); + tela = (TipoTela)3; + goto IL_02ce; + IL_0292: + commited.RiscosDiversosRepository.DeleteRange(itens.Select((Item x) => ((DomainBase)x).Id).ToList()); + tela = (TipoTela)3; + goto IL_02ce; + IL_02ce: + commited.ItemRepository.DeleteRange(itens.Select((Item x) => ((DomainBase)x).Id).ToList()); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + using (List.Enumerator enumerator = itens.GetEnumerator()) + { + if (enumerator.MoveNext()) + { + Item current = enumerator.Current; + RegistroLog val = new RegistroLog(); + val.Acao = (TipoAcao)2; + val.Usuario = Recursos.Usuario; + val.DataHora = dateHora; + val.Descricao = $"O USUÁRIO {Recursos.Usuario.Nome} SUBSTITUIU, EM {dateHora}, O ITEM DE" + $"ID: '{((DomainBase)current).Id}'" + ", DESCRIÇÃO: '" + (string.IsNullOrWhiteSpace(current.Descricao) ? "" : (current.Descricao ?? "")) + "', OBSERVAÇÃO: '" + (string.IsNullOrWhiteSpace(current.Observacao) ? "" : (current.Observacao ?? "")) + "', STATUS: '" + (string.IsNullOrWhiteSpace(current.Status) ? "" : (current.Status ?? "")) + "'" + $", RAMO: '{ramo}'."; + val.EntidadeId = ((DomainBase)current).Id; + val.Tela = tela; + val.Versao = LoginViewModel.VersaoAtual; + val.NomeMaquina = Environment.MachineName; + val.UsuarioMaquina = Environment.UserName; + val.Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString(); + RegistroLog keyValues = val; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + break; + } + } + goto end_IL_000c; + IL_01d5: + commited.GranizoRepository.DeleteRange(itens.Select((Item x) => ((DomainBase)x).Id).ToList()); + tela = (TipoTela)3; + goto IL_02ce; + IL_0153: + commited.PatrimonialRepository.DeleteRange(itens.Select((Item x) => ((DomainBase)x).Id).ToList()); + tela = (TipoTela)3; + goto IL_02ce; + IL_0216: + commited.VidaRepository.DeleteRange(itens.Select((Item x) => ((DomainBase)x).Id).ToList()); + tela = (TipoTela)3; + goto IL_02ce; + end_IL_000c:; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)275, tries, itens); + } + } + }); + } + + public async Task BuscarCliente(long id) + { + int tries = 3; + return await Task.Run((Func)delegate + { + //IL_0059: Unknown result type (might be due to invalid IL or missing references) + //IL_005f: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ItemRepository.BuscarCliente(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)27, tries, id); + } + } + return new Cliente(); + }); + } + + public async Task SaveRange(List itens) + { + int tries = 3; + DateTime dateHora = Funcoes.GetNetworkTime(); + await Task.Run(delegate + { + //IL_0052: Unknown result type (might be due to invalid IL or missing references) + //IL_0057: Unknown result type (might be due to invalid IL or missing references) + //IL_005e: Unknown result type (might be due to invalid IL or missing references) + //IL_0069: Unknown result type (might be due to invalid IL or missing references) + //IL_0075: Unknown result type (might be due to invalid IL or missing references) + //IL_0077: Unknown result type (might be due to invalid IL or missing references) + //IL_007c: Unknown result type (might be due to invalid IL or missing references) + //IL_0088: Expected O, but got Unknown + //IL_008d: Unknown result type (might be due to invalid IL or missing references) + //IL_0099: Unknown result type (might be due to invalid IL or missing references) + //IL_00a0: Unknown result type (might be due to invalid IL or missing references) + //IL_00ab: Unknown result type (might be due to invalid IL or missing references) + //IL_00b6: Unknown result type (might be due to invalid IL or missing references) + //IL_00c1: Unknown result type (might be due to invalid IL or missing references) + //IL_00ff: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork unitOfWork = Instancia.Commited; + try + { + itens.ForEach(delegate(Item x) + { + unitOfWork.ItemRepository.Merge(x); + }); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + foreach (Item iten in itens) + { + RegistroLog keyValues = new RegistroLog + { + Acao = (TipoAcao)2, + Usuario = Recursos.Usuario, + DataHora = dateHora, + Descricao = JsonConvert.SerializeObject((object)iten, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)iten).Id, + Tela = (TipoTela)3, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, unitOfWork); + } + ((GenericUnitOfWork)unitOfWork).Commit(); + base.Sucesso = true; + break; + } + finally + { + if (unitOfWork != null) + { + ((IDisposable)unitOfWork).Dispose(); + } + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)276, tries, itens); + } + } + }); + } + + public async Task> BuscarItens(List ids) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + List list = read.ItemRepository.FindItens(ids); + if (list != null) + { + return new ObservableCollection(from x in list + orderby x.Ordem, x.Descricao + select x); + } + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)52, tries, ids); + } + } + return new ObservableCollection(); + }); + } + + public async Task> BuscarItens(long id, StatusItem status) + { + //IL_001e: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + int tries = 3; + return await Task.Run(delegate + { + //IL_009e: Unknown result type (might be due to invalid IL or missing references) + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + List list = read.ItemRepository.FindItens(id, status); + if (list != null) + { + return new ObservableCollection(from x in list + orderby x.Ordem, x.Descricao + select x); + } + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)53, tries, new { id, status }); + } + } + return new ObservableCollection(); + }); + } + + public async Task> BuscarItens(List documento) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + List list = read.ItemRepository.FindItens(documento); + if (list != null) + { + return new ObservableCollection(from x in list + orderby x.Ordem, x.Descricao + select x); + } + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)305, tries, documento); + } + } + return new ObservableCollection(); + }); + } + + public async Task> BuscarItens(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + List list = read.ItemRepository.FindItens(id); + if (list != null) + { + return new ObservableCollection(from x in list + orderby x.Ordem, x.Descricao + select x); + } + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)53, tries, id); + } + } + return new ObservableCollection(); + }); + } + + public async Task> SaveTitulares(List titularesVidas) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork unitOfWork = Instancia.Commited; + try + { + titularesVidas.ForEach(delegate(TitularesVida x) + { + //IL_0009: Unknown result type (might be due to invalid IL or missing references) + //IL_000f: Invalid comparison between Unknown and I4 + if ((int)x.Tipo.GetValueOrDefault() != 2 && x.Dependente != null) + { + x.Dependente = null; + } + }); + titularesVidas.Where((TitularesVida x) => ((DomainBase)x).Id == 0L && (int)x.Tipo.GetValueOrDefault() != 2).ToList().ForEach(delegate(TitularesVida x) + { + ((DomainBase)titularesVidas.First((TitularesVida y) => y == x)).Id = ((DomainBase)unitOfWork.TitularesVidaRepository.SaveOrUpdate(x)).Id; + }); + titularesVidas.Where((TitularesVida x) => ((DomainBase)x).Id == 0L && (int)x.Tipo.GetValueOrDefault() == 2).ToList().ForEach(delegate(TitularesVida x) + { + ((DomainBase)titularesVidas.First((TitularesVida y) => y == x)).Id = ((DomainBase)unitOfWork.TitularesVidaRepository.SaveOrUpdate(x)).Id; + }); + titularesVidas.Where((TitularesVida x) => ((DomainBase)x).Id > 0).ToList().ForEach(delegate(TitularesVida x) + { + unitOfWork.TitularesVidaRepository.Merge(x); + }); + ((GenericUnitOfWork)unitOfWork).Commit(); + base.Sucesso = true; + return titularesVidas; + } + finally + { + if (unitOfWork != null) + { + ((IDisposable)unitOfWork).Dispose(); + } + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)276, tries, titularesVidas); + } + } + return new List(); + }); + } + + public async Task DeleteTitulares(List titularesVidas) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork commited = Instancia.Commited; + try + { + commited.TitularesVidaRepository.DeleteRange(titularesVidas.Select((TitularesVida x) => ((DomainBase)x).Id).ToList()); + ((GenericUnitOfWork)commited).Commit(); + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)276, tries, titularesVidas); + } + } + return false; + }); + } + + internal async Task> BuscaItensPorObs(string observacao, FiltroStatusDocumento status, List vendedorVinculado, bool tipobusca = false) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + return await Task.Run(async delegate + { + try + { + UnitOfWork unitOfWork = Instancia.Read; + try + { + return await unitOfWork.ItemRepository.BuscaItensPorObs(observacao, status, vendedorVinculado, (TipoPesquisa)18, tipobusca); + } + finally + { + ((IDisposable)unitOfWork)?.Dispose(); + } + } + catch (Exception) + { + return (List)null; + } + }); + } + + public async Task ChecarQuantidade(long idDocumento) + { + return await Task.Run(delegate + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ItemRepository.ChecarQuantidade(idDocumento); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch + { + return 0; + } + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Seguros.Itens/PatrimonialServico.cs b/Decompiler/Gestor.Application.Servicos.Seguros.Itens/PatrimonialServico.cs new file mode 100644 index 0000000..5d01a15 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Seguros.Itens/PatrimonialServico.cs @@ -0,0 +1,207 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Sockets; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Newtonsoft.Json; + +namespace Gestor.Application.Servicos.Seguros.Itens; + +internal class PatrimonialServico : BaseServico +{ + public async Task Save(Patrimonial patrimonial) + { + return await Task.Run((Func)delegate + { + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + //IL_005a: Unknown result type (might be due to invalid IL or missing references) + //IL_005f: Unknown result type (might be due to invalid IL or missing references) + //IL_0060: Unknown result type (might be due to invalid IL or missing references) + //IL_0066: Unknown result type (might be due to invalid IL or missing references) + //IL_0071: Unknown result type (might be due to invalid IL or missing references) + //IL_007c: Unknown result type (might be due to invalid IL or missing references) + //IL_0083: Unknown result type (might be due to invalid IL or missing references) + //IL_0088: Unknown result type (might be due to invalid IL or missing references) + //IL_0094: Expected O, but got Unknown + //IL_0099: Unknown result type (might be due to invalid IL or missing references) + //IL_00aa: Unknown result type (might be due to invalid IL or missing references) + //IL_00b1: Unknown result type (might be due to invalid IL or missing references) + //IL_00bc: Unknown result type (might be due to invalid IL or missing references) + //IL_00c7: Unknown result type (might be due to invalid IL or missing references) + //IL_00d2: Unknown result type (might be due to invalid IL or missing references) + //IL_010f: Expected O, but got Unknown + try + { + UnitOfWork commited = Instancia.Commited; + try + { + TipoAcao acao = (TipoAcao)(((DomainBase)patrimonial).Id != 0L); + patrimonial = ((((DomainBase)patrimonial).Id == 0L) ? commited.PatrimonialRepository.SaveOrUpdate(patrimonial) : commited.PatrimonialRepository.Merge(patrimonial)); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog keyValues = new RegistroLog + { + Acao = acao, + Usuario = Recursos.Usuario, + DataHora = Funcoes.GetNetworkTime(), + Descricao = JsonConvert.SerializeObject((object)patrimonial, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)patrimonial).Id, + Tela = (TipoTela)3, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return patrimonial; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception) + { + return (Patrimonial)null; + } + }); + } + + public async Task Delete(Item item) + { + int tries = 3; + return await Task.Run(delegate + { + //IL_009b: Unknown result type (might be due to invalid IL or missing references) + //IL_00a0: Unknown result type (might be due to invalid IL or missing references) + //IL_00a7: Unknown result type (might be due to invalid IL or missing references) + //IL_00b2: Unknown result type (might be due to invalid IL or missing references) + //IL_00b9: Unknown result type (might be due to invalid IL or missing references) + //IL_00c0: Unknown result type (might be due to invalid IL or missing references) + //IL_00c5: Unknown result type (might be due to invalid IL or missing references) + //IL_00d1: Expected O, but got Unknown + //IL_00d6: Unknown result type (might be due to invalid IL or missing references) + //IL_00f4: Unknown result type (might be due to invalid IL or missing references) + //IL_00fb: Unknown result type (might be due to invalid IL or missing references) + //IL_0106: Unknown result type (might be due to invalid IL or missing references) + //IL_0111: Unknown result type (might be due to invalid IL or missing references) + //IL_011c: Unknown result type (might be due to invalid IL or missing references) + //IL_0159: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork commited = Instancia.Commited; + try + { + if (item.Patrimonial != null && ((DomainBase)item.Patrimonial).Id > 0) + { + commited.PatrimonialRepository.Delete(((DomainBase)item.Patrimonial).Id); + } + commited.CoberturaRepository.DeletebyItem(((DomainBase)item).Id); + commited.ControleSinistroRepository.DeleteByItem(((DomainBase)item).Id); + commited.ItemRepository.Delete(((DomainBase)item).Id); + DateTime networkTime = Funcoes.GetNetworkTime(); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog val = new RegistroLog + { + Acao = (TipoAcao)2, + Usuario = Recursos.Usuario, + DataHora = networkTime, + Descricao = JsonConvert.SerializeObject((object)item, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }) + }; + Patrimonial patrimonial = item.Patrimonial; + val.EntidadeId = ((patrimonial != null) ? ((DomainBase)patrimonial).Id : 0); + val.Tela = (TipoTela)3; + val.Versao = LoginViewModel.VersaoAtual; + val.NomeMaquina = Environment.MachineName; + val.UsuarioMaquina = Environment.UserName; + val.Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString(); + RegistroLog keyValues = val; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)197, tries); + } + } + return false; + }); + } + + public async Task> BuscarImobiliaria(string imobiliaria, FiltroStatusDocumento status, List vendedorVinculado) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + return await Task.Run(delegate + { + //IL_0013: Unknown result type (might be due to invalid IL or missing references) + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.PatrimonialRepository.FindImobiliaria(imobiliaria, status, vendedorVinculado); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception) + { + return (List)null; + } + }); + } + + public async Task> BuscarLocatario(string locatario, FiltroStatusDocumento status, List vendedorVinculado) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + return await Task.Run(delegate + { + //IL_0013: Unknown result type (might be due to invalid IL or missing references) + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.PatrimonialRepository.Findlocatario(locatario, status, vendedorVinculado); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception) + { + return (List)null; + } + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Seguros.Itens/RiscosDiversosServico.cs b/Decompiler/Gestor.Application.Servicos.Seguros.Itens/RiscosDiversosServico.cs new file mode 100644 index 0000000..9e1aa82 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Seguros.Itens/RiscosDiversosServico.cs @@ -0,0 +1,154 @@ +using System; +using System.Linq; +using System.Net; +using System.Net.Sockets; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Newtonsoft.Json; + +namespace Gestor.Application.Servicos.Seguros.Itens; + +internal class RiscosDiversosServico : BaseServico +{ + public async Task Save(RiscosDiversos riscosdiversos) + { + return await Task.Run((Func)delegate + { + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + //IL_005a: Unknown result type (might be due to invalid IL or missing references) + //IL_005f: Unknown result type (might be due to invalid IL or missing references) + //IL_0060: Unknown result type (might be due to invalid IL or missing references) + //IL_0066: Unknown result type (might be due to invalid IL or missing references) + //IL_0071: Unknown result type (might be due to invalid IL or missing references) + //IL_007c: Unknown result type (might be due to invalid IL or missing references) + //IL_0083: Unknown result type (might be due to invalid IL or missing references) + //IL_0088: Unknown result type (might be due to invalid IL or missing references) + //IL_0094: Expected O, but got Unknown + //IL_0099: Unknown result type (might be due to invalid IL or missing references) + //IL_00aa: Unknown result type (might be due to invalid IL or missing references) + //IL_00b1: Unknown result type (might be due to invalid IL or missing references) + //IL_00bc: Unknown result type (might be due to invalid IL or missing references) + //IL_00c7: Unknown result type (might be due to invalid IL or missing references) + //IL_00d2: Unknown result type (might be due to invalid IL or missing references) + //IL_010f: Expected O, but got Unknown + try + { + UnitOfWork commited = Instancia.Commited; + try + { + TipoAcao acao = (TipoAcao)(((DomainBase)riscosdiversos).Id != 0L); + riscosdiversos = ((((DomainBase)riscosdiversos).Id == 0L) ? commited.RiscosDiversosRepository.SaveOrUpdate(riscosdiversos) : commited.RiscosDiversosRepository.Merge(riscosdiversos)); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog keyValues = new RegistroLog + { + Acao = acao, + Usuario = Recursos.Usuario, + DataHora = Funcoes.GetNetworkTime(), + Descricao = JsonConvert.SerializeObject((object)riscosdiversos, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)riscosdiversos).Id, + Tela = (TipoTela)3, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return riscosdiversos; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception) + { + return (RiscosDiversos)null; + } + }); + } + + public async Task Delete(Item item) + { + int tries = 3; + return await Task.Run(delegate + { + //IL_009b: Unknown result type (might be due to invalid IL or missing references) + //IL_00a0: Unknown result type (might be due to invalid IL or missing references) + //IL_00a7: Unknown result type (might be due to invalid IL or missing references) + //IL_00b2: Unknown result type (might be due to invalid IL or missing references) + //IL_00b9: Unknown result type (might be due to invalid IL or missing references) + //IL_00c0: Unknown result type (might be due to invalid IL or missing references) + //IL_00c5: Unknown result type (might be due to invalid IL or missing references) + //IL_00d1: Expected O, but got Unknown + //IL_00d6: Unknown result type (might be due to invalid IL or missing references) + //IL_00f4: Unknown result type (might be due to invalid IL or missing references) + //IL_00fb: Unknown result type (might be due to invalid IL or missing references) + //IL_0106: Unknown result type (might be due to invalid IL or missing references) + //IL_0111: Unknown result type (might be due to invalid IL or missing references) + //IL_011c: Unknown result type (might be due to invalid IL or missing references) + //IL_0159: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork commited = Instancia.Commited; + try + { + if (item.RiscosDiversos != null && ((DomainBase)item.RiscosDiversos).Id > 0) + { + commited.RiscosDiversosRepository.Delete(((DomainBase)item.RiscosDiversos).Id); + } + commited.CoberturaRepository.DeletebyItem(((DomainBase)item).Id); + commited.ControleSinistroRepository.DeleteByItem(((DomainBase)item).Id); + commited.ItemRepository.Delete(((DomainBase)item).Id); + DateTime networkTime = Funcoes.GetNetworkTime(); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog val = new RegistroLog + { + Acao = (TipoAcao)2, + Usuario = Recursos.Usuario, + DataHora = networkTime, + Descricao = JsonConvert.SerializeObject((object)item, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }) + }; + RiscosDiversos riscosDiversos = item.RiscosDiversos; + val.EntidadeId = ((riscosDiversos != null) ? ((DomainBase)riscosDiversos).Id : 0); + val.Tela = (TipoTela)3; + val.Versao = LoginViewModel.VersaoAtual; + val.NomeMaquina = Environment.MachineName; + val.UsuarioMaquina = Environment.UserName; + val.Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString(); + RegistroLog keyValues = val; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)199, tries); + } + } + return false; + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Seguros.Itens/VidaServico.cs b/Decompiler/Gestor.Application.Servicos.Seguros.Itens/VidaServico.cs new file mode 100644 index 0000000..75510ed --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Seguros.Itens/VidaServico.cs @@ -0,0 +1,154 @@ +using System; +using System.Linq; +using System.Net; +using System.Net.Sockets; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Newtonsoft.Json; + +namespace Gestor.Application.Servicos.Seguros.Itens; + +internal class VidaServico : BaseServico +{ + public async Task Save(Vida vida) + { + return await Task.Run((Func)delegate + { + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + //IL_005a: Unknown result type (might be due to invalid IL or missing references) + //IL_005f: Unknown result type (might be due to invalid IL or missing references) + //IL_0060: Unknown result type (might be due to invalid IL or missing references) + //IL_0066: Unknown result type (might be due to invalid IL or missing references) + //IL_0071: Unknown result type (might be due to invalid IL or missing references) + //IL_007c: Unknown result type (might be due to invalid IL or missing references) + //IL_0083: Unknown result type (might be due to invalid IL or missing references) + //IL_0088: Unknown result type (might be due to invalid IL or missing references) + //IL_0094: Expected O, but got Unknown + //IL_0099: Unknown result type (might be due to invalid IL or missing references) + //IL_00aa: Unknown result type (might be due to invalid IL or missing references) + //IL_00b1: Unknown result type (might be due to invalid IL or missing references) + //IL_00bc: Unknown result type (might be due to invalid IL or missing references) + //IL_00c7: Unknown result type (might be due to invalid IL or missing references) + //IL_00d2: Unknown result type (might be due to invalid IL or missing references) + //IL_010f: Expected O, but got Unknown + try + { + UnitOfWork commited = Instancia.Commited; + try + { + TipoAcao acao = (TipoAcao)(((DomainBase)vida).Id != 0L); + vida = ((((DomainBase)vida).Id == 0L) ? commited.VidaRepository.SaveOrUpdate(vida) : commited.VidaRepository.Merge(vida)); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog keyValues = new RegistroLog + { + Acao = acao, + Usuario = Recursos.Usuario, + DataHora = Funcoes.GetNetworkTime(), + Descricao = JsonConvert.SerializeObject((object)vida, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)vida).Id, + Tela = (TipoTela)3, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return vida; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception) + { + return (Vida)null; + } + }); + } + + public async Task Delete(Item item) + { + int tries = 3; + return await Task.Run(delegate + { + //IL_009b: Unknown result type (might be due to invalid IL or missing references) + //IL_00a0: Unknown result type (might be due to invalid IL or missing references) + //IL_00a7: Unknown result type (might be due to invalid IL or missing references) + //IL_00b2: Unknown result type (might be due to invalid IL or missing references) + //IL_00b9: Unknown result type (might be due to invalid IL or missing references) + //IL_00c0: Unknown result type (might be due to invalid IL or missing references) + //IL_00c5: Unknown result type (might be due to invalid IL or missing references) + //IL_00d1: Expected O, but got Unknown + //IL_00d6: Unknown result type (might be due to invalid IL or missing references) + //IL_00f4: Unknown result type (might be due to invalid IL or missing references) + //IL_00fb: Unknown result type (might be due to invalid IL or missing references) + //IL_0106: Unknown result type (might be due to invalid IL or missing references) + //IL_0111: Unknown result type (might be due to invalid IL or missing references) + //IL_011c: Unknown result type (might be due to invalid IL or missing references) + //IL_0159: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork commited = Instancia.Commited; + try + { + if (item.Vida != null && ((DomainBase)item.Vida).Id > 0) + { + commited.VidaRepository.Delete(((DomainBase)item.Vida).Id); + } + commited.CoberturaRepository.DeletebyItem(((DomainBase)item).Id); + commited.ControleSinistroRepository.DeleteByItem(((DomainBase)item).Id); + commited.ItemRepository.Delete(((DomainBase)item).Id); + DateTime networkTime = Funcoes.GetNetworkTime(); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog val = new RegistroLog + { + Acao = (TipoAcao)2, + Usuario = Recursos.Usuario, + DataHora = networkTime, + Descricao = JsonConvert.SerializeObject((object)item, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }) + }; + Vida vida = item.Vida; + val.EntidadeId = ((vida != null) ? ((DomainBase)vida).Id : 0); + val.Tela = (TipoTela)3; + val.Versao = LoginViewModel.VersaoAtual; + val.NomeMaquina = Environment.MachineName; + val.UsuarioMaquina = Environment.UserName; + val.Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString(); + RegistroLog keyValues = val; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)201, tries); + } + } + return false; + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Seguros/ApoliceServico.cs b/Decompiler/Gestor.Application.Servicos.Seguros/ApoliceServico.cs new file mode 100644 index 0000000..f68ae01 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Seguros/ApoliceServico.cs @@ -0,0 +1,1842 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net; +using System.Net.Sockets; +using System.Threading.Tasks; +using CsQuery.ExtensionMethods; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Relatorios; +using Gestor.Model.Domain.Relatorios.Fechamento; +using Gestor.Model.Domain.Relatorios.Tarefa; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.License; +using Newtonsoft.Json; + +namespace Gestor.Application.Servicos.Seguros; + +internal class ApoliceServico : BaseServico +{ + private bool _carregando; + + internal async Task> BuscarApolicesAsync(long id, FiltroStatusDocumento status = 0, List vendedorVinculado = null) + { + //IL_001e: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + if (_carregando) + { + return new ObservableCollection(); + } + int tries = 3; + return await Task.Run(delegate + { + //IL_00d4: Unknown result type (might be due to invalid IL or missing references) + //IL_0025: Unknown result type (might be due to invalid IL or missing references) + while (tries > 0) + { + try + { + _carregando = true; + UnitOfWork read = Instancia.Read; + try + { + ObservableCollection result = new ObservableCollection(read.DocumentoRepository.FindApoliceByCustomer(id, status, vendedorVinculado, LicenseHelper.Produtos, false, ((DomainBase)Recursos.Usuario).Id == 0, Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 43))); + _carregando = false; + return result; + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + bool assinatura = LicenseHelper.Produtos.Any((Licenca x) => (int)x.Produto == 86 && x.Status != 3); + tries = Registrar(e, (TipoErro)1, tries, new { id, status, vendedorVinculado, assinatura }); + } + } + _carregando = false; + return new ObservableCollection(); + }); + } + + internal async Task> BuscarApolicesComissao(long id, FiltroStatusDocumento status = 0) + { + //IL_001e: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + int tries = 3; + return await Task.Run(delegate + { + //IL_0052: Unknown result type (might be due to invalid IL or missing references) + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new ObservableCollection(read.DocumentoRepository.FindApoliceByCustomer(id, status, (List)null, LicenseHelper.Produtos, true, false, false)); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)2, tries, new { id, status }); + } + } + return new ObservableCollection(); + }); + } + + public async Task UpdateRange(Controle controle) + { + int tries = 3; + Controle controleSalvo = controle; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork unitOfWork = Instancia.Commited; + try + { + controleSalvo = unitOfWork.ControleRepository.Merge(controleSalvo); + controleSalvo.Documentos.ToList().ForEach(delegate(Documento x) + { + x = unitOfWork.DocumentoRepository.Merge(x); + }); + ((GenericUnitOfWork)unitOfWork).Commit(); + return true; + } + finally + { + if (unitOfWork != null) + { + ((IDisposable)unitOfWork).Dispose(); + } + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)19, tries, controle); + } + } + return false; + }); + } + + public async Task Excluir(Documento documento) + { + int tries = 3; + base.Sucesso = true; + Documento documentoOriginal = documento; + DateTime now = Funcoes.GetNetworkTime(); + return await Task.Run((Func)delegate + { + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_00bb: Unknown result type (might be due to invalid IL or missing references) + //IL_00c0: Unknown result type (might be due to invalid IL or missing references) + //IL_00c1: Unknown result type (might be due to invalid IL or missing references) + //IL_00c7: Unknown result type (might be due to invalid IL or missing references) + //IL_00d2: Unknown result type (might be due to invalid IL or missing references) + //IL_00de: Unknown result type (might be due to invalid IL or missing references) + //IL_00e5: Unknown result type (might be due to invalid IL or missing references) + //IL_00ea: Unknown result type (might be due to invalid IL or missing references) + //IL_00f6: Expected O, but got Unknown + //IL_00fb: Unknown result type (might be due to invalid IL or missing references) + //IL_010c: Unknown result type (might be due to invalid IL or missing references) + //IL_0113: Unknown result type (might be due to invalid IL or missing references) + //IL_011e: Unknown result type (might be due to invalid IL or missing references) + //IL_0129: Unknown result type (might be due to invalid IL or missing references) + //IL_0134: Unknown result type (might be due to invalid IL or missing references) + //IL_0172: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork commited = Instancia.Commited; + try + { + TipoAcao acao = (TipoAcao)2; + Controle controle = documento.Controle; + if (controle == null) + { + controle = commited.DocumentoRepository.FindById(((DomainBase)documento).Id, false, false).Controle; + documento.Controle = controle; + } + commited.ParcelaRepository.ExcluirVinculoParcelaPendenteDocExcluido(documento); + Status status = documento.Status; + if (status != null && ((DomainBase)status).Id == 0) + { + documento.Status = null; + } + documento = commited.DocumentoRepository.Merge(documento); + documento.Controle = commited.ControleRepository.Merge(controle); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog keyValues = new RegistroLog + { + Acao = acao, + Usuario = Recursos.Usuario, + DataHora = now, + Descricao = JsonConvert.SerializeObject((object)documento, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)documento).Id, + Tela = (TipoTela)2, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return documento; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)20, tries, documento); + } + } + return documentoOriginal; + }); + } + + public async Task AtualizarNumero(long id, string numero, string endosso, int tipoDocumento) + { + return await Task.Run(delegate + { + try + { + bool result = true; + UnitOfWork commited = Instancia.Commited; + try + { + result = commited.DocumentoRepository.AtualizarNumero(id, numero, endosso, tipoDocumento); + ((GenericUnitOfWork)commited).Commit(); + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + return result; + } + catch (Exception) + { + return false; + } + }); + } + + public async Task Save(Controle controle, Cliente cliente) + { + int tries = 3; + await Task.Run(delegate + { + //IL_004b: Unknown result type (might be due to invalid IL or missing references) + //IL_0050: Unknown result type (might be due to invalid IL or missing references) + //IL_005b: Unknown result type (might be due to invalid IL or missing references) + //IL_0066: Unknown result type (might be due to invalid IL or missing references) + //IL_0077: Unknown result type (might be due to invalid IL or missing references) + //IL_0092: Expected O, but got Unknown + //IL_0099: Unknown result type (might be due to invalid IL or missing references) + //IL_009e: Unknown result type (might be due to invalid IL or missing references) + //IL_00a9: Unknown result type (might be due to invalid IL or missing references) + //IL_00b4: Unknown result type (might be due to invalid IL or missing references) + //IL_00c5: Unknown result type (might be due to invalid IL or missing references) + //IL_00e0: Expected O, but got Unknown + while (tries > 0) + { + List logs = new List(); + List logsTroca = new List(); + try + { + UnitOfWork commited = Instancia.Commited; + try + { + List diferenca = new List(); + List diferencaTroca = new List(); + diferenca.Insert(0, new Diferenca + { + Campo = "Cliente", + Descricao = "NOME", + ValorAtual = cliente.Nome, + ValorAnterior = controle.Cliente.Nome + }); + diferencaTroca.Insert(0, new Diferenca + { + Campo = "Cliente", + Descricao = "APÓLICE TROCADA DE CLIENTE", + ValorAtual = cliente.Nome, + ValorAnterior = controle.Cliente.Nome + }); + ExtensionMethods.ForEach((IEnumerable)controle.Documentos, (Action)delegate(Documento x) + { + logs.Add(CreateLog(((DomainBase)x).Id, diferenca, (TipoTela)2)); + logsTroca.Add(CreateLog(((DomainBase)x).Id, diferencaTroca, (TipoTela)41)); + }); + commited.DocumentoRepository.TrocarCliente(controle, cliente); + SaveLog(logs, commited); + SaveLog(logsTroca, commited); + ((GenericUnitOfWork)commited).Commit(); + break; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)325, tries, controle); + } + } + }); + } + + public async Task Save(Documento documento, bool updateParcelas, bool criarParcelas) + { + int tries = 3; + base.Sucesso = true; + Documento documentoOriginal = documento; + DateTime now = Funcoes.GetNetworkTime(); + List logs = new List(); + return await Task.Run((Func)delegate + { + //IL_018d: Unknown result type (might be due to invalid IL or missing references) + //IL_0193: Invalid comparison between Unknown and I4 + while (tries > 0) + { + try + { + UnitOfWork unitOfWork = Instancia.Commited; + try + { + _ = ((DomainBase)documento).Id; + bool num = ((DomainBase)documento).Id == 0; + Controle controle = documento.Controle; + ObservableCollection parcelas = documento.Parcelas; + if (num) + { + controle = ((documento.Tipo > 0 && ((DomainBase)controle).Id > 0) ? controle : unitOfWork.ControleRepository.SaveOrUpdate(controle)); + documento.Controle = controle; + documento = unitOfWork.DocumentoRepository.SaveOrUpdate(documento); + logs.Add(CreateLog(((DomainBase)documento).Id, ((DomainBase)documento).GetValorOriginal(), (TipoTela)2, (TipoAcao)0)); + parcelas?.ToList().ForEach(delegate(Parcela p) + { + ObservableCollection vendedores3 = p.Vendedores; + p.Documento = documento; + p.IdEmpresa = documento.Controle.IdEmpresa; + p = unitOfWork.ParcelaRepository.SaveOrUpdate(p); + logs.Add(CreateLog(((DomainBase)documento).Id, ((DomainBase)p).GetValorOriginal(), (TipoTela)5, (TipoAcao)0)); + vendedores3.ToList().ForEach(delegate(VendedorParcela v) + { + //IL_0047: Unknown result type (might be due to invalid IL or missing references) + //IL_004c: Unknown result type (might be due to invalid IL or missing references) + //IL_004d: Unknown result type (might be due to invalid IL or missing references) + //IL_004f: Unknown result type (might be due to invalid IL or missing references) + //IL_0069: Expected I4, but got Unknown + v.Documento = documento; + v.Parcela = p; + if (v.Repasse != null) + { + switch (v.Repasse.Base) + { + case 2L: + v.DataPrePagamento = p.Vencimento; + break; + case 0L: + v.DataPrePagamento = documento.Vigencia1; + break; + case 1L: + v.DataPrePagamento = now; + break; + case 3L: + v.DataPrePagamento = documento.Emissao; + break; + case 4L: + v.DataPrePagamento = documento.Remessa; + break; + } + } + v = unitOfWork.VendedorParcelaRepository.SaveOrUpdate(v); + logs.Add(CreateLog(((DomainBase)p).Id, ((DomainBase)v).GetValorOriginal(), (TipoTela)37, (TipoAcao)0)); + }); + p.Vendedores = vendedores3; + }); + } + else + { + if (controle == null || ((controle != null) ? controle.Seguradora : null) == null) + { + controle = unitOfWork.DocumentoRepository.FindById(((DomainBase)documento).Id, false, false).Controle; + documento.Controle = controle; + } + logs.Add(CreateLog(((DomainBase)documento).Id, documento, (TipoTela)2)); + documento = unitOfWork.DocumentoRepository.Merge(documento); + if ((int)documento.TipoRecebimento.GetValueOrDefault() == 1) + { + if (criarParcelas) + { + unitOfWork.ParcelaRepository.FindByDocumentId(((DomainBase)documento).Id)?.ForEach(delegate(Parcela pa) + { + logs.Add(CreateLog(((DomainBase)documento).Id, ((DomainBase)pa).GetValorOriginal(), (TipoTela)5, (TipoAcao)2)); + }); + unitOfWork.VendedorParcelaRepository.FindByDocumentId(((DomainBase)documento).Id)?.ForEach(delegate(VendedorParcela pa) + { + logs.Add(CreateLog(((DomainBase)pa.Parcela).Id, ((DomainBase)pa).GetValorOriginal(), (TipoTela)37, (TipoAcao)2)); + }); + unitOfWork.VendedorParcelaRepository.DeleteRange(((DomainBase)documento).Id); + unitOfWork.ParcelaRepository.DeleteRange(((DomainBase)documento).Id); + parcelas.ToList().ForEach(delegate(Parcela p) + { + ObservableCollection vendedores2 = p.Vendedores; + p.Documento = documento; + p.IdEmpresa = documento.Controle.IdEmpresa; + p = unitOfWork.ParcelaRepository.SaveOrUpdate(p); + vendedores2.ToList().ForEach(delegate(VendedorParcela v) + { + //IL_0047: Unknown result type (might be due to invalid IL or missing references) + //IL_004c: Unknown result type (might be due to invalid IL or missing references) + //IL_004d: Unknown result type (might be due to invalid IL or missing references) + //IL_004f: Unknown result type (might be due to invalid IL or missing references) + //IL_0069: Expected I4, but got Unknown + v.Documento = documento; + v.Parcela = p; + if (v.Repasse != null) + { + switch (v.Repasse.Base) + { + case 2L: + v.DataPrePagamento = p.Vencimento; + break; + case 0L: + v.DataPrePagamento = documento.Vigencia1; + break; + case 1L: + v.DataPrePagamento = now; + break; + case 3L: + v.DataPrePagamento = documento.Emissao; + break; + case 4L: + v.DataPrePagamento = documento.Remessa; + break; + } + } + v = unitOfWork.VendedorParcelaRepository.SaveOrUpdate(v); + logs.Add(CreateLog(((DomainBase)p).Id, ((DomainBase)v).GetValorOriginal(), (TipoTela)37, (TipoAcao)0)); + }); + p.Vendedores = vendedores2; + logs.Add(CreateLog(((DomainBase)documento).Id, ((DomainBase)p).GetValorOriginal(), (TipoTela)5, (TipoAcao)0)); + }); + } + if (updateParcelas && !criarParcelas) + { + List parcelasAnteriores = unitOfWork.ParcelaRepository.FindByDocumentId(((DomainBase)documento).Id); + List vendedoresAnteriores = unitOfWork.VendedorParcelaRepository.FindByDocumentId(((DomainBase)documento).Id); + parcelas.ToList().ForEach(delegate(Parcela p) + { + //IL_00c0: Unknown result type (might be due to invalid IL or missing references) + //IL_00c5: Unknown result type (might be due to invalid IL or missing references) + //IL_00d0: Unknown result type (might be due to invalid IL or missing references) + //IL_00db: Unknown result type (might be due to invalid IL or missing references) + //IL_00f5: Unknown result type (might be due to invalid IL or missing references) + //IL_0114: Expected O, but got Unknown + ObservableCollection vendedores = p.Vendedores; + p.Documento = documento; + p = unitOfWork.ParcelaRepository.Merge(p); + vendedores.ToList().ForEach(delegate(VendedorParcela v) + { + //IL_013a: Unknown result type (might be due to invalid IL or missing references) + //IL_013f: Unknown result type (might be due to invalid IL or missing references) + //IL_014a: Unknown result type (might be due to invalid IL or missing references) + //IL_0155: Unknown result type (might be due to invalid IL or missing references) + //IL_016b: Unknown result type (might be due to invalid IL or missing references) + //IL_0186: Expected O, but got Unknown + v.Documento = documento; + v.Parcela = p; + int num2 = ((((DomainBase)v).Id <= 0) ? 1 : 0); + v = ((((DomainBase)v).Id > 0) ? unitOfWork.VendedorParcelaRepository.Merge(v) : unitOfWork.VendedorParcelaRepository.SaveOrUpdate(v)); + if (num2 == 0) + { + logs.Add(CreateLog(((DomainBase)p).Id, ((DomainBase)v).GetValorOriginal(), (TipoTela)37, (TipoAcao)0)); + } + VendedorParcela val2 = ((IEnumerable)vendedoresAnteriores).FirstOrDefault((Func)((VendedorParcela pa) => ((DomainBase)v).Id == ((DomainBase)pa).Id)); + if (val2 != null) + { + List valorOriginal2 = ((DomainBase)val2).GetValorOriginal(); + List list2 = ((DomainBase)v).Compare(valorOriginal2); + if (list2.Count > 0) + { + list2.Insert(0, new Diferenca + { + Campo = "Vendedor", + Descricao = "VENDEDOR", + ValorAtual = v.Vendedor.Nome, + ValorAnterior = v.Vendedor.Nome + }); + logs.Add(CreateLog(((DomainBase)p).Id, list2, (TipoTela)37)); + } + } + }); + p.Vendedores = vendedores; + Parcela val = ((IEnumerable)parcelasAnteriores).FirstOrDefault((Func)((Parcela pa) => ((DomainBase)p).Id == ((DomainBase)pa).Id)); + if (val != null) + { + List valorOriginal = ((DomainBase)val).GetValorOriginal(); + List list = ((DomainBase)p).Compare(valorOriginal); + if (list.Count > 0) + { + list.Insert(0, new Diferenca + { + Campo = "Parcela", + Descricao = "PARCELA", + ValorAtual = p.NumeroParcela.ToString(), + ValorAnterior = p.NumeroParcela.ToString() + }); + logs.Add(CreateLog(((DomainBase)documento).Id, list, (TipoTela)5)); + } + } + }); + } + } + documento.Controle = unitOfWork.ControleRepository.Merge(controle); + } + documento.Parcelas = parcelas; + SaveLog(logs, unitOfWork); + ((GenericUnitOfWork)unitOfWork).Commit(); + return documento; + } + finally + { + if (unitOfWork != null) + { + ((IDisposable)unitOfWork).Dispose(); + } + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)18, tries, new { documentoOriginal, updateParcelas, criarParcelas }); + } + } + return documentoOriginal; + }); + } + + internal async Task ExcluirVinculo(long id) + { + await Task.Run(delegate + { + try + { + UnitOfWork commited = Instancia.Commited; + try + { + commited.VinculoDocumentoRepository.Delete(id); + ((GenericUnitOfWork)commited).Commit(); + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception) + { + } + }); + } + + public async Task BuscarApoliceAsync(long id, bool itens = false, bool sinistrosPorControle = false) + { + int tries = 3; + return await Task.Run((Func)delegate + { + //IL_0064: Unknown result type (might be due to invalid IL or missing references) + //IL_006a: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.DocumentoRepository.FindById(id, itens, sinistrosPorControle); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)3, tries, id); + } + } + return new Documento(); + }); + } + + public async Task BuscarVendedorPrincipal(long id) + { + int tries = 3; + return await Task.Run((Func)delegate + { + //IL_0058: Unknown result type (might be due to invalid IL or missing references) + //IL_005e: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.VendedorParcelaRepository.BuscarVendedorPorControle(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)3, tries, id); + } + } + return new Vendedor(); + }); + } + + public async Task> BuscarApolicesPorId(List ids) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.DocumentoRepository.FindByIds(ids); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)3, tries, ids); + } + } + return new List(); + }); + } + + public async Task> BuscarApolicesPorIdParcela(List ids) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.DocumentoRepository.FindByParcelaIds(ids); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)3, tries, ids); + } + } + return new List(); + }); + } + + public async Task BuscarControleAsync(long id) + { + int tries = 3; + return await Task.Run((Func)delegate + { + //IL_0058: Unknown result type (might be due to invalid IL or missing references) + //IL_005e: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ControleRepository.FindById(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)4, tries, id); + } + } + return new Controle(); + }); + } + + public async Task ExcluirPagamento(List pagamentos) + { + int tries = 3; + base.Sucesso = true; + DateTime dateHora = Funcoes.GetNetworkTime(); + return await Task.Run(delegate + { + //IL_0041: Unknown result type (might be due to invalid IL or missing references) + //IL_0046: Unknown result type (might be due to invalid IL or missing references) + //IL_004d: Unknown result type (might be due to invalid IL or missing references) + //IL_0058: Unknown result type (might be due to invalid IL or missing references) + //IL_0064: Unknown result type (might be due to invalid IL or missing references) + //IL_0066: Unknown result type (might be due to invalid IL or missing references) + //IL_006b: Unknown result type (might be due to invalid IL or missing references) + //IL_0077: Expected O, but got Unknown + //IL_007c: Unknown result type (might be due to invalid IL or missing references) + //IL_008d: Unknown result type (might be due to invalid IL or missing references) + //IL_0095: Unknown result type (might be due to invalid IL or missing references) + //IL_00a0: Unknown result type (might be due to invalid IL or missing references) + //IL_00ab: Unknown result type (might be due to invalid IL or missing references) + //IL_00b6: Unknown result type (might be due to invalid IL or missing references) + //IL_00f4: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork commited = Instancia.Commited; + try + { + commited.VendedorParcelaRepository.DeleteRange(pagamentos); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + foreach (VendedorParcela pagamento in pagamentos) + { + RegistroLog keyValues = new RegistroLog + { + Acao = (TipoAcao)2, + Usuario = Recursos.Usuario, + DataHora = dateHora, + Descricao = JsonConvert.SerializeObject((object)pagamento, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)pagamento.Parcela).Id, + Tela = (TipoTela)37, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + } + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)21, tries, pagamentos); + } + } + return false; + }); + } + + public async Task IncluirVendedor(VendedorParcela vendedor) + { + int tries = 3; + base.Sucesso = true; + VendedorParcela vendedorSalvo = vendedor; + DateTime dateHora = Funcoes.GetNetworkTime(); + return await Task.Run((Func)delegate + { + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_0034: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork commited = Instancia.Commited; + try + { + vendedorSalvo = commited.VendedorParcelaRepository.SaveOrUpdate(vendedorSalvo); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog val = new RegistroLog(); + val.Acao = (TipoAcao)0; + val.Usuario = Recursos.Usuario; + val.DataHora = dateHora; + val.Descricao = $"O USUÁRIO {Recursos.Usuario.Nome} INCLUIU, EM {dateHora}, O VENDEDOR DE " + $"ID: '{((DomainBase)vendedor).Id}'" + $", VALOR DO PAGAMENTO: 'R${vendedor.ValorRepasse}'" + $", VALOR TOTAL: 'R${vendedor.ValorTotal}'" + ", DATA DO PAGAMENTO: '" + ((!vendedor.DataPagamento.HasValue) ? "" : (vendedor.DataPagamento?.ToShortDateString() ?? "")) + "'" + $", PORCENTAGEM DO PAGAMENTO: '{vendedor.PorcentagemRepasse}%'."; + val.EntidadeId = ((DomainBase)vendedor).Id; + val.Tela = (TipoTela)37; + val.Versao = LoginViewModel.VersaoAtual; + val.NomeMaquina = Environment.MachineName; + val.UsuarioMaquina = Environment.UserName; + val.Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString(); + RegistroLog keyValues = val; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return vendedorSalvo; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)22, tries, vendedor); + } + } + return vendedor; + }); + } + + public async Task> IncluirVendedores(List repasses) + { + int tries = 3; + base.Sucesso = true; + List repassesSalvos = repasses; + DateTime now = Funcoes.GetNetworkTime(); + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork unitOfWork = Instancia.Commited; + try + { + repassesSalvos = unitOfWork.VendedorParcelaRepository.AddRange(repassesSalvos); + IPHostEntry host = Dns.GetHostEntry(Dns.GetHostName()); + repassesSalvos.ForEach(delegate(VendedorParcela x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + //IL_0028: Unknown result type (might be due to invalid IL or missing references) + //IL_002a: Unknown result type (might be due to invalid IL or missing references) + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_003b: Expected O, but got Unknown + //IL_0040: Unknown result type (might be due to invalid IL or missing references) + //IL_0051: Unknown result type (might be due to invalid IL or missing references) + //IL_0059: Unknown result type (might be due to invalid IL or missing references) + //IL_0064: Unknown result type (might be due to invalid IL or missing references) + //IL_006f: Unknown result type (might be due to invalid IL or missing references) + //IL_007a: Unknown result type (might be due to invalid IL or missing references) + //IL_00bc: Expected O, but got Unknown + RegistroLog keyValues = new RegistroLog + { + Acao = (TipoAcao)0, + Usuario = Recursos.Usuario, + DataHora = now, + Descricao = JsonConvert.SerializeObject((object)x, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)x.Parcela).Id, + Tela = (TipoTela)37, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = host.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, unitOfWork); + ((GenericUnitOfWork)unitOfWork).Commit(); + }); + return repassesSalvos; + } + finally + { + if (unitOfWork != null) + { + ((IDisposable)unitOfWork).Dispose(); + } + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)22, tries, repasses); + } + } + return repasses; + }); + } + + public async Task> BuscarApolices(Filtros filtro, bool buscarAssinatura = false, bool painelBi = false) + { + int tries = 3; + return await Task.Run(async delegate + { + while (tries > 0) + { + try + { + UnitOfWork unitOfWork = Instancia.Read; + try + { + return await unitOfWork.DocumentoRepository.BuscaDocumentosPorVigencia(filtro, buscarAssinatura, painelBi); + } + finally + { + ((IDisposable)unitOfWork)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)5, tries, filtro); + } + } + return new List(); + }); + } + + public async Task> BuscarEndossos(Filtros filtro, bool buscarAssinatura = false) + { + int tries = 3; + return await Task.Run(async delegate + { + while (tries > 0) + { + try + { + UnitOfWork unitOfWork = Instancia.Read; + try + { + return await unitOfWork.DocumentoRepository.FindEndossoByVigencia(filtro, buscarAssinatura); + } + finally + { + ((IDisposable)unitOfWork)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)5, tries, filtro); + } + } + return new List(); + }); + } + + public async Task> BuscarApolicesVigenciaFinal(Filtros filtro, bool somarPremios = false) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.DocumentoRepository.FindByVigenciaFinal(filtro, LicenseHelper.Produtos, somarPremios); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)6, tries, filtro); + } + } + return new List(); + }); + } + + internal async Task BuscarCodDocumento(long pesquisa, List vendedorVinculado) + { + int tries = 3; + return await Task.Run((Func)delegate + { + //IL_005e: Unknown result type (might be due to invalid IL or missing references) + //IL_0064: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.DocumentoRepository.FindById(pesquisa, vendedorVinculado); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)3, tries, pesquisa); + } + } + return new Documento(); + }); + } + + internal async Task> BuscarApolice(string pesquisa, FiltroStatusDocumento status, List vendedorVinculado, string campo = "Apolice", bool tipobusca = false) + { + //IL_001e: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + int tries = 3; + return await Task.Run(delegate + { + //IL_009e: Unknown result type (might be due to invalid IL or missing references) + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.DocumentoRepository.FindApolice(pesquisa, status, vendedorVinculado, campo, (Recursos.Usuario.IdEmpresa == 1) ? 0 : Recursos.Usuario.IdEmpresa, Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 43), tipobusca); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)7, tries, new { pesquisa, status, campo }); + } + } + return new List(); + }); + } + + public async Task> BuscarFechamento(Filtros filtro) + { + int tries = 3; + return await Task.Run(async delegate + { + while (tries > 0) + { + try + { + UnitOfWork unitOfWork = Instancia.Read; + try + { + return await unitOfWork.DocumentoRepository.Fechamento(filtro); + } + finally + { + ((IDisposable)unitOfWork)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)8, tries, filtro); + } + } + return new List(); + }); + } + + public async Task Prorrogar(long id, DateTime vigencia2) + { + int tries = 3; + base.Sucesso = true; + DateTime now = Funcoes.GetNetworkTime(); + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork unitOfWork = Instancia.Commited; + try + { + unitOfWork.DocumentoRepository.FindByControle(id).ForEach(delegate(Documento x) + { + //IL_0073: Unknown result type (might be due to invalid IL or missing references) + //IL_0078: Unknown result type (might be due to invalid IL or missing references) + //IL_007f: Unknown result type (might be due to invalid IL or missing references) + //IL_008a: Unknown result type (might be due to invalid IL or missing references) + //IL_009b: Unknown result type (might be due to invalid IL or missing references) + //IL_009d: Unknown result type (might be due to invalid IL or missing references) + //IL_00a2: Unknown result type (might be due to invalid IL or missing references) + //IL_00ae: Expected O, but got Unknown + //IL_00b3: Unknown result type (might be due to invalid IL or missing references) + //IL_00bf: Unknown result type (might be due to invalid IL or missing references) + //IL_00c6: Unknown result type (might be due to invalid IL or missing references) + //IL_00d1: Unknown result type (might be due to invalid IL or missing references) + //IL_00dc: Unknown result type (might be due to invalid IL or missing references) + //IL_00e7: Unknown result type (might be due to invalid IL or missing references) + //IL_002a: Unknown result type (might be due to invalid IL or missing references) + //IL_0030: Invalid comparison between Unknown and I4 + //IL_0124: Expected O, but got Unknown + if (!x.NegocioCorretora.HasValue) + { + x.NegocioCorretora = (NegocioCorretora)((x.Negocio.HasValue && (int)x.Negocio.GetValueOrDefault() == 1) ? 1 : 0); + } + x.Vigencia2 = vigencia2; + unitOfWork.DocumentoRepository.Merge(x); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog keyValues = new RegistroLog + { + Acao = (TipoAcao)1, + Usuario = Recursos.Usuario, + DataHora = now, + Descricao = JsonConvert.SerializeObject((object)x, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)x).Id, + Tela = (TipoTela)2, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, unitOfWork); + }); + ((GenericUnitOfWork)unitOfWork).Commit(); + return true; + } + finally + { + if (unitOfWork != null) + { + ((IDisposable)unitOfWork).Dispose(); + } + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)23, tries, id); + } + } + return false; + }); + } + + public async Task Reabilitar(long id) + { + int tries = 3; + base.Sucesso = true; + DateTime now = Funcoes.GetNetworkTime(); + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork unitOfWork = Instancia.Commited; + try + { + unitOfWork.DocumentoRepository.FindByControle(id).ForEach(delegate(Documento x) + { + //IL_0046: Unknown result type (might be due to invalid IL or missing references) + //IL_004b: Unknown result type (might be due to invalid IL or missing references) + //IL_0052: Unknown result type (might be due to invalid IL or missing references) + //IL_005d: Unknown result type (might be due to invalid IL or missing references) + //IL_006e: Unknown result type (might be due to invalid IL or missing references) + //IL_0070: Unknown result type (might be due to invalid IL or missing references) + //IL_0075: Unknown result type (might be due to invalid IL or missing references) + //IL_0081: Expected O, but got Unknown + //IL_0086: Unknown result type (might be due to invalid IL or missing references) + //IL_0092: Unknown result type (might be due to invalid IL or missing references) + //IL_0099: Unknown result type (might be due to invalid IL or missing references) + //IL_00a4: Unknown result type (might be due to invalid IL or missing references) + //IL_00af: Unknown result type (might be due to invalid IL or missing references) + //IL_00ba: Unknown result type (might be due to invalid IL or missing references) + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Invalid comparison between Unknown and I4 + //IL_00f7: Expected O, but got Unknown + if (!x.TipoEndosso.HasValue || (int)x.TipoEndosso.GetValueOrDefault() != 2) + { + x.Situacao = (TipoSeguro)4; + unitOfWork.DocumentoRepository.Merge(x); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog keyValues = new RegistroLog + { + Acao = (TipoAcao)1, + Usuario = Recursos.Usuario, + DataHora = now, + Descricao = JsonConvert.SerializeObject((object)x, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)x).Id, + Tela = (TipoTela)2, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, unitOfWork); + } + }); + ((GenericUnitOfWork)unitOfWork).Commit(); + return true; + } + finally + { + if (unitOfWork != null) + { + ((IDisposable)unitOfWork).Dispose(); + } + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)23, tries, id); + } + } + return false; + }); + } + + public async Task Perdido(long id) + { + int tries = 3; + base.Sucesso = true; + DateTime now = Funcoes.GetNetworkTime(); + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork unitOfWork = Instancia.Commited; + try + { + unitOfWork.DocumentoRepository.FindByControle(id).ForEach(delegate(Documento x) + { + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Unknown result type (might be due to invalid IL or missing references) + //IL_003a: Unknown result type (might be due to invalid IL or missing references) + //IL_0041: Unknown result type (might be due to invalid IL or missing references) + //IL_004c: Unknown result type (might be due to invalid IL or missing references) + //IL_005d: Unknown result type (might be due to invalid IL or missing references) + //IL_005f: Unknown result type (might be due to invalid IL or missing references) + //IL_0064: Unknown result type (might be due to invalid IL or missing references) + //IL_0070: Expected O, but got Unknown + //IL_0075: Unknown result type (might be due to invalid IL or missing references) + //IL_0081: Unknown result type (might be due to invalid IL or missing references) + //IL_0088: Unknown result type (might be due to invalid IL or missing references) + //IL_0093: Unknown result type (might be due to invalid IL or missing references) + //IL_009e: Unknown result type (might be due to invalid IL or missing references) + //IL_00a9: Unknown result type (might be due to invalid IL or missing references) + //IL_00e6: Expected O, but got Unknown + x.SituacaoAnterior = x.Situacao; + x.Situacao = (TipoSeguro)6; + unitOfWork.DocumentoRepository.Merge(x); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog keyValues = new RegistroLog + { + Acao = (TipoAcao)1, + Usuario = Recursos.Usuario, + DataHora = now, + Descricao = JsonConvert.SerializeObject((object)x, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)x).Id, + Tela = (TipoTela)2, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, unitOfWork); + }); + ((GenericUnitOfWork)unitOfWork).Commit(); + return true; + } + finally + { + if (unitOfWork != null) + { + ((IDisposable)unitOfWork).Dispose(); + } + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)23, tries, id); + } + } + return false; + }); + } + + public async Task> BuscarApolicesPendentes(Filtros filtro) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.DocumentoRepository.FindPendenciasByVigencia(filtro); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)10, tries, filtro); + } + } + return new List(); + }); + } + + public async Task Save(long id, string observacao) + { + int tries = 3; + base.Sucesso = true; + Funcoes.GetNetworkTime(); + return await Task.Run(delegate + { + while (tries > 0) + { + List list = new List(); + try + { + UnitOfWork commited = Instancia.Commited; + try + { + Documento val = commited.DocumentoRepository.FindById(id, false, false); + ((DomainBase)val).Initialize(); + val.Observacao = observacao; + list.Add(CreateLog(((DomainBase)val).Id, val, (TipoTela)2)); + commited.DocumentoRepository.Merge(val); + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + return observacao; + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)18, tries, new { id, observacao }); + } + } + return ""; + }); + } + + public async Task ExcluirCritica(long id) + { + int tries = 3; + base.Sucesso = true; + DateTime now = Funcoes.GetNetworkTime(); + return await Task.Run(delegate + { + //IL_0045: Unknown result type (might be due to invalid IL or missing references) + //IL_004a: Unknown result type (might be due to invalid IL or missing references) + //IL_0051: Unknown result type (might be due to invalid IL or missing references) + //IL_0059: Unknown result type (might be due to invalid IL or missing references) + //IL_0064: Unknown result type (might be due to invalid IL or missing references) + //IL_0070: Unknown result type (might be due to invalid IL or missing references) + //IL_0072: Unknown result type (might be due to invalid IL or missing references) + //IL_0077: Unknown result type (might be due to invalid IL or missing references) + //IL_0083: Expected O, but got Unknown + //IL_0088: Unknown result type (might be due to invalid IL or missing references) + //IL_0094: Unknown result type (might be due to invalid IL or missing references) + //IL_009f: Unknown result type (might be due to invalid IL or missing references) + //IL_00aa: Unknown result type (might be due to invalid IL or missing references) + //IL_00b5: Unknown result type (might be due to invalid IL or missing references) + //IL_00f2: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork commited = Instancia.Commited; + try + { + CriticaApolice val = commited.CriticaApoliceRepository.FindByApolice(id); + if (val == null) + { + return true; + } + commited.CriticaApoliceRepository.Delete(((DomainBase)val).Id); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog keyValues = new RegistroLog + { + Acao = (TipoAcao)2, + Tela = (TipoTela)20, + Usuario = Recursos.Usuario, + DataHora = now, + Descricao = JsonConvert.SerializeObject((object)val, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)val).Id, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)25, tries, id); + } + } + return false; + }); + } + + public async Task> Auditoria(Filtros filtro) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.DocumentoRepository.Auditoria(filtro); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)13, tries, filtro); + } + } + return new List(); + }); + } + + public async Task BaixarParcelasCancelamento(Documento documento, bool estorno) + { + int tries = 3; + base.Sucesso = true; + DateTime now = Funcoes.GetNetworkTime(); + return await Task.Run(delegate + { + //IL_0071: Unknown result type (might be due to invalid IL or missing references) + //IL_0076: Unknown result type (might be due to invalid IL or missing references) + //IL_007d: Unknown result type (might be due to invalid IL or missing references) + //IL_0088: Unknown result type (might be due to invalid IL or missing references) + //IL_0094: Unknown result type (might be due to invalid IL or missing references) + //IL_009b: Unknown result type (might be due to invalid IL or missing references) + //IL_00a0: Unknown result type (might be due to invalid IL or missing references) + //IL_00ac: Expected O, but got Unknown + //IL_00b1: Unknown result type (might be due to invalid IL or missing references) + //IL_00c2: Unknown result type (might be due to invalid IL or missing references) + //IL_00c9: Unknown result type (might be due to invalid IL or missing references) + //IL_00d4: Unknown result type (might be due to invalid IL or missing references) + //IL_00df: Unknown result type (might be due to invalid IL or missing references) + //IL_00ea: Unknown result type (might be due to invalid IL or missing references) + //IL_0127: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork unitOfWork = Instancia.Commited; + try + { + unitOfWork.ParcelaRepository.FindByDocumentId(((DomainBase)documento).Id).ToList().ForEach(delegate(Parcela x) + { + List list = unitOfWork.VendedorParcelaRepository.FindByParcela(((DomainBase)x).Id); + if (list.Count > 0) + { + if (estorno) + { + string documentoLabel = ((documento.Tipo == 0) ? (" PROPOSTA " + documento.Proposta + " DO CLIENTE " + documento.Controle.Cliente.Nome) : (" PROPOSTA DE ENDOSSO " + documento.PropostaEndosso + " DO CLIENTE " + documento.Controle.Cliente.Nome)); + List list2 = (from v in list + where v.DataPagamento.HasValue + group v by ((DomainBase)v.Vendedor).Id).Select((Func, Adiantamento>)((IGrouping v) => new Adiantamento + { + Vendedor = v.First().Vendedor, + Data = now, + Valor = v.Where((VendedorParcela s) => s.ValorRepasse.HasValue).Sum(delegate(VendedorParcela s) + { + decimal value = s.ValorRepasse.Value; + decimal value2 = 1; + decimal? desconto = v.First().Vendedor.Desconto; + return value * ((decimal?)value2 - desconto).GetValueOrDefault(); + }), + Historico = $"ESTORNO DEVIDO A RECUSA {documentoLabel} PARCELA {x.NumeroParcela}" + })).ToList(); + unitOfWork.AdiantamentoRepository.AddRange(list2); + list.Where((VendedorParcela v) => !v.DataPagamento.HasValue).ToList().ForEach(delegate(VendedorParcela v) + { + v.ValorRepasse = default(decimal); + v.DataPagamento = now; + v.DataPrePagamento = v.DataPrePagamento.GetValueOrDefault(now); + unitOfWork.VendedorParcelaRepository.Merge(v); + }); + } + else + { + list.Where((VendedorParcela v) => !v.DataPrePagamento.HasValue).ToList().ForEach(delegate(VendedorParcela v) + { + v.ValorRepasse = default(decimal); + v.DataPagamento = now; + v.DataPrePagamento = v.DataPrePagamento.GetValueOrDefault(now); + unitOfWork.VendedorParcelaRepository.Merge(v); + }); + } + } + if (!x.DataRecebimento.HasValue) + { + x.DataRecebimento = now; + x.DataCredito = now; + x.ValorComissao = 0m; + x.ValorComDesconto = 0m; + unitOfWork.ParcelaRepository.Merge(x); + } + }); + unitOfWork.DocumentoRepository.Merge(documento); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog keyValues = new RegistroLog + { + Acao = (TipoAcao)1, + Usuario = Recursos.Usuario, + DataHora = now, + Descricao = JsonConvert.SerializeObject((object)documento, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)documento).Id, + Tela = (TipoTela)2, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, unitOfWork); + ((GenericUnitOfWork)unitOfWork).Commit(); + return true; + } + finally + { + if (unitOfWork != null) + { + ((IDisposable)unitOfWork).Dispose(); + } + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)26, tries, documento); + } + } + return false; + }); + } + + public async Task Cotacoes(Filtros filtro) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.DocumentoRepository.Cotacoes(filtro); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)14, tries, filtro); + } + } + return 0; + }); + } + + public async Task> BuscarLicenciamentos(Filtros filtro) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.DocumentoRepository.FindByLicenciamento(filtro); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)295, tries, filtro); + } + } + return new List(); + }); + } + + public async Task> BuscarPlacas(Filtros filtro) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.DocumentoRepository.FindByPlaca(filtro); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)327, tries, filtro); + } + } + return new List(); + }); + } + + public async Task> BuscarTarefas(Filtros filtro) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.TarefaRepository.BuscarTarefaPorFiltro(filtro.Inicio, filtro.Fim); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)97, tries, filtro); + } + } + return new List(); + }); + } + + public async Task> BuscarPlanilhaCompleta(List ids, bool configFranquia, bool configPremio) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ReportRepository.PlanilhaCompleta(ids, configFranquia, configPremio); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)296, tries, ids); + } + } + return (List)null; + }); + } + + public async Task> BuscarPlanilhaCompletaFatura(List ids, Relatorio relatorio, DateTime inicio, DateTime fim, bool configFranquia, bool configPremio) + { + //IL_001e: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + int tries = 3; + return await Task.Run(delegate + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ReportRepository.PlanilhaCompletaFatura(ids, relatorio, inicio, fim, configFranquia, configPremio); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)296, tries, ids); + } + } + return (List)null; + }); + } + + public async Task> BuscarPlanilhaCompletaProspeccao(List ids) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.DocumentoRepository.BuscarPlanilhaCompletaProspeccao(ids); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)296, tries, ids); + } + } + return (List)null; + }); + } + + public async Task BuscarLogAntigo(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.DocumentoRepository.BuscarLogAntigo(id, Connection.GetConnectionString()); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)319, tries, id); + } + } + return (string)null; + }); + } + + public async Task SalvarAssistencia(string id, long controleId) + { + await Task.Run(delegate + { + try + { + UnitOfWork commited = Instancia.Commited; + try + { + commited.DocumentoRepository.SalvarAssistencia(id, controleId); + ((GenericUnitOfWork)commited).Commit(); + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception) + { + } + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Seguros/AtividadeServico.cs b/Decompiler/Gestor.Application.Servicos.Seguros/AtividadeServico.cs new file mode 100644 index 0000000..44347a0 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Seguros/AtividadeServico.cs @@ -0,0 +1,76 @@ +using System; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; + +namespace Gestor.Application.Servicos.Seguros; + +internal class AtividadeServico : BaseServico +{ + public async Task Save(Atividade atividade) + { + int tries = 3; + base.Sucesso = true; + Atividade atividadeOriginal = atividade; + return await Task.Run((Func)delegate + { + while (tries > 0) + { + atividade = atividadeOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + bool flag = ((DomainBase)atividade).Id == 0; + atividade = (flag ? commited.AtividadeRepository.SaveOrUpdate(atividade) : commited.AtividadeRepository.Merge(atividade)); + ((GenericUnitOfWork)commited).Commit(); + return atividade; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)211, tries, atividade); + } + } + return atividadeOriginal; + }); + } + + public async Task FindLastId() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.AtividadeRepository.FindLastId(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)17, tries); + } + } + return 0L; + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Seguros/ClienteServico.cs b/Decompiler/Gestor.Application.Servicos.Seguros/ClienteServico.cs new file mode 100644 index 0000000..4b94129 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Seguros/ClienteServico.cs @@ -0,0 +1,1082 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Common.Validation; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Relatorios; +using Gestor.Model.Domain.Relatorios.Classificacao; +using Gestor.Model.Domain.Relatorios.ClientesAtivosInativos; +using Gestor.Model.Domain.Relatorios.Dashboard; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.License; + +namespace Gestor.Application.Servicos.Seguros; + +internal class ClienteServico : BaseServico +{ + internal async Task> BuscarCliente(string value, List vinculos = null, TipoFiltroCliente tipoFiltroCliente = 2) + { + //IL_0026: Unknown result type (might be due to invalid IL or missing references) + //IL_0027: Unknown result type (might be due to invalid IL or missing references) + value = ValidationHelper.RemoverAcentos(value.Trim()); + if (string.IsNullOrWhiteSpace(value)) + { + return new List(); + } + int tries = 3; + return await Task.Run(delegate + { + //IL_0076: Unknown result type (might be due to invalid IL or missing references) + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + long num = ((Recursos.Usuario.IdEmpresa == 1) ? 0 : Recursos.Usuario.IdEmpresa); + bool flag = LicenseHelper.Produtos.Any((Licenca x) => (int)x.Produto == 86 && x.Status != 3); + return (from x in read.ClienteRepository.FindClienteVinculo(value, vinculos, num, ((DomainBase)Recursos.Usuario).Id == 0, flag, tipoFiltroCliente) + orderby x.Nome + select x).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)29, tries, value); + } + } + return new List(); + }); + } + + internal async Task> BuscarClientePorDocumento(string documento) + { + documento = ValidationHelper.RemoverAcentos(documento.Trim()).ToUpper(); + if (string.IsNullOrWhiteSpace(documento)) + { + return new List(); + } + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return (from c in read.ClienteRepository.FindClienteDocumento(documento) + orderby c.Nome + select c).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)29, tries, documento); + } + } + return new List(); + }); + } + + internal async Task> BuscarClienteVinculo(string value, long id) + { + if (string.IsNullOrWhiteSpace(value)) + { + return new List(); + } + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return (from x in read.ClienteRepository.FindVinculo(value, id) + orderby x.Nome + select x).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)29, tries, value); + } + } + return new List(); + }); + } + + internal async Task BuscarCliente(long id) + { + int tries = 3; + return await Task.Run((Func)delegate + { + //IL_0065: Unknown result type (might be due to invalid IL or missing references) + //IL_006b: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + Cliente obj = read.ClienteRepository.FindById(id); + obj.Nome = obj.Nome; + return obj; + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)28, tries, id); + } + } + return new Cliente(); + }); + } + + internal async Task> BuscarTelefonesAsync(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new ObservableCollection(from x in read.ClienteTelefoneRepository.FindByClienteId(id) + orderby x.Ordem + select x); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)30, tries, id); + } + } + return new ObservableCollection(); + }); + } + + internal ObservableCollection BuscarTelefones(long id) + { + int num = 3; + while (num > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new ObservableCollection(from x in read.ClienteTelefoneRepository.FindByClienteId(id) + orderby x.Ordem + select x); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + num = Registrar(e, (TipoErro)30, num, id); + } + } + return new ObservableCollection(); + } + + internal async Task> BuscarTelefonesClientes(string telefone) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ClienteTelefoneRepository.Find(telefone, (Recursos.Usuario.IdEmpresa == 1) ? 0 : Recursos.Usuario.IdEmpresa); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)31, tries, telefone); + } + } + return new List(); + }); + } + + internal async Task> BuscarEmailsAsync(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new ObservableCollection(from mail in read.ClienteEmailRepository.FindByClienteId(id) + orderby mail.Ordem + select mail); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)32, tries, id); + } + } + return new ObservableCollection(); + }); + } + + internal async Task> BuscarVinculosAsync(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new ObservableCollection(read.ClienteVinculoRepository.FindByCliente(id)); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)33, tries, id); + } + } + return new ObservableCollection(); + }); + } + + internal async Task> BuscarEnderecosAsync(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new ObservableCollection(from x in read.ClienteEnderecoRepository.FindByClienteId(id) + orderby x.Ordem + select x); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)34, tries, id); + } + } + return new ObservableCollection(); + }); + } + + internal async Task> BuscarContatosAsync(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new ObservableCollection(read.MaisContatoRepository.FindByCustomerId(id)); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)35, tries, id); + } + } + return new ObservableCollection(); + }); + } + + public async Task AddCentralSegurado(long id, bool update = true) + { + await Task.Run(delegate + { + UnitOfWork commited = Instancia.Commited; + try + { + commited.ClienteRepository.AddCentralSegurado(id, update); + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + }); + } + + public async Task Save(Cliente cliente, bool salvando = false) + { + int tries = 3; + base.Sucesso = true; + Cliente clienteOriginal = cliente; + return await Task.Run((Func)delegate + { + //IL_003a: Unknown result type (might be due to invalid IL or missing references) + //IL_0160: Unknown result type (might be due to invalid IL or missing references) + //IL_0162: Invalid comparison between Unknown and I4 + //IL_015f: Unknown result type (might be due to invalid IL or missing references) + //IL_0536: Unknown result type (might be due to invalid IL or missing references) + while (tries > 0) + { + List logs = new List(); + cliente = clienteOriginal; + try + { + TipoAcao val = (TipoAcao)(((DomainBase)cliente).Id != 0L); + List list = cliente.Telefones?.ToList(); + List list2 = cliente.Enderecos?.ToList(); + List list3 = cliente.Contatos?.ToList(); + List list4 = cliente.Emails?.ToList(); + List list5 = cliente.Vinculos?.ToList(); + List list6 = cliente.Origens; + cliente.Telefones = null; + cliente.Enderecos = null; + cliente.Contatos = null; + cliente.Emails = null; + cliente.Vinculos = null; + cliente.Contatos = null; + cliente.Origens = null; + UnitOfWork unitOfWork = Instancia.Commited; + try + { + bool flag = ((DomainBase)cliente).Id == 0; + if (((DomainBase)cliente).Id != 0 && salvando) + { + flag = true; + val = (TipoAcao)0; + } + if ((int)val == 1) + { + List lista = new List { list, list2, list3, list4, list5, cliente }; + logs.Add(CreateDynamicLog(((DomainBase)cliente).Id, lista, (TipoTela)1)); + unitOfWork.ClienteTelefoneRepository.DeleteFone(((DomainBase)cliente).Id, list)?.ForEach(delegate(ClienteTelefone fone) + { + logs.Add(CreateLog(((DomainBase)cliente).Id, ((DomainBase)fone).GetValorOriginal(), (TipoTela)1, (TipoAcao)2)); + }); + unitOfWork.ClienteEnderecoRepository.DeleteEndereco(((DomainBase)cliente).Id, list2)?.ForEach(delegate(ClienteEndereco endereco) + { + logs.Add(CreateLog(((DomainBase)cliente).Id, ((DomainBase)endereco).GetValorOriginal(), (TipoTela)1, (TipoAcao)2)); + }); + unitOfWork.MaisContatoRepository.DeleteContato(((DomainBase)cliente).Id, list3)?.ForEach(delegate(MaisContato contato) + { + logs.Add(CreateLog(((DomainBase)cliente).Id, ((DomainBase)contato).GetValorOriginal(), (TipoTela)1, (TipoAcao)2)); + }); + unitOfWork.ClienteEmailRepository.DeleteMail(((DomainBase)cliente).Id, list4)?.ForEach(delegate(ClienteEmail mail) + { + logs.Add(CreateLog(((DomainBase)cliente).Id, ((DomainBase)mail).GetValorOriginal(), (TipoTela)1, (TipoAcao)2)); + }); + unitOfWork.ClienteVinculoRepository.DeleteVinculo(((DomainBase)cliente).Id, list5)?.ForEach(delegate(ClienteVinculo vinculo) + { + logs.Add(CreateLog(((DomainBase)cliente).Id, ((DomainBase)vinculo).GetValorOriginal(), (TipoTela)1, (TipoAcao)2)); + }); + } + if (flag) + { + cliente = unitOfWork.ClienteRepository.SaveOrUpdate(cliente); + if (list != null) + { + list = unitOfWork.ClienteTelefoneRepository.Inserir(list, cliente); + } + if (list2 != null) + { + list2 = unitOfWork.ClienteEnderecoRepository.Inserir(list2, cliente); + } + if (list3 != null) + { + list3 = unitOfWork.MaisContatoRepository.Inserir(list3, cliente); + } + if (list4 != null) + { + list4 = unitOfWork.ClienteEmailRepository.Inserir(list4, cliente); + } + if (list5 != null) + { + list5 = unitOfWork.ClienteVinculoRepository.Inserir(list5, cliente); + } + list6?.ForEach(delegate(OrigemCliente x) + { + x.Cliente = cliente; + x = unitOfWork.ClienteRepository.SaveOrUpdate(x); + }); + } + else + { + if (list != null) + { + list = unitOfWork.ClienteTelefoneRepository.Merge(list, cliente); + } + if (list2 != null) + { + list2 = unitOfWork.ClienteEnderecoRepository.Merge(list2, cliente); + } + if (list3 != null) + { + list3 = unitOfWork.MaisContatoRepository.Merge(list3, cliente); + } + if (list4 != null) + { + list4 = unitOfWork.ClienteEmailRepository.Merge(list4, cliente); + } + if (list5 != null) + { + list5 = unitOfWork.ClienteVinculoRepository.Merge(list5, cliente); + } + list6 = unitOfWork.ClienteRepository.Sincronize(list6, ((DomainBase)cliente).Id); + cliente = unitOfWork.ClienteRepository.Merge(cliente); + } + cliente.Nome = cliente.Nome; + cliente.Telefones = ((list == null) ? null : new ObservableCollection(list)); + cliente.Enderecos = ((list2 == null) ? null : new ObservableCollection(list2)); + cliente.Contatos = ((list3 == null) ? null : new ObservableCollection(list3)); + cliente.Emails = ((list4 == null) ? null : new ObservableCollection(list4)); + cliente.Vinculos = ((list5 == null) ? null : new ObservableCollection(list5)); + cliente.Origens = list6; + if ((int)val == 0) + { + logs.Add(CreateLog(((DomainBase)cliente).Id, ((DomainBase)cliente).GetValorOriginal(), (TipoTela)1, (TipoAcao)0)); + cliente.Telefones?.ToList().ForEach(delegate(ClienteTelefone fone) + { + logs.Add(CreateLog(((DomainBase)cliente).Id, ((DomainBase)fone).GetValorOriginal(), (TipoTela)1, (TipoAcao)0)); + }); + cliente.Enderecos?.ToList().ForEach(delegate(ClienteEndereco endereco) + { + logs.Add(CreateLog(((DomainBase)cliente).Id, ((DomainBase)endereco).GetValorOriginal(), (TipoTela)1, (TipoAcao)0)); + }); + cliente.Contatos?.ToList().ForEach(delegate(MaisContato contato) + { + logs.Add(CreateLog(((DomainBase)cliente).Id, ((DomainBase)contato).GetValorOriginal(), (TipoTela)1, (TipoAcao)0)); + }); + cliente.Emails?.ToList().ForEach(delegate(ClienteEmail mail) + { + logs.Add(CreateLog(((DomainBase)cliente).Id, ((DomainBase)mail).GetValorOriginal(), (TipoTela)1, (TipoAcao)0)); + }); + cliente.Vinculos?.ToList().ForEach(delegate(ClienteVinculo vinculo) + { + logs.Add(CreateLog(((DomainBase)cliente).Id, ((DomainBase)vinculo).GetValorOriginal(), (TipoTela)1, (TipoAcao)0)); + }); + } + SaveLog(logs, unitOfWork); + ((GenericUnitOfWork)unitOfWork).Commit(); + return cliente; + } + finally + { + if (unitOfWork != null) + { + ((IDisposable)unitOfWork).Dispose(); + } + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)171, tries, cliente); + } + } + return clienteOriginal; + }); + } + + public async Task Delete(Cliente cliente) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + List list = new List(); + try + { + UnitOfWork commited = Instancia.Commited; + try + { + list.Add(CreateLog(((DomainBase)cliente).Id, ((DomainBase)cliente).GetValorOriginal(), (TipoTela)1, (TipoAcao)2)); + commited.ClienteRepository.Merge(cliente); + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)172, tries, cliente); + } + } + return false; + }); + } + + public async Task> BuscarTodosClientes() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return (from x in read.ClienteRepository.FindAllClientes(false, (Recursos.Usuario.IdEmpresa == 1) ? 0 : Recursos.Usuario.IdEmpresa) + orderby x.Nome + select x).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)36, tries); + } + } + return new List(); + }); + } + + public async Task> BuscarClientesAtvosInativos(bool completo) + { + int tries = 3; + return await Task.Run(async delegate + { + while (tries > 0) + { + try + { + UnitOfWork unitOfWork = Instancia.Read; + try + { + return await unitOfWork.ClienteRepository.BuscaClientes(completo, (Recursos.Usuario.IdEmpresa == 1) ? 0 : Recursos.Usuario.IdEmpresa); + } + finally + { + ((IDisposable)unitOfWork)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)286, tries); + } + } + return new List(); + }); + } + + public async Task BuscarClienteAsync(long id) + { + int tries = 3; + return await Task.Run((Func)delegate + { + //IL_005b: Unknown result type (might be due to invalid IL or missing references) + //IL_0061: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + Cliente obj = read.ClienteRepository.FindById(id); + obj.Nome = obj.Nome; + return obj; + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)27, tries); + } + } + return new Cliente(); + }); + } + + public async Task> BuscarEmailsPorCliente(List ids) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ClienteEmailRepository.FindByCliente(ids); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)37, tries); + } + } + return new List(); + }); + } + + public async Task> BuscarEnderecosPorCliente(List clientes) + { + int tries = 3; + if (clientes.All((Cliente x) => ((DomainBase)x).Id < 0)) + { + return new List(); + } + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ClienteEnderecoRepository.FindByCliente(clientes); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)38, tries); + } + } + return new List(); + }); + } + + public async Task> BuscarObsCliente(string pesquisa) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ClienteRepository.FindObsCliente(pesquisa, (Recursos.Usuario.IdEmpresa == 1) ? 0 : Recursos.Usuario.IdEmpresa); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)39, tries); + } + } + return new List(); + }); + } + + public async Task> BuscarPastaCliente(string pesquisa, bool busca) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ClienteRepository.FindPastaCliente(pesquisa, busca, 0L); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)40, tries); + } + } + return new List(); + }); + } + + public async Task> BuscarAniversariantes(Filtros filtro) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ClienteRepository.BuscarAniversariantes(filtro, (Recursos.Usuario.IdEmpresa == 1) ? 0 : Recursos.Usuario.IdEmpresa); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)41, tries); + } + } + return new List(); + }); + } + + public async Task> BuscarVencimentosCnh(Filtros filtro) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ClienteRepository.BuscarVencimentoCnh(filtro, (Recursos.Usuario.IdEmpresa == 1) ? 0 : Recursos.Usuario.IdEmpresa); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)42, tries); + } + } + return new List(); + }); + } + + public async Task> BuscarProspect(Filtros filtro) + { + int tries = 3; + return await Task.Run(async delegate + { + while (tries > 0) + { + try + { + UnitOfWork unitOfWork = Instancia.Read; + try + { + return await unitOfWork.ClienteRepository.BuscaProspeccoes(filtro, (Recursos.Usuario.IdEmpresa == 1) ? 0 : Recursos.Usuario.IdEmpresa); + } + finally + { + ((IDisposable)unitOfWork)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)324, tries); + } + } + return new List(); + }); + } + + public async Task SalvarObservacoes(long id, string observacao) + { + int tries = 3; + base.Sucesso = true; + Funcoes.GetNetworkTime(); + return await Task.Run(delegate + { + while (tries > 0) + { + List list = new List(); + try + { + UnitOfWork commited = Instancia.Commited; + try + { + Cliente val = commited.ClienteRepository.FindById(id); + ((DomainBase)val).Initialize(); + val.Observacao = observacao; + list.Add(CreateLog(((DomainBase)val).Id, val, (TipoTela)1)); + commited.ClienteRepository.Merge(val); + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + return observacao; + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)171, tries, new { id, observacao }); + } + } + return ""; + }); + } + + public async Task> BuscarOrigens(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new ObservableCollection(read.ClienteRepository.BuscarOrigem(id)); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)326, tries, id); + } + } + return new ObservableCollection(); + }); + } + + public async Task BuscarLogAntigo(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ClienteRepository.BuscarLogAntigo(id, Connection.GetConnectionString()); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)319, tries, id); + } + } + return (string)null; + }); + } + + internal DateTime? BuscarNascimento(long id) + { + int num = 3; + while (num > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ClienteRepository.BuscaNascimeto(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + num = Registrar(e, (TipoErro)328, num, id); + } + } + return null; + } + + public async Task> BuscarClassificacoes() + { + int tries = 3; + return await Task.Run(async delegate + { + while (tries > 0) + { + try + { + UnitOfWork unitOfWork = Instancia.Read; + try + { + return await unitOfWork.ClienteRepository.BuscarClassificacoes((Recursos.Usuario.IdEmpresa == 1) ? 0 : Recursos.Usuario.IdEmpresa); + } + finally + { + ((IDisposable)unitOfWork)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)286, tries); + } + } + return new List(); + }); + } + + public async Task> BuscarClientesAtvosInativosVinculo(bool completo, List vinculo) + { + int tries = 3; + return await Task.Run(async delegate + { + while (tries > 0) + { + try + { + UnitOfWork unitOfWork = Instancia.Read; + try + { + return await unitOfWork.ClienteRepository.BuscaClientesVinculo(completo, vinculo, (Recursos.Usuario.IdEmpresa == 1) ? 0 : Recursos.Usuario.IdEmpresa); + } + finally + { + ((IDisposable)unitOfWork)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)286, tries); + } + } + return new List(); + }); + } + + public async Task> BuscarAniversariantesVinculo(Filtros filtro, List vinculo) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ClienteRepository.BuscarAniversariantesVinculo(filtro, vinculo, (Recursos.Usuario.IdEmpresa == 1) ? 0 : Recursos.Usuario.IdEmpresa); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)41, tries); + } + } + return new List(); + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Seguros/CriticaApoliceServico.cs b/Decompiler/Gestor.Application.Servicos.Seguros/CriticaApoliceServico.cs new file mode 100644 index 0000000..bf95774 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Seguros/CriticaApoliceServico.cs @@ -0,0 +1,302 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Sockets; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Newtonsoft.Json; + +namespace Gestor.Application.Servicos.Seguros; + +internal class CriticaApoliceServico : BaseServico +{ + private bool _carregando; + + internal async Task BuscarCliente(long id) + { + int tries = 3; + return await Task.Run((Func)delegate + { + //IL_0059: Unknown result type (might be due to invalid IL or missing references) + //IL_005f: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ClienteRepository.FindById(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)27, tries, id); + } + } + return new Cliente(); + }); + } + + public async Task> BuscarCritica(long usuario, DateTime inicio, DateTime fim, long id = 0L, bool criticado = false, List vinculos = null) + { + if (_carregando) + { + return new List(); + } + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + _carregando = true; + UnitOfWork read = Instancia.Read; + try + { + id = ((DomainBase)read.VendedorRepository.FindCorretora()).Id; + List result = read.CriticaApoliceRepository.Find(usuario, inicio, fim, id, criticado, (Recursos.Usuario.IdEmpresa == 1) ? 0 : Recursos.Usuario.IdEmpresa, vinculos, Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 43), Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 38)); + _carregando = false; + return result; + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)43, tries, new { usuario, inicio, fim, criticado }); + } + } + _carregando = false; + return new List(); + }); + } + + public async Task> BuscarCritica(DateTime inicio, DateTime fim) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.CriticaApoliceRepository.Find(inicio, fim, (Recursos.Usuario.IdEmpresa == 1) ? 0 : Recursos.Usuario.IdEmpresa); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)43, tries, new { inicio, fim }); + } + } + return new List(); + }); + } + + public async Task> BuscarUsuarioCritica(DateTime inicio, DateTime fim, bool criticado = false) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return (from x in read.CriticaApoliceRepository.BuscarUsuarioCritica(inicio, fim, criticado, (Recursos.Usuario.IdEmpresa == 1) ? 0 : Recursos.Usuario.IdEmpresa) + orderby x.Nome + select x).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)43, tries, new { inicio, fim, criticado }); + } + } + return new List(); + }); + } + + public async Task> BuscarCritica(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.CriticaApoliceRepository.Find(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)44, tries, id); + } + } + return new List(); + }); + } + + public async Task> BuscarImportacao(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.CriticaApoliceRepository.FindImport(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)45, tries, id); + } + } + return new List(); + }); + } + + public async Task> BuscarSeguroCombinado(long id, DateTime vigencia) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.CriticaApoliceRepository.FindDuo(id, vigencia); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)44, tries, id); + } + } + return new List(); + }); + } + + public async Task Save(CriticaApolice critica) + { + int tries = 3; + base.Sucesso = true; + CriticaApolice criticaSalva = critica; + return await Task.Run((Func)delegate + { + //IL_001d: Unknown result type (might be due to invalid IL or missing references) + //IL_0040: Unknown result type (might be due to invalid IL or missing references) + //IL_0045: Unknown result type (might be due to invalid IL or missing references) + //IL_0046: Unknown result type (might be due to invalid IL or missing references) + //IL_004c: Unknown result type (might be due to invalid IL or missing references) + //IL_0057: Unknown result type (might be due to invalid IL or missing references) + //IL_0062: Unknown result type (might be due to invalid IL or missing references) + //IL_0069: Unknown result type (might be due to invalid IL or missing references) + //IL_006e: Unknown result type (might be due to invalid IL or missing references) + //IL_007a: Expected O, but got Unknown + //IL_007f: Unknown result type (might be due to invalid IL or missing references) + //IL_0090: Unknown result type (might be due to invalid IL or missing references) + //IL_0098: Unknown result type (might be due to invalid IL or missing references) + //IL_00a3: Unknown result type (might be due to invalid IL or missing references) + //IL_00ae: Unknown result type (might be due to invalid IL or missing references) + //IL_00b9: Unknown result type (might be due to invalid IL or missing references) + //IL_00f6: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork commited = Instancia.Commited; + try + { + TipoAcao acao = (TipoAcao)(((DomainBase)criticaSalva).Id != 0L); + criticaSalva = commited.CriticaApoliceRepository.Merge(criticaSalva); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog keyValues = new RegistroLog + { + Acao = acao, + Usuario = Recursos.Usuario, + DataHora = Funcoes.GetNetworkTime(), + Descricao = JsonConvert.SerializeObject((object)criticaSalva, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)criticaSalva).Id, + Tela = (TipoTela)20, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return criticaSalva; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)173, tries, critica); + } + } + return critica; + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Seguros/ExpedicaoServico.cs b/Decompiler/Gestor.Application.Servicos.Seguros/ExpedicaoServico.cs new file mode 100644 index 0000000..ae17e2d --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Seguros/ExpedicaoServico.cs @@ -0,0 +1,178 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Sockets; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Newtonsoft.Json; + +namespace Gestor.Application.Servicos.Seguros; + +public class ExpedicaoServico : BaseServico +{ + public async Task> BuscarExpedicoes(Documento documento) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ExpedicaoRepository.FindByIdDocumento(((DomainBase)documento).Id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)289, tries, documento); + } + } + return new List(); + }); + } + + public async Task Save(Expedicao expedicao) + { + int tries = 3; + base.Sucesso = true; + Expedicao expedicaoOriginal = expedicao; + return await Task.Run((Func)delegate + { + //IL_0028: Unknown result type (might be due to invalid IL or missing references) + //IL_00cd: Unknown result type (might be due to invalid IL or missing references) + //IL_00d2: Unknown result type (might be due to invalid IL or missing references) + //IL_00d3: Unknown result type (might be due to invalid IL or missing references) + //IL_00d9: Unknown result type (might be due to invalid IL or missing references) + //IL_00e4: Unknown result type (might be due to invalid IL or missing references) + //IL_00eb: Unknown result type (might be due to invalid IL or missing references) + //IL_00f2: Unknown result type (might be due to invalid IL or missing references) + //IL_00f7: Unknown result type (might be due to invalid IL or missing references) + //IL_0103: Expected O, but got Unknown + //IL_0108: Unknown result type (might be due to invalid IL or missing references) + //IL_0119: Unknown result type (might be due to invalid IL or missing references) + //IL_0121: Unknown result type (might be due to invalid IL or missing references) + //IL_012c: Unknown result type (might be due to invalid IL or missing references) + //IL_0137: Unknown result type (might be due to invalid IL or missing references) + //IL_0142: Unknown result type (might be due to invalid IL or missing references) + //IL_0180: Expected O, but got Unknown + while (tries > 0) + { + expedicao = expedicaoOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + TipoAcao acao = (TipoAcao)(((DomainBase)expedicao).Id != 0L); + DateTime networkTime = Funcoes.GetNetworkTime(); + if (((DomainBase)expedicao).Id == 0L) + { + expedicao.UsuarioCriacao = ((DomainBase)Recursos.Usuario).Id; + expedicao.DataCriacao = networkTime; + expedicao = commited.ExpedicaoRepository.SaveOrUpdate(expedicao); + } + else + { + expedicao.UsuarioAlteracao = ((DomainBase)Recursos.Usuario).Id; + expedicao.DataAlteracao = networkTime; + expedicao = commited.ExpedicaoRepository.Merge(expedicao); + } + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog keyValues = new RegistroLog + { + Acao = acao, + Usuario = Recursos.Usuario, + DataHora = networkTime, + Descricao = JsonConvert.SerializeObject((object)expedicao, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)expedicao).Id, + Tela = (TipoTela)46, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return expedicao; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)290, tries, expedicao); + } + } + return expedicaoOriginal; + }); + } + + public async Task Delete(Expedicao expedicao) + { + int tries = 3; + return await Task.Run(delegate + { + //IL_0033: Unknown result type (might be due to invalid IL or missing references) + //IL_003a: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork commited = Instancia.Commited; + try + { + commited.ExpedicaoRepository.Delete(((DomainBase)expedicao).Id); + DateTime networkTime = Funcoes.GetNetworkTime(); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog val = new RegistroLog(); + val.Acao = (TipoAcao)2; + val.Usuario = Recursos.Usuario; + val.DataHora = networkTime; + val.Descricao = $"O USUÁRIO {Recursos.Usuario.Nome} EXCLUIU, EM {networkTime}, A EXPEDIÇÃO DE " + $"ID: '{((DomainBase)expedicao).Id}'" + ", DOCUMENTO: '" + expedicao.Documento + "', DESTINO: '" + expedicao.Destino + "'" + $", DATA ENVIO: '{expedicao.DataEnvio}'" + $", DATA RECEBIMENTO: '{expedicao.DataRecebimento}'" + ", RESPONSÁVEL: 'R$" + expedicao.Responsavel + "'."; + val.EntidadeId = ((DomainBase)expedicao).Id; + val.Versao = LoginViewModel.VersaoAtual; + val.Tela = (TipoTela)46; + val.NomeMaquina = Environment.MachineName; + val.UsuarioMaquina = Environment.UserName; + val.Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString(); + RegistroLog keyValues = val; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)291, tries, expedicao); + } + } + return false; + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Seguros/PerfilEmpresaServico.cs b/Decompiler/Gestor.Application.Servicos.Seguros/PerfilEmpresaServico.cs new file mode 100644 index 0000000..05291e2 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Seguros/PerfilEmpresaServico.cs @@ -0,0 +1,178 @@ +using System; +using System.Linq; +using System.Net; +using System.Net.Sockets; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Newtonsoft.Json; + +namespace Gestor.Application.Servicos.Seguros; + +internal class PerfilEmpresaServico : BaseServico +{ + internal async Task BuscarPerfis(long controleId) + { + int tries = 3; + return await Task.Run((Func)delegate + { + //IL_0059: Unknown result type (might be due to invalid IL or missing references) + //IL_005f: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.PerfilEmpresaRepository.FindByControleId(controleId); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)46, tries, controleId); + } + } + return new PerfilEmpresa(); + }); + } + + public async Task Save(PerfilEmpresa perfil) + { + int tries = 3; + base.Sucesso = true; + PerfilEmpresa perfilOriginal = perfil; + return await Task.Run((Func)delegate + { + //IL_0028: Unknown result type (might be due to invalid IL or missing references) + //IL_006b: Unknown result type (might be due to invalid IL or missing references) + //IL_0070: Unknown result type (might be due to invalid IL or missing references) + //IL_0071: Unknown result type (might be due to invalid IL or missing references) + //IL_0077: Unknown result type (might be due to invalid IL or missing references) + //IL_0082: Unknown result type (might be due to invalid IL or missing references) + //IL_008d: Unknown result type (might be due to invalid IL or missing references) + //IL_0094: Unknown result type (might be due to invalid IL or missing references) + //IL_0099: Unknown result type (might be due to invalid IL or missing references) + //IL_00a5: Expected O, but got Unknown + //IL_00aa: Unknown result type (might be due to invalid IL or missing references) + //IL_00bb: Unknown result type (might be due to invalid IL or missing references) + //IL_00c3: Unknown result type (might be due to invalid IL or missing references) + //IL_00ce: Unknown result type (might be due to invalid IL or missing references) + //IL_00d9: Unknown result type (might be due to invalid IL or missing references) + //IL_00e4: Unknown result type (might be due to invalid IL or missing references) + //IL_0121: Expected O, but got Unknown + while (tries > 0) + { + perfil = perfilOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + TipoAcao acao = (TipoAcao)(((DomainBase)perfil).Id != 0L); + perfil = ((((DomainBase)perfil).Id == 0L) ? commited.PerfilEmpresaRepository.SaveOrUpdate(perfil) : commited.PerfilEmpresaRepository.Merge(perfil)); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog keyValues = new RegistroLog + { + Acao = acao, + Usuario = Recursos.Usuario, + DataHora = Funcoes.GetNetworkTime(), + Descricao = JsonConvert.SerializeObject((object)perfil, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)perfil).Id, + Tela = (TipoTela)32, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return perfil; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)212, tries, perfil); + } + } + return perfilOriginal; + }); + } + + public async Task Delete(PerfilEmpresa perfil) + { + int tries = 3; + return await Task.Run(delegate + { + //IL_0033: Unknown result type (might be due to invalid IL or missing references) + //IL_0038: Unknown result type (might be due to invalid IL or missing references) + //IL_003f: Unknown result type (might be due to invalid IL or missing references) + //IL_004a: Unknown result type (might be due to invalid IL or missing references) + //IL_0051: Unknown result type (might be due to invalid IL or missing references) + //IL_0090: Unknown result type (might be due to invalid IL or missing references) + //IL_00a1: Unknown result type (might be due to invalid IL or missing references) + //IL_00a8: Unknown result type (might be due to invalid IL or missing references) + //IL_00b3: Unknown result type (might be due to invalid IL or missing references) + //IL_00be: Unknown result type (might be due to invalid IL or missing references) + //IL_00c9: Unknown result type (might be due to invalid IL or missing references) + //IL_0106: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork commited = Instancia.Commited; + try + { + commited.PerfilEmpresaRepository.Delete(((DomainBase)perfil).Id); + DateTime networkTime = Funcoes.GetNetworkTime(); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog keyValues = new RegistroLog + { + Acao = (TipoAcao)2, + Usuario = Recursos.Usuario, + DataHora = networkTime, + Descricao = $"O USUÁRIO {Recursos.Usuario.Nome} EXCLUIU O PERFIL, EM {networkTime}, DE " + $"ID: '{((DomainBase)perfil).Id}'", + EntidadeId = ((DomainBase)perfil).Id, + Tela = (TipoTela)3, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)213, tries, perfil); + } + } + return false; + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Seguros/PerfilServico.cs b/Decompiler/Gestor.Application.Servicos.Seguros/PerfilServico.cs new file mode 100644 index 0000000..b7955f7 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Seguros/PerfilServico.cs @@ -0,0 +1,167 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Sockets; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels; +using Gestor.Common.Validation; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Newtonsoft.Json; + +namespace Gestor.Application.Servicos.Seguros; + +internal class PerfilServico : BaseServico +{ + internal async Task> BuscarPerfis(long controleId) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.PerfilRepository.FindByControleId(controleId); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)46, tries, controleId); + } + } + return new List(); + }); + } + + public async Task Save(Perfil perfil) + { + int tries = 3; + base.Sucesso = true; + Perfil perfilOriginal = perfil; + return await Task.Run((Func)delegate + { + //IL_0028: Unknown result type (might be due to invalid IL or missing references) + //IL_006b: Unknown result type (might be due to invalid IL or missing references) + //IL_0070: Unknown result type (might be due to invalid IL or missing references) + //IL_0071: Unknown result type (might be due to invalid IL or missing references) + //IL_0077: Unknown result type (might be due to invalid IL or missing references) + //IL_0082: Unknown result type (might be due to invalid IL or missing references) + //IL_008d: Unknown result type (might be due to invalid IL or missing references) + //IL_0094: Unknown result type (might be due to invalid IL or missing references) + //IL_0099: Unknown result type (might be due to invalid IL or missing references) + //IL_00a5: Expected O, but got Unknown + //IL_00aa: Unknown result type (might be due to invalid IL or missing references) + //IL_00bb: Unknown result type (might be due to invalid IL or missing references) + //IL_00c3: Unknown result type (might be due to invalid IL or missing references) + //IL_00ce: Unknown result type (might be due to invalid IL or missing references) + //IL_00d9: Unknown result type (might be due to invalid IL or missing references) + //IL_00e4: Unknown result type (might be due to invalid IL or missing references) + //IL_0121: Expected O, but got Unknown + while (tries > 0) + { + perfil = perfilOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + TipoAcao acao = (TipoAcao)(((DomainBase)perfil).Id != 0L); + perfil = ((((DomainBase)perfil).Id == 0L) ? commited.PerfilRepository.SaveOrUpdate(perfil) : commited.PerfilRepository.Merge(perfil)); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog keyValues = new RegistroLog + { + Acao = acao, + Usuario = Recursos.Usuario, + DataHora = Funcoes.GetNetworkTime(), + Descricao = JsonConvert.SerializeObject((object)perfil, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)perfil).Id, + Tela = (TipoTela)32, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return perfil; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)212, tries, perfil); + } + } + return perfilOriginal; + }); + } + + public async Task Delete(Perfil perfil) + { + int tries = 3; + return await Task.Run(delegate + { + //IL_0033: Unknown result type (might be due to invalid IL or missing references) + //IL_003a: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork commited = Instancia.Commited; + try + { + commited.PerfilRepository.Delete(((DomainBase)perfil).Id); + DateTime networkTime = Funcoes.GetNetworkTime(); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog val = new RegistroLog(); + val.Acao = (TipoAcao)2; + val.Usuario = Recursos.Usuario; + val.DataHora = networkTime; + val.Descricao = $"O USUÁRIO {Recursos.Usuario.Nome} EXCLUIU O PERFIL, EM {networkTime}, DE " + $"ID: '{((DomainBase)perfil).Id}'" + ", NOME: '" + (string.IsNullOrWhiteSpace(perfil.Nome) ? "" : (perfil.Nome ?? "")) + "', CPF: '" + (string.IsNullOrWhiteSpace(perfil.Cpf) ? "" : (perfil.Cpf ?? "")) + "', HABILITAÇÃO: '" + (string.IsNullOrWhiteSpace(perfil.Habilitacao) ? "" : (perfil.Habilitacao ?? "")) + "', TEMPO DE HABILITAÇÃO: '" + ValidationHelper.GetDescription((Enum)(object)perfil.TempoHabilitacao) + "', NASCIMENTO: '" + ((!perfil.Nascimento.HasValue) ? "" : (perfil.Nascimento?.ToShortDateString() ?? "")) + "', SEXO: '" + ValidationHelper.GetDescription((Enum)(object)perfil.Sexo) + "', ESTADO CIVIL: '" + ValidationHelper.GetDescription((Enum)(object)perfil.EstadoCivil) + "', OCUPAÇÃO: '" + ValidationHelper.GetDescription((Enum)(object)perfil.Ocupacao) + "', RELAÇÃOO: '" + ValidationHelper.GetDescription((Enum)(object)perfil.Relacao) + "', DISTÂNCIA DO TRABALHO: '" + ValidationHelper.GetDescription((Enum)(object)perfil.DistanciaResidenciaTrabalho) + "', USO POR DEPENDENTES: '" + ValidationHelper.GetDescription((Enum)(object)perfil.UsoDependentes) + "', TIPO DE RESIDÊNCIA: '" + ValidationHelper.GetDescription((Enum)(object)perfil.TipoResidencia) + "', GARAGEM NA RESIDÊNCIA: '" + ValidationHelper.GetDescription((Enum)(object)perfil.GaragemResidencia) + "', GARAGEM NO TRABALHO: '" + ValidationHelper.GetDescription((Enum)(object)perfil.GaragemTrabalho) + "', GARAGEM NO ESTUDO: '" + ValidationHelper.GetDescription((Enum)(object)perfil.GaragemEstudo) + "', VEÍCULOS NA RESIDÊNCIA: '" + ((!perfil.VeiculoResidencia.HasValue) ? "" : $"{perfil.VeiculoResidencia}") + "', ANTFURTO: '" + ((!perfil.AntiFurto.HasValue) ? "" : ValidationHelper.GetDescription((Enum)(object)perfil.AntiFurto)) + "', SEGURO DE VIDA: '" + ((!perfil.SeguroVida.HasValue) ? "" : (perfil.SeguroVida.Value ? "SIM" : "NÃO")) + "', USO PROFISSIONAL: '" + ((!perfil.UsoProfissional.HasValue) ? "" : (perfil.UsoProfissional.Value ? "SIM" : "NÃO")) + "', COBERTURA ESTENDIDA: '" + ((!perfil.EstenderCobertura.HasValue) ? "" : (perfil.EstenderCobertura.Value ? "SIM" : "NÃO")) + "', CEP CIRCULAÇÃO: '" + (string.IsNullOrWhiteSpace(perfil.CepCirculacao) ? "" : (perfil.CepCirculacao ?? "")) + "', CEP PERNOITE: '" + (string.IsNullOrWhiteSpace(perfil.CepPernoite) ? "" : (perfil.CepPernoite ?? "")) + "'."; + val.EntidadeId = ((DomainBase)perfil).Id; + val.Tela = (TipoTela)3; + val.Versao = LoginViewModel.VersaoAtual; + val.NomeMaquina = Environment.MachineName; + val.UsuarioMaquina = Environment.UserName; + val.Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString(); + RegistroLog keyValues = val; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)213, tries, perfil); + } + } + return false; + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Seguros/ProfissaoServico.cs b/Decompiler/Gestor.Application.Servicos.Seguros/ProfissaoServico.cs new file mode 100644 index 0000000..ed83d06 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Seguros/ProfissaoServico.cs @@ -0,0 +1,76 @@ +using System; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; + +namespace Gestor.Application.Servicos.Seguros; + +internal class ProfissaoServico : BaseServico +{ + public async Task Save(Profissao profissao) + { + int tries = 3; + base.Sucesso = true; + Profissao profissaoOriginal = profissao; + return await Task.Run((Func)delegate + { + while (tries > 0) + { + profissao = profissaoOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + bool flag = ((DomainBase)profissao).Id == 0; + profissao = (flag ? commited.ProfissaoRepository.SaveOrUpdate(profissao) : commited.ProfissaoRepository.Merge(profissao)); + ((GenericUnitOfWork)commited).Commit(); + return profissao; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)214, tries, profissao); + } + } + return profissaoOriginal; + }); + } + + public async Task FindLastId() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ProfissaoRepository.FindLastId(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)17, tries); + } + } + return 0L; + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Seguros/SinistroServico.cs b/Decompiler/Gestor.Application.Servicos.Seguros/SinistroServico.cs new file mode 100644 index 0000000..5a06c52 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Seguros/SinistroServico.cs @@ -0,0 +1,385 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Relatorios; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Servicos.Seguros; + +internal class SinistroServico : BaseServico +{ + internal async Task> BuscarControles(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ControleSinistroRepository.FindByIdItem(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)48, tries, id); + } + } + return new List(); + }); + } + + public async Task BuscarSinistro(long id) + { + int tries = 3; + return await Task.Run((Func)delegate + { + //IL_0059: Unknown result type (might be due to invalid IL or missing references) + //IL_005f: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.SinistroRepository.FindById(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)49, tries, id); + } + } + return new Sinistro(); + }); + } + + public async Task Delete(Sinistro sinistro) + { + int tries = 3; + base.Sucesso = true; + return await Task.Run(delegate + { + while (tries > 0) + { + List list = new List(); + try + { + UnitOfWork commited = Instancia.Commited; + try + { + list.Add(CreateLog(((DomainBase)sinistro).Id, ((DomainBase)sinistro).GetValorOriginal(), (TipoTela)26, (TipoAcao)2)); + SinistroAuto val = commited.SinistroAutoRepository.FindBySinistroId(((DomainBase)sinistro).Id); + SinistroVida val2 = commited.SinistroVidaRepository.FindBySinistroId(((DomainBase)sinistro).Id); + if (val != null) + { + commited.SinistroAutoRepository.Delete(((DomainBase)val).Id); + } + if (val2 != null) + { + commited.SinistroVidaRepository.Delete(((DomainBase)val2).Id); + } + commited.SinistroRepository.Delete(((DomainBase)sinistro).Id); + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)174, tries, sinistro); + } + } + return false; + }); + } + + public async Task DeleteControle(ControleSinistro controle, bool atualizarItem) + { + int tries = 3; + base.Sucesso = true; + return await Task.Run(async delegate + { + while (tries > 0) + { + List logs = new List(); + try + { + UnitOfWork unitOfWork = Instancia.Commited; + try + { + if (atualizarItem) + { + Item val = unitOfWork.ItemRepository.FindById(((DomainBase)controle.Item).Id); + val.Sinistrado = false; + unitOfWork.ItemRepository.Merge(val); + } + List list = unitOfWork.SinistroRepository.FindByControleId(((DomainBase)controle).Id); + foreach (Sinistro item in list) + { + logs.Add(CreateLog(((DomainBase)item).Id, ((DomainBase)item).GetValorOriginal(), (TipoTela)26, (TipoAcao)2)); + if (!(await Delete(item))) + { + return false; + } + } + unitOfWork.ControleSinistroRepository.Delete(((DomainBase)controle).Id); + SaveLog(logs, unitOfWork); + ((GenericUnitOfWork)unitOfWork).Commit(); + return true; + } + finally + { + ((IDisposable)unitOfWork)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)174, tries, controle); + } + } + return false; + }); + } + + public async Task Save(Sinistro sinistro, long idramo) + { + int tries = 3; + base.Sucesso = true; + Sinistro sinistroSalvo = sinistro; + Funcoes.GetNetworkTime(); + return await Task.Run((Func)delegate + { + //IL_028e: Unknown result type (might be due to invalid IL or missing references) + //IL_0295: Expected O, but got Unknown + while (tries > 0) + { + List list = new List(); + try + { + UnitOfWork commited = Instancia.Commited; + try + { + Item val = commited.ItemRepository.FindById(((DomainBase)sinistro.ControleSinistro.Item).Id); + val.Sinistrado = true; + sinistroSalvo.ControleSinistro.Item = commited.ItemRepository.Merge(val); + bool num = ((DomainBase)sinistroSalvo.ControleSinistro).Id == 0; + SinistroAuto sinistroAuto = sinistroSalvo.SinistroAuto; + SinistroVida val2 = sinistroSalvo.SinistroVida; + if (num) + { + sinistroSalvo.ControleSinistro = commited.ControleSinistroRepository.SaveOrUpdate(sinistroSalvo.ControleSinistro); + sinistroSalvo = commited.SinistroRepository.SaveOrUpdate(sinistroSalvo); + list.Add(CreateLog(((DomainBase)sinistroSalvo).Id, ((DomainBase)sinistroSalvo).GetValorOriginal(), (TipoTela)7, (TipoAcao)0)); + long num2 = idramo; + long num3 = num2 - 5; + if ((ulong)num3 <= 5uL) + { + switch (num3) + { + case 0L: + goto IL_012e; + case 1L: + case 2L: + case 4L: + case 5L: + goto IL_0158; + case 3L: + goto IL_02d6; + } + } + if (num2 == 37) + { + goto IL_012e; + } + if (num2 == 53) + { + goto IL_0158; + } + } + else + { + list.Add(CreateLog(((DomainBase)sinistroSalvo).Id, sinistroSalvo, (TipoTela)7)); + sinistroSalvo.ControleSinistro = commited.ControleSinistroRepository.Merge(sinistroSalvo.ControleSinistro); + sinistroSalvo = ((((DomainBase)sinistroSalvo).Id == 0L) ? commited.SinistroRepository.SaveOrUpdate(sinistroSalvo) : commited.SinistroRepository.Merge(sinistroSalvo)); + long num2 = idramo; + long num4 = num2 - 5; + if ((ulong)num4 <= 5uL) + { + switch (num4) + { + case 0L: + goto IL_0247; + case 1L: + case 2L: + case 4L: + case 5L: + goto IL_028a; + case 3L: + goto IL_02d6; + } + } + if (num2 == 37) + { + goto IL_0247; + } + if (num2 == 53) + { + goto IL_028a; + } + } + goto IL_02d6; + IL_0247: + if (sinistroAuto != null) + { + sinistroAuto.Sinistro = sinistroSalvo; + sinistroAuto = ((((DomainBase)sinistroAuto).Id == 0L) ? commited.SinistroAutoRepository.SaveOrUpdate(sinistroAuto) : commited.SinistroAutoRepository.Merge(sinistroAuto)); + sinistroSalvo.SinistroAuto = sinistroAuto; + } + goto IL_02d6; + IL_028a: + if (val2 == null) + { + val2 = new SinistroVida(); + } + val2.Sinistro = sinistroSalvo; + val2 = ((((DomainBase)val2).Id == 0L) ? commited.SinistroVidaRepository.SaveOrUpdate(val2) : commited.SinistroVidaRepository.Merge(val2)); + sinistroSalvo.SinistroVida = val2; + goto IL_02d6; + IL_012e: + sinistroAuto.Sinistro = sinistroSalvo; + sinistroAuto = commited.SinistroAutoRepository.SaveOrUpdate(sinistroAuto); + sinistroSalvo.SinistroAuto = sinistroAuto; + goto IL_02d6; + IL_0158: + val2.Sinistro = sinistroSalvo; + val2 = commited.SinistroVidaRepository.SaveOrUpdate(val2); + sinistroSalvo.SinistroVida = val2; + goto IL_02d6; + IL_02d6: + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return sinistroSalvo; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)175, tries, sinistro); + } + } + return sinistro; + }); + } + + public async Task> BuscarSinistro(Filtros filtro) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.SinistroRepository.FindByData(filtro, false); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)176, tries, filtro); + } + } + return new List(); + }); + } + + public async Task> BuscarSinistroPendente(Filtros filtro) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.SinistroRepository.FindByData(filtro, true); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)176, tries, filtro); + } + } + return new List(); + }); + } + + public async Task> BuscarSinistros(string numero) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.SinistroRepository.FindNumeroSinistro(numero); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)177, tries, numero); + } + } + return new List(); + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos/ArquivoDigitalServico.cs b/Decompiler/Gestor.Application.Servicos/ArquivoDigitalServico.cs new file mode 100644 index 0000000..637a396 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos/ArquivoDigitalServico.cs @@ -0,0 +1,594 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using ArquivoDigital.Infrastructure.UnitOfWork.Generic; +using ArquivoDigital.Infrastructure.UnitOfWork.Logic; +using CsQuery.ExtensionMethods.Internal; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Aggilizador; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.License; + +namespace Gestor.Application.Servicos; + +public class ArquivoDigitalServico : BaseServico +{ + public async Task> BuscarPorTipo(TipoArquivoDigital tipo, long id) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + int tries = 3; + long usuario = ((DomainBase)Recursos.Usuario).Id; + return await Task.Run(delegate + { + //IL_0071: Unknown result type (might be due to invalid IL or missing references) + //IL_0013: Unknown result type (might be due to invalid IL or missing references) + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.IndiceArquivoDigitalRepository.Find(tipo, id, usuario, LicenseHelper.Produtos.Any((Licenca x) => (int)x.Produto == 86 && x.Status != 3)); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)64, tries, new { tipo, id }); + } + } + return new List(); + }); + } + + public async Task BuscarPorId(long id, string banco) + { + int tries = 3; + return await Task.Run((Func)delegate + { + while (tries > 0) + { + try + { + Gestor.Application.Helpers.ArquivoDigital.SetConnection(banco); + if (string.IsNullOrEmpty(banco)) + { + banco = Gestor.Application.Helpers.ArquivoDigital.Banco; + } + UnitOfWork read = Gestor.Application.Helpers.ArquivoDigital.Read; + try + { + ArquivoDigital val = read.ArquivoDigitalRepository.FindById(id, true); + if (val == null) + { + return (ArquivoDigital)null; + } + if (val.AzureGuid.HasValue) + { + byte[] result = Connection.DownloadFile(val.AzureStorage, val.DataCriacao.Value.Year, val.AzureGuid.Value, val.Extensao).Result; + if (result == null) + { + return (ArquivoDigital)null; + } + val.Arquivo = result; + } + return val; + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)65, tries, new { id, banco }); + } + } + return (ArquivoDigital)null; + }); + } + + public async Task BuscarPorId(long id) + { + int tries = 3; + return await Task.Run((Func)delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + ArquivoDigital val = read.IndiceArquivoDigitalRepository.FindAssinatura(id); + if (val.AzureGuid.HasValue) + { + byte[] result = Connection.DownloadFile(val.AzureStorage, val.DataCriacao.Value.Year, val.AzureGuid.Value, Path.GetExtension(val.Descricao), "siggner").Result; + if (result == null) + { + return (ArquivoDigital)null; + } + val.Arquivo = result; + } + return val; + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)64, tries, id); + } + } + return (ArquivoDigital)null; + }); + } + + public async Task DeleteAttachment(IndiceArquivoDigital indice) + { + int tries = 3; + DateTime now = Funcoes.GetNetworkTime(); + return await Task.Run(delegate + { + //IL_0023: Unknown result type (might be due to invalid IL or missing references) + //IL_0028: Unknown result type (might be due to invalid IL or missing references) + //IL_0033: Unknown result type (might be due to invalid IL or missing references) + //IL_003e: Unknown result type (might be due to invalid IL or missing references) + //IL_005c: Expected O, but got Unknown + //IL_005d: Unknown result type (might be due to invalid IL or missing references) + //IL_0062: Unknown result type (might be due to invalid IL or missing references) + //IL_006d: Unknown result type (might be due to invalid IL or missing references) + //IL_0078: Unknown result type (might be due to invalid IL or missing references) + //IL_008e: Expected O, but got Unknown + //IL_0101: Unknown result type (might be due to invalid IL or missing references) + //IL_0106: Unknown result type (might be due to invalid IL or missing references) + //IL_0111: Unknown result type (might be due to invalid IL or missing references) + //IL_011c: Unknown result type (might be due to invalid IL or missing references) + //IL_0141: Expected O, but got Unknown + while (tries > 0) + { + List list = new List(); + try + { + UnitOfWork commited = Instancia.Commited; + try + { + indice.Excluido = true; + List list2 = new List + { + new Diferenca + { + Campo = "Id", + Descricao = "ID", + ValorAtual = ((DomainBase)indice).Id.ToString() + }, + new Diferenca + { + Campo = "Descricao", + Descricao = "DESCRIÇÃO", + ValorAtual = indice.Descricao + } + }; + if (indice.AzureGuid.HasValue && Connection.DeleteFile(indice.AzureStorage, indice.DataCriacao.Value.Year, indice.AzureGuid.Value, indice.Extensao).Result) + { + list2.Add(new Diferenca + { + Campo = "AzureGuid", + Descricao = "AzureGuid", + ValorAtual = indice.AzureGuid.ToString() + }); + } + list.Add(CreateLog(((DomainBase)indice).Id, list2, (TipoTela)6, (TipoAcao)2)); + indice.DataAtualizacao = now; + if (!indice.DataCriacao.HasValue || indice.DataCriacao.Value.Year < 1754) + { + indice.DataCriacao = now; + } + commited.IndiceArquivoDigitalRepository.Merge(indice); + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + return true; + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)253, tries, indice); + } + } + return false; + }); + } + + public async Task Save(IndiceArquivoDigital indice) + { + int tries = 3; + base.Sucesso = true; + IndiceArquivoDigital indiceOriginal = indice; + DateTime now = Funcoes.GetNetworkTime(); + return await Task.Run((Func)delegate + { + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_0066: Unknown result type (might be due to invalid IL or missing references) + //IL_0068: Invalid comparison between Unknown and I4 + //IL_008e: Unknown result type (might be due to invalid IL or missing references) + //IL_0090: Invalid comparison between Unknown and I4 + //IL_00bb: Unknown result type (might be due to invalid IL or missing references) + //IL_00bd: Invalid comparison between Unknown and I4 + //IL_00c5: Unknown result type (might be due to invalid IL or missing references) + //IL_00ca: Unknown result type (might be due to invalid IL or missing references) + //IL_00d5: Unknown result type (might be due to invalid IL or missing references) + //IL_00e0: Unknown result type (might be due to invalid IL or missing references) + //IL_00f6: Expected O, but got Unknown + //IL_010b: Unknown result type (might be due to invalid IL or missing references) + while (tries > 0) + { + indice = indiceOriginal; + List list = new List(); + try + { + UnitOfWork commited = Instancia.Commited; + try + { + TipoAcao val = (TipoAcao)(((DomainBase)indice).Id != 0L); + indice.DataAtualizacao = now; + indice.UsuarioAtualizacao = ((DomainBase)Recursos.Usuario).Id; + indice.Excluido = false; + if ((int)val == 1) + { + list.Add(CreateLog(((DomainBase)indice).Id, indice, (TipoTela)6)); + } + indice = (((int)val == 1) ? commited.IndiceArquivoDigitalRepository.Merge(indice) : commited.IndiceArquivoDigitalRepository.SaveOrUpdate(indice)); + if ((int)val != 1) + { + List diferenca = new List + { + new Diferenca + { + Campo = "Descricao", + Descricao = "DESCRIÇÃO", + ValorAtual = indice.Descricao + } + }; + list.Add(CreateLog(((DomainBase)indice).Id, diferenca, (TipoTela)6, val)); + } + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + return indice; + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)252, tries, indice); + } + } + return indiceOriginal; + }); + } + + public async Task> Insert(List files) + { + int tries = 3; + base.Sucesso = true; + DateTime now = Funcoes.GetNetworkTime(); + List filesOriginal = files; + return await Task.Run(delegate + { + while (tries > 0) + { + List logs = new List(); + files = filesOriginal; + try + { + List indices = new List(); + files.ForEach(delegate(ArquivoDigital file) + { + //IL_0035: Unknown result type (might be due to invalid IL or missing references) + //IL_003a: Unknown result type (might be due to invalid IL or missing references) + //IL_0050: Unknown result type (might be due to invalid IL or missing references) + //IL_005b: Unknown result type (might be due to invalid IL or missing references) + //IL_0076: Unknown result type (might be due to invalid IL or missing references) + //IL_0083: Expected O, but got Unknown + //IL_00c9: Unknown result type (might be due to invalid IL or missing references) + //IL_00ce: Unknown result type (might be due to invalid IL or missing references) + //IL_00da: Unknown result type (might be due to invalid IL or missing references) + //IL_00e5: Unknown result type (might be due to invalid IL or missing references) + //IL_00f1: Unknown result type (might be due to invalid IL or missing references) + //IL_00fd: Unknown result type (might be due to invalid IL or missing references) + //IL_0109: Unknown result type (might be due to invalid IL or missing references) + //IL_0115: Unknown result type (might be due to invalid IL or missing references) + //IL_0121: Unknown result type (might be due to invalid IL or missing references) + //IL_012d: Unknown result type (might be due to invalid IL or missing references) + //IL_0139: Unknown result type (might be due to invalid IL or missing references) + //IL_0145: Unknown result type (might be due to invalid IL or missing references) + //IL_0151: Unknown result type (might be due to invalid IL or missing references) + //IL_015d: Unknown result type (might be due to invalid IL or missing references) + //IL_0169: Unknown result type (might be due to invalid IL or missing references) + //IL_0175: Unknown result type (might be due to invalid IL or missing references) + //IL_0181: Unknown result type (might be due to invalid IL or missing references) + //IL_018d: Unknown result type (might be due to invalid IL or missing references) + //IL_0199: Unknown result type (might be due to invalid IL or missing references) + //IL_01a5: Unknown result type (might be due to invalid IL or missing references) + //IL_01b1: Unknown result type (might be due to invalid IL or missing references) + //IL_01bd: Unknown result type (might be due to invalid IL or missing references) + //IL_01c9: Unknown result type (might be due to invalid IL or missing references) + //IL_01d5: Unknown result type (might be due to invalid IL or missing references) + //IL_01e1: Unknown result type (might be due to invalid IL or missing references) + //IL_01ed: Unknown result type (might be due to invalid IL or missing references) + //IL_01f9: Unknown result type (might be due to invalid IL or missing references) + //IL_0206: Expected O, but got Unknown + //IL_0268: Unknown result type (might be due to invalid IL or missing references) + //IL_026d: Unknown result type (might be due to invalid IL or missing references) + //IL_0278: Unknown result type (might be due to invalid IL or missing references) + //IL_0283: Unknown result type (might be due to invalid IL or missing references) + //IL_0294: Expected O, but got Unknown + file.UsuarioCriacao = ((DomainBase)Recursos.Usuario).Id; + file.DataCriacao = now; + file.DataAtualizacao = null; + UploadFile val = new UploadFile + { + Ano = now.Year, + Id = Guid.NewGuid(), + Extensao = file.Extensao.Replace(".", string.Empty), + Arquivo = file.Arquivo + }; + if (Connection.ConnectionAddress.UsaAzureStorage && Connection.UploadFile(val).Result) + { + file.AzureGuid = val.Id; + file.Arquivo = null; + file.AzureStorage = Connection.ConnectionAddress.AzureStorage; + } + IndiceArquivoDigital val2 = new IndiceArquivoDigital + { + Descricao = file.Descricao, + Bd = Gestor.Application.Helpers.ArquivoDigital.Banco, + Extensao = file.Extensao, + IdCliente = file.IdCliente, + IdDocumento = file.IdDocumento, + IdEmpresa = file.IdEmpresa, + IdParcela = file.IdParcela, + IdItem = file.IdItem, + IdExtrato = file.IdExtrato, + IdSinistro = file.IdSinistro, + IdSeguradora = file.IdSeguradora, + IdVendedor = file.IdVendedor, + IdUsuario = file.IdUsuario, + IdLancamento = file.IdLancamento, + IdFornecedor = file.IdFornecedor, + IdProspeccao = file.IdProspeccao, + IdSocio = file.IdSocio, + IdTarefa = file.IdTarefa, + IdNotaFiscal = file.IdNotaFiscal, + IdEstipulante = file.IdEstipulante, + Excluido = file.Excluido, + UsuarioCriacao = file.UsuarioCriacao, + DataCriacao = file.DataCriacao, + DataAtualizacao = file.DataAtualizacao, + AzureGuid = file.AzureGuid, + AzureStorage = file.AzureStorage + }; + Gestor.Application.Helpers.ArquivoDigital.SetConnection(); + val2.Bd = Gestor.Application.Helpers.ArquivoDigital.Banco; + UnitOfWork commited = Gestor.Application.Helpers.ArquivoDigital.Commited; + try + { + file = commited.ArquivoDigitalRepository.SaveOrUpdate(file); + val2.IdArquivoDigital = ((DomainBase)file).Id; + ((GenericUnitOfWork)commited).Commit(); + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + UnitOfWork commited2 = Instancia.Commited; + try + { + val2 = commited2.IndiceArquivoDigitalRepository.SaveOrUpdate(val2); + List diferenca = new List + { + new Diferenca + { + Campo = "Descricao", + Descricao = "DESCRIÇÃO", + ValorAtual = val2.Descricao + } + }; + logs.Add(CreateLog(((DomainBase)val2).Id, diferenca, (TipoTela)6, (TipoAcao)0)); + SaveLog(logs, commited2); + ((GenericUnitOfWork)commited2).Commit(); + } + finally + { + ((IDisposable)commited2)?.Dispose(); + } + indices.Add(val2); + }); + return indices; + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)252, tries, files); + } + } + return new List(); + }); + } + + public async Task> Buscar(List ids) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + List arquivos = new List(); + (from x in ids + group x by x.Bd).ToList().ForEach(delegate(IGrouping x) + { + Gestor.Application.Helpers.ArquivoDigital.SetConnection(x.Key); + List list = (from l in x + where !l.Assinado + select l.IdArquivoDigital).ToList(); + List list2 = (from l in x + where l.Assinado + select ((DomainBase)l).Id).ToList(); + if (list2.Any()) + { + List _arquivos2 = new List(); + UnitOfWork unitOfWork2 = Instancia.Read; + try + { + list2.ForEach(delegate(long a) + { + ArquivoDigital val2 = unitOfWork2.IndiceArquivoDigitalRepository.FindAssinatura(a); + if (val2.AzureGuid.HasValue) + { + val2.Arquivo = Connection.DownloadFile(val2.AzureStorage, val2.DataCriacao.Value.Year, val2.AzureGuid.Value, Path.GetExtension(val2.Descricao), "siggner").Result; + } + if (val2.Arquivo != null) + { + _arquivos2.Add(val2); + } + }); + } + finally + { + if (unitOfWork2 != null) + { + ((IDisposable)unitOfWork2).Dispose(); + } + } + arquivos.AddRange(_arquivos2); + } + if (list.Any()) + { + List _arquivos = new List(); + UnitOfWork unitOfWork = Gestor.Application.Helpers.ArquivoDigital.Read; + try + { + list.ForEach(delegate(long a) + { + ArquivoDigital val = unitOfWork.ArquivoDigitalRepository.FindById(a, true); + if (val.AzureGuid.HasValue) + { + val.Arquivo = Connection.DownloadFile(val.AzureStorage, val.DataCriacao.Value.Year, val.AzureGuid.Value, val.Extensao).Result; + } + if (val.Arquivo != null) + { + _arquivos.Add(val); + } + }); + } + finally + { + if (unitOfWork != null) + { + ((IDisposable)unitOfWork).Dispose(); + } + } + arquivos.AddRange(_arquivos); + } + }); + return arquivos; + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)66, tries, ids); + } + } + return new List(); + }); + } + + public async Task Criar() + { + int tries = 3; + await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Gestor.Application.Helpers.ArquivoDigital.Read; + try + { + read.ArquivoDigitalRepository.FindById(1L, false); + break; + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)288, tries); + } + } + }); + } + + public async Task> BaixarArquivosPendentes(List arquivos) + { + string banco = Gestor.Application.Helpers.ArquivoDigital.Banco; + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Gestor.Application.Helpers.ArquivoDigital.Read; + try + { + foreach (ArquivoVinculo arquivo in arquivos) + { + if (arquivo.Arquivo == null && !ExtensionMethods.IsNullOrEmpty((IEnumerable)arquivo.Chave)) + { + byte[] result = Connection.DownloadFile(arquivo.Storage, arquivo.Ano, Guid.Parse(arquivo.Chave), ".pdf", "aggilizador").Result; + if (result != null) + { + arquivo.Arquivo = result; + } + } + } + return arquivos; + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)65, tries, new { arquivos, banco }); + } + } + return (List)null; + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos/AssinaturaServico.cs b/Decompiler/Gestor.Application.Servicos/AssinaturaServico.cs new file mode 100644 index 0000000..3232c05 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos/AssinaturaServico.cs @@ -0,0 +1,209 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Assinador.Infrastructure.UnitOfWork.Generic; +using Assinador.Infrastructure.UnitOfWork.Logic; +using Assinador.Model.Common; +using Assinador.Model.Domain; +using Assinador.Model.Generic; +using Assinador.Modelos; +using Assinador.Processos; +using Gestor.Application.Helpers; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Newtonsoft.Json; +using Sign.Modelos; + +namespace Gestor.Application.Servicos; + +public class AssinaturaServico +{ + internal async void SaveLog(AssinaturaLogAssinador keyValues, UnitOfWork unitOfWork) + { + if (keyValues == null) + { + return; + } + try + { + unitOfWork.AssinaturaLogRepository.SaveOrUpdate(keyValues); + ((GenericUnitOfWork)unitOfWork).Commit(); + } + catch (Exception) + { + } + } + + public static async Task BuscarParametrosAssinatura(long id) + { + return await Task.Run((Func)delegate + { + try + { + UnitOfWork read = InstanciaAssinador.Read; + try + { + return read.EmpresaRepository.FindByEmpresa(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception) + { + return (ParametrosAssinaturaAssinador)null; + } + }); + } + + public async Task Save(ArquivoParaAssinaturaAssinador arquivo) + { + return await Task.Run((Func)delegate + { + //IL_003d: Unknown result type (might be due to invalid IL or missing references) + //IL_0042: Unknown result type (might be due to invalid IL or missing references) + //IL_0049: Unknown result type (might be due to invalid IL or missing references) + //IL_005a: Unknown result type (might be due to invalid IL or missing references) + //IL_0065: Unknown result type (might be due to invalid IL or missing references) + //IL_006c: Unknown result type (might be due to invalid IL or missing references) + //IL_0071: Unknown result type (might be due to invalid IL or missing references) + //IL_007d: Expected O, but got Unknown + //IL_0082: Unknown result type (might be due to invalid IL or missing references) + //IL_0092: Unknown result type (might be due to invalid IL or missing references) + //IL_00a3: Expected O, but got Unknown + try + { + UnitOfWork commited = InstanciaAssinador.Commited; + try + { + arquivo = ((((BaseModel)arquivo).Id == 0L) ? commited.ArquivoParaAssinaturaRepository.SaveOrUpdate(arquivo) : commited.ArquivoParaAssinaturaRepository.Merge(arquivo)); + AssinaturaLogAssinador keyValues = new AssinaturaLogAssinador + { + Acao = (Acao)0, + EntidadeId = ((BaseModel)arquivo).Id, + DataHora = Funcoes.GetNetworkTime(), + Descricao = JsonConvert.SerializeObject((object)arquivo, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + UsuarioId = ((DomainBase)Recursos.Usuario).Id, + Versao = ApplicationHelper.Versao.ToString() + }; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return arquivo; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception) + { + return (ArquivoParaAssinaturaAssinador)null; + } + }); + } + + public async Task Assinar(ArquivoDigital arquivoDigital, ApoliceAssinador apolice) + { + AggerSigner val = new AggerSigner(AssinadorHelper.Remetente); + ArquivoAssinatura val2 = new ArquivoAssinatura + { + Bytes = arquivoDigital.Arquivo, + Nome = arquivoDigital.Descricao + arquivoDigital.Extensao.ToLower() + }; + List destinatarios = new List + { + new Destinatario + { + Email = apolice.Email, + Nome = apolice.Cliente, + Documento = apolice.Documento + } + }; + val2.Destinatarios = destinatarios; + ArquivoCriado val3 = await val.EnviarParaAssinatura(val2); + return new ArquivoParaAssinaturaAssinador + { + AssinaturaId = val3.Id, + Chave = val3.Chave, + DocumentoId = ((BaseModel)apolice).Id, + ClienteId = apolice.ClienteId, + IndiceId = apolice.ArquivoId, + UrlAssinatura = val3.Url, + Enviado = Funcoes.GetNetworkTime(), + UsuarioId = ((DomainBase)Recursos.Usuario).Id + }; + } + + public async Task VerificarAssinado(long id) + { + return await Task.Run(delegate + { + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Invalid comparison between Unknown and I4 + //IL_0025: Unknown result type (might be due to invalid IL or missing references) + //IL_002b: Invalid comparison between Unknown and I4 + UnitOfWork read = InstanciaAssinador.Read; + try + { + ArquivoParaAssinaturaAssinador val = read.ArquivoParaAssinaturaRepository.FindByIndice(id); + return val != null && ((int)val.Status == 1 || (int)val.Status == 2); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + }); + } + + public async Task VerificarEnviado(long id) + { + return await Task.Run(delegate + { + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Invalid comparison between Unknown and I4 + UnitOfWork read = InstanciaAssinador.Read; + try + { + ArquivoParaAssinaturaAssinador val = read.ArquivoParaAssinaturaRepository.FindByIndice(id); + return val != null && (int)val.Status == 0; + } + finally + { + ((IDisposable)read)?.Dispose(); + } + }); + } + + public async Task Reenviar(long indice) + { + AggerSigner val = new AggerSigner(AssinadorHelper.Remetente); + UnitOfWork unitOfWork = InstanciaAssinador.Commited; + try + { + ArquivoParaAssinaturaAssinador assinatura = unitOfWork.ArquivoParaAssinaturaRepository.FindByIndice(indice); + await val.ReenviarParaAssinatura(new List { assinatura.AssinaturaId }, (string)null); + AssinaturaLogAssinador keyValues = new AssinaturaLogAssinador + { + Acao = (Acao)1, + EntidadeId = ((BaseModel)assinatura).Id, + DataHora = Funcoes.GetNetworkTime(), + Descricao = JsonConvert.SerializeObject((object)assinatura, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + UsuarioId = ((DomainBase)Recursos.Usuario).Id, + Versao = ApplicationHelper.Versao.ToString() + }; + SaveLog(keyValues, unitOfWork); + return assinatura; + } + finally + { + ((IDisposable)unitOfWork)?.Dispose(); + } + } +} diff --git a/Decompiler/Gestor.Application.Servicos/CepService.cs b/Decompiler/Gestor.Application.Servicos/CepService.cs new file mode 100644 index 0000000..0ee1d2c --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos/CepService.cs @@ -0,0 +1,85 @@ +using System; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text; +using System.Threading.Tasks; +using Agger.Registro; +using Gestor.Application.Helpers; +using Gestor.Common.Validation; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Newtonsoft.Json.Linq; + +namespace Gestor.Application.Servicos; + +public class CepService +{ + private const string GuidGestor = "bbbf4f03-01fc-4300-b430-33e007753578"; + + public async Task SearchDirect(string cep) + { + return await SearchDirectApiAgger(cep); + } + + private static async Task Authorization() + { + HttpClient client = new HttpClient(); + try + { + ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; + string arg = DateTime.Now.ToString("yyyy-MM-dd"); + string content = Convert.ToBase64String(Encoding.UTF8.GetBytes(string.Format("{0}|{1}|{2}", ApplicationHelper.IdFornecedor, "bbbf4f03-01fc-4300-b430-33e007753578", arg))); + Uri uri = Address.ApiCep.Append("/auth"); + HttpResponseMessage val = await client.PostAsync(uri, (HttpContent)(object)content.ToHttpContent()); + return (!val.IsSuccessStatusCode) ? string.Empty : ((object)val.Content.ToJObject()["token"])?.ToString(); + } + finally + { + ((IDisposable)client)?.Dispose(); + } + } + + public async Task SearchDirectApiAgger(string cep) + { + _ = 2; + try + { + string cepCleared = ValidationHelper.OnlyNumber(cep); + if (ValidationHelper.IsNullOrEmpty(cepCleared)) + { + return null; + } + HttpClient httpClient = new HttpClient(); + try + { + ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; + string text = await Authorization(); + ((HttpHeaders)httpClient.DefaultRequestHeaders).TryAddWithoutValidation("Authorization", "Bearer " + text); + Uri uri = Address.ApiCep.Append(cepCleared); + string text2 = await (await httpClient.GetAsync(uri)).Content.ReadAsStringAsync(); + JObject val = JObject.Parse(text2); + if (val == null || text2.Equals("Endereço não encontrado")) + { + return null; + } + return new EnderecoBase + { + Endereco = ((object)val["logradouro"])?.ToString().ToUpper(), + Bairro = ((object)val["bairro"])?.ToString().ToUpper(), + Cidade = ((object)val["cidade"])?.ToString().ToUpper(), + Estado = ((object)val["estado"])?.ToString().ToUpper(), + Cep = ((object)val["cep"])?.ToString().ToUpper() + }; + } + finally + { + ((IDisposable)httpClient)?.Dispose(); + } + } + catch (Exception) + { + return null; + } + } +} diff --git a/Decompiler/Gestor.Application.Servicos/LogServico.cs b/Decompiler/Gestor.Application.Servicos/LogServico.cs new file mode 100644 index 0000000..45c1289 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos/LogServico.cs @@ -0,0 +1,267 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Relatorios; +using Gestor.Model.Domain.Relatorios.LogsEnvio; + +namespace Gestor.Application.Servicos; + +public class LogServico : BaseServico +{ + public async Task> FindByEntityId(TipoTela tela, long id) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + int tries = 3; + return await Task.Run(delegate + { + //IL_006b: Unknown result type (might be due to invalid IL or missing references) + //IL_0013: Unknown result type (might be due to invalid IL or missing references) + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new ObservableCollection(from x in read.RegistroLogRepository.FindByEntityId(tela, id) + orderby x.DataHora descending + select x); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)67, tries, new { tela, id }); + } + } + return new ObservableCollection(); + }); + } + + public async Task> BuscaLogParcelas(List ids) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new ObservableCollection(from x in read.RegistroLogRepository.BuscaLogParcelas(ids) + orderby x.DataHora descending + select x); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)67, tries, new + { + Parcela = (TipoTela)5, + ids = ids + }); + } + } + return new ObservableCollection(); + }); + } + + public async Task> FindByEntity(TipoTela tela, long id) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + int tries = 3; + return await Task.Run(delegate + { + //IL_006b: Unknown result type (might be due to invalid IL or missing references) + //IL_0013: Unknown result type (might be due to invalid IL or missing references) + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new ObservableCollection(from x in read.RegistroLogRepository.FindByEntity(tela, id) + orderby x.Data descending + select x); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)68, tries, new { tela, id }); + } + } + return new ObservableCollection(); + }); + } + + public async Task> FindById(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new ObservableCollection(read.RegistroLogRepository.FindByIdSingle(id)); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)69, tries, new { id }); + } + } + return new ObservableCollection(); + }); + } + + public async Task> FindAllByEntityId(TipoTela tela, long id) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + int tries = 3; + return await Task.Run(delegate + { + //IL_006b: Unknown result type (might be due to invalid IL or missing references) + //IL_0013: Unknown result type (might be due to invalid IL or missing references) + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new ObservableCollection(from x in read.RegistroLogRepository.FindByEntityId(tela, id) + orderby x.DataHora descending + select x); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)67, tries, new { tela, id }); + } + } + return new ObservableCollection(); + }); + } + + public async Task> BuscarLogsEnvio(Filtros filtro) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.RegistroLogRepository.LogsEnvio(filtro); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)9, tries, filtro); + } + } + return new List(); + }); + } + + public async Task> BuscarLogs(Filtros filtro) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.RegistroAcaoRepository.Find(filtro); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)321, tries, filtro); + } + } + return new List(); + }); + } + + public async Task> BuscarLogsAntigos(Filtros filtro) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.RegistroAcaoRepository.FindOld(filtro, Connection.GetConnectionString()); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)321, tries, filtro); + } + } + return new List(); + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos/MalaDiretaServico.cs b/Decompiler/Gestor.Application.Servicos/MalaDiretaServico.cs new file mode 100644 index 0000000..61b55a6 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos/MalaDiretaServico.cs @@ -0,0 +1,185 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Sockets; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.MalaDireta; +using Newtonsoft.Json; + +namespace Gestor.Application.Servicos; + +public class MalaDiretaServico : BaseServico +{ + public async Task> BuscarModelos() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return (from x in read.ModeloMalaDiretaRepository.Find() + orderby x.Assunto + select x).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)70, tries); + } + } + return new List(); + }); + } + + public async Task Save(ModeloMalaDireta modelo) + { + int tries = 3; + base.Sucesso = true; + ModeloMalaDireta modeloeOriginal = modelo; + return await Task.Run((Func)delegate + { + //IL_0022: Unknown result type (might be due to invalid IL or missing references) + //IL_002a: Unknown result type (might be due to invalid IL or missing references) + //IL_0061: Unknown result type (might be due to invalid IL or missing references) + //IL_0066: Unknown result type (might be due to invalid IL or missing references) + //IL_0067: Unknown result type (might be due to invalid IL or missing references) + //IL_006d: Unknown result type (might be due to invalid IL or missing references) + //IL_0078: Unknown result type (might be due to invalid IL or missing references) + //IL_0083: Unknown result type (might be due to invalid IL or missing references) + //IL_008a: Unknown result type (might be due to invalid IL or missing references) + //IL_008f: Unknown result type (might be due to invalid IL or missing references) + //IL_009b: Expected O, but got Unknown + //IL_00a0: Unknown result type (might be due to invalid IL or missing references) + //IL_00b1: Unknown result type (might be due to invalid IL or missing references) + //IL_00b9: Unknown result type (might be due to invalid IL or missing references) + //IL_00c4: Unknown result type (might be due to invalid IL or missing references) + //IL_00cf: Unknown result type (might be due to invalid IL or missing references) + //IL_00da: Unknown result type (might be due to invalid IL or missing references) + //IL_0117: Expected O, but got Unknown + while (tries > 0) + { + modelo = modeloeOriginal; + try + { + TipoAcao val = (TipoAcao)(((DomainBase)modelo).Id != 0L); + UnitOfWork commited = Instancia.Commited; + try + { + modelo = (((int)val == 0) ? commited.ModeloMalaDiretaRepository.SaveOrUpdate(modelo) : commited.ModeloMalaDiretaRepository.Merge(modelo)); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog keyValues = new RegistroLog + { + Acao = val, + Usuario = Recursos.Usuario, + DataHora = Funcoes.GetNetworkTime(), + Descricao = JsonConvert.SerializeObject((object)modelo, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)modelo).Id, + Tela = (TipoTela)39, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return modelo; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)254, tries, modelo); + } + } + return modeloeOriginal; + }); + } + + public async Task Delete(ModeloMalaDireta modelo) + { + int tries = 3; + return await Task.Run(delegate + { + //IL_002d: Unknown result type (might be due to invalid IL or missing references) + //IL_0032: Unknown result type (might be due to invalid IL or missing references) + //IL_0039: Unknown result type (might be due to invalid IL or missing references) + //IL_0044: Unknown result type (might be due to invalid IL or missing references) + //IL_004f: Unknown result type (might be due to invalid IL or missing references) + //IL_0056: Unknown result type (might be due to invalid IL or missing references) + //IL_005b: Unknown result type (might be due to invalid IL or missing references) + //IL_0067: Expected O, but got Unknown + //IL_006c: Unknown result type (might be due to invalid IL or missing references) + //IL_007d: Unknown result type (might be due to invalid IL or missing references) + //IL_0085: Unknown result type (might be due to invalid IL or missing references) + //IL_0090: Unknown result type (might be due to invalid IL or missing references) + //IL_009b: Unknown result type (might be due to invalid IL or missing references) + //IL_00a6: Unknown result type (might be due to invalid IL or missing references) + //IL_00e3: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork commited = Instancia.Commited; + try + { + commited.ModeloMalaDiretaRepository.Delete(((DomainBase)modelo).Id); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog keyValues = new RegistroLog + { + Acao = (TipoAcao)2, + Usuario = Recursos.Usuario, + DataHora = Funcoes.GetNetworkTime(), + Descricao = JsonConvert.SerializeObject((object)modelo, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)modelo).Id, + Tela = (TipoTela)39, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)255, tries, modelo); + } + } + return false; + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos/ParceiroServico.cs b/Decompiler/Gestor.Application.Servicos/ParceiroServico.cs new file mode 100644 index 0000000..c96b2ed --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos/ParceiroServico.cs @@ -0,0 +1,124 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Servicos; + +internal class ParceiroServico : BaseServico +{ + public async Task Save(Parceiro parceiro) + { + int tries = 3; + base.Sucesso = true; + Parceiro parceiroOriginal = parceiro; + return await Task.Run((Func)delegate + { + while (tries > 0) + { + List list = new List(); + parceiro = parceiroOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + bool num = ((DomainBase)parceiro).Id != 0L; + if (num) + { + list.Add(CreateLog(((DomainBase)parceiro).Id, parceiro, (TipoTela)22)); + } + parceiro = ((((DomainBase)parceiro).Id == 0L) ? commited.ParceiroRepository.SaveOrUpdate(parceiro) : commited.ParceiroRepository.Merge(parceiro)); + if (!num) + { + list.Add(CreateLog(((DomainBase)parceiro).Id, ((DomainBase)parceiro).GetValorOriginal(), (TipoTela)22, (TipoAcao)0)); + } + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return parceiro; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)256, tries, parceiro); + } + } + return parceiroOriginal; + }); + } + + internal async Task BuscarParceiro(long id) + { + int tries = 3; + return await Task.Run((Func)delegate + { + //IL_0059: Unknown result type (might be due to invalid IL or missing references) + //IL_005f: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ParceiroRepository.FindById(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)71, tries, id); + } + } + return new Parceiro(); + }); + } + + public async Task Delete(Parceiro parceiro) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + List list = new List(); + try + { + UnitOfWork commited = Instancia.Commited; + try + { + list.Add(CreateLog(((DomainBase)parceiro).Id, ((DomainBase)parceiro).GetValorOriginal(), (TipoTela)22, (TipoAcao)2)); + commited.ParceiroRepository.Delete(((DomainBase)parceiro).Id); + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)257, tries, parceiro); + } + } + return false; + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos/ParcelaServico.cs b/Decompiler/Gestor.Application.Servicos/ParcelaServico.cs new file mode 100644 index 0000000..4b00269 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos/ParcelaServico.cs @@ -0,0 +1,994 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net; +using System.Net.Sockets; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Relatorios; +using Gestor.Model.Domain.Relatorios.PrevisaoPagamentoComissao; +using Gestor.Model.Domain.Seguros; +using Newtonsoft.Json; + +namespace Gestor.Application.Servicos; + +internal class ParcelaServico : BaseServico +{ + internal async Task> BuscarParcelasAsync(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new ObservableCollection(from x in read.ParcelaRepository.FindByDocumentId(id) + orderby x.NumeroParcela + select x); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)73, tries, id); + } + } + return new ObservableCollection(); + }); + } + + internal async Task> BuscarParcelasPorDocumento(Documento documento) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new ObservableCollection(from x in read.ParcelaRepository.FindByDocumento(documento) + orderby x.NumeroParcela + select x); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)73, tries, ((DomainBase)documento).Id); + } + } + return new ObservableCollection(); + }); + } + + internal async Task> BuscarTodasParcelas(List ids) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ParcelaRepository.FindByDocumentId(ids); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)73, tries, ids); + } + } + return new List(); + }); + } + + internal async Task> BuscarParcelas(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return (from x in read.ParcelaRepository.FindByDocumentId(id) + orderby x.NumeroParcela + select x).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)73, tries, id); + } + } + return new List(); + }); + } + + internal async Task> BuscarParcelas(string ids, List documentos) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ParcelaRepository.FindByDocumentIds(ids, documentos); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)75, tries); + } + } + return new List(); + }); + } + + internal async Task> BuscarVendedores(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return (from x in read.VendedorParcelaRepository.FindByDocumentId(id) + group x by ((DomainBase)x.Vendedor).Id into x + select x.First().Vendedor).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)140, tries); + } + } + return new List(); + }); + } + + public async Task Save(Parcela parcela, List todas, List repasses = null, bool abrirTela = true) + { + int tries = 3; + base.Sucesso = true; + Parcela parcelaOriginal = parcela; + List repassesOriginais = repasses; + Funcoes.GetNetworkTime(); + ObservableCollection oldParcelas = await BuscarParcelasAsync(((DomainBase)parcela.Documento).Id); + return await Task.Run(async delegate + { + while (tries > 0) + { + try + { + Parcela val = ((IEnumerable)oldParcelas).FirstOrDefault((Func)((Parcela x) => ((DomainBase)x).Id == ((DomainBase)parcela).Id)); + List list = new List(); + UnitOfWork commited = Instancia.Commited; + try + { + bool flag = ((DomainBase)parcela).Id == 0; + parcela.IdEmpresa = parcela.Documento.Controle.IdEmpresa; + parcela = (flag ? commited.ParcelaRepository.SaveOrUpdate(parcela) : commited.ParcelaRepository.Merge(parcela)); + if (repasses != null) + { + foreach (VendedorParcela repass in repasses) + { + repass.Documento = parcela.Documento; + repass.Parcela = parcela; + if (((DomainBase)repass).Id == 0L) + { + commited.VendedorParcelaRepository.SaveOrUpdate(repass); + } + else + { + commited.VendedorParcelaRepository.Merge(repass); + } + } + parcela.Vendedores = new ObservableCollection(repasses); + } + if (flag) + { + list.Add(CreateLog(((DomainBase)parcela).Id, ((DomainBase)parcela).GetValorOriginal(), (TipoTela)5, (TipoAcao)0)); + } + else + { + list.Add(CreateLog(((DomainBase)parcela).Id, ((DomainBase)parcela).Compare(((DomainBase)val).GetValorOriginal()), (TipoTela)5, (TipoAcao)1)); + } + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return parcela; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)24, tries, parcelaOriginal, abrirTela); + } + } + parcelaOriginal.Vendedores = ((repassesOriginais != null) ? new ObservableCollection(repassesOriginais) : null); + return parcelaOriginal; + }); + } + + public async Task Save(VendedorParcela pagamento) + { + int tries = 3; + base.Sucesso = true; + Funcoes.GetNetworkTime(); + return await Task.Run((Func)delegate + { + while (tries > 0) + { + VendedorParcela val = pagamento; + try + { + List list = new List(); + UnitOfWork commited = Instancia.Commited; + try + { + val = ((((DomainBase)val).Id == 0L) ? commited.VendedorParcelaRepository.SaveOrUpdate(val) : commited.VendedorParcelaRepository.Merge(val)); + if (((DomainBase)pagamento).Id == 0L) + { + list.Add(CreateLog(((DomainBase)val).Id, ((DomainBase)val).GetValorOriginal(), (TipoTela)37, (TipoAcao)0)); + } + else + { + list.Add(CreateLog(((DomainBase)val).Id, ((DomainBase)val).Compare(((DomainBase)val).GetValorOriginal()), (TipoTela)37, (TipoAcao)1)); + } + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return val; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)189, tries, pagamento); + } + } + return pagamento; + }); + } + + public async Task> SaveRange(List parcela) + { + int tries = 3; + base.Sucesso = true; + return await Task.Run(delegate + { + while (tries > 0) + { + List list = parcela; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + foreach (Parcela item in list) + { + if (((DomainBase)item).Id == 0L) + { + item.IdEmpresa = item.Documento.Controle.IdEmpresa; + commited.ParcelaRepository.SaveOrUpdate(item); + } + else + { + commited.ParcelaRepository.Merge(item); + } + } + ((GenericUnitOfWork)commited).Commit(); + return list; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)24, tries, parcela); + } + } + return parcela; + }); + } + + public async Task SaveRange(List repasses) + { + int tries = 3; + List repassesOriginais = repasses; + Funcoes.GetNetworkTime(); + return await Task.Run(delegate + { + while (tries > 0) + { + repasses = repassesOriginais; + try + { + List logs = new List(); + UnitOfWork unitOfWork = Instancia.Commited; + try + { + repasses?.ForEach(Action); + SaveLog(logs, unitOfWork); + ((GenericUnitOfWork)unitOfWork).Commit(); + return true; + } + finally + { + if (unitOfWork != null) + { + ((IDisposable)unitOfWork).Dispose(); + } + } + void Action(VendedorParcela x) + { + _ = ((DomainBase)x).Id; + x = ((((DomainBase)x).Id == 0L) ? unitOfWork.VendedorParcelaRepository.SaveOrUpdate(x) : unitOfWork.VendedorParcelaRepository.Merge(x)); + if (((DomainBase)x).Id == 0L) + { + logs.Add(CreateLog(((DomainBase)x).Id, ((DomainBase)x).GetValorOriginal(), (TipoTela)37, (TipoAcao)0)); + } + else + { + logs.Add(CreateLog(((DomainBase)x).Id, ((DomainBase)x).Compare(((DomainBase)x).GetValorOriginal()), (TipoTela)37, (TipoAcao)1)); + } + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)189, tries, repasses, abrirTela: false); + } + } + return false; + }); + } + + public async Task Delete(Parcela parcela, List todas) + { + int tries = 3; + Funcoes.GetNetworkTime(); + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork commited = Instancia.Commited; + try + { + commited.ParcelaRepository.Delete(((DomainBase)parcela).Id); + List keyValues = new List { CreateLog(((DomainBase)parcela).Id, ((DomainBase)parcela).GetValorOriginal(), (TipoTela)5, (TipoAcao)2) }; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)190, tries, parcela); + } + } + return false; + }); + } + + public async Task DeletePagamentoRange(List repasses) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork commited = Instancia.Commited; + try + { + commited.VendedorParcelaRepository.DeleteRange(repasses); + ((GenericUnitOfWork)commited).Commit(); + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)21, tries, repasses, abrirTela: false); + } + } + return false; + }); + } + + public async Task> UpdateRange(List parcelas) + { + base.Sucesso = true; + int tries = 3; + List parcelasOriginais = parcelas; + Funcoes.GetNetworkTime(); + return await Task.Run(delegate + { + while (tries > 0) + { + parcelas = parcelasOriginais; + try + { + List logs = new List(); + UnitOfWork unitOfWork = Instancia.Commited; + try + { + parcelas = unitOfWork.ParcelaRepository.UpdateRange(parcelas); + parcelas.ForEach(delegate(Parcela x) + { + logs.Add(CreateLog(((DomainBase)x).Id, ((DomainBase)x).Compare(((DomainBase)x).GetValorOriginal()), (TipoTela)5, (TipoAcao)1)); + SaveLog(logs, unitOfWork); + }); + ((GenericUnitOfWork)unitOfWork).Commit(); + return parcelas; + } + finally + { + if (unitOfWork != null) + { + ((IDisposable)unitOfWork).Dispose(); + } + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)24, tries, parcelas, abrirTela: false); + } + } + return parcelasOriginais; + }); + } + + public async Task BuscarParcela(long id) + { + int tries = 3; + return await Task.Run((Func)delegate + { + //IL_0059: Unknown result type (might be due to invalid IL or missing references) + //IL_005f: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ParcelaRepository.FindById(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)74, tries, id); + } + } + return new Parcela(); + }); + } + + public async Task UpdateDetalhes(List detalhes) + { + int tries = 3; + DateTime now = Funcoes.GetNetworkTime(); + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork unitOfWork = Instancia.Commited; + try + { + bool flag = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 51); + bool result = unitOfWork.ParcelaRepository.Update(detalhes, flag); + IPHostEntry host = Dns.GetHostEntry(Dns.GetHostName()); + detalhes.ForEach(delegate(DetalheExtrato x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + //IL_0028: Unknown result type (might be due to invalid IL or missing references) + //IL_002a: Unknown result type (might be due to invalid IL or missing references) + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_003b: Expected O, but got Unknown + //IL_0040: Unknown result type (might be due to invalid IL or missing references) + //IL_004c: Unknown result type (might be due to invalid IL or missing references) + //IL_0054: Unknown result type (might be due to invalid IL or missing references) + //IL_005f: Unknown result type (might be due to invalid IL or missing references) + //IL_006a: Unknown result type (might be due to invalid IL or missing references) + //IL_0075: Unknown result type (might be due to invalid IL or missing references) + //IL_00b7: Expected O, but got Unknown + RegistroLog keyValues = new RegistroLog + { + Acao = (TipoAcao)1, + Usuario = Recursos.Usuario, + DataHora = now, + Descricao = JsonConvert.SerializeObject((object)x, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)x).Id, + Tela = (TipoTela)23, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = host.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, unitOfWork); + }); + ((GenericUnitOfWork)unitOfWork).Commit(); + return result; + } + finally + { + if (unitOfWork != null) + { + ((IDisposable)unitOfWork).Dispose(); + } + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)192, tries, detalhes); + } + } + return false; + }); + } + + public async Task> BuscarFaturas(Filtros filtro, bool buscaAssinaturas = false, bool painelBi = false) + { + int tries = 3; + return await Task.Run(async delegate + { + while (tries > 0) + { + try + { + UnitOfWork unitOfWork = Instancia.Read; + try + { + return await unitOfWork.ParcelaRepository.BuscaDocumentosPorVigencia(filtro, buscaAssinaturas, painelBi); + } + finally + { + ((IDisposable)unitOfWork)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)76, tries, filtro); + } + } + return new List(); + }); + } + + public async Task> BuscarFatura(string numero) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ParcelaRepository.FindNumFatura(numero); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)322, tries, numero); + } + } + return new List(); + }); + } + + public async Task> BuscarParcelasRecebimento(Filtros filtro) + { + int tries = 3; + return await Task.Run(async delegate + { + while (tries > 0) + { + try + { + UnitOfWork unitOfWork = Instancia.Read; + try + { + return await unitOfWork.ParcelaRepository.FindByRecebimento(filtro); + } + finally + { + ((IDisposable)unitOfWork)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)77, tries, filtro); + } + } + return new List(); + }); + } + + public async Task> BuscarParcelasPendentes(Filtros filtro, bool somenteAtivos = false) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ParcelaRepository.FindByPendente(filtro, true, somenteAtivos); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)78, tries, filtro); + } + } + return new List(); + }); + } + + public async Task> BuscarParcelas(Filtros filtro, bool somenteAtivos = false) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ParcelaRepository.FindByPendente(filtro, false, somenteAtivos); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)79, tries, filtro); + } + } + return new List(); + }); + } + + public async Task> BuscarPagamentoVendedor(Filtros filtro, bool reciboPagamento, bool segundaViaReciboPagamento) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ParcelaRepository.FindByPagamento(filtro, reciboPagamento, segundaViaReciboPagamento, Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 34)); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)80, tries, filtro); + } + } + return new List(); + }); + } + + public async Task TemPagamento(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.VendedorParcelaRepository.TemPagamentoParcela(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)82, tries, id); + } + } + return false; + }); + } + + public async Task GerarPagamento(List pagamentos) + { + int tries = 3; + DateTime now = Funcoes.GetNetworkTime(); + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork commited = Instancia.Commited; + try + { + if (!commited.VendedorParcelaRepository.GerarPagamento(pagamentos.Select((VendedorParcela x) => ((DomainBase)x).Id).ToList(), now)) + { + return false; + } + ((GenericUnitOfWork)commited).Commit(); + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)193, tries, pagamentos); + } + } + return false; + }); + } + + public async Task BuscarApolice(long id) + { + int tries = 3; + return await Task.Run((Func)delegate + { + //IL_0058: Unknown result type (might be due to invalid IL or missing references) + //IL_005e: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ParcelaRepository.BuscarApolice(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)3, tries, id); + } + } + return new Documento(); + }); + } + + public async Task SalvarObservacoes(long id, string observacao) + { + int tries = 3; + base.Sucesso = true; + Funcoes.GetNetworkTime(); + return await Task.Run(delegate + { + while (tries > 0) + { + List list = new List(); + try + { + UnitOfWork commited = Instancia.Commited; + try + { + Parcela val = commited.ParcelaRepository.FindById(id); + ((DomainBase)val).Initialize(); + val.Observacao = observacao; + list.Add(CreateLog(((DomainBase)val).Id, val, (TipoTela)5)); + commited.ParcelaRepository.Merge(val); + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + return observacao; + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)24, tries, new { id, observacao }); + } + } + return ""; + }); + } + + public async Task> FaturaPendente(Filtros filtro) + { + int tries = 3; + return await Task.Run(async delegate + { + while (tries > 0) + { + try + { + UnitOfWork unitOfWork = Instancia.Read; + try + { + return await unitOfWork.ParcelaRepository.FaturaPendente(filtro); + } + finally + { + ((IDisposable)unitOfWork)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)83, tries, filtro); + } + } + return new List(); + }); + } + + public async Task> BuscarPrevisaoPagamentoComissao(Filtros filtro) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ParcelaRepository.PrevisaoPagamentoComissao(filtro); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)316, tries, filtro); + } + } + return new List(); + }); + } + + public async Task BuscarLogAntigo(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ParcelaRepository.BuscarLogAntigo(id, Connection.GetConnectionString()); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)319, tries, id); + } + } + return (string)null; + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos/PermissaoArquivoDigitalServico.cs b/Decompiler/Gestor.Application.Servicos/PermissaoArquivoDigitalServico.cs new file mode 100644 index 0000000..f48019c --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos/PermissaoArquivoDigitalServico.cs @@ -0,0 +1,181 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Servicos; + +public class PermissaoArquivoDigitalServico : BaseServico +{ + public async Task> SavePermiss(List permissao, List prev) + { + int tries = 3; + base.Sucesso = true; + List permissaoOriginal = permissao; + List prevOriginal = prev; + return await Task.Run(delegate + { + while (tries > 0) + { + permissao = permissaoOriginal; + prev = prevOriginal; + new List(); + List logs = new List(); + try + { + UnitOfWork unitOfWork = Instancia.Commited; + try + { + permissao.ForEach(delegate(PermissaoArquivoDigital x) + { + PermissaoArquivoDigital val = ((IEnumerable)prev).FirstOrDefault((Func)((PermissaoArquivoDigital y) => ((DomainBase)y).Id == ((DomainBase)x).Id)); + if (val == null || val.Consultar != x.Consultar || val.Excluir != x.Excluir || val.Incluir != x.Incluir) + { + if (val == null) + { + logs.Add(CreateLog(((DomainBase)x.Usuario).Id, ((DomainBase)x).GetValorOriginal(), (TipoTela)43, (TipoAcao)0)); + } + else + { + logs.Add(CreateLog(((DomainBase)x.Usuario).Id, ((DomainBase)x).Compare(((DomainBase)val).GetValorOriginal()), (TipoTela)43, (TipoAcao)1)); + } + x = ((((DomainBase)x).Id == 0L) ? unitOfWork.PermissaoArquivoDigitalRepository.SaveOrUpdate(x) : unitOfWork.PermissaoArquivoDigitalRepository.Merge(x)); + } + }); + SaveLog(logs, unitOfWork); + ((GenericUnitOfWork)unitOfWork).Commit(); + return permissao; + } + finally + { + if (unitOfWork != null) + { + ((IDisposable)unitOfWork).Dispose(); + } + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)258, tries, new { permissao, prev }); + } + } + return permissaoOriginal; + }); + } + + public async Task> PermissArquivoDigital(Usuario usuario) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.PermissaoArquivoDigitalRepository.FindByUsuario(((DomainBase)usuario).Id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)84, tries, usuario); + } + } + return new List(); + }); + } + + public async Task VerificarPermissao(Usuario usuario, TipoArquivoDigital tela) + { + //IL_001e: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + int tries = 3; + return await Task.Run((Func)delegate + { + //IL_004a: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Unknown result type (might be due to invalid IL or missing references) + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.PermissaoArquivoDigitalRepository.FindByPermissao(((DomainBase)usuario).Id, tela); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)85, tries, new { usuario, tela }); + } + } + return (PermissaoArquivoDigital)null; + }); + } + + public PermissaoArquivoDigital BuscarPermissao(Usuario usuario, TipoArquivoDigital tela) + { + //IL_0063: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + //IL_0021: Unknown result type (might be due to invalid IL or missing references) + //IL_0026: Unknown result type (might be due to invalid IL or missing references) + //IL_002d: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_0034: Unknown result type (might be due to invalid IL or missing references) + //IL_003b: Unknown result type (might be due to invalid IL or missing references) + //IL_0042: Unknown result type (might be due to invalid IL or missing references) + //IL_004a: Expected O, but got Unknown + int num = 3; + while (num > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + PermissaoArquivoDigital val = read.PermissaoArquivoDigitalRepository.FindByPermissao(((DomainBase)usuario).Id, tela); + if (val == null) + { + return new PermissaoArquivoDigital + { + Usuario = usuario, + Tela = tela, + Consultar = true, + Excluir = true, + Incluir = true + }; + } + return val; + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + num = Registrar(e, (TipoErro)85, num, new { usuario, tela }); + } + } + return null; + } +} diff --git a/Decompiler/Gestor.Application.Servicos/PermissaoUsuarioServico.cs b/Decompiler/Gestor.Application.Servicos/PermissaoUsuarioServico.cs new file mode 100644 index 0000000..6b7f0fe --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos/PermissaoUsuarioServico.cs @@ -0,0 +1,160 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Servicos; + +public class PermissaoUsuarioServico : BaseServico +{ + public async Task> SavePermiss(List permissao, List prev) + { + int tries = 3; + base.Sucesso = true; + List permissaoOriginal = permissao; + List prevOriginal = prev; + return await Task.Run(delegate + { + List logs = new List(); + while (tries > 0) + { + permissao = permissaoOriginal; + prev = prevOriginal; + try + { + UnitOfWork unitOfWork = Instancia.Commited; + try + { + permissao.ForEach(delegate(PermissaoUsuario x) + { + PermissaoUsuario val = ((IEnumerable)prev).FirstOrDefault((Func)((PermissaoUsuario y) => ((DomainBase)y).Id == ((DomainBase)x).Id)); + if (val == null || val.Alterar != x.Alterar || val.Consultar != x.Consultar || val.Excluir != x.Excluir || val.Incluir != x.Incluir) + { + if (val == null) + { + logs.Add(CreateLog(((DomainBase)x.Usuario).Id, ((DomainBase)x).GetValorOriginal(), (TipoTela)43, (TipoAcao)0)); + } + else + { + logs.Add(CreateLog(((DomainBase)x.Usuario).Id, ((DomainBase)x).Compare(((DomainBase)val).GetValorOriginal()), (TipoTela)43, (TipoAcao)1)); + } + x = ((((DomainBase)x).Id == 0L) ? unitOfWork.PermissaoUsuarioRepository.SaveOrUpdate(x) : unitOfWork.PermissaoUsuarioRepository.Merge(x)); + } + }); + SaveLog(logs, unitOfWork); + ((GenericUnitOfWork)unitOfWork).Commit(); + return permissao; + } + finally + { + if (unitOfWork != null) + { + ((IDisposable)unitOfWork).Dispose(); + } + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)258, tries, new { permissao, prev }); + } + } + return permissaoOriginal; + }); + } + + public async Task> PermissUsuario(Usuario usuario) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.PermissaoUsuarioRepository.FindByUsuario(((DomainBase)usuario).Id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)84, tries, usuario); + } + } + return new List(); + }); + } + + public async Task VerificarPermissao(Usuario usuario, TipoTela tela) + { + //IL_001e: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + int tries = 3; + return await Task.Run((Func)delegate + { + //IL_004a: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Unknown result type (might be due to invalid IL or missing references) + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.PermissaoUsuarioRepository.FindByPermissao(((DomainBase)usuario).Id, tela); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)85, tries, new { usuario, tela }); + } + } + return (PermissaoUsuario)null; + }); + } + + public PermissaoUsuario BuscarPermissao(Usuario usuario, TipoTela tela) + { + //IL_0031: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + int num = 3; + while (num > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.PermissaoUsuarioRepository.FindByPermissao(((DomainBase)usuario).Id, tela); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + num = Registrar(e, (TipoErro)85, num, new { usuario, tela }); + } + } + return null; + } +} diff --git a/Decompiler/Gestor.Application.Servicos/ProspeccaoServico.cs b/Decompiler/Gestor.Application.Servicos/ProspeccaoServico.cs new file mode 100644 index 0000000..6cdf7cf --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos/ProspeccaoServico.cs @@ -0,0 +1,340 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Sockets; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Threading; +using Gestor.Application.Actions; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Relatorios; +using Gestor.Model.Domain.Seguros; +using Newtonsoft.Json; + +namespace Gestor.Application.Servicos; + +public class ProspeccaoServico : BaseServico +{ + internal async Task> BuscarProspeccoes(long id, DateTime inicio, DateTime fim, StatusProspeccao? status) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ProspectRepository.Find(((DomainBase)Recursos.Empresa).Id, id, inicio, fim, status); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)86, tries, new { id, inicio, fim, status }); + } + } + return new List(); + }); + } + + public async Task Salvar(Prospeccao prospecao) + { + int tries = 3; + base.Sucesso = true; + Prospeccao prospecaoOriginal = prospecao; + return await Task.Run((Func)delegate + { + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_0165: Unknown result type (might be due to invalid IL or missing references) + //IL_016a: Unknown result type (might be due to invalid IL or missing references) + //IL_016b: Unknown result type (might be due to invalid IL or missing references) + //IL_0171: Unknown result type (might be due to invalid IL or missing references) + //IL_017c: Unknown result type (might be due to invalid IL or missing references) + //IL_0183: Unknown result type (might be due to invalid IL or missing references) + //IL_018a: Unknown result type (might be due to invalid IL or missing references) + //IL_018f: Unknown result type (might be due to invalid IL or missing references) + //IL_019b: Expected O, but got Unknown + //IL_01a0: Unknown result type (might be due to invalid IL or missing references) + //IL_01b1: Unknown result type (might be due to invalid IL or missing references) + //IL_01b9: Unknown result type (might be due to invalid IL or missing references) + //IL_01c4: Unknown result type (might be due to invalid IL or missing references) + //IL_01cf: Unknown result type (might be due to invalid IL or missing references) + //IL_01da: Unknown result type (might be due to invalid IL or missing references) + //IL_0219: Expected O, but got Unknown + while (tries > 0) + { + prospecao = prospecaoOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + DateTime networkTime = Funcoes.GetNetworkTime(); + TipoAcao acao = (TipoAcao)(((DomainBase)prospecao).Id != 0L); + prospecao.IdEmpresa = Recursos.Usuario.IdEmpresa; + if (!prospecao.DataCriacao.HasValue) + { + prospecao.DataCriacao = networkTime; + } + if (prospecao.UsuarioCriacao == 0L) + { + prospecao.UsuarioCriacao = ((DomainBase)Recursos.Usuario).Id; + } + Tarefa tarefa = prospecao.Tarefa; + tarefa = ((!prospecao.CriarTarefa) ? null : ((((DomainBase)tarefa).Id == 0L) ? commited.TarefaRepository.Salvar(tarefa) : commited.TarefaRepository.Atualizar(tarefa))); + prospecao.Tarefa = tarefa; + prospecao = ((((DomainBase)prospecao).Id == 0L) ? commited.ProspectRepository.SaveOrUpdate(prospecao) : commited.ProspectRepository.Merge(prospecao)); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + if (prospecao.Tarefa != null) + { + prospecao.Tarefa.IdEntidade = ((DomainBase)prospecao).Id; + prospecao.Tarefa = commited.TarefaRepository.Atualizar(prospecao.Tarefa); + } + RegistroLog keyValues = new RegistroLog + { + Acao = acao, + Usuario = Recursos.Usuario, + DataHora = networkTime, + Descricao = JsonConvert.SerializeObject((object)prospecao, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)prospecao).Id, + Tela = (TipoTela)33, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + ((DispatcherObject)Application.Current).Dispatcher.Invoke((Action)delegate + { + Gestor.Application.Actions.Actions.AtualizaBadges(); + }); + return prospecao; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)259, tries, prospecao); + } + } + return prospecaoOriginal; + }); + } + + public async Task Delete(Prospeccao prospeccao) + { + int tries = 3; + return await Task.Run(delegate + { + //IL_0134: Unknown result type (might be due to invalid IL or missing references) + //IL_0139: Unknown result type (might be due to invalid IL or missing references) + //IL_0140: Unknown result type (might be due to invalid IL or missing references) + //IL_014b: Unknown result type (might be due to invalid IL or missing references) + //IL_0152: Unknown result type (might be due to invalid IL or missing references) + //IL_0159: Unknown result type (might be due to invalid IL or missing references) + //IL_015e: Unknown result type (might be due to invalid IL or missing references) + //IL_016a: Expected O, but got Unknown + //IL_016f: Unknown result type (might be due to invalid IL or missing references) + //IL_0180: Unknown result type (might be due to invalid IL or missing references) + //IL_0188: Unknown result type (might be due to invalid IL or missing references) + //IL_0193: Unknown result type (might be due to invalid IL or missing references) + //IL_019e: Unknown result type (might be due to invalid IL or missing references) + //IL_01a9: Unknown result type (might be due to invalid IL or missing references) + //IL_006b: Unknown result type (might be due to invalid IL or missing references) + //IL_0070: Unknown result type (might be due to invalid IL or missing references) + //IL_0077: Unknown result type (might be due to invalid IL or missing references) + //IL_0082: Unknown result type (might be due to invalid IL or missing references) + //IL_0089: Unknown result type (might be due to invalid IL or missing references) + //IL_0095: Unknown result type (might be due to invalid IL or missing references) + //IL_009a: Unknown result type (might be due to invalid IL or missing references) + //IL_00a6: Expected O, but got Unknown + //IL_00ab: Unknown result type (might be due to invalid IL or missing references) + //IL_00c1: Unknown result type (might be due to invalid IL or missing references) + //IL_00c9: Unknown result type (might be due to invalid IL or missing references) + //IL_00d4: Unknown result type (might be due to invalid IL or missing references) + //IL_00df: Unknown result type (might be due to invalid IL or missing references) + //IL_00ea: Unknown result type (might be due to invalid IL or missing references) + //IL_01e6: Expected O, but got Unknown + //IL_0127: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork commited = Instancia.Commited; + try + { + if (prospeccao.Tarefa != null) + { + commited.TarefaRepository.Excluir(((DomainBase)prospeccao.Tarefa).Id); + } + commited.ProspectRepository.Delete(((DomainBase)prospeccao).Id); + DateTime networkTime = Funcoes.GetNetworkTime(); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog keyValues; + if (prospeccao.Tarefa != null) + { + keyValues = new RegistroLog + { + Acao = (TipoAcao)2, + Usuario = Recursos.Usuario, + DataHora = networkTime, + Descricao = JsonConvert.SerializeObject((object)prospeccao.Tarefa, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)prospeccao.Tarefa).Id, + Tela = (TipoTela)38, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, commited); + } + keyValues = new RegistroLog + { + Acao = (TipoAcao)2, + Usuario = Recursos.Usuario, + DataHora = networkTime, + Descricao = JsonConvert.SerializeObject((object)prospeccao, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)prospeccao).Id, + Tela = (TipoTela)33, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + ((DispatcherObject)Application.Current).Dispatcher.Invoke((Action)delegate + { + Gestor.Application.Actions.Actions.AtualizaBadges(); + }); + return true; + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)260, tries, prospeccao); + } + } + return false; + }); + } + + public async Task BuscarProspeccao(long id) + { + int tries = 3; + return await Task.Run((Func)delegate + { + //IL_0059: Unknown result type (might be due to invalid IL or missing references) + //IL_005f: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ProspectRepository.FindById(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)87, tries, id); + } + } + return new Prospeccao(); + }); + } + + public async Task> BuscarProspeccoes(Filtros filtro) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ProspectRepository.Find(filtro); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)88, tries, filtro); + } + } + return new List(); + }); + } + + public async Task> BuscarProspeccoesPorStatus(StatusDeProspeccao statusProspeccao) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ProspectRepository.FindByStatusPersonalizado(((DomainBase)statusProspeccao).Id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)310, tries, new { statusProspeccao }); + } + } + return new List(); + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos/RestricaoUsuarioServico.cs b/Decompiler/Gestor.Application.Servicos/RestricaoUsuarioServico.cs new file mode 100644 index 0000000..1c1e7ee --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos/RestricaoUsuarioServico.cs @@ -0,0 +1,222 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Servicos; + +public class RestricaoUsuarioServico : BaseServico +{ + public RestricaoUsuario BuscarRestricao(Usuario usuario, TipoRestricao restricao) + { + //IL_0031: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + int num = 3; + while (num > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.RestricaoUsuarioRepository.FindRestricao(((DomainBase)usuario).Id, restricao); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + num = Registrar(e, (TipoErro)89, num, new { usuario, restricao }); + } + } + return null; + } + + public async Task> SaveRestri(List restricoes, List prev) + { + int tries = 3; + base.Sucesso = true; + List restricoesOriginal = restricoes; + List prevOriginal = prev; + return await Task.Run(delegate + { + while (tries > 0) + { + new List(); + List logs = new List(); + restricoes = restricoesOriginal; + prev = prevOriginal; + try + { + UnitOfWork unitOfWork = Instancia.Commited; + try + { + restricoes.ForEach(delegate(RestricaoUsuario x) + { + RestricaoUsuario val = ((IEnumerable)prev).FirstOrDefault((Func)((RestricaoUsuario y) => (((DomainBase)x).Id != 0L) ? (((DomainBase)y).Id == ((DomainBase)x).Id) : (y.Tipo == x.Tipo))); + if (val == null || val.Restricao != x.Restricao) + { + if (val == null) + { + logs.Add(CreateLog(((DomainBase)x.Usuario).Id, ((DomainBase)x).GetValorOriginal(), (TipoTela)43, (TipoAcao)0)); + } + else + { + logs.Add(CreateLog(((DomainBase)x.Usuario).Id, ((DomainBase)x).Compare(((DomainBase)val).GetValorOriginal()), (TipoTela)43, (TipoAcao)1)); + } + x = ((((DomainBase)x).Id == 0L) ? unitOfWork.RestricaoUsuarioRepository.SaveOrUpdate(x) : unitOfWork.RestricaoUsuarioRepository.Merge(x)); + } + }); + SaveLog(logs, unitOfWork); + ((GenericUnitOfWork)unitOfWork).Commit(); + return restricoes; + } + finally + { + if (unitOfWork != null) + { + ((IDisposable)unitOfWork).Dispose(); + } + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)261, tries, new { restricoes, prev }); + } + } + return restricoesOriginal; + }); + } + + public async Task> SaveRestriCamposRelatorios(List restricoes, List prev) + { + int tries = 3; + base.Sucesso = true; + List restricoesOriginal = restricoes; + List prevOriginal = prev; + return await Task.Run(delegate + { + while (tries > 0) + { + new List(); + List logs = new List(); + restricoes = restricoesOriginal; + prev = prevOriginal; + try + { + UnitOfWork unitOfWork = Instancia.Commited; + try + { + restricoes.ForEach(delegate(RestricaoUsuarioCamposRelatorios x) + { + RestricaoUsuarioCamposRelatorios val = ((IEnumerable)prev).FirstOrDefault((Func)delegate(RestricaoUsuarioCamposRelatorios y) + { + //IL_0035: Unknown result type (might be due to invalid IL or missing references) + //IL_0040: Unknown result type (might be due to invalid IL or missing references) + if (((DomainBase)y).Id != 0L) + { + return ((DomainBase)y).Id == ((DomainBase)x).Id; + } + return y.Campo == x.Campo && y.Relatorio == x.Relatorio; + }); + if (val == null || val.Restricao != x.Restricao) + { + if (val == null) + { + logs.Add(CreateLog(((DomainBase)x.Usuario).Id, ((DomainBase)x).GetValorOriginal(), (TipoTela)43, (TipoAcao)0)); + } + else + { + logs.Add(CreateLog(((DomainBase)x.Usuario).Id, ((DomainBase)x).Compare(((DomainBase)val).GetValorOriginal()), (TipoTela)43, (TipoAcao)1)); + } + x = ((((DomainBase)x).Id == 0L) ? unitOfWork.RestricaoUsuarioCamposRelatoriosRepository.SaveOrUpdate(x) : unitOfWork.RestricaoUsuarioCamposRelatoriosRepository.Merge(x)); + } + }); + SaveLog(logs, unitOfWork); + ((GenericUnitOfWork)unitOfWork).Commit(); + return restricoes; + } + finally + { + if (unitOfWork != null) + { + ((IDisposable)unitOfWork).Dispose(); + } + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)261, tries, new { restricoes, prev }); + } + } + return restricoesOriginal; + }); + } + + public async Task> BuscarRestricoes(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.RestricaoUsuarioRepository.FindByUsuario(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)90, tries, id); + } + } + return new List(); + }); + } + + public async Task> BuscarRestricoesCamposRelatorios(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.RestricaoUsuarioCamposRelatoriosRepository.FindByUsuario(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)90, tries, id); + } + } + return new List(); + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos/ServicoExtrato.cs b/Decompiler/Gestor.Application.Servicos/ServicoExtrato.cs new file mode 100644 index 0000000..d8dc8d4 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos/ServicoExtrato.cs @@ -0,0 +1,310 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Relatorios; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Servicos; + +internal class ServicoExtrato : BaseServico +{ + internal async Task> BuscarDetalhes(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new ObservableCollection(from x in read.DetalheExtratoRepository.Find(id) + orderby x.Cliente, x.Apolice, x.Endosso, x.NumeroParcela + select x); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)91, tries, id); + } + } + return new ObservableCollection(); + }); + } + + internal async Task BuscarNumExtrato(long? id) + { + if (!id.HasValue || id <= 0) + { + return ""; + } + string numeroExtrato = ""; + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + DetalheExtrato val = read.DetalheExtratoRepository.FindByLongId(id).FirstOrDefault(); + numeroExtrato = ((val != null && ((DomainBase)val).Id > 0) ? val.Extrato.Numero : ""); + return numeroExtrato; + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)91, tries, id); + } + } + return ""; + }); + } + + public async Task> BuscarExtrato(long id, long idusuario, StatusExtrato status, DateTime inicio, DateTime fim) + { + //IL_0026: Unknown result type (might be due to invalid IL or missing references) + //IL_0027: Unknown result type (might be due to invalid IL or missing references) + int tries = 3; + return await Task.Run(delegate + { + //IL_00b6: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Unknown result type (might be due to invalid IL or missing references) + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return (from x in read.ExtratoRepository.FindBySeguradora(id, idusuario, ((DomainBase)Recursos.Empresa).Id, inicio, fim, (StatusExtrato?)status) + orderby x.Numero, x.Data descending + select x).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)92, tries, new { id, status, inicio, fim }); + } + } + return new List(); + }); + } + + public async Task> BuscarExtratoPorData(Filtros filtros) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return (from x in read.ExtratoRepository.FindByData(filtros) + orderby x.Data + select x).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)93, tries, filtros); + } + } + return new List(); + }); + } + + public async Task Save(DetalheExtrato detalhe) + { + int tries = 3; + base.Sucesso = true; + DetalheExtrato detalheOriginal = detalhe; + return await Task.Run((Func)delegate + { + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_0041: Unknown result type (might be due to invalid IL or missing references) + //IL_0043: Invalid comparison between Unknown and I4 + //IL_009b: Unknown result type (might be due to invalid IL or missing references) + //IL_0064: Unknown result type (might be due to invalid IL or missing references) + while (tries > 0) + { + detalhe = detalheOriginal; + try + { + List list = new List(); + UnitOfWork commited = Instancia.Commited; + try + { + TipoAcao val = (TipoAcao)(((DomainBase)detalhe).Id != 0L); + commited.DetalheExtratoRepository.Merge(detalhe); + if ((int)val == 1) + { + list.Add(CreateLog(((DomainBase)detalhe).Id, ((DomainBase)detalhe).GetValorOriginal(), (TipoTela)23, val)); + } + else + { + list.Add(CreateLog(((DomainBase)detalhe).Id, ((DomainBase)detalhe).Compare(((DomainBase)detalheOriginal).GetValorOriginal()), (TipoTela)23, val)); + } + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return detalhe; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)262, tries, detalhe); + } + } + return detalheOriginal; + }); + } + + public async Task Save(Extrato extrato) + { + int tries = 3; + base.Sucesso = true; + Extrato extratoOriginal = extrato; + return await Task.Run((Func)delegate + { + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_0041: Unknown result type (might be due to invalid IL or missing references) + //IL_0043: Invalid comparison between Unknown and I4 + //IL_009b: Unknown result type (might be due to invalid IL or missing references) + //IL_0064: Unknown result type (might be due to invalid IL or missing references) + while (tries > 0) + { + extrato = extratoOriginal; + try + { + List list = new List(); + UnitOfWork commited = Instancia.Commited; + try + { + TipoAcao val = (TipoAcao)(((DomainBase)extrato).Id != 0L); + commited.ExtratoRepository.Merge(extrato); + if ((int)val == 1) + { + list.Add(CreateLog(((DomainBase)extrato).Id, ((DomainBase)extrato).GetValorOriginal(), (TipoTela)23, val)); + } + else + { + list.Add(CreateLog(((DomainBase)extrato).Id, ((DomainBase)extrato).Compare(((DomainBase)extratoOriginal).GetValorOriginal()), (TipoTela)23, val)); + } + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + return extrato; + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)263, tries, extrato); + } + } + return extratoOriginal; + }); + } + + public async Task Delete(Extrato extrato) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + List list = new List(); + UnitOfWork commited = Instancia.Commited; + try + { + commited.ExtratoRepository.Delete(((DomainBase)extrato).Id); + list.Add(CreateLog(((DomainBase)extrato).Id, ((DomainBase)extrato).GetValorOriginal(), (TipoTela)1, (TipoAcao)2)); + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)264, tries, extrato); + } + } + return false; + }); + } + + public async Task FindByParcelaId(long id) + { + int tries = 3; + return await Task.Run((Func)delegate + { + //IL_0059: Unknown result type (might be due to invalid IL or missing references) + //IL_005f: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.DetalheExtratoRepository.FindByParcelaId(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)74, tries, id); + } + } + return new DetalheExtrato(); + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos/TarefaServico.cs b/Decompiler/Gestor.Application.Servicos/TarefaServico.cs new file mode 100644 index 0000000..6dd9c31 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos/TarefaServico.cs @@ -0,0 +1,817 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Sockets; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Threading; +using Gestor.Application.Actions; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Newtonsoft.Json; + +namespace Gestor.Application.Servicos; + +public class TarefaServico : BaseServico +{ + public async Task> BuscarTarefas(TipoTarefa entidade, long id, bool? concluido) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + int tries = 3; + return await Task.Run(delegate + { + //IL_0045: Unknown result type (might be due to invalid IL or missing references) + //IL_0010: Unknown result type (might be due to invalid IL or missing references) + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.TarefaRepository.BuscarTarefa(entidade, id, concluido); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)94, tries, new { entidade, id, concluido }); + } + } + return new List(); + }); + } + + public async Task Salvar(Tarefa tarefa) + { + int tries = 3; + base.Sucesso = true; + DateTime now = Funcoes.GetNetworkTime(); + Tarefa tarefaOriginal = tarefa; + return await Task.Run((Func)delegate + { + //IL_0028: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Invalid comparison between Unknown and I4 + //IL_00ad: Unknown result type (might be due to invalid IL or missing references) + //IL_00b2: Unknown result type (might be due to invalid IL or missing references) + //IL_00b9: Unknown result type (might be due to invalid IL or missing references) + //IL_00c4: Unknown result type (might be due to invalid IL or missing references) + //IL_00d0: Unknown result type (might be due to invalid IL or missing references) + //IL_00d7: Unknown result type (might be due to invalid IL or missing references) + //IL_00dc: Unknown result type (might be due to invalid IL or missing references) + //IL_00e8: Expected O, but got Unknown + //IL_00ed: Unknown result type (might be due to invalid IL or missing references) + //IL_00fe: Unknown result type (might be due to invalid IL or missing references) + //IL_0106: Unknown result type (might be due to invalid IL or missing references) + //IL_0111: Unknown result type (might be due to invalid IL or missing references) + //IL_011c: Unknown result type (might be due to invalid IL or missing references) + //IL_0127: Unknown result type (might be due to invalid IL or missing references) + //IL_0164: Expected O, but got Unknown + while (tries > 0) + { + tarefa = tarefaOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + CleanWebEditor(tarefa); + if ((int)tarefa.Entidade == 1) + { + tarefa.Descricao = ((!string.IsNullOrWhiteSpace(tarefa.Anotacoes)) ? tarefa.Anotacoes : tarefa.Descricao); + } + bool flag = ((DomainBase)tarefa).Id == 0; + tarefa = (flag ? commited.TarefaRepository.Salvar(tarefa) : commited.TarefaRepository.Atualizar(tarefa)); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog keyValues = new RegistroLog + { + Acao = (TipoAcao)1, + Usuario = Recursos.Usuario, + DataHora = now, + Descricao = JsonConvert.SerializeObject((object)tarefa, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)tarefa).Id, + Tela = (TipoTela)38, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + ((DispatcherObject)Application.Current).Dispatcher.Invoke((Action)delegate + { + Gestor.Application.Actions.Actions.AtualizaBadges(); + }); + return tarefa; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)265, tries, tarefa); + } + } + return tarefaOriginal; + }); + } + + private static void CleanWebEditor(Tarefa tarefa) + { + if (tarefa.Descricao != null) + { + tarefa.Descricao = RemoveXml(tarefa.Descricao); + } + if (tarefa.DescricaoInterna != null) + { + tarefa.DescricaoInterna = RemoveXml(tarefa.DescricaoInterna); + } + } + + public static string RemoveXml(string description) + { + try + { + List list = new List(); + string[] array = description.Split(new char[1] { '<' }); + foreach (string text in array) + { + if (text.Contains("?xml") || text.Contains("o:p")) + { + list.Add("<" + text); + } + } + foreach (string item in list) + { + description = description.Replace(item, ""); + } + return description; + } + catch (Exception ex) + { + throw ex; + } + } + + public async Task Salvar(Trilha trilha) + { + int tries = 3; + base.Sucesso = true; + DateTime now = Funcoes.GetNetworkTime(); + Trilha trilhaOriginal = trilha; + return await Task.Run((Func)delegate + { + //IL_005f: Unknown result type (might be due to invalid IL or missing references) + //IL_0064: Unknown result type (might be due to invalid IL or missing references) + //IL_006b: Unknown result type (might be due to invalid IL or missing references) + //IL_0076: Unknown result type (might be due to invalid IL or missing references) + //IL_0082: Unknown result type (might be due to invalid IL or missing references) + //IL_0089: Unknown result type (might be due to invalid IL or missing references) + //IL_008e: Unknown result type (might be due to invalid IL or missing references) + //IL_009a: Expected O, but got Unknown + //IL_009f: Unknown result type (might be due to invalid IL or missing references) + //IL_00b0: Unknown result type (might be due to invalid IL or missing references) + //IL_00b7: Unknown result type (might be due to invalid IL or missing references) + //IL_00c2: Unknown result type (might be due to invalid IL or missing references) + //IL_00cd: Unknown result type (might be due to invalid IL or missing references) + //IL_00d8: Unknown result type (might be due to invalid IL or missing references) + //IL_0115: Expected O, but got Unknown + while (tries > 0) + { + trilha = trilhaOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + bool flag = ((DomainBase)trilha).Id == 0; + trilha = (flag ? commited.TarefaRepository.Salvar(trilha) : commited.TarefaRepository.Atualizar(trilha)); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog keyValues = new RegistroLog + { + Acao = (TipoAcao)1, + Usuario = Recursos.Usuario, + DataHora = now, + Descricao = JsonConvert.SerializeObject((object)trilha, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)trilha).Id, + Tela = (TipoTela)4, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + ((DispatcherObject)Application.Current).Dispatcher.Invoke((Action)delegate + { + Gestor.Application.Actions.Actions.AtualizaBadges(); + }); + return trilha; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)267, tries, trilha); + } + } + return trilhaOriginal; + }); + } + + public async Task Excluir(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork commited = Instancia.Commited; + try + { + commited.TarefaRepository.Excluir(id); + ((GenericUnitOfWork)commited).Commit(); + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + ((DispatcherObject)Application.Current).Dispatcher.Invoke((Action)delegate + { + Gestor.Application.Actions.Actions.AtualizaBadges(); + }); + return true; + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)268, tries, id); + } + } + return false; + }); + } + + public async Task> BuscarTarefas(long id, DateTime inicio, DateTime fim, bool? concluido) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.TarefaRepository.BuscarTarefaPorUsuario(id, inicio, fim, concluido); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)95, tries, new { id, inicio, fim, concluido }); + } + } + return new List(); + }); + } + + public async Task> BuscarTarefasCliente(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.TarefaRepository.BuscarTarefaPorCliente(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)96, tries, id); + } + } + return new List(); + }); + } + + public async Task> BuscarNotas(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.TarefaRepository.BuscarTarefaPorUsuario(id, (TipoTarefa)1); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)98, tries, id); + } + } + return new List(); + }); + } + + public async Task> BuscarNotasConcluidas(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.TarefaRepository.BuscarTarefaConcluidaPorUsuario(id, (TipoTarefa)1); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)99, tries, id); + } + } + return new List(); + }); + } + + public async Task AtualizarNotasTarefas() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.TarefaRepository.ContarTarefas(((DomainBase)Recursos.Usuario).Id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)100, tries, ((DomainBase)Recursos.Usuario).Id); + } + } + return new int[1]; + }); + } + + public async Task> BuscarTarefas(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.TarefaRepository.BuscarTarefaPorTrilha(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)101, tries, id); + } + } + return new List(); + }); + } + + public async Task> BuscarFases(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.TarefaRepository.BuscarFases(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)102, tries, id); + } + } + return new List(); + }); + } + + public async Task> BuscarTrilhas() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.TarefaRepository.BuscarTrilhas(true); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)104, tries); + } + } + return new List(); + }); + } + + public async Task> Salvar(List fases) + { + int tries = 3; + base.Sucesso = true; + DateTime now = Funcoes.GetNetworkTime(); + List fasesOriginal = fases; + return await Task.Run(delegate + { + //IL_0052: Unknown result type (might be due to invalid IL or missing references) + //IL_0057: Unknown result type (might be due to invalid IL or missing references) + //IL_005e: Unknown result type (might be due to invalid IL or missing references) + //IL_0069: Unknown result type (might be due to invalid IL or missing references) + //IL_0075: Unknown result type (might be due to invalid IL or missing references) + //IL_0077: Unknown result type (might be due to invalid IL or missing references) + //IL_007c: Unknown result type (might be due to invalid IL or missing references) + //IL_0088: Expected O, but got Unknown + //IL_008d: Unknown result type (might be due to invalid IL or missing references) + //IL_0099: Unknown result type (might be due to invalid IL or missing references) + //IL_00a0: Unknown result type (might be due to invalid IL or missing references) + //IL_00ab: Unknown result type (might be due to invalid IL or missing references) + //IL_00b6: Unknown result type (might be due to invalid IL or missing references) + //IL_00c1: Unknown result type (might be due to invalid IL or missing references) + //IL_00ff: Expected O, but got Unknown + while (tries > 0) + { + fases = fasesOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + fases = commited.TarefaRepository.Salvar(fases); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + foreach (Fase fase in fases) + { + RegistroLog keyValues = new RegistroLog + { + Acao = (TipoAcao)1, + Usuario = Recursos.Usuario, + DataHora = now, + Descricao = JsonConvert.SerializeObject((object)fase, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)fase).Id, + Tela = (TipoTela)4, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, commited); + } + ((GenericUnitOfWork)commited).Commit(); + ((DispatcherObject)Application.Current).Dispatcher.Invoke((Action)delegate + { + Gestor.Application.Actions.Actions.AtualizaBadges(); + }); + return fases; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)269, tries, fases); + } + } + return fasesOriginal; + }); + } + + public async Task> Salvar(List tarefas) + { + int tries = 3; + base.Sucesso = true; + DateTime now = Funcoes.GetNetworkTime(); + List tarefasOriginal = tarefas; + return await Task.Run(delegate + { + //IL_0052: Unknown result type (might be due to invalid IL or missing references) + //IL_0057: Unknown result type (might be due to invalid IL or missing references) + //IL_005e: Unknown result type (might be due to invalid IL or missing references) + //IL_0069: Unknown result type (might be due to invalid IL or missing references) + //IL_0075: Unknown result type (might be due to invalid IL or missing references) + //IL_0077: Unknown result type (might be due to invalid IL or missing references) + //IL_007c: Unknown result type (might be due to invalid IL or missing references) + //IL_0088: Expected O, but got Unknown + //IL_008d: Unknown result type (might be due to invalid IL or missing references) + //IL_0099: Unknown result type (might be due to invalid IL or missing references) + //IL_00a0: Unknown result type (might be due to invalid IL or missing references) + //IL_00ab: Unknown result type (might be due to invalid IL or missing references) + //IL_00b6: Unknown result type (might be due to invalid IL or missing references) + //IL_00c1: Unknown result type (might be due to invalid IL or missing references) + //IL_00ff: Expected O, but got Unknown + while (tries > 0) + { + tarefas = tarefasOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + tarefas = commited.TarefaRepository.Salvar(tarefas); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + foreach (Tarefa tarefa in tarefas) + { + RegistroLog keyValues = new RegistroLog + { + Acao = (TipoAcao)1, + Usuario = Recursos.Usuario, + DataHora = now, + Descricao = JsonConvert.SerializeObject((object)tarefa, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)tarefa).Id, + Tela = (TipoTela)4, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, commited); + } + ((GenericUnitOfWork)commited).Commit(); + ((DispatcherObject)Application.Current).Dispatcher.Invoke((Action)delegate + { + Gestor.Application.Actions.Actions.AtualizaBadges(); + }); + return tarefas; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)265, tries, tarefas); + } + } + return tarefasOriginal; + }); + } + + public async Task> Validar(List ids, long trilhaId) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork commited = Instancia.Commited; + try + { + return commited.TarefaRepository.Validar(ids, trilhaId); + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)266, tries, new { ids, trilhaId }); + } + } + return (List)null; + }); + } + + public async Task BuscarTarefa(long id) + { + int tries = 3; + return await Task.Run((Func)delegate + { + //IL_0059: Unknown result type (might be due to invalid IL or missing references) + //IL_005f: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.TarefaRepository.BuscarTarefa(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)105, tries, id); + } + } + return new Tarefa(); + }); + } + + public async Task> BuscarTarefasPorTipo(TipoDeTarefa tipoTarefa) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.TarefaRepository.BuscarTarefasPorTipo(((DomainBase)tipoTarefa).Id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)309, tries, new { tipoTarefa }); + } + } + return new List(); + }); + } + + public async Task ExcluirTarefasDocumento(long id) + { + int tries = 3; + return await Task.Run(delegate + { + //IL_0077: Unknown result type (might be due to invalid IL or missing references) + //IL_007c: Unknown result type (might be due to invalid IL or missing references) + //IL_0083: Unknown result type (might be due to invalid IL or missing references) + //IL_008e: Unknown result type (might be due to invalid IL or missing references) + //IL_0099: Unknown result type (might be due to invalid IL or missing references) + //IL_009b: Unknown result type (might be due to invalid IL or missing references) + //IL_00a0: Unknown result type (might be due to invalid IL or missing references) + //IL_00ac: Expected O, but got Unknown + //IL_00b1: Unknown result type (might be due to invalid IL or missing references) + //IL_00bd: Unknown result type (might be due to invalid IL or missing references) + //IL_00c4: Unknown result type (might be due to invalid IL or missing references) + //IL_00cf: Unknown result type (might be due to invalid IL or missing references) + //IL_00da: Unknown result type (might be due to invalid IL or missing references) + //IL_00e5: Unknown result type (might be due to invalid IL or missing references) + //IL_0124: Expected O, but got Unknown + while (tries > 0) + { + try + { + List list = new List(); + UnitOfWork read = Instancia.Read; + try + { + list = read.TarefaRepository.BuscarTarefa((TipoTarefa)0, id, (bool?)false); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + foreach (Tarefa item in list) + { + UnitOfWork commited = Instancia.Commited; + try + { + commited.TarefaRepository.Excluir(((DomainBase)item).Id); + ((GenericUnitOfWork)commited).Commit(); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog keyValues = new RegistroLog + { + Acao = (TipoAcao)1, + Usuario = Recursos.Usuario, + DataHora = DateTime.Now, + Descricao = JsonConvert.SerializeObject((object)item, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)item).Id, + Tela = (TipoTela)4, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, commited); + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + ((DispatcherObject)Application.Current).Dispatcher.Invoke((Action)delegate + { + Gestor.Application.Actions.Actions.AtualizaBadges(); + }); + return true; + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)268, tries, id); + } + } + return false; + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos/VendedorUsuarioServico.cs b/Decompiler/Gestor.Application.Servicos/VendedorUsuarioServico.cs new file mode 100644 index 0000000..b73e0aa --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos/VendedorUsuarioServico.cs @@ -0,0 +1,175 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Servicos; + +public class VendedorUsuarioServico : BaseServico +{ + public async Task> FindByVinculo(Usuario usuario) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.VendedorUsuarioRepository.FindByVinculo(((DomainBase)usuario).Id).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)106, tries, usuario); + } + } + return new List(); + }); + } + + public async Task> SaveOrUpdate(List vinculo) + { + int tries = 3; + base.Sucesso = true; + List vinculoOriginal = vinculo; + return await Task.Run(delegate + { + while (tries > 0) + { + vinculo = vinculoOriginal; + try + { + UnitOfWork unitOfWork = Instancia.Commited; + try + { + vinculo.ForEach(delegate(VendedorUsuario x) + { + unitOfWork.VendedorUsuarioRepository.SaveOrUpdate(x); + }); + ((GenericUnitOfWork)unitOfWork).Commit(); + } + finally + { + if (unitOfWork != null) + { + ((IDisposable)unitOfWork).Dispose(); + } + } + return vinculo; + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)271, tries, vinculo); + } + } + return vinculoOriginal; + }); + } + + public async Task Delete(List vinculo) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork unitOfWork = Instancia.Commited; + try + { + vinculo.ForEach(delegate(VendedorUsuario x) + { + unitOfWork.VendedorUsuarioRepository.Delete(((DomainBase)x).Id); + }); + ((GenericUnitOfWork)unitOfWork).Commit(); + } + finally + { + if (unitOfWork != null) + { + ((IDisposable)unitOfWork).Dispose(); + } + } + return true; + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)272, tries, vinculo); + } + } + return false; + }); + } + + public async Task FindVinculo(Vendedor vendedor) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.VendedorUsuarioRepository.Exist(((DomainBase)vendedor).Id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)271, tries, vendedor); + } + } + return false; + }); + } + + public async Task FindVinculoByUsuario(long idusuario) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.VendedorUsuarioRepository.ExistVinculoUsuario(idusuario); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)106, tries); + } + } + return false; + }); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.BI/BISeriesViewModel.cs b/Decompiler/Gestor.Application.ViewModels.BI/BISeriesViewModel.cs new file mode 100644 index 0000000..edeae96 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.BI/BISeriesViewModel.cs @@ -0,0 +1,61 @@ +using Gestor.Application.ViewModels.Generic; +using LiveCharts; + +namespace Gestor.Application.ViewModels.BI; + +public class BISeriesViewModel : BaseSegurosViewModel +{ + private int _indice; + + private string _titulo; + + private SeriesCollection _serie; + + public int Indice + { + get + { + return _indice; + } + set + { + if (_indice != value) + { + _indice = value; + OnPropertyChanged("Indice"); + } + } + } + + public string Titulo + { + get + { + return _titulo; + } + set + { + if (!(_titulo == value)) + { + _titulo = value; + OnPropertyChanged("Titulo"); + } + } + } + + public SeriesCollection Serie + { + get + { + return _serie; + } + set + { + if (_serie != value) + { + _serie = value; + OnPropertyChanged("Serie"); + } + } + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.BI/NotasViewModel.cs b/Decompiler/Gestor.Application.ViewModels.BI/NotasViewModel.cs new file mode 100644 index 0000000..7023c98 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.BI/NotasViewModel.cs @@ -0,0 +1,265 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.BI; + +public class NotasViewModel : BaseSegurosViewModel +{ + private readonly TarefaServico _servico; + + private bool _enableIncluirNota = true; + + private bool _ocultarUsuarios; + + private ObservableCollection _usuarios; + + private Usuario _selectedUsuario; + + private Tarefa _tarefa; + + private ObservableCollection _notas; + + private ObservableCollection _notasConcluidas; + + private Tarefa _selectedNota; + + private bool _ocultarNotasConcluidas = true; + + public bool EnableIncluirNota + { + get + { + return _enableIncluirNota; + } + set + { + _enableIncluirNota = value; + OnPropertyChanged("EnableIncluirNota"); + } + } + + public bool OcultarUsuarios + { + get + { + return _ocultarUsuarios; + } + set + { + _ocultarUsuarios = value; + OnPropertyChanged("OcultarUsuarios"); + } + } + + public ObservableCollection Usuarios + { + get + { + return _usuarios; + } + set + { + _usuarios = value; + OnPropertyChanged("Usuarios"); + } + } + + public Usuario SelectedUsuario + { + get + { + return _selectedUsuario; + } + set + { + _selectedUsuario = value; + Carregar(); + OnPropertyChanged("SelectedUsuario"); + } + } + + public Tarefa Tarefa + { + get + { + return _tarefa; + } + set + { + _tarefa = value; + OnPropertyChanged("Tarefa"); + } + } + + public ObservableCollection Notas + { + get + { + return _notas; + } + set + { + _notas = value; + OnPropertyChanged("Notas"); + } + } + + public ObservableCollection NotasConcluidas + { + get + { + return _notasConcluidas; + } + set + { + _notasConcluidas = value; + OnPropertyChanged("NotasConcluidas"); + } + } + + public Tarefa SelectedNota + { + get + { + return _selectedNota; + } + set + { + _selectedNota = value; + OnPropertyChanged("SelectedNota"); + } + } + + public bool OcultarNotasConcluidas + { + get + { + return _ocultarNotasConcluidas; + } + set + { + _ocultarNotasConcluidas = value; + OnPropertyChanged("OcultarNotasConcluidas"); + } + } + + public NotasViewModel() + { + _servico = new TarefaServico(); + Usuarios = new ObservableCollection((from x in Recursos.Usuarios + where (Recursos.Usuario.IdEmpresa == 1 || x.IdEmpresa == Recursos.Usuario.IdEmpresa) && !x.Excluido + orderby x.Nome + select x).ToList()); + SelectedUsuario = ((IEnumerable)Usuarios).FirstOrDefault((Func)((Usuario x) => ((DomainBase)x).Id == ((DomainBase)Recursos.Usuario).Id)); + Usuario usuario = Recursos.Usuario; + OcultarUsuarios = usuario != null && usuario.Administrador; + Usuario usuario2 = Recursos.Usuario; + EnableIncluirNota = usuario2 != null && ((DomainBase)usuario2).Id > 0; + } + + public async void Carregar() + { + await CarregarNotas(); + } + + public async Task CarregarNotas() + { + if (SelectedUsuario == null) + { + return; + } + List list = await _servico.BuscarNotas(((DomainBase)SelectedUsuario).Id); + list.ForEach(delegate(Tarefa x) + { + if (x.Titulo == "TÍTULO" && x.Descricao == "DESCRIÇÃO") + { + x.HabilitarPublica = true; + } + }); + Notas = new ObservableCollection(list); + NotasConcluidas = new ObservableCollection(await _servico.BuscarNotasConcluidas(((DomainBase)SelectedUsuario).Id)); + } + + public async Task AdicionarNota() + { + if (Notas != null && Notas.Any((Tarefa x) => x.Titulo == "TÍTULO" && x.Descricao == "DESCRIÇÃO")) + { + await ShowMessage("PARA ADICIONAR OUTRA NOTA, INSERIR TÍTULO E DESCRIÇÃO DA NOTA JÁ ADICIONADA"); + return; + } + Tarefa nota2 = new Tarefa + { + Agendamento = Funcoes.GetNetworkTime(), + Titulo = "TÍTULO", + Anotacoes = "DESCRIÇÃO", + Usuario = Usuarios.First((Usuario x) => ((DomainBase)x).Id == ((DomainBase)SelectedUsuario).Id), + UsuarioCadastro = Recursos.Usuario, + Entidade = (TipoTarefa)1, + Status = (StatusTarefa)0 + }; + nota2 = await _servico.Salvar(nota2); + await CarregarNotas(); + SelectedNota = nota2; + } + + public async Task SalvarNota(Tarefa nota) + { + return await _servico.Salvar(nota); + } + + public async Task>> Salvar(Tarefa destino) + { + destino.AgendamentoRetroativo = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 45); + List> list = destino.Validate(); + if (list.Count > 0) + { + return list; + } + bool publica = destino.Publica; + await _servico.Salvar(destino); + if (!_servico.Sucesso) + { + return null; + } + if (publica) + { + long id = ((DomainBase)destino.Usuario).Id; + List usuarios = Recursos.Usuarios; + List list2 = new List(); + foreach (Usuario item in usuarios) + { + if (id != ((DomainBase)item).Id) + { + Tarefa val = (Tarefa)((DomainBase)destino).Clone(); + ((DomainBase)val).Id = 0L; + val.Usuario = item; + list2.Add(_servico.Salvar(val)); + } + } + await Task.WhenAll(list2); + } + await CarregarNotas(); + return null; + } + + public void ToggleNotasConcluidas() + { + OcultarNotasConcluidas = !OcultarNotasConcluidas; + } + + public async Task ExcluirNota(Tarefa nota) + { + await _servico.Excluir(((DomainBase)nota).Id); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.BI/PainelBiViewModel.cs b/Decompiler/Gestor.Application.ViewModels.BI/PainelBiViewModel.cs new file mode 100644 index 0000000..2a12cda --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.BI/PainelBiViewModel.cs @@ -0,0 +1,1563 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using Gestor.Application.Componentes; +using Gestor.Application.Helpers; +using Gestor.Application.Model; +using Gestor.Application.Servicos; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.ViewModels.Generic; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.BI; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Relatorios; +using Gestor.Model.Domain.Relatorios.ClientesAtivosInativos; +using Gestor.Model.Domain.Seguros; +using LiveCharts; +using LiveCharts.Defaults; +using LiveCharts.Definitions.Series; +using LiveCharts.Helpers; +using LiveCharts.Wpf; + +namespace Gestor.Application.ViewModels.BI; + +public class PainelBiViewModel : BaseSegurosViewModel +{ + private readonly ClienteServico _clienteServico; + + private readonly ApoliceServico _apoliceServico; + + private readonly ParcelaServico _parcelaServico; + + private Visibility _isVisibleProducao = (Visibility)2; + + private Visibility _isVisibleClientes = (Visibility)2; + + private Visibility _isVisiblePendencia = (Visibility)2; + + private Visibility _isVisibleVencimento = (Visibility)2; + + private DateTime _inicio = Funcoes.GetNetworkTime().Date.AddDays(-7.0); + + private DateTime _fim = Funcoes.GetNetworkTime().Date; + + private DateTime _inicioClientes = Funcoes.GetNetworkTime().Date.AddDays(-7.0); + + private DateTime _fimClientes = Funcoes.GetNetworkTime().Date; + + private DateTime _inicioVencimento = Funcoes.GetNetworkTime().Date; + + private DateTime _fimVencimento = Funcoes.GetNetworkTime().Date.AddDays(7.0); + + private Grafico _producao; + + private Grafico _fechamento; + + private int _aniversariantes; + + private int _vencimentoCnh; + + private int _vencimentos; + + private int _parcelasPendentes; + + private int _parcelasAVencer; + + private int _cotacoes; + + private List _parcelasPendencia; + + private List _parcelasVencimento; + + private List _documentosVencimento; + + private List _clientesAniversariantes; + + private List _clientesCnh; + + private int _quatidadeProducao; + + private int _endossos; + + private int _faturas; + + private int _apolicesPendentes; + + private int _novosNegocios; + + private int _renovacoes; + + private int _cancelamentos; + + private decimal _producaoTotal; + + private decimal _producaoTotalAnterior; + + private decimal _comissaoTotal; + + private List _documentosProducao; + + private List _documentosPendentes; + + private List _documentosFechamento; + + private Grafico _gerada; + + private Grafico _mediaComissao; + + private Func _yFormatter; + + private Func _xFormatter; + + public Visibility IsVisibleProducao + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _isVisibleProducao; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _isVisibleProducao = value; + OnPropertyChanged("IsVisibleProducao"); + } + } + + public Visibility IsVisibleClientes + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _isVisibleClientes; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _isVisibleClientes = value; + OnPropertyChanged("IsVisibleClientes"); + } + } + + public Visibility IsVisiblePendencia + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _isVisiblePendencia; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _isVisiblePendencia = value; + OnPropertyChanged("IsVisiblePendencia"); + } + } + + public Visibility IsVisibleVencimento + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _isVisibleVencimento; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _isVisibleVencimento = value; + OnPropertyChanged("IsVisibleVencimento"); + } + } + + public DateTime Inicio + { + get + { + return _inicio; + } + set + { + _inicio = value; + OnPropertyChanged("Inicio"); + } + } + + public DateTime Fim + { + get + { + return _fim; + } + set + { + _fim = value; + OnPropertyChanged("Fim"); + } + } + + public DateTime InicioClientes + { + get + { + return _inicioClientes; + } + set + { + _inicioClientes = value; + OnPropertyChanged("InicioClientes"); + } + } + + public DateTime FimClientes + { + get + { + return _fimClientes; + } + set + { + _fimClientes = value; + OnPropertyChanged("FimClientes"); + } + } + + public DateTime InicioVencimento + { + get + { + return _inicioVencimento; + } + set + { + _inicioVencimento = value; + OnPropertyChanged("InicioVencimento"); + } + } + + public DateTime FimVencimento + { + get + { + return _fimVencimento; + } + set + { + _fimVencimento = value; + OnPropertyChanged("FimVencimento"); + } + } + + public Grafico Producao + { + get + { + return _producao; + } + set + { + _producao = value; + OnPropertyChanged("Producao"); + } + } + + public Grafico Fechamento + { + get + { + return _fechamento; + } + set + { + _fechamento = value; + OnPropertyChanged("Fechamento"); + } + } + + public int Aniversariantes + { + get + { + return _aniversariantes; + } + set + { + _aniversariantes = value; + OnPropertyChanged("Aniversariantes"); + } + } + + public int VencimentoCnh + { + get + { + return _vencimentoCnh; + } + set + { + _vencimentoCnh = value; + OnPropertyChanged("VencimentoCnh"); + } + } + + public int Vencimentos + { + get + { + return _vencimentos; + } + set + { + _vencimentos = value; + OnPropertyChanged("Vencimentos"); + } + } + + public int ParcelasPendentes + { + get + { + return _parcelasPendentes; + } + set + { + _parcelasPendentes = value; + OnPropertyChanged("ParcelasPendentes"); + } + } + + public int ParcelasAVencer + { + get + { + return _parcelasAVencer; + } + set + { + _parcelasAVencer = value; + OnPropertyChanged("ParcelasAVencer"); + } + } + + public int Cotacoes + { + get + { + return _cotacoes; + } + set + { + _cotacoes = value; + OnPropertyChanged("Cotacoes"); + } + } + + public int QuatidadeProducao + { + get + { + return _quatidadeProducao; + } + set + { + _quatidadeProducao = value; + OnPropertyChanged("QuatidadeProducao"); + } + } + + public int Endossos + { + get + { + return _endossos; + } + set + { + _endossos = value; + OnPropertyChanged("Endossos"); + } + } + + public int Faturas + { + get + { + return _faturas; + } + set + { + _faturas = value; + OnPropertyChanged("Faturas"); + } + } + + public int ApolicesPendentes + { + get + { + return _apolicesPendentes; + } + set + { + _apolicesPendentes = value; + OnPropertyChanged("ApolicesPendentes"); + } + } + + public int NovosNegocios + { + get + { + return _novosNegocios; + } + set + { + _novosNegocios = value; + OnPropertyChanged("NovosNegocios"); + } + } + + public int Renovacoes + { + get + { + return _renovacoes; + } + set + { + _renovacoes = value; + OnPropertyChanged("Renovacoes"); + } + } + + public int Cancelamentos + { + get + { + return _cancelamentos; + } + set + { + _cancelamentos = value; + OnPropertyChanged("Cancelamentos"); + } + } + + public decimal ProducaoTotal + { + get + { + return _producaoTotal; + } + set + { + _producaoTotal = value; + OnPropertyChanged("ProducaoTotal"); + } + } + + public decimal ProducaoTotalAnterior + { + get + { + return _producaoTotalAnterior; + } + set + { + _producaoTotalAnterior = value; + OnPropertyChanged("ProducaoTotalAnterior"); + } + } + + public decimal ComissaoTotal + { + get + { + return _comissaoTotal; + } + set + { + _comissaoTotal = value; + OnPropertyChanged("ComissaoTotal"); + } + } + + public Grafico Gerada + { + get + { + return _gerada; + } + set + { + _gerada = value; + OnPropertyChanged("Gerada"); + } + } + + public Grafico MediaComissao + { + get + { + return _mediaComissao; + } + set + { + _mediaComissao = value; + OnPropertyChanged("MediaComissao"); + } + } + + public Func YFormatter + { + get + { + return _yFormatter; + } + set + { + _yFormatter = value; + OnPropertyChanged("YFormatter"); + } + } + + public Func XFormatter + { + get + { + return _xFormatter; + } + set + { + _xFormatter = value; + OnPropertyChanged("XFormatter"); + } + } + + public PainelBiViewModel() + { + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + //IL_0009: Unknown result type (might be due to invalid IL or missing references) + //IL_0010: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + _clienteServico = new ClienteServico(); + _apoliceServico = new ApoliceServico(); + _parcelaServico = new ParcelaServico(); + LoadInicial(); + } + + private async void LoadInicial() + { + await GerarProducao(); + await GerarVencimento(); + await GerarClientes(); + } + + public async Task GerarClientes() + { + IsVisibleClientes = (Visibility)2; + Filtros filtro = new Filtros + { + Inicio = InicioClientes, + Fim = FimClientes, + IdEmpresa = ((Recursos.Usuario.IdEmpresa == 1) ? 0 : Recursos.Usuario.IdEmpresa) + }; + _clientesAniversariantes = await _clienteServico.BuscarAniversariantes(filtro); + Aniversariantes = _clientesAniversariantes.Count; + _clientesCnh = await _clienteServico.BuscarVencimentosCnh(filtro); + VencimentoCnh = _clientesCnh.Count; + IsVisibleClientes = (Visibility)0; + } + + public async Task GerarVencimento() + { + IsVisibleVencimento = (Visibility)2; + List source = await new VendedorUsuarioServico().FindByVinculo(Recursos.Usuario); + Filtros filtro = new Filtros + { + Inicio = InicioVencimento, + Fim = FimVencimento, + IdEmpresa = ((Recursos.Usuario.IdEmpresa == 1) ? 0 : Recursos.Usuario.IdEmpresa), + Vendedores = source.Select((VendedorUsuario x) => ((DomainBase)x.Vendedor).Id).ToList() + }; + _documentosVencimento = (await _apoliceServico.BuscarApolicesVigenciaFinal(filtro)).Where((Documento x) => (int)x.Situacao != 7).ToList(); + Vencimentos = _documentosVencimento.Count; + _parcelasVencimento = (await _parcelaServico.BuscarParcelas(filtro)).Where((Parcela x) => (int)x.Documento.Situacao != 7).ToList(); + ParcelasAVencer = _parcelasVencimento.Count; + IsVisibleVencimento = (Visibility)0; + } + + public async Task GerarPendencia() + { + IsVisiblePendencia = (Visibility)2; + List source = await new VendedorUsuarioServico().FindByVinculo(Recursos.Usuario); + Filtros filtro = new Filtros + { + Inicio = Inicio, + Fim = Fim, + IdEmpresa = ((Recursos.Usuario.IdEmpresa == 1) ? 0 : Recursos.Usuario.IdEmpresa), + Vendedores = source.Select((VendedorUsuario x) => ((DomainBase)x.Vendedor).Id).ToList() + }; + _parcelasPendencia = (await _parcelaServico.BuscarParcelasPendentes(filtro)).Where((Parcela x) => (int)x.Documento.Situacao != 7).ToList(); + ParcelasPendentes = _parcelasPendencia.Count; + IsVisiblePendencia = (Visibility)0; + } + + public async Task GerarProducao() + { + IsVisibleProducao = (Visibility)2; + Producao = new Grafico + { + Series = new SeriesCollection(), + Formatter = (double value) => value.ToString("C0") + }; + Gerada = new Grafico + { + Series = new SeriesCollection(), + Formatter = (double value) => value.ToString("C2") + }; + MediaComissao = new Grafico + { + Series = new SeriesCollection(), + Formatter = (double value) => value.ToString("P2") + }; + Fechamento = new Grafico + { + Series = new SeriesCollection(), + Formatter = (double value) => value.ToString("C2") + }; + List source = await new VendedorUsuarioServico().FindByVinculo(Recursos.Usuario); + Filtros filtro = new Filtros + { + Inicio = Inicio, + Fim = Fim, + IdEmpresa = ((Recursos.Usuario.IdEmpresa == 1) ? 0 : Recursos.Usuario.IdEmpresa), + Vendedores = source.Select((VendedorUsuario x) => ((DomainBase)x.Vendedor).Id).ToList() + }; + Filtros filtroFechamento = new Filtros + { + Inicio = Inicio.AddYears(-1), + Fim = Fim.AddYears(-1), + IdEmpresa = ((Recursos.Usuario.IdEmpresa == 1) ? 0 : Recursos.Usuario.IdEmpresa), + Vendedores = source.Select((VendedorUsuario x) => ((DomainBase)x.Vendedor).Id).ToList() + }; + _documentosProducao = (await _apoliceServico.BuscarApolices(filtro, buscarAssinatura: false, painelBi: true)).Where((Documento x) => (int)x.Situacao != 7).ToList(); + _documentosPendentes = await _apoliceServico.BuscarApolicesPendentes(filtro); + List source2 = await _parcelaServico.BuscarFaturas(filtro, buscaAssinaturas: false, painelBi: true); + _documentosProducao.AddRange(source2.Where((Documento x) => (int)x.Situacao != 7)); + ApolicesPendentes = _documentosPendentes.Count((Documento x) => string.IsNullOrEmpty(x.Apolice) && x.Tipo != 2); + await GerarPendencia(); + _documentosFechamento = (await _apoliceServico.BuscarApolices(filtroFechamento, buscarAssinatura: false, painelBi: true)).Where((Documento x) => (int)x.Situacao != 7).ToList(); + List source3 = await _parcelaServico.BuscarFaturas(filtroFechamento, buscaAssinaturas: false, painelBi: true); + _documentosFechamento.AddRange(source3.Where((Documento x) => (int)x.Situacao != 7)); + Cotacoes = await _apoliceServico.Cotacoes(filtro); + QuatidadeProducao = _documentosProducao.Count((Documento x) => x.Tipo != 2); + Faturas = _documentosProducao.Count((Documento x) => x.Tipo == 2); + NovosNegocios = _documentosProducao.Count((Documento x) => x.Tipo == 0 && ((int)x.Situacao == 1 || ((int)x.Situacao == 2 && x.NegocioCorretora == (NegocioCorretora?)0))); + Renovacoes = _documentosProducao.Count((Documento x) => x.Tipo == 0 && (int)x.Situacao == 2 && ((int)x.NegocioCorretora.GetValueOrDefault() == 1 || (int)x.Negocio.GetValueOrDefault() == 1)); + Cancelamentos = (from x in _documentosProducao + where (int)x.Situacao == 3 && x.Tipo == 1 + select ((DomainBase)x.Controle).Id).Distinct().Count(); + Endossos = _documentosProducao.Count((Documento x) => x.Tipo == 1); + ProducaoTotal = _documentosProducao.Sum((Documento x) => x.PremioLiquido); + ProducaoTotalAnterior = _documentosFechamento.Sum((Documento x) => x.PremioLiquido); + ComissaoTotal = _documentosProducao.Sum((Documento x) => (x.PremioLiquido + (x.AdicionalComiss ? x.PremioAdicional : 0m)) * x.Comissao * 0.01m); + (from x in _documentosProducao + group x by x.Controle.Seguradora.NomeSocial into x + orderby x.Sum((Documento p) => p.PremioLiquido) descending + select x).ToList().ForEach(delegate(IGrouping x) + { + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Unknown result type (might be due to invalid IL or missing references) + //IL_0023: Unknown result type (might be due to invalid IL or missing references) + //IL_005e: Unknown result type (might be due to invalid IL or missing references) + //IL_0070: Unknown result type (might be due to invalid IL or missing references) + //IL_0080: Expected O, but got Unknown + //IL_00c1: Unknown result type (might be due to invalid IL or missing references) + //IL_00c6: Unknown result type (might be due to invalid IL or missing references) + //IL_00d7: Unknown result type (might be due to invalid IL or missing references) + //IL_0112: Unknown result type (might be due to invalid IL or missing references) + //IL_0119: Unknown result type (might be due to invalid IL or missing references) + //IL_012c: Expected O, but got Unknown + //IL_0188: Unknown result type (might be due to invalid IL or missing references) + //IL_018d: Unknown result type (might be due to invalid IL or missing references) + //IL_019e: Unknown result type (might be due to invalid IL or missing references) + //IL_01b5: Unknown result type (might be due to invalid IL or missing references) + //IL_01bc: Unknown result type (might be due to invalid IL or missing references) + //IL_01cf: Expected O, but got Unknown + ColumnSeries val6 = new ColumnSeries + { + Title = x.Key + }; + ChartValues obj = new ChartValues(); + ((NoisyCollection)(object)obj).Add(x.Sum((Documento p) => p.PremioLiquido)); + ((Series)val6).Values = (IChartValues)(object)obj; + ((Series)val6).LabelPoint = (ChartPoint chartPoint) => "R$ " + x.Sum((Documento p) => p.PremioLiquido).ToString("N2"); + val6.MaxColumnWidth = double.PositiveInfinity; + ColumnSeries val7 = val6; + ((NoisyCollection)(object)Producao.Series).Add((ISeriesView)(object)val7); + decimal comissaoGerada = x.Sum((Documento p) => (p.PremioLiquido + (p.AdicionalComiss ? p.PremioAdicional : 0m)) * p.Comissao * 0.01m); + PieSeries val8 = new PieSeries + { + Title = x.Key + }; + ChartValues obj2 = new ChartValues(); + ((NoisyCollection)(object)obj2).Add((comissaoGerada > 0m) ? comissaoGerada : (comissaoGerada * -1m)); + ((Series)val8).Values = (IChartValues)(object)obj2; + ((Series)val8).DataLabels = false; + ((Series)val8).LabelPoint = (ChartPoint chartPoint) => "R$ " + comissaoGerada.ToString("N2"); + PieSeries val9 = val8; + ((NoisyCollection)(object)Gerada.Series).Add((ISeriesView)(object)val9); + decimal mediaComissao = Math.Round(x.Sum((Documento p) => p.Comissao) / (decimal)x.Count(), 2); + PieSeries val10 = new PieSeries + { + Title = x.Key + }; + ChartValues obj3 = new ChartValues(); + ((NoisyCollection)(object)obj3).Add(mediaComissao); + ((Series)val10).Values = (IChartValues)(object)obj3; + ((Series)val10).DataLabels = false; + ((Series)val10).LabelPoint = (ChartPoint chartPoint) => $" Media de Comissão {mediaComissao}% "; + PieSeries val11 = val10; + ((NoisyCollection)(object)MediaComissao.Series).Add((ISeriesView)(object)val11); + }); + double totalDays = (filtro.Fim - filtro.Inicio).TotalDays; + ChartValues val2 = new ChartValues(); + ChartValues val3 = new ChartValues(); + for (int i = 0; (double)i <= totalDays; i++) + { + DateTime dateProc = filtro.Inicio.AddDays(i); + DateTime dateProcAnterior = dateProc.AddYears(-1); + decimal num = _documentosFechamento.Where((Documento s) => s.Vigencia1 == dateProcAnterior).Sum((Documento s) => s.PremioLiquido); + decimal num2 = _documentosProducao.Where((Documento s) => s.Vigencia1 == dateProc).Sum((Documento s) => s.PremioLiquido); + ((NoisyCollection)(object)val2).Add(new DateTimePoint(dateProc, (double)num)); + ((NoisyCollection)(object)val3).Add(new DateTimePoint(dateProc, (double)num2)); + } + LineSeries val4 = new LineSeries + { + Title = $"{filtroFechamento.Inicio.Year}", + Values = (IChartValues)(object)val2 + }; + LineSeries val5 = new LineSeries + { + Title = $"{filtro.Inicio.Year}", + Values = (IChartValues)(object)val3 + }; + ((NoisyCollection)(object)Fechamento.Series).Add((ISeriesView)(object)val4); + ((NoisyCollection)(object)Fechamento.Series).Add((ISeriesView)(object)val5); + XFormatter = (double val) => new DateTime((long)val).ToString("dd/MM"); + YFormatter = (double val) => val.ToString("C2"); + IsVisibleProducao = (Visibility)0; + } + + public async void Detalhar(int tipo) + { + string titulo = ""; + string tipo2 = "APOLICES"; + List campos = new List + { + "Nome", "Apolice", "Endosso", "Status", "Negocio", "VigenciaInicial", "VigenciaFinal", "Comissao", "PremioLiquido", "PremioTotal", + "Seguradora", "Ramo" + }; + List list; + switch (tipo) + { + default: + titulo = "PRODUÇÃO"; + list = ((IEnumerable)_documentosProducao).Select((Func)delegate(Documento x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_0039: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_005a: Unknown result type (might be due to invalid IL or missing references) + //IL_00af: Unknown result type (might be due to invalid IL or missing references) + //IL_00bb: Unknown result type (might be due to invalid IL or missing references) + //IL_00c7: Unknown result type (might be due to invalid IL or missing references) + //IL_00d3: Unknown result type (might be due to invalid IL or missing references) + //IL_00df: Unknown result type (might be due to invalid IL or missing references) + //IL_00e1: Unknown result type (might be due to invalid IL or missing references) + //IL_0080: Unknown result type (might be due to invalid IL or missing references) + //IL_00fe: Unknown result type (might be due to invalid IL or missing references) + //IL_0114: Unknown result type (might be due to invalid IL or missing references) + //IL_012a: Unknown result type (might be due to invalid IL or missing references) + //IL_012b: Unknown result type (might be due to invalid IL or missing references) + //IL_0130: Unknown result type (might be due to invalid IL or missing references) + //IL_0146: Unknown result type (might be due to invalid IL or missing references) + //IL_0161: Expected O, but got Unknown + //IL_0161: Unknown result type (might be due to invalid IL or missing references) + //IL_0169: Expected O, but got Unknown + Analitico val3 = new Analitico + { + Nome = (x.Controle.Cliente.Nome ?? ""), + Apolice = (x.Apolice ?? ""), + Endosso = (x.Endosso ?? ""), + Comissao = x.Comissao + }; + object negocio3; + if (x.NegocioCorretora.HasValue) + { + NegocioCorretora? negocioCorretora3 = x.NegocioCorretora; + negocio3 = (negocioCorretora3.HasValue ? ValidationHelper.GetDescription((Enum)(object)negocioCorretora3.GetValueOrDefault()) : null) ?? ""; + } + else + { + negocio3 = ValidationHelper.GetDescription((Enum)(object)x.Negocio); + } + val3.Negocio = (string)negocio3; + val3.PremioLiquido = x.PremioLiquido; + val3.PremioTotal = x.PremioTotal; + val3.VigenciaFinal = x.Vigencia2; + val3.VigenciaInicial = x.Vigencia1; + val3.Status = ValidationHelper.GetDescription((Enum)(object)x.Situacao) ?? ""; + val3.Seguradora = x.Controle.Seguradora.NomeSocial; + val3.Ramo = x.Controle.Ramo.Nome; + val3.Cliente = new ClientesAtivosInativos + { + Id = ((DomainBase)x.Controle.Cliente).Id, + Nome = x.Controle.Cliente.Nome + }; + val3.Documento = x; + return val3; + }).ToList(); + break; + case 1: + { + titulo = "COMPARATIVO"; + List documentosProducao = _documentosProducao; + List documentosFechamento = _documentosFechamento; + List list2 = new List(); + list2.AddRange(documentosProducao); + list2.AddRange(documentosFechamento); + list = ((IEnumerable)list2.OrderBy((Documento x) => x.Vigencia1)).Select((Func)delegate(Documento x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_0039: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_005a: Unknown result type (might be due to invalid IL or missing references) + //IL_00af: Unknown result type (might be due to invalid IL or missing references) + //IL_00bb: Unknown result type (might be due to invalid IL or missing references) + //IL_00c7: Unknown result type (might be due to invalid IL or missing references) + //IL_00d3: Unknown result type (might be due to invalid IL or missing references) + //IL_00df: Unknown result type (might be due to invalid IL or missing references) + //IL_00e1: Unknown result type (might be due to invalid IL or missing references) + //IL_0080: Unknown result type (might be due to invalid IL or missing references) + //IL_00fe: Unknown result type (might be due to invalid IL or missing references) + //IL_0114: Unknown result type (might be due to invalid IL or missing references) + //IL_012a: Unknown result type (might be due to invalid IL or missing references) + //IL_012b: Unknown result type (might be due to invalid IL or missing references) + //IL_0130: Unknown result type (might be due to invalid IL or missing references) + //IL_0146: Unknown result type (might be due to invalid IL or missing references) + //IL_0161: Expected O, but got Unknown + //IL_0161: Unknown result type (might be due to invalid IL or missing references) + //IL_0169: Expected O, but got Unknown + Analitico val10 = new Analitico + { + Nome = (x.Controle.Cliente.Nome ?? ""), + Apolice = (x.Apolice ?? ""), + Endosso = (x.Endosso ?? ""), + Comissao = x.Comissao + }; + object negocio10; + if (x.NegocioCorretora.HasValue) + { + NegocioCorretora? negocioCorretora10 = x.NegocioCorretora; + negocio10 = (negocioCorretora10.HasValue ? ValidationHelper.GetDescription((Enum)(object)negocioCorretora10.GetValueOrDefault()) : null) ?? ""; + } + else + { + negocio10 = ValidationHelper.GetDescription((Enum)(object)x.Negocio); + } + val10.Negocio = (string)negocio10; + val10.PremioLiquido = x.PremioLiquido; + val10.PremioTotal = x.PremioTotal; + val10.VigenciaFinal = x.Vigencia2; + val10.VigenciaInicial = x.Vigencia1; + val10.Status = ValidationHelper.GetDescription((Enum)(object)x.Situacao) ?? ""; + val10.Seguradora = x.Controle.Seguradora.NomeSocial; + val10.Ramo = x.Controle.Ramo.Nome; + val10.Cliente = new ClientesAtivosInativos + { + Id = ((DomainBase)x.Controle.Cliente).Id, + Nome = x.Controle.Cliente.Nome + }; + val10.Documento = x; + return val10; + }).ToList(); + break; + } + case 2: + titulo = "NOVOS NEGÓCIOS"; + list = ((IEnumerable)(from x in _documentosProducao + where x.Tipo == 0 && ((int)x.Situacao == 1 || ((int)x.Situacao == 2 && x.NegocioCorretora == (NegocioCorretora?)0)) + orderby x.Vigencia1 + select x)).Select((Func)delegate(Documento x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_0039: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_005a: Unknown result type (might be due to invalid IL or missing references) + //IL_00af: Unknown result type (might be due to invalid IL or missing references) + //IL_00bb: Unknown result type (might be due to invalid IL or missing references) + //IL_00c7: Unknown result type (might be due to invalid IL or missing references) + //IL_00d3: Unknown result type (might be due to invalid IL or missing references) + //IL_00df: Unknown result type (might be due to invalid IL or missing references) + //IL_00e1: Unknown result type (might be due to invalid IL or missing references) + //IL_0080: Unknown result type (might be due to invalid IL or missing references) + //IL_00fe: Unknown result type (might be due to invalid IL or missing references) + //IL_0114: Unknown result type (might be due to invalid IL or missing references) + //IL_012a: Unknown result type (might be due to invalid IL or missing references) + //IL_012b: Unknown result type (might be due to invalid IL or missing references) + //IL_0130: Unknown result type (might be due to invalid IL or missing references) + //IL_0146: Unknown result type (might be due to invalid IL or missing references) + //IL_0161: Expected O, but got Unknown + //IL_0161: Unknown result type (might be due to invalid IL or missing references) + //IL_0169: Expected O, but got Unknown + Analitico val8 = new Analitico + { + Nome = (x.Controle.Cliente.Nome ?? ""), + Apolice = (x.Apolice ?? ""), + Endosso = (x.Endosso ?? ""), + Comissao = x.Comissao + }; + object negocio8; + if (x.NegocioCorretora.HasValue) + { + NegocioCorretora? negocioCorretora8 = x.NegocioCorretora; + negocio8 = (negocioCorretora8.HasValue ? ValidationHelper.GetDescription((Enum)(object)negocioCorretora8.GetValueOrDefault()) : null) ?? ""; + } + else + { + negocio8 = ValidationHelper.GetDescription((Enum)(object)x.Negocio); + } + val8.Negocio = (string)negocio8; + val8.PremioLiquido = x.PremioLiquido; + val8.PremioTotal = x.PremioTotal; + val8.VigenciaFinal = x.Vigencia2; + val8.VigenciaInicial = x.Vigencia1; + val8.Status = ValidationHelper.GetDescription((Enum)(object)x.Situacao) ?? ""; + val8.Seguradora = x.Controle.Seguradora.NomeSocial; + val8.Ramo = x.Controle.Ramo.Nome; + val8.Cliente = new ClientesAtivosInativos + { + Id = ((DomainBase)x.Controle.Cliente).Id, + Nome = x.Controle.Cliente.Nome + }; + val8.Documento = x; + return val8; + }).ToList(); + break; + case 3: + titulo = "RENOVAÇÕES"; + list = ((IEnumerable)(from x in _documentosProducao + where x.Tipo == 0 && (int)x.Situacao == 2 && ((int)x.NegocioCorretora.GetValueOrDefault() == 1 || (int)x.Negocio.GetValueOrDefault() == 1) + orderby x.Vigencia1 + select x)).Select((Func)delegate(Documento x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_0039: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_005a: Unknown result type (might be due to invalid IL or missing references) + //IL_00af: Unknown result type (might be due to invalid IL or missing references) + //IL_00bb: Unknown result type (might be due to invalid IL or missing references) + //IL_00c7: Unknown result type (might be due to invalid IL or missing references) + //IL_00d3: Unknown result type (might be due to invalid IL or missing references) + //IL_00df: Unknown result type (might be due to invalid IL or missing references) + //IL_00e1: Unknown result type (might be due to invalid IL or missing references) + //IL_0080: Unknown result type (might be due to invalid IL or missing references) + //IL_00fe: Unknown result type (might be due to invalid IL or missing references) + //IL_0114: Unknown result type (might be due to invalid IL or missing references) + //IL_012a: Unknown result type (might be due to invalid IL or missing references) + //IL_012b: Unknown result type (might be due to invalid IL or missing references) + //IL_0130: Unknown result type (might be due to invalid IL or missing references) + //IL_0146: Unknown result type (might be due to invalid IL or missing references) + //IL_0161: Expected O, but got Unknown + //IL_0161: Unknown result type (might be due to invalid IL or missing references) + //IL_0169: Expected O, but got Unknown + Analitico val6 = new Analitico + { + Nome = (x.Controle.Cliente.Nome ?? ""), + Apolice = (x.Apolice ?? ""), + Endosso = (x.Endosso ?? ""), + Comissao = x.Comissao + }; + object negocio6; + if (x.NegocioCorretora.HasValue) + { + NegocioCorretora? negocioCorretora6 = x.NegocioCorretora; + negocio6 = (negocioCorretora6.HasValue ? ValidationHelper.GetDescription((Enum)(object)negocioCorretora6.GetValueOrDefault()) : null) ?? ""; + } + else + { + negocio6 = ValidationHelper.GetDescription((Enum)(object)x.Negocio); + } + val6.Negocio = (string)negocio6; + val6.PremioLiquido = x.PremioLiquido; + val6.PremioTotal = x.PremioTotal; + val6.VigenciaFinal = x.Vigencia2; + val6.VigenciaInicial = x.Vigencia1; + val6.Status = ValidationHelper.GetDescription((Enum)(object)x.Situacao) ?? ""; + val6.Seguradora = x.Controle.Seguradora.NomeSocial; + val6.Ramo = x.Controle.Ramo.Nome; + val6.Cliente = new ClientesAtivosInativos + { + Id = ((DomainBase)x.Controle.Cliente).Id, + Nome = x.Controle.Cliente.Nome + }; + val6.Documento = x; + return val6; + }).ToList(); + break; + case 4: + titulo = "CANCELAMENTOS"; + list = ((IEnumerable)(from x in _documentosProducao + where (int)x.Situacao == 3 && x.Tipo == 1 + orderby x.Vigencia1 + select x)).Select((Func)delegate(Documento x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_0039: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_005a: Unknown result type (might be due to invalid IL or missing references) + //IL_00af: Unknown result type (might be due to invalid IL or missing references) + //IL_00bb: Unknown result type (might be due to invalid IL or missing references) + //IL_00c7: Unknown result type (might be due to invalid IL or missing references) + //IL_00d3: Unknown result type (might be due to invalid IL or missing references) + //IL_00df: Unknown result type (might be due to invalid IL or missing references) + //IL_00e1: Unknown result type (might be due to invalid IL or missing references) + //IL_0080: Unknown result type (might be due to invalid IL or missing references) + //IL_00fe: Unknown result type (might be due to invalid IL or missing references) + //IL_0114: Unknown result type (might be due to invalid IL or missing references) + //IL_012a: Unknown result type (might be due to invalid IL or missing references) + //IL_012b: Unknown result type (might be due to invalid IL or missing references) + //IL_0130: Unknown result type (might be due to invalid IL or missing references) + //IL_0146: Unknown result type (might be due to invalid IL or missing references) + //IL_0161: Expected O, but got Unknown + //IL_0161: Unknown result type (might be due to invalid IL or missing references) + //IL_0169: Expected O, but got Unknown + Analitico val4 = new Analitico + { + Nome = (x.Controle.Cliente.Nome ?? ""), + Apolice = (x.Apolice ?? ""), + Endosso = (x.Endosso ?? ""), + Comissao = x.Comissao + }; + object negocio4; + if (x.NegocioCorretora.HasValue) + { + NegocioCorretora? negocioCorretora4 = x.NegocioCorretora; + negocio4 = (negocioCorretora4.HasValue ? ValidationHelper.GetDescription((Enum)(object)negocioCorretora4.GetValueOrDefault()) : null) ?? ""; + } + else + { + negocio4 = ValidationHelper.GetDescription((Enum)(object)x.Negocio); + } + val4.Negocio = (string)negocio4; + val4.PremioLiquido = x.PremioLiquido; + val4.PremioTotal = x.PremioTotal; + val4.VigenciaFinal = x.Vigencia2; + val4.VigenciaInicial = x.Vigencia1; + val4.Status = ValidationHelper.GetDescription((Enum)(object)x.Situacao) ?? ""; + val4.Seguradora = x.Controle.Seguradora.NomeSocial; + val4.Ramo = x.Controle.Ramo.Nome; + val4.Cliente = new ClientesAtivosInativos + { + Id = ((DomainBase)x.Controle.Cliente).Id, + Nome = x.Controle.Cliente.Nome + }; + val4.Documento = x; + return val4; + }).ToList(); + break; + case 5: + tipo2 = "CLIENTES"; + campos = new List + { + "Nome", "DocumentoCliente", "Dia/Mês", "Nascimento", "TipoPessoa", "Cidade", "Uf", "Cep", "Telefone", "E-mail", + "Profissão" + }; + list = ((IEnumerable)_clientesAniversariantes).Select((Func)((ClientesAtivosInativos x) => new Analitico + { + Nome = (x.Nome ?? ""), + DocumentoCliente = x.Documento, + DiaMes = x.Aniversario, + TipoPessoa = ((ValidationHelper.OnlyNumber(x.Documento).Length > 11) ? "JURÍDICA" : "FÍSICA"), + Nascimento = x.Nascimento, + VencimentoHabilitacao = x.VencimentoCnh, + Cliente = x, + Cidade = x.Cidade, + Uf = x.Estado, + Cep = x.Cep, + Telefone = x.Telefone, + Email = x.Email, + Profissao = x.Profissao + })).ToList(); + break; + case 6: + tipo2 = "CLIENTES"; + campos = new List { "Nome", "DocumentoCliente", "Nascimento", "VencimentoHabilitacao" }; + list = ((IEnumerable)_clientesCnh).Select((Func)((ClientesAtivosInativos x) => new Analitico + { + Nome = (x.Nome ?? ""), + DocumentoCliente = x.Documento, + Nascimento = x.Nascimento, + VencimentoHabilitacao = x.VencimentoCnh, + Cliente = x + })).ToList(); + break; + case 7: + titulo = "APÓLICES À VENCER"; + list = ((IEnumerable)_documentosVencimento.OrderBy((Documento x) => x.Vigencia1)).Select((Func)delegate(Documento x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_0039: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_005a: Unknown result type (might be due to invalid IL or missing references) + //IL_00af: Unknown result type (might be due to invalid IL or missing references) + //IL_00bb: Unknown result type (might be due to invalid IL or missing references) + //IL_00c7: Unknown result type (might be due to invalid IL or missing references) + //IL_00d3: Unknown result type (might be due to invalid IL or missing references) + //IL_00df: Unknown result type (might be due to invalid IL or missing references) + //IL_00e1: Unknown result type (might be due to invalid IL or missing references) + //IL_0080: Unknown result type (might be due to invalid IL or missing references) + //IL_00fe: Unknown result type (might be due to invalid IL or missing references) + //IL_0114: Unknown result type (might be due to invalid IL or missing references) + //IL_012a: Unknown result type (might be due to invalid IL or missing references) + //IL_012b: Unknown result type (might be due to invalid IL or missing references) + //IL_0130: Unknown result type (might be due to invalid IL or missing references) + //IL_0146: Unknown result type (might be due to invalid IL or missing references) + //IL_0161: Expected O, but got Unknown + //IL_0161: Unknown result type (might be due to invalid IL or missing references) + //IL_0169: Expected O, but got Unknown + Analitico val = new Analitico + { + Nome = (x.Controle.Cliente.Nome ?? ""), + Apolice = (x.Apolice ?? ""), + Endosso = (x.Endosso ?? ""), + Comissao = x.Comissao + }; + object negocio; + if (x.NegocioCorretora.HasValue) + { + NegocioCorretora? negocioCorretora = x.NegocioCorretora; + negocio = (negocioCorretora.HasValue ? ValidationHelper.GetDescription((Enum)(object)negocioCorretora.GetValueOrDefault()) : null) ?? ""; + } + else + { + negocio = ValidationHelper.GetDescription((Enum)(object)x.Negocio); + } + val.Negocio = (string)negocio; + val.PremioLiquido = x.PremioLiquido; + val.PremioTotal = x.PremioTotal; + val.VigenciaFinal = x.Vigencia2; + val.VigenciaInicial = x.Vigencia1; + val.Status = ValidationHelper.GetDescription((Enum)(object)x.Situacao) ?? ""; + val.Seguradora = x.Controle.Seguradora.NomeSocial; + val.Ramo = x.Controle.Ramo.Nome; + val.Cliente = new ClientesAtivosInativos + { + Id = ((DomainBase)x.Controle.Cliente).Id, + Nome = x.Controle.Cliente.Nome + }; + val.Documento = x; + return val; + }).ToList(); + break; + case 8: + campos = new List + { + "Nome", "Apolice", "Endosso", "Seguradora", "Comissao", "Vencimento", "Recebimento", "Valor", "ComissaoGerada", "NumeroParcela", + "Ramo" + }; + titulo = "PARCELAS À VENCER"; + tipo2 = "PARCELAS"; + list = ((IEnumerable)_parcelasVencimento.OrderBy((Parcela x) => x.Vencimento)).Select((Func)((Parcela x) => new Analitico + { + Nome = (x.Documento.Controle.Cliente.Nome ?? ""), + Apolice = (x.Documento.Apolice ?? ""), + Endosso = (x.Documento.Endosso ?? ""), + Comissao = x.Comissao, + Seguradora = x.Documento.Controle.Seguradora.NomeSocial, + Ramo = x.Documento.Controle.Ramo.Nome, + Vencimento = x.Vencimento, + Recebimento = x.DataRecebimento, + Valor = x.Valor, + ValorComissao = x.ValorComDesconto, + NumeroParcela = x.NumeroParcela, + Cliente = new ClientesAtivosInativos + { + Id = ((DomainBase)x.Documento.Controle.Cliente).Id, + Nome = x.Documento.Controle.Cliente.Nome + }, + Documento = x.Documento, + Parcela = x + })).ToList(); + break; + case 9: + titulo = "APÓLICES PENDENTES"; + list = ((IEnumerable)(from x in _documentosPendentes + where string.IsNullOrEmpty(x.Apolice) && x.Tipo != 2 + orderby x.Vigencia1 + select x)).Select((Func)delegate(Documento x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_0039: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_005a: Unknown result type (might be due to invalid IL or missing references) + //IL_00af: Unknown result type (might be due to invalid IL or missing references) + //IL_00bb: Unknown result type (might be due to invalid IL or missing references) + //IL_00c7: Unknown result type (might be due to invalid IL or missing references) + //IL_00d3: Unknown result type (might be due to invalid IL or missing references) + //IL_00df: Unknown result type (might be due to invalid IL or missing references) + //IL_00e1: Unknown result type (might be due to invalid IL or missing references) + //IL_0080: Unknown result type (might be due to invalid IL or missing references) + //IL_00fe: Unknown result type (might be due to invalid IL or missing references) + //IL_0114: Unknown result type (might be due to invalid IL or missing references) + //IL_012a: Unknown result type (might be due to invalid IL or missing references) + //IL_012b: Unknown result type (might be due to invalid IL or missing references) + //IL_0130: Unknown result type (might be due to invalid IL or missing references) + //IL_0146: Unknown result type (might be due to invalid IL or missing references) + //IL_0161: Expected O, but got Unknown + //IL_0161: Unknown result type (might be due to invalid IL or missing references) + //IL_0169: Expected O, but got Unknown + Analitico val5 = new Analitico + { + Nome = (x.Controle.Cliente.Nome ?? ""), + Apolice = (x.Apolice ?? ""), + Endosso = (x.Endosso ?? ""), + Comissao = x.Comissao + }; + object negocio5; + if (x.NegocioCorretora.HasValue) + { + NegocioCorretora? negocioCorretora5 = x.NegocioCorretora; + negocio5 = (negocioCorretora5.HasValue ? ValidationHelper.GetDescription((Enum)(object)negocioCorretora5.GetValueOrDefault()) : null) ?? ""; + } + else + { + negocio5 = ValidationHelper.GetDescription((Enum)(object)x.Negocio); + } + val5.Negocio = (string)negocio5; + val5.PremioLiquido = x.PremioLiquido; + val5.PremioTotal = x.PremioTotal; + val5.VigenciaFinal = x.Vigencia2; + val5.VigenciaInicial = x.Vigencia1; + val5.Status = ValidationHelper.GetDescription((Enum)(object)x.Situacao) ?? ""; + val5.Seguradora = x.Controle.Seguradora.NomeSocial; + val5.Ramo = x.Controle.Ramo.Nome; + val5.Cliente = new ClientesAtivosInativos + { + Id = ((DomainBase)x.Controle.Cliente).Id, + Nome = x.Controle.Cliente.Nome + }; + val5.Documento = x; + return val5; + }).ToList(); + break; + case 10: + campos = new List { "Nome", "Apolice", "Endosso", "Seguradora", "Comissao", "Vencimento", "Valor", "NumeroParcela", "Ramo" }; + titulo = "PARCELAS PENDENTES"; + tipo2 = "PARCELAS"; + list = ((IEnumerable)_parcelasPendencia.OrderBy((Parcela x) => x.Vencimento)).Select((Func)((Parcela x) => new Analitico + { + Nome = (x.Documento.Controle.Cliente.Nome ?? ""), + Apolice = (x.Documento.Apolice ?? ""), + Endosso = (x.Documento.Endosso ?? ""), + Comissao = x.Comissao, + Seguradora = x.Documento.Controle.Seguradora.NomeSocial, + Ramo = x.Documento.Controle.Ramo.Nome, + Vencimento = x.Vencimento, + Recebimento = x.DataRecebimento, + Valor = x.Valor, + ValorComissao = x.ValorComissao, + NumeroParcela = x.NumeroParcela, + Cliente = new ClientesAtivosInativos + { + Id = ((DomainBase)x.Documento.Controle.Cliente).Id, + Nome = x.Documento.Controle.Cliente.Nome + }, + Documento = x.Documento, + Parcela = x + })).ToList(); + break; + case 11: + titulo = "ENDOSSOS"; + list = ((IEnumerable)(from x in _documentosProducao + where x.Tipo == 1 + orderby x.Vigencia1 + select x)).Select((Func)delegate(Documento x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_0039: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_005a: Unknown result type (might be due to invalid IL or missing references) + //IL_00af: Unknown result type (might be due to invalid IL or missing references) + //IL_00bb: Unknown result type (might be due to invalid IL or missing references) + //IL_00c7: Unknown result type (might be due to invalid IL or missing references) + //IL_00d3: Unknown result type (might be due to invalid IL or missing references) + //IL_00df: Unknown result type (might be due to invalid IL or missing references) + //IL_00e1: Unknown result type (might be due to invalid IL or missing references) + //IL_0080: Unknown result type (might be due to invalid IL or missing references) + //IL_00fe: Unknown result type (might be due to invalid IL or missing references) + //IL_0114: Unknown result type (might be due to invalid IL or missing references) + //IL_012a: Unknown result type (might be due to invalid IL or missing references) + //IL_012b: Unknown result type (might be due to invalid IL or missing references) + //IL_0130: Unknown result type (might be due to invalid IL or missing references) + //IL_0146: Unknown result type (might be due to invalid IL or missing references) + //IL_0161: Expected O, but got Unknown + //IL_0161: Unknown result type (might be due to invalid IL or missing references) + //IL_0169: Expected O, but got Unknown + Analitico val7 = new Analitico + { + Nome = (x.Controle.Cliente.Nome ?? ""), + Apolice = (x.Apolice ?? ""), + Endosso = (x.Endosso ?? ""), + Comissao = x.Comissao + }; + object negocio7; + if (x.NegocioCorretora.HasValue) + { + NegocioCorretora? negocioCorretora7 = x.NegocioCorretora; + negocio7 = (negocioCorretora7.HasValue ? ValidationHelper.GetDescription((Enum)(object)negocioCorretora7.GetValueOrDefault()) : null) ?? ""; + } + else + { + negocio7 = ValidationHelper.GetDescription((Enum)(object)x.Negocio); + } + val7.Negocio = (string)negocio7; + val7.PremioLiquido = x.PremioLiquido; + val7.PremioTotal = x.PremioTotal; + val7.VigenciaFinal = x.Vigencia2; + val7.VigenciaInicial = x.Vigencia1; + val7.Status = ValidationHelper.GetDescription((Enum)(object)x.Situacao) ?? ""; + val7.Seguradora = x.Controle.Seguradora.NomeSocial; + val7.Ramo = x.Controle.Ramo.Nome; + val7.Cliente = new ClientesAtivosInativos + { + Id = ((DomainBase)x.Controle.Cliente).Id, + Nome = x.Controle.Cliente.Nome + }; + val7.Documento = x; + return val7; + }).ToList(); + break; + case 12: + titulo = "FATURAS"; + list = ((IEnumerable)(from x in _documentosProducao + where x.Tipo == 2 + orderby x.Vigencia1 + select x)).Select((Func)delegate(Documento x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_0039: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_005a: Unknown result type (might be due to invalid IL or missing references) + //IL_00af: Unknown result type (might be due to invalid IL or missing references) + //IL_00bb: Unknown result type (might be due to invalid IL or missing references) + //IL_00c7: Unknown result type (might be due to invalid IL or missing references) + //IL_00d3: Unknown result type (might be due to invalid IL or missing references) + //IL_00df: Unknown result type (might be due to invalid IL or missing references) + //IL_00e1: Unknown result type (might be due to invalid IL or missing references) + //IL_0080: Unknown result type (might be due to invalid IL or missing references) + //IL_00fe: Unknown result type (might be due to invalid IL or missing references) + //IL_0114: Unknown result type (might be due to invalid IL or missing references) + //IL_012a: Unknown result type (might be due to invalid IL or missing references) + //IL_012b: Unknown result type (might be due to invalid IL or missing references) + //IL_0130: Unknown result type (might be due to invalid IL or missing references) + //IL_0146: Unknown result type (might be due to invalid IL or missing references) + //IL_0161: Expected O, but got Unknown + //IL_0161: Unknown result type (might be due to invalid IL or missing references) + //IL_0169: Expected O, but got Unknown + Analitico val2 = new Analitico + { + Nome = (x.Controle.Cliente.Nome ?? ""), + Apolice = (x.Apolice ?? ""), + Endosso = (x.Endosso ?? ""), + Comissao = x.Comissao + }; + object negocio2; + if (x.NegocioCorretora.HasValue) + { + NegocioCorretora? negocioCorretora2 = x.NegocioCorretora; + negocio2 = (negocioCorretora2.HasValue ? ValidationHelper.GetDescription((Enum)(object)negocioCorretora2.GetValueOrDefault()) : null) ?? ""; + } + else + { + negocio2 = ValidationHelper.GetDescription((Enum)(object)x.Negocio); + } + val2.Negocio = (string)negocio2; + val2.PremioLiquido = x.PremioLiquido; + val2.PremioTotal = x.PremioTotal; + val2.VigenciaFinal = x.Vigencia2; + val2.VigenciaInicial = x.Vigencia1; + val2.Status = ValidationHelper.GetDescription((Enum)(object)x.Situacao) ?? ""; + val2.Seguradora = x.Controle.Seguradora.NomeSocial; + val2.Ramo = x.Controle.Ramo.Nome; + val2.Cliente = new ClientesAtivosInativos + { + Id = ((DomainBase)x.Controle.Cliente).Id, + Nome = x.Controle.Cliente.Nome + }; + val2.Documento = x; + return val2; + }).ToList(); + break; + case 13: + titulo = "TOTAL DOCUMENTOS"; + list = ((IEnumerable)(from x in _documentosProducao + where x.Tipo != 2 + orderby x.Vigencia1 + select x)).Select((Func)delegate(Documento x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_0039: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_005a: Unknown result type (might be due to invalid IL or missing references) + //IL_00af: Unknown result type (might be due to invalid IL or missing references) + //IL_00bb: Unknown result type (might be due to invalid IL or missing references) + //IL_00c7: Unknown result type (might be due to invalid IL or missing references) + //IL_00d3: Unknown result type (might be due to invalid IL or missing references) + //IL_00df: Unknown result type (might be due to invalid IL or missing references) + //IL_00e1: Unknown result type (might be due to invalid IL or missing references) + //IL_0080: Unknown result type (might be due to invalid IL or missing references) + //IL_00fe: Unknown result type (might be due to invalid IL or missing references) + //IL_0114: Unknown result type (might be due to invalid IL or missing references) + //IL_012a: Unknown result type (might be due to invalid IL or missing references) + //IL_012b: Unknown result type (might be due to invalid IL or missing references) + //IL_0130: Unknown result type (might be due to invalid IL or missing references) + //IL_0146: Unknown result type (might be due to invalid IL or missing references) + //IL_0161: Expected O, but got Unknown + //IL_0161: Unknown result type (might be due to invalid IL or missing references) + //IL_0169: Expected O, but got Unknown + Analitico val9 = new Analitico + { + Nome = (x.Controle.Cliente.Nome ?? ""), + Apolice = (x.Apolice ?? ""), + Endosso = (x.Endosso ?? ""), + Comissao = x.Comissao + }; + object negocio9; + if (x.NegocioCorretora.HasValue) + { + NegocioCorretora? negocioCorretora9 = x.NegocioCorretora; + negocio9 = (negocioCorretora9.HasValue ? ValidationHelper.GetDescription((Enum)(object)negocioCorretora9.GetValueOrDefault()) : null) ?? ""; + } + else + { + negocio9 = ValidationHelper.GetDescription((Enum)(object)x.Negocio); + } + val9.Negocio = (string)negocio9; + val9.PremioLiquido = x.PremioLiquido; + val9.PremioTotal = x.PremioTotal; + val9.VigenciaFinal = x.Vigencia2; + val9.VigenciaInicial = x.Vigencia1; + val9.Status = ValidationHelper.GetDescription((Enum)(object)x.Situacao) ?? ""; + val9.Seguradora = x.Controle.Seguradora.NomeSocial; + val9.Ramo = x.Controle.Ramo.Nome; + val9.Cliente = new ClientesAtivosInativos + { + Id = ((DomainBase)x.Controle.Cliente).Id, + Nome = x.Controle.Cliente.Nome + }; + val9.Documento = x; + return val9; + }).ToList(); + break; + case 14: + titulo = "PRODUÇÃO ANTERIOR"; + list = ((IEnumerable)_documentosFechamento).Select((Func)delegate(Documento x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_0039: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_005a: Unknown result type (might be due to invalid IL or missing references) + //IL_00af: Unknown result type (might be due to invalid IL or missing references) + //IL_00bb: Unknown result type (might be due to invalid IL or missing references) + //IL_00c7: Unknown result type (might be due to invalid IL or missing references) + //IL_00d3: Unknown result type (might be due to invalid IL or missing references) + //IL_00df: Unknown result type (might be due to invalid IL or missing references) + //IL_00e1: Unknown result type (might be due to invalid IL or missing references) + //IL_0080: Unknown result type (might be due to invalid IL or missing references) + //IL_00fe: Unknown result type (might be due to invalid IL or missing references) + //IL_0114: Unknown result type (might be due to invalid IL or missing references) + //IL_012a: Unknown result type (might be due to invalid IL or missing references) + //IL_012b: Unknown result type (might be due to invalid IL or missing references) + //IL_0130: Unknown result type (might be due to invalid IL or missing references) + //IL_0146: Unknown result type (might be due to invalid IL or missing references) + //IL_0161: Expected O, but got Unknown + //IL_0161: Unknown result type (might be due to invalid IL or missing references) + //IL_0169: Expected O, but got Unknown + Analitico val11 = new Analitico + { + Nome = (x.Controle.Cliente.Nome ?? ""), + Apolice = (x.Apolice ?? ""), + Endosso = (x.Endosso ?? ""), + Comissao = x.Comissao + }; + object negocio11; + if (x.NegocioCorretora.HasValue) + { + NegocioCorretora? negocioCorretora11 = x.NegocioCorretora; + negocio11 = (negocioCorretora11.HasValue ? ValidationHelper.GetDescription((Enum)(object)negocioCorretora11.GetValueOrDefault()) : null) ?? ""; + } + else + { + negocio11 = ValidationHelper.GetDescription((Enum)(object)x.Negocio); + } + val11.Negocio = (string)negocio11; + val11.PremioLiquido = x.PremioLiquido; + val11.PremioTotal = x.PremioTotal; + val11.VigenciaFinal = x.Vigencia2; + val11.VigenciaInicial = x.Vigencia1; + val11.Status = ValidationHelper.GetDescription((Enum)(object)x.Situacao) ?? ""; + val11.Seguradora = x.Controle.Seguradora.NomeSocial; + val11.Ramo = x.Controle.Ramo.Nome; + val11.Cliente = new ClientesAtivosInativos + { + Id = ((DomainBase)x.Controle.Cliente).Id, + Nome = x.Controle.Cliente.Nome + }; + val11.Documento = x; + return val11; + }).ToList(); + break; + } + if (list.Count == 0) + { + await ShowMessage("NÃO FOI POSSÍVEL DETALHAR POIS NÃO HÁ DADOS"); + } + else + { + ((Window)new HosterWindow((ContentControl)(object)new DialogAnaliticoBi(titulo, list, tipo2, campos), "ANALÍTICO", 1260.0, 500.0)).Show(); + } + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.BI/ProspeccaoViewModel.cs b/Decompiler/Gestor.Application.ViewModels.BI/ProspeccaoViewModel.cs new file mode 100644 index 0000000..a9fad65 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.BI/ProspeccaoViewModel.cs @@ -0,0 +1,503 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using ClosedXML.Excel; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Relatorios; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.BI; + +public class ProspeccaoViewModel : BaseViewModel +{ + private readonly ProspeccaoServico _servico; + + private PermissaoUsuario SelectedPermissaoUsuario; + + private ObservableCollection _vendedores; + + private Vendedor _selectedVendedor = new Vendedor(); + + private List _searchStatus = new List + { + "TODOS", + ValidationHelper.GetDescription((Enum)(object)(StatusProspeccao)1), + ValidationHelper.GetDescription((Enum)(object)(StatusProspeccao)5), + ValidationHelper.GetDescription((Enum)(object)(StatusProspeccao)2), + ValidationHelper.GetDescription((Enum)(object)(StatusProspeccao)4), + ValidationHelper.GetDescription((Enum)(object)(StatusProspeccao)3) + }; + + private string _selectedStatusSearch = "AGENDANDO"; + + private StatusProspeccao? _selectedStatus; + + private ObservableCollection _statusProspeccaoPersonalizado; + + private DateTime _inicio = Funcoes.GetNetworkTime().Date; + + private DateTime _fim = Funcoes.GetNetworkTime().Date.AddDays(7.0); + + private ObservableCollection _prospeccoesFiltradas; + + private Prospeccao _selectedProspeccao; + + private ObservableCollection _prospeccao; + + private bool _naoHaDados; + + public ObservableCollection Vendedores + { + get + { + return _vendedores; + } + set + { + _vendedores = value; + OnPropertyChanged("Vendedores"); + } + } + + public Vendedor SelectedVendedor + { + get + { + return _selectedVendedor; + } + set + { + _selectedVendedor = value; + OnPropertyChanged("SelectedVendedor"); + } + } + + public List SearchStatus + { + get + { + return _searchStatus; + } + set + { + _searchStatus = value; + SelectedStatusSearch = value[1]; + OnPropertyChanged("SearchStatus"); + } + } + + public string SelectedStatusSearch + { + get + { + return _selectedStatusSearch; + } + set + { + _selectedStatusSearch = value; + switch (value) + { + default: + SelectedStatus = null; + break; + case "AGENDADO": + SelectedStatus = (StatusProspeccao)1; + break; + case "GANHO": + SelectedStatus = (StatusProspeccao)2; + break; + case "PERDIDO": + SelectedStatus = (StatusProspeccao)3; + break; + case "NÃO TRABALHADO": + SelectedStatus = (StatusProspeccao)4; + break; + case "EM ANDAMENTO": + SelectedStatus = (StatusProspeccao)5; + break; + } + OnPropertyChanged("SelectedStatusSearch"); + } + } + + public StatusProspeccao? SelectedStatus + { + get + { + return _selectedStatus; + } + set + { + _selectedStatus = value; + OnPropertyChanged("SelectedStatus"); + } + } + + public ObservableCollection StatusProspeccaoPersonalizado + { + get + { + return _statusProspeccaoPersonalizado; + } + set + { + _statusProspeccaoPersonalizado = value; + OnPropertyChanged("StatusProspeccaoPersonalizado"); + } + } + + public DateTime Inicio + { + get + { + return _inicio; + } + set + { + _inicio = value; + OnPropertyChanged("Inicio"); + } + } + + public DateTime Fim + { + get + { + return _fim; + } + set + { + _fim = value; + OnPropertyChanged("Fim"); + } + } + + public List Prospeccoes { get; set; } + + public ObservableCollection ProspeccoesFiltradas + { + get + { + return _prospeccoesFiltradas; + } + set + { + _prospeccoesFiltradas = value; + OnPropertyChanged("ProspeccoesFiltradas"); + } + } + + public Prospeccao SelectedProspeccao + { + get + { + return _selectedProspeccao; + } + set + { + _selectedProspeccao = value; + OnPropertyChanged("SelectedProspeccao"); + } + } + + public AutoCompleteFilterPredicate ProspeccaoItemFilter => (string searchText, object obj) => ((Prospeccao)obj).Nome.ToUpper().Contains(searchText.ToUpper()) || ((Prospeccao)obj).Documento.ToString().ToUpper().Contains(searchText.ToUpper()) || ((Prospeccao)obj).Telefone1.ToString().ToUpper().Contains(searchText.ToUpper()) || ((Prospeccao)obj).Telefone2.ToString().ToUpper().Contains(searchText.ToUpper()) || ((Prospeccao)obj).Email.ToString().ToUpper().Contains(searchText.ToUpper()) || ((Prospeccao)obj).VigenciaFinal.ToString().ToUpper().Contains(searchText.ToUpper()); + + public ObservableCollection Prospeccao + { + get + { + return _prospeccao; + } + set + { + _prospeccao = value; + NaoHaDados = value == null || value.Count == 0; + OnPropertyChanged("Prospeccao"); + } + } + + public bool NaoHaDados + { + get + { + return _naoHaDados; + } + set + { + _naoHaDados = value; + OnPropertyChanged("NaoHaDados"); + } + } + + public ProspeccaoViewModel() + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_000b: Expected O, but got Unknown + _servico = new ProspeccaoServico(); + StatusProspeccaoPersonalizado = new ObservableCollection(Recursos.StatusProspeccao.Where((StatusDeProspeccao x) => x.Ativo).ToList()); + CarregaVendedores(); + SelectedStatusSearch = SearchStatus[1]; + CarregaProspeccoes(); + } + + public async void Excluir(Prospeccao prospeccao) + { + if (!(await BuscaPermissao("Excluir")) || prospeccao == null) + { + return; + } + bool flag = prospeccao.Tarefa == null; + if (flag) + { + flag = !(await ShowMessage("DESEJA EXCLUIR ESSA PROSPECÇÃO?", "SIM", "NÃO")); + } + bool flag2 = flag; + if (!flag2) + { + bool flag3 = prospeccao.Tarefa != null; + if (flag3) + { + flag3 = !(await ShowMessage("HÁ UMA TAREFA ANEXADA A ESSA PROSPECÇÃO. ESSE PROCEDIMENTO IRÁ EXCLUIR A TAREFA ANEXADA." + Environment.NewLine + "DESEJA REALMENTE PROSSEGUIR?", "SIM", "NÃO")); + } + flag2 = flag3; + } + if (!flag2 && await _servico.Delete(prospeccao)) + { + RegistrarAcao($"EXCLUIU PROSPECÇÃO DO ID: {((DomainBase)prospeccao).Id}", ((DomainBase)prospeccao).Id, (TipoTela)33, $"CLIENTE \"{prospeccao.Nome}\", ID: {((DomainBase)prospeccao).Id}"); + await CarregarProspeccoes(); + ToggleSnackBar("PROSPECÇÃO EXCLUÍDA COM SUCESSO"); + } + } + + public async void CarregaProspeccoes() + { + await CarregarProspeccoes(); + } + + public async void CarregaVendedores() + { + await CarregarVendedores(); + } + + public async Task CarregarVendedores() + { + List vinculos = (await new VendedorUsuarioServico().FindByVinculo(Recursos.Usuario)).Select((VendedorUsuario x) => ((DomainBase)x.Vendedor).Id).ToList(); + List list = new List(); + if (vinculos.Count > 0 && !Recursos.Usuario.Administrador) + { + list.AddRange((from x in Recursos.Vendedores + where (Recursos.Usuario.IdEmpresa == 1 || x.IdEmpresa == Recursos.Usuario.IdEmpresa) && x.Ativo && vinculos.Contains(((DomainBase)x).Id) + orderby x.Nome + select x).ToList()); + } + else + { + list.Add(new Vendedor + { + Id = 0L, + Nome = "TODOS OS VENDEDORES" + }); + list.AddRange((from x in Recursos.Vendedores + where (Recursos.Usuario.IdEmpresa == 1 || x.IdEmpresa == Recursos.Usuario.IdEmpresa) && x.Ativo + orderby x.Nome + select x).ToList()); + } + Vendedores = new ObservableCollection(list); + SelectedVendedor = Vendedores.FirstOrDefault(); + } + + public async Task CarregarProspeccoes() + { + if (!(Inicio > Fim)) + { + Loading(isLoading: true); + base.IsVisible = (Visibility)2; + Prospeccoes = await _servico.BuscarProspeccoes(((DomainBase)SelectedVendedor).Id, Inicio, Fim, SelectedStatus); + ProspeccoesFiltradas = new ObservableCollection(Prospeccoes.OrderBy((Prospeccao x) => x.VigenciaFinal)); + SelectedProspeccao = ProspeccoesFiltradas.FirstOrDefault(); + base.IsVisible = (Visibility)0; + Loading(isLoading: false); + } + } + + internal async Task> FiltrarProspecao(string value) + { + return await Task.Run(() => Filtrar(value)); + } + + public List Filtrar(string filter) + { + if (Prospeccoes == null) + { + return null; + } + ProspeccoesFiltradas = (string.IsNullOrWhiteSpace(filter) ? new ObservableCollection(Prospeccoes) : new ObservableCollection(from x in Prospeccoes + where ValidationHelper.RemoveDiacritics(ValidationHelper.RemoveDiacritics(x.Nome).ToUpper().Trim()).Contains(filter) || (x.Documento != null && ValidationHelper.RemoveDiacritics(x.Documento.Trim()).Contains(filter)) || (x.Telefone1 != null && ValidationHelper.RemoveDiacritics(x.Telefone1.Trim()).Contains(filter)) || (x.Telefone2 != null && ValidationHelper.RemoveDiacritics(x.Telefone2.Trim()).Contains(filter)) || (x.Email != null && ValidationHelper.RemoveDiacritics(x.Email.Trim()).Contains(filter)) || (x.VigenciaFinal.HasValue && ValidationHelper.RemoveDiacritics(x.VigenciaFinal.ToString().Trim()).Contains(filter)) + orderby x.VigenciaFinal + select x)); + return ProspeccoesFiltradas.ToList(); + } + + public async Task>> Salvar(Prospeccao prospecao) + { + return await SalvarProspeccao(prospecao); + } + + public async Task Print() + { + if (ProspeccoesFiltradas != null) + { + List printProspect = new List(); + ProspeccoesFiltradas.AsEnumerable().ToList().ForEach(delegate(Prospeccao x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Unknown result type (might be due to invalid IL or missing references) + //IL_0026: Unknown result type (might be due to invalid IL or missing references) + //IL_0032: Unknown result type (might be due to invalid IL or missing references) + //IL_0047: Unknown result type (might be due to invalid IL or missing references) + //IL_005c: Unknown result type (might be due to invalid IL or missing references) + //IL_0071: Unknown result type (might be due to invalid IL or missing references) + //IL_007d: Unknown result type (might be due to invalid IL or missing references) + //IL_0092: Unknown result type (might be due to invalid IL or missing references) + //IL_009e: Unknown result type (might be due to invalid IL or missing references) + //IL_00be: Unknown result type (might be due to invalid IL or missing references) + //IL_00d3: Unknown result type (might be due to invalid IL or missing references) + //IL_00e9: Unknown result type (might be due to invalid IL or missing references) + //IL_00f6: Expected O, but got Unknown + ProspeccaoToPrint item = new ProspeccaoToPrint + { + Nome = x.Nome, + Documento = (x.Documento ?? ""), + Nascimento = x.Nascimento, + Prefixo1 = (x.Prefixo1 ?? ""), + Telefone1 = (x.Telefone1 ?? ""), + Email = (x.Email ?? ""), + VigenciaFinal = x.VigenciaFinal, + Item = (x.Item ?? ""), + Status = x.Status, + StatusPersonalizadotoPrint = ((x.StatusPersonalizado == null) ? "" : x.StatusPersonalizado.Nome), + Tipo = (x.Tipo ?? ""), + Vendedor = (x.Vendedor.Nome ?? null), + Valor = x.Valor + }; + printProspect.Add(item); + }); + printProspect = printProspect.OrderBy((ProspeccaoToPrint x) => x.Vendedor).ToList(); + string text = await Funcoes.GenerateTable(printProspect.ToList(), new List()); + if (!string.IsNullOrEmpty(text)) + { + text = Funcoes.ExportarHtml(new TipoRelatorio + { + Inicio = Inicio, + Fim = Fim, + Nome = "PROSPECÇÕES - " + SelectedVendedor.Nome + }, text, "60", "landscaoe"); + string tempPath = Path.GetTempPath(); + string text2 = $"{tempPath}PROSPECÇÃO_{Funcoes.GetNetworkTime():ddMMyyyyhhmmss}.html"; + StreamWriter streamWriter = new StreamWriter(text2, append: true, Encoding.UTF8); + streamWriter.Write(text); + streamWriter.Close(); + Process.Start(text2); + } + } + } + + public async Task GerarExcel() + { + if (ProspeccoesFiltradas == null) + { + ShowMessage("NÃO HÁ DADOS PARA A IMPRESSÃO EM EXCEL"); + return; + } + List excelProspect = new List(); + ProspeccoesFiltradas.AsEnumerable().ToList().ForEach(delegate(Prospeccao x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Unknown result type (might be due to invalid IL or missing references) + //IL_0026: Unknown result type (might be due to invalid IL or missing references) + //IL_0032: Unknown result type (might be due to invalid IL or missing references) + //IL_0047: Unknown result type (might be due to invalid IL or missing references) + //IL_005c: Unknown result type (might be due to invalid IL or missing references) + //IL_0071: Unknown result type (might be due to invalid IL or missing references) + //IL_007d: Unknown result type (might be due to invalid IL or missing references) + //IL_0092: Unknown result type (might be due to invalid IL or missing references) + //IL_009e: Unknown result type (might be due to invalid IL or missing references) + //IL_00be: Unknown result type (might be due to invalid IL or missing references) + //IL_00d3: Unknown result type (might be due to invalid IL or missing references) + //IL_00e9: Unknown result type (might be due to invalid IL or missing references) + //IL_00f6: Expected O, but got Unknown + ProspeccaoToPrint item = new ProspeccaoToPrint + { + Nome = x.Nome, + Documento = (x.Documento ?? ""), + Nascimento = x.Nascimento, + Prefixo1 = (x.Prefixo1 ?? ""), + Telefone1 = (x.Telefone1 ?? ""), + Email = (x.Email ?? ""), + VigenciaFinal = x.VigenciaFinal, + Item = (x.Item ?? ""), + Status = x.Status, + StatusPersonalizadotoPrint = ((x.StatusPersonalizado == null) ? "" : x.StatusPersonalizado.Nome), + Tipo = (x.Tipo ?? ""), + Vendedor = (x.Vendedor.Nome ?? null), + Valor = x.Valor + }; + excelProspect.Add(item); + }); + string tempPath = Path.GetTempPath(); + string fileName = $"{tempPath}{Guid.NewGuid()}.xlsx"; + XLWorkbook val = new XLWorkbook(); + string nome = "PROSPECÇÃO"; + (await Funcoes.GerarXls(val, nome, excelProspect, new List())).SaveAs(fileName); + Process.Start(fileName); + } + + public async Task CarregaProspeccao() + { + if (ProspeccoesFiltradas != null) + { + ProspeccoesFiltradas = new ObservableCollection(ProspeccoesFiltradas.ToList()); + } + } + + public async Task CarregarPermissao() + { + SelectedPermissaoUsuario = await ServicoPermissUsuario.VerificarPermissao(Recursos.Usuario, (TipoTela)60); + } + + public async Task BuscaPermissao(string Tipo) + { + if (Recursos.Usuario.Administrador) + { + return true; + } + if (Tipo == "Alterar" && SelectedPermissaoUsuario != null && !SelectedPermissaoUsuario.Alterar) + { + return false; + } + if (Tipo == "Excluir" && SelectedPermissaoUsuario != null && !SelectedPermissaoUsuario.Excluir) + { + return false; + } + if (Tipo == "Incluir" && SelectedPermissaoUsuario != null && !SelectedPermissaoUsuario.Incluir) + { + return false; + } + return true; + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.BI/TarefaBIViewModel.cs b/Decompiler/Gestor.Application.ViewModels.BI/TarefaBIViewModel.cs new file mode 100644 index 0000000..03d23df --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.BI/TarefaBIViewModel.cs @@ -0,0 +1,1146 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using Gestor.Application.Actions; +using Gestor.Application.Drawers; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.ViewModels.Generic; +using Gestor.Application.Views.Generic; +using Gestor.Application.Views.Seguros; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.MalaDireta; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.Helper; + +namespace Gestor.Application.ViewModels.BI; + +public class TarefaBIViewModel : BaseTarefaViewModel +{ + private bool _enableAlterarTarefa = true; + + private bool _administrador; + + private DateTime _inicio = Funcoes.GetNetworkTime().Date.AddDays(-4.0); + + private DateTime _fim = Funcoes.GetNetworkTime().Date.AddDays(4.0); + + private List _status = new List + { + "TODAS AS TAREFAS", + ValidationHelper.GetDescription((Enum)(object)(StatusTarefa)0), + ValidationHelper.GetDescription((Enum)(object)(StatusTarefa)2) + }; + + private string _selectedStatus; + + private Visibility _isVisibleCliente = (Visibility)2; + + private Visibility _isVisibleApolice = (Visibility)2; + + private Visibility _isVisibleArquivoDigital = (Visibility)2; + + private Visibility _isVisibleSinistro = (Visibility)2; + + private ObservableCollection _usuariosFiltro; + + private ObservableCollection _usuarios; + + private ObservableCollection _tiposTarefa; + + private TipoDeTarefa _selectedTipoTarefa; + + private Usuario _selectedUsuarioFiltro = new Usuario(); + + private Usuario _selectedUsuario = new Usuario(); + + private DateTime _dataAgendamento = Funcoes.GetNetworkTime(); + + private DateTime _horaAgendamento = Funcoes.GetNetworkTime(); + + private bool _isAnotacoes = true; + + private string _descricao = ""; + + private string _historicoInterno = ""; + + private ObservableCollection _tarefas; + + private Tarefa _selectedTarefa; + + private ObservableCollection _telefones; + + private long _cancelTarefa; + + private ObservableCollection _tarefasFiltradas = new ObservableCollection(); + + private string _filtro = ""; + + private ObservableCollection _filtroTarefa = new ObservableCollection(); + + private GridLength _columnUsuarioPrincipal = new GridLength(1.0, (GridUnitType)2); + + private GridLength _columnUsuarios = new GridLength(0.0, (GridUnitType)1); + + private new TarefaServico Servico { get; } + + private ClienteServico ClienteServico { get; } + + public override bool EnableAlterarTarefa + { + get + { + return _enableAlterarTarefa; + } + set + { + _enableAlterarTarefa = _alterarPermissEnabled && value; + OnPropertyChanged("EnableAlterarTarefa"); + } + } + + public bool Administrador + { + get + { + return _administrador; + } + set + { + _administrador = value; + OnPropertyChanged("Administrador"); + } + } + + public DateTime Inicio + { + get + { + return _inicio; + } + set + { + _inicio = value; + CarregaTarefas(); + OnPropertyChanged("Inicio"); + } + } + + public DateTime Fim + { + get + { + return _fim; + } + set + { + _fim = value; + CarregaTarefas(); + OnPropertyChanged("Fim"); + } + } + + public List Status + { + get + { + return _status; + } + set + { + _status = value; + CarregaTarefas(); + OnPropertyChanged("Status"); + } + } + + public string SelectedStatus + { + get + { + return _selectedStatus; + } + set + { + _selectedStatus = value; + CarregaTarefas(); + OnPropertyChanged("SelectedStatus"); + } + } + + public Visibility IsVisibleCliente + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _isVisibleCliente; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _isVisibleCliente = value; + OnPropertyChanged("IsVisibleCliente"); + } + } + + public Visibility IsVisibleApolice + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _isVisibleApolice; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _isVisibleApolice = value; + OnPropertyChanged("IsVisibleApolice"); + } + } + + public Visibility IsVisibleArquivoDigital + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _isVisibleArquivoDigital; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _isVisibleArquivoDigital = value; + OnPropertyChanged("IsVisibleArquivoDigital"); + } + } + + public Visibility IsVisibleSinistro + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _isVisibleSinistro; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _isVisibleSinistro = value; + OnPropertyChanged("IsVisibleSinistro"); + } + } + + public ObservableCollection UsuariosFiltro + { + get + { + return _usuariosFiltro; + } + set + { + _usuariosFiltro = value; + OnPropertyChanged("UsuariosFiltro"); + } + } + + public ObservableCollection Usuarios + { + get + { + return _usuarios; + } + set + { + _usuarios = value; + OnPropertyChanged("Usuarios"); + } + } + + public ObservableCollection TiposTarefa + { + get + { + return _tiposTarefa; + } + set + { + _tiposTarefa = value; + OnPropertyChanged("TiposTarefa"); + } + } + + public TipoDeTarefa SelectedTipoTarefa + { + get + { + return _selectedTipoTarefa; + } + set + { + _selectedTipoTarefa = value; + OnPropertyChanged("SelectedTipoTarefa"); + } + } + + public Usuario SelectedUsuarioFiltro + { + get + { + return _selectedUsuarioFiltro; + } + set + { + _selectedUsuarioFiltro = value; + CarregaTarefas(); + OnPropertyChanged("SelectedUsuarioFiltro"); + } + } + + public Usuario SelectedUsuario + { + get + { + return _selectedUsuario; + } + set + { + _selectedUsuario = value; + OnPropertyChanged("SelectedUsuario"); + } + } + + public DateTime DataAgendamento + { + get + { + return _dataAgendamento; + } + set + { + _dataAgendamento = value; + if (SelectedTarefa != null) + { + SelectedTarefa.Agendamento = DateTime.Parse($"{value:d} {SelectedTarefa.Agendamento:T}"); + } + OnPropertyChanged("DataAgendamento"); + } + } + + public DateTime HoraAgendamento + { + get + { + return _horaAgendamento; + } + set + { + _horaAgendamento = value; + if (SelectedTarefa != null) + { + SelectedTarefa.Agendamento = DateTime.Parse($"{SelectedTarefa.Agendamento:d} {value:T}"); + } + OnPropertyChanged("HoraAgendamento"); + } + } + + public bool IsAnotacoes + { + get + { + return _isAnotacoes; + } + set + { + _isAnotacoes = value; + OnPropertyChanged("IsAnotacoes"); + } + } + + public string Descricao + { + get + { + return _descricao; + } + set + { + _descricao = value; + OnPropertyChanged("Descricao"); + } + } + + public string HistoricoInterno + { + get + { + return _historicoInterno; + } + set + { + _historicoInterno = value; + OnPropertyChanged("HistoricoInterno"); + } + } + + public ObservableCollection Tarefas + { + get + { + return _tarefas; + } + set + { + _tarefas = value; + OnPropertyChanged("Tarefas"); + } + } + + public override Tarefa SelectedTarefa + { + get + { + return _selectedTarefa; + } + set + { + _cancelTarefa = ((value != null) ? ((DomainBase)value).Id : 0); + WorkOnSelectedTarefa(value); + VerificarEnables((value != null) ? new long?(((DomainBase)value).Id) : null); + _selectedTarefa = value; + ValidaPermissaoParaEditarTarefa(); + OnPropertyChanged("SelectedTarefa"); + } + } + + public ObservableCollection Telefones + { + get + { + return _telefones; + } + set + { + _telefones = value; + OnPropertyChanged("Telefones"); + } + } + + public ObservableCollection TarefasFiltradas + { + get + { + return _tarefasFiltradas; + } + set + { + _tarefasFiltradas = value; + base.IsVisible = (Visibility)((value.Count <= 0) ? 2 : 0); + OnPropertyChanged("TarefasFiltradas"); + } + } + + public string Filtro + { + get + { + return _filtro; + } + set + { + _filtro = value; + OnPropertyChanged("Filtro"); + } + } + + public ObservableCollection FiltroTarefa + { + get + { + return _filtroTarefa; + } + set + { + _filtroTarefa = value; + OnPropertyChanged("FiltroTarefa"); + } + } + + public GridLength ColumnUsuarioPrincipal + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _columnUsuarioPrincipal; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _columnUsuarioPrincipal = value; + OnPropertyChanged("ColumnUsuarioPrincipal"); + } + } + + public GridLength ColumnUsuarios + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _columnUsuarios; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _columnUsuarios = value; + OnPropertyChanged("ColumnUsuarios"); + } + } + + public TarefaBIViewModel() + { + //IL_0089: Unknown result type (might be due to invalid IL or missing references) + //IL_0090: Unknown result type (might be due to invalid IL or missing references) + //IL_0097: Unknown result type (might be due to invalid IL or missing references) + //IL_009e: Unknown result type (might be due to invalid IL or missing references) + //IL_00a4: Unknown result type (might be due to invalid IL or missing references) + //IL_00ae: Expected O, but got Unknown + //IL_00af: Unknown result type (might be due to invalid IL or missing references) + //IL_00b9: Expected O, but got Unknown + //IL_0118: Unknown result type (might be due to invalid IL or missing references) + //IL_011d: Unknown result type (might be due to invalid IL or missing references) + //IL_012d: Unknown result type (might be due to invalid IL or missing references) + //IL_0132: Unknown result type (might be due to invalid IL or missing references) + //IL_01cd: Unknown result type (might be due to invalid IL or missing references) + //IL_01d2: Unknown result type (might be due to invalid IL or missing references) + //IL_01dd: Unknown result type (might be due to invalid IL or missing references) + //IL_01ea: Expected O, but got Unknown + Servico = new TarefaServico(); + ClienteServico = new ClienteServico(); + Administrador = ((DomainBase)Recursos.Usuario).Id == 0L || Recursos.Usuario.Administrador; + CarregarUsuarios(); + List list = (from x in Recursos.Usuarios + where (Recursos.Configuracoes.Any((ConfiguracaoSistema c) => (int)c.Configuracao == 36) || x.IdEmpresa == Recursos.Usuario.IdEmpresa) && !x.Excluido + orderby x.Nome + select x).ToList(); + list.Insert(0, new Usuario + { + Nome = "TODOS OS USUÁRIOS", + Id = 0L + }); + UsuariosFiltro = new ObservableCollection(list); + TiposTarefa = new ObservableCollection(Recursos.TiposTarefa.Where((TipoDeTarefa x) => x.Ativo).ToList()); + SelectedUsuarioFiltro = ((IEnumerable)UsuariosFiltro).FirstOrDefault((Func)((Usuario x) => ((DomainBase)x).Id == ((DomainBase)Recursos.Usuario).Id)) ?? UsuariosFiltro.FirstOrDefault(); + SelectedStatus = Status[1]; + CarregaTarefas(permissoes: true); + } + + public async void CarregaTarefas(bool permissoes = false) + { + if (permissoes) + { + await PermissaoTela((TipoTela)38); + Alterar(alterar: false); + } + await CarregarTarefas(); + } + + public async Task CarregarTarefas() + { + ColumnUsuarioPrincipal = new GridLength(1.0, (GridUnitType)2); + ColumnUsuarios = new GridLength(0.0, (GridUnitType)1); + Filtro = string.Empty; + TarefaServico servico = Servico; + Usuario selectedUsuarioFiltro = SelectedUsuarioFiltro; + Tarefas = new ObservableCollection(from x in await servico.BuscarTarefas((selectedUsuarioFiltro != null) ? ((DomainBase)selectedUsuarioFiltro).Id : 0, Inicio, Fim, (SelectedStatus == "TODAS AS TAREFAS") ? null : new bool?(SelectedStatus != "PENDENTE")) + where (int)x.Entidade != 1 + orderby x.Agendamento + select x); + TarefasFiltradas = Tarefas; + SelectedTarefa = TarefasFiltradas.FirstOrDefault(); + if (FiltroTarefa.Count > 0) + { + FiltrarTarefa(); + } + } + + private async void WorkOnSelectedTarefa(Tarefa value) + { + if (value == null) + { + base.Responsaveis = new ObservableCollection(); + return; + } + SelectedUsuario = ((value.Usuario != null) ? ((IEnumerable)Usuarios).FirstOrDefault((Func)((Usuario x) => ((DomainBase)x).Id == ((DomainBase)value.Usuario).Id)) : null); + DataAgendamento = value.Agendamento; + HoraAgendamento = value.Agendamento; + Descricao = value.Descricao; + HistoricoInterno = value.DescricaoInterna; + base.Responsaveis = ((value == null) ? new ObservableCollection() : ((value.Responsaveis == null) ? new ObservableCollection() : new ObservableCollection(value.Responsaveis))); + if (!base.Responsaveis.Any()) + { + TarefaBIViewModel tarefaBIViewModel = this; + Tarefa obj = value; + tarefaBIViewModel.Responsaveis = ((((obj != null) ? obj.Usuario : null) == null) ? new ObservableCollection() : new ObservableCollection((IEnumerable)(object)new ResponsavelTarefa[1] + { + new ResponsavelTarefa + { + Usuario = value.Usuario + } + })); + } + if (value.TipoDeTarefa != null) + { + if (TiposTarefa.All((TipoDeTarefa x) => ((DomainBase)x).Id != ((DomainBase)value).Id) && !value.TipoDeTarefa.Ativo) + { + TiposTarefa.Add(value.TipoDeTarefa); + } + else + { + TiposTarefa = new ObservableCollection(TiposTarefa.Where((TipoDeTarefa x) => x.Ativo).ToList()); + } + } + SelectedTipoTarefa = value.TipoDeTarefa; + IsVisibleCliente = (Visibility)2; + IsVisibleApolice = (Visibility)2; + IsVisibleSinistro = (Visibility)2; + IsVisibleArquivoDigital = (Visibility)2; + TipoTarefa entidade = value.Entidade; + switch ((int)entidade) + { + case 2: + IsVisibleCliente = (Visibility)0; + IsVisibleArquivoDigital = (Visibility)0; + break; + case 0: + case 3: + IsVisibleCliente = (Visibility)0; + IsVisibleApolice = (Visibility)0; + IsVisibleArquivoDigital = (Visibility)0; + break; + case 4: + IsVisibleCliente = (Visibility)0; + IsVisibleApolice = (Visibility)0; + IsVisibleSinistro = (Visibility)0; + IsVisibleArquivoDigital = (Visibility)0; + break; + } + entidade = value.Entidade; + if ((int)entidade != 5) + { + if ((int)entidade != 8) + { + Telefones = new ObservableCollection((await ClienteServico.BuscarTelefonesAsync(value.IdCliente)).Where((ClienteTelefone x) => ValidationHelper.ValidacaoTelefone(((TelefoneBase)x).Numero)).Select((Func)((ClienteTelefone x) => new TelefoneBase + { + Tipo = ((TelefoneBase)x).Tipo, + Id = ((DomainBase)x).Id, + Numero = ((TelefoneBase)x).Numero, + Prefixo = ((TelefoneBase)x).Prefixo + })).ToList()); + } + else + { + Telefones = new ObservableCollection(); + } + return; + } + Prospeccao val = await new ProspeccaoServico().BuscarProspeccao(value.IdEntidade); + Telefones = new ObservableCollection(); + if (val != null && val.Telefone1 != null) + { + Telefones.Add(new TelefoneBase + { + Tipo = (TipoTelefone)(val.Telefone1.StartsWith("9") ? 3 : 7), + Numero = val.Telefone1, + Prefixo = val.Prefixo1 + }); + } + if (val != null && val.Telefone2 != null) + { + Telefones.Add(new TelefoneBase + { + Tipo = (TipoTelefone)(val.Telefone2.StartsWith("9") ? 3 : 7), + Numero = val.Telefone2, + Prefixo = val.Prefixo2 + }); + } + } + + public async void Abrir(TipoTarefa tipo) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + switch ((int)tipo) + { + case 2: + ((Window)new HosterWindow((ContentControl)(object)new ClienteView(await CarregaCliente(SelectedTarefa.IdCliente), lockInsert: true), "CADASTRO DE CLIENTES - " + SelectedTarefa.Cliente)).Show(); + break; + case 3: + ((Window)new HosterWindow((ContentControl)(object)new ApoliceView(await CarregaApoliceParcela(SelectedTarefa.IdEntidade), lockInsert: true, invoke: false, (AcessoApolice)0, 0L), "CADASTRO DE APÓLICES - " + SelectedTarefa.Cliente + " - " + SelectedTarefa.Referencia)).Show(); + break; + case 0: + { + long num = SelectedTarefa.IdEntidade; + if ((int)SelectedTarefa.Entidade == 4) + { + Sinistro obj = await CarregaSinistroApolice(SelectedTarefa.IdEntidade); + long? obj2; + if (obj == null) + { + obj2 = null; + } + else + { + ControleSinistro controleSinistro = obj.ControleSinistro; + if (controleSinistro == null) + { + obj2 = null; + } + else + { + Item item = controleSinistro.Item; + if (item == null) + { + obj2 = null; + } + else + { + Documento documento = item.Documento; + obj2 = ((documento != null) ? new long?(((DomainBase)documento).Id) : null); + } + } + } + long? num2 = obj2; + num = num2.GetValueOrDefault(); + } + if (num != 0L) + { + ((Window)new HosterWindow((ContentControl)(object)new ApoliceView(await CarregaApolice(num), lockInsert: true, invoke: false, (AcessoApolice)0, 0L), "CADASTRO DE APÓLICES - " + SelectedTarefa.Cliente)).Show(); + } + break; + } + case 4: + { + Sinistro val = await CarregaSinistroApolice(SelectedTarefa.IdEntidade); + if (val == null) + { + await ShowMessage("SINISTRO NÃO ENCONTRADO!"); + } + else + { + ((Window)new HosterWindow((ContentControl)(object)new SinistroView(val.ControleSinistro.Item, attached: false), "CADASTRO DE SINISTROS - " + SelectedTarefa.Cliente + " - " + SelectedTarefa.Referencia)).Show(); + } + break; + } + case 1: + break; + } + } + + public async Task CriarMalaDireta(TipoTarefa tipo) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + switch ((int)tipo) + { + case 8: + return null; + case 2: + { + Cliente cliente = await CarregaCliente(SelectedTarefa.IdCliente); + return new MalaDireta + { + Cliente = cliente, + Tela = (TipoTela)1 + }; + } + case 3: + { + Documento val3 = await CarregaApoliceParcela(SelectedTarefa.IdEntidade); + return new MalaDireta + { + Cliente = val3.Controle.Cliente, + Apolice = val3, + Tela = (TipoTela)5 + }; + } + case 0: + { + Documento val2 = await CarregaApolice(SelectedTarefa.IdEntidade); + return new MalaDireta + { + Cliente = val2.Controle.Cliente, + Apolice = val2, + Tela = (TipoTela)2 + }; + } + case 4: + { + Sinistro val = await CarregaSinistroApolice(SelectedTarefa.IdEntidade); + return new MalaDireta + { + Cliente = val.ControleSinistro.Item.Documento.Controle.Cliente, + Apolice = val.ControleSinistro.Item.Documento, + Sinistro = val, + Tela = (TipoTela)7 + }; + } + case 5: + { + Prospeccao prospeccao = await CarregarProspeccao(SelectedTarefa.IdEntidade); + return new MalaDireta + { + Prospeccao = prospeccao, + Tela = (TipoTela)33 + }; + } + default: + return null; + } + } + + public async Task>> Salvar(string titulo) + { + if (SelectedTarefa == null) + { + return null; + } + DateTime networkTime = Funcoes.GetNetworkTime(); + if (Recursos.Configuracoes.All((ConfiguracaoSistema x) => (int)x.Configuracao != 45) && (int)SelectedTarefa.Status != 2 && SelectedTarefa.Agendamento < networkTime) + { + SelectedTarefa.Agendamento = networkTime; + } + if ((int)SelectedTarefa.Status == 2) + { + SelectedTarefa.Conclusao = networkTime; + } + SelectedTarefa.Responsaveis = base.Responsaveis.ToList(); + Tarefa selectedTarefa = SelectedTarefa; + ResponsavelTarefa? obj = base.Responsaveis.FirstOrDefault(); + selectedTarefa.Usuario = ((obj != null) ? obj.Usuario : null); + SelectedTarefa.AgendamentoRetroativo = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 45); + List> list = SelectedTarefa.Validate(); + string text = Funcoes.GetText(SelectedTarefa.Anotacoes); + string text2 = Funcoes.GetText(SelectedTarefa.AnotacoesInternas); + if (string.IsNullOrEmpty(text) && string.IsNullOrEmpty(text2)) + { + list.Add(new KeyValuePair("Anotações", "OBRIGATÓRIO")); + } + if (list.Count > 0) + { + return list; + } + SelectedTarefa.Anotacoes = Funcoes.AdicionarLog(SelectedTarefa.Anotacoes); + SelectedTarefa.Descricao = SelectedTarefa.Anotacoes + "

" + Descricao + "

"; + SelectedTarefa.DescricaoInterna = (string.IsNullOrWhiteSpace(SelectedTarefa.AnotacoesInternas) ? HistoricoInterno : (SelectedTarefa.AnotacoesInternas + "

" + HistoricoInterno + "

")); + SelectedTarefa.TipoDeTarefa = SelectedTipoTarefa; + SelectedTarefa.Titulo = titulo; + SelectedTarefa = await Servico.Salvar(SelectedTarefa); + if (!Servico.Sucesso) + { + return null; + } + long id = ((DomainBase)SelectedTarefa).Id; + await CarregarTarefas(); + SelectedTarefa = ((IEnumerable)TarefasFiltradas).FirstOrDefault((Func)((Tarefa x) => ((DomainBase)x).Id == id)) ?? TarefasFiltradas.FirstOrDefault(); + return null; + } + + public async Task Cancelar() + { + if (_cancelTarefa != 0L) + { + long id = _cancelTarefa; + await CarregarTarefas(); + SelectedTarefa = ((IEnumerable)TarefasFiltradas).FirstOrDefault((Func)((Tarefa x) => ((DomainBase)x).Id == id)); + Alterar(alterar: false); + } + } + + public async Task Excluir() + { + Tarefa selectedTarefa = SelectedTarefa; + if (selectedTarefa != null && ((DomainBase)selectedTarefa).Id == 0) + { + return; + } + TarefaBIViewModel tarefaBIViewModel = this; + string[] obj = new string[5] { "DESEJA REALMENTE EXCLUIR A TAREFA ", null, null, null, null }; + Tarefa selectedTarefa2 = SelectedTarefa; + obj[1] = ((selectedTarefa2 != null) ? selectedTarefa2.Titulo : null); + obj[2] = "?"; + obj[3] = Environment.NewLine; + obj[4] = "ESSE PROCEDIMENTO É IRREVERSÍVEL"; + if (await tarefaBIViewModel.ShowMessage(string.Concat(obj), "SIM", "NÃO")) + { + if (!(await Servico.Excluir(((DomainBase)SelectedTarefa).Id))) + { + Alterar(alterar: false); + return; + } + await CarregarTarefas(); + Gestor.Application.Actions.Actions.AtualizaTrilhas?.Invoke(); + Alterar(alterar: false); + } + } + + public async Task ConcluirTarefa(Tarefa tarefa) + { + if (!(await ValidaPermissaoParaEditarTarefa())) + { + await ShowMessage("VOCÊ NÃO TEM PERMISSÃO PARA EDITAR ESSA TAREFA!"); + return null; + } + return await Servico.Salvar(tarefa); + } + + public void FiltrarTarefa() + { + TarefasFiltradas = new ObservableCollection(Filtrar()); + SelectedTarefa = TarefasFiltradas.FirstOrDefault(); + } + + private List Filtrar() + { + List tarefas = Tarefas.ToList(); + FiltroTarefa.ToList().ForEach(delegate(string f) + { + tarefas = tarefas.Where((Tarefa x) => ValidationHelper.RemoveDiacritics(x.Titulo).ToUpper().Contains(ValidationHelper.RemoveDiacritics(f)) || ValidationHelper.RemoveDiacritics(x.Cliente).ToUpper().Contains(ValidationHelper.RemoveDiacritics(f)) || ValidationHelper.RemoveDiacritics(x.Referencia).ToUpper().Contains(ValidationHelper.RemoveDiacritics(f)) || x.Agendamento.ToString("d").ToUpper().Contains(ValidationHelper.RemoveDiacritics(f)) || ((DomainBase)x).Id.ToString().Contains(ValidationHelper.RemoveDiacritics(f)) || (x.TipoDeTarefa != null && ValidationHelper.RemoveDiacritics(x.TipoDeTarefa.Nome).ToUpper().Contains(ValidationHelper.RemoveDiacritics(f))) || (x.Usuario != null && x.Usuario.Nome.ToUpper().Contains(ValidationHelper.RemoveDiacritics(f)))).ToList(); + }); + return tarefas; + } + + public void AdcionarFiltro() + { + if (!string.IsNullOrEmpty(Filtro)) + { + if (FiltroTarefa == null) + { + FiltroTarefa = new ObservableCollection(); + } + FiltroTarefa.Add(Filtro); + Filtro = string.Empty; + FiltrarTarefa(); + } + } + + public void ExcluirFiltro(string filtro) + { + FiltroTarefa.Remove(filtro); + FiltrarTarefa(); + } + + public async void AbrirArquivoDigital() + { + if (SelectedTarefa.IdEntidade == 0L) + { + return; + } + FiltroArquivoDigital filtro = new FiltroArquivoDigital(); + TipoTarefa entidade = SelectedTarefa.Entidade; + switch ((int)entidade) + { + case 8: + return; + case 2: + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)1).Consultar) + { + await ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)1) + "."); + return; + } + Cliente val2 = await CarregaCliente(SelectedTarefa.IdCliente); + filtro.Id = ((DomainBase)val2).Id; + filtro.Tipo = (TipoArquivoDigital)1; + filtro.Parente = val2; + break; + } + case 3: + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)3).Consultar) + { + await ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)3) + "."); + return; + } + Parcela val5 = await CarregaParcela(SelectedTarefa.IdEntidade); + filtro.Id = ((DomainBase)val5).Id; + filtro.Tipo = (TipoArquivoDigital)3; + filtro.Parente = val5; + filtro.IdApolice = ((DomainBase)val5.Documento).Id; + break; + } + case 0: + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)2).Consultar) + { + await ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)2) + "."); + return; + } + Documento val3 = await CarregaApolice(SelectedTarefa.IdEntidade); + filtro.Id = ((DomainBase)val3).Id; + filtro.Tipo = (TipoArquivoDigital)2; + filtro.Parente = val3; + break; + } + case 4: + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)5).Consultar) + { + await ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)5) + "."); + return; + } + Sinistro val4 = await CarregaSinistroApolice(SelectedTarefa.IdEntidade); + filtro.Id = ((DomainBase)val4).Id; + filtro.Tipo = (TipoArquivoDigital)5; + filtro.Parente = val4; + filtro.IdApolice = ((DomainBase)val4.ControleSinistro.Item.Documento).Id; + break; + } + case 5: + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)11).Consultar) + { + await ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)11) + "."); + return; + } + Prospeccao val = await CarregarProspeccao(SelectedTarefa.IdEntidade); + filtro.Id = ((DomainBase)val).Id; + filtro.Tipo = (TipoArquivoDigital)11; + filtro.Parente = val; + break; + } + } + ShowDrawer(new ArquivoDigitalDrawer(filtro), 0, close: false); + } + + public async Task AlterarTarefa() + { + if (SelectedTarefa == null) + { + return; + } + if (!(await ValidaPermissaoParaEditarTarefa())) + { + await ShowMessage("VOCÊ NÃO TEM PERMISSÃO PARA EXCLUIR ESSA TAREFA!"); + return; + } + CarregarUsuarios(); + Alterar(alterar: true); + ColumnUsuarioPrincipal = (base.EnableFields ? new GridLength(0.0, (GridUnitType)1) : new GridLength(1.0, (GridUnitType)2)); + ColumnUsuarios = (base.EnableFields ? new GridLength(1.0, (GridUnitType)2) : new GridLength(0.0, (GridUnitType)1)); + ListaUsuariosResponsaveis(); + base.HasResponsaveis = true; + SelectedUsuario = null; + base.Responsaveis.ToList().ForEach(delegate(ResponsavelTarefa x) + { + Usuarios.Remove(((IEnumerable)Usuarios).FirstOrDefault((Func)((Usuario u) => ((DomainBase)u).Id == ((DomainBase)x.Usuario).Id))); + }); + } + + private void CarregarUsuarios() + { + Usuarios = new ObservableCollection((from x in Recursos.Usuarios + where (Recursos.Configuracoes.Any((ConfiguracaoSistema c) => (int)c.Configuracao == 36) || x.IdEmpresa == Recursos.Usuario.IdEmpresa) && !x.Excluido + orderby x.Nome + select x).ToList()); + } + + public async Task AdcionarResponsavel() + { + if (!(await ValidaPermissaoParaEditarTarefa())) + { + await ShowMessage("VOCÊ NÃO TEM PERMISSÃO PARA EXCLUIR ESSA TAREFA!"); + } + else if (SelectedUsuario != null) + { + base.Responsaveis.Add(new ResponsavelTarefa + { + Usuario = SelectedUsuario, + IdTarefa = ((DomainBase)SelectedTarefa).Id + }); + Usuarios.Remove(SelectedUsuario); + SelectedUsuario = null; + } + } + + public void Print() + { + string value = GerarHtml(); + string tempPath = Path.GetTempPath(); + string text = $"{tempPath}{(object)(TipoTela)38}_{Funcoes.GetNetworkTime():ddMMyyyyhhmmss}.html"; + StreamWriter streamWriter = new StreamWriter(text, append: true, Encoding.UTF8); + streamWriter.Write(value); + streamWriter.Close(); + Process.Start(text); + } + + public string GerarHtml() + { + //IL_0205: Unknown result type (might be due to invalid IL or missing references) + string text = " TAREFA
"; + text += "
"; + text += "

"; + text += "TAREFA


"; + text += ""; + int num = 0; + text = text + ""; + text = text + ""; + text = text + ""; + text = text + ""; + text = text + ""; + text = text + ""; + string[] obj = new string[6] + { + text, + ""; + text = string.Concat(obj); + text += "

CLIENTE: " + SelectedTarefa.Cliente + "

REFERÊNCIA: " + SelectedTarefa.Referencia + "

TÍTULO: " + SelectedTarefa.Titulo + "

AGENDAMENTO: " + SelectedTarefa.Agendamento.ToString() + "

RESPONSÁVEL PRINCIPAL: " + SelectedTarefa.Usuario.Nome + "

STATUS: " + ValidationHelper.GetDescription((Enum)(object)SelectedTarefa.Status) + "

TIPO DE TAREFA: ", + null, + null + }; + TipoDeTarefa selectedTipoTarefa = SelectedTipoTarefa; + obj[4] = ((selectedTipoTarefa != null) ? selectedTipoTarefa.Nome : null); + obj[5] = "

"; + if (base.Responsaveis != null && base.Responsaveis.Count > 0) + { + text += "

RESPONSÁVEIS VINCULADOS

"; + text += "
"; + text += ""; + List list = new List(); + foreach (ResponsavelTarefa responsavei in base.Responsaveis) + { + list.Add(responsavei.Usuario.Nome.Trim().ToUpper()); + } + text = text + ""; + text += "

" + string.Join(", ", list) + "

"; + text += "

"; + } + text += "

"; + if (SelectedTarefa.Descricao != null) + { + text += "

ANOTAÇÕES

"; + text += "
"; + text += ""; + text = text + ""; + text += "

" + SelectedTarefa.Descricao.Replace("", "").Replace("", "") + "

"; + text += "

"; + } + return text + "
"; + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Comissao/ComissaoViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Comissao/ComissaoViewModel.cs new file mode 100644 index 0000000..f79267f --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Comissao/ComissaoViewModel.cs @@ -0,0 +1,2497 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; +using CsQuery.ExtensionMethods; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.Servicos.Ferramentas; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Infrastructure.Helpers; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Relatorios; +using Gestor.Model.Domain.Relatorios.Extrato; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Comissao; + +public class ComissaoViewModel : BaseSegurosViewModel +{ + private readonly ServicoExtrato _servico; + + private readonly ApoliceServico _apoliceServico; + + private readonly ParcelaServico _parcelaServico; + + private readonly VendedorServico _vendedorServico; + + private bool _apelido; + + private bool _baixarVisibility; + + private bool _finalizarVisibility; + + private bool _desconsiderarVisibility; + + private bool _desfazerVisibility; + + private ObservableCollection _seguradoras = new ObservableCollection(); + + private DateTime _inicio = new DateTime(Funcoes.GetNetworkTime().Date.Year, Funcoes.GetNetworkTime().Date.Month, 1); + + private DateTime _fim = Funcoes.GetNetworkTime().Date; + + private bool _baixarPendentes = true; + + private ObservableCollection _extratos = new ObservableCollection(); + + private ObservableCollection _extratosFiltrados = new ObservableCollection(); + + private Extrato _selectedExtrato; + + private ObservableCollection _usuarios = new ObservableCollection(); + + private Usuario _selectedUsuario; + + private List _statusExtrato = new List + { + (StatusExtrato)1, + (StatusExtrato)2, + (StatusExtrato)3, + (StatusExtrato)4 + }; + + private StatusExtrato _selectedStatusExtrato = (StatusExtrato)1; + + private Seguradora _selectedSeguradora; + + private DetalheExtrato _selectedDetalhe; + + private FiltroStatusDocumento _selectedStatus; + + private Cliente _selectedCliente; + + private string _documentoPrincipal = ""; + + private ObservableCollection _detalheExtrato; + + private bool _allSelected; + + private ObservableCollection _detalheExtratoFiltrados; + + private int _quantidade; + + private decimal _totalBaixado; + + private decimal _totalPendente; + + private Visibility _isVisibleCliente = (Visibility)2; + + private Visibility _isVisibleApolice = (Visibility)2; + + private Visibility _isVisibleMensagem = (Visibility)2; + + private Visibility _isVisibleDetalhes = (Visibility)2; + + private Visibility _isVisibleExtrato = (Visibility)2; + + private bool _isExpanded = true; + + private ObservableCollection _apolices = new ObservableCollection(); + + private bool _idFatura; + + private Documento _selectedDocumento = new Documento(); + + private Parcela _selectedParcela = new Parcela(); + + private ObservableCollection _parcelas = new ObservableCollection(); + + private decimal _porcentagemExtrato; + + private decimal _porcentagem; + + private decimal _indiceTotal; + + private decimal _indice; + + private decimal _totaExtratosl; + + private decimal _total; + + private bool _criticando; + + private string _filtro = ""; + + private string _pesquisaPagamento = ""; + + private string _filtroApolice = ""; + + private ObservableCollection _filtroPersonalizado = new ObservableCollection(); + + public bool Apelido + { + get + { + return _apelido; + } + set + { + _apelido = value; + OnPropertyChanged("Apelido"); + } + } + + public bool BaixarVisibility + { + get + { + return _baixarVisibility; + } + set + { + _baixarVisibility = value; + OnPropertyChanged("BaixarVisibility"); + } + } + + public bool FinalizarVisibility + { + get + { + return _finalizarVisibility; + } + set + { + _finalizarVisibility = value; + OnPropertyChanged("FinalizarVisibility"); + } + } + + public bool DesconsiderarVisibility + { + get + { + return _desconsiderarVisibility; + } + set + { + _desconsiderarVisibility = value; + OnPropertyChanged("DesconsiderarVisibility"); + } + } + + public bool DesfazerVisibility + { + get + { + return _desfazerVisibility; + } + set + { + _desfazerVisibility = value; + OnPropertyChanged("DesfazerVisibility"); + } + } + + public ObservableCollection Seguradoras + { + get + { + return _seguradoras; + } + set + { + _seguradoras = value; + SelectedSeguradora = SelectedSeguradora ?? value.FirstOrDefault(); + OnPropertyChanged("Seguradoras"); + } + } + + public DateTime Inicio + { + get + { + return _inicio; + } + set + { + _inicio = value; + OnPropertyChanged("Inicio"); + } + } + + public DateTime Fim + { + get + { + return _fim; + } + set + { + _fim = value; + OnPropertyChanged("Fim"); + } + } + + public bool BaixarPendentes + { + get + { + return _baixarPendentes; + } + set + { + _baixarPendentes = value; + OnPropertyChanged("BaixarPendentes"); + } + } + + public ObservableCollection Extratos + { + get + { + return _extratos; + } + set + { + _extratos = value; + if (value == null || value.Count == 0) + { + DetalheExtrato = null; + DetalheExtratoFiltrados = null; + } + OnPropertyChanged("Extratos"); + } + } + + public ObservableCollection ExtratosFiltrados + { + get + { + return _extratosFiltrados; + } + set + { + _extratosFiltrados = value; + BaixarPendentes = value != null && value.Count > 0; + int enableButtons; + if (value != null && value.Count > 0) + { + Usuario usuario = Recursos.Usuario; + enableButtons = ((usuario != null && ((DomainBase)usuario).Id > 0) ? 1 : 0); + } + else + { + enableButtons = 0; + } + base.EnableButtons = (byte)enableButtons != 0; + IsVisibleExtrato = (Visibility)((value == null || value.Count <= 0) ? 2 : 0); + OnPropertyChanged("ExtratosFiltrados"); + } + } + + public Extrato SelectedExtrato + { + get + { + return _selectedExtrato; + } + set + { + _selectedExtrato = value; + IsVisibleExtrato = (Visibility)((value == null) ? 2 : 0); + OnPropertyChanged("SelectedExtrato"); + } + } + + public ObservableCollection Usuarios + { + get + { + return _usuarios; + } + set + { + _usuarios = value; + SelectedUsuario = SelectedUsuario ?? value.FirstOrDefault(); + OnPropertyChanged("Usuarios"); + } + } + + public Usuario SelectedUsuario + { + get + { + return _selectedUsuario; + } + set + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + _selectedUsuario = value; + SelecionaSeguradora(SelectedSeguradora, SelectedStatusExtrato); + OnPropertyChanged("SelectedUsuario"); + } + } + + public List Status + { + get + { + return _statusExtrato; + } + set + { + _statusExtrato = value; + OnPropertyChanged("Status"); + } + } + + public StatusExtrato SelectedStatusExtrato + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _selectedStatusExtrato; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + _selectedStatusExtrato = value; + SelecionaSeguradora(SelectedSeguradora, value); + OnPropertyChanged("SelectedStatusExtrato"); + } + } + + public Seguradora SelectedSeguradora + { + get + { + return _selectedSeguradora; + } + set + { + //IL_0015: Unknown result type (might be due to invalid IL or missing references) + _selectedSeguradora = value; + FiltroPersonalizado = new ObservableCollection(); + SelecionaSeguradora(value, SelectedStatusExtrato); + OnPropertyChanged("SelectedSeguradora"); + } + } + + public DetalheExtrato SelectedDetalhe + { + get + { + return _selectedDetalhe; + } + set + { + _selectedDetalhe = value; + OnPropertyChanged("SelectedDetalhe"); + } + } + + public FiltroStatusDocumento SelectedStatus + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _selectedStatus; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _selectedStatus = value; + WorkOnSelectedStatus(); + OnPropertyChanged("SelectedStatus"); + } + } + + public Cliente SelectedCliente + { + get + { + return _selectedCliente; + } + set + { + WorkOnSelectedCliente(value); + _selectedCliente = value; + OnPropertyChanged("SelectedCliente"); + } + } + + public string DocumentoPrincipal + { + get + { + return _documentoPrincipal; + } + set + { + _documentoPrincipal = value; + OnPropertyChanged("DocumentoPrincipal"); + } + } + + public ObservableCollection DetalheExtrato + { + get + { + return _detalheExtrato; + } + set + { + _detalheExtrato = value; + Quantidade = value?.Count ?? 0; + List status = new List + { + (StatusParcela)1, + (StatusParcela)10, + (StatusParcela)13 + }; + TotalBaixado = value?.Where((DetalheExtrato x) => x.Status.HasValue && x.ValorComissao.HasValue && status.Contains(x.Status.Value)).Sum((DetalheExtrato x) => x.ValorComissao.Value) ?? 0m; + Extrato selectedExtrato = SelectedExtrato; + TotalPendente = ((selectedExtrato != null && selectedExtrato.Bruto.HasValue) ? (SelectedExtrato.Bruto.Value - TotalBaixado) : 0m); + OnPropertyChanged("DetalheExtrato"); + } + } + + public bool AllSelected + { + get + { + return _allSelected; + } + set + { + _allSelected = value; + OnPropertyChanged("AllSelected"); + if (!_carregadoDetalhes) + { + Selecionar(value); + } + } + } + + public ObservableCollection DetalheExtratoFiltrados + { + get + { + return _detalheExtratoFiltrados; + } + set + { + _detalheExtratoFiltrados = value; + OnPropertyChanged("DetalheExtratoFiltrados"); + } + } + + public int Quantidade + { + get + { + return _quantidade; + } + set + { + _quantidade = value; + OnPropertyChanged("Quantidade"); + } + } + + public decimal TotalBaixado + { + get + { + return _totalBaixado; + } + set + { + _totalBaixado = value; + OnPropertyChanged("TotalBaixado"); + } + } + + public decimal TotalPendente + { + get + { + return _totalPendente; + } + set + { + _totalPendente = value; + OnPropertyChanged("TotalPendente"); + } + } + + public Visibility IsVisibleCliente + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _isVisibleCliente; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _isVisibleCliente = value; + OnPropertyChanged("IsVisibleCliente"); + } + } + + public Visibility IsVisibleApolice + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _isVisibleApolice; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _isVisibleApolice = value; + OnPropertyChanged("IsVisibleApolice"); + } + } + + public Visibility IsVisibleMensagem + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _isVisibleMensagem; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _isVisibleMensagem = value; + OnPropertyChanged("IsVisibleMensagem"); + } + } + + public Visibility IsVisibleDetalhes + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _isVisibleDetalhes; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _isVisibleDetalhes = value; + OnPropertyChanged("IsVisibleDetalhes"); + } + } + + public Visibility IsVisibleExtrato + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _isVisibleExtrato; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _isVisibleExtrato = value; + OnPropertyChanged("IsVisibleExtrato"); + } + } + + public bool IsExpanded + { + get + { + return _isExpanded; + } + set + { + _isExpanded = value; + OnPropertyChanged("IsExpanded"); + } + } + + private bool _carregadoDetalhes { get; set; } + + public ObservableCollection Apolices + { + get + { + return _apolices; + } + set + { + _apolices = value; + OnPropertyChanged("Apolices"); + } + } + + public ObservableCollection TodasApolices { get; set; } + + public bool IsFatura + { + get + { + return _idFatura; + } + set + { + _idFatura = value; + OnPropertyChanged("IsFatura"); + } + } + + public Documento SelectedDocumento + { + get + { + return _selectedDocumento; + } + set + { + _selectedDocumento = value; + WorkOnSelectedDocumento(value); + OnPropertyChanged("SelectedDocumento"); + } + } + + public Parcela SelectedParcela + { + get + { + return _selectedParcela; + } + set + { + _selectedParcela = value; + OnPropertyChanged("SelectedParcela"); + } + } + + public ObservableCollection Parcelas + { + get + { + return _parcelas; + } + set + { + _parcelas = value; + OnPropertyChanged("Parcelas"); + } + } + + public decimal PorcentagemExtrato + { + get + { + return _porcentagemExtrato; + } + set + { + _porcentagemExtrato = value; + OnPropertyChanged("PorcentagemExtrato"); + } + } + + public decimal Porcentagem + { + get + { + return _porcentagem; + } + set + { + _porcentagem = value; + OnPropertyChanged("Porcentagem"); + } + } + + public decimal IndiceTotal + { + get + { + return _indiceTotal; + } + set + { + _indiceTotal = value; + OnPropertyChanged("IndiceTotal"); + } + } + + public decimal Indice + { + get + { + return _indice; + } + set + { + _indice = value; + OnPropertyChanged("Indice"); + } + } + + public decimal TotalExtratos + { + get + { + return _totaExtratosl; + } + set + { + _totaExtratosl = value; + OnPropertyChanged("TotalExtratos"); + } + } + + public decimal Total + { + get + { + return _total; + } + set + { + _total = value; + OnPropertyChanged("Total"); + } + } + + public bool Buscando { get; set; } + + public bool Criticando + { + get + { + return _criticando; + } + set + { + _criticando = value; + OnPropertyChanged("Criticando"); + } + } + + private List Impostos { get; set; } = new List(); + + + private bool Carregando { get; set; } + + public string Filtro + { + get + { + return _filtro; + } + set + { + _filtro = value; + OnPropertyChanged("Filtro"); + } + } + + public string PesquisaPagamento + { + get + { + return _pesquisaPagamento; + } + set + { + _pesquisaPagamento = value; + OnPropertyChanged("PesquisaPagamento"); + } + } + + public string FiltroApolice + { + get + { + return _filtroApolice; + } + set + { + _filtroApolice = value; + OnPropertyChanged("FiltroApolice"); + } + } + + public ObservableCollection FiltroPersonalizado + { + get + { + return _filtroPersonalizado; + } + set + { + _filtroPersonalizado = value; + OnPropertyChanged("FiltroPersonalizado"); + } + } + + public ComissaoViewModel() + { + //IL_00a5: Unknown result type (might be due to invalid IL or missing references) + //IL_00b7: Unknown result type (might be due to invalid IL or missing references) + //IL_00be: Unknown result type (might be due to invalid IL or missing references) + //IL_00c5: Unknown result type (might be due to invalid IL or missing references) + //IL_00cc: Unknown result type (might be due to invalid IL or missing references) + //IL_00d3: Unknown result type (might be due to invalid IL or missing references) + //IL_00eb: Unknown result type (might be due to invalid IL or missing references) + //IL_00f5: Expected O, but got Unknown + //IL_00f6: Unknown result type (might be due to invalid IL or missing references) + //IL_0100: Expected O, but got Unknown + _servico = new ServicoExtrato(); + _apoliceServico = new ApoliceServico(); + _parcelaServico = new ParcelaServico(); + _vendedorServico = new VendedorServico(); + Apelido = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 6); + SelecionaSeguradoras(); + base.EnableMenu = true; + } + + public void SelecionaSeguradoras() + { + //IL_005c: Unknown result type (might be due to invalid IL or missing references) + //IL_0061: Unknown result type (might be due to invalid IL or missing references) + //IL_0069: Unknown result type (might be due to invalid IL or missing references) + //IL_0074: Unknown result type (might be due to invalid IL or missing references) + //IL_0084: Expected O, but got Unknown + //IL_00fd: Unknown result type (might be due to invalid IL or missing references) + //IL_0102: Unknown result type (might be due to invalid IL or missing references) + //IL_010a: Unknown result type (might be due to invalid IL or missing references) + //IL_011a: Expected O, but got Unknown + Loading(isLoading: true); + List list = (from x in Recursos.Seguradoras + where x.Ativo + orderby x.Nome + select x).ToList(); + list.Insert(0, new Seguradora + { + Id = 0L, + Nome = "TODAS AS SEGURADORAS", + NomeSocial = "TODAS DAS SEGURADORAS" + }); + List list2 = (from x in Recursos.Usuarios + where !x.Excluido + orderby x.IdEmpresa, x.Nome + select x).ToList(); + list2.Insert(0, new Usuario + { + Id = 0L, + Nome = "TODOS OS USUÁRIOS" + }); + Usuarios = new ObservableCollection(list2); + Seguradoras = new ObservableCollection(list); + Loading(isLoading: false); + } + + public async void SelecionaSeguradora(Seguradora value, StatusExtrato status, Extrato extrato = null) + { + //IL_001e: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + if (Carregando) + { + return; + } + if (Inicio > Fim) + { + await ShowMessage("DATA DE INÍCIO NÃO PODE SER MAR QUE A DATA FINAL"); + return; + } + Filtro = string.Empty; + FiltroApolice = string.Empty; + if (value == null) + { + Extratos = null; + ExtratosFiltrados = null; + DetalheExtrato = null; + DetalheExtratoFiltrados = null; + SelectedExtrato = null; + SelectedDetalhe = null; + return; + } + Loading(isLoading: true); + IsVisibleExtrato = (Visibility)2; + BaixarPendentes = (int)status == 1; + DetalheExtrato = null; + StatusExtrato status2 = (StatusExtrato)(((int)status == 2) ? 3 : ((int)status)); + List list = await _servico.BuscarExtrato(((DomainBase)value).Id, ((DomainBase)SelectedUsuario).Id, status2, Inicio, Fim); + Extratos = (((int)status == 2) ? new ObservableCollection(list.Where((Extrato x) => !x.Completo)) : (((int)status == 3) ? new ObservableCollection(list.Where((Extrato x) => x.Completo)) : new ObservableCollection(list))); + ExtratosFiltrados = Extratos; + if (FiltroPersonalizado.Count > 0) + { + FiltrarExtrato(); + } + ComissaoViewModel comissaoViewModel = this; + ObservableCollection extratosFiltrados = ExtratosFiltrados; + comissaoViewModel.IsExpanded = extratosFiltrados != null && extratosFiltrados.Count > 0; + Extrato extrato2 = ((extrato == null) ? ExtratosFiltrados.FirstOrDefault() : ((IEnumerable)ExtratosFiltrados).FirstOrDefault((Func)((Extrato x) => ((DomainBase)x).Id == ((DomainBase)extrato).Id))); + await SelecionaExtrato(extrato2); + Loading(isLoading: false); + if (SelectedSeguradora != null) + { + RegistrarAcao($"CONSULTOU COMISSÃO AUTOMÁTICA NO PERÍODO ENTRE {Inicio:d} E {Fim:d}", 0L, (TipoTela)35, string.Format("USUÁRIO IMPORTAÇÃO: {0} ({1})\nSEGURADORA: {2} ({3})\nSTATUS: {4}\nPESQUISA PERSONALIZADA: \"{5}\"", SelectedUsuario.Nome, ((DomainBase)SelectedUsuario).Id, SelectedSeguradora.Nome, ((DomainBase)SelectedSeguradora).Id, ValidationHelper.GetDescription((Enum)(object)SelectedStatusExtrato), ValidationHelper.Join((IEnumerable)FiltroPersonalizado, ", "))); + } + } + + public async void WorkOnSelectedStatus() + { + if (SelectedCliente != null && !Buscando) + { + await SelecionaCliente(SelectedCliente); + } + } + + private async void WorkOnSelectedCliente(Cliente value) + { + if (value == null || ((DomainBase)value).Id == 0L) + { + IsVisibleCliente = (Visibility)2; + IsVisibleApolice = (Visibility)2; + IsVisibleMensagem = (Visibility)2; + DocumentoPrincipal = string.Empty; + SelectedDocumento = null; + SelectedParcela = null; + return; + } + IsVisibleCliente = (Visibility)0; + if (!Buscando) + { + Loading(isLoading: true); + IsVisibleDetalhes = (Visibility)2; + } + if (!Buscando) + { + Buscando = true; + await SelecionaCliente(value); + await SelecionaDocumento(Apolices.FirstOrDefault()); + Buscando = false; + value.DocumentoPrincipal = value.DocumentoPrincipal.GetValueOrDefault(); + switch (value.DocumentoPrincipal) + { + case 0L: + DocumentoPrincipal = value.Documento ?? ""; + break; + case 1L: + DocumentoPrincipal = value.Rne ?? ""; + break; + case 2L: + DocumentoPrincipal = value.Cei ?? ""; + break; + } + IsVisibleDetalhes = (Visibility)0; + Loading(isLoading: false); + } + } + + private void WorkOnSelectedDocumento(Documento value) + { + //IL_001e: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Invalid comparison between Unknown and I4 + if (value != null && ((DomainBase)value).Id != 0L && !Buscando) + { + IsFatura = (int)value.TipoRecebimento.GetValueOrDefault() == 2; + } + } + + private void Selecionar(bool value) + { + ExtensionMethods.ForEach((IEnumerable)DetalheExtratoFiltrados, (Action)delegate(DetalheExtrato x) + { + x.Selecionado = value; + }); + } + + public async Task SelecionaExtrato(Extrato extrato) + { + if (extrato != null && ((DomainBase)extrato).Id != 0L) + { + Loading(isLoading: true); + IsVisibleDetalhes = (Visibility)2; + SelectedExtrato = extrato; + PesquisaPagamento = string.Empty; + await CarregaDetalhes(extrato); + IsVisibleDetalhes = (Visibility)0; + Loading(isLoading: false); + } + } + + private void SelecionaNormal() + { + ExtensionMethods.ForEach((IEnumerable)DetalheExtrato, (Action)delegate(DetalheExtrato detalhe) + { + //IL_000a: Unknown result type (might be due to invalid IL or missing references) + //IL_0010: Invalid comparison between Unknown and I4 + detalhe.IsNormal = (int)detalhe.SubTipo.GetValueOrDefault() == 1; + }); + } + + public async Task CarregaDetalhes(Extrato extrato) + { + if (extrato == null || ((DomainBase)extrato).Id == 0L) + { + return; + } + _carregadoDetalhes = true; + AllSelected = false; + DetalheExtrato = await _servico.BuscarDetalhes(((DomainBase)extrato).Id); + DetalheExtratoFiltrados = DetalheExtrato; + SelecionaNormal(); + _carregadoDetalhes = false; + List statusDesconsiderar = new List + { + (StatusParcela)2, + (StatusParcela)3 + }; + List statusDesfazer = new List + { + (StatusParcela)1, + (StatusParcela)13, + (StatusParcela)10 + }; + List statusBaixar = new List + { + (StatusParcela)16, + (StatusParcela)9, + (StatusParcela)14, + (StatusParcela)4, + (StatusParcela)17, + (StatusParcela)18 + }; + List statusFinalizar = new List + { + (StatusParcela)1, + (StatusParcela)13, + (StatusParcela)10, + (StatusParcela)5, + (StatusParcela)12, + (StatusParcela)6, + (StatusParcela)8 + }; + DesfazerVisibility = DetalheExtrato.Any((DetalheExtrato x) => x.Status.HasValue && statusDesfazer.Contains(x.Status.Value)); + DesconsiderarVisibility = DetalheExtrato.Any((DetalheExtrato x) => x.Status.HasValue && statusDesconsiderar.Contains(x.Status.Value)); + BaixarVisibility = DetalheExtrato.Any((DetalheExtrato x) => x.Status.HasValue && statusBaixar.Contains(x.Status.Value)); + if (SelectedExtrato != null) + { + FinalizarVisibility = DetalheExtrato.All((DetalheExtrato x) => x.Status.HasValue && statusFinalizar.Contains(x.Status.Value) && ((int)SelectedExtrato.Status == 1 || !SelectedExtrato.Completo)); + } + } + + private async Task> CarregarDetalhes(Extrato extrato) + { + return await _servico.BuscarDetalhes(((DomainBase)extrato).Id); + } + + internal async Task> FiltrarDetalhe(string value) + { + return await Task.Run(() => FiltrarDetalheExtrato(value)); + } + + public List FiltrarDetalheExtrato(string filter) + { + if (DetalheExtrato == null) + { + return null; + } + DetalheExtratoFiltrados = (string.IsNullOrWhiteSpace(filter) ? DetalheExtrato : new ObservableCollection(from x in DetalheExtrato + where ValidationHelper.RemoveDiacritics(x.Cliente).ToUpper().Contains(ValidationHelper.RemoveDiacritics(filter)) || x.Apolice.Contains(filter) || x.Endosso.Contains(filter) + orderby x.Cliente + select x)); + return DetalheExtratoFiltrados.ToList(); + } + + public List FiltrarDetalheExtrato(long id) + { + DetalheExtratoFiltrados = new ObservableCollection(DetalheExtrato.Where((DetalheExtrato x) => ((DomainBase)x).Id == id)); + return DetalheExtratoFiltrados.ToList(); + } + + public async Task BuscarCriticado(DetalheExtrato detalhe) + { + if (detalhe == null) + { + return; + } + SelectedDetalhe = DetalheExtratoFiltrados.First((DetalheExtrato x) => ((DomainBase)x).Id == ((DomainBase)detalhe).Id); + if (!SelectedDetalhe.Parcela.HasValue && !SelectedDetalhe.Documento.HasValue) + { + TodasApolices = null; + Apolices = null; + Parcelas = null; + return; + } + Buscando = true; + ParcelaServico parcelaServico = new ParcelaServico(); + Parcela parcela = null; + Documento documento = null; + if (SelectedDetalhe.Parcela.HasValue) + { + parcela = await parcelaServico.BuscarParcela(SelectedDetalhe.Parcela.Value); + if (parcela != null) + { + detalhe.Documento = ((DomainBase)parcela.Documento).Id; + documento = parcela.Documento; + } + } + if (SelectedDetalhe.Documento.HasValue && !SelectedDetalhe.Parcela.HasValue) + { + documento = await _apoliceServico.BuscarApoliceAsync(SelectedDetalhe.Documento.Value); + } + if (documento == null) + { + Buscando = false; + return; + } + SelectedCliente = documento.Controle.Cliente; + await SelecionaCliente(documento.Controle.Cliente); + SelectedDocumento = ((IEnumerable)Apolices).FirstOrDefault((Func)((Documento x) => ((DomainBase)x).Id == ((DomainBase)documento).Id)); + await SelecionaDocumento(documento); + SelecionaParcela(parcela); + Buscando = false; + } + + public async Task SelecionaCliente(Cliente value) + { + if (value == null || ((DomainBase)value).Id == 0L) + { + return; + } + ObservableCollection source = await _apoliceServico.BuscarApolicesComissao(((DomainBase)value).Id, SelectedStatus); + FiltroApolice = string.Empty; + long id = ((DomainBase)SelectedExtrato.Seguradora).Id; + List seguradoras; + if (id <= 544) + { + if (id <= 310) + { + if (id > 182) + { + if (id <= 261) + { + if (id == 216) + { + goto IL_06db; + } + if ((ulong)(id - 258) <= 3uL) + { + goto IL_0858; + } + } + else + { + if ((ulong)(id - 291) <= 1uL || id == 296) + { + goto IL_0534; + } + if (id == 310) + { + goto IL_0792; + } + } + goto IL_03ef; + } + if (id <= 93) + { + if (id == 28) + { + goto IL_041a; + } + if ((ulong)(id - 89) > 4uL) + { + goto IL_03ef; + } + seguradoras = new List { 89L, 90L, 91L, 92L, 93L }; + } + else + { + if ((ulong)(id - 112) > 1uL) + { + if (id != 182) + { + goto IL_03ef; + } + goto IL_08e2; + } + seguradoras = new List { 112L, 113L }; + } + } + else + { + if (id <= 400) + { + if (id <= 331) + { + if (id == 328) + { + goto IL_04aa; + } + if (id == 331) + { + goto IL_04e3; + } + } + else + { + if (id == 341) + { + goto IL_07d7; + } + if (id == 374) + { + goto IL_0804; + } + if (id == 400) + { + goto IL_0534; + } + } + goto IL_03ef; + } + if (id <= 480) + { + if (id == 402) + { + goto IL_0534; + } + if (id != 480) + { + goto IL_03ef; + } + seguradoras = new List + { + 475L, 476L, 477L, 478L, 479L, 480L, 481L, 482L, 483L, 484L, + 485L, 486L, 487L, 558L, 580L, 664L + }; + } + else + { + if (id != 501) + { + if (id == 543) + { + goto IL_04e3; + } + if (id != 544) + { + goto IL_03ef; + } + goto IL_0759; + } + seguradoras = new List { 498L, 499L, 500L, 501L, 502L }; + } + } + goto IL_090a; + } + if (id <= 630) + { + if (id <= 562) + { + if (id <= 552) + { + if (id == 548 || id == 552) + { + goto IL_0759; + } + } + else + { + if ((ulong)(id - 554) <= 1uL) + { + goto IL_0534; + } + if (id == 560) + { + goto IL_06db; + } + if (id == 562) + { + goto IL_04e3; + } + } + } + else if (id <= 574) + { + if (id == 570) + { + goto IL_0858; + } + if (id == 574) + { + goto IL_0534; + } + } + else + { + if (id == 578) + { + goto IL_0804; + } + long num = id - 591; + if ((ulong)num <= 7uL) + { + switch (num) + { + case 2L: + case 5L: + case 6L: + goto IL_03ef; + case 0L: + case 1L: + case 3L: + goto IL_041a; + case 4L: + goto IL_04e3; + case 7L: + goto IL_0858; + } + } + if (id == 630) + { + goto IL_0792; + } + } + } + else + { + if (id > 674) + { + if (id <= 711) + { + if (id != 694) + { + if (id != 711) + { + goto IL_03ef; + } + goto IL_04aa; + } + } + else if (id != 884) + { + if (id == 982) + { + goto IL_04e3; + } + if (id != 1006) + { + goto IL_03ef; + } + goto IL_08e2; + } + goto IL_0534; + } + if (id <= 643) + { + if (id == 631) + { + goto IL_07d7; + } + long num2 = id - 639; + if ((ulong)num2 <= 4uL) + { + switch (num2) + { + case 2L: + case 4L: + goto IL_0534; + case 0L: + goto IL_0792; + } + } + } + else + { + if (id == 649) + { + goto IL_041a; + } + if (id == 650) + { + goto IL_0792; + } + if (id == 674) + { + goto IL_0534; + } + } + } + goto IL_03ef; + IL_06db: + seguradoras = new List { 560L, 216L }; + goto IL_090a; + IL_0534: + seguradoras = new List + { + 70L, 291L, 292L, 296L, 400L, 401L, 402L, 554L, 555L, 574L, + 641L, 643L, 674L, 694L, 884L, 348L + }; + goto IL_090a; + IL_04aa: + seguradoras = new List { 328L, 329L, 711L }; + goto IL_090a; + IL_0759: + seguradoras = new List { 544L, 548L, 552L }; + goto IL_090a; + IL_0858: + seguradoras = new List { 258L, 259L, 260L, 261L, 570L, 598L, 472L, 595L, 741L, 982L }; + goto IL_090a; + IL_0804: + seguradoras = new List { 374L, 578L }; + goto IL_090a; + IL_03ef: + seguradoras = new List { ((DomainBase)SelectedExtrato.Seguradora).Id }; + goto IL_090a; + IL_090a: + TodasApolices = new ObservableCollection(from x in source + where x.Controle.Seguradora != null && seguradoras.Contains(((DomainBase)x.Controle.Seguradora).Id) + orderby x.Vigencia2, ((DomainBase)x.Controle).Id + select x); + Apolices = TodasApolices; + IsVisibleApolice = (Visibility)((TodasApolices.Count <= 0) ? 2 : 0); + IsVisibleMensagem = (Visibility)((TodasApolices.Count > 0) ? 2 : 0); + return; + IL_041a: + seguradoras = new List { 28L, 591L, 592L, 594L, 649L }; + goto IL_090a; + IL_04e3: + seguradoras = new List { 331L, 543L, 562L, 595L, 982L }; + goto IL_090a; + IL_07d7: + seguradoras = new List { 341L, 631L }; + goto IL_090a; + IL_0792: + seguradoras = new List { 310L, 630L, 639L, 650L }; + goto IL_090a; + IL_08e2: + seguradoras = new List { 182L, 1006L }; + goto IL_090a; + } + + public async Task SelecionaDocumento(Documento value) + { + if (value != null && ((DomainBase)value).Id != 0L) + { + SelectedDocumento = ((IEnumerable)Apolices).FirstOrDefault((Func)((Documento x) => ((DomainBase)x).Id == ((DomainBase)value).Id)); + Parcelas = await _parcelaServico.BuscarParcelasAsync(((DomainBase)value).Id); + } + } + + public void SelecionaParcela(Parcela value) + { + if (value != null && ((DomainBase)value).Id != 0L) + { + SelectedParcela = ((IEnumerable)Parcelas).FirstOrDefault((Func)((Parcela x) => ((DomainBase)x).Id == ((DomainBase)value).Id)); + } + } + + public async Task AtualizarExtrato() + { + if (DetalheExtratoFiltrados == null || DetalheExtratoFiltrados.Count == 0) + { + return; + } + if (DetalheExtratoFiltrados.All((DetalheExtrato x) => !x.Selecionado)) + { + await ShowMessage("NECESSÁRIO SELECIONAR QUAL PARCELA DESEJA ATUALIZAR."); + return; + } + Loading(isLoading: true); + IsVisibleDetalhes = (Visibility)2; + base.IsVisible = (Visibility)2; + await _parcelaServico.UpdateDetalhes(DetalheExtratoFiltrados.Where((DetalheExtrato x) => x.Selecionado).ToList()); + base.IsVisible = (Visibility)0; + IsVisibleDetalhes = (Visibility)0; + Loading(isLoading: false); + RegistrarAcao($"ATUALIZOU EXTRATO DE ID \n{((DomainBase)SelectedExtrato).Id}\n", ((DomainBase)SelectedExtrato).Id, (TipoTela)35); + ToggleSnackBar("EXTRATO ATUALIZADO COM SUCESSO"); + } + + public async Task Criticar(DetalheExtrato detalhe, bool critica) + { + if (detalhe == null || (SelectedDocumento == null && critica)) + { + return; + } + Loading(isLoading: true); + IsVisibleDetalhes = (Visibility)2; + List detalhesVinculados = new List(); + if (!critica) + { + detalhe.Status = (StatusParcela)6; + detalhe.Documento = null; + detalhe.Parcela = null; + goto IL_0484; + } + bool flag = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 12); + SubTipo? subTipo = detalhe.SubTipo; + if (subTipo.HasValue) + { + SubTipo valueOrDefault = subTipo.GetValueOrDefault(); + if ((int)valueOrDefault <= 1) + { + Parcela ultimaBaixa = ((IEnumerable)Parcelas).FirstOrDefault((Func)((Parcela x) => !x.DataRecebimento.HasValue)); + detalhe.Status = (StatusParcela)((ultimaBaixa != null && ultimaBaixa.NumeroParcela < SelectedParcela.NumeroParcela) ? 7 : (SelectedParcela.DataRecebimento.HasValue ? 5 : 14)); + detalhe.Documento = ((DomainBase)SelectedDocumento).Id; + detalhe.Parcela = ((DomainBase)SelectedParcela).Id; + detalhesVinculados = (from x in DetalheExtrato + where x.Cliente == detalhe.Cliente && x.Apolice == detalhe.Apolice && x.NumeroParcela != detalhe.NumeroParcela && (int)x.SubTipo.GetValueOrDefault() == 1 && ((int)x.Status.GetValueOrDefault() == 2 || (int)x.Status.GetValueOrDefault() == 3) + orderby x.NumeroParcela + select x).ToList(); + bool flag2 = detalhesVinculados.Count > 0; + if (flag2) + { + flag2 = await ShowMessage("DESEJA CRITICAR AUTOMATICAMENTE AS PRÓXIMAS PARCELAS DESTE DOCUMENTO?", "SIM", "NÃO"); + } + if (flag2) + { + detalhesVinculados.ForEach(delegate(DetalheExtrato x) + { + if (int.TryParse(x.NumeroParcela, out var _)) + { + Parcela val = ((IEnumerable)Parcelas).FirstOrDefault((Func)((Parcela p) => p.NumeroParcela == int.Parse(x.NumeroParcela))); + if (val != null) + { + x.Status = (StatusParcela)((ultimaBaixa != null && ultimaBaixa.NumeroParcela < val.NumeroParcela) ? 7 : (val.DataRecebimento.HasValue ? 5 : 14)); + x.Documento = ((DomainBase)SelectedDocumento).Id; + x.Parcela = ((DomainBase)val).Id; + } + } + }); + } + else + { + detalhesVinculados = null; + } + goto IL_0484; + } + } + detalhe.Status = (StatusParcela)((SelectedParcela == null || (!flag && (int)SelectedParcela.SubTipo == 1)) ? 17 : (SelectedParcela.DataRecebimento.HasValue ? 5 : 14)); + detalhe.Documento = ((DomainBase)SelectedDocumento).Id; + DetalheExtrato obj = detalhe; + if (SelectedParcela == null || ((DomainBase)SelectedParcela).Id == 0L) + { + goto IL_0225; + } + if (!flag) + { + Parcela selectedParcela = SelectedParcela; + if (selectedParcela != null && (int)selectedParcela.SubTipo == 1) + { + goto IL_0225; + } + } + long? parcela = ((DomainBase)SelectedParcela).Id; + goto IL_022e; + IL_0484: + await _servico.Save(detalhe); + if (!_servico.Sucesso) + { + Loading(isLoading: false); + return; + } + if (detalhesVinculados != null && detalhesVinculados.Count > 0) + { + foreach (DetalheExtrato item in detalhesVinculados) + { + await _servico.Save(item); + if (!_servico.Sucesso) + { + return; + } + } + } + await CarregaDetalhes(SelectedExtrato); + IsVisibleDetalhes = (Visibility)0; + Loading(isLoading: false); + ToggleSnackBar("CRÍTICA REALIZADA COM SUCESSO"); + string arg = ((SelectedParcela == null) ? "ESPECIAL" : SelectedParcela.NumeroParcela.ToString()); + RegistrarAcao(string.Format("{0} PARCELA NÚMERO \"{1}\" DO EXTRATO NÚMERO \n{2}\n, ID {3}", critica ? "CRITICOU" : "DESCONSIDEROU", detalhe.NumeroParcela, detalhe.Extrato.Numero, ((DomainBase)detalhe.Extrato).Id), ((DomainBase)SelectedExtrato).Id, (TipoTela)35, critica ? $"CRITICOU A PARCELA \"{arg}\" DO DOCUMENTO DE ID \n{((DomainBase)SelectedDocumento).Id}\n" : ""); + return; + IL_0225: + parcela = null; + goto IL_022e; + IL_022e: + obj.Parcela = parcela; + goto IL_0484; + } + + public async Task BaixarExtrato(bool selecionados = false) + { + if (DetalheExtrato == null || DetalheExtrato.Count == 0) + { + return; + } + if (DetalheExtrato.ToList().All((DetalheExtrato x) => (int)x.Status.GetValueOrDefault() == 6)) + { + SelectedExtrato.Status = (StatusExtrato)3; + await _servico.Save(SelectedExtrato); + if (_servico.Sucesso) + { + SelectedStatusExtrato = (StatusExtrato)3; + await SelecionaExtrato(SelectedExtrato); + ToggleSnackBar("TODAS AS PARCELAS FORAM DESCONSIDERADAS PELO USUARIO"); + } + return; + } + StatusExtrato extrato = SelectedExtrato.Status; + List extrato2 = (selecionados ? DetalheExtrato.Where((DetalheExtrato x) => x.Selecionado).ToList() : DetalheExtrato.ToList()); + await BaixarComissao(extrato2, selecionados); + RegistrarAcao($"BAIXOU EXTRATO DE ID \n{((DomainBase)SelectedExtrato).Id}\n", ((DomainBase)SelectedExtrato).Id, (TipoTela)35); + if ((int)SelectedExtrato.Status != 3) + { + SelectedStatusExtrato = SelectedExtrato.Status; + } + SelectedExtrato = null; + SelecionaSeguradora(SelectedSeguradora, extrato); + ToggleSnackBar("EXTRATO BAIXADO COM SUCESSO"); + } + + private static VendedorParcela PropriaCorretora() + { + //IL_002a: Unknown result type (might be due to invalid IL or missing references) + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0036: Unknown result type (might be due to invalid IL or missing references) + //IL_004a: Unknown result type (might be due to invalid IL or missing references) + //IL_0051: Unknown result type (might be due to invalid IL or missing references) + //IL_0065: Unknown result type (might be due to invalid IL or missing references) + //IL_0095: Expected O, but got Unknown + Vendedor vendedor = ((IEnumerable)Recursos.Vendedores).FirstOrDefault((Func)((Vendedor x) => x.IdEmpresa == ((DomainBase)Recursos.Empresa).Id && x.Corretora)); + return new VendedorParcela + { + Repasse = null, + ValorRepasse = default(decimal), + Vendedor = vendedor, + PorcentagemRepasse = default(decimal), + TipoVendedor = Recursos.TipoVendedor.First((TipoVendedor x) => ((DomainBase)x).Id == 1) + }; + } + + private async Task BaixarComissao(List extrato, bool selecionados = false) + { + _ = 3; + try + { + List status = new List + { + (StatusParcela)9, + (StatusParcela)14, + (StatusParcela)16, + (StatusParcela)4, + (StatusParcela)17, + (StatusParcela)15, + (StatusParcela)7, + (StatusParcela)18 + }; + List statusAproximacao = new List + { + (StatusParcela)16, + (StatusParcela)18 + }; + bool flag = !selecionados && DetalheExtrato.ToList().Any((DetalheExtrato x) => statusAproximacao.Contains(x.Status.Value)); + if (flag) + { + flag = !(await ShowMessage("O EXTRATO CONTÉM PARCELAS ENCONTRADAS POR APROXIMAÇÃO, DESEJA BAIXÁ-LAS?", "SIM", "NÃO")); + } + if (flag) + { + extrato = extrato.Where((DetalheExtrato parcela) => !statusAproximacao.Contains(parcela.Status.Value)).ToList(); + } + List source = extrato.Where((DetalheExtrato x) => x.Status.HasValue && status.Contains(x.Status.Value)).ToList(); + if (!source.Any()) + { + SelectedExtrato.Status = (StatusExtrato)3; + await _servico.Save(SelectedExtrato); + if (_servico.Sucesso) + { + await ShowMessage("NÃO HÁ PARCELAS A BAIXAR NESSE EXTRATO"); + } + return; + } + await BaixarExtrato((from x in source + orderby x.Cliente, x.Apolice, x.Endosso, ValidationHelper.ToInt(x.NumeroParcela) + select x).ToList()); + } + catch (Exception) + { + } + } + + private async Task CarregarImpostos() + { + Impostos = (await new ImpostoServico().Buscar(true)) ?? new List(); + } + + public Imposto CarregarImposto(Documento documento) + { + //IL_008c: Unknown result type (might be due to invalid IL or missing references) + object obj = ((IEnumerable)Impostos).FirstOrDefault((Func)((Imposto x) => x.Seguradora != null && ((DomainBase)x.Seguradora).Id == ((DomainBase)documento.Controle.Seguradora).Id && x.Ramo != null && ((DomainBase)x.Ramo).Id == ((DomainBase)documento.Controle.Ramo).Id)) ?? ((IEnumerable)Impostos).FirstOrDefault((Func)((Imposto x) => x.Seguradora != null && ((DomainBase)x.Seguradora).Id == ((DomainBase)documento.Controle.Seguradora).Id && x.Ramo == null)); + if (obj == null) + { + obj = ((IEnumerable)Impostos).FirstOrDefault((Func)((Imposto x) => x.Seguradora == null && x.Ramo != null && ((DomainBase)x.Ramo).Id == ((DomainBase)documento.Controle.Ramo).Id)); + } + if (obj == null) + { + obj = ((IEnumerable)Impostos).FirstOrDefault((Func)((Imposto x) => x.Seguradora == null && x.Ramo == null)); + } + if (obj == null) + { + obj = (object)new Imposto(); + } + return (Imposto)obj; + } + + private async Task BaixarExtrato(List baixar) + { + bool atualizarDocumento = true; + await CarregarImpostos(); + _apoliceServico.Sucesso = true; + _servico.Sucesso = true; + Porcentagem = 0m; + Indice = 0m; + Total = baixar.Count; + List list = (from x in baixar + where x.Documento.HasValue + select x.Documento.Value).ToList(); + List parcelasId = (from x in baixar + where !x.Documento.HasValue && x.Parcela.HasValue + select x.Parcela.Value).ToList(); + List list2 = ((list.Count <= 0) ? new List() : (await _apoliceServico.BuscarApolicesPorId(list))); + List documentos = list2; + if (parcelasId.Count > 0) + { + List list3 = documentos; + list3.AddRange(await _apoliceServico.BuscarApolicesPorIdParcela(parcelasId)); + } + List todasParcelas = await _parcelaServico.BuscarTodasParcelas(documentos.Select((Documento x) => ((DomainBase)x).Id).ToList()); + todasParcelas.ForEach(delegate(Parcela p) + { + p.Documento = documentos.Find((Documento d) => ((DomainBase)d).Id == ((DomainBase)p.Documento).Id); + }); + foreach (DetalheExtrato x2 in baixar) + { + if (!x2.Documento.HasValue && !x2.Parcela.HasValue) + { + x2.Status = (StatusParcela)2; + await _servico.Save(x2); + continue; + } + Indice++; + Porcentagem = Indice * 100m / Total; + bool criada = false; + Documento documento = null; + if (x2.Documento.HasValue && x2.Documento > 0) + { + documento = documentos.Find((Documento d) => ((DomainBase)d).Id == x2.Documento.Value); + } + if (documento.Excluido) + { + x2.Status = (StatusParcela)2; + await _servico.Save(x2); + continue; + } + if (documento != null && (int)documento.TipoRecebimento.GetValueOrDefault() == 1 && documento.Comissao == 0m && x2.Parcela.HasValue && x2.Parcela != 999) + { + Documento obj = documento; + if (obj != null && obj.Ordem == 0) + { + continue; + } + } + bool baixado = true; + List parcelas2 = (x2.Documento.HasValue ? (from p in todasParcelas + where ((DomainBase)p.Documento).Id == x2.Documento.Value + orderby p.NumeroParcela + select p).ToList() : null); + Parcela parcela; + if (!x2.Parcela.HasValue) + { + List list4 = ((parcelas2.Count <= 0) ? (await _vendedorServico.BuscaRepasse(x2.Documento.Value)) : (await _vendedorServico.BuscaRepasseParcela(((DomainBase)parcelas2.First()).Id))); + List list5 = list4; + Imposto val = CarregarImposto(documento); + decimal num = x2.ValorComissao.GetValueOrDefault() * val.Ir; + decimal num2 = x2.ValorComissao.GetValueOrDefault() * val.Iss; + decimal num3 = x2.ValorComissao.GetValueOrDefault() * val.Outros; + decimal num4 = x2.ValorComissao.GetValueOrDefault() * val.Desconto; + decimal valorComDesconto = x2.ValorComissao.GetValueOrDefault() - (num + num2 + num3 + num4); + DateTime? dateTime = (((int)documento.TipoRecebimento.GetValueOrDefault() == 1) ? null : ((!x2.Recebimento.HasValue) ? SelectedExtrato.Data : x2.Recebimento)); + decimal obj3; + if ((int)documento.TipoRecebimento.GetValueOrDefault() != 1) + { + Parcela? obj2 = parcelas2.FirstOrDefault(); + obj3 = ((obj2 != null) ? obj2.Comissao : x2.Comissao.GetValueOrDefault(100m)); + } + else + { + obj3 = 100m; + } + decimal num5 = obj3; + if (num5 == 100m && x2.Valor.HasValue && x2.Comissao.HasValue && x2.ValorComissao.HasValue) + { + decimal value = (x2.Valor * (x2.Comissao / (decimal?)100)).Value; + decimal value2 = x2.ValorComissao.Value; + if (Math.Truncate(value) == Math.Truncate(value2)) + { + DetalheExtrato obj4 = x2; + num5 = ((obj4 != null) ? obj4.Comissao : null).Value; + } + } + Parcela val2 = new Parcela + { + Documento = documento, + Vencimento = Funcoes.GetNetworkTime().Date, + Comissao = num5, + SubTipo = (SubTipo)(((int)documento.TipoRecebimento.GetValueOrDefault() != 1) ? 1 : ((int)x2.SubTipo.GetValueOrDefault((SubTipo)3))) + }; + int numeroParcela; + if ((int)documento.TipoRecebimento.GetValueOrDefault() != 1) + { + List list6 = parcelas2; + int? obj5; + if (list6 == null) + { + obj5 = null; + } + else + { + Parcela? obj6 = list6.LastOrDefault(); + obj5 = ((obj6 != null) ? new int?(obj6.NumeroParcela) : null); + } + int? num6 = obj5; + numeroParcela = num6.GetValueOrDefault() + 1; + } + else + { + numeroParcela = 999; + } + val2.NumeroParcela = numeroParcela; + val2.Valor = x2.Valor.GetValueOrDefault(); + val2.ValorRealizado = x2.Valor.GetValueOrDefault(); + val2.ValorComissao = x2.ValorComissao.GetValueOrDefault(); + val2.Irr = num; + val2.Iss = num2; + val2.Outros = num3; + val2.Desconto = num4; + val2.ValorComDesconto = valorComDesconto; + val2.DataRecebimento = SelectedExtrato.Data; + val2.DataCredito = SelectedExtrato.DataCredito ?? SelectedExtrato.Data; + val2.Fatura = (((int)documento.TipoRecebimento.GetValueOrDefault() == 1) ? "" : x2.Endosso); + val2.Emissao = dateTime; + val2.VigenciaIncial = dateTime; + val2.VigenciaFinal = (((int)documento.TipoRecebimento.GetValueOrDefault() == 1) ? null : dateTime?.AddMonths(1)); + val2.Extrato = x2.Extrato.Numero; + val2.DataCriacao = DateTime.Now; + parcela = val2; + if (documento.Ordem > 0) + { + VendedorServico vendedorServico = _vendedorServico; + list5 = Funcoes.DistinctBy(await vendedorServico.BuscaRepasse(((DomainBase)(await _apoliceServico.BuscarControleAsync(((DomainBase)documento.Controle).Id)).Documentos.First((Documento d) => d.Ordem == 0)).Id), (VendedorParcela v) => v.TipoVendedor).ToList(); + } + if (list5 != null) + { + ExtensionMethods.ForEach(list5.Where((VendedorParcela v) => v.Repasse != null), (Action)delegate(VendedorParcela v) + { + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_002f: Invalid comparison between Unknown and I4 + //IL_005c: Unknown result type (might be due to invalid IL or missing references) + //IL_0061: Unknown result type (might be due to invalid IL or missing references) + //IL_0062: Unknown result type (might be due to invalid IL or missing references) + //IL_0064: Unknown result type (might be due to invalid IL or missing references) + //IL_007e: Expected I4, but got Unknown + //IL_00ae: Unknown result type (might be due to invalid IL or missing references) + //IL_00b4: Invalid comparison between Unknown and I4 + //IL_00fd: Unknown result type (might be due to invalid IL or missing references) + //IL_0103: Invalid comparison between Unknown and I4 + //IL_0134: Unknown result type (might be due to invalid IL or missing references) + //IL_013a: Invalid comparison between Unknown and I4 + ((DomainBase)v).Id = 0L; + decimal value3 = Funcoes.CalculaRepasse(v.Repasse, parcela, apolice: false); + if ((int)v.Repasse.Forma.GetValueOrDefault() == 1) + { + v.DataPrePagamento = parcela.DataRecebimento; + } + switch (v.Repasse.Base) + { + case 2L: + v.DataPrePagamento = parcela.Vencimento; + break; + case 0L: + v.DataPrePagamento = (((int)documento.TipoRecebimento.GetValueOrDefault() == 2) ? parcela.VigenciaIncial : new DateTime?(documento.Vigencia1)); + break; + case 1L: + v.DataPrePagamento = parcela.DataCriacao; + break; + case 3L: + v.DataPrePagamento = (((int)documento.TipoRecebimento.GetValueOrDefault() == 2) ? parcela.Emissao : documento.Emissao); + break; + case 4L: + v.DataPrePagamento = (((int)documento.TipoRecebimento.GetValueOrDefault() == 2) ? parcela.Emissao : documento.Remessa); + break; + } + v.ValorRepasse = value3; + v.ValorTotal = value3; + v.DataPagamento = null; + }); + } + if (list5 == null || list5.Count == 0) + { + list5 = new List { PropriaCorretora() }; + } + if ((int)parcela.Documento.TipoRecebimento.GetValueOrDefault() == 1) + { + parcela.Vendedores = new ObservableCollection(list5); + parcela.Extrato = x2.Extrato.Numero; + parcela = await _parcelaServico.Save(parcela, Parcelas.ToList(), list5); + if (!_parcelaServico.Sucesso) + { + return; + } + x2.Parcela = ((DomainBase)parcela).Id; + criada = true; + } + } + if (!criada) + { + if (!x2.Parcela.HasValue) + { + continue; + } + parcela = todasParcelas.Find((Parcela p) => ((DomainBase)p).Id == x2.Parcela.Value); + if (parcela == null) + { + continue; + } + x2.Documento = ((DomainBase)parcela.Documento).Id; + if (parcela.DataRecebimento.HasValue) + { + x2.Status = (StatusParcela)5; + await _servico.Save(x2); + continue; + } + List list7 = await _vendedorServico.BuscaRepasseParcela(((DomainBase)parcela).Id); + Imposto val3 = CarregarImposto(documento); + decimal num7 = x2.ValorComissao.GetValueOrDefault() * val3.Ir; + decimal num8 = x2.ValorComissao.GetValueOrDefault() * val3.Iss; + decimal num9 = x2.ValorComissao.GetValueOrDefault() * val3.Outros; + decimal num10 = x2.ValorComissao.GetValueOrDefault() * val3.Desconto; + decimal valorComDesconto2 = x2.ValorComissao.GetValueOrDefault() - (num7 + num8 + num9 + num10); + parcela.ValorRealizado = x2.Valor.GetValueOrDefault(); + parcela.ValorComissao = x2.ValorComissao.GetValueOrDefault(); + parcela.Irr = num7; + parcela.Iss = num8; + parcela.Outros = num9; + parcela.Desconto = num10; + parcela.ValorComDesconto = valorComDesconto2; + parcela.DataRecebimento = SelectedExtrato.Data; + parcela.DataCredito = SelectedExtrato.DataCredito ?? SelectedExtrato.Data; + parcela.Extrato = SelectedExtrato.Numero; + parcela.Vendedores = new ObservableCollection(list7); + documento = parcela.Documento; + parcelas2 = parcelas2 ?? (from p in todasParcelas + where ((DomainBase)p.Documento).Id == ((DomainBase)documento).Id + orderby p.NumeroParcela + select p).ToList(); + parcelas2.ForEach(delegate(Parcela p) + { + if (((DomainBase)p).Id == ((DomainBase)parcela).Id) + { + p.ValorRealizado = parcela.ValorRealizado; + p.ValorComissao = parcela.ValorComissao; + p.Irr = parcela.Irr; + p.Iss = parcela.Iss; + p.Outros = parcela.Outros; + p.Desconto = parcela.Desconto; + p.ValorComDesconto = parcela.ValorComDesconto; + p.DataRecebimento = parcela.DataRecebimento; + p.DataCredito = parcela.DataCredito ?? parcela.DataRecebimento; + p.Extrato = parcela.Extrato; + } + }); + bool flag = true; + if ((int)parcela.SubTipo == 1) + { + Parcela val4 = ((IEnumerable)parcelas2).FirstOrDefault((Func)((Parcela p) => !p.DataRecebimento.HasValue)); + if (val4 != null && val4.NumeroParcela < parcela.NumeroParcela) + { + x2.Status = (StatusParcela)7; + flag = false; + baixado = false; + } + } + if (flag) + { + if (!(await Funcoes.BaixarComissao(parcela, parcelas2, parcela.Vendedores.ToList(), parcela.Documento.Controle.Seguradora.Tolerancia.GetValueOrDefault(), comissaoAuto: true)).DataRecebimento.HasValue) + { + continue; + } + Documento documento2 = parcela.Documento; + string descricao = ((documento2 != null && (int)documento2.TipoRecebimento.GetValueOrDefault() == 1) ? $"PARCELA {parcela.NumeroParcela} BAIXADA POR COMISSÃO AUTOMÁTICA, EXTRATO {x2.Extrato.Numero}" : ("FATURA " + parcela.Fatura + " BAIXADA POR COMISSÃO AUTOMÁTICA, EXTRATO " + x2.Extrato.Numero)); + RegistroAcao log = new RegistroAcao + { + Descricao = descricao, + EntidadeId = ((DomainBase)parcela).Id, + Tela = (TipoTela)35 + }; + string text = ((documento.Tipo == 0) ? ("APÓLICE: " + x2.Apolice) : (((int)documento.TipoRecebimento.GetValueOrDefault() == 2) ? ("APÓLICE: " + x2.Apolice + Environment.NewLine + "FATURA: " + x2.Endosso) : ("APÓLICE: " + x2.Apolice + Environment.NewLine + "ENDOSSO: " + x2.Endosso))); + string obs = $"CLIENTE: {x2.Cliente}{Environment.NewLine}{text}{Environment.NewLine}PARCELA: {x2.NumeroParcela}, VALOR: {x2.Valor:c2} COMISSÃO: {x2.Comissao:N2}% VALOR COMISSÃO: {x2.ValorComissao:c2}"; + _parcelaServico.SalvarAcao(log, obs); + } + } + if (x2.Corrigir && !(await _apoliceServico.AtualizarNumero(((DomainBase)documento).Id, x2.Apolice, x2.Endosso, documento.Tipo))) + { + atualizarDocumento = false; + } + StatusParcela? status = x2.Status; + if (!status.HasValue) + { + goto IL_19b4; + } + StatusParcela valueOrDefault = status.GetValueOrDefault(); + if ((int)valueOrDefault != 4) + { + if ((int)valueOrDefault != 14) + { + goto IL_19b4; + } + x2.Status = (StatusParcela)13; + } + else + { + x2.Status = (StatusParcela)10; + } + goto IL_1a7e; + IL_19b4: + x2.Status = (baixado ? new StatusParcela?((StatusParcela)1) : x2.Status); + goto IL_1a7e; + IL_1a7e: + await _servico.Save(x2); + if (!_servico.Sucesso) + { + return; + } + } + SelectedExtrato.Status = (StatusExtrato)3; + await _servico.Save(SelectedExtrato); + if (!atualizarDocumento) + { + await ShowMessage("OCORREU UM ERRO AO ATUALIZAR O NÚMERO DA APÓLICE/ENDOSSO DOS DOCUMENTOS BAIXADOS."); + } + } + + internal async Task> FiltrarApolices(string value) + { + return await Task.Run(() => FiltrarDocumento(value)); + } + + public List FiltrarDocumento(string filter) + { + Apolices = (string.IsNullOrWhiteSpace(filter) ? TodasApolices : new ObservableCollection(TodasApolices.Where((Documento x) => (x.Apolice != null && x.Apolice.ToUpper().Contains(filter.ToUpper())) || (x.Endosso != null && x.Endosso.ToUpper().Contains(filter.ToUpper())) || x.Vigencia1.ToString("d").Contains(filter) || (x.Vigencia2.HasValue && x.Vigencia2.Value.ToString("d").Contains(filter))))); + SelectedDocumento = null; + SelectedParcela = null; + return Apolices?.ToList(); + } + + public async Task BaixarTodosExtratos() + { + if (Extratos == null || Extratos.Count == 0) + { + return; + } + StatusExtrato statusAtual = Extratos[0].Status; + PorcentagemExtrato = 0m; + IndiceTotal = 0m; + TotalExtratos = Extratos.Count; + List status = new List + { + (StatusParcela)9, + (StatusParcela)14, + (StatusParcela)16, + (StatusParcela)4, + (StatusParcela)17, + (StatusParcela)15, + (StatusParcela)18 + }; + await Task.Run(async delegate + { + foreach (Extrato extrato in Extratos.OrderBy((Extrato x) => x.Data)) + { + decimal indiceTotal = IndiceTotal; + IndiceTotal = indiceTotal + 1m; + PorcentagemExtrato = IndiceTotal * 100m / TotalExtratos; + List source = (await CarregarDetalhes(extrato)).Where((DetalheExtrato x) => x.Status.HasValue && status.Contains(x.Status.Value)).ToList(); + SelectedExtrato = extrato; + await BaixarExtrato((from x in source + orderby x.Cliente, x.Apolice, x.Endosso, x.NumeroParcela + select x).ToList()); + } + }); + SelecionaSeguradora(SelectedSeguradora, statusAtual); + ToggleSnackBar("EXTRATOS BAIXADOS COM SUCESSO"); + } + + public async Task ExcluirExtrato() + { + if (SelectedExtrato == null) + { + return; + } + List status = new List + { + (StatusParcela)1, + (StatusParcela)10, + (StatusParcela)13 + }; + try + { + if (DetalheExtrato.Any((DetalheExtrato x) => x.Status.HasValue && status.Contains(x.Status.Value))) + { + await ShowMessage("O EXTRATO NÃO PODE SER EXCLUÍDO POIS FOI UTILIZADO PARA BAIXAR PARCELAS, DESFAÇA O EXTRATO ANTES DE EXCLUÍ-LO"); + } + else if (await _servico.Delete(SelectedExtrato)) + { + RegistrarAcao($"EXCLUIU EXTRATO DE ID \n{((DomainBase)SelectedExtrato).Id}\n", ((DomainBase)SelectedExtrato).Id, (TipoTela)35); + SelectedExtrato = null; + SelecionaSeguradora(SelectedSeguradora, (StatusExtrato)1); + ToggleSnackBar("EXTRATO EXCLUÍDO COM SUCESSO"); + } + } + catch (Exception) + { + } + } + + public async Task DesfazerParcela(DetalheExtrato detalhe) + { + DetalheExtrato obj = detalhe; + if (obj == null || !obj.Parcela.HasValue) + { + return false; + } + try + { + Parcela parcela = await _parcelaServico.BuscarParcela(detalhe.Parcela.Value); + if (parcela == null) + { + detalhe.Documento = null; + detalhe.Parcela = null; + detalhe.Status = (StatusParcela)2; + await _servico.Save(detalhe); + return false; + } + detalhe.Documento = ((DomainBase)parcela.Documento).Id; + parcela.Extrato = null; + List parcelas = await _parcelaServico.BuscarParcelas(detalhe.Documento.Value); + Parcela ultimaBaixa = ((IEnumerable)parcelas.OrderByDescending((Parcela p) => p.NumeroParcela)).FirstOrDefault((Func)((Parcela p) => p.DataRecebimento.HasValue && (int)p.SubTipo == 1)); + bool flag = await _parcelaServico.TemPagamento(((DomainBase)parcela).Id); + if ((int)parcela.Documento.TipoRecebimento.GetValueOrDefault() == 1 || !Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 28)) + { + flag = flag || (ultimaBaixa != null && ultimaBaixa.NumeroParcela > parcela.NumeroParcela); + } + if (flag && !parcela.Documento.Excluido) + { + return false; + } + await Funcoes.ExcluirBaixa(parcela, await _vendedorServico.BuscaRepasse(detalhe.Documento.Value), parcelas); + Parcela val = ((IEnumerable)parcelas).FirstOrDefault((Func)((Parcela x) => x.NumeroParcela == int.Parse(detalhe.NumeroParcela) - 1)); + DetalheExtrato obj2 = detalhe; + int num; + if (val == null || val.DataRecebimento.HasValue) + { + if ((int)detalhe.Status.GetValueOrDefault() != 13) + { + if (detalhe.Comissao.HasValue) + { + decimal comissao = parcela.Documento.Comissao; + decimal? comissao2 = detalhe.Comissao; + if (!((comissao == comissao2.GetValueOrDefault()) & comissao2.HasValue)) + { + num = 4; + goto IL_0578; + } + } + num = 9; + } + else + { + num = 14; + } + } + else + { + num = 7; + } + goto IL_0578; + IL_0578: + obj2.Status = (StatusParcela)num; + await _servico.Save(detalhe); + return true; + } + catch (Exception e) + { + new BaseServico().Registrar(e, (TipoErro)292, 3, detalhe); + return false; + } + } + + public async Task DesfazerExtrato() + { + if (DetalheExtrato == null || DetalheExtrato.Count == 0) + { + return; + } + List status = new List + { + (StatusParcela)1, + (StatusParcela)10, + (StatusParcela)12, + (StatusParcela)13 + }; + List detalhes = DetalheExtrato.Where((DetalheExtrato x) => x.Status.HasValue && status.Contains(x.Status.Value)).ToList(); + if (detalhes.Count == 0) + { + await ShowMessage("NÃO HÁ PARCELAS PARA SEREM DESFEITAS NO EXTRATO"); + return; + } + Porcentagem = 0m; + Indice = 0m; + Total = detalhes.Count; + List log = new List(); + await Task.Run(async delegate + { + foreach (DetalheExtrato detalhe in from x in detalhes + orderby x.Cliente, x.Apolice, x.Endosso, x.NumeroParcela descending + select x) + { + decimal indice = Indice; + Indice = indice + 1m; + Porcentagem = Indice * 100m / Total; + if (!(await DesfazerParcela(detalhe))) + { + log.Add(detalhe); + } + } + }); + SelectedExtrato.Status = (StatusExtrato)1; + await _servico.Save(SelectedExtrato); + if (_servico.Sucesso) + { + ObservableCollection detalhesAtualizados = await CarregarDetalhes(SelectedExtrato); + if (log.Count > 0) + { + await ShowDetalheExtrato(log); + } + else + { + ToggleSnackBar("EXTRATO DESFEITO COM SUCESSO"); + } + RegistrarAcao($"DESFEZ EXTRATO DE ID \n{((DomainBase)SelectedExtrato).Id}\n", ((DomainBase)SelectedExtrato).Id, (TipoTela)35); + bool flag = !detalhesAtualizados.Any((DetalheExtrato x) => x.Status.HasValue && status.Contains(x.Status.Value)); + if (flag) + { + flag = await ShowMessage("DESEJA EXCLUIR O EXTRATO DESFEITO?", "SIM", "NÃO"); + } + if (flag) + { + await ExcluirExtrato(); + SelectedExtrato = null; + } + Carregando = true; + SelectedStatusExtrato = (StatusExtrato)1; + Carregando = false; + SelecionaSeguradora(SelectedSeguradora, SelectedStatusExtrato, SelectedExtrato); + } + } + + public void AdcionarFiltro() + { + if (!string.IsNullOrEmpty(Filtro)) + { + if (FiltroPersonalizado == null) + { + FiltroPersonalizado = new ObservableCollection(); + } + FiltroPersonalizado.Add(Filtro); + Filtro = string.Empty; + FiltrarExtrato(); + } + } + + public void FiltrarExtrato() + { + ExtratosFiltrados = new ObservableCollection(Filtrar()); + SelectedExtrato = ExtratosFiltrados.FirstOrDefault(); + ObservableCollection extratosFiltrados = ExtratosFiltrados; + IsExpanded = extratosFiltrados != null && extratosFiltrados.Count > 0; + } + + private List Filtrar() + { + List extratos = Extratos.ToList(); + FiltroPersonalizado.ToList().ForEach(delegate(string f) + { + extratos = (from x in extratos + where ValidationHelper.RemoveDiacritics(x.Seguradora.Nome).ToUpper().Contains(ValidationHelper.RemoveDiacritics(f)) || ValidationHelper.RemoveDiacritics(x.Numero).ToUpper().Contains(ValidationHelper.RemoveDiacritics(f)) || (x.Data.HasValue && x.Data.ToString().Contains(f)) || (x.Bruto.HasValue && x.Bruto.ToString().Contains(f)) || (x.Liquido.HasValue && x.Liquido.ToString().Contains(f)) || (x.DataCredito.HasValue && x.DataCredito.ToString().Contains(f)) + orderby x.Numero, x.DataCredito descending + select x).ToList(); + }); + return extratos; + } + + public void ExcluirFiltro(string filtro) + { + FiltroPersonalizado.Remove(filtro); + FiltrarExtrato(); + } + + public async Task CriticarTodos(long id) + { + ObservableCollection parcelas = await _servico.BuscarDetalhes(id); + foreach (DetalheExtrato item in parcelas) + { + if ((int)item.Status.GetValueOrDefault() == 2 || (int)item.Status.GetValueOrDefault() == 3) + { + item.Status = (StatusParcela)6; + await _servico.Save(item); + if (!_servico.Sucesso) + { + return; + } + } + } + if (parcelas.All((DetalheExtrato x) => (int)x.Status.GetValueOrDefault() == 6)) + { + SelectedExtrato.Status = (StatusExtrato)3; + SelectedStatusExtrato = (StatusExtrato)3; + await SelecionaExtrato(SelectedExtrato); + } + await CarregaDetalhes(SelectedExtrato); + ToggleSnackBar("CRÍTICA REALIZADA COM SUCESSO"); + RegistrarAcao($"DESCONSIDEROU TODAS AS PARCELAS COM O STATUS DE DOCUMENTO NÃO ENCONTRADO OU PARCELA NÃO ENCONTRADA DO EXTRATO DE ID \n{id}\n", id, (TipoTela)35); + } + + public async Task GerarHtml() + { + ExtratoComissao val = new ExtratoComissao(); + Usuario? obj = ((IEnumerable)Auxiliar.Usuarios).FirstOrDefault((Func)((Usuario x) => ((DomainBase)x).Id == SelectedExtrato.IdUsuario)); + val.Usuario = ((obj != null) ? obj.Nome : null); + val.Seguradora = SelectedExtrato.Seguradora.Nome; + val.DetalhesExtrato = new ObservableCollection(); + val.InformacoesExtrato = new ObservableCollection + { + new InformacoesExtrato + { + NumeroExtrato = SelectedExtrato.Numero, + DataExtrato = SelectedExtrato.Data, + Bruto = SelectedExtrato.Bruto.GetValueOrDefault(), + Liquido = SelectedExtrato.Liquido.GetValueOrDefault(), + Ir = SelectedExtrato.Ir.GetValueOrDefault(), + Iss = SelectedExtrato.Iss.GetValueOrDefault(), + Outros = SelectedExtrato.Outro.GetValueOrDefault(), + Quantidade = Quantidade, + TotalBaixado = TotalBaixado, + TotalPendente = TotalPendente + } + }; + ExtratoComissao extrato = val; + foreach (DetalheExtrato detalheExtratoFiltrado in DetalheExtratoFiltrados) + { + DetalhesExtrato item = new DetalhesExtrato + { + Cliente = detalheExtratoFiltrado.Cliente, + Apolice = detalheExtratoFiltrado.Apolice, + Endosso = detalheExtratoFiltrado.Endosso, + Parcela = detalheExtratoFiltrado.NumeroParcela, + Pagto = detalheExtratoFiltrado.Valor, + Comissao = detalheExtratoFiltrado.Comissao, + ValorComissao = detalheExtratoFiltrado.ValorComissao, + Status = ValidationHelper.GetDescription((Enum)(object)detalheExtratoFiltrado.Status) + }; + extrato.DetalhesExtrato.Add(item); + } + string body = await Funcoes.GenerateTable(extrato.InformacoesExtrato.ToList(), new List()) + await Funcoes.GenerateTable(extrato.DetalhesExtrato.ToList(), new List()); + string text = Funcoes.CreateCard("SEGURADORA: " + extrato.Seguradora + "
USUÁRIO IMPORTAÇÃO: " + extrato.Usuario, body); + return Funcoes.ExportarHtml(new TipoRelatorio + { + Nome = "EXTRATO DE COMISSÃO" + }, text ?? "", "70"); + } + + public async Task FinalizarExtrato() + { + if (DetalheExtrato != null && DetalheExtrato.Count != 0) + { + StatusExtrato extrato = SelectedStatusExtrato; + SelectedExtrato.Status = (StatusExtrato)3; + Extrato val = await _servico.Save(SelectedExtrato); + if (_servico.Sucesso) + { + SelectedExtrato = null; + SelecionaSeguradora(SelectedSeguradora, extrato); + ToggleSnackBar("EXTRATO FINALIZADO COM SUCESSO"); + RegistrarAcao($"FINALIZOU EXTRATO DE ID \n{((DomainBase)val).Id}\n", ((DomainBase)val).Id, (TipoTela)35); + } + } + } + + public async Task DesconsiderarSelecionadas() + { + if (DetalheExtrato == null || DetalheExtrato.Count == 0) + { + return; + } + List statusBaixados = new List + { + (StatusParcela)1, + (StatusParcela)5, + (StatusParcela)8, + (StatusParcela)10, + (StatusParcela)12, + (StatusParcela)13, + (StatusParcela)21, + (StatusParcela)8, + (StatusParcela)6 + }; + IEnumerable enumerable = DetalheExtrato.Where((DetalheExtrato parcelas) => parcelas.Selecionado); + if (!enumerable.Any((DetalheExtrato parcelas) => statusBaixados.Any((StatusParcela status) => (StatusParcela?)status == parcelas.Status))) + { + foreach (DetalheExtrato item in enumerable) + { + item.Status = (StatusParcela)6; + await _servico.Save(item); + if (!_servico.Sucesso) + { + return; + } + } + await CarregaDetalhes(SelectedExtrato); + } + else + { + await ShowMessage("HÁ PARCELAS SELECIONADAS QUE JÁ ESTÃO BAIXADAS OU JÁ DESCONSIDERADAS"); + } + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Command/RelayCommand.cs b/Decompiler/Gestor.Application.ViewModels.Command/RelayCommand.cs new file mode 100644 index 0000000..fb4891a --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Command/RelayCommand.cs @@ -0,0 +1,28 @@ +using System; +using System.Windows.Input; + +namespace Gestor.Application.ViewModels.Command; + +public class RelayCommand : ICommand +{ + private Action mAction; + + public event EventHandler CanExecuteChanged = delegate + { + }; + + public RelayCommand(Action action) + { + mAction = action; + } + + public bool CanExecute(object parameter) + { + return true; + } + + public void Execute(object parameter) + { + mAction(); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Configuracoes/ConfiguracoesViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Configuracoes/ConfiguracoesViewModel.cs new file mode 100644 index 0000000..cd82ea8 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Configuracoes/ConfiguracoesViewModel.cs @@ -0,0 +1,171 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Configuracoes; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Generic; + +namespace Gestor.Application.ViewModels.Configuracoes; + +public class ConfiguracoesViewModel : BaseViewModel +{ + private bool _hasRows; + + private ObservableCollection _configuracoes; + + private Configuracao _selectedConfiguracao; + + private string _descricao; + + private bool _carregando; + + private ObservableCollection _configuracoesAdicionadas; + + private ConfuguracoesServico _servico { get; set; } + + public bool HasRows + { + get + { + return _hasRows; + } + set + { + _hasRows = value; + OnPropertyChanged("HasRows"); + } + } + + public ObservableCollection Configuracoes + { + get + { + return _configuracoes; + } + set + { + _configuracoes = value; + base.EnableFields = value != null && value.Count > 0; + OnPropertyChanged("Configuracoes"); + } + } + + public Configuracao SelectedConfiguracao + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _selectedConfiguracao; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + //IL_0008: Unknown result type (might be due to invalid IL or missing references) + _selectedConfiguracao = value; + Descricao = ValidationHelper.GetCategory((Enum)(object)value); + OnPropertyChanged("SelectedConfiguracao"); + } + } + + public string Descricao + { + get + { + return _descricao; + } + set + { + _descricao = value; + OnPropertyChanged("Descricao"); + } + } + + public bool Carregando + { + get + { + return _carregando; + } + set + { + _carregando = value; + OnPropertyChanged("Carregando"); + } + } + + public ObservableCollection ConfiguracoesAdicionadas + { + get + { + return _configuracoesAdicionadas; + } + set + { + _configuracoesAdicionadas = value; + HasRows = value != null && value.Count > 0; + PopularConfiguracoes(value); + OnPropertyChanged("ConfiguracoesAdicionadas"); + } + } + + public ConfiguracoesViewModel() + { + _servico = new ConfuguracoesServico(); + base.EnableMenu = true; + } + + public async Task BuscarConfiguracoes() + { + List list = await _servico.Buscar(); + Recursos.Configuracoes = list.OrderBy((ConfiguracaoSistema x) => ValidationHelper.GetDescription((Enum)(object)x.Configuracao)).ToList(); + ConfiguracoesAdicionadas = new ObservableCollection(list); + } + + private void PopularConfiguracoes(ObservableCollection configuracoes) + { + //IL_0052: Unknown result type (might be due to invalid IL or missing references) + //IL_0057: Unknown result type (might be due to invalid IL or missing references) + //IL_0072: Unknown result type (might be due to invalid IL or missing references) + //IL_00a3: Unknown result type (might be due to invalid IL or missing references) + if (configuracoes == null) + { + return; + } + List list = new List(); + foreach (Configuracao configuracao in ((Configuracao[])Enum.GetValues(typeof(Configuracao))).OrderBy((Configuracao x) => ValidationHelper.GetDescription((Enum)(object)x))) + { + if (!configuracoes.Any((ConfiguracaoSistema x) => x.Configuracao == configuracao)) + { + list.Add(configuracao); + } + } + Configuracoes = new ObservableCollection(list); + SelectedConfiguracao = Configuracoes.FirstOrDefault(); + } + + public async Task Salvar() + { + if (((DomainBase)(await _servico.Salvar(new ConfiguracaoSistema + { + Configuracao = SelectedConfiguracao + }))).Id != 0L) + { + await BuscarConfiguracoes(); + } + } + + public async Task Excluir(ConfiguracaoSistema configuracao) + { + if (await _servico.Excluir(configuracao)) + { + await BuscarConfiguracoes(); + } + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Drawer.Ajuda/AtendimentosViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Drawer.Ajuda/AtendimentosViewModel.cs new file mode 100644 index 0000000..05ffe12 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Drawer.Ajuda/AtendimentosViewModel.cs @@ -0,0 +1,472 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; +using Gestor.Application.Helpers; +using Gestor.Application.Model.Ajuda; +using Gestor.Application.Servicos.Ajuda; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.API; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Newtonsoft.Json; + +namespace Gestor.Application.ViewModels.Drawer.Ajuda; + +public class AtendimentosViewModel : BaseViewModel +{ + private readonly AjudaServico _ajudaServico; + + private List _status; + + private string _webbody; + + private Visibility _envioEmailVisibility = (Visibility)2; + + private Visibility _atendimentoVisibility; + + private ObservableCollection _atendimentos; + + private Atendimento _selectedAtendimento; + + private string _nome; + + private string _ddd; + + private string _telefone; + + private string _email; + + private string _assunto; + + private string _idacesso; + + private string _corpo; + + private string _senhaacesso; + + private ObservableCollection _arquivosAnexados = new ObservableCollection(); + + private ArquivoDigital _selectedAnexado = new ArquivoDigital(); + + private string _head; + + public HorarioAtendimento HorarioAtendimento { get; set; } + + public List Status + { + get + { + return _status; + } + set + { + _status = value; + OnPropertyChanged("Status"); + } + } + + public string WebBody + { + get + { + return _webbody?.ToUpper().Trim(); + } + set + { + _webbody = value; + OnPropertyChanged("WebBody"); + } + } + + public Visibility EnvioEmailVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _envioEmailVisibility; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _envioEmailVisibility = value; + OnPropertyChanged("EnvioEmailVisibility"); + } + } + + public Visibility AtendimentoVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _atendimentoVisibility; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _atendimentoVisibility = value; + OnPropertyChanged("AtendimentoVisibility"); + } + } + + public ObservableCollection Atendimentos + { + get + { + return _atendimentos; + } + set + { + _atendimentos = value; + OnPropertyChanged("Atendimentos"); + } + } + + public Atendimento SelectedAtendimento + { + get + { + return _selectedAtendimento; + } + set + { + _selectedAtendimento = value; + WorkOnSelectedAtendimento(value); + OnPropertyChanged("SelectedAtendimento"); + } + } + + public string Nome + { + get + { + return _nome; + } + set + { + _nome = value; + OnPropertyChanged("Nome"); + } + } + + public string Ddd + { + get + { + return _ddd; + } + set + { + _ddd = value; + OnPropertyChanged("Ddd"); + } + } + + public string Telefone + { + get + { + return _telefone; + } + set + { + _telefone = value; + OnPropertyChanged("Telefone"); + } + } + + public string Email + { + get + { + return _email; + } + set + { + _email = value; + OnPropertyChanged("Email"); + } + } + + public string Assunto + { + get + { + return _assunto; + } + set + { + _assunto = value; + OnPropertyChanged("Assunto"); + } + } + + public string IdAcesso + { + get + { + return _idacesso; + } + set + { + _idacesso = value; + OnPropertyChanged("IdAcesso"); + } + } + + public string Corpo + { + get + { + return _corpo; + } + set + { + _corpo = value; + OnPropertyChanged("Corpo"); + } + } + + public string SenhaAcesso + { + get + { + return _senhaacesso; + } + set + { + _senhaacesso = value; + OnPropertyChanged("SenhaAcesso"); + } + } + + public ObservableCollection ArquivosAnexados + { + get + { + return _arquivosAnexados; + } + set + { + _arquivosAnexados = value; + OnPropertyChanged("ArquivosAnexados"); + } + } + + public ArquivoDigital SelectedAnexado + { + get + { + return _selectedAnexado; + } + set + { + _selectedAnexado = value; + OnPropertyChanged("SelectedAnexado"); + } + } + + public string Head + { + get + { + return _head; + } + set + { + _head = value; + OnPropertyChanged("Head"); + } + } + + private async void HabilitarAtendimento(HorarioAtendimento horario) + { + if (horario == null || horario.Autorizado) + { + AtendimentosViewModel atendimentosViewModel = this; + Usuario usuario = Recursos.Usuario; + atendimentosViewModel.EnableButtons = usuario != null && ((DomainBase)usuario).Id > 0; + return; + } + base.EnableButtons = false; + string text = (horario.InicioDia.HasValue ? (" de " + horario.InicioDia.DiaDaSemana() + " à " + horario.FimDia.DiaDaSemana() + ", das " + horario.InicioHora + "hs às " + horario.FimHora + "hs") : (" das " + horario.InicioHora + "hs às " + horario.FimHora + "hs")); + await ShowMessage("Prezado Cliente," + Environment.NewLine + Environment.NewLine + "Informamos Nosso horário de atendimento e recepção dos mesmos é " + text + "." + Environment.NewLine + "Infelizmente não realizamos agendamento de data/hora de atendimento, por gentileza realize a solicitação dentro do horário comercial que retornaremos a você."); + } + + public AtendimentosViewModel() + { + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + //IL_0013: Unknown result type (might be due to invalid IL or missing references) + //IL_001d: Expected O, but got Unknown + base.EnableButtons = true; + _ajudaServico = new AjudaServico(); + LoadCombo(); + InitialLoad(); + } + + private async void InitialLoad() + { + base.IsEnabled = false; + HorarioAtendimento = await Connection.Get("Attendance"); + HabilitarAtendimento(HorarioAtendimento); + base.IsEnabled = true; + } + + private void LoadCombo() + { + Status = new List { "PENDENTES", "FINALIZADOS" }; + } + + public async void WorkOnSelectedStatus(string value) + { + Atendimentos = await _ajudaServico.BuscarAtendimentos(value); + SelecionaAtendimento(); + } + + public void SelecionaAtendimento() + { + if (Atendimentos != null && Atendimentos.Count > 0) + { + SelectedAtendimento = Atendimentos[0]; + } + AtendimentoVisibility = (Visibility)0; + EnvioEmailVisibility = (Visibility)2; + } + + private async void WorkOnSelectedAtendimento(Atendimento value) + { + if (value != null) + { + WebBody = await _ajudaServico.BuscarCorpoAtendimentos(value.IdAtendimento); + } + } + + public async void Anexar() + { + List list = await AddAttachments(new List(), new List()); + if (list != null) + { + list.AddRange(ArquivosAnexados); + ArquivosAnexados = new ObservableCollection(list); + } + } + + public async Task>> Enviar() + { + try + { + List> list = Validate(); + if (list.Count > 0) + { + return list; + } + CustomerData val = new CustomerData + { + Corretora = Recursos.Empresa.Nome, + Name = Nome, + AreaCode = Ddd, + Number = Telefone, + Email = Email + }; + string body = $"{Corpo}

ID Acesso: {IdAcesso}
Senha Acesso: {SenhaAcesso}

VERSÃO DO SISTEMA: {ApplicationHelper.Versao}
USUÁRIO SISTEMA:{((DomainBase)Recursos.Usuario).Id} {Recursos.Usuario.Login}

{JsonConvert.SerializeObject((object)val)}

"; + CustomerAttendance keyValues = new CustomerAttendance + { + CustomerData = val, + Subject = Assunto, + Body = body, + Attachments = ((IEnumerable)ArquivosAnexados).Select((Func)((ArquivoDigital x) => new Attachment + { + Description = x.Descricao, + Extension = x.Extensao, + File = x.Arquivo + })).ToList() + }; + bool num = await Connection.Post("Attendance/Send", keyValues) == null; + LimparComponentes(); + SelecionaAtendimento(); + return num ? null : new List> + { + new KeyValuePair("fail", "") + }; + } + catch (Exception) + { + return new List> + { + new KeyValuePair("fail", "") + }; + } + } + + public void LimparComponentes() + { + Nome = Recursos.Usuario.Nome; + Ddd = Recursos.Usuario.Prefixo; + Telefone = Recursos.Usuario.Telefone; + Email = Recursos.Usuario.Email; + Assunto = null; + IdAcesso = null; + SenhaAcesso = null; + Corpo = string.Empty; + ArquivosAnexados = new ObservableCollection(); + } + + public List> Validate() + { + List> list = ValidationHelper.AddValue(); + if (string.IsNullOrWhiteSpace(Nome)) + { + ValidationHelper.AddValue(list, "Nome", Messages.Obrigatorio, true); + } + if (string.IsNullOrWhiteSpace(Ddd)) + { + ValidationHelper.AddValue(list, "Ddd", Messages.Obrigatorio, true); + } + else if (!ValidationHelper.ValidacaoPrefixo(Ddd)) + { + ValidationHelper.AddValue(list, "Ddd", Messages.Invalido, true); + } + if (string.IsNullOrWhiteSpace(Telefone)) + { + ValidationHelper.AddValue(list, "Telefone", Messages.Obrigatorio, true); + } + else if (!ValidationHelper.ValidacaoTelefone(Telefone)) + { + ValidationHelper.AddValue(list, "Telefone", Messages.Invalido, true); + } + if (string.IsNullOrWhiteSpace(Email)) + { + ValidationHelper.AddValue(list, "Email", Messages.Obrigatorio, true); + } + else if (!ValidationHelper.ValidacaoEmail(Email)) + { + ValidationHelper.AddValue(list, "Email", Messages.Invalido, true); + } + if (string.IsNullOrWhiteSpace(Corpo)) + { + ValidationHelper.AddValue(list, "Corpo", Messages.Obrigatorio, true); + } + if (string.IsNullOrWhiteSpace(Assunto)) + { + ValidationHelper.AddValue(list, "Assunto", Messages.Obrigatorio, true); + } + return list; + } + + public void Delete(ArquivoDigital arquivo) + { + if (SelectedAnexado != null) + { + ArquivoDigital item = ArquivosAnexados.First((ArquivoDigital x) => x.Descricao == arquivo.Descricao); + ArquivosAnexados.Remove(item); + ArquivosAnexados = new ObservableCollection(ArquivosAnexados); + } + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Drawer.Ajuda/BoletosNotasViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Drawer.Ajuda/BoletosNotasViewModel.cs new file mode 100644 index 0000000..39f6c10 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Drawer.Ajuda/BoletosNotasViewModel.cs @@ -0,0 +1,100 @@ +using System.Collections.Generic; +using System.Linq; +using Gestor.Application.Model.Ajuda; +using Gestor.Application.Servicos.Ajuda; +using Gestor.Application.ViewModels.Generic; + +namespace Gestor.Application.ViewModels.Drawer.Ajuda; + +public class BoletosNotasViewModel : BaseViewModel +{ + private readonly AjudaServico _ajudaServico; + + private bool _carregando; + + private List _boletos; + + private string _boletoDisponivel; + + private List _status; + + public bool Carregando + { + get + { + return _carregando; + } + set + { + _carregando = value; + base.IsEnabled = !value; + base.EnableMenu = !value; + OnPropertyChanged("Carregando"); + } + } + + public List Boletos + { + get + { + return _boletos; + } + set + { + _boletos = value; + OnPropertyChanged("Boletos"); + } + } + + public string BoletoDisponivel + { + get + { + return _boletoDisponivel; + } + set + { + _boletoDisponivel = value; + OnPropertyChanged("BoletoDisponivel"); + } + } + + public List Status + { + get + { + return _status; + } + set + { + _status = value; + OnPropertyChanged("Status"); + } + } + + public BoletosNotasViewModel() + { + _ajudaServico = new AjudaServico(); + LoadCombos(); + BoletoDisponivel = "Disponível para impressão a partir de\n10 (dez) dias antes do vencimento"; + } + + private void LoadCombos() + { + Status = new List(); + Status.Add("PENDENTES"); + Status.Add("BAIXADOS"); + } + + public async void WorkOnSelectedStatus(string value) + { + Carregando = true; + Boletos = new List(); + List list = await _ajudaServico.BuscarBoletosNotas(value); + Boletos = ((value == "BAIXADOS") ? (from x in list + where x.Pagamento.HasValue + orderby x.Pagamento descending + select x).ToList() : list); + Carregando = false; + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Drawer.Ajuda/ContratosViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Drawer.Ajuda/ContratosViewModel.cs new file mode 100644 index 0000000..4258dcc --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Drawer.Ajuda/ContratosViewModel.cs @@ -0,0 +1,109 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using Gestor.Application.Helpers; +using Gestor.Application.Model.Ajuda; +using Gestor.Application.Servicos.Ajuda; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Domain.Generic; +using Gestor.Model.License; + +namespace Gestor.Application.ViewModels.Drawer.Ajuda; + +public class ContratosViewModel : BaseViewModel +{ + private readonly AjudaServico _ajudaServico; + + private bool _carregando; + + private List _contratos; + + private Licenca _selectedContrato; + + public bool Carregando + { + get + { + return _carregando; + } + set + { + _carregando = value; + base.IsEnabled = !value; + base.EnableMenu = !value; + OnPropertyChanged("Carregando"); + } + } + + public List Contratos + { + get + { + return _contratos; + } + set + { + _contratos = value; + OnPropertyChanged("Contratos"); + } + } + + public Licenca SelectedContrato + { + get + { + return _selectedContrato; + } + set + { + _selectedContrato = value; + WorkOnSelectedContrato(value); + OnPropertyChanged("SelectedContrato"); + } + } + + public ContratosViewModel() + { + _ajudaServico = new AjudaServico(); + Contratos = LicenseHelper.Produtos; + } + + internal async void WorkOnSelectedContrato(Licenca value) + { + Contrato contrato = await _ajudaServico.BuscarContrato(value.Produto); + if (string.IsNullOrEmpty(contrato.HtmlContrato) && contrato.IdModulo == 7) + { + Process.Start($"https://aggilizador.com.br/Contrato.aspx?id={ApplicationHelper.IdFornecedor}"); + return; + } + if (string.IsNullOrEmpty(contrato.HtmlContrato) && contrato.IdModulo != 7) + { + contrato = await _ajudaServico.BuscarContrato((Produto)1); + } + string produtos = string.Empty; + LicenseHelper.Produtos.ForEach(delegate(Licenca x) + { + //IL_0031: Unknown result type (might be due to invalid IL or missing references) + //IL_001a: Unknown result type (might be due to invalid IL or missing references) + produtos += (string.IsNullOrEmpty(produtos) ? ValidationHelper.GetDescription((Enum)(object)x.Produto) : ("/ " + ValidationHelper.GetDescription((Enum)(object)x.Produto))); + }); + contrato.HtmlContrato = contrato.HtmlContrato.Replace("[<NOME>]", Recursos.Empresa.Nome); + contrato.HtmlContrato = contrato.HtmlContrato.Replace("[<ENDERECO>]", ((EnderecoBase)Recursos.Empresa).Endereco); + contrato.HtmlContrato = contrato.HtmlContrato.Replace("[<CIDADE>]", ((EnderecoBase)Recursos.Empresa).Cidade); + contrato.HtmlContrato = contrato.HtmlContrato.Replace("[<CNPJ>]", Recursos.Empresa.Documento); + contrato.HtmlContrato = contrato.HtmlContrato.Replace("[<NS>]", Recursos.Empresa.Serial); + contrato.HtmlContrato = contrato.HtmlContrato.Replace("[<DATA>]", Funcoes.GetNetworkTime().Date.ToString("dd/MM/yyyy")); + contrato.HtmlContrato = contrato.HtmlContrato.Replace("[<VALOR>]", "Conforme Mensalidade"); + contrato.HtmlContrato = contrato.HtmlContrato.Replace("[<OUTROS>]", produtos.Replace("*", "")); + string tempPath = Path.GetTempPath(); + string text = string.Format("{0}{1}_{2:ddMMyyyyhhmmss}.html", tempPath, new Regex("[" + Regex.Escape(new string(Path.GetInvalidFileNameChars()) + new string(Path.GetInvalidPathChars())) + "]").Replace(ValidationHelper.GetDescription((Enum)(object)value.Produto), ""), Funcoes.GetNetworkTime()); + StreamWriter streamWriter = new StreamWriter(text, append: true, Encoding.UTF8); + streamWriter.Write(contrato.HtmlContrato); + streamWriter.Close(); + Process.Start(text); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Drawer.Ajuda/InstalacaoViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Drawer.Ajuda/InstalacaoViewModel.cs new file mode 100644 index 0000000..bfe29e1 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Drawer.Ajuda/InstalacaoViewModel.cs @@ -0,0 +1,201 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Controls; +using Gestor.Application.Helpers; +using Gestor.Application.Model.Ajuda; +using Gestor.Application.Servicos.Ajuda; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.License; + +namespace Gestor.Application.ViewModels.Drawer.Ajuda; + +public class InstalacaoViewModel : BaseViewModel +{ + private readonly AjudaServico _ajudaServico; + + private bool _enableExclusao; + + private bool _mostrarAggilizador; + + private string _infoGestor; + + private string _infoAggilizador; + + private bool _carregando; + + private List _agger; + + private ObservableCollection _aggerFiltrado; + + private List _aggilizador; + + public bool EnableExclusao + { + get + { + return _enableExclusao; + } + set + { + _enableExclusao = value; + OnPropertyChanged("EnableExclusao"); + } + } + + public bool MostrarAggilizador + { + get + { + return _mostrarAggilizador; + } + set + { + _mostrarAggilizador = value; + OnPropertyChanged("MostrarAggilizador"); + } + } + + public string InfoGestor + { + get + { + return _infoGestor; + } + set + { + _infoGestor = value; + OnPropertyChanged("InfoGestor"); + } + } + + public string InfoAggilizador + { + get + { + return _infoAggilizador; + } + set + { + _infoAggilizador = value; + OnPropertyChanged("InfoAggilizador"); + } + } + + public bool Carregando + { + get + { + return _carregando; + } + set + { + _carregando = value; + base.IsEnabled = !value; + base.EnableMenu = !value; + OnPropertyChanged("Carregando"); + } + } + + public List Agger + { + get + { + return _agger; + } + set + { + _agger = value; + OnPropertyChanged("Agger"); + } + } + + public ObservableCollection AggerFiltrado + { + get + { + return _aggerFiltrado; + } + set + { + _aggerFiltrado = value; + OnPropertyChanged("AggerFiltrado"); + } + } + + public List Aggilizador + { + get + { + return _aggilizador; + } + set + { + _aggilizador = value; + OnPropertyChanged("Aggilizador"); + } + } + + public AutoCompleteFilterPredicate InstalacaoItemFilter => (string searchText, object obj) => ((Instalacao)obj).Maquina.ToUpper().Contains(searchText.ToUpper()) || ((Instalacao)obj).Usuario.ToUpper().Contains(searchText.ToUpper()) || ((Instalacao)obj).DataIntalacao.ToString().Contains(searchText.ToUpper()); + + public InstalacaoViewModel() + { + Usuario usuario = Recursos.Usuario; + _enableExclusao = usuario != null && ((DomainBase)usuario).Id > 0; + base._002Ector(); + _ajudaServico = new AjudaServico(); + LoadInstalacoes(); + } + + private async void LoadInstalacoes() + { + Carregando = true; + ObservableCollection source = await _ajudaServico.BuscarLicencas(); + Agger = source.Where((Instalacao x) => !string.IsNullOrEmpty(x.IdGerenciador)).ToList(); + AggerFiltrado = new ObservableCollection(Agger); + Aggilizador = (LicenseHelper.Produtos.Any((Licenca x) => (int)x.Produto == 81) ? new List() : source.Where((Instalacao x) => !string.IsNullOrEmpty(x.IdAggilizador)).ToList()); + InstalacaoViewModel instalacaoViewModel = this; + object arg = Agger.Count; + Licenca? obj = ((IEnumerable)LicenseHelper.Produtos).FirstOrDefault((Func)((Licenca x) => (int)x.Produto == 1)); + instalacaoViewModel.InfoGestor = $"{arg} LICENÇAS INSTALADAS DE {((obj != null) ? new int?(obj.Quantidade) : null)} LICENÇAS CONTRATADAS."; + InstalacaoViewModel instalacaoViewModel2 = this; + object infoAggilizador; + if (Aggilizador.Count <= 0) + { + infoAggilizador = ""; + } + else + { + object arg2 = Aggilizador.Count; + Licenca? obj2 = ((IEnumerable)LicenseHelper.Produtos).FirstOrDefault((Func)((Licenca x) => (int)x.Produto == 81)); + infoAggilizador = $"{arg2} LICENÇAS INSTALADAS DE {((obj2 != null) ? new int?(obj2.Quantidade) : null)} LICENÇAS CONTRATADAS."; + } + instalacaoViewModel2.InfoAggilizador = (string)infoAggilizador; + MostrarAggilizador = Aggilizador.Count > 0; + Carregando = false; + } + + public async void Excluir(long id) + { + if (await _ajudaServico.ExcluirInstalacao(id)) + { + LoadInstalacoes(); + } + } + + internal async Task> Filtrar(string value) + { + return await Task.Run(() => FiltrarInstalacao(value)); + } + + public List FiltrarInstalacao(string filter) + { + AggerFiltrado = (string.IsNullOrWhiteSpace(filter) ? new ObservableCollection(Agger) : new ObservableCollection(Agger.Where((Instalacao x) => ValidationHelper.RemoveDiacritics(x.Maquina.Trim()).ToUpper().Contains(ValidationHelper.RemoveDiacritics(filter)) || ValidationHelper.RemoveDiacritics(x.Usuario.Trim()).ToUpper().Contains(ValidationHelper.RemoveDiacritics(filter)) || x.DataIntalacao.ToString().Contains(ValidationHelper.RemoveDiacritics(filter))))); + return AggerFiltrado.ToList(); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Drawer/AdiantamentoViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Drawer/AdiantamentoViewModel.cs new file mode 100644 index 0000000..06cd656 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Drawer/AdiantamentoViewModel.cs @@ -0,0 +1,248 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using Assinador.Infrastructure.Helpers; +using Gestor.Application.Servicos.Ferramentas; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Drawer; + +public class AdiantamentoViewModel : BaseSegurosViewModel +{ + private readonly AdiantamentoServico _servico; + + private readonly Vendedor _selectedVendedor; + + private bool _carregando; + + private ObservableCollection _adiantamento = new ObservableCollection(); + + private Adiantamento _selectedAdiantamento = new Adiantamento(); + + private bool _logEnabled; + + public Adiantamento CancelAdiantamento; + + public bool Carregando + { + get + { + return _carregando; + } + set + { + _carregando = value; + base.IsEnabled = !value; + base.EnableMenu = !value; + OnPropertyChanged("Carregando"); + } + } + + public ObservableCollection Adiantamento + { + get + { + return _adiantamento; + } + set + { + _adiantamento = value; + OnPropertyChanged("Adiantamento"); + } + } + + public Adiantamento SelectedAdiantamento + { + get + { + return _selectedAdiantamento; + } + set + { + _selectedAdiantamento = value; + CancelAdiantamento = ((value != null && ((DomainBase)value).Id > 0) ? value : CancelAdiantamento); + VerificarEnables((value != null) ? new long?(((DomainBase)value).Id) : null); + OnPropertyChanged("SelectedAdiantamento"); + } + } + + public bool LogEnabled + { + get + { + return _logEnabled; + } + set + { + _logEnabled = value; + OnPropertyChanged("LogEnabled"); + } + } + + public AdiantamentoViewModel(Vendedor vendedor) + { + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_0016: Expected O, but got Unknown + _servico = new AdiantamentoServico(); + Seleciona(vendedor); + _selectedVendedor = vendedor; + } + + private async void Seleciona(Vendedor vendedor) + { + Loading(isLoading: true); + await PermissaoTela((TipoTela)15); + await SelecionaAdiantamento(vendedor); + Loading(isLoading: false); + } + + public void SelecionaAdiantamento(Adiantamento adiantamento) + { + SelectedAdiantamento = adiantamento; + } + + private async Task SelecionaAdiantamento(Vendedor vendedor) + { + Carregando = true; + List list = (from x in await new BaseServico().BuscarAdiantamentoAsync(vendedor) + orderby x.Pago, x.Valor + select x).ToList(); + Adiantamento = new ObservableCollection(list); + if (Adiantamento.Count > 0) + { + SelecionaAdiantamento(Adiantamento.First()); + LogEnabled = true; + } + else + { + SelectedAdiantamento = new Adiantamento(); + LogEnabled = false; + Alterar(alterar: false); + VerificarEnables(((DomainBase)SelectedAdiantamento).Id); + base.EnableMenu = false; + } + Carregando = false; + } + + public void Incluir() + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Expected O, but got Unknown + Adiantamento selectedAdiantamento = new Adiantamento(); + SelectedAdiantamento = selectedAdiantamento; + Alterar(alterar: true); + } + + public async Task>> Salvar() + { + if (string.IsNullOrWhiteSpace(SelectedAdiantamento.Historico)) + { + return new List> + { + new KeyValuePair("Historico|HISTÓRICO", "OBRIGATÓRIO") + }; + } + SelectedAdiantamento.Vendedor = _selectedVendedor; + string acao = ((((DomainBase)SelectedAdiantamento).Id == 0L) ? "INCLUIU" : "ALTEROU"); + Adiantamento value = await _servico.Save(SelectedAdiantamento); + if (!_servico.Sucesso) + { + return null; + } + RegistrarAcao(acao + " ADIANTAMENTO DO VENDEDOR \"" + value.Vendedor.Nome + "\"", ((DomainBase)value).Id, (TipoTela)36, string.Format("ID: {0}\nDATA: {1}\nVALOR: {2:c}\nTIPO PAGAMENTO: {3}\nPAGO: {4}", ((DomainBase)value).Id, (!value.Data.HasValue) ? "-" : $"{value.Data:d}", value.Valor, Functions.GetDescription((Enum)(object)value.TipoPagamento), value.Pago ? "SIM" : "NÃO")); + if (Adiantamento.Any((Adiantamento x) => ((DomainBase)x).Id == ((DomainBase)value).Id)) + { + DomainBase.Copy(Adiantamento.First((Adiantamento x) => ((DomainBase)x).Id == ((DomainBase)value).Id), value); + } + else + { + Adiantamento.Add(value); + } + Adiantamento = new ObservableCollection(Adiantamento); + SelectedAdiantamento = Adiantamento.First((Adiantamento x) => ((DomainBase)x).Id == ((DomainBase)value).Id); + LogEnabled = true; + Alterar(alterar: false); + return null; + } + + public void CancelarAlteracao() + { + Carregando = true; + if (CancelAdiantamento != null && Adiantamento.Any((Adiantamento x) => ((DomainBase)x).Id == ((DomainBase)CancelAdiantamento).Id)) + { + DomainBase.Copy(Adiantamento.First((Adiantamento x) => ((DomainBase)x).Id == ((DomainBase)CancelAdiantamento).Id), CancelAdiantamento); + SelectedAdiantamento = Adiantamento.First((Adiantamento x) => ((DomainBase)x).Id == ((DomainBase)CancelAdiantamento).Id); + } + Alterar(alterar: false); + Carregando = false; + } + + public async Task Excluir() + { + if (SelectedAdiantamento == null || ((DomainBase)SelectedAdiantamento).Id == 0L) + { + return false; + } + if (!(await ShowMessage("DESEJA EXCLUIR?", "SIM", "NÃO"))) + { + return false; + } + Carregando = true; + if (!(await _servico.Delete(SelectedAdiantamento))) + { + return false; + } + RegistrarAcao("EXCLUIU O ADIANTAMENTO DO VENDEDOR \"" + SelectedAdiantamento.Vendedor.Nome + "\"", ((DomainBase)SelectedAdiantamento).Id, (TipoTela)36, string.Format("ID: {0}\nDATA: {1}\nVALOR: {2:c}\nTIPO PAGAMENTO: {3}\nPAGO: {4}", ((DomainBase)SelectedAdiantamento).Id, (!SelectedAdiantamento.Data.HasValue) ? "-" : $"{SelectedAdiantamento.Data:d}", SelectedAdiantamento.Valor, Functions.GetDescription((Enum)(object)SelectedAdiantamento.TipoPagamento), SelectedAdiantamento.Pago ? "SIM" : "NÃO")); + int num = Adiantamento.IndexOf(SelectedAdiantamento); + Adiantamento.Remove(SelectedAdiantamento); + Adiantamento.Remove(SelectedAdiantamento); + Adiantamento = new ObservableCollection(Adiantamento); + if (Adiantamento.Count > 0) + { + SelectedAdiantamento = ((num < Adiantamento.Count) ? Adiantamento.ElementAt(num) : Adiantamento.Last()); + LogEnabled = true; + } + else + { + SelectedAdiantamento = new Adiantamento(); + Alterar(alterar: false); + base.EnableMenu = false; + LogEnabled = false; + } + if (Adiantamento.Count > 0) + { + SelecionaAdiantamento((num < Adiantamento.Count) ? Adiantamento.ElementAt(num) : Adiantamento.Last()); + LogEnabled = true; + } + else + { + SelectedAdiantamento = new Adiantamento(); + LogEnabled = false; + Alterar(alterar: false); + } + Carregando = false; + return true; + } + + public async Task CarregarAdiantamento(int index) + { + Carregando = true; + Adiantamento = new ObservableCollection(await _servico.BuscarAdiantamentos(((DomainBase)_selectedVendedor).Id, index != 0)); + if (Adiantamento != null && Adiantamento.Count > 0) + { + SelectedAdiantamento = Adiantamento.First(); + LogEnabled = true; + } + else + { + LogEnabled = false; + } + Carregando = false; + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Drawer/AgendaViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Drawer/AgendaViewModel.cs new file mode 100644 index 0000000..57aebe2 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Drawer/AgendaViewModel.cs @@ -0,0 +1,406 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using Gestor.Application.Servicos.Ferramentas; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; + +namespace Gestor.Application.ViewModels.Drawer; + +public class AgendaViewModel : BaseSegurosViewModel +{ + private readonly AgendaServico _servico; + + private Agenda _selectedAgenda; + + private ObservableCollection _telefones = new ObservableCollection(); + + private ObservableCollection _emails = new ObservableCollection(); + + private long _ultimoId; + + public Agenda CancelAgenda; + + private ObservableCollection _agendasFiltradas = new ObservableCollection(); + + private bool _carregando; + + public Agenda SelectedAgenda + { + get + { + return _selectedAgenda; + } + set + { + _selectedAgenda = value; + VerificarEnables((value != null) ? new long?(((DomainBase)value).Id) : null); + OnPropertyChanged("SelectedAgenda"); + } + } + + public ObservableCollection Telefones + { + get + { + return _telefones; + } + set + { + _telefones = value; + OnPropertyChanged("Telefones"); + } + } + + public ObservableCollection Emails + { + get + { + return _emails; + } + set + { + _emails = value; + OnPropertyChanged("Emails"); + } + } + + public ObservableCollection AgendasFiltradas + { + get + { + return _agendasFiltradas; + } + set + { + _agendasFiltradas = value; + OnPropertyChanged("AgendasFiltradas"); + } + } + + public List Agendas { get; set; } + + public bool Carregando + { + get + { + return _carregando; + } + set + { + _carregando = value; + base.IsEnabled = !value; + base.EnableMenu = !value; + OnPropertyChanged("Carregando"); + } + } + + public AgendaViewModel() + { + _servico = new AgendaServico(); + Seleciona(); + } + + private async void Seleciona() + { + Loading(isLoading: true); + await PermissaoTela((TipoTela)34); + await SelecionaAgendas(); + Loading(isLoading: false); + } + + private async Task SelecionaAgendas() + { + Carregando = true; + Agendas = (await new BaseServico().BuscarAgendasAsync()).OrderBy((Agenda x) => x.Nome).ToList(); + AgendasFiltradas = new ObservableCollection(Agendas); + SelectedAgenda = (Agenda)((AgendasFiltradas.Count > 0) ? ((object)AgendasFiltradas.First()) : ((object)new Agenda())); + Carregando = false; + } + + public void IncluirTelefone() + { + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0021: Unknown result type (might be due to invalid IL or missing references) + //IL_002d: Unknown result type (might be due to invalid IL or missing references) + //IL_003a: Expected O, but got Unknown + if (SelectedAgenda != null) + { + if (Telefones == null) + { + Telefones = new ObservableCollection(); + } + AgendaTelefone item = new AgendaTelefone + { + Agenda = SelectedAgenda, + Tipo = (TipoTelefone)1 + }; + Telefones.Add(item); + OnPropertyChanged("IncluirTelefone"); + } + } + + public void ExcluirEmail(AgendaEmail email) + { + Emails.Remove(email); + } + + public void IncluirEmail() + { + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0021: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Expected O, but got Unknown + if (SelectedAgenda != null) + { + if (Emails == null) + { + Emails = new ObservableCollection(); + } + AgendaEmail item = new AgendaEmail + { + Agenda = SelectedAgenda + }; + Emails.Add(item); + OnPropertyChanged("IncluirEmail"); + } + } + + public void ExcluirTelefone(AgendaTelefone telefone) + { + Telefones.Remove(telefone); + } + + public void Incluir() + { + //IL_001a: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Expected O, but got Unknown + //IL_002b: Unknown result type (might be due to invalid IL or missing references) + //IL_0030: Unknown result type (might be due to invalid IL or missing references) + //IL_003c: Unknown result type (might be due to invalid IL or missing references) + //IL_004d: Expected O, but got Unknown + //IL_0059: Unknown result type (might be due to invalid IL or missing references) + //IL_005e: Unknown result type (might be due to invalid IL or missing references) + //IL_006f: Expected O, but got Unknown + if (SelectedAgenda != null) + { + _ultimoId = ((DomainBase)SelectedAgenda).Id; + } + SelectedAgenda = new Agenda(); + Telefones = new ObservableCollection + { + new AgendaTelefone + { + Agenda = SelectedAgenda, + Tipo = (TipoTelefone)1 + } + }; + Emails = new ObservableCollection + { + new AgendaEmail + { + Agenda = SelectedAgenda + } + }; + Alterar(alterar: true); + } + + public async Task>> Salvar() + { + List> list = SelectedAgenda.Validate(); + List list2 = Telefones.Where((AgendaTelefone x) => !string.IsNullOrEmpty(((TelefoneBase)x).Numero)).ToList(); + List list3 = Emails.Where((AgendaEmail x) => !string.IsNullOrEmpty(((EmailBase)x).Email)).ToList(); + foreach (AgendaTelefone item in list2) + { + list.AddRange(item.Validate()); + } + foreach (AgendaEmail item2 in list3) + { + list.AddRange(item2.Validate()); + } + if (list.Count > 0) + { + return list; + } + SelectedAgenda.Telefones = new ObservableCollection(list2); + SelectedAgenda.Emails = new ObservableCollection(list3); + if (((DomainBase)SelectedAgenda).Id == 0L) + { + SelectedAgenda = await _servico.Save(SelectedAgenda); + if (!_servico.Sucesso) + { + return null; + } + Telefones = new ObservableCollection(SelectedAgenda.Telefones); + Emails = new ObservableCollection(SelectedAgenda.Emails); + Agendas.Add(SelectedAgenda); + AgendasFiltradas.Insert((_ultimoId != 0L) ? AgendasFiltradas.IndexOf(AgendasFiltradas.First((Agenda x) => ((DomainBase)x).Id == _ultimoId)) : 0, SelectedAgenda); + } + else + { + SelectedAgenda = await _servico.Save(SelectedAgenda); + if (!_servico.Sucesso) + { + return null; + } + Telefones = new ObservableCollection(SelectedAgenda.Telefones); + Emails = new ObservableCollection(SelectedAgenda.Emails); + DomainBase.Copy(Agendas.First((Agenda x) => ((DomainBase)x).Id == ((DomainBase)SelectedAgenda).Id), SelectedAgenda); + if (AgendasFiltradas.Count > 0 && AgendasFiltradas.Any((Agenda x) => ((DomainBase)x).Id == ((DomainBase)SelectedAgenda).Id)) + { + DomainBase.Copy(AgendasFiltradas.First((Agenda x) => ((DomainBase)x).Id == ((DomainBase)SelectedAgenda).Id), SelectedAgenda); + } + else + { + AgendasFiltradas.Add(SelectedAgenda); + } + } + AgendasFiltradas = new ObservableCollection(AgendasFiltradas); + SelectedAgenda = AgendasFiltradas.First((Agenda x) => ((DomainBase)x).Id == ((DomainBase)SelectedAgenda).Id); + Alterar(alterar: false); + return null; + } + + public void CancelarAlteracao() + { + //IL_00cc: Unknown result type (might be due to invalid IL or missing references) + //IL_00d6: Expected O, but got Unknown + //IL_00dd: Unknown result type (might be due to invalid IL or missing references) + //IL_00e2: Unknown result type (might be due to invalid IL or missing references) + //IL_00ee: Unknown result type (might be due to invalid IL or missing references) + //IL_00ff: Expected O, but got Unknown + //IL_010b: Unknown result type (might be due to invalid IL or missing references) + //IL_0110: Unknown result type (might be due to invalid IL or missing references) + //IL_0121: Expected O, but got Unknown + Carregando = true; + if (((DomainBase)SelectedAgenda).Id == 0L) + { + if (AgendasFiltradas.Count > 0 && AgendasFiltradas.Any((Agenda x) => ((DomainBase)x).Id == _ultimoId)) + { + SelectedAgenda = AgendasFiltradas.First((Agenda x) => ((DomainBase)x).Id == _ultimoId); + } + else + { + if (Agendas.Count <= 0 || !Agendas.Any((Agenda x) => ((DomainBase)x).Id == _ultimoId)) + { + SelectedAgenda = new Agenda(); + Telefones = new ObservableCollection + { + new AgendaTelefone + { + Agenda = SelectedAgenda, + Tipo = (TipoTelefone)1 + } + }; + Emails = new ObservableCollection + { + new AgendaEmail + { + Agenda = SelectedAgenda + } + }; + Alterar(alterar: false); + Carregando = false; + return; + } + AgendasFiltradas.Add(Agendas.First((Agenda x) => ((DomainBase)x).Id == _ultimoId)); + SelectedAgenda = AgendasFiltradas.First((Agenda x) => ((DomainBase)x).Id == _ultimoId); + } + } + else + { + DomainBase.Copy(Agendas.First((Agenda x) => ((DomainBase)x).Id == ((DomainBase)CancelAgenda).Id), CancelAgenda); + if (AgendasFiltradas.Count > 0 && AgendasFiltradas.Any((Agenda x) => ((DomainBase)x).Id == ((DomainBase)CancelAgenda).Id)) + { + DomainBase.Copy(AgendasFiltradas.First((Agenda x) => ((DomainBase)x).Id == ((DomainBase)CancelAgenda).Id), CancelAgenda); + } + else + { + AgendasFiltradas.Add(CancelAgenda); + } + AgendasFiltradas = new ObservableCollection(AgendasFiltradas); + SelectedAgenda = AgendasFiltradas.First((Agenda x) => ((DomainBase)x).Id == ((DomainBase)CancelAgenda).Id); + } + Alterar(alterar: false); + Carregando = false; + } + + public async Task Excluir() + { + if (SelectedAgenda == null || ((DomainBase)SelectedAgenda).Id == 0L) + { + return false; + } + if (!(await ShowMessage("DESEJA EXCLUIR?", "SIM", "NÃO"))) + { + return false; + } + Carregando = true; + if (!(await _servico.Delete(SelectedAgenda))) + { + Alterar(alterar: false); + Carregando = false; + return false; + } + int num = AgendasFiltradas.IndexOf(SelectedAgenda); + Agendas.Remove(SelectedAgenda); + AgendasFiltradas.Remove(SelectedAgenda); + AgendasFiltradas = new ObservableCollection(AgendasFiltradas); + if (AgendasFiltradas.Count > 0) + { + if (num >= AgendasFiltradas.Count) + { + await SelecionaAgenda(AgendasFiltradas.Last()); + } + else + { + await SelecionaAgenda(AgendasFiltradas.ElementAt(num)); + } + } + else + { + SelectedAgenda = new Agenda(); + Telefones = new ObservableCollection(); + Emails = new ObservableCollection(); + Alterar(alterar: false); + } + Carregando = false; + return true; + } + + internal async Task> Filtrar(string value) + { + return await Task.Run(() => FiltrarAgenda(value)); + } + + public List FiltrarAgenda(string filter) + { + AgendasFiltradas = (string.IsNullOrWhiteSpace(filter) ? new ObservableCollection(Agendas) : new ObservableCollection(from x in Agendas + where ValidationHelper.RemoveDiacritics(x.Nome.Trim()).ToUpper().Contains(ValidationHelper.RemoveDiacritics(filter)) + orderby x.Nome + select x)); + return AgendasFiltradas.ToList(); + } + + public async Task SelecionaAgenda(Agenda agenda = null) + { + Carregando = true; + SelectedAgenda = ((agenda == null) ? AgendasFiltradas.FirstOrDefault() : ((IEnumerable)AgendasFiltradas).FirstOrDefault((Func)((Agenda x) => ((DomainBase)x).Id == ((DomainBase)agenda).Id))); + if (SelectedAgenda != null) + { + Emails = await _servico.BuscarEmailsAsync(((DomainBase)SelectedAgenda).Id); + Telefones = await _servico.BuscarTelefonesAsync(((DomainBase)SelectedAgenda).Id); + } + else + { + Emails = null; + Telefones = null; + } + Carregando = false; + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Drawer/ArquivoDigitalViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Drawer/ArquivoDigitalViewModel.cs new file mode 100644 index 0000000..a25f375 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Drawer/ArquivoDigitalViewModel.cs @@ -0,0 +1,1229 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; +using Assinador.Model.Domain; +using CsQuery.ExtensionMethods.Internal; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.ViewModels.Generic; +using Gestor.Application.Views.Ferramentas; +using Gestor.Common.Security; +using Gestor.Common.Validation; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Financeiro; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.MalaDireta; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.Helper; +using Gestor.Model.License; + +namespace Gestor.Application.ViewModels.Drawer; + +public class ArquivoDigitalViewModel : BaseSegurosViewModel +{ + private readonly ClienteServico _servico; + + private Visibility _assinarVisibility = (Visibility)2; + + private Visibility _visibilityWhatsApp = (Visibility)2; + + private bool _carregando; + + private bool _activated = true; + + private bool _adDocumento; + + private Visibility _adDocumentoVisibility; + + private bool _isVisibleSalvar; + + private Visibility _enviarSelecionadosVisibility; + + private Cliente _selectedCliente = new Cliente(); + + private ObservableCollection _telefones = new ObservableCollection(); + + private ObservableCollection _arquivos = new ObservableCollection(); + + private ObservableCollection _arquivosTela = new ObservableCollection(); + + private IndiceArquivoDigital _selectedArquivo = new IndiceArquivoDigital(); + + private ObservableCollection _arquivosAnexados = new ObservableCollection(); + + private ArquivoDigital _selectedAnexado = new ArquivoDigital(); + + private string _titulo = ""; + + private ObservableCollection _emails = new ObservableCollection(); + + private string _assunto; + + private string _corpo; + + private string _nome; + + private string _documento; + + private string _email; + + private string _licencas; + + private string _assinadorKey; + + private FiltroArquivoDigital Filtro { get; } + + public Visibility AssinarVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _assinarVisibility; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _assinarVisibility = value; + OnPropertyChanged("AssinarVisibility"); + } + } + + public Visibility VisibilityWhatsApp + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityWhatsApp; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityWhatsApp = value; + OnPropertyChanged("VisibilityWhatsApp"); + } + } + + public bool Carregando + { + get + { + return _carregando; + } + set + { + _carregando = value; + base.IsEnabled = !value; + OnPropertyChanged("Carregando"); + } + } + + public bool Activated + { + get + { + return _activated; + } + set + { + _activated = value; + OnPropertyChanged("Activated"); + } + } + + public bool AdDocumento + { + get + { + return _adDocumento; + } + set + { + _adDocumento = value; + CarregarArquivos(); + OnPropertyChanged("AdDocumento"); + } + } + + public Visibility AdDocumentoVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _adDocumentoVisibility; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _adDocumentoVisibility = value; + OnPropertyChanged("AdDocumentoVisibility"); + } + } + + public bool IsVisibleSalvar + { + get + { + return _isVisibleSalvar; + } + set + { + _isVisibleSalvar = value; + OnPropertyChanged("IsVisibleSalvar"); + } + } + + public Visibility EnviarSelecionadosVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _enviarSelecionadosVisibility; + } + set + { + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + _enviarSelecionadosVisibility = (Visibility)(Restricao((TipoRestricao)20) ? 2 : ((int)value)); + OnPropertyChanged("EnviarSelecionadosVisibility"); + } + } + + public Cliente SelectedCliente + { + get + { + return _selectedCliente; + } + set + { + _selectedCliente = value; + OnPropertyChanged("SelectedCliente"); + } + } + + public ObservableCollection Telefones + { + get + { + return _telefones; + } + set + { + _telefones = value; + OnPropertyChanged("Telefones"); + } + } + + public ObservableCollection Arquivos + { + get + { + return _arquivos; + } + set + { + _arquivos = value; + ArquivosTela = value; + OnPropertyChanged("Arquivos"); + } + } + + public ObservableCollection ArquivosTela + { + get + { + return _arquivosTela; + } + set + { + _arquivosTela = value; + OnPropertyChanged("ArquivosTela"); + } + } + + public IndiceArquivoDigital SelectedArquivo + { + get + { + return _selectedArquivo; + } + set + { + _selectedArquivo = value; + OnPropertyChanged("SelectedArquivo"); + } + } + + public ObservableCollection ArquivosAnexados + { + get + { + return _arquivosAnexados; + } + set + { + _arquivosAnexados = value; + IsVisibleSalvar = value != null && value.Count > 0; + OnPropertyChanged("ArquivosAnexados"); + } + } + + public ArquivoDigital SelectedAnexado + { + get + { + return _selectedAnexado; + } + set + { + _selectedAnexado = value; + OnPropertyChanged("SelectedAnexado"); + } + } + + public string Titulo + { + get + { + return _titulo; + } + set + { + _titulo = value; + OnPropertyChanged("Titulo"); + } + } + + public ObservableCollection Emails + { + get + { + return _emails; + } + set + { + _emails = value; + OnPropertyChanged("Emails"); + } + } + + public string Assunto + { + get + { + return _assunto; + } + set + { + _assunto = value; + OnPropertyChanged("Assunto"); + } + } + + public string Corpo + { + get + { + return _corpo; + } + set + { + _corpo = value; + OnPropertyChanged("Corpo"); + } + } + + public string Nome + { + get + { + return _nome; + } + set + { + _nome = value; + OnPropertyChanged("Nome"); + } + } + + public string Documento + { + get + { + return _documento; + } + set + { + _documento = value; + OnPropertyChanged("Documento"); + } + } + + public string Email + { + get + { + return _email; + } + set + { + _email = value?.Trim(); + OnPropertyChanged("Email"); + } + } + + public string Licencas + { + get + { + return _licencas; + } + set + { + _licencas = value; + OnPropertyChanged("Licencas"); + } + } + + public ArquivoDigitalViewModel(FiltroArquivoDigital filtro) + { + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + //IL_0009: Unknown result type (might be due to invalid IL or missing references) + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Expected O, but got Unknown + //IL_0042: Unknown result type (might be due to invalid IL or missing references) + //IL_004c: Expected O, but got Unknown + //IL_0058: Unknown result type (might be due to invalid IL or missing references) + //IL_0062: Expected O, but got Unknown + //IL_0098: Unknown result type (might be due to invalid IL or missing references) + //IL_009e: Invalid comparison between Unknown and I4 + //IL_00a1: Unknown result type (might be due to invalid IL or missing references) + //IL_00a7: Invalid comparison between Unknown and I4 + //IL_00c6: Unknown result type (might be due to invalid IL or missing references) + //IL_00cc: Invalid comparison between Unknown and I4 + //IL_00aa: Unknown result type (might be due to invalid IL or missing references) + //IL_00b0: Invalid comparison between Unknown and I4 + //IL_00cf: Unknown result type (might be due to invalid IL or missing references) + //IL_00d5: Invalid comparison between Unknown and I4 + //IL_00b3: Unknown result type (might be due to invalid IL or missing references) + //IL_00b9: Invalid comparison between Unknown and I4 + //IL_00d8: Unknown result type (might be due to invalid IL or missing references) + //IL_00de: Invalid comparison between Unknown and I4 + //IL_0108: Unknown result type (might be due to invalid IL or missing references) + //IL_010d: Unknown result type (might be due to invalid IL or missing references) + //IL_010e: Unknown result type (might be due to invalid IL or missing references) + //IL_015c: Expected I4, but got Unknown + Filtro = filtro; + _servico = new ClienteServico(); + CarregarArquivos(); + VisibilityWhatsApp = (Visibility)(((int)filtro.Tipo != 2 && (int)filtro.Tipo != 3 && (int)filtro.Tipo != 4 && (int)filtro.Tipo != 5) ? 2 : 0); + AdDocumentoVisibility = (Visibility)((((int)filtro.Tipo != 4 && (int)filtro.Tipo != 3 && (int)filtro.Tipo != 5) || !new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)2).Consultar) ? 2 : 0); + base.EnableMenu = true; + TipoArquivoDigital tipo = filtro.Tipo; + switch ((int)tipo) + { + default: + EnviarSelecionadosVisibility = (Visibility)0; + break; + case 0: + case 6: + case 7: + case 8: + case 9: + case 10: + case 12: + case 13: + case 14: + case 15: + case 17: + EnviarSelecionadosVisibility = (Visibility)2; + break; + } + } + + public async void CarregarArquivos() + { + await PermissaoTela((TipoTela)6); + await PermissaoArquivoDigital(Filtro.Tipo); + await CarregaArquivos(); + string licencas = "PRODUTO NÃO CONTRATADO"; + if (LicenseHelper.Produtos.Any((Licenca x) => (int)x.Produto == 86)) + { + _assinadorKey = await AssinadorHelper.Key(); + licencas = $"{await AssinadorHelper.Licencas(_assinadorKey)} LICENÇAS DISPONÍVEIS"; + } + Licencas = licencas; + VerificarEnables(0L); + } + + private void AtualizaEmpresa() + { + Recursos.Empresa = new BaseServico().BuscarEmpresa(Recursos.Usuario.IdEmpresa); + } + + public string CarregarMensagem() + { + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Invalid comparison between Unknown and I4 + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Invalid comparison between Unknown and I4 + //IL_0076: Unknown result type (might be due to invalid IL or missing references) + //IL_007b: Unknown result type (might be due to invalid IL or missing references) + //IL_007d: Unknown result type (might be due to invalid IL or missing references) + //IL_0080: Unknown result type (might be due to invalid IL or missing references) + //IL_009a: Expected I4, but got Unknown + //IL_016a: Unknown result type (might be due to invalid IL or missing references) + //IL_0170: Expected O, but got Unknown + //IL_0287: Unknown result type (might be due to invalid IL or missing references) + //IL_028e: Expected O, but got Unknown + //IL_0403: Unknown result type (might be due to invalid IL or missing references) + //IL_0409: Expected O, but got Unknown + //IL_0549: Unknown result type (might be due to invalid IL or missing references) + //IL_0550: Expected O, but got Unknown + //IL_009a: Unknown result type (might be due to invalid IL or missing references) + //IL_009e: Invalid comparison between Unknown and I4 + AtualizaEmpresa(); + string text = (((int)Recursos.Empresa.TipoTelefone1 == 11) ? "0300" : (((int)Recursos.Empresa.TipoTelefone1 == 10) ? "0800" : "")); + text = text + " " + Recursos.Empresa.PrimeiroPrefixo + " " + Recursos.Empresa.PrimeiroTelefone; + TipoArquivoDigital tipo = Filtro.Tipo; + switch (tipo - 1) + { + default: + if ((int)tipo == 13) + { + return "Prezado(a) " + ValidationHelper.Captalize(SelectedCliente.Nome) + ", segue o(s) link(s) para download referente ao(s) seu(s) arquivo(s). " + Environment.NewLine + Environment.NewLine + "[*LINK*]" + Environment.NewLine + Environment.NewLine + "<|LINKASSINATURA|>" + Environment.NewLine + Environment.NewLine + "Para mais informações entre contato conosco pelo " + text + "." + Environment.NewLine + "Atenciosamente " + ValidationHelper.Captalize(Recursos.Empresa.Nome) + "."; + } + return "Prezado(a), segue o(s) link(s) para download referente ao(s) seu(s) arquivo(s)." + Environment.NewLine + Environment.NewLine + "[*LINK*]" + Environment.NewLine + Environment.NewLine + " Para mais informações entre contato conosco pelo " + text + "." + Environment.NewLine + "Atenciosamente " + ValidationHelper.Captalize(Recursos.Empresa.Nome) + "."; + case 0: + return "Prezado(a) " + ValidationHelper.Captalize(SelectedCliente.Nome) + ", segue o(s) link(s) para download referente ao(s) seu(s) arquivo(s). " + Environment.NewLine + Environment.NewLine + "[*LINK*]" + Environment.NewLine + Environment.NewLine + "<|LINKASSINATURA|>" + Environment.NewLine + Environment.NewLine + "Para mais informações entre contato conosco pelo " + text + "." + Environment.NewLine + "Atenciosamente " + ValidationHelper.Captalize(Recursos.Empresa.Nome) + "."; + case 1: + { + Documento documento = (Documento)Filtro.Parente; + string text2 = (string.IsNullOrWhiteSpace(documento.Apolice) ? ("Proposta Número " + documento.Proposta) : ("Apólice Número " + documento.Apolice)); + return "Prezado(a) " + ValidationHelper.Captalize(SelectedCliente.Nome) + " segue o(s) link(s) para download do(s) arquivo(s) referente ao seu seguro. " + Environment.NewLine + $"{ValidationHelper.Captalize(documento.Controle.Seguradora.Nome)}, {ValidationHelper.Captalize(documento.Controle.Ramo.Nome)}, {text2} de Vigências entre {documento.Vigencia1:d} e {documento.Vigencia2:d}. {Environment.NewLine}{Environment.NewLine}[*LINK*]{Environment.NewLine}{Environment.NewLine}<|LINKASSINATURA|>Para mais informações entre contato conosco pelo {text}.{Environment.NewLine}Atenciosamente {ValidationHelper.Captalize(Recursos.Empresa.Nome)}."; + } + case 2: + { + Parcela val2 = (Parcela)Filtro.Parente; + Documento documento = val2.Documento; + string text2 = (string.IsNullOrWhiteSpace(documento.Apolice) ? ("Proposta Número " + documento.Proposta) : ("Apólice Número " + documento.Apolice)); + return "Prezado(a) " + ValidationHelper.Captalize(SelectedCliente.Nome) + " segue o(s) link(s) para download do(s) arquivo(s) referente a sua parcela. " + Environment.NewLine + $"Parcela {val2.NumeroParcela} de {documento.NumeroParcelas}, valor {val2.Valor:C2} de vencimento {val2.Vencimento:d}. {Environment.NewLine}" + $"{ValidationHelper.Captalize(documento.Controle.Seguradora.Nome)}, {ValidationHelper.Captalize(documento.Controle.Ramo.Nome)}, {text2} de Vigências entre {documento.Vigencia1:d} e {documento.Vigencia2:d}. {Environment.NewLine}{Environment.NewLine}[*LINK*]{Environment.NewLine}{Environment.NewLine}<|LINKASSINATURA|>Para mais informações entre contato conosco pelo {text}.{Environment.NewLine}Atenciosamente {ValidationHelper.Captalize(Recursos.Empresa.Nome)}."; + } + case 3: + { + Item item = (Item)Filtro.Parente; + Documento documento = item.Documento; + string text2 = (string.IsNullOrWhiteSpace(documento.Apolice) ? ("Proposta Número " + documento.Proposta) : ("Apólice Número " + documento.Apolice)); + return "Prezado(a) " + ValidationHelper.Captalize(SelectedCliente.Nome) + " segue o(s) link(s) para download do(s) arquivo(s) referente ao seu seguro. " + Environment.NewLine + "Item " + item.Descricao + ". " + Environment.NewLine + $"{ValidationHelper.Captalize(documento.Controle.Seguradora.Nome)}, {ValidationHelper.Captalize(documento.Controle.Ramo.Nome)}, {text2} de Vigências entre {documento.Vigencia1:d} e {documento.Vigencia2:d}. {Environment.NewLine}{Environment.NewLine}[*LINK*]{Environment.NewLine}{Environment.NewLine}<|LINKASSINATURA|>Para mais informações entre contato conosco pelo {text}.{Environment.NewLine}Atenciosamente {ValidationHelper.Captalize(Recursos.Empresa.Nome)}."; + } + case 4: + { + Sinistro val = (Sinistro)Filtro.Parente; + Item item = val.ControleSinistro.Item; + Documento documento = item.Documento; + string text2 = (string.IsNullOrWhiteSpace(documento.Apolice) ? ("Proposta Número " + documento.Proposta) : ("Apólice Número " + documento.Apolice)); + return "Prezado(a) " + ValidationHelper.Captalize(SelectedCliente.Nome) + " segue o(s) link(s) para download do(s) arquivo(s) referente ao seu sinistro. " + Environment.NewLine + "Sinistro de número " + val.Numero + " Item sinistrado " + val.ItemSinistrado + ". " + Environment.NewLine + $"{ValidationHelper.Captalize(documento.Controle.Seguradora.Nome)}, {ValidationHelper.Captalize(documento.Controle.Ramo.Nome)}, {text2} de Vigências entre {documento.Vigencia1:d} e {documento.Vigencia2:d}. {Environment.NewLine}{Environment.NewLine}[*LINK*]{Environment.NewLine}{Environment.NewLine}<|LINKASSINATURA|>Para mais informações entre contato conosco pelo {text}.{Environment.NewLine}Atenciosamente {ValidationHelper.Captalize(Recursos.Empresa.Nome)}."; + } + } + } + + public async Task CarregaArquivos() + { + FiltroArquivoDigital filtro = Filtro; + if (filtro != null && filtro.Id == 0) + { + return; + } + Carregando = true; + base.IsVisible = (Visibility)2; + AssinarVisibility = (Visibility)2; + if (Filtro != null) + { + List arquivos = await ArquivoDigitalServico.BuscarPorTipo(Filtro.Tipo, Filtro.Id); + if (AdDocumento) + { + List list = arquivos; + list.AddRange(await ArquivoDigitalServico.BuscarPorTipo((TipoArquivoDigital)2, Filtro.IdApolice)); + } + Arquivos = new ObservableCollection(arquivos.OrderBy((IndiceArquivoDigital x) => x.Descricao)); + TipoArquivoDigital tipo = Filtro.Tipo; + switch (tipo - 2) + { + default: + SelectedCliente = (Cliente)Filtro.Parente; + Titulo = "ARQUIVO DIGITAL DO CLIENTE \"" + SelectedCliente.Nome + "\""; + break; + case 0: + { + AssinarVisibility = (Visibility)0; + Documento val13 = (Documento)Filtro.Parente; + SelectedCliente = val13.Controle.Cliente; + Titulo = ((val13.Apolice != string.Empty) ? ("ARQUIVO DIGITAL DA APÓLICE \"" + val13.Apolice + "\"") : ("ARQUIVO DIGITAL DA PROPOSTA \"" + val13.Proposta + "\"")); + break; + } + case 1: + { + AssinarVisibility = (Visibility)0; + Parcela val16 = (Parcela)Filtro.Parente; + SelectedCliente = val16.Documento.Controle.Cliente; + Titulo = ((val16.Documento.Apolice != string.Empty) ? $"ARQUIVO DIGITAL DA PARCELA \"{val16.NumeroParcela}\" DA APÓLICE \"{val16.Documento.Apolice}\"" : $"ARQUIVO DIGITAL DA PARCELA \"{val16.NumeroParcela}\" DA PROPOSTA \"{val16.Documento.Proposta}\""); + DetalheExtrato val17 = await new ServicoExtrato().FindByParcelaId(((DomainBase)val16).Id); + if (val17 != null) + { + arquivos = await ArquivoDigitalServico.BuscarPorTipo((TipoArquivoDigital)7, ((DomainBase)val17.Extrato).Id); + arquivos.ForEach(delegate(IndiceArquivoDigital x) + { + x.NaoExcluir = true; + }); + ExtensionMethods.AddRange((ICollection)Arquivos, (IEnumerable)new ObservableCollection(arquivos.OrderBy((IndiceArquivoDigital x) => x.Descricao))); + } + break; + } + case 2: + { + AssinarVisibility = (Visibility)0; + Item val15 = (Item)Filtro.Parente; + SelectedCliente = val15.Documento.Controle.Cliente; + Titulo = "ARQUIVO DIGITAL DO ITEM \"" + val15.Descricao + "\""; + break; + } + case 3: + { + AssinarVisibility = (Visibility)0; + Sinistro val14 = (Sinistro)Filtro.Parente; + SelectedCliente = val14.ControleSinistro.Item.Documento.Controle.Cliente; + Titulo = "ARQUIVO DIGITAL DO SINITRO \"" + val14.Numero + "\" DO ITEM \"" + val14.ControleSinistro.Item.Descricao + "\""; + break; + } + case 7: + { + Lancamento val12 = (Lancamento)Filtro.Parente; + if (val12.Historico.Equals("TRANSFERÊNCIA ENTRE CONTAS")) + { + await ShowMessage("NÃO É POSSIVEL INCLUIR ARQUIVOS EM TRANSFERÊNCIA ENTRE CONTAS"); + CloseDrawer(); + return; + } + SelectedCliente = new Cliente + { + Id = val12.Controle.Fornecedor.Id, + Nome = val12.Controle.Fornecedor.Nome + }; + Titulo = $"ARQUIVO DIGITAL DO LANCAMENTO {((DomainBase)val12).Id}, PLANO {val12.Controle.Plano.Nome}, CENTRO {val12.Controle.Centro.Descricao}"; + break; + } + case 8: + { + Fornecedor val11 = (Fornecedor)Filtro.Parente; + SelectedCliente = new Cliente + { + Id = val11.Id, + Nome = val11.Nome + }; + Titulo = $"ARQUIVO DIGITAL DO FORNECEDOR {val11.Nome} {val11.Id}"; + break; + } + case 9: + { + Prospeccao val10 = (Prospeccao)Filtro.Parente; + SelectedCliente = new Cliente + { + Id = ((DomainBase)val10).Id, + Nome = val10.Nome + }; + Titulo = $"ARQUIVO DIGITAL DA PROSPECÇÃO {val10.Nome} {((DomainBase)val10).Id} {val10.Item}"; + break; + } + case 5: + { + Extrato val9 = (Extrato)Filtro.Parente; + SelectedCliente = new Cliente + { + Nome = "EXTRATO " + val9.Numero + }; + Titulo = $"ARQUIVO DIGITAL DO EXTRATO {val9.Numero} ID:{((DomainBase)val9).Id}"; + break; + } + case 6: + { + Seguradora val8 = (Seguradora)Filtro.Parente; + SelectedCliente = new Cliente + { + Id = ((DomainBase)val8).Id, + Nome = val8.Nome + }; + Titulo = $"ARQUIVO DIGITAL DA SEGURADORA {val8.Nome} {((DomainBase)val8).Id}"; + break; + } + case 4: + { + Vendedor val7 = (Vendedor)Filtro.Parente; + SelectedCliente = new Cliente + { + Id = ((DomainBase)val7).Id, + Nome = val7.Nome + }; + Titulo = $"ARQUIVO DIGITAL DO VENDEDOR {val7.Nome} {((DomainBase)val7).Id}"; + break; + } + case 10: + { + Usuario val6 = (Usuario)Filtro.Parente; + SelectedCliente = new Cliente + { + Id = ((DomainBase)val6).Id, + Nome = val6.Nome + }; + Titulo = $"ARQUIVO DIGITAL DO USUÁRIO {val6.Nome} {((DomainBase)val6).Id}"; + break; + } + case 11: + { + Empresa val5 = (Empresa)Filtro.Parente; + SelectedCliente = new Cliente + { + Id = ((DomainBase)val5).Id, + Nome = val5.Nome + }; + Titulo = $"ARQUIVO DIGITAL DA EMPRESA {val5.Nome} {((DomainBase)val5).Id}"; + break; + } + case 12: + { + Socio val4 = (Socio)Filtro.Parente; + SelectedCliente = new Cliente + { + Id = ((DomainBase)val4).Id, + Nome = val4.Nome + }; + Titulo = $"ARQUIVO DIGITAL DO SÓCIO {val4.Nome} {((DomainBase)val4).Id}"; + break; + } + case 13: + { + Tarefa val3 = (Tarefa)Filtro.Parente; + SelectedCliente = new Cliente + { + Id = ((DomainBase)val3).Id, + Nome = "TAREFA - " + val3.Titulo + }; + Titulo = $"ANEXO DA TAREFA {val3.Titulo} {((DomainBase)val3).Id}"; + break; + } + case 14: + { + NotaFiscal val2 = (NotaFiscal)Filtro.Parente; + SelectedCliente = new Cliente + { + Id = ((DomainBase)val2).Id, + Nome = $"NOTA FISCAL - {val2.Seguradora.NomeSocial} {val2.Data:d}" + }; + Titulo = $"ANEXO DA NOTA FISCAL {val2.Seguradora.NomeSocial} {val2.Data:d}"; + break; + } + case 15: + { + Estipulante val = (Estipulante)Filtro.Parente; + SelectedCliente = new Cliente + { + Id = ((DomainBase)val).Id, + Nome = "ESTIPULANTE - " + val.Nome + }; + Titulo = "ANEXO DO ESTIPULANTE " + val.Nome; + break; + } + } + } + if (Filtro != null) + { + TipoArquivoDigital tipo = Filtro.Tipo; + switch (tipo - 1) + { + default: + if ((int)tipo == 17) + { + Estipulante val20 = (Estipulante)Filtro.Parente; + Telefones = new ObservableCollection + { + new ClienteTelefone + { + Prefixo = val20.PrimeiroPrefixo, + Numero = val20.PrimeiroTelefone + }, + new ClienteTelefone + { + Prefixo = val20.SegundoPrefixo, + Numero = val20.SegundoTelefone + } + }; + } + break; + case 0: + case 1: + case 2: + case 3: + case 4: + { + Cliente cliente = await _servico.BuscarClienteAsync(((DomainBase)SelectedCliente).Id); + Telefones = await _servico.BuscarTelefonesAsync(((DomainBase)SelectedCliente).Id); + ObservableCollection source = await new ClienteServico().BuscarEmailsAsync(((DomainBase)SelectedCliente).Id); + if (SelectedCliente.Documento == null || ValidationHelper.OnlyNumber(SelectedCliente.Documento).Length <= 11) + { + ArquivoDigitalViewModel arquivoDigitalViewModel = this; + ClienteEmail? obj = source.FirstOrDefault(); + arquivoDigitalViewModel.Email = ((obj != null) ? ((EmailBase)obj).Email : null); + Nome = SelectedCliente.Nome; + Documento = SelectedCliente.Documento; + break; + } + ArquivoDigitalViewModel arquivoDigitalViewModel2 = this; + object obj2; + if (cliente == null) + { + obj2 = null; + } + else + { + ResponsavelAssinatura responsavelAssinatura = cliente.ResponsavelAssinatura; + obj2 = ((responsavelAssinatura != null) ? responsavelAssinatura.EmailResponsavel : null); + } + if (obj2 == null) + { + ClienteEmail? obj3 = source.FirstOrDefault(); + obj2 = ((obj3 != null) ? ((EmailBase)obj3).Email : null); + } + arquivoDigitalViewModel2.Email = (string)obj2; + ArquivoDigitalViewModel arquivoDigitalViewModel3 = this; + object obj4; + if (cliente == null) + { + obj4 = null; + } + else + { + ResponsavelAssinatura responsavelAssinatura2 = cliente.ResponsavelAssinatura; + obj4 = ((responsavelAssinatura2 != null) ? responsavelAssinatura2.NomeResponsavel : null); + } + if (obj4 == null) + { + obj4 = SelectedCliente.Nome; + } + arquivoDigitalViewModel3.Nome = (string)obj4; + ArquivoDigitalViewModel arquivoDigitalViewModel4 = this; + object obj5; + if (cliente == null) + { + obj5 = null; + } + else + { + ResponsavelAssinatura responsavelAssinatura3 = cliente.ResponsavelAssinatura; + obj5 = ((responsavelAssinatura3 != null) ? responsavelAssinatura3.DocumentoResponsavel : null); + } + if (obj5 == null) + { + obj5 = SelectedCliente.Documento; + } + arquivoDigitalViewModel4.Documento = (string)obj5; + break; + } + case 9: + { + Fornecedor val19 = (Fornecedor)Filtro.Parente; + Telefones = new ObservableCollection + { + new ClienteTelefone + { + Prefixo = val19.Prefixo1, + Numero = val19.Telefone1 + }, + new ClienteTelefone + { + Prefixo = val19.Prefixo2, + Numero = val19.Telefone2 + } + }; + break; + } + case 8: + { + Lancamento val18 = (Lancamento)Filtro.Parente; + Telefones = new ObservableCollection + { + new ClienteTelefone + { + Prefixo = val18.Controle.Fornecedor.Prefixo1, + Numero = val18.Controle.Fornecedor.Telefone1 + }, + new ClienteTelefone + { + Prefixo = val18.Controle.Fornecedor.Prefixo2, + Numero = val18.Controle.Fornecedor.Telefone2 + } + }; + break; + } + case 5: + case 6: + case 7: + break; + } + } + base.IsVisible = (Visibility)0; + Carregando = false; + } + + public void Baixar(IndiceArquivoDigital arquivo, bool abrir = false) + { + if (arquivo != null && arquivo.IdArquivoDigital != 0L) + { + Download(arquivo, abrir); + } + } + + public async Task Excluir(IndiceArquivoDigital arquivo) + { + if (arquivo != null && arquivo.IdArquivoDigital != 0L && await ArquivoDigitalServico.DeleteAttachment(arquivo)) + { + await CarregaArquivos(); + } + } + + public async void Editar(IndiceArquivoDigital arquivo) + { + if (arquivo != null && arquivo.IdArquivoDigital != 0L) + { + await ArquivoDigitalServico.Save(arquivo); + } + } + + public async Task BaixarTodos() + { + if (Arquivos == null || Arquivos.Count == 0) + { + return false; + } + return await DownloadAll(Arquivos.ToList(), Filtro.Id); + } + + public async void Anexar() + { + List attacheds = ((IEnumerable)Arquivos).Select((Func)((IndiceArquivoDigital x) => new ArquivoDigital + { + Descricao = x.Descricao, + Extensao = x.Extensao + })).ToList(); + List list = await AddAttachments(ArquivosAnexados.ToList(), attacheds); + if (list == null) + { + return; + } + if (!Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 47)) + { + list = await ShowDialogAnexar(list); + if (list == null) + { + return; + } + } + list.AddRange(ArquivosAnexados); + ArquivosAnexados = new ObservableCollection(list); + } + + public void Delete(ArquivoDigital arquivo) + { + if (SelectedAnexado != null) + { + ArquivoDigital item = ArquivosAnexados.First((ArquivoDigital x) => x.Descricao == arquivo.Descricao); + ArquivosAnexados.Remove(item); + ArquivosAnexados = new ObservableCollection(ArquivosAnexados); + } + } + + public async Task SalvarAnexos() + { + if (ArquivosAnexados != null && ArquivosAnexados.Count != 0) + { + Carregando = true; + List arquivos = ArquivosAnexados.ToList(); + if (!(await SalvarAttachments(arquivos, Filtro.Tipo, Filtro.Id))) + { + Carregando = false; + return; + } + await CarregaArquivos(); + ArquivosAnexados = new ObservableCollection(); + Carregando = false; + } + } + + public void LimparAnexos() + { + ArquivosAnexados = new ObservableCollection(); + } + + public async Task PrepararEnvio() + { + if (!Arquivos.Any((IndiceArquivoDigital x) => x.Selecionado)) + { + await ShowMessage("É NECESSÁRIO SELECIONAR AO MENOS UM ARQUIVO PARA ENVIO."); + return null; + } + MalaDireta maladireta = new MalaDireta + { + Cliente = SelectedCliente, + ArquivoDigital = Arquivos.Where((IndiceArquivoDigital x) => x.Selecionado).ToList() + }; + TipoArquivoDigital tipo = Filtro.Tipo; + switch (tipo - 2) + { + default: + { + if ((int)tipo != 11) + { + SelectedCliente = (Cliente)Filtro.Parente; + Titulo = "ARQUIVO DIGITAL DO CLIENTE \"" + SelectedCliente.Nome + "\""; + break; + } + Prospeccao val5 = (maladireta.Prospeccao = (Prospeccao)Filtro.Parente); + ((DomainBase)maladireta.Cliente).Id = 0L; + Assunto = "DOCUMENTOS REFERENTES PROSPECÇÃO " + val5.Nome; + Corpo = ""; + maladireta.Tela = (TipoTela)33; + break; + } + case 0: + { + Documento apolice = (Documento)Filtro.Parente; + List list2 = await CarregarItem(((DomainBase)apolice.Controle).Id, (StatusItem)0); + maladireta.Item = (Item)((list2.Count <= 1) ? ((object)list2.FirstOrDefault()) : ((object)new Item + { + Id = 0L, + Descricao = "APÓLICE COLETIVA" + })); + maladireta.Apolice = apolice; + Assunto = ((apolice.Apolice != string.Empty) ? ("DOCUMENTOS REFERENTES A APÓLICE " + apolice.Apolice) : ("DOCUMENTOS REFERENTES A PROPOSTA " + apolice.Proposta)); + Corpo = "PREZADO CLIENTE " + SelectedCliente.Nome + ", EM ANEXO OS DOCUMENTOS REFERENTES AO SEU SEGURO."; + maladireta.Tela = (TipoTela)2; + break; + } + case 1: + { + Parcela parcela = (Parcela)Filtro.Parente; + maladireta.Apolice = parcela.Documento; + maladireta.Parcela = parcela; + List list = await CarregarItem(((DomainBase)parcela.Documento.Controle).Id, (StatusItem)0); + maladireta.Item = (Item)((list.Count <= 1) ? ((object)list.FirstOrDefault()) : ((object)new Item + { + Id = 0L, + Descricao = "APÓLICE COLETIVA" + })); + Assunto = ((parcela.Documento.Apolice != string.Empty) ? $"DOCUMENTOS REFERENTE A PARCELA {parcela.NumeroParcela} DA APÓLICE {parcela.Documento.Apolice}" : $"DOCUMENTOS REFERENTE A PARCELA {parcela.NumeroParcela} DA PROPOSTA {parcela.Documento.Proposta}"); + Corpo = "PREZADO CLIENTE " + SelectedCliente.Nome + ", EM ANEXO OS DOCUMENTOS REFERENTES AS PARCELAS DE SEU SEGURO."; + maladireta.Tela = (TipoTela)5; + break; + } + case 2: + { + Item val3 = (Item)Filtro.Parente; + maladireta.Apolice = val3.Documento; + maladireta.Item = val3; + Assunto = "DOCUMENTOS REFERENTES AO ITEM " + val3.Descricao; + Corpo = "PREZADO CLIENTE " + SelectedCliente.Nome + ", EM ANEXO OS DOCUMENTOS REFERENTES AO SEU BEM."; + maladireta.Tela = (TipoTela)3; + break; + } + case 3: + { + Sinistro val2 = (maladireta.Sinistro = (Sinistro)Filtro.Parente); + maladireta.Item = val2.ControleSinistro.Item; + maladireta.Apolice = val2.ControleSinistro.Item.Documento; + Titulo = "DOCUMENTOS REFERENTES AO SINITRO " + val2.Numero; + Corpo = "PREZADO CLIENTE " + SelectedCliente.Nome + ", EM ANEXO OS DOCUMENTOS REFERENTES SINISTRO DO ITEM " + val2.ControleSinistro.Item.Descricao + "."; + maladireta.Tela = (TipoTela)7; + break; + } + } + return maladireta; + } + + public async Task CreateLink(IndiceArquivoDigital indice) + { + string value = $"{Funcoes.GetNetworkTime().Ticks}:{ApplicationHelper.IdFornecedor}:F:{((DomainBase)indice).Id}".Base64Encode(); + return Recursos.ApiArquivo.AddQuery("search", value); + } + + public async Task EnviarParaAssinatura() + { + if (!ArquivosTela.Any((IndiceArquivoDigital x) => x.Assinar)) + { + await ShowMessage("É NECESSÁRIO SELECIONAR AO MENOS UM ARQUIVO PARA ENVIAR PARA ASSINATURA."); + return false; + } + if (!(await ShowMessage("DESEJA ENVIAR OS ARQUIVOS SELECIONADOS PARA ASSINATURA ELETRÔNICA DO SEGURADO?", "SIM", "NÃO"))) + { + return false; + } + if (Email.EndsWith(";")) + { + await ShowMessage("É NECESSÁRIO QUE O ASSINANTE POSSUA UM E-MAIL VÁLIDO"); + return false; + } + Loading(isLoading: true); + _assinadorKey = await AssinadorHelper.Key(); + int licencasDisponiveis = await AssinadorHelper.Licencas(_assinadorKey); + if (licencasDisponiveis < Arquivos.Count((IndiceArquivoDigital x) => x.Assinar && !x.EnviadoAssinatura)) + { + if (Restricao((TipoRestricao)113)) + { + await ShowMessage("VOCÊ NÃO POSSUI MAIS LICENÇAS DISPONÍVEIS E O USUÁRIO NÃO PODE CONTRATAR, ENTRE EM CONTATO COM O ADMINISTRADOR DO SISTEMA."); + Loading(isLoading: false); + return false; + } + if (!(await ShowMessage("VOCÊ NÃO POSSUI MAIS LICENÇAS DISPONÍVEIS, DESEJA CONTRATAR MAIS?", "SIM", "NÃO"))) + { + Loading(isLoading: false); + return false; + } + string arguments = new Token().Encrypt(string.Format("{0}:{1}:{2}:{3}", ApplicationHelper.NumeroSerial, ApplicationHelper.IdFornecedor, ((DomainBase)Recursos.Usuario).Id, ApplicationHelper.Beta ? "1" : "0")); + ((Window)new DownloadWindow(new Parameters + { + Beta = ApplicationHelper.Beta, + Type = 8, + Application = "Assinador.Application.exe", + Directory = "Assinador.Application", + Arguments = arguments, + Run = true + })).Show(); + Loading(isLoading: false); + return false; + } + AssinadorHelper.Parametros = await AssinaturaServico.BuscarParametrosAssinatura(Recursos.Usuario.IdEmpresa); + int arquivosEnviados = 0; + int arquivosSelecionados = ArquivosTela.Where((IndiceArquivoDigital x) => x.Assinar).Count(); + foreach (IndiceArquivoDigital indice in ArquivosTela.Where((IndiceArquivoDigital x) => x.Assinar)) + { + if (indice.Assinado) + { + continue; + } + if (indice.EnviadoAssinatura) + { + await new AssinaturaServico().Reenviar(((DomainBase)indice).Id); + continue; + } + ArquivoParaAssinaturaAssinador val = await Assinar(indice); + if (val != null) + { + licencasDisponiveis--; + indice.EnviadoAssinatura = true; + indice.UrlAssinatura = val.UrlAssinatura; + arquivosEnviados++; + } + } + Loading(isLoading: false); + Arquivos = new ObservableCollection(Arquivos); + await ShowMessage($"{arquivosEnviados} DE {arquivosSelecionados} ARQUIVOS FORAM ENVIADOS PARA ASSINATURA. VOCÊ SERÁ NOTIFICADO QUANDO OS DOCUMENTOS FOREM ASSINADOS"); + return true; + } + + public async Task Assinar(IndiceArquivoDigital indice, bool lote = false) + { + try + { + AssinaturaServico servico = new AssinaturaServico(); + ArquivoDigitalServico servicoArquivo = new ArquivoDigitalServico(); + if (await servico.VerificarAssinado(((DomainBase)indice).Id)) + { + if (!lote) + { + await ShowMessage("ARQUIVO JÁ ASSINADO"); + } + return null; + } + if (await servico.VerificarEnviado(((DomainBase)indice).Id)) + { + return await servico.Reenviar(((DomainBase)indice).Id); + } + if (Nome == null || string.IsNullOrWhiteSpace(Nome)) + { + if (!lote) + { + await ShowMessage("É NECESSÁRIO QUE O ASSINANTE POSSUA UM NOME VÁLIDO"); + } + return null; + } + if (Documento == null || !ValidationHelper.ValidateDocument(Documento)) + { + if (!lote) + { + await ShowMessage("É NECESSÁRIO QUE O ASSINANTE POSSUA UM DOCUMENTO VÁLIDO"); + } + return null; + } + if (Documento.Length > 14) + { + if (!lote) + { + await ShowMessage("O DOCUMENTO DO ASSINANTE DEVE SER CPF E NÃO CNPJ"); + } + return null; + } + if (Email == null || !ValidationHelper.ValidacaoEmail(Email)) + { + if (!lote) + { + await ShowMessage("É NECESSÁRIO QUE O ASSINANTE POSSUA UM E-MAIL VÁLIDO"); + } + return null; + } + ArquivoDigital arquivoDigital = await servicoArquivo.BuscarPorId(indice.IdArquivoDigital, indice.Bd); + new Documento(); + TipoArquivoDigital tipo = Filtro.Tipo; + long id; + switch (tipo - 2) + { + default: + return null; + case 3: + id = ((DomainBase)((Sinistro)Filtro.Parente).ControleSinistro.Item.Documento).Id; + break; + case 1: + id = ((DomainBase)((Parcela)Filtro.Parente).Documento).Id; + break; + case 2: + id = ((DomainBase)((Item)Filtro.Parente).Documento).Id; + break; + case 0: + id = ((DomainBase)(Documento)Filtro.Parente).Id; + break; + } + return await servico.Save(await servico.Assinar(arquivoDigital, new ApoliceAssinador + { + ArquivoId = ((DomainBase)indice).Id, + ClienteId = ((DomainBase)SelectedCliente).Id, + Cliente = Nome, + Email = Email, + Documento = Documento, + Id = id + })); + } + catch (Exception ex) + { + await ShowMessage("ERRO AO ENVIAR PARA ASSINATURA" + Environment.NewLine + ex.Message + Environment.NewLine + "POR FAVOR CONTATE A AGGER ATRAVÉS DO PAINEL DE ATENDIMENTOS"); + return null; + } + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Drawer/ExpedicaoViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Drawer/ExpedicaoViewModel.cs new file mode 100644 index 0000000..d4633e7 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Drawer/ExpedicaoViewModel.cs @@ -0,0 +1,164 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Drawer; + +public class ExpedicaoViewModel : BaseSegurosViewModel +{ + private readonly ExpedicaoServico _servico; + + private readonly Documento _documento; + + private bool _carregando; + + private Expedicao _selectedExpedicao = new Expedicao(); + + private ObservableCollection _expedicoes = new ObservableCollection(); + + public bool Carregando + { + get + { + return _carregando; + } + set + { + _carregando = value; + base.EnableMenu = !value; + OnPropertyChanged("Carregando"); + } + } + + public Expedicao SelectedExpedicao + { + get + { + return _selectedExpedicao; + } + set + { + _selectedExpedicao = value; + VerificarEnables((value != null) ? new long?(((DomainBase)value).Id) : null); + OnPropertyChanged("SelectedExpedicao"); + } + } + + public ObservableCollection Expedicoes + { + get + { + return _expedicoes; + } + set + { + _expedicoes = value; + OnPropertyChanged("Expedicoes"); + } + } + + public ExpedicaoViewModel(Documento documento) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_000b: Expected O, but got Unknown + _servico = new ExpedicaoServico(); + _documento = documento; + Seleciona(documento); + } + + private async void Seleciona(Documento documento) + { + Carregando = true; + await PermissaoTela((TipoTela)46); + await Carregar(documento); + if (Expedicoes.Count > 0) + { + SelectedExpedicao = Expedicoes.First(); + } + else + { + SelectedExpedicao = new Expedicao(); + Alterar(alterar: false); + base.EnableMenu = false; + } + Carregando = false; + } + + private async Task Carregar(Documento documento) + { + Expedicoes = new ObservableCollection(await _servico.BuscarExpedicoes(documento)); + } + + public void Incluir() + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Expected O, but got Unknown + SelectedExpedicao = new Expedicao + { + Apolice = _documento + }; + Alterar(alterar: true); + } + + public async Task>> Salvar() + { + SelectedExpedicao = await _servico.Save(SelectedExpedicao); + if (!_servico.Sucesso) + { + return null; + } + long id = ((DomainBase)SelectedExpedicao).Id; + await Carregar(SelectedExpedicao.Apolice); + SelectedExpedicao = ((IEnumerable)Expedicoes).FirstOrDefault((Func)((Expedicao x) => ((DomainBase)x).Id == id)); + Alterar(alterar: false); + return null; + } + + public async void CancelarAlteracao() + { + Carregando = true; + long id = ((DomainBase)SelectedExpedicao).Id; + await Carregar(SelectedExpedicao.Apolice); + SelectedExpedicao = (Expedicao)((Expedicoes.Count > 0 && id > 0) ? ((IEnumerable)Expedicoes).FirstOrDefault((Func)((Expedicao x) => ((DomainBase)x).Id == id)) : ((Expedicoes.Count > 0 && id == 0L) ? ((object)Expedicoes.First()) : ((object)new Expedicao()))); + Alterar(alterar: false); + Carregando = false; + } + + public async Task Excluir() + { + if (SelectedExpedicao == null || ((DomainBase)SelectedExpedicao).Id == 0L) + { + return false; + } + if (!(await ShowMessage("DESEJA EXCLUIR?", "SIM", "NÃO"))) + { + return false; + } + Carregando = true; + if (!(await _servico.Delete(SelectedExpedicao))) + { + Carregando = false; + return false; + } + int num = Expedicoes.IndexOf(SelectedExpedicao); + Expedicoes.Remove(SelectedExpedicao); + if (Expedicoes.Count > 0) + { + SelectedExpedicao = ((num < Expedicoes.Count) ? Expedicoes.ElementAt(num) : Expedicoes.Last()); + } + else + { + SelectedExpedicao = new Expedicao(); + } + Carregando = false; + return true; + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Drawer/ExtratosViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Drawer/ExtratosViewModel.cs new file mode 100644 index 0000000..c04d349 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Drawer/ExtratosViewModel.cs @@ -0,0 +1,2773 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using Gestor.Application.Componentes; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.Servicos.Seguros.Itens; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Relatorios.ClientesAtivosInativos; +using Gestor.Model.Domain.Seguros; +using NReco.PdfGenerator; + +namespace Gestor.Application.ViewModels.Drawer; + +public class ExtratosViewModel : BaseSegurosViewModel +{ + private readonly ClienteServico _clienteServico = new ClienteServico(); + + private List _documentos; + + private List _prospeccoes; + + private List _clientes; + + private bool _tipoExtratoEnabled = true; + + private bool _extratoResumido; + + private bool _segurosVigentes; + + private Visibility _clientePorPaginaVisibility; + + private bool _clientePorPagina; + + private bool _extratoPorPagina; + + private bool _clientePorPaginaEnabled = true; + + private bool _obsCliente; + + private bool _comissaoDocumento; + + private bool _premioParcela; + + private bool _obsApolice; + + private bool _beneficiariosItens; + + private bool _selecionarItens; + + private bool _endossos; + + private bool _somenteEndosso; + + private Visibility _selecionarItensVisibility; + + private Visibility _endossoVisibility; + + private Visibility _obsDocVisibility; + + private Visibility _segurosVigentesVisibility; + + private bool _obsItem; + + private bool _separarPagina; + + private bool _perfilCondutor; + + private bool _obsClienteEnabled = true; + + private bool _comissaoDocumentoEnabled; + + private bool _obsApoliceEnabled; + + private bool _beneficiariosItensEnabled; + + private bool _obsItemEnabled; + + private bool _separarPaginaEnabled; + + private bool _coberturasEnabled; + + private bool _coberturas; + + private bool _perfilCondutorEnabled; + + private bool _endossoEnabled; + + private bool _esconderResumido; + + private bool _clienteVisibility; + + private bool _documentoVisibility; + + private bool _itemVisibility; + + private bool _perfilVisibility; + + private TipoExtrato _selectedTipoExtrato; + + private bool _carregando; + + private List _itensSelecionados; + + internal Relatorio? TipoDeRelatorio; + + public List Documentos + { + get + { + return _documentos; + } + set + { + _documentos = value; + OnPropertyChanged("Documentos"); + } + } + + public List Prospeccoes + { + get + { + return _prospeccoes; + } + set + { + _prospeccoes = value; + OnPropertyChanged("Prospeccoes"); + } + } + + public List Clientes + { + get + { + return _clientes; + } + set + { + _clientes = value; + OnPropertyChanged("Clientes"); + } + } + + public bool TipoExtratoEnabled + { + get + { + return _tipoExtratoEnabled; + } + set + { + _tipoExtratoEnabled = value; + OnPropertyChanged("TipoExtratoEnabled"); + } + } + + public bool ExtratoResumido + { + get + { + return _extratoResumido; + } + set + { + //IL_0059: Unknown result type (might be due to invalid IL or missing references) + _extratoResumido = value; + if (value) + { + ClienteVisibility = false; + DocumentoVisibility = false; + ItemVisibility = CoberturasEnabled; + SelecionarItensVisibility = (Visibility)2; + BeneficiariosItensEnabled = false; + ObsItemEnabled = false; + SepararPaginaEnabled = false; + } + else + { + ClienteVisibility = true; + DocumentoVisibility = true; + ItemVisibility = true; + AjustaTipoSelecionado(SelectedTipoExtrato); + } + OnPropertyChanged("ExtratoResumido"); + } + } + + public bool SegurosVigentes + { + get + { + return _segurosVigentes; + } + set + { + _segurosVigentes = value; + OnPropertyChanged("SegurosVigentes"); + } + } + + public Visibility ClientePorPaginaVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _clientePorPaginaVisibility; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _clientePorPaginaVisibility = value; + OnPropertyChanged("ClientePorPaginaVisibility"); + } + } + + public bool ClientePorPagina + { + get + { + return _clientePorPagina; + } + set + { + _clientePorPagina = value; + OnPropertyChanged("ClientePorPagina"); + } + } + + public bool ExtratoPorPagina + { + get + { + return _extratoPorPagina; + } + set + { + _extratoPorPagina = value; + OnPropertyChanged("ExtratoPorPagina"); + } + } + + public bool ClientePorPaginaEnabled + { + get + { + return _clientePorPaginaEnabled; + } + set + { + _clientePorPaginaEnabled = value; + OnPropertyChanged("ClientePorPaginaEnabled"); + } + } + + public bool ObsCliente + { + get + { + return _obsCliente; + } + set + { + _obsCliente = value; + OnPropertyChanged("ObsCliente"); + } + } + + public bool ComissaoDocumento + { + get + { + return _comissaoDocumento; + } + set + { + _comissaoDocumento = value; + OnPropertyChanged("ComissaoDocumento"); + } + } + + public bool PremioParcela + { + get + { + return _premioParcela; + } + set + { + _premioParcela = value; + OnPropertyChanged("PremioParcela"); + } + } + + public bool ObsApolice + { + get + { + return _obsApolice; + } + set + { + _obsApolice = value; + OnPropertyChanged("ObsApolice"); + } + } + + public bool BeneficiariosItens + { + get + { + return _beneficiariosItens; + } + set + { + _beneficiariosItens = value; + OnPropertyChanged("BeneficiariosItens"); + } + } + + public bool SelecionarItens + { + get + { + return _selecionarItens; + } + set + { + _selecionarItens = value; + if (!value) + { + _itensSelecionados = new List(); + } + OnPropertyChanged("SelecionarItens"); + } + } + + public bool Endossos + { + get + { + return _endossos; + } + set + { + _endossos = value; + if (SomenteEndossos != !value) + { + SomenteEndossos = !value; + } + OnPropertyChanged("Endossos"); + } + } + + public bool SomenteEndossos + { + get + { + return _somenteEndosso; + } + set + { + _somenteEndosso = value; + if (Endossos != !value) + { + Endossos = !value; + } + OnPropertyChanged("SomenteEndossos"); + } + } + + public Visibility SelecionarItensVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _selecionarItensVisibility; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _selecionarItensVisibility = value; + OnPropertyChanged("SelecionarItensVisibility"); + } + } + + public Visibility EndossoVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _endossoVisibility; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _endossoVisibility = value; + OnPropertyChanged("EndossoVisibility"); + } + } + + public Visibility ObsDocVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _obsDocVisibility; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _obsDocVisibility = value; + OnPropertyChanged("ObsDocVisibility"); + } + } + + public Visibility SegurosVigentesVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _segurosVigentesVisibility; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _segurosVigentesVisibility = value; + OnPropertyChanged("SegurosVigentesVisibility"); + } + } + + public bool ObsItem + { + get + { + return _obsItem; + } + set + { + _obsItem = value; + OnPropertyChanged("ObsItem"); + } + } + + public bool SepararPagina + { + get + { + return _separarPagina; + } + set + { + _separarPagina = value; + OnPropertyChanged("SepararPagina"); + } + } + + public bool PerfilCondutor + { + get + { + return _perfilCondutor; + } + set + { + _perfilCondutor = value; + OnPropertyChanged("PerfilCondutor"); + } + } + + public bool ObsClienteEnabled + { + get + { + return _obsClienteEnabled; + } + set + { + _obsClienteEnabled = value; + OnPropertyChanged("ObsClienteEnabled"); + } + } + + public bool ComissaoDocumentoEnabled + { + get + { + return _comissaoDocumentoEnabled; + } + set + { + _comissaoDocumentoEnabled = value; + OnPropertyChanged("ComissaoDocumentoEnabled"); + } + } + + public bool ObsApoliceEnabled + { + get + { + return _obsApoliceEnabled; + } + set + { + _obsApoliceEnabled = value; + OnPropertyChanged("ObsApoliceEnabled"); + } + } + + public bool BeneficiariosItensEnabled + { + get + { + return _beneficiariosItensEnabled; + } + set + { + _beneficiariosItensEnabled = value; + OnPropertyChanged("BeneficiariosItensEnabled"); + } + } + + public bool ObsItemEnabled + { + get + { + return _obsItemEnabled; + } + set + { + _obsItemEnabled = value; + OnPropertyChanged("ObsItemEnabled"); + } + } + + public bool SepararPaginaEnabled + { + get + { + return _separarPaginaEnabled; + } + set + { + _separarPaginaEnabled = value; + OnPropertyChanged("SepararPaginaEnabled"); + } + } + + public bool CoberturasEnabled + { + get + { + return _coberturasEnabled; + } + set + { + _coberturasEnabled = value; + OnPropertyChanged("CoberturasEnabled"); + } + } + + public bool Coberturas + { + get + { + return _coberturas; + } + set + { + _coberturas = value; + OnPropertyChanged("Coberturas"); + } + } + + public bool PerfilCondutorEnabled + { + get + { + return _perfilCondutorEnabled; + } + set + { + _perfilCondutorEnabled = value; + OnPropertyChanged("PerfilCondutorEnabled"); + } + } + + public bool EndossoEnabled + { + get + { + return _endossoEnabled; + } + set + { + _endossoEnabled = value; + OnPropertyChanged("EndossoEnabled"); + } + } + + public bool EsconderResumido + { + get + { + return _esconderResumido; + } + set + { + _esconderResumido = value; + OnPropertyChanged("EsconderResumido"); + } + } + + public bool ClienteVisibility + { + get + { + return _clienteVisibility; + } + set + { + _clienteVisibility = value; + OnPropertyChanged("ClienteVisibility"); + } + } + + public bool DocumentoVisibility + { + get + { + return _documentoVisibility; + } + set + { + _documentoVisibility = value; + OnPropertyChanged("DocumentoVisibility"); + } + } + + public bool ItemVisibility + { + get + { + return _itemVisibility; + } + set + { + _itemVisibility = value; + OnPropertyChanged("ItemVisibility"); + } + } + + public bool PerfilVisibility + { + get + { + return _perfilVisibility; + } + set + { + _perfilVisibility = value; + OnPropertyChanged("PerfilVisibility"); + } + } + + public TipoExtrato SelectedTipoExtrato + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _selectedTipoExtrato; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + //IL_0008: Unknown result type (might be due to invalid IL or missing references) + _selectedTipoExtrato = value; + AjustaTipoSelecionado(value); + OnPropertyChanged("SelectedTipoExtrato"); + } + } + + public bool Carregando + { + get + { + return _carregando; + } + set + { + _carregando = value; + base.IsEnabled = !value; + base.EnableMenu = !value; + OnPropertyChanged("Carregando"); + } + } + + public void AjustaTipoSelecionado(TipoExtrato tipoExtrato) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Expected I4, but got Unknown + switch ((int)tipoExtrato) + { + case 0: + ClienteVisibility = true; + ClientePorPaginaVisibility = (Visibility)1; + DocumentoVisibility = false; + ItemVisibility = false; + PerfilVisibility = false; + EsconderResumido = true; + SelecionarItensVisibility = (Visibility)2; + SegurosVigentesVisibility = (Visibility)2; + SegurosVigentes = false; + EndossoVisibility = (Visibility)2; + ObsDocVisibility = (Visibility)2; + ExtratoCliente(); + break; + case 1: + ClienteVisibility = true; + ClientePorPaginaVisibility = (Visibility)0; + DocumentoVisibility = true; + ItemVisibility = true; + PerfilVisibility = true; + EsconderResumido = false; + SelecionarItensVisibility = (Visibility)(TipoDeRelatorio.HasValue ? 2 : 0); + SegurosVigentesVisibility = (Visibility)2; + SegurosVigentes = false; + EndossoVisibility = (Visibility)0; + ObsDocVisibility = (Visibility)0; + ApoliceSelecionada(); + break; + case 2: + ClienteVisibility = false; + ClientePorPaginaVisibility = (Visibility)2; + DocumentoVisibility = true; + ItemVisibility = false; + PerfilVisibility = true; + EsconderResumido = false; + SelecionarItensVisibility = (Visibility)2; + SegurosVigentesVisibility = (Visibility)0; + EndossoVisibility = (Visibility)2; + ObsDocVisibility = (Visibility)2; + RelacaoApolices(); + break; + } + } + + private void SetAllFalse() + { + ObsClienteEnabled = false; + ClientePorPaginaEnabled = false; + ComissaoDocumentoEnabled = false; + ObsApoliceEnabled = false; + BeneficiariosItensEnabled = false; + ObsItemEnabled = false; + SepararPaginaEnabled = false; + CoberturasEnabled = false; + PerfilCondutorEnabled = false; + EndossoEnabled = false; + } + + private void ExtratoCliente() + { + SetAllFalse(); + ObsClienteEnabled = true; + } + + private void ApoliceSelecionada() + { + SetAllFalse(); + ObsClienteEnabled = true; + ClientePorPaginaEnabled = true; + ComissaoDocumentoEnabled = true; + ObsApoliceEnabled = true; + BeneficiariosItensEnabled = true; + ObsItemEnabled = true; + SepararPaginaEnabled = true; + PerfilCondutorEnabled = true; + EndossoEnabled = true; + CoberturasEnabled = true; + } + + private void RelacaoApolices() + { + SetAllFalse(); + ComissaoDocumentoEnabled = true; + PerfilCondutorEnabled = true; + } + + public async Task Gerar(Relatorio? tipoRelatorio = null, bool pdf = false) + { + string html = ""; + string title; + if (Clientes != null && Documentos == null) + { + html += ""; + title = "EXTRATO" + (ExtratoResumido ? " RESUMIDO" : "") + " DO CLIENTE"; + html += title; + html += "
"; + html += ""; + long idCli = 0L; + Clientes.ForEach(delegate(Cliente x) + { + //IL_0353: Unknown result type (might be due to invalid IL or missing references) + //IL_0359: Invalid comparison between Unknown and I4 + //IL_080c: Unknown result type (might be due to invalid IL or missing references) + //IL_0812: Invalid comparison between Unknown and I4 + //IL_0988: Unknown result type (might be due to invalid IL or missing references) + //IL_098e: Invalid comparison between Unknown and I4 + //IL_0bb7: Unknown result type (might be due to invalid IL or missing references) + //IL_0bbd: Invalid comparison between Unknown and I4 + //IL_0d17: Unknown result type (might be due to invalid IL or missing references) + //IL_0d1d: Invalid comparison between Unknown and I4 + //IL_0d97: Unknown result type (might be due to invalid IL or missing references) + //IL_0d9d: Invalid comparison between Unknown and I4 + //IL_1351: Unknown result type (might be due to invalid IL or missing references) + //IL_12a2: Unknown result type (might be due to invalid IL or missing references) + //IL_12a8: Invalid comparison between Unknown and I4 + //IL_0a09: Unknown result type (might be due to invalid IL or missing references) + //IL_0a0e: Unknown result type (might be due to invalid IL or missing references) + //IL_11e8: Unknown result type (might be due to invalid IL or missing references) + //IL_11ee: Invalid comparison between Unknown and I4 + //IL_0ea0: Unknown result type (might be due to invalid IL or missing references) + //IL_0ea5: Unknown result type (might be due to invalid IL or missing references) + //IL_1030: Unknown result type (might be due to invalid IL or missing references) + //IL_1035: Unknown result type (might be due to invalid IL or missing references) + int num6 = 0; + if (idCli != ((DomainBase)x).Id) + { + idCli = ((DomainBase)x).Id; + html += ((ClientePorPagina && ClientePorPaginaEnabled) ? "
" : ""); + html += "

"; + title = "EXTRATO" + (ExtratoResumido ? " RESUMIDO" : "") + " DO CLIENTE: " + x.Nome; + html = html + title + "


"; + string text25 = ((x.Atividade == null) ? "NASCIMENTO" : "ABERTURA"); + bool pessoaFisica3 = x.PessoaFisica; + html = html + ""; + if (pessoaFisica3) + { + html = html + ""; + } + else + { + num6++; + } + html += ""; + if (x.Atividade != null) + { + html = html + ""; + if (!pessoaFisica3) + { + num6++; + } + } + if ((int)SelectedTipoExtrato != 2) + { + html += ""; + if (pessoaFisica3) + { + html = html + ""; + } + html = html + ""; + } + if (pessoaFisica3) + { + html = html + ""; + } + if (!string.IsNullOrWhiteSpace(x.Identidade)) + { + html = html + ""; + } + if ((int)SelectedTipoExtrato != 2 && !ExtratoResumido) + { + html = html + ""; + } + TipoTelefone valueOrDefault3; + if ((x.Telefones != null || x.Emails != null) && (int)SelectedTipoExtrato != 2) + { + html += ""; + if (x.Telefones != null) + { + string text26 = ""; + foreach (ClienteTelefone telefone in x.Telefones) + { + string[] obj32 = new string[7] { text26, "
", null, null, null, null, null }; + TipoTelefone? tipo2 = ((TelefoneBase)telefone).Tipo; + object obj33; + if (!tipo2.HasValue) + { + obj33 = null; + } + else + { + valueOrDefault3 = tipo2.GetValueOrDefault(); + obj33 = ((object)(TipoTelefone)(ref valueOrDefault3)).ToString().ToUpper(); + } + obj32[2] = (string)obj33; + obj32[3] = " ("; + obj32[4] = ((TelefoneBase)telefone).Prefixo; + obj32[5] = ") "; + obj32[6] = ((TelefoneBase)telefone).Numero; + text26 = string.Concat(obj32); + } + html = html + "
"; + } + if (x.Emails != null && !ExtratoResumido) + { + string text27 = ""; + foreach (ClienteEmail email in x.Emails) + { + text27 = text27 + "
" + ((EmailBase)email).Email; + } + html = html + "
"; + } + num6++; + html += ""; + } + if (x.Enderecos != null && (int)SelectedTipoExtrato != 2) + { + string text28 = ""; + foreach (ClienteEndereco endereco in x.Enderecos) + { + text28 = text28 + "
" + ((EnderecoBase)endereco).Endereco + ", " + ((EnderecoBase)endereco).Numero + ", " + (string.IsNullOrWhiteSpace(((EnderecoBase)endereco).Complemento) ? "" : (((EnderecoBase)endereco).Complemento + ", ")) + ((EnderecoBase)endereco).Bairro + " - " + ((EnderecoBase)endereco).Cidade + " - " + ((EnderecoBase)endereco).Estado + " - " + ((EnderecoBase)endereco).Cep; + } + html = html + "
"; + } + if (x.Profissao != null && (int)SelectedTipoExtrato != 2) + { + html = html + ""; + } + if (x.Contatos != null && (int)SelectedTipoExtrato != 2 && !ExtratoResumido) + { + string text29 = ""; + foreach (MaisContato contato in x.Contatos) + { + string[] obj34 = new string[15] + { + text29, + "
NOME: ", + contato.Nome, + (!string.IsNullOrWhiteSpace(contato.Documento)) ? (", DOCUMENTO: " + contato.Documento) : "", + contato.Nascimento.HasValue ? (", NASCIMENTO: " + contato.Nascimento?.ToShortDateString()) : "", + null, + null, + null, + null, + null, + null, + null, + null, + null, + null + }; + object obj35; + if (!contato.Parentesco.HasValue) + { + obj35 = ""; + } + else + { + Parentesco? parentesco2 = contato.Parentesco; + object obj36; + if (!parentesco2.HasValue) + { + obj36 = null; + } + else + { + Parentesco valueOrDefault4 = parentesco2.GetValueOrDefault(); + obj36 = ((object)(Parentesco)(ref valueOrDefault4)).ToString().ToUpper(); + } + obj35 = ", PARENTESCO: " + (string?)obj36; + } + obj34[5] = (string)obj35; + obj34[6] = ((!string.IsNullOrWhiteSpace(contato.Banco) || !string.IsNullOrWhiteSpace(contato.Agencia) || !string.IsNullOrWhiteSpace(contato.Conta)) ? "
" : ""); + obj34[7] = ((!string.IsNullOrWhiteSpace(contato.Banco)) ? ("BANCO: " + contato.Banco) : ""); + obj34[8] = ((!string.IsNullOrWhiteSpace(contato.Agencia)) ? (((!string.IsNullOrWhiteSpace(contato.Banco)) ? ", AGÊNCIA: " : "AGÊNCIA: ") + contato.Agencia) : ""); + obj34[9] = ((!string.IsNullOrWhiteSpace(contato.Conta)) ? (((!string.IsNullOrWhiteSpace(contato.Banco) || !string.IsNullOrWhiteSpace(contato.Agencia)) ? ", CONTA: " : "CONTA: ") + contato.Conta) : ""); + obj34[10] = ((contato.Tipo.HasValue || (!string.IsNullOrWhiteSpace(contato.Prefixo) && !string.IsNullOrWhiteSpace(contato.Telefone)) || !string.IsNullOrWhiteSpace(contato.Email)) ? "
" : ""); + object obj37; + if (!contato.Tipo.HasValue) + { + obj37 = ""; + } + else + { + TipoTelefone? tipo2 = contato.Tipo; + object obj38; + if (!tipo2.HasValue) + { + obj38 = null; + } + else + { + valueOrDefault3 = tipo2.GetValueOrDefault(); + obj38 = ((object)(TipoTelefone)(ref valueOrDefault3)).ToString().ToUpper(); + } + obj37 = "TIPO DO TELEFONE: " + (string?)obj38; + } + obj34[11] = (string)obj37; + obj34[12] = ((!string.IsNullOrWhiteSpace(contato.Prefixo) && !string.IsNullOrWhiteSpace(contato.Telefone)) ? ((contato.Tipo.HasValue ? ", TELEFONE: (" : "TELEFONE: (") + contato.Prefixo + ") " + contato.Telefone) : ""); + obj34[13] = ((!string.IsNullOrWhiteSpace(contato.Email)) ? (((contato.Tipo.HasValue || (!string.IsNullOrWhiteSpace(contato.Prefixo) && !string.IsNullOrWhiteSpace(contato.Telefone))) ? ", EMAIL: " : "EMAIL: ") + contato.Email) : ""); + obj34[14] = "
"; + text29 = string.Concat(obj34); + } + html = html + "
"; + } + if (ObsCliente && ClienteVisibility && ObsClienteEnabled && !string.IsNullOrWhiteSpace(x.Observacao) && (int)SelectedTipoExtrato != 2 && !ExtratoResumido) + { + x.Observacao = "
" + x.Observacao.Replace("\r\n", "
"); + html = html + "
"; + } + if (!string.IsNullOrWhiteSpace(x.Pasta) && (int)SelectedTipoExtrato != 2 && !ExtratoResumido) + { + html = html + ""; + } + html += "

CLIENTE: " + x.Nome + "

CPF/CNPJ: " + x.Documento + "

" + text25 + ": " + x.Nascimento?.ToShortDateString() + "

FALECIDO: " + (x.Falecido ? "SIM" : "NÃO") + "

RAMO DE ATIVIDADE: " + x.Atividade.Nome + "

ESTADO CIVIL: " + (x.EstadoCivil.HasValue ? x.EstadoCivil.ToString().ToUpper() : "-") + "

SEXO: " + (x.Sexo.HasValue ? x.Sexo.ToString().ToUpper() : "-") + "

CLIENTE DESDE: " + ((!x.ClienteDesde.HasValue) ? "-" : x.ClienteDesde?.ToShortDateString()) + "

HABILITAÇÃO: " + ((!string.IsNullOrWhiteSpace(x.Habilitacao)) ? x.Habilitacao : "-") + "

CATEGORIA: " + ((!string.IsNullOrWhiteSpace(x.CategoriaHabilitacao)) ? x.CategoriaHabilitacao : "-") + "

1ª HAB.: " + ((!x.PrimeiraHabilitacao.HasValue) ? "-" : x.PrimeiraHabilitacao?.ToShortDateString()) + "

VENCIMENTO: " + ((!x.VencimentoHabilitacao.HasValue) ? "-" : x.VencimentoHabilitacao?.ToShortDateString()) + "

RG: " + ((!string.IsNullOrWhiteSpace(x.Identidade)) ? x.Identidade : "-") + "

ORGÃO EMISSOR: " + ((!string.IsNullOrWhiteSpace(x.Emissor)) ? x.Emissor : "-") + "

ESTADO EMISSOR: " + ((!string.IsNullOrWhiteSpace(x.EstadoEmissor)) ? x.EstadoEmissor : "-") + "

EXPEDIÇÃO: " + ((!x.Expedicao.HasValue) ? "-" : x.Expedicao?.ToShortDateString()) + "

BANCO: " + ((x.Banco != null) ? x.Banco.Nome : "-") + "

AGÊNCIA: " + ((!string.IsNullOrWhiteSpace(x.Agencia)) ? x.Agencia : "-") + "

CONTA: " + ((!string.IsNullOrWhiteSpace(x.Conta)) ? x.Conta : "-") + "

TIPO: " + ((!string.IsNullOrWhiteSpace(x.TipoConta)) ? x.TipoConta : "-") + "

CONTATOS: " + text26 + "

EMAILS: " + text27 + "

ENDEREÇOS: " + text28 + "

PROFISSÃO: " + x.Profissao.Nome + "

MAIS CONTATOS: " + text29 + "

OBSERVAÇÕES: " + x.Observacao + "

PASTA: " + x.Pasta + "

"; + html += (((int)ClientePorPaginaVisibility == 0 && ClientePorPagina && ClientePorPaginaEnabled) ? "
" : ""); + } + }); + DateTime networkTime = Funcoes.GetNetworkTime(); + html = html + "

" + Recursos.Usuario.Nome + " - " + networkTime.Date.ToShortDateString() + "
"; + string tempPath = Path.GetTempPath(); + string text = $"{tempPath}{(object)(TipoExtrato)0}_{networkTime:ddMMyyyyhhmmss}.html"; + if (pdf) + { + text = $"{tempPath}{(object)(TipoExtrato)0}_{networkTime:ddMMyyyyhhmmss}.pdf"; + byte[] bytes = ((HtmlToPdfConverter)new NRecoHtmlToPdfConverter()).GeneratePdf(html); + File.WriteAllBytes(text, bytes); + } + else + { + StreamWriter streamWriter = new StreamWriter(text, append: true, Encoding.UTF8); + streamWriter.Write(html); + streamWriter.Close(); + } + Process.Start(text); + RegistrarAcao("GEROU O EXTRATO" + (ExtratoResumido ? " RESUMIDO" : "") + " " + ((Clientes == null) ? "" : ((Clientes.Count > 1) ? $"DE {Clientes.Count} CLIENTES" : ("DO CLIENTE " + Clientes[0].Nome))), 0L, (TipoTela)23, "NOMES DOS CLIENTES:\n" + string.Join("\n", Clientes.Select((Cliente x) => x.Nome)) + GerarOpcoes()); + Documentos = null; + Clientes = null; + } + else + { + if ((Documentos == null && Prospeccoes == null) || Clientes != null) + { + return; + } + html = ""; + title = ""; + TipoExtrato selectedTipoExtrato = SelectedTipoExtrato; + switch ((int)selectedTipoExtrato) + { + case 0: + title = "EXTRATO" + (ExtratoResumido ? " RESUMIDO" : "") + " DO CLIENTE"; + break; + case 1: + title = "EXTRATO" + (ExtratoResumido ? " RESUMIDO" : "") + " DA APÓLICE SELECIONADA"; + if (tipoRelatorio.HasValue && (int)tipoRelatorio.GetValueOrDefault() == 4) + { + title = "EXTRATO" + (ExtratoResumido ? " RESUMIDO" : "") + " DO RELATÓRIO DE RENOVAÇÕES"; + } + break; + case 2: + title = "EXTRATO" + (ExtratoResumido ? " RESUMIDO" : "") + " DE RELAÇÃO DE APÓLICES"; + break; + } + html += title; + html += "
"; + List sDocumento = new List(); + if (Documentos != null && Documentos.Count > 0) + { + bool configEndosso = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 42); + foreach (Documento documento2 in Documentos) + { + Documento val = documento2; + val.Parcelas = await new ParcelaServico().BuscarParcelasAsync(((DomainBase)documento2).Id); + Controle controle = documento2.Controle; + controle.Cliente = await _clienteServico.BuscarCliente(((DomainBase)documento2.Controle.Cliente).Id); + Cliente cliente = documento2.Controle.Cliente; + cliente.Enderecos = await _clienteServico.BuscarEnderecosAsync(((DomainBase)documento2.Controle.Cliente).Id); + cliente = documento2.Controle.Cliente; + cliente.Emails = await _clienteServico.BuscarEmailsAsync(((DomainBase)documento2.Controle.Cliente).Id); + cliente = documento2.Controle.Cliente; + cliente.Telefones = await _clienteServico.BuscarTelefonesAsync(((DomainBase)documento2.Controle.Cliente).Id); + cliente = documento2.Controle.Cliente; + cliente.Contatos = await _clienteServico.BuscarContatosAsync(((DomainBase)documento2.Controle.Cliente).Id); + } + bool primeiro = true; + foreach (Documento documento in Documentos) + { + List itensDocumentos = new List(); + List list = ((!Endossos) ? (await new ItemServico().BuscarItens(((DomainBase)documento.Controle).Id, (StatusItem)0)).ToList() : (await new ItemServico().BuscarItens(((DomainBase)documento).Id, (StatusItem)2)).ToList()); + List list2 = list; + if (_itensSelecionados != null && _itensSelecionados.Count > 0) + { + list2.ForEach(delegate(Item x) + { + if (_itensSelecionados.Any((Item y) => ((DomainBase)y).Id == ((DomainBase)x).Id)) + { + itensDocumentos.Add(x); + } + }); + } + else + { + itensDocumentos.AddRange(list2); + } + List source = await new PerfilServico().BuscarPerfis(((DomainBase)documento.Controle).Id); + long num = 0L; + int color = 0; + if (!primeiro) + { + html += (ExtratoPorPagina ? "
" : ""); + } + if (num != ((DomainBase)documento.Controle.Cliente).Id) + { + html += (((int)ClientePorPaginaVisibility == 0 && ClientePorPagina && ClientePorPaginaEnabled && !ExtratoPorPagina) ? "
" : ""); + html += "

"; + selectedTipoExtrato = SelectedTipoExtrato; + switch ((int)selectedTipoExtrato) + { + case 0: + title = "EXTRATO" + (ExtratoResumido ? " RESUMIDO" : "") + " DO CLIENTE: " + documento.Controle.Cliente.Nome; + break; + case 1: + title = "EXTRATO" + (ExtratoResumido ? " RESUMIDO" : "") + " DA APÓLICE SELECIONADA: " + documento.Apolice; + if (tipoRelatorio.HasValue && (int)tipoRelatorio.GetValueOrDefault() == 4) + { + title = "EXTRATO" + (ExtratoResumido ? " RESUMIDO" : "") + " DA APÓLICE: " + documento.Apolice; + } + if (!string.IsNullOrEmpty(documento.Endosso) && !documento.Endosso.Equals("0")) + { + title = title + " E DO ENDOSSO: " + documento.Endosso; + } + if (SomenteEndossos) + { + title = "EXTRATO" + (ExtratoResumido ? " RESUMIDO" : "") + " DO ENDOSSO: " + documento.Endosso; + } + break; + case 2: + title = "EXTRATO" + (ExtratoResumido ? " RESUMIDO" : "") + " DE RELAÇÃO DE APÓLICES"; + break; + } + html = html + title + "


"; + html += ""; + TipoTelefone valueOrDefault; + if (ExtratoResumido) + { + bool pessoaFisica = documento.Controle.Cliente.PessoaFisica; + if ((!Endossos || !SomenteEndossos) && !sDocumento.Any((long x) => x == ((DomainBase)documento.Controle).Id)) + { + html = html + ""; + if (pessoaFisica) + { + html = html + ""; + } + html = html + ""; + if ((int)SelectedTipoExtrato != 2) + { + string text2 = ((documento.Controle.Cliente.Atividade == null) ? "NASCIMENTO" : "ABERTURA"); + html = html + ""; + } + else + { + color++; + } + } + if ((int)SelectedTipoExtrato != 2) + { + html = html + ""; + } + if ((int)SelectedTipoExtrato != 2) + { + html += ""; + string text3 = ""; + if (documento.Controle.Cliente.Telefones != null) + { + foreach (ClienteTelefone telefone2 in documento.Controle.Cliente.Telefones) + { + string[] obj = new string[7] { text3, "
", null, null, null, null, null }; + TipoTelefone? tipo = ((TelefoneBase)telefone2).Tipo; + object obj2; + if (!tipo.HasValue) + { + obj2 = null; + } + else + { + valueOrDefault = tipo.GetValueOrDefault(); + obj2 = ((object)(TipoTelefone)(ref valueOrDefault)).ToString().ToUpper(); + } + obj[2] = (string)obj2; + obj[3] = " ("; + obj[4] = ((TelefoneBase)telefone2).Prefixo; + obj[5] = ") "; + obj[6] = ((TelefoneBase)telefone2).Numero; + text3 = string.Concat(obj); + } + } + html = html + "
"; + string text4 = ""; + if (documento.Controle.Cliente.Emails != null) + { + foreach (ClienteEmail email2 in documento.Controle.Cliente.Emails) + { + text4 = text4 + "
" + ((EmailBase)email2).Email; + } + } + html = html + "
"; + string text5 = ""; + if (documento.Controle.Cliente.Enderecos != null) + { + foreach (ClienteEndereco endereco2 in documento.Controle.Cliente.Enderecos) + { + text5 = text5 + "
" + ((EnderecoBase)endereco2).Endereco + ", " + ((EnderecoBase)endereco2).Numero + ", " + (string.IsNullOrWhiteSpace(((EnderecoBase)endereco2).Complemento) ? "" : (((EnderecoBase)endereco2).Complemento + ", ")) + ((EnderecoBase)endereco2).Bairro + " - " + ((EnderecoBase)endereco2).Cidade + " - " + ((EnderecoBase)endereco2).Estado + " - " + ((EnderecoBase)endereco2).Cep; + } + } + html = html + "
"; + html += ""; + } + html += "

CLIENTE: " + documento.Controle.Cliente.Nome + "

RG: " + ((!string.IsNullOrWhiteSpace(documento.Controle.Cliente.Identidade)) ? documento.Controle.Cliente.Identidade : "-") + "

CPF/CNPJ: " + documento.Controle.Cliente.Documento + "

" + text2 + ": " + documento.Controle.Cliente.Nascimento?.ToShortDateString() + "

"; + if (pessoaFisica) + { + html = html + "

ESTADO CIVIL: " + (documento.Controle.Cliente.EstadoCivil.HasValue ? documento.Controle.Cliente.EstadoCivil.ToString().ToUpper() : "-") + "

SEXO: " + (documento.Controle.Cliente.Sexo.HasValue ? documento.Controle.Cliente.Sexo.ToString().ToUpper() : "-") + "

BANCO: " + ((documento.Controle.Cliente.Banco != null) ? documento.Controle.Cliente.Banco.Nome : "-") + "

AGÊNCIA: " + ((!string.IsNullOrWhiteSpace(documento.Controle.Cliente.Agencia)) ? documento.Controle.Cliente.Agencia : "-") + "

CONTA: " + ((!string.IsNullOrWhiteSpace(documento.Controle.Cliente.Conta)) ? documento.Controle.Cliente.Conta : "-") + "

TIPO: " + ((!string.IsNullOrWhiteSpace(documento.Controle.Cliente.TipoConta)) ? documento.Controle.Cliente.TipoConta : "-") + "

CONTATOS: " + (string.IsNullOrEmpty(text3) ? "-" : text3) + "

EMAILS: " + (string.IsNullOrEmpty(text4) ? "-" : text4) + "

ENDEREÇOS: " + (string.IsNullOrEmpty(text5) ? "-" : text5) + "

"; + html += (((int)ClientePorPaginaVisibility == 0 && ClientePorPagina && ClientePorPaginaEnabled) ? "
" : ""); + } + else + { + html = html + "

CLIENTE: " + documento.Controle.Cliente.Nome + "

RG: " + ((!string.IsNullOrWhiteSpace(documento.Controle.Cliente.Identidade)) ? documento.Controle.Cliente.Identidade : "-") + "

CPF/CNPJ: " + documento.Controle.Cliente.Documento + "

"; + } + if ((int)SelectedTipoExtrato == 0) + { + return; + } + color = 0; + Documento val2 = documento.Controle.Documentos?.LastOrDefault((Func)((Documento x) => !x.Excluido && x.Ordem != 0)); + html = html + "
"; + if (!documento.NegocioCorretora.HasValue) + { + documento.NegocioCorretora = (NegocioCorretora)(((int)documento.Situacao == 2 && documento.Negocio.HasValue && (int)documento.Negocio.GetValueOrDefault() == 1) ? 1 : 0); + } + if ((int)SelectedTipoExtrato != 2) + { + html = html + ""; + } + html = html + ""; + if ((int)SelectedTipoExtrato != 2) + { + html += ""; + string text6 = ""; + if (documento.Estipulante1 != null) + { + text6 = text6 + documento.Estipulante1.Nome + ", "; + } + if (documento.Estipulante2 != null) + { + text6 = text6 + documento.Estipulante2.Nome + ", "; + } + if (documento.Estipulante3 != null) + { + text6 = text6 + documento.Estipulante3.Nome + ", "; + } + if (documento.Estipulante4 != null) + { + text6 = text6 + documento.Estipulante4.Nome + ", "; + } + if (documento.Estipulante5 != null) + { + text6 = text6 + documento.Estipulante5.Nome + ", "; + } + if (!string.IsNullOrWhiteSpace(text6)) + { + int startIndex = text6.LastIndexOf(", ", StringComparison.Ordinal); + text6 = text6.Remove(startIndex, 2).Insert(startIndex, "."); + } + html = html + ""; + } + if ((int)SelectedTipoExtrato != 2) + { + html = html + ""; + } + else + { + html = html + ""; + } + html = html + ""; + html += "

RAMO: " + documento.Controle.Ramo.Nome + "

VIGÊNCIA INICIAL: " + documento.Vigencia1.ToShortDateString() + "

VIGÊNCIA FINAL: " + ((!documento.Vigencia2.HasValue) ? "-" : documento.Vigencia2?.ToShortDateString()) + "

CONTRATO: " + (string.IsNullOrWhiteSpace(documento.Apolice) ? "-" : documento.Apolice) + "

POSSUI ENDOSSO? " + (documento.TemEndosso ? "SIM" : "NÃO") + "

ADITAMENTO: " + ((!string.IsNullOrWhiteSpace(documento.Endosso)) ? documento.Endosso : ((configEndosso && val2 != null) ? val2.Endosso : "-")) + "

NEGÓCIO CORRETORA: " + ValidationHelper.GetDescription((Enum)(object)documento.NegocioCorretora) + "

STATUS DO SEGURO: " + ValidationHelper.GetDescription((Enum)(object)documento.Situacao) + "

VENDEDOR: " + ((documento.VendedorPrincipal == null) ? "-" : documento.VendedorPrincipal.Nome) + "

ESTIPULANTE(S): " + (string.IsNullOrWhiteSpace(text6) ? "-" : text6) + "

SEGURADORA: " + documento.Controle.Seguradora.Nome + "

APÓLICE SINISTRADA: " + (documento.Sinistro ? "SIM" : "NÃO") + "

SEGURADORA: " + documento.Controle.Seguradora.Nome + "

FORMA PAGAMENTO: " + ValidationHelper.GetDescription((Enum)(object)documento.FormaPagamento) + "

"; + if (PremioParcela || ExtratoResumido) + { + html += ""; + if ((ComissaoDocumento && ComissaoDocumentoEnabled) || ExtratoResumido) + { + html = html + ""; + } + html = html + ""; + html += "

COMISSÃO: " + $"{Math.Round(documento.Comissao, 2):n2}%" + "

PRÊMIO LÍQUIDO: " + $"{Math.Round(documento.PremioLiquido, 2):c}" + "

ADICIONAL: " + $"{Math.Round(documento.PremioAdicional, 2):c}" + "

CUSTO APÓLICE: " + $"{Math.Round(documento.Custo, 2):c}" + "

I.O.F.: " + $"{Math.Round(documento.Iof, 2):c}" + "

PRÊMIO TOTAL: " + $"{Math.Round(documento.PremioTotal, 2):c}" + "

Nº PARCELAS: " + documento.NumeroParcelas + "

"; + } + if (PerfilCondutor && PerfilVisibility && ((DomainBase)documento.Controle.Ramo).Id == 5 && PerfilCondutorEnabled) + { + List list3 = source.ToList(); + foreach (Perfil item3 in list3) + { + color = 0; + if (!string.IsNullOrEmpty(item3.Nome)) + { + html = html + "

" + $"CONDUTOR {list3.IndexOf(item3) + 1}: " + "" + item3.Nome + "

CPF: " + (string.IsNullOrWhiteSpace(item3.Cpf) ? "-" : item3.Cpf) + "

NASCIMENTO: " + ((!item3.Nascimento.HasValue) ? "-" : item3.Nascimento?.ToShortDateString()) + "

ESTADO CIVIL: " + ((!item3.EstadoCivil.HasValue) ? "-" : ValidationHelper.GetDescription((Enum)(object)item3.EstadoCivil)) + "

SEXO: " + ((!item3.Sexo.HasValue) ? "-" : ValidationHelper.GetDescription((Enum)(object)item3.Sexo)) + "

RELAÇÃO SEGURADO/CONDUTOR: " + ValidationHelper.GetDescription((Enum)(object)item3.Relacao) + "

GARAGEM NA RESIDÊNCIA: " + ((!item3.GaragemResidencia.HasValue) ? "-" : ValidationHelper.GetDescription((Enum)(object)item3.GaragemResidencia)) + "

GARAGEM NO TRABALHO: " + ((!item3.GaragemTrabalho.HasValue) ? "-" : ValidationHelper.GetDescription((Enum)(object)item3.GaragemTrabalho)) + "

GARAGEM NO ESTUDO: " + ((!item3.GaragemEstudo.HasValue) ? "-" : ValidationHelper.GetDescription((Enum)(object)item3.GaragemEstudo)) + "

TIPO DE RESIDÊNCIA: " + ((!item3.TipoResidencia.HasValue) ? "-" : ValidationHelper.GetDescription((Enum)(object)item3.TipoResidencia)) + "

DISTÂNCIA ATÉ O TRABALHO: " + ((!item3.DistanciaResidenciaTrabalho.HasValue) ? "-" : ValidationHelper.GetDescription((Enum)(object)item3.DistanciaResidenciaTrabalho)) + "

USO PROFISSIONAL: " + ((item3.UsoProfissional.HasValue && item3.UsoProfissional.Value) ? "SIM" : "NÃO") + "

USO POR DEPENDENTES: " + ((!item3.UsoDependentes.HasValue) ? "-" : ValidationHelper.GetDescription((Enum)(object)item3.UsoDependentes)) + "

ISENÇÃO DE IMPOSTOS: " + ((item3.Isencao.HasValue && item3.Isencao.Value) ? "SIM" : "NÃO") + "

"; + } + } + } + List itens2 = itensDocumentos.ToList(); + if (itens2.Count == 0) + { + html += "

ESTA APÓLICE NÃO POSSUI ITENS

"; + } + else + { + color = 0; + foreach (Item item2 in itens2) + { + if (item2.Sinistros.Count > 0) + { + Item val3 = item2; + val3.Sinistros = await new SinistroServico().BuscarControles(((DomainBase)item2).Id); + } + html += ((SepararPagina && SepararPaginaEnabled) ? "
" : ""); + html += (((int)SelectedTipoExtrato != 2 || itens2.IndexOf(item2) == 0) ? "
" : ""); + html += ""; + html += ""; + html += ""; + if ((int)SelectedTipoExtrato == 2) + { + html = html + ""; + } + else + { + switch (((DomainBase)documento.Controle.Ramo).Id) + { + case 1L: + case 2L: + case 3L: + case 15L: + case 18L: + { + Item val3 = item2; + val3.Patrimonial = await new ItemServico().BuscaPatrimonial(((DomainBase)item2).Id); + html = html + ""; + break; + } + case 5L: + case 37L: + { + Item val3 = item2; + val3.Auto = await new ItemServico().BuscaAuto(((DomainBase)item2).Id); + string[] obj3 = new string[26] + { + html, + ""; + html = string.Concat(obj3); + break; + } + default: + html = html + ""; + break; + } + } + if (item2.Sinistros.Count > 0) + { + Item obj4 = item2; + DateTime? obj5; + if (obj4 == null) + { + obj5 = null; + } + else + { + IList sinistros = obj4.Sinistros; + if (sinistros == null) + { + obj5 = null; + } + else + { + ControleSinistro? obj6 = sinistros.LastOrDefault(); + if (obj6 == null) + { + obj5 = null; + } + else + { + List sinistros2 = obj6.Sinistros; + if (sinistros2 == null) + { + obj5 = null; + } + else + { + Sinistro? obj7 = sinistros2.LastOrDefault(); + obj5 = ((obj7 != null) ? obj7.DataReclamacao : null); + } + } + } + } + DateTime? dateTime = obj5; + string text7 = (dateTime.HasValue ? dateTime.Value.ToShortDateString() : "-"); + string[] obj8 = new string[14] + { + html, ""; + html = string.Concat(obj8); + } + html += ""; + if ((int)SelectedTipoExtrato != 2) + { + string[] obj9 = new string[6] { html, ""; + html = string.Concat(obj9); + long id = ((DomainBase)documento.Controle.Ramo).Id; + long num3 = id - 1; + if ((ulong)num3 <= 58uL) + { + switch (num3) + { + case 0L: + case 1L: + case 2L: + case 14L: + case 17L: + if (ObsItem && ObsItemEnabled) + { + html = html + ""; + } + break; + case 4L: + case 36L: + { + if (ObsItem && ObsItemEnabled) + { + html = html + ""; + } + string[] array = new string[26]; + array[0] = html; + array[1] = ""; + html = string.Concat(array); + break; + } + case 5L: + case 6L: + case 8L: + case 9L: + case 52L: + { + Item val3 = item2; + val3.Vida = await new ItemServico().BuscaVida(((DomainBase)item2).Id); + if (!item2.Sinistrado || !BeneficiariosItens || !BeneficiariosItensEnabled) + { + break; + } + html = html + ""; + break; + } + case 3L: + case 7L: + case 15L: + case 16L: + case 18L: + case 22L: + case 23L: + case 25L: + case 27L: + case 30L: + case 32L: + case 38L: + case 40L: + case 43L: + case 48L: + case 58L: + { + Item val3 = item2; + val3.RiscosDiversos = await new ItemServico().BuscaRiscosDiversos(((DomainBase)item2).Id); + if (ObsItem && ObsItemEnabled) + { + html = html + ""; + } + break; + } + case 12L: + { + Item val3 = item2; + val3.Aeronautico = await new ItemServico().BuscaAeronautico(((DomainBase)item2).Id); + if (ObsItem && ObsItemEnabled) + { + html = html + ""; + } + break; + } + case 19L: + { + Item val3 = item2; + val3.Granizo = await new ItemServico().BuscaGranizo(((DomainBase)item2).Id); + if (ObsItem && ObsItemEnabled) + { + html = html + ""; + } + break; + } + } + } + } + html += "

" + $"ITEM {item2.Ordem}: " + "" + item2.Descricao + "

" + $"ITEM {item2.Ordem}: " + "" + ((EnderecoBase)item2.Patrimonial).Endereco + ", " + ((EnderecoBase)item2.Patrimonial).Numero + ", " + (string.IsNullOrWhiteSpace(((EnderecoBase)item2.Patrimonial).Complemento) ? "" : (((EnderecoBase)item2.Patrimonial).Complemento + ", ")) + ((EnderecoBase)item2.Patrimonial).Bairro + " - " + ((EnderecoBase)item2.Patrimonial).Cidade + " - " + ((EnderecoBase)item2.Patrimonial).Estado + " - " + ((EnderecoBase)item2.Patrimonial).Cep + "

", + $"ITEM {item2.Ordem}: ", + "
", + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null + }; + Fabricante fabricante = item2.Auto.Fabricante; + obj3[6] = ((fabricante != null) ? fabricante.Descricao : null); + obj3[7] = " "; + obj3[8] = item2.Auto.Modelo; + obj3[9] = " ("; + obj3[10] = item2.Auto.AnoFabricacao; + obj3[11] = "/"; + obj3[12] = item2.Auto.AnoModelo; + obj3[13] = ")
PLACA: "; + obj3[14] = item2.Auto.Placa; + obj3[15] = ", CHASSI: "; + obj3[16] = item2.Auto.Chassi; + obj3[17] = "
C.I.: "; + obj3[18] = item2.Auto.Ci; + obj3[19] = ", RENAVAM: "; + obj3[20] = item2.Auto.Renavam; + obj3[21] = ", CEP PERNOITE: "; + obj3[22] = item2.Auto.CepPernoite; + obj3[23] = "
FINANCIADO: "; + obj3[24] = (item2.Auto.Financiado.GetValueOrDefault() ? "SIM" : "NÃO"); + obj3[25] = "

" + $"ITEM {item2.Ordem}: " + "" + item2.Descricao + "

SINISTRO STATUS: "; + obj8[4] = ValidationHelper.GetDescription((Enum)(object)item2.Sinistros.LastOrDefault().Sinistros.LastOrDefault().StatusSinistro); + obj8[5] = "

DATA: "; + obj8[8] = text7; + obj8[9] = "

VALOR: "; + obj8[12] = ValidationHelper.ToCurrency(item2.Sinistros.LastOrDefault().Sinistros.LastOrDefault().Valor, "pt-BR"); + obj8[13] = "

ATIVO: "; + obj9[4] = ((!item2.Substituido.HasValue) ? "SIM" : "NÃO"); + obj9[5] = "

OBSERVAÇÕES: " + (string.IsNullOrWhiteSpace(item2.Patrimonial.Bens) ? "-" : item2.Patrimonial.Bens) + "

OBSERVAÇÕES: " + (string.IsNullOrWhiteSpace(item2.Auto.Observacao) ? "-" : item2.Auto.Observacao) + "

COBERTURA PADRÃO: "; + TipoCobertura? tipoCobertura = item2.Auto.TipoCobertura; + array[4] = (tipoCobertura.HasValue ? ValidationHelper.GetDescription((Enum)(object)tipoCobertura.GetValueOrDefault()) : null); + array[5] = "

BÔNUS: "; + array[8] = item2.Auto.Bonus.ToString(); + array[9] = "

REGIÃO DE CIRCULAÇÃO: "; + array[12] = (string.IsNullOrWhiteSpace(item2.Auto.RegiaoCirculacao) ? "-" : item2.Auto.RegiaoCirculacao); + array[13] = "

TABELA DE REFERÊNCIA: "; + TabelaReferencia? tabelaReferencia = item2.Auto.TabelaReferencia; + array[16] = (tabelaReferencia.HasValue ? ValidationHelper.GetDescription((Enum)(object)tabelaReferencia.GetValueOrDefault()) : null); + array[17] = "

FIPE: "; + array[20] = (string.IsNullOrWhiteSpace(item2.Auto.Fipe) ? "-" : item2.Auto.Fipe); + array[21] = "

% DE REFERÊNCIA: "; + array[24] = $"{item2.Auto.PorcentagemReferencia}%"; + array[25] = "

BENEFICIÁRIOS: "; + string text8 = ""; + foreach (ControleSinistro sinistro in item2.Sinistros) + { + if (sinistro.Sinistros == null) + { + continue; + } + foreach (Sinistro sinistro2 in sinistro.Sinistros) + { + if (!string.IsNullOrWhiteSpace(sinistro2.SinistroVida.Beneficiario)) + { + text8 = text8 + sinistro2.SinistroVida.Beneficiario + ", "; + } + } + } + if (!string.IsNullOrWhiteSpace(text8)) + { + int startIndex2 = text8.LastIndexOf(", ", StringComparison.Ordinal); + text8 = text8.Remove(startIndex2, 2).Insert(startIndex2, "."); + } + html = html + text8 + "

OBSERVAÇÕES: " + (string.IsNullOrWhiteSpace(item2.RiscosDiversos.Observacao) ? "-" : item2.RiscosDiversos.Observacao) + "

OBSERVAÇÕES: " + (string.IsNullOrWhiteSpace(item2.Aeronautico.Observacao) ? "-" : item2.Aeronautico.Observacao) + "

OBSERVAÇÕES: " + (string.IsNullOrWhiteSpace(item2.Granizo.Observacao) ? "-" : item2.Granizo.Observacao) + "

"; + if ((int)SelectedTipoExtrato != 2) + { + ObservableCollection observableCollection = await new ItemServico().BuscarCoberturasPorItemAsync(((DomainBase)item2).Id); + if (observableCollection.Count > 0 && Coberturas) + { + html += "
"; + foreach (Cobertura item4 in observableCollection) + { + color++; + html = html + ""; + } + html += "

COBERTURA

FRANQUIA

LMI

PRÊMIO

" + item4.Observacao + "

" + $"{item4.Franquia:c}" + "

" + $"{item4.Lmi:c}" + "

" + $"{item4.Premio:c}" + "

"; + } + html += ((SepararPagina && SepararPaginaEnabled) ? "
" : ""); + } + if ((int)SelectedTipoExtrato != 2) + { + color = 0; + } + } + } + } + else + { + if ((!Endossos || !SomenteEndossos) && !sDocumento.Any((long x) => x == ((DomainBase)documento.Controle).Id)) + { + string text9 = ((documento.Controle.Cliente.Atividade == null) ? "NASCIMENTO" : "ABERTURA"); + bool pessoaFisica2 = documento.Controle.Cliente.PessoaFisica; + html = html + ""; + if (pessoaFisica2) + { + html = html + ""; + } + else + { + color++; + } + html += ""; + if (documento.Controle.Cliente.Atividade != null) + { + html = html + ""; + } + if ((int)SelectedTipoExtrato != 2) + { + html = html + ""; + if (documento.Controle.Cliente.Profissao != null && (int)SelectedTipoExtrato != 2) + { + html = html + ""; + } + else + { + color++; + } + html += ""; + } + if (pessoaFisica2) + { + html = html + ""; + } + if (!string.IsNullOrWhiteSpace(documento.Controle.Cliente.Identidade)) + { + html = html + ""; + } + if ((int)SelectedTipoExtrato != 2 && !ExtratoResumido) + { + html = html + ""; + } + if ((documento.Controle.Cliente.Telefones != null || documento.Controle.Cliente.Emails != null) && (int)SelectedTipoExtrato != 2) + { + html += ""; + if (documento.Controle.Cliente.Telefones != null) + { + string text10 = ""; + foreach (ClienteTelefone telefone3 in documento.Controle.Cliente.Telefones) + { + string[] obj10 = new string[10] { text10, "
", null, null, null, null, null, null, null, null }; + TipoTelefone? tipo = ((TelefoneBase)telefone3).Tipo; + object obj11; + if (!tipo.HasValue) + { + obj11 = null; + } + else + { + valueOrDefault = tipo.GetValueOrDefault(); + obj11 = ((object)(TipoTelefone)(ref valueOrDefault)).ToString().ToUpper(); + } + obj10[2] = (string)obj11; + obj10[3] = " ("; + obj10[4] = ((TelefoneBase)telefone3).Prefixo; + obj10[5] = ") "; + obj10[6] = ((TelefoneBase)telefone3).Numero; + obj10[7] = " ("; + obj10[8] = telefone3.Observacao; + obj10[9] = ") "; + text10 = string.Concat(obj10); + } + html = html + "
"; + } + if (documento.Controle.Cliente.Emails != null && !ExtratoResumido) + { + string text11 = ""; + foreach (ClienteEmail email3 in documento.Controle.Cliente.Emails) + { + text11 = text11 + "
" + ((EmailBase)email3).Email; + } + html = html + "
"; + } + else if (documento.Controle.Cliente.Enderecos != null && (int)SelectedTipoExtrato != 2) + { + string text12 = ""; + foreach (ClienteEndereco endereco3 in documento.Controle.Cliente.Enderecos) + { + text12 = text12 + "
" + ((EnderecoBase)endereco3).Endereco + ", " + ((EnderecoBase)endereco3).Numero + ", " + (string.IsNullOrWhiteSpace(((EnderecoBase)endereco3).Complemento) ? "" : (((EnderecoBase)endereco3).Complemento + ", ")) + ((EnderecoBase)endereco3).Bairro + " - " + ((EnderecoBase)endereco3).Cidade + " - " + ((EnderecoBase)endereco3).Estado + " - " + ((EnderecoBase)endereco3).Cep; + } + html = html + "
"; + } + color++; + html += ""; + } + if (documento.Controle.Cliente.Enderecos != null && (int)SelectedTipoExtrato != 2 && documento.Controle.Cliente.Emails == null && ExtratoResumido) + { + string text13 = ""; + foreach (ClienteEndereco endereco4 in documento.Controle.Cliente.Enderecos) + { + text13 = text13 + "
" + ((EnderecoBase)endereco4).Endereco + ", " + ((EnderecoBase)endereco4).Numero + ", " + (string.IsNullOrWhiteSpace(((EnderecoBase)endereco4).Complemento) ? "" : (((EnderecoBase)endereco4).Complemento + ", ")) + ((EnderecoBase)endereco4).Bairro + " - " + ((EnderecoBase)endereco4).Cidade + " - " + ((EnderecoBase)endereco4).Estado + " - " + ((EnderecoBase)endereco4).Cep; + } + html = html + "
"; + } + if (documento.Controle.Cliente.Contatos != null && (int)SelectedTipoExtrato != 2 && !ExtratoResumido) + { + string text14 = ""; + foreach (MaisContato contato2 in documento.Controle.Cliente.Contatos) + { + string[] obj12 = new string[15] + { + text14, + "
NOME: ", + contato2.Nome, + (!string.IsNullOrWhiteSpace(contato2.Documento)) ? (", DOCUMENTO: " + contato2.Documento) : "", + contato2.Nascimento.HasValue ? (", NASCIMENTO: " + contato2.Nascimento?.ToShortDateString()) : "", + null, + null, + null, + null, + null, + null, + null, + null, + null, + null + }; + object obj13; + if (!contato2.Parentesco.HasValue) + { + obj13 = ""; + } + else + { + Parentesco? parentesco = contato2.Parentesco; + object obj14; + if (!parentesco.HasValue) + { + obj14 = null; + } + else + { + Parentesco valueOrDefault2 = parentesco.GetValueOrDefault(); + obj14 = ((object)(Parentesco)(ref valueOrDefault2)).ToString().ToUpper(); + } + obj13 = ", PARENTESCO: " + (string?)obj14; + } + obj12[5] = (string)obj13; + obj12[6] = ((!string.IsNullOrWhiteSpace(contato2.Banco) || !string.IsNullOrWhiteSpace(contato2.Agencia) || !string.IsNullOrWhiteSpace(contato2.Conta)) ? "
" : ""); + obj12[7] = ((!string.IsNullOrWhiteSpace(contato2.Banco)) ? ("BANCO: " + contato2.Banco) : ""); + obj12[8] = ((!string.IsNullOrWhiteSpace(contato2.Agencia)) ? (((!string.IsNullOrWhiteSpace(contato2.Banco)) ? ", AGÊNCIA: " : "AGÊNCIA: ") + contato2.Agencia) : ""); + obj12[9] = ((!string.IsNullOrWhiteSpace(contato2.Conta)) ? (((!string.IsNullOrWhiteSpace(contato2.Banco) || !string.IsNullOrWhiteSpace(contato2.Agencia)) ? ", CONTA: " : "CONTA: ") + contato2.Conta) : ""); + obj12[10] = ((contato2.Tipo.HasValue || (!string.IsNullOrWhiteSpace(contato2.Prefixo) && !string.IsNullOrWhiteSpace(contato2.Telefone)) || !string.IsNullOrWhiteSpace(contato2.Email)) ? "
" : ""); + object obj15; + if (!contato2.Tipo.HasValue) + { + obj15 = ""; + } + else + { + TipoTelefone? tipo = contato2.Tipo; + object obj16; + if (!tipo.HasValue) + { + obj16 = null; + } + else + { + valueOrDefault = tipo.GetValueOrDefault(); + obj16 = ((object)(TipoTelefone)(ref valueOrDefault)).ToString().ToUpper(); + } + obj15 = "TIPO DO TELEFONE: " + (string?)obj16; + } + obj12[11] = (string)obj15; + obj12[12] = ((!string.IsNullOrWhiteSpace(contato2.Prefixo) && !string.IsNullOrWhiteSpace(contato2.Telefone)) ? ((contato2.Tipo.HasValue ? ", TELEFONE: (" : "TELEFONE: (") + contato2.Prefixo + ") " + contato2.Telefone) : ""); + obj12[13] = ((!string.IsNullOrWhiteSpace(contato2.Email)) ? (((contato2.Tipo.HasValue || (!string.IsNullOrWhiteSpace(contato2.Prefixo) && !string.IsNullOrWhiteSpace(contato2.Telefone))) ? ", EMAIL: " : "EMAIL: ") + contato2.Email) : ""); + obj12[14] = "
"; + text14 = string.Concat(obj12); + } + html = html + "
"; + } + if (documento.Controle.Cliente.Enderecos != null && !ExtratoResumido) + { + string text15 = ""; + foreach (ClienteEndereco endereco5 in documento.Controle.Cliente.Enderecos) + { + text15 = text15 + "
" + ((EnderecoBase)endereco5).Endereco + ", " + ((EnderecoBase)endereco5).Numero + ", " + (string.IsNullOrWhiteSpace(((EnderecoBase)endereco5).Complemento) ? "" : (((EnderecoBase)endereco5).Complemento + ", ")) + ((EnderecoBase)endereco5).Bairro + " - " + ((EnderecoBase)endereco5).Cidade + " - " + ((EnderecoBase)endereco5).Estado + " - " + ((EnderecoBase)endereco5).Cep; + } + html = html + "
"; + } + if (ObsCliente && ClienteVisibility && ObsClienteEnabled && !string.IsNullOrWhiteSpace(documento.Controle.Cliente.Observacao) && (int)SelectedTipoExtrato != 2 && !ExtratoResumido) + { + documento.Controle.Cliente.Observacao = "
" + documento.Controle.Cliente.Observacao.Replace("\r\n", "
"); + html = html + "
"; + } + if (!string.IsNullOrWhiteSpace(documento.Controle.Cliente.Pasta) && (int)SelectedTipoExtrato != 2 && !ExtratoResumido) + { + html = html + ""; + } + html += "

CLIENTE: " + documento.Controle.Cliente.Nome + "

CPF/CNPJ: " + documento.Controle.Cliente.Documento + "

" + text9 + ": " + documento.Controle.Cliente.Nascimento?.ToShortDateString() + "

FALECIDO: " + (documento.Controle.Cliente.Falecido ? "SIM" : "NÃO") + "

RAMO DE ATIVIDADE: " + documento.Controle.Cliente.Atividade.Nome + "

"; + if (pessoaFisica2) + { + html = html + "ESTADO CIVIL: " + (documento.Controle.Cliente.EstadoCivil.HasValue ? documento.Controle.Cliente.EstadoCivil.ToString().ToUpper() : "-") + "

SEXO: " + (documento.Controle.Cliente.Sexo.HasValue ? documento.Controle.Cliente.Sexo.ToString().ToUpper() : "-") + "

"; + } + html = html + "

CLIENTE DESDE: " + ((!documento.Controle.Cliente.ClienteDesde.HasValue) ? "-" : documento.Controle.Cliente.ClienteDesde?.ToShortDateString()) + "

PROFISSÃO: " + documento.Controle.Cliente.Profissao.Nome + "

HABILITAÇÃO: " + ((!string.IsNullOrWhiteSpace(documento.Controle.Cliente.Habilitacao)) ? documento.Controle.Cliente.Habilitacao : "-") + "

CATEGORIA: " + ((!string.IsNullOrWhiteSpace(documento.Controle.Cliente.CategoriaHabilitacao)) ? documento.Controle.Cliente.CategoriaHabilitacao : "-") + "

1ª HAB.: " + ((!documento.Controle.Cliente.PrimeiraHabilitacao.HasValue) ? "-" : documento.Controle.Cliente.PrimeiraHabilitacao?.ToShortDateString()) + "

VENCIMENTO: " + ((!documento.Controle.Cliente.VencimentoHabilitacao.HasValue) ? "-" : documento.Controle.Cliente.VencimentoHabilitacao?.ToShortDateString()) + "

RG: " + ((!string.IsNullOrWhiteSpace(documento.Controle.Cliente.Identidade)) ? documento.Controle.Cliente.Identidade : "-") + "

ORGÃO EMISSOR: " + ((!string.IsNullOrWhiteSpace(documento.Controle.Cliente.Emissor)) ? documento.Controle.Cliente.Emissor : "-") + "

ESTADO EMISSOR: " + ((!string.IsNullOrWhiteSpace(documento.Controle.Cliente.EstadoEmissor)) ? documento.Controle.Cliente.EstadoEmissor : "-") + "

EXPEDIÇÃO: " + ((!documento.Controle.Cliente.Expedicao.HasValue) ? "-" : documento.Controle.Cliente.Expedicao?.ToShortDateString()) + "

BANCO: " + ((documento.Controle.Cliente.Banco != null) ? documento.Controle.Cliente.Banco.Nome : "-") + "

AGÊNCIA: " + ((!string.IsNullOrWhiteSpace(documento.Controle.Cliente.Agencia)) ? documento.Controle.Cliente.Agencia : "-") + "

CONTA: " + ((!string.IsNullOrWhiteSpace(documento.Controle.Cliente.Conta)) ? documento.Controle.Cliente.Conta : "-") + "

TIPO: " + ((!string.IsNullOrWhiteSpace(documento.Controle.Cliente.TipoConta)) ? documento.Controle.Cliente.TipoConta : "-") + "

CONTATOS: " + text10 + "

EMAILS: " + text11 + "

ENDEREÇOS: " + text12 + "

ENDEREÇOS: " + text13 + "

MAIS CONTATOS: " + text14 + "

ENDEREÇOS: " + text15 + "

OBSERVAÇÕES: " + documento.Controle.Cliente.Observacao + "

PASTA: " + documento.Controle.Cliente.Pasta + "

"; + if (!primeiro) + { + html += (((int)ClientePorPaginaVisibility == 0 && ClientePorPagina && ClientePorPaginaEnabled) ? "
" : ""); + } + } + else + { + html = html + "

CLIENTE: " + documento.Controle.Cliente.Nome + "

RG: " + ((!string.IsNullOrWhiteSpace(documento.Controle.Cliente.Identidade)) ? documento.Controle.Cliente.Identidade : "-") + "

CPF/CNPJ: " + documento.Controle.Cliente.Documento + "

"; + } + if ((int)SelectedTipoExtrato == 0) + { + return; + } + color = 0; + html = html + "
"; + if (!documento.NegocioCorretora.HasValue) + { + documento.NegocioCorretora = (NegocioCorretora)(((int)documento.Situacao == 2 && documento.Negocio.HasValue && (int)documento.Negocio.GetValueOrDefault() == 1) ? 1 : 0); + } + if (ComissaoDocumento && ComissaoDocumentoEnabled) + { + if ((int)SelectedTipoExtrato != 2) + { + html = html + ""; + } + else + { + html = html + ""; + } + } + else if ((int)SelectedTipoExtrato != 2) + { + html = html + ""; + } + html = html + ""; + if ((int)SelectedTipoExtrato != 2 && !ExtratoResumido) + { + html += ""; + string text16 = ""; + if (documento.Estipulante1 != null) + { + text16 = text16 + documento.Estipulante1.Nome + ", "; + } + if (documento.Estipulante2 != null) + { + text16 = text16 + documento.Estipulante2.Nome + ", "; + } + if (documento.Estipulante3 != null) + { + text16 = text16 + documento.Estipulante3.Nome + ", "; + } + if (documento.Estipulante4 != null) + { + text16 = text16 + documento.Estipulante4.Nome + ", "; + } + if (documento.Estipulante5 != null) + { + text16 = text16 + documento.Estipulante5.Nome + ", "; + } + if (!string.IsNullOrWhiteSpace(text16)) + { + int startIndex3 = text16.LastIndexOf(", ", StringComparison.Ordinal); + text16 = text16.Remove(startIndex3, 2).Insert(startIndex3, "."); + } + html = html + ""; + } + if ((int)SelectedTipoExtrato != 2) + { + html = html + ""; + if (documento.Controle.SeguradoraAnterior != null && !ExtratoResumido) + { + html = html + ""; + } + } + else + { + html = html + ""; + } + html += "

RAMO: " + documento.Controle.Ramo.Nome + "

VIGÊNCIA INICIAL: " + documento.Vigencia1.ToShortDateString() + "

VIGÊNCIA FINAL: " + ((!documento.Vigencia2.HasValue) ? "-" : documento.Vigencia2?.ToShortDateString()) + "

CONTRATO: " + (string.IsNullOrWhiteSpace(documento.Apolice) ? "-" : documento.Apolice) + "

POSSUI ENDOSSO? " + (documento.TemEndosso ? "SIM" : "NÃO") + "

ADITAMENTO: " + ((!string.IsNullOrWhiteSpace(documento.Endosso)) ? documento.Endosso : ((configEndosso && documento.Controle.Documentos.Where((Documento x) => !x.Excluido && x.Ordem != 0).ToList().Count > 0) ? documento.Controle.Documentos.Last((Documento x) => !x.Excluido && x.Ordem != 0).Endosso : "-")) + "

APÓLICE ANTERIOR: " + (string.IsNullOrWhiteSpace(documento.ApoliceAnterior) ? "-" : documento.ApoliceAnterior) + "

BANCO: " + ((documento.Banco == null) ? "-" : documento.Banco.Nome) + "

AGÊNCIA: " + (string.IsNullOrWhiteSpace(documento.Agencia) ? "-" : documento.Agencia) + "

CONTA: " + (string.IsNullOrWhiteSpace(documento.Conta) ? "-" : documento.Conta) + "

NUMERO CARTÃO: " + (string.IsNullOrWhiteSpace(documento.NumeroCartao) ? "-" : documento.NumeroCartao) + "

VENCIMENTO: " + (string.IsNullOrWhiteSpace(documento.VencimentoCartao) ? "-" : documento.VencimentoCartao) + "

BANDEIRA: " + ((!documento.Bandeira.HasValue) ? "-" : ValidationHelper.GetDescription((Enum)(object)documento.Bandeira)) + "

TITULAR/PROPONENTE: " + (string.IsNullOrWhiteSpace(documento.NomeProponente) ? "-" : documento.NomeProponente) + "

NEGÓCIO CORRETORA: " + ValidationHelper.GetDescription((Enum)(object)documento.NegocioCorretora) + "

STATUS DO SEGURO: " + ValidationHelper.GetDescription((Enum)(object)documento.Situacao) + "

COMISSÃO: " + $"{documento.Comissao}%" + "

COMISSÃO: " + $"{documento.Comissao}%" + "

NEGÓCIO CORRETORA: " + ValidationHelper.GetDescription((Enum)(object)documento.NegocioCorretora) + "

STATUS DO SEGURO: " + ValidationHelper.GetDescription((Enum)(object)documento.Situacao) + "

VENDEDOR: " + ((documento.VendedorPrincipal == null) ? "-" : documento.VendedorPrincipal.Nome) + "

REMESSA: " + ((!documento.Remessa.HasValue) ? "-" : documento.Remessa?.ToShortDateString()) + "

EMISSÃO: " + ((!documento.Emissao.HasValue) ? "-" : documento.Emissao?.ToShortDateString()) + "

ESTIPULANTE(S): " + (string.IsNullOrWhiteSpace(text16) ? "-" : text16) + "

SEGURADORA: " + documento.Controle.Seguradora.Nome + "

APÓLICE SINISTRADA: " + (documento.Sinistro ? "SIM" : "NÃO") + "

SEGURADORA ANTERIOR: " + documento.Controle.SeguradoraAnterior.Nome + "

SEGURADORA: " + documento.Controle.Seguradora.Nome + "

"; + if (!ExtratoResumido && (PremioParcela || ObsApoliceEnabled)) + { + html += ""; + if (PremioParcela) + { + html = html + ""; + html += ""; + html += "

PRÊMIO LÍQUIDO:
" + documento.PremioLiquido.ToString("c") + "

ADICIONAL:
" + documento.PremioAdicional.ToString("c") + "

CUSTO APÓLICE:
" + documento.Custo.ToString("c") + "

I.O.F.:
" + documento.Iof.ToString("c") + "

PRÊMIO TOTAL:
" + documento.PremioTotal.ToString("c") + "


"; + ObservableCollection parcelas = documento.Parcelas; + if (parcelas != null && parcelas.Count > 0) + { + html += ""; + foreach (Parcela parcela in documento.Parcelas) + { + html = html + ""; + } + } + } + if (ObsApolice && ObsApoliceEnabled) + { + html = html + ""; + } + html += "

PARCELA

VENCIMENTO

VALOR

FORMA DE PAGAMENTO

" + parcela.NumeroParcela + "

" + parcela.Vencimento.ToShortDateString() + "

" + $"{parcela.Valor:c}" + "

" + ValidationHelper.GetDescription((Enum)(object)documento.FormaPagamento) + "

OBSERVAÇÕES: " + (string.IsNullOrWhiteSpace(documento.Observacao) ? "-" : documento.Observacao) + "

"; + } + if (PerfilCondutor && PerfilVisibility && ((DomainBase)documento.Controle.Ramo).Id == 5 && PerfilCondutorEnabled) + { + List list4 = source.ToList(); + foreach (Perfil item5 in list4) + { + color = 0; + if (!string.IsNullOrEmpty(item5.Nome)) + { + html = html + "

" + $"CONDUTOR {list4.IndexOf(item5) + 1}: " + "" + item5.Nome + "

CPF: " + (string.IsNullOrWhiteSpace(item5.Cpf) ? "-" : item5.Cpf) + "

NASCIMENTO: " + ((!item5.Nascimento.HasValue) ? "-" : item5.Nascimento?.ToShortDateString()) + "

ESTADO CIVIL: " + ((!item5.EstadoCivil.HasValue) ? "-" : ValidationHelper.GetDescription((Enum)(object)item5.EstadoCivil)) + "

SEXO: " + ((!item5.Sexo.HasValue) ? "-" : ValidationHelper.GetDescription((Enum)(object)item5.Sexo)) + "

RELAÇÃO SEGURADO/CONDUTOR: " + ValidationHelper.GetDescription((Enum)(object)item5.Relacao) + "

HABILITAÇÃO: " + (string.IsNullOrWhiteSpace(item5.Habilitacao) ? "-" : item5.Habilitacao) + "

TEMPO DE HABILITAÇÃO: " + ((!item5.TempoHabilitacao.HasValue) ? "-" : ValidationHelper.GetDescription((Enum)(object)item5.TempoHabilitacao)) + "

QUATIDADE DE VEÍCULOS: " + ((!item5.VeiculoResidencia.HasValue) ? "-" : item5.VeiculoResidencia.Value.ToString()) + "

GARAGEM NA RESIDÊNCIA: " + ((!item5.GaragemResidencia.HasValue) ? "-" : ValidationHelper.GetDescription((Enum)(object)item5.GaragemResidencia)) + "

GARAGEM NO TRABALHO: " + ((!item5.GaragemTrabalho.HasValue) ? "-" : ValidationHelper.GetDescription((Enum)(object)item5.GaragemTrabalho)) + "

GARAGEM NO ESTUDO: " + ((!item5.GaragemEstudo.HasValue) ? "-" : ValidationHelper.GetDescription((Enum)(object)item5.GaragemEstudo)) + "

TIPO DE RESIDÊNCIA: " + ((!item5.TipoResidencia.HasValue) ? "-" : ValidationHelper.GetDescription((Enum)(object)item5.TipoResidencia)) + "

QUILOMETRAGEM MENSAL: " + (string.IsNullOrWhiteSpace(item5.KmMensal) ? "-" : item5.KmMensal) + "

DISTÂNCIA ATÉ O TRABALHO: " + ((!item5.DistanciaResidenciaTrabalho.HasValue) ? "-" : ValidationHelper.GetDescription((Enum)(object)item5.DistanciaResidenciaTrabalho)) + "

USO PROFISSIONAL: " + ((item5.UsoProfissional.HasValue && item5.UsoProfissional.Value) ? "SIM" : "NÃO") + "

USO POR DEPENDENTES: " + ((!item5.UsoDependentes.HasValue) ? "-" : ValidationHelper.GetDescription((Enum)(object)item5.UsoDependentes)) + "

OCUPAÇÃO: " + ((!item5.Ocupacao.HasValue) ? "-" : ValidationHelper.GetDescription((Enum)(object)item5.Ocupacao)) + "

SEGURO VIDA: " + ((item5.SeguroVida.HasValue && item5.SeguroVida.Value) ? "SIM" : "NÃO") + "

ISENÇÃO DE IMPOSTOS: " + ((item5.Isencao.HasValue && item5.Isencao.Value) ? "SIM" : "NÃO") + "

ANTIFURTO: " + (item5.AntiFurto.HasValue ? ValidationHelper.GetDescription((Enum)(object)item5.AntiFurto) : "") + "

COBERTURA ESTENDIDA PARA RESIDENTES HABILITADOS: " + ((item5.EstenderCobertura.HasValue && item5.EstenderCobertura.Value) ? "SIM" : "NÃO") + "

"; + } + } + } + List itens2 = itensDocumentos.ToList(); + if (itens2.Count == 0) + { + html += "

ESTA APÓLICE NÃO POSSUI ITENS

"; + } + else + { + color = 0; + foreach (Item item2 in itens2) + { + if (item2.Sinistros.Count > 0) + { + Item val3 = item2; + val3.Sinistros = await new SinistroServico().BuscarControles(((DomainBase)item2).Id); + } + html += ((SepararPagina && SepararPaginaEnabled) ? "
" : ""); + html += (((int)SelectedTipoExtrato != 2 || itens2.IndexOf(item2) == 0) ? "
" : ""); + html += ""; + html += ""; + html += ""; + if ((int)SelectedTipoExtrato == 2) + { + html = html + ""; + } + else + { + switch (((DomainBase)documento.Controle.Ramo).Id) + { + case 1L: + case 2L: + case 3L: + case 15L: + case 18L: + { + Item val3 = item2; + val3.Patrimonial = await new ItemServico().BuscaPatrimonial(((DomainBase)item2).Id); + html = html + ""; + break; + } + case 5L: + case 37L: + { + Item val3 = item2; + val3.Auto = await new ItemServico().BuscaAuto(((DomainBase)item2).Id); + string[] obj17 = new string[26] + { + html, + ""; + html = string.Concat(obj17); + break; + } + default: + html = html + ""; + break; + } + } + if (item2.Sinistros.Count > 0) + { + Item obj18 = item2; + DateTime? obj19; + if (obj18 == null) + { + obj19 = null; + } + else + { + IList sinistros3 = obj18.Sinistros; + if (sinistros3 == null) + { + obj19 = null; + } + else + { + ControleSinistro? obj20 = sinistros3.LastOrDefault(); + if (obj20 == null) + { + obj19 = null; + } + else + { + List sinistros4 = obj20.Sinistros; + if (sinistros4 == null) + { + obj19 = null; + } + else + { + Sinistro? obj21 = sinistros4.LastOrDefault(); + obj19 = ((obj21 != null) ? obj21.DataReclamacao : null); + } + } + } + } + DateTime? dateTime2 = obj19; + string text17 = (dateTime2.HasValue ? dateTime2.Value.ToShortDateString() : "-"); + string[] obj22 = new string[18] + { + html, ""; + html = string.Concat(obj22); + } + html += ""; + if ((int)SelectedTipoExtrato != 2) + { + string[] obj31 = new string[10] { html, ""; + html = string.Concat(obj31); + long id = ((DomainBase)documento.Controle.Ramo).Id; + long num4 = id - 1; + if ((ulong)num4 <= 58uL) + { + switch (num4) + { + case 0L: + case 1L: + case 2L: + case 14L: + case 17L: + if (ObsItem && ObsItemEnabled) + { + html = html + ""; + } + break; + case 4L: + case 36L: + { + if (ObsItem && ObsItemEnabled) + { + html = html + ""; + } + string[] array2 = new string[30]; + array2[0] = html; + array2[1] = ""; + html = string.Concat(array2); + break; + } + case 5L: + case 6L: + case 8L: + case 9L: + case 52L: + { + Item val3 = item2; + val3.Vida = await new ItemServico().BuscaVida(((DomainBase)item2).Id); + if (!item2.Sinistrado || !BeneficiariosItens || !BeneficiariosItensEnabled) + { + break; + } + html = html + ""; + break; + } + case 3L: + case 7L: + case 15L: + case 16L: + case 18L: + case 22L: + case 23L: + case 25L: + case 27L: + case 30L: + case 32L: + case 38L: + case 40L: + case 43L: + case 48L: + case 58L: + { + Item val3 = item2; + val3.RiscosDiversos = await new ItemServico().BuscaRiscosDiversos(((DomainBase)item2).Id); + if (ObsItem && ObsItemEnabled) + { + html = html + ""; + } + break; + } + case 12L: + { + Item val3 = item2; + val3.Aeronautico = await new ItemServico().BuscaAeronautico(((DomainBase)item2).Id); + if (ObsItem && ObsItemEnabled) + { + html = html + ""; + } + break; + } + case 19L: + { + Item val3 = item2; + val3.Granizo = await new ItemServico().BuscaGranizo(((DomainBase)item2).Id); + if (ObsItem && ObsItemEnabled) + { + html = html + ""; + } + break; + } + } + } + } + html += "

" + $"ITEM {item2.Ordem}: " + "" + item2.Descricao + "

" + $"ITEM {item2.Ordem}: " + "" + ((EnderecoBase)item2.Patrimonial).Endereco + ", " + ((EnderecoBase)item2.Patrimonial).Numero + ", " + (string.IsNullOrWhiteSpace(((EnderecoBase)item2.Patrimonial).Complemento) ? "" : (((EnderecoBase)item2.Patrimonial).Complemento + ", ")) + ((EnderecoBase)item2.Patrimonial).Bairro + " - " + ((EnderecoBase)item2.Patrimonial).Cidade + " - " + ((EnderecoBase)item2.Patrimonial).Estado + " - " + ((EnderecoBase)item2.Patrimonial).Cep + "

", + $"ITEM {item2.Ordem}: ", + "
", + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null + }; + Fabricante fabricante2 = item2.Auto.Fabricante; + obj17[6] = ((fabricante2 != null) ? fabricante2.Descricao : null); + obj17[7] = " "; + obj17[8] = item2.Auto.Modelo; + obj17[9] = " ("; + obj17[10] = item2.Auto.AnoFabricacao; + obj17[11] = "/"; + obj17[12] = item2.Auto.AnoModelo; + obj17[13] = ")
PLACA: "; + obj17[14] = item2.Auto.Placa; + obj17[15] = ", CHASSI: "; + obj17[16] = item2.Auto.Chassi; + obj17[17] = "
C.I.: "; + obj17[18] = item2.Auto.Ci; + obj17[19] = ", RENAVAM: "; + obj17[20] = item2.Auto.Renavam; + obj17[21] = ", CEP PERNOITE: "; + obj17[22] = item2.Auto.CepPernoite; + obj17[23] = "
FINANCIADO: "; + obj17[24] = (item2.Auto.Financiado.GetValueOrDefault() ? "SIM" : "NÃO"); + obj17[25] = "

" + $"ITEM {item2.Ordem}: " + "" + item2.Descricao + "

QTDE SINISTRO(S): " + item2.Sinistros.Count + "

SINISTRO STATUS: "; + Item obj23 = item2; + object obj24; + if (obj23 == null) + { + obj24 = null; + } + else + { + IList sinistros5 = obj23.Sinistros; + if (sinistros5 == null) + { + obj24 = null; + } + else + { + ControleSinistro? obj25 = sinistros5.LastOrDefault(); + if (obj25 == null) + { + obj24 = null; + } + else + { + List sinistros6 = obj25.Sinistros; + if (sinistros6 == null) + { + obj24 = null; + } + else + { + Sinistro? obj26 = sinistros6.LastOrDefault(); + obj24 = ((obj26 != null) ? ValidationHelper.GetDescription((Enum)(object)obj26.StatusSinistro) : null); + } + } + } + } + obj22[4] = (string)obj24; + obj22[5] = "

DATA: "; + obj22[8] = text17; + obj22[9] = "

VALOR: "; + Item obj27 = item2; + object obj28; + if (obj27 == null) + { + obj28 = null; + } + else + { + IList sinistros7 = obj27.Sinistros; + if (sinistros7 == null) + { + obj28 = null; + } + else + { + ControleSinistro? obj29 = sinistros7.LastOrDefault(); + if (obj29 == null) + { + obj28 = null; + } + else + { + List sinistros8 = obj29.Sinistros; + if (sinistros8 == null) + { + obj28 = null; + } + else + { + Sinistro? obj30 = sinistros8.LastOrDefault(); + obj28 = ((obj30 != null) ? ValidationHelper.ToCurrency(obj30.Valor, "pt-BR") : null); + } + } + } + } + obj22[12] = (string)obj28; + obj22[13] = "

QTDE SINISTRO(S): "; + obj22[16] = item2.Sinistros.Count.ToString(); + obj22[17] = "

STATUS: "; + obj31[4] = (string.IsNullOrWhiteSpace(item2.Status) ? item2.StatusInclusao : item2.Status); + obj31[5] = "

ATIVO: "; + obj31[8] = ((!item2.Substituido.HasValue) ? "SIM" : "NÃO"); + obj31[9] = "

OBSERVAÇÕES: " + (string.IsNullOrWhiteSpace(item2.Patrimonial.Item.Observacao) ? "-" : item2.Patrimonial.Item.Observacao) + "

BENS E INFORMAÇÕES: " + (string.IsNullOrWhiteSpace(item2.Patrimonial.Bens) ? "-" : item2.Patrimonial.Bens) + "

OBSERVAÇÕES: " + (string.IsNullOrWhiteSpace(item2.Auto.Observacao) ? "-" : item2.Auto.Observacao) + "

COBERTURA PADRÃO: "; + TipoCobertura? tipoCobertura = item2.Auto.TipoCobertura; + array2[4] = (tipoCobertura.HasValue ? ValidationHelper.GetDescription((Enum)(object)tipoCobertura.GetValueOrDefault()) : null); + array2[5] = "

BÔNUS: "; + array2[8] = item2.Auto.Bonus.ToString(); + array2[9] = "

REGIÃO DE CIRCULAÇÃO: "; + array2[12] = (string.IsNullOrWhiteSpace(item2.Auto.RegiaoCirculacao) ? "-" : item2.Auto.RegiaoCirculacao); + array2[13] = "

TABELA DE REFERÊNCIA: "; + TabelaReferencia? tabelaReferencia = item2.Auto.TabelaReferencia; + array2[16] = (tabelaReferencia.HasValue ? ValidationHelper.GetDescription((Enum)(object)tabelaReferencia.GetValueOrDefault()) : null); + array2[17] = "

% DE REFERÊNCIA: "; + array2[20] = $"{item2.Auto.PorcentagemReferencia}%"; + array2[21] = "

CÓDIGO FIPE: "; + array2[24] = (string.IsNullOrWhiteSpace(item2.Auto.Fipe) ? "-" : item2.Auto.Fipe); + array2[25] = "

COR DO VEÍCULO: "; + array2[28] = ((!item2.Auto.Cor.HasValue) ? "-" : ValidationHelper.GetDescription((Enum)(object)item2.Auto.Cor)); + array2[29] = "

BENEFICIÁRIOS: "; + string text18 = ""; + foreach (ControleSinistro sinistro3 in item2.Sinistros) + { + if (sinistro3.Sinistros == null) + { + continue; + } + foreach (Sinistro sinistro4 in sinistro3.Sinistros) + { + if (!string.IsNullOrWhiteSpace(sinistro4.SinistroVida.Beneficiario)) + { + text18 = text18 + sinistro4.SinistroVida.Beneficiario + ", "; + } + } + } + if (!string.IsNullOrWhiteSpace(text18)) + { + int startIndex4 = text18.LastIndexOf(", ", StringComparison.Ordinal); + text18 = text18.Remove(startIndex4, 2).Insert(startIndex4, "."); + } + html = html + text18 + "

OBSERVAÇÕES: " + (string.IsNullOrWhiteSpace(item2.RiscosDiversos.Observacao) ? "-" : item2.RiscosDiversos.Observacao) + "

OBSERVAÇÕES: " + (string.IsNullOrWhiteSpace(item2.Aeronautico.Observacao) ? "-" : item2.Aeronautico.Observacao) + "

OBSERVAÇÕES: " + (string.IsNullOrWhiteSpace(item2.Granizo.Observacao) ? "-" : item2.Granizo.Observacao) + "

"; + if ((int)SelectedTipoExtrato != 2) + { + ObservableCollection observableCollection2 = await new ItemServico().BuscarCoberturasPorItemAsync(((DomainBase)item2).Id); + if (observableCollection2.Count > 0 && Coberturas) + { + html += "
"; + foreach (Cobertura item6 in observableCollection2) + { + html = html + ""; + } + html += "

COBERTURA

FRANQUIA

L.M.I.

PRÊMIO

" + item6.Observacao + "

" + $"{item6.Franquia:c}" + "

" + $"{item6.Lmi:c}" + "

" + $"{item6.Premio:c}" + "

"; + } + html += ((SepararPagina && SepararPaginaEnabled) ? "
" : ""); + } + if ((int)SelectedTipoExtrato != 2) + { + color = 0; + } + } + } + } + } + sDocumento.Add(((DomainBase)documento.Controle).Id); + primeiro = false; + } + } + if (Prospeccoes != null && Prospeccoes.Count > 0) + { + foreach (Prospeccao prospecco in Prospeccoes) + { + int num5 = 0; + html += (((int)ClientePorPaginaVisibility == 0 && ClientePorPagina && ClientePorPaginaEnabled) ? "
" : ""); + html += "

"; + if ((int)SelectedTipoExtrato == 0) + { + title = "EXTRATO" + (ExtratoResumido ? " RESUMIDO" : "") + " DO CLIENTE: " + prospecco.Nome; + } + html = html + title + "


"; + html += ""; + if (ExtratoResumido) + { + html = html + ""; + if ((int)SelectedTipoExtrato != 2) + { + html += ""; + string text19 = ""; + if (prospecco.Telefone1 != null) + { + text19 = text19 + "
(" + prospecco.Prefixo1 + ") " + prospecco.Telefone1; + } + if (prospecco.Telefone2 != null) + { + text19 = text19 + "
(" + prospecco.Prefixo2 + ") " + prospecco.Telefone2; + } + html = html + "
"; + string text20 = ""; + if (prospecco.Email != null) + { + text20 = "
" + prospecco.Email; + } + html = html + "
"; + } + html += "

CLIENTE: " + prospecco.Nome + "

CPF/CNPJ: " + prospecco.Documento + "

CONTATOS: " + (string.IsNullOrEmpty(text19) ? "-" : text19) + "

EMAILS: " + (string.IsNullOrEmpty(text20) ? "-" : text20) + "

"; + html += (((int)ClientePorPaginaVisibility == 0 && ClientePorPagina && ClientePorPaginaEnabled) ? "
" : ""); + if ((int)SelectedTipoExtrato == 0) + { + return; + } + num5 = 0; + html = html + "
"; + html = html + ""; + html += "

VIGÊNCIA FINAL: " + ((!prospecco.VigenciaFinal.HasValue) ? "-" : prospecco.VigenciaFinal?.ToShortDateString()) + "

VENDEDOR: " + ((prospecco.Vendedor == null) ? "-" : prospecco.Vendedor.Nome) + "

"; + continue; + } + string text21 = "NASCIMENTO"; + html = html + ""; + if ((prospecco.Telefone1 != null || prospecco.Email != null) && (int)SelectedTipoExtrato != 2) + { + html += ""; + if (prospecco.Telefone1 != null) + { + string text22 = ""; + text22 = text22 + "
(" + prospecco.Prefixo1 + ") " + prospecco.Telefone1; + if (prospecco.Telefone2 != null) + { + text22 = text22 + "
(" + prospecco.Prefixo2 + ") " + prospecco.Telefone2; + } + html = html + "
"; + } + if (prospecco.Email != null && !ExtratoResumido) + { + string text23 = ""; + text23 = text23 + "
" + prospecco.Email; + html = html + "
"; + } + html += ""; + } + html += (((int)ClientePorPaginaVisibility == 0 && ClientePorPagina && ClientePorPaginaEnabled) ? "" : ""); + if ((int)SelectedTipoExtrato == 0) + { + return; + } + num5 = 0; + html = html + "

CLIENTE: " + prospecco.Nome + "

CPF/CNPJ: " + prospecco.Documento + "

" + text21 + ": " + prospecco.Nascimento?.ToShortDateString() + "

CONTATOS: " + text22 + "

EMAILS: " + text23 + "

"; + html = html + ""; + html += "

VIGÊNCIA FINAL: " + ((!prospecco.VigenciaFinal.HasValue) ? "-" : prospecco.VigenciaFinal?.ToShortDateString()) + "

VENDEDOR: " + ((prospecco.Vendedor == null) ? "-" : prospecco.Vendedor.Nome) + "

"; + } + } + DateTime networkTime2 = Funcoes.GetNetworkTime(); + html = html + "

" + Recursos.Usuario.Nome + " - " + networkTime2.Date.ToShortDateString() + "
"; + string tempPath2 = Path.GetTempPath(); + string text24 = $"{tempPath2}{(object)(TipoExtrato)0}_{networkTime2:ddMMyyyyhhmmss}.html"; + if (pdf) + { + text24 = $"{tempPath2}{(object)(TipoExtrato)0}_{networkTime2:ddMMyyyyhhmmss}.pdf"; + byte[] bytes2 = ((HtmlToPdfConverter)new NRecoHtmlToPdfConverter()).GeneratePdf(html); + File.WriteAllBytes(text24, bytes2); + } + else + { + StreamWriter streamWriter2 = new StreamWriter(text24, append: true, Encoding.UTF8); + streamWriter2.Write(html); + streamWriter2.Close(); + } + Process.Start(text24); + if (Documentos != null && Documentos.Count > 1) + { + RegistrarAcao("GEROU O EXTRATO" + (ExtratoResumido ? " RESUMIDO" : "") + " " + ((Documentos == null) ? "" : ((Documentos.Count > 1) ? $"DE {Documentos.Count} DOCUMENTOS" : $"DO DOCUMENTO {((DomainBase)Documentos[0]).Id}")), 0L, (TipoTela)23, "IDS DOS DOCUMENTOS:\n" + string.Join("\n", Documentos.Select((Documento x) => ((DomainBase)x).Id)) + GerarOpcoes()); + } + if (Prospeccoes != null && Prospeccoes.Count > 1) + { + RegistrarAcao("GEROU O EXTRATO" + (ExtratoResumido ? " RESUMIDO" : "") + " " + ((Prospeccoes == null) ? "" : ((Prospeccoes.Count > 1) ? $"DE {Prospeccoes.Count} PROSPECÇÕES" : $"DA PROSPÇÃO{((DomainBase)Prospeccoes[0]).Id}")), 0L, (TipoTela)23, "IDS DOS DOCUMENTOS:\n" + string.Join("\n", Prospeccoes.Select((Prospeccao x) => ((DomainBase)x).Id)) + GerarOpcoes()); + } + Documentos = null; + Clientes = null; + Prospeccoes = null; + } + } + + public string GerarOpcoes() + { + //IL_002b: Unknown result type (might be due to invalid IL or missing references) + //IL_00b3: Unknown result type (might be due to invalid IL or missing references) + //IL_008f: Unknown result type (might be due to invalid IL or missing references) + string text = ""; + if (ClienteVisibility && ObsCliente && ObsClienteEnabled) + { + text += "\nOBSERVAÇÕES DO CLIENTE"; + } + if ((int)ClientePorPaginaVisibility == 0 && ClientePorPagina && ClientePorPaginaEnabled) + { + text += "\nSEPARAR CLIENTES POR PÁGINA"; + } + if (DocumentoVisibility) + { + if (ComissaoDocumentoEnabled && ComissaoDocumento) + { + text += "\nCOMISSÕES DO DOCUMENTO"; + } + if (ObsApoliceEnabled && ObsApolice) + { + text += "\nOBSERVAÇÕES DA APÓLICE"; + } + if ((int)SegurosVigentesVisibility == 0 && SegurosVigentes) + { + text += "\nAPENAS SEGUROS VIGENTES"; + } + } + if (ItemVisibility) + { + if ((int)SelecionarItensVisibility == 0 && SelecionarItens) + { + text += "\nSELECIONAR ITENS"; + } + if (BeneficiariosItensEnabled && BeneficiariosItens) + { + text += "\nBENEFICIÁRIOS DOS ITENS"; + } + if (ObsItemEnabled && ObsItem) + { + text += "\nOBSERVAÇÕES DO ITEM"; + } + if (SepararPaginaEnabled && SepararPagina) + { + text += "\nSEPARAR ITENS POR PÁGINA"; + } + } + if (PerfilCondutor && PerfilVisibility && PerfilCondutorEnabled) + { + text += "\nPERFIL DO CONDUTOR"; + } + if (string.IsNullOrWhiteSpace(text)) + { + return ""; + } + return "\n\nOPÇÕES:" + text; + } + + public async Task PrepararExtrato(List clientes, List documentos, List prospeccoes, Relatorio? tipoRelatorio = null, List selecionadosDoc = null, List selecionadosPros = null, bool pdf = false) + { + Carregando = true; + if (tipoRelatorio == (Relatorio?)0 || (int)tipoRelatorio.GetValueOrDefault() == 1) + { + if (clientes == null || clientes.Count == 0) + { + await ShowMessage("É NECESSÁRIO HAVER AO MENOS UM CLIENTE"); + Carregando = false; + return; + } + if (clientes.Count > 200 && !(await ShowMessage("A SELEÇÃO DE MUITOS EXTRATOS PODE DEMORAR MAIS DE 30 MINUTOS! CONTINUAR?", "SIM", "NÃO"))) + { + Carregando = false; + return; + } + List listaCli = new List(); + foreach (ClientesAtivosInativos item2 in clientes.Where((ClientesAtivosInativos x) => x.Selecionado)) + { + Cliente cli = await new ClienteServico().BuscarCliente(item2.Id); + Cliente val = cli; + val.Enderecos = await _clienteServico.BuscarEnderecosAsync(((DomainBase)cli).Id); + val = cli; + val.Emails = await _clienteServico.BuscarEmailsAsync(((DomainBase)cli).Id); + val = cli; + val.Telefones = await _clienteServico.BuscarTelefonesAsync(((DomainBase)cli).Id); + val = cli; + val.Contatos = await _clienteServico.BuscarContatosAsync(((DomainBase)cli).Id); + val = cli; + val.Vinculos = await _clienteServico.BuscarVinculosAsync(((DomainBase)cli).Id); + listaCli.Add(cli); + } + Clientes = listaCli; + goto IL_16a4; + } + if ((documentos == null || documentos.Count == 0) && (prospeccoes == null || prospeccoes.Count == 0)) + { + await ShowMessage("É NECESSÁRIO HAVER AO MENOS UM DOCUMENTO OU PROSPECÇÃO"); + Carregando = false; + return; + } + if (documentos == null || documentos.Count <= 200) + { + if (prospeccoes == null || prospeccoes.Count <= 200) + { + goto IL_0741; + } + } + if (!(await ShowMessage("A SELEÇÃO DE MUITOS EXTRATOS PODE DEMORAR MAIS DE 30 MINUTOS! CONTINUAR?", "SIM", "NÃO"))) + { + Carregando = false; + return; + } + goto IL_0741; + IL_16a4: + if ((int)SegurosVigentesVisibility == 0 && SegurosVigentes) + { + Documentos = Documentos.Where((Documento x) => (x.Vigencia2 > Funcoes.GetNetworkTime().Date.AddDays(-5.0) || !x.Vigencia2.HasValue) && (int)x.Situacao != 7).ToList(); + } + await Gerar(tipoRelatorio, pdf); + Carregando = false; + return; + IL_0741: + TipoExtrato selectedTipoExtrato = SelectedTipoExtrato; + switch ((int)selectedTipoExtrato) + { + case 2: + { + List listaEndossos = new List(); + ApoliceServico apoliceServico = new ApoliceServico(); + long id = ((DomainBase)documentos.First().Controle.Cliente).Id; + FiltroStatusDocumento statusSelecionado = MainViewModel.StatusSelecionado; + Documentos = new List(await apoliceServico.BuscarApolicesAsync(id, statusSelecionado, await VerificaVinculoVendedor(Recursos.Usuario))); + foreach (Documento documento in Documentos) + { + foreach (Documento documento2 in documento.Controle.Documentos) + { + if (documento2.Tipo == 1) + { + listaEndossos.Add(documento2); + documento.TemEndosso = true; + } + } + } + Documentos.AddRange(listaEndossos); + break; + } + case 1: + if ((selecionadosDoc == null || selecionadosDoc.Count == 0) && (selecionadosPros == null || selecionadosPros.Count == 0)) + { + await ShowMessage("É NECESSÁRIO HAVER AO MENOS UM DOCUMENTO SELECIONADO"); + Carregando = false; + return; + } + Documentos = new List(); + Prospeccoes = new List(); + if (selecionadosDoc != null) + { + foreach (long item3 in selecionadosDoc) + { + Documento doc = await new ApoliceServico().BuscarApoliceAsync(item3, itens: false, sinistrosPorControle: true); + List listDoc = ((SomenteEndossos && doc.Ordem != 1) ? new List() : new List { doc }); + if (SomenteEndossos) + { + IEnumerable enumerable = doc.Controle.Documentos.Where((Documento x) => !x.Excluido && x.Ordem != 0 && !listDoc.Any((Documento y) => ((DomainBase)y).Id == ((DomainBase)x).Id)); + foreach (Documento item4 in enumerable) + { + item4.Sinistro = doc.Sinistro; + } + listDoc.AddRange(enumerable); + } + else if (Endossos) + { + IEnumerable enumerable2 = doc.Controle.Documentos.Where((Documento x) => ((DomainBase)x).Id != ((DomainBase)doc).Id && !x.Excluido); + foreach (Documento item5 in enumerable2) + { + item5.Sinistro = doc.Sinistro; + } + listDoc.AddRange(enumerable2); + } + if (doc.Controle.Documentos.Any((Documento x) => ((DomainBase)x).Id != ((DomainBase)doc).Id && !x.Excluido && x.Ordem > doc.Ordem)) + { + doc.TemEndosso = true; + } + if (Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 31) && doc.TemEndosso) + { + doc.PremioTotal = doc.Controle.Documentos.Where((Documento x) => !x.Excluido).Sum((Documento x) => x.PremioTotal); + doc.Iof = doc.Controle.Documentos.Where((Documento x) => !x.Excluido).Sum((Documento x) => x.Iof); + doc.Custo = doc.Controle.Documentos.Where((Documento x) => !x.Excluido).Sum((Documento x) => x.Custo); + doc.PremioLiquido = doc.Controle.Documentos.Where((Documento x) => !x.Excluido).Sum((Documento x) => x.PremioLiquido); + doc.PremioAdicional = doc.Controle.Documentos.Where((Documento x) => !x.Excluido).Sum((Documento x) => x.PremioAdicional); + } + Documentos.AddRange(listDoc.OrderBy((Documento x) => x.Ordem).ToList()); + } + } + if (selecionadosPros != null) + { + foreach (long selecionadosPro in selecionadosPros) + { + Prospeccao item = await new ProspeccaoServico().BuscarProspeccao(selecionadosPro); + Prospeccoes.Add(item); + } + } + if ((int)SelecionarItensVisibility == 0 && SelecionarItens && Documentos != null && Documentos.Count > 0) + { + _itensSelecionados = (await ShowSelecionarItensDialog(((DomainBase)Documentos.First().Controle).Id)).Where((Item x) => x.Selecionado).ToList(); + } + if ((Documentos == null || Documentos.Count == 0) && (Prospeccoes == null || Prospeccoes.Count == 0)) + { + if (!SomenteEndossos) + { + await ShowMessage("É NECESSÁRIO HAVER AO MENOS UM DOCUMENTO OU PROSPECÇÃO SELECIONADO"); + } + else + { + await ShowMessage("É NECESSÁRIO HAVER AO MENOS UM ENDOSSO OU PROSPECÇÃO SELECIONADO"); + } + Carregando = false; + return; + } + break; + case 0: + { + if (selecionadosDoc == null || selecionadosDoc.Count == 0) + { + await ShowMessage("É NECESSÁRIO HAVER AO MENOS UM DOCUMENTO SELECIONADO"); + Carregando = false; + return; + } + List listaCli = new List(); + foreach (Documento documento3 in documentos) + { + Cliente cli = await new ClienteServico().BuscarCliente(((DomainBase)documento3.Controle.Cliente).Id); + Cliente val = cli; + val.Enderecos = await _clienteServico.BuscarEnderecosAsync(((DomainBase)cli).Id); + val = cli; + val.Emails = await _clienteServico.BuscarEmailsAsync(((DomainBase)cli).Id); + val = cli; + val.Telefones = await _clienteServico.BuscarTelefonesAsync(((DomainBase)cli).Id); + val = cli; + val.Contatos = await _clienteServico.BuscarContatosAsync(((DomainBase)cli).Id); + val = cli; + val.Vinculos = await _clienteServico.BuscarVinculosAsync(((DomainBase)cli).Id); + listaCli.Add(cli); + } + Clientes = listaCli; + Prospeccoes = prospeccoes; + break; + } + } + goto IL_16a4; + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Drawer/ImpostoViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Drawer/ImpostoViewModel.cs new file mode 100644 index 0000000..a00c4be --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Drawer/ImpostoViewModel.cs @@ -0,0 +1,314 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Ferramentas; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Drawer; + +public class ImpostoViewModel : BaseViewModel +{ + private bool _carregando; + + private bool _apelido; + + public int Tipo; + + private List _seguradoras; + + private List _ramos; + + private ObservableCollection _impostos = new ObservableCollection(); + + private Imposto _selectedImposto = new Imposto(); + + private Ramo _selectedRamo = new Ramo(); + + private Seguradora _selectedSeguradora = new Seguradora(); + + private ImpostoServico Servico { get; } + + public bool? Ativo { get; set; } = true; + + + public bool Carregando + { + get + { + return _carregando; + } + set + { + _carregando = value; + base.IsEnabled = !value; + OnPropertyChanged("Carregando"); + } + } + + public bool Apelido + { + get + { + return _apelido; + } + set + { + _apelido = value; + OnPropertyChanged("Apelido"); + } + } + + public List Seguradoras + { + get + { + return _seguradoras; + } + set + { + _seguradoras = value; + OnPropertyChanged("Seguradoras"); + } + } + + public List Ramos + { + get + { + return _ramos; + } + set + { + _ramos = value; + OnPropertyChanged("Ramos"); + } + } + + public ObservableCollection Impostos + { + get + { + return _impostos; + } + set + { + _impostos = value; + OnPropertyChanged("Impostos"); + } + } + + public Imposto SelectedImposto + { + get + { + return _selectedImposto; + } + set + { + _selectedImposto = value; + VerificarEnables((value != null) ? new long?(((DomainBase)value).Id) : null); + OnPropertyChanged("SelectedImposto"); + } + } + + public Ramo SelectedRamo + { + get + { + return _selectedRamo; + } + set + { + _selectedRamo = value; + OnPropertyChanged("SelectedRamo"); + } + } + + public Seguradora SelectedSeguradora + { + get + { + return _selectedSeguradora; + } + set + { + _selectedSeguradora = value; + OnPropertyChanged("SelectedSeguradora"); + } + } + + public ImpostoViewModel() + { + //IL_0018: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Expected O, but got Unknown + //IL_0023: Unknown result type (might be due to invalid IL or missing references) + //IL_002d: Expected O, but got Unknown + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_0038: Expected O, but got Unknown + Servico = new ImpostoServico(); + Apelido = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 6); + } + + public async Task Carregar(int tipo, long id) + { + Tipo = tipo; + await PermissaoTela((TipoTela)56); + List list = (from x in Recursos.Seguradoras + where x.Ativo || (tipo == 0 && ((DomainBase)x).Id == id) + orderby (!Apelido) ? x.Nome : x.NomeSocial + select x).ToList(); + list.Insert(0, new Seguradora + { + Nome = "TODAS SEGURADORAS", + NomeSocial = "TODAS SEGURADORAS", + Id = 0L + }); + Seguradoras = list; + SelectedSeguradora = Seguradoras.First(); + List list2 = (from x in Recursos.Ramos + where x.Ativo || (tipo == 1 && ((DomainBase)x).Id == id) + orderby x.Nome + select x).ToList(); + list2.Insert(0, new Ramo + { + Nome = "TODOS OS RAMOS", + Id = 0L + }); + Ramos = list2; + SelectedRamo = Ramos.First(); + string text = ((tipo == 1) ? ("O RAMO \"" + Ramos.First((Ramo x) => ((DomainBase)x).Id == id).Nome + "\"") : ("A SEGURADORA \"" + Seguradoras.First((Seguradora x) => ((DomainBase)x).Id == id).Nome + "\"")); + RegistrarAcao("ACESSOU IMPOSTOS D" + text, id, (TipoTela)56, $"ID: {id}"); + List source = await Servico.Buscar(true); + if (tipo != 1) + { + source = source.Where((Imposto x) => x.Seguradora != null && ((DomainBase)x.Seguradora).Id == id && x.Ramo == null).ToList(); + SelectedSeguradora = Seguradoras.Find((Seguradora x) => ((DomainBase)x).Id == id); + } + else + { + source = source.Where((Imposto x) => x.Ramo != null && ((DomainBase)x.Ramo).Id == id && x.Seguradora == null).ToList(); + SelectedRamo = Ramos.Find((Ramo x) => ((DomainBase)x).Id == id); + } + Impostos = new ObservableCollection(source.OrderByDescending((Imposto x) => x.Ativo)); + SelectedImposto = Impostos.FirstOrDefault(); + } + + public async Task Carregar(long id = 0L) + { + List source = await Servico.Buscar(Ativo); + if (((DomainBase)SelectedSeguradora).Id == 0L) + { + source = source.Where((Imposto x) => x.Seguradora == null).ToList(); + } + if (((DomainBase)SelectedSeguradora).Id > 0) + { + source = source.Where((Imposto x) => x.Seguradora != null && ((DomainBase)x.Seguradora).Id == ((DomainBase)SelectedSeguradora).Id).ToList(); + } + if (((DomainBase)SelectedRamo).Id == 0L) + { + source = source.Where((Imposto x) => x.Ramo == null).ToList(); + } + if (((DomainBase)SelectedRamo).Id > 0) + { + source = source.Where((Imposto x) => x.Ramo != null && ((DomainBase)x.Ramo).Id == ((DomainBase)SelectedRamo).Id).ToList(); + } + Impostos = new ObservableCollection(source.Where((Imposto x) => !Ativo.HasValue || x.Ativo == Ativo.Value).ToList()); + SelectedImposto = ((id == 0L) ? Impostos.FirstOrDefault() : ((IEnumerable)Impostos).FirstOrDefault((Func)((Imposto x) => ((DomainBase)x).Id == id))); + } + + public void Incluir() + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_0042: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Expected O, but got Unknown + SelectedImposto = new Imposto + { + Seguradora = ((((DomainBase)SelectedSeguradora).Id > 0) ? SelectedSeguradora : null), + Ramo = ((((DomainBase)SelectedRamo).Id > 0) ? SelectedRamo : null), + Ativo = true + }; + Alterar(alterar: true); + } + + public void AlterarImposto() + { + Alterar(alterar: true); + } + + public async Task Cancelar() + { + Imposto selectedImposto = SelectedImposto; + long id = ((selectedImposto != null) ? ((DomainBase)selectedImposto).Id : 0); + Alterar(alterar: false); + await Carregar(id); + } + + public async Task>> Salvar() + { + List> list = SelectedImposto.Validate(); + list.AddRange(Validate(SelectedImposto)); + if (list.Count > 0) + { + return list; + } + string acao = ((((DomainBase)SelectedImposto).Id == 0L) ? "INCLUIU" : "ALTEROU"); + Imposto val = await Servico.Salvar(SelectedImposto); + if (!Servico.Sucesso) + { + return new List> + { + new KeyValuePair("GRAVAR", "HOUVE UM ERRO AO SALVAR O IMPOSTO SELECIONADO.") + }; + } + string text = ((val.Seguradora == null) ? "TODAS AS SEGURADORAS" : (" SEGURADORA " + val.Seguradora.Nome)); + string text2 = ((val.Ramo == null) ? "TODOS OS RAMOS" : (" RAMO " + val.Ramo.Nome)); + string text3 = " " + text + " E " + text2; + RegistrarAcao(acao + " IMPOSTO PARA " + text3, ((DomainBase)val).Id, (TipoTela)31, string.Format("ID: {0}{1}{2}\nSTATUS: {3}\nIR: {4:p2}\nISS: {5:p2}\nOUTROS: {6:p2}\nDESCONTO: {7:p2}", ((DomainBase)val).Id, text, text2, val.Ativo ? "ATIVO" : "INATIVO", val.Ir, val.Iss, val.Outros, val.Desconto)); + Alterar(alterar: false); + await Carregar(((DomainBase)val).Id); + return null; + } + + public List> Validate(Imposto imposto) + { + List> list = new List>(); + if (imposto == null) + { + return list; + } + if (imposto.Ativo && Impostos.Any(delegate(Imposto x) + { + if (((DomainBase)x).Id != ((DomainBase)imposto).Id) + { + Seguradora seguradora = x.Seguradora; + long? num = ((seguradora != null) ? new long?(((DomainBase)seguradora).Id) : null); + Seguradora seguradora2 = imposto.Seguradora; + if (num == ((seguradora2 != null) ? new long?(((DomainBase)seguradora2).Id) : null)) + { + Ramo ramo = x.Ramo; + long? num2 = ((ramo != null) ? new long?(((DomainBase)ramo).Id) : null); + Ramo ramo2 = imposto.Ramo; + if (num2 == ((ramo2 != null) ? new long?(((DomainBase)ramo2).Id) : null)) + { + return x.Ativo; + } + } + } + return false; + })) + { + list.Add(new KeyValuePair("IMPOSTO DUPLICADO", "NÃO É POSSIVEL INSERIR UM NOVO PARAMETRO DE IMPOSTO, POIS JÁ EXISTEM PARAMETROS PARA A MESMA SEGURADORA E RAMO")); + } + return list.Distinct().ToList(); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Drawer/InfoViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Drawer/InfoViewModel.cs new file mode 100644 index 0000000..20fb507 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Drawer/InfoViewModel.cs @@ -0,0 +1,175 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Windows; +using Gestor.Application.Servicos; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.Servicos.Seguros.Itens; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Drawer; + +public class InfoViewModel : BaseViewModel +{ + private ObservableCollection _contatos = new ObservableCollection(); + + private ObservableCollection _itens = new ObservableCollection(); + + private ObservableCollection _parcelas = new ObservableCollection(); + + private Documento _documento; + + private Visibility _ocultarInfos; + + private bool _carregando; + + public ObservableCollection Contatos + { + get + { + return _contatos; + } + set + { + _contatos = value; + OnPropertyChanged("Contatos"); + } + } + + public ObservableCollection Itens + { + get + { + return _itens; + } + set + { + _itens = value; + OnPropertyChanged("Itens"); + } + } + + public ObservableCollection Parcelas + { + get + { + return _parcelas; + } + set + { + _parcelas = value; + OnPropertyChanged("Parcelas"); + } + } + + public Documento Documento + { + get + { + return _documento; + } + set + { + _documento = value; + OnPropertyChanged("Documento"); + } + } + + public Visibility OcultarInfos + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _ocultarInfos; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _ocultarInfos = value; + OnPropertyChanged("OcultarInfos"); + } + } + + public bool Carregando + { + get + { + return _carregando; + } + set + { + _carregando = value; + base.IsEnabled = !value; + base.EnableMenu = !value; + OnPropertyChanged("Carregando"); + } + } + + public InfoViewModel(Documento documento, bool ocultarInfos) + { + Documento = documento; + OcultarInfos = (Visibility)(ocultarInfos ? 2 : 0); + Seleciona(); + } + + public async void Seleciona() + { + Carregando = true; + if (Documento != null) + { + Documento = await new ApoliceServico().BuscarApoliceAsync(((DomainBase)Documento).Id); + } + if ((int)OcultarInfos == 0 && Documento != null) + { + ObservableCollection observableCollection = await new ParcelaServico().BuscarParcelasAsync(((DomainBase)Documento).Id); + Parcelas = (((int)Documento.TipoRecebimento.GetValueOrDefault() == 2) ? new ObservableCollection(observableCollection.OrderByDescending((Parcela x) => x.VigenciaIncial)) : observableCollection); + } + Documento documento = Documento; + if (((documento != null) ? documento.Controle : null) != null) + { + Itens = await new ItemServico().BuscarItens(((DomainBase)Documento.Controle).Id, (StatusItem)0); + List contatos = new List(); + ClienteServico servico = new ClienteServico(); + if (Documento.Controle.Cliente != null) + { + ObservableCollection telefones = await servico.BuscarTelefonesAsync(((DomainBase)Documento.Controle.Cliente).Id); + ObservableCollection observableCollection2 = await servico.BuscarEmailsAsync(((DomainBase)Documento.Controle.Cliente).Id); + if (telefones != null) + { + contatos.AddRange(((IEnumerable)telefones).Select((Func)((ClienteTelefone x) => new Contato + { + Tipo = (TipoContato)0, + TipoTelefone = ((TelefoneBase)x).Tipo.GetValueOrDefault((TipoTelefone)1), + Numero = ((TelefoneBase)x).Prefixo + " " + ((TelefoneBase)x).Numero + })).Take(2).ToList()); + } + if (observableCollection2 != null) + { + contatos.AddRange(((IEnumerable)observableCollection2).Select((Func)((ClienteEmail x) => new Contato + { + Tipo = (TipoContato)1, + TipoTelefone = null, + Numero = ((EmailBase)x).Email + })).Take(1).ToList()); + } + } + Contatos = new ObservableCollection(contatos); + } + Carregando = false; + } + + public string GerarObs(Documento doc) + { + if (doc.Tipo != 0) + { + return $"CLIENTE: {doc.Controle.Cliente.Nome}{Environment.NewLine}CÓDIGO: {((DomainBase)doc).Id}{Environment.NewLine}PROPOSTA: {doc.Proposta}{Environment.NewLine}APÓLICE: {doc.Apolice}{Environment.NewLine}PROPOSTA DE ENDOSSO: {doc.PropostaEndosso}{Environment.NewLine}ENDOSSO: {doc.Endosso}"; + } + return $"CLIENTE: {doc.Controle.Cliente.Nome}{Environment.NewLine}CÓDIGO: {((DomainBase)doc).Id}{Environment.NewLine}PROPOSTA: {doc.Proposta}{Environment.NewLine}APÓLICE: {doc.Apolice}"; + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Drawer/LogAcaoViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Drawer/LogAcaoViewModel.cs new file mode 100644 index 0000000..b69bec0 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Drawer/LogAcaoViewModel.cs @@ -0,0 +1,97 @@ +using System; +using System.Linq; +using Gestor.Application.Helpers; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Relatorios; +using Gestor.Model.Domain.Seguros; +using Newtonsoft.Json; + +namespace Gestor.Application.ViewModels.Drawer; + +public class LogAcaoViewModel : BaseViewModel +{ + private RegistroAcao _log; + + private string _obs; + + private Relatorio Relatorio { get; set; } + + public RegistroAcao Log + { + get + { + return _log; + } + set + { + _log = value; + OnPropertyChanged("Log"); + } + } + + public string Obs + { + get + { + return _obs; + } + set + { + _obs = value; + OnPropertyChanged("Obs"); + } + } + + public LogAcaoViewModel(RegistroAcao registro, Relatorio relatorio) + { + //IL_0007: Unknown result type (might be due to invalid IL or missing references) + Relatorio = relatorio; + CarregarLog(registro); + } + + private void CarregarLog(RegistroAcao registro) + { + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_002b: Invalid comparison between Unknown and I4 + if (!registro.Tela.HasValue && !string.IsNullOrEmpty(registro.Observacao) && (int)Relatorio != 25) + { + Log = registro; + Filtros filtros = JsonConvert.DeserializeObject(registro.Observacao); + string text = ((filtros.Seguradoras == null || filtros.Seguradoras.Count == 0) ? "" : ("SEGURADORAS FILTRADAS: " + Environment.NewLine + string.Join(Environment.NewLine, from x in Recursos.Seguradoras + where filtros.Seguradoras.Contains(((DomainBase)x).Id) + select x.NomeSocial) + Environment.NewLine + Environment.NewLine)); + string text2 = ((filtros.Status == null || filtros.Status.Count == 0) ? "" : ("STATUS FILTRADOS: " + Environment.NewLine + string.Join(Environment.NewLine, filtros.Status.Select((long x) => (TipoSeguro)x)) + Environment.NewLine + Environment.NewLine)); + string text3 = ((filtros.Ramos == null || filtros.Ramos.Count == 0) ? "" : ("RAMOS FILTRADOS: " + Environment.NewLine + string.Join(Environment.NewLine, from x in Recursos.Ramos + where filtros.Ramos.Contains(((DomainBase)x).Id) + select x.Nome) + Environment.NewLine + Environment.NewLine)); + string text4 = ((filtros.Vendedores == null || filtros.Vendedores.Count == 0) ? "" : ("VENDEDORES FILTRADOS: " + Environment.NewLine + string.Join(Environment.NewLine, from x in Recursos.Vendedores + where filtros.Vendedores.Contains(((DomainBase)x).Id) + select x.Nome) + Environment.NewLine + Environment.NewLine)); + string text5 = ((filtros.Estipulantes == null || filtros.Estipulantes.Count == 0) ? "" : ("ESTIPULANTES FILTRADOS: " + Environment.NewLine + string.Join(Environment.NewLine, from x in Recursos.Estipulantes + where filtros.Estipulantes.Contains(((DomainBase)x).Id) + select x.Nome) + Environment.NewLine + Environment.NewLine)); + string text6 = ((filtros.Produtos == null || filtros.Produtos.Count == 0) ? "" : ("PRODUTOS FILTRADOS: " + Environment.NewLine + string.Join(Environment.NewLine, from x in Recursos.Produtos + where filtros.Produtos.Contains(((DomainBase)x).Id) + select x.Nome) + Environment.NewLine + Environment.NewLine)); + string text7 = ((filtros.Negocio == null || filtros.Negocio.Count == 0) ? "" : ("TIPOS DE NEGÓCIOS FILTRADOS: " + Environment.NewLine + string.Join(Environment.NewLine, filtros.Negocio.Select((long x) => (NegocioCorretora)x)) + Environment.NewLine + Environment.NewLine)); + string text8 = ((filtros.Usuarios == null || filtros.Usuarios.Count == 0) ? "" : ("USUÁRIOS FILTRADOS: " + Environment.NewLine + string.Join(Environment.NewLine, from x in Recursos.Usuarios + where filtros.Usuarios.Contains(((DomainBase)x).Id) + select x.Nome) + Environment.NewLine + Environment.NewLine)); + string text9 = ((filtros.Telas == null || filtros.Telas.Count == 0) ? "" : ("TELAS FILTRADAS: " + Environment.NewLine + string.Join(Environment.NewLine, filtros.Telas.Select((long x) => (TipoTela)x)) + Environment.NewLine + Environment.NewLine)); + string text10 = ((filtros.Relatorios == null || filtros.Relatorios.Count == 0) ? "" : ("RELATÓRIOS FILTRADOS: " + Environment.NewLine + string.Join(Environment.NewLine, filtros.Relatorios.Select((long x) => (Relatorio)x)) + Environment.NewLine + Environment.NewLine)); + string text11 = ((filtros.ParcelasEspeciais == null || !filtros.ParcelasEspeciais.Any((FiltroTipoParcela x) => x.Selecionado)) ? "" : ("TIPOS DE PARCELAS FILTRADOS: " + Environment.NewLine + string.Join(Environment.NewLine, filtros.ParcelasEspeciais.Select((FiltroTipoParcela x) => x.Tipo)) + Environment.NewLine + Environment.NewLine)); + string text12 = ((filtros.IdEmpresa == 0L) ? "" : ("EMPRESA: " + Environment.NewLine + Recursos.Empresas.Find((Empresa x) => ((DomainBase)x).Id == filtros.IdEmpresa).Nome + Environment.NewLine + Environment.NewLine)); + _ = $"PERÍODO DE {filtros.Inicio:d} ATÉ {filtros.Fim:d}"; + Obs = ValidationHelper.GetDescription((Enum)(object)registro.Relatorio) + Environment.NewLine + Environment.NewLine + text12 + text + text3 + text6 + text4 + text5 + text2 + text7 + text11 + text8 + text9 + text10; + } + else + { + Log = registro; + Obs = registro.Observacao; + } + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Drawer/LogEmailViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Drawer/LogEmailViewModel.cs new file mode 100644 index 0000000..5086554 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Drawer/LogEmailViewModel.cs @@ -0,0 +1,161 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Text; +using System.Windows; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Drawer; + +public class LogEmailViewModel : BaseSegurosViewModel +{ + private readonly LogServico _servico; + + private Visibility _visibilityDetalhesLog = (Visibility)1; + + private bool _mostrarMensagem; + + private ObservableCollection _logs = new ObservableCollection(); + + private LogEmail _selectedLog; + + private List _lists = new List(); + + public Visibility VisiblityDetalhesLog + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityDetalhesLog; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityDetalhesLog = value; + OnPropertyChanged("VisiblityDetalhesLog"); + } + } + + public bool MostrarMensagem + { + get + { + return _mostrarMensagem; + } + set + { + _mostrarMensagem = value; + OnPropertyChanged("MostrarMensagem"); + } + } + + public ObservableCollection Logs + { + get + { + return _logs; + } + set + { + _logs = value; + OnPropertyChanged("Logs"); + } + } + + public LogEmail SelectedLog + { + get + { + return _selectedLog; + } + set + { + _selectedLog = value; + List lists = SelectedLog.CriarLogEmail(); + Lists = lists; + OnPropertyChanged("SelectedLog"); + } + } + + public List Lists + { + get + { + return _lists; + } + set + { + _lists = value; + OnPropertyChanged("Lists"); + } + } + + public LogEmailViewModel(TipoTela tela, long id, bool singleMode) + { + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + //IL_0064: Unknown result type (might be due to invalid IL or missing references) + _servico = new LogServico(); + VisiblityDetalhesLog = (Visibility)(!Recursos.Configuracoes.Any((ConfiguracaoSistema c) => (int)c.Configuracao == 55)); + Seleciona(tela, id, singleMode); + } + + private async void Seleciona(TipoTela tela, long id, bool singleMode) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + Loading(isLoading: true); + if (singleMode) + { + Logs = await _servico.FindById(id); + } + else + { + Logs = await _servico.FindByEntity(tela, id); + } + if (Logs.Count > 0) + { + SelectedLog = Logs[0]; + } + else + { + MostrarMensagem = true; + } + Loading(isLoading: false); + } + + public void Imprimir() + { + string text = "LOGS
LOG ENVIO DE E-MAIL"; + foreach (TupleList list in Lists) + { + foreach (Tuple tuple in list.Tuples) + { + if (tuple == list.Tuples.First()) + { + text += ""; + text += "
DESCRIÇÃOE-MAIL ENVIADO
"; + } + bool flag = tuple.Item1.Contains("$"); + text = text + ""; + text += "
" + tuple.Item1.Replace(" ", " ").Replace("$", "") + "" + tuple.Item2 + "
"; + } + } + text += "
"; + string tempPath = Path.GetTempPath(); + string text2 = $"{tempPath}{(object)(TipoExtrato)0}_{Funcoes.GetNetworkTime():ddMMyyyyhhmmss}.html"; + StreamWriter streamWriter = new StreamWriter(text2, append: true, Encoding.UTF8); + streamWriter.Write(text); + streamWriter.Close(); + Process.Start(text2); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Drawer/LogSistemaAntigoViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Drawer/LogSistemaAntigoViewModel.cs new file mode 100644 index 0000000..3e52eea --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Drawer/LogSistemaAntigoViewModel.cs @@ -0,0 +1,36 @@ +using Gestor.Application.ViewModels.Generic; + +namespace Gestor.Application.ViewModels.Drawer; + +public class LogSistemaAntigoViewModel : BaseViewModel +{ + private string _descricao; + + private string _log; + + public string Descricao + { + get + { + return _descricao; + } + set + { + _descricao = value; + OnPropertyChanged("Descricao"); + } + } + + public string Log + { + get + { + return _log; + } + set + { + _log = value; + OnPropertyChanged("Log"); + } + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Drawer/LogViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Drawer/LogViewModel.cs new file mode 100644 index 0000000..bc49853 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Drawer/LogViewModel.cs @@ -0,0 +1,1458 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +using System.Windows; +using ControlzEx; +using CsQuery.ExtensionMethods.Internal; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Financeiro; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.Validation; +using MaterialDesignThemes.Wpf; +using Newtonsoft.Json; + +namespace Gestor.Application.ViewModels.Drawer; + +public class LogViewModel : BaseSegurosViewModel +{ + private readonly LogServico _servico; + + private readonly TipoTela _tipoTela; + + private readonly long _id; + + private Visibility _visibilityDetalhesLog = (Visibility)1; + + private bool _mostrar; + + private bool _mostrarMensagem; + + private string _mostrarToolTip = "MOSTRAR TODAS OS CAMPOS"; + + private long _mostrarColuna = 120L; + + private PackIcon _mostrarIcone; + + private ObservableCollection _logs; + + private string _currentDescription; + + private RegistroLog _selectedLog; + + private List _lists; + + private ObservableCollection _listsAlterados; + + private ObservableCollection _listsAdicionados; + + private ObservableCollection _listsRemovidos; + + private string _textAdicoes; + + public Visibility VisiblityDetalhesLog + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityDetalhesLog; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityDetalhesLog = value; + OnPropertyChanged("VisiblityDetalhesLog"); + } + } + + public bool Mostrar + { + get + { + return _mostrar; + } + set + { + //IL_0051: Unknown result type (might be due to invalid IL or missing references) + //IL_0056: Unknown result type (might be due to invalid IL or missing references) + //IL_0061: Expected O, but got Unknown + //IL_0066: Expected O, but got Unknown + //IL_0022: Unknown result type (might be due to invalid IL or missing references) + //IL_0027: Unknown result type (might be due to invalid IL or missing references) + //IL_0032: Expected O, but got Unknown + //IL_0037: Expected O, but got Unknown + _mostrar = value; + if (value) + { + MostrarColuna = 240L; + MostrarToolTip = "ESCONDER CAMPOS INALTERADOS"; + PackIcon val = new PackIcon(); + ((PackIconBase)val).Kind = (PackIconKind)1492; + MostrarIcone = val; + } + else + { + MostrarColuna = 240L; + MostrarToolTip = "MOSTRAR TODOS OS CAMPOS"; + PackIcon val2 = new PackIcon(); + ((PackIconBase)val2).Kind = (PackIconKind)1497; + MostrarIcone = val2; + } + OnPropertyChanged("Mostrar"); + } + } + + public bool MostrarMensagem + { + get + { + return _mostrarMensagem; + } + set + { + _mostrarMensagem = value; + OnPropertyChanged("MostrarMensagem"); + } + } + + public string MostrarToolTip + { + get + { + return _mostrarToolTip; + } + set + { + _mostrarToolTip = value; + OnPropertyChanged("MostrarToolTip"); + } + } + + public long MostrarColuna + { + get + { + return _mostrarColuna; + } + set + { + _mostrarColuna = value; + OnPropertyChanged("MostrarColuna"); + } + } + + public PackIcon MostrarIcone + { + get + { + return _mostrarIcone; + } + set + { + _mostrarIcone = value; + OnPropertyChanged("MostrarIcone"); + } + } + + public ObservableCollection Logs + { + get + { + return _logs; + } + set + { + _logs = value; + OnPropertyChanged("Logs"); + } + } + + public string CurrentDescription + { + get + { + return _currentDescription; + } + set + { + _currentDescription = value; + OnPropertyChanged("CurrentDescription"); + } + } + + public RegistroLog SelectedLog + { + get + { + return _selectedLog; + } + set + { + //IL_01d7: Unknown result type (might be due to invalid IL or missing references) + //IL_0081: Unknown result type (might be due to invalid IL or missing references) + //IL_0086: Unknown result type (might be due to invalid IL or missing references) + //IL_0088: Unknown result type (might be due to invalid IL or missing references) + //IL_008b: Unknown result type (might be due to invalid IL or missing references) + //IL_0171: Expected I4, but got Unknown + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Unknown result type (might be due to invalid IL or missing references) + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Expected I4, but got Unknown + //IL_090b: Unknown result type (might be due to invalid IL or missing references) + //IL_08b5: Unknown result type (might be due to invalid IL or missing references) + //IL_08ba: Unknown result type (might be due to invalid IL or missing references) + //IL_08c6: Expected O, but got Unknown + //IL_0733: Unknown result type (might be due to invalid IL or missing references) + //IL_0738: Unknown result type (might be due to invalid IL or missing references) + //IL_0744: Expected O, but got Unknown + _selectedLog = value; + List list = new List(); + try + { + if (value.ModeloNovo) + { + TipoAcao acao = value.Acao; + switch ((int)acao) + { + case 0: + case 2: + list = JsonConvert.DeserializeObject>(SelectedLog.Descricao).LogList(Restricao((TipoRestricao)14)); + break; + case 1: + list = JsonConvert.DeserializeObject>(SelectedLog.Descricao).LogList(Restricao((TipoRestricao)14)); + break; + } + } + else + { + TipoTela tipoTela = _tipoTela; + switch (tipoTela - 1) + { + case 1: + list = JsonConvert.DeserializeObject(SelectedLog.Descricao).Log(Restricao((TipoRestricao)14)); + break; + case 4: + try + { + list = JsonConvert.DeserializeObject(SelectedLog.Descricao).Log(Restricao((TipoRestricao)14), Restricao((TipoRestricao)95)); + } + catch + { + list = DefaultLog(SelectedLog.Descricao, SelectedLog.Acao); + } + break; + case 36: + list = JsonConvert.DeserializeObject(SelectedLog.Descricao).Log(Restricao((TipoRestricao)14), Restricao((TipoRestricao)95)); + break; + case 0: + list = JsonConvert.DeserializeObject(SelectedLog.Descricao).Log(); + break; + case 2: + { + Item val = JsonConvert.DeserializeObject(SelectedLog.Descricao); + if (val.Aeronautico != null) + { + list = Aeronautico.Log(val); + } + else if (val.Auto != null) + { + list = Auto.Log(val); + } + else if (val.Granizo != null) + { + list = Granizo.Log(val); + } + else if (val.Patrimonial != null) + { + list = Patrimonial.Log(val); + } + else if (val.RiscosDiversos != null) + { + list = RiscosDiversos.Log(val); + } + else if (val.Vida != null) + { + list = Vida.Log(val); + } + break; + } + case 12: + list = JsonConvert.DeserializeObject(SelectedLog.Descricao).Log(); + break; + case 11: + { + Ramo ramo = JsonConvert.DeserializeObject(SelectedLog.Descricao); + List list5 = (from x in Recursos.Coberturas + where x.IdRamo == ((DomainBase)ramo).Id + orderby x.Padrao descending, x.Descricao + select x).ToList(); + list = JsonConvert.DeserializeObject(SelectedLog.Descricao).Log(list5); + break; + } + case 9: + list = JsonConvert.DeserializeObject(SelectedLog.Descricao).Log(); + break; + case 8: + list = JsonConvert.DeserializeObject(SelectedLog.Descricao).Log(); + break; + case 14: + list = JsonConvert.DeserializeObject(SelectedLog.Descricao).Log(); + break; + case 13: + list = JsonConvert.DeserializeObject(SelectedLog.Descricao).Log(); + break; + case 15: + list = JsonConvert.DeserializeObject(SelectedLog.Descricao).Log(); + break; + case 16: + list = JsonConvert.DeserializeObject(SelectedLog.Descricao).Log(); + break; + case 17: + list = JsonConvert.DeserializeObject(SelectedLog.Descricao).Log(); + break; + case 21: + list = JsonConvert.DeserializeObject(SelectedLog.Descricao).Log(); + break; + case 23: + list = JsonConvert.DeserializeObject(SelectedLog.Descricao).Log(); + break; + case 25: + list = JsonConvert.DeserializeObject(SelectedLog.Descricao).Log(); + break; + case 27: + list = JsonConvert.DeserializeObject(SelectedLog.Descricao).Log(); + break; + case 28: + list = JsonConvert.DeserializeObject(SelectedLog.Descricao).Log(); + break; + case 3: + list = JsonConvert.DeserializeObject(SelectedLog.Descricao).Log(); + break; + case 32: + list = JsonConvert.DeserializeObject(SelectedLog.Descricao).Log(); + break; + case 37: + list = JsonConvert.DeserializeObject(SelectedLog.Descricao).Log(); + break; + case 33: + list = JsonConvert.DeserializeObject(SelectedLog.Descricao).Log(); + break; + case 18: + list = JsonConvert.DeserializeObject(SelectedLog.Descricao).Log(); + break; + case 40: + list = JsonConvert.DeserializeObject(SelectedLog.Descricao).Log(); + break; + case 41: + list = JsonConvert.DeserializeObject(SelectedLog.Descricao).Log(); + break; + case 35: + list = JsonConvert.DeserializeObject(SelectedLog.Descricao).Log(); + break; + case 29: + list = JsonConvert.DeserializeObject(SelectedLog.Descricao).Log(); + break; + case 10: + list = JsonConvert.DeserializeObject(SelectedLog.Descricao).Log(); + break; + case 30: + list = JsonConvert.DeserializeObject(SelectedLog.Descricao).Log(); + break; + case 45: + list = JsonConvert.DeserializeObject(SelectedLog.Descricao).Log(); + break; + case 6: + list = JsonConvert.DeserializeObject(SelectedLog.Descricao).Log(); + break; + case 42: + { + List>>>>> list4 = JsonConvert.DeserializeObject>>>>>>(SelectedLog.Descricao); + List list3 = new List(); + foreach (Tuple>>>> item in list4) + { + ObservableCollection> observableCollection = new ObservableCollection> + { + new Tuple(item.Item1 + "$", "", "") + }; + foreach (Tuple>> item2 in item.Item2) + { + observableCollection.Add(new Tuple(" " + item2.Item1 + "$", "", "")); + foreach (Tuple item3 in item2.Item2) + { + observableCollection.Add(new Tuple(" " + item3.Item1, item3.Item2, "")); + } + } + list3.Add(new TupleList + { + Tuples = observableCollection + }); + } + foreach (TupleList item4 in list3) + { + list.Add(item4); + } + break; + } + case 47: + list = JsonConvert.DeserializeObject(SelectedLog.Descricao).Log(); + break; + case 51: + list = JsonConvert.DeserializeObject(SelectedLog.Descricao).Log(); + break; + case 53: + list = JsonConvert.DeserializeObject(SelectedLog.Descricao).Log(); + break; + case 54: + list = JsonConvert.DeserializeObject(SelectedLog.Descricao).Log(); + break; + case 55: + list = JsonConvert.DeserializeObject(SelectedLog.Descricao).Log(); + break; + case 44: + { + List list2 = JsonConvert.DeserializeObject>(SelectedLog.Descricao); + List list3 = new List(); + ObservableCollection> observableCollection = new ObservableCollection> + { + new Tuple("VENDEDORES VINCULADOS$", "", "") + }; + foreach (Vendedor item5 in list2) + { + observableCollection.Add(new Tuple($" VENDEDOR {list2.IndexOf(item5) + 1}", item5.Nome, "")); + } + list3.Add(new TupleList + { + Tuples = observableCollection + }); + foreach (TupleList item6 in list3) + { + list.Add(item6); + } + break; + } + default: + list = DefaultLog(SelectedLog.Descricao, SelectedLog.Acao); + break; + } + } + } + catch (Exception) + { + } + Lists = list; + OnPropertyChanged("SelectedLog"); + } + } + + public List Lists + { + get + { + return _lists; + } + set + { + _lists = value; + SetListaFiltrada(value); + OnPropertyChanged("Lists"); + } + } + + public ObservableCollection ListsAlterados + { + get + { + return _listsAlterados; + } + set + { + _listsAlterados = value; + OnPropertyChanged("ListsAlterados"); + } + } + + public ObservableCollection ListsAdicionados + { + get + { + return _listsAdicionados; + } + set + { + _listsAdicionados = value; + OnPropertyChanged("ListsAdicionados"); + } + } + + public ObservableCollection ListsRemovidos + { + get + { + return _listsRemovidos; + } + set + { + _listsRemovidos = value; + if (ListsAlterados == null && ListsAdicionados == null && value == null) + { + MostrarMensagem = true; + } + else + { + MostrarMensagem = false; + } + OnPropertyChanged("ListsRemovidos"); + } + } + + public string TextAdicoes + { + get + { + return _textAdicoes; + } + set + { + _textAdicoes = value; + OnPropertyChanged("TextAdicoes"); + } + } + + public LogViewModel(TipoTela tela, long id, List parcelas = null, int numparcela = 0) + { + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0021: Unknown result type (might be due to invalid IL or missing references) + //IL_002c: Expected O, but got Unknown + //IL_0031: Expected O, but got Unknown + //IL_0090: Unknown result type (might be due to invalid IL or missing references) + //IL_0091: Unknown result type (might be due to invalid IL or missing references) + //IL_00e8: Unknown result type (might be due to invalid IL or missing references) + PackIcon val = new PackIcon(); + ((PackIconBase)val).Kind = (PackIconKind)1497; + _mostrarIcone = val; + _logs = new ObservableCollection(); + _currentDescription = ""; + _lists = new List(); + _listsAlterados = new ObservableCollection(); + _listsAdicionados = new ObservableCollection(); + _listsRemovidos = new ObservableCollection(); + _textAdicoes = "INCLUSÃO"; + base._002Ector(); + _servico = new LogServico(); + _tipoTela = tela; + _id = id; + VisiblityDetalhesLog = (Visibility)(!Recursos.Configuracoes.Any((ConfiguracaoSistema c) => (int)c.Configuracao == 55)); + base.EnableMenu = true; + if (parcelas != null) + { + LogParcelas(id, parcelas, numparcela); + } + else + { + Seleciona(tela, id); + } + } + + private static List DefaultLog(string log, TipoAcao acao) + { + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Unknown result type (might be due to invalid IL or missing references) + //IL_0037: Expected O, but got Unknown + return new List + { + new TupleList + { + Tuples = new ObservableCollection> + { + new Tuple(Funcoes.GetDescription((Enum)(object)acao), log, "") + } + } + }; + } + + public int BuscaNumeroParcela(string json) + { + try + { + if (!int.TryParse(json.Split(new char[1] { '}' }).FirstOrDefault((string x) => x.Contains("NumeroParcela")).Split(new char[1] { ':' })[^1].Replace("\"", ""), out var result)) + { + return 0; + } + return result; + } + catch + { + return 0; + } + } + + private async void LogParcelas(long documento, List parcelas, int numparcela) + { + Loading(isLoading: true); + List list = new List(); + list.AddRange(parcelas); + list.Add(documento); + Logs = new ObservableCollection(await _servico.BuscaLogParcelas(list)); + ObservableCollection observableCollection = new ObservableCollection(); + List list2 = Logs.Where((RegistroLog x) => !x.ModeloNovo && x.EntidadeId == documento).ToList(); + for (int num = list2.Count - 1; num >= 0; num--) + { + ObservableCollection observableCollection2 = new ObservableCollection(); + try + { + int num2 = num; + while (num2 >= 0 && list2[num2].DataHora < list2[num].DataHora.AddSeconds(4.0)) + { + Parcela val = JsonConvert.DeserializeObject(Logs[num2].Descricao); + if (val != null && (numparcela == 0 || BuscaNumeroParcela(Logs[num2].Descricao) == numparcela)) + { + observableCollection2.Add(val); + } + num = num2; + num2--; + } + } + catch (Exception) + { + try + { + List list3 = JsonConvert.DeserializeObject>(Logs[num].Descricao); + if (list3 != null && (numparcela == 0 || BuscaNumeroParcela(Logs[num].Descricao) == numparcela)) + { + ExtensionMethods.AddRange((ICollection)observableCollection2, (IEnumerable)list3); + } + goto end_IL_01b0; + } + catch (Exception) + { + Logs[num].Descricao = Logs[num].Descricao ?? ""; + observableCollection.Insert(0, Logs[num]); + } + continue; + end_IL_01b0:; + } + observableCollection2 = new ObservableCollection(observableCollection2.OrderBy((Parcela x) => x.NumeroParcela)); + if (observableCollection2 != null && observableCollection2.Count != 0 && observableCollection2[0].Documento != null) + { + list2[num].Descricao = JsonConvert.SerializeObject((object)new Parcelas + { + ParcelasList = observableCollection2, + TipoRecebimento = observableCollection2[0].Documento.TipoRecebimento + }, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }); + observableCollection.Insert(0, list2[num]); + } + } + List list4 = new List(); + List list5 = Logs.Where((RegistroLog x) => x.ModeloNovo).ToList(); + if (numparcela == 0) + { + list4.AddRange(list5); + } + else + { + foreach (RegistroLog item in list5) + { + int num3 = BuscaNumeroParcela(item.Descricao); + if ((num3 != 0 && num3 == numparcela) || (numparcela != 0 && parcelas.Count == 1 && item.EntidadeId != documento)) + { + list4.Add(item); + } + } + } + Logs = observableCollection; + ExtensionMethods.AddRange((ICollection)Logs, (IEnumerable)list4); + if (Logs.Count > 0) + { + SelectedLog = Logs[0]; + } + else + { + SetListaFiltrada(Lists); + } + Loading(isLoading: false); + } + + private async void Seleciona(TipoTela tela, long id, List parcelas = null, long? parcela = null) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + Loading(isLoading: true); + Logs = new ObservableCollection(await _servico.FindByEntityId(tela, id)); + if ((int)tela == 37) + { + ObservableCollection observableCollection = new ObservableCollection(); + List list = Logs.Where((RegistroLog x) => !x.ModeloNovo).ToList(); + for (int num = list.Count - 1; num >= 0; num--) + { + ObservableCollection observableCollection2 = new ObservableCollection(); + int num2 = num; + while (num2 >= 0 && list[num2].DataHora < list[num].DataHora.AddSeconds(4.0)) + { + observableCollection2.Add(JsonConvert.DeserializeObject(list[num2].Descricao)); + num = num2; + num2--; + } + observableCollection2 = new ObservableCollection(observableCollection2.OrderBy((VendedorParcela x) => ((DomainBase)x).Id)); + list[num].Descricao = JsonConvert.SerializeObject((object)new VendedorParcelas + { + VendedorParcelasList = observableCollection2 + }, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }); + observableCollection.Insert(0, list[num]); + } + List list2 = Logs.Where((RegistroLog x) => x.ModeloNovo).ToList(); + Logs = observableCollection; + ExtensionMethods.AddRange((ICollection)Logs, (IEnumerable)list2); + } + if (Logs.Count > 0) + { + SelectedLog = Logs[0]; + } + else + { + SetListaFiltrada(Lists); + } + Loading(isLoading: false); + } + + public void SetListaFiltrada(List listAtual) + { + //IL_0036: Unknown result type (might be due to invalid IL or missing references) + //IL_003c: Invalid comparison between Unknown and I4 + //IL_0083: Unknown result type (might be due to invalid IL or missing references) + //IL_00ca: Unknown result type (might be due to invalid IL or missing references) + //IL_00d0: Invalid comparison between Unknown and I4 + //IL_0173: Unknown result type (might be due to invalid IL or missing references) + //IL_0178: Unknown result type (might be due to invalid IL or missing references) + //IL_017a: Unknown result type (might be due to invalid IL or missing references) + //IL_017d: Unknown result type (might be due to invalid IL or missing references) + //IL_0263: Expected I4, but got Unknown + //IL_0e13: Unknown result type (might be due to invalid IL or missing references) + //IL_0e18: Unknown result type (might be due to invalid IL or missing references) + //IL_0e28: Expected O, but got Unknown + //IL_0d23: Unknown result type (might be due to invalid IL or missing references) + //IL_0d28: Unknown result type (might be due to invalid IL or missing references) + //IL_0d34: Expected O, but got Unknown + //IL_0b11: Unknown result type (might be due to invalid IL or missing references) + //IL_0b16: Unknown result type (might be due to invalid IL or missing references) + //IL_0b22: Expected O, but got Unknown + //IL_1026: Unknown result type (might be due to invalid IL or missing references) + //IL_102b: Unknown result type (might be due to invalid IL or missing references) + //IL_103b: Expected O, but got Unknown + //IL_13d8: Unknown result type (might be due to invalid IL or missing references) + //IL_13dd: Unknown result type (might be due to invalid IL or missing references) + //IL_13ed: Expected O, but got Unknown + //IL_1770: Unknown result type (might be due to invalid IL or missing references) + //IL_1775: Unknown result type (might be due to invalid IL or missing references) + //IL_1785: Expected O, but got Unknown + if (Logs.Count == 0) + { + ListsAlterados = null; + ListsAdicionados = null; + ListsRemovidos = null; + return; + } + if (SelectedLog.ModeloNovo && (int)SelectedLog.Acao == 1) + { + TextAdicoes = "ALTERAÇÕES"; + ListsAdicionados = null; + ListsRemovidos = null; + ListsAlterados = new ObservableCollection(Lists); + MostrarMensagem = false; + return; + } + if (SelectedLog.ModeloNovo && (int)SelectedLog.Acao == 0) + { + TextAdicoes = "INCLUSÕES"; + ListsAlterados = null; + ListsRemovidos = null; + ListsAdicionados = new ObservableCollection(listAtual); + MostrarMensagem = false; + return; + } + if (SelectedLog.ModeloNovo && (int)SelectedLog.Acao == 2) + { + TextAdicoes = "EXCLUSÕES"; + ListsAlterados = null; + ListsAdicionados = null; + ListsRemovidos = new ObservableCollection(listAtual); + MostrarMensagem = false; + return; + } + if (Mostrar || Logs.Last() == SelectedLog) + { + TextAdicoes = ((Logs.Last() != SelectedLog) ? "LOG COMPLETO" : "INCLUSÃO"); + ListsAlterados = null; + ListsAdicionados = new ObservableCollection(listAtual); + ListsRemovidos = null; + return; + } + TextAdicoes = "INCLUSÃO"; + List list = new List(); + try + { + TipoTela tipoTela = _tipoTela; + switch (tipoTela - 1) + { + case 1: + list = JsonConvert.DeserializeObject(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log(Restricao((TipoRestricao)14)); + break; + case 4: + list = JsonConvert.DeserializeObject(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log(Restricao((TipoRestricao)14), Restricao((TipoRestricao)95)); + break; + case 36: + list = JsonConvert.DeserializeObject(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log(Restricao((TipoRestricao)14), Restricao((TipoRestricao)95)); + break; + case 0: + list = JsonConvert.DeserializeObject(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log(); + break; + case 2: + { + Item val = JsonConvert.DeserializeObject(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao); + if (val.Aeronautico != null) + { + list = Aeronautico.Log(val); + } + else if (val.Auto != null) + { + list = Auto.Log(val); + } + else if (val.Granizo != null) + { + list = Granizo.Log(val); + } + else if (val.Patrimonial != null) + { + list = Patrimonial.Log(val); + } + else if (val.RiscosDiversos != null) + { + list = RiscosDiversos.Log(val); + } + else if (val.Vida != null) + { + list = Vida.Log(val); + } + break; + } + case 12: + list = JsonConvert.DeserializeObject(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log(); + break; + case 11: + { + Ramo ramo = JsonConvert.DeserializeObject(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao); + List list5 = (from x in Recursos.Coberturas + where x.IdRamo == ((DomainBase)ramo).Id + orderby x.Padrao descending, x.Descricao + select x).ToList(); + list = ramo.Log(list5); + break; + } + case 9: + list = JsonConvert.DeserializeObject(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log(); + break; + case 8: + list = JsonConvert.DeserializeObject(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log(); + break; + case 14: + list = JsonConvert.DeserializeObject(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log(); + break; + case 13: + list = JsonConvert.DeserializeObject(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log(); + break; + case 15: + list = JsonConvert.DeserializeObject(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log(); + break; + case 16: + list = JsonConvert.DeserializeObject(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log(); + break; + case 17: + list = JsonConvert.DeserializeObject(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log(); + break; + case 21: + list = JsonConvert.DeserializeObject(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log(); + break; + case 23: + list = JsonConvert.DeserializeObject(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log(); + break; + case 25: + list = JsonConvert.DeserializeObject(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log(); + break; + case 27: + list = JsonConvert.DeserializeObject(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log(); + break; + case 28: + list = JsonConvert.DeserializeObject(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log(); + break; + case 3: + list = JsonConvert.DeserializeObject(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log(); + break; + case 32: + list = JsonConvert.DeserializeObject(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log(); + break; + case 37: + list = JsonConvert.DeserializeObject(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log(); + break; + case 33: + list = JsonConvert.DeserializeObject(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log(); + break; + case 18: + list = JsonConvert.DeserializeObject(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log(); + break; + case 40: + list = JsonConvert.DeserializeObject(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log(); + break; + case 41: + list = JsonConvert.DeserializeObject(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log(); + break; + case 35: + list = JsonConvert.DeserializeObject(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log(); + break; + case 29: + list = JsonConvert.DeserializeObject(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log(); + break; + case 10: + list = JsonConvert.DeserializeObject(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log(); + break; + case 30: + list = JsonConvert.DeserializeObject(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log(); + break; + case 45: + list = JsonConvert.DeserializeObject(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log(); + break; + case 6: + list = JsonConvert.DeserializeObject(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log(); + break; + case 42: + { + List>>>>> list4 = JsonConvert.DeserializeObject>>>>>>(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao); + List list3 = new List(); + foreach (Tuple>>>> item in list4) + { + ObservableCollection> observableCollection = new ObservableCollection> + { + new Tuple(item.Item1 + "$", "", "") + }; + foreach (Tuple>> item2 in item.Item2) + { + observableCollection.Add(new Tuple(" " + item2.Item1 + "$", "", "")); + foreach (Tuple item3 in item2.Item2) + { + observableCollection.Add(new Tuple(" " + item3.Item1, item3.Item2, "")); + } + } + list3.Add(new TupleList + { + Tuples = observableCollection + }); + } + foreach (TupleList item4 in list3) + { + list.Add(item4); + } + break; + } + case 47: + list = JsonConvert.DeserializeObject(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log(); + break; + case 51: + list = JsonConvert.DeserializeObject(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log(); + break; + case 53: + list = JsonConvert.DeserializeObject(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log(); + break; + case 54: + list = JsonConvert.DeserializeObject(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log(); + break; + case 55: + list = JsonConvert.DeserializeObject(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log(); + break; + case 44: + { + List list2 = JsonConvert.DeserializeObject>(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao); + List list3 = new List(); + ObservableCollection> observableCollection = new ObservableCollection> + { + new Tuple("VENDEDORES VINCULADOS$", "", "") + }; + foreach (Vendedor item5 in list2) + { + observableCollection.Add(new Tuple($" VENDEDOR {list2.IndexOf(item5) + 1}", item5.Nome, "")); + } + list3.Add(new TupleList + { + Tuples = observableCollection + }); + foreach (TupleList item6 in list3) + { + list.Add(item6); + } + break; + } + case 5: + case 7: + case 19: + case 20: + case 22: + case 24: + case 26: + case 31: + case 34: + case 38: + case 39: + case 43: + case 46: + case 48: + case 49: + case 50: + case 52: + break; + } + } + catch (Exception) + { + } + ObservableCollection observableCollection2 = new ObservableCollection(); + foreach (TupleList item7 in listAtual) + { + int num = -1; + if (list.Count - 1 < listAtual.IndexOf(item7)) + { + continue; + } + for (int i = 0; i < item7.Tuples.Count; i++) + { + Tuple tuple = item7.Tuples[i]; + if (QntEspaco(tuple.Item1) == 0) + { + if (tuple.Item2 != list[listAtual.IndexOf(item7)].Tuples[item7.Tuples.IndexOf(tuple)].Item2) + { + if (num < listAtual.IndexOf(item7)) + { + observableCollection2.Add(new TupleList + { + Tuples = new ObservableCollection>() + }); + num = listAtual.IndexOf(item7); + } + observableCollection2.Last().Tuples.Add(new Tuple(tuple.Item1, tuple.Item2, list[listAtual.IndexOf(item7)].Tuples[item7.Tuples.IndexOf(tuple)].Item2)); + } + continue; + } + List list6 = new List(); + int num2 = QntEspaco(tuple.Item1); + for (int num3 = i; num3 >= 0; num3--) + { + if (QntEspaco(item7.Tuples[num3].Item1) <= num2) + { + list6.Insert(0, item7.Tuples[num3].Item1); + num2 = QntEspaco(item7.Tuples[num3].Item1); + } + } + bool flag = false; + int num4 = 0; + foreach (string item8 in list6) + { + if (flag) + { + break; + } + for (int j = num4; j < list[listAtual.IndexOf(item7)].Tuples.Count; j++) + { + if (j == list[listAtual.IndexOf(item7)].Tuples.Count - 1 && item8 != list[listAtual.IndexOf(item7)].Tuples[j].Item1) + { + flag = true; + break; + } + if (item8 == list[listAtual.IndexOf(item7)].Tuples[j].Item1) + { + num4 = j; + break; + } + } + } + if (flag || !(tuple.Item2 != list[listAtual.IndexOf(item7)].Tuples[num4].Item2)) + { + continue; + } + if (num < listAtual.IndexOf(item7)) + { + observableCollection2.Add(new TupleList + { + Tuples = new ObservableCollection>() + }); + num = listAtual.IndexOf(item7); + } + int count = observableCollection2.Last().Tuples.Count; + int num5 = QntEspaco(tuple.Item1); + for (int num6 = i - 1; num6 >= 0; num6--) + { + if (QntEspaco(item7.Tuples[num6].Item1) < QntEspaco(tuple.Item1) && QntEspaco(item7.Tuples[num6].Item1) < num5) + { + bool flag2 = false; + for (int num7 = observableCollection2.Last().Tuples.Count - 1; num7 >= 0; num7--) + { + if (observableCollection2.Last().Tuples[num7].Item1 == item7.Tuples[num6].Item1) + { + flag2 = true; + break; + } + } + if (flag2) + { + break; + } + num5 = QntEspaco(item7.Tuples[num6].Item1); + observableCollection2.Last().Tuples.Insert(count, new Tuple(item7.Tuples[num6].Item1, item7.Tuples[num6].Item2, "")); + } + } + observableCollection2.Last().Tuples.Add(new Tuple(tuple.Item1, tuple.Item2, list[listAtual.IndexOf(item7)].Tuples[num4].Item2)); + } + } + ListsAlterados = ((observableCollection2.Count == 0) ? null : observableCollection2); + observableCollection2 = new ObservableCollection(); + foreach (TupleList item9 in listAtual) + { + int num8 = -1; + if (list.Count - 1 < listAtual.IndexOf(item9)) + { + continue; + } + for (int k = 0; k < item9.Tuples.Count; k++) + { + Tuple tuple2 = item9.Tuples[k]; + if (QntEspaco(tuple2.Item1) <= 0) + { + continue; + } + List list7 = new List(); + int num9 = QntEspaco(tuple2.Item1); + for (int num10 = k; num10 >= 0; num10--) + { + if (QntEspaco(item9.Tuples[num10].Item1) <= num9) + { + list7.Insert(0, item9.Tuples[num10].Item1); + num9 = QntEspaco(item9.Tuples[num10].Item1); + } + } + bool flag3 = false; + int num11 = 0; + foreach (string item10 in list7) + { + if (flag3) + { + break; + } + for (int l = num11; l < list[listAtual.IndexOf(item9)].Tuples.Count; l++) + { + if (l == list[listAtual.IndexOf(item9)].Tuples.Count - 1 && item10 != list[listAtual.IndexOf(item9)].Tuples[l].Item1) + { + flag3 = true; + break; + } + if (item10 == list[listAtual.IndexOf(item9)].Tuples[l].Item1) + { + num11 = l; + break; + } + } + } + if (!flag3) + { + continue; + } + if (num8 < listAtual.IndexOf(item9)) + { + observableCollection2.Add(new TupleList + { + Tuples = new ObservableCollection>() + }); + num8 = listAtual.IndexOf(item9); + } + int count2 = observableCollection2.Last().Tuples.Count; + int num12 = QntEspaco(tuple2.Item1); + for (int num13 = k - 1; num13 >= 0; num13--) + { + if (QntEspaco(item9.Tuples[num13].Item1) < QntEspaco(tuple2.Item1) && QntEspaco(item9.Tuples[num13].Item1) < num12) + { + bool flag4 = false; + for (int num14 = observableCollection2.Last().Tuples.Count - 1; num14 >= 0; num14--) + { + if (observableCollection2.Last().Tuples[num14].Item1 == item9.Tuples[num13].Item1) + { + flag4 = true; + break; + } + } + if (flag4) + { + break; + } + num12 = QntEspaco(item9.Tuples[num13].Item1); + observableCollection2.Last().Tuples.Insert(count2, new Tuple(item9.Tuples[num13].Item1, item9.Tuples[num13].Item2, "")); + } + } + observableCollection2.Last().Tuples.Add(new Tuple(tuple2.Item1, tuple2.Item2, "")); + } + } + ListsAdicionados = ((observableCollection2.Count == 0) ? null : observableCollection2); + observableCollection2 = new ObservableCollection(); + foreach (TupleList item11 in list) + { + int num15 = -1; + for (int m = 0; m < item11.Tuples.Count; m++) + { + Tuple tuple3 = item11.Tuples[m]; + if (QntEspaco(tuple3.Item1) <= 0) + { + continue; + } + List list8 = new List(); + int num16 = QntEspaco(tuple3.Item1); + for (int num17 = m; num17 >= 0; num17--) + { + if (QntEspaco(item11.Tuples[num17].Item1) <= num16) + { + list8.Insert(0, item11.Tuples[num17].Item1); + num16 = QntEspaco(item11.Tuples[num17].Item1); + } + } + bool flag5 = false; + int num18 = 0; + foreach (string item12 in list8) + { + if (flag5) + { + break; + } + if (listAtual.Count - 1 < list.IndexOf(item11)) + { + continue; + } + for (int n = num18; n < listAtual[list.IndexOf(item11)].Tuples.Count; n++) + { + if (n == listAtual[list.IndexOf(item11)].Tuples.Count - 1 && item12 != listAtual[list.IndexOf(item11)].Tuples[n].Item1) + { + flag5 = true; + break; + } + if (item12 == listAtual[list.IndexOf(item11)].Tuples[n].Item1) + { + num18 = n; + break; + } + } + } + if (!flag5) + { + continue; + } + if (num15 < list.IndexOf(item11)) + { + observableCollection2.Add(new TupleList + { + Tuples = new ObservableCollection>() + }); + num15 = list.IndexOf(item11); + } + int count3 = observableCollection2.Last().Tuples.Count; + int num19 = QntEspaco(tuple3.Item1); + for (int num20 = m - 1; num20 >= 0; num20--) + { + if (QntEspaco(item11.Tuples[num20].Item1) < QntEspaco(tuple3.Item1) && QntEspaco(item11.Tuples[num20].Item1) < num19) + { + bool flag6 = false; + for (int num21 = observableCollection2.Last().Tuples.Count - 1; num21 >= 0; num21--) + { + if (observableCollection2.Last().Tuples[num21].Item1 == item11.Tuples[num20].Item1) + { + flag6 = true; + break; + } + } + if (flag6) + { + break; + } + num19 = QntEspaco(item11.Tuples[num20].Item1); + observableCollection2.Last().Tuples.Insert(count3, new Tuple(item11.Tuples[num20].Item1, item11.Tuples[num20].Item2, "")); + } + } + observableCollection2.Last().Tuples.Add(new Tuple(tuple3.Item1, "", tuple3.Item2)); + } + } + ListsRemovidos = ((observableCollection2.Count == 0) ? null : observableCollection2); + } + + private static int QntEspaco(string str) + { + return Regex.Match(str, "[^\\s]").Index; + } + + public void MostrarCampos() + { + if (SelectedLog != null && !SelectedLog.ModeloNovo) + { + Mostrar = !Mostrar; + Lists = Lists; + } + } + + public void Imprimir() + { + //IL_063c: Unknown result type (might be due to invalid IL or missing references) + //IL_0662: Unknown result type (might be due to invalid IL or missing references) + //IL_067d: Unknown result type (might be due to invalid IL or missing references) + string text = "LOGS
"; + ObservableCollection listsAlterados = ListsAlterados; + if (listsAlterados != null && listsAlterados.Count > 0) + { + text += "ALTERAÇÃO"; + } + if (ListsAlterados != null) + { + foreach (TupleList listsAlterado in ListsAlterados) + { + foreach (Tuple tuple in listsAlterado.Tuples) + { + if (tuple == listsAlterado.Tuples.First()) + { + text = text + ""; + if (!Mostrar) + { + text += ""; + } + text += "
DESCRIÇÃOVALOR LOG SELECIONADOVALOR LOG ANTERIOR
"; + } + bool flag = tuple.Item1.Contains("$"); + text = text + ""; + if (!Mostrar) + { + text = text + ""; + } + text += "
" + tuple.Item1.Replace(" ", " ").Replace("$", "") + "" + tuple.Item2 + "" + tuple.Item3 + "
"; + } + if (listsAlterado != ListsAlterados.Last()) + { + text += "
"; + } + } + } + ObservableCollection listsAdicionados = ListsAdicionados; + if (listsAdicionados != null && listsAdicionados.Count > 0) + { + ObservableCollection listsAlterados2 = ListsAlterados; + if (listsAlterados2 != null && listsAlterados2.Count > 0) + { + text += "


"; + } + text += "INCLUSÃO"; + } + if (ListsAdicionados != null) + { + foreach (TupleList listsAdicionado in ListsAdicionados) + { + foreach (Tuple tuple2 in listsAdicionado.Tuples) + { + if (tuple2 == listsAdicionado.Tuples.First()) + { + text = text + ""; + if (!Mostrar) + { + text += ""; + } + text += "
DESCRIÇÃOVALOR LOG SELECIONADOVALOR LOG ANTERIOR
"; + } + bool flag2 = tuple2.Item1.Contains("$"); + text = text + ""; + if (!Mostrar) + { + text = text + ""; + } + text += "
" + tuple2.Item1.Replace(" ", " ").Replace("$", "") + "" + tuple2.Item2 + "" + tuple2.Item3 + "
"; + } + if (listsAdicionado != ListsAdicionados.Last()) + { + text += "
"; + } + } + } + ObservableCollection listsRemovidos = ListsRemovidos; + if (listsRemovidos != null && listsRemovidos.Count > 0) + { + ObservableCollection listsAlterados3 = ListsAlterados; + if (listsAlterados3 == null || listsAlterados3.Count <= 0) + { + ObservableCollection listsAdicionados2 = ListsAdicionados; + if (listsAdicionados2 == null || listsAdicionados2.Count <= 0) + { + goto IL_0428; + } + } + text += "


"; + goto IL_0428; + } + goto IL_0434; + IL_0434: + if (ListsRemovidos != null) + { + foreach (TupleList listsRemovido in ListsRemovidos) + { + foreach (Tuple tuple3 in listsRemovido.Tuples) + { + if (tuple3 == listsRemovido.Tuples.First()) + { + text = text + ""; + if (!Mostrar) + { + text += ""; + } + text += "
DESCRIÇÃOVALOR LOG SELECIONADOVALOR LOG ANTERIOR
"; + } + bool flag3 = tuple3.Item1.Contains("$"); + text = text + ""; + if (!Mostrar) + { + text = text + ""; + } + text += "
" + tuple3.Item1.Replace(" ", " ").Replace("$", "") + "" + tuple3.Item2 + "" + tuple3.Item3 + "
"; + } + if (listsRemovido != ListsRemovidos.Last()) + { + text += "
"; + } + } + } + text += "
"; + string tempPath = Path.GetTempPath(); + string text2 = $"{tempPath}{(object)(TipoExtrato)0}_{Funcoes.GetNetworkTime():ddMMyyyyhhmmss}.html"; + StreamWriter streamWriter = new StreamWriter(text2, append: true, Encoding.UTF8); + streamWriter.Write(text); + streamWriter.Close(); + Process.Start(text2); + RegistrarAcao($"IMPRIMIU O LOG DE ALTERAÇÕES DE {Funcoes.GetDescription((Enum)(object)_tipoTela)} DO ID \"{_id}\"", _id, _tipoTela, $"ID ENTIDADE: {_id}\nTIPO: {Funcoes.GetDescription((Enum)(object)_tipoTela)}"); + return; + IL_0428: + text += "EXCLUSÃO"; + goto IL_0434; + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Drawer/MetaSeguradoraViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Drawer/MetaSeguradoraViewModel.cs new file mode 100644 index 0000000..4e162a9 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Drawer/MetaSeguradoraViewModel.cs @@ -0,0 +1,212 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using Assinador.Infrastructure.Helpers; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Ferramentas; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Drawer; + +public class MetaSeguradoraViewModel : BaseSegurosViewModel +{ + private readonly MetaSeguradoraServico _servico; + + private readonly Seguradora _selectedSeguradora; + + private MetaSeguradora _selectedMetaSeguradora = new MetaSeguradora(); + + private ObservableCollection _metasSeguradora = new ObservableCollection(); + + private bool _carregando; + + public MetaSeguradora CancelMetaSeguradora; + + public MetaSeguradora SelectedMetaSeguradora + { + get + { + return _selectedMetaSeguradora; + } + set + { + _selectedMetaSeguradora = value; + CancelMetaSeguradora = ((value != null && ((DomainBase)value).Id > 0) ? value : CancelMetaSeguradora); + VerificarEnables((value != null) ? new long?(((DomainBase)value).Id) : null); + OnPropertyChanged("SelectedMetaSeguradora"); + } + } + + public ObservableCollection MetasSeguradora + { + get + { + return _metasSeguradora; + } + set + { + _metasSeguradora = value; + OnPropertyChanged("MetasSeguradora"); + } + } + + public bool Carregando + { + get + { + return _carregando; + } + set + { + _carregando = value; + base.IsEnabled = !value; + base.EnableMenu = !value; + OnPropertyChanged("Carregando"); + } + } + + public MetaSeguradoraViewModel(Seguradora seguradora) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_000b: Expected O, but got Unknown + _servico = new MetaSeguradoraServico(); + Seleciona(seguradora); + _selectedSeguradora = seguradora; + } + + private async void Seleciona(Seguradora seguradora) + { + Loading(isLoading: true); + await PermissaoTela((TipoTela)31); + await SelecionaMetasSeguradora(seguradora); + Loading(isLoading: false); + } + + public void SelecionaMetaSeguradora(MetaSeguradora metaSeguradora) + { + SelectedMetaSeguradora = metaSeguradora; + } + + private async Task SelecionaMetasSeguradora(Seguradora seguradora) + { + Carregando = true; + await CarregarMetas(seguradora); + if (MetasSeguradora.Count > 0) + { + SelecionaMetaSeguradora(MetasSeguradora.First()); + } + else + { + SelectedMetaSeguradora = new MetaSeguradora(); + Alterar(alterar: false); + base.EnableMenu = false; + base.EnableAlterar = false; + base.EnableExcluir = false; + } + Carregando = false; + } + + public void Incluir() + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Unknown result type (might be due to invalid IL or missing references) + //IL_0034: Expected O, but got Unknown + DateTime date = Funcoes.GetNetworkTime().Date; + SelectedMetaSeguradora = new MetaSeguradora + { + Ano = date.Year, + Mes = (Mes)date.Month + }; + Alterar(alterar: true); + } + + public async Task>> Salvar() + { + SelectedMetaSeguradora.Seguradora = _selectedSeguradora; + string acao = ((((DomainBase)SelectedMetaSeguradora).Id == 0L) ? "INCLUIU" : "ALTEROU"); + MetaSeguradora value = await _servico.Save(SelectedMetaSeguradora); + if (!_servico.Sucesso) + { + return null; + } + RegistrarAcao(acao + " META DA SEGURADORA \"" + value.Seguradora.Nome + "\"", ((DomainBase)value).Id, (TipoTela)31, $"ID: {((DomainBase)value).Id}\nVALOR: {value.Valor:C}\nMÊS: {Functions.GetDescription((Enum)(object)value.Mes)}\nANO: {value.Ano}"); + if (MetasSeguradora.Any((MetaSeguradora x) => ((DomainBase)x).Id == ((DomainBase)value).Id)) + { + DomainBase.Copy(MetasSeguradora.First((MetaSeguradora x) => ((DomainBase)x).Id == ((DomainBase)value).Id), value); + } + else + { + MetasSeguradora.Add(value); + } + MetasSeguradora = new ObservableCollection(MetasSeguradora); + SelectedMetaSeguradora = MetasSeguradora.First((MetaSeguradora x) => ((DomainBase)x).Id == ((DomainBase)value).Id); + Alterar(alterar: false); + return null; + } + + public async Task Excluir() + { + if (SelectedMetaSeguradora == null || ((DomainBase)SelectedMetaSeguradora).Id == 0L) + { + return false; + } + if (!(await ShowMessage("DESEJA EXCLUIR?", "SIM", "NÃO"))) + { + return false; + } + Carregando = true; + if (!(await _servico.Delete(SelectedMetaSeguradora))) + { + Carregando = false; + Alterar(alterar: false); + return false; + } + MetaSeguradoraViewModel metaSeguradoraViewModel = this; + Seguradora seguradora = SelectedMetaSeguradora.Seguradora; + metaSeguradoraViewModel.RegistrarAcao("EXCLUIU META DA SEGURADORA \"" + ((seguradora != null) ? seguradora.Nome : null) + "\"", ((DomainBase)SelectedMetaSeguradora).Id, (TipoTela)31, $"ID: {((DomainBase)SelectedMetaSeguradora).Id}\nVALOR: {SelectedMetaSeguradora.Valor:C}\nMÊS: {Functions.GetDescription((Enum)(object)SelectedMetaSeguradora.Mes)}\nANO: {SelectedMetaSeguradora.Ano}"); + int num = MetasSeguradora.IndexOf(SelectedMetaSeguradora); + MetasSeguradora.Remove(SelectedMetaSeguradora); + MetasSeguradora.Remove(SelectedMetaSeguradora); + MetasSeguradora = new ObservableCollection(MetasSeguradora); + if (MetasSeguradora.Count > 0) + { + SelectedMetaSeguradora = ((num < MetasSeguradora.Count) ? MetasSeguradora.ElementAt(num) : MetasSeguradora.Last()); + } + else + { + SelectedMetaSeguradora = new MetaSeguradora(); + Alterar(alterar: false); + base.EnableMenu = false; + base.EnableAlterar = false; + base.EnableExcluir = false; + } + Carregando = false; + return true; + } + + public void CancelarAlteracao() + { + Carregando = true; + if (CancelMetaSeguradora != null && MetasSeguradora.Any((MetaSeguradora x) => ((DomainBase)x).Id == ((DomainBase)CancelMetaSeguradora).Id)) + { + DomainBase.Copy(MetasSeguradora.First((MetaSeguradora x) => ((DomainBase)x).Id == ((DomainBase)CancelMetaSeguradora).Id), CancelMetaSeguradora); + SelectedMetaSeguradora = MetasSeguradora.First((MetaSeguradora x) => ((DomainBase)x).Id == ((DomainBase)CancelMetaSeguradora).Id); + } + Alterar(alterar: false); + Carregando = false; + } + + private async Task CarregarMetas(Seguradora seguradora) + { + MetasSeguradora = new ObservableCollection(from x in await new BaseServico().BuscarMetaSeguradoraAsync(seguradora) + orderby x.Mes, x.Valor + select x); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Drawer/MetaVendedorViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Drawer/MetaVendedorViewModel.cs new file mode 100644 index 0000000..55f706c --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Drawer/MetaVendedorViewModel.cs @@ -0,0 +1,209 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using Assinador.Infrastructure.Helpers; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Ferramentas; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Drawer; + +public class MetaVendedorViewModel : BaseSegurosViewModel +{ + private readonly MetaVendedorServico _servico; + + private readonly Vendedor _selectedVendedor; + + private MetaVendedor _selectedMetaVendedor = new MetaVendedor(); + + private ObservableCollection _metasVendedor = new ObservableCollection(); + + private bool _carregando; + + public MetaVendedor CancelMetaVendedor; + + public MetaVendedor SelectedMetaVendedor + { + get + { + return _selectedMetaVendedor; + } + set + { + _selectedMetaVendedor = value; + CancelMetaVendedor = ((value != null && ((DomainBase)value).Id > 0) ? value : CancelMetaVendedor); + VerificarEnables((value != null) ? new long?(((DomainBase)value).Id) : null); + OnPropertyChanged("SelectedMetaVendedor"); + } + } + + public ObservableCollection MetasVendedor + { + get + { + return _metasVendedor; + } + set + { + _metasVendedor = value; + OnPropertyChanged("MetasVendedor"); + } + } + + public bool Carregando + { + get + { + return _carregando; + } + set + { + _carregando = value; + base.IsEnabled = !value; + base.EnableMenu = !value; + OnPropertyChanged("Carregando"); + } + } + + public MetaVendedorViewModel(Vendedor vendedor) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_000b: Expected O, but got Unknown + _servico = new MetaVendedorServico(); + Seleciona(vendedor); + _selectedVendedor = vendedor; + } + + private async void Seleciona(Vendedor vendedor) + { + Loading(isLoading: true); + await PermissaoTela((TipoTela)30); + await SelecionaMetasVendedor(vendedor); + Loading(isLoading: false); + } + + public void SelecionaMetaVendedor(MetaVendedor metaVendedor) + { + SelectedMetaVendedor = metaVendedor; + } + + private async Task SelecionaMetasVendedor(Vendedor vendedor) + { + Carregando = true; + await CarregarMetas(vendedor); + if (MetasVendedor.Count > 0) + { + SelecionaMetaVendedor(MetasVendedor.First()); + } + else + { + SelectedMetaVendedor = new MetaVendedor(); + Alterar(alterar: false); + base.EnableMenu = false; + } + Carregando = false; + } + + public void Incluir() + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Unknown result type (might be due to invalid IL or missing references) + //IL_0034: Expected O, but got Unknown + DateTime date = Funcoes.GetNetworkTime().Date; + SelectedMetaVendedor = new MetaVendedor + { + Ano = date.Year, + Mes = (Mes)date.Month + }; + Alterar(alterar: true); + } + + public async Task>> Salvar() + { + SelectedMetaVendedor.Vendedor = _selectedVendedor; + _servico.Sucesso = true; + string acao = ((((DomainBase)SelectedMetaVendedor).Id == 0L) ? "INCLUIU" : "ALTEROU"); + MetaVendedor value = await _servico.Save(SelectedMetaVendedor); + if (!_servico.Sucesso) + { + return null; + } + RegistrarAcao(acao + " META DO VENDEDOR \"" + value.Vendedor.Nome + "\"", ((DomainBase)value).Id, (TipoTela)30, $"ID: {((DomainBase)value).Id}\nVALOR: {value.Valor:C}\nMÊS: {Functions.GetDescription((Enum)(object)value.Mes)}\nANO: {value.Ano}"); + if (MetasVendedor.Any((MetaVendedor x) => ((DomainBase)x).Id == ((DomainBase)value).Id)) + { + DomainBase.Copy(MetasVendedor.First((MetaVendedor x) => ((DomainBase)x).Id == ((DomainBase)value).Id), value); + } + else + { + MetasVendedor.Add(value); + } + MetasVendedor = new ObservableCollection(MetasVendedor); + SelectedMetaVendedor = MetasVendedor.First((MetaVendedor x) => ((DomainBase)x).Id == ((DomainBase)value).Id); + Alterar(alterar: false); + return null; + } + + public async Task Excluir() + { + if (SelectedMetaVendedor == null || ((DomainBase)SelectedMetaVendedor).Id == 0L) + { + return false; + } + if (!(await ShowMessage("DESEJA EXCLUIR?", "SIM", "NÃO"))) + { + return false; + } + Carregando = true; + string log = "EXCLUIU META DO VENDEDOR \"" + _selectedVendedor.Nome + "\""; + long id = ((DomainBase)SelectedMetaVendedor).Id; + string descricao = $"ID: {((DomainBase)SelectedMetaVendedor).Id}\nVALOR: {SelectedMetaVendedor.Valor:C}\nMÊS: {Functions.GetDescription((Enum)(object)SelectedMetaVendedor.Mes)}\nANO: {SelectedMetaVendedor.Ano}"; + if (!(await _servico.Delete(SelectedMetaVendedor))) + { + Carregando = false; + Alterar(alterar: false); + return false; + } + RegistrarAcao(log, id, (TipoTela)30, descricao); + await CarregarMetas(_selectedVendedor); + if (MetasVendedor.Count > 0) + { + SelectedMetaVendedor = MetasVendedor.First(); + } + else + { + SelectedMetaVendedor = new MetaVendedor(); + Alterar(alterar: false); + base.EnableMenu = false; + base.EnableAlterar = false; + base.EnableExcluir = false; + } + Carregando = false; + return true; + } + + public void CancelarAlteracao() + { + Carregando = true; + if (CancelMetaVendedor != null && MetasVendedor.Any((MetaVendedor x) => ((DomainBase)x).Id == ((DomainBase)CancelMetaVendedor).Id)) + { + DomainBase.Copy(MetasVendedor.First((MetaVendedor x) => ((DomainBase)x).Id == ((DomainBase)CancelMetaVendedor).Id), CancelMetaVendedor); + SelectedMetaVendedor = MetasVendedor.First((MetaVendedor x) => ((DomainBase)x).Id == ((DomainBase)CancelMetaVendedor).Id); + } + Alterar(alterar: false); + Carregando = false; + } + + private async Task CarregarMetas(Vendedor vendedor) + { + MetasVendedor = new ObservableCollection((from x in await new BaseServico().BuscarMetaVendedorAsync(vendedor) + orderby x.Mes, x.Valor + select x).ToList()); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Drawer/PermissaoUsuarioViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Drawer/PermissaoUsuarioViewModel.cs new file mode 100644 index 0000000..393faa6 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Drawer/PermissaoUsuarioViewModel.cs @@ -0,0 +1,1704 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; +using Gestor.Application.Actions; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Ferramentas; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Relatorios; +using Gestor.Model.Domain.Relatorios.ApolicePendente; +using Gestor.Model.Domain.Relatorios.Auditoria; +using Gestor.Model.Domain.Relatorios.ClientesAtivosInativos; +using Gestor.Model.Domain.Relatorios.Comissao; +using Gestor.Model.Domain.Relatorios.ExtratoBaixado; +using Gestor.Model.Domain.Relatorios.FaturaPendente; +using Gestor.Model.Domain.Relatorios.Fechamento; +using Gestor.Model.Domain.Relatorios.Licenciamento; +using Gestor.Model.Domain.Relatorios.LogsEnvio; +using Gestor.Model.Domain.Relatorios.MetaSeguradora; +using Gestor.Model.Domain.Relatorios.MetaVendedor; +using Gestor.Model.Domain.Relatorios.NotaFiscal; +using Gestor.Model.Domain.Relatorios.Pendente; +using Gestor.Model.Domain.Relatorios.Placa; +using Gestor.Model.Domain.Relatorios.PrevisaoPagamentoComissao; +using Gestor.Model.Domain.Relatorios.Producao; +using Gestor.Model.Domain.Relatorios.Renovacao; +using Gestor.Model.Domain.Relatorios.Sinistro; +using Gestor.Model.Domain.Relatorios.Tarefa; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Drawer; + +public class PermissaoUsuarioViewModel : BaseSegurosViewModel +{ + private readonly UsuarioServico _servicoUsuario; + + private Usuario _selectedUsuario; + + private bool _expandedBis; + + private bool _expandedSeguros; + + private bool _expandedRelatorios; + + private bool _expandedCampos; + + private bool _expandedTotalizacoes; + + private bool _expandedFinanceiros; + + private bool _expandedFerramentas; + + private bool _expandedAjudas; + + private ObservableCollection _seguros; + + private ObservableCollection _ferramentas; + + private ObservableCollection _arquivosDigitais; + + private bool _enableAlterarPermiss = true; + + private ObservableCollection _restricoesBisFiltradas; + + private ObservableCollection _restricoesSegurosFiltradas; + + private ObservableCollection _restricoesRelatoriosFiltrados; + + private ObservableCollection _restricoesTotalizacoesRelatoriosFiltrados; + + private ObservableCollection _restricoesCamposRelatoriosFiltrados; + + private ObservableCollection _restricoesFinanceirosFiltradas; + + private ObservableCollection _restricoesFerramentasFiltradas; + + private ObservableCollection _restricoesAjudasFiltrados; + + private List _restricoesBis; + + private List _restricoesSeguros; + + private List _restricoesRelatorios; + + private List _restricoesTotalizacoesRelatorios; + + private List _restricoesCamposRelatorios; + + private List _restricoesFinanceiros; + + private List _restricoesFerramentas; + + private List _restricoesAjudas; + + private Visibility _restricoesBisVisibility; + + private Visibility _restricoesSegurosVisibility; + + private Visibility _restricoesRelatoriosVisibility; + + private Visibility _restricoesTotalizacoesRelatoriosVisibility; + + private Visibility _restricoesCamposRelatoriosVisibility; + + private Visibility _restricoesFinanceirosVisibility; + + private Visibility _restricoesFerramentasVisibility; + + private Visibility _restricoesAjudasVisibility; + + private List _permissaoAggilizador; + + private PermissaoAggilizador _selectedPermissao; + + private bool _admUsuario; + + private bool _importarEnabled; + + private bool _carregando; + + private bool _ativarDesativarPermissoesBool = true; + + private bool _ativarDesativarRestricoesBool = true; + + public Usuario SelectedUsuario + { + get + { + return _selectedUsuario; + } + set + { + _selectedUsuario = value; + OnPropertyChanged("SelectedUsuario"); + } + } + + public bool Carregado { get; set; } + + public bool ExpandedBis + { + get + { + return _expandedBis; + } + set + { + _expandedBis = value; + OnPropertyChanged("ExpandedBis"); + } + } + + public bool ExpandedSeguros + { + get + { + return _expandedSeguros; + } + set + { + _expandedSeguros = value; + OnPropertyChanged("ExpandedSeguros"); + } + } + + public bool ExpandedRelatorios + { + get + { + return _expandedRelatorios; + } + set + { + _expandedRelatorios = value; + OnPropertyChanged("ExpandedRelatorios"); + } + } + + public bool ExpandedCampos + { + get + { + return _expandedCampos; + } + set + { + _expandedCampos = value; + OnPropertyChanged("ExpandedCampos"); + } + } + + public bool ExpandedTotalizacoes + { + get + { + return _expandedTotalizacoes; + } + set + { + _expandedTotalizacoes = value; + OnPropertyChanged("ExpandedTotalizacoes"); + } + } + + public bool ExpandedFinanceiros + { + get + { + return _expandedFinanceiros; + } + set + { + _expandedFinanceiros = value; + OnPropertyChanged("ExpandedFinanceiros"); + } + } + + public bool ExpandedFerramentas + { + get + { + return _expandedFerramentas; + } + set + { + _expandedFerramentas = value; + OnPropertyChanged("ExpandedFerramentas"); + } + } + + public bool ExpandedAjudas + { + get + { + return _expandedAjudas; + } + set + { + _expandedAjudas = value; + OnPropertyChanged("ExpandedAjudas"); + } + } + + public ObservableCollection Seguros + { + get + { + return _seguros; + } + set + { + _seguros = value; + OnPropertyChanged("Seguros"); + if (value != null && Ferramentas != null && value.All((PermissaoUsuario x) => ((int)x.Tela == 21 && x.Consultar) || ((int)x.Tela == 5 && x.Alterar && x.Incluir && x.Excluir) || ((int)x.Tela != 21 && (int)x.Tela != 5 && x.Consultar && x.Alterar && x.Incluir && x.Excluir)) && Ferramentas.All((PermissaoUsuario x) => ((int)x.Tela == 18 && x.Consultar && x.Alterar) || ((int)x.Tela == 10 && x.Consultar && x.Alterar && x.Incluir) || ((int)x.Tela == 12 && x.Consultar && x.Alterar) || ((int)x.Tela == 13 && x.Consultar && x.Alterar && x.Incluir) || ((int)x.Tela != 18 && (int)x.Tela != 10 && (int)x.Tela != 12 && (int)x.Tela != 13 && x.Consultar && x.Alterar && x.Incluir && x.Excluir))) + { + AtivarDesativarPermissoesBool = false; + } + Gestor.Application.Actions.Actions.OcultarTogglesSeguros(); + } + } + + public ObservableCollection Ferramentas + { + get + { + return _ferramentas; + } + set + { + _ferramentas = value; + OnPropertyChanged("Ferramentas"); + if (value != null && Seguros != null && value.All((PermissaoUsuario x) => ((int)x.Tela == 18 && x.Consultar && x.Alterar) || ((int)x.Tela == 10 && x.Consultar && x.Alterar && x.Incluir) || ((int)x.Tela == 12 && x.Consultar && x.Alterar) || ((int)x.Tela == 13 && x.Consultar && x.Alterar && x.Incluir) || ((int)x.Tela != 18 && (int)x.Tela != 10 && (int)x.Tela != 12 && (int)x.Tela != 13 && x.Consultar && x.Alterar && x.Incluir && x.Excluir)) && Seguros.All((PermissaoUsuario x) => ((int)x.Tela == 21 && x.Consultar) || ((int)x.Tela == 5 && x.Alterar && x.Incluir && x.Excluir) || ((int)x.Tela != 21 && (int)x.Tela != 5 && x.Consultar && x.Alterar && x.Incluir && x.Excluir))) + { + AtivarDesativarPermissoesBool = false; + } + Gestor.Application.Actions.Actions.OcultarTogglesFerramentas(); + } + } + + public ObservableCollection ArquivosDigitais + { + get + { + return _arquivosDigitais; + } + set + { + _arquivosDigitais = value; + OnPropertyChanged("ArquivosDigitais"); + Gestor.Application.Actions.Actions.OcultarTogglesArquivoDigital(); + } + } + + public bool EnableAlterarPermiss + { + get + { + return _enableAlterarPermiss; + } + set + { + _enableAlterarPermiss = value; + OnPropertyChanged("EnableAlterarPermiss"); + } + } + + public ObservableCollection RestricoesBisFiltradas + { + get + { + return _restricoesBisFiltradas; + } + set + { + RestricoesBisVisibility = (Visibility)((value == null || value.Count <= 0) ? 2 : 0); + _restricoesBisFiltradas = new ObservableCollection(from x in value.ToList() + orderby ValidationHelper.GetDescription((Enum)(object)x.Tipo) + select x); + OnPropertyChanged("RestricoesBisFiltradas"); + AtivarDesativarRestricoes(); + } + } + + public ObservableCollection RestricoesSegurosFiltradas + { + get + { + return _restricoesSegurosFiltradas; + } + set + { + RestricoesSegurosVisibility = (Visibility)((value == null || value.Count <= 0) ? 2 : 0); + _restricoesSegurosFiltradas = new ObservableCollection(from x in value.ToList() + orderby ValidationHelper.GetDescription((Enum)(object)x.Tipo) + select x); + OnPropertyChanged("RestricoesSegurosFiltradas"); + AtivarDesativarRestricoes(); + } + } + + public ObservableCollection RestricoesRelatoriosFiltrados + { + get + { + return _restricoesRelatoriosFiltrados; + } + set + { + RestricoesRelatoriosVisibility = (Visibility)((value == null || value.Count <= 0) ? 2 : 0); + _restricoesRelatoriosFiltrados = new ObservableCollection(from x in value.ToList() + orderby ValidationHelper.GetDescription((Enum)(object)x.Tipo) + select x); + OnPropertyChanged("RestricoesRelatoriosFiltrados"); + AtivarDesativarRestricoes(); + } + } + + public ObservableCollection RestricoesTotalizacoesRelatoriosFiltrados + { + get + { + return _restricoesTotalizacoesRelatoriosFiltrados; + } + set + { + RestricoesTotalizacoesRelatoriosVisibility = (Visibility)((value == null || value.Count <= 0) ? 2 : 0); + _restricoesTotalizacoesRelatoriosFiltrados = new ObservableCollection(from x in value.ToList() + orderby ValidationHelper.GetDescription((Enum)(object)x.Tipo) + select x); + OnPropertyChanged("RestricoesTotalizacoesRelatoriosFiltrados"); + AtivarDesativarRestricoes(); + } + } + + public ObservableCollection RestricoesCamposRelatoriosFiltrados + { + get + { + return _restricoesCamposRelatoriosFiltrados; + } + set + { + RestricoesCamposRelatoriosVisibility = (Visibility)((value == null || value.Count <= 0) ? 2 : 0); + _restricoesCamposRelatoriosFiltrados = new ObservableCollection(from x in value.ToList() + orderby x.Relatorio, x.Campo + select x); + OnPropertyChanged("RestricoesCamposRelatoriosFiltrados"); + AtivarDesativarRestricoes(); + } + } + + public ObservableCollection RestricoesFinanceirosFiltradas + { + get + { + return _restricoesFinanceirosFiltradas; + } + set + { + RestricoesFinanceirosVisibility = (Visibility)((value == null || value.Count <= 0) ? 2 : 0); + _restricoesFinanceirosFiltradas = new ObservableCollection(from x in value.ToList() + orderby ValidationHelper.GetDescription((Enum)(object)x.Tipo) + select x); + OnPropertyChanged("RestricoesFinanceirosFiltradas"); + AtivarDesativarRestricoes(); + } + } + + public ObservableCollection RestricoesFerramentasFiltradas + { + get + { + return _restricoesFerramentasFiltradas; + } + set + { + RestricoesFerramentasVisibility = (Visibility)((value == null || value.Count <= 0) ? 2 : 0); + _restricoesFerramentasFiltradas = new ObservableCollection(from x in value.ToList() + orderby ValidationHelper.GetDescription((Enum)(object)x.Tipo) + select x); + OnPropertyChanged("RestricoesFerramentasFiltradas"); + AtivarDesativarRestricoes(); + } + } + + public ObservableCollection RestricoesAjudasFiltrados + { + get + { + return _restricoesAjudasFiltrados; + } + set + { + RestricoesAjudasVisibility = (Visibility)((value == null || value.Count <= 0) ? 2 : 0); + _restricoesAjudasFiltrados = new ObservableCollection(from x in value.ToList() + orderby ValidationHelper.GetDescription((Enum)(object)x.Tipo) + select x); + OnPropertyChanged("RestricoesAjudasFiltrados"); + AtivarDesativarRestricoes(); + } + } + + public List RestricoesBis + { + get + { + return _restricoesBis; + } + set + { + _restricoesBis = value; + OnPropertyChanged("RestricoesBis"); + } + } + + public List RestricoesSeguros + { + get + { + return _restricoesSeguros; + } + set + { + _restricoesSeguros = value; + OnPropertyChanged("RestricoesSeguros"); + } + } + + public List RestricoesRelatorios + { + get + { + return _restricoesRelatorios; + } + set + { + _restricoesRelatorios = value; + OnPropertyChanged("RestricoesRelatorios"); + } + } + + public List RestricoesTotalizacoesRelatorios + { + get + { + return _restricoesTotalizacoesRelatorios; + } + set + { + _restricoesTotalizacoesRelatorios = value; + OnPropertyChanged("RestricoesTotalizacoesRelatorios"); + } + } + + public List RestricoesCamposRelatorios + { + get + { + return _restricoesCamposRelatorios; + } + set + { + _restricoesCamposRelatorios = value; + OnPropertyChanged("RestricoesCamposRelatorios"); + } + } + + public List RestricoesFinanceiros + { + get + { + return _restricoesFinanceiros; + } + set + { + _restricoesFinanceiros = value; + OnPropertyChanged("RestricoesFinanceiros"); + } + } + + public List RestricoesFerramentas + { + get + { + return _restricoesFerramentas; + } + set + { + _restricoesFerramentas = value; + OnPropertyChanged("RestricoesFerramentas"); + } + } + + public List RestricoesAjudas + { + get + { + return _restricoesAjudas; + } + set + { + _restricoesAjudas = value; + OnPropertyChanged("RestricoesAjudas"); + } + } + + public Visibility RestricoesBisVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _restricoesBisVisibility; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _restricoesBisVisibility = value; + OnPropertyChanged("RestricoesBisVisibility"); + } + } + + public Visibility RestricoesSegurosVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _restricoesSegurosVisibility; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _restricoesSegurosVisibility = value; + OnPropertyChanged("RestricoesSegurosVisibility"); + } + } + + public Visibility RestricoesRelatoriosVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _restricoesRelatoriosVisibility; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _restricoesRelatoriosVisibility = value; + OnPropertyChanged("RestricoesRelatoriosVisibility"); + } + } + + public Visibility RestricoesTotalizacoesRelatoriosVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _restricoesTotalizacoesRelatoriosVisibility; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _restricoesTotalizacoesRelatoriosVisibility = value; + OnPropertyChanged("RestricoesTotalizacoesRelatoriosVisibility"); + } + } + + public Visibility RestricoesCamposRelatoriosVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _restricoesCamposRelatoriosVisibility; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _restricoesCamposRelatoriosVisibility = value; + OnPropertyChanged("RestricoesCamposRelatoriosVisibility"); + } + } + + public Visibility RestricoesFinanceirosVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _restricoesFinanceirosVisibility; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _restricoesFinanceirosVisibility = value; + OnPropertyChanged("RestricoesFinanceirosVisibility"); + } + } + + public Visibility RestricoesFerramentasVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _restricoesFerramentasVisibility; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _restricoesFerramentasVisibility = value; + OnPropertyChanged("RestricoesFerramentasVisibility"); + } + } + + public Visibility RestricoesAjudasVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _restricoesAjudasVisibility; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _restricoesAjudasVisibility = value; + OnPropertyChanged("RestricoesAjudasVisibility"); + } + } + + public List PermissaoAggilizador + { + get + { + return _permissaoAggilizador; + } + set + { + _permissaoAggilizador = value; + OnPropertyChanged("PermissaoAggilizador"); + } + } + + public PermissaoAggilizador SelectedPermissao + { + get + { + return _selectedPermissao; + } + set + { + _selectedPermissao = value; + OnPropertyChanged("SelectedPermissao"); + } + } + + public bool AdmUsuario + { + get + { + return _admUsuario; + } + set + { + _admUsuario = value; + ImportarEnabled = !value; + SelectedUsuario.Administrador = value; + if (value && !Carregando) + { + AtivarDesativarPermissoes(permiss: true); + AtivarDesativarRestricoes(restricao: false); + } + OnPropertyChanged("AdmUsuario"); + } + } + + public bool ImportarEnabled + { + get + { + return _importarEnabled; + } + set + { + _importarEnabled = value; + OnPropertyChanged("ImportarEnabled"); + } + } + + public bool Carregando + { + get + { + return _carregando; + } + set + { + _carregando = value; + base.IsEnabled = !value; + base.EnableMenu = !value; + OnPropertyChanged("Carregando"); + } + } + + public bool AtivarDesativarPermissoesBool + { + get + { + return _ativarDesativarPermissoesBool; + } + set + { + _ativarDesativarPermissoesBool = value; + OnPropertyChanged("AtivarDesativarPermissoesBool"); + } + } + + public bool AtivarDesativarRestricoesBool + { + get + { + return _ativarDesativarRestricoesBool; + } + set + { + _ativarDesativarRestricoesBool = value; + OnPropertyChanged("AtivarDesativarRestricoesBool"); + } + } + + public PermissaoUsuarioViewModel(Usuario usuario) + { + SelectedUsuario = usuario; + _servicoUsuario = new UsuarioServico(); + CarregarModulos(usuario); + EnableAlterarPermiss = ((DomainBase)Recursos.Usuario).Id > 0; + } + + private async void CarregarModulos(Usuario usuario) + { + await Modulos(usuario); + Carregado = true; + } + + private async Task Modulos(Usuario usuario) + { + Carregando = true; + usuario = await _servicoUsuario.BuscarUsuarioPorId(((DomainBase)usuario).Id); + Seguros = new ObservableCollection(await GetPermissoes(usuario, "seguros")); + Ferramentas = new ObservableCollection(await GetPermissoes(usuario, "ferramentas")); + ArquivosDigitais = new ObservableCollection(await GetPermissoesArquivoDigital(usuario)); + PermissaoAggilizador = new List(await _servicoUsuario.BuscarPermissaoAggilizador()); + RestricoesBis = await GetRestricoes(usuario, "b.i."); + RestricoesBisFiltradas = new ObservableCollection(RestricoesBis); + RestricoesSeguros = await GetRestricoes(usuario, "seguros"); + RestricoesSegurosFiltradas = new ObservableCollection(RestricoesSeguros); + RestricoesRelatorios = await GetRestricoes(usuario, "relatorios"); + RestricoesRelatoriosFiltrados = new ObservableCollection(RestricoesRelatorios); + RestricoesFinanceiros = await GetRestricoes(usuario, "financeiro"); + RestricoesFinanceirosFiltradas = new ObservableCollection(RestricoesFinanceiros); + RestricoesFerramentas = await GetRestricoes(usuario, "ferramentas"); + RestricoesFerramentasFiltradas = new ObservableCollection(RestricoesFerramentas); + RestricoesAjudas = await GetRestricoes(usuario, "ajuda"); + RestricoesAjudasFiltrados = new ObservableCollection(RestricoesAjudas); + RestricoesTotalizacoesRelatorios = await GetRestricoes(usuario, "totalizacoesRelatorios"); + RestricoesTotalizacoesRelatoriosFiltrados = new ObservableCollection(RestricoesTotalizacoesRelatorios); + RestricoesCamposRelatorios = await GetRestricoesCamposRelatorios(usuario); + RestricoesCamposRelatoriosFiltrados = new ObservableCollection(RestricoesCamposRelatorios); + Carregando = false; + AdmUsuario = usuario.Administrador; + SelectedPermissao = ((!usuario.PermissaoAggilizador.HasValue) ? ((IEnumerable)PermissaoAggilizador).FirstOrDefault((Func)((PermissaoAggilizador x) => ((DomainBase)x).Id == 2)) : ((IEnumerable)PermissaoAggilizador).FirstOrDefault((Func)((PermissaoAggilizador x) => ((DomainBase)x).Id == usuario.PermissaoAggilizador))); + } + + private async Task> GetPermissoesArquivoDigital(Usuario usuario) + { + List list = new List(); + List telas = (from TipoArquivoDigital v in Enum.GetValues(typeof(TipoArquivoDigital)) + select ((object)(TipoArquivoDigital)(ref v)).ToString() into x + orderby x + select x).ToList(); + List permissoes = await ServicoPermissArquivoDigital.PermissArquivoDigital(usuario); + telas.ForEach(delegate(string x) + { + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_00ca: Unknown result type (might be due to invalid IL or missing references) + //IL_00cf: Unknown result type (might be due to invalid IL or missing references) + //IL_00d6: Unknown result type (might be due to invalid IL or missing references) + //IL_00d8: Unknown result type (might be due to invalid IL or missing references) + //IL_00e2: Unknown result type (might be due to invalid IL or missing references) + //IL_00e9: Unknown result type (might be due to invalid IL or missing references) + //IL_00f0: Unknown result type (might be due to invalid IL or missing references) + //IL_00fa: Expected O, but got Unknown + TipoArquivoDigital tela = (TipoArquivoDigital)Enum.Parse(typeof(TipoArquivoDigital), x); + long id = 0L; + bool consultar = true; + bool incluir = true; + bool excluir = true; + if (permissoes.Count > 0 && permissoes.Any((PermissaoArquivoDigital y) => y.Tela == tela)) + { + id = ((DomainBase)permissoes.First((PermissaoArquivoDigital y) => y.Tela == tela)).Id; + consultar = permissoes.First((PermissaoArquivoDigital y) => y.Tela == tela).Consultar; + incluir = permissoes.First((PermissaoArquivoDigital y) => y.Tela == tela).Incluir; + excluir = permissoes.First((PermissaoArquivoDigital y) => y.Tela == tela).Excluir; + } + PermissaoArquivoDigital item = new PermissaoArquivoDigital + { + Id = id, + Tela = tela, + Consultar = consultar, + Incluir = incluir, + Excluir = excluir + }; + list.Add(item); + }); + return list; + } + + private async Task> GetPermissoes(Usuario usuario, string modulo) + { + List list = new List(); + List telas = (from TipoTela v in Enum.GetValues(typeof(TipoTela)) + select ((object)(TipoTela)(ref v)).ToString() into x + orderby x + select x).ToList(); + List permissoes = await ServicoPermissUsuario.PermissUsuario(usuario); + telas.ForEach(delegate(string x) + { + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Unknown result type (might be due to invalid IL or missing references) + //IL_010d: Unknown result type (might be due to invalid IL or missing references) + //IL_0112: Unknown result type (might be due to invalid IL or missing references) + //IL_0119: Unknown result type (might be due to invalid IL or missing references) + //IL_011b: Unknown result type (might be due to invalid IL or missing references) + //IL_0125: Unknown result type (might be due to invalid IL or missing references) + //IL_012c: Unknown result type (might be due to invalid IL or missing references) + //IL_0133: Unknown result type (might be due to invalid IL or missing references) + //IL_013b: Unknown result type (might be due to invalid IL or missing references) + //IL_0145: Expected O, but got Unknown + TipoTela tela = (TipoTela)Enum.Parse(typeof(TipoTela), x); + if (string.Equals(ValidationHelper.GetCategory((Enum)(object)tela), modulo, StringComparison.CurrentCultureIgnoreCase)) + { + long id = 0L; + bool consultar = true; + bool incluir = true; + bool alterar = true; + bool excluir = true; + if (permissoes.Count > 0 && permissoes.Any((PermissaoUsuario y) => y.Tela == tela)) + { + id = ((DomainBase)permissoes.First((PermissaoUsuario y) => y.Tela == tela)).Id; + consultar = permissoes.First((PermissaoUsuario y) => y.Tela == tela).Consultar; + incluir = permissoes.First((PermissaoUsuario y) => y.Tela == tela).Incluir; + alterar = permissoes.First((PermissaoUsuario y) => y.Tela == tela).Alterar; + excluir = permissoes.First((PermissaoUsuario y) => y.Tela == tela).Excluir; + } + PermissaoUsuario item = new PermissaoUsuario + { + Id = id, + Tela = tela, + Consultar = consultar, + Incluir = incluir, + Alterar = alterar, + Excluir = excluir + }; + list.Add(item); + } + }); + return list; + } + + private async Task> GetRestricoes(Usuario usuario, string modulo) + { + List list = new List(); + List tipos = (from TipoRestricao v in Enum.GetValues(typeof(TipoRestricao)) + select ((object)(TipoRestricao)(ref v)).ToString() into x + orderby x + select x).ToList(); + List restricoesUsuario = await ServicoRestriUsuario.BuscarRestricoes(((DomainBase)usuario).Id); + tipos.ForEach(delegate(string x) + { + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Unknown result type (might be due to invalid IL or missing references) + //IL_0041: Unknown result type (might be due to invalid IL or missing references) + //IL_00b7: Unknown result type (might be due to invalid IL or missing references) + //IL_00bc: Unknown result type (might be due to invalid IL or missing references) + //IL_00c3: Unknown result type (might be due to invalid IL or missing references) + //IL_00c5: Unknown result type (might be due to invalid IL or missing references) + //IL_00cf: Unknown result type (might be due to invalid IL or missing references) + //IL_00d6: Unknown result type (might be due to invalid IL or missing references) + //IL_00df: Expected O, but got Unknown + TipoRestricao tipo = (TipoRestricao)Enum.Parse(typeof(TipoRestricao), x); + if (string.Equals(ValidationHelper.GetCategory((Enum)(object)tipo), modulo, StringComparison.CurrentCultureIgnoreCase)) + { + string help = ValidationHelper.GetHelp((Enum)(object)tipo); + long id = 0L; + bool restricao = false; + if (restricoesUsuario.Count > 0 && restricoesUsuario.Any((RestricaoUsuario y) => y.Tipo == tipo)) + { + id = ((DomainBase)restricoesUsuario.First((RestricaoUsuario y) => y.Tipo == tipo)).Id; + restricao = restricoesUsuario.First((RestricaoUsuario y) => y.Tipo == tipo).Restricao; + } + RestricaoUsuario item = new RestricaoUsuario + { + Id = id, + Tipo = tipo, + Restricao = restricao, + Ajuda = help + }; + list.Add(item); + } + }); + return list; + } + + private async Task> GetRestricoesCamposRelatorios(Usuario usuario) + { + List list = new List(); + List parametros = new List(); + foreach (Relatorio item2 in Enum.GetValues(typeof(Relatorio)).Cast()) + { + switch ((int)item2) + { + case 0: + case 1: + parametros.AddRange(Funcoes.ColunasRelatorio(item2, new List())); + break; + case 2: + parametros.AddRange(Funcoes.ColunasRelatorio(item2, new List())); + break; + case 3: + parametros.AddRange(Funcoes.ColunasRelatorio(item2, new List())); + break; + case 18: + parametros.AddRange(Funcoes.ColunasRelatorio(item2, new List())); + break; + case 4: + parametros.AddRange(Funcoes.ColunasRelatorio(item2, new List())); + break; + case 5: + parametros.AddRange(Funcoes.ColunasRelatorio(item2, new List())); + break; + case 6: + case 16: + parametros.AddRange(Funcoes.ColunasRelatorio(item2, new List())); + break; + case 9: + case 10: + parametros.AddRange(Funcoes.ColunasRelatorio(item2, new List())); + break; + case 23: + parametros.AddRange(Funcoes.ColunasRelatorio(item2, new List())); + break; + case 8: + parametros.AddRange(Funcoes.ColunasRelatorio(item2, new List())); + break; + case 13: + parametros.AddRange(Funcoes.ColunasRelatorio(item2, new List())); + break; + case 12: + parametros.AddRange(Funcoes.ColunasRelatorio(item2, new List())); + break; + case 14: + parametros.AddRange(Funcoes.ColunasRelatorio(item2, new List())); + break; + case 15: + parametros.AddRange(Funcoes.ColunasRelatorio(item2, new List())); + break; + case 11: + parametros.AddRange(Funcoes.ColunasRelatorio(item2, new List())); + break; + case 17: + parametros.AddRange(Funcoes.ColunasRelatorio(item2, new List())); + break; + case 27: + parametros.AddRange(Funcoes.ColunasRelatorio(item2, new List())); + break; + case 7: + parametros.AddRange(Funcoes.ColunasRelatorio(item2, new List())); + break; + case 19: + parametros.AddRange(Funcoes.ColunasRelatorio(item2, new List())); + break; + case 20: + parametros.AddRange(Funcoes.ColunasRelatorio(item2, new List())); + break; + } + } + List restricoesUsuario = await ServicoRestriUsuario.BuscarRestricoesCamposRelatorios(((DomainBase)usuario).Id); + parametros.ForEach(delegate(ParametrosRelatorio x) + { + //IL_0073: Unknown result type (might be due to invalid IL or missing references) + //IL_0078: Unknown result type (might be due to invalid IL or missing references) + //IL_007f: Unknown result type (might be due to invalid IL or missing references) + //IL_0090: Unknown result type (might be due to invalid IL or missing references) + //IL_0097: Unknown result type (might be due to invalid IL or missing references) + //IL_00a1: Unknown result type (might be due to invalid IL or missing references) + //IL_00a9: Expected O, but got Unknown + long id = 0L; + bool restricao = false; + if (restricoesUsuario.Count > 0 && restricoesUsuario.Any((RestricaoUsuarioCamposRelatorios y) => y.Campo == x.Header && y.Relatorio == x.Relatorio)) + { + id = ((DomainBase)restricoesUsuario.First((RestricaoUsuarioCamposRelatorios y) => y.Campo == x.Header && y.Relatorio == x.Relatorio)).Id; + restricao = restricoesUsuario.First((RestricaoUsuarioCamposRelatorios y) => y.Campo == x.Header && y.Relatorio == x.Relatorio).Restricao; + } + RestricaoUsuarioCamposRelatorios item = new RestricaoUsuarioCamposRelatorios + { + Id = id, + Campo = x.Header, + Relatorio = x.Relatorio, + Restricao = restricao + }; + list.Add(item); + }); + return list; + } + + public async Task Salvar(long? idUsuario = null, bool registrar = true) + { + PermissaoUsuario obj = ServicoPermissUsuario.BuscarPermissao(Recursos.Usuario, (TipoTela)43); + if (obj != null && !obj.Alterar && !Recursos.Usuario.Administrador) + { + await ShowMessage("VOCÊ NÃO TEM PERMISSÃO PARA ALTERAR PERMISSÕES!"); + return false; + } + Usuario usuario = await _servicoUsuario.BuscarUsuarioPorId(idUsuario ?? ((DomainBase)_selectedUsuario).Id); + List prevPer = new List(); + List list = prevPer; + list.AddRange(await GetPermissoes(usuario, "seguros")); + list = prevPer; + list.AddRange(await GetPermissoes(usuario, "ferramentas")); + List prevPerArquivoDigital = new List(); + List list2 = prevPerArquivoDigital; + list2.AddRange(await GetPermissoesArquivoDigital(usuario)); + List permissao = ((IEnumerable)ArquivosDigitais).Select((Func)((PermissaoArquivoDigital x) => new PermissaoArquivoDigital + { + Id = ((prevPerArquivoDigital.Count == 0) ? 0 : ((DomainBase)prevPerArquivoDigital.First((PermissaoArquivoDigital y) => y.Tela == x.Tela)).Id), + Tela = x.Tela, + Consultar = x.Consultar, + Incluir = x.Incluir, + Excluir = x.Excluir, + Usuario = usuario + })).ToList(); + List permissoes = new List(); + List collection = ((IEnumerable)Seguros).Select((Func)((PermissaoUsuario x) => new PermissaoUsuario + { + Id = ((prevPer.Count == 0) ? 0 : ((DomainBase)prevPer.First((PermissaoUsuario y) => y.Tela == x.Tela)).Id), + Tela = x.Tela, + Consultar = x.Consultar, + Incluir = x.Incluir, + Alterar = x.Alterar, + Excluir = x.Excluir, + Usuario = usuario + })).ToList(); + permissoes.AddRange(collection); + collection = ((IEnumerable)Ferramentas).Select((Func)((PermissaoUsuario x) => new PermissaoUsuario + { + Id = ((prevPer.Count == 0) ? 0 : ((DomainBase)prevPer.First((PermissaoUsuario y) => y.Tela == x.Tela)).Id), + Tela = x.Tela, + Consultar = x.Consultar, + Incluir = x.Incluir, + Alterar = x.Alterar, + Excluir = x.Excluir, + Usuario = usuario + })).ToList(); + permissoes.AddRange(collection); + Usuario obj2 = usuario; + PermissaoAggilizador selectedPermissao = SelectedPermissao; + obj2.PermissaoAggilizador = ((selectedPermissao != null) ? ((DomainBase)selectedPermissao).Id : 0); + usuario.Administrador = AdmUsuario; + await ServicoPermissArquivoDigital.SavePermiss(permissao, prevPerArquivoDigital); + if (!ServicoPermissArquivoDigital.Sucesso) + { + return false; + } + await ServicoPermissUsuario.SavePermiss(permissoes, prevPer); + if (!ServicoPermissUsuario.Sucesso) + { + return false; + } + await _servicoUsuario.Save(usuario); + if (!_servicoUsuario.Sucesso) + { + return false; + } + if (((DomainBase)Recursos.Usuario).Id == ((DomainBase)_selectedUsuario).Id) + { + Recursos.Usuario = usuario; + } + List prevRes = new List(); + List list3 = prevRes; + list3.AddRange(await GetRestricoes(usuario, "b.i.")); + list3 = prevRes; + list3.AddRange(await GetRestricoes(usuario, "seguros")); + list3 = prevRes; + list3.AddRange(await GetRestricoes(usuario, "relatorios")); + list3 = prevRes; + list3.AddRange(await GetRestricoes(usuario, "financeiro")); + list3 = prevRes; + list3.AddRange(await GetRestricoes(usuario, "ferramentas")); + list3 = prevRes; + list3.AddRange(await GetRestricoes(usuario, "ajuda")); + list3 = prevRes; + list3.AddRange(await GetRestricoes(usuario, "totalizacoesRelatorios")); + list3 = prevRes; + list3.AddRange(await GetRestricoes(usuario, "camposRelatorios")); + List prevResCamposRelatorios = new List(); + List list4 = prevResCamposRelatorios; + list4.AddRange(await GetRestricoesCamposRelatorios(usuario)); + List list5 = new List(); + List restricoesCamposRelatorios = new List(); + List collection2 = ((IEnumerable)RestricoesBis).Select((Func)((RestricaoUsuario x) => new RestricaoUsuario + { + Id = ((prevRes.Count == 0) ? 0 : ((DomainBase)prevRes.First((RestricaoUsuario y) => y.Tipo == x.Tipo)).Id), + Tipo = x.Tipo, + Restricao = x.Restricao, + Usuario = usuario + })).ToList(); + list5.AddRange(collection2); + collection2 = ((IEnumerable)RestricoesSeguros).Select((Func)((RestricaoUsuario x) => new RestricaoUsuario + { + Id = ((prevRes.Count == 0) ? 0 : ((DomainBase)prevRes.First((RestricaoUsuario y) => y.Tipo == x.Tipo)).Id), + Tipo = x.Tipo, + Restricao = x.Restricao, + Usuario = usuario + })).ToList(); + list5.AddRange(collection2); + collection2 = ((IEnumerable)RestricoesRelatorios).Select((Func)((RestricaoUsuario x) => new RestricaoUsuario + { + Id = ((prevRes.Count == 0) ? 0 : ((DomainBase)prevRes.First((RestricaoUsuario y) => y.Tipo == x.Tipo)).Id), + Tipo = x.Tipo, + Restricao = x.Restricao, + Usuario = usuario + })).ToList(); + list5.AddRange(collection2); + collection2 = ((IEnumerable)RestricoesTotalizacoesRelatorios).Select((Func)((RestricaoUsuario x) => new RestricaoUsuario + { + Id = ((prevRes.Count == 0) ? 0 : ((DomainBase)prevRes.First((RestricaoUsuario y) => y.Tipo == x.Tipo)).Id), + Tipo = x.Tipo, + Restricao = x.Restricao, + Usuario = usuario + })).ToList(); + list5.AddRange(collection2); + collection2 = ((IEnumerable)RestricoesFinanceiros).Select((Func)((RestricaoUsuario x) => new RestricaoUsuario + { + Id = ((prevRes.Count == 0) ? 0 : ((DomainBase)prevRes.First((RestricaoUsuario y) => y.Tipo == x.Tipo)).Id), + Tipo = x.Tipo, + Restricao = x.Restricao, + Usuario = usuario + })).ToList(); + list5.AddRange(collection2); + collection2 = ((IEnumerable)RestricoesFerramentas).Select((Func)((RestricaoUsuario x) => new RestricaoUsuario + { + Id = ((prevRes.Count == 0) ? 0 : ((DomainBase)prevRes.First((RestricaoUsuario y) => y.Tipo == x.Tipo)).Id), + Tipo = x.Tipo, + Restricao = x.Restricao, + Usuario = usuario + })).ToList(); + list5.AddRange(collection2); + collection2 = ((IEnumerable)RestricoesAjudas).Select((Func)((RestricaoUsuario x) => new RestricaoUsuario + { + Id = ((prevRes.Count == 0) ? 0 : ((DomainBase)prevRes.First((RestricaoUsuario y) => y.Tipo == x.Tipo)).Id), + Tipo = x.Tipo, + Restricao = x.Restricao, + Usuario = usuario + })).ToList(); + list5.AddRange(collection2); + List collection3 = ((IEnumerable)RestricoesCamposRelatorios).Select((Func)((RestricaoUsuarioCamposRelatorios x) => new RestricaoUsuarioCamposRelatorios + { + Id = ((prevResCamposRelatorios.Count == 0) ? 0 : ((DomainBase)prevResCamposRelatorios.First((RestricaoUsuarioCamposRelatorios y) => y.Campo == x.Campo && y.Relatorio == x.Relatorio)).Id), + Campo = x.Campo, + Restricao = x.Restricao, + Relatorio = x.Relatorio, + Usuario = usuario + })).ToList(); + restricoesCamposRelatorios.AddRange(collection3); + await ServicoRestriUsuario.SaveRestri(list5, prevRes); + if (!ServicoRestriUsuario.Sucesso) + { + return false; + } + await ServicoRestriUsuario.SaveRestriCamposRelatorios(restricoesCamposRelatorios, prevResCamposRelatorios); + if (!ServicoRestriUsuario.Sucesso) + { + return false; + } + if (registrar) + { + RegistrarAcao("ALTEROU PERMISSÕES/RESTRIÇÕES DO USUÁRIO \"" + SelectedUsuario.Nome + "\"", ((DomainBase)SelectedUsuario).Id, (TipoTela)43, "ACESSE O LOG DE ALTERAÇÕES NA TELA DE PERMISSÕES/RESTRIÇÕES PARA VER EXATAMENTE O QUE FOI ALTERADO."); + } + return true; + } + + internal async Task> FiltrarRestricoesBi(string value) + { + return await Task.Run(() => FiltrarRestricoesBis(value)); + } + + internal async Task> FiltrarRestricoesSeguro(string value) + { + return await Task.Run(() => FiltrarRestricoesSeguros(value)); + } + + internal async Task> FiltrarRestricoesRelatorio(string value) + { + return await Task.Run(() => FiltrarRestricoesRelatorios(value)); + } + + internal async Task> FiltrarRestricoesTotalizacoesRelatorio(string value) + { + return await Task.Run(() => FiltrarRestricoesTotalizacoesRelatorios(value)); + } + + internal async Task> FiltrarRestricoesCamposRelatorio(string value) + { + return await Task.Run(() => FiltrarRestricoesCamposRelatorios(value)); + } + + internal async Task> FiltrarRestricoesFinanceiro(string value) + { + return await Task.Run(() => FiltrarRestricoesFinanceiros(value)); + } + + internal async Task> FiltrarRestricoesFerramenta(string value) + { + return await Task.Run(() => FiltrarRestricoesFerramentas(value)); + } + + internal async Task> FiltrarRestricoesAjuda(string value) + { + return await Task.Run(() => FiltrarRestricoesAjudas(value)); + } + + public List FiltrarRestricoesBis(string filter) + { + RestricoesBisFiltradas = ((filter == "") ? new ObservableCollection(RestricoesBis) : new ObservableCollection(RestricoesBis.Where((RestricaoUsuario x) => ValidationHelper.RemoveDiacritics(ValidationHelper.GetDescription((Enum)(object)x.Tipo).Trim()).ToUpper().Contains(filter.ToUpper())))); + ExpandedBis = RestricoesBisFiltradas.Count > 0 && filter != ""; + if (!(filter == "")) + { + return RestricoesBisFiltradas.ToList(); + } + return null; + } + + public List FiltrarRestricoesSeguros(string filter) + { + RestricoesSegurosFiltradas = ((filter == "") ? new ObservableCollection(RestricoesSeguros) : new ObservableCollection(RestricoesSeguros.Where((RestricaoUsuario x) => ValidationHelper.RemoveDiacritics(ValidationHelper.GetDescription((Enum)(object)x.Tipo).Trim()).ToUpper().Contains(filter.ToUpper())))); + ExpandedSeguros = RestricoesSegurosFiltradas.Count > 0 && filter != ""; + if (!(filter == "")) + { + return RestricoesSegurosFiltradas.ToList(); + } + return null; + } + + public List FiltrarRestricoesRelatorios(string filter) + { + RestricoesRelatoriosFiltrados = ((filter == "") ? new ObservableCollection(RestricoesRelatorios) : new ObservableCollection(RestricoesRelatorios.Where((RestricaoUsuario x) => ValidationHelper.RemoveDiacritics(ValidationHelper.GetDescription((Enum)(object)x.Tipo).Trim()).ToUpper().Contains(filter.ToUpper())))); + ExpandedRelatorios = RestricoesRelatoriosFiltrados.Count > 0 && filter != ""; + if (!(filter == "")) + { + return RestricoesRelatoriosFiltrados.ToList(); + } + return null; + } + + public List FiltrarRestricoesTotalizacoesRelatorios(string filter) + { + RestricoesTotalizacoesRelatoriosFiltrados = ((filter == "") ? new ObservableCollection(RestricoesTotalizacoesRelatorios) : new ObservableCollection(RestricoesTotalizacoesRelatorios.Where((RestricaoUsuario x) => ValidationHelper.RemoveDiacritics(ValidationHelper.GetDescription((Enum)(object)x.Tipo).Trim()).ToUpper().Contains(filter.ToUpper())))); + ExpandedTotalizacoes = RestricoesTotalizacoesRelatoriosFiltrados.Count > 0 && filter != ""; + if (!(filter == "")) + { + return RestricoesTotalizacoesRelatoriosFiltrados.ToList(); + } + return null; + } + + public List FiltrarRestricoesCamposRelatorios(string filter) + { + RestricoesCamposRelatoriosFiltrados = ((filter == "") ? new ObservableCollection(RestricoesCamposRelatorios) : new ObservableCollection(RestricoesCamposRelatorios.Where((RestricaoUsuarioCamposRelatorios x) => ValidationHelper.RemoveDiacritics(x.Campo.ToUpper().Trim()).Contains(filter.ToUpper()) || ValidationHelper.RemoveDiacritics(ValidationHelper.GetDescription((Enum)(object)x.Relatorio).Trim()).ToUpper().Contains(filter.ToUpper())))); + ExpandedCampos = RestricoesCamposRelatoriosFiltrados.Count > 0 && filter != ""; + if (!(filter == "")) + { + return RestricoesCamposRelatoriosFiltrados.ToList(); + } + return null; + } + + public List FiltrarRestricoesFinanceiros(string filter) + { + RestricoesFinanceirosFiltradas = ((filter == "") ? new ObservableCollection(RestricoesFinanceiros) : new ObservableCollection(RestricoesFinanceiros.Where((RestricaoUsuario x) => ValidationHelper.RemoveDiacritics(ValidationHelper.GetDescription((Enum)(object)x.Tipo).Trim()).ToUpper().Contains(filter.ToUpper())))); + ExpandedFinanceiros = RestricoesFinanceirosFiltradas.Count > 0 && filter != ""; + if (!(filter == "")) + { + return RestricoesFinanceirosFiltradas.ToList(); + } + return null; + } + + public List FiltrarRestricoesFerramentas(string filter) + { + RestricoesFerramentasFiltradas = ((filter == "") ? new ObservableCollection(RestricoesFerramentas) : new ObservableCollection(RestricoesFerramentas.Where((RestricaoUsuario x) => ValidationHelper.RemoveDiacritics(ValidationHelper.GetDescription((Enum)(object)x.Tipo).Trim()).ToUpper().Contains(filter.ToUpper())))); + ExpandedFerramentas = RestricoesFerramentasFiltradas.Count > 0 && filter != ""; + if (!(filter == "")) + { + return RestricoesFerramentasFiltradas.ToList(); + } + return null; + } + + public List FiltrarRestricoesAjudas(string filter) + { + RestricoesAjudasFiltrados = ((filter == "") ? new ObservableCollection(RestricoesAjudas) : new ObservableCollection(RestricoesAjudas.Where((RestricaoUsuario x) => ValidationHelper.RemoveDiacritics(ValidationHelper.GetDescription((Enum)(object)x.Tipo).Trim()).ToUpper().Contains(filter.ToUpper())))); + ExpandedAjudas = RestricoesAjudasFiltrados.Count > 0 && filter != ""; + if (!(filter == "")) + { + return RestricoesAjudasFiltrados.ToList(); + } + return null; + } + + public bool CopiarPermissoes(Tuple, Usuario, List, List, List> copiarPermiss) + { + if (copiarPermiss.Item1.Count > 0) + { + copiarPermiss.Item1.ForEach(delegate(PermissaoUsuario x) + { + Seguros.ToList().ForEach(delegate(PermissaoUsuario y) + { + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + if (x.Tela == y.Tela) + { + y.Consultar = x.Consultar; + y.Incluir = x.Incluir; + y.Alterar = x.Alterar; + y.Excluir = x.Excluir; + y.Usuario = _selectedUsuario; + } + }); + Ferramentas.ToList().ForEach(delegate(PermissaoUsuario y) + { + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + if (x.Tela == y.Tela) + { + y.Consultar = x.Consultar; + y.Incluir = x.Incluir; + y.Alterar = x.Alterar; + y.Excluir = x.Excluir; + y.Usuario = _selectedUsuario; + } + }); + }); + } + else + { + Seguros.ToList().ForEach(delegate(PermissaoUsuario x) + { + x.Consultar = false; + x.Incluir = false; + x.Alterar = false; + x.Excluir = false; + x.Usuario = _selectedUsuario; + }); + Ferramentas.ToList().ForEach(delegate(PermissaoUsuario x) + { + x.Consultar = false; + x.Incluir = false; + x.Alterar = false; + x.Excluir = false; + x.Usuario = _selectedUsuario; + }); + } + if (copiarPermiss.Item4.Count > 0) + { + copiarPermiss.Item4.ForEach(delegate(PermissaoArquivoDigital x) + { + ArquivosDigitais.ToList().ForEach(delegate(PermissaoArquivoDigital y) + { + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + if (x.Tela == y.Tela) + { + y.Consultar = x.Consultar; + y.Incluir = x.Incluir; + y.Excluir = x.Excluir; + y.Usuario = _selectedUsuario; + } + }); + }); + } + else + { + ArquivosDigitais.ToList().ForEach(delegate(PermissaoArquivoDigital x) + { + x.Consultar = false; + x.Incluir = false; + x.Excluir = false; + x.Usuario = _selectedUsuario; + }); + } + SelectedPermissao = (copiarPermiss.Item2.PermissaoAggilizador.HasValue ? ((IEnumerable)PermissaoAggilizador).FirstOrDefault((Func)((PermissaoAggilizador x) => ((DomainBase)x).Id == copiarPermiss.Item2.PermissaoAggilizador)) : null); + copiarPermiss.Item3.ForEach(delegate(RestricaoUsuario x) + { + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Unknown result type (might be due to invalid IL or missing references) + //IL_007b: Unknown result type (might be due to invalid IL or missing references) + //IL_0081: Unknown result type (might be due to invalid IL or missing references) + //IL_00da: Unknown result type (might be due to invalid IL or missing references) + //IL_00e0: Unknown result type (might be due to invalid IL or missing references) + //IL_013b: Unknown result type (might be due to invalid IL or missing references) + //IL_0141: Unknown result type (might be due to invalid IL or missing references) + //IL_019e: Unknown result type (might be due to invalid IL or missing references) + //IL_01a4: Unknown result type (might be due to invalid IL or missing references) + //IL_0201: Unknown result type (might be due to invalid IL or missing references) + //IL_0207: Unknown result type (might be due to invalid IL or missing references) + //IL_0264: Unknown result type (might be due to invalid IL or missing references) + //IL_026a: Unknown result type (might be due to invalid IL or missing references) + foreach (RestricaoUsuario restricoesBi in RestricoesBis) + { + if (restricoesBi.Tipo == x.Tipo) + { + restricoesBi.Restricao = x.Restricao; + restricoesBi.Usuario = _selectedUsuario; + } + } + foreach (RestricaoUsuario restricoesSeguro in RestricoesSeguros) + { + if (restricoesSeguro.Tipo == x.Tipo) + { + restricoesSeguro.Restricao = x.Restricao; + restricoesSeguro.Usuario = _selectedUsuario; + } + } + foreach (RestricaoUsuario restricoesRelatorio in RestricoesRelatorios) + { + if (restricoesRelatorio.Tipo == x.Tipo) + { + restricoesRelatorio.Restricao = x.Restricao; + restricoesRelatorio.Usuario = _selectedUsuario; + } + } + foreach (RestricaoUsuario restricoesTotalizacoesRelatorio in RestricoesTotalizacoesRelatorios) + { + if (restricoesTotalizacoesRelatorio.Tipo == x.Tipo) + { + restricoesTotalizacoesRelatorio.Restricao = x.Restricao; + restricoesTotalizacoesRelatorio.Usuario = _selectedUsuario; + } + } + foreach (RestricaoUsuario restricoesFinanceiro in RestricoesFinanceiros) + { + if (restricoesFinanceiro.Tipo == x.Tipo) + { + restricoesFinanceiro.Restricao = x.Restricao; + restricoesFinanceiro.Usuario = _selectedUsuario; + } + } + foreach (RestricaoUsuario restricoesFerramenta in RestricoesFerramentas) + { + if (restricoesFerramenta.Tipo == x.Tipo) + { + restricoesFerramenta.Restricao = x.Restricao; + restricoesFerramenta.Usuario = _selectedUsuario; + } + } + foreach (RestricaoUsuario restricoesAjuda in RestricoesAjudas) + { + if (restricoesAjuda.Tipo == x.Tipo) + { + restricoesAjuda.Restricao = x.Restricao; + restricoesAjuda.Usuario = _selectedUsuario; + } + } + }); + copiarPermiss.Item5.ForEach(delegate(RestricaoUsuarioCamposRelatorios x) + { + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Unknown result type (might be due to invalid IL or missing references) + foreach (RestricaoUsuarioCamposRelatorios restricoesCamposRelatorio in RestricoesCamposRelatorios) + { + if (restricoesCamposRelatorio.Campo == x.Campo && restricoesCamposRelatorio.Relatorio == x.Relatorio) + { + restricoesCamposRelatorio.Restricao = x.Restricao; + restricoesCamposRelatorio.Usuario = _selectedUsuario; + } + } + }); + RegistrarAcao("IMPORTOU PERMISSÕES/RESTRIÇÕES DO USUÁRIO \"" + copiarPermiss.Item2.Nome + "\"", ((DomainBase)SelectedUsuario).Id, (TipoTela)43, $"ID USUÁRIO: {((DomainBase)copiarPermiss.Item2).Id}"); + return true; + } + + public async Task ExportarPermissoes(List usuarios) + { + foreach (Usuario item in usuarios.Where((Usuario x) => x.Selecionado)) + { + await Salvar(((DomainBase)item).Id, registrar: false); + } + RegistrarAcao(string.Format("EXPORTOU PERMISSÕES/RESTRIÇÕES DO USUÁRIO \"{0}\" PARA {1} USUÁRIO{2}", SelectedUsuario.Nome, usuarios.Count, (usuarios.Count == 1) ? "" : "S"), ((DomainBase)SelectedUsuario).Id, (TipoTela)43, "IDS E NOMES DOS USUÁRIOS: " + string.Join("\n", usuarios.Select((Usuario x) => $"{((DomainBase)x).Id}: \"{x.Nome}\""))); + return true; + } + + public void AtivarDesativarPermissoes(bool permiss) + { + AtivarDesativarPermissoesBool = !permiss; + Seguros.ToList().ForEach(delegate(PermissaoUsuario x) + { + x.Consultar = permiss; + x.Incluir = permiss; + x.Alterar = permiss; + x.Excluir = permiss; + }); + Ferramentas.ToList().ForEach(delegate(PermissaoUsuario x) + { + x.Consultar = permiss; + x.Incluir = permiss; + x.Alterar = permiss; + x.Excluir = permiss; + }); + ArquivosDigitais.ToList().ForEach(delegate(PermissaoArquivoDigital x) + { + x.Consultar = permiss; + x.Incluir = permiss; + x.Excluir = permiss; + }); + SelectedPermissao = (permiss ? ((IEnumerable)PermissaoAggilizador).FirstOrDefault((Func)((PermissaoAggilizador x) => x.Descricao == "ADMINISTRADOR")) : null); + Seguros = new ObservableCollection(Seguros); + Ferramentas = new ObservableCollection(Ferramentas); + ArquivosDigitais = new ObservableCollection(ArquivosDigitais); + } + + public void AtivarDesativarRestricoes(bool restricao) + { + AtivarDesativarRestricoesBool = !restricao; + foreach (RestricaoUsuario restricoesBisFiltrada in RestricoesBisFiltradas) + { + restricoesBisFiltrada.Restricao = restricao; + } + foreach (RestricaoUsuario restricoesSegurosFiltrada in RestricoesSegurosFiltradas) + { + restricoesSegurosFiltrada.Restricao = restricao; + } + foreach (RestricaoUsuario restricoesRelatoriosFiltrado in RestricoesRelatoriosFiltrados) + { + restricoesRelatoriosFiltrado.Restricao = restricao; + } + foreach (RestricaoUsuario restricoesTotalizacoesRelatoriosFiltrado in RestricoesTotalizacoesRelatoriosFiltrados) + { + restricoesTotalizacoesRelatoriosFiltrado.Restricao = restricao; + } + foreach (RestricaoUsuarioCamposRelatorios restricoesCamposRelatoriosFiltrado in RestricoesCamposRelatoriosFiltrados) + { + restricoesCamposRelatoriosFiltrado.Restricao = restricao; + } + foreach (RestricaoUsuario restricoesFinanceirosFiltrada in RestricoesFinanceirosFiltradas) + { + restricoesFinanceirosFiltrada.Restricao = restricao; + } + foreach (RestricaoUsuario restricoesFerramentasFiltrada in RestricoesFerramentasFiltradas) + { + restricoesFerramentasFiltrada.Restricao = restricao; + } + foreach (RestricaoUsuario restricoesAjudasFiltrado in RestricoesAjudasFiltrados) + { + restricoesAjudasFiltrado.Restricao = restricao; + } + RestricoesBisFiltradas = new ObservableCollection(RestricoesBisFiltradas); + RestricoesSegurosFiltradas = new ObservableCollection(RestricoesSegurosFiltradas); + RestricoesRelatoriosFiltrados = new ObservableCollection(RestricoesRelatoriosFiltrados); + RestricoesTotalizacoesRelatoriosFiltrados = new ObservableCollection(RestricoesTotalizacoesRelatoriosFiltrados); + RestricoesCamposRelatoriosFiltrados = new ObservableCollection(RestricoesCamposRelatoriosFiltrados); + RestricoesFinanceirosFiltradas = new ObservableCollection(RestricoesFinanceirosFiltradas); + RestricoesFerramentasFiltradas = new ObservableCollection(RestricoesFerramentasFiltradas); + RestricoesAjudasFiltrados = new ObservableCollection(RestricoesAjudasFiltrados); + } + + public void AtivarDesativarRestricoes() + { + if (RestricoesBisFiltradas != null && RestricoesAjudasFiltrados != null && RestricoesSegurosFiltradas != null && RestricoesRelatoriosFiltrados != null && RestricoesFinanceirosFiltradas != null && RestricoesFerramentasFiltradas != null && RestricoesTotalizacoesRelatoriosFiltrados != null && RestricoesCamposRelatoriosFiltrados != null && RestricoesBisFiltradas.All((RestricaoUsuario x) => x.Restricao) && RestricoesAjudasFiltrados.All((RestricaoUsuario x) => x.Restricao) && RestricoesSegurosFiltradas.All((RestricaoUsuario x) => x.Restricao) && RestricoesRelatoriosFiltrados.All((RestricaoUsuario x) => x.Restricao) && RestricoesFinanceirosFiltradas.All((RestricaoUsuario x) => x.Restricao) && RestricoesFerramentasFiltradas.All((RestricaoUsuario x) => x.Restricao) && RestricoesTotalizacoesRelatoriosFiltrados.All((RestricaoUsuario x) => x.Restricao) && RestricoesCamposRelatoriosFiltrados.All((RestricaoUsuarioCamposRelatorios x) => x.Restricao)) + { + AtivarDesativarRestricoesBool = false; + } + } + + public void DesabilitarArquivoDigital(PermissaoArquivoDigital desabilitar) + { + PermissaoArquivoDigital val = ArquivosDigitais.First((PermissaoArquivoDigital x) => x.Tela == desabilitar.Tela); + if (val.Incluir || val.Excluir) + { + val.Incluir = false; + val.Excluir = false; + ArquivosDigitais = new ObservableCollection(ArquivosDigitais); + } + } + + public void DesabilitarConsulta(PermissaoUsuario desabilitar, string source) + { + if (!(source == "Ferramentas")) + { + PermissaoUsuario val = Seguros.First((PermissaoUsuario x) => x.Tela == desabilitar.Tela); + if (val.Incluir || val.Alterar || val.Excluir) + { + val.Alterar = false; + val.Incluir = false; + val.Excluir = false; + Seguros = new ObservableCollection(Seguros); + } + } + else + { + PermissaoUsuario val2 = Ferramentas.First((PermissaoUsuario x) => x.Tela == desabilitar.Tela); + if (val2.Incluir || val2.Alterar || val2.Excluir) + { + val2.Alterar = false; + val2.Incluir = false; + val2.Excluir = false; + Ferramentas = new ObservableCollection(Ferramentas); + } + } + } + + public void HabilitarArquivoDigital(PermissaoArquivoDigital habilitar) + { + PermissaoArquivoDigital val = ArquivosDigitais.First((PermissaoArquivoDigital x) => x.Tela == habilitar.Tela); + if (!val.Consultar) + { + val.Consultar = true; + ArquivosDigitais = new ObservableCollection(ArquivosDigitais); + } + } + + public void HabilitarConsulta(PermissaoUsuario habilitar, string source) + { + if (!(source == "Ferramentas")) + { + PermissaoUsuario val = Seguros.First((PermissaoUsuario x) => x.Tela == habilitar.Tela); + if (!val.Consultar) + { + val.Consultar = true; + Seguros = new ObservableCollection(Seguros); + } + } + else + { + PermissaoUsuario val2 = Ferramentas.First((PermissaoUsuario x) => x.Tela == habilitar.Tela); + if (!val2.Consultar) + { + val2.Consultar = true; + Ferramentas = new ObservableCollection(Ferramentas); + } + } + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Drawer/TarefaDrawerViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Drawer/TarefaDrawerViewModel.cs new file mode 100644 index 0000000..4231c90 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Drawer/TarefaDrawerViewModel.cs @@ -0,0 +1,1064 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.Helper; + +namespace Gestor.Application.ViewModels.Drawer; + +public class TarefaDrawerViewModel : BaseTarefaViewModel +{ + private bool _enableMenu = true; + + private GridLength _dados = new GridLength(0.0, (GridUnitType)1); + + private GridLength _grid = new GridLength(1.0, (GridUnitType)2); + + private GridLength _anotacoesLength = new GridLength(0.0, (GridUnitType)1); + + private GridLength _descricaoLength = new GridLength(1.0, (GridUnitType)2); + + private GridLength _anotacoesInternasLength = new GridLength(0.0, (GridUnitType)1); + + private GridLength _descricaoInternaLength = new GridLength(1.0, (GridUnitType)2); + + private bool _enableAlterarTarefa = true; + + private Visibility _visibilityMenu; + + private bool _isVisibleDescricao; + + private bool _isSelected; + + private bool _concluido; + + private bool _carregando; + + private string _tituloTarefas; + + private string _titulo; + + private string _subTitulo; + + private Tarefa _tarefa = new Tarefa(); + + private ObservableCollection _tarefasFiltradas = new ObservableCollection(); + + private List _tarefas = new List(); + + private bool _isAnotacoes = true; + + private Tarefa _selectedTarefa; + + private ObservableCollection _usuarios; + + private ObservableCollection _tiposTarefa; + + private List _telefones; + + private DateTime _dataAgendamento = Funcoes.GetNetworkTime(); + + private DateTime _horaAgendamento = Funcoes.GetNetworkTime(); + + private Usuario _selectedUsuario; + + private TipoDeTarefa _selectedTipoTarefa; + + private ArquivoDigital _selectedAnexado = new ArquivoDigital(); + + private ObservableCollection _arquivosAnexados = new ObservableCollection(); + + private List _arquivosFinais = new List(); + + private bool _inclusaoArquivoDigitalEnable = true; + + private new TarefaServico Servico { get; } + + public GridLength Dados + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _dados; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _dados = value; + OnPropertyChanged("Dados"); + } + } + + public GridLength Grid + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _grid; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _grid = value; + OnPropertyChanged("Grid"); + } + } + + public GridLength AnotacoesLength + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _anotacoesLength; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _anotacoesLength = value; + OnPropertyChanged("AnotacoesLength"); + } + } + + public GridLength DescricaoLength + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _descricaoLength; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _descricaoLength = value; + OnPropertyChanged("DescricaoLength"); + } + } + + public GridLength AnotacoesInternasLength + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _anotacoesInternasLength; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _anotacoesInternasLength = value; + OnPropertyChanged("AnotacoesInternasLength"); + } + } + + public GridLength DescricaoInternaLength + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _descricaoInternaLength; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _descricaoInternaLength = value; + OnPropertyChanged("DescricaoInternaLength"); + } + } + + public override bool EnableAlterarTarefa + { + get + { + return _enableAlterarTarefa; + } + set + { + _enableAlterarTarefa = _alterarPermissEnabled && value; + OnPropertyChanged("EnableAlterarTarefa"); + } + } + + public long IdCliente { get; set; } + + private int Index { get; set; } = 1; + + + public Visibility VisibilityMenu + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityMenu; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityMenu = value; + OnPropertyChanged("VisibilityMenu"); + } + } + + public bool IsVisibleDescricao + { + get + { + return _isVisibleDescricao; + } + set + { + _isVisibleDescricao = value; + OnPropertyChanged("IsVisibleDescricao"); + } + } + + public bool IsSelected + { + get + { + return _isSelected; + } + set + { + _isSelected = value; + OnPropertyChanged("IsSelected"); + } + } + + public bool Concluido + { + get + { + return _concluido; + } + set + { + _concluido = value; + OnPropertyChanged("Concluido"); + } + } + + public bool Carregando + { + get + { + return _carregando; + } + set + { + _carregando = value; + base.IsEnabled = !value; + OnPropertyChanged("Carregando"); + } + } + + public string TituloTarefas + { + get + { + return _tituloTarefas; + } + set + { + _tituloTarefas = value; + OnPropertyChanged("TituloTarefas"); + } + } + + public string Titulo + { + get + { + return _titulo; + } + set + { + _titulo = value; + OnPropertyChanged("Titulo"); + } + } + + public string SubTitulo + { + get + { + return _subTitulo; + } + set + { + _subTitulo = value; + OnPropertyChanged("SubTitulo"); + } + } + + public Tarefa Tarefa + { + get + { + return _tarefa; + } + set + { + _tarefa = value; + OnPropertyChanged("Tarefa"); + } + } + + public ObservableCollection TarefasFiltradas + { + get + { + return _tarefasFiltradas; + } + set + { + _tarefasFiltradas = value; + OnPropertyChanged("TarefasFiltradas"); + } + } + + public List Tarefas + { + get + { + return _tarefas; + } + set + { + _tarefas = value; + OnPropertyChanged("Tarefas"); + } + } + + public bool IsAnotacoes + { + get + { + return _isAnotacoes; + } + set + { + _isAnotacoes = value; + OnPropertyChanged("IsAnotacoes"); + } + } + + public override Tarefa SelectedTarefa + { + get + { + return _selectedTarefa; + } + set + { + //IL_007b: Unknown result type (might be due to invalid IL or missing references) + //IL_0081: Invalid comparison between Unknown and I4 + //IL_0147: Unknown result type (might be due to invalid IL or missing references) + //IL_015c: Unknown result type (might be due to invalid IL or missing references) + //IL_0194: Unknown result type (might be due to invalid IL or missing references) + //IL_0183: Unknown result type (might be due to invalid IL or missing references) + //IL_00eb: Unknown result type (might be due to invalid IL or missing references) + //IL_00f0: Unknown result type (might be due to invalid IL or missing references) + //IL_0102: Expected O, but got Unknown + //IL_01cc: Unknown result type (might be due to invalid IL or missing references) + //IL_01bb: Unknown result type (might be due to invalid IL or missing references) + DateTime networkTime = Funcoes.GetNetworkTime(); + IsSelected = value != null; + _selectedTarefa = value; + Tarefa obj = value; + DataAgendamento = ((obj != null) ? obj.Agendamento : networkTime); + Tarefa obj2 = value; + HoraAgendamento = ((obj2 != null) ? obj2.Agendamento : networkTime); + IsVisibleDescricao = value != null; + Tarefa obj3 = value; + Concluido = obj3 != null && (int)obj3.Status == 2; + base.Responsaveis = ((value == null) ? new ObservableCollection() : ((value.Responsaveis == null) ? new ObservableCollection() : new ObservableCollection(value.Responsaveis))); + if (!base.Responsaveis.Any()) + { + Tarefa obj4 = value; + base.Responsaveis = ((((obj4 != null) ? obj4.Usuario : null) == null) ? new ObservableCollection() : new ObservableCollection((IEnumerable)(object)new ResponsavelTarefa[1] + { + new ResponsavelTarefa + { + Usuario = value.Usuario + } + })); + } + if (value != null && ((DomainBase)value).Id > 0) + { + AlterarTamanho(alterar: false); + } + if (value != null) + { + AnotacoesLength = new GridLength(0.0, (GridUnitType)1); + AnotacoesInternasLength = new GridLength(0.0, (GridUnitType)1); + DescricaoLength = (string.IsNullOrWhiteSpace(value.Descricao) ? new GridLength(0.0, (GridUnitType)1) : new GridLength(1.0, (GridUnitType)2)); + DescricaoInternaLength = (string.IsNullOrWhiteSpace(value.DescricaoInterna) ? new GridLength(0.0, (GridUnitType)1) : new GridLength(1.0, (GridUnitType)2)); + } + Tarefa obj5 = value; + if (((obj5 != null) ? obj5.TipoDeTarefa : null) != null) + { + if (TiposTarefa.All((TipoDeTarefa x) => ((DomainBase)x).Id != ((DomainBase)value).Id) && !value.TipoDeTarefa.Ativo) + { + TiposTarefa.Add(value.TipoDeTarefa); + } + else + { + TiposTarefa = new ObservableCollection(TiposTarefa.Where((TipoDeTarefa x) => x.Ativo).ToList()); + } + } + Tarefa obj6 = value; + SelectedTipoTarefa = ((obj6 != null) ? obj6.TipoDeTarefa : null); + if (base.EnableIncluir || base.EnableFields || base.EnableButtons) + { + Tarefa obj7 = value; + VerificarEnables((obj7 != null) ? new long?(((DomainBase)obj7).Id) : null); + } + ValidaPermissaoParaEditarTarefa(); + OnPropertyChanged("SelectedTarefa"); + } + } + + public ObservableCollection Usuarios + { + get + { + return _usuarios; + } + set + { + _usuarios = value; + OnPropertyChanged("Usuarios"); + } + } + + public ObservableCollection TiposTarefa + { + get + { + return _tiposTarefa; + } + set + { + _tiposTarefa = value; + OnPropertyChanged("TiposTarefa"); + } + } + + public List Telefones + { + get + { + return _telefones; + } + set + { + _telefones = value; + OnPropertyChanged("Telefones"); + } + } + + public DateTime DataAgendamento + { + get + { + return _dataAgendamento; + } + set + { + _dataAgendamento = value; + if (SelectedTarefa != null) + { + SelectedTarefa.Agendamento = DateTime.Parse($"{value:d} {SelectedTarefa.Agendamento:T}"); + } + OnPropertyChanged("DataAgendamento"); + } + } + + public DateTime HoraAgendamento + { + get + { + return _horaAgendamento; + } + set + { + _horaAgendamento = value; + if (SelectedTarefa != null) + { + SelectedTarefa.Agendamento = DateTime.Parse($"{SelectedTarefa.Agendamento:d} {value:T}"); + } + OnPropertyChanged("HoraAgendamento"); + } + } + + public Usuario SelectedUsuario + { + get + { + return _selectedUsuario; + } + set + { + _selectedUsuario = value; + OnPropertyChanged("SelectedUsuario"); + } + } + + public TipoDeTarefa SelectedTipoTarefa + { + get + { + return _selectedTipoTarefa; + } + set + { + _selectedTipoTarefa = value; + OnPropertyChanged("SelectedTipoTarefa"); + } + } + + public ArquivoDigital SelectedAnexado + { + get + { + return _selectedAnexado; + } + set + { + _selectedAnexado = value; + OnPropertyChanged("SelectedAnexado"); + } + } + + public ObservableCollection ArquivosAnexados + { + get + { + return _arquivosAnexados; + } + set + { + _arquivosAnexados = value; + OnPropertyChanged("ArquivosAnexados"); + } + } + + public List ArquivosFinais + { + get + { + return _arquivosFinais; + } + set + { + _arquivosFinais = value; + OnPropertyChanged("ArquivosFinais"); + } + } + + public bool InclusaoArquivoDigitalEnable + { + get + { + return _inclusaoArquivoDigitalEnable; + } + set + { + _inclusaoArquivoDigitalEnable = value; + OnPropertyChanged("InclusaoArquivoDigitalEnable"); + } + } + + public TarefaDrawerViewModel(Tarefa tarefa, bool enableMenu) + { + //IL_0012: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + //IL_0027: Unknown result type (might be due to invalid IL or missing references) + //IL_002c: Unknown result type (might be due to invalid IL or missing references) + //IL_003c: Unknown result type (might be due to invalid IL or missing references) + //IL_0041: Unknown result type (might be due to invalid IL or missing references) + //IL_0051: Unknown result type (might be due to invalid IL or missing references) + //IL_0056: Unknown result type (might be due to invalid IL or missing references) + //IL_0066: Unknown result type (might be due to invalid IL or missing references) + //IL_006b: Unknown result type (might be due to invalid IL or missing references) + //IL_007b: Unknown result type (might be due to invalid IL or missing references) + //IL_0080: Unknown result type (might be due to invalid IL or missing references) + //IL_0094: Unknown result type (might be due to invalid IL or missing references) + //IL_009e: Expected O, but got Unknown + //IL_00d2: Unknown result type (might be due to invalid IL or missing references) + //IL_00dc: Expected O, but got Unknown + Servico = new TarefaServico(); + Tarefa = tarefa; + _enableMenu = enableMenu; + CarregarUsuarios(); + TiposTarefa = new ObservableCollection(Recursos.TiposTarefa.Where((TipoDeTarefa x) => x.Ativo).ToList()); + SelecionarTarefas(tarefa, tarefa.Conclusao.HasValue); + TituloTarefas = (tarefa.Conclusao.HasValue ? "TAREFAS CONCLUÍDAS" : "TAREFAS PENDENTES"); + base.EnableMenu = true; + } + + private void CarregarUsuarios() + { + Usuarios = new ObservableCollection((from x in Recursos.Usuarios + where (Recursos.Configuracoes.Any((ConfiguracaoSistema c) => (int)c.Configuracao == 36) || x.IdEmpresa == Recursos.Usuario.IdEmpresa) && !x.Excluido && x.PermissaoAggilizador != 4 + orderby x.Nome + select x).ToList()); + } + + public async void SelecionarTarefas(Tarefa tarefa, bool? concluido) + { + await PermissaoTela((TipoTela)38); + CarregarInformacoes(tarefa); + await CarregarTarefas(tarefa, concluido); + if (((DomainBase)tarefa).Id != 0L && !_enableMenu) + { + VisibilityMenu = (Visibility)2; + } + } + + public async void CarregarInformacoes(Tarefa tarefa) + { + ClienteServico clienteServico = new ClienteServico(); + SubTitulo = ((tarefa.IdEntidade != 0L) ? "TODAS AS TAREFAS PENDENTES DO CLIENTE" : ""); + IdCliente = tarefa.IdCliente; + Titulo = tarefa.Cliente; + Telefones = (await clienteServico.BuscarTelefonesAsync(tarefa.IdCliente)).Where((ClienteTelefone x) => ValidationHelper.ValidacaoTelefone(((TelefoneBase)x).Numero)).Select((Func)((ClienteTelefone x) => new TelefoneBase + { + Tipo = ((TelefoneBase)x).Tipo, + Id = ((DomainBase)x).Id, + Numero = ((TelefoneBase)x).Numero, + Prefixo = ((TelefoneBase)x).Prefixo + })).ToList(); + if (tarefa.IdEntidade == 0L) + { + return; + } + TipoTarefa entidade = tarefa.Entidade; + if ((int)entidade != 0) + { + if ((int)entidade != 4) + { + return; + } + Sinistro val = await new SinistroServico().BuscarSinistro(tarefa.IdEntidade); + if (val != null) + { + IdCliente = ((DomainBase)val.ControleSinistro.Item.Documento.Controle.Cliente).Id; + Titulo = val.ControleSinistro.Item.Documento.Controle.Cliente.Nome; + SubTitulo = "SINISTRO " + val.Numero + " ITEM " + val.ItemSinistrado; + Telefones = (await clienteServico.BuscarTelefonesAsync(IdCliente)).Where((ClienteTelefone x) => ValidationHelper.ValidacaoTelefone(((TelefoneBase)x).Numero)).Select((Func)((ClienteTelefone x) => new TelefoneBase + { + Tipo = ((TelefoneBase)x).Tipo, + Id = ((DomainBase)x).Id, + Numero = ((TelefoneBase)x).Numero, + Prefixo = ((TelefoneBase)x).Prefixo + })).ToList(); + } + } + else + { + Documento val2 = await new ApoliceServico().BuscarApoliceAsync(tarefa.IdEntidade); + IdCliente = ((DomainBase)val2.Controle.Cliente).Id; + Titulo = val2.Controle.Cliente.Nome; + SubTitulo = ((val2.Tipo == 0 && !string.IsNullOrWhiteSpace(val2.Apolice)) ? ("APÓLICE NÚMERO " + val2.Apolice) : ((val2.Tipo > 0) ? ("APÓLICE NÚMERO " + val2.Apolice + " ENDOSSO " + val2.Endosso) : ("PROPOSTA NÚMERO " + val2.Proposta))); + Telefones = (await clienteServico.BuscarTelefonesAsync(((DomainBase)val2.Controle.Cliente).Id)).Where((ClienteTelefone x) => ValidationHelper.ValidacaoTelefone(((TelefoneBase)x).Numero)).Select((Func)((ClienteTelefone x) => new TelefoneBase + { + Tipo = ((TelefoneBase)x).Tipo, + Id = ((DomainBase)x).Id, + Numero = ((TelefoneBase)x).Numero, + Prefixo = ((TelefoneBase)x).Prefixo + })).ToList(); + } + } + + public async Task CarregarTarefas(int index) + { + if (Tarefa.IdEntidade != 0L) + { + Carregando = true; + Tarefa tarefa = new Tarefa + { + Cliente = Tarefa.Cliente, + IdCliente = Tarefa.IdCliente, + Entidade = Tarefa.Entidade, + IdEntidade = Tarefa.IdEntidade + }; + Index = index; + List source; + switch (index) + { + default: + CarregarInformacoes(tarefa); + source = await Servico.BuscarTarefas(Tarefa.Entidade, Tarefa.IdEntidade, true); + break; + case 1: + CarregarInformacoes(tarefa); + source = await Servico.BuscarTarefas(Tarefa.Entidade, Tarefa.IdEntidade, false); + break; + case 2: + tarefa.Entidade = (TipoTarefa)2; + CarregarInformacoes(tarefa); + source = await Servico.BuscarTarefasCliente(Tarefa.IdCliente); + break; + } + Tarefas = source.OrderByDescending((Tarefa x) => x.Agendamento).ToList(); + TarefasFiltradas = new ObservableCollection(Tarefas); + SelectedTarefa = (Tarefa)((TarefasFiltradas == null || TarefasFiltradas.Count == 0) ? null : ((((DomainBase)tarefa).Id != 0L) ? ((object)((IEnumerable)TarefasFiltradas).FirstOrDefault((Func)((Tarefa x) => ((DomainBase)x).Id == ((DomainBase)tarefa).Id))) : ((object)TarefasFiltradas.First()))); + Carregando = false; + } + } + + public async Task CarregarTarefas(Tarefa tarefa, bool? concluido) + { + Carregando = true; + if (tarefa.IdEntidade != 0L) + { + Tarefas = (await Servico.BuscarTarefas(tarefa.Entidade, tarefa.IdEntidade, concluido)).OrderBy((Tarefa x) => x.Agendamento).ToList(); + TarefasFiltradas = new ObservableCollection(Tarefas); + SelectedTarefa = (Tarefa)((TarefasFiltradas == null || TarefasFiltradas.Count == 0) ? null : ((((DomainBase)tarefa).Id != 0L) ? ((object)((IEnumerable)TarefasFiltradas).FirstOrDefault((Func)((Tarefa x) => ((DomainBase)x).Id == ((DomainBase)tarefa).Id))) : ((object)TarefasFiltradas.First()))); + } + else if (((DomainBase)tarefa).Id > 0) + { + SelectedTarefa = await Servico.BuscarTarefa(((DomainBase)tarefa).Id); + } + Carregando = false; + } + + public async Task Incluir() + { + CarregarUsuarios(); + base.Responsaveis = new ObservableCollection(); + SelectedTarefa = new Tarefa + { + IdCliente = IdCliente, + Cliente = Titulo, + Referencia = SubTitulo, + Entidade = Tarefa.Entidade, + IdEntidade = Tarefa.IdEntidade, + Trilha = Tarefa.Trilha, + Status = (StatusTarefa)0, + Agendamento = Funcoes.GetNetworkTime().AddHours(1.0), + UsuarioCadastro = Recursos.Usuario, + Usuario = ((IEnumerable)Usuarios).FirstOrDefault((Func)((Usuario x) => ((DomainBase)x).Id == ((DomainBase)Recursos.Usuario).Id)), + Restrito = false, + Responsaveis = base.Responsaveis.ToList() + }; + ArquivosFinais = new List(); + AlterarTamanho(alterar: true); + TituloTarefas += " (INCLUINDO)"; + Alterar(alterar: true); + AnotacoesLength = new GridLength(1.0, (GridUnitType)2); + AnotacoesInternasLength = new GridLength(1.0, (GridUnitType)2); + DescricaoLength = new GridLength(0.0, (GridUnitType)1); + DescricaoInternaLength = new GridLength(0.0, (GridUnitType)1); + EnableAlterarTarefa = false; + } + + public void AlterarTamanho(bool alterar) + { + //IL_007d: Unknown result type (might be due to invalid IL or missing references) + //IL_006c: Unknown result type (might be due to invalid IL or missing references) + //IL_00a6: Unknown result type (might be due to invalid IL or missing references) + //IL_0095: Unknown result type (might be due to invalid IL or missing references) + if (!alterar) + { + if (TituloTarefas.Contains("TODAS")) + { + TituloTarefas = "TODAS TAREFAS DO CLIENTE"; + } + else if (TituloTarefas.Contains("PENDENTES")) + { + TituloTarefas = "TAREFAS PENDENTES"; + } + else if (TituloTarefas.Contains("CONCLUÍDAS")) + { + TituloTarefas = "TAREFAS CONCLUÍDAS"; + } + } + Grid = (alterar ? new GridLength(0.0, (GridUnitType)2) : new GridLength(1.0, (GridUnitType)2)); + Dados = (alterar ? new GridLength(1.0, (GridUnitType)2) : new GridLength(360.0, (GridUnitType)1)); + } + + public async Task>> Salvar(string anotacoes, string anotacoesInternas) + { + DateTime networkTime = Funcoes.GetNetworkTime(); + if (Recursos.Configuracoes.All((ConfiguracaoSistema x) => (int)x.Configuracao != 45) && (int)SelectedTarefa.Status != 2 && SelectedTarefa.Agendamento < networkTime) + { + SelectedTarefa.Agendamento = networkTime; + } + if ((int)SelectedTarefa.Status == 2) + { + SelectedTarefa.Conclusao = networkTime; + } + if ((int)SelectedTarefa.Status == 0) + { + SelectedTarefa.Conclusao = null; + } + SelectedTarefa.Responsaveis = base.Responsaveis.ToList(); + Tarefa selectedTarefa = SelectedTarefa; + ResponsavelTarefa? obj = base.Responsaveis.FirstOrDefault(); + selectedTarefa.Usuario = ((obj != null) ? obj.Usuario : null); + SelectedTarefa.AgendamentoRetroativo = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 45); + List> list = SelectedTarefa.Validate(); + if (SelectedTarefa.Descricao == null && string.IsNullOrWhiteSpace(anotacoes) && string.IsNullOrWhiteSpace(anotacoesInternas)) + { + list.Add(new KeyValuePair("ANOTAÇÕES", "OBRIGATÓRIO")); + } + if (list.Count > 0) + { + return list; + } + if (!string.IsNullOrWhiteSpace(anotacoes)) + { + SelectedTarefa.Anotacoes = Funcoes.AdicionarLog(SelectedTarefa.Anotacoes); + SelectedTarefa.Descricao = SelectedTarefa.Anotacoes + "

" + SelectedTarefa.Descricao + "

"; + } + if (!string.IsNullOrWhiteSpace(anotacoesInternas)) + { + SelectedTarefa.AnotacoesInternas = Funcoes.AdicionarLog(SelectedTarefa.AnotacoesInternas); + SelectedTarefa.DescricaoInterna = SelectedTarefa.AnotacoesInternas + "

" + SelectedTarefa.DescricaoInterna + "

"; + } + SelectedTarefa.TipoDeTarefa = SelectedTipoTarefa; + bool inclusao = ((DomainBase)SelectedTarefa).Id == 0; + SelectedTarefa = await Servico.Salvar(SelectedTarefa); + string text = (inclusao ? "INCLUIU" : "ALTEROU"); + RegistrarAcao(text + " TAREFA", ((DomainBase)SelectedTarefa).Id, (TipoTela)38, $"TAREFA \"{SelectedTarefa.Titulo}\", ID: {((DomainBase)SelectedTarefa).Id}"); + if (inclusao) + { + foreach (ArquivoDigital arquivosFinai in ArquivosFinais) + { + arquivosFinai.IdTarefa = ((DomainBase)SelectedTarefa).Id; + } + await ArquivoDigitalServico.Insert(ArquivosFinais); + } + if (!Servico.Sucesso) + { + return null; + } + long id = ((DomainBase)SelectedTarefa).Id; + await CarregarTarefas(Index); + SelectedTarefa = ((IEnumerable)TarefasFiltradas).FirstOrDefault((Func)((Tarefa x) => ((DomainBase)x).Id == id)); + return null; + } + + public void AlterarTarefa() + { + //IL_0055: Unknown result type (might be due to invalid IL or missing references) + //IL_006a: Unknown result type (might be due to invalid IL or missing references) + //IL_00a9: Unknown result type (might be due to invalid IL or missing references) + //IL_0098: Unknown result type (might be due to invalid IL or missing references) + //IL_00e8: Unknown result type (might be due to invalid IL or missing references) + //IL_00d7: Unknown result type (might be due to invalid IL or missing references) + CarregarUsuarios(); + if (SelectedTarefa != null) + { + EnableAlterarTarefa = false; + AlterarTamanho(alterar: true); + TituloTarefas = TituloTarefas + " (ALTERANDO \"" + SelectedTarefa.Titulo + "\")"; + Alterar(alterar: true); + AnotacoesLength = new GridLength(1.0, (GridUnitType)2); + AnotacoesInternasLength = new GridLength(1.0, (GridUnitType)2); + Tarefa selectedTarefa = SelectedTarefa; + DescricaoLength = (string.IsNullOrWhiteSpace((selectedTarefa != null) ? selectedTarefa.Descricao : null) ? new GridLength(0.0, (GridUnitType)1) : new GridLength(1.0, (GridUnitType)2)); + Tarefa selectedTarefa2 = SelectedTarefa; + DescricaoInternaLength = (string.IsNullOrWhiteSpace((selectedTarefa2 != null) ? selectedTarefa2.DescricaoInterna : null) ? new GridLength(0.0, (GridUnitType)1) : new GridLength(1.0, (GridUnitType)2)); + TarefasFiltradas = new ObservableCollection { SelectedTarefa }; + ListaUsuariosResponsaveis(); + base.Responsaveis.ToList().ForEach(delegate(ResponsavelTarefa x) + { + Usuarios.Remove(x.Usuario); + }); + } + } + + public async Task Cancelar() + { + CarregarUsuarios(); + AlterarTamanho(alterar: false); + Tarefa selectedTarefa = SelectedTarefa; + long id = ((selectedTarefa != null) ? ((DomainBase)selectedTarefa).Id : 0); + await CarregarTarefas(Index); + Alterar(alterar: false); + await ValidaPermissaoParaEditarTarefa(); + if (id != 0L) + { + SelectedTarefa = ((IEnumerable)TarefasFiltradas).FirstOrDefault((Func)((Tarefa x) => ((DomainBase)x).Id == id)); + } + } + + public async Task Excluir(Tarefa item) + { + if ((int)VisibilityMenu == 2) + { + await ShowMessage("NÃO É POSSÍVEL EXCLUIR TAREFA PELO RELATÓRIO!"); + return false; + } + if (!(await ShowMessage("DESEJA REALMENTE EXCLUIR A TAREFA " + item.Titulo + "?" + Environment.NewLine + "ESSE PROCEDIMENTO É IRREVERSÍVEL", "SIM", "NÃO"))) + { + return false; + } + string titulo = item.Titulo; + long id = ((DomainBase)item).Id; + if (!(await Servico.Excluir(((DomainBase)item).Id))) + { + Alterar(alterar: false); + return true; + } + RegistrarAcao("EXCLUIU TAREFA", ((DomainBase)item).Id, (TipoTela)38, $"TAREFA \"{titulo}\", ID: {id}"); + await CarregarTarefas(Index); + Alterar(alterar: false); + return true; + } + + public void AdcionarResponsavel() + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Unknown result type (might be due to invalid IL or missing references) + //IL_0036: Expected O, but got Unknown + if (SelectedUsuario != null) + { + base.Responsaveis.Add(new ResponsavelTarefa + { + Usuario = SelectedUsuario, + IdTarefa = ((DomainBase)SelectedTarefa).Id + }); + Usuarios.Remove(SelectedUsuario); + SelectedUsuario = null; + } + } + + public async void Editar(IndiceArquivoDigital arquivo) + { + if (arquivo != null && arquivo.IdArquivoDigital != 0L) + { + await ArquivoDigitalServico.Save(arquivo); + } + } + + public void Delete(ArquivoDigital arquivo) + { + if (SelectedAnexado != null) + { + ArquivoDigital item = ArquivosAnexados.First((ArquivoDigital x) => x.Descricao == arquivo.Descricao); + ArquivosAnexados.Remove(item); + ArquivosAnexados = new ObservableCollection(ArquivosAnexados); + } + } + + public async void Anexar() + { + InclusaoArquivoDigitalEnable = false; + List arquivos = await AddAttachments(ArquivosAnexados.ToList(), new List()); + await Task.Run(async delegate + { + await Task.Delay(200); + InclusaoArquivoDigitalEnable = true; + }); + if (arquivos != null) + { + arquivos.AddRange(ArquivosAnexados); + ArquivosAnexados = new ObservableCollection(arquivos); + } + } + + public void SalvarAnexos() + { + ArquivosFinais = ArquivosAnexados.ToList(); + } + + public void LimparAnexos() + { + ArquivosAnexados = new ObservableCollection(); + } + + public void Print() + { + string value = GerarHtml(); + string tempPath = Path.GetTempPath(); + string text = $"{tempPath}{(object)(TipoTela)38}_{Funcoes.GetNetworkTime():ddMMyyyyhhmmss}.html"; + StreamWriter streamWriter = new StreamWriter(text, append: true, Encoding.UTF8); + streamWriter.Write(value); + streamWriter.Close(); + Process.Start(text); + RegistrarAcao("IMPRIMIU A TAREFA", ((DomainBase)SelectedTarefa).Id, (TipoTela)38, $"TAREFA \"{SelectedTarefa.Titulo}\", ID: {((DomainBase)SelectedTarefa).Id}"); + } + + public string GerarHtml() + { + //IL_0205: Unknown result type (might be due to invalid IL or missing references) + string text = " TAREFA
"; + text += "
"; + text += "

"; + text += "TAREFA


"; + text += ""; + int num = 0; + text = text + ""; + text = text + ""; + text = text + ""; + text = text + ""; + text = text + ""; + text = text + ""; + string[] obj = new string[6] + { + text, + ""; + text = string.Concat(obj); + text += "

CLIENTE: " + SelectedTarefa.Cliente + "

REFERÊNCIA: " + SelectedTarefa.Referencia + "

TÍTULO: " + SelectedTarefa.Titulo + "

AGENDAMENTO: " + SelectedTarefa.Agendamento.ToString() + "

RESPONSÁVEL PRINCIPAL: " + SelectedTarefa.Usuario.Nome + "

STATUS: " + ValidationHelper.GetDescription((Enum)(object)SelectedTarefa.Status) + "

TIPO DE TAREFA: ", + null, + null + }; + TipoDeTarefa selectedTipoTarefa = SelectedTipoTarefa; + obj[4] = ((selectedTipoTarefa != null) ? selectedTipoTarefa.Nome : null); + obj[5] = "

"; + if (base.Responsaveis != null && base.Responsaveis.Count > 0) + { + text += "

RESPONSÁVEIS VINCULADOS

"; + text += "
"; + text += ""; + List list = new List(); + foreach (ResponsavelTarefa responsavei in base.Responsaveis) + { + list.Add(responsavei.Usuario.Nome.Trim().ToUpper()); + } + text = text + ""; + text += "

" + string.Join(", ", list) + "

"; + text += "

"; + } + text += "

"; + if (SelectedTarefa.Descricao != null) + { + text += "

ANOTAÇÕES

"; + text += "
"; + text += ""; + text = text + ""; + text += "

" + SelectedTarefa.Descricao.Replace("", "").Replace("", "") + "

"; + text += "

"; + } + return text + "
"; + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Drawer/ValoresApoliceViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Drawer/ValoresApoliceViewModel.cs new file mode 100644 index 0000000..e27a291 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Drawer/ValoresApoliceViewModel.cs @@ -0,0 +1,306 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Windows; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Drawer; + +public class ValoresApoliceViewModel : BaseSegurosViewModel +{ + private Visibility _isVisibleEspecial; + + private Visibility _isVisibleVendedores; + + private decimal _prevista; + + private decimal _recebida; + + private decimal _recebidaEspecial; + + private decimal _pendente; + + private decimal _repasse; + + private decimal _repasseEspecial; + + private decimal _paga; + + private decimal _pagaEspecial; + + private string _apoliceLabel = "DESCRIÇÃO DE VALORES"; + + private string _apoliceDescricao = "VALORES BASEADOS NO DOCUMENTO SELECIONADO ATÉ O MOMENTO, OS VALORES PODEM SER DIFERENTES EM CASO DE ALTERAÇÕES POR OUTROS USUÁRIOS."; + + private Documento _selectedDocumento; + + private ObservableCollection _pagamentos; + + public Visibility IsVisibleEspecial + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _isVisibleEspecial; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _isVisibleEspecial = value; + OnPropertyChanged("IsVisibleEspecial"); + } + } + + public Visibility IsVisibleVendedores + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _isVisibleVendedores; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _isVisibleVendedores = value; + OnPropertyChanged("IsVisibleVendedores"); + } + } + + public decimal Prevista + { + get + { + return _prevista; + } + set + { + _prevista = value; + OnPropertyChanged("Prevista"); + } + } + + public decimal Recebida + { + get + { + return _recebida; + } + set + { + _recebida = value; + OnPropertyChanged("Recebida"); + } + } + + public decimal RecebidaEspecial + { + get + { + return _recebidaEspecial; + } + set + { + _recebidaEspecial = value; + OnPropertyChanged("RecebidaEspecial"); + } + } + + public decimal Pendente + { + get + { + return _pendente; + } + set + { + _pendente = value; + OnPropertyChanged("Pendente"); + } + } + + public decimal Repasse + { + get + { + return _repasse; + } + set + { + _repasse = value; + OnPropertyChanged("Repasse"); + } + } + + public decimal RepasseEspecial + { + get + { + return _repasseEspecial; + } + set + { + _repasseEspecial = value; + OnPropertyChanged("RepasseEspecial"); + } + } + + public decimal Paga + { + get + { + return _paga; + } + set + { + _paga = value; + OnPropertyChanged("Paga"); + } + } + + public decimal PagaEspecial + { + get + { + return _pagaEspecial; + } + set + { + _pagaEspecial = value; + OnPropertyChanged("PagaEspecial"); + } + } + + public string ApoliceLabel + { + get + { + return _apoliceLabel; + } + set + { + _apoliceLabel = value; + OnPropertyChanged("ApoliceLabel"); + } + } + + public string ApoliceDescricao + { + get + { + return _apoliceDescricao; + } + set + { + _apoliceDescricao = value; + OnPropertyChanged("ApoliceDescricao"); + } + } + + public Documento SelectedDocumento + { + get + { + return _selectedDocumento; + } + set + { + _selectedDocumento = value; + OnPropertyChanged("SelectedDocumento"); + } + } + + public ObservableCollection Pagamentos + { + get + { + return _pagamentos; + } + set + { + _pagamentos = value; + OnPropertyChanged("Pagamentos"); + } + } + + public ValoresApoliceViewModel(Documento documento) + { + base.EnableMenu = true; + Seleciona(documento); + } + + public void Seleciona(Documento documento) + { + SelectedDocumento = documento; + if (SelectedDocumento.Tipo != 1) + { + ApoliceLabel = ((!SelectedDocumento.Emissao.HasValue) ? ("VALORES DA PROPOSTA " + SelectedDocumento.Proposta) : ("VALORES DA APÓLICE " + SelectedDocumento.Apolice)); + ApoliceDescricao = ((!SelectedDocumento.Emissao.HasValue) ? ("VALORES BASEADOS NA PROPOSTA " + SelectedDocumento.Proposta + " ATÉ O MOMENTO, OS VALORES PODEM SER DIFERENTES EM CASO DE ALTERAÇÕES POR OUTROS USUÁRIOS.") : ("VALORES BASEADOS NA APÓLICE " + SelectedDocumento.Apolice + " ATÉ O MOMENTO, OS VALORES PODEM SER DIFERENTES EM CASO DE ALTERAÇÕES POR OUTROS USUÁRIOS.")); + } + CalculaComissao(); + CalculaEspecial(); + CalculaRepasse(); + RegistrarAcao($"CONSULTOU MAIS INFORMAÇÕES DOS VALORES DO DOCUMENTO DE ID {((DomainBase)documento).Id}", ((DomainBase)documento).Id, (TipoTela)21); + } + + private void CalculaRepasse() + { + if (SelectedDocumento.Pagamentos.All((VendedorParcela x) => x.Vendedor.Corretora)) + { + IsVisibleVendedores = (Visibility)2; + return; + } + List list = (from x in SelectedDocumento.Pagamentos + where !x.Vendedor.Corretora + group x by ((DomainBase)x.Vendedor).Id).Select((Func, VendedorParcela>)((IGrouping x) => new VendedorParcela + { + Repasse = x.First().Repasse, + Documento = SelectedDocumento, + ValorTotal = x.First().ValorTotal, + Vendedor = x.First().Vendedor, + ValorTotalPago = x.Where((VendedorParcela y) => (int)y.Parcela.SubTipo == 1 && y.DataPrePagamento.HasValue).Sum((VendedorParcela y) => y.ValorRepasse), + ValorRepasseB = x.Where((VendedorParcela y) => (int)y.Parcela.SubTipo != 1).Sum((VendedorParcela y) => y.ValorRepasse), + ValorRepasse = x.Where((VendedorParcela y) => (int)y.Parcela.SubTipo != 1 && y.DataPrePagamento.HasValue).Sum((VendedorParcela y) => y.ValorRepasse), + PorcentagemRepasse = x.First().PorcentagemRepasse / (decimal?)100, + TipoVendedor = x.First().TipoVendedor + })).ToList(); + Pagamentos = new ObservableCollection(list); + } + + private void CalculaComissao() + { + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Invalid comparison between Unknown and I4 + if ((int)SelectedDocumento.TipoRecebimento.GetValueOrDefault() == 1) + { + decimal num = (SelectedDocumento.AdicionalComiss ? (SelectedDocumento.PremioLiquido + SelectedDocumento.PremioAdicional) : SelectedDocumento.PremioLiquido); + decimal num2 = SelectedDocumento.Comissao * 0.01m; + Prevista = num * num2; + } + else + { + Prevista = SelectedDocumento.Parcelas.Where((Parcela x) => (int)x.SubTipo == 1).Sum((Parcela x) => x.ValorLiquidoFatura * ((x.Comissao < 1m) ? x.Comissao : ((x.Comissao > 100m) ? 1m : (x.Comissao * 0.01m)))); + } + Recebida = SelectedDocumento.Parcelas.Where((Parcela x) => (int)x.SubTipo == 1).Sum((Parcela x) => x.ValorComissao); + Pendente = Prevista - Recebida; + Repasse = SelectedDocumento.Pagamentos.Where((VendedorParcela x) => (int)x.Parcela.SubTipo == 1).Sum((VendedorParcela x) => x.ValorRepasse.GetValueOrDefault()); + Paga = SelectedDocumento.Pagamentos.Where((VendedorParcela x) => (int)x.Parcela.SubTipo == 1 && x.DataPrePagamento.HasValue).Sum((VendedorParcela x) => x.ValorRepasse.GetValueOrDefault()); + } + + private void CalculaEspecial() + { + if (SelectedDocumento.Parcelas.All((Parcela x) => (int)x.SubTipo == 1)) + { + IsVisibleEspecial = (Visibility)2; + return; + } + RecebidaEspecial = SelectedDocumento.Parcelas.Where((Parcela x) => (int)x.SubTipo != 1).Sum((Parcela x) => x.ValorComissao); + RepasseEspecial = SelectedDocumento.Pagamentos.Where((VendedorParcela x) => (int)x.Parcela.SubTipo != 1).Sum((VendedorParcela x) => x.ValorRepasse.GetValueOrDefault()); + PagaEspecial = SelectedDocumento.Pagamentos.Where((VendedorParcela x) => (int)x.Parcela.SubTipo != 1 && x.DataPrePagamento.HasValue).Sum((VendedorParcela x) => x.ValorRepasse.GetValueOrDefault()); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Drawer/ValoresParcelaViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Drawer/ValoresParcelaViewModel.cs new file mode 100644 index 0000000..49cbccc --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Drawer/ValoresParcelaViewModel.cs @@ -0,0 +1,490 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Windows; +using Gestor.Application.Servicos; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Aggilizador; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Drawer; + +public class ValoresParcelaViewModel : BaseSegurosViewModel +{ + private ParcelaPendente _pendecia; + + private Visibility _isVisiblePendencia = (Visibility)2; + + private Visibility _isVisibleFatura; + + private Visibility _isVisibleVendedores; + + private decimal _prevista; + + private decimal _ir; + + private decimal _iss; + + private string _repassePago; + + private decimal _recebidaLiquida; + + private decimal _recebida; + + private decimal _recebidaEspecial; + + private decimal _pendente; + + private decimal _repasse; + + private decimal _repasseEspecial; + + private decimal _paga; + + private decimal _pagaEspecial; + + private string _apoliceLabel = "DESCRIÇÃO DE VALORES"; + + private string _apoliceDescricao = "VALORES BASEADOS NO DOCUMENTO SELECIONADO ATÉ O MOMENTO, OS VALORES PODEM SER DIFERENTES EM CASO DE ALTERAÇÕES POR OUTROS USUÁRIOS."; + + private Parcela _selectedParcela; + + private string _statusBaixa; + + private string _statusParc; + + private Visibility _isVisiblestatusparc = (Visibility)2; + + private ObservableCollection _pagamentos; + + public ParcelaPendente Pendecia + { + get + { + return _pendecia; + } + set + { + _pendecia = value; + IsVisiblePendencia = (Visibility)((value == null) ? 2 : 0); + OnPropertyChanged("Pendecia"); + } + } + + public Visibility IsVisiblePendencia + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _isVisiblePendencia; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _isVisiblePendencia = value; + OnPropertyChanged("IsVisiblePendencia"); + } + } + + public Visibility IsVisibleFatura + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _isVisibleFatura; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _isVisibleFatura = value; + OnPropertyChanged("IsVisibleFatura"); + } + } + + public Visibility IsVisibleVendedores + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _isVisibleVendedores; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _isVisibleVendedores = value; + OnPropertyChanged("IsVisibleVendedores"); + } + } + + public decimal Prevista + { + get + { + return _prevista; + } + set + { + _prevista = value; + OnPropertyChanged("Prevista"); + } + } + + public decimal Ir + { + get + { + return _ir; + } + set + { + _ir = value; + OnPropertyChanged("Ir"); + } + } + + public decimal Iss + { + get + { + return _iss; + } + set + { + _iss = value; + OnPropertyChanged("Iss"); + } + } + + public string RepassePago + { + get + { + return _repassePago; + } + set + { + _repassePago = value; + OnPropertyChanged("RepassePago"); + } + } + + public decimal RecebidaLiquida + { + get + { + return _recebidaLiquida; + } + set + { + _recebidaLiquida = value; + OnPropertyChanged("RecebidaLiquida"); + } + } + + public decimal Recebida + { + get + { + return _recebida; + } + set + { + _recebida = value; + OnPropertyChanged("Recebida"); + } + } + + public decimal RecebidaEspecial + { + get + { + return _recebidaEspecial; + } + set + { + _recebidaEspecial = value; + OnPropertyChanged("RecebidaEspecial"); + } + } + + public decimal Pendente + { + get + { + return _pendente; + } + set + { + if (value < 0.01m) + { + _pendente = default(decimal); + } + else + { + _pendente = value; + } + OnPropertyChanged("Pendente"); + } + } + + public decimal Repasse + { + get + { + return _repasse; + } + set + { + _repasse = value; + OnPropertyChanged("Repasse"); + } + } + + public decimal RepasseEspecial + { + get + { + return _repasseEspecial; + } + set + { + _repasseEspecial = value; + OnPropertyChanged("RepasseEspecial"); + } + } + + public decimal Paga + { + get + { + return _paga; + } + set + { + _paga = value; + OnPropertyChanged("Paga"); + } + } + + public decimal PagaEspecial + { + get + { + return _pagaEspecial; + } + set + { + _pagaEspecial = value; + OnPropertyChanged("PagaEspecial"); + } + } + + public string ApoliceLabel + { + get + { + return _apoliceLabel; + } + set + { + _apoliceLabel = value; + OnPropertyChanged("ApoliceLabel"); + } + } + + public string ApoliceDescricao + { + get + { + return _apoliceDescricao; + } + set + { + _apoliceDescricao = value; + OnPropertyChanged("ApoliceDescricao"); + } + } + + public Parcela SelectedParcela + { + get + { + return _selectedParcela; + } + set + { + _selectedParcela = value; + OnPropertyChanged("SelectedParcela"); + } + } + + public string StatusBaixa + { + get + { + return _statusBaixa; + } + set + { + _statusBaixa = value; + OnPropertyChanged("StatusBaixa"); + } + } + + public string StatusParc + { + get + { + return _statusParc; + } + set + { + _statusParc = value; + OnPropertyChanged("StatusParc"); + } + } + + public Visibility IsVisibleStatusParc + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _isVisiblestatusparc; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _isVisiblestatusparc = value; + OnPropertyChanged("IsVisibleStatusParc"); + } + } + + public ObservableCollection Pagamentos + { + get + { + return _pagamentos; + } + set + { + _pagamentos = value; + OnPropertyChanged("Pagamentos"); + } + } + + public ValoresParcelaViewModel(Parcela parcela, Documento documento) + { + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + Seleciona(parcela, documento); + } + + public async void Seleciona(Parcela parcela, Documento documento) + { + SelectedParcela = parcela; + IsVisibleFatura = (Visibility)(((int)SelectedParcela.Documento.TipoRecebimento.GetValueOrDefault() != 2) ? 2 : 0); + ApoliceLabel = $"VALORES DA PARCELA {SelectedParcela.NumeroParcela} VENCIMENTO {parcela.Vencimento:d}"; + ApoliceDescricao = $"VALORES BASEADOS NA PARCELA {SelectedParcela.NumeroParcela} ATÉ O MOMENTO, OS VALORES PODEM SER DIFERENTES EM CASO DE ALTERAÇÕES POR OUTROS USUÁRIOS."; + StatusBaixa = "PENDENTE"; + RepassePago = "REPASSE A SER PAGO"; + if (SelectedParcela.DataRecebimento.HasValue) + { + StatusBaixa = (((int)SelectedParcela.Documento.TipoRecebimento.GetValueOrDefault() == 2) ? "BAIXA MANUAL" : ((SelectedParcela.ValorRealizado == 0m) ? "BAIXA ESGOTAMENTO" : "BAIXA MANUAL")); + DetalheExtrato val = await new ServicoExtrato().FindByParcelaId(((DomainBase)SelectedParcela).Id); + if (val != null) + { + StatusParcela? status = val.Status; + if (status.HasValue) + { + StatusParcela valueOrDefault = status.GetValueOrDefault(); + if ((int)valueOrDefault != 1) + { + if ((int)valueOrDefault == 5) + { + goto IL_021c; + } + switch (valueOrDefault - 10) + { + case 0: + case 3: + break; + case 2: + goto IL_021c; + default: + goto IL_0232; + } + } + IsVisibleStatusParc = (Visibility)0; + StatusParc = ValidationHelper.GetDescription((Enum)(object)val.Status); + RepassePago = "REPASSE PAGO"; + StatusBaixa = ((SelectedParcela.ValorRealizado == 0m) ? "BAIXA AUTOMATICA ESGOTAMENTO" : "BAIXA AUTOMATICA"); + } + } + } + goto IL_0232; + IL_021c: + RepassePago = "REPASSE PAGO"; + StatusBaixa = "BAIXA MANUAL"; + goto IL_0232; + IL_0232: + CalculaComissao(documento); + CalculaRepasse(); + if (SelectedParcela.IdParcelaPendente > 0 && SelectedParcela.StatusPagamento != (StatusPagamento?)0) + { + BuscarPendencia(); + } + } + + private async void BuscarPendencia() + { + Pendecia = await new BaseServico().BuscarParcelaPendente(SelectedParcela.IdParcelaPendente); + } + + private void CalculaRepasse() + { + if (SelectedParcela.Vendedores.All((VendedorParcela x) => x.Vendedor.Corretora)) + { + IsVisibleVendedores = (Visibility)2; + return; + } + List list = (from x in SelectedParcela.Vendedores + where !x.Vendedor.Corretora + group x by ((DomainBase)x.Vendedor).Id).Select((Func, VendedorParcela>)((IGrouping x) => new VendedorParcela + { + Repasse = x.First().Repasse, + Documento = SelectedParcela.Documento, + ValorTotal = x.First().ValorTotal, + Vendedor = x.First().Vendedor, + ValorTotalPago = x.Where((VendedorParcela y) => (int)y.Parcela.SubTipo == 1 && y.DataPrePagamento.HasValue).Sum((VendedorParcela y) => y.ValorRepasse), + ValorRepasseB = x.Where((VendedorParcela y) => (int)y.Parcela.SubTipo != 1).Sum((VendedorParcela y) => y.ValorRepasse), + ValorRepasse = x.Where((VendedorParcela y) => (int)y.Parcela.SubTipo != 1 && y.DataPrePagamento.HasValue).Sum((VendedorParcela y) => y.ValorRepasse), + PorcentagemRepasse = x.First().PorcentagemRepasse / (decimal?)100, + TipoVendedor = x.First().TipoVendedor + })).ToList(); + Pagamentos = new ObservableCollection(list); + } + + private void CalculaComissao(Documento documento) + { + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_000c: Invalid comparison between Unknown and I4 + decimal num = (((int)SelectedParcela.SubTipo != 1) ? SelectedParcela.Valor : ((documento.NumeroParcelas == 0m) ? 0m : (documento.AdicionalComiss ? ((documento.PremioLiquido + documento.PremioAdicional) / documento.NumeroParcelas) : (documento.PremioLiquido / documento.NumeroParcelas)))); + Prevista = ((SelectedParcela.ValorLiquidoFatura != 0m) ? (SelectedParcela.ValorLiquidoFatura * SelectedParcela.Comissao * 0.01m) : (num * SelectedParcela.Comissao * 0.01m)); + Recebida = SelectedParcela.ValorComissao; + Pendente = Prevista - Recebida; + Repasse = SelectedParcela.Vendedores.Where((VendedorParcela x) => ((int)SelectedParcela.SubTipo != 1) ? ((int)x.Parcela.SubTipo != 1) : ((int)x.Parcela.SubTipo == 1)).Sum((VendedorParcela x) => x.ValorRepasse.GetValueOrDefault()); + Paga = SelectedParcela.Vendedores.Where((VendedorParcela x) => ((int)SelectedParcela.SubTipo != 1) ? ((int)x.Parcela.SubTipo != 1 && x.DataPrePagamento.HasValue) : ((int)x.Parcela.SubTipo == 1)).Sum((VendedorParcela x) => x.ValorRepasse.GetValueOrDefault()); + Ir = SelectedParcela.Irr; + Iss = SelectedParcela.Iss; + RecebidaLiquida = SelectedParcela.ValorComDesconto; + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Drawer/VinculoVendedorViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Drawer/VinculoVendedorViewModel.cs new file mode 100644 index 0000000..849ec7f --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Drawer/VinculoVendedorViewModel.cs @@ -0,0 +1,258 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Sockets; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.Servicos.Ferramentas; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Newtonsoft.Json; + +namespace Gestor.Application.ViewModels.Drawer; + +public class VinculoVendedorViewModel : BaseSegurosViewModel +{ + private readonly VendedorUsuarioServico _servicoVendedorUsuario; + + private readonly VendedorServico _servicoVendedor; + + public readonly Usuario SelectedUsuario; + + private bool _isVisibleVinculado; + + private bool _enableAlterarVinculo; + + private bool _isVisibleVendedor = true; + + private List _vinculado; + + private List _vinculadoFiltro; + + private List _vendedor; + + private List _vendedorFiltro; + + public bool IsVisibleVinculado + { + get + { + return _isVisibleVinculado; + } + set + { + _isVisibleVinculado = value; + OnPropertyChanged("IsVisibleVinculado"); + } + } + + public bool EnableAlterarVinculo + { + get + { + return _enableAlterarVinculo; + } + set + { + _enableAlterarVinculo = value; + OnPropertyChanged("EnableAlterarVinculo"); + } + } + + public bool IsVisibleVendedor + { + get + { + return _isVisibleVendedor; + } + set + { + _isVisibleVendedor = value; + OnPropertyChanged("IsVisibleVendedor"); + } + } + + public List Vinculado + { + get + { + return _vinculado; + } + set + { + _vinculado = value; + IsVisibleVinculado = value != null && value.Count > 0; + OnPropertyChanged("Vinculado"); + } + } + + public List VinculadoFiltro + { + get + { + return _vinculadoFiltro; + } + set + { + _vinculadoFiltro = value; + OnPropertyChanged("VinculadoFiltro"); + } + } + + public List Vendedor + { + get + { + return _vendedor; + } + set + { + _vendedor = value; + IsVisibleVendedor = value != null && value.Count > 0; + OnPropertyChanged("Vendedor"); + } + } + + public List VendedorFiltro + { + get + { + return _vendedorFiltro; + } + set + { + _vendedorFiltro = value; + OnPropertyChanged("VendedorFiltro"); + } + } + + public VinculoVendedorViewModel(Usuario usuario) + { + SelectedUsuario = usuario; + _servicoVendedorUsuario = new VendedorUsuarioServico(); + _servicoVendedor = new VendedorServico(); + Load(usuario); + EnableAlterarVinculo = ((DomainBase)Recursos.Usuario).Id > 0; + base.EnableMenu = true; + } + + private async void Load(Usuario usuario) + { + await AwaitLoad(usuario); + } + + private async Task AwaitLoad(Usuario usuario) + { + Vinculado = await GetVinculo(usuario); + Vendedor = await GetVendedor(usuario); + VinculadoFiltro = Vinculado; + VendedorFiltro = Vendedor; + } + + private async Task> GetVinculo(Usuario usuario) + { + List vinculado = new List(); + (await _servicoVendedorUsuario.FindByVinculo(usuario)).ForEach(delegate(VendedorUsuario x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Unknown result type (might be due to invalid IL or missing references) + //IL_001d: Unknown result type (might be due to invalid IL or missing references) + //IL_0025: Expected O, but got Unknown + VinculoVendedor item = new VinculoVendedor + { + Id = ((DomainBase)x).Id, + Vendedor = x.Vendedor, + Vinculado = true + }; + vinculado.Add(item); + }); + return vinculado; + } + + private async Task> GetVendedor(Usuario usuario) + { + List list = (await _servicoVendedor.BuscarVendedoresAtivosAsync())?.Where((Vendedor x) => x.IdEmpresa == usuario.IdEmpresa).ToList(); + return (list == null || list.Count == 0) ? null : list.Where((Vendedor vendedor) => Vinculado.All((VinculoVendedor x) => ((DomainBase)x.Vendedor).Id != ((DomainBase)vendedor).Id)).Select((Func)((Vendedor vendedor) => new VinculoVendedor + { + Id = 0L, + Vendedor = vendedor, + Vinculado = false + })).ToList(); + } + + internal async Task BuscarVinculoVendedor(string value) + { + await Task.Run(delegate + { + FiltrarVinculoVendedor(value); + }); + } + + internal void FiltrarVinculoVendedor(string filter) + { + Vinculado = (string.IsNullOrEmpty(filter) ? VinculadoFiltro : new List(VinculadoFiltro.Where((VinculoVendedor x) => ValidationHelper.RemoveDiacritics(x.Vendedor.Nome.ToUpper().Trim()).Contains(filter.ToUpper())))); + Vendedor = (string.IsNullOrEmpty(filter) ? VendedorFiltro : new List(VendedorFiltro.Where((VinculoVendedor x) => ValidationHelper.RemoveDiacritics(x.Vendedor.Nome.ToUpper().Trim()).Contains(filter.ToUpper())))); + } + + public async Task Salvar() + { + List list = Vinculado.Where((VinculoVendedor x) => !x.Vinculado).Select((Func)((VinculoVendedor x) => new VendedorUsuario + { + Id = ((DomainBase)x).Id, + Vendedor = x.Vendedor, + Usuario = SelectedUsuario + })).ToList(); + if (list.Count > 0 && !(await _servicoVendedorUsuario.Delete(list))) + { + return; + } + List list2 = Vendedor.Where((VinculoVendedor x) => x.Vinculado).Select((Func)((VinculoVendedor x) => new VendedorUsuario + { + Id = ((DomainBase)x).Id, + Vendedor = x.Vendedor, + Usuario = SelectedUsuario + })).ToList(); + if (list2.Count > 0) + { + await _servicoVendedorUsuario.SaveOrUpdate(list2); + } + await AwaitLoad(SelectedUsuario); + UnitOfWork commited = Instancia.Commited; + try + { + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog keyValues = new RegistroLog + { + Acao = (TipoAcao)0, + Usuario = Recursos.Usuario, + DataHora = Funcoes.GetNetworkTime(), + Descricao = JsonConvert.SerializeObject((object)Vinculado.Select((VinculoVendedor x) => x.Vendedor).ToList(), new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)SelectedUsuario).Id, + Tela = (TipoTela)45, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + _servicoVendedorUsuario.SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + RegistrarAcao("ALTEROU VÍNCULOS DE VENDEDOR DO USUÁRIO \"" + SelectedUsuario.Nome + "\"", ((DomainBase)SelectedUsuario).Id, (TipoTela)45, $"ID: {((DomainBase)SelectedUsuario).Id}\n\nACESSE O LOG DE ALTERAÇÕES NA TELA DE VÍNCULO DE VENDEDOR PARA VER EXATAMENTE O QUE FOI ALTERADO."); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Ferramentas/CadastroEmailViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Ferramentas/CadastroEmailViewModel.cs new file mode 100644 index 0000000..6aefb0b --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Ferramentas/CadastroEmailViewModel.cs @@ -0,0 +1,285 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Ferramentas; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Helpers; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; + +namespace Gestor.Application.ViewModels.Ferramentas; + +public class CadastroEmailViewModel : BaseSegurosViewModel +{ + private readonly EmailServico _servico; + + public Credencial CancelCredencial; + + private Credencial _selectedCredencial; + + private ObservableCollection _credenciaisFiltrados = new ObservableCollection(); + + private bool _isExpanded; + + public Credencial SelectedCredencial + { + get + { + return _selectedCredencial; + } + set + { + _selectedCredencial = value; + WorkOnSelectedCredencial(value); + VerificarEnables((value != null) ? new long?(((DomainBase)value).Id) : null); + OnPropertyChanged("SelectedCredencial"); + } + } + + public ObservableCollection CredenciaisFiltrados + { + get + { + return _credenciaisFiltrados; + } + set + { + _credenciaisFiltrados = value; + IsExpanded = value != null && value.Count > 0; + OnPropertyChanged("CredenciaisFiltrados"); + } + } + + public bool IsExpanded + { + get + { + return _isExpanded; + } + set + { + _isExpanded = value; + OnPropertyChanged("IsExpanded"); + } + } + + public List Credenciais { get; set; } + + public CadastroEmailViewModel() + { + _servico = new EmailServico(); + base.EnableMenu = true; + Seleciona(); + } + + public void Incluir() + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_002b: Expected O, but got Unknown + SelectedCredencial = new Credencial + { + IdEmpresa = Recursos.Usuario.IdEmpresa, + IdUsuario = ((DomainBase)Recursos.Usuario).Id + }; + Alterar(alterar: true); + } + + public async Task CancelarAlteracao() + { + await CarregarCredenciais(); + if (CredenciaisFiltrados.Any()) + { + Credencial cancelCredencial = CancelCredencial; + long id = ((cancelCredencial != null) ? ((DomainBase)cancelCredencial).Id : 0); + SelectedCredencial = ((IEnumerable)CredenciaisFiltrados).FirstOrDefault((Func)((Credencial x) => ((DomainBase)x).Id == id)); + } + else + { + SelectedCredencial = new Credencial(); + Alterar(alterar: false); + base.EnableMenu = false; + } + Alterar(alterar: false); + } + + public async Task>> Salvar() + { + List> list = SelectedCredencial.Validate(); + list.AddRange(Validate()); + if (list.Count > 0) + { + return list; + } + SelectedCredencial.Assinatura = SelectedCredencial.Assinatura.GetBody(); + SelectedCredencial.Cabecalho = SelectedCredencial.Cabecalho.GetBody(); + if (SelectedCredencial.Senha == null) + { + SelectedCredencial.Senha = ""; + } + string acao = ((((DomainBase)SelectedCredencial).Id == 0L) ? "INCLUIU" : "ALTEROU"); + Credencial value = await _servico.Save(SelectedCredencial); + if (!_servico.Sucesso) + { + return null; + } + RegistrarAcao(acao + " E-MAIL \"" + value.Email + "\"", ((DomainBase)value).Id, (TipoTela)17, $"E-MAIL: {value.Email}\nID: {((DomainBase)value).Id}"); + await CarregarCredenciais(); + SelectedCredencial = ((IEnumerable)CredenciaisFiltrados).FirstOrDefault((Func)((Credencial x) => ((DomainBase)x).Id == ((DomainBase)value).Id)); + Alterar(alterar: false); + ToggleSnackBar("E-MAIL SALVO COM SUCESSO"); + return null; + } + + public async Task Excluir() + { + if (SelectedCredencial == null || ((DomainBase)SelectedCredencial).Id == 0L || !(await ShowMessage("DESEJA REALMENTE EXCLUIR O E-MAIL " + SelectedCredencial.Email + " PERMANENTEMENTE?", "SIM", "NÃO"))) + { + return; + } + Loading(isLoading: true); + if (!(await _servico.Delete(SelectedCredencial))) + { + Loading(isLoading: false); + return; + } + RegistrarAcao("EXCLUIU E-MAIL \"" + SelectedCredencial.Email + "\"", ((DomainBase)SelectedCredencial).Id, (TipoTela)17, $"E-MAIL: {SelectedCredencial.Email}\nID: {((DomainBase)SelectedCredencial).Id}"); + await CarregarCredenciais(); + if (CredenciaisFiltrados.Any()) + { + SelectedCredencial = CredenciaisFiltrados.FirstOrDefault(); + } + else + { + SelectedCredencial = new Credencial(); + Alterar(alterar: false); + base.EnableMenu = false; + } + Loading(isLoading: false); + ToggleSnackBar("E-MAIL EXCLUÍDO COM SUCESSO"); + } + + public List> Validate() + { + List> list = new List>(); + if (Credenciais.Any((Credencial x) => ((DomainBase)x).Id != ((DomainBase)SelectedCredencial).Id && x.Descricao == SelectedCredencial.Descricao)) + { + list.Add(new KeyValuePair("Descricao", "UM E-MAIL COM A MESMA DESCRIÇÃO/NOME JÁ EXISTE.")); + } + return list; + } + + private async void Seleciona() + { + Loading(isLoading: true); + await PermissaoTela((TipoTela)17); + Loading(isLoading: false); + } + + public async Task SelecionaCredenciais() + { + Loading(isLoading: true); + await CarregarCredenciais(); + SelectedCredencial = CredenciaisFiltrados.FirstOrDefault(); + Loading(isLoading: false); + } + + private async Task CarregarCredenciais() + { + List list = await new BaseServico().BuscarCredenciais(); + foreach (Credencial item in list) + { + if (item.Email.Contains("@gmail.com")) + { + item.Tipo = (TipoEmail)1; + } + item.Senha = EncryptionHelper.Decrypt(item.Senha); + } + Credenciais = list.OrderBy((Credencial x) => x.Descricao).ToList(); + CredenciaisFiltrados = new ObservableCollection(Credenciais); + } + + private void WorkOnSelectedCredencial(Credencial value, bool registrar = true) + { + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_006a: Unknown result type (might be due to invalid IL or missing references) + //IL_0071: Invalid comparison between Unknown and I4 + //IL_00d7: Unknown result type (might be due to invalid IL or missing references) + CancelCredencial = (Credencial)((value == null || ((DomainBase)value).Id == 0L) ? ((object)CancelCredencial) : ((object)(Credencial)((DomainBase)value).Clone())); + if (value == null || ((DomainBase)value).Id == 0L || (LastAccessId == ((DomainBase)value).Id && (int)LastAccessTela == 17)) + { + return; + } + if (registrar) + { + RegistrarAcao("ACESSOU E-MAIL \"" + value.Email + "\"", ((DomainBase)value).Id, (TipoTela)17, $"ID E-MAIL: {((DomainBase)value).Id}"); + } + LastAccessId = ((DomainBase)value).Id; + LastAccessTela = (TipoTela)17; + Credencial selectedCredencial = SelectedCredencial; + if (((selectedCredencial != null) ? new long?(((DomainBase)selectedCredencial).Id) : null) != ((DomainBase)value).Id) + { + SelectedCredencial = ((IEnumerable)CredenciaisFiltrados).FirstOrDefault((Func)((Credencial x) => ((DomainBase)x).Id == ((DomainBase)value).Id)); + } + } + + internal async Task> Filtrar(string value) + { + return await Task.Run(() => FiltrarCredenciais(value)); + } + + public List FiltrarCredenciais(string filter) + { + CredenciaisFiltrados = (string.IsNullOrWhiteSpace(filter) ? new ObservableCollection(Credenciais) : new ObservableCollection(Credenciais.Where((Credencial x) => ValidationHelper.RemoveDiacritics(x.Descricao.Trim()).ToUpper().Contains(ValidationHelper.RemoveDiacritics(filter))))); + SelectedCredencial = CredenciaisFiltrados.FirstOrDefault(); + return CredenciaisFiltrados.ToList(); + } + + public void SelecionaCredencial(Credencial credencial) + { + SelectedCredencial = CredenciaisFiltrados.First((Credencial x) => ((DomainBase)x).Id == ((DomainBase)credencial).Id); + } + + public async Task EnviarTesteEmail() + { + if (SelectedCredencial == null) + { + await ShowMessage("NECESSÁRIO CRIAR UM E-MAIL DE ENVIO PARA PROSSEGUIR."); + return false; + } + TipoEmail tipo = SelectedCredencial.Tipo; + if ((int)tipo != 0) + { + if (tipo - 1 <= 1 && string.IsNullOrWhiteSpace(SelectedCredencial.Email)) + { + await ShowMessage("NECESSÁRIO PREENCHER O E-MAIL PARA ENVIAR UM E-MAIL DE TESTE"); + return false; + } + } + else if (string.IsNullOrWhiteSpace(SelectedCredencial.Email) || !SelectedCredencial.Porta.HasValue || string.IsNullOrWhiteSpace(SelectedCredencial.Dominio)) + { + await ShowMessage("NECESSÁRIO PREENCHER O E-MAIL, PORTA E DOMÍNIO PARA ENVIAR UM E-MAIL DE TESTE"); + return false; + } + LogEnvio val = await new MailHelper().SendAsync(destinatario: new Destinatario + { + Assunto = "TESTE ENVIO E-MAIL", + Corpo = "TESTE DE ENVIO DE E-MAIL", + Email = SelectedCredencial.Email, + Nome = SelectedCredencial.Descricao + }, credencial: SelectedCredencial, filtro: null, maladireta: null, tela: (TipoTela)0); + if (!val.Enviado) + { + await ShowMessage(val.Erro); + return false; + } + return true; + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Ferramentas/CadastroParceiroViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Ferramentas/CadastroParceiroViewModel.cs new file mode 100644 index 0000000..b0abb9b --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Ferramentas/CadastroParceiroViewModel.cs @@ -0,0 +1,273 @@ +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Ferramentas; + +public class CadastroParceiroViewModel : BaseSegurosViewModel +{ + private readonly ParceiroServico _servico; + + private Parceiro _selectedParceiro; + + private ObservableCollection _parceirosFiltrados = new ObservableCollection(); + + private bool _isExpanded; + + public Parceiro CancelParceiro; + + private Item _selectedItem = new Item(); + + public List Parceiros { get; set; } + + public Parceiro SelectedParceiro + { + get + { + return _selectedParceiro; + } + set + { + _selectedParceiro = value; + WorkOnSelectedParceiro(value); + VerificarEnables((value != null) ? new long?(((DomainBase)value).Id) : null); + OnPropertyChanged("SelectedParceiro"); + } + } + + public ObservableCollection ParceirosFiltrados + { + get + { + return _parceirosFiltrados; + } + set + { + _parceirosFiltrados = value; + IsExpanded = value != null && value.Count > 0; + OnPropertyChanged("ParceirosFiltrados"); + } + } + + public bool IsExpanded + { + get + { + return _isExpanded; + } + set + { + _isExpanded = value; + OnPropertyChanged("IsExpanded"); + } + } + + public Item SelectedItem + { + get + { + return _selectedItem; + } + set + { + _selectedItem = value; + OnPropertyChanged("SelectedItem"); + } + } + + public CadastroParceiroViewModel(Parceiro parceiro) + { + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_0016: Expected O, but got Unknown + _servico = new ParceiroServico(); + base.EnableMenu = true; + Seleciona(parceiro); + } + + private async void Seleciona(Parceiro parceiro) + { + Loading(isLoading: true); + await PermissaoTela((TipoTela)22); + await SelecionaParceiro(parceiro); + Loading(isLoading: false); + } + + public async void SelecionarParceiro(Parceiro parceiro) + { + if (parceiro == null) + { + SelectedParceiro = null; + return; + } + Parceiro val = await _servico.BuscarParceiro(((DomainBase)parceiro).Id); + DomainBase.Copy(ParceirosFiltrados.First((Parceiro x) => ((DomainBase)x).Id == ((DomainBase)parceiro).Id), val); + SelectedParceiro = ParceirosFiltrados.First((Parceiro x) => ((DomainBase)x).Id == ((DomainBase)parceiro).Id); + } + + private async Task SelecionaParceiro(Parceiro parceiro = null) + { + Loading(isLoading: true); + Parceiros = (await new BaseServico().BuscarParceirosAsync()).OrderBy((Parceiro x) => x.Nome).ToList(); + ParceirosFiltrados = new ObservableCollection(Parceiros); + SelecionarParceiro(parceiro ?? ParceirosFiltrados.FirstOrDefault()); + Loading(isLoading: false); + } + + private async void WorkOnSelectedParceiro(Parceiro value, bool registrar = true) + { + CancelParceiro = (Parceiro)((value == null || ((DomainBase)value).Id == 0L) ? ((object)CancelParceiro) : ((object)(Parceiro)((DomainBase)value).Clone())); + if (value == null || ((DomainBase)value).Id == 0L || (LastAccessId == ((DomainBase)value).Id && (int)LastAccessTela == 22)) + { + return; + } + if (registrar) + { + RegistrarAcao("ACESSOU PARCEIRO \"" + value.Nome + "\"", ((DomainBase)value).Id, (TipoTela)22, "DOCUMENTO: " + value.Cgccpf + "\nTELEFONE 1: (" + value.Ddd1 + ") " + value.Telefone1 + "\nTELEFONE 2: (" + value.Ddd2 + ") " + value.Telefone2 + "\nTELEFONE 3: (" + value.Ddd3 + ") " + value.Telefone3 + "\nE-MAIL: " + value.Email + "\n\nENDEREÇO: " + value.Endereco + ", " + value.Numero + ", " + (string.IsNullOrWhiteSpace(value.Complemento) ? "-" : (value.Complemento ?? "")) + ", " + value.Bairro + ", " + value.Cidade + "/" + value.Uf + " - " + value.Cep); + } + LastAccessId = ((DomainBase)value).Id; + LastAccessTela = (TipoTela)22; + Parceiro selectedParceiro = SelectedParceiro; + if (((selectedParceiro != null) ? new long?(((DomainBase)selectedParceiro).Id) : null) != ((DomainBase)value).Id) + { + Parceiro val = await _servico.BuscarParceiro(((DomainBase)value).Id); + DomainBase.Copy(SelectedParceiro, val); + Parceiro selectedParceiro2 = SelectedParceiro; + if (selectedParceiro2 != null) + { + ((DomainBase)selectedParceiro2).Initialize(); + } + Initialized = true; + } + } + + internal async Task> Filtrar(string value) + { + return await Task.Run(() => FiltrarParceiro(value)); + } + + public List FiltrarParceiro(string filter) + { + ParceirosFiltrados = (string.IsNullOrWhiteSpace(filter) ? new ObservableCollection(Parceiros) : new ObservableCollection(Parceiros.Where((Parceiro x) => ValidationHelper.RemoveDiacritics(x.Nome.Trim()).ToUpper().Contains(ValidationHelper.RemoveDiacritics(filter))))); + return ParceirosFiltrados.ToList(); + } + + public void Incluir() + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_000b: Expected O, but got Unknown + SelectedParceiro = new Parceiro(); + Alterar(alterar: true); + } + + public void CancelarAlteracao() + { + if (CancelParceiro != null && Parceiros.Any((Parceiro x) => ((DomainBase)x).Id == ((DomainBase)CancelParceiro).Id)) + { + DomainBase.Copy(Parceiros.First((Parceiro x) => ((DomainBase)x).Id == ((DomainBase)CancelParceiro).Id), CancelParceiro); + if (ParceirosFiltrados.Count > 0 && ParceirosFiltrados.Any((Parceiro x) => ((DomainBase)x).Id == ((DomainBase)CancelParceiro).Id)) + { + DomainBase.Copy(ParceirosFiltrados.First((Parceiro x) => ((DomainBase)x).Id == ((DomainBase)CancelParceiro).Id), CancelParceiro); + } + else + { + ParceirosFiltrados.Add(CancelParceiro); + } + ParceirosFiltrados = new ObservableCollection(ParceirosFiltrados); + SelecionarParceiro(ParceirosFiltrados.First((Parceiro x) => ((DomainBase)x).Id == ((DomainBase)CancelParceiro).Id)); + } + else + { + Incluir(); + } + Alterar(alterar: false); + } + + public async Task>> Salvar() + { + List> list = SelectedParceiro.Validate(); + if (list.Count > 0) + { + return list; + } + string acao = ((((DomainBase)SelectedParceiro).Id == 0L) ? "INCLUIU" : "ALTEROU"); + Parceiro value = await _servico.Save(SelectedParceiro); + if (!_servico.Sucesso) + { + return null; + } + RegistrarAcao(acao + " PARCEIRO \"" + value.Nome + "\"", ((DomainBase)value).Id, (TipoTela)22, "DOCUMENTO: " + value.Cgccpf + "\nTELEFONE 1: (" + value.Ddd1 + ") " + value.Telefone1 + "\nTELEFONE 2: (" + value.Ddd2 + ") " + value.Telefone2 + "\nTELEFONE 3: (" + value.Ddd3 + ") " + value.Telefone3 + "\nE-MAIL: " + value.Email + "\n\nENDEREÇO: " + value.Endereco + ", " + value.Numero + ", " + (string.IsNullOrWhiteSpace(value.Complemento) ? "-" : (value.Complemento ?? "")) + ", " + value.Bairro + ", " + value.Cidade + "/" + value.Uf + " - " + value.Cep); + if (Parceiros.Any((Parceiro x) => ((DomainBase)x).Id == ((DomainBase)value).Id)) + { + DomainBase.Copy(Parceiros.First((Parceiro x) => ((DomainBase)x).Id == ((DomainBase)value).Id), value); + } + else + { + Parceiros.Add(value); + } + if (ParceirosFiltrados.Any((Parceiro x) => ((DomainBase)x).Id == ((DomainBase)value).Id)) + { + DomainBase.Copy(ParceirosFiltrados.First((Parceiro x) => ((DomainBase)x).Id == ((DomainBase)value).Id), value); + } + else + { + ParceirosFiltrados.Add(value); + } + ParceirosFiltrados = new ObservableCollection(ParceirosFiltrados); + Recursos.Parceiros = Parceiros; + WorkOnSelectedParceiro(value, registrar: false); + Alterar(alterar: false); + ToggleSnackBar("PARCEIRO SALVO COM SUCESSO"); + return null; + } + + public async void Excluir() + { + if (SelectedParceiro == null || ((DomainBase)SelectedParceiro).Id == 0L) + { + return; + } + if (await new BaseServico().ParceiroUtilizado(((DomainBase)SelectedParceiro).Id)) + { + await ShowMessage("PARCEIRO NÃO PODE SER EXCLUÍDO POIS ESTÁ SENDO UTILIZADO."); + } + else + { + if (!(await ShowMessage("DESEJA EXCLUIR?", "SIM", "NÃO"))) + { + return; + } + Loading(isLoading: true); + if (!(await _servico.Delete(SelectedParceiro))) + { + Loading(isLoading: false); + return; + } + RegistrarAcao("EXCLUIU O PARCEIRO \"" + SelectedParceiro.Nome + "\"", ((DomainBase)SelectedParceiro).Id, (TipoTela)22, "DOCUMENTO: " + SelectedParceiro.Cgccpf + "\nTELEFONE 1: (" + SelectedParceiro.Ddd1 + ") " + SelectedParceiro.Telefone1 + "\nTELEFONE 2: (" + SelectedParceiro.Ddd2 + ") " + SelectedParceiro.Telefone2 + "\nTELEFONE 3: (" + SelectedParceiro.Ddd3 + ") " + SelectedParceiro.Telefone3 + "\nE-MAIL: " + SelectedParceiro.Email + "\n\nENDEREÇO: " + SelectedParceiro.Endereco + ", " + SelectedParceiro.Numero + ", " + (string.IsNullOrWhiteSpace(SelectedParceiro.Complemento) ? "-" : (SelectedParceiro.Complemento ?? "")) + ", " + SelectedParceiro.Bairro + ", " + SelectedParceiro.Cidade + "/" + SelectedParceiro.Uf + " - " + SelectedParceiro.Cep); + int num = ParceirosFiltrados.IndexOf(SelectedParceiro); + Parceiros.Remove(SelectedParceiro); + ParceirosFiltrados.Remove(SelectedParceiro); + ParceirosFiltrados = new ObservableCollection(ParceirosFiltrados); + if (ParceirosFiltrados.Count > 0) + { + SelecionarParceiro((num < ParceirosFiltrados.Count) ? ParceirosFiltrados.ElementAt(num) : ParceirosFiltrados.Last()); + } + else + { + Incluir(); + Alterar(alterar: false); + base.EnableMenu = false; + } + Loading(isLoading: false); + ToggleSnackBar("PARCEIRO EXCLUÍDO COM SUCESSO"); + } + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Ferramentas/ComboModelo.cs b/Decompiler/Gestor.Application.ViewModels.Ferramentas/ComboModelo.cs new file mode 100644 index 0000000..1d78404 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Ferramentas/ComboModelo.cs @@ -0,0 +1,37 @@ +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Domain.MalaDireta; + +namespace Gestor.Application.ViewModels.Ferramentas; + +public class ComboModelo : BaseViewModel +{ + private ModeloMalaDireta _modeloMalaDireta = new ModeloMalaDireta(); + + private bool _indisponivel; + + public ModeloMalaDireta ModeloMalaDireta + { + get + { + return _modeloMalaDireta; + } + set + { + _modeloMalaDireta = value; + OnPropertyChanged("ModeloMalaDireta"); + } + } + + public bool Indisponivel + { + get + { + return _indisponivel; + } + set + { + _indisponivel = value; + OnPropertyChanged("Indisponivel"); + } + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Ferramentas/ComboVariavel.cs b/Decompiler/Gestor.Application.ViewModels.Ferramentas/ComboVariavel.cs new file mode 100644 index 0000000..f1df618 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Ferramentas/ComboVariavel.cs @@ -0,0 +1,47 @@ +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Domain.MalaDireta; + +namespace Gestor.Application.ViewModels.Ferramentas; + +public class ComboVariavel : BaseViewModel +{ + private VariaveisMalaDireta _variaveisMalaDireta; + + private bool _indisponivel; + + public VariaveisMalaDireta VariaveisMalaDireta + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _variaveisMalaDireta; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _variaveisMalaDireta = value; + OnPropertyChanged("VariaveisMalaDireta"); + } + } + + public bool Indisponivel + { + get + { + return _indisponivel; + } + set + { + _indisponivel = value; + OnPropertyChanged("Indisponivel"); + } + } + + public ComboVariavel(VariaveisMalaDireta variaveisMalaDireta, bool indisponivel) + { + //IL_0007: Unknown result type (might be due to invalid IL or missing references) + VariaveisMalaDireta = variaveisMalaDireta; + Indisponivel = indisponivel; + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Ferramentas/DownloadViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Ferramentas/DownloadViewModel.cs new file mode 100644 index 0000000..1246bfe --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Ferramentas/DownloadViewModel.cs @@ -0,0 +1,482 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Globalization; +using System.IO; +using System.IO.Compression; +using System.Linq; +using System.Net; +using System.Runtime.InteropServices; +using System.Text.RegularExpressions; +using System.Threading; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Media; +using Gestor.Application.Helpers; +using Gestor.Application.ViewModels.Generic; +using Gestor.Application.Views.Ferramentas; +using Gestor.Common.Validation; +using Gestor.Model.API; +using Gestor.Model.Domain.Generic; +using IWshRuntimeLibrary; + +namespace Gestor.Application.ViewModels.Ferramentas; + +public class DownloadViewModel : BaseSegurosViewModel +{ + private const string _path = "c:\\AggerSeguros\\"; + + private string _head; + + private string _total; + + private string _progresso; + + private decimal _porcentagem; + + private bool _processando = true; + + private Geometry _maximizeRestore = Geometry.Parse((string)Application.Current.Resources[(object)"Maximize"]); + + private Parameters Parameters { get; set; } + + private string CurrentVersion { get; set; } + + public string Head + { + get + { + return _head; + } + set + { + _head = value; + OnPropertyChanged("Head"); + } + } + + public string Total + { + get + { + return _total; + } + set + { + _total = value; + OnPropertyChanged("Total"); + } + } + + public string Progresso + { + get + { + return _progresso; + } + set + { + _progresso = value; + OnPropertyChanged("Progresso"); + } + } + + public decimal Porcentagem + { + get + { + return _porcentagem; + } + set + { + _porcentagem = value; + Progresso = $"{value}% de {Total} MB"; + OnPropertyChanged("Porcentagem"); + } + } + + public bool Processando + { + get + { + return _processando; + } + set + { + _processando = value; + OnPropertyChanged("Processando"); + } + } + + public Geometry MaximizeRestore + { + get + { + return _maximizeRestore; + } + set + { + _maximizeRestore = value; + OnPropertyChanged("MaximizeRestore"); + } + } + + public DownloadViewModel(Parameters parameters) + { + Parameters = parameters; + base.IsEnabled = false; + Head = "ATUALIZAÇÃO " + Parameters.Directory.ToUpper(); + } + + public async Task Atualizar() + { + string rota = (Parameters.Beta ? "Beta" : "Released"); + switch (Parameters.Type) + { + default: + { + CurrentVersion = await GetCurrentVersion(Parameters.Directory); + Version val2 = await Connection.Get($"Update/{rota}/{Parameters.Type}"); + if (VerificarVersao(val2)) + { + Open(); + } + else + { + await Atualizar(val2); + } + break; + } + case 88: + if (!File.Exists("c:\\AggerSeguros\\Aggilizador.Application.exe")) + { + Parameters.Arguments = ""; + await AtualizarAggilizador(); + } + else + { + Parameters.Application = "Aggilizador.Application.exe"; + Open(); + } + break; + case 7: + try + { + Version val = await Connection.Get($"Update/{rota}/{Parameters.Type}"); + FileVersionInfo fileVersionInfo = (File.Exists("c:\\AggerSeguros\\Agger.Gestor.exe") ? FileVersionInfo.GetVersionInfo("c:\\AggerSeguros\\Agger.Gestor.exe") : null); + if (fileVersionInfo == null || !Version.TryParse(fileVersionInfo.FileVersion, out Version result) || !(result >= Version.Parse(val.VersaoAplicacao))) + { + await AtualizarGestor(val, criarAtalho: true); + } + else + { + Funcoes.Destroy(); + } + break; + } + catch (Exception) + { + Funcoes.Destroy(); + break; + } + case 99: + await Atualizar(await Connection.Get($"Update/Released/{Parameters.Type}")); + break; + } + } + + public void Open() + { + if (!Parameters.Run) + { + Funcoes.Destroy(); + return; + } + string fileName = Path.Combine((Parameters.Type == 99 || Parameters.Type == 88) ? "c:\\AggerSeguros\\" : ("c:\\AggerSeguros\\" + CurrentVersion), Parameters.Application); + try + { + Process.Start(fileName, Parameters.Arguments); + } + catch + { + } + Funcoes.Destroy(); + } + + private bool CheckFreeSpace() + { + DriveInfo driveInfo = new DriveInfo("C"); + if (driveInfo.IsReady) + { + return driveInfo.AvailableFreeSpace > 314572800; + } + return false; + } + + public async Task Atualizar(Version version) + { + if (!CheckFreeSpace()) + { + Erro.RegistrarErro(new LogError + { + IdFornecedor = ApplicationHelper.IdFornecedor, + Fornecedor = Recursos.Empresa.Nome, + UsuarioLogado = Recursos.Usuario.Nome, + IdUsuarioLogado = ((DomainBase)Recursos.Usuario).Id, + Versao = ApplicationHelper.Versao.ToString(), + Data = Funcoes.GetNetworkTime(), + IdErro = 1001, + Erro = ValidationHelper.GetDescription((Enum)(object)(TipoErro)1001) + " - " + version.Name, + HResult = 0, + HelpLink = "", + Message = "", + Source = "", + StackTrace = "", + Maquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName + }); + return; + } + string text = "c:\\AggerSeguros\\" + version.Name; + if (Directory.Exists(text)) + { + Directory.Delete(text, recursive: true); + } + while (Directory.Exists(text)) + { + Thread.Sleep(500); + } + Directory.CreateDirectory(text); + using WebClient webClient = new WebClient(); + webClient.DownloadFileCompleted += DownloadFileComplete; + webClient.DownloadProgressChanged += DownloadProgressCallback; + CurrentVersion = version.Name; + string address = ((Parameters.Type == 99) ? (version.Uri + "/" + version.Name + ".exe") : (version.Uri + "/" + version.Name + ".zip")); + string fileName = ((Parameters.Type == 99) ? (text + ".exe") : (text + "//" + version.Name + ".zip")); + Stream stream = webClient.OpenRead(address); + Total = Math.Round((float)long.Parse(webClient.ResponseHeaders["Content-Length"]) / 1024f / 1024f, 2).ToString(CultureInfo.InvariantCulture); + stream?.Dispose(); + await webClient.DownloadFileTaskAsync(address, fileName); + webClient.Dispose(); + } + + public async Task AtualizarGestor(Version version, bool criarAtalho = false) + { + string text = "c:\\AggerSeguros\\"; + using (WebClient webClient = new WebClient()) + { + webClient.DownloadFileCompleted += DownloadFileCompleteGestor; + webClient.DownloadProgressChanged += DownloadProgressCallback; + CurrentVersion = version.Name; + string address = version.Uri + "/" + version.Name + ".zip"; + string fileName = text + version.Name + ".zip"; + Stream stream = webClient.OpenRead(address); + Total = Math.Round((float)long.Parse(webClient.ResponseHeaders["Content-Length"]) / 1024f / 1024f, 2).ToString(CultureInfo.InvariantCulture); + stream?.Dispose(); + await webClient.DownloadFileTaskAsync(address, fileName); + webClient.Dispose(); + } + if (criarAtalho) + { + CriarAtalho(); + } + } + + private void CriarAtalho() + { + WshShell wshShell = (WshShell)Activator.CreateInstance(Marshal.GetTypeFromCLSID(new Guid("72C24DD5-D70A-438B-8A42-98424B88AFB8"))); + string text = "c:\\AggerSeguros\\"; + string text2 = "Agger.Gestor.exe"; + string description = "Agger Gestor"; + try + { + if (wshShell.CreateShortcut(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\Agger Gestor.lnk") is IWshShortcut wshShortcut) + { + wshShortcut.TargetPath = text + text2; + wshShortcut.WindowStyle = 1; + wshShortcut.Description = description; + wshShortcut.WorkingDirectory = text; + wshShortcut.IconLocation = text + text2 + ",0"; + wshShortcut.Save(); + } + } + catch (Exception) + { + } + try + { + if (wshShell.CreateShortcut(Environment.GetFolderPath(Environment.SpecialFolder.Programs) + "\\Agger Gestor.lnk") is IWshShortcut wshShortcut2) + { + wshShortcut2.TargetPath = text + text2; + wshShortcut2.WindowStyle = 1; + wshShortcut2.Description = description; + wshShortcut2.WorkingDirectory = text; + wshShortcut2.IconLocation = text + text2 + ",0"; + wshShortcut2.Save(); + } + } + catch (Exception) + { + } + try + { + if (wshShell.CreateShortcut(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Agger Gestor.lnk") is IWshShortcut wshShortcut3) + { + wshShortcut3.TargetPath = text + text2; + wshShortcut3.WindowStyle = 1; + wshShortcut3.Description = description; + wshShortcut3.WorkingDirectory = text; + wshShortcut3.IconLocation = text + text2 + ",0"; + wshShortcut3.Save(); + } + } + catch (Exception) + { + } + try + { + if (wshShell.CreateShortcut(Environment.GetFolderPath(Environment.SpecialFolder.StartMenu) + "\\Agger Gestor.lnk") is IWshShortcut wshShortcut4) + { + wshShortcut4.TargetPath = text + text2; + wshShortcut4.WindowStyle = 1; + wshShortcut4.Description = description; + wshShortcut4.WorkingDirectory = text; + wshShortcut4.IconLocation = text + text2 + ",0"; + wshShortcut4.Save(); + } + } + catch (Exception) + { + } + } + + public async Task AtualizarAggilizador() + { + if (!CheckFreeSpace()) + { + Erro.RegistrarErro(new LogError + { + IdFornecedor = ApplicationHelper.IdFornecedor, + Fornecedor = Recursos.Empresa.Nome, + UsuarioLogado = Recursos.Usuario.Nome, + IdUsuarioLogado = ((DomainBase)Recursos.Usuario).Id, + Versao = ApplicationHelper.Versao.ToString(), + Data = Funcoes.GetNetworkTime(), + IdErro = 1001, + Erro = ValidationHelper.GetDescription((Enum)(object)(TipoErro)1001) + " - AGGILIZADOR", + HResult = 0, + HelpLink = "", + Message = "", + Source = "", + StackTrace = "", + Maquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName + }); + } + else + { + using WebClient webClient = new WebClient(); + webClient.DownloadFileCompleted += DownloadFileComplete; + webClient.DownloadProgressChanged += DownloadProgressCallback; + string address = "https://update.aggilizador.com.br/stable/Instalador.exe"; + string fileName = "c:\\AggerSeguros\\" + Parameters.Application; + Stream stream = webClient.OpenRead(address); + Total = Math.Round((float)long.Parse(webClient.ResponseHeaders["Content-Length"]) / 1024f / 1024f, 2).ToString(CultureInfo.InvariantCulture); + stream?.Dispose(); + await webClient.DownloadFileTaskAsync(address, fileName); + webClient.Dispose(); + } + } + + private bool VerificarVersao(Version versao) + { + bool flag = File.Exists("c:\\AggerSeguros\\\\" + CurrentVersion + "\\" + Parameters.Application); + return versao.Name == CurrentVersion && flag; + } + + private async Task GetCurrentVersion(string name) + { + return await Task.Run(delegate + { + string[] directories = Directory.GetDirectories("c:\\AggerSeguros\\"); + List list = new List(); + string[] array = directories; + foreach (string text in array) + { + if (text.IndexOf(name, StringComparison.Ordinal) > -1) + { + Match match = new Regex("(^[A-Za-z]+)(.)([A-Za-z]+)(\\d+)", RegexOptions.IgnoreCase).Match(text.Replace("c:\\AggerSeguros\\", "")); + if (match.Success) + { + long item = long.Parse(match.Groups[4].Value); + list.Add(item); + } + } + } + list.Reverse(); + return (list.Count != 0) ? $"{name}{list.First()}" : ""; + }); + } + + private void DownloadFileComplete(object sender, AsyncCompletedEventArgs e) + { + Processando = true; + Porcentagem = 0m; + Extract(); + Open(); + } + + private void DownloadFileCompleteGestor(object sender, AsyncCompletedEventArgs e) + { + Processando = true; + Porcentagem = 0m; + ExtractGestor(); + Funcoes.Destroy(); + } + + public void Extract() + { + if (Parameters.Type != 99 && Parameters.Type != 88) + { + string text = "c:\\AggerSeguros\\" + CurrentVersion; + string text2 = text + "\\" + CurrentVersion + ".zip"; + _ = text + "\\" + Parameters.Application; + ZipFile.ExtractToDirectory(text2, text); + File.Delete(text2); + } + } + + public void ExtractGestor() + { + string text = "c:\\AggerSeguros\\" + CurrentVersion + ".zip"; + ZipArchive zipArchive = ZipFile.OpenRead(text); + try + { + foreach (ZipArchiveEntry entry in zipArchive.Entries) + { + string fullPath = Path.GetFullPath(Path.Combine("c:\\AggerSeguros\\", entry.FullName)); + fullPath.StartsWith("c:\\AggerSeguros\\", StringComparison.OrdinalIgnoreCase); + if (entry.Name == "") + { + Directory.CreateDirectory(Path.GetDirectoryName(fullPath)); + } + else + { + entry.ExtractToFile(fullPath, overwrite: true); + } + } + zipArchive.Dispose(); + File.Delete(text); + } + catch (Exception) + { + } + } + + private void DownloadProgressCallback(object sender, DownloadProgressChangedEventArgs e) + { + Processando = false; + Porcentagem = e.ProgressPercentage; + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Ferramentas/EmpresaViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Ferramentas/EmpresaViewModel.cs new file mode 100644 index 0000000..578dbd9 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Ferramentas/EmpresaViewModel.cs @@ -0,0 +1,444 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Forms; +using System.Windows.Input; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Ferramentas; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels.Command; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Helpers; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; + +namespace Gestor.Application.ViewModels.Ferramentas; + +public class EmpresaViewModel : BaseSegurosViewModel +{ + private readonly EmpresaServico _servico; + + public Empresa CancelEmpresa; + + private Empresa _selectedEmpresa = new Empresa(); + + private string _logoLabel = "ANEXAR LOGOTIPO"; + + private bool _passWordReadOnly; + + private bool _enableConsultaEspaco = true; + + private double _espaco; + + private string _senha; + + private string _confirmaSenha; + + private ObservableCollection _empresasFiltradas = new ObservableCollection(); + + private bool _isExpanded; + + public ICommand ConsultarEspacoCommand { get; set; } + + public List Empresas { get; set; } + + public Empresa SelectedEmpresa + { + get + { + return _selectedEmpresa; + } + set + { + _selectedEmpresa = value; + object senha; + if (value == null) + { + senha = null; + } + else + { + string senhaAdmin = value.SenhaAdmin; + senha = ((senhaAdmin != null) ? EncryptionHelper.Decrypt(senhaAdmin) : null); + } + Senha = (string)senha; + ConfirmaSenha = string.Empty; + WorkOnSelectedEmpresa(value); + VerificarEnables((value != null) ? new long?(((DomainBase)value).Id) : null); + OnPropertyChanged("SelectedEmpresa"); + } + } + + public string LogoLabel + { + get + { + return _logoLabel; + } + set + { + _logoLabel = value; + OnPropertyChanged("LogoLabel"); + } + } + + public bool PassWordReadOnly + { + get + { + return _passWordReadOnly; + } + set + { + _passWordReadOnly = value && (Recursos.Usuario.Administrador || ((DomainBase)Recursos.Usuario).Id == 0); + OnPropertyChanged("PassWordReadOnly"); + } + } + + public bool EnableConsultaEspaco + { + get + { + return _enableConsultaEspaco; + } + set + { + _enableConsultaEspaco = value; + OnPropertyChanged("EnableConsultaEspaco"); + } + } + + public double Espaco + { + get + { + return _espaco; + } + set + { + _espaco = value; + OnPropertyChanged("Espaco"); + } + } + + public string Senha + { + get + { + return _senha; + } + set + { + _senha = value; + OnPropertyChanged("Senha"); + } + } + + public string ConfirmaSenha + { + get + { + return _confirmaSenha; + } + set + { + _confirmaSenha = value; + OnPropertyChanged("ConfirmaSenha"); + } + } + + public ObservableCollection EmpresasFiltradas + { + get + { + return _empresasFiltradas; + } + set + { + _empresasFiltradas = value; + IsExpanded = value != null && value.Count > 0; + OnPropertyChanged("EmpresasFiltradas"); + } + } + + private Visibility _visualizacaoMatriz { get; set; } = (Visibility)2; + + + public Visibility VisualizacaoMatriz + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visualizacaoMatriz; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + _visualizacaoMatriz = value; + OnPropertyChanged("VisualizacaoMatriz"); + } + } + + private Visibility _confirmacaoSenha { get; set; } = (Visibility)2; + + + public Visibility ConfirmacaoSenha + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _confirmacaoSenha; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + _confirmacaoSenha = value; + OnPropertyChanged("ConfirmacaoSenha"); + } + } + + public bool IsExpanded + { + get + { + return _isExpanded; + } + set + { + _isExpanded = value; + OnPropertyChanged("IsExpanded"); + } + } + + public EmpresaViewModel() + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_000b: Expected O, but got Unknown + //IL_002a: Unknown result type (might be due to invalid IL or missing references) + //IL_0031: Unknown result type (might be due to invalid IL or missing references) + ConsultarEspacoCommand = new RelayCommand(async delegate + { + await ConsultaEspacoUsadoClienteInGb(); + }); + _servico = new EmpresaServico(); + base.EnableMenu = true; + PassWordReadOnly = Recursos.Usuario.Administrador && base.EnableFields; + Seleciona(); + } + + private async void Seleciona() + { + Loading(isLoading: true); + await PermissaoTela((TipoTela)18); + await SelecionaEmpresas(); + Loading(isLoading: false); + } + + private async Task SelecionaEmpresas() + { + Loading(isLoading: true); + Empresas = (from x in await new BaseServico().BuscarEmpresasAsync() + where Recursos.Usuario.IdEmpresa == 1 || ((DomainBase)x).Id == Recursos.Usuario.IdEmpresa + orderby x.Nome + select x).ToList(); + EmpresasFiltradas = new ObservableCollection(Empresas); + if (EmpresasFiltradas.Count > 0) + { + SelecionaEmpresa(EmpresasFiltradas.First()); + } + else + { + SelectedEmpresa = new Empresa(); + Alterar(alterar: false); + base.EnableMenu = false; + } + Loading(isLoading: false); + } + + public void Incluir() + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Expected O, but got Unknown + Empresa selectedEmpresa = new Empresa(); + SelectedEmpresa = selectedEmpresa; + Alterar(alterar: true); + } + + public async Task>> Salvar() + { + List> list = SelectedEmpresa.Validate(); + if ((int)VisualizacaoMatriz != 2 && ConfirmaSenha != Senha) + { + list.Add(new KeyValuePair("SenhaAdmin|SENHA ADM", "A SENHA E A CONFIRMAÇÃO DA SENHA DEVEM SER IGUAIS.")); + } + if (list.Count > 0) + { + return list; + } + if (((DomainBase)SelectedEmpresa).Id == 1) + { + SelectedEmpresa.SenhaAdmin = EncryptionHelper.Encrypt(Senha); + } + string acao = ((((DomainBase)SelectedEmpresa).Id == 0L) ? "INCLUIU" : "ALTEROU"); + Empresa value = await _servico.Save(SelectedEmpresa); + if (!_servico.Sucesso) + { + return null; + } + RegistrarAcao(acao + " EMPRESA \"" + value.Nome + "\"", ((DomainBase)value).Id, (TipoTela)18, $"EMPRESA \"{value.Nome}\", ID: {((DomainBase)value).Id}"); + if (Empresas.Any((Empresa x) => ((DomainBase)x).Id == ((DomainBase)value).Id)) + { + DomainBase.Copy(Empresas.First((Empresa x) => ((DomainBase)x).Id == ((DomainBase)value).Id), value); + } + else + { + Empresas.Add(value); + } + if (EmpresasFiltradas.Any((Empresa x) => ((DomainBase)x).Id == ((DomainBase)value).Id)) + { + DomainBase.Copy(EmpresasFiltradas.First((Empresa x) => ((DomainBase)x).Id == ((DomainBase)value).Id), value); + } + else + { + EmpresasFiltradas.Add(value); + } + EmpresasFiltradas = new ObservableCollection(EmpresasFiltradas); + Recursos.Empresas = Empresas; + WorkOnSelectedEmpresa(value, registrar: false); + Alterar(alterar: false); + ToggleSnackBar("EMPRESA SALVA COM SUCESSO"); + return null; + } + + public void CancelarAlteracao() + { + if (CancelEmpresa != null && Empresas.Any((Empresa x) => ((DomainBase)x).Id == ((DomainBase)CancelEmpresa).Id)) + { + DomainBase.Copy(Empresas.First((Empresa x) => ((DomainBase)x).Id == ((DomainBase)CancelEmpresa).Id), CancelEmpresa); + if (EmpresasFiltradas.Count > 0 && EmpresasFiltradas.Any((Empresa x) => ((DomainBase)x).Id == ((DomainBase)CancelEmpresa).Id)) + { + DomainBase.Copy(EmpresasFiltradas.First((Empresa x) => ((DomainBase)x).Id == ((DomainBase)CancelEmpresa).Id), CancelEmpresa); + } + else + { + EmpresasFiltradas.Add(CancelEmpresa); + } + EmpresasFiltradas = new ObservableCollection(EmpresasFiltradas); + SelectedEmpresa = EmpresasFiltradas.First((Empresa x) => ((DomainBase)x).Id == ((DomainBase)CancelEmpresa).Id); + } + else + { + Incluir(); + } + Alterar(alterar: false); + } + + private void WorkOnSelectedEmpresa(Empresa value, bool registrar = true) + { + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_0069: Unknown result type (might be due to invalid IL or missing references) + //IL_0070: Invalid comparison between Unknown and I4 + //IL_00d6: Unknown result type (might be due to invalid IL or missing references) + CancelEmpresa = (Empresa)((value == null || ((DomainBase)value).Id == 0L) ? ((object)CancelEmpresa) : ((object)(Empresa)((DomainBase)value).Clone())); + if (value == null || ((DomainBase)value).Id == 0L || (LastAccessId == ((DomainBase)value).Id && (int)LastAccessTela == 18)) + { + return; + } + if (registrar) + { + RegistrarAcao("ACESSOU EMPRESA \"" + value.Nome + "\"", ((DomainBase)value).Id, (TipoTela)18, $"ID EMPRESA: {((DomainBase)value).Id}"); + } + LastAccessId = ((DomainBase)value).Id; + LastAccessTela = (TipoTela)18; + Empresa selectedEmpresa = SelectedEmpresa; + if (((selectedEmpresa != null) ? new long?(((DomainBase)selectedEmpresa).Id) : null) != ((DomainBase)value).Id) + { + SelectedEmpresa = ((IEnumerable)EmpresasFiltradas).FirstOrDefault((Func)((Empresa x) => ((DomainBase)x).Id == ((DomainBase)value).Id)); + } + Empresa selectedEmpresa2 = SelectedEmpresa; + LogoLabel = ((((selectedEmpresa2 != null) ? selectedEmpresa2.Logo : null) == null) ? "ANEXAR LOGOTIPO" : "ALTERAR LOGOTIPO"); + VisualizacaoMatriz = (Visibility)((((DomainBase)SelectedEmpresa).Id != 1) ? 2 : 0); + } + + internal async Task> Filtrar(string value) + { + return await Task.Run(() => FiltrarEmpresa(value)); + } + + public List FiltrarEmpresa(string filter) + { + EmpresasFiltradas = (string.IsNullOrWhiteSpace(filter) ? new ObservableCollection(Empresas) : new ObservableCollection(from x in Empresas + where ValidationHelper.RemoveDiacritics(x.Nome.Trim()).ToUpper().Contains(ValidationHelper.RemoveDiacritics(filter)) + orderby x.Nome + select x)); + return EmpresasFiltradas.ToList(); + } + + public async void SelecionaEmpresa(Empresa empresa) + { + Empresa val = await _servico.BuscarEmpresaPorId(((DomainBase)empresa).Id); + DomainBase.Copy(EmpresasFiltradas.First((Empresa x) => ((DomainBase)x).Id == ((DomainBase)empresa).Id), val); + SelectedEmpresa = EmpresasFiltradas.First((Empresa x) => ((DomainBase)x).Id == ((DomainBase)empresa).Id); + } + + public async Task AnexarLogo() + { + string text = ""; + OpenFileDialog val = new OpenFileDialog(); + try + { + val.Multiselect = false; + ((FileDialog)val).Filter = "Imagens|*.jpg;*.jpeg;*.png;"; + ((FileDialog)val).InitialDirectory = Environment.SpecialFolder.Desktop.ToString(); + if (1 != (int)((CommonDialog)val).ShowDialog()) + { + return; + } + text = ((FileDialog)val).FileName; + } + finally + { + ((IDisposable)val)?.Dispose(); + } + try + { + using MemoryStream memoryStream = new MemoryStream(File.ReadAllBytes(text)); + byte[] array = new byte[memoryStream.Length]; + memoryStream.Position = 0L; + memoryStream.Read(array, 0, array.Length); + SelectedEmpresa.Logo = array; + } + catch (Exception) + { + await ShowMessage("NÃO FOI POSSÍVEL CARREGAR O ARQUIVO " + text + "." + Environment.NewLine + "O ARQUIVO ESTÁ INACESSÍVEL OU SENDO UTILIZADO POR OUTRO PROCESSO."); + } + } + + public async Task ConsultaEspacoUsadoClienteInGb() + { + EnableConsultaEspaco = false; + Loading(isLoading: true); + double espacoBanco = await _servico.ConsultaEspacoBancoInGb(); + double espacoStorageInGB = 0.0; + if (Connection.ConnectionAddress.UsaAzureStorage) + { + double num = await Connection.EspacoUsadoAzureInBytes(); + if (num > 0.0) + { + espacoStorageInGB = num / 1024.0 / 1024.0 / 1024.0; + } + } + Espaco = espacoBanco + espacoStorageInGB; + if (Espaco == 0.0) + { + EnableConsultaEspaco = true; + } + Loading(isLoading: false); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Ferramentas/EstipulanteViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Ferramentas/EstipulanteViewModel.cs new file mode 100644 index 0000000..2848ad4 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Ferramentas/EstipulanteViewModel.cs @@ -0,0 +1,316 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Ferramentas; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Ferramentas; + +public class EstipulanteViewModel : BaseSegurosViewModel +{ + private readonly EstipulanteServico _servico; + + public Estipulante CancelEstipulante; + + private Estipulante _selectedEstipulante = new Estipulante(); + + private ObservableCollection _estipulantesFiltrados = new ObservableCollection(); + + private bool _isExpanded; + + public List Estipulantes { get; set; } + + public Estipulante SelectedEstipulante + { + get + { + return _selectedEstipulante; + } + set + { + _selectedEstipulante = value; + WorkOnSelectedEstipulante(value); + VerificarEnables((value != null) ? new long?(((DomainBase)value).Id) : null); + OnPropertyChanged("SelectedEstipulante"); + if (value != null) + { + ((DomainBase)SelectedEstipulante).Initialize(); + } + } + } + + public ObservableCollection EstipulantesFiltrados + { + get + { + return _estipulantesFiltrados; + } + set + { + _estipulantesFiltrados = value; + IsExpanded = value != null && value.Count > 0; + OnPropertyChanged("EstipulantesFiltrados"); + } + } + + public bool IsExpanded + { + get + { + return _isExpanded; + } + set + { + _isExpanded = value; + OnPropertyChanged("IsExpanded"); + } + } + + public EstipulanteViewModel() + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_000b: Expected O, but got Unknown + _servico = new EstipulanteServico(); + base.EnableMenu = true; + Seleciona(); + } + + private async void Seleciona() + { + Loading(isLoading: true); + await PermissaoTela((TipoTela)9); + await SelecionaEstipulantes(); + Loading(isLoading: false); + } + + private async Task SelecionaEstipulantes() + { + Loading(isLoading: true); + List list = await new BaseServico().BuscarEstipulantesAsync(); + Estipulantes = (from x in list + where Recursos.Usuario.IdEmpresa == 1 || Recursos.Usuario.IdEmpresa == x.IdEmpresa + orderby x.Ativo descending, x.Nome + select x).ToList(); + EstipulantesFiltrados = new ObservableCollection(Estipulantes); + if (EstipulantesFiltrados.Count > 0) + { + SelecionaEstipulante(EstipulantesFiltrados.First()); + } + else + { + SelectedEstipulante = new Estipulante(); + Alterar(alterar: false); + base.EnableMenu = false; + } + Recursos.Estipulantes = list; + Loading(isLoading: false); + } + + public async Task>> Validate() + { + List> errors = new List>(); + bool valida = !string.IsNullOrEmpty(SelectedEstipulante.Nome); + List list = ((!ValidationHelper.ValidateDocument(SelectedEstipulante.Documento)) ? new List() : (await new BaseServico().BuscarEstipulante(SelectedEstipulante.Documento))); + List list2 = list; + string nome = ""; + if (list2.Count > 0) + { + list2.ForEach(delegate(Estipulante x) + { + if (((DomainBase)x).Id != ((DomainBase)SelectedEstipulante).Id && !string.IsNullOrEmpty(SelectedEstipulante.Documento) && x.Documento == SelectedEstipulante.Documento) + { + valida = false; + nome = x.Nome; + } + }); + } + if (!valida) + { + errors.Add(new KeyValuePair("Documento", "O DOCUMENTO ESTÁ CADASTRADO PARA O ESTIPULANTE " + nome + ".")); + } + return errors; + } + + public void Incluir() + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Expected O, but got Unknown + SelectedEstipulante = new Estipulante + { + IdEmpresa = Recursos.Usuario.IdEmpresa, + Ativo = true + }; + Alterar(alterar: true); + } + + public async Task>> Salvar() + { + List> errorMessages = SelectedEstipulante.Validate(); + List> list = errorMessages; + list.AddRange(await Validate()); + if (errorMessages.Count > 0) + { + return errorMessages; + } + string acao = ((((DomainBase)SelectedEstipulante).Id == 0L) ? "INCLUIU" : "ALTEROU"); + Estipulante value = await _servico.Save(SelectedEstipulante); + if (!_servico.Sucesso) + { + return null; + } + RegistrarAcao(acao + " ESTIPULANTE \"" + value.Nome + "\"", ((DomainBase)value).Id, (TipoTela)9, $"ESTIPULANTE \"{value.Nome}\", ID: {((DomainBase)value).Id}"); + if (Estipulantes.Any((Estipulante x) => ((DomainBase)x).Id == ((DomainBase)value).Id)) + { + DomainBase.Copy(Estipulantes.First((Estipulante x) => ((DomainBase)x).Id == ((DomainBase)value).Id), value); + } + else + { + Estipulantes.Add(value); + } + if (EstipulantesFiltrados.Any((Estipulante x) => ((DomainBase)x).Id == ((DomainBase)value).Id)) + { + DomainBase.Copy(EstipulantesFiltrados.First((Estipulante x) => ((DomainBase)x).Id == ((DomainBase)value).Id), value); + } + else + { + EstipulantesFiltrados.Add(value); + } + EstipulantesFiltrados = new ObservableCollection(EstipulantesFiltrados); + Recursos.Estipulantes = Estipulantes; + WorkOnSelectedEstipulante(value, registrar: false); + Alterar(alterar: false); + ((DomainBase)SelectedEstipulante).Initialize(); + ToggleSnackBar("ESTIPULANTE SALVO COM SUCESSO"); + return null; + } + + private void WorkOnSelectedEstipulante(Estipulante value, bool registrar = true) + { + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_0069: Unknown result type (might be due to invalid IL or missing references) + //IL_0070: Invalid comparison between Unknown and I4 + //IL_00d6: Unknown result type (might be due to invalid IL or missing references) + CancelEstipulante = (Estipulante)((value == null || ((DomainBase)value).Id == 0L) ? ((object)CancelEstipulante) : ((object)(Estipulante)((DomainBase)value).Clone())); + if (value == null || ((DomainBase)value).Id == 0L || (LastAccessId == ((DomainBase)value).Id && (int)LastAccessTela == 9)) + { + return; + } + if (registrar) + { + RegistrarAcao("ACESSOU ESTIPULANTE \"" + value.Nome + "\"", ((DomainBase)value).Id, (TipoTela)9, $"ID ESTIPULANTE: {((DomainBase)value).Id}"); + } + LastAccessId = ((DomainBase)value).Id; + LastAccessTela = (TipoTela)9; + Estipulante selectedEstipulante = SelectedEstipulante; + if (((selectedEstipulante != null) ? new long?(((DomainBase)selectedEstipulante).Id) : null) != ((DomainBase)value).Id) + { + SelectedEstipulante = ((IEnumerable)EstipulantesFiltrados).FirstOrDefault((Func)((Estipulante x) => ((DomainBase)x).Id == ((DomainBase)value).Id)); + } + } + + public void CancelarAlteracao() + { + if (CancelEstipulante != null && Estipulantes.Any((Estipulante x) => ((DomainBase)x).Id == ((DomainBase)CancelEstipulante).Id)) + { + DomainBase.Copy(Estipulantes.First((Estipulante x) => ((DomainBase)x).Id == ((DomainBase)CancelEstipulante).Id), CancelEstipulante); + if (EstipulantesFiltrados.Count > 0 && EstipulantesFiltrados.Any((Estipulante x) => ((DomainBase)x).Id == ((DomainBase)CancelEstipulante).Id)) + { + DomainBase.Copy(EstipulantesFiltrados.First((Estipulante x) => ((DomainBase)x).Id == ((DomainBase)CancelEstipulante).Id), CancelEstipulante); + } + else + { + EstipulantesFiltrados.Add(CancelEstipulante); + } + EstipulantesFiltrados = new ObservableCollection(EstipulantesFiltrados); + SelectedEstipulante = EstipulantesFiltrados.First((Estipulante x) => ((DomainBase)x).Id == ((DomainBase)CancelEstipulante).Id); + } + else + { + Incluir(); + } + Alterar(alterar: false); + } + + public async void Excluir() + { + if (SelectedEstipulante == null || ((DomainBase)SelectedEstipulante).Id == 0L) + { + return; + } + Loading(isLoading: true); + List list = await new BaseServico().BuscarDocumentosPorEstipulante(((DomainBase)SelectedEstipulante).Id); + Loading(isLoading: false); + if (list.Count > 0) + { + string text = "ESTIPULANTE NÃO PODE SER EXCLUÍDO POIS ESTÁ VINCULADO AOS SEGUINTES DOCUMENTOS:"; + foreach (Documento item in list) + { + text = ((!string.IsNullOrWhiteSpace(item.Apolice)) ? (text + $"{Environment.NewLine}DOCUMENTO {list.IndexOf(item) + 1} (NÚMERO DA PROPOSTA: {item.Proposta}, NÚMERO DA APÓLICE: {item.Apolice})") : (text + $"{Environment.NewLine}DOCUMENTO {list.IndexOf(item) + 1} (NÚMERO DA PROPOSTA: {item.Proposta})")); + } + await ShowMessage(text); + } + else + { + if (!(await ShowMessage("DESEJA EXCLUIR?", "SIM", "NÃO"))) + { + return; + } + Loading(isLoading: true); + if (!(await _servico.Delete(SelectedEstipulante))) + { + Loading(isLoading: false); + return; + } + RegistrarAcao("EXCLUIU ESTIPULANTE \"" + SelectedEstipulante.Nome + "\"", ((DomainBase)SelectedEstipulante).Id, (TipoTela)9, $"ESTIPULANTE \"{SelectedEstipulante.Nome}\", ID: {((DomainBase)SelectedEstipulante).Id}"); + int num = EstipulantesFiltrados.IndexOf(SelectedEstipulante); + Estipulantes.Remove(SelectedEstipulante); + EstipulantesFiltrados.Remove(SelectedEstipulante); + EstipulantesFiltrados = new ObservableCollection(EstipulantesFiltrados); + if (EstipulantesFiltrados.Count > 0) + { + SelectedEstipulante = ((num < EstipulantesFiltrados.Count) ? EstipulantesFiltrados.ElementAt(num) : EstipulantesFiltrados.Last()); + } + else + { + SelectedEstipulante = new Estipulante(); + Alterar(alterar: false); + base.EnableMenu = false; + } + Recursos.Estipulantes = await new BaseServico().BuscarEstipulantesAsync(); + Loading(isLoading: false); + ToggleSnackBar("ESTIPULANTE EXCLUÍDO COM SUCESSO"); + } + } + + internal async Task> Filtrar(string value) + { + return await Task.Run(() => FiltrarEstipulante(value)); + } + + public List FiltrarEstipulante(string filter) + { + EstipulantesFiltrados = (string.IsNullOrWhiteSpace(filter) ? new ObservableCollection(Estipulantes) : new ObservableCollection(from x in Estipulantes + where ValidationHelper.RemoveDiacritics(x.Nome.Trim()).ToUpper().Contains(ValidationHelper.RemoveDiacritics(filter)) + orderby x.Ativo descending, x.Nome + select x)); + SelectedEstipulante = EstipulantesFiltrados.FirstOrDefault(); + return EstipulantesFiltrados.ToList(); + } + + public async void SelecionaEstipulante(Estipulante estipulante) + { + Estipulante val = await _servico.BuscarEstipulantePorId(((DomainBase)estipulante).Id); + DomainBase.Copy(EstipulantesFiltrados.First((Estipulante x) => ((DomainBase)x).Id == ((DomainBase)estipulante).Id), val); + SelectedEstipulante = EstipulantesFiltrados.First((Estipulante x) => ((DomainBase)x).Id == ((DomainBase)estipulante).Id); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Ferramentas/EtiquetaViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Ferramentas/EtiquetaViewModel.cs new file mode 100644 index 0000000..a541f8f --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Ferramentas/EtiquetaViewModel.cs @@ -0,0 +1,792 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Diagnostics; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.Servicos.Seguros.Itens; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Ferramentas; + +public class EtiquetaViewModel : BaseSegurosViewModel +{ + private bool _allSelectedChanging; + + private List _tiposEtiqueta = new List { "CLIENTE", "APÓLICE" }; + + private string _tipoEtiqueta = "CLIENTE"; + + private bool? _allSelected; + + private ObservableCollection _apolicesFiltrados = new ObservableCollection(); + + private bool _duasColunas = true; + + private bool _tresColunas; + + private bool _umaPagina; + + private bool _mostrarNascimento; + + private int _pular; + + private object _visibilityColunas; + + private bool _mostrarApolice = true; + + private bool _mostrarVendedor = true; + + private bool _mostrarItem = true; + + public List TiposEtiqueta + { + get + { + return _tiposEtiqueta; + } + set + { + _tiposEtiqueta = value; + OnPropertyChanged("TiposEtiqueta"); + } + } + + public string TipoEtiqueta + { + get + { + return _tipoEtiqueta; + } + set + { + _tipoEtiqueta = value; + OnPropertyChanged("TipoEtiqueta"); + OnPropertyChanged("ExibirControlesEtiquetaApolice"); + OnPropertyChanged("ExibirControlesEtiquetaCliente"); + } + } + + public Visibility ExibirControlesEtiquetaApolice + { + get + { + if (TipoEtiqueta == "APÓLICE") + { + return (Visibility)0; + } + return (Visibility)2; + } + } + + public Visibility ExibirControlesEtiquetaCliente + { + get + { + if (TipoEtiqueta == "CLIENTE") + { + return (Visibility)0; + } + return (Visibility)2; + } + } + + public bool? AllSelected + { + get + { + return _allSelected; + } + set + { + if (value != _allSelected) + { + _allSelected = value; + AllSelectedChanged(); + Apolices = new List(Apolices); + OnPropertyChanged("AllSelected"); + } + } + } + + public List Apolices { get; set; } + + public ObservableCollection ApolicesFiltrados + { + get + { + return _apolicesFiltrados; + } + set + { + _apolicesFiltrados = value; + foreach (Documento apolicesFiltrado in ApolicesFiltrados) + { + apolicesFiltrado.PropertyChanged += EntryOnPropertyChanged; + } + OnPropertyChanged("ApolicesFiltrados"); + } + } + + public bool DuasColunas + { + get + { + return _duasColunas; + } + set + { + _duasColunas = value; + OnPropertyChanged("DuasColunas"); + } + } + + public bool TresColunas + { + get + { + return _tresColunas; + } + set + { + _tresColunas = value; + OnPropertyChanged("TresColunas"); + } + } + + public bool UmaPagina + { + get + { + return _umaPagina; + } + set + { + _umaPagina = value; + VisibilityColunas = (object)(Visibility)(value ? 2 : 0); + OnPropertyChanged("UmaPagina"); + } + } + + public bool MostrarNascimento + { + get + { + return _mostrarNascimento; + } + set + { + _mostrarNascimento = value; + OnPropertyChanged("MostrarNascimento"); + } + } + + public int Pular + { + get + { + return _pular; + } + set + { + _pular = value; + OnPropertyChanged("Pular"); + } + } + + public object VisibilityColunas + { + get + { + return _visibilityColunas; + } + set + { + _visibilityColunas = value; + OnPropertyChanged("VisibilityColunas"); + } + } + + public bool MostrarApolice + { + get + { + return _mostrarApolice; + } + set + { + _mostrarApolice = value; + OnPropertyChanged("MostrarApolice"); + } + } + + public bool MostrarVendedor + { + get + { + return _mostrarVendedor; + } + set + { + _mostrarVendedor = value; + OnPropertyChanged("MostrarVendedor"); + } + } + + public bool MostrarItem + { + get + { + return _mostrarItem; + } + set + { + _mostrarItem = value; + OnPropertyChanged("MostrarItem"); + } + } + + private void EntryOnPropertyChanged(object sender, PropertyChangedEventArgs args) + { + if (args.PropertyName == "Selecionado") + { + RecheckAllSelected(); + } + } + + private void RecheckAllSelected() + { + if (_allSelectedChanging) + { + return; + } + try + { + _allSelectedChanging = true; + if (Apolices.All((Documento e) => e.Selecionado)) + { + AllSelected = true; + } + else if (Apolices.All((Documento e) => !e.Selecionado)) + { + AllSelected = false; + } + else + { + AllSelected = null; + } + } + finally + { + _allSelectedChanging = false; + } + } + + private void AllSelectedChanged() + { + if (_allSelectedChanging) + { + return; + } + try + { + _allSelectedChanging = true; + if (!AllSelected.HasValue) + { + return; + } + foreach (Documento apolice in Apolices) + { + apolice.Selecionado = AllSelected.Value; + } + } + finally + { + _allSelectedChanging = false; + } + } + + public async Task CarregarDados(List list, bool apenasCliente) + { + List source = ((IEnumerable)list.ToList()).Select((Func)((Documento x) => new Cliente + { + Id = ((DomainBase)x.Controle.Cliente).Id + })).ToList(); + ClienteServico clienteServico = new ClienteServico(); + ItemServico itemServico = new ItemServico(); + List enderecos = await clienteServico.BuscarEnderecosPorCliente(source.Where((Cliente x) => ((DomainBase)x).Id > 0).ToList()); + ObservableCollection observableCollection = ((!apenasCliente) ? (await itemServico.BuscarItens(list.ToList())) : null); + ObservableCollection source2 = observableCollection; + foreach (Documento x2 in list) + { + if (enderecos.Where((ClienteEndereco y) => ((DomainBase)y.Cliente).Id == ((DomainBase)x2.Controle.Cliente).Id).Count() == 0) + { + continue; + } + if (((DomainBase)x2.Controle.Cliente).Id > 0) + { + x2.Controle.Cliente.Enderecos = new ObservableCollection(from y in enderecos.Where((ClienteEndereco y) => ((DomainBase)y.Cliente).Id == ((DomainBase)x2.Controle.Cliente).Id).ToList() + orderby y.Ordem + select y); + } + if (!apenasCliente) + { + x2.ItensAtivo = source2.Where((Item y) => ((DomainBase)y.Documento).Id == ((DomainBase)x2).Id).ToList(); + } + } + TipoEtiqueta = (apenasCliente ? "CLIENTE" : "APÓLICE"); + Apolices = (from x in list.Where(delegate(Documento x) + { + Cliente cliente = x.Controle.Cliente; + if (((cliente != null) ? cliente.Enderecos : null) != null) + { + Cliente cliente2 = x.Controle.Cliente; + if (cliente2 == null) + { + return false; + } + return cliente2.Enderecos.Count() > 0; + } + return false; + }) + orderby x.Controle.Cliente.Nome + select x).ToList(); + ApolicesFiltrados = new ObservableCollection(Apolices); + AllSelected = true; + RecheckAllSelected(); + } + + public void EmitirEtiquetas() + { + string text = ""; + List list = Apolices.Where((Documento x) => x.Selecionado).ToList(); + string tipoEtiqueta = TipoEtiqueta; + if (!(tipoEtiqueta == "CLIENTE")) + { + if (tipoEtiqueta == "APÓLICE") + { + if (UmaPagina) + { + text = "ETIQUETAS"; + for (int i = 0; i < list.Count; i++) + { + text += "
" : "30%'>"); + text += "
"; + text += ""; + text += ""; + text = text + ""; + text += ""; + text += "
"; + Documento val = list[i]; + string[] obj = new string[7] + { + text, + val.Controle.Cliente.Nome.Trim(), + "
", + null, + null, + null, + null + }; + object obj2; + if (!MostrarItem) + { + obj2 = null; + } + else + { + if (val.ItensAtivo.Count <= 1) + { + Item? obj3 = val.ItensAtivo.FirstOrDefault(); + obj2 = ((obj3 != null) ? obj3.Descricao.ToUpper() : null) + "
"; + } + else + { + obj2 = "APÓLICE COLETIVA
"; + } + if (obj2 == null) + { + obj2 = ""; + } + } + obj[3] = (string)obj2; + obj[4] = (MostrarApolice ? (((val.Apolice == "PROSPECÇÃO") ? $"{val.Vigencia2:d} - APÓLICE: {val.Apolice}
" : ($"{val.Vigencia1:d} - {val.Vigencia2:d} - APÓLICE: {val.Apolice}" + (string.IsNullOrEmpty(val.Endosso) ? "
" : (" /" + val.Endosso + "
")))) ?? "") : null); + obj[5] = ((val.Apolice == "PROSPECÇÃO") ? "" : (val.Controle.Seguradora.Nome + " - " + val.Controle.Ramo.Nome + "
")); + obj[6] = (MostrarVendedor ? (((val.VendedorPrincipal == null) ? "" : ("VENDEDOR: " + val.VendedorPrincipal.Nome)) ?? "") : null); + text = string.Concat(obj); + text += "
"; + text += "
"; + text += "
"; + } + } + else + { + int num = 0; + int num2 = 0; + double num3 = 0.0; + if (DuasColunas) + { + num = 10; + num2 = 2; + num3 = 10.52; + } + else if (TresColunas) + { + num = 10; + num2 = 3; + num3 = 6.87; + } + Pular %= num * num2; + int pular = Pular; + text = "ETIQUETAS
"; + int num4 = 0; + while (num4 < list.Count) + { + text += "
"; + text = text + ""; + for (int j = 0; j < num * num2; j += num2) + { + text += ""; + for (int k = 0; k < num2; k++) + { + text = text + ""; + } + } + text += "
"; + if (j + k >= Pular) + { + if (num4 < list.Count) + { + Documento val2 = list[num4]; + string[] obj4 = new string[7] + { + text, + val2.Controle.Cliente.Nome.Trim(), + "
", + null, + null, + null, + null + }; + object obj5; + if (!MostrarItem) + { + obj5 = null; + } + else + { + if (val2.ItensAtivo.Count <= 1) + { + Item? obj6 = val2.ItensAtivo.FirstOrDefault(); + obj5 = ((obj6 != null) ? obj6.Descricao.ToUpper() : null) + "
"; + } + else + { + obj5 = "APÓLICE COLETIVA
"; + } + if (obj5 == null) + { + obj5 = ""; + } + } + obj4[3] = (string)obj5; + obj4[4] = ((!MostrarApolice) ? null : (((val2.Apolice == "PROSPECÇÃO") ? $"{val2.Vigencia2:d} - APÓLICE: {val2.Apolice}
" : ($"{val2.Vigencia1:d} - {val2.Vigencia2:d} - APÓLICE: {val2.Apolice}" + (string.IsNullOrEmpty(val2.Endosso) ? "
" : (" /" + val2.Endosso + "
")))) ?? "")); + obj4[5] = ((val2.Apolice == "PROSPECÇÃO") ? "" : (val2.Controle.Seguradora.Nome + " - " + val2.Controle.Ramo.Nome + "
")); + obj4[6] = ((!MostrarVendedor) ? null : (((val2.VendedorPrincipal == null) ? "" : ("VENDEDOR: " + val2.VendedorPrincipal.Nome)) ?? "")); + text = string.Concat(obj4); + num4++; + } + Pular = 0; + } + text += "
"; + text += "
"; + } + Pular = (pular + list.Count) % (num * num2); + } + RegistrarAcao(string.Format("EMITIU ETIQUETA DE {0} DOCUMENTO{1}", list.Count, (list.Count == 1) ? "" : "S"), 0L, (TipoTela)59, "IDS DOS DOCUMENTOS:\n" + string.Join(", ", list.Select((Documento x) => ((DomainBase)x).Id))); + } + } + else + { + list = Apolices.Where((Documento x) => x.Selecionado && x.Controle.Cliente.Enderecos != null).ToList(); + if (UmaPagina) + { + text = "ETIQUETAS"; + for (int l = 0; l < list.Count; l++) + { + text += "
" : "30%'>"); + text += "
"; + text += ""; + text += ""; + text = text + ""; + text += ""; + text += "
"; + Documento val3 = list[l]; + if (MostrarNascimento) + { + val3.Controle.Cliente.Nascimento = new ClienteServico().BuscarNascimento(((DomainBase)val3.Controle.Cliente).Id); + } + string[] obj7 = new string[9] + { + text, + val3.Controle.Cliente.Nome.Trim(), + " ", + (!val3.Controle.Cliente.Nascimento.HasValue || !MostrarNascimento) ? "" : val3.Controle.Cliente.Nascimento?.ToString("dd/MM"), + "
", + null, + null, + null, + null + }; + object obj16; + if (((DomainBase)val3.Controle.Cliente).Id != 0L) + { + string[] array = new string[10]; + ClienteEndereco? obj8 = val3.Controle.Cliente.Enderecos.OrderBy((ClienteEndereco x) => x.Ordem).FirstOrDefault(); + array[0] = ((obj8 == null) ? null : ((EnderecoBase)obj8).Endereco?.Trim()); + array[1] = ", "; + ClienteEndereco? obj9 = val3.Controle.Cliente.Enderecos.FirstOrDefault(); + array[2] = ((obj9 == null) ? null : ((EnderecoBase)obj9).Numero?.Trim()); + ClienteEndereco? obj10 = val3.Controle.Cliente.Enderecos.FirstOrDefault(); + object obj11; + if (string.IsNullOrWhiteSpace((obj10 != null) ? ((EnderecoBase)obj10).Complemento : null)) + { + obj11 = ""; + } + else + { + ClienteEndereco? obj12 = val3.Controle.Cliente.Enderecos.FirstOrDefault(); + obj11 = "
" + ((obj12 == null) ? null : ((EnderecoBase)obj12).Complemento?.Trim()); + } + array[3] = (string)obj11; + array[4] = "
"; + ClienteEndereco? obj13 = val3.Controle.Cliente.Enderecos.FirstOrDefault(); + array[5] = ((obj13 == null) ? null : ((EnderecoBase)obj13).Bairro?.Trim()); + array[6] = " - "; + ClienteEndereco? obj14 = val3.Controle.Cliente.Enderecos.FirstOrDefault(); + array[7] = ((obj14 == null) ? null : ((EnderecoBase)obj14).Cidade?.Trim()); + array[8] = "/"; + ClienteEndereco? obj15 = val3.Controle.Cliente.Enderecos.FirstOrDefault(); + array[9] = ((obj15 == null) ? null : ((EnderecoBase)obj15).Estado?.Trim()); + obj16 = string.Concat(array); + } + else + { + obj16 = ""; + } + obj7[5] = (string)obj16; + obj7[6] = "
"; + object obj18; + if (((DomainBase)val3.Controle.Cliente).Id != 0L) + { + ClienteEndereco? obj17 = val3.Controle.Cliente.Enderecos.OrderBy((ClienteEndereco x) => x.Ordem).FirstOrDefault(); + obj18 = ((obj17 != null) ? ((EnderecoBase)obj17).Cep.Trim() : null) ?? ""; + } + else + { + obj18 = ""; + } + obj7[7] = (string)obj18; + obj7[8] = "
"; + text = string.Concat(obj7); + text += "
"; + text += "
"; + text += "
"; + } + } + else + { + int num5 = 0; + int num6 = 0; + double num7 = 0.0; + if (DuasColunas) + { + num5 = 10; + num6 = 2; + num7 = 10.52; + } + else if (TresColunas) + { + num5 = 10; + num6 = 3; + num7 = 6.82; + } + Pular %= num5 * num6; + int pular2 = Pular; + text = "ETIQUETAS
"; + int num8 = 0; + while (num8 < list.Count) + { + text += "
"; + bool flag = num8 == 0 || num8 == num5 * num6; + text = text + ""; + for (int m = 0; m < num5 * num6; m += num6) + { + text += ""; + if (DuasColunas) + { + text += ""; + for (int n = 0; n < num6; n++) + { + text = text + ""; + if (n < num6 - 1) + { + if (DuasColunas) + { + text += ""; + } + } + text += "
"; + } + else if (TresColunas) + { + text += ""; + } + text += ""; + if (m + n >= Pular) + { + if (num8 < list.Count) + { + Documento val4 = list[num8]; + if (MostrarNascimento) + { + val4.Controle.Cliente.Nascimento = new ClienteServico().BuscarNascimento(((DomainBase)val4.Controle.Cliente).Id); + } + if (val4.Controle.Cliente.Enderecos.Count() > 0) + { + string[] obj19 = new string[8] + { + text, + val4.Controle.Cliente.Nome.Trim(), + " ", + (!val4.Controle.Cliente.Nascimento.HasValue || !MostrarNascimento) ? "" : val4.Controle.Cliente.Nascimento?.ToString("dd/MM"), + "
", + null, + null, + null + }; + object obj32; + if (((DomainBase)val4.Controle.Cliente).Id != 0L) + { + string[] array2 = new string[10]; + ClienteEndereco? obj20 = val4.Controle.Cliente.Enderecos.FirstOrDefault(); + array2[0] = ((obj20 == null) ? null : ((EnderecoBase)obj20).Endereco?.Trim()); + array2[1] = ", "; + ClienteEndereco? obj21 = val4.Controle.Cliente.Enderecos.FirstOrDefault(); + array2[2] = ((obj21 == null) ? null : ((EnderecoBase)obj21).Numero?.Trim()); + ClienteEndereco? obj22 = val4.Controle.Cliente.Enderecos.FirstOrDefault(); + object obj23; + if (string.IsNullOrWhiteSpace((obj22 != null) ? ((EnderecoBase)obj22).Complemento : null)) + { + obj23 = ""; + } + else + { + ClienteEndereco? obj24 = val4.Controle.Cliente.Enderecos.FirstOrDefault(); + obj23 = "
" + ((obj24 != null) ? ((EnderecoBase)obj24).Complemento.Trim() : null); + } + array2[3] = (string)obj23; + array2[4] = "
"; + ClienteEndereco? obj25 = val4.Controle.Cliente.Enderecos.FirstOrDefault(); + array2[5] = ((obj25 == null) ? null : ((EnderecoBase)obj25).Bairro?.Trim()); + array2[6] = " - "; + ClienteEndereco? obj26 = val4.Controle.Cliente.Enderecos.FirstOrDefault(); + object obj27; + if (string.IsNullOrEmpty((obj26 != null) ? ((EnderecoBase)obj26).Cidade : null)) + { + obj27 = ""; + } + else + { + ClienteEndereco? obj28 = val4.Controle.Cliente.Enderecos.FirstOrDefault(); + obj27 = ((obj28 != null) ? ((EnderecoBase)obj28).Cidade.Trim() : null); + } + array2[7] = (string)obj27; + array2[8] = "/"; + ClienteEndereco? obj29 = val4.Controle.Cliente.Enderecos.FirstOrDefault(); + object obj30; + if (string.IsNullOrEmpty((obj29 != null) ? ((EnderecoBase)obj29).Estado : null)) + { + obj30 = ""; + } + else + { + ClienteEndereco? obj31 = val4.Controle.Cliente.Enderecos.FirstOrDefault(); + obj30 = ((obj31 != null) ? ((EnderecoBase)obj31).Estado.Trim() : null); + } + array2[9] = (string)obj30; + obj32 = string.Concat(array2); + } + else + { + obj32 = ""; + } + obj19[5] = (string)obj32; + obj19[6] = "
"; + object obj34; + if (((DomainBase)val4.Controle.Cliente).Id != 0L) + { + ClienteEndereco? obj33 = val4.Controle.Cliente.Enderecos.FirstOrDefault(); + obj34 = ((obj33 != null) ? ((EnderecoBase)obj33).Cep.Trim() : null) ?? ""; + } + else + { + obj34 = ""; + } + obj19[7] = (string)obj34; + text = string.Concat(obj19); + } + num8++; + } + Pular = 0; + } + text += "
"; + } + else if (TresColunas) + { + text += ""; + } + } + text += "
"; + text += "
"; + } + Pular = (pular2 + list.Count) % (num5 * num6); + } + RegistrarAcao(string.Format("EMITIU ETIQUETA DE {0} CLIENTE{1}", list.Count, (list.Count == 1) ? "" : "S"), 0L, (TipoTela)59, "IDS E NOMES DOS CLIENTES:\n" + string.Join("\n", list.Select((Documento x) => ((DomainBase)x.Controle.Cliente).Id + ": \"" + x.Controle.Cliente.Nome + "\""))); + } + text += ""; + string tempPath = Path.GetTempPath(); + string text2 = $"{tempPath}{(object)(TipoExtrato)0}_{Funcoes.GetNetworkTime():ddMMyyyyhhmmss}.html"; + StreamWriter streamWriter = new StreamWriter(text2, append: true, Encoding.UTF8); + streamWriter.Write(text); + streamWriter.Close(); + Process.Start(text2); + } + + internal async Task> Filtrar(string value) + { + return await Task.Run(() => FiltrarApolice(value)); + } + + public List FiltrarApolice(string filter) + { + ApolicesFiltrados = (string.IsNullOrWhiteSpace(filter) ? new ObservableCollection(Apolices) : new ObservableCollection(from x in Apolices + where ValidationHelper.RemoveDiacritics(x.Controle.Cliente.Nome.Trim()).ToUpper().Contains(ValidationHelper.RemoveDiacritics(filter)) + orderby x.Controle.Cliente.Nome descending, ((DomainBase)x).Id + select x)); + return ApolicesFiltrados.ToList(); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Ferramentas/IncluirRamoViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Ferramentas/IncluirRamoViewModel.cs new file mode 100644 index 0000000..f9bc22b --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Ferramentas/IncluirRamoViewModel.cs @@ -0,0 +1,103 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using Gestor.Application.Helpers; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Ferramentas; + +public class IncluirRamoViewModel : BaseSegurosViewModel +{ + private Ramo _selectedRamo; + + private Ramo _adicionarRamo; + + private List _ramosAdicionadas; + + private ObservableCollection _ramos; + + private string _filtro; + + public Ramo SelectedRamo + { + get + { + return _selectedRamo; + } + set + { + _selectedRamo = value; + OnPropertyChanged("SelectedRamo"); + } + } + + public Ramo AdicionarRamo + { + get + { + return _adicionarRamo; + } + set + { + _adicionarRamo = value; + OnPropertyChanged("AdicionarRamo"); + } + } + + public List RamosAdicionadas + { + get + { + return _ramosAdicionadas; + } + set + { + _ramosAdicionadas = value; + OnPropertyChanged("RamosAdicionadas"); + } + } + + public ObservableCollection Ramos + { + get + { + return _ramos; + } + set + { + _ramos = value; + OnPropertyChanged("Ramos"); + } + } + + public string Filtro + { + get + { + return _filtro; + } + set + { + _filtro = value; + OnPropertyChanged("Filtro"); + } + } + + public IncluirRamoViewModel(List ramos) + { + RamosAdicionadas = ramos; + } + + public async void Pesquisar() + { + if (string.IsNullOrWhiteSpace(Filtro) || Filtro.Length < 3) + { + return; + } + string text = Uri.EscapeDataString(Filtro); + Ramos = new ObservableCollection((await Connection.Get>("Ramos/search?ramo=" + text)).Where((Ramo x) => RamosAdicionadas.All((Ramo y) => ((DomainBase)y).Id != ((DomainBase)x).Id))); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Ferramentas/IncluirSeguradoraViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Ferramentas/IncluirSeguradoraViewModel.cs new file mode 100644 index 0000000..992960f --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Ferramentas/IncluirSeguradoraViewModel.cs @@ -0,0 +1,103 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using Gestor.Application.Helpers; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Ferramentas; + +public class IncluirSeguradoraViewModel : BaseSegurosViewModel +{ + private Seguradora _selectedSeguradora; + + private Seguradora _adicionarSeguradora; + + private List _seguradorasAdicionadas; + + private ObservableCollection _seguradoras; + + private string _filtro; + + public Seguradora SelectedSeguradora + { + get + { + return _selectedSeguradora; + } + set + { + _selectedSeguradora = value; + OnPropertyChanged("SelectedSeguradora"); + } + } + + public Seguradora AdicionarSeguradora + { + get + { + return _adicionarSeguradora; + } + set + { + _adicionarSeguradora = value; + OnPropertyChanged("AdicionarSeguradora"); + } + } + + public List SeguradorasAdicionadas + { + get + { + return _seguradorasAdicionadas; + } + set + { + _seguradorasAdicionadas = value; + OnPropertyChanged("SeguradorasAdicionadas"); + } + } + + public ObservableCollection Seguradoras + { + get + { + return _seguradoras; + } + set + { + _seguradoras = value; + OnPropertyChanged("Seguradoras"); + } + } + + public string Filtro + { + get + { + return _filtro; + } + set + { + _filtro = value; + OnPropertyChanged("Filtro"); + } + } + + public IncluirSeguradoraViewModel(List seguradoras) + { + SeguradorasAdicionadas = seguradoras; + } + + public async void Pesquisar() + { + if (string.IsNullOrWhiteSpace(Filtro) || Filtro.Length < 3) + { + return; + } + string text = Uri.EscapeDataString(Filtro); + Seguradoras = new ObservableCollection((await Connection.Get>("Seguradoras/search?cia=" + text)).Where((Seguradora x) => SeguradorasAdicionadas.All((Seguradora y) => ((DomainBase)y).Id != ((DomainBase)x).Id))); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Ferramentas/MalaDiretaViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Ferramentas/MalaDiretaViewModel.cs new file mode 100644 index 0000000..7a47ab6 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Ferramentas/MalaDiretaViewModel.cs @@ -0,0 +1,660 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.MalaDireta; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Ferramentas; + +public class MalaDiretaViewModel : BaseSegurosViewModel +{ + private readonly MalaDiretaServico _servico; + + private readonly FiltroArquivoDigital _filtro; + + private ObservableCollection _malaDireta = new ObservableCollection(); + + private ObservableCollection _variaveis = new ObservableCollection(); + + private bool _enableCredencial; + + private ObservableCollection _modelos = new ObservableCollection(); + + private ComboModelo _selectedModelo = new ComboModelo(); + + private ComboVariavel _selectedVariavel; + + private string _assunto; + + private string _corpo; + + private ObservableCollection _credenciais = new ObservableCollection(); + + private Credencial _selectedCredencial = new Credencial(); + + private ObservableCollection _arquivos = new ObservableCollection(); + + private ObservableCollection _arquivosAnexados = new ObservableCollection(); + + private ArquivoDigital _selectedAnexado = new ArquivoDigital(); + + private Visibility _visibilitySalvarAnexos = (Visibility)1; + + private bool _enviarOriginal; + + private bool _salvarArquivoDigital; + + private bool _assinatura; + + public bool _confirmarLeitura; + + public ObservableCollection MalaDireta + { + get + { + return _malaDireta; + } + set + { + _malaDireta = value; + OnPropertyChanged("MalaDireta"); + } + } + + public ObservableCollection Variaveis + { + get + { + return _variaveis; + } + set + { + _variaveis = new ObservableCollection(value.OrderBy((ComboVariavel x) => x.Indisponivel).ThenBy(delegate(ComboVariavel x) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + VariaveisMalaDireta variaveisMalaDireta = x.VariaveisMalaDireta; + return ((object)(VariaveisMalaDireta)(ref variaveisMalaDireta)).ToString(); + })); + OnPropertyChanged("Variaveis"); + } + } + + public bool EnableCredencial + { + get + { + return _enableCredencial; + } + set + { + _enableCredencial = value; + OnPropertyChanged("EnableCredencial"); + } + } + + public ObservableCollection Modelos + { + get + { + return _modelos; + } + set + { + List source = ((VariaveisMalaDireta[])Enum.GetValues(typeof(VariaveisMalaDireta))).Select((VariaveisMalaDireta variavel) => ValidationHelper.GetEntity((Enum)(object)variavel)).ToList(); + List variaveisPermitidas = (from x in Variaveis + where !x.Indisponivel + select x into v + select ValidationHelper.GetEntity((Enum)(object)v.VariaveisMalaDireta)).ToList(); + List list = new List(); + foreach (ComboModelo item2 in value) + { + if (source.Where(item2.ModeloMalaDireta.Corpo.Contains).All((string s) => variaveisPermitidas.Contains(s))) + { + list.Add(item2); + continue; + } + ComboModelo item = new ComboModelo + { + ModeloMalaDireta = item2.ModeloMalaDireta, + Indisponivel = true + }; + list.Add(item); + } + _modelos = new ObservableCollection(from x in list + orderby x.Indisponivel, x.ModeloMalaDireta.Assunto + select x); + OnPropertyChanged("Modelos"); + } + } + + public ComboModelo SelectedModelo + { + get + { + return _selectedModelo; + } + set + { + _selectedModelo = value; + VerificarEnables((value != null) ? new long?(((DomainBase)value.ModeloMalaDireta).Id) : null); + WorkOnSelectedModelo(value?.ModeloMalaDireta); + OnPropertyChanged("SelectedModelo"); + } + } + + public ComboVariavel SelectedVariavel + { + get + { + return _selectedVariavel; + } + set + { + _selectedVariavel = value; + OnPropertyChanged("SelectedVariavel"); + } + } + + public string Assunto + { + get + { + return _assunto; + } + set + { + _assunto = value; + OnPropertyChanged("Assunto"); + } + } + + public string Corpo + { + get + { + return _corpo; + } + set + { + _corpo = value; + OnPropertyChanged("Corpo"); + } + } + + public ObservableCollection Credenciais + { + get + { + return _credenciais; + } + set + { + _credenciais = value; + OnPropertyChanged("Credenciais"); + } + } + + public Credencial SelectedCredencial + { + get + { + return _selectedCredencial; + } + set + { + _selectedCredencial = value; + OnPropertyChanged("SelectedCredencial"); + } + } + + public ObservableCollection Arquivos + { + get + { + return _arquivos; + } + set + { + _arquivos = value; + OnPropertyChanged("Arquivos"); + } + } + + public ObservableCollection ArquivosAnexados + { + get + { + return _arquivosAnexados; + } + set + { + _arquivosAnexados = value; + OnPropertyChanged("ArquivosAnexados"); + } + } + + public ArquivoDigital SelectedAnexado + { + get + { + return _selectedAnexado; + } + set + { + _selectedAnexado = value; + OnPropertyChanged("SelectedAnexado"); + } + } + + public Visibility VisibilitySalvarAnexos + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilitySalvarAnexos; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilitySalvarAnexos = value; + OnPropertyChanged("VisibilitySalvarAnexos"); + } + } + + public bool EnviarOriginal + { + get + { + return _enviarOriginal; + } + set + { + _enviarOriginal = value; + OnPropertyChanged("EnviarOriginal"); + } + } + + public bool SalvarArquivoDigital + { + get + { + return _salvarArquivoDigital; + } + set + { + _salvarArquivoDigital = value; + OnPropertyChanged("SalvarArquivoDigital"); + } + } + + public bool Assinatura + { + get + { + return _assinatura; + } + set + { + _assinatura = value; + OnPropertyChanged("Assinatura"); + } + } + + public bool ConfirmarLeitura + { + get + { + return _confirmarLeitura; + } + set + { + _confirmarLeitura = value; + } + } + + public bool Enviado { get; set; } + + public MalaDiretaViewModel(FiltroArquivoDigital filtro = null) + { + //IL_0038: Unknown result type (might be due to invalid IL or missing references) + //IL_0042: Expected O, but got Unknown + //IL_0059: Unknown result type (might be due to invalid IL or missing references) + //IL_0063: Expected O, but got Unknown + //IL_0065: Unknown result type (might be due to invalid IL or missing references) + _servico = new MalaDiretaServico(); + _filtro = filtro; + BuscarCredenciais(); + } + + private async void BuscarCredenciais() + { + await PermissaoTela((TipoTela)39); + VerificarEnables(null); + Credenciais = new ObservableCollection((await new BaseServico().BuscarCredenciais()).OrderBy((Credencial x) => x.Descricao)); + EnableCredencial = !Restricao((TipoRestricao)110); + SelectedCredencial = (EnableCredencial ? (((IEnumerable)Credenciais).FirstOrDefault((Func)((Credencial x) => x.IdUsuario == ((DomainBase)Recursos.Usuario).Id)) ?? Credenciais.FirstOrDefault()) : ((IEnumerable)Credenciais).FirstOrDefault((Func)((Credencial x) => x.IdUsuario == ((DomainBase)Recursos.Usuario).Id))); + } + + private async Task CarregarModelos(ModeloMalaDireta modelo = null) + { + List obj = await _servico.BuscarModelos(); + List list = new List(); + foreach (ModeloMalaDireta item in obj) + { + list.Add(new ComboModelo + { + ModeloMalaDireta = item + }); + } + Modelos = new ObservableCollection(list); + if (modelo != null) + { + SelectedModelo = Modelos.FirstOrDefault((ComboModelo x) => ((DomainBase)x.ModeloMalaDireta).Id == ((DomainBase)modelo).Id); + } + } + + private void WorkOnSelectedModelo(ModeloMalaDireta value) + { + if (value != null) + { + Corpo = SelectedModelo.ModeloMalaDireta.Corpo; + Assunto = SelectedModelo.ModeloMalaDireta.Assunto; + } + } + + public async void Anexar() + { + List attacheds = ((IEnumerable)Arquivos).Select((Func)((IndiceArquivoDigital x) => new ArquivoDigital + { + Descricao = x.Descricao, + Extensao = x.Extensao + })).ToList(); + List list = await AddAttachments(ArquivosAnexados.ToList(), attacheds); + if (list != null) + { + list.AddRange(ArquivosAnexados); + ArquivosAnexados = new ObservableCollection(list); + } + } + + public async Task Enviar() + { + if (string.IsNullOrWhiteSpace(Corpo) || string.IsNullOrWhiteSpace(Assunto)) + { + await ShowMessage("NECESSÁRIO CONTER ASSUNTO E MENSAGEM PARA PROSSEGUIR."); + return false; + } + if (SelectedCredencial == null || ((DomainBase)SelectedCredencial).Id == 0L) + { + await ShowMessage("NECESSÁRIO SELECIONAR O E-MAIL DE ENVIO PARA PROSSEGUIR."); + return false; + } + List list = MalaDireta.Where((MalaDireta x) => x.Selecionado).ToList(); + if (list.Count == 0) + { + await ShowMessage("NECESSÁRIO SELECIONAR AO MENOS UM DESTINATÁRIO PARA PROSSEGUIR."); + return false; + } + await ShowEnviarEmailsDialog(list, Assinatura, EnviarOriginal, ArquivosAnexados.ToList(), Assunto, Corpo, SelectedCredencial, _filtro, SalvarArquivoDigital, ConfirmarLeitura); + Enviado = true; + return true; + } + + public async Task CarregarEmails(List maladireta, string assunto = null, string corpo = null) + { + ClienteServico clienteServico = new ClienteServico(); + List list = (from x in maladireta + where x.Cliente != null + select ((DomainBase)x.Cliente).Id).ToList(); + VisibilitySalvarAnexos = (Visibility)(list.Count > 1); + List emails = await clienteServico.BuscarEmailsPorCliente(list); + List maladiretacompleta = new List(); + maladireta.ForEach(delegate(MalaDireta x) + { + //IL_0105: Unknown result type (might be due to invalid IL or missing references) + //IL_010b: Expected O, but got Unknown + //IL_0120: Unknown result type (might be due to invalid IL or missing references) + //IL_0125: Unknown result type (might be due to invalid IL or missing references) + //IL_013b: Unknown result type (might be due to invalid IL or missing references) + if (x.Cliente != null) + { + Assinatura = Assinatura || (x.ArquivoDigital != null && x.ArquivoDigital.Any((IndiceArquivoDigital a) => !string.IsNullOrEmpty(a.UrlAssinatura) && !a.Assinado)); + List source = emails.Where((ClienteEmail e) => ((DomainBase)e.Cliente).Id == ((DomainBase)x.Cliente).Id).ToList(); + int index = 0; + source.OrderBy((ClienteEmail o) => o.Ordem.GetValueOrDefault()).ToList().ForEach(delegate(ClienteEmail e) + { + //IL_00c7: Unknown result type (might be due to invalid IL or missing references) + //IL_00cd: Expected O, but got Unknown + //IL_0051: Unknown result type (might be due to invalid IL or missing references) + //IL_0057: Expected O, but got Unknown + x.Selecionado = string.IsNullOrWhiteSpace(x.Email) && x.Cliente.MalaDireta.GetValueOrDefault(true); + if (index > 0) + { + MalaDireta val2 = new MalaDireta(); + DomainBase.Copy(val2, x); + val2.Email = ((EmailBase)e).Email; + val2.Selecionado = false; + maladiretacompleta.Add(val2); + } + else + { + x.Email = ((EmailBase)e).Email; + x.Ordem = e.Ordem.GetValueOrDefault(); + MalaDireta val3 = new MalaDireta(); + DomainBase.Copy(val3, x); + maladiretacompleta.Add(val3); + } + index++; + }); + } + if (x.Prospeccao != null) + { + MalaDireta val = new MalaDireta(); + x.Cliente = (Cliente)(((object)x.Cliente) ?? ((object)new Cliente + { + Nome = x.Prospeccao.Nome, + Documento = x.Prospeccao.Documento + })); + if (string.IsNullOrEmpty(x.Cliente.Documento)) + { + x.Cliente.Documento = x.Prospeccao.Documento; + } + x.Email = x.Prospeccao.Email; + x.Ordem = 0; + x.Selecionado = true; + DomainBase.Copy(val, x); + maladiretacompleta.Add(val); + } + }); + MalaDireta = new ObservableCollection(from x in maladiretacompleta + orderby x.Cliente.Nome, x.Ordem + select x); + Variaveis.Add(new ComboVariavel((VariaveisMalaDireta)18, indisponivel: false)); + Variaveis.Add(new ComboVariavel((VariaveisMalaDireta)0, indisponivel: false)); + Variaveis.Add(new ComboVariavel((VariaveisMalaDireta)1, indisponivel: false)); + Variaveis.Add(new ComboVariavel((VariaveisMalaDireta)2, indisponivel: false)); + Variaveis.Add(MalaDireta.Any((MalaDireta x) => x.Cliente.VencimentoHabilitacao.HasValue) ? new ComboVariavel((VariaveisMalaDireta)16, indisponivel: false) : new ComboVariavel((VariaveisMalaDireta)16, indisponivel: true)); + if (MalaDireta.Any((MalaDireta x) => x.Cliente.Nascimento.HasValue)) + { + Variaveis.Add(new ComboVariavel((VariaveisMalaDireta)14, indisponivel: false)); + Variaveis.Add(new ComboVariavel((VariaveisMalaDireta)15, indisponivel: false)); + } + else + { + Variaveis.Add(new ComboVariavel((VariaveisMalaDireta)14, indisponivel: true)); + Variaveis.Add(new ComboVariavel((VariaveisMalaDireta)15, indisponivel: true)); + } + Variaveis.Add(MalaDireta.Any((MalaDireta x) => x.ArquivoDigital != null && x.ArquivoDigital.Any((IndiceArquivoDigital z) => !string.IsNullOrWhiteSpace(z.UrlAssinatura))) ? new ComboVariavel((VariaveisMalaDireta)17, indisponivel: false) : new ComboVariavel((VariaveisMalaDireta)17, indisponivel: true)); + if (MalaDireta.All((MalaDireta x) => x.Apolice != null)) + { + Variaveis.Add(new ComboVariavel((VariaveisMalaDireta)3, indisponivel: false)); + Variaveis.Add(new ComboVariavel((VariaveisMalaDireta)4, indisponivel: false)); + Variaveis.Add(new ComboVariavel((VariaveisMalaDireta)7, indisponivel: false)); + Variaveis.Add(MalaDireta.Any((MalaDireta x) => x.Apolice.Vigencia2.HasValue) ? new ComboVariavel((VariaveisMalaDireta)8, indisponivel: false) : new ComboVariavel((VariaveisMalaDireta)8, indisponivel: true)); + Variaveis.Add(new ComboVariavel((VariaveisMalaDireta)19, indisponivel: false)); + Variaveis.Add(new ComboVariavel((VariaveisMalaDireta)23, indisponivel: false)); + Variaveis.Add(new ComboVariavel((VariaveisMalaDireta)24, indisponivel: false)); + if (MalaDireta.Any((MalaDireta x) => x.Apolice.Controle != null)) + { + Variaveis.Add(new ComboVariavel((VariaveisMalaDireta)5, indisponivel: false)); + Variaveis.Add(new ComboVariavel((VariaveisMalaDireta)6, indisponivel: false)); + } + else + { + Variaveis.Add(new ComboVariavel((VariaveisMalaDireta)5, indisponivel: true)); + Variaveis.Add(new ComboVariavel((VariaveisMalaDireta)6, indisponivel: true)); + } + } + else + { + Variaveis.Add(new ComboVariavel((VariaveisMalaDireta)19, indisponivel: true)); + Variaveis.Add(new ComboVariavel((VariaveisMalaDireta)3, indisponivel: true)); + Variaveis.Add(new ComboVariavel((VariaveisMalaDireta)4, indisponivel: true)); + Variaveis.Add(new ComboVariavel((VariaveisMalaDireta)7, indisponivel: true)); + Variaveis.Add(new ComboVariavel((VariaveisMalaDireta)8, indisponivel: true)); + Variaveis.Add(new ComboVariavel((VariaveisMalaDireta)5, indisponivel: true)); + Variaveis.Add(new ComboVariavel((VariaveisMalaDireta)6, indisponivel: true)); + } + if (MalaDireta.All((MalaDireta x) => x.Parcela != null)) + { + Variaveis.Add(new ComboVariavel((VariaveisMalaDireta)9, indisponivel: false)); + Variaveis.Add(new ComboVariavel((VariaveisMalaDireta)10, indisponivel: false)); + Variaveis.Add(new ComboVariavel((VariaveisMalaDireta)13, indisponivel: false)); + } + else + { + Variaveis.Add(new ComboVariavel((VariaveisMalaDireta)9, indisponivel: true)); + Variaveis.Add(new ComboVariavel((VariaveisMalaDireta)10, indisponivel: true)); + Variaveis.Add(new ComboVariavel((VariaveisMalaDireta)13, indisponivel: true)); + } + Variaveis.Add(MalaDireta.All((MalaDireta x) => x.Item != null) ? new ComboVariavel((VariaveisMalaDireta)11, indisponivel: false) : new ComboVariavel((VariaveisMalaDireta)11, indisponivel: true)); + Variaveis.Add(MalaDireta.All((MalaDireta x) => x.Sinistro != null) ? new ComboVariavel((VariaveisMalaDireta)12, indisponivel: false) : new ComboVariavel((VariaveisMalaDireta)12, indisponivel: true)); + Variaveis = new ObservableCollection(Variaveis); + Variaveis.Add(MalaDireta.Any(delegate(MalaDireta x) + { + Documento apolice3 = x.Apolice; + if (apolice3 == null) + { + return false; + } + _ = apolice3.PremioLiquido; + return true; + }) ? new ComboVariavel((VariaveisMalaDireta)20, indisponivel: false) : new ComboVariavel((VariaveisMalaDireta)20, indisponivel: true)); + Variaveis.Add(MalaDireta.Any(delegate(MalaDireta x) + { + Documento apolice2 = x.Apolice; + if (apolice2 == null) + { + return false; + } + _ = apolice2.PremioTotal; + return true; + }) ? new ComboVariavel((VariaveisMalaDireta)21, indisponivel: false) : new ComboVariavel((VariaveisMalaDireta)21, indisponivel: true)); + Variaveis.Add(MalaDireta.Any(delegate(MalaDireta x) + { + Documento apolice = x.Apolice; + return apolice != null && apolice.FormaPagamento.HasValue; + }) ? new ComboVariavel((VariaveisMalaDireta)22, indisponivel: false) : new ComboVariavel((VariaveisMalaDireta)22, indisponivel: true)); + await CarregarModelos(); + if (assunto != null) + { + Assunto = assunto; + } + if (corpo != null) + { + Corpo = corpo; + } + } + + public void Selecionar() + { + MalaDireta.ToList().ForEach(delegate(MalaDireta x) + { + x.Selecionado = !x.Selecionado; + }); + MalaDireta = new ObservableCollection(MalaDireta); + } + + public void Delete(ArquivoDigital arquivo) + { + if (SelectedAnexado != null) + { + ArquivoDigital item = ArquivosAnexados.First((ArquivoDigital x) => x.Descricao == arquivo.Descricao); + ArquivosAnexados.Remove(item); + ArquivosAnexados = new ObservableCollection(ArquivosAnexados); + } + } + + public void Incluir() + { + SelectedModelo = new ComboModelo(); + Corpo = string.Empty; + Alterar(alterar: true); + } + + public void CancelarAlteracao() + { + Alterar(alterar: false); + SelectedModelo = null; + } + + public async Task>> Salvar() + { + if (SelectedModelo == null) + { + SelectedModelo = new ComboModelo + { + ModeloMalaDireta = new ModeloMalaDireta + { + Assunto = Assunto, + Corpo = Corpo + } + }; + } + else + { + SelectedModelo.ModeloMalaDireta.Assunto = Assunto; + SelectedModelo.ModeloMalaDireta.Corpo = Corpo; + } + List> list = SelectedModelo.ModeloMalaDireta.Validate(); + if (list.Count > 0) + { + return list; + } + ModeloMalaDireta modelo = await _servico.Save(SelectedModelo.ModeloMalaDireta); + if (!_servico.Sucesso) + { + return null; + } + Alterar(alterar: false); + await CarregarModelos(modelo); + ToggleSnackBar("MODELO SALVO COM SUCESSO"); + return null; + } + + public async void Excluir() + { + if (SelectedModelo != null && ((DomainBase)SelectedModelo.ModeloMalaDireta).Id != 0L && await ShowMessage("DESEJA REALMENTE EXCLUIR O MODELO?", "SIM", "NÃO") && await _servico.Delete(SelectedModelo.ModeloMalaDireta)) + { + RegistrarAcao("EXCLUIU MODELO " + SelectedModelo.ModeloMalaDireta.Assunto, ((DomainBase)SelectedModelo.ModeloMalaDireta).Id, (TipoTela)39); + await CarregarModelos(); + SelectedModelo = null; + ToggleSnackBar("MODELO EXCLUÍDO COM SUCESSO"); + } + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Ferramentas/ManutencaoPagamentosViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Ferramentas/ManutencaoPagamentosViewModel.cs new file mode 100644 index 0000000..93bc1d6 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Ferramentas/ManutencaoPagamentosViewModel.cs @@ -0,0 +1,756 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Data; +using CsQuery.ExtensionMethods; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.Servicos.Ferramentas; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Common; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Relatorios; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Ferramentas; + +public class ManutencaoPagamentosViewModel : BaseSegurosViewModel +{ + private Visibility _filtrosPersonalizados = (Visibility)2; + + private Visibility _visibilityFiltroPersonalizado = (Visibility)2; + + private List _filtroRelatorioPersonalizado; + + private FiltroPersonalizado _filtroPersonalizado; + + private Type _tipoString = typeof(string); + + private Type _tipoEnum = typeof(Enum); + + private Type _tipoDateTime = typeof(DateTime); + + private Type _tipoDecimal = typeof(decimal); + + private Type _tipoInt = typeof(int); + + private Type _tipoLong = typeof(long); + + private string _valorIncial = ""; + + private string _valorFinal = ""; + + private bool _semValor; + + private Visibility _visibilitySemValor = (Visibility)2; + + private ObservableCollection _filtroPersonalizadoSelecionado; + + private ObservableCollection _filtroRelatorioSelecionado = new ObservableCollection(); + + private ObservableCollection _vendedores = new ObservableCollection(); + + private Vendedor _selectedVendedor; + + private bool _enableExcluirManutPagamento; + + private ObservableCollection _pagamentos; + + private ListCollectionView _view; + + private bool _allSelected; + + private string _selectedFiltro; + + private ObservableCollection _filtros; + + private DateTime? _inicio; + + private DateTime? _fim; + + private List _todosPagamentos; + + public Visibility FiltrosPersonalizados + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _filtrosPersonalizados; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _filtrosPersonalizados = value; + OnPropertyChanged("FiltrosPersonalizados"); + } + } + + public Visibility VisibilityFiltroPersonalizado + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityFiltroPersonalizado; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityFiltroPersonalizado = value; + OnPropertyChanged("VisibilityFiltroPersonalizado"); + } + } + + public List RelatorioFiltroPersonalizado + { + get + { + return _filtroRelatorioPersonalizado; + } + set + { + _filtroRelatorioPersonalizado = value; + OnPropertyChanged("RelatorioFiltroPersonalizado"); + } + } + + public FiltroPersonalizado FiltroPersonalizado + { + get + { + return _filtroPersonalizado; + } + set + { + _filtroPersonalizado = value; + VisibilitySemValor = (Visibility)((value == null) ? 2 : 0); + OnPropertyChanged("FiltroPersonalizado"); + if (value == null) + { + return; + } + string name = value.Tipo.Name; + if (name == null) + { + return; + } + switch (name.Length) + { + default: + return; + case 4: + { + char c = name[0]; + if (c != 'E') + { + if (c != 'l' || !(name == "long")) + { + return; + } + break; + } + if (!(name == "Enum")) + { + return; + } + goto IL_0121; + } + case 5: + switch (name[3]) + { + default: + return; + case '3': + if (!(name == "int32")) + { + return; + } + break; + case '6': + if (!(name == "int64")) + { + return; + } + break; + } + break; + case 6: + if (name == "String") + { + ValorInicial = ""; + ValorFinal = ""; + } + return; + case 7: + if (name == "Decimal") + { + ValorInicial = "0,00"; + ValorFinal = "0,00"; + } + return; + case 8: + if (!(name == "DateTime")) + { + return; + } + goto IL_0121; + case 3: + { + if (!(name == "int")) + { + return; + } + break; + } + IL_0121: + ValorInicial = null; + ValorFinal = null; + return; + } + ValorInicial = "0"; + ValorFinal = "0"; + } + } + + public Type TipoString + { + get + { + return _tipoString; + } + set + { + _tipoString = value; + OnPropertyChanged("TipoString"); + } + } + + public Type TipoEnum + { + get + { + return _tipoEnum; + } + set + { + _tipoEnum = value; + OnPropertyChanged("TipoEnum"); + } + } + + public Type TipoDateTime + { + get + { + return _tipoDateTime; + } + set + { + _tipoDateTime = value; + OnPropertyChanged("TipoDateTime"); + } + } + + public Type TipoDecimal + { + get + { + return _tipoDecimal; + } + set + { + _tipoDecimal = value; + OnPropertyChanged("TipoDecimal"); + } + } + + public Type TipoInt + { + get + { + return _tipoInt; + } + set + { + _tipoInt = value; + OnPropertyChanged("TipoInt"); + } + } + + public Type TipoLong + { + get + { + return _tipoLong; + } + set + { + _tipoLong = value; + OnPropertyChanged("TipoLong"); + } + } + + public string ValorInicial + { + get + { + return _valorIncial; + } + set + { + _valorIncial = value; + OnPropertyChanged("ValorInicial"); + } + } + + public string ValorFinal + { + get + { + return _valorFinal; + } + set + { + _valorFinal = value; + OnPropertyChanged("ValorFinal"); + } + } + + public bool SemValor + { + get + { + return _semValor; + } + set + { + _semValor = value; + if (value) + { + ValorInicial = null; + ValorFinal = null; + } + OnPropertyChanged("SemValor"); + } + } + + public Visibility VisibilitySemValor + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilitySemValor; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilitySemValor = value; + OnPropertyChanged("VisibilitySemValor"); + } + } + + public ObservableCollection FiltroPersonalizadoSelecionado + { + get + { + return _filtroPersonalizadoSelecionado; + } + set + { + _filtroPersonalizadoSelecionado = value; + OnPropertyChanged("FiltroPersonalizadoSelecionado"); + } + } + + public ObservableCollection FiltroRelatorioSelecionado + { + get + { + return _filtroRelatorioSelecionado; + } + set + { + _filtroRelatorioSelecionado = value; + OnPropertyChanged("FiltroRelatorioSelecionado"); + } + } + + public ObservableCollection Vendedores + { + get + { + return _vendedores; + } + set + { + _vendedores = value; + SelectedVendedor = SelectedVendedor ?? value.FirstOrDefault(); + OnPropertyChanged("Vendedores"); + } + } + + public Vendedor SelectedVendedor + { + get + { + return _selectedVendedor; + } + set + { + _selectedVendedor = value; + OnPropertyChanged("SelectedVendedor"); + } + } + + public bool EnableExcluirManutPagamento + { + get + { + return _enableExcluirManutPagamento; + } + set + { + _enableExcluirManutPagamento = value; + OnPropertyChanged("EnableExcluirManutPagamento"); + } + } + + public ObservableCollection Pagamentos + { + get + { + return _pagamentos; + } + set + { + //IL_0009: Unknown result type (might be due to invalid IL or missing references) + //IL_0013: Expected O, but got Unknown + //IL_0023: Unknown result type (might be due to invalid IL or missing references) + //IL_002d: Expected O, but got Unknown + //IL_003d: Unknown result type (might be due to invalid IL or missing references) + //IL_0047: Expected O, but got Unknown + _pagamentos = value; + View = new ListCollectionView((IList)value); + ((CollectionView)View).GroupDescriptions.Add((GroupDescription)new PropertyGroupDescription("Pagamento")); + ((CollectionView)View).GroupDescriptions.Add((GroupDescription)new PropertyGroupDescription("Vendedor")); + OnPropertyChanged("Pagamentos"); + } + } + + public ListCollectionView View + { + get + { + return _view; + } + set + { + _view = value; + OnPropertyChanged("View"); + } + } + + public bool AllSelected + { + get + { + return _allSelected; + } + set + { + _allSelected = value; + OnPropertyChanged("AllSelected"); + Selecionar(value); + } + } + + public string SelectedFiltro + { + get + { + return _selectedFiltro; + } + set + { + _selectedFiltro = value; + OnPropertyChanged("SelectedFiltro"); + } + } + + public ObservableCollection Filtros + { + get + { + return _filtros; + } + set + { + _filtros = value; + OnPropertyChanged("Filtros"); + } + } + + public DateTime? Inicio + { + get + { + return _inicio; + } + set + { + if (value.HasValue && value.Value < new DateTime(1754, 1, 1)) + { + value = new DateTime(1754, 1, 1); + } + if (value.HasValue && value.Value > new DateTime(9999, 12, 31)) + { + value = new DateTime(9999, 12, 31); + } + _inicio = value; + OnPropertyChanged("Inicio"); + } + } + + public DateTime? Fim + { + get + { + return _fim; + } + set + { + if (value.HasValue && value.Value < new DateTime(1754, 1, 1)) + { + value = new DateTime(1754, 1, 1); + } + if (value.HasValue && value.Value > new DateTime(9999, 12, 31)) + { + value = new DateTime(9999, 12, 31); + } + _fim = value; + OnPropertyChanged("Fim"); + } + } + + private List TodosPagamentos + { + get + { + return _todosPagamentos; + } + set + { + FiltrosPersonalizados = (Visibility)((value == null || !value.Any()) ? 2 : 0); + _todosPagamentos = value; + } + } + + public ManutencaoPagamentosViewModel() + { + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + //IL_0009: Unknown result type (might be due to invalid IL or missing references) + //IL_0086: Unknown result type (might be due to invalid IL or missing references) + //IL_017a: Unknown result type (might be due to invalid IL or missing references) + //IL_017f: Unknown result type (might be due to invalid IL or missing references) + //IL_0187: Unknown result type (might be due to invalid IL or missing references) + //IL_0197: Expected O, but got Unknown + Usuario usuario = Recursos.Usuario; + _enableExcluirManutPagamento = usuario != null && ((DomainBase)usuario).Id > 0; + _inicio = Funcoes.GetNetworkTime(); + _fim = Funcoes.GetNetworkTime().AddDays(7.0); + base._002Ector(); + Filtros = new ObservableCollection { "DATA DE EMISSÃO DO RECEBIMENTO", "DATA DE EMISSÃO DO RECIBO DE PAGAMENTO" }; + SelectedFiltro = Filtros.First(); + List list = (from x in Recursos.Vendedores + where x.Ativo + orderby x.Nome + select x).ToList(); + list.Insert(0, new Vendedor + { + Id = 0L, + Nome = "TODAS OS VENDEDORES" + }); + Vendedores = new ObservableCollection(list); + RelatorioFiltroPersonalizado = Funcoes.PopularFiltroPersonalizado(); + } + + public void Selecionar(bool value) + { + if (Pagamentos != null && Pagamentos.Count != 0) + { + ExtensionMethods.ForEach((IEnumerable)Pagamentos, (Action)delegate(ManutencaoPagamentos x) + { + x.Selecionado = value; + }); + } + } + + public async Task Buscar() + { + if (Inicio.HasValue && Fim.HasValue) + { + FiltroPersonalizadoSelecionado = null; + VisibilityFiltroPersonalizado = (Visibility)0; + Filtros val = new Filtros + { + Inicio = Inicio.Value, + Fim = Fim.Value + }; + if (((DomainBase)SelectedVendedor).Id > 0) + { + val.Vendedores = new List { ((DomainBase)SelectedVendedor).Id }; + } + if (!(SelectedFiltro == "DATA DE EMISSÃO DO RECEBIMENTO")) + { + val.Referencia = "DATA PAGAMENTO"; + } + else + { + val.Referencia = "DATA PREVISÃO"; + } + TodosPagamentos = await new VendedorServico().BuscarPagos(val); + Pagamentos = new ObservableCollection(TodosPagamentos); + RegistrarAcao("CONSULTOU OS PAGAMENTOS DE \"" + Inicio.Value.ToShortDateString() + "\" A \"" + Fim.Value.ToShortDateString() + "\" POR " + SelectedFiltro, 0L, (TipoTela)58); + } + } + + public async Task Excluir() + { + List selecionados = Pagamentos.Where((ManutencaoPagamentos x) => x.Selecionado).ToList(); + if (selecionados.Count == 0) + { + return; + } + string log = "PAGAMENTOS EXCLUÍDOS:"; + foreach (ManutencaoPagamentos item in selecionados) + { + log += $"\nID: {item.Id}, NÚMERO: {item.Parcela}, ID DOCUMENTO: {item.IdDocumento}"; + VendedorParcela val = await new VendedorServico().BuscarVendedorParcelaCompleto(item.Id); + val.DataPagamento = null; + await new ParcelaServico().Save(val); + } + RegistrarAcao(string.Format("EXCLUIU {0} PAGAMENTO{1}", selecionados.Count, (selecionados.Count > 1) ? "S" : ""), 0L, (TipoTela)58, log); + for (int num = Pagamentos.Count - 1; num >= 0; num--) + { + if (Pagamentos[num].Selecionado) + { + Pagamentos.RemoveAt(num); + } + } + ToggleSnackBar("PAGAMENTOS EXCLUÍDOS COM SUCESSO."); + } + + public async void AdcionarFiltroPersonalizado() + { + if (FiltroPersonalizado == null) + { + return; + } + string descricao; + if (!SemValor) + { + List list = ((FiltroPersonalizadoSelecionado == null) ? new List() : FiltroPersonalizadoSelecionado.Where((FiltroPersonalizado x) => x.Propriedade == FiltroPersonalizado.Propriedade && x.SemValor).ToList()); + if (list.Count > 0) + { + list.ForEach(delegate(FiltroPersonalizado x) + { + FiltroPersonalizadoSelecionado.Remove(x); + }); + } + switch (FiltroPersonalizado.Tipo.Name) + { + default: + if (string.IsNullOrEmpty(ValorInicial)) + { + await ShowMessage("O VALOR DEVE SER PREENCHIDO CORRETAMENTE."); + return; + } + descricao = FiltroPersonalizado.Nome + " = " + ValorInicial; + break; + case "DateTime": + { + if (!DateTime.TryParse(ValorInicial, out var result3) || !DateTime.TryParse(ValorFinal, out result3) || DateTime.Parse(ValorInicial) > DateTime.Parse(ValorFinal)) + { + await ShowMessage("O VALOR DE INTERVALO DEVE SER PREENCHIDO CORRETAMENTE."); + return; + } + descricao = $"{FiltroPersonalizado.Nome}: {DateTime.Parse(ValorInicial):d} até {DateTime.Parse(ValorFinal):d}"; + break; + } + case "Decimal": + { + if (!decimal.TryParse(ValorInicial, out var result2) || !decimal.TryParse(ValorFinal, out result2) || Math.Abs(decimal.Parse(ValorInicial)) > Math.Abs(decimal.Parse(ValorFinal))) + { + await ShowMessage("O VALOR DE INTERVALO DEVE SER PREENCHIDO CORRETAMENTE."); + return; + } + descricao = $"{FiltroPersonalizado.Nome}: {decimal.Parse(ValorInicial):n2} até {decimal.Parse(ValorFinal):n2}"; + break; + } + case "Int32": + { + if (!int.TryParse(ValorInicial, out var result4) || !int.TryParse(ValorFinal, out result4) || int.Parse(ValorInicial) > int.Parse(ValorFinal)) + { + await ShowMessage("O VALOR DE INTERVALO DEVE SER PREENCHIDO CORRETAMENTE."); + return; + } + descricao = $"{FiltroPersonalizado.Nome}: {int.Parse(ValorInicial):n0} até {int.Parse(ValorFinal):n0}"; + break; + } + case "Int64": + { + if (!long.TryParse(ValorInicial, out var result) || !long.TryParse(ValorFinal, out result) || long.Parse(ValorInicial) > int.Parse(ValorFinal)) + { + await ShowMessage("O VALOR DE INTERVALO DEVE SER PREENCHIDO CORRETAMENTE."); + return; + } + descricao = $"{FiltroPersonalizado.Nome}: {long.Parse(ValorInicial):n0} até {long.Parse(ValorFinal):n0}"; + break; + } + } + } + else + { + List list2 = ((FiltroPersonalizadoSelecionado == null) ? new List() : FiltroPersonalizadoSelecionado.Where((FiltroPersonalizado x) => x.Propriedade == FiltroPersonalizado.Propriedade).ToList()); + if (list2.Count > 0) + { + list2.ForEach(delegate(FiltroPersonalizado x) + { + FiltroPersonalizadoSelecionado.Remove(x); + }); + } + descricao = FiltroPersonalizado.Nome + ": EM BRANCO"; + } + if (FiltroPersonalizadoSelecionado == null) + { + FiltroPersonalizadoSelecionado = new ObservableCollection(); + } + FiltroPersonalizadoSelecionado.Add(new FiltroPersonalizado + { + Nome = FiltroPersonalizado.Nome, + Propriedade = FiltroPersonalizado.Propriedade, + Tipo = FiltroPersonalizado.Tipo, + ValorIncial = ValorInicial, + ValorFinal = ValorFinal, + SemValor = SemValor, + Descricao = descricao + }); + FiltroPersonalizado = null; + ValorInicial = string.Empty; + ValorFinal = string.Empty; + PesquisaPersonalizada(); + } + + public void PesquisaPersonalizada() + { + Pagamentos = new ObservableCollection(TodosPagamentos.CustomWhere(FiltroPersonalizadoSelecionado.ToList())); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Ferramentas/NotaFiscalViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Ferramentas/NotaFiscalViewModel.cs new file mode 100644 index 0000000..c2585a0 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Ferramentas/NotaFiscalViewModel.cs @@ -0,0 +1,348 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Globalization; +using System.Linq; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.Servicos.Ferramentas; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Ferramentas; + +public class NotaFiscalViewModel : BaseSegurosViewModel +{ + private readonly NotaFiscalServico _servico; + + private readonly ServicoExtrato _servicoExtrato; + + private bool _apelido; + + private List _estipulantes; + + private List _seguradoras; + + private ObservableCollection _notasFiscaisFiltrados = new ObservableCollection(); + + private bool _isExpanded; + + private string _numExtrato; + + private NotaFiscal _selectedNotaFiscal; + + public NotaFiscal CancelNotaFiscal; + + public bool Apelido + { + get + { + return _apelido; + } + set + { + _apelido = value; + OnPropertyChanged("Apelido"); + } + } + + public List Estipulantes + { + get + { + return _estipulantes; + } + set + { + _estipulantes = value; + OnPropertyChanged("Estipulantes"); + } + } + + public List Seguradoras + { + get + { + return _seguradoras; + } + set + { + _seguradoras = value; + OnPropertyChanged("Seguradoras"); + } + } + + public ObservableCollection NotasFiscaisFiltrados + { + get + { + return _notasFiscaisFiltrados; + } + set + { + _notasFiscaisFiltrados = value; + IsExpanded = value != null && value.Count > 0; + OnPropertyChanged("NotasFiscaisFiltrados"); + } + } + + public bool IsExpanded + { + get + { + return _isExpanded; + } + set + { + _isExpanded = value; + OnPropertyChanged("IsExpanded"); + } + } + + public string NumExtrato + { + get + { + return _numExtrato; + } + set + { + _numExtrato = value; + OnPropertyChanged("NumExtrato"); + } + } + + public List NotasFiscais { get; set; } + + public NotaFiscal SelectedNotaFiscal + { + get + { + return _selectedNotaFiscal; + } + set + { + _selectedNotaFiscal = value; + WorkOnSelectedNotaFiscal(value); + VerificarEnables((value != null) ? new long?(((DomainBase)value).Id) : null); + OnPropertyChanged("SelectedNotaFiscal"); + } + } + + public NotaFiscalViewModel() + { + _servicoExtrato = new ServicoExtrato(); + _servico = new NotaFiscalServico(); + Seguradoras = Recursos.Seguradoras.Where((Seguradora x) => x.Ativo).ToList(); + Estipulantes = Recursos.Estipulantes.Where((Estipulante e) => e.Ativo).ToList(); + Apelido = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 6); + base.EnableMenu = true; + Seleciona(); + } + + private async void Seleciona() + { + Loading(isLoading: true); + await PermissaoTela((TipoTela)55); + await SelecionaNotaFiscal(); + Loading(isLoading: false); + } + + public async Task SelecionaNotaFiscal() + { + Loading(isLoading: true); + NotasFiscais = (await _servico.BuscarNotasFiscais()).OrderBy((NotaFiscal x) => x.Seguradora.Nome).ToList(); + NotasFiscaisFiltrados = new ObservableCollection(NotasFiscais); + SelectedNotaFiscal = NotasFiscaisFiltrados.FirstOrDefault(); + Loading(isLoading: false); + } + + public async Task> Filtrar(string value) + { + return await Task.Run(() => FiltrarNotaFiscal(value)); + } + + public List FiltrarNotaFiscal(string filter) + { + NotasFiscaisFiltrados = (string.IsNullOrWhiteSpace(filter) ? new ObservableCollection(NotasFiscais) : new ObservableCollection(from x in NotasFiscais + where ValidationHelper.RemoveDiacritics(x.Seguradora.Nome.Trim()).ToUpper().Contains(ValidationHelper.RemoveDiacritics(filter)) || ValidationHelper.RemoveDiacritics(x.ValorBruto.ToString(CultureInfo.InvariantCulture).Trim()).Contains(ValidationHelper.RemoveDiacritics(filter)) || ValidationHelper.RemoveDiacritics(x.Data.ToString().Trim()).Contains(ValidationHelper.RemoveDiacritics(filter)) + orderby x.Seguradora.Nome + select x)); + return NotasFiscaisFiltrados.ToList(); + } + + public void Incluir() + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Expected O, but got Unknown + //IL_0011: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Unknown result type (might be due to invalid IL or missing references) + //IL_001c: Expected O, but got Unknown + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0027: Unknown result type (might be due to invalid IL or missing references) + //IL_0032: Unknown result type (might be due to invalid IL or missing references) + //IL_003d: Unknown result type (might be due to invalid IL or missing references) + //IL_004d: Expected O, but got Unknown + SelectedNotaFiscal = new NotaFiscal + { + Seguradora = new Seguradora(), + Estipulante = new Estipulante(), + Iss = 0m, + ValorLiquido = 0m, + ValorBruto = 0m, + Extrato = "" + }; + Alterar(alterar: true); + } + + public async Task>> Salvar() + { + List> list = SelectedNotaFiscal.Validate(); + if (list.Count > 0) + { + return list; + } + string acao = ((((DomainBase)SelectedNotaFiscal).Id == 0L) ? "INCLUIU" : "ALTEROU"); + NotaFiscal selectedNotaFiscal = SelectedNotaFiscal; + int num; + if (selectedNotaFiscal == null) + { + num = 0; + } + else + { + Estipulante estipulante = selectedNotaFiscal.Estipulante; + num = ((((estipulante != null) ? new long?(((DomainBase)estipulante).Id) : null) <= 0) ? 1 : 0); + } + if (num != 0) + { + SelectedNotaFiscal.Estipulante = null; + } + NotaFiscal value = await _servico.Save(SelectedNotaFiscal); + if (!_servico.Sucesso) + { + return null; + } + RegistrarAcao($"{acao} NOTA FISCAL DE ID \"{((DomainBase)value).Id}\"", ((DomainBase)value).Id, (TipoTela)55, string.Format("SEGURADORA: {0}\nDATA: {1}\nBRUTO: {2:c}\nISS: {3:c}\nLÍQUIDO: {4:c}", value.Seguradora.Nome, (!value.Data.HasValue) ? "-" : $"{value.Data:d}", value.ValorBruto, value.Iss, value.ValorLiquido)); + if (NotasFiscais.Any((NotaFiscal x) => ((DomainBase)x).Id == ((DomainBase)value).Id)) + { + DomainBase.Copy(NotasFiscais.First((NotaFiscal x) => ((DomainBase)x).Id == ((DomainBase)value).Id), value); + } + else + { + NotasFiscais.Add(value); + } + if (NotasFiscaisFiltrados.Any((NotaFiscal x) => ((DomainBase)x).Id == ((DomainBase)value).Id)) + { + DomainBase.Copy(NotasFiscaisFiltrados.First((NotaFiscal x) => ((DomainBase)x).Id == ((DomainBase)value).Id), value); + } + else + { + NotasFiscaisFiltrados.Add(value); + } + NotasFiscaisFiltrados = new ObservableCollection(NotasFiscaisFiltrados); + WorkOnSelectedNotaFiscal(value, registrar: false); + Alterar(alterar: false); + ToggleSnackBar("NOTA FISCAL SALVA COM SUCESSO"); + return null; + } + + public async Task SalvarLote(List notas) + { + foreach (NotaFiscal nota in notas) + { + bool flag = nota.IdExtrato.HasValue; + if (flag) + { + flag = await _servico.Cadatrada(nota.IdExtrato.Value); + } + if (!flag) + { + SelectedNotaFiscal = nota; + await Salvar(); + } + } + ToggleSnackBar("NOTAS FISCAIS SALVAS COM SUCESSO"); + } + + public void CancelarAlteracao() + { + if (CancelNotaFiscal != null && NotasFiscais.Any((NotaFiscal x) => ((DomainBase)x).Id == ((DomainBase)CancelNotaFiscal).Id)) + { + DomainBase.Copy(NotasFiscais.First((NotaFiscal x) => ((DomainBase)x).Id == ((DomainBase)CancelNotaFiscal).Id), CancelNotaFiscal); + if (NotasFiscaisFiltrados.Count > 0 && NotasFiscaisFiltrados.Any((NotaFiscal x) => ((DomainBase)x).Id == ((DomainBase)CancelNotaFiscal).Id)) + { + DomainBase.Copy(NotasFiscaisFiltrados.First((NotaFiscal x) => ((DomainBase)x).Id == ((DomainBase)CancelNotaFiscal).Id), CancelNotaFiscal); + } + else + { + NotasFiscaisFiltrados.Add(CancelNotaFiscal); + } + NotasFiscaisFiltrados = new ObservableCollection(NotasFiscaisFiltrados); + SelectedNotaFiscal = NotasFiscaisFiltrados.First((NotaFiscal x) => ((DomainBase)x).Id == ((DomainBase)CancelNotaFiscal).Id); + } + else + { + Incluir(); + } + Alterar(alterar: false); + } + + public async void Excluir() + { + if (SelectedNotaFiscal != null && ((DomainBase)SelectedNotaFiscal).Id != 0L && await ShowMessage("DESEJA REALMENTE EXCLUIR A NOTA FISCAL DA " + SelectedNotaFiscal.Seguradora.Nome + "?", "SIM", "NÃO")) + { + Loading(isLoading: true); + if (!(await _servico.Delete(SelectedNotaFiscal))) + { + Loading(isLoading: false); + return; + } + RegistrarAcao($"EXCLUIU NOTA FISCAL DE ID \"{((DomainBase)SelectedNotaFiscal).Id}\"", ((DomainBase)SelectedNotaFiscal).Id, (TipoTela)55, string.Format("SEGURADORA: {0}\nDATA: {1}\nBRUTO: {2:c}\nISS: {3:c}\nLÍQUIDO: {4:c}", SelectedNotaFiscal.Seguradora.Nome, (!SelectedNotaFiscal.Data.HasValue) ? "-" : $"{SelectedNotaFiscal.Data:d}", SelectedNotaFiscal.ValorBruto, SelectedNotaFiscal.Iss, SelectedNotaFiscal.ValorLiquido)); + await SelecionaNotaFiscal(); + Loading(isLoading: false); + ToggleSnackBar("RECIBO EXCLUÍDO COM SUCESSO"); + } + } + + private async Task WorkOnSelectedNotaFiscal(NotaFiscal value, bool registrar = true) + { + CancelNotaFiscal = (NotaFiscal)((value == null || ((DomainBase)value).Id == 0L) ? ((object)CancelNotaFiscal) : ((object)(NotaFiscal)((DomainBase)value).Clone())); + if (value == null || ((DomainBase)value).Id == 0L || (LastAccessId == ((DomainBase)value).Id && (int)LastAccessTela == 55)) + { + return; + } + if (registrar) + { + RegistrarAcao($"ACESSOU NOTA FISCAL DE ID \"{((DomainBase)value).Id}\"", ((DomainBase)value).Id, (TipoTela)55, string.Format("SEGURADORA: {0}\nDATA: {1}\nBRUTO: {2:c}\nISS: {3:c}\nLÍQUIDO: {4:c}", value.Seguradora.Nome, (!value.Data.HasValue) ? "-" : $"{value.Data:d}", value.ValorBruto, value.Iss, value.ValorLiquido)); + } + LastAccessId = ((DomainBase)value).Id; + LastAccessTela = (TipoTela)55; + if (string.IsNullOrEmpty(SelectedNotaFiscal.Extrato)) + { + NotaFiscal selectedNotaFiscal = SelectedNotaFiscal; + string extrato = ((!SelectedNotaFiscal.IdExtrato.HasValue) ? "" : (await _servicoExtrato.BuscarNumExtrato(SelectedNotaFiscal.IdExtrato))); + selectedNotaFiscal.Extrato = extrato; + } + NotaFiscal selectedNotaFiscal2 = SelectedNotaFiscal; + if (((selectedNotaFiscal2 != null) ? new long?(((DomainBase)selectedNotaFiscal2).Id) : null) != ((DomainBase)value).Id) + { + SelectedNotaFiscal = ((IEnumerable)NotasFiscaisFiltrados).FirstOrDefault((Func)((NotaFiscal x) => ((DomainBase)x).Id == ((DomainBase)value).Id)); + } + } + + public async Task BuscarImposto() + { + List source = await new ImpostoServico().Buscar(true); + Imposto? obj = ((IEnumerable)source).FirstOrDefault((Func)((Imposto x) => x.Seguradora != null && ((DomainBase)x.Seguradora).Id == ((DomainBase)SelectedNotaFiscal.Seguradora).Id && x.Ramo == null)) ?? ((IEnumerable)source).FirstOrDefault((Func)((Imposto x) => x.Seguradora == null && x.Ramo == null)); + return (obj != null) ? obj.Iss : 0m; + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Ferramentas/ProdutoViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Ferramentas/ProdutoViewModel.cs new file mode 100644 index 0000000..efbb0dd --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Ferramentas/ProdutoViewModel.cs @@ -0,0 +1,245 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Ferramentas; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Ferramentas; + +public class ProdutoViewModel : BaseSegurosViewModel +{ + private readonly ProdutoServico _servico; + + private Produto _selectedProduto; + + public Produto CancelProduto; + + private ObservableCollection _produtosFiltrados = new ObservableCollection(); + + private bool _isExpanded; + + public Produto SelectedProduto + { + get + { + return _selectedProduto; + } + set + { + _selectedProduto = value; + WorkOnSelectedProduto(value); + VerificarEnables((value != null) ? new long?(((DomainBase)value).Id) : null); + OnPropertyChanged("SelectedProduto"); + } + } + + public ObservableCollection ProdutosFiltrados + { + get + { + return _produtosFiltrados; + } + set + { + _produtosFiltrados = value; + IsExpanded = value != null && value.Count > 0; + OnPropertyChanged("ProdutosFiltrados"); + } + } + + public bool IsExpanded + { + get + { + return _isExpanded; + } + set + { + _isExpanded = value; + OnPropertyChanged("IsExpanded"); + } + } + + public List Produtos { get; set; } + + public ProdutoViewModel() + { + _servico = new ProdutoServico(); + base.EnableMenu = true; + Seleciona(); + } + + private async void Seleciona() + { + Loading(isLoading: true); + await PermissaoTela((TipoTela)10); + await SelecionaProdutos(); + Loading(isLoading: false); + } + + private async Task SelecionaProdutos() + { + Loading(isLoading: true); + Produtos = (from x in await new BaseServico().BuscarProdutosAsync() + orderby x.Ativo descending, x.Nome + select x).ToList(); + ProdutosFiltrados = new ObservableCollection(Produtos); + SelectedProduto = ProdutosFiltrados.FirstOrDefault(); + Recursos.Produtos = Produtos.OrderBy((Produto x) => x.Nome).ToList(); + Loading(isLoading: false); + Loading(isLoading: true); + } + + public async Task>> Validate() + { + if (string.IsNullOrWhiteSpace(SelectedProduto.Nome)) + { + return new List>(); + } + List> errors = new List>(); + bool valida = true; + List list = await new BaseServico().BuscarProduto(SelectedProduto.Nome); + if (list.Count > 0) + { + list.ForEach(delegate(Produto x) + { + if (((DomainBase)x).Id != ((DomainBase)SelectedProduto).Id && x.Nome == SelectedProduto.Nome) + { + valida = false; + } + }); + } + if (!valida) + { + errors.Add(new KeyValuePair("Nome", "UM PRODUTO COM O MESMO NOME JÁ EXISTE.")); + } + return errors; + } + + public async Task>> Salvar() + { + List> errorMessages = SelectedProduto.Validate(); + List> list = errorMessages; + list.AddRange(await Validate()); + if (errorMessages.Count > 0) + { + return errorMessages; + } + string acao = ((((DomainBase)SelectedProduto).Id == 0L) ? "INCLUIU" : "ALTEROU"); + Produto value = await _servico.Save(SelectedProduto); + if (!_servico.Sucesso) + { + return null; + } + RegistrarAcao(acao + " PRODUTO \"" + value.Nome + "\"", ((DomainBase)value).Id, (TipoTela)10, $"PRODUTO \"{value.Nome}\", ID: {((DomainBase)value).Id}"); + if (Produtos.Any((Produto x) => ((DomainBase)x).Id == ((DomainBase)value).Id)) + { + DomainBase.Copy(Produtos.First((Produto x) => ((DomainBase)x).Id == ((DomainBase)value).Id), value); + } + else + { + Produtos.Add(value); + } + if (ProdutosFiltrados.Any((Produto x) => ((DomainBase)x).Id == ((DomainBase)value).Id)) + { + DomainBase.Copy(ProdutosFiltrados.First((Produto x) => ((DomainBase)x).Id == ((DomainBase)value).Id), value); + } + else + { + ProdutosFiltrados.Add(value); + } + ProdutosFiltrados = new ObservableCollection(ProdutosFiltrados); + Recursos.Produtos = Produtos.OrderBy((Produto x) => x.Nome).ToList(); + WorkOnSelectedProduto(value, registrar: false); + Alterar(alterar: false); + ToggleSnackBar("PRODUTO SALVO COM SUCESSO"); + return null; + } + + public void CancelarAlteracao() + { + if (CancelProduto != null && Produtos.Any((Produto x) => ((DomainBase)x).Id == ((DomainBase)CancelProduto).Id)) + { + DomainBase.Copy(Produtos.First((Produto x) => ((DomainBase)x).Id == ((DomainBase)CancelProduto).Id), CancelProduto); + if (ProdutosFiltrados.Count > 0 && ProdutosFiltrados.Any((Produto x) => ((DomainBase)x).Id == ((DomainBase)CancelProduto).Id)) + { + DomainBase.Copy(ProdutosFiltrados.First((Produto x) => ((DomainBase)x).Id == ((DomainBase)CancelProduto).Id), CancelProduto); + } + else + { + ProdutosFiltrados.Add(CancelProduto); + } + ProdutosFiltrados = new ObservableCollection(ProdutosFiltrados); + SelectedProduto = ProdutosFiltrados.First((Produto x) => ((DomainBase)x).Id == ((DomainBase)CancelProduto).Id); + } + else + { + Incluir(); + } + Alterar(alterar: false); + } + + private void WorkOnSelectedProduto(Produto value, bool registrar = true) + { + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_0069: Unknown result type (might be due to invalid IL or missing references) + //IL_0070: Invalid comparison between Unknown and I4 + //IL_00d6: Unknown result type (might be due to invalid IL or missing references) + CancelProduto = (Produto)((value == null || ((DomainBase)value).Id == 0L) ? ((object)CancelProduto) : ((object)(Produto)((DomainBase)value).Clone())); + if (value == null || ((DomainBase)value).Id == 0L || (LastAccessId == ((DomainBase)value).Id && (int)LastAccessTela == 10)) + { + return; + } + if (registrar) + { + RegistrarAcao("ACESSOU PRODUTO \"" + value.Nome + "\"", ((DomainBase)value).Id, (TipoTela)10, $"ID PRODUTO: {((DomainBase)value).Id}"); + } + LastAccessId = ((DomainBase)value).Id; + LastAccessTela = (TipoTela)10; + Produto selectedProduto = SelectedProduto; + if (((selectedProduto != null) ? new long?(((DomainBase)selectedProduto).Id) : null) != ((DomainBase)value).Id) + { + SelectedProduto = ((IEnumerable)ProdutosFiltrados).FirstOrDefault((Func)((Produto x) => ((DomainBase)x).Id == ((DomainBase)value).Id)); + } + } + + public void Incluir() + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Expected O, but got Unknown + SelectedProduto = new Produto + { + Ativo = true + }; + Alterar(alterar: true); + } + + internal async Task> Filtrar(string value) + { + return await Task.Run(() => FiltrarProduto(value)); + } + + public List FiltrarProduto(string filter) + { + ProdutosFiltrados = (string.IsNullOrWhiteSpace(filter) ? new ObservableCollection(Produtos) : new ObservableCollection(from x in Produtos + where ValidationHelper.RemoveDiacritics(x.Nome.Trim()).ToUpper().Contains(ValidationHelper.RemoveDiacritics(filter)) + orderby x.Ativo descending, x.Nome + select x)); + SelectedProduto = ProdutosFiltrados.FirstOrDefault(); + return ProdutosFiltrados.ToList(); + } + + public void SelecionaProduto(Produto produto) + { + SelectedProduto = produto; + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Ferramentas/ProtocoloDocumentosViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Ferramentas/ProtocoloDocumentosViewModel.cs new file mode 100644 index 0000000..20e4e44 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Ferramentas/ProtocoloDocumentosViewModel.cs @@ -0,0 +1,278 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Windows; +using System.Windows.Controls; +using Assinador.Infrastructure.Helpers; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.ViewModels.Generic; +using Gestor.Application.Views.Ferramentas; +using Gestor.Application.Views.Generic; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Ferramentas; + +public class ProtocoloDocumentosViewModel : BaseSegurosViewModel +{ + private Cliente _selectedCliente = new Cliente(); + + private ObservableCollection _apolicesFiltradas = new ObservableCollection(); + + private ObservableCollection _apolicesAdicionadas = new ObservableCollection(); + + private FiltroStatusDocumento _selectedStatus; + + public Cliente SelectedCliente + { + get + { + return _selectedCliente; + } + set + { + //IL_0053: Unknown result type (might be due to invalid IL or missing references) + //IL_0030: Unknown result type (might be due to invalid IL or missing references) + //IL_0037: Invalid comparison between Unknown and I4 + _selectedCliente = value; + if (SelectedCliente != null && ((DomainBase)SelectedCliente).Id != 0L && (LastAccessId != ((DomainBase)SelectedCliente).Id || (int)LastAccessTela != 59)) + { + SelecionarDocumentos(); + LastAccessId = ((DomainBase)SelectedCliente).Id; + LastAccessTela = (TipoTela)59; + } + OnPropertyChanged("SelectedCliente"); + } + } + + public ObservableCollection ApolicesFiltradas + { + get + { + return _apolicesFiltradas; + } + set + { + _apolicesFiltradas = value; + OnPropertyChanged("ApolicesFiltradas"); + } + } + + public ObservableCollection ApolicesAdicionadas + { + get + { + return _apolicesAdicionadas; + } + set + { + _apolicesAdicionadas = value; + OnPropertyChanged("ApolicesAdicionadas"); + } + } + + public FiltroStatusDocumento SelectedStatus + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _selectedStatus; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _selectedStatus = value; + SelectedCliente = SelectedCliente; + SelecionarDocumentos(); + OnPropertyChanged("SelectedStatus"); + } + } + + public async void SelecionarDocumentos() + { + Loading(isLoading: true); + if (SelectedCliente == null) + { + Loading(isLoading: false); + return; + } + ApolicesFiltradas = await new ApoliceServico().BuscarApolicesComissao(((DomainBase)SelectedCliente).Id, SelectedStatus); + ProtocoloDocumentosViewModel protocoloDocumentosViewModel = this; + string arg = (((int)SelectedStatus == 4) ? "TODOS OS DOCUMENTOS" : ("OS " + Functions.GetDescription((Enum)(object)SelectedStatus))); + Cliente selectedCliente = SelectedCliente; + string arg2 = ((selectedCliente != null) ? selectedCliente.Nome : null); + Cliente selectedCliente2 = SelectedCliente; + protocoloDocumentosViewModel.RegistrarAcao($"CONSULTOU {arg} DO CLIENTE {arg2} ({((selectedCliente2 != null) ? new long?(((DomainBase)selectedCliente2).Id) : null)})", (SelectedCliente == null) ? 0 : ((DomainBase)SelectedCliente).Id, (TipoTela)59); + Loading(isLoading: false); + } + + public async void AdicionarProtocolo(Documento documento) + { + bool flag = ApolicesAdicionadas.Any((ProtocoloEtiqueta x) => ((DomainBase)x.Documento).Id == ((DomainBase)documento).Id && (int)x.Tipo == 0); + if (flag) + { + flag = !(await ShowMessage("JÁ EXISTE UM PROTOCOLO ADICIONADO PARA O DOCUMENTO SELECIONADO, DESEJA ADICIONAR NOVAMENTE?", "SIM", "NÃO")); + } + if (!flag) + { + ObservableCollection apolicesAdicionadas = ApolicesAdicionadas; + ProtocoloEtiqueta protocoloEtiqueta = new ProtocoloEtiqueta(); + ProtocoloEtiqueta protocoloEtiqueta2 = protocoloEtiqueta; + protocoloEtiqueta2.Documento = await new ApoliceServico().BuscarApoliceAsync(((DomainBase)documento).Id); + protocoloEtiqueta.Tipo = (TipoProtocoloEtiqueta)0; + apolicesAdicionadas.Add(protocoloEtiqueta); + ApolicesAdicionadas = new ObservableCollection(ApolicesAdicionadas.OrderBy((ProtocoloEtiqueta x) => ((DomainBase)x.Documento).Id)); + } + } + + public async void AdicionarEtiqueta(Documento documento) + { + ObservableCollection apolicesAdicionadas = ApolicesAdicionadas; + ProtocoloEtiqueta protocoloEtiqueta = new ProtocoloEtiqueta(); + ProtocoloEtiqueta protocoloEtiqueta2 = protocoloEtiqueta; + protocoloEtiqueta2.Documento = await new ApoliceServico().BuscarApoliceAsync(((DomainBase)documento).Id); + protocoloEtiqueta.Tipo = (TipoProtocoloEtiqueta)1; + apolicesAdicionadas.Add(protocoloEtiqueta); + ApolicesAdicionadas = new ObservableCollection(ApolicesAdicionadas.OrderBy((ProtocoloEtiqueta x) => ((DomainBase)x.Documento).Id)); + } + + public async void AdicionarEtiquetaCliente() + { + if (SelectedCliente == null || ((DomainBase)SelectedCliente).Id == 0L) + { + return; + } + bool flag = ApolicesAdicionadas.Any((ProtocoloEtiqueta x) => ((DomainBase)x.Documento.Controle.Cliente).Id == ((DomainBase)SelectedCliente).Id && (int)x.Tipo == 1); + if (flag) + { + flag = !(await ShowMessage("JÁ EXISTE UMA ETIQUETA ADICIONADA PARA O CLIENTE SELECIONADO, DESEJA ADICIONAR NOVAMENTE?", "SIM", "NÃO")); + } + if (!flag) + { + ApolicesAdicionadas.Add(new ProtocoloEtiqueta + { + Documento = new Documento + { + Controle = new Controle + { + Cliente = SelectedCliente + } + }, + Tipo = (TipoProtocoloEtiqueta)1 + }); + ApolicesAdicionadas = new ObservableCollection(from x in ApolicesAdicionadas + orderby x.Tipo, ((DomainBase)x.Documento.Controle.Cliente).Id + select x); + } + } + + public async void AdicionarEtiquetaCorretora() + { + ClienteEndereco item = new ClienteEndereco + { + Endereco = ((EnderecoBase)Recursos.Empresa).Endereco, + Bairro = ((EnderecoBase)Recursos.Empresa).Bairro, + Numero = ((EnderecoBase)Recursos.Empresa).Numero, + Complemento = ((EnderecoBase)Recursos.Empresa).Complemento, + Cidade = ((EnderecoBase)Recursos.Empresa).Cidade, + Estado = ((EnderecoBase)Recursos.Empresa).Estado, + Cep = ((EnderecoBase)Recursos.Empresa).Cep + }; + ObservableCollection observableCollection = new ObservableCollection(); + observableCollection.Add(item); + ApolicesAdicionadas.Add(new ProtocoloEtiqueta + { + Documento = new Documento + { + Controle = new Controle + { + Cliente = new Cliente + { + Nome = Recursos.Empresa.Nome, + Id = -1L, + Enderecos = observableCollection + } + } + }, + Tipo = (TipoProtocoloEtiqueta)1 + }); + ApolicesAdicionadas = new ObservableCollection(from x in ApolicesAdicionadas + orderby x.Tipo, ((DomainBase)x.Documento.Controle.Cliente).Id + select x); + } + + public void Remover(ProtocoloEtiqueta documento) + { + ApolicesAdicionadas.Remove(documento); + SelecionarDocumentos(); + } + + public async void Imprimir(TipoProtocoloEtiqueta tipo) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + if (ApolicesAdicionadas.Count == 0) + { + await ShowMessage("NECESSÁRIO ADICIONAR DOCUMENTOS PARA EMISSÃO DE " + Functions.GetDescription((Enum)(object)tipo)); + } + else if ((int)tipo != 0) + { + if ((int)tipo != 1) + { + return; + } + if (ApolicesAdicionadas.All((ProtocoloEtiqueta x) => (int)x.Tipo != 1)) + { + await ShowMessage("NECESSÁRIO ADICIONAR DOCUMENTOS PARA EMISSÃO DE " + Functions.GetDescription((Enum)(object)tipo)); + return; + } + if (ApolicesAdicionadas.Any((ProtocoloEtiqueta x) => (int)x.Tipo == 1 && ((DomainBase)x.Documento).Id == 0)) + { + if (ApolicesAdicionadas.Any((ProtocoloEtiqueta x) => (int)x.Tipo == 1 && ((DomainBase)x.Documento).Id != 0)) + { + await ShowMessage("COMO EXISTEM ETIQUETAS DE CLIENTES E DOCUMENTOS,\nPRIMEIRO CONFIGURE AS DE SOMENTE CLIENTE.\nDEPOIS DE GERAR AS ETIQUETAS DE CLIENTE, CONFIGURAR AS DE DOCUMENTOS"); + } + ((Window)new HosterWindow((ContentControl)(object)new EtiquetaView((from x in ApolicesAdicionadas + where (int)x.Tipo == 1 && ((DomainBase)x.Documento).Id == 0 + select x.Documento).ToList(), apenasCliente: true), "ETIQUETAS", 900.0, 600.0)).Show(); + } + if (ApolicesAdicionadas.Any((ProtocoloEtiqueta x) => (int)x.Tipo == 1 && ((DomainBase)x.Documento).Id != 0)) + { + ((Window)new HosterWindow((ContentControl)(object)new EtiquetaView((from x in ApolicesAdicionadas + where (int)x.Tipo == 1 && ((DomainBase)x.Documento).Id != 0 + select x.Documento).ToList(), apenasCliente: false), "ETIQUETAS", 900.0, 600.0)).Show(); + } + } + else if (ApolicesAdicionadas.All((ProtocoloEtiqueta x) => (int)x.Tipo > 0)) + { + await ShowMessage("NECESSÁRIO ADICIONAR DOCUMENTOS PARA EMISSÃO DE " + Functions.GetDescription((Enum)(object)tipo)); + } + else if (ApolicesAdicionadas.Any((ProtocoloEtiqueta x) => (int)x.Tipo == 0)) + { + List lista = await ShowProtocoloDialog((from x in ApolicesAdicionadas + where (int)x.Tipo == 0 + select x.Documento).ToList()); + if (lista != null) + { + PrepararProtocolo(lista, await ShowMessage("DESEJA EMITIR DOIS PROTOCOLOS POR PÁGINA?" + Environment.NewLine + "A QUANTIDADE DE INFORMÃÇÕES PODE IMPEDIR QUE ESSA FUNÇÃO FUNCIONE CORRETAMENTE", "SIM", "NÃO")); + } + } + } + + public async void PrepararProtocolo(List documentos, bool doisPorPagina) + { + if (await ShowMessage("DESEJA EMITIR O CHECKLIST?", "SIM", "NÃO")) + { + await EmitirCheckList(documentos); + } + if (documentos != null) + { + List> lista = documentos.Select((Documento x) => new Tuple(((DomainBase)x).Id, x.ObsProtocolo)).ToList(); + await EmitirProtocolos(lista, doisPorPagina, documentos); + } + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Ferramentas/ProtocoloEtiqueta.cs b/Decompiler/Gestor.Application.ViewModels.Ferramentas/ProtocoloEtiqueta.cs new file mode 100644 index 0000000..81c1f67 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Ferramentas/ProtocoloEtiqueta.cs @@ -0,0 +1,11 @@ +using Gestor.Model.Common; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Ferramentas; + +public class ProtocoloEtiqueta +{ + public TipoProtocoloEtiqueta Tipo { get; set; } + + public Documento Documento { get; set; } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Ferramentas/QualificacaoViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Ferramentas/QualificacaoViewModel.cs new file mode 100644 index 0000000..5e79531 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Ferramentas/QualificacaoViewModel.cs @@ -0,0 +1,122 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using Gestor.Application.Servicos.Ferramentas; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Ferramentas; + +public class QualificacaoViewModel : BaseSegurosViewModel +{ + private readonly QualificacaoServico _servico; + + private Qualificacao _selectedQualificacao; + + public Qualificacao CancelQualificacao; + + public Qualificacao SelectedQualificacao + { + get + { + return _selectedQualificacao; + } + set + { + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + //IL_0013: Unknown result type (might be due to invalid IL or missing references) + //IL_001e: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_003e: Unknown result type (might be due to invalid IL or missing references) + //IL_004b: Unknown result type (might be due to invalid IL or missing references) + //IL_0058: Unknown result type (might be due to invalid IL or missing references) + //IL_0065: Unknown result type (might be due to invalid IL or missing references) + //IL_0072: Unknown result type (might be due to invalid IL or missing references) + //IL_0082: Unknown result type (might be due to invalid IL or missing references) + //IL_0092: Unknown result type (might be due to invalid IL or missing references) + //IL_009c: Expected O, but got Unknown + if (value == null || ((DomainBase)value).Id == 0L) + { + value = new Qualificacao + { + Liquido1 = 0m, + Liquido2 = 1000m, + Liquido3 = 5000m, + Comissao1 = 10m, + Comissao2 = 15m, + Comissao3 = 20m, + Resultado1 = 100m, + Resultado2 = 200m, + Resultado3 = 300m, + Id = 1L + }; + } + _selectedQualificacao = value; + VerificarEnables(((DomainBase)value).Id); + OnPropertyChanged("SelectedQualificacao"); + } + } + + public QualificacaoViewModel() + { + _servico = new QualificacaoServico(); + Seleciona(); + } + + private async void Seleciona() + { + Loading(isLoading: true); + await PermissaoTela((TipoTela)48); + await SelecionaQualificacao(); + Loading(isLoading: false); + } + + private async Task SelecionaQualificacao() + { + Loading(isLoading: true); + SelectedQualificacao = await _servico.BuscarQualificacaoAsync(); + RegistrarAcao("ACESSOU QUALIFICAÇÃO", 0L, (TipoTela)48); + Loading(isLoading: false); + } + + public async Task>> Salvar() + { + if (((DomainBase)(await _servico.BuscarQualificacaoAsync())).Id == 0L) + { + ((DomainBase)SelectedQualificacao).Id = 0L; + } + List> list = SelectedQualificacao.Validate(); + if (list.Count > 0) + { + return list; + } + SelectedQualificacao = await _servico.Save(SelectedQualificacao); + if (!_servico.Sucesso) + { + return null; + } + RegistrarAcao("ALTEROU QUALIFICAÇÃO", 0L, (TipoTela)48); + Alterar(alterar: false); + ToggleSnackBar("QUALIFICACAO SALVA COM SUCESSO"); + return null; + } + + public void CancelarAlteracao() + { + Loading(isLoading: true); + if (((DomainBase)SelectedQualificacao).Id == 0L) + { + SelectedQualificacao = null; + Alterar(alterar: false); + base.EnableMenu = false; + Loading(isLoading: false); + } + else + { + SelectedQualificacao = CancelQualificacao; + } + Alterar(alterar: false); + Loading(isLoading: false); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Ferramentas/RamoViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Ferramentas/RamoViewModel.cs new file mode 100644 index 0000000..131f914 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Ferramentas/RamoViewModel.cs @@ -0,0 +1,284 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Ferramentas; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Ferramentas; + +public class RamoViewModel : BaseSegurosViewModel +{ + private readonly RamoServico _servico; + + private Ramo _selectedRamo = new Ramo(); + + private decimal _iof; + + private ObservableCollection _ramosFiltrados = new ObservableCollection(); + + private bool _isExpanded; + + private List _coberturas = new List(); + + private ObservableCollection _coberturasFiltradas = new ObservableCollection(); + + public Ramo CancelRamo; + + public Ramo SelectedRamo + { + get + { + return _selectedRamo; + } + set + { + _selectedRamo = value; + WorkOnSelectedRamo(value); + VerificarEnables((value != null) ? new long?(((DomainBase)value).Id) : null); + OnPropertyChanged("SelectedRamo"); + } + } + + public decimal Iof + { + get + { + return _iof; + } + set + { + _iof = value; + OnPropertyChanged("Iof"); + } + } + + public List Ramos { get; set; } + + public ObservableCollection RamosFiltrados + { + get + { + return _ramosFiltrados; + } + set + { + _ramosFiltrados = value; + IsExpanded = value != null && value.Count > 0; + OnPropertyChanged("RamosFiltrados"); + } + } + + public bool IsExpanded + { + get + { + return _isExpanded; + } + set + { + _isExpanded = value; + OnPropertyChanged("IsExpanded"); + } + } + + public List Coberturas + { + get + { + return _coberturas; + } + set + { + _coberturas = value; + OnPropertyChanged("Coberturas"); + } + } + + public ObservableCollection CoberturasFiltradas + { + get + { + return _coberturasFiltradas; + } + set + { + _coberturasFiltradas = value; + OnPropertyChanged("CoberturasFiltradas"); + } + } + + public RamoViewModel() + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_000b: Expected O, but got Unknown + _servico = new RamoServico(); + base.EnableMenu = true; + Seleciona(); + } + + public async void Seleciona() + { + Loading(isLoading: true); + await PermissaoTela((TipoTela)12); + await SelecionaRamos(); + Loading(isLoading: false); + } + + private async Task SelecionaRamos(Ramo ramo = null) + { + Loading(isLoading: true); + await SelecionaCoberturas(); + List list = await new BaseServico().BuscarRamosAsync(); + Ramos = (from x in list + orderby x.Ativo descending, x.Nome + select x).ToList(); + RamosFiltrados = new ObservableCollection(Ramos); + SelectedRamo = (Ramo)((ramo == null) ? ((object)RamosFiltrados.First()) : ((object)((IEnumerable)RamosFiltrados).FirstOrDefault((Func)((Ramo x) => ((DomainBase)x).Id == ((DomainBase)ramo).Id)))); + Recursos.Ramos = list; + Loading(isLoading: false); + } + + private static async Task SelecionaCoberturas() + { + Recursos.Coberturas = await new BaseServico().BuscaCoberturas(); + } + + private void WorkOnSelectedRamo(Ramo value, bool registrar = true) + { + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_0069: Unknown result type (might be due to invalid IL or missing references) + //IL_0070: Invalid comparison between Unknown and I4 + //IL_0170: Unknown result type (might be due to invalid IL or missing references) + CancelRamo = (Ramo)((value == null || ((DomainBase)value).Id == 0L) ? ((object)CancelRamo) : ((object)(Ramo)((DomainBase)value).Clone())); + if (value == null || ((DomainBase)value).Id == 0L || (LastAccessId == ((DomainBase)value).Id && (int)LastAccessTela == 12)) + { + return; + } + Coberturas = (from x in Recursos.Coberturas + where x.IdRamo == ((DomainBase)value).Id + orderby x.Padrao descending, x.Descricao + select x).ToList(); + CoberturasFiltradas = new ObservableCollection(Coberturas); + Iof = value.Iof * 0.01m; + if (registrar) + { + RegistrarAcao("ACESSOU RAMO \"" + value.Nome + "\"", ((DomainBase)value).Id, (TipoTela)12, $"ID RAMO: {((DomainBase)value).Id}"); + } + LastAccessId = ((DomainBase)value).Id; + LastAccessTela = (TipoTela)12; + Ramo selectedRamo = SelectedRamo; + if (((selectedRamo != null) ? new long?(((DomainBase)selectedRamo).Id) : null) != ((DomainBase)value).Id) + { + SelectedRamo = ((IEnumerable)RamosFiltrados).FirstOrDefault((Func)((Ramo x) => ((DomainBase)x).Id == ((DomainBase)value).Id)); + } + } + + public async Task>> Salvar() + { + SelectedRamo.Iof = Iof; + List> list = SelectedRamo.Validate(); + if (list.Count > 0) + { + return list; + } + Ramo selectedRamo = SelectedRamo; + selectedRamo.Iof *= 100m; + string acao = ((((DomainBase)SelectedRamo).Id == 0L) ? "INCLUIU" : "ALTEROU"); + Ramo value = await _servico.Save(SelectedRamo, Coberturas); + if (!_servico.Sucesso) + { + return null; + } + RegistrarAcao(acao + " RAMO \"" + value.Nome + "\"", ((DomainBase)value).Id, (TipoTela)12, $"RAMO \"{value.Nome}\", ID: {((DomainBase)value).Id}"); + if (Ramos.Any((Ramo x) => ((DomainBase)x).Id == ((DomainBase)value).Id)) + { + DomainBase.Copy(Ramos.First((Ramo x) => ((DomainBase)x).Id == ((DomainBase)value).Id), value); + } + else + { + Ramos.Add(value); + } + if (RamosFiltrados.Any((Ramo x) => ((DomainBase)x).Id == ((DomainBase)value).Id)) + { + DomainBase.Copy(RamosFiltrados.First((Ramo x) => ((DomainBase)x).Id == ((DomainBase)value).Id), value); + } + else + { + RamosFiltrados.Add(value); + } + RamosFiltrados = new ObservableCollection(RamosFiltrados); + Recursos.Ramos = Ramos; + await SelecionaCoberturas(); + WorkOnSelectedRamo(value, registrar: false); + Alterar(alterar: false); + ToggleSnackBar("RAMO SALVO COM SUCESSO"); + return null; + } + + public void CancelarAlteracao() + { + if (CancelRamo != null && Ramos.Any((Ramo x) => ((DomainBase)x).Id == ((DomainBase)CancelRamo).Id)) + { + DomainBase.Copy(Ramos.First((Ramo x) => ((DomainBase)x).Id == ((DomainBase)CancelRamo).Id), CancelRamo); + if (RamosFiltrados.Count > 0 && RamosFiltrados.Any((Ramo x) => ((DomainBase)x).Id == ((DomainBase)CancelRamo).Id)) + { + DomainBase.Copy(RamosFiltrados.First((Ramo x) => ((DomainBase)x).Id == ((DomainBase)CancelRamo).Id), CancelRamo); + } + else + { + RamosFiltrados.Add(CancelRamo); + } + RamosFiltrados = new ObservableCollection(RamosFiltrados); + SelectedRamo = RamosFiltrados.First((Ramo x) => ((DomainBase)x).Id == ((DomainBase)CancelRamo).Id); + } + Alterar(alterar: false); + } + + internal async Task> Filtrar(string value) + { + return await Task.Run(() => FiltrarRamo(value)); + } + + public List FiltrarRamo(string filter) + { + RamosFiltrados = (string.IsNullOrWhiteSpace(filter) ? new ObservableCollection(Ramos) : new ObservableCollection(from x in Ramos + where ValidationHelper.RemoveDiacritics(x.Nome.Trim()).ToUpper().Contains(ValidationHelper.RemoveDiacritics(filter)) + orderby x.Ativo descending, x.Nome + select x)); + return RamosFiltrados.ToList(); + } + + internal async Task> FiltrarCobertura(string value) + { + return await Task.Run(() => FiltrarCoberturaRamo(value)); + } + + public List FiltrarCoberturaRamo(string filter) + { + CoberturasFiltradas = (string.IsNullOrWhiteSpace(filter) ? new ObservableCollection(Coberturas) : new ObservableCollection(Coberturas.Where((CoberturaPadrao x) => ValidationHelper.RemoveDiacritics(x.Descricao.Trim()).ToUpper().Contains(ValidationHelper.RemoveDiacritics(filter))))); + return CoberturasFiltradas.ToList(); + } + + public void SelecionaRamo(Ramo ramo) + { + SelectedRamo = ramo; + } + + public async void Incluir(Ramo ramo) + { + ramo.Ativo = true; + await _servico.Insert(ramo); + if (_servico.Sucesso) + { + await SelecionaRamos(ramo); + } + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Ferramentas/ReciboViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Ferramentas/ReciboViewModel.cs new file mode 100644 index 0000000..81e4e8f --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Ferramentas/ReciboViewModel.cs @@ -0,0 +1,537 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.Drawing; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Ferramentas; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Ferramentas; + +public class ReciboViewModel : BaseSegurosViewModel +{ + private readonly ReciboServico _servico; + + public Recibo CancelRecibo; + + private Recibo _selectedRecibo = new Recibo(); + + private DateTime? _horaRecibo; + + private ObservableCollection _recibosFiltrados = new ObservableCollection(); + + private bool _isExpanded; + + private Cliente _pagante; + + private Cliente _recebedor; + + public List Recibos { get; set; } + + public Recibo SelectedRecibo + { + get + { + return _selectedRecibo; + } + set + { + _selectedRecibo = value; + WorkOnSelectedRecibo(value); + VerificarEnables((value != null) ? new long?(((DomainBase)value).Id) : null); + if (!value.DataRecibo.HasValue) + { + value.DataRecibo = DateTime.Now; + } + if (value != null) + { + HoraRecibo = value.DataRecibo; + } + OnPropertyChanged("SelectedRecibo"); + } + } + + public DateTime? HoraRecibo + { + get + { + return _horaRecibo; + } + set + { + _horaRecibo = value; + if (value.HasValue) + { + SelectedRecibo.DataRecibo = (SelectedRecibo.DataRecibo.HasValue ? new DateTime?(DateTime.Parse($"{SelectedRecibo.DataRecibo.Value:d} {value:T}")) : null); + OnPropertyChanged("HoraRecibo"); + } + } + } + + public ObservableCollection RecibosFiltrados + { + get + { + return _recibosFiltrados; + } + set + { + _recibosFiltrados = value; + IsExpanded = value != null && value.Count > 0; + OnPropertyChanged("RecibosFiltrados"); + } + } + + public bool IsExpanded + { + get + { + return _isExpanded; + } + set + { + _isExpanded = value; + OnPropertyChanged("IsExpanded"); + } + } + + public Cliente Pagante + { + get + { + return _pagante; + } + set + { + _pagante = value; + WorkOnSelectedPagante(value); + OnPropertyChanged("Pagante"); + } + } + + public Cliente Recebedor + { + get + { + return _recebedor; + } + set + { + _recebedor = value; + WorkOnSelectedRecebedor(value); + OnPropertyChanged("Recebedor"); + } + } + + public ReciboViewModel() + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_000b: Expected O, but got Unknown + _servico = new ReciboServico(); + base.EnableMenu = true; + Seleciona(); + } + + private void WorkOnSelectedPagante(Cliente value) + { + if (value != null) + { + SelectedRecibo.Pagante = Regex.Replace(value.NomeSocial, "\\-\\s\\d.*", "").Trim(); + SelectedRecibo.DocumentoPagante = value.Documento; + SelectedRecibo = SelectedRecibo; + } + } + + private void WorkOnSelectedRecebedor(Cliente value) + { + if (value != null) + { + SelectedRecibo.Recebedor = Regex.Replace(value.NomeSocial, "\\-\\s\\d.*", "").Trim(); + SelectedRecibo.DocumentoRecebedor = value.Documento; + SelectedRecibo = SelectedRecibo; + } + } + + private async void Seleciona() + { + Loading(isLoading: true); + await PermissaoTela((TipoTela)42); + await SelecionaRecibo(); + Loading(isLoading: false); + } + + private async Task SelecionaRecibo() + { + Loading(isLoading: true); + Recibos = (await _servico.BuscarRecibos()).ToList(); + RecibosFiltrados = new ObservableCollection(Recibos); + if (RecibosFiltrados.Count > 0) + { + SelectedRecibo = RecibosFiltrados.First(); + } + else + { + SelectedRecibo = new Recibo(); + Alterar(alterar: false); + base.EnableMenu = false; + } + Loading(isLoading: false); + } + + public void Incluir() + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_000b: Expected O, but got Unknown + SelectedRecibo = new Recibo(); + Alterar(alterar: true); + } + + internal async Task> Filtrar(string value) + { + return await Task.Run(() => FiltrarRecibo(value)); + } + + public List FiltrarRecibo(string filter) + { + RecibosFiltrados = (string.IsNullOrWhiteSpace(filter) ? new ObservableCollection(Recibos) : new ObservableCollection(Recibos.Where((Recibo x) => ValidationHelper.RemoveDiacritics(x.Pagante.Trim()).ToUpper().Contains(ValidationHelper.RemoveDiacritics(filter)) || ValidationHelper.RemoveDiacritics(x.Recebedor).ToUpper().Contains(ValidationHelper.RemoveDiacritics(filter))))); + return RecibosFiltrados.ToList(); + } + + public async Task>> Salvar() + { + List> list = SelectedRecibo.Validate(); + if (list.Count > 0) + { + return list; + } + string acao = ((((DomainBase)SelectedRecibo).Id == 0L) ? "INCLUIU" : "ALTEROU"); + Recibo value = await _servico.Save(SelectedRecibo); + if (!_servico.Sucesso) + { + return null; + } + ReciboViewModel reciboViewModel = this; + string descricao = $"{acao} RECIBO DE NÚMERO \"{((DomainBase)value).Id}\""; + long id = ((DomainBase)value).Id; + TipoTela? tela = (TipoTela)42; + object[] obj = new object[9] + { + value.Tipo.HasValue ? (ValidationHelper.GetDescription((Enum)(object)value.Tipo.Value) ?? "") : "-", + null, + null, + null, + null, + null, + null, + null, + null + }; + TipoPagamento? pagamento = value.Pagamento; + obj[1] = (pagamento.HasValue ? ValidationHelper.GetDescription((Enum)(object)pagamento.GetValueOrDefault()) : null); + obj[2] = value.Valor; + obj[3] = value.DataRecibo; + obj[4] = value.Pagante; + obj[5] = value.DocumentoPagante; + obj[6] = value.Recebedor; + obj[7] = value.DocumentoRecebedor; + obj[8] = value.Referente; + reciboViewModel.RegistrarAcao(descricao, id, tela, string.Format("TIPO: {0}\nPAGAMENTO: {1}\nVALOR: {2:c}\nDATA RECIBO: {3:G}\nPAGANTE: {4}, {5}\nRECEBEDOR: {6}, {7}\nREFERENTE: \"{8}\"", obj)); + if (Recibos.Any((Recibo x) => ((DomainBase)x).Id == ((DomainBase)value).Id)) + { + DomainBase.Copy(Recibos.First((Recibo x) => ((DomainBase)x).Id == ((DomainBase)value).Id), value); + } + else + { + Recibos.Add(value); + } + if (RecibosFiltrados.Any((Recibo x) => ((DomainBase)x).Id == ((DomainBase)value).Id)) + { + DomainBase.Copy(RecibosFiltrados.First((Recibo x) => ((DomainBase)x).Id == ((DomainBase)value).Id), value); + } + else + { + RecibosFiltrados.Add(value); + } + RecibosFiltrados = new ObservableCollection(RecibosFiltrados); + WorkOnSelectedRecibo(value, registrar: false); + Alterar(alterar: false); + ToggleSnackBar("RECIBO SALVO COM SUCESSO"); + return null; + } + + public async void Excluir() + { + if (SelectedRecibo != null && ((DomainBase)SelectedRecibo).Id != 0L && await ShowMessage("DESEJA REALMENTE EXCLUIR O RECIBO PERMANENTEMENTE?", "SIM", "NÃO")) + { + Loading(isLoading: true); + if (!(await _servico.Delete(SelectedRecibo))) + { + Loading(isLoading: false); + return; + } + ReciboViewModel reciboViewModel = this; + string descricao = $"EXCLUIU RECIBO DE NÚMERO \"{((DomainBase)SelectedRecibo).Id}\""; + long id = ((DomainBase)SelectedRecibo).Id; + TipoTela? tela = (TipoTela)42; + object[] obj = new object[9] + { + SelectedRecibo.Tipo.HasValue ? (ValidationHelper.GetDescription((Enum)(object)SelectedRecibo.Tipo.Value) ?? "") : "-", + null, + null, + null, + null, + null, + null, + null, + null + }; + TipoPagamento? pagamento = SelectedRecibo.Pagamento; + obj[1] = (pagamento.HasValue ? ValidationHelper.GetDescription((Enum)(object)pagamento.GetValueOrDefault()) : null); + obj[2] = SelectedRecibo.Valor; + obj[3] = SelectedRecibo.DataRecibo; + obj[4] = SelectedRecibo.Pagante; + obj[5] = SelectedRecibo.DocumentoPagante; + obj[6] = SelectedRecibo.Recebedor; + obj[7] = SelectedRecibo.DocumentoRecebedor; + obj[8] = SelectedRecibo.Referente; + reciboViewModel.RegistrarAcao(descricao, id, tela, string.Format("TIPO: {0}\nPAGAMENTO: {1}\nVALOR: {2:c}\nDATA RECIBO: {3:G}\nPAGANTE: {4}, {5}\nRECEBEDOR: {6}, {7}\nREFERENTE: \"{8}\"", obj)); + await SelecionaRecibo(); + Loading(isLoading: false); + ToggleSnackBar("RECIBO EXCLUÍDO COM SUCESSO"); + } + } + + public void CancelarAlteracao() + { + if (CancelRecibo != null && Recibos.Any((Recibo x) => ((DomainBase)x).Id == ((DomainBase)CancelRecibo).Id)) + { + DomainBase.Copy(Recibos.First((Recibo x) => ((DomainBase)x).Id == ((DomainBase)CancelRecibo).Id), CancelRecibo); + if (RecibosFiltrados.Count > 0 && RecibosFiltrados.Any((Recibo x) => ((DomainBase)x).Id == ((DomainBase)CancelRecibo).Id)) + { + DomainBase.Copy(RecibosFiltrados.First((Recibo x) => ((DomainBase)x).Id == ((DomainBase)CancelRecibo).Id), CancelRecibo); + } + else + { + RecibosFiltrados.Add(CancelRecibo); + } + RecibosFiltrados = new ObservableCollection(RecibosFiltrados); + SelectedRecibo = RecibosFiltrados.First((Recibo x) => ((DomainBase)x).Id == ((DomainBase)CancelRecibo).Id); + } + else + { + Incluir(); + } + Alterar(alterar: false); + } + + private bool IsImage(string extensao) + { + if (extensao == null) + { + return false; + } + if (extensao.ToLower().Contains("jpg")) + { + return true; + } + if (extensao.ToLower().Contains("jpeg")) + { + return true; + } + if (extensao.ToLower().Contains("png")) + { + return true; + } + return false; + } + + public async void Print() + { + Recibo selectedRecibo = SelectedRecibo; + if (((selectedRecibo != null) ? selectedRecibo.Referente : null) == null || SelectedRecibo.Recebedor == null) + { + return; + } + ArquivoDigital arquivo = null; + List list = await ArquivoDigitalServico.BuscarPorTipo((TipoArquivoDigital)13, ((DomainBase)Recursos.Empresa).Id); + if (list != null && list.Any((IndiceArquivoDigital x) => x.Descricao == "LOGO")) + { + IndiceArquivoDigital? obj = ((IEnumerable)list).FirstOrDefault((Func)((IndiceArquivoDigital x) => x.Descricao == "LOGO")); + long? num = ((obj != null) ? new long?(obj.IdArquivoDigital) : null); + IndiceArquivoDigital? obj2 = ((IEnumerable)list).FirstOrDefault((Func)((IndiceArquivoDigital x) => x.Descricao == "LOGO")); + string banco = ((obj2 != null) ? obj2.Bd : null); + if (num.HasValue) + { + arquivo = await ArquivoDigitalServico.BuscarPorId(num.Value, banco); + } + } + ArquivoDigital obj3 = arquivo; + byte[] array = ((obj3 != null) ? obj3.Arquivo : null); + string image = ""; + if (array != null && array.Length != 0) + { + ReciboViewModel reciboViewModel = this; + ArquivoDigital obj4 = arquivo; + if (reciboViewModel.IsImage((obj4 != null) ? obj4.Extensao : null)) + { + ArquivoDigital obj5 = arquivo; + image = GetImage(array, (obj5 != null) ? obj5.Extensao : null); + } + } + string longDatePattern = new CultureInfo("pt-PT", useUserOverride: false).DateTimeFormat.LongDatePattern; + string data = SelectedRecibo.DataRecibo?.ToString(longDatePattern, new CultureInfo("pt-PT")); + int vias = ((!(await ShowMessage("DESEJA IMPRIMIR DUAS VIAS DO RECIBO?", "SIM", "NÃO"))) ? 1 : 2); + bool flag = !string.IsNullOrEmpty(image); + if (flag) + { + flag = await ShowMessage("DESEJA IMPRIMIR O LOGO DA CORRETORA NO RECIBO?\nPARA ADICIONAR UM LOGO, É NECESSÁRIO COLOCÁ-LO NO ARQUIVO\nDIGITAL NA TELA DE EMPRESA E FILIAIS COM DESCRIÇÃO \"LOGO\"", "SIM", "NÃO"); + } + bool flag2 = flag; + string text = "RECIBO"; + for (int i = 0; i < vias; i++) + { + if (flag2) + { + text = text + "
" + image + "
"; + text += "
"; + } + else + { + text += "
"; + } + text += $"
N° {((DomainBase)SelectedRecibo).Id}

"; + text += "R E C I B O

"; + if ((int)SelectedRecibo.Tipo.GetValueOrDefault() == 1) + { + string text2 = ((SelectedRecibo.DocumentoRecebedor == null || SelectedRecibo.DocumentoRecebedor.Clear().Length < 12) ? "EU" : "A"); + string text3 = ((SelectedRecibo.DocumentoRecebedor == null || SelectedRecibo.DocumentoRecebedor.Clear().Length < 12) ? "CPF" : "CNPJ"); + string text4 = ((text2 == "EU") ? "O" : "A"); + string text5 = ((text2 == "EU") ? "RECEBI" : "RECEBEU"); + text += $"PELO PRESENTE, {text2}, {SelectedRecibo.Recebedor}, INSCRIT{text4} NO {text3} SOB Nº {SelectedRecibo.DocumentoRecebedor}, DECLAR{text4} QUE {text5}, NA DATA DE HOJE, {SelectedRecibo.DataRecibo:dd/MM/yyyy HH:mm}, O VALOR DE R$ {SelectedRecibo.Valor:0.00} POR MEIO DE {ValidationHelper.GetDescription((Enum)(object)SelectedRecibo.Pagamento)}, DE {SelectedRecibo.Pagante}, INSCRITO NO CPF/CNPJ SOB Nº {SelectedRecibo.DocumentoPagante}, REFERENTE À(AO) {SelectedRecibo.Referente.ToUpper()}. DANDO-LHE POR ESTE RECIBO A DEVIDA QUITAÇÃO.
"; + text = text + "" + ((EnderecoBase)Recursos.Empresa).Cidade + ", " + data?.ToUpper() + ".

"; + text = text + "_________________________________
ASSINATURA " + SelectedRecibo.Recebedor + "
" + SelectedRecibo.DocumentoRecebedor; + } + else + { + string text6 = ((SelectedRecibo.DocumentoPagante == null || SelectedRecibo.DocumentoPagante.Clear().Length < 12) ? "EU" : "A"); + string text7 = ((SelectedRecibo.DocumentoPagante == null || SelectedRecibo.DocumentoPagante.Clear().Length < 12) ? "CPF" : "CNPJ"); + string text8 = ((text6 == "EU") ? "O" : "A"); + string text9 = ((text6 == "EU") ? "PAGUEI" : "PAGOU"); + text += $"PELO PRESENTE, {text6}, {SelectedRecibo.Pagante}, INSCRIT{text8} NO {text7} SOB Nº {SelectedRecibo.DocumentoPagante}, DECLAR{text8} QUE {text9}, NA DATA DE HOJE, {SelectedRecibo.DataRecibo:dd/MM/yyyy HH:mm}, O VALOR DE R$ {SelectedRecibo.Valor:0.00} POR MEIO DE {ValidationHelper.GetDescription((Enum)(object)SelectedRecibo.Pagamento)}, PARA {SelectedRecibo.Recebedor}, INSCRITO NO CPF/CNPJ SOB Nº {SelectedRecibo.DocumentoRecebedor}, REFERENTE À(AO) {SelectedRecibo.Referente.ToUpper()}. DANDO-LHE POR ESTE RECIBO A DEVIDA QUITAÇÃO.
"; + text = text + "
" + ((EnderecoBase)Recursos.Empresa).Cidade + ", " + data?.ToUpper() + ".

"; + text = text + "_________________________________
ASSINATURA " + SelectedRecibo.Recebedor + "
" + SelectedRecibo.DocumentoRecebedor; + } + text += "
"; + } + text += " "; + string tempPath = Path.GetTempPath(); + string text10 = $"{tempPath}_{Funcoes.GetNetworkTime():ddMMyyyyhhmmss}.html"; + StreamWriter streamWriter = new StreamWriter(text10, append: true, Encoding.UTF8); + streamWriter.Write(text); + streamWriter.Close(); + Process.Start(text10); + ReciboViewModel reciboViewModel2 = this; + string descricao = $"IMPRIMIU O RECIBO DE NÚMERO \"{((DomainBase)SelectedRecibo).Id}\""; + long id = ((DomainBase)SelectedRecibo).Id; + TipoTela? tela = (TipoTela)42; + object[] obj6 = new object[9] + { + SelectedRecibo.Tipo.HasValue ? (ValidationHelper.GetDescription((Enum)(object)SelectedRecibo.Tipo.Value) ?? "") : "-", + null, + null, + null, + null, + null, + null, + null, + null + }; + TipoPagamento? pagamento = SelectedRecibo.Pagamento; + obj6[1] = (pagamento.HasValue ? ValidationHelper.GetDescription((Enum)(object)pagamento.GetValueOrDefault()) : null); + obj6[2] = SelectedRecibo.Valor; + obj6[3] = SelectedRecibo.DataRecibo; + obj6[4] = SelectedRecibo.Pagante; + obj6[5] = SelectedRecibo.DocumentoPagante; + obj6[6] = SelectedRecibo.Recebedor; + obj6[7] = SelectedRecibo.DocumentoRecebedor; + obj6[8] = SelectedRecibo.Referente; + reciboViewModel2.RegistrarAcao(descricao, id, tela, string.Format("TIPO: {0}\nPAGAMENTO: {1}\nVALOR: {2:c}\nDATA RECIBO: {3:G}\nPAGANTE: {4}, {5}\nRECEBEDOR: {6}, {7}\nREFERENTE: \"{8}\"", obj6)); + } + + private static string GetImage(byte[] bytes, string extensao) + { + try + { + Image val = Image.FromStream((Stream)new MemoryStream(bytes)); + string text = (extensao.ToUpper().Contains("JPG") ? ("data:image/jpeg;base64," + Convert.ToBase64String(bytes, Base64FormattingOptions.None)) : ("data:image/png;base64," + Convert.ToBase64String(bytes, Base64FormattingOptions.None))); + return ""; + } + catch (Exception) + { + return ""; + } + } + + private void WorkOnSelectedRecibo(Recibo value, bool registrar = true) + { + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_0069: Unknown result type (might be due to invalid IL or missing references) + //IL_0070: Invalid comparison between Unknown and I4 + //IL_01ad: Unknown result type (might be due to invalid IL or missing references) + //IL_00de: Unknown result type (might be due to invalid IL or missing references) + //IL_0113: Unknown result type (might be due to invalid IL or missing references) + CancelRecibo = (Recibo)((value == null || ((DomainBase)value).Id == 0L) ? ((object)CancelRecibo) : ((object)(Recibo)((DomainBase)value).Clone())); + if (value == null || ((DomainBase)value).Id == 0L || (LastAccessId == ((DomainBase)value).Id && (int)LastAccessTela == 42)) + { + return; + } + if (registrar) + { + string descricao = $"ACESSOU RECIBO DE NÚMERO \"{((DomainBase)value).Id}\""; + long id = ((DomainBase)value).Id; + TipoTela? tela = (TipoTela)42; + object[] obj = new object[9] + { + value.Tipo.HasValue ? (ValidationHelper.GetDescription((Enum)(object)value.Tipo.Value) ?? "") : "-", + null, + null, + null, + null, + null, + null, + null, + null + }; + TipoPagamento? pagamento = value.Pagamento; + obj[1] = (pagamento.HasValue ? ValidationHelper.GetDescription((Enum)(object)pagamento.GetValueOrDefault()) : null); + obj[2] = value.Valor; + obj[3] = value.DataRecibo; + obj[4] = value.Pagante; + obj[5] = value.DocumentoPagante; + obj[6] = value.Recebedor; + obj[7] = value.DocumentoRecebedor; + obj[8] = value.Referente; + RegistrarAcao(descricao, id, tela, string.Format("TIPO: {0}\nPAGAMENTO: {1}\nVALOR: {2:c}\nDATA RECIBO: {3:G}\nPAGANTE: {4}, {5}\nRECEBEDOR: {6}, {7}\nREFERENTE: \"{8}\"", obj)); + } + LastAccessId = ((DomainBase)value).Id; + LastAccessTela = (TipoTela)42; + Recibo selectedRecibo = SelectedRecibo; + if (((selectedRecibo != null) ? new long?(((DomainBase)selectedRecibo).Id) : null) != ((DomainBase)value).Id) + { + SelectedRecibo = ((IEnumerable)RecibosFiltrados).FirstOrDefault((Func)((Recibo x) => ((DomainBase)x).Id == ((DomainBase)value).Id)); + } + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Ferramentas/SeguradoraViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Ferramentas/SeguradoraViewModel.cs new file mode 100644 index 0000000..bae9af6 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Ferramentas/SeguradoraViewModel.cs @@ -0,0 +1,535 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Ferramentas; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Ferramentas; + +public class SeguradoraViewModel : BaseSegurosViewModel +{ + private readonly SeguradoraServico _servico; + + private bool _apelido; + + private Seguradora _selectedSeguradora; + + private SeguradoraEndereco _selectedEndereco = new SeguradoraEndereco(); + + private ObservableCollection _contatos = new ObservableCollection(); + + private ObservableCollection _enderecos = new ObservableCollection(); + + private SeguradoraContato _selectedTelefone = new SeguradoraContato(); + + private Visibility _tipoTelefone; + + private Visibility _telefone; + + private Visibility _prefixo; + + private ObservableCollection _configFiltrados = new ObservableCollection(); + + public Seguradora CancelSeguradora; + + public ObservableCollection CancelEnderecos; + + public ObservableCollection CancelContatos; + + private ObservableCollection _seguradorasFiltradas = new ObservableCollection(); + + private bool _isExpanded; + + public bool Apelido + { + get + { + return _apelido; + } + set + { + _apelido = value; + OnPropertyChanged("Apelido"); + } + } + + public Seguradora SelectedSeguradora + { + get + { + return _selectedSeguradora; + } + set + { + _selectedSeguradora = value; + WorkOnSelectedSeguradora(value); + VerificarEnables((value != null) ? new long?(((DomainBase)value).Id) : null); + OnPropertyChanged("SelectedSeguradora"); + } + } + + public SeguradoraEndereco SelectedEndereco + { + get + { + return _selectedEndereco; + } + set + { + _selectedEndereco = value; + OnPropertyChanged("SelectedEndereco"); + } + } + + public ObservableCollection Contatos + { + get + { + return _contatos; + } + set + { + _contatos = value; + OnPropertyChanged("Contatos"); + } + } + + public ObservableCollection Enderecos + { + get + { + return _enderecos; + } + set + { + _enderecos = value; + OnPropertyChanged("Enderecos"); + } + } + + public SeguradoraContato SelectedTelefone + { + get + { + return _selectedTelefone; + } + set + { + _selectedTelefone = value; + OnPropertyChanged("SelectedTelefone"); + } + } + + public Visibility TipoTelefoneVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _tipoTelefone; + } + set + { + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_000c: Invalid comparison between Unknown and I4 + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_0010: Unknown result type (might be due to invalid IL or missing references) + if ((int)SelectedTelefone.TipoContato == 2) + { + _tipoTelefone = (Visibility)2; + } + else + { + _tipoTelefone = (Visibility)0; + } + OnPropertyChanged("TipoTelefoneVisibility"); + } + } + + public Visibility TelefoneVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _telefone; + } + set + { + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_000c: Invalid comparison between Unknown and I4 + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_0010: Unknown result type (might be due to invalid IL or missing references) + if ((int)SelectedTelefone.TipoContato == 2) + { + _telefone = (Visibility)2; + } + else + { + _telefone = (Visibility)0; + } + OnPropertyChanged("TelefoneVisibility"); + } + } + + public Visibility PrefixoVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _prefixo; + } + set + { + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_000c: Invalid comparison between Unknown and I4 + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_0010: Unknown result type (might be due to invalid IL or missing references) + if ((int)SelectedTelefone.TipoContato == 2) + { + _prefixo = (Visibility)2; + } + else + { + _prefixo = (Visibility)0; + } + OnPropertyChanged("PrefixoVisibility"); + } + } + + public ObservableCollection ConfigFiltrados + { + get + { + return _configFiltrados; + } + set + { + _configFiltrados = value; + OnPropertyChanged("ConfigFiltrados"); + } + } + + public string Pesquisa { get; set; } + + public decimal Tolerancia { get; set; } + + public ObservableCollection SeguradorasFiltradas + { + get + { + return _seguradorasFiltradas; + } + set + { + _seguradorasFiltradas = value; + IsExpanded = value != null && value.Count > 0; + OnPropertyChanged("SeguradorasFiltradas"); + } + } + + public bool IsExpanded + { + get + { + return _isExpanded; + } + set + { + _isExpanded = value; + OnPropertyChanged("IsExpanded"); + } + } + + public List Seguradoras { get; set; } + + public List Config { get; set; } + + public SeguradoraViewModel() + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_000b: Expected O, but got Unknown + //IL_0022: Unknown result type (might be due to invalid IL or missing references) + //IL_002c: Expected O, but got Unknown + _servico = new SeguradoraServico(); + Apelido = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 6); + base.EnableMenu = true; + Seleciona(); + } + + private async void Seleciona() + { + Loading(isLoading: true); + await PermissaoTela((TipoTela)13); + await SelecionaSeguradoras(); + Loading(isLoading: false); + } + + private async Task SelecionaSeguradoras(Seguradora seguradora = null) + { + Loading(isLoading: true); + List list = await new BaseServico().BuscarSeguradorasAsync(); + Seguradoras = (from x in list + orderby x.Ativo descending, x.Nome + select x).ToList(); + SeguradorasFiltradas = new ObservableCollection(Seguradoras); + if (seguradora != null) + { + SelecionaSeguradora(((IEnumerable)SeguradorasFiltradas).FirstOrDefault((Func)((Seguradora x) => ((DomainBase)x).Id == ((DomainBase)seguradora).Id))); + } + else if (SeguradorasFiltradas.Count > 0) + { + SelecionaSeguradora(SeguradorasFiltradas.First()); + } + else + { + SelectedSeguradora = new Seguradora(); + Alterar(alterar: false); + base.EnableMenu = false; + } + Recursos.Seguradoras = list; + Loading(isLoading: false); + } + + public List> Validate(List endereco) + { + List> errors = new List>(); + endereco?.ForEach(delegate(SeguradoraEndereco x) + { + errors.AddRange(x.Validate()); + }); + return errors.Distinct().ToList(); + } + + public List> Validate(List contatos) + { + List> errors = new List>(); + contatos?.ForEach(delegate(SeguradoraContato x) + { + errors.AddRange(x.Validate()); + }); + List list = contatos?.Where((SeguradoraContato x) => (int)x.TipoContato == 1).ToList(); + if (list == null) + { + return errors; + } + if (list.Count > 4) + { + errors.Add(new KeyValuePair("ASSISTÊNCIAS 24 HORAS", "NÃO É POSSÍVEL ADICIONAR MAIS QUE 4 NUMEROS DE ASSISTÊNCIA 24 HORAS")); + } + return errors.Distinct().ToList(); + } + + public void IncluirTelefone() + { + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0021: Unknown result type (might be due to invalid IL or missing references) + //IL_002c: Unknown result type (might be due to invalid IL or missing references) + //IL_0038: Unknown result type (might be due to invalid IL or missing references) + //IL_0045: Expected O, but got Unknown + if (SelectedSeguradora != null) + { + if (Contatos == null) + { + Contatos = new ObservableCollection(); + } + SeguradoraContato val = new SeguradoraContato + { + Empresa = Recursos.Empresa, + Seguradora = SelectedSeguradora, + Tipo = (TipoTelefone)2 + }; + Contatos.Add(val); + SelectedTelefone = val; + } + } + + public void ExcluirTelefone(SeguradoraContato contato) + { + Contatos.Remove(contato); + } + + public void IncluirEndereco() + { + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0021: Unknown result type (might be due to invalid IL or missing references) + //IL_002c: Unknown result type (might be due to invalid IL or missing references) + //IL_0038: Unknown result type (might be due to invalid IL or missing references) + //IL_0040: Expected O, but got Unknown + if (SelectedSeguradora != null) + { + if (Enderecos == null) + { + Enderecos = new ObservableCollection(); + } + SeguradoraEndereco val = new SeguradoraEndereco + { + Empresa = Recursos.Empresa, + Seguradora = SelectedSeguradora, + Tipo = (TipoEndereco)4 + }; + Enderecos.Add(val); + SelectedEndereco = val; + } + } + + public void ExcluirEndereco(SeguradoraEndereco endereco) + { + Enderecos.Remove(endereco); + } + + public async Task>> Salvar() + { + List> list = SelectedSeguradora.Validate(); + list.AddRange(Validate(Contatos.ToList())); + list.AddRange(Validate(Enderecos.ToList())); + if (list.Count > 0) + { + return list; + } + SelectedSeguradora.Contatos = Contatos.Where((SeguradoraContato x) => !string.IsNullOrEmpty(x.NomeContato) || (int)x.TipoContato == 1).ToList(); + SelectedSeguradora.Enderecos = Enderecos.Where((SeguradoraEndereco x) => !string.IsNullOrEmpty(((EnderecoBase)x).Bairro)).ToList(); + Seguradora value = await _servico.Save(SelectedSeguradora, Config); + string text = ((((DomainBase)SelectedSeguradora).Id == 0L) ? "INCLUIU" : "ALTEROU"); + if (!_servico.Sucesso) + { + return null; + } + RegistrarAcao(text + " SEGURADORA \"" + value.Nome + "\"", ((DomainBase)value).Id, (TipoTela)13, $"SEGURADORA \"{value.Nome}\", ID: {((DomainBase)value).Id}"); + await SelecionaSeguradoras(); + FiltrarSeguradora(Pesquisa); + SelectedSeguradora = ((IEnumerable)SeguradorasFiltradas).FirstOrDefault((Func)((Seguradora x) => ((DomainBase)x).Id == ((DomainBase)value).Id)) ?? SeguradorasFiltradas.FirstOrDefault(); + Alterar(alterar: false); + ToggleSnackBar("SEGURADORA SALVA COM SUCESSO"); + return null; + } + + private void WorkOnSelectedSeguradora(Seguradora value, bool registrar = true) + { + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_008b: Unknown result type (might be due to invalid IL or missing references) + //IL_0092: Invalid comparison between Unknown and I4 + //IL_014c: Unknown result type (might be due to invalid IL or missing references) + CancelSeguradora = (Seguradora)((value == null || ((DomainBase)value).Id == 0L) ? ((object)CancelSeguradora) : ((object)(Seguradora)((DomainBase)value).Clone())); + CancelEnderecos = new ObservableCollection(Enderecos); + CancelContatos = new ObservableCollection(Contatos); + if (value == null || ((DomainBase)value).Id == 0L || (LastAccessId == ((DomainBase)value).Id && (int)LastAccessTela == 13)) + { + return; + } + Seguradora selectedSeguradora = SelectedSeguradora; + if (((selectedSeguradora != null) ? selectedSeguradora.Contatos : null) != null) + { + Contatos = new ObservableCollection(SelectedSeguradora.Contatos); + } + Seguradora selectedSeguradora2 = SelectedSeguradora; + if (((selectedSeguradora2 != null) ? selectedSeguradora2.Enderecos : null) != null) + { + Enderecos = new ObservableCollection(SelectedSeguradora.Enderecos); + } + if (registrar) + { + RegistrarAcao("ACESSOU SEGURADORA \"" + value.Nome + "\"", ((DomainBase)value).Id, (TipoTela)13, $"ID SEGURADORA: {((DomainBase)value).Id}"); + } + LastAccessId = ((DomainBase)value).Id; + LastAccessTela = (TipoTela)13; + Seguradora selectedSeguradora3 = SelectedSeguradora; + if (((selectedSeguradora3 != null) ? new long?(((DomainBase)selectedSeguradora3).Id) : null) != ((DomainBase)value).Id) + { + SelectedSeguradora = ((IEnumerable)SeguradorasFiltradas).FirstOrDefault((Func)((Seguradora x) => ((DomainBase)x).Id == ((DomainBase)value).Id)); + } + Seguradora selectedSeguradora4 = SelectedSeguradora; + Tolerancia = ((selectedSeguradora4 != null) ? selectedSeguradora4.Tolerancia : null).GetValueOrDefault(); + } + + public void CancelarAlteracao() + { + if (CancelSeguradora != null && Seguradoras.Any((Seguradora x) => ((DomainBase)x).Id == ((DomainBase)CancelSeguradora).Id)) + { + DomainBase.Copy(Seguradoras.First((Seguradora x) => ((DomainBase)x).Id == ((DomainBase)CancelSeguradora).Id), CancelSeguradora); + if (SeguradorasFiltradas.Count > 0 && SeguradorasFiltradas.Any((Seguradora x) => ((DomainBase)x).Id == ((DomainBase)CancelSeguradora).Id)) + { + DomainBase.Copy(SeguradorasFiltradas.First((Seguradora x) => ((DomainBase)x).Id == ((DomainBase)CancelSeguradora).Id), CancelSeguradora); + } + else + { + SeguradorasFiltradas.Add(CancelSeguradora); + } + SeguradorasFiltradas = new ObservableCollection(SeguradorasFiltradas); + ConfigFiltrados = new ObservableCollection(ConfigFiltrados); + SelectedSeguradora = SeguradorasFiltradas.First((Seguradora x) => ((DomainBase)x).Id == ((DomainBase)CancelSeguradora).Id); + Enderecos = CancelEnderecos; + Contatos = CancelContatos; + } + Alterar(alterar: false); + } + + internal async Task> Filtrar(string value) + { + return await Task.Run(() => FiltrarSeguradora(value)); + } + + public List FiltrarSeguradora(string filter) + { + Pesquisa = filter; + SeguradorasFiltradas = (string.IsNullOrWhiteSpace(filter) ? new ObservableCollection(Seguradoras) : new ObservableCollection(from x in Seguradoras + where ValidationHelper.RemoveDiacritics(x.Nome.Trim()).ToUpper().Contains(ValidationHelper.RemoveDiacritics(filter)) || ValidationHelper.RemoveDiacritics(x.NomeSocial).ToUpper().Contains(ValidationHelper.RemoveDiacritics(filter)) + orderby x.Ativo descending, x.Nome + select x)); + return SeguradorasFiltradas.ToList(); + } + + internal async Task> FiltrarConfig(string value) + { + return await Task.Run(() => FiltrarDescricao(value)); + } + + public List FiltrarDescricao(string filter) + { + ConfigFiltrados = (string.IsNullOrWhiteSpace(filter) ? new ObservableCollection(Config) : new ObservableCollection(from x in Config + where ValidationHelper.RemoveDiacritics(x.Descricao.Trim()).ToUpper().Contains(ValidationHelper.RemoveDiacritics(filter)) + orderby x.Descricao + select x)); + return ConfigFiltrados.ToList(); + } + + public async void SelecionaSeguradora(Seguradora seguradora) + { + Loading(isLoading: true); + SelectedSeguradora = seguradora; + Contatos = await _servico.BuscarContatos(((DomainBase)SelectedSeguradora).Id); + Enderecos = await _servico.BuscarEnderecos(((DomainBase)SelectedSeguradora).Id); + Config = await _servico.BuscarConfig(((DomainBase)SelectedSeguradora).Id); + ConfigFiltrados = new ObservableCollection(Config); + Loading(isLoading: false); + } + + public void Clonar() + { + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_0016: Expected O, but got Unknown + CancelSeguradora = (Seguradora)((DomainBase)SelectedSeguradora).Clone(); + CancelEnderecos = new ObservableCollection(Enderecos); + CancelContatos = new ObservableCollection(Contatos); + } + + public async void Incluir(Seguradora seguradora) + { + seguradora.Tolerancia = 2; + seguradora.ToleranciaPremio = 2; + seguradora.Ativo = true; + await _servico.Insert(seguradora); + if (_servico.Sucesso) + { + await SelecionaSeguradoras(seguradora); + } + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Ferramentas/SocioViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Ferramentas/SocioViewModel.cs new file mode 100644 index 0000000..4e3466e --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Ferramentas/SocioViewModel.cs @@ -0,0 +1,301 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using Gestor.Application.Servicos.Ferramentas; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; + +namespace Gestor.Application.ViewModels.Ferramentas; + +public class SocioViewModel : BaseSegurosViewModel +{ + private readonly SocioServico _servico; + + public Socio CancelSocio; + + private ObservableCollection _empresas = new ObservableCollection(); + + private Empresa _selectedEmpresa; + + private Socio _selectedSocio = new Socio(); + + private ObservableCollection _sociosFiltradas = new ObservableCollection(); + + private bool _isExpanded; + + private bool _isLoading; + + public ObservableCollection Empresas + { + get + { + return _empresas; + } + set + { + _empresas = value; + OnPropertyChanged("Empresas"); + } + } + + public Empresa SelectedEmpresa + { + get + { + return _selectedEmpresa; + } + set + { + _selectedEmpresa = value; + WorkOnSelectedEmpresa(value); + OnPropertyChanged("SelectedEmpresa"); + } + } + + public Socio SelectedSocio + { + get + { + return _selectedSocio; + } + set + { + _selectedSocio = value; + WorkOnSelectedSocio(value); + VerificarEnables((value != null) ? new long?(((DomainBase)value).Id) : null); + OnPropertyChanged("SelectedSocio"); + } + } + + public ObservableCollection SociosFiltradas + { + get + { + return _sociosFiltradas; + } + set + { + _sociosFiltradas = value; + IsExpanded = value != null && value.Count > 0; + OnPropertyChanged("SociosFiltradas"); + } + } + + public bool IsExpanded + { + get + { + return _isExpanded; + } + set + { + _isExpanded = value; + OnPropertyChanged("IsExpanded"); + } + } + + public List Socios { get; set; } + + public bool IsLoading + { + get + { + return _isLoading; + } + set + { + _isLoading = value; + OnPropertyChanged("IsLoading"); + } + } + + public SocioViewModel() + { + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_0016: Expected O, but got Unknown + _servico = new SocioServico(); + base.EnableMenu = true; + Seleciona(); + } + + private async void Seleciona() + { + Loading(isLoading: true); + await PermissaoTela((TipoTela)19); + Empresas = new ObservableCollection(await new EmpresaServico().BuscarEmpresas()); + Loading(isLoading: false); + SelectedEmpresa = Empresas.FirstOrDefault(); + } + + private async Task SelecionaSocios(long? id) + { + Socios = null; + SociosFiltradas = null; + if (id.HasValue && id != 0) + { + Loading(isLoading: true); + Socios = (await new BaseServico().BuscarSociosAsync(id.Value)).OrderBy((Socio x) => x.Nome).ToList(); + SociosFiltradas = new ObservableCollection(Socios); + SelectedSocio = SociosFiltradas.FirstOrDefault(); + Loading(isLoading: false); + } + } + + private async void WorkOnSelectedEmpresa(Empresa value) + { + if (value != null && ((DomainBase)value).Id != 0L) + { + await SelecionaSocios(((DomainBase)value).Id); + } + } + + internal async Task> Filtrar(string value) + { + return await Task.Run(() => FiltrarSocio(value)); + } + + public List FiltrarSocio(string filter) + { + SociosFiltradas = (string.IsNullOrWhiteSpace(filter) ? new ObservableCollection(Socios) : new ObservableCollection(from x in Socios + where ValidationHelper.RemoveDiacritics(x.Nome.Trim()).ToUpper().Contains(ValidationHelper.RemoveDiacritics(filter)) + orderby x.Nome + select x)); + return SociosFiltradas.ToList(); + } + + public async Task>> Salvar() + { + List> list = SelectedSocio.Validate(); + if (list.Count > 0) + { + return list; + } + string acao = ((((DomainBase)SelectedSocio).Id == 0L) ? "INCLUIU" : "ALTEROU"); + Socio value = await _servico.Save(SelectedSocio); + if (!_servico.Sucesso) + { + return null; + } + RegistrarAcao(acao + " SÓCIO \"" + value.Nome + "\"", ((DomainBase)value).Id, (TipoTela)19, $"ID: {((DomainBase)value).Id}\nTELEFONE: ({value.Prefixo}) {value.Telefone}\nE-MAIL: {value.Email}"); + if (Socios.Any((Socio x) => ((DomainBase)x).Id == ((DomainBase)value).Id)) + { + DomainBase.Copy(Socios.First((Socio x) => ((DomainBase)x).Id == ((DomainBase)value).Id), value); + } + else + { + Socios.Add(value); + } + if (SociosFiltradas.Any((Socio x) => ((DomainBase)x).Id == ((DomainBase)value).Id)) + { + DomainBase.Copy(SociosFiltradas.First((Socio x) => ((DomainBase)x).Id == ((DomainBase)value).Id), value); + } + else + { + SociosFiltradas.Add(value); + } + SociosFiltradas = new ObservableCollection(SociosFiltradas); + WorkOnSelectedSocio(value, registrar: false); + Alterar(alterar: false); + ToggleSnackBar("SÓCIO SALVO COM SUCESSO"); + return null; + } + + public void CancelarAlteracao() + { + if (CancelSocio != null && Socios.Any((Socio x) => ((DomainBase)x).Id == ((DomainBase)CancelSocio).Id)) + { + DomainBase.Copy(Socios.First((Socio x) => ((DomainBase)x).Id == ((DomainBase)CancelSocio).Id), CancelSocio); + if (SociosFiltradas.Count > 0 && SociosFiltradas.Any((Socio x) => ((DomainBase)x).Id == ((DomainBase)CancelSocio).Id)) + { + DomainBase.Copy(SociosFiltradas.First((Socio x) => ((DomainBase)x).Id == ((DomainBase)CancelSocio).Id), CancelSocio); + } + else + { + SociosFiltradas.Add(CancelSocio); + } + SociosFiltradas = new ObservableCollection(SociosFiltradas); + SelectedSocio = SociosFiltradas.First((Socio x) => ((DomainBase)x).Id == ((DomainBase)CancelSocio).Id); + } + else + { + Incluir(); + } + Alterar(alterar: false); + } + + public void Incluir() + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Expected O, but got Unknown + Socio selectedSocio = new Socio + { + IdEmpresa = ((DomainBase)SelectedEmpresa).Id + }; + SelectedSocio = selectedSocio; + Alterar(alterar: true); + } + + public async void Excluir() + { + if (SelectedSocio == null || ((DomainBase)SelectedSocio).Id == 0L || !(await ShowMessage("DESEJA EXCLUIR?", "SIM", "NÃO"))) + { + return; + } + Loading(isLoading: true); + IsLoading = true; + if (!(await _servico.Delete(SelectedSocio))) + { + Loading(isLoading: false); + IsLoading = false; + return; + } + RegistrarAcao("EXCLUIU SÓCIO \"" + SelectedSocio.Nome + "\"", ((DomainBase)SelectedSocio).Id, (TipoTela)19, $"ID: {((DomainBase)SelectedSocio).Id}\nTELEFONE: ({SelectedSocio.Prefixo}) {SelectedSocio.Telefone}\nE-MAIL: {SelectedSocio.Email}"); + int num = SociosFiltradas.IndexOf(SelectedSocio); + Socios.Remove(SelectedSocio); + SociosFiltradas.Remove(SelectedSocio); + SociosFiltradas = new ObservableCollection(SociosFiltradas); + if (SociosFiltradas.Count > 0) + { + SelectedSocio = ((num < SociosFiltradas.Count) ? SociosFiltradas.ElementAt(num) : SociosFiltradas.Last()); + } + else + { + SelectedSocio = new Socio(); + Alterar(alterar: false); + } + Loading(isLoading: false); + IsLoading = false; + ToggleSnackBar("SÓCIO EXCLUÍDO COM SUCESSO"); + } + + private void WorkOnSelectedSocio(Socio value, bool registrar = true) + { + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_0069: Unknown result type (might be due to invalid IL or missing references) + //IL_0070: Invalid comparison between Unknown and I4 + //IL_0109: Unknown result type (might be due to invalid IL or missing references) + CancelSocio = (Socio)((value == null || ((DomainBase)value).Id == 0L) ? ((object)CancelSocio) : ((object)(Socio)((DomainBase)value).Clone())); + if (value == null || ((DomainBase)value).Id == 0L || (LastAccessId == ((DomainBase)value).Id && (int)LastAccessTela == 19)) + { + return; + } + if (registrar) + { + RegistrarAcao("ACESSOU SÓCIO \"" + value.Nome + "\"", ((DomainBase)value).Id, (TipoTela)19, $"ID: {((DomainBase)value).Id}\nTELEFONE: ({value.Prefixo}) {value.Telefone}\nE-MAIL: {value.Email}"); + } + LastAccessId = ((DomainBase)value).Id; + LastAccessTela = (TipoTela)19; + Socio selectedSocio = SelectedSocio; + if (((selectedSocio != null) ? new long?(((DomainBase)selectedSocio).Id) : null) != ((DomainBase)value).Id) + { + SelectedSocio = ((IEnumerable)SociosFiltradas).FirstOrDefault((Func)((Socio x) => ((DomainBase)x).Id == ((DomainBase)value).Id)); + } + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Ferramentas/StatusProspeccaoViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Ferramentas/StatusProspeccaoViewModel.cs new file mode 100644 index 0000000..5397aca --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Ferramentas/StatusProspeccaoViewModel.cs @@ -0,0 +1,263 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.Servicos.Ferramentas; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; + +namespace Gestor.Application.ViewModels.Ferramentas; + +public class StatusProspeccaoViewModel : BaseSegurosViewModel +{ + private readonly StatusProspeccaoServico _servico; + + private readonly ProspeccaoServico _servicoProspeccao; + + public StatusDeProspeccao CancelStatusProspeccao; + + private ObservableCollection _statusProspeccaoFiltrados = new ObservableCollection(); + + private bool _isExpanded; + + private StatusDeProspeccao _selectedStatusProspeccao; + + public List StatusProspeccao { get; set; } + + public ObservableCollection StatusProspeccaoFiltrados + { + get + { + return _statusProspeccaoFiltrados; + } + set + { + _statusProspeccaoFiltrados = value; + IsExpanded = value != null && value.Count > 0; + OnPropertyChanged("StatusProspeccaoFiltrados"); + } + } + + public bool IsExpanded + { + get + { + return _isExpanded; + } + set + { + _isExpanded = value; + OnPropertyChanged("IsExpanded"); + } + } + + public StatusDeProspeccao SelectedStatusProspeccao + { + get + { + return _selectedStatusProspeccao; + } + set + { + _selectedStatusProspeccao = value; + WorkOnSelectedStatusProspeccao(value); + VerificarEnables((value != null) ? new long?(((DomainBase)value).Id) : null); + OnPropertyChanged("SelectedStatusProspeccao"); + } + } + + public StatusProspeccaoViewModel() + { + _servico = new StatusProspeccaoServico(); + _servicoProspeccao = new ProspeccaoServico(); + base.EnableMenu = true; + Seleciona(); + } + + private async void Seleciona() + { + Loading(isLoading: true); + await PermissaoTela((TipoTela)57); + await SelecionaStatusProspeccao(); + Loading(isLoading: false); + } + + private async Task SelecionaStatusProspeccao() + { + Loading(isLoading: true); + StatusProspeccao = (from x in await _servico.BuscarProspeccoes() + where !x.Excluido + orderby x.Ativo descending, x.Nome + select x).ToList(); + StatusProspeccaoFiltrados = new ObservableCollection(StatusProspeccao); + SelectedStatusProspeccao = StatusProspeccaoFiltrados.FirstOrDefault(); + Loading(isLoading: false); + } + + public async Task> Filtrar(string value) + { + return await Task.Run(() => FiltrarStatusProspeccao(value)); + } + + public List FiltrarStatusProspeccao(string filter) + { + StatusProspeccaoFiltrados = (string.IsNullOrWhiteSpace(filter) ? new ObservableCollection(StatusProspeccao) : new ObservableCollection(from x in StatusProspeccao + where ValidationHelper.RemoveDiacritics(x.Nome.Trim()).ToUpper().Contains(ValidationHelper.RemoveDiacritics(filter)) + orderby x.Ativo descending, x.Nome + select x)); + SelectedStatusProspeccao = StatusProspeccaoFiltrados.FirstOrDefault(); + return StatusProspeccaoFiltrados.ToList(); + } + + public void Incluir() + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0019: Expected O, but got Unknown + SelectedStatusProspeccao = new StatusDeProspeccao + { + Ativo = true, + Excluido = false + }; + Alterar(alterar: true); + } + + public async Task>> Salvar() + { + List> list = SelectedStatusProspeccao.Validate(); + list.AddRange(Validate()); + if (list.Count > 0) + { + return list; + } + string acao = ((((DomainBase)SelectedStatusProspeccao).Id == 0L) ? "INCLUIU" : "ALTEROU"); + StatusDeProspeccao value = await _servico.Save(SelectedStatusProspeccao); + if (!_servico.Sucesso) + { + return null; + } + RegistrarAcao(acao + " STATUS DE PROSPECÇÃO \"" + value.Nome + "\"", ((DomainBase)value).Id, (TipoTela)57, string.Format("ID: {0}\nATIVO: {1}\nDESCRIÇÃO: \"{2}\"", ((DomainBase)value).Id, value.Ativo ? "SIM" : "NÃO", value.Descricao)); + if (StatusProspeccao.Any((StatusDeProspeccao x) => ((DomainBase)x).Id == ((DomainBase)value).Id)) + { + DomainBase.Copy(StatusProspeccao.First((StatusDeProspeccao x) => ((DomainBase)x).Id == ((DomainBase)value).Id), value); + } + else + { + StatusProspeccao.Add(value); + } + if (StatusProspeccaoFiltrados.Any((StatusDeProspeccao x) => ((DomainBase)x).Id == ((DomainBase)value).Id)) + { + DomainBase.Copy(StatusProspeccaoFiltrados.First((StatusDeProspeccao x) => ((DomainBase)x).Id == ((DomainBase)value).Id), value); + } + else + { + StatusProspeccaoFiltrados.Add(value); + } + StatusProspeccaoFiltrados = new ObservableCollection(StatusProspeccaoFiltrados); + WorkOnSelectedStatusProspeccao(value, registrar: false); + Recursos.StatusProspeccao = StatusProspeccao; + Alterar(alterar: false); + ToggleSnackBar("STATUS DE PROSPECÇÃO SALVO COM SUCESSO"); + return null; + } + + public List> Validate() + { + List> list = new List>(); + if (string.IsNullOrWhiteSpace(SelectedStatusProspeccao.Nome)) + { + return list; + } + if (StatusProspeccao.Any((StatusDeProspeccao x) => x.Nome.Contains(SelectedStatusProspeccao.Nome) && ((DomainBase)x).Id != ((DomainBase)SelectedStatusProspeccao).Id)) + { + list.Add(new KeyValuePair("Nome", "UM STATUS DE PROSPECÇÃO COM O MESMO NOME JÁ EXISTE.")); + } + return list; + } + + public void CancelarAlteracao() + { + if (CancelStatusProspeccao != null && StatusProspeccao.Any((StatusDeProspeccao x) => ((DomainBase)x).Id == ((DomainBase)CancelStatusProspeccao).Id)) + { + DomainBase.Copy(StatusProspeccao.First((StatusDeProspeccao x) => ((DomainBase)x).Id == ((DomainBase)CancelStatusProspeccao).Id), CancelStatusProspeccao); + if (StatusProspeccaoFiltrados.Count > 0 && StatusProspeccaoFiltrados.Any((StatusDeProspeccao x) => ((DomainBase)x).Id == ((DomainBase)CancelStatusProspeccao).Id)) + { + DomainBase.Copy(StatusProspeccaoFiltrados.First((StatusDeProspeccao x) => ((DomainBase)x).Id == ((DomainBase)CancelStatusProspeccao).Id), CancelStatusProspeccao); + } + else + { + StatusProspeccaoFiltrados.Add(CancelStatusProspeccao); + } + StatusProspeccaoFiltrados = new ObservableCollection(StatusProspeccaoFiltrados); + SelectedStatusProspeccao = StatusProspeccaoFiltrados.First((StatusDeProspeccao x) => ((DomainBase)x).Id == ((DomainBase)CancelStatusProspeccao).Id); + } + else + { + Incluir(); + } + Alterar(alterar: false); + } + + public async void Excluir() + { + if (SelectedStatusProspeccao == null || ((DomainBase)SelectedStatusProspeccao).Id == 0L) + { + return; + } + if ((await _servicoProspeccao.BuscarProspeccoesPorStatus(SelectedStatusProspeccao)).Count > 0) + { + await ShowMessage("O STATUS " + SelectedStatusProspeccao.Nome + ", NÃO PODE SER EXCLUÍDO, POIS ESTÁ CADASTRADO EM UMA PROSPECÇÃO"); + } + else if (await ShowMessage("DESEJA REALMENTE EXCLUIR O STATUS DE PROSPECÇÃO " + SelectedStatusProspeccao.Nome + "?", "SIM", "NÃO")) + { + Loading(isLoading: true); + SelectedStatusProspeccao.Excluido = true; + SelectedStatusProspeccao.Ativo = false; + await _servico.Save(SelectedStatusProspeccao); + if (!_servico.Sucesso) + { + Loading(isLoading: false); + return; + } + RegistrarAcao("EXCLUIU STATUS DE PROSPECÇÃO \"" + SelectedStatusProspeccao.Nome + "\"", ((DomainBase)SelectedStatusProspeccao).Id, (TipoTela)57, string.Format("ID: {0}\nATIVO: {1}\nDESCRIÇÃO: \"{2}\"", ((DomainBase)SelectedStatusProspeccao).Id, SelectedStatusProspeccao.Ativo ? "SIM" : "NÃO", SelectedStatusProspeccao.Descricao)); + StatusProspeccao.Remove(SelectedStatusProspeccao); + StatusProspeccaoFiltrados.Remove(SelectedStatusProspeccao); + Recursos.StatusProspeccao.Remove(SelectedStatusProspeccao); + SelectedStatusProspeccao = StatusProspeccaoFiltrados.FirstOrDefault(); + await SelecionaStatusProspeccao(); + Loading(isLoading: false); + ToggleSnackBar("STATUS DE PROSPECÇÃO EXCLUÍDO COM SUCESSO"); + } + } + + private void WorkOnSelectedStatusProspeccao(StatusDeProspeccao value, bool registrar = true) + { + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_0069: Unknown result type (might be due to invalid IL or missing references) + //IL_0070: Invalid comparison between Unknown and I4 + //IL_00fa: Unknown result type (might be due to invalid IL or missing references) + CancelStatusProspeccao = (StatusDeProspeccao)((value == null || ((DomainBase)value).Id == 0L) ? ((object)CancelStatusProspeccao) : ((object)(StatusDeProspeccao)((DomainBase)value).Clone())); + if (value == null || ((DomainBase)value).Id == 0L || (LastAccessId == ((DomainBase)value).Id && (int)LastAccessTela == 57)) + { + return; + } + if (registrar) + { + RegistrarAcao("ACESSOU STATUS DE PROSPECÇÃO \"" + value.Nome + "\"", ((DomainBase)value).Id, (TipoTela)57, string.Format("ID: {0}\nATIVO: {1}\nDESCRIÇÃO: \"{2}\"", ((DomainBase)value).Id, value.Ativo ? "SIM" : "NÃO", value.Descricao)); + } + LastAccessId = ((DomainBase)value).Id; + LastAccessTela = (TipoTela)57; + StatusDeProspeccao selectedStatusProspeccao = SelectedStatusProspeccao; + if (((selectedStatusProspeccao != null) ? new long?(((DomainBase)selectedStatusProspeccao).Id) : null) != ((DomainBase)value).Id) + { + SelectedStatusProspeccao = ((IEnumerable)StatusProspeccaoFiltrados).FirstOrDefault((Func)((StatusDeProspeccao x) => ((DomainBase)x).Id == ((DomainBase)value).Id)); + } + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Ferramentas/StatusViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Ferramentas/StatusViewModel.cs new file mode 100644 index 0000000..2f758d1 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Ferramentas/StatusViewModel.cs @@ -0,0 +1,295 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Ferramentas; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Ferramentas; + +public class StatusViewModel : BaseSegurosViewModel +{ + private readonly StatusServico _servico; + + private Status _selectedStatus; + + public Status CancelStatus; + + private ObservableCollection _statusFiltrados = new ObservableCollection(); + + private bool _isExpanded; + + public Status SelectedStatus + { + get + { + return _selectedStatus; + } + set + { + _selectedStatus = value; + WorkOnSelectedStatus(value); + VerificarEnables((value != null) ? new long?(((DomainBase)value).Id) : null); + OnPropertyChanged("SelectedStatus"); + } + } + + public ObservableCollection StatusFiltrados + { + get + { + return _statusFiltrados; + } + set + { + _statusFiltrados = value; + IsExpanded = value != null && value.Count > 0; + OnPropertyChanged("StatusFiltrados"); + } + } + + public bool IsExpanded + { + get + { + return _isExpanded; + } + set + { + _isExpanded = value; + OnPropertyChanged("IsExpanded"); + } + } + + public List Status { get; set; } + + public StatusViewModel() + { + _servico = new StatusServico(); + base.EnableMenu = true; + Seleciona(); + } + + private async void Seleciona() + { + Loading(isLoading: true); + await PermissaoTela((TipoTela)11); + await SelecionaStatuses(); + Loading(isLoading: false); + } + + private async Task SelecionaStatuses() + { + Loading(isLoading: true); + Status = (from x in await new BaseServico().BuscarStatusAsync() + orderby x.Ativo descending, x.Nome + select x).ToList(); + StatusFiltrados = new ObservableCollection(Status); + SelectedStatus = StatusFiltrados.FirstOrDefault(); + Recursos.Status = Status; + Loading(isLoading: false); + } + + public async Task>> Validate() + { + if (string.IsNullOrWhiteSpace(SelectedStatus.Nome)) + { + return new List>(); + } + List> errors = new List>(); + bool valida = true; + List list = await new BaseServico().BuscarStatus(SelectedStatus.Nome); + if (list.Count > 0) + { + list.ForEach(delegate(Status x) + { + if (((DomainBase)x).Id != ((DomainBase)SelectedStatus).Id && x.Nome == SelectedStatus.Nome) + { + valida = false; + } + }); + } + if (!valida) + { + errors.Add(new KeyValuePair("Nome", "UM STATUS COM O MESMO NOME JÁ EXISTE.")); + } + return errors; + } + + public async Task>> Salvar() + { + List> errorMessages = SelectedStatus.Validate(); + List> list = errorMessages; + list.AddRange(await Validate()); + if (errorMessages.Count > 0) + { + return errorMessages; + } + string acao = ((((DomainBase)SelectedStatus).Id == 0L) ? "INCLUIU" : "ALTEROU"); + Status value = await _servico.Save(SelectedStatus); + if (!_servico.Sucesso) + { + return null; + } + RegistrarAcao(acao + " STATUS ID \"" + value.Nome + "\"", ((DomainBase)value).Id, (TipoTela)11, string.Format("ID: {0}\nATIVO: {1}", ((DomainBase)value).Id, value.Ativo ? "SIM" : "NÃO")); + if (Status.Any((Status x) => ((DomainBase)x).Id == ((DomainBase)value).Id)) + { + DomainBase.Copy(Status.First((Status x) => ((DomainBase)x).Id == ((DomainBase)value).Id), value); + } + else + { + Status.Add(value); + } + if (StatusFiltrados.Any((Status x) => ((DomainBase)x).Id == ((DomainBase)value).Id)) + { + DomainBase.Copy(StatusFiltrados.First((Status x) => ((DomainBase)x).Id == ((DomainBase)value).Id), value); + } + else + { + StatusFiltrados.Add(value); + } + StatusFiltrados = new ObservableCollection(StatusFiltrados); + WorkOnSelectedStatus(value, registrar: false); + Recursos.Status = Status; + Alterar(alterar: false); + ToggleSnackBar("STATUS SALVO COM SUCESSO"); + return null; + } + + public void CancelarAlteracao() + { + if (CancelStatus != null && Status.Any((Status x) => ((DomainBase)x).Id == ((DomainBase)CancelStatus).Id)) + { + DomainBase.Copy(Status.First((Status x) => ((DomainBase)x).Id == ((DomainBase)CancelStatus).Id), CancelStatus); + if (StatusFiltrados.Count > 0 && StatusFiltrados.Any((Status x) => ((DomainBase)x).Id == ((DomainBase)CancelStatus).Id)) + { + DomainBase.Copy(StatusFiltrados.First((Status x) => ((DomainBase)x).Id == ((DomainBase)CancelStatus).Id), CancelStatus); + } + else + { + StatusFiltrados.Add(CancelStatus); + } + StatusFiltrados = new ObservableCollection(StatusFiltrados); + SelectedStatus = StatusFiltrados.First((Status x) => ((DomainBase)x).Id == ((DomainBase)CancelStatus).Id); + } + else + { + Incluir(); + } + Alterar(alterar: false); + } + + public void Incluir() + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Expected O, but got Unknown + SelectedStatus = new Status + { + Ativo = true + }; + Alterar(alterar: true); + } + + internal async Task> Filtrar(string value) + { + return await Task.Run(() => FiltrarStatus(value)); + } + + public List FiltrarStatus(string filter) + { + StatusFiltrados = (string.IsNullOrWhiteSpace(filter) ? new ObservableCollection(Status) : new ObservableCollection(from x in Status + where ValidationHelper.RemoveDiacritics(x.Nome.Trim()).ToUpper().Contains(ValidationHelper.RemoveDiacritics(filter)) + orderby x.Ativo descending, x.Nome + select x)); + return StatusFiltrados.ToList(); + } + + public async void SelecionaStatus(Status status) + { + Status val = await _servico.BuscarStatusPorId(((DomainBase)status).Id); + DomainBase.Copy(StatusFiltrados.First((Status x) => ((DomainBase)x).Id == ((DomainBase)status).Id), val); + SelectedStatus = StatusFiltrados.First((Status x) => ((DomainBase)x).Id == ((DomainBase)status).Id); + } + + public async void Excluir() + { + if (SelectedStatus == null || ((DomainBase)SelectedStatus).Id == 0L) + { + return; + } + Loading(isLoading: true); + List list = await new BaseServico().BuscarDocumentosPorStatus(((DomainBase)SelectedStatus).Id); + Loading(isLoading: false); + if (list.Count > 0) + { + string text = "ESTIPULANTE NÃO PODE SER EXCLUÍDO POIS ESTÁ VINCULADO AOS SEGUINTES DOCUMENTOS:"; + foreach (Documento item in list) + { + text = ((!string.IsNullOrWhiteSpace(item.Apolice)) ? (text + $"{Environment.NewLine}DOCUMENTO {list.IndexOf(item) + 1} (NÚMERO DA PROPOSTA: {item.Proposta}, NÚMERO DA APÓLICE: {item.Apolice})") : (text + $"{Environment.NewLine}DOCUMENTO {list.IndexOf(item) + 1} (NÚMERO DA PROPOSTA: {item.Proposta})")); + } + await ShowMessage(text); + } + else + { + if (!(await ShowMessage("DESEJA EXCLUIR?", "SIM", "NÃO"))) + { + return; + } + Loading(isLoading: true); + if (!(await _servico.Delete(SelectedStatus))) + { + Loading(isLoading: false); + return; + } + RegistrarAcao("EXCLUIU STATUS \"" + SelectedStatus.Nome + "\"", ((DomainBase)SelectedStatus).Id, (TipoTela)11, string.Format("ID: {0}\nATIVO: {1}", ((DomainBase)SelectedStatus).Id, SelectedStatus.Ativo ? "SIM" : "NÃO")); + int num = StatusFiltrados.IndexOf(SelectedStatus); + Status.Remove(SelectedStatus); + StatusFiltrados.Remove(SelectedStatus); + StatusFiltrados = new ObservableCollection(StatusFiltrados); + if (StatusFiltrados.Count > 0) + { + SelectedStatus = ((num < StatusFiltrados.Count) ? StatusFiltrados.ElementAt(num) : StatusFiltrados.Last()); + } + else + { + SelectedStatus = new Status(); + Alterar(alterar: false); + base.EnableMenu = false; + } + Loading(isLoading: false); + ToggleSnackBar("ESTIPULANTE EXCLUÍDO COM SUCESSO"); + } + } + + private void WorkOnSelectedStatus(Status value, bool registrar = true) + { + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_0069: Unknown result type (might be due to invalid IL or missing references) + //IL_0070: Invalid comparison between Unknown and I4 + //IL_00ef: Unknown result type (might be due to invalid IL or missing references) + CancelStatus = (Status)((value == null || ((DomainBase)value).Id == 0L) ? ((object)CancelStatus) : ((object)(Status)((DomainBase)value).Clone())); + if (value == null || ((DomainBase)value).Id == 0L || (LastAccessId == ((DomainBase)value).Id && (int)LastAccessTela == 11)) + { + return; + } + if (registrar) + { + RegistrarAcao("ACESSOU STATUS \"" + value.Nome + "\"", ((DomainBase)value).Id, (TipoTela)11, string.Format("ID: {0}\nATIVO: {1}", ((DomainBase)value).Id, value.Ativo ? "SIM" : "NÃO")); + } + LastAccessId = ((DomainBase)value).Id; + LastAccessTela = (TipoTela)11; + Status selectedStatus = SelectedStatus; + if (((selectedStatus != null) ? new long?(((DomainBase)selectedStatus).Id) : null) != ((DomainBase)value).Id) + { + SelectedStatus = ((IEnumerable)StatusFiltrados).FirstOrDefault((Func)((Status x) => ((DomainBase)x).Id == ((DomainBase)value).Id)); + } + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Ferramentas/TipoTarefaViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Ferramentas/TipoTarefaViewModel.cs new file mode 100644 index 0000000..bf0176b --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Ferramentas/TipoTarefaViewModel.cs @@ -0,0 +1,263 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.Servicos.Ferramentas; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; + +namespace Gestor.Application.ViewModels.Ferramentas; + +public class TipoTarefaViewModel : BaseSegurosViewModel +{ + private readonly TipoTarefaServico _servico; + + private readonly TarefaServico _servicoTarefa; + + public TipoDeTarefa CancelTipoTarefa; + + private ObservableCollection _tiposTarefaFiltrados = new ObservableCollection(); + + private bool _isExpanded; + + private TipoDeTarefa _selectedTipoTarefa; + + public List TiposTarefa { get; set; } + + public ObservableCollection TiposTarefaFiltrados + { + get + { + return _tiposTarefaFiltrados; + } + set + { + _tiposTarefaFiltrados = value; + IsExpanded = value != null && value.Count > 0; + OnPropertyChanged("TiposTarefaFiltrados"); + } + } + + public bool IsExpanded + { + get + { + return _isExpanded; + } + set + { + _isExpanded = value; + OnPropertyChanged("IsExpanded"); + } + } + + public TipoDeTarefa SelectedTipoTarefa + { + get + { + return _selectedTipoTarefa; + } + set + { + _selectedTipoTarefa = value; + WorkOnSelectedTipoTarefa(value); + VerificarEnables((value != null) ? new long?(((DomainBase)value).Id) : null); + OnPropertyChanged("SelectedTipoTarefa"); + } + } + + public TipoTarefaViewModel() + { + _servico = new TipoTarefaServico(); + _servicoTarefa = new TarefaServico(); + base.EnableMenu = true; + Seleciona(); + } + + private async void Seleciona() + { + Loading(isLoading: true); + await PermissaoTela((TipoTela)52); + await SelecionaTipoTarefa(); + Loading(isLoading: false); + } + + private async Task SelecionaTipoTarefa() + { + Loading(isLoading: true); + TiposTarefa = (from x in await _servico.BuscarTarefas() + where !x.Excluido + orderby x.Ativo descending, x.Nome + select x).ToList(); + TiposTarefaFiltrados = new ObservableCollection(TiposTarefa); + SelectedTipoTarefa = TiposTarefaFiltrados.FirstOrDefault(); + Loading(isLoading: false); + } + + public async Task> Filtrar(string value) + { + return await Task.Run(() => FiltrarTipoTarefa(value)); + } + + public List FiltrarTipoTarefa(string filter) + { + TiposTarefaFiltrados = (string.IsNullOrWhiteSpace(filter) ? new ObservableCollection(TiposTarefa) : new ObservableCollection(from x in TiposTarefa + where ValidationHelper.RemoveDiacritics(x.Nome.Trim()).ToUpper().Contains(ValidationHelper.RemoveDiacritics(filter)) + orderby x.Ativo descending, x.Nome + select x)); + SelectedTipoTarefa = TiposTarefaFiltrados.FirstOrDefault(); + return TiposTarefaFiltrados.ToList(); + } + + public void Incluir() + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0019: Expected O, but got Unknown + SelectedTipoTarefa = new TipoDeTarefa + { + Ativo = true, + Excluido = false + }; + Alterar(alterar: true); + } + + public async Task>> Salvar() + { + List> list = SelectedTipoTarefa.Validate(); + list.AddRange(Validate()); + if (list.Count > 0) + { + return list; + } + string acao = ((((DomainBase)SelectedTipoTarefa).Id == 0L) ? "INCLUIU" : "ALTEROU"); + TipoDeTarefa value = await _servico.Save(SelectedTipoTarefa); + if (!_servico.Sucesso) + { + return null; + } + RegistrarAcao(acao + " TIPO DE TAREFA \"" + value.Nome + "\"", ((DomainBase)value).Id, (TipoTela)52, string.Format("ID: {0}\nATIVO: {1}\nDESCRIÇÃO: \"{2}\"", ((DomainBase)value).Id, value.Ativo ? "SIM" : "NÃO", value.Descricao)); + if (TiposTarefa.Any((TipoDeTarefa x) => ((DomainBase)x).Id == ((DomainBase)value).Id)) + { + DomainBase.Copy(TiposTarefa.First((TipoDeTarefa x) => ((DomainBase)x).Id == ((DomainBase)value).Id), value); + } + else + { + TiposTarefa.Add(value); + } + if (TiposTarefaFiltrados.Any((TipoDeTarefa x) => ((DomainBase)x).Id == ((DomainBase)value).Id)) + { + DomainBase.Copy(TiposTarefaFiltrados.First((TipoDeTarefa x) => ((DomainBase)x).Id == ((DomainBase)value).Id), value); + } + else + { + TiposTarefaFiltrados.Add(value); + } + TiposTarefaFiltrados = new ObservableCollection(TiposTarefaFiltrados); + WorkOnSelectedTipoTarefa(value, registrar: false); + Recursos.TiposTarefa = TiposTarefa; + Alterar(alterar: false); + ToggleSnackBar("TIPO DE TAREFA SALVO COM SUCESSO"); + return null; + } + + public List> Validate() + { + List> list = new List>(); + if (string.IsNullOrWhiteSpace(SelectedTipoTarefa.Nome)) + { + return list; + } + if (TiposTarefa.Any((TipoDeTarefa x) => x.Nome.Contains(SelectedTipoTarefa.Nome) && ((DomainBase)x).Id != ((DomainBase)SelectedTipoTarefa).Id)) + { + list.Add(new KeyValuePair("Nome", "UM TIPO DE TAREFA COM O MESMO NOME JÁ EXISTE.")); + } + return list; + } + + public void CancelarAlteracao() + { + if (CancelTipoTarefa != null && TiposTarefa.Any((TipoDeTarefa x) => ((DomainBase)x).Id == ((DomainBase)CancelTipoTarefa).Id)) + { + DomainBase.Copy(TiposTarefa.First((TipoDeTarefa x) => ((DomainBase)x).Id == ((DomainBase)CancelTipoTarefa).Id), CancelTipoTarefa); + if (TiposTarefaFiltrados.Count > 0 && TiposTarefaFiltrados.Any((TipoDeTarefa x) => ((DomainBase)x).Id == ((DomainBase)CancelTipoTarefa).Id)) + { + DomainBase.Copy(TiposTarefaFiltrados.First((TipoDeTarefa x) => ((DomainBase)x).Id == ((DomainBase)CancelTipoTarefa).Id), CancelTipoTarefa); + } + else + { + TiposTarefaFiltrados.Add(CancelTipoTarefa); + } + TiposTarefaFiltrados = new ObservableCollection(TiposTarefaFiltrados); + SelectedTipoTarefa = TiposTarefaFiltrados.First((TipoDeTarefa x) => ((DomainBase)x).Id == ((DomainBase)CancelTipoTarefa).Id); + } + else + { + Incluir(); + } + Alterar(alterar: false); + } + + public async void Excluir() + { + if (SelectedTipoTarefa == null || ((DomainBase)SelectedTipoTarefa).Id == 0L) + { + return; + } + if ((await _servicoTarefa.BuscarTarefasPorTipo(SelectedTipoTarefa)).Count > 0) + { + await ShowMessage("O TIPO " + SelectedTipoTarefa.Nome + ", NÃO PODE SER EXCLUÍDO, POIS ESTÁ CADASTRADO EM UMA TAREFA"); + } + else if (await ShowMessage("DESEJA REALMENTE EXCLUIR O TIPO DE TAREFA " + SelectedTipoTarefa.Nome + "?", "SIM", "NÃO")) + { + Loading(isLoading: true); + SelectedTipoTarefa.Excluido = true; + SelectedTipoTarefa.Ativo = false; + await _servico.Save(SelectedTipoTarefa); + if (!_servico.Sucesso) + { + Loading(isLoading: false); + return; + } + RegistrarAcao("EXCLUIU TIPO DE TAREFA \"" + SelectedTipoTarefa.Nome + "\"", ((DomainBase)SelectedTipoTarefa).Id, (TipoTela)52, string.Format("ID: {0}\nATIVO: {1}\nDESCRIÇÃO: \"{2}\"", ((DomainBase)SelectedTipoTarefa).Id, SelectedTipoTarefa.Ativo ? "SIM" : "NÃO", SelectedTipoTarefa.Descricao)); + TiposTarefa.Remove(SelectedTipoTarefa); + TiposTarefaFiltrados.Remove(SelectedTipoTarefa); + Recursos.TiposTarefa.Remove(SelectedTipoTarefa); + SelectedTipoTarefa = TiposTarefaFiltrados.FirstOrDefault(); + await SelecionaTipoTarefa(); + Loading(isLoading: false); + ToggleSnackBar("TIPO DE TAREFA EXCLUÍDO COM SUCESSO"); + } + } + + private void WorkOnSelectedTipoTarefa(TipoDeTarefa value, bool registrar = true) + { + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_0069: Unknown result type (might be due to invalid IL or missing references) + //IL_0070: Invalid comparison between Unknown and I4 + //IL_00fa: Unknown result type (might be due to invalid IL or missing references) + CancelTipoTarefa = (TipoDeTarefa)((value == null || ((DomainBase)value).Id == 0L) ? ((object)CancelTipoTarefa) : ((object)(TipoDeTarefa)((DomainBase)value).Clone())); + if (value == null || ((DomainBase)value).Id == 0L || (LastAccessId == ((DomainBase)value).Id && (int)LastAccessTela == 52)) + { + return; + } + if (registrar) + { + RegistrarAcao("ACESSOU TIPO DE TAREFA \"" + value.Nome + "\"", ((DomainBase)value).Id, (TipoTela)52, string.Format("ID: {0}\nATIVO: {1}\nDESCRIÇÃO: \"{2}\"", ((DomainBase)value).Id, value.Ativo ? "SIM" : "NÃO", value.Descricao)); + } + LastAccessId = ((DomainBase)value).Id; + LastAccessTela = (TipoTela)52; + TipoDeTarefa selectedTipoTarefa = SelectedTipoTarefa; + if (((selectedTipoTarefa != null) ? new long?(((DomainBase)selectedTipoTarefa).Id) : null) != ((DomainBase)value).Id) + { + SelectedTipoTarefa = ((IEnumerable)TiposTarefaFiltrados).FirstOrDefault((Func)((TipoDeTarefa x) => ((DomainBase)x).Id == ((DomainBase)value).Id)); + } + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Ferramentas/TipoVendedorViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Ferramentas/TipoVendedorViewModel.cs new file mode 100644 index 0000000..4d6b650 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Ferramentas/TipoVendedorViewModel.cs @@ -0,0 +1,294 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Ferramentas; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Ferramentas; + +public class TipoVendedorViewModel : BaseSegurosViewModel +{ + private readonly TipoVendedorServico _servico; + + public TipoVendedor CancelTipoVendedor; + + private Visibility _ativoVisibility = (Visibility)2; + + private TipoVendedor _selectedTipoVendedor = new TipoVendedor(); + + private ObservableCollection _tipoVendedoresFiltrados = new ObservableCollection(); + + private bool _isExpanded; + + public List TipoVendedores { get; set; } + + public Visibility AtivoVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _ativoVisibility; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _ativoVisibility = value; + OnPropertyChanged("AtivoVisibility"); + } + } + + public TipoVendedor SelectedTipoVendedor + { + get + { + return _selectedTipoVendedor; + } + set + { + _selectedTipoVendedor = value; + WorkOnSelectedTipoVendedor(value); + AtivoVisibility = (Visibility)((value != null && ((DomainBase)value).Id == 1) ? 2 : 0); + VerificarEnables((value != null) ? new long?(((DomainBase)value).Id) : null); + OnPropertyChanged("SelectedTipoVendedor"); + } + } + + public ObservableCollection TipoVendedoresFiltrados + { + get + { + return _tipoVendedoresFiltrados; + } + set + { + _tipoVendedoresFiltrados = value; + IsExpanded = value != null && value.Count > 0; + OnPropertyChanged("TipoVendedoresFiltrados"); + } + } + + public bool IsExpanded + { + get + { + return _isExpanded; + } + set + { + _isExpanded = value; + OnPropertyChanged("IsExpanded"); + } + } + + public TipoVendedorViewModel() + { + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + //IL_0008: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Expected O, but got Unknown + _servico = new TipoVendedorServico(); + base.EnableMenu = true; + Seleciona(); + } + + public async void Seleciona() + { + Loading(isLoading: true); + await PermissaoTela((TipoTela)14); + await SelecionaTipoVendedores(); + Loading(isLoading: false); + } + + private async Task SelecionaTipoVendedores() + { + Loading(isLoading: true); + List list = await new BaseServico().BuscarTipoVendedoresAsync(); + TipoVendedores = (from x in list + orderby x.Ativo descending, x.Descricao + select x).ToList(); + TipoVendedoresFiltrados = new ObservableCollection(TipoVendedores); + if (TipoVendedoresFiltrados.Count > 0) + { + SelecionaTipoVendedor(TipoVendedoresFiltrados.First()); + } + else + { + SelectedTipoVendedor = new TipoVendedor(); + Alterar(alterar: false); + base.EnableMenu = false; + } + Recursos.TipoVendedor = list; + Loading(isLoading: false); + } + + public void Incluir() + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Unknown result type (might be due to invalid IL or missing references) + //IL_0023: Expected O, but got Unknown + SelectedTipoVendedor = new TipoVendedor + { + Ativo = true, + Inserido = false + }; + Alterar(alterar: true); + } + + public async Task>> Salvar() + { + List> list = SelectedTipoVendedor.Validate(); + if (list.Count > 0) + { + return list; + } + string acao = ((((DomainBase)SelectedTipoVendedor).Id == 0L) ? "INCLUIU" : "ALTEROU"); + TipoVendedor value = await _servico.Save(SelectedTipoVendedor); + if (!_servico.Sucesso) + { + return null; + } + RegistrarAcao(acao + " TIPO VENDEDOR \"" + value.Descricao + "\"", ((DomainBase)value).Id, (TipoTela)14, string.Format("ID: {0}\nATIVO: {1}", ((DomainBase)value).Id, (value.Ativo.HasValue && value.Ativo.Value) ? "SIM" : "NÃO")); + if (TipoVendedores.Any((TipoVendedor x) => ((DomainBase)x).Id == ((DomainBase)value).Id)) + { + DomainBase.Copy(TipoVendedores.First((TipoVendedor x) => ((DomainBase)x).Id == ((DomainBase)value).Id), value); + } + else + { + TipoVendedores.Add(value); + } + if (TipoVendedoresFiltrados.Any((TipoVendedor x) => ((DomainBase)x).Id == ((DomainBase)value).Id)) + { + DomainBase.Copy(TipoVendedoresFiltrados.First((TipoVendedor x) => ((DomainBase)x).Id == ((DomainBase)value).Id), value); + } + else + { + TipoVendedoresFiltrados.Add(value); + } + TipoVendedoresFiltrados = new ObservableCollection(TipoVendedoresFiltrados); + WorkOnSelectedTipoVendedor(value, registrar: false); + Recursos.TipoVendedor = TipoVendedores; + Alterar(alterar: false); + ToggleSnackBar("TIPO VENDEDOR SALVO COM SUCESSO"); + return null; + } + + public void CancelarAlteracao() + { + if (CancelTipoVendedor != null && TipoVendedores.Any((TipoVendedor x) => ((DomainBase)x).Id == ((DomainBase)CancelTipoVendedor).Id)) + { + DomainBase.Copy(TipoVendedores.First((TipoVendedor x) => ((DomainBase)x).Id == ((DomainBase)CancelTipoVendedor).Id), CancelTipoVendedor); + if (TipoVendedoresFiltrados.Count > 0 && TipoVendedoresFiltrados.Any((TipoVendedor x) => ((DomainBase)x).Id == ((DomainBase)CancelTipoVendedor).Id)) + { + DomainBase.Copy(TipoVendedoresFiltrados.First((TipoVendedor x) => ((DomainBase)x).Id == ((DomainBase)CancelTipoVendedor).Id), CancelTipoVendedor); + } + else + { + TipoVendedoresFiltrados.Add(CancelTipoVendedor); + } + TipoVendedoresFiltrados = new ObservableCollection(TipoVendedoresFiltrados); + SelectedTipoVendedor = TipoVendedoresFiltrados.First((TipoVendedor x) => ((DomainBase)x).Id == ((DomainBase)CancelTipoVendedor).Id); + } + else + { + Incluir(); + } + Alterar(alterar: false); + } + + public async void Excluir() + { + if (SelectedTipoVendedor == null || ((DomainBase)SelectedTipoVendedor).Id == 0L || ((DomainBase)SelectedTipoVendedor).Id == 1) + { + return; + } + if (await new BaseServico().TipoVendedorUtilizado(((DomainBase)SelectedTipoVendedor).Id)) + { + await ShowMessage("TIPO VENDEDOR NÃO PODE SER EXCLUÍDO POIS ESTÁ SENDO UTILIZADO."); + } + else + { + if (!(await ShowMessage("DESEJA EXCLUIR?", "SIM", "NÃO"))) + { + return; + } + Loading(isLoading: true); + if (!(await _servico.Delete(SelectedTipoVendedor))) + { + Loading(isLoading: false); + return; + } + RegistrarAcao("EXCLUIU TIPO VENDEDOR \"" + SelectedTipoVendedor.Descricao + "\"", ((DomainBase)SelectedTipoVendedor).Id, (TipoTela)14, string.Format("ID: {0}\nATIVO: {1}", ((DomainBase)SelectedTipoVendedor).Id, (SelectedTipoVendedor.Ativo.HasValue && SelectedTipoVendedor.Ativo.Value) ? "SIM" : "NÃO")); + int num = TipoVendedoresFiltrados.IndexOf(SelectedTipoVendedor); + TipoVendedores.Remove(SelectedTipoVendedor); + TipoVendedoresFiltrados.Remove(SelectedTipoVendedor); + TipoVendedoresFiltrados = new ObservableCollection(TipoVendedoresFiltrados); + if (TipoVendedoresFiltrados.Count > 0) + { + SelectedTipoVendedor = ((num < TipoVendedoresFiltrados.Count) ? TipoVendedoresFiltrados.ElementAt(num) : TipoVendedoresFiltrados.Last()); + } + else + { + SelectedTipoVendedor = new TipoVendedor(); + Alterar(alterar: false); + base.EnableMenu = false; + } + Recursos.TipoVendedor = TipoVendedores; + Loading(isLoading: false); + ToggleSnackBar("TIPO VENDEDOR EXCLUÍDO COM SUCESSO"); + } + } + + internal async Task> Filtrar(string value) + { + return await Task.Run(() => FiltrarTipoVendedor(value)); + } + + public List FiltrarTipoVendedor(string filter) + { + TipoVendedoresFiltrados = (string.IsNullOrWhiteSpace(filter) ? new ObservableCollection(TipoVendedores) : new ObservableCollection(from x in TipoVendedores + where ValidationHelper.RemoveDiacritics(x.Descricao.Trim()).ToUpper().Contains(ValidationHelper.RemoveDiacritics(filter)) + orderby x.Ativo descending, x.Descricao + select x)); + SelectedTipoVendedor = TipoVendedoresFiltrados.FirstOrDefault(); + return TipoVendedoresFiltrados.ToList(); + } + + public void SelecionaTipoVendedor(TipoVendedor tipoVendedor) + { + SelectedTipoVendedor = tipoVendedor; + } + + private void WorkOnSelectedTipoVendedor(TipoVendedor value, bool registrar = true) + { + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_0069: Unknown result type (might be due to invalid IL or missing references) + //IL_0070: Invalid comparison between Unknown and I4 + //IL_010f: Unknown result type (might be due to invalid IL or missing references) + CancelTipoVendedor = (TipoVendedor)((value == null || ((DomainBase)value).Id == 0L) ? ((object)CancelTipoVendedor) : ((object)(TipoVendedor)((DomainBase)value).Clone())); + if (value == null || ((DomainBase)value).Id == 0L || (LastAccessId == ((DomainBase)value).Id && (int)LastAccessTela == 14)) + { + return; + } + if (registrar) + { + RegistrarAcao("ACESSOU TIPO VENDEDOR \"" + value.Descricao + "\"", ((DomainBase)value).Id, (TipoTela)14, string.Format("ID: {0}\nATIVO: {1}", ((DomainBase)value).Id, (value.Ativo.HasValue && value.Ativo.Value) ? "SIM" : "NÃO")); + } + LastAccessId = ((DomainBase)value).Id; + LastAccessTela = (TipoTela)14; + TipoVendedor selectedTipoVendedor = SelectedTipoVendedor; + if (((selectedTipoVendedor != null) ? new long?(((DomainBase)selectedTipoVendedor).Id) : null) != ((DomainBase)value).Id) + { + SelectedTipoVendedor = ((IEnumerable)TipoVendedoresFiltrados).FirstOrDefault((Func)((TipoVendedor x) => ((DomainBase)x).Id == ((DomainBase)value).Id)); + } + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Ferramentas/UsuarioViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Ferramentas/UsuarioViewModel.cs new file mode 100644 index 0000000..f8f20d8 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Ferramentas/UsuarioViewModel.cs @@ -0,0 +1,684 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net.Http; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using Agger.Registro; +using Gestor.Application.Actions; +using Gestor.Application.Drawers; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.Servicos.Ferramentas; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Helpers; +using Gestor.Common.Security; +using Gestor.Common.Validation; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using MaterialDesignThemes.Wpf; +using Newtonsoft.Json; + +namespace Gestor.Application.ViewModels.Ferramentas; + +public class UsuarioViewModel : BaseSegurosViewModel +{ + private readonly UsuarioServico _servico; + + private readonly PermissaoUsuarioServico _permissaoUsuarioServico; + + public Usuario CancelUsuario; + + private string _inicioAcesso; + + private string _fimAcesso; + + private Usuario _selectedUsuario; + + private Empresa _selectedFilial; + + private bool _cartaoCriado; + + private ObservableCollection _usuariosFiltrados = new ObservableCollection(); + + private bool _isExpanded; + + private bool _enableGrid = true; + + private Visibility _horarioAcessoVisible; + + private List _empresas = Recursos.Empresas; + + private string _confirmaSenha; + + private string _labelCartao; + + public static DrawerHost Drawer { get; set; } + + public List PermissaoUsuario { get; set; } + + public List Usuarios { get; set; } + + public string InicioAcesso + { + get + { + return _inicioAcesso; + } + set + { + _inicioAcesso = value; + OnPropertyChanged("InicioAcesso"); + } + } + + public string FimAcesso + { + get + { + return _fimAcesso; + } + set + { + _fimAcesso = value; + OnPropertyChanged("FimAcesso"); + } + } + + public Usuario SelectedUsuario + { + get + { + return _selectedUsuario; + } + set + { + _selectedUsuario = value; + WorkOnSelectedUsuario(value); + VerificarEnables((value != null) ? new long?(((DomainBase)value).Id) : null); + OnPropertyChanged("SelectedUsuario"); + } + } + + public Empresa SelectedFilial + { + get + { + return _selectedFilial; + } + set + { + _selectedFilial = value; + OnPropertyChanged("SelectedFilial"); + } + } + + public bool CartaoCriado + { + get + { + return _cartaoCriado; + } + set + { + _cartaoCriado = value; + OnPropertyChanged("CartaoCriado"); + } + } + + public ObservableCollection UsuariosFiltrados + { + get + { + return _usuariosFiltrados; + } + set + { + _usuariosFiltrados = value; + IsExpanded = value != null && value.Count > 0; + OnPropertyChanged("UsuariosFiltrados"); + } + } + + public bool IsExpanded + { + get + { + return _isExpanded; + } + set + { + _isExpanded = value; + OnPropertyChanged("IsExpanded"); + } + } + + public bool EnableGrid + { + get + { + return _enableGrid; + } + set + { + _enableGrid = value; + OnPropertyChanged("EnableGrid"); + } + } + + public Visibility HorarioAcessoVisible + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _horarioAcessoVisible; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _horarioAcessoVisible = value; + OnPropertyChanged("HorarioAcessoVisible"); + } + } + + public List Empresas + { + get + { + return _empresas; + } + set + { + _empresas = value; + OnPropertyChanged("Empresas"); + } + } + + public Visibility AddUsuarioCentralSeguradoVisibility { get; set; } = (Visibility)(string.IsNullOrEmpty(Connection.UrlCentralSegurado) ? 2 : 0); + + + private string SenhaOriginal { get; set; } + + public string ConfirmaSenha + { + get + { + return _confirmaSenha; + } + set + { + _confirmaSenha = value; + OnPropertyChanged("ConfirmaSenha"); + } + } + + public string LabelCartao + { + get + { + return _labelCartao; + } + set + { + _labelCartao = value; + OnPropertyChanged("LabelCartao"); + } + } + + public UsuarioViewModel() + { + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + _servico = new UsuarioServico(); + _permissaoUsuarioServico = new PermissaoUsuarioServico(); + base.EnableMenu = true; + } + + private async Task BuscaPermissao() + { + PermissaoUsuario = await _permissaoUsuarioServico.PermissUsuario(Recursos.Usuario); + } + + public async Task Seleciona() + { + HorarioAcessoVisible = (Visibility)(Restricao((TipoRestricao)94) ? 2 : 0); + await PermissaoTela((TipoTela)16); + await SelecionaUsuarios(); + } + + public async Task VerificaUsuarioAdmCentralSegurado() + { + await BuscaAlteracaoUsuarios(((DomainBase)SelectedUsuario).Id); + } + + private async Task CarregarUsuarios() + { + Usuarios = (from x in await new BaseServico().CarregarUsuarios() + where !x.Excluido && x.PermissaoAggilizador != 4 + orderby x.Nome + select x).ToList(); + UsuariosFiltrados = new ObservableCollection(Usuarios); + await BuscaPermissao(); + } + + private async Task SelecionaUsuarios() + { + EnableGrid = false; + Loading(isLoading: true); + await CarregarUsuarios(); + if (UsuariosFiltrados.Count > 0) + { + await SelecionaUsuario(UsuariosFiltrados.First()); + } + else + { + SelectedUsuario = new Usuario + { + Segunda = true, + Terca = true, + Quarta = true, + Quinta = true, + Sexta = true, + Sabado = true, + Domingo = true + }; + Alterar(alterar: false); + base.EnableMenu = false; + } + Loading(isLoading: false); + EnableGrid = true; + } + + public async Task>> Validate() + { + List> errors = new List>(); + if (SenhaOriginal == null || SenhaOriginal != SelectedUsuario.Senha) + { + string b = new Token().Decrypt(SelectedUsuario.Senha) ?? SelectedUsuario.Senha; + if (string.IsNullOrWhiteSpace(ConfirmaSenha)) + { + errors.Add(new KeyValuePair("ConfirmaSenha|CONFIRMAÇÃO SENHA", "OBRIGATÓRIO")); + } + else if (!string.Equals(ConfirmaSenha, b)) + { + errors.Add(new KeyValuePair("ConfirmaSenha|CONFIRMAÇÃO SENHA", "INVÁLIDO")); + } + } + List list = (string.IsNullOrWhiteSpace(SelectedUsuario.Login) ? new List() : (await new BaseServico().BuscarUsuarioPorLoginInteiro(SelectedUsuario.Login))); + foreach (Usuario item in list) + { + if (((DomainBase)item).Id != ((DomainBase)SelectedUsuario).Id) + { + errors.Add(new KeyValuePair("Login", "O LOGIN JÁ ESTÁ CADASTRADO PARA O USUÁRIO \"" + item.Nome + "\".")); + } + } + if (SelectedUsuario.InicioAcesso.HasValue && !SelectedUsuario.FimAcesso.HasValue) + { + errors.Add(new KeyValuePair("FIM DO ACESSO", "NECESSÁRIO PREENCHER O CAMPO FIM DO ACESSO!")); + } + if (!SelectedUsuario.InicioAcesso.HasValue && SelectedUsuario.FimAcesso.HasValue) + { + errors.Add(new KeyValuePair("INÍCIO DO ACESSO", "NECESSÁRIO PREENCHER O CAMPO INÍCIO DO ACESSO!")); + } + bool flag = !string.IsNullOrWhiteSpace(SelectedUsuario.Documento); + if (flag) + { + flag = await new BaseServico().BuscarUsuarioMesmoDocumento(ValidationHelper.OnlyNumber(SelectedUsuario.Documento), ((DomainBase)SelectedUsuario).Id, SelectedUsuario.IdEmpresa); + } + if (flag) + { + errors.Add(new KeyValuePair("Documento", "O DOCUMENTO JÁ ESTÁ SENDO USADO EM OUTRO USUÁRIO")); + } + return errors; + } + + public void Incluir() + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_003a: Unknown result type (might be due to invalid IL or missing references) + //IL_0046: Unknown result type (might be due to invalid IL or missing references) + //IL_0052: Unknown result type (might be due to invalid IL or missing references) + //IL_005e: Unknown result type (might be due to invalid IL or missing references) + //IL_006a: Unknown result type (might be due to invalid IL or missing references) + //IL_0071: Unknown result type (might be due to invalid IL or missing references) + //IL_0082: Expected O, but got Unknown + SelectedUsuario = new Usuario + { + IdEmpresa = Recursos.Usuario.IdEmpresa, + Segunda = true, + Terca = true, + Quarta = true, + Quinta = true, + Sexta = true, + Sabado = true, + Domingo = true, + Excluido = false, + FiltroInicial = (TipoFiltroCliente)0 + }; + SenhaOriginal = null; + Alterar(alterar: true); + } + + public async Task>> Salvar() + { + if (DateTime.TryParse(InicioAcesso, out var result) && DateTime.TryParse(FimAcesso, out var result2)) + { + SelectedUsuario.InicioAcesso = result; + SelectedUsuario.FimAcesso = result2; + } + else + { + SelectedUsuario.InicioAcesso = null; + SelectedUsuario.FimAcesso = null; + } + SelectedUsuario.Senha = ((!string.IsNullOrEmpty(SelectedUsuario.Senha)) ? SelectedUsuario.Senha : SenhaOriginal); + List> errorMessages = SelectedUsuario.Validate(); + List> list = errorMessages; + list.AddRange(await Validate()); + if (errorMessages.Count > 0) + { + return errorMessages; + } + SelectedUsuario.Senha = new Token().AggerEncrypt(SelectedUsuario.Senha); + SelectedUsuario.IdEmpresa = ((SelectedUsuario.IdEmpresa == 0L) ? Recursos.Usuario.IdEmpresa : SelectedUsuario.IdEmpresa); + bool usuarioAlterado = await BuscaAlteracaoUsuarios(((DomainBase)SelectedUsuario).Id); + string acao = ((((DomainBase)SelectedUsuario).Id == 0L) ? "INCLUIU" : "ALTEROU"); + Usuario value = await _servico.Save(SelectedUsuario); + if (!_servico.Sucesso) + { + return null; + } + RegistrarAcao(acao + " USUÁRIO \"" + value.Nome + "\"", ((DomainBase)value).Id, (TipoTela)16, $"ID: {((DomainBase)value).Id}"); + if (usuarioAlterado) + { + await AddUsuarioAdiministadorCentralSegurado(); + } + await CarregarUsuarios(); + SelectedUsuario = ((IEnumerable)UsuariosFiltrados).FirstOrDefault((Func)((Usuario x) => ((DomainBase)x).Id == ((DomainBase)value).Id)); + Recursos.Usuarios = Usuarios; + ConfirmaSenha = ""; + Alterar(alterar: false); + ToggleSnackBar("USUÁRIO SALVO COM SUCESSO"); + IsExpanded = true; + return null; + } + + public async Task CancelarAlteracao() + { + await CarregarUsuarios(); + if (UsuariosFiltrados.Any()) + { + Usuario cancelUsuario = CancelUsuario; + long id = ((cancelUsuario != null) ? ((DomainBase)cancelUsuario).Id : 0); + SelectedUsuario = ((IEnumerable)UsuariosFiltrados).FirstOrDefault((Func)((Usuario x) => ((DomainBase)x).Id == id)); + } + else + { + SelectedUsuario = new Usuario(); + Alterar(alterar: false); + base.EnableMenu = false; + } + Alterar(alterar: false); + ConfirmaSenha = ""; + } + + public async Task Excluir() + { + if (SelectedUsuario == null || ((DomainBase)SelectedUsuario).Id == 0L) + { + return; + } + if (await new VendedorUsuarioServico().FindVinculoByUsuario(((DomainBase)SelectedUsuario).Id)) + { + await ShowMessage("O USUÁRIO POSSUI VÍNCULO DE VENDEDOR, REMOVA O VÍNCULO ANTES DE EXCLUIR."); + } + else + { + if (!(await ShowMessage("DESEJA EXCLUIR?", "SIM", "NÃO"))) + { + return; + } + Loading(isLoading: true); + if (!(await _servico.Delete(SelectedUsuario))) + { + Loading(isLoading: false); + return; + } + RegistrarAcao("EXCLUIU USUÁRIO \"" + SelectedUsuario.Nome + "\"", ((DomainBase)SelectedUsuario).Id, (TipoTela)16, $"ID: {((DomainBase)SelectedUsuario).Id}"); + await CarregarUsuarios(); + if (UsuariosFiltrados.Any()) + { + SelectedUsuario = UsuariosFiltrados.FirstOrDefault(); + } + else + { + SelectedUsuario = new Usuario(); + Alterar(alterar: false); + base.EnableMenu = false; + } + Loading(isLoading: false); + ToggleSnackBar("USUÁRIO EXCLUÍDO COM SUCESSO"); + } + } + + internal async Task> Filtrar(string value) + { + return await Task.Run(() => FiltrarUsuario(value)); + } + + public List FiltrarUsuario(string filter) + { + UsuariosFiltrados = (string.IsNullOrWhiteSpace(filter) ? new ObservableCollection(Usuarios) : new ObservableCollection(from x in Usuarios + where ValidationHelper.RemoveDiacritics(x.Nome.Trim()).ToUpper().Contains(ValidationHelper.RemoveDiacritics(filter)) + orderby !x.Excluido descending, x.Nome + select x)); + return UsuariosFiltrados.ToList(); + } + + public async Task SelecionaUsuario(Usuario usuario) + { + Usuario val = await _servico.BuscarUsuarioPorId(((DomainBase)usuario).Id); + val.Segunda = val.Segunda.GetValueOrDefault(true); + val.Terca = val.Terca.GetValueOrDefault(true); + val.Quarta = val.Quarta.GetValueOrDefault(true); + val.Quinta = val.Quinta.GetValueOrDefault(true); + val.Sexta = val.Sexta.GetValueOrDefault(true); + val.Sabado = val.Sabado.GetValueOrDefault(true); + val.Domingo = val.Domingo.GetValueOrDefault(true); + if (((DomainBase)Recursos.Usuario).Id == ((DomainBase)usuario).Id) + { + val.Senha = new Token().AggerDecrypt(val.Senha); + SenhaOriginal = val.Senha; + ConfirmaSenha = ""; + DomainBase.Copy(UsuariosFiltrados.First((Usuario x) => ((DomainBase)x).Id == ((DomainBase)usuario).Id), val); + } + SelectedUsuario = UsuariosFiltrados.First((Usuario x) => ((DomainBase)x).Id == ((DomainBase)usuario).Id); + } + + public async Task OpenPermissao() + { + bool flag = SelectedUsuario == null; + if (flag) + { + flag = await ShowMessage("É NECESSÁRIO SELECIONAR UM USUÁRIO!"); + } + if (!flag) + { + Gestor.Application.Actions.Actions.AtualizaUsuario = (Action)Delegate.Remove(Gestor.Application.Actions.Actions.AtualizaUsuario, new Action(AtualizaUsuario)); + Gestor.Application.Actions.Actions.AtualizaUsuario = (Action)Delegate.Combine(Gestor.Application.Actions.Actions.AtualizaUsuario, new Action(AtualizaUsuario)); + ShowDrawer(new PermissaoUsuarioDrawer(SelectedUsuario), 0, close: false); + } + } + + public async void AtualizaUsuario() + { + if (!base.EnableFields) + { + await CarregarUsuarios(); + } + } + + public async Task OpenVinculo() + { + bool flag = SelectedUsuario == null; + if (flag) + { + flag = await ShowMessage("É NECESSÁRIO SELECIONAR UM USUÁRIO!"); + } + if (!flag) + { + ShowDrawer(new VinculoVendedorDrawer(SelectedUsuario), 0); + } + } + + private void WorkOnSelectedUsuario(Usuario value, bool registrar = true) + { + //IL_0035: Unknown result type (might be due to invalid IL or missing references) + //IL_008c: Unknown result type (might be due to invalid IL or missing references) + //IL_0093: Invalid comparison between Unknown and I4 + //IL_00f9: Unknown result type (might be due to invalid IL or missing references) + CartaoCriado = false; + CancelUsuario = (Usuario)((value == null || ((DomainBase)value).Id == 0L) ? ((object)CancelUsuario) : ((object)(Usuario)((DomainBase)value).Clone())); + if (value == null || ((DomainBase)value).Id == 0L) + { + return; + } + value.Senha = EncryptionHelper.Decrypt(value.Senha); + if (LastAccessId == ((DomainBase)value).Id && (int)LastAccessTela == 16) + { + return; + } + if (registrar) + { + RegistrarAcao("ACESSOU USUÁRIO \"" + value.Nome + "\"", ((DomainBase)value).Id, (TipoTela)16, $"ID USUÁRIO: {((DomainBase)value).Id}"); + } + LastAccessId = ((DomainBase)value).Id; + LastAccessTela = (TipoTela)16; + Usuario selectedUsuario = SelectedUsuario; + if (((selectedUsuario != null) ? new long?(((DomainBase)selectedUsuario).Id) : null) != ((DomainBase)value).Id) + { + SelectedUsuario = ((IEnumerable)UsuariosFiltrados).FirstOrDefault((Func)((Usuario x) => ((DomainBase)x).Id == ((DomainBase)value).Id)); + } + if (SelectedUsuario.InicioAcesso.HasValue && SelectedUsuario.FimAcesso.HasValue) + { + InicioAcesso = SelectedUsuario.InicioAcesso.Value.ToString("HH:mm"); + FimAcesso = SelectedUsuario.FimAcesso.Value.ToString("HH:mm"); + } + if (!SelectedUsuario.InicioAcesso.HasValue && !SelectedUsuario.FimAcesso.HasValue) + { + InicioAcesso = null; + FimAcesso = null; + } + CartaoCriado = !string.IsNullOrEmpty(value.Visita); + LabelCartao = (CartaoCriado ? "ATUALIZAR CARTÃO" : "CRIAR CARTÃO"); + } + + public async Task CriarCartao(bool dadosUsuario) + { + await ShowMessage("CARTÃO CRIADO/ATUALIZADO COM SUCESSO"); + } + + public async Task AlterarUsuario() + { + if (SelectedUsuario != null) + { + Usuario val = await _servico.BuscarUsuarioPorId(((DomainBase)SelectedUsuario).Id); + SenhaOriginal = new Token().AggerDecrypt(val.Senha); + await SelecionaUsuario(SelectedUsuario); + } + } + + private async Task BuscaAlteracaoUsuarios(long idUsuario) + { + Usuario val = await new UsuarioServico().BuscarUsuarioPorId(idUsuario); + bool usuarioAlteradoADMCentral = val != null && ((val != null) ? new bool?(val.AdministradorCentralSegurado) : null) != SelectedUsuario.AdministradorCentralSegurado; + bool novoUsuarioADMCentral = !usuarioAlteradoADMCentral && SelectedUsuario.AdministradorCentralSegurado && ((DomainBase)SelectedUsuario).Id == 0; + List list = (from x in Usuarios + where x.AdministradorCentralSegurado + orderby x.Nome + select x).ToList(); + if (usuarioAlteradoADMCentral && !novoUsuarioADMCentral && list.Count == 0 && !(await ShowMessage("ESTE USUÁRIO É O ÚNICO ADM DA CENTRAL DO SEGURADO.\nTEM CERTEZA QUE DESEJA REMOVER?", "SIM", "CANCELAR"))) + { + CancelarAlteracao(); + return false; + } + if ((novoUsuarioADMCentral || usuarioAlteradoADMCentral) && string.IsNullOrEmpty(Connection.UrlCentralSegurado)) + { + if (SelectedUsuario != null) + { + SelectedUsuario.AdministradorCentralSegurado = false; + } + await ShowMessage("NÃO FOI POSSÍVEL ADICIONAR UM USUÁRIO ADM CENTRAL SEGURADO, POR FAVOR ENTRE EM CONTATO COM O SUPORTE AGGER. \nURL AUSENTE!"); + return false; + } + return usuarioAlteradoADMCentral || novoUsuarioADMCentral; + } + + public async Task AddUsuarioAdiministadorCentralSegurado() + { + if (SelectedUsuario == null) + { + return; + } + Loading(isLoading: true); + string message = "USUÁRIO CADASTRADO/ALTERADO COM SUCESSO!"; + try + { + string text = ((SelectedUsuario.Telefone == null) ? string.Empty : ("(" + SelectedUsuario.Prefixo + ") " + SelectedUsuario.Telefone)); + Token val = new Token(); + UsuarioCentralSegurado val2 = new UsuarioCentralSegurado + { + Id = "", + Senha = "", + Serial = val.Encrypt(Recursos.Empresa.Serial), + FornecedorId = ApplicationHelper.IdFornecedor, + Nome = val.Encrypt(SelectedUsuario.Nome), + Documento = val.Encrypt(SelectedUsuario.Documento.Clear()), + Email = val.Encrypt(SelectedUsuario.Email), + IdEmpresa = SelectedUsuario.IdEmpresa, + Telefone = val.Encrypt(text), + Rua = ((((EnderecoBase)SelectedUsuario).Cidade != null) ? val.Encrypt(((EnderecoBase)SelectedUsuario).Endereco) : string.Empty), + Numero = ((((EnderecoBase)SelectedUsuario).Cidade != null) ? val.Encrypt(((EnderecoBase)SelectedUsuario).Numero) : string.Empty), + Bairro = ((((EnderecoBase)SelectedUsuario).Cidade != null) ? val.Encrypt(((EnderecoBase)SelectedUsuario).Bairro) : string.Empty), + Cidade = ((((EnderecoBase)SelectedUsuario).Cidade != null) ? val.Encrypt(((EnderecoBase)SelectedUsuario).Cidade) : string.Empty), + Estado = ((((EnderecoBase)SelectedUsuario).Cidade != null) ? val.Encrypt(((EnderecoBase)SelectedUsuario).Estado) : string.Empty), + Cep = ((((EnderecoBase)SelectedUsuario).Cidade != null) ? val.Encrypt(((EnderecoBase)SelectedUsuario).Cep) : string.Empty), + Corretora = val.Encrypt(Recursos.Empresa.Nome), + UriCorretora = val.Encrypt(Connection.UrlCentralSegurado), + Admin = SelectedUsuario.AdministradorCentralSegurado + }; + HttpClient client = new HttpClient(); + try + { + StringContent val3 = new StringContent(JsonConvert.SerializeObject((object)val2), Encoding.UTF8, "application/json"); + Uri uri = Address.CentralSegurado.Append("Usuario").Append("AddAggerApp"); + HttpResponseMessage response = await client.PostAsync(uri, (HttpContent)(object)val3); + await _servico.AddCentralSegurado(((DomainBase)SelectedUsuario).Id, response.IsSuccessStatusCode); + if (!response.IsSuccessStatusCode) + { + message = "HOUVE(RAM) O(S) SEGUINTE(S) ERROS: " + (await response.Content.ReadAsStringAsync()).Replace(";", ", ").ToUpper(); + } + } + finally + { + ((IDisposable)client)?.Dispose(); + } + } + catch + { + message = "HOUVERAM ERROS AO CADASTRAR/ALTERAR O USUÁRIO!"; + } + Loading(isLoading: false); + await ShowMessage(message); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Ferramentas/VendedorViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Ferramentas/VendedorViewModel.cs new file mode 100644 index 0000000..8a7f8dd --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Ferramentas/VendedorViewModel.cs @@ -0,0 +1,698 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; +using CsQuery.ExtensionMethods.Internal; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Ferramentas; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Attributes; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Ferramentas; + +public class VendedorViewModel : BaseSegurosViewModel +{ + private readonly VendedorServico _servico; + + public Vendedor CancelVendedor; + + private Vendedor _selectedVendedor; + + private GridLength _gridHeight = new GridLength(1.0, (GridUnitType)2); + + private GridLength _gridHeight2 = new GridLength(0.0); + + private ObservableCollection _vendedoresFiltrados = new ObservableCollection(); + + private bool _isExpanded; + + private VendedorTelefone _selectedTelefone = new VendedorTelefone(); + + private ObservableCollection _telefones = new ObservableCollection(); + + private Repasse _selectedRepasse = new Repasse(); + + private ObservableCollection _repasses = new ObservableCollection(); + + private string _pesquisa; + + private Visibility _mostrarRamo; + + private ObservableCollection _ramos = new ObservableCollection(); + + public List Vendedores { get; set; } + + public Vendedor SelectedVendedor + { + get + { + return _selectedVendedor; + } + set + { + _selectedVendedor = value; + WorkOnSelectedVendedor(value); + VerificarEnables((value != null) ? new long?(((DomainBase)value).Id) : null); + OnPropertyChanged("SelectedVendedor"); + } + } + + public GridLength GridHeight + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _gridHeight; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _gridHeight = value; + OnPropertyChanged("GridHeight"); + } + } + + public GridLength GridHeight2 + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _gridHeight2; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _gridHeight2 = value; + OnPropertyChanged("GridHeight2"); + } + } + + private Visibility _visualizacaoPropriaCorretora { get; set; } = (Visibility)2; + + + public Visibility VisualizacaoPropriaCorretora + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visualizacaoPropriaCorretora; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + _visualizacaoPropriaCorretora = value; + OnPropertyChanged("VisualizacaoPropriaCorretora"); + } + } + + public ObservableCollection VendedoresFiltrados + { + get + { + return _vendedoresFiltrados; + } + set + { + _vendedoresFiltrados = value; + IsExpanded = value != null && value.Count > 0; + OnPropertyChanged("VendedoresFiltrados"); + } + } + + public bool IsExpanded + { + get + { + return _isExpanded; + } + set + { + _isExpanded = value; + OnPropertyChanged("IsExpanded"); + } + } + + public VendedorTelefone SelectedTelefone + { + get + { + return _selectedTelefone; + } + set + { + _selectedTelefone = value; + OnPropertyChanged("SelectedTelefone"); + } + } + + public ObservableCollection Telefones + { + get + { + return _telefones; + } + set + { + _telefones = value; + OnPropertyChanged("Telefones"); + } + } + + public Repasse SelectedRepasse + { + get + { + return _selectedRepasse; + } + set + { + _selectedRepasse = value; + OnPropertyChanged("SelectedRepasse"); + } + } + + public ObservableCollection Repasses + { + get + { + return _repasses; + } + set + { + //IL_0025: Unknown result type (might be due to invalid IL or missing references) + //IL_002f: Expected O, but got Unknown + if (value != null && value.Count > 0) + { + foreach (Repasse item in value) + { + if (item.Ramo == null) + { + item.Ramo = new Ramo(); + } + } + } + _repasses = value; + OnPropertyChanged("Repasses"); + } + } + + public string Pesquisa + { + get + { + return _pesquisa; + } + set + { + _pesquisa = value; + OnPropertyChanged("Pesquisa"); + } + } + + public Visibility MostrarRamo + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _mostrarRamo; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _mostrarRamo = value; + OnPropertyChanged("MostrarRamo"); + } + } + + public ObservableCollection Ramos + { + get + { + return _ramos; + } + set + { + _ramos = value; + OnPropertyChanged("Ramos"); + } + } + + public List TiposRepasseFiltrados => Enum.GetValues(typeof(TipoRepasse)).Cast().Where(delegate(TipoRepasse tipo) + { + //IL_0031: Unknown result type (might be due to invalid IL or missing references) + //IL_0037: Expected O, but got Unknown + //IL_0054: Unknown result type (might be due to invalid IL or missing references) + //IL_0063: Unknown result type (might be due to invalid IL or missing references) + TipoAttribute val = (TipoAttribute)typeof(TipoRepasse).GetField(((object)(TipoRepasse)(ref tipo)).ToString()).GetCustomAttributes(typeof(TipoAttribute), inherit: false).FirstOrDefault(); + return val == null || val.Tipo == "0" || CoCorretagemAtiva || (TipoRepasse?)tipo == SelectedRepasse.Tipo; + }) + .ToList(); + + public bool CoCorretagemAtiva { get; set; } = Recursos.Configuracoes.Any((ConfiguracaoSistema config) => (int)config.Configuracao == 56); + + + public VendedorViewModel() + { + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + //IL_0010: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_002b: Unknown result type (might be due to invalid IL or missing references) + //IL_003c: Unknown result type (might be due to invalid IL or missing references) + //IL_0046: Expected O, but got Unknown + //IL_0052: Unknown result type (might be due to invalid IL or missing references) + //IL_005c: Expected O, but got Unknown + _servico = new VendedorServico(); + base.EnableMenu = true; + Seleciona(); + } + + private async void WorkOnSelectedVendedor(Vendedor value, bool registrar = true) + { + CancelVendedor = (Vendedor)((value == null || ((DomainBase)value).Id == 0L) ? ((object)CancelVendedor) : ((object)(Vendedor)((DomainBase)value).Clone())); + if (value == null || ((DomainBase)value).Id == 0L) + { + return; + } + Loading(isLoading: true); + Repasses = new ObservableCollection(await _servico.BuscaRepassesPorIdVendedor(((DomainBase)value).Id)); + Telefones = new ObservableCollection(await _servico.BuscarTelefonesAsync(((DomainBase)value).Id)); + Loading(isLoading: false); + if (LastAccessId == ((DomainBase)value).Id && (int)LastAccessTela == 15) + { + return; + } + if (registrar) + { + VendedorViewModel vendedorViewModel = this; + string descricao = "ACESSOU VENDEDOR \"" + value.Nome + "\""; + long id = ((DomainBase)value).Id; + TipoTela? tela = (TipoTela)15; + object[] obj = new object[8] + { + ((DomainBase)value).Id, + Recursos.Empresas.First((Empresa x) => ((DomainBase)x).Id == ((value.IdEmpresa == 0L) ? 1 : value.IdEmpresa)).Nome, + value.Documento, + null, + null, + null, + null, + null + }; + Banco banco = value.Banco; + obj[3] = ((banco != null) ? banco.Nome : null); + obj[4] = value.Agencia; + obj[5] = value.Conta; + obj[6] = value.Desconto; + obj[7] = (value.Ativo ? "SIM" : "NÃO"); + vendedorViewModel.RegistrarAcao(descricao, id, tela, string.Format("ID: {0}\nFILIAL DO VENDEDOR: {1}\nDOCUMENTO: {2}\nBANCO: {3}\nAGÊNCIA: {4}\nCONTA: {5}\nDESCONTO: {6:N2}\nATIVO: {7}", obj)); + } + LastAccessId = ((DomainBase)value).Id; + LastAccessTela = (TipoTela)15; + Vendedor selectedVendedor = SelectedVendedor; + if (((selectedVendedor != null) ? new long?(((DomainBase)selectedVendedor).Id) : null) != ((DomainBase)value).Id) + { + SelectedVendedor = ((IEnumerable)VendedoresFiltrados).FirstOrDefault((Func)((Vendedor x) => ((DomainBase)x).Id == ((DomainBase)value).Id)); + } + VendedorViewModel vendedorViewModel2 = this; + Vendedor selectedVendedor2 = SelectedVendedor; + vendedorViewModel2.VisualizacaoPropriaCorretora = (Visibility)((selectedVendedor2 == null || !selectedVendedor2.Corretora) ? 2 : 0); + if (((DomainBase)Recursos.Usuario).Id == 0L) + { + Vendedor selectedVendedor3 = SelectedVendedor; + if (selectedVendedor3 != null && selectedVendedor3.Corretora) + { + _alterarPermissEnabled = true; + base.EnableAlterar = true; + } + else + { + _alterarPermissEnabled = false; + base.EnableAlterar = false; + } + } + } + + private async void Seleciona() + { + Loading(isLoading: true); + await PermissaoTela((TipoTela)15); + await SelecionaVendedores(); + await SelecionaRamos(); + Loading(isLoading: false); + } + + private async Task SelecionaVendedores(bool selecionar = true) + { + List list = await new BaseServico().BuscarVendedoresAsync(); + Vendedores = (from x in list + where Recursos.Usuario.IdEmpresa == 1 || x.IdEmpresa == Recursos.Usuario.IdEmpresa + orderby x.Ativo descending, x.Nome + select x).ToList(); + VendedoresFiltrados = new ObservableCollection(Vendedores); + if (selecionar) + { + SelectedVendedor = VendedoresFiltrados.FirstOrDefault(); + } + Recursos.Vendedores = list; + } + + private async Task SelecionaRamos() + { + MostrarRamo = (Visibility)(Recursos.Configuracoes.All((ConfiguracaoSistema x) => (int)x.Configuracao != 20) ? 2 : 0); + Ramos.Add(new Ramo + { + Nome = "TODOS OS RAMOS" + }); + List source = await new BaseServico().BuscarRamosAsync(); + ExtensionMethods.AddRange((ICollection)Ramos, (IEnumerable)(from x in source + where x.Ativo + orderby x.Nome + select x)); + } + + public void Incluir() + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0026: Expected O, but got Unknown + SelectedVendedor = new Vendedor + { + Ativo = true, + Desconto = default(decimal) + }; + Telefones = new ObservableCollection(); + Repasses = new ObservableCollection(); + Alterar(alterar: true); + } + + public async Task>> Salvar() + { + SelectedVendedor.Telefones = Telefones.ToList(); + List> errorMessages = SelectedVendedor.Validate(); + List> list = errorMessages; + list.AddRange(await Validate()); + if (errorMessages.Count > 0) + { + return errorMessages; + } + SelectedVendedor.Telefones = Telefones.Where((VendedorTelefone x) => !string.IsNullOrEmpty(x.Nome)).ToList(); + List repassesValidos = Repasses.ToList().Where(delegate(Repasse x) + { + List> list2 = x.Validate(); + return list2 != null && list2.Count == 0; + }).ToList(); + if (repassesValidos.Count < Repasses.Count && !(await ShowMessage("HÁ REPASSES INVÁLIDOS, DESEJA PROSSEGUIR?" + Environment.NewLine + "CASO PROSSIGA OS REPASSES INVÁLIDOS NÃO SERÃO SALVOS.", "SIM", "NÃO"))) + { + Repasses.ToList().ForEach(delegate(Repasse x) + { + errorMessages.AddRange(x.Validate()); + }); + return errorMessages; + } + Repasses = new ObservableCollection(repassesValidos); + string acao = ((((DomainBase)SelectedVendedor).Id == 0L) ? "INCLUIU" : "ALTEROU"); + Vendedor value = await _servico.Save(SelectedVendedor, Repasses.ToList()); + if (!_servico.Sucesso) + { + return null; + } + VendedorViewModel vendedorViewModel = this; + string descricao = acao + " VENDEDOR \"" + value.Nome + "\""; + long id = ((DomainBase)value).Id; + TipoTela? tela = (TipoTela)15; + object[] obj = new object[8] + { + ((DomainBase)value).Id, + Recursos.Empresas.First((Empresa x) => ((DomainBase)x).Id == ((value.IdEmpresa == 0L) ? 1 : value.IdEmpresa)).Nome, + value.Documento, + null, + null, + null, + null, + null + }; + Banco banco = value.Banco; + obj[3] = ((banco != null) ? banco.Nome : null); + obj[4] = value.Agencia; + obj[5] = value.Conta; + obj[6] = value.Desconto; + obj[7] = (value.Ativo ? "SIM" : "NÃO"); + vendedorViewModel.RegistrarAcao(descricao, id, tela, string.Format("ID: {0}\nFILIAL DO VENDEDOR: {1}\nDOCUMENTO: {2}\nBANCO: {3}\nAGÊNCIA: {4}\nCONTA: {5}\nDESCONTO: {6:N2}\nATIVO: {7}", obj)); + Pesquisa = string.Empty; + SelectedVendedor = null; + await SelecionaVendedores(selecionar: false); + SelectedVendedor = ((IEnumerable)VendedoresFiltrados).FirstOrDefault((Func)((Vendedor x) => ((DomainBase)x).Id == ((DomainBase)value).Id)); + Recursos.Vendedores = Vendedores; + Alterar(alterar: false); + ToggleSnackBar("VENDEDOR SALVO COM SUCESSO"); + return null; + } + + public void CancelarAlteracao() + { + if (CancelVendedor != null && Vendedores.Any((Vendedor x) => ((DomainBase)x).Id == ((DomainBase)CancelVendedor).Id)) + { + DomainBase.Copy(Vendedores.First((Vendedor x) => ((DomainBase)x).Id == ((DomainBase)CancelVendedor).Id), CancelVendedor); + if (VendedoresFiltrados.Count > 0 && VendedoresFiltrados.Any((Vendedor x) => ((DomainBase)x).Id == ((DomainBase)CancelVendedor).Id)) + { + DomainBase.Copy(VendedoresFiltrados.First((Vendedor x) => ((DomainBase)x).Id == ((DomainBase)CancelVendedor).Id), CancelVendedor); + } + else + { + VendedoresFiltrados.Add(CancelVendedor); + } + VendedoresFiltrados = new ObservableCollection(VendedoresFiltrados); + SelectedVendedor = VendedoresFiltrados.First((Vendedor x) => ((DomainBase)x).Id == ((DomainBase)CancelVendedor).Id); + } + else + { + Incluir(); + } + Alterar(alterar: false); + } + + public void IncluirTelefone() + { + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0021: Unknown result type (might be due to invalid IL or missing references) + //IL_002d: Unknown result type (might be due to invalid IL or missing references) + //IL_003a: Expected O, but got Unknown + if (SelectedVendedor != null) + { + if (Telefones == null) + { + Telefones = new ObservableCollection(); + } + VendedorTelefone val = new VendedorTelefone + { + Vendedor = SelectedVendedor, + Tipo = (TipoTelefone)1 + }; + Telefones.Add(val); + SelectedTelefone = val; + } + } + + public void ExcluirTelefone(VendedorTelefone telefone) + { + Telefones.Remove(telefone); + } + + public void IncluirRepasse() + { + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0021: Unknown result type (might be due to invalid IL or missing references) + //IL_002d: Unknown result type (might be due to invalid IL or missing references) + //IL_0039: Unknown result type (might be due to invalid IL or missing references) + //IL_0045: Unknown result type (might be due to invalid IL or missing references) + //IL_0051: Unknown result type (might be due to invalid IL or missing references) + //IL_0058: Unknown result type (might be due to invalid IL or missing references) + //IL_006a: Expected O, but got Unknown + if (SelectedVendedor != null) + { + if (Repasses == null) + { + Repasses = new ObservableCollection(); + } + Repasse val = new Repasse + { + Vendedor = SelectedVendedor, + Forma = (FormaRepasse)1, + Incidencia = (TipoIncidencia)1, + Tipo = (TipoRepasse)2, + Ativo = true, + Ramo = Ramos.First() + }; + Repasses.Insert(0, val); + SelectedRepasse = val; + } + } + + internal async Task> Filtrar(string value) + { + return await Task.Run(() => FiltrarVendedor(value)); + } + + public List FiltrarVendedor(string filter) + { + VendedoresFiltrados = (string.IsNullOrWhiteSpace(filter) ? new ObservableCollection(Vendedores) : new ObservableCollection(from x in Vendedores + where ValidationHelper.RemoveDiacritics(x.Nome.Trim()).ToUpper().Contains(ValidationHelper.RemoveDiacritics(filter)) + orderby x.Ativo descending, x.Nome + select x)); + SelectedVendedor = VendedoresFiltrados.FirstOrDefault(); + return VendedoresFiltrados.ToList(); + } + + private async Task>> Validate() + { + List> errors = new List>(); + List source = ((!ValidationHelper.ValidateDocument(SelectedVendedor.Documento)) ? new List() : (await new BaseServico().BuscarVendedor(SelectedVendedor.Documento))); + Vendedor val = ((IEnumerable)source).FirstOrDefault((Func)((Vendedor x) => ((DomainBase)x).Id != ((DomainBase)SelectedVendedor).Id && x.Documento == SelectedVendedor.Documento && x.Ativo)); + if (val != null && Recursos.Configuracoes.All((ConfiguracaoSistema x) => (int)x.Configuracao != 7)) + { + errors.Add(new KeyValuePair("Documento", "O DOCUMENTO JÁ ESTÁ CADASTRADO PARA O VENDEDOR " + val.Nome + ".")); + } + if (Recursos.Configuracoes.All((ConfiguracaoSistema x) => (int)x.Configuracao != 15)) + { + IEnumerable enumerable = Repasses?.Where((Repasse x) => (int)x.Tipo.GetValueOrDefault() == 2 && (x.ValorNovo > 100m || x.ValorRenovacao > 100m)); + if (enumerable != null && enumerable.Any()) + { + errors.Add(new KeyValuePair("VALOR REPASSE", "O VALOR DE REPASSE NÃO PODE SER SUPERIOR A 100%")); + } + } + ObservableCollection observableCollection = await _servico.BuscaRepassesPorIdVendedor(((DomainBase)SelectedVendedor).Id); + if (observableCollection != null && observableCollection.Count > 0) + { + foreach (Repasse semAlteracao in observableCollection) + { + if (Repasses.Any(delegate(Repasse repasse) + { + //IL_002b: Unknown result type (might be due to invalid IL or missing references) + //IL_0032: Unknown result type (might be due to invalid IL or missing references) + //IL_009a: Unknown result type (might be due to invalid IL or missing references) + //IL_00a1: Unknown result type (might be due to invalid IL or missing references) + //IL_00d5: Unknown result type (might be due to invalid IL or missing references) + //IL_00dc: Unknown result type (might be due to invalid IL or missing references) + //IL_0110: Unknown result type (might be due to invalid IL or missing references) + //IL_0117: Unknown result type (might be due to invalid IL or missing references) + if (((DomainBase)semAlteracao).Id == ((DomainBase)repasse).Id) + { + if (semAlteracao.Tipo == repasse.Tipo && !(semAlteracao.ValorNovo != repasse.ValorNovo) && !(semAlteracao.ValorRenovacao != repasse.ValorRenovacao) && semAlteracao.Incidencia == repasse.Incidencia && semAlteracao.Forma == repasse.Forma && semAlteracao.Base == repasse.Base && semAlteracao.Seguradora == repasse.Seguradora) + { + if (semAlteracao.Ramo == null) + { + Ramo ramo = repasse.Ramo; + if (ramo != null && ((DomainBase)ramo).Id == 0) + { + return false; + } + } + Ramo ramo2 = semAlteracao.Ramo; + long? num = ((ramo2 != null) ? new long?(((DomainBase)ramo2).Id) : null); + Ramo ramo3 = repasse.Ramo; + return num != ((ramo3 != null) ? new long?(((DomainBase)ramo3).Id) : null); + } + return true; + } + return false; + }) && (await _servico.BuscarVendedorParcela(((DomainBase)semAlteracao).Id)).Count > 1) + { + errors.Add(new KeyValuePair("REPASSE", $"O REPASSE, DE ID {((DomainBase)semAlteracao).Id}, NÃO PODE SER ALTERADO POIS JÁ ESTÁ CADASTRADO EM ALGUM DOCUMENTO!")); + } + } + } + return errors; + } + + public async Task SalvarVinculo(VinculoRepasse vinculo) + { + await _servico.Save(vinculo); + Repasses = new ObservableCollection(await _servico.BuscaRepassesPorIdVendedor(((DomainBase)SelectedVendedor).Id)); + ToggleSnackBar("VINCULO SALVO COM SUCESSO"); + } + + public async Task ExcluirVinculo(VinculoRepasse vinculo) + { + if (await ShowMessage("DESEJA REALMENTE EXCLUIR O VÍNCULO DO REPASSE SELECIONADO?", "SIM", "NÃO")) + { + await _servico.Delete(vinculo); + Repasses = new ObservableCollection(await _servico.BuscaRepassesPorIdVendedor(((DomainBase)SelectedVendedor).Id)); + ToggleSnackBar("VINCULO EXCLUÍDO COM SUCESSO"); + } + } + + public async Task AtivarInativarVendedor(Vendedor vendedor) + { + if (vendedor != null && ((DomainBase)vendedor).Id != 0L) + { + string acao = (vendedor.Ativo ? "INATIVOU VENDEDOR" : "ATIVOU VENDEDOR"); + vendedor.Ativo = !vendedor.Ativo; + vendedor = await _servico.Save(vendedor, Repasses.ToList()); + VendedorViewModel vendedorViewModel = this; + string descricao = acao + " \"" + vendedor.Nome + "\""; + long id = ((DomainBase)vendedor).Id; + TipoTela? tela = (TipoTela)15; + object[] obj = new object[8] + { + ((DomainBase)vendedor).Id, + Recursos.Empresas.First((Empresa x) => ((DomainBase)x).Id == ((vendedor.IdEmpresa == 0L) ? 1 : vendedor.IdEmpresa)).Nome, + vendedor.Documento, + null, + null, + null, + null, + null + }; + Banco banco = vendedor.Banco; + obj[3] = ((banco != null) ? banco.Nome : null); + obj[4] = vendedor.Agencia; + obj[5] = vendedor.Conta; + obj[6] = vendedor.Desconto; + obj[7] = (vendedor.Ativo ? "SIM" : "NÃO"); + vendedorViewModel.RegistrarAcao(descricao, id, tela, string.Format("ID: {0}\nFILIAL DO VENDEDOR: {1}\nDOCUMENTO: {2}\nBANCO: {3}\nAGÊNCIA: {4}\nCONTA: {5}\nDESCONTO: {6:N2}\nATIVO: {7}", obj)); + Pesquisa = string.Empty; + SelectedVendedor = null; + await SelecionaVendedores(selecionar: false); + SelectedVendedor = ((IEnumerable)VendedoresFiltrados).FirstOrDefault((Func)((Vendedor x) => ((DomainBase)x).Id == ((DomainBase)vendedor).Id)); + Recursos.Vendedores = Vendedores; + Alterar(alterar: false); + ToggleSnackBar("VENDEDOR SALVO COM SUCESSO"); + } + } + + public async Task AtivarInativarRepasse(Repasse repasse) + { + if (repasse != null && ((DomainBase)repasse).Id != 0L) + { + string acao = (repasse.Ativo ? "INATIVOU REPASSE" : "ATIVOU REPASSE"); + repasse.Ativo = !repasse.Ativo; + Repasse obj = repasse; + Ramo ramo = repasse.Ramo; + obj.Ramo = ((ramo != null && ((DomainBase)ramo).Id == 0) ? null : repasse.Ramo); + repasse = await _servico.Save(repasse); + long id = ((DomainBase)SelectedVendedor).Id; + RegistrarAcao(acao + " \"" + SelectedVendedor.Nome + "\"", ((DomainBase)SelectedVendedor).Id, (TipoTela)15, string.Format("ID: {0}\nVALOR NOVO: {1:N2}\nVALOR RENOVAÇÃO: {2:N2}\nATIVO: {3}", ((DomainBase)repasse).Id, repasse.ValorNovo, repasse.ValorRenovacao, repasse.Ativo ? "SIM" : "NÃO")); + Pesquisa = string.Empty; + SelectedVendedor = null; + await SelecionaVendedores(selecionar: false); + SelectedVendedor = ((IEnumerable)VendedoresFiltrados).FirstOrDefault((Func)((Vendedor x) => ((DomainBase)x).Id == id)); + Recursos.Vendedores = Vendedores; + Alterar(alterar: false); + ToggleSnackBar("REPASSE SALVO COM SUCESSO"); + } + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Financeiro.Relatorios/FechamentoFinanceiroViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Financeiro.Relatorios/FechamentoFinanceiroViewModel.cs new file mode 100644 index 0000000..7bccb8f --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Financeiro.Relatorios/FechamentoFinanceiroViewModel.cs @@ -0,0 +1,974 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using System.Windows.Forms; +using ClosedXML.Excel; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Financeiro; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Helpers; +using Gestor.Model.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Financeiro; +using Gestor.Model.Domain.Financeiro.Relatorios; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Relatorios; + +namespace Gestor.Application.ViewModels.Financeiro.Relatorios; + +public class FechamentoFinanceiroViewModel : BaseViewModel +{ + private readonly FinanceiroServico _servico; + + private bool _isExpanded; + + private bool _analitico; + + private List _plano; + + private List _planos; + + private List _centro; + + private List _conta; + + private DateTime? _inicio = new DateTime(Funcoes.GetNetworkTime().Date.Year, Funcoes.GetNetworkTime().Date.Month, 1); + + private DateTime? _fim = Funcoes.GetNetworkTime(); + + private List _fechamento; + + private List _fechamentoAnalitico; + + private string _htmlContent; + + private bool _print; + + public bool IsExpanded + { + get + { + return _isExpanded; + } + set + { + _isExpanded = value; + OnPropertyChanged("IsExpanded"); + } + } + + public bool Analitico + { + get + { + return _analitico; + } + set + { + _analitico = value; + OnPropertyChanged("Analitico"); + } + } + + public List Plano + { + get + { + return _plano; + } + set + { + _plano = value; + OnPropertyChanged("Plano"); + } + } + + public List Planos + { + get + { + return _planos; + } + set + { + _planos = value; + OnPropertyChanged("Planos"); + } + } + + public List Centro + { + get + { + return _centro; + } + set + { + _centro = value; + OnPropertyChanged("Centro"); + } + } + + public List Conta + { + get + { + return _conta; + } + set + { + _conta = value; + OnPropertyChanged("Conta"); + } + } + + public DateTime? Inicio + { + get + { + return _inicio; + } + set + { + _inicio = value; + OnPropertyChanged("Inicio"); + } + } + + public DateTime? Fim + { + get + { + return _fim; + } + set + { + _fim = value; + OnPropertyChanged("Fim"); + } + } + + public List Fechamento + { + get + { + return _fechamento; + } + set + { + _fechamento = value; + OnPropertyChanged("Fechamento"); + } + } + + public List FechamentoAnalitico + { + get + { + return _fechamentoAnalitico; + } + set + { + _fechamentoAnalitico = value; + OnPropertyChanged("FechamentoAnalitico"); + } + } + + public string HtmlContent + { + get + { + return _htmlContent; + } + set + { + _htmlContent = value; + IsPrintable = !string.IsNullOrWhiteSpace(_htmlContent); + OnPropertyChanged("HtmlContent"); + } + } + + public bool IsPrintable + { + get + { + return _print; + } + set + { + _print = value; + OnPropertyChanged("IsPrintable"); + } + } + + public FechamentoFinanceiroViewModel() + { + _servico = new FinanceiroServico(); + LoadInicial(); + } + + private async void LoadInicial() + { + Plano = await _servico.BuscarPlanoAsync(); + Planos = await _servico.BuscarPlanosAsync(); + Centro = await _servico.BuscarCentroAsync(); + Conta = await new BancosContasServico().BuscarBancos(); + } + + public async Task GerarRelatorio() + { + if (!Inicio.HasValue || !Fim.HasValue) + { + return; + } + List plano = (from x in Plano + where x.Selecionado + select ((DomainBase)x).Id).ToList(); + List planos = (from x in Planos + where x.Selecionado + select ((DomainBase)x).Id).ToList(); + List centro = (from x in Centro + where x.Selecionado + select ((DomainBase)x).Id).ToList(); + List conta = (from x in Conta + where x.Selecionado + select ((DomainBase)x).Id).ToList(); + FiltroFinanceiro filtro = new FiltroFinanceiro + { + Inicio = Inicio.Value, + Fim = Fim.Value, + Plano = plano, + Planos = planos, + Centro = centro, + Conta = conta, + Referencia = "l.dtbaixa" + }; + List lancamentos = await _servico.BuscarFechamento(filtro); + if (Analitico) + { + FechamentoAnalitico = new List(); + (from x in lancamentos.Where(delegate(Lancamento x) + { + ControleFinanceiro controle7 = x.Controle; + return ((controle7 != null) ? controle7.Plano : null) != null; + }) + orderby x.Controle.Plano.Nome + group x by ((DomainBase)x.Controle.Plano.Plano).Id).ToList().ForEach(delegate(IGrouping x) + { + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_0043: Unknown result type (might be due to invalid IL or missing references) + //IL_00ae: Expected O, but got Unknown + //IL_00b4: Unknown result type (might be due to invalid IL or missing references) + //IL_00b9: Unknown result type (might be due to invalid IL or missing references) + //IL_00c4: Unknown result type (might be due to invalid IL or missing references) + //IL_00f4: Unknown result type (might be due to invalid IL or missing references) + //IL_0124: Unknown result type (might be due to invalid IL or missing references) + //IL_0154: Unknown result type (might be due to invalid IL or missing references) + //IL_0184: Unknown result type (might be due to invalid IL or missing references) + //IL_01b4: Unknown result type (might be due to invalid IL or missing references) + //IL_01e4: Unknown result type (might be due to invalid IL or missing references) + //IL_0214: Unknown result type (might be due to invalid IL or missing references) + //IL_0244: Unknown result type (might be due to invalid IL or missing references) + //IL_0274: Unknown result type (might be due to invalid IL or missing references) + //IL_02a4: Unknown result type (might be due to invalid IL or missing references) + //IL_02d4: Unknown result type (might be due to invalid IL or missing references) + //IL_0304: Unknown result type (might be due to invalid IL or missing references) + //IL_0334: Unknown result type (might be due to invalid IL or missing references) + //IL_0364: Unknown result type (might be due to invalid IL or missing references) + //IL_0399: Expected O, but got Unknown + FechamentoFinanceiroAnalitico val8 = new FechamentoFinanceiroAnalitico + { + NomeConta = x.First().Controle.Plano.Plano.Descricao.ToUpper(), + Dados = (from f in x + orderby ((DomainBase)f.Controle.Plano).Id + group f by ((DomainBase)f.Controle.Plano).Id).Select((Func, DadosFechamentoAnalitico>)((IGrouping f) => new DadosFechamentoAnalitico + { + Nome = f.First().Controle.Plano.Descricao, + Jan = f.Where(delegate(Lancamento s) + { + DateTime? baixa12 = s.Baixa; + DateTime value25 = new DateTime(filtro.Inicio.Year, 1, 1); + if (baixa12 >= value25) + { + baixa12 = s.Baixa; + value25 = new DateTime(filtro.Inicio.Year, 1, 31); + return baixa12 <= value25; + } + return false; + }).ToList().Sum(delegate(Lancamento s) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Invalid comparison between Unknown and I4 + if ((int)s.Sinal != 1) + { + return s.ValorPago; + } + decimal? valorPago25 = s.ValorPago; + decimal value24 = 2; + decimal? valorPago26 = s.ValorPago; + return valorPago25 - (decimal?)value24 * valorPago26; + }), + Fev = f.Where(delegate(Lancamento s) + { + DateTime? baixa11 = s.Baixa; + DateTime value23 = new DateTime(filtro.Inicio.Year, 2, 1); + if (baixa11 >= value23) + { + baixa11 = s.Baixa; + value23 = new DateTime(filtro.Inicio.Year, 2, DateTime.DaysInMonth(filtro.Inicio.Year, 2)); + return baixa11 <= value23; + } + return false; + }).ToList().Sum(delegate(Lancamento s) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Invalid comparison between Unknown and I4 + if ((int)s.Sinal != 1) + { + return s.ValorPago; + } + decimal? valorPago23 = s.ValorPago; + decimal value22 = 2; + decimal? valorPago24 = s.ValorPago; + return valorPago23 - (decimal?)value22 * valorPago24; + }), + Mar = f.Where(delegate(Lancamento s) + { + DateTime? baixa10 = s.Baixa; + DateTime value21 = new DateTime(filtro.Inicio.Year, 3, 1); + if (baixa10 >= value21) + { + baixa10 = s.Baixa; + value21 = new DateTime(filtro.Inicio.Year, 3, 31); + return baixa10 <= value21; + } + return false; + }).ToList().Sum(delegate(Lancamento s) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Invalid comparison between Unknown and I4 + if ((int)s.Sinal != 1) + { + return s.ValorPago; + } + decimal? valorPago21 = s.ValorPago; + decimal value20 = 2; + decimal? valorPago22 = s.ValorPago; + return valorPago21 - (decimal?)value20 * valorPago22; + }), + Abr = f.Where(delegate(Lancamento s) + { + DateTime? baixa9 = s.Baixa; + DateTime value19 = new DateTime(filtro.Inicio.Year, 4, 1); + if (baixa9 >= value19) + { + baixa9 = s.Baixa; + value19 = new DateTime(filtro.Inicio.Year, 4, 30); + return baixa9 <= value19; + } + return false; + }).ToList().Sum(delegate(Lancamento s) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Invalid comparison between Unknown and I4 + if ((int)s.Sinal != 1) + { + return s.ValorPago; + } + decimal? valorPago19 = s.ValorPago; + decimal value18 = 2; + decimal? valorPago20 = s.ValorPago; + return valorPago19 - (decimal?)value18 * valorPago20; + }), + Mai = f.Where(delegate(Lancamento s) + { + DateTime? baixa8 = s.Baixa; + DateTime value17 = new DateTime(filtro.Inicio.Year, 5, 1); + if (baixa8 >= value17) + { + baixa8 = s.Baixa; + value17 = new DateTime(filtro.Inicio.Year, 5, 31); + return baixa8 <= value17; + } + return false; + }).ToList().Sum(delegate(Lancamento s) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Invalid comparison between Unknown and I4 + if ((int)s.Sinal != 1) + { + return s.ValorPago; + } + decimal? valorPago17 = s.ValorPago; + decimal value16 = 2; + decimal? valorPago18 = s.ValorPago; + return valorPago17 - (decimal?)value16 * valorPago18; + }), + Jun = f.Where(delegate(Lancamento s) + { + DateTime? baixa7 = s.Baixa; + DateTime value15 = new DateTime(filtro.Inicio.Year, 6, 1); + if (baixa7 >= value15) + { + baixa7 = s.Baixa; + value15 = new DateTime(filtro.Inicio.Year, 6, 30); + return baixa7 <= value15; + } + return false; + }).ToList().Sum(delegate(Lancamento s) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Invalid comparison between Unknown and I4 + if ((int)s.Sinal != 1) + { + return s.ValorPago; + } + decimal? valorPago15 = s.ValorPago; + decimal value14 = 2; + decimal? valorPago16 = s.ValorPago; + return valorPago15 - (decimal?)value14 * valorPago16; + }), + Jul = f.Where(delegate(Lancamento s) + { + DateTime? baixa6 = s.Baixa; + DateTime value13 = new DateTime(filtro.Inicio.Year, 7, 1); + if (baixa6 >= value13) + { + baixa6 = s.Baixa; + value13 = new DateTime(filtro.Inicio.Year, 7, 31); + return baixa6 <= value13; + } + return false; + }).ToList().Sum(delegate(Lancamento s) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Invalid comparison between Unknown and I4 + if ((int)s.Sinal != 1) + { + return s.ValorPago; + } + decimal? valorPago13 = s.ValorPago; + decimal value12 = 2; + decimal? valorPago14 = s.ValorPago; + return valorPago13 - (decimal?)value12 * valorPago14; + }), + Ago = f.Where(delegate(Lancamento s) + { + DateTime? baixa5 = s.Baixa; + DateTime value11 = new DateTime(filtro.Inicio.Year, 8, 1); + if (baixa5 >= value11) + { + baixa5 = s.Baixa; + value11 = new DateTime(filtro.Inicio.Year, 8, 31); + return baixa5 <= value11; + } + return false; + }).ToList().Sum(delegate(Lancamento s) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Invalid comparison between Unknown and I4 + if ((int)s.Sinal != 1) + { + return s.ValorPago; + } + decimal? valorPago11 = s.ValorPago; + decimal value10 = 2; + decimal? valorPago12 = s.ValorPago; + return valorPago11 - (decimal?)value10 * valorPago12; + }), + Set = f.Where(delegate(Lancamento s) + { + DateTime? baixa4 = s.Baixa; + DateTime value9 = new DateTime(filtro.Inicio.Year, 9, 1); + if (baixa4 >= value9) + { + baixa4 = s.Baixa; + value9 = new DateTime(filtro.Inicio.Year, 9, 30); + return baixa4 <= value9; + } + return false; + }).ToList().Sum(delegate(Lancamento s) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Invalid comparison between Unknown and I4 + if ((int)s.Sinal != 1) + { + return s.ValorPago; + } + decimal? valorPago9 = s.ValorPago; + decimal value8 = 2; + decimal? valorPago10 = s.ValorPago; + return valorPago9 - (decimal?)value8 * valorPago10; + }), + Out = f.Where(delegate(Lancamento s) + { + DateTime? baixa3 = s.Baixa; + DateTime value7 = new DateTime(filtro.Inicio.Year, 10, 1); + if (baixa3 >= value7) + { + baixa3 = s.Baixa; + value7 = new DateTime(filtro.Inicio.Year, 10, 31); + return baixa3 <= value7; + } + return false; + }).ToList().Sum(delegate(Lancamento s) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Invalid comparison between Unknown and I4 + if ((int)s.Sinal != 1) + { + return s.ValorPago; + } + decimal? valorPago7 = s.ValorPago; + decimal value6 = 2; + decimal? valorPago8 = s.ValorPago; + return valorPago7 - (decimal?)value6 * valorPago8; + }), + Nov = f.Where(delegate(Lancamento s) + { + DateTime? baixa2 = s.Baixa; + DateTime value5 = new DateTime(filtro.Inicio.Year, 11, 1); + if (baixa2 >= value5) + { + baixa2 = s.Baixa; + value5 = new DateTime(filtro.Inicio.Year, 11, 30); + return baixa2 <= value5; + } + return false; + }).ToList().Sum(delegate(Lancamento s) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Invalid comparison between Unknown and I4 + if ((int)s.Sinal != 1) + { + return s.ValorPago; + } + decimal? valorPago5 = s.ValorPago; + decimal value4 = 2; + decimal? valorPago6 = s.ValorPago; + return valorPago5 - (decimal?)value4 * valorPago6; + }), + Dez = f.Where(delegate(Lancamento s) + { + DateTime? baixa = s.Baixa; + DateTime value3 = new DateTime(filtro.Inicio.Year, 12, 1); + if (baixa >= value3) + { + baixa = s.Baixa; + value3 = new DateTime(filtro.Inicio.Year, 12, 31); + return baixa <= value3; + } + return false; + }).ToList().Sum(delegate(Lancamento s) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Invalid comparison between Unknown and I4 + if ((int)s.Sinal != 1) + { + return s.ValorPago; + } + decimal? valorPago3 = s.ValorPago; + decimal value2 = 2; + decimal? valorPago4 = s.ValorPago; + return valorPago3 - (decimal?)value2 * valorPago4; + }), + Total = f.Sum(delegate(Lancamento s) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Invalid comparison between Unknown and I4 + if ((int)s.Sinal != 1) + { + return s.ValorPago; + } + decimal? valorPago = s.ValorPago; + decimal value = 2; + decimal? valorPago2 = s.ValorPago; + return valorPago - (decimal?)value * valorPago2; + }), + PercentualCredito = ((f.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) == 0m) ? 0m : (f.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) / x.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)), + PercentualDebito = ((f.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) == 0m) ? 0m : (f.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) / x.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)) + })).ToList() + }; + val8.Dados.Add(new DadosFechamentoAnalitico + { + Nome = "TOTAL", + Jan = val8.Dados.Sum((DadosFechamentoAnalitico t) => t.Jan), + Fev = val8.Dados.Sum((DadosFechamentoAnalitico t) => t.Fev), + Mar = val8.Dados.Sum((DadosFechamentoAnalitico t) => t.Mar), + Abr = val8.Dados.Sum((DadosFechamentoAnalitico t) => t.Abr), + Mai = val8.Dados.Sum((DadosFechamentoAnalitico t) => t.Mai), + Jun = val8.Dados.Sum((DadosFechamentoAnalitico t) => t.Jun), + Jul = val8.Dados.Sum((DadosFechamentoAnalitico t) => t.Jul), + Ago = val8.Dados.Sum((DadosFechamentoAnalitico t) => t.Ago), + Set = val8.Dados.Sum((DadosFechamentoAnalitico t) => t.Set), + Out = val8.Dados.Sum((DadosFechamentoAnalitico t) => t.Out), + Nov = val8.Dados.Sum((DadosFechamentoAnalitico t) => t.Nov), + Dez = val8.Dados.Sum((DadosFechamentoAnalitico t) => t.Dez), + Total = val8.Dados.Sum((DadosFechamentoAnalitico t) => t.Total), + PercentualCredito = val8.Dados.Sum((DadosFechamentoAnalitico t) => t.PercentualCredito), + PercentualDebito = val8.Dados.Sum((DadosFechamentoAnalitico t) => t.PercentualDebito) + }); + FechamentoAnalitico.Add(val8); + }); + FechamentoFinanceiroAnalitico val = new FechamentoFinanceiroAnalitico + { + NomeConta = "TOTAL NO PERÍODO", + Dados = new List() + }; + val.Dados.Add(new DadosFechamentoAnalitico + { + Nome = "TOTAL", + Jan = FechamentoAnalitico.Sum((FechamentoFinanceiroAnalitico x) => x.Dados.Sum((DadosFechamentoAnalitico y) => (!(y.Nome != "TOTAL")) ? new decimal?(default(decimal)) : y.Jan)), + Fev = FechamentoAnalitico.Sum((FechamentoFinanceiroAnalitico x) => x.Dados.Sum((DadosFechamentoAnalitico y) => (!(y.Nome != "TOTAL")) ? new decimal?(default(decimal)) : y.Fev)), + Mar = FechamentoAnalitico.Sum((FechamentoFinanceiroAnalitico x) => x.Dados.Sum((DadosFechamentoAnalitico y) => (!(y.Nome != "TOTAL")) ? new decimal?(default(decimal)) : y.Mar)), + Abr = FechamentoAnalitico.Sum((FechamentoFinanceiroAnalitico x) => x.Dados.Sum((DadosFechamentoAnalitico y) => (!(y.Nome != "TOTAL")) ? new decimal?(default(decimal)) : y.Abr)), + Mai = FechamentoAnalitico.Sum((FechamentoFinanceiroAnalitico x) => x.Dados.Sum((DadosFechamentoAnalitico y) => (!(y.Nome != "TOTAL")) ? new decimal?(default(decimal)) : y.Mai)), + Jun = FechamentoAnalitico.Sum((FechamentoFinanceiroAnalitico x) => x.Dados.Sum((DadosFechamentoAnalitico y) => (!(y.Nome != "TOTAL")) ? new decimal?(default(decimal)) : y.Jun)), + Jul = FechamentoAnalitico.Sum((FechamentoFinanceiroAnalitico x) => x.Dados.Sum((DadosFechamentoAnalitico y) => (!(y.Nome != "TOTAL")) ? new decimal?(default(decimal)) : y.Jul)), + Ago = FechamentoAnalitico.Sum((FechamentoFinanceiroAnalitico x) => x.Dados.Sum((DadosFechamentoAnalitico y) => (!(y.Nome != "TOTAL")) ? new decimal?(default(decimal)) : y.Ago)), + Set = FechamentoAnalitico.Sum((FechamentoFinanceiroAnalitico x) => x.Dados.Sum((DadosFechamentoAnalitico y) => (!(y.Nome != "TOTAL")) ? new decimal?(default(decimal)) : y.Set)), + Out = FechamentoAnalitico.Sum((FechamentoFinanceiroAnalitico x) => x.Dados.Sum((DadosFechamentoAnalitico y) => (!(y.Nome != "TOTAL")) ? new decimal?(default(decimal)) : y.Out)), + Nov = FechamentoAnalitico.Sum((FechamentoFinanceiroAnalitico x) => x.Dados.Sum((DadosFechamentoAnalitico y) => (!(y.Nome != "TOTAL")) ? new decimal?(default(decimal)) : y.Nov)), + Dez = FechamentoAnalitico.Sum((FechamentoFinanceiroAnalitico x) => x.Dados.Sum((DadosFechamentoAnalitico y) => (!(y.Nome != "TOTAL")) ? new decimal?(default(decimal)) : y.Dez)), + Total = FechamentoAnalitico.Sum((FechamentoFinanceiroAnalitico x) => x.Dados.Sum((DadosFechamentoAnalitico y) => (!(y.Nome != "TOTAL")) ? new decimal?(default(decimal)) : y.Total)), + PercentualCredito = 100m, + PercentualDebito = 100m + }); + FechamentoAnalitico.Add(val); + } + else + { + Fechamento = new List(); + (from x in lancamentos.Where(delegate(Lancamento x) + { + ControleFinanceiro controle6 = x.Controle; + return ((controle6 != null) ? controle6.Plano : null) != null; + }) + orderby x.Controle.Plano.Nome + group x by ((DomainBase)x.Controle.Plano.Plano).Id).ToList().ForEach(delegate(IGrouping x) + { + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Unknown result type (might be due to invalid IL or missing references) + //IL_0037: Unknown result type (might be due to invalid IL or missing references) + //IL_00a2: Expected O, but got Unknown + //IL_00a8: Unknown result type (might be due to invalid IL or missing references) + //IL_00ad: Unknown result type (might be due to invalid IL or missing references) + //IL_00b8: Unknown result type (might be due to invalid IL or missing references) + //IL_00e8: Unknown result type (might be due to invalid IL or missing references) + //IL_0118: Unknown result type (might be due to invalid IL or missing references) + //IL_01e7: Unknown result type (might be due to invalid IL or missing references) + //IL_02bb: Expected O, but got Unknown + FechamentoFinanceiro val7 = new FechamentoFinanceiro + { + Plano = x.First().Controle.Plano.Nome.ToUpper(), + Dados = (from f in x + orderby f.Controle.Plano.Nome + group f by ((DomainBase)f.Controle.Plano).Id).Select((Func, DadosFechamento>)((IGrouping f) => new DadosFechamento + { + Planos = f.First().Controle.Plano.Descricao, + Credito = f.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()), + PercentualCredito = ((f.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) == 0m) ? 0m : (f.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) / x.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)), + Debito = f.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()), + PercentualDebito = ((f.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) == 0m) ? 0m : (f.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) / x.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)) + })).ToList() + }; + val7.Dados.Add(new DadosFechamento + { + Planos = "TOTAL", + Credito = val7.Dados.Sum((DadosFechamento t) => t.Credito), + Debito = val7.Dados.Sum((DadosFechamento t) => t.Debito), + PercentualCredito = ((val7.Dados.Sum((DadosFechamento t) => t.Credito) == 0m) ? 0m : (val7.Dados.Sum((DadosFechamento t) => t.Credito) / lancamentos.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)), + PercentualDebito = ((val7.Dados.Sum((DadosFechamento t) => t.Debito) == 0m) ? 0m : (val7.Dados.Sum((DadosFechamento t) => t.Debito) / lancamentos.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)) + }); + Fechamento.Add(val7); + }); + FechamentoFinanceiro val2 = new FechamentoFinanceiro + { + Plano = "CONTA CORRENTE", + Dados = (from x in lancamentos.Where(delegate(Lancamento x) + { + ControleFinanceiro controle5 = x.Controle; + return ((controle5 != null) ? controle5.Plano : null) != null; + }) + orderby x.Conta.Descricao + group x by ((DomainBase)x.Conta).Id).Select((Func, DadosFechamento>)((IGrouping f) => new DadosFechamento + { + Planos = f.First().Conta.Descricao, + Credito = f.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()), + PercentualCredito = ((f.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) == 0m) ? 0m : (f.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) / lancamentos.Where((Lancamento s) => s.Controle != null && (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)), + Debito = f.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()), + PercentualDebito = ((f.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) == 0m) ? 0m : (f.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) / lancamentos.Where((Lancamento s) => s.Controle != null && (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)) + })).ToList() + }; + val2.Dados.Add(new DadosFechamento + { + Planos = "TOTAL", + Credito = val2.Dados.Sum((DadosFechamento t) => t.Credito), + Debito = val2.Dados.Sum((DadosFechamento t) => t.Debito), + PercentualCredito = ((val2.Dados.Sum((DadosFechamento t) => t.Credito) == 0m) ? 0m : (val2.Dados.Sum((DadosFechamento t) => t.Credito) / lancamentos.Where((Lancamento s) => s.Controle != null && (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)), + PercentualDebito = ((val2.Dados.Sum((DadosFechamento t) => t.Debito) == 0m) ? 0m : (val2.Dados.Sum((DadosFechamento t) => t.Debito) / lancamentos.Where((Lancamento s) => s.Controle != null && (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)) + }); + Fechamento.Add(val2); + FechamentoFinanceiro val3 = new FechamentoFinanceiro + { + Plano = "TRANSFERÊNCIA", + Dados = (from x in lancamentos.Where(delegate(Lancamento x) + { + ControleFinanceiro controle4 = x.Controle; + return ((controle4 != null) ? controle4.Plano : null) == null; + }) + orderby x.Conta.Descricao + group x by ((DomainBase)x.Conta).Id).Select((Func, DadosFechamento>)((IGrouping f) => new DadosFechamento + { + Planos = f.First().Conta.Descricao, + Credito = f.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()), + PercentualCredito = ((f.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) == 0m) ? 0m : (f.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) / f.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)), + Debito = f.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()), + PercentualDebito = ((f.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) == 0m) ? 0m : (f.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) / f.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)) + })).ToList() + }; + val3.Dados.Add(new DadosFechamento + { + Planos = "TOTAL", + Credito = val3.Dados.Sum((DadosFechamento t) => t.Credito), + Debito = val3.Dados.Sum((DadosFechamento t) => t.Debito), + PercentualCredito = ((val3.Dados.Sum((DadosFechamento t) => t.Credito) == 0m) ? 0m : (val3.Dados.Sum((DadosFechamento t) => t.Credito) / lancamentos.Where(delegate(Lancamento s) + { + //IL_0015: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Invalid comparison between Unknown and I4 + ControleFinanceiro controle3 = s.Controle; + return ((controle3 != null) ? controle3.Plano : null) == null && (int)s.Sinal == 0; + }).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)), + PercentualDebito = ((val3.Dados.Sum((DadosFechamento t) => t.Debito) == 0m) ? 0m : (val3.Dados.Sum((DadosFechamento t) => t.Debito) / lancamentos.Where(delegate(Lancamento s) + { + //IL_0015: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Invalid comparison between Unknown and I4 + ControleFinanceiro controle2 = s.Controle; + return ((controle2 != null) ? controle2.Plano : null) == null && (int)s.Sinal == 1; + }).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)) + }); + Fechamento.Add(val3); + FechamentoFinanceiro val4 = new FechamentoFinanceiro + { + Plano = "CONTA CORRENTE + TRANSFERÊNCIA", + Dados = (from x in lancamentos + orderby x.Conta.Descricao + group x by ((DomainBase)x.Conta).Id).Select((Func, DadosFechamento>)((IGrouping f) => new DadosFechamento + { + Planos = f.First().Conta.Descricao, + Credito = f.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()), + PercentualCredito = ((f.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) == 0m) ? 0m : (f.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) / lancamentos.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)), + Debito = f.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()), + PercentualDebito = ((f.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) == 0m) ? 0m : (f.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) / lancamentos.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)) + })).ToList() + }; + val4.Dados.Add(new DadosFechamento + { + Planos = "TOTAL", + Credito = val4.Dados.Sum((DadosFechamento t) => t.Credito), + Debito = val4.Dados.Sum((DadosFechamento t) => t.Debito), + PercentualCredito = ((val4.Dados.Sum((DadosFechamento t) => t.Credito) == 0m) ? 0m : (val4.Dados.Sum((DadosFechamento t) => t.Credito) / lancamentos.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)), + PercentualDebito = ((val4.Dados.Sum((DadosFechamento t) => t.Debito) == 0m) ? 0m : (val4.Dados.Sum((DadosFechamento t) => t.Debito) / lancamentos.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)) + }); + Fechamento.Add(val4); + FechamentoFinanceiro val5 = new FechamentoFinanceiro + { + Plano = "CENTRO DE CUSTO", + Dados = (from x in lancamentos.Where(delegate(Lancamento x) + { + ControleFinanceiro controle = x.Controle; + return ((controle != null) ? controle.Plano : null) != null; + }) + orderby x.Controle.Centro.Descricao + group x by ((DomainBase)x.Controle.Centro).Id).Select((Func, DadosFechamento>)((IGrouping f) => new DadosFechamento + { + Planos = f.First().Controle.Centro.Descricao, + Credito = f.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()), + PercentualCredito = ((f.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) == 0m) ? 0m : (f.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) / lancamentos.Where((Lancamento s) => s.Controle != null && (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)), + Debito = f.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()), + PercentualDebito = ((f.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) == 0m) ? 0m : (f.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) / lancamentos.Where((Lancamento s) => s.Controle != null && (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)) + })).ToList() + }; + val5.Dados.Add(new DadosFechamento + { + Planos = "TOTAL", + Credito = val5.Dados.Sum((DadosFechamento t) => t.Credito), + Debito = val5.Dados.Sum((DadosFechamento t) => t.Debito), + PercentualCredito = ((val5.Dados.Sum((DadosFechamento t) => t.Credito) == 0m) ? 0m : (val5.Dados.Sum((DadosFechamento t) => t.Credito) / lancamentos.Where((Lancamento s) => s.Controle != null && (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)), + PercentualDebito = ((val5.Dados.Sum((DadosFechamento t) => t.Debito) == 0m) ? 0m : (val5.Dados.Sum((DadosFechamento t) => t.Debito) / lancamentos.Where((Lancamento s) => s.Controle != null && (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)) + }); + Fechamento.Add(val5); + FechamentoFinanceiro val6 = new FechamentoFinanceiro + { + Plano = "TIPO PAGAMENTO", + Dados = (from x in lancamentos + orderby EnumHelper.GetDescription(x.TipoPagamento) + group x by x.TipoPagamento).Select((Func, DadosFechamento>)((IGrouping f) => new DadosFechamento + { + Planos = EnumHelper.GetDescription(f.First().TipoPagamento), + Credito = f.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()), + PercentualCredito = ((f.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) == 0m) ? 0m : (f.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) / lancamentos.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)), + Debito = f.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()), + PercentualDebito = ((f.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) == 0m) ? 0m : (f.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) / lancamentos.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)) + })).ToList() + }; + val6.Dados.Add(new DadosFechamento + { + Planos = "TOTAL", + Credito = val6.Dados.Sum((DadosFechamento t) => t.Credito), + Debito = val6.Dados.Sum((DadosFechamento t) => t.Debito), + PercentualCredito = ((val6.Dados.Sum((DadosFechamento t) => t.Credito) == 0m) ? 0m : (val6.Dados.Sum((DadosFechamento t) => t.Credito) / lancamentos.Where((Lancamento s) => (int)s.Sinal == 0).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)), + PercentualDebito = ((val6.Dados.Sum((DadosFechamento t) => t.Debito) == 0m) ? 0m : (val6.Dados.Sum((DadosFechamento t) => t.Debito) / lancamentos.Where((Lancamento s) => (int)s.Sinal == 1).Sum((Lancamento s) => s.ValorPago.GetValueOrDefault()) * 100m)), + Soma = val6.Dados.Sum((DadosFechamento t) => t.Credito) - val6.Dados.Sum((DadosFechamento t) => t.Debito), + SomaPercentual = ((val6.Dados.Sum((DadosFechamento t) => t.Credito) + val6.Dados.Sum((DadosFechamento t) => t.Debito) == 0m) ? 0m : ((val6.Dados.Sum((DadosFechamento t) => t.Credito) - val6.Dados.Sum((DadosFechamento t) => t.Debito)) * 100m / (val6.Dados.Sum((DadosFechamento t) => t.Credito) + val6.Dados.Sum((DadosFechamento t) => t.Debito)))) + }); + Fechamento.Add(val6); + } + HtmlContent = await GerarHtml(screen: true); + } + + private async Task GerarHtml(bool screen) + { + string relatorio = ""; + if (Analitico) + { + foreach (FechamentoFinanceiroAnalitico x3 in FechamentoAnalitico) + { + string body = await Funcoes.GenerateTable(x3.Dados, new List(), grafico: false, screen); + relatorio += Funcoes.CreateCard(x3.NomeConta, body); + } + } + else + { + foreach (FechamentoFinanceiro x2 in Fechamento) + { + string body2 = await Funcoes.GenerateTable(x2.Dados, new List { "TOTAL CRÉDITO - TOTAL DÉBITO", "% TOTAL DE CRÉDITO - % TOTAL DE DÉBITO" }, grafico: false, screen); + relatorio += Funcoes.CreateCard(x2.Plano, body2); + } + FechamentoFinanceiro total = new FechamentoFinanceiro + { + Plano = "TOTAL NO PERÍODO", + Dados = new List + { + new DadosFechamento + { + Planos = "TOTAL", + Soma = Fechamento.Where((FechamentoFinanceiro x) => x.Plano == "TIPO PAGAMENTO").Sum((FechamentoFinanceiro x) => x.Dados.Sum((DadosFechamento y) => y.Soma)), + SomaPercentual = Fechamento.Where((FechamentoFinanceiro x) => x.Plano == "TIPO PAGAMENTO").Sum((FechamentoFinanceiro x) => x.Dados.Sum((DadosFechamento y) => y.SomaPercentual)) + } + } + }; + string body3 = await Funcoes.GenerateTable(total.Dados, new List { "TOTAL CRÉDITO", "TOTAL DÉBITO", "% CRÉDITO", "% DÉBITO" }, grafico: false, screen); + relatorio += Funcoes.CreateCard(total.Plano, body3); + } + if (Inicio.HasValue && Fim.HasValue) + { + return Funcoes.ExportarHtml(new TipoRelatorio + { + Nome = (Analitico ? "RELATÓRIO FECHAMENTO FINANCEIRO ANALÍTICO" : "RELATÓRIO FECHAMENTO FINANCEIRO"), + Inicio = Inicio.Value, + Fim = Fim.Value + }, relatorio, "50", "portrait"); + } + return null; + } + + public async Task Print() + { + string path = Path.GetTempPath(); + string value = await GerarHtml(screen: false); + string text = $"{path}FECHAMENTO_FINANCEIRO_{Funcoes.GetNetworkTime():ddMMyyyyhhmmss}.html"; + StreamWriter streamWriter = new StreamWriter(text, append: true, Encoding.UTF8); + streamWriter.Write(value); + streamWriter.Close(); + Process.Start(text); + } + + public async Task GerarExcel() + { + string text = ""; + string fileName; + if (Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 41)) + { + FolderBrowserDialog val = new FolderBrowserDialog(); + try + { + if (1 != (int)((CommonDialog)val).ShowDialog()) + { + return; + } + text = val.SelectedPath + "\\"; + Directory.CreateDirectory(text); + } + finally + { + ((IDisposable)val)?.Dispose(); + } + fileName = text + "FECHAMENTO " + Functions.GetNetworkTime().Date.ToShortDateString().Replace("/", "") + ".xlsx"; + } + else + { + text = Path.GetTempPath(); + fileName = $"{text}{Guid.NewGuid()}.xlsx"; + } + XLWorkbook val2 = new XLWorkbook(); + int index2 = 1; + if (Analitico) + { + if (FechamentoAnalitico == null || FechamentoAnalitico.Count == 0) + { + return; + } + foreach (FechamentoFinanceiroAnalitico item in FechamentoAnalitico) + { + string text2 = $"{index2}_{item.NomeConta}"; + while (text2.Replace("/", "_").Trim().Length > 30) + { + text2 = Regex.Replace(text2.Trim(), "[^\\s]*$", ""); + } + val2 = await Funcoes.GerarXls(val2, text2.Replace("/", "_"), item.Dados.ToList()); + } + } + else + { + if (Fechamento == null || Fechamento.Count == 0) + { + return; + } + List list = new List(); + list.AddRange(Fechamento); + list.Add(new FechamentoFinanceiro + { + Plano = "TOTAL NO PERÍODO", + Dados = new List + { + new DadosFechamento + { + Planos = "TOTAL", + Soma = Fechamento.Where((FechamentoFinanceiro x) => x.Plano == "TIPO PAGAMENTO").Sum((FechamentoFinanceiro x) => x.Dados.Sum((DadosFechamento y) => y.Soma)) + } + } + }); + index2 = 1; + foreach (FechamentoFinanceiro item2 in list) + { + string text3 = $"{index2}_{item2.Plano}"; + index2++; + while (text3.Replace("/", "_").Trim().Length > 30) + { + text3 = Regex.Replace(text3.Trim(), "[^\\s]*$", ""); + } + val2 = await Funcoes.GerarXls(val2, text3.Replace("/", "_"), item2.Dados.ToList()); + } + } + RegistrarAcao($"EMITIU EXCEL DO RELATÓRIO PERÍODO ENTRE {Inicio:d} E {Fim:d}", (Relatorio)11); + val2.SaveAs(fileName); + Process.Start(fileName); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Financeiro/BancosContasViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Financeiro/BancosContasViewModel.cs new file mode 100644 index 0000000..579dbd1 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Financeiro/BancosContasViewModel.cs @@ -0,0 +1,542 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Media; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Financeiro; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Financeiro; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.Helper; + +namespace Gestor.Application.ViewModels.Financeiro; + +public class BancosContasViewModel : BaseFinanceiroViewModel +{ + private readonly BancosContasServico _bancosContasServico; + + public BancosContas CancelBancosContas; + + private long _ultimoId; + + private BancosContas _selectedBancosContas; + + private SolidColorBrush _corDoSaldo = new SolidColorBrush(Colors.Green); + + private ObservableCollection _bancosContasFiltrados = new ObservableCollection(); + + private bool _isExpanded; + + private ObservableCollection _saldos = new ObservableCollection(); + + private bool _habilitarFecharSaldo; + + private Saldo _selectedSaldo = new Saldo(); + + private string _saldoAtual; + + private decimal? _valorAbertura; + + private DateTime? _dataAbertura; + + private bool _incluindo; + + public List BancosContas { get; set; } + + public BancosContas SelectedBancosContas + { + get + { + return _selectedBancosContas; + } + set + { + _selectedBancosContas = value; + CarregarSaldos(value); + VerificarEnables((value != null) ? new long?(((DomainBase)value).Id) : null); + Incluindo = value != null && ((DomainBase)value).Id == 0; + OnPropertyChanged("SelectedBancosContas"); + } + } + + public SolidColorBrush CorDoSaldo + { + get + { + return _corDoSaldo; + } + set + { + _corDoSaldo = value; + OnPropertyChanged("CorDoSaldo"); + } + } + + public ObservableCollection BancosContasFiltrados + { + get + { + return _bancosContasFiltrados; + } + set + { + _bancosContasFiltrados = value; + IsExpanded = value != null && value.Count > 0; + OnPropertyChanged("BancosContasFiltrados"); + } + } + + public bool IsExpanded + { + get + { + return _isExpanded; + } + set + { + _isExpanded = value; + OnPropertyChanged("IsExpanded"); + } + } + + public ObservableCollection Saldos + { + get + { + return _saldos; + } + set + { + _saldos = value; + if (value != null && value.Count > 0) + { + SelectedSaldo = ((IEnumerable)value).FirstOrDefault((Func)((Saldo x) => !x.DataFinal.HasValue)); + if (SelectedSaldo == null) + { + UltimoSladoNaoAberto(); + } + } + OnPropertyChanged("Saldos"); + } + } + + public bool HabilitarFecharSaldo + { + get + { + return _habilitarFecharSaldo; + } + set + { + _habilitarFecharSaldo = value; + OnPropertyChanged("HabilitarFecharSaldo"); + } + } + + public Saldo SelectedSaldo + { + get + { + return _selectedSaldo; + } + set + { + _selectedSaldo = value; + int habilitarFecharSaldo; + if (value != null && !value.DataFinal.HasValue) + { + Usuario usuario = Recursos.Usuario; + habilitarFecharSaldo = ((usuario != null && ((DomainBase)usuario).Id > 0) ? 1 : 0); + } + else + { + habilitarFecharSaldo = 0; + } + HabilitarFecharSaldo = (byte)habilitarFecharSaldo != 0; + OnPropertyChanged("SelectedSaldo"); + Saldo selectedSaldo = SelectedSaldo; + if (selectedSaldo != null) + { + ((DomainBase)selectedSaldo).Initialize(); + } + } + } + + public string SaldoAtual + { + get + { + return _saldoAtual; + } + set + { + _saldoAtual = value; + OnPropertyChanged("SaldoAtual"); + } + } + + public decimal? ValorAbertura + { + get + { + return _valorAbertura; + } + set + { + _valorAbertura = value; + OnPropertyChanged("ValorAbertura"); + } + } + + public DateTime? DataAbertura + { + get + { + return _dataAbertura; + } + set + { + _dataAbertura = value; + OnPropertyChanged("DataAbertura"); + } + } + + public bool Incluindo + { + get + { + return _incluindo; + } + set + { + _incluindo = value; + OnPropertyChanged("Incluindo"); + } + } + + public BancosContasViewModel() + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_0010: Expected O, but got Unknown + //IL_0027: Unknown result type (might be due to invalid IL or missing references) + //IL_0031: Expected O, but got Unknown + _bancosContasServico = new BancosContasServico(); + Seleciona(); + } + + public async void CarregarSaldos(BancosContas banco) + { + if (banco == null || ((DomainBase)banco).Id == 0L) + { + return; + } + List source = await _bancosContasServico.BuscarSaldos(((DomainBase)banco).Id); + CorDoSaldo = new SolidColorBrush(Colors.Green); + SaldoAtual = string.Empty; + Saldos = new ObservableCollection(source.OrderByDescending((Saldo x) => x.DataInicio)); + if (Saldos.FirstOrDefault() != null) + { + Saldo saldo = new Saldo + { + Conta = Saldos.First().Conta, + ValorInicio = Saldos.First().ValorInicio, + DataInicio = Saldos.First().DataInicio, + DataFinal = Funcoes.GetNetworkTime() + }; + saldo = await _bancosContasServico.FecharSaldo(saldo); + decimal? valorFinal = saldo.ValorFinal; + if ((valorFinal.GetValueOrDefault() < default(decimal)) & valorFinal.HasValue) + { + CorDoSaldo = new SolidColorBrush(Colors.Red); + } + SaldoAtual = $"SALDO: {Math.Round(saldo.ValorFinal.GetValueOrDefault(), 2):c}"; + } + } + + private async void UltimoSladoNaoAberto() + { + Saldo ultimoSaldo = Saldos.ToList().Find(delegate(Saldo x) + { + DateTime? dataInicio = x.DataInicio; + DateTime? dateTime = Saldos.Max((Saldo r) => r.DataInicio); + if (dataInicio.HasValue != dateTime.HasValue) + { + return false; + } + return !dataInicio.HasValue || dataInicio.GetValueOrDefault() == dateTime.GetValueOrDefault(); + }); + bool flag = ultimoSaldo.DataFinal.HasValue; + if (flag) + { + flag = await ShowMessage("O ÚLTIMO SALDO NÃO ESTÁ ABERTO. DESEJA ABRÍ-LO AGORA?", "SIM", "NÃO"); + } + if (flag) + { + ultimoSaldo.DataFinal = null; + ultimoSaldo.ValorFinal = null; + SelectedSaldo = await _bancosContasServico.Save(ultimoSaldo); + SelectedBancosContas = SelectedBancosContas; + } + } + + private async void Seleciona() + { + Loading(isLoading: true); + await PermissaoTela((TipoTela)26); + await SelecionaBancosDeContas(); + Loading(isLoading: false); + } + + private async Task SelecionaBancosDeContas() + { + Loading(isLoading: true); + List list = await _bancosContasServico.BuscarBancos(); + BancosContas = (from x in list + orderby x.Ativo descending, x.Descricao + select x).ToList(); + BancosContasFiltrados = new ObservableCollection(BancosContas); + if (BancosContasFiltrados.Count > 0) + { + SelecionaBancosContas(BancosContasFiltrados.First()); + } + else + { + SelectedBancosContas = new BancosContas(); + Saldos = new ObservableCollection(); + DataAbertura = null; + ValorAbertura = default(decimal); + SaldoAtual = ""; + Alterar(alterar: false); + base.EnableMenu = false; + } + Recursos.BancosContas = list; + Loading(isLoading: false); + } + + public void Incluir() + { + //IL_0040: Unknown result type (might be due to invalid IL or missing references) + //IL_0045: Unknown result type (might be due to invalid IL or missing references) + //IL_0051: Expected O, but got Unknown + _ultimoId = ((DomainBase)SelectedBancosContas).Id; + DataAbertura = null; + ValorAbertura = default(decimal); + SaldoAtual = ""; + SelectedBancosContas = new BancosContas + { + Ativo = true + }; + Saldos = new ObservableCollection(); + SelectedSaldo = null; + Alterar(alterar: true); + } + + public async Task>> Salvar() + { + List> list = SelectedBancosContas.Validate(); + list.AddRange(Validate()); + if (list.Count > 0) + { + return list; + } + BancosContas conta = await _bancosContasServico.Save(SelectedBancosContas); + if (!_bancosContasServico.Sucesso) + { + return null; + } + if (((DomainBase)SelectedBancosContas).Id == 0L && DataAbertura.HasValue && ValorAbertura.HasValue) + { + Saldo saldo = new Saldo + { + Conta = conta, + DataInicio = DataAbertura.Value, + ValorInicio = ValorAbertura.Value + }; + await _bancosContasServico.Save(saldo); + if (!_bancosContasServico.Sucesso) + { + return null; + } + } + await SelecionaBancosDeContas(); + SelecionaBancosContas(conta); + Recursos.BancosContas = BancosContas; + Alterar(alterar: false); + ToggleSnackBar("CONTA SALVA COM SUCESSO"); + return null; + } + + public List> Validate() + { + List> list = new List>(); + if (BancosContas.Where((BancosContas x) => x.Descricao == SelectedBancosContas.Descricao && ((DomainBase)x).Id != ((DomainBase)SelectedBancosContas).Id).Any()) + { + ValidationHelper.AddValue(list, "Descricao|DESCRIÇÃO", "NÃO É POSSÍVEL SALVAR MAIS DE UMA CONTA COM A MESMA DESCRIÇÃO.", true); + } + if (((DomainBase)SelectedBancosContas).Id == 0L) + { + if (!DataAbertura.HasValue) + { + ValidationHelper.AddValue(list, "DataAbertura|ABERTURA", "É NECESSÁRIO PREENCHER A DATA DE ABERTURA DA CONTA.", true); + } + else if (DateTime.Compare(DataAbertura.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(DataAbertura.Value, new DateTime(9999, 12, 31)) > 0) + { + ValidationHelper.AddValue(list, "DataAbertura|ABERTURA", "DATA INVÁLIDA", true); + } + if (!ValorAbertura.HasValue) + { + ValidationHelper.AddValue(list, "ValorAbertura|VALOR", "É NECESSÁRIO PREENCHER O VALOR DE ABERTURA DA CONTA.", true); + } + } + return list; + } + + public async void CancelarAlteracao() + { + Loading(isLoading: true); + if (((DomainBase)SelectedBancosContas).Id > 0) + { + await SelecionaBancosDeContas(); + } + SelecionaBancosContas(((IEnumerable)BancosContasFiltrados).FirstOrDefault((Func)((BancosContas x) => ((DomainBase)x).Id == _ultimoId)) ?? BancosContasFiltrados.FirstOrDefault()); + Alterar(alterar: false); + Loading(isLoading: false); + } + + public async void Excluir() + { + if (SelectedBancosContas == null || ((DomainBase)SelectedBancosContas).Id == 0L) + { + return; + } + if (await new BaseServico().BancosContasUtilizado(((DomainBase)SelectedBancosContas).Id)) + { + await ShowMessage("NÃO PODE SER EXCLUÍDO POIS ESTÁ SENDO UTILIZADO EM UM LANÇAMENTO."); + } + else if (await ShowMessage("DESEJA REALMENTE EXCLUIR A CONTA " + SelectedBancosContas.Descricao + " PERMANENTEMENTE?", "SIM", "NÃO")) + { + Loading(isLoading: true); + if (!(await _bancosContasServico.Delete(SelectedBancosContas))) + { + Loading(isLoading: false); + return; + } + await SelecionaBancosDeContas(); + Loading(isLoading: false); + ToggleSnackBar("CONTA EXCLUÍDA COM SUCESSO"); + } + } + + public async void ExcluirSaldo() + { + if (SelectedSaldo == null || ((DomainBase)SelectedSaldo).Id == 0L) + { + return; + } + if (Saldos.Count <= 1) + { + await ShowMessage("NÃO É POSSÍVEL EXCLUIR O SALDO INICIAL DA CONTA."); + } + else + { + if (!(await ShowMessage("DESEJA REALMENTE EXCLUIR O SALDO PERMANENTEMENTE?", "SIM", "NÃO"))) + { + return; + } + Loading(isLoading: true); + Saldo val = ((IEnumerable)Saldos).FirstOrDefault((Func)delegate(Saldo x) + { + DateTime? dataFinal = x.DataFinal; + DateTime? dataInicio = SelectedSaldo.DataInicio; + if (dataFinal.HasValue != dataInicio.HasValue) + { + return false; + } + return !dataFinal.HasValue || dataFinal.GetValueOrDefault() == dataInicio.GetValueOrDefault(); + }); + if (val == null) + { + Loading(isLoading: false); + await ShowMessage("NÃO É POSSÍVEL EXCLUIR O SALDO DA CONTA."); + return; + } + val.DataFinal = null; + val.ValorFinal = null; + await _bancosContasServico.Save(val); + if (!_bancosContasServico.Sucesso) + { + Loading(isLoading: false); + return; + } + if (!(await _bancosContasServico.DeleteSaldo(SelectedSaldo))) + { + Loading(isLoading: false); + return; + } + CarregarSaldos(SelectedBancosContas); + Loading(isLoading: false); + ToggleSnackBar("SALDO EXCLUÍDO COM SUCESSO"); + Loading(isLoading: false); + } + } + + public void SelecionaBancosContas(BancosContas bancosContas) + { + Loading(isLoading: true); + SelectedBancosContas = ((IEnumerable)BancosContasFiltrados).FirstOrDefault((Func)((BancosContas x) => ((DomainBase)x).Id == ((DomainBase)bancosContas).Id)); + Loading(isLoading: false); + } + + internal async Task> Filtrar(string value) + { + return await Task.Run(() => FiltrarBancosContas(value)); + } + + public List FiltrarBancosContas(string filter) + { + BancosContasFiltrados = (string.IsNullOrWhiteSpace(filter) ? new ObservableCollection(BancosContas) : new ObservableCollection(from x in BancosContas + where ValidationHelper.RemoveDiacritics(x.Descricao.Trim()).ToUpper().Contains(ValidationHelper.RemoveDiacritics(filter)) + orderby x.Ativo descending, x.Descricao + select x)); + return BancosContasFiltrados.ToList(); + } + + public async Task FecharSaldo() + { + SelectedSaldo = await _bancosContasServico.Save(SelectedSaldo); + if (!_bancosContasServico.Sucesso) + { + return; + } + if (SelectedSaldo.DataFinal.HasValue && SelectedSaldo.ValorFinal.HasValue) + { + Saldo saldo = new Saldo + { + Conta = SelectedSaldo.Conta, + DataFinal = null, + DataInicio = SelectedSaldo.DataFinal.Value, + ValorFinal = null, + ValorInicio = SelectedSaldo.ValorFinal.Value + }; + await _bancosContasServico.Save(saldo); + if (!_bancosContasServico.Sucesso) + { + return; + } + } + CarregarSaldos(SelectedBancosContas); + ToggleSnackBar("SALDO FECHADO COM SUCESSO"); + } + + public async Task CalcularValor() + { + return (await _bancosContasServico.FecharSaldo(SelectedSaldo)).ValorFinal.GetValueOrDefault(); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Financeiro/CentroDeCustoViewmodel.cs b/Decompiler/Gestor.Application.ViewModels.Financeiro/CentroDeCustoViewmodel.cs new file mode 100644 index 0000000..8f7427a --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Financeiro/CentroDeCustoViewmodel.cs @@ -0,0 +1,219 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using Gestor.Application.Servicos.Financeiro; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Financeiro; +using Gestor.Model.Domain.Generic; + +namespace Gestor.Application.ViewModels.Financeiro; + +public class CentroDeCustoViewmodel : BaseFinanceiroViewModel +{ + private readonly CentroServico _centroServico; + + private ObservableCollection _centrosFiltrados = new ObservableCollection(); + + private bool _isExpanded; + + private Centro _selectedCentro; + + private bool _ativo; + + private long _ultimoId; + + public Centro CancelCentro; + + public List Centros { get; set; } + + public ObservableCollection CentrosFiltrados + { + get + { + return _centrosFiltrados; + } + set + { + _centrosFiltrados = value; + IsExpanded = value != null && value.Count > 0; + OnPropertyChanged("CentrosFiltrados"); + } + } + + public bool IsExpanded + { + get + { + return _isExpanded; + } + set + { + _isExpanded = value; + OnPropertyChanged("IsExpanded"); + } + } + + public Centro SelectedCentro + { + get + { + return _selectedCentro; + } + set + { + _selectedCentro = value; + if (((DomainBase)value).Id > 0) + { + _ultimoId = ((DomainBase)value).Id; + } + VerificarEnables(((DomainBase)value).Id); + OnPropertyChanged("SelectedCentro"); + } + } + + public bool Ativo + { + get + { + return _ativo; + } + set + { + _ativo = bool.Parse(value.ToString()); + OnPropertyChanged("Ativo"); + } + } + + public CentroDeCustoViewmodel() + { + _centroServico = new CentroServico(); + base.EnableMenu = true; + Seleciona(); + } + + private async void Seleciona() + { + Loading(isLoading: true); + await PermissaoTela((TipoTela)29); + await SelecionaCentro(); + await SelecionaCentro(CentrosFiltrados.FirstOrDefault()); + Loading(isLoading: false); + } + + private async Task SelecionaCentro(Centro centros) + { + if (centros == null) + { + Alterar(alterar: false); + base.EnableMenu = false; + base.EnableAlterar = false; + return; + } + Loading(isLoading: true); + List source = await new BaseServico().BuscarCentroAsync(); + DomainBase.Copy(CentrosFiltrados.First((Centro x) => ((DomainBase)x).Id == ((DomainBase)centros).Id), source.First((Centro x) => ((DomainBase)x).Id == ((DomainBase)centros).Id)); + SelectedCentro = CentrosFiltrados.First((Centro x) => ((DomainBase)x).Id == ((DomainBase)centros).Id); + Loading(isLoading: false); + } + + public void SelecionaCentroDeCusto(Centro centro) + { + SelectedCentro = CentrosFiltrados.First((Centro x) => ((DomainBase)x).Id == ((DomainBase)centro).Id); + } + + public void Incluir() + { + //IL_001a: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + //IL_002b: Expected O, but got Unknown + Centro selectedCentro = SelectedCentro; + _ultimoId = ((selectedCentro != null) ? ((DomainBase)selectedCentro).Id : 0); + SelectedCentro = new Centro + { + Ativo = true + }; + Alterar(alterar: true); + } + + public async Task>> Validate() + { + List> errors = new List>(); + bool valida = true; + List list = await new BaseServico().BuscarCentroAsync(); + if (list.Count > 0) + { + list.ForEach(delegate(Centro x) + { + if (((DomainBase)x).Id != ((DomainBase)SelectedCentro).Id && x.Descricao == SelectedCentro.Descricao && x.IdEmpresa == SelectedCentro.IdEmpresa) + { + valida = false; + } + }); + } + if (!valida) + { + errors.Add(new KeyValuePair("Descricao", "UM CENTRO COM ESSE NOME JÁ EXISTE.")); + } + return errors; + } + + public async Task>> Salvar() + { + List> errorMessages = SelectedCentro.Validate(); + List> list = errorMessages; + list.AddRange(await Validate()); + if (errorMessages.Count > 0) + { + return errorMessages; + } + SelectedCentro = await _centroServico.Save(SelectedCentro); + if (!_centroServico.Sucesso) + { + return null; + } + await SelecionaCentro(); + await SelecionaCentro(CentrosFiltrados.First((Centro x) => ((DomainBase)x).Id == ((DomainBase)SelectedCentro).Id)); + Alterar(alterar: false); + ToggleSnackBar("CENTRO DE CUSTO SALVO COM SUCESSO"); + return null; + } + + public async void CancelarAlteracao() + { + Loading(isLoading: true); + Alterar(alterar: false); + if (((DomainBase)SelectedCentro).Id > 0) + { + await SelecionaCentro(); + } + await SelecionaCentro(((IEnumerable)CentrosFiltrados).FirstOrDefault((Func)((Centro x) => ((DomainBase)x).Id == _ultimoId))); + Loading(isLoading: false); + } + + private async Task SelecionaCentro() + { + Centros = (from x in await new BaseServico().BuscarCentroAsync() + orderby x.Ativo descending, x.Descricao, x.Descricao + select x).ToList(); + CentrosFiltrados = new ObservableCollection(Centros); + } + + public async Task> Filtrar(string value) + { + return await Task.Run(() => FiltrarCentro(value)); + } + + public List FiltrarCentro(string filter) + { + CentrosFiltrados = (string.IsNullOrWhiteSpace(filter) ? new ObservableCollection(Centros) : new ObservableCollection(from x in Centros + where ValidationHelper.RemoveDiacritics(x.Descricao.Trim()).ToUpper().Contains(ValidationHelper.RemoveDiacritics(filter)) + orderby Ativo descending, x.Descricao + select x)); + return CentrosFiltrados.ToList(); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Financeiro/ContasDialogModel.cs b/Decompiler/Gestor.Application.ViewModels.Financeiro/ContasDialogModel.cs new file mode 100644 index 0000000..16dc049 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Financeiro/ContasDialogModel.cs @@ -0,0 +1,46 @@ +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Domain.Financeiro; + +namespace Gestor.Application.ViewModels.Financeiro; + +public class ContasDialogModel : BaseViewModel +{ + private ObservableCollection _contasFiltradas; + + private BancosContas _conta; + + public ObservableCollection ContasFiltradas + { + get + { + return _contasFiltradas; + } + set + { + _contasFiltradas = value; + OnPropertyChanged("ContasFiltradas"); + } + } + + public BancosContas Conta + { + get + { + return _conta; + } + set + { + _conta = value; + OnPropertyChanged("Conta"); + } + } + + public ContasDialogModel(List contas) + { + ContasFiltradas = new ObservableCollection(contas); + Conta = ContasFiltradas.FirstOrDefault(); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Financeiro/CopiarClienteViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Financeiro/CopiarClienteViewModel.cs new file mode 100644 index 0000000..d6702d5 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Financeiro/CopiarClienteViewModel.cs @@ -0,0 +1,22 @@ +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Financeiro; + +public class CopiarClienteViewModel : BaseSegurosViewModel +{ + private Cliente _selectedCliente; + + public Cliente SelectedCliente + { + get + { + return _selectedCliente; + } + set + { + _selectedCliente = value; + OnPropertyChanged("SelectedCliente"); + } + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Financeiro/ExtratoContaViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Financeiro/ExtratoContaViewModel.cs new file mode 100644 index 0000000..6c57232 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Financeiro/ExtratoContaViewModel.cs @@ -0,0 +1,408 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Forms; +using System.Windows.Media; +using ClosedXML.Excel; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Financeiro; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Helpers; +using Gestor.Model.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Financeiro; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Relatorios; + +namespace Gestor.Application.ViewModels.Financeiro; + +public class ExtratoContaViewModel : BaseFinanceiroViewModel +{ + private Geometry _maximizeRestore = Geometry.Parse((string)Application.Current.Resources[(object)"Restore"]); + + private string _head; + + private readonly FinanceiroServico _servico; + + private ObservableCollection _contas; + + private ObservableCollection _contasFilter; + + private BancosContas _selectedConta; + + private DateTime? _inicio = new DateTime(Funcoes.GetNetworkTime().Date.Year, Funcoes.GetNetworkTime().Date.Month, 1); + + private DateTime? _fim = Funcoes.GetNetworkTime(); + + private static ObservableCollection _bancosContas = new ObservableCollection { "TODOS", "ATIVOS", "INATIVOS" }; + + private string _selectedBancosContas = "TODOS"; + + private ObservableCollection _extrato; + + private bool _saldoFinal; + + private bool _naoHaDados; + + public Geometry MaximizeRestore + { + get + { + return _maximizeRestore; + } + set + { + _maximizeRestore = value; + OnPropertyChanged("MaximizeRestore"); + } + } + + public string Head + { + get + { + return _head; + } + set + { + _head = value; + OnPropertyChanged("Head"); + } + } + + public ObservableCollection Contas + { + get + { + return _contas; + } + set + { + _contas = value; + OnPropertyChanged("Contas"); + } + } + + public ObservableCollection ContasFilter + { + get + { + return _contasFilter; + } + set + { + _contasFilter = value; + OnPropertyChanged("ContasFilter"); + } + } + + public BancosContas SelectedConta + { + get + { + return _selectedConta; + } + set + { + _selectedConta = value; + OnPropertyChanged("SelectedConta"); + } + } + + public DateTime? Inicio + { + get + { + return _inicio; + } + set + { + _inicio = value; + OnPropertyChanged("Inicio"); + } + } + + public DateTime? Fim + { + get + { + return _fim; + } + set + { + _fim = value; + OnPropertyChanged("Fim"); + } + } + + public ObservableCollection BancosContas + { + get + { + return _bancosContas; + } + set + { + _bancosContas = value; + OnPropertyChanged("BancosContas"); + } + } + + public string SelectedBancosContas + { + get + { + return _selectedBancosContas; + } + set + { + _selectedBancosContas = value; + if (value == null || Contas == null || Contas.Count <= 0) + { + return; + } + switch (value) + { + case "TODOS": + ContasFilter = Contas; + break; + case "ATIVOS": + ContasFilter = new ObservableCollection(Contas.Where((BancosContas x) => x.Ativo).ToList()); + break; + case "INATIVOS": + ContasFilter = new ObservableCollection(Contas.Where((BancosContas x) => !x.Ativo).ToList()); + break; + } + OnPropertyChanged("SelectedBancosContas"); + } + } + + public ObservableCollection Extrato + { + get + { + return _extrato; + } + set + { + _extrato = value; + NaoHaDados = value == null || value.Count == 0; + OnPropertyChanged("Extrato"); + } + } + + public bool SaldoFinal + { + get + { + return _saldoFinal; + } + set + { + _saldoFinal = value; + OnPropertyChanged("SaldoFinal"); + } + } + + public bool NaoHaDados + { + get + { + return _naoHaDados; + } + set + { + _naoHaDados = value; + OnPropertyChanged("NaoHaDados"); + } + } + + public ExtratoContaViewModel(long id) + { + _servico = new FinanceiroServico(); + BuscaInicial(id); + } + + private async void BuscaInicial(long id) + { + Loading(isLoading: true); + List source = await new BancosContasServico().BuscarBancos(); + Contas = new ObservableCollection(source.OrderBy((BancosContas x) => x.Descricao)); + ContasFilter = new ObservableCollection(source.OrderBy((BancosContas x) => x.Descricao)); + SelectedConta = ((id > 0) ? ((IEnumerable)Contas).FirstOrDefault((Func)((BancosContas x) => ((DomainBase)x).Id == id)) : Contas.FirstOrDefault()); + await GerarRelatorio(); + Loading(isLoading: false); + } + + public void LimparRelatorio() + { + Extrato = null; + } + + public async Task GerarRelatorio() + { + if (SelectedConta == null || ((DomainBase)SelectedConta).Id == 0L || !Inicio.HasValue || !Fim.HasValue) + { + return; + } + BancosContasServico servico = new BancosContasServico(); + Saldo val = await servico.BuscarSaldoInicial(((DomainBase)SelectedConta).Id); + if (((val != null) ? val.DataInicio : null) > Inicio) + { + ShowMessage("DATA DE INÍCIO É MENOR QUE A CRIAÇÃO DA CONTA " + val.Conta.Descricao + ",\nDATA DE ABERTURA " + val.DataInicio?.ToString("dd/MM/yyyy")); + NaoHaDados = true; + return; + } + List lancamentos = await _servico.BuscarLancamentosPorConta(Inicio.Value, Fim.Value, ((DomainBase)SelectedConta).Id); + Saldo val2 = await servico.BuscarSaldo(Inicio.Value, ((DomainBase)SelectedConta).Id); + if (lancamentos.Count == 0) + { + NaoHaDados = true; + return; + } + if (val2 == null) + { + val2 = new Saldo + { + Conta = SelectedConta, + DataInicio = Inicio, + ValorInicio = 0m + }; + } + val2.DataFinal = Inicio.Value; + val2.ValorFinal = default(decimal); + val2 = await servico.FecharSaldo(val2); + List extrato = new List(); + ExtratoConta val3 = new ExtratoConta + { + Baixa = Inicio.Value, + Fornecedor = "SALDO INICIAL", + Valor = val2.ValorFinal.GetValueOrDefault(), + Sinal = (Sinal)((val2.ValorFinal.GetValueOrDefault() < 0m) ? 1 : 0), + Bold = true + }; + extrato.Add(val3); + decimal? saldoDia = val3.Valor; + (from x in lancamentos + orderby x.Baixa + group x by x.Baixa).ToList().ForEach(delegate(IGrouping g) + { + //IL_002a: Unknown result type (might be due to invalid IL or missing references) + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0040: Unknown result type (might be due to invalid IL or missing references) + //IL_004b: Unknown result type (might be due to invalid IL or missing references) + //IL_00b4: Unknown result type (might be due to invalid IL or missing references) + //IL_0143: Unknown result type (might be due to invalid IL or missing references) + //IL_014b: Expected O, but got Unknown + List list2 = lancamentos.Where(delegate(ExtratoConta x) + { + DateTime? baixa = x.Baixa; + DateTime? key = g.Key; + if (baixa.HasValue != key.HasValue) + { + return false; + } + return !baixa.HasValue || baixa.GetValueOrDefault() == key.GetValueOrDefault(); + }).ToList(); + ExtratoConta val5 = new ExtratoConta + { + Baixa = g.Key, + Fornecedor = "SALDO FINAL DO DIA", + Valor = saldoDia + list2.Sum((ExtratoConta x) => x.Valor) + }; + decimal? num2 = saldoDia + list2.Sum((ExtratoConta x) => x.Valor); + val5.Sinal = (Sinal)(((num2.GetValueOrDefault() < default(decimal)) & num2.HasValue) ? 1 : 0); + val5.Bold = true; + ExtratoConta val6 = val5; + if (!SaldoFinal) + { + extrato.AddRange(list2); + } + extrato.Add(val6); + saldoDia = val6.Valor; + }); + List list = extrato; + ExtratoConta val4 = new ExtratoConta + { + Baixa = Fim.Value, + Fornecedor = "SALDO FINAL", + Valor = saldoDia + }; + decimal? num = saldoDia; + val4.Sinal = (Sinal)(((num.GetValueOrDefault() < default(decimal)) & num.HasValue) ? 1 : 0); + val4.Bold = true; + list.Add(val4); + Extrato = new ObservableCollection(extrato); + } + + public async Task Print() + { + if (Extrato == null || Extrato.Count == 0) + { + ShowMessage("NÃO HÁ DADOS PARA A IMPRESSÃO"); + return; + } + string dados = await Funcoes.GenerateTable(Extrato.ToList(), new List()); + TipoRelatorio val = new TipoRelatorio + { + Nome = "EXTRATO CONTA - " + SelectedConta.Descricao, + Inicio = (Inicio ?? DateTime.MinValue), + Fim = (Fim ?? DateTime.MinValue) + }; + val.Nome = ((val.Nome.Length < 30) ? val.Nome : val.Nome.Substring(0, 30)); + string value = Funcoes.ExportarHtml(val, dados, "60", "portrait"); + string tempPath = Path.GetTempPath(); + string text = string.Format("{0}{1}_{2:ddMMyyyyhhmmss}.html", tempPath, new Regex("[" + Regex.Escape(new string(Path.GetInvalidFileNameChars()) + new string(Path.GetInvalidPathChars())) + "]").Replace(val.Nome, ""), Funcoes.GetNetworkTime()); + StreamWriter streamWriter = new StreamWriter(text, append: true, Encoding.UTF8); + streamWriter.Write(value); + streamWriter.Close(); + Process.Start(text); + } + + public async Task GerarExcel() + { + if (Extrato == null || Extrato.Count == 0) + { + ShowMessage("NÃO HÁ DADOS PARA A IMPRESSÃO EM EXCEL"); + return; + } + List analitico = Extrato.ToList(); + string text = ""; + string fileName; + if (Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 41)) + { + FolderBrowserDialog val = new FolderBrowserDialog(); + try + { + if (1 != (int)((CommonDialog)val).ShowDialog()) + { + return; + } + text = val.SelectedPath + "\\"; + Directory.CreateDirectory(text); + } + finally + { + ((IDisposable)val)?.Dispose(); + } + fileName = text + "EXTRATO CONTA - " + SelectedConta.Descricao + " " + Functions.GetNetworkTime().Date.ToShortDateString().Replace("/", "") + ".xlsx"; + } + else + { + text = Path.GetTempPath(); + fileName = $"{text}{Guid.NewGuid()}.xlsx"; + } + XLWorkbook val2 = new XLWorkbook(); + string text2 = "EXTRATO CONTA - " + SelectedConta.Descricao; + text2 = ((text2.Length < 30) ? text2 : text2.Substring(0, 30)); + (await Funcoes.GerarXls(val2, text2, analitico, new List())).SaveAs(fileName); + Process.Start(fileName); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Financeiro/FinanceiroViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Financeiro/FinanceiroViewModel.cs new file mode 100644 index 0000000..61db9ae --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Financeiro/FinanceiroViewModel.cs @@ -0,0 +1,4400 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Forms; +using ClosedXML.Excel; +using CsQuery.ExtensionMethods; +using Gestor.Application.Actions; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Financeiro; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels.Generic; +using Gestor.Application.Views.Relatorios; +using Gestor.Common.Helpers; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Financeiro; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Relatorios; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.Helper; +using OfxSharpLib; + +namespace Gestor.Application.ViewModels.Financeiro; + +public class FinanceiroViewModel : BaseFinanceiroViewModel +{ + private readonly FinanceiroServico _servico; + + private bool _enableIncluirNovo; + + private bool _enableChanges; + + private SinteticoFinanceiroTipo _sinteticoTipo; + + private Visibility _isVisibleData; + + private Visibility _isVisibleFornecedor = (Visibility)2; + + private Visibility _isVisiblePersonalizado = (Visibility)2; + + private Visibility _isVisibleFiltros = (Visibility)2; + + private Visibility _isVisibleLancamento; + + private Visibility _isvisibleStatus; + + private FiltroLancamento _selectedFiltro; + + private FiltroLancamentoData _selectedFiltroData; + + private StatusLancamento _selectedStatus; + + private StatusLancamento _selectedStatusImportacao = (StatusLancamento)2; + + private Visibility _botaoSalvarVisibility; + + private DateTime? _inicio = Funcoes.GetNetworkTime(); + + private DateTime? _fim = Funcoes.GetNetworkTime().AddDays(7.0); + + private Fornecedor _selectedFornecedor; + + private ObservableCollection _saldos = new ObservableCollection(); + + private Saldo _selectedSaldo = new Saldo(); + + private ObservableCollection _lancamentos = new ObservableCollection(); + + private bool _dontSort; + + private ObservableCollection _lancamentosFiltrados = new ObservableCollection(); + + private ObservableCollection _lancamentosFiltradosCopia = new ObservableCollection(); + + private ObservableCollection _lancamentosVinculo = new ObservableCollection(); + + private Lancamento _lancamentoVinculo; + + private Lancamento _selectedLancamento; + + private Fornecedor _fornecedorInclusao; + + private long _idLancamento; + + private string _historico; + + private string _observacao; + + private string _documento; + + private string _complemento; + + private string _competencia; + + private int _parcela; + + private double _dropDownHeight; + + private int _parcelas; + + public bool VencimentoAlterado; + + private DateTime _vencimento; + + private DateTime? _baixa; + + private DateTime? _pagamento; + + private decimal _valor; + + private decimal? _valorPago; + + private Sinal _sinal; + + private Planos _plano; + + private Centro _centro; + + private BancosContas _conta; + + private TipoPagamento _tipoPagamento; + + private List _planosFiltro; + + private List _centroFiltro; + + private List _contaFiltro; + + private List _planos; + + private ObservableCollection _planosFiltrados; + + private List _contas; + + private ObservableCollection _contasFiltradas; + + private List _centros; + + private ObservableCollection _centrosFiltrados; + + private ObservableCollection _totalizacao; + + private Visibility _visibilityFornecedor; + + private Visibility _visibilityCentro; + + private Visibility _visibilityConta; + + private Visibility _alterando = (Visibility)2; + + private bool _buscaHabilitada = true; + + private bool _alteracao = true; + + private List _filtroRelatorioPersonalizado; + + private List _filtros; + + private ObservableCollection _personalizadoSelecionado; + + private ObservableCollection _filtroRelatorioSelecionado = new ObservableCollection(); + + private Visibility _visibilitySemValor = (Visibility)2; + + private FiltroPersonalizado _filtro; + + private Type _tipoString = typeof(string); + + private Type _tipoEnum = typeof(Enum); + + private Type _tipoDateTime = typeof(DateTime); + + private Type _tipoDecimal = typeof(decimal); + + private Type _tipoInt = typeof(int); + + private Type _tipoLong = typeof(long); + + private string _valorIncial = ""; + + private string _valorFinal = ""; + + private bool _semValor; + + private List _filtroPersonalizado; + + private ObservableCollection _filtroPersonalizadoSelecionado = new ObservableCollection(); + + private Visibility _visibleFiltros = (Visibility)2; + + private Visibility _visibleOlho = (Visibility)2; + + private bool importando; + + private bool _isExpanded; + + public bool EnableIncluirNovo + { + get + { + return _enableIncluirNovo; + } + set + { + _enableIncluirNovo = value; + OnPropertyChanged("EnableIncluirNovo"); + } + } + + public bool EnableChanges + { + get + { + return _enableChanges; + } + set + { + _enableChanges = value; + OnPropertyChanged("EnableChanges"); + } + } + + public SinteticoFinanceiroTipo SinteticoTipo + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _sinteticoTipo; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _sinteticoTipo = value; + OnPropertyChanged("SinteticoTipo"); + } + } + + public Visibility IsVisibleData + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _isVisibleData; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _isVisibleData = value; + OnPropertyChanged("IsVisibleData"); + } + } + + public Visibility IsVisibleFornecedor + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _isVisibleFornecedor; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _isVisibleFornecedor = value; + OnPropertyChanged("IsVisibleFornecedor"); + } + } + + public Visibility IsVisiblePersonalizado + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _isVisiblePersonalizado; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _isVisiblePersonalizado = value; + OnPropertyChanged("IsVisiblePersonalizado"); + } + } + + public Visibility IsVisibleFiltros + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _isVisibleFiltros; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _isVisibleFiltros = value; + OnPropertyChanged("IsVisibleFiltros"); + } + } + + public Visibility IsVisibleLancamento + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _isVisibleLancamento; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _isVisibleLancamento = value; + OnPropertyChanged("IsVisibleLancamento"); + } + } + + public Visibility IsvisibleStatus + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _isvisibleStatus; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _isvisibleStatus = value; + OnPropertyChanged("IsvisibleStatus"); + } + } + + public FiltroLancamento SelectedFiltro + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _selectedFiltro; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _selectedFiltro = value; + LimparLancamentos(); + OnPropertyChanged("SelectedFiltro"); + } + } + + public FiltroLancamentoData SelectedFiltroData + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _selectedFiltroData; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _selectedFiltroData = value; + LimparLancamentos(); + OnPropertyChanged("SelectedFiltroData"); + } + } + + public StatusLancamento SelectedStatus + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _selectedStatus; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _selectedStatus = value; + LimparLancamentos(); + OnPropertyChanged("SelectedStatus"); + } + } + + public StatusLancamento SelectedStatusImportacao + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _selectedStatusImportacao; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _selectedStatusImportacao = value; + OnPropertyChanged("SelectedStatusImportacao"); + } + } + + public Visibility BotaoSalvarVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _isvisibleStatus; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _isvisibleStatus = value; + OnPropertyChanged("BotaoSalvarVisibility"); + } + } + + public DateTime? Inicio + { + get + { + return _inicio; + } + set + { + if (value.HasValue && value.Value < new DateTime(1754, 1, 1)) + { + value = new DateTime(1754, 1, 1); + } + if (value.HasValue && value.Value > new DateTime(9999, 12, 31)) + { + value = new DateTime(9999, 12, 31); + } + _inicio = value; + OnPropertyChanged("Inicio"); + } + } + + public DateTime? Fim + { + get + { + return _fim; + } + set + { + if (value.HasValue && value.Value < new DateTime(1754, 1, 1)) + { + value = new DateTime(1754, 1, 1); + } + if (value.HasValue && value.Value > new DateTime(9999, 12, 31)) + { + value = new DateTime(9999, 12, 31); + } + _fim = value; + OnPropertyChanged("Fim"); + } + } + + public Fornecedor SelectedFornecedor + { + get + { + return _selectedFornecedor; + } + set + { + _selectedFornecedor = value; + LimparLancamentos(); + OnPropertyChanged("SelectedFornecedor"); + } + } + + public ObservableCollection Saldos + { + get + { + return _saldos; + } + set + { + _saldos = value; + OnPropertyChanged("Saldos"); + } + } + + public Saldo SelectedSaldo + { + get + { + return _selectedSaldo; + } + set + { + _selectedSaldo = value; + OnPropertyChanged("SelectedSaldo"); + } + } + + public ObservableCollection Lancamentos + { + get + { + return _lancamentos; + } + set + { + _lancamentos = value; + OnPropertyChanged("Lancamentos"); + } + } + + public ObservableCollection LancamentosFiltrados + { + get + { + return _lancamentosFiltrados; + } + set + { + if (!_dontSort) + { + Gestor.Application.Actions.Actions.SaveSortLancamentos?.Invoke(); + } + _lancamentosFiltrados = value; + Totalizar(); + OnPropertyChanged("LancamentosFiltrados"); + if (!_dontSort) + { + Gestor.Application.Actions.Actions.SortLancamentos?.Invoke(); + } + } + } + + public ObservableCollection LancamentosFiltradosCopia + { + get + { + return _lancamentosFiltradosCopia; + } + set + { + _lancamentosFiltradosCopia = value; + OnPropertyChanged("LancamentosFiltradosCopia"); + } + } + + private bool Salvando { get; set; } + + public ObservableCollection LancamentosVinculo + { + get + { + return _lancamentosVinculo; + } + set + { + _lancamentosVinculo = value; + OnPropertyChanged("LancamentosVinculo"); + } + } + + public Lancamento LancamentoVinculo + { + get + { + return _lancamentoVinculo; + } + set + { + _lancamentoVinculo = value; + OnPropertyChanged("LancamentoVinculo"); + } + } + + public Lancamento SelectedLancamento + { + get + { + return _selectedLancamento; + } + set + { + if (value != null && ((DomainBase)value).Id != 0L) + { + IdLancamento = ((DomainBase)value).Id; + } + else if (importando) + { + IdLancamento = 0L; + } + int enableIncluirNovo; + if (value != null && ((DomainBase)value).Id > 0) + { + Usuario usuario = Recursos.Usuario; + enableIncluirNovo = ((usuario != null && ((DomainBase)usuario).Id > 0) ? 1 : 0); + } + else + { + enableIncluirNovo = 0; + } + EnableIncluirNovo = (byte)enableIncluirNovo != 0; + _selectedLancamento = value; + int enableButtons; + if (value != null && ((DomainBase)value).Id > 0) + { + Usuario usuario2 = Recursos.Usuario; + enableButtons = ((usuario2 != null && ((DomainBase)usuario2).Id > 0) ? 1 : 0); + } + else + { + enableButtons = 0; + } + base.EnableButtons = (byte)enableButtons != 0; + Usuario usuario3 = Recursos.Usuario; + EnableChanges = usuario3 != null && ((DomainBase)usuario3).Id > 0; + Alteracao = value != null && ((DomainBase)value.Controle).Id > 0; + OnPropertyChanged("SelectedLancamento"); + Feed(value); + if (value != null && ((DomainBase)value).Id != 0L) + { + LancamentoSelecionado = value; + } + } + } + + public Fornecedor FornecedorInclusao + { + get + { + return _fornecedorInclusao; + } + set + { + //IL_017a: Unknown result type (might be due to invalid IL or missing references) + //IL_0172: Unknown result type (might be due to invalid IL or missing references) + _fornecedorInclusao = value; + OnPropertyChanged("FornecedorInclusao"); + Lancamento selectedLancamento = SelectedLancamento; + if ((selectedLancamento == null || ((DomainBase)selectedLancamento).Id <= 0) && value != null && value.Id != 0L && Carregar) + { + Plano = (Planos)((Importando && Plano != null) ? ((object)Plano) : ((object)(((IEnumerable)PlanosFiltrados).FirstOrDefault((Func)((Planos x) => ((DomainBase)x).Id == value.IdPlano)) ?? ((PlanosFiltrados.Count == 1) ? PlanosFiltrados.First() : null)))); + Centro = (Centro)((Importando && Centro != null) ? ((object)Centro) : ((object)(((IEnumerable)CentrosFiltrados).FirstOrDefault((Func)((Centro x) => ((DomainBase)x).Id == value.IdCentro)) ?? ((CentrosFiltrados.Count == 1) ? CentrosFiltrados.First() : null)))); + Conta = (BancosContas)((Importando && Conta != null) ? ((object)Conta) : ((object)(((IEnumerable)ContasFiltradas).FirstOrDefault((Func)((BancosContas x) => ((DomainBase)x).Id == value.IdConta)) ?? ((ContasFiltradas.Count == 1) ? ContasFiltradas.First() : null)))); + TipoPagamento = (Importando ? TipoPagamento : value.TipoPagamento.GetValueOrDefault()); + } + } + } + + public long IdLancamento + { + get + { + return _idLancamento; + } + set + { + _idLancamento = value; + OnPropertyChanged("IdLancamento"); + } + } + + public string Historico + { + get + { + return _historico; + } + set + { + _historico = value; + OnPropertyChanged("Historico"); + } + } + + public string Observacao + { + get + { + return _observacao; + } + set + { + _observacao = value; + OnPropertyChanged("Observacao"); + } + } + + public string Documento + { + get + { + return _documento; + } + set + { + _documento = value; + OnPropertyChanged("Documento"); + } + } + + public string Complemento + { + get + { + return _complemento; + } + set + { + _complemento = value; + OnPropertyChanged("Complemento"); + } + } + + public string Competencia + { + get + { + return _competencia; + } + set + { + _competencia = value; + OnPropertyChanged("Competencia"); + } + } + + public int Parcela + { + get + { + return _parcela; + } + set + { + _parcela = value; + OnPropertyChanged("Parcela"); + } + } + + public double DropDownHeight + { + get + { + return _dropDownHeight; + } + set + { + _dropDownHeight = value; + OnPropertyChanged("DropDownHeight"); + } + } + + public int Parcelas + { + get + { + return _parcelas; + } + set + { + _parcelas = value; + OnPropertyChanged("Parcelas"); + } + } + + public DateTime VencimentoAnt { get; set; } + + public DateTime Vencimento + { + get + { + return _vencimento; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + if ((int)Alterando == 0 && value != VencimentoAnt) + { + VencimentoAlterado = true; + } + VencimentoAnt = value; + _vencimento = value; + OnPropertyChanged("Vencimento"); + } + } + + public DateTime? Baixa + { + get + { + return _baixa; + } + set + { + _baixa = value; + OnPropertyChanged("Baixa"); + } + } + + public DateTime? Pagamento + { + get + { + return _pagamento; + } + set + { + _pagamento = value; + OnPropertyChanged("Pagamento"); + } + } + + public decimal Valor + { + get + { + return _valor; + } + set + { + _valor = value; + if (Vencimento <= Funcoes.GetNetworkTime().Date) + { + ValorPago = value; + } + OnPropertyChanged("Valor"); + } + } + + public decimal? ValorPago + { + get + { + return _valorPago; + } + set + { + _valorPago = value; + OnPropertyChanged("ValorPago"); + } + } + + public Sinal Sinal + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _sinal; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _sinal = value; + OnPropertyChanged("Sinal"); + } + } + + public Planos Plano + { + get + { + return _plano; + } + set + { + //IL_0030: Unknown result type (might be due to invalid IL or missing references) + //IL_0028: Unknown result type (might be due to invalid IL or missing references) + _plano = value; + OnPropertyChanged("Plano"); + if (value != null && ((DomainBase)value).Id != 0L) + { + Sinal = (importando ? Sinal : value.Sinal); + } + } + } + + public Centro Centro + { + get + { + return _centro; + } + set + { + _centro = value; + OnPropertyChanged("Centro"); + } + } + + public BancosContas Conta + { + get + { + return _conta; + } + set + { + _conta = value; + OnPropertyChanged("Conta"); + } + } + + public TipoPagamento TipoPagamento + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _tipoPagamento; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _tipoPagamento = value; + OnPropertyChanged("TipoPagamento"); + } + } + + private bool Carregar { get; set; } = true; + + + public string CodigoBanco { get; set; } + + public List PlanosFiltro + { + get + { + return _planosFiltro; + } + set + { + _planosFiltro = value; + OnPropertyChanged("PlanosFiltro"); + } + } + + public List CentroFiltro + { + get + { + return _centroFiltro; + } + set + { + _centroFiltro = value; + OnPropertyChanged("CentroFiltro"); + } + } + + public List ContaFiltro + { + get + { + return _contaFiltro; + } + set + { + _contaFiltro = value; + OnPropertyChanged("ContaFiltro"); + } + } + + public List Planos + { + get + { + return _planos; + } + set + { + _planos = value; + OnPropertyChanged("Planos"); + } + } + + public ObservableCollection PlanosFiltrados + { + get + { + return _planosFiltrados; + } + set + { + _planosFiltrados = value; + OnPropertyChanged("PlanosFiltrados"); + } + } + + public List Contas + { + get + { + return _contas; + } + set + { + _contas = value; + OnPropertyChanged("Contas"); + } + } + + public ObservableCollection ContasFiltradas + { + get + { + return _contasFiltradas; + } + set + { + _contasFiltradas = value; + OnPropertyChanged("ContasFiltradas"); + } + } + + public List Centros + { + get + { + return _centros; + } + set + { + _centros = value; + OnPropertyChanged("Centros"); + } + } + + public ObservableCollection CentrosFiltrados + { + get + { + return _centrosFiltrados; + } + set + { + _centrosFiltrados = value; + OnPropertyChanged("CentrosFiltrados"); + } + } + + public ObservableCollection Totalizacao + { + get + { + return _totalizacao; + } + set + { + _totalizacao = value; + OnPropertyChanged("Totalizacao"); + } + } + + public bool Importando + { + get + { + return importando; + } + set + { + importando = value; + OnPropertyChanged("Importando"); + } + } + + public bool NotImportando => !Importando; + + public Visibility VisibilityFornecedor + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityFornecedor; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityFornecedor = value; + OnPropertyChanged("VisibilityFornecedor"); + } + } + + public Visibility VisibilityCentro + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityCentro; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityCentro = value; + OnPropertyChanged("VisibilityCentro"); + } + } + + public Visibility VisibilityConta + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityConta; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityConta = value; + OnPropertyChanged("VisibilityConta"); + } + } + + public Visibility Alterando + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _alterando; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _alterando = value; + OnPropertyChanged("Alterando"); + } + } + + public bool BuscaHabilitada + { + get + { + return _buscaHabilitada; + } + set + { + _buscaHabilitada = value; + OnPropertyChanged("BuscaHabilitada"); + } + } + + public bool Alteracao + { + get + { + return _alteracao; + } + set + { + _alteracao = value; + OnPropertyChanged("Alteracao"); + } + } + + public List RelatorioFiltroPersonalizado + { + get + { + return _filtroRelatorioPersonalizado; + } + set + { + _filtroRelatorioPersonalizado = value; + OnPropertyChanged("RelatorioFiltroPersonalizado"); + } + } + + public List Filtros + { + get + { + return _filtros; + } + set + { + _filtros = value; + OnPropertyChanged("Filtros"); + } + } + + public ObservableCollection PersonalizadoSelecionado + { + get + { + return _personalizadoSelecionado; + } + set + { + _personalizadoSelecionado = value; + OnPropertyChanged("PersonalizadoSelecionado"); + } + } + + public ObservableCollection FiltroRelatorioSelecionado + { + get + { + return _filtroRelatorioSelecionado; + } + set + { + _filtroRelatorioSelecionado = value; + OnPropertyChanged("FiltroRelatorioSelecionado"); + } + } + + public Visibility VisibilitySemValor + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilitySemValor; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilitySemValor = value; + OnPropertyChanged("VisibilitySemValor"); + } + } + + public FiltroPersonalizado Filtro + { + get + { + return _filtro; + } + set + { + _filtro = value; + VisibilitySemValor = (Visibility)((value == null) ? 2 : 0); + OnPropertyChanged("Filtro"); + if (value == null) + { + return; + } + string name = value.Tipo.Name; + if (name == null) + { + return; + } + switch (name.Length) + { + default: + return; + case 4: + { + char c = name[0]; + if (c != 'E') + { + if (c != 'l' || !(name == "long")) + { + return; + } + break; + } + if (!(name == "Enum")) + { + return; + } + goto IL_0121; + } + case 5: + switch (name[3]) + { + default: + return; + case '3': + if (!(name == "int32")) + { + return; + } + break; + case '6': + if (!(name == "int64")) + { + return; + } + break; + } + break; + case 6: + if (name == "String") + { + ValorInicial = ""; + ValorFinal = ""; + } + return; + case 7: + if (name == "Decimal") + { + ValorInicial = "0,00"; + ValorFinal = "0,00"; + } + return; + case 8: + if (!(name == "DateTime")) + { + return; + } + goto IL_0121; + case 3: + { + if (!(name == "int")) + { + return; + } + break; + } + IL_0121: + ValorInicial = null; + ValorFinal = null; + return; + } + ValorInicial = "0"; + ValorFinal = "0"; + } + } + + public Type TipoString + { + get + { + return _tipoString; + } + set + { + _tipoString = value; + OnPropertyChanged("TipoString"); + } + } + + public Type TipoEnum + { + get + { + return _tipoEnum; + } + set + { + _tipoEnum = value; + OnPropertyChanged("TipoEnum"); + } + } + + public Type TipoDateTime + { + get + { + return _tipoDateTime; + } + set + { + _tipoDateTime = value; + OnPropertyChanged("TipoDateTime"); + } + } + + public Type TipoDecimal + { + get + { + return _tipoDecimal; + } + set + { + _tipoDecimal = value; + OnPropertyChanged("TipoDecimal"); + } + } + + public Type TipoInt + { + get + { + return _tipoInt; + } + set + { + _tipoInt = value; + OnPropertyChanged("TipoInt"); + } + } + + public Type TipoLong + { + get + { + return _tipoLong; + } + set + { + _tipoLong = value; + OnPropertyChanged("TipoLong"); + } + } + + public string ValorInicial + { + get + { + return _valorIncial; + } + set + { + _valorIncial = value; + OnPropertyChanged("ValorInicial"); + } + } + + public string ValorFinal + { + get + { + return _valorFinal; + } + set + { + _valorFinal = value; + OnPropertyChanged("ValorFinal"); + } + } + + public bool SemValor + { + get + { + return _semValor; + } + set + { + _semValor = value; + if (value) + { + ValorInicial = null; + ValorFinal = null; + } + OnPropertyChanged("SemValor"); + } + } + + public List FiltroPersonalizado + { + get + { + return _filtroPersonalizado; + } + set + { + _filtroPersonalizado = value; + OnPropertyChanged("FiltroPersonalizado"); + } + } + + public ObservableCollection FiltroPersonalizadoSelecionado + { + get + { + return _filtroPersonalizadoSelecionado; + } + set + { + _filtroPersonalizadoSelecionado = value; + OnPropertyChanged("FiltroPersonalizadoSelecionado"); + } + } + + public AutoCompleteFilterPredicate FiltroPersonalizadoItemFilter => (string searchText, object obj) => ((FiltroPersonalizado)obj).Descricao.ToUpper().Contains(searchText.ToUpper()); + + public Visibility VisibleFiltros + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibleFiltros; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibleFiltros = value; + OnPropertyChanged("VisibleFiltros"); + } + } + + public Visibility VisibleOlho + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibleOlho; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibleOlho = value; + OnPropertyChanged("VisibleOlho"); + } + } + + private Lancamento LancamentoSelecionado { get; set; } + + public Func>> ValidationEvent => ValidateIncluir; + + public bool IsExpanded + { + get + { + return _isExpanded; + } + set + { + _isExpanded = value; + OnPropertyChanged("IsExpanded"); + } + } + + public FinanceiroViewModel() + { + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + //IL_0009: Unknown result type (might be due to invalid IL or missing references) + //IL_0010: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + //IL_0059: Unknown result type (might be due to invalid IL or missing references) + //IL_0063: Expected O, but got Unknown + //IL_0098: Unknown result type (might be due to invalid IL or missing references) + //IL_00b8: Unknown result type (might be due to invalid IL or missing references) + //IL_0140: Unknown result type (might be due to invalid IL or missing references) + //IL_0147: Unknown result type (might be due to invalid IL or missing references) + _servico = new FinanceiroServico(); + RelatorioFiltroPersonalizado = Funcoes.PopularFiltroFinanceiro(); + BuscaInicial(); + } + + public void FiltroImportacao() + { + //IL_000a: Unknown result type (might be due to invalid IL or missing references) + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0010: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Expected I4, but got Unknown + if (!importando) + { + return; + } + StatusLancamento selectedStatusImportacao = SelectedStatusImportacao; + switch ((int)selectedStatusImportacao) + { + case 0: + LancamentosFiltrados = new ObservableCollection(Lancamentos.Where((Lancamento x) => !x.Baixado)); + break; + case 1: + LancamentosFiltrados = new ObservableCollection(Lancamentos.Where((Lancamento x) => x.Baixado)); + break; + case 2: + LancamentosFiltrados = new ObservableCollection(Lancamentos); + break; + } + } + + public async Task CarregarSaldos() + { + Saldos = new ObservableCollection(); + BancosContasServico bancoServico = new BancosContasServico(); + foreach (BancosContas contasFiltrada in ContasFiltradas) + { + Saldo val = await bancoServico.BuscarSaldoAberto(((DomainBase)contasFiltrada).Id); + if (val != null) + { + val.DataFinal = Funcoes.GetNetworkTime().Date.AddDays(1.0); + val = await bancoServico.FecharSaldo(val); + Saldos.Add(val); + } + } + SelectedSaldo = Saldos.FirstOrDefault(); + } + + public void Feed(Lancamento lancamento) + { + //IL_00f7: Unknown result type (might be due to invalid IL or missing references) + //IL_01d9: Unknown result type (might be due to invalid IL or missing references) + if (lancamento != null && !Salvando && (importando || lancamento.Controle.Plano != null)) + { + Fornecedor fornecedor = lancamento.Controle.Fornecedor; + FornecedorInclusao = ((fornecedor != null && fornecedor.Id == 0) ? null : lancamento.Controle.Fornecedor); + Plano = ((lancamento.Controle.Plano != null) ? ((IEnumerable)PlanosFiltrados).FirstOrDefault((Func)((Planos x) => ((DomainBase)x).Id == ((DomainBase)lancamento.Controle.Plano).Id)) : null); + Centro = ((IEnumerable)CentrosFiltrados).FirstOrDefault((Func)((Centro x) => ((DomainBase)x).Id == ((DomainBase)lancamento.Controle.Centro).Id)); + Conta = ((lancamento.Conta != null) ? ((IEnumerable)ContasFiltradas).FirstOrDefault((Func)((BancosContas x) => ((DomainBase)x).Id == ((DomainBase)lancamento.Conta).Id)) : null); + TipoPagamento = lancamento.TipoPagamento; + Historico = lancamento.Historico; + Observacao = lancamento.Observacao; + Complemento = lancamento.Complemento; + Competencia = lancamento.Competencia; + Documento = lancamento.Documento; + Parcela = lancamento.Parcela; + Parcelas = lancamento.Controle.Parcelas; + Valor = lancamento.Valor; + ValorPago = lancamento.ValorPago; + Vencimento = lancamento.Vencimento; + Pagamento = lancamento.Pagamento; + Baixa = lancamento.Baixa; + Sinal = lancamento.Sinal; + CodigoBanco = lancamento.CodigoBanco; + } + } + + public void FeedImportando(Lancamento lancamento) + { + //IL_0148: Unknown result type (might be due to invalid IL or missing references) + if (lancamento != null && !Salvando && (importando || lancamento.Controle.Plano != null)) + { + Conta = ((Conta == null) ? ((IEnumerable)ContasFiltradas).FirstOrDefault((Func)((BancosContas x) => ((DomainBase)x).Id == ((DomainBase)lancamento.Conta).Id)) : null); + ((DomainBase)SelectedLancamento).Id = ((DomainBase)lancamento).Id; + ((DomainBase)SelectedLancamento.Controle).Id = ((DomainBase)lancamento.Controle).Id; + SelectedLancamento.Controle.Historico = lancamento.Controle.Historico; + SelectedLancamento.Baixado = lancamento.Baixa.HasValue; + decimal? valorPago = SelectedLancamento.ValorPago; + IdLancamento = ((DomainBase)lancamento).Id; + Plano = ((lancamento.Controle.Plano != null) ? ((IEnumerable)PlanosFiltrados).FirstOrDefault((Func)((Planos x) => ((DomainBase)x).Id == ((DomainBase)lancamento.Controle.Plano).Id)) : null); + Centro = ((IEnumerable)CentrosFiltrados).FirstOrDefault((Func)((Centro x) => ((DomainBase)x).Id == ((DomainBase)lancamento.Controle.Centro).Id)); + TipoPagamento = lancamento.TipoPagamento; + Historico = lancamento.Historico; + Observacao = lancamento.Observacao; + Complemento = lancamento.Complemento; + Documento = lancamento.Documento; + Parcela = lancamento.Parcela; + Parcelas = lancamento.Controle.Parcelas; + Valor = lancamento.Valor; + ValorPago = valorPago; + Vencimento = lancamento.Vencimento; + Pagamento = (lancamento.Pagamento.HasValue ? lancamento.Pagamento : Pagamento); + } + } + + public void BindImportando() + { + //IL_0045: Unknown result type (might be due to invalid IL or missing references) + //IL_004f: Expected O, but got Unknown + //IL_00dc: Unknown result type (might be due to invalid IL or missing references) + //IL_01a8: Unknown result type (might be due to invalid IL or missing references) + //IL_0062: Unknown result type (might be due to invalid IL or missing references) + //IL_006c: Expected O, but got Unknown + Carregar = false; + object obj = FornecedorInclusao; + if (obj == null) + { + Lancamento selectedLancamento = SelectedLancamento; + if (selectedLancamento == null) + { + obj = null; + } + else + { + ControleFinanceiro controle = selectedLancamento.Controle; + obj = ((controle != null) ? controle.Fornecedor : null); + } + } + FornecedorInclusao = (Fornecedor)obj; + Carregar = true; + if (SelectedLancamento == null) + { + SelectedLancamento = new Lancamento(); + } + if (SelectedLancamento.Controle == null) + { + SelectedLancamento.Controle = new ControleFinanceiro(); + } + SelectedLancamento.Controle.Fornecedor = FornecedorInclusao; + SelectedLancamento.Controle.Plano = Plano; + SelectedLancamento.Controle.Centro = Centro; + SelectedLancamento.Controle.Parcelas = Parcelas; + SelectedLancamento.Conta = Conta; + SelectedLancamento.TipoPagamento = TipoPagamento; + SelectedLancamento.Historico = Historico; + SelectedLancamento.Observacao = Observacao; + SelectedLancamento.Complemento = Complemento; + SelectedLancamento.Competencia = Competencia; + SelectedLancamento.Documento = Documento; + SelectedLancamento.Parcela = Parcela; + SelectedLancamento.Valor = Valor; + SelectedLancamento.ValorPago = ValorPago; + SelectedLancamento.Vencimento = Vencimento; + SelectedLancamento.Pagamento = Pagamento; + SelectedLancamento.Baixa = Baixa; + SelectedLancamento.Sinal = Sinal; + SelectedLancamento.CodigoBanco = CodigoBanco; + } + + public void Bind() + { + //IL_0045: Unknown result type (might be due to invalid IL or missing references) + //IL_004f: Expected O, but got Unknown + //IL_00ee: Unknown result type (might be due to invalid IL or missing references) + //IL_01ba: Unknown result type (might be due to invalid IL or missing references) + //IL_0062: Unknown result type (might be due to invalid IL or missing references) + //IL_006c: Expected O, but got Unknown + Carregar = false; + object obj = FornecedorInclusao; + if (obj == null) + { + Lancamento selectedLancamento = SelectedLancamento; + if (selectedLancamento == null) + { + obj = null; + } + else + { + ControleFinanceiro controle = selectedLancamento.Controle; + obj = ((controle != null) ? controle.Fornecedor : null); + } + } + FornecedorInclusao = (Fornecedor)obj; + Carregar = true; + if (SelectedLancamento == null) + { + SelectedLancamento = new Lancamento(); + } + if (SelectedLancamento.Controle == null) + { + SelectedLancamento.Controle = new ControleFinanceiro(); + } + Salvando = true; + ((DomainBase)SelectedLancamento).Initialize(); + SelectedLancamento.Controle.Fornecedor = FornecedorInclusao; + SelectedLancamento.Controle.Plano = Plano; + SelectedLancamento.Controle.Centro = Centro; + SelectedLancamento.Controle.Parcelas = Parcelas; + SelectedLancamento.Conta = Conta; + SelectedLancamento.TipoPagamento = TipoPagamento; + SelectedLancamento.Historico = Historico; + SelectedLancamento.Observacao = Observacao; + SelectedLancamento.Complemento = Complemento; + SelectedLancamento.Competencia = Competencia; + SelectedLancamento.Documento = Documento; + SelectedLancamento.Parcela = Parcela; + SelectedLancamento.Valor = Valor; + SelectedLancamento.ValorPago = ValorPago; + SelectedLancamento.Vencimento = Vencimento; + SelectedLancamento.Pagamento = Pagamento; + SelectedLancamento.Baixa = Baixa; + SelectedLancamento.Sinal = Sinal; + SelectedLancamento.CodigoBanco = CodigoBanco; + Salvando = false; + } + + private async void BuscaInicial() + { + Loading(isLoading: true); + Planos = await new PlanoServico().BuscarPlanos(); + PlanosFiltrados = new ObservableCollection(from x in Planos + where x.Ativo + orderby x.Descricao + select x); + Contas = await new BancosContasServico().BuscarBancos(); + ContasFiltradas = new ObservableCollection(from x in Contas + where x.Ativo + orderby x.Descricao + select x); + Centros = await new CentroServico().BuscarCentros(); + CentrosFiltrados = new ObservableCollection(from x in Centros + where x.Ativo + orderby x.Descricao + select x); + PlanosFiltro = new List(Planos.OrderBy((Planos x) => x.Descricao)); + ContaFiltro = new List(Contas.OrderBy((BancosContas x) => x.Descricao)); + CentroFiltro = new List(Centros.OrderBy((Centro x) => x.Descricao)); + PopularFiltro(); + await Buscar(); + Loading(isLoading: false); + } + + public void Totalizar() + { + //IL_0095: Unknown result type (might be due to invalid IL or missing references) + //IL_009a: Unknown result type (might be due to invalid IL or missing references) + //IL_009b: Unknown result type (might be due to invalid IL or missing references) + //IL_00a0: Unknown result type (might be due to invalid IL or missing references) + //IL_00a8: Unknown result type (might be due to invalid IL or missing references) + //IL_00b8: Expected O, but got Unknown + //IL_00b8: Unknown result type (might be due to invalid IL or missing references) + //IL_00e3: Unknown result type (might be due to invalid IL or missing references) + //IL_010e: Unknown result type (might be due to invalid IL or missing references) + //IL_0139: Unknown result type (might be due to invalid IL or missing references) + //IL_0164: Unknown result type (might be due to invalid IL or missing references) + //IL_018f: Unknown result type (might be due to invalid IL or missing references) + //IL_01ba: Unknown result type (might be due to invalid IL or missing references) + //IL_01ea: Expected O, but got Unknown + if (LancamentosFiltrados == null) + { + Totalizacao = null; + return; + } + List list = (from x in LancamentosFiltrados + where x.Conta != null + group x by new + { + ((DomainBase)x.Conta).Id, + x.Conta.Descricao + } into x + select new SinteticoFinanceiro + { + Conta = new BancosContas + { + Id = x.Key.Id, + Descricao = x.Key.Descricao + }, + Filtrados = x.Count(), + Credito = x.Sum((Lancamento s) => ((int)s.Sinal != 0) ? 0m : s.Valor), + Debito = x.Sum((Lancamento s) => ((int)s.Sinal != 0) ? (-s.Valor) : 0m), + Liquido = x.Sum((Lancamento s) => ((int)s.Sinal != 0) ? (-s.Valor) : s.Valor), + LiquidoPago = x.Sum((Lancamento s) => ((int)s.Sinal != 0) ? (-s.ValorPago) : s.ValorPago).GetValueOrDefault(), + Selecionados = x.Count((Lancamento s) => s.Selecionado), + LiquidoSelecionados = x.Where((Lancamento s) => s.Selecionado).Sum((Lancamento s) => ((int)s.Sinal != 0) ? (-s.ValorPago).GetValueOrDefault() : s.ValorPago.GetValueOrDefault()) + }).ToList(); + if (list.Count > 1) + { + list.Add(new SinteticoFinanceiro + { + Conta = new BancosContas + { + Id = 0L, + Descricao = "TOTAL" + }, + Filtrados = list.Sum((SinteticoFinanceiro x) => x.Filtrados), + Credito = list.Sum((SinteticoFinanceiro x) => x.Credito), + Debito = list.Sum((SinteticoFinanceiro x) => x.Debito), + Liquido = list.Sum((SinteticoFinanceiro x) => x.Liquido), + LiquidoPago = list.Sum((SinteticoFinanceiro x) => x.LiquidoPago), + Selecionados = list.Sum((SinteticoFinanceiro x) => x.Selecionados), + LiquidoSelecionados = list.Sum((SinteticoFinanceiro x) => x.LiquidoSelecionados) + }); + } + Totalizacao = new ObservableCollection(list); + } + + public async Task Buscar() + { + Importando = false; + if (!Inicio.HasValue || !Fim.HasValue) + { + await ShowMessage("NECESSÁRIO PREENCHER TANTO A DATA DE INÍCIO QUANTO A DATA FINAL PARA REALIZAR A PESQUISA."); + return; + } + if (Inicio > Fim) + { + await ShowMessage("A DATA DE INÍCIO NÃO PODE SER SUPERIOR A DATA FINAL."); + return; + } + PersonalizadoSelecionado = null; + FiltroLancamento selectedFiltro = SelectedFiltro; + List list; + switch (selectedFiltro - 1) + { + default: + list = await _servico.BuscarLancamentos(Inicio.Value, Fim.Value, SelectedStatus); + break; + case 2: + if (SelectedFornecedor == null) + { + return; + } + list = await _servico.BuscarLancamentosPorFornecedor(SelectedFornecedor.Id, SelectedStatus); + break; + case 0: + list = await _servico.BuscarLancamentosPorBaixa(Inicio.Value, Fim.Value); + break; + case 1: + list = await _servico.BuscarLancamentosPorPagamento(Inicio.Value, Fim.Value); + break; + case 3: + list = await _servico.BuscarLancamentosPorLancamento(Inicio.Value, Fim.Value, SelectedStatus); + break; + case 4: + { + List source = await _servico.BuscarLancamentosPersonalizados(Inicio.Value, Fim.Value, SelectedStatus, SelectedFiltroData); + List fornecedores = ((FiltroPersonalizadoSelecionado != null) ? (from x in FiltroPersonalizadoSelecionado + where (int)x.Tipo == 0 + select x.Id).ToList() : new List()); + List centros = ((FiltroPersonalizadoSelecionado != null) ? (from x in FiltroPersonalizadoSelecionado + where (int)x.Tipo == 2 + select x.Id).ToList() : new List()); + List planos = ((FiltroPersonalizadoSelecionado != null) ? (from x in FiltroPersonalizadoSelecionado + where (int)x.Tipo == 1 + select x.Id).ToList() : new List()); + List contas = ((FiltroPersonalizadoSelecionado != null) ? (from x in FiltroPersonalizadoSelecionado + where (int)x.Tipo == 3 + select x.Id).ToList() : new List()); + List sinal = ((FiltroPersonalizadoSelecionado != null) ? (from x in FiltroPersonalizadoSelecionado + where (int)x.Tipo == 4 + select x.Id).ToList() : new List()); + list = source.Where((Lancamento x) => (fornecedores.Count == 0 || (x.Controle.Fornecedor != null && fornecedores.Contains(x.Controle.Fornecedor.Id))) && (centros.Count == 0 || (x.Controle.Centro != null && centros.Contains(((DomainBase)x.Controle.Centro).Id))) && (planos.Count == 0 || (x.Controle.Plano != null && planos.Contains(((DomainBase)x.Controle.Plano).Id))) && (contas.Count == 0 || (x.Conta != null && contas.Contains(((DomainBase)x.Conta).Id))) && (sinal.Count == 0 || sinal.Contains((long)x.Sinal))).ToList(); + break; + } + } + list.ForEach(delegate(Lancamento x) + { + ((DomainBase)x).Initialize(); + }); + Lancamentos = new ObservableCollection(list); + LancamentosFiltrados = Lancamentos; + LancamentosFiltradosCopia = LancamentosFiltrados; + SelectedLancamento = LancamentosFiltrados.FirstOrDefault(); + await CarregarSaldos(); + } + + internal async Task BuscarLancamentosVinculo() + { + DateTime? obj; + if (SelectedLancamento.Conta == null) + { + obj = SelectedLancamento.Vencimento.AddDays(-5.0); + } + else + { + Saldo? obj2 = ((IEnumerable)Saldos).FirstOrDefault((Func)((Saldo x) => ((DomainBase)x).Id == ((DomainBase)SelectedLancamento.Conta).Id)); + obj = ((obj2 != null) ? obj2.DataInicio : null); + } + DateTime date = obj ?? SelectedLancamento.Vencimento.AddDays(-5.0); + List source = await _servico.BuscarLancamentosPorFornecedor(FornecedorInclusao.Id, date, Sinal); + List ids = Lancamentos.Select((Lancamento x) => ((DomainBase)x).Id).ToList(); + source = source.Where((Lancamento x) => !ids.Contains(((DomainBase)x).Id)).ToList(); + LancamentosVinculo = new ObservableCollection(source); + } + + public void FiltrarPersonalizado() + { + List fornecedores = ((FiltroPersonalizadoSelecionado != null) ? (from x in FiltroPersonalizadoSelecionado + where (int)x.Tipo == 0 + select x.Id).ToList() : new List()); + List centros = ((FiltroPersonalizadoSelecionado != null) ? (from x in FiltroPersonalizadoSelecionado + where (int)x.Tipo == 2 + select x.Id).ToList() : new List()); + List planos = ((FiltroPersonalizadoSelecionado != null) ? (from x in FiltroPersonalizadoSelecionado + where (int)x.Tipo == 1 + select x.Id).ToList() : new List()); + List contas = ((FiltroPersonalizadoSelecionado != null) ? (from x in FiltroPersonalizadoSelecionado + where (int)x.Tipo == 3 + select x.Id).ToList() : new List()); + List sinal = ((FiltroPersonalizadoSelecionado != null) ? (from x in FiltroPersonalizadoSelecionado + where (int)x.Tipo == 4 + select x.Id).ToList() : new List()); + List list = Lancamentos.Where((Lancamento x) => (fornecedores.Count == 0 || (x.Controle.Fornecedor != null && fornecedores.Contains(x.Controle.Fornecedor.Id))) && (centros.Count == 0 || (x.Controle.Centro != null && centros.Contains(((DomainBase)x.Controle.Centro).Id))) && (planos.Count == 0 || (x.Controle.Plano != null && planos.Contains(((DomainBase)x.Controle.Plano).Id))) && (contas.Count == 0 || (x.Conta != null && contas.Contains(((DomainBase)x.Conta).Id))) && (sinal.Count == 0 || sinal.Contains((long)x.Sinal))).ToList(); + LancamentosFiltrados = new ObservableCollection(list); + LancamentosFiltradosCopia = LancamentosFiltrados; + SelectedLancamento = LancamentosFiltrados.FirstOrDefault(); + } + + public async Task ParseOfx(BancosContas conta) + { + SelectedStatusImportacao = (StatusLancamento)2; + Importando = true; + VisibleFiltros = (Visibility)2; + List list = await ImportarOfx(); + if (list == null || list.Count == 0) + { + Importando = false; + return; + } + List codigoBanco = new List { "0237", "033" }; + List lancamentos = new List(); + foreach (OfxDocument x2 in list) + { + Tuple tuple = CorrigeLancamentos(x2, codigoBanco); + x2.StatementStart = tuple.Item1; + x2.StatementEnd = tuple.Item2; + List saved = await _servico.BuscarLancamentos(x2.StatementStart.AddDays(-5.0), x2.StatementEnd.AddDays(5.0), ((DomainBase)conta).Id); + x2.Transactions.ForEach(delegate(Transaction t) + { + //IL_00d9: Unknown result type (might be due to invalid IL or missing references) + //IL_00fc: Unknown result type (might be due to invalid IL or missing references) + //IL_0101: Unknown result type (might be due to invalid IL or missing references) + //IL_0106: Unknown result type (might be due to invalid IL or missing references) + //IL_0266: Unknown result type (might be due to invalid IL or missing references) + //IL_026b: Unknown result type (might be due to invalid IL or missing references) + //IL_026c: Unknown result type (might be due to invalid IL or missing references) + //IL_0271: Unknown result type (might be due to invalid IL or missing references) + //IL_0278: Unknown result type (might be due to invalid IL or missing references) + //IL_0298: Unknown result type (might be due to invalid IL or missing references) + //IL_029f: Unknown result type (might be due to invalid IL or missing references) + //IL_02a6: Unknown result type (might be due to invalid IL or missing references) + //IL_02c8: Expected O, but got Unknown + //IL_02c8: Unknown result type (might be due to invalid IL or missing references) + //IL_02de: Unknown result type (might be due to invalid IL or missing references) + //IL_02f9: Unknown result type (might be due to invalid IL or missing references) + //IL_0316: Unknown result type (might be due to invalid IL or missing references) + //IL_024c: Unknown result type (might be due to invalid IL or missing references) + //IL_025b: Unknown result type (might be due to invalid IL or missing references) + //IL_0254: Unknown result type (might be due to invalid IL or missing references) + //IL_0337: Unknown result type (might be due to invalid IL or missing references) + //IL_034d: Unknown result type (might be due to invalid IL or missing references) + //IL_035e: Unknown result type (might be due to invalid IL or missing references) + //IL_0374: Unknown result type (might be due to invalid IL or missing references) + //IL_038a: Unknown result type (might be due to invalid IL or missing references) + //IL_03a7: Unknown result type (might be due to invalid IL or missing references) + //IL_03a8: Unknown result type (might be due to invalid IL or missing references) + //IL_03ae: Unknown result type (might be due to invalid IL or missing references) + //IL_03cd: Unknown result type (might be due to invalid IL or missing references) + //IL_03d4: Unknown result type (might be due to invalid IL or missing references) + //IL_03f1: Unknown result type (might be due to invalid IL or missing references) + //IL_03f9: Expected O, but got Unknown + if (!(t.Date < x2.StatementStart.AddDays(-5.0)) || !(t.Date < x2.StatementEnd.AddDays(5.0)) || codigoBanco.Any((string c) => c == x2.Account.BankId.Trim())) + { + Sinal sinal = (Sinal)((t.Amount < 0m) ? 1 : 0); + Lancamento val = ((IEnumerable)saved).FirstOrDefault((Func)((Lancamento l) => ((l.ValorPago.HasValue && Math.Abs(l.ValorPago.Value) > 0m && Math.Abs(l.ValorPago.Value) == Math.Abs(t.Amount)) || Math.Abs(l.Valor) == Math.Abs(t.Amount)) && l.Sinal == sinal && l.Documento != null && t.TransactionId.Contains(l.Documento) && (l.Pagamento == t.Date || l.Vencimento == t.Date || (l.Vencimento >= t.Date.AddDays(-5.0) && l.Vencimento <= t.Date.AddDays(5.0))))); + TipoPagamento val2 = t.TransType.ParseTransactionType(); + string transactionId = t.TransactionId; + string documento = ((transactionId == null || transactionId.Trim().Length <= 50) ? t.TransactionId?.Trim() : t.TransactionId?.Trim()?.Substring(0, 50)); + if (val != null) + { + val.Baixado = val.Baixa.HasValue; + val.Conta = conta; + val.ValorPago = Math.Abs(t.Amount); + val.Competencia = t.Date.ToString("MM/yyyy"); + val.Baixa = ((!val.Baixa.HasValue) ? new DateTime?(t.Date) : val.Baixa); + val.Pagamento = ((!val.Pagamento.HasValue) ? new DateTime?(t.Date) : val.Pagamento); + val.Documento = documento; + val.CodigoBanco = t.TransactionId; + val.TipoPagamento = (((int)val.TipoPagamento == 0) ? val2 : val.TipoPagamento); + } + else + { + val = new Lancamento + { + Controle = new ControleFinanceiro + { + Fornecedor = null, + Centro = Centros.FirstOrDefault(), + Plano = null, + Parcelas = 1, + Historico = t.Memo?.Trim() + }, + Valor = Math.Abs(t.Amount), + ValorPago = Math.Abs(t.Amount), + Historico = t.Memo?.Trim(), + Sinal = (Sinal)((t.Amount < 0m) ? 1 : 0), + Conta = conta, + Vencimento = t.Date, + Baixa = t.Date, + Pagamento = t.Date, + Documento = t.TransactionId?.Trim(), + TipoPagamento = val2, + Competencia = t.Date.ToString("MM/yyyy"), + Parcela = 1, + CodigoBanco = t.TransactionId?.Trim(), + Baixado = false + }; + } + lancamentos.Add(val); + } + }); + } + Lancamentos = new ObservableCollection(lancamentos); + LancamentosFiltrados = Lancamentos; + ExtensionMethods.ForEach((IEnumerable)LancamentosFiltrados, (Action)delegate(Lancamento x) + { + SelecionarLancamento(x); + }); + LancamentosFiltradosCopia = LancamentosFiltrados; + } + + private Tuple CorrigeLancamentos(OfxDocument lancamentos, List codigoBanco) + { + if (VerificaFiltroErrado(lancamentos)) + { + Transaction obj = lancamentos.Transactions.OrderBy((Transaction lanc) => lanc.Date).First(); + DateTime value = ((obj != null) ? new DateTime?(obj.Date) : null).Value; + Transaction obj2 = lancamentos.Transactions.OrderByDescending((Transaction lanc) => lanc.Date).First(); + return new Tuple(value, ((obj2 != null) ? new DateTime?(obj2.Date) : null).Value); + } + if (VerificaDataInvertida(lancamentos)) + { + return new Tuple(lancamentos.StatementEnd, lancamentos.StatementStart); + } + return new Tuple(lancamentos.StatementStart, lancamentos.StatementEnd); + } + + private bool VerificaFiltroErrado(OfxDocument lancamentos) + { + List source = new List { "0237", "756" }; + if (lancamentos.StatementStart == lancamentos.StatementEnd) + { + return source.Any((string idbanco) => idbanco == lancamentos.Account.BankId); + } + return false; + } + + private bool VerificaDataInvertida(OfxDocument lancamentos) + { + List source = new List { "0104" }; + if (lancamentos.StatementStart > lancamentos.StatementEnd) + { + return source.Any((string banco) => banco == lancamentos.Account.BankId); + } + return false; + } + + public List FiltrarLancamento(long id) + { + LancamentosFiltrados = new ObservableCollection(Lancamentos.Where((Lancamento x) => ((DomainBase)x).Id == id)); + return LancamentosFiltrados.ToList(); + } + + public List FiltrarLancamento(Lancamento lancamento) + { + LancamentosFiltrados = new ObservableCollection(Lancamentos.Where((Lancamento x) => x.Valor == lancamento.Valor && x.Vencimento == lancamento.Vencimento && x.Historico == lancamento.Historico)); + return LancamentosFiltrados.ToList(); + } + + public async Task> FiltrarLancamento(string value) + { + return await Task.Run(() => Filtrar(value)); + } + + public List Filtrar(string filter) + { + _dontSort = true; + LancamentosFiltrados = (string.IsNullOrWhiteSpace(filter) ? Lancamentos : new ObservableCollection(Lancamentos.Where(delegate(Lancamento x) + { + //IL_01ea: Unknown result type (might be due to invalid IL or missing references) + //IL_0252: Unknown result type (might be due to invalid IL or missing references) + //IL_0259: Unknown result type (might be due to invalid IL or missing references) + if ((x.Historico == null || !ValidationHelper.RemoveDiacritics(x.Historico.Trim()).Contains(filter)) && (x.Documento == null || !ValidationHelper.RemoveDiacritics(x.Documento.Trim()).Contains(filter)) && (x.Competencia == null || !ValidationHelper.RemoveDiacritics(x.Competencia.Trim()).Contains(filter)) && (x.Complemento == null || !ValidationHelper.RemoveDiacritics(x.Complemento.Trim()).Contains(filter)) && (x.Observacao == null || !ValidationHelper.RemoveDiacritics(x.Observacao.Trim()).Contains(filter)) && !ValidationHelper.RemoveDiacritics(x.Vencimento.ToString(CultureInfo.CurrentCulture).Trim()).ToUpper().Contains(filter) && (!x.Baixa.HasValue || !ValidationHelper.RemoveDiacritics(x.Baixa.ToString().Trim()).ToUpper().Contains(filter)) && (!x.Pagamento.HasValue || !ValidationHelper.RemoveDiacritics(x.Pagamento.ToString().Trim()).ToUpper().Contains(filter)) && (x.Conta == null || !ValidationHelper.RemoveDiacritics(x.Conta.Descricao.Trim()).ToUpper().Contains(filter)) && (x.Controle.Historico == null || !ValidationHelper.RemoveDiacritics(x.Controle.Historico.Trim()).ToUpper().Contains(filter)) && !ValidationHelper.RemoveDiacritics(EnumHelper.GetDescription(x.Sinal).Trim()).Contains(filter)) + { + ControleFinanceiro controle = x.Controle; + if (((controle != null) ? controle.Plano : null) == null || !ValidationHelper.RemoveDiacritics(x.Controle.Plano.Descricao.Trim()).ToUpper().Contains(filter)) + { + _ = x.TipoPagamento; + if (!ValidationHelper.RemoveDiacritics(EnumHelper.GetDescription(x.TipoPagamento).Trim()).ToUpper().Contains(filter)) + { + ControleFinanceiro controle2 = x.Controle; + if (((controle2 != null) ? controle2.Centro : null) == null || !ValidationHelper.RemoveDiacritics(x.Controle.Centro.Descricao.Trim()).ToUpper().Contains(filter)) + { + ControleFinanceiro controle3 = x.Controle; + if (((controle3 != null) ? controle3.Fornecedor : null) != null) + { + return ValidationHelper.RemoveDiacritics(x.Controle.Fornecedor.Nome.Trim()).ToUpper().Contains(filter); + } + return false; + } + } + } + } + return true; + }))); + _dontSort = false; + LancamentosFiltradosCopia = LancamentosFiltrados; + return LancamentosFiltrados.ToList(); + } + + public void SelecionarTodos() + { + List list = LancamentosFiltrados.ToList(); + list.ForEach(delegate(Lancamento x) + { + x.Selecionado = !x.Selecionado; + if (!x.Baixado && !importando) + { + if (!x.Selecionado) + { + x.Baixa = null; + x.Pagamento = null; + x.ValorPago = default(decimal); + } + else + { + DateTime date = Funcoes.GetNetworkTime().Date; + x.Baixa = ((!x.Baixa.HasValue) ? new DateTime?(date) : x.Baixa); + x.Baixa = date; + x.Pagamento = ((!x.Pagamento.HasValue) ? new DateTime?(date) : x.Pagamento); + decimal? valorPago = x.ValorPago; + x.ValorPago = (((valorPago.GetValueOrDefault() == default(decimal)) & valorPago.HasValue) ? new decimal?(x.Valor) : x.ValorPago); + } + } + }); + LancamentosFiltrados = new ObservableCollection(list); + LancamentosFiltradosCopia = LancamentosFiltrados; + } + + private static List GerarRelatorio(List lancamentos) + { + return ((IEnumerable)lancamentos).Select((Func)delegate(Lancamento x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_003a: Unknown result type (might be due to invalid IL or missing references) + //IL_0046: Unknown result type (might be due to invalid IL or missing references) + //IL_0052: Unknown result type (might be due to invalid IL or missing references) + //IL_005e: Unknown result type (might be due to invalid IL or missing references) + //IL_006a: Unknown result type (might be due to invalid IL or missing references) + //IL_0076: Unknown result type (might be due to invalid IL or missing references) + //IL_0082: Unknown result type (might be due to invalid IL or missing references) + //IL_008e: Unknown result type (might be due to invalid IL or missing references) + //IL_00ab: Unknown result type (might be due to invalid IL or missing references) + //IL_00cd: Unknown result type (might be due to invalid IL or missing references) + //IL_00ea: Unknown result type (might be due to invalid IL or missing references) + //IL_0102: Unknown result type (might be due to invalid IL or missing references) + //IL_0127: Unknown result type (might be due to invalid IL or missing references) + //IL_013d: Unknown result type (might be due to invalid IL or missing references) + //IL_014a: Expected O, but got Unknown + RelatorioLancamentos val = new RelatorioLancamentos(); + Fornecedor fornecedor = x.Controle.Fornecedor; + val.Fornecedor = ((fornecedor != null) ? fornecedor.Nome : null); + val.Historico = x.Historico; + val.Observacao = x.Observacao; + val.Documento = x.Documento; + val.Parcela = x.Parcela; + val.Vencimento = x.Vencimento; + val.Valor = x.Valor; + val.Baixa = x.Baixa; + val.ValorPago = x.ValorPago; + val.Pagamento = x.Pagamento; + Planos plano = x.Controle.Plano; + val.Plano = ((plano != null) ? plano.Descricao : null); + Planos plano2 = x.Controle.Plano; + val.Planos = ((plano2 != null) ? plano2.Plano.Descricao : null); + Centro centro = x.Controle.Centro; + val.Centro = ((centro != null) ? centro.Descricao : null); + BancosContas conta = x.Conta; + val.Conta = ((conta != null) ? conta.Descricao : null); + Fornecedor fornecedor2 = x.Controle.Fornecedor; + val.Sinal = ((((fornecedor2 != null) ? fornecedor2.Nome : null) == "TOTAL") ? "" : EnumHelper.GetDescription(x.Sinal)); + val.Competencia = x.Competencia; + return val; + }).ToList(); + } + + public async Task GerarExcel(List relatorioGrid) + { + bool agrupar = await ShowMessage("DESEJA AGRUPAR POR " + EnumHelper.GetDescription(SinteticoTipo), "SIM", "NÃO"); + XLWorkbook xlWorkbook = new XLWorkbook(); + string nome = "LANÇAMENTOS FINANCEIROS"; + new List(); + List lancamentosRelatorio = new List(); + bool selecionados = relatorioGrid.Any((Lancamento x) => x.Selecionado); + relatorioGrid.ToList().ForEach(delegate(Lancamento lancamentoGrid) + { + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + //IL_001d: Expected O, but got Unknown + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + //IL_0025: Invalid comparison between Unknown and I4 + //IL_0041: Unknown result type (might be due to invalid IL or missing references) + //IL_0047: Invalid comparison between Unknown and I4 + if (!selecionados || lancamentoGrid.Selecionado) + { + Lancamento val2 = (Lancamento)((DomainBase)lancamentoGrid).Clone(); + val2.Valor = (((int)val2.Sinal == 1) ? (-val2.Valor) : val2.Valor); + val2.ValorPago = (((int)val2.Sinal != 1) ? val2.ValorPago : (-val2.ValorPago)); + lancamentosRelatorio.Add(val2); + } + }); + List source = lancamentosRelatorio.GroupBy(delegate(Lancamento lancamento) + { + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_000c: Invalid comparison between Unknown and I4 + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + //IL_0021: Unknown result type (might be due to invalid IL or missing references) + //IL_0027: Invalid comparison between Unknown and I4 + object obj7; + if ((int)SinteticoTipo != 1) + { + if ((int)SinteticoTipo != 0) + { + if ((int)SinteticoTipo != 3) + { + Fornecedor fornecedor4 = lancamento.Controle.Fornecedor; + if (fornecedor4 == null) + { + return (string)null; + } + return fornecedor4.Nome; + } + BancosContas conta4 = lancamento.Conta; + obj7 = ((conta4 != null) ? conta4.Descricao : null); + if (obj7 == null) + { + return ""; + } + } + else + { + Planos plano4 = lancamento.Controle.Plano; + obj7 = ((plano4 != null) ? plano4.Nome : null); + if (obj7 == null) + { + return ""; + } + } + } + else + { + Centro centro4 = lancamento.Controle.Centro; + obj7 = ((centro4 != null) ? centro4.Descricao : null) ?? ""; + } + return (string)obj7; + }).Select((Func, SinteticoFinanceiro>)((IGrouping lancamento) => new SinteticoFinanceiro + { + Agrupamento = (lancamento.Key ?? "TRANSFERÊNCIAS"), + Valor = lancamento.Sum((Lancamento sintetic) => sintetic.Valor), + ValorPago = lancamento.Sum((Lancamento sintetic) => sintetic.ValorPago).GetValueOrDefault() + })).ToList(); + source = source.OrderBy((SinteticoFinanceiro lancamento) => lancamento.Agrupamento).ToList(); + source.Add(new SinteticoFinanceiro + { + Agrupamento = "TOTAL", + Valor = source.Sum((SinteticoFinanceiro sintetic) => sintetic.Valor), + ValorPago = source.Sum((SinteticoFinanceiro sintetic) => sintetic.ValorPago) + }); + xlWorkbook = await Funcoes.GerarXls(xlWorkbook, "SINTÉTICO", source); + if (agrupar) + { + SinteticoFinanceiroTipo sinteticoTipo = SinteticoTipo; + switch ((int)sinteticoTipo) + { + case 2: + { + List list = lancamentosRelatorio.Select(delegate(Lancamento lancamento) + { + ControleFinanceiro controle6 = lancamento.Controle; + object obj4; + if (controle6 == null) + { + obj4 = null; + } + else + { + Fornecedor fornecedor3 = controle6.Fornecedor; + obj4 = ((fornecedor3 != null) ? fornecedor3.Nome : null); + } + if (obj4 == null) + { + obj4 = ""; + } + return (string)obj4; + }).Distinct().ToList(); + foreach (string grupo2 in list) + { + List list5 = lancamentosRelatorio.Where(delegate(Lancamento lancamento) + { + if (string.IsNullOrWhiteSpace(grupo2)) + { + ControleFinanceiro controle4 = lancamento.Controle; + object value2; + if (controle4 == null) + { + value2 = null; + } + else + { + Fornecedor fornecedor = controle4.Fornecedor; + value2 = ((fornecedor != null) ? fornecedor.Nome : null); + } + return string.IsNullOrEmpty((string?)value2); + } + ControleFinanceiro controle5 = lancamento.Controle; + object obj3; + if (controle5 == null) + { + obj3 = null; + } + else + { + Fornecedor fornecedor2 = controle5.Fornecedor; + obj3 = ((fornecedor2 != null) ? fornecedor2.Nome : null); + } + return (string?)obj3 == grupo2; + }).ToList(); + if (list5.Count != 0) + { + List list3 = GerarRelatorio(list5); + list3.Add(new RelatorioLancamentos + { + Fornecedor = "TOTAL", + Valor = list5.Sum((Lancamento lancamento) => lancamento.Valor), + ValorPago = list5.Sum((Lancamento lancamento) => lancamento.ValorPago) + }); + nome = grupo2.ValidaNomePlanilha(); + xlWorkbook = await Funcoes.GerarXls(xlWorkbook, nome, list3); + } + } + break; + } + case 1: + { + List list = lancamentosRelatorio.Select(delegate(Lancamento lancamento) + { + ControleFinanceiro controle9 = lancamento.Controle; + object obj6; + if (controle9 == null) + { + obj6 = null; + } + else + { + Centro centro3 = controle9.Centro; + obj6 = ((centro3 != null) ? centro3.Descricao : null); + } + if (obj6 == null) + { + obj6 = ""; + } + return (string)obj6; + }).Distinct().ToList(); + foreach (string grupo3 in list) + { + List list4 = lancamentosRelatorio.Where(delegate(Lancamento lanamento) + { + if (string.IsNullOrWhiteSpace(grupo3)) + { + ControleFinanceiro controle7 = lanamento.Controle; + object value3; + if (controle7 == null) + { + value3 = null; + } + else + { + Centro centro = controle7.Centro; + value3 = ((centro != null) ? centro.Descricao : null); + } + return string.IsNullOrEmpty((string?)value3); + } + ControleFinanceiro controle8 = lanamento.Controle; + object obj5; + if (controle8 == null) + { + obj5 = null; + } + else + { + Centro centro2 = controle8.Centro; + obj5 = ((centro2 != null) ? centro2.Descricao : null); + } + return (string?)obj5 == grupo3; + }).ToList(); + if (list4.Count != 0) + { + List list3 = GerarRelatorio(list4); + list3.Add(new RelatorioLancamentos + { + Fornecedor = "TOTAL", + Valor = list4.Sum((Lancamento lancamento) => lancamento.Valor), + ValorPago = list4.Sum((Lancamento lancamento) => lancamento.ValorPago) + }); + nome = grupo3.ValidaNomePlanilha(); + xlWorkbook = await Funcoes.GerarXls(xlWorkbook, nome, list3); + } + } + break; + } + case 0: + { + List list = lancamentosRelatorio.Select(delegate(Lancamento x) + { + ControleFinanceiro controle3 = x.Controle; + object obj2; + if (controle3 == null) + { + obj2 = null; + } + else + { + Planos plano3 = controle3.Plano; + obj2 = ((plano3 != null) ? plano3.Descricao : null); + } + if (obj2 == null) + { + obj2 = ""; + } + return (string)obj2; + }).Distinct().ToList(); + foreach (string grupo in list) + { + List list6 = lancamentosRelatorio.Where(delegate(Lancamento lancamento) + { + if (string.IsNullOrWhiteSpace(grupo)) + { + ControleFinanceiro controle = lancamento.Controle; + object value; + if (controle == null) + { + value = null; + } + else + { + Planos plano = controle.Plano; + value = ((plano != null) ? plano.Descricao : null); + } + return string.IsNullOrEmpty((string?)value); + } + ControleFinanceiro controle2 = lancamento.Controle; + object obj; + if (controle2 == null) + { + obj = null; + } + else + { + Planos plano2 = controle2.Plano; + obj = ((plano2 != null) ? plano2.Descricao : null); + } + return (string?)obj == grupo; + }).ToList(); + if (list6.Count != 0) + { + List list3 = GerarRelatorio(list6); + list3.Add(new RelatorioLancamentos + { + Fornecedor = "TOTAL", + Valor = list6.Sum((Lancamento lancamento) => lancamento.Valor), + ValorPago = list6.Sum((Lancamento lancamento) => lancamento.ValorPago) + }); + nome = ((!string.IsNullOrWhiteSpace(grupo)) ? grupo.ValidaNomePlanilha() : "TRANSFERENCIAS"); + xlWorkbook = await Funcoes.GerarXls(xlWorkbook, nome, list3); + } + } + break; + } + case 3: + { + List list = lancamentosRelatorio.Select(delegate(Lancamento x) + { + BancosContas conta3 = x.Conta; + return ((conta3 != null) ? conta3.Descricao : null) ?? ""; + }).Distinct().ToList(); + foreach (string grupo4 in list) + { + if (string.IsNullOrWhiteSpace(grupo4)) + { + continue; + } + List list2 = lancamentosRelatorio.Where(delegate(Lancamento lancamento) + { + if (string.IsNullOrWhiteSpace(grupo4)) + { + BancosContas conta = lancamento.Conta; + return string.IsNullOrEmpty((conta != null) ? conta.Descricao : null); + } + BancosContas conta2 = lancamento.Conta; + return ((conta2 != null) ? conta2.Descricao : null) == grupo4; + }).ToList(); + if (list2.Count != 0) + { + List list3 = GerarRelatorio(list2); + list3.Add(new RelatorioLancamentos + { + Fornecedor = "TOTAL", + Valor = list2.Sum((Lancamento lancamento) => lancamento.Valor), + ValorPago = list2.Sum((Lancamento lancamento) => lancamento.ValorPago) + }); + nome = grupo4.ValidaNomePlanilha(); + xlWorkbook = await Funcoes.GerarXls(xlWorkbook, nome, list3); + } + } + break; + } + } + } + else + { + List list3 = GerarRelatorio(lancamentosRelatorio); + list3.Add(new RelatorioLancamentos + { + Fornecedor = "TOTAL", + Valor = list3.Sum((RelatorioLancamentos lancamento) => lancamento.Valor), + ValorPago = list3.Sum((RelatorioLancamentos lancamento) => lancamento.ValorPago) + }); + xlWorkbook = await Funcoes.GerarXls(xlWorkbook, nome, list3); + } + string text = ""; + string text2; + if (Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 41)) + { + FolderBrowserDialog val = new FolderBrowserDialog(); + try + { + if (1 != (int)((CommonDialog)val).ShowDialog()) + { + return; + } + text = val.SelectedPath + "\\"; + Directory.CreateDirectory(text); + } + finally + { + ((IDisposable)val)?.Dispose(); + } + text2 = text + nome + " " + Functions.GetNetworkTime().Date.ToShortDateString().Replace("/", "") + ".xlsx"; + } + else + { + text = Path.GetTempPath(); + text2 = $"{text}{Guid.NewGuid()}.xlsx"; + } + xlWorkbook.SaveAs(text2); + Process.Start(text2); + } + + private async Task GerarHtml(List relatorioGrid, bool posicao = false) + { + TipoRelatorio tipo = new TipoRelatorio + { + Nome = "RELATÓRIO FINANCEIRO", + Inicio = (Inicio ?? DateTime.MinValue), + Fim = (Fim ?? DateTime.MinValue) + }; + FiltroLancamento selectedFiltro = SelectedFiltro; + switch ((int)selectedFiltro) + { + case 3: + tipo.Nome = SelectedFornecedor.Nome; + tipo.Inicio = DateTime.MinValue; + tipo.Fim = DateTime.MinValue; + break; + case 0: + tipo.Nome = "RELATORIO FINANCEIRO - VENCIMENTO"; + break; + case 1: + tipo.Nome = "RELATORIO FINANCEIRO - BAIXA"; + break; + case 2: + tipo.Nome = "RELATORIO FINANCEIRO - PAGAMENTO"; + break; + } + List colunasOcultas = Funcoes.OcultarColunasDescricao(typeof(Sintetico), "FINANCEIRO"); + List lancamentosRelatorio = new List(); + bool selecionados = relatorioGrid.Any((Lancamento x) => x.Selecionado); + relatorioGrid.ToList().ForEach(delegate(Lancamento lancamentoGrid) + { + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + //IL_001d: Expected O, but got Unknown + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + //IL_0025: Invalid comparison between Unknown and I4 + //IL_0041: Unknown result type (might be due to invalid IL or missing references) + //IL_0047: Invalid comparison between Unknown and I4 + if (!selecionados || lancamentoGrid.Selecionado) + { + Lancamento val = (Lancamento)((DomainBase)lancamentoGrid).Clone(); + val.Valor = (((int)val.Sinal == 1) ? (-val.Valor) : val.Valor); + val.ValorPago = (((int)val.Sinal != 1) ? val.ValorPago : (-val.ValorPago)); + lancamentosRelatorio.Add(val); + } + }); + List source = lancamentosRelatorio.GroupBy(delegate(Lancamento lancamento) + { + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_000c: Invalid comparison between Unknown and I4 + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + //IL_0021: Unknown result type (might be due to invalid IL or missing references) + //IL_0027: Invalid comparison between Unknown and I4 + object obj2; + if ((int)SinteticoTipo != 1) + { + if ((int)SinteticoTipo != 0) + { + if ((int)SinteticoTipo != 3) + { + Fornecedor fornecedor3 = lancamento.Controle.Fornecedor; + if (fornecedor3 == null) + { + return (string)null; + } + return fornecedor3.Nome; + } + BancosContas conta3 = lancamento.Conta; + obj2 = ((conta3 != null) ? conta3.Descricao : null); + if (obj2 == null) + { + return ""; + } + } + else + { + Planos plano3 = lancamento.Controle.Plano; + obj2 = ((plano3 != null) ? plano3.Descricao : null); + if (obj2 == null) + { + return ""; + } + } + } + else + { + Centro centro3 = lancamento.Controle.Centro; + obj2 = ((centro3 != null) ? centro3.Descricao : null) ?? ""; + } + return (string)obj2; + }).Select((Func, SinteticoFinanceiro>)((IGrouping lancamento) => new SinteticoFinanceiro + { + Agrupamento = (lancamento.Key ?? "TRANSFERÊNCIAS"), + Valor = lancamento.Sum((Lancamento sintetic) => sintetic.Valor), + ValorPago = lancamento.Sum((Lancamento sintetic) => sintetic.ValorPago).GetValueOrDefault() + })).ToList(); + source = source.OrderBy((SinteticoFinanceiro lancamento) => lancamento.Agrupamento).ToList(); + source.Add(new SinteticoFinanceiro + { + Agrupamento = "TOTAL", + Valor = source.Sum((SinteticoFinanceiro sintetic) => sintetic.Valor), + ValorPago = source.Sum((SinteticoFinanceiro sintetic) => sintetic.ValorPago) + }); + string body = await Funcoes.GenerateTable(source, colunasOcultas); + string relatorio = Funcoes.CreateCard("SINTÉTICO " + EnumHelper.GetDescription(SinteticoTipo), body); + List list = (from lancamento in lancamentosRelatorio.GroupBy(delegate(Lancamento lancamento) + { + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_000c: Invalid comparison between Unknown and I4 + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + //IL_0021: Unknown result type (might be due to invalid IL or missing references) + //IL_0027: Invalid comparison between Unknown and I4 + object obj; + if ((int)SinteticoTipo != 1) + { + if ((int)SinteticoTipo != 0) + { + if ((int)SinteticoTipo != 3) + { + Fornecedor fornecedor2 = lancamento.Controle.Fornecedor; + if (fornecedor2 == null) + { + return (string)null; + } + return fornecedor2.Nome; + } + BancosContas conta2 = lancamento.Conta; + obj = ((conta2 != null) ? conta2.Descricao : null); + if (obj == null) + { + return ""; + } + } + else + { + Planos plano2 = lancamento.Controle.Plano; + obj = ((plano2 != null) ? plano2.Nome : null); + if (obj == null) + { + return ""; + } + } + } + else + { + Centro centro2 = lancamento.Controle.Centro; + obj = ((centro2 != null) ? centro2.Descricao : null) ?? ""; + } + return (string)obj; + }) + select lancamento.Key).Distinct().ToList(); + foreach (string grupo in list) + { + List list2 = lancamentosRelatorio.Where(delegate(Lancamento lancamento) + { + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Invalid comparison between Unknown and I4 + //IL_0021: Unknown result type (might be due to invalid IL or missing references) + //IL_0033: Unknown result type (might be due to invalid IL or missing references) + //IL_0039: Invalid comparison between Unknown and I4 + if ((int)SinteticoTipo != 1) + { + if ((int)SinteticoTipo != 0) + { + if ((int)SinteticoTipo != 3) + { + Fornecedor fornecedor = lancamento.Controle.Fornecedor; + return ((fornecedor != null) ? fornecedor.Nome : null) == grupo; + } + BancosContas conta = lancamento.Conta; + return ((conta != null) ? conta.Descricao : null) == grupo; + } + Planos plano = lancamento.Controle.Plano; + return ((plano != null) ? plano.Nome : null) == grupo; + } + Centro centro = lancamento.Controle.Centro; + return ((centro != null) ? centro.Descricao : null) == grupo; + }).ToList(); + if (list2.Count != 0) + { + list2.Add(new Lancamento + { + Controle = new ControleFinanceiro + { + Fornecedor = new Fornecedor + { + Nome = "TOTAL" + } + }, + Valor = list2.Sum((Lancamento lancamento) => lancamento.Valor), + ValorPago = list2.Sum((Lancamento lancamento) => lancamento.ValorPago) + }); + string body2 = await Funcoes.GenerateTable(GerarRelatorio(list2), new List()); + relatorio += Funcoes.CreateCard(grupo, body2); + } + } + int num = (Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 14) ? 70 : 50); + return Funcoes.ExportarHtml(tipo, relatorio ?? "", num.ToString(), posicao ? "landscape" : "portrait"); + } + + public async Task Print(List relatorioGrid, bool posicao = false) + { + string path = Path.GetTempPath(); + string value = await GerarHtml(relatorioGrid, posicao); + string text = $"{path}RELATORIO FINANCEIRO_{Funcoes.GetNetworkTime():ddMMyyyyhhmmss}.html"; + StreamWriter streamWriter = new StreamWriter(text, append: true, Encoding.UTF8); + streamWriter.Write(value); + streamWriter.Close(); + Process.Start(text); + } + + public void IncluirLancamento() + { + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Invalid comparison between Unknown and I4 + //IL_016b: Unknown result type (might be due to invalid IL or missing references) + //IL_0170: Unknown result type (might be due to invalid IL or missing references) + //IL_0183: Unknown result type (might be due to invalid IL or missing references) + //IL_0188: Unknown result type (might be due to invalid IL or missing references) + //IL_0189: Unknown result type (might be due to invalid IL or missing references) + //IL_018e: Unknown result type (might be due to invalid IL or missing references) + //IL_019a: Unknown result type (might be due to invalid IL or missing references) + //IL_01a1: Unknown result type (might be due to invalid IL or missing references) + //IL_01a8: Unknown result type (might be due to invalid IL or missing references) + //IL_01b4: Expected O, but got Unknown + //IL_01b4: Unknown result type (might be due to invalid IL or missing references) + //IL_01bb: Unknown result type (might be due to invalid IL or missing references) + //IL_01c3: Unknown result type (might be due to invalid IL or missing references) + //IL_01ca: Unknown result type (might be due to invalid IL or missing references) + //IL_01cb: Unknown result type (might be due to invalid IL or missing references) + //IL_01d7: Expected O, but got Unknown + //IL_01e2: Unknown result type (might be due to invalid IL or missing references) + //IL_023b: Unknown result type (might be due to invalid IL or missing references) + //IL_029c: Unknown result type (might be due to invalid IL or missing references) + Alterando = (Visibility)0; + BuscaHabilitada = false; + Fornecedor fornecedor = null; + if ((int)SelectedFiltro == 3 && SelectedFornecedor != null && SelectedFornecedor.Id > 0) + { + fornecedor = SelectedFornecedor; + } + VisibilityFornecedor = (Visibility)((fornecedor != null) ? 2 : 0); + Fornecedor obj = fornecedor; + Planos plano = ((obj != null && obj.IdPlano.HasValue) ? (((IEnumerable)PlanosFiltrados).FirstOrDefault((Func)((Planos x) => ((DomainBase)x).Id == fornecedor.IdPlano)) ?? PlanosFiltrados.FirstOrDefault()) : PlanosFiltrados.FirstOrDefault()); + Fornecedor obj2 = fornecedor; + BancosContas conta = ((obj2 != null && obj2.IdConta.HasValue) ? (((IEnumerable)ContasFiltradas).FirstOrDefault((Func)((BancosContas x) => ((DomainBase)x).Id == fornecedor.IdConta)) ?? ContasFiltradas.FirstOrDefault()) : ContasFiltradas.FirstOrDefault()); + Fornecedor obj3 = fornecedor; + Centro centro = ((obj3 != null && obj3.IdCentro.HasValue) ? (((IEnumerable)CentrosFiltrados).FirstOrDefault((Func)((Centro x) => ((DomainBase)x).Id == fornecedor.IdCentro)) ?? CentrosFiltrados.FirstOrDefault()) : CentrosFiltrados.FirstOrDefault()); + Fornecedor obj4 = fornecedor; + TipoPagamento valueOrDefault = ((obj4 != null) ? obj4.TipoPagamento : null).GetValueOrDefault(); + DateTime date = Funcoes.GetNetworkTime().Date; + SelectedLancamento = new Lancamento + { + Controle = new ControleFinanceiro + { + Fornecedor = fornecedor, + Centro = centro, + Plano = plano, + Parcelas = 1 + }, + Conta = conta, + Vencimento = date, + Parcela = 1, + TipoPagamento = valueOrDefault + }; + FornecedorInclusao = (Fornecedor)(((object)fornecedor) ?? ((object)new Fornecedor())); + Historico = ""; + Documento = ""; + Competencia = ""; + Complemento = ""; + Plano = plano; + Centro = centro; + Conta = conta; + Planos plano2 = Plano; + Sinal = (Sinal)((plano2 != null) ? ((int)plano2.Sinal) : 0); + Parcelas = 1; + Parcela = 0; + Vencimento = date; + Valor = 0m; + Baixa = null; + ValorPago = default(decimal); + Pagamento = null; + TipoPagamento = valueOrDefault; + Observacao = ""; + Alteracao = false; + VisibilityCentro = (Visibility)((CentrosFiltrados.Count <= 1) ? 2 : 0); + VisibilityConta = (Visibility)((ContasFiltradas.Count <= 1) ? 2 : 0); + } + + public void CancelarAlteracao() + { + LancamentosFiltrados = LancamentosFiltradosCopia; + SelectedLancamento = ((IEnumerable)LancamentosFiltrados).FirstOrDefault((Func)delegate(Lancamento x) + { + long id = ((DomainBase)x).Id; + Lancamento lancamentoSelecionado = LancamentoSelecionado; + return id == ((lancamentoSelecionado != null) ? new long?(((DomainBase)lancamentoSelecionado).Id) : null); + }); + } + + public void DeSelecionarLancamento(Lancamento lancamento) + { + Lancamento val = ((((DomainBase)lancamento).Id > 0) ? LancamentosFiltrados.First((Lancamento x) => ((DomainBase)x).Id == ((DomainBase)lancamento).Id) : LancamentosFiltrados.First(delegate(Lancamento x) + { + if (((DomainBase)x).Id == ((DomainBase)lancamento).Id) + { + ControleFinanceiro controle = x.Controle; + long? obj; + if (controle == null) + { + obj = null; + } + else + { + Fornecedor fornecedor = controle.Fornecedor; + obj = ((fornecedor != null) ? new long?(fornecedor.Id) : null); + } + long? num = obj; + ControleFinanceiro controle2 = lancamento.Controle; + long? obj2; + if (controle2 == null) + { + obj2 = null; + } + else + { + Fornecedor fornecedor2 = controle2.Fornecedor; + obj2 = ((fornecedor2 != null) ? new long?(fornecedor2.Id) : null); + } + if (num == obj2 && x.Valor == lancamento.Valor && x.Vencimento == lancamento.Vencimento) + { + ControleFinanceiro controle3 = x.Controle; + long? obj3; + if (controle3 == null) + { + obj3 = null; + } + else + { + Planos plano = controle3.Plano; + obj3 = ((plano != null) ? new long?(((DomainBase)plano).Id) : null); + } + long? num2 = obj3; + ControleFinanceiro controle4 = lancamento.Controle; + long? obj4; + if (controle4 == null) + { + obj4 = null; + } + else + { + Planos plano2 = controle4.Plano; + obj4 = ((plano2 != null) ? new long?(((DomainBase)plano2).Id) : null); + } + return num2 == obj4; + } + } + return false; + })); + val.Selecionado = false; + if (!val.Baixado) + { + val.Baixa = null; + val.Pagamento = null; + val.ValorPago = default(decimal); + } + LancamentosFiltradosCopia = LancamentosFiltrados; + Totalizar(); + } + + public void SelecionarLancamento(Lancamento lancamento) + { + Lancamento val = ((((DomainBase)lancamento).Id > 0) ? LancamentosFiltrados.First((Lancamento x) => ((DomainBase)x).Id == ((DomainBase)lancamento).Id) : LancamentosFiltrados.First(delegate(Lancamento x) + { + if (((DomainBase)x).Id == ((DomainBase)lancamento).Id) + { + ControleFinanceiro controle = x.Controle; + long? obj; + if (controle == null) + { + obj = null; + } + else + { + Fornecedor fornecedor = controle.Fornecedor; + obj = ((fornecedor != null) ? new long?(fornecedor.Id) : null); + } + long? num = obj; + ControleFinanceiro controle2 = lancamento.Controle; + long? obj2; + if (controle2 == null) + { + obj2 = null; + } + else + { + Fornecedor fornecedor2 = controle2.Fornecedor; + obj2 = ((fornecedor2 != null) ? new long?(fornecedor2.Id) : null); + } + if (num == obj2 && x.Valor == lancamento.Valor && x.Vencimento == lancamento.Vencimento) + { + ControleFinanceiro controle3 = x.Controle; + long? obj3; + if (controle3 == null) + { + obj3 = null; + } + else + { + Planos plano = controle3.Plano; + obj3 = ((plano != null) ? new long?(((DomainBase)plano).Id) : null); + } + long? num2 = obj3; + ControleFinanceiro controle4 = lancamento.Controle; + long? obj4; + if (controle4 == null) + { + obj4 = null; + } + else + { + Planos plano2 = controle4.Plano; + obj4 = ((plano2 != null) ? new long?(((DomainBase)plano2).Id) : null); + } + if (num2 == obj4) + { + return lancamento.Documento == x.Documento; + } + } + } + return false; + })); + DateTime date = Funcoes.GetNetworkTime().Date; + val.Selecionado = true; + val.Baixa = val.Baixa ?? val.Pagamento.GetValueOrDefault(date); + val.Pagamento = val.Pagamento.GetValueOrDefault(date); + decimal? valorPago = val.ValorPago; + val.ValorPago = (((valorPago.GetValueOrDefault() == default(decimal)) & valorPago.HasValue) ? new decimal?(lancamento.Valor) : val.ValorPago); + LancamentosFiltradosCopia = LancamentosFiltrados; + Totalizar(); + } + + public async void AdcionarFiltroPersonalizado() + { + if (Filtro == null) + { + return; + } + string descricao; + if (!SemValor) + { + List list = ((PersonalizadoSelecionado == null) ? new List() : PersonalizadoSelecionado.Where((FiltroPersonalizado x) => x.Propriedade == Filtro.Propriedade && x.SemValor).ToList()); + if (list.Count > 0) + { + list.ForEach(delegate(FiltroPersonalizado x) + { + PersonalizadoSelecionado.Remove(x); + }); + } + switch (Filtro.Tipo.Name) + { + default: + if (string.IsNullOrEmpty(ValorInicial)) + { + await ShowMessage("O VALOR DEVE SER PREENCHIDO CORRETAMENTE."); + return; + } + descricao = Filtro.Nome + " = " + ValorInicial; + break; + case "DateTime": + { + if (!DateTime.TryParse(ValorInicial, out var result3) || !DateTime.TryParse(ValorFinal, out result3) || DateTime.Parse(ValorInicial) > DateTime.Parse(ValorFinal)) + { + await ShowMessage("O VALOR DE INTERVALO DEVE SER PREENCHIDO CORRETAMENTE."); + return; + } + descricao = $"{Filtro.Nome}: {DateTime.Parse(ValorInicial):d} até {DateTime.Parse(ValorFinal):d}"; + break; + } + case "Decimal": + { + if (!decimal.TryParse(ValorInicial, out var result2) || !decimal.TryParse(ValorFinal, out result2) || Math.Abs(decimal.Parse(ValorInicial)) > Math.Abs(decimal.Parse(ValorFinal))) + { + await ShowMessage("O VALOR DE INTERVALO DEVE SER PREENCHIDO CORRETAMENTE."); + return; + } + descricao = $"{Filtro.Nome}: {decimal.Parse(ValorInicial):n2} até {decimal.Parse(ValorFinal):n2}"; + break; + } + case "Int32": + { + if (!int.TryParse(ValorInicial, out var result4) || !int.TryParse(ValorFinal, out result4) || int.Parse(ValorInicial) > int.Parse(ValorFinal)) + { + await ShowMessage("O VALOR DE INTERVALO DEVE SER PREENCHIDO CORRETAMENTE."); + return; + } + descricao = $"{Filtro.Nome}: {int.Parse(ValorInicial):n0} até {int.Parse(ValorFinal):n0}"; + break; + } + case "Int64": + { + if (!long.TryParse(ValorInicial, out var result) || !long.TryParse(ValorFinal, out result) || long.Parse(ValorInicial) > int.Parse(ValorFinal)) + { + await ShowMessage("O VALOR DE INTERVALO DEVE SER PREENCHIDO CORRETAMENTE."); + return; + } + descricao = $"{Filtro.Nome}: {long.Parse(ValorInicial):n0} até {long.Parse(ValorFinal):n0}"; + break; + } + } + } + else + { + List list2 = ((PersonalizadoSelecionado == null) ? new List() : PersonalizadoSelecionado.Where((FiltroPersonalizado x) => x.Propriedade == Filtro.Propriedade).ToList()); + if (list2.Count > 0) + { + list2.ForEach(delegate(FiltroPersonalizado x) + { + PersonalizadoSelecionado.Remove(x); + }); + } + descricao = Filtro.Nome + ": EM BRANCO"; + } + if (PersonalizadoSelecionado == null) + { + PersonalizadoSelecionado = new ObservableCollection(); + } + PersonalizadoSelecionado.Add(new FiltroPersonalizado + { + Nome = Filtro.Nome, + Propriedade = Filtro.Propriedade, + Tipo = Filtro.Tipo, + ValorIncial = ValorInicial, + ValorFinal = ValorFinal, + SemValor = SemValor, + Descricao = descricao + }); + Filtro = null; + ValorInicial = string.Empty; + ValorFinal = string.Empty; + PesquisaPersonalizada(); + } + + public void PesquisaPersonalizada() + { + List property = PersonalizadoSelecionado.Where((FiltroPersonalizado x) => !x.Propriedade.Contains(".")).ToList(); + List lancamentos = Lancamentos.ToList().CustomWhere(property); + PersonalizadoSelecionado.Where((FiltroPersonalizado x) => x.Propriedade.Contains(".")).ToList().ForEach(delegate(FiltroPersonalizado x) + { + switch (x.Nome) + { + case "FORNECEDOR": + lancamentos = lancamentos.Where(delegate(Lancamento l) + { + ControleFinanceiro controle = l.Controle; + object obj; + if (controle == null) + { + obj = null; + } + else + { + Fornecedor fornecedor = controle.Fornecedor; + obj = ((fornecedor != null) ? fornecedor.NomeSocial : null); + } + return obj != null && ValidationHelper.AlphanumericAndSpace(l.Controle.Fornecedor.NomeSocial.ToLower().Trim()).Contains(ValidationHelper.AlphanumericAndSpace(x.ValorIncial.ToLower().Trim())); + }).ToList(); + break; + case "FORNECEDOR ATIVO": + if (x.ValorIncial.Trim().Equals("SIM")) + { + lancamentos = lancamentos.Where(delegate(Lancamento l) + { + ControleFinanceiro controle3 = l.Controle; + if (controle3 != null) + { + Fornecedor fornecedor3 = controle3.Fornecedor; + if (fornecedor3 != null) + { + _ = fornecedor3.Ativo; + if (true) + { + return l.Controle.Fornecedor.Ativo; + } + } + } + return false; + }).ToList(); + } + else if (x.ValorIncial.Equals("NÃO")) + { + lancamentos = lancamentos.Where(delegate(Lancamento l) + { + ControleFinanceiro controle2 = l.Controle; + if (controle2 != null) + { + Fornecedor fornecedor2 = controle2.Fornecedor; + if (fornecedor2 != null) + { + _ = fornecedor2.Ativo; + if (true) + { + return !l.Controle.Fornecedor.Ativo; + } + } + } + return false; + }).ToList(); + } + break; + case "CONTA": + lancamentos = lancamentos.Where(delegate(Lancamento l) + { + BancosContas conta = l.Conta; + return ((conta != null) ? conta.Descricao : null) != null && ValidationHelper.AlphanumericAndSpace(l.Conta.Descricao.ToLower().Trim()).Contains(ValidationHelper.AlphanumericAndSpace(x.ValorIncial.ToLower().Trim())); + }).ToList(); + break; + case "PLANO DE CONTAS": + lancamentos = lancamentos.Where(delegate(Lancamento l) + { + ControleFinanceiro controle4 = l.Controle; + object obj2; + if (controle4 == null) + { + obj2 = null; + } + else + { + Planos plano = controle4.Plano; + obj2 = ((plano != null) ? plano.Descricao : null); + } + return obj2 != null && ValidationHelper.AlphanumericAndSpace(l.Controle.Plano.Descricao.ToLower().Trim()).Contains(ValidationHelper.AlphanumericAndSpace(x.ValorIncial.ToLower().Trim())); + }).ToList(); + break; + case "CENTRO DE CUSTO": + lancamentos = lancamentos.Where(delegate(Lancamento l) + { + ControleFinanceiro controle5 = l.Controle; + object obj3; + if (controle5 == null) + { + obj3 = null; + } + else + { + Centro centro = controle5.Centro; + obj3 = ((centro != null) ? centro.Descricao : null); + } + return obj3 != null && ValidationHelper.AlphanumericAndSpace(l.Controle.Centro.Descricao.ToLower().Trim()).Contains(ValidationHelper.AlphanumericAndSpace(x.ValorIncial.ToLower().Trim())); + }).ToList(); + break; + case "PLANO": + lancamentos = lancamentos.Where(delegate(Lancamento l) + { + ControleFinanceiro controle6 = l.Controle; + object obj4; + if (controle6 == null) + { + obj4 = null; + } + else + { + Planos plano2 = controle6.Plano; + obj4 = ((plano2 != null) ? plano2.Nome : null); + } + return obj4 != null && ValidationHelper.AlphanumericAndSpace(l.Controle.Plano.Nome.ToLower().Trim()).Contains(ValidationHelper.AlphanumericAndSpace(x.ValorIncial.ToLower().Trim())); + }).ToList(); + break; + } + }); + LancamentosFiltrados = new ObservableCollection(lancamentos); + } + + public async void PopularFiltro() + { + if (FiltroPersonalizado == null || FiltroPersonalizado.Count <= 0) + { + FiltroPersonalizado = new List(); + List collection = ((IEnumerable)(await new BaseServico().BuscarFornecedor())).Select((Func)((Fornecedor x) => new FiltroPersonalizado + { + Tipo = (TipoFiltroFinanceiro)0, + Descricao = x.Nome + " " + x.Documento, + Id = x.Id + })).ToList(); + FiltroPersonalizado.AddRange(collection); + collection = ((IEnumerable)Centros).Select((Func)((Centro x) => new FiltroPersonalizado + { + Tipo = (TipoFiltroFinanceiro)2, + Descricao = x.Descricao, + Id = ((DomainBase)x).Id + })).ToList(); + FiltroPersonalizado.AddRange(collection); + collection = ((IEnumerable)Planos).Select((Func)((Planos x) => new FiltroPersonalizado + { + Tipo = (TipoFiltroFinanceiro)1, + Descricao = x.Descricao, + Id = ((DomainBase)x).Id + })).ToList(); + FiltroPersonalizado.AddRange(collection); + collection = ((IEnumerable)Contas).Select((Func)((BancosContas x) => new FiltroPersonalizado + { + Tipo = (TipoFiltroFinanceiro)3, + Descricao = x.Descricao, + Id = ((DomainBase)x).Id + })).ToList(); + FiltroPersonalizado.AddRange(collection); + FiltroPersonalizado.Add(new FiltroPersonalizado + { + Descricao = EnumHelper.GetDescription((Sinal)0), + Id = 0L, + Tipo = (TipoFiltroFinanceiro)4 + }); + FiltroPersonalizado.Add(new FiltroPersonalizado + { + Descricao = EnumHelper.GetDescription((Sinal)1), + Id = 1L, + Tipo = (TipoFiltroFinanceiro)4 + }); + } + } + + internal async Task> FiltroPersonalizadoTask(string value) + { + return await Task.Run(() => FiltrarPersonalizado(value)); + } + + public List FiltrarPersonalizado(string filter) + { + if (FiltroPersonalizado == null) + { + PopularFiltro(); + } + return FiltroPersonalizado.Where((FiltroPersonalizado x) => ValidationHelper.RemoveDiacritics(x.Descricao.Trim()).ToUpper().Contains(filter.ToUpper())).ToList(); + } + + public void AdicionarFiltro(FiltroPersonalizado filtro) + { + if (filtro != null) + { + if (FiltroPersonalizadoSelecionado == null) + { + FiltroPersonalizadoSelecionado = new ObservableCollection(); + } + VisibleFiltros = (Visibility)0; + if (!FiltroPersonalizadoSelecionado.Any((FiltroPersonalizado x) => x.Id == filtro.Id && x.Tipo == filtro.Tipo)) + { + FiltroPersonalizadoSelecionado.Add(filtro); + FiltrarPersonalizado(); + } + } + } + + public void LimparLancamentos() + { + Lancamentos = new ObservableCollection(); + LancamentosFiltrados = new ObservableCollection(); + LimparFiltros(); + } + + public void ExcluirFiltro(FiltroPersonalizado filtro) + { + FiltroPersonalizado item = FiltroPersonalizadoSelecionado.First((FiltroPersonalizado x) => x.Id == filtro.Id && x.Tipo == filtro.Tipo); + FiltroPersonalizadoSelecionado.Remove(item); + FiltroPersonalizadoSelecionado = new ObservableCollection(FiltroPersonalizadoSelecionado); + FiltrarPersonalizado(); + } + + public void LimparFiltros() + { + FiltroPersonalizadoSelecionado = null; + VisibleFiltros = (Visibility)2; + } + + public async Task>> Salvar(Transferencia transferencia) + { + List> errors = transferencia.Validate(); + List> list = errors; + list.AddRange(await Validar(transferencia)); + if (errors.Count > 0) + { + return errors; + } + ControleFinanceiro controle = new ControleFinanceiro + { + Historico = "TRANSFERÊNCIA ENTRE CONTAS", + Parcelas = 2 + }; + Lancamento lancamentoOrigem = new Lancamento + { + Controle = controle, + Historico = "TRANSFERÊNCIA ENTRE CONTAS", + Vencimento = transferencia.Data, + Conta = transferencia.Origem, + Valor = transferencia.Valor, + ValorPago = transferencia.Valor, + Pagamento = transferencia.Data, + Baixa = transferencia.Data, + Parcela = 1, + Sinal = (Sinal)1, + TipoPagamento = (TipoPagamento)11 + }; + Lancamento lancamentoDestino = new Lancamento + { + Controle = controle, + Historico = "TRANSFERÊNCIA ENTRE CONTAS", + Vencimento = transferencia.Data, + Conta = transferencia.Destino, + Valor = transferencia.Valor, + ValorPago = transferencia.Valor, + Pagamento = transferencia.Data, + Baixa = transferencia.Data, + Parcela = 2, + Sinal = (Sinal)0, + TipoPagamento = (TipoPagamento)11 + }; + if (!(await _servico.Transferir(lancamentoOrigem, lancamentoDestino))) + { + return null; + } + await CarregarSaldos(); + ToggleSnackBar("TRANSFERÊNCIA REALIZADA COM SUCESSO"); + return null; + } + + private async Task>> Validar(Transferencia transferencia) + { + List> errors = ValidationHelper.AddValue(); + BancosContasServico servico = new BancosContasServico(); + Transferencia obj = transferencia; + if (((obj != null) ? obj.Origem : null) == null) + { + ValidationHelper.AddValue(errors, "ORIGEM", "NÃO É POSSÍVEL FAZER UMA TRANSFERÊNCIA SEM BANDO ORIGEM", true); + return errors; + } + Transferencia obj2 = transferencia; + if (((obj2 != null) ? obj2.Destino : null) == null) + { + ValidationHelper.AddValue(errors, "DESTINO", "NÃO É POSSÍVEL FAZER UMA TRANSFERÊNCIA SEM BANDO DESTINO", true); + return errors; + } + List ids = new List + { + ((DomainBase)transferencia.Origem).Id, + ((DomainBase)transferencia.Destino).Id + }; + List saldos = await servico.BuscarSaldoAberto(ids); + Saldo saldo2 = ((IEnumerable)saldos).FirstOrDefault((Func)((Saldo s) => ((DomainBase)s.Conta).Id == ((DomainBase)transferencia.Origem).Id)); + if (saldo2 == null) + { + List todosSaldos = await servico.BuscarSaldos(((DomainBase)transferencia.Origem).Id); + Saldo ultimoSaldo = todosSaldos.Find(delegate(Saldo x) + { + DateTime? dataInicio = x.DataInicio; + DateTime? dateTime = todosSaldos.Max((Saldo r) => r.DataInicio); + if (dataInicio.HasValue != dateTime.HasValue) + { + return false; + } + return !dataInicio.HasValue || dataInicio.GetValueOrDefault() == dateTime.GetValueOrDefault(); + }); + bool flag = ultimoSaldo.DataInicio <= transferencia.Data && ultimoSaldo.DataFinal.HasValue; + if (flag) + { + flag = await ShowMessage("O ÚLTIMO SALDO NÃO ESTÁ ABERTO. DESEJA ABRÍ-LO AGORA E CONTINUAR?", "SIM", "NÃO"); + } + if (flag) + { + ultimoSaldo.DataFinal = null; + ultimoSaldo.ValorFinal = null; + saldo2 = await servico.Save(ultimoSaldo); + } + } + if (saldo2 == null || saldo2.DataInicio > transferencia.Data) + { + ValidationHelper.AddValue(errors, "SALDO", "NÃO É POSSÍVEL REALIZAR A BAIXA DO LANÇAMENTO POIS NÃO HÁ SALDO ABERTO NO PERÍODO PARA A CONTA " + transferencia.Origem.Descricao + ".", true); + } + saldo2 = ((IEnumerable)saldos).FirstOrDefault((Func)((Saldo s) => ((DomainBase)s.Conta).Id == ((DomainBase)transferencia.Destino).Id)); + if (saldo2 == null || saldo2.DataInicio > transferencia.Data) + { + ValidationHelper.AddValue(errors, "SALDO", "NÃO É POSSÍVEL REALIZAR A BAIXA DO LANÇAMENTO POIS NÃO HÁ SALDO ABERTO NO PERÍODO PARA A CONTA " + transferencia.Destino.Descricao + ".", true); + } + return errors; + } + + public async Task AlterarLancamentos(Lancamento lancamentoAtual, bool alterarVencimento, bool alterarValores) + { + List source = await _servico.BuscarLancamentosPorControle(((DomainBase)lancamentoAtual.Controle).Id); + int i = 1; + foreach (Lancamento item in source.Where((Lancamento l) => l.Parcela > lancamentoAtual.Parcela)) + { + if (!item.Baixado) + { + if (alterarVencimento) + { + item.Vencimento = lancamentoAtual.Vencimento.AddMonths(i); + } + if (alterarValores) + { + item.Valor = lancamentoAtual.Valor; + } + await _servico.Save(item); + } + i++; + } + SelectedLancamento = lancamentoAtual; + } + + public async Task>> Salvar() + { + List> errors = SelectedLancamento.Validate() ?? new List>(); + List> list = errors; + list.AddRange(await Validar()); + if (errors.Count > 0) + { + return errors; + } + if (((DomainBase)SelectedLancamento.Controle).Id == 0 && SelectedLancamento.Controle.Parcelas > 0) + { + List list2 = new List(); + for (int i = 1; i <= SelectedLancamento.Controle.Parcelas; i++) + { + Lancamento item = new Lancamento + { + Controle = new ControleFinanceiro + { + Centro = SelectedLancamento.Controle.Centro, + Fornecedor = SelectedLancamento.Controle.Fornecedor, + Historico = SelectedLancamento.Controle.Historico, + Id = ((DomainBase)SelectedLancamento.Controle).Id, + Parcelas = SelectedLancamento.Controle.Parcelas, + Plano = SelectedLancamento.Controle.Plano + }, + Historico = SelectedLancamento.Historico, + Observacao = SelectedLancamento.Observacao, + Complemento = SelectedLancamento.Complemento, + Competencia = SelectedLancamento.Competencia, + Vencimento = ((i == 1) ? SelectedLancamento.Vencimento : SelectedLancamento.Vencimento.AddMonths(i - 1)), + Conta = SelectedLancamento.Conta, + ValorPago = ((i == 1) ? SelectedLancamento.ValorPago : new decimal?(default(decimal))), + Pagamento = ((i == 1) ? SelectedLancamento.Pagamento : null), + Baixa = ((i == 1) ? SelectedLancamento.Baixa : null), + Parcela = i, + Documento = ((i == 1) ? SelectedLancamento.Documento : ""), + Sinal = SelectedLancamento.Sinal, + TipoPagamento = SelectedLancamento.TipoPagamento, + Valor = SelectedLancamento.Valor + }; + list2.Add(item); + } + SelectedLancamento = (await _servico.AddRange(list2)).FirstOrDefault(); + FinanceiroViewModel financeiroViewModel = this; + Lancamento selectedLancamento = SelectedLancamento; + object arg = ((selectedLancamento != null) ? new long?(((DomainBase)selectedLancamento).Id) : null); + Lancamento selectedLancamento2 = SelectedLancamento; + string descricao = $"INSERIU O LANÇAMENTO DO ID {arg} HISTORICO: {((selectedLancamento2 != null) ? selectedLancamento2.Historico : null)}"; + Lancamento selectedLancamento3 = SelectedLancamento; + int num; + if (selectedLancamento3 == null) + { + num = 1; + } + else + { + _ = ((DomainBase)selectedLancamento3).Id; + num = 0; + } + financeiroViewModel.RegistrarAcao(descricao, (num != 0) ? 0 : ((DomainBase)SelectedLancamento).Id, (TipoTela)25); + VencimentoAlterado = false; + return null; + } + if (((DomainBase)SelectedLancamento.Controle).Id == 0L) + { + VencimentoAlterado = false; + } + SelectedLancamento = await _servico.Save(SelectedLancamento); + if (VencimentoAlterado && SelectedLancamento.Controle.Parcelas > 1) + { + if (await ShowMessage("DESEJA ALTERAR O VENCIMENTO PARA OS PRÓXIMOS LANÇAMENTOS?", "SIM", "NÃO")) + { + await AlterarLancamentos(SelectedLancamento, alterarVencimento: true, alterarValores: false); + } + VencimentoAlterado = false; + } + if (SelectedLancamento.Controle.Parcelas > 1 && await ShowMessage("DESEJA ALTERAR O VALOR PARA OS PRÓXIMOS LANÇAMENTOS?", "SIM", "NÃO")) + { + await AlterarLancamentos(SelectedLancamento, alterarVencimento: false, alterarValores: true); + } + if (!_servico.Sucesso) + { + return null; + } + await Buscar(); + ToggleSnackBar("LANÇAMENTO SALVO COM SUCESSO"); + return null; + } + + private async Task>> Validar() + { + List> errors = ValidationHelper.AddValue(); + BancosContasServico servico = new BancosContasServico(); + Saldo saldo = ((IEnumerable)(await servico.BuscarSaldoAberto(Contas.Select((BancosContas x) => ((DomainBase)x).Id).ToList()))).FirstOrDefault((Func)delegate(Saldo s) + { + long id = ((DomainBase)s.Conta).Id; + Lancamento selectedLancamento2 = SelectedLancamento; + long? obj; + if (selectedLancamento2 == null) + { + obj = null; + } + else + { + BancosContas conta = selectedLancamento2.Conta; + obj = ((conta != null) ? new long?(((DomainBase)conta).Id) : null); + } + return id == obj; + }); + if (saldo == null) + { + Lancamento selectedLancamento = SelectedLancamento; + if (((selectedLancamento != null) ? selectedLancamento.Conta : null) != null) + { + List todosSaldos = await servico.BuscarSaldos(((DomainBase)SelectedLancamento.Conta).Id); + Saldo ultimoSaldo = todosSaldos.Find(delegate(Saldo x) + { + DateTime? dataInicio = x.DataInicio; + DateTime? dateTime = todosSaldos.Max((Saldo r) => r.DataInicio); + if (dataInicio.HasValue != dateTime.HasValue) + { + return false; + } + return !dataInicio.HasValue || dataInicio.GetValueOrDefault() == dateTime.GetValueOrDefault(); + }); + bool flag = ultimoSaldo.DataInicio <= SelectedLancamento.Baixa && ultimoSaldo.DataFinal.HasValue; + if (flag) + { + flag = await ShowMessage("O ÚLTIMO SALDO NÃO ESTÁ ABERTO. DESEJA ABRÍ-LO AGORA E CONTINUAR?", "SIM", "NÃO"); + } + if (flag) + { + ultimoSaldo.DataFinal = null; + ultimoSaldo.ValorFinal = null; + saldo = await servico.Save(ultimoSaldo); + } + } + } + if (saldo != null && !(saldo.DataInicio > SelectedLancamento.Baixa)) + { + return new List>(); + } + ValidationHelper.AddValue(errors, "SALDO", "NÃO É POSSÍVEL REALIZAR A BAIXA DO LANÇAMENTO POIS NÃO HÁ SALDO ABERTO NO PERÍODO.", true); + return errors; + } + + public async void IncluirParcela() + { + if (!LancamentosFiltrados.Any((Lancamento x) => x.Selecionado)) + { + await ShowMessage("NECESSÁRIO SELECIONAR AO MENOS UM LANCAMENTOS PARA INCLUIR UMA NOVA PARCELA."); + return; + } + if (LancamentosFiltrados.Count((Lancamento x) => x.Selecionado) == 1) + { + SelectedLancamento = ((IEnumerable)LancamentosFiltrados).FirstOrDefault((Func)((Lancamento x) => x.Selecionado)); + } + if (LancamentosFiltrados.Count((Lancamento x) => x.Selecionado) > 1) + { + if (await ShowMessage("HÁ MAIS DE UM LANÇAMENTO SELECIONADO, DESEJA FAZER A INCLUSÃO DE NOVAS PARCELAS PARA TODOS OS LANÇAMENTOS SELECIONADOS?", "SIM", "NÃO")) + { + await AdicionarParcelaRange(); + } + return; + } + Lancamento selectedLancamento = SelectedLancamento; + if (((selectedLancamento != null) ? selectedLancamento.Controle : null) != null && ((DomainBase)SelectedLancamento.Controle).Id != 0L) + { + VisibilityFornecedor = (Visibility)2; + Alterando = (Visibility)0; + BuscaHabilitada = false; + SelectedLancamento = new Lancamento + { + Controle = new ControleFinanceiro + { + Centro = SelectedLancamento.Controle.Centro, + Fornecedor = SelectedLancamento.Controle.Fornecedor, + Historico = SelectedLancamento.Controle.Historico, + Id = ((DomainBase)SelectedLancamento.Controle).Id, + Parcelas = SelectedLancamento.Controle.Parcelas + 1, + Plano = SelectedLancamento.Controle.Plano + }, + Historico = SelectedLancamento.Historico, + Observacao = SelectedLancamento.Observacao, + Vencimento = SelectedLancamento.Vencimento.AddMonths(1), + Conta = SelectedLancamento.Conta, + Parcela = SelectedLancamento.Parcela + 1, + Documento = SelectedLancamento.Documento, + Sinal = SelectedLancamento.Sinal, + TipoPagamento = SelectedLancamento.TipoPagamento, + Valor = SelectedLancamento.Valor + }; + VisibilityCentro = (Visibility)((CentrosFiltrados.Count <= 1) ? 2 : 0); + VisibilityConta = (Visibility)((ContasFiltradas.Count <= 1) ? 2 : 0); + } + } + + private async Task AdicionarParcelaRange() + { + Loading(isLoading: true); + List lancamentosInclusao = new List(); + List list = LancamentosFiltrados.Where((Lancamento x) => x.Selecionado).Select((Func)((Lancamento x) => new Lancamento + { + Controle = new ControleFinanceiro + { + Centro = x.Controle.Centro, + Fornecedor = x.Controle.Fornecedor, + Historico = x.Controle.Historico, + Id = ((DomainBase)x.Controle).Id, + Parcelas = x.Controle.Parcelas + 1, + Plano = x.Controle.Plano + }, + Historico = x.Historico, + Observacao = x.Observacao, + Vencimento = x.Vencimento.AddMonths(1), + Conta = x.Conta, + Parcela = x.Parcela + 1, + Documento = x.Documento, + Sinal = x.Sinal, + TipoPagamento = x.TipoPagamento, + Valor = x.Valor + })).ToList(); + foreach (Lancamento x2 in list) + { + if (await _servico.BuscarLancamento(((DomainBase)x2.Controle).Id, x2.Parcela) == null) + { + lancamentosInclusao.Add(x2); + } + } + await _servico.IncluirRange(lancamentosInclusao); + if (!_servico.Sucesso) + { + Loading(isLoading: false); + return; + } + await Buscar(); + ToggleSnackBar("INCLUSÃO DE PARCELA REALIZADA COM SUCESSO"); + Loading(isLoading: false); + } + + public async Task ExcluirBaixaRange() + { + List lancamentos = LancamentosFiltrados.Where((Lancamento x) => (x.Selecionado && x.Controle.Plano != null) || (x.Historico.Equals("TRANSFERÊNCIA ENTRE CONTAS") && x.Selecionado && x.Controle.Plano == null)).ToList(); + if (lancamentos.Count == 0) + { + await ShowMessage("NÃO HÁ LANÇAMENTOS SELECIONADOS, SELECIONE-OS ANTES DE EXCLUIR A BAIXA."); + } + else + { + if (!(await ShowMessage("DESEJA REAMENTE EXCLUIR A BAIXA DOS LANÇAMENTOS SELECIONADOS?", "SIM", "NÃO"))) + { + return; + } + Loading(isLoading: true); + List lancamentosExlusao = new List(); + bool observacao = false; + foreach (Lancamento x2 in lancamentos) + { + Saldo val = await VerificaSaldo(((DomainBase)x2.Conta).Id, reabrirSaldo: false); + if (val != null && x2.Baixado) + { + if (val.DataInicio > x2.Baixa) + { + observacao = true; + continue; + } + x2.Baixa = null; + x2.ValorPago = default(decimal); + x2.Pagamento = null; + lancamentosExlusao.Add(x2); + } + } + if (lancamentosExlusao.Count == 0) + { + await ShowMessage("NÃO FOI POSSÍVEL FAZER A EXCLUSÃO, POIS NÃO HÁ LANÇAMENTOS BAIXADOS DENTRO DO ÚLTIMO SALDO ABERTO. PROCESSO INTERROMPIDO"); + Loading(isLoading: false); + return; + } + bool flag = observacao; + if (flag) + { + flag = !(await ShowMessage("HÁ LANÇAMENTOS SELECIONADOS QUE NÃO PODERÃO TER A BAIXA EXCLUÍDA. " + Environment.NewLine + "DESEJA PROSSEGUIR COM A EXCLUSÃO DA BAIXA DOS DEMAIS LANÇAMENTOS?", "SIM", "NÃO")); + } + if (flag) + { + Loading(isLoading: false); + return; + } + await _servico.Atualizar(lancamentosExlusao); + if (!_servico.Sucesso) + { + Loading(isLoading: false); + return; + } + ToggleSnackBar($"EXCLUSÃO DE BAIXA DE {lancamentosExlusao.Count} DO TOTAL DE {lancamentos.Count} LANÇAMENTOS SELECIONADOS REALIZADA COM SUCESSO."); + await Buscar(); + Loading(isLoading: false); + } + } + + public async Task ExcluirBaixa() + { + if (SelectedLancamento == null || ((DomainBase)SelectedLancamento).Id == 0L) + { + return; + } + Loading(isLoading: true); + if (!(await _servico.BuscarLancamento(((DomainBase)SelectedLancamento).Id)).Baixa.HasValue) + { + await ShowMessage("LANÇAMENTO AINDA NÃO BAIXADO. PROCESSO INTERROMPIDO"); + Loading(isLoading: false); + return; + } + if (!(await ShowMessage("DESEJA REAMENTE EXCLUIR A BAIXA DO LANÇAMENTO SELECIONADO?", "SIM", "NÃO"))) + { + Loading(isLoading: false); + return; + } + Saldo val = await VerificaSaldo(((DomainBase)SelectedLancamento.Conta).Id, reabrirSaldo: true); + if (val == null) + { + return; + } + if (val.DataInicio > SelectedLancamento.Baixa) + { + await ShowMessage("LANÇAMENTO NÃO PODE TER SUA BAIXA EXCLUÍDA POIS NÃO POSSUI SALDO ABERTO PARA O PERÍODO."); + Loading(isLoading: false); + return; + } + SelectedLancamento.Baixa = null; + SelectedLancamento.ValorPago = default(decimal); + SelectedLancamento.Pagamento = null; + SelectedLancamento.Baixado = false; + SelectedLancamento = await _servico.Save(SelectedLancamento); + if (importando) + { + BindImportando(); + LancamentosFiltrados = Lancamentos; + Loading(isLoading: false); + } + else if (_servico.Sucesso) + { + ToggleSnackBar("EXCLUSÃO DE BAIXA REALIZADA COM SUCESSO"); + await Buscar(); + Loading(isLoading: false); + } + } + + public async Task ExcluirRange() + { + List lancamentos = LancamentosFiltrados.Where((Lancamento x) => x.Selecionado).ToList(); + if (lancamentos.Count == 0) + { + await ShowMessage("NÃO HÁ LANÇAMENTOS SELECIONADOS, SELECIONE-OS ANTES DE EXCLUIR."); + } + else + { + if (!(await ShowMessage("DESEJA REAMENTE EXCLUIR OS LANÇAMENTOS SELECIONADOS? ESSE PROCESSO É IRREVERSÍVEL.", "SIM", "NÃO"))) + { + return; + } + Loading(isLoading: true); + List lancamentosExlusao = new List(); + List transferencias = LancamentosFiltrados.Where((Lancamento x) => x.Selecionado && x.Historico.Equals("TRANSFERÊNCIA ENTRE CONTAS")).ToList(); + transferencias.ForEach(delegate(Lancamento x) + { + Lancamento y = ((IEnumerable)transferencias).FirstOrDefault((Func)((Lancamento z) => ((DomainBase)z.Controle).Id == ((DomainBase)x.Controle).Id && x.Valor == z.Valor && x.Sinal != z.Sinal)); + if (y != null && lancamentosExlusao.Where((Lancamento z) => z == x || z == y).ToList().Count <= 0) + { + lancamentosExlusao.AddRange(new List { x, y }); + } + }); + bool flag = transferencias?.Count != lancamentosExlusao.Count; + if (flag) + { + flag = !(await ShowMessage("HÁ TRANSFERÊNCIA ENTRE CONTAS SELECIONADOS QUE NÃO PODERÃO TER A BAIXA EXCLUÍDA, PARA EXCLUIR É NECESSÁRIO SELECIONAR O DÉBITO E O CRÉDITO DA TRANSFERENCIA" + Environment.NewLine + "DESEJA PROSSEGUIR COM A EXCLUSÃO DOS DEMAIS LANÇAMENTOS?", "SIM", "NÃO")); + } + if (flag) + { + Loading(isLoading: false); + return; + } + bool observacao = false; + List todosLancamentos = new List(); + foreach (Lancamento x2 in (from x in lancamentos + orderby ((DomainBase)x.Controle).Id, x.Parcela descending + select x).ToList()) + { + if (x2.Baixado) + { + Saldo val = await VerificaSaldo(((DomainBase)x2.Conta).Id, reabrirSaldo: false); + if (val == null) + { + continue; + } + if (val.DataInicio > x2.Baixa) + { + observacao = true; + continue; + } + } + Lancamento lancamentoPosterior = await _servico.BuscarLancamento(((DomainBase)x2.Controle).Id, x2.Parcela + 1); + if (lancamentoPosterior != null) + { + todosLancamentos = (await _servico.BuscarLancamentosPorControle(((DomainBase)x2.Controle).Id)).Where((Lancamento c) => !c.Baixado && c.Parcela >= x2.Parcela + 1).AsEnumerable().ToList(); + } + if (lancamentoPosterior != null && lancamentosExlusao.All((Lancamento l) => ((DomainBase)l).Id != ((DomainBase)lancamentoPosterior).Id)) + { + observacao = true; + } + else if (x2.Controle.Plano != null) + { + lancamentosExlusao.Add(x2); + } + } + if (lancamentosExlusao.Count == 0 && todosLancamentos.Count == 0) + { + await ShowMessage("OS LANÇAMENTOS SELECIONADOS NÃO PODEM SER EXCLUÍDOS. NENHUMA ALTERAÇÃO FOI FEITA"); + Loading(isLoading: false); + return; + } + flag = observacao; + if (flag) + { + flag = !(await ShowMessage("HÁ LANÇAMENTOS SELECIONADOS QUE NÃO PODERÃO SER EXCLUÍDOS. " + Environment.NewLine + "DESEJA PROSSEGUIR COM A EXCLUSÃO DOS DEMAIS LANÇAMENTOS?", "SIM", "NÃO")); + } + if (flag) + { + Loading(isLoading: false); + return; + } + flag = todosLancamentos.Count > 0; + if (flag) + { + flag = await ShowMessage("DESEJA EXCLUIR LANÇAMENTOS/PARCELAS CADASTRADOS ACIMA DAS SELECIONADAS.", "SIM", "NÃO"); + } + if (flag) + { + lancamentosExlusao.AddRange(todosLancamentos); + } + if (!(await _servico.Excluir(lancamentosExlusao))) + { + Loading(isLoading: false); + return; + } + if (lancamentosExlusao != null && lancamentosExlusao.Count > 0) + { + lancamentosExlusao.ForEach(delegate(Lancamento x) + { + FinanceiroViewModel financeiroViewModel = this; + string descricao = $"EXCLUIU O LANÇAMENTO DO ID {((x != null) ? new long?(((DomainBase)x).Id) : null)} HISTORICO: {((x != null) ? x.Historico : null)}"; + long entidadeId; + if (x != null) + { + _ = ((DomainBase)x).Id; + if (0 == 0) + { + entidadeId = ((DomainBase)x).Id; + goto IL_0054; + } + } + entidadeId = 0L; + goto IL_0054; + IL_0054: + financeiroViewModel.RegistrarAcao(descricao, entidadeId, (TipoTela)25); + }); + } + ToggleSnackBar($"EXCLUSÃO DE {lancamentosExlusao.Count} DO TOTAL DE {lancamentos.Count} LANÇAMENTOS SELECIONADOS REALIZADA COM SUCESSO."); + await Buscar(); + Loading(isLoading: false); + } + } + + private async Task VerificaSaldo(long contaId, bool reabrirSaldo) + { + Saldo saldo = ((IEnumerable)(await new BancosContasServico().BuscarSaldoAberto(Contas.Select((BancosContas x) => ((DomainBase)x).Id).ToList()))).FirstOrDefault((Func)((Saldo s) => ((DomainBase)s.Conta).Id == contaId)); + if (saldo == null && reabrirSaldo) + { + await ShowMessage("NÃO FOI ENCONTRADO UM SALDO ABERTO PARA FAZER A EXCLUSÃO."); + } + return saldo; + } + + public async Task Excluir() + { + if (SelectedLancamento == null || ((DomainBase)SelectedLancamento).Id == 0L) + { + return; + } + Loading(isLoading: true); + Lancamento lancamento = await _servico.BuscarLancamento(((DomainBase)SelectedLancamento).Id); + Saldo val = await VerificaSaldo(((DomainBase)SelectedLancamento.Conta).Id, reabrirSaldo: true); + if (val == null) + { + return; + } + if (val.DataInicio > lancamento.Baixa) + { + await ShowMessage("LANÇAMENTO NÃO PODE SER EXCLUÍDO POIS NÃO POSSUI SALDO ABERTO PARA O PERÍODO."); + Loading(isLoading: false); + return; + } + if (!(await ShowMessage("DESEJA REAMENTE EXCLUIR O LANÇAMENTO SELECIONADO?", "SIM", "NÃO"))) + { + Loading(isLoading: false); + return; + } + if (!(await _servico.Excluir(SelectedLancamento))) + { + Loading(isLoading: false); + return; + } + FinanceiroViewModel financeiroViewModel = this; + Lancamento selectedLancamento = SelectedLancamento; + object arg = ((selectedLancamento != null) ? new long?(((DomainBase)selectedLancamento).Id) : null); + Lancamento selectedLancamento2 = SelectedLancamento; + string descricao = $"EXCLUIU O LANÇAMENTO DO ID {arg} HISTORICO: {((selectedLancamento2 != null) ? selectedLancamento2.Historico : null)}"; + Lancamento selectedLancamento3 = SelectedLancamento; + int num; + if (selectedLancamento3 == null) + { + num = 1; + } + else + { + _ = ((DomainBase)selectedLancamento3).Id; + num = 0; + } + financeiroViewModel.RegistrarAcao(descricao, (num != 0) ? 0 : ((DomainBase)SelectedLancamento).Id, (TipoTela)25); + ToggleSnackBar("EXCLUSÃO REALIZADA COM SUCESSO"); + await Buscar(); + Loading(isLoading: false); + } + + public async Task SalvarImportacao(List list) + { + List lancamentosAtualizar = new List(); + List lancamentosBaixar = new List(); + List lancamentosIncluir = new List(); + List lancamentos = new List(); + foreach (Lancamento x2 in list) + { + if (x2.Baixado) + { + continue; + } + if (!x2.Selecionado) + { + x2.Baixa = null; + } + if (x2.Baixa.HasValue) + { + Saldo val = await VerificaSaldo(((DomainBase)x2.Conta).Id, reabrirSaldo: false); + if (val == null || val.DataInicio > x2.Baixa) + { + continue; + } + } + string[] array = x2.Observacao?.Split(new char[1] { '\n' }); + StringBuilder stringBuilder = new StringBuilder(); + string value = "IMPORTAÇÃO OFX REALIZADA PELO USUÁRIO"; + if (array != null) + { + string[] array2 = array; + foreach (string text in array2) + { + if (text.IndexOf(value, StringComparison.InvariantCulture) != 0) + { + stringBuilder.Append(text + "\n"); + } + } + } + x2.Observacao = string.Format("{0}IMPORTAÇÃO OFX REALIZADA PELO USUÁRIO {1} {2} EM {3}", stringBuilder, ((DomainBase)Recursos.Usuario).Id, Recursos.Usuario.Nome, Funcoes.GetNetworkTime().ToString("F").ToUpper()); + if (((DomainBase)x2).Id > 0) + { + if (x2.Baixa.HasValue) + { + lancamentosBaixar.Add(x2); + } + else + { + lancamentosAtualizar.Add(x2); + } + } + else + { + lancamentosIncluir.Add(x2); + } + lancamentos.Add(x2); + } + if (lancamentos.Count == 0) + { + await ShowMessage("NÃO HÁ LANÇAMENTOS PARA SEREM ATUALIZADOS."); + Loading(isLoading: false); + return false; + } + if (!(await ShowMessage($"{lancamentosIncluir.Count} LANÇAMENTOS SERÃO CRIADOS.{Environment.NewLine}{lancamentosAtualizar.Count} LANÇAMENTOS SERÃO ATUALIZADOS.{Environment.NewLine}{lancamentosBaixar.Count} LANÇAMENTOS SERÃO BAIXADOS.{Environment.NewLine}{Environment.NewLine}DESEJA REALMENTE PROSSEGUIR?", "SIM", "NÃO"))) + { + Loading(isLoading: false); + return false; + } + bool sucesso = true; + foreach (Lancamento x2 in lancamentos) + { + await _servico.Save(x2); + sucesso = sucesso && _servico.Sucesso; + if (x2 != null && ((DomainBase)x2).Id != 0 && sucesso) + { + FinanceiroViewModel financeiroViewModel = this; + object arg = ((DomainBase)x2).Id; + Lancamento obj = x2; + string descricao = $"BAIXOU/ATUALIZOU O LANÇAMENTO DO ID {arg}POR IMPORTAÇÃO HISTORICO: {((obj != null) ? obj.Historico : null)}"; + Lancamento obj2 = x2; + int num; + if (obj2 == null) + { + num = 1; + } + else + { + _ = ((DomainBase)obj2).Id; + num = 0; + } + financeiroViewModel.RegistrarAcao(descricao, (num != 0) ? 0 : ((DomainBase)x2).Id, (TipoTela)25); + } + else if (x2 != null && sucesso) + { + FinanceiroViewModel financeiroViewModel2 = this; + Lancamento obj3 = x2; + financeiroViewModel2.RegistrarAcao("INSERIU O LANÇAMENTO POR IMPORTAÇÃO HISTORICO: " + ((obj3 != null) ? obj3.Historico : null), 0L, (TipoTela)25); + } + } + if (!sucesso) + { + await ShowMessage("HOUVERAM PROBLEMAS AO INCLUIR OU ATUALIZAR LANÇAMENTOS, FAVOR CONFERIR A IMPORTAÇÃO."); + return false; + } + await Buscar(); + ToggleSnackBar("ATUALIZAÇÃO REALIZADA COM SUCESSO"); + await CarregarSaldos(); + return true; + } + + public async Task Atualizar(List list) + { + Loading(isLoading: true); + List lancamentosAtualizar = new List(); + List lancamentosBaixar = new List(); + List lancamentos = new List(); + foreach (Lancamento x in list) + { + if (x.Baixado) + { + continue; + } + if (!x.Selecionado) + { + x.Baixa = null; + } + if (x.Baixa.HasValue) + { + Saldo val = await VerificaSaldo(((DomainBase)x.Conta).Id, reabrirSaldo: false); + if (val == null || val.DataInicio > x.Baixa) + { + continue; + } + } + if (x.Selecionado) + { + string text = ((x.Observacao == null) ? "" : ("\n " + x.Observacao)); + x.Observacao = string.Format("BAIXA AGRUPADA REALIZADA PELO USUARIO {0} {1} EM {2}{3}", ((DomainBase)Recursos.Usuario).Id, Recursos.Usuario.Nome, Funcoes.GetNetworkTime().ToString("F").ToUpper(), text); + } + List> list2 = x.Validate(); + if (list2 == null || list2.Count <= 0) + { + if (x.Baixa.HasValue) + { + lancamentosBaixar.Add(x); + } + else + { + lancamentosAtualizar.Add(x); + } + lancamentos.Add(x); + } + } + if (lancamentos.Count == 0) + { + await ShowMessage("NÃO HÁ LANÇAMENTOS PARA SEREM ATUALIZADOS."); + Loading(isLoading: false); + return; + } + if (!(await ShowMessage($"{lancamentosAtualizar.Count} LANÇAMENTOS SERÃO ATUALIZADOS.{Environment.NewLine}{lancamentosBaixar.Count} LANÇAMENTOS SERÃO BAIXADOS.{Environment.NewLine}{Environment.NewLine}DESEJA REALMENTE PROSSEGUIR?", "SIM", "NÃO"))) + { + Loading(isLoading: false); + return; + } + await _servico.Atualizar(lancamentos); + if (!_servico.Sucesso) + { + Loading(isLoading: false); + return; + } + if (await ShowMessage("DESEJA GERAR O RELATÓRIO NOVAMENTE?", "SIM,", "NÃO")) + { + await Buscar(); + } + ToggleSnackBar("ATUALIZAÇÃO REALIZADA COM SUCESSO"); + await CarregarSaldos(); + Loading(isLoading: false); + } + + public void Sintetizar() + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Unknown result type (might be due to invalid IL or missing references) + //IL_0009: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Expected I4, but got Unknown + SinteticoFinanceiroTipo sinteticoTipo = SinteticoTipo; + List list = (sinteticoTipo - 1) switch + { + 3 => (from x in LancamentosFiltrados + where x.Controle.Plano != null && x.Controle.Plano.Plano != null + group x by new + { + ((DomainBase)x.Controle.Plano.Plano).Id, + x.Controle.Plano.Plano.Descricao + } into x + select new Sintetico + { + Agrupamento = x.Key.Descricao, + Valor = x.Sum((Lancamento s) => ((int)s.Sinal != 0) ? (-s.Valor) : s.Valor), + ValorPago = x.Sum((Lancamento s) => ((int)s.Sinal != 0) ? (-s.ValorPago).GetValueOrDefault() : s.ValorPago.GetValueOrDefault()) + }).ToList(), + 0 => (from x in LancamentosFiltrados + where x.Controle.Plano != null + group x by new + { + ((DomainBase)x.Controle.Centro).Id, + x.Controle.Centro.Descricao + } into x + select new Sintetico + { + Agrupamento = x.Key.Descricao, + Valor = x.Sum((Lancamento s) => ((int)s.Sinal != 0) ? (-s.Valor) : s.Valor), + ValorPago = x.Sum((Lancamento s) => ((int)s.Sinal != 0) ? (-s.ValorPago).GetValueOrDefault() : s.ValorPago.GetValueOrDefault()) + }).ToList(), + 2 => (from x in LancamentosFiltrados + where x.Controle.Plano != null + group x by new + { + ((DomainBase)x.Conta).Id, + x.Conta.Descricao + } into x + select new Sintetico + { + Agrupamento = x.Key.Descricao, + Valor = x.Sum((Lancamento s) => ((int)s.Sinal != 0) ? (-s.Valor) : s.Valor), + ValorPago = x.Sum((Lancamento s) => ((int)s.Sinal != 0) ? (-s.ValorPago).GetValueOrDefault() : s.ValorPago.GetValueOrDefault()) + }).ToList(), + 1 => (from x in LancamentosFiltrados + where x.Controle.Plano != null + group x by new + { + x.Controle.Fornecedor.Id, + x.Controle.Fornecedor.Nome + } into x + select new Sintetico + { + Agrupamento = x.Key.Nome, + Valor = x.Sum((Lancamento s) => ((int)s.Sinal != 0) ? (-s.Valor) : s.Valor), + ValorPago = x.Sum((Lancamento s) => ((int)s.Sinal != 0) ? (-s.ValorPago).GetValueOrDefault() : s.ValorPago.GetValueOrDefault()) + }).ToList(), + _ => (from x in LancamentosFiltrados + where x.Controle.Plano != null + group x by new + { + ((DomainBase)x.Controle.Plano).Id, + x.Controle.Plano.Descricao + } into x + select new Sintetico + { + Agrupamento = x.Key.Descricao, + Valor = x.Sum((Lancamento s) => ((int)s.Sinal != 0) ? (-s.Valor) : s.Valor), + ValorPago = x.Sum((Lancamento s) => ((int)s.Sinal != 0) ? (-s.ValorPago).GetValueOrDefault() : s.ValorPago.GetValueOrDefault()) + }).ToList(), + }; + if (list.Count != 0) + { + ((Window)new SinteticoView(list, "RELATORIO FINANCEIRO", Inicio, Fim)).Show(); + } + } + + public List> ValidateIncluir() + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0026: Unknown result type (might be due to invalid IL or missing references) + //IL_0032: Unknown result type (might be due to invalid IL or missing references) + //IL_003e: Unknown result type (might be due to invalid IL or missing references) + //IL_004a: Unknown result type (might be due to invalid IL or missing references) + //IL_004c: Unknown result type (might be due to invalid IL or missing references) + //IL_0056: Unknown result type (might be due to invalid IL or missing references) + //IL_0062: Unknown result type (might be due to invalid IL or missing references) + //IL_006e: Unknown result type (might be due to invalid IL or missing references) + //IL_007a: Unknown result type (might be due to invalid IL or missing references) + //IL_0086: Unknown result type (might be due to invalid IL or missing references) + //IL_0092: Unknown result type (might be due to invalid IL or missing references) + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + Lancamento val = new Lancamento(); + Lancamento selectedLancamento = SelectedLancamento; + val.Controle = (ControleFinanceiro)(((object)((selectedLancamento != null) ? selectedLancamento.Controle : null)) ?? ((object)new ControleFinanceiro())); + val.Historico = Historico; + val.Valor = Valor; + val.Conta = Conta; + val.TipoPagamento = TipoPagamento; + val.Documento = Documento; + val.Competencia = Competencia; + val.Complemento = Complemento; + val.Baixa = Baixa; + val.Vencimento = Vencimento; + val.Pagamento = Pagamento; + return val.Validate(); + } + + public void AdicionarFiltros() + { + ExtensionMethods.ForEach(PlanosFiltro.Where((Planos x) => x.Selecionado), (Action)delegate(Planos x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Unknown result type (might be due to invalid IL or missing references) + //IL_0018: Unknown result type (might be due to invalid IL or missing references) + //IL_0025: Expected O, but got Unknown + FiltroPersonalizado filtro3 = new FiltroPersonalizado + { + Id = ((DomainBase)x).Id, + Tipo = (TipoFiltroFinanceiro)1, + Descricao = x.Descricao + }; + AdicionarFiltro(filtro3); + }); + PlanosFiltro = new List(Planos.OrderBy((Planos x) => x.Descricao)); + ExtensionMethods.ForEach(ContaFiltro.Where((BancosContas x) => x.Selecionado), (Action)delegate(BancosContas x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Unknown result type (might be due to invalid IL or missing references) + //IL_0018: Unknown result type (might be due to invalid IL or missing references) + //IL_0025: Expected O, but got Unknown + FiltroPersonalizado filtro2 = new FiltroPersonalizado + { + Id = ((DomainBase)x).Id, + Tipo = (TipoFiltroFinanceiro)3, + Descricao = x.Descricao + }; + AdicionarFiltro(filtro2); + }); + ContaFiltro = new List(Contas.OrderBy((BancosContas x) => x.Descricao)); + ExtensionMethods.ForEach(CentroFiltro.Where((Centro x) => x.Selecionado), (Action)delegate(Centro x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Unknown result type (might be due to invalid IL or missing references) + //IL_0018: Unknown result type (might be due to invalid IL or missing references) + //IL_0025: Expected O, but got Unknown + FiltroPersonalizado filtro = new FiltroPersonalizado + { + Id = ((DomainBase)x).Id, + Tipo = (TipoFiltroFinanceiro)2, + Descricao = x.Descricao + }; + AdicionarFiltro(filtro); + x.Selecionado = false; + }); + CentroFiltro = new List(Centros.OrderBy((Centro x) => x.Descricao)); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Financeiro/FornecedorViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Financeiro/FornecedorViewModel.cs new file mode 100644 index 0000000..64f20d3 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Financeiro/FornecedorViewModel.cs @@ -0,0 +1,477 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; +using Assinador.Infrastructure.Helpers; +using ClosedXML.Excel; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Financeiro; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Financeiro; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.Helper; + +namespace Gestor.Application.ViewModels.Financeiro; + +public class FornecedorViewModel : BaseFinanceiroViewModel +{ + private readonly FornecedorServico _servico; + + private List _planos; + + private ObservableCollection _planosFiltrados; + + private List _contas; + + private ObservableCollection _contasFiltradas; + + private List _centros; + + private ObservableCollection _centrosFiltrados; + + private ObservableCollection _fornecedorFiltrados = new ObservableCollection(); + + private bool _isExpanded; + + private Fornecedor _selectedFornecedor; + + private string _anotacoes; + + private long _ultimoId; + + public Fornecedor CancelProduto; + + public List Planos + { + get + { + return _planos; + } + set + { + _planos = value; + OnPropertyChanged("Planos"); + } + } + + public ObservableCollection PlanosFiltrados + { + get + { + return _planosFiltrados; + } + set + { + _planosFiltrados = value; + OnPropertyChanged("PlanosFiltrados"); + } + } + + public List Contas + { + get + { + return _contas; + } + set + { + _contas = value; + OnPropertyChanged("Contas"); + } + } + + public ObservableCollection ContasFiltradas + { + get + { + return _contasFiltradas; + } + set + { + _contasFiltradas = value; + OnPropertyChanged("ContasFiltradas"); + } + } + + public List Centros + { + get + { + return _centros; + } + set + { + _centros = value; + OnPropertyChanged("Centros"); + } + } + + public ObservableCollection CentrosFiltrados + { + get + { + return _centrosFiltrados; + } + set + { + _centrosFiltrados = value; + OnPropertyChanged("CentrosFiltrados"); + } + } + + public ObservableCollection FornecedorFiltrados + { + get + { + return _fornecedorFiltrados; + } + set + { + _fornecedorFiltrados = value; + IsExpanded = value != null && value.Count > 0; + OnPropertyChanged("FornecedorFiltrados"); + } + } + + public bool IsExpanded + { + get + { + return _isExpanded; + } + set + { + _isExpanded = value; + OnPropertyChanged("IsExpanded"); + } + } + + public List Fornecedor { get; set; } + + public Fornecedor SelectedFornecedor + { + get + { + return _selectedFornecedor; + } + set + { + _selectedFornecedor = value; + VerificarEnables((value != null) ? new long?(value.Id) : null); + Anotacoes = string.Empty; + _ultimoId = ((value != null && value.Id > 0) ? value.Id : _ultimoId); + OnPropertyChanged("SelectedFornecedor"); + } + } + + public string Anotacoes + { + get + { + return _anotacoes; + } + set + { + _anotacoes = value; + OnPropertyChanged("Anotacoes"); + } + } + + public FornecedorViewModel() + { + _servico = new FornecedorServico(); + base.EnableMenu = true; + BuscaIncial(); + } + + internal async Task> Filtrar(string value) + { + return await Task.Run(() => FiltrarFornecedor(value)); + } + + public List FiltrarFornecedor(string filter) + { + FornecedorFiltrados = (string.IsNullOrWhiteSpace(filter) ? new ObservableCollection(Fornecedor) : new ObservableCollection(from x in Fornecedor + where ValidationHelper.RemoveDiacritics(x.Nome.Trim()).ToUpper().Contains(ValidationHelper.RemoveDiacritics(filter)) || (x.Documento != null && ValidationHelper.RemoveDiacritics(x.Documento.Trim()).Contains(filter)) || (x.Telefone1 != null && ValidationHelper.RemoveDiacritics(x.Telefone1.Trim()).Contains(filter)) || (x.Telefone2 != null && ValidationHelper.RemoveDiacritics(x.Telefone2.Trim()).Contains(filter)) || (x.Email != null && ValidationHelper.RemoveDiacritics(x.Email.Trim()).Contains(filter)) + orderby x.Nome descending + select x)); + if (FornecedorFiltrados.Count == 1) + { + SelectedFornecedor = FornecedorFiltrados.First(); + } + return FornecedorFiltrados.ToList(); + } + + private async void BuscaIncial() + { + Loading(isLoading: true); + await PermissaoTela((TipoTela)24); + Planos = await new PlanoServico().BuscarPlanos(); + PlanosFiltrados = new ObservableCollection(from x in Planos + where x.Ativo + orderby x.Descricao + select x); + Contas = await new BancosContasServico().BuscarBancos(); + ContasFiltradas = new ObservableCollection(from x in Contas + where x.Ativo + orderby x.Descricao + select x); + Centros = await new CentroServico().BuscarCentros(); + CentrosFiltrados = new ObservableCollection(from x in Centros + where x.Ativo + orderby x.Descricao + select x); + await SelecionaFornecedor(); + SelectedFornecedor = FornecedorFiltrados.FirstOrDefault(); + Loading(isLoading: false); + } + + private async Task SelecionaFornecedor() + { + Fornecedor = await _servico.BuscarFornecedores(); + FornecedorFiltrados = new ObservableCollection(Fornecedor.OrderBy((Fornecedor x) => x.Nome)); + } + + public void Incluir() + { + //IL_001a: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + //IL_0027: Unknown result type (might be due to invalid IL or missing references) + //IL_0033: Expected O, but got Unknown + Fornecedor selectedFornecedor = SelectedFornecedor; + _ultimoId = ((selectedFornecedor != null) ? selectedFornecedor.Id : 0); + SelectedFornecedor = new Fornecedor + { + IdEmpresa = 1L, + Ativo = true + }; + Alterar(alterar: true); + } + + public async void CancelarAlteracao() + { + Loading(isLoading: true); + Alterar(alterar: false); + if (SelectedFornecedor.Id > 0) + { + await SelecionaFornecedor(); + } + SelectedFornecedor = ((IEnumerable)FornecedorFiltrados).FirstOrDefault((Func)((Fornecedor x) => x.Id == _ultimoId)); + Loading(isLoading: false); + } + + public async Task>> Salvar() + { + List> erros = SelectedFornecedor.Validate(); + List> list = erros; + list.AddRange(await Validate()); + if (erros.Count > 0) + { + return erros; + } + if (!SelectedFornecedor.TipoPagamento.HasValue) + { + SelectedFornecedor.TipoPagamento = (TipoPagamento)12; + } + if (!string.IsNullOrWhiteSpace(Anotacoes)) + { + SelectedFornecedor.Observacao = $"{Recursos.Usuario.Nome}, ID: {((DomainBase)Recursos.Usuario).Id}, {Funcoes.GetNetworkTime():g}{Environment.NewLine}{Anotacoes}{Environment.NewLine}{Environment.NewLine}{SelectedFornecedor.Observacao}"; + } + Fornecedor fornecedor = await _servico.Save(SelectedFornecedor); + if (!_servico.Sucesso) + { + return null; + } + await SelecionaFornecedor(); + SelectedFornecedor = FornecedorFiltrados.First((Fornecedor x) => x.Id == fornecedor.Id); + ToggleSnackBar("FORNECEDOR SALVO COM SUCESSO"); + Alterar(alterar: false); + return null; + } + + public async Task>> Validate() + { + List> errors = ValidationHelper.AddValue(); + if (!string.IsNullOrWhiteSpace(SelectedFornecedor.Documento)) + { + List list = (await _servico.BuscarFornecedores()).Where((Fornecedor x) => x.Id != SelectedFornecedor.Id && ValidationHelper.DocumentoFornecedor(x.Documento) == ValidationHelper.DocumentoFornecedor(SelectedFornecedor.Documento)).ToList(); + if (list.Count > 0) + { + ValidationHelper.AddValue(errors, "DOCUMENTO", "DOCUMENTO JÁ CADASTRADO PARA OUTROS FORNECEDORES " + string.Join(" | ", list.Select((Fornecedor x) => x.Nome)), true); + } + } + return errors; + } + + public async Task Delete() + { + if (SelectedFornecedor != null && SelectedFornecedor.Id != 0L && await ShowMessage("DESEJA REALMENTE EXCLUIR O FORNECEDOR " + SelectedFornecedor.Nome + "?", "SIM", "NÃO")) + { + Loading(isLoading: true); + if (await new FinanceiroServico().TemLancamentosPorFornecedor(SelectedFornecedor.Id)) + { + await ShowMessage("IMPOSSÍVEL REAIZAR A EXCLUSÃO POIS EXISTEM LANCAMENTOS PARA ESSE FORNECEDOR. PROCESSO INTERROMPIDO"); + Loading(isLoading: false); + return; + } + if (!(await _servico.Delete(SelectedFornecedor))) + { + Loading(isLoading: false); + return; + } + await SelecionaFornecedor(); + SelectedFornecedor = FornecedorFiltrados.FirstOrDefault(); + ToggleSnackBar("FORNECEDOR EXCLUÍDO COM SUCESSO"); + Loading(isLoading: false); + } + } + + public void Copiar(Cliente cliente) + { + if (SelectedFornecedor == null) + { + Incluir(); + } + SelectedFornecedor.Nome = cliente.Nome; + SelectedFornecedor.Documento = cliente.Documento; + Fornecedor selectedFornecedor = SelectedFornecedor; + object cep; + if (cliente.Enderecos == null || !cliente.Enderecos.Any()) + { + cep = null; + } + else + { + ClienteEndereco obj = cliente.Enderecos.First(); + cep = ((obj == null) ? null : ((EnderecoBase)obj).Cep?.Trim()); + } + ((EnderecoBase)selectedFornecedor).Cep = (string)cep; + Fornecedor selectedFornecedor2 = SelectedFornecedor; + object endereco; + if (cliente.Enderecos == null || !cliente.Enderecos.Any()) + { + endereco = null; + } + else + { + ClienteEndereco obj2 = cliente.Enderecos.First(); + endereco = ((obj2 == null) ? null : ((EnderecoBase)obj2).Endereco?.Trim()); + } + ((EnderecoBase)selectedFornecedor2).Endereco = (string)endereco; + Fornecedor selectedFornecedor3 = SelectedFornecedor; + object numero; + if (cliente.Enderecos == null || !cliente.Enderecos.Any()) + { + numero = null; + } + else + { + ClienteEndereco obj3 = cliente.Enderecos.First(); + numero = ((obj3 == null) ? null : ((EnderecoBase)obj3).Numero?.Trim()); + } + ((EnderecoBase)selectedFornecedor3).Numero = (string)numero; + Fornecedor selectedFornecedor4 = SelectedFornecedor; + object complemento; + if (cliente.Enderecos == null || !cliente.Enderecos.Any()) + { + complemento = null; + } + else + { + ClienteEndereco obj4 = cliente.Enderecos.First(); + complemento = ((obj4 == null) ? null : ((EnderecoBase)obj4).Complemento?.Trim()); + } + ((EnderecoBase)selectedFornecedor4).Complemento = (string)complemento; + Fornecedor selectedFornecedor5 = SelectedFornecedor; + object bairro; + if (cliente.Enderecos == null || !cliente.Enderecos.Any()) + { + bairro = null; + } + else + { + ClienteEndereco obj5 = cliente.Enderecos.First(); + bairro = ((obj5 == null) ? null : ((EnderecoBase)obj5).Bairro?.Trim()); + } + ((EnderecoBase)selectedFornecedor5).Bairro = (string)bairro; + Fornecedor selectedFornecedor6 = SelectedFornecedor; + object cidade; + if (cliente.Enderecos == null || !cliente.Enderecos.Any()) + { + cidade = null; + } + else + { + ClienteEndereco obj6 = cliente.Enderecos.First(); + cidade = ((obj6 == null) ? null : ((EnderecoBase)obj6).Cidade?.Trim()); + } + ((EnderecoBase)selectedFornecedor6).Cidade = (string)cidade; + Fornecedor selectedFornecedor7 = SelectedFornecedor; + object estado; + if (cliente.Enderecos == null || !cliente.Enderecos.Any()) + { + estado = null; + } + else + { + ClienteEndereco obj7 = cliente.Enderecos.First(); + estado = ((obj7 == null) ? null : ((EnderecoBase)obj7).Estado?.Trim()); + } + ((EnderecoBase)selectedFornecedor7).Estado = (string)estado; + SelectedFornecedor.TipoTelefone1 = ((cliente.Telefones != null && cliente.Telefones.Any()) ? ((TelefoneBase)cliente.Telefones.First()).Tipo : null); + SelectedFornecedor.Prefixo1 = ((cliente.Telefones == null || !cliente.Telefones.Any()) ? null : ((TelefoneBase)cliente.Telefones.First()).Prefixo?.Trim()); + SelectedFornecedor.Telefone1 = ((cliente.Telefones == null || !cliente.Telefones.Any()) ? null : ((TelefoneBase)cliente.Telefones.First()).Numero?.Trim()); + SelectedFornecedor.TipoTelefone2 = ((cliente.Telefones != null && cliente.Telefones.Any() && cliente.Telefones.Count > 2) ? ((TelefoneBase)cliente.Telefones[1]).Tipo : null); + SelectedFornecedor.Prefixo2 = ((cliente.Telefones == null || cliente.Telefones.Count <= 2) ? null : ((TelefoneBase)cliente.Telefones[1]).Prefixo?.Trim()); + SelectedFornecedor.Telefone2 = ((cliente.Telefones == null || cliente.Telefones.Count <= 2) ? null : ((TelefoneBase)cliente.Telefones[1]).Numero?.Trim()); + SelectedFornecedor.Email = ((cliente.Emails == null || !cliente.Emails.Any() || cliente.Emails.Count <= 0) ? null : ((EmailBase)cliente.Emails.First()).Email?.Trim()); + OnPropertyChanged("SelectedFornecedor"); + } + + public async void Excel() + { + XLWorkbook xlWorkbook = new XLWorkbook(); + string nome = "RELAÓRIO DE FORNECEDOR"; + xlWorkbook = await Funcoes.GerarXls(xlWorkbook, nome, FornecedorFiltrados.ToList()); + string text = ""; + string text2; + if (Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 41)) + { + FolderBrowserDialog val = new FolderBrowserDialog(); + try + { + if (1 != (int)((CommonDialog)val).ShowDialog()) + { + return; + } + text = val.SelectedPath + "\\"; + Directory.CreateDirectory(text); + } + finally + { + ((IDisposable)val)?.Dispose(); + } + text2 = text + nome + " " + Functions.GetNetworkTime().Date.ToShortDateString().Replace("/", "") + ".xlsx"; + } + else + { + text = Path.GetTempPath(); + text2 = $"{text}{Guid.NewGuid()}.xlsx"; + } + xlWorkbook.SaveAs(text2); + Process.Start(text2); + } + + public async void Imprimir() + { + await ImprimirFornecedor(FornecedorFiltrados.ToList()); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Financeiro/InfoExtratoViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Financeiro/InfoExtratoViewModel.cs new file mode 100644 index 0000000..1cf33dc --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Financeiro/InfoExtratoViewModel.cs @@ -0,0 +1,64 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using Gestor.Application.Servicos.Financeiro; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Domain.Financeiro; +using Gestor.Model.Domain.Generic; + +namespace Gestor.Application.ViewModels.Financeiro; + +public class InfoExtratoViewModel : BaseFinanceiroViewModel +{ + private readonly BancosContasServico _saldoServico; + + private Saldo _selectedSaldo; + + public bool _telaBancos { get; set; } + + public Saldo SelectedSaldo + { + get + { + return _selectedSaldo; + } + set + { + if (value != null && !_telaBancos) + { + value.DataFinal = null; + value.ValorFinal = null; + } + _selectedSaldo = value; + OnPropertyChanged("SelectedSaldo"); + ((DomainBase)SelectedSaldo).Initialize(); + } + } + + public InfoExtratoViewModel(bool telaBancos) + { + _telaBancos = telaBancos; + _saldoServico = new BancosContasServico(); + } + + public async Task>> Salvar() + { + List> list = SelectedSaldo.Validate(); + if (list.Count > 0) + { + return list; + } + if (!_telaBancos) + { + SelectedSaldo.DataFinal = null; + SelectedSaldo.ValorFinal = null; + } + SelectedSaldo = await _saldoServico.Save(SelectedSaldo); + if (!_saldoServico.Sucesso) + { + return null; + } + Alterar(alterar: false); + ToggleSnackBar("SALDO SALVO COM SUCESSO"); + return null; + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Financeiro/MenuFinanceiroViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Financeiro/MenuFinanceiroViewModel.cs new file mode 100644 index 0000000..826f92f --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Financeiro/MenuFinanceiroViewModel.cs @@ -0,0 +1,24 @@ +using Gestor.Application.ViewModels.Generic; +using Gestor.Application.Views.Financeiro; + +namespace Gestor.Application.ViewModels.Financeiro; + +public class MenuFinanceiroViewModel : BaseViewModel +{ + private object _content; + + public FinanceiroView FinanceiroView; + + public object Content + { + get + { + return _content; + } + set + { + _content = value; + OnPropertyChanged("Content"); + } + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Financeiro/PlanoViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Financeiro/PlanoViewModel.cs new file mode 100644 index 0000000..4218195 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Financeiro/PlanoViewModel.cs @@ -0,0 +1,129 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using Gestor.Application.Servicos.Financeiro; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Common; +using Gestor.Model.Domain.Financeiro; +using Gestor.Model.Domain.Generic; + +namespace Gestor.Application.ViewModels.Financeiro; + +public class PlanoViewModel : BaseFinanceiroViewModel +{ + private readonly PlanoServico _planoServico; + + private Plano _selectedPlano; + + public Plano Cancel; + + public Plano SelectedPlano + { + get + { + return _selectedPlano; + } + set + { + _selectedPlano = value; + VerificarEnables((value != null) ? new long?(((DomainBase)value).Id) : null); + OnPropertyChanged("SelectedPlano"); + } + } + + public PlanoViewModel(Plano plano) + { + _planoServico = new PlanoServico(); + Seleciona(plano); + } + + private async void Seleciona(Plano plano) + { + Loading(isLoading: true); + await PermissaoTela((TipoTela)27); + if (plano == null) + { + SelectedPlano = new Plano + { + Descricao = "", + Ativo = true + }; + } + else + { + SelectedPlano = plano; + } + Loading(isLoading: false); + } + + public async Task>> Salvar() + { + List> errorMessages = SelectedPlano.Validate(); + List> list = errorMessages; + list.AddRange(await Validate()); + if (errorMessages.Count > 0) + { + return errorMessages; + } + SelectedPlano = await _planoServico.Save(SelectedPlano); + if (!_planoServico.Sucesso) + { + return null; + } + Alterar(alterar: false); + ToggleSnackBar("PLANO SALVO COM SUCESSO"); + return null; + } + + public void Cancelar() + { + //IL_0015: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Expected O, but got Unknown + Loading(isLoading: true); + if (((DomainBase)SelectedPlano).Id == 0L) + { + SelectedPlano = new Plano(); + Alterar(alterar: false); + Loading(isLoading: false); + } + else + { + Alterar(alterar: false); + Loading(isLoading: false); + } + } + + public async Task>> Validate() + { + List> errors = new List>(); + bool valida = true; + List list = await new BaseServico().BuscarPlanoAsync(); + if (list.Count > 0) + { + list.ForEach(delegate(Plano x) + { + if (((DomainBase)x).Id != ((DomainBase)SelectedPlano).Id && x.Descricao == SelectedPlano.Descricao) + { + valida = false; + } + }); + } + if (!valida) + { + errors.Add(new KeyValuePair("Descricao", "UM PLANO COM ESSE NOME JÁ EXISTE.")); + } + return errors; + } + + public void Incluir() + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Expected O, but got Unknown + SelectedPlano = new Plano + { + Ativo = true + }; + Alterar(alterar: true); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Financeiro/PlanosViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Financeiro/PlanosViewModel.cs new file mode 100644 index 0000000..1ea9c15 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Financeiro/PlanosViewModel.cs @@ -0,0 +1,252 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using Gestor.Application.Servicos.Financeiro; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Financeiro; +using Gestor.Model.Domain.Generic; + +namespace Gestor.Application.ViewModels.Financeiro; + +public class PlanosViewModel : BaseFinanceiroViewModel +{ + private readonly PlanosServico _planosServico; + + private ObservableCollection _plano = new ObservableCollection(); + + private ObservableCollection _planosFiltrados = new ObservableCollection(); + + private bool _isExpanded; + + private Planos _selectedPlanos; + + private Plano _selectedPlano; + + private bool _ativo; + + private long _ultimoId; + + public List Planos { get; set; } + + public ObservableCollection Plano + { + get + { + return _plano; + } + set + { + _plano = value; + OnPropertyChanged("Plano"); + } + } + + public ObservableCollection PlanosFiltrados + { + get + { + return _planosFiltrados; + } + set + { + _planosFiltrados = value; + IsExpanded = value != null && value.Count > 0; + OnPropertyChanged("PlanosFiltrados"); + } + } + + public bool IsExpanded + { + get + { + return _isExpanded; + } + set + { + _isExpanded = value; + OnPropertyChanged("IsExpanded"); + } + } + + public Planos SelectedPlanos + { + get + { + return _selectedPlanos; + } + set + { + _selectedPlanos = value; + Planos obj = value; + SelectedPlano = ((((obj != null) ? obj.Plano : null) != null) ? ((IEnumerable)Plano).FirstOrDefault((Func)((Plano x) => ((DomainBase)x).Id == ((DomainBase)value.Plano).Id)) : null); + Planos obj2 = value; + if (obj2 != null && ((DomainBase)obj2).Id > 0) + { + _ultimoId = ((DomainBase)value).Id; + } + Planos obj3 = value; + VerificarEnables((obj3 != null) ? new long?(((DomainBase)obj3).Id) : null); + OnPropertyChanged("SelectedPlanos"); + } + } + + public Plano SelectedPlano + { + get + { + return _selectedPlano; + } + set + { + _selectedPlano = value; + OnPropertyChanged("SelectedPlano"); + } + } + + public bool Ativo + { + get + { + return _ativo; + } + set + { + _ativo = value; + OnPropertyChanged("Ativo"); + } + } + + public PlanosViewModel() + { + _planosServico = new PlanosServico(); + base.EnableMenu = true; + Seleciona(); + } + + private async void Seleciona() + { + Loading(isLoading: true); + await PermissaoTela((TipoTela)28); + await SelecionaPlanos(); + await SelecionaPlanos(PlanosFiltrados.FirstOrDefault()); + Loading(isLoading: false); + } + + private async Task SelecionaPlanos() + { + Planos = (await new BaseServico().BuscarPlanosAsync()).OrderByDescending((Planos x) => x.Ativo).ThenBy(delegate(Planos x) + { + Plano plano = x.Plano; + return (plano == null) ? null : plano.Descricao; + }).ThenBy((Planos x) => x.Descricao) + .ToList(); + PlanosFiltrados = new ObservableCollection(Planos); + } + + public async Task SelecionaPlanos(Planos planos) + { + if (planos == null) + { + Alterar(alterar: false); + base.EnableMenu = false; + base.EnableAlterar = false; + return; + } + Loading(isLoading: true); + ObservableCollection source = await _planosServico.BuscarPlanos(); + DomainBase.Copy(PlanosFiltrados.First((Planos x) => ((DomainBase)x).Id == ((DomainBase)planos).Id), source.First((Planos x) => ((DomainBase)x).Id == ((DomainBase)planos).Id)); + if (Plano == null) + { + Plano = new ObservableCollection((from x in await new BaseServico().BuscarPlanoAsync() + orderby x.Ativo descending, x.Descricao + select x).ToList()); + } + SelectedPlanos = PlanosFiltrados.First((Planos x) => ((DomainBase)x).Id == ((DomainBase)planos).Id); + Loading(isLoading: false); + } + + public void Incluir() + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Expected O, but got Unknown + Planos selectedPlanos = new Planos + { + Plano = SelectedPlano + }; + SelectedPlanos = selectedPlanos; + Alterar(alterar: true); + } + + public async Task>> Validate() + { + List> errors = new List>(); + bool valida = true; + (await new BaseServico().BuscarPlanosAsync())?.ForEach(delegate(Planos x) + { + if (((DomainBase)x).Id != ((DomainBase)SelectedPlanos).Id && x.Descricao == SelectedPlanos.Descricao) + { + valida = false; + } + }); + if (!valida) + { + errors.Add(new KeyValuePair("Descricao", "UM SUBNÍVEL COM ESSE NOME JÁ EXISTE.")); + } + return errors; + } + + public async Task>> Salvar() + { + SelectedPlanos.Plano = SelectedPlano; + List> errorMessages = SelectedPlanos.Validate(); + List> list = errorMessages; + list.AddRange(await Validate()); + if (errorMessages.Count > 0) + { + return errorMessages; + } + SelectedPlanos.Plano = SelectedPlano; + SelectedPlanos = await _planosServico.Save(SelectedPlanos); + if (!_planosServico.Sucesso) + { + return null; + } + await SelecionaPlanos(); + await SelecionaPlanos(PlanosFiltrados.First((Planos x) => ((DomainBase)x).Id == ((DomainBase)SelectedPlanos).Id)); + Alterar(alterar: false); + ToggleSnackBar("SUBNÍVEL SALVO COM SUCESSO"); + return null; + } + + public async void CancelarAlteracao() + { + Loading(isLoading: true); + Alterar(alterar: false); + if (((DomainBase)SelectedPlanos).Id > 0) + { + await SelecionaPlanos(); + } + await SelecionaPlanos(((IEnumerable)PlanosFiltrados).FirstOrDefault((Func)((Planos x) => ((DomainBase)x).Id == _ultimoId))); + Loading(isLoading: false); + } + + public async Task> Filtrar(string value) + { + return await Task.Run(() => FiltrarPlanos(value)); + } + + public ObservableCollection FiltrarPlanos(string filter) + { + PlanosFiltrados = (string.IsNullOrWhiteSpace(filter) ? new ObservableCollection(Planos) : new ObservableCollection(from x in Planos + where ValidationHelper.RemoveDiacritics(x.Descricao.Trim()).ToUpper().Contains(ValidationHelper.RemoveDiacritics(filter)) + orderby Ativo descending, x.Descricao + select x)); + return PlanosFiltrados; + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Financeiro/TranferenciaViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Financeiro/TranferenciaViewModel.cs new file mode 100644 index 0000000..fd7e8fb --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Financeiro/TranferenciaViewModel.cs @@ -0,0 +1,66 @@ +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using Gestor.Application.Servicos.Financeiro; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Domain.Financeiro; +using Gestor.Model.Domain.Generic; + +namespace Gestor.Application.ViewModels.Financeiro; + +public class TranferenciaViewModel : BaseViewModel +{ + private Transferencia _transferencia; + + private ObservableCollection _contas; + + private BancosContasServico _servico { get; set; } + + public Transferencia Transferencia + { + get + { + return _transferencia; + } + set + { + _transferencia = value; + OnPropertyChanged("Transferencia"); + } + } + + public ObservableCollection Contas + { + get + { + return _contas; + } + set + { + _contas = value; + OnPropertyChanged("Contas"); + } + } + + public TranferenciaViewModel(Transferencia transferencia) + { + _servico = new BancosContasServico(); + Carregar(transferencia); + } + + private async void Carregar(Transferencia transferencia) + { + List source = await _servico.BuscarBancos(); + Contas = new ObservableCollection(from x in source + where x.Ativo + orderby x.Descricao + select x); + Transferencia = new Transferencia + { + Origem = ((transferencia.Origem != null) ? source.First((BancosContas x) => ((DomainBase)x).Id == ((DomainBase)transferencia.Origem).Id) : null), + Data = transferencia.Data, + Valor = transferencia.Valor, + Destino = ((transferencia.Destino != null) ? source.First((BancosContas x) => ((DomainBase)x).Id == ((DomainBase)transferencia.Destino).Id) : null) + }; + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Generic/BaseApoliceViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Generic/BaseApoliceViewModel.cs new file mode 100644 index 0000000..038aec6 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Generic/BaseApoliceViewModel.cs @@ -0,0 +1,4483 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; +using Gestor.Application.Actions; +using Gestor.Application.Drawers; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.Servicos.Ferramentas; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.Servicos.Seguros.Itens; +using Gestor.Application.ViewModels.Seguros; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.Helper; + +namespace Gestor.Application.ViewModels.Generic; + +public class BaseApoliceViewModel : BaseSegurosViewModel +{ + internal ApoliceServico Servico; + + internal PerfilServico PerfilServico; + + internal RamoServico RamoServico; + + internal SeguradoraServico SeguradoraServico; + + internal VendedorServico VendedorServico; + + internal ParcelaServico ParcelaServico; + + internal ProdutoServico ProdutoServico; + + internal EstipulanteServico EstipulanteServico; + + internal TarefaServico TarefaServico; + + private bool _invoke = true; + + public bool UpdatePremio; + + private bool _enableControle = true; + + private bool _apelido; + + private bool _controleAdm; + + private Documento _selectedDocumento; + + private Visibility _visibilityExcluirParcela = (Visibility)2; + + private Visibility _visibilityReplicarFatura = (Visibility)2; + + private Visibility _visibilityAlterarVencimento; + + private string _importado = "CLIQUE PARA VER INFORMAÇÕES SOBRE A INCLUSÃO"; + + private string _codigoDocumento; + + private DateTime? _emissaoDocumento; + + private DateTime? _transmissaoDocumento; + + private bool _editandoParcela; + + private bool _botoesParcelaEnabled = true; + + private List _vendedores; + + private List _todosVendedores; + + private ObservableCollection _pagamentos; + + private ObservableCollection _situacao = new ObservableCollection(new List + { + (TipoSeguro)1, + (TipoSeguro)2, + (TipoSeguro)5 + }); + + private ObservableCollection _tipoEndosso = new ObservableCollection(new List + { + (TipoEndosso)0, + (TipoEndosso)1, + (TipoEndosso)2, + (TipoEndosso)4, + (TipoEndosso)3 + }); + + private Parcela _selectedParcela; + + private bool _coCorretagem; + + private Visibility _baixarParcelaVisibility = (Visibility)2; + + private ObservableCollection _parcelas; + + private decimal _gerada; + + private decimal _comissOriginal; + + private Visibility _comissOriginalVisibility = (Visibility)2; + + private decimal _recebida; + + private decimal _pendente; + + private decimal _repasse; + + private Visibility _recusaVisibility; + + private string _excluirParcelaLabel = "EXCLUIR BAIXA"; + + private bool _isEnableSituacao; + + private List _produtos = Recursos.Produtos; + + private List _status = Recursos.Status; + + private List _ramos; + + private List _seguradorasAnteriores; + + private List _seguradoras; + + private Visibility _isRenovacaoVisibility = (Visibility)2; + + private bool _isEndosso; + + private bool _enableAlterarSituacao; + + private string _assinada = "PROPOSTA ASSINADA"; + + private string _conferida = "APÓLICE CONFERIDA"; + + private string _transmissao = "TRANSMISSÃO DE PROPOSTA"; + + private string _emissao = "EMISSÃO DA APÓLICE"; + + private List _tiposVendedor = Recursos.TipoVendedor?.Where((TipoVendedor x) => !x.Ativo.HasValue || x.Ativo.Value).ToList(); + + private List _estipulantes; + + public Documento CancelDocumento; + + private List _repasses; + + private List _repassesVendedores; + + private List _repassesVendedor; + + private VendedorParcela _selectedPagamento; + + private bool _baixarParcelas; + + private bool _isFatura; + + private bool _ultimaFatura; + + private bool _allowEditVendedor = true; + + private bool _alteracaoEnabled = true; + + private bool _allowEditEmissao = true; + + private bool _allowEditApolice = true; + + private bool _allowVigenciaFinal = true; + + private bool _novaApolice; + + private bool _renovar; + + public decimal Tolerancia; + + private bool _enableRepasse; + + private bool _bloquearObservacao = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 39); + + private string _editarParcelasLabel = "EDITAR PARCELAS"; + + private string _anotacoes; + + private int _quantidadeFaturas; + + private double _tamanhoGrid; + + private bool _inclusao; + + private bool _criandoParcelaEspecial; + + private bool _visibilityLogAntigo = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 22); + + internal Documento DocumentoSelecionado { get; set; } + + internal long ParcelaSelecionada { get; set; } + + public bool Invoke + { + get + { + return _invoke; + } + set + { + _invoke = value; + OnPropertyChanged("Invoke"); + } + } + + public bool EnableControle + { + get + { + return _enableControle; + } + set + { + _enableControle = value; + OnPropertyChanged("EnableControle"); + } + } + + public AcessoApolice Acesso { get; set; } + + public bool Apelido + { + get + { + return _apelido; + } + set + { + _apelido = value; + OnPropertyChanged("Apelido"); + } + } + + public bool ControleAdm + { + get + { + return _controleAdm; + } + set + { + _controleAdm = value; + OnPropertyChanged("ControleAdm"); + } + } + + public Documento SelectedDocumento + { + get + { + return _selectedDocumento; + } + set + { + if (value != null && ((DomainBase)value).Id == 0L) + { + VisibilityLogAntigo = false; + } + _selectedDocumento = value; + Anotacoes = string.Empty; + base.EnableButtons = value != null && ((DomainBase)value).Id > 0; + base.EnableIncluir = value == null || ((DomainBase)value).Id > 0; + bool flag = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 13); + base.EnableEndossar = value != null && ((DomainBase)value).Id > 0 && (flag || (!string.IsNullOrWhiteSpace(value.Apolice) && !string.IsNullOrWhiteSpace(value.Proposta) && value.Emissao.HasValue)); + base.EnableRenovar = value != null && ((DomainBase)value).Id > 0 && value.Vigencia2.HasValue && !string.IsNullOrWhiteSpace(value.Apolice); + if (value == null || ((DomainBase)value).Id == 0L) + { + ZeraComissao(); + } + CodigoDocumento = ((SelectedDocumento == null || ((DomainBase)SelectedDocumento).Id == 0L) ? "" : $"{((DomainBase)SelectedDocumento).Id}"); + if (value != null && value.Status == null && Status.First().Nome == "SEM STATUS") + { + value.Status = Status.First(); + } + EmissaoDocumento = ((value != null && value.Emissao.HasValue) ? value.Emissao : new DateTime?(Funcoes.GetNetworkTime().Date)); + TransmissaoDocumento = ((value != null && value.Remessa.HasValue) ? value.Remessa : new DateTime?(Funcoes.GetNetworkTime().Date)); + RecusaVisibility = (Visibility)((Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 19) && !string.IsNullOrWhiteSpace((value != null) ? value.Apolice : null) && value.Emissao.HasValue) ? 2 : 0); + VerificarEnables((value != null) ? new long?(((DomainBase)value).Id) : null); + OnPropertyChanged("SelectedDocumento"); + } + } + + public Visibility VisibilityExcluirParcela + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityExcluirParcela; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityExcluirParcela = value; + OnPropertyChanged("VisibilityExcluirParcela"); + } + } + + public Visibility VisibilityReplicarFatura + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityReplicarFatura; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityReplicarFatura = value; + OnPropertyChanged("VisibilityReplicarFatura"); + } + } + + public Visibility VisibilityAlterarVencimento + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityAlterarVencimento; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityAlterarVencimento = value; + OnPropertyChanged("VisibilityAlterarVencimento"); + } + } + + public string Importado + { + get + { + return _importado; + } + set + { + _importado = value; + OnPropertyChanged("Importado"); + } + } + + public string CodigoDocumento + { + get + { + return _codigoDocumento; + } + set + { + _codigoDocumento = value; + OnPropertyChanged("CodigoDocumento"); + } + } + + public DateTime? EmissaoDocumento + { + get + { + return _emissaoDocumento; + } + set + { + _emissaoDocumento = value; + OnPropertyChanged("EmissaoDocumento"); + } + } + + public DateTime? TransmissaoDocumento + { + get + { + return _transmissaoDocumento; + } + set + { + _transmissaoDocumento = value; + OnPropertyChanged("TransmissaoDocumento"); + } + } + + public bool EditandoParcela + { + get + { + return _editandoParcela; + } + set + { + _editandoParcela = value; + OnPropertyChanged("EditandoParcela"); + } + } + + public bool BotoesParcelaEnabled + { + get + { + return _botoesParcelaEnabled; + } + set + { + _botoesParcelaEnabled = value; + OnPropertyChanged("BotoesParcelaEnabled"); + } + } + + public List Vendedores + { + get + { + return _vendedores; + } + set + { + _vendedores = value; + OnPropertyChanged("Vendedores"); + } + } + + public List TodosVendedores + { + get + { + return _todosVendedores; + } + set + { + _todosVendedores = value; + OnPropertyChanged("TodosVendedores"); + } + } + + public ObservableCollection Pagamentos + { + get + { + return _pagamentos; + } + set + { + _pagamentos = value; + OnPropertyChanged("Pagamentos"); + } + } + + public ObservableCollection Situacao + { + get + { + return _situacao; + } + set + { + _situacao = value; + OnPropertyChanged("Situacao"); + } + } + + public ObservableCollection TipoEndossoList + { + get + { + return _tipoEndosso; + } + set + { + _tipoEndosso = value; + OnPropertyChanged("TipoEndossoList"); + } + } + + public Parcela SelectedParcela + { + get + { + return _selectedParcela; + } + set + { + _selectedParcela = value; + WorkOnSelectedParcela(value); + OnPropertyChanged("SelectedParcela"); + } + } + + public bool CoCorretagem + { + get + { + return _coCorretagem; + } + set + { + if (SelectedPagamento != null) + { + SelectedPagamento.CoCorretagem = value; + } + _coCorretagem = value; + OnPropertyChanged("CoCorretagem"); + } + } + + public Visibility BaixarParcelaVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _baixarParcelaVisibility; + } + set + { + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + if (!Restricao((TipoRestricao)15)) + { + _baixarParcelaVisibility = value; + OnPropertyChanged("BaixarParcelaVisibility"); + } + } + } + + public ObservableCollection Parcelas + { + get + { + return _parcelas; + } + set + { + _parcelas = value; + if (value != null && value.Count == 0) + { + VisibilityExcluirParcela = (Visibility)2; + VisibilityReplicarFatura = (Visibility)2; + BaixarParcelaVisibility = (Visibility)2; + VisibilityAlterarVencimento = (Visibility)2; + } + OnPropertyChanged("Parcelas"); + } + } + + public decimal Gerada + { + get + { + return _gerada; + } + set + { + _gerada = value; + OnPropertyChanged("Gerada"); + } + } + + public decimal ComissOriginal + { + get + { + return _comissOriginal; + } + set + { + ComissOriginalVisibility = (Visibility)((!VerificaCoCorretagem()) ? 2 : 0); + _comissOriginal = value; + OnPropertyChanged("ComissOriginal"); + } + } + + public Visibility ComissOriginalVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _comissOriginalVisibility; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _comissOriginalVisibility = value; + OnPropertyChanged("ComissOriginalVisibility"); + } + } + + public decimal Recebida + { + get + { + return _recebida; + } + set + { + _recebida = value; + OnPropertyChanged("Recebida"); + } + } + + public decimal Pendente + { + get + { + return _pendente; + } + set + { + _pendente = value; + OnPropertyChanged("Pendente"); + } + } + + public decimal Repasse + { + get + { + return _repasse; + } + set + { + _repasse = value; + OnPropertyChanged("Repasse"); + } + } + + public Visibility RecusaVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _recusaVisibility; + } + set + { + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + _recusaVisibility = (Visibility)(Restricao((TipoRestricao)18) ? 2 : ((int)value)); + OnPropertyChanged("RecusaVisibility"); + } + } + + public bool Loaded { get; set; } + + public string ExcluirParcelaLabel + { + get + { + return _excluirParcelaLabel; + } + set + { + _excluirParcelaLabel = value; + OnPropertyChanged("ExcluirParcelaLabel"); + } + } + + public bool IsEnableSituacao + { + get + { + return _isEnableSituacao; + } + set + { + _isEnableSituacao = value; + OnPropertyChanged("IsEnableSituacao"); + } + } + + public List Produtos + { + get + { + return _produtos; + } + set + { + _produtos = value; + OnPropertyChanged("Produtos"); + } + } + + public List Status + { + get + { + return _status; + } + set + { + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_0039: Unknown result type (might be due to invalid IL or missing references) + //IL_0041: Unknown result type (might be due to invalid IL or missing references) + //IL_004d: Expected O, but got Unknown + if (value.All((Status x) => x.Nome != "SEM STATUS")) + { + value.Insert(0, new Status + { + Nome = "SEM STATUS", + Id = 0L, + Ativo = true + }); + } + _status = value; + OnPropertyChanged("Status"); + } + } + + public List Ramos + { + get + { + return _ramos; + } + set + { + _ramos = value; + OnPropertyChanged("Ramos"); + } + } + + public List SeguradorasAnteriores + { + get + { + return _seguradorasAnteriores; + } + set + { + _seguradorasAnteriores = value; + OnPropertyChanged("SeguradorasAnteriores"); + } + } + + public List Seguradoras + { + get + { + return _seguradoras; + } + set + { + _seguradoras = value; + OnPropertyChanged("Seguradoras"); + } + } + + public Visibility IsRenovacaoVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _isRenovacaoVisibility; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _isRenovacaoVisibility = value; + OnPropertyChanged("IsRenovacaoVisibility"); + } + } + + public bool IsEndosso + { + get + { + return _isEndosso; + } + set + { + _isEndosso = value; + WorkOnSelectedTipo(value); + OnPropertyChanged("IsEndosso"); + } + } + + public bool EnableAlterarSituacao + { + get + { + return _enableAlterarSituacao; + } + set + { + _enableAlterarSituacao = value; + OnPropertyChanged("EnableAlterarSituacao"); + } + } + + public string Assinada + { + get + { + return _assinada; + } + set + { + _assinada = value; + OnPropertyChanged("Assinada"); + } + } + + public string Conferida + { + get + { + return _conferida; + } + set + { + _conferida = value; + OnPropertyChanged("Conferida"); + } + } + + public string Transmissao + { + get + { + return _transmissao; + } + set + { + _transmissao = value; + OnPropertyChanged("Transmissao"); + } + } + + public string Emissao + { + get + { + return _emissao; + } + set + { + _emissao = value; + OnPropertyChanged("Emissao"); + } + } + + public List TiposVendedor + { + get + { + return _tiposVendedor; + } + set + { + _tiposVendedor = value; + OnPropertyChanged("TiposVendedor"); + } + } + + public List Estipulantes + { + get + { + return _estipulantes; + } + set + { + _estipulantes = value; + OnPropertyChanged("Estipulantes"); + } + } + + public List Repasses + { + get + { + return _repasses; + } + set + { + _repasses = value; + OnPropertyChanged("Repasses"); + } + } + + public List RepassesVendedores + { + get + { + return _repassesVendedores; + } + set + { + _repassesVendedores = value; + OnPropertyChanged("RepassesVendedores"); + } + } + + public List RepassesVendedor + { + get + { + return _repassesVendedor; + } + set + { + _repassesVendedor = value; + EnableRepasse = value != null && value.Count > 0; + OnPropertyChanged("RepassesVendedor"); + } + } + + public VendedorParcela SelectedPagamento + { + get + { + return _selectedPagamento; + } + set + { + _selectedPagamento = value; + OnPropertyChanged("SelectedPagamento"); + } + } + + public bool BaixarParcelas + { + get + { + return _baixarParcelas; + } + set + { + _baixarParcelas = value; + OnPropertyChanged("BaixarParcelas"); + } + } + + public bool IsFatura + { + get + { + return _isFatura; + } + set + { + _isFatura = value; + OnPropertyChanged("IsFatura"); + } + } + + public bool UltimaFatura + { + get + { + return _ultimaFatura; + } + set + { + _ultimaFatura = value; + OnPropertyChanged("UltimaFatura"); + } + } + + public bool AllowEditVendedor + { + get + { + return _allowEditVendedor; + } + set + { + _allowEditVendedor = _incluirPermissEnabled && value; + OnPropertyChanged("AllowEditVendedor"); + } + } + + public bool AlteracaoEnabled + { + get + { + return _alteracaoEnabled; + } + set + { + _alteracaoEnabled = value; + OnPropertyChanged("AlteracaoEnabled"); + } + } + + public bool AllowEditEmissao + { + get + { + return _allowEditEmissao; + } + set + { + _allowEditEmissao = value; + OnPropertyChanged("AllowEditEmissao"); + } + } + + public bool AllowEditApolice + { + get + { + return _allowEditApolice; + } + set + { + _allowEditApolice = value; + AllowVigenciaFinal = value || IsFatura; + OnPropertyChanged("AllowEditApolice"); + } + } + + public bool AllowVigenciaFinal + { + get + { + return _allowVigenciaFinal; + } + set + { + _allowVigenciaFinal = value; + OnPropertyChanged("AllowVigenciaFinal"); + } + } + + private Documento DocumentoRenovado { get; set; } + + public bool NovaApolice + { + get + { + return _novaApolice; + } + set + { + _novaApolice = value; + OnPropertyChanged("NovaApolice"); + } + } + + public bool Renovar + { + get + { + return _renovar; + } + set + { + _renovar = value; + OnPropertyChanged("Renovar"); + } + } + + public bool EnableRepasse + { + get + { + return _enableRepasse; + } + set + { + _enableRepasse = value; + OnPropertyChanged("EnableRepasse"); + } + } + + public bool BloquearObservacao + { + get + { + return _bloquearObservacao; + } + set + { + _bloquearObservacao = value; + OnPropertyChanged("BloquearObservacao"); + } + } + + public string EditarParcelasLabel + { + get + { + return _editarParcelasLabel; + } + set + { + _editarParcelasLabel = value; + OnPropertyChanged("EditarParcelasLabel"); + } + } + + public new string Anotacoes + { + get + { + return _anotacoes; + } + set + { + _anotacoes = value; + OnPropertyChanged("Anotacoes"); + } + } + + public int QuantidadeFaturas + { + get + { + return _quantidadeFaturas; + } + set + { + if (value < 0) + { + value = 0; + } + if (value > 12) + { + value = 12; + } + _quantidadeFaturas = value; + OnPropertyChanged("QuantidadeFaturas"); + } + } + + public double TamanhoGrid + { + get + { + return _tamanhoGrid; + } + set + { + _tamanhoGrid = value; + OnPropertyChanged("TamanhoGrid"); + } + } + + public bool Inclusao + { + get + { + return _inclusao; + } + set + { + _inclusao = value; + OnPropertyChanged("Inclusao"); + } + } + + public bool CriandoParcelaEspecial + { + get + { + return _criandoParcelaEspecial; + } + set + { + _criandoParcelaEspecial = value; + } + } + + public Imposto Imposto { get; set; } + + public bool VisibilityLogAntigo + { + get + { + return _visibilityLogAntigo; + } + set + { + _visibilityLogAntigo = value; + OnPropertyChanged("VisibilityLogAntigo"); + } + } + + public BaseApoliceViewModel() + { + //IL_0010: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + //IL_0088: Unknown result type (might be due to invalid IL or missing references) + //IL_008f: Unknown result type (might be due to invalid IL or missing references) + //IL_00b7: Unknown result type (might be due to invalid IL or missing references) + Servico = new ApoliceServico(); + VendedorServico = new VendedorServico(); + ParcelaServico = new ParcelaServico(); + RamoServico = new RamoServico(); + SeguradoraServico = new SeguradoraServico(); + ProdutoServico = new ProdutoServico(); + EstipulanteServico = new EstipulanteServico(); + TarefaServico = new TarefaServico(); + PerfilServico = new PerfilServico(); + Apelido = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 6); + ControleAdm = Recursos.Configuracoes.All((ConfiguracaoSistema x) => (int)x.Configuracao != 33) || Recursos.Usuario.Administrador; + } + + public async Task Importacao() + { + List importados = await new CriticaApoliceServico().BuscarImportacao(((DomainBase)SelectedDocumento).Id); + List list = (await new LogServico().FindByEntityId((TipoTela)2, ((DomainBase)SelectedDocumento).Id)).ToList(); + RegistroLog val = ((list.Count > 0) ? list.Last() : null); + switch (importados.Count) + { + case 0: + { + BaseApoliceViewModel baseApoliceViewModel = this; + string importado; + if (SelectedDocumento.DataCriacao.HasValue) + { + Usuario usuarioCriacao = SelectedDocumento.UsuarioCriacao; + importado = $"CADASTRO MANUAL: {((usuarioCriacao != null) ? usuarioCriacao.Nome : null)} - {SelectedDocumento.DataCriacao:dd/MM/yyyy 'ÀS' HH:mm:ss}"; + } + else + { + importado = $"CADASTRO MANUAL: {((val != null) ? val.Usuario.Nome : null)} - {((val != null) ? new DateTime?(val.DataHora) : null):dd/MM/yyyy 'ÀS' HH:mm:ss}"; + } + baseApoliceViewModel.Importado = importado; + break; + } + case 1: + if (string.IsNullOrWhiteSpace(importados[0].Tipo) || importados[0].Tipo == "0") + { + Importado = ((!importados[0].Aggilizador.HasValue || !importados[0].Aggilizador.Value) ? $"IMPORTAÇÃO DA PROPOSTA: {importados[0].UsuarioImportacao.Nome} - {importados[0].DataImportacao:dd/MM/yyyy 'ÀS' HH:mm:ss}" : $"IMPORTAÇÃO DA PROPOSTA VIA AGGILIZADOR: {importados[0].UsuarioImportacao.Nome} - {importados[0].DataImportacao:dd/MM/yyyy 'ÀS' HH:mm:ss}"); + } + if (importados[0].Tipo == "1") + { + if (!SelectedDocumento.DataCriacao.HasValue) + { + Importado = $"CADASTRO MANUAL DA PROPOSTA: {((val != null) ? val.Usuario.Nome : null)} - {((val != null) ? new DateTime?(val.DataHora) : null):dd/MM/yyyy 'ÀS' HH:mm:ss}\n"; + } + else if (importados[0].DataImportacao.HasValue && DateTime.Compare(SelectedDocumento.DataCriacao.Value, importados[0].DataImportacao.Value) < 0) + { + Importado = $"CADASTRO MANUAL DA PROPOSTA: {SelectedDocumento.UsuarioCriacao} - {SelectedDocumento.DataCriacao:dd/MM/yyyy 'ÀS' HH:mm:ss}\n"; + } + if (SelectedDocumento.DataCriacao <= importados[0].DataImportacao) + { + Importado = ((!importados[0].Aggilizador.HasValue || !importados[0].Aggilizador.Value) ? $"IMPORTAÇÃO DA APÓLICE: {importados[0].UsuarioImportacao.Nome} - {importados[0].DataImportacao:dd/MM/yyyy 'ÀS' HH:mm:ss}" : $"IMPORTAÇÃO DA APÓLICE VIA AGGILIZADOR: {importados[0].UsuarioImportacao.Nome} - {importados[0].DataImportacao:dd/MM/yyyy 'ÀS' HH:mm:ss}"); + } + } + if (importados[0].Tipo == "2") + { + if (!SelectedDocumento.DataCriacao.HasValue) + { + Importado = $"CADASTRO MANUAL DA PROPOSTA: {((val != null) ? val.Usuario.Nome : null)} - {((val != null) ? new DateTime?(val.DataHora) : null):dd/MM/yyyy 'ÀS' HH:mm:ss}\n"; + } + else if (importados[0].DataImportacao.HasValue && DateTime.Compare(SelectedDocumento.DataCriacao.Value, importados[0].DataImportacao.Value) < 0) + { + Importado = $"CADASTRO MANUAL DA PROPOSTA: {SelectedDocumento.UsuarioCriacao} - {SelectedDocumento.DataCriacao:dd/MM/yyyy 'ÀS' HH:mm:ss}\n"; + } + if (SelectedDocumento.DataCriacao <= importados[0].DataImportacao) + { + Importado = ((!importados[0].Aggilizador.HasValue || !importados[0].Aggilizador.Value) ? $"IMPORTAÇÃO DO ENDOSSO: {importados[0].UsuarioImportacao.Nome} - {importados[0].DataImportacao:dd/MM/yyyy 'ÀS' HH:mm:ss}" : $"IMPORTAÇÃO DO ENDOSSO VIA AGGILIZADOR: {importados[0].UsuarioImportacao.Nome} - {importados[0].DataImportacao:dd/MM/yyyy 'ÀS' HH:mm:ss}"); + } + } + break; + case 2: + case 3: + { + CriticaApolice val2 = importados.Find((CriticaApolice x) => string.IsNullOrWhiteSpace(x.Tipo) || x.Tipo == "0"); + CriticaApolice val3 = importados.Find((CriticaApolice x) => x.Tipo == "1"); + Importado = ((!val2.Aggilizador.HasValue || !val2.Aggilizador.Value) ? $"IMPORTAÇÃO DA PROPOSTA: {val2.UsuarioImportacao.Nome} - {val2.DataImportacao:dd/MM/yyyy 'ÀS' HH:mm:ss}\n" : $"IMPORTAÇÃO DA PROPOSTA VIA AGGILIZADOR: {val2.UsuarioImportacao.Nome} - {val2.DataImportacao:dd/MM/yyyy 'ÀS' HH:mm:ss}\n"); + if (val3 != null) + { + Importado += ((!val3.Aggilizador.HasValue || !val3.Aggilizador.Value) ? $"IMPORTAÇÃO DA APÓLICE: {val3.UsuarioImportacao.Nome} - {val3.DataImportacao:dd/MM/yyyy 'ÀS' HH:mm:ss}" : $"IMPORTAÇÃO DA APÓLICE VIA AGGILIZADOR: {val3.UsuarioImportacao.Nome} - {val3.DataImportacao:dd/MM/yyyy 'ÀS' HH:mm:ss}"); + } + break; + } + } + } + + private void WorkOnSelectedParcela(Parcela value) + { + //IL_003a: Unknown result type (might be due to invalid IL or missing references) + //IL_0040: Invalid comparison between Unknown and I4 + //IL_00a0: Unknown result type (might be due to invalid IL or missing references) + //IL_00a6: Invalid comparison between Unknown and I4 + //IL_00b9: Unknown result type (might be due to invalid IL or missing references) + //IL_00bf: Invalid comparison between Unknown and I4 + //IL_01fe: Unknown result type (might be due to invalid IL or missing references) + //IL_0204: Invalid comparison between Unknown and I4 + if (value == null || ((DomainBase)value).Id == 0L || SelectedDocumento == null) + { + return; + } + bool flag = Repasses.Any((VendedorParcela x) => ((DomainBase)x.Parcela).Id == ((DomainBase)SelectedParcela).Id && x.DataPagamento.HasValue); + if ((int)SelectedDocumento.TipoRecebimento.GetValueOrDefault() == 2) + { + AllowEditEmissao = (Repasses?.Where((VendedorParcela x) => ((DomainBase)x.Parcela).Id == ((DomainBase)SelectedParcela).Id && x.Repasse != null && (int)x.Repasse.Base.GetValueOrDefault() == 4).All((VendedorParcela x) => !x.DataPagamento.HasValue)).Value; + } + if ((int)value.SubTipo == 1 && (int)SelectedDocumento.TipoRecebimento.GetValueOrDefault() == 1) + { + BaixarParcelaVisibility = (Visibility)((!Parcelas.Any((Parcela x) => !x.DataRecebimento.HasValue && (int)x.SubTipo == 1)) ? 2 : 0); + Parcela val = ((IEnumerable)Parcelas.OrderBy((Parcela x) => x.NumeroParcela)).LastOrDefault((Func)((Parcela x) => x.DataRecebimento.HasValue && (int)x.SubTipo == 1 && (x.ValorComissao != 0m || x.ValorRealizado != 0m))); + VisibilityExcluirParcela = (Visibility)(flag ? 2 : (((!value.DataRecebimento.HasValue || val != null) && !(((val != null) ? new int?(val.NumeroParcela) : null) <= value.NumeroParcela)) ? 2 : 0)); + ExcluirParcelaLabel = "EXCLUIR BAIXA"; + } + else + { + BaixarParcelaVisibility = (Visibility)(value.DataRecebimento.HasValue ? 2 : 0); + VisibilityExcluirParcela = (Visibility)(flag ? 2 : 0); + ExcluirParcelaLabel = (value.DataRecebimento.HasValue ? "EXCLUIR BAIXA" : (((int)SelectedDocumento.TipoRecebimento.GetValueOrDefault() == 1) ? "EXCLUIR PARCELA" : "EXCLUIR FATURA")); + } + VisibilityReplicarFatura = (Visibility)((!IsFatura) ? 2 : 0); + } + + private void ZeraComissao() + { + Gerada = 0m; + Recebida = 0m; + Pendente = 0m; + Repasse = 0m; + ComissOriginal = 0m; + } + + public async void Seleciona(Documento documento) + { + Loading(isLoading: true); + await PermissaoTela((TipoTela)2); + await PermissaoTela((TipoTela)5); + if (documento == null || documento != SelectedDocumento) + { + await SelecionaDocumento(documento); + } + Gestor.Application.Actions.Actions.Redimencionar?.Invoke(Invoke); + Loading(isLoading: false); + } + + public async Task BuscarVendedores(bool verificarRamo = true) + { + if (RepassesVendedores == null) + { + RepassesVendedores = await VendedorServico.BuscaRepasses(); + TodosVendedores = (from x in RepassesVendedores + group x by ((DomainBase)x.Vendedor).Id into x + select x.First().Vendedor into x + orderby x.Nome + select x).ToList(); + } + Documento selectedDocumento = SelectedDocumento; + List list = ((selectedDocumento != null) ? selectedDocumento.Vendedores : null); + if (list == null) + { + Documento selectedDocumento2 = SelectedDocumento; + List list2 = ((selectedDocumento2 == null || ((DomainBase)selectedDocumento2).Id <= 0) ? new List() : (await ParcelaServico.BuscarVendedores(((DomainBase)SelectedDocumento).Id))); + list = list2; + } + List vendedores = list; + Vendedores = TodosVendedores.Where((Vendedor x) => (x.IdEmpresa == Recursos.Usuario.IdEmpresa || vendedores.Select((Vendedor y) => ((DomainBase)y).Id).Contains(((DomainBase)x).Id)) && x.Ativo && !x.Corretora).ToList(); + List list3 = await VerificaVinculoVendedor(Recursos.Usuario); + if (list3.Count > 0) + { + list3.ForEach(delegate(VendedorUsuario x) + { + vendedores.Add(x.Vendedor); + }); + Vendedores = vendedores; + } + if (!verificarRamo) + { + return; + } + Documento selectedDocumento3 = SelectedDocumento; + object obj; + if (selectedDocumento3 == null) + { + obj = null; + } + else + { + Controle controle = selectedDocumento3.Controle; + obj = ((controle != null) ? controle.Ramo : null); + } + if (obj == null) + { + return; + } + for (int num = Vendedores.Count - 1; num >= 0; num--) + { + List repasses = GetRepasses(Vendedores[num]); + if (!repasses.Any((Repasse x) => x.Ramo == null) && repasses.All((Repasse x) => ((DomainBase)x.Ramo).Id != ((DomainBase)SelectedDocumento.Controle.Ramo).Id)) + { + Vendedores.Remove(Vendedores[num]); + } + } + } + + public async Task LimparRepasses() + { + if (Pagamentos == null) + { + return; + } + ObservableCollection pagamentos = Pagamentos; + if ((pagamentos == null || pagamentos.Count != 0) && Repasses != null) + { + List repasses = Repasses; + if ((repasses == null || repasses.Count != 0) && ((DomainBase)SelectedDocumento).Id == 0L && base.EnableFields && AllowEditApolice && AlteracaoEnabled) + { + await ShowMessage("REPASSES ADICIONADOS NÃO PERTENCEM AO RAMO SELECIONADO E SERÃO EXCLUÍDOS."); + Pagamentos.Clear(); + Repasses.Clear(); + } + } + } + + public async Task SelecionaDocumento(Documento documento) + { + Loading(isLoading: true); + base.IsEnabled = false; + await BuscarVendedores(verificarRamo: false); + Estipulantes = (from x in await new BaseServico().BuscarEstipulantes() + where (documento != null) ? (x.IdEmpresa == documento.Controle.IdEmpresa && x.Ativo) : (x.IdEmpresa == Recursos.Usuario.IdEmpresa) + orderby x.Nome + select x).ToList(); + SelectedDocumento = null; + PreLoad(); + if (documento == null) + { + base.EnableFields = false; + Loading(isLoading: false); + return; + } + await WorkOnSelectedDocumento(documento); + if (Invoke) + { + long id = ((DomainBase)SelectedDocumento).Id; + Documento documentoSelecionado = ConsultaViewModel.DocumentoSelecionado; + if (id != ((documentoSelecionado != null) ? new long?(((DomainBase)documentoSelecionado).Id) : null)) + { + ConsultaViewModel.DocumentoSelecionado = SelectedDocumento; + } + } + if ((int)Acesso == 1 && ParcelaSelecionada != 0L) + { + await SelecionaParcela(((IEnumerable)Parcelas).FirstOrDefault((Func)((Parcela x) => ((DomainBase)x).Id == ParcelaSelecionada))); + } + if (Invoke) + { + Loaded = true; + } + base.IsEnabled = true; + Loading(isLoading: false); + } + + private void PreLoad() + { + Ramos = Recursos.Ramos; + Seguradoras = Recursos.Seguradoras; + Produtos = Recursos.Produtos; + Status = Recursos.Status; + SeguradorasAnteriores = Recursos.Seguradoras; + TipoEndossoList = new ObservableCollection(new List + { + (TipoEndosso)0, + (TipoEndosso)1, + (TipoEndosso)2, + (TipoEndosso)4, + (TipoEndosso)3 + }); + } + + private async Task WorkOnSelectedDocumento(Documento value) + { + base.IsEnabledEdit = value == null || ((DomainBase)value).Id == 0; + base.IsEnabledEditEndosso = value == null || ((DomainBase)value).Id == 0; + if (value != null && ((DomainBase)value).Id != 0L) + { + if (Situacao.All((TipoSeguro x) => x != value.Situacao)) + { + List list = new List + { + (TipoSeguro)1, + (TipoSeguro)2, + (TipoSeguro)5, + value.Situacao + }; + Situacao = new ObservableCollection(list); + } + else + { + IsEnableSituacao = true; + } + Controle controle = value.Controle; + List seguradoras = ((((controle != null) ? controle.Seguradora : null) != null) ? Recursos.Seguradoras.Where((Seguradora x) => x.Ativo || ((DomainBase)x).Id == ((DomainBase)value.Controle.Seguradora).Id).ToList() : Recursos.Seguradoras.Where((Seguradora x) => x.Ativo).ToList()); + Seguradoras = seguradoras; + SeguradorasAnteriores = Recursos.Seguradoras; + SelectedDocumento = await Servico.BuscarApoliceAsync(((DomainBase)value).Id); + if (!SelectedDocumento.NegocioCorretora.HasValue) + { + SelectedDocumento.NegocioCorretora = (NegocioCorretora)(((int)SelectedDocumento.Situacao == 2 && SelectedDocumento.Negocio.HasValue && (int)SelectedDocumento.Negocio.GetValueOrDefault() == 1) ? 1 : 0); + OnPropertyChanged("SelectedDocumento"); + } + BaseApoliceViewModel baseApoliceViewModel = this; + Controle controle2 = SelectedDocumento.Controle; + decimal? obj; + if (controle2 == null) + { + obj = null; + } + else + { + Seguradora seguradora = controle2.Seguradora; + obj = ((seguradora != null) ? seguradora.Tolerancia : null); + } + decimal? num = obj; + baseApoliceViewModel.Tolerancia = num.GetValueOrDefault(2m); + List produtos = Recursos.Produtos.Where((Produto x) => x.Ativo || (SelectedDocumento.Controle.Produto != null && ((DomainBase)x).Id == ((DomainBase)SelectedDocumento.Controle.Produto).Id)).ToList(); + Produtos = produtos; + if (Invoke) + { + ConsultaViewModel.DocumentoSelecionado = SelectedDocumento; + } + Documento documento = (Documento)((DomainBase)SelectedDocumento).Clone(); + await CarregarParcelas(documento); + await CarregaRepasse(((DomainBase)documento).Id); + ((DomainBase)SelectedDocumento).Initialize(); + Initialized = true; + if (Parcelas.Count == 0) + { + AllowEditVendedor = false; + } + AllowEditApolice = Parcelas.Where((Parcela x) => (int)x.SubTipo == 1).All((Parcela x) => !x.DataRecebimento.HasValue) && Repasses.Where((VendedorParcela x) => (int)x.Parcela.SubTipo == 1).All((VendedorParcela x) => !x.DataPagamento.HasValue); + AllowEditEmissao = (int)SelectedDocumento.TipoRecebimento.GetValueOrDefault() == 2 || Repasses.Where((VendedorParcela x) => x.Repasse != null && (int)x.Repasse.Base.GetValueOrDefault() == 4).All((VendedorParcela x) => !x.DataPagamento.HasValue); + CalculaComissao(SelectedDocumento, Parcelas); + IsEndosso = SelectedDocumento.Tipo != 0; + EnableAlterarSituacao = !SelectedDocumento.TipoEndosso.HasValue || ((int)SelectedDocumento.TipoEndosso.GetValueOrDefault() != 2 && (int)SelectedDocumento.TipoEndosso.GetValueOrDefault() != 3); + EditarParcelasLabel = (((int)SelectedDocumento.TipoRecebimento.GetValueOrDefault() == 2) ? "EDITAR FATURAS" : "EDITAR PARCELAS"); + base.AllowEditParcela = true; + CancelDocumento = (Documento)((DomainBase)SelectedDocumento).Clone(); + } + } + + public bool VerificaCoCorretagem() + { + return Repasses?.Any((VendedorParcela x) => x.CoCorretagem) ?? false; + } + + public async Task CarregarParcelas(Documento documento) + { + if (documento != null) + { + ObservableCollection observableCollection = await ParcelaServico.BuscarParcelasPorDocumento(documento); + Parcelas = (IsFatura ? new ObservableCollection(observableCollection.OrderByDescending((Parcela x) => x.NumeroParcela)) : observableCollection); + if (Invoke) + { + Gestor.Application.Actions.Actions.RecarregarParcelas?.Invoke(SelectedDocumento); + } + } + } + + private void CalculaComissao(Documento documento, ObservableCollection parcelas) + { + decimal num = (documento.AdicionalComiss ? (documento.PremioLiquido + documento.PremioAdicional) : documento.PremioLiquido); + decimal num2 = documento.Comissao * 0.01m; + Gerada = num * num2; + Recebida = (Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 32) ? parcelas.Where((Parcela x) => (int)x.SubTipo == 1 || (int)x.SubTipo == 6).Sum((Parcela x) => x.ValorComissao) : parcelas.Where((Parcela x) => (int)x.SubTipo == 1).Sum((Parcela x) => x.ValorComissao)); + Pendente = Gerada - Recebida; + Pendente = ((Pendente < 0.01m) ? 0.00m : Pendente); + Repasse = Repasses.Where((VendedorParcela x) => x.DataPrePagamento.HasValue && !x.CoCorretagem).Sum((VendedorParcela x) => x.ValorRepasse.GetValueOrDefault()); + if (Pendente < Tolerancia) + { + Pendente = 0m; + } + if (VerificaCoCorretagem()) + { + Documento selectedDocumento = SelectedDocumento; + ComissOriginal = ((selectedDocumento != null) ? selectedDocumento.ComissaoTotal : null).GetValueOrDefault(); + } + } + + public void ToggleSeguradoraAnterior(TipoSeguro situacao) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Invalid comparison between Unknown and I4 + if ((int)situacao != 2) + { + IsRenovacaoVisibility = (Visibility)2; + } + else + { + IsRenovacaoVisibility = (Visibility)0; + } + } + + private void WorkOnSelectedTipo(bool value) + { + Assinada = (value ? "PROPOSTA DE ENDOSSO ASSINADA" : "PROPOSTA ASSINADA"); + Conferida = (value ? "ENDOSSO CONFERIDO" : "APÓLICE CONFERIDA"); + Transmissao = (value ? "TRANSMISSÃO DA PROPOSTA DE ENDOSSO" : "TRANSMISSÃO DA PROPOSTA"); + Emissao = (value ? "EMISSÃO DO ENDOSSO" : "EMISSÃO DA APÓLICE"); + } + + public async Task SelecionarParcelaBaixa() + { + if (SelectedParcela == null || SelectedDocumento == null) + { + return false; + } + if ((int)SelectedParcela.SubTipo != 1 && !SelectedParcela.DataRecebimento.HasValue) + { + SelectedParcela.ValorLiquidoFatura = SelectedDocumento.PremioLiquido / ((SelectedDocumento.NumeroParcelas > 0m) ? SelectedDocumento.NumeroParcelas : 1m); + SelectedParcela.Baixando = true; + return true; + } + if (IsFatura && !SelectedParcela.DataRecebimento.HasValue) + { + SelectedParcela.Baixando = true; + return true; + } + if (Parcelas == null || !Parcelas.Any()) + { + return false; + } + Parcela parcela = ((IEnumerable)Parcelas.OrderBy((Parcela x) => x.NumeroParcela)).FirstOrDefault((Func)((Parcela x) => !x.DataRecebimento.HasValue && (int)x.SubTipo == 1)); + if (parcela != null && !IsFatura && SelectedDocumento.NumeroParcelas > 0m) + { + parcela.ValorLiquidoFatura = (SelectedDocumento.AdicionalComiss ? ((SelectedDocumento.PremioLiquido + SelectedDocumento.PremioAdicional) / SelectedDocumento.NumeroParcelas) : (SelectedDocumento.PremioLiquido / SelectedDocumento.NumeroParcelas)); + } + SelectedParcela = parcela ?? SelectedParcela; + if (parcela == null) + { + await ShowMessage("NÃO HÁ MAIS NENHUMA PARCELA A SER BAIXADA"); + } + if (parcela != null) + { + SelectedParcela.Baixando = true; + } + return parcela != null; + } + + public async Task SelecionaParcela(Parcela parcela) + { + SelectedParcela = parcela; + if (parcela == null || ((DomainBase)parcela).Id == 0L || SelectedDocumento == null) + { + return; + } + if (Repasses == null) + { + await CarregaRepasse(((DomainBase)SelectedDocumento).Id); + } + List source = Repasses.Where((VendedorParcela x) => ((DomainBase)x.Parcela).Id == ((DomainBase)parcela).Id).ToList(); + if (IsFatura || (int)parcela.SubTipo != 1) + { + AllowEditVendedor = !parcela.DataRecebimento.HasValue && source.All((VendedorParcela x) => ((DomainBase)x.Parcela).Id == ((DomainBase)parcela).Id && !x.DataPagamento.HasValue); + } + if (!IsFatura && (int)parcela.SubTipo == 1) + { + AllowEditVendedor = parcela.NumeroParcela == 1 && !parcela.DataRecebimento.HasValue && source.All((VendedorParcela x) => (int)x.Parcela.SubTipo == 1 && !x.DataPagamento.HasValue); + } + Pagamentos = new ObservableCollection(source.OrderBy((VendedorParcela x) => ((DomainBase)x.TipoVendedor).Id)); + } + + public async Task CarregaRepasse(long id) + { + Repasses = await VendedorServico.BuscaRepasse(id); + await SelecionaParcela(SelectedParcela ?? Parcelas.FirstOrDefault()); + } + + public async void CancelPagamento() + { + BaixarParcelas = false; + SelectedParcela.Baixando = false; + ObservableCollection observableCollection = await ParcelaServico.BuscarParcelasAsync(((DomainBase)SelectedDocumento).Id); + Parcelas = (IsFatura ? new ObservableCollection(observableCollection.OrderByDescending((Parcela x) => x.NumeroParcela)) : observableCollection); + await CarregaRepasse(((DomainBase)SelectedDocumento).Id); + await SelecionaParcela(Parcelas.FirstOrDefault()); + } + + public void IncluirParcelaEspecial() + { + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + //IL_0013: Unknown result type (might be due to invalid IL or missing references) + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Unknown result type (might be due to invalid IL or missing references) + //IL_0048: Unknown result type (might be due to invalid IL or missing references) + //IL_0055: Unknown result type (might be due to invalid IL or missing references) + //IL_005c: Unknown result type (might be due to invalid IL or missing references) + //IL_0067: Unknown result type (might be due to invalid IL or missing references) + //IL_0077: Unknown result type (might be due to invalid IL or missing references) + //IL_008c: Expected O, but got Unknown + SelectedParcela = new Parcela + { + IdEmpresa = SelectedDocumento.Controle.IdEmpresa, + Documento = SelectedDocumento, + Vencimento = Funcoes.GetNetworkTime().Date, + Comissao = 100m, + SubTipo = (SubTipo)3, + NumeroParcela = 999, + DataCriacao = Funcoes.GetNetworkTime(), + UsuarioCriacao = ((DomainBase)Recursos.Usuario).Id + }; + Parcela parcelaAtual = Parcelas?.FirstOrDefault((Func)((Parcela x) => (int)x.SubTipo == 1)); + if (parcelaAtual == null) + { + Repasses = new List(); + return; + } + List list = Repasses.Where((VendedorParcela x) => ((DomainBase)x.Parcela).Id == ((DomainBase)parcelaAtual).Id).ToList(); + list.ForEach(delegate(VendedorParcela x) + { + ((DomainBase)x).Id = 0L; + x.Parcela = SelectedParcela; + x.DataPrePagamento = null; + x.DataPagamento = null; + x.ValorRepasse = default(decimal); + x.DataPagamento = null; + }); + Repasses = list; + RecalculaRepasse(); + } + + public void IncluirFatura() + { + //IL_011e: Unknown result type (might be due to invalid IL or missing references) + //IL_0123: Unknown result type (might be due to invalid IL or missing references) + //IL_0139: Unknown result type (might be due to invalid IL or missing references) + //IL_0145: Unknown result type (might be due to invalid IL or missing references) + //IL_0159: Unknown result type (might be due to invalid IL or missing references) + //IL_0160: Unknown result type (might be due to invalid IL or missing references) + //IL_0167: Unknown result type (might be due to invalid IL or missing references) + //IL_016e: Unknown result type (might be due to invalid IL or missing references) + //IL_017a: Unknown result type (might be due to invalid IL or missing references) + //IL_018f: Expected O, but got Unknown + Parcela? obj = ((IEnumerable)Parcelas.OrderBy((Parcela x) => x.NumeroParcela)).LastOrDefault((Func)((Parcela x) => (int)x.SubTipo == 1)); + int numeroParcela = ((obj != null) ? obj.NumeroParcela : 0) + 1; + decimal comissao = ((obj != null) ? obj.Comissao : 0m); + Parcela selectedParcela = SelectedParcela; + long num2; + if (selectedParcela == null) + { + ObservableCollection parcelas = Parcelas; + long? obj2; + if (parcelas == null) + { + obj2 = null; + } + else + { + Parcela? obj3 = ((IEnumerable)parcelas.OrderBy((Parcela x) => x.NumeroParcela)).LastOrDefault((Func)((Parcela x) => (int)x.SubTipo == 1)); + obj2 = ((obj3 != null) ? new long?(((DomainBase)obj3).Id) : null); + } + long? num = obj2; + num2 = num.GetValueOrDefault(); + } + else + { + num2 = ((DomainBase)selectedParcela).Id; + } + long parcelaAtual = num2; + DateTime networkTime = Funcoes.GetNetworkTime(); + SelectedParcela = new Parcela + { + IdEmpresa = SelectedDocumento.Controle.IdEmpresa, + Documento = SelectedDocumento, + Vencimento = Funcoes.GetNetworkTime().Date, + Comissao = comissao, + SubTipo = (SubTipo)1, + NumeroParcela = numeroParcela, + DataCriacao = networkTime, + UsuarioCriacao = ((DomainBase)Recursos.Usuario).Id + }; + if (parcelaAtual != 0L) + { + List list = Repasses.Where((VendedorParcela x) => ((DomainBase)x.Parcela).Id == parcelaAtual).ToList(); + list.ForEach(delegate(VendedorParcela x) + { + //IL_0059: Unknown result type (might be due to invalid IL or missing references) + //IL_005c: Unknown result type (might be due to invalid IL or missing references) + //IL_0061: Unknown result type (might be due to invalid IL or missing references) + ((DomainBase)x).Id = 0L; + x.Parcela = SelectedParcela; + x.DataPrePagamento = null; + x.DataPagamento = null; + x.PorcentagemRepasse = ((x.Repasse == null) ? 0m : ((SelectedDocumento.NegocioCorretora == (NegocioCorretora?)0) ? x.Repasse.ValorNovo : x.Repasse.ValorRenovacao)); + }); + Repasses = list; + RecalculaRepasse(); + } + } + + public async Task ReplicarFatura() + { + if (Parcelas != null) + { + Parcela val = ((IEnumerable)Parcelas.OrderBy((Parcela x) => x.NumeroParcela)).LastOrDefault((Func)((Parcela x) => (int)x.SubTipo == 1)); + if (val != null && val.NumeroParcela == 999) + { + await ShowMessage("PARCELA ESPECIAL NÃO PODE SER REPLICADA."); + return; + } + int numeroParcela = ((val != null) ? val.NumeroParcela : 0) + 1; + Parcela selectedParcela = SelectedParcela; + decimal comissao = ((selectedParcela != null) ? selectedParcela.Comissao : 0m); + Parcela parcelaAtual = Parcelas.First((Parcela x) => (int)x.SubTipo == 1); + DateTime networkTime = Funcoes.GetNetworkTime(); + Parcela obj = parcelaAtual; + DateTime value = ((obj != null) ? obj.VigenciaFinal : null) ?? networkTime.Date; + Parcela obj2 = parcelaAtual; + DateTime value2 = ((obj2 == null) ? null : obj2.Emissao?.AddMonths(1)) ?? networkTime.Date; + Parcela obj3 = parcelaAtual; + DateTime vencimento = ((obj3 != null) ? obj3.Vencimento.AddMonths(1) : networkTime.Date); + DateTime value3 = value.AddMonths(1); + Parcela obj4 = parcelaAtual; + decimal valor = ((obj4 != null) ? obj4.Valor : 0m); + Parcela obj5 = parcelaAtual; + decimal valorLiquidoFatura = ((obj5 != null) ? obj5.ValorLiquidoFatura : 0m); + List list = Funcoes.DistinctBy(Repasses.Where((VendedorParcela x) => parcelaAtual != null && ((DomainBase)x.Parcela).Id == ((DomainBase)parcelaAtual).Id), (VendedorParcela x) => new + { + Id = ((DomainBase)x.Parcela).Id, + vendedor = ((DomainBase)x.Vendedor).Id, + tipovendedor = ((DomainBase)x.TipoVendedor).Id + }).ToList(); + SelectedParcela = new Parcela + { + IdEmpresa = SelectedDocumento.Controle.IdEmpresa, + Documento = SelectedDocumento, + Vencimento = vencimento, + Comissao = comissao, + SubTipo = (SubTipo)1, + NumeroParcela = numeroParcela, + VigenciaIncial = value, + VigenciaFinal = value3, + Valor = valor, + Emissao = value2, + DataCriacao = networkTime, + ValorLiquidoFatura = valorLiquidoFatura + }; + list.ForEach(delegate(VendedorParcela x) + { + //IL_004f: Unknown result type (might be due to invalid IL or missing references) + //IL_0052: Unknown result type (might be due to invalid IL or missing references) + //IL_0057: Unknown result type (might be due to invalid IL or missing references) + ((DomainBase)x).Id = 0L; + x.Parcela = SelectedParcela; + x.DataPrePagamento = null; + x.DataPagamento = null; + x.PorcentagemRepasse = ((x.Repasse == null) ? 0m : ((SelectedDocumento.NegocioCorretora == (NegocioCorretora?)0) ? x.Repasse.ValorNovo : x.Repasse.ValorRenovacao)); + }); + Repasses = list; + } + RecalculaRepasse(); + } + + public void IncluirVendedor() + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Expected O, but got Unknown + SelectedPagamento = new VendedorParcela + { + Documento = SelectedDocumento + }; + } + + public void SelecionarVendedor() + { + SelectedPagamento = Pagamentos?.FirstOrDefault(); + } + + public void SelecionaPrimeiraParcela() + { + SelectedParcela = SelectedParcela ?? Parcelas.FirstOrDefault(); + } + + public async Task IncluirApolice(bool renovar = false) + { + if (renovar && (string.IsNullOrWhiteSpace(SelectedDocumento.Apolice) || !SelectedDocumento.Emissao.HasValue)) + { + await ShowMessage("PROPOSTA NÃO PODE SER RENOVADA. NECESSÁRIO PREENCHER O NÚMERO DA APÓLICE E DATA DE EMISSÃO ANTES DE PROSSEGUIR."); + return false; + } + List seguradoras = (from x in Recursos.Seguradoras + where x.Ativo + orderby x.Nome + select x).ToList(); + Seguradoras = seguradoras; + SeguradorasAnteriores = Recursos.Seguradoras; + List ramos = (from x in Recursos.Ramos + where x.Ativo + orderby x.Nome + select x).ToList(); + Ramos = ramos; + List produtos = Recursos.Produtos.Where((Produto x) => x.Ativo).ToList(); + Produtos = produtos; + List status = Recursos.Status.Where((Status x) => x.Ativo).ToList(); + Status = status; + DateTime today = Funcoes.GetNetworkTime().Date; + Documento documento; + if (renovar) + { + SelectedDocumento = await Servico.BuscarApoliceAsync(((DomainBase)SelectedDocumento).Id); + DocumentoRenovado = SelectedDocumento; + if (Seguradoras.All((Seguradora x) => ((DomainBase)x).Id != ((DomainBase)SelectedDocumento.Controle.Seguradora).Id)) + { + Seguradoras.Add(SelectedDocumento.Controle.Seguradora); + } + if (SelectedDocumento.Controle.Produto != null && Produtos.All((Produto x) => ((DomainBase)x).Id != ((DomainBase)SelectedDocumento.Controle.Produto).Id)) + { + Seguradoras.Add(SelectedDocumento.Controle.Seguradora); + } + if (SelectedDocumento.Controle.Ramo != null && Ramos.All((Ramo x) => ((DomainBase)x).Id != ((DomainBase)SelectedDocumento.Controle.Ramo).Id)) + { + Seguradoras.Add(SelectedDocumento.Controle.Seguradora); + } + Vendedores = (Recursos.Configuracoes.All((ConfiguracaoSistema x) => (int)x.Configuracao != 20) ? TodosVendedores.Where((Vendedor x) => x.IdEmpresa == SelectedDocumento.Controle.IdEmpresa && x.Ativo && !x.Corretora).ToList() : new List()); + Estipulantes = Recursos.Estipulantes.Where((Estipulante x) => x.IdEmpresa == SelectedDocumento.Controle.IdEmpresa && x.Ativo).ToList(); + documento = new Documento + { + Controle = new Controle + { + Cliente = MainViewModel.ClienteSelecionado, + IdEmpresa = SelectedDocumento.Controle.IdEmpresa, + Ramo = SelectedDocumento.Controle.Ramo, + Seguradora = SelectedDocumento.Controle.Seguradora, + SeguradoraAnterior = SelectedDocumento.Controle.Seguradora + }, + Ordem = 0, + Tipo = 0, + NegocioCorretora = (NegocioCorretora)1, + Situacao = (TipoSeguro)2, + Negocio = (Negocio)1, + TipoRecebimento = (TipoRecebimento)1, + Vigencia1 = SelectedDocumento.Vigencia2.GetValueOrDefault(today), + Vigencia2 = (SelectedDocumento.Vigencia2?.AddYears(1) ?? today.AddYears(1)), + ApoliceConferida = false, + PropostaAssinada = false, + AdicionalComiss = false, + Excluido = false, + ApoliceAnterior = SelectedDocumento.Apolice, + FormaPagamento = null + }; + EmissaoDocumento = today; + TransmissaoDocumento = today; + if (await ShowMessage("DESEJA MANTER OS VENDEDORES DA APÓLICE ANTERIOR?", "SIM", "NÃO")) + { + Pagamentos?.ToList().ForEach(delegate(VendedorParcela x) + { + x.Documento = null; + x.ValorRepasse = default(decimal); + x.ValorTotal = null; + x.DataPagamento = null; + x.DataPagamento = null; + }); + } + else + { + Pagamentos = new ObservableCollection { PropriaCorretora() }; + Repasses = null; + } + Pagamentos = ((Pagamentos != null) ? new ObservableCollection(Pagamentos) : new ObservableCollection()); + } + else + { + Inclusao = true; + Vendedores = (Recursos.Configuracoes.All((ConfiguracaoSistema x) => (int)x.Configuracao != 20) ? TodosVendedores.Where((Vendedor x) => x.IdEmpresa == MainViewModel.ClienteSelecionado.IdEmpresa && x.Ativo && !x.Corretora).ToList() : new List()); + Estipulantes = Recursos.Estipulantes.Where((Estipulante x) => x.IdEmpresa == MainViewModel.ClienteSelecionado.IdEmpresa && x.Ativo).ToList(); + documento = new Documento + { + Controle = new Controle + { + Cliente = MainViewModel.ClienteSelecionado, + IdEmpresa = MainViewModel.ClienteSelecionado.IdEmpresa + }, + Ordem = 0, + Tipo = 0, + NegocioCorretora = (NegocioCorretora)0, + Situacao = (TipoSeguro)1, + TipoRecebimento = (TipoRecebimento)1, + Vigencia1 = today, + Vigencia2 = today.AddYears(1), + ApoliceConferida = false, + PropostaAssinada = false, + AdicionalComiss = false, + Excluido = false, + FormaPagamento = null + }; + Pagamentos = null; + Repasses = null; + } + IsFatura = false; + SelectedParcela = null; + SelectedDocumento = null; + SelectedPagamento = null; + Parcelas = null; + SelectedDocumento = documento; + IsEndosso = false; + NovaApolice = true; + Renovar = renovar; + EnableAlterarSituacao = true; + AllowEditVendedor = !renovar; + AllowEditApolice = true; + base.IsEnabledEdit = true; + base.IsEnabledEditEndosso = true; + base.AllowEditParcela = false; + base.EnableFields = true; + base.EnableIncluir = false; + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: false); + return true; + } + + public async Task VerificarVigencia(Documento documento) + { + if (!documento.Vigencia2.HasValue) + { + return true; + } + TimeSpan timeSpan = DateTime.Parse(documento.Vigencia2.ToString()) - documento.Vigencia1; + string text = ((timeSpan.Days > 366) ? "VIGÊNCIA FINAL MAIOR QUE 365 DIAS.\nDESEJA CONTINUAR?" : ((timeSpan.Days < 365) ? "VIGÊNCIA FINAL MENOR QUE 365 DIAS.\nDESEJA CONTINUAR?" : "")); + if (text == "") + { + return true; + } + return await ShowMessage(text, "SIM", "NÃO"); + } + + private void ZerarValores() + { + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Invalid comparison between Unknown and I4 + if ((int)SelectedDocumento.TipoRecebimento.GetValueOrDefault() == 2) + { + SelectedDocumento.PremioLiquido = 0m; + SelectedDocumento.PremioAdicional = 0m; + SelectedDocumento.PremioAdicional = 0m; + SelectedDocumento.Iof = 0m; + SelectedDocumento.Diferenca = 0m; + SelectedDocumento.NumeroParcelas = 0m; + } + } + + public async Task>> Salvar(bool critica = false) + { + if ((int)SelectedDocumento.Situacao == 2) + { + SelectedDocumento.Negocio = (Negocio)((SelectedDocumento.NegocioCorretora != (NegocioCorretora?)0) ? 1 : 2); + } + Status status = SelectedDocumento.Status; + if (status != null && ((DomainBase)status).Id == 0) + { + SelectedDocumento.Status = null; + } + ZerarValores(); + List> errors = SelectedDocumento.Validate(IsEndosso, Recursos.Configuracoes.Any((ConfiguracaoSistema c) => (int)c.Configuracao == 11)); + if (SelectedDocumento.Comissao > 100m) + { + SelectedDocumento.Comissao = 100m; + } + bool insert = ((DomainBase)SelectedDocumento).Id == 0; + VendedorParcela selectedPagamento = SelectedPagamento; + if (((selectedPagamento != null) ? selectedPagamento.Vendedor : null) != null && SelectedDocumento.Vendedores == null) + { + SelectedDocumento.Vendedores = new List { TodosVendedores.First((Vendedor x) => x.Corretora && x.IdEmpresa == SelectedDocumento.Controle.IdEmpresa) }; + } + if (insert) + { + VendedorParcela selectedPagamento2 = SelectedPagamento; + if (((selectedPagamento2 != null) ? selectedPagamento2.Vendedor : null) != null && SelectedDocumento.Vendedores != null) + { + List> list = errors; + list.AddRange((await AdicionarVendedor()) ?? new List>()); + } + } + if (errors.Count > 0) + { + return errors; + } + bool flag = SelectedDocumento.Tipo == 0; + if (flag) + { + flag = !(await VerificarVigencia(SelectedDocumento)); + } + if (flag) + { + if (critica) + { + errors.Add(new KeyValuePair("Vigencia2", "VIGENCIANAOACEITA")); + } + return errors; + } + if ((int)SelectedDocumento.TipoEndosso.GetValueOrDefault() != 3 && (int)SelectedDocumento.Situacao == 3 && ((DomainBase)SelectedDocumento).Id == 0L) + { + await ShowMessage("EM DOCUMENTOS CANCELADOS SÓ É POSSIVEL INCLUIR ENDOSSO DE REABILITAÇÃO."); + Alterar(alterar: true); + return null; + } + if (SelectedDocumento.TipoEndosso.HasValue && (int)SelectedDocumento.TipoEndosso.GetValueOrDefault() == 3) + { + SelectedDocumento.Situacao = (TipoSeguro)4; + } + Documento documento = SelectedDocumento; + Alterar(alterar: false); + if (!documento.FormaPagamento.HasValue) + { + documento.FormaPagamento = (FormaPagamento)(Recursos.Configuracoes.Any((ConfiguracaoSistema y) => (int)y.Configuracao == 21) ? 4 : 0); + } + Acesso = (AcessoApolice)0; + bool updateValores = ((DomainBase)documento).Id > 0 && AllowEditApolice && (CancelDocumento.PremioLiquido != documento.PremioLiquido || CancelDocumento.AdicionalComiss != documento.AdicionalComiss || (documento.AdicionalComiss && CancelDocumento.PremioAdicional != documento.PremioAdicional) || CancelDocumento.Comissao != documento.Comissao || CancelDocumento.NegocioCorretora != documento.NegocioCorretora || CancelDocumento.Diferenca != documento.Diferenca || CancelDocumento.Iof != documento.Iof || UpdatePremio); + bool criarNovasParelas = (int)documento.TipoRecebimento.GetValueOrDefault() != 2 && (((DomainBase)documento).Id == 0L || CancelDocumento.NumeroParcelas != documento.NumeroParcelas || documento.NumeroParcelas != (decimal)Parcelas.Count((Parcela x) => (int)x.SubTipo == 1)); + bool renovacao = (int)documento.NegocioCorretora.GetValueOrDefault() == 1; + if (criarNovasParelas && (int)documento.TipoRecebimento.GetValueOrDefault() == 1) + { + CriarParcelas(insert); + Parcelas.ToList().ForEach(delegate(Parcela x) + { + x.Documento = documento; + errors.AddRange(x.Validate(Recursos.Configuracoes.Any((ConfiguracaoSistema y) => (int)y.Configuracao == 9), Recursos.Configuracoes.Any((ConfiguracaoSistema y) => (int)y.Configuracao == 11), EditandoParcela, Recursos.Configuracoes.Any((ConfiguracaoSistema r) => (int)r.Configuracao == 16))); + }); + if (errors.Count > 0) + { + Alterar(alterar: true); + return errors.Distinct().ToList(); + } + } + if (Parcelas == null || Parcelas.Count == 0) + { + Pagamentos = new ObservableCollection(); + } + if (updateValores && !criarNovasParelas) + { + AtualizaValores(renovacao); + } + if ((int)SelectedDocumento.Situacao == 5 && SelectedDocumento.Controle.Documentos != null && SelectedDocumento.Controle.Documentos.Count > 0) + { + foreach (Documento item in SelectedDocumento.Controle.Documentos.Where((Documento x) => x.Tipo != 0 && !x.Excluido)) + { + if ((int)item.Situacao != 3) + { + item.SituacaoAnterior = item.Situacao; + item.Situacao = (TipoSeguro)5; + await Servico.Save(item, updateParcelas: false, criarParcelas: false); + } + } + } + if (((DomainBase)SelectedDocumento).Id != 0L && SelectedDocumento.Tipo == 0 && SelectedDocumento.Controle.Documentos != null && SelectedDocumento.Controle.Documentos.Count > 0 && SelectedDocumento.Controle.Documentos.Where((Documento x) => x.Tipo != 0 && !x.Excluido).Any((Documento x) => x.Apolice != SelectedDocumento.Apolice || x.Proposta != SelectedDocumento.Proposta)) + { + foreach (Documento item2 in SelectedDocumento.Controle.Documentos.Where((Documento x) => x.Tipo != 0 && !x.Excluido)) + { + item2.Apolice = SelectedDocumento.Apolice; + item2.Proposta = SelectedDocumento.Proposta; + await Servico.Save(item2, updateParcelas: false, criarParcelas: false); + ToggleSnackBar("NUMERO DA PROPOSTA/APOLICE ATUALIZADOS NO ENDOSSO"); + } + } + if (Renovar) + { + if (!CancelDocumento.NegocioCorretora.HasValue) + { + CancelDocumento.NegocioCorretora = (NegocioCorretora)((CancelDocumento.Negocio.HasValue && (int)CancelDocumento.Negocio.GetValueOrDefault() == 1) ? 1 : 0); + } + CancelDocumento.Situacao = (TipoSeguro)5; + IEnumerable enumerable = CancelDocumento.Controle.Documentos.Where((Documento d) => d.Tipo == 1 && ((int)d.Situacao == 1 || (int)d.Situacao == 2 || (int)d.Situacao == 4)); + foreach (Documento item3 in enumerable) + { + item3.Situacao = (TipoSeguro)5; + await Servico.Save(item3, updateParcelas: false, criarParcelas: false); + } + Servico.Sucesso = true; + await Servico.Save(CancelDocumento, updateParcelas: false, criarParcelas: false); + if (!Servico.Sucesso) + { + await ShowMessage("NÃO FOI POSSÍVEL ALTERAR O STATUS DO DOCUMENTO RENOVADO, POR FAVOR VERIFIQUE APÓS O PROCEDIMENTO SER CONCLUÍDO."); + } + string text = (string.IsNullOrEmpty(CancelDocumento.Apolice) ? ("A PROPOSTA \"" + CancelDocumento.Proposta + "\"") : ("A APÓLICE \"" + CancelDocumento.Apolice + "\"")); + RegistrarAcao("RENOVOU " + text, ((DomainBase)CancelDocumento).Id, (TipoTela)2, GerarObs(CancelDocumento)); + } + if (documento.TipoEndosso.HasValue && (int)documento.TipoEndosso.GetValueOrDefault() == 4 && SelectedDocumento.Vigencia2.HasValue && !(await Servico.Prorrogar(((DomainBase)SelectedDocumento.Controle).Id, SelectedDocumento.Vigencia2.Value))) + { + await ShowMessage("NÃO FOI POSSÍVEL ALTERAR A VIGÊNCIA FINAL DA APÓLICE, POR FAVOR VERIFIQUE APÓS O PROCEDIMENTO SER CONCLUÍDO."); + } + if (documento.TipoEndosso.HasValue && (int)documento.TipoEndosso.GetValueOrDefault() == 3 && !(await Servico.Reabilitar(((DomainBase)SelectedDocumento.Controle).Id))) + { + await ShowMessage("NÃO FOI POSSÍVEL ALTERAR O STATUS DA APÓLICE, POR FAVOR VERIFIQUE APÓS O PROCEDIMENTO SER CONCLUÍDO."); + } + if (documento.TipoEndosso.HasValue && (int)documento.TipoEndosso.GetValueOrDefault() == 2) + { + Documento apolice = ((IEnumerable)CancelDocumento.Controle.Documentos).FirstOrDefault((Func)((Documento x) => x.Tipo == 0)); + apolice.Situacao = (TipoSeguro)3; + IEnumerable enumerable2 = CancelDocumento.Controle.Documentos.Where((Documento x) => x.Tipo == 1); + foreach (Documento item4 in enumerable2) + { + item4.Situacao = (TipoSeguro)3; + await Servico.Save(item4, updateParcelas: false, criarParcelas: false); + } + if (!apolice.NegocioCorretora.HasValue) + { + apolice.NegocioCorretora = (NegocioCorretora)((apolice.Negocio.HasValue && (int)apolice.Negocio.GetValueOrDefault() == 1) ? 1 : 0); + } + documento.Situacao = (TipoSeguro)3; + Servico.Sucesso = true; + await Servico.Save(apolice, updateParcelas: false, criarParcelas: false); + if (!Servico.Sucesso) + { + await ShowMessage("NÃO FOI POSSÍVEL ALTERAR O STATUS DO DOCUMENTO CANCELADO, POR FAVOR VERIFIQUE APÓS O PROCEDIMENTO SER CONCLUÍDO."); + } + flag = insert; + if (flag) + { + flag = await ShowMessage("DESEJA BAIXAR AS PARCELAS PENDENTES ABAIXO DESSE DOCUMENTO?", "SIM", "NÃO"); + } + if (flag) + { + bool baixarParcelas = true; + foreach (Documento documento2 in apolice.Controle.Documentos) + { + baixarParcelas = await Servico.BaixarParcelasCancelamento(documento2, estorno: false) && baixarParcelas; + } + if (!baixarParcelas) + { + await ShowMessage("NÃO FOI POSSÍVEL AS PARCELAS DO DOCUMENTO CANCELADO, POR FAVOR VERIFIQUE APÓS O PROCEDIMENTO SER CONCLUÍDO."); + } + } + string text2 = "A APÓLICE \"" + apolice.Apolice + "\""; + RegistrarAcao("CANCELOU " + text2, ((DomainBase)apolice).Id, (TipoTela)2, GerarObs(apolice)); + } + if (Parcelas != null) + { + documento.Parcelas = new ObservableCollection(Parcelas.Where((Parcela x) => (int)x.SubTipo == 1)); + } + if (!string.IsNullOrWhiteSpace(Anotacoes)) + { + documento.Observacao = $"{Recursos.Usuario.Nome}, ID: {((DomainBase)Recursos.Usuario).Id}, {Funcoes.GetNetworkTime():g}{Environment.NewLine}{Anotacoes}{Environment.NewLine}{Environment.NewLine}{documento.Observacao}"; + } + Documento documentoSelecionado = DocumentoSelecionado; + int num; + if (documentoSelecionado == null) + { + num = 0; + } + else + { + _ = documentoSelecionado.Situacao; + num = 1; + } + if (num != 0 && (int)DocumentoSelecionado.Situacao == 7 && DocumentoSelecionado.Situacao != documento.Situacao) + { + ObservableCollection parcelas = documento.Parcelas; + if (parcelas != null && parcelas.Where((Parcela x) => x.DataRecebimento.HasValue).Count() >= 1) + { + await ShowMessage("O DOCUMENTO TEM PARCELAS BAIXADAS DEVIDO A RECUSA. CASO NECESSÁRIO, REALIZE A EXCLUSÃO DAS BAIXAS MANUALMENTE."); + Alterar(alterar: true); + return null; + } + } + Servico.Sucesso = true; + if (((DomainBase)documento).Id == 0L) + { + documento.DataCriacao = Funcoes.GetNetworkTime(); + documento.UsuarioCriacao = Recursos.Usuario; + } + documento.SituacaoAnterior = documento.Situacao; + Documento documentoSalvo = await Servico.Save(documento, updateValores, criarNovasParelas); + List list2 = Pagamentos?.Where((VendedorParcela p) => (int)documentoSalvo.TipoRecebimento.GetValueOrDefault() == 1 && p.Repasse != null && ((int)p.Repasse.Base.GetValueOrDefault() == 1 || (int)p.Repasse.Base.GetValueOrDefault() == 4 || (int)p.Repasse.Base.GetValueOrDefault() == 5) && !p.DataPagamento.HasValue).ToList(); + if (list2 != null && list2.Count > 0) + { + List atualizarPagamentos = new List(); + list2?.ForEach(delegate(VendedorParcela p) + { + //IL_001a: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Unknown result type (might be due to invalid IL or missing references) + //IL_003c: Expected I4, but got Unknown + BaseRepasse? @base = p.Repasse.Base; + if (@base.HasValue) + { + BaseRepasse valueOrDefault = @base.GetValueOrDefault(); + switch (valueOrDefault - 1) + { + case 0: + if (!(p.DataPrePagamento == documentoSalvo.Vigencia1)) + { + p.DataPrePagamento = documentoSalvo.Vigencia1; + atualizarPagamentos.Add(p); + } + break; + case 3: + if (!(p.DataPrePagamento == documentoSalvo.Emissao)) + { + p.DataPrePagamento = documentoSalvo.Emissao; + atualizarPagamentos.Add(p); + } + break; + case 4: + if (!(p.DataPrePagamento == documentoSalvo.Remessa)) + { + p.DataPrePagamento = documentoSalvo.Remessa; + atualizarPagamentos.Add(p); + } + break; + case 1: + case 2: + break; + } + } + }); + if (atualizarPagamentos.Count > 0) + { + await new ParcelaServico().SaveRange(atualizarPagamentos.ToList()); + } + } + if (!Servico.Sucesso) + { + Alterar(alterar: true); + return null; + } + Documento documentoSelecionado2 = DocumentoSelecionado; + int num2; + if (documentoSelecionado2 == null) + { + num2 = 0; + } + else + { + _ = documentoSelecionado2.Situacao; + num2 = 1; + } + if (num2 != 0 && (int)DocumentoSelecionado.Situacao == 7 && documento.Situacao != DocumentoSelecionado.Situacao) + { + Gestor.Application.Actions.Actions.AcessaTela?.Invoke((TipoTela)21, ""); + } + SelectedDocumento = await Servico.BuscarApoliceAsync(((DomainBase)documentoSalvo).Id); + ((DomainBase)SelectedDocumento).Initialize(); + await CarregarParcelas(SelectedDocumento); + await CarregaRepasse(((DomainBase)SelectedDocumento).Id); + SelectedParcela = Parcelas.FirstOrDefault(); + Documento selectedDocumento = SelectedDocumento; + VendedorParcela? obj = ((IEnumerable)Repasses).FirstOrDefault((Func)((VendedorParcela x) => ((DomainBase)x.TipoVendedor).Id == 1)); + selectedDocumento.VendedorPrincipal = ((obj != null) ? obj.Vendedor : null); + bool renovar = Renovar; + ConsultaViewModel.DocumentoRenovado = (renovar ? DocumentoRenovado : ConsultaViewModel.DocumentoSelecionado); + NovaApolice = false; + Renovar = false; + if (insert) + { + AllowEditApolice = true; + base.IsEnabledEdit = true; + base.IsEnabledEditEndosso = true; + if (Invoke) + { + ConsultaViewModel.DocumentoSelecionado = SelectedDocumento; + } + if (Invoke) + { + Gestor.Application.Actions.Actions.RecarregarDocumentos?.Invoke(SelectedDocumento); + } + if (Invoke) + { + Gestor.Application.Actions.Actions.UpdateDocumento?.Invoke(SelectedDocumento); + } + } + else if (Invoke) + { + long id = ((DomainBase)SelectedDocumento).Id; + Documento documentoSelecionado3 = ConsultaViewModel.DocumentoSelecionado; + if (id != ((documentoSelecionado3 != null) ? new long?(((DomainBase)documentoSelecionado3).Id) : null)) + { + ConsultaViewModel.DocumentoSelecionado = SelectedDocumento; + } + } + if (Parcelas.Count == 0) + { + AllowEditVendedor = false; + } + base.AllowEditParcela = true; + ToggleSnackBar("DOCUMENTO SALVO COM SUCESSO"); + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: true); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: true); + if (renovar && await ShowMessage("DESEJA MANTER OS DADOS DO PERFIL DA APÓLICE ANTERIOR?", "SIM", "NÃO")) + { + List source = await PerfilServico.BuscarPerfis(((DomainBase)CancelDocumento.Controle).Id); + try + { + foreach (Perfil item5 in source.ToList()) + { + Perfil perfil = new Perfil + { + Id = 0L, + AntiFurto = item5.AntiFurto, + CepCirculacao = ValidationHelper.FormataCep(item5.CepCirculacao), + CepPernoite = ValidationHelper.FormataCep(item5.CepPernoite), + Cliente = item5.Cliente, + Controle = new Controle + { + AssistenciaId = item5.Controle.AssistenciaId, + Cliente = item5.Controle.Cliente, + Documentos = item5.Controle.Documentos, + Id = ((DomainBase)SelectedDocumento.Controle).Id, + IdEmpresa = item5.Controle.IdEmpresa, + Item = item5.Controle.Item, + Produto = item5.Controle.Produto, + Ramo = item5.Controle.Ramo, + Seguradora = item5.Controle.Seguradora, + SeguradoraAnterior = item5.Controle.SeguradoraAnterior + }, + Cpf = item5.Cpf, + DistanciaResidenciaTrabalho = item5.DistanciaResidenciaTrabalho, + EstadoCivil = item5.EstadoCivil, + EstenderCobertura = item5.EstenderCobertura, + GaragemEstudo = item5.GaragemEstudo, + GaragemResidencia = item5.GaragemResidencia, + GaragemTrabalho = item5.GaragemTrabalho, + Habilitacao = item5.Habilitacao, + Isencao = item5.Isencao, + KmMensal = item5.KmMensal, + Nascimento = item5.Nascimento, + Nome = item5.Nome, + Ocupacao = item5.Ocupacao, + Relacao = item5.Relacao, + SeguroVida = item5.SeguroVida, + Sexo = item5.Sexo, + TempoHabilitacao = item5.TempoHabilitacao, + TipoResidencia = item5.TipoResidencia, + UsoDependentes = item5.UsoDependentes, + UsoProfissional = item5.UsoProfissional, + VeiculoResidencia = item5.VeiculoResidencia + }; + await PerfilServico.Save(perfil); + } + } + catch (Exception ex) + { + _ = ex; + await ShowMessage("NÃO FOI POSSÍVEL MANTER OS DADOS DO PERFIL DA APÓLICE ANTERIOR, POR FAVOR VERIFIQUE APÓS O PROCEDIMENTO SER CONCLUÍDO."); + } + } + CancelDocumento = (Documento)((DomainBase)SelectedDocumento).Clone(); + EditarParcelasLabel = (((int)SelectedDocumento.TipoRecebimento.GetValueOrDefault() == 2) ? "EDITAR FATURAS" : "EDITAR PARCELAS"); + base.EnableFields = false; + CalculaComissao(SelectedDocumento, Parcelas); + string text3 = (insert ? "INCLUIU" : "ALTEROU"); + string text4 = ((SelectedDocumento.Tipo == 0 && string.IsNullOrEmpty(SelectedDocumento.Apolice)) ? ("A PROPOSTA \"" + SelectedDocumento.Proposta + "\"") : ((SelectedDocumento.Tipo == 0 && !string.IsNullOrEmpty(SelectedDocumento.Apolice)) ? ("A APÓLICE \"" + SelectedDocumento.Apolice + "\"") : (string.IsNullOrEmpty(SelectedDocumento.Endosso) ? ("A PROPOSTA DE ENDOSSO \"" + SelectedDocumento.PropostaEndosso + "\"") : ("O ENDOSSO \"" + SelectedDocumento.Endosso + "\"")))); + RegistrarAcao(text3 + " " + text4, ((DomainBase)SelectedDocumento).Id, (TipoTela)2, GerarObs(SelectedDocumento)); + if ((renovar || (IsEndosso && (int)SelectedDocumento.TipoEndosso.GetValueOrDefault() != 2)) && insert) + { + Gestor.Application.Actions.Actions.AcessaTela?.Invoke((TipoTela)3, renovar ? "Renovação" : "Endosso"); + return null; + } + if ((int)SelectedDocumento.TipoEndosso.GetValueOrDefault() == 2) + { + return null; + } + flag = !Invoke || !insert; + if (!flag) + { + flag = !(await ShowMessage("DESEJA INCLUIR O ITEM AGORA?", "SIM", "NÃO")); + } + if (flag) + { + return null; + } + Gestor.Application.Actions.Actions.AcessaTela?.Invoke((TipoTela)3, ""); + return null; + } + + private void AtualizaValores(bool renovacao) + { + Repasses.ForEach(delegate(VendedorParcela x) + { + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + //IL_001d: Invalid comparison between Unknown and I4 + //IL_0028: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Invalid comparison between Unknown and I4 + //IL_0094: Unknown result type (might be due to invalid IL or missing references) + //IL_009a: Invalid comparison between Unknown and I4 + if (x.Repasse != null && (int)x.Repasse.Tipo.GetValueOrDefault() != 1) + { + Parcela parcela = x.Parcela; + if ((int)parcela.SubTipo == 1) + { + parcela.Documento = SelectedDocumento; + decimal value = Funcoes.CalculaRepasse(x.Repasse, parcela); + decimal value2 = (renovacao ? x.Repasse.ValorRenovacao : x.Repasse.ValorNovo); + if (x.CoCorretagem) + { + value2 = x.Repasse.ValorNovo; + } + if ((int)x.Repasse.Forma.GetValueOrDefault() == 3) + { + value /= SelectedDocumento.NumeroParcelas; + } + if (x.CoCorretagem) + { + decimal comissao = SelectedDocumento.Comissao; + Documento selectedDocumento = SelectedDocumento; + decimal valueOrDefault = ((selectedDocumento != null) ? selectedDocumento.ComissaoTotal : null).GetValueOrDefault(); + value = SelectedDocumento.PremioLiquido * ((valueOrDefault - comissao) / 100m); + } + x.PorcentagemRepasse = value2; + x.ValorRepasse = value; + x.ValorTotal = value; + } + } + }); + decimal valor = ((Parcelas.Count((Parcela x) => (int)x.SubTipo == 1) > 0) ? (SelectedDocumento.PremioTotal / (decimal)Parcelas.Count((Parcela x) => (int)x.SubTipo == 1)) : 0m); + Parcelas.Where((Parcela x) => (int)x.SubTipo == 1).ToList().ForEach(delegate(Parcela x) + { + x.Valor = valor; + x.Comissao = SelectedDocumento.Comissao; + x.Vendedores = new ObservableCollection(Repasses.Where((VendedorParcela r) => ((DomainBase)r.Parcela).Id == ((DomainBase)x).Id)); + }); + } + + private void CriarParcelas(bool insert) + { + if (Repasses == null) + { + Repasses = new List(); + } + var list = (from x in Repasses + where insert || (int)x.Parcela.SubTipo == 1 + group x by new { x.Repasse, x.TipoVendedor }).Distinct().ToList(); + List vendedorParcelas = new List(); + list.ForEach(x => + { + //IL_003e: Unknown result type (might be due to invalid IL or missing references) + //IL_0044: Invalid comparison between Unknown and I4 + if (x.Key.Repasse != null) + { + VendedorParcela val = CalculaRepasse(x.Key.Repasse, x.Key.TipoVendedor); + if ((int)val.Repasse.Forma.GetValueOrDefault() == 3) + { + val.ValorRepasse /= (decimal?)((SelectedDocumento.NumeroParcelas > 0m) ? SelectedDocumento.NumeroParcelas : 1m); + } + vendedorParcelas.Add(val); + } + }); + if (vendedorParcelas.All((VendedorParcela x) => ((DomainBase)x.TipoVendedor).Id != 1)) + { + vendedorParcelas.Add(PropriaCorretora()); + } + Parcelas = new ObservableCollection(CriarParcelas(vendedorParcelas)); + } + + private List CriarParcelas(List vendedores) + { + //IL_0068: Unknown result type (might be due to invalid IL or missing references) + //IL_006d: Unknown result type (might be due to invalid IL or missing references) + //IL_0083: Unknown result type (might be due to invalid IL or missing references) + //IL_008a: Unknown result type (might be due to invalid IL or missing references) + //IL_0091: Unknown result type (might be due to invalid IL or missing references) + //IL_00a2: Unknown result type (might be due to invalid IL or missing references) + //IL_00bf: Unknown result type (might be due to invalid IL or missing references) + //IL_00c6: Unknown result type (might be due to invalid IL or missing references) + //IL_0102: Unknown result type (might be due to invalid IL or missing references) + //IL_0110: Unknown result type (might be due to invalid IL or missing references) + //IL_0114: Unknown result type (might be due to invalid IL or missing references) + //IL_0119: Unknown result type (might be due to invalid IL or missing references) + //IL_0135: Unknown result type (might be due to invalid IL or missing references) + //IL_013b: Invalid comparison between Unknown and I4 + //IL_0181: Unknown result type (might be due to invalid IL or missing references) + //IL_0191: Unknown result type (might be due to invalid IL or missing references) + //IL_01a3: Expected O, but got Unknown + //IL_014b: Unknown result type (might be due to invalid IL or missing references) + //IL_0151: Invalid comparison between Unknown and I4 + //IL_0161: Unknown result type (might be due to invalid IL or missing references) + //IL_0167: Invalid comparison between Unknown and I4 + List list = new List(); + if (SelectedDocumento.NumeroParcelas == 0m) + { + return list; + } + decimal valor = SelectedDocumento.PremioTotal / SelectedDocumento.NumeroParcelas; + if (!SelectedDocumento.FormaPagamento.HasValue) + { + SelectedDocumento.FormaPagamento = (FormaPagamento)0; + } + for (int i = 1; (decimal)i <= SelectedDocumento.NumeroParcelas; i++) + { + Parcela item = new Parcela + { + IdEmpresa = SelectedDocumento.Controle.IdEmpresa, + NumeroParcela = i, + Valor = valor, + Comissao = SelectedDocumento.Comissao, + Vencimento = SelectedDocumento.Vigencia1.AddMonths(i - 1), + SubTipo = (SubTipo)1, + Vendedores = new ObservableCollection((i == 1) ? vendedores : vendedores.Where(delegate(VendedorParcela x) + { + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + //IL_001a: Invalid comparison between Unknown and I4 + Repasse repasse = x.Repasse; + return repasse != null && (int)repasse.Forma.GetValueOrDefault() == 3; + }).ToList()), + TipoPagamento = (TipoPagamento)((SelectedDocumento.FormaPagamento == (FormaPagamento?)0) ? 7 : (((int)SelectedDocumento.FormaPagamento.GetValueOrDefault() == 1) ? 3 : (((int)SelectedDocumento.FormaPagamento.GetValueOrDefault() == 2) ? 15 : (((int)SelectedDocumento.FormaPagamento.GetValueOrDefault() == 3 && i == 1) ? 15 : 7)))), + DataCriacao = Funcoes.GetNetworkTime(), + UsuarioCriacao = ((DomainBase)Recursos.Usuario).Id + }; + list.Add(item); + } + return list; + } + + private List CriarRepasses(VendedorParcela repasse) + { + //IL_0050: Unknown result type (might be due to invalid IL or missing references) + //IL_0056: Invalid comparison between Unknown and I4 + if (Parcelas == null || Parcelas.Count == 0 || SelectedDocumento == null) + { + return null; + } + List repasses = new List(); + repasse.ValorRepasse = (((int)repasse.Repasse.Forma.GetValueOrDefault() != 3) ? repasse.ValorRepasse : (repasse.ValorRepasse / (decimal?)SelectedDocumento.NumeroParcelas)); + Parcelas.ToList().ForEach(delegate(Parcela x) + { + //IL_0013: Unknown result type (might be due to invalid IL or missing references) + //IL_0019: Invalid comparison between Unknown and I4 + //IL_0030: Unknown result type (might be due to invalid IL or missing references) + //IL_0036: Expected O, but got Unknown + //IL_0049: Unknown result type (might be due to invalid IL or missing references) + //IL_004f: Invalid comparison between Unknown and I4 + if ((int)repasse.Repasse.Forma.GetValueOrDefault() == 3 || x.NumeroParcela <= 1) + { + VendedorParcela val = (VendedorParcela)((DomainBase)repasse).Clone(); + if ((int)repasse.Repasse.Forma.GetValueOrDefault() == 3) + { + val.DataPrePagamento = x.Vencimento; + } + val.Parcela = x; + repasses.Add(val); + } + }); + return repasses; + } + + private VendedorParcela PropriaCorretora() + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Unknown result type (might be due to invalid IL or missing references) + //IL_002c: Unknown result type (might be due to invalid IL or missing references) + //IL_0048: Unknown result type (might be due to invalid IL or missing references) + //IL_005c: Unknown result type (might be due to invalid IL or missing references) + //IL_008c: Expected O, but got Unknown + return new VendedorParcela + { + Repasse = null, + ValorRepasse = default(decimal), + Documento = SelectedDocumento, + Vendedor = ((IEnumerable)Recursos.Vendedores).FirstOrDefault((Func)delegate(Vendedor x) + { + long idEmpresa = x.IdEmpresa; + Documento selectedDocumento = SelectedDocumento; + long? obj; + if (selectedDocumento == null) + { + obj = null; + } + else + { + Controle controle = selectedDocumento.Controle; + obj = ((controle != null) ? new long?(controle.IdEmpresa) : null); + } + return idEmpresa == (obj ?? ((DomainBase)Recursos.Empresa).Id) && x.Corretora; + }), + PorcentagemRepasse = default(decimal), + TipoVendedor = Recursos.TipoVendedor.First((TipoVendedor x) => ((DomainBase)x).Id == 1) + }; + } + + public VendedorParcela CalculaRepasse(Repasse repasse, TipoVendedor tipoVendedor) + { + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Invalid comparison between Unknown and I4 + //IL_0066: Unknown result type (might be due to invalid IL or missing references) + //IL_006b: Unknown result type (might be due to invalid IL or missing references) + //IL_0072: Unknown result type (might be due to invalid IL or missing references) + //IL_007e: Unknown result type (might be due to invalid IL or missing references) + //IL_008a: Unknown result type (might be due to invalid IL or missing references) + //IL_0096: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Unknown result type (might be due to invalid IL or missing references) + //IL_0025: Unknown result type (might be due to invalid IL or missing references) + //IL_002c: Unknown result type (might be due to invalid IL or missing references) + //IL_0047: Expected O, but got Unknown + //IL_00b2: Unknown result type (might be due to invalid IL or missing references) + //IL_00b9: Unknown result type (might be due to invalid IL or missing references) + //IL_00c9: Unknown result type (might be due to invalid IL or missing references) + //IL_00cf: Invalid comparison between Unknown and I4 + //IL_00d7: Expected O, but got Unknown + bool flag = (int)SelectedDocumento.NegocioCorretora.GetValueOrDefault() == 1; + if (SelectedParcela == null) + { + SelectedParcela = new Parcela + { + SubTipo = (SubTipo)1, + IdEmpresa = SelectedDocumento.Controle.IdEmpresa + }; + } + SelectedParcela.Documento = SelectedDocumento; + decimal value = Funcoes.CalculaRepasse(repasse, SelectedParcela); + return new VendedorParcela + { + Repasse = repasse, + ValorRepasse = value, + ValorTotal = value, + Vendedor = repasse.Vendedor, + PorcentagemRepasse = (flag ? repasse.ValorRenovacao : repasse.ValorNovo), + TipoVendedor = tipoVendedor, + CoCorretagem = (repasse != null && (int)repasse.Tipo.GetValueOrDefault() == 3) + }; + } + + public List GetRepasses(Vendedor vendedor) + { + if (CoCorretagem) + { + return RepassesVendedores.Where((Repasse x) => ((DomainBase)x.Vendedor).Id == ((DomainBase)vendedor).Id)?.Where((Repasse x) => (int)x.Tipo.GetValueOrDefault() == 3)?.OrderBy((Repasse x) => x.ValorNovo).ToList(); + } + if (Recursos.Configuracoes.All((ConfiguracaoSistema x) => (int)x.Configuracao != 20)) + { + return (from x in RepassesVendedores.Where((Repasse x) => ((DomainBase)x.Vendedor).Id == ((DomainBase)vendedor).Id)?.Where((Repasse x) => (int)x.Tipo.GetValueOrDefault() != 3) + orderby x.ValorNovo + select x).ToList(); + } + if (RepassesVendedores.Any((Repasse x) => ((DomainBase)x.Vendedor).Id == ((DomainBase)vendedor).Id && x.Ramo != null && ((DomainBase)x.Ramo).Id == ((DomainBase)SelectedDocumento.Controle.Ramo).Id)) + { + return (from x in RepassesVendedores + where ((DomainBase)x.Vendedor).Id == ((DomainBase)vendedor).Id && x.Ramo != null && ((DomainBase)x.Ramo).Id == ((DomainBase)SelectedDocumento.Controle.Ramo).Id + orderby x.ValorNovo + select x).ToList(); + } + return (from x in RepassesVendedores + where ((DomainBase)x.Vendedor).Id == ((DomainBase)vendedor).Id && x.Ramo == null + orderby x.ValorNovo + select x).ToList(); + } + + public void FiltrarRepasse(Vendedor vendedor) + { + //IL_0009: Unknown result type (might be due to invalid IL or missing references) + //IL_0013: Expected O, but got Unknown + if (SelectedPagamento == null) + { + SelectedPagamento = new VendedorParcela(); + } + SelectedPagamento.Vendedor = vendedor; + RepassesVendedor = GetRepasses(vendedor); + } + + public async Task>> AdicionarVendedor() + { + if (SelectedPagamento == null) + { + return null; + } + if (SelectedPagamento.Repasse == null) + { + return new List> + { + new KeyValuePair("ValorRepasse|VALOR DO REPASSE", "OBRIGATÓRIO") + }; + } + if (SelectedDocumento.Comissao == 0m) + { + return new List> + { + new KeyValuePair("Comissao|PORCENTAGEM DE COMISSÃO", "OBRIGATÓRIO") + }; + } + Loading(isLoading: true); + SelectedPagamento.Parcela = SelectedParcela ?? Parcelas?.OrderBy((Parcela x) => x.NumeroParcela).FirstOrDefault(); + List vinculo = SelectedPagamento.Repasse.Vinculo?.Where((VinculoRepasse x) => ((DomainBase)x.TipoVendedor).Id == ((DomainBase)SelectedPagamento.TipoVendedor).Id).ToList(); + List pagamentos = new List { SelectedPagamento }; + bool renovacao = (SelectedDocumento.NegocioCorretora.HasValue ? ((int)SelectedDocumento.NegocioCorretora.GetValueOrDefault() == 1) : ((int)SelectedDocumento.Situacao == 2 && SelectedDocumento.Negocio.HasValue && (int)SelectedDocumento.Negocio.GetValueOrDefault() == 1)); + if (vinculo != null && vinculo.Count > 0 && await ShowMessage("DESEJA ADICIONAR OS REPASSES VINCULADOS?", "SIM", "NÃO")) + { + foreach (VinculoRepasse item2 in vinculo) + { + decimal value = Funcoes.CalculaRepasse(item2.RepasseVinculo, SelectedPagamento.Parcela, SelectedPagamento.Parcela == null || (int)SelectedPagamento.Parcela.SubTipo == 1); + VendedorParcela val = new VendedorParcela + { + TipoVendedor = item2.TipoVendedorVinculo, + Vendedor = item2.RepasseVinculo.Vendedor, + Repasse = item2.RepasseVinculo, + Documento = SelectedPagamento.Documento, + Parcela = SelectedPagamento.Parcela, + PorcentagemRepasse = (renovacao ? item2.RepasseVinculo.ValorRenovacao : item2.RepasseVinculo.ValorNovo), + ValorRepasse = value, + ValorTotal = value + }; + Repasse repasseVinculo = item2.RepasseVinculo; + val.CoCorretagem = repasseVinculo != null && (int)repasseVinculo.Tipo.GetValueOrDefault() == 3; + VendedorParcela item = val; + pagamentos.Add(item); + } + } + List> errors; + foreach (VendedorParcela p in pagamentos) + { + VendedorParcela pagamento = p; + if (((pagamento != null) ? pagamento.Documento : null) == null && ((DomainBase)pagamento.Parcela.Documento).Id == ((DomainBase)SelectedDocumento).Id) + { + pagamento.Documento = SelectedDocumento; + } + errors = pagamento.Validate(); + errors.AddRange(Validate(pagamento)); + if (errors.Count > 0) + { + if (SelectedPagamento == null) + { + SelectedPagamento = pagamento; + } + Loading(isLoading: false); + return errors; + } + if (pagamento.Repasse != null) + { + switch (pagamento.Repasse.Base) + { + case 2L: + pagamento.DataPrePagamento = ((pagamento.Parcela.Vencimento == DateTime.MinValue) ? SelectedDocumento.Vigencia1 : pagamento.Parcela.Vencimento); + break; + case 0L: + pagamento.DataPrePagamento = (((int)SelectedDocumento.TipoRecebimento.GetValueOrDefault() == 2) ? SelectedParcela.VigenciaIncial : new DateTime?(SelectedDocumento.Vigencia1)); + break; + case 1L: + pagamento.DataPrePagamento = SelectedDocumento.DataCriacao; + break; + case 3L: + pagamento.DataPrePagamento = (((int)SelectedDocumento.TipoRecebimento.GetValueOrDefault() == 2) ? SelectedParcela.Emissao : SelectedDocumento.Emissao); + break; + case 4L: + pagamento.DataPrePagamento = (((int)SelectedDocumento.TipoRecebimento.GetValueOrDefault() == 2) ? SelectedParcela.Emissao : SelectedDocumento.Remessa); + break; + } + } + if (Pagamentos == null) + { + Pagamentos = new ObservableCollection(); + } + if (((DomainBase)SelectedDocumento).Id == 0L) + { + Repasses.Add(pagamento); + Pagamentos.Add(pagamento); + SelectedPagamento = new VendedorParcela(); + continue; + } + if ((int)SelectedDocumento.TipoRecebimento.GetValueOrDefault() != 2 && SelectedDocumento.NumeroParcelas != (decimal)Parcelas.Count((Parcela x) => (int)x.SubTipo == 1)) + { + CriarParcelas(insert: true); + Parcelas.ToList().ForEach(delegate(Parcela x) + { + x.Documento = SelectedDocumento; + errors.AddRange(x.Validate(Recursos.Configuracoes.Any((ConfiguracaoSistema y) => (int)y.Configuracao == 9), Recursos.Configuracoes.Any((ConfiguracaoSistema y) => (int)y.Configuracao == 11), EditandoParcela, Recursos.Configuracoes.Any((ConfiguracaoSistema r) => (int)r.Configuracao == 16))); + }); + if (errors.Count > 0) + { + Loading(isLoading: false); + return errors.Distinct().ToList(); + } + ParcelaServico.Sucesso = true; + await ParcelaServico.SaveRange(Parcelas.ToList()); + if (!ParcelaServico.Sucesso) + { + Repasses = await VendedorServico.BuscaRepasse(((DomainBase)SelectedDocumento).Id); + await SelecionaParcela(SelectedParcela ?? Parcelas.FirstOrDefault()); + SelectedPagamento = null; + Loading(isLoading: false); + return null; + } + await CarregarParcelas(SelectedDocumento); + SelectedPagamento.Parcela = Parcelas.First(); + SelectedParcela = Parcelas.First(); + } + VendedorParcela corretora = ((IEnumerable)Repasses).FirstOrDefault((Func)((VendedorParcela x) => (int)x.Parcela.SubTipo == 1 && ((DomainBase)x.TipoVendedor).Id == 1 && x.Vendedor.Corretora)); + bool excluirCorretora = !pagamento.CoCorretagem && ((DomainBase)pagamento.TipoVendedor).Id == 1 && corretora != null; + if (pagamento.CoCorretagem) + { + await AjusteComissãoCoCorretagem(); + decimal premioLiquido = SelectedDocumento.PremioLiquido; + decimal? num = (SelectedDocumento.ComissaoTotal - (decimal?)SelectedDocumento.Comissao) / (decimal?)100; + decimal? num2 = (decimal?)premioLiquido * num; + pagamento.PorcentagemRepasse = p.Repasse.ValorNovo; + pagamento.ValorRepasse = num2; + pagamento.ValorTotal = num2; + p.ValorRepasse = num2; + p.ValorTotal = num2; + } + List repasses = CriarRepasses(pagamento); + repasses = await Servico.IncluirVendedores(repasses); + if (!Servico.Sucesso) + { + Repasses = await VendedorServico.BuscaRepasse(((DomainBase)SelectedDocumento).Id); + await SelecionaParcela(SelectedParcela ?? Parcelas.FirstOrDefault()); + SelectedPagamento = null; + Loading(isLoading: false); + return null; + } + string tipodoc = ((SelectedDocumento.Tipo == 0 && string.IsNullOrEmpty(SelectedDocumento.Apolice)) ? ("NA PROPOSTA \"" + SelectedDocumento.Proposta + "\"") : ((SelectedDocumento.Tipo == 0 && !string.IsNullOrEmpty(SelectedDocumento.Apolice)) ? ("NA APÓLICE \"" + SelectedDocumento.Apolice + "\"") : (string.IsNullOrEmpty(SelectedDocumento.Endosso) ? ("NA PROPOSTA DE ENDOSSO \"" + SelectedDocumento.PropostaEndosso + "\"") : ("NO ENDOSSO \"" + SelectedDocumento.Endosso + "\"")))); + repasses?.ForEach(delegate(VendedorParcela x) + { + string descricao = "VENDEDOR " + x.Vendedor.Nome + " ADICIONADO, " + tipodoc; + RegistrarAcao(descricao, ((DomainBase)x).Id, (TipoTela)37, $"{GerarObs(SelectedDocumento)}{Environment.NewLine}VENDEDOR: {x.Vendedor.Nome}{Environment.NewLine}COMISSÃO TOTAL: {x.ValorTotal:C2}"); + }); + Repasses.AddRange(repasses); + if (excluirCorretora) + { + await ExcluirVendedor(corretora, incluirCorretora: false); + Documento selectedDocumento = SelectedDocumento; + VendedorParcela? obj = ((IEnumerable)Repasses).FirstOrDefault((Func)((VendedorParcela x) => ((DomainBase)x.TipoVendedor).Id == 1)); + selectedDocumento.VendedorPrincipal = ((obj != null) ? obj.Vendedor : null); + } + ToggleSnackBar("VENDEDOR ADICIONADO COM SUCESSO"); + Repasses = await VendedorServico.BuscaRepasse(((DomainBase)SelectedDocumento).Id); + await SelecionaParcela(SelectedParcela ?? Parcelas.FirstOrDefault()); + SelectedPagamento = null; + } + CalculaComissao(SelectedDocumento, Parcelas); + Loading(isLoading: false); + return null; + } + + public List> Validate(VendedorParcela pagamento) + { + List> list = new List>(); + if (pagamento == null || SelectedDocumento == null) + { + list.Add(new KeyValuePair("pagamento|PAGAMENTO", "ERRO AO INSERIR VENDEDOR.")); + return list; + } + if (pagamento.TipoVendedor == null || pagamento.Vendedor == null) + { + return list; + } + if (Repasses == null) + { + Repasses = new List(); + } + if (Repasses.Count > 0) + { + if (Repasses.All((VendedorParcela x) => x.Parcela == null)) + { + if (((DomainBase)SelectedDocumento).Id > 0) + { + ObservableCollection parcelas = Parcelas; + if (parcelas != null && parcelas.Count > 0) + { + goto IL_00da; + } + } + if (SelectedDocumento.Tipo == 1) + { + goto IL_00da; + } + } + decimal value = Repasses.Where(delegate(VendedorParcela x) + { + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_000c: Invalid comparison between Unknown and I4 + //IL_0047: Unknown result type (might be due to invalid IL or missing references) + //IL_004d: Invalid comparison between Unknown and I4 + if ((int)x.Parcela.SubTipo == 1) + { + decimal? porcentagemRepasse = x.PorcentagemRepasse; + decimal num = 100; + if (!((porcentagemRepasse.GetValueOrDefault() == num) & porcentagemRepasse.HasValue)) + { + return (int)pagamento.Repasse.Forma.GetValueOrDefault() == 1; + } + return false; + } + return false; + }).Sum((VendedorParcela x) => x.ValorRepasse.GetValueOrDefault()) + pagamento.ValorRepasse.GetValueOrDefault(); + decimal value2 = (SelectedDocumento.AdicionalComiss ? (SelectedDocumento.PremioLiquido + SelectedDocumento.PremioAdicional) : SelectedDocumento.PremioLiquido) * SelectedDocumento.Comissao * 0.01m; + if (Recursos.Configuracoes.All((ConfiguracaoSistema x) => (int)x.Configuracao != 15) && Math.Abs(value) > Math.Abs(value2) + Tolerancia) + { + list.Add(new KeyValuePair("ValorRepasse|VALOR DO REPASSE", "O TOTAL DE COMISSÃO PAGA NÃO PODE SER SUPERIOR A COMISSÃO PREVISTA PARA RECEBIMENTO.")); + } + if (Repasses.Where((VendedorParcela vendedorParcela) => vendedorParcela.Repasse != null && (int)vendedorParcela.Repasse.Tipo.GetValueOrDefault() != 3).Any((VendedorParcela x) => ((DomainBase)x.TipoVendedor).Id == ((DomainBase)pagamento.TipoVendedor).Id && !x.Vendedor.Corretora && (int)x.Parcela.SubTipo == 1)) + { + list.Add(new KeyValuePair("TipoVendedor|TIPO VENDEDOR", "JÁ EXISTE UM VENDEDOR DO TIPO " + pagamento.TipoVendedor.Descricao + " ADICIONADO AO DOCUMENTO.")); + } + if (Repasses.Any((VendedorParcela x) => ((DomainBase)x.Vendedor).Id == ((DomainBase)pagamento.Vendedor).Id && (int)x.Parcela.SubTipo == 1)) + { + list.Add(new KeyValuePair("Nome|VENDEDOR", "VENDEDOR " + pagamento.Vendedor.Nome + " JÁ ADICIONADO AO DOCUMENTO.")); + } + } + long id = ((DomainBase)pagamento.Vendedor).Id; + Repasse repasse = pagamento.Repasse; + if (id != ((repasse != null) ? new long?(((DomainBase)repasse.Vendedor).Id) : null)) + { + list.Add(new KeyValuePair("ValorRepasse|VALOR DO REPASSE", "PERCENTUAL DE REPASSE DEVE SER SELECIONADO")); + } + return list; + IL_00da: + list.Add(new KeyValuePair("|PARCELA", "PARCELA DEVE SER SELECIONADA PARA A INCLUSÃO DO VENDEDOR.")); + return list; + } + + public List> ValidateEspecial(VendedorParcela pagamento) + { + //IL_0231: Unknown result type (might be due to invalid IL or missing references) + //IL_0237: Invalid comparison between Unknown and I4 + List> list = new List>(); + if (SelectedParcela == null) + { + list.Add(new KeyValuePair("SelectedParcela|PARCELA", "PARCELA DEVE SER SELECIONADA PARA A INCLUSÃO DO VENDEDOR.")); + return list; + } + if (Repasses == null) + { + Repasses = new List(); + } + decimal? num = Repasses.Where((VendedorParcela x) => ((DomainBase)x.Parcela).Id == ((DomainBase)pagamento.Parcela).Id).Sum((VendedorParcela x) => x.ValorRepasse) + pagamento.ValorRepasse; + decimal valor = SelectedParcela.Valor; + decimal value = (SelectedParcela.DataRecebimento.HasValue ? SelectedParcela.ValorComDesconto : (valor * SelectedParcela.Comissao * 0.01m)); + if (Recursos.Configuracoes.All((ConfiguracaoSistema x) => (int)x.Configuracao != 15) && num.HasValue && Math.Abs(num.Value) > Math.Abs(value) + Tolerancia) + { + list.Add(new KeyValuePair("SelectedParcela|VALOR DO REPASSE", "O TOTAL DE COMISSÃO PAGA NÃO PODE SER SUPERIOR A COMISSÃO PREVISTA PARA RECEBIMENTO.")); + } + if (pagamento.Parcela == null) + { + if (Repasses.Any((VendedorParcela x) => ((DomainBase)x.TipoVendedor).Id == ((DomainBase)pagamento.TipoVendedor).Id && !x.Vendedor.Corretora)) + { + list.Add(new KeyValuePair("TipoVendedor|TIPO VENDEDOR", "JÁ EXISTE UM VENDEDOR DO TIPO " + pagamento.TipoVendedor.Descricao + " ADICIONADO AO DOCUMENTO.")); + } + if (Repasses.Any((VendedorParcela x) => ((DomainBase)x.Vendedor).Id == ((DomainBase)pagamento.Vendedor).Id)) + { + list.Add(new KeyValuePair("Nome|VENDEDOR", "VENDEDOR " + pagamento.Vendedor.Nome + " JÁ ADICIONADO AO DOCUMENTO")); + } + return list; + } + if ((int)pagamento.Parcela.SubTipo == 1) + { + if (Repasses.Any(delegate(VendedorParcela x) + { + long id = ((DomainBase)x.TipoVendedor).Id; + TipoVendedor tipoVendedor = pagamento.TipoVendedor; + return id == ((tipoVendedor != null) ? new long?(((DomainBase)tipoVendedor).Id) : null) && !x.Vendedor.Corretora && ((DomainBase)x.Parcela).Id == ((DomainBase)pagamento.Parcela).Id; + })) + { + list.Add(new KeyValuePair("TipoVendedor|TIPO VENDEDOR", "JÁ EXISTE UM VENDEDOR DO TIPO " + pagamento.TipoVendedor.Descricao + " ADICIONADO AO DOCUMENTO.")); + } + if (Repasses.Any((VendedorParcela x) => ((DomainBase)x.Vendedor).Id == ((DomainBase)pagamento.Vendedor).Id && ((DomainBase)x.Parcela).Id == ((DomainBase)pagamento.Parcela).Id)) + { + list.Add(new KeyValuePair("Nome|VENDEDOR", "VENDEDOR " + pagamento.Vendedor.Nome + " JÁ ADICIONADO AO DOCUMENTO")); + } + return list; + } + if (Repasses.Any((VendedorParcela x) => ((DomainBase)x.Parcela).Id == ((DomainBase)pagamento.Parcela).Id && ((DomainBase)x.TipoVendedor).Id == ((DomainBase)pagamento.TipoVendedor).Id && !x.Vendedor.Corretora)) + { + list.Add(new KeyValuePair("TipoVendedor|TIPO VENDEDOR", "JÁ EXISTE UM VENDEDOR DO TIPO " + pagamento.TipoVendedor.Descricao + " ADICIONADO A PARCELA.")); + } + if (Repasses.Any((VendedorParcela x) => ((DomainBase)x.Parcela).Id == ((DomainBase)pagamento.Parcela).Id && ((DomainBase)x.Vendedor).Id == ((DomainBase)pagamento.Vendedor).Id)) + { + list.Add(new KeyValuePair("Nome|VENDEDOR", "VENDEDOR " + pagamento.Vendedor.Nome + " JÁ ADICIONADO A PARCELA")); + } + return list; + } + + public List> HabilitarVendedor(int editarParcelaTipo = 0) + { + List> list = new List>(); + if (editarParcelaTipo == 4) + { + if (SelectedParcela != null) + { + Parcela selectedParcela = SelectedParcela; + list.AddRange((selectedParcela != null) ? selectedParcela.Validate(Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 9), Recursos.Configuracoes.Any((ConfiguracaoSistema y) => (int)y.Configuracao == 11), EditandoParcela, Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 16)) : null); + } + } + else + { + list.AddRange(SelectedDocumento.Validate(IsEndosso, Recursos.Configuracoes.Any((ConfiguracaoSistema c) => (int)c.Configuracao == 11))); + } + return list; + } + + public async Task ExcluirVendedor(VendedorParcela pagamento, bool incluirCorretora = true) + { + if (IsEndosso && ((DomainBase)SelectedDocumento).Id == 0L) + { + RemoverVendedor(((DomainBase)pagamento.Vendedor).Id); + ToggleSnackBar("VENDEDOR EXCLUÍDO COM SUCESSO"); + return; + } + if (!AllowEditApolice && !IsFatura && (int)SelectedParcela.SubTipo == 1) + { + await ShowMessage("O VENDEDOR " + pagamento.Vendedor.Nome.ToUpper() + " NÃO PODE SER EXCLUÍDO." + Environment.NewLine + "JÁ EXISTEM RECEBIMENTOS OU PAGAMENTOS DE COMISSÃO PARA ESSE DOCUMENTO."); + return; + } + if (((DomainBase)SelectedDocumento).Id > 0 && (IsFatura || (int)SelectedParcela.SubTipo != 1) && ((((DomainBase)SelectedParcela).Id > 0 && SelectedParcela.DataRecebimento.HasValue) || Repasses.Any((VendedorParcela x) => ((DomainBase)x.Parcela).Id == ((DomainBase)SelectedParcela).Id && x.DataPagamento.HasValue))) + { + await ShowMessage("O VENDEDOR " + pagamento.Vendedor.Nome.ToUpper() + " NÃO PODE SER EXCLUÍDO." + Environment.NewLine + "JÁ EXISTEM RECEBIMENTOS OU PAGAMENTOS DE COMISSÃO PARA ESSA FATURA."); + return; + } + if (((DomainBase)SelectedDocumento).Id == 0L) + { + RemoverVendedor(((DomainBase)pagamento.Vendedor).Id); + ToggleSnackBar("VENDEDOR EXCLUÍDO COM SUCESSO"); + return; + } + List source = (((int)SelectedParcela.SubTipo == 1 && !IsFatura) ? Repasses.Where((VendedorParcela x) => ((DomainBase)x.Vendedor).Id == ((DomainBase)pagamento.Vendedor).Id && x.Parcela.NumeroParcela != 999).ToList() : Repasses.Where((VendedorParcela x) => ((DomainBase)x.Vendedor).Id == ((DomainBase)pagamento.Vendedor).Id && ((DomainBase)x.Parcela).Id == ((DomainBase)SelectedParcela).Id).ToList()); + List vendedores = source.Distinct().ToList(); + if (!(await Servico.ExcluirPagamento(vendedores))) + { + await SelecionaParcela(SelectedParcela ?? Parcelas.FirstOrDefault()); + return; + } + if (((DomainBase)SelectedParcela).Id > 0) + { + string tipodoc = ((SelectedDocumento.Tipo == 0 && string.IsNullOrEmpty(SelectedDocumento.Apolice)) ? ("NA PROPOSTA \"" + SelectedDocumento.Proposta + "\"") : ((SelectedDocumento.Tipo == 0 && !string.IsNullOrEmpty(SelectedDocumento.Apolice)) ? ("NA APÓLICE \"" + SelectedDocumento.Apolice + "\"") : (string.IsNullOrEmpty(SelectedDocumento.Endosso) ? ("NA PROPOSTA DE ENDOSSO \"" + SelectedDocumento.PropostaEndosso + "\"") : ("NO ENDOSSO \"" + SelectedDocumento.Endosso + "\"")))); + vendedores.ForEach(delegate(VendedorParcela x) + { + string descricao = "VENDEDOR " + x.Vendedor.Nome + " EXCLUÍDO, " + tipodoc; + RegistrarAcao(descricao, ((DomainBase)x).Id, (TipoTela)37, $"{GerarObs(SelectedDocumento)}{Environment.NewLine}VENDEDOR: {x.Vendedor.Nome}{Environment.NewLine}COMISSÃO TOTAL: {x.ValorTotal:C2}"); + }); + } + RemoverVendedor(((DomainBase)pagamento.Vendedor).Id); + bool flag = ((IsFatura || (int)SelectedParcela.SubTipo != 1) ? Repasses.Any((VendedorParcela x) => ((DomainBase)x.Parcela).Id == ((DomainBase)SelectedParcela).Id && ((DomainBase)x.TipoVendedor).Id == 1) : Repasses.Any((VendedorParcela x) => (int)x.Parcela.SubTipo == 1 && ((DomainBase)x.TipoVendedor).Id == 1 && !x.CoCorretagem)); + if (((DomainBase)pagamento.TipoVendedor).Id == 1 && incluirCorretora && !flag) + { + VendedorParcela val = await IncluirPropriaCorretora(); + if (val != null) + { + Repasses.Add(val); + Documento selectedDocumento = SelectedDocumento; + VendedorParcela? obj = ((IEnumerable)Repasses).FirstOrDefault((Func)((VendedorParcela x) => ((DomainBase)x.TipoVendedor).Id == 1)); + selectedDocumento.VendedorPrincipal = ((obj != null) ? obj.Vendedor : null); + } + } + if (Repasses != null) + { + Pagamentos = new ObservableCollection(Repasses.Where((VendedorParcela x) => ((DomainBase)x.Parcela).Id == ((DomainBase)SelectedParcela).Id).ToList()); + } + ToggleSnackBar("VENDEDOR EXCLUÍDO COM SUCESSO"); + CalculaComissao(SelectedDocumento, Parcelas); + } + + private void RemoverVendedor(long id) + { + //IL_0027: Unknown result type (might be due to invalid IL or missing references) + //IL_002d: Invalid comparison between Unknown and I4 + //IL_0095: Unknown result type (might be due to invalid IL or missing references) + //IL_009b: Invalid comparison between Unknown and I4 + ((((DomainBase)SelectedDocumento).Id == 0L || ((int)SelectedParcela.SubTipo == 1 && !IsFatura)) ? Repasses.Where((VendedorParcela x) => ((DomainBase)x.Vendedor).Id == id).ToList() : Repasses.Where((VendedorParcela x) => ((DomainBase)x.Vendedor).Id == id && ((DomainBase)x.Parcela).Id == ((DomainBase)SelectedParcela).Id).ToList()).ForEach(delegate(VendedorParcela x) + { + Repasses.Remove(x); + }); + ((((DomainBase)SelectedDocumento).Id == 0L || ((int)SelectedParcela.SubTipo == 1 && !IsFatura)) ? Pagamentos.Where((VendedorParcela x) => ((DomainBase)x.Vendedor).Id == id).ToList() : Pagamentos.Where(delegate(VendedorParcela x) + { + if (((DomainBase)x.Vendedor).Id == id) + { + Parcela parcela = x.Parcela; + return ((parcela != null) ? ((DomainBase)parcela).Id : 0) == ((DomainBase)SelectedParcela).Id; + } + return false; + }).ToList()).ForEach(delegate(VendedorParcela x) + { + Pagamentos.Remove(x); + }); + } + + private async Task IncluirPropriaCorretora() + { + if (Parcelas.Count == 0) + { + return null; + } + VendedorParcela val = PropriaCorretora(); + Parcela val3 = (val.Parcela = (Parcela)(((int)SelectedParcela.SubTipo == 1 && !IsFatura) ? ((object)((IEnumerable)Parcelas).FirstOrDefault((Func)((Parcela x) => x.NumeroParcela == 1))) : ((object)SelectedParcela))); + val.Documento = SelectedDocumento; + if (val3 != null && ((DomainBase)val3).Id == 0L) + { + return val; + } + return await Servico.IncluirVendedor(val); + } + + public async Task CancelarAlteracao() + { + Acesso = (AcessoApolice)0; + if (CancelDocumento != null && ((DomainBase)CancelDocumento).Id != 0L) + { + await SelecionaDocumento(CancelDocumento); + } + else + { + SelectedDocumento = null; + } + Anotacoes = string.Empty; + base.EnableFields = false; + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: true); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: true); + Gestor.Application.Actions.Actions.EnablePesquisarClientes?.Invoke(obj: true); + } + + public async Task AlterarVencimento() + { + if (SelectedParcela == null) + { + return; + } + Loading(isLoading: true); + bool flag = (int)SelectedParcela.SubTipo == 1 && !IsFatura && (decimal)SelectedParcela.NumeroParcela < SelectedDocumento.NumeroParcelas; + if (flag) + { + flag = await ShowMessage("DESEJA ALTERAR O VENCIMENTO PARA AS PRÓXIMAS PARCELAS?", "SIM", "NÃO"); + } + bool alterarDemais = flag; + if ((int)SelectedParcela.SubTipo == 1 && !IsFatura) + { + DateTime vencimento = SelectedParcela.Vencimento; + decimal valor = SelectedDocumento.PremioTotal - Parcelas.Where((Parcela x) => (int)x.SubTipo == 1 && ((DomainBase)x).Id != ((DomainBase)SelectedParcela).Id).Sum((Parcela x) => x.Valor); + decimal num = SelectedDocumento.PremioTotal - Parcelas.Where((Parcela x) => (int)x.SubTipo == 1 && ((DomainBase)x).Id < ((DomainBase)SelectedParcela).Id).Sum((Parcela x) => x.Valor); + num -= SelectedParcela.Valor; + decimal num2 = SelectedDocumento.NumeroParcelas - (decimal)SelectedParcela.NumeroParcela; + if (num2 == 0m) + { + num2 = 1m; + } + decimal valorDemais = ((num2 > 0m) ? (num / num2) : 0m); + if (valorDemais == 0m) + { + SelectedParcela.Valor = valor; + } + List parcelas = new List { SelectedParcela }; + decimal num3 = Math.Abs(valorDemais); + decimal? tolerancia = SelectedDocumento.Controle.Seguradora.Tolerancia; + if (((num3 > tolerancia.GetValueOrDefault()) & tolerancia.HasValue) && !Parcelas.Any((Parcela x) => (int)x.SubTipo == 1 && x.NumeroParcela > SelectedParcela.NumeroParcela)) + { + SelectedParcela.Valor = valor; + } + Parcelas.Where((Parcela x) => (int)x.SubTipo == 1 && x.NumeroParcela != SelectedParcela.NumeroParcela).ToList().ForEach(delegate(Parcela x) + { + if (x.NumeroParcela > SelectedParcela.NumeroParcela) + { + if (alterarDemais) + { + vencimento = vencimento.AddMonths(1); + if (SelectedDocumento.Vigencia2.HasValue) + { + DateTime value = vencimento; + DateTime? vigencia = SelectedDocumento.Vigencia2; + if (!(value < vigencia) && !Recursos.Configuracoes.Any((ConfiguracaoSistema c) => (int)c.Configuracao == 11)) + { + goto IL_00d0; + } + } + x.Vencimento = vencimento; + } + goto IL_00d0; + } + goto IL_012b; + IL_012b: + parcelas.Add(x); + return; + IL_00d0: + x.Valor = ((valorDemais > 0m) ? valorDemais : x.Valor); + x.Comissao = ((x.Comissao == 0m) ? SelectedDocumento.Comissao : x.Comissao); + goto IL_012b; + }); + Repasses?.ForEach(delegate(VendedorParcela x) + { + //IL_00c8: Unknown result type (might be due to invalid IL or missing references) + //IL_00ce: Invalid comparison between Unknown and I4 + if (!x.CoCorretagem && x.Repasse != null && x.Parcela != null && (((DomainBase)x.Parcela).Id == ((DomainBase)SelectedParcela).Id || alterarDemais) && !x.DataPagamento.HasValue) + { + Parcela val = ((IEnumerable)parcelas).FirstOrDefault((Func)((Parcela y) => ((DomainBase)y).Id == ((DomainBase)x.Parcela).Id)); + x.Parcela = ((val != null) ? val : x.Parcela); + if ((int)x.Repasse.Base.GetValueOrDefault() == 3 && val != null) + { + x.DataPrePagamento = ((x.Parcela.Vencimento == DateTime.MinValue) ? SelectedDocumento.Vigencia1 : x.Parcela.Vencimento); + } + } + }); + foreach (Parcela x2 in parcelas) + { + if (x2.NumeroParcela >= SelectedParcela.NumeroParcela) + { + x2.Documento = SelectedDocumento; + if (((DomainBase)x2).Id != ((DomainBase)SelectedParcela).Id) + { + x2.Valor = valorDemais; + } + } + List auxRepasse = Repasses?.Where((VendedorParcela y) => ((DomainBase)y.Parcela).Id == ((DomainBase)x2).Id).ToList(); + ObservableCollection source = await ParcelaServico.BuscarParcelasAsync(((DomainBase)SelectedDocumento).Id); + if (auxRepasse == null && auxRepasse.Count <= 0) + { + await ParcelaServico.Save(x2, source.ToList()); + } + else + { + await ParcelaServico.Save(x2, source.ToList(), auxRepasse); + } + string text = ((SelectedDocumento.Tipo == 0 && string.IsNullOrEmpty(SelectedDocumento.Apolice)) ? ("PROPOSTA " + SelectedDocumento.Proposta) : ((SelectedDocumento.Tipo == 0 && !string.IsNullOrEmpty(SelectedDocumento.Apolice)) ? ("APÓLICE " + SelectedDocumento.Apolice) : (string.IsNullOrEmpty(SelectedDocumento.Endosso) ? ("PROPOSTA DE ENDOSSO " + SelectedDocumento.PropostaEndosso) : ("ENDOSSO " + SelectedDocumento.Endosso)))); + string descricao = (((int)SelectedDocumento.TipoRecebimento.GetValueOrDefault() == 1) ? $"PARCELA {x2.NumeroParcela} ALTERADA, {text}" : ("FATURA " + x2.Fatura + " ALTERADA, " + text)); + RegistrarAcao(descricao, ((DomainBase)x2).Id, (TipoTela)5, GerarObs(SelectedDocumento)); + if (!ParcelaServico.Sucesso && x2.NumeroParcela >= SelectedParcela.NumeroParcela) + { + await CarregarParcelas(SelectedDocumento); + Loading(isLoading: false); + return; + } + } + } + else + { + SelectedParcela.Documento = SelectedDocumento; + Repasses?.ForEach(delegate(VendedorParcela x) + { + //IL_0057: Unknown result type (might be due to invalid IL or missing references) + //IL_005d: Invalid comparison between Unknown and I4 + //IL_008f: Unknown result type (might be due to invalid IL or missing references) + //IL_0094: Unknown result type (might be due to invalid IL or missing references) + //IL_0095: Unknown result type (might be due to invalid IL or missing references) + //IL_0097: Unknown result type (might be due to invalid IL or missing references) + //IL_00b1: Expected I4, but got Unknown + //IL_0107: Unknown result type (might be due to invalid IL or missing references) + //IL_010d: Invalid comparison between Unknown and I4 + //IL_0163: Unknown result type (might be due to invalid IL or missing references) + //IL_0169: Invalid comparison between Unknown and I4 + //IL_01a3: Unknown result type (might be due to invalid IL or missing references) + //IL_01a9: Invalid comparison between Unknown and I4 + if (!x.CoCorretagem && x.Repasse != null && x.Parcela != null && ((DomainBase)x.Parcela).Id == ((DomainBase)SelectedParcela).Id && !x.DataPagamento.HasValue) + { + if ((int)x.Repasse.Forma.GetValueOrDefault() == 1) + { + x.DataPrePagamento = SelectedParcela.DataRecebimento; + } + BaseRepasse? @base = x.Repasse.Base; + if (@base.HasValue) + { + BaseRepasse valueOrDefault = @base.GetValueOrDefault(); + switch (valueOrDefault - 1) + { + case 2: + x.DataPrePagamento = ((x.Parcela.Vencimento == DateTime.MinValue) ? SelectedDocumento.Vigencia1 : x.Parcela.Vencimento); + break; + case 0: + x.DataPrePagamento = (((int)SelectedDocumento.TipoRecebimento.GetValueOrDefault() == 2) ? SelectedParcela.VigenciaIncial : new DateTime?(SelectedDocumento.Vigencia1)); + break; + case 1: + x.DataPrePagamento = x.Parcela.DataCriacao; + break; + case 3: + x.DataPrePagamento = (((int)SelectedDocumento.TipoRecebimento.GetValueOrDefault() == 2) ? x.Parcela.Emissao : SelectedDocumento.Emissao); + break; + case 4: + x.DataPrePagamento = (((int)SelectedDocumento.TipoRecebimento.GetValueOrDefault() == 2) ? x.Parcela.Emissao : SelectedDocumento.Remessa); + break; + } + } + } + }); + ObservableCollection source2 = await ParcelaServico.BuscarParcelasAsync(((DomainBase)SelectedDocumento).Id); + SelectedParcela = await ParcelaServico.Save(SelectedParcela, source2.ToList(), Repasses?.Where((VendedorParcela x) => ((DomainBase)x.Parcela).Id == ((DomainBase)SelectedParcela).Id).ToList()); + if (!ParcelaServico.Sucesso) + { + await CarregarParcelas(SelectedDocumento); + Loading(isLoading: false); + return; + } + } + ToggleSnackBar("PARCELAS ALTERADAS COM SUCESSO"); + await CarregarParcelas(SelectedDocumento); + Loading(isLoading: false); + } + + public async Task AdicionarParcelaEspecial() + { + if (SelectedParcela == null || CriandoParcelaEspecial) + { + return; + } + CriandoParcelaEspecial = true; + if (SelectedPagamento == null || SelectedPagamento.Vendedor.Corretora) + { + SelectedPagamento = PropriaCorretora(); + } + else + { + List> list = await AdicionarVendedorParcelaEspecial(); + if (list.Count > 0) + { + _criandoParcelaEspecial = false; + await ShowMessage(list, " PROCESSO INTERROMPIDO, PARCELA/FATURA SEM VENDENDEDOR", "OK"); + return; + } + } + SelectedParcela.Documento = SelectedDocumento; + DateTime vencimento = SelectedParcela.Vencimento; + DateTime? recebimento = SelectedParcela.DataRecebimento; + DateTime? credito = SelectedParcela.DataCredito; + DateTime? controle = SelectedParcela.DataControle; + int numeroParcela = SelectedParcela.NumeroParcela; + DateTime? vigencia1 = SelectedParcela.VigenciaIncial; + DateTime? vigencia2 = SelectedParcela.VigenciaFinal; + DateTime? emissao = SelectedParcela.Emissao; + long result; + long fatura = (long.TryParse(string.IsNullOrWhiteSpace(ValidationHelper.OnlyNumber(SelectedParcela.Fatura)) ? "1" : ValidationHelper.OnlyNumber(SelectedParcela.Fatura), out result) ? result : 1); + if (QuantidadeFaturas == 0 || !IsFatura) + { + QuantidadeFaturas = 1; + } + if (QuantidadeFaturas > 12) + { + CriandoParcelaEspecial = false; + await ShowMessage("NÃO É POSSIVEL REPLICAR MAIS QUE 12 VEZES A MESMA FATURA. PROCESSO CANCELADO"); + return; + } + for (int i = 0; i < QuantidadeFaturas; i++) + { + SelectedParcela.Vencimento = vencimento.AddMonths(i); + SelectedParcela.VigenciaIncial = vigencia1?.AddMonths(i); + SelectedParcela.VigenciaFinal = vigencia2?.AddMonths(i); + SelectedParcela.Emissao = emissao?.AddMonths(i); + SelectedParcela.DataRecebimento = recebimento?.AddMonths(i); + SelectedParcela.DataCredito = credito?.AddMonths(i); + SelectedParcela.DataControle = controle?.AddMonths(i); + SelectedParcela.NumeroParcela = numeroParcela + i; + if (i > 0) + { + fatura++; + SelectedParcela.Fatura = $"{fatura}"; + SelectedParcela.DataQuitacao = null; + } + Repasses?.ForEach(delegate(VendedorParcela x) + { + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + //IL_001d: Invalid comparison between Unknown and I4 + //IL_0056: Unknown result type (might be due to invalid IL or missing references) + //IL_005b: Unknown result type (might be due to invalid IL or missing references) + //IL_005c: Unknown result type (might be due to invalid IL or missing references) + //IL_005e: Unknown result type (might be due to invalid IL or missing references) + //IL_0078: Expected I4, but got Unknown + //IL_00c3: Unknown result type (might be due to invalid IL or missing references) + //IL_00c9: Invalid comparison between Unknown and I4 + //IL_010f: Unknown result type (might be due to invalid IL or missing references) + //IL_0115: Invalid comparison between Unknown and I4 + //IL_0144: Unknown result type (might be due to invalid IL or missing references) + //IL_014a: Invalid comparison between Unknown and I4 + if (x.Repasse != null) + { + if ((int)x.Repasse.Forma.GetValueOrDefault() == 1) + { + x.DataPrePagamento = SelectedParcela.DataRecebimento; + } + x.Parcela = SelectedParcela; + BaseRepasse? @base = x.Repasse.Base; + if (@base.HasValue) + { + BaseRepasse valueOrDefault = @base.GetValueOrDefault(); + switch (valueOrDefault - 1) + { + case 2: + x.DataPrePagamento = ((x.Parcela.Vencimento == DateTime.MinValue) ? SelectedDocumento.Vigencia1 : x.Parcela.Vencimento); + break; + case 0: + x.DataPrePagamento = (((int)SelectedDocumento.TipoRecebimento.GetValueOrDefault() == 2) ? x.Parcela.VigenciaIncial : new DateTime?(SelectedDocumento.Vigencia1)); + break; + case 1: + x.DataPrePagamento = x.Parcela.DataCriacao; + break; + case 3: + x.DataPrePagamento = (((int)SelectedDocumento.TipoRecebimento.GetValueOrDefault() == 2) ? x.Parcela.Emissao : SelectedDocumento.Emissao); + break; + case 4: + x.DataPrePagamento = (((int)SelectedDocumento.TipoRecebimento.GetValueOrDefault() == 2) ? x.Parcela.Emissao : SelectedDocumento.Remessa); + break; + } + } + } + }); + if (Repasses == null) + { + Repasses = new List { PropriaCorretora() }; + } + if (Repasses.All((VendedorParcela x) => ((DomainBase)x.TipoVendedor).Id != 1)) + { + Repasses.Add(PropriaCorretora()); + } + Parcela selectedParcela = await ParcelaServico.Save(SelectedParcela, Parcelas.ToList(), Repasses); + if (i == QuantidadeFaturas - 1) + { + SelectedParcela = selectedParcela; + } + } + QuantidadeFaturas = 0; + string text = ((SelectedDocumento.Tipo == 0 && string.IsNullOrEmpty(SelectedDocumento.Apolice)) ? ("NA PROPOSTA \"" + SelectedDocumento.Proposta + "\"") : ((SelectedDocumento.Tipo == 0 && !string.IsNullOrEmpty(SelectedDocumento.Apolice)) ? ("NA APÓLICE \"" + SelectedDocumento.Apolice + "\"") : (string.IsNullOrEmpty(SelectedDocumento.Endosso) ? ("NA PROPOSTA DE ENDOSSO \"" + SelectedDocumento.PropostaEndosso + "\"") : ("NO ENDOSSO \"" + SelectedDocumento.Endosso + "\"")))); + string descricao = (((int)SelectedDocumento.TipoRecebimento.GetValueOrDefault() == 1) ? ("PARCELA ESPECIAL ADICIONADA, " + text) : ("FATURA " + SelectedParcela.Fatura + " ADICIONADA, " + text)); + RegistrarAcao(descricao, ((DomainBase)SelectedParcela).Id, (TipoTela)5, GerarObs(SelectedDocumento)); + if (ParcelaServico.Sucesso) + { + ToggleSnackBar(((int)SelectedDocumento.TipoRecebimento.GetValueOrDefault() == 1) ? "PARCELA ESPECIAL ADICIONADA COM SUCESSO" : "FATURA ADICIONADA COM SUCESSO"); + } + await CarregarParcelas(SelectedDocumento); + await CarregaRepasse(((DomainBase)SelectedDocumento).Id); + await SelecionaParcela(SelectedParcela ?? Parcelas.FirstOrDefault()); + CalculaComissao(SelectedDocumento, Parcelas); + BaixarParcelas = false; + CriandoParcelaEspecial = false; + } + + public void EditarParcelaEspecial() + { + AllowEditVendedor = true; + } + + public async Task>> AdicionarVendedorParcelaEspecial() + { + List> list = new List>(); + if (SelectedPagamento == null) + { + list.Add(new KeyValuePair("SelectedPagamento|PAGAMENTO", "ERRO AO INCLUIR VENDEDOR.")); + return list; + } + if (SelectedPagamento.Repasse == null) + { + list.Add(new KeyValuePair("Repasse|REPASSE", "ERRO AO INCLUIR VENDEDOR.")); + return list; + } + SelectedPagamento.Parcela = SelectedParcela; + if ((int)SelectedDocumento.TipoRecebimento.GetValueOrDefault() == 2 && (int)SelectedPagamento.Repasse.Forma.GetValueOrDefault() == 3) + { + ShowMessage("NÃO É POSSÍVEL ADICIONAR UM VENDEDOR COM A FORMA DE PAGAMENTO À PRAZO EM DOCUMENTOS DO TIPO FATURA"); + return null; + } + Repasse repasse = SelectedPagamento.Repasse; + List vinculo = ((repasse == null) ? null : repasse.Vinculo?.Where((VinculoRepasse x) => ((DomainBase)x.TipoVendedor).Id == ((DomainBase)SelectedPagamento.TipoVendedor).Id).ToList()); + List pagamentos = new List { SelectedPagamento }; + bool renovacao = (SelectedDocumento.NegocioCorretora.HasValue ? ((int)SelectedDocumento.NegocioCorretora.GetValueOrDefault() == 1) : ((int)SelectedDocumento.Situacao == 2 && SelectedDocumento.Negocio.HasValue && (int)SelectedDocumento.Negocio.GetValueOrDefault() == 1)); + bool flag = vinculo != null && vinculo.Count > 0; + if (flag) + { + flag = await ShowMessage("DESEJA ADICIONAR OS REPASSES VINCULADOS?", "SIM", "NÃO"); + } + if (flag) + { + foreach (VinculoRepasse item2 in vinculo) + { + decimal value = Funcoes.CalculaRepasse(item2.RepasseVinculo, SelectedPagamento.Parcela, SelectedPagamento.Parcela == null || (int)SelectedPagamento.Parcela.SubTipo == 1); + VendedorParcela item = new VendedorParcela + { + TipoVendedor = item2.TipoVendedorVinculo, + Vendedor = item2.RepasseVinculo.Vendedor, + Repasse = item2.RepasseVinculo, + Documento = SelectedPagamento.Documento, + Parcela = SelectedPagamento.Parcela, + PorcentagemRepasse = (renovacao ? item2.RepasseVinculo.ValorRenovacao : item2.RepasseVinculo.ValorNovo), + ValorRepasse = value, + ValorTotal = value + }; + pagamentos.Add(item); + } + } + foreach (VendedorParcela item3 in pagamentos) + { + VendedorParcela val = item3; + list = val.Validate(); + list.AddRange(ValidateEspecial(val)); + if (list.Count > 0) + { + if (SelectedPagamento == null) + { + SelectedPagamento = val; + } + return list; + } + if (val.Repasse != null) + { + switch (val.Repasse.Base) + { + case 2L: + val.DataPrePagamento = ((val.Parcela.Vencimento == DateTime.MinValue) ? SelectedDocumento.Vigencia1 : val.Parcela.Vencimento); + break; + case 0L: + val.DataPrePagamento = (((int)SelectedDocumento.TipoRecebimento.GetValueOrDefault() == 2) ? val.Parcela.VigenciaIncial : new DateTime?(SelectedDocumento.Vigencia1)); + break; + case 1L: + val.DataPrePagamento = val.Parcela.DataCriacao; + break; + case 3L: + val.DataPrePagamento = (((int)SelectedDocumento.TipoRecebimento.GetValueOrDefault() == 2) ? val.Parcela.Emissao : SelectedDocumento.Emissao); + break; + case 4L: + val.DataPrePagamento = (((int)SelectedDocumento.TipoRecebimento.GetValueOrDefault() == 2) ? val.Parcela.Emissao : SelectedDocumento.Remessa); + break; + } + } + if (Pagamentos == null) + { + Pagamentos = new ObservableCollection(); + } + VendedorParcela corretora = ((IEnumerable)Repasses).FirstOrDefault((Func)((VendedorParcela x) => ((DomainBase)x.Parcela).Id == ((DomainBase)SelectedParcela).Id && ((DomainBase)x.TipoVendedor).Id == 1 && x.Vendedor.Corretora)); + bool excluirCorretora = ((DomainBase)val.TipoVendedor).Id == 1 && corretora != null; + if (((DomainBase)SelectedParcela).Id == 0L) + { + Repasses.Add(val); + Pagamentos.Add(val); + SelectedPagamento = null; + if ((IsFatura || (int)SelectedParcela.SubTipo != 1) && excluirCorretora) + { + await ExcluirVendedor(corretora, incluirCorretora: false); + } + continue; + } + if ((int)val.Repasse.Forma.GetValueOrDefault() == 1) + { + val.DataPrePagamento = SelectedParcela.DataRecebimento; + } + List repasses = new List { val }; + repasses = await Servico.IncluirVendedores(repasses); + string tipodoc = ((SelectedDocumento.Tipo == 0 && string.IsNullOrEmpty(SelectedDocumento.Apolice)) ? ("NA PROPOSTA \"" + SelectedDocumento.Proposta + "\"") : ((SelectedDocumento.Tipo == 0 && !string.IsNullOrEmpty(SelectedDocumento.Apolice)) ? ("NA APÓLICE \"" + SelectedDocumento.Apolice + "\"") : (string.IsNullOrEmpty(SelectedDocumento.Endosso) ? ("NA PROPOSTA DE ENDOSSO \"" + SelectedDocumento.PropostaEndosso + "\"") : ("NO ENDOSSO \"" + SelectedDocumento.Endosso + "\"")))); + repasses?.ForEach(delegate(VendedorParcela x) + { + string descricao = "VENDEDOR " + x.Vendedor.Nome + " ADICIONADO A PARCELA ESPECIAL, " + tipodoc; + RegistrarAcao(descricao, ((DomainBase)x).Id, (TipoTela)37, $"{GerarObs(SelectedDocumento)}{Environment.NewLine}VENDEDOR: {x.Vendedor.Nome}{Environment.NewLine}COMISSÃO TOTAL: {x.ValorTotal:C2}"); + }); + Repasses.AddRange(repasses); + if (excluirCorretora) + { + await ExcluirVendedor(corretora, incluirCorretora: false); + } + Repasses = await VendedorServico.BuscaRepasse(((DomainBase)SelectedDocumento).Id); + await SelecionaParcela(SelectedParcela ?? Parcelas.FirstOrDefault()); + SelectedPagamento = null; + } + ToggleSnackBar("VENDEDOR ADICIONADO COM SUCESSO"); + return null; + } + + internal async Task BaixarComissao() + { + if (SelectedParcela == null) + { + return; + } + Loading(isLoading: true); + int num; + if (IsFatura) + { + Parcela? obj = ((IEnumerable)Parcelas.OrderBy((Parcela x) => x.NumeroParcela)).LastOrDefault((Func)((Parcela x) => (int)x.SubTipo == 1)); + num = ((((obj != null) ? new long?(((DomainBase)obj).Id) : null) == ((DomainBase)SelectedParcela).Id) ? 1 : 0); + } + else + { + num = 0; + } + bool ultimafatura = (byte)num != 0; + SelectedParcela.Documento = SelectedDocumento; + Parcela selectedParcela = SelectedParcela; + List parcelas = Parcelas.ToList(); + List repasses = Repasses; + Documento selectedDocumento = SelectedDocumento; + decimal? obj2; + if (selectedDocumento == null) + { + obj2 = null; + } + else + { + Controle controle = selectedDocumento.Controle; + if (controle == null) + { + obj2 = null; + } + else + { + Seguradora seguradora = controle.Seguradora; + obj2 = ((seguradora != null) ? seguradora.Tolerancia : null); + } + } + SelectedParcela = await Funcoes.BaixarComissao(selectedParcela, parcelas, repasses, obj2 ?? Tolerancia); + Documento selectedDocumento2 = SelectedDocumento; + string text; + if (selectedDocumento2 == null || selectedDocumento2.Tipo != 0 || !string.IsNullOrEmpty(SelectedDocumento.Apolice)) + { + Documento selectedDocumento3 = SelectedDocumento; + if (selectedDocumento3 == null || selectedDocumento3.Tipo != 0 || string.IsNullOrEmpty(SelectedDocumento.Apolice)) + { + Documento selectedDocumento4 = SelectedDocumento; + if (!string.IsNullOrEmpty((selectedDocumento4 != null) ? selectedDocumento4.Endosso : null)) + { + text = "ENDOSSO " + SelectedDocumento.Endosso; + } + else + { + Documento selectedDocumento5 = SelectedDocumento; + text = "PROPOSTA DE ENDOSSO " + ((selectedDocumento5 != null) ? selectedDocumento5.PropostaEndosso : null); + } + } + else + { + text = "APÓLICE " + SelectedDocumento.Apolice; + } + } + else + { + text = "PROPOSTA " + SelectedDocumento.Proposta; + } + string text2 = text; + Documento selectedDocumento6 = SelectedDocumento; + string descricao = ((selectedDocumento6 != null && (int)selectedDocumento6.TipoRecebimento.GetValueOrDefault() == 1) ? $"PARCELA {SelectedParcela.NumeroParcela} BAIXADA, {text2}" : ("FATURA " + SelectedParcela.Fatura + " BAIXADA, " + text2)); + RegistrarAcao(descricao, ((DomainBase)SelectedParcela).Id, (TipoTela)5, GerarObs(SelectedDocumento)); + if (SelectedDocumento != null) + { + await CarregarParcelas(SelectedDocumento); + await CarregaRepasse(((DomainBase)SelectedDocumento).Id); + CalculaComissao(SelectedDocumento, Parcelas); + } + await SelecionaParcela(SelectedParcela ?? Parcelas.FirstOrDefault()); + BaixarParcelas = false; + AllowEditApolice = Parcelas.Where((Parcela x) => (int)x.SubTipo == 1).All((Parcela x) => !x.DataRecebimento.HasValue) && Repasses.Where((VendedorParcela x) => (int)x.Parcela.SubTipo == 1).All((VendedorParcela x) => !x.DataPagamento.HasValue); + Loading(isLoading: false); + bool flag = ultimafatura; + if (flag) + { + flag = await ShowMessage("DESEJA INCLUIR A PRÓXIMA FATURA?", "SIM", "NÃO"); + } + if (flag) + { + UltimaFatura = true; + } + ToggleSnackBar("PARCELA BAIXADA COM SUCESSO"); + } + + internal async Task ExcluirBaixa() + { + if (SelectedParcela != null && await ShowMessage("DESEJA REALMENTE EXCLUIR A BAIXA DA PARCELA SELECIONADA?" + Environment.NewLine + "ESSE PROCEDIMENTO É IRREVERSÍVEL.", "SIM", "NÃO")) + { + Loading(isLoading: true); + SelectedParcela.Documento = SelectedDocumento; + SelectedParcela = await Funcoes.ExcluirBaixa(SelectedParcela, Repasses, Parcelas.ToList()); + string text = ((SelectedDocumento.Tipo == 0 && string.IsNullOrEmpty(SelectedDocumento.Apolice)) ? ("PROPOSTA " + SelectedDocumento.Proposta) : ((SelectedDocumento.Tipo == 0 && !string.IsNullOrEmpty(SelectedDocumento.Apolice)) ? ("APÓLICE " + SelectedDocumento.Apolice) : (string.IsNullOrEmpty(SelectedDocumento.Endosso) ? ("PROPOSTA DE ENDOSSO " + SelectedDocumento.PropostaEndosso) : ("ENDOSSO " + SelectedDocumento.Endosso)))); + string descricao = (((int)SelectedDocumento.TipoRecebimento.GetValueOrDefault() == 1) ? $"BAIXA DA PARCELA {SelectedParcela.NumeroParcela} EXCLUÍDA, {text}" : ("BAIXA DA FATURA " + SelectedParcela.Fatura + " EXCLUÍDA, " + text)); + RegistrarAcao(descricao, ((DomainBase)SelectedParcela).Id, (TipoTela)5, GerarObs(SelectedDocumento)); + await CarregarParcelas(SelectedDocumento); + await CarregaRepasse(((DomainBase)SelectedDocumento).Id); + CalculaComissao(SelectedDocumento, Parcelas); + await SelecionaParcela(SelectedParcela ?? Parcelas.FirstOrDefault()); + BaixarParcelas = false; + AllowEditApolice = Parcelas.Where((Parcela x) => (int)x.SubTipo == 1).All((Parcela x) => !x.DataRecebimento.HasValue) && Repasses.Where((VendedorParcela x) => (int)x.Parcela.SubTipo == 1).All((VendedorParcela x) => !x.DataPagamento.HasValue); + Loading(isLoading: false); + ToggleSnackBar("BAIXA EXCLUÍDA COM SUCESSO"); + } + } + + public async Task ExcluirParcela() + { + if (SelectedParcela == null || ((int)SelectedParcela.SubTipo == 1 && (int)SelectedDocumento.TipoRecebimento.GetValueOrDefault() == 1)) + { + return; + } + if ((int)SelectedParcela.SubTipo == 1) + { + Parcela val = Parcelas.OrderBy((Parcela x) => x.NumeroParcela).Last((Parcela x) => (int)x.SubTipo == 1); + if (((DomainBase)SelectedParcela).Id != ((DomainBase)val).Id) + { + await ShowMessage("A FATURA NÃO PODE SER EXCLUÍDA POIS HÁ FATURAS CADASTRADAS ACIMA DA SELECIONADA."); + return; + } + } + if (await ShowMessage("DESEJA REALMENTE EXCLUIR A PARCELA SELECIONADA?" + Environment.NewLine + "ESSE PROCEDIMENTO É IRREVERSÍVEL.", "SIM", "NÃO")) + { + Loading(isLoading: true); + if (await ParcelaServico.Delete(SelectedParcela, Parcelas.ToList())) + { + ToggleSnackBar(((int)SelectedDocumento.TipoRecebimento.GetValueOrDefault() == 1) ? "PARCELA EXCLUÍDA COM SUCESSO" : "FATURA EXCLUÍDA COM SUCESSO"); + string text = ((SelectedDocumento.Tipo == 0 && string.IsNullOrEmpty(SelectedDocumento.Apolice)) ? ("PROPOSTA " + SelectedDocumento.Proposta) : ((SelectedDocumento.Tipo == 0 && !string.IsNullOrEmpty(SelectedDocumento.Apolice)) ? ("APÓLICE " + SelectedDocumento.Apolice) : (string.IsNullOrEmpty(SelectedDocumento.Endosso) ? ("PROPOSTA DE ENDOSSO " + SelectedDocumento.PropostaEndosso) : ("ENDOSSO " + SelectedDocumento.Endosso)))); + string descricao = (((int)SelectedDocumento.TipoRecebimento.GetValueOrDefault() == 1) ? $"PARCELA {SelectedParcela.NumeroParcela} EXCLUÍDA, {text}" : ("FATURA " + SelectedParcela.Fatura + " EXCLUÍDA, " + text)); + RegistrarAcao(descricao, ((DomainBase)SelectedParcela).Id, (TipoTela)5, GerarObs(SelectedDocumento)); + } + await CarregarParcelas(SelectedDocumento); + await CarregaRepasse(((DomainBase)SelectedDocumento).Id); + await SelecionaParcela(Parcelas.FirstOrDefault()); + BaixarParcelas = false; + if (Parcelas == null || Parcelas.Count == 0) + { + VisibilityExcluirParcela = (Visibility)2; + VisibilityReplicarFatura = (Visibility)2; + BaixarParcelaVisibility = (Visibility)2; + } + Loading(isLoading: false); + AllowEditVendedor = Parcelas.Any(); + } + } + + public async Task ExcluirApolice() + { + if (SelectedDocumento == null) + { + return; + } + if (!AllowEditApolice || Parcelas.Any((Parcela x) => x.DataRecebimento.HasValue) || Repasses.Any((VendedorParcela x) => x.DataPagamento.HasValue)) + { + await ShowMessage("DOCUMENTO NÃO PODE SER EXCLUÍDO POIS POSSUI BAIXAS DE COMISSÃO OU PAGAMENTO DE VENDEDORES."); + return; + } + if (SelectedDocumento.Tipo > 0 && SelectedDocumento.Sinistro) + { + await ShowMessage("DOCUMENTO NÃO PODE SER EXCLUÍDO POIS POSSUI SINISTROS PARA UM OU MAIS DE SEUS ITENS."); + return; + } + Documento documentoSelecionado = SelectedDocumento; + string documento = ((documentoSelecionado.Tipo == 0 && string.IsNullOrEmpty(documentoSelecionado.Apolice)) ? "A PROPOSTA SELECIONADA" : ((documentoSelecionado.Tipo == 0 && !string.IsNullOrEmpty(documentoSelecionado.Apolice)) ? "A APÓLICE SELECIONADA" : "O ENDOSSO SELECIONADO")); + int ordem = SelectedDocumento.Ordem; + Documento? obj = ((IEnumerable)SelectedDocumento.Controle.Documentos.OrderByDescending((Documento x) => x.Ordem)).FirstOrDefault((Func)((Documento x) => (!x.Excluido && (int)x.Situacao != 7) || ((DomainBase)x).Id == ((DomainBase)SelectedDocumento).Id)); + if (ordem != ((obj != null) ? obj.Ordem : SelectedDocumento.Ordem)) + { + await ShowMessage(documento + " NÃO PODE SER EXCLUÍDO(A) POIS POSSUEM DOCUMENTOS ATIVOS ACIMA."); + } + else + { + if (!(await ShowMessage("DESEJA REALMENTE EXCLUIR " + documento + "?" + Environment.NewLine + "ESSE PROCEDIMENTO É IRREVERSÍVEL.", "SIM", "NÃO"))) + { + return; + } + bool flag = documentoSelecionado.TipoEndosso.HasValue; + if (flag) + { + flag = await ShowMessage("DESEJA DESFAZER AS ALTERAÇOES NOS ITENS VINCULADOS A ESSE ENDOSSO ?", "SIM", "NÃO"); + } + if (flag) + { + Documento? obj2 = ((IEnumerable)SelectedDocumento.Controle.Documentos.OrderByDescending((Documento x) => x.Ordem)).FirstOrDefault((Func)((Documento x) => !x.Excluido && (int)x.Situacao != 7 && x.Ordem > SelectedDocumento.Ordem)); + if (((obj2 != null) ? new int?(obj2.Ordem) : null) > SelectedDocumento.Ordem) + { + await ShowMessage("NÃO É POSSIVEL DESFAZER AS ALTERAÇÕES, POIS " + documento + " POSSUE ENDOSSOS ATIVOS ACIMA."); + return; + } + await DesfazerAlteracoes(); + } + string descricao = ((documentoSelecionado.Tipo == 0 && string.IsNullOrEmpty(documentoSelecionado.Apolice)) ? ("EXCLUIU PROPOSTA " + documentoSelecionado.Proposta) : ((documentoSelecionado.Tipo == 0 && !string.IsNullOrEmpty(documentoSelecionado.Apolice)) ? ("EXCLUIU APÓLICE " + documentoSelecionado.Apolice) : (string.IsNullOrEmpty(documentoSelecionado.Endosso) ? ("EXCLUIU PROPOSTA DE ENDOSSO " + documentoSelecionado.PropostaEndosso) : ("EXCLUIU ENDOSSO " + documentoSelecionado.Endosso)))); + RegistrarAcao(descricao, ((DomainBase)SelectedDocumento).Id, (TipoTela)2, GerarObs(documentoSelecionado)); + Loading(isLoading: true); + string label = ((documentoSelecionado.Tipo == 0 && string.IsNullOrEmpty(documentoSelecionado.Apolice)) ? "PROPOSTA EXCLUÍDA" : ((documentoSelecionado.Tipo == 0 && !string.IsNullOrEmpty(documentoSelecionado.Apolice)) ? "APÓLICE EXCLUÍDA" : "ENDOSSO EXCLUÍDO")); + documentoSelecionado.Excluido = true; + Servico.Sucesso = true; + await Servico.ExcluirCritica(((DomainBase)documentoSelecionado).Id); + if (!Servico.Sucesso) + { + Loading(isLoading: false); + return; + } + TarefaServico tarefaServico = TarefaServico; + tarefaServico.Sucesso = await TarefaServico.ExcluirTarefasDocumento(((DomainBase)documentoSelecionado).Id); + if (!TarefaServico.Sucesso) + { + Loading(isLoading: false); + return; + } + Servico.Sucesso = true; + if (documentoSelecionado.TipoEndosso.HasValue && (int)documentoSelecionado.TipoEndosso.GetValueOrDefault() == 2) + { + Documento apolice = ((IEnumerable)CancelDocumento.Controle.Documentos).FirstOrDefault((Func)((Documento x) => x.Tipo == 0 && !x.Excluido)); + List endossos = CancelDocumento.Controle.Documentos.Where((Documento x) => x.Tipo == 1 && !x.Excluido).ToList(); + if (apolice != null) + { + apolice.Situacao = (TipoSeguro)((apolice.SituacaoAnterior.HasValue && (int)apolice.SituacaoAnterior.GetValueOrDefault() != 3) ? ((int)apolice.SituacaoAnterior.Value) : (((int)apolice.NegocioCorretora.GetValueOrDefault() != 1) ? 1 : 2)); + await Servico.Save(apolice, updateParcelas: false, criarParcelas: false); + foreach (Documento item in endossos) + { + item.Situacao = apolice.Situacao; + await Servico.Save(item, updateParcelas: false, criarParcelas: false); + } + } + } + await Servico.Excluir(documentoSelecionado); + if (!Servico.Sucesso) + { + Loading(isLoading: false); + return; + } + if (documentoSelecionado.Tipo > 0) + { + await Funcoes.OrganizarDocumentos(((DomainBase)documentoSelecionado.Controle).Id); + await Funcoes.InativarItens(((DomainBase)documentoSelecionado).Id, ((DomainBase)documentoSelecionado.Controle.Ramo).Id); + } + if (Invoke) + { + ConsultaViewModel.DocumentoSelecionado = null; + Gestor.Application.Actions.Actions.RecarregarDocumentos?.Invoke(null); + } + Loading(isLoading: false); + ToggleSnackBar(label + " COM SUCESSO"); + if (Invoke) + { + Gestor.Application.Actions.Actions.AcessaTela?.Invoke((TipoTela)21, ""); + } + } + } + + private async Task DesfazerAlteracoes() + { + ObservableCollection itensApoMae = await new ItemServico().BuscarItems(((DomainBase)((IEnumerable)SelectedDocumento.Controle.Documentos).FirstOrDefault((Func)((Documento x) => !x.Excluido && (int)x.Situacao != 7 && x.Ordem == 0))).Id, (StatusItem)2); + ObservableCollection itensDocumento = await new ItemServico().BuscarItems(((DomainBase)SelectedDocumento).Id, (StatusItem)2); + List list = itensApoMae.Where((Item x) => x.IdDocumentoCancelado == ((DomainBase)SelectedDocumento).Id).ToList(); + list.AddRange(itensApoMae.Where(delegate(Item x) + { + if (x.Substituido.HasValue) + { + long? substituido = x.Substituido; + Item? obj = ((IEnumerable)itensDocumento).FirstOrDefault((Func)((Item d) => ((DomainBase)d).Id == x.Substituido)); + return substituido == ((obj != null) ? new long?(((DomainBase)obj).Id) : null); + } + return false; + })?.ToList()); + if (list.Count == 0) + { + list = itensApoMae.Where((Item x) => x.Status != null && !ValidationHelper.IsNullOrEmpty(x.Status) && x.Status.Contains("ORDEM") && x.Status.Replace("ORDEM", "-").Split(new char[1] { '-' })[1].Trim().Equals($"{SelectedDocumento.Ordem}")).ToList(); + } + foreach (Item item in list) + { + await new ItemServico().Reativar(item, ""); + } + } + + public string GerarObs(Documento doc) + { + if (doc.Tipo != 0) + { + return $"CLIENTE: {doc.Controle.Cliente.Nome}{Environment.NewLine}CÓDIGO: {((DomainBase)doc).Id}{Environment.NewLine}PROPOSTA: {doc.Proposta}{Environment.NewLine}APÓLICE: {doc.Apolice}{Environment.NewLine}PROPOSTA DE ENDOSSO: {doc.PropostaEndosso}{Environment.NewLine}ENDOSSO: {doc.Endosso}"; + } + return $"CLIENTE: {doc.Controle.Cliente.Nome}{Environment.NewLine}CÓDIGO: {((DomainBase)doc).Id}{Environment.NewLine}PROPOSTA: {doc.Proposta}{Environment.NewLine}APÓLICE: {doc.Apolice}"; + } + + public async Task RecusarApolice() + { + if (SelectedDocumento == null) + { + return; + } + bool[] array = await Funcoes.VerificarPagamento(((DomainBase)SelectedDocumento).Id); + if (Recursos.Configuracoes.All((ConfiguracaoSistema x) => (int)x.Configuracao != 23) && array.Any((bool x) => x)) + { + await ShowMessage("NÃO É POSSÍVEL RECURSAR UM APÓLICE ENQUANTO HOUVER RECEBIMENTO DE COMISSÃO OU PAGAMENTO DE VENDEDORES PARA A APÓLICE"); + return; + } + bool flag = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 23) && array[1]; + if (flag) + { + flag = await ShowMessage("EXISTEM PAGAMENTOS PARA OS VENDEDORES DO CONTRATO, DESEJA CRIAR ESTORNOS PARA ESSES PAGAMENTOS?", "SIM", "NÃO"); + } + bool estorno = flag; + Documento val = await Servico.BuscarApoliceAsync(((DomainBase)DocumentoSelecionado).Id); + IList list; + if (val.Controle.Documentos.Count <= 1) + { + list = val.Controle.Documentos; + } + else + { + IList list2 = (from x in val.Controle.Documentos + where !x.Excluido + orderby x.Ordem + select x).ToList(); + list = list2; + } + IList list3 = list; + if (list3.Count > 1 && ((DomainBase)list3.Last((Documento x) => (int)x.Situacao != 7)).Id != ((DomainBase)DocumentoSelecionado).Id) + { + await ShowMessage("NÃO É POSSÍVEL RECUSAR UM DOCUMENTO ENQUANTO HOUVER ENDOSSOS EM CIMA DO MESMO."); + return; + } + if ((int)val.Situacao == 7) + { + await ShowMessage("NÃO É POSSÍVEL RECUSAR UM DOCUMENTO JÁ RECUSADO."); + return; + } + string text = ((SelectedDocumento.Tipo == 0 && string.IsNullOrEmpty(SelectedDocumento.Apolice)) ? "A PROPOSTA SELECIONADA" : ((SelectedDocumento.Tipo == 0 && !string.IsNullOrEmpty(SelectedDocumento.Apolice)) ? "A APÓLICE SELECIONADA" : "O ENDOSSO SELECIONADO")); + if (await ShowMessage("DESEJA REALMENTE RECUSAR " + text + "? " + Environment.NewLine + "ESSE PROCEDIMENTO É IRREVERSÍVEL.", "SIM", "NÃO")) + { + string motivo = await ShowObservacaoDialog(); + if (motivo != null) + { + Loading(isLoading: true); + await Funcoes.RecusarApolice(SelectedDocumento, motivo, estorno); + string text2 = ((SelectedDocumento.Tipo == 0 && string.IsNullOrEmpty(SelectedDocumento.Apolice)) ? ("A PROPOSTA \"" + SelectedDocumento.Proposta + "\"") : ((SelectedDocumento.Tipo == 0 && !string.IsNullOrEmpty(SelectedDocumento.Apolice)) ? ("A APÓLICE \"" + SelectedDocumento.Apolice + "\"") : (string.IsNullOrEmpty(SelectedDocumento.Endosso) ? ("A PROPOSTA DE ENDOSSO \"" + SelectedDocumento.PropostaEndosso + "\"") : ("O ENDOSSO \"" + SelectedDocumento.Endosso + "\"")))); + RegistrarAcao("RECUSOU " + text2, ((DomainBase)SelectedDocumento).Id, (TipoTela)2, GerarObs(SelectedDocumento) + Environment.NewLine + "MOTIVO: " + motivo); + Loading(isLoading: false); + } + } + } + + public async Task IncluirEndosso() + { + if (!Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 13) && string.IsNullOrWhiteSpace(SelectedDocumento.Apolice)) + { + await ShowMessage("PROPOSTA NÃO PODE SER ENDOSSADA. NECESSÁRIO PREENCHER O NÚMERO DA APÓLICE E DATA DE EMISSÃO ANTES DE PROSSEGUIR."); + return false; + } + ObservableCollection tipoEndossoList = (((int)SelectedDocumento.TipoRecebimento.GetValueOrDefault() == 2) ? new ObservableCollection(new List + { + (TipoEndosso)2, + (TipoEndosso)1, + (TipoEndosso)4 + }) : new ObservableCollection(new List + { + (TipoEndosso)0, + (TipoEndosso)1, + (TipoEndosso)2, + (TipoEndosso)4 + })); + if ((int)SelectedDocumento.Situacao == 3) + { + tipoEndossoList = new ObservableCollection(new List { (TipoEndosso)3 }); + } + TipoEndossoList = tipoEndossoList; + Documento val = new Documento + { + Controle = SelectedDocumento.Controle, + Tipo = 1, + Ordem = SelectedDocumento.Controle.Documentos.Where((Documento x) => !x.Excluido).Max((Documento x) => x.Ordem) + 1, + NegocioCorretora = (NegocioCorretora)(((int?)SelectedDocumento.NegocioCorretora) ?? (((int)SelectedDocumento.Situacao == 2 && SelectedDocumento.Negocio.HasValue && (int)SelectedDocumento.Negocio.GetValueOrDefault() == 1) ? 1 : 0)), + Situacao = SelectedDocumento.Situacao, + Negocio = SelectedDocumento.Negocio, + TipoRecebimento = SelectedDocumento.TipoRecebimento, + Vigencia1 = Funcoes.GetNetworkTime().Date, + Vigencia2 = SelectedDocumento.Vigencia2, + ApoliceConferida = false, + PropostaAssinada = false, + AdicionalComiss = false, + Excluido = false, + Apolice = SelectedDocumento.Apolice, + Proposta = SelectedDocumento.Proposta, + TipoEndosso = (TipoEndosso)(((int)SelectedDocumento.TipoRecebimento.GetValueOrDefault() == 2) ? 2 : 0), + Comissao = SelectedDocumento.Comissao, + Estipulante1 = SelectedDocumento.Estipulante1, + Estipulante2 = SelectedDocumento.Estipulante2, + Estipulante3 = SelectedDocumento.Estipulante3, + Estipulante4 = SelectedDocumento.Estipulante4, + Estipulante5 = SelectedDocumento.Estipulante5 + }; + SelectedParcela = null; + SelectedDocumento = null; + SelectedPagamento = null; + if ((int)val.TipoRecebimento.GetValueOrDefault() == 1) + { + List list = (from x in Repasses.Where((VendedorParcela x) => (int)x.Parcela.SubTipo == 1).ToList() + group x by ((DomainBase)x.Vendedor).Id).Select((Func, VendedorParcela>)((IGrouping x) => new VendedorParcela + { + Repasse = x.First().Repasse, + Parcela = SelectedParcela, + Documento = SelectedDocumento, + ValorRepasse = default(decimal), + Vendedor = x.First().Vendedor, + PorcentagemRepasse = x.First().PorcentagemRepasse, + TipoVendedor = x.First().TipoVendedor + })).ToList(); + Pagamentos = new ObservableCollection(list); + Repasses = list; + } + else + { + Pagamentos = null; + Repasses = null; + } + Parcelas = null; + SelectedDocumento = val; + NovaApolice = true; + AllowEditVendedor = false; + AllowEditApolice = true; + IsEndosso = true; + base.IsEnabledEditEndosso = true; + base.EnableFields = true; + base.EnableIncluir = false; + AllowEditEmissao = true; + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: false); + return true; + } + + public async void RecalculaRepasses() + { + if (Repasses == null) + { + return; + } + bool renovacao = (SelectedDocumento.NegocioCorretora.HasValue ? ((int)SelectedDocumento.NegocioCorretora.GetValueOrDefault() == 1) : ((int)SelectedDocumento.Situacao == 2 && SelectedDocumento.Negocio.HasValue && (int)SelectedDocumento.Negocio.GetValueOrDefault() == 1)); + Repasses?.Where((VendedorParcela x) => NovaApolice || (int)x.Parcela.SubTipo == 1).ToList().ForEach(delegate(VendedorParcela x) + { + //IL_00a6: Unknown result type (might be due to invalid IL or missing references) + //IL_00ac: Invalid comparison between Unknown and I4 + //IL_0068: Unknown result type (might be due to invalid IL or missing references) + //IL_006e: Invalid comparison between Unknown and I4 + if (x.Parcela == null || x.Repasse == null || x.DataPagamento.HasValue) + { + return; + } + Parcela parcela = x.Parcela; + parcela.Documento = SelectedDocumento; + decimal value = Funcoes.CalculaRepasse(x.Repasse, parcela); + decimal value2; + if (renovacao) + { + Repasse repasse = x.Repasse; + if (repasse == null || (int)repasse.Tipo.GetValueOrDefault() != 3) + { + value2 = x.Repasse.ValorRenovacao; + goto IL_008d; + } + } + value2 = x.Repasse.ValorNovo; + goto IL_008d; + IL_008d: + x.PorcentagemRepasse = value2; + decimal? valorRepasse = (((int)x.Repasse.Forma.GetValueOrDefault() != 3) ? new decimal?(value) : (x.ValorTotal / (decimal?)SelectedDocumento.NumeroParcelas)); + if (x.CoCorretagem) + { + decimal premioLiquido = SelectedDocumento.PremioLiquido; + decimal? num = (SelectedDocumento.ComissaoTotal - (decimal?)SelectedDocumento.Comissao) / (decimal?)100; + valorRepasse = (decimal?)premioLiquido * num; + } + x.ValorRepasse = valorRepasse; + x.ValorTotal = value; + }); + if (NovaApolice) + { + Pagamentos = new ObservableCollection(Repasses.OrderBy((VendedorParcela x) => ((DomainBase)x.TipoVendedor).Id)); + } + else + { + await SelecionaParcela(SelectedParcela ?? Parcelas.FirstOrDefault()); + CalculaComissao(SelectedDocumento, Parcelas); + } + } + + public void RecalculaRepasse() + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_001c: Invalid comparison between Unknown and I4 + if ((!IsFatura && BaixarParcelas && (int)SelectedParcela.SubTipo == 1) || Repasses == null || Repasses.Count == 0) + { + return; + } + if (((DomainBase)SelectedParcela).Id == 0L) + { + Repasses.ForEach(delegate(VendedorParcela x) + { + //IL_0026: Unknown result type (might be due to invalid IL or missing references) + //IL_002c: Invalid comparison between Unknown and I4 + //IL_010d: Unknown result type (might be due to invalid IL or missing references) + //IL_0113: Invalid comparison between Unknown and I4 + if (x.DataPagamento.HasValue) + { + return; + } + Repasse repasse3 = x.Repasse; + if (repasse3 != null && (int)repasse3.Tipo.GetValueOrDefault() == 3) + { + return; + } + Parcela val = x.Parcela ?? SelectedParcela; + val.Documento = SelectedDocumento; + if (x.Repasse != null) + { + x.Repasse.ValorNovo = x.PorcentagemRepasse ?? x.Repasse.ValorNovo; + x.Repasse.ValorRenovacao = x.PorcentagemRepasse ?? x.Repasse.ValorRenovacao; + } + decimal value2 = Funcoes.CalculaRepasse(x.Repasse, val); + decimal? valorRepasse2; + if (SelectedDocumento.NumeroParcelas > 0m && !SelectedParcela.NumeroParcela.Equals(999)) + { + Repasse repasse4 = x.Repasse; + if (repasse4 != null && (int)repasse4.Forma.GetValueOrDefault() == 3) + { + valorRepasse2 = x.ValorTotal / (decimal?)SelectedDocumento.NumeroParcelas; + goto IL_015c; + } + } + valorRepasse2 = value2; + goto IL_015c; + IL_015c: + x.ValorRepasse = valorRepasse2; + x.ValorTotal = value2; + }); + Pagamentos = new ObservableCollection(Repasses); + return; + } + Repasses?.Where((VendedorParcela x) => ((DomainBase)SelectedParcela).Id > 0 && ((DomainBase)x.Parcela).Id == ((DomainBase)SelectedParcela).Id).ToList().ForEach(delegate(VendedorParcela x) + { + //IL_0026: Unknown result type (might be due to invalid IL or missing references) + //IL_002c: Invalid comparison between Unknown and I4 + //IL_0167: Unknown result type (might be due to invalid IL or missing references) + //IL_016d: Invalid comparison between Unknown and I4 + //IL_0175: Unknown result type (might be due to invalid IL or missing references) + //IL_017b: Invalid comparison between Unknown and I4 + //IL_0103: Unknown result type (might be due to invalid IL or missing references) + //IL_0109: Invalid comparison between Unknown and I4 + if (x.DataPagamento.HasValue) + { + return; + } + Repasse repasse = x.Repasse; + if (repasse != null && (int)repasse.Tipo.GetValueOrDefault() == 3) + { + return; + } + Parcela selectedParcela = SelectedParcela; + selectedParcela.Documento = SelectedDocumento; + if (x.Repasse != null) + { + x.Repasse.ValorNovo = x.PorcentagemRepasse ?? x.Repasse.ValorNovo; + x.Repasse.ValorRenovacao = x.PorcentagemRepasse ?? x.Repasse.ValorRenovacao; + } + decimal value = Funcoes.CalculaRepasse(x.Repasse, selectedParcela); + decimal? valorRepasse; + if (SelectedDocumento.NumeroParcelas > 0m && !SelectedParcela.NumeroParcela.Equals(999)) + { + Repasse repasse2 = x.Repasse; + if (repasse2 != null && (int)repasse2.Forma.GetValueOrDefault() == 3) + { + valorRepasse = x.ValorTotal / (decimal?)SelectedDocumento.NumeroParcelas; + goto IL_0152; + } + } + valorRepasse = value; + goto IL_0152; + IL_0152: + x.ValorRepasse = valorRepasse; + x.ValorTotal = (((int)SelectedDocumento.TipoRecebimento.GetValueOrDefault() == 1 && (int)SelectedParcela.SubTipo == 1) ? new decimal?(value) : x.ValorTotal); + }); + Pagamentos = new ObservableCollection(Repasses?.Where((VendedorParcela x) => ((DomainBase)SelectedParcela).Id > 0 && ((DomainBase)x.Parcela).Id == ((DomainBase)SelectedParcela).Id).ToList()); + } + + public async Task>> SalvarParcelas(int tipo) + { + if (SelectedParcela.Documento == null) + { + SelectedParcela.Documento = SelectedDocumento; + } + SelectedParcela.Documento.Parcelas = Parcelas; + if ((int)SelectedDocumento.TipoRecebimento.GetValueOrDefault() == 1 && (int)SelectedParcela.SubTipo == 1 && SelectedParcela.Comissao == 0m) + { + SelectedParcela.Comissao = SelectedDocumento.Comissao; + } + List> errors = SelectedParcela.Validate(Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 9), Recursos.Configuracoes.Any((ConfiguracaoSistema y) => (int)y.Configuracao == 11), EditandoParcela, Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 16)); + errors.AddRange(ValidaParcelaEspecial(tipo)); + decimal num = ((SelectedParcela.ValorExtrato == 0m) ? SelectedParcela.ValorLiquidoFatura : SelectedParcela.ValorExtrato); + int num2 = ((num > 0m) ? num.CompareTo(SelectedParcela.ValorComissao) : SelectedParcela.ValorComissao.CompareTo(num)); + bool flag = errors.Count == 1 && 2 == (int)SelectedDocumento.TipoRecebimento.GetValueOrDefault() && num2 < 0; + if (flag) + { + flag = await ShowMessage("VALOR RECEBIMENTO MAIOR QUE VALOR PARCELA, CONTINUAR?", "SIM", "NÃO"); + } + if (flag) + { + errors.Clear(); + } + if (errors.Count > 0) + { + return errors; + } + SelectedParcela.Baixando = false; + if (!Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 5) && (SelectedParcela.Iss > 0m || SelectedParcela.Irr > 0m || SelectedParcela.Outros > 0m || SelectedParcela.Desconto > 0m)) + { + SelectedParcela.Iss = 0m; + SelectedParcela.Irr = 0m; + SelectedParcela.Outros = 0m; + SelectedParcela.Desconto = 0m; + SelectedParcela.ValorComDesconto = SelectedParcela.ValorComissao; + } + switch (tipo) + { + case 1: + await AlterarVencimento(); + break; + case 2: + await BaixarComissao(); + break; + case 3: + case 4: + await AdicionarParcelaEspecial(); + break; + } + return null; + } + + private List> ValidaParcelaEspecial(int tipo) + { + //IL_0010: Unknown result type (might be due to invalid IL or missing references) + //IL_0016: Invalid comparison between Unknown and I4 + List> list = new List>(); + if (tipo == 4 && (int)SelectedParcela.SubTipo == 1) + { + list.Add(new KeyValuePair("SubTipo|TIPO", "A PARCELA ESPECIAL NÃO PODE SER DO TIPO PARCELA NORMAL")); + } + return list; + } + + public Documento AbrirDetalhes() + { + Documento selectedDocumento = SelectedDocumento; + selectedDocumento.Parcelas = Parcelas; + selectedDocumento.Pagamentos = Repasses; + return selectedDocumento; + } + + public bool CompararValores() + { + if (((DomainBase)SelectedDocumento).Id != 0L && !((DomainBase)SelectedDocumento).HasChange("PremioLiquido") && !((DomainBase)SelectedDocumento).HasChange("PremioAdicional") && !((DomainBase)SelectedDocumento).HasChange("Comissao") && !((DomainBase)SelectedDocumento).HasChange("Iof")) + { + return ((DomainBase)SelectedDocumento).HasChange("AdicionalComiss"); + } + return true; + } + + public Parcela AbrirDetalhesParcela() + { + Parcela selectedParcela = SelectedParcela; + selectedParcela.Vendedores = Pagamentos; + return selectedParcela; + } + + public void ManutecaoItens() + { + if (Invoke) + { + Gestor.Application.Actions.Actions.AcessaTela?.Invoke((TipoTela)3, "Manutencao"); + } + } + + public async Task PagamentoVendedor(Parcela parcela) + { + return await ParcelaServico.TemPagamento(((DomainBase)parcela).Id); + } + + public async Task ExcluirPagamento(VendedorParcela pagamento) + { + Loading(isLoading: true); + if (await Funcoes.ExcluirPagamento(pagamento)) + { + ToggleSnackBar("PAGAMENTO EXCLUÍDO COM SUCESSO"); + string text = ((SelectedDocumento.Tipo == 0 && string.IsNullOrEmpty(SelectedDocumento.Apolice)) ? ("NA PROPOSTA \"" + SelectedDocumento.Proposta + "\"") : ((SelectedDocumento.Tipo == 0 && !string.IsNullOrEmpty(SelectedDocumento.Apolice)) ? ("NA APÓLICE \"" + SelectedDocumento.Apolice + "\"") : (string.IsNullOrEmpty(SelectedDocumento.Endosso) ? ("NA PROPOSTA DE ENDOSSO \"" + SelectedDocumento.PropostaEndosso + "\"") : ("NO ENDOSSO \"" + SelectedDocumento.Endosso + "\"")))); + string descricao = "PAGAMENTO DO VENDEDOR " + pagamento.Vendedor.Nome + " EXCLUÍDO, " + text; + RegistrarAcao(descricao, ((DomainBase)pagamento).Id, (TipoTela)37, $"{GerarObs(SelectedDocumento)}{Environment.NewLine}VENDEDOR: {pagamento.Vendedor.Nome}{Environment.NewLine}COMISSÃO TOTAL: {pagamento.ValorTotal:C2}"); + } + await CarregarParcelas(SelectedDocumento); + await CarregaRepasse(((DomainBase)SelectedDocumento).Id); + await SelecionaParcela(Parcelas.FirstOrDefault()); + AllowEditApolice = Parcelas.Where((Parcela x) => (int)x.SubTipo == 1).All((Parcela x) => !x.DataRecebimento.HasValue) && Repasses.Where((VendedorParcela x) => (int)x.Parcela.SubTipo == 1).All((VendedorParcela x) => !x.DataPagamento.HasValue); + BaixarParcelas = false; + Loading(isLoading: false); + } + + public async Task CarregarImposto() + { + List source = await new ImpostoServico().Buscar(true); + object obj = ((IEnumerable)source).FirstOrDefault((Func)((Imposto x) => x.Seguradora != null && ((DomainBase)x.Seguradora).Id == ((DomainBase)SelectedDocumento.Controle.Seguradora).Id && x.Ramo != null && ((DomainBase)x.Ramo).Id == ((DomainBase)SelectedDocumento.Controle.Ramo).Id)) ?? ((IEnumerable)source).FirstOrDefault((Func)((Imposto x) => x.Seguradora != null && ((DomainBase)x.Seguradora).Id == ((DomainBase)SelectedDocumento.Controle.Seguradora).Id && x.Ramo == null)); + if (obj == null) + { + obj = ((IEnumerable)source).FirstOrDefault((Func)((Imposto x) => x.Seguradora == null && x.Ramo != null && ((DomainBase)x.Ramo).Id == ((DomainBase)SelectedDocumento.Controle.Ramo).Id)); + } + if (obj == null) + { + obj = ((IEnumerable)source).FirstOrDefault((Func)((Imposto x) => x.Seguradora == null && x.Ramo == null)); + } + Imposto val = (Imposto)obj; + Imposto = (Imposto)(((object)val) ?? ((object)new Imposto())); + } + + public async Task EditarParcelas() + { + if (DocumentoSelecionado == null) + { + DocumentoSelecionado = SelectedDocumento; + } + await ShowEditarParcelasDialog(DocumentoSelecionado); + await CarregarParcelas(DocumentoSelecionado); + } + + public async void AbrirLogAntigo() + { + Loading(isLoading: true); + string text = await Servico.BuscarLogAntigo(((DomainBase)SelectedDocumento).Id); + Loading(isLoading: false); + if (string.IsNullOrEmpty(text)) + { + await ShowMessage("NÃO HÁ LOG PARA ESSE DOCUMENTO"); + } + else + { + ShowDrawer(new LogSistemaAntigo(((DomainBase)SelectedDocumento).Id, text), 0, close: false); + } + } + + public async void AbrirLogAntigoParcela() + { + Loading(isLoading: true); + string log = ""; + foreach (Parcela item in await ParcelaServico.BuscarParcelas(((DomainBase)SelectedDocumento).Id)) + { + string text = log; + log = text + await ParcelaServico.BuscarLogAntigo(((DomainBase)item).Id); + } + Loading(isLoading: false); + if (string.IsNullOrEmpty(log)) + { + await ShowMessage("NÃO HÁ LOG PARA PARCELAS"); + } + else + { + ShowDrawer(new LogSistemaAntigo(((DomainBase)SelectedDocumento).Id, log), 0, close: false); + } + } + + public async Task AjusteComissãoCoCorretagem(bool removido = false) + { + try + { + if (removido) + { + Documento selectedDocumento = SelectedDocumento; + Documento selectedDocumento2 = SelectedDocumento; + selectedDocumento.Comissao = ((selectedDocumento2 != null) ? selectedDocumento2.ComissaoTotal : null).GetValueOrDefault(); + SelectedDocumento = await Servico.Save(SelectedDocumento, updateParcelas: false, criarParcelas: false); + AjustaParcelasCoCorretagem(); + CalculaComissao(SelectedDocumento, Parcelas); + } + else + { + VendedorParcela selectedPagamento = SelectedPagamento; + decimal num = ((selectedPagamento != null) ? selectedPagamento.Repasse.ValorNovo : 0m); + decimal comissao = SelectedDocumento.Comissao; + SelectedDocumento.ComissaoTotal = comissao; + SelectedDocumento.Comissao = Math.Round(comissao - comissao * (num * 0.01m), 2); + SelectedDocumento = await Servico.Save(SelectedDocumento, updateParcelas: false, criarParcelas: false); + AjustaParcelasCoCorretagem(); + CalculaComissao(SelectedDocumento, Parcelas); + } + } + catch + { + await ShowMessage("NÃO FOI POSSÍVEL ALTERAR A COMISSÃO DA CO-CORRETAGEM"); + } + } + + public async void AjustaParcelasCoCorretagem() + { + try + { + ObservableCollection parcelas = Parcelas; + foreach (Parcela item in parcelas) + { + if (item.NumeroParcela == 999) + { + return; + } + item.Comissao = SelectedDocumento.Comissao; + } + Parcelas = new ObservableCollection(await ParcelaServico.SaveRange(parcelas.ToList())); + await CarregarParcelas(SelectedDocumento); + } + catch + { + await ShowMessage("NÃO FOI POSSÍVEL SALVAR AS PARCELAS"); + } + } + + public List VendedorCoCorretagem(bool coCorretagem = false) + { + if (coCorretagem) + { + return Vendedores = Vendedores.Where((Vendedor vendedor) => RepassesVendedores?.FindAll((Repasse repasse) => ((DomainBase)repasse.Vendedor).Id == ((DomainBase)vendedor).Id).Any((Repasse x) => (int)x.Tipo.GetValueOrDefault() == 3) ?? false).ToList(); + } + return Vendedores = (from vendedor in Recursos.Vendedores + where vendedor.Ativo && !vendedor.Corretora && vendedor.IdEmpresa == Recursos.Usuario.IdEmpresa + select vendedor into v + orderby v.Nome + select v).ToList(); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Generic/BaseDialogViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Generic/BaseDialogViewModel.cs new file mode 100644 index 0000000..77c4577 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Generic/BaseDialogViewModel.cs @@ -0,0 +1,5 @@ +namespace Gestor.Application.ViewModels.Generic; + +public class BaseDialogViewModel : BaseViewModel +{ +} diff --git a/Decompiler/Gestor.Application.ViewModels.Generic/BaseFinanceiroViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Generic/BaseFinanceiroViewModel.cs new file mode 100644 index 0000000..abe8a24 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Generic/BaseFinanceiroViewModel.cs @@ -0,0 +1,371 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Forms; +using Gestor.Application.Componentes; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels.Financeiro; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Financeiro; +using MaterialDesignThemes.Wpf; +using OfxSharpLib; +using Xceed.Wpf.AvalonDock.Controls; + +namespace Gestor.Application.ViewModels.Generic; + +public abstract class BaseFinanceiroViewModel : BaseViewModel +{ + public AutoCompleteFilterPredicate BancosContasItemFilter => (string searchText, object obj) => ((BancosContas)obj).Descricao.ToUpper().Contains(searchText.ToUpper()); + + public AutoCompleteFilterPredicate FornecedorItemFilter => (string searchText, object obj) => (((Fornecedor)obj).Nome != null && ((Fornecedor)obj).Nome.ToUpper().Contains(searchText.ToUpper())) || (((Fornecedor)obj).Documento != null && ((Fornecedor)obj).Documento.ToString().Contains(searchText.ToUpper())) || (((Fornecedor)obj).Telefone1 != null && ((Fornecedor)obj).Telefone1.ToString().Contains(searchText.ToUpper())) || (((Fornecedor)obj).Telefone2 != null && ((Fornecedor)obj).Telefone2.ToString().Contains(searchText.ToUpper())) || (((Fornecedor)obj).Email != null && ((Fornecedor)obj).Email.ToString().Contains(searchText.ToUpper())); + + public AutoCompleteFilterPredicate LancamentoItemFilter => delegate(string searchText, object obj) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + //IL_0056: Unknown result type (might be due to invalid IL or missing references) + //IL_0099: Unknown result type (might be due to invalid IL or missing references) + //IL_006b: Unknown result type (might be due to invalid IL or missing references) + //IL_00dc: Unknown result type (might be due to invalid IL or missing references) + //IL_00ae: Unknown result type (might be due to invalid IL or missing references) + //IL_0113: Unknown result type (might be due to invalid IL or missing references) + //IL_00e9: Unknown result type (might be due to invalid IL or missing references) + //IL_0156: Unknown result type (might be due to invalid IL or missing references) + //IL_012c: Unknown result type (might be due to invalid IL or missing references) + //IL_019e: Unknown result type (might be due to invalid IL or missing references) + //IL_016f: Unknown result type (might be due to invalid IL or missing references) + //IL_01e3: Unknown result type (might be due to invalid IL or missing references) + //IL_01b7: Unknown result type (might be due to invalid IL or missing references) + //IL_01fc: Unknown result type (might be due to invalid IL or missing references) + if ((((Lancamento)obj).Historico == null || !((Lancamento)obj).Historico.ToUpper().Contains(searchText.ToUpper())) && !((Lancamento)obj).Vencimento.ToString().ToUpper().Contains(searchText.ToUpper()) && (!((Lancamento)obj).Baixa.HasValue || !((Lancamento)obj).Baixa.ToString().ToUpper().Contains(searchText.ToUpper())) && (!((Lancamento)obj).Pagamento.HasValue || !((Lancamento)obj).Pagamento.ToString().ToUpper().Contains(searchText.ToUpper())) && (((Lancamento)obj).Conta == null || !((Lancamento)obj).Conta.Descricao.ToString().ToUpper().Contains(searchText.ToUpper()))) + { + ControleFinanceiro controle = ((Lancamento)obj).Controle; + if (((controle != null) ? controle.Historico : null) == null || !((Lancamento)obj).Controle.Historico.ToString().ToUpper().Contains(searchText.ToUpper())) + { + ControleFinanceiro controle2 = ((Lancamento)obj).Controle; + if (((controle2 != null) ? controle2.Plano : null) == null || !((Lancamento)obj).Controle.Plano.Descricao.ToString().ToUpper().Contains(searchText.ToUpper())) + { + ControleFinanceiro controle3 = ((Lancamento)obj).Controle; + if (((controle3 != null) ? controle3.Centro : null) == null || !((Lancamento)obj).Controle.Centro.Descricao.ToString().ToUpper().Contains(searchText.ToUpper())) + { + ControleFinanceiro controle4 = ((Lancamento)obj).Controle; + if (((controle4 != null) ? controle4.Fornecedor : null) != null) + { + return ((Lancamento)obj).Controle.Fornecedor.Nome.ToString().ToUpper().Contains(searchText.ToUpper()); + } + return false; + } + } + } + } + return true; + }; + + public AutoCompleteFilterPredicate PlanoItemFilter => (string searchText, object obj) => ((Plano)obj).Descricao.ToUpper().Contains(searchText.ToUpper()) || ((Plano)obj).Descricao.ToString().Contains(searchText.ToUpper()); + + public AutoCompleteFilterPredicate PlanosItemFilter => (string searchText, object obj) => ((Planos)obj).Descricao.ToUpper().Contains(searchText.ToUpper()) || ((Planos)obj).Descricao.ToString().Contains(searchText.ToUpper()); + + public AutoCompleteFilterPredicate BancoItemFilter => (string searchText, object obj) => ((Banco)obj).Nome.ToUpper().Contains(searchText.ToUpper()); + + internal async Task> BuscarBancosContas(string value) + { + return await Task.Run(() => new BaseServico().BuscarBancosContas(value)); + } + + internal async Task> BuscarFornecedor(string value) + { + return await Task.Run(() => new BaseServico().BuscarFornecedor(value)); + } + + internal async Task> BuscarFornecedorAtivo(string value) + { + return await Task.Run(() => new BaseServico().BuscarFornecedor(value, ativo: true)); + } + + internal async Task ShowTransferencia(Transferencia transferencia) + { + DialogHost val = Extentions.FindVisualChildren((DependencyObject)(object)((IEnumerable)Application.Current.Windows).OfType().SingleOrDefault((Func)((Window x) => x.IsActive))).FirstOrDefault(); + DialogTransferencia dialogControl = new DialogTransferencia(transferencia); + return await ExecuteRunExtendedDialogTransferencia((UserControl)(object)dialogControl, (val != null) ? val.Identifier.ToString() : "RootDialog"); + } + + public async Task ExecuteRunExtendedDialogTransferencia(UserControl dialogControl, string hostName) + { + Extentions.FindVisualChildren((DependencyObject)(object)((IEnumerable)Application.Current.Windows).OfType().SingleOrDefault((Func)((Window x) => x.IsActive))).ToList().ForEach(delegate(WebEditor x) + { + ((UIElement)x).Visibility = (Visibility)2; + }); + object obj = await DialogHost.Show((object)dialogControl, (object)hostName, new DialogOpenedEventHandler(base.ExtendedOpenedEventHandler), new DialogClosingEventHandler(base.ExtendedClosingEventHandler)); + if (obj is bool) + { + return null; + } + return (Transferencia)obj; + } + + internal async Task ShowVinculo(FinanceiroViewModel viewModel) + { + DialogHost val = Extentions.FindVisualChildren((DependencyObject)(object)((IEnumerable)Application.Current.Windows).OfType().SingleOrDefault((Func)((Window x) => x.IsActive))).FirstOrDefault(); + VincularLancamentoDialog dialogControl = new VincularLancamentoDialog(viewModel); + return await ExecuteRunExtendedDialogVinculo((UserControl)(object)dialogControl, (val != null) ? val.Identifier.ToString() : "RootDialog"); + } + + public async Task ExecuteRunExtendedDialogVinculo(UserControl dialogControl, string hostName) + { + Extentions.FindVisualChildren((DependencyObject)(object)((IEnumerable)Application.Current.Windows).OfType().SingleOrDefault((Func)((Window x) => x.IsActive))).ToList().ForEach(delegate(WebEditor x) + { + ((UIElement)x).Visibility = (Visibility)2; + }); + object obj = await DialogHost.Show((object)dialogControl, (object)hostName, new DialogOpenedEventHandler(base.ExtendedOpenedEventHandler), new DialogClosingEventHandler(base.ExtendedClosingEventHandler)); + if (obj is bool) + { + return null; + } + return (Lancamento)obj; + } + + internal async Task ShowContas(List contas) + { + DialogHost val = Extentions.FindVisualChildren((DependencyObject)(object)((IEnumerable)Application.Current.Windows).OfType().SingleOrDefault((Func)((Window x) => x.IsActive))).FirstOrDefault(); + ContasDialog dialogControl = new ContasDialog(contas); + return await ExecuteRunExtendedDialogContas((UserControl)(object)dialogControl, (val != null) ? val.Identifier.ToString() : "RootDialog"); + } + + public async Task ExecuteRunExtendedDialogContas(UserControl dialogControl, string hostName) + { + Extentions.FindVisualChildren((DependencyObject)(object)((IEnumerable)Application.Current.Windows).OfType().SingleOrDefault((Func)((Window x) => x.IsActive))).ToList().ForEach(delegate(WebEditor x) + { + ((UIElement)x).Visibility = (Visibility)2; + }); + object obj = await DialogHost.Show((object)dialogControl, (object)hostName, new DialogOpenedEventHandler(base.ExtendedOpenedEventHandler), new DialogClosingEventHandler(base.ExtendedClosingEventHandler)); + if (obj is bool) + { + return null; + } + return (BancosContas)obj; + } + + public Encoding GetEncoding(string filename) + { + byte[] array = new byte[4]; + using (FileStream fileStream = new FileStream(filename, FileMode.Open, FileAccess.Read)) + { + fileStream.Read(array, 0, 4); + } + if (array[0] == 43 && array[1] == 47 && array[2] == 118) + { + return Encoding.UTF7; + } + if (array[0] == 239 && array[1] == 187 && array[2] == 191) + { + return Encoding.UTF8; + } + if (array[0] == byte.MaxValue && array[1] == 254 && array[2] == 0 && array[3] == 0) + { + return Encoding.UTF32; + } + if (array[0] == byte.MaxValue && array[1] == 254) + { + return Encoding.Unicode; + } + if (array[0] == 254 && array[1] == byte.MaxValue) + { + return Encoding.BigEndianUnicode; + } + if (array[0] == 0 && array[1] == 0 && array[2] == 254 && array[3] == byte.MaxValue) + { + return new UTF32Encoding(bigEndian: true, byteOrderMark: true); + } + return Encoding.ASCII; + } + + public async Task> ImportarOfx() + { + List ofxDocuments = new List(); + bool error = false; + List files = new List(); + OpenFileDialog val = new OpenFileDialog(); + try + { + val.Multiselect = true; + ((FileDialog)val).Filter = "Arquivos OFX|*.ofx"; + ((FileDialog)val).InitialDirectory = Environment.SpecialFolder.Desktop.ToString(); + if (1 != (int)((CommonDialog)val).ShowDialog()) + { + return null; + } + files.AddRange(((FileDialog)val).FileNames); + } + finally + { + ((IDisposable)val)?.Dispose(); + } + await Task.Run(delegate + { + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + //IL_0018: Expected O, but got Unknown + OfxDocumentParser parser = new OfxDocumentParser(); + files.ForEach(delegate(string x) + { + try + { + string text = DateTime.Now.Date.ToString("yyyyMMddHHmmss"); + string text2 = DetectEncodingAndRead(x).Replace("00000000", "" + text).Replace("00000000000000", "" + text).Replace(",", ".") + .Replace(" ", "."); + if (text2.Contains("336") && !text2.Contains("")) + { + text2 = text2.Replace("UTF - 8", "USASCII").Replace("", "\r\n\r\n0\r\n00000000\r\n").Replace("00000000", "" + text) + .Replace(": ", ":") + .Replace(" ", "") + .Replace("", "0"); + } + if (text2.Contains("0403") && !text2.Contains("CHARSET:1252") && text2.Contains("ENCODING:UTF-8")) + { + text2 = text2.Replace("UTF-8", "USASCII\nCHARSET:1252").Replace("00000000", "" + text).Replace("[0:GMT]", "") + .Replace(": ", ":") + .Replace(" ", ""); + } + if (text2.Contains("260")) + { + text2 = text2.Replace("UTF-8", "USASCII").Replace("CHARSET:NONE", "CHARSET:1252"); + } + if (text2.Contains("")) + { + text2 = text2.Replace("", "SEM INFORMAÇÃO"); + } + if (Regex.IsMatch(text2, "\\s*")) + { + text2 = text2.Replace("\n", "SEM NOME").Replace("", "SEM NOME"); + } + OfxDocument item = parser.Import(text2); + ofxDocuments.Add(item); + } + catch (Exception) + { + error = true; + } + }); + }); + if (error) + { + await ShowMessage("HOUVE PROBLEMAS AO IMPORTAR O OFX, BAIXE-O NOVAMENTE COM UM PERÍODO MENOR."); + } + return ofxDocuments; + } + + private string DetectEncodingAndRead(string arquivo) + { + return File.ReadAllText(arquivo, DetectTextFileEncoding(arquivo)); + } + + public static Encoding DetectTextFileEncoding(string filePath) + { + byte[] array; + using (FileStream fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read)) + { + int num = (int)Math.Min(fileStream.Length, 4096L); + array = new byte[num]; + fileStream.Read(array, 0, num); + } + if (array.Length >= 2) + { + if (array.Length >= 3 && array[0] == 239 && array[1] == 187 && array[2] == 191) + { + return Encoding.UTF8; + } + if (array[0] == byte.MaxValue && array[1] == 254) + { + return Encoding.Unicode; + } + if (array[0] == 254 && array[1] == byte.MaxValue) + { + return Encoding.BigEndianUnicode; + } + if (array.Length >= 4 && array[0] == byte.MaxValue && array[1] == 254 && array[2] == 0 && array[3] == 0) + { + return Encoding.UTF32; + } + if (array.Length >= 4 && array[0] == 0 && array[1] == 0 && array[2] == 254 && array[3] == byte.MaxValue) + { + return new UTF32Encoding(bigEndian: true, byteOrderMark: true); + } + } + bool flag = true; + int num2 = 0; + int num3 = 0; + for (int i = 0; i < array.Length; i++) + { + if (array[i] <= 127) + { + num3++; + continue; + } + if (array[i] >= 194 && array[i] <= 223 && i + 1 < array.Length && array[i + 1] >= 128 && array[i + 1] <= 191) + { + num2++; + i++; + continue; + } + if (array[i] >= 224 && array[i] <= 239 && i + 2 < array.Length && array[i + 1] >= 128 && array[i + 1] <= 191 && array[i + 2] >= 128 && array[i + 2] <= 191) + { + num2++; + i += 2; + continue; + } + if (array[i] >= 240 && array[i] <= 244 && i + 3 < array.Length && array[i + 1] >= 128 && array[i + 1] <= 191 && array[i + 2] >= 128 && array[i + 2] <= 191 && array[i + 3] >= 128 && array[i + 3] <= 191) + { + num2++; + i += 3; + continue; + } + flag = false; + break; + } + int num4 = 0; + for (int j = 0; j < array.Length - 1; j += 2) + { + if (array[j] == 0 || array[j + 1] == 0) + { + num4++; + } + } + if (flag && num2 > 0) + { + return Encoding.UTF8; + } + if ((double)num3 > (double)array.Length * 0.95) + { + return Encoding.ASCII; + } + if ((double)num4 > (double)array.Length * 0.4) + { + int num5 = 0; + int num6 = 0; + for (int k = 0; k < array.Length - 1; k += 2) + { + if (array[k] == 0 && array[k + 1] != 0) + { + num6++; + } + if (array[k] != 0 && array[k + 1] == 0) + { + num5++; + } + } + if (num5 > num6) + { + return Encoding.Unicode; + } + return Encoding.BigEndianUnicode; + } + return Encoding.GetEncoding(1252); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Generic/BaseSegurosViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Generic/BaseSegurosViewModel.cs new file mode 100644 index 0000000..b481bbb --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Generic/BaseSegurosViewModel.cs @@ -0,0 +1,656 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Globalization; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using Agger.Registro; +using Gestor.Application.Componentes; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.Servicos.Seguros.Itens; +using Gestor.Application.ViewModels.Seguros.Itens; +using Gestor.Application.Views.Seguros.Itens; +using Gestor.Model.Common; +using Gestor.Model.Domain.Card; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.MalaDireta; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.Helper; +using MaterialDesignThemes.Wpf; +using Xceed.Wpf.AvalonDock.Controls; + +namespace Gestor.Application.ViewModels.Generic; + +public class BaseSegurosViewModel : BaseViewModel +{ + private string _anotacoes; + + private bool _enableEndossar; + + private bool _enableRenovar; + + public AutoCompleteFilterPredicate ClienteItemFilter => (string searchText, object obj) => CultureInfo.InvariantCulture.CompareInfo.IndexOf(((Cliente)obj).Nome.ToUpper(), searchText.Trim(), CompareOptions.IgnoreNonSpace) > -1 || (((Cliente)obj).Documento != null && ((Cliente)obj).Documento.Contains(searchText.Trim())) || (((Cliente)obj).Rne != null && ((Cliente)obj).Rne.Contains(searchText.Trim())) || (((Cliente)obj).Cei != null && ((Cliente)obj).Cei.Contains(searchText.Trim())) || (((Cliente)obj).NomeSocialRg != null && ((Cliente)obj).NomeSocialRg.ToUpper().Contains(searchText.Trim().ToUpper())) || (((Cliente)obj).Telefones != null && ((Cliente)obj).Telefones.Count > 0 && ((Cliente)obj).Telefones.Any((ClienteTelefone x) => ((TelefoneBase)x).Numero.Contains(searchText.Trim()))); + + public string Anotacoes + { + get + { + return _anotacoes; + } + set + { + _anotacoes = value; + OnPropertyChanged("Anotacoes"); + } + } + + public AutoCompleteFilterPredicate AgendaItemFilter => (string searchText, object obj) => ((Agenda)obj).Nome.ToUpper().Contains(searchText.ToUpper()); + + public AutoCompleteFilterPredicate VendedorItemFilter => (string searchText, object obj) => ((Vendedor)obj).Nome.ToUpper().Contains(searchText.ToUpper()) || (((Vendedor)obj).Documento != null && ((Vendedor)obj).Documento.ToUpper().Contains(searchText.ToUpper())); + + public AutoCompleteFilterPredicate ProfissaoItemFilter => (string searchText, object obj) => ((Profissao)obj).Nome.ToUpper().Contains(searchText.ToUpper()) || ((Profissao)obj).Codigo.ToUpper().Contains(searchText.ToUpper()); + + public AutoCompleteFilterPredicate EstipulanteItemFilter => (string searchText, object obj) => ((Estipulante)obj).Nome.ToUpper().Contains(searchText.ToUpper()) || ((Estipulante)obj).Documento.ToString().Contains(searchText.ToUpper()); + + public AutoCompleteFilterPredicate ProdutoItemFilter => (string searchText, object obj) => ((Produto)obj).Nome.ToUpper().Contains(searchText.ToUpper()); + + public AutoCompleteFilterPredicate TipoTarefaItemFilter => (string searchText, object obj) => ((TipoDeTarefa)obj).Nome.ToUpper().Contains(searchText.ToUpper()); + + public AutoCompleteFilterPredicate StatusProspeccaoItemFilter => (string searchText, object obj) => ((StatusDeProspeccao)obj).Nome.ToUpper().Contains(searchText.ToUpper()); + + public AutoCompleteFilterPredicate NotaFiscalItemFilter => (string searchText, object obj) => ((NotaFiscal)obj).Seguradora.Nome.ToUpper().Contains(searchText.ToUpper()); + + public AutoCompleteFilterPredicate StatusItemFilter => (string searchText, object obj) => ((Status)obj).Nome.ToUpper().Contains(searchText.ToUpper()); + + public AutoCompleteFilterPredicate ReciboItemFilter => (string searchText, object obj) => ((Recibo)obj).Pagante.ToUpper().Contains(searchText.ToUpper()) || ((Recibo)obj).Recebedor.ToUpper().Contains(searchText.ToUpper()); + + public AutoCompleteFilterPredicate EtiquetaItemFilter => (string searchText, object obj) => ((Documento)obj).Controle.Cliente.Nome.ToUpper().Contains(searchText.ToUpper()); + + public AutoCompleteFilterPredicate EmpresaItemFilter => (string searchText, object obj) => ((Empresa)obj).Nome.ToUpper().Contains(searchText.ToUpper()) || ((Empresa)obj).Documento.ToString().Contains(searchText.ToUpper()) || ((Empresa)obj).Serial.ToString().Contains(searchText.ToUpper()); + + public AutoCompleteFilterPredicate SocioItemFilter => (string searchText, object obj) => ((Socio)obj).Nome.ToUpper().Contains(searchText.ToUpper()) || ((Socio)obj).Email.ToString().Contains(searchText.ToUpper()) || ((Socio)obj).Telefone.ToString().Contains(searchText.ToUpper()); + + public AutoCompleteFilterPredicate UsuarioItemFilter => (string searchText, object obj) => ((Usuario)obj).Nome.ToUpper().Contains(searchText.ToUpper()) || ((Usuario)obj).Documento.ToString().Contains(searchText.ToUpper()); + + public AutoCompleteFilterPredicate NomeItemFilter => (string searchText, object obj) => ((Credencial)obj).Descricao.ToUpper().Contains(searchText.ToUpper()); + + public AutoCompleteFilterPredicate BancoItemFilter => (string searchText, object obj) => ((Banco)obj).Nome.ToUpper().Contains(searchText.ToUpper()) || ((Banco)obj).Codigo.ToString().Contains(searchText.ToUpper()); + + public AutoCompleteFilterPredicate AtividadeItemFilter => (string searchText, object obj) => ((Atividade)obj).Nome.ToUpper().Contains(searchText.ToUpper()) || ((Atividade)obj).Cnac.ToUpper().Contains(searchText.ToUpper()); + + public AutoCompleteFilterPredicate FabricanteItemFilter => (string searchText, object obj) => ((Fabricante)obj).Descricao.ToUpper().Contains(searchText.ToUpper()); + + public AutoCompleteFilterPredicate SeguradoraItemFilter => (string searchText, object obj) => ((Seguradora)obj).Nome.ToUpper().Contains(searchText.ToUpper()) || (((Seguradora)obj).Documento != null && ((Seguradora)obj).Documento.ToUpper().Contains(searchText.ToUpper())) || (((Seguradora)obj).Susep != null && ((Seguradora)obj).Susep.ToUpper().Contains(searchText.ToUpper())); + + public AutoCompleteFilterPredicate ConfigItemFilter => (string searchText, object obj) => ((ConfigExtratoImport)obj).Descricao.ToUpper().Contains(searchText.ToUpper()); + + public AutoCompleteFilterPredicate ParceiroItemFilter => (string searchText, object obj) => ((Parceiro)obj).Nome.ToUpper().Contains(searchText.ToUpper()); + + public AutoCompleteFilterPredicate TipoVendedorItemFilter => (string searchText, object obj) => ((TipoVendedor)obj).Descricao.ToUpper().Contains(searchText.ToUpper()); + + public AutoCompleteFilterPredicate RamoItemFilter => (string searchText, object obj) => ((Ramo)obj).Nome.ToUpper().Contains(searchText.ToUpper()); + + public AutoCompleteFilterPredicate ItemFilter => (string searchText, object obj) => ((Item)obj).Descricao.ToUpper().Contains(searchText.ToUpper()); + + public AutoCompleteFilterPredicate SinitroItemFilter => (string searchText, object obj) => ((ControleSinistro)obj).DataSinistro.ToString().Contains(searchText) || (((ControleSinistro)obj).Sinistros != null && ((ControleSinistro)obj).Sinistros.Count > 0 && ((ControleSinistro)obj).Sinistros[0].Numero.ToUpper().Contains(searchText.ToUpper())); + + public AutoCompleteFilterPredicate CoberturaPadraoItemFilter => (string searchText, object obj) => ((CoberturaPadrao)obj).Descricao.ToUpper().Contains(searchText.ToUpper()); + + public bool EnableEndossar + { + get + { + return _enableEndossar; + } + set + { + _enableEndossar = value; + OnPropertyChanged("EnableEndossar"); + } + } + + public bool EnableRenovar + { + get + { + return _enableRenovar; + } + set + { + _enableRenovar = value; + OnPropertyChanged("EnableRenovar"); + } + } + + public List FilterCliente(List clientes, string searchText) + { + return clientes.Where((Cliente x) => x.Nome.ToUpper().Contains(searchText.ToUpper()) || (x.Documento != null && x.Documento.Contains(searchText)) || (x.Rne != null && x.Rne.Contains(searchText)) || (x.Cei != null && x.Cei.Contains(searchText))).ToList(); + } + + internal async Task> BuscarClienteEmpresa(string value) + { + return await Task.Run(() => new BaseServico().BuscarClienteEmpresa(value)); + } + + internal async Task> BuscarCliente(string value, List vinculos = null, TipoFiltroCliente tipoFiltroCliente = 2) + { + //IL_001e: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + return await new ClienteServico().BuscarCliente(value, vinculos, tipoFiltroCliente); + } + + internal async Task> BuscarClienteVinculo(string value, long id) + { + return await Task.Run(() => new ClienteServico().BuscarClienteVinculo(value, id)); + } + + internal async Task> BuscarProfissao(string value) + { + return await Task.Run(() => new BaseServico().BuscarProfissao(value)); + } + + internal async Task> BuscarAtividade(string value) + { + return await Task.Run(() => new BaseServico().BuscarAtividade(value)); + } + + internal async Task> BuscaFabricante(string value) + { + return await Task.Run(() => new BaseServico().BuscarFabricante(value)); + } + + internal async Task> BuscarUsuario(string value) + { + return await Task.Run(() => new BaseServico().BuscarUsuario(value)); + } + + internal async Task ShowDetalheExtrato(List detalhes) + { + DialogHost host = GetHost(); + if (host == null || !host.IsOpen) + { + DialogDetalheExtrato dialogControl = new DialogDetalheExtrato(detalhes); + await ExecuteRunExtendedDialogDetalheExtrato((UserControl)(object)dialogControl, (host != null) ? host.Identifier.ToString() : "RootDialog"); + } + } + + public async Task ExecuteRunExtendedDialogDetalheExtrato(UserControl dialogControl, string hostName) + { + Extentions.FindVisualChildren((DependencyObject)(object)((IEnumerable)Application.Current.Windows).OfType().SingleOrDefault((Func)((Window x) => x.IsActive))).ToList().ForEach(delegate(WebEditor x) + { + ((UIElement)x).Visibility = (Visibility)2; + }); + await DialogHost.Show((object)dialogControl, (object)hostName, new DialogOpenedEventHandler(base.ExtendedOpenedEventHandler), new DialogClosingEventHandler(base.ExtendedClosingEventHandler)); + } + + internal async Task ShowBuscaModeloDialog(string modelo, string ano) + { + DialogHost host = GetHost(); + if (host != null && host.IsOpen) + { + return null; + } + BuscarModeloView dialogControl = new BuscarModeloView(new BuscarModeloViewModel(modelo, ano)); + return await ExecuteRunExtendedDialogBuscaModelo((UserControl)(object)dialogControl, (host != null) ? host.Identifier.ToString() : "RootDialog"); + } + + internal async Task ShowEditarParcelasDialog(Documento documento) + { + DialogHost host = GetHost(); + if (host == null || !host.IsOpen) + { + DialogEditarParcelas dialogControl = new DialogEditarParcelas(documento); + await ExecuteRunExtendedDialogEditarParcelas((UserControl)(object)dialogControl, (host != null) ? host.Identifier.ToString() : "RootDialog"); + } + } + + public async Task ExecuteRunExtendedDialogEditarParcelas(UserControl dialogControl, string hostName) + { + Extentions.FindVisualChildren((DependencyObject)(object)((IEnumerable)Application.Current.Windows).OfType().SingleOrDefault((Func)((Window x) => x.IsActive))).ToList().ForEach(delegate(WebEditor x) + { + ((UIElement)x).Visibility = (Visibility)2; + }); + await DialogHost.Show((object)dialogControl, (object)hostName, new DialogOpenedEventHandler(base.ExtendedOpenedEventHandler), new DialogClosingEventHandler(base.ExtendedClosingEventHandler)); + } + + internal async Task ShowObservacaoDialog() + { + DialogHost host = GetHost(); + if (host != null && host.IsOpen) + { + return null; + } + DialogObservacao dialogControl = new DialogObservacao(); + return await ExecuteRunExtendedDialogObservacao((UserControl)(object)dialogControl, (host != null) ? host.Identifier.ToString() : "RootDialog"); + } + + public async Task ExecuteRunExtendedDialogObservacao(UserControl dialogControl, string hostName) + { + Extentions.FindVisualChildren((DependencyObject)(object)((IEnumerable)Application.Current.Windows).OfType().SingleOrDefault((Func)((Window x) => x.IsActive))).ToList().ForEach(delegate(WebEditor x) + { + ((UIElement)x).Visibility = (Visibility)2; + }); + object obj = await DialogHost.Show((object)dialogControl, (object)hostName, new DialogOpenedEventHandler(base.ExtendedOpenedEventHandler), new DialogClosingEventHandler(base.ExtendedClosingEventHandler)); + if (obj is bool) + { + return null; + } + return (string)obj; + } + + public async Task ExecuteRunExtendedDialogBuscaModelo(UserControl dialogControl, string hostName) + { + Extentions.FindVisualChildren((DependencyObject)(object)((IEnumerable)Application.Current.Windows).OfType().SingleOrDefault((Func)((Window x) => x.IsActive))).ToList().ForEach(delegate(WebEditor x) + { + ((UIElement)x).Visibility = (Visibility)2; + }); + object obj = await DialogHost.Show((object)dialogControl, (object)hostName, new DialogOpenedEventHandler(base.ExtendedOpenedEventHandler), new DialogClosingEventHandler(base.ExtendedClosingEventHandler)); + if (obj is bool) + { + return null; + } + return (Fipe)obj; + } + + internal async Task ShowVinculoDialog(VinculoRepasse vinculo, List repasses, Repasse repasse) + { + DialogHost host = GetHost(); + if (host != null && host.IsOpen) + { + return null; + } + DialogVinculo dialogControl = new DialogVinculo(vinculo, repasses, repasse); + return await ExecuteRunExtendedDialogVinculo((UserControl)(object)dialogControl, (host != null) ? host.Identifier.ToString() : "RootDialog"); + } + + public async Task ExecuteRunExtendedDialogVinculo(UserControl dialogControl, string hostName) + { + Extentions.FindVisualChildren((DependencyObject)(object)((IEnumerable)Application.Current.Windows).OfType().SingleOrDefault((Func)((Window x) => x.IsActive))).ToList().ForEach(delegate(WebEditor x) + { + ((UIElement)x).Visibility = (Visibility)2; + }); + object obj = await DialogHost.Show((object)dialogControl, (object)hostName, new DialogOpenedEventHandler(base.ExtendedOpenedEventHandler), new DialogClosingEventHandler(base.ExtendedClosingEventHandler)); + if (obj is bool) + { + return null; + } + return (VinculoRepasse)obj; + } + + internal async Task ShowTarefaDialog(Tarefa tarefa, bool nota = false, bool agendamento = false) + { + DialogHost host = GetHost(); + if (host != null && host.IsOpen) + { + return null; + } + List telefones = new List(); + if (tarefa != null && tarefa.IdCliente > 0) + { + telefones = (await new ClienteServico().BuscarTelefonesAsync(tarefa.IdCliente)).Where((ClienteTelefone x) => ValidationHelper.ValidacaoTelefone(((TelefoneBase)x).Numero)).Select((Func)((ClienteTelefone x) => new TelefoneBase + { + Tipo = ((TelefoneBase)x).Tipo, + Id = ((DomainBase)x).Id, + Numero = ((TelefoneBase)x).Numero, + Prefixo = ((TelefoneBase)x).Prefixo + })).ToList(); + } + DialogTarefa dialogControl = new DialogTarefa(tarefa, telefones, nota, agendamento); + return await ExecuteRunExtendedDialogTarefa((UserControl)(object)dialogControl, (host != null) ? host.Identifier.ToString() : "RootDialog"); + } + + internal async Task> ShowSelecionarItensDialog(long id) + { + DialogHost host = GetHost(); + if (host != null && host.IsOpen) + { + return null; + } + DialogSelecionarItens dialogControl = new DialogSelecionarItens(id); + return await ExecuteRunExtendedDialogSelecionarItens((UserControl)(object)dialogControl, (host != null) ? host.Identifier.ToString() : "RootDialog"); + } + + internal async Task> ShowReordenarItensDialog(List ids) + { + DialogHost host = GetHost(); + if (host != null && host.IsOpen) + { + return null; + } + DialogReordenarItens dialogControl = new DialogReordenarItens(ids); + return await ExecuteRunExtendedDialogReordenarItens((UserControl)(object)dialogControl, (host != null) ? host.Identifier.ToString() : "RootDialog"); + } + + internal async Task> ShowProtocoloDialog(List itens) + { + DialogHost host = GetHost(); + if (host != null && host.IsOpen) + { + return null; + } + DialogProtocolo dialogControl = new DialogProtocolo(itens); + return await ExecuteRunExtendedDialogProtocolo((UserControl)(object)dialogControl, (host != null) ? host.Identifier.ToString() : "RootDialog"); + } + + public async Task> ExecuteRunExtendedDialogProtocolo(UserControl dialogControl, string hostName) + { + Extentions.FindVisualChildren((DependencyObject)(object)((IEnumerable)Application.Current.Windows).OfType().SingleOrDefault((Func)((Window x) => x.IsActive))).ToList().ForEach(delegate(WebEditor x) + { + ((UIElement)x).Visibility = (Visibility)2; + }); + object obj = await DialogHost.Show((object)dialogControl, (object)hostName, new DialogOpenedEventHandler(base.ExtendedOpenedEventHandler), new DialogClosingEventHandler(base.ExtendedClosingEventHandler)); + if (obj == null || obj is bool) + { + return null; + } + return ((ObservableCollection)obj).ToList(); + } + + public async Task> ExecuteRunExtendedDialogReordenarItens(UserControl dialogControl, string hostName) + { + Extentions.FindVisualChildren((DependencyObject)(object)((IEnumerable)Application.Current.Windows).OfType().SingleOrDefault((Func)((Window x) => x.IsActive))).ToList().ForEach(delegate(WebEditor x) + { + ((UIElement)x).Visibility = (Visibility)2; + }); + object obj = await DialogHost.Show((object)dialogControl, (object)hostName, new DialogOpenedEventHandler(base.ExtendedOpenedEventHandler), new DialogClosingEventHandler(base.ExtendedClosingEventHandler)); + if (obj == null || obj is bool) + { + return null; + } + return (ObservableCollection)obj; + } + + public async Task> ExecuteRunExtendedDialogSelecionarItens(UserControl dialogControl, string hostName) + { + Extentions.FindVisualChildren((DependencyObject)(object)((IEnumerable)Application.Current.Windows).OfType().SingleOrDefault((Func)((Window x) => x.IsActive))).ToList().ForEach(delegate(WebEditor x) + { + ((UIElement)x).Visibility = (Visibility)2; + }); + object obj = await DialogHost.Show((object)dialogControl, (object)hostName, new DialogOpenedEventHandler(base.ExtendedOpenedEventHandler), new DialogClosingEventHandler(base.ExtendedClosingEventHandler)); + if (obj is bool) + { + return null; + } + return (ObservableCollection)obj; + } + + internal async Task, Usuario, List, List, List>> ShowCopiarPermissaoDialog() + { + DialogHost host = GetHost(); + if (host != null && host.IsOpen) + { + return null; + } + DialogCopiarPermissao dialogControl = new DialogCopiarPermissao(new DialogCopiarPermissaoViewModel()); + return await ExecuteRunExtendedDialogCopiarPermiss((UserControl)(object)dialogControl, (host != null) ? host.Identifier.ToString() : "RootDialog"); + } + + internal async Task> ShowExportarPermissaoDialog(long idUsuario) + { + DialogHost host = GetHost(); + if (host != null && host.IsOpen) + { + return null; + } + DialogExportarPermissao dialogControl = new DialogExportarPermissao(new DialogExportarPermissaoViewModel(idUsuario)); + return await ExecuteRunExtendedDialogExportarPermiss((UserControl)(object)dialogControl, (host != null) ? host.Identifier.ToString() : "RootDialog"); + } + + internal async Task ShowLogAcessoDialog(TipoTela tela, Usuario usuario) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + DialogHost host = GetHost(); + if (host == null || !host.IsOpen) + { + DialogLogAcesso dialogControl = new DialogLogAcesso(tela, usuario); + await ExecuteRunExtendedDialogEnviarEmails((UserControl)(object)dialogControl, (host != null) ? host.Identifier.ToString() : "RootDialog"); + } + } + + public async Task ExecuteRunExtendedDialogLogAcesso(UserControl dialogControl, string hostName) + { + Extentions.FindVisualChildren((DependencyObject)(object)((IEnumerable)Application.Current.Windows).OfType().SingleOrDefault((Func)((Window x) => x.IsActive))).ToList().ForEach(delegate(WebEditor x) + { + ((UIElement)x).Visibility = (Visibility)2; + }); + await DialogHost.Show((object)dialogControl, (object)hostName, new DialogOpenedEventHandler(base.ExtendedOpenedEventHandler), new DialogClosingEventHandler(base.ExtendedClosingEventHandler)); + } + + internal async Task ShowEnviarEmailsDialog(List lista, bool assinatura, bool original, List arquivosAnexados, string assunto, string corpo, Credencial credencial, FiltroArquivoDigital filtro, bool salvarAd, bool confirmarLeitura) + { + DialogHost host = GetHost(); + if (host == null || !host.IsOpen) + { + DialogEnviarEmails dialogControl = new DialogEnviarEmails(new DialogEnviarEmailsViewModel(lista, assinatura, original, arquivosAnexados, assunto, corpo, credencial, filtro, salvarAd, confirmarLeitura)); + await ExecuteRunExtendedDialogEnviarEmails((UserControl)(object)dialogControl, (host != null) ? host.Identifier.ToString() : "RootDialog"); + } + } + + internal async Task ShowPesquisaAvancadaDialog() + { + DialogHost host = GetHost(); + if (host != null && host.IsOpen) + { + return null; + } + DialogPesquisaAvancadaViewModel dialogPesquisaAvancadaViewModel = new DialogPesquisaAvancadaViewModel(); + DialogPesquisaAvancada dialogPesquisaAvancada = new DialogPesquisaAvancada(dialogPesquisaAvancadaViewModel); + ((FrameworkElement)dialogPesquisaAvancada).DataContext = dialogPesquisaAvancadaViewModel; + DialogPesquisaAvancada dialogControl = dialogPesquisaAvancada; + return await ExecuteRunExtendedDialogPesquisaAvancada((UserControl)(object)dialogControl, (host != null) ? host.Identifier.ToString() : "RootDialog"); + } + + public async Task ExecuteRunExtendedDialogTarefa(UserControl dialogControl, string hostName) + { + Extentions.FindVisualChildren((DependencyObject)(object)((IEnumerable)Application.Current.Windows).OfType().SingleOrDefault((Func)((Window x) => x.IsActive))).ToList().ForEach(delegate(WebEditor x) + { + ((UIElement)x).Visibility = (Visibility)2; + }); + object obj = await DialogHost.Show((object)dialogControl, (object)hostName, new DialogOpenedEventHandler(base.ExtendedOpenedEventHandler), new DialogClosingEventHandler(base.ExtendedClosingEventHandler)); + if (obj is bool) + { + return null; + } + return (Tarefa)obj; + } + + public async Task, Usuario, List, List, List>> ExecuteRunExtendedDialogCopiarPermiss(UserControl dialogControl, string hostName) + { + Extentions.FindVisualChildren((DependencyObject)(object)((IEnumerable)Application.Current.Windows).OfType().SingleOrDefault((Func)((Window x) => x.IsActive))).ToList().ForEach(delegate(WebEditor x) + { + ((UIElement)x).Visibility = (Visibility)2; + }); + object obj = await DialogHost.Show((object)dialogControl, (object)hostName, new DialogOpenedEventHandler(base.ExtendedOpenedEventHandler), new DialogClosingEventHandler(base.ExtendedClosingEventHandler)); + if (obj is bool) + { + return null; + } + return (Tuple, Usuario, List, List, List>)obj; + } + + public async Task> ExecuteRunExtendedDialogExportarPermiss(UserControl dialogControl, string hostName) + { + Extentions.FindVisualChildren((DependencyObject)(object)((IEnumerable)Application.Current.Windows).OfType().SingleOrDefault((Func)((Window x) => x.IsActive))).ToList().ForEach(delegate(WebEditor x) + { + ((UIElement)x).Visibility = (Visibility)2; + }); + object obj = await DialogHost.Show((object)dialogControl, (object)hostName, new DialogOpenedEventHandler(base.ExtendedOpenedEventHandler), new DialogClosingEventHandler(base.ExtendedClosingEventHandler)); + if (obj is bool) + { + return null; + } + return (List)obj; + } + + public async Task ExecuteRunExtendedDialogEnviarEmails(UserControl dialogControl, string hostName) + { + Extentions.FindVisualChildren((DependencyObject)(object)((IEnumerable)Application.Current.Windows).OfType().SingleOrDefault((Func)((Window x) => x.IsActive))).ToList().ForEach(delegate(WebEditor x) + { + ((UIElement)x).Visibility = (Visibility)2; + }); + await DialogHost.Show((object)dialogControl, (object)hostName, new DialogOpenedEventHandler(base.ExtendedOpenedEventHandler), new DialogClosingEventHandler(base.ExtendedClosingEventHandler)); + } + + public async Task ExecuteRunExtendedDialogPesquisaAvancada(UserControl dialogControl, string hostName) + { + Extentions.FindVisualChildren((DependencyObject)(object)((IEnumerable)Application.Current.Windows).OfType().SingleOrDefault((Func)((Window x) => x.IsActive))).ToList().ForEach(delegate(WebEditor x) + { + ((UIElement)x).Visibility = (Visibility)2; + }); + object obj = await DialogHost.Show((object)dialogControl, (object)hostName, new DialogOpenedEventHandler(base.ExtendedOpenedEventHandler), new DialogClosingEventHandler(base.ExtendedClosingEventHandler)); + if (obj is bool) + { + return null; + } + return (PesquisaAvancada)obj; + } + + public async Task CarregaApolice(long id) + { + return await new ApoliceServico().BuscarApoliceAsync(id); + } + + public async Task CarregaCliente(long id) + { + return await new ClienteServico().BuscarClienteAsync(id); + } + + public async Task CarregaSinistroApolice(long id) + { + return await new SinistroServico().BuscarSinistro(id); + } + + public async Task CarregaApoliceParcela(long id) + { + return await new ParcelaServico().BuscarApolice(id); + } + + public async Task CarregaParcela(long id) + { + return await new ParcelaServico().BuscarParcela(id); + } + + public async Task CarregarProspeccao(long id) + { + return await new ProspeccaoServico().BuscarProspeccao(id); + } + + public async Task> CarregarItem(long id, StatusItem status = 2) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + return (await new ItemServico().BuscarItens(id, status)).ToList(); + } + + public async Task CreateLinkAssistencia(Documento documento, string item, bool retorno = true) + { + if (documento == null) + { + return ""; + } + return $"{Address.Assistance}{((DomainBase)documento).Id.GeraAssistencia()}"; + } + + public async Task CreateCardLogo(Empresa empresa, string id = null) + { + if (empresa == null) + { + return ""; + } + Logo logo = new Logo + { + CustomId = ApplicationHelper.NumeroSerial, + Data = empresa.Logo, + Corretora = ((!string.IsNullOrEmpty(empresa.NomeSocial)) ? empresa.NomeSocial : empresa.Nome), + Whatsapp = empresa.Whatsapp, + WhatsappSinistro = empresa.WhatsappSinistro + }; + string text = ((!string.IsNullOrWhiteSpace(id)) ? (await logo.Atualizarlogo(id)) : (await logo.Criarlogo())); + id = text; + return id; + } + + public async Task CreateSeguradora(Seguradora seguradora, string id = null) + { + if (seguradora == null) + { + return ""; + } + int index = 1; + AssistenciaCia assistencia = new AssistenciaCia + { + Seguradora = seguradora.Nome, + IdSeguradora = ((DomainBase)seguradora).Id, + LinkAppAndroid = seguradora.LinkAppAndroid, + LinkAppIos = seguradora.LinkAppIos, + CustomId = ApplicationHelper.NumeroSerial + }; + seguradora.Contatos.OrderBy((SeguradoraContato x) => ((object)((TelefoneBase)x).Tipo.GetValueOrDefault((TipoTelefone)7)).GetType()).ToList().ForEach(delegate(SeguradoraContato x) + { + //IL_0121: Unknown result type (might be due to invalid IL or missing references) + //IL_0208: Unknown result type (might be due to invalid IL or missing references) + //IL_02ef: Unknown result type (might be due to invalid IL or missing references) + //IL_003a: Unknown result type (might be due to invalid IL or missing references) + //IL_0160: Unknown result type (might be due to invalid IL or missing references) + //IL_0167: Invalid comparison between Unknown and I4 + //IL_014e: Unknown result type (might be due to invalid IL or missing references) + //IL_0155: Invalid comparison between Unknown and I4 + //IL_0247: Unknown result type (might be due to invalid IL or missing references) + //IL_024e: Invalid comparison between Unknown and I4 + //IL_0235: Unknown result type (might be due to invalid IL or missing references) + //IL_023c: Invalid comparison between Unknown and I4 + //IL_032e: Unknown result type (might be due to invalid IL or missing references) + //IL_0335: Invalid comparison between Unknown and I4 + //IL_031c: Unknown result type (might be due to invalid IL or missing references) + //IL_0323: Invalid comparison between Unknown and I4 + //IL_0079: Unknown result type (might be due to invalid IL or missing references) + //IL_0080: Invalid comparison between Unknown and I4 + //IL_0067: Unknown result type (might be due to invalid IL or missing references) + //IL_006e: Invalid comparison between Unknown and I4 + //IL_0172: Unknown result type (might be due to invalid IL or missing references) + //IL_0178: Invalid comparison between Unknown and I4 + //IL_0259: Unknown result type (might be due to invalid IL or missing references) + //IL_025f: Invalid comparison between Unknown and I4 + //IL_0340: Unknown result type (might be due to invalid IL or missing references) + //IL_0346: Invalid comparison between Unknown and I4 + //IL_008b: Unknown result type (might be due to invalid IL or missing references) + //IL_0091: Invalid comparison between Unknown and I4 + switch (index) + { + default: + assistencia.Assistencia1Tipo = ((!((TelefoneBase)x).Tipo.HasValue) ? 10 : ((int)((TelefoneBase)x).Tipo.Value)); + assistencia.Assistencia1 = ((((TelefoneBase)x).Tipo.HasValue && (int)((TelefoneBase)x).Tipo.GetValueOrDefault() == 10) ? ("0800-" + ((TelefoneBase)x).Numero) : (((int)((TelefoneBase)x).Tipo.GetValueOrDefault() == 11) ? ("0300-" + ((TelefoneBase)x).Numero) : (((int)((TelefoneBase)x).Tipo.GetValueOrDefault() == 7 && string.IsNullOrEmpty(((TelefoneBase)x).Prefixo)) ? ((TelefoneBase)x).Numero : ("(" + ((TelefoneBase)x).Prefixo + ") " + ((TelefoneBase)x).Numero)))); + assistencia.Assistencia1Obs = x.NomeContato; + break; + case 2: + assistencia.Assistencia2Tipo = ((!((TelefoneBase)x).Tipo.HasValue) ? 10 : ((int)((TelefoneBase)x).Tipo.Value)); + assistencia.Assistencia2 = ((((TelefoneBase)x).Tipo.HasValue && (int)((TelefoneBase)x).Tipo.GetValueOrDefault() == 10) ? ("0800-" + ((TelefoneBase)x).Numero) : (((int)((TelefoneBase)x).Tipo.GetValueOrDefault() == 11) ? ("0300-" + ((TelefoneBase)x).Numero) : (((int)((TelefoneBase)x).Tipo.GetValueOrDefault() == 7 && string.IsNullOrEmpty(((TelefoneBase)x).Prefixo)) ? ((TelefoneBase)x).Numero : ("(" + ((TelefoneBase)x).Prefixo + ") " + ((TelefoneBase)x).Numero)))); + assistencia.Assistencia2Obs = x.NomeContato; + break; + case 3: + assistencia.Assistencia3Tipo = ((!((TelefoneBase)x).Tipo.HasValue) ? 10 : ((int)((TelefoneBase)x).Tipo.Value)); + assistencia.Assistencia3 = ((((TelefoneBase)x).Tipo.HasValue && (int)((TelefoneBase)x).Tipo.GetValueOrDefault() == 10) ? ("0800-" + ((TelefoneBase)x).Numero) : (((int)((TelefoneBase)x).Tipo.GetValueOrDefault() == 11) ? ("0300-" + ((TelefoneBase)x).Numero) : (((int)((TelefoneBase)x).Tipo.GetValueOrDefault() == 7 && string.IsNullOrEmpty(((TelefoneBase)x).Prefixo)) ? ((TelefoneBase)x).Numero : ("(" + ((TelefoneBase)x).Prefixo + ") " + ((TelefoneBase)x).Numero)))); + assistencia.Assistencia3Obs = x.NomeContato; + break; + case 4: + assistencia.Assistencia4Tipo = ((!((TelefoneBase)x).Tipo.HasValue) ? 10 : ((int)((TelefoneBase)x).Tipo.Value)); + assistencia.Assistencia4 = ((((TelefoneBase)x).Tipo.HasValue && (int)((TelefoneBase)x).Tipo.GetValueOrDefault() == 10) ? ("0800-" + ((TelefoneBase)x).Numero) : (((int)((TelefoneBase)x).Tipo.GetValueOrDefault() == 11) ? ("0300-" + ((TelefoneBase)x).Numero) : (((int)((TelefoneBase)x).Tipo.GetValueOrDefault() == 7 && string.IsNullOrEmpty(((TelefoneBase)x).Prefixo)) ? ((TelefoneBase)x).Numero : ("(" + ((TelefoneBase)x).Prefixo + ") " + ((TelefoneBase)x).Numero)))); + assistencia.Assistencia4Obs = x.NomeContato; + break; + } + index++; + }); + string text = ((!string.IsNullOrWhiteSpace(id)) ? (await assistencia.AtualizarSeguradora(id)) : (await assistencia.CriarSeguradora())); + id = text; + return id; + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Generic/BaseTarefaViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Generic/BaseTarefaViewModel.cs new file mode 100644 index 0000000..8f2eb16 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Generic/BaseTarefaViewModel.cs @@ -0,0 +1,105 @@ +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Model.Common; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Generic; + +public abstract class BaseTarefaViewModel : BaseSegurosViewModel +{ + private ObservableCollection _responsaveis = new ObservableCollection(); + + private bool _hasResponsaveis; + + public TarefaServico Servico { get; set; } + + public abstract Tarefa SelectedTarefa { get; set; } + + public abstract bool EnableAlterarTarefa { get; set; } + + public ObservableCollection Responsaveis + { + get + { + return _responsaveis; + } + set + { + _responsaveis = value; + HasResponsaveis = value != null && value.Count > 0; + OnPropertyChanged("Responsaveis"); + } + } + + public bool HasResponsaveis + { + get + { + return _hasResponsaveis; + } + set + { + _hasResponsaveis = value; + OnPropertyChanged("HasResponsaveis"); + } + } + + public async Task ValidaPermissaoParaEditarTarefa() + { + bool flag = false; + bool flag3; + if (SelectedTarefa == null) + { + BaseTarefaViewModel baseTarefaViewModel = this; + BaseTarefaViewModel baseTarefaViewModel2 = this; + flag3 = (EnableAlterarTarefa = flag); + bool enableAlterar = (baseTarefaViewModel2.EnableExcluir = flag3); + baseTarefaViewModel.EnableAlterar = enableAlterar; + return flag; + } + PermissaoUsuario val = await BuscaPermisaoUsuario(); + flag = Recursos.Usuario.Administrador || (val == null && !SelectedTarefa.Restrito.GetValueOrDefault()) || ((val == null || val.Alterar) && (!SelectedTarefa.Restrito.GetValueOrDefault() || ((DomainBase)SelectedTarefa.UsuarioCadastro).Id == ((DomainBase)Recursos.Usuario).Id || (SelectedTarefa.Responsaveis?.Any((ResponsavelTarefa x) => ((DomainBase)x.Usuario).Id == ((DomainBase)Recursos.Usuario).Id) ?? false) || ((DomainBase)SelectedTarefa.Usuario).Id == ((DomainBase)Recursos.Usuario).Id)); + BaseTarefaViewModel baseTarefaViewModel3 = this; + BaseTarefaViewModel baseTarefaViewModel4 = this; + bool flag6 = (EnableAlterarTarefa = flag); + flag3 = (baseTarefaViewModel4.EnableExcluir = flag6); + return baseTarefaViewModel3.EnableAlterar = flag3; + } + + internal async Task BuscaPermisaoUsuario() + { + return await new PermissaoUsuarioServico().VerificarPermissao(Recursos.Usuario, (TipoTela)38); + } + + public async Task ValidaPermissaoParaExcluirTarefa(Tarefa tarefa = null) + { + if (tarefa != null) + { + SelectedTarefa = tarefa; + } + PermissaoUsuario val = await BuscaPermisaoUsuario(); + return Recursos.Usuario.Administrador || (val == null && !SelectedTarefa.Restrito.GetValueOrDefault()) || ((val == null || val.Excluir) && (!SelectedTarefa.Restrito.GetValueOrDefault() || ((DomainBase)SelectedTarefa.UsuarioCadastro).Id == ((DomainBase)Recursos.Usuario).Id || (SelectedTarefa.Responsaveis?.Any((ResponsavelTarefa x) => ((DomainBase)x.Usuario).Id == ((DomainBase)Recursos.Usuario).Id) ?? false) || ((DomainBase)SelectedTarefa.Usuario).Id == ((DomainBase)Recursos.Usuario).Id)); + } + + public void ListaUsuariosResponsaveis() + { + //IL_0035: Unknown result type (might be due to invalid IL or missing references) + //IL_003a: Unknown result type (might be due to invalid IL or missing references) + //IL_004b: Unknown result type (might be due to invalid IL or missing references) + //IL_0061: Expected O, but got Unknown + Tarefa selectedTarefa = SelectedTarefa; + if (((selectedTarefa != null) ? selectedTarefa.Usuario : null) != null && !Responsaveis.Any((ResponsavelTarefa r) => ((DomainBase)r.Usuario).Id == ((DomainBase)SelectedTarefa.Usuario).Id)) + { + Responsaveis.Insert(0, new ResponsavelTarefa + { + IdTarefa = ((DomainBase)SelectedTarefa).Id, + Usuario = SelectedTarefa.Usuario + }); + } + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Generic/BaseViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Generic/BaseViewModel.cs new file mode 100644 index 0000000..d48c992 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Generic/BaseViewModel.cs @@ -0,0 +1,2102 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Runtime.CompilerServices; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Forms; +using System.Windows.Threading; +using Agger.Registro; +using Gestor.Application.Actions; +using Gestor.Application.Componentes; +using Gestor.Application.Drawers; +using Gestor.Application.Helpers; +using Gestor.Application.Model; +using Gestor.Application.Properties; +using Gestor.Application.Servicos; +using Gestor.Application.Servicos.Ferramentas; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.Servicos.Seguros.Itens; +using Gestor.Common.Helpers; +using Gestor.Common.Validation; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Aggilizador; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Financeiro; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.MalaDireta; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.License; +using MaterialDesignThemes.Wpf; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using Xceed.Wpf.AvalonDock.Controls; + +namespace Gestor.Application.ViewModels.Generic; + +public abstract class BaseViewModel : INotifyPropertyChanged +{ + public ArquivoDigitalServico ArquivoDigitalServico; + + public PermissaoArquivoDigitalServico ServicoPermissArquivoDigital; + + public PermissaoUsuarioServico ServicoPermissUsuario; + + public RestricaoUsuarioServico ServicoRestriUsuario; + + public VendedorUsuarioServico ServicoVendedorUsuario; + + public bool _incluirPermissEnabled; + + public bool _alterarPermissEnabled; + + public bool _excluirPermissEnabled; + + public long LastAccessId; + + public TipoTela LastAccessTela; + + private bool _enableButtons = true; + + private bool _enableIncluir = true; + + private bool _isVisibleEmpresa; + + private bool _enableAlterar; + + private bool _enableExcluir; + + private long? _lastId; + + private bool _incluirParcelaEnabled; + + private bool _alterarParcelaEnabled; + + private bool _excluirParcelaEnabled; + + private bool _permissaoWhatsapp; + + public bool Initialized; + + private bool _enableFields; + + private bool _allowEditParcela; + + private bool _isEnableEdit; + + private bool _isEnabledEditEndosso; + + private bool _enableMenu; + + private bool _enableMainMenu; + + private bool _isEnabled; + + private Visibility _isVisible; + + private object _popupContent; + + public bool EnableButtons + { + get + { + return _enableButtons; + } + set + { + _enableButtons = value; + OnPropertyChanged("EnableButtons"); + } + } + + public bool EnableIncluir + { + get + { + return _enableIncluir; + } + set + { + _enableIncluir = _incluirPermissEnabled && value; + OnPropertyChanged("EnableIncluir"); + } + } + + public bool IsVisibleEmpresa + { + get + { + return _isVisibleEmpresa; + } + set + { + _isVisibleEmpresa = value; + OnPropertyChanged("IsVisibleEmpresa"); + } + } + + public bool EnableAlterar + { + get + { + return _enableAlterar; + } + set + { + _enableAlterar = _alterarPermissEnabled && value; + OnPropertyChanged("EnableAlterar"); + } + } + + public bool EnableExcluir + { + get + { + return _enableExcluir; + } + set + { + _enableExcluir = _excluirPermissEnabled && value; + OnPropertyChanged("EnableExcluir"); + } + } + + public bool IncluirParcelaEnabled + { + get + { + return _incluirParcelaEnabled; + } + set + { + _incluirParcelaEnabled = value; + OnPropertyChanged("IncluirParcelaEnabled"); + } + } + + public bool AlterarParcelaEnabled + { + get + { + return _alterarParcelaEnabled; + } + set + { + _alterarParcelaEnabled = value; + OnPropertyChanged("AlterarParcelaEnabled"); + } + } + + public bool ExcluirParcelaEnabled + { + get + { + return _excluirParcelaEnabled; + } + set + { + _excluirParcelaEnabled = value; + OnPropertyChanged("ExcluirParcelaEnabled"); + } + } + + public bool PermissaoWhatsapp + { + get + { + return _permissaoWhatsapp; + } + set + { + _permissaoWhatsapp = value; + OnPropertyChanged("PermissaoWhatsapp"); + } + } + + public bool EnableFields + { + get + { + return _enableFields; + } + set + { + _enableFields = value; + OnPropertyChanged("EnableFields"); + } + } + + public bool AllowEditParcela + { + get + { + return _allowEditParcela; + } + set + { + _allowEditParcela = value; + OnPropertyChanged("AllowEditParcela"); + } + } + + public bool IsEnabledEdit + { + get + { + return _isEnableEdit; + } + set + { + _isEnableEdit = value; + OnPropertyChanged("IsEnabledEdit"); + } + } + + public bool IsEnabledEditEndosso + { + get + { + return _isEnabledEditEndosso; + } + set + { + _isEnabledEditEndosso = value; + OnPropertyChanged("IsEnabledEditEndosso"); + } + } + + public bool EnableMenu + { + get + { + return _enableMenu; + } + set + { + _enableMenu = value; + OnPropertyChanged("EnableMenu"); + } + } + + public bool EnableMainMenu + { + get + { + return _enableMainMenu; + } + set + { + _enableMainMenu = value; + OnPropertyChanged("EnableMainMenu"); + } + } + + public bool IsEnabled + { + get + { + return _isEnabled; + } + set + { + _isEnabled = value; + OnPropertyChanged("IsEnabled"); + } + } + + public Visibility IsVisible + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _isVisible; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _isVisible = value; + OnPropertyChanged("IsVisible"); + } + } + + public string ErroCamposInvalidos { get; } + + public object PopupContent + { + get + { + return _popupContent; + } + set + { + _popupContent = value; + OnPropertyChanged("PopupContent"); + } + } + + public AutoCompleteFilterPredicate CoberturaItemFilter => (string searchText, object obj) => ((CoberturaPadrao)obj).Descricao.ToUpper().Contains(searchText.ToUpper()); + + public event PropertyChangedEventHandler PropertyChanged; + + protected BaseViewModel() + { + //IL_00b3: Unknown result type (might be due to invalid IL or missing references) + int isVisibleEmpresa; + if (LicenseHelper.Produtos != null && LicenseHelper.Produtos.Any((Licenca x) => (int)x.Produto == 2 && x.Status == 1)) + { + Empresa empresa = Recursos.Empresa; + isVisibleEmpresa = ((empresa != null && ((DomainBase)empresa).Id == 1) ? 1 : 0); + } + else + { + isVisibleEmpresa = 0; + } + _isVisibleEmpresa = (byte)isVisibleEmpresa != 0; + _enableAlterar = true; + _enableExcluir = true; + _permissaoWhatsapp = true; + _allowEditParcela = true; + _isEnableEdit = true; + _isEnabledEditEndosso = true; + Usuario usuario = Recursos.Usuario; + _enableMenu = usuario != null && ((DomainBase)usuario).Id > 0; + _enableMainMenu = true; + _isEnabled = true; + _isVisible = (Visibility)2; + ErroCamposInvalidos = "HÁ CAMPOS DESTACADOS QUE DEVEM SER PREENCHIDOS CORRETAMENTE." + Environment.NewLine + "REALIZE A CORREÇÃO E TENTE NOVAMENTE."; + base._002Ector(); + ArquivoDigitalServico = new ArquivoDigitalServico(); + Gestor.Application.Actions.Actions.EnableMainMenu = (Action)Delegate.Combine(Gestor.Application.Actions.Actions.EnableMainMenu, new Action(HabilitarMenu)); + Gestor.Application.Actions.Actions.EnableMenu = (Action)Delegate.Combine(Gestor.Application.Actions.Actions.EnableMenu, new Action(HabilitarMenuSecundario)); + ServicoPermissArquivoDigital = new PermissaoArquivoDigitalServico(); + ServicoPermissUsuario = new PermissaoUsuarioServico(); + ServicoRestriUsuario = new RestricaoUsuarioServico(); + ServicoVendedorUsuario = new VendedorUsuarioServico(); + } + + public void VerificarEnables(long? id) + { + _lastId = id; + EnableIncluir = !id.HasValue || id.Value >= 0; + EnableAlterar = id.HasValue && id.Value > 0; + EnableExcluir = id.HasValue && id.Value > 0; + EnableButtons = id.HasValue && id.Value > 0; + } + + public async Task PermissaoConsultar(TipoTela tela) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + if (((DomainBase)Recursos.Usuario).Id == 0L) + { + return true; + } + PermissaoUsuario obj = await ServicoPermissUsuario.VerificarPermissao(Recursos.Usuario, tela); + return obj == null || obj.Consultar; + } + + public async Task PermissaoTela(TipoTela tela) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + EnableIncluir = false; + EnableAlterar = false; + EnableExcluir = false; + if (((DomainBase)Recursos.Usuario).Id != 0L) + { + PermissaoUsuario val = await ServicoPermissUsuario.VerificarPermissao(Recursos.Usuario, tela); + if ((int)tela == 5) + { + IncluirParcelaEnabled = val == null || val.Incluir; + AlterarParcelaEnabled = val == null || val.Alterar; + ExcluirParcelaEnabled = val == null || val.Excluir; + } + else if ((int)tela == 24 || (int)tela == 26 || (int)tela == 29 || (int)tela == 28 || (int)tela == 27) + { + _incluirPermissEnabled = true; + _alterarPermissEnabled = true; + _excluirPermissEnabled = true; + } + else + { + _incluirPermissEnabled = val == null || val.Incluir; + _alterarPermissEnabled = val == null || val.Alterar; + _excluirPermissEnabled = val == null || val.Excluir; + } + } + } + + public async Task PermissaoArquivoDigital(TipoArquivoDigital tela) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + EnableIncluir = false; + EnableExcluir = false; + if (((DomainBase)Recursos.Usuario).Id != 0L) + { + PermissaoArquivoDigital val = await ServicoPermissArquivoDigital.VerificarPermissao(Recursos.Usuario, tela); + _incluirPermissEnabled = val == null || val.Incluir; + _excluirPermissEnabled = val == null || val.Excluir; + } + } + + public async Task VerificarVersao() + { + bool flag; + try + { + string text = await Connection.Get($"Update/Stable?versao={ApplicationHelper.Versao}"); + flag = text != null && bool.Parse(text); + } + catch (Exception e) + { + new BaseServico().Registrar(e, (TipoErro)287, 3, ApplicationHelper.Versao.ToString(), abrirTela: false); + flag = false; + } + if (!flag) + { + ApplicationHelper.ChecagemVersao = Funcoes.GetNetworkTime(); + return; + } + await ShowMessage("HÁ UMA ATUALIZAÇÃO OBRIGATÓRIA A SER FEITA. O PROCESSO SERÁ CANCELADO PARA A ATUALIZAÇÃO"); + Application.Current.Shutdown(); + } + + public async void Alterar(bool alterar) + { + Gestor.Application.Actions.Actions.EnablePesquisarClientes?.Invoke(!alterar); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(!alterar); + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(!alterar); + EnableFields = alterar; + EnableMenu = !alterar; + if (!alterar) + { + VerificarEnables(_lastId); + } + else + { + EnableIncluir = false; + EnableAlterar = false; + EnableExcluir = false; + EnableButtons = false; + } + AllowEditParcela = !alterar; + IsEnabledEdit = !alterar; + IsEnabledEditEndosso = !alterar; + if ((Funcoes.GetNetworkTime() - ApplicationHelper.ChecagemVersao).TotalMinutes > 10.0) + { + await VerificarVersao(); + } + } + + private void HabilitarMenu(bool enable) + { + EnableMainMenu = enable; + } + + private void HabilitarMenuSecundario(bool enable) + { + EnableMenu = enable; + } + + public void OnPropertyChanged([CallerMemberName] string name = "") + { + this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name)); + } + + public void Loading(bool isLoading) + { + Grid progressRing = App.ProgressRing; + if (progressRing == null) + { + return; + } + Dispatcher dispatcher = ((DispatcherObject)progressRing).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)4, (Delegate)(Action)delegate + { + LoadingThread(isLoading); + }); + } + } + + public void LoadingThread(bool isLoading) + { + IsVisible = (Visibility)(isLoading ? 2 : 0); + ((UIElement)App.ProgressRing).Visibility = (Visibility)((!isLoading) ? 2 : 0); + IsEnabled = !isLoading; + } + + public async Task BuscaCep(string cep) + { + return await new CepService().SearchDirect(cep); + } + + internal void ShowDrawer(object content, int position, bool close = true) + { + Window? obj = ((IEnumerable)Application.Current.Windows).OfType().SingleOrDefault((Func)((Window x) => x.IsActive)); + DrawerHost val = Extentions.FindVisualChildren((DependencyObject)(object)obj).FirstOrDefault(); + Extentions.FindVisualChildren((DependencyObject)(object)obj).ToList().ForEach(delegate(WebEditor x) + { + ((UIElement)x).Visibility = (Visibility)2; + }); + if (val == null) + { + return; + } + switch (position) + { + case 1: + val.TopDrawerContent = content; + val.IsTopDrawerOpen = true; + val.TopDrawerCloseOnClickAway = close; + return; + case 2: + val.LeftDrawerContent = content; + val.IsLeftDrawerOpen = true; + val.LeftDrawerCloseOnClickAway = close; + return; + case 3: + val.BottomDrawerContent = content; + val.IsBottomDrawerOpen = true; + val.BottomDrawerCloseOnClickAway = close; + return; + } + if (val.IsRightDrawerOpen && (val.RightDrawerContent == null || val.RightDrawerContent.GetType() != content.GetType())) + { + val.LeftDrawerContent = content; + val.IsLeftDrawerOpen = true; + val.LeftDrawerCloseOnClickAway = close; + } + else + { + val.IsRightDrawerOpen = true; + val.RightDrawerContent = content; + val.RightDrawerCloseOnClickAway = close; + } + } + + internal void CloseDrawer() + { + Window? obj = ((IEnumerable)Application.Current.Windows).OfType().SingleOrDefault((Func)((Window x) => x.IsActive)); + DrawerHost val = Extentions.FindVisualChildren((DependencyObject)(object)obj).FirstOrDefault(); + Extentions.FindVisualChildren((DependencyObject)(object)obj).ToList().ForEach(delegate(WebEditor x) + { + ((UIElement)x).Visibility = (Visibility)0; + }); + if (val != null) + { + val.IsBottomDrawerOpen = false; + val.IsTopDrawerOpen = false; + if (val.IsLeftDrawerOpen) + { + val.IsLeftDrawerOpen = false; + } + else + { + val.IsRightDrawerOpen = false; + } + } + } + + internal DialogHost GetHost() + { + DialogHost val = Extentions.FindVisualChildren((DependencyObject)(object)((IEnumerable)Application.Current.Windows).OfType().SingleOrDefault((Func)((Window x) => x.IsActive))).FirstOrDefault(); + if (val == null) + { + foreach (Window item in ((IEnumerable)Application.Current.Windows).OfType()) + { + val = Extentions.FindVisualChildren((DependencyObject)(object)item).FirstOrDefault(); + if (val != null && !val.IsOpen) + { + break; + } + } + } + if (val == null || !val.IsOpen) + { + return val; + } + return null; + } + + internal async Task ShowMessage(string message, string accept = "OK", string cancel = "", bool root = false) + { + DialogHost val = null; + if (!root) + { + val = GetHost(); + if (val == null) + { + return false; + } + } + DefaultDialog defaultDialog = new DefaultDialog(); + ((FrameworkElement)defaultDialog).DataContext = new DialogViewModel + { + AcceptContent = accept, + CancelContent = cancel, + Message = message + }; + DefaultDialog dialogControl = defaultDialog; + return await ExecuteRunExtendedDialog((UserControl)(object)dialogControl, (val != null) ? val.Identifier.ToString() : "RootDialog"); + } + + internal async Task ShowDialogPrint(Relatorio relatorio, Type tipo) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + DialogHost host = GetHost(); + if (host != null && host.IsOpen) + { + return null; + } + DialogPrint dialogControl = new DialogPrint(relatorio, tipo); + return await ExecuteRunExtendedDialogPrint((UserControl)(object)dialogControl, (host != null) ? host.Identifier.ToString() : "RootDialog"); + } + + public async Task ExecuteRunExtendedDialogPrint(UserControl dialogControl, string hostName) + { + Extentions.FindVisualChildren((DependencyObject)(object)((IEnumerable)Application.Current.Windows).OfType().SingleOrDefault((Func)((Window x) => x.IsActive))).ToList().ForEach(delegate(WebEditor x) + { + ((UIElement)x).Visibility = (Visibility)2; + }); + return (ConfiguracaoImpressao)(await DialogHost.Show((object)dialogControl, (object)hostName, new DialogOpenedEventHandler(ExtendedOpenedEventHandler), new DialogClosingEventHandler(ExtendedClosingEventHandler))); + } + + internal async Task> ShowDialogAnexar(List arquivos, bool root = false) + { + DialogHost val = null; + if (!root) + { + val = GetHost(); + if (val != null && val.IsOpen) + { + return arquivos; + } + } + DialogAnexar dialogControl = new DialogAnexar(arquivos); + return await ExecuteRunExtendedDialogAnexar((UserControl)(object)dialogControl, (val != null) ? val.Identifier.ToString() : "RootDialog"); + } + + public async Task> ExecuteRunExtendedDialogAnexar(UserControl dialogControl, string hostName) + { + Extentions.FindVisualChildren((DependencyObject)(object)((IEnumerable)Application.Current.Windows).OfType().SingleOrDefault((Func)((Window x) => x.IsActive))).ToList().ForEach(delegate(WebEditor x) + { + ((UIElement)x).Visibility = (Visibility)2; + }); + return (List)(await DialogHost.Show((object)dialogControl, (object)hostName, new DialogOpenedEventHandler(ExtendedOpenedEventHandler), new DialogClosingEventHandler(ExtendedClosingEventHandlerArquivo))); + } + + internal async Task ShowDialogAdvertising(bool root = false) + { + _ = 1; + try + { + DialogHost host = null; + if (!root) + { + host = GetHost(); + if (host != null && host.IsOpen) + { + return; + } + } + DialogAdvertising dialogAdvertising = await CreateDialogAdvertising(); + if (dialogAdvertising != null) + { + await ExecuteRunExtendedDialogAdvertising((UserControl)(object)dialogAdvertising, (host != null) ? host.Identifier.ToString() : "RootDialog"); + } + } + catch + { + } + } + + private async Task CreateDialogAdvertising() + { + JObject val = await LoadJsonAdvertising(Address.SurveyJson); + if (val == null) + { + return await LoadDialogAdertisingPromo(); + } + JToken obj = val["Inicio"]; + DateTime? dateTime = ((obj != null) ? new DateTime?(Extensions.Value((IEnumerable)obj)) : null); + JToken obj2 = val["Fim"]; + DateTime? dateTime2 = ((obj2 != null) ? new DateTime?(Extensions.Value((IEnumerable)obj2)) : null); + DateTime networkTime = Funcoes.GetNetworkTime(); + Gestor.Application.Model.Configuracoes configuracoes = LoadConfiguracoes(); + JToken obj3 = val["UrlPost"]; + string text = ((obj3 != null) ? Extensions.Value((IEnumerable)obj3) : null); + if (ValidationHelper.IsNullOrEmpty(text)) + { + JToken obj4 = val["UrlFixa"]; + text = ((obj4 != null) ? Extensions.Value((IEnumerable)obj4) : null) ?? string.Empty; + } + if (configuracoes.LinkPromo == text || configuracoes.NaoverPromo) + { + return null; + } + return (!(dateTime2 >= networkTime) || !(dateTime <= networkTime)) ? (await LoadDialogAdertisingPromo()) : new DialogAdvertising(val, isPromo: false); + } + + private Gestor.Application.Model.Configuracoes LoadConfiguracoes() + { + CriarConfiguracaoPadrao("config.json"); + return JsonConvert.DeserializeObject(File.ReadAllText("config.json")); + } + + private async Task LoadDialogAdertisingPromo() + { + Gestor.Application.Model.Configuracoes config = LoadConfiguracoes(); + JObject val = await LoadJsonAdvertising(Address.JsonPromo()); + if (val == null) + { + return null; + } + JToken obj = val["Imagem"]; + string text = ((obj != null) ? Extensions.Value((IEnumerable)obj) : null) ?? string.Empty; + if (config.LinkPromo == text || config.NaoverPromo) + { + return null; + } + return new DialogAdvertising(val); + } + + private async Task LoadJsonAdvertising(Uri location) + { + HttpClient client = new HttpClient(); + try + { + ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; + client.Timeout = TimeSpan.FromSeconds(20.0); + HttpResponseMessage val = await client.GetAsync(location); + return (!val.IsSuccessStatusCode) ? null : JObject.Parse(await val.Content.ReadAsStringAsync()); + } + finally + { + ((IDisposable)client)?.Dispose(); + } + } + + private void CriarConfiguracaoPadrao(string configFile) + { + if (!File.Exists(configFile)) + { + Gestor.Application.Model.Configuracoes configuracoes = new Gestor.Application.Model.Configuracoes + { + LinkPromo = "", + NaoverPromo = false + }; + File.WriteAllText(configFile, JsonConvert.SerializeObject((object)configuracoes, (Formatting)1)); + } + } + + public async Task ExecuteRunExtendedDialogAdvertising(UserControl dialogControl, string hostName) + { + Extentions.FindVisualChildren((DependencyObject)(object)((IEnumerable)Application.Current.Windows).OfType().SingleOrDefault((Func)((Window x) => x.IsActive))).ToList().ForEach(delegate(WebEditor x) + { + ((UIElement)x).Visibility = (Visibility)2; + }); + await DialogHost.Show((object)dialogControl, (object)hostName, new DialogOpenedEventHandler(ExtendedOpenedEventHandler), new DialogClosingEventHandler(ExtendedClosingEventHandlerArquivo)); + } + + internal async Task ShowMessage(List> pairs, string message, string accept, string cancel = "") + { + DialogHost host = GetHost(); + if (host != null && host.IsOpen) + { + return false; + } + ErrorDialog errorDialog = new ErrorDialog(); + ((FrameworkElement)errorDialog).DataContext = new ErrorDialogViewModel + { + Erros = pairs.Select((KeyValuePair pair) => new KeyValuePair(pair.Key.Contains("|") ? pair.Key.Substring(pair.Key.IndexOf("|", StringComparison.Ordinal) + 1) : pair.Key, pair.Value)).ToList(), + AcceptContent = accept, + CancelContent = cancel, + Message = message + }; + ErrorDialog dialogControl = errorDialog; + return await ExecuteRunExtendedDialog((UserControl)(object)dialogControl, (host != null) ? host.Identifier.ToString() : "RootDialog"); + } + + internal async Task ShowMedalha(int liquido, int comissao, int resultado, int media) + { + DialogHost host = GetHost(); + if (host == null || !host.IsOpen) + { + DialogMedalha dialogControl = new DialogMedalha(liquido, comissao, resultado, media); + await ExecuteRunExtendedDialog((UserControl)(object)dialogControl, (host != null) ? host.Identifier.ToString() : "RootDialog"); + } + } + + internal async Task ShowSenha(string mensagem) + { + DialogHost host = GetHost(); + if (host != null && host.IsOpen) + { + return false; + } + DialogSenhaAdm dialogControl = new DialogSenhaAdm(mensagem); + return await ExecuteRunExtendedDialogSenha((UserControl)(object)dialogControl, (host != null) ? host.Identifier.ToString() : "RootDialog"); + } + + internal async Task ShowInstalacoes(List instalacoes) + { + DialogHost host = GetHost(); + if (host != null && host.IsOpen) + { + return null; + } + DialogInstalacoes dialogControl = new DialogInstalacoes(instalacoes); + return await ExecuteRunExtendedDialogInstalacoes((UserControl)(object)dialogControl, (host != null) ? host.Identifier.ToString() : "RootDialog"); + } + + public async Task ExecuteRunExtendedDialogInstalacoes(UserControl dialogControl, string hostName) + { + Extentions.FindVisualChildren((DependencyObject)(object)((IEnumerable)Application.Current.Windows).OfType().SingleOrDefault((Func)((Window x) => x.IsActive))).ToList().ForEach(delegate(WebEditor x) + { + ((UIElement)x).Visibility = (Visibility)2; + }); + object obj = await DialogHost.Show((object)dialogControl, (object)hostName, new DialogOpenedEventHandler(ExtendedOpenedEventHandler), new DialogClosingEventHandler(ExtendedClosingEventHandler)); + object obj2 = obj; + if (obj2 == null || (obj2 is bool && !(bool)obj2)) + { + return null; + } + return (Instalacao)obj; + } + + internal async Task ShowProspeccaoDialog(Prospeccao prospecao) + { + DialogHost host = GetHost(); + if (host != null && host.IsOpen) + { + return null; + } + ProspeccaoDialog dialogControl = new ProspeccaoDialog(prospecao); + return await ExecuteRunExtendedDialogProspeccao((UserControl)(object)dialogControl, (host != null) ? host.Identifier.ToString() : "RootDialog"); + } + + public async Task ExecuteRunExtendedDialogProspeccao(UserControl dialogControl, string hostName) + { + Extentions.FindVisualChildren((DependencyObject)(object)((IEnumerable)Application.Current.Windows).OfType().SingleOrDefault((Func)((Window x) => x.IsActive))).ToList().ForEach(delegate(WebEditor x) + { + ((UIElement)x).Visibility = (Visibility)2; + }); + object obj = await DialogHost.Show((object)dialogControl, (object)hostName, new DialogOpenedEventHandler(ExtendedOpenedEventHandler), new DialogClosingEventHandler(ExtendedClosingEventHandler)); + if (obj is bool) + { + return null; + } + return (Prospeccao)obj; + } + + public async Task ExecuteRunExtendedDialog(UserControl dialogControl, string hostName) + { + object obj = await DialogHost.Show((object)dialogControl, (object)hostName, new DialogOpenedEventHandler(ExtendedOpenedEventHandler), new DialogClosingEventHandler(ExtendedClosingEventHandler)); + DialogHost.CloseDialogCommand.Execute((object)null, (IInputElement)null); + return obj != null && (bool)obj; + } + + public async Task ExecuteRunExtendedDialogSenha(UserControl dialogControl, string hostName) + { + Extentions.FindVisualChildren((DependencyObject)(object)((IEnumerable)Application.Current.Windows).OfType().SingleOrDefault((Func)((Window x) => x.IsActive))).ToList().ForEach(delegate(WebEditor x) + { + ((UIElement)x).Visibility = (Visibility)2; + }); + return (bool?)(await DialogHost.Show((object)dialogControl, (object)hostName, new DialogOpenedEventHandler(ExtendedOpenedEventHandler), new DialogClosingEventHandler(ExtendedClosingEventHandler))); + } + + public void ExtendedOpenedEventHandler(object sender, DialogOpenedEventArgs eventargs) + { + IsEnabled = false; + } + + public void ExtendedClosingEventHandler(object sender, DialogClosingEventArgs eventArgs) + { + IsEnabled = true; + Window? obj = ((IEnumerable)Application.Current.Windows).OfType().SingleOrDefault((Func)((Window x) => x.IsActive)); + Extentions.FindVisualChildren((DependencyObject)(object)obj).ToList().ForEach(delegate(WebEditor x) + { + if (!x.IsReadOnly) + { + ((UIElement)x).Visibility = (Visibility)0; + } + }); + Extentions.FindVisualChildren((DependencyObject)(object)obj).Any((DrawerHost x) => x.IsLeftDrawerOpen || x.IsBottomDrawerOpen || x.IsRightDrawerOpen || x.IsTopDrawerOpen); + } + + public void ExtendedClosingEventHandlerArquivo(object sender, DialogClosingEventArgs eventArgs) + { + IsEnabled = true; + Extentions.FindVisualChildren((DependencyObject)(object)((IEnumerable)Application.Current.Windows).OfType().SingleOrDefault((Func)((Window x) => x.IsActive))).Any((DrawerHost x) => x.IsLeftDrawerOpen || x.IsBottomDrawerOpen || x.IsRightDrawerOpen || x.IsTopDrawerOpen); + } + + public void ToggleSnackBar(string message, bool active = true) + { + Snackbar val = Extentions.FindVisualChildren((DependencyObject)(object)((IEnumerable)Application.Current.Windows).OfType().SingleOrDefault((Func)((Window x) => x.IsActive))).FirstOrDefault(); + if (val != null) + { + ((ContentControl)val.Message).Content = message; + val.IsActive = active; + if (active) + { + Task.Factory.StartNew(CloseSlackBar); + } + } + } + + private void CloseSlackBar() + { + Thread.Sleep(5000); + Dispatcher dispatcher = ((DispatcherObject)App.ProgressRing).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)4, (Delegate)(Action)delegate + { + ToggleSnackBar("", active: false); + }); + } + } + + public async Task> ValidateAttachment(List attachments, List files) + { + string message = ("Os Arquivos Abaixo não podem ser anexados pois não possuem Formatos válidos, são maiores que o permitido ou já foram anexados!" + Environment.NewLine + Environment.NewLine).ToUpper(); + List result = new List(); + bool error = false; + foreach (string x in files) + { + try + { + if (attachments?.Exists(delegate(ArquivoDigital a) + { + string text2 = ValidationHelper.RemoveDiacritics(a.Descricao.ToUpper()); + string? fileNameWithoutExtension = Path.GetFileNameWithoutExtension(x); + return text2 == ((fileNameWithoutExtension != null) ? ValidationHelper.RemoveDiacritics(fileNameWithoutExtension.ToUpper()) : null); + }) ?? false) + { + message += Path.GetFileName(x); + error = true; + continue; + } + FileInfo fileInfo = new FileInfo(x); + if (fileInfo.Length > 1024 && fileInfo.Length / 1024 > ((Recursos.Empresa.MaxFileSize > 0) ? Recursos.Empresa.MaxFileSize : 14336)) + { + message += Path.GetFileName(x); + error = true; + continue; + } + string text = Path.GetExtension(x)?.ToLower(); + if (text != null) + { + int length = text.Length; + if (length != 4) + { + if (length == 5) + { + switch (text[2]) + { + case 'o': + break; + case 'l': + goto IL_0341; + case 'p': + goto IL_0351; + case 's': + goto IL_0361; + default: + goto IL_036f; + } + if (text == ".docx") + { + goto IL_038d; + } + } + } + else + { + switch (text[1]) + { + case 't': + break; + case 'd': + goto IL_0243; + case 'x': + goto IL_0259; + case 'j': + goto IL_026f; + case 'p': + goto IL_0285; + case 'b': + goto IL_02ac; + case 'z': + goto IL_02c2; + case 'r': + goto IL_02d8; + case 'm': + goto IL_02ee; + case 'e': + goto IL_0301; + case 'a': + goto IL_0311; + case 'o': + goto IL_0321; + default: + goto IL_036f; + } + if (text == ".txt") + { + goto IL_038d; + } + } + } + goto IL_036f; + IL_0285: + if (!(text == ".png") && !(text == ".pdf")) + { + goto IL_036f; + } + goto IL_038d; + IL_026f: + if (!(text == ".jpg")) + { + goto IL_036f; + } + goto IL_038d; + IL_0311: + if (!(text == ".amr")) + { + goto IL_036f; + } + goto IL_038d; + IL_02d8: + if (!(text == ".rar")) + { + goto IL_036f; + } + goto IL_038d; + IL_0321: + if (!(text == ".ogg")) + { + goto IL_036f; + } + goto IL_038d; + IL_0301: + if (!(text == ".eml")) + { + goto IL_036f; + } + goto IL_038d; + IL_02ac: + if (!(text == ".bmp")) + { + goto IL_036f; + } + goto IL_038d; + IL_0243: + if (!(text == ".doc")) + { + goto IL_036f; + } + goto IL_038d; + IL_02ee: + if (!(text == ".msg")) + { + goto IL_036f; + } + goto IL_038d; + IL_0361: + if (!(text == ".json")) + { + goto IL_036f; + } + goto IL_038d; + IL_038d: + result.Add(x); + goto end_IL_0080; + IL_0341: + if (!(text == ".xlsx")) + { + goto IL_036f; + } + goto IL_038d; + IL_036f: + message += Path.GetFileName(x); + goto end_IL_0080; + IL_0351: + if (!(text == ".jpeg")) + { + goto IL_036f; + } + goto IL_038d; + IL_0259: + if (!(text == ".xls")) + { + goto IL_036f; + } + goto IL_038d; + IL_02c2: + if (!(text == ".zip")) + { + goto IL_036f; + } + goto IL_038d; + end_IL_0080:; + } + catch (Exception) + { + await ShowMessage("NÃO FOI POSSÍVEL CARREGAR O ARQUIVO " + x + "." + Environment.NewLine + "O ARQUIVO ESTÁ INACESSÍVEL OU SENDO UTILIZADO POR OUTRO PROCESSO."); + } + } + if (error) + { + await ShowMessage((message + Environment.NewLine + Environment.NewLine + "Favor Corrija antes de tentar novamente.").ToUpper()); + } + return result; + } + + public async Task> AddAttachments(List attachments, List attacheds) + { + List list = new List(); + OpenFileDialog val = new OpenFileDialog(); + try + { + val.Multiselect = true; + ((FileDialog)val).Filter = "Todos os Arquivos|*.pdf;*.jpg;*.jpeg;*.png;*.bmp;*.doc;*.docx;*.xls;*.xlsx;*.json;*.rar;*.zip;*.msg;*.eml;*.txt|Arquivos PDF|*.pdf|Imagens|*.jpg;*.jpeg;*.png;*.bmp|Documentos|*.doc;*.docx;*.msg|Planilhas|*.xls;*.xlsx|Arquivos do Aggilizador|*.json|Arquivos de Áudio|*.amr;*.ogg"; + ((FileDialog)val).InitialDirectory = Environment.SpecialFolder.Desktop.ToString(); + if (1 != (int)((CommonDialog)val).ShowDialog()) + { + return null; + } + list.AddRange(((FileDialog)val).FileNames); + } + finally + { + ((IDisposable)val)?.Dispose(); + } + list = await ValidateAttachment(attacheds, await ValidateAttachment(attachments, list)); + attachments = new List(); + foreach (string item2 in list) + { + try + { + string extension = Path.GetExtension(item2); + using MemoryStream memoryStream = new MemoryStream(File.ReadAllBytes(item2)); + byte[] array = new byte[memoryStream.Length]; + memoryStream.Position = 0L; + memoryStream.Read(array, 0, array.Length); + ArquivoDigital item = new ArquivoDigital + { + Arquivo = array, + Descricao = Path.GetFileNameWithoutExtension(item2), + Extensao = extension + }; + attachments.Add(item); + } + catch (Exception) + { + await ShowMessage("NÃO FOI POSSÍVEL CARREGAR O ARQUIVO " + item2 + "." + Environment.NewLine + "O ARQUIVO ESTÁ INACESSÍVEL OU SENDO UTILIZADO POR OUTRO PROCESSO."); + } + } + return (attachments.Count == 0) ? null : attachments; + } + + public async void Download(IndiceArquivoDigital indice, bool open = true) + { + if (((DomainBase)indice).Id == 0L) + { + return; + } + ArquivoDigital arquivo = null; + if (indice.Assinado) + { + ArquivoDigital val = await ArquivoDigitalServico.BuscarPorId(((DomainBase)indice).Id); + if (((val != null) ? val.Arquivo : null) != null) + { + if (!val.Extensao.Contains(".")) + { + val.Extensao = "." + val.Extensao; + } + arquivo = val; + } + } + if (arquivo == null) + { + arquivo = await ArquivoDigitalServico.BuscarPorId(indice.IdArquivoDigital, indice.Bd); + } + ArquivoDigital obj = arquivo; + if (((obj != null) ? obj.Arquivo : null) == null || arquivo.Extensao == null) + { + string text = "DOCUMENTO NÃO POSSUI PDF"; + if (indice.DataCriacao?.Year <= DateTime.Now.Year - 5) + { + text += " OU POR SER UM ARQUIVO ANTIGO, TENTE NOVAMENTE EM ALGUNS MINUTOS"; + } + await ShowMessage(text + "."); + return; + } + if (open) + { + if (Abrir(indice, arquivo)) + { + return; + } + await ShowMessage("NÃO FOI POSSÍVEL ABRIR O ARQUIVO. ESCOLHA UM LOCAL PARA SALVAR O ARQUIVO."); + } + SaveFileDialog sfd = new SaveFileDialog(); + try + { + ((FileDialog)sfd).Filter = "All Files|*.*"; + ((FileDialog)sfd).FileName = indice.Descricao; + if (1 != (int)((CommonDialog)sfd).ShowDialog()) + { + return; + } + if (File.Exists(((FileDialog)sfd).FileName + ValidationHelper.GetDefaultExtension(arquivo.Extensao))) + { + await ShowMessage("JÁ EXISTE UM ARQUIVO COM O NOME DE " + arquivo.Descricao + ValidationHelper.GetDefaultExtension(arquivo.Extensao) + " NA PASTA SELECIONADA. " + Environment.NewLine + "TENTE NOVAMENTE EM OUTRA PASTA."); + return; + } + using BinaryWriter binaryWriter = new BinaryWriter(File.Open(((FileDialog)sfd).FileName + ValidationHelper.GetDefaultExtension(arquivo.Extensao), FileMode.Create)); + binaryWriter.Write(arquivo.Arquivo); + } + finally + { + ((IDisposable)sfd)?.Dispose(); + } + } + + public async Task Salvar(IndiceArquivoDigital indice) + { + if (((DomainBase)indice).Id == 0L) + { + return null; + } + ArquivoDigital val = await ArquivoDigitalServico.BuscarPorId(indice.IdArquivoDigital, indice.Bd); + if (((val != null) ? val.Arquivo : null) == null || val.Extensao == null) + { + return null; + } + string tempPath = Path.GetTempPath(); + string text = $"{tempPath}{val.AzureGuid ?? Guid.NewGuid()}{ValidationHelper.GetDefaultExtension(val.Extensao)}"; + using (BinaryWriter binaryWriter = new BinaryWriter(File.Open(text, FileMode.Create))) + { + binaryWriter.Write(val.Arquivo); + } + return text; + } + + public bool Abrir(IndiceArquivoDigital indice, ArquivoDigital arquivo) + { + string tempPath = Path.GetTempPath(); + string text = $"{tempPath}{arquivo.AzureGuid ?? Guid.NewGuid()}{ValidationHelper.GetDefaultExtension(arquivo.Extensao)}"; + try + { + using (BinaryWriter binaryWriter = new BinaryWriter(File.Open(text, FileMode.Create))) + { + binaryWriter.Write(arquivo.Arquivo); + } + Process.Start(text); + } + catch (Exception) + { + return false; + } + return true; + } + + public async Task DownloadAll(List indices, long id) + { + FolderBrowserDialog val = new FolderBrowserDialog(); + string selectedPath; + try + { + if (1 != (int)((CommonDialog)val).ShowDialog()) + { + return false; + } + selectedPath = $"{val.SelectedPath}\\{id}"; + Directory.CreateDirectory(selectedPath); + } + finally + { + ((IDisposable)val)?.Dispose(); + } + int count = 1; + foreach (IndiceArquivoDigital indice in indices) + { + ArquivoDigital arquivo = null; + if (indice.Assinado) + { + ArquivoDigital val2 = await ArquivoDigitalServico.BuscarPorId(((DomainBase)indice).Id); + if (((val2 != null) ? val2.Arquivo : null) != null) + { + arquivo = val2; + } + } + if (arquivo == null) + { + arquivo = await ArquivoDigitalServico.BuscarPorId(indice.IdArquivoDigital, indice.Bd); + } + ArquivoDigital obj = arquivo; + if (((obj != null) ? obj.Arquivo : null) == null || arquivo.Extensao == null) + { + return false; + } + if (File.Exists(ValidationHelper.NormalizePath(selectedPath + "\\" + indice.Descricao + ValidationHelper.GetDefaultExtension(arquivo.Extensao)))) + { + indice.Descricao = $"{indice.Descricao}_{count}"; + count++; + } + using BinaryWriter binaryWriter = new BinaryWriter(File.Open(ValidationHelper.NormalizePath(selectedPath + "\\" + indice.Descricao + ValidationHelper.GetDefaultExtension(arquivo.Extensao)), FileMode.Create)); + binaryWriter.Write(arquivo.Arquivo); + } + Process.Start(selectedPath); + return true; + } + + public async Task DownloadAll(List ids, TipoArquivoVinculo type) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + if (ids == null || ids.Count == 0) + { + return; + } + string selectedPath = $"{Path.GetTempPath()}{Guid.NewGuid()}"; + BaseServico baseServico = new BaseServico(); + ArquivoDigitalServico attachment = new ArquivoDigitalServico(); + List arquivos = await baseServico.ArquivoVinculo(ids, type); + int count = 1; + if (!Directory.Exists(selectedPath)) + { + Directory.CreateDirectory(selectedPath); + } + foreach (ArquivoVinculo item in await attachment.BaixarArquivosPendentes(arquivos)) + { + if (((item != null) ? item.Arquivo : null) != null) + { + string text = Guid.NewGuid().ToString(); + if (File.Exists(selectedPath + "\\" + text + ".pdf")) + { + text = $"{text}_{count}"; + count++; + } + using BinaryWriter binaryWriter = new BinaryWriter(File.Open(selectedPath + "\\" + text + ".pdf", FileMode.Create)); + binaryWriter.Write(item.Arquivo); + } + } + Process.Start(selectedPath); + } + + internal async Task> BuscarBanco(string value) + { + return await Task.Run(() => new BaseServico().BuscarBanco(value)); + } + + public bool Restricao(TipoRestricao tipoRestricao) + { + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + if (((DomainBase)Recursos.Usuario).Id == 0L) + { + return false; + } + RestricaoUsuario val = ServicoRestriUsuario.BuscarRestricao(Recursos.Usuario, tipoRestricao); + if (val != null) + { + return val.Restricao; + } + return false; + } + + public bool Permissao(TipoTela tipoTela) + { + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + if (((DomainBase)Recursos.Usuario).Id == 0L) + { + return false; + } + PermissaoUsuario val = ServicoPermissUsuario.BuscarPermissao(Recursos.Usuario, tipoTela); + if (val != null) + { + return val.Consultar; + } + return true; + } + + public async Task> VerificaVinculoVendedor(Usuario usuario) + { + if (usuario == null || ((DomainBase)usuario).Id == 0L) + { + return new List(); + } + return await ServicoVendedorUsuario.FindByVinculo(usuario); + } + + public async Task>> SalvarProspeccao(Prospeccao prospecao) + { + List> list = prospecao.Validate(); + if (list.Count > 0) + { + return list; + } + List anexos = prospecao.Anexos; + if (((DomainBase)prospecao.Tarefa).Id == 0L) + { + prospecao.Tarefa.Cliente = prospecao.Nome; + prospecao.Tarefa.Titulo = "PROSPECÇÃO " + prospecao.VigenciaFinal?.ToString("d"); + prospecao.Tarefa.Referencia = prospecao.Item; + prospecao.Tarefa.Descricao = $"{Recursos.Usuario.Nome} {Funcoes.GetNetworkTime():g} {Environment.NewLine}{prospecao.Observacao}"; + } + Prospeccao prosccaoSalva = await new ProspeccaoServico().Salvar(prospecao); + if (anexos != null && anexos.Count > 0) + { + await SalvarAttachments(anexos, (TipoArquivoDigital)11, ((DomainBase)prosccaoSalva).Id); + } + if (prosccaoSalva.Tarefa != null && prospecao.AbrirTarefa && prosccaoSalva != null && ((DomainBase)prosccaoSalva).Id > 0) + { + Tarefa tarefa = prosccaoSalva.Tarefa; + ShowDrawer(new TarefaDrawer(tarefa), 0, close: false); + } + return null; + } + + public async Task VerificarRestricao(TipoRestricao tipoRestricao, bool root = false, bool showmessage = true) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + if (((DomainBase)Recursos.Usuario).Id == 0L) + { + return true; + } + RestricaoUsuario val = ServicoRestriUsuario.BuscarRestricao(Recursos.Usuario, tipoRestricao); + if (val == null || !val.Restricao) + { + return true; + } + if (showmessage) + { + await ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR ESSA TELA. CONTATE O ADMINISTRADOR DO SISTEMA.", "OK", "", root); + } + return false; + } + + public async Task VerificarPermissao(TipoTela tela, bool root = false) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + if (await PermissaoConsultar(tela)) + { + return true; + } + await ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR ESSA TELA. CONTATE O ADIMINSTRADOR DO SISTEMA.", "OK", "", root); + return false; + } + + public async Task VerificarContrato(Produto produto, bool message = true, bool root = false) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + if ((int)produto == 79) + { + if (LicenseHelper.Produtos.Exists((Licenca x) => (int)x.Produto == 91 && x.AcessoLiberado)) + { + return true; + } + if (LicenseHelper.Produtos.Exists((Licenca x) => (int)x.Produto == 81 && x.AcessoLiberado)) + { + return true; + } + if (LicenseHelper.Produtos.Exists((Licenca x) => (int)x.Produto == 77 && x.AcessoLiberado)) + { + return true; + } + } + if (LicenseHelper.Produtos != null && LicenseHelper.Produtos.Exists((Licenca x) => x.Produto == produto && x.AcessoLiberado)) + { + return true; + } + if (message) + { + Licenca val = LicenseHelper.Produtos?.FirstOrDefault((Func)((Licenca x) => x.Produto == produto)); + await ShowMessage((val == null) ? ("VOCÊ NÃO POSSUI O MÓDULO " + EnumHelper.GetDescription(produto) + " CONTRATADO") : ("ACESSO AO MÓDULO " + EnumHelper.GetDescription(produto) + " INTERROMPIDO"), "OK", "", root); + } + return false; + } + + internal async Task> ShowExtratoComissaoDialog(List seguradoras) + { + DialogHost host = GetHost(); + if (host != null && host.IsOpen) + { + return null; + } + DialogExtratoComissao dialogControl = new DialogExtratoComissao(seguradoras); + return await ExecuteRunExtendedDialogExtratoComissao((UserControl)(object)dialogControl, (host != null) ? host.Identifier.ToString() : "RootDialog"); + } + + public async Task> ExecuteRunExtendedDialogExtratoComissao(UserControl dialogControl, string hostName) + { + Extentions.FindVisualChildren((DependencyObject)(object)((IEnumerable)Application.Current.Windows).OfType().SingleOrDefault((Func)((Window x) => x.IsActive))).ToList().ForEach(delegate(WebEditor x) + { + ((UIElement)x).Visibility = (Visibility)2; + }); + object obj = await DialogHost.Show((object)dialogControl, (object)hostName, new DialogOpenedEventHandler(ExtendedOpenedEventHandler), new DialogClosingEventHandler(ExtendedClosingEventHandler)); + if (obj is bool) + { + return null; + } + return (List)obj; + } + + internal async Task ShowCopiarCliente() + { + DialogHost host = GetHost(); + if (host != null && host.IsOpen) + { + return null; + } + DialogCopiarCliente dialogControl = new DialogCopiarCliente(); + return await ExecuteRunExtendedDialogCopiarCliente((UserControl)(object)dialogControl, (host != null) ? host.Identifier.ToString() : "RootDialog"); + } + + public async Task ExecuteRunExtendedDialogCopiarCliente(UserControl dialogControl, string hostName) + { + Extentions.FindVisualChildren((DependencyObject)(object)((IEnumerable)Application.Current.Windows).OfType().SingleOrDefault((Func)((Window x) => x.IsActive))).ToList().ForEach(delegate(WebEditor x) + { + ((UIElement)x).Visibility = (Visibility)2; + }); + object obj = await DialogHost.Show((object)dialogControl, (object)hostName, new DialogOpenedEventHandler(ExtendedOpenedEventHandler), new DialogClosingEventHandler(ExtendedClosingEventHandler)); + if (obj is bool) + { + return null; + } + return (Cliente)obj; + } + + internal async Task ShowCopiaDialog(Copia copia) + { + DialogHost host = GetHost(); + if (host != null && host.IsOpen) + { + return null; + } + DialogCopia dialogControl = new DialogCopia(copia); + return await ExecuteRunExtendedDialogCopia((UserControl)(object)dialogControl, (host != null) ? host.Identifier.ToString() : "RootDialog"); + } + + public async Task ExecuteRunExtendedDialogCopia(UserControl dialogControl, string hostName) + { + Extentions.FindVisualChildren((DependencyObject)(object)((IEnumerable)Application.Current.Windows).OfType().SingleOrDefault((Func)((Window x) => x.IsActive))).ToList().ForEach(delegate(WebEditor x) + { + ((UIElement)x).Visibility = (Visibility)2; + }); + object obj = await DialogHost.Show((object)dialogControl, (object)hostName, new DialogOpenedEventHandler(ExtendedOpenedEventHandler), new DialogClosingEventHandler(ExtendedClosingEventHandler)); + if (obj is bool) + { + return null; + } + return (Copia)obj; + } + + public async void AbrirLog(TipoTela tipoTela, long id) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + if (((DomainBase)Recursos.Usuario).Id == 0L) + { + ShowDrawer(new LogDrawer(tipoTela, id), 0, close: false); + return; + } + RestricaoUsuario val = ServicoRestriUsuario.BuscarRestricao(Recursos.Usuario, (TipoRestricao)109); + if (val == null || !val.Restricao) + { + ShowDrawer(new LogDrawer(tipoTela, id), 0, close: false); + } + else + { + await ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR OS LOGS"); + } + } + + public async void AbrirLogParcela(List parcelas, long documento, int numparcela = 0) + { + if (((DomainBase)Recursos.Usuario).Id == 0L) + { + ShowDrawer(new LogDrawer((TipoTela)5, documento, parcelas, numparcela), 0, close: false); + return; + } + RestricaoUsuario val = ServicoRestriUsuario.BuscarRestricao(Recursos.Usuario, (TipoRestricao)109); + if (val == null || !val.Restricao) + { + ShowDrawer(new LogDrawer((TipoTela)5, documento, parcelas, numparcela), 0, close: false); + } + else + { + await ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR OS LOGS"); + } + } + + public async void AbrirLogEmail(TipoTela tela, long id) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + if (((DomainBase)Recursos.Usuario).Id == 0L) + { + ShowDrawer(new LogEmailDrawer(tela, id), 0, close: false); + return; + } + RestricaoUsuario val = ServicoRestriUsuario.BuscarRestricao(Recursos.Usuario, (TipoRestricao)109); + if (val == null || !val.Restricao) + { + ShowDrawer(new LogEmailDrawer(tela, id), 0, close: false); + } + else + { + await ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR OS LOGS"); + } + } + + public async Task ImprimirFornecedor(List fornecedores) + { + new ParcelaServico(); + string text = "RELATÓRIO DE FORNECEDORES"; + text += "
RELATÓRIO DE FORNECEDORES

"; + text += "
"; + text += ""; + int num = 1; + text += ""; + text += ""; + text += ""; + text += ""; + text += ""; + text += ""; + text += ""; + foreach (Fornecedor fornecedore in fornecedores) + { + text = text + ""; + text = text + ""; + text = text + ""; + text = text + ""; + string text2 = ((fornecedore.Documento == null) ? "" : ((ValidationHelper.OnlyNumber(fornecedore.Documento).Length > 11) ? "JURÍDICA" : "FÍSICA")); + text = text + ""; + num = ((num != 1) ? (num + 1) : 0); + } + DateTime networkTime = Funcoes.GetNetworkTime(); + string nome = Recursos.Usuario.Nome; + text += "
NOMECPF/CNPJENDEREÇOE-MAILTIPO PESSOA
" + fornecedore.Nome + "" + fornecedore.Documento + "" + ((EnderecoBase)fornecedore).Endereco + "" + fornecedore.Email + "" + text2 + "
"; + text += $"Emitido pelo usuário: {nome}, data e hora: {networkTime}."; + text += ""; + string tempPath = Path.GetTempPath(); + string text3 = $"{tempPath}FORNECEDORES_{networkTime:ddMMyyyyhhmmss}.html"; + StreamWriter streamWriter = new StreamWriter(text3, append: true, Encoding.UTF8); + streamWriter.Write(text); + streamWriter.Close(); + Process.Start(text3); + } + + public async Task EmitirCheckList(List documentos) + { + ParcelaServico parcelaServico = new ParcelaServico(); + string html5 = "CHECK LIST DE PROTOCOLOS"; + html5 += "
CHECK LIST DE PROTOCOLOS

"; + html5 += "
"; + html5 += ""; + int color = 1; + html5 += ""; + html5 += ""; + html5 += ""; + html5 += ""; + html5 += ""; + html5 += ""; + html5 += ""; + html5 += ""; + documentos = documentos.OrderBy((Documento x) => x.Controle.Cliente.Nome).ToList(); + foreach (Documento doc in documentos) + { + Documento val = doc; + val.Parcelas = await parcelaServico.BuscarParcelasAsync(((DomainBase)doc).Id); + html5 = html5 + ""; + html5 = html5 + ""; + string text = ((doc.Parcelas != null && doc.Parcelas.Where((Parcela x) => (int)x.SubTipo == 1).ToList().Count > 0) ? doc.Parcelas.Where((Parcela x) => x.NumeroParcela == 1).First().Vencimento.Date.ToString("dd/MM/yyyy") : ""); + html5 = html5 + ""; + text = ((doc.Parcelas != null && doc.Parcelas.Where((Parcela x) => (int)x.SubTipo == 1).ToList().Count > 1) ? doc.Parcelas.Where((Parcela x) => x.NumeroParcela == 2).First().Vencimento.Date.ToString("dd/MM/yyyy") : ""); + html5 = html5 + ""; + html5 = html5 + ""; + string[] obj = new string[6] + { + html5, + ""; + html5 = string.Concat(obj); + color = ((color != 1) ? (color + 1) : 0); + } + DateTime networkTime = Funcoes.GetNetworkTime(); + string nome = Recursos.Usuario.Nome; + html5 += "
CLIENTEAPÓLICE1ª PARCELA2ª PARCELARECEBIDA PORVENDEDOR
" + doc.Controle.Cliente.Nome + "" + doc.Apolice + "" + text + "" + text + "____________/____/___", + null, + null + }; + Vendedor vendedorPrincipal = doc.VendedorPrincipal; + obj[4] = ((vendedorPrincipal != null) ? vendedorPrincipal.Nome : null); + obj[5] = "
"; + html5 = html5 + "
TOTAL DE PROTOCOLOS: " + documentos.Count + "
"; + html5 += $"Emitido pelo usuário: {nome}, data e hora: {networkTime}."; + html5 += ""; + string tempPath = Path.GetTempPath(); + string text2 = $"{tempPath}{(object)(TipoExtrato)0}CheckList_{networkTime:ddMMyyyyhhmmss}.html"; + StreamWriter streamWriter = new StreamWriter(text2, append: true, Encoding.UTF8); + streamWriter.Write(html5); + streamWriter.Close(); + Process.Start(text2); + } + + public async Task EmitirProtocolos(List> lista, bool doisPorPagina, List protocolo) + { + int multiploDois = 0; + DateTime now = Funcoes.GetNetworkTime(); + int i = 0; + StringBuilder pageBuilder = new StringBuilder(); + StringBuilder protocoloContent = new StringBuilder(); + foreach (Tuple listum in lista) + { + i++; + ApoliceServico apoliceServico = new ApoliceServico(); + ItemServico itemServico = new ItemServico(); + ClienteServico cliServico = new ClienteServico(); + ParcelaServico parcelaServico = new ParcelaServico(); + Documento apolice = await apoliceServico.BuscarApoliceAsync(listum.Item1); + apolice.Controle.Cliente.Telefones = cliServico.BuscarTelefones(((DomainBase)apolice.Controle.Cliente).Id); + Cliente cliente = apolice.Controle.Cliente; + cliente.Emails = await cliServico.BuscarEmailsAsync(((DomainBase)apolice.Controle.Cliente).Id); + cliente = apolice.Controle.Cliente; + cliente.Enderecos = await cliServico.BuscarEnderecosAsync(((DomainBase)apolice.Controle.Cliente).Id); + if (apolice.VendedorPrincipal == null) + { + Documento val = apolice; + val.VendedorPrincipal = await apoliceServico.BuscarVendedorPrincipal(((DomainBase)apolice.Controle).Id); + } + ObservableCollection itens = await itemServico.BuscarItems(((DomainBase)apolice).Id, (StatusItem)2); + if (itens == null || itens.Count == 0) + { + itens = await itemServico.BuscarItens(((DomainBase)apolice.Controle).Id, (StatusItem)3); + } + ObservableCollection observableCollection = await parcelaServico.BuscarParcelasAsync(((DomainBase)apolice).Id); + apolice.ProtocoloEmail = protocolo.Find((Documento x) => ((DomainBase)x).Id == ((DomainBase)apolice).Id).ProtocoloEmail; + apolice.ProtocoloTelefone = protocolo.Find((Documento x) => ((DomainBase)x).Id == ((DomainBase)apolice).Id).ProtocoloTelefone; + apolice.ProtocoloParcela = protocolo.Find((Documento x) => ((DomainBase)x).Id == ((DomainBase)apolice).Id).ProtocoloParcela; + apolice.ProtocoloEndereco = protocolo.Find((Documento x) => ((DomainBase)x).Id == ((DomainBase)apolice).Id).ProtocoloEndereco; + apolice.ProtocoloVendedor = protocolo.Find((Documento x) => ((DomainBase)x).Id == ((DomainBase)apolice).Id).ProtocoloVendedor; + ObservableCollection telefones = apolice.Controle.Cliente.Telefones; + string text = "Telefone: " + ((apolice.ProtocoloTelefone && telefones != null && telefones.Where((ClienteTelefone t) => !string.IsNullOrEmpty(((TelefoneBase)t).Numero)).Any()) ? string.Join(" | ", (from t in telefones + where !string.IsNullOrEmpty(((TelefoneBase)t).Numero) + select ((TelefoneBase)t).Prefixo + " " + ((TelefoneBase)t).Numero).ToList()) : null) + ""; + ClienteEndereco val2 = apolice.Controle.Cliente.Enderecos?.FirstOrDefault(); + string newValue = (protocolo.Find((Documento x) => ((DomainBase)x).Id == ((DomainBase)apolice).Id).ProtocoloEndereco ? ((string.IsNullOrWhiteSpace(((EnderecoBase)val2).Endereco) ? "" : ((EnderecoBase)val2).Endereco) + ", " + (string.IsNullOrWhiteSpace(((EnderecoBase)val2).Numero) ? "" : ((EnderecoBase)val2).Numero) + (string.IsNullOrWhiteSpace(((EnderecoBase)val2).Complemento) ? "" : (" - " + ((EnderecoBase)val2).Complemento)) + " - " + (string.IsNullOrWhiteSpace(((EnderecoBase)val2).Bairro) ? "" : ((EnderecoBase)val2).Bairro) + " - " + (string.IsNullOrWhiteSpace(((EnderecoBase)val2).Cidade) ? "" : ((EnderecoBase)val2).Cidade) + " - " + (string.IsNullOrWhiteSpace(((EnderecoBase)val2).Estado) ? "" : ((EnderecoBase)val2).Estado) + ", " + (string.IsNullOrWhiteSpace(((EnderecoBase)val2).Cep) ? "" : ((EnderecoBase)val2).Cep)) : null); + ObservableCollection emails = apolice.Controle.Cliente.Emails; + bool flag = apolice.ProtocoloEmail && emails != null && emails.Count > 0 && !string.IsNullOrEmpty(((EmailBase)emails.First()).Email); + string newValue2 = " Email: " + (flag ? ((EmailBase)emails.First()).Email : null) + ""; + string newValue3 = ((telefones == null && val2 == null && emails == null) ? "style='display:none;'" : ""); + string newValue4 = (string.IsNullOrWhiteSpace(apolice.Endosso) ? ", " : (" e
endosso de n° " + apolice.Endosso + ", ")); + string newValue5 = "iniciado em " + (string.IsNullOrWhiteSpace(apolice.Vigencia1.ToShortDateString()) ? "" : apolice.Vigencia1.ToShortDateString()) + " até " + (string.IsNullOrWhiteSpace(apolice.Vigencia2?.ToShortDateString()) ? "" : apolice.Vigencia2?.ToShortDateString()) + ""; + string newValue6 = ((itens != null && itens.Count > 0) ? ("" + (string.IsNullOrWhiteSpace(itens[0].Descricao) ? "" : itens[0].Descricao) + "") : ""); + string text2 = ""; + Documento? obj = ((IEnumerable)protocolo).FirstOrDefault((Func)((Documento x) => ((DomainBase)x).Id == ((DomainBase)apolice).Id)); + string text3 = ((obj != null) ? obj.ObsProtocolo : null); + string newValue7 = (string.IsNullOrEmpty(text3) ? "" : ("OBSERVAÇÃO: " + text3)); + if (apolice.ProtocoloParcela && observableCollection != null && observableCollection.Count > 0) + { + text2 = ((observableCollection.Count != 1) ? (string.Format("{0} parcelas: vencimento 1ª parcela: {1}, ", observableCollection.Count, string.IsNullOrWhiteSpace(observableCollection[0].Vencimento.ToShortDateString()) ? "" : observableCollection[0].Vencimento.ToShortDateString()) + "vencimento 2ª parcela: " + (string.IsNullOrWhiteSpace(observableCollection[1].Vencimento.ToShortDateString()) ? "" : observableCollection[1].Vencimento.ToShortDateString()) + ", demais parcelas, vide apólice.") : (text2 + "1 parcela: vencimento " + (string.IsNullOrWhiteSpace(observableCollection[0].Vencimento.ToShortDateString()) ? "" : observableCollection[0].Vencimento.ToShortDateString()) + " ")); + } + string text4 = (apolice.ProtocoloVendedor ? apolice.Pasta : null); + object obj2; + if (!apolice.ProtocoloVendedor) + { + obj2 = null; + } + else + { + Vendedor vendedorPrincipal = apolice.VendedorPrincipal; + obj2 = ((vendedorPrincipal != null) ? vendedorPrincipal.Nome : null); + } + string text5 = (string)obj2; + string newValue8 = ((text4 != null || text5 != null) ? "" : "style = 'display:none;'"); + protocoloContent.Append(Resources.ProtocoloTemplate.Replace("{Tamanho}", doisPorPagina ? "12.2cm" : "24.4cm").Replace("{Observacao}", newValue7).Replace("{Nome}", apolice.Controle.Cliente.Nome) + .Replace("{Email}", newValue2) + .Replace("{DisplayTelefones}", newValue3) + .Replace("{Telefones}", (telefones != null) ? text : "") + .Replace("{Endereço}", newValue) + .Replace("{Ramo}", apolice.Controle.Ramo.Nome) + .Replace("{Apolice}", apolice.Apolice) + .Replace("{Endosso}", newValue4) + .Replace("{Seguradora}", apolice.Controle.Seguradora.Nome) + .Replace("{Vigencias}", newValue5) + .Replace("{Item}", newValue6) + .Replace("{Parcelas}", text2) + .Replace("{Pasta}", text4) + .Replace("{Vendedor}", text5) + .Replace("{DisplayVendedor}", newValue8) + .Replace("{NomeCorretora}", Recursos.Empresa.Nome) + .Replace("{Usuario}", Recursos.Usuario.Nome) + .Replace("{Emissao}", $"{now}")); + multiploDois++; + if (!doisPorPagina || i == 2) + { + protocoloContent.Append("
"); + i = 0; + } + } + pageBuilder.Append(Resources.ProtocoloPageTemplate.Replace("{Protocolos}", protocoloContent.ToString())); + string tempPath = Path.GetTempPath(); + string text6 = $"{tempPath}{(object)(TipoExtrato)0}_{now:ddMMyyyyhhmmss}.html"; + StreamWriter streamWriter = new StreamWriter(text6, append: true, Encoding.UTF8); + streamWriter.Write((object?)pageBuilder); + streamWriter.Close(); + Process.Start(text6); + RegistrarAcao(string.Format("EMITIU PROTOCOLO DE {0} DOCUMENTO{1}", lista.Count, (lista.Count == 1) ? "" : "S"), 0L, (TipoTela)59, "IDS DOS DOCUMENTOS E SUAS RESPECTIVAS OBSERVAÇÕES:\n" + string.Join("\n", lista.Select((Tuple x) => x.Item1 + ": \"" + x.Item2 + "\""))); + } + + public async Task VerificarAcesso(long id) + { + string erro = null; + Usuario val = await new UsuarioServico().BuscarUsuarioPorId(id); + if (val == null) + { + return "DADOS DE ACESSO INVÁLIDOS"; + } + List list = new List(); + List list2 = new List { "SEGUNDAS-FEIRAS", "TERÇAS-FEIRAS", "QUARTAS-FEIRAS", "QUINTAS-FEIRAS", "SEXTAS-FEIRAS", "SÁBADOS", "DOMINGOS" }; + if (val.Segunda == false) + { + list.Add("SEGUNDAS-FEIRAS"); + list2.Remove("SEGUNDAS-FEIRAS"); + } + if (val.Terca == false) + { + list.Add("TERÇAS-FEIRAS"); + list2.Remove("TERÇAS-FEIRAS"); + } + if (val.Quarta == false) + { + list.Add("QUARTAS-FEIRAS"); + list2.Remove("QUARTAS-FEIRAS"); + } + if (val.Quinta == false) + { + list.Add("QUINTAS-FEIRAS"); + list2.Remove("QUINTAS-FEIRAS"); + } + if (val.Sexta == false) + { + list.Add("SEXTAS-FEIRAS"); + list2.Remove("SEXTAS-FEIRAS"); + } + if (val.Sabado == false) + { + list.Add("SÁBADOS"); + list2.Remove("SÁBADOS"); + } + if (val.Domingo == false) + { + list.Add("DOMINGOS"); + list2.Remove("DOMINGOS"); + } + string text; + if (list.Count == 7) + { + text = "RESTRITO TODOS OS DIAS"; + } + else if (list.Count <= 3) + { + text = "RESTRITO "; + for (int i = 0; i < list.Count; i++) + { + text = ((i >= list.Count - 2) ? ((i != list.Count - 2) ? (text + list[i]) : (text + list[i] + " E ")) : (text + list[i] + ", ")); + } + } + else + { + text = "APENAS PERMITIDO "; + for (int j = 0; j < list2.Count; j++) + { + text = ((j >= list2.Count - 2) ? ((j != list2.Count - 2) ? (text + list2[j]) : (text + list2[j] + " E ")) : (text + list2[j] + ", ")); + } + } + DateTime networkTime = Funcoes.GetNetworkTime(); + switch (networkTime.DayOfWeek) + { + case DayOfWeek.Monday: + if (val.Segunda == false) + { + return "ACESSO " + text + ". CONTATE O ADMINISTRADOR DO SISTEMA"; + } + break; + case DayOfWeek.Tuesday: + if (val.Terca == false) + { + return "ACESSO " + text + ". CONTATE O ADMINISTRADOR DO SISTEMA"; + } + break; + case DayOfWeek.Wednesday: + if (val.Quarta == false) + { + return "ACESSO " + text + ". CONTATE O ADMINISTRADOR DO SISTEMA"; + } + break; + case DayOfWeek.Thursday: + if (val.Quinta == false) + { + return "ACESSO " + text + ". CONTATE O ADMINISTRADOR DO SISTEMA"; + } + break; + case DayOfWeek.Friday: + if (val.Sexta == false) + { + return "ACESSO " + text + ". CONTATE O ADMINISTRADOR DO SISTEMA"; + } + break; + case DayOfWeek.Saturday: + if (val.Sabado == false) + { + return "ACESSO " + text + ". CONTATE O ADMINISTRADOR DO SISTEMA"; + } + break; + case DayOfWeek.Sunday: + if (val.Domingo == false) + { + return "ACESSO " + text + ". CONTATE O ADMINISTRADOR DO SISTEMA"; + } + break; + } + if (val.InicioAcesso.HasValue && val.FimAcesso.HasValue && (networkTime.TimeOfDay <= val.InicioAcesso.Value.TimeOfDay || networkTime.TimeOfDay >= val.FimAcesso.Value.TimeOfDay)) + { + erro = "USUÁRIO COM PERMISSÃO DE ACESSO ENTRE " + val.InicioAcesso.Value.ToShortTimeString() + " E " + val.FimAcesso.Value.ToShortTimeString(); + } + return erro; + } + + public void RegistrarAcao(string descricao, long entidadeId, TipoTela? tela = null, object obs = null) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_0013: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Expected O, but got Unknown + RegistroAcao log = new RegistroAcao + { + Descricao = descricao, + EntidadeId = entidadeId, + Tela = tela + }; + new ApoliceServico().SalvarAcao(log, obs); + } + + public void RegistrarAcao(string descricao, Relatorio? relatorio, object obs = null) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Expected O, but got Unknown + RegistroAcao log = new RegistroAcao + { + Relatorio = relatorio, + Descricao = descricao + }; + new ApoliceServico().SalvarAcao(log, obs); + } + + public async Task SalvarAttachments(List arquivos, TipoArquivoDigital tipoAd, long id) + { + //IL_001e: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + if (arquivos == null || arquivos.Count == 0) + { + return false; + } + arquivos.ForEach(delegate(ArquivoDigital x) + { + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + //IL_0008: Invalid comparison between Unknown and I4 + //IL_001b: Unknown result type (might be due to invalid IL or missing references) + //IL_0021: Invalid comparison between Unknown and I4 + //IL_0034: Unknown result type (might be due to invalid IL or missing references) + //IL_003a: Invalid comparison between Unknown and I4 + //IL_004d: Unknown result type (might be due to invalid IL or missing references) + //IL_0053: Invalid comparison between Unknown and I4 + //IL_0066: Unknown result type (might be due to invalid IL or missing references) + //IL_006c: Invalid comparison between Unknown and I4 + //IL_007f: Unknown result type (might be due to invalid IL or missing references) + //IL_0085: Invalid comparison between Unknown and I4 + //IL_0098: Unknown result type (might be due to invalid IL or missing references) + //IL_009f: Invalid comparison between Unknown and I4 + //IL_00b2: Unknown result type (might be due to invalid IL or missing references) + //IL_00b8: Invalid comparison between Unknown and I4 + //IL_00cb: Unknown result type (might be due to invalid IL or missing references) + //IL_00d1: Invalid comparison between Unknown and I4 + //IL_00e4: Unknown result type (might be due to invalid IL or missing references) + //IL_00eb: Invalid comparison between Unknown and I4 + //IL_00fe: Unknown result type (might be due to invalid IL or missing references) + //IL_0105: Invalid comparison between Unknown and I4 + //IL_0118: Unknown result type (might be due to invalid IL or missing references) + //IL_011f: Invalid comparison between Unknown and I4 + //IL_0132: Unknown result type (might be due to invalid IL or missing references) + //IL_0139: Invalid comparison between Unknown and I4 + //IL_014c: Unknown result type (might be due to invalid IL or missing references) + //IL_0153: Invalid comparison between Unknown and I4 + //IL_0166: Unknown result type (might be due to invalid IL or missing references) + //IL_016d: Invalid comparison between Unknown and I4 + //IL_0180: Unknown result type (might be due to invalid IL or missing references) + //IL_0187: Invalid comparison between Unknown and I4 + x.IdCliente = (((int)tipoAd == 1) ? id : 0); + x.IdDocumento = (((int)tipoAd == 2) ? id : 0); + x.IdParcela = (((int)tipoAd == 3) ? id : 0); + x.IdItem = (((int)tipoAd == 4) ? id : 0); + x.IdSinistro = (((int)tipoAd == 5) ? id : 0); + x.IdVendedor = (((int)tipoAd == 6) ? id : 0); + x.IdUsuario = (((int)tipoAd == 12) ? id : 0); + x.IdSeguradora = (((int)tipoAd == 8) ? id : 0); + x.IdExtrato = (((int)tipoAd == 7) ? id : 0); + x.IdLancamento = (((int)tipoAd == 9) ? id : 0); + x.IdFornecedor = (((int)tipoAd == 10) ? id : 0); + x.IdProspeccao = (((int)tipoAd == 11) ? id : 0); + x.IdSocio = (((int)tipoAd == 14) ? id : 0); + x.IdTarefa = (((int)tipoAd == 15) ? id : 0); + x.IdNotaFiscal = (((int)tipoAd == 16) ? id : 0); + x.IdEstipulante = (((int)tipoAd == 17) ? id : 0); + x.IdEmpresa = Recursos.Usuario.IdEmpresa; + }); + TipoArquivoDigital val = tipoAd; + switch (val - 1) + { + default: + await ArquivoDigitalServico.Insert(arquivos); + if (!ArquivoDigitalServico.Sucesso) + { + return false; + } + return true; + } + } + + public double GetWindowHeight() + { + return ((FrameworkElement)((IEnumerable)Application.Current.Windows).OfType().SingleOrDefault((Func)((Window x) => x.IsActive))).ActualHeight; + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Generic/DialogAdvertisingViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Generic/DialogAdvertisingViewModel.cs new file mode 100644 index 0000000..eeacfe2 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Generic/DialogAdvertisingViewModel.cs @@ -0,0 +1,225 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Windows; +using Gestor.Application.Helpers; +using Gestor.Application.Model; +using Gestor.Common.Validation; +using Gestor.Model.Domain.Generic; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace Gestor.Application.ViewModels.Generic; + +public class DialogAdvertisingViewModel : BaseViewModel +{ + private readonly bool _isPromo; + + private string _urlPesquisa; + + private Visibility _visualizarNaoExibirNovamente = (Visibility)1; + + private string _titulo = ""; + + private string _imagem = ""; + + public string Url = ""; + + private bool _naoQuero; + + public Visibility VisualizarNaoExibirNovamente + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visualizarNaoExibirNovamente; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visualizarNaoExibirNovamente = value; + OnPropertyChanged("VisualizarNaoExibirNovamente"); + } + } + + public string Titulo + { + get + { + return _titulo; + } + set + { + _titulo = value; + OnPropertyChanged("Titulo"); + } + } + + public string Imagem + { + get + { + return _imagem; + } + set + { + _imagem = value; + OnPropertyChanged("Imagem"); + } + } + + public bool NaoVer + { + get + { + return _naoQuero; + } + set + { + _naoQuero = value; + OnPropertyChanged("NaoVer"); + } + } + + public DialogAdvertisingViewModel(JObject jsonAd, bool isPromo) + { + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + bool flag = false; + _isPromo = isPromo; + if (!_isPromo) + { + CarregaPesquisa(jsonAd); + } + else + { + CarregaImagem(jsonAd); + JToken obj = jsonAd["NaoExibirNovamente"]; + flag = obj == null || Extensions.Value((IEnumerable)obj); + } + VisualizarNaoExibirNovamente = (Visibility)(!flag); + } + + private void CarregaImagem(JObject json) + { + if (json != null) + { + JToken obj = json["Titulo"]; + Titulo = ((obj != null) ? Extensions.Value((IEnumerable)obj) : null); + JToken obj2 = json["Url"]; + Url = ((obj2 != null) ? Extensions.Value((IEnumerable)obj2) : null); + JToken obj3 = json["Imagem"]; + Imagem = ((obj3 != null) ? Extensions.Value((IEnumerable)obj3) : null); + } + } + + public void SalvaEditarArquivoConfig(bool visto = false) + { + if (!File.Exists("config.json")) + { + CriarConfiguracaoPadrao("config.json"); + } + Gestor.Application.Model.Configuracoes configuracoes = JsonConvert.DeserializeObject(File.ReadAllText("config.json")); + configuracoes.LinkPromo = (_isPromo ? Imagem : _urlPesquisa); + configuracoes.NaoverPromo = NaoVer; + File.WriteAllText("config.json", JsonConvert.SerializeObject((object)configuracoes, (Formatting)1)); + } + + public void CriarConfiguracaoPadrao(string configFile) + { + Gestor.Application.Model.Configuracoes configuracoes = new Gestor.Application.Model.Configuracoes + { + LinkPromo = "", + NaoverPromo = NaoVer + }; + File.WriteAllText(configFile, JsonConvert.SerializeObject((object)configuracoes, (Formatting)1)); + } + + private void CarregaPesquisa(JObject json) + { + if (json != null) + { + JToken obj = json["Titulo"]; + Titulo = ((obj != null) ? Extensions.Value((IEnumerable)obj) : null); + JToken obj2 = json["Imagem"]; + Imagem = ((obj2 != null) ? Extensions.Value((IEnumerable)obj2) : null); + JToken obj3 = json["UrlPost"]; + _urlPesquisa = ((obj3 != null) ? Extensions.Value((IEnumerable)obj3) : null); + if (!ValidationHelper.IsNotNullOrEmpty(_urlPesquisa)) + { + JToken obj4 = json["UrlFixa"]; + _urlPesquisa = ((obj4 != null) ? Extensions.Value((IEnumerable)obj4) : null); + Url = _urlPesquisa; + } + } + } + + public void EnviarPesquisa() + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Expected O, but got Unknown + try + { + HttpClient val = new HttpClient(); + try + { + ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; + val.Timeout = TimeSpan.FromSeconds(15.0); + ((HttpHeaders)val.DefaultRequestHeaders).TryAddWithoutValidation("company-key", "$2b$10$arV/viDP6N.5KX9sRt/.MOo8Gv5FFvHIx0P6HZyuky51P3ItWBV0u"); + var content = new + { + customers = new[] + { + new + { + nome = Recursos.Usuario.Nome, + email = (ValidationHelper.IsNullOrEmpty(Recursos.Usuario.Email) ? $"{((DomainBase)Recursos.Usuario).Id}-{ApplicationHelper.IdFornecedor}@sememail.com" : Recursos.Usuario.Email), + corretora = Recursos.Empresa.NomeSocial, + produto = "Gestor", + idfornecedor = ApplicationHelper.IdFornecedor + } + } + }; + HttpResponseMessage result = val.PostAsync(_urlPesquisa, (HttpContent)(object)content.ToHttpContent()).Result; + if (!result.IsSuccessStatusCode) + { + return; + } + JToken obj = JObject.Parse(result.Content.ReadAsStringAsync().Result)["customers"]; + object obj2; + if (obj == null) + { + obj2 = null; + } + else + { + JToken obj3 = obj[(object)0]; + if (obj3 == null) + { + obj2 = null; + } + else + { + JToken obj4 = obj3[(object)"shortUrl"]; + obj2 = ((obj4 != null) ? Extensions.Value((IEnumerable)obj4) : null); + } + } + string text = (string)obj2; + if (!ValidationHelper.IsNullOrEmpty(text)) + { + Url = text; + } + } + finally + { + ((IDisposable)val)?.Dispose(); + } + } + catch (Exception) + { + } + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Generic/DialogAnexarViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Generic/DialogAnexarViewModel.cs new file mode 100644 index 0000000..2c372da --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Generic/DialogAnexarViewModel.cs @@ -0,0 +1,35 @@ +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using Gestor.Model.Domain.Common; + +namespace Gestor.Application.ViewModels.Generic; + +public class DialogAnexarViewModel : BaseViewModel +{ + private ObservableCollection _arquivos = new ObservableCollection(); + + public ObservableCollection Arquivos + { + get + { + return _arquivos; + } + set + { + _arquivos = value; + OnPropertyChanged("Arquivos"); + } + } + + public DialogAnexarViewModel(List arquivos) + { + Arquivos = new ObservableCollection(arquivos); + } + + public void Remover(ArquivoDigital removido) + { + IEnumerable collection = Arquivos.Where((ArquivoDigital x) => x.Descricao == removido.Descricao && x.Arquivo.Length == removido.Arquivo.Length); + Arquivos = new ObservableCollection(collection); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Generic/DialogCopiaViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Generic/DialogCopiaViewModel.cs new file mode 100644 index 0000000..87c487a --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Generic/DialogCopiaViewModel.cs @@ -0,0 +1,162 @@ +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using Gestor.Model.Domain.MalaDireta; +using Gestor.Model.Helper; + +namespace Gestor.Application.ViewModels.Generic; + +public class DialogCopiaViewModel : BaseViewModel +{ + private List _tipoCopia = new List { "CÓPIA COMUM", "CÓPIA OCULTA" }; + + private string _tipo; + + private string _copiarPara; + + private Copia _copia; + + private string _erro; + + private ObservableCollection _copiasComuns; + + private ObservableCollection _copiasOcultas; + + public List TipoCopia + { + get + { + return _tipoCopia; + } + set + { + _tipoCopia = value; + OnPropertyChanged("TipoCopia"); + } + } + + public string Tipo + { + get + { + return _tipo; + } + set + { + _tipo = value; + OnPropertyChanged("Tipo"); + } + } + + public string CopiarPara + { + get + { + return _copiarPara; + } + set + { + _copiarPara = value; + OnPropertyChanged("CopiarPara"); + } + } + + public Copia Copia + { + get + { + return _copia; + } + set + { + _copia = value; + OnPropertyChanged("Copia"); + } + } + + public string Erro + { + get + { + return _erro; + } + set + { + _erro = value; + OnPropertyChanged("Erro"); + } + } + + public ObservableCollection CopiasComuns + { + get + { + return _copiasComuns; + } + set + { + _copiasComuns = value; + OnPropertyChanged("CopiasComuns"); + } + } + + public ObservableCollection CopiasOcultas + { + get + { + return _copiasOcultas; + } + set + { + _copiasOcultas = value; + OnPropertyChanged("CopiasOcultas"); + } + } + + public DialogCopiaViewModel(Copia copia) + { + //IL_003e: Unknown result type (might be due to invalid IL or missing references) + //IL_0043: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + Tipo = TipoCopia.First(); + Copia = (Copia)(((object)copia) ?? ((object)new Copia + { + CopiaOculta = new List(), + CopiaComum = new List() + })); + CopiasComuns = new ObservableCollection(Copia.CopiaComum); + CopiasOcultas = new ObservableCollection(Copia.CopiaOculta); + } + + public void AdicionarCopia() + { + if (!ValidationHelper.ValidacaoEmail(CopiarPara)) + { + Erro = "E-MAIL INVÁLIDO"; + return; + } + if (Copia.CopiaOculta.Contains(CopiarPara)) + { + Erro = "E-MAIL JÁ ADICIONADO"; + return; + } + Copia.CopiaOculta.Add(CopiarPara); + CopiasOcultas = new ObservableCollection(Copia.CopiaOculta); + CopiarPara = string.Empty; + Erro = "E-MAIL ADICIONADO COM SUCESSO"; + } + + public void ExcluirCopia(string tipo, string copia) + { + if (!(tipo == "CÓPIA OCULTA")) + { + Copia.CopiaComum.Remove(copia); + } + else + { + Copia.CopiaOculta.Remove(copia); + } + CopiasComuns = new ObservableCollection(Copia.CopiaComum); + CopiasOcultas = new ObservableCollection(Copia.CopiaOculta); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Generic/DialogCopiarPermissaoViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Generic/DialogCopiarPermissaoViewModel.cs new file mode 100644 index 0000000..465409a --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Generic/DialogCopiarPermissaoViewModel.cs @@ -0,0 +1,320 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Relatorios; +using Gestor.Model.Domain.Relatorios.ApolicePendente; +using Gestor.Model.Domain.Relatorios.Auditoria; +using Gestor.Model.Domain.Relatorios.Classificacao; +using Gestor.Model.Domain.Relatorios.ClientesAtivosInativos; +using Gestor.Model.Domain.Relatorios.Comissao; +using Gestor.Model.Domain.Relatorios.ExtratoBaixado; +using Gestor.Model.Domain.Relatorios.FaturaPendente; +using Gestor.Model.Domain.Relatorios.Fechamento; +using Gestor.Model.Domain.Relatorios.Licenciamento; +using Gestor.Model.Domain.Relatorios.LogsEnvio; +using Gestor.Model.Domain.Relatorios.MetaSeguradora; +using Gestor.Model.Domain.Relatorios.MetaVendedor; +using Gestor.Model.Domain.Relatorios.NotaFiscal; +using Gestor.Model.Domain.Relatorios.Pendente; +using Gestor.Model.Domain.Relatorios.Placa; +using Gestor.Model.Domain.Relatorios.PrevisaoPagamentoComissao; +using Gestor.Model.Domain.Relatorios.Producao; +using Gestor.Model.Domain.Relatorios.Renovacao; +using Gestor.Model.Domain.Relatorios.Sinistro; +using Gestor.Model.Domain.Relatorios.Tarefa; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Generic; + +public class DialogCopiarPermissaoViewModel : BaseSegurosViewModel +{ + private Usuario _selectedUsuario; + + private Tuple, Usuario, List, List, List> _usuarioParameter; + + public Usuario SelectedUsuario + { + get + { + return _selectedUsuario; + } + set + { + _selectedUsuario = value; + WorkOnSelectedUsuario(value); + OnPropertyChanged("SelectedUsuario"); + } + } + + public Tuple, Usuario, List, List, List> UsuarioParameter + { + get + { + return _usuarioParameter; + } + set + { + _usuarioParameter = value; + OnPropertyChanged("UsuarioParameter"); + } + } + + public DialogCopiarPermissaoViewModel() + { + UsuarioParameter = new Tuple, Usuario, List, List, List>(null, null, null, null, null); + } + + private async void WorkOnSelectedUsuario(Usuario value) + { + if (value != null && ((DomainBase)value).Id != 0L) + { + UsuarioParameter = new Tuple, Usuario, List, List, List>(await GetPermissoes(value), value, await GetRestricoes(value), await GetPermissoesArquivoDigital(value), await GetRestricoesCamposRelatorios(value)); + } + } + + private async Task> GetPermissoesArquivoDigital(Usuario usuario) + { + List list = new List(); + List telas = (from TipoArquivoDigital v in Enum.GetValues(typeof(TipoArquivoDigital)) + select ((object)(TipoArquivoDigital)(ref v)).ToString() into x + orderby x + select x).ToList(); + List permissoes = await ServicoPermissArquivoDigital.PermissArquivoDigital(usuario); + telas.ForEach(delegate(string x) + { + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_00ca: Unknown result type (might be due to invalid IL or missing references) + //IL_00cf: Unknown result type (might be due to invalid IL or missing references) + //IL_00d6: Unknown result type (might be due to invalid IL or missing references) + //IL_00d8: Unknown result type (might be due to invalid IL or missing references) + //IL_00e2: Unknown result type (might be due to invalid IL or missing references) + //IL_00e9: Unknown result type (might be due to invalid IL or missing references) + //IL_00f0: Unknown result type (might be due to invalid IL or missing references) + //IL_00fa: Expected O, but got Unknown + TipoArquivoDigital tela = (TipoArquivoDigital)Enum.Parse(typeof(TipoArquivoDigital), x); + long id = 0L; + bool consultar = true; + bool incluir = true; + bool excluir = true; + if (permissoes.Count > 0 && permissoes.Any((PermissaoArquivoDigital y) => y.Tela == tela)) + { + id = ((DomainBase)permissoes.First((PermissaoArquivoDigital y) => y.Tela == tela)).Id; + consultar = permissoes.First((PermissaoArquivoDigital y) => y.Tela == tela).Consultar; + incluir = permissoes.First((PermissaoArquivoDigital y) => y.Tela == tela).Incluir; + excluir = permissoes.First((PermissaoArquivoDigital y) => y.Tela == tela).Excluir; + } + PermissaoArquivoDigital item = new PermissaoArquivoDigital + { + Id = id, + Tela = tela, + Consultar = consultar, + Incluir = incluir, + Excluir = excluir + }; + list.Add(item); + }); + return list; + } + + private async Task> GetPermissoes(Usuario usuario) + { + List list = new List(); + List telas = (from TipoTela v in Enum.GetValues(typeof(TipoTela)) + select ((object)(TipoTela)(ref v)).ToString() into x + orderby x + select x).ToList(); + List permissoes = await ServicoPermissUsuario.PermissUsuario(usuario); + telas.ForEach(delegate(string x) + { + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Unknown result type (might be due to invalid IL or missing references) + //IL_003f: Unknown result type (might be due to invalid IL or missing references) + //IL_0129: Unknown result type (might be due to invalid IL or missing references) + //IL_012e: Unknown result type (might be due to invalid IL or missing references) + //IL_0135: Unknown result type (might be due to invalid IL or missing references) + //IL_0137: Unknown result type (might be due to invalid IL or missing references) + //IL_0141: Unknown result type (might be due to invalid IL or missing references) + //IL_0148: Unknown result type (might be due to invalid IL or missing references) + //IL_014f: Unknown result type (might be due to invalid IL or missing references) + //IL_0157: Unknown result type (might be due to invalid IL or missing references) + //IL_0161: Expected O, but got Unknown + TipoTela tela = (TipoTela)Enum.Parse(typeof(TipoTela), x); + if (string.Equals(ValidationHelper.GetCategory((Enum)(object)tela), "seguros", StringComparison.CurrentCultureIgnoreCase) || string.Equals(ValidationHelper.GetCategory((Enum)(object)tela), "ferramentas", StringComparison.CurrentCultureIgnoreCase)) + { + long id = 0L; + bool consultar = true; + bool incluir = true; + bool alterar = true; + bool excluir = true; + if (permissoes.Count > 0 && permissoes.Any((PermissaoUsuario y) => y.Tela == tela)) + { + id = ((DomainBase)permissoes.First((PermissaoUsuario y) => y.Tela == tela)).Id; + consultar = permissoes.First((PermissaoUsuario y) => y.Tela == tela).Consultar; + incluir = permissoes.First((PermissaoUsuario y) => y.Tela == tela).Incluir; + alterar = permissoes.First((PermissaoUsuario y) => y.Tela == tela).Alterar; + excluir = permissoes.First((PermissaoUsuario y) => y.Tela == tela).Excluir; + } + PermissaoUsuario item = new PermissaoUsuario + { + Id = id, + Tela = tela, + Consultar = consultar, + Incluir = incluir, + Alterar = alterar, + Excluir = excluir + }; + list.Add(item); + } + }); + return list; + } + + private async Task> GetRestricoes(Usuario usuario) + { + List list = new List(); + List tipos = (from TipoRestricao v in Enum.GetValues(typeof(TipoRestricao)) + select ((object)(TipoRestricao)(ref v)).ToString() into x + orderby x + select x).ToList(); + List restricoesUsuario = await ServicoRestriUsuario.BuscarRestricoes(((DomainBase)usuario).Id); + tipos.ForEach(delegate(string x) + { + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0087: Unknown result type (might be due to invalid IL or missing references) + //IL_008c: Unknown result type (might be due to invalid IL or missing references) + //IL_0093: Unknown result type (might be due to invalid IL or missing references) + //IL_0095: Unknown result type (might be due to invalid IL or missing references) + //IL_009f: Unknown result type (might be due to invalid IL or missing references) + //IL_00a7: Expected O, but got Unknown + TipoRestricao tipo = (TipoRestricao)Enum.Parse(typeof(TipoRestricao), x); + long id = 0L; + bool restricao = false; + if (restricoesUsuario.Count > 0 && restricoesUsuario.Any((RestricaoUsuario y) => y.Tipo == tipo)) + { + id = ((DomainBase)restricoesUsuario.First((RestricaoUsuario y) => y.Tipo == tipo)).Id; + restricao = restricoesUsuario.First((RestricaoUsuario y) => y.Tipo == tipo).Restricao; + } + RestricaoUsuario item = new RestricaoUsuario + { + Id = id, + Tipo = tipo, + Restricao = restricao + }; + list.Add(item); + }); + return list; + } + + private async Task> GetRestricoesCamposRelatorios(Usuario usuario) + { + List list = new List(); + List parametros = new List(); + foreach (Relatorio item2 in Enum.GetValues(typeof(Relatorio)).Cast()) + { + switch ((int)item2) + { + case 0: + case 1: + parametros.AddRange(Funcoes.ColunasRelatorio(item2, new List())); + break; + case 2: + parametros.AddRange(Funcoes.ColunasRelatorio(item2, new List())); + break; + case 3: + parametros.AddRange(Funcoes.ColunasRelatorio(item2, new List())); + break; + case 18: + parametros.AddRange(Funcoes.ColunasRelatorio(item2, new List())); + break; + case 4: + parametros.AddRange(Funcoes.ColunasRelatorio(item2, new List())); + break; + case 5: + parametros.AddRange(Funcoes.ColunasRelatorio(item2, new List())); + break; + case 6: + case 16: + parametros.AddRange(Funcoes.ColunasRelatorio(item2, new List())); + break; + case 9: + case 10: + parametros.AddRange(Funcoes.ColunasRelatorio(item2, new List())); + break; + case 23: + parametros.AddRange(Funcoes.ColunasRelatorio(item2, new List())); + break; + case 8: + parametros.AddRange(Funcoes.ColunasRelatorio(item2, new List())); + break; + case 13: + parametros.AddRange(Funcoes.ColunasRelatorio(item2, new List())); + break; + case 12: + parametros.AddRange(Funcoes.ColunasRelatorio(item2, new List())); + break; + case 14: + parametros.AddRange(Funcoes.ColunasRelatorio(item2, new List())); + break; + case 15: + parametros.AddRange(Funcoes.ColunasRelatorio(item2, new List())); + break; + case 11: + parametros.AddRange(Funcoes.ColunasRelatorio(item2, new List())); + break; + case 17: + parametros.AddRange(Funcoes.ColunasRelatorio(item2, new List())); + break; + case 27: + parametros.AddRange(Funcoes.ColunasRelatorio(item2, new List())); + break; + case 7: + parametros.AddRange(Funcoes.ColunasRelatorio(item2, new List())); + break; + case 19: + parametros.AddRange(Funcoes.ColunasRelatorio(item2, new List())); + break; + case 20: + parametros.AddRange(Funcoes.ColunasRelatorio(item2, new List())); + break; + case 29: + parametros.AddRange(Funcoes.ColunasRelatorio(item2, new List())); + break; + } + } + List restricoesUsuario = await ServicoRestriUsuario.BuscarRestricoesCamposRelatorios(((DomainBase)usuario).Id); + parametros.ForEach(delegate(ParametrosRelatorio x) + { + //IL_0073: Unknown result type (might be due to invalid IL or missing references) + //IL_0078: Unknown result type (might be due to invalid IL or missing references) + //IL_007f: Unknown result type (might be due to invalid IL or missing references) + //IL_0090: Unknown result type (might be due to invalid IL or missing references) + //IL_0097: Unknown result type (might be due to invalid IL or missing references) + //IL_00a1: Unknown result type (might be due to invalid IL or missing references) + //IL_00a9: Expected O, but got Unknown + long id = 0L; + bool restricao = false; + if (restricoesUsuario.Count > 0 && restricoesUsuario.Any((RestricaoUsuarioCamposRelatorios y) => y.Campo == x.Header && y.Relatorio == x.Relatorio)) + { + id = ((DomainBase)restricoesUsuario.First((RestricaoUsuarioCamposRelatorios y) => y.Campo == x.Header && y.Relatorio == x.Relatorio)).Id; + restricao = restricoesUsuario.First((RestricaoUsuarioCamposRelatorios y) => y.Campo == x.Header && y.Relatorio == x.Relatorio).Restricao; + } + RestricaoUsuarioCamposRelatorios item = new RestricaoUsuarioCamposRelatorios + { + Id = id, + Campo = x.Header, + Relatorio = x.Relatorio, + Restricao = restricao + }; + list.Add(item); + }); + return list; + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Generic/DialogEditarParcelasViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Generic/DialogEditarParcelasViewModel.cs new file mode 100644 index 0000000..46f1411 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Generic/DialogEditarParcelasViewModel.cs @@ -0,0 +1,245 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using Gestor.Application.Actions; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Model.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.Resources; + +namespace Gestor.Application.ViewModels.Generic; + +public class DialogEditarParcelasViewModel : BaseViewModel +{ + private List _parcelasOriginais; + + internal ParcelaServico ParcelaServico; + + private ObservableCollection _parcelas; + + private bool _isFatura; + + private string _status; + + private Parcela _selectedParcela; + + private Documento _selectedDocumento; + + public ObservableCollection Parcelas + { + get + { + return _parcelas; + } + set + { + _parcelas = value; + OnPropertyChanged("Parcelas"); + } + } + + public bool IsFatura + { + get + { + return _isFatura; + } + set + { + _isFatura = value; + OnPropertyChanged("IsFatura"); + } + } + + public string Status + { + get + { + return _status; + } + set + { + _status = value; + OnPropertyChanged("Status"); + } + } + + public Parcela SelectedParcela + { + get + { + return _selectedParcela; + } + set + { + _selectedParcela = value; + OnPropertyChanged("SelectedParcela"); + } + } + + public Documento SelectedDocumento + { + get + { + return _selectedDocumento; + } + set + { + _selectedDocumento = value; + OnPropertyChanged("SelectedDocumento"); + } + } + + public DialogEditarParcelasViewModel(Documento documento) + { + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Invalid comparison between Unknown and I4 + SelectedDocumento = documento; + ParcelaServico = new ParcelaServico(); + Carregar(((DomainBase)documento).Id); + IsFatura = (int)documento.TipoRecebimento.GetValueOrDefault((TipoRecebimento)1) == 2; + } + + public async void Carregar(long id) + { + await CarregarParcelas(id); + } + + public async Task CarregarParcelas(long id) + { + ObservableCollection observableCollection = await new ParcelaServico().BuscarParcelasAsync(id); + _parcelasOriginais = new List(); + foreach (Parcela item in observableCollection) + { + _parcelasOriginais.Add((Parcela)((DomainBase)item).Clone()); + } + Parcelas = (IsFatura ? new ObservableCollection(observableCollection.OrderBy((Parcela x) => x.NumeroParcela)) : observableCollection); + } + + public async Task SalvarParcelas() + { + foreach (Parcela p in Parcelas) + { + Parcela val = _parcelasOriginais.First((Parcela x) => ((DomainBase)x).Id == ((DomainBase)p).Id); + if (!(p.Vencimento != val.Vencimento) && !(p.Valor != val.Valor)) + { + continue; + } + val.Vencimento = p.Vencimento; + val.Valor = p.Valor; + List> list = SelectedParcela.Validate(Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 9), Recursos.Configuracoes.Any((ConfiguracaoSistema y) => (int)y.Configuracao == 11), true, Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 16)); + if (list.Count > 0) + { + string text = string.Join(", ", list.Select(delegate(KeyValuePair x) + { + string[] array = x.Key.Split(new char[1] { '|' }); + return ((array.Length > 1) ? array[1] : x.Key) + ": " + x.Value + Environment.NewLine; + })); + Status = "NÃO FOI POSSÍVEL SALVAR DEVIDO AOS ERROS ABAIXO:" + Environment.NewLine + text; + return false; + } + await new ParcelaServico().Save(val, _parcelasOriginais); + } + RegistrarAcao($"EDITOU VENCIMENTO E/OU VALORES DAS PARCELAS/FATURAS DO DOCUMENTO DE ID {((DomainBase)Parcelas[0].Documento).Id}", ((DomainBase)Parcelas[0].Documento).Id, (TipoTela)5); + return true; + } + + public void AlterandoValor() + { + //IL_0042: Unknown result type (might be due to invalid IL or missing references) + //IL_0048: Invalid comparison between Unknown and I4 + //IL_0050: Unknown result type (might be due to invalid IL or missing references) + //IL_0056: Invalid comparison between Unknown and I4 + if (SelectedParcela.Documento == null) + { + SelectedParcela.Documento = SelectedDocumento; + } + SelectedParcela.Documento.Parcelas = Parcelas; + if ((int)SelectedDocumento.TipoRecebimento.GetValueOrDefault() == 1 && (int)SelectedParcela.SubTipo == 1 && SelectedParcela.Comissao == 0m) + { + SelectedParcela.Comissao = SelectedDocumento.Comissao; + } + SelectedParcela.Baixando = false; + AlterarValor(); + } + + public void AlterandoVencimento(Parcela parcela) + { + if (Recursos.Configuracoes.All((ConfiguracaoSistema y) => (int)y.Configuracao != 11) && parcela.Documento.Vigencia2.HasValue) + { + DateTime vencimento = parcela.Vencimento; + DateTime? vigencia = parcela.Documento.Vigencia2; + if (vigencia.HasValue && vencimento > vigencia.GetValueOrDefault() && ((DomainBase)parcela.Documento.Controle.Ramo).Id != 23) + { + Gestor.Application.Actions.Actions.AcionarSnackbar?.Invoke("DATA INVÁLIDA. " + Messages.VencimentoMaior); + parcela.Vencimento = _parcelasOriginais.First((Parcela x) => ((DomainBase)x).Id == ((DomainBase)parcela).Id).Vencimento; + } + } + if (Recursos.Configuracoes.All((ConfiguracaoSistema x) => (int)x.Configuracao != 9) && ((parcela.Documento.Vigencia1 > DateTime.MinValue && parcela.NumeroParcela == 1 && parcela.Vencimento < parcela.Documento.Vigencia1.AddDays(-30.0)) || (parcela.NumeroParcela != 1 && parcela.Vencimento < parcela.Documento.Vigencia1))) + { + Gestor.Application.Actions.Actions.AcionarSnackbar?.Invoke("DATA INVÁLIDA. " + Messages.VencimentoMenor); + parcela.Vencimento = _parcelasOriginais.First((Parcela x) => ((DomainBase)x).Id == ((DomainBase)parcela).Id).Vencimento; + } + Parcelas = new ObservableCollection(Parcelas.OrderBy((Parcela x) => x.NumeroParcela)); + } + + public void AlterarValor() + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0015: Invalid comparison between Unknown and I4 + if (SelectedParcela == null) + { + return; + } + if ((int)SelectedParcela.SubTipo == 1 && !IsFatura) + { + decimal valor = SelectedDocumento.PremioTotal - Parcelas.Where((Parcela x) => (int)x.SubTipo == 1 && ((DomainBase)x).Id != ((DomainBase)SelectedParcela).Id).Sum((Parcela x) => x.Valor); + decimal num = SelectedDocumento.PremioTotal - Parcelas.Where((Parcela x) => (int)x.SubTipo == 1 && ((DomainBase)x).Id < ((DomainBase)SelectedParcela).Id).Sum((Parcela x) => x.Valor); + num -= SelectedParcela.Valor; + decimal num2 = SelectedDocumento.NumeroParcelas - (decimal)SelectedParcela.NumeroParcela; + if (num2 == 0m) + { + num2 = 1m; + } + decimal valorDemais = ((num2 > 0m) ? (num / num2) : 0m); + if (valorDemais == 0m) + { + SelectedParcela.Valor = valor; + } + List parcelas = new List { SelectedParcela }; + decimal num3 = Math.Abs(valorDemais); + decimal? tolerancia = SelectedDocumento.Controle.Seguradora.Tolerancia; + if (((num3 > tolerancia.GetValueOrDefault()) & tolerancia.HasValue) && !Parcelas.Any((Parcela x) => (int)x.SubTipo == 1 && x.NumeroParcela > SelectedParcela.NumeroParcela)) + { + SelectedParcela.Valor = valor; + } + Parcelas.Where((Parcela x) => (int)x.SubTipo == 1 && x.NumeroParcela != SelectedParcela.NumeroParcela).ToList().ForEach(delegate(Parcela x) + { + if (x.NumeroParcela > SelectedParcela.NumeroParcela) + { + x.Valor = ((valorDemais > 0m) ? valorDemais : x.Valor); + x.Comissao = ((x.Comissao == 0m) ? SelectedDocumento.Comissao : x.Comissao); + } + parcelas.Add(x); + }); + foreach (Parcela item in parcelas.Where((Parcela x) => x.NumeroParcela >= SelectedParcela.NumeroParcela)) + { + item.Documento = SelectedDocumento; + if (((DomainBase)item).Id != ((DomainBase)SelectedParcela).Id) + { + item.Valor = valorDemais; + } + } + Parcelas = new ObservableCollection(parcelas.OrderBy((Parcela x) => x.NumeroParcela)); + } + else + { + SelectedParcela.Documento = SelectedDocumento; + } + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Generic/DialogEnviarEmailsViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Generic/DialogEnviarEmailsViewModel.cs new file mode 100644 index 0000000..1a21d9a --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Generic/DialogEnviarEmailsViewModel.cs @@ -0,0 +1,273 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.MalaDireta; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Generic; + +public class DialogEnviarEmailsViewModel : BaseSegurosViewModel +{ + private ObservableCollection _listaTela = new ObservableCollection(); + + private string _infoEnvio = "CLIQUE EM ENVIAR PARA INCIAR O ENVIO"; + + private bool _assinatura { get; set; } + + private bool _original { get; set; } + + private List _arquivosAnexados { get; set; } + + private string _assunto { get; set; } + + private string _corpo { get; set; } + + private Credencial _credencial { get; set; } + + private FiltroArquivoDigital _filtro { get; set; } + + private bool _salvarAd { get; set; } + + private bool _confirmarLeitura { get; set; } + + public List Lista { get; set; } + + public ObservableCollection ListaTela + { + get + { + return _listaTela; + } + set + { + _listaTela = value; + OnPropertyChanged("ListaTela"); + } + } + + public string InfoEnvio + { + get + { + return _infoEnvio; + } + set + { + _infoEnvio = value; + OnPropertyChanged("InfoEnvio"); + } + } + + public DialogEnviarEmailsViewModel(List lista, bool assinatura, bool original, List arquivosAnexados, string assunto, string corpo, Credencial credencial, FiltroArquivoDigital filtro, bool salvarAd, bool confirmarLeitura) + { + lista.ForEach(delegate(MalaDireta x) + { + x.InfoEnvio = null; + }); + Lista = lista; + PrepararLista(); + _assinatura = assinatura; + _original = original; + _arquivosAnexados = arquivosAnexados; + _assunto = assunto; + _corpo = corpo; + _credencial = credencial; + _filtro = filtro; + _salvarAd = salvarAd; + _confirmarLeitura = confirmarLeitura; + } + + private void PrepararLista() + { + List listaTela = new List(); + Lista.ForEach(delegate(MalaDireta x) + { + listaTela.Add(x); + if (x.Copia != null) + { + listaTela.AddRange(((IEnumerable)x.Copia.CopiaOculta).Select((Func)((string c) => new MalaDireta + { + Cliente = x.Cliente, + Email = c, + Enviado = x.Enviado, + InfoEnvio = x.InfoEnvio + })).ToList()); + } + }); + ListaTela = new ObservableCollection(listaTela); + } + + public void Enviar() + { + Enviar(_assinatura, _original, _arquivosAnexados, _assunto, _corpo, _credencial, _filtro, _salvarAd, _confirmarLeitura); + } + + private async void Enviar(bool assinatura, bool original, List arquivosAnexados, string assunto, string corpo, Credencial credencial, FiltroArquivoDigital filtro, bool salvarAd, bool confirmarLeitura) + { + Loading(isLoading: true); + InfoEnvio = "ENVIANDO, AGUARDE ATÉ O PROCESSO TERMINAR."; + await EnviarEmails(assinatura, original, arquivosAnexados, assunto, corpo, credencial, filtro, salvarAd, confirmarLeitura); + InfoEnvio = "TENTATIVA DE ENVIO CONCLUÍDA, CONFIRA O STATUS ABAIXO."; + Loading(isLoading: false); + } + + private async Task EnviarEmails(bool assinatura, bool original, List arquivosAnexados, string assunto, string corpo, Credencial credencial, FiltroArquivoDigital filtro, bool salvarAd, bool confirmarLeitura) + { + List list = new List(); + VariaveisMalaDireta[] array = (VariaveisMalaDireta[])Enum.GetValues(typeof(VariaveisMalaDireta)); + foreach (VariaveisMalaDireta val in array) + { + list.Add(ValidationHelper.GetEntity((Enum)(object)val)); + } + bool temVariaveis = list.Any(assunto.Contains) || list.Any(corpo.Contains) || Lista.Any((MalaDireta x) => x.ArquivoDigital != null && x.ArquivoDigital.Count > 0); + MailHelper mail = new MailHelper(); + bool parar = false; + if (salvarAd) + { + ArquivoDigitalServico arquivoServico = new ArquivoDigitalServico(); + foreach (MalaDireta x2 in Lista) + { + arquivosAnexados.ForEach(delegate(ArquivoDigital a) + { + //IL_0007: Unknown result type (might be due to invalid IL or missing references) + //IL_000d: Invalid comparison between Unknown and I4 + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Invalid comparison between Unknown and I4 + //IL_0057: Unknown result type (might be due to invalid IL or missing references) + //IL_005d: Invalid comparison between Unknown and I4 + //IL_007f: Unknown result type (might be due to invalid IL or missing references) + //IL_0085: Invalid comparison between Unknown and I4 + //IL_00a7: Unknown result type (might be due to invalid IL or missing references) + //IL_00ae: Invalid comparison between Unknown and I4 + //IL_00d0: Unknown result type (might be due to invalid IL or missing references) + //IL_00d6: Invalid comparison between Unknown and I4 + a.IdCliente = (((int)x2.Tela == 1) ? ((DomainBase)x2.Cliente).Id : 0); + a.IdDocumento = (((int)x2.Tela == 2) ? ((DomainBase)x2.Apolice).Id : 0); + a.IdItem = (((int)x2.Tela == 3) ? ((DomainBase)x2.Item).Id : 0); + a.IdParcela = (((int)x2.Tela == 5) ? ((DomainBase)x2.Parcela).Id : 0); + a.IdProspeccao = (((int)x2.Tela == 33) ? ((DomainBase)x2.Prospeccao).Id : 0); + a.IdSinistro = (((int)x2.Tela == 7) ? ((DomainBase)x2.Sinistro).Id : 0); + a.IdEmpresa = Recursos.Usuario.IdEmpresa; + }); + List ids = await arquivoServico.Insert(arquivosAnexados.ToList()); + if (arquivosAnexados.Any((ArquivoDigital arquivo) => arquivo.Arquivo == null)) + { + arquivosAnexados = await arquivoServico.Buscar(ids); + } + } + } + if (!string.IsNullOrWhiteSpace(credencial.Cabecalho)) + { + corpo = credencial.Cabecalho + corpo; + } + if (!string.IsNullOrWhiteSpace(credencial.Assinatura)) + { + corpo = corpo + "

" + credencial.Assinatura; + } + if (!temVariaveis) + { + while (!parar) + { + List list2 = Lista.Where((MalaDireta x) => !x.Enviado.HasValue).Take(200).ToList(); + List cco = list2.Select((MalaDireta x) => x.Email).ToList(); + list2.ForEach(delegate(MalaDireta x) + { + if (x.Copia != null) + { + cco.AddRange(x.Copia.CopiaComum); + cco.AddRange(x.Copia.CopiaOculta); + } + }); + cco = cco.Distinct().ToList(); + Destinatario destinatario = new Destinatario + { + Assunto = assunto, + Corpo = corpo, + Email = credencial.Email, + Nome = credencial.Descricao, + Encaminhar = new List(), + EncaminharOculto = cco, + Anexos = arquivosAnexados.ToList() + }; + LogEnvio result = await mail.SendAsync(credencial, destinatario, filtro, Lista.ToList(), (TipoTela)0, confirmarLeitura); + List list3 = Lista.ToList(); + list3.ForEach(delegate(MalaDireta x) + { + x.Enviado = result.Enviado; + x.InfoEnvio = (result.Enviado ? "ENVIADO COM SUCESSO" : ("NÃO ENVIADO, ENTRE EM CONTATO COM SEU PROVEDOR/SERVIÇO DE E-MAIL E INFORME OS DADOS ABAIXO: \r\n" + result.Erro)); + }); + Lista = list3; + parar = Lista.All((MalaDireta x) => x.Enviado.HasValue); + } + } + else + { + for (int i = 0; i < Lista.Count; i++) + { + MalaDireta envio = Lista[i]; + List list5; + if (envio.ArquivoDigital != null) + { + List list4 = ((!(!assinatura || original)) ? (await ArquivoDigitalServico.Buscar(envio.ArquivoDigital.Where((IndiceArquivoDigital x) => string.IsNullOrWhiteSpace(x.UrlAssinatura)).ToList())) : (await ArquivoDigitalServico.Buscar(envio.ArquivoDigital.ToList()))); + list5 = list4; + } + else + { + list5 = new List(); + } + List arquivos = list5; + if (arquivosAnexados != null && arquivosAnexados.Count > 0) + { + arquivos.AddRange(arquivosAnexados); + } + if (((envio != null) ? envio.ArquivoDigital : null) == null) + { + int num; + if (envio == null) + { + num = 0; + } + else + { + Documento apolice = envio.Apolice; + num = ((((apolice != null) ? new long?(((DomainBase)apolice).Id) : null) > 0) ? 1 : 0); + } + if (num != 0) + { + MalaDireta val2 = envio; + val2.ArquivoDigital = await ArquivoDigitalServico.BuscarPorTipo((TipoArquivoDigital)2, ((DomainBase)envio.Apolice).Id); + } + } + Destinatario val3 = new Destinatario + { + Assunto = Funcoes.SubstituirVariaveis(assunto, envio), + Corpo = Funcoes.SubstituirVariaveis(corpo, envio), + Email = envio.Email + }; + Copia copia = envio.Copia; + val3.Encaminhar = ((copia != null) ? copia.CopiaComum : null); + Copia copia2 = envio.Copia; + val3.EncaminharOculto = ((copia2 != null) ? copia2.CopiaOculta : null); + val3.Nome = envio.Cliente.Nome; + val3.Anexos = arquivos; + Destinatario destinatario2 = val3; + List maladireta = new List { envio }; + LogEnvio val4 = await mail.SendAsync(credencial, destinatario2, filtro, maladireta, (TipoTela)0, confirmarLeitura); + envio.Enviado = val4.Enviado; + envio.InfoEnvio = (val4.Enviado ? "ENVIADO COM SUCESSO" : ("NÃO ENVIADO, ENTRE EM CONTATO COM SEU PROVEDOR/SERVIÇO DE E-MAIL E INFORME OS DADOS ABAIXO: \r\n" + val4.Erro)); + envio.ArquivoDigital = null; + Lista = Lista; + } + } + PrepararLista(); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Generic/DialogExportarPermissaoViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Generic/DialogExportarPermissaoViewModel.cs new file mode 100644 index 0000000..d2da048 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Generic/DialogExportarPermissaoViewModel.cs @@ -0,0 +1,109 @@ +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using Gestor.Application.Servicos.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Generic; + +public class DialogExportarPermissaoViewModel : BaseSegurosViewModel +{ + private bool _enableGrid = true; + + private List _usuarios; + + private ObservableCollection _usuariosFiltrados = new ObservableCollection(); + + public bool EnableGrid + { + get + { + return _enableGrid; + } + set + { + _enableGrid = value; + OnPropertyChanged("EnableGrid"); + } + } + + public List Usuarios + { + get + { + return _usuarios; + } + set + { + _usuarios = value; + OnPropertyChanged("Usuarios"); + } + } + + public ObservableCollection UsuariosFiltrados + { + get + { + return _usuariosFiltrados; + } + set + { + _usuariosFiltrados = value; + OnPropertyChanged("UsuariosFiltrados"); + } + } + + public DialogExportarPermissaoViewModel(long idUsuario) + { + Seleciona(idUsuario); + } + + private async void Seleciona(long idUsuario) + { + Loading(isLoading: true); + await SelecionaUsuarios(idUsuario); + Loading(isLoading: false); + } + + private async Task SelecionaUsuarios(long idUsuario) + { + EnableGrid = false; + Loading(isLoading: true); + Usuarios = (from x in await new BaseServico().BuscarUsuariosAsync() + where !x.Excluido && ((DomainBase)x).Id != idUsuario + orderby x.Nome + select x).ToList(); + UsuariosFiltrados = new ObservableCollection(Usuarios); + Loading(isLoading: false); + EnableGrid = true; + } + + internal async Task> Filtrar(string value) + { + return await Task.Run(() => FiltrarUsuario(value)); + } + + public List FiltrarUsuario(string filter) + { + UsuariosFiltrados = (string.IsNullOrWhiteSpace(filter) ? new ObservableCollection(Usuarios) : new ObservableCollection(from x in Usuarios + where ValidationHelper.RemoveDiacritics(x.Nome.ToUpper().Trim()).Contains(ValidationHelper.RemoveDiacritics(filter)) + orderby !x.Excluido descending, x.Nome + select x)); + return UsuariosFiltrados.ToList(); + } + + public void Selecionar() + { + if (UsuariosFiltrados != null && UsuariosFiltrados.Count != 0) + { + UsuariosFiltrados.ToList().ForEach(delegate(Usuario x) + { + x.Selecionado = !x.Selecionado; + }); + UsuariosFiltrados = new ObservableCollection(UsuariosFiltrados); + } + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Generic/DialogGraficoViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Generic/DialogGraficoViewModel.cs new file mode 100644 index 0000000..93aedeb --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Generic/DialogGraficoViewModel.cs @@ -0,0 +1,38 @@ +using System; +using System.ComponentModel; +using Gestor.Application.Helpers; +using Gestor.Application.Model; + +namespace Gestor.Application.ViewModels.Generic; + +public class DialogGraficoViewModel : INotifyPropertyChanged +{ + private SinteticoSource _source; + + public SinteticoSource Source + { + get + { + return _source; + } + set + { + this.MutateVerbose(ref _source, value, RaisePropertyChanged(), "Source"); + } + } + + public event PropertyChangedEventHandler PropertyChanged; + + public DialogGraficoViewModel(SinteticoSource series) + { + Source = series; + } + + private Action RaisePropertyChanged() + { + return delegate(PropertyChangedEventArgs args) + { + this.PropertyChanged?.Invoke(this, args); + }; + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Generic/DialogMedalhaViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Generic/DialogMedalhaViewModel.cs new file mode 100644 index 0000000..7fe1669 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Generic/DialogMedalhaViewModel.cs @@ -0,0 +1,72 @@ +namespace Gestor.Application.ViewModels.Generic; + +public class DialogMedalhaViewModel : BaseSegurosViewModel +{ + private int _liquido; + + private int _comissao; + + private int _resultado; + + private int _media; + + public int Liquido + { + get + { + return _liquido; + } + set + { + _liquido = value; + OnPropertyChanged("Liquido"); + } + } + + public int Comissao + { + get + { + return _comissao; + } + set + { + _comissao = value; + OnPropertyChanged("Comissao"); + } + } + + public int Resultado + { + get + { + return _resultado; + } + set + { + _resultado = value; + OnPropertyChanged("Resultado"); + } + } + + public int Media + { + get + { + return _media; + } + set + { + _media = value; + OnPropertyChanged("Media"); + } + } + + public DialogMedalhaViewModel(int liquido, int comissao, int resultado, int media) + { + Liquido = liquido; + Comissao = comissao; + Resultado = resultado; + Media = media; + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Generic/DialogPesquisaAvancadaViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Generic/DialogPesquisaAvancadaViewModel.cs new file mode 100644 index 0000000..b4985fd --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Generic/DialogPesquisaAvancadaViewModel.cs @@ -0,0 +1,503 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.Servicos.Ferramentas; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.Servicos.Seguros.Itens; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Generic; + +public class DialogPesquisaAvancadaViewModel : BaseSegurosViewModel +{ + private ObservableCollection _pesquisas = new ObservableCollection(); + + private PesquisaAvancada _resultado = new PesquisaAvancada(); + + private string _pesquisa; + + private FiltroStatusDocumento _status; + + private TipoTela _tela; + + private TipoFiltroBusca _tipoFiltro; + + private bool _habilitarFiltroBuscar; + + private FiltroStatusDocumento _oldStatus; + + private bool _enableStatus = true; + + public bool TipoBusca; + + public ObservableCollection Pesquisas + { + get + { + return _pesquisas; + } + set + { + _pesquisas = value; + OnPropertyChanged("Pesquisas"); + } + } + + public PesquisaAvancada Resultado + { + get + { + return _resultado; + } + set + { + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + if (value != null) + { + value.Status = Status; + } + _resultado = value; + OnPropertyChanged("Resultado"); + } + } + + public string Pesquisa + { + get + { + return _pesquisa; + } + set + { + _pesquisa = value; + OnPropertyChanged("Pesquisa"); + } + } + + public FiltroStatusDocumento Status + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _status; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + //IL_0008: Unknown result type (might be due to invalid IL or missing references) + //IL_0009: Unknown result type (might be due to invalid IL or missing references) + //IL_001d: Unknown result type (might be due to invalid IL or missing references) + _status = value; + _oldStatus = value; + if (Resultado != null) + { + Resultado.Status = Status; + } + OnPropertyChanged("Status"); + } + } + + public TipoTela Tela + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _tela; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _tela = value; + OnPropertyChanged("Tela"); + } + } + + public TipoFiltroBusca TipoFiltro + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _tipoFiltro; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _tipoFiltro = value; + OnPropertyChanged("TipoFiltro"); + } + } + + public bool HabilitarFiltroBuscar + { + get + { + return _habilitarFiltroBuscar; + } + set + { + _habilitarFiltroBuscar = value; + OnPropertyChanged("HabilitarFiltroBuscar"); + } + } + + private TipoPesquisa _tipo { get; set; } = (TipoPesquisa)14; + + + public TipoPesquisa Tipo + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _tipo; + } + set + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Invalid comparison between Unknown and I4 + //IL_001a: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + //IL_0028: Unknown result type (might be due to invalid IL or missing references) + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_0004: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Invalid comparison between Unknown and I4 + //IL_0056: Unknown result type (might be due to invalid IL or missing references) + //IL_0008: Unknown result type (might be due to invalid IL or missing references) + //IL_000b: Invalid comparison between Unknown and I4 + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0010: Invalid comparison between Unknown and I4 + //IL_0031: Unknown result type (might be due to invalid IL or missing references) + //IL_0037: Invalid comparison between Unknown and I4 + //IL_004b: Unknown result type (might be due to invalid IL or missing references) + //IL_003a: Unknown result type (might be due to invalid IL or missing references) + //IL_0040: Invalid comparison between Unknown and I4 + if ((int)value == 1 || (int)value == 2 || (int)value == 17 || (int)value == 9) + { + EnableStatus = false; + FiltroStatusDocumento oldStatus = _oldStatus; + Status = (FiltroStatusDocumento)4; + _oldStatus = oldStatus; + } + else if ((int)_tipo == 1 || (int)_tipo == 2) + { + EnableStatus = true; + Status = _oldStatus; + } + _tipo = value; + GetTipoTela(); + HabilitarBusca(); + OnPropertyChanged("Tipo"); + } + } + + public bool EnableStatus + { + get + { + return _enableStatus; + } + set + { + _enableStatus = value; + OnPropertyChanged("EnableStatus"); + } + } + + public string Informacao => "O LIMITE DA PESQUISA É EM MIL ITENS,\r\nPARA OBTER UMA EXATIDÃO NA PESQUISA É NECESSÁRIO ESPECIFICAR O ITEM PROCURADO."; + + public void GetTipoTela() + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Unknown result type (might be due to invalid IL or missing references) + //IL_0055: Expected I4, but got Unknown + TipoPesquisa tipo = Tipo; + switch ((int)tipo) + { + case 1: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 10: + case 11: + case 12: + case 13: + case 15: + case 16: + case 17: + Tela = (TipoTela)21; + break; + case 0: + case 14: + Tela = (TipoTela)3; + break; + case 2: + case 9: + Tela = (TipoTela)7; + break; + } + } + + public void HabilitarBusca() + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Unknown result type (might be due to invalid IL or missing references) + //IL_0049: Expected I4, but got Unknown + TipoPesquisa tipo = Tipo; + switch ((int)tipo) + { + case 0: + case 4: + case 6: + case 8: + case 10: + case 13: + case 14: + HabilitarFiltroBuscar = true; + break; + case 1: + case 2: + TipoFiltro = (TipoFiltroBusca)1; + HabilitarFiltroBuscar = false; + break; + default: + TipoFiltro = (TipoFiltroBusca)0; + HabilitarFiltroBuscar = false; + break; + } + } + + public void GetTipoPesquisa() + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Unknown result type (might be due to invalid IL or missing references) + //IL_000a: Unknown result type (might be due to invalid IL or missing references) + //IL_000c: Invalid comparison between Unknown and I4 + TipoFiltroBusca tipoFiltro = _tipoFiltro; + if ((int)tipoFiltro != 0) + { + if ((int)tipoFiltro == 1) + { + TipoBusca = true; + } + } + else + { + TipoBusca = false; + } + } + + public async Task Pesquisar() + { + List list = ((Recursos.Usuario != null) ? (await VerificaVinculoVendedor(Recursos.Usuario)) : new List()); + List vendedorVinculado = list; + GetTipoPesquisa(); + TipoPesquisa tipo = Tipo; + switch ((int)tipo) + { + case 5: + Pesquisas = new ObservableCollection(await new PatrimonialServico().BuscarImobiliaria(Pesquisa, Status, vendedorVinculado)); + break; + case 7: + Pesquisas = new ObservableCollection(await new PatrimonialServico().BuscarLocatario(Pesquisa, Status, vendedorVinculado)); + break; + case 10: + Pesquisas = new ObservableCollection((await new ApoliceServico().BuscarApolice(Pesquisa, Status, vendedorVinculado, "Proposta", TipoBusca)).Select(delegate(Documento x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Expected O, but got Unknown + PesquisaAvancada val7 = new PesquisaAvancada(); + val7.IdCliente = ((DomainBase)x.Controle.Cliente).Id; + val7.IdDocumento = ((DomainBase)x).Id; + val7.Nome = x.Controle.Cliente.Nome; + val7.Pesquisa = "NÚMERO DA PROPOSTA: " + x.Proposta + " - NÚMERO DA APÓLICE: " + x.Apolice + " - NÚMERO DO ENDOSSO: " + x.Endosso; + return val7; + }).ToList()); + break; + case 11: + Pesquisas = new ObservableCollection(((IEnumerable)(await new ApoliceServico().BuscarApolice(Pesquisa, Status, vendedorVinculado, "NumeroEndosso", TipoBusca))).Select((Func)((Documento x) => new PesquisaAvancada + { + IdCliente = ((DomainBase)x.Controle.Cliente).Id, + IdDocumento = ((DomainBase)x).Id, + Nome = x.Controle.Cliente.Nome, + Pesquisa = "NÚMERO DA APÓLICE: " + x.Apolice + " - NÚMERO DO ENDOSSO: " + x.Endosso + })).ToList()); + break; + case 15: + Pesquisas = new ObservableCollection((await new ApoliceServico().BuscarApolice(Pesquisa, Status, vendedorVinculado, "PedidoEndosso", TipoBusca)).Select(delegate(Documento x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Expected O, but got Unknown + PesquisaAvancada val6 = new PesquisaAvancada(); + val6.IdCliente = ((DomainBase)x.Controle.Cliente).Id; + val6.IdDocumento = ((DomainBase)x).Id; + val6.Nome = x.Controle.Cliente.Nome; + val6.Pesquisa = "PROPOSTA ENDOSSO: " + x.PropostaEndosso + " - NÚMERO DA APÓLICE: " + x.Apolice + " - NÚMERO DO ENDOSSO: " + x.Endosso; + return val6; + }).ToList()); + break; + case 8: + Pesquisas = new ObservableCollection((await new ApoliceServico().BuscarApolice(Pesquisa, Status, vendedorVinculado, "", TipoBusca)).Select(delegate(Documento x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Expected O, but got Unknown + PesquisaAvancada val5 = new PesquisaAvancada(); + val5.IdCliente = ((DomainBase)x.Controle.Cliente).Id; + val5.IdDocumento = ((DomainBase)x).Id; + val5.Nome = x.Controle.Cliente.Nome; + val5.Pesquisa = ((!x.Vigencia2.HasValue) ? $"NÚMERO DA APÓLICE: {x.Apolice} - VIGÊNCIA INICIAL: {x.Vigencia1:d} - NÚMERO DO ENDOSSO: {x.Endosso}" : $"NÚMERO DA APÓLICE: {x.Apolice} - VIGÊNCIA INICIAL: {x.Vigencia1:d} - VIGÊNCIA FINAL: {x.Vigencia2.Value:d} - NÚMERO DO ENDOSSO: {x.Endosso}"); + return val5; + }).ToList()); + break; + case 1: + { + if (long.TryParse(Pesquisa, out var _)) + { + Documento val3 = await new ApoliceServico().BuscarCodDocumento(long.Parse(Pesquisa), vendedorVinculado); + DialogPesquisaAvancadaViewModel dialogPesquisaAvancadaViewModel2 = this; + ObservableCollection pesquisas; + if (val3 != null && !val3.Excluido) + { + ObservableCollection observableCollection = new ObservableCollection(); + ObservableCollection observableCollection3 = observableCollection; + PesquisaAvancada val2 = new PesquisaAvancada(); + val2.Nome = val3.Controle.Cliente.Nome; + val2.IdDocumento = ((DomainBase)val3).Id; + val2.Pesquisa = "CÓDIGO DO COCUMENTO: " + ((DomainBase)val3).Id + " - NÚMERO DA PROPOSTA: " + val3.Proposta + " - NÚMERO DA APÓLICE: " + val3.Apolice + " - NÚMERO DO ENDOSSO: " + val3.Endosso; + val2.IdCliente = ((DomainBase)val3.Controle.Cliente).Id; + observableCollection3.Add(val2); + pesquisas = observableCollection; + } + else + { + pesquisas = new ObservableCollection(); + } + dialogPesquisaAvancadaViewModel2.Pesquisas = pesquisas; + } + break; + } + case 0: + Pesquisas = new ObservableCollection(await new AutoServico().BuscarChassi(Pesquisa, Status, vendedorVinculado, TipoBusca)); + break; + case 14: + Pesquisas = new ObservableCollection(await new AutoServico().BuscarPlaca(Pesquisa, Status, vendedorVinculado, TipoBusca)); + break; + case 6: + Pesquisas = new ObservableCollection(await new AutoServico().BuscarItem(Pesquisa, Status, vendedorVinculado, TipoBusca)); + break; + case 16: + { + ClienteServico clienteServico = new ClienteServico(); + string telefone = (Pesquisa = ValidationHelper.FormatarTelefone(Pesquisa)); + Pesquisas = new ObservableCollection(((IEnumerable)(await clienteServico.BuscarTelefonesClientes(telefone))).Select((Func)((ClienteTelefone x) => new PesquisaAvancada + { + Nome = x.Cliente.Nome, + Pesquisa = "TELEFONE: " + ((TelefoneBase)x).Prefixo + "-" + ((TelefoneBase)x).Numero, + IdCliente = ((DomainBase)x.Cliente).Id + })).ToList()); + break; + } + case 3: + Pesquisas = new ObservableCollection(((IEnumerable)(await new EmailServico().BuscarEmail(Pesquisa))).Select((Func)((ClienteEmail x) => new PesquisaAvancada + { + Nome = x.Cliente.Nome, + Pesquisa = "E-MAIL: " + ((EmailBase)x).Email, + IdCliente = ((DomainBase)x.Cliente).Id + })).ToList()); + break; + case 2: + { + SinistroServico sinistroServico = new SinistroServico(); + if (int.TryParse(Pesquisa, out var _)) + { + Sinistro val = await sinistroServico.BuscarSinistro(long.Parse(Pesquisa)); + if (val == null) + { + Pesquisas = new ObservableCollection(); + break; + } + DialogPesquisaAvancadaViewModel dialogPesquisaAvancadaViewModel = this; + ObservableCollection observableCollection = new ObservableCollection(); + ObservableCollection observableCollection2 = observableCollection; + PesquisaAvancada val2 = new PesquisaAvancada(); + val2.IdCliente = ((DomainBase)val.ControleSinistro.Item.Documento.Controle.Cliente).Id; + val2.IdDocumento = ((DomainBase)val.ControleSinistro.Item.Documento).Id; + val2.IdItem = ((DomainBase)val.ControleSinistro.Item).Id; + val2.IdSinistro = ((DomainBase)val).Id; + val2.Nome = val.ControleSinistro.Item.Documento.NomeProponente; + val2.Pesquisa = "CÓDIGO DO SINISTRO: " + ((DomainBase)val.ControleSinistro).Id + " - NÚMERO DA APÓLICE: " + val.ControleSinistro.Item.Documento.Apolice + " - ITEM " + val.ItemSinistrado; + observableCollection2.Add(val2); + dialogPesquisaAvancadaViewModel.Pesquisas = observableCollection; + } + break; + } + case 9: + Pesquisas = new ObservableCollection((await new SinistroServico().BuscarSinistros(Pesquisa)).Select(delegate(Sinistro x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Expected O, but got Unknown + PesquisaAvancada val4 = new PesquisaAvancada(); + val4.Nome = x.ControleSinistro.Item.Documento.Controle.Cliente.Nome; + val4.Pesquisa = "NÚMERO DO SINISTRO: " + x.Numero + " - NÚMERO DA APÓLICE: " + x.ControleSinistro.Item.Documento.Apolice + " - ITEM: " + x.ItemSinistrado; + val4.IdCliente = ((DomainBase)x.ControleSinistro.Item.Documento.Controle.Cliente).Id; + val4.IdDocumento = ((DomainBase)x.ControleSinistro.Item.Documento).Id; + val4.IdItem = ((DomainBase)x.ControleSinistro.Item).Id; + val4.IdSinistro = ((DomainBase)x).Id; + return val4; + }).ToList()); + break; + case 4: + Pesquisas = new ObservableCollection(((IEnumerable)(await new ApoliceServico().BuscarApolice(Pesquisa, Status, vendedorVinculado, "Estipulante", TipoBusca))).Select((Func)((Documento x) => new PesquisaAvancada + { + IdCliente = ((DomainBase)x.Controle.Cliente).Id, + IdDocumento = ((DomainBase)x).Id, + Nome = x.Controle.Cliente.Nome, + Pesquisa = " NÚMERO DA APÓLICE: " + x.Apolice + })).ToList()); + break; + case 12: + Pesquisas = new ObservableCollection(((IEnumerable)(await new ClienteServico().BuscarObsCliente(Pesquisa))).Select((Func)((Cliente x) => new PesquisaAvancada + { + Nome = x.Nome, + Pesquisa = "OBSERVAÇÃO: " + x.Observacao, + IdCliente = ((DomainBase)x).Id + })).ToList()); + break; + case 18: + Pesquisas = new ObservableCollection(await new ItemServico().BuscaItensPorObs(Pesquisa, Status, vendedorVinculado, TipoBusca)); + break; + case 13: + Pesquisas = new ObservableCollection(((IEnumerable)(await new ClienteServico().BuscarPastaCliente(Pesquisa, TipoBusca))).Select((Func)((Cliente x) => new PesquisaAvancada + { + Nome = x.Nome, + Pesquisa = "PASTA: " + x.Pasta, + IdCliente = ((DomainBase)x).Id + })).ToList()); + break; + case 17: + Pesquisas = new ObservableCollection(((IEnumerable)(await new ParcelaServico().BuscarFatura(Pesquisa))).Select((Func)((Documento x) => new PesquisaAvancada + { + IdDocumento = ((DomainBase)x).Id, + Nome = x.Controle.Cliente.Nome, + Pesquisa = "CÓDIGO DA FATURA: " + x.Endosso, + IdCliente = ((DomainBase)x.Controle.Cliente).Id + })).ToList()); + break; + } + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Generic/DialogProspeccaoViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Generic/DialogProspeccaoViewModel.cs new file mode 100644 index 0000000..a86bb11 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Generic/DialogProspeccaoViewModel.cs @@ -0,0 +1,315 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Seguros; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Generic; + +public class DialogProspeccaoViewModel : BaseSegurosViewModel +{ + private readonly ClienteServico _servico; + + private Prospeccao _selectedProspeccao; + + private bool _isVisibleAnexos; + + private ObservableCollection _arquivosAnexados = new ObservableCollection(); + + private ArquivoDigital _selectedAnexado = new ArquivoDigital(); + + private ObservableCollection _arquivos = new ObservableCollection(); + + private Visibility _visibilityStatusPersonalizado; + + private ObservableCollection _usuarios; + + private ObservableCollection _vendedores; + + private DateTime _dataAgendamento; + + private DateTime _horaAgendamento; + + private List _produtos = Recursos.Produtos; + + private ObservableCollection _statusProspeccao; + + private List _ramos = Recursos.Ramos; + + public Prospeccao SelectedProspeccao + { + get + { + return _selectedProspeccao; + } + set + { + _selectedProspeccao = value; + OnPropertyChanged("SelectedProspeccao"); + } + } + + public bool IsVisibleAnexos + { + get + { + return _isVisibleAnexos; + } + set + { + _isVisibleAnexos = value; + OnPropertyChanged("IsVisibleAnexos"); + } + } + + public ObservableCollection ArquivosAnexados + { + get + { + return _arquivosAnexados; + } + set + { + _arquivosAnexados = value; + OnPropertyChanged("ArquivosAnexados"); + IsVisibleAnexos = value != null && value.Count > 0; + SelectedProspeccao.Anexos = value?.ToList(); + } + } + + public ArquivoDigital SelectedAnexado + { + get + { + return _selectedAnexado; + } + set + { + _selectedAnexado = value; + OnPropertyChanged("SelectedAnexado"); + } + } + + public ObservableCollection Arquivos + { + get + { + return _arquivos; + } + set + { + _arquivos = value; + OnPropertyChanged("Arquivos"); + } + } + + public Visibility VisibilityStatusPersonalizado + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityStatusPersonalizado; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityStatusPersonalizado = value; + OnPropertyChanged("VisibilityStatusPersonalizado"); + } + } + + public ObservableCollection Usuarios + { + get + { + return _usuarios; + } + set + { + _usuarios = value; + OnPropertyChanged("Usuarios"); + } + } + + public ObservableCollection Vendedores + { + get + { + return _vendedores; + } + set + { + _vendedores = value; + OnPropertyChanged("Vendedores"); + } + } + + public DateTime DataAgendamento + { + get + { + return _dataAgendamento; + } + set + { + _dataAgendamento = value; + if (SelectedProspeccao.Tarefa != null) + { + SelectedProspeccao.Tarefa.Agendamento = DateTime.Parse($"{value:d} {SelectedProspeccao.Tarefa.Agendamento:T}"); + } + OnPropertyChanged("DataAgendamento"); + } + } + + public DateTime HoraAgendamento + { + get + { + return _horaAgendamento; + } + set + { + _horaAgendamento = value; + if (SelectedProspeccao.Tarefa != null) + { + SelectedProspeccao.Tarefa.Agendamento = DateTime.Parse($"{SelectedProspeccao.Tarefa.Agendamento:d} {value:T}"); + } + OnPropertyChanged("HoraAgendamento"); + } + } + + public List Produtos + { + get + { + return _produtos; + } + set + { + _produtos = value; + OnPropertyChanged("Produtos"); + } + } + + public ObservableCollection StatusProspeccao + { + get + { + return _statusProspeccao; + } + set + { + _statusProspeccao = value; + OnPropertyChanged("StatusProspeccao"); + } + } + + public List Ramos + { + get + { + return _ramos; + } + set + { + _ramos = value; + OnPropertyChanged("Ramos"); + } + } + + public DialogProspeccaoViewModel(Prospeccao prospeccao) + { + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_0016: Expected O, but got Unknown + //IL_01bc: Unknown result type (might be due to invalid IL or missing references) + //IL_01c1: Unknown result type (might be due to invalid IL or missing references) + //IL_01cc: Unknown result type (might be due to invalid IL or missing references) + //IL_01d3: Unknown result type (might be due to invalid IL or missing references) + //IL_01df: Unknown result type (might be due to invalid IL or missing references) + //IL_01ea: Unknown result type (might be due to invalid IL or missing references) + //IL_020e: Unknown result type (might be due to invalid IL or missing references) + //IL_021f: Expected O, but got Unknown + _servico = new ClienteServico(); + Usuarios = new ObservableCollection((from x in Recursos.Usuarios + where (Recursos.Usuario.IdEmpresa == 1 || x.IdEmpresa == Recursos.Usuario.IdEmpresa) && !x.Excluido + orderby x.Nome + select x).ToList()); + Vendedores = new ObservableCollection((from x in Recursos.Vendedores + where (Recursos.Usuario.IdEmpresa == 1 || x.IdEmpresa == Recursos.Usuario.IdEmpresa) && x.Ativo + orderby x.Nome + select x).ToList()); + StatusProspeccao = new ObservableCollection((from x in Recursos.StatusProspeccao + where x.Ativo + orderby x.Nome + select x).ToList()); + if (StatusProspeccao == null || StatusProspeccao.Count == 0) + { + VisibilityStatusPersonalizado = (Visibility)2; + } + if (prospeccao.Vendedor == null) + { + prospeccao.Vendedor = Vendedores.First((Vendedor x) => x.Corretora); + } + if (prospeccao.Tarefa == null) + { + prospeccao.Tarefa = new Tarefa + { + Titulo = "PROSPECÇÃO", + Entidade = (TipoTarefa)5, + IdEntidade = ((DomainBase)prospeccao).Id, + Usuario = Recursos.Usuario, + Agendamento = (prospeccao.VigenciaFinal ?? Funcoes.GetNetworkTime()), + Cliente = prospeccao.Nome + }; + } + SelectedProspeccao = prospeccao; + Tarefa tarefa = prospeccao.Tarefa; + DataAgendamento = ((tarefa != null) ? new DateTime?(tarefa.Agendamento) : null).Value; + Tarefa tarefa2 = prospeccao.Tarefa; + HoraAgendamento = ((tarefa2 != null) ? new DateTime?(tarefa2.Agendamento) : null).Value; + } + + public async Task BuscarInfoCliente(Cliente cliente) + { + cliente = await _servico.BuscarCliente(((DomainBase)cliente).Id); + Cliente val = cliente; + val.Telefones = await _servico.BuscarTelefonesAsync(((DomainBase)cliente).Id); + val = cliente; + val.Emails = await _servico.BuscarEmailsAsync(((DomainBase)cliente).Id); + return cliente; + } + + public async void Anexar() + { + List attacheds = ((IEnumerable)Arquivos).Select((Func)((IndiceArquivoDigital x) => new ArquivoDigital + { + Descricao = x.Descricao, + Extensao = x.Extensao + })).ToList(); + List list = await AddAttachments(ArquivosAnexados.ToList(), attacheds); + if (list != null) + { + list.AddRange(ArquivosAnexados); + ArquivosAnexados = new ObservableCollection(list); + } + } + + public void Delete(ArquivoDigital arquivo) + { + if (SelectedAnexado != null) + { + ArquivoDigital item = ArquivosAnexados.First((ArquivoDigital x) => x.Descricao == arquivo.Descricao); + ArquivosAnexados.Remove(item); + ArquivosAnexados = new ObservableCollection(ArquivosAnexados); + } + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Generic/DialogTarefaViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Generic/DialogTarefaViewModel.cs new file mode 100644 index 0000000..6e53508 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Generic/DialogTarefaViewModel.cs @@ -0,0 +1,300 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Linq; +using System.Windows; +using CsQuery.ExtensionMethods.Internal; +using Gestor.Application.Helpers; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Generic; + +public class DialogTarefaViewModel : BaseSegurosViewModel +{ + private bool _showPublica; + + private bool _nota; + + private Visibility _cabecalho; + + private Visibility _agendamento; + + private Visibility _status; + + private List _telefones; + + private ObservableCollection _usuarios; + + private Tarefa _tarefa; + + private DateTime _dataAgendamento = Funcoes.GetNetworkTime(); + + private DateTime _horaAgendamento = Funcoes.GetNetworkTime(); + + private ObservableCollection _responsaveis = new ObservableCollection(); + + private Usuario _selectedUsuario; + + private bool _isAnotacoes = true; + + public bool ShowPublica + { + get + { + return _showPublica; + } + set + { + _showPublica = value; + OnPropertyChanged("ShowPublica"); + } + } + + public bool Nota + { + get + { + return _nota; + } + set + { + _nota = value; + if (value) + { + Cabecalho = (Visibility)2; + Status = (Visibility)2; + } + } + } + + public Visibility Cabecalho + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _cabecalho; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + _cabecalho = value; + this.MutateVerbose(ref _cabecalho, value, OnRaisePropertyChanged(), "Cabecalho"); + } + } + + public Visibility Agendamento + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _agendamento; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + _agendamento = value; + this.MutateVerbose(ref _agendamento, value, OnRaisePropertyChanged(), "Agendamento"); + } + } + + public Visibility Status + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _status; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + _status = value; + this.MutateVerbose(ref _status, value, OnRaisePropertyChanged(), "Status"); + } + } + + public List Telefones + { + get + { + return _telefones; + } + set + { + _telefones = value; + this.MutateVerbose(ref _telefones, value, OnRaisePropertyChanged(), "Telefones"); + } + } + + public ObservableCollection Usuarios + { + get + { + return _usuarios; + } + set + { + _usuarios = value; + this.MutateVerbose(ref _usuarios, value, OnRaisePropertyChanged(), "Usuarios"); + } + } + + public Tarefa Tarefa + { + get + { + return _tarefa; + } + set + { + DateTime networkTime = Funcoes.GetNetworkTime(); + DataAgendamento = ((value != null) ? value.Agendamento : networkTime); + HoraAgendamento = ((value != null) ? value.Agendamento : networkTime); + this.MutateVerbose(ref _tarefa, value, OnRaisePropertyChanged(), "Tarefa"); + } + } + + public DateTime DataAgendamento + { + get + { + return _dataAgendamento; + } + set + { + _dataAgendamento = value; + if (Tarefa != null) + { + Tarefa.Agendamento = DateTime.Parse($"{value:d} {Tarefa.Agendamento:T}"); + } + this.MutateVerbose(ref _dataAgendamento, value, OnRaisePropertyChanged(), "DataAgendamento"); + } + } + + public DateTime HoraAgendamento + { + get + { + return _horaAgendamento; + } + set + { + _horaAgendamento = value; + if (Tarefa != null) + { + Tarefa.Agendamento = DateTime.Parse($"{Tarefa.Agendamento:d} {value:T}"); + } + this.MutateVerbose(ref _horaAgendamento, value, OnRaisePropertyChanged(), "HoraAgendamento"); + } + } + + public ObservableCollection Responsaveis + { + get + { + return _responsaveis; + } + set + { + _responsaveis = value; + OnPropertyChanged("Responsaveis"); + } + } + + public Usuario SelectedUsuario + { + get + { + return _selectedUsuario; + } + set + { + _selectedUsuario = value; + OnPropertyChanged("SelectedUsuario"); + } + } + + public bool IsAnotacoes + { + get + { + return _isAnotacoes; + } + set + { + _isAnotacoes = value; + OnPropertyChanged("IsAnotacoes"); + } + } + + public event PropertyChangedEventHandler RaisePropertyChanged; + + public DialogTarefaViewModel(Tarefa tarefa, List telefones, bool nota = false, bool agendamento = false) + { + //IL_00ac: Unknown result type (might be due to invalid IL or missing references) + //IL_00b2: Invalid comparison between Unknown and I4 + ShowPublica = nota && tarefa.HabilitarPublica; + Telefones = telefones; + Usuarios = new ObservableCollection((from x in Recursos.Usuarios + where (Recursos.Usuario.IdEmpresa == 1 || x.IdEmpresa == Recursos.Usuario.IdEmpresa) && !x.Excluido + orderby x.Nome + select x).ToList()); + Nota = nota; + if ((int)tarefa.Entidade == 1) + { + tarefa.Anotacoes = tarefa.Descricao; + tarefa.Descricao = string.Empty; + } + if (agendamento) + { + Agendamento = (Visibility)2; + } + if (tarefa.UsuariosVinculados != null) + { + ExtensionMethods.AddRange((ICollection)Responsaveis, (IEnumerable)tarefa.UsuariosVinculados); + } + Responsaveis.ToList().ForEach(delegate(Usuario x) + { + Usuarios.Remove(((IEnumerable)Usuarios).FirstOrDefault((Func)((Usuario u) => ((DomainBase)u).Id == ((DomainBase)x).Id))); + }); + Tarefa = tarefa; + } + + private Action OnRaisePropertyChanged() + { + return delegate(PropertyChangedEventArgs args) + { + this.RaisePropertyChanged?.Invoke(this, args); + }; + } + + public void AdcionarResponsavel() + { + if (SelectedUsuario != null && !Responsaveis.Any((Usuario x) => x == SelectedUsuario)) + { + Responsaveis.Add(SelectedUsuario); + Tarefa.UsuariosVinculados = Responsaveis.ToList(); + Usuarios.Remove(SelectedUsuario); + SelectedUsuario = null; + } + } + + public void RemoverResponsavel(Usuario selectedUsuario) + { + if (selectedUsuario != null) + { + Responsaveis.Remove(selectedUsuario); + Tarefa.UsuariosVinculados = Responsaveis.ToList(); + Usuarios.Add(selectedUsuario); + selectedUsuario = null; + } + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Generic/DialogTrilhaViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Generic/DialogTrilhaViewModel.cs new file mode 100644 index 0000000..9ebc626 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Generic/DialogTrilhaViewModel.cs @@ -0,0 +1,95 @@ +using System; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Linq; +using Gestor.Application.Helpers; +using Gestor.Model.Domain.Ferramentas; + +namespace Gestor.Application.ViewModels.Generic; + +public class DialogTrilhaViewModel : INotifyPropertyChanged +{ + private Trilha _trilha; + + private ObservableCollection _fases; + + private Fase _selectedFase; + + public Trilha Trilha + { + get + { + return _trilha; + } + set + { + this.MutateVerbose(ref _trilha, value, RaisePropertyChanged(), "Trilha"); + } + } + + public ObservableCollection Fases + { + get + { + return _fases; + } + set + { + this.MutateVerbose(ref _fases, value, RaisePropertyChanged(), "Fases"); + } + } + + public Fase SelectedFase + { + get + { + return _selectedFase; + } + set + { + this.MutateVerbose(ref _selectedFase, value, RaisePropertyChanged(), "SelectedFase"); + } + } + + public event PropertyChangedEventHandler PropertyChanged; + + private Action RaisePropertyChanged() + { + return delegate(PropertyChangedEventArgs args) + { + this.PropertyChanged?.Invoke(this, args); + }; + } + + public void AdicionarFase() + { + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_001e: Unknown result type (might be due to invalid IL or missing references) + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_0039: Expected O, but got Unknown + if (Fases == null) + { + Fases = new ObservableCollection(); + } + Fases.Add(new Fase + { + Titulo = "TÍTULO", + Descricao = "DESCRIÇÃO" + }); + Fases = new ObservableCollection(Fases); + Trilha.Fases = Fases.ToList(); + } + + public void ExcluirFase(Fase fase) + { + Fases.RemoveAt(Fases.IndexOf(fase)); + Fases = new ObservableCollection(Fases); + Trilha.Fases = Fases.ToList(); + } + + public void UpdateFase(int index) + { + Fases[index] = SelectedFase; + Trilha.Fases = Fases.ToList(); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Generic/DialogViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Generic/DialogViewModel.cs new file mode 100644 index 0000000..c9b9595 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Generic/DialogViewModel.cs @@ -0,0 +1,78 @@ +using System; +using System.ComponentModel; +using System.Windows; +using Gestor.Application.Helpers; + +namespace Gestor.Application.ViewModels.Generic; + +public class DialogViewModel : INotifyPropertyChanged +{ + private string _message; + + private string _acceptContent; + + private string _cancelContent; + + private Visibility _cancelVisibility; + + public string Message + { + get + { + return _message; + } + set + { + this.MutateVerbose(ref _message, value, RaisePropertyChanged(), "Message"); + } + } + + public string AcceptContent + { + get + { + return _acceptContent; + } + set + { + this.MutateVerbose(ref _acceptContent, value, RaisePropertyChanged(), "AcceptContent"); + } + } + + public string CancelContent + { + get + { + return _cancelContent; + } + set + { + CancelVisibility = (Visibility)(string.IsNullOrEmpty(value) ? 2 : 0); + this.MutateVerbose(ref _cancelContent, value, RaisePropertyChanged(), "CancelContent"); + } + } + + public Visibility CancelVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _cancelVisibility; + } + set + { + //IL_0007: Unknown result type (might be due to invalid IL or missing references) + this.MutateVerbose(ref _cancelVisibility, value, RaisePropertyChanged(), "CancelVisibility"); + } + } + + public event PropertyChangedEventHandler PropertyChanged; + + private Action RaisePropertyChanged() + { + return delegate(PropertyChangedEventArgs args) + { + this.PropertyChanged?.Invoke(this, args); + }; + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Generic/DialogVinculoViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Generic/DialogVinculoViewModel.cs new file mode 100644 index 0000000..e39aaf7 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Generic/DialogVinculoViewModel.cs @@ -0,0 +1,177 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using Gestor.Application.Helpers; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Generic; + +public class DialogVinculoViewModel : BaseViewModel +{ + private Repasse _repasse; + + private List _tiposVendedor = Recursos.TipoVendedor?.Where((TipoVendedor x) => !x.Ativo.HasValue || x.Ativo.Value).ToList(); + + private ObservableCollection _vendedoresAtivos = new ObservableCollection(); + + private Vendedor _selectedVendedor = new Vendedor(); + + private ObservableCollection _repassesVinculo = new ObservableCollection(); + + private Repasse _selectedRepasse = new Repasse(); + + private TipoVendedor _selectedTipo = new TipoVendedor(); + + private TipoVendedor _selectedTipoVinculo = new TipoVendedor(); + + public Repasse Repasse + { + get + { + return _repasse; + } + set + { + _repasse = value; + OnPropertyChanged("Repasse"); + } + } + + public VinculoRepasse Vinculo { get; set; } + + public List Vendedores { get; set; } + + public List Repasses { get; set; } + + public List TiposVendedor + { + get + { + return _tiposVendedor; + } + set + { + _tiposVendedor = value; + OnPropertyChanged("TiposVendedor"); + } + } + + public ObservableCollection VendedoresAtivos + { + get + { + return _vendedoresAtivos; + } + set + { + _vendedoresAtivos = value; + OnPropertyChanged("VendedoresAtivos"); + } + } + + public Vendedor SelectedVendedor + { + get + { + return _selectedVendedor; + } + set + { + _selectedVendedor = value; + RepassesVinculo = ((value == null) ? null : new ObservableCollection(Repasses.Where((Repasse x) => ((DomainBase)x.Vendedor).Id == ((DomainBase)value).Id))); + OnPropertyChanged("SelectedVendedor"); + } + } + + public ObservableCollection RepassesVinculo + { + get + { + return _repassesVinculo; + } + set + { + _repassesVinculo = value; + OnPropertyChanged("RepassesVinculo"); + } + } + + public Repasse SelectedRepasse + { + get + { + return _selectedRepasse; + } + set + { + _selectedRepasse = value; + Vinculo.RepasseVinculo = value; + OnPropertyChanged("SelectedRepasse"); + } + } + + public TipoVendedor SelectedTipo + { + get + { + return _selectedTipo; + } + set + { + _selectedTipo = value; + Vinculo.TipoVendedor = value; + OnPropertyChanged("SelectedTipo"); + } + } + + public TipoVendedor SelectedTipoVinculo + { + get + { + return _selectedTipoVinculo; + } + set + { + _selectedTipoVinculo = value; + Vinculo.TipoVendedorVinculo = value; + OnPropertyChanged("SelectedTipoVinculo"); + } + } + + public DialogVinculoViewModel(VinculoRepasse vinculo, List repasses, Repasse repasse) + { + //IL_0047: Unknown result type (might be due to invalid IL or missing references) + //IL_0051: Expected O, but got Unknown + //IL_005d: Unknown result type (might be due to invalid IL or missing references) + //IL_0067: Expected O, but got Unknown + //IL_0068: Unknown result type (might be due to invalid IL or missing references) + //IL_0072: Expected O, but got Unknown + //IL_0073: Unknown result type (might be due to invalid IL or missing references) + //IL_007d: Expected O, but got Unknown + //IL_00ac: Unknown result type (might be due to invalid IL or missing references) + //IL_00b1: Unknown result type (might be due to invalid IL or missing references) + //IL_00c2: Unknown result type (might be due to invalid IL or missing references) + //IL_00d8: Expected O, but got Unknown + DialogVinculoViewModel dialogVinculoViewModel = this; + Repasse = repasse; + Repasses = repasses; + Vinculo = new VinculoRepasse + { + IdRepasse = vinculo.IdRepasse, + Id = ((DomainBase)vinculo).Id + }; + Vendedores = (from x in Repasses + group x by ((DomainBase)x.Vendedor).Id into x + select x.First().Vendedor into x + orderby x.Nome + select x).ToList(); + long idvendedor = ((DomainBase)Repasses.First((Repasse x) => ((DomainBase)x).Id == dialogVinculoViewModel.Vinculo.IdRepasse).Vendedor).Id; + VendedoresAtivos = new ObservableCollection(Vendedores.Where((Vendedor x) => x.IdEmpresa == Recursos.Usuario.IdEmpresa && x.Ativo && !x.Corretora && ((DomainBase)x).Id != idvendedor)); + SelectedVendedor = ((vinculo.RepasseVinculo != null) ? ((IEnumerable)VendedoresAtivos).FirstOrDefault((Func)((Vendedor x) => ((DomainBase)x).Id == ((DomainBase)vinculo.RepasseVinculo.Vendedor).Id)) : null); + SelectedRepasse = ((vinculo.RepasseVinculo != null) ? ((IEnumerable)RepassesVinculo).FirstOrDefault((Func)((Repasse x) => ((DomainBase)x).Id == ((DomainBase)vinculo.RepasseVinculo).Id)) : null); + SelectedTipo = ((vinculo.TipoVendedor != null) ? ((IEnumerable)TiposVendedor).FirstOrDefault((Func)((TipoVendedor x) => ((DomainBase)x).Id == ((DomainBase)vinculo.TipoVendedor).Id)) : null); + SelectedTipoVinculo = ((vinculo.TipoVendedorVinculo != null) ? ((IEnumerable)TiposVendedor).FirstOrDefault((Func)((TipoVendedor x) => ((DomainBase)x).Id == ((DomainBase)vinculo.TipoVendedorVinculo).Id)) : null); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Generic/ErrorDialogViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Generic/ErrorDialogViewModel.cs new file mode 100644 index 0000000..66e554c --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Generic/ErrorDialogViewModel.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using Gestor.Application.Helpers; + +namespace Gestor.Application.ViewModels.Generic; + +public class ErrorDialogViewModel : DialogViewModel, INotifyPropertyChanged +{ + private List> _erros; + + public List> Erros + { + get + { + List> list = new List>(); + foreach (KeyValuePair erro in _erros) + { + list.Add(new KeyValuePair(erro.Key.ToUpper(), erro.Value.ToUpper())); + } + return list; + } + set + { + this.MutateVerbose(ref _erros, value, RaisePropertyChanged(), "Erros"); + } + } + + public new event PropertyChangedEventHandler PropertyChanged; + + private Action RaisePropertyChanged() + { + return delegate(PropertyChangedEventArgs args) + { + this.PropertyChanged?.Invoke(this, args); + }; + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Generic/ExtratoComissaoViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Generic/ExtratoComissaoViewModel.cs new file mode 100644 index 0000000..de7163c --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Generic/ExtratoComissaoViewModel.cs @@ -0,0 +1,137 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Model.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Generic; + +public class ExtratoComissaoViewModel : BaseViewModel +{ + private ServicoExtrato _servico; + + private bool _apelido; + + private List _seguradoras; + + private DateTime _inicio = new DateTime(Funcoes.GetNetworkTime().Date.Year, Funcoes.GetNetworkTime().Date.Month, 1); + + private DateTime _fim = Funcoes.GetNetworkTime().Date; + + private ObservableCollection _extratos; + + public bool Apelido + { + get + { + return _apelido; + } + set + { + _apelido = value; + OnPropertyChanged("Apelido"); + } + } + + public List Seguradoras + { + get + { + return _seguradoras; + } + set + { + _seguradoras = value; + OnPropertyChanged("Seguradoras"); + } + } + + public DateTime Inicio + { + get + { + return _inicio; + } + set + { + _inicio = value; + OnPropertyChanged("Inicio"); + } + } + + public DateTime Fim + { + get + { + return _fim; + } + set + { + _fim = value; + OnPropertyChanged("Fim"); + } + } + + public ObservableCollection Extratos + { + get + { + return _extratos; + } + set + { + _extratos = value; + OnPropertyChanged("Extratos"); + } + } + + public ExtratoComissaoViewModel(List seguradoras) + { + _servico = new ServicoExtrato(); + Apelido = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 6); + Seguradoras = seguradoras; + } + + public async Task CarregarExtratos(Seguradora seguradora, DateTime inicio, DateTime fim) + { + Extratos = new ObservableCollection(await _servico.BuscarExtrato(((DomainBase)seguradora).Id, 0L, (StatusExtrato)4, inicio, fim)); + } + + internal void SelecionarTudo() + { + if (Extratos != null) + { + Extratos.ToList().ForEach(delegate(Extrato x) + { + x.Selecionado = !x.Selecionado; + }); + Extratos = new ObservableCollection(Extratos); + } + } + + internal List Selecionar() + { + if (Extratos == null) + { + return null; + } + return Extratos.Where((Extrato x) => x.Selecionado).Select((Func)((Extrato x) => new NotaFiscal + { + IdExtrato = ((DomainBase)x).Id, + Seguradora = x.Seguradora, + Data = x.Data, + Iss = x.Iss.GetValueOrDefault(), + Ir = x.Ir.GetValueOrDefault(), + ValorBruto = x.Bruto.GetValueOrDefault(), + ValorLiquido = x.Liquido.GetValueOrDefault(), + Extrato = x.Numero + })).ToList(); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Generic/ItemViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Generic/ItemViewModel.cs new file mode 100644 index 0000000..22dba97 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Generic/ItemViewModel.cs @@ -0,0 +1,682 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Data; +using System.Globalization; +using System.Linq; +using System.Runtime.InteropServices; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Forms; +using CsQuery.ExtensionMethods.Internal; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Seguros.Itens; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Microsoft.Office.Interop.Excel; + +namespace Gestor.Application.ViewModels.Generic; + +public class ItemViewModel : BaseSegurosViewModel +{ + private bool _alterandoFiltros; + + public CoberturaViewModel CoberturaViewModel; + + public ItemServico _itemServico; + + private Visibility _alteracaoTitularesVisibility = (Visibility)2; + + private bool _enableAlterarExcluirTitulares; + + private List _excluirTlitulares = new List(); + + private TitularesVida _titularAlteracao = new TitularesVida(); + + private bool _codigo; + + private bool _inicio; + + private bool _fim; + + private bool _fatura; + + private bool _nome; + + private bool _observacao; + + private bool _nascimento; + + private bool _cpf; + + private bool _matricula; + + private bool _premio; + + private bool _capital; + + private bool _tipo; + + private ObservableCollection _titulares = new ObservableCollection(); + + private bool? _allSelected = false; + + private bool _allSelectedChanging; + + private List _oldTitulares = new List(); + + public Item ItemSubstituido { get; set; } + + public bool Mantido { get; set; } + + public Visibility AlteracaoTitularesVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _alteracaoTitularesVisibility; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _alteracaoTitularesVisibility = value; + OnPropertyChanged("AlteracaoTitularesVisibility"); + } + } + + public bool EnableAlterarExcluirTitulares + { + get + { + return _enableAlterarExcluirTitulares; + } + set + { + _enableAlterarExcluirTitulares = value; + OnPropertyChanged("EnableAlterarExcluirTitulares"); + } + } + + public List ExcluirTitulares + { + get + { + return _excluirTlitulares; + } + set + { + _excluirTlitulares = value; + OnPropertyChanged("ExcluirTitulares"); + } + } + + public TitularesVida TitularAlteracao + { + get + { + return _titularAlteracao; + } + set + { + _titularAlteracao = value; + OnPropertyChanged("TitularAlteracao"); + } + } + + public bool Codigo + { + get + { + return _codigo; + } + set + { + _codigo = value; + OnPropertyChanged("Codigo"); + } + } + + public bool Inicio + { + get + { + return _inicio; + } + set + { + _inicio = value; + OnPropertyChanged("Inicio"); + } + } + + public bool Fim + { + get + { + return _fim; + } + set + { + _fim = value; + OnPropertyChanged("Fim"); + } + } + + public bool Fatura + { + get + { + return _fatura; + } + set + { + _fatura = value; + OnPropertyChanged("Fatura"); + } + } + + public bool Nome + { + get + { + return _nome; + } + set + { + _nome = value; + OnPropertyChanged("Nome"); + } + } + + public bool Observacao + { + get + { + return _observacao; + } + set + { + _observacao = value; + OnPropertyChanged("Observacao"); + } + } + + public bool Nascimento + { + get + { + return _nascimento; + } + set + { + _nascimento = value; + OnPropertyChanged("Nascimento"); + } + } + + public bool Cpf + { + get + { + return _cpf; + } + set + { + _cpf = value; + OnPropertyChanged("Cpf"); + } + } + + public bool Matricula + { + get + { + return _matricula; + } + set + { + _matricula = value; + OnPropertyChanged("Matricula"); + } + } + + public bool Premio + { + get + { + return _premio; + } + set + { + _premio = value; + OnPropertyChanged("Premio"); + } + } + + public bool Capital + { + get + { + return _capital; + } + set + { + _capital = value; + OnPropertyChanged("Capital"); + } + } + + public bool Tipo + { + get + { + return _tipo; + } + set + { + _tipo = value; + OnPropertyChanged("Tipo"); + } + } + + public ObservableCollection Titulares + { + get + { + return _titulares; + } + set + { + _titulares = value; + foreach (TitularesVida titulare in Titulares) + { + titulare.PropertyChanged += TitularesOnPropertyChanged; + } + OnPropertyChanged("Titulares"); + } + } + + public bool? AllSelected + { + get + { + return _allSelected; + } + set + { + if (value != _allSelected) + { + EnableAlterarExcluirTitulares = value != false; + if (value == false) + { + AlteracaoTitularesVisibility = (Visibility)2; + } + _allSelected = value; + AllSelectedChanged(); + Titulares = new ObservableCollection(Titulares); + OnPropertyChanged("AllSelected"); + } + } + } + + public List OldTitulares + { + get + { + return _oldTitulares; + } + set + { + _oldTitulares = value; + OnPropertyChanged("OldTitulares"); + } + } + + public AutoCompleteFilterPredicate DependenteItemFilter => (string searchText, object obj) => ((TitularesVida)obj).Nome.ToUpper().Contains(searchText.ToUpper()) && (int)((TitularesVida)obj).Tipo.GetValueOrDefault() != 2; + + public ItemViewModel() + { + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + //IL_0013: Unknown result type (might be due to invalid IL or missing references) + //IL_001d: Expected O, but got Unknown + CoberturaViewModel = new CoberturaViewModel(); + _itemServico = new ItemServico(); + } + + public async Task QuantidadeDeItens(long id) + { + return await new ItemServico().BuscarProximoItem(id); + } + + private void AllSelectedChanged() + { + if (_allSelectedChanging) + { + return; + } + try + { + _alterandoFiltros = true; + _allSelectedChanging = true; + if (!AllSelected.HasValue) + { + return; + } + foreach (TitularesVida titulare in Titulares) + { + titulare.Selecionado = AllSelected.Value; + } + _alterandoFiltros = false; + } + finally + { + _allSelectedChanging = false; + } + } + + private void TitularesOnPropertyChanged(object sender, PropertyChangedEventArgs args) + { + if (!_alterandoFiltros) + { + RecheckAllSelected(); + } + } + + public void RecheckAllSelected() + { + if (_allSelectedChanging) + { + return; + } + try + { + _allSelectedChanging = true; + if (Titulares.All((TitularesVida e) => e.Selecionado)) + { + AllSelected = true; + } + else if (Titulares.All((TitularesVida e) => !e.Selecionado)) + { + AllSelected = false; + } + else + { + AllSelected = null; + } + } + finally + { + _allSelectedChanging = false; + } + } + + public async Task ImportarTitulares() + { + OpenFileDialog val = new OpenFileDialog(); + string path; + try + { + ((FileDialog)val).Filter = "Excel|*.xls;*.xlsx"; + ((FileDialog)val).InitialDirectory = Environment.SpecialFolder.Desktop.ToString(); + if (1 != (int)((CommonDialog)val).ShowDialog()) + { + return; + } + path = ((FileDialog)val).FileName; + } + finally + { + ((IDisposable)val)?.Dispose(); + } + Loading(isLoading: true); + try + { + List list = await Task.Run(delegate + { + Microsoft.Office.Interop.Excel.Application application = (Microsoft.Office.Interop.Excel.Application)Activator.CreateInstance(Marshal.GetTypeFromCLSID(new Guid("00024500-0000-0000-C000-000000000046"))); + Workbook workbook = application.Workbooks.Open(path, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing); + List list2 = new List + { + "codigo", "inicio", "fim", "fatura", "nome", "nascimento", "cpf", "matricula", "premio", "capital", + "tipo", "observacao", "titulardependente" + }; + List list3 = new List(); + foreach (object worksheet in workbook.Worksheets) + { + DataTable dataTable = new DataTable(); + Microsoft.Office.Interop.Excel.Range usedRange = ((Worksheet)worksheet).UsedRange; + object[,] array = (dynamic)usedRange.Value2; + int num = 0; + if (array != null) + { + for (int i = 0; i <= usedRange.Columns.Count - 1; i++) + { + if (array[1, i + 1] == null || !list2.Contains(Funcoes.RemoverAcentos(array[1, i + 1].ToString().ToLower().Trim()))) + { + num--; + } + else + { + DataColumn column = new DataColumn + { + DataType = Type.GetType("System.String"), + ColumnName = Funcoes.RemoverAcentos(array[1, i + 1].ToString().ToLower().Trim()) + }; + dataTable.Columns.Add(column); + for (int j = 0; j <= usedRange.Rows.Count - 2; j++) + { + object obj2 = array[j + 2, i + 1]; + array[1, i + 1].ToString().ToLower(); + string value; + if (Funcoes.RemoverAcentos(array[1, i + 1].ToString().Trim().ToLower()) == "inicio" || Funcoes.RemoverAcentos(array[1, i + 1].ToString().Trim().ToLower()) == "fim" || Funcoes.RemoverAcentos(array[1, i + 1].ToString().Trim().ToLower()) == "nascimento") + { + DateTime result; + if (obj2 is double d) + { + result = DateTime.FromOADate(d); + value = result.ToShortDateString(); + } + else if (DateTime.TryParse((string)obj2, out result)) + { + result = DateTime.Parse((string)obj2); + value = result.ToShortDateString(); + } + else + { + value = ""; + } + } + else + { + value = ((obj2 is string text) ? Funcoes.RemoverAcentos(text).ToUpper().Trim() : ((obj2 is double num2) ? num2.ToString(CultureInfo.InvariantCulture) : ((!(obj2 is bool)) ? "" : (((bool)obj2) ? "1" : "0")))); + } + if (i + num == 0) + { + dataTable.Rows.Add(dataTable.NewRow()); + dataTable.Rows[j][i + num] = value; + } + else + { + dataTable.Rows[j][i + num] = value; + } + } + } + } + list3.Add(dataTable); + } + } + application.Quit(); + List list4 = new List(); + foreach (DataTable dt in list3) + { + list4.AddRange(((IEnumerable)(from x in dt.AsEnumerable() + where x.Field("nome") != null && !string.IsNullOrEmpty(x.Field("nome").ToString()) + select x).ToList()).Select((Func)((DataRow x) => new TitularesVida + { + Codigo = ((!dt.Columns.Contains("codigo") || string.IsNullOrWhiteSpace(x.Field("codigo").ToString())) ? null : x.Field("codigo").ToString().ToUpper()), + Inicio = ((!dt.Columns.Contains("inicio") || string.IsNullOrWhiteSpace(x.Field("inicio").ToString())) ? null : new DateTime?(DateTime.Parse(x.Field("inicio").ToString()))), + Fim = ((!dt.Columns.Contains("fim") | string.IsNullOrWhiteSpace(x.Field("fim").ToString())) ? null : new DateTime?(DateTime.Parse(x.Field("fim").ToString()))), + Fatura = ((!dt.Columns.Contains("fatura") || string.IsNullOrWhiteSpace(x.Field("fatura").ToString())) ? null : x.Field("fatura").ToString().ToUpper()), + Nome = ((!dt.Columns.Contains("nome") || string.IsNullOrWhiteSpace(x.Field("nome").ToString())) ? null : x.Field("nome").ToString().ToUpper()), + Observacao = ((!dt.Columns.Contains("observacao") || string.IsNullOrWhiteSpace(x.Field("observacao").ToString())) ? null : x.Field("observacao").ToString().ToUpper()), + Nascimento = ((!dt.Columns.Contains("nascimento") || string.IsNullOrWhiteSpace(x.Field("nascimento").ToString())) ? null : new DateTime?(DateTime.Parse(x.Field("nascimento").ToString()))), + Cpf = ((!dt.Columns.Contains("cpf") || string.IsNullOrWhiteSpace(x.Field("cpf").ToString())) ? null : x.Field("cpf").ToString()), + Matricula = ((!dt.Columns.Contains("matricula") || string.IsNullOrWhiteSpace(x.Field("matricula").ToString())) ? null : x.Field("matricula").ToString().ToUpper()), + Premio = ((!dt.Columns.Contains("premio") || string.IsNullOrWhiteSpace(x.Field("premio").ToString())) ? null : new decimal?(decimal.Parse(x.Field("premio").ToString(), NumberStyles.AllowDecimalPoint | NumberStyles.AllowThousands, CultureInfo.InvariantCulture))), + Capital = ((!dt.Columns.Contains("capital") || string.IsNullOrWhiteSpace(x.Field("capital").ToString())) ? null : new decimal?(decimal.Parse(x.Field("capital").ToString(), NumberStyles.AllowDecimalPoint | NumberStyles.AllowThousands, CultureInfo.InvariantCulture))), + Tipo = ((!dt.Columns.Contains("tipo") || string.IsNullOrWhiteSpace(x.Field("tipo").ToString())) ? null : ((x.Field("tipo").ToString() == "SOCIO") ? new TipoTitular?((TipoTitular)0) : ((x.Field("tipo").ToString() == "FUNCIONARIO") ? new TipoTitular?((TipoTitular)1) : null))) + })).ToList()); + } + return list4; + }); + Loading(isLoading: false); + if (list.Count == 0) + { + await ShowMessage("NENHUMA COLUNA FOI ENCONTRADA"); + } + else + { + ExtensionMethods.AddRange((ICollection)Titulares, (IEnumerable)list); + } + } + catch + { + Loading(isLoading: false); + await ShowMessage("FALHA AO IMPORTAR O EXCEL, VERIFIQUE SE O ARQUIVO POSSUI ALGUM ERRO."); + } + } + + public void AlterarTitular() + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Expected O, but got Unknown + if ((int)AlteracaoTitularesVisibility == 0) + { + AlteracaoTitularesVisibility = (Visibility)2; + return; + } + TitularAlteracao = new TitularesVida(); + Codigo = false; + Inicio = false; + Fim = false; + Fatura = false; + Nome = false; + Nascimento = false; + Cpf = false; + Matricula = false; + Premio = false; + Capital = false; + Tipo = false; + AlteracaoTitularesVisibility = (Visibility)0; + } + + public void AplicarTitular() + { + foreach (TitularesVida item in Titulares.Where((TitularesVida x) => x.Selecionado).ToList()) + { + if (Codigo) + { + item.Codigo = TitularAlteracao.Codigo; + } + if (Inicio) + { + item.Inicio = TitularAlteracao.Inicio; + } + if (Fim) + { + item.Fim = TitularAlteracao.Fim; + } + if (Fatura) + { + item.Fatura = TitularAlteracao.Fatura; + } + if (Nome) + { + item.Nome = TitularAlteracao.Nome; + } + if (Observacao) + { + item.Observacao = TitularAlteracao.Observacao; + } + if (Nascimento) + { + item.Nascimento = TitularAlteracao.Nascimento; + } + if (Cpf) + { + item.Cpf = TitularAlteracao.Cpf; + } + if (Matricula) + { + item.Matricula = TitularAlteracao.Matricula; + } + if (Premio) + { + item.Premio = TitularAlteracao.Premio; + } + if (Capital) + { + item.Capital = TitularAlteracao.Capital; + } + if (Tipo) + { + item.Tipo = TitularAlteracao.Tipo; + } + } + Titulares = new ObservableCollection(Titulares); + AlteracaoTitularesVisibility = (Visibility)2; + } + + internal async Task> BuscarTitulares(string value) + { + return await Task.Run(() => Titulares.Where((TitularesVida x) => (int)x.Tipo.GetValueOrDefault() != 2 && x.Nome != null && ValidationHelper.RemoveDiacritics(x.Nome.Trim()).ToUpper().Contains(value.ToUpper())).ToList()); + } + + public async Task CarregarTitulares(long id) + { + Titulares = new ObservableCollection(await _itemServico.BuscaTitularesVida(id)); + OldTitulares = ((IEnumerable)Titulares.ToList()).Select((Func)((TitularesVida x) => new TitularesVida + { + Id = ((DomainBase)x).Id, + IdItem = x.IdItem, + Codigo = x.Codigo, + Inicio = x.Inicio, + Fim = x.Fim, + Fatura = x.Fatura, + Nome = x.Nome, + Observacao = x.Observacao, + Nascimento = x.Nascimento, + Cpf = x.Cpf, + Matricula = x.Matricula, + Premio = x.Premio, + Capital = x.Capital, + Tipo = x.Tipo, + Dependente = x.Dependente + })).ToList(); + } + + public void IncluirTitular() + { + //IL_0007: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Expected O, but got Unknown + Titulares.Insert(0, new TitularesVida()); + Titulares = new ObservableCollection(Titulares); + } + + public void ExcluirTitular() + { + List list = Titulares.Where((TitularesVida x) => x.Selecionado).ToList(); + ExcluirTitulares.AddRange(list.Where((TitularesVida x) => ((DomainBase)x).Id > 0)); + foreach (TitularesVida item in list) + { + Titulares.Remove(item); + } + AllSelected = false; + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Generic/ProtocoloViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Generic/ProtocoloViewModel.cs new file mode 100644 index 0000000..dbb3048 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Generic/ProtocoloViewModel.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; +using System.Collections.ObjectModel; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Generic; + +public class ProtocoloViewModel : BaseSegurosViewModel +{ + private ObservableCollection _itens = new ObservableCollection(); + + public ObservableCollection Itens + { + get + { + return _itens; + } + set + { + _itens = value; + OnPropertyChanged("Itens"); + } + } + + public ProtocoloViewModel(List itens) + { + Itens = new ObservableCollection(itens); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Generic/ReordenarItensViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Generic/ReordenarItensViewModel.cs new file mode 100644 index 0000000..27ca9c2 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Generic/ReordenarItensViewModel.cs @@ -0,0 +1,63 @@ +using System.Collections.Generic; +using System.Collections.ObjectModel; +using Gestor.Application.Servicos.Seguros.Itens; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Generic; + +public class ReordenarItensViewModel : BaseSegurosViewModel +{ + private readonly ItemServico _itemServico; + + private bool _carregando; + + private ObservableCollection _itens = new ObservableCollection(); + + public bool Carregando + { + get + { + return _carregando; + } + set + { + _carregando = value; + OnPropertyChanged("Carregando"); + } + } + + public ObservableCollection Itens + { + get + { + return _itens; + } + set + { + _itens = value; + OnPropertyChanged("Itens"); + } + } + + public ReordenarItensViewModel(List ids) + { + _itemServico = new ItemServico(); + CarregarItens(ids); + } + + private async void CarregarItens(List ids) + { + Carregando = true; + Itens = await _itemServico.BuscarItens(ids); + Carregando = false; + } + + public void ReordenarAutomaticamente() + { + foreach (Item iten in Itens) + { + iten.Ordem = Itens.IndexOf(iten) + 1; + } + Itens = new ObservableCollection(Itens); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Generic/SelecionarItensViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Generic/SelecionarItensViewModel.cs new file mode 100644 index 0000000..6e0bd14 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Generic/SelecionarItensViewModel.cs @@ -0,0 +1,82 @@ +using System.Collections.ObjectModel; +using Gestor.Application.Servicos.Seguros.Itens; +using Gestor.Model.Common; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Generic; + +public class SelecionarItensViewModel : BaseSegurosViewModel +{ + private ItemServico _itemServico; + + private ObservableCollection _itens = new ObservableCollection(); + + private bool? _allSelected; + + private bool _allSelectedChanging; + + public ObservableCollection Itens + { + get + { + return _itens; + } + set + { + _itens = value; + OnPropertyChanged("Itens"); + } + } + + public bool? AllSelected + { + get + { + return _allSelected; + } + set + { + if (value != _allSelected) + { + _allSelected = value; + AllSelectedChanged(); + OnPropertyChanged("AllSelected"); + } + } + } + + public SelecionarItensViewModel(long id) + { + _itemServico = new ItemServico(); + CarregarItens(id); + } + + private async void CarregarItens(long id) + { + Itens = await _itemServico.BuscarItens(id, (StatusItem)0); + } + + private void AllSelectedChanged() + { + if (_allSelectedChanging) + { + return; + } + try + { + _allSelectedChanging = true; + if (!AllSelected.HasValue) + { + return; + } + foreach (Item iten in Itens) + { + iten.Selecionado = AllSelected.Value; + } + } + finally + { + _allSelectedChanging = false; + } + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Relatorios/DialogPrintViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Relatorios/DialogPrintViewModel.cs new file mode 100644 index 0000000..859ee64 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Relatorios/DialogPrintViewModel.cs @@ -0,0 +1,176 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Configuracoes; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Common; +using Gestor.Model.Domain.Relatorios; + +namespace Gestor.Application.ViewModels.Relatorios; + +public class DialogPrintViewModel : BaseViewModel +{ + private bool _carregando; + + private ConfiguracaoImpressao _configuracoes; + + private List _tamanhos = new List { "GRANDE", "MÉDIO", "PEQUENO" }; + + private bool _orientacaoImpressaoPortrait; + + private bool _orientacaoImpressaoLandscape; + + private string _tamanhoFonte = "PEQUENO"; + + private Relatorio _relatorio { get; set; } + + private Type _tipo { get; set; } + + public bool Carregando + { + get + { + return _carregando; + } + set + { + _carregando = value; + OnPropertyChanged("Carregando"); + } + } + + public ConfiguracaoImpressao Configuracoes + { + get + { + return _configuracoes; + } + set + { + _configuracoes = value; + OnPropertyChanged("Configuracoes"); + } + } + + public List Tamanhos + { + get + { + return _tamanhos; + } + set + { + _tamanhos = value; + OnPropertyChanged("Tamanhos"); + } + } + + public bool OrientacaoImpressaoPortrait + { + get + { + return _orientacaoImpressaoPortrait; + } + set + { + _orientacaoImpressaoPortrait = value; + OnPropertyChanged("OrientacaoImpressaoPortrait"); + } + } + + public bool OrientacaoImpressaoLandscape + { + get + { + return _orientacaoImpressaoLandscape; + } + set + { + _orientacaoImpressaoLandscape = value; + OnPropertyChanged("OrientacaoImpressaoLandscape"); + } + } + + public bool OrientacaoImpressao { get; set; } + + public string TamanhoFonte + { + get + { + return _tamanhoFonte; + } + set + { + _tamanhoFonte = value; + if (!(value == "MÉDIO")) + { + if (!(value == "GRANDE")) + { + Configuracoes.TamanhoFonte = 7; + } + else + { + Configuracoes.TamanhoFonte = 5; + } + } + else + { + Configuracoes.TamanhoFonte = 6; + } + OnPropertyChanged("TamanhoFonte"); + } + } + + public DialogPrintViewModel(Relatorio relatorio, Type tipo) + { + //IL_003e: Unknown result type (might be due to invalid IL or missing references) + _relatorio = relatorio; + _tipo = tipo; + } + + public async Task Carregar() + { + List list = await new ConfuguracoesServico().BuscarParametros(_relatorio); + if (list == null || list.Count == 0) + { + list = ((IEnumerable)_tipo.GetProperties(BindingFlags.Instance | BindingFlags.Public)).Select((Func)((PropertyInfo x) => new ParametrosRelatorio + { + Campo = x.Name, + Header = x.GetDescriptionAttribute(), + Tipo = x.GetTypeAttribute(), + Relatorio = _relatorio, + Width = 0, + Ordem = 0 + })).ToList(); + } + list.ForEach(delegate(ParametrosRelatorio x) + { + x.Selecionado = true; + }); + Configuracoes = new ConfiguracaoImpressao + { + TamanhoFonte = 7, + Campos = list, + OrientacaoImpressao = false + }; + } + + public void Selecionar() + { + if (Carregando) + { + return; + } + ConfiguracaoImpressao configuracoes = Configuracoes; + if (configuracoes != null) + { + configuracoes.Campos?.ForEach(delegate(ParametrosRelatorio x) + { + x.Selecionado = !x.Selecionado; + }); + } + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Relatorios/RelatorioViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Relatorios/RelatorioViewModel.cs new file mode 100644 index 0000000..60e86e3 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Relatorios/RelatorioViewModel.cs @@ -0,0 +1,14605 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Diagnostics; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Forms; +using System.Windows.Threading; +using Agger.Registro; +using ClosedXML.Excel; +using CsQuery.ExtensionMethods; +using Gestor.Application.Actions; +using Gestor.Application.Componentes; +using Gestor.Application.Drawers; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.Servicos.Configuracoes; +using Gestor.Application.Servicos.Ferramentas; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.Servicos.Seguros.Itens; +using Gestor.Application.ViewModels.Generic; +using Gestor.Application.Views.BI; +using Gestor.Application.Views.Ferramentas; +using Gestor.Application.Views.Generic; +using Gestor.Application.Views.Relatorios; +using Gestor.Common.Converters; +using Gestor.Common.Helpers; +using Gestor.Common.Validation; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Aggilizador; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.MalaDireta; +using Gestor.Model.Domain.Relatorios; +using Gestor.Model.Domain.Relatorios.ApolicePendente; +using Gestor.Model.Domain.Relatorios.Auditoria; +using Gestor.Model.Domain.Relatorios.Classificacao; +using Gestor.Model.Domain.Relatorios.Cliente; +using Gestor.Model.Domain.Relatorios.ClientesAtivosInativos; +using Gestor.Model.Domain.Relatorios.Comissao; +using Gestor.Model.Domain.Relatorios.CriticaApolice; +using Gestor.Model.Domain.Relatorios.EndossoCancelamento; +using Gestor.Model.Domain.Relatorios.ExtratoBaixado; +using Gestor.Model.Domain.Relatorios.FaturaPendente; +using Gestor.Model.Domain.Relatorios.Fechamento; +using Gestor.Model.Domain.Relatorios.Licenciamento; +using Gestor.Model.Domain.Relatorios.Log; +using Gestor.Model.Domain.Relatorios.LogsEnvio; +using Gestor.Model.Domain.Relatorios.MetaSeguradora; +using Gestor.Model.Domain.Relatorios.MetaVendedor; +using Gestor.Model.Domain.Relatorios.NotaFiscal; +using Gestor.Model.Domain.Relatorios.Pagamento; +using Gestor.Model.Domain.Relatorios.Pendente; +using Gestor.Model.Domain.Relatorios.Placa; +using Gestor.Model.Domain.Relatorios.PrevisaoPagamentoComissao; +using Gestor.Model.Domain.Relatorios.Producao; +using Gestor.Model.Domain.Relatorios.Renovacao; +using Gestor.Model.Domain.Relatorios.Sinistro; +using Gestor.Model.Domain.Relatorios.Tarefa; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.License; +using MaterialDesignThemes.Wpf; + +namespace Gestor.Application.ViewModels.Relatorios; + +public class RelatorioViewModel : BaseSegurosViewModel +{ + private bool _alterandoFiltros; + + private readonly ApoliceServico _apoliceServico; + + private readonly ParcelaServico _parcelaServico; + + private readonly SinistroServico _sinistroServico; + + private readonly ClienteServico _clienteServico; + + private readonly LogServico _logServico; + + private readonly CriticaApoliceServico _criticaServico; + + private readonly ServicoExtrato _extratoServico; + + private readonly MetaSeguradoraServico _metaSeguradoraServico; + + private readonly MetaVendedorServico _metaVendedorServico; + + private readonly NotaFiscalServico _notaFiscalServico; + + private readonly Func funcProducaoDistinctByDocumentoId = (Producao p) => ((DomainBase)p.Documento).Id; + + private readonly Func funcProducaoSegurosNovos = (Producao p) => (int)p.Documento.Situacao == 1; + + private readonly Func funcProducaoSegurosRenovacao = (Producao p) => (int)p.Documento.Situacao == 2; + + private readonly Func funcProducaoNegociosNovos = (Producao p) => p.Documento.NegocioCorretora == (NegocioCorretora?)0; + + private readonly Func funcProducaoNegociosProprios = (Producao p) => (int)p.Documento.NegocioCorretora.GetValueOrDefault() == 1; + + private bool _totalizacao = true; + + private bool _enableEmpresa; + + private bool _apelido; + + private List _empresas; + + private Empresa _empresa; + + private bool? _allSelectedSeguradora; + + private bool? _allSelectedRamo; + + private bool? _allSelectedVendedor; + + private bool? _allSelectedTipoVendedor; + + private bool? _allSelectedStatus; + + private bool? _allSelectedNegocio; + + private bool? _allSelectedEstipulante; + + private bool? _allSelectedProduto; + + private bool _allSelectedChanging; + + private string _filtro; + + private bool _visibilityHtml; + + private bool _relatorioVisibility; + + private string _htmlContent; + + private List _relatorios = new List(); + + private Relatorio _relatorio = (Relatorio)2; + + private bool _extratosEnabled; + + private Visibility _planilhaVisibility; + + private object _report; + + private bool _permitirFiltrosPersonalizados; + + private Visibility _filtrosPersonalizados = (Visibility)2; + + private bool _somenteNaoPagos; + + private bool _visibilityDesconsiderarNegativos = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 50); + + private bool _desconsiderarNegativos; + + private bool _segundaViaReciboPagamento; + + private bool _documentosEmitidos; + + private bool _sinteticosPagamento; + + private bool _visibilityUsuarios; + + private Visibility _visibilityDocumentoAtivo; + + private Visibility _visibilityReferencia = (Visibility)2; + + private Visibility _visibilityOrdem = (Visibility)2; + + private string _referencia; + + private ObservableCollection _referencias = new ObservableCollection(); + + private ObservableCollection _ordens = new ObservableCollection(); + + private string _ordemSelecionada; + + private DateTime _inicio = Funcoes.GetNetworkTime().Date.AddMonths(-1); + + private DateTime _fim = Funcoes.GetNetworkTime().Date; + + private int _inicioValor; + + private int _fimValor; + + private Agrupamento _agrupamento; + + private List _producao; + + private List _licenciamento; + + private List _placas; + + private List _tarefa; + + private List _endosso; + + private List _classificacao; + + private ObservableCollection _licenciamentoFiltrado; + + private ObservableCollection _placaFiltrado; + + private ObservableCollection _tarefaFiltrado; + + private List _renovacao; + + private List _faturaPendente; + + private ObservableCollection _faturaPendenteFiltrado; + + private List _sinistro; + + private List _comissao; + + private List _pendente; + + private List _pagamentos; + + private List _pagamentosSintetico; + + private List _clientesAtivosInativos; + + private List _logsEnvio; + + private ObservableCollection _apoliceCriticaFiltrado; + + private ObservableCollection _logUtilizacaoFiltrado; + + private ObservableCollection _fechamento; + + private ObservableCollection _previsao; + + private ObservableCollection _previsaoSintetico; + + private List _auditoria; + + private ObservableCollection _auditoriaFiltrado; + + private List _apolicePendente; + + private List _extratos; + + private ObservableCollection _apolicePendenteFiltrado; + + private ObservableCollection _extratosFiltrado; + + private List _metaSeguradora; + + private List _metaVendedor; + + private ObservableCollection _metaSeguradoraFiltrado; + + private ObservableCollection _metaVendedorFiltrado; + + private ObservableCollection _producaoFiltrado; + + private ObservableCollection _endossoFiltrado; + + private ObservableCollection _notaFiscalFiltrado; + + private ObservableCollection _renovacaoFiltrado; + + private ObservableCollection _sinistroFiltrado; + + private ObservableCollection _comissaoFiltrado; + + private ObservableCollection _pendenteFiltrado; + + private ObservableCollection _clientesAtivosInativosFiltrado; + + private ObservableCollection _classificacaoFiltrado; + + private ObservableCollection _logsEnvioFiltrado; + + private ObservableCollection _fechamentoFiltrado; + + private ObservableCollection _previsaoFiltrado; + + private bool _totais; + + private ObservableCollection _sinteticoRelatorio; + + private SinteticoClientes _sinteticoCliente; + + private ObservableCollection _sintetic; + + private bool _comparativo; + + private bool _completo; + + private bool _notaFiscalPorSeguradora; + + private Mes _selectedMes; + + private int _selectedAno; + + private Visibility _infoVisibility = (Visibility)2; + + private string _info; + + private string _erroRelatorio = "NÃO HÁ DADOS NO PERÍODO E FILTROS SELECIONADOS."; + + private bool _carregando; + + private bool _documentosAtivos; + + private List _seguradoras = (from x in Recursos.Seguradoras + where x.Ativo + orderby x.Nome + select x).ToList(); + + private List _ramos = (from x in Recursos.Ramos + where x.Ativo + orderby x.Nome + select x).ToList(); + + private List _notasFiscais = new List(); + + private bool _inativo = true; + + private List _vendedores = new List(); + + private List _tipoVendedor = (from x in Recursos.TipoVendedor + where x.Ativo.GetValueOrDefault() + orderby x.Descricao + select x).ToList(); + + private List _produtos = (from x in Recursos.Produtos + where x.Ativo + orderby x.Nome + select x).ToList(); + + private List _estipulantes = (from x in Recursos.Estipulantes + where (Recursos.Usuario.IdEmpresa == 1 || Recursos.Usuario.IdEmpresa == x.IdEmpresa) && x.Ativo + orderby x.Nome + select x).ToList(); + + private static readonly List NegocioList = new List + { + new NegocioRelatorio + { + Id = 0, + Selecionado = false, + Negocio = (NegocioCorretora)0 + }, + new NegocioRelatorio + { + Id = 1, + Selecionado = false, + Negocio = (NegocioCorretora)1 + } + }; + + private List _negocios = NegocioList; + + private static readonly List TipoSegurosList = new List + { + new StatusRelatorio + { + Id = 1, + Selecionado = false, + Status = (TipoSeguro)1 + }, + new StatusRelatorio + { + Id = 2, + Selecionado = false, + Status = (TipoSeguro)2 + }, + new StatusRelatorio + { + Id = 3, + Selecionado = false, + Status = (TipoSeguro)3 + }, + new StatusRelatorio + { + Id = 4, + Selecionado = false, + Status = (TipoSeguro)7 + }, + new StatusRelatorio + { + Id = 5, + Selecionado = false, + Status = (TipoSeguro)5 + }, + new StatusRelatorio + { + Id = 6, + Selecionado = false, + Status = (TipoSeguro)6 + }, + new StatusRelatorio + { + Id = 7, + Selecionado = false, + Status = (TipoSeguro)4 + } + }; + + private List _tipoSeguros = TipoSegurosList; + + private bool _isVisibleGrid1 = true; + + private bool _isVisibleGrid2 = true; + + private bool _isVisibleGrid3 = true; + + private bool _isVisibleGrid4 = true; + + private List _filtroRelatorioPersonalizado; + + private FiltroPersonalizado _filtroPersonalizado; + + private Type _tipoString = typeof(string); + + private Type _tipoEnum = typeof(Enum); + + private Type _tipoDateTime = typeof(DateTime); + + private Type _tipoDecimal = typeof(decimal); + + private Type _tipoInt = typeof(int); + + private Type _tipoLong = typeof(long); + + private ObservableCollection _ramosSelecionados; + + private bool _novosNegocios; + + private Ramo _ramoSelecionado; + + private string _valorIncial = ""; + + private string _valorFinal = ""; + + private bool _semValor; + + private bool _valorIgual; + + private Visibility _visibilitySemValor = (Visibility)2; + + private Visibility _visibilityOpcoesFiltros = (Visibility)2; + + private ObservableCollection _filtroPersonalizadoSelecionado; + + private ObservableCollection _filtroRelatorioSelecionado = new ObservableCollection(); + + private Visibility _visibilityFiltros; + + private Visibility _visibilityEtiqueta; + + private Visibility _visibiltyProtocolo; + + private Visibility _visibiltySincronizar; + + private Visibility _visibilityEmail; + + private Visibility _visibilityApolice; + + private Visibility _visibilityExtratos; + + private Visibility _visibilityData; + + private Visibility _visibilityMeta; + + private Visibility _visibilityMaisFiltros; + + private Visibility _visibilityGridFiltros; + + private Visibility _visibilityAgrupamento; + + private Visibility _visibilityOlho; + + private Visibility _visibilityEspecial; + + private Visibility _visibilityComparativo; + + private Visibility _visibilityCompleto; + + private Visibility _visibilityNotaFiscalPorSeguradora; + + private Visibility _visibilityPagamento; + + private Visibility _visibilitySintetizar; + + private Visibility _visibilityConfigurar; + + private Visibility _visibilityFiltroPersonalizadoButton; + + private Visibility _visibilityTarefas; + + private Visibility _visibilityAcompanhamento; + + private Visibility _visibilityValor; + + private Visibility _visibilityFiltroPersonalizado = (Visibility)2; + + private string _head; + + private List _parcelasEspeciais = new List + { + new FiltroTipoParcela + { + Selecionado = true, + Tipo = (SubTipo)1 + }, + new FiltroTipoParcela + { + Selecionado = true, + Tipo = (SubTipo)6 + }, + new FiltroTipoParcela + { + Selecionado = true, + Tipo = (SubTipo)3 + }, + new FiltroTipoParcela + { + Selecionado = true, + Tipo = (SubTipo)2 + }, + new FiltroTipoParcela + { + Selecionado = true, + Tipo = (SubTipo)5 + }, + new FiltroTipoParcela + { + Selecionado = true, + Tipo = (SubTipo)4 + } + }; + + private ObservableCollection _ajuda = new ObservableCollection(); + + private bool _carregandoAjuda; + + private ObservableCollection _parametrosRelatorio; + + private ObservableCollection _parametrosRelatorioAdicionados; + + private ObservableCollection _parametrosTotalizacao; + + private ObservableCollection _parametrosTotalizacaoAdicionados; + + private bool _isCampo = true; + + private ParametrosRelatorio _selectedParametrosRelatorio; + + private ParametrosTotalizacao _selectedParametrosTotalizacao; + + private ObservableCollection _usuariosFiltrados = new ObservableCollection(); + + public string Sessao { get; set; } + + public static DrawerHost Drawer { get; set; } + + public bool Totalizacao + { + get + { + return _totalizacao; + } + set + { + _totalizacao = value; + OnPropertyChanged("Totalizacao"); + } + } + + public bool EnableEmpresa + { + get + { + return _enableEmpresa; + } + set + { + _enableEmpresa = value; + OnPropertyChanged("EnableEmpresa"); + } + } + + public bool Apelido + { + get + { + return _apelido; + } + set + { + _apelido = value; + OnPropertyChanged("Apelido"); + } + } + + public List Empresas + { + get + { + return _empresas; + } + set + { + _empresas = value; + OnPropertyChanged("Empresas"); + } + } + + public Empresa Empresa + { + get + { + return _empresa; + } + set + { + _empresa = value; + OnPropertyChanged("Empresa"); + } + } + + public bool? AllSelectedSeguradora + { + get + { + return _allSelectedSeguradora; + } + set + { + if (value != _allSelectedSeguradora) + { + _allSelectedSeguradora = value; + AllSelectedChanged(0); + Seguradoras = new List(Seguradoras); + OnPropertyChanged("AllSelectedSeguradora"); + } + } + } + + public bool? AllSelectedRamo + { + get + { + return _allSelectedRamo; + } + set + { + if (value != _allSelectedRamo) + { + _allSelectedRamo = value; + AllSelectedChanged(1); + Ramos = new List(Ramos); + OnPropertyChanged("AllSelectedRamo"); + } + } + } + + public bool? AllSelectedVendedor + { + get + { + return _allSelectedVendedor; + } + set + { + if (value != _allSelectedVendedor) + { + _allSelectedVendedor = value; + AllSelectedChanged(2); + Vendedores = new List(Vendedores); + OnPropertyChanged("AllSelectedVendedor"); + } + } + } + + public bool? AllSelectedTipoVendedor + { + get + { + return _allSelectedTipoVendedor; + } + set + { + if (value != _allSelectedTipoVendedor) + { + _allSelectedTipoVendedor = value; + AllSelectedChanged(4); + TipoVendedor = new List(TipoVendedor); + OnPropertyChanged("AllSelectedTipoVendedor"); + } + } + } + + public bool? AllSelectedStatus + { + get + { + return _allSelectedStatus; + } + set + { + if (value != _allSelectedStatus) + { + _allSelectedStatus = value; + AllSelectedChanged(3); + TipoSeguros = new List(TipoSeguros); + OnPropertyChanged("AllSelectedStatus"); + } + } + } + + public bool? AllSelectedNegocio + { + get + { + return _allSelectedNegocio; + } + set + { + if (value != _allSelectedNegocio) + { + _allSelectedNegocio = value; + AllSelectedChanged(5); + Negocios = new List(Negocios); + OnPropertyChanged("AllSelectedNegocio"); + } + } + } + + public bool? AllSelectedEstipulante + { + get + { + return _allSelectedEstipulante; + } + set + { + if (value != _allSelectedEstipulante) + { + _allSelectedEstipulante = value; + AllSelectedChanged(7); + Estipulantes = new List(Estipulantes); + OnPropertyChanged("AllSelectedEstipulante"); + } + } + } + + public bool? AllSelectedProduto + { + get + { + return _allSelectedProduto; + } + set + { + if (value != _allSelectedProduto) + { + _allSelectedProduto = value; + AllSelectedChanged(6); + Produtos = new List(Produtos); + OnPropertyChanged("AllSelectedProduto"); + } + } + } + + public string Filtro + { + get + { + return _filtro; + } + set + { + _filtro = value; + Filtrar(); + OnPropertyChanged("Filtro"); + } + } + + public bool VisibilityHtml + { + get + { + return _visibilityHtml; + } + set + { + _visibilityHtml = value; + OnPropertyChanged("VisibilityHtml"); + } + } + + public bool RelatorioVisibility + { + get + { + return _relatorioVisibility; + } + set + { + _relatorioVisibility = value; + OnPropertyChanged("RelatorioVisibility"); + } + } + + public string HtmlContent + { + get + { + return _htmlContent; + } + set + { + _htmlContent = value; + OnPropertyChanged("HtmlContent"); + } + } + + public List Relatorios + { + get + { + return _relatorios; + } + set + { + _relatorios = value; + OnPropertyChanged("Relatorios"); + } + } + + public Relatorio Relatorio + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _relatorio; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + //IL_0008: Unknown result type (might be due to invalid IL or missing references) + _relatorio = value; + WorkOnRelatorio(value); + OnPropertyChanged("Relatorio"); + } + } + + public bool ExtratosEnabled + { + get + { + return _extratosEnabled; + } + set + { + _extratosEnabled = value; + OnPropertyChanged("ExtratosEnabled"); + } + } + + public Visibility PlanilhaVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _planilhaVisibility; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _planilhaVisibility = value; + OnPropertyChanged("PlanilhaVisibility"); + } + } + + public object Report + { + get + { + return _report; + } + set + { + _report = value; + FiltrosPersonalizados = (Visibility)((value == null || !PermitirFiltrosPersonalizados) ? 2 : 0); + OnPropertyChanged("Report"); + } + } + + public bool PermitirFiltrosPersonalizados + { + get + { + return _permitirFiltrosPersonalizados; + } + set + { + _permitirFiltrosPersonalizados = value; + OnPropertyChanged("PermitirFiltrosPersonalizados"); + } + } + + public Visibility FiltrosPersonalizados + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _filtrosPersonalizados; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _filtrosPersonalizados = value; + OnPropertyChanged("FiltrosPersonalizados"); + } + } + + private bool ReciboPagamento { get; set; } + + public bool SomenteNaoPagos + { + get + { + return _somenteNaoPagos; + } + set + { + LimparRelatorio(); + _somenteNaoPagos = value; + if (value) + { + SegundaViaReciboPagamento = false; + } + OnPropertyChanged("SomenteNaoPagos"); + } + } + + public bool VisibilityDesconsiderarNegativos + { + get + { + return _visibilityDesconsiderarNegativos; + } + set + { + _visibilityDesconsiderarNegativos = value; + OnPropertyChanged("VisibilityDesconsiderarNegativos"); + } + } + + public bool DesconsiderarNegativos + { + get + { + return _desconsiderarNegativos; + } + set + { + LimparRelatorio(); + _desconsiderarNegativos = value; + OnPropertyChanged("DesconsiderarNegativos"); + } + } + + public bool SegundaViaReciboPagamento + { + get + { + return _segundaViaReciboPagamento; + } + set + { + LimparRelatorio(); + _segundaViaReciboPagamento = value; + if (value) + { + SomenteNaoPagos = false; + } + OnPropertyChanged("SegundaViaReciboPagamento"); + } + } + + public bool DocumentosEmitidos + { + get + { + return _documentosEmitidos; + } + set + { + LimparRelatorio(); + _documentosEmitidos = value; + OnPropertyChanged("DocumentosEmitidos"); + } + } + + public bool SinteticosPagamento + { + get + { + return _sinteticosPagamento; + } + set + { + _sinteticosPagamento = value; + OnPropertyChanged("SinteticosPagamento"); + } + } + + public bool VisibilityUsuarios + { + get + { + return _visibilityUsuarios; + } + set + { + _visibilityUsuarios = value; + OnPropertyChanged("VisibilityUsuarios"); + } + } + + public Visibility VisibilityDocumentoAtivo + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityDocumentoAtivo; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityDocumentoAtivo = value; + OnPropertyChanged("VisibilityDocumentoAtivo"); + } + } + + public Visibility VisibilityReferencia + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityReferencia; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityReferencia = value; + OnPropertyChanged("VisibilityReferencia"); + } + } + + public Visibility VisibilityOrdem + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityOrdem; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityOrdem = value; + OnPropertyChanged("VisibilityOrdem"); + } + } + + public string Referencia + { + get + { + return _referencia; + } + set + { + _referencia = value; + OnPropertyChanged("Referencia"); + } + } + + public ObservableCollection Referencias + { + get + { + return _referencias; + } + set + { + _referencias = value; + OnPropertyChanged("Referencias"); + } + } + + public ObservableCollection Ordens + { + get + { + return _ordens; + } + set + { + _ordens = value; + OnPropertyChanged("Ordens"); + } + } + + public string OrdemSelecionada + { + get + { + return _ordemSelecionada; + } + set + { + _ordemSelecionada = value; + OnPropertyChanged("OrdemSelecionada"); + } + } + + public DateTime Inicio + { + get + { + return _inicio; + } + set + { + if (value < new DateTime(1754, 1, 1)) + { + value = new DateTime(1754, 1, 1); + } + if (value > new DateTime(9999, 12, 31)) + { + value = new DateTime(9999, 12, 31); + } + _inicio = value; + OnPropertyChanged("Inicio"); + } + } + + public DateTime Fim + { + get + { + return _fim; + } + set + { + if (value < new DateTime(1754, 1, 1)) + { + value = new DateTime(1754, 1, 1); + } + if (value > new DateTime(9999, 12, 31)) + { + value = new DateTime(9999, 12, 31); + } + _fim = value; + OnPropertyChanged("Fim"); + } + } + + public int InicioValor + { + get + { + return _inicioValor; + } + set + { + _inicioValor = value; + OnPropertyChanged("InicioValor"); + } + } + + public int FimValor + { + get + { + return _fimValor; + } + set + { + _fimValor = value; + OnPropertyChanged("FimValor"); + } + } + + public Agrupamento Agrupamento + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _agrupamento; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _agrupamento = value; + OnPropertyChanged("Agrupamento"); + } + } + + public List Producao + { + get + { + return _producao; + } + set + { + _producao = value; + OnPropertyChanged("Producao"); + } + } + + public List Licenciamento + { + get + { + return _licenciamento; + } + set + { + _licenciamento = value; + OnPropertyChanged("Licenciamento"); + } + } + + public List Placas + { + get + { + return _placas; + } + set + { + _placas = value; + OnPropertyChanged("Placas"); + } + } + + public List Tarefa + { + get + { + return _tarefa; + } + set + { + _tarefa = value; + OnPropertyChanged("Tarefa"); + } + } + + public List Endossoo + { + get + { + return _endosso; + } + set + { + _endosso = value; + OnPropertyChanged("Endossoo"); + } + } + + public List Classificacao + { + get + { + return _classificacao; + } + set + { + _classificacao = value; + OnPropertyChanged("Classificacao"); + } + } + + public ObservableCollection LicenciamentoFiltrado + { + get + { + return _licenciamentoFiltrado; + } + set + { + _licenciamentoFiltrado = value; + SintetizarRelatorio(); + OnPropertyChanged("LicenciamentoFiltrado"); + } + } + + public ObservableCollection PlacaFiltrado + { + get + { + return _placaFiltrado; + } + set + { + _placaFiltrado = value; + SintetizarRelatorio(); + OnPropertyChanged("PlacaFiltrado"); + } + } + + public ObservableCollection TarefaFiltrado + { + get + { + return _tarefaFiltrado; + } + set + { + _tarefaFiltrado = value; + SintetizarRelatorio(); + OnPropertyChanged("TarefaFiltrado"); + } + } + + public List Renovacao + { + get + { + return _renovacao; + } + set + { + _renovacao = value; + OnPropertyChanged("Renovacao"); + } + } + + public List FaturaPendente + { + get + { + return _faturaPendente; + } + set + { + _faturaPendente = value; + OnPropertyChanged("FaturaPendente"); + } + } + + public ObservableCollection FaturaPendenteFiltrado + { + get + { + return _faturaPendenteFiltrado; + } + set + { + _faturaPendenteFiltrado = value; + SintetizarRelatorio(); + OnPropertyChanged("FaturaPendenteFiltrado"); + } + } + + public List Sinistro + { + get + { + return _sinistro; + } + set + { + _sinistro = value; + OnPropertyChanged("Sinistro"); + } + } + + public List Comissao + { + get + { + return _comissao; + } + set + { + _comissao = value; + OnPropertyChanged("Comissao"); + } + } + + public List Pendente + { + get + { + return _pendente; + } + set + { + _pendente = value; + OnPropertyChanged("Pendente"); + } + } + + public List Pagamentos + { + get + { + return _pagamentos; + } + set + { + _pagamentos = value; + Sintetic = null; + OnPropertyChanged("Pagamentos"); + } + } + + public List PagamentosSintetico + { + get + { + return _pagamentosSintetico; + } + set + { + _pagamentosSintetico = value; + Sintetic = null; + OnPropertyChanged("PagamentosSintetico"); + } + } + + public List ClientesAtivosInativos + { + get + { + return _clientesAtivosInativos; + } + set + { + //IL_0008: Unknown result type (might be due to invalid IL or missing references) + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0029: Expected O, but got Unknown + _clientesAtivosInativos = value; + SinteticoCliente = new SinteticoClientes + { + Total = (value?.Count ?? 0) + }; + OnPropertyChanged("ClientesAtivosInativos"); + } + } + + public List LogsEnvio + { + get + { + return _logsEnvio; + } + set + { + _logsEnvio = value; + OnPropertyChanged("LogsEnvio"); + } + } + + public List ApoliceCritica { get; set; } + + public ObservableCollection ApoliceCriticaFiltrado + { + get + { + return _apoliceCriticaFiltrado; + } + set + { + _apoliceCriticaFiltrado = value; + SintetizarRelatorio(); + OnPropertyChanged("ApoliceCriticaFiltrado"); + } + } + + public List LogUtilizacao { get; set; } + + public ObservableCollection LogUtilizacaoFiltrado + { + get + { + return _logUtilizacaoFiltrado; + } + set + { + _logUtilizacaoFiltrado = value; + SintetizarRelatorio(); + OnPropertyChanged("LogUtilizacaoFiltrado"); + } + } + + public ObservableCollection Fechamento + { + get + { + return _fechamento; + } + set + { + _fechamento = value; + Sintetic = null; + OnPropertyChanged("Fechamento"); + } + } + + public ObservableCollection Previsao + { + get + { + return _previsao; + } + set + { + _previsao = value; + Sintetic = null; + OnPropertyChanged("Previsao"); + } + } + + public ObservableCollection PrevisaoSintetico + { + get + { + return _previsaoSintetico; + } + set + { + _previsaoSintetico = value; + Sintetic = null; + OnPropertyChanged("PrevisaoSintetico"); + } + } + + public List Auditoria + { + get + { + return _auditoria; + } + set + { + _auditoria = value; + OnPropertyChanged("Auditoria"); + } + } + + public ObservableCollection AuditoriaFiltrado + { + get + { + return _auditoriaFiltrado; + } + set + { + _auditoriaFiltrado = value; + SintetizarRelatorio(); + OnPropertyChanged("AuditoriaFiltrado"); + } + } + + public List ApolicePendente + { + get + { + return _apolicePendente; + } + set + { + _apolicePendente = value; + OnPropertyChanged("ApolicePendente"); + } + } + + public List Extratos + { + get + { + return _extratos; + } + set + { + _extratos = value; + OnPropertyChanged("Extratos"); + } + } + + public ObservableCollection ApolicePendenteFiltrado + { + get + { + return _apolicePendenteFiltrado; + } + set + { + _apolicePendenteFiltrado = value; + SintetizarRelatorio(); + OnPropertyChanged("ApolicePendenteFiltrado"); + } + } + + public ObservableCollection ExtratosFiltrado + { + get + { + return _extratosFiltrado; + } + set + { + _extratosFiltrado = value; + SintetizarRelatorio(); + OnPropertyChanged("ExtratosFiltrado"); + } + } + + public List MetaSeguradora + { + get + { + return _metaSeguradora; + } + set + { + _metaSeguradora = value; + OnPropertyChanged("MetaSeguradora"); + } + } + + public List MetaVendedor + { + get + { + return _metaVendedor; + } + set + { + _metaVendedor = value; + OnPropertyChanged("MetaVendedor"); + } + } + + public ObservableCollection MetaSeguradoraFiltrado + { + get + { + return _metaSeguradoraFiltrado; + } + set + { + _metaSeguradoraFiltrado = value; + SintetizarRelatorio(); + OnPropertyChanged("MetaSeguradoraFiltrado"); + } + } + + public ObservableCollection MetaVendedorFiltrado + { + get + { + return _metaVendedorFiltrado; + } + set + { + _metaVendedorFiltrado = value; + SintetizarRelatorio(); + OnPropertyChanged("MetaVendedorFiltrado"); + } + } + + public ObservableCollection ProducaoFiltrado + { + get + { + return _producaoFiltrado; + } + set + { + _producaoFiltrado = value; + SintetizarRelatorio(); + OnPropertyChanged("ProducaoFiltrado"); + } + } + + public ObservableCollection EndossoFiltrado + { + get + { + return _endossoFiltrado; + } + set + { + _endossoFiltrado = value; + SintetizarRelatorio(); + OnPropertyChanged("EndossoFiltrado"); + } + } + + public ObservableCollection NotaFiscalFiltrado + { + get + { + return _notaFiscalFiltrado; + } + set + { + _notaFiscalFiltrado = value; + SintetizarRelatorio(); + OnPropertyChanged("NotaFiscalFiltrado"); + } + } + + public ObservableCollection RenovacaoFiltrado + { + get + { + return _renovacaoFiltrado; + } + set + { + _renovacaoFiltrado = value; + SintetizarRelatorio(); + OnPropertyChanged("RenovacaoFiltrado"); + } + } + + public ObservableCollection SinistroFiltrado + { + get + { + return _sinistroFiltrado; + } + set + { + _sinistroFiltrado = value; + SintetizarRelatorio(); + OnPropertyChanged("SinistroFiltrado"); + } + } + + public ObservableCollection ComissaoFiltrado + { + get + { + return _comissaoFiltrado; + } + set + { + _comissaoFiltrado = value; + SintetizarRelatorio(); + OnPropertyChanged("ComissaoFiltrado"); + } + } + + public ObservableCollection PendenteFiltrado + { + get + { + return _pendenteFiltrado; + } + set + { + _pendenteFiltrado = value; + SintetizarRelatorio(); + OnPropertyChanged("PendenteFiltrado"); + } + } + + public ObservableCollection ClientesAtivosInativosFiltrado + { + get + { + return _clientesAtivosInativosFiltrado; + } + set + { + _clientesAtivosInativosFiltrado = value; + SintetizarRelatorio(); + OnPropertyChanged("ClientesAtivosInativosFiltrado"); + } + } + + public ObservableCollection ClassificacaoFiltrado + { + get + { + return _classificacaoFiltrado; + } + set + { + _classificacaoFiltrado = value; + SintetizarRelatorio(); + OnPropertyChanged("ClassificacaoFiltrado"); + } + } + + public ObservableCollection LogsEnvioFiltrado + { + get + { + return _logsEnvioFiltrado; + } + set + { + _logsEnvioFiltrado = value; + Sintetic = null; + OnPropertyChanged("LogsEnvioFiltrado"); + } + } + + public ObservableCollection FechamentoFiltrado + { + get + { + return _fechamentoFiltrado; + } + set + { + _fechamentoFiltrado = value; + SintetizarRelatorio(); + Sintetic = null; + OnPropertyChanged("FechamentoFiltrado"); + } + } + + public ObservableCollection PrevisaoFiltrado + { + get + { + return _previsaoFiltrado; + } + set + { + _previsaoFiltrado = value; + SintetizarRelatorio(); + Sintetic = null; + OnPropertyChanged("PrevisaoFiltrado"); + } + } + + public bool Totais + { + get + { + return _totais; + } + set + { + _totais = value; + OnPropertyChanged("Totais"); + } + } + + public ObservableCollection SinteticoRelatorio + { + get + { + return _sinteticoRelatorio; + } + set + { + //IL_003a: Unknown result type (might be due to invalid IL or missing references) + _sinteticoRelatorio = value; + OnPropertyChanged("SinteticoRelatorio"); + Totais = value != null && value.Count > 0; + if (value != null && value.Count != 0) + { + List list = value.FirstOrDefault().ConstruirSintetico(Relatorio); + Sintetic = new ObservableCollection(list); + } + } + } + + public SinteticoClientes SinteticoCliente + { + get + { + return _sinteticoCliente; + } + set + { + _sinteticoCliente = value; + OnPropertyChanged("SinteticoCliente"); + } + } + + public ObservableCollection Sintetic + { + get + { + return _sintetic; + } + set + { + _sintetic = value; + OnPropertyChanged("Sintetic"); + } + } + + public bool Comparativo + { + get + { + return _comparativo; + } + set + { + _comparativo = value; + OnPropertyChanged("Comparativo"); + } + } + + public bool Completo + { + get + { + return _completo; + } + set + { + _completo = value; + OnPropertyChanged("Completo"); + } + } + + public bool NotaFiscalPorSeguradora + { + get + { + return _notaFiscalPorSeguradora; + } + set + { + _notaFiscalPorSeguradora = value; + OnPropertyChanged("NotaFiscalPorSeguradora"); + } + } + + public Mes SelectedMes + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _selectedMes; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _selectedMes = value; + OnPropertyChanged("SelectedMes"); + } + } + + public int SelectedAno + { + get + { + return _selectedAno; + } + set + { + _selectedAno = value; + OnPropertyChanged("SelectedAno"); + } + } + + public Visibility InfoVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _infoVisibility; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _infoVisibility = value; + OnPropertyChanged("InfoVisibility"); + } + } + + public string Info + { + get + { + return _info; + } + set + { + _info = value; + OnPropertyChanged("Info"); + } + } + + public string ErroRelatorio + { + get + { + return _erroRelatorio; + } + set + { + _erroRelatorio = value; + OnPropertyChanged("ErroRelatorio"); + } + } + + public bool Carregando + { + get + { + return _carregando; + } + set + { + _carregando = value; + OnPropertyChanged("Carregando"); + } + } + + public bool DocumentosAtivos + { + get + { + return _documentosAtivos; + } + set + { + _documentosAtivos = value; + OnPropertyChanged("DocumentosAtivos"); + } + } + + public Filtros Filtros { get; set; } + + public List ColunasOcultas { get; set; } = new List(); + + + public List Seguradoras + { + get + { + return _seguradoras; + } + set + { + _seguradoras = value; + foreach (Seguradora seguradora in Seguradoras) + { + seguradora.PropertyChanged += SeguradoraOnPropertyChanged; + } + OnPropertyChanged("Seguradoras"); + } + } + + public List Ramos + { + get + { + return _ramos; + } + set + { + _ramos = value; + foreach (Ramo ramo in Ramos) + { + ramo.PropertyChanged += RamoOnPropertyChanged; + } + OnPropertyChanged("Ramos"); + } + } + + public List NotasFiscais + { + get + { + return _notasFiscais; + } + set + { + _notasFiscais = value; + OnPropertyChanged("NotasFiscais"); + } + } + + public bool Inativo + { + get + { + return _inativo; + } + set + { + _inativo = value; + ReloadVendedores(); + OnPropertyChanged("Inativo"); + } + } + + public List Vendedores + { + get + { + return _vendedores; + } + set + { + _vendedores = value; + foreach (Vendedor vendedore in Vendedores) + { + vendedore.PropertyChanged += VendedorOnPropertyChanged; + } + OnPropertyChanged("Vendedores"); + } + } + + public List TipoVendedor + { + get + { + return _tipoVendedor; + } + set + { + _tipoVendedor = value; + foreach (TipoVendedor item in TipoVendedor) + { + item.PropertyChanged += TipoVendedorOnPropertyChanged; + } + OnPropertyChanged("TipoVendedor"); + } + } + + private List Vinculo { get; set; } + + public List Produtos + { + get + { + return _produtos; + } + set + { + _produtos = value; + foreach (Produto produto in Produtos) + { + produto.PropertyChanged += ProdutoOnPropertyChanged; + } + OnPropertyChanged("Produtos"); + } + } + + public List Estipulantes + { + get + { + return _estipulantes; + } + set + { + _estipulantes = value; + foreach (Estipulante estipulante in Estipulantes) + { + estipulante.PropertyChanged += EstipulanteOnPropertyChanged; + } + OnPropertyChanged("Estipulantes"); + } + } + + public List Negocios + { + get + { + return _negocios; + } + set + { + _negocios = value; + foreach (NegocioRelatorio negocio in Negocios) + { + negocio.PropertyChanged += NegocioOnPropertyChanged; + } + OnPropertyChanged("Negocios"); + } + } + + public List TipoSeguros + { + get + { + return _tipoSeguros; + } + set + { + _tipoSeguros = value; + foreach (StatusRelatorio tipoSeguro in TipoSeguros) + { + tipoSeguro.PropertyChanged += StatusOnPropertyChanged; + } + OnPropertyChanged("TipoSeguros"); + } + } + + public bool IsVisibleGrid1 + { + get + { + return _isVisibleGrid1; + } + set + { + _isVisibleGrid1 = value; + OnPropertyChanged("IsVisibleGrid1"); + } + } + + public bool IsVisibleGrid2 + { + get + { + return _isVisibleGrid2; + } + set + { + _isVisibleGrid2 = value; + OnPropertyChanged("IsVisibleGrid2"); + } + } + + public bool IsVisibleGrid3 + { + get + { + return _isVisibleGrid3; + } + set + { + _isVisibleGrid3 = value; + OnPropertyChanged("IsVisibleGrid3"); + } + } + + public bool IsVisibleGrid4 + { + get + { + return _isVisibleGrid4; + } + set + { + _isVisibleGrid4 = value; + OnPropertyChanged("IsVisibleGrid4"); + } + } + + public List RelatorioFiltroPersonalizado + { + get + { + return _filtroRelatorioPersonalizado; + } + set + { + _filtroRelatorioPersonalizado = value; + OnPropertyChanged("RelatorioFiltroPersonalizado"); + } + } + + public FiltroPersonalizado FiltroPersonalizado + { + get + { + return _filtroPersonalizado; + } + set + { + _filtroPersonalizado = value; + VisibilitySemValor = (Visibility)((value == null) ? 2 : 0); + VisibilityOpcoesFiltros = (Visibility)2; + OnPropertyChanged("FiltroPersonalizado"); + if (value == null) + { + return; + } + string name = value.Tipo.Name; + if (name == null) + { + return; + } + switch (name.Length) + { + default: + return; + case 4: + { + char c = name[0]; + if (c != 'E') + { + if (c != 'l' || !(name == "long")) + { + return; + } + break; + } + if (!(name == "Enum")) + { + return; + } + goto IL_013b; + } + case 5: + switch (name[3]) + { + default: + return; + case '3': + if (!(name == "int32")) + { + return; + } + break; + case '6': + if (!(name == "int64")) + { + return; + } + break; + } + break; + case 6: + if (name == "String") + { + ValorInicial = ""; + ValorFinal = ""; + VisibilityOpcoesFiltros = (Visibility)((value == null) ? 2 : 0); + } + return; + case 7: + if (name == "Decimal") + { + ValorInicial = "0,00"; + ValorFinal = "0,00"; + } + return; + case 8: + if (!(name == "DateTime")) + { + return; + } + goto IL_013b; + case 3: + { + if (!(name == "int")) + { + return; + } + break; + } + IL_013b: + ValorInicial = null; + ValorFinal = null; + return; + } + ValorInicial = "0"; + ValorFinal = "0"; + } + } + + public Type TipoString + { + get + { + return _tipoString; + } + set + { + _tipoString = value; + OnPropertyChanged("TipoString"); + } + } + + public Type TipoEnum + { + get + { + return _tipoEnum; + } + set + { + _tipoEnum = value; + OnPropertyChanged("TipoEnum"); + } + } + + public Type TipoDateTime + { + get + { + return _tipoDateTime; + } + set + { + _tipoDateTime = value; + OnPropertyChanged("TipoDateTime"); + } + } + + public Type TipoDecimal + { + get + { + return _tipoDecimal; + } + set + { + _tipoDecimal = value; + OnPropertyChanged("TipoDecimal"); + } + } + + public Type TipoInt + { + get + { + return _tipoInt; + } + set + { + _tipoInt = value; + OnPropertyChanged("TipoInt"); + } + } + + public Type TipoLong + { + get + { + return _tipoLong; + } + set + { + _tipoLong = value; + OnPropertyChanged("TipoLong"); + } + } + + public ObservableCollection RamosSelecionados + { + get + { + return _ramosSelecionados; + } + set + { + _ramosSelecionados = value; + OnPropertyChanged("RamosSelecionados"); + } + } + + public bool NovosNegocios + { + get + { + return _novosNegocios; + } + set + { + _novosNegocios = value; + OnPropertyChanged("NovosNegocios"); + } + } + + public Ramo RamoSelecionado + { + get + { + return _ramoSelecionado; + } + set + { + _ramoSelecionado = value; + OnPropertyChanged("RamoSelecionado"); + } + } + + public string ValorInicial + { + get + { + return _valorIncial; + } + set + { + _valorIncial = value; + OnPropertyChanged("ValorInicial"); + } + } + + public string ValorFinal + { + get + { + return _valorFinal; + } + set + { + _valorFinal = value; + OnPropertyChanged("ValorFinal"); + } + } + + public bool SemValor + { + get + { + return _semValor; + } + set + { + _semValor = value; + if (value) + { + ValorInicial = null; + ValorFinal = null; + } + OnPropertyChanged("SemValor"); + } + } + + public bool ValorIgual + { + get + { + return _valorIgual; + } + set + { + _valorIgual = value; + OnPropertyChanged("ValorIgual"); + } + } + + public Visibility VisibilitySemValor + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilitySemValor; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilitySemValor = value; + OnPropertyChanged("VisibilitySemValor"); + } + } + + public Visibility VisibilityOpcoesFiltros + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityOpcoesFiltros; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityOpcoesFiltros = value; + OnPropertyChanged("VisibilityOpcoesFiltros"); + } + } + + public ObservableCollection FiltroPersonalizadoSelecionado + { + get + { + return _filtroPersonalizadoSelecionado; + } + set + { + _filtroPersonalizadoSelecionado = value; + OnPropertyChanged("FiltroPersonalizadoSelecionado"); + } + } + + public ObservableCollection FiltroRelatorioSelecionado + { + get + { + return _filtroRelatorioSelecionado; + } + set + { + _filtroRelatorioSelecionado = value; + OnPropertyChanged("FiltroRelatorioSelecionado"); + } + } + + public Visibility VisibilityFiltros + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityFiltros; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityFiltros = value; + OnPropertyChanged("VisibilityFiltros"); + } + } + + public Visibility VisibilityEtiqueta + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityEtiqueta; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityEtiqueta = value; + OnPropertyChanged("VisibilityEtiqueta"); + } + } + + public Visibility VisibiltyProtocolo + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibiltyProtocolo; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibiltyProtocolo = value; + OnPropertyChanged("VisibiltyProtocolo"); + } + } + + public Visibility VisibiltySincronizar + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibiltySincronizar; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibiltySincronizar = value; + OnPropertyChanged("VisibiltySincronizar"); + } + } + + public Visibility VisibilityEmail + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityEmail; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityEmail = value; + OnPropertyChanged("VisibilityEmail"); + } + } + + public Visibility VisibilityApolice + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityApolice; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityApolice = value; + OnPropertyChanged("VisibilityApolice"); + } + } + + public Visibility VisibilityExtratos + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityExtratos; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityExtratos = value; + OnPropertyChanged("VisibilityExtratos"); + } + } + + public Visibility VisibilityData + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityData; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityData = value; + OnPropertyChanged("VisibilityData"); + } + } + + public Visibility VisibilityMeta + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityMeta; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityMeta = value; + OnPropertyChanged("VisibilityMeta"); + } + } + + public Visibility VisibilityMaisFiltros + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityMaisFiltros; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityMaisFiltros = value; + OnPropertyChanged("VisibilityMaisFiltros"); + } + } + + public Visibility VisibilityGridFiltros + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityGridFiltros; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityGridFiltros = value; + OnPropertyChanged("VisibilityGridFiltros"); + } + } + + public Visibility VisibilityAgrupamento + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityAgrupamento; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityAgrupamento = value; + OnPropertyChanged("VisibilityAgrupamento"); + } + } + + public Visibility VisibilityOlho + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityOlho; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityOlho = value; + OnPropertyChanged("VisibilityOlho"); + } + } + + public Visibility VisibilityEspecial + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityEspecial; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityEspecial = value; + OnPropertyChanged("VisibilityEspecial"); + } + } + + public Visibility VisibilityComparativo + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityComparativo; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityComparativo = value; + OnPropertyChanged("VisibilityComparativo"); + } + } + + public Visibility VisibilityCompleto + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityCompleto; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityCompleto = value; + OnPropertyChanged("VisibilityCompleto"); + } + } + + public Visibility VisibilityNotaFiscalPorSeguradora + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityNotaFiscalPorSeguradora; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityNotaFiscalPorSeguradora = value; + OnPropertyChanged("VisibilityNotaFiscalPorSeguradora"); + } + } + + public Visibility VisibilityPagamento + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityPagamento; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityPagamento = value; + OnPropertyChanged("VisibilityPagamento"); + } + } + + public Visibility VisibilitySintetizar + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilitySintetizar; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilitySintetizar = value; + OnPropertyChanged("VisibilitySintetizar"); + } + } + + public Visibility VisibilityConfigurar + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityConfigurar; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityConfigurar = value; + OnPropertyChanged("VisibilityConfigurar"); + } + } + + public Visibility VisibilityFiltroPersonalizadoButton + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityFiltroPersonalizadoButton; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityFiltroPersonalizadoButton = value; + OnPropertyChanged("VisibilityFiltroPersonalizadoButton"); + } + } + + public Visibility VisibilityTarefas + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityTarefas; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityTarefas = value; + OnPropertyChanged("VisibilityTarefas"); + } + } + + public Visibility VisibilityAcompanhamento + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityAcompanhamento; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityAcompanhamento = value; + OnPropertyChanged("VisibilityAcompanhamento"); + } + } + + public Visibility VisibilityValor + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityValor; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityValor = value; + OnPropertyChanged("VisibilityValor"); + } + } + + public Visibility VisibilityFiltroPersonalizado + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityFiltroPersonalizado; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityFiltroPersonalizado = value; + OnPropertyChanged("VisibilityFiltroPersonalizado"); + } + } + + public string Head + { + get + { + return _head; + } + set + { + _head = value; + OnPropertyChanged("Head"); + } + } + + public List ParcelasEspeciais + { + get + { + return _parcelasEspeciais; + } + set + { + _parcelasEspeciais = value; + OnPropertyChanged("ParcelasEspeciais"); + } + } + + public ObservableCollection Ajuda + { + get + { + return _ajuda; + } + set + { + _ajuda = value; + OnPropertyChanged("Ajuda"); + } + } + + public bool CarregandoAjuda + { + get + { + return _carregandoAjuda; + } + set + { + _carregandoAjuda = value; + OnPropertyChanged("CarregandoAjuda"); + } + } + + public ObservableCollection ParametrosRelatorio + { + get + { + return _parametrosRelatorio; + } + set + { + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Unknown result type (might be due to invalid IL or missing references) + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_0029: Expected O, but got Unknown + if (value == null) + { + value = new ObservableCollection(); + } + value.Insert(0, new ParametrosRelatorio + { + Id = 0L, + Header = "SELECIONE UM CAMPO" + }); + _parametrosRelatorio = value; + SelectedParametrosRelatorio = value[0]; + OnPropertyChanged("ParametrosRelatorio"); + } + } + + public ObservableCollection ParametrosRelatorioAdicionados + { + get + { + return _parametrosRelatorioAdicionados; + } + set + { + _parametrosRelatorioAdicionados = value; + OnPropertyChanged("ParametrosRelatorioAdicionados"); + } + } + + public ObservableCollection ParametrosTotalizacao + { + get + { + return _parametrosTotalizacao; + } + set + { + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Unknown result type (might be due to invalid IL or missing references) + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_0029: Expected O, but got Unknown + if (value == null) + { + value = new ObservableCollection(); + } + value.Insert(0, new ParametrosTotalizacao + { + Id = 0L, + Header = "SELECIONE UMA TOTALIZAÇÃO" + }); + _parametrosTotalizacao = value; + SelectedParametrosTotalizacao = value[0]; + OnPropertyChanged("ParametrosTotalizacao"); + } + } + + public ObservableCollection ParametrosTotalizacaoAdicionados + { + get + { + return _parametrosTotalizacaoAdicionados; + } + set + { + _parametrosTotalizacaoAdicionados = value; + OnPropertyChanged("ParametrosTotalizacaoAdicionados"); + } + } + + public bool IsCampo + { + get + { + return _isCampo; + } + set + { + _isCampo = value; + OnPropertyChanged("IsCampo"); + } + } + + public ParametrosRelatorio SelectedParametrosRelatorio + { + get + { + return _selectedParametrosRelatorio; + } + set + { + _selectedParametrosRelatorio = value; + OnPropertyChanged("SelectedParametrosRelatorio"); + } + } + + public ParametrosTotalizacao SelectedParametrosTotalizacao + { + get + { + return _selectedParametrosTotalizacao; + } + set + { + _selectedParametrosTotalizacao = value; + OnPropertyChanged("SelectedParametrosTotalizacao"); + } + } + + public List Usuarios { get; set; } + + public ObservableCollection UsuariosFiltrados + { + get + { + return _usuariosFiltrados; + } + set + { + _usuariosFiltrados = value; + OnPropertyChanged("UsuariosFiltrados"); + } + } + + public RelatorioViewModel(string opcao) + { + //IL_00cd: Unknown result type (might be due to invalid IL or missing references) + //IL_00d4: Unknown result type (might be due to invalid IL or missing references) + //IL_010a: Unknown result type (might be due to invalid IL or missing references) + //IL_0111: Unknown result type (might be due to invalid IL or missing references) + //IL_015d: Unknown result type (might be due to invalid IL or missing references) + //IL_03f7: Unknown result type (might be due to invalid IL or missing references) + //IL_03fe: Unknown result type (might be due to invalid IL or missing references) + //IL_0410: Unknown result type (might be due to invalid IL or missing references) + //IL_041c: Unknown result type (might be due to invalid IL or missing references) + //IL_0421: Unknown result type (might be due to invalid IL or missing references) + //IL_0428: Unknown result type (might be due to invalid IL or missing references) + //IL_0434: Expected O, but got Unknown + //IL_0435: Unknown result type (might be due to invalid IL or missing references) + //IL_043a: Unknown result type (might be due to invalid IL or missing references) + //IL_0441: Unknown result type (might be due to invalid IL or missing references) + //IL_044d: Expected O, but got Unknown + //IL_044e: Unknown result type (might be due to invalid IL or missing references) + //IL_0453: Unknown result type (might be due to invalid IL or missing references) + //IL_045a: Unknown result type (might be due to invalid IL or missing references) + //IL_0466: Expected O, but got Unknown + //IL_0467: Unknown result type (might be due to invalid IL or missing references) + //IL_046c: Unknown result type (might be due to invalid IL or missing references) + //IL_0473: Unknown result type (might be due to invalid IL or missing references) + //IL_047f: Expected O, but got Unknown + //IL_0480: Unknown result type (might be due to invalid IL or missing references) + //IL_0485: Unknown result type (might be due to invalid IL or missing references) + //IL_048c: Unknown result type (might be due to invalid IL or missing references) + //IL_0498: Expected O, but got Unknown + //IL_0499: Unknown result type (might be due to invalid IL or missing references) + //IL_049e: Unknown result type (might be due to invalid IL or missing references) + //IL_04a5: Unknown result type (might be due to invalid IL or missing references) + //IL_04b1: Expected O, but got Unknown + //IL_05c7: Unknown result type (might be due to invalid IL or missing references) + //IL_05cc: Unknown result type (might be due to invalid IL or missing references) + //IL_05d4: Unknown result type (might be due to invalid IL or missing references) + //IL_05e4: Expected O, but got Unknown + _apoliceServico = new ApoliceServico(); + _parcelaServico = new ParcelaServico(); + _sinistroServico = new SinistroServico(); + _clienteServico = new ClienteServico(); + _logServico = new LogServico(); + _extratoServico = new ServicoExtrato(); + _metaSeguradoraServico = new MetaSeguradoraServico(); + _metaVendedorServico = new MetaVendedorServico(); + _notaFiscalServico = new NotaFiscalServico(); + _criticaServico = new CriticaApoliceServico(); + Sessao = Guid.NewGuid().ToString(); + base.IsEnabled = true; + Apelido = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 6); + List list = Recursos.Empresas.OrderBy((Empresa x) => ((DomainBase)x).Id).ToList(); + list.Insert(0, new Empresa + { + Id = 0L, + Nome = "TODAS, MATRIZ E FILIAIS" + }); + Empresas = list; + Empresa = (Empresa)((Recursos.Usuario.IdEmpresa <= 1) ? ((object)Empresas.First()) : ((object)Empresas.Find((Empresa x) => ((DomainBase)x).Id == Recursos.Usuario.IdEmpresa))); + EnableEmpresa = Recursos.Usuario.IdEmpresa <= 1; + base.EnableMenu = true; + LoadVendedores(); + PopularRelatorio(opcao); + } + + private void AllSelectedChanged(int tipo) + { + if (_allSelectedChanging) + { + return; + } + try + { + _alterandoFiltros = true; + _allSelectedChanging = true; + switch (tipo) + { + case 0: + if (!AllSelectedSeguradora.HasValue) + { + return; + } + foreach (Seguradora seguradora in Seguradoras) + { + seguradora.Selecionado = AllSelectedSeguradora.Value; + } + break; + case 1: + if (!AllSelectedRamo.HasValue) + { + return; + } + foreach (Ramo ramo in Ramos) + { + ramo.Selecionado = AllSelectedRamo.Value; + } + break; + case 2: + if (!AllSelectedVendedor.HasValue) + { + return; + } + foreach (Vendedor vendedore in Vendedores) + { + vendedore.Selecionado = AllSelectedVendedor.Value; + } + break; + case 3: + if (!AllSelectedStatus.HasValue) + { + return; + } + foreach (StatusRelatorio tipoSeguro in TipoSeguros) + { + tipoSeguro.Selecionado = AllSelectedStatus.Value; + } + break; + case 4: + if (!AllSelectedTipoVendedor.HasValue) + { + return; + } + foreach (TipoVendedor item in TipoVendedor) + { + item.Selecionado = AllSelectedTipoVendedor.Value; + } + break; + case 5: + if (!AllSelectedNegocio.HasValue) + { + return; + } + foreach (NegocioRelatorio negocio in Negocios) + { + negocio.Selecionado = AllSelectedNegocio.Value; + } + break; + case 6: + if (!AllSelectedProduto.HasValue) + { + return; + } + foreach (Produto produto in Produtos) + { + produto.Selecionado = AllSelectedProduto.Value; + } + break; + case 7: + if (!AllSelectedEstipulante.HasValue) + { + return; + } + foreach (Estipulante estipulante in Estipulantes) + { + estipulante.Selecionado = AllSelectedEstipulante.Value; + } + break; + } + _alterandoFiltros = false; + AdicionarFiltros(); + } + finally + { + _allSelectedChanging = false; + } + } + + private void Filtrar() + { + Seguradoras = (from x in Recursos.Seguradoras + where x.Ativo && x.Nome.Contains(Filtro) + orderby x.Nome + select x).ToList(); + Ramos = (from x in Recursos.Ramos + where x.Ativo && x.Nome.Contains(Filtro) + orderby x.Nome + select x).ToList(); + Estipulantes = (from x in Recursos.Estipulantes + where x.Ativo && x.Nome.Contains(Filtro) + orderby x.Nome + select x).ToList(); + Vendedores = ((Vinculo.Count > 0) ? (from x in Recursos.Vendedores + where Vinculo.Any((VendedorUsuario y) => ((DomainBase)y.Vendedor).Id == ((DomainBase)x).Id) && x.Nome.Contains(Filtro) && x.Ativo + orderby x.Nome + select x).ToList() : (from x in Recursos.Vendedores + where x.Nome.Contains(Filtro) && (Inativo || x.Ativo) + orderby x.Nome + select x).ToList()); + TipoVendedor = (from x in Recursos.TipoVendedor + where x.Ativo.GetValueOrDefault() && x.Descricao.Contains(Filtro) + orderby x.Descricao + select x).ToList(); + Produtos = (from x in Recursos.Produtos + where x.Ativo && x.Nome.Contains(Filtro) + orderby x.Nome + select x).ToList(); + TipoSeguros = (from x in TipoSegurosList + where EnumHelper.GetDescription(x.Status).Contains(Filtro) + orderby x.Status + select x).ToList(); + Negocios = (from x in NegocioList + where EnumHelper.GetDescription(x.Negocio).Contains(Filtro) + orderby x.Negocio + select x).ToList(); + } + + internal async Task RemoverVinculo(ApolicePendente pendencia) + { + Loading(isLoading: true); + VinculoDocumento vinculo = pendencia.Documento.Vinculo; + if (vinculo != null && vinculo.Id != 0L) + { + await _apoliceServico.ExcluirVinculo(vinculo.Id); + Gestor.Application.Actions.Actions.RecarregarRelatorios?.Invoke(Sessao); + Loading(isLoading: false); + } + } + + private void WorkOnRelatorio(Relatorio value) + { + //IL_00bc: Unknown result type (might be due to invalid IL or missing references) + //IL_00be: Invalid comparison between Unknown and I4 + //IL_00c0: Unknown result type (might be due to invalid IL or missing references) + //IL_00c3: Invalid comparison between Unknown and I4 + //IL_00f9: Unknown result type (might be due to invalid IL or missing references) + //IL_00fc: Invalid comparison between Unknown and I4 + //IL_00fe: Unknown result type (might be due to invalid IL or missing references) + //IL_0100: Invalid comparison between Unknown and I4 + //IL_016c: Unknown result type (might be due to invalid IL or missing references) + //IL_01ea: Expected I4, but got Unknown + //IL_0634: Unknown result type (might be due to invalid IL or missing references) + //IL_0639: Unknown result type (might be due to invalid IL or missing references) + //IL_0641: Unknown result type (might be due to invalid IL or missing references) + //IL_064d: Unknown result type (might be due to invalid IL or missing references) + //IL_0655: Expected O, but got Unknown + //IL_065c: Unknown result type (might be due to invalid IL or missing references) + //IL_0661: Unknown result type (might be due to invalid IL or missing references) + //IL_0669: Unknown result type (might be due to invalid IL or missing references) + //IL_0675: Unknown result type (might be due to invalid IL or missing references) + //IL_067d: Expected O, but got Unknown + //IL_053c: Unknown result type (might be due to invalid IL or missing references) + //IL_0541: Unknown result type (might be due to invalid IL or missing references) + //IL_0549: Unknown result type (might be due to invalid IL or missing references) + //IL_0555: Unknown result type (might be due to invalid IL or missing references) + //IL_055d: Expected O, but got Unknown + //IL_0564: Unknown result type (might be due to invalid IL or missing references) + //IL_0569: Unknown result type (might be due to invalid IL or missing references) + //IL_0571: Unknown result type (might be due to invalid IL or missing references) + //IL_057d: Unknown result type (might be due to invalid IL or missing references) + //IL_0585: Expected O, but got Unknown + //IL_058c: Unknown result type (might be due to invalid IL or missing references) + //IL_0591: Unknown result type (might be due to invalid IL or missing references) + //IL_0599: Unknown result type (might be due to invalid IL or missing references) + //IL_05a5: Unknown result type (might be due to invalid IL or missing references) + //IL_05ad: Expected O, but got Unknown + //IL_05b4: Unknown result type (might be due to invalid IL or missing references) + //IL_05b9: Unknown result type (might be due to invalid IL or missing references) + //IL_05c1: Unknown result type (might be due to invalid IL or missing references) + //IL_05cd: Unknown result type (might be due to invalid IL or missing references) + //IL_05d5: Expected O, but got Unknown + //IL_05dc: Unknown result type (might be due to invalid IL or missing references) + //IL_05e1: Unknown result type (might be due to invalid IL or missing references) + //IL_05e9: Unknown result type (might be due to invalid IL or missing references) + //IL_05f5: Unknown result type (might be due to invalid IL or missing references) + //IL_05fd: Expected O, but got Unknown + //IL_0604: Unknown result type (might be due to invalid IL or missing references) + //IL_0609: Unknown result type (might be due to invalid IL or missing references) + //IL_0611: Unknown result type (might be due to invalid IL or missing references) + //IL_061d: Unknown result type (might be due to invalid IL or missing references) + //IL_0625: Expected O, but got Unknown + //IL_0376: Unknown result type (might be due to invalid IL or missing references) + //IL_037d: Invalid comparison between Unknown and I4 + //IL_0797: Unknown result type (might be due to invalid IL or missing references) + //IL_079e: Invalid comparison between Unknown and I4 + HtmlContent = string.Empty; + VisibilityHtml = false; + FiltroRelatorioSelecionado = new ObservableCollection(); + LimparFiltros(); + VisibilityFiltros = (Visibility)0; + VisibilityMaisFiltros = (Visibility)0; + VisibilityGridFiltros = (Visibility)2; + VisibilityData = (Visibility)0; + VisibilityOlho = (Visibility)0; + VisibilityEspecial = (Visibility)2; + VisibilityPagamento = (Visibility)2; + VisibilityExtratos = (Visibility)0; + VisibilityEtiqueta = (Visibility)0; + VisibilityEmail = (Visibility)0; + VisibilityAgrupamento = (Visibility)0; + VisibilitySintetizar = (Visibility)0; + Usuario usuario = Recursos.Usuario; + VisibilityTarefas = (Visibility)((usuario == null || ((DomainBase)usuario).Id <= 0) ? 2 : 0); + VisibilityAcompanhamento = (Visibility)2; + VisibilityReferencia = (Visibility)2; + VisibiltyProtocolo = (Visibility)2; + VisibilityMeta = (Visibility)2; + VisibilityApolice = (Visibility)2; + VisibiltySincronizar = (Visibility)(((int)value != 3 && (int)value != 16) ? 2 : 0); + VisibilityComparativo = (Visibility)2; + VisibilityCompleto = (Visibility)2; + VisibilityNotaFiscalPorSeguradora = (Visibility)2; + Agrupamento = (Agrupamento)0; + NovosNegocios = false; + ExtratosEnabled = false; + PermitirFiltrosPersonalizados = (int)value != 11 && (int)value != 7; + VisibilityFiltroPersonalizadoButton = (Visibility)0; + Usuario usuario2 = Recursos.Usuario; + VisibilityConfigurar = (Visibility)((usuario2 == null || ((DomainBase)usuario2).Id <= 0) ? 2 : 0); + VisibilityUsuarios = false; + VisibilityOrdem = (Visibility)2; + VisibilityValor = (Visibility)2; + PlanilhaVisibility = (Visibility)2; + VisibilityDocumentoAtivo = (Visibility)2; + LimparFiltroUsuario(); + InicioValor = 0; + FimValor = 0; + switch ((int)value) + { + case 26: + VisibilityExtratos = (Visibility)2; + VisibilitySintetizar = (Visibility)2; + VisibilityAgrupamento = (Visibility)2; + VisibilityMaisFiltros = (Visibility)2; + VisibilityTarefas = (Visibility)2; + VisibilityEtiqueta = (Visibility)2; + PlanilhaVisibility = (Visibility)2; + break; + case 24: + case 25: + VisibilityExtratos = (Visibility)2; + VisibilitySintetizar = (Visibility)2; + VisibilityAgrupamento = (Visibility)2; + VisibilityMaisFiltros = (Visibility)0; + VisibilityTarefas = (Visibility)2; + VisibilityEtiqueta = (Visibility)2; + VisibilityEmail = (Visibility)2; + break; + case 18: + VisibilityExtratos = (Visibility)2; + VisibilitySintetizar = (Visibility)2; + VisibilityAgrupamento = (Visibility)2; + VisibilityMaisFiltros = (Visibility)2; + VisibilityTarefas = (Visibility)2; + VisibilityEtiqueta = (Visibility)2; + VisibilityEmail = (Visibility)2; + break; + case 17: + VisibilityExtratos = (Visibility)2; + VisibilitySintetizar = (Visibility)2; + VisibilityAgrupamento = (Visibility)2; + VisibilityMaisFiltros = (Visibility)2; + VisibilityTarefas = (Visibility)2; + VisibilityEtiqueta = (Visibility)2; + VisibilityData = (Visibility)2; + VisibilityValor = (Visibility)0; + InfoVisibility = (Visibility)2; + break; + case 0: + VisibilityAgrupamento = (Visibility)2; + VisibilityData = (Visibility)2; + VisibilitySintetizar = (Visibility)2; + VisibilityMaisFiltros = (Visibility)2; + VisibilityFiltros = (Visibility)2; + VisibilityCompleto = (Visibility)0; + InfoVisibility = (Visibility)2; + break; + case 1: + VisibilityAgrupamento = (Visibility)2; + VisibilitySintetizar = (Visibility)2; + VisibilityMaisFiltros = (Visibility)2; + VisibilityFiltros = (Visibility)2; + VisibilityExtratos = (Visibility)2; + Info = "O RELATÓRIO DE ANIVERSARIANTE CONSIDERA O DIA E MÊS FILTRADOS E DESCONSIDERA O ANO INFORMADO NA PESQUISA."; + InfoVisibility = (Visibility)0; + break; + case 5: + VisibilityExtratos = (Visibility)2; + break; + case 13: + case 20: + { + List list = new List { "DATA IMPORTAÇÃO", "DATA DO EXTRATO", "DATA DO CRÉDITO" }; + Referencias = new ObservableCollection(list); + Referencia = Referencias.First(); + if ((int)Relatorio == 13) + { + VisibilityReferencia = (Visibility)0; + VisibilityMaisFiltros = (Visibility)2; + } + VisibilityEspecial = (Visibility)2; + VisibilityExtratos = (Visibility)2; + VisibilityEtiqueta = (Visibility)2; + VisibilityEmail = (Visibility)2; + VisibilityAgrupamento = (Visibility)2; + VisibilitySintetizar = (Visibility)2; + VisibilityTarefas = (Visibility)2; + break; + } + case 11: + { + VisibilityComparativo = (Visibility)0; + VisibilityEspecial = (Visibility)2; + VisibilityExtratos = (Visibility)2; + VisibilityEtiqueta = (Visibility)2; + VisibilityEmail = (Visibility)2; + VisibilityAgrupamento = (Visibility)2; + VisibilitySintetizar = (Visibility)0; + VisibilityTarefas = (Visibility)2; + VisibilityReferencia = (Visibility)0; + List list = new List { "VIGÊNCIA INICIAL", "EMISSÃO" }; + Referencias = new ObservableCollection(list); + Referencia = Referencias.First(); + break; + } + case 7: + { + ParcelasEspeciais[0].IsEnable = true; + VisibilityEspecial = (Visibility)0; + VisibilityPagamento = (Visibility)0; + VisibilityExtratos = (Visibility)2; + VisibilityEtiqueta = (Visibility)2; + VisibilityEmail = (Visibility)2; + VisibilityAgrupamento = (Visibility)2; + VisibilityTarefas = (Visibility)2; + SomenteNaoPagos = true; + ReciboPagamento = false; + VisibilityOrdem = (Visibility)((!Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 8)) ? 2 : 0); + List list2 = new List { "DATA RECEBIMENTO", "NOME CLIENTE", "SEGURADORA, RAMO" }; + Ordens = new ObservableCollection(list2); + OrdemSelecionada = Ordens.First(); + VisibilityHtml = true; + break; + } + case 8: + { + ParcelasEspeciais[0].IsEnable = false; + VisibilityEspecial = (Visibility)0; + VisibilityExtratos = (Visibility)2; + Info = "AGORA O RELATÓRIO DE AUDITORIA SELECIONA TODOS OS SEGUROS, MESMO TENDO PARCELAS PENDENTES, PARA FILTRAR APENAS OS SEGUROS SEM PARCELAS PENDENTES, BASTA UTILIZAR O FILTRO PERSONALIZADO 'RECEBIDO POR COMPLETO', PREENCHER 'SIM' EM SEU VALOR E APLICAR O FILTRO"; + InfoVisibility = (Visibility)0; + FiltroRelatorio filtro = new FiltroRelatorio + { + Id = 1L, + Descricao = EnumHelper.GetDescription((TipoSeguro)1), + Tipo = (TipoFiltroRelatorio)5 + }; + AdicionarFiltro(filtro); + filtro = new FiltroRelatorio + { + Id = 2L, + Descricao = EnumHelper.GetDescription((TipoSeguro)2), + Tipo = (TipoFiltroRelatorio)5 + }; + AdicionarFiltro(filtro); + filtro = new FiltroRelatorio + { + Id = 3L, + Descricao = EnumHelper.GetDescription((TipoSeguro)3), + Tipo = (TipoFiltroRelatorio)5 + }; + AdicionarFiltro(filtro); + filtro = new FiltroRelatorio + { + Id = 4L, + Descricao = EnumHelper.GetDescription((TipoSeguro)4), + Tipo = (TipoFiltroRelatorio)5 + }; + AdicionarFiltro(filtro); + filtro = new FiltroRelatorio + { + Id = 5L, + Descricao = EnumHelper.GetDescription((TipoSeguro)5), + Tipo = (TipoFiltroRelatorio)5 + }; + AdicionarFiltro(filtro); + filtro = new FiltroRelatorio + { + Id = 6L, + Descricao = EnumHelper.GetDescription((TipoSeguro)6), + Tipo = (TipoFiltroRelatorio)5 + }; + AdicionarFiltro(filtro); + break; + } + case 2: + { + VisibiltyProtocolo = (Visibility)0; + FiltroRelatorio filtro = new FiltroRelatorio + { + Id = 1L, + Descricao = EnumHelper.GetDescription((TipoSeguro)1), + Tipo = (TipoFiltroRelatorio)5 + }; + AdicionarFiltro(filtro); + filtro = new FiltroRelatorio + { + Id = 2L, + Descricao = EnumHelper.GetDescription((TipoSeguro)2), + Tipo = (TipoFiltroRelatorio)5 + }; + AdicionarFiltro(filtro); + List list = new List { "VIGÊNCIA INICIAL", "EMISSÃO", "TRANSMISSÃO PROPOSTA", "DATA DE CADASTRO" }; + Referencias = new ObservableCollection(list); + Referencia = Referencias.First(); + VisibilityReferencia = (Visibility)0; + VisibilityGridFiltros = (Visibility)0; + VisibilityOlho = (Visibility)2; + PlanilhaVisibility = (Visibility)0; + break; + } + case 12: + { + List list = new List { "VIGÊNCIA", "VENCIMENTO" }; + Referencias = new ObservableCollection(list); + Referencia = Referencias.First(); + VisibilityReferencia = (Visibility)0; + VisibilityExtratos = (Visibility)2; + VisibilitySintetizar = (Visibility)2; + break; + } + case 3: + VisibiltyProtocolo = (Visibility)0; + VisibiltySincronizar = (Visibility)0; + VisibilityExtratos = (Visibility)2; + break; + case 4: + VisibiltyProtocolo = (Visibility)0; + VisibilityAcompanhamento = (Visibility)0; + PlanilhaVisibility = (Visibility)0; + break; + case 14: + case 15: + { + VisibilityEtiqueta = (Visibility)2; + VisibilityAgrupamento = (Visibility)2; + VisibilityData = (Visibility)2; + VisibilitySintetizar = (Visibility)0; + VisibilityExtratos = (Visibility)2; + VisibilityMeta = (Visibility)0; + Agrupamento = (Agrupamento)(((int)Relatorio != 15) ? 1 : 3); + DateTime date = Funcoes.GetNetworkTime().Date; + SelectedMes = (Mes)date.Month; + SelectedAno = date.Year; + break; + } + case 10: + { + VisibilityExtratos = (Visibility)2; + VisibilityReferencia = (Visibility)0; + List list = new List { "DATA SINISTRO", "DATA LIQUIDAÇÃO", "DATA RECLAMAÇÃO" }; + Referencias = new ObservableCollection(list); + Referencia = Referencias.First(); + break; + } + case 16: + VisibilityExtratos = (Visibility)2; + PlanilhaVisibility = (Visibility)2; + VisibilityDocumentoAtivo = (Visibility)0; + break; + case 6: + case 9: + VisibilityExtratos = (Visibility)2; + PlanilhaVisibility = (Visibility)2; + break; + case 19: + VisibilityExtratos = (Visibility)2; + VisibilityEtiqueta = (Visibility)2; + VisibilityAgrupamento = (Visibility)2; + VisibilityNotaFiscalPorSeguradora = (Visibility)0; + VisibilitySintetizar = (Visibility)2; + VisibilityEmail = (Visibility)2; + VisibilityTarefas = (Visibility)2; + break; + case 23: + VisibilitySintetizar = (Visibility)2; + VisibilityEtiqueta = (Visibility)2; + VisibilityMaisFiltros = (Visibility)2; + VisibilityTarefas = (Visibility)2; + VisibilityEmail = (Visibility)2; + VisibilityExtratos = (Visibility)2; + break; + case 28: + { + VisibilitySintetizar = (Visibility)2; + VisibilityEtiqueta = (Visibility)2; + VisibilityMaisFiltros = (Visibility)2; + VisibilityTarefas = (Visibility)2; + VisibilityEmail = (Visibility)2; + VisibilityExtratos = (Visibility)2; + List list = new List { "VIGÊNCIA INICIAL", "EMISSÃO", "TRANSMISSÃO PROPOSTA", "DATA DE CADASTRO" }; + Referencias = new ObservableCollection(list); + Referencia = Referencias.First(); + VisibilityReferencia = (Visibility)0; + VisibilityGridFiltros = (Visibility)0; + PlanilhaVisibility = (Visibility)0; + break; + } + case 27: + VisibilitySintetizar = (Visibility)2; + VisibilityEtiqueta = (Visibility)2; + VisibilityMaisFiltros = (Visibility)2; + VisibilityTarefas = (Visibility)2; + VisibilityEmail = (Visibility)2; + VisibilityExtratos = (Visibility)2; + break; + case 29: + VisibilityExtratos = (Visibility)2; + VisibilitySintetizar = (Visibility)2; + VisibilityAgrupamento = (Visibility)2; + VisibilityData = (Visibility)2; + VisibilitySintetizar = (Visibility)2; + VisibilityMaisFiltros = (Visibility)2; + VisibilityFiltros = (Visibility)2; + VisibilityCompleto = (Visibility)2; + InfoVisibility = (Visibility)2; + Info = ""; + break; + case 21: + case 22: + break; + } + } + + public void SintetizarRelatorio() + { + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Unknown result type (might be due to invalid IL or missing references) + //IL_0013: Unknown result type (might be due to invalid IL or missing references) + //IL_0092: Expected I4, but got Unknown + //IL_0eb6: Unknown result type (might be due to invalid IL or missing references) + //IL_0ebb: Unknown result type (might be due to invalid IL or missing references) + //IL_0ecd: Unknown result type (might be due to invalid IL or missing references) + //IL_1420: Unknown result type (might be due to invalid IL or missing references) + //IL_1425: Unknown result type (might be due to invalid IL or missing references) + //IL_1122: Unknown result type (might be due to invalid IL or missing references) + //IL_1127: Unknown result type (might be due to invalid IL or missing references) + //IL_18a3: Unknown result type (might be due to invalid IL or missing references) + //IL_18a8: Unknown result type (might be due to invalid IL or missing references) + //IL_1bde: Unknown result type (might be due to invalid IL or missing references) + //IL_1be3: Unknown result type (might be due to invalid IL or missing references) + //IL_0d51: Unknown result type (might be due to invalid IL or missing references) + //IL_0d56: Unknown result type (might be due to invalid IL or missing references) + //IL_0700: Unknown result type (might be due to invalid IL or missing references) + //IL_0705: Unknown result type (might be due to invalid IL or missing references) + //IL_0a5f: Unknown result type (might be due to invalid IL or missing references) + //IL_0a64: Unknown result type (might be due to invalid IL or missing references) + //IL_044b: Unknown result type (might be due to invalid IL or missing references) + //IL_0450: Unknown result type (might be due to invalid IL or missing references) + //IL_0652: Unknown result type (might be due to invalid IL or missing references) + //IL_0657: Unknown result type (might be due to invalid IL or missing references) + //IL_066e: Expected O, but got Unknown + //IL_0350: Unknown result type (might be due to invalid IL or missing references) + //IL_0355: Unknown result type (might be due to invalid IL or missing references) + //IL_0255: Unknown result type (might be due to invalid IL or missing references) + //IL_025a: Unknown result type (might be due to invalid IL or missing references) + //IL_0fc6: Unknown result type (might be due to invalid IL or missing references) + //IL_0fcb: Unknown result type (might be due to invalid IL or missing references) + //IL_0fe2: Expected O, but got Unknown + //IL_1074: Unknown result type (might be due to invalid IL or missing references) + //IL_1079: Unknown result type (might be due to invalid IL or missing references) + //IL_1090: Expected O, but got Unknown + //IL_0119: Unknown result type (might be due to invalid IL or missing references) + //IL_011e: Unknown result type (might be due to invalid IL or missing references) + //IL_1e6f: Unknown result type (might be due to invalid IL or missing references) + //IL_1e74: Unknown result type (might be due to invalid IL or missing references) + //IL_1e8f: Expected O, but got Unknown + //IL_0efe: Unknown result type (might be due to invalid IL or missing references) + //IL_1456: Unknown result type (might be due to invalid IL or missing references) + //IL_1158: Unknown result type (might be due to invalid IL or missing references) + //IL_18d9: Unknown result type (might be due to invalid IL or missing references) + //IL_1c14: Unknown result type (might be due to invalid IL or missing references) + //IL_0d87: Unknown result type (might be due to invalid IL or missing references) + //IL_0736: Unknown result type (might be due to invalid IL or missing references) + //IL_0a95: Unknown result type (might be due to invalid IL or missing references) + //IL_048a: Unknown result type (might be due to invalid IL or missing references) + //IL_0385: Unknown result type (might be due to invalid IL or missing references) + //IL_028a: Unknown result type (might be due to invalid IL or missing references) + //IL_014e: Unknown result type (might be due to invalid IL or missing references) + //IL_0f34: Expected O, but got Unknown + //IL_1487: Unknown result type (might be due to invalid IL or missing references) + //IL_1189: Unknown result type (might be due to invalid IL or missing references) + //IL_190a: Unknown result type (might be due to invalid IL or missing references) + //IL_1c45: Unknown result type (might be due to invalid IL or missing references) + //IL_0767: Unknown result type (might be due to invalid IL or missing references) + //IL_0ac6: Unknown result type (might be due to invalid IL or missing references) + //IL_04ba: Unknown result type (might be due to invalid IL or missing references) + //IL_03ba: Expected O, but got Unknown + //IL_02bf: Expected O, but got Unknown + //IL_017e: Unknown result type (might be due to invalid IL or missing references) + //IL_0ddc: Unknown result type (might be due to invalid IL or missing references) + //IL_0dee: Unknown result type (might be due to invalid IL or missing references) + //IL_0798: Unknown result type (might be due to invalid IL or missing references) + //IL_0af7: Unknown result type (might be due to invalid IL or missing references) + //IL_04ea: Unknown result type (might be due to invalid IL or missing references) + //IL_01ae: Unknown result type (might be due to invalid IL or missing references) + //IL_01c4: Expected O, but got Unknown + //IL_0e24: Expected O, but got Unknown + //IL_0b28: Unknown result type (might be due to invalid IL or missing references) + //IL_051a: Unknown result type (might be due to invalid IL or missing references) + //IL_1522: Unknown result type (might be due to invalid IL or missing references) + //IL_1220: Unknown result type (might be due to invalid IL or missing references) + //IL_19aa: Unknown result type (might be due to invalid IL or missing references) + //IL_1ccc: Unknown result type (might be due to invalid IL or missing references) + //IL_0b59: Unknown result type (might be due to invalid IL or missing references) + //IL_054a: Unknown result type (might be due to invalid IL or missing references) + //IL_1251: Unknown result type (might be due to invalid IL or missing references) + //IL_082e: Unknown result type (might be due to invalid IL or missing references) + //IL_057a: Unknown result type (might be due to invalid IL or missing references) + //IL_1282: Unknown result type (might be due to invalid IL or missing references) + //IL_19ff: Unknown result type (might be due to invalid IL or missing references) + //IL_1d21: Unknown result type (might be due to invalid IL or missing references) + //IL_085f: Unknown result type (might be due to invalid IL or missing references) + //IL_0bae: Unknown result type (might be due to invalid IL or missing references) + //IL_05aa: Unknown result type (might be due to invalid IL or missing references) + //IL_05c0: Expected O, but got Unknown + //IL_15b8: Unknown result type (might be due to invalid IL or missing references) + //IL_12b3: Unknown result type (might be due to invalid IL or missing references) + //IL_1a30: Unknown result type (might be due to invalid IL or missing references) + //IL_0890: Unknown result type (might be due to invalid IL or missing references) + //IL_0bdf: Unknown result type (might be due to invalid IL or missing references) + //IL_15e9: Unknown result type (might be due to invalid IL or missing references) + //IL_12e4: Unknown result type (might be due to invalid IL or missing references) + //IL_1a61: Unknown result type (might be due to invalid IL or missing references) + //IL_1d76: Unknown result type (might be due to invalid IL or missing references) + //IL_08c1: Unknown result type (might be due to invalid IL or missing references) + //IL_0c10: Unknown result type (might be due to invalid IL or missing references) + //IL_1315: Unknown result type (might be due to invalid IL or missing references) + //IL_1a92: Unknown result type (might be due to invalid IL or missing references) + //IL_1da7: Unknown result type (might be due to invalid IL or missing references) + //IL_08f2: Unknown result type (might be due to invalid IL or missing references) + //IL_0c41: Unknown result type (might be due to invalid IL or missing references) + //IL_0c58: Unknown result type (might be due to invalid IL or missing references) + //IL_163e: Unknown result type (might be due to invalid IL or missing references) + //IL_1661: Unknown result type (might be due to invalid IL or missing references) + //IL_1684: Unknown result type (might be due to invalid IL or missing references) + //IL_16a7: Unknown result type (might be due to invalid IL or missing references) + //IL_16ca: Unknown result type (might be due to invalid IL or missing references) + //IL_1346: Unknown result type (might be due to invalid IL or missing references) + //IL_1ac3: Unknown result type (might be due to invalid IL or missing references) + //IL_1ad3: Unknown result type (might be due to invalid IL or missing references) + //IL_1ddd: Expected O, but got Unknown + //IL_0923: Unknown result type (might be due to invalid IL or missing references) + //IL_0c89: Unknown result type (might be due to invalid IL or missing references) + //IL_1377: Unknown result type (might be due to invalid IL or missing references) + //IL_138e: Expected O, but got Unknown + //IL_1b04: Unknown result type (might be due to invalid IL or missing references) + //IL_0954: Unknown result type (might be due to invalid IL or missing references) + //IL_0cbf: Expected O, but got Unknown + //IL_171f: Unknown result type (might be due to invalid IL or missing references) + //IL_1b35: Unknown result type (might be due to invalid IL or missing references) + //IL_1b4c: Expected O, but got Unknown + //IL_0985: Unknown result type (might be due to invalid IL or missing references) + //IL_09b6: Unknown result type (might be due to invalid IL or missing references) + //IL_09cd: Expected O, but got Unknown + //IL_1774: Unknown result type (might be due to invalid IL or missing references) + //IL_17c9: Unknown result type (might be due to invalid IL or missing references) + //IL_17db: Unknown result type (might be due to invalid IL or missing references) + //IL_1811: Expected O, but got Unknown + SinteticoRelatorio = new ObservableCollection(); + Relatorio relatorio = Relatorio; + switch ((int)relatorio) + { + case 19: + if (NotaFiscalFiltrado != null && NotaFiscalFiltrado.Count != 0) + { + List list9 = (NotaFiscalFiltrado.Any((NotaFiscalRelatorio x) => x.Selecionado) ? NotaFiscalFiltrado.Where((NotaFiscalRelatorio x) => x.Selecionado).ToList() : NotaFiscalFiltrado.ToList()); + SinteticoRelatorio = new ObservableCollection(new List + { + new Sintetico + { + PremioLiquido = list9.Sum((NotaFiscalRelatorio p) => p.Liquido), + Iss = list9.Sum((NotaFiscalRelatorio p) => p.Iss), + PremioTotal = list9.Sum((NotaFiscalRelatorio x) => x.Bruto), + TotalGeral = list9.Count + } + }); + } + break; + case 15: + if (MetaVendedorFiltrado != null && MetaVendedorFiltrado.Count != 0) + { + List source = (MetaVendedorFiltrado.Any((MetaVendedorRelatorio x) => x.Selecionado) ? MetaVendedorFiltrado.Where((MetaVendedorRelatorio x) => x.Selecionado).ToList() : MetaVendedorFiltrado.ToList()); + SinteticoRelatorio = new ObservableCollection(new List + { + new Sintetico + { + MetaAtingir = source.Sum((MetaVendedorRelatorio x) => x.MetaAtingir), + MetaCumprida = source.Sum((MetaVendedorRelatorio p) => p.MetaCumprida) + } + }); + } + break; + case 14: + if (MetaSeguradoraFiltrado != null && MetaSeguradoraFiltrado.Count != 0) + { + List source4 = (MetaSeguradoraFiltrado.Any((MetaSeguradoraRelatorio x) => x.Selecionado) ? MetaSeguradoraFiltrado.Where((MetaSeguradoraRelatorio x) => x.Selecionado).ToList() : MetaSeguradoraFiltrado.ToList()); + SinteticoRelatorio = new ObservableCollection(new List + { + new Sintetico + { + MetaAtingir = source4.Sum((MetaSeguradoraRelatorio x) => x.MetaAtingir), + MetaCumprida = source4.Sum((MetaSeguradoraRelatorio p) => p.MetaCumprida) + } + }); + } + break; + case 12: + if (FaturaPendenteFiltrado != null && FaturaPendenteFiltrado.Count != 0) + { + List list8 = (FaturaPendenteFiltrado.Any((FaturaPendente x) => x.Selecionado) ? FaturaPendenteFiltrado.Where((FaturaPendente x) => x.Selecionado).ToList() : FaturaPendenteFiltrado.ToList()); + SinteticoRelatorio = new ObservableCollection(new List + { + new Sintetico + { + TotalClientes = list8.Select((FaturaPendente x) => x.Cliente).Distinct().Count(), + Cancelamentos = list8.Count((FaturaPendente c) => (int)c.Documento.Situacao == 3), + Novos = list8.Count((FaturaPendente c) => (int)c.Documento.Situacao == 1 || ((int)c.Documento.Situacao == 2 && (int)c.Documento.Negocio.GetValueOrDefault() == 2)), + Renovacoes = list8.Count((FaturaPendente c) => (int)c.Documento.Situacao == 2 && (int)c.Documento.Negocio.GetValueOrDefault() == 1), + Apolices = list8.Count((FaturaPendente c) => c.Documento.Tipo == 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Endossos = list8.Count((FaturaPendente c) => c.Documento.Tipo != 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Faturas = list8.Count((FaturaPendente c) => (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 2), + TotalGeral = list8.Count + } + }); + } + break; + case 13: + if (ExtratosFiltrado != null && ExtratosFiltrado.Count != 0) + { + List list6 = (ExtratosFiltrado.Any((ExtratoBaixadoRelatorio x) => x.Selecionado) ? ExtratosFiltrado.Where((ExtratoBaixadoRelatorio x) => x.Selecionado).ToList() : ExtratosFiltrado.ToList()); + SinteticoRelatorio = new ObservableCollection(new List + { + new Sintetico + { + TotalGeral = list6.Count + } + }); + } + break; + case 8: + if (AuditoriaFiltrado != null && AuditoriaFiltrado.Count != 0) + { + List list5 = (AuditoriaFiltrado.Any((Auditoria x) => x.Selecionado) ? AuditoriaFiltrado.Where((Auditoria x) => x.Selecionado).ToList() : AuditoriaFiltrado.ToList()); + SinteticoRelatorio = new ObservableCollection(new List + { + new Sintetico + { + PremioTotal = list5.Sum((Auditoria x) => x.PremioTotal), + PremioLiquido = list5.Sum((Auditoria p) => p.PremioLiquido), + ComissaoRecebidaBruta = list5.Sum((Auditoria p) => p.ComissaoRecebida), + MediaComissao = (list5.Any((Auditoria c) => c.Comissao > 0m) ? decimal.Round(list5.Sum((Auditoria c) => c.Comissao) / (decimal)list5.Count((Auditoria c) => c.Comissao > 0m), 2) : 0m), + ComissaoPrevista = list5.Sum((Auditoria c) => c.ComissaoPrevista), + ComissaoPendente = list5.Sum((Auditoria c) => c.ComissaoPendente), + Cancelamentos = list5.Count((Auditoria c) => (int)c.Documento.Situacao == 3), + Novos = list5.Count((Auditoria c) => (int)c.Documento.Situacao == 1 || ((int)c.Documento.Situacao == 2 && (int)c.Documento.Negocio.GetValueOrDefault() == 2)), + Renovacoes = list5.Count((Auditoria c) => (int)c.Documento.Situacao == 2 && (int)c.Documento.Negocio.GetValueOrDefault() == 1), + Apolices = list5.Count((Auditoria c) => c.Tipo == 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Endossos = list5.Count((Auditoria c) => c.Tipo != 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Faturas = list5.Count((Auditoria c) => (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 2), + TotalGeral = list5.Count + } + }); + } + break; + case 9: + case 10: + if (SinistroFiltrado != null && SinistroFiltrado.Count != 0) + { + List source3 = (SinistroFiltrado.Any((Sinistro x) => x.Selecionado) ? SinistroFiltrado.Where((Sinistro x) => x.Selecionado).ToList() : SinistroFiltrado.ToList()); + SinteticoRelatorio = new ObservableCollection(new List + { + new Sintetico + { + Liquidado = source3.Count((Sinistro x) => (int)x.StatusSinistro == 2 && (int)x.TipoSinistro == 0), + Valor = source3.Sum((Sinistro x) => x.Valor), + ValorOrcado = source3.Sum((Sinistro x) => x.ValorOrcado), + ValorLiberado = source3.Sum((Sinistro x) => x.ValorLiberado), + ValorPago = source3.Sum((Sinistro x) => x.ValorPago), + ValorLiquidado = source3.Where((Sinistro x) => (int)x.StatusSinistro == 2).Sum((Sinistro x) => x.ValorPago), + ValorSalvado = source3.Sum((Sinistro x) => x.ValorSalvado), + ValorFranquia = source3.Sum((Sinistro x) => x.ValorFranquia), + Pendente = source3.Count((Sinistro x) => !x.Liquidacao.HasValue), + TotalGeral = source3.Distinct().Count(), + TotalClientes = source3.Count((Sinistro x) => (int)x.TipoSinistro == 0), + TotalTerceiros = source3.Count((Sinistro x) => (int)x.TipoSinistro == 1) + } + }); + } + break; + case 6: + case 16: + if (PendenteFiltrado != null && PendenteFiltrado.Count != 0) + { + List list4 = (PendenteFiltrado.Any((Pendente x) => x.Selecionado) ? PendenteFiltrado.Where((Pendente x) => x.Selecionado).ToList() : PendenteFiltrado.ToList()); + SinteticoRelatorio = new ObservableCollection(new List + { + new Sintetico + { + ComissaoPrevista = list4.Sum((Pendente x) => x.ComissaoPrevista), + TotalPrevista = Funcoes.DistinctBy(list4, (Pendente x) => ((DomainBase)x.Documento).Id).Sum((Pendente x) => x.TotalPrevisto), + TotalGeral = list4.Count, + TotalParcela = list4.Sum((Pendente x) => x.ValorParcela) + } + }); + } + break; + case 0: + case 1: + if (ClientesAtivosInativosFiltrado != null && ClientesAtivosInativosFiltrado.Count != 0) + { + List list11 = (ClientesAtivosInativosFiltrado.Any((ClientesAtivosInativos x) => x.Selecionado) ? ClientesAtivosInativosFiltrado.Where((ClientesAtivosInativos x) => x.Selecionado).ToList() : ClientesAtivosInativosFiltrado.ToList()); + SinteticoRelatorio = new ObservableCollection(new List + { + new Sintetico + { + TotalClientes = list11.Count, + TotalClientesAtivos = list11.Count((ClientesAtivosInativos x) => x.Ativo == "SIM"), + TotalClientesInativos = list11.Count((ClientesAtivosInativos x) => x.Ativo == "NÃO") + } + }); + } + break; + case 17: + if (LicenciamentoFiltrado != null && LicenciamentoFiltrado.Count != 0) + { + List list2 = (LicenciamentoFiltrado.Any((Licenciamento x) => x.Selecionado) ? LicenciamentoFiltrado.Where((Licenciamento x) => x.Selecionado).ToList() : LicenciamentoFiltrado.ToList()); + SinteticoRelatorio = new ObservableCollection(new List + { + new Sintetico + { + TotalClientes = list2.Count + } + }); + } + break; + case 18: + if (TarefaFiltrado != null && TarefaFiltrado.Count != 0) + { + List list7 = (TarefaFiltrado.Any((Tarefa x) => x.Selecionado) ? TarefaFiltrado.Where((Tarefa x) => x.Selecionado).ToList() : TarefaFiltrado.ToList()); + SinteticoRelatorio = new ObservableCollection(new List + { + new Sintetico + { + TotalTarefas = list7.Count + } + }); + } + break; + case 3: + if (ApolicePendenteFiltrado != null && ApolicePendenteFiltrado.Count != 0) + { + List list = (ApolicePendenteFiltrado.Any((ApolicePendente x) => x.Selecionado) ? ApolicePendenteFiltrado.Where((ApolicePendente x) => x.Selecionado).ToList() : ApolicePendenteFiltrado.ToList()); + SinteticoRelatorio = new ObservableCollection(new List + { + new Sintetico + { + PremioTotal = list.Sum((ApolicePendente x) => x.PremioTotal), + PremioLiquido = list.Sum((ApolicePendente p) => p.PremioLiquido), + MediaComissao = ((list.Count((ApolicePendente c) => c.Comissao > 0m) > 0) ? decimal.Round(list.Sum((ApolicePendente c) => c.Comissao) / (decimal)list.Count((ApolicePendente c) => c.Comissao > 0m), 2) : 0m), + ComissaoGerada = list.Sum((ApolicePendente c) => (c.PremioLiquido + (c.Documento.AdicionalComiss ? c.Documento.PremioAdicional : 0m)) * c.Comissao * 0.01m), + Cancelamentos = list.Count((ApolicePendente c) => (int)c.Documento.Situacao == 3), + Novos = list.Count((ApolicePendente c) => (int)c.Documento.Situacao == 1 || ((int)c.Documento.Situacao == 2 && (int)c.Documento.Negocio.GetValueOrDefault() == 2)), + Renovacoes = list.Count((ApolicePendente c) => (int)c.Documento.Situacao == 2 && (int)c.Documento.Negocio.GetValueOrDefault() == 1), + Apolices = list.Count((ApolicePendente c) => c.Tipo == 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Endossos = list.Count((ApolicePendente c) => c.Tipo != 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Faturas = list.Count((ApolicePendente c) => (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 2), + TotalGeral = list.Count + } + }); + } + break; + case 2: + if (ProducaoFiltrado != null && ProducaoFiltrado.Count != 0) + { + List list10 = (ProducaoFiltrado.Any((Producao x) => x.Selecionado) ? ProducaoFiltrado.Where((Producao x) => x.Selecionado).ToList() : ProducaoFiltrado.ToList()); + SinteticoRelatorio = new ObservableCollection(new List + { + new Sintetico + { + PremioTotal = list10.Sum((Producao x) => x.PremioTotal), + PremioLiquido = list10.Sum((Producao p) => p.PremioLiquido), + MediaPonderada = ((list10.Sum((Producao p) => p.PremioLiquido) > 0m) ? decimal.Round(list10.Sum((Producao c) => (c.PremioLiquido + (c.Documento.AdicionalComiss ? c.Documento.PremioAdicional : 0m)) * c.Comissao) / list10.Sum((Producao p) => p.PremioLiquido), 2) : 0m), + MediaComissao = (list10.Any((Producao c) => c.Comissao > 0m) ? decimal.Round(list10.Sum((Producao c) => c.Comissao) / (decimal)list10.Count((Producao c) => c.Comissao > 0m), 2) : 0m), + ComissaoGerada = list10.Sum((Producao c) => (c.PremioLiquido + (c.Documento.AdicionalComiss ? c.Documento.PremioAdicional : 0m)) * c.Comissao * 0.01m), + Cancelamentos = Funcoes.DistinctBy(list10, (Producao x) => ((DomainBase)x.Documento.Controle).Id).Count((Producao c) => (int)c.Documento.Situacao == 3), + Novos = Funcoes.DistinctBy(list10, funcProducaoDistinctByDocumentoId).Count(funcProducaoNegociosNovos), + NegociosProprios = Funcoes.DistinctBy(list10, funcProducaoDistinctByDocumentoId).Count(funcProducaoNegociosProprios), + SegurosNovos = Funcoes.DistinctBy(list10, funcProducaoDistinctByDocumentoId).Count(funcProducaoSegurosNovos), + Renovacoes = Funcoes.DistinctBy(list10, funcProducaoDistinctByDocumentoId).Count(funcProducaoSegurosRenovacao), + Apolices = Funcoes.DistinctBy(list10, (Producao x) => ((DomainBase)x.Documento).Id).Count((Producao c) => c.Tipo == 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Endossos = Funcoes.DistinctBy(list10, (Producao x) => ((DomainBase)x.Documento).Id).Count((Producao c) => c.Tipo != 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Faturas = Funcoes.DistinctBy(list10, (Producao x) => ((DomainBase)x.Documento).Id).Count((Producao c) => (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 2), + TotalGeral = list10.Count, + TotalLiquido = list10.Count((Producao c) => (int)c.Documento.Situacao != 3) + } + }); + } + break; + case 4: + if (RenovacaoFiltrado != null && RenovacaoFiltrado.Count != 0) + { + List list3 = (RenovacaoFiltrado.Any((Renovacao x) => x.Selecionado) ? RenovacaoFiltrado.Where((Renovacao x) => x.Selecionado).ToList() : RenovacaoFiltrado.ToList()); + SinteticoRelatorio = new ObservableCollection(new List + { + new Sintetico + { + PremioTotal = list3.Sum((Renovacao x) => x.PremioTotal), + PremioLiquido = list3.Sum((Renovacao p) => p.PremioLiquido), + MediaComissao = ((list3.Sum((Renovacao c) => c.Comissao) > 0m) ? decimal.Round(list3.Sum((Renovacao c) => c.Comissao) / (decimal)list3.Count((Renovacao c) => c.Comissao > 0m), 2) : 0m), + ComissaoGerada = list3.Where((Renovacao x) => x.Tipo != 3 && x.Comissao > 0m).Sum((Renovacao c) => (c.PremioLiquido + (c.Documento.AdicionalComiss ? c.Documento.PremioAdicional : 0m)) * c.Comissao * 0.01m), + Cancelamentos = list3.Count((Renovacao c) => c.Tipo != 3 && (int)c.Documento.Situacao == 3), + Novos = list3.Count((Renovacao c) => (c.Tipo != 3 && (int)c.Documento.Situacao == 1) || (c.Tipo != 3 && (int)c.Documento.Situacao == 2 && (int)c.Documento.Negocio.GetValueOrDefault() == 2)), + Renovacoes = list3.Count((Renovacao c) => c.Tipo != 3 && (int)c.Documento.Situacao == 2 && (int)c.Documento.Negocio.GetValueOrDefault() == 1), + Apolices = list3.Count((Renovacao c) => c.Tipo != 3 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Endossos = null, + Faturas = list3.Count((Renovacao c) => c.Tipo != 3 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 2), + TotalProspeccao = list3.Count((Renovacao c) => c.Tipo == 3), + TotalGeral = list3.Count + } + }); + } + break; + case 5: + if (ComissaoFiltrado != null && ComissaoFiltrado.Count != 0) + { + List source2 = (ComissaoFiltrado.Any((Comissao x) => x.Selecionado) ? ComissaoFiltrado.Where((Comissao x) => x.Selecionado).ToList() : ComissaoFiltrado.ToList()); + SinteticoRelatorio = new ObservableCollection(new List + { + new Sintetico + { + ComissaoRecebidaBruta = source2.Sum((Comissao x) => x.ComissaoBruta), + ComissaoRecebidaLiquida = source2.Sum((Comissao x) => x.ComissaoRecebida), + Impostos = source2.Sum((Comissao x) => x.Ir) + source2.Sum((Comissao x) => x.Iss) + source2.Sum((Comissao x) => x.Outros), + PremioLiquido = Funcoes.DistinctBy(source2, (Comissao x) => ((DomainBase)x.Documento).Id).Sum((Comissao x) => x.PremioLiquido), + PremioTotal = Funcoes.DistinctBy(source2, (Comissao x) => ((DomainBase)x.Documento).Id).Sum((Comissao x) => x.PremioTotal), + ComissaoPrevista = source2.Sum((Comissao x) => x.ValorLiquido), + Repasse = source2.Sum((Comissao x) => x.Repasse) + } + }); + } + break; + case 29: + if (ClassificacaoFiltrado == null || ClassificacaoFiltrado.Count == 0) + { + break; + } + if (!ClassificacaoFiltrado.Any((Classificacao x) => x.Selecionado)) + { + ClassificacaoFiltrado.ToList(); + } + else + { + ClassificacaoFiltrado.Where((Classificacao x) => x.Selecionado).ToList(); + } + SinteticoRelatorio = new ObservableCollection(new List + { + new Sintetico + { + TotalClientes = ClassificacaoFiltrado.Count() + } + }); + break; + case 7: + case 11: + case 20: + case 21: + case 22: + case 23: + case 24: + case 25: + case 26: + case 27: + case 28: + break; + } + } + + public async Task GerarRelatorio(DateTime? inicio, DateTime? fim) + { + ErroRelatorio = "NÃO HÁ DADOS NO PERÍODO E FILTROS SELECIONADOS."; + ColunasOcultas = new List(); + FiltroPersonalizadoSelecionado = null; + VisibilityFiltroPersonalizado = (Visibility)0; + RamosSelecionados = null; + RamoSelecionado = null; + ReciboPagamento = false; + VisibilityUsuarios = false; + List seguradoras = ((FiltroRelatorioSelecionado != null) ? (from x in FiltroRelatorioSelecionado + where (int)x.Tipo == 0 + select x.Id).ToList() : new List()); + List ramos = ((FiltroRelatorioSelecionado != null) ? (from x in FiltroRelatorioSelecionado + where (int)x.Tipo == 1 + select x.Id).ToList() : new List()); + List vendedores = ((FiltroRelatorioSelecionado != null) ? (from x in FiltroRelatorioSelecionado + where (int)x.Tipo == 2 + select x.Id).ToList() : new List()); + List tipoVendedor = ((FiltroRelatorioSelecionado != null) ? (from x in FiltroRelatorioSelecionado + where (int)x.Tipo == 6 + select x.Id).ToList() : new List()); + List estipulantes = ((FiltroRelatorioSelecionado != null) ? (from x in FiltroRelatorioSelecionado + where (int)x.Tipo == 3 + select x.Id).ToList() : new List()); + List produtos = ((FiltroRelatorioSelecionado != null) ? (from x in FiltroRelatorioSelecionado + where (int)x.Tipo == 4 + select x.Id).ToList() : new List()); + List status = ((FiltroRelatorioSelecionado != null) ? (from x in FiltroRelatorioSelecionado + where (int)x.Tipo == 5 + select x.Id).ToList() : new List()); + List negocios = ((FiltroRelatorioSelecionado != null) ? (from x in FiltroRelatorioSelecionado + where (int)x.Tipo == 7 + select x.Id).ToList() : new List()); + List usuarios = (UsuariosFiltrados.Any((Usuario x) => x.Selecionado) ? (from x in UsuariosFiltrados + where x.Selecionado + select ((DomainBase)x).Id).ToList() : new List()); + List list = await VerificaVinculoVendedor(Recursos.Usuario); + List vinculoVendedores = new List(); + list.ForEach(delegate(VendedorUsuario v) + { + vinculoVendedores.Add(((DomainBase)v.Vendedor).Id); + }); + if (vendedores.Count == 0 && list.Count > 0) + { + list.ForEach(delegate(VendedorUsuario x) + { + vendedores.Add(((DomainBase)x.Vendedor).Id); + }); + } + RelatorioViewModel relatorioViewModel = this; + Filtros val = new Filtros + { + Inicio = (inicio ?? Inicio), + Fim = (fim ?? Fim), + ValorInicio = InicioValor, + ValorFim = FimValor, + Status = status, + Seguradoras = seguradoras, + Ramos = ramos, + Estipulantes = estipulantes, + Produtos = produtos, + Vendedores = vendedores, + VinculoVendedores = vinculoVendedores, + TipoVendedor = tipoVendedor, + Negocio = negocios, + Referencia = Referencia + }; + Empresa empresa2 = Empresa; + val.IdEmpresa = ((empresa2 != null) ? ((DomainBase)empresa2).Id : Recursos.Usuario.IdEmpresa); + val.Usuarios = usuarios; + relatorioViewModel.Filtros = val; + bool nomeSeguradora = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 44); + try + { + DateTime today = Funcoes.GetNetworkTime().Date; + Relatorio relatorio = Relatorio; + Mes selectedMes; + switch ((int)relatorio) + { + case 0: + case 1: + { + RelatorioFiltroPersonalizado = Funcoes.PopularFiltroPersonalizado(); + List list23; + if ((int)Relatorio == 0) + { + List list22 = ((list.Count <= 0) ? (await _clienteServico.BuscarClientesAtvosInativos(Completo)).ToList() : (await _clienteServico.BuscarClientesAtvosInativosVinculo(Completo, list)).ToList()); + list23 = list22; + } + else + { + List list22 = ((list.Count <= 0) ? (await _clienteServico.BuscarAniversariantes(Filtros)) : (await _clienteServico.BuscarAniversariantesVinculo(Filtros, list))); + list23 = list22; + } + List list24 = list23; + if (list24.Count == 0) + { + ExtratosEnabled = false; + return false; + } + ClientesAtivosInativos = list24; + ClientesAtivosInativosFiltrado = new ObservableCollection(ClientesAtivosInativos); + break; + } + case 17: + { + RelatorioFiltroPersonalizado = Funcoes.PopularFiltroPersonalizado(); + List licenciamentos = await _apoliceServico.BuscarLicenciamentos(Filtros); + if (licenciamentos.Count == 0) + { + ExtratosEnabled = false; + return false; + } + List analiticoLicenciamento = new List(); + licenciamentos.SelectMany((Documento x) => x.ItensAtivo).ToList().ForEach(delegate(Item i) + { + //IL_002b: Unknown result type (might be due to invalid IL or missing references) + //IL_0030: Unknown result type (might be due to invalid IL or missing references) + //IL_0046: Unknown result type (might be due to invalid IL or missing references) + //IL_006c: Unknown result type (might be due to invalid IL or missing references) + //IL_00b0: Unknown result type (might be due to invalid IL or missing references) + //IL_00f4: Unknown result type (might be due to invalid IL or missing references) + //IL_011a: Unknown result type (might be due to invalid IL or missing references) + //IL_0139: Unknown result type (might be due to invalid IL or missing references) + //IL_019c: Unknown result type (might be due to invalid IL or missing references) + //IL_01b4: Unknown result type (might be due to invalid IL or missing references) + //IL_01d5: Unknown result type (might be due to invalid IL or missing references) + //IL_022b: Unknown result type (might be due to invalid IL or missing references) + //IL_023c: Unknown result type (might be due to invalid IL or missing references) + //IL_0259: Unknown result type (might be due to invalid IL or missing references) + //IL_02a6: Unknown result type (might be due to invalid IL or missing references) + //IL_02b2: Unknown result type (might be due to invalid IL or missing references) + //IL_02b9: Unknown result type (might be due to invalid IL or missing references) + //IL_02d0: Expected O, but got Unknown + Documento val17 = ((IEnumerable)licenciamentos).FirstOrDefault((Func)((Documento d) => ((DomainBase)d).Id == ((DomainBase)i.Documento).Id)); + if (val17 != null) + { + Licenciamento val18 = new Licenciamento + { + Id = ((DomainBase)val17.Controle.Cliente).Id + }; + Cliente cliente5 = val17.Controle.Cliente; + val18.Cliente = ((cliente5 != null) ? cliente5.Nome : null) ?? ""; + val18.Telefone = string.Join(" | ", val17.Controle.Cliente.Telefones.Select((ClienteTelefone t) => ((TelefoneBase)t).Prefixo + " " + ((TelefoneBase)t).Numero)); + val18.Email = string.Join(" | ", val17.Controle.Cliente.Emails.Select((ClienteEmail t) => ((EmailBase)t).Email)); + Produto produto3 = val17.Controle.Produto; + val18.Produto = ((produto3 != null) ? produto3.Nome : null) ?? ""; + val18.Ramo = val17.Controle.Ramo.Nome ?? ""; + val18.Seguradora = (nomeSeguradora ? val17.Controle.Seguradora.Nome : ((!string.IsNullOrWhiteSpace(val17.Controle.Seguradora.NomeSocial)) ? val17.Controle.Seguradora.NomeSocial : val17.Controle.Seguradora.Nome)); + Vendedor vendedorPrincipal2 = val17.VendedorPrincipal; + val18.Vendedor = ((vendedorPrincipal2 != null) ? vendedorPrincipal2.Nome : null); + Estipulante estipulante2 = val17.Estipulante1; + val18.Estipulante = ((estipulante2 != null) ? estipulante2.Nome : null) ?? ""; + val18.TodosVendedores = ((val17.Vendedores == null || val17.Vendedores.Count == 0) ? "" : string.Join(" | ", val17.Vendedores.Select((Vendedor v) => v.Nome))); + val18.Item = i.Descricao; + Auto auto = i.Auto; + val18.Placa = ((auto != null) ? auto.Placa : null); + Auto auto2 = i.Auto; + object categoria; + if (auto2 != null && auto2.Categoria.HasValue) + { + Auto auto3 = i.Auto; + categoria = ((auto3 != null) ? EnumHelper.GetDescription(auto3.Categoria) : null); + } + else + { + categoria = "AUTOMÓVEL"; + } + val18.Categoria = (string)categoria; + val18.EntidadeItem = i; + val18.Documento = val17; + val18.PastaCliente = val17.Controle.Cliente.Pasta; + Licenciamento item7 = val18; + analiticoLicenciamento.Add(item7); + } + }); + Licenciamento = analiticoLicenciamento.OrderBy((Licenciamento x) => x.Cliente).ToList(); + LicenciamentoFiltrado = new ObservableCollection(Licenciamento); + break; + } + case 27: + { + RelatorioFiltroPersonalizado = Funcoes.PopularFiltroPersonalizado(); + List placas = await _apoliceServico.BuscarPlacas(Filtros); + if (placas.Count == 0) + { + ExtratosEnabled = false; + return false; + } + List analiticoPlaca = new List(); + placas.SelectMany((Documento x) => x.ItensAtivo).ToList().ForEach(delegate(Item i) + { + //IL_002b: Unknown result type (might be due to invalid IL or missing references) + //IL_0030: Unknown result type (might be due to invalid IL or missing references) + //IL_0046: Unknown result type (might be due to invalid IL or missing references) + //IL_006c: Unknown result type (might be due to invalid IL or missing references) + //IL_00b0: Unknown result type (might be due to invalid IL or missing references) + //IL_00f4: Unknown result type (might be due to invalid IL or missing references) + //IL_011a: Unknown result type (might be due to invalid IL or missing references) + //IL_0139: Unknown result type (might be due to invalid IL or missing references) + //IL_019c: Unknown result type (might be due to invalid IL or missing references) + //IL_01b4: Unknown result type (might be due to invalid IL or missing references) + //IL_01d5: Unknown result type (might be due to invalid IL or missing references) + //IL_022b: Unknown result type (might be due to invalid IL or missing references) + //IL_023c: Unknown result type (might be due to invalid IL or missing references) + //IL_0259: Unknown result type (might be due to invalid IL or missing references) + //IL_02a6: Unknown result type (might be due to invalid IL or missing references) + //IL_02b2: Unknown result type (might be due to invalid IL or missing references) + //IL_02b9: Unknown result type (might be due to invalid IL or missing references) + //IL_02d0: Expected O, but got Unknown + Documento val31 = ((IEnumerable)placas).FirstOrDefault((Func)((Documento d) => ((DomainBase)d).Id == ((DomainBase)i.Documento).Id)); + if (val31 != null) + { + Placas val32 = new Placas + { + Id = ((DomainBase)val31.Controle.Cliente).Id + }; + Cliente cliente8 = val31.Controle.Cliente; + val32.Cliente = ((cliente8 != null) ? cliente8.Nome : null) ?? ""; + val32.Telefone = string.Join(" | ", val31.Controle.Cliente.Telefones.Select((ClienteTelefone t) => ((TelefoneBase)t).Prefixo + " " + ((TelefoneBase)t).Numero)); + val32.Email = string.Join(" | ", val31.Controle.Cliente.Emails.Select((ClienteEmail t) => ((EmailBase)t).Email)); + Produto produto7 = val31.Controle.Produto; + val32.Produto = ((produto7 != null) ? produto7.Nome : null) ?? ""; + val32.Ramo = val31.Controle.Ramo.Nome ?? ""; + val32.Seguradora = (nomeSeguradora ? val31.Controle.Seguradora.Nome : ((!string.IsNullOrWhiteSpace(val31.Controle.Seguradora.NomeSocial)) ? val31.Controle.Seguradora.NomeSocial : val31.Controle.Seguradora.Nome)); + Vendedor vendedorPrincipal5 = val31.VendedorPrincipal; + val32.Vendedor = ((vendedorPrincipal5 != null) ? vendedorPrincipal5.Nome : null); + Estipulante estipulante5 = val31.Estipulante1; + val32.Estipulante = ((estipulante5 != null) ? estipulante5.Nome : null) ?? ""; + val32.TodosVendedores = ((val31.Vendedores == null || val31.Vendedores.Count == 0) ? "" : string.Join(" | ", val31.Vendedores.Select((Vendedor v) => v.Nome))); + val32.Item = i.Descricao; + Auto auto4 = i.Auto; + val32.Placa = ((auto4 != null) ? auto4.Placa : null); + Auto auto5 = i.Auto; + object categoria2; + if (auto5 != null && auto5.Categoria.HasValue) + { + Auto auto6 = i.Auto; + categoria2 = ((auto6 != null) ? EnumHelper.GetDescription(auto6.Categoria) : null); + } + else + { + categoria2 = "AUTOMÓVEL"; + } + val32.Categoria = (string)categoria2; + val32.EntidadeItem = i; + val32.Documento = val31; + val32.PastaCliente = val31.Controle.Cliente.Pasta; + Placas item10 = val32; + analiticoPlaca.Add(item10); + } + }); + Placas = analiticoPlaca.OrderBy((Placas x) => x.Cliente).ToList(); + PlacaFiltrado = new ObservableCollection(Placas); + break; + } + case 18: + { + RelatorioFiltroPersonalizado = Funcoes.PopularFiltroPersonalizado(); + List list17 = await _apoliceServico.BuscarTarefas(Filtros); + if (list17.Count == 0) + { + ExtratosEnabled = false; + return false; + } + List analiticoTarefa = new List(); + list17.ForEach(delegate(Tarefa x) + { + if (x != null) + { + analiticoTarefa.Add(x); + } + }); + Tarefa = analiticoTarefa.OrderBy((Tarefa x) => x.Cliente).ToList(); + TarefaFiltrado = new ObservableCollection(Tarefa); + break; + } + case 3: + { + RelatorioFiltroPersonalizado = Funcoes.PopularFiltroPersonalizado(); + List list11 = await _apoliceServico.BuscarApolicesPendentes(Filtros); + if (list11.Count == 0) + { + ExtratosEnabled = false; + return false; + } + List apolicePendente = ((IEnumerable)list11).Select((Func)delegate(Documento x) + { + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Unknown result type (might be due to invalid IL or missing references) + //IL_0076: Unknown result type (might be due to invalid IL or missing references) + //IL_00a1: Unknown result type (might be due to invalid IL or missing references) + //IL_00cc: Unknown result type (might be due to invalid IL or missing references) + //IL_00e6: Unknown result type (might be due to invalid IL or missing references) + //IL_0100: Unknown result type (might be due to invalid IL or missing references) + //IL_0111: Unknown result type (might be due to invalid IL or missing references) + //IL_012c: Unknown result type (might be due to invalid IL or missing references) + //IL_0144: Unknown result type (might be due to invalid IL or missing references) + //IL_0155: Unknown result type (might be due to invalid IL or missing references) + //IL_0166: Unknown result type (might be due to invalid IL or missing references) + //IL_0177: Unknown result type (might be due to invalid IL or missing references) + //IL_0188: Unknown result type (might be due to invalid IL or missing references) + //IL_01b3: Unknown result type (might be due to invalid IL or missing references) + //IL_01d7: Unknown result type (might be due to invalid IL or missing references) + //IL_0249: Unknown result type (might be due to invalid IL or missing references) + //IL_0250: Unknown result type (might be due to invalid IL or missing references) + //IL_0268: Unknown result type (might be due to invalid IL or missing references) + //IL_0285: Unknown result type (might be due to invalid IL or missing references) + //IL_02ab: Unknown result type (might be due to invalid IL or missing references) + //IL_0310: Unknown result type (might be due to invalid IL or missing references) + //IL_0321: Unknown result type (might be due to invalid IL or missing references) + //IL_0347: Unknown result type (might be due to invalid IL or missing references) + //IL_0358: Unknown result type (might be due to invalid IL or missing references) + //IL_036e: Unknown result type (might be due to invalid IL or missing references) + //IL_0396: Unknown result type (might be due to invalid IL or missing references) + //IL_03f9: Unknown result type (might be due to invalid IL or missing references) + //IL_0423: Unknown result type (might be due to invalid IL or missing references) + //IL_042f: Unknown result type (might be due to invalid IL or missing references) + //IL_0455: Unknown result type (might be due to invalid IL or missing references) + //IL_0466: Unknown result type (might be due to invalid IL or missing references) + //IL_0477: Unknown result type (might be due to invalid IL or missing references) + //IL_0488: Unknown result type (might be due to invalid IL or missing references) + //IL_04a4: Expected O, but got Unknown + ApolicePendente val36 = new ApolicePendente + { + Pendencia = ((!((today - x.Vigencia1).TotalDays < 0.0)) ? int.Parse($"{(today - x.Vigencia1).TotalDays:00}") : 0) + }; + Cliente cliente10 = x.Controle.Cliente; + val36.Cliente = ((cliente10 != null) ? cliente10.Nome : null) ?? ""; + Cliente cliente11 = x.Controle.Cliente; + val36.DocumentoCli = ((cliente11 != null) ? cliente11.Documento : null) ?? ""; + val36.Proposta = x.Proposta ?? ""; + val36.PedidoEndosso = x.PropostaEndosso ?? ""; + val36.Comissao = x.Comissao; + Negocio? negocio2 = x.Negocio; + val36.Negocio = (negocio2.HasValue ? EnumHelper.GetDescription(negocio2.GetValueOrDefault()) : null) ?? ""; + val36.PremioLiquido = x.PremioLiquido; + val36.PremioTotal = x.PremioTotal; + val36.VigenciaFinal = x.Vigencia2; + val36.VigenciaInicial = x.Vigencia1; + Produto produto9 = x.Controle.Produto; + val36.Produto = ((produto9 != null) ? produto9.Nome : null) ?? ""; + val36.Ramo = x.Controle.Ramo.Nome ?? ""; + val36.Seguradora = (nomeSeguradora ? x.Controle.Seguradora.Nome : ((!string.IsNullOrWhiteSpace(x.Controle.Seguradora.NomeSocial)) ? x.Controle.Seguradora.NomeSocial : x.Controle.Seguradora.Nome)); + val36.Status = EnumHelper.GetDescription(x.Situacao) ?? ""; + Vendedor vendedorPrincipal8 = x.VendedorPrincipal; + val36.Vendedor = ((vendedorPrincipal8 != null) ? vendedorPrincipal8.Nome : null); + Estipulante estipulante8 = x.Estipulante1; + val36.Estipulante = ((estipulante8 != null) ? estipulante8.Nome : null) ?? ""; + val36.TodosVendedores = ((x.Vendedores == null || x.Vendedores.Count == 0) ? "" : string.Join("; ", x.Vendedores.Select((Vendedor v) => v.Nome))); + val36.DataControle = x.DataControle; + Status status8 = x.Status; + val36.StatusApolice = ((status8 != null) ? status8.Nome : null) ?? ""; + val36.Tipo = x.Tipo; + val36.IdEmpresa = x.Controle.IdEmpresa; + Empresa? obj28 = ((IEnumerable)Recursos.Empresas).FirstOrDefault((Func)((Empresa empresa) => ((DomainBase)empresa).Id == x.Controle.IdEmpresa)); + val36.Empresa = ((obj28 != null) ? obj28.NomeSocial : null); + val36.Item = ((x.ItensAtivo == null) ? "" : ((x.ItensAtivo.Count > 1) ? "APÓLICE COLETIVA" : ((x.ItensAtivo.Count == 1) ? x.ItensAtivo.First().Descricao : ""))); + val36.Vinculo = x.Vinculo != null && x.Vinculo.IdApoliceDigital > 0; + val36.Documento = x; + Banco banco4 = x.Banco; + val36.Banco = ((banco4 != null) ? banco4.Nome : null) ?? ""; + val36.Conta = x.Conta; + val36.Agencia = x.Agencia; + val36.Pasta = x.Pasta; + val36.PastaCliente = x.Controle.Cliente.Pasta; + return val36; + }).ToList(); + ApolicePendente = apolicePendente; + ApolicePendenteFiltrado = new ObservableCollection(ApolicePendente); + break; + } + case 2: + { + bool flag = Filtros.Inicio.AddDays(61.0) < Filtros.Fim; + if (flag) + { + flag = !(await ShowMessage("O RELATÓRIO DE PRODUÇÃO É INDIVIDUALIZADO, PORTANTO DEMORADO, CASO O INTUITO DA GERAÇÃO SEJA OS TOTAIS, OUTRAS OPÇÕES SÃO MAIS RÁPIDAS, COMO O RELATÓRIO DE FECHAMENTO!", "GERAR MESMO ASSIM", "CANCELAR")); + } + if (flag) + { + return false; + } + RelatorioFiltroPersonalizado = Funcoes.PopularFiltroPersonalizado(); + Task> producaoTask = _apoliceServico.BuscarApolices(Filtros, LicenseHelper.Produtos.Any((Licenca x) => (int)x.Produto == 86 && x.Status != 3)); + Task> faturaTask = _parcelaServico.BuscarFaturas(Filtros, LicenseHelper.Produtos.Any((Licenca x) => (int)x.Produto == 86 && x.Status != 3)); + await Task.WhenAll>(producaoTask, faturaTask); + List result = producaoTask.Result; + List result2 = faturaTask.Result; + result.AddRange(result2); + if (result.Count == 0) + { + ExtratosEnabled = false; + return false; + } + bool listarRepasse = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 37); + List producao = ((IEnumerable)result).Select((Func)delegate(Documento x) + { + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Unknown result type (might be due to invalid IL or missing references) + //IL_003d: Unknown result type (might be due to invalid IL or missing references) + //IL_0057: Unknown result type (might be due to invalid IL or missing references) + //IL_0071: Unknown result type (might be due to invalid IL or missing references) + //IL_0090: Unknown result type (might be due to invalid IL or missing references) + //IL_00aa: Unknown result type (might be due to invalid IL or missing references) + //IL_00c4: Unknown result type (might be due to invalid IL or missing references) + //IL_00d5: Unknown result type (might be due to invalid IL or missing references) + //IL_00f0: Unknown result type (might be due to invalid IL or missing references) + //IL_0108: Unknown result type (might be due to invalid IL or missing references) + //IL_0119: Unknown result type (might be due to invalid IL or missing references) + //IL_012a: Unknown result type (might be due to invalid IL or missing references) + //IL_013b: Unknown result type (might be due to invalid IL or missing references) + //IL_014c: Unknown result type (might be due to invalid IL or missing references) + //IL_015d: Unknown result type (might be due to invalid IL or missing references) + //IL_016e: Unknown result type (might be due to invalid IL or missing references) + //IL_017f: Unknown result type (might be due to invalid IL or missing references) + //IL_01aa: Unknown result type (might be due to invalid IL or missing references) + //IL_01ce: Unknown result type (might be due to invalid IL or missing references) + //IL_0245: Unknown result type (might be due to invalid IL or missing references) + //IL_024c: Unknown result type (might be due to invalid IL or missing references) + //IL_0264: Unknown result type (might be due to invalid IL or missing references) + //IL_0281: Unknown result type (might be due to invalid IL or missing references) + //IL_02a5: Unknown result type (might be due to invalid IL or missing references) + //IL_02b6: Unknown result type (might be due to invalid IL or missing references) + //IL_031b: Unknown result type (might be due to invalid IL or missing references) + //IL_0380: Unknown result type (might be due to invalid IL or missing references) + //IL_0391: Unknown result type (might be due to invalid IL or missing references) + //IL_03c5: Unknown result type (might be due to invalid IL or missing references) + //IL_03d6: Unknown result type (might be due to invalid IL or missing references) + //IL_03fc: Unknown result type (might be due to invalid IL or missing references) + //IL_0412: Unknown result type (might be due to invalid IL or missing references) + //IL_043a: Unknown result type (might be due to invalid IL or missing references) + //IL_0446: Unknown result type (might be due to invalid IL or missing references) + //IL_04a9: Unknown result type (might be due to invalid IL or missing references) + //IL_04ba: Unknown result type (might be due to invalid IL or missing references) + //IL_04d9: Unknown result type (might be due to invalid IL or missing references) + //IL_04f8: Unknown result type (might be due to invalid IL or missing references) + //IL_04ff: Unknown result type (might be due to invalid IL or missing references) + //IL_0509: Unknown result type (might be due to invalid IL or missing references) + //IL_051a: Unknown result type (might be due to invalid IL or missing references) + //IL_056e: Unknown result type (might be due to invalid IL or missing references) + //IL_0584: Unknown result type (might be due to invalid IL or missing references) + //IL_0595: Unknown result type (might be due to invalid IL or missing references) + //IL_05bb: Unknown result type (might be due to invalid IL or missing references) + //IL_05cc: Unknown result type (might be due to invalid IL or missing references) + //IL_05dd: Unknown result type (might be due to invalid IL or missing references) + //IL_05f8: Unknown result type (might be due to invalid IL or missing references) + //IL_0613: Unknown result type (might be due to invalid IL or missing references) + //IL_0696: Unknown result type (might be due to invalid IL or missing references) + //IL_0719: Unknown result type (might be due to invalid IL or missing references) + //IL_074a: Expected O, but got Unknown + Producao val29 = new Producao(); + Cliente cliente7 = x.Controle.Cliente; + val29.Cliente = ((cliente7 != null) ? cliente7.Nome : null) ?? ""; + val29.Proposta = x.Proposta ?? ""; + val29.Apolice = x.Apolice ?? ""; + val29.ApoliceConferida = (x.ApoliceConferida ? "SIM" : "NÃO"); + val29.PropostaEndosso = x.PropostaEndosso ?? ""; + val29.Endosso = x.Endosso ?? ""; + val29.Comissao = x.Comissao; + NegocioCorretora? negocioCorretora3 = x.NegocioCorretora; + val29.Negocio = (negocioCorretora3.HasValue ? EnumHelper.GetDescription(negocioCorretora3.GetValueOrDefault()) : null) ?? ""; + val29.PremioLiquido = x.PremioLiquido; + val29.PremioTotal = x.PremioTotal; + val29.NumeroParcelas = x.NumeroParcelas; + val29.Emissao = x.Emissao; + val29.VigenciaFinal = x.Vigencia2; + val29.VigenciaInicial = x.Vigencia1; + val29.Remessa = x.Remessa; + Produto produto6 = x.Controle.Produto; + val29.Produto = ((produto6 != null) ? produto6.Nome : null) ?? ""; + val29.Ramo = x.Controle.Ramo.Nome ?? ""; + val29.Seguradora = (nomeSeguradora ? x.Controle.Seguradora.Nome : ((!string.IsNullOrWhiteSpace(x.Controle.Seguradora.NomeSocial)) ? x.Controle.Seguradora.NomeSocial : x.Controle.Seguradora.Nome)); + val29.Status = EnumHelper.GetDescription(x.Situacao) ?? ""; + Vendedor vendedorPrincipal4 = x.VendedorPrincipal; + val29.Vendedor = ((vendedorPrincipal4 != null) ? vendedorPrincipal4.Nome : null); + val29.RepasseVendedor = ((!listarRepasse) ? null : x.PercentualRepasse); + val29.Estipulante = x.Estipulantes; + val29.TodosVendedores = ((x.Vendedores == null || x.Vendedores.Count == 0) ? "" : string.Join("; ", x.Vendedores.Select((Vendedor v) => v.Nome))); + val29.DescricaoTipoVendedor = ((x.Pagamentos == null || x.Pagamentos.Count == 0) ? "" : string.Join("; ", x.Pagamentos.Select((VendedorParcela v) => v.TipoVendedor.Descricao ?? ""))); + val29.Tipo = x.Tipo; + val29.TipoDocumento = ((x.Tipo == 0) ? "APÓLICE" : ((x.Tipo == 1) ? "ENDOSSO" : "FATURA")); + val29.DataControle = x.DataControle; + Status status5 = x.Status; + val29.StatusApolice = ((status5 != null) ? status5.Nome : null) ?? ""; + val29.IdEmpresa = x.Controle.IdEmpresa; + Empresa? obj19 = ((IEnumerable)Recursos.Empresas).FirstOrDefault((Func)((Empresa empresa) => ((DomainBase)empresa).Id == x.Controle.IdEmpresa)); + val29.Empresa = ((obj19 != null) ? obj19.NomeSocial : null); + val29.Documento = x; + val29.Item = ((x.ItensAtivo == null) ? "" : ((x.ItensAtivo.Count > 1) ? "APÓLICE COLETIVA" : ((x.ItensAtivo.Count == 1) ? x.ItensAtivo.First().Descricao : ""))); + val29.Assinaturas = x.Assinaturas; + val29.AssinadaSiggner = (x.AssinadaSiggner ? "SIM" : "NÃO"); + val29.PropAssinada = (x.PropostaAssinada ? "SIM" : "NÃO"); + val29.StatusAssinatura = x.StatusAssinatura; + val29.Pasta = x.Pasta; + val29.ComissaoGerada = (x.PremioLiquido + (x.AdicionalComiss ? x.PremioAdicional : 0m)) * x.Comissao * 0.01m; + val29.TipoPagamento = EnumHelper.GetDescription(x.TipoRecebimento); + val29.DataCriacao = x.DataCriacao; + Banco banco3 = x.Banco; + val29.Banco = ((banco3 != null) ? banco3.Nome : null) ?? ""; + val29.Conta = x.Conta; + val29.Agencia = x.Agencia; + val29.PastaCliente = x.Controle.Cliente.Pasta; + val29.DocumentoCliente = x.Controle.Cliente.Documento; + val29.Telefones = ((x.Controle.Cliente.Telefones == null || x.Controle.Cliente.Telefones.Count == 0) ? "" : string.Join(" | ", x.Controle.Cliente.Telefones.Select((ClienteTelefone v) => (((TelefoneBase)v).Prefixo + " " + ((TelefoneBase)v).Numero).Trim()))); + val29.Emails = ((x.Controle.Cliente.Emails == null || x.Controle.Cliente.Emails.Count == 0) ? "" : string.Join(" | ", x.Controle.Cliente.Emails.Select((ClienteEmail v) => ((EmailBase)v).Email))); + val29.TipoPessoa = ((x.Controle.Cliente.Documento.Length > 14) ? "PJ" : "PF"); + return val29; + }).ToList(); + Producao = producao; + ProducaoFiltrado = new ObservableCollection(Producao); + break; + } + case 4: + { + RelatorioFiltroPersonalizado = Funcoes.PopularFiltroPersonalizado(); + List analiticoRenovacao = (await _apoliceServico.BuscarApolicesVigenciaFinal(Filtros, Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 31))).Where((Documento documento) => documento.Tipo != 3).Select((Func)delegate(Documento documento) + { + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Unknown result type (might be due to invalid IL or missing references) + //IL_003d: Unknown result type (might be due to invalid IL or missing references) + //IL_0057: Unknown result type (might be due to invalid IL or missing references) + //IL_0068: Unknown result type (might be due to invalid IL or missing references) + //IL_0079: Unknown result type (might be due to invalid IL or missing references) + //IL_0094: Unknown result type (might be due to invalid IL or missing references) + //IL_00ac: Unknown result type (might be due to invalid IL or missing references) + //IL_00bd: Unknown result type (might be due to invalid IL or missing references) + //IL_00e8: Unknown result type (might be due to invalid IL or missing references) + //IL_0113: Unknown result type (might be due to invalid IL or missing references) + //IL_0180: Unknown result type (might be due to invalid IL or missing references) + //IL_0187: Unknown result type (might be due to invalid IL or missing references) + //IL_018d: Invalid comparison between Unknown and I4 + //IL_0195: Unknown result type (might be due to invalid IL or missing references) + //IL_019b: Invalid comparison between Unknown and I4 + //IL_01c2: Unknown result type (might be due to invalid IL or missing references) + //IL_01a3: Unknown result type (might be due to invalid IL or missing references) + //IL_01df: Unknown result type (might be due to invalid IL or missing references) + //IL_020b: Unknown result type (might be due to invalid IL or missing references) + //IL_0237: Unknown result type (might be due to invalid IL or missing references) + //IL_025d: Unknown result type (might be due to invalid IL or missing references) + //IL_02c2: Unknown result type (might be due to invalid IL or missing references) + //IL_02d3: Unknown result type (might be due to invalid IL or missing references) + //IL_02df: Unknown result type (might be due to invalid IL or missing references) + //IL_02f0: Unknown result type (might be due to invalid IL or missing references) + //IL_0353: Unknown result type (might be due to invalid IL or missing references) + //IL_0387: Unknown result type (might be due to invalid IL or missing references) + //IL_03a6: Unknown result type (might be due to invalid IL or missing references) + //IL_03b7: Unknown result type (might be due to invalid IL or missing references) + //IL_03dd: Unknown result type (might be due to invalid IL or missing references) + //IL_03f3: Unknown result type (might be due to invalid IL or missing references) + //IL_0414: Unknown result type (might be due to invalid IL or missing references) + //IL_0449: Unknown result type (might be due to invalid IL or missing references) + //IL_046f: Unknown result type (might be due to invalid IL or missing references) + //IL_0480: Unknown result type (might be due to invalid IL or missing references) + //IL_0491: Unknown result type (might be due to invalid IL or missing references) + //IL_04a2: Unknown result type (might be due to invalid IL or missing references) + //IL_04bd: Unknown result type (might be due to invalid IL or missing references) + //IL_04ce: Unknown result type (might be due to invalid IL or missing references) + //IL_04f9: Unknown result type (might be due to invalid IL or missing references) + //IL_058d: Unknown result type (might be due to invalid IL or missing references) + //IL_05a3: Unknown result type (might be due to invalid IL or missing references) + //IL_05f7: Unknown result type (might be due to invalid IL or missing references) + //IL_0612: Expected O, but got Unknown + Renovacao val16 = new Renovacao(); + Cliente cliente = documento.Controle.Cliente; + val16.Cliente = ((cliente != null) ? cliente.Nome : null) ?? ""; + val16.Apolice = documento.Apolice ?? ""; + val16.PremioLiquido = documento.PremioLiquido; + val16.PremioTotal = documento.PremioTotal; + NegocioCorretora? negocioCorretora = documento.NegocioCorretora; + val16.Negocio = (negocioCorretora.HasValue ? EnumHelper.GetDescription(negocioCorretora.GetValueOrDefault()) : null) ?? ""; + val16.VigenciaFinal = documento.Vigencia2; + Produto produto2 = documento.Controle.Produto; + val16.Produto = ((produto2 != null) ? produto2.Nome : null) ?? ""; + Ramo ramo = documento.Controle.Ramo; + val16.Ramo = ((ramo != null) ? ramo.Nome : null) ?? ""; + val16.Seguradora = (nomeSeguradora ? documento.Controle.Seguradora.Nome : ((!string.IsNullOrWhiteSpace(documento.Controle.Seguradora.NomeSocial)) ? documento.Controle.Seguradora.NomeSocial : documento.Controle.Seguradora.Nome)); + val16.Status = (((int)documento.Situacao == 1 || (int)documento.Situacao == 2) ? "NÃO TRABALHADO" : (EnumHelper.GetDescription(documento.Situacao) ?? "")); + Vendedor vendedorPrincipal = documento.VendedorPrincipal; + val16.Vendedor = ((vendedorPrincipal != null) ? vendedorPrincipal.Nome : null); + Cliente cliente2 = documento.Controle.Cliente; + val16.Telefone = JoinTelefones((cliente2 != null) ? cliente2.Telefones.ToList() : null); + Cliente cliente3 = documento.Controle.Cliente; + val16.Email = JoinEmails((cliente3 != null) ? cliente3.Emails.ToList() : null); + Estipulante estipulante = documento.Estipulante1; + val16.Estipulante = ((estipulante != null) ? estipulante.Nome : null) ?? ""; + val16.TodosVendedores = ((documento.Vendedores == null || documento.Vendedores.Count == 0) ? "" : string.Join("; ", documento.Vendedores.Select((Vendedor v) => v.Nome))); + val16.Tipo = documento.Tipo; + val16.Documento = documento; + val16.Comissao = documento.Comissao; + val16.Item = ((documento.ItensAtivo == null) ? "" : ((documento.ItensAtivo.Count > 1) ? "APÓLICE COLETIVA" : ((documento.ItensAtivo.Count == 1) ? documento.ItensAtivo.First().Descricao : ""))); + val16.TipoDocumento = ((documento.Tipo == 0) ? "APÓLICE" : ((documento.Tipo == 1) ? "ENDOSSO" : "")); + val16.Sinistro = (documento.Sinistro ? "SIM" : "NÃO"); + val16.DataControle = documento.DataControle; + Status status3 = documento.Status; + val16.StatusApolice = ((status3 != null) ? status3.Nome : null) ?? ""; + val16.IdEmpresa = documento.Controle.IdEmpresa; + val16.Empresa = ((IEnumerable)Recursos.Empresas).FirstOrDefault((Func)((Empresa empresa) => ((DomainBase)empresa).Id == documento.Controle.IdEmpresa)).NomeSocial; + val16.QtdSinistro = documento.ItensAtivo.Sum((Item s) => s.Sinistros.Count); + Banco banco = documento.Banco; + val16.Banco = ((banco != null) ? banco.Nome : null) ?? ""; + val16.Conta = documento.Conta; + val16.Agencia = documento.Agencia; + val16.Pasta = documento.Pasta; + val16.PastaCliente = documento.Controle.Cliente.Pasta; + val16.Calculos = documento.Calculos; + Cliente cliente4 = documento.Controle.Cliente; + val16.DocumentoCliente = ((cliente4 != null) ? cliente4.Documento : null) ?? ""; + val16.TipoPessoa = ((documento.Controle.Cliente.Documento == null) ? "" : ((documento.Controle.Cliente.Documento.Length == 11) ? "FÍSICA" : ((documento.Controle.Cliente.Documento.Length == 14 && documento.Controle.Cliente.Documento.Contains(".")) ? "FÍSICA" : "JURÍDICA"))); + val16.TipoPagamento = EnumHelper.GetDescription(documento.TipoRecebimento); + val16.ComissaoGerada = (documento.PremioLiquido + (documento.AdicionalComiss ? documento.PremioAdicional : 0m)) * documento.Comissao * 0.01m; + val16.Endosso = documento.Endosso ?? ""; + return val16; + }).ToList(); + List collection4 = (await new ProspeccaoServico().BuscarProspeccoes(Filtros)).Where((Prospeccao x) => x.Renovacao).Select(delegate(Prospeccao x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Expected O, but got Unknown + //IL_0054: Unknown result type (might be due to invalid IL or missing references) + Renovacao val15 = new Renovacao(); + val15.Cliente = x.Nome ?? ""; + val15.DocumentoCliente = x.Documento; + val15.Apolice = "PROSPECÇÃO"; + val15.VigenciaFinal = x.VigenciaFinal; + StatusProspeccao? status2 = x.Status; + val15.Status = (status2.HasValue ? EnumHelper.GetDescription(status2.GetValueOrDefault()) : null) ?? ""; + Vendedor vendedor = x.Vendedor; + val15.Vendedor = ((vendedor != null) ? vendedor.Nome : null); + Vendedor vendedor2 = x.Vendedor; + val15.TodosVendedores = ((vendedor2 != null) ? vendedor2.Nome : null); + val15.Telefone = x.Prefixo1 + " " + x.Telefone1 + " | " + x.Prefixo2 + " " + x.Telefone2; + val15.Email = x.Email; + val15.Tipo = 3; + val15.TipoDocumento = "PROSPECÇÃO"; + val15.Item = x.Item; + Produto produto = x.Produto; + val15.Produto = ((produto != null) ? produto.Nome : null); + val15.Prospeccao = x; + return val15; + }).ToList(); + analiticoRenovacao.AddRange(collection4); + if (analiticoRenovacao.Count == 0) + { + ExtratosEnabled = false; + return false; + } + Renovacao = analiticoRenovacao.OrderBy((Renovacao x) => x.VigenciaFinal).ToList(); + RenovacaoFiltrado = new ObservableCollection(Renovacao); + break; + } + case 5: + { + RelatorioFiltroPersonalizado = Funcoes.PopularFiltroPersonalizado(); + List list10 = await _parcelaServico.BuscarParcelasRecebimento(Filtros); + if (list10.Count == 0) + { + ExtratosEnabled = false; + return false; + } + List comissao = ((IEnumerable)list10).Select((Func)delegate(Parcela x) + { + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Unknown result type (might be due to invalid IL or missing references) + //IL_001e: Unknown result type (might be due to invalid IL or missing references) + //IL_0047: Unknown result type (might be due to invalid IL or missing references) + //IL_0066: Unknown result type (might be due to invalid IL or missing references) + //IL_0085: Unknown result type (might be due to invalid IL or missing references) + //IL_0091: Unknown result type (might be due to invalid IL or missing references) + //IL_00a9: Unknown result type (might be due to invalid IL or missing references) + //IL_00c9: Unknown result type (might be due to invalid IL or missing references) + //IL_00e1: Unknown result type (might be due to invalid IL or missing references) + //IL_00f7: Unknown result type (might be due to invalid IL or missing references) + //IL_010d: Unknown result type (might be due to invalid IL or missing references) + //IL_0123: Unknown result type (might be due to invalid IL or missing references) + //IL_0139: Unknown result type (might be due to invalid IL or missing references) + //IL_0162: Unknown result type (might be due to invalid IL or missing references) + //IL_0178: Unknown result type (might be due to invalid IL or missing references) + //IL_0189: Unknown result type (might be due to invalid IL or missing references) + //IL_019a: Unknown result type (might be due to invalid IL or missing references) + //IL_022b: Unknown result type (might be due to invalid IL or missing references) + //IL_0244: Unknown result type (might be due to invalid IL or missing references) + //IL_0255: Unknown result type (might be due to invalid IL or missing references) + //IL_0266: Unknown result type (might be due to invalid IL or missing references) + //IL_0277: Unknown result type (might be due to invalid IL or missing references) + //IL_0288: Unknown result type (might be due to invalid IL or missing references) + //IL_029f: Unknown result type (might be due to invalid IL or missing references) + //IL_02b0: Unknown result type (might be due to invalid IL or missing references) + //IL_02c1: Unknown result type (might be due to invalid IL or missing references) + //IL_02d2: Unknown result type (might be due to invalid IL or missing references) + //IL_02e3: Unknown result type (might be due to invalid IL or missing references) + //IL_02fa: Unknown result type (might be due to invalid IL or missing references) + //IL_0387: Unknown result type (might be due to invalid IL or missing references) + //IL_0411: Unknown result type (might be due to invalid IL or missing references) + //IL_0492: Unknown result type (might be due to invalid IL or missing references) + //IL_04c2: Unknown result type (might be due to invalid IL or missing references) + //IL_04ed: Unknown result type (might be due to invalid IL or missing references) + //IL_05c8: Unknown result type (might be due to invalid IL or missing references) + //IL_062d: Unknown result type (might be due to invalid IL or missing references) + //IL_063e: Unknown result type (might be due to invalid IL or missing references) + //IL_0664: Unknown result type (might be due to invalid IL or missing references) + //IL_0696: Unknown result type (might be due to invalid IL or missing references) + //IL_06b1: Unknown result type (might be due to invalid IL or missing references) + //IL_06d2: Unknown result type (might be due to invalid IL or missing references) + //IL_0730: Unknown result type (might be due to invalid IL or missing references) + //IL_0737: Unknown result type (might be due to invalid IL or missing references) + //IL_0741: Unknown result type (might be due to invalid IL or missing references) + //IL_0757: Unknown result type (might be due to invalid IL or missing references) + //IL_0777: Unknown result type (might be due to invalid IL or missing references) + //IL_078c: Unknown result type (might be due to invalid IL or missing references) + //IL_0792: Invalid comparison between Unknown and I4 + //IL_07bf: Expected O, but got Unknown + Comissao val37 = new Comissao + { + ParcelaEntity = x, + Cliente = (x.Documento.Controle.Cliente.Nome ?? ""), + Apolice = (x.Documento.Apolice ?? ""), + Endosso = (x.Documento.Endosso ?? ""), + Status = (EnumHelper.GetDescription(x.Documento.Situacao) ?? "") + }; + NegocioCorretora? negocioCorretora4 = x.Documento.NegocioCorretora; + val37.Negocio = (negocioCorretora4.HasValue ? EnumHelper.GetDescription(negocioCorretora4.GetValueOrDefault()) : null) ?? ""; + val37.VigenciaFinal = x.Documento.Vigencia2; + val37.VigenciaInicial = x.Documento.Vigencia1; + val37.PremioTotal = x.Documento.PremioTotal; + val37.PremioLiquido = x.Documento.PremioLiquido; + val37.Ramo = x.Documento.Controle.Ramo.Nome ?? ""; + val37.ComissaoApolice = x.Documento.Comissao; + val37.ComissaoPerc = x.Comissao; + val37.ValorRealizado = x.ValorRealizado; + val37.ValorComissao = ((x.Documento.Comissao > 0m) ? decimal.Round((x.Documento.PremioLiquido + (x.Documento.AdicionalComiss ? x.Documento.PremioAdicional : 0m)) * x.Documento.Comissao * 0.01m, 2) : 0m); + val37.Parcela = x.NumeroParcela.ToString(); + val37.Recebimento = x.DataRecebimento; + val37.Quitacao = x.DataQuitacao; + val37.Controle = x.DataControle; + val37.Vencimento = x.Vencimento; + val37.ComissaoBruta = decimal.Round(x.ValorComissao, 2); + val37.Ir = x.Irr; + val37.Iss = x.Iss; + val37.Desconto = x.Desconto; + val37.Outros = x.Outros; + val37.ComissaoRecebida = decimal.Round(x.ValorComDesconto, 2); + val37.Repasse = ((x.Vendedores == null || !x.Vendedores.Any()) ? 0m : decimal.Round(x.Vendedores.Where((VendedorParcela v) => v.DataPrePagamento.HasValue).Sum((VendedorParcela y) => y.ValorRepasse).GetValueOrDefault(), 2)); + decimal valorComDesconto = x.ValorComDesconto; + decimal? obj29 = x.Vendedores?.Sum((VendedorParcela y) => y.ValorRepasse); + val37.ValorLiquido = decimal.Round(((decimal?)valorComDesconto - obj29).GetValueOrDefault(), 2); + val37.Seguradora = (nomeSeguradora ? x.Documento.Controle.Seguradora.Nome : ((!string.IsNullOrWhiteSpace(x.Documento.Controle.Seguradora.NomeSocial)) ? x.Documento.Controle.Seguradora.NomeSocial : x.Documento.Controle.Seguradora.Nome)); + Produto produto10 = x.Documento.Controle.Produto; + val37.Produto = ((produto10 != null) ? produto10.Nome : null) ?? ""; + Estipulante estipulante9 = x.Documento.Estipulante1; + val37.Estipulante = ((estipulante9 != null) ? estipulante9.Nome : null) ?? ""; + object obj31; + if (x.Vendedores != null && x.Vendedores.Count != 0) + { + VendedorParcela? obj30 = ((IEnumerable)x.Vendedores).FirstOrDefault((Func)((VendedorParcela v) => ((DomainBase)v.TipoVendedor).Id == 1)); + if (obj30 == null) + { + obj31 = null; + } + else + { + Vendedor vendedor5 = obj30.Vendedor; + obj31 = ((vendedor5 != null) ? vendedor5.Nome : null); + } + if (obj31 == null) + { + Vendedor? obj32 = ((IEnumerable)Recursos.Vendedores).FirstOrDefault((Func)((Vendedor v) => v.Corretora)); + obj31 = ((obj32 != null) ? obj32.Nome : null); + } + } + else + { + IEnumerable enumerable = Recursos.Vendedores.Where((Vendedor v) => v.Ativo && v.Corretora && v.IdEmpresa == x.IdEmpresa); + if (enumerable == null) + { + obj31 = null; + } + else + { + Vendedor? obj33 = enumerable.FirstOrDefault(); + obj31 = ((obj33 != null) ? obj33.Nome : null); + } + } + val37.Vendedor = (string)obj31; + val37.TodosVendedores = ((x.Vendedores == null || x.Vendedores.Count == 0) ? "" : string.Join("; ", x.Vendedores.Select((VendedorParcela v) => v.Vendedor.Nome))); + val37.Documento = x.Documento; + Documento documento9 = x.Documento; + val37.DataControle = ((documento9 != null) ? documento9.DataControle : null); + Documento documento10 = x.Documento; + object obj34; + if (documento10 == null) + { + obj34 = null; + } + else + { + Status status9 = documento10.Status; + obj34 = ((status9 != null) ? status9.Nome : null); + } + if (obj34 == null) + { + obj34 = ""; + } + val37.StatusApolice = (string)obj34; + val37.IdEmpresa = x.Documento.Controle.IdEmpresa; + val37.Empresa = ((IEnumerable)Recursos.Empresas).FirstOrDefault((Func)((Empresa empresa) => ((DomainBase)empresa).Id == x.Documento.Controle.IdEmpresa)).NomeSocial; + val37.Item = ((x.Documento.ItensAtivo.Count > 1) ? "APÓLICE COLETIVA" : ((x.Documento.ItensAtivo.Count == 1) ? x.Documento.ItensAtivo.First().Descricao : "")); + val37.SubTipo = x.SubTipo; + val37.Pasta = x.Documento.Pasta; + val37.PastaCliente = x.Documento.Controle.Cliente.Pasta; + val37.TipoDocumento = (((int)x.Documento.TipoRecebimento.GetValueOrDefault() == 2) ? "FATURA" : ((x.Documento.Tipo == 0) ? "APÓLICE" : "ENDOSSO")); + return val37; + }).ToList(); + Comissao = comissao; + ComissaoFiltrado = (Recursos.Configuracoes.Any((ConfiguracaoSistema c) => (int)c.Configuracao == 10) ? new ObservableCollection(Comissao.Where((Comissao x) => x.ComissaoRecebida != 0m).ToList()) : new ObservableCollection(Comissao)); + break; + } + case 6: + case 16: + { + RelatorioFiltroPersonalizado = Funcoes.PopularFiltroPersonalizado(); + List list18 = (((int)Relatorio != 6) ? (await _parcelaServico.BuscarParcelas(Filtros, DocumentosAtivos)) : (await _parcelaServico.BuscarParcelasPendentes(Filtros))); + if (list18.Count == 0) + { + ExtratosEnabled = false; + return false; + } + List pendente = ((IEnumerable)list18).Select((Func)delegate(Parcela x) + { + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Unknown result type (might be due to invalid IL or missing references) + //IL_0037: Unknown result type (might be due to invalid IL or missing references) + //IL_0043: Unknown result type (might be due to invalid IL or missing references) + //IL_006c: Unknown result type (might be due to invalid IL or missing references) + //IL_008b: Unknown result type (might be due to invalid IL or missing references) + //IL_00aa: Unknown result type (might be due to invalid IL or missing references) + //IL_00b6: Unknown result type (might be due to invalid IL or missing references) + //IL_00ce: Unknown result type (might be due to invalid IL or missing references) + //IL_00ee: Unknown result type (might be due to invalid IL or missing references) + //IL_0106: Unknown result type (might be due to invalid IL or missing references) + //IL_011c: Unknown result type (might be due to invalid IL or missing references) + //IL_0132: Unknown result type (might be due to invalid IL or missing references) + //IL_015b: Unknown result type (might be due to invalid IL or missing references) + //IL_016f: Unknown result type (might be due to invalid IL or missing references) + //IL_0175: Invalid comparison between Unknown and I4 + //IL_0199: Unknown result type (might be due to invalid IL or missing references) + //IL_01e5: Unknown result type (might be due to invalid IL or missing references) + //IL_01eb: Invalid comparison between Unknown and I4 + //IL_0264: Unknown result type (might be due to invalid IL or missing references) + //IL_0278: Unknown result type (might be due to invalid IL or missing references) + //IL_027e: Invalid comparison between Unknown and I4 + //IL_02a2: Unknown result type (might be due to invalid IL or missing references) + //IL_02a8: Invalid comparison between Unknown and I4 + //IL_033a: Unknown result type (might be due to invalid IL or missing references) + //IL_034b: Unknown result type (might be due to invalid IL or missing references) + //IL_035c: Unknown result type (might be due to invalid IL or missing references) + //IL_036d: Unknown result type (might be due to invalid IL or missing references) + //IL_038c: Unknown result type (might be due to invalid IL or missing references) + //IL_03a0: Unknown result type (might be due to invalid IL or missing references) + //IL_03a6: Invalid comparison between Unknown and I4 + //IL_0481: Unknown result type (might be due to invalid IL or missing references) + //IL_0495: Unknown result type (might be due to invalid IL or missing references) + //IL_049b: Invalid comparison between Unknown and I4 + //IL_0589: Unknown result type (might be due to invalid IL or missing references) + //IL_05b9: Unknown result type (might be due to invalid IL or missing references) + //IL_063f: Unknown result type (might be due to invalid IL or missing references) + //IL_066a: Unknown result type (might be due to invalid IL or missing references) + //IL_068c: Unknown result type (might be due to invalid IL or missing references) + //IL_06df: Unknown result type (might be due to invalid IL or missing references) + //IL_06f0: Unknown result type (might be due to invalid IL or missing references) + //IL_0716: Unknown result type (might be due to invalid IL or missing references) + //IL_0748: Unknown result type (might be due to invalid IL or missing references) + //IL_07a6: Unknown result type (might be due to invalid IL or missing references) + //IL_07ad: Unknown result type (might be due to invalid IL or missing references) + //IL_07b7: Unknown result type (might be due to invalid IL or missing references) + //IL_07cd: Unknown result type (might be due to invalid IL or missing references) + //IL_07ee: Unknown result type (might be due to invalid IL or missing references) + //IL_07fd: Unknown result type (might be due to invalid IL or missing references) + //IL_081d: Unknown result type (might be due to invalid IL or missing references) + //IL_082e: Unknown result type (might be due to invalid IL or missing references) + //IL_0849: Unknown result type (might be due to invalid IL or missing references) + //IL_086a: Unknown result type (might be due to invalid IL or missing references) + //IL_0880: Unknown result type (might be due to invalid IL or missing references) + //IL_08a0: Unknown result type (might be due to invalid IL or missing references) + //IL_08c6: Unknown result type (might be due to invalid IL or missing references) + //IL_08cc: Invalid comparison between Unknown and I4 + //IL_08f9: Unknown result type (might be due to invalid IL or missing references) + //IL_092b: Expected O, but got Unknown + Pendente val27 = new Pendente + { + Pendencia = (int)(today - x.Vencimento).TotalDays, + ParcelaEntity = x, + Cliente = (x.Documento.Controle.Cliente.Nome ?? ""), + Apolice = (x.Documento.Apolice ?? ""), + Endosso = (x.Documento.Endosso ?? ""), + Status = (EnumHelper.GetDescription(x.Documento.Situacao) ?? "") + }; + Negocio? negocio = x.Documento.Negocio; + val27.Negocio = (negocio.HasValue ? EnumHelper.GetDescription(negocio.GetValueOrDefault()) : null) ?? ""; + val27.VigenciaInicial = x.Documento.Vigencia1; + val27.VigenciaFinal = x.Documento.Vigencia2; + val27.Ramo = x.Documento.Controle.Ramo.Nome ?? ""; + val27.ComissaoPerc = (((int)x.Documento.TipoRecebimento.GetValueOrDefault() == 1) ? x.Documento.Comissao : x.Comissao); + val27.ComissaoGerada = ((x.Documento.Comissao > 0m) ? decimal.Round((((x.NumeroParcela == 999 && (int)x.Documento.TipoRecebimento.GetValueOrDefault() == 1) ? x.Valor : x.Documento.PremioLiquido) + (x.Documento.AdicionalComiss ? x.Documento.PremioAdicional : 0m)) * (x.Documento.Comissao / 100m), 2) : 0m); + val27.Pendentes = (((int)x.Documento.TipoRecebimento.GetValueOrDefault() == 1 && x.NumeroParcela < 10) ? $"0{x.NumeroParcela} de {x.Documento.NumeroParcelas}" : (((int)x.Documento.TipoRecebimento.GetValueOrDefault() == 1 && x.NumeroParcela >= 10) ? $"{x.NumeroParcela} de {x.Documento.NumeroParcelas}" : $"{x.NumeroParcela}")); + val27.Vencimento = x.Vencimento; + val27.Quitacao = x.DataQuitacao; + val27.Controle = x.DataControle; + val27.Proposta = x.Documento.Proposta ?? ""; + val27.ComissaoPrevista = (((int)x.Documento.TipoRecebimento.GetValueOrDefault() != 1) ? decimal.Round(x.Documento.PremioLiquido * (x.Comissao / 100m), 2) : ((x.Documento.NumeroParcelas == 0m) ? 0m : decimal.Round((x.Documento.PremioLiquido + (x.Documento.AdicionalComiss ? x.Documento.PremioAdicional : 0m)) * (x.Documento.Comissao / 100m) / x.Documento.NumeroParcelas, 2))); + val27.TotalPrevisto = (((int)x.Documento.TipoRecebimento.GetValueOrDefault() == 1 && x.Documento.Parcelas != null) ? (decimal.Round((x.Documento.PremioLiquido + (x.Documento.AdicionalComiss ? x.Documento.PremioAdicional : 0m)) * (x.Documento.Comissao / 100m), 2) - x.Documento.Parcelas.Sum((Parcela p) => p.ValorComissao)) : decimal.Round(x.Documento.PremioLiquido * (x.Comissao / 100m), 2)); + Produto produto5 = x.Documento.Controle.Produto; + val27.Produto = ((produto5 != null) ? produto5.Nome : null) ?? ""; + val27.Seguradora = (nomeSeguradora ? x.Documento.Controle.Seguradora.Nome : ((!string.IsNullOrWhiteSpace(x.Documento.Controle.Seguradora.NomeSocial)) ? x.Documento.Controle.Seguradora.NomeSocial : x.Documento.Controle.Seguradora.Nome)); + Estipulante estipulante4 = x.Documento.Estipulante1; + val27.Estipulante = ((estipulante4 != null) ? estipulante4.Nome : null) ?? ""; + Vendedor vendedorPrincipal3 = x.Documento.VendedorPrincipal; + val27.Vendedor = ((vendedorPrincipal3 != null) ? vendedorPrincipal3.Nome : null); + val27.TodosVendedores = ((x.Vendedores != null) ? string.Join("; ", x.Vendedores.Select((VendedorParcela v) => v.Vendedor.Nome)) : ""); + val27.Documento = x.Documento; + Documento documento3 = x.Documento; + val27.DataControle = ((documento3 != null) ? documento3.DataControle : null); + Documento documento4 = x.Documento; + object obj18; + if (documento4 == null) + { + obj18 = null; + } + else + { + Status status4 = documento4.Status; + obj18 = ((status4 != null) ? status4.Nome : null); + } + if (obj18 == null) + { + obj18 = ""; + } + val27.StatusApolice = (string)obj18; + val27.Item = ((x.Documento.ItensAtivo.Count > 1) ? "APÓLICE COLETIVA" : ((x.Documento.ItensAtivo.Count == 1) ? x.Documento.ItensAtivo.First().Descricao : "")); + val27.SubTipo = x.SubTipo; + val27.StatusPagamento = EnumHelper.GetDescription(x.StatusPagamento); + FormaPagamento? formaPagamento = x.Documento.FormaPagamento; + val27.FormaPagamento = (formaPagamento.HasValue ? EnumHelper.GetDescription(formaPagamento.GetValueOrDefault()) : null); + val27.DocumentoCliente = x.Documento.Controle.Cliente.Documento; + val27.ValorParcela = x.Valor; + val27.IdEmpresa = x.Documento.Controle.IdEmpresa; + val27.Empresa = ((IEnumerable)Recursos.Empresas).FirstOrDefault((Func)((Empresa empresa) => ((DomainBase)empresa).Id == x.Documento.Controle.IdEmpresa)).NomeSocial; + val27.Pasta = x.Documento.Pasta; + val27.PastaCliente = x.Documento.Controle.Cliente.Pasta; + val27.TipoDocumento = ((x.Documento.Tipo == 0 && (int)x.Documento.TipoRecebimento.GetValueOrDefault() == 2) ? "FATURA" : ((x.Documento.Tipo == 1) ? "ENDOSSO" : "APÓLICE")); + Cliente cliente6 = x.Documento.Controle.Cliente; + val27.Telefones = JoinTelefones((cliente6 != null) ? cliente6.Telefones.ToList() : null); + return val27; + }).ToList(); + Pendente = pendente; + PendenteFiltrado = new ObservableCollection(Pendente); + break; + } + case 9: + case 10: + { + RelatorioFiltroPersonalizado = Funcoes.PopularFiltroPersonalizado(); + List list13 = (((int)Relatorio != 9) ? (await _sinistroServico.BuscarSinistro(Filtros)) : (await _sinistroServico.BuscarSinistroPendente(Filtros))); + if (list13.Count == 0) + { + ExtratosEnabled = false; + return false; + } + List sinistro = ((IEnumerable)(from x in list13 + orderby x.ControleSinistro.DataSinistro, ((DomainBase)x.ControleSinistro).Id + select x)).Select((Func)delegate(Sinistro x) + { + //IL_002a: Unknown result type (might be due to invalid IL or missing references) + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0094: Unknown result type (might be due to invalid IL or missing references) + //IL_00c7: Unknown result type (might be due to invalid IL or missing references) + //IL_00f0: Unknown result type (might be due to invalid IL or missing references) + //IL_0119: Unknown result type (might be due to invalid IL or missing references) + //IL_016b: Unknown result type (might be due to invalid IL or missing references) + //IL_01b8: Unknown result type (might be due to invalid IL or missing references) + //IL_01de: Unknown result type (might be due to invalid IL or missing references) + //IL_0204: Unknown result type (might be due to invalid IL or missing references) + //IL_021e: Unknown result type (might be due to invalid IL or missing references) + //IL_022e: Unknown result type (might be due to invalid IL or missing references) + //IL_0238: Unknown result type (might be due to invalid IL or missing references) + //IL_0266: Unknown result type (might be due to invalid IL or missing references) + //IL_028f: Unknown result type (might be due to invalid IL or missing references) + //IL_02a9: Unknown result type (might be due to invalid IL or missing references) + //IL_02ba: Unknown result type (might be due to invalid IL or missing references) + //IL_02cb: Unknown result type (might be due to invalid IL or missing references) + //IL_02dc: Unknown result type (might be due to invalid IL or missing references) + //IL_02ed: Unknown result type (might be due to invalid IL or missing references) + //IL_0307: Unknown result type (might be due to invalid IL or missing references) + //IL_0318: Unknown result type (might be due to invalid IL or missing references) + //IL_0329: Unknown result type (might be due to invalid IL or missing references) + //IL_033a: Unknown result type (might be due to invalid IL or missing references) + //IL_0344: Unknown result type (might be due to invalid IL or missing references) + //IL_0377: Unknown result type (might be due to invalid IL or missing references) + //IL_03ac: Unknown result type (might be due to invalid IL or missing references) + //IL_03e1: Unknown result type (might be due to invalid IL or missing references) + //IL_048f: Unknown result type (might be due to invalid IL or missing references) + //IL_049b: Unknown result type (might be due to invalid IL or missing references) + //IL_04b6: Unknown result type (might be due to invalid IL or missing references) + //IL_04cc: Unknown result type (might be due to invalid IL or missing references) + //IL_04ec: Unknown result type (might be due to invalid IL or missing references) + //IL_0516: Unknown result type (might be due to invalid IL or missing references) + //IL_053b: Unknown result type (might be due to invalid IL or missing references) + //IL_0588: Unknown result type (might be due to invalid IL or missing references) + //IL_05d2: Unknown result type (might be due to invalid IL or missing references) + //IL_05f7: Unknown result type (might be due to invalid IL or missing references) + //IL_0618: Unknown result type (might be due to invalid IL or missing references) + //IL_064a: Unknown result type (might be due to invalid IL or missing references) + //IL_067c: Unknown result type (might be due to invalid IL or missing references) + //IL_076d: Unknown result type (might be due to invalid IL or missing references) + //IL_0785: Unknown result type (might be due to invalid IL or missing references) + //IL_0731: Unknown result type (might be due to invalid IL or missing references) + //IL_07b8: Unknown result type (might be due to invalid IL or missing references) + //IL_07c9: Unknown result type (might be due to invalid IL or missing references) + //IL_07da: Unknown result type (might be due to invalid IL or missing references) + //IL_07f4: Unknown result type (might be due to invalid IL or missing references) + //IL_0805: Unknown result type (might be due to invalid IL or missing references) + //IL_082d: Unknown result type (might be due to invalid IL or missing references) + //IL_083e: Unknown result type (might be due to invalid IL or missing references) + //IL_0867: Expected O, but got Unknown + if (x.ControleSinistro.DataSinistro.HasValue) + { + Sinistro val34 = new Sinistro + { + Pendencia = ((!x.DataLiquidacao.HasValue) ? int.Parse($"{(today - x.ControleSinistro.DataSinistro.Value.Date).TotalDays}") : 0), + Nome = (x.ControleSinistro.Item.Documento.Controle.Cliente.Nome ?? ""), + Apolice = (x.ControleSinistro.Item.Documento.Apolice ?? ""), + Endosso = (x.ControleSinistro.Item.Documento.Endosso ?? "") + }; + ControleSinistro controleSinistro = x.ControleSinistro; + DateTime? vigenciaInicial; + if (controleSinistro == null) + { + vigenciaInicial = null; + } + else + { + Item item11 = controleSinistro.Item; + if (item11 == null) + { + vigenciaInicial = null; + } + else + { + Documento documento5 = item11.Documento; + vigenciaInicial = ((documento5 != null) ? new DateTime?(documento5.Vigencia1) : null); + } + } + val34.VigenciaInicial = vigenciaInicial; + ControleSinistro controleSinistro2 = x.ControleSinistro; + DateTime? vigenciaFinal; + if (controleSinistro2 == null) + { + vigenciaFinal = null; + } + else + { + Item item12 = controleSinistro2.Item; + if (item12 == null) + { + vigenciaFinal = null; + } + else + { + Documento documento6 = item12.Documento; + vigenciaFinal = ((documento6 != null) ? documento6.Vigencia2 : null); + } + } + val34.VigenciaFinal = vigenciaFinal; + SinistroAuto sinistroAuto = x.SinistroAuto; + val34.Email = ((sinistroAuto != null) ? sinistroAuto.Email : null) ?? ""; + SinistroAuto sinistroAuto2 = x.SinistroAuto; + val34.Telefone = ((sinistroAuto2 != null) ? sinistroAuto2.Telefone : null) ?? ""; + val34.NumeroSinistro = x.Numero ?? ""; + val34.TipoSinistro = x.TipoSinistro.GetValueOrDefault(); + val34.DataSinistro = x.ControleSinistro.DataSinistro ?? DateTime.MinValue; + val34.Reclamacao = x.DataReclamacao ?? DateTime.MinValue; + val34.Item = x.ItemSinistrado ?? ""; + val34.Valor = x.Valor; + val34.ValorOrcado = x.ValorOrcado; + val34.ValorLiberado = x.ValorLiberado; + val34.ValorPago = x.ValorPago; + val34.ValorSalvado = x.ValorSalvado.GetValueOrDefault(); + val34.ValorFranquia = x.ValorFranquia; + val34.Liquidacao = x.DataLiquidacao; + val34.StatusSinistro = x.StatusSinistro.GetValueOrDefault((StatusSinistro)1); + val34.Ramo = x.ControleSinistro.Item.Documento.Controle.Ramo.Nome ?? ""; + Estipulante estipulante6 = x.ControleSinistro.Item.Documento.Estipulante1; + val34.Estipulante = ((estipulante6 != null) ? estipulante6.Nome : null) ?? ""; + Vendedor vendedorPrincipal6 = x.ControleSinistro.Item.Documento.VendedorPrincipal; + val34.Vendedor = ((vendedorPrincipal6 != null) ? vendedorPrincipal6.Nome : null) ?? ""; + val34.Seguradora = (nomeSeguradora ? x.ControleSinistro.Item.Documento.Controle.Seguradora.Nome : ((!string.IsNullOrWhiteSpace(x.ControleSinistro.Item.Documento.Controle.Seguradora.NomeSocial)) ? x.ControleSinistro.Item.Documento.Controle.Seguradora.NomeSocial : x.ControleSinistro.Item.Documento.Controle.Seguradora.Nome)); + val34.EntidadeSinistro = x; + val34.Documento = x.ControleSinistro.Item.Documento; + val34.EntidadeItem = x.ControleSinistro.Item; + val34.Pasta = x.ControleSinistro.Item.Documento.Pasta; + val34.PastaCliente = x.ControleSinistro.Item.Documento.Controle.Cliente.Pasta; + val34.Cliente = x.ControleSinistro.Item.Documento.Controle.Cliente; + ControleSinistro controleSinistro3 = x.ControleSinistro; + DateTime? dataControle; + if (controleSinistro3 == null) + { + dataControle = null; + } + else + { + Item item13 = controleSinistro3.Item; + if (item13 == null) + { + dataControle = null; + } + else + { + Documento documento7 = item13.Documento; + dataControle = ((documento7 != null) ? documento7.DataControle : null); + } + } + val34.DataControle = dataControle; + ControleSinistro controleSinistro4 = x.ControleSinistro; + object obj22; + if (controleSinistro4 == null) + { + obj22 = null; + } + else + { + Item item14 = controleSinistro4.Item; + if (item14 == null) + { + obj22 = null; + } + else + { + Documento documento8 = item14.Documento; + if (documento8 == null) + { + obj22 = null; + } + else + { + Status status6 = documento8.Status; + obj22 = ((status6 != null) ? status6.Nome : null); + } + } + } + if (obj22 == null) + { + obj22 = ""; + } + val34.StatusApolice = (string)obj22; + val34.IdEmpresa = x.ControleSinistro.Item.Documento.Controle.IdEmpresa; + val34.Empresa = ((IEnumerable)Recursos.Empresas).FirstOrDefault((Func)((Empresa empresa) => ((DomainBase)empresa).Id == x.ControleSinistro.Item.Documento.Controle.IdEmpresa)).NomeSocial; + SinistroAuto sinistroAuto3 = x.SinistroAuto; + object obj23; + if (sinistroAuto3 == null) + { + obj23 = null; + } + else + { + Parceiro parceiroMecanica = sinistroAuto3.ParceiroMecanica; + obj23 = ((parceiroMecanica != null) ? parceiroMecanica.Nome : null); + } + if (obj23 == null) + { + obj23 = ""; + } + val34.Mecanica = (string)obj23; + SinistroAuto sinistroAuto4 = x.SinistroAuto; + object obj24; + if (sinistroAuto4 == null) + { + obj24 = null; + } + else + { + Parceiro parceiroFunilaria = sinistroAuto4.ParceiroFunilaria; + obj24 = ((parceiroFunilaria != null) ? parceiroFunilaria.Nome : null); + } + if (obj24 == null) + { + obj24 = ""; + } + val34.Funilaria = (string)obj24; + object obj25; + if (((DomainBase)x.ControleSinistro.Item.Documento.Controle.Ramo).Id != 5) + { + if (!new List { 6L, 7L, 9L, 10L, 53L }.Contains(((DomainBase)x.ControleSinistro.Item.Documento.Controle.Ramo).Id)) + { + obj25 = ""; + } + else + { + SinistroVida sinistroVida = x.SinistroVida; + if (sinistroVida == null) + { + obj25 = null; + } + else + { + TipoPerda? tipoPerda = sinistroVida.TipoPerda; + obj25 = (tipoPerda.HasValue ? EnumHelper.GetDescription(tipoPerda.GetValueOrDefault()) : null); + } + if (obj25 == null) + { + obj25 = ""; + } + } + } + else + { + SinistroAuto sinistroAuto5 = x.SinistroAuto; + if (sinistroAuto5 == null) + { + obj25 = null; + } + else + { + TipoPerda? tipoPerda = sinistroAuto5.TipoPerda; + obj25 = (tipoPerda.HasValue ? EnumHelper.GetDescription(tipoPerda.GetValueOrDefault()) : null); + } + if (obj25 == null) + { + obj25 = ""; + } + } + val34.TipoPerda = (string)obj25; + val34.CpfCnpj = x.ControleSinistro.Item.Documento.Controle.Cliente.Documento ?? ""; + val34.StatusPersonalizado = x.StatusPersonalizado; + val34.Auxiliar = x.Auxiliar; + val34.Motivo = x.Motivo ?? ""; + val34.DataCriacao = x.DataCriacao; + Usuario? obj26 = ((IEnumerable)Recursos.Usuarios).FirstOrDefault((Func)((Usuario usuario) => ((DomainBase)usuario).Id == x.IdUsuarioCriacao)); + val34.UsuarioCriacao = ((obj26 != null) ? obj26.Nome : null); + val34.DataAlteracao = x.DataAlteracao; + Usuario? obj27 = ((IEnumerable)Recursos.Usuarios).FirstOrDefault((Func)((Usuario usuario) => ((DomainBase)usuario).Id == x.IdUsuarioAlteracao)); + val34.UsuarioAlteracao = ((obj27 != null) ? obj27.Nome : null); + return val34; + } + return (Sinistro)null; + }).ToList(); + Sinistro = sinistro; + SinistroFiltrado = new ObservableCollection(Sinistro); + break; + } + case 11: + { + List list25 = await _apoliceServico.BuscarFechamento(Filtros); + if (list25 == null) + { + ExtratosEnabled = false; + return false; + } + list25.ForEach(delegate(Fechamento x) + { + x.Pendente = x.Gerada - x.Recebida; + x.PendenteAnterior = x.GeradaAnterior - x.RecebidaAnterior; + }); + Fechamento = new ObservableCollection(); + List list26 = (from x in list25 + where x.Entidade == 0 + orderby x.PremioTotal descending + select x).ToList(); + if (list26.Count > 0) + { + list26.Add(new Fechamento + { + Entidade = list26.First().Entidade, + Nome = "TOTAL", + PremioTotal = list26.Sum((Fechamento x) => x.PremioTotal), + PremioTotalAnterior = list26.Sum((Fechamento x) => x.PremioTotalAnterior), + PremioLiquido = list26.Sum((Fechamento x) => x.PremioLiquido), + PremioLiquidoAnterior = list26.Sum((Fechamento x) => x.PremioLiquidoAnterior), + Fechada = (list26.Any() ? 100 : 0), + FechadaAnterior = (list26.Any() ? 100 : 0), + Mix = 100m, + MixAnterior = 100m, + Gerada = list26.Sum((Fechamento x) => x.Gerada), + GeradaAnterior = list26.Sum((Fechamento x) => x.GeradaAnterior), + Recebida = list26.Sum((Fechamento x) => x.Recebida), + RecebidaAnterior = list26.Sum((Fechamento x) => x.RecebidaAnterior), + Pendente = list26.Sum((Fechamento x) => x.Pendente), + PendenteAnterior = list26.Sum((Fechamento x) => x.PendenteAnterior), + Paga = list26.Sum((Fechamento x) => x.Paga), + PagaAnterior = list26.Sum((Fechamento x) => x.PagaAnterior), + Apolice = list26.Sum((Fechamento x) => x.Apolice), + ApoliceAnterior = list26.Sum((Fechamento x) => x.ApoliceAnterior), + Endosso = list26.Sum((Fechamento x) => x.Endosso), + EndossoAnterior = list26.Sum((Fechamento x) => x.EndossoAnterior), + Fatura = list26.Sum((Fechamento x) => x.Fatura), + FaturaAnterior = list26.Sum((Fechamento x) => x.FaturaAnterior), + Itens = list26.Sum((Fechamento x) => x.Itens), + ItensAnterior = list26.Sum((Fechamento x) => x.ItensAnterior) + }); + Fechamento.Add(new Fechamentos + { + Title = "SEGURADORA", + Fechamento = new ObservableCollection(list26) + }); + } + List list27 = (from x in list25 + where x.Entidade == 1 + orderby x.PremioTotal descending + select x).ToList(); + if (list27.Count > 0) + { + list27.Add(new Fechamento + { + Entidade = list27.First().Entidade, + Nome = "TOTAL", + PremioTotal = list27.Sum((Fechamento x) => x.PremioTotal), + PremioTotalAnterior = list27.Sum((Fechamento x) => x.PremioTotalAnterior), + PremioLiquido = list27.Sum((Fechamento x) => x.PremioLiquido), + PremioLiquidoAnterior = list27.Sum((Fechamento x) => x.PremioLiquidoAnterior), + Fechada = (list27.Any() ? 100 : 0), + FechadaAnterior = (list27.Any() ? 100 : 0), + Mix = 100m, + MixAnterior = 100m, + Gerada = list27.Sum((Fechamento x) => x.Gerada), + GeradaAnterior = list27.Sum((Fechamento x) => x.GeradaAnterior), + Recebida = list27.Sum((Fechamento x) => x.Recebida), + RecebidaAnterior = list27.Sum((Fechamento x) => x.RecebidaAnterior), + Pendente = list27.Sum((Fechamento x) => x.Pendente), + PendenteAnterior = list27.Sum((Fechamento x) => x.PendenteAnterior), + Paga = list27.Sum((Fechamento x) => x.Paga), + PagaAnterior = list27.Sum((Fechamento x) => x.PagaAnterior), + Apolice = list27.Sum((Fechamento x) => x.Apolice), + ApoliceAnterior = list27.Sum((Fechamento x) => x.ApoliceAnterior), + Endosso = list27.Sum((Fechamento x) => x.Endosso), + EndossoAnterior = list27.Sum((Fechamento x) => x.EndossoAnterior), + Fatura = list27.Sum((Fechamento x) => x.Fatura), + FaturaAnterior = list27.Sum((Fechamento x) => x.FaturaAnterior), + Itens = list27.Sum((Fechamento x) => x.Itens), + ItensAnterior = list27.Sum((Fechamento x) => x.ItensAnterior) + }); + Fechamento.Add(new Fechamentos + { + Title = "RAMO", + Fechamento = new ObservableCollection(list27) + }); + } + List list28 = (from x in list25 + where x.Entidade == 2 + orderby x.PremioTotal descending + select x).ToList(); + if (list28.Count > 0) + { + list28.Add(new Fechamento + { + Entidade = list28.First().Entidade, + Nome = "TOTAL", + PremioTotal = list28.Sum((Fechamento x) => x.PremioTotal), + PremioTotalAnterior = list28.Sum((Fechamento x) => x.PremioTotalAnterior), + PremioLiquido = list28.Sum((Fechamento x) => x.PremioLiquido), + PremioLiquidoAnterior = list28.Sum((Fechamento x) => x.PremioLiquidoAnterior), + Fechada = (list28.Any() ? 100 : 0), + FechadaAnterior = (list28.Any() ? 100 : 0), + Mix = 100m, + MixAnterior = 100m, + Gerada = list28.Sum((Fechamento x) => x.Gerada), + GeradaAnterior = list28.Sum((Fechamento x) => x.GeradaAnterior), + Recebida = list28.Sum((Fechamento x) => x.Recebida), + RecebidaAnterior = list28.Sum((Fechamento x) => x.RecebidaAnterior), + Pendente = list28.Sum((Fechamento x) => x.Pendente), + PendenteAnterior = list28.Sum((Fechamento x) => x.PendenteAnterior), + Paga = list28.Sum((Fechamento x) => x.Paga), + PagaAnterior = list28.Sum((Fechamento x) => x.PagaAnterior), + Apolice = list28.Sum((Fechamento x) => x.Apolice), + ApoliceAnterior = list28.Sum((Fechamento x) => x.ApoliceAnterior), + Endosso = list28.Sum((Fechamento x) => x.Endosso), + EndossoAnterior = list28.Sum((Fechamento x) => x.EndossoAnterior), + Fatura = list28.Sum((Fechamento x) => x.Fatura), + FaturaAnterior = list28.Sum((Fechamento x) => x.FaturaAnterior), + Itens = list28.Sum((Fechamento x) => x.Itens), + ItensAnterior = list28.Sum((Fechamento x) => x.ItensAnterior) + }); + Fechamento.Add(new Fechamentos + { + Title = "ESTIPULANTE", + Fechamento = new ObservableCollection(list28) + }); + } + List list29 = (from x in list25 + where x.Entidade == 3 + orderby x.PremioTotal descending + select x).ToList(); + if (list29.Count > 0) + { + List source7 = Funcoes.DistinctBy(list29, (Fechamento x) => new { x.PremioTotal, x.PremioLiquido, x.PremioTotalAnterior, x.PremioLiquidoAnterior }).ToList(); + list29.Add(new Fechamento + { + Entidade = list29.First().Entidade, + Nome = "TOTAL", + PremioTotal = source7.Sum((Fechamento x) => x.PremioTotal), + PremioTotalAnterior = source7.Sum((Fechamento x) => x.PremioTotalAnterior), + PremioLiquido = source7.Sum((Fechamento x) => x.PremioLiquido), + PremioLiquidoAnterior = source7.Sum((Fechamento x) => x.PremioLiquidoAnterior), + Fechada = (list29.Any() ? 100 : 0), + FechadaAnterior = (list29.Any() ? 100 : 0), + Mix = 100m, + MixAnterior = 100m, + Gerada = source7.Sum((Fechamento x) => x.Gerada), + GeradaAnterior = source7.Sum((Fechamento x) => x.GeradaAnterior), + Recebida = source7.Sum((Fechamento x) => x.Recebida), + RecebidaAnterior = source7.Sum((Fechamento x) => x.RecebidaAnterior), + Pendente = source7.Sum((Fechamento x) => x.Pendente), + PendenteAnterior = source7.Sum((Fechamento x) => x.PendenteAnterior), + Paga = source7.Sum((Fechamento x) => x.Paga), + PagaAnterior = source7.Sum((Fechamento x) => x.PagaAnterior), + Apolice = source7.Sum((Fechamento x) => x.Apolice), + ApoliceAnterior = source7.Sum((Fechamento x) => x.ApoliceAnterior), + Endosso = source7.Sum((Fechamento x) => x.Endosso), + EndossoAnterior = source7.Sum((Fechamento x) => x.EndossoAnterior), + Fatura = source7.Sum((Fechamento x) => x.Fatura), + FaturaAnterior = source7.Sum((Fechamento x) => x.FaturaAnterior), + Itens = source7.Sum((Fechamento x) => x.Itens), + ItensAnterior = source7.Sum((Fechamento x) => x.ItensAnterior) + }); + Fechamento.Add(new Fechamentos + { + Title = "VENDEDOR", + Fechamento = new ObservableCollection(list29) + }); + } + FechamentoFiltrado = new ObservableCollection(Fechamento); + HtmlContent = await GerarHtml(screen: true); + break; + } + case 8: + { + RelatorioFiltroPersonalizado = Funcoes.PopularFiltroPersonalizado(); + Filtros.ParcelasEspeciais = ParcelasEspeciais; + List list12 = await _apoliceServico.Auditoria(Filtros); + if (list12.Count == 0) + { + ExtratosEnabled = false; + return false; + } + List auditoria = ((IEnumerable)list12).Select((Func)delegate(Documento x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_002b: Unknown result type (might be due to invalid IL or missing references) + //IL_0040: Unknown result type (might be due to invalid IL or missing references) + //IL_0055: Unknown result type (might be due to invalid IL or missing references) + //IL_0061: Unknown result type (might be due to invalid IL or missing references) + //IL_006d: Unknown result type (might be due to invalid IL or missing references) + //IL_0079: Unknown result type (might be due to invalid IL or missing references) + //IL_0085: Unknown result type (might be due to invalid IL or missing references) + //IL_00cb: Unknown result type (might be due to invalid IL or missing references) + //IL_0118: Unknown result type (might be due to invalid IL or missing references) + //IL_011a: Unknown result type (might be due to invalid IL or missing references) + //IL_0120: Invalid comparison between Unknown and I4 + //IL_0126: Unknown result type (might be due to invalid IL or missing references) + //IL_012c: Invalid comparison between Unknown and I4 + //IL_026f: Unknown result type (might be due to invalid IL or missing references) + //IL_027b: Unknown result type (might be due to invalid IL or missing references) + //IL_0287: Unknown result type (might be due to invalid IL or missing references) + //IL_02ad: Unknown result type (might be due to invalid IL or missing references) + //IL_02cc: Unknown result type (might be due to invalid IL or missing references) + //IL_0325: Unknown result type (might be due to invalid IL or missing references) + //IL_0327: Unknown result type (might be due to invalid IL or missing references) + //IL_033f: Unknown result type (might be due to invalid IL or missing references) + //IL_0360: Unknown result type (might be due to invalid IL or missing references) + //IL_0381: Unknown result type (might be due to invalid IL or missing references) + //IL_03d7: Unknown result type (might be due to invalid IL or missing references) + //IL_03e3: Unknown result type (might be due to invalid IL or missing references) + //IL_03ef: Unknown result type (might be due to invalid IL or missing references) + //IL_0410: Unknown result type (might be due to invalid IL or missing references) + //IL_0417: Unknown result type (might be due to invalid IL or missing references) + //IL_0466: Unknown result type (might be due to invalid IL or missing references) + //IL_04b4: Unknown result type (might be due to invalid IL or missing references) + //IL_04c0: Unknown result type (might be due to invalid IL or missing references) + //IL_04d7: Expected O, but got Unknown + Auditoria val35 = new Auditoria(); + Cliente cliente9 = x.Controle.Cliente; + val35.Cliente = ((cliente9 != null) ? cliente9.Nome : null) ?? ""; + val35.Apolice = x.Apolice ?? ""; + val35.Endosso = x.Endosso ?? ""; + val35.Comissao = x.Comissao; + val35.PremioLiquido = x.PremioLiquido; + val35.PremioTotal = x.PremioTotal; + val35.PremioAdicional = x.PremioAdicional; + val35.ComissaoPrevista = decimal.Round((x.PremioLiquido + (x.AdicionalComiss ? x.PremioAdicional : 0m)) * x.Comissao * 0.01m, 2); + val35.ComissaoRecebida = ((x.Parcelas != null && x.Parcelas.Count > 0) ? x.Parcelas.Sum((Parcela p) => p.ValorComissao) : 0m); + val35.ComissaoPendente = (((int)x.Situacao == 3 || (int)x.Situacao == 7) ? 0m : (decimal.Round((x.PremioLiquido + (x.AdicionalComiss ? x.PremioAdicional : 0m)) * x.Comissao * 0.01m, 2) - ((x.Parcelas != null && x.Parcelas.Count > 0) ? ((x.Parcelas.Sum((Parcela p) => p.ValorComissao) < 0m && x.PremioLiquido > x.Parcelas.Sum((Parcela p) => p.ValorComissao)) ? (x.Parcelas.Sum((Parcela p) => p.ValorComissao) * -1m) : x.Parcelas.Sum((Parcela p) => p.ValorComissao)) : 0m))); + val35.VigenciaFinal = x.Vigencia2; + val35.VigenciaInicial = x.Vigencia1; + Produto produto8 = x.Controle.Produto; + val35.Produto = ((produto8 != null) ? produto8.Nome : null) ?? ""; + val35.Ramo = x.Controle.Ramo.Nome ?? ""; + val35.Seguradora = (nomeSeguradora ? x.Controle.Seguradora.Nome : ((!string.IsNullOrWhiteSpace(x.Controle.Seguradora.NomeSocial)) ? x.Controle.Seguradora.NomeSocial : x.Controle.Seguradora.Nome)); + val35.Status = EnumHelper.GetDescription(x.Situacao) ?? ""; + Vendedor vendedorPrincipal7 = x.VendedorPrincipal; + val35.Vendedor = ((vendedorPrincipal7 != null) ? vendedorPrincipal7.Nome : null) ?? ""; + Estipulante estipulante7 = x.Estipulante1; + val35.Estipulante = ((estipulante7 != null) ? estipulante7.Nome : null) ?? ""; + val35.TodosVendedores = ((x.Vendedores == null || x.Vendedores.Count == 0) ? "" : string.Join("; ", x.Vendedores.Select((Vendedor v) => v.Nome))); + val35.Tipo = x.Tipo; + val35.DataControle = x.DataControle; + Status status7 = x.Status; + val35.StatusApolice = ((status7 != null) ? status7.Nome : null) ?? ""; + val35.Documento = x; + val35.Item = ((x.ItensAtivo == null) ? "" : ((x.ItensAtivo.Count > 1) ? "APÓLICE COLETIVA" : ((x.ItensAtivo.Count == 1) ? x.ItensAtivo.First().Descricao : ""))); + val35.Completo = (((decimal)x.Parcelas.Count((Parcela p) => (int)p.SubTipo == 1 && p.DataRecebimento.HasValue) == x.NumeroParcelas) ? "SIM" : "NÃO"); + val35.Pasta = x.Pasta; + val35.PastaCliente = x.Controle.Cliente.Pasta; + return val35; + }).ToList(); + Auditoria = auditoria; + AuditoriaFiltrado = new ObservableCollection(Auditoria); + break; + } + case 7: + { + AdiantamentoServico adiantamentoServico = new AdiantamentoServico(); + Filtros.ParcelasEspeciais = ParcelasEspeciais; + List pagamento = await _parcelaServico.BuscarPagamentoVendedor(Filtros, SomenteNaoPagos, SegundaViaReciboPagamento); + if (_documentosEmitidos) + { + pagamento = pagamento.Where(delegate(VendedorParcela x) + { + Documento documento2 = x.Documento; + return documento2 != null && documento2.Emissao.HasValue; + }).ToList(); + } + List list19 = await adiantamentoServico.BuscarPorData(Filtros, SegundaViaReciboPagamento); + if (pagamento.Count == 0 && list19.Count == 0) + { + ExtratosEnabled = false; + return false; + } + List analiticoPagamento = ((IEnumerable)pagamento).Select((Func)delegate(VendedorParcela x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Unknown result type (might be due to invalid IL or missing references) + //IL_001d: Unknown result type (might be due to invalid IL or missing references) + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_0030: Unknown result type (might be due to invalid IL or missing references) + //IL_004b: Unknown result type (might be due to invalid IL or missing references) + //IL_005c: Unknown result type (might be due to invalid IL or missing references) + //IL_006d: Unknown result type (might be due to invalid IL or missing references) + //IL_0083: Unknown result type (might be due to invalid IL or missing references) + //IL_0094: Unknown result type (might be due to invalid IL or missing references) + //IL_009b: Unknown result type (might be due to invalid IL or missing references) + //IL_00aa: Unknown result type (might be due to invalid IL or missing references) + //IL_0117: Unknown result type (might be due to invalid IL or missing references) + //IL_012d: Unknown result type (might be due to invalid IL or missing references) + //IL_0143: Unknown result type (might be due to invalid IL or missing references) + //IL_0152: Unknown result type (might be due to invalid IL or missing references) + //IL_0158: Invalid comparison between Unknown and I4 + //IL_01be: Unknown result type (might be due to invalid IL or missing references) + //IL_01d4: Unknown result type (might be due to invalid IL or missing references) + //IL_0218: Unknown result type (might be due to invalid IL or missing references) + //IL_022e: Unknown result type (might be due to invalid IL or missing references) + //IL_0234: Invalid comparison between Unknown and I4 + //IL_024e: Unknown result type (might be due to invalid IL or missing references) + //IL_0262: Unknown result type (might be due to invalid IL or missing references) + //IL_0437: Unknown result type (might be due to invalid IL or missing references) + //IL_0443: Unknown result type (might be due to invalid IL or missing references) + //IL_0454: Unknown result type (might be due to invalid IL or missing references) + //IL_0465: Unknown result type (might be due to invalid IL or missing references) + //IL_0490: Unknown result type (might be due to invalid IL or missing references) + //IL_038e: Unknown result type (might be due to invalid IL or missing references) + //IL_04b6: Unknown result type (might be due to invalid IL or missing references) + //IL_04e1: Unknown result type (might be due to invalid IL or missing references) + //IL_04fd: Unknown result type (might be due to invalid IL or missing references) + //IL_0515: Unknown result type (might be due to invalid IL or missing references) + //IL_052b: Unknown result type (might be due to invalid IL or missing references) + //IL_053c: Unknown result type (might be due to invalid IL or missing references) + //IL_054d: Unknown result type (might be due to invalid IL or missing references) + //IL_0577: Unknown result type (might be due to invalid IL or missing references) + //IL_0588: Unknown result type (might be due to invalid IL or missing references) + //IL_0599: Unknown result type (might be due to invalid IL or missing references) + //IL_05c1: Unknown result type (might be due to invalid IL or missing references) + //IL_0600: Unknown result type (might be due to invalid IL or missing references) + //IL_060f: Unknown result type (might be due to invalid IL or missing references) + //IL_0615: Invalid comparison between Unknown and I4 + //IL_062a: Expected O, but got Unknown + DadosRelatorio val26 = new DadosRelatorio + { + Id = ((DomainBase)x).Id, + EntidadeDocumento = x.Documento, + EntidadeParcela = x.Parcela, + EntidadeVendedorParcela = x, + Cliente = x.Documento.Controle.Cliente.Nome, + Apolice = x.Documento.Apolice, + Endosso = x.Documento.Endosso, + VigenciaIncial = x.Documento.Vigencia1, + VigenciaFinal = x.Documento.Vigencia2, + Status = EnumHelper.GetDescription(x.Documento.Situacao), + Seguradora = (nomeSeguradora ? x.Documento.Controle.Seguradora.Nome : ((!string.IsNullOrWhiteSpace(x.Documento.Controle.Seguradora.NomeSocial)) ? x.Documento.Controle.Seguradora.NomeSocial : x.Documento.Controle.Seguradora.Nome)), + Comissao = x.Documento.Comissao, + PremioLiquido = x.Documento.PremioLiquido, + Parcela = (((int)x.Documento.TipoRecebimento.GetValueOrDefault() != 1) ? $"{x.Parcela.NumeroParcela}" : ((x.Parcela.NumeroParcela != 999) ? $"{x.Parcela.NumeroParcela} de {x.Documento.NumeroParcelas}" : " Especial")), + ValorParcela = x.Parcela.Valor, + Recebimento = (Recursos.Configuracoes.Any((ConfiguracaoSistema c) => (int)c.Configuracao == 34) ? x.Documento.DataControle : x.DataPrePagamento) + }; + Repasse repasse = x.Repasse; + val26.ComissaoRepasse = ((repasse != null && (int)repasse.Tipo.GetValueOrDefault() == 2) ? x.PorcentagemRepasse : null); + val26.Repasse = x.ValorRepasse.GetValueOrDefault(); + decimal? num2; + decimal? desconto; + if (x.Vendedor.Desconto.HasValue) + { + desconto = x.Vendedor.Desconto; + if (!((desconto.GetValueOrDefault() == default(decimal)) & desconto.HasValue) && x.ValorRepasse.HasValue) + { + desconto = x.ValorRepasse; + if (!((desconto.GetValueOrDefault() == default(decimal)) & desconto.HasValue)) + { + desconto = x.ValorRepasse; + if (!((desconto.GetValueOrDefault() < default(decimal)) & desconto.HasValue)) + { + desconto = x.ValorRepasse; + decimal value2 = 1; + decimal? desconto2 = x.Vendedor.Desconto; + num2 = desconto * (decimal?)((decimal?)value2 - desconto2).GetValueOrDefault(); + } + else if ((int)x.Vendedor.TipoIncidenciaDesconto != 0) + { + num2 = x.ValorRepasse; + } + else + { + desconto = x.ValorRepasse; + decimal value3 = 1; + decimal? desconto3 = x.Vendedor.Desconto; + num2 = desconto * (decimal?)((decimal?)value3 - desconto3).GetValueOrDefault(); + } + goto IL_042a; + } + } + } + num2 = x.ValorRepasse.GetValueOrDefault(); + goto IL_042a; + IL_042a: + desconto = num2; + val26.ValorLiquido = desconto.Value; + val26.DataPagamento = x.DataPagamento; + val26.Vendedor = x.Vendedor.Nome; + val26.CPFVendedor = x.Vendedor.Documento; + Produto produto4 = x.Documento.Controle.Produto; + val26.Produto = ((produto4 != null) ? produto4.Nome : null) ?? ""; + Estipulante estipulante3 = x.Documento.Estipulante1; + val26.Estipulante = ((estipulante3 != null) ? estipulante3.Nome : null) ?? ""; + Ramo ramo2 = x.Documento.Controle.Ramo; + val26.Ramo = ((ramo2 != null) ? ramo2.Nome : null) ?? ""; + NegocioCorretora? negocioCorretora2 = x.Documento.NegocioCorretora; + val26.Negocio = (negocioCorretora2.HasValue ? EnumHelper.GetDescription(negocioCorretora2.GetValueOrDefault()) : null) ?? ""; + val26.PremioTotal = x.Documento.PremioTotal; + val26.Proposta = x.Documento.Proposta; + val26.DataCriacao = x.Documento.DataCriacao; + val26.Banco = ((x.Vendedor.Banco == null) ? "" : x.Vendedor.Banco.Nome); + val26.Agencia = x.Vendedor.Agencia; + val26.Conta = x.Vendedor.Conta; + val26.DocumentoEmitido = (x.Documento.Emissao.HasValue ? "SIM" : "NÃO"); + val26.HouveRecebimento = ((x.Parcela.DataRecebimento.HasValue && x.Parcela.ValorComDesconto != 0m) ? "SIM" : "NÃO"); + val26.RecebidoPorCompleto = (((int)x.Documento.TipoRecebimento.GetValueOrDefault() == 1) ? x.RecebidoPorCompleto : "FATURA INDEFINIDO"); + return val26; + }).ToList(); + List collection2 = ((IEnumerable)list19).Select((Func)delegate(Adiantamento x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_0018: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_0030: Unknown result type (might be due to invalid IL or missing references) + //IL_0041: Unknown result type (might be due to invalid IL or missing references) + //IL_0052: Unknown result type (might be due to invalid IL or missing references) + //IL_0063: Unknown result type (might be due to invalid IL or missing references) + //IL_0074: Unknown result type (might be due to invalid IL or missing references) + //IL_0091: Unknown result type (might be due to invalid IL or missing references) + //IL_00a2: Unknown result type (might be due to invalid IL or missing references) + //IL_00b4: Expected O, but got Unknown + DadosRelatorio val25 = new DadosRelatorio + { + EntidadeAdiantamento = x, + Id = ((DomainBase)x).Id, + Cliente = x.Historico, + Recebimento = x.Data, + Repasse = -x.Valor, + ValorLiquido = -x.Valor, + Vendedor = x.Vendedor.Nome, + CPFVendedor = x.Vendedor.Documento + }; + Banco banco2 = x.Vendedor.Banco; + val25.Banco = ((banco2 != null) ? banco2.Nome : null); + val25.Agencia = x.Vendedor.Agencia; + val25.Conta = x.Vendedor.Conta; + return val25; + }).ToList(); + analiticoPagamento.AddRange(collection2); + if (DesconsiderarNegativos) + { + analiticoPagamento = analiticoPagamento.Where((DadosRelatorio x) => x.ValorLiquido >= 0m).ToList(); + } + if (Recursos.Configuracoes.Any((ConfiguracaoSistema y) => (int)y.Configuracao == 10)) + { + analiticoPagamento = analiticoPagamento.Where((DadosRelatorio x) => Math.Round(x.ValorLiquido, 2) != 0.00m).ToList(); + } + List list20 = (from x in analiticoPagamento + orderby x.Vendedor + select x.Vendedor).Distinct().ToList(); + List pagamentos = new List(); + list20.ForEach(delegate(string x) + { + //IL_026e: Unknown result type (might be due to invalid IL or missing references) + //IL_0273: Unknown result type (might be due to invalid IL or missing references) + //IL_027e: Unknown result type (might be due to invalid IL or missing references) + //IL_02cd: Unknown result type (might be due to invalid IL or missing references) + //IL_031e: Expected O, but got Unknown + //IL_031e: Unknown result type (might be due to invalid IL or missing references) + //IL_0323: Unknown result type (might be due to invalid IL or missing references) + //IL_032e: Unknown result type (might be due to invalid IL or missing references) + //IL_037d: Unknown result type (might be due to invalid IL or missing references) + //IL_03ce: Expected O, but got Unknown + //IL_03ce: Unknown result type (might be due to invalid IL or missing references) + //IL_03d3: Unknown result type (might be due to invalid IL or missing references) + //IL_0410: Unknown result type (might be due to invalid IL or missing references) + //IL_041e: Unknown result type (might be due to invalid IL or missing references) + //IL_0424: Invalid comparison between Unknown and I4 + //IL_043e: Unknown result type (might be due to invalid IL or missing references) + //IL_04a3: Unknown result type (might be due to invalid IL or missing references) + //IL_0542: Expected O, but got Unknown + //IL_0542: Unknown result type (might be due to invalid IL or missing references) + //IL_0547: Unknown result type (might be due to invalid IL or missing references) + //IL_0552: Unknown result type (might be due to invalid IL or missing references) + //IL_066b: Unknown result type (might be due to invalid IL or missing references) + //IL_0696: Unknown result type (might be due to invalid IL or missing references) + //IL_06c3: Expected O, but got Unknown + //IL_06c3: Unknown result type (might be due to invalid IL or missing references) + //IL_06c8: Unknown result type (might be due to invalid IL or missing references) + //IL_06d4: Unknown result type (might be due to invalid IL or missing references) + //IL_06ec: Unknown result type (might be due to invalid IL or missing references) + //IL_0704: Unknown result type (might be due to invalid IL or missing references) + //IL_071c: Unknown result type (might be due to invalid IL or missing references) + //IL_0734: Unknown result type (might be due to invalid IL or missing references) + //IL_0783: Unknown result type (might be due to invalid IL or missing references) + //IL_07d2: Unknown result type (might be due to invalid IL or missing references) + //IL_0821: Unknown result type (might be due to invalid IL or missing references) + //IL_0870: Unknown result type (might be due to invalid IL or missing references) + //IL_08bf: Unknown result type (might be due to invalid IL or missing references) + //IL_08cc: Unknown result type (might be due to invalid IL or missing references) + //IL_08d9: Unknown result type (might be due to invalid IL or missing references) + //IL_08e8: Expected O, but got Unknown + //IL_091c: Unknown result type (might be due to invalid IL or missing references) + //IL_0921: Unknown result type (might be due to invalid IL or missing references) + //IL_092d: Unknown result type (might be due to invalid IL or missing references) + //IL_0939: Unknown result type (might be due to invalid IL or missing references) + //IL_0943: Expected O, but got Unknown + string ordemSelecionada = OrdemSelecionada; + List list30 = ((ordemSelecionada == "NOME CLIENTE") ? (from p in analiticoPagamento + orderby (p.EntidadeAdiantamento != null) ? 1 : 0, p.Cliente, p.Recebimento + where p.Vendedor == x + select p).ToList() : ((ordemSelecionada == "SEGURADORA, RAMO") ? (from p in analiticoPagamento + orderby (p.EntidadeAdiantamento != null) ? 1 : 0, p.Seguradora, p.Ramo, p.Recebimento + where p.Vendedor == x + select p).ToList() : (from p in analiticoPagamento + orderby (p.EntidadeAdiantamento != null) ? 1 : 0, p.Recebimento, p.Cliente + where p.Vendedor == x + select p).ToList())); + if (list30.Count == 0) + { + return; + } + List collection5 = list30.Where((DadosRelatorio p) => p.EntidadeAdiantamento == null).ToList(); + List collection6 = list30.Where((DadosRelatorio p) => p.EntidadeAdiantamento != null).ToList(); + DadosRelatorio item8 = new DadosRelatorio + { + Cliente = "TOTAL REPASSES", + Repasse = list30.Where((DadosRelatorio p) => p.EntidadeAdiantamento == null).Sum((DadosRelatorio p) => p.Repasse), + ValorLiquido = list30.Where((DadosRelatorio p) => p.EntidadeAdiantamento == null).Sum((DadosRelatorio p) => p.ValorLiquido) + }; + DadosRelatorio val19 = new DadosRelatorio + { + Cliente = "TOTAL ADIANTAMENTOS", + Repasse = list30.Where((DadosRelatorio p) => p.EntidadeAdiantamento != null).Sum((DadosRelatorio p) => p.Repasse), + ValorLiquido = list30.Where((DadosRelatorio p) => p.EntidadeAdiantamento != null).Sum((DadosRelatorio p) => p.ValorLiquido) + }; + DadosRelatorio val20 = new DadosRelatorio(); + DadosRelatorio? obj9 = list30.FirstOrDefault(); + object obj11; + if (obj9 != null) + { + VendedorParcela entidadeVendedorParcela = obj9.EntidadeVendedorParcela; + TipoIncidenciaDesconto? obj10; + if (entidadeVendedorParcela == null) + { + obj10 = null; + } + else + { + Vendedor vendedor3 = entidadeVendedorParcela.Vendedor; + obj10 = ((vendedor3 != null) ? new TipoIncidenciaDesconto?(vendedor3.TipoIncidenciaDesconto) : null); + } + TipoIncidenciaDesconto? val21 = obj10; + if ((int)val21.GetValueOrDefault() == 1) + { + obj11 = "SOMENTE POSITIVOS)"; + goto IL_0434; + } + } + obj11 = "AMBOS)"; + goto IL_0434; + IL_0434: + val20.Cliente = "DESCONTO (INCIDÊNCIA: " + (string?)obj11; + DadosRelatorio? obj12 = list30.FirstOrDefault(); + decimal? obj13; + if (obj12 == null) + { + obj13 = null; + } + else + { + VendedorParcela entidadeVendedorParcela2 = obj12.EntidadeVendedorParcela; + if (entidadeVendedorParcela2 == null) + { + obj13 = null; + } + else + { + Vendedor vendedor4 = entidadeVendedorParcela2.Vendedor; + obj13 = ((vendedor4 != null) ? vendedor4.Desconto : null); + } + } + decimal? num = obj13; + val20.ComissaoRepasse = num.GetValueOrDefault() * 100m; + val20.ValorLiquido = list30.Where((DadosRelatorio p) => p.EntidadeAdiantamento == null).Sum((DadosRelatorio p) => p.Repasse) - list30.Where((DadosRelatorio p) => p.EntidadeAdiantamento == null).Sum((DadosRelatorio p) => p.ValorLiquido); + DadosRelatorio val22 = val20; + DadosRelatorio val23 = new DadosRelatorio + { + Cliente = "TOTAL GERAL", + PremioLiquido = Funcoes.DistinctBy(list30.Where((DadosRelatorio d) => d.EntidadeDocumento != null), delegate(DadosRelatorio c) + { + Documento entidadeDocumento = c.EntidadeDocumento; + return (entidadeDocumento == null) ? null : new long?(((DomainBase)entidadeDocumento).Id); + }).Sum((DadosRelatorio p) => p.PremioLiquido) + Funcoes.DistinctBy(list30.Where((DadosRelatorio d) => d.EntidadeDocumento == null), delegate(DadosRelatorio c) + { + Adiantamento entidadeAdiantamento = c.EntidadeAdiantamento; + return (entidadeAdiantamento == null) ? null : new long?(((DomainBase)entidadeAdiantamento).Id); + }).Sum((DadosRelatorio p) => p.PremioLiquido), + Repasse = list30.Sum((DadosRelatorio p) => p.Repasse), + ValorLiquido = list30.Sum((DadosRelatorio p) => p.ValorLiquido) + }; + AgrupamentoVendedor val24 = new AgrupamentoVendedor + { + Vendedor = x + }; + DadosRelatorio? obj14 = list30.FirstOrDefault(); + val24.CPF = ((obj14 != null) ? obj14.CPFVendedor : null); + DadosRelatorio? obj15 = list30.FirstOrDefault(); + val24.Banco = ((obj15 != null) ? obj15.Banco : null); + DadosRelatorio? obj16 = list30.FirstOrDefault(); + val24.Agencia = ((obj16 != null) ? obj16.Agencia : null); + DadosRelatorio? obj17 = list30.FirstOrDefault(); + val24.Conta = ((obj17 != null) ? obj17.Conta : null); + val24.Repasse = list30.Where((DadosRelatorio p) => p.EntidadeAdiantamento == null && p.Repasse >= 0m).Sum((DadosRelatorio p) => p.Repasse); + val24.Estorno = list30.Where((DadosRelatorio p) => p.EntidadeAdiantamento == null && p.Repasse < 0m).Sum((DadosRelatorio p) => p.Repasse); + val24.RepasseBruto = list30.Where((DadosRelatorio p) => p.EntidadeAdiantamento == null).Sum((DadosRelatorio p) => p.Repasse); + val24.Debito = list30.Where((DadosRelatorio p) => p.EntidadeAdiantamento != null && p.Repasse < 0m).Sum((DadosRelatorio p) => p.Repasse); + val24.Credito = list30.Where((DadosRelatorio p) => p.EntidadeAdiantamento != null && p.Repasse >= 0m).Sum((DadosRelatorio p) => p.Repasse); + val24.Desconto = val22.ValorLiquido; + val24.Adiantamento = val19.ValorLiquido; + val24.ValorLiquido = val23.ValorLiquido; + AgrupamentoVendedor vendedores2 = val24; + list30 = new List(); + list30.AddRange(collection5); + list30.Add(item8); + list30.AddRange(collection6); + list30.Add(val19); + list30.Add(val22); + list30.Add(val23); + Pagamento item9 = new Pagamento + { + Title = x, + Dados = new ObservableCollection(list30), + Vendedores = vendedores2 + }; + pagamentos.Add(item9); + }); + Pagamentos = pagamentos; + PagamentosSintetico = new List(); + PagamentoSintetico val9 = new PagamentoSintetico + { + Titulo = "SINTÉTICO POR SEGURADORA", + Agrupamento = new ObservableCollection() + }; + foreach (IGrouping s2 in (from x in analiticoPagamento + where x.Seguradora != null + orderby x.Seguradora + group x by x.Seguradora).ToList()) + { + List source4 = analiticoPagamento.Where((DadosRelatorio x) => x.Seguradora == s2.Key).ToList(); + AgrupamentoPagamentoSintetico val10 = new AgrupamentoPagamentoSintetico(); + DadosRelatorio? obj5 = ((IEnumerable)source4).FirstOrDefault((Func)((DadosRelatorio n) => n.Seguradora == s2.Key)); + val10.Nome = ((obj5 != null) ? obj5.Seguradora : null); + val10.Repasse = source4.Sum((DadosRelatorio x) => x.Repasse); + val10.VlrLiquido = source4.Sum((DadosRelatorio x) => x.ValorLiquido); + AgrupamentoPagamentoSintetico item4 = val10; + val9.Agrupamento.Add(item4); + } + val9.Agrupamento.Add(new AgrupamentoPagamentoSintetico + { + Nome = "TOTAL", + Repasse = val9.Agrupamento.Sum((AgrupamentoPagamentoSintetico x) => x.Repasse), + VlrLiquido = val9.Agrupamento.Sum((AgrupamentoPagamentoSintetico x) => x.VlrLiquido) + }); + PagamentosSintetico.Add(val9); + PagamentoSintetico val11 = new PagamentoSintetico + { + Titulo = "SINTÉTICO POR RAMO", + Agrupamento = new ObservableCollection() + }; + foreach (IGrouping r in (from x in analiticoPagamento + where x.Ramo != null + orderby x.Ramo + group x by x.Ramo).ToList()) + { + List source5 = (from x in analiticoPagamento + where x.Ramo == r.Key + orderby x.Ramo + select x).ToList(); + AgrupamentoPagamentoSintetico val12 = new AgrupamentoPagamentoSintetico(); + DadosRelatorio? obj6 = ((IEnumerable)source5).FirstOrDefault((Func)((DadosRelatorio n) => n.Ramo == r.Key)); + val12.Nome = ((obj6 != null) ? obj6.Ramo : null); + val12.Repasse = source5.Sum((DadosRelatorio x) => x.Repasse); + val12.VlrLiquido = source5.Sum((DadosRelatorio x) => x.ValorLiquido); + AgrupamentoPagamentoSintetico item5 = val12; + val11.Agrupamento.Add(item5); + } + val11.Agrupamento.Add(new AgrupamentoPagamentoSintetico + { + Nome = "TOTAL", + Repasse = val11.Agrupamento.Sum((AgrupamentoPagamentoSintetico x) => x.Repasse), + VlrLiquido = val11.Agrupamento.Sum((AgrupamentoPagamentoSintetico x) => x.VlrLiquido) + }); + PagamentosSintetico.Add(val11); + PagamentoSintetico val13 = new PagamentoSintetico + { + Titulo = "SINTÉTICO POR VENDEDOR", + Agrupamento = new ObservableCollection() + }; + foreach (IGrouping v2 in (from x in analiticoPagamento + orderby x.Vendedor + group x by x.Vendedor).ToList()) + { + List source6 = analiticoPagamento.Where((DadosRelatorio x) => x.Vendedor == v2.Key).ToList(); + AgrupamentoPagamentoSintetico val14 = new AgrupamentoPagamentoSintetico(); + DadosRelatorio? obj7 = ((IEnumerable)source6).FirstOrDefault((Func)((DadosRelatorio n) => n.Vendedor == v2.Key)); + val14.Nome = ((obj7 != null) ? obj7.Vendedor : null); + val14.Repasse = source6.Sum((DadosRelatorio x) => x.Repasse); + val14.VlrLiquido = source6.Sum((DadosRelatorio x) => x.ValorLiquido); + AgrupamentoPagamentoSintetico item6 = val14; + val13.Agrupamento.Add(item6); + } + val13.Agrupamento.Add(new AgrupamentoPagamentoSintetico + { + Nome = "TOTAL", + Repasse = val13.Agrupamento.Sum((AgrupamentoPagamentoSintetico x) => x.Repasse), + VlrLiquido = val13.Agrupamento.Sum((AgrupamentoPagamentoSintetico x) => x.VlrLiquido) + }); + PagamentosSintetico.Add(val13); + HtmlContent = await GerarHtml(screen: true); + break; + } + case 13: + { + RelatorioFiltroPersonalizado = Funcoes.PopularFiltroPersonalizado(); + List list15 = await _extratoServico.BuscarExtratoPorData(Filtros); + if (list15.Count == 0) + { + ExtratosEnabled = false; + return false; + } + List extratos = ((IEnumerable)list15).Select((Func)delegate(Extrato x) + { + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Unknown result type (might be due to invalid IL or missing references) + //IL_0023: Unknown result type (might be due to invalid IL or missing references) + //IL_0034: Unknown result type (might be due to invalid IL or missing references) + //IL_0045: Unknown result type (might be due to invalid IL or missing references) + //IL_0056: Unknown result type (might be due to invalid IL or missing references) + //IL_0067: Unknown result type (might be due to invalid IL or missing references) + //IL_0078: Unknown result type (might be due to invalid IL or missing references) + //IL_0089: Unknown result type (might be due to invalid IL or missing references) + //IL_009a: Unknown result type (might be due to invalid IL or missing references) + //IL_00ab: Unknown result type (might be due to invalid IL or missing references) + //IL_00bc: Unknown result type (might be due to invalid IL or missing references) + //IL_00f4: Unknown result type (might be due to invalid IL or missing references) + //IL_0105: Unknown result type (might be due to invalid IL or missing references) + //IL_010c: Unknown result type (might be due to invalid IL or missing references) + //IL_011b: Unknown result type (might be due to invalid IL or missing references) + //IL_0128: Expected O, but got Unknown + ExtratoBaixadoRelatorio val30 = new ExtratoBaixadoRelatorio + { + Id = ((DomainBase)x).Id, + Bruto = x.Bruto, + Data = x.Data, + DataCredito = x.DataCredito, + Historico = x.Historico, + Ir = x.Ir, + Iss = x.Iss, + Liquido = x.Liquido, + Numero = x.Numero, + Observacao = x.Observacao + }; + object seguradora; + if (x.Seguradora == null) + { + seguradora = null; + } + else + { + Seguradora? obj20 = ((IEnumerable)Recursos.Seguradoras).FirstOrDefault((Func)((Seguradora p) => ((DomainBase)p).Id == ((DomainBase)x.Seguradora).Id)); + seguradora = ((obj20 != null) ? obj20.Nome : null); + } + val30.Seguradora = (string)seguradora; + val30.Outro = x.Outro; + val30.Status = EnumHelper.GetDescription(x.Status); + val30.Extrato = x; + return val30; + }).ToList(); + Extratos = extratos; + ExtratosFiltrado = new ObservableCollection(Extratos); + break; + } + case 12: + { + if ((fim.Value - inicio.Value).TotalDays < 30.0) + { + await ShowMessage("RECOMENDAMOS FILTRAR UM PERÍODO DE 30 DIAS PARA QUE O RELATÓRIO FUNCIONE CORRETAMENTE."); + } + RelatorioFiltroPersonalizado = Funcoes.PopularFiltroPersonalizado(); + List list4 = await _parcelaServico.FaturaPendente(Filtros); + if (list4.Count == 0) + { + return false; + } + DateTime dateNow = Funcoes.GetNetworkTime(); + List faturaPendente = ((IEnumerable)list4).Select((Func)delegate(Documento x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_018c: Unknown result type (might be due to invalid IL or missing references) + //IL_01b2: Unknown result type (might be due to invalid IL or missing references) + //IL_01c7: Unknown result type (might be due to invalid IL or missing references) + //IL_01dc: Unknown result type (might be due to invalid IL or missing references) + //IL_01e8: Unknown result type (might be due to invalid IL or missing references) + //IL_01f4: Unknown result type (might be due to invalid IL or missing references) + //IL_021a: Unknown result type (might be due to invalid IL or missing references) + //IL_0239: Unknown result type (might be due to invalid IL or missing references) + //IL_029c: Unknown result type (might be due to invalid IL or missing references) + //IL_029e: Unknown result type (might be due to invalid IL or missing references) + //IL_02b6: Unknown result type (might be due to invalid IL or missing references) + //IL_02ce: Unknown result type (might be due to invalid IL or missing references) + //IL_02ef: Unknown result type (might be due to invalid IL or missing references) + //IL_02f6: Unknown result type (might be due to invalid IL or missing references) + //IL_0302: Unknown result type (might be due to invalid IL or missing references) + //IL_0323: Unknown result type (might be due to invalid IL or missing references) + //IL_032f: Unknown result type (might be due to invalid IL or missing references) + //IL_034c: Unknown result type (might be due to invalid IL or missing references) + //IL_039b: Unknown result type (might be due to invalid IL or missing references) + //IL_03ac: Unknown result type (might be due to invalid IL or missing references) + //IL_0419: Unknown result type (might be due to invalid IL or missing references) + //IL_0486: Unknown result type (might be due to invalid IL or missing references) + //IL_04ba: Unknown result type (might be due to invalid IL or missing references) + //IL_04d6: Expected O, but got Unknown + FaturaPendente val40 = new FaturaPendente(); + Parcela? obj35 = x.Parcelas.FirstOrDefault(); + int pendencia; + if (!(((obj35 != null) ? obj35.VigenciaFinal : null) == DateTime.MinValue)) + { + pendencia = (((x.Vigencia2 == DateTime.MinValue || !x.Vigencia2.HasValue) ? dateNow.Year : x.Vigencia2.Value.Year) - x.Parcelas.FirstOrDefault().VigenciaFinal.Value.Year) * 12 + ((x.Vigencia2 == DateTime.MinValue || !x.Vigencia2.HasValue) ? dateNow.Month : x.Vigencia2.Value.Month) - x.Parcelas.FirstOrDefault().VigenciaFinal.Value.Month; + } + else + { + _ = x.Vigencia1; + pendencia = (dateNow.Year - x.Vigencia1.Year) * 12 + (dateNow.Month - x.Vigencia1.Month); + } + val40.Pendencia = pendencia; + Cliente cliente13 = x.Controle.Cliente; + val40.Cliente = ((cliente13 != null) ? cliente13.Nome : null) ?? ""; + val40.Apolice = x.Apolice ?? ""; + val40.Endosso = x.Endosso ?? ""; + val40.VigenciaFinal = x.Vigencia2; + val40.VigenciaInicial = x.Vigencia1; + Produto produto12 = x.Controle.Produto; + val40.Produto = ((produto12 != null) ? produto12.Nome : null) ?? ""; + val40.Ramo = x.Controle.Ramo.Nome ?? ""; + val40.Seguradora = (nomeSeguradora ? x.Controle.Seguradora.Nome : ((!string.IsNullOrWhiteSpace(x.Controle.Seguradora.NomeSocial)) ? x.Controle.Seguradora.NomeSocial : x.Controle.Seguradora.Nome)); + val40.Status = EnumHelper.GetDescription(x.Situacao) ?? ""; + Vendedor vendedorPrincipal10 = x.VendedorPrincipal; + val40.Vendedor = ((vendedorPrincipal10 != null) ? vendedorPrincipal10.Nome : null); + Estipulante estipulante12 = x.Estipulante1; + val40.Estipulante = ((estipulante12 != null) ? estipulante12.Nome : null) ?? ""; + val40.Documento = x; + val40.DataControle = x.DataControle; + Status status11 = x.Status; + val40.StatusApolice = ((status11 != null) ? status11.Nome : null) ?? ""; + val40.Pasta = x.Pasta; + Cliente cliente14 = x.Controle.Cliente; + val40.PastaCliente = ((cliente14 != null) ? cliente14.Pasta : null); + val40.Item = ((x.ItensAtivo == null) ? "" : ((x.ItensAtivo.Count > 1) ? "APÓLICE COLETIVA" : ((x.ItensAtivo.Count == 1) ? x.ItensAtivo.First().Descricao : ""))); + val40.Parcela = x.Parcelas.FirstOrDefault(); + val40.VigenciaFinalFatura = ((x.Parcelas.FirstOrDefault().VigenciaFinal == DateTime.MinValue || !x.Parcelas.FirstOrDefault().VigenciaFinal.HasValue) ? null : x.Parcelas.FirstOrDefault().VigenciaFinal); + val40.VigenciaIncialFatura = ((x.Parcelas.FirstOrDefault().VigenciaIncial == DateTime.MinValue || !x.Parcelas.FirstOrDefault().VigenciaIncial.HasValue) ? null : x.Parcelas.FirstOrDefault().VigenciaIncial); + val40.Fatura = (ValidationHelper.IsNullOrEmpty(x.Parcelas.FirstOrDefault().Fatura) ? "0" : x.Parcelas.FirstOrDefault().Fatura); + val40.Vencimento = x.Parcelas.FirstOrDefault().Vencimento; + return val40; + }).ToList(); + FaturaPendente = faturaPendente; + FaturaPendenteFiltrado = new ObservableCollection(FaturaPendente); + break; + } + case 14: + { + RelatorioFiltroPersonalizado = Funcoes.PopularFiltroPersonalizado(); + Filtros filtros3 = Filtros; + int selectedAno4 = SelectedAno; + selectedMes = SelectedMes; + filtros3.Inicio = new DateTime(selectedAno4, ((object)(Mes)(ref selectedMes)).GetHashCode(), 1); + Filtros filtros4 = Filtros; + int selectedAno5 = SelectedAno; + selectedMes = SelectedMes; + int hashCode2 = ((object)(Mes)(ref selectedMes)).GetHashCode(); + int selectedAno6 = SelectedAno; + selectedMes = SelectedMes; + filtros4.Fim = new DateTime(selectedAno5, hashCode2, DateTime.DaysInMonth(selectedAno6, ((object)(Mes)(ref selectedMes)).GetHashCode())); + DateTime value = (Inicio = Filtros.Inicio); + inicio = value; + value = (Fim = Filtros.Fim); + fim = value; + List metasSeguradoras = await _metaSeguradoraServico.BuscarMetasSeguradoras(Filtros); + if (Filtros.Seguradoras.Count == 0) + { + Filtros.Seguradoras.AddRange(metasSeguradoras.Select((MetaSeguradora x) => ((DomainBase)x.Seguradora).Id)); + } + List prodParcelasSeg = await _apoliceServico.BuscarApolices(Filtros); + List collection3 = await _parcelaServico.BuscarFaturas(Filtros); + prodParcelasSeg.AddRange(collection3); + if (metasSeguradoras.Count == 0) + { + ExtratosEnabled = false; + return false; + } + List metasS = new List(); + metasSeguradoras.ForEach(delegate(MetaSeguradora x) + { + //IL_0013: Unknown result type (might be due to invalid IL or missing references) + //IL_0018: Unknown result type (might be due to invalid IL or missing references) + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_003f: Unknown result type (might be due to invalid IL or missing references) + //IL_0050: Unknown result type (might be due to invalid IL or missing references) + //IL_0096: Expected O, but got Unknown + metasS.Add(new MetaSeguradoraRelatorio + { + Id = ((DomainBase)x).Id, + Seguradora = x.Seguradora.Nome, + MetaAtingir = x.Valor, + MetaCumprida = prodParcelasSeg.Where((Documento y) => ((DomainBase)y.Controle.Seguradora).Id.Equals(((DomainBase)x.Seguradora).Id)).Sum((Documento y) => y.PremioLiquido) + }); + }); + MetaSeguradora = metasS; + MetaSeguradoraFiltrado = new ObservableCollection(MetaSeguradora); + break; + } + case 15: + { + RelatorioFiltroPersonalizado = Funcoes.PopularFiltroPersonalizado(); + Filtros filtros = Filtros; + int selectedAno = SelectedAno; + selectedMes = SelectedMes; + filtros.Inicio = new DateTime(selectedAno, ((object)(Mes)(ref selectedMes)).GetHashCode(), 1); + Filtros filtros2 = Filtros; + int selectedAno2 = SelectedAno; + selectedMes = SelectedMes; + int hashCode = ((object)(Mes)(ref selectedMes)).GetHashCode(); + int selectedAno3 = SelectedAno; + selectedMes = SelectedMes; + filtros2.Fim = new DateTime(selectedAno2, hashCode, DateTime.DaysInMonth(selectedAno3, ((object)(Mes)(ref selectedMes)).GetHashCode())); + List metasVendedores = await _metaVendedorServico.BuscarMetasVendedores(Filtros); + Inicio = Filtros.Inicio; + Fim = Filtros.Fim; + List prodParcelasVen = await _apoliceServico.BuscarApolices(Filtros); + List collection = await _parcelaServico.BuscarFaturas(Filtros); + prodParcelasVen.AddRange(collection); + List vends = metasVendedores.Select((MetaVendedor x) => ((DomainBase)x.Vendedor).Id).ToList(); + prodParcelasVen = prodParcelasVen.Where((Documento x) => vends.Any((long m) => x.Vendedores.Select((Vendedor v) => ((DomainBase)v).Id).Contains(m))).ToList(); + if (metasVendedores.Count == 0) + { + ExtratosEnabled = false; + return false; + } + List metasV = new List(); + metasVendedores.ForEach(delegate(MetaVendedor x) + { + //IL_0036: Unknown result type (might be due to invalid IL or missing references) + //IL_003b: Unknown result type (might be due to invalid IL or missing references) + //IL_004c: Unknown result type (might be due to invalid IL or missing references) + //IL_0062: Unknown result type (might be due to invalid IL or missing references) + //IL_0073: Unknown result type (might be due to invalid IL or missing references) + //IL_0084: Expected O, but got Unknown + decimal premioLiquido = default(decimal); + prodParcelasVen.ForEach(delegate(Documento y) + { + if (y.Vendedores.Any((Vendedor v) => ((DomainBase)v).Id == ((DomainBase)x.Vendedor).Id)) + { + premioLiquido += y.PremioLiquido; + } + }); + metasV.Add(new MetaVendedorRelatorio + { + Id = ((DomainBase)x).Id, + Vendedor = x.Vendedor.Nome, + MetaAtingir = x.Valor, + MetaCumprida = premioLiquido + }); + }); + MetaVendedor = metasV; + MetaVendedorFiltrado = new ObservableCollection(MetaVendedor); + break; + } + case 19: + { + RelatorioFiltroPersonalizado = Funcoes.PopularFiltroPersonalizado(); + List list8 = ((IEnumerable)(await _notaFiscalServico.BuscarNotasFiscais(Filtros))).Select((Func)delegate(NotaFiscal x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + //IL_002b: Unknown result type (might be due to invalid IL or missing references) + //IL_0037: Unknown result type (might be due to invalid IL or missing references) + //IL_0043: Unknown result type (might be due to invalid IL or missing references) + //IL_004f: Unknown result type (might be due to invalid IL or missing references) + //IL_005b: Unknown result type (might be due to invalid IL or missing references) + //IL_007c: Unknown result type (might be due to invalid IL or missing references) + //IL_0088: Unknown result type (might be due to invalid IL or missing references) + //IL_00a3: Expected O, but got Unknown + NotaFiscalRelatorio val39 = new NotaFiscalRelatorio + { + Seguradora = (x.Seguradora.Nome ?? ""), + Liquido = x.ValorLiquido, + Ir = x.Ir, + Iss = x.Iss, + Bruto = x.ValorBruto, + Data = x.Data + }; + Estipulante estipulante11 = x.Estipulante; + val39.Estipulante = ((estipulante11 != null) ? estipulante11.Nome : null) ?? ""; + val39.Extrato = x.Extrato; + val39.Cnpj = x.Seguradora.Documento ?? ""; + return val39; + }).ToList(); + if (list8.Count == 0) + { + ExtratosEnabled = false; + return false; + } + NotasFiscais = list8.OrderBy((NotaFiscalRelatorio x) => x.Seguradora).ToList(); + NotaFiscalFiltrado = new ObservableCollection(NotasFiscais); + break; + } + case 20: + { + List list5 = await _parcelaServico.BuscarPrevisaoPagamentoComissao(Filtros); + if (list5 == null) + { + ExtratosEnabled = false; + return false; + } + PrevisaoSintetico = new ObservableCollection(); + PrevisaoPagamentoComissaoSintetico val2 = new PrevisaoPagamentoComissaoSintetico + { + Titulo = "SINTÉTICO POR SEGURADORA", + Agrupamento = new ObservableCollection() + }; + foreach (IGrouping s3 in (from x in list5 + orderby x.Seguradora + group x by x.Seguradora).ToList()) + { + List source = list5.Where((PrevisaoPagamento x) => x.Seguradora == s3.Key).ToList(); + AgrupamentoSintetico val3 = new AgrupamentoSintetico(); + PrevisaoPagamento? obj = ((IEnumerable)source).FirstOrDefault((Func)((PrevisaoPagamento n) => n.Seguradora == s3.Key)); + val3.Nome = ((obj != null) ? obj.Seguradora.ToUpper() : null); + val3.PrevisaoPagamento = source.Sum((PrevisaoPagamento x) => x.Repasse); + val3.PrevisaoLiquida = source.Sum((PrevisaoPagamento x) => x.RepasseLiquido); + AgrupamentoSintetico item = val3; + val2.Agrupamento.Add(item); + } + val2.Agrupamento.Add(new AgrupamentoSintetico + { + Nome = "TOTAL", + PrevisaoPagamento = val2.Agrupamento.Sum((AgrupamentoSintetico x) => x.PrevisaoPagamento), + PrevisaoLiquida = val2.Agrupamento.Sum((AgrupamentoSintetico x) => x.PrevisaoLiquida) + }); + PrevisaoSintetico.Add(val2); + PrevisaoPagamentoComissaoSintetico val4 = new PrevisaoPagamentoComissaoSintetico + { + Titulo = "SINTÉTICO POR RAMO", + Agrupamento = new ObservableCollection() + }; + foreach (IGrouping r2 in (from x in list5 + orderby x.Ramo + group x by x.Ramo).ToList()) + { + List source2 = (from x in list5 + where x.Ramo == r2.Key + orderby x.Ramo + select x).ToList(); + AgrupamentoSintetico val5 = new AgrupamentoSintetico(); + PrevisaoPagamento? obj2 = ((IEnumerable)source2).FirstOrDefault((Func)((PrevisaoPagamento n) => n.Ramo == r2.Key)); + val5.Nome = ((obj2 != null) ? obj2.Ramo.ToUpper() : null); + val5.PrevisaoPagamento = source2.Sum((PrevisaoPagamento x) => x.Repasse); + val5.PrevisaoLiquida = source2.Sum((PrevisaoPagamento x) => x.RepasseLiquido); + AgrupamentoSintetico item2 = val5; + val4.Agrupamento.Add(item2); + } + val4.Agrupamento.Add(new AgrupamentoSintetico + { + Nome = "TOTAL", + PrevisaoPagamento = val4.Agrupamento.Sum((AgrupamentoSintetico x) => x.PrevisaoPagamento), + PrevisaoLiquida = val4.Agrupamento.Sum((AgrupamentoSintetico x) => x.PrevisaoLiquida) + }); + PrevisaoSintetico.Add(val4); + PrevisaoPagamentoComissaoSintetico val6 = new PrevisaoPagamentoComissaoSintetico + { + Titulo = "SINTÉTICO POR VENDEDOR", + Agrupamento = new ObservableCollection() + }; + foreach (IGrouping v4 in (from x in list5 + orderby x.Vendedor.Nome + group x by ((DomainBase)x.Vendedor).Id).ToList()) + { + List source3 = list5.Where((PrevisaoPagamento x) => ((DomainBase)x.Vendedor).Id == v4.Key).ToList(); + AgrupamentoSintetico val7 = new AgrupamentoSintetico(); + PrevisaoPagamento? obj3 = ((IEnumerable)source3).FirstOrDefault((Func)((PrevisaoPagamento n) => ((DomainBase)n.Vendedor).Id == v4.Key)); + val7.Nome = ((obj3 != null) ? obj3.Vendedor.Nome.ToUpper() : null); + val7.PrevisaoPagamento = source3.Sum((PrevisaoPagamento x) => x.Repasse); + val7.PrevisaoLiquida = source3.Sum((PrevisaoPagamento x) => x.RepasseLiquido); + AgrupamentoSintetico item3 = val7; + val6.Agrupamento.Add(item3); + } + val6.Agrupamento.Add(new AgrupamentoSintetico + { + Nome = "TOTAL", + PrevisaoPagamento = val6.Agrupamento.Sum((AgrupamentoSintetico x) => x.PrevisaoPagamento), + PrevisaoLiquida = val6.Agrupamento.Sum((AgrupamentoSintetico x) => x.PrevisaoLiquida) + }); + PrevisaoSintetico.Add(val6); + List> list6 = (from x in list5 + group x by ((DomainBase)x.Vendedor).Id).ToList(); + Previsao = new ObservableCollection(); + foreach (IGrouping v3 in list6) + { + List list7 = list5.Where((PrevisaoPagamento x) => ((DomainBase)x.Vendedor).Id == v3.Key).ToList(); + list7.Add(new PrevisaoPagamento + { + Nome = "TOTAL", + PremioLiquido = list7.Sum((PrevisaoPagamento x) => x.PremioLiquido), + RepasseLiquido = list7.Sum((PrevisaoPagamento x) => x.RepasseLiquido) + }); + ObservableCollection previsao = Previsao; + PrevisaoPagamentoComissao val8 = new PrevisaoPagamentoComissao(); + PrevisaoPagamento? obj4 = ((IEnumerable)list7).FirstOrDefault((Func)((PrevisaoPagamento x) => ((DomainBase)x.Vendedor).Id == v3.Key)); + val8.Vendedor = ((obj4 != null) ? obj4.Vendedor.Nome.ToUpper() : null); + val8.PrevisaoPagamento = new ObservableCollection(list7); + previsao.Add(val8); + } + Previsao = new ObservableCollection(Previsao.OrderBy((PrevisaoPagamentoComissao x) => x.Vendedor)); + PrevisaoFiltrado = new ObservableCollection(Previsao); + HtmlContent = await GerarHtml(screen: true); + break; + } + case 23: + { + RelatorioFiltroPersonalizado = Funcoes.PopularFiltroPersonalizado(); + List list3 = await _logServico.BuscarLogsEnvio(Filtros); + if (list3.Count == 0) + { + ExtratosEnabled = false; + return false; + } + LogsEnvio = list3; + LogsEnvioFiltrado = new ObservableCollection(LogsEnvio); + break; + } + case 24: + { + RelatorioFiltroPersonalizado = Funcoes.PopularFiltroPersonalizado(); + List list21 = await _logServico.BuscarLogs(Filtros); + if (list21.Count == 0) + { + ExtratosEnabled = false; + return false; + } + LogUtilizacao = ((IEnumerable)list21).Select((Func)((RegistroAcao x) => new LogAcaoRelatorio + { + RegistroEntity = x, + EntidadeId = x.EntidadeId, + Acesso = ((!x.Tela.HasValue) ? EnumHelper.GetDescription(x.Relatorio) : EnumHelper.GetDescription(x.Tela)), + Data = x.DataHora, + Descricao = x.Descricao, + Ip = x.Ip, + Maquina = x.NomeMaquina, + UsuarioAgger = x.Usuario.Nome, + UsuarioMaquina = x.UsuarioMaquina, + Versao = x.Versao + })).ToList(); + LogUtilizacaoFiltrado = new ObservableCollection(LogUtilizacao); + break; + } + case 25: + { + RelatorioFiltroPersonalizado = Funcoes.PopularFiltroPersonalizado(); + List list16 = await _logServico.BuscarLogsAntigos(Filtros); + if (list16.Count == 0) + { + ExtratosEnabled = false; + return false; + } + LogUtilizacao = ((IEnumerable)list16).Select((Func)delegate(RegistroAcao x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_0018: Unknown result type (might be due to invalid IL or missing references) + //IL_0046: Unknown result type (might be due to invalid IL or missing references) + //IL_0052: Unknown result type (might be due to invalid IL or missing references) + //IL_005e: Unknown result type (might be due to invalid IL or missing references) + //IL_006a: Unknown result type (might be due to invalid IL or missing references) + //IL_0076: Unknown result type (might be due to invalid IL or missing references) + //IL_008e: Unknown result type (might be due to invalid IL or missing references) + //IL_009a: Unknown result type (might be due to invalid IL or missing references) + //IL_00a7: Expected O, but got Unknown + LogAcaoRelatorio val28 = new LogAcaoRelatorio + { + RegistroEntity = x, + EntidadeId = x.EntidadeId, + Acesso = ((!x.Tela.HasValue) ? EnumHelper.GetDescription(x.Relatorio) : EnumHelper.GetDescription(x.Tela)), + Data = x.DataHora, + Descricao = x.Descricao, + Ip = x.Ip, + Maquina = x.NomeMaquina + }; + Usuario usuario2 = x.Usuario; + val28.UsuarioAgger = ((usuario2 != null) ? usuario2.Nome : null); + val28.UsuarioMaquina = x.UsuarioMaquina; + val28.Versao = x.Versao; + return val28; + }).ToList(); + LogUtilizacaoFiltrado = new ObservableCollection(LogUtilizacao); + break; + } + case 26: + { + RelatorioFiltroPersonalizado = Funcoes.PopularFiltroPersonalizado(); + List list14 = await _criticaServico.BuscarCritica(Inicio, Fim); + if (list14.Count == 0) + { + return false; + } + ApoliceCritica = ((IEnumerable)list14).Select((Func)delegate(CriticaApolice x) + { + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Unknown result type (might be due to invalid IL or missing references) + //IL_001e: Unknown result type (might be due to invalid IL or missing references) + //IL_007d: Unknown result type (might be due to invalid IL or missing references) + //IL_009d: Unknown result type (might be due to invalid IL or missing references) + //IL_00b3: Unknown result type (might be due to invalid IL or missing references) + //IL_00c9: Unknown result type (might be due to invalid IL or missing references) + //IL_00df: Unknown result type (might be due to invalid IL or missing references) + //IL_00f5: Unknown result type (might be due to invalid IL or missing references) + //IL_0115: Unknown result type (might be due to invalid IL or missing references) + //IL_0135: Unknown result type (might be due to invalid IL or missing references) + //IL_017c: Unknown result type (might be due to invalid IL or missing references) + //IL_0195: Unknown result type (might be due to invalid IL or missing references) + //IL_01b2: Unknown result type (might be due to invalid IL or missing references) + //IL_01c3: Unknown result type (might be due to invalid IL or missing references) + //IL_0209: Expected O, but got Unknown + ApoliceCritica val33 = new ApoliceCritica + { + Critica = x, + Pendencia = (x.Critica.GetValueOrDefault() ? "" : $"{(DateTime.Today - x.DataImportacao.Value.Date).TotalDays} DIAS"), + Cliente = x.Documento.Controle.Cliente.Nome, + Proposta = x.Documento.Proposta, + Apolice = x.Documento.Apolice, + PropostaEndosso = x.Documento.PropostaEndosso, + VigenciaInicial = x.Documento.Vigencia1, + Ramo = x.Documento.Controle.Ramo.Nome, + Seguradora = x.Documento.Controle.Seguradora.Nome, + Tipo = ((x.Tipo == "0") ? "PROPOSTA" : ((x.Tipo == "1") ? "APÓLICE" : "PROPOSTA DE ENDOSSO")), + Importado = x.DataImportacao.Value + }; + Usuario usuarioImportacao = x.UsuarioImportacao; + val33.UsuarioImportacao = ((usuarioImportacao != null) ? usuarioImportacao.Nome : null); + val33.Criticado = x.DataCritica; + object usuarioCritica; + if (!x.UsuarioCritica.HasValue) + { + usuarioCritica = ""; + } + else + { + Usuario? obj21 = ((IEnumerable)Recursos.Usuarios).FirstOrDefault((Func)((Usuario u) => ((DomainBase)u).Id == x.UsuarioCritica)); + usuarioCritica = ((obj21 != null) ? obj21.Nome : null); + } + val33.UsuarioCritica = (string)usuarioCritica; + return val33; + }).ToList(); + ApoliceCriticaFiltrado = new ObservableCollection(ApoliceCritica); + break; + } + case 28: + { + RelatorioFiltroPersonalizado = Funcoes.PopularFiltroPersonalizado(); + List list9 = await _apoliceServico.BuscarEndossos(Filtros, LicenseHelper.Produtos.Any((Licenca x) => (int)x.Produto == 86 && x.Status != 3)); + if (list9.Count == 0) + { + ExtratosEnabled = false; + return false; + } + List endossoo = ((IEnumerable)list9).Select((Func)delegate(Documento x) + { + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Unknown result type (might be due to invalid IL or missing references) + //IL_003d: Unknown result type (might be due to invalid IL or missing references) + //IL_0057: Unknown result type (might be due to invalid IL or missing references) + //IL_0071: Unknown result type (might be due to invalid IL or missing references) + //IL_0090: Unknown result type (might be due to invalid IL or missing references) + //IL_00aa: Unknown result type (might be due to invalid IL or missing references) + //IL_00c4: Unknown result type (might be due to invalid IL or missing references) + //IL_00d5: Unknown result type (might be due to invalid IL or missing references) + //IL_00f0: Unknown result type (might be due to invalid IL or missing references) + //IL_0108: Unknown result type (might be due to invalid IL or missing references) + //IL_0119: Unknown result type (might be due to invalid IL or missing references) + //IL_012a: Unknown result type (might be due to invalid IL or missing references) + //IL_013b: Unknown result type (might be due to invalid IL or missing references) + //IL_014c: Unknown result type (might be due to invalid IL or missing references) + //IL_015d: Unknown result type (might be due to invalid IL or missing references) + //IL_016e: Unknown result type (might be due to invalid IL or missing references) + //IL_017f: Unknown result type (might be due to invalid IL or missing references) + //IL_01aa: Unknown result type (might be due to invalid IL or missing references) + //IL_01ce: Unknown result type (might be due to invalid IL or missing references) + //IL_023b: Unknown result type (might be due to invalid IL or missing references) + //IL_0242: Unknown result type (might be due to invalid IL or missing references) + //IL_025a: Unknown result type (might be due to invalid IL or missing references) + //IL_0277: Unknown result type (might be due to invalid IL or missing references) + //IL_0288: Unknown result type (might be due to invalid IL or missing references) + //IL_02ae: Unknown result type (might be due to invalid IL or missing references) + //IL_0313: Unknown result type (might be due to invalid IL or missing references) + //IL_0324: Unknown result type (might be due to invalid IL or missing references) + //IL_0358: Unknown result type (might be due to invalid IL or missing references) + //IL_0369: Unknown result type (might be due to invalid IL or missing references) + //IL_038f: Unknown result type (might be due to invalid IL or missing references) + //IL_03a5: Unknown result type (might be due to invalid IL or missing references) + //IL_03c6: Unknown result type (might be due to invalid IL or missing references) + //IL_03d2: Unknown result type (might be due to invalid IL or missing references) + //IL_0435: Unknown result type (might be due to invalid IL or missing references) + //IL_0446: Unknown result type (might be due to invalid IL or missing references) + //IL_0465: Unknown result type (might be due to invalid IL or missing references) + //IL_0484: Unknown result type (might be due to invalid IL or missing references) + //IL_048b: Unknown result type (might be due to invalid IL or missing references) + //IL_0495: Unknown result type (might be due to invalid IL or missing references) + //IL_04a6: Unknown result type (might be due to invalid IL or missing references) + //IL_04fa: Unknown result type (might be due to invalid IL or missing references) + //IL_0510: Unknown result type (might be due to invalid IL or missing references) + //IL_0521: Unknown result type (might be due to invalid IL or missing references) + //IL_053c: Unknown result type (might be due to invalid IL or missing references) + //IL_0558: Expected O, but got Unknown + Endosso val38 = new Endosso(); + Cliente cliente12 = x.Controle.Cliente; + val38.Cliente = ((cliente12 != null) ? cliente12.Nome : null) ?? ""; + val38.Proposta = x.Proposta ?? ""; + val38.Apolice = x.Apolice ?? ""; + val38.ApoliceConferida = (x.ApoliceConferida ? "SIM" : "NÃO"); + val38.PropostaEndosso = x.PropostaEndosso ?? ""; + val38.NumEndosso = x.Endosso ?? ""; + val38.Comissao = x.Comissao; + NegocioCorretora? negocioCorretora5 = x.NegocioCorretora; + val38.Negocio = (negocioCorretora5.HasValue ? EnumHelper.GetDescription(negocioCorretora5.GetValueOrDefault()) : null) ?? ""; + val38.PremioLiquido = x.PremioLiquido; + val38.PremioTotal = x.PremioTotal; + val38.NumeroParcelas = x.NumeroParcelas; + val38.Emissao = x.Emissao; + val38.VigenciaFinal = x.Vigencia2; + val38.VigenciaInicial = x.Vigencia1; + val38.Remessa = x.Remessa; + Produto produto11 = x.Controle.Produto; + val38.Produto = ((produto11 != null) ? produto11.Nome : null) ?? ""; + val38.Ramo = x.Controle.Ramo.Nome ?? ""; + val38.Seguradora = (nomeSeguradora ? x.Controle.Seguradora.Nome : ((!string.IsNullOrWhiteSpace(x.Controle.Seguradora.NomeSocial)) ? x.Controle.Seguradora.NomeSocial : x.Controle.Seguradora.Nome)); + val38.Status = EnumHelper.GetDescription(x.Situacao) ?? ""; + Vendedor vendedorPrincipal9 = x.VendedorPrincipal; + val38.Vendedor = ((vendedorPrincipal9 != null) ? vendedorPrincipal9.Nome : null); + val38.RepasseVendedor = x.PercentualRepasse; + Estipulante estipulante10 = x.Estipulante1; + val38.Estipulante = ((estipulante10 != null) ? estipulante10.Nome : null) ?? ""; + val38.TodosVendedores = ((x.Vendedores == null || x.Vendedores.Count == 0) ? "" : string.Join("; ", x.Vendedores.Select((Vendedor v) => v.Nome))); + val38.Tipo = x.Tipo; + val38.TipoDocumento = ((x.Tipo == 0) ? "APÓLICE" : ((x.Tipo == 1) ? "ENDOSSO" : "FATURA")); + val38.DataControle = x.DataControle; + Status status10 = x.Status; + val38.StatusApolice = ((status10 != null) ? status10.Nome : null) ?? ""; + val38.IdEmpresa = x.Controle.IdEmpresa; + val38.Empresa = ((IEnumerable)Recursos.Empresas).FirstOrDefault((Func)((Empresa empresa) => ((DomainBase)empresa).Id == x.Controle.IdEmpresa)).NomeSocial; + val38.Documento = x; + val38.Item = ((x.ItensAtivo == null) ? "" : ((x.ItensAtivo.Count > 1) ? "APÓLICE COLETIVA" : ((x.ItensAtivo.Count == 1) ? x.ItensAtivo.First().Descricao : ""))); + val38.Assinaturas = x.Assinaturas; + val38.AssinadaSiggner = (x.AssinadaSiggner ? "SIM" : "NÃO"); + val38.PropAssinada = (x.PropostaAssinada ? "SIM" : "NÃO"); + val38.StatusAssinatura = x.StatusAssinatura; + val38.Pasta = x.Pasta; + val38.ComissaoGerada = (x.PremioLiquido + (x.AdicionalComiss ? x.PremioAdicional : 0m)) * x.Comissao * 0.01m; + val38.TipoPagamento = EnumHelper.GetDescription(x.TipoRecebimento); + val38.DataCriacao = x.DataCriacao; + val38.PastaCliente = x.Controle.Cliente.Pasta; + val38.DocumentoCliente = x.Controle.Cliente.Documento; + return val38; + }).ToList(); + Endossoo = endossoo; + EndossoFiltrado = new ObservableCollection(Endossoo); + break; + } + case 29: + { + RelatorioFiltroPersonalizado = Funcoes.PopularFiltroPersonalizado(); + List list2 = await _clienteServico.BuscarClassificacoes(); + if (list2.Count == 0) + { + ExtratosEnabled = false; + return false; + } + List classificacao = ((IEnumerable)list2).Select((Func)((Classificacao x) => new Classificacao + { + EntidadeCliente = x.EntidadeCliente, + Nome = x.Nome, + Premioliquido = x.Premioliquido, + Resultado = x.Resultado, + Comissao = x.Comissao, + Geral = x.Geral, + Ativo = x.Ativo + })).ToList(); + Classificacao = classificacao; + ClassificacaoFiltrado = new ObservableCollection(Classificacao); + break; + } + } + RegistrarAcao($"EMITIU RELATÓRIO PERÍODO ENTRE {Inicio:d} E {Fim:d}", Relatorio, Filtros); + PostMonitor(); + } + catch + { + string text = ""; + if ((int)Relatorio != 0 && (int)Relatorio != 15 && (int)Relatorio != 14) + { + text = " DE " + Inicio.ToShortDateString() + " ATÉ " + Fim.ToShortDateString(); + } + await ShowMessage("ERRO AO GERAR " + EnumHelper.GetDescription(Relatorio) + text + ".\nFAVOR ENTRAR EM CONTATO COM A AGGER."); + return false; + } + return true; + } + + private static string UltimaMovimentacaoSinistro(Sinistro x) + { + _ = x.IdUsuarioAlteracao; + if (x.IdUsuarioAlteracao != 0L) + { + return $"{x.DataAlteracao} / {Recursos.Usuarios.First((Usuario usuario) => ((DomainBase)usuario).Id == x.IdUsuarioAlteracao).Nome}"; + } + _ = x.IdUsuarioCriacao; + if (x.IdUsuarioCriacao != 0L) + { + return $"{x.DataCriacao} / {Recursos.Usuarios.First((Usuario usuario) => ((DomainBase)usuario).Id == x.IdUsuarioCriacao).Nome}"; + } + return ""; + } + + private static string JoinTelefones(List telefones) + { + if (telefones != null) + { + return string.Join(" | ", telefones.Select((ClienteTelefone v) => ((TelefoneBase)v).Prefixo + " " + ((TelefoneBase)v).Numero)); + } + return ""; + } + + private static string JoinEmails(List emails) + { + if (emails != null) + { + return string.Join(" | ", (from v in emails + where !string.IsNullOrEmpty(((EmailBase)v).Email) + select ((EmailBase)v).Email).Distinct()); + } + return ""; + } + + public async Task Print(bool pageBreak = false) + { + string html = ""; + Relatorio relatorio = Relatorio; + switch ((int)relatorio) + { + case 0: + case 1: + { + if (ClientesAtivosInativosFiltrado == null || ClientesAtivosInativosFiltrado.Count == 0) + { + return; + } + ConfiguracaoImpressao parametros = await ShowDialogPrint(Relatorio, ((object)ClientesAtivosInativosFiltrado.First()).GetType()); + if (parametros == null || !parametros.Campos.Any()) + { + return; + } + html = await GerarHtml(screen: false, pageBreak, parametros); + break; + } + case 17: + { + if (LicenciamentoFiltrado == null || LicenciamentoFiltrado.Count == 0) + { + return; + } + ConfiguracaoImpressao parametros = await ShowDialogPrint(Relatorio, ((object)LicenciamentoFiltrado.First()).GetType()); + if (parametros == null || !parametros.Campos.Any()) + { + return; + } + html = await GerarHtml(screen: false, pageBreak, parametros); + break; + } + case 18: + { + if (TarefaFiltrado == null || TarefaFiltrado.Count == 0) + { + return; + } + ConfiguracaoImpressao parametros = await ShowDialogPrint(Relatorio, ((object)TarefaFiltrado.First()).GetType()); + if (parametros == null || !parametros.Campos.Any()) + { + return; + } + html = await GerarHtml(screen: false, pageBreak, parametros); + break; + } + case 2: + { + if (ProducaoFiltrado == null || ProducaoFiltrado.Count == 0) + { + return; + } + ConfiguracaoImpressao parametros = await ShowDialogPrint(Relatorio, ((object)ProducaoFiltrado.First()).GetType()); + if (parametros == null || !parametros.Campos.Any()) + { + return; + } + html = await GerarHtml(screen: false, pageBreak, parametros); + break; + } + case 3: + { + if (ApolicePendenteFiltrado == null || ApolicePendenteFiltrado.Count == 0) + { + return; + } + ConfiguracaoImpressao parametros = await ShowDialogPrint(Relatorio, ((object)ApolicePendenteFiltrado.First()).GetType()); + if (parametros == null || !parametros.Campos.Any()) + { + return; + } + html = await GerarHtml(screen: false, pageBreak, parametros); + break; + } + case 4: + { + if (RenovacaoFiltrado == null || RenovacaoFiltrado.Count == 0) + { + return; + } + ConfiguracaoImpressao parametros = await ShowDialogPrint(Relatorio, ((object)RenovacaoFiltrado.First()).GetType()); + if (parametros == null || !parametros.Campos.Any()) + { + return; + } + html = await GerarHtml(screen: false, pageBreak, parametros); + break; + } + case 5: + { + if (ComissaoFiltrado == null || ComissaoFiltrado.Count == 0) + { + return; + } + ConfiguracaoImpressao parametros = await ShowDialogPrint(Relatorio, ((object)ComissaoFiltrado.First()).GetType()); + if (parametros == null || !parametros.Campos.Any()) + { + return; + } + html = await GerarHtml(screen: false, pageBreak, parametros); + break; + } + case 9: + case 10: + { + if (SinistroFiltrado == null || SinistroFiltrado.Count == 0) + { + return; + } + ConfiguracaoImpressao parametros = await ShowDialogPrint(Relatorio, ((object)SinistroFiltrado.First()).GetType()); + if (parametros == null || !parametros.Campos.Any()) + { + return; + } + html = await GerarHtml(screen: false, pageBreak, parametros); + break; + } + case 23: + { + if (LogsEnvioFiltrado == null || LogsEnvioFiltrado.Count == 0) + { + return; + } + ConfiguracaoImpressao parametros = await ShowDialogPrint(Relatorio, ((object)LogsEnvioFiltrado.First()).GetType()); + if (parametros == null || !parametros.Campos.Any()) + { + return; + } + html = await GerarHtml(screen: false, pageBreak, parametros); + break; + } + case 6: + case 16: + { + if (PendenteFiltrado == null || PendenteFiltrado.Count == 0) + { + return; + } + ConfiguracaoImpressao parametros = await ShowDialogPrint(Relatorio, ((object)PendenteFiltrado.First()).GetType()); + if (parametros == null || !parametros.Campos.Any()) + { + return; + } + html = await GerarHtml(screen: false, pageBreak, parametros); + break; + } + case 8: + { + if (AuditoriaFiltrado == null || AuditoriaFiltrado.Count == 0) + { + return; + } + ConfiguracaoImpressao parametros = await ShowDialogPrint(Relatorio, ((object)AuditoriaFiltrado.First()).GetType()); + if (parametros == null || !parametros.Campos.Any()) + { + return; + } + html = await GerarHtml(screen: false, pageBreak, parametros); + break; + } + case 7: + { + if (Pagamentos == null || Pagamentos.Count == 0) + { + return; + } + ConfiguracaoImpressao parametros = await ShowDialogPrint(Relatorio, ((object)Pagamentos.First()).GetType()); + if (parametros == null || !parametros.Campos.Any()) + { + return; + } + bool flag = Pagamentos.All((Pagamento x) => x.Dados.Any((DadosRelatorio p) => !p.DataPagamento.HasValue)) && SomenteNaoPagos; + if (flag) + { + flag = await ShowMessage("DESEJA REALMENTE EMITIR O RECIBO DE PAGAMENTO DOS VENDEDORES LISTADOS?" + Environment.NewLine + "ESSE PROCEDIMENTO IRÁ GERAR O PAGAMENTO DO REPASSE DAS PARCELAS PRESENTES NA LISTAGEM.", "SIM", "NÃO"); + } + if (flag) + { + ReciboPagamento = true; + } + Carregando = true; + base.IsEnabled = false; + html = await GerarHtml(screen: false, pageBreak, parametros); + if (ReciboPagamento) + { + await GerarPagamento(Pagamentos.ToList()); + } + ReciboPagamento = false; + break; + } + case 12: + { + if (FaturaPendenteFiltrado == null || FaturaPendenteFiltrado.Count == 0) + { + return; + } + ConfiguracaoImpressao parametros = await ShowDialogPrint(Relatorio, ((object)FaturaPendenteFiltrado.First()).GetType()); + if (parametros == null || !parametros.Campos.Any()) + { + return; + } + html = await GerarHtml(screen: false, pageBreak, parametros); + break; + } + case 11: + { + if (FechamentoFiltrado == null || FechamentoFiltrado.Count == 0) + { + return; + } + ConfiguracaoImpressao parametros = await ShowDialogPrint(Relatorio, ((object)FechamentoFiltrado.First()).GetType()); + if (parametros == null || !parametros.Campos.Any()) + { + return; + } + html = await GerarHtml(screen: false, pageBreak, parametros); + break; + } + case 14: + { + if (MetaSeguradoraFiltrado == null || MetaSeguradoraFiltrado.Count == 0) + { + return; + } + ConfiguracaoImpressao parametros = await ShowDialogPrint(Relatorio, ((object)MetaSeguradoraFiltrado.First()).GetType()); + if (parametros == null || !parametros.Campos.Any()) + { + return; + } + html = await GerarHtml(screen: false, pageBreak, parametros); + break; + } + case 15: + { + if (MetaVendedorFiltrado == null || MetaVendedorFiltrado.Count == 0) + { + return; + } + ConfiguracaoImpressao parametros = await ShowDialogPrint(Relatorio, ((object)MetaVendedorFiltrado.First()).GetType()); + if (parametros == null || !parametros.Campos.Any()) + { + return; + } + html = await GerarHtml(screen: false, pageBreak, parametros); + break; + } + case 19: + { + if (NotaFiscalFiltrado == null || NotaFiscalFiltrado.Count == 0) + { + return; + } + ConfiguracaoImpressao parametros = await ShowDialogPrint(Relatorio, ((object)NotaFiscalFiltrado.First()).GetType()); + if (parametros == null || !parametros.Campos.Any()) + { + return; + } + html = await GerarHtml(screen: false, pageBreak, parametros); + break; + } + case 20: + { + if (PrevisaoFiltrado == null || PrevisaoFiltrado.Count == 0) + { + return; + } + ConfiguracaoImpressao parametros = await ShowDialogPrint(Relatorio, ((object)PrevisaoFiltrado.First()).GetType()); + if (parametros == null || !parametros.Campos.Any()) + { + return; + } + html = await GerarHtml(screen: false, pageBreak, parametros); + break; + } + case 24: + case 25: + { + if (LogUtilizacaoFiltrado == null || LogUtilizacaoFiltrado.Count == 0) + { + return; + } + ConfiguracaoImpressao parametros = await ShowDialogPrint(Relatorio, ((object)LogUtilizacaoFiltrado.First()).GetType()); + if (parametros == null || !parametros.Campos.Any()) + { + return; + } + html = await GerarHtml(screen: false, pageBreak, parametros); + break; + } + case 26: + { + if (ApoliceCriticaFiltrado == null || ApoliceCriticaFiltrado.Count == 0) + { + return; + } + ConfiguracaoImpressao parametros = await ShowDialogPrint(Relatorio, ((object)ApoliceCriticaFiltrado.First()).GetType()); + if (parametros == null || !parametros.Campos.Any()) + { + return; + } + html = await GerarHtml(screen: false, pageBreak, parametros); + break; + } + case 27: + { + if (PlacaFiltrado == null || PlacaFiltrado.Count == 0) + { + return; + } + ConfiguracaoImpressao parametros = await ShowDialogPrint(Relatorio, ((object)PlacaFiltrado.First()).GetType()); + if (parametros == null || !parametros.Campos.Any()) + { + return; + } + html = await GerarHtml(screen: false, pageBreak, parametros); + break; + } + case 13: + { + if (ExtratosFiltrado == null || ExtratosFiltrado.Count == 0) + { + return; + } + ConfiguracaoImpressao parametros = await ShowDialogPrint(Relatorio, ((object)ExtratosFiltrado.First()).GetType()); + if (parametros == null || !parametros.Campos.Any()) + { + return; + } + html = await GerarHtml(screen: false, pageBreak, parametros); + break; + } + case 28: + { + if (EndossoFiltrado == null || EndossoFiltrado.Count == 0) + { + return; + } + ConfiguracaoImpressao parametros = await ShowDialogPrint(Relatorio, ((object)EndossoFiltrado.First()).GetType()); + if (parametros == null || !parametros.Campos.Any()) + { + return; + } + html = await GerarHtml(screen: false, pageBreak, parametros); + break; + } + case 29: + { + if (ClassificacaoFiltrado == null || ClassificacaoFiltrado.Count == 0) + { + return; + } + ConfiguracaoImpressao parametros = await ShowDialogPrint(Relatorio, ((object)ClassificacaoFiltrado.First()).GetType()); + if (parametros == null || !parametros.Campos.Any()) + { + return; + } + html = await GerarHtml(screen: false, pageBreak, parametros); + break; + } + } + if (string.IsNullOrEmpty(html)) + { + return; + } + RegistrarAcao($"IMPRIMIU RELATÓRIO PERÍODO ENTRE {Inicio:d} E {Fim:d}", Relatorio, Filtros); + string tempPath = Path.GetTempPath(); + string text = string.Format("{0}{1}_{2:ddMMyyyyhhmmss}.html", tempPath, new Regex("[" + Regex.Escape(new string(Path.GetInvalidFileNameChars()) + new string(Path.GetInvalidPathChars())) + "]").Replace(EnumHelper.GetDescription(Relatorio), ""), Funcoes.GetNetworkTime()); + StreamWriter streamWriter = new StreamWriter(text, append: true, Encoding.UTF8); + streamWriter.Write(html); + streamWriter.Close(); + try + { + Process.Start(text); + } + catch + { + await ShowMessage("NÃO FOI ENCONTRADO O APLICATIVO PADRÃO DE HTML. \nACESSE AS CONFIGURAÇÕES DO SISTEMA OPERACIONAL PARA CONFIGURAR OU CONTATE UM TÉCNICO PARA AUXILIÁ-LO."); + } + } + + private async Task PostMonitor() + { + try + { + HttpClient client = new HttpClient(); + try + { + ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; + client.Timeout = TimeSpan.FromSeconds(10.0); + string value = $"{ApplicationHelper.IdFornecedor}:{(int)Relatorio}:{Funcoes.GetNetworkTime().ToUniversalTime().Ticks}".EncodeBase64(); + Uri uri = Address.ApiMonitor.Append("report").AddQuery("reportQuery", value); + await client.GetAsync(uri); + } + finally + { + ((IDisposable)client)?.Dispose(); + } + } + catch + { + } + } + + private async Task GerarPagamento(List pagamentos) + { + ParcelaServico parcelaServico = new ParcelaServico(); + List repasses = pagamentos.SelectMany((Pagamento x) => x.Dados).ToList(); + if (await parcelaServico.GerarPagamento((from x in repasses + where x.EntidadeVendedorParcela != null + select x.EntidadeVendedorParcela).ToList())) + { + await new AdiantamentoServico().GerarPagamento((from x in repasses + where x.EntidadeAdiantamento != null && !x.DataPagamento.HasValue + select x.EntidadeAdiantamento).ToList()); + RegistrarAcao($"GEROU EMISSÃO DE RECIBO ENTRE {Inicio:d} E {Fim:d}", Relatorio, Filtros); + } + } + + public async Task GerarHtml(bool screen = false, bool pageBreak = false, ConfiguracaoImpressao config = null, bool portrait = false) + { + string relatorio = ""; + string footer = ""; + Relatorio relatorio2 = Relatorio; + if (!((object)(Relatorio)(ref relatorio2)).Equals((object)(Relatorio)0)) + { + footer = $"{EnumHelper.GetDescription(Relatorio)} - PERÍODO DE {Inicio:d} ATÉ {Fim:d}. DATA DE EMISSÃO DO RELATÓRIO EM {Funcoes.GetNetworkTime():G}"; + } + SintetizarRelatorio(); + relatorio2 = Relatorio; + switch ((int)relatorio2) + { + case 0: + case 1: + { + ColunasOcultas = await Funcoes.OcultarColunas(Relatorio); + List list73 = ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(); + List analitico8 = (list73.Any((ClientesAtivosInativos x) => x.Selecionado) ? list73.Where((ClientesAtivosInativos x) => x.Selecionado).ToList() : list73); + string text = relatorio; + relatorio = text + Funcoes.CreateCard("", await Funcoes.GenerateTable(analitico8, Relatorio, grafico: false, verificarColunas: true, footer, config)); + break; + } + case 17: + { + ColunasOcultas = await Funcoes.OcultarColunas(Relatorio); + List list44 = ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(); + List analitico5 = (list44.Any((Licenciamento x) => x.Selecionado) ? list44.Where((Licenciamento x) => x.Selecionado).ToList() : list44); + string text = relatorio; + relatorio = text + Funcoes.CreateCard("", await Funcoes.GenerateTable(analitico5, Relatorio, grafico: false, verificarColunas: true, footer, config)); + break; + } + case 27: + { + ColunasOcultas = await Funcoes.OcultarColunas(Relatorio); + List list45 = ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(); + if (list45.Any((Placas x) => x.Selecionado)) + { + list45.Where((Placas x) => x.Selecionado).ToList(); + } + string text = relatorio; + relatorio = text + Funcoes.CreateCard("", await Funcoes.GenerateTable(list45, Relatorio, grafico: false, verificarColunas: true, footer)); + break; + } + case 18: + { + ColunasOcultas = await Funcoes.OcultarColunas(Relatorio); + List list38 = ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(); + List analitico4 = (list38.Any((Tarefa x) => x.Selecionado) ? list38.Where((Tarefa x) => x.Selecionado).ToList() : list38); + string text = relatorio; + relatorio = text + Funcoes.CreateCard("", await Funcoes.GenerateTable(analitico4, Relatorio, grafico: false, verificarColunas: true, footer, config)); + break; + } + default: + { + ColunasOcultas = await Funcoes.OcultarColunas(Relatorio); + List listProducao = ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(); + if ((int)Agrupamento != 0) + { + List list15 = (from x in listProducao + group x by ((int)Agrupamento != 1) ? (((int)Agrupamento != 2) ? (((int)Agrupamento != 3) ? (((int)Agrupamento != 4) ? x.Status : x.Estipulante) : x.Vendedor) : x.Ramo) : x.Seguradora).Select((Func, Sintetico>)((IGrouping x) => new Sintetico + { + Agrupamento = ((x.Key == null && (int)Agrupamento == 3) ? "SEM VENDEDOR" : x.Key), + PremioTotal = x.Sum((Producao c) => c.PremioTotal), + PremioLiquido = x.Sum((Producao p) => p.PremioLiquido), + MediaComissao = ((x.Sum((Producao c) => c.Comissao) > 0m) ? (decimal.Round(x.Sum((Producao c) => c.Comissao) / (decimal)x.Count((Producao c) => c.Comissao > 0m), 2) * 100m) : 0m) * 0.01m, + ComissaoGerada = x.Sum((Producao c) => (c.PremioLiquido + (c.Documento.AdicionalComiss ? c.Documento.PremioAdicional : 0m)) * c.Comissao * 0.01m), + Cancelamentos = Funcoes.DistinctBy(x, (Producao c) => ((DomainBase)c.Documento).Id).Count((Producao c) => (int)c.Documento.Situacao == 3), + Novos = Funcoes.DistinctBy(x, funcProducaoDistinctByDocumentoId).Count(funcProducaoNegociosNovos), + NegociosProprios = Funcoes.DistinctBy(x, funcProducaoDistinctByDocumentoId).Count(funcProducaoNegociosProprios), + SegurosNovos = Funcoes.DistinctBy(x, funcProducaoDistinctByDocumentoId).Count(funcProducaoSegurosNovos), + Renovacoes = Funcoes.DistinctBy(x, funcProducaoDistinctByDocumentoId).Count(funcProducaoSegurosRenovacao), + Apolices = Funcoes.DistinctBy(x, (Producao c) => ((DomainBase)c.Documento).Id).Count((Producao c) => c.Tipo == 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Endossos = Funcoes.DistinctBy(x, (Producao c) => ((DomainBase)c.Documento).Id).Count((Producao c) => c.Tipo != 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Faturas = x.Count((Producao c) => (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 2), + TotalLiquido = x.Count((Producao c) => (int)c.Documento.Situacao != 3), + TotalGeral = x.Count(), + MediaPonderada = ((x.Sum((Producao p) => p.PremioLiquido) > 0m) ? (decimal.Round(x.Sum((Producao c) => (c.PremioLiquido + (c.Documento.AdicionalComiss ? c.Documento.PremioAdicional : 0m)) * c.Comissao) / x.Sum((Producao p) => p.PremioLiquido), 2) * 100m) : 0m) * 0.01m + })).ToList(); + list15.Add(new Sintetico + { + Agrupamento = "TOTAL", + PremioTotal = listProducao.Sum((Producao c) => c.PremioTotal), + PremioLiquido = listProducao.Sum((Producao p) => p.PremioLiquido), + MediaComissao = ((listProducao.Sum((Producao c) => c.Comissao) > 0m) ? (decimal.Round(listProducao.Sum((Producao c) => c.Comissao) / (decimal)listProducao.Count((Producao c) => c.Comissao > 0m), 2) * 100m) : 0m) * 0.01m, + ComissaoGerada = listProducao.Sum((Producao c) => (c.PremioLiquido + (c.Documento.AdicionalComiss ? c.Documento.PremioAdicional : 0m)) * c.Comissao * 0.01m), + Cancelamentos = Funcoes.DistinctBy(listProducao, (Producao c) => ((DomainBase)c.Documento).Id).Count((Producao c) => (int)c.Documento.Situacao == 3), + Novos = Funcoes.DistinctBy(listProducao, funcProducaoDistinctByDocumentoId).Count(funcProducaoNegociosNovos), + NegociosProprios = Funcoes.DistinctBy(listProducao, funcProducaoDistinctByDocumentoId).Count(funcProducaoNegociosProprios), + SegurosNovos = Funcoes.DistinctBy(listProducao, funcProducaoDistinctByDocumentoId).Count(funcProducaoSegurosNovos), + Renovacoes = Funcoes.DistinctBy(listProducao, funcProducaoDistinctByDocumentoId).Count(funcProducaoSegurosRenovacao), + Apolices = Funcoes.DistinctBy(listProducao, (Producao c) => ((DomainBase)c.Documento).Id).Count((Producao c) => c.Tipo == 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Endossos = Funcoes.DistinctBy(listProducao, (Producao c) => ((DomainBase)c.Documento).Id).Count((Producao c) => c.Tipo != 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Faturas = listProducao.Count((Producao c) => (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 2), + TotalLiquido = listProducao.Count((Producao c) => (int)c.Documento.Situacao != 3), + TotalGeral = listProducao.Count, + MediaPonderada = ((listProducao.Sum((Producao p) => p.PremioLiquido) > 0m) ? (decimal.Round(listProducao.Sum((Producao c) => (c.PremioLiquido + (c.Documento.AdicionalComiss ? c.Documento.PremioAdicional : 0m)) * c.Comissao) / listProducao.Sum((Producao p) => p.PremioLiquido), 2) * 100m) : 0m) * 0.01m + }); + relatorio = Funcoes.CreateCard("SINTÉTICO", await Funcoes.GenerateTableSintetic(list15.ConstruirSintetico(Relatorio), config.TamanhoFonte), pageBreak); + } + Agrupamento agrupamento42 = Agrupamento; + switch (agrupamento42 - 1) + { + default: + relatorio = await Funcoes.GenerateTable(listProducao.Any((Producao x) => x.Selecionado) ? listProducao.Where((Producao x) => x.Selecionado).ToList() : listProducao.ToList(), Relatorio, grafico: false, verificarColunas: true, footer, config); + break; + case 0: + { + List agrupamento30 = (from x in listProducao + orderby x.Seguradora + select x.Seguradora).Distinct().ToList(); + foreach (string grupo33 in agrupamento30) + { + List list22 = (listProducao.Any((Producao x) => x.Selecionado) ? listProducao.Where((Producao x) => x.Selecionado && x.Seguradora == grupo33).ToList() : listProducao.Where((Producao x) => x.Seguradora == grupo33).ToList()); + if (list22.Count != 0) + { + list22.Add(new Producao + { + Cliente = "TOTAL", + Comissao = (list22.Any() ? (list22.Sum((Producao x) => x.Comissao) / (decimal)list22.Count) : 0m), + PremioTotal = list22.Sum((Producao x) => x.PremioTotal), + PremioLiquido = list22.Sum((Producao x) => x.PremioLiquido), + ComissaoGerada = list22.Sum((Producao x) => x.ComissaoGerada) + }); + string text11 = await Funcoes.GenerateTable(list22, Relatorio, grafico: false, verificarColunas: true, footer, config); + List list23 = (listProducao.Any((Producao x) => x.Selecionado) ? listProducao.Where((Producao x) => x.Selecionado && x.Seguradora == grupo33).ToList() : listProducao.Where((Producao x) => x.Seguradora == grupo33).ToList()); + List sintetic10 = Funcoes.ConstruirSintetico(new Sintetico + { + Agrupamento = grupo33, + PremioTotal = list23.Sum((Producao x) => x.PremioTotal), + PremioLiquido = list23.Sum((Producao p) => p.PremioLiquido), + MediaComissao = ((list23.Sum((Producao c) => c.Comissao) > 0m) ? decimal.Round(list23.Sum((Producao c) => c.Comissao) / (decimal)list23.Count((Producao c) => c.Comissao > 0m), 2) : 0m), + ComissaoGerada = list23.Sum((Producao c) => (c.PremioLiquido + (c.Documento.AdicionalComiss ? c.Documento.PremioAdicional : 0m)) * c.Comissao * 0.01m), + Cancelamentos = list23.Count((Producao c) => (int)c.Documento.Situacao == 3), + Novos = list23.Count(funcProducaoNegociosNovos), + NegociosProprios = list23.Count(funcProducaoNegociosProprios), + SegurosNovos = list23.Count(funcProducaoSegurosNovos), + Renovacoes = list23.Count(funcProducaoSegurosRenovacao), + Apolices = list23.Count((Producao c) => c.Tipo == 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Endossos = list23.Count((Producao c) => c.Tipo != 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Faturas = list23.Count((Producao c) => (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 2), + TotalGeral = list23.Count + }, Relatorio); + string text = text11; + text11 = text + await Funcoes.GenerateTableSintetic(sintetic10, config.TamanhoFonte); + relatorio += Funcoes.CreateCard(grupo33, text11, pageBreak); + } + } + break; + } + case 1: + { + List agrupamento30 = (from x in listProducao + orderby x.Ramo + select x.Ramo).Distinct().ToList(); + foreach (string grupo34 in agrupamento30) + { + List list20 = (listProducao.Any((Producao x) => x.Selecionado) ? listProducao.Where((Producao x) => x.Selecionado && x.Ramo == grupo34).ToList() : listProducao.Where((Producao x) => x.Ramo == grupo34).ToList()); + if (list20.Count != 0) + { + list20.Add(new Producao + { + Cliente = "TOTAL", + Comissao = (list20.Any() ? (list20.Sum((Producao x) => x.Comissao) / (decimal)list20.Count) : 0m), + PremioTotal = list20.Sum((Producao x) => x.PremioTotal), + PremioLiquido = list20.Sum((Producao x) => x.PremioLiquido), + ComissaoGerada = list20.Sum((Producao x) => x.ComissaoGerada) + }); + string text10 = await Funcoes.GenerateTable(list20, Relatorio, grafico: false, verificarColunas: true, footer, config); + List list21 = (listProducao.Any((Producao x) => x.Selecionado) ? listProducao.Where((Producao x) => x.Selecionado && x.Ramo == grupo34).ToList() : listProducao.Where((Producao x) => x.Ramo == grupo34).ToList()); + List sintetic9 = Funcoes.ConstruirSintetico(new Sintetico + { + Agrupamento = grupo34, + PremioTotal = list21.Sum((Producao x) => x.PremioTotal), + PremioLiquido = list21.Sum((Producao p) => p.PremioLiquido), + MediaComissao = ((list21.Sum((Producao c) => c.Comissao) > 0m) ? decimal.Round(list21.Sum((Producao c) => c.Comissao) / (decimal)list21.Count((Producao c) => c.Comissao > 0m), 2) : 0m), + ComissaoGerada = list21.Sum((Producao c) => (c.PremioLiquido + (c.Documento.AdicionalComiss ? c.Documento.PremioAdicional : 0m)) * c.Comissao * 0.01m), + Cancelamentos = list21.Count((Producao c) => (int)c.Documento.Situacao == 3), + Novos = list21.Count(funcProducaoNegociosNovos), + NegociosProprios = list21.Count(funcProducaoNegociosProprios), + SegurosNovos = list21.Count(funcProducaoSegurosNovos), + Renovacoes = list21.Count(funcProducaoSegurosRenovacao), + Apolices = list21.Count((Producao c) => c.Tipo == 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Endossos = list21.Count((Producao c) => c.Tipo != 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Faturas = list21.Count((Producao c) => (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 2), + TotalGeral = list21.Count + }, Relatorio); + string text = text10; + text10 = text + await Funcoes.GenerateTableSintetic(sintetic9, config.TamanhoFonte); + relatorio += Funcoes.CreateCard(grupo34, text10, pageBreak); + } + } + break; + } + case 2: + { + List agrupamento30 = (from x in listProducao + orderby x.Vendedor + select x.Vendedor).Distinct().ToList(); + foreach (string grupo35 in agrupamento30) + { + List list18 = (listProducao.Any((Producao x) => x.Selecionado) ? listProducao.Where((Producao x) => x.Selecionado && x.Vendedor == grupo35).ToList() : listProducao.Where((Producao x) => x.Vendedor == grupo35).ToList()); + if (list18.Count != 0) + { + list18.Add(new Producao + { + Cliente = "TOTAL", + Comissao = (list18.Any() ? (list18.Sum((Producao x) => x.Comissao) / (decimal)list18.Count) : 0m), + PremioTotal = list18.Sum((Producao x) => x.PremioTotal), + PremioLiquido = list18.Sum((Producao x) => x.PremioLiquido), + ComissaoGerada = list18.Sum((Producao x) => x.ComissaoGerada) + }); + string text9 = await Funcoes.GenerateTable(list18, Relatorio, grafico: false, verificarColunas: true, footer, config); + List list19 = (listProducao.Any((Producao x) => x.Selecionado) ? listProducao.Where((Producao x) => x.Selecionado && x.Vendedor == grupo35).ToList() : listProducao.Where((Producao x) => x.Vendedor == grupo35).ToList()); + List sintetic8 = Funcoes.ConstruirSintetico(new Sintetico + { + Agrupamento = grupo35, + PremioTotal = list19.Sum((Producao x) => x.PremioTotal), + PremioLiquido = list19.Sum((Producao p) => p.PremioLiquido), + MediaComissao = ((list19.Sum((Producao c) => c.Comissao) > 0m) ? decimal.Round(list19.Sum((Producao c) => c.Comissao) / (decimal)list19.Count((Producao c) => c.Comissao > 0m), 2) : 0m), + ComissaoGerada = list19.Sum((Producao c) => (c.PremioLiquido + (c.Documento.AdicionalComiss ? c.Documento.PremioAdicional : 0m)) * c.Comissao * 0.01m), + Cancelamentos = list19.Count((Producao c) => (int)c.Documento.Situacao == 3), + Novos = list19.Count(funcProducaoNegociosNovos), + NegociosProprios = list19.Count(funcProducaoNegociosProprios), + SegurosNovos = list19.Count(funcProducaoSegurosNovos), + Renovacoes = list19.Count(funcProducaoSegurosRenovacao), + Apolices = list19.Count((Producao c) => c.Tipo == 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Endossos = list19.Count((Producao c) => c.Tipo != 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Faturas = list19.Count((Producao c) => (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 2), + TotalGeral = list19.Count + }, Relatorio); + string text = text9; + text9 = text + await Funcoes.GenerateTableSintetic(sintetic8, config.TamanhoFonte); + relatorio += Funcoes.CreateCard(grupo35, text9, pageBreak); + } + } + break; + } + case 3: + { + List agrupamento30 = (from x in listProducao + orderby x.Estipulante + select x.Estipulante).Distinct().ToList(); + foreach (string grupo32 in agrupamento30) + { + List list24 = (listProducao.Any((Producao x) => x.Selecionado) ? listProducao.Where((Producao x) => x.Selecionado && x.Estipulante == grupo32).ToList() : listProducao.Where((Producao x) => x.Estipulante == grupo32).ToList()); + if (list24.Count != 0) + { + list24.Add(new Producao + { + Cliente = "TOTAL", + Comissao = (list24.Any() ? (list24.Sum((Producao x) => x.Comissao) / (decimal)list24.Count) : 0m), + PremioTotal = list24.Sum((Producao x) => x.PremioTotal), + PremioLiquido = list24.Sum((Producao x) => x.PremioLiquido), + ComissaoGerada = list24.Sum((Producao x) => x.ComissaoGerada) + }); + string text12 = await Funcoes.GenerateTable(list24, Relatorio, grafico: false, verificarColunas: true, footer, config); + List list25 = (listProducao.Any((Producao x) => x.Selecionado) ? listProducao.Where((Producao x) => x.Selecionado && x.Estipulante == grupo32).ToList() : listProducao.Where((Producao x) => x.Estipulante == grupo32).ToList()); + List sintetic11 = Funcoes.ConstruirSintetico(new Sintetico + { + Agrupamento = grupo32, + PremioTotal = list25.Sum((Producao x) => x.PremioTotal), + PremioLiquido = list25.Sum((Producao p) => p.PremioLiquido), + MediaComissao = ((list25.Sum((Producao c) => c.Comissao) > 0m) ? decimal.Round(list25.Sum((Producao c) => c.Comissao) / (decimal)list25.Count((Producao c) => c.Comissao > 0m), 2) : 0m), + ComissaoGerada = list25.Sum((Producao c) => (c.PremioLiquido + (c.Documento.AdicionalComiss ? c.Documento.PremioAdicional : 0m)) * c.Comissao * 0.01m), + Cancelamentos = list25.Count((Producao c) => (int)c.Documento.Situacao == 3), + Novos = list25.Count(funcProducaoNegociosNovos), + NegociosProprios = list25.Count(funcProducaoNegociosProprios), + SegurosNovos = list25.Count(funcProducaoSegurosNovos), + Renovacoes = list25.Count(funcProducaoSegurosRenovacao), + Apolices = list25.Count((Producao c) => c.Tipo == 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Endossos = list25.Count((Producao c) => c.Tipo != 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Faturas = list25.Count((Producao c) => (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 2), + TotalGeral = list25.Count + }, Relatorio); + string text = text12; + text12 = text + await Funcoes.GenerateTableSintetic(sintetic11, config.TamanhoFonte); + relatorio += Funcoes.CreateCard(grupo32, text12, pageBreak); + } + } + break; + } + case 4: + { + List agrupamento30 = (from x in listProducao + orderby x.Status + select x.Status).Distinct().ToList(); + foreach (string grupo36 in agrupamento30) + { + List list16 = (listProducao.Any((Producao x) => x.Selecionado) ? listProducao.Where((Producao x) => x.Selecionado && x.Status == grupo36).ToList() : listProducao.Where((Producao x) => x.Status == grupo36).ToList()); + if (list16.Count != 0) + { + list16.Add(new Producao + { + Cliente = "TOTAL", + Comissao = (list16.Any() ? (list16.Sum((Producao x) => x.Comissao) / (decimal)list16.Count) : 0m), + PremioTotal = list16.Sum((Producao x) => x.PremioTotal), + PremioLiquido = list16.Sum((Producao x) => x.PremioLiquido), + ComissaoGerada = list16.Sum((Producao x) => x.ComissaoGerada) + }); + string text8 = await Funcoes.GenerateTable(list16, Relatorio, grafico: false, verificarColunas: true, footer, config); + List list17 = (listProducao.Any((Producao x) => x.Selecionado) ? listProducao.Where((Producao x) => x.Selecionado && x.Status == grupo36).ToList() : listProducao.Where((Producao x) => x.Status == grupo36).ToList()); + List sintetic7 = Funcoes.ConstruirSintetico(new Sintetico + { + Agrupamento = grupo36, + PremioTotal = list17.Sum((Producao x) => x.PremioTotal), + PremioLiquido = list17.Sum((Producao p) => p.PremioLiquido), + MediaComissao = ((list17.Sum((Producao c) => c.Comissao) > 0m) ? decimal.Round(list17.Sum((Producao c) => c.Comissao) / (decimal)list17.Count((Producao c) => c.Comissao > 0m), 2) : 0m), + ComissaoGerada = list17.Sum((Producao c) => (c.PremioLiquido + (c.Documento.AdicionalComiss ? c.Documento.PremioAdicional : 0m)) * c.Comissao * 0.01m), + Cancelamentos = list17.Count((Producao c) => (int)c.Documento.Situacao == 3), + Novos = list17.Count(funcProducaoNegociosNovos), + NegociosProprios = list17.Count(funcProducaoNegociosProprios), + SegurosNovos = list17.Count(funcProducaoSegurosNovos), + Renovacoes = list17.Count(funcProducaoSegurosRenovacao), + Apolices = list17.Count((Producao c) => c.Tipo == 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Endossos = list17.Count((Producao c) => c.Tipo != 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Faturas = list17.Count((Producao c) => (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 2), + TotalGeral = list17.Count + }, Relatorio); + string text = text8; + text8 = text + await Funcoes.GenerateTableSintetic(sintetic7, config.TamanhoFonte); + relatorio += Funcoes.CreateCard(grupo36, text8, pageBreak); + } + } + break; + } + } + break; + } + case 3: + { + ColunasOcultas = await Funcoes.OcultarColunas(Relatorio); + List listApolicePendente = ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(); + Agrupamento agrupamento42 = Agrupamento; + switch (agrupamento42 - 1) + { + default: + relatorio = await Funcoes.GenerateTable(listApolicePendente.Any((ApolicePendente x) => x.Selecionado) ? listApolicePendente.Where((ApolicePendente x) => x.Selecionado).ToList() : listApolicePendente, Relatorio, grafico: false, verificarColunas: true, footer, config); + break; + case 0: + { + List agrupamento30 = (from x in listApolicePendente + orderby x.Seguradora + select x.Seguradora).Distinct().ToList(); + foreach (string grupo18 in agrupamento30) + { + List list52 = (listApolicePendente.Any((ApolicePendente x) => x.Selecionado) ? listApolicePendente.Where((ApolicePendente x) => x.Selecionado && x.Seguradora == grupo18).ToList() : listApolicePendente.Where((ApolicePendente x) => x.Seguradora == grupo18).ToList()); + if (list52.Count != 0) + { + list52.Add(new ApolicePendente + { + Cliente = "TOTAL", + Comissao = (list52.Any() ? (list52.Sum((ApolicePendente x) => x.Comissao) / (decimal)list52.Count) : 0m), + PremioTotal = list52.Sum((ApolicePendente x) => x.PremioTotal), + PremioLiquido = list52.Sum((ApolicePendente x) => x.PremioLiquido) + }); + string text26 = await Funcoes.GenerateTable(list52, Relatorio, grafico: false, verificarColunas: true, footer, config); + List list53 = (listApolicePendente.Any((ApolicePendente x) => x.Selecionado) ? listApolicePendente.Where((ApolicePendente x) => x.Selecionado && x.Seguradora == grupo18).ToList() : listApolicePendente.Where((ApolicePendente x) => x.Seguradora == grupo18).ToList()); + List sintetic25 = Funcoes.ConstruirSintetico(new Sintetico + { + Agrupamento = grupo18, + PremioTotal = list53.Sum((ApolicePendente x) => x.PremioTotal), + PremioLiquido = list53.Sum((ApolicePendente p) => p.PremioLiquido), + MediaComissao = ((list53.Sum((ApolicePendente c) => c.Comissao) > 0m) ? decimal.Round(list53.Sum((ApolicePendente c) => c.Comissao) / (decimal)list53.Count((ApolicePendente c) => c.Comissao > 0m), 2) : 0m), + ComissaoGerada = list53.Sum((ApolicePendente c) => (c.PremioLiquido + (c.Documento.AdicionalComiss ? c.Documento.PremioAdicional : 0m)) * c.Comissao * 0.01m), + Cancelamentos = list53.Count((ApolicePendente c) => (int)c.Documento.Situacao == 3), + Novos = list53.Count((ApolicePendente c) => (int)c.Documento.Situacao == 1 || ((int)c.Documento.Situacao == 2 && (int)c.Documento.Negocio.GetValueOrDefault() == 2)), + Renovacoes = list53.Count((ApolicePendente c) => (int)c.Documento.Situacao == 2 && (int)c.Documento.Negocio.GetValueOrDefault() == 1), + Apolices = list53.Count((ApolicePendente c) => c.Tipo == 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Endossos = list53.Count((ApolicePendente c) => c.Tipo != 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Faturas = list53.Count((ApolicePendente c) => (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 2), + TotalGeral = list53.Count + }, Relatorio); + string text = text26; + text26 = text + await Funcoes.GenerateTableSintetic(sintetic25, config.TamanhoFonte); + relatorio += Funcoes.CreateCard(grupo18, text26, pageBreak); + } + } + break; + } + case 1: + { + List agrupamento30 = (from x in listApolicePendente + orderby x.Ramo + select x.Ramo).Distinct().ToList(); + foreach (string grupo19 in agrupamento30) + { + List list50 = (listApolicePendente.Any((ApolicePendente x) => x.Selecionado) ? listApolicePendente.Where((ApolicePendente x) => x.Selecionado && x.Ramo == grupo19).ToList() : listApolicePendente.Where((ApolicePendente x) => x.Ramo == grupo19).ToList()); + if (list50.Count != 0) + { + list50.Add(new ApolicePendente + { + Cliente = "TOTAL", + Comissao = (list50.Any() ? (list50.Sum((ApolicePendente x) => x.Comissao) / (decimal)list50.Count) : 0m), + PremioTotal = list50.Sum((ApolicePendente x) => x.PremioTotal), + PremioLiquido = list50.Sum((ApolicePendente x) => x.PremioLiquido) + }); + string text25 = await Funcoes.GenerateTable(list50, Relatorio, grafico: false, verificarColunas: true, footer, config); + List list51 = (listApolicePendente.Any((ApolicePendente x) => x.Selecionado) ? listApolicePendente.Where((ApolicePendente x) => x.Selecionado && x.Ramo == grupo19).ToList() : listApolicePendente.Where((ApolicePendente x) => x.Ramo == grupo19).ToList()); + List sintetic24 = Funcoes.ConstruirSintetico(new Sintetico + { + Agrupamento = grupo19, + PremioTotal = list51.Sum((ApolicePendente x) => x.PremioTotal), + PremioLiquido = list51.Sum((ApolicePendente p) => p.PremioLiquido), + MediaComissao = ((list51.Sum((ApolicePendente c) => c.Comissao) > 0m) ? decimal.Round(list51.Sum((ApolicePendente c) => c.Comissao) / (decimal)list51.Count((ApolicePendente c) => c.Comissao > 0m), 2) : 0m), + ComissaoGerada = list51.Sum((ApolicePendente c) => (c.PremioLiquido + (c.Documento.AdicionalComiss ? c.Documento.PremioAdicional : 0m)) * c.Comissao * 0.01m), + Cancelamentos = list51.Count((ApolicePendente c) => (int)c.Documento.Situacao == 3), + Novos = list51.Count((ApolicePendente c) => (int)c.Documento.Situacao == 1 || ((int)c.Documento.Situacao == 2 && (int)c.Documento.Negocio.GetValueOrDefault() == 2)), + Renovacoes = list51.Count((ApolicePendente c) => (int)c.Documento.Situacao == 2 && (int)c.Documento.Negocio.GetValueOrDefault() == 1), + Apolices = list51.Count((ApolicePendente c) => c.Tipo == 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Endossos = list51.Count((ApolicePendente c) => c.Tipo != 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Faturas = list51.Count((ApolicePendente c) => (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 2), + TotalGeral = list51.Count + }, Relatorio); + string text = text25; + text25 = text + await Funcoes.GenerateTableSintetic(sintetic24, config.TamanhoFonte); + relatorio += Funcoes.CreateCard(grupo19, text25, pageBreak); + } + } + break; + } + case 2: + { + List agrupamento30 = (from x in listApolicePendente + orderby x.Vendedor + select x.Vendedor).Distinct().ToList(); + foreach (string grupo20 in agrupamento30) + { + List list48 = (listApolicePendente.Any((ApolicePendente x) => x.Selecionado) ? listApolicePendente.Where((ApolicePendente x) => x.Selecionado && x.Vendedor == grupo20).ToList() : listApolicePendente.Where((ApolicePendente x) => x.Vendedor == grupo20).ToList()); + if (list48.Count != 0) + { + list48.Add(new ApolicePendente + { + Cliente = "TOTAL", + Comissao = (list48.Any() ? (list48.Sum((ApolicePendente x) => x.Comissao) / (decimal)list48.Count) : 0m), + PremioTotal = list48.Sum((ApolicePendente x) => x.PremioTotal), + PremioLiquido = list48.Sum((ApolicePendente x) => x.PremioLiquido) + }); + string text24 = await Funcoes.GenerateTable(list48, Relatorio, grafico: false, verificarColunas: true, footer, config); + List list49 = (listApolicePendente.Any((ApolicePendente x) => x.Selecionado) ? listApolicePendente.Where((ApolicePendente x) => x.Selecionado && x.Vendedor == grupo20).ToList() : listApolicePendente.Where((ApolicePendente x) => x.Vendedor == grupo20).ToList()); + List sintetic23 = Funcoes.ConstruirSintetico(new Sintetico + { + Agrupamento = grupo20, + PremioTotal = list49.Sum((ApolicePendente x) => x.PremioTotal), + PremioLiquido = list49.Sum((ApolicePendente p) => p.PremioLiquido), + MediaComissao = ((list49.Sum((ApolicePendente c) => c.Comissao) > 0m) ? decimal.Round(list49.Sum((ApolicePendente c) => c.Comissao) / (decimal)list49.Count((ApolicePendente c) => c.Comissao > 0m), 2) : 0m), + ComissaoGerada = list49.Sum((ApolicePendente c) => (c.PremioLiquido + (c.Documento.AdicionalComiss ? c.Documento.PremioAdicional : 0m)) * c.Comissao * 0.01m), + Cancelamentos = list49.Count((ApolicePendente c) => (int)c.Documento.Situacao == 3), + Novos = list49.Count((ApolicePendente c) => (int)c.Documento.Situacao == 1 || ((int)c.Documento.Situacao == 2 && (int)c.Documento.Negocio.GetValueOrDefault() == 2)), + Renovacoes = list49.Count((ApolicePendente c) => (int)c.Documento.Situacao == 2 && (int)c.Documento.Negocio.GetValueOrDefault() == 1), + Apolices = list49.Count((ApolicePendente c) => c.Tipo == 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Endossos = list49.Count((ApolicePendente c) => c.Tipo != 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Faturas = list49.Count((ApolicePendente c) => (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 2), + TotalGeral = list49.Count + }, Relatorio); + string text = text24; + text24 = text + await Funcoes.GenerateTableSintetic(sintetic23, config.TamanhoFonte); + relatorio += Funcoes.CreateCard(grupo20, text24, pageBreak); + } + } + break; + } + case 3: + { + List agrupamento30 = (from x in listApolicePendente + orderby x.Estipulante + select x.Estipulante).Distinct().ToList(); + foreach (string grupo17 in agrupamento30) + { + List list54 = (listApolicePendente.Any((ApolicePendente x) => x.Selecionado) ? listApolicePendente.Where((ApolicePendente x) => x.Selecionado && x.Estipulante == grupo17).ToList() : listApolicePendente.Where((ApolicePendente x) => x.Estipulante == grupo17).ToList()); + if (list54.Count != 0) + { + list54.Add(new ApolicePendente + { + Cliente = "TOTAL", + Comissao = (list54.Any() ? (list54.Sum((ApolicePendente x) => x.Comissao) / (decimal)list54.Count) : 0m), + PremioTotal = list54.Sum((ApolicePendente x) => x.PremioTotal), + PremioLiquido = list54.Sum((ApolicePendente x) => x.PremioLiquido) + }); + string text27 = await Funcoes.GenerateTable(list54, Relatorio, grafico: false, verificarColunas: true, footer, config); + List list55 = (listApolicePendente.Any((ApolicePendente x) => x.Selecionado) ? listApolicePendente.Where((ApolicePendente x) => x.Selecionado && x.Estipulante == grupo17).ToList() : listApolicePendente.Where((ApolicePendente x) => x.Estipulante == grupo17).ToList()); + List sintetic26 = Funcoes.ConstruirSintetico(new Sintetico + { + Agrupamento = grupo17, + PremioTotal = list55.Sum((ApolicePendente x) => x.PremioTotal), + PremioLiquido = list55.Sum((ApolicePendente p) => p.PremioLiquido), + MediaComissao = ((list55.Sum((ApolicePendente c) => c.Comissao) > 0m) ? decimal.Round(list55.Sum((ApolicePendente c) => c.Comissao) / (decimal)list55.Count((ApolicePendente c) => c.Comissao > 0m), 2) : 0m), + ComissaoGerada = list55.Sum((ApolicePendente c) => (c.PremioLiquido + (c.Documento.AdicionalComiss ? c.Documento.PremioAdicional : 0m)) * c.Comissao * 0.01m), + Cancelamentos = list55.Count((ApolicePendente c) => (int)c.Documento.Situacao == 3), + Novos = list55.Count((ApolicePendente c) => (int)c.Documento.Situacao == 1 || ((int)c.Documento.Situacao == 2 && (int)c.Documento.Negocio.GetValueOrDefault() == 2)), + Renovacoes = list55.Count((ApolicePendente c) => (int)c.Documento.Situacao == 2 && (int)c.Documento.Negocio.GetValueOrDefault() == 1), + Apolices = list55.Count((ApolicePendente c) => c.Tipo == 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Endossos = list55.Count((ApolicePendente c) => c.Tipo != 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Faturas = list55.Count((ApolicePendente c) => (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 2), + TotalGeral = list55.Count + }, Relatorio); + string text = text27; + text27 = text + await Funcoes.GenerateTableSintetic(sintetic26, config.TamanhoFonte); + relatorio += Funcoes.CreateCard(grupo17, text27, pageBreak); + } + } + break; + } + case 4: + { + List agrupamento30 = (from x in listApolicePendente + orderby x.Status + select x.Status).Distinct().ToList(); + foreach (string grupo21 in agrupamento30) + { + List list46 = (listApolicePendente.Any((ApolicePendente x) => x.Selecionado) ? listApolicePendente.Where((ApolicePendente x) => x.Selecionado && x.Status == grupo21).ToList() : listApolicePendente.Where((ApolicePendente x) => x.Status == grupo21).ToList()); + if (list46.Count != 0) + { + list46.Add(new ApolicePendente + { + Cliente = "TOTAL", + Comissao = (list46.Any() ? (list46.Sum((ApolicePendente x) => x.Comissao) / (decimal)list46.Count) : 0m), + PremioTotal = list46.Sum((ApolicePendente x) => x.PremioTotal), + PremioLiquido = list46.Sum((ApolicePendente x) => x.PremioLiquido) + }); + string text23 = await Funcoes.GenerateTable(list46, Relatorio, grafico: false, verificarColunas: true, footer, config); + List list47 = (listApolicePendente.Any((ApolicePendente x) => x.Selecionado) ? listApolicePendente.Where((ApolicePendente x) => x.Selecionado && x.Status == grupo21).ToList() : listApolicePendente.Where((ApolicePendente x) => x.Status == grupo21).ToList()); + List sintetic22 = Funcoes.ConstruirSintetico(new Sintetico + { + Agrupamento = grupo21, + PremioTotal = list47.Sum((ApolicePendente x) => x.PremioTotal), + PremioLiquido = list47.Sum((ApolicePendente p) => p.PremioLiquido), + MediaComissao = ((list47.Sum((ApolicePendente c) => c.Comissao) > 0m) ? decimal.Round(list47.Sum((ApolicePendente c) => c.Comissao) / (decimal)list47.Count((ApolicePendente c) => c.Comissao > 0m), 2) : 0m), + ComissaoGerada = list47.Sum((ApolicePendente c) => (c.PremioLiquido + (c.Documento.AdicionalComiss ? c.Documento.PremioAdicional : 0m)) * c.Comissao * 0.01m), + Cancelamentos = list47.Count((ApolicePendente c) => (int)c.Documento.Situacao == 3), + Novos = list47.Count((ApolicePendente c) => (int)c.Documento.Situacao == 1 || ((int)c.Documento.Situacao == 2 && (int)c.Documento.Negocio.GetValueOrDefault() == 2)), + Renovacoes = list47.Count((ApolicePendente c) => (int)c.Documento.Situacao == 2 && (int)c.Documento.Negocio.GetValueOrDefault() == 1), + Apolices = list47.Count((ApolicePendente c) => c.Tipo == 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Endossos = list47.Count((ApolicePendente c) => c.Tipo != 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Faturas = list47.Count((ApolicePendente c) => (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 2), + TotalGeral = list47.Count + }, Relatorio); + string text = text23; + text23 = text + await Funcoes.GenerateTableSintetic(sintetic22, config.TamanhoFonte); + relatorio += Funcoes.CreateCard(grupo21, text23, pageBreak); + } + } + break; + } + } + break; + } + case 4: + { + ColunasOcultas = await Funcoes.OcultarColunas(Relatorio); + List listRenovacao = ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(); + Agrupamento agrupamento42 = Agrupamento; + switch (agrupamento42 - 1) + { + default: + relatorio = await Funcoes.GenerateTable(listRenovacao.Any((Renovacao x) => x.Selecionado) ? listRenovacao.Where((Renovacao x) => x.Selecionado).ToList() : listRenovacao, Relatorio, grafico: false, verificarColunas: true, footer, config); + break; + case 0: + { + List agrupamento30 = (from x in listRenovacao + orderby x.Seguradora + select x.Seguradora).Distinct().ToList(); + foreach (string grupo23 in agrupamento30) + { + List list42 = (listRenovacao.Any((Renovacao x) => x.Selecionado) ? listRenovacao.Where((Renovacao x) => x.Selecionado && x.Seguradora == grupo23).ToList() : listRenovacao.Where((Renovacao x) => x.Seguradora == grupo23).ToList()); + if (list42.Count != 0) + { + list42.Add(new Renovacao + { + Cliente = "TOTAL", + Comissao = (list42.Any() ? (list42.Sum((Renovacao x) => x.Comissao) / (decimal)list42.Count) : 0m), + PremioTotal = list42.Sum((Renovacao x) => x.PremioTotal), + PremioLiquido = list42.Sum((Renovacao x) => x.PremioLiquido) + }); + string text21 = await Funcoes.GenerateTable(list42, Relatorio, grafico: false, verificarColunas: true, footer, config); + List sintetico6 = (listRenovacao.Any((Renovacao x) => x.Selecionado) ? listRenovacao.Where((Renovacao x) => x.Selecionado && x.Seguradora == grupo23).ToList() : listRenovacao.Where((Renovacao x) => x.Seguradora == grupo23).ToList()); + List sintetic20 = SintetizarRenovacao(grupo23, sintetico6).ConstruirSintetico(Relatorio); + string text = text21; + text21 = text + await Funcoes.GenerateTableSintetic(sintetic20, config.TamanhoFonte); + relatorio += Funcoes.CreateCard(grupo23, text21, pageBreak); + } + } + break; + } + case 1: + { + List agrupamento30 = (from x in listRenovacao + orderby x.Ramo + select x.Ramo).Distinct().ToList(); + foreach (string grupo24 in agrupamento30) + { + List list41 = (listRenovacao.Any((Renovacao x) => x.Selecionado) ? listRenovacao.Where((Renovacao x) => x.Selecionado && x.Ramo == grupo24).ToList() : listRenovacao.Where((Renovacao x) => x.Ramo == grupo24).ToList()); + if (list41.Count != 0) + { + list41.Add(new Renovacao + { + Cliente = "TOTAL", + Comissao = (list41.Any() ? (list41.Sum((Renovacao x) => x.Comissao) / (decimal)list41.Count) : 0m), + PremioTotal = list41.Sum((Renovacao x) => x.PremioTotal), + PremioLiquido = list41.Sum((Renovacao x) => x.PremioLiquido) + }); + string text20 = await Funcoes.GenerateTable(list41, Relatorio, grafico: false, verificarColunas: true, footer, config); + List sintetico5 = (listRenovacao.Any((Renovacao x) => x.Selecionado) ? listRenovacao.Where((Renovacao x) => x.Selecionado && x.Ramo == grupo24).ToList() : listRenovacao.Where((Renovacao x) => x.Ramo == grupo24).ToList()); + List sintetic19 = SintetizarRenovacao(grupo24, sintetico5).ConstruirSintetico(Relatorio); + string text = text20; + text20 = text + await Funcoes.GenerateTableSintetic(sintetic19, config.TamanhoFonte); + relatorio += Funcoes.CreateCard(grupo24, text20, pageBreak); + } + } + break; + } + case 2: + { + List agrupamento30 = (from x in listRenovacao + orderby x.Vendedor + select x.Vendedor).Distinct().ToList(); + foreach (string grupo25 in agrupamento30) + { + List list40 = (listRenovacao.Any((Renovacao x) => x.Selecionado) ? listRenovacao.Where((Renovacao x) => x.Selecionado && x.Vendedor == grupo25).ToList() : listRenovacao.Where((Renovacao x) => x.Vendedor == grupo25).ToList()); + if (list40.Count != 0) + { + list40.Add(new Renovacao + { + Cliente = "TOTAL", + Comissao = (list40.Any() ? (list40.Sum((Renovacao x) => x.Comissao) / (decimal)list40.Count) : 0m), + PremioTotal = list40.Sum((Renovacao x) => x.PremioTotal), + PremioLiquido = list40.Sum((Renovacao x) => x.PremioLiquido) + }); + string text19 = await Funcoes.GenerateTable(list40, Relatorio, grafico: false, verificarColunas: true, footer, config); + List sintetico4 = (listRenovacao.Any((Renovacao x) => x.Selecionado) ? listRenovacao.Where((Renovacao x) => x.Selecionado && x.Vendedor == grupo25).ToList() : listRenovacao.Where((Renovacao x) => x.Vendedor == grupo25).ToList()); + List sintetic18 = SintetizarRenovacao(grupo25, sintetico4).ConstruirSintetico(Relatorio); + string text = text19; + text19 = text + await Funcoes.GenerateTableSintetic(sintetic18, config.TamanhoFonte); + relatorio += Funcoes.CreateCard(grupo25, text19, pageBreak); + } + } + break; + } + case 3: + { + List agrupamento30 = (from x in listRenovacao + orderby x.Estipulante + select x.Estipulante).Distinct().ToList(); + foreach (string grupo22 in agrupamento30) + { + List list43 = (listRenovacao.Any((Renovacao x) => x.Selecionado) ? listRenovacao.Where((Renovacao x) => x.Selecionado && x.Estipulante == grupo22).ToList() : listRenovacao.Where((Renovacao x) => x.Estipulante == grupo22).ToList()); + if (list43.Count != 0) + { + list43.Add(new Renovacao + { + Cliente = "TOTAL", + Comissao = (list43.Any() ? (list43.Sum((Renovacao x) => x.Comissao) / (decimal)list43.Count) : 0m), + PremioTotal = list43.Sum((Renovacao x) => x.PremioTotal), + PremioLiquido = list43.Sum((Renovacao x) => x.PremioLiquido) + }); + string text22 = await Funcoes.GenerateTable(list43, Relatorio, grafico: false, verificarColunas: true, footer, config); + List sintetico7 = (listRenovacao.Any((Renovacao x) => x.Selecionado) ? listRenovacao.Where((Renovacao x) => x.Selecionado && x.Estipulante == grupo22).ToList() : listRenovacao.Where((Renovacao x) => x.Estipulante == grupo22).ToList()); + List sintetic21 = SintetizarRenovacao(grupo22, sintetico7).ConstruirSintetico(Relatorio); + string text = text22; + text22 = text + await Funcoes.GenerateTableSintetic(sintetic21, config.TamanhoFonte); + relatorio += Funcoes.CreateCard(grupo22, text22, pageBreak); + } + } + break; + } + case 4: + { + List agrupamento30 = (from x in listRenovacao + orderby x.Status + select x.Status).Distinct().ToList(); + foreach (string grupo26 in agrupamento30) + { + List list39 = (listRenovacao.Any((Renovacao x) => x.Selecionado) ? listRenovacao.Where((Renovacao x) => x.Selecionado && x.Status == grupo26).ToList() : listRenovacao.Where((Renovacao x) => x.Status == grupo26).ToList()); + if (list39.Count != 0) + { + list39.Add(new Renovacao + { + Cliente = "TOTAL", + Comissao = (list39.Any() ? (list39.Sum((Renovacao x) => x.Comissao) / (decimal)list39.Count) : 0m), + PremioTotal = list39.Sum((Renovacao x) => x.PremioTotal), + PremioLiquido = list39.Sum((Renovacao x) => x.PremioLiquido) + }); + string text18 = await Funcoes.GenerateTable(list39, Relatorio, grafico: false, verificarColunas: true, footer, config); + List sintetico3 = (listRenovacao.Any((Renovacao x) => x.Selecionado) ? listRenovacao.Where((Renovacao x) => x.Selecionado && x.Status == grupo26).ToList() : listRenovacao.Where((Renovacao x) => x.Status == grupo26).ToList()); + List sintetic17 = SintetizarRenovacao(grupo26, sintetico3).ConstruirSintetico(Relatorio); + string text = text18; + text18 = text + await Funcoes.GenerateTableSintetic(sintetic17, config.TamanhoFonte); + relatorio += Funcoes.CreateCard(grupo26, text18, pageBreak); + } + } + break; + } + } + break; + } + case 5: + { + ColunasOcultas = await Funcoes.OcultarColunas(Relatorio); + List listComissaoRelatorio = ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(); + Agrupamento agrupamento42 = Agrupamento; + switch (agrupamento42 - 1) + { + default: + relatorio = await Funcoes.GenerateTable(listComissaoRelatorio.Any((Comissao x) => x.Selecionado) ? listComissaoRelatorio.Where((Comissao x) => x.Selecionado).ToList() : listComissaoRelatorio, Relatorio, grafico: false, verificarColunas: true, footer, config); + break; + case 0: + { + List agrupamento30 = (from x in listComissaoRelatorio + orderby x.Seguradora + select x.Seguradora).Distinct().ToList(); + foreach (string grupo2 in agrupamento30) + { + List list79 = (listComissaoRelatorio.Any((Comissao x) => x.Selecionado) ? listComissaoRelatorio.Where((Comissao x) => x.Selecionado && x.Seguradora == grupo2).ToList() : listComissaoRelatorio.Where((Comissao x) => x.Seguradora == grupo2).ToList()); + if (list79.Count != 0) + { + list79.Add(new Comissao + { + Cliente = "TOTAL", + ComissaoPerc = (list79.Any() ? (list79.Sum((Comissao x) => x.ComissaoPerc) / (decimal)list79.Count) : 0m), + ValorComissao = list79.Sum((Comissao x) => x.ValorComissao), + ComissaoBruta = list79.Sum((Comissao x) => x.ComissaoBruta), + ComissaoRecebida = list79.Sum((Comissao x) => x.ComissaoRecebida), + Repasse = list79.Sum((Comissao x) => x.Repasse) + }); + string text41 = await Funcoes.GenerateTable(list79, Relatorio, grafico: false, verificarColunas: true, footer, config); + List source10 = (listComissaoRelatorio.Any((Comissao x) => x.Selecionado) ? listComissaoRelatorio.Where((Comissao x) => x.Selecionado && x.Seguradora == grupo2).ToList() : listComissaoRelatorio.Where((Comissao x) => x.Seguradora == grupo2).ToList()); + List sintetic40 = Funcoes.ConstruirSintetico(new Sintetico + { + Agrupamento = grupo2, + ComissaoRecebidaBruta = source10.Sum((Comissao x) => x.ComissaoRecebida), + ComissaoPrevista = source10.Sum((Comissao x) => x.ValorLiquido), + Repasse = source10.Sum((Comissao x) => x.Repasse) + }, Relatorio); + string text = text41; + text41 = text + await Funcoes.GenerateTableSintetic(sintetic40, config.TamanhoFonte); + relatorio += Funcoes.CreateCard(grupo2, text41, pageBreak); + } + } + break; + } + case 1: + { + List agrupamento30 = (from x in listComissaoRelatorio + orderby x.Ramo + select x.Ramo).Distinct().ToList(); + foreach (string grupo3 in agrupamento30) + { + List list78 = (listComissaoRelatorio.Any((Comissao x) => x.Selecionado) ? listComissaoRelatorio.Where((Comissao x) => x.Selecionado && x.Ramo == grupo3).ToList() : listComissaoRelatorio.Where((Comissao x) => x.Ramo == grupo3).ToList()); + if (list78.Count != 0) + { + list78.Add(new Comissao + { + Cliente = "TOTAL", + ComissaoPerc = (list78.Any() ? (list78.Sum((Comissao x) => x.ComissaoPerc) / (decimal)list78.Count) : 0m), + ValorComissao = list78.Sum((Comissao x) => x.ValorComissao) + }); + string text40 = await Funcoes.GenerateTable(list78, Relatorio, grafico: false, verificarColunas: true, footer, config); + List source9 = (listComissaoRelatorio.Any((Comissao x) => x.Selecionado) ? listComissaoRelatorio.Where((Comissao x) => x.Selecionado && x.Ramo == grupo3).ToList() : listComissaoRelatorio.Where((Comissao x) => x.Ramo == grupo3).ToList()); + List sintetic39 = Funcoes.ConstruirSintetico(new Sintetico + { + Agrupamento = grupo3, + ComissaoRecebidaBruta = source9.Sum((Comissao x) => x.ComissaoRecebida), + ComissaoPrevista = source9.Sum((Comissao x) => x.ValorLiquido), + Repasse = source9.Sum((Comissao x) => x.Repasse) + }, Relatorio); + string text = text40; + text40 = text + await Funcoes.GenerateTableSintetic(sintetic39, config.TamanhoFonte); + relatorio += Funcoes.CreateCard(grupo3, text40, pageBreak); + } + } + break; + } + case 2: + { + List agrupamento30 = (from x in listComissaoRelatorio + orderby x.Vendedor + select x.Vendedor).Distinct().ToList(); + List sinteticVendedor = new List(); + bool tabelaVendedores = await ShowMessage("DESEJA COLOCAR A TOTALIZAÇÃO DOS VENDEDORES EM APENAS UMA TABELA??", "SIM", "NÃO"); + if (tabelaVendedores) + { + List list76 = new List(); + foreach (string grupo5 in agrupamento30) + { + List source7 = (listComissaoRelatorio.Any((Comissao x) => x.Selecionado) ? listComissaoRelatorio.Where((Comissao x) => x.Selecionado && x.Vendedor == grupo5).ToList() : listComissaoRelatorio.Where((Comissao x) => x.Vendedor == grupo5).ToList()); + List list77 = Funcoes.ConstruirSintetico(new Sintetico + { + Agrupamento = (grupo5 ?? "NÃO CADASTRADO"), + ComissaoRecebidaBruta = source7.Sum((Comissao x) => x.ComissaoRecebida), + ComissaoPrevista = source7.Sum((Comissao x) => x.ValorLiquido), + Repasse = source7.Sum((Comissao x) => x.Repasse) + }, Relatorio); + list77.Insert(0, new SinteticModel + { + Hint = "VENDEDOR", + Value = (grupo5 ?? "NÃO CADASTRADO") + }); + list76.AddRange(list77); + } + sinteticVendedor = (from x in list76.OrderByDescending((SinteticModel x) => x.Hint).ToList() + group x by x.Hint).Select((Func, SinteticModelList>)((IGrouping x) => new SinteticModelList + { + Hint = x.First().Hint, + Value = x.Select((SinteticModel v) => v.Value).ToList() + })).ToList(); + } + int i = 0; + foreach (string grupo4 in agrupamento30) + { + string text39 = ""; + List prod2 = (listComissaoRelatorio.Any((Comissao x) => x.Selecionado) ? listComissaoRelatorio.Where((Comissao x) => x.Selecionado && x.Vendedor == grupo4).ToList() : listComissaoRelatorio.Where((Comissao x) => x.Vendedor == grupo4).ToList()); + if (prod2.Count != 0) + { + prod2.Add(new Comissao + { + Cliente = "TOTAL", + ComissaoPerc = (prod2.Any() ? (prod2.Sum((Comissao x) => x.ComissaoPerc) / (decimal)prod2.Count) : 0m), + ValorComissao = prod2.Sum((Comissao x) => x.ValorComissao), + ComissaoRecebida = prod2.Sum((Comissao p) => p.ComissaoRecebida), + Repasse = prod2.Sum((Comissao p) => p.Repasse), + ValorLiquido = prod2.Sum((Comissao p) => p.ValorLiquido), + PremioLiquido = prod2.Sum((Comissao p) => p.PremioLiquido) + }); + if (i == 0 && tabelaVendedores) + { + string text = text39; + text39 = text + await Funcoes.GenerateTableSintetic(sinteticVendedor, config.TamanhoFonte); + relatorio += Funcoes.CreateCard("COMISSÃO RECEBIDA POR VENDEDOR", text39, pageBreak); + } + i++; + text39 = await Funcoes.GenerateTable(prod2, Relatorio, grafico: false, verificarColunas: true, footer, config); + List source8 = (listComissaoRelatorio.Any((Comissao x) => x.Selecionado) ? listComissaoRelatorio.Where((Comissao x) => x.Selecionado && x.Vendedor == grupo4).ToList() : listComissaoRelatorio.Where((Comissao x) => x.Vendedor == grupo4).ToList()); + Sintetico sintetico8 = new Sintetico + { + Agrupamento = (grupo4 ?? "NÃO CADASTRADO"), + ComissaoRecebidaBruta = source8.Sum((Comissao x) => x.ComissaoRecebida), + ComissaoPrevista = source8.Sum((Comissao x) => x.ValorLiquido), + Repasse = source8.Sum((Comissao x) => x.Repasse) + }; + if (!tabelaVendedores) + { + List sintetic38 = sintetico8.ConstruirSintetico(Relatorio); + string text = text39; + text39 = text + await Funcoes.GenerateTableSintetic(sintetic38, config.TamanhoFonte); + } + relatorio += Funcoes.CreateCard(grupo4 ?? "NÃO CADASTRADO", text39, pageBreak); + } + } + break; + } + case 3: + { + List agrupamento30 = (from x in listComissaoRelatorio + orderby x.Estipulante + select x.Estipulante).Distinct().ToList(); + foreach (string grupo in agrupamento30) + { + List list80 = (listComissaoRelatorio.Any((Comissao x) => x.Selecionado) ? listComissaoRelatorio.Where((Comissao x) => x.Selecionado && x.Estipulante == grupo).ToList() : listComissaoRelatorio.Where((Comissao x) => x.Estipulante == grupo).ToList()); + if (list80.Count != 0) + { + list80.Add(new Comissao + { + Cliente = "TOTAL", + ComissaoPerc = (list80.Any() ? (list80.Sum((Comissao x) => x.ComissaoPerc) / (decimal)list80.Count) : 0m), + ValorComissao = list80.Sum((Comissao x) => x.ValorComissao) + }); + string text42 = await Funcoes.GenerateTable(list80, Relatorio, grafico: false, verificarColunas: true, footer, config); + List source11 = (listComissaoRelatorio.Any((Comissao x) => x.Selecionado) ? listComissaoRelatorio.Where((Comissao x) => x.Selecionado && x.Estipulante == grupo).ToList() : listComissaoRelatorio.Where((Comissao x) => x.Estipulante == grupo).ToList()); + List sintetic41 = Funcoes.ConstruirSintetico(new Sintetico + { + Agrupamento = grupo, + ComissaoRecebidaBruta = source11.Sum((Comissao x) => x.ComissaoRecebida), + ComissaoPrevista = source11.Sum((Comissao x) => x.ValorLiquido), + Repasse = source11.Sum((Comissao x) => x.Repasse) + }, Relatorio); + string text = text42; + text42 = text + await Funcoes.GenerateTableSintetic(sintetic41, config.TamanhoFonte); + relatorio += Funcoes.CreateCard(grupo, text42, pageBreak); + } + } + break; + } + case 4: + { + List agrupamento30 = (from x in listComissaoRelatorio + orderby x.Status + select x.Status).Distinct().ToList(); + foreach (string grupo6 in agrupamento30) + { + List list75 = (listComissaoRelatorio.Any((Comissao x) => x.Selecionado) ? listComissaoRelatorio.Where((Comissao x) => x.Selecionado && x.Status == grupo6).ToList() : listComissaoRelatorio.Where((Comissao x) => x.Status == grupo6).ToList()); + if (list75.Count != 0) + { + list75.Add(new Comissao + { + Cliente = "TOTAL", + ComissaoPerc = (list75.Any() ? (list75.Sum((Comissao x) => x.ComissaoPerc) / (decimal)list75.Count) : 0m), + ValorComissao = list75.Sum((Comissao x) => x.ValorComissao) + }); + string text38 = await Funcoes.GenerateTable(list75, Relatorio, grafico: false, verificarColunas: true, footer, config); + List source6 = (listComissaoRelatorio.Any((Comissao x) => x.Selecionado) ? listComissaoRelatorio.Where((Comissao x) => x.Selecionado && x.Status == grupo6).ToList() : listComissaoRelatorio.Where((Comissao x) => x.Status == grupo6).ToList()); + List sintetic37 = Funcoes.ConstruirSintetico(new Sintetico + { + Agrupamento = grupo6, + ComissaoRecebidaBruta = source6.Sum((Comissao x) => x.ComissaoRecebida), + ComissaoPrevista = source6.Sum((Comissao x) => x.ValorLiquido), + Repasse = source6.Sum((Comissao x) => x.Repasse) + }, Relatorio); + string text = text38; + text38 = text + await Funcoes.GenerateTableSintetic(sintetic37, config.TamanhoFonte); + relatorio += Funcoes.CreateCard(grupo6, text38, pageBreak); + } + } + break; + } + } + break; + } + case 6: + case 16: + { + ColunasOcultas = await Funcoes.OcultarColunas(Relatorio); + List listPendente = ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(); + Agrupamento agrupamento42 = Agrupamento; + switch (agrupamento42 - 1) + { + default: + relatorio = await Funcoes.GenerateTable(listPendente.Any((Pendente x) => x.Selecionado) ? listPendente.Where((Pendente x) => x.Selecionado).ToList() : listPendente, Relatorio, grafico: false, verificarColunas: true, footer, config); + break; + case 0: + { + List agrupamento30 = (from x in listPendente + orderby x.Seguradora + select x.Seguradora).Distinct().ToList(); + foreach (string grupo8 in agrupamento30) + { + List list69 = (listPendente.Any((Pendente x) => x.Selecionado) ? listPendente.Where((Pendente x) => x.Selecionado && x.Seguradora == grupo8).ToList() : listPendente.Where((Pendente x) => x.Seguradora == grupo8).ToList()); + if (list69.Count != 0) + { + list69.Add(new Pendente + { + Cliente = "TOTAL", + ComissaoPerc = (list69.Any() ? (list69.Sum((Pendente x) => x.ComissaoPerc) / (decimal)list69.Count) : 0m), + ComissaoGerada = list69.Sum((Pendente x) => x.ComissaoGerada), + ComissaoPrevista = list69.Sum((Pendente x) => x.ComissaoPrevista), + TotalPrevisto = list69.Sum((Pendente x) => x.TotalPrevisto) + }); + string text36 = await Funcoes.GenerateTable(list69, Relatorio, grafico: false, verificarColunas: true, footer, config); + List list70 = (listPendente.Any((Pendente x) => x.Selecionado) ? listPendente.Where((Pendente x) => x.Selecionado && x.Seguradora == grupo8).ToList() : listPendente.Where((Pendente x) => x.Seguradora == grupo8).ToList()); + List sintetic35 = Funcoes.ConstruirSintetico(new Sintetico + { + Agrupamento = grupo8, + ComissaoPrevista = list70.Sum((Pendente x) => x.ComissaoPrevista), + TotalPrevista = list70.Sum((Pendente x) => x.TotalPrevisto), + TotalGeral = list70.Count + }, Relatorio); + string text = text36; + text36 = text + await Funcoes.GenerateTableSintetic(sintetic35, config.TamanhoFonte); + relatorio += Funcoes.CreateCard(grupo8, text36, pageBreak); + } + } + break; + } + case 1: + { + List agrupamento30 = (from x in listPendente + orderby x.Ramo + select x.Ramo).Distinct().ToList(); + foreach (string grupo9 in agrupamento30) + { + List list67 = (listPendente.Any((Pendente x) => x.Selecionado) ? listPendente.Where((Pendente x) => x.Selecionado && x.Ramo == grupo9).ToList() : listPendente.Where((Pendente x) => x.Ramo == grupo9).ToList()); + if (list67.Count != 0) + { + list67.Add(new Pendente + { + Cliente = "TOTAL", + ComissaoPerc = (list67.Any() ? (list67.Sum((Pendente x) => x.ComissaoPerc) / (decimal)list67.Count) : 0m), + ComissaoGerada = list67.Sum((Pendente x) => x.ComissaoGerada), + ComissaoPrevista = list67.Sum((Pendente x) => x.ComissaoPrevista), + TotalPrevisto = list67.Sum((Pendente x) => x.TotalPrevisto) + }); + string text35 = await Funcoes.GenerateTable(list67, Relatorio, grafico: false, verificarColunas: true, footer, config); + List list68 = (listPendente.Any((Pendente x) => x.Selecionado) ? listPendente.Where((Pendente x) => x.Selecionado && x.Ramo == grupo9).ToList() : listPendente.Where((Pendente x) => x.Ramo == grupo9).ToList()); + List sintetic34 = Funcoes.ConstruirSintetico(new Sintetico + { + Agrupamento = grupo9, + ComissaoPrevista = list68.Sum((Pendente x) => x.ComissaoPrevista), + TotalPrevista = list68.Sum((Pendente x) => x.TotalPrevisto), + TotalGeral = list68.Count + }, Relatorio); + string text = text35; + text35 = text + await Funcoes.GenerateTableSintetic(sintetic34, config.TamanhoFonte); + relatorio += Funcoes.CreateCard(grupo9, text35, pageBreak); + } + } + break; + } + case 2: + { + List agrupamento30 = (from x in listPendente + orderby x.Vendedor + select x.Vendedor).Distinct().ToList(); + foreach (string grupo10 in agrupamento30) + { + List list65 = (listPendente.Any((Pendente x) => x.Selecionado) ? listPendente.Where((Pendente x) => x.Selecionado && x.Vendedor == grupo10).ToList() : listPendente.Where((Pendente x) => x.Vendedor == grupo10).ToList()); + if (list65.Count != 0) + { + list65.Add(new Pendente + { + Cliente = "TOTAL", + ComissaoPerc = (list65.Any() ? (list65.Sum((Pendente x) => x.ComissaoPerc) / (decimal)list65.Count) : 0m), + ComissaoGerada = list65.Sum((Pendente x) => x.ComissaoGerada), + ComissaoPrevista = list65.Sum((Pendente x) => x.ComissaoPrevista), + TotalPrevisto = list65.Sum((Pendente x) => x.TotalPrevisto) + }); + string text34 = await Funcoes.GenerateTable(list65, Relatorio, grafico: false, verificarColunas: true, footer, config); + List list66 = (listPendente.Any((Pendente x) => x.Selecionado) ? listPendente.Where((Pendente x) => x.Selecionado && x.Vendedor == grupo10).ToList() : listPendente.Where((Pendente x) => x.Vendedor == grupo10).ToList()); + List sintetic33 = Funcoes.ConstruirSintetico(new Sintetico + { + Agrupamento = grupo10, + ComissaoPrevista = list66.Sum((Pendente x) => x.ComissaoPrevista), + TotalPrevista = list66.Sum((Pendente x) => x.TotalPrevisto), + TotalGeral = list66.Count + }, Relatorio); + string text = text34; + text34 = text + await Funcoes.GenerateTableSintetic(sintetic33, config.TamanhoFonte); + relatorio += Funcoes.CreateCard(grupo10, text34, pageBreak); + } + } + break; + } + case 3: + { + List agrupamento30 = (from x in listPendente + orderby x.Estipulante + select x.Estipulante).Distinct().ToList(); + foreach (string grupo7 in agrupamento30) + { + List list71 = (listPendente.Any((Pendente x) => x.Selecionado) ? listPendente.Where((Pendente x) => x.Selecionado && x.Estipulante == grupo7).ToList() : listPendente.Where((Pendente x) => x.Estipulante == grupo7).ToList()); + if (list71.Count != 0) + { + list71.Add(new Pendente + { + Cliente = "TOTAL", + ComissaoPerc = (list71.Any() ? (list71.Sum((Pendente x) => x.ComissaoPerc) / (decimal)list71.Count) : 0m), + ComissaoGerada = list71.Sum((Pendente x) => x.ComissaoGerada), + ComissaoPrevista = list71.Sum((Pendente x) => x.ComissaoPrevista), + TotalPrevisto = list71.Sum((Pendente x) => x.TotalPrevisto), + ValorParcela = list71.Sum((Pendente x) => x.ValorParcela) + }); + string text37 = await Funcoes.GenerateTable(list71, Relatorio, grafico: false, verificarColunas: true, footer, config); + List list72 = (listPendente.Any((Pendente x) => x.Selecionado) ? listPendente.Where((Pendente x) => x.Selecionado && x.Estipulante == grupo7).ToList() : listPendente.Where((Pendente x) => x.Estipulante == grupo7).ToList()); + List sintetic36 = Funcoes.ConstruirSintetico(new Sintetico + { + Agrupamento = grupo7, + ComissaoPrevista = list72.Sum((Pendente x) => x.ComissaoPrevista), + TotalPrevista = list72.Sum((Pendente x) => x.TotalPrevisto), + TotalGeral = list72.Count + }, Relatorio); + string text = text37; + text37 = text + await Funcoes.GenerateTableSintetic(sintetic36, config.TamanhoFonte); + relatorio += Funcoes.CreateCard(grupo7, text37, pageBreak); + } + } + break; + } + case 4: + { + List agrupamento30 = (from x in listPendente + orderby x.Status + select x.Status).Distinct().ToList(); + foreach (string grupo11 in agrupamento30) + { + List list63 = (listPendente.Any((Pendente x) => x.Selecionado) ? listPendente.Where((Pendente x) => x.Selecionado && x.Status == grupo11).ToList() : listPendente.Where((Pendente x) => x.Status == grupo11).ToList()); + if (list63.Count != 0) + { + list63.Add(new Pendente + { + Cliente = "TOTAL", + ComissaoPerc = (list63.Any() ? (list63.Sum((Pendente x) => x.ComissaoPerc) / (decimal)list63.Count) : 0m), + ComissaoGerada = list63.Sum((Pendente x) => x.ComissaoGerada), + ComissaoPrevista = list63.Sum((Pendente x) => x.ComissaoPrevista), + TotalPrevisto = list63.Sum((Pendente x) => x.TotalPrevisto) + }); + string text33 = await Funcoes.GenerateTable(list63, Relatorio, grafico: false, verificarColunas: true, footer, config); + List list64 = (listPendente.Any((Pendente x) => x.Selecionado) ? listPendente.Where((Pendente x) => x.Selecionado && x.Status == grupo11).ToList() : listPendente.Where((Pendente x) => x.Status == grupo11).ToList()); + List sintetic32 = Funcoes.ConstruirSintetico(new Sintetico + { + Agrupamento = grupo11, + ComissaoPrevista = list64.Sum((Pendente x) => x.ComissaoPrevista), + TotalPrevista = list64.Sum((Pendente x) => x.TotalPrevisto), + TotalGeral = list64.Count + }, Relatorio); + string text = text33; + text33 = text + await Funcoes.GenerateTableSintetic(sintetic32, config.TamanhoFonte); + relatorio += Funcoes.CreateCard(grupo11, text33, pageBreak); + } + } + break; + } + } + break; + } + case 9: + case 10: + { + ColunasOcultas = await Funcoes.OcultarColunas(Relatorio); + List listSinistroAnalitico = ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(); + Agrupamento agrupamento42 = Agrupamento; + switch (agrupamento42 - 1) + { + default: + relatorio = await Funcoes.GenerateTable(listSinistroAnalitico.Any((Sinistro x) => x.Selecionado) ? listSinistroAnalitico.Where((Sinistro x) => x.Selecionado).ToList() : listSinistroAnalitico, Relatorio, grafico: false, verificarColunas: true, footer, config); + break; + case 0: + { + List agrupamento30 = (from x in listSinistroAnalitico + orderby x.Seguradora + select x.Seguradora).Distinct().ToList(); + foreach (string grupo13 in agrupamento30) + { + List list59 = (listSinistroAnalitico.Any((Sinistro x) => x.Selecionado) ? listSinistroAnalitico.Where((Sinistro x) => x.Selecionado && x.Seguradora == grupo13).ToList() : listSinistroAnalitico.Where((Sinistro x) => x.Seguradora == grupo13).ToList()); + if (list59.Count == 0) + { + continue; + } + if ((int)Relatorio != 9) + { + list59.Add(new Sinistro + { + Nome = "TOTAL", + Valor = list59.Sum((Sinistro x) => x.Valor), + ValorOrcado = list59.Sum((Sinistro x) => x.ValorOrcado), + ValorLiberado = list59.Sum((Sinistro x) => x.ValorLiberado), + ValorPago = list59.Sum((Sinistro x) => x.ValorPago), + ValorSalvado = list59.Sum((Sinistro x) => x.ValorSalvado), + ValorFranquia = list59.Sum((Sinistro x) => x.ValorFranquia) + }); + } + string text31 = await Funcoes.GenerateTable(list59, Relatorio, grafico: false, verificarColunas: true, footer, config); + List source4 = (listSinistroAnalitico.Any((Sinistro x) => x.Selecionado) ? listSinistroAnalitico.Where((Sinistro x) => x.Selecionado && x.Seguradora == grupo13).ToList() : listSinistroAnalitico.Where((Sinistro x) => x.Seguradora == grupo13).ToList()); + List sintetic30 = Funcoes.ConstruirSintetico(new Sintetico + { + Liquidado = (from x in source4 + where x.Liquidacao.HasValue + select ((DomainBase)x.EntidadeSinistro.ControleSinistro).Id).Distinct().Count(), + Valor = source4.Sum((Sinistro x) => x.Valor), + ValorOrcado = source4.Sum((Sinistro x) => x.ValorOrcado), + ValorLiberado = source4.Sum((Sinistro x) => x.ValorLiberado), + ValorLiquidado = source4.Where((Sinistro x) => x.Liquidacao.HasValue).Sum((Sinistro x) => x.ValorPago), + ValorPago = source4.Sum((Sinistro x) => x.ValorPago), + ValorSalvado = source4.Sum((Sinistro x) => x.ValorSalvado), + ValorFranquia = source4.Sum((Sinistro x) => x.ValorFranquia), + Pendente = (from x in source4 + where !x.Liquidacao.HasValue + select ((DomainBase)x.EntidadeSinistro.ControleSinistro).Id).Distinct().Count(), + TotalGeral = listSinistroAnalitico.Distinct().Count(), + TotalClientes = listSinistroAnalitico.Select((Sinistro x) => x.EntidadeSinistro.TipoSinistro == (TipoSinistro?)0).Distinct().Count(), + TotalTerceiros = listSinistroAnalitico.Select((Sinistro x) => (int)x.EntidadeSinistro.TipoSinistro.GetValueOrDefault() == 1).Distinct().Count() + }, Relatorio); + string text = text31; + text31 = text + await Funcoes.GenerateTableSintetic(sintetic30, config.TamanhoFonte); + relatorio += Funcoes.CreateCard(grupo13, text31, pageBreak); + } + break; + } + case 1: + { + List agrupamento30 = (from x in listSinistroAnalitico + orderby x.Ramo + select x.Ramo).Distinct().ToList(); + foreach (string grupo14 in agrupamento30) + { + List list58 = (listSinistroAnalitico.Any((Sinistro x) => x.Selecionado) ? listSinistroAnalitico.Where((Sinistro x) => x.Selecionado && x.Ramo == grupo14).ToList() : listSinistroAnalitico.Where((Sinistro x) => x.Ramo == grupo14).ToList()); + if (list58.Count == 0) + { + continue; + } + if ((int)Relatorio != 9) + { + list58.Add(new Sinistro + { + Nome = "TOTAL", + Valor = list58.Sum((Sinistro x) => x.Valor), + ValorOrcado = list58.Sum((Sinistro x) => x.ValorOrcado), + ValorLiberado = list58.Sum((Sinistro x) => x.ValorLiberado), + ValorPago = list58.Sum((Sinistro x) => x.ValorPago), + ValorSalvado = list58.Sum((Sinistro x) => x.ValorSalvado), + ValorFranquia = list58.Sum((Sinistro x) => x.ValorFranquia) + }); + } + string text30 = await Funcoes.GenerateTable(list58, Relatorio, grafico: false, verificarColunas: true, footer, config); + List source3 = (listSinistroAnalitico.Any((Sinistro x) => x.Selecionado) ? listSinistroAnalitico.Where((Sinistro x) => x.Selecionado && x.Ramo == grupo14).ToList() : listSinistroAnalitico.Where((Sinistro x) => x.Ramo == grupo14).ToList()); + List sintetic29 = Funcoes.ConstruirSintetico(new Sintetico + { + Liquidado = (from x in source3 + where x.Liquidacao.HasValue + select ((DomainBase)x.EntidadeSinistro.ControleSinistro).Id).Distinct().Count(), + Valor = source3.Sum((Sinistro x) => x.Valor), + ValorOrcado = source3.Sum((Sinistro x) => x.ValorOrcado), + ValorLiberado = source3.Sum((Sinistro x) => x.ValorLiberado), + ValorLiquidado = source3.Where((Sinistro x) => x.Liquidacao.HasValue).Sum((Sinistro x) => x.ValorPago), + ValorPago = source3.Sum((Sinistro x) => x.ValorPago), + ValorSalvado = source3.Sum((Sinistro x) => x.ValorSalvado), + ValorFranquia = source3.Sum((Sinistro x) => x.ValorFranquia), + Pendente = (from x in source3 + where !x.Liquidacao.HasValue + select ((DomainBase)x.EntidadeSinistro.ControleSinistro).Id).Distinct().Count(), + TotalGeral = listSinistroAnalitico.Distinct().Count(), + TotalClientes = listSinistroAnalitico.Select((Sinistro x) => x.EntidadeSinistro.TipoSinistro == (TipoSinistro?)0).Distinct().Count(), + TotalTerceiros = listSinistroAnalitico.Select((Sinistro x) => (int)x.EntidadeSinistro.TipoSinistro.GetValueOrDefault() == 1).Distinct().Count() + }, Relatorio); + string text = text30; + text30 = text + await Funcoes.GenerateTableSintetic(sintetic29, config.TamanhoFonte); + relatorio += Funcoes.CreateCard(grupo14, text30, pageBreak); + } + break; + } + case 2: + { + List agrupamento30 = (from x in listSinistroAnalitico + orderby x.Vendedor + select x.Vendedor).Distinct().ToList(); + foreach (string grupo15 in agrupamento30) + { + List list57 = (listSinistroAnalitico.Any((Sinistro x) => x.Selecionado) ? listSinistroAnalitico.Where((Sinistro x) => x.Selecionado && x.Vendedor == grupo15).ToList() : listSinistroAnalitico.Where((Sinistro x) => x.Vendedor == grupo15).ToList()); + if (list57.Count == 0) + { + continue; + } + if ((int)Relatorio != 9) + { + list57.Add(new Sinistro + { + Nome = "TOTAL", + Valor = list57.Sum((Sinistro x) => x.Valor), + ValorOrcado = list57.Sum((Sinistro x) => x.ValorOrcado), + ValorLiberado = list57.Sum((Sinistro x) => x.ValorLiberado), + ValorPago = list57.Sum((Sinistro x) => x.ValorPago), + ValorSalvado = list57.Sum((Sinistro x) => x.ValorSalvado), + ValorFranquia = list57.Sum((Sinistro x) => x.ValorFranquia) + }); + } + string text29 = await Funcoes.GenerateTable(list57, Relatorio, grafico: false, verificarColunas: true, footer, config); + List source2 = (listSinistroAnalitico.Any((Sinistro x) => x.Selecionado) ? listSinistroAnalitico.Where((Sinistro x) => x.Selecionado && x.Vendedor == grupo15).ToList() : listSinistroAnalitico.Where((Sinistro x) => x.Vendedor == grupo15).ToList()); + List sintetic28 = Funcoes.ConstruirSintetico(new Sintetico + { + Liquidado = (from x in source2 + where x.Liquidacao.HasValue + select ((DomainBase)x.EntidadeSinistro.ControleSinistro).Id).Distinct().Count(), + Valor = source2.Sum((Sinistro x) => x.Valor), + ValorOrcado = source2.Sum((Sinistro x) => x.ValorOrcado), + ValorLiberado = source2.Sum((Sinistro x) => x.ValorLiberado), + ValorLiquidado = source2.Where((Sinistro x) => x.Liquidacao.HasValue).Sum((Sinistro x) => x.ValorPago), + ValorPago = source2.Sum((Sinistro x) => x.ValorPago), + ValorSalvado = source2.Sum((Sinistro x) => x.ValorSalvado), + ValorFranquia = source2.Sum((Sinistro x) => x.ValorFranquia), + Pendente = (from x in source2 + where !x.Liquidacao.HasValue + select ((DomainBase)x.EntidadeSinistro.ControleSinistro).Id).Distinct().Count(), + TotalGeral = listSinistroAnalitico.Distinct().Count(), + TotalClientes = listSinistroAnalitico.Select((Sinistro x) => x.EntidadeSinistro.TipoSinistro == (TipoSinistro?)0).Distinct().Count(), + TotalTerceiros = listSinistroAnalitico.Select((Sinistro x) => (int)x.EntidadeSinistro.TipoSinistro.GetValueOrDefault() == 1).Distinct().Count() + }, Relatorio); + string text = text29; + text29 = text + await Funcoes.GenerateTableSintetic(sintetic28, config.TamanhoFonte); + relatorio += Funcoes.CreateCard(grupo15, text29, pageBreak); + } + break; + } + case 3: + { + List agrupamento30 = (from x in listSinistroAnalitico + orderby x.Estipulante + select x.Estipulante).Distinct().ToList(); + foreach (string grupo12 in agrupamento30) + { + List list60 = (listSinistroAnalitico.Any((Sinistro x) => x.Selecionado) ? listSinistroAnalitico.Where((Sinistro x) => x.Selecionado && x.Estipulante == grupo12).ToList() : listSinistroAnalitico.Where((Sinistro x) => x.Estipulante == grupo12).ToList()); + if (list60.Count == 0) + { + continue; + } + if ((int)Relatorio != 9) + { + list60.Add(new Sinistro + { + Nome = "TOTAL", + Valor = list60.Sum((Sinistro x) => x.Valor), + ValorOrcado = list60.Sum((Sinistro x) => x.ValorOrcado), + ValorLiberado = list60.Sum((Sinistro x) => x.ValorLiberado), + ValorPago = list60.Sum((Sinistro x) => x.ValorPago), + ValorSalvado = list60.Sum((Sinistro x) => x.ValorSalvado), + ValorFranquia = list60.Sum((Sinistro x) => x.ValorFranquia) + }); + } + string text32 = await Funcoes.GenerateTable(list60, Relatorio, grafico: false, verificarColunas: true, footer, config); + List source5 = (listSinistroAnalitico.Any((Sinistro x) => x.Selecionado) ? listSinistroAnalitico.Where((Sinistro x) => x.Selecionado && x.Estipulante == grupo12).ToList() : listSinistroAnalitico.Where((Sinistro x) => x.Estipulante == grupo12).ToList()); + List sintetic31 = Funcoes.ConstruirSintetico(new Sintetico + { + Liquidado = (from x in source5 + where x.Liquidacao.HasValue + select ((DomainBase)x.EntidadeSinistro.ControleSinistro).Id).Distinct().Count(), + Valor = source5.Sum((Sinistro x) => x.Valor), + ValorOrcado = source5.Sum((Sinistro x) => x.ValorOrcado), + ValorLiberado = source5.Sum((Sinistro x) => x.ValorLiberado), + ValorLiquidado = source5.Where((Sinistro x) => x.Liquidacao.HasValue).Sum((Sinistro x) => x.ValorPago), + ValorPago = source5.Sum((Sinistro x) => x.ValorPago), + ValorSalvado = source5.Sum((Sinistro x) => x.ValorSalvado), + ValorFranquia = source5.Sum((Sinistro x) => x.ValorFranquia), + Pendente = (from x in source5 + where !x.Liquidacao.HasValue + select ((DomainBase)x.EntidadeSinistro.ControleSinistro).Id).Distinct().Count(), + TotalGeral = listSinistroAnalitico.Distinct().Count(), + TotalClientes = listSinistroAnalitico.Select((Sinistro x) => x.EntidadeSinistro.TipoSinistro == (TipoSinistro?)0).Distinct().Count(), + TotalTerceiros = listSinistroAnalitico.Select((Sinistro x) => (int)x.EntidadeSinistro.TipoSinistro.GetValueOrDefault() == 1).Distinct().Count() + }, Relatorio); + string text = text32; + text32 = text + await Funcoes.GenerateTableSintetic(sintetic31, config.TamanhoFonte); + relatorio += Funcoes.CreateCard(grupo12, text32, pageBreak); + } + break; + } + case 4: + { + List agrupamento30 = (from x in listSinistroAnalitico + orderby x.StatusSinistro + select EnumHelper.GetDescription(x.StatusSinistro)).Distinct().ToList(); + foreach (string grupo16 in agrupamento30) + { + List list56 = (listSinistroAnalitico.Any((Sinistro x) => x.Selecionado) ? listSinistroAnalitico.Where((Sinistro x) => x.Selecionado && EnumHelper.GetDescription(x.StatusSinistro) == grupo16).ToList() : listSinistroAnalitico.Where((Sinistro x) => EnumHelper.GetDescription(x.StatusSinistro) == grupo16).ToList()); + if (list56.Count == 0) + { + continue; + } + if ((int)Relatorio != 9) + { + list56.Add(new Sinistro + { + Nome = "TOTAL", + Valor = list56.Sum((Sinistro x) => x.Valor), + ValorOrcado = list56.Sum((Sinistro x) => x.ValorOrcado), + ValorLiberado = list56.Sum((Sinistro x) => x.ValorLiberado), + ValorPago = list56.Sum((Sinistro x) => x.ValorPago), + ValorSalvado = list56.Sum((Sinistro x) => x.ValorSalvado), + ValorFranquia = list56.Sum((Sinistro x) => x.ValorFranquia) + }); + } + string text28 = await Funcoes.GenerateTable(list56, Relatorio, grafico: false, verificarColunas: true, footer, config); + List source = (listSinistroAnalitico.Any((Sinistro x) => x.Selecionado) ? listSinistroAnalitico.Where((Sinistro x) => x.Selecionado && EnumHelper.GetDescription(x.StatusSinistro) == grupo16).ToList() : listSinistroAnalitico.Where((Sinistro x) => EnumHelper.GetDescription(x.StatusSinistro) == grupo16).ToList()); + List sintetic27 = Funcoes.ConstruirSintetico(new Sintetico + { + Liquidado = (from x in source + where x.Liquidacao.HasValue + select ((DomainBase)x.EntidadeSinistro.ControleSinistro).Id).Distinct().Count(), + Valor = source.Sum((Sinistro x) => x.Valor), + ValorOrcado = source.Sum((Sinistro x) => x.ValorOrcado), + ValorLiberado = source.Sum((Sinistro x) => x.ValorLiberado), + ValorLiquidado = source.Where((Sinistro x) => x.Liquidacao.HasValue).Sum((Sinistro x) => x.ValorPago), + ValorPago = source.Sum((Sinistro x) => x.ValorPago), + ValorSalvado = source.Sum((Sinistro x) => x.ValorSalvado), + ValorFranquia = source.Sum((Sinistro x) => x.ValorFranquia), + Pendente = (from x in source + where !x.Liquidacao.HasValue + select ((DomainBase)x.EntidadeSinistro.ControleSinistro).Id).Distinct().Count(), + TotalGeral = listSinistroAnalitico.Distinct().Count(), + TotalClientes = listSinistroAnalitico.Select((Sinistro x) => x.EntidadeSinistro.TipoSinistro == (TipoSinistro?)0).Distinct().Count(), + TotalTerceiros = listSinistroAnalitico.Select((Sinistro x) => (int)x.EntidadeSinistro.TipoSinistro.GetValueOrDefault() == 1).Distinct().Count() + }, Relatorio); + string text = text28; + text28 = text + await Funcoes.GenerateTableSintetic(sintetic27, config.TamanhoFonte); + relatorio += Funcoes.CreateCard(grupo16, text28, pageBreak); + } + break; + } + } + break; + } + case 8: + { + ColunasOcultas = await Funcoes.OcultarColunas(Relatorio); + List listAuditoria = ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(); + Agrupamento agrupamento42 = Agrupamento; + switch (agrupamento42 - 1) + { + default: + relatorio = await Funcoes.GenerateTable(listAuditoria.Any((Auditoria x) => x.Selecionado) ? listAuditoria.Where((Auditoria x) => x.Selecionado).ToList() : listAuditoria, Relatorio, grafico: false, verificarColunas: true, footer, config); + break; + case 0: + { + List agrupamento30 = (from x in listAuditoria + orderby x.Seguradora + select x.Seguradora).Distinct().ToList(); + foreach (string grupo39 in agrupamento30) + { + List list9 = (listAuditoria.Any((Auditoria x) => x.Selecionado) ? listAuditoria.Where((Auditoria x) => x.Selecionado && x.Seguradora == grupo39).ToList() : listAuditoria.Where((Auditoria x) => x.Seguradora == grupo39).ToList()); + if (list9.Count != 0) + { + list9.Add(new Auditoria + { + Cliente = "TOTAL", + Comissao = (list9.Any() ? (list9.Sum((Auditoria x) => x.Comissao) / (decimal)list9.Count) : 0m), + PremioTotal = list9.Sum((Auditoria x) => x.PremioTotal), + PremioLiquido = list9.Sum((Auditoria x) => x.PremioLiquido), + ComissaoPrevista = list9.Sum((Auditoria x) => x.ComissaoPrevista), + ComissaoRecebida = list9.Sum((Auditoria x) => x.ComissaoRecebida) + }); + string text5 = await Funcoes.GenerateTable(list9, Relatorio, grafico: false, verificarColunas: true, footer, config); + List list10 = (listAuditoria.Any((Auditoria x) => x.Selecionado) ? listAuditoria.Where((Auditoria x) => x.Selecionado && x.Seguradora == grupo39).ToList() : listAuditoria.Where((Auditoria x) => x.Seguradora == grupo39).ToList()); + List sintetic4 = Funcoes.ConstruirSintetico(new Sintetico + { + Agrupamento = grupo39, + PremioTotal = list10.Sum((Auditoria x) => x.PremioTotal), + PremioLiquido = list10.Sum((Auditoria p) => p.PremioLiquido), + ComissaoRecebidaBruta = list10.Sum((Auditoria p) => p.ComissaoRecebida), + MediaComissao = (list10.Any((Auditoria c) => c.Comissao > 0m) ? decimal.Round(list10.Sum((Auditoria c) => c.Comissao) / (decimal)list10.Count((Auditoria c) => c.Comissao > 0m), 2) : 0m), + ComissaoPrevista = list10.Sum((Auditoria c) => c.ComissaoPrevista), + ComissaoGerada = list10.Sum((Auditoria c) => c.ComissaoPrevista), + Cancelamentos = list10.Count((Auditoria c) => (int)c.Documento.Situacao == 3), + Novos = list10.Count((Auditoria c) => (int)c.Documento.Situacao == 1 || ((int)c.Documento.Situacao == 2 && (int)c.Documento.Negocio.GetValueOrDefault() == 2)), + Renovacoes = list10.Count((Auditoria c) => (int)c.Documento.Situacao == 2 && (int)c.Documento.Negocio.GetValueOrDefault() == 1), + Apolices = list10.Count((Auditoria c) => c.Tipo == 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Endossos = list10.Count((Auditoria c) => c.Tipo != 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Faturas = list10.Count((Auditoria c) => (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 2), + TotalGeral = list10.Count + }, Relatorio); + string text = text5; + text5 = text + await Funcoes.GenerateTableSintetic(sintetic4, config.TamanhoFonte); + relatorio += Funcoes.CreateCard(grupo39, text5, pageBreak); + } + } + break; + } + case 1: + { + List agrupamento30 = (from x in listAuditoria + orderby x.Ramo + select x.Ramo).Distinct().ToList(); + foreach (string grupo40 in agrupamento30) + { + List list7 = (listAuditoria.Any((Auditoria x) => x.Selecionado) ? listAuditoria.Where((Auditoria x) => x.Selecionado && x.Ramo == grupo40).ToList() : listAuditoria.Where((Auditoria x) => x.Ramo == grupo40).ToList()); + if (list7.Count != 0) + { + list7.Add(new Auditoria + { + Cliente = "TOTAL", + Comissao = (list7.Any() ? (list7.Sum((Auditoria x) => x.Comissao) / (decimal)list7.Count) : 0m), + PremioTotal = list7.Sum((Auditoria x) => x.PremioTotal), + PremioLiquido = list7.Sum((Auditoria x) => x.PremioLiquido), + ComissaoPrevista = list7.Sum((Auditoria x) => x.ComissaoPrevista), + ComissaoRecebida = list7.Sum((Auditoria x) => x.ComissaoRecebida) + }); + string text4 = await Funcoes.GenerateTable(list7, Relatorio, grafico: false, verificarColunas: true, footer, config); + List list8 = (listAuditoria.Any((Auditoria x) => x.Selecionado) ? listAuditoria.Where((Auditoria x) => x.Selecionado && x.Ramo == grupo40).ToList() : listAuditoria.Where((Auditoria x) => x.Ramo == grupo40).ToList()); + List sintetic3 = Funcoes.ConstruirSintetico(new Sintetico + { + Agrupamento = grupo40, + PremioTotal = list8.Sum((Auditoria x) => x.PremioTotal), + PremioLiquido = list8.Sum((Auditoria p) => p.PremioLiquido), + ComissaoRecebidaBruta = list8.Sum((Auditoria p) => p.ComissaoRecebida), + MediaComissao = (list8.Any((Auditoria c) => c.Comissao > 0m) ? decimal.Round(list8.Sum((Auditoria c) => c.Comissao) / (decimal)list8.Count((Auditoria c) => c.Comissao > 0m), 2) : 0m), + ComissaoPrevista = list8.Sum((Auditoria c) => c.ComissaoPrevista), + ComissaoGerada = list8.Sum((Auditoria c) => c.ComissaoPrevista), + Cancelamentos = list8.Count((Auditoria c) => (int)c.Documento.Situacao == 3), + Novos = list8.Count((Auditoria c) => (int)c.Documento.Situacao == 1 || ((int)c.Documento.Situacao == 2 && (int)c.Documento.Negocio.GetValueOrDefault() == 2)), + Renovacoes = list8.Count((Auditoria c) => (int)c.Documento.Situacao == 2 && (int)c.Documento.Negocio.GetValueOrDefault() == 1), + Apolices = list8.Count((Auditoria c) => c.Tipo == 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Endossos = list8.Count((Auditoria c) => c.Tipo != 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Faturas = list8.Count((Auditoria c) => (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 2), + TotalGeral = list8.Count + }, Relatorio); + string text = text4; + text4 = text + await Funcoes.GenerateTableSintetic(sintetic3, config.TamanhoFonte); + relatorio += Funcoes.CreateCard(grupo40, text4, pageBreak); + } + } + break; + } + case 2: + { + List agrupamento30 = (from x in listAuditoria + orderby x.Vendedor + select x.Vendedor).Distinct().ToList(); + foreach (string grupo41 in agrupamento30) + { + List list5 = (listAuditoria.Any((Auditoria x) => x.Selecionado) ? listAuditoria.Where((Auditoria x) => x.Selecionado && x.Vendedor == grupo41).ToList() : listAuditoria.Where((Auditoria x) => x.Vendedor == grupo41).ToList()); + if (list5.Count != 0) + { + list5.Add(new Auditoria + { + Cliente = "TOTAL", + Comissao = (list5.Any() ? (list5.Sum((Auditoria x) => x.Comissao) / (decimal)list5.Count) : 0m), + PremioTotal = list5.Sum((Auditoria x) => x.PremioTotal), + PremioLiquido = list5.Sum((Auditoria x) => x.PremioLiquido), + ComissaoPrevista = list5.Sum((Auditoria x) => x.ComissaoPrevista), + ComissaoRecebida = list5.Sum((Auditoria x) => x.ComissaoRecebida) + }); + string text3 = await Funcoes.GenerateTable(list5, Relatorio, grafico: false, verificarColunas: true, footer, config); + List list6 = (listAuditoria.Any((Auditoria x) => x.Selecionado) ? listAuditoria.Where((Auditoria x) => x.Selecionado && x.Vendedor == grupo41).ToList() : listAuditoria.Where((Auditoria x) => x.Vendedor == grupo41).ToList()); + List sintetic2 = Funcoes.ConstruirSintetico(new Sintetico + { + Agrupamento = grupo41, + PremioTotal = list6.Sum((Auditoria x) => x.PremioTotal), + PremioLiquido = list6.Sum((Auditoria p) => p.PremioLiquido), + ComissaoRecebidaBruta = list6.Sum((Auditoria p) => p.ComissaoRecebida), + ComissaoPrevista = list6.Sum((Auditoria c) => c.ComissaoPrevista), + MediaComissao = (list6.Any((Auditoria c) => c.Comissao > 0m) ? decimal.Round(list6.Sum((Auditoria c) => c.Comissao) / (decimal)list6.Count((Auditoria c) => c.Comissao > 0m), 2) : 0m), + ComissaoGerada = list6.Sum((Auditoria c) => c.ComissaoPrevista), + Cancelamentos = list6.Count((Auditoria c) => (int)c.Documento.Situacao == 3), + Novos = list6.Count((Auditoria c) => (int)c.Documento.Situacao == 1 || ((int)c.Documento.Situacao == 2 && (int)c.Documento.Negocio.GetValueOrDefault() == 2)), + Renovacoes = list6.Count((Auditoria c) => (int)c.Documento.Situacao == 2 && (int)c.Documento.Negocio.GetValueOrDefault() == 1), + Apolices = list6.Count((Auditoria c) => c.Tipo == 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Endossos = list6.Count((Auditoria c) => c.Tipo != 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Faturas = list6.Count((Auditoria c) => (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 2), + TotalGeral = list6.Count + }, Relatorio); + string text = text3; + text3 = text + await Funcoes.GenerateTableSintetic(sintetic2, config.TamanhoFonte); + relatorio += Funcoes.CreateCard(grupo41, text3, pageBreak); + } + } + break; + } + case 3: + { + List agrupamento30 = (from x in listAuditoria + orderby x.Estipulante + select x.Estipulante).Distinct().ToList(); + foreach (string grupo38 in agrupamento30) + { + List list11 = (listAuditoria.Any((Auditoria x) => x.Selecionado) ? listAuditoria.Where((Auditoria x) => x.Selecionado && x.Estipulante == grupo38).ToList() : listAuditoria.Where((Auditoria x) => x.Estipulante == grupo38).ToList()); + if (list11.Count != 0) + { + list11.Add(new Auditoria + { + Cliente = "TOTAL", + Comissao = (list11.Any() ? (list11.Sum((Auditoria x) => x.Comissao) / (decimal)list11.Count) : 0m), + PremioTotal = list11.Sum((Auditoria x) => x.PremioTotal), + PremioLiquido = list11.Sum((Auditoria x) => x.PremioLiquido), + ComissaoPrevista = list11.Sum((Auditoria x) => x.ComissaoPrevista), + ComissaoRecebida = list11.Sum((Auditoria x) => x.ComissaoRecebida) + }); + string text6 = await Funcoes.GenerateTable(list11, Relatorio, grafico: false, verificarColunas: true, footer, config); + List list12 = (listAuditoria.Any((Auditoria x) => x.Selecionado) ? listAuditoria.Where((Auditoria x) => x.Selecionado && x.Estipulante == grupo38).ToList() : listAuditoria.Where((Auditoria x) => x.Estipulante == grupo38).ToList()); + List sintetic5 = Funcoes.ConstruirSintetico(new Sintetico + { + Agrupamento = grupo38, + PremioTotal = list12.Sum((Auditoria x) => x.PremioTotal), + PremioLiquido = list12.Sum((Auditoria p) => p.PremioLiquido), + ComissaoRecebidaBruta = list12.Sum((Auditoria p) => p.ComissaoRecebida), + MediaComissao = (list12.Any((Auditoria c) => c.Comissao > 0m) ? decimal.Round(list12.Sum((Auditoria c) => c.Comissao) / (decimal)list12.Count((Auditoria c) => c.Comissao > 0m), 2) : 0m), + ComissaoPrevista = list12.Sum((Auditoria c) => c.ComissaoPrevista), + Cancelamentos = list12.Count((Auditoria c) => (int)c.Documento.Situacao == 3), + Novos = list12.Count((Auditoria c) => (int)c.Documento.Situacao == 1 || ((int)c.Documento.Situacao == 2 && (int)c.Documento.Negocio.GetValueOrDefault() == 2)), + Renovacoes = list12.Count((Auditoria c) => (int)c.Documento.Situacao == 2 && (int)c.Documento.Negocio.GetValueOrDefault() == 1), + Apolices = list12.Count((Auditoria c) => c.Tipo == 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Endossos = list12.Count((Auditoria c) => c.Tipo != 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Faturas = list12.Count((Auditoria c) => (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 2), + TotalGeral = list12.Count + }, Relatorio); + string text = text6; + text6 = text + await Funcoes.GenerateTableSintetic(sintetic5, config.TamanhoFonte); + relatorio += Funcoes.CreateCard(grupo38, text6, pageBreak); + } + } + break; + } + case 4: + { + List agrupamento30 = (from x in listAuditoria + orderby x.Status + select x.Status).Distinct().ToList(); + foreach (string grupo42 in agrupamento30) + { + List list3 = (listAuditoria.Any((Auditoria x) => x.Selecionado) ? listAuditoria.Where((Auditoria x) => x.Selecionado && x.Status == grupo42).ToList() : listAuditoria.Where((Auditoria x) => x.Status == grupo42).ToList()); + if (list3.Count != 0) + { + list3.Add(new Auditoria + { + Cliente = "TOTAL", + Comissao = (list3.Any() ? (list3.Sum((Auditoria x) => x.Comissao) / (decimal)list3.Count) : 0m), + PremioTotal = list3.Sum((Auditoria x) => x.PremioTotal), + PremioLiquido = list3.Sum((Auditoria x) => x.PremioLiquido), + ComissaoPrevista = list3.Sum((Auditoria x) => x.ComissaoPrevista), + ComissaoRecebida = list3.Sum((Auditoria x) => x.ComissaoRecebida) + }); + string text2 = await Funcoes.GenerateTable(list3, Relatorio, grafico: false, verificarColunas: true, footer, config); + List list4 = (listAuditoria.Any((Auditoria x) => x.Selecionado) ? listAuditoria.Where((Auditoria x) => x.Selecionado && x.Status == grupo42).ToList() : listAuditoria.Where((Auditoria x) => x.Status == grupo42).ToList()); + List sintetic = Funcoes.ConstruirSintetico(new Sintetico + { + Agrupamento = grupo42, + PremioTotal = list4.Sum((Auditoria x) => x.PremioTotal), + PremioLiquido = list4.Sum((Auditoria p) => p.PremioLiquido), + ComissaoRecebidaBruta = list4.Sum((Auditoria p) => p.ComissaoRecebida), + MediaComissao = (list4.Any((Auditoria c) => c.Comissao > 0m) ? decimal.Round(list4.Sum((Auditoria c) => c.Comissao) / (decimal)list4.Count((Auditoria c) => c.Comissao > 0m), 2) : 0m), + ComissaoPrevista = list4.Sum((Auditoria c) => c.ComissaoPrevista), + Cancelamentos = list4.Count((Auditoria c) => (int)c.Documento.Situacao == 3), + Novos = list4.Count((Auditoria c) => (int)c.Documento.Situacao == 1 || ((int)c.Documento.Situacao == 2 && (int)c.Documento.Negocio.GetValueOrDefault() == 2)), + Renovacoes = list4.Count((Auditoria c) => (int)c.Documento.Situacao == 2 && (int)c.Documento.Negocio.GetValueOrDefault() == 1), + Apolices = list4.Count((Auditoria c) => c.Tipo == 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Endossos = list4.Count((Auditoria c) => c.Tipo != 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Faturas = list4.Count((Auditoria c) => (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 2), + TotalGeral = list4.Count + }, Relatorio); + string text = text2; + text2 = text + await Funcoes.GenerateTableSintetic(sintetic, config.TamanhoFonte); + relatorio += Funcoes.CreateCard(grupo42, text2, pageBreak); + } + } + break; + } + } + break; + } + case 7: + { + ColunasOcultas = await Funcoes.OcultarColunas(Relatorio); + if (SinteticosPagamento) + { + foreach (PagamentoSintetico sintetico2 in PagamentosSintetico) + { + string body = await Funcoes.GenerateTable(new List(sintetico2.Agrupamento), new List(), grafico: false, propertyName: false, "", config); + relatorio += Funcoes.CreateCard(sintetico2.Titulo, body); + } + relatorio += "
"; + } + int count = -1; + foreach (Pagamento x3 in Pagamentos.OrderBy((Pagamento x) => x.Title)) + { + count++; + string body2 = await Funcoes.GenerateTable(x3.Dados.ToList(), Relatorio, grafico: false, verificarColunas: true, footer, config); + relatorio += Funcoes.CreateCard(ReciboPagamento ? x3.Title : (SegundaViaReciboPagamento ? (x3.Title + " - SEGUNDA VIA") : (x3.Title + " - SIMPLES CONFERÊNCIA")), body2); + DadosRelatorio? obj = ((IEnumerable)x3.Dados).FirstOrDefault((Func)((DadosRelatorio y) => y.EntidadeVendedorParcela != null)); + object obj2; + if (obj == null) + { + obj2 = null; + } + else + { + VendedorParcela entidadeVendedorParcela = obj.EntidadeVendedorParcela; + obj2 = ((entidadeVendedorParcela != null) ? entidadeVendedorParcela.Vendedor : null); + } + if (obj2 == null) + { + DadosRelatorio? obj3 = ((IEnumerable)x3.Dados).FirstOrDefault((Func)((DadosRelatorio y) => y.EntidadeAdiantamento != null)); + obj2 = ((obj3 != null) ? obj3.EntidadeAdiantamento.Vendedor : null); + } + Vendedor vendedor = (Vendedor)obj2; + if (ReciboPagamento || SegundaViaReciboPagamento) + { + relatorio += Funcoes.CriarRecibo(vendedor, x3.Dados.Last().ValorLiquido, new Filtros + { + Inicio = Inicio, + Fim = Fim + }, SegundaViaReciboPagamento); + } + if (count < Pagamentos.Count - 1) + { + relatorio += "
"; + } + } + if (!SinteticosPagamento) + { + break; + } + List list14 = new List(); + foreach (Pagamento item in Pagamentos.OrderBy((Pagamento x) => x.Title)) + { + list14.Add(item.Vendedores); + } + list14.Add(new AgrupamentoVendedor + { + Vendedor = "TOTAL", + Repasse = list14.Sum((AgrupamentoVendedor p) => p.Repasse), + RepasseBruto = list14.Sum((AgrupamentoVendedor p) => p.RepasseBruto), + Estorno = list14.Sum((AgrupamentoVendedor p) => p.Estorno), + Debito = list14.Sum((AgrupamentoVendedor p) => p.Debito), + Credito = list14.Sum((AgrupamentoVendedor p) => p.Credito), + Desconto = list14.Sum((AgrupamentoVendedor p) => p.Desconto), + Adiantamento = list14.Sum((AgrupamentoVendedor p) => p.Adiantamento), + ValorLiquido = list14.Sum((AgrupamentoVendedor p) => p.ValorLiquido) + }); + relatorio = relatorio + "
" + Funcoes.CreateCard("", await Funcoes.GenerateTable(list14, new List(), grafico: false, propertyName: false, "", config)); + break; + } + case 12: + { + ColunasOcultas = await Funcoes.OcultarColunas(Relatorio); + if ((int)Agrupamento == 0) + { + relatorio = await Funcoes.GenerateTable(((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(), Relatorio, grafico: false, verificarColunas: true, footer, config); + break; + } + IEnumerable> enumerable = from FaturaPendente x in (IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items + orderby ((int)Agrupamento != 1) ? (((int)Agrupamento != 2) ? (((int)Agrupamento != 3) ? (((int)Agrupamento != 4) ? x.Status : x.Estipulante) : x.Vendedor) : x.Ramo) : x.Seguradora + group x by ((int)Agrupamento != 1) ? (((int)Agrupamento != 2) ? (((int)Agrupamento != 3) ? (((int)Agrupamento != 4) ? x.Status : x.Estipulante) : x.Vendedor) : x.Ramo) : x.Seguradora; + foreach (IGrouping x2 in enumerable) + { + string body3 = await Funcoes.GenerateTable(x2.ToList(), Relatorio, grafico: false, verificarColunas: true, footer, config); + string title = (((int)Agrupamento == 1) ? x2.First().Seguradora : (((int)Agrupamento == 2) ? x2.First().Ramo : (((int)Agrupamento == 3) ? x2.First().Vendedor : (((int)Agrupamento == 4) ? x2.First().Estipulante : x2.First().Status)))); + relatorio += Funcoes.CreateCard(title, body3); + } + break; + } + case 11: + { + if (Fechamento == null) + { + return ""; + } + ColunasOcultas = new List + { + "PRÊMIO TOTAL ANTERIOR", "COMPARATIVO PRÊMIO TOTAL", "PRÊMIO LÍQUIDO ANTERIOR", "COMPARATIVO PRÊMIO LÍQUIDO", "MÉDIA FECHADA ANTERIOR", "COMPARATIVO MÉDIA FECHADA", "MÉDIA MIX % ANTERIOR", "COMPARATIVO MÉDIA MIX %", "COMISSÃO GERADA ANTERIOR", "COMPARATIVO COMISSÃO GERADA", + "COMISSÃO RECEBIDA ANTERIOR", "COMPARATIVO COMISSÃO RECEBIDA", "COMISSÃO PAGA ANTERIOR", "COMPARATIVO COMISSÃO PAGA", "QTD APÓLICE ANTERIOR", "COMPARATIVO QTD APÓLICE", "QTD ENDOSSO ANTERIOR", "COMPARATIVO QTD ENDOSSO", "QTD FATURA ANTERIOR", "COMPARATIVO QTD FATURA", + "QTD ITENS ANTERIOR", "COMPARATIVO QTD ITENS", "ANO ANTERIOR" + }; + ComparativoConverter comparer = new ComparativoConverter(); + NumberFormatInfo percentageFormat = new NumberFormatInfo + { + PercentPositivePattern = 1, + PercentNegativePattern = 1 + }; + foreach (Fechamentos fechamento in Fechamento) + { + ExtensionMethods.ForEach((IEnumerable)fechamento.Fechamento, (Action)delegate(Fechamento x) + { + object[] array = new object[2] { x.PremioTotal, x.PremioTotalAnterior }; + x.PremioTotalComparativo = decimal.Parse(comparer.Convert(array, typeof(decimal), new object(), new CultureInfo("pt-BR")).ToString()).ToString("P2", percentageFormat); + array[0] = x.PremioLiquido; + array[1] = x.PremioLiquidoAnterior; + x.PremioLiquidoComparativo = decimal.Parse(comparer.Convert(array, typeof(decimal), new object(), new CultureInfo("pt-BR")).ToString()).ToString("P2", percentageFormat); + array[0] = x.Fechada; + array[1] = x.FechadaAnterior; + x.FechadaAnteriorComparativo = decimal.Parse(comparer.Convert(array, typeof(decimal), new object(), new CultureInfo("pt-BR")).ToString()).ToString("P2", percentageFormat); + array[0] = x.Mix; + array[1] = x.MixAnterior; + x.MixAnteriorComparativo = decimal.Parse(comparer.Convert(array, typeof(decimal), new object(), new CultureInfo("pt-BR")).ToString()).ToString("P2", percentageFormat); + array[0] = x.Gerada; + array[1] = x.GeradaAnterior; + x.GeradaAnteriorComparativo = decimal.Parse(comparer.Convert(array, typeof(decimal), new object(), new CultureInfo("pt-BR")).ToString()).ToString("P2", percentageFormat); + array[0] = x.Recebida; + array[1] = x.RecebidaAnterior; + x.RecebidaAnteriorComparativo = decimal.Parse(comparer.Convert(array, typeof(decimal), new object(), new CultureInfo("pt-BR")).ToString()).ToString("P2", percentageFormat); + array[0] = x.Pendente; + array[1] = x.PendenteAnterior; + x.PendenteAnteriorComparativo = decimal.Parse(comparer.Convert(array, typeof(decimal), new object(), new CultureInfo("pt-BR")).ToString()).ToString("P2", percentageFormat); + array[0] = x.Paga; + array[1] = x.PagaAnterior; + x.PagaAnteriorComparativo = decimal.Parse(comparer.Convert(array, typeof(decimal), new object(), new CultureInfo("pt-BR")).ToString()).ToString("P2", percentageFormat); + array[0] = x.Apolice; + array[1] = x.ApoliceAnterior; + x.ApoliceAnteriorComparativo = decimal.Parse(comparer.Convert(array, typeof(decimal), new object(), new CultureInfo("pt-BR")).ToString()).ToString("P2", percentageFormat); + array[0] = x.Endosso; + array[1] = x.EndossoAnterior; + x.EndossoAnteriorComparativo = decimal.Parse(comparer.Convert(array, typeof(decimal), new object(), new CultureInfo("pt-BR")).ToString()).ToString("P2", percentageFormat); + array[0] = x.Fatura; + array[1] = x.FaturaAnterior; + x.FaturaAnteriorComparativo = decimal.Parse(comparer.Convert(array, typeof(decimal), new object(), new CultureInfo("pt-BR")).ToString()).ToString("P2", percentageFormat); + array[0] = x.Itens; + array[1] = x.ItensAnterior; + x.ItensAnteriorComparativo = decimal.Parse(comparer.Convert(array, typeof(decimal), new object(), new CultureInfo("pt-BR")).ToString()).ToString("P2", percentageFormat); + }); + ColunasOcultas = new List(); + string body6 = await Funcoes.GenerateTable(new List(fechamento.Fechamento), Relatorio, grafico: false, verificarColunas: true, footer, config); + relatorio += Funcoes.CreateCard(fechamento.Title, body6); + } + break; + } + case 14: + { + ColunasOcultas = await Funcoes.OcultarColunas(Relatorio); + List list26 = ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(); + relatorio = await Funcoes.GenerateTable(list26.Any((MetaSeguradoraRelatorio x) => x.Selecionado) ? list26.Where((MetaSeguradoraRelatorio x) => x.Selecionado).ToList() : list26, Relatorio, grafico: false, verificarColunas: true, footer, config); + break; + } + case 15: + { + ColunasOcultas = await Funcoes.OcultarColunas(Relatorio); + List list74 = ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(); + relatorio = await Funcoes.GenerateTable(list74.Any((MetaVendedorRelatorio x) => x.Selecionado) ? list74.Where((MetaVendedorRelatorio x) => x.Selecionado).ToList() : list74, Relatorio, grafico: false, verificarColunas: true, footer, config); + break; + } + case 19: + { + ColunasOcultas = await Funcoes.OcultarColunas(Relatorio); + List listNotaFiscalRelatorio = ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(); + if (NotaFiscalPorSeguradora) + { + List agrupamento30 = (from x in listNotaFiscalRelatorio + orderby x.Seguradora + select x.Seguradora).Distinct().ToList(); + foreach (string grupo37 in agrupamento30) + { + List prod = (listNotaFiscalRelatorio.Any((NotaFiscalRelatorio x) => x.Selecionado) ? listNotaFiscalRelatorio.Where((NotaFiscalRelatorio x) => x.Selecionado && x.Seguradora == grupo37).ToList() : listNotaFiscalRelatorio.Where((NotaFiscalRelatorio x) => x.Seguradora == grupo37).ToList()); + if (prod.Count != 0) + { + prod.Add(new NotaFiscalRelatorio + { + Seguradora = "TOTAL", + Bruto = prod.Sum((NotaFiscalRelatorio x) => x.Bruto), + Liquido = prod.Sum((NotaFiscalRelatorio x) => x.Liquido), + Iss = prod.Sum((NotaFiscalRelatorio x) => x.Iss) + }); + string text7 = await Funcoes.GenerateTable(prod, Relatorio, grafico: false, verificarColunas: true, footer, config); + List list13 = (listNotaFiscalRelatorio.Any((NotaFiscalRelatorio x) => x.Selecionado) ? listNotaFiscalRelatorio.Where((NotaFiscalRelatorio x) => x.Selecionado && x.Seguradora == grupo37).ToList() : listNotaFiscalRelatorio.Where((NotaFiscalRelatorio x) => x.Seguradora == grupo37).ToList()); + Sintetico val = new Sintetico + { + Agrupamento = grupo37, + ValorBruto = list13.Sum((NotaFiscalRelatorio g) => g.Bruto), + ValorLiquido = list13.Sum((NotaFiscalRelatorio g) => g.Liquido), + Iss = list13.Sum((NotaFiscalRelatorio g) => g.Iss), + TotalGeral = list13.Count + }; + string Aux = ""; + prod.Where((NotaFiscalRelatorio x) => x.Seguradora == grupo37).ToList().ForEach(delegate(NotaFiscalRelatorio x) + { + Aux = x.Cnpj; + }); + if (!string.IsNullOrEmpty(Aux)) + { + Aux = grupo37.ToString() + " - " + Aux; + } + else if (!string.IsNullOrEmpty(grupo37)) + { + Aux = grupo37; + } + List sintetic6 = Funcoes.ConstruirSintetico(val, Relatorio); + string text = text7; + text7 = text + await Funcoes.GenerateTableSintetic(sintetic6, config.TamanhoFonte); + relatorio += Funcoes.CreateCard(Aux, text7, pageBreak); + } + } + } + else + { + relatorio = await Funcoes.GenerateTable(listNotaFiscalRelatorio.Any((NotaFiscalRelatorio x) => x.Selecionado) ? listNotaFiscalRelatorio.Where((NotaFiscalRelatorio x) => x.Selecionado).ToList() : listNotaFiscalRelatorio, Relatorio, grafico: false, verificarColunas: true, footer, config); + } + break; + } + case 20: + if (Previsao == null) + { + return ""; + } + foreach (PrevisaoPagamentoComissaoSintetico sintetico in PrevisaoSintetico) + { + string body4 = await Funcoes.GenerateTable(new List(sintetico.Agrupamento), new List()); + relatorio += Funcoes.CreateCard(sintetico.Titulo, body4); + } + foreach (PrevisaoPagamentoComissao previsao in Previsao) + { + string body5 = await Funcoes.GenerateTable(new List(previsao.PrevisaoPagamento), Relatorio, grafico: false, verificarColunas: true, footer, config); + relatorio += Funcoes.CreateCard(previsao.Vendedor, body5); + } + break; + case 23: + { + ColunasOcultas = await Funcoes.OcultarColunas(Relatorio); + List list61 = ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(); + List analitico6 = (list61.Any((LogsEnvio x) => x.Selecionado) ? list61.Where((LogsEnvio x) => x.Selecionado).ToList() : list61); + string text = relatorio; + relatorio = text + Funcoes.CreateCard("", await Funcoes.GenerateTable(analitico6, Relatorio, grafico: false, verificarColunas: true, footer, config)); + break; + } + case 24: + case 25: + { + ColunasOcultas = await Funcoes.OcultarColunas(Relatorio); + List list2 = ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(); + List analitico2 = (list2.Any((LogAcaoRelatorio x) => x.Selecionado) ? list2.Where((LogAcaoRelatorio x) => x.Selecionado).ToList() : list2); + string text = relatorio; + relatorio = text + Funcoes.CreateCard("", await Funcoes.GenerateTable(analitico2, Relatorio, grafico: false, verificarColunas: true, footer, config)); + break; + } + case 26: + { + ColunasOcultas = await Funcoes.OcultarColunas(Relatorio); + List list62 = ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(); + List analitico7 = (list62.Any((ApoliceCritica x) => x.Selecionado) ? list62.Where((ApoliceCritica x) => x.Selecionado).ToList() : list62); + string text = relatorio; + relatorio = text + Funcoes.CreateCard("", await Funcoes.GenerateTable(analitico7, Relatorio, grafico: false, verificarColunas: true, footer, config)); + break; + } + case 13: + { + ColunasOcultas = await Funcoes.OcultarColunas(Relatorio); + List list37 = ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(); + List analitico3 = (list37.Any((ExtratoBaixadoRelatorio x) => x.Selecionado) ? list37.Where((ExtratoBaixadoRelatorio x) => x.Selecionado).ToList() : list37); + string text = relatorio; + relatorio = text + Funcoes.CreateCard("", await Funcoes.GenerateTable(analitico3, Relatorio, grafico: false, verificarColunas: true, footer, config)); + break; + } + case 28: + { + ColunasOcultas = await Funcoes.OcultarColunas(Relatorio); + List endossoBaixado = ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(); + Agrupamento agrupamento42 = Agrupamento; + switch (agrupamento42 - 1) + { + default: + relatorio = await Funcoes.GenerateTable(endossoBaixado.Any((Endosso x) => x.Selecionado) ? endossoBaixado.Where((Endosso x) => x.Selecionado).ToList() : endossoBaixado, Relatorio, grafico: false, verificarColunas: true, footer, config); + break; + case 0: + { + List agrupamento30 = (from x in endossoBaixado + orderby x.Seguradora + select x.Seguradora).Distinct().ToList(); + foreach (string grupo28 in agrupamento30) + { + List list33 = (endossoBaixado.Any((Endosso x) => x.Selecionado) ? endossoBaixado.Where((Endosso x) => x.Selecionado && x.Seguradora == grupo28).ToList() : endossoBaixado.Where((Endosso x) => x.Seguradora == grupo28).ToList()); + if (list33.Count != 0) + { + list33.Add(new Endosso + { + Cliente = "TOTAL", + Comissao = (list33.Any() ? (list33.Sum((Endosso x) => x.Comissao) / (decimal)list33.Count) : 0m), + PremioTotal = list33.Sum((Endosso x) => x.PremioTotal), + PremioLiquido = list33.Sum((Endosso x) => x.PremioLiquido) + }); + string text16 = await Funcoes.GenerateTable(list33, Relatorio, grafico: false, verificarColunas: true, footer, config); + List list34 = (endossoBaixado.Any((Endosso x) => x.Selecionado) ? endossoBaixado.Where((Endosso x) => x.Selecionado && x.Seguradora == grupo28).ToList() : endossoBaixado.Where((Endosso x) => x.Seguradora == grupo28).ToList()); + List sintetic15 = Funcoes.ConstruirSintetico(new Sintetico + { + Agrupamento = grupo28, + PremioTotal = list34.Sum((Endosso x) => x.PremioTotal), + PremioLiquido = list34.Sum((Endosso p) => p.PremioLiquido), + Cancelamentos = list34.Count((Endosso c) => (int)c.Documento.Situacao == 3), + Endossos = list34.Count((Endosso c) => c.Tipo != 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1 && (int)c.Documento.Situacao != 3), + TotalGeral = list34.Count + }, Relatorio); + string text = text16; + text16 = text + await Funcoes.GenerateTableSintetic(sintetic15, config.TamanhoFonte); + relatorio += Funcoes.CreateCard(grupo28, text16, pageBreak); + } + } + break; + } + case 1: + { + List agrupamento30 = (from x in endossoBaixado + orderby x.Ramo + select x.Ramo).Distinct().ToList(); + foreach (string grupo29 in agrupamento30) + { + List list31 = (endossoBaixado.Any((Endosso x) => x.Selecionado) ? endossoBaixado.Where((Endosso x) => x.Selecionado && x.Ramo == grupo29).ToList() : endossoBaixado.Where((Endosso x) => x.Ramo == grupo29).ToList()); + if (list31.Count != 0) + { + list31.Add(new Endosso + { + Cliente = "TOTAL", + Comissao = (list31.Any() ? (list31.Sum((Endosso x) => x.Comissao) / (decimal)list31.Count) : 0m), + PremioTotal = list31.Sum((Endosso x) => x.PremioTotal), + PremioLiquido = list31.Sum((Endosso x) => x.PremioLiquido) + }); + string text15 = await Funcoes.GenerateTable(list31, Relatorio, grafico: false, verificarColunas: true, footer, config); + List list32 = (endossoBaixado.Any((Endosso x) => x.Selecionado) ? endossoBaixado.Where((Endosso x) => x.Selecionado && x.Ramo == grupo29).ToList() : endossoBaixado.Where((Endosso x) => x.Ramo == grupo29).ToList()); + List sintetic14 = Funcoes.ConstruirSintetico(new Sintetico + { + Agrupamento = grupo29, + PremioTotal = list32.Sum((Endosso x) => x.PremioTotal), + PremioLiquido = list32.Sum((Endosso p) => p.PremioLiquido), + Cancelamentos = list32.Count((Endosso c) => (int)c.Documento.Situacao == 3), + Endossos = list32.Count((Endosso c) => c.Tipo != 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1 && (int)c.Documento.Situacao != 3), + TotalGeral = list32.Count + }, Relatorio); + string text = text15; + text15 = text + await Funcoes.GenerateTableSintetic(sintetic14, config.TamanhoFonte); + relatorio += Funcoes.CreateCard(grupo29, text15, pageBreak); + } + } + break; + } + case 2: + { + List agrupamento30 = (from x in endossoBaixado + orderby x.Vendedor + select x.Vendedor).Distinct().ToList(); + foreach (string grupo30 in agrupamento30) + { + List list29 = (endossoBaixado.Any((Endosso x) => x.Selecionado) ? endossoBaixado.Where((Endosso x) => x.Selecionado && x.Vendedor == grupo30).ToList() : endossoBaixado.Where((Endosso x) => x.Vendedor == grupo30).ToList()); + if (list29.Count != 0) + { + list29.Add(new Endosso + { + Cliente = "TOTAL", + Comissao = (list29.Any() ? (list29.Sum((Endosso x) => x.Comissao) / (decimal)list29.Count) : 0m), + PremioTotal = list29.Sum((Endosso x) => x.PremioTotal), + PremioLiquido = list29.Sum((Endosso x) => x.PremioLiquido) + }); + string text14 = await Funcoes.GenerateTable(list29, Relatorio, grafico: false, verificarColunas: true, footer, config); + List list30 = (endossoBaixado.Any((Endosso x) => x.Selecionado) ? endossoBaixado.Where((Endosso x) => x.Selecionado && x.Vendedor == grupo30).ToList() : endossoBaixado.Where((Endosso x) => x.Vendedor == grupo30).ToList()); + List sintetic13 = Funcoes.ConstruirSintetico(new Sintetico + { + Agrupamento = grupo30, + PremioTotal = list30.Sum((Endosso x) => x.PremioTotal), + PremioLiquido = list30.Sum((Endosso p) => p.PremioLiquido), + Cancelamentos = list30.Count((Endosso c) => (int)c.Documento.Situacao == 3), + Endossos = list30.Count((Endosso c) => c.Tipo != 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1 && (int)c.Documento.Situacao != 3), + TotalGeral = list30.Count + }, Relatorio); + string text = text14; + text14 = text + await Funcoes.GenerateTableSintetic(sintetic13, config.TamanhoFonte); + relatorio += Funcoes.CreateCard(grupo30, text14, pageBreak); + } + } + break; + } + case 3: + { + List agrupamento30 = (from x in endossoBaixado + orderby x.Estipulante + select x.Estipulante).Distinct().ToList(); + foreach (string grupo27 in agrupamento30) + { + List list35 = (endossoBaixado.Any((Endosso x) => x.Selecionado) ? endossoBaixado.Where((Endosso x) => x.Selecionado && x.Estipulante == grupo27).ToList() : endossoBaixado.Where((Endosso x) => x.Estipulante == grupo27).ToList()); + if (list35.Count != 0) + { + list35.Add(new Endosso + { + Cliente = "TOTAL", + Comissao = (list35.Any() ? (list35.Sum((Endosso x) => x.Comissao) / (decimal)list35.Count) : 0m), + PremioTotal = list35.Sum((Endosso x) => x.PremioTotal), + PremioLiquido = list35.Sum((Endosso x) => x.PremioLiquido) + }); + string text17 = await Funcoes.GenerateTable(list35, Relatorio, grafico: false, verificarColunas: true, footer, config); + List list36 = (endossoBaixado.Any((Endosso x) => x.Selecionado) ? endossoBaixado.Where((Endosso x) => x.Selecionado && x.Estipulante == grupo27).ToList() : endossoBaixado.Where((Endosso x) => x.Estipulante == grupo27).ToList()); + List sintetic16 = Funcoes.ConstruirSintetico(new Sintetico + { + Agrupamento = grupo27, + PremioTotal = list36.Sum((Endosso x) => x.PremioTotal), + PremioLiquido = list36.Sum((Endosso p) => p.PremioLiquido), + Cancelamentos = list36.Count((Endosso c) => (int)c.Documento.Situacao == 3), + Endossos = list36.Count((Endosso c) => c.Tipo != 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1 && (int)c.Documento.Situacao != 3), + TotalGeral = list36.Count + }, Relatorio); + string text = text17; + text17 = text + await Funcoes.GenerateTableSintetic(sintetic16, config.TamanhoFonte); + relatorio += Funcoes.CreateCard(grupo27, text17, pageBreak); + } + } + break; + } + case 4: + { + List agrupamento30 = (from x in endossoBaixado + orderby x.Status + select x.Status).Distinct().ToList(); + foreach (string grupo31 in agrupamento30) + { + List list27 = (endossoBaixado.Any((Endosso x) => x.Selecionado) ? endossoBaixado.Where((Endosso x) => x.Selecionado && x.Status == grupo31).ToList() : endossoBaixado.Where((Endosso x) => x.Status == grupo31).ToList()); + if (list27.Count != 0) + { + list27.Add(new Endosso + { + Cliente = "TOTAL", + Comissao = (list27.Any() ? (list27.Sum((Endosso x) => x.Comissao) / (decimal)list27.Count) : 0m), + PremioTotal = list27.Sum((Endosso x) => x.PremioTotal), + PremioLiquido = list27.Sum((Endosso x) => x.PremioLiquido) + }); + string text13 = await Funcoes.GenerateTable(list27, Relatorio, grafico: false, verificarColunas: true, footer, config); + List list28 = (endossoBaixado.Any((Endosso x) => x.Selecionado) ? endossoBaixado.Where((Endosso x) => x.Selecionado && x.Status == grupo31).ToList() : endossoBaixado.Where((Endosso x) => x.Status == grupo31).ToList()); + List sintetic12 = Funcoes.ConstruirSintetico(new Sintetico + { + Agrupamento = grupo31, + PremioTotal = list28.Sum((Endosso x) => x.PremioTotal), + PremioLiquido = list28.Sum((Endosso p) => p.PremioLiquido), + Cancelamentos = list28.Count((Endosso c) => (int)c.Documento.Situacao == 3), + Endossos = list28.Count((Endosso c) => c.Tipo != 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1 && (int)c.Documento.Situacao != 3), + TotalGeral = list28.Count + }, Relatorio); + string text = text13; + text13 = text + await Funcoes.GenerateTableSintetic(sintetic12, config.TamanhoFonte); + relatorio += Funcoes.CreateCard(grupo31, text13, pageBreak); + } + } + break; + } + } + break; + } + case 29: + { + ColunasOcultas = await Funcoes.OcultarColunas(Relatorio); + List list = ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(); + List analitico = (list.Any((Classificacao x) => x.Selecionado) ? list.Where((Classificacao x) => x.Selecionado).ToList() : list); + string text = relatorio; + relatorio = text + Funcoes.CreateCard("", await Funcoes.GenerateTable(analitico, Relatorio, grafico: false, verificarColunas: true, footer, config)); + break; + } + } + string filtros = ""; + int porcentagemImpressao = (Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 14) ? 70 : 50); + if (FiltroRelatorioSelecionado != null && FiltroRelatorioSelecionado.Count > 0) + { + filtros = Funcoes.CreateCard("FILTROS ADICIONADOS AO RELATÓRIO", await Funcoes.GenerateTable(FiltroRelatorioSelecionado.ToList(), new List())); + } + TipoRelatorio tipo = new TipoRelatorio + { + Nome = EnumHelper.GetDescription(Relatorio), + Inicio = Inicio, + Fim = Fim + }; + string text43 = ""; + if (Totalizacao) + { + string text44 = ((Sintetic != null) ? Funcoes.CreateCard("TOTAL", await Funcoes.GenerateTableSintetic(Sintetic.ToList(), config.TamanhoFonte)) : ""); + text43 = text44; + } + bool? obj4; + if (config != null && config.OrientacaoImpressao.HasValue) + { + obj4 = ((config != null) ? config.OrientacaoImpressao : null); + } + else + { + obj4 = false; + } + bool? flag = obj4; + portrait = flag.Value; + return Funcoes.ExportarHtml(tipo, relatorio + text43 + filtros, porcentagemImpressao.ToString(), portrait ? "portrait" : "landscape", screen); + } + + private static Sintetico SintetizarRenovacao(string grupo, List sintetico) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_003c: Unknown result type (might be due to invalid IL or missing references) + //IL_006c: Unknown result type (might be due to invalid IL or missing references) + //IL_009c: Unknown result type (might be due to invalid IL or missing references) + //IL_00cc: Unknown result type (might be due to invalid IL or missing references) + //IL_00fc: Unknown result type (might be due to invalid IL or missing references) + //IL_012c: Unknown result type (might be due to invalid IL or missing references) + //IL_015c: Unknown result type (might be due to invalid IL or missing references) + //IL_016e: Expected O, but got Unknown + return new Sintetico + { + Agrupamento = grupo, + Cancelamentos = sintetico.Count((Renovacao c) => c.Tipo != 3 && (int)c.Documento.Situacao == 3), + Novos = sintetico.Count((Renovacao c) => (c.Tipo != 3 && (int)c.Documento.Situacao == 1) || (c.Tipo != 3 && (int)c.Documento.Situacao == 2 && (int)c.Documento.Negocio.GetValueOrDefault() == 2)), + Renovacoes = sintetico.Count((Renovacao c) => c.Tipo != 3 && (int)c.Documento.Situacao == 2 && (int)c.Documento.Negocio.GetValueOrDefault() == 1), + Apolices = sintetico.Count((Renovacao c) => c.Tipo != 3 && c.Tipo == 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Endossos = sintetico.Count((Renovacao c) => c.Tipo != 3 && c.Tipo != 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Faturas = sintetico.Count((Renovacao c) => c.Tipo != 3 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 2), + TotalProspeccao = sintetico.Count((Renovacao c) => c.Tipo == 3), + TotalGeral = sintetico.Count + }; + } + + public async Task Sintetico() + { + List list = null; + if ((GridRelatorio)Report == null && (int)Relatorio != 7 && (int)Relatorio != 11) + { + await ShowMessage("NECESSARIO GERAR UM RELATÓRIO COM DADOS PARA SINTETIZAR"); + return; + } + Relatorio relatorio = Relatorio; + switch (relatorio - 2) + { + case 0: + { + List list7 = ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(); + if (ProducaoFiltrado == null || list7.Count == 0) + { + return; + } + if ((int)Agrupamento == 3) + { + list7 = list7.Where((Producao producao) => producao.Vendedor != null).ToList(); + } + list = (from x in list7 + group x by ((int)Agrupamento != 1) ? (((int)Agrupamento != 2) ? (((int)Agrupamento != 3) ? (((int)Agrupamento != 4) ? x.Status : x.Estipulante) : x.Vendedor) : x.Ramo) : x.Seguradora).Select((Func, Sintetico>)((IGrouping x) => new Sintetico + { + Agrupamento = x.Key, + PremioTotal = x.Sum((Producao c) => c.PremioTotal), + PremioLiquido = x.Sum((Producao p) => p.PremioLiquido), + MediaComissao = ((x.Sum((Producao c) => c.Comissao) > 0m) ? (decimal.Round(x.Sum((Producao c) => c.Comissao) / (decimal)x.Count((Producao c) => c.Comissao > 0m), 2) * 100m) : 0m), + ComissaoGerada = x.Sum((Producao c) => (c.PremioLiquido + (c.Documento.AdicionalComiss ? c.Documento.PremioAdicional : 0m)) * c.Comissao * 0.01m), + Cancelamentos = Funcoes.DistinctBy(x, (Producao c) => ((DomainBase)c.Documento).Id).Count((Producao c) => (int)c.Documento.Situacao == 3), + Novos = Funcoes.DistinctBy(x, funcProducaoDistinctByDocumentoId).Count(funcProducaoNegociosNovos), + NegociosProprios = Funcoes.DistinctBy(x, funcProducaoDistinctByDocumentoId).Count(funcProducaoNegociosProprios), + SegurosNovos = Funcoes.DistinctBy(x, funcProducaoDistinctByDocumentoId).Count(funcProducaoSegurosNovos), + Renovacoes = Funcoes.DistinctBy(x, funcProducaoDistinctByDocumentoId).Count(funcProducaoSegurosRenovacao), + Apolices = Funcoes.DistinctBy(x, (Producao c) => ((DomainBase)c.Documento).Id).Count((Producao c) => c.Tipo == 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Endossos = Funcoes.DistinctBy(x, (Producao c) => ((DomainBase)c.Documento).Id).Count((Producao c) => c.Tipo != 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Faturas = Funcoes.DistinctBy(x, (Producao c) => ((DomainBase)c.Documento).Id).Count((Producao c) => (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 2), + TotalLiquido = x.Count((Producao c) => (int)c.Documento.Situacao != 3), + TotalGeral = x.Count(), + MediaPonderada = ((x.Sum((Producao p) => p.PremioLiquido) > 0m) ? (decimal.Round(x.Sum((Producao c) => (c.PremioLiquido + (c.Documento.AdicionalComiss ? c.Documento.PremioAdicional : 0m)) * c.Comissao) / x.Sum((Producao p) => p.PremioLiquido), 2) * 100m) : 0m) + })).ToList(); + break; + } + case 9: + { + if (FechamentoFiltrado == null || FechamentoFiltrado.Count == 0) + { + return; + } + list = new List(); + Fechamento val = FechamentoFiltrado.First().Fechamento.Last(); + list.Add(new Sintetico + { + Agrupamento = "ATUAL: " + Inicio.Year, + TotalGeral = val.Apolice, + ValorPago = val.Paga, + ComissaoRecebidaBruta = val.Recebida, + ComissaoGerada = val.Gerada, + PremioLiquido = val.PremioLiquido, + PremioTotal = val.PremioTotal + }); + list.Add(new Sintetico + { + Agrupamento = "ANTERIOR: " + (Inicio.Year - 1), + TotalGeral = val.ApoliceAnterior, + ValorPago = val.PagaAnterior, + ComissaoRecebidaBruta = val.RecebidaAnterior, + ComissaoGerada = val.GeradaAnterior, + PremioLiquido = val.PremioLiquidoAnterior, + PremioTotal = val.PremioTotalAnterior + }); + break; + } + case 2: + { + List list3 = ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(); + if (RenovacaoFiltrado == null || list3.Count == 0) + { + return; + } + list = (from x in list3 + where x.Documento != null + group x by ((int)Agrupamento != 1) ? (((int)Agrupamento != 2) ? (((int)Agrupamento != 3) ? (((int)Agrupamento != 4) ? x.Status : x.Estipulante) : x.Vendedor) : x.Ramo) : x.Seguradora).Select((Func, Sintetico>)((IGrouping x) => new Sintetico + { + Agrupamento = x.Key, + PremioTotal = x.Sum((Renovacao c) => c.PremioTotal), + PremioLiquido = x.Sum((Renovacao p) => p.PremioLiquido), + MediaComissao = ((x.Sum((Renovacao c) => c.Comissao) > 0m) ? (decimal.Round(x.Sum((Renovacao c) => c.Comissao) / (decimal)x.Count((Renovacao c) => c.Comissao > 0m), 2) * 100m) : 0m), + ComissaoGerada = x.Sum((Renovacao c) => (c.PremioLiquido + (c.Documento.AdicionalComiss ? c.Documento.PremioAdicional : 0m)) * c.Comissao * 0.01m), + Cancelamentos = Funcoes.DistinctBy(x, (Renovacao c) => ((DomainBase)c.Documento).Id).Count((Renovacao c) => (int)c.Documento.Situacao == 3), + Novos = Funcoes.DistinctBy(x, (Renovacao c) => ((DomainBase)c.Documento).Id).Count((Renovacao c) => (int)c.Documento.Situacao == 1 || ((int)c.Documento.Situacao == 2 && (int)c.Documento.Negocio.GetValueOrDefault() == 2)), + Renovacoes = Funcoes.DistinctBy(x, (Renovacao c) => ((DomainBase)c.Documento).Id).Count((Renovacao c) => (int)c.Documento.Situacao == 2 && (int)c.Documento.Negocio.GetValueOrDefault() == 1), + Apolices = Funcoes.DistinctBy(x, (Renovacao c) => ((DomainBase)c.Documento).Id).Count((Renovacao c) => c.Tipo == 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Endossos = Funcoes.DistinctBy(x, (Renovacao c) => ((DomainBase)c.Documento).Id).Count((Renovacao c) => c.Tipo != 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Faturas = Funcoes.DistinctBy(x, (Renovacao c) => ((DomainBase)c.Documento).Id).Count((Renovacao c) => (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 2), + TotalProspeccao = x.Count((Renovacao c) => c.Tipo == 3), + TotalGeral = x.Count() + })).ToList(); + break; + } + case 1: + { + List list4 = ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(); + if (ApolicePendenteFiltrado == null || list4.Count == 0) + { + return; + } + list = (from x in list4 + group x by ((int)Agrupamento != 1) ? (((int)Agrupamento != 2) ? (((int)Agrupamento != 3) ? (((int)Agrupamento != 4) ? x.Status : x.Estipulante) : x.Vendedor) : x.Ramo) : x.Seguradora).Select((Func, Sintetico>)((IGrouping x) => new Sintetico + { + Agrupamento = x.Key, + Cancelamentos = Funcoes.DistinctBy(x, (ApolicePendente c) => ((DomainBase)c.Documento).Id).Count((ApolicePendente c) => (int)c.Documento.Situacao == 3), + Novos = Funcoes.DistinctBy(x, (ApolicePendente c) => ((DomainBase)c.Documento).Id).Count((ApolicePendente c) => (int)c.Documento.Situacao == 1 || ((int)c.Documento.Situacao == 2 && (int)c.Documento.Negocio.GetValueOrDefault() == 2)), + Renovacoes = Funcoes.DistinctBy(x, (ApolicePendente c) => ((DomainBase)c.Documento).Id).Count((ApolicePendente c) => (int)c.Documento.Situacao == 2 && (int)c.Documento.Negocio.GetValueOrDefault() == 1), + Apolices = Funcoes.DistinctBy(x, (ApolicePendente c) => ((DomainBase)c.Documento).Id).Count((ApolicePendente c) => c.Tipo == 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Endossos = Funcoes.DistinctBy(x, (ApolicePendente c) => ((DomainBase)c.Documento).Id).Count((ApolicePendente c) => c.Tipo != 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Faturas = Funcoes.DistinctBy(x, (ApolicePendente c) => ((DomainBase)c.Documento).Id).Count((ApolicePendente c) => (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 2), + TotalGeral = x.Count() + })).ToList(); + break; + } + case 3: + { + List list6 = ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(); + if (ComissaoFiltrado == null || list6.Count == 0) + { + return; + } + list = (from x in list6 + group x by ((int)Agrupamento != 1) ? (((int)Agrupamento != 2) ? (((int)Agrupamento != 3) ? (((int)Agrupamento != 4) ? x.Status : x.Estipulante) : x.Vendedor) : x.Ramo) : x.Seguradora).Select((Func, Sintetico>)((IGrouping x) => new Sintetico + { + Agrupamento = x.Key, + Cancelamentos = Funcoes.DistinctBy(x, (Comissao c) => ((DomainBase)c.Documento).Id).Count((Comissao c) => (int)c.Documento.Situacao == 3), + Novos = Funcoes.DistinctBy(x, (Comissao c) => ((DomainBase)c.Documento).Id).Count((Comissao c) => (int)c.Documento.Situacao == 1 || ((int)c.Documento.Situacao == 2 && (int)c.Documento.Negocio.GetValueOrDefault() == 2)), + Renovacoes = Funcoes.DistinctBy(x, (Comissao c) => ((DomainBase)c.Documento).Id).Count((Comissao c) => (int)c.Documento.Situacao == 2 && (int)c.Documento.Negocio.GetValueOrDefault() == 1), + Apolices = Funcoes.DistinctBy(x, (Comissao c) => ((DomainBase)c.Documento).Id).Count((Comissao c) => c.Documento.Tipo == 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Endossos = Funcoes.DistinctBy(x, (Comissao c) => ((DomainBase)c.Documento).Id).Count((Comissao c) => c.Documento.Tipo != 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Faturas = Funcoes.DistinctBy(x, (Comissao c) => ((DomainBase)c.Documento).Id).Count((Comissao c) => (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 2), + ComissaoRecebidaBruta = x.Sum((Comissao c) => c.ComissaoBruta), + ComissaoRecebidaLiquida = x.Sum((Comissao c) => c.ComissaoRecebida), + Repasse = x.Sum((Comissao c) => c.Repasse), + MediaComissao = (x.Any((Comissao c) => c.ComissaoPerc > 0m) ? decimal.Round(x.Sum((Comissao c) => c.ComissaoPerc) / (decimal)x.Count((Comissao c) => c.ComissaoPerc > 0m), 2) : 0m) * 100m, + ComissaoPrevista = x.Sum((Comissao c) => c.ValorLiquido), + TotalGeral = x.Count() + })).ToList(); + break; + } + case 4: + case 14: + if (PendenteFiltrado == null || PendenteFiltrado.Count == 0) + { + return; + } + list = (from x in PendenteFiltrado + group x by ((int)Agrupamento != 1) ? (((int)Agrupamento != 2) ? (((int)Agrupamento != 3) ? (((int)Agrupamento != 4) ? x.Status : x.Estipulante) : x.Vendedor) : x.Ramo) : x.Seguradora).Select((Func, Sintetico>)((IGrouping x) => new Sintetico + { + Agrupamento = x.Key, + Cancelamentos = Funcoes.DistinctBy(x, (Pendente c) => ((DomainBase)c.Documento).Id).Count((Pendente c) => (int)c.Documento.Situacao == 3), + Novos = Funcoes.DistinctBy(x, (Pendente c) => ((DomainBase)c.Documento).Id).Count((Pendente c) => (int)c.Documento.Situacao == 1 || ((int)c.Documento.Situacao == 2 && (int)c.Documento.Negocio.GetValueOrDefault() == 2)), + Renovacoes = Funcoes.DistinctBy(x, (Pendente c) => ((DomainBase)c.Documento).Id).Count((Pendente c) => (int)c.Documento.Situacao == 2 && (int)c.Documento.Negocio.GetValueOrDefault() == 1), + Apolices = Funcoes.DistinctBy(x, (Pendente c) => ((DomainBase)c.Documento).Id).Count((Pendente c) => c.Documento.Tipo == 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Endossos = Funcoes.DistinctBy(x, (Pendente c) => ((DomainBase)c.Documento).Id).Count((Pendente c) => c.Documento.Tipo != 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Faturas = Funcoes.DistinctBy(x, (Pendente c) => ((DomainBase)c.Documento).Id).Count((Pendente c) => (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 2), + ComissaoPrevista = x.Sum((Pendente c) => c.ComissaoPrevista), + TotalPrevista = x.Sum((Pendente c) => c.TotalPrevisto), + TotalGeral = x.Count() + })).ToList(); + break; + case 7: + case 8: + { + List list5 = ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(); + if (SinistroFiltrado == null || list5.Count == 0) + { + return; + } + list = (from x in list5 + group x by ((int)Agrupamento != 1) ? (((int)Agrupamento != 2) ? (((int)Agrupamento != 3) ? (((int)Agrupamento != 4) ? EnumHelper.GetDescription(x.StatusSinistro) : x.Estipulante) : x.Vendedor) : x.Ramo) : x.Seguradora).Select((Func, Sintetico>)((IGrouping x) => new Sintetico + { + Agrupamento = x.Key, + Liquidado = (((int)Relatorio == 9) ? null : new int?((from s in x + where s.Liquidacao.HasValue + select ((DomainBase)s.EntidadeSinistro.ControleSinistro).Id).Distinct().Count())), + Valor = x.Sum((Sinistro s) => s.Valor), + ValorOrcado = x.Sum((Sinistro s) => s.ValorOrcado), + ValorLiberado = x.Sum((Sinistro s) => s.ValorLiberado), + ValorPago = x.Sum((Sinistro s) => s.ValorPago), + ValorLiquidado = (((int)Relatorio == 9) ? null : new decimal?(x.Where((Sinistro s) => s.Liquidacao.HasValue).Sum((Sinistro s) => s.ValorPago))), + ValorSalvado = x.Sum((Sinistro s) => s.ValorSalvado), + ValorFranquia = x.Sum((Sinistro s) => s.ValorFranquia), + Pendente = (from s in x + where !s.Liquidacao.HasValue + select ((DomainBase)s.EntidadeSinistro.ControleSinistro).Id).Distinct().Count(), + TotalGeral = x.Select((Sinistro s) => ((DomainBase)s.EntidadeSinistro.ControleSinistro).Id).Distinct().Count() + })).ToList(); + break; + } + case 6: + { + List list2 = ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(); + if (AuditoriaFiltrado == null || list2.Count == 0) + { + return; + } + list = (from x in list2 + group x by ((int)Agrupamento != 1) ? (((int)Agrupamento != 2) ? (((int)Agrupamento != 3) ? (((int)Agrupamento != 4) ? x.Status : x.Estipulante) : x.Vendedor) : x.Ramo) : x.Seguradora).Select((Func, Sintetico>)((IGrouping x) => new Sintetico + { + Agrupamento = x.Key, + PremioTotal = x.Sum((Auditoria c) => c.PremioTotal), + PremioLiquido = x.Sum((Auditoria p) => p.PremioLiquido), + MediaComissao = ((x.Sum((Auditoria c) => c.Comissao) > 0m) ? decimal.Round(x.Sum((Auditoria c) => c.Comissao) / (decimal)x.Count((Auditoria c) => c.Comissao > 0m), 2) : 0m) * 100m, + ComissaoGerada = x.Sum((Auditoria c) => (c.PremioLiquido + (c.Documento.AdicionalComiss ? c.Documento.PremioAdicional : 0m)) * c.Comissao * 0.01m), + ComissaoPrevista = x.Sum((Auditoria c) => c.ComissaoPrevista), + ComissaoRecebidaBruta = x.Sum((Auditoria c) => c.ComissaoRecebida), + ComissaoPendente = x.Sum((Auditoria c) => c.ComissaoPendente), + Cancelamentos = Funcoes.DistinctBy(x, (Auditoria c) => ((DomainBase)c.Documento).Id).Count((Auditoria c) => (int)c.Documento.Situacao == 3), + Novos = Funcoes.DistinctBy(x, (Auditoria c) => ((DomainBase)c.Documento).Id).Count((Auditoria c) => (int)c.Documento.Situacao == 1 || ((int)c.Documento.Situacao == 2 && (int)c.Documento.Negocio.GetValueOrDefault() == 2)), + Renovacoes = Funcoes.DistinctBy(x, (Auditoria c) => ((DomainBase)c.Documento).Id).Count((Auditoria c) => (int)c.Documento.Situacao == 2 && (int)c.Documento.Negocio.GetValueOrDefault() == 1), + Apolices = Funcoes.DistinctBy(x, (Auditoria c) => ((DomainBase)c.Documento).Id).Count((Auditoria c) => c.Tipo == 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Endossos = Funcoes.DistinctBy(x, (Auditoria c) => ((DomainBase)c.Documento).Id).Count((Auditoria c) => c.Tipo != 0 && (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 1), + Faturas = Funcoes.DistinctBy(x, (Auditoria c) => ((DomainBase)c.Documento).Id).Count((Auditoria c) => (int)c.Documento.TipoRecebimento.GetValueOrDefault() == 2), + TotalLiquido = x.Count((Auditoria c) => (int)c.Documento.Situacao != 3), + TotalGeral = x.Count() + })).ToList(); + break; + } + case 5: + if (Pagamentos == null || Pagamentos.Count == 0) + { + return; + } + list = ((IEnumerable)Pagamentos).Select((Func)((Pagamento x) => new Sintetico + { + Agrupamento = x.Vendedores.Vendedor, + ValorLiquido = x.Dados.Where((DadosRelatorio c) => c.Id != 0).Sum((DadosRelatorio c) => c.ValorLiquido), + ValorParcela = x.Dados.Where((DadosRelatorio c) => c.Id != 0).Sum((DadosRelatorio c) => c.ValorParcela), + Repasse = x.Dados.Where((DadosRelatorio c) => c.Id != 0).Sum((DadosRelatorio c) => c.Repasse), + TotalGeral = x.Dados.Count((DadosRelatorio c) => c.Id != 0) + })).ToList(); + break; + case 13: + if (MetaVendedor == null || MetaVendedor.Count == 0) + { + return; + } + list = (from g in MetaVendedor + group g by g.Vendedor).Select((Func, Sintetico>)((IGrouping x) => new Sintetico + { + Agrupamento = x.Key, + Meta = Math.Round(x.Where((MetaVendedorRelatorio m) => m.MetaAtingir > 0m).Sum((MetaVendedorRelatorio m) => m.MetaCumprida * 100m / m.MetaAtingir) * 100m, 2), + MetaAtingir = Math.Round(x.Sum((MetaVendedorRelatorio m) => m.MetaAtingir), 2), + MetaCumprida = Math.Round(x.Sum((MetaVendedorRelatorio m) => m.MetaCumprida), 2) + })).ToList(); + break; + case 12: + if (MetaSeguradora == null || MetaSeguradora.Count == 0) + { + return; + } + list = (from g in MetaSeguradora + group g by g.Seguradora).Select((Func, Sintetico>)((IGrouping x) => new Sintetico + { + Agrupamento = x.Key, + Meta = Math.Round(x.Where((MetaSeguradoraRelatorio m) => m.MetaAtingir > 0m).Sum((MetaSeguradoraRelatorio m) => m.MetaCumprida * 100m / m.MetaAtingir) * 100m, 2), + MetaAtingir = Math.Round(x.Sum((MetaSeguradoraRelatorio m) => m.MetaAtingir), 2), + MetaCumprida = Math.Round(x.Sum((MetaSeguradoraRelatorio m) => m.MetaCumprida), 2) + })).ToList(); + break; + } + if (list != null) + { + ((Window)new SinteticoView(list, EnumHelper.GetDescription(Relatorio), Inicio, Fim)).Show(); + } + } + + private void SeguradoraOnPropertyChanged(object sender, PropertyChangedEventArgs args) + { + if (!_alterandoFiltros) + { + RecheckAllSelected(0); + } + } + + public void RecheckAllLists() + { + for (int i = 0; i <= 9; i++) + { + RecheckAllSelected(i); + } + } + + public void RecheckAllSelected(int tipo) + { + if (_allSelectedChanging) + { + return; + } + try + { + _allSelectedChanging = true; + switch (tipo) + { + case 0: + if (Seguradoras.All((Seguradora e) => e.Selecionado)) + { + AllSelectedSeguradora = true; + } + else if (Seguradoras.All((Seguradora e) => !e.Selecionado)) + { + AllSelectedSeguradora = false; + } + else + { + AllSelectedSeguradora = null; + } + break; + case 1: + if (Ramos.All((Ramo e) => e.Selecionado)) + { + AllSelectedRamo = true; + } + else if (Ramos.All((Ramo e) => !e.Selecionado)) + { + AllSelectedRamo = false; + } + else + { + AllSelectedRamo = null; + } + break; + case 2: + if (Vendedores.All((Vendedor e) => e.Selecionado)) + { + AllSelectedVendedor = true; + } + else if (Vendedores.All((Vendedor e) => !e.Selecionado)) + { + AllSelectedVendedor = false; + } + else + { + AllSelectedVendedor = null; + } + break; + case 3: + if (TipoSeguros.All((StatusRelatorio e) => e.Selecionado)) + { + AllSelectedStatus = true; + } + else if (TipoSeguros.All((StatusRelatorio e) => !e.Selecionado)) + { + AllSelectedStatus = false; + } + else + { + AllSelectedStatus = null; + } + break; + case 4: + if (TipoVendedor.All((TipoVendedor e) => e.Selecionado)) + { + AllSelectedTipoVendedor = true; + } + else if (TipoVendedor.All((TipoVendedor e) => !e.Selecionado)) + { + AllSelectedTipoVendedor = false; + } + else + { + AllSelectedTipoVendedor = null; + } + break; + case 5: + if (Negocios.All((NegocioRelatorio e) => e.Selecionado)) + { + AllSelectedNegocio = true; + } + else if (Negocios.All((NegocioRelatorio e) => !e.Selecionado)) + { + AllSelectedNegocio = false; + } + else + { + AllSelectedNegocio = null; + } + break; + case 6: + if (Produtos.All((Produto e) => e.Selecionado)) + { + AllSelectedProduto = true; + } + else if (Produtos.All((Produto e) => !e.Selecionado)) + { + AllSelectedProduto = false; + } + else + { + AllSelectedProduto = null; + } + break; + case 7: + if (Estipulantes.All((Estipulante e) => e.Selecionado)) + { + AllSelectedEstipulante = true; + } + else if (Estipulantes.All((Estipulante e) => !e.Selecionado)) + { + AllSelectedEstipulante = false; + } + else + { + AllSelectedEstipulante = null; + } + break; + } + AdicionarFiltros(); + } + finally + { + _allSelectedChanging = false; + } + } + + private void RamoOnPropertyChanged(object sender, PropertyChangedEventArgs args) + { + if (!_alterandoFiltros) + { + RecheckAllSelected(1); + } + } + + public void ReloadVendedores() + { + if (!Inativo) + { + Vendedores = ((Vinculo.Count > 0) ? (from x in Recursos.Vendedores + where Vinculo.Any((VendedorUsuario y) => ((DomainBase)y.Vendedor).Id == ((DomainBase)x).Id) && x.Ativo + orderby x.Nome + select x).ToList() : (from x in Recursos.Vendedores + where (Recursos.Usuario.IdEmpresa == 1 || x.IdEmpresa == Recursos.Usuario.IdEmpresa) && x.Ativo + orderby x.Nome + select x).ToList()); + } + else + { + Vendedores = ((Vinculo.Count > 0) ? (from x in Recursos.Vendedores + where Vinculo.Any((VendedorUsuario y) => ((DomainBase)y.Vendedor).Id == ((DomainBase)x).Id) + orderby x.Nome + select x).ToList() : (from x in Recursos.Vendedores + where Recursos.Usuario.IdEmpresa == 1 || x.IdEmpresa == Recursos.Usuario.IdEmpresa + orderby x.Nome + select x).ToList()); + } + OnPropertyChanged("ReloadVendedores"); + } + + private void TipoVendedorOnPropertyChanged(object sender, PropertyChangedEventArgs args) + { + if (!_alterandoFiltros) + { + RecheckAllSelected(4); + } + } + + private void VendedorOnPropertyChanged(object sender, PropertyChangedEventArgs args) + { + if (!_alterandoFiltros) + { + RecheckAllSelected(2); + } + } + + private async Task LoadVendedores() + { + Vinculo = await VerificaVinculoVendedor(Recursos.Usuario); + Vendedores = ((Vinculo.Count > 0) ? (from x in Recursos.Vendedores + where Vinculo.Any((VendedorUsuario y) => ((DomainBase)y.Vendedor).Id == ((DomainBase)x).Id) + orderby x.Nome + select x).ToList() : (from x in Recursos.Vendedores + where Recursos.Usuario.IdEmpresa == 1 || x.IdEmpresa == Recursos.Usuario.IdEmpresa + orderby x.Nome + select x).ToList()); + Usuarios = (from x in Recursos.Usuarios + where !x.Excluido + orderby x.Nome + select x).ToList(); + UsuariosFiltrados = new ObservableCollection(Usuarios); + } + + private void ProdutoOnPropertyChanged(object sender, PropertyChangedEventArgs args) + { + if (!_alterandoFiltros) + { + RecheckAllSelected(5); + } + } + + private void EstipulanteOnPropertyChanged(object sender, PropertyChangedEventArgs args) + { + if (!_alterandoFiltros) + { + RecheckAllSelected(6); + } + } + + private void NegocioOnPropertyChanged(object sender, PropertyChangedEventArgs args) + { + if (!_alterandoFiltros) + { + RecheckAllSelected(9); + } + } + + private void StatusOnPropertyChanged(object sender, PropertyChangedEventArgs args) + { + if (!_alterandoFiltros) + { + RecheckAllSelected(3); + } + } + + private async void PopularRelatorio(string opcao) + { + Relatorios = new List(); + List source = await ServicoRestriUsuario.BuscarRestricoes(((DomainBase)Recursos.Usuario).Id); + foreach (Relatorio item in ((Relatorio[])Enum.GetValues(typeof(Relatorio))).OrderBy((Relatorio x) => EnumHelper.GetDescription(x))) + { + if (ValidationHelper.GetTipo((Enum)(object)item) != opcao) + { + continue; + } + switch ((int)item) + { + case 3: + { + RestricaoUsuario? obj19 = ((IEnumerable)source).FirstOrDefault((Func)((RestricaoUsuario x) => (int)x.Tipo == 34)); + if (obj19 == null || !obj19.Restricao) + { + Relatorios.Add(item); + } + break; + } + case 2: + { + RestricaoUsuario? obj26 = ((IEnumerable)source).FirstOrDefault((Func)((RestricaoUsuario x) => (int)x.Tipo == 23)); + if (obj26 == null || !obj26.Restricao) + { + Relatorios.Add(item); + } + break; + } + case 4: + { + RestricaoUsuario? obj12 = ((IEnumerable)source).FirstOrDefault((Func)((RestricaoUsuario x) => (int)x.Tipo == 24)); + if (obj12 == null || !obj12.Restricao) + { + Relatorios.Add(item); + } + break; + } + case 23: + { + RestricaoUsuario? obj23 = ((IEnumerable)source).FirstOrDefault((Func)((RestricaoUsuario x) => (int)x.Tipo == 96)); + if (obj23 == null || !obj23.Restricao) + { + Relatorios.Add(item); + } + break; + } + case 24: + { + RestricaoUsuario? obj17 = ((IEnumerable)source).FirstOrDefault((Func)((RestricaoUsuario x) => (int)x.Tipo == 98)); + if (obj17 == null || !obj17.Restricao) + { + Relatorios.Add(item); + } + break; + } + case 25: + { + RestricaoUsuario? obj27 = ((IEnumerable)source).FirstOrDefault((Func)((RestricaoUsuario x) => (int)x.Tipo == 98)); + if ((obj27 == null || !obj27.Restricao) && !Recursos.Configuracoes.All((ConfiguracaoSistema x) => (int)x.Configuracao != 22)) + { + Relatorios.Add(item); + } + break; + } + case 9: + { + RestricaoUsuario? obj2 = ((IEnumerable)source).FirstOrDefault((Func)((RestricaoUsuario x) => (int)x.Tipo == 25)); + if (obj2 == null || !obj2.Restricao) + { + Relatorios.Add(item); + } + break; + } + case 10: + { + RestricaoUsuario? obj18 = ((IEnumerable)source).FirstOrDefault((Func)((RestricaoUsuario x) => (int)x.Tipo == 26)); + if (obj18 == null || !obj18.Restricao) + { + Relatorios.Add(item); + } + break; + } + case 5: + { + RestricaoUsuario? obj13 = ((IEnumerable)source).FirstOrDefault((Func)((RestricaoUsuario x) => (int)x.Tipo == 27)); + if (obj13 == null || !obj13.Restricao) + { + Relatorios.Add(item); + } + break; + } + case 7: + { + RestricaoUsuario? obj7 = ((IEnumerable)source).FirstOrDefault((Func)((RestricaoUsuario x) => (int)x.Tipo == 28)); + if (obj7 == null || !obj7.Restricao) + { + Relatorios.Add(item); + } + break; + } + case 6: + { + RestricaoUsuario? obj11 = ((IEnumerable)source).FirstOrDefault((Func)((RestricaoUsuario x) => (int)x.Tipo == 29)); + if (obj11 == null || !obj11.Restricao) + { + Relatorios.Add(item); + } + break; + } + case 1: + { + RestricaoUsuario? obj21 = ((IEnumerable)source).FirstOrDefault((Func)((RestricaoUsuario x) => (int)x.Tipo == 49)); + if (obj21 == null || !obj21.Restricao) + { + Relatorios.Add(item); + } + break; + } + case 0: + { + RestricaoUsuario? obj4 = ((IEnumerable)source).FirstOrDefault((Func)((RestricaoUsuario x) => (int)x.Tipo == 30)); + if (obj4 == null || !obj4.Restricao) + { + Relatorios.Add(item); + } + break; + } + case 11: + { + RestricaoUsuario? obj14 = ((IEnumerable)source).FirstOrDefault((Func)((RestricaoUsuario x) => (int)x.Tipo == 41)); + if (obj14 == null || !obj14.Restricao) + { + Relatorios.Add(item); + } + break; + } + case 8: + { + RestricaoUsuario? obj6 = ((IEnumerable)source).FirstOrDefault((Func)((RestricaoUsuario x) => (int)x.Tipo == 46)); + if (obj6 == null || !obj6.Restricao) + { + Relatorios.Add(item); + } + break; + } + case 12: + { + RestricaoUsuario? obj24 = ((IEnumerable)source).FirstOrDefault((Func)((RestricaoUsuario x) => (int)x.Tipo == 51)); + if (obj24 == null || !obj24.Restricao) + { + Relatorios.Add(item); + } + break; + } + case 13: + { + RestricaoUsuario? obj10 = ((IEnumerable)source).FirstOrDefault((Func)((RestricaoUsuario x) => (int)x.Tipo == 50)); + if (obj10 == null || !obj10.Restricao) + { + Relatorios.Add(item); + } + break; + } + case 14: + { + RestricaoUsuario? obj28 = ((IEnumerable)source).FirstOrDefault((Func)((RestricaoUsuario x) => (int)x.Tipo == 52)); + if (obj28 == null || !obj28.Restricao) + { + Relatorios.Add(item); + } + break; + } + case 15: + { + RestricaoUsuario? obj16 = ((IEnumerable)source).FirstOrDefault((Func)((RestricaoUsuario x) => (int)x.Tipo == 53)); + if (obj16 == null || !obj16.Restricao) + { + Relatorios.Add(item); + } + break; + } + case 16: + { + RestricaoUsuario? obj5 = ((IEnumerable)source).FirstOrDefault((Func)((RestricaoUsuario x) => (int)x.Tipo == 62)); + if (obj5 == null || !obj5.Restricao) + { + Relatorios.Add(item); + } + break; + } + case 17: + { + RestricaoUsuario? obj25 = ((IEnumerable)source).FirstOrDefault((Func)((RestricaoUsuario x) => (int)x.Tipo == 63)); + if (obj25 == null || !obj25.Restricao) + { + Relatorios.Add(item); + } + break; + } + case 18: + { + RestricaoUsuario? obj20 = ((IEnumerable)source).FirstOrDefault((Func)((RestricaoUsuario x) => (int)x.Tipo == 31)); + if (obj20 == null || !obj20.Restricao) + { + Relatorios.Add(item); + } + break; + } + case 19: + { + RestricaoUsuario? obj9 = ((IEnumerable)source).FirstOrDefault((Func)((RestricaoUsuario x) => (int)x.Tipo == 90)); + if (obj9 == null || !obj9.Restricao) + { + Relatorios.Add(item); + } + break; + } + case 20: + { + RestricaoUsuario? obj3 = ((IEnumerable)source).FirstOrDefault((Func)((RestricaoUsuario x) => (int)x.Tipo == 91)); + if (obj3 == null || !obj3.Restricao) + { + Relatorios.Add(item); + } + break; + } + case 26: + { + RestricaoUsuario? obj22 = ((IEnumerable)source).FirstOrDefault((Func)((RestricaoUsuario x) => (int)x.Tipo == 107)); + if (obj22 == null || !obj22.Restricao) + { + Relatorios.Add(item); + } + break; + } + case 27: + { + RestricaoUsuario? obj15 = ((IEnumerable)source).FirstOrDefault((Func)((RestricaoUsuario x) => (int)x.Tipo == 111)); + if (obj15 == null || !obj15.Restricao) + { + Relatorios.Add(item); + } + break; + } + case 28: + { + RestricaoUsuario? obj8 = ((IEnumerable)source).FirstOrDefault((Func)((RestricaoUsuario x) => (int)x.Tipo == 112)); + if (obj8 == null || !obj8.Restricao) + { + Relatorios.Add(item); + } + break; + } + case 29: + { + RestricaoUsuario? obj = ((IEnumerable)source).FirstOrDefault((Func)((RestricaoUsuario x) => (int)x.Tipo == 30)); + if (obj == null || !obj.Restricao) + { + Relatorios.Add(item); + } + break; + } + } + } + Relatorio = Relatorios.FirstOrDefault(); + } + + public void AdicionarFiltro(FiltroRelatorio filtro) + { + //IL_005a: Unknown result type (might be due to invalid IL or missing references) + //IL_005f: Unknown result type (might be due to invalid IL or missing references) + //IL_0061: Unknown result type (might be due to invalid IL or missing references) + //IL_0088: Expected I4, but got Unknown + if (filtro == null) + { + return; + } + if (FiltroRelatorioSelecionado == null) + { + FiltroRelatorioSelecionado = new ObservableCollection(); + } + if (FiltroRelatorioSelecionado.Any((FiltroRelatorio x) => x.Id == filtro.Id && x.Tipo == filtro.Tipo)) + { + return; + } + FiltroRelatorioSelecionado.Add(filtro); + TipoFiltroRelatorio tipo = filtro.Tipo; + switch ((int)tipo) + { + case 5: + { + StatusRelatorio val8 = ((IEnumerable)TipoSeguros).FirstOrDefault((Func)((StatusRelatorio x) => (long)x.Status == filtro.Id)); + if (val8 != null) + { + val8.Selecionado = true; + } + break; + } + case 0: + { + Seguradora val4 = ((IEnumerable)Seguradoras).FirstOrDefault((Func)((Seguradora x) => ((DomainBase)x).Id == filtro.Id)); + if (val4 != null) + { + val4.Selecionado = true; + } + break; + } + case 1: + { + Ramo val6 = ((IEnumerable)Ramos).FirstOrDefault((Func)((Ramo x) => ((DomainBase)x).Id == filtro.Id)); + if (val6 != null) + { + val6.Selecionado = true; + } + break; + } + case 3: + { + Estipulante val2 = ((IEnumerable)Estipulantes).FirstOrDefault((Func)((Estipulante x) => ((DomainBase)x).Id == filtro.Id)); + if (val2 != null) + { + val2.Selecionado = true; + } + break; + } + case 2: + { + Vendedor val7 = ((IEnumerable)Vendedores).FirstOrDefault((Func)((Vendedor x) => ((DomainBase)x).Id == filtro.Id)); + if (val7 != null) + { + val7.Selecionado = true; + } + break; + } + case 6: + { + TipoVendedor val5 = ((IEnumerable)TipoVendedor).FirstOrDefault((Func)((TipoVendedor x) => ((DomainBase)x).Id == filtro.Id)); + if (val5 != null) + { + val5.Selecionado = true; + } + break; + } + case 4: + { + Produto val3 = ((IEnumerable)Produtos).FirstOrDefault((Func)((Produto x) => ((DomainBase)x).Id == filtro.Id)); + if (val3 != null) + { + val3.Selecionado = true; + } + break; + } + case 7: + { + NegocioRelatorio val = ((IEnumerable)Negocios).FirstOrDefault((Func)((NegocioRelatorio x) => x.Id == filtro.Id)); + if (val != null) + { + val.Selecionado = true; + } + break; + } + } + } + + public void LimparFiltros() + { + _alterandoFiltros = true; + FiltroRelatorioSelecionado = null; + foreach (StatusRelatorio item in TipoSeguros.Where((StatusRelatorio x) => x.Selecionado)) + { + item.Selecionado = false; + } + foreach (Seguradora item2 in Seguradoras.Where((Seguradora x) => x.Selecionado)) + { + item2.Selecionado = false; + } + foreach (Ramo item3 in Ramos.Where((Ramo x) => x.Selecionado)) + { + item3.Selecionado = false; + } + foreach (Estipulante item4 in Estipulantes.Where((Estipulante x) => x.Selecionado)) + { + item4.Selecionado = false; + } + foreach (Vendedor item5 in Vendedores.Where((Vendedor x) => x.Selecionado)) + { + item5.Selecionado = false; + } + foreach (TipoVendedor item6 in TipoVendedor.Where((TipoVendedor x) => x.Selecionado)) + { + item6.Selecionado = false; + } + foreach (Produto item7 in Produtos.Where((Produto x) => x.Selecionado)) + { + item7.Selecionado = false; + } + foreach (NegocioRelatorio item8 in Negocios.Where((NegocioRelatorio x) => x.Selecionado)) + { + item8.Selecionado = false; + } + _alterandoFiltros = false; + } + + public void AdicionarFiltros() + { + List list = new List(); + List collection = Seguradoras.Where((Seguradora x) => x.Selecionado).Select((Func)((Seguradora x) => new FiltroRelatorio + { + Id = ((DomainBase)x).Id, + Descricao = x.Nome, + Tipo = (TipoFiltroRelatorio)0 + })).ToList(); + list.AddRange(collection); + collection = Ramos.Where((Ramo x) => x.Selecionado).Select((Func)((Ramo x) => new FiltroRelatorio + { + Id = ((DomainBase)x).Id, + Descricao = x.Nome, + Tipo = (TipoFiltroRelatorio)1 + })).ToList(); + list.AddRange(collection); + collection = Vendedores.Where((Vendedor x) => x.Selecionado).Select((Func)((Vendedor x) => new FiltroRelatorio + { + Id = ((DomainBase)x).Id, + Descricao = x.Nome, + Tipo = (TipoFiltroRelatorio)2 + })).ToList(); + list.AddRange(collection); + collection = TipoVendedor.Where((TipoVendedor x) => x.Selecionado).Select((Func)((TipoVendedor x) => new FiltroRelatorio + { + Id = ((DomainBase)x).Id, + Descricao = x.Descricao, + Tipo = (TipoFiltroRelatorio)6 + })).ToList(); + list.AddRange(collection); + collection = Estipulantes.Where((Estipulante x) => x.Selecionado).Select((Func)((Estipulante x) => new FiltroRelatorio + { + Id = ((DomainBase)x).Id, + Descricao = x.Nome, + Tipo = (TipoFiltroRelatorio)3 + })).ToList(); + list.AddRange(collection); + collection = Produtos.Where((Produto x) => x.Selecionado).Select((Func)((Produto x) => new FiltroRelatorio + { + Id = ((DomainBase)x).Id, + Descricao = x.Nome, + Tipo = (TipoFiltroRelatorio)4 + })).ToList(); + list.AddRange(collection); + collection = TipoSeguros.Where((StatusRelatorio x) => x.Selecionado).Select((Func)((StatusRelatorio x) => new FiltroRelatorio + { + Id = (long)x.Status, + Descricao = EnumHelper.GetDescription(x.Status), + Tipo = (TipoFiltroRelatorio)5 + })).ToList(); + list.AddRange(collection); + collection = Negocios.Where((NegocioRelatorio x) => x.Selecionado).Select((Func)((NegocioRelatorio x) => new FiltroRelatorio + { + Id = (long)x.Negocio, + Descricao = EnumHelper.GetDescription(x.Negocio), + Tipo = (TipoFiltroRelatorio)7 + })).ToList(); + list.AddRange(collection); + FiltroRelatorioSelecionado = new ObservableCollection(list); + } + + public void LimparRelatorio() + { + RelatorioVisibility = false; + VisibilityFiltroPersonalizado = (Visibility)2; + } + + public async Task GerarExcel() + { + string text = ""; + string fileName; + if (Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 41)) + { + FolderBrowserDialog val = new FolderBrowserDialog(); + try + { + if (1 != (int)((CommonDialog)val).ShowDialog()) + { + return; + } + text = val.SelectedPath + "\\"; + Directory.CreateDirectory(text); + } + finally + { + ((IDisposable)val)?.Dispose(); + } + fileName = text + EnumHelper.GetDescription(Relatorio) + " " + Functions.GetNetworkTime().Date.ToShortDateString().Replace("/", "") + ".xlsx"; + } + else + { + text = Path.GetTempPath(); + fileName = $"{text}{Guid.NewGuid()}.xlsx"; + } + XLWorkbook workbook = new XLWorkbook(); + int index3 = 1; + Relatorio relatorio = Relatorio; + Agrupamento agrupamento40; + Agrupamento agrupamento41; + switch ((int)relatorio) + { + case 19: + { + List list47 = ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(); + if (NotaFiscalFiltrado == null || list47.Count == 0) + { + return; + } + List analitico48 = (list47.Any((NotaFiscalRelatorio x) => x.Selecionado) ? list47.Where((NotaFiscalRelatorio x) => x.Selecionado).ToList() : list47); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico48, Relatorio); + break; + } + case 17: + { + List list48 = ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(); + if (LicenciamentoFiltrado == null || list48.Count == 0) + { + return; + } + List analitico49 = (list48.Any((Licenciamento x) => x.Selecionado) ? list48.Where((Licenciamento x) => x.Selecionado).ToList() : list48); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico49, Relatorio); + break; + } + case 18: + { + List list56 = ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(); + if (TarefaFiltrado == null || list56.Count == 0) + { + return; + } + List analitico58 = (list56.Any((Tarefa x) => x.Selecionado) ? list56.Where((Tarefa x) => x.Selecionado).ToList() : list56); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico58, Relatorio); + break; + } + case 0: + case 1: + { + List list23 = ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(); + if (ClientesAtivosInativosFiltrado == null || list23.Count == 0) + { + return; + } + List analitico27 = (list23.Any((ClientesAtivosInativos x) => x.Selecionado) ? list23.Where((ClientesAtivosInativos x) => x.Selecionado).ToList() : list23); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico27, Relatorio); + break; + } + case 4: + { + List listRenovacao = ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(); + if (RenovacaoFiltrado == null || listRenovacao.Count == 0) + { + return; + } + agrupamento40 = Agrupamento; + switch (agrupamento40 - 1) + { + default: + { + List analitico7 = (listRenovacao.Any((Renovacao x) => x.Selecionado) ? listRenovacao.Where((Renovacao x) => x.Selecionado).ToList() : listRenovacao.ToList()); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico7, Relatorio); + break; + } + case 0: + { + List agrupamento9 = (from x in listRenovacao + orderby x.Seguradora + select x.Seguradora).Distinct().ToList(); + if ((agrupamento9.Count == 2 && agrupamento9[0] == null && agrupamento9[1] == "") || (agrupamento9.Count == 1 && agrupamento9[0] == null) || (agrupamento9.Count == 1 && agrupamento9[0] == "")) + { + List analitico6 = (listRenovacao.Any((Renovacao x) => x.Selecionado) ? listRenovacao.Where((Renovacao x) => x.Selecionado).ToList() : listRenovacao.ToList()); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico6, Relatorio); + break; + } + foreach (string grupo35 in agrupamento9) + { + if (!string.IsNullOrWhiteSpace(grupo35)) + { + List list6 = (listRenovacao.Any((Renovacao x) => x.Selecionado) ? (from x in listRenovacao + where x.Selecionado && x.Seguradora == grupo35 + orderby x.VigenciaFinal + select x).ToList() : (from x in listRenovacao + where x.Seguradora == grupo35 + orderby x.VigenciaFinal + select x).ToList()); + if (list6.Count != 0) + { + string nome6 = grupo35; + agrupamento41 = Agrupamento; + string nome2 = nome6.ValidaNomePlanilha(((object)(Agrupamento)(ref agrupamento41)).ToString()); + workbook = await Funcoes.GerarXls(workbook, nome2, list6, Relatorio); + } + } + } + break; + } + case 1: + { + List agrupamento9 = (from x in listRenovacao + orderby x.Ramo + select x.Ramo).Distinct().ToList(); + if ((agrupamento9.Count == 2 && agrupamento9[0] == null && agrupamento9[1] == "") || (agrupamento9.Count == 1 && agrupamento9[0] == null) || (agrupamento9.Count == 1 && agrupamento9[0] == "")) + { + List analitico5 = (listRenovacao.Any((Renovacao x) => x.Selecionado) ? listRenovacao.Where((Renovacao x) => x.Selecionado).ToList() : listRenovacao.ToList()); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico5, Relatorio); + break; + } + foreach (string grupo36 in agrupamento9) + { + if (!string.IsNullOrWhiteSpace(grupo36)) + { + List list5 = (listRenovacao.Any((Renovacao x) => x.Selecionado) ? (from x in listRenovacao + where x.Selecionado && x.Ramo == grupo36 + orderby x.VigenciaFinal + select x).ToList() : (from x in listRenovacao + where x.Ramo == grupo36 + orderby x.VigenciaFinal + select x).ToList()); + if (list5.Count != 0) + { + string nome5 = grupo36; + agrupamento41 = Agrupamento; + string nome2 = nome5.ValidaNomePlanilha(((object)(Agrupamento)(ref agrupamento41)).ToString()); + workbook = await Funcoes.GerarXls(workbook, nome2, list5, Relatorio); + index3++; + } + } + } + break; + } + case 2: + { + List agrupamento9 = (from x in listRenovacao + orderby x.Vendedor + select x.Vendedor).Distinct().ToList(); + if ((agrupamento9.Count == 2 && agrupamento9[0] == null && agrupamento9[1] == "") || (agrupamento9.Count == 1 && agrupamento9[0] == null) || (agrupamento9.Count == 1 && agrupamento9[0] == "")) + { + List analitico3 = (listRenovacao.Any((Renovacao x) => x.Selecionado) ? listRenovacao.Where((Renovacao x) => x.Selecionado).ToList() : listRenovacao.ToList()); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico3, Relatorio); + break; + } + index3 = 1; + foreach (string grupo38 in agrupamento9) + { + if (!string.IsNullOrWhiteSpace(grupo38)) + { + List list3 = (listRenovacao.Any((Renovacao x) => x.Selecionado) ? (from x in listRenovacao + where x.Selecionado && x.Vendedor == grupo38 + orderby x.VigenciaFinal + select x).ToList() : (from x in listRenovacao + where x.Vendedor == grupo38 + orderby x.VigenciaFinal + select x).ToList()); + if (list3.Count != 0) + { + string nome3 = grupo38; + agrupamento41 = Agrupamento; + string nome2 = nome3.ValidaNomePlanilha(((object)(Agrupamento)(ref agrupamento41)).ToString(), index3); + workbook = await Funcoes.GerarXls(workbook, nome2, list3, Relatorio); + index3++; + } + } + } + break; + } + case 3: + { + List agrupamento9 = (from x in listRenovacao + orderby x.Estipulante + select x.Estipulante).Distinct().ToList(); + if ((agrupamento9.Count == 2 && agrupamento9[0] == null && agrupamento9[1] == "") || (agrupamento9.Count == 1 && agrupamento9[0] == null) || (agrupamento9.Count == 1 && agrupamento9[0] == "")) + { + List analitico4 = (listRenovacao.Any((Renovacao x) => x.Selecionado) ? listRenovacao.Where((Renovacao x) => x.Selecionado).ToList() : listRenovacao.ToList()); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico4, Relatorio); + break; + } + index3 = 1; + foreach (string grupo37 in agrupamento9) + { + if (!string.IsNullOrWhiteSpace(grupo37)) + { + List list4 = (listRenovacao.Any((Renovacao x) => x.Selecionado) ? (from x in listRenovacao + where x.Selecionado && x.Estipulante == grupo37 + orderby x.VigenciaFinal + select x).ToList() : (from x in listRenovacao + where x.Estipulante == grupo37 + orderby x.VigenciaFinal + select x).ToList()); + if (list4.Count != 0) + { + string nome4 = grupo37; + agrupamento41 = Agrupamento; + string nome2 = nome4.ValidaNomePlanilha(((object)(Agrupamento)(ref agrupamento41)).ToString(), index3); + workbook = await Funcoes.GerarXls(workbook, nome2, list4, Relatorio); + index3++; + } + } + } + break; + } + case 4: + { + ColunasOcultas = await Funcoes.OcultarColunas(Relatorio); + List agrupamento9 = (from x in listRenovacao + orderby x.Status + select x.Status).Distinct().ToList(); + if ((agrupamento9.Count == 2 && agrupamento9[0] == null && agrupamento9[1] == "") || (agrupamento9.Count == 1 && agrupamento9[0] == null) || (agrupamento9.Count == 1 && agrupamento9[0] == "")) + { + List analitico2 = (listRenovacao.Any((Renovacao x) => x.Selecionado) ? listRenovacao.Where((Renovacao x) => x.Selecionado).ToList() : listRenovacao.ToList()); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico2, Relatorio); + break; + } + foreach (string grupo39 in agrupamento9) + { + if (!string.IsNullOrWhiteSpace(grupo39)) + { + List list2 = (listRenovacao.Any((Renovacao x) => x.Selecionado) ? (from x in listRenovacao + where x.Selecionado && x.Status == grupo39 + orderby x.VigenciaFinal + select x).ToList() : (from x in listRenovacao + where x.Status == grupo39 + orderby x.VigenciaFinal + select x).ToList()); + if (list2.Count != 0) + { + string nome = grupo39; + agrupamento41 = Agrupamento; + string nome2 = nome.ValidaNomePlanilha(((object)(Agrupamento)(ref agrupamento41)).ToString()); + workbook = await Funcoes.GerarXls(workbook, nome2, list2, Relatorio); + } + } + } + break; + } + } + break; + } + case 2: + { + List listProducao = ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(); + if (ProducaoFiltrado == null || listProducao.Count == 0) + { + return; + } + agrupamento40 = Agrupamento; + switch (agrupamento40 - 1) + { + default: + { + List source = (listProducao.Any((Producao x) => x.Selecionado) ? (from x in listProducao + where x.Selecionado + orderby x.VigenciaInicial + select x).ToList() : listProducao.OrderBy((Producao x) => x.VigenciaInicial).ToList()); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", source.ToList(), Relatorio); + break; + } + case 0: + { + List agrupamento9 = (from x in listProducao + orderby x.Seguradora + select x.Seguradora).Distinct().ToList(); + if ((agrupamento9.Count == 2 && agrupamento9[0] == null && agrupamento9[1] == "") || (agrupamento9.Count == 1 && agrupamento9[0] == null) || (agrupamento9.Count == 1 && agrupamento9[0] == "")) + { + List analitico31 = (listProducao.Any((Producao x) => x.Selecionado) ? (from x in listProducao.Where((Producao x) => x.Selecionado).ToList() + orderby x.VigenciaInicial + select x).ToList() : listProducao.OrderBy((Producao x) => x.VigenciaInicial).ToList()); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico31, Relatorio); + break; + } + foreach (string grupo17 in agrupamento9) + { + if (!string.IsNullOrWhiteSpace(grupo17)) + { + List list27 = (listProducao.Any((Producao x) => x.Selecionado) ? (from x in listProducao + where x.Selecionado && x.Seguradora == grupo17 + orderby x.VigenciaInicial + select x).ToList() : (from x in listProducao + where x.Seguradora == grupo17 + orderby x.VigenciaInicial + select x).ToList()); + if (list27.Count != 0) + { + string nome24 = grupo17; + agrupamento41 = Agrupamento; + string nome2 = nome24.ValidaNomePlanilha(((object)(Agrupamento)(ref agrupamento41)).ToString()); + workbook = await Funcoes.GerarXls(workbook, nome2, list27, Relatorio); + } + } + } + break; + } + case 1: + { + List agrupamento9 = (from x in listProducao + orderby x.Ramo + select x.Ramo).Distinct().ToList(); + if ((agrupamento9.Count == 2 && agrupamento9[0] == null && agrupamento9[1] == "") || (agrupamento9.Count == 1 && agrupamento9[0] == null) || (agrupamento9.Count == 1 && agrupamento9[0] == "")) + { + List analitico33 = (listProducao.Any((Producao x) => x.Selecionado) ? (from x in listProducao.Where((Producao x) => x.Selecionado).ToList() + orderby x.VigenciaInicial + select x).ToList() : listProducao.OrderBy((Producao x) => x.VigenciaInicial).ToList()); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico33, Relatorio); + break; + } + foreach (string grupo15 in agrupamento9) + { + if (!string.IsNullOrWhiteSpace(grupo15)) + { + List list29 = (listProducao.Any((Producao x) => x.Selecionado) ? (from x in listProducao + where x.Selecionado && x.Ramo == grupo15 + orderby x.VigenciaInicial + select x).ToList() : (from x in listProducao + where x.Ramo == grupo15 + orderby x.VigenciaInicial + select x).ToList()); + if (list29.Count != 0) + { + string nome26 = grupo15; + agrupamento41 = Agrupamento; + string nome2 = nome26.ValidaNomePlanilha(((object)(Agrupamento)(ref agrupamento41)).ToString()); + workbook = await Funcoes.GerarXls(workbook, nome2, list29, Relatorio); + } + } + } + break; + } + case 2: + { + List agrupamento9 = (from x in listProducao + orderby x.Vendedor + select x.Vendedor).Distinct().ToList(); + if ((agrupamento9.Count == 2 && agrupamento9[0] == null && agrupamento9[1] == "") || (agrupamento9.Count == 1 && agrupamento9[0] == null) || (agrupamento9.Count == 1 && agrupamento9[0] == "")) + { + List analitico30 = (listProducao.Any((Producao x) => x.Selecionado) ? (from x in listProducao.Where((Producao x) => x.Selecionado).ToList() + orderby x.VigenciaInicial + select x).ToList() : listProducao.OrderBy((Producao x) => x.VigenciaInicial).ToList()); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico30, Relatorio); + break; + } + index3 = 1; + foreach (string grupo18 in agrupamento9) + { + if (!string.IsNullOrWhiteSpace(grupo18)) + { + List list26 = (listProducao.Any((Producao x) => x.Selecionado) ? (from x in listProducao + where x.Selecionado && x.Vendedor == grupo18 + orderby x.VigenciaInicial + select x).ToList() : (from x in listProducao + where x.Vendedor == grupo18 + orderby x.VigenciaInicial + select x).ToList()); + if (list26.Count != 0) + { + string nome23 = grupo18; + agrupamento41 = Agrupamento; + string nome2 = nome23.ValidaNomePlanilha(((object)(Agrupamento)(ref agrupamento41)).ToString(), index3); + workbook = await Funcoes.GerarXls(workbook, nome2, list26, Relatorio); + index3++; + } + } + } + break; + } + case 3: + { + List agrupamento9 = (from x in listProducao + orderby x.Estipulante + select x.Estipulante).Distinct().ToList(); + if ((agrupamento9.Count == 2 && agrupamento9[0] == null && agrupamento9[1] == "") || (agrupamento9.Count == 1 && agrupamento9[0] == null) || (agrupamento9.Count == 1 && agrupamento9[0] == "")) + { + List analitico32 = (listProducao.Any((Producao x) => x.Selecionado) ? (from x in listProducao.Where((Producao x) => x.Selecionado).ToList() + orderby x.VigenciaInicial + select x).ToList() : listProducao.OrderBy((Producao x) => x.VigenciaInicial).ToList()); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico32, Relatorio); + break; + } + index3 = 1; + foreach (string grupo16 in agrupamento9) + { + if (!string.IsNullOrWhiteSpace(grupo16)) + { + List list28 = (listProducao.Any((Producao x) => x.Selecionado) ? (from x in listProducao + where x.Selecionado && x.Estipulante == grupo16 + orderby x.VigenciaInicial + select x).ToList() : (from x in listProducao + where x.Estipulante == grupo16 + orderby x.VigenciaInicial + select x).ToList()); + if (list28.Count != 0) + { + string nome25 = grupo16; + agrupamento41 = Agrupamento; + string nome2 = nome25.ValidaNomePlanilha(((object)(Agrupamento)(ref agrupamento41)).ToString(), index3); + workbook = await Funcoes.GerarXls(workbook, nome2, list28, Relatorio); + index3++; + } + } + } + break; + } + case 4: + { + List agrupamento9 = (from x in listProducao + orderby x.Status + select x.Status).Distinct().ToList(); + ColunasOcultas = await Funcoes.OcultarColunas(Relatorio); + if ((agrupamento9.Count == 2 && agrupamento9[0] == null && agrupamento9[1] == "") || (agrupamento9.Count == 1 && agrupamento9[0] == null) || (agrupamento9.Count == 1 && agrupamento9[0] == "")) + { + List analitico29 = (listProducao.Any((Producao x) => x.Selecionado) ? (from x in listProducao.Where((Producao x) => x.Selecionado).ToList() + orderby x.VigenciaInicial + select x).ToList() : listProducao.OrderBy((Producao x) => x.VigenciaInicial).ToList()); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico29, ColunasOcultas); + break; + } + foreach (string grupo19 in agrupamento9) + { + if (!string.IsNullOrWhiteSpace(grupo19)) + { + List list25 = (listProducao.Any((Producao x) => x.Selecionado) ? (from x in listProducao + where x.Selecionado && x.Status == grupo19 + orderby x.VigenciaInicial + select x).ToList() : (from x in listProducao + where x.Status == grupo19 + orderby x.VigenciaInicial + select x).ToList()); + if (list25.Count != 0) + { + string nome22 = grupo19; + agrupamento41 = Agrupamento; + string nome2 = nome22.ValidaNomePlanilha(((object)(Agrupamento)(ref agrupamento41)).ToString()); + workbook = await Funcoes.GerarXls(workbook, nome2, list25, ColunasOcultas); + } + } + } + break; + } + } + break; + } + case 3: + { + List listApolicePendente = ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(); + if (ApolicePendenteFiltrado == null || listApolicePendente.Count == 0) + { + return; + } + agrupamento40 = Agrupamento; + switch (agrupamento40 - 1) + { + default: + { + List analitico46 = (listApolicePendente.Any((ApolicePendente x) => x.Selecionado) ? listApolicePendente.Where((ApolicePendente x) => x.Selecionado).ToList() : listApolicePendente); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico46, Relatorio); + break; + } + case 0: + { + List agrupamento9 = (from x in listApolicePendente + orderby x.Seguradora + select x.Seguradora).Distinct().ToList(); + if ((agrupamento9.Count == 2 && agrupamento9[0] == null && agrupamento9[1] == "") || (agrupamento9.Count == 1 && agrupamento9[0] == null) || (agrupamento9.Count == 1 && agrupamento9[0] == "")) + { + List analitico45 = (listApolicePendente.Any((ApolicePendente x) => x.Selecionado) ? listApolicePendente.Where((ApolicePendente x) => x.Selecionado).ToList() : listApolicePendente); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico45, Relatorio); + break; + } + foreach (string grupo6 in agrupamento9) + { + if (!string.IsNullOrWhiteSpace(grupo6)) + { + List list42 = (listApolicePendente.Any((ApolicePendente x) => x.Selecionado) ? (from x in listApolicePendente + where x.Selecionado && x.Seguradora == grupo6 + orderby x.VigenciaInicial + select x).ToList() : (from x in listApolicePendente + where x.Seguradora == grupo6 + orderby x.VigenciaInicial + select x).ToList()); + if (list42.Count != 0) + { + string nome38 = grupo6; + agrupamento41 = Agrupamento; + string nome2 = nome38.ValidaNomePlanilha(((object)(Agrupamento)(ref agrupamento41)).ToString()); + workbook = await Funcoes.GerarXls(workbook, nome2, list42, Relatorio); + } + } + } + break; + } + case 1: + { + List agrupamento9 = (from x in listApolicePendente + orderby x.Ramo + select x.Ramo).Distinct().ToList(); + if ((agrupamento9.Count == 2 && agrupamento9[0] == null && agrupamento9[1] == "") || (agrupamento9.Count == 1 && agrupamento9[0] == null) || (agrupamento9.Count == 1 && agrupamento9[0] == "")) + { + List analitico44 = (listApolicePendente.Any((ApolicePendente x) => x.Selecionado) ? listApolicePendente.Where((ApolicePendente x) => x.Selecionado).ToList() : listApolicePendente); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico44, Relatorio); + break; + } + foreach (string grupo7 in agrupamento9) + { + if (!string.IsNullOrWhiteSpace(grupo7)) + { + List list41 = (listApolicePendente.Any((ApolicePendente x) => x.Selecionado) ? (from x in listApolicePendente + where x.Selecionado && x.Ramo == grupo7 + orderby x.Seguradora + select x).ToList() : (from x in listApolicePendente + where x.Ramo == grupo7 + orderby x.Seguradora + select x).ToList()); + if (list41.Count != 0) + { + string nome37 = grupo7; + agrupamento41 = Agrupamento; + string nome2 = nome37.ValidaNomePlanilha(((object)(Agrupamento)(ref agrupamento41)).ToString()); + workbook = await Funcoes.GerarXls(workbook, nome2, list41, Relatorio); + } + } + } + break; + } + case 2: + { + List agrupamento9 = (from x in listApolicePendente + orderby x.Vendedor + select x.Vendedor).Distinct().ToList(); + if ((agrupamento9.Count == 2 && agrupamento9[0] == null && agrupamento9[1] == "") || (agrupamento9.Count == 1 && agrupamento9[0] == null) || (agrupamento9.Count == 1 && agrupamento9[0] == "")) + { + List analitico42 = (listApolicePendente.Any((ApolicePendente x) => x.Selecionado) ? listApolicePendente.Where((ApolicePendente x) => x.Selecionado).ToList() : listApolicePendente); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico42, Relatorio); + break; + } + index3 = 1; + foreach (string grupo9 in agrupamento9) + { + if (!string.IsNullOrWhiteSpace(grupo9)) + { + List list39 = (listApolicePendente.Any((ApolicePendente x) => x.Selecionado) ? (from x in listApolicePendente + where x.Selecionado && x.Vendedor == grupo9 + orderby x.Seguradora + select x).ToList() : (from x in listApolicePendente + where x.Vendedor == grupo9 + orderby x.Seguradora + select x).ToList()); + if (list39.Count != 0) + { + string nome35 = grupo9; + agrupamento41 = Agrupamento; + string nome2 = nome35.ValidaNomePlanilha(((object)(Agrupamento)(ref agrupamento41)).ToString(), index3); + workbook = await Funcoes.GerarXls(workbook, nome2, list39, Relatorio); + index3++; + } + } + } + break; + } + case 3: + { + List agrupamento9 = (from x in listApolicePendente + orderby x.Estipulante + select x.Estipulante).Distinct().ToList(); + if ((agrupamento9.Count == 2 && agrupamento9[0] == null && agrupamento9[1] == "") || (agrupamento9.Count == 1 && agrupamento9[0] == null) || (agrupamento9.Count == 1 && agrupamento9[0] == "")) + { + List analitico43 = (listApolicePendente.Any((ApolicePendente x) => x.Selecionado) ? listApolicePendente.Where((ApolicePendente x) => x.Selecionado).ToList() : listApolicePendente); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico43, Relatorio); + break; + } + index3 = 1; + foreach (string grupo8 in agrupamento9) + { + if (!string.IsNullOrWhiteSpace(grupo8)) + { + List list40 = (listApolicePendente.Any((ApolicePendente x) => x.Selecionado) ? (from x in listApolicePendente + where x.Selecionado && x.Estipulante == grupo8 + orderby x.Seguradora + select x).ToList() : (from x in listApolicePendente + where x.Estipulante == grupo8 + orderby x.Seguradora + select x).ToList()); + if (list40.Count != 0) + { + string nome36 = grupo8; + agrupamento41 = Agrupamento; + string nome2 = nome36.ValidaNomePlanilha(((object)(Agrupamento)(ref agrupamento41)).ToString(), index3); + workbook = await Funcoes.GerarXls(workbook, nome2, list40, Relatorio); + index3++; + } + } + } + break; + } + case 4: + { + List agrupamento9 = (from x in listApolicePendente + orderby x.Status + select x.Status).Distinct().ToList(); + if ((agrupamento9.Count == 2 && agrupamento9[0] == null && agrupamento9[1] == "") || (agrupamento9.Count == 1 && agrupamento9[0] == null) || (agrupamento9.Count == 1 && agrupamento9[0] == "")) + { + List analitico41 = (listApolicePendente.Any((ApolicePendente x) => x.Selecionado) ? listApolicePendente.Where((ApolicePendente x) => x.Selecionado).ToList() : listApolicePendente); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico41, ColunasOcultas); + break; + } + foreach (string grupo10 in agrupamento9) + { + if (!string.IsNullOrWhiteSpace(grupo10)) + { + List list38 = (listApolicePendente.Any((ApolicePendente x) => x.Selecionado) ? (from x in listApolicePendente + where x.Selecionado && x.Status == grupo10 + orderby x.Seguradora + select x).ToList() : (from x in listApolicePendente + where x.Status == grupo10 + orderby x.Seguradora + select x).ToList()); + if (list38.Count != 0) + { + string nome34 = grupo10; + agrupamento41 = Agrupamento; + string nome2 = nome34.ValidaNomePlanilha(((object)(Agrupamento)(ref agrupamento41)).ToString()); + workbook = await Funcoes.GerarXls(workbook, nome2, list38, ColunasOcultas); + } + } + } + break; + } + } + break; + } + case 5: + { + List listComissaoRelatorio = ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(); + if (ComissaoFiltrado == null || listComissaoRelatorio.Count == 0) + { + return; + } + agrupamento40 = Agrupamento; + switch (agrupamento40 - 1) + { + default: + { + List analitico19 = (listComissaoRelatorio.Any((Comissao x) => x.Selecionado) ? listComissaoRelatorio.Where((Comissao x) => x.Selecionado).ToList() : listComissaoRelatorio); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico19, Relatorio); + break; + } + case 0: + { + List agrupamento9 = (from x in listComissaoRelatorio + orderby x.Seguradora + select x.Seguradora).Distinct().ToList(); + if ((agrupamento9.Count == 2 && agrupamento9[0] == null && agrupamento9[1] == "") || (agrupamento9.Count == 1 && agrupamento9[0] == null) || (agrupamento9.Count == 1 && agrupamento9[0] == "")) + { + List analitico18 = (listComissaoRelatorio.Any((Comissao x) => x.Selecionado) ? listComissaoRelatorio.Where((Comissao x) => x.Selecionado).ToList() : listComissaoRelatorio); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico18, Relatorio); + break; + } + foreach (string grupo25 in agrupamento9) + { + if (!string.IsNullOrWhiteSpace(grupo25)) + { + List list16 = (listComissaoRelatorio.Any((Comissao x) => x.Selecionado) ? (from x in listComissaoRelatorio + where x.Selecionado && x.Seguradora == grupo25 + orderby x.Recebimento + select x).ToList() : (from x in listComissaoRelatorio + where x.Seguradora == grupo25 + orderby x.Recebimento + select x).ToList()); + if (list16.Count != 0) + { + string nome16 = grupo25; + agrupamento41 = Agrupamento; + string nome2 = nome16.ValidaNomePlanilha(((object)(Agrupamento)(ref agrupamento41)).ToString()); + workbook = await Funcoes.GerarXls(workbook, nome2, list16, Relatorio); + } + } + } + break; + } + case 1: + { + List agrupamento9 = (from x in listComissaoRelatorio + orderby x.Ramo + select x.Ramo).Distinct().ToList(); + if ((agrupamento9.Count == 2 && agrupamento9[0] == null && agrupamento9[1] == "") || (agrupamento9.Count == 1 && agrupamento9[0] == null) || (agrupamento9.Count == 1 && agrupamento9[0] == "")) + { + List analitico17 = (listComissaoRelatorio.Any((Comissao x) => x.Selecionado) ? listComissaoRelatorio.Where((Comissao x) => x.Selecionado).ToList() : listComissaoRelatorio); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico17, Relatorio); + break; + } + foreach (string grupo26 in agrupamento9) + { + if (!string.IsNullOrWhiteSpace(grupo26)) + { + List list15 = (listComissaoRelatorio.Any((Comissao x) => x.Selecionado) ? (from x in listComissaoRelatorio + where x.Selecionado && x.Ramo == grupo26 + orderby x.Recebimento + select x).ToList() : (from x in listComissaoRelatorio + where x.Ramo == grupo26 + orderby x.Recebimento + select x).ToList()); + if (list15.Count != 0) + { + string nome15 = grupo26; + agrupamento41 = Agrupamento; + string nome2 = nome15.ValidaNomePlanilha(((object)(Agrupamento)(ref agrupamento41)).ToString()); + workbook = await Funcoes.GerarXls(workbook, nome2, list15, Relatorio); + } + } + } + break; + } + case 2: + { + List agrupamento9 = (from x in listComissaoRelatorio + orderby x.Vendedor + select x.Vendedor).Distinct().ToList(); + if ((agrupamento9.Count == 2 && agrupamento9[0] == null && agrupamento9[1] == "") || (agrupamento9.Count == 1 && agrupamento9[0] == null) || (agrupamento9.Count == 1 && agrupamento9[0] == "")) + { + List analitico15 = (listComissaoRelatorio.Any((Comissao x) => x.Selecionado) ? listComissaoRelatorio.Where((Comissao x) => x.Selecionado).ToList() : listComissaoRelatorio); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico15, Relatorio); + break; + } + index3 = 1; + foreach (string grupo28 in agrupamento9) + { + if (!string.IsNullOrWhiteSpace(grupo28)) + { + List list13 = (listComissaoRelatorio.Any((Comissao x) => x.Selecionado) ? (from x in listComissaoRelatorio + where x.Selecionado && x.Vendedor == grupo28 + orderby x.Recebimento + select x).ToList() : (from x in listComissaoRelatorio + where x.Vendedor == grupo28 + orderby x.Recebimento + select x).ToList()); + if (list13.Count != 0) + { + string nome13 = grupo28; + agrupamento41 = Agrupamento; + string nome2 = nome13.ValidaNomePlanilha(((object)(Agrupamento)(ref agrupamento41)).ToString(), index3); + workbook = await Funcoes.GerarXls(workbook, nome2, list13, Relatorio); + index3++; + } + } + } + break; + } + case 3: + { + List agrupamento9 = (from x in listComissaoRelatorio + orderby x.Estipulante + select x.Estipulante).Distinct().ToList(); + if ((agrupamento9.Count == 2 && agrupamento9[0] == null && agrupamento9[1] == "") || (agrupamento9.Count == 1 && agrupamento9[0] == null) || (agrupamento9.Count == 1 && agrupamento9[0] == "")) + { + List analitico16 = (listComissaoRelatorio.Any((Comissao x) => x.Selecionado) ? listComissaoRelatorio.Where((Comissao x) => x.Selecionado).ToList() : listComissaoRelatorio); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico16, Relatorio); + break; + } + index3 = 1; + foreach (string grupo27 in agrupamento9) + { + if (!string.IsNullOrWhiteSpace(grupo27)) + { + List list14 = (listComissaoRelatorio.Any((Comissao x) => x.Selecionado) ? (from x in listComissaoRelatorio + where x.Selecionado && x.Estipulante == grupo27 + orderby x.Recebimento + select x).ToList() : (from x in listComissaoRelatorio + where x.Estipulante == grupo27 + orderby x.Recebimento + select x).ToList()); + if (list14.Count != 0) + { + string nome14 = grupo27; + agrupamento41 = Agrupamento; + string nome2 = nome14.ValidaNomePlanilha(((object)(Agrupamento)(ref agrupamento41)).ToString(), index3); + workbook = await Funcoes.GerarXls(workbook, nome2, list14, Relatorio); + index3++; + } + } + } + break; + } + case 4: + { + List agrupamento9 = (from x in listComissaoRelatorio + orderby x.Status + select x.Status).Distinct().ToList(); + if ((agrupamento9.Count == 2 && agrupamento9[0] == null && agrupamento9[1] == "") || (agrupamento9.Count == 1 && agrupamento9[0] == null) || (agrupamento9.Count == 1 && agrupamento9[0] == "")) + { + List analitico14 = (listComissaoRelatorio.Any((Comissao x) => x.Selecionado) ? listComissaoRelatorio.Where((Comissao x) => x.Selecionado).ToList() : listComissaoRelatorio); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico14, ColunasOcultas); + break; + } + foreach (string grupo29 in agrupamento9) + { + if (!string.IsNullOrWhiteSpace(grupo29)) + { + List list12 = (listComissaoRelatorio.Any((Comissao x) => x.Selecionado) ? (from x in listComissaoRelatorio + where x.Selecionado && x.Status == grupo29 + orderby x.Recebimento + select x).ToList() : (from x in listComissaoRelatorio + where x.Status == grupo29 + orderby x.Recebimento + select x).ToList()); + if (list12.Count != 0) + { + string nome12 = grupo29; + agrupamento41 = Agrupamento; + string nome2 = nome12.ValidaNomePlanilha(((object)(Agrupamento)(ref agrupamento41)).ToString()); + workbook = await Funcoes.GerarXls(workbook, nome2, list12, ColunasOcultas); + } + } + } + break; + } + } + break; + } + case 7: + { + if (Pagamentos == null) + { + return; + } + List list43 = PagamentosSintetico.OrderByDescending((PagamentoSintetico x) => x.Titulo).ToList(); + foreach (PagamentoSintetico item in list43) + { + string titulo2 = item.Titulo; + agrupamento40 = Agrupamento; + string nome39 = titulo2.ValidaNomePlanilha(((object)(Agrupamento)(ref agrupamento40)).ToString()); + workbook = await Funcoes.GerarXls(workbook, nome39, item.Agrupamento.ToList(), Relatorio); + } + index3 = 1; + List list44 = Pagamentos.OrderByDescending((Pagamento x) => x.Title).ToList(); + foreach (Pagamento item2 in list44) + { + string title2 = item2.Title; + agrupamento40 = Agrupamento; + string nome40 = title2.ValidaNomePlanilha(((object)(Agrupamento)(ref agrupamento40)).ToString(), index3); + workbook = await Funcoes.GerarXls(workbook, nome40, item2.Dados.ToList(), Relatorio); + index3++; + } + List list45 = new List(); + foreach (Pagamento item3 in Pagamentos.OrderBy((Pagamento x) => x.Title)) + { + list45.Add(item3.Vendedores); + } + list45.Add(new AgrupamentoVendedor + { + Vendedor = "TOTAL", + Repasse = list45.Sum((AgrupamentoVendedor p) => p.Repasse), + Debito = list45.Sum((AgrupamentoVendedor p) => p.Debito), + Credito = list45.Sum((AgrupamentoVendedor p) => p.Credito), + Desconto = list45.Sum((AgrupamentoVendedor p) => p.Desconto), + Adiantamento = list45.Sum((AgrupamentoVendedor p) => p.Adiantamento), + ValorLiquido = list45.Sum((AgrupamentoVendedor p) => p.ValorLiquido) + }); + workbook = await Funcoes.GerarXls(workbook, "DADOS BANCÁRIOS", list45, Relatorio, verificarColunas: false); + break; + } + case 6: + case 16: + { + List listPendente = ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(); + if (PendenteFiltrado == null || listPendente.Count == 0) + { + return; + } + agrupamento40 = Agrupamento; + switch (agrupamento40 - 1) + { + default: + { + List analitico25 = (listPendente.Any((Pendente x) => x.Selecionado) ? listPendente.Where((Pendente x) => x.Selecionado).ToList() : listPendente); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico25, Relatorio); + break; + } + case 0: + { + List agrupamento9 = (from x in listPendente + orderby x.Seguradora + select x.Seguradora).Distinct().ToList(); + if ((agrupamento9.Count == 2 && agrupamento9[0] == null && agrupamento9[1] == "") || (agrupamento9.Count == 1 && agrupamento9[0] == null) || (agrupamento9.Count == 1 && agrupamento9[0] == "")) + { + List analitico24 = (listPendente.Any((Pendente x) => x.Selecionado) ? listPendente.Where((Pendente x) => x.Selecionado).ToList() : listPendente); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico24, Relatorio); + break; + } + foreach (string grupo20 in agrupamento9) + { + if (!string.IsNullOrWhiteSpace(grupo20)) + { + List list21 = (listPendente.Any((Pendente x) => x.Selecionado) ? (from x in listPendente + where x.Selecionado && x.Seguradora == grupo20 + orderby x.Vencimento + select x).ToList() : (from x in listPendente + where x.Seguradora == grupo20 + orderby x.Vencimento + select x).ToList()); + if (list21.Count != 0) + { + string nome21 = grupo20; + agrupamento41 = Agrupamento; + string nome2 = nome21.ValidaNomePlanilha(((object)(Agrupamento)(ref agrupamento41)).ToString()); + workbook = await Funcoes.GerarXls(workbook, nome2, list21, Relatorio); + } + } + } + break; + } + case 1: + { + List agrupamento9 = (from x in listPendente + orderby x.Ramo + select x.Ramo).Distinct().ToList(); + if ((agrupamento9.Count == 2 && agrupamento9[0] == null && agrupamento9[1] == "") || (agrupamento9.Count == 1 && agrupamento9[0] == null) || (agrupamento9.Count == 1 && agrupamento9[0] == "")) + { + List analitico23 = (listPendente.Any((Pendente x) => x.Selecionado) ? listPendente.Where((Pendente x) => x.Selecionado).ToList() : listPendente); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico23, Relatorio); + break; + } + foreach (string grupo21 in agrupamento9) + { + if (!string.IsNullOrWhiteSpace(grupo21)) + { + List list20 = (listPendente.Any((Pendente x) => x.Selecionado) ? (from x in listPendente + where x.Selecionado && x.Ramo == grupo21 + orderby x.Vencimento + select x).ToList() : (from x in listPendente + where x.Ramo == grupo21 + orderby x.Vencimento + select x).ToList()); + if (list20.Count != 0) + { + string nome20 = grupo21; + agrupamento41 = Agrupamento; + string nome2 = nome20.ValidaNomePlanilha(((object)(Agrupamento)(ref agrupamento41)).ToString()); + workbook = await Funcoes.GerarXls(workbook, nome2, list20, Relatorio); + } + } + } + break; + } + case 2: + { + List agrupamento9 = (from x in listPendente + orderby x.Vendedor + select x.Vendedor).Distinct().ToList(); + if ((agrupamento9.Count == 2 && agrupamento9[0] == null && agrupamento9[1] == "") || (agrupamento9.Count == 1 && agrupamento9[0] == null) || (agrupamento9.Count == 1 && agrupamento9[0] == "")) + { + List analitico21 = (listPendente.Any((Pendente x) => x.Selecionado) ? listPendente.Where((Pendente x) => x.Selecionado).ToList() : listPendente); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico21, Relatorio); + break; + } + index3 = 1; + foreach (string grupo23 in agrupamento9) + { + if (!string.IsNullOrWhiteSpace(grupo23)) + { + List list18 = (listPendente.Any((Pendente x) => x.Selecionado) ? (from x in listPendente + where x.Selecionado && x.Vendedor == grupo23 + orderby x.Vencimento + select x).ToList() : (from x in listPendente + where x.Vendedor == grupo23 + orderby x.Vencimento + select x).ToList()); + if (list18.Count != 0) + { + string nome18 = grupo23; + agrupamento41 = Agrupamento; + string nome2 = nome18.ValidaNomePlanilha(((object)(Agrupamento)(ref agrupamento41)).ToString(), index3); + workbook = await Funcoes.GerarXls(workbook, nome2, list18, Relatorio); + index3++; + } + } + } + break; + } + case 3: + { + List agrupamento9 = (from x in listPendente + orderby x.Estipulante + select x.Estipulante).Distinct().ToList(); + if ((agrupamento9.Count == 2 && agrupamento9[0] == null && agrupamento9[1] == "") || (agrupamento9.Count == 1 && agrupamento9[0] == null) || (agrupamento9.Count == 1 && agrupamento9[0] == "")) + { + List analitico22 = (listPendente.Any((Pendente x) => x.Selecionado) ? listPendente.Where((Pendente x) => x.Selecionado).ToList() : listPendente); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico22, Relatorio); + break; + } + index3 = 1; + foreach (string grupo22 in agrupamento9) + { + if (!string.IsNullOrWhiteSpace(grupo22)) + { + List list19 = (listPendente.Any((Pendente x) => x.Selecionado) ? (from x in listPendente + where x.Selecionado && x.Estipulante == grupo22 + orderby x.Vencimento + select x).ToList() : (from x in listPendente + where x.Estipulante == grupo22 + orderby x.Vencimento + select x).ToList()); + if (list19.Count != 0) + { + string nome19 = grupo22; + agrupamento41 = Agrupamento; + string nome2 = nome19.ValidaNomePlanilha(((object)(Agrupamento)(ref agrupamento41)).ToString(), index3); + workbook = await Funcoes.GerarXls(workbook, nome2, list19, Relatorio); + index3++; + } + } + } + break; + } + case 4: + { + List agrupamento9 = (from x in listPendente + orderby x.Status + select x.Status).Distinct().ToList(); + if ((agrupamento9.Count == 2 && agrupamento9[0] == null && agrupamento9[1] == "") || (agrupamento9.Count == 1 && agrupamento9[0] == null) || (agrupamento9.Count == 1 && agrupamento9[0] == "")) + { + List analitico20 = (listPendente.Any((Pendente x) => x.Selecionado) ? listPendente.Where((Pendente x) => x.Selecionado).ToList() : listPendente); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico20, ColunasOcultas); + break; + } + foreach (string grupo24 in agrupamento9) + { + if (!string.IsNullOrWhiteSpace(grupo24)) + { + List list17 = (listPendente.Any((Pendente x) => x.Selecionado) ? (from x in listPendente + where x.Selecionado && x.Status == grupo24 + orderby x.Vencimento + select x).ToList() : (from x in listPendente + where x.Status == grupo24 + orderby x.Vencimento + select x).ToList()); + if (list17.Count != 0) + { + string nome17 = grupo24; + agrupamento41 = Agrupamento; + string nome2 = nome17.ValidaNomePlanilha(((object)(Agrupamento)(ref agrupamento41)).ToString()); + workbook = await Funcoes.GerarXls(workbook, nome2, list17, ColunasOcultas); + } + } + } + break; + } + } + break; + } + case 9: + case 10: + { + List listSinistroAnalitico = ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(); + if (SinistroFiltrado == null || listSinistroAnalitico.Count == 0) + { + return; + } + agrupamento40 = Agrupamento; + switch (agrupamento40 - 1) + { + default: + { + List analitico13 = (listSinistroAnalitico.Any((Sinistro x) => x.Selecionado) ? listSinistroAnalitico.Where((Sinistro x) => x.Selecionado).ToList() : listSinistroAnalitico); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico13, Relatorio); + break; + } + case 0: + { + List agrupamento9 = (from Sinistro x in (IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items + orderby x.Seguradora + select x.Seguradora).Distinct().ToList(); + if ((agrupamento9.Count == 2 && agrupamento9[0] == null && agrupamento9[1] == "") || (agrupamento9.Count == 1 && agrupamento9[0] == null) || (agrupamento9.Count == 1 && agrupamento9[0] == "")) + { + List analitico12 = (listSinistroAnalitico.Any((Sinistro x) => x.Selecionado) ? listSinistroAnalitico.Where((Sinistro x) => x.Selecionado).ToList() : listSinistroAnalitico); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico12, Relatorio); + break; + } + foreach (string grupo30 in agrupamento9) + { + if (!string.IsNullOrWhiteSpace(grupo30)) + { + List list11 = (listSinistroAnalitico.Any((Sinistro x) => x.Selecionado) ? (from x in listSinistroAnalitico + where x.Selecionado && x.Seguradora == grupo30 + orderby x.DataSinistro + select x).ToList() : (from x in listSinistroAnalitico + where x.Seguradora == grupo30 + orderby x.DataSinistro + select x).ToList()); + if (list11.Count != 0) + { + string nome11 = grupo30; + agrupamento41 = Agrupamento; + string nome2 = nome11.ValidaNomePlanilha(((object)(Agrupamento)(ref agrupamento41)).ToString()); + workbook = await Funcoes.GerarXls(workbook, nome2, list11, Relatorio); + } + } + } + break; + } + case 1: + { + List agrupamento9 = (from Sinistro x in (IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items + orderby x.Ramo + select x.Ramo).Distinct().ToList(); + if ((agrupamento9.Count == 2 && agrupamento9[0] == null && agrupamento9[1] == "") || (agrupamento9.Count == 1 && agrupamento9[0] == null) || (agrupamento9.Count == 1 && agrupamento9[0] == "")) + { + List analitico11 = (listSinistroAnalitico.Any((Sinistro x) => x.Selecionado) ? listSinistroAnalitico.Where((Sinistro x) => x.Selecionado).ToList() : listSinistroAnalitico); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico11, Relatorio); + break; + } + foreach (string grupo31 in agrupamento9) + { + if (!string.IsNullOrWhiteSpace(grupo31)) + { + List list10 = (listSinistroAnalitico.Any((Sinistro x) => x.Selecionado) ? (from x in listSinistroAnalitico + where x.Selecionado && x.Ramo == grupo31 + orderby x.DataSinistro + select x).ToList() : (from x in listSinistroAnalitico + where x.Ramo == grupo31 + orderby x.DataSinistro + select x).ToList()); + if (list10.Count != 0) + { + string nome10 = grupo31; + agrupamento41 = Agrupamento; + string nome2 = nome10.ValidaNomePlanilha(((object)(Agrupamento)(ref agrupamento41)).ToString()); + workbook = await Funcoes.GerarXls(workbook, nome2, list10, Relatorio); + } + } + } + break; + } + case 2: + { + List agrupamento9 = (from Sinistro x in (IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items + orderby x.Vendedor + select x.Vendedor).Distinct().ToList(); + if ((agrupamento9.Count == 2 && agrupamento9[0] == null && agrupamento9[1] == "") || (agrupamento9.Count == 1 && agrupamento9[0] == null) || (agrupamento9.Count == 1 && agrupamento9[0] == "")) + { + List analitico9 = (listSinistroAnalitico.Any((Sinistro x) => x.Selecionado) ? listSinistroAnalitico.Where((Sinistro x) => x.Selecionado).ToList() : listSinistroAnalitico); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico9, Relatorio); + break; + } + index3 = 1; + foreach (string grupo33 in agrupamento9) + { + if (!string.IsNullOrWhiteSpace(grupo33)) + { + List list8 = (listSinistroAnalitico.Any((Sinistro x) => x.Selecionado) ? (from x in listSinistroAnalitico + where x.Selecionado && x.Vendedor == grupo33 + orderby x.DataSinistro + select x).ToList() : (from x in listSinistroAnalitico + where x.Vendedor == grupo33 + orderby x.DataSinistro + select x).ToList()); + if (list8.Count != 0) + { + string nome8 = grupo33; + agrupamento41 = Agrupamento; + string nome2 = nome8.ValidaNomePlanilha(((object)(Agrupamento)(ref agrupamento41)).ToString(), index3); + workbook = await Funcoes.GerarXls(workbook, nome2, list8, Relatorio); + index3++; + } + } + } + break; + } + case 3: + { + List agrupamento9 = (from Sinistro x in (IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items + orderby x.Estipulante + select x.Estipulante).Distinct().ToList(); + if ((agrupamento9.Count == 2 && agrupamento9[0] == null && agrupamento9[1] == "") || (agrupamento9.Count == 1 && agrupamento9[0] == null) || (agrupamento9.Count == 1 && agrupamento9[0] == "")) + { + List analitico10 = (listSinistroAnalitico.Any((Sinistro x) => x.Selecionado) ? listSinistroAnalitico.Where((Sinistro x) => x.Selecionado).ToList() : listSinistroAnalitico); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico10, Relatorio); + break; + } + index3 = 1; + foreach (string grupo32 in agrupamento9) + { + if (!string.IsNullOrWhiteSpace(grupo32)) + { + List list9 = (listSinistroAnalitico.Any((Sinistro x) => x.Selecionado) ? (from x in listSinistroAnalitico + where x.Selecionado && x.Estipulante == grupo32 + orderby x.DataSinistro + select x).ToList() : (from x in listSinistroAnalitico + where x.Estipulante == grupo32 + orderby x.DataSinistro + select x).ToList()); + if (list9.Count != 0) + { + string nome9 = grupo32; + agrupamento41 = Agrupamento; + string nome2 = nome9.ValidaNomePlanilha(((object)(Agrupamento)(ref agrupamento41)).ToString(), index3); + workbook = await Funcoes.GerarXls(workbook, nome2, list9, Relatorio); + index3++; + } + } + } + break; + } + case 4: + { + List agrupamento9 = (from Sinistro x in (IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items + orderby x.StatusApolice + select EnumHelper.GetDescription(x.StatusSinistro)).Distinct().ToList(); + if ((agrupamento9.Count == 2 && agrupamento9[0] == null && agrupamento9[1] == "") || (agrupamento9.Count == 1 && agrupamento9[0] == null) || (agrupamento9.Count == 1 && agrupamento9[0] == "")) + { + List analitico8 = (listSinistroAnalitico.Any((Sinistro x) => x.Selecionado) ? listSinistroAnalitico.Where((Sinistro x) => x.Selecionado).ToList() : listSinistroAnalitico); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico8, ColunasOcultas); + break; + } + foreach (string grupo34 in agrupamento9) + { + if (!string.IsNullOrWhiteSpace(grupo34)) + { + List list7 = (listSinistroAnalitico.Any((Sinistro x) => x.Selecionado) ? (from x in listSinistroAnalitico + where x.Selecionado && x.StatusApolice == grupo34 + orderby x.DataSinistro + select x).ToList() : (from x in listSinistroAnalitico + where x.StatusApolice == grupo34 + orderby x.DataSinistro + select x).ToList()); + if (list7.Count != 0) + { + string nome7 = grupo34; + agrupamento41 = Agrupamento; + string nome2 = nome7.ValidaNomePlanilha(((object)(Agrupamento)(ref agrupamento41)).ToString()); + workbook = await Funcoes.GerarXls(workbook, nome2, list7, ColunasOcultas); + } + } + } + break; + } + } + break; + } + case 8: + { + List listAuditoria = ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(); + if (AuditoriaFiltrado == null || listAuditoria.Count == 0) + { + return; + } + agrupamento40 = Agrupamento; + switch (agrupamento40 - 1) + { + default: + { + List analitico55 = (listAuditoria.Any((Auditoria x) => x.Selecionado) ? listAuditoria.Where((Auditoria x) => x.Selecionado).ToList() : listAuditoria); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico55, Relatorio); + break; + } + case 0: + { + List agrupamento9 = (from x in listAuditoria + orderby x.Seguradora + select x.Seguradora).Distinct().ToList(); + if ((agrupamento9.Count == 2 && agrupamento9[0] == null && agrupamento9[1] == "") || (agrupamento9.Count == 1 && agrupamento9[0] == null) || (agrupamento9.Count == 1 && agrupamento9[0] == "")) + { + List analitico54 = (listAuditoria.Any((Auditoria x) => x.Selecionado) ? listAuditoria.Where((Auditoria x) => x.Selecionado).ToList() : listAuditoria); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico54, Relatorio); + break; + } + foreach (string grupo in agrupamento9) + { + if (!string.IsNullOrWhiteSpace(grupo)) + { + List list53 = (listAuditoria.Any((Auditoria x) => x.Selecionado) ? (from x in listAuditoria + where x.Selecionado && x.Seguradora == grupo + orderby x.VigenciaInicial + select x).ToList() : (from x in listAuditoria + where x.Seguradora == grupo + orderby x.VigenciaInicial + select x).ToList()); + if (list53.Count != 0) + { + string nome45 = grupo; + agrupamento41 = Agrupamento; + string nome2 = nome45.ValidaNomePlanilha(((object)(Agrupamento)(ref agrupamento41)).ToString()); + workbook = await Funcoes.GerarXls(workbook, nome2, list53, Relatorio); + } + } + } + break; + } + case 1: + { + List agrupamento9 = (from x in listAuditoria + orderby x.Ramo + select x.Ramo).Distinct().ToList(); + if ((agrupamento9.Count == 2 && agrupamento9[0] == null && agrupamento9[1] == "") || (agrupamento9.Count == 1 && agrupamento9[0] == null) || (agrupamento9.Count == 1 && agrupamento9[0] == "")) + { + List analitico53 = (listAuditoria.Any((Auditoria x) => x.Selecionado) ? listAuditoria.Where((Auditoria x) => x.Selecionado).ToList() : listAuditoria); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico53, Relatorio); + break; + } + foreach (string grupo2 in agrupamento9) + { + if (!string.IsNullOrWhiteSpace(grupo2)) + { + List list52 = (listAuditoria.Any((Auditoria x) => x.Selecionado) ? (from x in listAuditoria + where x.Selecionado && x.Ramo == grupo2 + orderby x.VigenciaInicial + select x).ToList() : (from x in listAuditoria + where x.Ramo == grupo2 + orderby x.VigenciaInicial + select x).ToList()); + if (list52.Count != 0) + { + string nome44 = grupo2; + agrupamento41 = Agrupamento; + string nome2 = nome44.ValidaNomePlanilha(((object)(Agrupamento)(ref agrupamento41)).ToString()); + workbook = await Funcoes.GerarXls(workbook, nome2, list52, Relatorio); + } + } + } + break; + } + case 2: + { + List agrupamento9 = (from x in listAuditoria + orderby x.Vendedor + select x.Vendedor).Distinct().ToList(); + if ((agrupamento9.Count == 2 && agrupamento9[0] == null && agrupamento9[1] == "") || (agrupamento9.Count == 1 && agrupamento9[0] == null) || (agrupamento9.Count == 1 && agrupamento9[0] == "")) + { + List analitico51 = (listAuditoria.Any((Auditoria x) => x.Selecionado) ? listAuditoria.Where((Auditoria x) => x.Selecionado).ToList() : listAuditoria); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico51, Relatorio); + break; + } + index3 = 1; + foreach (string grupo4 in agrupamento9) + { + if (!string.IsNullOrWhiteSpace(grupo4)) + { + List list50 = (listAuditoria.Any((Auditoria x) => x.Selecionado) ? (from x in listAuditoria + where x.Selecionado && x.Vendedor == grupo4 + orderby x.VigenciaInicial + select x).ToList() : (from x in listAuditoria + where x.Vendedor == grupo4 + orderby x.VigenciaInicial + select x).ToList()); + if (list50.Count != 0) + { + string nome42 = grupo4; + agrupamento41 = Agrupamento; + string nome2 = nome42.ValidaNomePlanilha(((object)(Agrupamento)(ref agrupamento41)).ToString(), index3); + workbook = await Funcoes.GerarXls(workbook, nome2, list50, Relatorio); + index3++; + } + } + } + break; + } + case 3: + { + List agrupamento9 = (from x in listAuditoria + orderby x.Estipulante + select x.Estipulante).Distinct().ToList(); + if ((agrupamento9.Count == 2 && agrupamento9[0] == null && agrupamento9[1] == "") || (agrupamento9.Count == 1 && agrupamento9[0] == null) || (agrupamento9.Count == 1 && agrupamento9[0] == "")) + { + List analitico52 = (listAuditoria.Any((Auditoria x) => x.Selecionado) ? listAuditoria.Where((Auditoria x) => x.Selecionado).ToList() : listAuditoria); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico52, Relatorio); + break; + } + index3 = 1; + foreach (string grupo3 in agrupamento9) + { + if (!string.IsNullOrWhiteSpace(grupo3)) + { + List list51 = (listAuditoria.Any((Auditoria x) => x.Selecionado) ? (from x in listAuditoria + where x.Selecionado && x.Estipulante == grupo3 + orderby x.VigenciaInicial + select x).ToList() : (from x in listAuditoria + where x.Estipulante == grupo3 + orderby x.VigenciaInicial + select x).ToList()); + if (list51.Count != 0) + { + string nome43 = grupo3; + agrupamento41 = Agrupamento; + string nome2 = nome43.ValidaNomePlanilha(((object)(Agrupamento)(ref agrupamento41)).ToString(), index3); + workbook = await Funcoes.GerarXls(workbook, nome2, list51, Relatorio); + index3++; + } + } + } + break; + } + case 4: + { + List agrupamento9 = (from x in listAuditoria + orderby x.Status + select x.Status).Distinct().ToList(); + if ((agrupamento9.Count == 2 && agrupamento9[0] == null && agrupamento9[1] == "") || (agrupamento9.Count == 1 && agrupamento9[0] == null) || (agrupamento9.Count == 1 && agrupamento9[0] == "")) + { + List analitico50 = (listAuditoria.Any((Auditoria x) => x.Selecionado) ? listAuditoria.Where((Auditoria x) => x.Selecionado).ToList() : listAuditoria); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico50, ColunasOcultas); + break; + } + foreach (string grupo5 in agrupamento9) + { + if (!string.IsNullOrWhiteSpace(grupo5)) + { + List list49 = (listAuditoria.Any((Auditoria x) => x.Selecionado) ? (from x in listAuditoria + where x.Selecionado && x.Status == grupo5 + orderby x.VigenciaInicial + select x).ToList() : (from x in listAuditoria + where x.Status == grupo5 + orderby x.VigenciaInicial + select x).ToList()); + if (list49.Count != 0) + { + string nome41 = grupo5; + agrupamento41 = Agrupamento; + string nome2 = nome41.ValidaNomePlanilha(((object)(Agrupamento)(ref agrupamento41)).ToString()); + workbook = await Funcoes.GerarXls(workbook, nome2, list49, ColunasOcultas); + } + } + } + break; + } + } + break; + } + case 12: + { + List list24 = ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(); + if (FaturaPendenteFiltrado == null || list24.Count == 0) + { + return; + } + List analitico28 = (list24.Any((FaturaPendente x) => x.Selecionado) ? list24.Where((FaturaPendente x) => x.Selecionado).ToList() : list24); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico28, Relatorio); + break; + } + case 14: + { + List list22 = ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(); + if (MetaSeguradoraFiltrado == null || list22.Count == 0) + { + return; + } + List analitico26 = (list22.Any((MetaSeguradoraRelatorio x) => x.Selecionado) ? list22.Where((MetaSeguradoraRelatorio x) => x.Selecionado).ToList() : list22); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico26, Relatorio); + break; + } + case 15: + { + List list55 = ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(); + if (MetaVendedorFiltrado == null || list55.Count == 0) + { + return; + } + List analitico57 = (list55.Any((MetaVendedorRelatorio x) => x.Selecionado) ? list55.Where((MetaVendedorRelatorio x) => x.Selecionado).ToList() : list55); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico57, Relatorio); + break; + } + case 11: + { + List list30 = new List(); + if ((GridRelatorio)Report != null) + { + list30 = ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(); + } + if (FechamentoFiltrado == null || (list30.Count == 0 && (GridRelatorio)Report != null)) + { + return; + } + index3 = 1; + foreach (Fechamentos item4 in Fechamento) + { + string title = item4.Title; + agrupamento40 = Agrupamento; + string nome27 = title.ValidaNomePlanilha(((object)(Agrupamento)(ref agrupamento40)).ToString(), index3); + workbook = await Funcoes.GerarXls(workbook, nome27, item4.Fechamento.ToList(), Relatorio); + index3++; + } + break; + } + case 13: + { + List list46 = ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(); + if (ExtratosFiltrado == null || list46.Count == 0) + { + return; + } + List analitico47 = (list46.Any((ExtratoBaixadoRelatorio x) => x.Selecionado) ? list46.Where((ExtratoBaixadoRelatorio x) => x.Selecionado).ToList() : list46); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico47, Relatorio); + break; + } + case 20: + { + if (PrevisaoFiltrado == null) + { + return; + } + List list36 = PrevisaoSintetico.OrderByDescending((PrevisaoPagamentoComissaoSintetico x) => x.Titulo).ToList(); + foreach (PrevisaoPagamentoComissaoSintetico item5 in list36) + { + string titulo = item5.Titulo; + agrupamento40 = Agrupamento; + string nome32 = titulo.ValidaNomePlanilha(((object)(Agrupamento)(ref agrupamento40)).ToString()); + workbook = await Funcoes.GerarXls(workbook, nome32, item5.Agrupamento.ToList(), Relatorio, verificarColunas: false); + } + index3 = 1; + foreach (PrevisaoPagamentoComissao item6 in Previsao) + { + string vendedor = item6.Vendedor; + agrupamento40 = Agrupamento; + string nome33 = vendedor.ValidaNomePlanilha(((object)(Agrupamento)(ref agrupamento40)).ToString(), index3); + workbook = await Funcoes.GerarXls(workbook, nome33, item6.PrevisaoPagamento.ToList(), Relatorio); + index3++; + } + break; + } + case 23: + { + List list54 = ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(); + if (LogsEnvioFiltrado == null || list54.Count == 0) + { + return; + } + List analitico56 = (list54.Any((LogsEnvio x) => x.Selecionado) ? list54.Where((LogsEnvio x) => x.Selecionado).ToList() : list54); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico56, Relatorio); + break; + } + case 24: + case 25: + { + List list35 = ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(); + if (LogUtilizacaoFiltrado == null || list35.Count == 0) + { + return; + } + List analitico39 = (list35.Any((LogAcaoRelatorio x) => x.Selecionado) ? list35.Where((LogAcaoRelatorio x) => x.Selecionado).ToList() : list35); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico39, Relatorio); + break; + } + case 26: + { + List list57 = ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(); + if (ApoliceCriticaFiltrado == null || list57.Count == 0) + { + return; + } + List analitico59 = (list57.Any((ApoliceCritica x) => x.Selecionado) ? list57.Where((ApoliceCritica x) => x.Selecionado).ToList() : list57); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico59, Relatorio); + break; + } + case 28: + { + List list37 = ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(); + if (EndossoFiltrado == null || list37.Count == 0) + { + return; + } + List analitico40 = (list37.Any((Endosso x) => x.Selecionado) ? list37.Where((Endosso x) => x.Selecionado).ToList() : list37); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico40, Relatorio); + break; + } + case 27: + { + List listPlaca = ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(); + if (PlacaFiltrado == null || listPlaca.Count == 0) + { + return; + } + agrupamento40 = Agrupamento; + switch (agrupamento40 - 1) + { + default: + { + List analitico38 = (listPlaca.Any((Placas x) => x.Selecionado) ? listPlaca.Where((Placas x) => x.Selecionado).ToList() : listPlaca); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico38, Relatorio); + break; + } + case 0: + { + List agrupamento9 = (from x in listPlaca + orderby x.Seguradora + select x.Seguradora).Distinct().ToList(); + if ((agrupamento9.Count == 2 && agrupamento9[0] == null && agrupamento9[1] == "") || (agrupamento9.Count == 1 && agrupamento9[0] == null) || (agrupamento9.Count == 1 && agrupamento9[0] == "")) + { + List analitico36 = (listPlaca.Any((Placas x) => x.Selecionado) ? listPlaca.Where((Placas x) => x.Selecionado).ToList() : listPlaca); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico36, Relatorio); + break; + } + foreach (string grupo12 in agrupamento9) + { + if (!string.IsNullOrWhiteSpace(grupo12)) + { + List list33 = (listPlaca.Any((Placas x) => x.Selecionado) ? listPlaca.Where((Placas x) => x.Selecionado && x.Seguradora == grupo12).ToList() : listPlaca.Where((Placas x) => x.Seguradora == grupo12).ToList()); + if (list33.Count != 0) + { + string nome30 = grupo12; + agrupamento41 = Agrupamento; + string nome2 = nome30.ValidaNomePlanilha(((object)(Agrupamento)(ref agrupamento41)).ToString()); + workbook = await Funcoes.GerarXls(workbook, nome2, list33, Relatorio); + } + } + } + break; + } + case 1: + { + List agrupamento9 = (from x in listPlaca + orderby x.Ramo + select x.Ramo).Distinct().ToList(); + if ((agrupamento9.Count == 2 && agrupamento9[0] == null && agrupamento9[1] == "") || (agrupamento9.Count == 1 && agrupamento9[0] == null) || (agrupamento9.Count == 1 && agrupamento9[0] == "")) + { + List analitico35 = (listPlaca.Any((Placas x) => x.Selecionado) ? listPlaca.Where((Placas x) => x.Selecionado).ToList() : listPlaca); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico35, Relatorio); + break; + } + foreach (string grupo13 in agrupamento9) + { + if (!string.IsNullOrWhiteSpace(grupo13)) + { + List list32 = (listPlaca.Any((Placas x) => x.Selecionado) ? listPlaca.Where((Placas x) => x.Selecionado && x.Ramo == grupo13).ToList() : listPlaca.Where((Placas x) => x.Ramo == grupo13).ToList()); + if (list32.Count != 0) + { + string nome29 = grupo13; + agrupamento41 = Agrupamento; + string nome2 = nome29.ValidaNomePlanilha(((object)(Agrupamento)(ref agrupamento41)).ToString()); + workbook = await Funcoes.GerarXls(workbook, nome2, list32, Relatorio); + } + } + } + break; + } + case 2: + { + List agrupamento9 = (from x in listPlaca + orderby x.Vendedor + select x.Vendedor).Distinct().ToList(); + if ((agrupamento9.Count == 2 && agrupamento9[0] == null && agrupamento9[1] == "") || (agrupamento9.Count == 1 && agrupamento9[0] == null) || (agrupamento9.Count == 1 && agrupamento9[0] == "")) + { + List analitico37 = (listPlaca.Any((Placas x) => x.Selecionado) ? listPlaca.Where((Placas x) => x.Selecionado).ToList() : listPlaca); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico37, Relatorio); + break; + } + index3 = 1; + foreach (string grupo11 in agrupamento9) + { + if (!string.IsNullOrWhiteSpace(grupo11)) + { + List list34 = (listPlaca.Any((Placas x) => x.Selecionado) ? listPlaca.Where((Placas x) => x.Selecionado && x.Vendedor == grupo11).ToList() : listPlaca.Where((Placas x) => x.Vendedor == grupo11).ToList()); + if (list34.Count != 0) + { + string nome31 = grupo11; + agrupamento41 = Agrupamento; + string nome2 = nome31.ValidaNomePlanilha(((object)(Agrupamento)(ref agrupamento41)).ToString(), index3); + workbook = await Funcoes.GerarXls(workbook, nome2, list34, Relatorio); + index3++; + } + } + } + break; + } + case 3: + { + List agrupamento9 = (from x in listPlaca + orderby x.Estipulante + select x.Estipulante).Distinct().ToList(); + if ((agrupamento9.Count == 2 && agrupamento9[0] == null && agrupamento9[1] == "") || (agrupamento9.Count == 1 && agrupamento9[0] == null) || (agrupamento9.Count == 1 && agrupamento9[0] == "")) + { + List analitico34 = (listPlaca.Any((Placas x) => x.Selecionado) ? listPlaca.Where((Placas x) => x.Selecionado).ToList() : listPlaca); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico34, Relatorio); + break; + } + index3 = 1; + foreach (string grupo14 in agrupamento9) + { + if (!string.IsNullOrWhiteSpace(grupo14)) + { + List list31 = (listPlaca.Any((Placas x) => x.Selecionado) ? listPlaca.Where((Placas x) => x.Selecionado && x.Estipulante == grupo14).ToList() : listPlaca.Where((Placas x) => x.Estipulante == grupo14).ToList()); + if (list31.Count != 0) + { + string nome28 = grupo14; + agrupamento41 = Agrupamento; + string nome2 = nome28.ValidaNomePlanilha(((object)(Agrupamento)(ref agrupamento41)).ToString(), index3); + workbook = await Funcoes.GerarXls(workbook, nome2, list31, Relatorio); + index3++; + } + } + } + break; + } + } + break; + } + case 29: + { + List list = ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList(); + if (ClassificacaoFiltrado == null || list.Count == 0) + { + return; + } + List analitico = (list.Any((Classificacao x) => x.Selecionado) ? list.Where((Classificacao x) => x.Selecionado).ToList() : list); + workbook = await Funcoes.GerarXls(workbook, "ANALÍTICO", analitico, Relatorio); + break; + } + } + if (SinteticoRelatorio != null && SinteticoRelatorio.Count > 0) + { + workbook = await Funcoes.GerarXlsSintetico(workbook, "SINTÉTICO", Sintetic.ToList()); + } + if (FiltroRelatorioSelecionado != null && FiltroRelatorioSelecionado.Count > 0) + { + workbook = await Funcoes.GerarXls(workbook, "FILTROS", FiltroRelatorioSelecionado.ToList(), ColunasOcultas); + } + RegistrarAcao($"EMITIU EXCEL DO RELATÓRIO PERÍODO ENTRE {Inicio:d} E {Fim:d}", Relatorio, Filtros); + workbook.SaveAs(fileName); + Process.Start(fileName); + } + + public void Bind() + { + //IL_002d: Unknown result type (might be due to invalid IL or missing references) + //IL_0032: Unknown result type (might be due to invalid IL or missing references) + //IL_0033: Unknown result type (might be due to invalid IL or missing references) + //IL_00b1: Expected I4, but got Unknown + ((GridRelatorio)Report).DataGrid.CancelEdit(); + ((GridRelatorio)Report).DataGrid.CancelEdit(); + Relatorio relatorio = Relatorio; + switch ((int)relatorio) + { + case 0: + case 1: + ((ItemsControl)((GridRelatorio)Report).DataGrid).ItemsSource = ClientesAtivosInativosFiltrado; + ((GridRelatorio)Report).SinteticoGrid.ItemsSource = Sintetic; + break; + case 17: + ((ItemsControl)((GridRelatorio)Report).DataGrid).ItemsSource = LicenciamentoFiltrado; + ((GridRelatorio)Report).SinteticoGrid.ItemsSource = Sintetic; + break; + case 27: + ((ItemsControl)((GridRelatorio)Report).DataGrid).ItemsSource = PlacaFiltrado; + ((GridRelatorio)Report).SinteticoGrid.ItemsSource = Sintetic; + break; + case 18: + ((ItemsControl)((GridRelatorio)Report).DataGrid).ItemsSource = TarefaFiltrado; + ((GridRelatorio)Report).SinteticoGrid.ItemsSource = Sintetic; + break; + case 3: + ((ItemsControl)((GridRelatorio)Report).DataGrid).ItemsSource = ApolicePendenteFiltrado; + ((GridRelatorio)Report).SinteticoGrid.ItemsSource = Sintetic; + break; + case 12: + ((ItemsControl)((GridRelatorio)Report).DataGrid).ItemsSource = FaturaPendenteFiltrado; + ((GridRelatorio)Report).SinteticoGrid.ItemsSource = Sintetic; + break; + case 2: + ((ItemsControl)((GridRelatorio)Report).DataGrid).ItemsSource = ProducaoFiltrado; + ((GridRelatorio)Report).SinteticoGrid.ItemsSource = Sintetic; + break; + case 4: + ((ItemsControl)((GridRelatorio)Report).DataGrid).ItemsSource = RenovacaoFiltrado; + ((GridRelatorio)Report).SinteticoGrid.ItemsSource = Sintetic; + break; + case 5: + ((ItemsControl)((GridRelatorio)Report).DataGrid).ItemsSource = ComissaoFiltrado; + ((GridRelatorio)Report).SinteticoGrid.ItemsSource = Sintetic; + break; + case 6: + case 16: + ((ItemsControl)((GridRelatorio)Report).DataGrid).ItemsSource = PendenteFiltrado; + ((GridRelatorio)Report).SinteticoGrid.ItemsSource = Sintetic; + break; + case 9: + case 10: + ((ItemsControl)((GridRelatorio)Report).DataGrid).ItemsSource = SinistroFiltrado; + ((GridRelatorio)Report).SinteticoGrid.ItemsSource = Sintetic; + break; + case 13: + ((ItemsControl)((GridRelatorio)Report).DataGrid).ItemsSource = ExtratosFiltrado; + ((GridRelatorio)Report).SinteticoGrid.ItemsSource = Sintetic; + break; + case 14: + ((ItemsControl)((GridRelatorio)Report).DataGrid).ItemsSource = MetaSeguradoraFiltrado; + ((GridRelatorio)Report).SinteticoGrid.ItemsSource = Sintetic; + break; + case 15: + ((ItemsControl)((GridRelatorio)Report).DataGrid).ItemsSource = MetaVendedorFiltrado; + ((GridRelatorio)Report).SinteticoGrid.ItemsSource = Sintetic; + break; + case 19: + ((ItemsControl)((GridRelatorio)Report).DataGrid).ItemsSource = NotaFiscalFiltrado; + ((GridRelatorio)Report).SinteticoGrid.ItemsSource = Sintetic; + break; + case 23: + ((ItemsControl)((GridRelatorio)Report).DataGrid).ItemsSource = LogsEnvioFiltrado; + ((GridRelatorio)Report).SinteticoGrid.ItemsSource = Sintetic; + break; + case 24: + case 25: + ((ItemsControl)((GridRelatorio)Report).DataGrid).ItemsSource = LogUtilizacaoFiltrado; + ((GridRelatorio)Report).SinteticoGrid.ItemsSource = Sintetic; + break; + case 8: + ((ItemsControl)((GridRelatorio)Report).DataGrid).ItemsSource = AuditoriaFiltrado; + ((GridRelatorio)Report).SinteticoGrid.ItemsSource = Sintetic; + break; + case 28: + ((ItemsControl)((GridRelatorio)Report).DataGrid).ItemsSource = EndossoFiltrado; + ((GridRelatorio)Report).SinteticoGrid.ItemsSource = Sintetic; + break; + case 26: + ((ItemsControl)((GridRelatorio)Report).DataGrid).ItemsSource = ApoliceCriticaFiltrado; + ((GridRelatorio)Report).SinteticoGrid.ItemsSource = Sintetic; + break; + case 29: + ((ItemsControl)((GridRelatorio)Report).DataGrid).ItemsSource = ClassificacaoFiltrado; + ((GridRelatorio)Report).SinteticoGrid.ItemsSource = Sintetic; + break; + case 7: + case 11: + case 20: + case 21: + case 22: + break; + } + } + + public async Task Selecionar() + { + await Task.Run(delegate + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Unknown result type (might be due to invalid IL or missing references) + //IL_0085: Expected I4, but got Unknown + Relatorio relatorio = Relatorio; + switch ((int)relatorio) + { + case 0: + case 1: + if (ClientesAtivosInativosFiltrado == null || ClientesAtivosInativosFiltrado.Count == 0) + { + return; + } + ClientesAtivosInativosFiltrado.ToList().ForEach(delegate(ClientesAtivosInativos x) + { + x.Selecionado = !x.Selecionado; + }); + ClientesAtivosInativosFiltrado = new ObservableCollection(ClientesAtivosInativosFiltrado); + break; + case 17: + if (LicenciamentoFiltrado == null || LicenciamentoFiltrado.Count == 0) + { + return; + } + LicenciamentoFiltrado.ToList().ForEach(delegate(Licenciamento x) + { + x.Selecionado = !x.Selecionado; + }); + LicenciamentoFiltrado = new ObservableCollection(LicenciamentoFiltrado); + break; + case 18: + if (TarefaFiltrado == null || TarefaFiltrado.Count == 0) + { + return; + } + TarefaFiltrado.ToList().ForEach(delegate(Tarefa x) + { + x.Selecionado = !x.Selecionado; + }); + TarefaFiltrado = new ObservableCollection(TarefaFiltrado); + break; + case 3: + if (ApolicePendenteFiltrado == null || ApolicePendenteFiltrado.Count == 0) + { + return; + } + ApolicePendenteFiltrado.ToList().ForEach(delegate(ApolicePendente x) + { + x.Selecionado = !x.Selecionado; + }); + ApolicePendenteFiltrado = new ObservableCollection(ApolicePendenteFiltrado); + break; + case 12: + if (FaturaPendenteFiltrado == null || FaturaPendenteFiltrado.Count == 0) + { + return; + } + FaturaPendenteFiltrado.ToList().ForEach(delegate(FaturaPendente x) + { + x.Selecionado = !x.Selecionado; + }); + FaturaPendenteFiltrado = new ObservableCollection(FaturaPendenteFiltrado); + break; + case 2: + if (ProducaoFiltrado == null || ProducaoFiltrado.Count == 0) + { + return; + } + ProducaoFiltrado.ToList().ForEach(delegate(Producao x) + { + x.Selecionado = !x.Selecionado; + }); + ProducaoFiltrado = new ObservableCollection(ProducaoFiltrado); + break; + case 4: + if (RenovacaoFiltrado == null || RenovacaoFiltrado.Count == 0) + { + return; + } + RenovacaoFiltrado.ToList().ForEach(delegate(Renovacao x) + { + x.Selecionado = !x.Selecionado; + }); + RenovacaoFiltrado = new ObservableCollection(RenovacaoFiltrado); + break; + case 5: + if (ComissaoFiltrado == null || ComissaoFiltrado.Count == 0) + { + return; + } + ComissaoFiltrado.ToList().ForEach(delegate(Comissao x) + { + x.Selecionado = !x.Selecionado; + }); + ComissaoFiltrado = new ObservableCollection(ComissaoFiltrado); + break; + case 6: + case 16: + if (PendenteFiltrado == null || PendenteFiltrado.Count == 0) + { + return; + } + PendenteFiltrado.ToList().ForEach(delegate(Pendente x) + { + x.Selecionado = !x.Selecionado; + }); + PendenteFiltrado = new ObservableCollection(PendenteFiltrado); + break; + case 9: + case 10: + if (SinistroFiltrado == null || SinistroFiltrado.Count == 0) + { + return; + } + SinistroFiltrado.ToList().ForEach(delegate(Sinistro x) + { + x.Selecionado = !x.Selecionado; + }); + SinistroFiltrado = new ObservableCollection(SinistroFiltrado); + break; + case 13: + if (ExtratosFiltrado == null || ExtratosFiltrado.Count == 0) + { + return; + } + ExtratosFiltrado.ToList().ForEach(delegate(ExtratoBaixadoRelatorio x) + { + x.Selecionado = !x.Selecionado; + }); + ExtratosFiltrado = new ObservableCollection(ExtratosFiltrado); + break; + case 14: + if (MetaSeguradoraFiltrado == null || MetaSeguradoraFiltrado.Count == 0) + { + return; + } + MetaSeguradoraFiltrado.ToList().ForEach(delegate(MetaSeguradoraRelatorio x) + { + x.Selecionado = !x.Selecionado; + }); + MetaSeguradoraFiltrado = new ObservableCollection(MetaSeguradoraFiltrado); + break; + case 15: + if (MetaVendedorFiltrado == null || MetaVendedorFiltrado.Count == 0) + { + return; + } + MetaVendedorFiltrado.ToList().ForEach(delegate(MetaVendedorRelatorio x) + { + x.Selecionado = !x.Selecionado; + }); + MetaVendedorFiltrado = new ObservableCollection(MetaVendedorFiltrado); + break; + case 19: + if (NotaFiscalFiltrado == null || NotaFiscalFiltrado.Count == 0) + { + return; + } + NotaFiscalFiltrado.ToList().ForEach(delegate(NotaFiscalRelatorio x) + { + x.Selecionado = !x.Selecionado; + }); + NotaFiscalFiltrado = new ObservableCollection(NotaFiscalFiltrado); + break; + case 23: + if (LogsEnvioFiltrado == null || LogsEnvioFiltrado.Count == 0) + { + return; + } + LogsEnvioFiltrado.ToList().ForEach(delegate(LogsEnvio x) + { + x.Selecionado = !x.Selecionado; + }); + LogsEnvioFiltrado = new ObservableCollection(LogsEnvioFiltrado); + break; + case 24: + case 25: + if (LogUtilizacaoFiltrado == null || LogUtilizacaoFiltrado.Count == 0) + { + return; + } + LogUtilizacaoFiltrado.ToList().ForEach(delegate(LogAcaoRelatorio x) + { + x.Selecionado = !x.Selecionado; + }); + LogUtilizacaoFiltrado = new ObservableCollection(LogUtilizacaoFiltrado); + break; + case 8: + if (AuditoriaFiltrado == null || AuditoriaFiltrado.Count == 0) + { + return; + } + AuditoriaFiltrado.ToList().ForEach(delegate(Auditoria x) + { + x.Selecionado = !x.Selecionado; + }); + AuditoriaFiltrado = new ObservableCollection(AuditoriaFiltrado); + break; + case 28: + if (EndossoFiltrado == null || EndossoFiltrado.Count == 0) + { + return; + } + EndossoFiltrado.ToList().ForEach(delegate(Endosso x) + { + x.Selecionado = !x.Selecionado; + }); + EndossoFiltrado = new ObservableCollection(EndossoFiltrado); + break; + case 27: + if (PlacaFiltrado == null || PlacaFiltrado.Count == 0) + { + return; + } + PlacaFiltrado.ToList().ForEach(delegate(Placas x) + { + x.Selecionado = !x.Selecionado; + }); + PlacaFiltrado = new ObservableCollection(PlacaFiltrado); + break; + case 26: + if (ApoliceCriticaFiltrado == null || ApoliceCriticaFiltrado.Count == 0) + { + return; + } + ApoliceCriticaFiltrado.ToList().ForEach(delegate(ApoliceCritica x) + { + x.Selecionado = !x.Selecionado; + }); + ApoliceCriticaFiltrado = new ObservableCollection(ApoliceCriticaFiltrado); + break; + case 29: + if (ClassificacaoFiltrado == null || ClassificacaoFiltrado.Count == 0) + { + return; + } + ClassificacaoFiltrado.ToList().ForEach(delegate(Classificacao x) + { + x.Selecionado = !x.Selecionado; + }); + ClassificacaoFiltrado = new ObservableCollection(ClassificacaoFiltrado); + break; + } + Dispatcher dispatcher = ((DispatcherObject)Application.Current).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)4, (Delegate)new Action(Bind)); + } + }); + } + + public async Task Acompanhamento() + { + if (RenovacaoFiltrado == null || RenovacaoFiltrado.Count == 0 || RenovacaoFiltrado.All((Renovacao x) => !x.Selecionado)) + { + await ShowMessage("NECESSÁRIO SELECIONAR AO MENOS UM ITEM NA LISTA PARA GERAR O ACOMPANHAMENTO."); + return; + } + Trilha trilha2 = new Trilha + { + Ativo = true, + Titulo = "ACOMPANHAMENTO DE RENOVAÇÃO", + Tipo = (TipoTrilha)0, + Fases = new List + { + new Fase + { + Titulo = "A RENOVAR" + }, + new Fase + { + Titulo = "EM RENOVAÇÃO" + }, + new Fase + { + Titulo = "RENOVADOS" + }, + new Fase + { + Titulo = "PERDIDOS" + } + } + }; + trilha2 = await SalvarTrilha(trilha2); + if (trilha2 == null) + { + return; + } + List tarefas = await new TarefaServico().BuscarTarefas(((DomainBase)trilha2).Id); + foreach (Renovacao r in RenovacaoFiltrado.Where((Renovacao x) => x.Selecionado)) + { + if (!tarefas.Any((Tarefa x) => x.IdEntidade == ((DomainBase)r.Documento).Id)) + { + Tarefa val = new Tarefa(); + val.Entidade = (TipoTarefa)0; + val.IdEntidade = ((DomainBase)r.Documento).Id; + val.IdCliente = ((DomainBase)r.Documento.Controle.Cliente).Id; + val.Cliente = r.Cliente; + val.Titulo = "APÓLICE NÚMERO " + r.Apolice; + val.Usuario = Recursos.Usuario; + val.Agendamento = Funcoes.GetNetworkTime(); + val.Trilha = trilha2; + val.Fase = trilha2.Fases.First(); + val.Referencia = $"VIGÊNCIA FINAL: {r.VigenciaFinal}\nSEGURADORA: {r.Seguradora}\nRAMO: {r.Ramo}\nITEM: {r.Item}"; + Tarefa tarefa = val; + await new TarefaServico().Salvar(tarefa); + } + } + if (Funcoes.IsWindowOpen("ACOMPANHAMENTO DE RENOVAÇÃO")) + { + Funcoes.Destroy("ACOMPANHAMENTO DE RENOVAÇÃO"); + } + ((Window)new HosterWindow((ContentControl)(object)new AcompanhamentoView(), "ACOMPANHAMENTO DE RENOVAÇÃO", 910.0, 600.0, canMaximize: true)).Show(); + } + + public async Task SalvarTrilha(Trilha destino) + { + List fases2 = destino.Fases; + TarefaServico servico = new TarefaServico(); + List source = await servico.BuscarTrilhas(); + if (source.Any((Trilha x) => x.Tipo == destino.Tipo)) + { + Trilha trilhaExistente = source.First((Trilha x) => x.Tipo == destino.Tipo); + Trilha val = trilhaExistente; + val.Fases = await servico.BuscarFases(((DomainBase)trilhaExistente).Id); + return trilhaExistente; + } + Trilha trilha = await servico.Salvar(destino); + if (!servico.Sucesso) + { + return null; + } + fases2.ForEach(delegate(Fase x) + { + x.Trilha = trilha; + }); + fases2 = await servico.Salvar(fases2); + if (!servico.Sucesso) + { + return null; + } + trilha.Fases = fases2; + return trilha; + } + + public async Task SalvarTarefas(List tarefas) + { + await new TarefaServico().Salvar(tarefas); + } + + public List GerarTarefas(Tarefa tarefa) + { + //IL_0025: Unknown result type (might be due to invalid IL or missing references) + //IL_002a: Unknown result type (might be due to invalid IL or missing references) + //IL_002c: Unknown result type (might be due to invalid IL or missing references) + //IL_007b: Expected I4, but got Unknown + List list = new List(); + Usuario usuario = tarefa.Usuario; + Relatorio relatorio = Relatorio; + switch ((int)relatorio) + { + case 17: + if (LicenciamentoFiltrado == null || LicenciamentoFiltrado.Count == 0 || !LicenciamentoFiltrado.Any((Licenciamento x) => x.Selecionado)) + { + return null; + } + return LicenciamentoFiltrado.Where((Licenciamento x) => x.Selecionado).Select((Func)((Licenciamento x) => new Tarefa + { + Entidade = (TipoTarefa)2, + IdEntidade = ((DomainBase)x.Documento.Controle.Cliente).Id, + Agendamento = tarefa.Agendamento, + Titulo = tarefa.Titulo, + Descricao = tarefa.Anotacoes, + Usuario = usuario, + UsuarioCadastro = Recursos.Usuario, + Cliente = x.Cliente, + IdCliente = ((DomainBase)x.Documento.Controle.Cliente).Id, + Referencia = "VENCIMENTO CRLV " + x.Placa + " - ITEM " + x.Item, + Responsaveis = tarefa.Responsaveis + })).ToList(); + case 9: + case 10: + if (SinistroFiltrado == null || SinistroFiltrado.Count == 0 || !SinistroFiltrado.Any((Sinistro x) => x.Selecionado)) + { + return null; + } + return SinistroFiltrado.Where((Sinistro x) => x.Selecionado).Select((Func)((Sinistro x) => new Tarefa + { + Entidade = (TipoTarefa)4, + IdEntidade = ((DomainBase)x.EntidadeSinistro).Id, + Agendamento = tarefa.Agendamento, + Titulo = tarefa.Titulo, + Descricao = tarefa.Anotacoes, + Usuario = usuario, + UsuarioCadastro = Recursos.Usuario, + Cliente = x.Nome, + IdCliente = ((DomainBase)x.EntidadeSinistro.ControleSinistro.Item.Documento.Controle.Cliente).Id, + Referencia = "SINISTRO " + x.NumeroSinistro + " - ITEM " + x.Item, + Responsaveis = tarefa.Responsaveis + })).ToList(); + case 5: + if (ComissaoFiltrado == null || ComissaoFiltrado.Count == 0 || !ComissaoFiltrado.Any((Comissao x) => x.Selecionado)) + { + return null; + } + return ComissaoFiltrado.Where((Comissao x) => x.Selecionado).Select(delegate(Comissao x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Expected O, but got Unknown + Tarefa val = new Tarefa(); + val.Entidade = (TipoTarefa)3; + val.IdEntidade = ((DomainBase)x.ParcelaEntity).Id; + val.Agendamento = tarefa.Agendamento; + val.Titulo = tarefa.Titulo; + val.Descricao = tarefa.Anotacoes; + val.Usuario = usuario; + val.UsuarioCadastro = Recursos.Usuario; + val.Cliente = x.Documento.Controle.Cliente.Nome; + val.IdCliente = ((DomainBase)x.Documento.Controle.Cliente).Id; + val.Referencia = ((x.Documento.Tipo == 0 && !string.IsNullOrWhiteSpace(x.Documento.Apolice)) ? ("PARCELA " + x.Parcela + " DA APÓLICE " + x.Documento.Apolice) : ((x.Documento.Tipo > 0) ? ("PARCELA " + x.Parcela + " DA APÓLICE " + x.Documento.Apolice + " ENDOSSO " + x.Documento.Endosso) : ("PARCELA " + x.Parcela + " DA PROPOSTA " + x.Documento.Proposta))); + val.Responsaveis = tarefa.Responsaveis; + return val; + }).ToList(); + case 6: + case 16: + if (PendenteFiltrado == null || PendenteFiltrado.Count == 0 || !PendenteFiltrado.Any((Pendente x) => x.Selecionado)) + { + return null; + } + return PendenteFiltrado.Where((Pendente x) => x.Selecionado).Select((Func)((Pendente x) => new Tarefa + { + Entidade = (TipoTarefa)3, + IdEntidade = ((DomainBase)x.ParcelaEntity).Id, + Agendamento = tarefa.Agendamento, + Titulo = tarefa.Titulo, + Descricao = tarefa.Anotacoes, + Usuario = usuario, + UsuarioCadastro = Recursos.Usuario, + Cliente = x.Documento.Controle.Cliente.Nome, + IdCliente = ((DomainBase)x.Documento.Controle.Cliente).Id, + Referencia = ((x.Documento.Tipo == 0 && !string.IsNullOrWhiteSpace(x.Documento.Apolice)) ? $"PARCELA {x.ParcelaEntity.NumeroParcela} DA APÓLICE {x.Documento.Apolice}" : ((x.Documento.Tipo > 0) ? $"PARCELA {x.ParcelaEntity.NumeroParcela} DA APÓLICE {x.Documento.Apolice} ENDOSSO {x.Documento.Endosso}" : $"PARCELA {x.ParcelaEntity.NumeroParcela} DA PROPOSTA {x.Documento.Proposta}")), + Responsaveis = tarefa.Responsaveis + })).ToList(); + case 1: + if (ClientesAtivosInativosFiltrado == null || ClientesAtivosInativosFiltrado.Count == 0 || !ClientesAtivosInativosFiltrado.Any((ClientesAtivosInativos x) => x.Selecionado)) + { + return null; + } + return ClientesAtivosInativosFiltrado.Where((ClientesAtivosInativos x) => x.Selecionado).Select((Func)((ClientesAtivosInativos x) => new Tarefa + { + Entidade = (TipoTarefa)2, + IdEntidade = x.Id, + Agendamento = tarefa.Agendamento, + Titulo = tarefa.Titulo, + Descricao = tarefa.Anotacoes, + Responsaveis = tarefa.Responsaveis, + Usuario = usuario, + UsuarioCadastro = Recursos.Usuario, + Cliente = x.Nome, + IdCliente = x.Id + })).ToList(); + case 0: + if (ClientesAtivosInativosFiltrado == null || ClientesAtivosInativosFiltrado.Count == 0 || !ClientesAtivosInativosFiltrado.Any((ClientesAtivosInativos x) => x.Selecionado)) + { + return null; + } + return ClientesAtivosInativosFiltrado.Where((ClientesAtivosInativos x) => x.Selecionado).Select((Func)((ClientesAtivosInativos x) => new Tarefa + { + Entidade = (TipoTarefa)2, + IdEntidade = x.Id, + Agendamento = tarefa.Agendamento, + Titulo = tarefa.Titulo, + Descricao = tarefa.Anotacoes, + Responsaveis = tarefa.Responsaveis, + Usuario = usuario, + UsuarioCadastro = Recursos.Usuario, + Cliente = x.Nome, + IdCliente = x.Id + })).ToList(); + case 3: + if (ApolicePendenteFiltrado == null || ApolicePendenteFiltrado.Count == 0 || !ApolicePendenteFiltrado.Any((ApolicePendente x) => x.Selecionado)) + { + return null; + } + return ApolicePendenteFiltrado.Where((ApolicePendente x) => x.Selecionado).Select((Func)((ApolicePendente x) => new Tarefa + { + Entidade = (TipoTarefa)0, + IdEntidade = ((DomainBase)x.Documento).Id, + Agendamento = tarefa.Agendamento, + Titulo = tarefa.Titulo, + Descricao = tarefa.Anotacoes, + Responsaveis = tarefa.Responsaveis, + Usuario = usuario, + UsuarioCadastro = Recursos.Usuario, + Cliente = x.Documento.Controle.Cliente.Nome, + IdCliente = ((DomainBase)x.Documento.Controle.Cliente).Id, + Referencia = ((x.Documento.Tipo == 0 && !string.IsNullOrWhiteSpace(x.Documento.Apolice)) ? ("APÓLICE NÚMERO " + x.Documento.Apolice) : ((x.Documento.Tipo > 0) ? ("APÓLICE NÚMERO " + x.Documento.Apolice + " ENDOSSO " + x.Documento.Endosso) : ("PROPOSTA NÚMERO " + x.Documento.Proposta))) + })).ToList(); + case 4: + { + if (RenovacaoFiltrado == null || RenovacaoFiltrado.Count == 0 || !RenovacaoFiltrado.Any((Renovacao x) => x.Selecionado)) + { + return null; + } + IEnumerable enumerable = RenovacaoFiltrado.Where((Renovacao x) => x.Documento != null); + IEnumerable enumerable2 = RenovacaoFiltrado.Where((Renovacao x) => x.Prospeccao != null); + List collection = new List(); + List collection2 = new List(); + Renovacao[] source = (enumerable as Renovacao[]) ?? enumerable.ToArray(); + if (source.Any()) + { + collection = source.Where((Renovacao x) => x.Selecionado).Select((Func)((Renovacao x) => new Tarefa + { + Entidade = (TipoTarefa)0, + IdEntidade = ((DomainBase)x.Documento).Id, + Agendamento = tarefa.Agendamento, + Titulo = tarefa.Titulo, + Descricao = tarefa.Anotacoes, + Responsaveis = tarefa.Responsaveis, + Usuario = usuario, + UsuarioCadastro = Recursos.Usuario, + Cliente = x.Documento.Controle.Cliente.Nome, + IdCliente = ((DomainBase)x.Documento.Controle.Cliente).Id, + Referencia = ((x.Documento.Tipo == 0 && !string.IsNullOrWhiteSpace(x.Documento.Apolice)) ? ("APÓLICE NÚMERO " + x.Documento.Apolice) : ((x.Documento.Tipo > 0) ? ("APÓLICE NÚMERO " + x.Documento.Apolice + " ENDOSSO " + x.Documento.Endosso) : ("PROPOSTA NÚMERO " + x.Documento.Proposta))) + })).ToList(); + } + Renovacao[] source2 = (enumerable2 as Renovacao[]) ?? enumerable2.ToArray(); + if (source2.Any()) + { + collection2 = source2.Where((Renovacao x) => x.Selecionado).Select((Func)((Renovacao x) => new Tarefa + { + Entidade = (TipoTarefa)5, + IdEntidade = ((DomainBase)x.Prospeccao).Id, + Agendamento = tarefa.Agendamento, + Titulo = tarefa.Titulo, + Descricao = tarefa.Anotacoes, + Responsaveis = tarefa.Responsaveis, + Usuario = usuario, + UsuarioCadastro = Recursos.Usuario, + Cliente = x.Prospeccao.Nome, + Referencia = "PROSPECÇÃO " + x.VigenciaFinal?.ToString("d") + })).ToList(); + } + list.AddRange(collection); + list.AddRange(collection2); + if (list.Count <= 0) + { + return null; + } + return list; + } + case 8: + if (AuditoriaFiltrado == null || AuditoriaFiltrado.Count == 0 || !AuditoriaFiltrado.Any((Auditoria x) => x.Selecionado)) + { + return null; + } + return AuditoriaFiltrado.Where((Auditoria x) => x.Selecionado).Select((Func)((Auditoria x) => new Tarefa + { + Entidade = (TipoTarefa)0, + IdEntidade = ((DomainBase)x.Documento).Id, + Agendamento = tarefa.Agendamento, + Titulo = tarefa.Titulo, + Descricao = tarefa.Anotacoes, + Responsaveis = tarefa.Responsaveis, + Usuario = usuario, + UsuarioCadastro = Recursos.Usuario, + Cliente = x.Documento.Controle.Cliente.Nome, + IdCliente = ((DomainBase)x.Documento.Controle.Cliente).Id, + Referencia = ((x.Documento.Tipo == 0 && !string.IsNullOrWhiteSpace(x.Documento.Apolice)) ? ("APÓLICE NÚMERO " + x.Documento.Apolice) : ((x.Documento.Tipo > 0) ? ("APÓLICE NÚMERO " + x.Documento.Apolice + " ENDOSSO " + x.Documento.Endosso) : ("PROPOSTA NÚMERO " + x.Documento.Proposta))) + })).ToList(); + case 15: + if (MetaVendedorFiltrado == null || MetaVendedorFiltrado.Count == 0 || !MetaVendedorFiltrado.Any((MetaVendedorRelatorio x) => x.Selecionado)) + { + return null; + } + return MetaVendedorFiltrado.Where((MetaVendedorRelatorio x) => x.Selecionado).Select((Func)((MetaVendedorRelatorio x) => new Tarefa + { + Entidade = (TipoTarefa)6, + IdEntidade = x.Id, + Agendamento = tarefa.Agendamento, + Titulo = tarefa.Titulo, + Descricao = tarefa.Anotacoes, + Responsaveis = tarefa.Responsaveis, + Usuario = usuario, + UsuarioCadastro = Recursos.Usuario, + Cliente = x.Vendedor, + Referencia = "VENDEDOR " + x.Vendedor + })).ToList(); + case 14: + if (MetaSeguradoraFiltrado == null || MetaSeguradoraFiltrado.Count == 0 || !MetaSeguradoraFiltrado.Any((MetaSeguradoraRelatorio x) => x.Selecionado)) + { + return null; + } + return MetaSeguradoraFiltrado.Where((MetaSeguradoraRelatorio x) => x.Selecionado).Select((Func)((MetaSeguradoraRelatorio x) => new Tarefa + { + Entidade = (TipoTarefa)7, + IdEntidade = x.Id, + Agendamento = tarefa.Agendamento, + Titulo = tarefa.Titulo, + Descricao = tarefa.Anotacoes, + Responsaveis = tarefa.Responsaveis, + Usuario = usuario, + UsuarioCadastro = Recursos.Usuario, + Cliente = x.Seguradora, + Referencia = "SEGURADORA " + x.Seguradora + })).ToList(); + default: + if (ProducaoFiltrado == null || ProducaoFiltrado.Count == 0 || !ProducaoFiltrado.Any((Producao x) => x.Selecionado)) + { + return null; + } + return ProducaoFiltrado.Where((Producao x) => x.Selecionado).Select((Func)((Producao x) => new Tarefa + { + Entidade = (TipoTarefa)0, + IdEntidade = ((DomainBase)x.Documento).Id, + Agendamento = tarefa.Agendamento, + Titulo = tarefa.Titulo, + Descricao = tarefa.Anotacoes, + Responsaveis = tarefa.Responsaveis, + Usuario = usuario, + UsuarioCadastro = Recursos.Usuario, + Cliente = x.Documento.Controle.Cliente.Nome, + IdCliente = ((DomainBase)x.Documento.Controle.Cliente).Id, + Referencia = ((x.Documento.Tipo == 0 && !string.IsNullOrWhiteSpace(x.Documento.Apolice)) ? ("APÓLICE NÚMERO " + x.Documento.Apolice) : ((x.Documento.Tipo > 0) ? ("APÓLICE NÚMERO " + x.Documento.Apolice + " ENDOSSO " + x.Documento.Endosso) : ("PROPOSTA NÚMERO " + x.Documento.Proposta))) + })).ToList(); + } + } + + public async Task> CriarLista() + { + return await Task.Run(delegate + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Unknown result type (might be due to invalid IL or missing references) + //IL_0055: Expected I4, but got Unknown + //IL_0055: Unknown result type (might be due to invalid IL or missing references) + //IL_0058: Invalid comparison between Unknown and I4 + Relatorio relatorio = Relatorio; + switch ((int)relatorio) + { + default: + if ((int)relatorio == 26) + { + if (ApoliceCriticaFiltrado == null || ApoliceCriticaFiltrado.Count == 0 || !ApoliceCriticaFiltrado.Any((ApoliceCritica x) => x.Selecionado)) + { + return new List(); + } + return ApoliceCriticaFiltrado.Where((ApoliceCritica x) => x.Selecionado).Select((Func)((ApoliceCritica x) => new MalaDireta + { + Cliente = x.Critica.Documento.Controle.Cliente, + Apolice = x.Critica.Documento, + Tela = (TipoTela)2, + Item = new Item + { + Descricao = ((x.Critica.Documento.ItensAtivo == null) ? "" : ((x.Critica.Documento.ItensAtivo.Count > 1) ? "APÓLICE COLETIVA" : ((x.Critica.Documento.ItensAtivo.Count == 1) ? x.Critica.Documento.ItensAtivo.First().Descricao : ""))) + }, + Relatorio = Relatorio + })).ToList(); + } + break; + case 17: + if (LicenciamentoFiltrado == null || LicenciamentoFiltrado.Count == 0 || !LicenciamentoFiltrado.Any((Licenciamento x) => x.Selecionado)) + { + return new List(); + } + return LicenciamentoFiltrado.Where((Licenciamento x) => x.Selecionado).Select((Func)((Licenciamento x) => new MalaDireta + { + Cliente = x.Documento.Controle.Cliente, + Apolice = x.Documento, + Item = x.EntidadeItem, + Tela = (TipoTela)3, + Relatorio = Relatorio + })).ToList(); + case 1: + if (ClientesAtivosInativosFiltrado == null || ClientesAtivosInativosFiltrado.Count == 0 || !ClientesAtivosInativosFiltrado.Any((ClientesAtivosInativos x) => x.Selecionado)) + { + return new List(); + } + return ClientesAtivosInativosFiltrado.Where((ClientesAtivosInativos x) => x.Selecionado).Select((Func)((ClientesAtivosInativos x) => new MalaDireta + { + Cliente = new Cliente + { + Id = x.Id, + Nome = x.Nome, + Nascimento = x.Nascimento, + Documento = x.Documento, + VencimentoHabilitacao = x.VencimentoCnh, + MalaDireta = x.EntidadeCliente.MalaDireta + }, + Tela = (TipoTela)1, + Relatorio = Relatorio + })).ToList(); + case 0: + if (ClientesAtivosInativosFiltrado == null || ClientesAtivosInativosFiltrado.Count == 0 || !ClientesAtivosInativosFiltrado.Any((ClientesAtivosInativos x) => x.Selecionado)) + { + return new List(); + } + return ClientesAtivosInativosFiltrado.Where((ClientesAtivosInativos x) => x.Selecionado).Select((Func)((ClientesAtivosInativos x) => new MalaDireta + { + Cliente = new Cliente + { + Id = x.Id, + Nome = x.Nome, + Nascimento = x.Nascimento, + Documento = x.Documento, + VencimentoHabilitacao = x.VencimentoCnh, + NomeSocialRg = x.EntidadeCliente.NomeSocialRg, + MalaDireta = x.EntidadeCliente.MalaDireta + }, + Tela = (TipoTela)1, + Relatorio = Relatorio + })).ToList(); + case 2: + if (ProducaoFiltrado == null || ProducaoFiltrado.Count == 0 || !ProducaoFiltrado.Any((Producao x) => x.Selecionado && x.Documento != null)) + { + return new List(); + } + return ProducaoFiltrado.Where((Producao x) => x.Selecionado && x.Documento != null).Select((Func)((Producao x) => new MalaDireta + { + Cliente = x.Documento.Controle.Cliente, + Apolice = x.Documento, + Item = new Item + { + Descricao = x.Item + }, + Tela = (TipoTela)2, + Relatorio = Relatorio + })).ToList(); + case 3: + if (ApolicePendenteFiltrado == null || ApolicePendenteFiltrado.Count == 0 || !ApolicePendenteFiltrado.Any((ApolicePendente x) => x.Selecionado && x.Documento != null)) + { + return new List(); + } + return ApolicePendenteFiltrado.Where((ApolicePendente x) => x.Selecionado && x.Documento != null).Select((Func)((ApolicePendente x) => new MalaDireta + { + Cliente = x.Documento.Controle.Cliente, + Apolice = x.Documento, + Item = new Item + { + Descricao = x.Item + }, + Tela = (TipoTela)2, + Relatorio = Relatorio + })).ToList(); + case 4: + { + if (RenovacaoFiltrado == null || RenovacaoFiltrado.Count == 0 || !RenovacaoFiltrado.Any((Renovacao x) => x.Selecionado)) + { + return new List(); + } + List list = RenovacaoFiltrado.Where((Renovacao x) => x.Selecionado && x.Documento != null).Select((Func)((Renovacao x) => new MalaDireta + { + Cliente = x.Documento.Controle.Cliente, + Apolice = x.Documento, + Tela = (TipoTela)2, + Item = new Item + { + Descricao = x.Item + }, + Relatorio = Relatorio + })).ToList(); + List list2 = RenovacaoFiltrado.Where((Renovacao x) => x.Selecionado && x.Prospeccao != null).Select((Func)((Renovacao x) => new MalaDireta + { + Cliente = new Cliente + { + Nome = x.Prospeccao.Nome, + Id = 0L + }, + Prospeccao = x.Prospeccao, + Tela = (TipoTela)33, + Item = new Item + { + Descricao = x.Item + }, + Relatorio = Relatorio + })).ToList(); + if (list2.Count > 0) + { + list.AddRange(list2); + } + return list; + } + case 5: + if (ComissaoFiltrado == null || ComissaoFiltrado.Count == 0 || !ComissaoFiltrado.Any((Comissao x) => x.Selecionado && x.Documento != null)) + { + return new List(); + } + return ComissaoFiltrado.Where((Comissao x) => x.Selecionado && x.Documento != null).Select((Func)((Comissao x) => new MalaDireta + { + Cliente = x.Documento.Controle.Cliente, + Apolice = x.Documento, + Parcela = x.ParcelaEntity, + Item = new Item + { + Descricao = x.Item + }, + Tela = (TipoTela)5, + Relatorio = Relatorio + })).ToList(); + case 9: + case 10: + if (SinistroFiltrado == null || SinistroFiltrado.Count == 0 || !SinistroFiltrado.Any((Sinistro x) => x.Selecionado)) + { + return new List(); + } + return SinistroFiltrado.Where((Sinistro x) => x.Selecionado).Select((Func)((Sinistro x) => new MalaDireta + { + Cliente = x.Cliente, + Apolice = x.Documento, + Item = new Item + { + Descricao = x.Item + }, + Sinistro = x.EntidadeSinistro, + Tela = (TipoTela)7, + Relatorio = Relatorio + })).ToList(); + case 6: + case 16: + if (PendenteFiltrado == null || PendenteFiltrado.Count == 0 || !PendenteFiltrado.Any((Pendente x) => x.Selecionado && x.Documento != null)) + { + return new List(); + } + return PendenteFiltrado.Where((Pendente x) => x.Selecionado && x.Documento != null).Select((Func)((Pendente x) => new MalaDireta + { + Cliente = x.Documento.Controle.Cliente, + Apolice = x.Documento, + Item = new Item + { + Descricao = x.Item + }, + Parcela = x.ParcelaEntity, + Tela = (TipoTela)5, + Relatorio = Relatorio + })).ToList(); + case 7: + case 8: + case 11: + case 12: + case 13: + case 14: + case 15: + break; + } + return (List)null; + }); + } + + public async Task> CriarListaEtiqueta() + { + return await Task.Run(delegate + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Unknown result type (might be due to invalid IL or missing references) + //IL_0051: Expected I4, but got Unknown + Relatorio relatorio = Relatorio; + switch ((int)relatorio) + { + case 1: + if (ClientesAtivosInativosFiltrado == null || ClientesAtivosInativosFiltrado.Count == 0 || !ClientesAtivosInativosFiltrado.Any((ClientesAtivosInativos x) => x.Selecionado)) + { + return (List)null; + } + return ClientesAtivosInativosFiltrado.Where((ClientesAtivosInativos x) => x.Selecionado).Select((Func)((ClientesAtivosInativos x) => new Documento + { + Controle = new Controle + { + Cliente = new Cliente + { + Id = x.Id, + Nome = x.Nome + } + } + })).ToList(); + case 0: + if (ClientesAtivosInativosFiltrado == null || ClientesAtivosInativosFiltrado.Count == 0 || !ClientesAtivosInativosFiltrado.Any((ClientesAtivosInativos x) => x.Selecionado)) + { + return (List)null; + } + return ClientesAtivosInativosFiltrado.Where((ClientesAtivosInativos x) => x.Selecionado).Select((Func)((ClientesAtivosInativos x) => new Documento + { + Controle = new Controle + { + Cliente = new Cliente + { + Id = x.Id, + Nome = x.Nome + } + } + })).ToList(); + case 2: + if (Producao == null || Producao.Count == 0 || !Producao.Any((Producao x) => x.Selecionado)) + { + return (List)null; + } + return Producao.Where((Producao x) => x.Selecionado).Select((Func)((Producao x) => new Documento + { + Id = ((DomainBase)x.Documento).Id, + Vigencia1 = x.Documento.Vigencia1, + Vigencia2 = x.Documento.Vigencia2, + Apolice = x.Documento.Apolice, + Endosso = x.Documento.Endosso, + VendedorPrincipal = x.Documento.VendedorPrincipal, + Controle = new Controle + { + Seguradora = new Seguradora + { + Id = ((DomainBase)x.Documento.Controle.Seguradora).Id, + Nome = x.Documento.Controle.Seguradora.Nome + }, + Ramo = new Ramo + { + Id = ((DomainBase)x.Documento.Controle.Ramo).Id, + Nome = x.Documento.Controle.Ramo.Nome + }, + Cliente = new Cliente + { + Id = ((DomainBase)x.Documento.Controle.Cliente).Id, + Nome = x.Documento.Controle.Cliente.Nome + } + } + })).ToList(); + case 3: + if (ApolicePendente == null || ApolicePendente.Count == 0 || !ApolicePendente.Any((ApolicePendente x) => x.Selecionado)) + { + return (List)null; + } + return ApolicePendente.Where((ApolicePendente x) => x.Selecionado).Select((Func)((ApolicePendente x) => new Documento + { + Id = ((DomainBase)x.Documento).Id, + Vigencia1 = x.Documento.Vigencia1, + Vigencia2 = x.Documento.Vigencia2, + Apolice = x.Documento.Apolice, + Endosso = x.Documento.Endosso, + VendedorPrincipal = x.Documento.VendedorPrincipal, + Controle = new Controle + { + Seguradora = new Seguradora + { + Id = ((DomainBase)x.Documento.Controle.Seguradora).Id, + Nome = x.Documento.Controle.Seguradora.Nome + }, + Ramo = new Ramo + { + Id = ((DomainBase)x.Documento.Controle.Ramo).Id, + Nome = x.Documento.Controle.Ramo.Nome + }, + Cliente = new Cliente + { + Id = ((DomainBase)x.Documento.Controle.Cliente).Id, + Nome = x.Documento.Controle.Cliente.Nome + } + } + })).ToList(); + case 4: + if (RenovacaoFiltrado == null || RenovacaoFiltrado.Count == 0 || !RenovacaoFiltrado.Any((Renovacao x) => x.Selecionado)) + { + return (List)null; + } + return RenovacaoFiltrado.Where((Renovacao x) => x.Selecionado).Select((Func)((Renovacao x) => new Documento + { + Id = ((x.Apolice == "PROSPECÇÃO") ? ((DomainBase)x.Prospeccao).Id : ((DomainBase)x.Documento).Id), + Vigencia1 = ((x.Apolice == "PROSPECÇÃO") ? default(DateTime) : x.Documento.Vigencia1), + Vigencia2 = x.VigenciaFinal, + Apolice = x.Apolice, + Endosso = ((x.Apolice == "PROSPECÇÃO") ? "" : x.Documento.Endosso), + VendedorPrincipal = (Vendedor)((!(x.Apolice == "PROSPECÇÃO")) ? ((object)x.Documento.VendedorPrincipal) : ((object)new Vendedor + { + Nome = x.Vendedor + })), + Controle = new Controle + { + Seguradora = ((x.Apolice == "PROSPECÇÃO") ? new Seguradora() : new Seguradora + { + Id = ((DomainBase)x.Documento.Controle.Seguradora).Id, + Nome = x.Documento.Controle.Seguradora.Nome + }), + Ramo = ((x.Apolice == "PROSPECÇÃO") ? new Ramo() : new Ramo + { + Id = ((DomainBase)x.Documento.Controle.Ramo).Id, + Nome = x.Documento.Controle.Ramo.Nome + }), + Cliente = ((x.Apolice == "PROSPECÇÃO") ? new Cliente + { + Nome = x.Cliente + } : new Cliente + { + Id = ((DomainBase)x.Documento.Controle.Cliente).Id, + Nome = x.Documento.Controle.Cliente.Nome + }) + }, + ItensAtivo = new List + { + new Item + { + Descricao = x.Item + } + } + })).ToList(); + case 5: + if (ComissaoFiltrado == null || ComissaoFiltrado.Count == 0 || !ComissaoFiltrado.Any((Comissao x) => x.Selecionado)) + { + return (List)null; + } + return ComissaoFiltrado.Where((Comissao x) => x.Selecionado).Select((Func)((Comissao x) => new Documento + { + Id = ((DomainBase)x.Documento).Id, + Vigencia1 = x.Documento.Vigencia1, + Vigencia2 = x.Documento.Vigencia2, + Apolice = x.Documento.Apolice, + Endosso = x.Documento.Endosso, + VendedorPrincipal = x.Documento.VendedorPrincipal, + Controle = new Controle + { + Seguradora = new Seguradora + { + Id = ((DomainBase)x.Documento.Controle.Seguradora).Id, + Nome = x.Documento.Controle.Seguradora.Nome + }, + Ramo = new Ramo + { + Id = ((DomainBase)x.Documento.Controle.Ramo).Id, + Nome = x.Documento.Controle.Ramo.Nome + }, + Cliente = new Cliente + { + Id = ((DomainBase)x.Documento.Controle.Cliente).Id, + Nome = x.Documento.Controle.Cliente.Nome + } + } + })).ToList(); + case 6: + case 16: + if (PendenteFiltrado == null || PendenteFiltrado.Count == 0 || !PendenteFiltrado.Any((Pendente x) => x.Selecionado)) + { + return (List)null; + } + return PendenteFiltrado.Where((Pendente x) => x.Selecionado).Select((Func)((Pendente x) => new Documento + { + Id = ((DomainBase)x.Documento).Id, + Vigencia1 = x.Documento.Vigencia1, + Vigencia2 = x.Documento.Vigencia2, + Apolice = x.Documento.Apolice, + Endosso = x.Documento.Endosso, + VendedorPrincipal = x.Documento.VendedorPrincipal, + Controle = new Controle + { + Seguradora = new Seguradora + { + Id = ((DomainBase)x.Documento.Controle.Seguradora).Id, + Nome = x.Documento.Controle.Seguradora.Nome + }, + Ramo = new Ramo + { + Id = ((DomainBase)x.Documento.Controle.Ramo).Id, + Nome = x.Documento.Controle.Ramo.Nome + }, + Cliente = new Cliente + { + Id = ((DomainBase)x.Documento.Controle.Cliente).Id, + Nome = x.Documento.Controle.Cliente.Nome + } + } + })).ToList(); + case 8: + if (Auditoria == null || Auditoria.Count == 0 || !Auditoria.Any((Auditoria x) => x.Selecionado)) + { + return (List)null; + } + return Auditoria.Where((Auditoria x) => x.Selecionado).Select((Func)((Auditoria x) => new Documento + { + Id = ((DomainBase)x.Documento).Id, + Vigencia1 = x.Documento.Vigencia1, + Vigencia2 = x.Documento.Vigencia2, + Apolice = x.Documento.Apolice, + Endosso = x.Documento.Endosso, + VendedorPrincipal = x.Documento.VendedorPrincipal, + Controle = new Controle + { + Seguradora = new Seguradora + { + Id = ((DomainBase)x.Documento.Controle.Seguradora).Id, + Nome = x.Documento.Controle.Seguradora.Nome + }, + Ramo = new Ramo + { + Id = ((DomainBase)x.Documento.Controle.Ramo).Id, + Nome = x.Documento.Controle.Ramo.Nome + }, + Cliente = new Cliente + { + Id = ((DomainBase)x.Documento.Controle.Cliente).Id, + Nome = x.Documento.Controle.Cliente.Nome + } + } + })).ToList(); + case 9: + if (Sinistro == null || Sinistro.Count == 0 || !Sinistro.Any((Sinistro x) => x.Selecionado)) + { + return (List)null; + } + return Sinistro.Where((Sinistro x) => x.Selecionado).Select((Func)((Sinistro x) => new Documento + { + Id = ((DomainBase)x.Documento).Id, + Vigencia1 = x.Documento.Vigencia1, + Vigencia2 = x.Documento.Vigencia2, + Apolice = x.Documento.Apolice, + Endosso = x.Documento.Endosso, + VendedorPrincipal = x.Documento.VendedorPrincipal, + Controle = new Controle + { + Seguradora = new Seguradora + { + Id = ((DomainBase)x.Documento.Controle.Seguradora).Id, + Nome = x.Documento.Controle.Seguradora.Nome + }, + Ramo = new Ramo + { + Id = ((DomainBase)x.Documento.Controle.Ramo).Id, + Nome = x.Documento.Controle.Ramo.Nome + }, + Cliente = new Cliente + { + Id = ((DomainBase)x.Documento.Controle.Cliente).Id, + Nome = x.Documento.Controle.Cliente.Nome + } + } + })).ToList(); + case 10: + if (Sinistro == null || Sinistro.Count == 0 || !Sinistro.Any((Sinistro x) => x.Selecionado)) + { + return (List)null; + } + return Sinistro.Where((Sinistro x) => x.Selecionado).Select((Func)((Sinistro x) => new Documento + { + Id = ((DomainBase)x.Documento).Id, + Vigencia1 = x.Documento.Vigencia1, + Vigencia2 = x.Documento.Vigencia2, + Apolice = x.Documento.Apolice, + Endosso = x.Documento.Endosso, + VendedorPrincipal = x.Documento.VendedorPrincipal, + Controle = new Controle + { + Seguradora = new Seguradora + { + Id = ((DomainBase)x.Documento.Controle.Seguradora).Id, + Nome = x.Documento.Controle.Seguradora.Nome + }, + Ramo = new Ramo + { + Id = ((DomainBase)x.Documento.Controle.Ramo).Id, + Nome = x.Documento.Controle.Ramo.Nome + }, + Cliente = new Cliente + { + Id = ((DomainBase)x.Documento.Controle.Cliente).Id, + Nome = x.Documento.Controle.Cliente.Nome + } + } + })).ToList(); + case 12: + if (FaturaPendenteFiltrado == null || FaturaPendenteFiltrado.Count == 0 || !FaturaPendenteFiltrado.Any((FaturaPendente x) => x.Selecionado)) + { + return (List)null; + } + return FaturaPendenteFiltrado.Where((FaturaPendente x) => x.Selecionado).Select((Func)((FaturaPendente x) => new Documento + { + Id = ((DomainBase)x.Documento).Id, + Vigencia1 = x.Documento.Vigencia1, + Vigencia2 = x.Documento.Vigencia2, + Apolice = x.Documento.Apolice, + Endosso = x.Documento.Endosso, + VendedorPrincipal = x.Documento.VendedorPrincipal, + Controle = new Controle + { + Seguradora = new Seguradora + { + Id = ((DomainBase)x.Documento.Controle.Seguradora).Id, + Nome = x.Documento.Controle.Seguradora.Nome + }, + Ramo = new Ramo + { + Id = ((DomainBase)x.Documento.Controle.Ramo).Id, + Nome = x.Documento.Controle.Ramo.Nome + }, + Cliente = new Cliente + { + Id = ((DomainBase)x.Documento.Controle.Cliente).Id, + Nome = x.Documento.Controle.Cliente.Nome + } + } + })).ToList(); + default: + return (List)null; + } + }); + } + + public async void ExibirExtratoDrawer() + { + List list = new List(); + List list2 = new List(); + List list3 = new List(); + List list4 = new List(); + List list5 = new List(); + Relatorio relatorio = Relatorio; + switch ((int)relatorio) + { + case 0: + foreach (ClientesAtivosInativos item in ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList()) + { + list3.Add(new ClientesAtivosInativos + { + Id = item.Id, + Nome = item.Nome, + Documento = item.Documento, + Selecionado = item.Selecionado + }); + } + ShowDrawer(new ExtratosDrawer(list3, null, Relatorio), 0, close: false); + return; + case 2: + foreach (Producao item2 in ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList()) + { + list.Add(item2.Documento); + if (item2.Selecionado) + { + list4.Add(((DomainBase)item2.Documento).Id); + } + } + break; + case 4: + foreach (Renovacao item3 in ((IEnumerable)((ItemsControl)((GridRelatorio)Report).DataGrid).Items).Cast().ToList()) + { + if (item3.Documento != null) + { + list.Add(item3.Documento); + if (item3.Selecionado) + { + list4.Add(((DomainBase)item3.Documento).Id); + } + } + if (item3.Prospeccao != null) + { + list2.Add(item3.Prospeccao); + if (item3.Selecionado) + { + list5.Add(((DomainBase)item3.Prospeccao).Id); + } + } + } + break; + } + if (list4.Count == 0 && list5.Count == 0) + { + await ShowMessage("É NECESSÁRIO HAVER AO MENOS UM DOCUMENTO SELECIONADO"); + } + else + { + ShowDrawer(new ExtratosDrawer(null, list, Relatorio, list4, list5, list2), 0, close: false); + } + } + + public async void MostrarProtocolo() + { + Relatorio relatorio = Relatorio; + switch (relatorio - 2) + { + case 0: + if (!ProducaoFiltrado.Any((Producao x) => x.Selecionado)) + { + await ShowMessage("NECESSÁRIO SELECIONAR OS DOCUMENTOS PARA EMISSÃO DE PROTOCOLO"); + break; + } + PrepararProtocolo(await ShowProtocoloDialog((from x in ProducaoFiltrado + where x.Selecionado + select x.Documento).ToList())); + break; + case 1: + if (!ApolicePendenteFiltrado.Any((ApolicePendente x) => x.Selecionado)) + { + await ShowMessage("NECESSÁRIO SELECIONAR OS DOCUMENTOS PARA EMISSÃO DE PROTOCOLO"); + break; + } + PrepararProtocolo(await ShowProtocoloDialog((from x in ApolicePendenteFiltrado + where x.Selecionado + select x.Documento).ToList())); + break; + case 2: + if (!RenovacaoFiltrado.Any((Renovacao x) => x.Selecionado)) + { + await ShowMessage("NECESSÁRIO SELECIONAR OS DOCUMENTOS PARA EMISSÃO DE PROTOCOLO"); + break; + } + PrepararProtocolo(await ShowProtocoloDialog((from x in RenovacaoFiltrado + where x.Selecionado + select x.Documento).ToList())); + break; + } + } + + public async void PrepararProtocolo(List itens) + { + if (itens == null) + { + return; + } + Carregando = true; + base.IsEnabled = false; + if (await ShowMessage("DESEJA EMITIR O CHECKLIST?", "SIM", "NÃO")) + { + await EmitirCheckList(itens); + } + List> listaIds = new List>(); + foreach (Documento iten in itens) + { + listaIds.Add(new Tuple(((DomainBase)iten).Id, iten.ObsProtocolo)); + } + await EmitirProtocolos(listaIds, await ShowMessage("DESEJA EMITIR DOIS PROTOCOLOS POR PÁGINA?" + Environment.NewLine + "A QUANTIDADE DE INFORMÃÇÕES PODE IMPEDIR QUE ESSA FUNÇÃO FUNCIONE CORRETAMENTE", "SIM", "NÃO"), itens); + base.IsEnabled = true; + Carregando = false; + } + + public async void AdcionarFiltroPersonalizado() + { + if (FiltroPersonalizado == null) + { + return; + } + string descricao; + if (!SemValor) + { + List list = ((FiltroPersonalizadoSelecionado == null) ? new List() : FiltroPersonalizadoSelecionado.Where((FiltroPersonalizado x) => x.Propriedade == FiltroPersonalizado.Propriedade && x.SemValor).ToList()); + if (list.Count > 0) + { + list.ForEach(delegate(FiltroPersonalizado x) + { + FiltroPersonalizadoSelecionado.Remove(x); + }); + } + switch (FiltroPersonalizado.Tipo.Name) + { + default: + if (string.IsNullOrEmpty(ValorInicial)) + { + await ShowMessage("O VALOR DEVE SER PREENCHIDO CORRETAMENTE."); + return; + } + descricao = FiltroPersonalizado.Nome + " = " + ValorInicial; + break; + case "DateTime": + { + if (!DateTime.TryParse(ValorInicial, out var result3) || !DateTime.TryParse(ValorFinal, out result3) || DateTime.Parse(ValorInicial) > DateTime.Parse(ValorFinal)) + { + await ShowMessage("O VALOR DE INTERVALO DEVE SER PREENCHIDO CORRETAMENTE."); + return; + } + descricao = $"{FiltroPersonalizado.Nome}: {DateTime.Parse(ValorInicial):d} até {DateTime.Parse(ValorFinal):d}"; + break; + } + case "Decimal": + { + if (!decimal.TryParse(ValorInicial, out var result2) || !decimal.TryParse(ValorFinal, out result2) || decimal.Parse(ValorInicial) > decimal.Parse(ValorFinal)) + { + await ShowMessage("O VALOR DE INTERVALO DEVE SER PREENCHIDO CORRETAMENTE."); + return; + } + descricao = $"{FiltroPersonalizado.Nome}: {decimal.Parse(ValorInicial):n2} até {decimal.Parse(ValorFinal):n2}"; + break; + } + case "Int32": + { + if (!int.TryParse(ValorInicial, out var result4) || !int.TryParse(ValorFinal, out result4) || int.Parse(ValorInicial) > int.Parse(ValorFinal)) + { + await ShowMessage("O VALOR DE INTERVALO DEVE SER PREENCHIDO CORRETAMENTE."); + return; + } + descricao = $"{FiltroPersonalizado.Nome}: {int.Parse(ValorInicial):n0} até {int.Parse(ValorFinal):n0}"; + break; + } + case "Int64": + { + if (!long.TryParse(ValorInicial, out var result) || !long.TryParse(ValorFinal, out result) || long.Parse(ValorInicial) > int.Parse(ValorFinal)) + { + await ShowMessage("O VALOR DE INTERVALO DEVE SER PREENCHIDO CORRETAMENTE."); + return; + } + descricao = $"{FiltroPersonalizado.Nome}: {long.Parse(ValorInicial):n0} até {long.Parse(ValorFinal):n0}"; + break; + } + } + } + else + { + List list2 = ((FiltroPersonalizadoSelecionado == null) ? new List() : FiltroPersonalizadoSelecionado.Where((FiltroPersonalizado x) => x.Propriedade == FiltroPersonalizado.Propriedade).ToList()); + if (list2.Count > 0) + { + list2.ForEach(delegate(FiltroPersonalizado x) + { + FiltroPersonalizadoSelecionado.Remove(x); + }); + } + descricao = FiltroPersonalizado.Nome + ": EM BRANCO"; + } + if (FiltroPersonalizadoSelecionado == null) + { + FiltroPersonalizadoSelecionado = new ObservableCollection(); + } + FiltroPersonalizadoSelecionado.Add(new FiltroPersonalizado + { + Nome = FiltroPersonalizado.Nome, + Propriedade = FiltroPersonalizado.Propriedade, + Tipo = FiltroPersonalizado.Tipo, + ValorIncial = ValorInicial, + ValorFinal = ValorFinal, + SemValor = SemValor, + Descricao = descricao + }); + FiltroPersonalizado = null; + ValorInicial = string.Empty; + ValorFinal = string.Empty; + PesquisaPersonalizada(); + } + + public void PesquisaPersonalizada() + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Unknown result type (might be due to invalid IL or missing references) + //IL_0085: Expected I4, but got Unknown + Relatorio relatorio = Relatorio; + switch ((int)relatorio) + { + case 17: + LicenciamentoFiltrado = new ObservableCollection(Licenciamento.CustomWhere(FiltroPersonalizadoSelecionado.ToList(), ValorIgual)); + ((ItemsControl)((GridRelatorio)Report).DataGrid).ItemsSource = LicenciamentoFiltrado; + break; + case 27: + PlacaFiltrado = new ObservableCollection(Placas.CustomWhere(FiltroPersonalizadoSelecionado.ToList(), ValorIgual)); + ((ItemsControl)((GridRelatorio)Report).DataGrid).ItemsSource = PlacaFiltrado; + break; + case 1: + ClientesAtivosInativosFiltrado = new ObservableCollection(ClientesAtivosInativos.CustomWhere(FiltroPersonalizadoSelecionado.ToList(), ValorIgual)); + ((ItemsControl)((GridRelatorio)Report).DataGrid).ItemsSource = ClientesAtivosInativosFiltrado; + break; + case 0: + FiltrarRamo(); + break; + case 2: + ProducaoFiltrado = new ObservableCollection(Producao.CustomWhere(FiltroPersonalizadoSelecionado.ToList(), ValorIgual)); + ((ItemsControl)((GridRelatorio)Report).DataGrid).ItemsSource = ProducaoFiltrado; + break; + case 3: + ApolicePendenteFiltrado = new ObservableCollection(ApolicePendente.CustomWhere(FiltroPersonalizadoSelecionado.ToList(), ValorIgual)); + ((ItemsControl)((GridRelatorio)Report).DataGrid).ItemsSource = ApolicePendenteFiltrado; + break; + case 4: + RenovacaoFiltrado = new ObservableCollection(Renovacao.CustomWhere(FiltroPersonalizadoSelecionado.ToList(), ValorIgual)); + ((ItemsControl)((GridRelatorio)Report).DataGrid).ItemsSource = RenovacaoFiltrado; + break; + case 5: + ComissaoFiltrado = new ObservableCollection(Comissao.CustomWhere(FiltroPersonalizadoSelecionado.ToList(), ValorIgual)); + ((ItemsControl)((GridRelatorio)Report).DataGrid).ItemsSource = ComissaoFiltrado; + break; + case 6: + case 16: + PendenteFiltrado = new ObservableCollection(Pendente.CustomWhere(FiltroPersonalizadoSelecionado.ToList(), ValorIgual)); + ((ItemsControl)((GridRelatorio)Report).DataGrid).ItemsSource = PendenteFiltrado; + break; + case 8: + AuditoriaFiltrado = new ObservableCollection(Auditoria.CustomWhere(FiltroPersonalizadoSelecionado.ToList(), ValorIgual)); + ((ItemsControl)((GridRelatorio)Report).DataGrid).ItemsSource = AuditoriaFiltrado; + break; + case 9: + case 10: + SinistroFiltrado = new ObservableCollection(Sinistro.CustomWhere(FiltroPersonalizadoSelecionado.ToList(), ValorIgual)); + ((ItemsControl)((GridRelatorio)Report).DataGrid).ItemsSource = SinistroFiltrado; + break; + case 13: + ExtratosFiltrado = new ObservableCollection(Extratos.CustomWhere(FiltroPersonalizadoSelecionado.ToList(), ValorIgual)); + ((ItemsControl)((GridRelatorio)Report).DataGrid).ItemsSource = ExtratosFiltrado; + break; + case 12: + FaturaPendenteFiltrado = new ObservableCollection(FaturaPendente.CustomWhere(FiltroPersonalizadoSelecionado.ToList(), ValorIgual)); + ((ItemsControl)((GridRelatorio)Report).DataGrid).ItemsSource = FaturaPendenteFiltrado; + break; + case 14: + MetaSeguradoraFiltrado = new ObservableCollection(MetaSeguradora.CustomWhere(FiltroPersonalizadoSelecionado.ToList(), ValorIgual)); + ((ItemsControl)((GridRelatorio)Report).DataGrid).ItemsSource = MetaSeguradoraFiltrado; + break; + case 15: + MetaVendedorFiltrado = new ObservableCollection(MetaVendedor.CustomWhere(FiltroPersonalizadoSelecionado.ToList(), ValorIgual)); + ((ItemsControl)((GridRelatorio)Report).DataGrid).ItemsSource = MetaVendedorFiltrado; + break; + case 18: + TarefaFiltrado = new ObservableCollection(Tarefa.CustomWhere(FiltroPersonalizadoSelecionado.ToList(), ValorIgual)); + ((ItemsControl)((GridRelatorio)Report).DataGrid).ItemsSource = TarefaFiltrado; + break; + case 19: + NotaFiscalFiltrado = new ObservableCollection(NotasFiscais.CustomWhere(FiltroPersonalizadoSelecionado.ToList(), ValorIgual)); + ((ItemsControl)((GridRelatorio)Report).DataGrid).ItemsSource = NotaFiscalFiltrado; + break; + case 23: + LogsEnvioFiltrado = new ObservableCollection(LogsEnvio.CustomWhere(FiltroPersonalizadoSelecionado.ToList(), ValorIgual)); + ((ItemsControl)((GridRelatorio)Report).DataGrid).ItemsSource = LogsEnvioFiltrado; + break; + case 24: + case 25: + LogUtilizacaoFiltrado = new ObservableCollection(LogUtilizacao.CustomWhere(FiltroPersonalizadoSelecionado.ToList(), ValorIgual)); + ((ItemsControl)((GridRelatorio)Report).DataGrid).ItemsSource = LogUtilizacaoFiltrado; + break; + case 26: + ApoliceCriticaFiltrado = new ObservableCollection(ApoliceCritica.CustomWhere(FiltroPersonalizadoSelecionado.ToList(), ValorIgual)); + ((ItemsControl)((GridRelatorio)Report).DataGrid).ItemsSource = ApoliceCriticaFiltrado; + break; + case 28: + EndossoFiltrado = new ObservableCollection(Endossoo.CustomWhere(FiltroPersonalizadoSelecionado.ToList(), ValorIgual)); + ((ItemsControl)((GridRelatorio)Report).DataGrid).ItemsSource = EndossoFiltrado; + break; + case 29: + ClassificacaoFiltrado = new ObservableCollection(Classificacao.CustomWhere(FiltroPersonalizadoSelecionado.ToList(), ValorIgual)); + ((ItemsControl)((GridRelatorio)Report).DataGrid).ItemsSource = ClassificacaoFiltrado; + break; + } + ((GridRelatorio)Report).SinteticoGrid.ItemsSource = Sintetic; + } + + public async Task ValidateTarefa() + { + bool erro = false; + await ServicoRestriUsuario.BuscarRestricoes(((DomainBase)Recursos.Usuario).Id); + Relatorio relatorio = Relatorio; + switch ((int)relatorio) + { + case 17: + if (LicenciamentoFiltrado == null || LicenciamentoFiltrado.Count == 0 || LicenciamentoFiltrado.All((Licenciamento x) => !x.Selecionado)) + { + erro = true; + } + break; + case 1: + if (ClientesAtivosInativosFiltrado == null || ClientesAtivosInativosFiltrado.Count == 0 || ClientesAtivosInativosFiltrado.All((ClientesAtivosInativos x) => !x.Selecionado)) + { + erro = true; + } + break; + case 0: + if (ClientesAtivosInativosFiltrado == null || ClientesAtivosInativosFiltrado.Count == 0 || ClientesAtivosInativosFiltrado.All((ClientesAtivosInativos x) => !x.Selecionado)) + { + erro = true; + } + break; + case 3: + if (ApolicePendenteFiltrado == null || ApolicePendenteFiltrado.Count == 0 || ApolicePendenteFiltrado.All((ApolicePendente x) => !x.Selecionado)) + { + erro = true; + } + break; + case 2: + if (ProducaoFiltrado == null || ProducaoFiltrado.Count == 0 || ProducaoFiltrado.All((Producao x) => !x.Selecionado)) + { + erro = true; + } + break; + case 4: + if (RenovacaoFiltrado == null || RenovacaoFiltrado.Count == 0 || RenovacaoFiltrado.All((Renovacao x) => !x.Selecionado)) + { + erro = true; + } + break; + case 5: + if (ComissaoFiltrado == null || ComissaoFiltrado.Count == 0 || ComissaoFiltrado.All((Comissao x) => !x.Selecionado)) + { + erro = true; + } + break; + case 6: + case 16: + if (PendenteFiltrado == null || PendenteFiltrado.Count == 0 || PendenteFiltrado.All((Pendente x) => !x.Selecionado)) + { + erro = true; + } + break; + case 9: + case 10: + if (SinistroFiltrado == null || SinistroFiltrado.Count == 0 || SinistroFiltrado.All((Sinistro x) => !x.Selecionado)) + { + erro = true; + } + break; + case 13: + if (ExtratosFiltrado == null || ExtratosFiltrado.Count == 0 || ExtratosFiltrado.All((ExtratoBaixadoRelatorio x) => !x.Selecionado)) + { + erro = true; + } + break; + case 14: + if (MetaSeguradoraFiltrado == null || MetaSeguradoraFiltrado.Count == 0 || MetaSeguradoraFiltrado.All((MetaSeguradoraRelatorio x) => !x.Selecionado)) + { + erro = true; + } + break; + case 15: + if (MetaVendedorFiltrado == null || MetaVendedorFiltrado.Count == 0 || MetaVendedorFiltrado.All((MetaVendedorRelatorio x) => !x.Selecionado)) + { + erro = true; + } + break; + case 7: + erro = true; + break; + case 11: + case 20: + erro = true; + break; + case 8: + if (Auditoria == null || Auditoria.Count == 0 || Auditoria.All((Auditoria x) => !x.Selecionado)) + { + erro = true; + } + break; + case 12: + if (FaturaPendente == null || FaturaPendente.Count == 0 || FaturaPendente.All((FaturaPendente x) => !x.Selecionado)) + { + erro = true; + } + break; + case 27: + if (PlacaFiltrado == null || PlacaFiltrado.Count == 0 || PlacaFiltrado.All((Placas x) => !x.Selecionado)) + { + erro = true; + } + break; + } + if (erro) + { + await ShowMessage("NECESSÁRIO SELECIONAR AO MENOS UM ITEM NA LISTA PARA GERAR TAREFAS."); + } + return erro; + } + + public void AdicionarRamo() + { + if (RamoSelecionado != null) + { + if (RamosSelecionados == null) + { + RamosSelecionados = new ObservableCollection(); + } + if (RamosSelecionados.All((Ramo x) => ((DomainBase)x).Id != ((DomainBase)RamoSelecionado).Id)) + { + RamosSelecionados.Add(RamoSelecionado); + } + RamoSelecionado = null; + FiltrarRamo(); + } + } + + public void RemoverRamo(Ramo ramo) + { + if (ramo != null) + { + if (RamosSelecionados.Any((Ramo x) => ((DomainBase)x).Id == ((DomainBase)ramo).Id)) + { + RamosSelecionados.Remove(ramo); + } + FiltrarRamo(); + } + } + + private void FiltrarRamo() + { + List property = ((RamosSelecionados == null) ? new List() : ((IEnumerable)RamosSelecionados).Select((Func)((Ramo x) => new FiltroPersonalizado + { + Nome = x.Nome, + Propriedade = "Ramo", + Tipo = typeof(string), + ValorIncial = x.Nome, + SemValor = false, + Descricao = x.Nome, + Diferente = true + })).ToList()); + ClientesAtivosInativosFiltrado = new ObservableCollection(ClientesAtivosInativos.CustomNot(property)); + if (FiltroPersonalizadoSelecionado != null) + { + ClientesAtivosInativosFiltrado = new ObservableCollection(ClientesAtivosInativosFiltrado.ToList().CustomWhere(FiltroPersonalizadoSelecionado.ToList())); + } + ((ItemsControl)((GridRelatorio)Report).DataGrid).ItemsSource = ClientesAtivosInativosFiltrado; + ((GridRelatorio)Report).SinteticoGrid.ItemsSource = Sintetic; + } + + public async Task Sincronizar() + { + if (LicenseHelper.Produtos.All((Licenca x) => (int)x.Produto != 77) && LicenseHelper.Produtos.All((Licenca x) => (int)x.Produto != 84)) + { + await ShowMessage("VOCÊ AINDA NÃO POSSUI O AGGILIZADOR DE DOCUMENTOS, NAVEGUE POR NOSSO PORTAL E ENCONTRE A OFERTA QUE MAIS ENCAIXE EM SEU DIA-A-DIA."); + Process.Start("https://agger.com.br"); + return; + } + Relatorio relatorio = Relatorio; + if ((int)relatorio != 3) + { + if ((int)relatorio != 16) + { + return; + } + if (PendenteFiltrado == null || !PendenteFiltrado.Any()) + { + await ShowMessage("NÃO HÁ DADOS PARA SINCRONIZAÇÃO"); + return; + } + List ids = PendenteFiltrado.Select((Pendente x) => ((DomainBase)x.ParcelaEntity).Id).ToList(); + int[] array = await _parcelaServico.Sincronizar(Inicio, ids); + if (array[0] == 0) + { + await ShowMessage("NÃO HÁ PARCELAS PENDENTES NO PERIODO SELECIONADO."); + } + else if (array[0] <= 0 || array[1] != 0) + { + Gestor.Application.Actions.Actions.RecarregarRelatorios?.Invoke(Sessao); + ToggleSnackBar($"{array[1]} PARCELAS VINCULADAS"); + } + return; + } + if (ApolicePendenteFiltrado == null || !ApolicePendenteFiltrado.Any()) + { + await ShowMessage("NÃO HÁ DADOS PARA SINCRONIZAÇÃO"); + return; + } + List dados = ApolicePendenteFiltrado.Where(delegate(ApolicePendente x) + { + Documento documento4 = x.Documento; + if (documento4 != null) + { + Controle controle = documento4.Controle; + if (controle != null) + { + Seguradora seguradora = controle.Seguradora; + if (seguradora != null && seguradora.IdAggilizador.HasValue) + { + Documento documento5 = x.Documento; + if (((documento5 != null) ? documento5.Vinculo : null) != null) + { + Documento documento6 = x.Documento; + if (documento6 == null) + { + return false; + } + VinculoDocumento vinculo4 = documento6.Vinculo; + return ((vinculo4 != null) ? new long?(vinculo4.IdApoliceDigital) : null) == 0; + } + return true; + } + } + } + return false; + }).Select((Func)delegate(ApolicePendente x) + { + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Unknown result type (might be due to invalid IL or missing references) + //IL_0028: Unknown result type (might be due to invalid IL or missing references) + //IL_00cd: Unknown result type (might be due to invalid IL or missing references) + //IL_00e3: Unknown result type (might be due to invalid IL or missing references) + //IL_0103: Unknown result type (might be due to invalid IL or missing references) + //IL_0119: Unknown result type (might be due to invalid IL or missing references) + //IL_0141: Unknown result type (might be due to invalid IL or missing references) + //IL_0157: Unknown result type (might be due to invalid IL or missing references) + //IL_016d: Unknown result type (might be due to invalid IL or missing references) + //IL_0184: Expected O, but got Unknown + DadosVinculo val2 = new DadosVinculo + { + Id = ((DomainBase)x.Documento).Id + }; + object proposta; + if (x.Documento.Controle.Seguradora.IdAggilizador.Value != 1 || ((DomainBase)x.Documento.Controle.Ramo).Id != 5) + { + proposta = x.Documento.Proposta; + } + else + { + ObservableCollection result = Task.Run(() => new ItemServico().BuscarItems(((DomainBase)x.Documento).Id, (StatusItem)2)).Result; + object obj; + if (result == null) + { + obj = null; + } + else + { + Item? obj2 = result.FirstOrDefault(); + obj = ((obj2 != null) ? obj2.Auto.Placa : null); + } + proposta = ((string)obj)?.Replace("-", string.Empty); + } + val2.Proposta = (string)proposta; + val2.Apolice = x.Documento.Apolice; + val2.Documento = x.Documento.Controle.Cliente.Documento; + val2.Endosso = x.Documento.PropostaEndosso; + val2.IdSeguradora = x.Documento.Controle.Seguradora.IdAggilizador.Value; + val2.VigenciaInicial = x.Documento.Vigencia1; + val2.Vigenciafinal = x.Documento.Vigencia2; + val2.Vinculo = x.Documento.Vinculo; + return val2; + }).ToList(); + Filtros filtros = new Filtros + { + Inicio = Inicio, + Fim = Fim + }; + int num = await _apoliceServico.Sincronizar(dados, filtros); + Gestor.Application.Actions.Actions.RecarregarRelatorios?.Invoke(Sessao); + if (ApolicePendenteFiltrado.All(delegate(ApolicePendente x) + { + Documento documento3 = x.Documento; + if (documento3 == null) + { + return false; + } + VinculoDocumento vinculo3 = documento3.Vinculo; + return ((vinculo3 != null) ? new long?(vinculo3.IdApoliceDigital) : null) == 0; + })) + { + await ShowMessage("NENHUM NOVO DOCUMENTO FOI SINCRONIZADO"); + return; + } + if (num == 0) + { + if (!(await ShowMessage("NENHUM NOVO DOCUMENTO FOI SINCRONIZADO, DESEJA IMPORTAR OS DOCUMENTOS ANTERIORMENTE SINCRONIZADOS?", "SIM", "NÃO"))) + { + return; + } + } + else + { + ToggleSnackBar($"{num} DOCUMENTOS SINCRONIZADOS"); + if (!(await ShowMessage($"{ApolicePendenteFiltrado.Count(delegate(ApolicePendente x) + { + Documento documento2 = x.Documento; + if (documento2 == null) + { + return false; + } + VinculoDocumento vinculo2 = documento2.Vinculo; + return ((vinculo2 != null) ? new long?(vinculo2.IdApoliceDigital) : null) > 0; + })} DOCUMENTOS SINCRONIZADOS, DESEJA INICIAR A IMPORTAÇÃO DESSES DOCUMENTOS?", "SIM", "NÃO"))) + { + return; + } + } + List ids2 = (from x in ApolicePendenteFiltrado.Where(delegate(ApolicePendente x) + { + Documento documento = x.Documento; + if (documento == null) + { + return false; + } + VinculoDocumento vinculo = documento.Vinculo; + return ((vinculo != null) ? new long?(vinculo.IdApoliceDigital) : null) > 0; + }) + select x.Documento.Vinculo.IdApoliceDigital).ToList(); + await DownloadAll(ids2, (TipoArquivoVinculo)1); + Parameters val = new Parameters(); + val.Beta = false; + val.Type = 4; + val.Application = "Agger.ImportPDF.exe"; + val.Directory = "Agger.Import"; + val.Arguments = $"{((DomainBase)Recursos.Empresa).Id} {((DomainBase)Recursos.Usuario).Id} NOVOGESTOR PERFIL:{ApplicationHelper.Subkey} SERIAL:{ApplicationHelper.NumeroSerial}"; + val.Run = true; + ((Window)new DownloadWindow(val)).Show(); + } + + public async Task CarregarAjuda() + { + if (!Ajuda.Any((AjudaTela x) => (int)x.Tela == int.Parse(EnumHelper.GetOldValue(Relatorio)))) + { + CarregandoAjuda = true; + List list = await Connection.Get>($"Help/{int.Parse(EnumHelper.GetOldValue(Relatorio))}"); + if (list != null) + { + Ajuda = new ObservableCollection(list); + CarregandoAjuda = false; + } + } + } + + public async Task GerarPlanilhaCompleta() + { + RestricaoUsuario? obj = ((IEnumerable)(await ServicoRestriUsuario.BuscarRestricoes(((DomainBase)Recursos.Usuario).Id))).FirstOrDefault((Func)((RestricaoUsuario x) => (int)x.Tipo == 99)); + if (obj != null && obj.Restricao) + { + await ShowMessage("VOCÊ NÃO TEM PERMISSÃO PARA ACESSAR O PLANILHA COMPLETA"); + return; + } + if ((Fim - Inicio).TotalDays > 31.0) + { + await ShowMessage("NÃO É POSSÍVEL GERAR A PLANILHA COMPLETA COM INTERVALO MAIOR QUE 31 DIAS FILTRADOS."); + return; + } + Loading(isLoading: true); + List idsProspeccoes = new List(); + new List(); + bool configFranquia = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 40); + bool configSomaPremio = false; + Relatorio relatorio = Relatorio; + List list; + List idsFaturas; + if ((int)relatorio != 2) + { + if ((int)relatorio != 4) + { + Loading(isLoading: false); + return; + } + configSomaPremio = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 31); + RenovacaoFiltrado?.Where((Renovacao x) => x.Selecionado).ToList(); + list = (from x in RenovacaoFiltrado?.Where((Renovacao x) => x.Selecionado && x.Documento != null && !x.TipoPagamento.Equals("FATURA")) + select ((DomainBase)x.Documento).Id).ToList() ?? new List(); + idsFaturas = (from x in RenovacaoFiltrado?.Where((Renovacao x) => x.Selecionado && x.Documento != null && x.TipoPagamento.Equals("FATURA")) + select ((DomainBase)x.Documento).Id).ToList() ?? new List(); + idsProspeccoes = (from x in RenovacaoFiltrado?.Where((Renovacao x) => x.Selecionado && x.Prospeccao != null) + select ((DomainBase)x.Prospeccao).Id).ToList() ?? new List(); + if (list.Count == 0 && idsFaturas.Count == 0 && idsProspeccoes.Count == 0) + { + await ShowMessage("É NECESSÁRIO SELECIONAR AO MENOS UM DOCUMENTO"); + return; + } + } + else + { + list = (from x in ProducaoFiltrado?.Where((Producao x) => x.Selecionado && x.Tipo != 2) + select ((DomainBase)x.Documento).Id).ToList() ?? new List(); + idsFaturas = (from x in ProducaoFiltrado?.Where((Producao x) => x.Selecionado && x.Tipo == 2) + select ((DomainBase)x.Documento).Id).ToList() ?? new List(); + if (list.Count == 0 && idsFaturas.Count == 0) + { + await ShowMessage("É NECESSÁRIO SELECIONAR AO MENOS UM DOCUMENTO"); + return; + } + } + List list2 = ((list == null || list.Count <= 0) ? new List() : (await _apoliceServico.BuscarPlanilhaCompleta(list, configFranquia, configSomaPremio))); + List planilha2 = list2; + List list3 = idsFaturas; + list2 = ((list3 == null || list3.Count <= 0) ? new List() : (await _apoliceServico.BuscarPlanilhaCompletaFatura(idsFaturas, Relatorio, Filtros.Inicio, Filtros.Fim, configFranquia, configSomaPremio))); + List planilhaFatura = list2; + List list4 = idsProspeccoes; + list2 = ((list4 == null || list4.Count <= 0) ? new List() : (await _apoliceServico.BuscarPlanilhaCompletaProspeccao(idsProspeccoes))); + List list5 = list2; + if (planilha2 == null || planilhaFatura == null || list5 == null) + { + await ShowMessage("ERRO AO GERAR PLANILHA COMPLETA, TENTE NOVAMENTE MAIS TARDE."); + Loading(isLoading: false); + return; + } + planilha2.AddRange(planilhaFatura); + planilha2.AddRange(list5); + List list6 = planilha2; + if (list6 != null && list6.Count == 0) + { + await ShowMessage("NÃO HÁ DADOS PARA EMISSÃO DA PLANILHA COMPLETA."); + Loading(isLoading: false); + return; + } + planilha2 = (((int)Relatorio == 4) ? planilha2.OrderBy((PlanilhaCompleta x) => x.VigenciaFinal).ToList() : planilha2.OrderBy((PlanilhaCompleta x) => x.VigenciaInicial).ToList()); + string text = ""; + string fileName; + if (Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 41)) + { + FolderBrowserDialog val = new FolderBrowserDialog(); + try + { + if (1 != (int)((CommonDialog)val).ShowDialog()) + { + return; + } + text = val.SelectedPath + "\\"; + Directory.CreateDirectory(text); + } + finally + { + ((IDisposable)val)?.Dispose(); + } + fileName = text + EnumHelper.GetDescription(Relatorio) + " " + Functions.GetNetworkTime().Date.ToShortDateString().Replace("/", "") + ".xlsx"; + } + else + { + text = Path.GetTempPath(); + fileName = $"{text}{Guid.NewGuid()}.xlsx"; + } + (await Funcoes.GerarXls(new XLWorkbook(), "PLANILHA COMPLETA", planilha2, new List())).SaveAs(fileName); + Process.Start(fileName); + Loading(isLoading: false); + } + + public async Task CarregarConfiguracoes() + { + List parametros = new List(); + List list = await new ConfuguracoesServico().BuscarParametros(Relatorio); + Relatorio relatorio = Relatorio; + switch ((int)relatorio) + { + case 0: + case 1: + parametros = Funcoes.ColunasRelatorio(Relatorio, list); + break; + case 2: + parametros = Funcoes.ColunasRelatorio(Relatorio, list); + break; + case 3: + parametros = Funcoes.ColunasRelatorio(Relatorio, list); + break; + case 18: + parametros = Funcoes.ColunasRelatorio(Relatorio, list); + break; + case 4: + parametros = Funcoes.ColunasRelatorio(Relatorio, list); + break; + case 5: + parametros = Funcoes.ColunasRelatorio(Relatorio, list); + break; + case 6: + case 16: + parametros = Funcoes.ColunasRelatorio(Relatorio, list); + break; + case 9: + case 10: + parametros = Funcoes.ColunasRelatorio(Relatorio, list); + break; + case 23: + parametros = Funcoes.ColunasRelatorio(Relatorio, list); + break; + case 8: + parametros = Funcoes.ColunasRelatorio(Relatorio, list); + break; + case 13: + parametros = Funcoes.ColunasRelatorio(Relatorio, list); + break; + case 12: + parametros = Funcoes.ColunasRelatorio(Relatorio, list); + break; + case 14: + parametros = Funcoes.ColunasRelatorio(Relatorio, list); + break; + case 15: + parametros = Funcoes.ColunasRelatorio(Relatorio, list); + break; + case 11: + parametros = Funcoes.ColunasRelatorio(Relatorio, list); + break; + case 17: + parametros = Funcoes.ColunasRelatorio(Relatorio, list); + break; + case 27: + parametros = Funcoes.ColunasRelatorio(Relatorio, list); + break; + case 7: + parametros = Funcoes.ColunasRelatorio(Relatorio, list); + break; + case 19: + parametros = Funcoes.ColunasRelatorio(Relatorio, list); + break; + case 20: + parametros = Funcoes.ColunasRelatorio(Relatorio, list); + break; + case 24: + case 25: + parametros = Funcoes.ColunasRelatorio(Relatorio, list); + break; + case 26: + parametros = Funcoes.ColunasRelatorio(Relatorio, list); + break; + case 28: + parametros = Funcoes.ColunasRelatorio(Relatorio, list); + break; + case 29: + parametros = Funcoes.ColunasRelatorio(Relatorio, list); + break; + } + ParametrosRelatorio = new ObservableCollection(parametros); + ParametrosRelatorioAdicionados = new ObservableCollection(list.OrderBy((ParametrosRelatorio x) => x.Ordem)); + List list2 = await new ConfuguracoesServico().BuscarParametroTotalizacaoAsync(Relatorio); + ParametrosTotalizacao = new ObservableCollection(Funcoes.TotalizacoesRelatorio(Relatorio, list2)); + ParametrosTotalizacaoAdicionados = new ObservableCollection(list2); + } + + public async Task SalvarParametros() + { + if (!(await new ConfuguracoesServico().Salvar(ParametrosRelatorioAdicionados.ToList(), ParametrosRelatorio.ToList()))) + { + return false; + } + if (!(await new ConfuguracoesServico().SalvarTotalizacoes(ParametrosTotalizacaoAdicionados.ToList(), ParametrosTotalizacao.ToList()))) + { + return false; + } + RegistrarAcao("SALVOU CONFIGURAÇÃO DO RELATORIO", Relatorio, Filtros); + await CarregarConfiguracoes(); + return true; + } + + public void AdicionarParametro(ParametrosRelatorio parametro) + { + if (parametro != null && parametro.Header != "SELECIONE UM CAMPO") + { + ParametrosRelatorio.Remove(parametro); + ParametrosRelatorioAdicionados.Add(parametro); + SelectedParametrosRelatorio = ParametrosRelatorio[0]; + } + } + + public void AdicionarTotalizacao(ParametrosTotalizacao parametro) + { + if (parametro != null && parametro.Header != "SELECIONE UMA TOTALIZAÇÃO") + { + ParametrosTotalizacao.Remove(parametro); + ParametrosTotalizacaoAdicionados.Add(parametro); + SelectedParametrosTotalizacao = ParametrosTotalizacao[0]; + } + } + + public void ExcluirParametro(ParametrosRelatorio parametro) + { + if (parametro != null) + { + ParametrosRelatorioAdicionados.Remove(parametro); + ParametrosRelatorio.Add(parametro); + ParametrosRelatorio = new ObservableCollection(ParametrosRelatorio.OrderBy((ParametrosRelatorio x) => x.Header)); + } + } + + public void ExcluirTotalizacao(ParametrosTotalizacao parametro) + { + if (parametro != null) + { + ParametrosTotalizacaoAdicionados.Remove(parametro); + ParametrosTotalizacao.Add(parametro); + ParametrosTotalizacao = new ObservableCollection(ParametrosTotalizacao.OrderBy((ParametrosTotalizacao x) => x.Header)); + } + } + + public void SubirParametro(ParametrosRelatorio parametro) + { + if (parametro != null) + { + int num = ParametrosRelatorioAdicionados.IndexOf(parametro); + if (num != 0) + { + ParametrosRelatorioAdicionados.Move(num, num - 1); + } + } + } + + public void DescerParametro(ParametrosRelatorio parametro) + { + if (parametro != null) + { + int num = ParametrosRelatorioAdicionados.IndexOf(parametro); + if (num != ParametrosRelatorioAdicionados.Count - 1) + { + ParametrosRelatorioAdicionados.Move(num, num + 1); + } + } + } + + internal async Task> Filtrar(string value) + { + return await Task.Run(() => FiltrarUsuario(value)); + } + + public List FiltrarUsuario(string filter) + { + UsuariosFiltrados = (string.IsNullOrWhiteSpace(filter) ? new ObservableCollection(Usuarios) : new ObservableCollection(from x in Usuarios + where ValidationHelper.RemoveDiacritics(x.Nome.Trim()).ToUpper().Contains(ValidationHelper.RemoveDiacritics(filter)) + orderby !x.Excluido descending, x.Nome + select x)); + return UsuariosFiltrados.ToList(); + } + + private void LimparFiltroUsuario() + { + ExtensionMethods.ForEach((IEnumerable)UsuariosFiltrados, (Action)delegate(Usuario x) + { + x.Selecionado = false; + }); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Relatorios/SinteticoViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Relatorios/SinteticoViewModel.cs new file mode 100644 index 0000000..c3adb1d --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Relatorios/SinteticoViewModel.cs @@ -0,0 +1,445 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Diagnostics; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Forms; +using System.Windows.Media; +using ClosedXML.Excel; +using Gestor.Application.Componentes; +using Gestor.Application.Helpers; +using Gestor.Application.Model; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Helpers; +using Gestor.Model.Attributes; +using Gestor.Model.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Relatorios; +using LiveCharts; +using LiveCharts.Definitions.Series; +using LiveCharts.Helpers; +using LiveCharts.Wpf; +using NReco.PdfGenerator; + +namespace Gestor.Application.ViewModels.Relatorios; + +public class SinteticoViewModel : BaseSegurosViewModel +{ + private Visibility _unicaPaginaVisibility = (Visibility)2; + + private Geometry _maximizeRestore = Geometry.Parse((string)Application.Current.Resources[(object)"Restore"]); + + private ObservableCollection _series; + + private string _titulotela = $"RELATÓRIO SINTÉTICO | VERSÃO GESTOR {ApplicationHelper.Versao}"; + + public Visibility UnicaPaginaVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _unicaPaginaVisibility; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _unicaPaginaVisibility = value; + OnPropertyChanged("UnicaPaginaVisibility"); + } + } + + public string Relatorio { get; set; } + + public Geometry MaximizeRestore + { + get + { + return _maximizeRestore; + } + set + { + _maximizeRestore = value; + OnPropertyChanged("MaximizeRestore"); + } + } + + public ObservableCollection Series + { + get + { + return _series; + } + set + { + _series = value; + OnPropertyChanged("Series"); + } + } + + public string Titulotela + { + get + { + return _titulotela; + } + set + { + _titulotela = value; + OnPropertyChanged("Titulotela"); + } + } + + public SinteticoViewModel(List sintetico, string relatorio) + { + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + Relatorio = relatorio; + GerarSintetico(sintetico); + } + + private void GerarSintetico(List sintetico) + { + //IL_00d6: Unknown result type (might be due to invalid IL or missing references) + //IL_00e0: Expected O, but got Unknown + //IL_0117: Unknown result type (might be due to invalid IL or missing references) + //IL_0169: Unknown result type (might be due to invalid IL or missing references) + //IL_016e: Unknown result type (might be due to invalid IL or missing references) + //IL_0180: Unknown result type (might be due to invalid IL or missing references) + //IL_0189: Expected O, but got Unknown + //IL_02f2: Unknown result type (might be due to invalid IL or missing references) + //IL_02f7: Unknown result type (might be due to invalid IL or missing references) + //IL_03f4: Unknown result type (might be due to invalid IL or missing references) + //IL_03f9: Unknown result type (might be due to invalid IL or missing references) + //IL_0203: Unknown result type (might be due to invalid IL or missing references) + //IL_0208: Unknown result type (might be due to invalid IL or missing references) + //IL_031e: Unknown result type (might be due to invalid IL or missing references) + //IL_0356: Unknown result type (might be due to invalid IL or missing references) + //IL_0361: Unknown result type (might be due to invalid IL or missing references) + //IL_0420: Unknown result type (might be due to invalid IL or missing references) + //IL_0449: Unknown result type (might be due to invalid IL or missing references) + //IL_0451: Unknown result type (might be due to invalid IL or missing references) + //IL_045c: Unknown result type (might be due to invalid IL or missing references) + //IL_022f: Unknown result type (might be due to invalid IL or missing references) + //IL_0257: Unknown result type (might be due to invalid IL or missing references) + //IL_025f: Unknown result type (might be due to invalid IL or missing references) + //IL_036f: Unknown result type (might be due to invalid IL or missing references) + //IL_037c: Expected O, but got Unknown + //IL_046a: Unknown result type (might be due to invalid IL or missing references) + //IL_0477: Expected O, but got Unknown + //IL_026d: Unknown result type (might be due to invalid IL or missing references) + //IL_027a: Expected O, but got Unknown + //IL_071b: Unknown result type (might be due to invalid IL or missing references) + //IL_0720: Unknown result type (might be due to invalid IL or missing references) + //IL_072b: Unknown result type (might be due to invalid IL or missing references) + //IL_0733: Unknown result type (might be due to invalid IL or missing references) + //IL_073e: Unknown result type (might be due to invalid IL or missing references) + //IL_0746: Unknown result type (might be due to invalid IL or missing references) + //IL_0589: Unknown result type (might be due to invalid IL or missing references) + //IL_058e: Unknown result type (might be due to invalid IL or missing references) + //IL_0599: Unknown result type (might be due to invalid IL or missing references) + //IL_05a6: Unknown result type (might be due to invalid IL or missing references) + //IL_05ae: Unknown result type (might be due to invalid IL or missing references) + //IL_076e: Unknown result type (might be due to invalid IL or missing references) + //IL_077e: Expected O, but got Unknown + //IL_05cd: Unknown result type (might be due to invalid IL or missing references) + //IL_05dd: Expected O, but got Unknown + UnicaPaginaVisibility = (Visibility)((!(Relatorio == "RELATÓRIO DE FECHAMENTO")) ? 2 : 0); + Series = new ObservableCollection(); + PropertyInfo[] properties = ((object)sintetico.First()).GetType().GetProperties(); + foreach (PropertyInfo parentProperty in properties) + { + if (parentProperty.Name == "ValidationEvent" || parentProperty.Name == "Agrupamento" || sintetico.All((Sintetico s) => ((object)s).GetType().GetProperty(parentProperty.Name)?.GetValue(s, null) == null)) + { + continue; + } + object obj = parentProperty.GetCustomAttributes(typeof(DescriptionAttribute), inherit: true).FirstOrDefault(); + if (obj == null) + { + continue; + } + string description = ((DescriptionAttribute)obj).Description; + SinteticoSource sinteticoSource = new SinteticoSource + { + Titulo = description, + Colecao = new SeriesCollection(), + Lista = new ObservableCollection() + }; + object obj2 = parentProperty.GetCustomAttributes(typeof(TipoAttribute), inherit: true).FirstOrDefault(); + string text = ""; + if (obj2 != null) + { + text = ((TipoAttribute)obj2).Description; + } + sintetico = sintetico.OrderByDescending((Sintetico x) => parentProperty.GetValue(x, null)).ToList(); + foreach (Sintetico x2 in sintetico) + { + bool flag = false; + PieSeries val = new PieSeries + { + Title = x2.Agrupamento, + DataLabels = false + }; + IChartValues values; + if (!(text == "PERCENTUAL")) + { + if (!(text == "VALOR")) + { + flag = (int)parentProperty.GetValue(x2) < 0; + ChartValues obj3 = new ChartValues(); + ((NoisyCollection)(object)obj3).Add(Math.Abs((int)parentProperty.GetValue(x2))); + values = (IChartValues)(object)obj3; + sinteticoSource.Lista.Add(new ValorSintetico + { + Indice = x2.Agrupamento + (flag ? " (-)" : ""), + Valor = decimal.Parse(parentProperty.GetValue(x2).ToString()), + Formato = text, + Sinal = (Sinal)(flag ? 1 : 0), + NomeRelatorio = description + }); + ((Series)val).LabelPoint = (ChartPoint chartPoint) => ((int)parentProperty.GetValue(x2)).ToString("n"); + } + else + { + flag = (decimal)parentProperty.GetValue(x2) < 0m; + ChartValues obj4 = new ChartValues(); + ((NoisyCollection)(object)obj4).Add(Math.Abs((decimal)parentProperty.GetValue(x2))); + values = (IChartValues)(object)obj4; + sinteticoSource.Lista.Add(new ValorSintetico + { + Indice = x2.Agrupamento + (flag ? " (-)" : ""), + Valor = Math.Round((decimal)parentProperty.GetValue(x2), 2), + Formato = text, + Unidate = "R$", + Sinal = (Sinal)(flag ? 1 : 0), + NomeRelatorio = description + }); + ((Series)val).LabelPoint = (ChartPoint chartPoint) => ((decimal)parentProperty.GetValue(x2)).ToString("n2"); + } + } + else + { + flag = (decimal)parentProperty.GetValue(x2) < 0m; + ChartValues obj5 = new ChartValues(); + ((NoisyCollection)(object)obj5).Add(Math.Abs((decimal)parentProperty.GetValue(x2))); + values = (IChartValues)(object)obj5; + sinteticoSource.Lista.Add(new ValorSintetico + { + Indice = x2.Agrupamento + (flag ? " (-)" : ""), + Valor = Math.Round((decimal)parentProperty.GetValue(x2) * 0.01m, 2), + Unidate = "%", + Sinal = (Sinal)(flag ? 1 : 0), + NomeRelatorio = description + }); + ((Series)val).LabelPoint = (ChartPoint chartPoint) => ((decimal)parentProperty.GetValue(x2)).ToString("n2"); + } + ((Series)val).Values = values; + ((NoisyCollection)(object)sinteticoSource.Colecao).Add((ISeriesView)(object)val); + } + if (obj2 != null && !(text == "PERCENTUAL")) + { + if (!(text == "VALOR")) + { + if (!Relatorio.Equals("RELATÓRIO DE FECHAMENTO")) + { + int num = sintetico.Sum((Sintetico x) => (int)parentProperty.GetValue(x, null)); + if (num != 0) + { + foreach (ValorSintetico listum in sinteticoSource.Lista) + { + listum.Porcentagem = (100m * listum.Valor / (decimal)num).ToString("F") + "%"; + } + } + sinteticoSource.Lista.Add(new ValorSintetico + { + Indice = "TOTAL", + Valor = num, + Formato = text, + Sinal = (Sinal)(sintetico.Sum((Sintetico x) => (int)parentProperty.GetValue(x, null)) < 0), + Porcentagem = "100%" + }); + } + else + { + int num2 = sintetico.Sum((Sintetico x) => (int)parentProperty.GetValue(x, null)); + if (num2 != 0) + { + foreach (ValorSintetico listum2 in sinteticoSource.Lista) + { + listum2.Porcentagem = (100m * listum2.Valor / (decimal)num2).ToString("F") + "%"; + } + } + } + } + else if (!Relatorio.Equals("RELATÓRIO DE FECHAMENTO")) + { + decimal num3 = Math.Round(sintetico.Sum((Sintetico x) => (decimal)parentProperty.GetValue(x, null)), 2); + if (num3 != 0m) + { + foreach (ValorSintetico listum3 in sinteticoSource.Lista) + { + listum3.Porcentagem = (100m * listum3.Valor / num3).ToString("F") + "%"; + } + } + sinteticoSource.Lista.Add(new ValorSintetico + { + Indice = "TOTAL", + Valor = num3, + Unidate = "R$", + Formato = text, + Sinal = (Sinal)((sintetico.Sum((Sintetico x) => (decimal)parentProperty.GetValue(x, null)) < 0m) ? 1 : 0), + Porcentagem = "100%" + }); + } + else + { + decimal num4 = Math.Round(sintetico.Sum((Sintetico x) => (decimal)parentProperty.GetValue(x, null)), 2); + if (num4 != 0m) + { + foreach (ValorSintetico listum4 in sinteticoSource.Lista) + { + listum4.Porcentagem = (100m * listum4.Valor / num4).ToString("F") + "%"; + } + } + } + } + Series.Add(sinteticoSource); + } + } + + public async Task Print(SinteticoSource sintetico) + { + string grafico = Funcoes.GerarGrafico(sintetico.Lista.ToList()); + string dados = await Funcoes.GenerateTable(GerarRelacao(sintetico.Lista.ToList()), new List(), grafico: true); + string value = Funcoes.ExportarHtml(new TipoRelatorio + { + Nome = sintetico.Titulo, + Inicio = (sintetico.DateStart ?? DateTime.MinValue), + Fim = (sintetico.DateFinal ?? DateTime.MinValue) + }, dados, "60", "landscape", search: false, grafico); + string tempPath = Path.GetTempPath(); + string text = string.Format("{0}{1}_{2:ddMMyyyyhhmmss}.html", tempPath, new Regex("[" + Regex.Escape(new string(Path.GetInvalidFileNameChars()) + new string(Path.GetInvalidPathChars())) + "]").Replace(Relatorio, ""), Funcoes.GetNetworkTime()); + StreamWriter streamWriter = new StreamWriter(text, append: true, Encoding.UTF8); + streamWriter.Write(value); + streamWriter.Close(); + Process.Start(text); + } + + public async Task PrintUnica(SinteticoSource sintetico) + { + List> list = new List>(); + foreach (SinteticoSource item in Series) + { + list.Add(item.Lista.ToList()); + } + string grafico = Funcoes.GerarGraficoUnico(list); + string dados = await Funcoes.GenerateMultipleTable(GerarRelacao(list), new List(), grafico: true); + string value = Funcoes.ExportarMultipleHtml(new TipoRelatorio + { + Nome = "RELATÓRIOS", + Inicio = (sintetico.DateStart ?? DateTime.MinValue), + Fim = (sintetico.DateFinal ?? DateTime.MinValue) + }, dados, "60", "landscape", search: false, grafico); + string tempPath = Path.GetTempPath(); + string text = string.Format("{0}{1}_{2:ddMMyyyyhhmmss}.html", tempPath, new Regex("[" + Regex.Escape(new string(Path.GetInvalidFileNameChars()) + new string(Path.GetInvalidPathChars())) + "]").Replace(Relatorio, ""), Funcoes.GetNetworkTime()); + StreamWriter streamWriter = new StreamWriter(text, append: true, Encoding.UTF8); + streamWriter.Write(value); + streamWriter.Close(); + Process.Start(text); + } + + private static List GerarRelacao(List lista) + { + return ((IEnumerable)lista).Select((Func)((ValorSintetico x) => new Listagem + { + Agrupamento = x.Indice, + Valor = ((x.Formato == "VALOR") ? x.Valor.ToString("c2") : ((x.Formato == "PERCENTUAL") ? x.Valor.ToString("p2") : x.Valor.ToString(new CultureInfo("pt-BR")))), + NomeRelatorio = x.NomeRelatorio + })).ToList(); + } + + private static List> GerarRelacao(List> listas) + { + List> list = new List>(); + foreach (List lista in listas) + { + list.Add(GerarRelacao(lista)); + } + return list; + } + + public async Task GerarPdf(SinteticoSource sintetico) + { + string dados = await Funcoes.GenerateTable(GerarRelacao(sintetico.Lista.ToList()), new List()); + string text = Funcoes.ExportarHtml(new TipoRelatorio + { + Nome = sintetico.Titulo, + Inicio = DateTime.MinValue, + Fim = DateTime.MinValue + }, dados); + NRecoHtmlToPdfConverter nRecoHtmlToPdfConverter = new NRecoHtmlToPdfConverter(); + ((HtmlToPdfConverter)nRecoHtmlToPdfConverter).Orientation = (PageOrientation)1; + ((HtmlToPdfConverter)nRecoHtmlToPdfConverter).Zoom = 0.5f; + byte[] bytes = ((HtmlToPdfConverter)nRecoHtmlToPdfConverter).GeneratePdf(text); + SaveFileDialog sfd = new SaveFileDialog(); + try + { + ((FileDialog)sfd).Filter = "All Files|*.*"; + ((FileDialog)sfd).FileName = $"RELATORIO FINANCEIRO_{Funcoes.GetNetworkTime():ddMMyyyyhhmmss}"; + if (1 != (int)((CommonDialog)sfd).ShowDialog()) + { + return; + } + if (File.Exists(((FileDialog)sfd).FileName + ".pdf")) + { + await ShowMessage("JÁ EXISTE UM ARQUIVO COM O NOME DE " + ((FileDialog)sfd).FileName + ".pdf NA PASTA SELECIONADA. " + Environment.NewLine + "TENTE NOVAMENTE EM OUTRA PASTA."); + return; + } + File.WriteAllBytes(((FileDialog)sfd).FileName + ".pdf", bytes); + Process.Start(((FileDialog)sfd).FileName + ".pdf"); + } + finally + { + ((IDisposable)sfd)?.Dispose(); + } + } + + public async Task GerarExcel(SinteticoSource sintetico) + { + List analitico = GerarRelacao(sintetico.Lista.ToList()); + string text = ""; + string fileName; + if (Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 41)) + { + FolderBrowserDialog val = new FolderBrowserDialog(); + try + { + if (1 != (int)((CommonDialog)val).ShowDialog()) + { + return; + } + text = val.SelectedPath + "\\"; + Directory.CreateDirectory(text); + } + finally + { + ((IDisposable)val)?.Dispose(); + } + fileName = text + "SINTETICO " + Functions.GetNetworkTime().Date.ToShortDateString().Replace("/", "") + ".xlsx"; + } + else + { + text = Path.GetTempPath(); + fileName = $"{text}{Guid.NewGuid()}.xlsx"; + } + (await Funcoes.GerarXls(new XLWorkbook(), "SINTÉTICO", analitico)).SaveAs(fileName); + Process.Start(fileName); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Seguros.Itens/AeronauticoViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Seguros.Itens/AeronauticoViewModel.cs new file mode 100644 index 0000000..54e530c --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Seguros.Itens/AeronauticoViewModel.cs @@ -0,0 +1,435 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; +using Gestor.Application.Actions; +using Gestor.Application.Componentes; +using Gestor.Application.Servicos.Seguros.Itens; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Seguros.Itens; + +public class AeronauticoViewModel : ItemViewModel, IDisposable +{ + private new readonly ItemServico _itemServico; + + private readonly AeronauticoServico _servico; + + private bool _allowAlterarExcluir = true; + + private object _cobertura; + + private string _codigoItem; + + private Item _selectedItem = new Item(); + + private bool _aero = true; + + private string _serie = "REGISTRO"; + + private string _prefixo = "PREFIXO"; + + private string _marinaAero = "AERÓDROMO"; + + private Item ItemSelecionado { get; set; } + + private Ramo Ramo { get; } + + public bool Invoke { get; set; } + + public bool AllowAlterarExcluir + { + get + { + return _allowAlterarExcluir; + } + set + { + _allowAlterarExcluir = value; + OnPropertyChanged("AllowAlterarExcluir"); + } + } + + public object Cobertura + { + get + { + return _cobertura; + } + set + { + _cobertura = value; + OnPropertyChanged("Cobertura"); + } + } + + public string CodigoItem + { + get + { + return _codigoItem; + } + set + { + _codigoItem = value; + OnPropertyChanged("CodigoItem"); + } + } + + public Item SelectedItem + { + get + { + return _selectedItem; + } + set + { + _selectedItem = value; + VerificarEnables((value != null) ? new long?(((DomainBase)value).Id) : null); + OnPropertyChanged("SelectedItem"); + } + } + + public bool Aero + { + get + { + return _aero; + } + set + { + _aero = value; + OnPropertyChanged("Aero"); + } + } + + public string Serie + { + get + { + return _serie; + } + set + { + _serie = value; + OnPropertyChanged("Serie"); + } + } + + public string Prefixo + { + get + { + return _prefixo; + } + set + { + _prefixo = value; + OnPropertyChanged("Prefixo"); + } + } + + public string MarinaAero + { + get + { + return _marinaAero; + } + set + { + _marinaAero = value; + OnPropertyChanged("MarinaAero"); + } + } + + public AeronauticoViewModel(bool substituir = false, ManutencaoItem manutencao = null, Item itemSelecionado = null, Ramo ramo = null, bool endossoRenovacao = false) + { + //IL_0008: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Expected O, but got Unknown + //IL_0088: Unknown result type (might be due to invalid IL or missing references) + Invoke = itemSelecionado == null; + ItemSelecionado = itemSelecionado ?? ConsultaViewModel.ItemSelecionado; + Ramo = ramo ?? ConsultaViewModel.DocumentoSelecionado.Controle.Ramo; + if (Invoke) + { + ItemSelecionado = (Item)(((object)ItemSelecionado) ?? ((object)new Item())); + ItemSelecionado.Documento = ConsultaViewModel.DocumentoSelecionado; + } + _itemServico = new ItemServico(); + _servico = new AeronauticoServico(); + Seleciona(ItemSelecionado); + if (substituir) + { + Substituir(ItemSelecionado); + } + if (manutencao != null) + { + Manter(ItemSelecionado, manutencao); + } + AllowAlterarExcluir = !endossoRenovacao; + CarregaCobertura(); + } + + public void CarregaCobertura() + { + CoberturaViewModel.Item = ItemSelecionado; + CoberturaViewModel.Ramo = Ramo; + Cobertura = new CoberturaView(CoberturaViewModel); + } + + public void Descarregar() + { + Cobertura = null; + } + + public void Manter(Item item, ManutencaoItem manutencao) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Invalid comparison between Unknown and I4 + if ((int)manutencao.Tipo == 1) + { + base.ItemSubstituido = item; + } + Manter(manutencao); + base.Mantido = true; + } + + public void Manter(ManutencaoItem manutencao) + { + //IL_0077: Unknown result type (might be due to invalid IL or missing references) + List obj = CoberturaViewModel.Coberturas?.ToList(); + ((DomainBase)SelectedItem).Id = 0L; + ((DomainBase)SelectedItem.Aeronautico).Id = 0L; + Item selectedItem = SelectedItem; + Item itemSubstituido = base.ItemSubstituido; + selectedItem.Substituicao = ((itemSubstituido != null) ? new long?(((DomainBase)itemSubstituido).Id) : null); + SelectedItem.Documento = ItemSelecionado.Documento; + if ((int)manutencao.Tipo == 0) + { + SelectedItem.Sinistrado = false; + SelectedItem.Status = ""; + SelectedItem.Sinistro = null; + SelectedItem.Sinistros = null; + } + CoberturaViewModel.CarregaPadrao(); + CoberturaViewModel.Coberturas = new ObservableCollection(); + obj?.ForEach(delegate(Cobertura x) + { + x.Item = SelectedItem; + CoberturaViewModel.Coberturas.Add(x); + }); + Alterar(alterar: true); + } + + public async void Substituir(Item item) + { + base.ItemSubstituido = item; + await Incluir(substituir: true); + } + + private async void Seleciona(Item item) + { + Loading(isLoading: true); + await PermissaoTela((TipoTela)3); + await SelecionaItem(item); + Loading(isLoading: false); + } + + public async Task SelecionaItem(Item item, bool registrar = true) + { + if (item != null && LastAccessId == ((DomainBase)item).Id && (int)LastAccessTela == 9) + { + return; + } + base.Mantido = false; + if (!new List { 13L }.Contains(((DomainBase)Ramo).Id)) + { + return; + } + CoberturaViewModel.Ramo = Ramo; + if (CoberturaViewModel.CoberturasPadrao == null) + { + await CoberturaViewModel.SelectionaCoberturas(); + } + if (item == null || ((DomainBase)item).Id == 0L) + { + SelectedItem = null; + CoberturaViewModel.Coberturas = null; + base.IsVisible = (Visibility)0; + return; + } + Loading(isLoading: true); + item = await _itemServico.BuscarItemPorIdAsync(((DomainBase)item).Id); + Item val = item; + val.Aeronautico = await _itemServico.BuscaAeronautico(((DomainBase)item).Id); + SelectedItem = item; + ((DomainBase)SelectedItem).Initialize(); + Initialized = true; + CoberturaViewModel.Item = item; + await CoberturaViewModel.CancelarAlteracao(); + if (registrar) + { + RegistrarAcao("ACESSOU ITEM DE DESCRIÇÃO \"" + SelectedItem.Descricao + "\"", ((DomainBase)SelectedItem).Id, (TipoTela)3, $"ID ITEM: {((DomainBase)SelectedItem).Id}\nID DOCUMENTO: {((DomainBase)SelectedItem.Documento).Id}\nRAMO: {SelectedItem.Documento.Controle.Ramo.Nome}\nCLIENTE: {SelectedItem.Documento.Controle.Cliente.Nome}\nID CLIENTE: {((DomainBase)SelectedItem.Documento.Controle.Cliente).Id}"); + } + LastAccessId = ((DomainBase)SelectedItem).Id; + LastAccessTela = (TipoTela)3; + CodigoItem = ((DomainBase)SelectedItem).Id.ToString(); + Loading(isLoading: false); + } + + public async Task Incluir(bool substituir = false) + { + List coberturas = ((CoberturaViewModel.Coberturas == null) ? CoberturaViewModel.CarregaCoberturaPadrao().ToList() : CoberturaViewModel.Coberturas.ToList()); + Item val = new Item(); + val.Documento = ItemSelecionado.Documento; + Item val2 = val; + int? ordem = (substituir ? base.ItemSubstituido.Ordem : new int?(await QuantidadeDeItens(((DomainBase)ItemSelecionado.Documento.Controle).Id))); + val2.Ordem = ordem; + val.Aeronautico = new Aeronautico + { + Tipo = (TipoAeronautico)1 + }; + val.Substituicao = (substituir ? new long?(((DomainBase)base.ItemSubstituido).Id) : null); + Item item = val; + if (item.Ordem.GetValueOrDefault() == 2 && !(await ShowMessage("ESTA APÓLICE SERÁ UMA FROTA, DESEJA CONTINUAR?", "SIM", "NÃO"))) + { + return; + } + bool flag = substituir; + if (flag) + { + flag = await ShowMessage("DESEJA COPIAR OS DADOS DO ITEM?", "SIM", "NÃO"); + } + if (flag) + { + ((DomainBase)SelectedItem).Id = 0L; + SelectedItem.Documento = ItemSelecionado.Documento; + } + else + { + SelectedItem = item; + SelectedItem.Aeronautico.Item = item; + } + flag = item.Ordem > 1; + if (flag) + { + flag = await ShowMessage("DESEJA REPLICAR AS COBERTURAS DO ITEM SELECIONADO?", "SIM", "NÃO"); + } + if (flag) + { + CoberturaViewModel.Coberturas = new ObservableCollection(); + coberturas.ForEach(delegate(Cobertura x) + { + x.Item = SelectedItem; + CoberturaViewModel.Coberturas.Add(x); + }); + } + else + { + CoberturaViewModel.CarregaPadrao(); + } + if (substituir) + { + CoberturaViewModel.Coberturas = new ObservableCollection(); + coberturas.ForEach(delegate(Cobertura x) + { + x.Item = SelectedItem; + CoberturaViewModel.Coberturas.Add(x); + }); + } + Alterar(alterar: true); + } + + public async Task>> Salvar() + { + SelectedItem.Descricao = $"{SelectedItem.Aeronautico.Tipo} - FABRICANTE: {SelectedItem.Aeronautico.Fabricante} - MODELO: {SelectedItem.Aeronautico.Modelo}"; + List> list = SelectedItem.Validate(); + if (list.Count > 0) + { + return list; + } + Item selectedItem = SelectedItem; + selectedItem.Coberturas = await CoberturaViewModel.LimpaCoberturas(); + string status = ((SelectedItem.Documento.Ordem <= 0) ? "" : (base.Mantido ? $"ITEM ALTERADO NO ENDOSSO ORDEM {SelectedItem.Documento.Ordem}" : ((base.ItemSubstituido != null) ? $"SUBSTITUIÇÃO DO ITEM {base.ItemSubstituido.Ordem} NO ENDOSSO ORDEM {SelectedItem.Documento.Ordem}" : $"ITEM INCLUÍDO NO ENDOSSO ORDEM {SelectedItem.Documento.Ordem}"))); + if (((DomainBase)SelectedItem).Id == 0L) + { + SelectedItem.Status = status; + } + string acao = ((((DomainBase)SelectedItem).Id == 0L) ? "INCLUIU" : "ALTEROU"); + SelectedItem = await _itemServico.Save(SelectedItem); + if (!_itemServico.Sucesso) + { + return null; + } + if (base.ItemSubstituido != null) + { + string descricao = (base.Mantido ? $"ITEM ALTERADO NO ENDOSSO ORDEM {SelectedItem.Documento.Ordem}" : $"ITEM SUBSTITUIDO NO ENDOSSO ORDEM {SelectedItem.Documento.Ordem}"); + await _itemServico.Substituir(base.ItemSubstituido, ((DomainBase)SelectedItem).Id, descricao); + } + base.Mantido = false; + await SelecionaItem(SelectedItem, registrar: false); + ItemSelecionado = SelectedItem; + if (Invoke) + { + ConsultaViewModel.ItemSelecionado = SelectedItem; + } + ToggleSnackBar(Ramo.Nome + " SALVO COM SUCESSO"); + RegistrarAcao(acao + " ITEM DE DESCRIÇÃO \"" + SelectedItem.Descricao + "\"", ((DomainBase)SelectedItem).Id, (TipoTela)3, $"ID ITEM: {((DomainBase)SelectedItem).Id}\nID DOCUMENTO: {((DomainBase)SelectedItem.Documento).Id}\nRAMO: {SelectedItem.Documento.Controle.Ramo.Nome}\nCLIENTE: {SelectedItem.Documento.Controle.Cliente.Nome}\nID CLIENTE: {((DomainBase)SelectedItem.Documento.Controle.Cliente).Id}"); + Alterar(alterar: false); + return null; + } + + public async void CancelarAlteracao() + { + Loading(isLoading: true); + await SelecionaItem(ItemSelecionado, registrar: false); + await CoberturaViewModel.CancelarAlteracao(); + Alterar(alterar: false); + Loading(isLoading: false); + } + + public async Task Excluir() + { + if (SelectedItem == null || ((DomainBase)SelectedItem).Id == 0L) + { + return false; + } + if (!(await ShowMessage("DESEJA EXCLUIR?", "SIM", "NÃO"))) + { + return false; + } + Loading(isLoading: true); + bool num = await _servico.Delete(SelectedItem); + Loading(isLoading: false); + if (!num) + { + await ShowMessage("NÃO POSSÍVEL EXCLUIR O ITEM"); + return false; + } + RegistrarAcao("EXCLUIU ITEM DE DESCRIÇÃO \"" + SelectedItem.Descricao + "\"", ((DomainBase)SelectedItem).Id, (TipoTela)3, $"ID ITEM: {((DomainBase)SelectedItem).Id}\nID DOCUMENTO: {((DomainBase)SelectedItem.Documento).Id}\nRAMO: {SelectedItem.Documento.Controle.Ramo.Nome}\nCLIENTE: {SelectedItem.Documento.Controle.Cliente.Nome}\nID CLIENTE: {((DomainBase)SelectedItem.Documento.Controle.Cliente).Id}"); + ToggleSnackBar(Ramo.Nome + " EXCLUÍDO COM SUCESSO"); + return true; + } + + public void UpdateAero() + { + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + Aero = ValidationHelper.GetCategory((Enum)(object)SelectedItem.Aeronautico.Tipo) == "Aero"; + Serie = (Aero ? "REGISTRO" : "SÉRIE"); + Prefixo = (Aero ? "PREFIXO" : "NOME"); + MarinaAero = (Aero ? "AERÓDROMO" : "MARINA"); + } + + public void Dispose() + { + Gestor.Application.Actions.Actions.UpdateItem = (Action)Delegate.Remove(Gestor.Application.Actions.Actions.UpdateItem, new Action(Seleciona)); + Gestor.Application.Actions.Actions.SubstituirItem = (Action)Delegate.Remove(Gestor.Application.Actions.Actions.SubstituirItem, new Action(Substituir)); + Gestor.Application.Actions.Actions.ManterItem = (Action)Delegate.Remove(Gestor.Application.Actions.Actions.ManterItem, new Action(Manter)); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Seguros.Itens/AutoViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Seguros.Itens/AutoViewModel.cs new file mode 100644 index 0000000..5de8d10 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Seguros.Itens/AutoViewModel.cs @@ -0,0 +1,1266 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Data; +using System.Globalization; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Forms; +using ClosedXML.Excel; +using Gestor.Application.Actions; +using Gestor.Application.Componentes; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Seguros.Itens; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.Helper; +using Microsoft.Office.Interop.Excel; + +namespace Gestor.Application.ViewModels.Seguros.Itens; + +public class AutoViewModel : ItemViewModel, IDisposable +{ + private new readonly ItemServico _itemServico; + + private readonly AutoServico _servico; + + private bool _allowAlterarExcluir = true; + + private Visibility _isVisiblePorcentagemReferencia = (Visibility)2; + + private Visibility _isVisibleValorDeterminado = (Visibility)2; + + private object _cobertura; + + private List _combustivel = ((Combustivel[])Enum.GetValues(typeof(Combustivel))).OrderBy((Combustivel x) => ValidationHelper.GetCategory((Enum)(object)x)).ToList(); + + private Item _selectedItem = new Item(); + + private List _fabricantes; + + private Fabricante _selectedFabricante; + + private string _codigoItem; + + private Categoria? _categocia; + + private UsoVeiculo? _usoVeiculo; + + private Item ItemSelecionado { get; set; } + + private Ramo Ramo { get; } + + public bool Invoke { get; set; } + + public bool AllowAlterarExcluir + { + get + { + return _allowAlterarExcluir; + } + set + { + _allowAlterarExcluir = value; + OnPropertyChanged("AllowAlterarExcluir"); + } + } + + public Visibility IsVisiblePorcentagemReferencia + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _isVisiblePorcentagemReferencia; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _isVisiblePorcentagemReferencia = value; + OnPropertyChanged("IsVisiblePorcentagemReferencia"); + } + } + + public Visibility IsVisibleValorDeterminado + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _isVisibleValorDeterminado; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _isVisibleValorDeterminado = value; + OnPropertyChanged("IsVisibleValorDeterminado"); + } + } + + public object Cobertura + { + get + { + return _cobertura; + } + set + { + _cobertura = value; + OnPropertyChanged("Cobertura"); + } + } + + public List Combustivel + { + get + { + return _combustivel; + } + set + { + _combustivel = value; + OnPropertyChanged("Combustivel"); + } + } + + public Item SelectedItem + { + get + { + return _selectedItem; + } + set + { + _selectedItem = value; + VerificarEnables((value != null) ? new long?(((DomainBase)value).Id) : null); + OnPropertyChanged("SelectedItem"); + } + } + + public List Fabricantes + { + get + { + return _fabricantes; + } + set + { + _fabricantes = value; + OnPropertyChanged("Fabricantes"); + } + } + + public Fabricante SelectedFabricante + { + get + { + return _selectedFabricante; + } + set + { + _selectedFabricante = value; + OnPropertyChanged("SelectedFabricante"); + } + } + + public string CodigoItem + { + get + { + return _codigoItem; + } + set + { + _codigoItem = value; + OnPropertyChanged("CodigoItem"); + } + } + + public Categoria? Categoria + { + get + { + return _categocia; + } + set + { + _categocia = value; + Item selectedItem = SelectedItem; + if (((selectedItem != null) ? selectedItem.Auto : null) != null) + { + SelectedItem.Auto.Categoria = value; + } + OnPropertyChanged("Categoria"); + } + } + + public UsoVeiculo? UsoVeiculo + { + get + { + return _usoVeiculo; + } + set + { + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + //IL_0008: Invalid comparison between Unknown and I4 + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Invalid comparison between Unknown and I4 + if ((int)value.GetValueOrDefault() == 2 || (int)value.GetValueOrDefault() == 3) + { + SelectedItem.Auto.Categoria = (Categoria)3; + Categoria = (Categoria)3; + } + Item selectedItem = SelectedItem; + if (((selectedItem != null) ? selectedItem.Auto : null) != null && value.HasValue) + { + SelectedItem.Auto.UsoVeiculo = value; + } + _usoVeiculo = value; + OnPropertyChanged("UsoVeiculo"); + } + } + + public AutoViewModel(bool substituir = false, ManutencaoItem manutencao = null, Item itemSelecionado = null, Ramo ramo = null, bool endossoRenovacao = false) + { + //IL_0009: Unknown result type (might be due to invalid IL or missing references) + //IL_0010: Unknown result type (might be due to invalid IL or missing references) + //IL_0059: Unknown result type (might be due to invalid IL or missing references) + //IL_0063: Expected O, but got Unknown + //IL_00b1: Unknown result type (might be due to invalid IL or missing references) + Invoke = itemSelecionado == null; + ItemSelecionado = itemSelecionado ?? ConsultaViewModel.ItemSelecionado; + Ramo = ramo ?? ConsultaViewModel.DocumentoSelecionado.Controle.Ramo; + if (Invoke) + { + ItemSelecionado = (Item)(((object)ItemSelecionado) ?? ((object)new Item())); + ItemSelecionado.Documento = ConsultaViewModel.DocumentoSelecionado; + } + _itemServico = new ItemServico(); + _servico = new AutoServico(); + Seleciona(ItemSelecionado); + if (substituir) + { + Substituir(ItemSelecionado); + } + if (manutencao != null) + { + Manter(ItemSelecionado, manutencao); + } + AllowAlterarExcluir = !endossoRenovacao; + CarregaCobertura(); + } + + public void CarregaCobertura() + { + CoberturaViewModel.Item = ItemSelecionado; + CoberturaViewModel.Ramo = Ramo; + Cobertura = new CoberturaView(CoberturaViewModel); + } + + public void Descarregar() + { + Cobertura = null; + } + + private void WorkOnSelectedAuto(Auto value) + { + if (value != null && ((DomainBase)value).Id != 0L) + { + SelectedFabricante = ((IEnumerable)Fabricantes).FirstOrDefault((Func)delegate(Fabricante x) + { + int id = x.Id; + Fabricante fabricante = value.Fabricante; + return id == ((fabricante != null) ? new int?(fabricante.Id) : null); + }); + } + } + + public async void Seleciona(Item item) + { + Loading(isLoading: true); + await PermissaoTela((TipoTela)3); + await SelecionaItem(item); + Loading(isLoading: false); + } + + public async void Substituir(Item item) + { + base.ItemSubstituido = item; + await Incluir(substituir: true); + } + + public void Manter(Item item, ManutencaoItem manutencao) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Invalid comparison between Unknown and I4 + if ((int)manutencao.Tipo == 1) + { + base.ItemSubstituido = item; + } + Manter(manutencao); + base.Mantido = true; + } + + public async Task SelecionaItem(Item item, bool registrar = true) + { + if (item != null && LastAccessId == ((DomainBase)item).Id && (int)LastAccessTela == 9) + { + return; + } + base.Mantido = false; + Fabricantes = Recursos.Fabricantes; + if (!new List { 5L, 37L }.Contains(((DomainBase)Ramo).Id)) + { + return; + } + CoberturaViewModel.Ramo = Ramo; + if (CoberturaViewModel.CoberturasPadrao == null) + { + await CoberturaViewModel.SelectionaCoberturas(); + } + if (item == null || ((DomainBase)item).Id == 0L) + { + SelectedItem = null; + CoberturaViewModel.Coberturas = null; + base.IsVisible = (Visibility)0; + return; + } + Loading(isLoading: true); + item = await _itemServico.BuscarItemPorIdAsync(((DomainBase)item).Id); + Item val = item; + val.Auto = await _itemServico.BuscaAuto(((DomainBase)item).Id); + SelectedItem = item; + ((DomainBase)SelectedItem).Initialize(); + Initialized = true; + WorkOnSelectedAuto(SelectedItem.Auto); + CoberturaViewModel.Item = item; + await CoberturaViewModel.CancelarAlteracao(); + if (registrar) + { + RegistrarAcao("ACESSOU ITEM DE DESCRIÇÃO \"" + SelectedItem.Descricao + "\"", ((DomainBase)SelectedItem).Id, (TipoTela)3, $"ID ITEM: {((DomainBase)SelectedItem).Id}\nID DOCUMENTO: {((DomainBase)SelectedItem.Documento).Id}\nRAMO: {SelectedItem.Documento.Controle.Ramo.Nome}\nCLIENTE: {SelectedItem.Documento.Controle.Cliente.Nome}\nID CLIENTE: {((DomainBase)SelectedItem.Documento.Controle.Cliente).Id}"); + } + LastAccessId = ((DomainBase)SelectedItem).Id; + LastAccessTela = (TipoTela)3; + CodigoItem = ((DomainBase)SelectedItem).Id.ToString(); + UsoVeiculo = SelectedItem.Auto.UsoVeiculo; + Categoria = SelectedItem.Auto.Categoria; + Loading(isLoading: false); + } + + public async Task>> Validate() + { + List> errors = new List>(); + if (string.IsNullOrEmpty(SelectedItem.Auto.Chassi)) + { + return errors; + } + if (Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 26)) + { + return errors; + } + Documento val = await new AutoServico().BuscarAuto(SelectedItem.Auto.Chassi, ((DomainBase)SelectedItem.Auto).Id, SelectedItem.Documento.Vigencia1, SelectedItem.Documento.Vigencia2, ((DomainBase)SelectedItem.Documento.Controle.Seguradora).Id); + if (val == null) + { + return errors; + } + if (!AllowAlterarExcluir && ((DomainBase)SelectedItem.Documento.Controle).Id == ((DomainBase)val.Controle).Id) + { + return errors; + } + errors.Add(new KeyValuePair("Chassi", "CHASSI JÁ CADASTRADO NA APÓLICE " + val.Apolice + " DO CLIENTE " + val.Controle.Cliente.Nome + ".")); + return errors; + } + + public async Task>> Validate(Item item) + { + List> errors = new List>(); + if (string.IsNullOrEmpty(item.Auto.Chassi)) + { + return errors; + } + if (Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 26)) + { + return errors; + } + Documento val = await new AutoServico().BuscarAuto(item.Auto.Chassi, ((DomainBase)item.Auto).Id, item.Documento.Vigencia1, item.Documento.Vigencia2, ((DomainBase)item.Documento.Controle.Seguradora).Id); + if (val == null) + { + return errors; + } + if (!AllowAlterarExcluir && ((DomainBase)item.Documento.Controle).Id == ((DomainBase)val.Controle).Id) + { + return errors; + } + errors.Add(new KeyValuePair("Chassi", "CHASSI JÁ CADASTRADO NA APÓLICE " + val.Apolice + " DO CLIENTE " + val.Controle.Cliente.Nome + ".")); + return errors; + } + + public async Task>> Salvar() + { + SelectedItem.Auto.Placa = ((!string.IsNullOrEmpty(SelectedItem.Auto.Placa)) ? ValidationHelper.FormataPlaca(SelectedItem.Auto.Placa) : string.Empty); + Item selectedItem = SelectedItem; + string[] array = new string[7]; + Fabricante fabricante = SelectedItem.Auto.Fabricante; + array[0] = ((fabricante != null) ? fabricante.Descricao : null); + array[1] = " "; + array[2] = SelectedItem.Auto.Modelo; + array[3] = " / "; + array[4] = SelectedItem.Auto.Chassi; + array[5] = " / "; + array[6] = SelectedItem.Auto.Placa; + selectedItem.Descricao = string.Concat(array); + List> errorMessages = SelectedItem.Validate(Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 18), Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 27)); + List> list = errorMessages; + list.AddRange(await Validate()); + if (errorMessages.Count > 0) + { + return errorMessages; + } + Item selectedItem2 = SelectedItem; + selectedItem2.Coberturas = await CoberturaViewModel.LimpaCoberturas(); + string acao = ((((DomainBase)SelectedItem).Id == 0L) ? "INCLUIU" : "ALTEROU"); + string status = ((SelectedItem.Documento.Ordem <= 0) ? "" : (base.Mantido ? $"ITEM ALTERADO NO ENDOSSO ORDEM {SelectedItem.Documento.Ordem}" : ((base.ItemSubstituido != null) ? $"SUBSTITUIÇÃO DO ITEM {base.ItemSubstituido.Ordem} NO ENDOSSO ORDEM {SelectedItem.Documento.Ordem}" : $"ITEM INCLUÍDO NO ENDOSSO ORDEM {SelectedItem.Documento.Ordem}"))); + if (((DomainBase)SelectedItem).Id == 0L) + { + SelectedItem.Status = status; + } + SelectedItem = await _itemServico.Save(SelectedItem); + if (!_itemServico.Sucesso) + { + return null; + } + if (base.ItemSubstituido != null) + { + string descricao = (base.Mantido ? $"ITEM ALTERADO NO ENDOSSO ORDEM {SelectedItem.Documento.Ordem}" : $"ITEM SUBSTITUIDO NO ENDOSSO ORDEM {SelectedItem.Documento.Ordem}"); + await _itemServico.Substituir(base.ItemSubstituido, ((DomainBase)SelectedItem).Id, descricao); + } + base.Mantido = false; + await SelecionaItem(SelectedItem, registrar: false); + ItemSelecionado = SelectedItem; + if (Invoke) + { + ConsultaViewModel.ItemSelecionado = SelectedItem; + } + ToggleSnackBar(Ramo.Nome + " SALVO COM SUCESSO"); + RegistrarAcao(acao + " ITEM DE DESCRIÇÃO \"" + SelectedItem.Descricao + "\"", ((DomainBase)SelectedItem).Id, (TipoTela)3, $"ID ITEM: {((DomainBase)SelectedItem).Id}\nID DOCUMENTO: {((DomainBase)SelectedItem.Documento).Id}\nRAMO: {SelectedItem.Documento.Controle.Ramo.Nome}\nCLIENTE: {SelectedItem.Documento.Controle.Cliente.Nome}\nID CLIENTE: {((DomainBase)SelectedItem.Documento.Controle.Cliente).Id}"); + Alterar(alterar: false); + return null; + } + + public async Task>> SalvarRange(IEnumerable list) + { + Item ultimoItem = new Item(); + List> erros = new List>(); + int ordeminicial = await QuantidadeDeItens(((DomainBase)list.First().Documento.Controle).Id); + foreach (Item item in list) + { + if (!item.Auto.Isencao.HasValue) + { + item.Auto.Isencao = (Isencao)0; + } + if (!item.Auto.ZeroKm.HasValue) + { + item.Auto.ZeroKm = false; + } + if (!item.Auto.Financiado.HasValue) + { + item.Auto.Financiado = false; + } + if (!item.Auto.UsoVeiculo.HasValue) + { + item.Auto.UsoVeiculo = (UsoVeiculo)0; + } + item.Ordem = ordeminicial; + ordeminicial++; + item.Auto.Item = item; + item.Auto.Placa = ((!string.IsNullOrEmpty(item.Auto.Placa)) ? ValidationHelper.FormataPlaca(item.Auto.Placa) : string.Empty); + Item obj = item; + string[] array = new string[7]; + Fabricante fabricante = item.Auto.Fabricante; + array[0] = ((fabricante != null) ? fabricante.Descricao : null); + array[1] = " "; + array[2] = item.Auto.Modelo; + array[3] = " / "; + array[4] = item.Auto.Chassi; + array[5] = " / "; + array[6] = item.Auto.Placa; + obj.Descricao = string.Concat(array); + List> errorMessages = item.Validate(Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 18), false); + List> list2 = errorMessages; + list2.AddRange(await Validate(item)); + item.Status = ((item.Documento.Ordem > 0) ? $"ITEM INCLUÍDO NO ENDOSSO ORDEM {item.Documento.Ordem}" : ""); + if (errorMessages.Count > 0) + { + erros.Add(new KeyValuePair("", item.Descricao)); + erros.AddRange(errorMessages); + } + } + if (erros.Count > 0) + { + return erros; + } + foreach (Item item in list) + { + string acao = ((((DomainBase)item).Id == 0L) ? "INCLUIU" : "ALTEROU"); + ultimoItem = await _itemServico.Save(item); + RegistrarAcao(acao + " ITEM DE DESCRIÇÃO \"" + item.Descricao + "\"", ((DomainBase)item).Id, (TipoTela)3, $"ID ITEM: {((DomainBase)item).Id}\nID DOCUMENTO: {((DomainBase)item.Documento).Id}\nRAMO: {item.Documento.Controle.Ramo.Nome}\nCLIENTE: {item.Documento.Controle.Cliente.Nome}\nID CLIENTE: {((DomainBase)item.Documento.Controle.Cliente).Id}"); + } + SelectedItem = ultimoItem; + await SelecionaItem(SelectedItem, registrar: false); + ItemSelecionado = SelectedItem; + if (Invoke) + { + ConsultaViewModel.ItemSelecionado = SelectedItem; + } + ToggleSnackBar("ITENS SALVOS COM SUCESSO"); + Alterar(alterar: false); + return null; + } + + public async Task Excluir() + { + if (SelectedItem == null || ((DomainBase)SelectedItem).Id == 0L) + { + return false; + } + if (!(await ShowMessage("DESEJA EXCLUIR?", "SIM", "NÃO"))) + { + return false; + } + Loading(isLoading: true); + bool num = await _servico.Delete(SelectedItem); + Loading(isLoading: false); + if (!num) + { + await ShowMessage("NÃO POSSÍVEL EXCLUIR O ITEM"); + return false; + } + RegistrarAcao("EXCLUIU ITEM DE DESCRIÇÃO \"" + SelectedItem.Descricao + "\"", ((DomainBase)SelectedItem).Id, (TipoTela)3, $"ID ITEM: {((DomainBase)SelectedItem).Id}\nID DOCUMENTO: {((DomainBase)SelectedItem.Documento).Id}\nRAMO: {SelectedItem.Documento.Controle.Ramo.Nome}\nCLIENTE: {SelectedItem.Documento.Controle.Cliente.Nome}\nID CLIENTE: {((DomainBase)SelectedItem.Documento.Controle.Cliente).Id}"); + ToggleSnackBar(Ramo.Nome + " EXCLUÍDO COM SUCESSO"); + return true; + } + + public async Task BuscaModelo(string fipe) + { + return await _itemServico.BuscarModelo(fipe); + } + + public async Task Incluir(bool substituir = false) + { + List coberturas = ((CoberturaViewModel.Coberturas == null) ? CoberturaViewModel.CarregaCoberturaPadrao().ToList() : CoberturaViewModel.Coberturas.ToList()); + Item val = new Item(); + val.Documento = ItemSelecionado.Documento; + Item val2 = val; + int? ordem = (substituir ? base.ItemSubstituido.Ordem : new int?(await QuantidadeDeItens(((DomainBase)ItemSelecionado.Documento.Controle).Id))); + val2.Ordem = ordem; + val.Auto = new Auto + { + Isencao = (Isencao)0, + ZeroKm = false, + Financiado = false, + UsoVeiculo = (UsoVeiculo)0, + Categoria = (Categoria)3 + }; + val.Substituicao = (substituir ? new long?(((DomainBase)base.ItemSubstituido).Id) : null); + Item item = val; + bool flag = substituir; + if (flag) + { + flag = await ShowMessage("DESEJA COPIAR OS DADOS DO ITEM?", "SIM", "NÃO"); + } + if (flag) + { + ((DomainBase)SelectedItem).Id = 0L; + ((DomainBase)SelectedItem.Auto).Id = 0L; + Item selectedItem = SelectedItem; + Item itemSubstituido = base.ItemSubstituido; + selectedItem.Substituicao = ((itemSubstituido != null) ? new long?(((DomainBase)itemSubstituido).Id) : null); + SelectedItem.Documento = ItemSelecionado.Documento; + } + else + { + SelectedItem = item; + SelectedItem.Auto.Item = item; + UsoVeiculo = SelectedItem.Auto.UsoVeiculo; + Categoria = SelectedItem.Auto.Categoria; + } + if (item.Ordem.GetValueOrDefault() == 2 && !substituir && !(await ShowMessage("ESTA APÓLICE SERÁ UMA FROTA, DESEJA CONTINUAR?", "SIM", "NÃO"))) + { + return; + } + flag = item.Ordem > 1; + if (flag) + { + flag = await ShowMessage("DESEJA REPLICAR AS COBERTURAS DO ITEM SELECIONADO?", "SIM", "NÃO"); + } + if (flag) + { + CoberturaViewModel.Coberturas = new ObservableCollection(); + coberturas.ForEach(delegate(Cobertura x) + { + x.Item = SelectedItem; + CoberturaViewModel.Coberturas.Add(x); + }); + } + else + { + CoberturaViewModel.CarregaPadrao(); + } + if (substituir) + { + CoberturaViewModel.Coberturas = new ObservableCollection(); + coberturas.ForEach(delegate(Cobertura x) + { + x.Item = SelectedItem; + CoberturaViewModel.Coberturas.Add(x); + }); + } + Alterar(alterar: true); + } + + public void Manter(ManutencaoItem manutencao) + { + //IL_0077: Unknown result type (might be due to invalid IL or missing references) + List obj = CoberturaViewModel.Coberturas?.ToList(); + ((DomainBase)SelectedItem).Id = 0L; + ((DomainBase)SelectedItem.Auto).Id = 0L; + Item selectedItem = SelectedItem; + Item itemSubstituido = base.ItemSubstituido; + selectedItem.Substituicao = ((itemSubstituido != null) ? new long?(((DomainBase)itemSubstituido).Id) : null); + SelectedItem.Documento = ItemSelecionado.Documento; + if ((int)manutencao.Tipo == 0) + { + SelectedItem.Sinistrado = false; + SelectedItem.Status = ""; + SelectedItem.Sinistro = null; + SelectedItem.Sinistros = null; + } + CoberturaViewModel.CarregaPadrao(); + CoberturaViewModel.Coberturas = new ObservableCollection(); + obj?.ForEach(delegate(Cobertura x) + { + x.Item = SelectedItem; + CoberturaViewModel.Coberturas.Add(x); + }); + Alterar(alterar: true); + } + + public async void CancelarAlteracao() + { + Loading(isLoading: true); + await SelecionaItem(ItemSelecionado, registrar: false); + await CoberturaViewModel.CancelarAlteracao(); + Alterar(alterar: false); + Loading(isLoading: false); + } + + public void Dispose() + { + Gestor.Application.Actions.Actions.UpdateItem = (Action)Delegate.Remove(Gestor.Application.Actions.Actions.UpdateItem, new Action(Seleciona)); + Gestor.Application.Actions.Actions.SubstituirItem = (Action)Delegate.Remove(Gestor.Application.Actions.Actions.SubstituirItem, new Action(Substituir)); + Gestor.Application.Actions.Actions.ManterItem = (Action)Delegate.Remove(Gestor.Application.Actions.Actions.ManterItem, new Action(Manter)); + } + + public void Atualiza(string valorSelecionado) + { + if (valorSelecionado == "MERCADO") + { + IsVisiblePorcentagemReferencia = (Visibility)0; + IsVisibleValorDeterminado = (Visibility)2; + } + else + { + IsVisiblePorcentagemReferencia = (Visibility)2; + IsVisibleValorDeterminado = (Visibility)0; + } + } + + public async void BaixarXls() + { + FolderBrowserDialog fbd = new FolderBrowserDialog(); + try + { + fbd.SelectedPath = Environment.SpecialFolder.Desktop.ToString(); + if ((int)((CommonDialog)fbd).ShowDialog() == 1 && !string.IsNullOrWhiteSpace(fbd.SelectedPath)) + { + XLWorkbook val = new XLWorkbook(); + DataTable dataTable = new DataTable(); + List list = new List + { + "placa", "fabricante", "modelo", "fipe", "chassi", "anofabricacao", "anomodelo", "cor", "categoria", "combustivel", + "zerokm", "renavam", "capacidade", "portas", "bonus", "ceppernoite", "ci", "financiado", "correcao", "isencao", + "pcd", "cepcirculacao", "tipocobertura", "porcentagemreferencia", "tabelareferencia", "valordeterminado", "observacao", "pr casco", "fr casco", "lmi casco", + "obs casco", "pr dm", "fr dm", "lmi dm", "obs dm", "pr dc", "fr dc", "lmi dc", "obs dc", "pr morte", + "fr morte", "lmi morte", "obs morte", "pr invalidez", "fr invalidez", "lmi invalidez", "obs invalidez", "pr carro reserva", "fr carro reserva", "lmi carro reserva", + "obs carro reserva", "pr vidros", "fr vidros", "lmi vidros", "obs vidros", "pr carroceria", "fr carroceria", "lmi carroceria", "obs carroceria", "pr Ass 24Horas", + "fr Ass 24Horas", "lmi Ass 24Horas", "obs Ass 24Horas", "pr Danos Morais", "fr Danos Morais", "lmi Danos Morais", "obs Danos Morais", "pr app", "fr app", "lmi app", + "obs app", "pr equipamentos", "fr equipamentos", "lmi equipamentos", "obs equipamentos" + }; + List> list2 = new List> + { + new List + { + "XXX0X00", "FORD", "MODELO", "000000-0", "75F 8C33MP Y2 W12900", "2000", "2001", "PRETO", "PASSEIO", "FLEX", + "SIM", "00000000000", "5", "5", "100", "00.000-000", "000000", "NÃO", "MERCADO", "SEM", + "NÃO", "00.000-000", "COMPREENSIVA", "100", "FIPE", "", "OBSERVAÇÕES", "1000", "2000", "3000", + "teste obs", "", "", "", "", "2000", "3000", "4000", "teste obs", "100000", + "200000", "300000", "teste obs", "2000", "3000", "4000", "teste obs", "", "", "", + "", "1000", "2000", "3000", "teste obs", "2000", "3000", "4000", "teste obs", "", + "", "", "", "1000", "2000", "3000", "teste obs", "", "", "", + "", "2000", "3000", "4000", "teste obs", "1000", "2000", "3000", "teste obs" + }, + new List + { + "XXX0X01", "CHEVROLET", "MODELO", "000000-1", "4EL ZBE75H B5 A65693", "2000", "2001", "VERDE", "PICKUP", "GASOLINA/ÁLCOOL/GNV", + "NÃO", "00000000000", "5", "2", "100", "00.000-000", "000000", "SIM", "DETERMINADO", "IPI E ICMS", + "NÃO", "00.000-000", "INCÊNDIO E ROUBO/FURTO", "100", "MOLICAR", "19767,34", "OBSERVAÇÕES", "1000", "2000", "3000", + "teste obs", "", "", "", "", "2000", "3000", "4000", "teste obs", "100000", + "200000", "300000", "teste obs", "2000", "3000", "4000", "teste obs", "", "", "", + "", "1000", "2000", "3000", "teste obs", "2000", "3000", "4000", "teste obs", "", + "", "", "", "1000", "2000", "3000", "teste obs", "", "", "", + "", "2000", "3000", "4000", "teste obs", "1000", "2000", "3000", "teste obs" + } + }; + List list3 = new List + { + "BRANCO", "CINZA", "PRATA", "VERMELHO", "AMARELO", "OURO", "LARANJA", "ROSA", "VERDE", "AZUL", + "VINHO", "MARROM", "BEGE", "DOURADO", "OUTROS" + }; + List list4 = new List + { + "PICKUP", "OUTROS", "PASSEIO", "CAMINHÃO", "CAMINHONETE", "ÔNIBUS", "UTILITÁRIO", "CARGA", "MOTOCICLETA", "TAXI", + "UBER", "REBOCADOR", "REBOQUE/SEMI REBOQUE" + }; + List list5 = new List + { + "ÁLCOOL", "GASOLINA", "DIESEL", "FLEX", "GNV", "OUTROS", "GASOLINA/GNV", "GASOLINA/ÁLCOOL/GNV", "GASOLINA/ELÉTRICO", "HÍBRIDO", + "ELÉTRICO", "GASOLINA/ÁLCOOL/ELÉTRICO" + }; + List list6 = new List { "MERCADO", "DETERMINADO" }; + List list7 = new List { "SEM ISENÇÃO", "ICMS", "IPI", "IPI E ICMS" }; + List list8 = new List { "COMPREENSIVA", "INCÊNDIO E ROUBO/FURTO", "DANOS A TERCEIROS", "PASSAGEIROS", "ROUBO/FURTO" }; + List list9 = new List { "MOLICAR", "FIPE" }; + List list10 = new List { "SIM", "NÃO" }; + foreach (string item in list) + { + DataColumn column = new DataColumn + { + DataType = Type.GetType("System.String"), + ColumnName = item + }; + dataTable.Columns.Add(column); + } + foreach (List item2 in list2) + { + DataRow dataRow = dataTable.NewRow(); + foreach (string item3 in list) + { + dataRow[item3] = item2[list.IndexOf(item3)]; + } + dataTable.Rows.Add(dataRow); + } + val.Worksheets.Add(dataTable, "EXEMPLO AUTO EXCEL"); + val.SaveAs(fbd.SelectedPath + "\\EXEMPLO AUTO EXCEL.xlsx"); + val = new XLWorkbook(); + dataTable = new DataTable(); + foreach (string item4 in list) + { + DataColumn column2 = new DataColumn + { + DataType = Type.GetType("System.String"), + ColumnName = item4 + }; + dataTable.Columns.Add(column2); + } + foreach (string item5 in list3) + { + DataRow dataRow2 = dataTable.NewRow(); + foreach (string item6 in list) + { + int num = list3.IndexOf(item5); + switch (item6) + { + case "cor": + dataRow2[item6] = ((list3.Count >= num + 1) ? list3[num] : ""); + break; + case "categoria": + dataRow2[item6] = ((list4.Count >= num + 1) ? list4[num] : ""); + break; + case "combustivel": + dataRow2[item6] = ((list5.Count >= num + 1) ? list5[num] : ""); + break; + case "correcao": + dataRow2[item6] = ((list6.Count >= num + 1) ? list6[num] : ""); + break; + case "isencao": + dataRow2[item6] = ((list7.Count >= num + 1) ? list7[num] : ""); + break; + case "tipocobertura": + dataRow2[item6] = ((list8.Count >= num + 1) ? list8[num] : ""); + break; + case "tabelareferencia": + dataRow2[item6] = ((list9.Count >= num + 1) ? list9[num] : ""); + break; + case "pcd": + case "zerokm": + case "financiado": + dataRow2[item6] = ((list10.Count >= num + 1) ? list10[num] : ""); + break; + case "placa": + dataRow2[item6] = ((num == 0) ? "XXX0X00" : ""); + break; + case "fabricante": + dataRow2[item6] = ((num == 0) ? "FABRICANTE" : ""); + break; + case "modelo": + dataRow2[item6] = ((num == 0) ? "MODELO" : ""); + break; + case "fipe": + dataRow2[item6] = ((num == 0) ? "000000-0" : ""); + break; + case "chassi": + dataRow2[item6] = ((num == 0) ? "XXX XXXXXX XX XXXXXX" : ""); + break; + case "anofabricacao": + dataRow2[item6] = ((num == 0) ? "0000" : ""); + break; + case "anomodelo": + dataRow2[item6] = ((num == 0) ? "0000" : ""); + break; + case "renavam": + dataRow2[item6] = ((num == 0) ? "00000000000" : ""); + break; + case "capacidade": + dataRow2[item6] = ((num == 0) ? "000" : ""); + break; + case "portas": + dataRow2[item6] = ((num == 0) ? "00" : ""); + break; + case "bonus": + dataRow2[item6] = ((num == 0) ? "0" : ""); + break; + case "ceppernoite": + dataRow2[item6] = ((num == 0) ? "00.000-000" : ""); + break; + case "ci": + dataRow2[item6] = ((num == 0) ? "000000" : ""); + break; + case "cepcirculacao": + dataRow2[item6] = ((num == 0) ? "00.000-000" : ""); + break; + case "porcentagemreferencia": + dataRow2[item6] = ((num == 0) ? "000" : ""); + break; + case "valordeterminado": + dataRow2[item6] = ((num == 0) ? "000000" : ""); + break; + case "observacao": + dataRow2[item6] = ((num == 0) ? "OBSERVAÇÕES" : ""); + break; + case "pr casco": + dataRow2[item6] = ((num == 0) ? "0" : ""); + break; + case "fr casco": + dataRow2[item6] = ((num == 0) ? "0" : ""); + break; + case "lmi casco": + dataRow2[item6] = ((num == 0) ? "0" : ""); + break; + case "obs casco": + dataRow2[item6] = ((num == 0) ? "OBSERVAÇÃO" : ""); + break; + case "pr dm": + dataRow2[item6] = ((num == 0) ? "0" : ""); + break; + case "fr dm": + dataRow2[item6] = ((num == 0) ? "0" : ""); + break; + case "lmi dm": + dataRow2[item6] = ((num == 0) ? "0" : ""); + break; + case "obs dm": + dataRow2[item6] = ((num == 0) ? "OBSERVAÇÃO" : ""); + break; + case "pr dc": + dataRow2[item6] = ((num == 0) ? "0" : ""); + break; + case "fr dc": + dataRow2[item6] = ((num == 0) ? "0" : ""); + break; + case "lmi dc": + dataRow2[item6] = ((num == 0) ? "0" : ""); + break; + case "obs dc": + dataRow2[item6] = ((num == 0) ? "OBSERVAÇÃO" : ""); + break; + case "pr morte": + dataRow2[item6] = ((num == 0) ? "0" : ""); + break; + case "fr morte": + dataRow2[item6] = ((num == 0) ? "0" : ""); + break; + case "lmi morte": + dataRow2[item6] = ((num == 0) ? "0" : ""); + break; + case "obs morte": + dataRow2[item6] = ((num == 0) ? "OBSERVAÇÃO" : ""); + break; + case "pr invalidez": + dataRow2[item6] = ((num == 0) ? "0" : ""); + break; + case "fr invalidez": + dataRow2[item6] = ((num == 0) ? "0" : ""); + break; + case "lmi invalidez": + dataRow2[item6] = ((num == 0) ? "0" : ""); + break; + case "obs invalidez": + dataRow2[item6] = ((num == 0) ? "OBSERVAÇÃO" : ""); + break; + case "pr carro reserva": + dataRow2[item6] = ((num == 0) ? "0" : ""); + break; + case "fr carro reserva": + dataRow2[item6] = ((num == 0) ? "0" : ""); + break; + case "lmi carro reserva": + dataRow2[item6] = ((num == 0) ? "0" : ""); + break; + case "obs carro reserva": + dataRow2[item6] = ((num == 0) ? "OBSERVAÇÃO" : ""); + break; + case "pr vidros": + dataRow2[item6] = ((num == 0) ? "0" : ""); + break; + case "fr vidros": + dataRow2[item6] = ((num == 0) ? "0" : ""); + break; + case "lmi vidros": + dataRow2[item6] = ((num == 0) ? "0" : ""); + break; + case "obs vidros": + dataRow2[item6] = ((num == 0) ? "OBSERVAÇÃO" : ""); + break; + case "pr carroceria": + dataRow2[item6] = ((num == 0) ? "0" : ""); + break; + case "fr carroceria": + dataRow2[item6] = ((num == 0) ? "0" : ""); + break; + case "lmi carroceria": + dataRow2[item6] = ((num == 0) ? "0" : ""); + break; + case "obs carroceria": + dataRow2[item6] = ((num == 0) ? "OBSERVAÇÃO" : ""); + break; + case "pr Ass 24Horas": + dataRow2[item6] = ((num == 0) ? "0" : ""); + break; + case "fr Ass 24Horas": + dataRow2[item6] = ((num == 0) ? "0" : ""); + break; + case "lmi Ass 24Horas": + dataRow2[item6] = ((num == 0) ? "0" : ""); + break; + case "obs Ass 24Horas": + dataRow2[item6] = ((num == 0) ? "OBSERVAÇÃO" : ""); + break; + case "pr Danos Morais": + dataRow2[item6] = ((num == 0) ? "0" : ""); + break; + case "fr Danos Morais": + dataRow2[item6] = ((num == 0) ? "0" : ""); + break; + case "lmi Danos Morais": + dataRow2[item6] = ((num == 0) ? "0" : ""); + break; + case "obs Danos Morais": + dataRow2[item6] = ((num == 0) ? "OBSERVAÇÃO" : ""); + break; + case "pr app": + dataRow2[item6] = ((num == 0) ? "0" : ""); + break; + case "fr app": + dataRow2[item6] = ((num == 0) ? "0" : ""); + break; + case "lmi app": + dataRow2[item6] = ((num == 0) ? "0" : ""); + break; + case "obs app": + dataRow2[item6] = ((num == 0) ? "OBSERVAÇÃO" : ""); + break; + case "pr equipamentos": + dataRow2[item6] = ((num == 0) ? "0" : ""); + break; + case "fr equipamentos": + dataRow2[item6] = ((num == 0) ? "0" : ""); + break; + case "lmi equipamentos": + dataRow2[item6] = ((num == 0) ? "0" : ""); + break; + case "obs equipamentos": + dataRow2[item6] = ((num == 0) ? "OBSERVAÇÃO" : ""); + break; + } + } + dataTable.Rows.Add(dataRow2); + } + val.Worksheets.Add(dataTable, "VALORES PERMITIDOS AUTO EXCEL"); + val.SaveAs(fbd.SelectedPath + "\\VALORES PERMITIDOS AUTO EXCEL.xlsx"); + } + await ShowMessage("\"EXEMPLO AUTO EXCEL.xlsx\" E \"VALORES PERMITIDOS AUTO EXCEL.xlsx\"\nFORAM SALVOS EM \"" + fbd.SelectedPath + "\""); + } + finally + { + ((IDisposable)fbd)?.Dispose(); + } + } + + public async Task>> ImportarXls() + { + List> erros = new List>(); + OpenFileDialog val = new OpenFileDialog(); + string path; + try + { + ((FileDialog)val).Filter = "Excel|*.xls;*.xlsx"; + ((FileDialog)val).InitialDirectory = Environment.SpecialFolder.Desktop.ToString(); + if (1 != (int)((CommonDialog)val).ShowDialog()) + { + erros.Add(new KeyValuePair("EXCEL", "ERRO AO SELECIONAR DOCUMENTO")); + return erros; + } + path = ((FileDialog)val).FileName; + } + finally + { + ((IDisposable)val)?.Dispose(); + } + try + { + List> list = await Task.Run(delegate + { + Microsoft.Office.Interop.Excel.Application application = (Microsoft.Office.Interop.Excel.Application)Activator.CreateInstance(Marshal.GetTypeFromCLSID(new Guid("00024500-0000-0000-C000-000000000046"))); + Workbook workbook = application.Workbooks.Open(path, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing); + new List + { + "placa", "fabricante", "modelo", "fipe", "chassi", "anofabricacao", "anomodelo", "cor", "categoria", "combustivel", + "zerokm", "renavam", "capacidade", "portas", "bonus", "ceppernoite", "ci", "financiado", "correcao", "isencao", + "pcd", "cepcirculacao", "tipocobertura", "porcentagemreferencia", "tabelareferencia", "valordeterminado", "observacao", "usoveiculos" + }; + List list2 = new List(); + foreach (object worksheet in workbook.Worksheets) + { + DataTable dataTable = new DataTable(); + Microsoft.Office.Interop.Excel.Range usedRange = ((Worksheet)worksheet).UsedRange; + object[,] array = (dynamic)usedRange.Value2; + int num = 0; + for (int i = 0; i <= usedRange.Columns.Count - 1; i++) + { + if (array[1, i + 1] == null) + { + num--; + } + else + { + DataColumn column = new DataColumn + { + DataType = Type.GetType("System.String"), + ColumnName = Funcoes.RemoverAcentos(array[1, i + 1].ToString().ToLower()) + }; + dataTable.Columns.Add(column); + for (int j = 0; j <= usedRange.Rows.Count - 2; j++) + { + object obj = array[j + 2, i + 1]; + string value = ((obj is string text) ? Funcoes.RemoverAcentos(text).ToUpper() : ((!(obj is double num2)) ? ((!(obj is bool)) ? "" : (((bool)obj) ? "1" : "0")) : ((!num2.ToString(CultureInfo.InvariantCulture).Contains("+")) ? num2.ToString(CultureInfo.InvariantCulture) : "."))); + if (i + num == 0) + { + dataTable.Rows.Add(dataTable.NewRow()); + dataTable.Rows[j][i + num] = value; + } + else + { + dataTable.Rows[j][i + num] = value; + } + } + } + } + list2.Add(dataTable); + } + application.Quit(); + List> list3 = new List>(); + foreach (DataTable dt in list2) + { + for (int num3 = dt.Rows.Count - 1; num3 >= 0; num3--) + { + if (dt.Rows[num3].ItemArray.All((object item) => string.IsNullOrEmpty(item?.ToString()))) + { + dt.Rows.RemoveAt(num3); + } + } + list3.AddRange(((IEnumerable)dt.AsEnumerable().ToList()).Select((Func>)async delegate(DataRow x) + { + Item val2 = new Item(); + Item val3 = val2; + Auto val4 = new Auto(); + val4.Placa = ((!dt.Columns.Contains("placa") || string.IsNullOrWhiteSpace(x.Field("placa").ToString())) ? null : x.Field("placa").ToString().ToUpper()); + val4.AnoFabricacao = ((!dt.Columns.Contains("anofabricacao") || string.IsNullOrWhiteSpace(x.Field("anofabricacao").ToString())) ? null : new Regex("[^0-9]").Replace(x.Field("anofabricacao").ToString(), "")); + val4.AnoModelo = ((!dt.Columns.Contains("anomodelo") || string.IsNullOrWhiteSpace(x.Field("anomodelo").ToString())) ? null : new Regex("[^0-9]").Replace(x.Field("anomodelo").ToString(), "")); + val4.Bonus = ((!dt.Columns.Contains("bonus") || string.IsNullOrWhiteSpace(x.Field("bonus").ToString())) ? null : new int?(int.Parse(new Regex("[^0-9]").Replace(x.Field("bonus").ToString(), "")))); + val4.Capacidade = ((!dt.Columns.Contains("capacidade") || string.IsNullOrWhiteSpace(x.Field("capacidade").ToString())) ? null : new Regex("[^0-9]").Replace(x.Field("capacidade").ToString(), "")); + val4.CepPernoite = ((!dt.Columns.Contains("ceppernoite") || string.IsNullOrWhiteSpace(x.Field("ceppernoite").ToString())) ? ValidationHelper.FormatPostCode(new Regex("[^0-9]").Replace(x.Field("cepcirculacao").ToString(), "")) : ValidationHelper.FormatPostCode(new Regex("[^0-9]").Replace(x.Field("ceppernoite").ToString(), ""))); + val4.Chassi = ((!dt.Columns.Contains("chassi") || string.IsNullOrWhiteSpace(x.Field("chassi").ToString())) ? null : x.Field("chassi").ToString()); + val4.Ci = ((!dt.Columns.Contains("ci") || string.IsNullOrWhiteSpace(x.Field("ci").ToString())) ? null : new Regex("[^0-9]").Replace(x.Field("ci").ToString(), "")); + val4.Observacao = ((!dt.Columns.Contains("observacao") || string.IsNullOrWhiteSpace(x.Field("observacao").ToString())) ? null : x.Field("observacao").ToString()); + val4.Cor = ((!dt.Columns.Contains("cor") || string.IsNullOrWhiteSpace(x.Field("cor").ToString())) ? null : Funcoes.GetCor(x.Field("cor").ToString().ToLower())); + val4.Financiado = ((!dt.Columns.Contains("financiado") || string.IsNullOrWhiteSpace(x.Field("financiado").ToString())) ? null : new bool?(x.Field("financiado").ToString().ToLower() == "sim")); + val4.ZeroKm = ((!dt.Columns.Contains("zerokm") || string.IsNullOrWhiteSpace(x.Field("zerokm").ToString())) ? null : new bool?(x.Field("zerokm").ToString().ToLower() == "sim")); + val4.Combustivel = ((!dt.Columns.Contains("combustivel") || string.IsNullOrWhiteSpace(x.Field("combustivel").ToString())) ? null : Funcoes.GetCombustivel(x.Field("combustivel").ToString().ToLower())); + val4.Correcao = ((!dt.Columns.Contains("correcao") || string.IsNullOrWhiteSpace(x.Field("correcao").ToString())) ? null : Funcoes.GetCorrecao(x.Field("correcao").ToString().ToLower())); + Auto val5 = val4; + Fabricante fabricante = ((dt.Columns.Contains("fabricante") && !string.IsNullOrWhiteSpace(x.Field("fabricante").ToString())) ? (await Funcoes.GetFabricante(x.Field("fabricante").ToString().ToLower())) : null); + val5.Fabricante = fabricante; + val4.Fipe = ((!dt.Columns.Contains("fipe") || string.IsNullOrWhiteSpace(x.Field("fipe").ToString())) ? null : ValidationHelper.FormataFipe(new Regex("[^0-9]").Replace(x.Field("fipe").ToString(), ""))); + val4.Isencao = ((!dt.Columns.Contains("isencao") || string.IsNullOrWhiteSpace(x.Field("isencao").ToString())) ? null : Funcoes.GetIsencao(x.Field("isencao").ToString().ToLower())); + val4.Modelo = ((!dt.Columns.Contains("modelo") || string.IsNullOrWhiteSpace(x.Field("modelo").ToString())) ? null : x.Field("modelo").ToString()); + val4.Pcd = ((!dt.Columns.Contains("pcd") || string.IsNullOrWhiteSpace(x.Field("pcd").ToString())) ? null : new bool?(x.Field("pcd").ToString().ToLower() == "sim")); + val4.PorcentagemReferencia = ((!dt.Columns.Contains("porcentagemreferencia") || string.IsNullOrWhiteSpace(x.Field("porcentagemreferencia").ToString())) ? 0m : (decimal.TryParse(x.Field("porcentagemreferencia").ToString(), out var _) ? decimal.Parse(x.Field("porcentagemreferencia").ToString()) : 0m)); + val4.Portas = ((!dt.Columns.Contains("portas") || string.IsNullOrWhiteSpace(x.Field("portas").ToString())) ? null : new Regex("[^0-9]").Replace(x.Field("portas").ToString(), "")); + val4.RegiaoCirculacao = ((!dt.Columns.Contains("cepcirculacao") || string.IsNullOrWhiteSpace(x.Field("cepcirculacao").ToString())) ? null : ValidationHelper.FormatPostCode(new Regex("[^0-9]").Replace(x.Field("cepcirculacao").ToString(), ""))); + val4.Renavam = ((!dt.Columns.Contains("renavam") || string.IsNullOrWhiteSpace(x.Field("renavam").ToString())) ? null : new Regex("[^0-9]").Replace(x.Field("renavam").ToString(), "")); + val4.TabelaReferencia = ((!dt.Columns.Contains("tabelareferencia") || string.IsNullOrWhiteSpace(x.Field("tabelareferencia").ToString())) ? null : Funcoes.GetTabelaReferencia(x.Field("tabelareferencia").ToString().ToLower())); + val4.TipoCobertura = ((!dt.Columns.Contains("tipocobertura") || string.IsNullOrWhiteSpace(x.Field("tipocobertura").ToString())) ? null : Funcoes.GetTipoCobertura(x.Field("tipocobertura").ToString().ToLower())); + val4.ValorDeterminado = ((!dt.Columns.Contains("valordeterminado") || string.IsNullOrWhiteSpace(x.Field("valordeterminado").ToString()) || !ValidationHelper.ValidateValor(x.Field("valordeterminado").ToString())) ? 0m : decimal.Parse(x.Field("valordeterminado").ToString())); + val4.Categoria = ((!dt.Columns.Contains("categoria") || string.IsNullOrWhiteSpace(x.Field("categoria").ToString())) ? null : Funcoes.GetCategoria(x.Field("categoria").ToString().ToLower())); + val4.UsoVeiculo = ((!dt.Columns.Contains("usoveiculo") || string.IsNullOrWhiteSpace(x.Field("usoveiculo").ToString())) ? null : Funcoes.GetUsoveiculo(x.Field("usoveiculo").ToString().ToUpper())); + val4.KitGas = ((!dt.Columns.Contains("KitGas") || string.IsNullOrWhiteSpace(x.Field("KitGas").ToString())) ? null : new bool?(x.Field("KitGas").ToString().ToLower() == "sim")); + val3.Auto = val4; + val2.Coberturas = Coberturas(x); + val2.Documento = ItemSelecionado.Documento; + val2.Substituicao = null; + return val2; + }).ToList()); + } + return list3; + }); + if (list.Count == 0) + { + erros.Add(new KeyValuePair("EXCEL", "NENHUMA COLUNA FOI ENCONTRADA")); + return erros; + } + erros = await SalvarRange(await Task.WhenAll(list)); + } + catch (Exception) + { + erros.Add(new KeyValuePair("EXCEL", "FALHA AO IMPORTAR O EXCEL,\nVERIFIQUE SE O ARQUIVO POSSUI ALGUM ERRO")); + } + return erros; + } + + public List Coberturas(DataRow row) + { + //IL_0478: Unknown result type (might be due to invalid IL or missing references) + //IL_047d: Unknown result type (might be due to invalid IL or missing references) + //IL_047e: Unknown result type (might be due to invalid IL or missing references) + //IL_0483: Unknown result type (might be due to invalid IL or missing references) + //IL_0491: Expected O, but got Unknown + //IL_0491: Unknown result type (might be due to invalid IL or missing references) + //IL_04a5: Unknown result type (might be due to invalid IL or missing references) + //IL_04ad: Unknown result type (might be due to invalid IL or missing references) + //IL_04b5: Unknown result type (might be due to invalid IL or missing references) + //IL_04c2: Expected O, but got Unknown + List list = new List(); + foreach (DataColumn column in row.Table.Columns) + { + if (!Regex.IsMatch(column.ColumnName, "pr .+")) + { + continue; + } + string value = Regex.Match(column.ColumnName, "pr (.+)").Groups[1].Value; + if (!(value != "casco") || !(value != "dm") || !(value != "dc") || !(value != "morte") || !(value != "invalidez") || !(value != "carro reserva") || !(value != "vidros") || !(value != "carroceria") || !(value != "ass 24horas") || !(value != "danos morais") || !(value != "app") || !(value != "equipamentos")) + { + int num = 0; + string text = ""; + switch (value) + { + case "casco": + num = 1; + text = "Veiculo (Casco)"; + break; + case "dm": + num = 2; + text = "Danos Materiais"; + break; + case "dc": + num = 3; + text = "Danos Corporais"; + break; + case "morte": + num = 4; + text = "Morte"; + break; + case "invalidez": + num = 5; + text = "Invalidez"; + break; + case "carro reserva": + num = 7; + text = "Carro Reserva"; + break; + case "vidros": + num = 6; + text = "Vidros"; + break; + case "carroceria": + num = 25; + text = "Carroceria"; + break; + case "ass 24horas": + num = 19; + text = "Assistência (Guincho)"; + break; + case "danos morais": + num = 17; + text = "Danos Morais"; + break; + case "app": + num = 53; + text = "Acidentes Pessoais"; + break; + case "equipamentos": + num = 54; + text = "Equipamentos"; + break; + } + decimal num2 = (string.IsNullOrWhiteSpace(row.Field("pr " + value).ToString()) ? 0m : ValidationHelper.ToDecimal(row.Field("pr " + value).ToString(), "pt-BR")); + decimal num3 = (string.IsNullOrWhiteSpace(row.Field("lmi " + value).ToString()) ? 0m : ValidationHelper.ToDecimal(row.Field("lmi " + value).ToString(), "pt-BR")); + decimal num4 = (string.IsNullOrWhiteSpace(row.Field("fr " + value).ToString()) ? 0m : ValidationHelper.ToDecimal(row.Field("fr " + value).ToString(), "pt-BR")); + string text2 = (string.IsNullOrWhiteSpace(row.Field("obs " + value).ToString()) ? "" : row.Field("obs " + value).ToString()); + if (num3 > 0m || num4 > 0m || num2 > 0m) + { + list.Add(new Cobertura + { + CoberturaPadrao = new CoberturaPadrao + { + Id = num + }, + Observacao = text + " - " + text2, + Premio = num2, + Lmi = num3, + Franquia = num4 + }); + } + } + } + return list; + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Seguros.Itens/BuscarModeloViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Seguros.Itens/BuscarModeloViewModel.cs new file mode 100644 index 0000000..c2f5fa1 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Seguros.Itens/BuscarModeloViewModel.cs @@ -0,0 +1,91 @@ +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using CsQuery.ExtensionMethods.Internal; +using Gestor.Application.Servicos.Seguros.Itens; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Seguros.Itens; + +public class BuscarModeloViewModel : BaseSegurosViewModel +{ + private Auto _selectedBuscaModelo = new Auto(); + + private ObservableCollection _modelosAutos = new ObservableCollection(); + + private Fipe _resultado = new Fipe(); + + public Auto SelectedBuscaModelo + { + get + { + return _selectedBuscaModelo; + } + set + { + _selectedBuscaModelo = value; + OnPropertyChanged("SelectedBuscaModelo"); + } + } + + public ObservableCollection ModelosAutos + { + get + { + return _modelosAutos; + } + set + { + _modelosAutos = value; + OnPropertyChanged("ModelosAutos"); + } + } + + public Fipe Resultado + { + get + { + return _resultado; + } + set + { + _resultado = value; + OnPropertyChanged("Resultado"); + } + } + + public BuscarModeloViewModel(string modelo, string ano) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_000b: Expected O, but got Unknown + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + //IL_0021: Expected O, but got Unknown + //IL_0028: Unknown result type (might be due to invalid IL or missing references) + //IL_002d: Unknown result type (might be due to invalid IL or missing references) + //IL_0034: Unknown result type (might be due to invalid IL or missing references) + //IL_0040: Expected O, but got Unknown + SelectedBuscaModelo = new Auto + { + AnoModelo = ano, + Modelo = modelo + }; + } + + public async void Pesquisar() + { + string modelo = SelectedBuscaModelo.Modelo; + int ano = ValidationHelper.ToInt(SelectedBuscaModelo.AnoModelo); + List list = await new ItemServico().BuscarPorModelo(modelo); + if ((SelectedBuscaModelo.AnoModelo == null && !ExtensionMethods.IsNullOrEmpty((IEnumerable)list)) || ((DomainBase)SelectedBuscaModelo).Id == 0L) + { + ModelosAutos = new ObservableCollection(list); + return; + } + list = list.Where((Fipe x) => x.AnoMinimo <= ano && x.AnoMaximo >= ano).ToList(); + ModelosAutos = new ObservableCollection(list); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Seguros.Itens/ConsorcioViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Seguros.Itens/ConsorcioViewModel.cs new file mode 100644 index 0000000..73c7311 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Seguros.Itens/ConsorcioViewModel.cs @@ -0,0 +1,399 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; +using Gestor.Application.Actions; +using Gestor.Application.Componentes; +using Gestor.Application.Servicos.Seguros.Itens; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Seguros.Itens; + +public class ConsorcioViewModel : ItemViewModel, IDisposable +{ + private new readonly ItemServico _itemServico; + + private readonly ConsorcioServico _servico; + + private bool _visibilityTitulares; + + private bool _allowAlterarExcluir = true; + + private object _cobertura; + + private object _sinistro; + + private string _codigoItem; + + private Item _selectedItem = new Item(); + + private Item ItemSelecionado { get; set; } + + private Ramo Ramo { get; } + + public bool Invoke { get; set; } + + public bool VisibilityTitulares + { + get + { + return _visibilityTitulares; + } + set + { + _visibilityTitulares = value; + OnPropertyChanged("VisibilityTitulares"); + } + } + + public bool AllowAlterarExcluir + { + get + { + return _allowAlterarExcluir; + } + set + { + _allowAlterarExcluir = value; + OnPropertyChanged("AllowAlterarExcluir"); + } + } + + public object Cobertura + { + get + { + return _cobertura; + } + set + { + _cobertura = value; + OnPropertyChanged("Cobertura"); + } + } + + public object Sinistro + { + get + { + return _sinistro; + } + set + { + _sinistro = value; + OnPropertyChanged("Sinistro"); + } + } + + public string CodigoItem + { + get + { + return _codigoItem; + } + set + { + _codigoItem = value; + OnPropertyChanged("CodigoItem"); + } + } + + public Item SelectedItem + { + get + { + return _selectedItem; + } + set + { + _selectedItem = value; + VerificarEnables((value != null) ? new long?(((DomainBase)value).Id) : null); + OnPropertyChanged("SelectedItem"); + } + } + + public ConsorcioViewModel(bool substituir = false, ManutencaoItem manutencao = null, Item itemSelecionado = null, Ramo ramo = null, bool endossoRenovacao = false) + { + //IL_0008: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Expected O, but got Unknown + //IL_0060: Unknown result type (might be due to invalid IL or missing references) + Invoke = itemSelecionado == null; + ItemSelecionado = itemSelecionado ?? ConsultaViewModel.ItemSelecionado; + Ramo = ramo ?? ConsultaViewModel.DocumentoSelecionado.Controle.Ramo; + if (Invoke) + { + ItemSelecionado = (Item)(((object)ItemSelecionado) ?? ((object)new Item())); + ItemSelecionado.Documento = ConsultaViewModel.DocumentoSelecionado; + } + _itemServico = new ItemServico(); + _servico = new ConsorcioServico(); + Seleciona(ItemSelecionado); + if (substituir) + { + Substituir(ItemSelecionado); + } + if (manutencao != null) + { + Manter(ItemSelecionado, manutencao); + } + AllowAlterarExcluir = !endossoRenovacao; + CarregaCobertura(); + VisibilityTitulares = ((DomainBase)Ramo).Id == 31; + } + + public void CarregaCobertura() + { + CoberturaViewModel.Item = ItemSelecionado; + CoberturaViewModel.Ramo = Ramo; + Cobertura = new CoberturaView(CoberturaViewModel); + } + + public void Descarregar() + { + Cobertura = null; + Sinistro = null; + } + + public void Manter(Item item, ManutencaoItem manutencao) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Invalid comparison between Unknown and I4 + if ((int)manutencao.Tipo == 1) + { + base.ItemSubstituido = item; + } + Manter(manutencao); + base.Mantido = true; + } + + public void Manter(ManutencaoItem manutencao) + { + //IL_0077: Unknown result type (might be due to invalid IL or missing references) + List obj = CoberturaViewModel.Coberturas?.ToList(); + ((DomainBase)SelectedItem).Id = 0L; + ((DomainBase)SelectedItem.Consorcio).Id = 0L; + Item selectedItem = SelectedItem; + Item itemSubstituido = base.ItemSubstituido; + selectedItem.Substituicao = ((itemSubstituido != null) ? new long?(((DomainBase)itemSubstituido).Id) : null); + SelectedItem.Documento = ItemSelecionado.Documento; + if ((int)manutencao.Tipo == 0) + { + SelectedItem.Sinistrado = false; + SelectedItem.Status = ""; + SelectedItem.Sinistro = null; + SelectedItem.Sinistros = null; + } + CoberturaViewModel.CarregaPadrao(); + CoberturaViewModel.Coberturas = new ObservableCollection(); + obj?.ForEach(delegate(Cobertura x) + { + x.Item = SelectedItem; + CoberturaViewModel.Coberturas.Add(x); + }); + Alterar(alterar: true); + } + + public async void Substituir(Item item) + { + base.ItemSubstituido = item; + await Incluir(substituir: true); + } + + private async void Seleciona(Item item) + { + Loading(isLoading: true); + await PermissaoTela((TipoTela)3); + await SelecionaItem(item); + Loading(isLoading: false); + } + + public async Task SelecionaItem(Item item, bool registrar = true) + { + if (item != null && LastAccessId == ((DomainBase)item).Id && (int)LastAccessTela == 9) + { + return; + } + base.Mantido = false; + CoberturaViewModel.Ramo = Ramo; + if (CoberturaViewModel.CoberturasPadrao == null) + { + await CoberturaViewModel.SelectionaCoberturas(); + } + if (item == null || ((DomainBase)item).Id == 0L) + { + SelectedItem = null; + CoberturaViewModel.Coberturas = null; + base.IsVisible = (Visibility)0; + base.Titulares = new ObservableCollection(); + return; + } + Loading(isLoading: true); + item = await _itemServico.BuscarItemPorIdAsync(((DomainBase)item).Id); + Item val = item; + val.Consorcio = (Consorcio)(((object)(await _itemServico.BuscaConsorcio(((DomainBase)item).Id))) ?? ((object)new Consorcio + { + Item = item + })); + if (VisibilityTitulares) + { + await CarregarTitulares(((DomainBase)item).Id); + } + SelectedItem = item; + ((DomainBase)SelectedItem).Initialize(); + Initialized = true; + CoberturaViewModel.Item = item; + await CoberturaViewModel.CancelarAlteracao(); + if (registrar) + { + RegistrarAcao("ACESSOU ITEM DE DESCRIÇÃO \"" + SelectedItem.Descricao + "\"", ((DomainBase)SelectedItem).Id, (TipoTela)3, $"ID ITEM: {((DomainBase)SelectedItem).Id}\nID DOCUMENTO: {((DomainBase)SelectedItem.Documento).Id}\nRAMO: {SelectedItem.Documento.Controle.Ramo.Nome}\nCLIENTE: {SelectedItem.Documento.Controle.Cliente.Nome}\nID CLIENTE: {((DomainBase)SelectedItem.Documento.Controle.Cliente).Id}"); + } + LastAccessId = ((DomainBase)SelectedItem).Id; + LastAccessTela = (TipoTela)3; + CodigoItem = ((DomainBase)SelectedItem).Id.ToString(); + Loading(isLoading: false); + } + + public async Task Incluir(bool substituir = false) + { + List coberturas = ((CoberturaViewModel.Coberturas == null) ? CoberturaViewModel.CarregaCoberturaPadrao().ToList() : CoberturaViewModel.Coberturas.ToList()); + Item val = new Item(); + val.Documento = ItemSelecionado.Documento; + Item val2 = val; + int? ordem = (substituir ? base.ItemSubstituido.Ordem : new int?(await QuantidadeDeItens(((DomainBase)ItemSelecionado.Documento.Controle).Id))); + val2.Ordem = ordem; + val.Consorcio = new Consorcio(); + val.Substituicao = (substituir ? new long?(((DomainBase)base.ItemSubstituido).Id) : null); + Item item = val; + base.Titulares = new ObservableCollection(); + if (item.Ordem.GetValueOrDefault() == 2 && !(await ShowMessage("ESTA APÓLICE SERÁ UMA FROTA, DESEJA CONTINUAR?", "SIM", "NÃO"))) + { + return; + } + bool flag = substituir; + if (flag) + { + flag = await ShowMessage("DESEJA COPIAR OS DADOS DO ITEM?", "SIM", "NÃO"); + } + if (flag) + { + ((DomainBase)SelectedItem).Id = 0L; + SelectedItem.Documento = ItemSelecionado.Documento; + } + else + { + SelectedItem = item; + SelectedItem.Consorcio.Item = item; + } + flag = item.Ordem > 1; + if (flag) + { + flag = await ShowMessage("DESEJA REPLICAR AS COBERTURAS DO ITEM SELECIONADO?", "SIM", "NÃO"); + } + if (flag) + { + CoberturaViewModel.Coberturas = new ObservableCollection(); + coberturas.ForEach(delegate(Cobertura x) + { + x.Item = SelectedItem; + CoberturaViewModel.Coberturas.Add(x); + }); + } + else + { + CoberturaViewModel.CarregaPadrao(); + } + if (substituir) + { + CoberturaViewModel.Coberturas = new ObservableCollection(); + coberturas.ForEach(delegate(Cobertura x) + { + x.Item = SelectedItem; + CoberturaViewModel.Coberturas.Add(x); + }); + } + Alterar(alterar: true); + } + + public async void CancelarAlteracao() + { + Loading(isLoading: true); + await SelecionaItem(ItemSelecionado, registrar: false); + await CoberturaViewModel.CancelarAlteracao(); + Alterar(alterar: false); + Loading(isLoading: false); + } + + public async Task Excluir() + { + if (SelectedItem == null || ((DomainBase)SelectedItem).Id == 0L) + { + return false; + } + if (!(await ShowMessage("DESEJA EXCLUIR?", "SIM", "NÃO"))) + { + return false; + } + Loading(isLoading: true); + bool num = await _servico.Delete(SelectedItem); + Loading(isLoading: false); + if (!num) + { + await ShowMessage("NÃO POSSÍVEL EXCLUIR O ITEM"); + return false; + } + RegistrarAcao("EXCLUIU ITEM DE DESCRIÇÃO \"" + SelectedItem.Descricao + "\"", ((DomainBase)SelectedItem).Id, (TipoTela)3, $"ID ITEM: {((DomainBase)SelectedItem).Id}\nID DOCUMENTO: {((DomainBase)SelectedItem.Documento).Id}\nRAMO: {SelectedItem.Documento.Controle.Ramo.Nome}\nCLIENTE: {SelectedItem.Documento.Controle.Cliente.Nome}\nID CLIENTE: {((DomainBase)SelectedItem.Documento.Controle.Cliente).Id}"); + ToggleSnackBar(Ramo.Nome + " EXCLUÍDO COM SUCESSO"); + return true; + } + + public async Task>> Salvar() + { + SelectedItem.Descricao = SelectedItem.Consorcio.BensConsorcio; + List> list = SelectedItem.Validate(); + if (list.Count > 0) + { + return list; + } + Item selectedItem = SelectedItem; + selectedItem.Coberturas = await CoberturaViewModel.LimpaCoberturas(); + string status = ((SelectedItem.Documento.Ordem <= 0) ? "" : (base.Mantido ? $"ITEM ALTERADO NO ENDOSSO ORDEM {SelectedItem.Documento.Ordem}" : ((base.ItemSubstituido != null) ? $"SUBSTITUIÇÃO DO ITEM {base.ItemSubstituido.Ordem} NO ENDOSSO ORDEM {SelectedItem.Documento.Ordem}" : $"ITEM INCLUÍDO NO ENDOSSO ORDEM {SelectedItem.Documento.Ordem}"))); + if (((DomainBase)SelectedItem).Id == 0L) + { + SelectedItem.Status = status; + } + string acao = ((((DomainBase)SelectedItem).Id == 0L) ? "INCLUIU" : "ALTEROU"); + SelectedItem = await _itemServico.Save(SelectedItem); + if (!_itemServico.Sucesso) + { + return null; + } + if (base.ItemSubstituido != null) + { + string descricao = (base.Mantido ? $"ITEM ALTERADO NO ENDOSSO ORDEM {SelectedItem.Documento.Ordem}" : $"ITEM SUBSTITUIDO NO ENDOSSO ORDEM {SelectedItem.Documento.Ordem}"); + await _itemServico.Substituir(base.ItemSubstituido, ((DomainBase)SelectedItem).Id, descricao); + } + base.Mantido = false; + await SelecionaItem(SelectedItem, registrar: false); + ItemSelecionado = SelectedItem; + if (Invoke) + { + ConsultaViewModel.ItemSelecionado = SelectedItem; + } + ToggleSnackBar(Ramo.Nome + " SALVO COM SUCESSO"); + RegistrarAcao(acao + " ITEM DE DESCRIÇÃO \"" + SelectedItem.Descricao + "\"", ((DomainBase)SelectedItem).Id, (TipoTela)3, $"ID ITEM: {((DomainBase)SelectedItem).Id}\nID DOCUMENTO: {((DomainBase)SelectedItem.Documento).Id}\nRAMO: {SelectedItem.Documento.Controle.Ramo.Nome}\nCLIENTE: {SelectedItem.Documento.Controle.Cliente.Nome}\nID CLIENTE: {((DomainBase)SelectedItem.Documento.Controle.Cliente).Id}"); + Alterar(alterar: false); + return null; + } + + public void Dispose() + { + Gestor.Application.Actions.Actions.UpdateItem = (Action)Delegate.Remove(Gestor.Application.Actions.Actions.UpdateItem, new Action(Seleciona)); + Gestor.Application.Actions.Actions.SubstituirItem = (Action)Delegate.Remove(Gestor.Application.Actions.Actions.SubstituirItem, new Action(Substituir)); + Gestor.Application.Actions.Actions.ManterItem = (Action)Delegate.Remove(Gestor.Application.Actions.Actions.ManterItem, new Action(Manter)); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Seguros.Itens/GranizoViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Seguros.Itens/GranizoViewModel.cs new file mode 100644 index 0000000..b88277b --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Seguros.Itens/GranizoViewModel.cs @@ -0,0 +1,380 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; +using Gestor.Application.Actions; +using Gestor.Application.Componentes; +using Gestor.Application.Servicos.Seguros.Itens; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Seguros.Itens; + +public class GranizoViewModel : ItemViewModel, IDisposable +{ + private new readonly ItemServico _itemServico; + + private readonly GranizoServico _servico; + + private bool _allowAlterarExcluir = true; + + private object _cobertura; + + private string _codigoItem; + + private Item _selectedItem = new Item(); + + private Visibility _visibilityMaisInformacoes = (Visibility)2; + + private Item ItemSelecionado { get; } + + private Ramo Ramo { get; } + + public bool Invoke { get; set; } + + public bool AllowAlterarExcluir + { + get + { + return _allowAlterarExcluir; + } + set + { + _allowAlterarExcluir = value; + OnPropertyChanged("AllowAlterarExcluir"); + } + } + + public object Cobertura + { + get + { + return _cobertura; + } + set + { + _cobertura = value; + OnPropertyChanged("Cobertura"); + } + } + + public string CodigoItem + { + get + { + return _codigoItem; + } + set + { + _codigoItem = value; + OnPropertyChanged("CodigoItem"); + } + } + + public Item SelectedItem + { + get + { + return _selectedItem; + } + set + { + _selectedItem = value; + VerificarEnables((value != null) ? new long?(((DomainBase)value).Id) : null); + OnPropertyChanged("SelectedItem"); + } + } + + public Visibility VisibilityMaisInformacoes + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityMaisInformacoes; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityMaisInformacoes = value; + OnPropertyChanged("VisibilityMaisInformacoes"); + } + } + + public GranizoViewModel(bool substituir = false, ManutencaoItem manutencao = null, Item itemSelecionado = null, Ramo ramo = null, bool endossoRenovacao = false) + { + //IL_0008: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Expected O, but got Unknown + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + //IL_0067: Unknown result type (might be due to invalid IL or missing references) + Invoke = itemSelecionado == null; + ItemSelecionado = itemSelecionado ?? ConsultaViewModel.ItemSelecionado; + Ramo = ramo ?? ConsultaViewModel.DocumentoSelecionado.Controle.Ramo; + if (Invoke) + { + ItemSelecionado = (Item)(((object)ItemSelecionado) ?? ((object)new Item())); + ItemSelecionado.Documento = ConsultaViewModel.DocumentoSelecionado; + } + _itemServico = new ItemServico(); + _servico = new GranizoServico(); + Seleciona(ItemSelecionado); + if (substituir) + { + Substituir(ItemSelecionado); + } + if (manutencao != null) + { + Manter(ItemSelecionado, manutencao); + } + AllowAlterarExcluir = !endossoRenovacao; + CarregaCobertura(); + } + + public void CarregaCobertura() + { + CoberturaViewModel.Item = ItemSelecionado; + CoberturaViewModel.Ramo = Ramo; + Cobertura = new CoberturaView(CoberturaViewModel); + } + + public void Descarregar() + { + Cobertura = null; + } + + public void Manter(Item item, ManutencaoItem manutencao) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Invalid comparison between Unknown and I4 + if ((int)manutencao.Tipo == 1) + { + base.ItemSubstituido = item; + } + Manter(manutencao); + base.Mantido = true; + } + + public void Manter(ManutencaoItem manutencao) + { + //IL_0077: Unknown result type (might be due to invalid IL or missing references) + List obj = CoberturaViewModel.Coberturas?.ToList(); + ((DomainBase)SelectedItem).Id = 0L; + ((DomainBase)SelectedItem.Granizo).Id = 0L; + Item selectedItem = SelectedItem; + Item itemSubstituido = base.ItemSubstituido; + selectedItem.Substituicao = ((itemSubstituido != null) ? new long?(((DomainBase)itemSubstituido).Id) : null); + SelectedItem.Documento = ItemSelecionado.Documento; + if ((int)manutencao.Tipo == 0) + { + SelectedItem.Sinistrado = false; + SelectedItem.Status = ""; + SelectedItem.Sinistro = null; + SelectedItem.Sinistros = null; + } + CoberturaViewModel.CarregaPadrao(); + CoberturaViewModel.Coberturas = new ObservableCollection(); + obj?.ForEach(delegate(Cobertura x) + { + x.Item = SelectedItem; + CoberturaViewModel.Coberturas.Add(x); + }); + Alterar(alterar: true); + } + + public async void Substituir(Item item) + { + base.ItemSubstituido = item; + await IncluirItem(substituir: true); + } + + private async void Seleciona(Item item) + { + Loading(isLoading: true); + await PermissaoTela((TipoTela)3); + await SelecionaItem(item); + Loading(isLoading: false); + } + + public async Task SelecionaItem(Item item, bool registrar = true) + { + if (item != null && LastAccessId == ((DomainBase)item).Id && (int)LastAccessTela == 9) + { + return; + } + base.Mantido = false; + if (!new List { 20L }.Contains(((DomainBase)Ramo).Id)) + { + return; + } + CoberturaViewModel.Ramo = Ramo; + if (CoberturaViewModel.CoberturasPadrao == null) + { + await CoberturaViewModel.SelectionaCoberturas(); + } + if (item == null || ((DomainBase)item).Id == 0L) + { + SelectedItem = null; + CoberturaViewModel.Coberturas = null; + base.IsVisible = (Visibility)0; + return; + } + Loading(isLoading: true); + item = await _itemServico.BuscarItemPorIdAsync(((DomainBase)item).Id); + Item val = item; + val.Granizo = await _itemServico.BuscaGranizo(((DomainBase)item).Id); + SelectedItem = item; + ((DomainBase)SelectedItem).Initialize(); + Initialized = true; + CoberturaViewModel.Item = item; + await CoberturaViewModel.CancelarAlteracao(); + if (registrar) + { + RegistrarAcao("ACESSOU ITEM DE DESCRIÇÃO \"" + SelectedItem.Descricao + "\"", ((DomainBase)SelectedItem).Id, (TipoTela)3, $"ID ITEM: {((DomainBase)SelectedItem).Id}\nID DOCUMENTO: {((DomainBase)SelectedItem.Documento).Id}\nRAMO: {SelectedItem.Documento.Controle.Ramo.Nome}\nCLIENTE: {SelectedItem.Documento.Controle.Cliente.Nome}\nID CLIENTE: {((DomainBase)SelectedItem.Documento.Controle.Cliente).Id}"); + } + LastAccessId = ((DomainBase)SelectedItem).Id; + LastAccessTela = (TipoTela)3; + CodigoItem = ((DomainBase)SelectedItem).Id.ToString(); + Loading(isLoading: false); + } + + public async Task IncluirItem(bool substituir = false) + { + List coberturas = ((CoberturaViewModel.Coberturas == null) ? CoberturaViewModel.CarregaCoberturaPadrao().ToList() : CoberturaViewModel.Coberturas.ToList()); + Item val = new Item(); + val.Documento = ItemSelecionado.Documento; + Item val2 = val; + int? ordem = (substituir ? base.ItemSubstituido.Ordem : new int?(await QuantidadeDeItens(((DomainBase)ItemSelecionado.Documento.Controle).Id))); + val2.Ordem = ordem; + val.Granizo = new Granizo + { + Item = SelectedItem + }; + val.Substituicao = (substituir ? new long?(((DomainBase)base.ItemSubstituido).Id) : null); + Item item = val; + if (item.Ordem.GetValueOrDefault() == 2 && !(await ShowMessage("ESTA APÓLICE SERÁ UMA FROTA, DESEJA CONTINUAR?", "SIM", "NÃO"))) + { + return; + } + bool flag = substituir; + if (flag) + { + flag = await ShowMessage("DESEJA COPIAR OS DADOS DO ITEM?", "SIM", "NÃO"); + } + if (flag) + { + ((DomainBase)SelectedItem).Id = 0L; + SelectedItem.Documento = ItemSelecionado.Documento; + } + else + { + SelectedItem = item; + SelectedItem.Granizo.Item = item; + } + flag = item.Ordem > 1; + if (flag) + { + flag = await ShowMessage("DESEJA REPLICAR AS COBERTURAS DO ITEM SELECIONADO?", "SIM", "NÃO"); + } + if (flag) + { + CoberturaViewModel.Coberturas = new ObservableCollection(); + coberturas.ForEach(delegate(Cobertura x) + { + x.Item = SelectedItem; + CoberturaViewModel.Coberturas.Add(x); + }); + } + else + { + CoberturaViewModel.CarregaPadrao(); + } + if (substituir) + { + CoberturaViewModel.Coberturas = new ObservableCollection(); + coberturas.ForEach(delegate(Cobertura x) + { + x.Item = SelectedItem; + CoberturaViewModel.Coberturas.Add(x); + }); + } + Alterar(alterar: true); + } + + public async Task>> Salvar() + { + SelectedItem.Descricao = SelectedItem.Granizo.Cultura + " " + SelectedItem.Granizo.Sitio + (ValidationHelper.IsNotNullOrEmpty(SelectedItem.Granizo.Area) ? "" : (" / " + SelectedItem.Granizo.Area)); + List> list = SelectedItem.Granizo.Validate(); + if (list.Count > 0) + { + return list; + } + Item selectedItem = SelectedItem; + selectedItem.Coberturas = await CoberturaViewModel.LimpaCoberturas(); + string status = ((SelectedItem.Documento.Ordem <= 0) ? "" : (base.Mantido ? $"ITEM ALTERADO NO ENDOSSO ORDEM {SelectedItem.Documento.Ordem}" : ((base.ItemSubstituido != null) ? $"SUBSTITUIÇÃO DO ITEM {base.ItemSubstituido.Ordem} NO ENDOSSO ORDEM {SelectedItem.Documento.Ordem}" : $"ITEM INCLUÍDO NO ENDOSSO ORDEM {SelectedItem.Documento.Ordem}"))); + if (((DomainBase)SelectedItem).Id == 0L) + { + SelectedItem.Status = status; + } + string acao = ((((DomainBase)SelectedItem).Id == 0L) ? "INCLUIU" : "ALTEROU"); + SelectedItem = await _itemServico.Save(SelectedItem); + if (!_itemServico.Sucesso) + { + return null; + } + if (base.ItemSubstituido != null) + { + string descricao = (base.Mantido ? $"ITEM ALTERADO NO ENDOSSO ORDEM {SelectedItem.Documento.Ordem}" : $"ITEM SUBSTITUIDO NO ENDOSSO ORDEM {SelectedItem.Documento.Ordem}"); + await _itemServico.Substituir(base.ItemSubstituido, ((DomainBase)SelectedItem).Id, descricao); + } + base.Mantido = false; + await SelecionaItem(SelectedItem, registrar: false); + ToggleSnackBar(Ramo.Nome + " SALVO COM SUCESSO"); + RegistrarAcao(acao + " ITEM DE DESCRIÇÃO \"" + SelectedItem.Descricao + "\"", ((DomainBase)SelectedItem).Id, (TipoTela)3, $"ID ITEM: {((DomainBase)SelectedItem).Id}\nID DOCUMENTO: {((DomainBase)SelectedItem.Documento).Id}\nRAMO: {SelectedItem.Documento.Controle.Ramo.Nome}\nCLIENTE: {SelectedItem.Documento.Controle.Cliente.Nome}\nID CLIENTE: {((DomainBase)SelectedItem.Documento.Controle.Cliente).Id}"); + Alterar(alterar: false); + return null; + } + + public async void CancelarAlteracao() + { + Loading(isLoading: true); + await SelecionaItem(ItemSelecionado, registrar: false); + await CoberturaViewModel.CancelarAlteracao(); + Alterar(alterar: false); + Loading(isLoading: false); + } + + public async Task Excluir() + { + if (SelectedItem == null || ((DomainBase)SelectedItem).Id == 0L) + { + return false; + } + if (!(await ShowMessage("DESEJA EXCLUIR?", "SIM", "NÃO"))) + { + return false; + } + Loading(isLoading: true); + bool num = await _servico.Delete(SelectedItem); + Loading(isLoading: false); + if (!num) + { + await ShowMessage("NÃO POSSÍVEL EXCLUIR O ITEM"); + return false; + } + RegistrarAcao("EXCLUIU ITEM DE DESCRIÇÃO \"" + SelectedItem.Descricao + "\"", ((DomainBase)SelectedItem).Id, (TipoTela)3, $"ID ITEM: {((DomainBase)SelectedItem).Id}\nID DOCUMENTO: {((DomainBase)SelectedItem.Documento).Id}\nRAMO: {SelectedItem.Documento.Controle.Ramo.Nome}\nCLIENTE: {SelectedItem.Documento.Controle.Cliente.Nome}\nID CLIENTE: {((DomainBase)SelectedItem.Documento.Controle.Cliente).Id}"); + ToggleSnackBar(Ramo.Nome + " EXCLUÍDO COM SUCESSO"); + return true; + } + + public void Dispose() + { + Gestor.Application.Actions.Actions.UpdateItem = (Action)Delegate.Remove(Gestor.Application.Actions.Actions.UpdateItem, new Action(Seleciona)); + Gestor.Application.Actions.Actions.SubstituirItem = (Action)Delegate.Remove(Gestor.Application.Actions.Actions.SubstituirItem, new Action(Substituir)); + Gestor.Application.Actions.Actions.ManterItem = (Action)Delegate.Remove(Gestor.Application.Actions.Actions.ManterItem, new Action(Manter)); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Seguros.Itens/PatrimonialViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Seguros.Itens/PatrimonialViewModel.cs new file mode 100644 index 0000000..d0e5947 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Seguros.Itens/PatrimonialViewModel.cs @@ -0,0 +1,530 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; +using Gestor.Application.Actions; +using Gestor.Application.Componentes; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.Servicos.Seguros.Itens; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Seguros.Itens; + +public class PatrimonialViewModel : ItemViewModel, IDisposable +{ + private new readonly ItemServico _itemServico; + + private readonly PatrimonialServico _servico; + + private bool _allowAlterarExcluir = true; + + private object _cobertura; + + private string _codigoItem; + + private Item _selectedItem = new Item(); + + private Visibility _visibilityTipoMoradia = (Visibility)2; + + private Visibility _visibilityFianca = (Visibility)2; + + private Visibility _visibilityPatrimonial; + + private string _bensInformacoes = "BENS/INFORMAÇÕES"; + + private string _locatarioTomador1 = "LOCATÁRIO 1:"; + + private string _locatarioTomador2 = "LOCATÁRIO 2:"; + + private string _locatarioTomador3 = "LOCATÁRIO 3:"; + + private Visibility _visibilityDescricao = (Visibility)2; + + private Item ItemSelecionado { get; set; } + + private Ramo Ramo { get; } + + public bool Invoke { get; set; } + + public bool AllowAlterarExcluir + { + get + { + return _allowAlterarExcluir; + } + set + { + _allowAlterarExcluir = value; + OnPropertyChanged("AllowAlterarExcluir"); + } + } + + public object Cobertura + { + get + { + return _cobertura; + } + set + { + _cobertura = value; + OnPropertyChanged("Cobertura"); + } + } + + public string CodigoItem + { + get + { + return _codigoItem; + } + set + { + _codigoItem = value; + OnPropertyChanged("CodigoItem"); + } + } + + public Item SelectedItem + { + get + { + return _selectedItem; + } + set + { + _selectedItem = value; + VerificarEnables((value != null) ? new long?(((DomainBase)value).Id) : null); + OnPropertyChanged("SelectedItem"); + } + } + + public Visibility VisibilityTipoMoradia + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityTipoMoradia; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityTipoMoradia = value; + OnPropertyChanged("VisibilityTipoMoradia"); + } + } + + public Visibility VisibilityFianca + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityFianca; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityFianca = value; + OnPropertyChanged("VisibilityFianca"); + } + } + + public Visibility VisibilityPatrimonial + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityPatrimonial; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityPatrimonial = value; + OnPropertyChanged("VisibilityPatrimonial"); + } + } + + public string BensInformacoes + { + get + { + return _bensInformacoes; + } + set + { + _bensInformacoes = value; + OnPropertyChanged("BensInformacoes"); + } + } + + public string LocatarioTomador1 + { + get + { + return _locatarioTomador1; + } + set + { + _locatarioTomador1 = value; + OnPropertyChanged("LocatarioTomador1"); + } + } + + public string LocatarioTomador2 + { + get + { + return _locatarioTomador2; + } + set + { + _locatarioTomador2 = value; + OnPropertyChanged("LocatarioTomador2"); + } + } + + public string LocatarioTomador3 + { + get + { + return _locatarioTomador3; + } + set + { + _locatarioTomador3 = value; + OnPropertyChanged("LocatarioTomador3"); + } + } + + public Visibility VisibilityDescricao + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityDescricao; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityDescricao = value; + OnPropertyChanged("VisibilityDescricao"); + } + } + + public bool Garantia { get; set; } + + public PatrimonialViewModel(bool substituir = false, ManutencaoItem manutencao = null, Item itemSelecionado = null, Ramo ramo = null, bool endossoRenovacao = false) + { + //IL_0008: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Expected O, but got Unknown + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_00a1: Unknown result type (might be due to invalid IL or missing references) + Invoke = itemSelecionado == null; + ItemSelecionado = itemSelecionado ?? ConsultaViewModel.ItemSelecionado; + Ramo = ramo ?? ConsultaViewModel.DocumentoSelecionado.Controle.Ramo; + if (Invoke) + { + ItemSelecionado = (Item)(((object)ItemSelecionado) ?? ((object)new Item())); + ItemSelecionado.Documento = ConsultaViewModel.DocumentoSelecionado; + } + _itemServico = new ItemServico(); + _servico = new PatrimonialServico(); + Seleciona(ItemSelecionado); + if (substituir) + { + Substituir(ItemSelecionado); + } + if (manutencao != null) + { + Manter(ItemSelecionado, manutencao); + } + AllowAlterarExcluir = !endossoRenovacao; + CarregaCobertura(); + } + + public void CarregaCobertura() + { + CoberturaViewModel.Item = ItemSelecionado; + CoberturaViewModel.Ramo = Ramo; + Cobertura = new CoberturaView(CoberturaViewModel); + } + + public void Descarregar() + { + Cobertura = null; + } + + public void Manter(Item item, ManutencaoItem manutencao) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Invalid comparison between Unknown and I4 + if ((int)manutencao.Tipo == 1) + { + base.ItemSubstituido = item; + } + Manter(manutencao); + base.Mantido = true; + } + + public void Manter(ManutencaoItem manutencao) + { + //IL_0077: Unknown result type (might be due to invalid IL or missing references) + List obj = CoberturaViewModel.Coberturas?.ToList(); + ((DomainBase)SelectedItem).Id = 0L; + ((DomainBase)SelectedItem.Patrimonial).Id = 0L; + Item selectedItem = SelectedItem; + Item itemSubstituido = base.ItemSubstituido; + selectedItem.Substituicao = ((itemSubstituido != null) ? new long?(((DomainBase)itemSubstituido).Id) : null); + SelectedItem.Documento = ItemSelecionado.Documento; + if ((int)manutencao.Tipo == 0) + { + SelectedItem.Sinistrado = false; + SelectedItem.Status = ""; + SelectedItem.Sinistro = null; + SelectedItem.Sinistros = null; + } + CoberturaViewModel.CarregaPadrao(); + CoberturaViewModel.Coberturas = new ObservableCollection(); + obj?.ForEach(delegate(Cobertura x) + { + x.Item = SelectedItem; + CoberturaViewModel.Coberturas.Add(x); + }); + Alterar(alterar: true); + } + + public async void Substituir(Item item) + { + base.ItemSubstituido = item; + await Incluir(substituir: true); + } + + private async void Seleciona(Item item) + { + Loading(isLoading: true); + await PermissaoTela((TipoTela)3); + await SelecionaItem(item); + Loading(isLoading: false); + } + + public async Task Incluir(bool substituir = false) + { + List coberturas = ((CoberturaViewModel.Coberturas == null) ? CoberturaViewModel.CarregaCoberturaPadrao().ToList() : CoberturaViewModel.Coberturas.ToList()); + Item val = new Item(); + val.Documento = ItemSelecionado.Documento; + Item val2 = val; + int? ordem = (substituir ? base.ItemSubstituido.Ordem : new int?(await QuantidadeDeItens(((DomainBase)ItemSelecionado.Documento.Controle).Id))); + val2.Ordem = ordem; + val.Patrimonial = new Patrimonial + { + Item = SelectedItem + }; + val.Substituicao = (substituir ? new long?(((DomainBase)base.ItemSubstituido).Id) : null); + Item item = val; + bool flag = !Garantia; + if (flag) + { + flag = await ShowMessage("COPIAR OS DADOS DE ENDEREÇO DO CLIENTE?", "SIM", "NÃO"); + } + if (flag) + { + ObservableCollection observableCollection = await new ClienteServico().BuscarEnderecosAsync(((DomainBase)item.Documento.Controle.Cliente).Id); + if (observableCollection != null && observableCollection.Any()) + { + List source = ((IEnumerable)observableCollection.OrderBy((ClienteEndereco x) => x.Ordem.GetValueOrDefault() == 1)).Select((Func)((ClienteEndereco e) => new Patrimonial + { + Endereco = ((EnderecoBase)e).Endereco, + Numero = ((EnderecoBase)e).Numero, + Complemento = ((EnderecoBase)e).Complemento, + Bairro = ((EnderecoBase)e).Bairro, + Cidade = ((EnderecoBase)e).Cidade, + Estado = ((EnderecoBase)e).Estado, + Cep = ((EnderecoBase)e).Cep + })).ToList(); + item.Patrimonial = (source.Any() ? source.Last() : null); + } + } + if (item.Ordem.GetValueOrDefault() == 2 && !(await ShowMessage("ESTA APÓLICE SERÁ UMA FROTA, DESEJA CONTINUAR?", "SIM", "NÃO"))) + { + return; + } + SelectedItem = item; + SelectedItem.Patrimonial.Item = item; + flag = item.Ordem > 1; + if (flag) + { + flag = await ShowMessage("DESEJA REPLICAR AS COBERTURAS DO ITEM SELECIONADO?", "SIM", "NÃO"); + } + if (flag) + { + CoberturaViewModel.Coberturas = new ObservableCollection(); + coberturas.ForEach(delegate(Cobertura x) + { + x.Item = SelectedItem; + CoberturaViewModel.Coberturas.Add(x); + }); + } + else + { + CoberturaViewModel.CarregaPadrao(); + } + if (substituir) + { + CoberturaViewModel.Coberturas = new ObservableCollection(); + coberturas.ForEach(delegate(Cobertura x) + { + x.Item = SelectedItem; + CoberturaViewModel.Coberturas.Add(x); + }); + } + Alterar(alterar: true); + } + + public async Task>> Salvar() + { + SelectedItem.Descricao = (((int)VisibilityPatrimonial == 0) ? (((EnderecoBase)SelectedItem.Patrimonial).Endereco + ", " + ((EnderecoBase)SelectedItem.Patrimonial).Numero + " - " + ((EnderecoBase)SelectedItem.Patrimonial).Complemento + " - " + ((EnderecoBase)SelectedItem.Patrimonial).Bairro + ", " + ((EnderecoBase)SelectedItem.Patrimonial).Cidade + " / " + ((EnderecoBase)SelectedItem.Patrimonial).Estado) : SelectedItem.Descricao); + List> list = SelectedItem.Validate(); + if (list.Count > 0) + { + return list; + } + Item selectedItem = SelectedItem; + selectedItem.Coberturas = await CoberturaViewModel.LimpaCoberturas(); + string status = ((SelectedItem.Documento.Ordem <= 0) ? "" : (base.Mantido ? $"ITEM ALTERADO NO ENDOSSO ORDEM {SelectedItem.Documento.Ordem}" : ((base.ItemSubstituido != null) ? $"SUBSTITUIÇÃO DO ITEM {base.ItemSubstituido.Ordem} NO ENDOSSO ORDEM {SelectedItem.Documento.Ordem}" : $"ITEM INCLUÍDO NO ENDOSSO ORDEM {SelectedItem.Documento.Ordem}"))); + if (((DomainBase)SelectedItem).Id == 0L) + { + SelectedItem.Status = status; + } + string acao = ((((DomainBase)SelectedItem).Id == 0L) ? "INCLUIU" : "ALTEROU"); + SelectedItem = await _itemServico.Save(SelectedItem); + if (!_itemServico.Sucesso) + { + return null; + } + if (base.ItemSubstituido != null) + { + string descricao = (base.Mantido ? $"ITEM ALTERADO NO ENDOSSO ORDEM {SelectedItem.Documento.Ordem}" : $"ITEM SUBSTITUIDO NO ENDOSSO ORDEM {SelectedItem.Documento.Ordem}"); + await _itemServico.Substituir(base.ItemSubstituido, ((DomainBase)SelectedItem).Id, descricao); + } + base.Mantido = false; + await SelecionaItem(SelectedItem, registrar: false); + ItemSelecionado = SelectedItem; + if (Invoke) + { + ConsultaViewModel.ItemSelecionado = SelectedItem; + } + ToggleSnackBar(Ramo.Nome + " SALVO COM SUCESSO"); + RegistrarAcao(acao + " ITEM DE DESCRIÇÃO \"" + SelectedItem.Descricao + "\"", ((DomainBase)SelectedItem).Id, (TipoTela)3, $"ID ITEM: {((DomainBase)SelectedItem).Id}\nID DOCUMENTO: {((DomainBase)SelectedItem.Documento).Id}\nRAMO: {SelectedItem.Documento.Controle.Ramo.Nome}\nCLIENTE: {SelectedItem.Documento.Controle.Cliente.Nome}\nID CLIENTE: {((DomainBase)SelectedItem.Documento.Controle.Cliente).Id}"); + Alterar(alterar: false); + return null; + } + + public async void CancelarAlteracao() + { + Loading(isLoading: true); + await SelecionaItem(ItemSelecionado, registrar: false); + await CoberturaViewModel.CancelarAlteracao(); + Alterar(alterar: false); + Loading(isLoading: false); + } + + public async Task Excluir() + { + if (SelectedItem == null || ((DomainBase)SelectedItem).Id == 0L) + { + return false; + } + if (!(await ShowMessage("DESEJA EXCLUIR?", "SIM", "NÃO"))) + { + return false; + } + Loading(isLoading: true); + bool num = await _servico.Delete(SelectedItem); + Loading(isLoading: false); + if (!num) + { + await ShowMessage("NÃO POSSÍVEL EXCLUIR O ITEM"); + return false; + } + RegistrarAcao("EXCLUIU ITEM DE DESCRIÇÃO \"" + SelectedItem.Descricao + "\"", ((DomainBase)SelectedItem).Id, (TipoTela)3, $"ID ITEM: {((DomainBase)SelectedItem).Id}\nID DOCUMENTO: {((DomainBase)SelectedItem.Documento).Id}\nRAMO: {SelectedItem.Documento.Controle.Ramo.Nome}\nCLIENTE: {SelectedItem.Documento.Controle.Cliente.Nome}\nID CLIENTE: {((DomainBase)SelectedItem.Documento.Controle.Cliente).Id}"); + ToggleSnackBar(Ramo.Nome + " EXCLUÍDO COM SUCESSO"); + return true; + } + + public async Task SelecionaItem(Item item, bool registrar = true) + { + if (item != null && LastAccessId == ((DomainBase)item).Id && (int)LastAccessTela == 9) + { + return; + } + base.Mantido = false; + if (!new List { 1L, 2L, 3L, 15L, 18L, 30L, 38L }.Contains(((DomainBase)Ramo).Id)) + { + return; + } + VisibilityTipoMoradia = (Visibility)((((DomainBase)Ramo).Id != 1) ? 2 : 0); + CoberturaViewModel.Ramo = Ramo; + if (CoberturaViewModel.CoberturasPadrao == null) + { + await CoberturaViewModel.SelectionaCoberturas(); + } + VisibilityFianca = (Visibility)((((DomainBase)Ramo).Id != 15 && ((DomainBase)Ramo).Id != 38) ? 2 : 0); + if (((DomainBase)Ramo).Id == 38) + { + HabilitaCamposGarantia(); + } + if (item == null || ((DomainBase)item).Id == 0L) + { + SelectedItem = null; + CoberturaViewModel.Coberturas = null; + base.IsVisible = (Visibility)0; + return; + } + Loading(isLoading: true); + item = await _itemServico.BuscarItemPorIdAsync(((DomainBase)item).Id); + Item val = item; + val.Patrimonial = await _itemServico.BuscaPatrimonial(((DomainBase)item).Id); + SelectedItem = item; + ((DomainBase)SelectedItem).Initialize(); + Initialized = true; + CoberturaViewModel.Item = item; + await CoberturaViewModel.CancelarAlteracao(); + if (registrar) + { + RegistrarAcao("ACESSOU ITEM DE DESCRIÇÃO \"" + SelectedItem.Descricao + "\"", ((DomainBase)SelectedItem).Id, (TipoTela)3, $"ID ITEM: {((DomainBase)SelectedItem).Id}\nID DOCUMENTO: {((DomainBase)SelectedItem.Documento).Id}\nRAMO: {SelectedItem.Documento.Controle.Ramo.Nome}\nCLIENTE: {SelectedItem.Documento.Controle.Cliente.Nome}\nID CLIENTE: {((DomainBase)SelectedItem.Documento.Controle.Cliente).Id}"); + } + LastAccessId = ((DomainBase)SelectedItem).Id; + LastAccessTela = (TipoTela)3; + CodigoItem = ((DomainBase)SelectedItem).Id.ToString(); + Loading(isLoading: false); + } + + private void HabilitaCamposGarantia() + { + VisibilityPatrimonial = (Visibility)((((DomainBase)Ramo).Id == 38) ? 2 : 0); + BensInformacoes = "OBSERVAÇÕES"; + LocatarioTomador1 = "TOMADOR 1:"; + LocatarioTomador2 = "TOMADOR 2:"; + LocatarioTomador3 = "TOMADOR 3:"; + VisibilityDescricao = (Visibility)0; + Garantia = true; + } + + public void Dispose() + { + Gestor.Application.Actions.Actions.UpdateItem = (Action)Delegate.Remove(Gestor.Application.Actions.Actions.UpdateItem, new Action(Seleciona)); + Gestor.Application.Actions.Actions.SubstituirItem = (Action)Delegate.Remove(Gestor.Application.Actions.Actions.SubstituirItem, new Action(Substituir)); + Gestor.Application.Actions.Actions.ManterItem = (Action)Delegate.Remove(Gestor.Application.Actions.Actions.ManterItem, new Action(Manter)); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Seguros.Itens/RiscosDiversosViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Seguros.Itens/RiscosDiversosViewModel.cs new file mode 100644 index 0000000..41fc4a5 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Seguros.Itens/RiscosDiversosViewModel.cs @@ -0,0 +1,449 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; +using Gestor.Application.Actions; +using Gestor.Application.Componentes; +using Gestor.Application.Servicos.Seguros.Itens; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Seguros.Itens; + +public class RiscosDiversosViewModel : ItemViewModel, IDisposable +{ + private new readonly ItemServico _itemServico; + + private readonly RiscosDiversosServico _servico; + + private bool _visibilityTitulares; + + private bool _allowAlterarExcluir = true; + + private object _cobertura; + + private object _sinistro; + + private string _codigoItem; + + private Item _selectedItem = new Item(); + + private Item ItemSelecionado { get; set; } + + private Ramo Ramo { get; } + + public bool Invoke { get; set; } + + public bool VisibilityTitulares + { + get + { + return _visibilityTitulares; + } + set + { + _visibilityTitulares = value; + OnPropertyChanged("VisibilityTitulares"); + } + } + + public bool AllowAlterarExcluir + { + get + { + return _allowAlterarExcluir; + } + set + { + _allowAlterarExcluir = value; + OnPropertyChanged("AllowAlterarExcluir"); + } + } + + public object Cobertura + { + get + { + return _cobertura; + } + set + { + _cobertura = value; + OnPropertyChanged("Cobertura"); + } + } + + public object Sinistro + { + get + { + return _sinistro; + } + set + { + _sinistro = value; + OnPropertyChanged("Sinistro"); + } + } + + public string CodigoItem + { + get + { + return _codigoItem; + } + set + { + _codigoItem = value; + OnPropertyChanged("CodigoItem"); + } + } + + public Visibility _visibilityMultRisco { get; set; } = (Visibility)2; + + + public Visibility VisibilityMultRisco + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityMultRisco; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + _visibilityMultRisco = value; + OnPropertyChanged("VisibilityMultRisco"); + } + } + + public Item SelectedItem + { + get + { + return _selectedItem; + } + set + { + _selectedItem = value; + VerificarEnables((value != null) ? new long?(((DomainBase)value).Id) : null); + OnPropertyChanged("SelectedItem"); + } + } + + public RiscosDiversosViewModel(bool substituir = false, ManutencaoItem manutencao = null, Item itemSelecionado = null, Ramo ramo = null, bool endossoRenovacao = false) + { + //IL_0009: Unknown result type (might be due to invalid IL or missing references) + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0019: Expected O, but got Unknown + //IL_0067: Unknown result type (might be due to invalid IL or missing references) + Invoke = itemSelecionado == null; + ItemSelecionado = itemSelecionado ?? ConsultaViewModel.ItemSelecionado; + Ramo = ramo ?? ConsultaViewModel.DocumentoSelecionado.Controle.Ramo; + if (Invoke) + { + ItemSelecionado = (Item)(((object)ItemSelecionado) ?? ((object)new Item())); + ItemSelecionado.Documento = ConsultaViewModel.DocumentoSelecionado; + } + _itemServico = new ItemServico(); + _servico = new RiscosDiversosServico(); + Seleciona(ItemSelecionado); + if (substituir) + { + Substituir(ItemSelecionado); + } + if (manutencao != null) + { + Manter(ItemSelecionado, manutencao); + } + AllowAlterarExcluir = !endossoRenovacao; + CarregaCobertura(); + VisibilityTitulares = ((DomainBase)Ramo).Id == 31; + VisibilityMultRisco = (Visibility)((((DomainBase)Ramo).Id != 33) ? 2 : 0); + } + + public void CarregaCobertura() + { + CoberturaViewModel.Item = ItemSelecionado; + CoberturaViewModel.Ramo = Ramo; + Cobertura = new CoberturaView(CoberturaViewModel); + } + + public void Descarregar() + { + Cobertura = null; + Sinistro = null; + } + + public void Manter(Item item, ManutencaoItem manutencao) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Invalid comparison between Unknown and I4 + if ((int)manutencao.Tipo == 1) + { + base.ItemSubstituido = item; + } + Manter(manutencao); + base.Mantido = true; + } + + public void Manter(ManutencaoItem manutencao) + { + //IL_0077: Unknown result type (might be due to invalid IL or missing references) + List obj = CoberturaViewModel.Coberturas?.ToList(); + ((DomainBase)SelectedItem).Id = 0L; + ((DomainBase)SelectedItem.RiscosDiversos).Id = 0L; + Item selectedItem = SelectedItem; + Item itemSubstituido = base.ItemSubstituido; + selectedItem.Substituicao = ((itemSubstituido != null) ? new long?(((DomainBase)itemSubstituido).Id) : null); + SelectedItem.Documento = ItemSelecionado.Documento; + if ((int)manutencao.Tipo == 0) + { + SelectedItem.Sinistrado = false; + SelectedItem.Status = ""; + SelectedItem.Sinistro = null; + SelectedItem.Sinistros = null; + } + CoberturaViewModel.CarregaPadrao(); + CoberturaViewModel.Coberturas = new ObservableCollection(); + obj?.ForEach(delegate(Cobertura x) + { + x.Item = SelectedItem; + CoberturaViewModel.Coberturas.Add(x); + }); + Alterar(alterar: true); + } + + public async void Substituir(Item item) + { + base.ItemSubstituido = item; + await Incluir(substituir: true); + } + + private async void Seleciona(Item item) + { + Loading(isLoading: true); + await PermissaoTela((TipoTela)3); + await SelecionaItem(item); + Loading(isLoading: false); + } + + public async Task SelecionaItem(Item item, bool registrar = true) + { + if (item != null && LastAccessId == ((DomainBase)item).Id && (int)LastAccessTela == 9) + { + return; + } + base.Mantido = false; + CoberturaViewModel.Ramo = Ramo; + if (CoberturaViewModel.CoberturasPadrao == null) + { + await CoberturaViewModel.SelectionaCoberturas(); + } + if (item == null || ((DomainBase)item).Id == 0L) + { + SelectedItem = null; + CoberturaViewModel.Coberturas = null; + base.IsVisible = (Visibility)0; + base.Titulares = new ObservableCollection(); + return; + } + Loading(isLoading: true); + item = await _itemServico.BuscarItemPorIdAsync(((DomainBase)item).Id); + Item val = item; + val.RiscosDiversos = (RiscosDiversos)(((object)(await _itemServico.BuscaRiscosDiversos(((DomainBase)item).Id))) ?? ((object)new RiscosDiversos + { + Item = item + })); + if (VisibilityTitulares) + { + await CarregarTitulares(((DomainBase)item).Id); + } + SelectedItem = item; + ((DomainBase)SelectedItem).Initialize(); + Initialized = true; + CoberturaViewModel.Item = item; + await CoberturaViewModel.CancelarAlteracao(); + if (registrar) + { + RegistrarAcao("ACESSOU ITEM DE DESCRIÇÃO \"" + SelectedItem.Descricao + "\"", ((DomainBase)SelectedItem).Id, (TipoTela)3, $"ID ITEM: {((DomainBase)SelectedItem).Id}\nID DOCUMENTO: {((DomainBase)SelectedItem.Documento).Id}\nRAMO: {SelectedItem.Documento.Controle.Ramo.Nome}\nCLIENTE: {SelectedItem.Documento.Controle.Cliente.Nome}\nID CLIENTE: {((DomainBase)SelectedItem.Documento.Controle.Cliente).Id}"); + } + LastAccessId = ((DomainBase)SelectedItem).Id; + LastAccessTela = (TipoTela)3; + CodigoItem = ((DomainBase)SelectedItem).Id.ToString(); + Loading(isLoading: false); + } + + public async Task Incluir(bool substituir = false) + { + List coberturas = ((CoberturaViewModel.Coberturas == null) ? CoberturaViewModel.CarregaCoberturaPadrao().ToList() : CoberturaViewModel.Coberturas.ToList()); + Item val = new Item(); + val.Documento = ItemSelecionado.Documento; + Item val2 = val; + int? ordem = (substituir ? base.ItemSubstituido.Ordem : new int?(await QuantidadeDeItens(((DomainBase)ItemSelecionado.Documento.Controle).Id))); + val2.Ordem = ordem; + val.RiscosDiversos = new RiscosDiversos(); + val.Substituicao = (substituir ? new long?(((DomainBase)base.ItemSubstituido).Id) : null); + Item item = val; + base.Titulares = new ObservableCollection(); + if (item.Ordem.GetValueOrDefault() == 2 && !(await ShowMessage("ESTA APÓLICE SERÁ UMA FROTA, DESEJA CONTINUAR?", "SIM", "NÃO"))) + { + return; + } + bool flag = substituir; + if (flag) + { + flag = await ShowMessage("DESEJA COPIAR OS DADOS DO ITEM?", "SIM", "NÃO"); + } + if (flag) + { + ((DomainBase)SelectedItem).Id = 0L; + SelectedItem.Documento = ItemSelecionado.Documento; + } + else + { + SelectedItem = item; + SelectedItem.RiscosDiversos.Item = item; + } + flag = item.Ordem > 1; + if (flag) + { + flag = await ShowMessage("DESEJA REPLICAR AS COBERTURAS DO ITEM SELECIONADO?", "SIM", "NÃO"); + } + if (flag) + { + CoberturaViewModel.Coberturas = new ObservableCollection(); + coberturas.ForEach(delegate(Cobertura x) + { + x.Item = SelectedItem; + CoberturaViewModel.Coberturas.Add(x); + }); + } + else + { + CoberturaViewModel.CarregaPadrao(); + } + if (substituir) + { + CoberturaViewModel.Coberturas = new ObservableCollection(); + coberturas.ForEach(delegate(Cobertura x) + { + x.Item = SelectedItem; + CoberturaViewModel.Coberturas.Add(x); + }); + } + Alterar(alterar: true); + } + + public async Task>> Salvar(List titularesGrid) + { + if (VisibilityTitulares) + { + SelectedItem.Titulares = titularesGrid; + } + List> list = SelectedItem.Validate(); + if (list.Count > 0) + { + return list; + } + Item selectedItem = SelectedItem; + selectedItem.Coberturas = await CoberturaViewModel.LimpaCoberturas(); + string status = ((SelectedItem.Documento.Ordem <= 0) ? "" : (base.Mantido ? $"ITEM ALTERADO NO ENDOSSO ORDEM {SelectedItem.Documento.Ordem}" : ((base.ItemSubstituido != null) ? $"SUBSTITUIÇÃO DO ITEM {base.ItemSubstituido.Ordem} NO ENDOSSO ORDEM {SelectedItem.Documento.Ordem}" : $"ITEM INCLUÍDO NO ENDOSSO ORDEM {SelectedItem.Documento.Ordem}"))); + if (((DomainBase)SelectedItem).Id == 0L) + { + SelectedItem.Status = status; + } + if (VisibilityTitulares) + { + await _itemServico.DeleteTitulares(base.ExcluirTitulares); + base.ExcluirTitulares = new List(); + } + string acao = ((((DomainBase)SelectedItem).Id == 0L) ? "INCLUIU" : "ALTEROU"); + SelectedItem = await _itemServico.Save(SelectedItem); + if (VisibilityTitulares) + { + foreach (TitularesVida item in titularesGrid) + { + item.IdItem = ((DomainBase)SelectedItem).Id; + } + List list2 = new List(); + foreach (TitularesVida t in titularesGrid) + { + if (((DomainBase)t).Id == 0L) + { + list2.Add(t); + continue; + } + TitularesVida val = base.OldTitulares.First((TitularesVida x) => ((DomainBase)x).Id == ((DomainBase)t).Id); + if (t.Codigo != val.Codigo || t.Inicio != val.Inicio || t.Fim != val.Fim || t.Fatura != val.Fatura || t.Nome != val.Nome || t.Observacao != val.Observacao || t.Nascimento != val.Nascimento || t.Cpf != val.Cpf || t.Matricula != val.Matricula || !(t.Premio == val.Premio) || !(t.Capital == val.Capital) || t.Tipo != val.Tipo || t.Dependente != val.Dependente) + { + list2.Add(t); + } + } + base.Titulares = new ObservableCollection(await _itemServico.SaveTitulares(list2)); + } + if (!_itemServico.Sucesso) + { + return null; + } + if (base.ItemSubstituido != null) + { + string descricao = (base.Mantido ? $"ITEM ALTERADO NO ENDOSSO ORDEM {SelectedItem.Documento.Ordem}" : $"ITEM SUBSTITUIDO NO ENDOSSO ORDEM {SelectedItem.Documento.Ordem}"); + await _itemServico.Substituir(base.ItemSubstituido, ((DomainBase)SelectedItem).Id, descricao); + } + base.Mantido = false; + await SelecionaItem(SelectedItem, registrar: false); + ItemSelecionado = SelectedItem; + if (Invoke) + { + ConsultaViewModel.ItemSelecionado = SelectedItem; + } + ToggleSnackBar(Ramo.Nome + " SALVO COM SUCESSO"); + RegistrarAcao(acao + " ITEM DE DESCRIÇÃO \"" + SelectedItem.Descricao + "\"", ((DomainBase)SelectedItem).Id, (TipoTela)3, $"ID ITEM: {((DomainBase)SelectedItem).Id}\nID DOCUMENTO: {((DomainBase)SelectedItem.Documento).Id}\nRAMO: {SelectedItem.Documento.Controle.Ramo.Nome}\nCLIENTE: {SelectedItem.Documento.Controle.Cliente.Nome}\nID CLIENTE: {((DomainBase)SelectedItem.Documento.Controle.Cliente).Id}"); + Alterar(alterar: false); + return null; + } + + public async void CancelarAlteracao() + { + Loading(isLoading: true); + await SelecionaItem(ItemSelecionado, registrar: false); + await CoberturaViewModel.CancelarAlteracao(); + Alterar(alterar: false); + Loading(isLoading: false); + } + + public async Task Excluir() + { + if (SelectedItem == null || ((DomainBase)SelectedItem).Id == 0L) + { + return false; + } + if (!(await ShowMessage("DESEJA EXCLUIR?", "SIM", "NÃO"))) + { + return false; + } + Loading(isLoading: true); + bool num = await _servico.Delete(SelectedItem); + Loading(isLoading: false); + if (!num) + { + await ShowMessage("NÃO POSSÍVEL EXCLUIR O ITEM"); + return false; + } + RegistrarAcao("EXCLUIU ITEM DE DESCRIÇÃO \"" + SelectedItem.Descricao + "\"", ((DomainBase)SelectedItem).Id, (TipoTela)3, $"ID ITEM: {((DomainBase)SelectedItem).Id}\nID DOCUMENTO: {((DomainBase)SelectedItem.Documento).Id}\nRAMO: {SelectedItem.Documento.Controle.Ramo.Nome}\nCLIENTE: {SelectedItem.Documento.Controle.Cliente.Nome}\nID CLIENTE: {((DomainBase)SelectedItem.Documento.Controle.Cliente).Id}"); + ToggleSnackBar(Ramo.Nome + " EXCLUÍDO COM SUCESSO"); + return true; + } + + public void Dispose() + { + Gestor.Application.Actions.Actions.UpdateItem = (Action)Delegate.Remove(Gestor.Application.Actions.Actions.UpdateItem, new Action(Seleciona)); + Gestor.Application.Actions.Actions.SubstituirItem = (Action)Delegate.Remove(Gestor.Application.Actions.Actions.SubstituirItem, new Action(Substituir)); + Gestor.Application.Actions.Actions.ManterItem = (Action)Delegate.Remove(Gestor.Application.Actions.Actions.ManterItem, new Action(Manter)); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Seguros.Itens/VidaViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Seguros.Itens/VidaViewModel.cs new file mode 100644 index 0000000..6f59156 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Seguros.Itens/VidaViewModel.cs @@ -0,0 +1,438 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; +using Gestor.Application.Actions; +using Gestor.Application.Componentes; +using Gestor.Application.Servicos.Seguros.Itens; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Seguros.Itens; + +public class VidaViewModel : ItemViewModel, IDisposable +{ + private new readonly ItemServico _itemServico; + + private readonly VidaServico _servico; + + private bool _allowAlterarExcluir = true; + + private object _cobertura; + + private string _codigoItem; + + private Item _selectedItem = new Item(); + + private Visibility _atualizarCamposSaude; + + private Item ItemSelecionado { get; set; } + + private Ramo Ramo { get; } + + public bool Invoke { get; set; } + + public bool AllowAlterarExcluir + { + get + { + return _allowAlterarExcluir; + } + set + { + _allowAlterarExcluir = value; + OnPropertyChanged("AllowAlterarExcluir"); + } + } + + public object Cobertura + { + get + { + return _cobertura; + } + set + { + _cobertura = value; + OnPropertyChanged("Cobertura"); + } + } + + public string CodigoItem + { + get + { + return _codigoItem; + } + set + { + _codigoItem = value; + OnPropertyChanged("CodigoItem"); + } + } + + public Item SelectedItem + { + get + { + return _selectedItem; + } + set + { + _selectedItem = value; + VerificarEnables((value != null) ? new long?(((DomainBase)value).Id) : null); + OnPropertyChanged("SelectedItem"); + } + } + + public Visibility AtualizarCamposSaude + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _atualizarCamposSaude; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _atualizarCamposSaude = value; + OnPropertyChanged("AtualizarCamposSaude"); + } + } + + public VidaViewModel(bool substituir = false, ManutencaoItem manutencao = null, Item itemSelecionado = null, Ramo ramo = null, bool endossoRenovacao = false) + { + //IL_0008: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Expected O, but got Unknown + //IL_0060: Unknown result type (might be due to invalid IL or missing references) + Invoke = itemSelecionado == null; + ItemSelecionado = itemSelecionado ?? ConsultaViewModel.ItemSelecionado; + Ramo = ramo ?? ConsultaViewModel.DocumentoSelecionado.Controle.Ramo; + if (Invoke) + { + ItemSelecionado = (Item)(((object)ItemSelecionado) ?? ((object)new Item())); + ItemSelecionado.Documento = ConsultaViewModel.DocumentoSelecionado; + } + _itemServico = new ItemServico(); + _servico = new VidaServico(); + Gestor.Application.Actions.Actions.UpdateItem = (Action)Delegate.Combine(Gestor.Application.Actions.Actions.UpdateItem, new Action(Seleciona)); + Gestor.Application.Actions.Actions.SubstituirItem = (Action)Delegate.Combine(Gestor.Application.Actions.Actions.SubstituirItem, new Action(Substituir)); + Gestor.Application.Actions.Actions.ManterItem = (Action)Delegate.Combine(Gestor.Application.Actions.Actions.ManterItem, new Action(Manter)); + Seleciona(ItemSelecionado); + if (substituir) + { + Substituir(ItemSelecionado); + } + if (manutencao != null) + { + Manter(ItemSelecionado, manutencao); + } + AllowAlterarExcluir = !endossoRenovacao; + CarregaCobertura(); + } + + public void CarregaCobertura() + { + CoberturaViewModel.Item = ItemSelecionado; + CoberturaViewModel.Ramo = Ramo; + Cobertura = new CoberturaView(CoberturaViewModel); + } + + public void Descarregar() + { + Cobertura = null; + } + + public void Manter(Item item, ManutencaoItem manutencao) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Invalid comparison between Unknown and I4 + if ((int)manutencao.Tipo == 1) + { + base.ItemSubstituido = item; + } + Manter(manutencao); + base.Mantido = true; + } + + public void Manter(ManutencaoItem manutencao) + { + //IL_006d: Unknown result type (might be due to invalid IL or missing references) + //IL_0077: Expected O, but got Unknown + //IL_0149: Unknown result type (might be due to invalid IL or missing references) + //IL_00c0: Unknown result type (might be due to invalid IL or missing references) + List obj = CoberturaViewModel.Coberturas?.ToList(); + List list = new List { 6L, 7L, 9L, 10L, 47L, 53L, 66L }; + if (SelectedItem.Vida == null) + { + SelectedItem.Vida = new Vida(); + } + if (((DomainBase)ItemSelecionado.Documento.Controle).Id != ((DomainBase)SelectedItem.Documento.Controle).Id) + { + Item selectedItem = SelectedItem; + if (selectedItem == null || selectedItem.Sinistros.Count() <= 0 || (int)manutencao.Tipo != 0) + { + if (!list.Contains(((DomainBase)Ramo).Id)) + { + ((DomainBase)SelectedItem).Id = 0L; + } + goto IL_0108; + } + } + ((DomainBase)SelectedItem).Id = 0L; + ((DomainBase)SelectedItem.Vida).Id = 0L; + goto IL_0108; + IL_0108: + Item selectedItem2 = SelectedItem; + Item itemSubstituido = base.ItemSubstituido; + selectedItem2.Substituicao = ((itemSubstituido != null) ? new long?(((DomainBase)itemSubstituido).Id) : null); + SelectedItem.Documento = ItemSelecionado.Documento; + if ((int)manutencao.Tipo == 0) + { + SelectedItem.Sinistrado = false; + SelectedItem.Status = ""; + SelectedItem.Sinistro = null; + SelectedItem.Sinistros = null; + } + CoberturaViewModel.CarregaPadrao(); + CoberturaViewModel.Coberturas = new ObservableCollection(); + obj?.ForEach(delegate(Cobertura x) + { + x.Item = SelectedItem; + CoberturaViewModel.Coberturas.Add(x); + }); + Alterar(alterar: true); + } + + public async void Substituir(Item item) + { + base.ItemSubstituido = item; + await Incluir(substituir: true); + } + + private async void Seleciona(Item item) + { + Loading(isLoading: true); + await PermissaoTela((TipoTela)3); + await SelecionaItem(item); + Loading(isLoading: false); + } + + public async Task SelecionaItem(Item item, bool registrar = true) + { + if (item != null && LastAccessId == ((DomainBase)item).Id && (int)LastAccessTela == 9) + { + return; + } + base.Mantido = false; + if (!new List { 6L, 7L, 9L, 10L, 47L, 53L, 66L }.Contains(((DomainBase)Ramo).Id)) + { + return; + } + AtualizarCamposSaude = (Visibility)((((DomainBase)Ramo).Id == 9) ? 2 : 0); + CoberturaViewModel.Ramo = Ramo; + if (CoberturaViewModel.CoberturasPadrao == null) + { + await CoberturaViewModel.SelectionaCoberturas(); + } + if (item == null || ((DomainBase)item).Id == 0L) + { + SelectedItem = null; + CoberturaViewModel.Coberturas = null; + base.IsVisible = (Visibility)0; + base.Titulares = new ObservableCollection(); + return; + } + Loading(isLoading: true); + item = await _itemServico.BuscarItemPorIdAsync(((DomainBase)item).Id); + Item val = item; + val.Vida = await _itemServico.BuscaVida(((DomainBase)item).Id); + await CarregarTitulares(((DomainBase)item).Id); + SelectedItem = item; + ((DomainBase)SelectedItem).Initialize(); + Initialized = true; + CoberturaViewModel.Item = item; + await CoberturaViewModel.CancelarAlteracao(); + if (registrar) + { + RegistrarAcao("ACESSOU ITEM DE DESCRIÇÃO \"" + SelectedItem.Descricao + "\"", ((DomainBase)SelectedItem).Id, (TipoTela)3, $"ID ITEM: {((DomainBase)SelectedItem).Id}\nID DOCUMENTO: {((DomainBase)SelectedItem.Documento).Id}\nRAMO: {SelectedItem.Documento.Controle.Ramo.Nome}\nCLIENTE: {SelectedItem.Documento.Controle.Cliente.Nome}\nID CLIENTE: {((DomainBase)SelectedItem.Documento.Controle.Cliente).Id}"); + } + LastAccessId = ((DomainBase)SelectedItem).Id; + LastAccessTela = (TipoTela)3; + CodigoItem = ((DomainBase)SelectedItem).Id.ToString(); + Loading(isLoading: false); + } + + public async Task Incluir(bool substituir = false) + { + List coberturas = ((CoberturaViewModel.Coberturas == null) ? CoberturaViewModel.CarregaCoberturaPadrao().ToList() : CoberturaViewModel.Coberturas.ToList()); + Item val = new Item(); + val.Documento = ItemSelecionado.Documento; + Item val2 = val; + int? ordem = (substituir ? base.ItemSubstituido.Ordem : new int?(await QuantidadeDeItens(((DomainBase)ItemSelecionado.Documento.Controle).Id))); + val2.Ordem = ordem; + val.Vida = new Vida + { + Item = SelectedItem + }; + val.Substituicao = (substituir ? new long?(((DomainBase)base.ItemSubstituido).Id) : null); + Item item = val; + base.Titulares = new ObservableCollection(); + if (item.Ordem.GetValueOrDefault() == 2 && !(await ShowMessage("ESTA APÓLICE SERÁ UMA FROTA, DESEJA CONTINUAR?", "SIM", "NÃO"))) + { + return; + } + bool flag = substituir; + if (flag) + { + flag = await ShowMessage("DESEJA COPIAR OS DADOS DO ITEM?", "SIM", "NÃO"); + } + if (flag) + { + ((DomainBase)SelectedItem).Id = 0L; + SelectedItem.Documento = ItemSelecionado.Documento; + } + else + { + SelectedItem = item; + SelectedItem.Vida.Item = item; + } + flag = item.Ordem > 1; + if (flag) + { + flag = await ShowMessage("DESEJA REPLICAR AS COBERTURAS DO ITEM SELECIONADO?", "SIM", "NÃO"); + } + if (flag) + { + CoberturaViewModel.Coberturas = new ObservableCollection(); + coberturas.ForEach(delegate(Cobertura x) + { + x.Item = SelectedItem; + CoberturaViewModel.Coberturas.Add(x); + }); + } + else + { + CoberturaViewModel.CarregaPadrao(); + } + if (substituir) + { + CoberturaViewModel.Coberturas = new ObservableCollection(); + coberturas.ForEach(delegate(Cobertura x) + { + x.Item = SelectedItem; + CoberturaViewModel.Coberturas.Add(x); + }); + } + Alterar(alterar: true); + } + + public async Task>> Salvar(List titularesGrid) + { + SelectedItem.Descricao = (string.IsNullOrWhiteSpace(SelectedItem.Descricao) ? (SelectedItem.Vida.Plano ?? "") : SelectedItem.Descricao); + SelectedItem.Titulares = titularesGrid; + List> list = SelectedItem.Validate(); + if (list.Count > 0) + { + return list; + } + Item selectedItem = SelectedItem; + selectedItem.Coberturas = await CoberturaViewModel.LimpaCoberturas(); + string status = ((SelectedItem.Documento.Ordem <= 0) ? "" : (base.Mantido ? $"ITEM ALTERADO NO ENDOSSO ORDEM {SelectedItem.Documento.Ordem}" : ((base.ItemSubstituido != null) ? $"SUBSTITUIÇÃO DO ITEM {base.ItemSubstituido.Ordem} NO ENDOSSO ORDEM {SelectedItem.Documento.Ordem}" : $"ITEM INCLUÍDO NO ENDOSSO ORDEM {SelectedItem.Documento.Ordem}"))); + if (((DomainBase)SelectedItem).Id == 0L) + { + SelectedItem.Status = status; + } + await _itemServico.DeleteTitulares(base.ExcluirTitulares); + base.ExcluirTitulares = new List(); + string acao = ((((DomainBase)SelectedItem).Id == 0L) ? "INCLUIU" : "ALTEROU"); + SelectedItem = await _itemServico.Save(SelectedItem); + foreach (TitularesVida item in titularesGrid) + { + item.IdItem = ((DomainBase)SelectedItem).Id; + } + List list2 = new List(); + foreach (TitularesVida t in titularesGrid) + { + if (((DomainBase)t).Id == 0L) + { + if (t.Inicio.HasValue) + { + list2.Add(t); + } + continue; + } + TitularesVida val = base.OldTitulares.First((TitularesVida x) => ((DomainBase)x).Id == ((DomainBase)t).Id); + if (t.Codigo != val.Codigo || t.Inicio != val.Inicio || t.Fim != val.Fim || t.Fatura != val.Fatura || t.Nome != val.Nome || t.Observacao != val.Observacao || t.Nascimento != val.Nascimento || t.Cpf != val.Cpf || t.Matricula != val.Matricula || !(t.Premio == val.Premio) || !(t.Capital == val.Capital) || t.Tipo != val.Tipo || t.Dependente != val.Dependente) + { + list2.Add(t); + } + } + base.Titulares = new ObservableCollection(await _itemServico.SaveTitulares(list2)); + if (!_itemServico.Sucesso) + { + return null; + } + if (base.ItemSubstituido != null) + { + string descricao = (base.Mantido ? $"ITEM ALTERADO NO ENDOSSO ORDEM {SelectedItem.Documento.Ordem}" : $"ITEM SUBSTITUIDO NO ENDOSSO ORDEM {SelectedItem.Documento.Ordem}"); + await _itemServico.Substituir(base.ItemSubstituido, ((DomainBase)SelectedItem).Id, descricao); + } + base.Mantido = false; + await SelecionaItem(SelectedItem, registrar: false); + ItemSelecionado = SelectedItem; + if (Invoke) + { + ConsultaViewModel.ItemSelecionado = SelectedItem; + } + ToggleSnackBar(Ramo.Nome + " SALVO COM SUCESSO"); + RegistrarAcao(acao + " ITEM DE DESCRIÇÃO \"" + SelectedItem.Descricao + "\"", ((DomainBase)SelectedItem).Id, (TipoTela)3, $"ID ITEM: {((DomainBase)SelectedItem).Id}\nID DOCUMENTO: {((DomainBase)SelectedItem.Documento).Id}\nRAMO: {SelectedItem.Documento.Controle.Ramo.Nome}\nCLIENTE: {SelectedItem.Documento.Controle.Cliente.Nome}\nID CLIENTE: {((DomainBase)SelectedItem.Documento.Controle.Cliente).Id}"); + Alterar(alterar: false); + return null; + } + + public async void CancelarAlteracao() + { + Loading(isLoading: true); + base.AllSelected = false; + await SelecionaItem(ItemSelecionado, registrar: false); + await CoberturaViewModel.CancelarAlteracao(); + Alterar(alterar: false); + Loading(isLoading: false); + } + + public async Task Excluir() + { + if (SelectedItem == null || ((DomainBase)SelectedItem).Id == 0L) + { + return false; + } + if (!(await ShowMessage("DESEJA EXCLUIR?", "SIM", "NÃO"))) + { + return false; + } + Loading(isLoading: true); + bool num = await _servico.Delete(SelectedItem); + Loading(isLoading: false); + if (!num) + { + await ShowMessage("NÃO POSSÍVEL EXCLUIR O ITEM"); + return false; + } + RegistrarAcao("EXCLUIU ITEM DE DESCRIÇÃO \"" + SelectedItem.Descricao + "\"", ((DomainBase)SelectedItem).Id, (TipoTela)3, $"ID ITEM: {((DomainBase)SelectedItem).Id}\nID DOCUMENTO: {((DomainBase)SelectedItem.Documento).Id}\nRAMO: {SelectedItem.Documento.Controle.Ramo.Nome}\nCLIENTE: {SelectedItem.Documento.Controle.Cliente.Nome}\nID CLIENTE: {((DomainBase)SelectedItem.Documento.Controle.Cliente).Id}"); + ToggleSnackBar(Ramo.Nome + " EXCLUÍDO COM SUCESSO"); + return true; + } + + public void Dispose() + { + Gestor.Application.Actions.Actions.UpdateItem = (Action)Delegate.Remove(Gestor.Application.Actions.Actions.UpdateItem, new Action(Seleciona)); + Gestor.Application.Actions.Actions.SubstituirItem = (Action)Delegate.Remove(Gestor.Application.Actions.Actions.SubstituirItem, new Action(Substituir)); + Gestor.Application.Actions.Actions.ManterItem = (Action)Delegate.Remove(Gestor.Application.Actions.Actions.ManterItem, new Action(Manter)); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Seguros/ApoliceViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Seguros/ApoliceViewModel.cs new file mode 100644 index 0000000..15c8dba --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Seguros/ApoliceViewModel.cs @@ -0,0 +1,73 @@ +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Gestor.Application.Drawers; +using Gestor.Application.Helpers; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Seguros; + +public class ApoliceViewModel : BaseApoliceViewModel +{ + private bool _documentoExcluido; + + public bool DocumentoExcluido + { + get + { + return _documentoExcluido; + } + set + { + _documentoExcluido = value; + OnPropertyChanged("DocumentoExcluido"); + } + } + + public ApoliceViewModel(AcessoApolice acesso, Documento documentoSelecionado, bool invoke = true, long idparcela = 0L) + { + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + base.Invoke = invoke; + base.Acesso = acesso; + base.DocumentoSelecionado = documentoSelecionado; + long parcelaSelecionada; + if (!invoke) + { + parcelaSelecionada = idparcela; + } + else + { + Parcela parcelaSelecionada2 = ConsultaViewModel.ParcelaSelecionada; + parcelaSelecionada = ((parcelaSelecionada2 != null) ? ((DomainBase)parcelaSelecionada2).Id : 0); + } + base.ParcelaSelecionada = parcelaSelecionada; + DocumentoExcluido = base.DocumentoSelecionado != null && base.DocumentoSelecionado.Excluido; + Seleciona(base.DocumentoSelecionado); + } + + public async Task Alteracao(bool alterar) + { + if (!base.AllowEditApolice || base.Parcelas.Any((Parcela x) => x.DataRecebimento.HasValue) || base.Repasses.Any((VendedorParcela x) => x.DataPagamento.HasValue)) + { + await ShowMessage("DOCUMENTO POSSUI BAIXAS DE COMISSÃO OU PAGAMENTO DE VENDEDORES.\nNÃO SERÁ POSSÍVEL ALTERAR ALGUMAS INFORMAÇÕES DO DOCUMENTO.\nPARA ISSO, EXCLUA AS BAIXAS E O PAGAMENTO DO VENDEDOR"); + return; + } + List seguradoras = Recursos.Seguradoras.Where((Seguradora x) => x.Ativo || ((DomainBase)x).Id == ((DomainBase)base.SelectedDocumento.Controle.Seguradora).Id).ToList(); + base.Seguradoras = seguradoras; + base.SeguradorasAnteriores = Recursos.Seguradoras; + List ramos = Recursos.Ramos.Where((Ramo x) => x.Ativo || ((DomainBase)x).Id == ((DomainBase)base.SelectedDocumento.Controle.Ramo).Id).ToList(); + base.Ramos = ramos; + List produtos = Recursos.Produtos.Where((Produto x) => x.Ativo || (base.SelectedDocumento.Controle.Produto != null && ((DomainBase)x).Id == ((DomainBase)base.SelectedDocumento.Controle.Produto).Id)).ToList(); + base.Produtos = produtos; + List status = Recursos.Status.Where((Status x) => x.Ativo || (base.SelectedDocumento.Status != null && ((DomainBase)x).Id == ((DomainBase)base.SelectedDocumento.Status).Id)).ToList(); + base.Status = status; + } + + public void AbrirInfo() + { + ShowDrawer(new InfoDrawer(base.SelectedDocumento, ocultarInfos: true), 0, close: false); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Seguros/ClienteViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Seguros/ClienteViewModel.cs new file mode 100644 index 0000000..278faa9 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Seguros/ClienteViewModel.cs @@ -0,0 +1,1343 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net.Http; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Input; +using Agger.Registro; +using Gestor.Application.Actions; +using Gestor.Application.Drawers; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.Servicos.Ferramentas; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.ViewModels.Command; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Security; +using Gestor.Common.Validation; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Newtonsoft.Json; + +namespace Gestor.Application.ViewModels.Seguros; + +public class ClienteViewModel : BaseSegurosViewModel +{ + private const int NumeroMaximoCadastros = 9; + + private readonly ClienteServico _servico; + + private const string AddCentralSegurado = "ADICIONAR CENTRAL SEGURADO"; + + private const string UpdateCentralSegurado = "ALTERAR DADOS/SENHA CENTRAL SEGURADO"; + + private bool _visibilityLogAntigo = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 22); + + private ObservableCollection _telefones = new ObservableCollection(); + + private ObservableCollection _emails = new ObservableCollection(); + + private ObservableCollection _enderecos = new ObservableCollection(); + + private ObservableCollection _contatos = new ObservableCollection(); + + private ObservableCollection _vinculos = new ObservableCollection(); + + private Cliente _vinculo; + + private bool _isLoading; + + private bool _clienteExcluido; + + private DateTime? _nascimentoCliente; + + private DateTime? _habilitaCliente; + + private DateTime? _vencimentoHabCliente; + + private DateTime? _expedicaoCliente; + + private Cliente _selectedCliente; + + private string _fieldNascimento = "NASCIMENTO"; + + private string _fieldDocumento = "CPF"; + + private Visibility _visibilityJuridica = (Visibility)2; + + private Visibility _visibilityFisica = (Visibility)2; + + private bool _enableAddTelephone = true; + + private bool _enableAddAddress = true; + + private bool _enableAddEmail = true; + + private bool _enableAddContact = true; + + private string _profissaoText; + + private string _atividadeText; + + private bool _saving; + + private ObservableCollection _origens; + + private OrigemCliente _selectedOrigem; + + private Cliente ClienteSelecionado { get; set; } + + private bool Invoke { get; } + + public Visibility AddUsuarioCentralSeguradoVisibility { get; set; } = (Visibility)(string.IsNullOrEmpty(Connection.UrlCentralSegurado) ? 2 : 0); + + + public ICommand CommandAddUsuarioCentralSegurado { get; set; } + + public string LabelAddUsuarioCentralSegurado + { + get + { + if (SelectedCliente == null || !SelectedCliente.EstaNaCentralSegurado) + { + return "ADICIONAR CENTRAL SEGURADO"; + } + return "ALTERAR DADOS/SENHA CENTRAL SEGURADO"; + } + } + + public bool VisibilityLogAntigo + { + get + { + return _visibilityLogAntigo; + } + set + { + _visibilityLogAntigo = value; + OnPropertyChanged("VisibilityLogAntigo"); + } + } + + public ObservableCollection Telefones + { + get + { + return _telefones; + } + set + { + _telefones = value; + OnPropertyChanged("Telefones"); + } + } + + public ObservableCollection Emails + { + get + { + return _emails; + } + set + { + _emails = value; + OnPropertyChanged("Emails"); + } + } + + public ObservableCollection Enderecos + { + get + { + return _enderecos; + } + set + { + _enderecos = value; + OnPropertyChanged("Enderecos"); + } + } + + public ObservableCollection Contatos + { + get + { + return _contatos; + } + set + { + _contatos = value; + OnPropertyChanged("Contatos"); + } + } + + public ObservableCollection Vinculos + { + get + { + return _vinculos; + } + set + { + if (value != null && value.Count > 0 && SelectedCliente != null) + { + foreach (ClienteVinculo item in value) + { + if (((DomainBase)item.Cliente2).Id == ((DomainBase)SelectedCliente).Id) + { + item.Parentesco = Funcoes.ParentescoInverso(item.Parentesco); + } + } + } + _vinculos = value; + OnPropertyChanged("Vinculos"); + } + } + + public Cliente Vinculo + { + get + { + return _vinculo; + } + set + { + _vinculo = value; + OnPropertyChanged("Vinculo"); + } + } + + public bool Salvando { get; set; } + + public bool IsLoading + { + get + { + return _isLoading; + } + set + { + _isLoading = value; + OnPropertyChanged("IsLoading"); + } + } + + public bool ClienteExcluido + { + get + { + return _clienteExcluido; + } + set + { + _clienteExcluido = value; + OnPropertyChanged("ClienteExcluido"); + } + } + + public DateTime? NascimentoCliente + { + get + { + return _nascimentoCliente; + } + set + { + _nascimentoCliente = value; + OnPropertyChanged("NascimentoCliente"); + } + } + + public DateTime? HabilitaCliente + { + get + { + return _habilitaCliente; + } + set + { + _habilitaCliente = value; + OnPropertyChanged("HabilitaCliente"); + } + } + + public DateTime? VencimentoHabCliente + { + get + { + return _vencimentoHabCliente; + } + set + { + _vencimentoHabCliente = value; + OnPropertyChanged("VencimentoHabCliente"); + } + } + + public DateTime? ExpedicaoCliente + { + get + { + return _expedicaoCliente; + } + set + { + _expedicaoCliente = value; + OnPropertyChanged("ExpedicaoCliente"); + } + } + + public Cliente SelectedCliente + { + get + { + return _selectedCliente; + } + set + { + _selectedCliente = value; + WorkOnSelectedCliente(value); + VerificarEnables((value != null) ? new long?(((DomainBase)value).Id) : null); + OnPropertyChanged("SelectedCliente"); + OnPropertyChanged("LabelAddUsuarioCentralSegurado"); + } + } + + private bool IsJuridica { get; set; } + + public string FieldNascimento + { + get + { + return _fieldNascimento; + } + set + { + _fieldNascimento = value; + OnPropertyChanged("FieldNascimento"); + } + } + + public string FieldDocumento + { + get + { + return _fieldDocumento; + } + set + { + _fieldDocumento = value; + OnPropertyChanged("FieldDocumento"); + } + } + + public Visibility VisibilityJuridica + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityJuridica; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityJuridica = value; + OnPropertyChanged("VisibilityJuridica"); + } + } + + public Visibility VisibilityFisica + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityFisica; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityFisica = value; + OnPropertyChanged("VisibilityFisica"); + } + } + + public bool EnableAddTelephone + { + get + { + return _enableAddTelephone; + } + set + { + _enableAddTelephone = value; + OnPropertyChanged("EnableAddTelephone"); + } + } + + public bool EnableAddAddress + { + get + { + return _enableAddAddress; + } + set + { + _enableAddAddress = value; + OnPropertyChanged("EnableAddAddress"); + } + } + + public bool EnableAddEmail + { + get + { + return _enableAddEmail; + } + set + { + _enableAddEmail = value; + OnPropertyChanged("EnableAddEmail"); + } + } + + public bool EnableAddContact + { + get + { + return _enableAddContact; + } + set + { + _enableAddContact = value; + OnPropertyChanged("EnableAddContact"); + } + } + + public string ProfissaoText + { + get + { + return _profissaoText; + } + set + { + _profissaoText = value; + OnPropertyChanged("ProfissaoText"); + } + } + + public string AtividadeText + { + get + { + return _atividadeText; + } + set + { + _atividadeText = value; + OnPropertyChanged("AtividadeText"); + } + } + + public ObservableCollection Origens + { + get + { + return _origens; + } + set + { + _origens = value; + OnPropertyChanged("Origens"); + if (Origens != null) + { + SelectedOrigem = Origens.FirstOrDefault(); + } + } + } + + public OrigemCliente SelectedOrigem + { + get + { + return _selectedOrigem; + } + set + { + _selectedOrigem = value; + OnPropertyChanged("SelectedOrigem"); + } + } + + public ClienteViewModel(Cliente cliente = null, bool invoke = true) + { + //IL_0011: Unknown result type (might be due to invalid IL or missing references) + //IL_0094: Unknown result type (might be due to invalid IL or missing references) + //IL_009b: Unknown result type (might be due to invalid IL or missing references) + Invoke = invoke; + _servico = new ClienteServico(); + ClienteSelecionado = cliente ?? MainViewModel.ClienteSelecionado; + SelecionaCliente(ClienteSelecionado); + CommandAddUsuarioCentralSegurado = new RelayCommand(delegate + { + AddUsuarioCentralSegurado(); + }); + } + + public async void SelecionaCliente(Cliente value) + { + if (!_saving || !Invoke) + { + if (value == null) + { + ClienteSelecionado = new Cliente(); + value = ClienteSelecionado; + } + Loading(isLoading: true); + await PermissaoTela((TipoTela)1); + await CarregaCliente(value); + Loading(isLoading: false); + } + } + + public async Task CarregaCliente(Cliente value) + { + if (value == null || ((DomainBase)value).Id == 0L) + { + SelectedCliente = null; + Telefones = null; + Enderecos = null; + Emails = null; + Contatos = null; + Vinculos = null; + Origens = null; + return; + } + Cliente cliente = value; + if (((DomainBase)value).Id != 0L) + { + cliente = await _servico.BuscarCliente(((DomainBase)value).Id); + Cliente val = cliente; + val.Telefones = await _servico.BuscarTelefonesAsync(((DomainBase)value).Id); + ClienteViewModel clienteViewModel = this; + ObservableCollection telefones = cliente.Telefones; + clienteViewModel.EnableAddTelephone = telefones != null && telefones.Count <= 9; + val = cliente; + val.Emails = await _servico.BuscarEmailsAsync(((DomainBase)value).Id); + ClienteViewModel clienteViewModel2 = this; + ObservableCollection emails = cliente.Emails; + clienteViewModel2.EnableAddEmail = emails != null && emails.Count <= 9; + val = cliente; + val.Enderecos = await _servico.BuscarEnderecosAsync(((DomainBase)value).Id); + ClienteViewModel clienteViewModel3 = this; + ObservableCollection enderecos = cliente.Enderecos; + clienteViewModel3.EnableAddAddress = enderecos != null && enderecos.Count <= 9; + val = cliente; + val.Contatos = await _servico.BuscarContatosAsync(((DomainBase)value).Id); + ClienteViewModel clienteViewModel4 = this; + ObservableCollection contatos = cliente.Contatos; + clienteViewModel4.EnableAddContact = contatos != null && contatos.Count <= 9; + val = cliente; + val.Vinculos = await _servico.BuscarVinculosAsync(((DomainBase)value).Id); + Origens = await _servico.BuscarOrigens(((DomainBase)value).Id); + Telefones = cliente.Telefones; + ObservableCollection telefones2 = Telefones; + if (telefones2 != null && telefones2.Count == 0) + { + IncluirTelefone(); + } + Emails = cliente.Emails; + ObservableCollection emails2 = Emails; + if (emails2 != null && emails2.Count == 0) + { + IncluirEmail(); + } + Enderecos = cliente.Enderecos; + ObservableCollection enderecos2 = Enderecos; + if (enderecos2 != null && enderecos2.Count == 0) + { + IncluirEndereco(); + } + Contatos = cliente.Contatos; + Vinculos = cliente.Vinculos; + } + if (!cliente.DocumentoPrincipal.HasValue) + { + cliente.DocumentoPrincipal = (TipoDocumento)0; + } + if (cliente.ResponsavelAssinatura == null) + { + cliente.ResponsavelAssinatura = new ResponsavelAssinatura + { + IdCliente = ((DomainBase)cliente).Id + }; + } + SelectedCliente = cliente; + JuridicaouFisica(SelectedCliente.Documento); + ((DomainBase)SelectedCliente).Initialize(); + SelectedCliente.Telefones?.ToList().ForEach(delegate(ClienteTelefone telefone) + { + ((DomainBase)telefone).Initialize(); + }); + SelectedCliente.Enderecos?.ToList().ForEach(delegate(ClienteEndereco endereco) + { + ((DomainBase)endereco).Initialize(); + }); + SelectedCliente.Contatos?.ToList().ForEach(delegate(MaisContato contato) + { + ((DomainBase)contato).Initialize(); + }); + SelectedCliente.Emails?.ToList().ForEach(delegate(ClienteEmail email) + { + ((DomainBase)email).Initialize(); + }); + SelectedCliente.Vinculos?.ToList().ForEach(delegate(ClienteVinculo vinculo) + { + ((DomainBase)vinculo).Initialize(); + }); + Initialized = true; + } + + private async void WorkOnSelectedCliente(Cliente value) + { + if (value != null && ((DomainBase)value).Id != 0L && !IsLoading) + { + Loading(isLoading: true); + Cliente cliente = await _servico.BuscarCliente(((DomainBase)value).Id); + if (cliente.ResponsavelAssinatura == null) + { + cliente.ResponsavelAssinatura = new ResponsavelAssinatura + { + IdCliente = ((DomainBase)cliente).Id + }; + } + Cliente val = cliente; + val.Telefones = await _servico.BuscarTelefonesAsync(((DomainBase)value).Id); + val = cliente; + val.Emails = await _servico.BuscarEmailsAsync(((DomainBase)value).Id); + val = cliente; + val.Enderecos = await _servico.BuscarEnderecosAsync(((DomainBase)value).Id); + val = cliente; + val.Contatos = await _servico.BuscarContatosAsync(((DomainBase)value).Id); + val = cliente; + val.Vinculos = await _servico.BuscarVinculosAsync(((DomainBase)value).Id); + Origens = await _servico.BuscarOrigens(((DomainBase)value).Id); + cliente.DocumentoPrincipal = cliente.DocumentoPrincipal.GetValueOrDefault(); + ClienteExcluido = cliente.Excluido; + if (SelectedCliente != null) + { + DomainBase.Copy(SelectedCliente, cliente); + JuridicaouFisica(SelectedCliente.Documento); + ((DomainBase)SelectedCliente).Initialize(); + ClienteSelecionado = cliente; + } + NascimentoCliente = ((value != null && value.Nascimento.HasValue) ? value.Nascimento : new DateTime?(Funcoes.GetNetworkTime().Date)); + HabilitaCliente = ((value != null && value.PrimeiraHabilitacao.HasValue) ? value.PrimeiraHabilitacao : new DateTime?(Funcoes.GetNetworkTime().Date)); + VencimentoHabCliente = ((value != null && value.VencimentoHabilitacao.HasValue) ? value.VencimentoHabilitacao : new DateTime?(Funcoes.GetNetworkTime().Date)); + ExpedicaoCliente = ((value != null && value.Expedicao.HasValue) ? value.Expedicao : new DateTime?(Funcoes.GetNetworkTime().Date)); + Initialized = true; + Loading(isLoading: false); + } + } + + public void JuridicaouFisica(string documento) + { + if (SelectedCliente != null) + { + ProfissaoText = ""; + AtividadeText = ""; + if (documento == null || ValidationHelper.OnlyNumber(documento).Length > 11) + { + VisibilityJuridica = (Visibility)0; + VisibilityFisica = (Visibility)2; + FieldNascimento = "FUNDAÇÃO"; + FieldDocumento = "CNPJ"; + SelectedCliente.Profissao = null; + IsJuridica = true; + } + else + { + VisibilityJuridica = (Visibility)2; + VisibilityFisica = (Visibility)0; + FieldNascimento = "NASCIMENTO"; + FieldDocumento = "CPF"; + SelectedCliente.Atividade = null; + IsJuridica = false; + } + } + } + + public void IncluirEmail() + { + //IL_0031: Unknown result type (might be due to invalid IL or missing references) + //IL_0036: Unknown result type (might be due to invalid IL or missing references) + //IL_0042: Unknown result type (might be due to invalid IL or missing references) + //IL_005b: Expected O, but got Unknown + if (SelectedCliente != null) + { + if (Emails == null) + { + Emails = new ObservableCollection(); + } + EnableAddEmail = Emails.Count < 9; + ClienteEmail item = new ClienteEmail + { + Cliente = SelectedCliente, + Ordem = Emails.Count + 1 + }; + Emails.Add(item); + OnPropertyChanged("IncluirEmail"); + } + } + + public void IncluirTelefone() + { + //IL_0031: Unknown result type (might be due to invalid IL or missing references) + //IL_0036: Unknown result type (might be due to invalid IL or missing references) + //IL_0042: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_0067: Expected O, but got Unknown + if (SelectedCliente != null) + { + if (Telefones == null) + { + Telefones = new ObservableCollection(); + } + EnableAddTelephone = Telefones.Count < 9; + ClienteTelefone item = new ClienteTelefone + { + Cliente = SelectedCliente, + Tipo = (TipoTelefone)1, + Ordem = Telefones.Count + 1 + }; + Telefones.Add(item); + OnPropertyChanged("IncluirTelefone"); + } + } + + public async Task IncluirOrigem(string name) + { + if (SelectedCliente != null && !string.IsNullOrWhiteSpace(name)) + { + if (Origens == null) + { + Origens = new ObservableCollection(); + } + if (Origens.Any((OrigemCliente x) => x.Nome?.Trim() == name.Trim())) + { + await ShowMessage("JÁ EXISTE UMA ORIGEM " + name + ". PROCESSO CANCELADO."); + return; + } + Origens.Insert(0, new OrigemCliente + { + Cliente = SelectedCliente, + Nome = name, + TipoOrigem = 1L + }); + OnPropertyChanged("Origens"); + } + } + + public void IncluirEndereco() + { + //IL_0031: Unknown result type (might be due to invalid IL or missing references) + //IL_0036: Unknown result type (might be due to invalid IL or missing references) + //IL_0042: Unknown result type (might be due to invalid IL or missing references) + //IL_005b: Expected O, but got Unknown + if (SelectedCliente != null) + { + if (Enderecos == null) + { + Enderecos = new ObservableCollection(); + } + EnableAddAddress = Enderecos.Count < 9; + ClienteEndereco item = new ClienteEndereco + { + Cliente = SelectedCliente, + Ordem = Enderecos.Count + 1 + }; + Enderecos.Add(item); + OnPropertyChanged("IncluirEndereco"); + } + } + + public void IncluirContato() + { + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0021: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Expected O, but got Unknown + if (SelectedCliente != null) + { + if (Contatos == null) + { + Contatos = new ObservableCollection(); + } + MaisContato item = new MaisContato + { + Cliente = SelectedCliente + }; + EnableAddContact = Contatos.Count < 9; + Contatos.Add(item); + OnPropertyChanged("IncluirContato"); + } + } + + public bool IncluirVinculo() + { + //IL_0050: Unknown result type (might be due to invalid IL or missing references) + //IL_0055: Unknown result type (might be due to invalid IL or missing references) + //IL_0061: Unknown result type (might be due to invalid IL or missing references) + //IL_006e: Expected O, but got Unknown + if (Vinculo == null || ((DomainBase)Vinculo).Id == ((DomainBase)SelectedCliente).Id) + { + return false; + } + if (Vinculos == null) + { + Vinculos = new ObservableCollection(); + } + if (Vinculos.Any((ClienteVinculo x) => ((DomainBase)x.Cliente1).Id == ((DomainBase)Vinculo).Id || ((DomainBase)x.Cliente2).Id == ((DomainBase)Vinculo).Id)) + { + return false; + } + ClienteVinculo item = new ClienteVinculo + { + Cliente1 = SelectedCliente, + Cliente2 = Vinculo + }; + Vinculos.Add(item); + Vinculo = null; + OnPropertyChanged("IncluirVinculo"); + return true; + } + + public async void ExcluirTelefone(ClienteTelefone telefone) + { + if (Telefones.Count < 2) + { + await ShowMessage("É NECESSÁRIO TER AO MENOS UM CONTATO TELEFÔNICO CADASTRADO."); + return; + } + EnableAddTelephone = Telefones.Count <= 9; + Telefones.Remove(telefone); + } + + public async void ExcluirEmail(ClienteEmail email) + { + if (Emails.Count < 2 && Recursos.Configuracoes.All((ConfiguracaoSistema x) => (int)x.Configuracao != 29)) + { + await ShowMessage("É NECESSÁRIO TER AO MENOS UM CONTATO DE E-MAIL CADASTRADO."); + return; + } + EnableAddEmail = Emails.Count <= 9; + Emails.Remove(email); + } + + public async void ExcluirEndereco(ClienteEndereco endereco) + { + if (Enderecos.Count < 2) + { + await ShowMessage("É NECESSÁRIO TER AO MENOS UM ENDEREÇO CADASTRADO."); + return; + } + EnableAddAddress = Enderecos.Count <= 9; + Enderecos.Remove(endereco); + } + + public void ExcluirContato(MaisContato contato) + { + EnableAddContact = Contatos.Count <= 9; + Contatos.Remove(contato); + } + + public void ExcluirVinculo(ClienteVinculo vinculo) + { + Vinculos.Remove(vinculo); + } + + public async Task Validate(ClienteEmail item) + { + if (ValidationHelper.ValidateMail(((EmailBase)item).Email)) + { + return true; + } + await ShowMessage("ENDEREÇO DE E-MAIL INVÁLIDO"); + return false; + } + + public void IncluirCliente() + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_0030: Unknown result type (might be due to invalid IL or missing references) + //IL_003c: Unknown result type (might be due to invalid IL or missing references) + //IL_003d: Unknown result type (might be due to invalid IL or missing references) + //IL_0047: Expected O, but got Unknown + //IL_004c: Expected O, but got Unknown + //IL_0083: Unknown result type (might be due to invalid IL or missing references) + //IL_0088: Unknown result type (might be due to invalid IL or missing references) + //IL_0094: Unknown result type (might be due to invalid IL or missing references) + //IL_00a0: Unknown result type (might be due to invalid IL or missing references) + //IL_00b1: Expected O, but got Unknown + //IL_00bd: Unknown result type (might be due to invalid IL or missing references) + //IL_00c2: Unknown result type (might be due to invalid IL or missing references) + //IL_00ce: Unknown result type (might be due to invalid IL or missing references) + //IL_00df: Expected O, but got Unknown + //IL_00eb: Unknown result type (might be due to invalid IL or missing references) + //IL_00f0: Unknown result type (might be due to invalid IL or missing references) + //IL_00fc: Unknown result type (might be due to invalid IL or missing references) + //IL_010d: Expected O, but got Unknown + DateTime date = Funcoes.GetNetworkTime().Date; + SelectedCliente = new Cliente + { + IdEmpresa = Recursos.Usuario.IdEmpresa, + DocumentoPrincipal = (TipoDocumento)0, + ClienteDesde = date, + ResponsavelAssinatura = new ResponsavelAssinatura() + }; + NascimentoCliente = date; + HabilitaCliente = date; + VencimentoHabCliente = date; + ExpedicaoCliente = date; + Telefones = new ObservableCollection + { + new ClienteTelefone + { + Cliente = SelectedCliente, + Tipo = (TipoTelefone)1, + Ordem = 1 + } + }; + Enderecos = new ObservableCollection + { + new ClienteEndereco + { + Cliente = SelectedCliente, + Ordem = 1 + } + }; + Emails = new ObservableCollection + { + new ClienteEmail + { + Cliente = SelectedCliente, + Ordem = 1 + } + }; + Contatos = new ObservableCollection(); + Vinculos = new ObservableCollection(); + Origens = new ObservableCollection(); + Salvando = true; + Alterar(alterar: true); + } + + public async void CancelarAlteracao() + { + Loading(isLoading: true); + IsLoading = true; + Alterar(alterar: false); + await CarregaCliente(ClienteSelecionado); + Salvando = false; + IsLoading = false; + Loading(isLoading: false); + } + + public async void Excluir() + { + if (SelectedCliente == null || ((DomainBase)SelectedCliente).Id == 0L) + { + return; + } + if ((await new ApoliceServico().BuscarApolicesAsync(((DomainBase)SelectedCliente).Id, (FiltroStatusDocumento)4)).Count > 0) + { + await ShowMessage("NÃO É POSSÍVEL EXCLUIR O CLIENTE POIS POSSUI APÓLICES CADASTRADAS."); + } + else if (await ShowMessage("DESEJA EXCLUIR?", "SIM", "NÃO")) + { + Cliente cliente = SelectedCliente; + cliente.Excluido = true; + if (await _servico.Delete(cliente)) + { + ClienteSelecionado = null; + MainViewModel.ClienteSelecionado = null; + Gestor.Application.Actions.Actions.LimparCliente?.Invoke(); + SelectedCliente = new Cliente + { + IdEmpresa = Recursos.Usuario.IdEmpresa, + DocumentoPrincipal = (TipoDocumento)0, + ClienteDesde = Funcoes.GetNetworkTime().Date + }; + Telefones = new ObservableCollection + { + new ClienteTelefone + { + Cliente = SelectedCliente, + Tipo = (TipoTelefone)1, + Ordem = 1 + } + }; + Enderecos = new ObservableCollection + { + new ClienteEndereco + { + Cliente = SelectedCliente, + Ordem = 1 + } + }; + Emails = new ObservableCollection + { + new ClienteEmail + { + Cliente = SelectedCliente, + Ordem = 1 + } + }; + Contatos = new ObservableCollection(); + Vinculos = new ObservableCollection(); + Origens = new ObservableCollection(); + string descricao = $"EXCLUIU CLIENTE \"{cliente.Nome}\", ID: {((DomainBase)cliente).Id}"; + RegistrarAcao(descricao, ((DomainBase)cliente).Id, (TipoTela)1, $"CLIENTE \"{SelectedCliente.Nome}\", ID: {((DomainBase)SelectedCliente).Id}"); + ToggleSnackBar("CLIENTE EXCLUÍDO COM SUCESSO"); + } + } + } + + public async Task>> Salvar() + { + List list = Telefones.Where((ClienteTelefone x) => !string.IsNullOrEmpty(((TelefoneBase)x).Numero)).ToList(); + List list2 = Enderecos.Where((ClienteEndereco x) => !string.IsNullOrEmpty(((EnderecoBase)x).Endereco)).ToList(); + List list3 = Contatos?.Where((MaisContato x) => !string.IsNullOrEmpty(x.Nome)).ToList(); + List emails = Emails.Where((ClienteEmail x) => !string.IsNullOrEmpty(((EmailBase)x).Email)).ToList(); + List list4 = Vinculos?.Where((ClienteVinculo x) => x.Cliente2 != null && x.Parentesco.HasValue).ToList(); + if (list4 != null && ClienteSelecionado != null) + { + foreach (ClienteVinculo item in list4.Where((ClienteVinculo c) => ((DomainBase)c.Cliente2).Id == ((DomainBase)ClienteSelecionado).Id)) + { + item.Parentesco = Funcoes.ParentescoInverso(item.Parentesco); + } + } + SelectedCliente.Telefones = new ObservableCollection(list); + SelectedCliente.Enderecos = new ObservableCollection(list2); + SelectedCliente.Contatos = ((list3 != null) ? new ObservableCollection(list3) : null); + SelectedCliente.Emails = new ObservableCollection(emails); + SelectedCliente.Vinculos = ((list4 != null) ? new ObservableCollection(list4) : null); + SelectedCliente.Origens = Origens?.ToList(); + if (ValidationHelper.OnlyNumber(SelectedCliente.Documento).Length <= 11 && !string.IsNullOrWhiteSpace(ProfissaoText) && SelectedCliente.Profissao == null) + { + ProfissaoServico profissaoServico = new ProfissaoServico(); + Cliente selectedCliente = SelectedCliente; + ProfissaoServico profissaoServico2 = profissaoServico; + Profissao val = new Profissao(); + val.Nome = ProfissaoText; + val.Codigo = "0"; + Profissao val2 = val; + ((DomainBase)val2).Id = await profissaoServico.FindLastId() + 1; + selectedCliente.Profissao = await profissaoServico2.Save(val); + if (!profissaoServico.Sucesso) + { + return null; + } + } + if (ValidationHelper.OnlyNumber(SelectedCliente.Documento).Length > 11 && !string.IsNullOrWhiteSpace(AtividadeText) && SelectedCliente.Atividade == null) + { + AtividadeServico atividadeServico = new AtividadeServico(); + Cliente selectedCliente = SelectedCliente; + AtividadeServico atividadeServico2 = atividadeServico; + Atividade val3 = new Atividade(); + val3.Nome = AtividadeText; + val3.Cnac = "0"; + Atividade val4 = val3; + ((DomainBase)val4).Id = await atividadeServico.FindLastId() + 1; + selectedCliente.Atividade = await atividadeServico2.Save(val3); + if (!atividadeServico.Sucesso) + { + return null; + } + } + if (IsJuridica) + { + SelectedCliente.Cei = null; + SelectedCliente.Rne = null; + SelectedCliente.Caepf = null; + } + List> errorMessages = SelectedCliente.Validate(); + emails.ForEach(delegate(ClienteEmail x) + { + errorMessages.AddRange(x.Validate()); + }); + List> list5 = errorMessages; + list5.AddRange(await Validate()); + foreach (MaisContato contato in Contatos) + { + errorMessages.AddRange(contato.Validate()); + } + foreach (ClienteVinculo vinculo in Vinculos) + { + errorMessages.AddRange(vinculo.Validate()); + } + if (errorMessages.Count > 0) + { + return errorMessages; + } + bool insert = ((DomainBase)SelectedCliente).Id == 0; + _saving = true; + Cliente clienteSelecionado = ClienteSelecionado; + int num2; + if (clienteSelecionado == null || ((DomainBase)clienteSelecionado).Id != 0) + { + Cliente clienteSelecionado2 = ClienteSelecionado; + long? num = ((clienteSelecionado2 != null) ? new long?(((DomainBase)clienteSelecionado2).Id) : null); + Cliente selectedCliente2 = SelectedCliente; + if (num == ((selectedCliente2 != null) ? new long?(((DomainBase)selectedCliente2).Id) : null)) + { + num2 = (Salvando ? 1 : 0); + goto IL_0815; + } + } + num2 = 0; + goto IL_0815; + IL_0815: + bool flag = (byte)num2 != 0; + if (flag) + { + flag = await ShowMessage("NÃO FOI POSSIVEL INCLUIR UM NOVO SEGURADO, TENTE NOVAMENTE"); + } + if (flag) + { + return null; + } + SelectedCliente = await _servico.Save(SelectedCliente, Salvando); + if (!_servico.Sucesso) + { + return null; + } + if (Invoke) + { + Gestor.Application.Actions.Actions.SelectCliente?.Invoke(SelectedCliente); + } + await CarregaCliente(SelectedCliente); + string text = (insert ? "INCLUIU" : "ALTEROU"); + RegistrarAcao(text + " CLIENTE \"" + SelectedCliente.Nome + "\"", ((DomainBase)SelectedCliente).Id, (TipoTela)1, $"CLIENTE \"{SelectedCliente.Nome}\", ID: {((DomainBase)SelectedCliente).Id}"); + ToggleSnackBar("CLIENTE SALVO COM SUCESSO"); + if (Invoke) + { + ConsultaViewModel.DocumentoSelecionado = null; + Gestor.Application.Actions.Actions.AtualizaContatos?.Invoke(); + if (insert) + { + MainViewModel.ClienteSelecionado = SelectedCliente; + if (await ShowMessage("DESEJA INCLUIR UMA APÓLICE AGORA?", "SIM", "NÃO")) + { + Gestor.Application.Actions.Actions.AcessaTela?.Invoke((TipoTela)2, ""); + } + } + } + Salvando = false; + Alterar(alterar: false); + _saving = false; + return null; + } + + private async Task>> Validate() + { + List> errors = new List>(); + bool valida = !string.IsNullOrEmpty(SelectedCliente.Nome); + switch (SelectedCliente.DocumentoPrincipal) + { + case 0L: + if (!ValidationHelper.ValidateDocument(SelectedCliente.Documento)) + { + valida = false; + } + break; + case 1L: + if (!ValidationHelper.ValidateRne(SelectedCliente.Rne)) + { + valida = false; + } + break; + case 2L: + if (!ValidationHelper.ValidateCei(SelectedCliente.Cei)) + { + valida = false; + } + break; + case 3L: + if (!ValidationHelper.ValidateCaepf(SelectedCliente.Caepf)) + { + valida = false; + } + break; + } + if (ValidationHelper.ValidateDocument(SelectedCliente.Documento) && SelectedCliente.DocumentoPrincipal == (TipoDocumento?)0) + { + SelectedCliente.Documento = ValidationHelper.FormatDocument(SelectedCliente.Documento); + } + List list = ((!ValidationHelper.ValidateDocument(SelectedCliente.Documento)) ? new List() : (await new ClienteServico().BuscarCliente(SelectedCliente.Documento, null, (TipoFiltroCliente)2))); + List clienteBase = list; + if (!IsJuridica) + { + list = ((!ValidationHelper.ValidateCei(SelectedCliente.Cei)) ? new List() : (await new ClienteServico().BuscarCliente(SelectedCliente.Cei, null, (TipoFiltroCliente)2))); + List clienteCei = list; + list = ((!ValidationHelper.ValidateRne(SelectedCliente.Rne)) ? new List() : (await new ClienteServico().BuscarCliente(SelectedCliente.Rne, null, (TipoFiltroCliente)2))); + List clienteRne = list; + list = ((!ValidationHelper.ValidateCaepf(SelectedCliente.Caepf)) ? new List() : (await new ClienteServico().BuscarCliente(SelectedCliente.Caepf, null, (TipoFiltroCliente)2))); + List list2 = list; + clienteBase.AddRange(clienteCei ?? new List()); + clienteBase.AddRange(clienteRne ?? new List()); + clienteBase.AddRange(list2 ?? new List()); + } + string nome = ""; + string docDuplicado = ""; + if (clienteBase.Count > 0) + { + clienteBase.ForEach(delegate(Cliente x) + { + if (((DomainBase)x).Id != ((DomainBase)SelectedCliente).Id && x.IdEmpresa == SelectedCliente.IdEmpresa) + { + if (!string.IsNullOrEmpty(SelectedCliente.Documento) && x.Documento == SelectedCliente.Documento) + { + valida = false; + nome = x.Nome; + } + if (!string.IsNullOrEmpty(SelectedCliente.Cei) && x.Cei == SelectedCliente.Cei) + { + docDuplicado = " (CEI)"; + valida = false; + nome = x.Nome; + } + if (!string.IsNullOrEmpty(SelectedCliente.Rne) && x.Rne == SelectedCliente.Rne) + { + docDuplicado = " (RNE)"; + valida = false; + nome = x.Nome; + } + if (!string.IsNullOrEmpty(SelectedCliente.Caepf) && x.Caepf == SelectedCliente.Caepf) + { + docDuplicado = " (CAEPF)"; + valida = false; + nome = x.Nome; + } + } + }); + } + if (!valida && clienteBase.Count((Cliente x) => ((DomainBase)x).Id != ((DomainBase)SelectedCliente).Id) > 0) + { + if (!(await new VendedorUsuarioServico().FindVinculoByUsuario(((DomainBase)Recursos.Usuario).Id))) + { + errors.Add(new KeyValuePair("Documento", "O DOCUMENTO" + docDuplicado + " JÁ ESTÁ CADASTRADO PARA O CLIENTE " + nome)); + } + else + { + Cliente? obj = clienteBase.FirstOrDefault(); + long idCliente = ((obj != null) ? ((DomainBase)obj).Id : 0); + string text = string.Join("|", (await new VendedorServico().BuscarVinculosCliente(idCliente)).Select((Vendedor vendedor) => vendedor.Nome)); + errors.Add(new KeyValuePair("Documento", "O DOCUMENTO" + docDuplicado + " JÁ ESTÁ CADASTRADO PARA O CLIENTE " + nome + ".\nEXISTENTE NO VINCULO COM VENDEDORES: " + text + " ")); + } + } + if (SelectedCliente.Telefones == null || SelectedCliente.Telefones.Count == 0) + { + errors.Add(new KeyValuePair("Telefones", "NECESSITA-SE AO MENOS UM TELEFONE VÁLIDO.")); + } + if (Recursos.Configuracoes.All((ConfiguracaoSistema x) => (int)x.Configuracao != 29) && (SelectedCliente.Emails == null || SelectedCliente.Emails.Count == 0)) + { + errors.Add(new KeyValuePair("Emails|E-MAILS", "NECESSITA-SE AO MENOS UM E-MAIL VÁLIDO.")); + } + if (SelectedCliente.Enderecos == null || SelectedCliente.Enderecos.Count == 0) + { + errors.Add(new KeyValuePair("Enderecos|ENDEREÇOS", "NECESSITA-SE AO MENOS UM ENDEREÇO VÁLIDO.")); + } + return errors; + } + + public async Task ExcluirOrigem(OrigemCliente origem) + { + Origens.Remove(origem); + OnPropertyChanged("Origens"); + } + + public async void AbrirLogAntigo() + { + Loading(isLoading: true); + string text = await _servico.BuscarLogAntigo(((DomainBase)SelectedCliente).Id); + Loading(isLoading: false); + if (string.IsNullOrEmpty(text)) + { + await ShowMessage("NÃO HÁ LOG PARA ESSE CLIENTE"); + } + else + { + ShowDrawer(new LogSistemaAntigo(((DomainBase)SelectedCliente).Id, text), 0, close: false); + } + } + + public async void AddUsuarioCentralSegurado() + { + if (SelectedCliente == null || SelectedCliente.Emails.Count == 0) + { + return; + } + Loading(isLoading: true); + string message = "CLIENTE CADASTRADO/ALTERADO COM SUCESSO!"; + try + { + string text = ((SelectedCliente.Telefones.Count == 0) ? string.Empty : ("(" + ((TelefoneBase)SelectedCliente.Telefones[0]).Prefixo + ") " + ((TelefoneBase)SelectedCliente.Telefones[0]).Numero)); + bool flag = SelectedCliente.Enderecos.Count > 0; + Token val = new Token(); + UsuarioCentralSegurado val2 = new UsuarioCentralSegurado + { + Id = "", + Senha = "", + Serial = val.Encrypt(Recursos.Empresa.Serial), + FornecedorId = ApplicationHelper.IdFornecedor, + Nome = val.Encrypt(SelectedCliente.Nome), + Documento = val.Encrypt(SelectedCliente.Documento.Clear()), + Email = val.Encrypt(((EmailBase)SelectedCliente.Emails[0]).Email), + IdEmpresa = SelectedCliente.IdEmpresa, + Telefone = val.Encrypt(text), + Rua = (flag ? val.Encrypt(((EnderecoBase)SelectedCliente.Enderecos[0]).Endereco) : string.Empty), + Numero = (flag ? val.Encrypt(((EnderecoBase)SelectedCliente.Enderecos[0]).Numero) : string.Empty), + Bairro = (flag ? val.Encrypt(((EnderecoBase)SelectedCliente.Enderecos[0]).Bairro) : string.Empty), + Cidade = (flag ? val.Encrypt(((EnderecoBase)SelectedCliente.Enderecos[0]).Cidade) : string.Empty), + Estado = (flag ? val.Encrypt(((EnderecoBase)SelectedCliente.Enderecos[0]).Estado) : string.Empty), + Cep = (flag ? val.Encrypt(((EnderecoBase)SelectedCliente.Enderecos[0]).Cep) : string.Empty), + Corretora = val.Encrypt(Recursos.Empresa.Nome), + UriCorretora = val.Encrypt(Connection.UrlCentralSegurado) + }; + HttpClient client = new HttpClient(); + try + { + StringContent val3 = new StringContent(JsonConvert.SerializeObject((object)val2), Encoding.UTF8, "application/json"); + Uri uri = Address.CentralSegurado.Append("Usuario").Append("AddAggerApp"); + HttpResponseMessage response = await client.PostAsync(uri, (HttpContent)(object)val3); + await _servico.AddCentralSegurado(((DomainBase)SelectedCliente).Id, response.IsSuccessStatusCode); + if (!response.IsSuccessStatusCode) + { + message = "HOUVE(RAM) O(S) SEGUINTE(S) ERROS: " + (await response.Content.ReadAsStringAsync()).Replace(";", ", ").ToUpper(); + } + } + finally + { + ((IDisposable)client)?.Dispose(); + } + } + catch + { + message = "HOUVERAM ERROS AO CADASTRAR/ALTERAR O CLIENTE!"; + } + OnPropertyChanged("LabelAddUsuarioCentralSegurado"); + Loading(isLoading: false); + await ShowMessage(message); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Seguros/ConsultaViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Seguros/ConsultaViewModel.cs new file mode 100644 index 0000000..a41d428 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Seguros/ConsultaViewModel.cs @@ -0,0 +1,1685 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Forms; +using System.Windows.Threading; +using Assinador.Infrastructure.Helpers; +using ClosedXML.Excel; +using Gestor.Application.Actions; +using Gestor.Application.Helpers; +using Gestor.Application.Model; +using Gestor.Application.Servicos; +using Gestor.Application.Servicos.Ferramentas; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.Servicos.Seguros.Itens; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Seguros; + +public class ConsultaViewModel : BaseSegurosViewModel +{ + private readonly ApoliceServico _apoliceServico; + + private readonly ParcelaServico _parcelaServico; + + private readonly ItemServico _itemServico; + + private readonly VendedorServico _vendedorServico; + + public bool UpdatingScroll; + + public static Parcela ParcelaSelecionada; + + public static Item ItemSelecionado; + + private static Documento _documentoSelecionado; + + private bool _apelido; + + private Visibility _semDocumentos = (Visibility)2; + + private Cliente _selectedCliente = new Cliente(); + + private bool _carregando; + + private bool _isLoading; + + private Visibility _visibilityParcelasVendedores; + + private ObservableCollection _apolices = new ObservableCollection(); + + private ObservableCollection _endossos = new ObservableCollection(); + + private Documento _selectedEndosso = new Documento(); + + private string _parcelasLabel = "PARCELAS"; + + private Documento _selectedControle = new Documento(); + + private bool _isFatura; + + private bool _isEnabledParcelaItem = true; + + private Item _selectedItem = new Item(); + + private ObservableCollection _itens = new ObservableCollection(); + + private Parcela _selectedParcela = new Parcela(); + + private ObservableCollection _parcelas = new ObservableCollection(); + + private Visibility _isVisibleRadioEndosso = (Visibility)2; + + private Visibility _isVisibleEndosso = (Visibility)2; + + private Visibility _isVisibleApolice; + + private string _pendenciaApolice = ""; + + private Visibility _isVisiblePendenciaApolice = (Visibility)2; + + private decimal _gerada; + + private decimal _recebida; + + private decimal _pendente; + + private bool _isLoadingParcelas = true; + + private bool _isLoadingItens = true; + + private int _filterItens; + + private int _filterDocumento; + + private Visibility _manutencaoItemVisibility; + + private Visibility _recusaVisibility; + + private Visibility _renovarVisibility; + + private Visibility _endossarVisibility; + + private Visibility _trocarClienteVisibility; + + private Visibility _tarefasVisibility; + + private Visibility _comissaoVisibility; + + private Visibility _comissaoValorVisibility; + + private Visibility _mostrarItensVisibility = (Visibility)2; + + private Visibility _mostrarSinistroVisibility; + + private ObservableCollection _telefones = new ObservableCollection(); + + public static Documento DocumentoSelecionado + { + get + { + return _documentoSelecionado; + } + set + { + _documentoSelecionado = value; + Gestor.Application.Actions.Actions.EnableItens?.Invoke(value != null && ((DomainBase)value).Id > 0); + Gestor.Application.Actions.Actions.EnableDocumento?.Invoke(value != null && ((DomainBase)value).Id > 0); + } + } + + public static Documento DocumentoRenovado { get; set; } + + public bool Apelido + { + get + { + return _apelido; + } + set + { + _apelido = value; + OnPropertyChanged("Apelido"); + } + } + + public bool Pesquisando { get; set; } + + public Visibility SemDocumentos + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _semDocumentos; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _semDocumentos = value; + OnPropertyChanged("SemDocumentos"); + } + } + + public Cliente SelectedCliente + { + get + { + return _selectedCliente; + } + set + { + _selectedCliente = value; + OnPropertyChanged("SelectedCliente"); + } + } + + public bool Carregando + { + get + { + return _carregando; + } + set + { + _carregando = value; + SemDocumentos = (Visibility)((value || (Apolices != null && Apolices.Count != 0)) ? 2 : 0); + } + } + + public bool IsLoading + { + get + { + return _isLoading; + } + set + { + _isLoading = value; + OnPropertyChanged("IsLoading"); + } + } + + public Visibility VisibilityParcelasVendedores + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityParcelasVendedores; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityParcelasVendedores = value; + OnPropertyChanged("VisibilityParcelasVendedores"); + } + } + + public ObservableCollection Apolices + { + get + { + return _apolices; + } + set + { + _apolices = value; + OnPropertyChanged("Apolices"); + } + } + + public ObservableCollection Endossos + { + get + { + return _endossos; + } + set + { + _endossos = value; + OnPropertyChanged("Endossos"); + } + } + + public Documento SelectedEndosso + { + get + { + return _selectedEndosso; + } + set + { + _selectedEndosso = value; + WorkOnSelectedDocumento(value); + OnPropertyChanged("SelectedEndosso"); + } + } + + public string ParcelasLabel + { + get + { + return _parcelasLabel; + } + set + { + _parcelasLabel = value; + OnPropertyChanged("ParcelasLabel"); + } + } + + public Documento SelectedControle + { + get + { + return _selectedControle; + } + set + { + _selectedControle = value; + int enableButtons; + if (value != null && ((DomainBase)value).Id > 0) + { + Usuario usuario = Recursos.Usuario; + enableButtons = ((usuario != null && ((DomainBase)usuario).Id > 0) ? 1 : 0); + } + else + { + enableButtons = 0; + } + base.EnableButtons = (byte)enableButtons != 0; + bool flag = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 13); + base.EnableEndossar = value != null && ((DomainBase)value).Id > 0 && (flag || (!string.IsNullOrWhiteSpace(value.Apolice) && !string.IsNullOrWhiteSpace(value.Proposta) && value.Emissao.HasValue)); + base.EnableRenovar = value != null && ((DomainBase)value).Id > 0 && value.Vigencia2.HasValue && !string.IsNullOrWhiteSpace(value.Apolice); + WorkOnSelectedDocumento(value); + RecusaVisibility = (Visibility)((Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 19) && !string.IsNullOrWhiteSpace((value != null) ? value.Apolice : null) && value.Emissao.HasValue) ? 2 : 0); + ItensRevelados = false; + MostrarItensVisibility = (Visibility)2; + MostrarSinistroVisibility = (Visibility)0; + OnPropertyChanged("SelectedControle"); + } + } + + public bool IsFatura + { + get + { + return _isFatura; + } + set + { + //IL_0004: Unknown result type (might be due to invalid IL or missing references) + //IL_000a: Invalid comparison between Unknown and I4 + if (!value) + { + value = (int)ComissaoValorVisibility == 2; + } + _isFatura = value; + OnPropertyChanged("IsFatura"); + } + } + + public bool Recarregando { get; set; } + + public bool IsEnabledParcelaItem + { + get + { + return _isEnabledParcelaItem; + } + set + { + _isEnabledParcelaItem = value; + OnPropertyChanged("IsEnabledParcelaItem"); + } + } + + public Item SelectedItem + { + get + { + return _selectedItem; + } + set + { + _selectedItem = value; + WorkOnSelectedItem(value); + OnPropertyChanged("SelectedItem"); + } + } + + public ObservableCollection Itens + { + get + { + return _itens; + } + set + { + _itens = value; + OnPropertyChanged("Itens"); + } + } + + public Parcela SelectedParcela + { + get + { + return _selectedParcela; + } + set + { + _selectedParcela = value; + OnPropertyChanged("SelectedParcela"); + } + } + + public ObservableCollection Parcelas + { + get + { + return _parcelas; + } + set + { + _parcelas = value; + OnPropertyChanged("Parcelas"); + } + } + + public Visibility IsVisibleRadioEndosso + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _isVisibleRadioEndosso; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _isVisibleRadioEndosso = value; + OnPropertyChanged("IsVisibleRadioEndosso"); + } + } + + public Visibility IsVisibleEndosso + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _isVisibleEndosso; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _isVisibleEndosso = value; + OnPropertyChanged("IsVisibleEndosso"); + } + } + + public Visibility IsVisibleApolice + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _isVisibleApolice; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _isVisibleApolice = value; + OnPropertyChanged("IsVisibleApolice"); + } + } + + public string PendenciaApolice + { + get + { + return _pendenciaApolice; + } + set + { + _pendenciaApolice = value; + IsVisiblePendenciaApolice = (Visibility)(string.IsNullOrEmpty(_pendenciaApolice) ? 2 : 0); + OnPropertyChanged("PendenciaApolice"); + } + } + + public Visibility IsVisiblePendenciaApolice + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _isVisiblePendenciaApolice; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _isVisiblePendenciaApolice = value; + OnPropertyChanged("IsVisiblePendenciaApolice"); + } + } + + public decimal Gerada + { + get + { + return _gerada; + } + set + { + _gerada = value; + OnPropertyChanged("Gerada"); + } + } + + public decimal Recebida + { + get + { + return _recebida; + } + set + { + _recebida = value; + OnPropertyChanged("Recebida"); + } + } + + public decimal Pendente + { + get + { + return _pendente; + } + set + { + _pendente = value; + OnPropertyChanged("Pendente"); + } + } + + public bool IsLoadingParcelas + { + get + { + return _isLoadingParcelas; + } + set + { + _isLoadingParcelas = value; + OnPropertyChanged("IsLoadingParcelas"); + } + } + + public bool IsLoadingItens + { + get + { + return _isLoadingItens; + } + set + { + _isLoadingItens = value; + OnPropertyChanged("IsLoadingItens"); + } + } + + public static int FiltrarItens { get; set; } + + public int FilterItens + { + get + { + return _filterItens; + } + set + { + _filterItens = value; + FiltrarItens = value; + OnPropertyChanged("FilterItens"); + } + } + + public int FilterDocumento + { + get + { + return _filterDocumento; + } + set + { + _filterDocumento = value; + Gestor.Application.Actions.Actions.UpdateRadioApolice?.Invoke(_filterDocumento); + OnPropertyChanged("FilterDocumento"); + } + } + + public Visibility ManutencaoItemVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _manutencaoItemVisibility; + } + set + { + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + _manutencaoItemVisibility = (Visibility)(Restricao((TipoRestricao)22) ? 2 : ((int)value)); + OnPropertyChanged("ManutencaoItemVisibility"); + } + } + + public Visibility RecusaVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _recusaVisibility; + } + set + { + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + _recusaVisibility = (Visibility)(Restricao((TipoRestricao)18) ? 2 : ((int)value)); + OnPropertyChanged("RecusaVisibility"); + } + } + + public Visibility RenovarVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _renovarVisibility; + } + set + { + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + _renovarVisibility = (Visibility)(Restricao((TipoRestricao)17) ? 2 : ((int)value)); + OnPropertyChanged("RenovarVisibility"); + } + } + + public Visibility EndossarVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _endossarVisibility; + } + set + { + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + _endossarVisibility = (Visibility)(Restricao((TipoRestricao)33) ? 2 : ((int)value)); + OnPropertyChanged("EndossarVisibility"); + } + } + + public Visibility TrocarClienteVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _trocarClienteVisibility; + } + set + { + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + _trocarClienteVisibility = (Visibility)(Restricao((TipoRestricao)21) ? 2 : ((int)value)); + OnPropertyChanged("TrocarClienteVisibility"); + } + } + + public Visibility TarefasVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _tarefasVisibility; + } + set + { + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + _tarefasVisibility = (Visibility)((!Permissao((TipoTela)38)) ? 2 : ((int)value)); + OnPropertyChanged("TarefasVisibility"); + } + } + + public Visibility ComissaoVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _comissaoVisibility; + } + set + { + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + _comissaoVisibility = (Visibility)(Restricao((TipoRestricao)95) ? 2 : ((int)value)); + OnPropertyChanged("ComissaoVisibility"); + } + } + + public Visibility ComissaoValorVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _comissaoValorVisibility; + } + set + { + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + _comissaoValorVisibility = (Visibility)(Restricao((TipoRestricao)14) ? 2 : ((int)value)); + OnPropertyChanged("ComissaoValorVisibility"); + } + } + + public Visibility MostrarItensVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _mostrarItensVisibility; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _mostrarItensVisibility = value; + OnPropertyChanged("MostrarItensVisibility"); + } + } + + public Visibility MostrarSinistroVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _mostrarSinistroVisibility; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _mostrarSinistroVisibility = value; + OnPropertyChanged("MostrarSinistroVisibility"); + } + } + + public bool ItensRevelados { get; set; } + + public ObservableCollection Telefones + { + get + { + return _telefones; + } + set + { + _telefones = value; + OnPropertyChanged("Telefones"); + } + } + + public ConsultaViewModel() + { + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + //IL_0008: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Expected O, but got Unknown + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_0033: Expected O, but got Unknown + //IL_003f: Unknown result type (might be due to invalid IL or missing references) + //IL_0049: Expected O, but got Unknown + //IL_0051: Unknown result type (might be due to invalid IL or missing references) + //IL_005b: Expected O, but got Unknown + //IL_0067: Unknown result type (might be due to invalid IL or missing references) + //IL_0071: Expected O, but got Unknown + //IL_007e: Unknown result type (might be due to invalid IL or missing references) + //IL_0085: Unknown result type (might be due to invalid IL or missing references) + //IL_0097: Unknown result type (might be due to invalid IL or missing references) + //IL_00ac: Unknown result type (might be due to invalid IL or missing references) + _apoliceServico = new ApoliceServico(); + _parcelaServico = new ParcelaServico(); + _vendedorServico = new VendedorServico(); + _itemServico = new ItemServico(); + Apelido = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 6); + SemDocumentos = (Visibility)0; + base.EnableButtons = false; + if (MainViewModel.ClienteSelecionado != null && ((DomainBase)MainViewModel.ClienteSelecionado).Id > 0) + { + SelecionarCliente(MainViewModel.ClienteSelecionado); + } + } + + public async Task Pesquisar(PesquisaAvancada pesquisa) + { + MainViewModel.StatusSelecionado = pesquisa.Status; + if (pesquisa.IdDocumento == 0L) + { + await SelecionarCliente(pesquisa.IdCliente, selecionar: true); + return; + } + Pesquisando = true; + await SelecionarCliente(pesquisa.IdCliente, selecionar: false); + Loading(isLoading: true); + Documento documento = await _apoliceServico.BuscarApoliceAsync(pesquisa.IdDocumento); + if (documento == null || Apolices.Count == 0 || Apolices == null) + { + Pesquisando = false; + Loading(isLoading: false); + return; + } + Documento val = ((IEnumerable)Apolices).FirstOrDefault((Func)((Documento x) => ((DomainBase)x.Controle).Id == ((DomainBase)documento.Controle).Id)); + if (val == null && documento.Tipo == 1) + { + val = documento; + val.TemEndosso = true; + if (val == null) + { + Pesquisando = false; + Loading(isLoading: false); + return; + } + } + SelectedControle = val; + IsVisibleApolice = (Visibility)0; + VisibilityParcelasVendedores = (Visibility)2; + DateTime date = Funcoes.GetNetworkTime().Date; + PendenciaApolice = (string.IsNullOrEmpty(val.Apolice) ? $"{(date - val.Vigencia1).TotalDays} DIAS DE PENDÊNCIA" : ""); + IsVisibleRadioEndosso = (Visibility)((!val.TemEndosso) ? 2 : 0); + if (val.TemEndosso) + { + IsVisibleRadioEndosso = (Visibility)0; + Endossos = new ObservableCollection(val.Controle.Documentos.Where((Documento x) => x.Tipo == 1 && !x.Excluido)); + } + if (documento.Tipo == 1) + { + documento = Endossos.First((Documento x) => ((DomainBase)x).Id == ((DomainBase)documento).Id); + FilterDocumento = 1; + IsVisibleEndosso = (Visibility)0; + SelectedEndosso = documento; + PendenciaApolice = (string.IsNullOrEmpty(documento.Endosso) ? $"{(date - documento.Vigencia1).TotalDays} DIAS DE PENDÊNCIA" : ""); + } + CarregaDocumentos(documento.Tipo); + await SelecionaParcelas(documento); + VisibilityParcelasVendedores = (Visibility)0; + Pesquisando = false; + if (pesquisa.IdItem == 0L) + { + await SelecionaItens((documento.Tipo == 0) ? 1 : 2, documento, 0L); + Loading(isLoading: false); + return; + } + await SelecionaItens((documento.Tipo == 0) ? 1 : 2, documento, pesquisa.IdItem, pesquisaAvancada: true); + SelecionaItem(((IEnumerable)Itens).FirstOrDefault((Func)((Item x) => ((DomainBase)x).Id == pesquisa.IdItem))); + Loading(isLoading: false); + if (pesquisa.IdSinistro != 0L) + { + Gestor.Application.Actions.Actions.AcessaTela?.Invoke((TipoTela)7, ""); + } + } + + public async void SelecionarCliente(Cliente cliente) + { + await SelecionaCliente(cliente); + ScrollDocumento(); + } + + public void ScrollDocumento() + { + if (UpdatingScroll) + { + return; + } + UpdatingScroll = true; + Task.Run(async delegate + { + await Task.Delay(300); + ((DispatcherObject)Application.Current).Dispatcher.Invoke((Action)delegate + { + Gestor.Application.Actions.Actions.ScrollDocumento?.Invoke(); + }); + }); + } + + public async Task SelecionarCliente(long id, bool selecionar) + { + await SelecionaCliente(await new ClienteServico().BuscarCliente(id), selecionar); + } + + public async Task SelecionaCliente(Cliente value, bool selecionar = true) + { + Clear(); + if (value == null || ((DomainBase)value).Id == 0L) + { + base.IsVisible = (Visibility)2; + return; + } + try + { + Carregando = true; + Loading(isLoading: true); + SelectedCliente = value; + ApoliceServico apoliceServico = _apoliceServico; + long id = ((DomainBase)value).Id; + FiltroStatusDocumento statusSelecionado = MainViewModel.StatusSelecionado; + List vendedorVinculado = ((Recursos.Usuario != null) ? (await VerificaVinculoVendedor(Recursos.Usuario)) : new List()); + Apolices = await apoliceServico.BuscarApolicesAsync(id, statusSelecionado, vendedorVinculado); + ConsultaViewModel consultaViewModel = this; + string descricao = "CONSULTOU " + (((int)MainViewModel.StatusSelecionado != 4) ? ("OS " + Functions.GetDescription((Enum)(object)MainViewModel.StatusSelecionado)) : "TODOS OS DOCUMENTOS") + " DO CLIENTE \"" + SelectedCliente.Nome + "\""; + long id2 = ((DomainBase)SelectedCliente).Id; + TipoTela? tela = (TipoTela)21; + Cliente selectedCliente = SelectedCliente; + consultaViewModel.RegistrarAcao(descricao, id2, tela, $"ID CLIENTE: {((selectedCliente != null) ? new long?(((DomainBase)selectedCliente).Id) : null)}"); + if (Apolices != null && Apolices.Count > 0) + { + if (!selecionar) + { + Loading(isLoading: false); + Carregando = false; + return; + } + if (DocumentoSelecionado != null && DocumentoSelecionado.Tipo != 0) + { + Controle controle = DocumentoSelecionado.Controle; + long? obj; + if (controle == null) + { + obj = null; + } + else + { + Cliente cliente = controle.Cliente; + obj = ((cliente != null) ? new long?(((DomainBase)cliente).Id) : null); + } + if (obj == ((DomainBase)value).Id) + { + Controle controle2 = DocumentoSelecionado.Controle; + long? obj2; + if (controle2 == null) + { + obj2 = null; + } + else + { + IList documentos = controle2.Documentos; + if (documentos == null) + { + obj2 = null; + } + else + { + Documento? obj3 = ((IEnumerable)documentos).FirstOrDefault((Func)((Documento x) => x.Tipo == 0)); + obj2 = ((obj3 != null) ? new long?(((DomainBase)obj3).Id) : null); + } + } + long? num = obj2; + long documentId = num.GetValueOrDefault(); + Documento documentoSelecionado = DocumentoSelecionado; + long? endossoId = ((documentoSelecionado != null) ? new long?(((DomainBase)documentoSelecionado).Id) : null); + if (((documentId > 0) ? ((IEnumerable)Apolices).FirstOrDefault((Func)((Documento x) => ((DomainBase)x).Id == documentId)) : null) != null) + { + await SelecionaDocumento(0, ((IEnumerable)Apolices).FirstOrDefault((Func)((Documento x) => ((DomainBase)x).Id == documentId))); + FilterDocumento = 1; + IsVisibleEndosso = (Visibility)0; + SelectedEndosso = ((IEnumerable)Endossos).FirstOrDefault((Func)((Documento x) => ((DomainBase)x).Id == endossoId)) ?? Endossos[0]; + IsLoading = false; + await WorkOnSelectedEndosso(SelectedEndosso); + CarregaDocumentos(1); + } + else + { + await SelecionaDocumento(0, (DocumentoSelecionado != null) ? (((IEnumerable)Apolices).FirstOrDefault((Func)((Documento x) => ((DomainBase)x).Id == ((DomainBase)DocumentoSelecionado).Id)) ?? Apolices.FirstOrDefault()) : Apolices.FirstOrDefault()); + CarregaDocumentos(0); + } + goto IL_06af; + } + } + await SelecionaDocumento(0, (DocumentoSelecionado != null) ? (((IEnumerable)Apolices).FirstOrDefault((Func)((Documento x) => ((DomainBase)x).Id == ((DomainBase)DocumentoSelecionado).Id)) ?? Apolices.FirstOrDefault()) : Apolices.FirstOrDefault()); + CarregaDocumentos(0); + } + else + { + SelectedControle = null; + SelectedEndosso = null; + SelectedItem = null; + SelectedParcela = null; + DocumentoSelecionado = null; + ItemSelecionado = null; + FilterDocumento = 0; + IsVisibleRadioEndosso = (Visibility)2; + Gestor.Application.Actions.Actions.UpdateDocumento?.Invoke(null); + } + goto IL_06af; + IL_06af: + ManutencaoItemVisibility = (Visibility)0; + RenovarVisibility = (Visibility)0; + TrocarClienteVisibility = (Visibility)0; + TarefasVisibility = (Visibility)0; + EndossarVisibility = (Visibility)0; + ComissaoVisibility = (Visibility)0; + Loading(isLoading: false); + } + catch (Exception e) + { + Clear(); + SelectedControle = null; + SelectedEndosso = null; + SelectedItem = null; + SelectedParcela = null; + DocumentoSelecionado = null; + ItemSelecionado = null; + FilterDocumento = 0; + IsVisibleRadioEndosso = (Visibility)2; + Gestor.Application.Actions.Actions.UpdateDocumento?.Invoke(null); + new BaseServico().Registrar(e, (TipoErro)1, 3, new { value, selecionar }); + } + Carregando = false; + } + + private void Clear() + { + Apolices = null; + Parcelas = null; + Itens = null; + } + + private async Task WorkOnSelectedEndosso(Documento value) + { + if (value == null || ((DomainBase)value).Id == 0L || IsLoading) + { + return; + } + DocumentoSelecionado = value; + base.IsEnabled = false; + IsLoading = true; + VisibilityParcelasVendedores = (Visibility)2; + PendenciaApolice = (string.IsNullOrEmpty(value.Endosso) ? $"{(Funcoes.GetNetworkTime().Date - value.Vigencia1).TotalDays} DIAS DE PENDÊNCIA" : ""); + await SelecionaParcelas(value); + Item itemSelecionado = ItemSelecionado; + long item = ((itemSelecionado != null) ? ((DomainBase)itemSelecionado).Id : 0); + await SelecionaItens(FilterItens, null, 0L); + if (item > 0 && Itens != null && Itens.Any((Item x) => ((DomainBase)x).Id == item)) + { + ItemSelecionado = Itens.First((Item x) => ((DomainBase)x).Id == item); + SelecionaItem(ItemSelecionado); + Gestor.Application.Actions.Actions.ScrollToItem?.Invoke(); + } + VisibilityParcelasVendedores = (Visibility)0; + ConsultaViewModel consultaViewModel = this; + int num; + if (Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 19)) + { + if (!string.IsNullOrWhiteSpace((value != null) ? value.Apolice : null) && value.Emissao.HasValue) + { + num = 2; + goto IL_027b; + } + } + num = 0; + goto IL_027b; + IL_027b: + consultaViewModel.RecusaVisibility = (Visibility)num; + base.IsEnabled = true; + IsLoading = false; + } + + private void WorkOnSelectedDocumento(Documento value) + { + //IL_0028: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Invalid comparison between Unknown and I4 + //IL_004f: Unknown result type (might be due to invalid IL or missing references) + //IL_0055: Invalid comparison between Unknown and I4 + if (value != null && ((DomainBase)value).Id != 0L && !Recarregando) + { + DocumentoSelecionado = value; + ParcelasLabel = (((int)DocumentoSelecionado.TipoRecebimento.GetValueOrDefault() == 2) ? "FATURAS" : "PARCELAS"); + IsFatura = (int)DocumentoSelecionado.TipoRecebimento.GetValueOrDefault() == 2; + Gestor.Application.Actions.Actions.UpdateDocumento?.Invoke(value); + } + } + + private async Task WorkOnSelectedControle(Documento value) + { + if (value == null || ((DomainBase)value).Id == 0L || IsLoading) + { + return; + } + DocumentoSelecionado = value; + IsEnabledParcelaItem = false; + IsLoading = true; + VisibilityParcelasVendedores = (Visibility)2; + PendenciaApolice = (string.IsNullOrEmpty(value.Apolice) ? $"{(Funcoes.GetNetworkTime().Date - value.Vigencia1).TotalDays} DIAS DE PENDÊNCIA" : ""); + IsVisibleRadioEndosso = (Visibility)((!value.TemEndosso) ? 2 : 0); + await SelecionaParcelas(value); + VisibilityParcelasVendedores = (Visibility)0; + FilterItens = 0; + Item itemSelecionado = ItemSelecionado; + long item = ((itemSelecionado != null) ? ((DomainBase)itemSelecionado).Id : 0); + await SelecionaItens(FilterItens, value, 0L); + if (item > 0 && Itens != null && Itens.Any((Item x) => ((DomainBase)x).Id == item)) + { + ItemSelecionado = Itens.First((Item x) => ((DomainBase)x).Id == item); + SelecionaItem(ItemSelecionado); + Gestor.Application.Actions.Actions.ScrollToItem?.Invoke(); + } + IsLoading = false; + IsEnabledParcelaItem = true; + } + + private void CalculaComissao(Documento documento, ObservableCollection parcelas) + { + decimal num = (documento.AdicionalComiss ? (documento.PremioLiquido + documento.PremioAdicional) : documento.PremioLiquido); + decimal num2 = documento.Comissao * 0.01m; + Gerada = num * num2; + Recebida = (Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 32) ? parcelas.Where((Parcela x) => (int)x.SubTipo == 1 || (int)x.SubTipo == 6).Sum((Parcela x) => x.ValorComissao) : parcelas.Where((Parcela x) => (int)x.SubTipo == 1).Sum((Parcela x) => x.ValorComissao)); + Pendente = Gerada - Recebida; + Pendente = ((Pendente < 0.01m) ? 0.00m : Pendente); + } + + public async Task SelecionaParcelas(Documento documento = null) + { + if (documento == null) + { + documento = SelectedControle; + } + ObservableCollection observableCollection = await _parcelaServico.BuscarParcelasPorDocumento(documento); + Parcelas = (((int)documento.TipoRecebimento.GetValueOrDefault() == 2) ? new ObservableCollection(observableCollection.OrderByDescending((Parcela x) => x.NumeroParcela)) : observableCollection); + SelectedParcela = ((Parcelas != null && Parcelas.Count > 0) ? Parcelas[0] : null); + CalculaComissao(documento, Parcelas); + IsLoadingParcelas = true; + } + + public async Task SelecionaItens(int type, Documento documento = null, long iditem = 0L, bool pesquisaAvancada = false) + { + if (documento == null) + { + documento = SelectedControle; + } + if (documento == null) + { + return; + } + IsLoadingItens = false; + bool flag = !pesquisaAvancada; + if (flag) + { + flag = await VerificaItens(documento); + } + if (flag) + { + return; + } + await CarregaItens(type, documento); + int filterItens = FilterItens; + if (iditem == 0L && filterItens != 2) + { + Item val = Itens?.FirstOrDefault((Func)delegate(Item i) + { + long id3 = ((DomainBase)i).Id; + Item selectedItem5 = SelectedItem; + return id3 == ((selectedItem5 != null) ? new long?(((DomainBase)selectedItem5).Id) : null); + }); + if (val != null || filterItens == 0) + { + SelectedItem = (Item)((val != null) ? ((object)val) : ((object)Itens?.FirstOrDefault())); + } + else if (val == null && filterItens == 1) + { + Item selectedItem = SelectedItem; + if (selectedItem != null && selectedItem.Substituicao > 0) + { + val = Itens?.FirstOrDefault((Func)delegate(Item i) + { + long id2 = ((DomainBase)i).Id; + Item selectedItem4 = SelectedItem; + return id2 == ((selectedItem4 != null) ? selectedItem4.Substituicao : null); + }); + } + SelectedItem = (Item)((val != null) ? ((object)val) : ((object)Itens?.FirstOrDefault())); + } + Item selectedItem2 = SelectedItem; + if (selectedItem2 != null && selectedItem2.Substituido > 0 && filterItens != 1) + { + FilterItens = 3; + Itens = await _itemServico.BuscarItens(((DomainBase)documento.Controle).Id, (StatusItem)1); + val = Itens?.FirstOrDefault((Func)delegate(Item i) + { + long id = ((DomainBase)i).Id; + Item selectedItem3 = SelectedItem; + return id == ((selectedItem3 != null) ? new long?(((DomainBase)selectedItem3).Id) : null); + }); + SelectedItem = (Item)((val != null) ? ((object)val) : ((object)Itens?.FirstOrDefault())); + } + } + IsLoadingItens = true; + } + + public async Task VerificaItens(Documento documento) + { + if (!ItensRevelados && await _itemServico.ChecarQuantidade(((DomainBase)documento).Id) > 2) + { + Itens = new ObservableCollection(); + Itens.Add(new Item + { + Id = 0L, + Descricao = "Item - Apólice Coletiva" + }); + MostrarItensVisibility = (Visibility)0; + MostrarSinistroVisibility = (Visibility)2; + return true; + } + return false; + } + + public async Task MostrarItens(int type = 0) + { + IsLoadingItens = false; + MostrarItensVisibility = (Visibility)2; + MostrarSinistroVisibility = (Visibility)0; + ItensRevelados = true; + Documento documento = DocumentoSelecionado; + if (type == 1 && DocumentoSelecionado.Tipo == 1) + { + documento = SelectedControle; + } + await CarregaItens(type, documento); + ObservableCollection itens = Itens; + if (itens != null && itens.Count > 1) + { + SelectedItem = Itens?.FirstOrDefault(); + } + IsLoadingItens = true; + } + + public async Task CarregaItens(int type, Documento documento) + { + FilterItens = 0; + switch (type) + { + case 0: + Itens = await _itemServico.BuscarItens(((DomainBase)documento.Controle).Id, (StatusItem)0); + break; + case 1: + FilterItens = 1; + Itens = await _itemServico.BuscarItens(((DomainBase)documento).Id, (StatusItem)2); + break; + case 2: + FilterItens = 2; + documento = SelectedEndosso ?? documento; + Itens = await _itemServico.BuscarItens(((DomainBase)documento).Id, (StatusItem)2); + break; + case 3: + FilterItens = 3; + Itens = await _itemServico.BuscarItens(((DomainBase)documento.Controle).Id, (StatusItem)1); + break; + } + } + + public async Task SelecionaDocumento(int type, Documento documento) + { + if (Pesquisando) + { + return; + } + if (documento == null) + { + FilterDocumento = 0; + IsVisibleRadioEndosso = (Visibility)2; + IsVisibleApolice = (Visibility)0; + return; + } + documento.Controle.Cliente.Nome = SelectedCliente.Nome; + if (type != 1) + { + FilterDocumento = 0; + IsVisibleRadioEndosso = (Visibility)2; + IsVisibleApolice = (Visibility)0; + SelectedControle = documento; + await WorkOnSelectedControle(documento); + if (documento.TemEndosso) + { + IsVisibleRadioEndosso = (Visibility)0; + Endossos = new ObservableCollection(documento.Controle.Documentos.Where((Documento x) => x.Tipo == 1 && (((DomainBase)Recursos.Usuario).Id == 0L || !x.Excluido))); + } + } + else + { + FilterDocumento = 1; + IsVisibleEndosso = (Visibility)0; + SelectedEndosso = documento; + await WorkOnSelectedEndosso(documento); + } + } + + public void CarregaDocumentos(int type) + { + IsVisibleApolice = (Visibility)2; + IsVisibleEndosso = (Visibility)2; + if (type != 1) + { + IsVisibleApolice = (Visibility)0; + } + else + { + IsVisibleEndosso = (Visibility)0; + } + } + + public void SelecionaItem(Item item) + { + if (item != null && ((DomainBase)item).Id != 0L) + { + FilterItens = ((item != null && item.Substituido > 0) ? 3 : 0); + SelectedItem = item; + } + } + + private static void WorkOnSelectedItem(Item value) + { + if (value != null) + { + Item itemSelecionado = ItemSelecionado; + if (((itemSelecionado != null) ? new long?(((DomainBase)itemSelecionado).Id) : null) == ((DomainBase)value).Id) + { + return; + } + } + ItemSelecionado = value; + Gestor.Application.Actions.Actions.UpdateItem?.Invoke(value); + } + + public async Task AbrirDetalhes() + { + Documento documento = SelectedControle; + if (FilterDocumento == 1) + { + documento = SelectedEndosso ?? SelectedControle; + } + Documento val = documento; + val.Pagamentos = await _vendedorServico.BuscaRepasse(((DomainBase)documento).Id); + val = documento; + val.Parcelas = await _parcelaServico.BuscarParcelasAsync(((DomainBase)documento).Id); + return documento; + } + + public async Task EditarParcelas() + { + await ShowEditarParcelasDialog(DocumentoSelecionado); + await SelecionaParcelas(DocumentoSelecionado); + } + + public async Task RecusarDocumento() + { + if (DocumentoSelecionado == null) + { + return; + } + bool[] array = await Funcoes.VerificarPagamento(((DomainBase)DocumentoSelecionado).Id); + if (Recursos.Configuracoes.All((ConfiguracaoSistema x) => (int)x.Configuracao != 23) && array.Any((bool x) => x)) + { + await ShowMessage("NÃO É POSSÍVEL RECUSAR UMA APÓLICE ENQUANTO HOUVER RECEBIMENTO DE COMISSÃO OU PAGAMENTO DE VENDEDORES"); + return; + } + bool flag = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 23) && array[1]; + if (flag) + { + flag = await ShowMessage("EXISTEM PAGAMENTOS PARA OS VENDEDORES DO CONTRATO, DESEJA CRIAR ESTORNOS PARA ESSES PAGAMENTOS?", "SIM", "NÃO"); + } + bool estorno = flag; + Documento documento = await _apoliceServico.BuscarApoliceAsync(((DomainBase)DocumentoSelecionado).Id); + IList list; + if (documento.Controle.Documentos.Count <= 1) + { + list = documento.Controle.Documentos; + } + else + { + IList list2 = (from x in documento.Controle.Documentos + where !x.Excluido + orderby x.Ordem + select x).ToList(); + list = list2; + } + IList list3 = list; + if (list3.Count > 1 && ((DomainBase)list3.Last((Documento x) => (int)x.Situacao != 7)).Id != ((DomainBase)DocumentoSelecionado).Id) + { + await ShowMessage("NÃO É POSSÍVEL RECUSAR UM DOCUMENTO ENQUANTO HOUVER ENDOSSOS EM CIMA DO MESMO."); + return; + } + if ((int)documento.Situacao == 7) + { + await ShowMessage("NÃO É POSSÍVEL RECUSAR UM DOCUMENTO JÁ RECUSADO."); + return; + } + string text = ((documento.Tipo == 0 && string.IsNullOrEmpty(documento.Apolice)) ? "A PROPOSTA SELECIONADA" : ((documento.Tipo == 0 && !string.IsNullOrEmpty(documento.Apolice)) ? "A APÓLICE SELECIONADA" : "O ENDOSSO SELECIONADO")); + if (await ShowMessage("DESEJA REALMENTE RECUSAR " + text + "?", "SIM", "NÃO")) + { + string text2 = await ShowObservacaoDialog(); + if (text2 != null) + { + Loading(isLoading: true); + await Funcoes.RecusarApolice(documento, text2, estorno); + DocumentoSelecionado = null; + await SelecionaCliente(SelectedCliente); + Loading(isLoading: false); + } + } + } + + public async Task AbrirDetalhesParcela() + { + Parcela parcela = SelectedParcela; + parcela.Vendedores = new ObservableCollection(await _vendedorServico.BuscaRepasseParcela(((DomainBase)parcela).Id)); + return parcela; + } + + public void ManutecaoItens() + { + Gestor.Application.Actions.Actions.AcessaTela?.Invoke((TipoTela)3, "Manutencao"); + } + + public async Task GerarExcel(int type) + { + if (SelectedControle == null) + { + return; + } + Loading(isLoading: true); + bool iniciar = Type.GetTypeFromProgID("Excel.Application") != null; + string descricao = "ATIVOS"; + ObservableCollection observableCollection; + switch (type) + { + default: + observableCollection = await _itemServico.BuscarItems(((DomainBase)SelectedControle.Controle).Id, (StatusItem)0, sinsitroCompleto: true); + break; + case 1: + descricao = "DA APÓLICE"; + observableCollection = await _itemServico.BuscarItems(((DomainBase)SelectedControle).Id, (StatusItem)2, sinsitroCompleto: true); + break; + case 2: + { + Documento val = SelectedEndosso ?? SelectedControle; + descricao = ((SelectedEndosso == null) ? "DA APÓLICE" : "DO ENDOSSO"); + observableCollection = await _itemServico.BuscarItems(((DomainBase)val).Id, (StatusItem)2, sinsitroCompleto: true); + break; + } + case 3: + descricao = "INATIVOS"; + observableCollection = await _itemServico.BuscarItems(((DomainBase)SelectedControle.Controle).Id, (StatusItem)1, sinsitroCompleto: true); + break; + } + if (observableCollection == null || observableCollection.Count == 0) + { + Loading(isLoading: false); + await ShowMessage("NÃO HÁ ITENS PARA EXIBIR A RELAÇÃO"); + return; + } + List itensList = new List(); + observableCollection.ToList().ForEach(delegate(Item x) + { + string Coberturas = ""; + if (x.Coberturas.Count() > 0) + { + x.Coberturas.ToList().ForEach(delegate(Cobertura c) + { + Coberturas += $"Cobertura: {c.Observacao} | Premio: {c.Premio} | Franquia: {c.Franquia} | LMI: {c.Lmi}\n"; + }); + } + RelacaoItens obj = new RelacaoItens + { + Nome = SelectedCliente.Nome, + Documento = SelectedCliente.Documento, + Apolice = SelectedControle.Apolice, + VigenciaInicial = SelectedControle.Vigencia1, + VigenciaFinal = SelectedControle.Vigencia2, + Ordem = x.Ordem, + Sinistrado = (x.Sinistrado ? "SIM" : "NÃO") + }; + ControleSinistro? obj2 = x.Sinistros.FirstOrDefault(); + obj.DataSinistro = ((obj2 != null) ? obj2.DataSinistro : null); + ControleSinistro? obj3 = x.Sinistros.FirstOrDefault(); + object numSinistro; + if (obj3 == null) + { + numSinistro = null; + } + else + { + Sinistro? obj4 = obj3.Sinistros.FirstOrDefault(); + numSinistro = ((obj4 != null) ? obj4.Numero : null); + } + obj.NumSinistro = (string)numSinistro; + ControleSinistro? obj5 = x.Sinistros.FirstOrDefault(); + StatusSinistro? statusSinistro; + if (obj5 == null) + { + statusSinistro = null; + } + else + { + Sinistro? obj6 = obj5.Sinistros.FirstOrDefault(); + statusSinistro = ((obj6 != null) ? obj6.StatusSinistro : null); + } + obj.StatusSinistro = statusSinistro; + ControleSinistro? obj7 = x.Sinistros.FirstOrDefault(); + object itemSinistrado; + if (obj7 == null) + { + itemSinistrado = null; + } + else + { + Sinistro? obj8 = obj7.Sinistros.FirstOrDefault(); + itemSinistrado = ((obj8 != null) ? obj8.ItemSinistrado : null); + } + obj.ItemSinistrado = (string)itemSinistrado; + ControleSinistro? obj9 = x.Sinistros.FirstOrDefault(); + decimal? valor; + if (obj9 == null) + { + valor = null; + } + else + { + Sinistro? obj10 = obj9.Sinistros.FirstOrDefault(); + valor = ((obj10 != null) ? new decimal?(obj10.Valor) : null); + } + obj.Valor = valor; + ControleSinistro? obj11 = x.Sinistros.FirstOrDefault(); + DateTime? dataLiq; + if (obj11 == null) + { + dataLiq = null; + } + else + { + Sinistro? obj12 = obj11.Sinistros.FirstOrDefault(); + dataLiq = ((obj12 != null) ? obj12.DataLiquidacao : null); + } + obj.DataLiq = dataLiq; + ControleSinistro? obj13 = x.Sinistros.FirstOrDefault(); + DateTime? dataRec; + if (obj13 == null) + { + dataRec = null; + } + else + { + Sinistro? obj14 = obj13.Sinistros.FirstOrDefault(); + dataRec = ((obj14 != null) ? obj14.DataReclamacao : null); + } + obj.DataRec = dataRec; + ControleSinistro? obj15 = x.Sinistros.FirstOrDefault(); + object motivo; + if (obj15 == null) + { + motivo = null; + } + else + { + Sinistro? obj16 = obj15.Sinistros.FirstOrDefault(); + motivo = ((obj16 != null) ? obj16.Motivo : null); + } + obj.Motivo = (string)motivo; + obj.Status = (string.IsNullOrEmpty(x.Status) ? x.StatusInclusao : x.Status); + obj.Cobertura = ((Coberturas.Length > 4000) ? Coberturas.Substring(0, 4000) : Coberturas); + RelacaoItens relacaoItens = obj; + switch (((DomainBase)SelectedControle.Controle.Ramo).Id) + { + case 1L: + case 2L: + case 3L: + case 18L: + relacaoItens.Endereco = ((EnderecoBase)x.Patrimonial).Endereco; + relacaoItens.Numero = ((EnderecoBase)x.Patrimonial).Numero; + relacaoItens.Bairro = ((EnderecoBase)x.Patrimonial).Bairro; + relacaoItens.Cidade = ((EnderecoBase)x.Patrimonial).Cidade; + relacaoItens.Estado = ((EnderecoBase)x.Patrimonial).Estado; + relacaoItens.Cep = ((EnderecoBase)x.Patrimonial).Cep; + relacaoItens.Complemento = ((EnderecoBase)x.Patrimonial).Complemento; + relacaoItens.Bens = x.Patrimonial.Bens; + relacaoItens.Descricao = x.Descricao; + break; + case 5L: + case 37L: + { + relacaoItens.Fipe = x.Auto.Fipe; + Fabricante fabricante = x.Auto.Fabricante; + relacaoItens.Fabricante = ((fabricante != null) ? fabricante.Descricao : null); + relacaoItens.Modelo = x.Auto.Modelo; + relacaoItens.AnoFab = x.Auto.AnoFabricacao; + relacaoItens.AnoMod = x.Auto.AnoModelo; + relacaoItens.Chassi = x.Auto.Chassi; + relacaoItens.Placa = x.Auto.Placa; + relacaoItens.RegiaoCirculacao = x.Auto.RegiaoCirculacao; + relacaoItens.Bonus = x.Auto.Bonus; + relacaoItens.Descricao = x.Descricao; + break; + } + default: + relacaoItens.Descricao = x.Descricao; + break; + } + itensList.Add(relacaoItens); + }); + string text = ""; + string fileName; + if (Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 41)) + { + FolderBrowserDialog val2 = new FolderBrowserDialog(); + try + { + if (1 != (int)((CommonDialog)val2).ShowDialog()) + { + return; + } + text = val2.SelectedPath + "\\"; + Directory.CreateDirectory(text); + } + finally + { + ((IDisposable)val2)?.Dispose(); + } + fileName = string.Format("{0}ITENS - {1} {2} {3}.xlsx", text, descricao, SelectedControle.Apolice.Replace("/", ""), Guid.NewGuid()); + } + else + { + text = Path.GetTempPath(); + fileName = $"{text}{Guid.NewGuid()}.xlsx"; + } + (await Funcoes.GerarXls(new XLWorkbook(), "ITENS - " + SelectedControle.Apolice?.Replace("/", ""), itensList)).SaveAs(fileName); + if (!iniciar) + { + await ShowMessage("ARQUIVO SALVO NO CAMINHO " + fileName); + } + else + { + Process.Start(fileName); + } + RegistrarAcao($"GEROU A RELAÇÃO DOS ITENS DO DOCUMENTO DE ID {((DomainBase)SelectedControle).Id}", ((DomainBase)SelectedControle).Id, (TipoTela)21); + Loading(isLoading: false); + } + + public async void SalvarOrdem(ObservableCollection itens) + { + if (itens == null) + { + return; + } + if (itens.Any((Item x) => x.Ordem == 0)) + { + await ShowMessage("O CAMPO ORDEM DEVE SER MAIOR QUE ZERO."); + return; + } + if ((from item in itens + group item by item.Ordem).Any((IGrouping x) => x.Count() > 1)) + { + await ShowMessage("EXISTEM ITENS COM ORDEM REPETIDA. \nDEFINA UMA SEQUÊNCIA DIFERENTE PARA CADA ITEM."); + return; + } + Loading(isLoading: true); + foreach (Item iten in itens) + { + await _itemServico.Save(iten); + } + await SelecionaItens(FilterItens, null, 0L); + Loading(isLoading: false); + } + + public async Task CreateLink(Documento documento) + { + if (documento == null || SelectedCliente == null) + { + return ""; + } + Telefones = new ObservableCollection(await new ClienteServico().BuscarTelefonesAsync(((DomainBase)SelectedCliente).Id)); + object obj2; + if (Itens != null) + { + if (Itens.Count <= 1) + { + Item? obj = Itens.FirstOrDefault(); + obj2 = ((obj != null) ? obj.Descricao : null); + } + else + { + obj2 = "APÓLICE COLETIVA"; + } + } + else + { + obj2 = ""; + } + string item = (string)obj2; + return await CreateLinkAssistencia(documento, item); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Seguros/CriticaApoliceViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Seguros/CriticaApoliceViewModel.cs new file mode 100644 index 0000000..1bc6e72 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Seguros/CriticaApoliceViewModel.cs @@ -0,0 +1,1109 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using System.Windows; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.Servicos.Seguros.Itens; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Seguros; + +public class CriticaApoliceViewModel : BaseApoliceViewModel +{ + private readonly CriticaApoliceServico _criticaServico; + + private readonly ClienteServico _clienteServico; + + private readonly ItemServico _itemServico; + + private List Vinculos; + + private ObservableCollection _usuarios = new ObservableCollection(); + + private ObservableCollection _seguradorasFiltro = new ObservableCollection(); + + private string _fieldNascimento = "NASCIMENTO"; + + private bool _isExpanded = true; + + private DateTime _inicio = Funcoes.GetNetworkTime().Date.AddDays(-7.0); + + private DateTime _fim = Funcoes.GetNetworkTime().Date; + + private Usuario _selectedUsuario; + + private Seguradora _selectedSeguradora; + + private bool _criticado; + + private ObservableCollection _criticas = new ObservableCollection(); + + private ObservableCollection _criticaFiltrada = new ObservableCollection(); + + private bool _isCriticaSelected; + + private CriticaApolice _selectedCritica; + + private bool _hasChange; + + private bool _isParcela; + + private DateTime? _emissaoCritica; + + private DateTime? _transmissaoCritica; + + private DateTime? _nascimentoCritica; + + private TipoSeguro? _situacao; + + private Cliente _selectedCliente; + + private string _documentoPrincipal; + + private Visibility _visibilityFisica = (Visibility)2; + + private ObservableCollection _telefones = new ObservableCollection(); + + private ObservableCollection _emails = new ObservableCollection(); + + private ObservableCollection _itens = new ObservableCollection(); + + private bool _enableGrid = true; + + private string _pesquisa = ""; + + private ObservableCollection _pesquisaCritica = new ObservableCollection(); + + private string _profissaoText; + + private string _atividadeText; + + private Visibility _visibilityJuridica = (Visibility)2; + + private string _fieldDocumento = "CPF"; + + private Visibility _valorComissao; + + public ObservableCollection Usuarios + { + get + { + return _usuarios; + } + set + { + _usuarios = value; + SelectedUsuario = SelectedUsuario ?? value.FirstOrDefault(); + OnPropertyChanged("Usuarios"); + } + } + + public ObservableCollection SeguradorasFiltro + { + get + { + return _seguradorasFiltro; + } + set + { + _seguradorasFiltro = value; + SelectedSeguradora = SelectedSeguradora ?? value.FirstOrDefault(); + OnPropertyChanged("SeguradorasFiltro"); + } + } + + public string FieldNascimento + { + get + { + return _fieldNascimento; + } + set + { + _fieldNascimento = value; + OnPropertyChanged("FieldNascimento"); + } + } + + public bool IsExpanded + { + get + { + return _isExpanded; + } + set + { + _isExpanded = value; + OnPropertyChanged("IsExpanded"); + } + } + + public DateTime Inicio + { + get + { + return _inicio; + } + set + { + _inicio = value; + OnPropertyChanged("Inicio"); + } + } + + public DateTime Fim + { + get + { + return _fim; + } + set + { + _fim = value; + OnPropertyChanged("Fim"); + } + } + + public Usuario SelectedUsuario + { + get + { + return _selectedUsuario; + } + set + { + _selectedUsuario = value; + OnPropertyChanged("SelectedUsuario"); + } + } + + public Seguradora SelectedSeguradora + { + get + { + return _selectedSeguradora; + } + set + { + _selectedSeguradora = value; + OnPropertyChanged("SelectedSeguradora"); + } + } + + public bool Criticado + { + get + { + return _criticado; + } + set + { + _criticado = value; + OnPropertyChanged("Criticado"); + } + } + + public ObservableCollection Criticas + { + get + { + return _criticas; + } + set + { + _criticas = value; + OnPropertyChanged("Criticas"); + } + } + + public ObservableCollection CriticaFiltrada + { + get + { + return _criticaFiltrada; + } + set + { + _criticaFiltrada = value; + OnPropertyChanged("CriticaFiltrada"); + } + } + + public bool IsCriticaSelected + { + get + { + return _isCriticaSelected; + } + set + { + _isCriticaSelected = value; + OnPropertyChanged("IsCriticaSelected"); + } + } + + public CriticaApolice SelectedCritica + { + get + { + return _selectedCritica; + } + set + { + _selectedCritica = value; + IsCriticaSelected = value != null; + OnPropertyChanged("SelectedCritica"); + } + } + + public bool HasChange + { + get + { + return _hasChange; + } + set + { + _hasChange = value; + OnPropertyChanged("HasChange"); + } + } + + public bool IsParcela + { + get + { + return _isParcela; + } + set + { + _isParcela = value; + OnPropertyChanged("IsParcela"); + } + } + + public DateTime? EmissaoCritica + { + get + { + return _emissaoCritica; + } + set + { + _emissaoCritica = value; + OnPropertyChanged("EmissaoCritica"); + } + } + + public DateTime? TransmissaoCritica + { + get + { + return _transmissaoCritica; + } + set + { + _transmissaoCritica = value; + OnPropertyChanged("TransmissaoCritica"); + } + } + + public DateTime? NascimentoCritica + { + get + { + return _nascimentoCritica; + } + set + { + _nascimentoCritica = value; + OnPropertyChanged("NascimentoCritica"); + } + } + + public bool BuscaInicial { get; set; } = true; + + + public bool SeguroCombinado { get; set; } + + public bool IsLoading { get; set; } + + public TipoSeguro? StatusDocumento + { + get + { + return _situacao; + } + set + { + _situacao = value; + OnPropertyChanged("StatusDocumento"); + } + } + + public Cliente SelectedCliente + { + get + { + return _selectedCliente; + } + set + { + _selectedCliente = value; + OnPropertyChanged("SelectedCliente"); + } + } + + public string DocumentoPrincipal + { + get + { + return _documentoPrincipal; + } + set + { + //IL_005e: Unknown result type (might be due to invalid IL or missing references) + //IL_0063: Unknown result type (might be due to invalid IL or missing references) + //IL_0064: Unknown result type (might be due to invalid IL or missing references) + //IL_0066: Invalid comparison between Unknown and I4 + //IL_0068: Unknown result type (might be due to invalid IL or missing references) + //IL_006a: Invalid comparison between Unknown and I4 + if (value == null || ValidationHelper.OnlyNumber(value).Length > 11) + { + VisibilityFisica = (Visibility)2; + FieldNascimento = "FUNDAÇÃO"; + } + else + { + VisibilityFisica = (Visibility)0; + FieldNascimento = "NASCIMENTO"; + } + _documentoPrincipal = value; + if (SelectedCliente != null) + { + TipoDocumento? documentoPrincipal = SelectedCliente.DocumentoPrincipal; + if (!documentoPrincipal.HasValue) + { + goto IL_006c; + } + TipoDocumento valueOrDefault = documentoPrincipal.GetValueOrDefault(); + if ((int)valueOrDefault != 1) + { + if ((int)valueOrDefault != 2) + { + goto IL_006c; + } + SelectedCliente.Cei = value; + } + else + { + SelectedCliente.Rne = value; + } + } + goto IL_0094; + IL_006c: + SelectedCliente.Documento = value; + goto IL_0094; + IL_0094: + OnPropertyChanged("DocumentoPrincipal"); + } + } + + public Visibility VisibilityFisica + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityFisica; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityFisica = value; + OnPropertyChanged("VisibilityFisica"); + } + } + + public ObservableCollection Telefones + { + get + { + return _telefones; + } + set + { + _telefones = value; + OnPropertyChanged("Telefones"); + } + } + + public ObservableCollection Emails + { + get + { + return _emails; + } + set + { + _emails = value; + OnPropertyChanged("Emails"); + } + } + + public ObservableCollection Itens + { + get + { + return _itens; + } + set + { + _itens = value; + OnPropertyChanged("Itens"); + } + } + + public int Index { get; set; } = -1; + + + public bool EnableGrid + { + get + { + return _enableGrid; + } + set + { + _enableGrid = value; + OnPropertyChanged("EnableGrid"); + } + } + + public string Pesquisa + { + get + { + return _pesquisa; + } + set + { + _pesquisa = value; + OnPropertyChanged("Pesquisa"); + } + } + + public ObservableCollection PesquisaCritica + { + get + { + return _pesquisaCritica; + } + set + { + _pesquisaCritica = value; + OnPropertyChanged("PesquisaCritica"); + } + } + + public string ProfissaoText + { + get + { + return _profissaoText; + } + set + { + _profissaoText = value; + OnPropertyChanged("ProfissaoText"); + } + } + + public string AtividadeText + { + get + { + return _atividadeText; + } + set + { + _atividadeText = value; + OnPropertyChanged("AtividadeText"); + } + } + + public Visibility VisibilityJuridica + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityJuridica; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityJuridica = value; + OnPropertyChanged("VisibilityJuridica"); + } + } + + public string FieldDocumento + { + get + { + return _fieldDocumento; + } + set + { + _fieldDocumento = value; + OnPropertyChanged("FieldDocumento"); + } + } + + public Visibility ValorComissao + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _valorComissao; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _valorComissao = value; + OnPropertyChanged("ValorComissao"); + } + } + + public CriticaApoliceViewModel() + { + //IL_007e: Unknown result type (might be due to invalid IL or missing references) + //IL_00ca: Unknown result type (might be due to invalid IL or missing references) + base.Invoke = false; + _criticaServico = new CriticaApoliceServico(); + _clienteServico = new ClienteServico(); + _itemServico = new ItemServico(); + } + + public async Task InitialLoad() + { + IsLoading = true; + Loading(isLoading: true); + await PermissaoTela((TipoTela)2); + await SelecionaUsuario(); + await CarregarUsuarios(0L); + await CarregarSeguradoras(); + CriticaApoliceViewModel criticaApoliceViewModel = this; + Usuario selectedUsuario = SelectedUsuario; + await criticaApoliceViewModel.CarregaCritica((selectedUsuario != null) ? ((DomainBase)selectedUsuario).Id : 0, 0L); + Loading(isLoading: false); + IsLoading = false; + } + + public async Task SelecionaUsuario() + { + IsLoading = true; + if (Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 38 || (int)x.Configuracao == 43) && ((DomainBase)Recursos.Usuario).Id != 0L) + { + Vinculos = await VerificaVinculoVendedor(Recursos.Usuario); + } + IsLoading = false; + } + + public async Task CarregarUsuarios(long selected = 0L, bool criticado = false) + { + IsLoading = true; + Criticado = criticado; + List list = new List(); + List vinculos = Vinculos; + if (vinculos != null && vinculos.Count > 0) + { + list.Insert(0, new Usuario + { + Id = ((DomainBase)Recursos.Usuario).Id, + Nome = Recursos.Usuario.Nome + }); + } + else + { + list = await _criticaServico.BuscarUsuarioCritica(Inicio, Fim, Criticado); + list.Insert(0, new Usuario + { + Id = 0L, + Nome = "TODOS OS USUÁRIOS" + }); + } + Usuarios = new ObservableCollection(list); + SelectedUsuario = ((IEnumerable)Usuarios).FirstOrDefault((Func)((Usuario x) => ((DomainBase)x).Id == selected)) ?? Usuarios.FirstOrDefault(); + IsLoading = false; + } + + public async Task CarregarSeguradoras() + { + IsLoading = true; + List list = (await _criticaServico.BuscarSeguradorasAsync()).OrderBy((Seguradora x) => x.Nome).ToList(); + list.Insert(0, new Seguradora + { + Id = 0L, + Nome = "TODAS AS SEGURADORAS", + Ativo = true + }); + SeguradorasFiltro = new ObservableCollection(list.Where((Seguradora x) => x.Ativo)); + SelectedSeguradora = SeguradorasFiltro.FirstOrDefault(); + IsLoading = false; + } + + public async Task CarregaCritica(long usuario, long seguradora, bool criticado = false) + { + if (!IsLoading || BuscaInicial) + { + BuscaInicial = false; + EnableGrid = false; + Loading(isLoading: true); + Criticado = criticado; + await CarregarUsuarios(usuario, Criticado); + Criticas = new ObservableCollection(from x in await _criticaServico.BuscarCritica(usuario, Inicio, Fim, 0L, Criticado, Vinculos) + where (usuario == 0L || ((DomainBase)x.UsuarioImportacao).Id == usuario) && (seguradora == 0L || ((DomainBase)x.Documento.Controle.Seguradora).Id == seguradora) + orderby x.DataImportacao, x.Documento.Controle.Cliente.Nome descending + select x); + CriticaFiltrada = Criticas; + if (CriticaFiltrada != null && CriticaFiltrada.Count > 0) + { + await SelecionaCritica(CriticaFiltrada.First()); + } + else + { + IsCriticaSelected = false; + } + CriticaApoliceViewModel criticaApoliceViewModel = this; + ObservableCollection criticaFiltrada = CriticaFiltrada; + criticaApoliceViewModel.IsExpanded = criticaFiltrada != null && criticaFiltrada.Count > 0; + Loading(isLoading: false); + Usuario val = Usuarios?.FirstOrDefault((Func)((Usuario x) => ((DomainBase)x).Id == usuario)); + Seguradora val2 = base.Seguradoras?.FirstOrDefault((Func)((Seguradora x) => ((DomainBase)x).Id == seguradora)); + RegistrarAcao($"CONSULTOU CRÍTICAS NO PERÍODO ENTRE {Inicio:d} E {Fim:d}", 0L, (TipoTela)20, (PesquisaCritica != null && PesquisaCritica.Count > 0) ? string.Format("USUÁRIO IMPORTAÇÃO: {0} ({1})\nSEGURADORA: {2} ({3})\nCRITICADOS: {4}\nPESQUISA PERSONALIZADA: \"{5}\"", ((val != null) ? val.Nome : null) ?? "TODOS USUÁRIOS", (val != null) ? ((DomainBase)val).Id : 0, ((val2 != null) ? val2.Nome : null) ?? "TODAS AS SEGURADORAS", (val2 != null) ? ((DomainBase)val2).Id : 0, Criticado ? "SIM" : "NÃO", ValidationHelper.Join((IEnumerable)PesquisaCritica, ", ")) : string.Format("USUÁRIO IMPORTAÇÃO: {0} ({1})\nSEGURADORA: {2} ({3})\nCRITICADOS: {4}", ((val != null) ? val.Nome : null) ?? "TODOS USUÁRIOS", (val != null) ? ((DomainBase)val).Id : 0, ((val2 != null) ? val2.Nome : null) ?? "TODAS AS SEGURADORAS", (val2 != null) ? ((DomainBase)val2).Id : 0, Criticado ? "SIM" : "NÃO")); + EnableGrid = true; + } + } + + public async Task SelecionaCritica(CriticaApolice critica) + { + if (critica != null && !IsLoading) + { + IsLoading = true; + Loading(isLoading: true); + critica.Documento = await Servico.BuscarApoliceAsync(((DomainBase)critica.Documento).Id); + base.SelectedDocumento = null; + base.Repasses = null; + base.Parcelas = null; + base.Pagamentos = null; + base.SelectedParcela = null; + base.SelectedPagamento = null; + SelectedCritica = critica; + await SelecionaDocumento(critica.Documento); + EmissaoCritica = ((critica.Documento != null && critica.Documento.Emissao.HasValue) ? critica.Documento.Emissao : new DateTime?(Funcoes.GetNetworkTime().Date)); + TransmissaoCritica = ((critica.Documento != null && critica.Documento.Remessa.HasValue) ? critica.Documento.Remessa : new DateTime?(Funcoes.GetNetworkTime().Date)); + StatusDocumento = (Recursos.Configuracoes.All((ConfiguracaoSistema x) => (int)x.Configuracao != 3) ? new TipoSeguro?(base.SelectedDocumento.Situacao) : null); + if (base.SelectedDocumento == null) + { + IsParcela = true; + HasChange = false; + Loading(isLoading: false); + return; + } + IsParcela = (int)base.SelectedDocumento.TipoRecebimento.GetValueOrDefault() == 1; + await SelecionaCliente(base.SelectedDocumento.Controle.Cliente); + await SelecionaItens(((DomainBase)base.SelectedDocumento.Controle).Id); + HasChange = false; + Loading(isLoading: false); + IsLoading = false; + } + } + + public async Task SelecionaItens(long id) + { + Itens = await _itemServico.BuscarItens(id, (StatusItem)0); + } + + public async Task SelecionaCliente(Cliente cliente) + { + TipoDocumento? documentoPrincipal = cliente.DocumentoPrincipal; + if (!documentoPrincipal.HasValue) + { + goto IL_0040; + } + TipoDocumento valueOrDefault = documentoPrincipal.GetValueOrDefault(); + if ((int)valueOrDefault != 1) + { + if ((int)valueOrDefault != 2) + { + goto IL_0040; + } + DocumentoPrincipal = cliente.Cei; + } + else + { + DocumentoPrincipal = cliente.Rne; + } + goto IL_0088; + IL_0088: + NascimentoCritica = ((cliente != null && cliente.Nascimento.HasValue) ? cliente.Nascimento : new DateTime?(Funcoes.GetNetworkTime().Date)); + SelectedCliente = cliente; + ((DomainBase)SelectedCliente).Initialize(); + Telefones = await _clienteServico.BuscarTelefonesAsync(((DomainBase)SelectedCliente).Id); + if (Telefones.Count == 0) + { + Telefones.Add(new ClienteTelefone + { + Cliente = SelectedCliente + }); + } + Telefones.ToList().ForEach(delegate(ClienteTelefone x) + { + ((DomainBase)x).Initialize(); + }); + Emails = await _clienteServico.BuscarEmailsAsync(((DomainBase)SelectedCliente).Id); + if (Emails.Count == 0) + { + Emails.Add(new ClienteEmail + { + Cliente = SelectedCliente + }); + } + Emails.ToList().ForEach(delegate(ClienteEmail x) + { + ((DomainBase)x).Initialize(); + }); + return; + IL_0040: + DocumentoPrincipal = cliente.Documento; + cliente.DocumentoPrincipal = (TipoDocumento)0; + goto IL_0088; + } + + public async Task ConcluirCritica() + { + DateTime now = Funcoes.GetNetworkTime(); + SelectedCritica.Critica = true; + SelectedCritica.DataCritica = now; + SelectedCritica.UsuarioCritica = ((DomainBase)Recursos.Usuario).Id; + foreach (CriticaApolice item2 in await _criticaServico.BuscarCritica(((DomainBase)SelectedCritica.Documento).Id)) + { + item2.Critica = true; + item2.DataCritica = now; + item2.UsuarioCritica = ((DomainBase)Recursos.Usuario).Id; + await _criticaServico.Save(item2); + } + if (SeguroCombinado) + { + List list = (await _criticaServico.BuscarSeguroCombinado(((DomainBase)SelectedCritica.Documento.Controle.Cliente).Id, SelectedCritica.Documento.Vigencia1)).Where(delegate(CriticaApolice duo) + { + if (((DomainBase)duo.Documento.Controle.Seguradora).Id == ((DomainBase)SelectedCritica.Documento.Controle.Seguradora).Id && ((DomainBase)duo.Documento.Controle.Cliente).Id == ((DomainBase)SelectedCritica.Documento.Controle.Cliente).Id && duo.Documento.Vigencia1 == SelectedCritica.Documento.Vigencia1) + { + DateTime? vigencia = duo.Documento.Vigencia2; + DateTime? vigencia2 = SelectedCritica.Documento.Vigencia2; + if (vigencia.HasValue == vigencia2.HasValue && (!vigencia.HasValue || vigencia.GetValueOrDefault() == vigencia2.GetValueOrDefault()) && ((DomainBase)duo.Documento).Id != ((DomainBase)SelectedCritica.Documento).Id && duo.Documento.Apolice == SelectedCritica.Documento.Apolice && duo.Documento.Proposta == null) + { + return true; + } + } + return Regex.Replace(duo.Documento.Proposta, "[^.'-,/]", "") == Regex.Replace(SelectedCritica.Documento.Proposta, "[^.'-,/]", ""); + }).ToList(); + List list2 = ((list == null || list.Count() <= 0) ? null : (await _criticaServico.BuscarCritica(((DomainBase)list.FirstOrDefault().Documento).Id))); + list = list2; + if (list != null && list.Any()) + { + foreach (CriticaApolice seguroduo in list) + { + seguroduo.Critica = true; + seguroduo.DataCritica = now; + seguroduo.Documento.PremioLiquido = 0.01m; + seguroduo.Documento.PremioTotal = 0.01m; + seguroduo.Documento.Comissao = 0.01m; + seguroduo.UsuarioCritica = ((DomainBase)Recursos.Usuario).Id; + await _criticaServico.Save(seguroduo); + await Servico.Save(seguroduo.Documento, updateParcelas: false, criarParcelas: false); + } + } + } + string text = ((SelectedCritica.Tipo == "0") ? ("A PROPOSTA \"" + CancelDocumento.Proposta + "\"") : ((SelectedCritica.Tipo == "1") ? ("A APÓLICE \"" + CancelDocumento.Apolice + "\"") : ("O ENDOSSO \"" + CancelDocumento.Endosso + "\""))); + RegistrarAcao("CONCLUIU A CRÍTICA D" + text, ((DomainBase)SelectedCritica).Id, (TipoTela)20); + object obj2; + if (Itens != null) + { + if (Itens.Count <= 1) + { + Item? obj = Itens.FirstOrDefault(); + obj2 = ((obj != null) ? obj.Descricao : null); + } + else + { + obj2 = "APÓLICE COLETIVA"; + } + } + else + { + obj2 = ""; + } + string item = (string)obj2; + try + { + if (string.IsNullOrEmpty(base.SelectedDocumento.Controle.AssistenciaId)) + { + await CreateLinkAssistencia(base.SelectedDocumento, item, retorno: false); + } + } + catch (Exception) + { + } + base.SelectedDocumento = null; + SelectedCliente = null; + Telefones = null; + Emails = null; + Itens = null; + await CarregaCritica(((DomainBase)SelectedUsuario).Id, ((DomainBase)SelectedSeguradora).Id, Criticado); + } + + public async void ExcluirTelefone(ClienteTelefone telefone) + { + if (Telefones.Count < 2) + { + await ShowMessage("É NECESSÁRIO TER AO MENOS UM TELEFONE CADASTRADO."); + return; + } + HasChange = true; + bool num = telefone.Ordem != Telefones.Count; + int quantidate = Telefones.Count; + Telefones.Remove(telefone); + if (num && ((IEnumerable)Telefones).FirstOrDefault((Func)((ClienteTelefone x) => x.Ordem == quantidate)) != null) + { + Telefones.First((ClienteTelefone x) => x.Ordem == quantidate).Ordem = telefone.Ordem; + Telefones = new ObservableCollection(Telefones.OrderBy((ClienteTelefone x) => x.Ordem)); + } + } + + public async void ExcluirEmail(ClienteEmail email) + { + if (Emails.Count < 2) + { + await ShowMessage("É NECESSÁRIO TER AO MENOS UM CONTATO DE E-MAIL CADASTRADO."); + return; + } + HasChange = true; + bool num = email.Ordem != Emails.Count; + int quantidate = Emails.Count; + Emails.Remove(email); + if (num && ((IEnumerable)Emails).FirstOrDefault((Func)((ClienteEmail x) => x.Ordem == quantidate)) != null) + { + Emails.First((ClienteEmail x) => x.Ordem == quantidate).Ordem = email.Ordem; + Emails = new ObservableCollection(Emails.OrderBy((ClienteEmail x) => x.Ordem)); + } + } + + public async Task>> SalvarCliente() + { + if (!HasChange && !((DomainBase)SelectedCliente).HasChange() && Telefones.All((ClienteTelefone x) => !((DomainBase)x).HasChange()) && Emails.All((ClienteEmail x) => !((DomainBase)x).HasChange())) + { + return null; + } + List list = Telefones.Where((ClienteTelefone x) => !string.IsNullOrEmpty(((TelefoneBase)x).Numero)).ToList(); + List list2 = Emails.Where((ClienteEmail x) => !string.IsNullOrEmpty(((EmailBase)x).Email)).ToList(); + SelectedCliente.Telefones = new ObservableCollection(list); + SelectedCliente.Emails = new ObservableCollection(list2); + TipoDocumento? documentoPrincipal = SelectedCliente.DocumentoPrincipal; + if (!documentoPrincipal.HasValue) + { + goto IL_0147; + } + TipoDocumento valueOrDefault = documentoPrincipal.GetValueOrDefault(); + if ((int)valueOrDefault != 1) + { + if ((int)valueOrDefault != 2) + { + goto IL_0147; + } + SelectedCliente.Cei = DocumentoPrincipal; + } + else + { + SelectedCliente.Rne = DocumentoPrincipal; + } + goto IL_017e; + IL_017e: + List> errorMessages = SelectedCliente.Validate(); + list.ForEach(delegate(ClienteTelefone x) + { + errorMessages.AddRange(x.Validate()); + }); + list2.ForEach(delegate(ClienteEmail x) + { + errorMessages.AddRange(x.Validate()); + }); + List> list3 = errorMessages; + list3.AddRange(await Validate()); + if (errorMessages.Count > 0) + { + return errorMessages; + } + await _clienteServico.Save(SelectedCliente); + return null; + IL_0147: + SelectedCliente.Documento = DocumentoPrincipal; + goto IL_017e; + } + + private async Task>> Validate() + { + List> errors = new List>(); + bool valida = !string.IsNullOrEmpty(SelectedCliente.Nome); + switch (SelectedCliente.DocumentoPrincipal) + { + case 0L: + if (!ValidationHelper.ValidateDocument(SelectedCliente.Documento)) + { + valida = false; + } + break; + case 1L: + if (!ValidationHelper.ValidateRne(SelectedCliente.Rne)) + { + valida = false; + } + break; + case 2L: + if (!ValidationHelper.ValidateCei(SelectedCliente.Cei)) + { + valida = false; + } + break; + } + List list = ((!ValidationHelper.ValidateDocument(SelectedCliente.Documento)) ? new List() : (await new ClienteServico().BuscarClientePorDocumento(SelectedCliente.Documento))); + List list2 = list; + string nome = ""; + if (list2.Count > 0) + { + list2.ForEach(delegate(Cliente x) + { + if (((DomainBase)x).Id != ((DomainBase)SelectedCliente).Id && SelectedCliente.IdEmpresa == x.IdEmpresa && !string.IsNullOrEmpty(SelectedCliente.Documento) && x.Documento == SelectedCliente.Documento) + { + valida = false; + nome = x.Nome; + } + }); + } + if (!valida) + { + errors.Add(new KeyValuePair("Documento", "O DOCUMENTO JÁ ESTÁ CADASTRADO PARA O CLIENTE " + nome + ".")); + } + if (SelectedCliente.Telefones == null || SelectedCliente.Telefones.Count == 0) + { + errors.Add(new KeyValuePair("Telefones", "NECESSITA-SE AO MENOS UM TELEFONE VÁLIDO.")); + } + if (Recursos.Configuracoes.All((ConfiguracaoSistema x) => (int)x.Configuracao != 29) && (SelectedCliente.Emails == null || SelectedCliente.Emails.Count == 0)) + { + errors.Add(new KeyValuePair("Emails", "NECESSITA-SE AO MENOS UM E-MAIL VÁLIDO.")); + } + return errors; + } + + public void AlteraDocumentoPrincipal() + { + //IL_0020: Unknown result type (might be due to invalid IL or missing references) + //IL_0025: Unknown result type (might be due to invalid IL or missing references) + //IL_0026: Unknown result type (might be due to invalid IL or missing references) + //IL_0028: Invalid comparison between Unknown and I4 + //IL_002a: Unknown result type (might be due to invalid IL or missing references) + //IL_002c: Invalid comparison between Unknown and I4 + if (SelectedCliente == null) + { + return; + } + TipoDocumento? documentoPrincipal = SelectedCliente.DocumentoPrincipal; + if (documentoPrincipal.HasValue) + { + TipoDocumento valueOrDefault = documentoPrincipal.GetValueOrDefault(); + if ((int)valueOrDefault == 1) + { + DocumentoPrincipal = SelectedCliente.Rne; + return; + } + if ((int)valueOrDefault == 2) + { + DocumentoPrincipal = SelectedCliente.Cei; + return; + } + } + DocumentoPrincipal = SelectedCliente.Documento; + SelectedCliente.DocumentoPrincipal = (TipoDocumento)0; + } + + public void AdcionarFiltro() + { + if (!string.IsNullOrEmpty(Pesquisa) && !string.IsNullOrWhiteSpace(Pesquisa.Replace("+", ""))) + { + if (PesquisaCritica == null) + { + PesquisaCritica = new ObservableCollection(); + } + PesquisaCritica.Add(Pesquisa); + Pesquisa = string.Empty; + Pesquisar(); + } + } + + public async void Pesquisar() + { + EnableGrid = false; + if (PesquisaCritica == null || PesquisaCritica.Count == 0) + { + CriticaFiltrada = new ObservableCollection(Criticas); + } + else + { + CriticaFiltrada = new ObservableCollection(from x in Criticas + where PesquisaCritica.All((string s) => (from f in s.Split(new char[1] { '+' }).ToList() + where !string.IsNullOrWhiteSpace(f) + select f).Any((string f) => ValidationHelper.RemoveDiacritics(x.Documento.Controle.Cliente.Nome).ToUpper().Contains(ValidationHelper.RemoveDiacritics(f)) || (x.Documento.Controle.Cliente.Documento != null && x.Documento.Controle.Cliente.Documento.Contains(f)) || (x.Documento.Controle.Cliente.Cei != null && x.Documento.Controle.Cliente.Cei.Contains(f)) || (x.Documento.Controle.Cliente.Rne != null && x.Documento.Controle.Cliente.Rne.Contains(f)) || (x.UsuarioImportacao != null && x.UsuarioImportacao.Nome.Contains(f)) || (x.DataImportacao.HasValue && x.DataImportacao.ToString().Contains(f)) || (x.Documento.Apolice != null && x.Documento.Apolice.ToUpper().Contains(f.ToUpper())) || (x.Documento.Proposta != null && x.Documento.Proposta.ToUpper().Contains(f.ToUpper())))) + orderby x.DataImportacao, x.Documento.Controle.Cliente.Nome descending + select x); + } + await SelecionaCritica(CriticaFiltrada.FirstOrDefault()); + EnableGrid = true; + } + + public void JuridicaouFisica(string documento) + { + if (SelectedCliente != null) + { + ProfissaoText = ""; + AtividadeText = ""; + if (documento == null || ValidationHelper.OnlyNumber(documento).Length > 11) + { + VisibilityJuridica = (Visibility)0; + VisibilityFisica = (Visibility)2; + FieldNascimento = "FUNDAÇÃO"; + FieldDocumento = "CNPJ"; + SelectedCliente.Profissao = null; + } + else + { + VisibilityJuridica = (Visibility)2; + VisibilityFisica = (Visibility)0; + FieldNascimento = "NASCIMENTO"; + FieldDocumento = "CPF"; + SelectedCliente.Atividade = null; + } + } + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Seguros/PerfilEmpresaViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Seguros/PerfilEmpresaViewModel.cs new file mode 100644 index 0000000..a119dd3 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Seguros/PerfilEmpresaViewModel.cs @@ -0,0 +1,256 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using System.Windows; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.Helper; +using Gestor.Model.Resources; + +namespace Gestor.Application.ViewModels.Seguros; + +public class PerfilEmpresaViewModel : BaseViewModel +{ + private readonly PerfilEmpresaServico _servico; + + private readonly Controle _controle; + + private Visibility _ativaCampos = (Visibility)2; + + private string _equipamentoSeguranca = ""; + + private string _equipamentoIncendio = ""; + + private bool _enableIncluirPerfil; + + private string _dataConstrucao; + + public long CancelPerfil; + + private PerfilEmpresa _selectedPerfilEmpresa = new PerfilEmpresa(); + + public Visibility AtivaCampos + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _ativaCampos; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _ativaCampos = value; + OnPropertyChanged("AtivaCampos"); + } + } + + public string EquipamentoSeguranca + { + get + { + return _equipamentoSeguranca; + } + set + { + _equipamentoSeguranca = value; + OnPropertyChanged("EquipamentoSeguranca"); + } + } + + public string EquipamentoIncendio + { + get + { + return _equipamentoIncendio; + } + set + { + _equipamentoIncendio = value; + OnPropertyChanged("EquipamentoIncendio"); + } + } + + public bool EnableIncluirPerfil + { + get + { + return _enableIncluirPerfil; + } + set + { + _enableIncluirPerfil = value; + OnPropertyChanged("EnableIncluirPerfil"); + } + } + + public string DataConstrucao + { + get + { + return _dataConstrucao; + } + set + { + _dataConstrucao = value?.Replace(" ", ""); + OnPropertyChanged("DataConstrucao"); + } + } + + public PerfilEmpresa SelectedPerfilEmpresa + { + get + { + return _selectedPerfilEmpresa; + } + set + { + _selectedPerfilEmpresa = value; + if (value != null && ((DomainBase)value).Id > 0) + { + CancelPerfil = ((DomainBase)value).Id; + } + VerificarEnables((value != null) ? new long?(((DomainBase)value).Id) : null); + OnPropertyChanged("SelectedPerfilEmpresa"); + } + } + + public PerfilEmpresaViewModel(Controle controle) + { + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + //IL_001e: Unknown result type (might be due to invalid IL or missing references) + //IL_0028: Expected O, but got Unknown + _servico = new PerfilEmpresaServico(); + _controle = controle; + Seleciona(((DomainBase)controle).Id); + } + + private async void Seleciona(long id) + { + Loading(isLoading: true); + await PermissaoTela((TipoTela)32); + await SelecionaPerfil(id); + Loading(isLoading: false); + } + + private async Task SelecionaPerfil(long id) + { + Loading(isLoading: true); + SelectedPerfilEmpresa = await _servico.BuscarPerfis(id); + if (SelectedPerfilEmpresa != null) + { + EquipamentoSeguranca = BindingEnumHelper.ConcatenarDescricoesEnum(SelectedPerfilEmpresa.EquipamentoSeguranca); + EquipamentoIncendio = BindingEnumHelper.ConcatenarDescricoesEnum(SelectedPerfilEmpresa.EquipamentoIncendio); + if (SelectedPerfilEmpresa.AnoConstrucao.HasValue) + { + DataConstrucao = SelectedPerfilEmpresa.AnoConstrucao.Value.Year.ToString(); + } + } + else + { + EnableIncluirPerfil = true; + EquipamentoSeguranca = ""; + EquipamentoIncendio = ""; + } + Loading(isLoading: false); + } + + public void Incluir() + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_003a: Unknown result type (might be due to invalid IL or missing references) + //IL_0046: Unknown result type (might be due to invalid IL or missing references) + //IL_0052: Unknown result type (might be due to invalid IL or missing references) + //IL_005e: Unknown result type (might be due to invalid IL or missing references) + //IL_006a: Unknown result type (might be due to invalid IL or missing references) + //IL_0077: Expected O, but got Unknown + PerfilEmpresa selectedPerfilEmpresa = new PerfilEmpresa + { + Controle = _controle, + Cliente = _controle.Cliente, + ExclusivoDeposito = false, + DivisaTerrenoBaldio = false, + PatrimonioHistorio = false, + PossuiTelhado = false, + CaixasEletronicos = false, + Isopainel = false, + ConstrucaoReforma = false + }; + SelectedPerfilEmpresa = selectedPerfilEmpresa; + Alterar(alterar: true); + } + + public async Task>> Salvar() + { + List> errorMessages = SelectedPerfilEmpresa.Validate(); + errorMessages = ValidateCampos(errorMessages); + if (errorMessages.Count > 0) + { + return errorMessages; + } + if (DataConstrucao != null && DataConstrucao != "") + { + SelectedPerfilEmpresa.AnoConstrucao = DateTime.Parse("01/01/" + DataConstrucao); + } + SelectedPerfilEmpresa = await _servico.Save(SelectedPerfilEmpresa); + if (!_servico.Sucesso) + { + return null; + } + await SelecionaPerfil(((DomainBase)_controle).Id); + ToggleSnackBar("PERFIL SALVO COM SUCESSO"); + Alterar(alterar: false); + return null; + } + + private List> ValidateCampos(List> errorMessages) + { + if (DataConstrucao == null) + { + ValidationHelper.AddValue(errorMessages, "ANO DA CONSTRUÇÃO", Messages.DataInvalida, true); + } + if (!int.TryParse(DataConstrucao, out var _)) + { + ValidationHelper.AddValue(errorMessages, "ANO DA CONSTRUÇÃO", Messages.DataInvalida, true); + } + if (DataConstrucao != null && int.TryParse(DataConstrucao, out var _) && (int.Parse(DataConstrucao) <= 1755 || int.Parse(DataConstrucao) >= 9999)) + { + ValidationHelper.AddValue(errorMessages, "ANO DA CONSTRUÇÃO", Messages.DataInvalida, true); + } + return errorMessages; + } + + public void CancelarAlteracao() + { + Loading(isLoading: true); + Alterar(alterar: false); + Loading(isLoading: false); + } + + public async Task Excluir() + { + if (SelectedPerfilEmpresa != null && ((DomainBase)SelectedPerfilEmpresa).Id != 0L && await ShowMessage("DESEJA EXCLUIR?", "SIM", "NÃO")) + { + Loading(isLoading: true); + if (!(await _servico.Delete(SelectedPerfilEmpresa))) + { + Loading(isLoading: false); + return; + } + await SelecionaPerfil(((DomainBase)_controle).Id); + Loading(isLoading: false); + EnableIncluirPerfil = true; + AtivaCampos = (Visibility)2; + DataConstrucao = null; + ToggleSnackBar("PERFIL EXCLUÍDO COM SUCESSO"); + } + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Seguros/PerfilViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Seguros/PerfilViewModel.cs new file mode 100644 index 0000000..2515b35 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Seguros/PerfilViewModel.cs @@ -0,0 +1,168 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Seguros; + +public class PerfilViewModel : BaseViewModel +{ + private readonly PerfilServico _servico; + + private readonly Controle _controle; + + public long CancelPerfil; + + private Perfil _selectedPerfil = new Perfil(); + + private ObservableCollection _perfis; + + public Perfil SelectedPerfil + { + get + { + return _selectedPerfil; + } + set + { + _selectedPerfil = value; + if (value != null && ((DomainBase)value).Id > 0) + { + CancelPerfil = ((DomainBase)value).Id; + } + VerificarEnables((value != null) ? new long?(((DomainBase)value).Id) : null); + OnPropertyChanged("SelectedPerfil"); + } + } + + public ObservableCollection Perfis + { + get + { + return _perfis; + } + set + { + _perfis = value; + OnPropertyChanged("Perfis"); + } + } + + public PerfilViewModel(Controle controle) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_000b: Expected O, but got Unknown + _servico = new PerfilServico(); + _controle = controle; + Seleciona(((DomainBase)controle).Id); + } + + private async void Seleciona(long id) + { + Loading(isLoading: true); + await PermissaoTela((TipoTela)32); + await SelecionaPerfis(id, 0L); + Loading(isLoading: false); + } + + private async Task SelecionaPerfis(long id, long perfilId = 0L) + { + Loading(isLoading: true); + Perfis = new ObservableCollection(await _servico.BuscarPerfis(id)); + SelectedPerfil = (Perfil)((perfilId == 0L) ? ((object)Perfis.FirstOrDefault()) : ((object)Perfis.First((Perfil x) => ((DomainBase)x).Id == perfilId))); + Loading(isLoading: false); + } + + public void Incluir() + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_003a: Unknown result type (might be due to invalid IL or missing references) + //IL_0046: Unknown result type (might be due to invalid IL or missing references) + //IL_0052: Unknown result type (might be due to invalid IL or missing references) + //IL_005f: Expected O, but got Unknown + Perfil selectedPerfil = new Perfil + { + Controle = _controle, + Cliente = _controle.Cliente, + UsoProfissional = false, + AntiFurto = (Antifurto)0, + Isencao = false, + SeguroVida = false, + EstenderCobertura = false + }; + SelectedPerfil = selectedPerfil; + Alterar(alterar: true); + } + + public async Task>> Salvar() + { + List> list = SelectedPerfil.Validate(); + if (list.Count > 0) + { + return list; + } + SelectedPerfil = await _servico.Save(SelectedPerfil); + if (!_servico.Sucesso) + { + return null; + } + await SelecionaPerfis(((DomainBase)_controle).Id, ((DomainBase)SelectedPerfil).Id); + ToggleSnackBar("PERFIL SALVO COM SUCESSO"); + Alterar(alterar: false); + return null; + } + + public void CancelarAlteracao() + { + Loading(isLoading: true); + if (CancelPerfil > 0) + { + SelectedPerfil = ((IEnumerable)Perfis).FirstOrDefault((Func)((Perfil x) => ((DomainBase)x).Id == CancelPerfil)); + } + Alterar(alterar: false); + Loading(isLoading: false); + } + + public async Task Excluir() + { + if (SelectedPerfil == null || ((DomainBase)SelectedPerfil).Id == 0L || !(await ShowMessage("DESEJA EXCLUIR?", "SIM", "NÃO"))) + { + return; + } + Loading(isLoading: true); + bool isLast = SelectedPerfil == Perfis.Last(); + if (!(await _servico.Delete(SelectedPerfil))) + { + Loading(isLoading: false); + return; + } + if (isLast) + { + int num = Perfis.IndexOf(SelectedPerfil); + if (num <= 0) + { + await SelecionaPerfis(((DomainBase)_controle).Id, 0L); + } + else + { + await SelecionaPerfis(((DomainBase)_controle).Id, ((DomainBase)Perfis[num - 1]).Id); + } + } + else if (Perfis.Count > 0) + { + await SelecionaPerfis(((DomainBase)_controle).Id, ((DomainBase)Perfis[Perfis.IndexOf(SelectedPerfil) + 1]).Id); + } + Loading(isLoading: false); + ToggleSnackBar("PERFIL EXCLUÍDO COM SUCESSO"); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Seguros/SinistroViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Seguros/SinistroViewModel.cs new file mode 100644 index 0000000..d5b0f8f --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Seguros/SinistroViewModel.cs @@ -0,0 +1,1337 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using Gestor.Application.Drawers; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.Servicos.Seguros.Itens; +using Gestor.Application.ViewModels.Generic; +using Gestor.Application.Views.Ferramentas; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.MalaDireta; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Seguros; + +public class SinistroViewModel : BaseSegurosViewModel +{ + private readonly SinistroServico _servico; + + private readonly ItemServico _itemServico; + + private readonly Documento _documentoSelecionado; + + private readonly ClienteServico _clienteServico; + + private bool _editarObservacao = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 49); + + private bool _isAnotacoes = true; + + private List _tipoPerdaAuto = new List + { + (TipoPerda)1, + (TipoPerda)2, + (TipoPerda)4, + (TipoPerda)3, + (TipoPerda)8 + }; + + private List _tipoPerdaVida = new List + { + (TipoPerda)5, + (TipoPerda)6, + (TipoPerda)7, + (TipoPerda)8 + }; + + private Credencial _selectedCredencial = new Credencial(); + + private List _credenciais = new List(); + + private ObservableCollection _itens = new ObservableCollection(); + + private ObservableCollection _itensFiltrados = new ObservableCollection(); + + private ObservableCollection _parceiros = new ObservableCollection(GerarParceiros()); + + private bool _habilitarImprimirHistorico; + + private bool _habilitarEnviarHistorico; + + private Visibility _isVisibleImprimirHistorico; + + private Visibility _isVisibleIncluir; + + private Visibility _isVisibleTerceiro = (Visibility)2; + + private Visibility _visibilityAuto = (Visibility)2; + + private Visibility _visibilityVida = (Visibility)2; + + private Visibility _liquidacaoVisibility; + + private bool _isReadOnlyItem = true; + + private bool _tipoSinistroEnabled; + + private Item _selectedItem = new Item(); + + private bool _mostrarLista; + + private bool _isExpandedItem = true; + + private bool _isExpandedSinistro = true; + + private List _controles = new List(); + + private ObservableCollection _controlesFiltrados = new ObservableCollection(); + + private ControleSinistro _selectedControle = new ControleSinistro(); + + private Sinistro _selectedSinistro; + + private string _codigoSinistro; + + private string _anotacoes; + + private string _anotacoesInternas; + + private string _telefonesMecanica; + + private string _telefonesFunileiro; + + public int FiltroItens { get; set; } + + public Item ItemSelecionado { get; set; } + + public bool EditarObservacao + { + get + { + return _editarObservacao; + } + set + { + _editarObservacao = value; + OnPropertyChanged("EditarObservacao"); + } + } + + public bool IsAnotacoes + { + get + { + return _isAnotacoes; + } + set + { + _isAnotacoes = value; + OnPropertyChanged("IsAnotacoes"); + } + } + + private bool Carregando { get; set; } + + public List TipoPerdaAuto + { + get + { + return _tipoPerdaAuto; + } + set + { + _tipoPerdaAuto = value; + OnPropertyChanged("TipoPerdaAuto"); + } + } + + public List TipoPerdaVida + { + get + { + return _tipoPerdaVida; + } + set + { + _tipoPerdaVida = value; + OnPropertyChanged("TipoPerdaVida"); + } + } + + public Credencial SelectedCredencial + { + get + { + return _selectedCredencial; + } + set + { + _selectedCredencial = value; + OnPropertyChanged("SelectedCredencial"); + } + } + + public List Credenciais + { + get + { + return _credenciais; + } + set + { + _credenciais = value; + OnPropertyChanged("Credenciais"); + } + } + + public ObservableCollection Itens + { + get + { + return _itens; + } + set + { + _itens = value; + OnPropertyChanged("Itens"); + } + } + + public ObservableCollection ItensFiltrados + { + get + { + return _itensFiltrados; + } + set + { + _itensFiltrados = value; + IsExpandedItem = value != null && value.Count > 0; + OnPropertyChanged("ItensFiltrados"); + } + } + + public ObservableCollection Parceiros + { + get + { + return _parceiros; + } + set + { + _parceiros = value; + OnPropertyChanged("Parceiros"); + } + } + + public bool HabilitarImprimirHistorico + { + get + { + return _habilitarImprimirHistorico; + } + set + { + _habilitarImprimirHistorico = value; + OnPropertyChanged("HabilitarImprimirHistorico"); + } + } + + public bool HabilitarEnviarHistorico + { + get + { + return _habilitarEnviarHistorico; + } + set + { + _habilitarEnviarHistorico = value; + OnPropertyChanged("HabilitarEnviarHistorico"); + } + } + + public Visibility IsVisibleImprimirHistorico + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _isVisibleImprimirHistorico; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _isVisibleImprimirHistorico = value; + OnPropertyChanged("IsVisibleImprimirHistorico"); + } + } + + public Visibility IsVisibleIncluir + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _isVisibleIncluir; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _isVisibleIncluir = value; + OnPropertyChanged("IsVisibleIncluir"); + } + } + + public Visibility IsVisibleTerceiro + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _isVisibleTerceiro; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _isVisibleTerceiro = value; + OnPropertyChanged("IsVisibleTerceiro"); + } + } + + public Visibility VisibilityAuto + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityAuto; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityAuto = value; + OnPropertyChanged("VisibilityAuto"); + } + } + + public Visibility VisibilityVida + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityVida; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityVida = value; + OnPropertyChanged("VisibilityVida"); + } + } + + public Visibility LiquidacaoVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _liquidacaoVisibility; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _liquidacaoVisibility = value; + OnPropertyChanged("LiquidacaoVisibility"); + } + } + + public bool IsReadOnlyItem + { + get + { + return _isReadOnlyItem; + } + set + { + _isReadOnlyItem = value; + OnPropertyChanged("IsReadOnlyItem"); + } + } + + public bool TipoSinistroEnabled + { + get + { + return _tipoSinistroEnabled; + } + set + { + _tipoSinistroEnabled = value; + OnPropertyChanged("TipoSinistroEnabled"); + } + } + + public Item SelectedItem + { + get + { + return _selectedItem; + } + set + { + _selectedItem = value; + VerificarEnables((value != null) ? new long?(((DomainBase)value).Id) : null); + OnPropertyChanged("SelectedItem"); + } + } + + public bool MostrarLista + { + get + { + return _mostrarLista; + } + set + { + _mostrarLista = value; + OnPropertyChanged("MostrarLista"); + } + } + + public bool IsExpandedItem + { + get + { + return _isExpandedItem; + } + set + { + _isExpandedItem = value; + OnPropertyChanged("IsExpandedItem"); + } + } + + public bool IsExpandedSinistro + { + get + { + return _isExpandedSinistro; + } + set + { + _isExpandedSinistro = value; + OnPropertyChanged("IsExpandedSinistro"); + } + } + + public List Controles + { + get + { + return _controles; + } + set + { + _controles = value; + base.EnableIncluir = value == null || value.Count == 0; + OnPropertyChanged("Controles"); + } + } + + public ObservableCollection ControlesFiltrados + { + get + { + return _controlesFiltrados; + } + set + { + _controlesFiltrados = value; + IsExpandedSinistro = value != null && value.Count > 0; + OnPropertyChanged("ControlesFiltrados"); + } + } + + public ControleSinistro SelectedControle + { + get + { + return _selectedControle; + } + set + { + _selectedControle = value; + if (value != null) + { + base.EnableButtons = ((DomainBase)value).Id > 0; + base.EnableIncluir = ((DomainBase)value).Id > 0; + IsVisibleTerceiro = (Visibility)((value.Sinistros == null || (value.Sinistros != null && value.Sinistros.Count < 2)) ? 2 : 0); + IsVisibleIncluir = (Visibility)((value.Sinistros != null && value.Sinistros.Any()) ? 2 : 0); + int mostrarLista; + if (!MostrarLista) + { + List controles = Controles; + mostrarLista = ((controles != null && controles.Count > 1) ? 1 : 0); + } + else + { + mostrarLista = 1; + } + MostrarLista = (byte)mostrarLista != 0; + } + OnPropertyChanged("SelectedControle"); + } + } + + public Sinistro SelectedSinistro + { + get + { + return _selectedSinistro; + } + set + { + //IL_0186: Unknown result type (might be due to invalid IL or missing references) + //IL_008d: Unknown result type (might be due to invalid IL or missing references) + //IL_0093: Invalid comparison between Unknown and I4 + _selectedSinistro = value; + Anotacoes = string.Empty; + AnotacoesInternas = string.Empty; + HabilitarImprimirHistorico = value != null; + HabilitarEnviarHistorico = value != null; + CodigoSinistro = ((SelectedSinistro == null || ((DomainBase)SelectedSinistro).Id == 0L) ? "" : $"CÓDIGO SINISTRO {((DomainBase)SelectedSinistro).Id}"); + if (value != null && ((DomainBase)value).Id != 0L && (LastAccessId != ((DomainBase)value).Id || (int)LastAccessTela != 7)) + { + RegistrarAcao($"ACESSOU SINISTRO DE ID \"{((DomainBase)value).Id}\"", ((DomainBase)value).Id, (TipoTela)7, $"ID ITEM: {((DomainBase)value.ControleSinistro.Item).Id}\nID DOCUMENTO: {((DomainBase)value.ControleSinistro.Item.Documento).Id}\nRAMO: {value.ControleSinistro.Item.Documento.Controle.Ramo.Nome}\nCLIENTE: {value.ControleSinistro.Item.Documento.Controle.Cliente.Nome}\nID CLIENTE: {((DomainBase)value.ControleSinistro.Item.Documento.Controle.Cliente).Id}\nDESCRIÇÃO: \"{value.Descricao}\""); + LastAccessId = ((DomainBase)value).Id; + LastAccessTela = (TipoTela)7; + } + VerificarEnables((value != null) ? new long?(((DomainBase)value).Id) : null); + OnPropertyChanged("SelectedSinistro"); + } + } + + public string CodigoSinistro + { + get + { + return _codigoSinistro; + } + set + { + _codigoSinistro = value; + OnPropertyChanged("CodigoSinistro"); + } + } + + public new string Anotacoes + { + get + { + return _anotacoes; + } + set + { + _anotacoes = value; + OnPropertyChanged("Anotacoes"); + } + } + + public string AnotacoesInternas + { + get + { + return _anotacoesInternas; + } + set + { + _anotacoesInternas = value; + OnPropertyChanged("AnotacoesInternas"); + } + } + + public string TelefonesMecanica + { + get + { + return _telefonesMecanica; + } + set + { + _telefonesMecanica = value; + OnPropertyChanged("TelefonesMecanica"); + } + } + + public string TelefonesFunileiro + { + get + { + return _telefonesFunileiro; + } + set + { + _telefonesFunileiro = value; + OnPropertyChanged("TelefonesFunileiro"); + } + } + + public SinistroViewModel(Item item, bool attached) + { + //IL_008c: Unknown result type (might be due to invalid IL or missing references) + //IL_0096: Expected O, but got Unknown + //IL_00c9: Unknown result type (might be due to invalid IL or missing references) + //IL_00d0: Unknown result type (might be due to invalid IL or missing references) + //IL_00d7: Unknown result type (might be due to invalid IL or missing references) + //IL_00e4: Unknown result type (might be due to invalid IL or missing references) + //IL_00ee: Expected O, but got Unknown + //IL_0113: Unknown result type (might be due to invalid IL or missing references) + //IL_011d: Expected O, but got Unknown + _servico = new SinistroServico(); + _itemServico = new ItemServico(); + _clienteServico = new ClienteServico(); + _documentoSelecionado = (attached ? ConsultaViewModel.DocumentoSelecionado : item.Documento); + FiltroItens = ConsultaViewModel.FiltrarItens; + ItemSelecionado = ConsultaViewModel.ItemSelecionado; + if (!attached) + { + FiltroItens = 4; + ItemSelecionado = item; + } + if (((item != null) ? item.Documento : null) != null) + { + Documento documentoSelecionado = ConsultaViewModel.DocumentoSelecionado; + if (((documentoSelecionado != null) ? documentoSelecionado.VendedorPrincipal : null) != null) + { + item.Documento.VendedorPrincipal = ConsultaViewModel.DocumentoSelecionado.VendedorPrincipal; + } + } + Seleciona(item); + } + + public async void SelecionaItem(Item item) + { + if (Carregando) + { + return; + } + SelectedItem = item; + if (SelectedItem == null || Carregando) + { + return; + } + if (((DomainBase)item).Id != ((DomainBase)SelectedItem).Id) + { + SelectedItem = ((IEnumerable)ItensFiltrados).FirstOrDefault((Func)((Item x) => ((DomainBase)x).Id == ((DomainBase)item).Id)); + } + await SelecionaControles(item); + } + + public void SelecionaControle(ControleSinistro controle) + { + if (Carregando) + { + return; + } + SelectedControle = controle; + ControleSinistro selectedControle = SelectedControle; + ControleSinistro selectedControle2 = SelectedControle; + selectedControle.Sinistros = ((selectedControle2 == null) ? null : selectedControle2.Sinistros?.OrderBy((Sinistro x) => ((DomainBase)x).Id).ToList()); + if (Carregando) + { + return; + } + if (((DomainBase)controle).Id != ((DomainBase)SelectedControle).Id) + { + SelectedControle = controle; + } + ControleSinistro selectedControle3 = SelectedControle; + if (((selectedControle3 != null) ? selectedControle3.Sinistros : null) != null) + { + TipoSinistroEnabled = !SelectedControle.Sinistros.Any((Sinistro x) => x.TipoSinistro == (TipoSinistro?)0) || SelectedControle.Sinistros.Count <= 1; + } + } + + public void CarregarParceiros() + { + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Expected O, but got Unknown + List list = new List + { + new Parceiro + { + Nome = "NENHUM" + } + }; + list.AddRange(Recursos.Parceiros.OrderBy((Parceiro x) => x.Nome)); + Parceiros = new ObservableCollection(list); + } + + private static List GerarParceiros() + { + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Expected O, but got Unknown + List list = new List(); + list.Add(new Parceiro + { + Nome = "NENHUM" + }); + list.AddRange(Recursos.Parceiros.OrderBy((Parceiro x) => x.Nome)); + return list; + } + + public async Task IncluirSinistro() + { + if (SelectedItem == null) + { + await ShowMessage("NECESSÁRIO INCLUIR O ITEM ANTES DE INCLUIR UM SINISTRO."); + return; + } + DateTime now = Funcoes.GetNetworkTime(); + ControleSinistro controle = new ControleSinistro + { + DataSinistro = now, + Item = SelectedItem + }; + Cobertura val = ((IEnumerable)(await _itemServico.BuscarCoberturasPorItemAsync(((DomainBase)SelectedItem).Id))).FirstOrDefault((Func)((Cobertura x) => x.CoberturaPadrao != null && ((DomainBase)x.CoberturaPadrao).Id == 1)); + Sinistro val2 = new Sinistro + { + ControleSinistro = controle, + TipoSinistro = (TipoSinistro)0, + Ativo = true, + DataReclamacao = now, + StatusSinistro = (StatusSinistro)1, + ItemSinistrado = SelectedItem.Descricao, + ValorFranquia = ((val != null) ? val.Franquia : 0m) + }; + long id = ((DomainBase)_documentoSelecionado.Controle.Ramo).Id; + long num = id - 5; + if ((ulong)num <= 5uL) + { + switch (num) + { + case 0L: + goto IL_0215; + case 1L: + case 2L: + case 4L: + case 5L: + goto IL_022e; + case 3L: + goto IL_0239; + } + } + if (id == 37) + { + goto IL_0215; + } + if (id == 53) + { + goto IL_022e; + } + goto IL_0239; + IL_0215: + val2.SinistroAuto = new SinistroAuto + { + Culpado = false + }; + goto IL_0239; + IL_0239: + IsReadOnlyItem = true; + SelectedControle = controle; + SelectedSinistro = val2; + Alterar(alterar: true); + return; + IL_022e: + val2.SinistroVida = new SinistroVida(); + goto IL_0239; + } + + public async void IncluirEnvolvido() + { + Sinistro sinistro = new Sinistro + { + ControleSinistro = SelectedControle, + TipoSinistro = (TipoSinistro)1, + Ativo = true, + StatusSinistro = (StatusSinistro)1 + }; + long id = ((DomainBase)_documentoSelecionado.Controle.Ramo).Id; + long num = id - 5; + if ((ulong)num <= 5uL) + { + switch (num) + { + case 0L: + goto IL_0098; + case 1L: + case 2L: + case 4L: + case 5L: + goto IL_00aa; + case 3L: + goto IL_011e; + } + } + if (id == 37) + { + goto IL_0098; + } + if (id == 53) + { + goto IL_00aa; + } + goto IL_011e; + IL_00aa: + sinistro.SinistroVida = new SinistroVida(); + goto IL_011e; + IL_011e: + if (await ShowMessage("VOCÊ DESEJA COPIAR OS DADOS DO SINISTRADO PARA O TERCEIRO?", "SIM", "NÃO")) + { + sinistro.ItemSinistrado = SelectedItem.Descricao; + sinistro.Descricao = SelectedSinistro.Descricao; + sinistro.DataReclamacao = SelectedSinistro.DataReclamacao; + if (sinistro.SinistroAuto != null) + { + if (SelectedSinistro.SinistroAuto == null) + { + SelectedSinistro.SinistroAuto = new SinistroAuto(); + } + sinistro.SinistroAuto.Endereco = SelectedSinistro.SinistroAuto.Endereco; + } + } + else + { + sinistro.DataReclamacao = Funcoes.GetNetworkTime(); + } + IsReadOnlyItem = false; + SelectedSinistro = sinistro; + Alterar(alterar: true); + return; + IL_0098: + sinistro.SinistroAuto = new SinistroAuto(); + goto IL_011e; + } + + internal void ImprimirHistorico() + { + Vendedor vendedorPrincipal = _documentoSelecionado.VendedorPrincipal; + string value = GerarHtmlSinistro((vendedorPrincipal != null) ? vendedorPrincipal.Nome : null); + string tempPath = Path.GetTempPath(); + string text = $"{tempPath}{(object)(TipoTela)7}_{Funcoes.GetNetworkTime():ddMMyyyyhhmmss}.html"; + StreamWriter streamWriter = new StreamWriter(text, append: true, Encoding.UTF8); + streamWriter.Write(value); + streamWriter.Close(); + Process.Start(text); + } + + public string GerarHtmlSinistro(string vendedorPrincipal = "") + { + string text = " HISTÓRICO DO SINISTRO
"; + string text2 = ""; + foreach (Sinistro item in SelectedControle.Sinistros.OrderBy((Sinistro x) => x.TipoSinistro)) + { + text += "

"; + text2 = (string.IsNullOrEmpty(text2) ? "CLIENTE" : ("TERCEIRO Nº " + item.Numero)); + text = text + text2 + "

"; + text += "
"; + int num = 0; + if (text2 == "CLIENTE") + { + text = text + ""; + num = 1; + text = text + ""; + num = 0; + text = text + ""; + num = 1; + text = text + ""; + num = 0; + string text3 = ((!(item.ControleSinistro.Item.Documento.Vigencia2.GetValueOrDefault().ToString(new CultureInfo("pt-BR")) != "01/01/0001 00:00:00")) ? "NÃO POSSUI" : item.ControleSinistro.Item.Documento.Vigencia2?.ToShortDateString()); + text = text + ""; + num = 1; + vendedorPrincipal = ((item.ControleSinistro.Item.Documento.VendedorPrincipal == null) ? vendedorPrincipal : item.ControleSinistro.Item.Documento.VendedorPrincipal.Nome); + text = text + ""; + num = 0; + text = text + ""; + } + num = 1; + text = text + ""; + num = 0; + text = text + ""; + num = 1; + text = text + ""; + num = 0; + text = text + ""; + num = 1; + text = text + ""; + num = 0; + text = text + ""; + num = 1; + text = text + ""; + num = 0; + text = text + ""; + num = 1; + text = text + ""; + num = 0; + text = text + ""; + num = 1; + text = text + ""; + text += "
CLIENTE: " + item.ControleSinistro.Item.Documento.Controle.Cliente.Nome + "
DOCUMENTO DO SEGURADO: " + item.ControleSinistro.Item.Documento.Controle.Cliente.Documento + "
APÓLICE: " + item.ControleSinistro.Item.Documento.Apolice + "
VIGÊNCIA INICIAL: " + item.ControleSinistro.Item.Documento.Vigencia1.ToShortDateString() + "
VIGÊNCIA FINAL: " + text3 + "
VENDEDOR PRINCIPAL: " + vendedorPrincipal + "
SEGURADORA: " + item.ControleSinistro.Item.Documento.Controle.Seguradora.Nome + "
NÚMERO SINISTRO: " + item.Numero + "
DATA DO SINISTRO: " + item.ControleSinistro.DataSinistro?.ToShortDateString() + "
HORA DO SINISTRO: " + item.ControleSinistro.HoraSinistro?.ToShortTimeString() + "
DATA/HORA ABERTURA: " + item.DataReclamacao.ToString() + "
DATA LIQUIDAÇÃO: " + item.DataLiquidacao.ToString() + "
DESCRIÇÃO DO BEM SINISTRADO: " + item.ItemSinistrado + "
VALOR ORÇADO: " + item.ValorOrcado.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)) + "
VALOR LIBERADO: " + item.ValorLiberado.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)) + "
VALOR PAGO: " + item.ValorPago.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)) + "
VALOR FRANQUIA: " + item.ValorFranquia.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)) + "
SITUAÇÃO: " + ValidationHelper.GetDescription((Enum)(object)item.StatusSinistro) + "
"; + string text4; + object obj; + if (item.SinistroAuto != null) + { + text += "
"; + num = 0; + text = text + ""; + num = 1; + text = text + ""; + num = 0; + text4 = text; + if (""; + goto IL_08f0; + } + } + obj = "NÃO"; + goto IL_08f0; + } + goto IL_14d5; + IL_14d5: + if (item.SinistroVida != null) + { + text += "
NÚMERO B.O.: " + item.SinistroAuto.NumeroBo + "
TIPO PERDA: " + ValidationHelper.GetDescription((Enum)(object)item.SinistroAuto.TipoPerda) + "
CONSIDERA-SE CULPADO? " + item.SinistroAuto.Culpado != null) + { + SinistroAuto sinistroAuto = item.SinistroAuto; + if (sinistroAuto == null || sinistroAuto.Culpado != false) + { + obj = "SIM
"; + num = 1; + text = text + ""; + num = 0; + text = text + ""; + num = 1; + text = text + ""; + num = 0; + text = text + ""; + num = 1; + text = text + ""; + text += "
TIPO PERDA: " + ValidationHelper.GetDescription((Enum)(object)item.SinistroVida.TipoPerda) + "
AUXÍLIO FUNERAL: " + ((item.SinistroVida.AuxFuneral.HasValue && item.SinistroVida.AuxFuneral.Value) ? "SIM" : "NÃO") + "
ESTADO CIVIL: " + ValidationHelper.GetDescription((Enum)(object)item.SinistroVida.EstadoCivil) + "
CERTIDÃO DE ÓBITO: " + item.SinistroVida.CertObito + "
BENEFICIÁRIO: " + item.SinistroVida.Beneficiario + "
"; + } + if (!string.IsNullOrWhiteSpace(item.Descricao)) + { + text += "
"; + text += "

DESCRIÇÃO

"; + text += "
"; + text = text + "
" + item.Descricao + "
"; + } + if (!string.IsNullOrWhiteSpace(item.Observacao)) + { + text += "
"; + text += "

HISTÓRICO

"; + text += "
"; + text = text + "
" + item.Observacao.Replace("", "").Replace("", "") + "
"; + } + continue; + IL_08f0: + text = text4 + (string?)obj; + num = 1; + text = text + "ÚLTIMO DOC. ENVIADO: " + $"{item.SinistroAuto.UltimoDocEnviado:dd/MM/yyyy}" + ""; + num = 0; + text = text + "ENDEREÇO: " + item.SinistroAuto.Endereco + ""; + num = 1; + text = text + "ENVOLVIDO/PROPRIETÁRIO: " + item.SinistroAuto.Envolvido + ""; + num = 0; + text = text + "MOTORISTA: " + item.SinistroAuto.Motorista + ""; + num = 1; + text = text + "TELEFONE: (" + item.SinistroAuto.Ddd + ") " + item.SinistroAuto.Telefone + ""; + num = 0; + text = text + "E-MAIL: " + item.SinistroAuto.Email + ""; + text += "
"; + text += "
"; + num = 1; + string text5 = ((item.SinistroAuto.ParceiroMecanica != null) ? item.SinistroAuto.ParceiroMecanica.Nome : ""); + text = text + ""; + num = 0; + string text6 = ((item.SinistroAuto.ParceiroMecanica == null || (string.IsNullOrEmpty(item.SinistroAuto.ParceiroMecanica.Ddd1) && string.IsNullOrEmpty(item.SinistroAuto.ParceiroMecanica.Telefone1))) ? "" : ("(" + item.SinistroAuto.ParceiroMecanica.Ddd1 + ") " + item.SinistroAuto.ParceiroMecanica.Telefone1)); + string text7 = ((item.SinistroAuto.ParceiroMecanica == null || (string.IsNullOrEmpty(item.SinistroAuto.ParceiroMecanica.Ddd2) && string.IsNullOrEmpty(item.SinistroAuto.ParceiroMecanica.Telefone2))) ? "" : (" / (" + item.SinistroAuto.ParceiroMecanica.Ddd2 + ") " + item.SinistroAuto.ParceiroMecanica.Telefone2)); + string text8 = ((item.SinistroAuto.ParceiroMecanica == null || (string.IsNullOrEmpty(item.SinistroAuto.ParceiroMecanica.Ddd3) && string.IsNullOrEmpty(item.SinistroAuto.ParceiroMecanica.Telefone3))) ? "" : (" / (" + item.SinistroAuto.ParceiroMecanica.Ddd3 + ") " + item.SinistroAuto.ParceiroMecanica.Telefone3)); + text = text + ""; + num = 1; + string text9 = ((item.SinistroAuto.ParceiroMecanica == null) ? "" : item.SinistroAuto.ParceiroMecanica.Email); + text = text + ""; + num = 0; + string text10 = ((item.SinistroAuto.ParceiroMecanica == null || string.IsNullOrEmpty(item.SinistroAuto.ParceiroMecanica.Endereco)) ? "" : (item.SinistroAuto.ParceiroMecanica.Endereco ?? "")); + string text11 = ((item.SinistroAuto.ParceiroMecanica == null || string.IsNullOrEmpty(item.SinistroAuto.ParceiroMecanica.Numero)) ? "" : (", " + item.SinistroAuto.ParceiroMecanica.Numero)); + string text12 = ((item.SinistroAuto.ParceiroMecanica == null || string.IsNullOrEmpty(item.SinistroAuto.ParceiroMecanica.Complemento)) ? "" : (", " + item.SinistroAuto.ParceiroMecanica.Complemento)); + string text13 = ((item.SinistroAuto.ParceiroMecanica == null || string.IsNullOrEmpty(item.SinistroAuto.ParceiroMecanica.Bairro)) ? "" : (", " + item.SinistroAuto.ParceiroMecanica.Bairro)); + string text14 = ((item.SinistroAuto.ParceiroMecanica == null || string.IsNullOrEmpty(item.SinistroAuto.ParceiroMecanica.Cidade)) ? "" : (" - " + item.SinistroAuto.ParceiroMecanica.Cidade)); + string text15 = ((item.SinistroAuto.ParceiroMecanica == null || string.IsNullOrEmpty(item.SinistroAuto.ParceiroMecanica.Uf)) ? "" : (" - " + item.SinistroAuto.ParceiroMecanica.Uf)); + string text16 = ((item.SinistroAuto.ParceiroMecanica == null || string.IsNullOrEmpty(item.SinistroAuto.ParceiroMecanica.Cep)) ? "" : (" - " + item.SinistroAuto.ParceiroMecanica.Cep)); + text = text + ""; + text += "
PARCEIRO MECÂNICA: " + text5 + "
CONTATOS: " + text6 + text7 + text8 + "
EMAIL: " + text9 + "
ENDEREÇO: " + text10 + text11 + text12 + text13 + text14 + text15 + text16 + "
"; + text += "
"; + num = 1; + text5 = ((item.SinistroAuto.ParceiroFunilaria != null) ? item.SinistroAuto.ParceiroFunilaria.Nome : ""); + text = text + ""; + num = 0; + text6 = ((item.SinistroAuto.ParceiroFunilaria == null || (string.IsNullOrEmpty(item.SinistroAuto.ParceiroFunilaria.Ddd1) && string.IsNullOrEmpty(item.SinistroAuto.ParceiroFunilaria.Telefone1))) ? "" : ("(" + item.SinistroAuto.ParceiroFunilaria.Ddd1 + ") " + item.SinistroAuto.ParceiroFunilaria.Telefone1)); + text7 = ((item.SinistroAuto.ParceiroFunilaria == null || (string.IsNullOrEmpty(item.SinistroAuto.ParceiroFunilaria.Ddd2) && string.IsNullOrEmpty(item.SinistroAuto.ParceiroFunilaria.Telefone2))) ? "" : (" / (" + item.SinistroAuto.ParceiroFunilaria.Ddd2 + ") " + item.SinistroAuto.ParceiroFunilaria.Telefone2)); + text8 = ((item.SinistroAuto.ParceiroFunilaria == null || (string.IsNullOrEmpty(item.SinistroAuto.ParceiroFunilaria.Ddd3) && string.IsNullOrEmpty(item.SinistroAuto.ParceiroFunilaria.Telefone3))) ? "" : (" / (" + item.SinistroAuto.ParceiroFunilaria.Ddd3 + ") " + item.SinistroAuto.ParceiroFunilaria.Telefone3)); + text = text + ""; + num = 1; + text9 = ((item.SinistroAuto.ParceiroFunilaria == null) ? "" : item.SinistroAuto.ParceiroFunilaria.Email); + text = text + ""; + num = 0; + text10 = ((item.SinistroAuto.ParceiroFunilaria == null || string.IsNullOrEmpty(item.SinistroAuto.ParceiroFunilaria.Endereco)) ? "" : (item.SinistroAuto.ParceiroFunilaria.Endereco ?? "")); + text11 = ((item.SinistroAuto.ParceiroFunilaria == null || string.IsNullOrEmpty(item.SinistroAuto.ParceiroFunilaria.Numero)) ? "" : (", " + item.SinistroAuto.ParceiroFunilaria.Numero)); + text12 = ((item.SinistroAuto.ParceiroFunilaria == null || string.IsNullOrEmpty(item.SinistroAuto.ParceiroFunilaria.Complemento)) ? "" : (", " + item.SinistroAuto.ParceiroFunilaria.Complemento)); + text13 = ((item.SinistroAuto.ParceiroFunilaria == null || string.IsNullOrEmpty(item.SinistroAuto.ParceiroFunilaria.Bairro)) ? "" : (", " + item.SinistroAuto.ParceiroFunilaria.Bairro)); + text14 = ((item.SinistroAuto.ParceiroFunilaria == null || string.IsNullOrEmpty(item.SinistroAuto.ParceiroFunilaria.Cidade)) ? "" : (" - " + item.SinistroAuto.ParceiroFunilaria.Cidade)); + text15 = ((item.SinistroAuto.ParceiroFunilaria == null || string.IsNullOrEmpty(item.SinistroAuto.ParceiroFunilaria.Uf)) ? "" : (" - " + item.SinistroAuto.ParceiroFunilaria.Uf)); + text16 = ((item.SinistroAuto.ParceiroFunilaria == null || string.IsNullOrEmpty(item.SinistroAuto.ParceiroFunilaria.Cep)) ? "" : (" - " + item.SinistroAuto.ParceiroFunilaria.Cep)); + text = text + ""; + text += "
PARCEIRO FUNILARIA: " + text5 + "
CONTATOS: " + text6 + text7 + text8 + "
EMAIL: " + text9 + "
ENDEREÇO: " + text10 + text11 + text12 + text13 + text14 + text15 + text16 + "
"; + goto IL_14d5; + } + return text + ""; + } + + public async void CancelarAlteracao() + { + Loading(isLoading: true); + ControleSinistro selectedControle = SelectedControle; + long controle = ((selectedControle != null) ? ((DomainBase)selectedControle).Id : 0); + Sinistro selectedSinistro = SelectedSinistro; + long sinistro = ((selectedSinistro != null) ? ((DomainBase)selectedSinistro).Id : 0); + await CarregarControles(SelectedItem); + Anotacoes = string.Empty; + AnotacoesInternas = string.Empty; + SelectedControle = ((IEnumerable)ControlesFiltrados).FirstOrDefault((Func)((ControleSinistro x) => ((DomainBase)x).Id == controle)) ?? ControlesFiltrados.FirstOrDefault(); + SinistroViewModel sinistroViewModel = this; + object obj; + if (SelectedControle == null) + { + obj = null; + } + else + { + ControleSinistro selectedControle2 = SelectedControle; + obj = ((selectedControle2 == null) ? null : selectedControle2.Sinistros?.FirstOrDefault((Func)((Sinistro x) => ((DomainBase)x).Id == sinistro))); + if (obj == null) + { + ControleSinistro selectedControle3 = SelectedControle; + obj = ((selectedControle3 == null) ? null : selectedControle3.Sinistros?.FirstOrDefault()); + } + } + sinistroViewModel.SelectedSinistro = (Sinistro)obj; + Alterar(alterar: false); + SinistroViewModel sinistroViewModel2 = this; + Sinistro selectedSinistro2 = SelectedSinistro; + sinistroViewModel2.VerificarEnables((selectedSinistro2 != null) ? new long?(((DomainBase)selectedSinistro2).Id) : null); + Loading(isLoading: false); + } + + public async void Excluir() + { + if (SelectedSinistro == null || ((DomainBase)SelectedSinistro).Id == 0L || !(await ShowMessage("DESEJA EXCLUIR?", "SIM", "NÃO"))) + { + return; + } + Loading(isLoading: true); + RegistrarAcao($"EXCLUIU SINISTRO DE ID \"{((DomainBase)SelectedSinistro).Id}\"", ((DomainBase)SelectedSinistro).Id, (TipoTela)7, $"ID ITEM: {((DomainBase)SelectedSinistro.ControleSinistro.Item).Id}\nID DOCUMENTO: {((DomainBase)SelectedSinistro.ControleSinistro.Item.Documento).Id}\nRAMO: {SelectedSinistro.ControleSinistro.Item.Documento.Controle.Ramo.Nome}\nCLIENTE: {SelectedSinistro.ControleSinistro.Item.Documento.Controle.Cliente.Nome}\nID CLIENTE: {((DomainBase)SelectedSinistro.ControleSinistro.Item.Documento.Controle.Cliente).Id}\nDESCRIÇÃO: {((DomainBase)SelectedSinistro).Id}"); + if (SelectedControle.Sinistros.Count == 1) + { + List controles = Controles; + controles.Remove(SelectedControle); + if (!(await _servico.DeleteControle(SelectedControle, controles == null || controles.Count == 0))) + { + return; + } + int num = ControlesFiltrados.IndexOf(SelectedControle); + Controles.Remove(SelectedControle); + ControlesFiltrados.Remove(SelectedControle); + ControlesFiltrados = new ObservableCollection(ControlesFiltrados); + if (ControlesFiltrados.Count > 0) + { + SelectedControle = ((num < ControlesFiltrados.Count) ? ControlesFiltrados.ElementAt(((num == 0) ? 1 : num) - 1) : ControlesFiltrados.Last()); + } + else + { + SelectedControle = new ControleSinistro(); + Alterar(alterar: false); + base.EnableMenu = false; + } + SinistroViewModel sinistroViewModel = this; + ControleSinistro selectedControle = SelectedControle; + sinistroViewModel.SelectedSinistro = ((selectedControle == null) ? null : selectedControle.Sinistros?.FirstOrDefault()); + } + else + { + if (!(await _servico.Delete(SelectedSinistro))) + { + return; + } + int num2 = SelectedControle.Sinistros.IndexOf(SelectedSinistro); + SelectedControle.Sinistros.Remove(SelectedSinistro); + long id = ((DomainBase)SelectedControle).Id; + SelectedControle = null; + SelectedControle = ControlesFiltrados.First((ControleSinistro x) => ((DomainBase)x).Id == id); + SelectedSinistro = ((num2 < SelectedControle.Sinistros.Count) ? SelectedControle.Sinistros.ElementAt(num2) : SelectedControle.Sinistros.Last()); + } + if (Controles == null || Controles.Count == 0) + { + ItemServico itemServico = new ItemServico(); + Item val = await itemServico.BuscarItemPorIdAsync(((DomainBase)SelectedItem).Id); + val.Sinistrado = false; + await itemServico.Save(val); + } + if (ItensFiltrados.Count > 0 && ItensFiltrados != null) + { + Item obj = ItensFiltrados.First((Item x) => ((DomainBase)x).Id == ((DomainBase)SelectedItem).Id); + ControleSinistro selectedControle2 = SelectedControle; + obj.Sinistrado = selectedControle2 != null && selectedControle2.Sinistros?.Count > 0; + } + ItensFiltrados = new ObservableCollection(ItensFiltrados); + Loading(isLoading: false); + ToggleSnackBar("SINISTRO EXCLUÍDO COM SUCESSO"); + } + + public async Task>> Salvar() + { + List> list = SelectedSinistro.Validate(); + if (list.Count > 0) + { + return list; + } + Sinistro sinistro = SelectedSinistro; + if (sinistro.SinistroAuto != null) + { + Parceiro parceiroFunilaria = sinistro.SinistroAuto.ParceiroFunilaria; + if (parceiroFunilaria != null && ((DomainBase)parceiroFunilaria).Id == 0) + { + sinistro.SinistroAuto.ParceiroFunilaria = null; + } + Parceiro parceiroMecanica = sinistro.SinistroAuto.ParceiroMecanica; + if (parceiroMecanica != null && ((DomainBase)parceiroMecanica).Id == 0) + { + sinistro.SinistroAuto.ParceiroMecanica = null; + } + } + DateTime networkTime = Funcoes.GetNetworkTime(); + if (!string.IsNullOrWhiteSpace(Anotacoes) && !Anotacoes.IsEmpty()) + { + sinistro.Observacao = $"

{Recursos.Usuario.Nome}, ID: {((DomainBase)Recursos.Usuario).Id}, {networkTime:g}
{Anotacoes}



{sinistro.Observacao}"; + } + if (!string.IsNullOrWhiteSpace(AnotacoesInternas) && !AnotacoesInternas.IsEmpty()) + { + sinistro.ObservacaoInterna = $"

{Recursos.Usuario.Nome}, ID: {((DomainBase)Recursos.Usuario).Id}, {networkTime:g}
{AnotacoesInternas}



{sinistro.ObservacaoInterna}"; + } + if (((DomainBase)sinistro).Id == 0L) + { + sinistro.DataCriacao = DateTime.Now; + sinistro.IdUsuarioCriacao = ((DomainBase)Recursos.Usuario).Id; + } + else + { + sinistro.DataAlteracao = DateTime.Now; + sinistro.IdUsuarioAlteracao = ((DomainBase)Recursos.Usuario).Id; + } + string acao = ((((DomainBase)sinistro).Id == 0L) ? "INCLUIU" : "ALTEROU"); + sinistro = await _servico.Save(sinistro, ((DomainBase)_documentoSelecionado.Controle.Ramo).Id); + if (!_servico.Sucesso) + { + return null; + } + await CarregarControles(sinistro.ControleSinistro.Item); + SelectedControle = ControlesFiltrados.First((ControleSinistro x) => ((DomainBase)x).Id == ((DomainBase)sinistro.ControleSinistro).Id); + SelectedSinistro = SelectedControle.Sinistros.First((Sinistro x) => ((DomainBase)x).Id == ((DomainBase)sinistro).Id); + Recursos.Parceiros = Parceiros.ToList(); + Alterar(alterar: false); + ToggleSnackBar("SINISTRO SALVO COM SUCESSO"); + RegistrarAcao($"{acao} SINISTRO DE ID \"{((DomainBase)sinistro).Id}\"", ((DomainBase)sinistro).Id, (TipoTela)7, $"ID ITEM: {((DomainBase)sinistro.ControleSinistro.Item).Id}\nID DOCUMENTO: {((DomainBase)sinistro.ControleSinistro.Item.Documento).Id}\nRAMO: {sinistro.ControleSinistro.Item.Documento.Controle.Ramo.Nome}\nCLIENTE: {sinistro.ControleSinistro.Item.Documento.Controle.Cliente.Nome}\nID CLIENTE: {((DomainBase)sinistro.ControleSinistro.Item.Documento.Controle.Cliente).Id}\nDESCRIÇÃO: \"{sinistro.Descricao}\""); + return null; + } + + public async void Seleciona(Item item) + { + Loading(isLoading: true); + await PermissaoTela((TipoTela)7); + SelectedItem = ItemSelecionado; + VisibilityAuto = (Visibility)((((DomainBase)_documentoSelecionado.Controle.Ramo).Id != 5) ? 2 : 0); + VisibilityVida = (Visibility)((((DomainBase)_documentoSelecionado.Controle.Ramo).Id != 6) ? 2 : 0); + if (item == null) + { + Loading(isLoading: false); + return; + } + await SelecionaControles(item); + Loading(isLoading: false); + } + + public async Task SelecionaItens(int type, Item item = null) + { + Loading(isLoading: true); + Carregando = true; + switch (type) + { + default: + Itens = await _itemServico.BuscarItens(((DomainBase)_documentoSelecionado.Controle).Id, (StatusItem)0); + break; + case 1: + case 2: + Itens = await _itemServico.BuscarItens(((DomainBase)_documentoSelecionado).Id, (StatusItem)2); + break; + case 3: + Itens = await _itemServico.BuscarItens(((DomainBase)_documentoSelecionado.Controle).Id, (StatusItem)1); + break; + case 4: + Itens = await _itemServico.BuscarItens(((DomainBase)_documentoSelecionado.Controle).Id, (StatusItem)3); + break; + } + ItensFiltrados = Itens; + if (item != null && ((DomainBase)item).Id > 0) + { + SelectedItem = ((ItensFiltrados != null && ItensFiltrados.Count > 0) ? ((IEnumerable)ItensFiltrados).FirstOrDefault((Func)((Item x) => ((DomainBase)x).Id == ((DomainBase)item).Id)) : null); + } + SinistroViewModel sinistroViewModel = this; + int mostrarLista; + if (!MostrarLista) + { + ObservableCollection itens = Itens; + mostrarLista = ((itens != null && itens.Count > 1) ? 1 : 0); + } + else + { + mostrarLista = 1; + } + sinistroViewModel.MostrarLista = (byte)mostrarLista != 0; + Carregando = false; + Loading(isLoading: false); + } + + public async Task SelecionaControles(Item item) + { + Loading(isLoading: true); + await CarregarControles(item); + if (ControlesFiltrados.Count > 0) + { + SelectedControle = ControlesFiltrados.FirstOrDefault(); + } + else + { + SelectedControle = new ControleSinistro(); + Alterar(alterar: false); + } + SinistroViewModel sinistroViewModel = this; + ControleSinistro selectedControle = SelectedControle; + sinistroViewModel.SelectedSinistro = ((selectedControle == null) ? null : selectedControle.Sinistros?.FirstOrDefault()); + Loading(isLoading: false); + } + + private async Task CarregarControles(Item item) + { + Controles = (await _servico.BuscarControles(((DomainBase)item).Id)).OrderByDescending((ControleSinistro x) => x.DataSinistro).ToList(); + ControlesFiltrados = new ObservableCollection(Controles); + } + + internal async Task> SinistroFiltrar(string value) + { + return await Task.Run(() => FiltrarSinistro(value)); + } + + public List FiltrarSinistro(string filter) + { + ControlesFiltrados = (string.IsNullOrWhiteSpace(filter) ? new ObservableCollection(Controles) : new ObservableCollection(from x in Controles + where ValidationHelper.RemoveDiacritics(x.DataSinistro.ToString().Trim()).Contains(filter) || (x.Sinistros != null && x.Sinistros.Count > 0 && ValidationHelper.RemoveDiacritics(x.Sinistros[0].Numero.Trim()).Contains(filter)) + orderby x.DataSinistro + select x)); + SelectedControle = ((ControlesFiltrados.Count > 0) ? ControlesFiltrados.First() : null); + return ControlesFiltrados.ToList(); + } + + internal async Task> ItemFiltrar(string value) + { + return await Task.Run(() => FiltrarItem(value)); + } + + public List FiltrarItem(string filter) + { + ItensFiltrados = (string.IsNullOrWhiteSpace(filter) ? Itens : new ObservableCollection(from x in Itens + where ValidationHelper.RemoveDiacritics(x.Descricao.Trim()).ToUpper().Contains(ValidationHelper.RemoveDiacritics(filter)) + orderby x.Ordem + select x)); + return ItensFiltrados.ToList(); + } + + public async Task BuscarClienteSinistro() + { + return await _itemServico.BuscarCliente(((DomainBase)SelectedItem).Id); + } + + public async void EnviarLogEmail() + { + List list = Credenciais; + if (list == null) + { + list = await new BaseServico().BuscarCredenciais(); + } + Credenciais = list; + SelectedCredencial = ((IEnumerable)Credenciais).FirstOrDefault((Func)((Credencial x) => x.IdUsuario == ((DomainBase)Recursos.Usuario).Id)) ?? Credenciais.FirstOrDefault(); + ObservableCollection mails = await _clienteServico.BuscarEmailsAsync(((DomainBase)SelectedSinistro.ControleSinistro.Item.Documento.Controle.Cliente).Id); + if (mails.Count == 0) + { + await ShowMessage("O CLIENTE NÃO POSSUI NENHUM E-MAIL CADASTRADO"); + return; + } + Documento val = await new ApoliceServico().BuscarApoliceAsync(((DomainBase)_documentoSelecionado).Id); + SinistroViewModel sinistroViewModel = this; + Vendedor vendedorPrincipal = val.VendedorPrincipal; + string text = sinistroViewModel.GerarHtmlSinistro((vendedorPrincipal != null) ? vendedorPrincipal.Nome : null); + string input = new Regex(".*<\\/title>").Replace(text, " ").Trim(); + input = new Regex("(<[^>]*>)|(p\\s?{[^}]*})|(\\r)|(\\n)").Replace(input, " ").Trim(); + input = input.Replace("@page{ size: A4;} body; -webkit-print-color-adjust: exact; }", " "); + input.Replace("NEW P { MARGIN-BOTTOM: 0; MARGIN-TOP: 0; }", " "); + MalaDireta val2 = new MalaDireta + { + Cliente = val.Controle.Cliente, + ArquivoDigital = null, + Sinistro = SelectedSinistro, + Item = SelectedItem, + Apolice = val, + Tela = (TipoTela)7 + }; + ClienteEmail? obj = mails.FirstOrDefault(); + val2.Email = ((obj != null) ? ((EmailBase)obj).Email : null); + ClienteEmail? obj2 = mails.FirstOrDefault(); + val2.Ordem = ((obj2 != null) ? obj2.Ordem : null).GetValueOrDefault(); + MalaDireta item = val2; + if (Funcoes.IsWindowOpen<HosterWindow>("ENVIO DE E-MAIL")) + { + Funcoes.Destroy<HosterWindow>("ENVIO DE E-MAIL"); + } + ((Window)new HosterWindow((ContentControl)(object)new MalaDiretaView(new List<MalaDireta> { item }, "HISTÓRICO DO SINISTRO DO ITEM " + SelectedItem.Descricao, text), "ENVIO DE E-MAIL", 1200.0, 600.0, canMaximize: true)).ShowDialog(); + } + + public void AbrirInfo() + { + ShowDrawer(new InfoDrawer(_documentoSelecionado), 0, close: false); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels.Seguros/TrocarClienteViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Seguros/TrocarClienteViewModel.cs new file mode 100644 index 0000000..2384db1 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Seguros/TrocarClienteViewModel.cs @@ -0,0 +1,75 @@ +using System.Threading.Tasks; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Seguros; + +public class TrocarClienteViewModel : BaseSegurosViewModel +{ + private readonly ApoliceServico _apoliceServico; + + private readonly ClienteServico _clienteServico; + + private Documento _selectedDocumento; + + private Cliente _selectedCliente; + + public Documento SelectedDocumento + { + get + { + return _selectedDocumento; + } + set + { + OnPropertyChanged("SelectedDocumento"); + _selectedDocumento = value; + } + } + + public Cliente SelectedCliente + { + get + { + return _selectedCliente; + } + set + { + OnPropertyChanged("SelectedCliente"); + _selectedCliente = value; + } + } + + public TrocarClienteViewModel() + { + _apoliceServico = new ApoliceServico(); + _clienteServico = new ClienteServico(); + } + + public async Task<bool> Salvar() + { + if (SelectedCliente == null) + { + return false; + } + if (((DomainBase)SelectedCliente).Id == ((DomainBase)SelectedDocumento.Controle.Cliente).Id) + { + return false; + } + Cliente clienteantigo = await _clienteServico.BuscarCliente(((DomainBase)SelectedDocumento.Controle.Cliente).Id); + Documento documento = SelectedDocumento; + _apoliceServico.Sucesso = true; + await _apoliceServico.Save(documento.Controle, SelectedCliente); + if (!_apoliceServico.Sucesso) + { + return false; + } + RegistrarAcao($"TROCOU O CLIENTE DO DOCUMENTO DE ID {((DomainBase)SelectedDocumento).Id}", ((DomainBase)SelectedDocumento).Id, (TipoTela)41, $"CLIENTE ANTIGO: {clienteantigo.Nome}\nNOVO CLIENTE: {SelectedCliente.Nome} ({((DomainBase)SelectedCliente).Id})"); + SelectedCliente = documento.Controle.Cliente; + SelectedDocumento = documento; + return true; + } +} diff --git a/Decompiler/Gestor.Application.ViewModels/AnaliticoViewModel.cs b/Decompiler/Gestor.Application.ViewModels/AnaliticoViewModel.cs new file mode 100644 index 0000000..da3773b --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels/AnaliticoViewModel.cs @@ -0,0 +1,172 @@ +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using System.Windows.Controls; +using System.Windows.Data; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Common; +using Gestor.Model.Domain.BI; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Relatorios; + +namespace Gestor.Application.ViewModels; + +internal class AnaliticoViewModel : BaseSegurosViewModel +{ + private string _head; + + public TipoTela Tela { get; set; } = (TipoTela)1; + + + public string Tipo { get; set; } + + public string Head + { + get + { + return _head; + } + set + { + _head = value; + OnPropertyChanged("Head"); + } + } + + public AnaliticoViewModel(string tipo) + { + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + Tipo = tipo; + string tipo2 = Tipo; + if (!(tipo2 == "PARCELAS")) + { + if (!(tipo2 == "APOLICES")) + { + Tela = (TipoTela)1; + } + else + { + Tela = (TipoTela)2; + } + } + else + { + Tela = (TipoTela)5; + } + } + + public async Task Save(List<Tarefa> tarefas) + { + await new TarefaServico().Salvar(tarefas); + } + + public async Task<Trilha> Salvar(Trilha destino) + { + List<Fase> fases2 = destino.Fases; + TarefaServico servico = new TarefaServico(); + Trilha trilha = await servico.Salvar(destino); + if (!servico.Sucesso) + { + return null; + } + fases2.ForEach(delegate(Fase x) + { + x.Trilha = trilha; + }); + fases2 = await servico.Salvar(fases2); + if (!servico.Sucesso) + { + return null; + } + trilha.Fases = fases2; + return trilha; + } + + public async Task<List<Analitico>> Validar(List<Analitico> analitico, Trilha trilha) + { + TarefaServico tarefaServico = new TarefaServico(); + List<long> ids; + switch (Tipo) + { + case "CLIENTES": + ids = analitico.Select((Analitico x) => x.Cliente.Id).ToList(); + break; + default: + ids = analitico.Select((Analitico x) => ((DomainBase)x.Documento).Id).ToList(); + break; + case "PARCELAS": + case "COMISSÃO": + ids = analitico.Select((Analitico x) => ((DomainBase)x.Parcela).Id).ToList(); + break; + } + List<long> excluirIds = await tarefaServico.Validar(ids, ((DomainBase)trilha).Id); + List<Analitico> second; + switch (Head) + { + case "CLIENTES": + second = analitico.Where((Analitico x) => excluirIds.Contains(x.Cliente.Id)).ToList(); + break; + default: + second = analitico.Where((Analitico x) => excluirIds.Contains(((DomainBase)x.Documento).Id)).ToList(); + break; + case "PARCELAS": + case "COMISSÃO": + second = analitico.Where((Analitico x) => excluirIds.Contains(((DomainBase)x.Parcela).Id)).ToList(); + break; + } + return analitico.Except(second).ToList(); + } + + private async Task<string> GerarHtml(DataGrid grid) + { + List<string> first = (from x in typeof(Analitico).GetProperties() + select x.Name).ToList(); + List<string> list = new List<string>(); + for (int i = 0; i < grid.Columns.Count; i++) + { + if (!(grid.Columns[i] is DataGridTemplateColumn)) + { + DataGridColumn obj = grid.Columns[i]; + BindingBase binding = ((DataGridBoundColumn)((obj is DataGridBoundColumn) ? obj : null)).Binding; + Binding val = (Binding)(object)((binding is Binding) ? binding : null); + list.Add(val.Path.Path); + } + } + List<string> colunasOcultas = first.Except(list).ToList(); + string text = Funcoes.CreateCard("", await Funcoes.GenerateTable((from Analitico x in (IEnumerable)((ItemsControl)grid).Items + where x.Selecionado + select x).ToList(), colunasOcultas, grafico: false, propertyName: true)); + return Funcoes.ExportarHtml(new TipoRelatorio + { + Nome = "ANALÍTICO - " + Head + }, text ?? ""); + } + + public async Task Print(DataGrid grid) + { + if (!((IEnumerable)((ItemsControl)grid).Items).Cast<Analitico>().Any((Analitico x) => x.Selecionado)) + { + await ShowMessage("É NECESSÁRIO SELECIONAR AO MENOS UM DOCUMENTO"); + return; + } + string value = await GerarHtml(grid); + if (!string.IsNullOrEmpty(value)) + { + string tempPath = Path.GetTempPath(); + string text = string.Format("{0}{1}_{2:ddMMyyyyhhmmss}.html", tempPath, new Regex("[" + Regex.Escape(new string(Path.GetInvalidFileNameChars()) + new string(Path.GetInvalidPathChars())) + "]").Replace(Head, ""), Funcoes.GetNetworkTime()); + StreamWriter streamWriter = new StreamWriter(text, append: true, Encoding.UTF8); + streamWriter.Write(value); + streamWriter.Close(); + Process.Start(text); + } + } +} diff --git a/Decompiler/Gestor.Application.ViewModels/Arquivo.cs b/Decompiler/Gestor.Application.ViewModels/Arquivo.cs new file mode 100644 index 0000000..9e73979 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels/Arquivo.cs @@ -0,0 +1,8 @@ +namespace Gestor.Application.ViewModels; + +public class Arquivo +{ + public string Nome { get; set; } + + public int Processo { get; set; } +} diff --git a/Decompiler/Gestor.Application.ViewModels/CoberturaViewModel.cs b/Decompiler/Gestor.Application.ViewModels/CoberturaViewModel.cs new file mode 100644 index 0000000..47f386d --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels/CoberturaViewModel.cs @@ -0,0 +1,179 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Seguros.Itens; +using Gestor.Application.ViewModels.Generic; +using Gestor.Application.ViewModels.Seguros; +using Gestor.Common.Validation; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels; + +public class CoberturaViewModel : BaseSegurosViewModel +{ + private readonly ItemServico _itemServico; + + private Cobertura _selectedCobertura = new Cobertura(); + + private List<CoberturaPadrao> _coberturasPadrao; + + private ObservableCollection<Cobertura> _coberturas; + + private readonly IComparer<Cobertura> _comparerCobertura = Comparer<Cobertura>.Create(delegate(Cobertura item1, Cobertura item2) + { + if (((DomainBase)item1).Id > ((DomainBase)item2).Id) + { + return 1; + } + return (((DomainBase)item1).Id < ((DomainBase)item2).Id) ? (-1) : 0; + }); + + public Item Item { get; set; } + + public Ramo Ramo { get; set; } + + public Cobertura SelectedCobertura + { + get + { + return _selectedCobertura; + } + set + { + _selectedCobertura = value; + OnPropertyChanged("SelectedCobertura"); + } + } + + public List<CoberturaPadrao> CoberturasPadrao + { + get + { + return _coberturasPadrao; + } + set + { + _coberturasPadrao = value; + OnPropertyChanged("CoberturasPadrao"); + } + } + + public ObservableCollection<Cobertura> Coberturas + { + get + { + return _coberturas; + } + set + { + _coberturas = value; + OnPropertyChanged("Coberturas"); + } + } + + public CoberturaViewModel(Ramo ramo = null, Item item = null) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_000b: Expected O, but got Unknown + Item = item ?? ConsultaViewModel.ItemSelecionado; + object obj = ramo; + if (obj == null) + { + Documento documentoSelecionado = ConsultaViewModel.DocumentoSelecionado; + if (documentoSelecionado == null) + { + obj = null; + } + else + { + Controle controle = documentoSelecionado.Controle; + obj = ((controle != null) ? controle.Ramo : null); + } + } + Ramo = (Ramo)obj; + _itemServico = new ItemServico(); + } + + public async Task SelectionaCoberturas() + { + if (Ramo != null) + { + CoberturasPadrao = Recursos.Coberturas.Where((CoberturaPadrao x) => x.IdRamo == ((DomainBase)Ramo).Id).ToList(); + if (Item != null) + { + Coberturas = await _itemServico.BuscarCoberturasPorItemAsync(((DomainBase)Item).Id); + } + } + } + + internal async Task<List<CoberturaPadrao>> BuscarCobertura(string value) + { + return await Task.Run(() => CoberturasPadrao?.Where((CoberturaPadrao x) => ValidationHelper.RemoveDiacritics(x.Descricao.ToUpper().Trim()).Contains(value.ToUpper())).ToList()); + } + + public void AdicionaCobertura() + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Expected O, but got Unknown + Cobertura val = new Cobertura + { + Item = Item + }; + ValidationHelper.AddSorted<Cobertura>(Coberturas, val, _comparerCobertura); + SelectedCobertura = val; + } + + public async void ExcluirCobertura(Cobertura cobertura) + { + if (cobertura != null && await ShowMessage("DESEJA REALMENTE EXCLUIR A COBERTURA" + Environment.NewLine + "\"" + cobertura.Observacao + "\"?", "SIM", "NÃO")) + { + Coberturas.Remove(cobertura); + } + } + + public async Task<IList<Cobertura>> LimpaCoberturas() + { + bool flag = Coberturas != null && Coberturas.Any((Cobertura x) => x.Franquia == 0m && x.Lmi == 0m && x.Premio == 0m); + if (flag) + { + flag = await ShowMessage("DESEJA LIMPAR AS COBERTURAS SEM VALOR DE FRANQUIA, LMI E PRÊMIO?", "SIM", "NÃO"); + } + return (!flag) ? Coberturas?.ToList() : Coberturas?.Where((Cobertura x) => !string.IsNullOrEmpty(x.Observacao) && (x.Franquia != 0m || x.Lmi != 0m || x.Premio != 0m)).ToList(); + } + + public async Task CancelarAlteracao() + { + if (Item != null) + { + Coberturas = await _itemServico.BuscarCoberturasPorItemAsync(((DomainBase)Item).Id); + } + } + + public void CarregaPadrao() + { + List<Cobertura> list = CoberturasPadrao?.Where((CoberturaPadrao x) => x.Padrao).Select((Func<CoberturaPadrao, Cobertura>)((CoberturaPadrao x) => new Cobertura + { + CoberturaPadrao = x, + Observacao = x.Descricao + })).ToList(); + if (list != null) + { + Coberturas = new ObservableCollection<Cobertura>(list); + } + } + + public ObservableCollection<Cobertura> CarregaCoberturaPadrao() + { + List<Cobertura> list = CoberturasPadrao?.Where((CoberturaPadrao x) => x.Padrao).Select((Func<CoberturaPadrao, Cobertura>)((CoberturaPadrao x) => new Cobertura + { + CoberturaPadrao = x, + Observacao = x.Descricao + })).ToList(); + return Coberturas = new ObservableCollection<Cobertura>(list); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels/DashboardViewModel.cs b/Decompiler/Gestor.Application.ViewModels/DashboardViewModel.cs new file mode 100644 index 0000000..be683d2 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels/DashboardViewModel.cs @@ -0,0 +1,925 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Relatorios; +using Gestor.Model.Domain.Relatorios.ClientesAtivosInativos; +using Gestor.Model.Domain.Relatorios.Dashboard; +using Gestor.Model.Domain.Relatorios.Renovacao; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels; + +public class DashboardViewModel : BaseSegurosViewModel +{ + private readonly TarefaServico _servico; + + private readonly ApoliceServico _apoliceServico; + + private readonly ClienteServico _clienteServico; + + private readonly SinistroServico _sinitrosServico; + + private readonly TarefaServico _tarefaServico; + + private bool _renovacoesEnabled; + + private bool _tarefasEnabled; + + private bool _aniversariantesEnabled; + + private bool _sinistrosEnabled; + + private bool _prospeccoesEnabled; + + private bool _notasEnabled; + + private bool _publica; + + private string _quantidadeRenovacoes = "0"; + + private string _quantidadeAniversariantes = "0"; + + private string _quantidadeProspeccao = "0"; + + private string _quantidadeSinisto = "0"; + + private string _quantidadeTarefas = "0"; + + private List<string> _intervalo = new List<string> { "HOJE", "PRÓXIMOS 3 DIAS", "PRÓXIMOS 7 DIAS" }; + + private string _intervaloSelecionado = "HOJE"; + + private bool _isProspectar; + + private ObservableCollection<Tarefa> _notas; + + private ObservableCollection<ClienteTelefone> _telefones = new ObservableCollection<ClienteTelefone>(); + + private string _anotacoes = ""; + + private ObservableCollection<Prospectar> _prospeccoes; + + private ObservableCollection<ClientesAtivosInativos> _aniversariantes; + + private ObservableCollection<Sinistro> _sinistros; + + private ObservableCollection<Renovacao> _renovacaoFiltrado; + + private ObservableCollection<Tarefa> _tarefas = new ObservableCollection<Tarefa>(); + + private List<Ramo> _ramos; + + private Ramo _selectedRamo; + + private List<string> _referencias = new List<string> { "VENCIMENTO DA ÚLTIMA PARCELA", "VIGÊNCIA INICIAL", "VIGÊNCIA FINAL" }; + + private string _referencia = "VENCIMENTO DA ÚLTIMA PARCELA"; + + private int _selectedTile = 1; + + private string _labelProspeccao; + + private List<string> _filtroCliente = new List<string> { "AMBOS", "CNPJ", "CPF" }; + + private string _filtroClientes; + + public bool RenovacoesEnabled + { + get + { + return _renovacoesEnabled; + } + set + { + _renovacoesEnabled = value; + OnPropertyChanged("RenovacoesEnabled"); + } + } + + public bool TarefasEnabled + { + get + { + return _tarefasEnabled; + } + set + { + _tarefasEnabled = value; + OnPropertyChanged("TarefasEnabled"); + } + } + + public bool AniversariantesEnabled + { + get + { + return _aniversariantesEnabled; + } + set + { + _aniversariantesEnabled = value; + OnPropertyChanged("AniversariantesEnabled"); + } + } + + public bool SinistrosEnabled + { + get + { + return _sinistrosEnabled; + } + set + { + _sinistrosEnabled = value; + OnPropertyChanged("SinistrosEnabled"); + } + } + + public bool ProspeccoesEnabled + { + get + { + return _prospeccoesEnabled; + } + set + { + _prospeccoesEnabled = value; + OnPropertyChanged("ProspeccoesEnabled"); + } + } + + public bool NotasEnabled + { + get + { + return _notasEnabled; + } + set + { + _notasEnabled = value; + OnPropertyChanged("NotasEnabled"); + } + } + + public bool Load { get; set; } = true; + + + public int SelectedTile + { + get + { + return _selectedTile; + } + set + { + _selectedTile = value; + IsProspectar = value == 4 || value == 5; + } + } + + public bool Publica + { + get + { + return _publica; + } + set + { + _publica = value; + OnPropertyChanged("Publica"); + } + } + + public string QuantidadeRenovacoes + { + get + { + return _quantidadeRenovacoes; + } + set + { + _quantidadeRenovacoes = value; + OnPropertyChanged("QuantidadeRenovacoes"); + } + } + + public string QuantidadeAniversariantes + { + get + { + return _quantidadeAniversariantes; + } + set + { + _quantidadeAniversariantes = value; + OnPropertyChanged("QuantidadeAniversariantes"); + } + } + + public string QuantidadeProspeccao + { + get + { + return _quantidadeProspeccao; + } + set + { + _quantidadeProspeccao = value; + OnPropertyChanged("QuantidadeProspeccao"); + } + } + + public string QuantidadeSinistro + { + get + { + return _quantidadeSinisto; + } + set + { + _quantidadeSinisto = value; + OnPropertyChanged("QuantidadeSinistro"); + } + } + + public string QuantidadeTarefas + { + get + { + return _quantidadeTarefas; + } + set + { + _quantidadeTarefas = value; + OnPropertyChanged("QuantidadeTarefas"); + } + } + + public List<string> Intervalo + { + get + { + return _intervalo; + } + set + { + _intervalo = value; + OnPropertyChanged("Intervalo"); + } + } + + public string IntervaloSelecionado + { + get + { + return _intervaloSelecionado; + } + set + { + _intervaloSelecionado = value; + OnPropertyChanged("IntervaloSelecionado"); + } + } + + public bool IsProspectar + { + get + { + return _isProspectar; + } + set + { + _isProspectar = value; + OnPropertyChanged("IsProspectar"); + } + } + + public ObservableCollection<Tarefa> Notas + { + get + { + return _notas; + } + set + { + _notas = value; + OnPropertyChanged("Notas"); + } + } + + public ObservableCollection<ClienteTelefone> Telefones + { + get + { + return _telefones; + } + set + { + _telefones = value; + OnPropertyChanged("Telefones"); + } + } + + public new string Anotacoes + { + get + { + return _anotacoes; + } + set + { + _anotacoes = value; + OnPropertyChanged("Anotacoes"); + } + } + + public ObservableCollection<Prospectar> Prospeccoes + { + get + { + return _prospeccoes; + } + set + { + _prospeccoes = value; + OnPropertyChanged("Prospeccoes"); + } + } + + public List<RestricaoUsuario> Restricoes { get; set; } + + public List<PermissaoUsuario> Permissoes { get; set; } + + public ObservableCollection<ClientesAtivosInativos> Aniversariantes + { + get + { + return _aniversariantes; + } + set + { + _aniversariantes = value; + OnPropertyChanged("Aniversariantes"); + } + } + + public ObservableCollection<Sinistro> Sinistros + { + get + { + return _sinistros; + } + set + { + _sinistros = value; + OnPropertyChanged("Sinistros"); + } + } + + public Filtros Filtros { get; set; } + + private Filtros _filtroRenovacao { get; set; } + + private Filtros _filtroAniversariantes { get; set; } + + private Filtros _filtroTarefas { get; set; } + + private Filtros _filtroSinistros { get; set; } + + public ObservableCollection<Renovacao> RenovacaoFiltrado + { + get + { + return _renovacaoFiltrado; + } + set + { + _renovacaoFiltrado = value; + OnPropertyChanged("RenovacaoFiltrado"); + } + } + + public ObservableCollection<Tarefa> Tarefas + { + get + { + return _tarefas; + } + set + { + _tarefas = value; + OnPropertyChanged("Tarefas"); + } + } + + private Filtros _filtroProspectar { get; set; } + + public List<Ramo> Ramos + { + get + { + return _ramos; + } + set + { + _ramos = value; + OnPropertyChanged("Ramos"); + } + } + + public Ramo SelectedRamo + { + get + { + return _selectedRamo; + } + set + { + _selectedRamo = value; + OnPropertyChanged("SelectedRamo"); + } + } + + public List<string> Referencias + { + get + { + return _referencias; + } + set + { + _referencias = value; + OnPropertyChanged("Referencias"); + } + } + + public string Referencia + { + get + { + return _referencia; + } + set + { + _referencia = value; + OnPropertyChanged("Referencia"); + } + } + + public string LabelProspeccao + { + get + { + return _labelProspeccao; + } + set + { + _labelProspeccao = value; + OnPropertyChanged("LabelProspeccao"); + } + } + + public List<string> FiltroCliente + { + get + { + return _filtroCliente; + } + set + { + _filtroCliente = value; + OnPropertyChanged("FiltroCliente"); + } + } + + public string FiltroClientes + { + get + { + return _filtroClientes; + } + set + { + _filtroClientes = value; + OnPropertyChanged("FiltroClientes"); + } + } + + public DashboardViewModel() + { + _servico = new TarefaServico(); + _apoliceServico = new ApoliceServico(); + _clienteServico = new ClienteServico(); + _tarefaServico = new TarefaServico(); + _sinitrosServico = new SinistroServico(); + } + + public async Task BuscarRestricoes() + { + Restricoes = await ServicoRestriUsuario.BuscarRestricoes(((DomainBase)Recursos.Usuario).Id); + Permissoes = new List<PermissaoUsuario>(); + PermissaoUsuario val = await ServicoPermissUsuario.VerificarPermissao(Recursos.Usuario, (TipoTela)38); + if (val != null) + { + Permissoes.Add(val); + } + } + + public async Task CarregarAniversariantes(bool force = false) + { + AniversariantesEnabled = false; + if (!force && CompararFiltros(_filtroAniversariantes)) + { + AniversariantesEnabled = true; + return; + } + _filtroAniversariantes = Filtros; + List<VendedorUsuario> list = await VerificaVinculoVendedor(Recursos.Usuario); + List<long> vinculoVendedores = new List<long>(); + list.ForEach(delegate(VendedorUsuario v) + { + vinculoVendedores.Add(((DomainBase)v.Vendedor).Id); + }); + List<ClientesAtivosInativos> list2 = ((list.Count <= 0) ? (await _clienteServico.BuscarAniversariantes(Filtros)) : (await _clienteServico.BuscarAniversariantesVinculo(Filtros, list))); + List<ClientesAtivosInativos> list3 = list2; + QuantidadeAniversariantes = list3.Count.ToString(); + if (list3.Count == 0) + { + Aniversariantes = null; + AniversariantesEnabled = true; + } + else + { + Aniversariantes = new ObservableCollection<ClientesAtivosInativos>(list3); + AniversariantesEnabled = true; + } + } + + public async Task CarregarSinistros(bool force = false) + { + SinistrosEnabled = false; + if (!force && CompararFiltros(_filtroSinistros)) + { + SinistrosEnabled = true; + return; + } + _filtroSinistros = Filtros; + List<Sinistro> list = await _sinitrosServico.BuscarSinistroPendente(Filtros); + QuantidadeSinistro = list.Count.ToString(); + if (list.Count == 0) + { + Sinistros = null; + SinistrosEnabled = true; + } + else + { + Sinistros = new ObservableCollection<Sinistro>(list); + SinistrosEnabled = true; + } + } + + public async Task CarregarSinistros(DateTime inicio, DateTime fim) + { + _filtroSinistros.Fim = fim; + _filtroSinistros.Inicio = inicio; + List<Sinistro> list = await _sinitrosServico.BuscarSinistroPendente(_filtroSinistros); + QuantidadeSinistro = list.Count.ToString(); + Sinistros = new ObservableCollection<Sinistro>(list); + } + + public async Task CarregarFiltros() + { + List<long> vendedores = new List<long>(); + List<VendedorUsuario> list = await VerificaVinculoVendedor(Recursos.Usuario); + if (list.Count > 0) + { + list.ForEach(delegate(VendedorUsuario x) + { + vendedores.Add(((DomainBase)x.Vendedor).Id); + }); + } + DateTime today = DateTime.Today; + DateTime fim = DateTime.Today; + string intervaloSelecionado = IntervaloSelecionado; + if (!(intervaloSelecionado == "PRÓXIMOS 3 DIAS")) + { + if (intervaloSelecionado == "PRÓXIMOS 7 DIAS") + { + fim = today.AddDays(7.0); + } + } + else + { + fim = today.AddDays(3.0); + } + Filtros = new Filtros + { + Inicio = today, + Fim = fim, + Vendedores = vendedores, + IdEmpresa = ((Recursos.Usuario.IdEmpresa > 1) ? Recursos.Usuario.IdEmpresa : 0), + Status = new List<long> { 1L, 2L } + }; + } + + private bool CompararFiltros(Filtros comparacao) + { + if (comparacao == null) + { + return false; + } + if (Filtros == null) + { + return false; + } + if (comparacao.Inicio != Filtros.Inicio) + { + return false; + } + if (comparacao.Fim != Filtros.Fim) + { + return false; + } + return true; + } + + public async Task CarregarRenovacoes(bool force = false) + { + RenovacoesEnabled = false; + if (!force && CompararFiltros(_filtroRenovacao)) + { + RenovacoesEnabled = true; + return; + } + _filtroRenovacao = Filtros; + List<Renovacao> analiticoRenovacao = (await _apoliceServico.BuscarApolicesVigenciaFinal(Filtros)).Where((Documento x) => x.Tipo != 3).Select((Func<Documento, Renovacao>)delegate(Documento x) + { + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Unknown result type (might be due to invalid IL or missing references) + //IL_003d: Unknown result type (might be due to invalid IL or missing references) + //IL_0057: Unknown result type (might be due to invalid IL or missing references) + //IL_0068: Unknown result type (might be due to invalid IL or missing references) + //IL_0079: Unknown result type (might be due to invalid IL or missing references) + //IL_0094: Unknown result type (might be due to invalid IL or missing references) + //IL_00b1: Unknown result type (might be due to invalid IL or missing references) + //IL_00c2: Unknown result type (might be due to invalid IL or missing references) + //IL_00ed: Unknown result type (might be due to invalid IL or missing references) + //IL_0111: Unknown result type (might be due to invalid IL or missing references) + //IL_015f: Unknown result type (might be due to invalid IL or missing references) + //IL_0166: Unknown result type (might be due to invalid IL or missing references) + //IL_016c: Invalid comparison between Unknown and I4 + //IL_0174: Unknown result type (might be due to invalid IL or missing references) + //IL_017a: Invalid comparison between Unknown and I4 + //IL_01a6: Unknown result type (might be due to invalid IL or missing references) + //IL_0182: Unknown result type (might be due to invalid IL or missing references) + //IL_01c3: Unknown result type (might be due to invalid IL or missing references) + //IL_01e9: Unknown result type (might be due to invalid IL or missing references) + //IL_024e: Unknown result type (might be due to invalid IL or missing references) + //IL_025f: Unknown result type (might be due to invalid IL or missing references) + //IL_026b: Unknown result type (might be due to invalid IL or missing references) + //IL_027c: Unknown result type (might be due to invalid IL or missing references) + //IL_02df: Unknown result type (might be due to invalid IL or missing references) + //IL_0313: Unknown result type (might be due to invalid IL or missing references) + //IL_0332: Unknown result type (might be due to invalid IL or missing references) + //IL_0343: Unknown result type (might be due to invalid IL or missing references) + //IL_0369: Unknown result type (might be due to invalid IL or missing references) + //IL_037f: Unknown result type (might be due to invalid IL or missing references) + //IL_03a7: Unknown result type (might be due to invalid IL or missing references) + //IL_03dc: Unknown result type (might be due to invalid IL or missing references) + //IL_0402: Unknown result type (might be due to invalid IL or missing references) + //IL_0413: Unknown result type (might be due to invalid IL or missing references) + //IL_0424: Unknown result type (might be due to invalid IL or missing references) + //IL_0435: Unknown result type (might be due to invalid IL or missing references) + //IL_0450: Unknown result type (might be due to invalid IL or missing references) + //IL_0462: Expected O, but got Unknown + Renovacao val2 = new Renovacao(); + Cliente cliente = x.Controle.Cliente; + val2.Cliente = ((cliente != null) ? cliente.Nome : null) ?? ""; + val2.Apolice = x.Apolice ?? ""; + val2.PremioLiquido = x.PremioLiquido; + val2.PremioTotal = x.PremioTotal; + Negocio? negocio = x.Negocio; + val2.Negocio = (negocio.HasValue ? ValidationHelper.GetDescription((Enum)(object)negocio.GetValueOrDefault()) : null) ?? ""; + val2.VigenciaFinal = x.Vigencia2; + Produto produto2 = x.Controle.Produto; + val2.Produto = ((produto2 != null) ? produto2.Nome : null) ?? ""; + val2.Ramo = x.Controle.Ramo.Nome ?? ""; + val2.Seguradora = ((!string.IsNullOrWhiteSpace(x.Controle.Seguradora.NomeSocial)) ? x.Controle.Seguradora.NomeSocial : x.Controle.Seguradora.Nome); + val2.Status = (((int)x.Situacao == 1 || (int)x.Situacao == 2) ? "NÃO TRABALHADO" : (ValidationHelper.GetDescription((Enum)(object)x.Situacao) ?? "")); + Vendedor vendedorPrincipal = x.VendedorPrincipal; + val2.Vendedor = ((vendedorPrincipal != null) ? vendedorPrincipal.Nome : null); + Estipulante estipulante = x.Estipulante1; + val2.Estipulante = ((estipulante != null) ? estipulante.Nome : null) ?? ""; + val2.TodosVendedores = ((x.Vendedores == null || x.Vendedores.Count == 0) ? "" : string.Join("; ", x.Vendedores.Select((Vendedor v) => v.Nome))); + val2.Tipo = x.Tipo; + val2.Documento = x; + val2.Comissao = x.Comissao; + val2.Item = ((x.ItensAtivo == null) ? "" : ((x.ItensAtivo.Count > 1) ? "APÓLICE COLETIVA" : ((x.ItensAtivo.Count == 1) ? x.ItensAtivo.First().Descricao : ""))); + val2.TipoDocumento = ((x.Tipo == 0) ? "APÓLICE" : ((x.Tipo == 1) ? "ENDOSSO" : "")); + val2.Sinistro = (x.Sinistro ? "SIM" : "NÃO"); + val2.DataControle = x.DataControle; + Status status2 = x.Status; + val2.StatusApolice = ((status2 != null) ? status2.Nome : null) ?? ""; + val2.IdEmpresa = x.Controle.IdEmpresa; + Empresa? obj = ((IEnumerable<Empresa>)Recursos.Empresas).FirstOrDefault((Func<Empresa, bool>)((Empresa e) => ((DomainBase)e).Id == x.Controle.IdEmpresa)); + val2.Empresa = ((obj != null) ? obj.Nome : null); + val2.QtdSinistro = x.ItensAtivo.Sum((Item s) => s.Sinistros.Count); + Banco banco = x.Banco; + val2.Banco = ((banco != null) ? banco.Nome : null) ?? ""; + val2.Conta = x.Conta; + val2.Agencia = x.Agencia; + val2.Pasta = x.Pasta; + val2.PastaCliente = x.Controle.Cliente.Pasta; + val2.Calculos = x.Calculos; + return val2; + }).ToList(); + List<Renovacao> collection = (await new ProspeccaoServico().BuscarProspeccoes(Filtros)).Where((Prospeccao x) => x.Renovacao).Select(delegate(Prospeccao x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Expected O, but got Unknown + //IL_0048: Unknown result type (might be due to invalid IL or missing references) + Renovacao val = new Renovacao(); + val.Cliente = x.Nome ?? ""; + val.Apolice = "PROSPECÇÃO"; + val.VigenciaFinal = x.VigenciaFinal; + StatusProspeccao? status = x.Status; + val.Status = (status.HasValue ? ValidationHelper.GetDescription((Enum)(object)status.GetValueOrDefault()) : null) ?? ""; + Vendedor vendedor = x.Vendedor; + val.Vendedor = ((vendedor != null) ? vendedor.Nome : null); + Vendedor vendedor2 = x.Vendedor; + val.TodosVendedores = ((vendedor2 != null) ? vendedor2.Nome : null); + val.Telefone = x.Prefixo1 + " " + x.Telefone1 + " | " + x.Prefixo2 + " " + x.Telefone2; + val.Tipo = 3; + val.TipoDocumento = "PROSPECÇÃO"; + val.Item = x.Item; + Produto produto = x.Produto; + val.Produto = ((produto != null) ? produto.Nome : null); + val.Prospeccao = x; + return val; + }).ToList(); + analiticoRenovacao.AddRange(collection); + QuantidadeRenovacoes = analiticoRenovacao.Count.ToString(); + if (analiticoRenovacao.Count == 0) + { + RenovacaoFiltrado = null; + RenovacoesEnabled = true; + return; + } + RenovacaoFiltrado = new ObservableCollection<Renovacao>(analiticoRenovacao.OrderBy((Renovacao x) => x.VigenciaFinal).ToList()); + RenovacoesEnabled = true; + } + + public async Task CarregarNotas() + { + NotasEnabled = false; + Notas = new ObservableCollection<Tarefa>(await _servico.BuscarNotas(((DomainBase)Recursos.Usuario).Id)); + NotasEnabled = true; + } + + public async Task<List<KeyValuePair<string, string>>> Salvar(Tarefa destino) + { + destino.AgendamentoRetroativo = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 45); + List<KeyValuePair<string, string>> list = destino.Validate(); + if (list.Count > 0) + { + return list; + } + await _servico.Salvar(destino); + if (!_servico.Sucesso) + { + return null; + } + if (Publica) + { + long id = ((DomainBase)destino.Usuario).Id; + List<Usuario> usuarios = Recursos.Usuarios; + List<Task> list2 = new List<Task>(); + foreach (Usuario item in usuarios) + { + if (id != ((DomainBase)item).Id) + { + Tarefa val = (Tarefa)((DomainBase)destino).Clone(); + ((DomainBase)val).Id = 0L; + val.Usuario = item; + list2.Add(_servico.Salvar(val)); + } + } + await Task.WhenAll(list2); + } + await CarregarNotas(); + return null; + } + + public async Task<Tarefa> SalvarNota(Tarefa nota) + { + return await _servico.Salvar(nota); + } + + public async Task ExcluirNota(Tarefa nota) + { + await _servico.Excluir(((DomainBase)nota).Id); + } + + public async Task CarregarTarefas(bool force = false) + { + TarefasEnabled = false; + if (!force && CompararFiltros(_filtroTarefas)) + { + TarefasEnabled = true; + return; + } + _filtroTarefas = Filtros; + List<Tarefa> list = await _tarefaServico.BuscarTarefas(((DomainBase)Recursos.Usuario).Id, _filtroTarefas.Inicio, _filtroTarefas.Fim, false); + QuantidadeTarefas = list.Count.ToString(); + if (list.Count == 0) + { + Tarefas = null; + TarefasEnabled = true; + return; + } + Tarefas = new ObservableCollection<Tarefa>(from x in list + where (int)x.Entidade != 1 + orderby x.Agendamento + select x); + TarefasEnabled = true; + } + + public async Task CarregarProspect(DateTime inicio, DateTime fim) + { + ProspeccoesEnabled = false; + Filtros val = new Filtros + { + Inicio = inicio, + Fim = fim, + Ramos = new List<long> { ((DomainBase)SelectedRamo).Id }, + Vendedores = Filtros.Vendedores, + Referencia = Referencia, + FiltrarDocumento = FiltroClientes + }; + LabelProspeccao = "CLIENTES QUE NÃO POSSUEM SEGUROS DO RAMO " + SelectedRamo.Nome + " "; + string referencia = Referencia; + if (!(referencia == "VIGÊNCIA INICIAL")) + { + if (!(referencia == "VIGÊNCIA FINAL")) + { + LabelProspeccao += "E QUE ESTÃO COM A ULTIMA PARCELA VENCENDO NO PERÍODO"; + } + else + { + LabelProspeccao += "E QUE ESTÃO COM UMA APÓLICE VENCENDO NO PERÍODO"; + } + } + else + { + LabelProspeccao += "E QUE ESTÃO COM UMA APÓLICE INICIANDO NO PERÍODO"; + } + if (_filtroProspectar != null && _filtroProspectar.Inicio == val.Inicio && _filtroProspectar.Fim == val.Fim && _filtroProspectar.Ramos == val.Ramos && _filtroProspectar.Referencia == val.Referencia) + { + ProspeccoesEnabled = true; + return; + } + _filtroProspectar = val; + List<Prospectar> list = await _clienteServico.BuscarProspect(val); + QuantidadeProspeccao = list.Count.ToString(); + if (list.Count == 0) + { + LabelProspeccao = "NÃO HÁ CLIENTES PARA PROSPECTAR"; + } + Prospeccoes = new ObservableCollection<Prospectar>(list); + ProspeccoesEnabled = true; + } + + public void LimparProspeccao() + { + } + + public void CarregarRamos() + { + List<long> ids = new List<long> { 1L, 2L, 6L, 7L }; + Ramos = Recursos.Ramos.Where((Ramo x) => ids.Contains(((DomainBase)x).Id)).ToList(); + SelectedRamo = Ramos.Find((Ramo x) => ((DomainBase)x).Id == 1); + } + + public async Task<bool> GerarCsv() + { + string fileName = Path.GetFileNameWithoutExtension(Path.GetTempFileName()) + ".csv"; + File.WriteAllText(fileName, (await Funcoes.GerarCsv(Prospeccoes.ToList(), new List<string> { "Nome", "Documento", "Telefone" })).ToString(), Encoding.UTF8); + Process.Start(fileName); + return true; + } +} diff --git a/Decompiler/Gestor.Application.ViewModels/ImportViewModel.cs b/Decompiler/Gestor.Application.ViewModels/ImportViewModel.cs new file mode 100644 index 0000000..34daacf --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels/ImportViewModel.cs @@ -0,0 +1,103 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.Linq; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Domain.Generic; +using Microsoft.Win32; + +namespace Gestor.Application.ViewModels; + +public class ImportViewModel : BaseViewModel +{ + private ObservableCollection<Arquivo> _arquivos = new ObservableCollection<Arquivo>(); + + public ObservableCollection<Arquivo> Arquivos + { + get + { + return _arquivos; + } + set + { + _arquivos = value; + OnPropertyChanged("Arquivos"); + } + } + + public void CarregarArquivos() + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0010: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Unknown result type (might be due to invalid IL or missing references) + //IL_0023: Expected O, but got Unknown + OpenFileDialog val = new OpenFileDialog + { + Title = "Selecione o PDF", + Filter = "Arquivos PDF|*.pdf", + Multiselect = true + }; + if (((CommonDialog)val).ShowDialog().GetValueOrDefault()) + { + Arquivos = new ObservableCollection<Arquivo>(); + ((FileDialog)val).FileNames.ToList().ForEach(delegate(string x) + { + Arquivos.Add(new Arquivo + { + Nome = x, + Processo = 0 + }); + }); + } + } + + public void Importar() + { + new TaskFactory().StartNew(() => Importar(Arquivos.ToList())); + } + + public async Task<bool> Importar(List<Arquivo> arquivos) + { + arquivos.ForEach(async delegate(Arquivo x) + { + await Import(x); + }); + return true; + } + + public async Task Import(Arquivo arquivo) + { + await Task.Run(delegate + { + try + { + Process process = new Process + { + StartInfo = new ProcessStartInfo + { + FileName = "C:\\AggerSeguros\\Agger.Import201911261630\\Agger.ImportPDF.exe", + Arguments = $" {((DomainBase)Recursos.Empresa).Id} {((DomainBase)Recursos.Usuario).Id} NOVOGESTOR {arquivo.Nome}", + UseShellExecute = false, + RedirectStandardOutput = true, + CreateNoWindow = true + } + }; + process.Start(); + process.WaitForExit(); + string text = process.StandardError.ReadToEnd(); + string text2 = process.StandardOutput.ReadToEnd(); + if (process.ExitCode != 0) + { + throw new Exception("netsh exit code: " + process.ExitCode + " " + ((!string.IsNullOrEmpty(text)) ? (" " + text) : "") + " " + ((!string.IsNullOrEmpty(text2)) ? (" " + text2) : "")); + } + } + catch (Exception) + { + } + }); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels/LoginImageModel.cs b/Decompiler/Gestor.Application.ViewModels/LoginImageModel.cs new file mode 100644 index 0000000..774c664 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels/LoginImageModel.cs @@ -0,0 +1,8 @@ +namespace Gestor.Application.ViewModels; + +public class LoginImageModel +{ + public string Imagem { get; set; } + + public string UrlFixa { get; set; } +} diff --git a/Decompiler/Gestor.Application.ViewModels/LoginViewModel.cs b/Decompiler/Gestor.Application.ViewModels/LoginViewModel.cs new file mode 100644 index 0000000..4298f27 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels/LoginViewModel.cs @@ -0,0 +1,866 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Reflection; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Input; +using Agger.Registro; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Ferramentas; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels.Command; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Security; +using Gestor.Common.Validation; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace Gestor.Application.ViewModels; + +internal class LoginViewModel : BaseSegurosViewModel +{ + private class AggerAccess + { + public long Id { get; set; } + + public Client Usuario { get; set; } + + public string Ip { get; set; } + + public string Acao { get; set; } + + public string Serial { get; set; } + + public DateTime? Data { get; set; } + + public string Log { get; set; } + } + + private class Client + { + public long Id { get; set; } + + public string Name { get; set; } + + public string Login { get; set; } + + public string Password { get; set; } + + public string Email { get; set; } + + public bool Deleted { get; set; } + + public bool AttendancePrivate { get; set; } + + public DateTime? DateLoginStart { get; set; } + + public DateTime? DateLoginFinal { get; set; } + + public DateTime? ExpirationPassDate { get; set; } + } + + private bool _enableRegistro; + + private bool _enableTrocaSenha; + + private bool _aggerUser; + + private string _imagemLink = "https://calendly.com/treinamentocs"; + + private string _imagem = "https://docs.agger.com.br/treinamentoprimeirasemana.png"; + + private string _head; + + private string _login; + + private string _novaNovaSenha; + + private string _senha; + + private string _confirmacaoSenha; + + private Usuario _usuario; + + private string userJson = AppDomain.CurrentDomain.BaseDirectory + "user.json"; + + private LoginImageModel _selectedImage; + + private int _selectedIndex; + + private string _version; + + private string _labelVersion = ""; + + private bool _loadingVisibility; + + private bool _fieldsVisibility; + + private string _errorLogin = "DADOS DE ACESSO INVÁLIDOS"; + + private Visibility _errorLoginVisibility = (Visibility)1; + + private Visibility _acessoVisibility = (Visibility)2; + + private Visibility _trocaSenhaVisibility = (Visibility)2; + + private Visibility _loginVisibility; + + private Visibility _registrarVisibility = (Visibility)2; + + private Visibility _visibilityCancelarRegitro = (Visibility)2; + + private string _chave; + + private string _mensagem; + + private string _centralAtendimento = Address.CentralAtendimento.ToString(); + + public static string VersaoAtual { get; set; } + + public bool EnableRegistro + { + get + { + return _enableRegistro; + } + set + { + _enableRegistro = value; + OnPropertyChanged("EnableRegistro"); + } + } + + public bool EnableTrocaSenha + { + get + { + return _enableTrocaSenha; + } + set + { + _enableTrocaSenha = value; + OnPropertyChanged("EnableTrocaSenha"); + } + } + + public bool AggerUser + { + get + { + return _aggerUser; + } + set + { + _aggerUser = value; + OnPropertyChanged("AggerUser"); + } + } + + public string ImagemLink + { + get + { + return _imagemLink; + } + set + { + _imagemLink = value; + OnPropertyChanged("ImagemLink"); + } + } + + public string Imagem + { + get + { + return _imagem; + } + set + { + _imagem = value; + OnPropertyChanged("Imagem"); + } + } + + public string Head + { + get + { + return _head; + } + set + { + _head = value?.ToUpper(); + OnPropertyChanged("Head"); + } + } + + public string Login + { + get + { + return _login; + } + set + { + _login = value; + string login = Login; + AggerUser = (login != null && login.ToUpper().StartsWith("AGGER@")) || (Senha?.ToUpper().StartsWith("AGGER@") ?? false); + OnPropertyChanged("Login"); + } + } + + public string NovaSenha + { + get + { + return _novaNovaSenha; + } + set + { + _novaNovaSenha = value; + EnableTrocaSenha = ValidationHelper.IsNotNullOrEmpty(NovaSenha) && ValidationHelper.IsNotNullOrEmpty(ConfirmacaoSenha) && NovaSenha.Equals(ConfirmacaoSenha); + OnPropertyChanged("NovaSenha"); + } + } + + public string Senha + { + get + { + return _senha; + } + set + { + _senha = value; + string login = Login; + AggerUser = (login != null && login.ToUpper().StartsWith("AGGER@")) || (Senha?.ToUpper().StartsWith("AGGER@") ?? false); + OnPropertyChanged("Senha"); + } + } + + public string ConfirmacaoSenha + { + get + { + return _confirmacaoSenha; + } + set + { + _confirmacaoSenha = value; + EnableTrocaSenha = ValidationHelper.IsNotNullOrEmpty(NovaSenha) && ValidationHelper.IsNotNullOrEmpty(ConfirmacaoSenha) && NovaSenha.Equals(ConfirmacaoSenha); + OnPropertyChanged("ConfirmacaoSenha"); + } + } + + public Usuario Usuario + { + get + { + return _usuario; + } + set + { + _usuario = value; + OnPropertyChanged("Usuario"); + } + } + + public ObservableCollection<LoginImageModel> LoginImages { get; set; } = new ObservableCollection<LoginImageModel>(); + + + public LoginImageModel SelectedImage + { + get + { + return _selectedImage; + } + set + { + _selectedImage = value; + OnPropertyChanged("SelectedImage"); + } + } + + public int SelectedIndex + { + get + { + return _selectedIndex; + } + set + { + _selectedIndex = value; + SelectedImage = LoginImages.ElementAtOrDefault(value); + OnPropertyChanged("SelectedIndex"); + } + } + + public ICommand ImageClickCommand => new RelayCommand(delegate + { + LoginImageModel selectedImage = SelectedImage; + if (selectedImage != null && ValidationHelper.IsNotNullOrEmpty(selectedImage.UrlFixa)) + { + Process.Start(new ProcessStartInfo + { + FileName = SelectedImage.UrlFixa, + UseShellExecute = true + }); + } + }); + + public string Version + { + get + { + return _version; + } + set + { + _version = value; + OnPropertyChanged("Version"); + } + } + + public string LabelVersion + { + get + { + return _labelVersion; + } + set + { + _labelVersion = value; + OnPropertyChanged("LabelVersion"); + } + } + + public bool LoadingVisibility + { + get + { + return _loadingVisibility; + } + set + { + _loadingVisibility = value; + OnPropertyChanged("LoadingVisibility"); + } + } + + public bool FieldsVisibility + { + get + { + return _fieldsVisibility; + } + set + { + _fieldsVisibility = value; + OnPropertyChanged("FieldsVisibility"); + } + } + + public string ErrorLogin + { + get + { + return _errorLogin; + } + set + { + _errorLogin = value; + OnPropertyChanged("ErrorLogin"); + } + } + + public Visibility ErrorLoginVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _errorLoginVisibility; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _errorLoginVisibility = value; + OnPropertyChanged("ErrorLoginVisibility"); + } + } + + public Visibility AcessoVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _acessoVisibility; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _acessoVisibility = value; + OnPropertyChanged("AcessoVisibility"); + } + } + + public Visibility TrocaSenhaVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _trocaSenhaVisibility; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _trocaSenhaVisibility = value; + OnPropertyChanged("TrocaSenhaVisibility"); + } + } + + public Visibility LoginVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _loginVisibility; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _loginVisibility = value; + OnPropertyChanged("LoginVisibility"); + } + } + + public Visibility RegistrarVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _registrarVisibility; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _registrarVisibility = value; + OnPropertyChanged("RegistrarVisibility"); + } + } + + public Visibility VisibilityCancelarRegitro + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityCancelarRegitro; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityCancelarRegitro = value; + OnPropertyChanged("VisibilityCancelarRegitro"); + } + } + + public string Chave + { + get + { + return _chave; + } + set + { + _chave = value; + EnableRegistro = ValidationHelper.IsNotNullOrEmpty(Chave); + OnPropertyChanged("Chave"); + } + } + + public string Mensagem + { + get + { + return _mensagem; + } + set + { + _mensagem = value; + OnPropertyChanged("Mensagem"); + } + } + + public string CentralAtendimento + { + get + { + return _centralAtendimento; + } + set + { + _centralAtendimento = value; + OnPropertyChanged("CentralAtendimento"); + } + } + + public LoginViewModel() + { + //IL_0053: Unknown result type (might be due to invalid IL or missing references) + //IL_005a: Unknown result type (might be due to invalid IL or missing references) + //IL_0061: Unknown result type (might be due to invalid IL or missing references) + //IL_0068: Unknown result type (might be due to invalid IL or missing references) + //IL_006f: Unknown result type (might be due to invalid IL or missing references) + base.EnableButtons = true; + ApplicationHelper.Versao = Assembly.GetExecutingAssembly().GetName().Version; + Version = ApplicationHelper.Versao.ToString(); + LabelVersion = "Gestor " + Version; + VersaoAtual = LabelVersion; + if (File.Exists(userJson)) + { + Usuario val = JsonConvert.DeserializeObject<Usuario>(File.ReadAllText(userJson)); + Login = ((val != null) ? val.Login : null); + } + } + + public async Task<bool> Load() + { + return await Task.Run(async delegate + { + try + { + return await new BaseServico().LoadInicialParameters(); + } + catch (Exception) + { + return false; + } + }); + } + + public async Task<bool> Validate(string login, string password) + { + ErrorLoginVisibility = (Visibility)1; + if (login.Contains("AGGER@")) + { + string[] array = login.Split(new char[1] { '@' }); + AggerAccess keyValues = new AggerAccess + { + Usuario = new Client + { + Login = array[1], + Password = new Token().AggerEncrypt(password) + }, + Acao = "AggerAccessNovoGestor", + Log = "ANG - " + ApplicationHelper.NumeroSerial, + Serial = ApplicationHelper.NumeroSerial + }; + AggerAccess aggerAccess = await Connection.Post("Access/AggerLogin", keyValues); + if (aggerAccess == null || !(aggerAccess.Usuario?.Id > 0)) + { + ErrorLoginVisibility = (Visibility)0; + return false; + } + Recursos.Usuario = new Usuario + { + Nome = "ACESSO AGGER - USUÁRIO " + aggerAccess.Usuario.Name, + Login = aggerAccess.Usuario.Login, + IdEmpresa = 1L, + PermissaoAggilizador = 1L + }; + Recursos.Empresa = new BaseServico().BuscarEmpresa(Recursos.Usuario.IdEmpresa); + return true; + } + Usuario usuario = await new BaseServico().BuscarUsuario(login, password); + string text = ((usuario != null) ? (await VerificarAcesso(((DomainBase)usuario).Id)) : "DADOS DE ACESSO INVÁLIDOS"); + string text2 = text; + if (text2 != null) + { + ErrorLogin = text2; + ErrorLoginVisibility = (Visibility)0; + return false; + } + Recursos.Usuario = usuario; + Recursos.Empresa = new BaseServico().BuscarEmpresa(Recursos.Usuario.IdEmpresa); + Recursos.Usuario.Senha = string.Empty; + File.WriteAllText(userJson, JsonConvert.SerializeObject((object)usuario)); + return true; + } + + public void AcessoNegado(string message) + { + Mensagem = message; + RegistrarVisibility = (Visibility)2; + LoginVisibility = (Visibility)2; + AcessoVisibility = (Visibility)0; + } + + public void AbrirRegistro() + { + LoginVisibility = (Visibility)2; + AcessoVisibility = (Visibility)2; + RegistrarVisibility = (Visibility)0; + VisibilityCancelarRegitro = (Visibility)((ApplicationHelper.IdFornecedor == 0L) ? 2 : 0); + Chave = string.Empty; + } + + public void FecharRegistro() + { + RegistrarVisibility = (Visibility)2; + LoginVisibility = (Visibility)0; + Chave = string.Empty; + } + + public async Task AbrirTrocaSenha() + { + UsuarioServico usuarioServico = new UsuarioServico(); + bool flag = ValidationHelper.IsNullOrEmpty(Senha) || ValidationHelper.IsNullOrEmpty(Login); + if (!flag) + { + bool flag2 = ValidationHelper.IsNotNullOrEmpty(Login); + if (flag2) + { + Usuario val2 = (Usuario = await usuarioServico.BuscarLogin(Login)); + flag2 = val2 == null; + } + flag = flag2; + } + if (flag) + { + await ShowMessage("NECESSÁRIO INSERIR UM USUÁRIO E SENHA VÁLIDOS PARA REALIZAR A TROCA DE SENHA."); + return; + } + TrocaSenhaVisibility = (Visibility)0; + LoginVisibility = (Visibility)2; + } + + public async Task<bool> TrocaSenha() + { + if (string.IsNullOrEmpty(Senha)) + { + await ShowMessage("NECESSÁRIO PREENCHER A SENHA ANTERIOR PARA REALIZAR A TROCA DE SENHA."); + return false; + } + if (string.IsNullOrEmpty(NovaSenha)) + { + await ShowMessage("NECESSÁRIO PREENCHER A NOVA SENHA PARA REALIZAR A TROCA DE SENHA."); + return false; + } + Token token = new Token(); + if (Senha == NovaSenha) + { + await ShowMessage("A NOVA SENHA NÃO PODE SER IGUAL A SENHA ANTERIOR."); + return false; + } + if (NovaSenha != ConfirmacaoSenha) + { + await ShowMessage("A SENHA E A CONFIRMAÇÃO DA SENHA DEVEM SER IGUAIS."); + return false; + } + if (Senha.ToUpper().Contains("AGGER@")) + { + string[] array = Senha.Split(new char[1] { '@' }); + if (array.Length < 3) + { + await ShowMessage("SENHA ANTERIOR INVÁLIDA."); + return false; + } + AggerAccess keyValues = new AggerAccess + { + Usuario = new Client + { + Login = array[1].ToUpper(), + Password = new Token().AggerEncrypt(array[2]) + }, + Acao = $"TrocaSenha - {((DomainBase)Usuario).Id}|{Usuario.Login}", + Log = "ANG - " + ApplicationHelper.NumeroSerial, + Serial = ApplicationHelper.NumeroSerial + }; + AggerAccess acesso; + try + { + acesso = await Connection.Post("Access/AggerLogin", keyValues); + } + catch (Exception ex) + { + _ = ex; + await ShowMessage("SENHA ANTERIOR INVÁLIDA."); + return false; + } + if (acesso == null || !(acesso.Usuario?.Id > 0)) + { + await ShowMessage("SENHA ANTERIOR INVÁLIDA."); + return false; + } + } + else if (ValidationHelper.IsNotNullOrEmpty(Usuario.Senha) && Senha != token.AggerDecrypt(Usuario.Senha)) + { + await ShowMessage("SENHA ANTERIOR INVÁLIDA."); + return false; + } + UsuarioServico servico = new UsuarioServico(); + Usuario.SenhaAnterior = token.AggerEncrypt(Senha); + Usuario.Senha = token.AggerEncrypt(NovaSenha); + await servico.Save(Usuario); + if (servico.Sucesso) + { + Senha = NovaSenha; + return true; + } + Usuario.SenhaAnterior = string.Empty; + Usuario.Senha = string.Empty; + await ShowMessage("VERIFIQUE OS DADOS DIGITADOS E TENTE NOVAMENTE."); + return false; + } + + public async Task GetImagesFromJson() + { + _ = 1; + try + { + HttpClient client = new HttpClient(); + try + { + ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; + client.Timeout = TimeSpan.FromSeconds(30.0); + HttpResponseMessage val; + try + { + val = await client.GetAsync(Address.LoginJson); + val.EnsureSuccessStatusCode(); + } + catch + { + return; + } + if (val.IsSuccessStatusCode) + { + JObject obj2 = JObject.Parse(await val.Content.ReadAsStringAsync()); + JToken obj3 = obj2["Imagem"]; + string text = ((obj3 != null) ? Extensions.Value<string>((IEnumerable<JToken>)obj3) : null); + JToken obj4 = obj2["Url"]; + string text2 = ((obj4 != null) ? Extensions.Value<string>((IEnumerable<JToken>)obj4) : null); + if (ValidationHelper.IsNotNullOrEmpty(text) && ValidationHelper.IsNotNullOrEmpty(text2)) + { + Imagem = text; + ImagemLink = text2; + } + } + } + finally + { + ((IDisposable)client)?.Dispose(); + } + } + catch + { + } + } + + public async Task<bool> GetCfgJson() + { + _ = 2; + try + { + HttpClient client = new HttpClient(); + try + { + ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; + client.Timeout = TimeSpan.FromSeconds(30.0); + HttpResponseMessage result; + try + { + result = await client.GetAsync(Address.JsonGestor); + result.EnsureSuccessStatusCode(); + } + catch + { + result = await client.GetAsync(Address.JsonGestorAzure); + } + if (result.IsSuccessStatusCode) + { + JObject obj2 = JObject.Parse(await result.Content.ReadAsStringAsync()); + JToken obj3 = obj2["ApiGestor"]; + string text = ((obj3 != null) ? Extensions.Value<string>((IEnumerable<JToken>)obj3) : null); + JToken obj4 = obj2["ApiGestorBeta"]; + string text2 = ((obj4 != null) ? Extensions.Value<string>((IEnumerable<JToken>)obj4) : null); + JToken obj5 = obj2["ApiAssinador"]; + string text3 = ((obj5 != null) ? Extensions.Value<string>((IEnumerable<JToken>)obj5) : null); + JToken obj6 = obj2["ApiAssinadorBeta"]; + string text4 = ((obj6 != null) ? Extensions.Value<string>((IEnumerable<JToken>)obj6) : null); + JToken obj7 = obj2["ApiCard"]; + string text5 = ((obj7 != null) ? Extensions.Value<string>((IEnumerable<JToken>)obj7) : null); + JToken obj8 = obj2["ApiAssistencia"]; + string text6 = ((obj8 != null) ? Extensions.Value<string>((IEnumerable<JToken>)obj8) : null); + JToken obj9 = obj2["ApiAD"]; + string text7 = ((obj9 != null) ? Extensions.Value<string>((IEnumerable<JToken>)obj9) : null); + JToken obj10 = obj2["ApiAttachment"]; + string text8 = ((obj10 != null) ? Extensions.Value<string>((IEnumerable<JToken>)obj10) : null); + JToken obj11 = obj2["ApiFipe"]; + string text9 = ((obj11 != null) ? Extensions.Value<string>((IEnumerable<JToken>)obj11) : null); + JToken obj12 = obj2["ApiSso"]; + string text10 = ((obj12 != null) ? Extensions.Value<string>((IEnumerable<JToken>)obj12) : null); + JToken obj13 = obj2["ApiCep"]; + string text11 = ((obj13 != null) ? Extensions.Value<string>((IEnumerable<JToken>)obj13) : null); + JToken obj14 = obj2["ApiMonitor"]; + string text12 = ((obj14 != null) ? Extensions.Value<string>((IEnumerable<JToken>)obj14) : null); + JToken obj15 = obj2["LoginJson"]; + string text13 = ((obj15 != null) ? Extensions.Value<string>((IEnumerable<JToken>)obj15) : null); + JToken obj16 = obj2["PromoJson"]; + string text14 = ((obj16 != null) ? Extensions.Value<string>((IEnumerable<JToken>)obj16) : null); + JToken obj17 = obj2["BetaPromoJson"]; + string text15 = ((obj17 != null) ? Extensions.Value<string>((IEnumerable<JToken>)obj17) : null); + JToken obj18 = obj2["SurveyJson"]; + string text16 = ((obj18 != null) ? Extensions.Value<string>((IEnumerable<JToken>)obj18) : null); + JToken obj19 = obj2["CentralAtendimento"]; + string text17 = ((obj19 != null) ? Extensions.Value<string>((IEnumerable<JToken>)obj19) : null); + JToken obj20 = obj2["UsarApis"]; + if (obj20 != null) + { + Extensions.Value<string>((IEnumerable<JToken>)obj20); + } + Address.ApiGestorOficial = text?.ToUri() ?? Address.ApiGestorOficial; + Address.ApiGestorBeta = text2?.ToUri() ?? Address.ApiGestorBeta; + Address.AssinadorApiOficial = text3?.ToUri() ?? Address.AssinadorApiOficial; + Address.AssinadorApiBeta = text4?.ToUri() ?? Address.AssinadorApiBeta; + Address.Card = text5?.ToUri() ?? Address.Card; + Address.Assistance = text6?.ToUri() ?? Address.Assistance; + Address.ApiAD = text7?.ToUri() ?? Address.ApiAD; + Address.ApiArquivo = text8?.ToUri() ?? Address.ApiArquivo; + Address.ApiFipe = text9?.ToUri() ?? Address.ApiFipe; + Address.ApiSso = text10?.ToUri() ?? Address.ApiSso; + Address.ApiMonitor = text12?.ToUri() ?? Address.ApiMonitor; + Address.ApiCep = text11?.ToUri() ?? Address.ApiCep; + Address.LoginJson = text13?.ToUri() ?? Address.LoginJson; + Address.SurveyJson = text16?.ToUri() ?? Address.SurveyJson; + Address.Promo = text14?.ToUri() ?? Address.Promo; + Address.BetaPromo = text15?.ToUri() ?? Address.BetaPromo; + Address.CentralAtendimento = text17?.ToUri() ?? Address.CentralAtendimento; + return true; + } + } + finally + { + ((IDisposable)client)?.Dispose(); + } + } + catch + { + } + return false; + } +} diff --git a/Decompiler/Gestor.Application.ViewModels/MainViewModel.cs b/Decompiler/Gestor.Application.ViewModels/MainViewModel.cs new file mode 100644 index 0000000..f9a9093 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels/MainViewModel.cs @@ -0,0 +1,1061 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Threading; +using Gestor.Application.Actions; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.Servicos.Ferramentas; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.ViewModels.Generic; +using Gestor.Application.ViewModels.Seguros; +using Gestor.Application.Views.Financeiro; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Card; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.License; + +namespace Gestor.Application.ViewModels; + +public class MainViewModel : BaseSegurosViewModel +{ + public FinanceiroView FinanceiroView; + + public ConsultaViewModel ConsultaViewModel; + + public ClienteViewModel ClienteViewModel; + + private readonly ClienteServico _servico; + + public DashboardViewModel DashboardViewModel; + + private List<Payment> _boletos; + + private BitmapImage _qrCode; + + private string _code; + + private Geometry _maximizeRestore = Geometry.Parse((string)Application.Current.Resources[(object)"Restore"]); + + private object _content; + + private double _headMaxWidth; + + private string _head; + + private string _tela; + + private TipoTela? _telaAberta; + + private string _versao; + + private long _selectedRamo = 5L; + + public bool PesquisaAvançada; + + private Cliente _selectedCliente; + + private bool _isEnableDocumento; + + private bool _isEnableItens; + + private TipoDocumento _tipoDocumento; + + private string _documentoPrincipal = ""; + + private ObservableCollection<AjudaTela> _ajuda = new ObservableCollection<AjudaTela>(); + + private bool _matrizFilial = LicenseHelper.Produtos.Any((Licenca x) => (int)x.Produto == 2 && x.Status == 1); + + private readonly bool _temEpic = LicenseHelper.Produtos.Any((Licenca produto) => (int)produto.Produto == 83 && produto.Status == 1); + + private bool _carregandoAjuda; + + private string _empresa = ""; + + private ObservableCollection<Contato> _contatos = new ObservableCollection<Contato>(); + + private int _liquido; + + private int _mediaComissao; + + private int _resultado; + + private Visibility _visibleChaveInstalacao = (Visibility)2; + + private Visibility _visibleSeguros = (Visibility)2; + + private Visibility _visibleBi = (Visibility)2; + + private FiltroStatusDocumento _selectedStatus; + + private TipoFiltroCliente _selectedFiltroCliente = (TipoFiltroCliente)1; + + private bool _buscaNome = true; + + private bool _enableSeguros; + + private bool _enableBuscar; + + private Visibility _visibilityVoltar = (Visibility)2; + + private int _notasBadge; + + private int _tarefasBadge; + + private int _badges; + + private int _ultimoUpdate; + + private Visibility _mensagemTarefasVisibility = (Visibility)2; + + private string _mensagemTarefas = ""; + + private string _pesquisa = ""; + + private int _medalhaCor; + + private Visibility _medalhaVisibility = (Visibility)2; + + private string _placeHolderAutoComplete = "PESQUISAR CLIENTE POR NOME OU NOME SOCIAL"; + + public static string ViewAberta { get; set; } + + public static Cliente ClienteSelecionado { get; set; } + + public static FiltroStatusDocumento StatusSelecionado { get; set; } + + public List<Payment> Boletos + { + get + { + return _boletos; + } + set + { + _boletos = value; + OnPropertyChanged("Boletos"); + } + } + + public BitmapImage QrCode + { + get + { + return _qrCode; + } + set + { + _qrCode = value; + OnPropertyChanged("QrCode"); + } + } + + public string Code + { + get + { + return _code; + } + set + { + _code = value; + OnPropertyChanged("Code"); + } + } + + public Geometry MaximizeRestore + { + get + { + return _maximizeRestore; + } + set + { + _maximizeRestore = value; + OnPropertyChanged("MaximizeRestore"); + } + } + + public object Content + { + get + { + return _content; + } + set + { + _content = value; + OnPropertyChanged("Content"); + } + } + + public double HeadMaxWidth + { + get + { + return _headMaxWidth; + } + set + { + _headMaxWidth = value; + OnPropertyChanged("HeadMaxWidth"); + } + } + + public string Head + { + get + { + return _head; + } + set + { + _head = value; + OnPropertyChanged("Head"); + } + } + + public string Tela + { + get + { + return _tela; + } + set + { + _tela = value; + OnPropertyChanged("Tela"); + } + } + + public TipoTela? TelaAberta + { + get + { + return _telaAberta; + } + set + { + _telaAberta = value; + OnPropertyChanged("TelaAberta"); + } + } + + public string Versao + { + get + { + return _versao; + } + set + { + _versao = value; + OnPropertyChanged("Versao"); + } + } + + public long SelectedRamo + { + get + { + return _selectedRamo; + } + set + { + _selectedRamo = value; + OnPropertyChanged("SelectedRamo"); + } + } + + public bool Invoke { get; set; } = true; + + + public Cliente SelectedCliente + { + get + { + return _selectedCliente; + } + set + { + if (Invoke) + { + if (value != null) + { + long id = ((DomainBase)value).Id; + Cliente selectedCliente = SelectedCliente; + if (id == ((selectedCliente != null) ? new long?(((DomainBase)selectedCliente).Id) : null)) + { + goto IL_004a; + } + } + ClienteSelecionado = value; + } + goto IL_004a; + IL_004a: + _selectedCliente = value; + OnPropertyChanged("SelectedCliente"); + } + } + + public bool Isdropped { get; set; } + + public bool IsPopulating { get; set; } + + public List<Cliente> ClientesFiltrados { get; set; } + + public bool IsEnableDocumento + { + get + { + return _isEnableDocumento; + } + set + { + _isEnableDocumento = value; + OnPropertyChanged("IsEnableDocumento"); + } + } + + public bool IsEnableItens + { + get + { + return _isEnableItens; + } + set + { + _isEnableItens = value; + OnPropertyChanged("IsEnableItens"); + } + } + + public TipoDocumento TipoDocumento + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _tipoDocumento; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _tipoDocumento = value; + OnPropertyChanged("TipoDocumento"); + } + } + + public string DocumentoPrincipal + { + get + { + return _documentoPrincipal; + } + set + { + _documentoPrincipal = value; + OnPropertyChanged("DocumentoPrincipal"); + } + } + + public ObservableCollection<AjudaTela> Ajuda + { + get + { + return _ajuda; + } + set + { + _ajuda = value; + OnPropertyChanged("Ajuda"); + } + } + + public bool MatrizFilial + { + get + { + return _matrizFilial; + } + set + { + _matrizFilial = value; + OnPropertyChanged("MatrizFilial"); + } + } + + public Visibility TemEpic + { + get + { + if (_temEpic) + { + return (Visibility)0; + } + return (Visibility)2; + } + } + + public bool CarregandoAjuda + { + get + { + return _carregandoAjuda; + } + set + { + _carregandoAjuda = value; + OnPropertyChanged("CarregandoAjuda"); + } + } + + public string Empresa + { + get + { + return _empresa; + } + set + { + _empresa = value; + OnPropertyChanged("Empresa"); + } + } + + public ObservableCollection<Contato> Contatos + { + get + { + return _contatos; + } + set + { + _contatos = value; + OnPropertyChanged("Contatos"); + } + } + + public List<VendedorUsuario> VendedorUsuario { get; set; } + + public Visibility VisibleChaveInstalacao + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibleChaveInstalacao; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibleChaveInstalacao = value; + OnPropertyChanged("VisibleChaveInstalacao"); + } + } + + public Visibility VisibleSeguros + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibleSeguros; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibleSeguros = value; + OnPropertyChanged("VisibleSeguros"); + } + } + + public Visibility VisibleBi + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibleBi; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibleBi = value; + OnPropertyChanged("VisibleBi"); + } + } + + public FiltroStatusDocumento SelectedStatus + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _selectedStatus; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + //IL_0008: Unknown result type (might be due to invalid IL or missing references) + _selectedStatus = value; + WorkOnSelectedStatus(value); + OnPropertyChanged("SelectedStatus"); + } + } + + public TipoFiltroCliente SelectedFiltroCliente + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _selectedFiltroCliente; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + //IL_0008: Unknown result type (might be due to invalid IL or missing references) + //IL_000a: Invalid comparison between Unknown and I4 + //IL_0013: Unknown result type (might be due to invalid IL or missing references) + _selectedFiltroCliente = value; + BuscaNome = (int)value == 1; + PlaceHolderAutoComplete = (((int)_selectedFiltroCliente == 0) ? "PESQUISAR CLIENTE POR NOME OU SOBRENOME" : "PESQUISAR CLIENTE POR NOME OU DOCUMENTO"); + OnPropertyChanged("SelectedFiltroCliente"); + } + } + + public bool BuscaNome + { + get + { + return _buscaNome; + } + set + { + _buscaNome = value; + OnPropertyChanged("BuscaNome"); + } + } + + public bool EnableSeguros + { + get + { + return _enableSeguros; + } + set + { + _enableSeguros = value; + OnPropertyChanged("EnableSeguros"); + } + } + + public bool EnableBuscar + { + get + { + return _enableBuscar; + } + set + { + _enableBuscar = value; + OnPropertyChanged("EnableBuscar"); + } + } + + public Visibility VisibilityVoltar + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityVoltar; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityVoltar = value; + OnPropertyChanged("VisibilityVoltar"); + } + } + + public int NotasBadge + { + get + { + return _notasBadge; + } + set + { + _notasBadge = value; + Badges = value + TarefasBadge; + OnPropertyChanged("NotasBadge"); + } + } + + public int TarefasBadge + { + get + { + return _tarefasBadge; + } + set + { + _tarefasBadge = value; + Badges = value + NotasBadge; + OnPropertyChanged("TarefasBadge"); + } + } + + public int Badges + { + get + { + return _badges; + } + set + { + _badges = value; + OnPropertyChanged("Badges"); + } + } + + public Visibility MensagemTarefasVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _mensagemTarefasVisibility; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _mensagemTarefasVisibility = value; + OnPropertyChanged("MensagemTarefasVisibility"); + } + } + + public string MensagemTarefas + { + get + { + return _mensagemTarefas; + } + set + { + _mensagemTarefas = value; + OnPropertyChanged("MensagemTarefas"); + } + } + + public string Pesquisa + { + get + { + return _pesquisa; + } + set + { + _pesquisa = value; + OnPropertyChanged("Pesquisa"); + } + } + + public int MedalhaCor + { + get + { + return _medalhaCor; + } + set + { + _medalhaCor = value; + OnPropertyChanged("MedalhaCor"); + } + } + + public Visibility MedalhaVisibility + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _medalhaVisibility; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _medalhaVisibility = value; + OnPropertyChanged("MedalhaVisibility"); + } + } + + public string PlaceHolderAutoComplete + { + get + { + return _placeHolderAutoComplete; + } + set + { + _placeHolderAutoComplete = value; + OnPropertyChanged("PlaceHolderAutoComplete"); + } + } + + public List<Cliente> ClientesEncontrados { get; set; } + + public MainViewModel() + { + //IL_00bf: Unknown result type (might be due to invalid IL or missing references) + //IL_00c6: Unknown result type (might be due to invalid IL or missing references) + //IL_00cd: Unknown result type (might be due to invalid IL or missing references) + //IL_00d4: Unknown result type (might be due to invalid IL or missing references) + //IL_00e2: Unknown result type (might be due to invalid IL or missing references) + //IL_00e9: Unknown result type (might be due to invalid IL or missing references) + //IL_0106: Unknown result type (might be due to invalid IL or missing references) + //IL_0225: Unknown result type (might be due to invalid IL or missing references) + //IL_0254: Unknown result type (might be due to invalid IL or missing references) + Gestor.Application.Actions.Actions.AtualizaBadges = AtualizarBadges; + Gestor.Application.Actions.Actions.LimparCliente = LimparCliente; + _servico = new ClienteServico(); + Gestor.Application.Actions.Actions.UpdateDocumento = (Action<Documento>)Delegate.Combine(Gestor.Application.Actions.Actions.UpdateDocumento, new Action<Documento>(UpdateRamoIcon)); + Gestor.Application.Actions.Actions.SelectCliente = (Action<Cliente>)Delegate.Combine(Gestor.Application.Actions.Actions.SelectCliente, new Action<Cliente>(SelectCliente)); + Gestor.Application.Actions.Actions.AtualizaContatos = (Action)Delegate.Combine(Gestor.Application.Actions.Actions.AtualizaContatos, new Action(AtualizarContatos)); + Gestor.Application.Actions.Actions.EnableItens = (Action<bool>)Delegate.Combine(Gestor.Application.Actions.Actions.EnableItens, new Action<bool>(EnableItens)); + Gestor.Application.Actions.Actions.EnableDocumento = (Action<bool>)Delegate.Combine(Gestor.Application.Actions.Actions.EnableDocumento, new Action<bool>(EnableDocumento)); + Versao = Recursos.Empresa.Nome + " | " + LoginViewModel.VersaoAtual; + Usuario usuario = Recursos.Usuario; + SelectedFiltroCliente = ((usuario != null) ? usuario.FiltroInicial : null).GetValueOrDefault(); + new DispatcherTimer(TimeSpan.FromHours(1.0), (DispatcherPriority)4, (EventHandler)delegate + { + AtualizarBadges(); + }, ((DispatcherObject)Application.Current).Dispatcher).Start(); + } + + private void SelectCliente(Cliente cliente) + { + SelectedCliente = cliente; + if (Pesquisa != ((cliente == null) ? null : cliente.NomeSocial?.Trim())) + { + Pesquisa = ((cliente == null) ? null : cliente.NomeSocial?.Trim()); + } + } + + private void EnableItens(bool enabled) + { + IsEnableItens = enabled; + } + + private void EnableDocumento(bool enabled) + { + IsEnableDocumento = enabled; + } + + public async Task SelecionarCliente(Cliente value) + { + IsEnableDocumento = false; + IsEnableItens = false; + LimparDocumentos(); + if (value != null) + { + if (Invoke) + { + ClienteSelecionado = value; + } + await WorkOnSelectedCliente(value); + IsEnableDocumento = true; + } + } + + private async Task WorkOnSelectedCliente(Cliente value) + { + base.IsEnabled = false; + List<Contato> contatos = new List<Contato>(); + ObservableCollection<ClienteTelefone> telefones = await _servico.BuscarTelefonesAsync(((DomainBase)value).Id); + ObservableCollection<ClienteEmail> observableCollection = await _servico.BuscarEmailsAsync(((DomainBase)value).Id); + if (telefones != null) + { + contatos.AddRange(((IEnumerable<ClienteTelefone>)telefones).Select((Func<ClienteTelefone, Contato>)((ClienteTelefone x) => new Contato + { + Tipo = (TipoContato)0, + TipoTelefone = ((TelefoneBase)x).Tipo.GetValueOrDefault((TipoTelefone)1), + Numero = ((TelefoneBase)x).Prefixo + " " + ((TelefoneBase)x).Numero + })).Take(2).ToList()); + } + if (observableCollection != null) + { + contatos.AddRange(((IEnumerable<ClienteEmail>)observableCollection).Select((Func<ClienteEmail, Contato>)((ClienteEmail x) => new Contato + { + Tipo = (TipoContato)1, + TipoTelefone = null, + Numero = ((EmailBase)x).Email + })).Take(1).ToList()); + } + Contatos = new ObservableCollection<Contato>(contatos); + TipoDocumento = value.DocumentoPrincipal.GetValueOrDefault(); + MainViewModel mainViewModel = this; + Empresa? obj = ((IEnumerable<Empresa>)Recursos.Empresas).FirstOrDefault((Func<Empresa, bool>)((Empresa x) => ((DomainBase)x).Id == value.IdEmpresa)); + mainViewModel.Empresa = ((obj != null) ? obj.Nome : null) ?? Recursos.Empresa.Nome; + TipoDocumento tipoDocumento = TipoDocumento; + switch ((int)tipoDocumento) + { + case 0: + DocumentoPrincipal = value.Documento ?? ""; + break; + case 1: + DocumentoPrincipal = value.Rne ?? ""; + break; + case 2: + DocumentoPrincipal = value.Cei ?? ""; + break; + case 3: + DocumentoPrincipal = value.Caepf ?? ""; + break; + } + if (ClienteSelecionado != null) + { + ClienteSelecionado.Telefones = telefones; + ClienteSelecionado.Emails = observableCollection; + } + string viewAberta = ViewAberta; + if (!(viewAberta == "ConsultaOriginalView")) + { + if (viewAberta == "ClienteView") + { + ClienteViewModel?.SelecionaCliente(SelectedCliente); + MainViewModel mainViewModel2 = this; + string descricao = "ACESSOU CLIENTE \"" + SelectedCliente.Nome + "\""; + long id = ((DomainBase)SelectedCliente).Id; + TipoTela? tela = (TipoTela)1; + Cliente selectedCliente = SelectedCliente; + mainViewModel2.RegistrarAcao(descricao, id, tela, $"ID CLIENTE: {((selectedCliente != null) ? new long?(((DomainBase)selectedCliente).Id) : null)}"); + } + } + else if (ConsultaViewModel != null) + { + await (ConsultaViewModel?.SelecionaCliente(value)); + AtualizarMedalha(ConsultaViewModel.Apolices.ToList()); + } + base.IsEnabled = true; + MainViewModel mainViewModel3 = this; + Cliente selectedCliente2 = SelectedCliente; + mainViewModel3.Pesquisa = ((selectedCliente2 != null) ? selectedCliente2.NomeSocial : null); + } + + private async void AtualizarMedalha(List<Documento> apolices) + { + Qualificacao val = await _servico.BuscarQualificacaoAsync(); + if (((DomainBase)val).Id == 0L) + { + val = new Qualificacao + { + Liquido1 = 0m, + Liquido2 = 1000m, + Liquido3 = 5000m, + Comissao1 = 10m, + Comissao2 = 15m, + Comissao3 = 20m, + Resultado1 = 100m, + Resultado2 = 200m, + Resultado3 = 300m, + Id = 1L + }; + } + _liquido = 0; + _mediaComissao = 0; + _resultado = 0; + decimal num = apolices.Sum((Documento p) => p.PremioLiquido); + if (num >= val.Liquido3) + { + _liquido = 3; + } + else if (num >= val.Liquido2) + { + _liquido = 2; + } + else if (num >= val.Liquido1) + { + _liquido = 1; + } + decimal num2 = (apolices.Any((Documento c) => c.Comissao > 0m) ? decimal.Round(apolices.Sum((Documento c) => c.Comissao) / (decimal)apolices.Count((Documento c) => c.Comissao > 0m), 2) : 0m); + if (num2 >= val.Comissao3) + { + _mediaComissao = 3; + } + else if (num2 >= val.Comissao2) + { + _mediaComissao = 2; + } + else if (num2 >= val.Comissao1) + { + _mediaComissao = 1; + } + decimal num3 = apolices.Sum((Documento p) => (p.PremioLiquido + (p.AdicionalComiss ? p.PremioAdicional : 0m)) * p.Comissao * 0.01m); + if (num3 >= val.Resultado3) + { + _resultado = 3; + } + else if (num3 >= val.Resultado2) + { + _resultado = 2; + } + else if (num3 >= val.Resultado1) + { + _resultado = 1; + } + MedalhaCor = (int)Math.Round(((float)_liquido + (float)_mediaComissao + (float)_resultado) / 3f); + MedalhaVisibility = (Visibility)0; + } + + public async void Medalha() + { + await ShowMedalha(_liquido, _mediaComissao, _resultado, MedalhaCor); + } + + private async void AtualizarContatos() + { + List<Contato> contatos = new List<Contato>(); + if (SelectedCliente == null) + { + return; + } + ObservableCollection<ClienteTelefone> telefones = await _servico.BuscarTelefonesAsync(((DomainBase)SelectedCliente).Id); + ObservableCollection<ClienteEmail> observableCollection = await _servico.BuscarEmailsAsync(((DomainBase)SelectedCliente).Id); + if (telefones != null) + { + contatos.AddRange(((IEnumerable<ClienteTelefone>)telefones).Select((Func<ClienteTelefone, Contato>)((ClienteTelefone x) => new Contato + { + Tipo = (TipoContato)0, + TipoTelefone = ((TelefoneBase)x).Tipo.GetValueOrDefault((TipoTelefone)1), + Numero = ((TelefoneBase)x).Prefixo + " " + ((TelefoneBase)x).Numero + })).Take(2).ToList()); + } + if (observableCollection != null) + { + contatos.AddRange(((IEnumerable<ClienteEmail>)observableCollection).Select((Func<ClienteEmail, Contato>)((ClienteEmail x) => new Contato + { + Tipo = (TipoContato)1, + TipoTelefone = null, + Numero = ((EmailBase)x).Email + })).Take(1).ToList()); + } + Contatos = new ObservableCollection<Contato>(contatos); + } + + private void WorkOnSelectedStatus(FiltroStatusDocumento value) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + StatusSelecionado = value; + if (SelectedCliente == null || !Invoke) + { + return; + } + string viewAberta = ViewAberta; + if (!(viewAberta == "ConsultaOriginalView")) + { + if (viewAberta == "ClienteView") + { + ClienteViewModel?.SelecionaCliente(SelectedCliente); + } + } + else + { + ConsultaViewModel?.SelecionarCliente(SelectedCliente); + } + } + + private void UpdateRamoIcon(Documento documento) + { + if (documento != null && ((DomainBase)documento).Id != 0L) + { + SelectedRamo = ((DomainBase)documento.Controle.Ramo).Id; + } + } + + private async void AtualizarBadges() + { + try + { + int[] array = await new TarefaServico().AtualizarNotasTarefas(); + NotasBadge = array[0]; + TarefasBadge = array[1]; + if (array[1] > _ultimoUpdate) + { + MensagemTarefas = string.Format("{0} NOVA{1} TAREFA{2}", array[1], (array[1] > 1) ? "S" : "", (array[1] > 1) ? "S" : ""); + MensagemTarefasVisibility = (Visibility)0; + } + _ultimoUpdate = array[1]; + } + catch + { + } + } + + public async void LimparDocumentos() + { + Contatos = null; + DocumentoPrincipal = ""; + string viewAberta = ViewAberta; + if (!(viewAberta == "ConsultaOriginalView")) + { + if (viewAberta == "ClienteView") + { + ClienteViewModel?.SelecionaCliente(null); + } + } + else if (ConsultaViewModel != null) + { + await (ConsultaViewModel?.SelecionaCliente(null)); + } + } + + private void LimparCliente() + { + SelectedCliente = null; + Contatos = null; + DocumentoPrincipal = ""; + Pesquisa = ""; + } + + public async Task CarregarAjuda() + { + if (TelaAberta.HasValue && !Ajuda.Any((AjudaTela x) => (TipoTela?)x.Tela == TelaAberta)) + { + CarregandoAjuda = true; + Ajuda = new ObservableCollection<AjudaTela>(await Connection.Get<List<AjudaTela>>($"Help/{(int)TelaAberta.Value}")); + CarregandoAjuda = false; + } + } + + public List<Cliente> FiltrarClientes(string value) + { + return FilterCliente(ClientesEncontrados, value); + } + + public async void VerificarLogo() + { + if (string.IsNullOrEmpty(Recursos.Empresa.LogoId) && Recursos.Empresa.Logo != null) + { + Logo val = new Logo + { + CustomId = ApplicationHelper.NumeroSerial, + Data = Recursos.Empresa.Logo + }; + Empresa empresa = Recursos.Empresa; + empresa.LogoId = await Funcoes.Criarlogo(val); + new EmpresaServico().AtualizarLogoId(((DomainBase)Recursos.Empresa).Id, Recursos.Empresa.LogoId); + } + } +} diff --git a/Decompiler/Gestor.Application.ViewModels/MenuBIViewModel.cs b/Decompiler/Gestor.Application.ViewModels/MenuBIViewModel.cs new file mode 100644 index 0000000..1f33a00 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels/MenuBIViewModel.cs @@ -0,0 +1,7 @@ +using Gestor.Application.ViewModels.Generic; + +namespace Gestor.Application.ViewModels; + +public class MenuBIViewModel : BaseSegurosViewModel +{ +} diff --git a/Decompiler/Gestor.Application.ViewModels/MenuFerramentasViewModel.cs b/Decompiler/Gestor.Application.ViewModels/MenuFerramentasViewModel.cs new file mode 100644 index 0000000..2193e34 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels/MenuFerramentasViewModel.cs @@ -0,0 +1,79 @@ +using System.Windows; +using Gestor.Application.ViewModels.Ferramentas; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels; + +internal class MenuFerramentasViewModel : BaseSegurosViewModel +{ + private Usuario _selectedUsuario = new Usuario(); + + private Visibility _visibilityUsuario; + + private Visibility _visibilityEmpresa; + + private object _content; + + public UsuarioViewModel UsuarioViewModel { get; set; } + + public static Usuario UsuarioSelecionado { get; set; } + + public Usuario SelectedUsuario + { + get + { + return _selectedUsuario; + } + set + { + _selectedUsuario = value; + OnPropertyChanged("SelectedUsuario"); + } + } + + public Visibility VisibilityUsuario + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityUsuario; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityUsuario = value; + OnPropertyChanged("VisibilityUsuario"); + } + } + + public Visibility VisibilityEmpresa + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityEmpresa; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityEmpresa = value; + OnPropertyChanged("VisibilityEmpresa"); + } + } + + public object Content + { + get + { + return _content; + } + set + { + _content = value; + OnPropertyChanged("Content"); + } + } +} diff --git a/Decompiler/Gestor.Application.ViewModels/MenuItemViewModel.cs b/Decompiler/Gestor.Application.ViewModels/MenuItemViewModel.cs new file mode 100644 index 0000000..10e8bf1 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels/MenuItemViewModel.cs @@ -0,0 +1,798 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; +using Gestor.Application.Actions; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Seguros.Itens; +using Gestor.Application.ViewModels.Generic; +using Gestor.Application.ViewModels.Seguros; +using Gestor.Application.Views.Seguros.Itens; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels; + +public class MenuItemViewModel : BaseSegurosViewModel +{ + private readonly ItemServico _servico; + + private string _acaoItens = "MANTER"; + + private readonly Documento _documentoSelecionado; + + public bool AlterandoSelectedItem; + + private bool _endossoRenovacao; + + private ObservableCollection<Item> _itens = new ObservableCollection<Item>(); + + private ObservableCollection<Item> _itensFiltrados = new ObservableCollection<Item>(); + + private Item _selectedItem = new Item(); + + private bool _mostrarLista; + + private bool _isExpanded = true; + + private ManutencaoItem _manutencao; + + private object _view; + + private bool _allSelectedChanging; + + private bool? _allSelected = false; + + private string _manterTodosText = "MANTER TODOS OS ITENS"; + + private string _manterText = "MANTER ITENS"; + + public long Ramo { get; set; } + + public bool EndossoRenovacao + { + get + { + return _endossoRenovacao; + } + set + { + _endossoRenovacao = value; + OnPropertyChanged("EndossoRenovacao"); + } + } + + public ObservableCollection<Item> Itens + { + get + { + return _itens; + } + set + { + _itens = value; + OnPropertyChanged("Itens"); + } + } + + public ObservableCollection<Item> ItensFiltrados + { + get + { + return _itensFiltrados; + } + set + { + _itensFiltrados = value; + IsExpanded = value != null && value.Count > 0; + foreach (Item itensFiltrado in ItensFiltrados) + { + itensFiltrado.PropertyChanged += EntryOnPropertyChanged; + } + OnPropertyChanged("ItensFiltrados"); + } + } + + public Item SelectedItem + { + get + { + return _selectedItem; + } + set + { + WorkOnSelectedItem(value); + _selectedItem = value; + OnPropertyChanged("SelectedItem"); + } + } + + public bool MostrarLista + { + get + { + return _mostrarLista; + } + set + { + _mostrarLista = value; + OnPropertyChanged("MostrarLista"); + } + } + + public bool IsExpanded + { + get + { + return _isExpanded; + } + set + { + _isExpanded = value; + OnPropertyChanged("IsExpanded"); + } + } + + public ManutencaoItem Manutencao + { + get + { + return _manutencao; + } + set + { + _manutencao = value; + OnPropertyChanged("Manutencao"); + } + } + + public object View + { + get + { + return _view; + } + set + { + _view = value; + OnPropertyChanged("View"); + } + } + + private bool Carregando { get; set; } + + public bool? AllSelected + { + get + { + return _allSelected; + } + set + { + if (value != _allSelected) + { + _allSelected = value; + AllSelectedChanged(); + Itens = new ObservableCollection<Item>(Itens); + OnPropertyChanged("AllSelected"); + } + } + } + + public string ManterTodosText + { + get + { + return _manterTodosText; + } + set + { + _manterTodosText = value; + OnPropertyChanged("ManterTodosText"); + } + } + + public string ManterText + { + get + { + return _manterText; + } + set + { + _manterText = value; + OnPropertyChanged("ManterText"); + } + } + + public MenuItemViewModel(long ramo, ManutencaoItem manutencao) + { + //IL_0022: Unknown result type (might be due to invalid IL or missing references) + //IL_002c: Expected O, but got Unknown + //IL_00e0: Unknown result type (might be due to invalid IL or missing references) + //IL_00e6: Invalid comparison between Unknown and I4 + if (ramo == 6 || ramo == 7 || ramo == 9 || ramo == 10 || ramo == 53 || ramo == 66) + { + _acaoItens = "MOVER"; + } + _manterTodosText = _acaoItens + " TODOS OS ITENS"; + _manterText = _acaoItens + " ITEM"; + Ramo = ramo; + _servico = new ItemServico(); + _documentoSelecionado = ((manutencao == null) ? ConsultaViewModel.DocumentoSelecionado : manutencao.Documento); + if (manutencao != null && (int)manutencao.Tipo == 2) + { + ConsultaViewModel.FiltrarItens = 4; + } + Seleciona(manutencao == null); + if (manutencao != null) + { + Manutencao = manutencao; + MostrarLista = true; + } + } + + public async void Seleciona(bool item = true) + { + if (!item || ConsultaViewModel.ItemSelecionado != null) + { + await SelecionaItens(ConsultaViewModel.FiltrarItens, ConsultaViewModel.ItemSelecionado); + } + else + { + Load(); + } + } + + public async void RecarregarItens(Item item) + { + ManutencaoItem manutencao = Manutencao; + if (manutencao != null && (int)manutencao.Tipo == 0) + { + ItensFiltrados.Remove(SelectedItem); + Itens.Remove(SelectedItem); + if (ItensFiltrados.Count == 0) + { + Gestor.Application.Actions.Actions.AcessaTela?.Invoke((TipoTela)21, ""); + return; + } + AllSelected = false; + ManterTodosText = _acaoItens + " TODOS OS ITENS"; + SelecionaItem(ItensFiltrados.First()); + return; + } + ManutencaoItem manutencao2 = Manutencao; + if (manutencao2 != null && (int)manutencao2.Tipo == 2) + { + ConsultaViewModel.FiltrarItens = 4; + } + await SelecionaItens(ConsultaViewModel.FiltrarItens, (Item)(((object)item) ?? ((object)new Item + { + Id = 0L + }))); + AlterandoSelectedItem = true; + SelectedItem = (Item)((item != null) ? ((object)(((IEnumerable<Item>)Itens).FirstOrDefault((Func<Item, bool>)((Item x) => ((DomainBase)x).Id == ((DomainBase)item).Id)) ?? Itens.FirstOrDefault())) : ((object)((Itens.Count > 0) ? Itens[0] : null))); + AlterandoSelectedItem = false; + } + + public async Task SelecionaItens(int type, Item item = null) + { + Loading(isLoading: true); + Carregando = true; + switch (type) + { + default: + Itens = await _servico.BuscarItens(((DomainBase)_documentoSelecionado.Controle).Id, (StatusItem)0); + break; + case 1: + case 2: + Itens = await _servico.BuscarItens(((DomainBase)_documentoSelecionado).Id, (StatusItem)2); + break; + case 3: + Itens = await _servico.BuscarItens(((DomainBase)_documentoSelecionado.Controle).Id, (StatusItem)1); + break; + case 4: + Itens = await _servico.BuscarItens(((DomainBase)_documentoSelecionado.Controle).Id, (StatusItem)3); + break; + } + ItensFiltrados = Itens; + if (item != null && ((DomainBase)item).Id > 0) + { + AlterandoSelectedItem = true; + SelectedItem = ((ItensFiltrados != null && ItensFiltrados.Count > 0) ? ((IEnumerable<Item>)ItensFiltrados).FirstOrDefault((Func<Item, bool>)((Item x) => ((DomainBase)x).Id == ((DomainBase)item).Id)) : null); + Gestor.Application.Actions.Actions.ScrollToItem?.Invoke(); + AlterandoSelectedItem = false; + } + MenuItemViewModel menuItemViewModel = this; + int mostrarLista; + if (!MostrarLista) + { + ObservableCollection<Item> itens = Itens; + mostrarLista = ((itens != null && itens.Count > 1) ? 1 : 0); + } + else + { + mostrarLista = 1; + } + menuItemViewModel.MostrarLista = (byte)mostrarLista != 0; + Carregando = false; + Loading(isLoading: false); + } + + private void WorkOnSelectedItem(Item value) + { + ConsultaViewModel.ItemSelecionado = value; + Load(); + } + + private async void Load(bool substituir = false, ManutencaoItem manutencao = null) + { + long ramo = Ramo; + if (ramo <= 38) + { + long num = ramo - 1; + if ((ulong)num <= 19uL) + { + switch (num) + { + case 4L: + goto IL_00f3; + case 0L: + case 1L: + case 2L: + case 14L: + case 17L: + goto IL_01e8; + case 12L: + goto IL_02dd; + case 19L: + goto IL_03d2; + case 5L: + case 6L: + case 8L: + case 9L: + goto IL_04c7; + case 3L: + case 7L: + case 10L: + case 11L: + case 13L: + case 15L: + case 16L: + case 18L: + goto IL_06b1; + } + } + if (ramo == 30) + { + goto IL_01e8; + } + long num2 = ramo - 36; + if ((ulong)num2 <= 2uL) + { + switch (num2) + { + case 1L: + break; + case 2L: + goto IL_01e8; + case 0L: + goto IL_05bc; + default: + goto IL_06b1; + } + goto IL_00f3; + } + } + else if (ramo == 47 || ramo == 53 || ramo == 66) + { + goto IL_04c7; + } + goto IL_06b1; + IL_00f3: + if (View != null && View.GetType() == typeof(AutoView)) + { + await ((AutoView)View).Selecionar(ConsultaViewModel.ItemSelecionado); + if (substituir) + { + ((AutoView)View).Substituir(); + } + if (manutencao != null) + { + ((AutoView)View).Manter(manutencao); + } + return; + } + View = new AutoView(this, lockInsert: false, substituir, manutencao, null, null, EndossoRenovacao); + goto IL_079e; + IL_06b1: + if (View != null && View.GetType() == typeof(RiscosDiversosView)) + { + await ((RiscosDiversosView)View).Selecionar(ConsultaViewModel.ItemSelecionado); + if (substituir) + { + ((RiscosDiversosView)View).Substituir(); + } + if (manutencao != null) + { + ((RiscosDiversosView)View).Manter(manutencao); + } + return; + } + View = new RiscosDiversosView(this, lockInsert: false, substituir, manutencao, null, null, EndossoRenovacao); + goto IL_079e; + IL_05bc: + if (View != null && View.GetType() == typeof(ConsorcioView)) + { + await ((ConsorcioView)View).Selecionar(ConsultaViewModel.ItemSelecionado); + if (substituir) + { + ((ConsorcioView)View).Substituir(); + } + if (manutencao != null) + { + ((ConsorcioView)View).Manter(manutencao); + } + return; + } + View = new ConsorcioView(this, lockInsert: false, substituir, manutencao, null, null, EndossoRenovacao); + goto IL_079e; + IL_079e: + base.IsVisible = (Visibility)0; + return; + IL_01e8: + if (View != null && View.GetType() == typeof(PatrimonialView)) + { + await ((PatrimonialView)View).Selecionar(ConsultaViewModel.ItemSelecionado); + if (substituir) + { + ((PatrimonialView)View).Substituir(); + } + if (manutencao != null) + { + ((PatrimonialView)View).Manter(manutencao); + } + return; + } + View = new PatrimonialView(this, lockInsert: false, substituir, manutencao, null, null, EndossoRenovacao); + goto IL_079e; + IL_02dd: + if (View != null && View.GetType() == typeof(AeronauticoView)) + { + await ((AeronauticoView)View).Selecionar(ConsultaViewModel.ItemSelecionado); + if (substituir) + { + ((AeronauticoView)View).Substituir(); + } + if (manutencao != null) + { + ((AeronauticoView)View).Manter(manutencao); + } + return; + } + View = new AeronauticoView(this, lockInsert: false, substituir, manutencao, null, null, EndossoRenovacao); + goto IL_079e; + IL_04c7: + if (View != null && View.GetType() == typeof(VidaView)) + { + await ((VidaView)View).Selecionar(ConsultaViewModel.ItemSelecionado); + if (substituir) + { + ((VidaView)View).Substituir(); + } + if (manutencao != null) + { + ((VidaView)View).Manter(manutencao); + } + return; + } + View = new VidaView(this, lockInsert: false, substituir, manutencao, null, null, EndossoRenovacao); + goto IL_079e; + IL_03d2: + if (View != null && View.GetType() == typeof(GranizoView)) + { + await ((GranizoView)View).Selecionar(ConsultaViewModel.ItemSelecionado); + if (substituir) + { + ((GranizoView)View).Substituir(); + } + if (manutencao != null) + { + ((GranizoView)View).Manter(manutencao); + } + return; + } + View = new GranizoView(this, lockInsert: false, substituir, manutencao, null, null, EndossoRenovacao); + goto IL_079e; + } + + public void SelecionaItem(Item item) + { + if (!Carregando) + { + AlterandoSelectedItem = true; + SelectedItem = item; + ConsultaViewModel.ItemSelecionado = SelectedItem; + AlterandoSelectedItem = false; + } + } + + internal async Task<List<Item>> Filtrar(string value) + { + return await Task.Run(() => FiltrarItem(value)); + } + + public List<Item> FiltrarItem(string filter) + { + ItensFiltrados = (string.IsNullOrWhiteSpace(filter) ? Itens : new ObservableCollection<Item>(from x in Itens + where ValidationHelper.RemoveDiacritics(x.Descricao.Trim()).ToUpper().Contains(ValidationHelper.RemoveDiacritics(filter)) + orderby x.Ordem + select x)); + return ItensFiltrados.ToList(); + } + + public async void CancelarItem(Item item) + { + if (item != null) + { + Loading(isLoading: true); + await _servico.Cancelar(item, $"CANCELADO NO ENDOSSO ORDEM {Manutencao.Documento.Ordem}", ((DomainBase)Manutencao.Documento).Id); + ToggleSnackBar("ITEM CANCELADO COM SUCESSO"); + Loading(isLoading: false); + RecarregarItens(item); + } + } + + public void Substituir(Item item) + { + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: false); + ConsultaViewModel.ItemSelecionado = item; + Load(substituir: true); + } + + public void Manter(Item item) + { + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: false); + ConsultaViewModel.ItemSelecionado = item; + Load(substituir: false, Manutencao); + } + + public async void ManterItens() + { + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: false); + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: false); + Loading(isLoading: true); + int ordem = 1; + foreach (Item item in (ManterTodosText == _acaoItens + " TODOS OS ITENS") ? new List<Item>(Itens) : new List<Item>(Itens.Where((Item x) => x.Selecionado))) + { + Item itemManter = await _servico.BuscarItemPorIdAsync(((DomainBase)item).Id); + Item val = itemManter; + val.Coberturas = await _servico.BuscarCoberturasPorItemAsync(((DomainBase)item).Id); + bool moverTitulares = false; + ((DomainBase)itemManter).Id = 0L; + itemManter.Sinistrado = false; + itemManter.Sinistros = null; + itemManter.Documento = ConsultaViewModel.DocumentoSelecionado; + itemManter.Ordem = ordem; + ordem++; + foreach (Cobertura cobertura in itemManter.Coberturas) + { + ((DomainBase)cobertura).Id = 0L; + cobertura.Item = itemManter; + } + long ramo = Ramo; + if (ramo <= 36) + { + long num = ramo - 1; + if ((ulong)num <= 19uL) + { + switch (num) + { + case 4L: + goto IL_0385; + case 0L: + case 1L: + case 2L: + case 14L: + case 17L: + goto IL_0537; + case 12L: + goto IL_0608; + case 19L: + goto IL_06d9; + case 5L: + case 6L: + case 8L: + case 9L: + goto IL_07aa; + case 3L: + case 7L: + case 10L: + case 11L: + case 13L: + case 15L: + case 16L: + case 18L: + goto IL_0953; + } + } + if (ramo == 36) + { + val = itemManter; + val.Consorcio = await _servico.BuscaConsorcio(((DomainBase)item).Id); + itemManter.Consorcio.Item = itemManter; + ((DomainBase)itemManter.Consorcio).Id = 0L; + goto IL_0a20; + } + } + else + { + if (ramo == 37) + { + goto IL_0385; + } + if (ramo == 53 || ramo == 66) + { + goto IL_07aa; + } + } + goto IL_0953; + IL_0a20: + itemManter.Status = ""; + item.Substituido = null; + itemManter = await _servico.Save(itemManter); + if (moverTitulares && ((DomainBase)itemManter).Id != ((DomainBase)item).Id) + { + List<TitularesVida> list = await _servico.BuscaTitularesVida(((DomainBase)item).Id); + if (list.Count > 0) + { + list.ForEach(delegate(TitularesVida t) + { + t.IdItem = ((DomainBase)itemManter).Id; + }); + await _servico.SaveTitulares(list); + } + } + ItensFiltrados.Remove(item); + Itens.Remove(item); + continue; + IL_07aa: + val = itemManter; + val.Vida = await _servico.BuscaVida(((DomainBase)item).Id); + itemManter.Vida.Item = itemManter; + ((DomainBase)itemManter.Vida).Id = 0L; + moverTitulares = true; + goto IL_0a20; + IL_0385: + val = itemManter; + val.Auto = await _servico.BuscaAuto(((DomainBase)item).Id); + itemManter.Auto.Item = itemManter; + ((DomainBase)itemManter.Auto).Id = 0L; + if (itemManter.Auto != null && itemManter.Auto.Placa == null) + { + await ShowMessage($"ITEM {itemManter.Ordem} ENCONTRADO SEM PLACA."); + Loading(isLoading: false); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: true); + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: true); + return; + } + goto IL_0a20; + IL_0953: + val = itemManter; + val.RiscosDiversos = await _servico.BuscaRiscosDiversos(((DomainBase)item).Id); + itemManter.RiscosDiversos.Item = itemManter; + ((DomainBase)itemManter.RiscosDiversos).Id = 0L; + goto IL_0a20; + IL_06d9: + val = itemManter; + val.Granizo = await _servico.BuscaGranizo(((DomainBase)item).Id); + itemManter.Granizo.Item = itemManter; + ((DomainBase)itemManter.Granizo).Id = 0L; + goto IL_0a20; + IL_0608: + val = itemManter; + val.Aeronautico = await _servico.BuscaAeronautico(((DomainBase)item).Id); + itemManter.Aeronautico.Item = itemManter; + ((DomainBase)itemManter.Aeronautico).Id = 0L; + goto IL_0a20; + IL_0537: + val = itemManter; + val.Patrimonial = await _servico.BuscaPatrimonial(((DomainBase)item).Id); + itemManter.Patrimonial.Item = itemManter; + ((DomainBase)itemManter.Patrimonial).Id = 0L; + goto IL_0a20; + } + Loading(isLoading: false); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: true); + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: true); + if (ItensFiltrados.Count == 0) + { + Gestor.Application.Actions.Actions.AcessaTela?.Invoke((TipoTela)21, ""); + return; + } + AllSelected = false; + ManterTodosText = _acaoItens + " TODOS OS ITENS"; + SelecionaItem(ItensFiltrados.First()); + } + + public async void Reativar(Item item) + { + if (item != null) + { + Loading(isLoading: true); + await _servico.Reativar(item, "ITEM REATIVADO PELO USUARIO " + Recursos.Usuario.Nome); + ToggleSnackBar("ITEM REATIVADO COM SUCESSO"); + Loading(isLoading: false); + RecarregarItens(item); + } + } + + private void AllSelectedChanged() + { + if (_allSelectedChanging) + { + return; + } + try + { + _allSelectedChanging = true; + if (!AllSelected.HasValue) + { + return; + } + ManterTodosText = (AllSelected.Value ? (_acaoItens + " ITENS SELECIONADOS") : (_acaoItens + " TODOS OS ITENS")); + foreach (Item iten in Itens) + { + iten.Selecionado = AllSelected.Value; + } + } + finally + { + _allSelectedChanging = false; + } + } + + private void EntryOnPropertyChanged(object sender, PropertyChangedEventArgs args) + { + if (args.PropertyName == "Selecionado") + { + RecheckAllSelected(); + } + } + + private void RecheckAllSelected() + { + if (_allSelectedChanging) + { + return; + } + try + { + _allSelectedChanging = true; + if (Itens.All((Item e) => e.Selecionado)) + { + AllSelected = true; + ManterTodosText = _acaoItens + " ITENS SELECIONADOS"; + } + else if (Itens.All((Item e) => !e.Selecionado)) + { + AllSelected = false; + ManterTodosText = _acaoItens + " TODOS OS ITENS"; + } + else + { + AllSelected = null; + ManterTodosText = _acaoItens + " ITENS SELECIONADOS"; + } + } + finally + { + _allSelectedChanging = false; + } + } +} diff --git a/Decompiler/Gestor.Application.ViewModels/TrilhaViewModel.cs b/Decompiler/Gestor.Application.ViewModels/TrilhaViewModel.cs new file mode 100644 index 0000000..2c6d1d6 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels/TrilhaViewModel.cs @@ -0,0 +1,259 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using Gestor.Application.Actions; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels; + +public class TrilhaViewModel : BaseSegurosViewModel +{ + private ObservableCollection<Trilha> _trilhas = new ObservableCollection<Trilha>(); + + private ObservableCollection<Fase> _fases = new ObservableCollection<Fase>(); + + private Trilha _selectedTrilha = new Trilha(); + + private Tarefa _selectedTarefa; + + private ObservableCollection<Usuario> _usuarios; + + private Usuario _selectedUsuario = new Usuario(); + + private TarefaServico Servico { get; } + + public ObservableCollection<Trilha> Trilhas + { + get + { + return _trilhas; + } + set + { + _trilhas = value; + OnPropertyChanged("Trilhas"); + } + } + + public ObservableCollection<Fase> Fases + { + get + { + return _fases; + } + set + { + _fases = value; + OnPropertyChanged("Fases"); + } + } + + public Trilha SelectedTrilha + { + get + { + return _selectedTrilha; + } + set + { + _selectedTrilha = value; + OnPropertyChanged("SelectedTrilha"); + } + } + + public Tarefa SelectedTarefa + { + get + { + return _selectedTarefa; + } + set + { + _selectedTarefa = value; + OnPropertyChanged("SelectedTarefa"); + } + } + + public ObservableCollection<Usuario> Usuarios + { + get + { + return _usuarios; + } + set + { + _usuarios = value; + OnPropertyChanged("Usuarios"); + } + } + + public Usuario SelectedUsuario + { + get + { + return _selectedUsuario; + } + set + { + _selectedUsuario = value; + OnPropertyChanged("SelectedUsuario"); + } + } + + public TrilhaViewModel() + { + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + //IL_0021: Expected O, but got Unknown + //IL_0022: Unknown result type (might be due to invalid IL or missing references) + //IL_002c: Expected O, but got Unknown + //IL_0043: Unknown result type (might be due to invalid IL or missing references) + //IL_0048: Unknown result type (might be due to invalid IL or missing references) + //IL_0050: Unknown result type (might be due to invalid IL or missing references) + //IL_0060: Expected O, but got Unknown + Servico = new TarefaServico(); + List<Usuario> list = new List<Usuario> + { + new Usuario + { + Id = 0L, + Nome = "TODOS OS USUÁRIOS" + } + }; + list.AddRange((from x in Recursos.Usuarios + where (Recursos.Usuario.IdEmpresa == 1 || x.IdEmpresa == Recursos.Usuario.IdEmpresa) && !x.Excluido + orderby x.Nome + select x).ToList()); + Usuarios = new ObservableCollection<Usuario>(list); + SelectedUsuario = Usuarios.First(); + Gestor.Application.Actions.Actions.AtualizaTrilhas = (Action)Delegate.Combine(Gestor.Application.Actions.Actions.AtualizaTrilhas, new Action(AtualizarTrilhas)); + CarregaTrilhas(); + } + + public void AtualizarTrilhas() + { + CarregaTrilhas(); + } + + public async void CarregaTrilhas() + { + await CarregarTrilhas(); + } + + public async Task CarregarTrilhas(Trilha trilha = null) + { + List<Trilha> list = await Servico.BuscarTrilhas(); + Trilhas = new ObservableCollection<Trilha>(list); + await CarregarTrilha((trilha != null) ? ((IEnumerable<Trilha>)Trilhas).FirstOrDefault((Func<Trilha, bool>)((Trilha x) => ((DomainBase)x).Id == ((DomainBase)trilha).Id)) : list.FirstOrDefault()); + } + + public async Task CarregarTrilha(Trilha trilha) + { + if (trilha == null || ((DomainBase)trilha).Id == 0L) + { + return; + } + SelectedTrilha = trilha; + List<Tarefa> tarefas = await Servico.BuscarTarefas(((DomainBase)trilha).Id); + List<Fase> obj = await Servico.BuscarFases(((DomainBase)trilha).Id); + Fases = new ObservableCollection<Fase>(); + obj.ForEach(delegate(Fase x) + { + x.Tarefas = tarefas.Where((Tarefa t) => (SelectedUsuario == null || ((DomainBase)SelectedUsuario).Id == 0L || ((DomainBase)SelectedUsuario).Id == ((DomainBase)t.Usuario).Id) && ((DomainBase)t.Fase).Id == ((DomainBase)x).Id && (int)t.Status != 2).ToList(); + Fases.Add(x); + }); + } + + public void Excluir(Fase origem, Tarefa data) + { + Tarefa item = Fases.First((Fase x) => ((DomainBase)x).Id == ((DomainBase)origem).Id).Tarefas.First((Tarefa x) => ((DomainBase)x).Id == ((DomainBase)data).Id); + Fases.First((Fase x) => ((DomainBase)x).Id == ((DomainBase)origem).Id).Tarefas.Remove(item); + } + + public async Task Excluir(Tarefa tarefa) + { + if (((DomainBase)tarefa).Id != 0L && await ShowMessage("DESEJA REALMENTE EXCLUIR A TAREFA " + tarefa.Titulo + "?" + Environment.NewLine + "ESSE PROCEDIMENTO É IRREVERSÍVEL", "SIM", "NÃO")) + { + if (!(await Servico.Excluir(((DomainBase)tarefa).Id))) + { + Alterar(alterar: false); + return; + } + await CarregarTrilha(SelectedTrilha); + Alterar(alterar: false); + } + } + + public void Inserir(Fase origem, Tarefa data, int index, bool aberto = false) + { + data.Aberto = aberto; + data.Fase = origem; + Fases.First((Fase x) => ((DomainBase)x).Id == ((DomainBase)origem).Id).Tarefas.Insert((index != -1) ? index : 0, data); + TrocarFase(data); + } + + public void Update() + { + Fases = new ObservableCollection<Fase>(Fases); + } + + public async Task<List<KeyValuePair<string, string>>> Salvar(Tarefa destino) + { + destino.AgendamentoRetroativo = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 45); + List<KeyValuePair<string, string>> list = destino.Validate(); + if (list.Count > 0) + { + return list; + } + await Servico.Salvar(destino); + if (!Servico.Sucesso) + { + return null; + } + await CarregarTrilha(SelectedTrilha); + return null; + } + + public async Task Salvar(Trilha destino) + { + SelectedTrilha = null; + Fases = null; + List<Fase> fases = destino.Fases; + Trilha trilha = await Servico.Salvar(destino); + if (!Servico.Sucesso) + { + return; + } + if (fases != null) + { + fases.ForEach(delegate(Fase x) + { + x.Trilha = trilha; + }); + await Servico.Salvar(fases); + if (!Servico.Sucesso) + { + return; + } + } + await CarregarTrilhas(trilha); + } + + public async Task Cancelar() + { + await CarregarTrilha(SelectedTrilha); + Alterar(alterar: false); + } + + private async void TrocarFase(Tarefa tarefa) + { + await Servico.Salvar(tarefa); + } +} diff --git a/Decompiler/Gestor.Application.ViewModels/TutorialViewModel.cs b/Decompiler/Gestor.Application.ViewModels/TutorialViewModel.cs new file mode 100644 index 0000000..8cd84c8 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels/TutorialViewModel.cs @@ -0,0 +1,480 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.Servicos.Ajuda; +using Gestor.Application.Servicos.Ferramentas; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Security; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.License; + +namespace Gestor.Application.ViewModels; + +public class TutorialViewModel : BaseViewModel +{ + private bool _fase1; + + private bool _fase2; + + private bool _fase3; + + private string _mensagem = "ESTAMOS PREPARANDO TUDO PRA VOCÊ INICIAR"; + + private string _nome; + + private string _usuario; + + private string _senha; + + private string _confirmacaoSenha; + + private ObservableCollection<Seguradora> _seguradoras = new ObservableCollection<Seguradora>(); + + private ObservableCollection<Ramo> _ramos = new ObservableCollection<Ramo>(); + + private bool _loadingVisibility; + + public bool Fase1 + { + get + { + return _fase1; + } + set + { + _fase1 = value; + OnPropertyChanged("Fase1"); + } + } + + public bool Fase2 + { + get + { + return _fase2; + } + set + { + _fase2 = value; + OnPropertyChanged("Fase2"); + } + } + + public bool Fase3 + { + get + { + return _fase3; + } + set + { + _fase3 = value; + OnPropertyChanged("Fase3"); + } + } + + public string Mensagem + { + get + { + return _mensagem; + } + set + { + _mensagem = value; + OnPropertyChanged("Mensagem"); + } + } + + private long _idUsuario { get; set; } = -1L; + + + public string Nome + { + get + { + return _nome; + } + set + { + _nome = value; + OnPropertyChanged("Nome"); + } + } + + public string Usuario + { + get + { + return _usuario; + } + set + { + _usuario = value; + OnPropertyChanged("Usuario"); + } + } + + public string Senha + { + get + { + return _senha; + } + set + { + _senha = value; + OnPropertyChanged("Senha"); + } + } + + public string ConfirmacaoSenha + { + get + { + return _confirmacaoSenha; + } + set + { + _confirmacaoSenha = value; + OnPropertyChanged("ConfirmacaoSenha"); + } + } + + public ObservableCollection<Seguradora> Seguradoras + { + get + { + return _seguradoras; + } + set + { + _seguradoras = value; + OnPropertyChanged("Seguradoras"); + } + } + + public ObservableCollection<Ramo> Ramos + { + get + { + return _ramos; + } + set + { + _ramos = value; + OnPropertyChanged("Ramos"); + } + } + + private Customer Empresa { get; set; } + + public bool LoadingVisibility + { + get + { + return _loadingVisibility; + } + set + { + _loadingVisibility = value; + OnPropertyChanged("LoadingVisibility"); + } + } + + public TutorialViewModel() + { + base.EnableFields = true; + } + + public async Task IniciarConfiguracoes() + { + base.EnableButtons = false; + ConnectionHelper connectionHelper = new ConnectionHelper(); + EmpresaServico servicoEmpresa = new EmpresaServico(); + Empresa savedEmpresa = await servicoEmpresa.BuscarEmpresaPorId(1L); + Empresa = await Connection.Get<Customer>($"Customer/{ApplicationHelper.IdFornecedor}"); + if (savedEmpresa == null) + { + await servicoEmpresa.Save(Empresa); + } + BaseServico servico = new BaseServico(); + ControleArquivoDigital val = (ControleArquivoDigital)(((object)(await servico.BuscarControle())) ?? ((object)new ControleArquivoDigital + { + Catalogo = Connection.Catalog, + Tabela = "Arquivos" + })); + if (((DomainBase)val).Id == 0L) + { + await servico.SalvarControle(val); + } + VendedorServico vendedorServico = new VendedorServico(); + Vendedor val2 = (Vendedor)(((object)(await vendedorServico.BuscarCorretora())) ?? ((object)new Vendedor + { + IdEmpresa = 1L, + Nome = Empresa.Name, + Ativo = true, + Corretora = true + })); + if (((DomainBase)val2).Id == 0L) + { + Repasse repasse = new Repasse + { + Forma = (FormaRepasse)1, + Incidencia = (TipoIncidencia)1, + Ativo = true, + Tipo = (TipoRepasse)2, + ValorNovo = 0m, + ValorRenovacao = 0m + }; + await vendedorServico.Save(val2, repasse); + if (!vendedorServico.Sucesso) + { + return; + } + } + await new ArquivoDigitalServico().Criar(); + string text = await connectionHelper.AtualizarBanco(); + if (text != null) + { + await ShowMessage(text); + return; + } + List<Seguradora> seguradora = await new SeguradoraServico().BuscarSeguradoras(); + List<Ramo> source = await new RamoServico().BuscarRamos(); + Seguradoras = new ObservableCollection<Seguradora>(seguradora.OrderBy((Seguradora x) => x.Nome)); + Ramos = new ObservableCollection<Ramo>(source.OrderBy((Ramo x) => x.Nome)); + base.EnableButtons = true; + } + + public async Task<bool> ValidarLogin() + { + Fase1 = false; + Mensagem = "ESTAMOS VALIDANDO AS INFORMAÇÕES"; + if (string.IsNullOrEmpty(Usuario) || string.IsNullOrEmpty(Senha) || string.IsNullOrEmpty(ConfirmacaoSenha) || string.IsNullOrEmpty(Nome)) + { + await ShowMessage("NECESSÁRIO PREENCHER O NOME COMPLETO, USUÁRIO, SENHA E CONFIRMAÇÃO DA SENHA PARA PROSSEGUIR."); + Fase1 = true; + return true; + } + if (!string.IsNullOrEmpty(Usuario) && !Regex.IsMatch(Usuario, "^(?!.*(@.*@|@\\.|\\.@|--|\\.\\.|-\\.|\\.-|-@|@-))[a-zA-Z0-9](?:[a-zA-Z0-9@.-]*[a-zA-Z0-9])?(?: [a-zA-Z0-9](?:[a-zA-Z0-9@.-]*[a-zA-Z0-9])?)?$")) + { + await ShowMessage("USUÁRIO DEVE CONTER APENAS LETRAS E NÚMEROS," + Environment.NewLine + "NÃO DEVE CONTER MAIS DE UM ESPAÇO," + Environment.NewLine + "NÃO DEVE TER ESPAÇO NO INICIO E NO FIM." + Environment.NewLine + "EXEMPLO VALIDO:" + Environment.NewLine + "USUARIO01 OU USUARIO 02 OU USUARIO.03"); + Fase1 = true; + return true; + } + if (Usuario.Length > 30) + { + await ShowMessage("USUÁRIO SOMENTE DEVE CONTER NO MÁXIMO 30 CARACTERES"); + Fase1 = true; + return true; + } + if (Senha != ConfirmacaoSenha) + { + await ShowMessage("A SENHA E A CONFIRMAÇÃO DA SENHA ESTÃO DIFERENTES, CORRIJA PARA PROSSEGUIR."); + Fase1 = true; + return true; + } + if (!(await UsuarioInicial())) + { + return false; + } + while (Seguradoras.Count == 0) + { + await Task.Delay(25); + } + Fase1 = false; + Fase2 = true; + return true; + } + + public async Task<string> CriarBanco() + { + string text = await new ConnectionHelper().VerifyConnection(); + if (text == null) + { + Instancia.ExcluirCfg(); + return await VerificaEmpresa(); + } + return text; + } + + public async Task<string> VerificaEmpresa() + { + ConnectionHelper connectionHelper = new ConnectionHelper(); + Empresa = await Connection.Get<Customer>($"Customer/{ApplicationHelper.IdFornecedor}"); + EmpresaServico servico = new EmpresaServico(); + if (!connectionHelper.ExisteEmpresa()) + { + await servico.Save(Empresa); + if (!servico.Sucesso) + { + return "ERRO AO CRIAR BANCO DE DADOS"; + } + } + else if (!connectionHelper.BDConvertido()) + { + return "HOUVE UM ERRO NO ACESSO! REINICIE O SISTEMA!"; + } + return null; + } + + public void DesativarRamos() + { + foreach (Ramo ramo in Ramos) + { + ramo.Ativo = false; + } + Ramos = new ObservableCollection<Ramo>(Ramos); + } + + public void DesativarSeguradoras() + { + foreach (Seguradora seguradora in Seguradoras) + { + seguradora.Ativo = false; + } + Seguradoras = new ObservableCollection<Seguradora>(Seguradoras); + } + + public async Task<bool> Concluir() + { + Fase3 = false; + if (Ramos.All((Ramo x) => !x.Ativo)) + { + await ShowMessage("NECESSÁRIO AO MENOS UM RAMO ATIVO PARA PROSSEGUIR."); + Fase3 = true; + return false; + } + Mensagem = "ESTAMOS TERMINANDO AS CONFIGURAÇÕES INICIAIS E LOGO MAIS VOCÊ PODERÁ UTILIZAR."; + if (!(await UsuarioInicial())) + { + return false; + } + SeguradoraServico seguradoraServico = new SeguradoraServico(); + foreach (Seguradora seguradora in Seguradoras) + { + await seguradoraServico.Save(seguradora, null, primeiroAcesso: true); + if (!seguradoraServico.Sucesso) + { + return false; + } + } + RamoServico ramoServico = new RamoServico(); + foreach (Ramo ramo in Ramos) + { + await ramoServico.Save(ramo, null); + if (!ramoServico.Sucesso) + { + return false; + } + } + await new BaseServico().LoadInicialParameters(); + return true; + } + + public async Task<bool> UsuarioInicial() + { + Usuario val = await new UsuarioServico().BuscaUsuarioInicial(Usuario, Senha); + if (val == null) + { + await ShowMessage("USUÁRIO JÁ EXISTE E A SENHA ESTÁ INCORRETA, REINICIE O SISTEMA!"); + return false; + } + await SalvarUsuario(val); + return true; + } + + private async Task SalvarUsuario(Usuario verificaUsuario) + { + _idUsuario = ((verificaUsuario != null) ? ((DomainBase)verificaUsuario).Id : 0); + Usuario val = new Usuario + { + Id = _idUsuario, + Nome = Nome, + Login = Usuario, + Senha = new Token().AggerEncrypt(Senha), + Administrador = true, + Excluido = false, + IdEmpresa = 1L, + PermissaoAggilizador = 1L + }; + val.SsoId = ((verificaUsuario != null) ? verificaUsuario.SsoId : null); + Usuario usuario = val; + usuario = await new UsuarioServico().Save(usuario); + _idUsuario = ((DomainBase)usuario).Id; + Recursos.Usuario = usuario; + } + + public async Task ValidarSeguradoras() + { + Fase2 = false; + if (Seguradoras.All((Seguradora x) => !x.Ativo)) + { + await ShowMessage("NECESSÁRIO AO MENOS UMA SEGURADORA ATIVA PARA PROSSEGUIR."); + Fase2 = true; + } + else + { + Fase2 = false; + Fase3 = true; + } + } + + public async Task VerificarUsuario() + { + Instancia.ExcluirCfg(); + Usuario val = await new UsuarioServico().BuscarUsuarioPorId(1L); + if (val != null) + { + Nome = val.Nome; + Usuario = val.Login; + _idUsuario = ((DomainBase)val).Id; + } + } + + public async Task<bool> VerificaAcesso() + { + LicenseHelper license = new LicenseHelper(); + bool registrar = false; + if (!(await license.VerificarMaquina())) + { + Loading(isLoading: false); + while (!registrar) + { + List<Instalacao> licencas = await license.GetInstalacoes(); + if (licencas.Count == 0) + { + await ShowMessage("ACESSO NEGADO, NÃO EXISTEM LICENÇAS VÁLIDAS."); + return false; + } + Instalacao instalacaoUsuario = ((IEnumerable<Instalacao>)licencas.OrderByDescending((Instalacao x) => x.UltimoAcesso)).FirstOrDefault((Func<Instalacao, bool>)((Instalacao x) => x.UsuarioId == ((DomainBase)Recursos.Usuario).Id)); + bool flag = instalacaoUsuario != null; + if (flag) + { + flag = await ShowMessage("SEU ULTIMO ACESSO FOI NA MAQUINA " + instalacaoUsuario.NomeMaquina + ". DESEJA SUBSTITUIR A LICENÇA PARA ESSA MAQUINA?", "SIM", "NÃO"); + } + Instalacao val = ((!flag) ? (await ShowInstalacoes(licencas)) : instalacaoUsuario); + Instalacao val2 = val; + if (val2 == null) + { + await ShowMessage("MÁQUINA NÃO REGISTRADA"); + return false; + } + await new AjudaServico().ExcluirInstalacao(((DomainBase)val2).Id); + registrar = await license.VerificarMaquina(); + } + } + return true; + } +} diff --git a/Decompiler/Gestor.Application.Views.Ajuda/AtendimentosView.cs b/Decompiler/Gestor.Application.Views.Ajuda/AtendimentosView.cs new file mode 100644 index 0000000..2bf4bd4 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Ajuda/AtendimentosView.cs @@ -0,0 +1,299 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Data; +using System.Windows.Input; +using System.Windows.Markup; +using Gestor.Application.Componentes; +using Gestor.Application.Helpers; +using Gestor.Application.ViewModels.Drawer.Ajuda; +using Gestor.Application.Views.Ferramentas; +using Gestor.Application.Views.Generic; +using Gestor.Model.API; +using Gestor.Model.Domain.Common; +using MaterialDesignThemes.Wpf; +using Xceed.Wpf.AvalonDock.Controls; + +namespace Gestor.Application.Views.Ajuda; + +public class AtendimentosView : BaseUserControl, IComponentConnector, IStyleConnector +{ + internal AtendimentosViewModel ViewModel; + + internal ComboBox StatusCbo; + + internal DataGrid AtendimentosGrid; + + internal DataGridTextColumn SolucaoColumn; + + internal TextBox NomeBox; + + internal TextBox Ddd; + + internal TextBox TelefoneBox; + + internal TextBox ValorBox; + + internal TextBox AssuntoBox; + + internal TextBox IdAcessoBox; + + internal TextBox SenhaBox; + + internal WebEditor WebEditor; + + private bool _contentLoaded; + + public AtendimentosView() + { + ViewModel = new AtendimentosViewModel(); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + ViewModel.Head = Recursos.Usuario.Nome + " - " + Recursos.Empresa.Nome + ", VOCÊ ESTÁ EM ATENDIMENTOS"; + ((Selector)StatusCbo).SelectedIndex = 0; + ViewModel.IsVisible = (Visibility)0; + } + + private void AnexarArquivos_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Anexar(); + } + + private async void Enviar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + ViewModel.Corpo = WebEditor.GetHtml(); + List<KeyValuePair<string, string>> list = await ViewModel.Enviar(); + bool num = list == null || list.Count == 0; + if (list != null && list.Any((KeyValuePair<string, string> x) => x.Key == "fail")) + { + list.Remove(list.First((KeyValuePair<string, string> x) => x.Key == "fail")); + } + ((DependencyObject)(object)this).ValidateFields(list); + ViewModel.Loading(isLoading: false); + if (!num) + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + return; + } + await ViewModel.ShowMessage("SOLICITAÇÃO ENVIADA PARA AGGER, POR FAVOR AGUARDE NOSSO RETORNO!"); + WebEditor.Body = ""; + } + + private void SelectedStatus_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + if (((Selector)StatusCbo).SelectedItem != null) + { + ViewModel.WorkOnSelectedStatus(((Selector)StatusCbo).SelectedItem.ToString()); + ((DataGridColumn)SolucaoColumn).Visibility = (Visibility)((((Selector)StatusCbo).SelectedItem.ToString() == "PENDENTES") ? 2 : 0); + } + } + + private void AbrirAntendimento_OnClick(object sender, RoutedEventArgs e) + { + ((Selector)AtendimentosGrid).SelectedItem = null; + ViewModel.LimparComponentes(); + if (WebEditor.WebBrowserEditor.HtmlDocument.body != null) + { + WebEditor.WebBrowserEditor.HtmlDocument.body.innerHTML = string.Empty; + } + ViewModel.AtendimentoVisibility = (Visibility)2; + ViewModel.EnvioEmailVisibility = (Visibility)0; + ViewModel.IsEnabled = false; + } + + private void Cancelar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.IsEnabled = true; + ViewModel.SelecionaAtendimento(); + } + + private void AcessoRemoto_OnClick(object sender, RoutedEventArgs e) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Unknown result type (might be due to invalid IL or missing references) + //IL_002a: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Unknown result type (might be due to invalid IL or missing references) + //IL_0040: Unknown result type (might be due to invalid IL or missing references) + //IL_004c: Expected O, but got Unknown + string text = "c:\\AggerSeguros\\Remoto.exe"; + if (File.Exists(text)) + { + Process.Start(text); + return; + } + ((Window)new DownloadWindow(new Parameters + { + Beta = false, + Type = 99, + Application = "Remoto.exe", + Directory = "", + Run = true + })).Show(); + } + + private void DeleteArquivo_OnDeleteClick(object sender, RoutedEventArgs e) + { + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_0034: Expected O, but got Unknown + Chip val = (Chip)((sender is Chip) ? sender : null); + if (val != null) + { + ListBox val2 = Extentions.FindVisualAncestor<ListBox>((DependencyObject)(object)val); + ArquivoDigital val3 = (ArquivoDigital)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)]; + if (val3 != null) + { + ViewModel.Delete(val3); + } + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/ajuda/atendimentosview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0053: Unknown result type (might be due to invalid IL or missing references) + //IL_005d: Expected O, but got Unknown + //IL_006a: Unknown result type (might be due to invalid IL or missing references) + //IL_0074: Expected O, but got Unknown + //IL_0076: Unknown result type (might be due to invalid IL or missing references) + //IL_0082: Unknown result type (might be due to invalid IL or missing references) + //IL_008c: Expected O, but got Unknown + //IL_008f: Unknown result type (might be due to invalid IL or missing references) + //IL_0099: Expected O, but got Unknown + //IL_009c: Unknown result type (might be due to invalid IL or missing references) + //IL_00a6: Expected O, but got Unknown + //IL_00a8: Unknown result type (might be due to invalid IL or missing references) + //IL_00b4: Unknown result type (might be due to invalid IL or missing references) + //IL_00be: Expected O, but got Unknown + //IL_00c0: Unknown result type (might be due to invalid IL or missing references) + //IL_00cc: Unknown result type (might be due to invalid IL or missing references) + //IL_00d6: Expected O, but got Unknown + //IL_00d8: Unknown result type (might be due to invalid IL or missing references) + //IL_00e4: Unknown result type (might be due to invalid IL or missing references) + //IL_00ee: Expected O, but got Unknown + //IL_00f1: Unknown result type (might be due to invalid IL or missing references) + //IL_00fb: Expected O, but got Unknown + //IL_00fe: Unknown result type (might be due to invalid IL or missing references) + //IL_0108: Expected O, but got Unknown + //IL_0116: Unknown result type (might be due to invalid IL or missing references) + //IL_0120: Expected O, but got Unknown + //IL_0123: Unknown result type (might be due to invalid IL or missing references) + //IL_012d: Expected O, but got Unknown + //IL_013b: Unknown result type (might be due to invalid IL or missing references) + //IL_0145: Expected O, but got Unknown + //IL_0153: Unknown result type (might be due to invalid IL or missing references) + //IL_015d: Expected O, but got Unknown + //IL_0160: Unknown result type (might be due to invalid IL or missing references) + //IL_016a: Expected O, but got Unknown + //IL_016d: Unknown result type (might be due to invalid IL or missing references) + //IL_0177: Expected O, but got Unknown + //IL_017a: Unknown result type (might be due to invalid IL or missing references) + //IL_0184: Expected O, but got Unknown + //IL_0187: Unknown result type (might be due to invalid IL or missing references) + //IL_0191: Expected O, but got Unknown + //IL_0193: Unknown result type (might be due to invalid IL or missing references) + //IL_019f: Unknown result type (might be due to invalid IL or missing references) + //IL_01a9: Expected O, but got Unknown + switch (connectionId) + { + case 1: + StatusCbo = (ComboBox)target; + ((Selector)StatusCbo).SelectionChanged += new SelectionChangedEventHandler(SelectedStatus_OnSelectionChanged); + break; + case 2: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AbrirAntendimento_OnClick); + break; + case 3: + AtendimentosGrid = (DataGrid)target; + break; + case 4: + SolucaoColumn = (DataGridTextColumn)target; + break; + case 5: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Cancelar_OnClick); + break; + case 6: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AnexarArquivos_OnClick); + break; + case 7: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Enviar_OnClick); + break; + case 8: + NomeBox = (TextBox)target; + break; + case 9: + Ddd = (TextBox)target; + ((UIElement)Ddd).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 10: + TelefoneBox = (TextBox)target; + ((UIElement)TelefoneBox).LostFocus += new RoutedEventHandler(FormatarTelefone); + ((UIElement)TelefoneBox).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 11: + ValorBox = (TextBox)target; + break; + case 12: + AssuntoBox = (TextBox)target; + break; + case 13: + IdAcessoBox = (TextBox)target; + break; + case 14: + SenhaBox = (TextBox)target; + break; + case 15: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AcessoRemoto_OnClick); + break; + case 17: + WebEditor = (WebEditor)target; + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Unknown result type (might be due to invalid IL or missing references) + //IL_001c: Expected O, but got Unknown + if (connectionId == 16) + { + ((Chip)target).DeleteClick += new RoutedEventHandler(DeleteArquivo_OnDeleteClick); + } + } +} diff --git a/Decompiler/Gestor.Application.Views.BI/AcompanhamentoView.cs b/Decompiler/Gestor.Application.Views.BI/AcompanhamentoView.cs new file mode 100644 index 0000000..910e4d8 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.BI/AcompanhamentoView.cs @@ -0,0 +1,369 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Data; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Media; +using Gestor.Application.Helpers; +using Gestor.Application.ViewModels; +using Gestor.Application.Views.Generic; +using Gestor.Model.Common; +using Gestor.Model.Domain.Ferramentas; + +namespace Gestor.Application.Views.BI; + +public class AcompanhamentoView : BaseUserControl, IComponentConnector, IStyleConnector +{ + private ListBox _dragSource; + + private object _data; + + internal ListBox FasesListBox; + + private bool _contentLoaded; + + public TrilhaViewModel ViewModel { get; set; } + + public AcompanhamentoView() + { + ((FrameworkElement)this).Tag = "CADASTRO DE TRILHAS"; + ViewModel = new TrilhaViewModel(); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + ((FrameworkElement)FasesListBox).DataContext = ViewModel; + } + + private static object GetDataFromListBox(ItemsControl source, Point point) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + IInputElement obj = ((UIElement)source).InputHitTest(point); + UIElement val = (UIElement)(object)((obj is UIElement) ? obj : null); + if (val != null) + { + object obj2 = DependencyProperty.UnsetValue; + while (obj2 == DependencyProperty.UnsetValue) + { + if (val != null) + { + obj2 = source.ItemContainerGenerator.ItemFromContainer((DependencyObject)(object)val); + if (obj2 == DependencyProperty.UnsetValue) + { + DependencyObject parent = VisualTreeHelper.GetParent((DependencyObject)(object)val); + val = (UIElement)(object)((parent is UIElement) ? parent : null); + } + if (val == source) + { + return null; + } + } + } + if (obj2 != DependencyProperty.UnsetValue) + { + return obj2; + } + } + return null; + } + + private void ListBox_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + //IL_000a: Unknown result type (might be due to invalid IL or missing references) + //IL_0010: Expected O, but got Unknown + //IL_002c: Unknown result type (might be due to invalid IL or missing references) + //IL_004c: Unknown result type (might be due to invalid IL or missing references) + if (sender is Button) + { + Button val = (Button)sender; + ListBox dragSource = ((DependencyObject)(object)val).FindAncestor<ListBox>().FirstOrDefault(); + _dragSource = dragSource; + _data = GetDataFromListBox((ItemsControl)(object)_dragSource, ((MouseEventArgs)e).GetPosition((IInputElement)(object)val)); + if (_data != null) + { + DragDrop.DoDragDrop((DependencyObject)(object)val, _data, (DragDropEffects)2); + ((RoutedEventArgs)e).Handled = true; + } + } + } + + private void ListBox_Drop(object sender, DragEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_008e: Unknown result type (might be due to invalid IL or missing references) + //IL_0098: Expected O, but got Unknown + //IL_00a1: Unknown result type (might be due to invalid IL or missing references) + //IL_00ad: Expected O, but got Unknown + //IL_0042: Unknown result type (might be due to invalid IL or missing references) + ListBox val = (ListBox)sender; + object data = e.Data.GetData(_data.GetType()); + int index = -1; + for (int i = 0; i < ((CollectionView)((ItemsControl)val).Items).Count; i++) + { + DependencyObject obj = ((ItemsControl)val).ItemContainerGenerator.ContainerFromIndex(i); + ListBoxItem val2 = (ListBoxItem)(object)((obj is ListBoxItem) ? obj : null); + if (val2 != null && IsMouseOverTarget((Visual)(object)val2, e.GetPosition((IInputElement)(object)val2))) + { + index = i; + break; + } + } + object dataContext = ((FrameworkElement)_dragSource).DataContext; + Fase origem = (Fase)((dataContext is Fase) ? dataContext : null); + object dataContext2 = ((FrameworkElement)val).DataContext; + Fase origem2 = (Fase)((dataContext2 is Fase) ? dataContext2 : null); + ViewModel.Excluir(origem, (Tarefa)data); + ViewModel.Inserir(origem2, (Tarefa)data, index); + ViewModel.Update(); + } + + private static bool IsMouseOverTarget(Visual target, Point point) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_0009: Unknown result type (might be due to invalid IL or missing references) + Rect descendantBounds = VisualTreeHelper.GetDescendantBounds(target); + return ((Rect)(ref descendantBounds)).Contains(point); + } + + private void Info_OnClick(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + Button val = (Button)sender; + bool isOpen = !((ToolTip)((FrameworkElement)val).ToolTip).IsOpen; + ((ToolTip)((FrameworkElement)val).ToolTip).IsOpen = isOpen; + } + + private async void AdicionarTarefa_OnClick(object sender, RoutedEventArgs e) + { + object dataContext = ((FrameworkElement)(Button)sender).DataContext; + Fase fase = (Fase)((dataContext is Fase) ? dataContext : null); + Tarefa data = new Tarefa + { + Agendamento = Funcoes.GetNetworkTime(), + Titulo = "NOVA TAREFA", + Usuario = Recursos.Usuario, + Trilha = ViewModel.SelectedTrilha, + Status = (StatusTarefa)0, + Fase = fase + }; + ViewModel.Loading(isLoading: true); + while (true) + { + Tarefa val = await ViewModel.ShowTarefaDialog(data); + if (val == null) + { + return; + } + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(val); + ViewModel.Loading(isLoading: false); + if (list == null || list.Count == 0) + { + break; + } + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + ViewModel.ToggleSnackBar("TAREFA SALVA COM SUCESSO."); + ViewModel.Alterar(alterar: false); + } + + private async void ListBox_OnPreviewMouseDoubleClick(object sender, MouseButtonEventArgs e) + { + ListBox val = (ListBox)sender; + object dataFromListBox = GetDataFromListBox((ItemsControl)(object)val, ((MouseEventArgs)e).GetPosition((IInputElement)(object)val)); + if (dataFromListBox != null) + { + await AbrirTarefa((Tarefa)dataFromListBox); + } + } + + private async Task AbrirTarefa(Tarefa data) + { + while (true) + { + Tarefa val = await ViewModel.ShowTarefaDialog(data); + if (val == null) + { + return; + } + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(val); + ViewModel.Loading(isLoading: false); + if (list == null || list.Count == 0) + { + break; + } + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + ViewModel.ToggleSnackBar("TAREFA SALVA COM SUCESSO."); + ViewModel.Alterar(alterar: false); + } + + private async void ExcluirTarefa_OnClick(object sender, RoutedEventArgs e) + { + object dataContext = ((FrameworkElement)(Button)sender).DataContext; + Tarefa tarefa = (Tarefa)((dataContext is Tarefa) ? dataContext : null); + await ViewModel.Excluir(tarefa); + } + + private async void EditarTarefa_OnClick(object sender, RoutedEventArgs e) + { + object dataContext = ((FrameworkElement)(Button)sender).DataContext; + Tarefa data = (Tarefa)((dataContext is Tarefa) ? dataContext : null); + await AbrirTarefa(data); + } + + private async void TarefaConcluida_OnClick(object sender, RoutedEventArgs e) + { + object dataContext = ((FrameworkElement)(Button)sender).DataContext; + Tarefa val = (Tarefa)((dataContext is Tarefa) ? dataContext : null); + if (val != null) + { + val.Conclusao = Funcoes.GetNetworkTime(); + val.Status = (StatusTarefa)2; + await ViewModel.Salvar(val); + await ViewModel.CarregarTrilha(ViewModel.SelectedTrilha); + } + } + + private void FasesListBox_OnDragOver(object sender, DragEventArgs e) + { + //IL_0018: Unknown result type (might be due to invalid IL or missing references) + //IL_001d: Unknown result type (might be due to invalid IL or missing references) + ListBox val = (ListBox)((sender is ListBox) ? sender : null); + ScrollViewer val2 = AcompanhamentoView.FindVisualChild<ScrollViewer>((DependencyObject)(object)FasesListBox); + if (val != null) + { + Point position = e.GetPosition((IInputElement)(object)val); + double x = ((Point)(ref position)).X; + if (x < 100.0) + { + val2.ScrollToHorizontalOffset(val2.HorizontalOffset - 30.0); + } + else if (x > ((FrameworkElement)val).ActualWidth - 100.0) + { + val2.ScrollToHorizontalOffset(val2.HorizontalOffset + 30.0); + } + } + } + + public static TChildItem FindVisualChild<TChildItem>(DependencyObject obj) where TChildItem : DependencyObject + { + for (int i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++) + { + DependencyObject child = VisualTreeHelper.GetChild(obj, i); + TChildItem val = (TChildItem)(object)((child is TChildItem) ? child : null); + if (val != null) + { + return val; + } + TChildItem val2 = FindVisualChild<TChildItem>(child); + if (val2 != null) + { + return val2; + } + } + return default(TChildItem); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/bi/acompanhamentoview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_0010: Expected O, but got Unknown + //IL_001d: Unknown result type (might be due to invalid IL or missing references) + //IL_0027: Expected O, but got Unknown + if (connectionId == 1) + { + FasesListBox = (ListBox)target; + ((UIElement)FasesListBox).DragOver += new DragEventHandler(FasesListBox_OnDragOver); + } + else + { + _contentLoaded = true; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_0026: Unknown result type (might be due to invalid IL or missing references) + //IL_0032: Unknown result type (might be due to invalid IL or missing references) + //IL_003c: Expected O, but got Unknown + //IL_003e: Unknown result type (might be due to invalid IL or missing references) + //IL_004a: Unknown result type (might be due to invalid IL or missing references) + //IL_0054: Expected O, but got Unknown + //IL_0056: Unknown result type (might be due to invalid IL or missing references) + //IL_0062: Unknown result type (might be due to invalid IL or missing references) + //IL_006c: Expected O, but got Unknown + //IL_006d: Unknown result type (might be due to invalid IL or missing references) + //IL_0079: Unknown result type (might be due to invalid IL or missing references) + //IL_0083: Expected O, but got Unknown + //IL_0084: Unknown result type (might be due to invalid IL or missing references) + //IL_0090: Unknown result type (might be due to invalid IL or missing references) + //IL_009a: Expected O, but got Unknown + //IL_009c: Unknown result type (might be due to invalid IL or missing references) + //IL_00a8: Unknown result type (might be due to invalid IL or missing references) + //IL_00b2: Expected O, but got Unknown + //IL_00b4: Unknown result type (might be due to invalid IL or missing references) + //IL_00c0: Unknown result type (might be due to invalid IL or missing references) + //IL_00ca: Expected O, but got Unknown + //IL_00cc: Unknown result type (might be due to invalid IL or missing references) + //IL_00d8: Unknown result type (might be due to invalid IL or missing references) + //IL_00e2: Expected O, but got Unknown + //IL_00e4: Unknown result type (might be due to invalid IL or missing references) + //IL_00f0: Unknown result type (might be due to invalid IL or missing references) + //IL_00fa: Expected O, but got Unknown + switch (connectionId) + { + case 2: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AdicionarTarefa_OnClick); + break; + case 3: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Info_OnClick); + break; + case 4: + ((Control)(ListBox)target).PreviewMouseDoubleClick += new MouseButtonEventHandler(ListBox_OnPreviewMouseDoubleClick); + ((UIElement)(ListBox)target).MouseLeftButtonDown += new MouseButtonEventHandler(ListBox_PreviewMouseLeftButtonDown); + ((UIElement)(ListBox)target).Drop += new DragEventHandler(ListBox_Drop); + break; + case 5: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirTarefa_OnClick); + break; + case 6: + ((UIElement)(Button)target).PreviewMouseLeftButtonDown += new MouseButtonEventHandler(ListBox_PreviewMouseLeftButtonDown); + break; + case 7: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(EditarTarefa_OnClick); + break; + case 8: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(TarefaConcluida_OnClick); + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.BI/AgendaBIView.cs b/Decompiler/Gestor.Application.Views.BI/AgendaBIView.cs new file mode 100644 index 0000000..921fa92 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.BI/AgendaBIView.cs @@ -0,0 +1,81 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; +using System.Windows.Threading; + +namespace Gestor.Application.Views.BI; + +public class AgendaBIView : UserControl, IComponentConnector +{ + internal ContentControl NotasControl; + + internal ContentControl TarefaControl; + + internal ContentControl BiControl; + + private bool _contentLoaded; + + public AgendaBIView() + { + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + } + + private void ContentLoad() + { + NotasView notasView = new NotasView(); + NotasControl.Content = notasView; + ((FrameworkElement)NotasControl).DataContext = ((FrameworkElement)notasView).DataContext; + TarefaView tarefaView = new TarefaView(); + TarefaControl.Content = tarefaView; + ((FrameworkElement)TarefaControl).DataContext = ((FrameworkElement)tarefaView).DataContext; + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/bi/agendabiview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0018: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Expected O, but got Unknown + //IL_0025: Unknown result type (might be due to invalid IL or missing references) + //IL_002f: Expected O, but got Unknown + //IL_0032: Unknown result type (might be due to invalid IL or missing references) + //IL_003c: Expected O, but got Unknown + switch (connectionId) + { + case 1: + NotasControl = (ContentControl)target; + break; + case 2: + TarefaControl = (ContentControl)target; + break; + case 3: + BiControl = (ContentControl)target; + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.BI/NotasView.cs b/Decompiler/Gestor.Application.Views.BI/NotasView.cs new file mode 100644 index 0000000..788cf19 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.BI/NotasView.cs @@ -0,0 +1,275 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Media; +using Gestor.Application.Helpers; +using Gestor.Application.ViewModels.BI; +using Gestor.Application.Views.Generic; +using Gestor.Model.Common; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Views.BI; + +public class NotasView : BaseUserControl, IComponentConnector, IStyleConnector +{ + internal ProgressBar ProgressRing; + + private bool _contentLoaded; + + public NotasViewModel ViewModel { get; set; } + + public NotasView() + { + ViewModel = new NotasViewModel(); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + private static object GetDataFromListBox(ItemsControl source, Point point) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + IInputElement obj = ((UIElement)source).InputHitTest(point); + UIElement val = (UIElement)(object)((obj is UIElement) ? obj : null); + if (val == null) + { + return null; + } + object obj2 = DependencyProperty.UnsetValue; + while (obj2 == DependencyProperty.UnsetValue) + { + if (val != null) + { + obj2 = source.ItemContainerGenerator.ItemFromContainer((DependencyObject)(object)val); + if (obj2 == DependencyProperty.UnsetValue) + { + DependencyObject parent = VisualTreeHelper.GetParent((DependencyObject)(object)val); + val = (UIElement)(object)((parent is UIElement) ? parent : null); + } + if (val == source) + { + return null; + } + } + } + if (obj2 == DependencyProperty.UnsetValue) + { + return null; + } + return obj2; + } + + private async void AdicionarNota_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.AdicionarNota(); + } + + private async void ListBox_OnPreviewMouseDoubleClick(object sender, MouseButtonEventArgs e) + { + ListBox val = (ListBox)sender; + object dataFromListBox = GetDataFromListBox((ItemsControl)(object)val, ((MouseEventArgs)e).GetPosition((IInputElement)(object)val)); + if (dataFromListBox != null) + { + Tarefa val2 = new Tarefa(); + DomainBase.Copy<Tarefa, Tarefa>(val2, (Tarefa)dataFromListBox); + val2.UsuariosVinculados = val2.Responsaveis?.Select((ResponsavelTarefa x) => x.Usuario).ToList(); + await AbrirNota(val2, (int)val2.Entidade == 1, (int)val2.Entidade == 1); + } + } + + private async Task AbrirNota(Tarefa data, bool notaBool = false, bool agendamento = false) + { + while (true) + { + Tarefa nota = await ViewModel.ShowTarefaDialog(data, notaBool, agendamento); + if (nota == null) + { + return; + } + if (nota.Usuario == null) + { + nota.Usuario = nota.UsuariosVinculados.FirstOrDefault(); + } + List<ResponsavelTarefa> responsaveis = ((IEnumerable<Usuario>)nota.UsuariosVinculados).Select((Func<Usuario, ResponsavelTarefa>)((Usuario x) => new ResponsavelTarefa + { + IdTarefa = ((DomainBase)nota).Id, + Usuario = x + })).ToList(); + nota.Responsaveis = responsaveis; + ViewModel.Loading(isLoading: true); + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(nota); + ViewModel.Loading(isLoading: false); + if (list == null || list.Count == 0) + { + break; + } + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + ViewModel.ToggleSnackBar("NOTA SALVA COM SUCESSO."); + await ViewModel.CarregarNotas(); + } + + private async void NotaConcluida_OnClick(object sender, RoutedEventArgs e) + { + object dataContext = ((FrameworkElement)(Button)sender).DataContext; + Tarefa val = (Tarefa)((dataContext is Tarefa) ? dataContext : null); + if (val != null) + { + val.Conclusao = Funcoes.GetNetworkTime(); + val.Status = (StatusTarefa)2; + await ViewModel.SalvarNota(val); + await ViewModel.CarregarNotas(); + } + } + + private void ToggleNotasConcluidas_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.ToggleNotasConcluidas(); + } + + private async void ExcluirNota_OnClick(object sender, RoutedEventArgs e) + { + object dataContext = ((FrameworkElement)(Button)sender).DataContext; + Tarefa val = (Tarefa)((dataContext is Tarefa) ? dataContext : null); + if (val != null) + { + await ViewModel.ExcluirNota(val); + await ViewModel.CarregarNotas(); + } + } + + private async void SarvarNota_OnClick(object sender, RoutedEventArgs e) + { + object dataContext = ((FrameworkElement)(Button)sender).DataContext; + Tarefa val = (Tarefa)((dataContext is Tarefa) ? dataContext : null); + if (val != null) + { + ViewModel.Loading(isLoading: true); + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(val); + ViewModel.Loading(isLoading: false); + if (list == null || list.Count == 0) + { + ViewModel.ToggleSnackBar("NOTA SALVA COM SUCESSO."); + } + else + { + await ViewModel.CarregarNotas(); + } + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/bi/notasview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_002c: Unknown result type (might be due to invalid IL or missing references) + //IL_0036: Expected O, but got Unknown + //IL_0038: Unknown result type (might be due to invalid IL or missing references) + //IL_0044: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Expected O, but got Unknown + //IL_0050: Unknown result type (might be due to invalid IL or missing references) + //IL_005c: Unknown result type (might be due to invalid IL or missing references) + //IL_0066: Expected O, but got Unknown + //IL_0068: Unknown result type (might be due to invalid IL or missing references) + //IL_0074: Unknown result type (might be due to invalid IL or missing references) + //IL_007e: Expected O, but got Unknown + //IL_0080: Unknown result type (might be due to invalid IL or missing references) + //IL_008c: Unknown result type (might be due to invalid IL or missing references) + //IL_0096: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ProgressRing = (ProgressBar)target; + break; + case 2: + ((Control)(ListBox)target).PreviewMouseDoubleClick += new MouseButtonEventHandler(ListBox_OnPreviewMouseDoubleClick); + break; + case 6: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AdicionarNota_OnClick); + break; + case 7: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ToggleNotasConcluidas_OnClick); + break; + case 8: + ((Control)(ListBox)target).PreviewMouseDoubleClick += new MouseButtonEventHandler(ListBox_OnPreviewMouseDoubleClick); + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_002a: Unknown result type (might be due to invalid IL or missing references) + //IL_0036: Unknown result type (might be due to invalid IL or missing references) + //IL_0040: Expected O, but got Unknown + //IL_0042: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_0058: Expected O, but got Unknown + //IL_005a: Unknown result type (might be due to invalid IL or missing references) + //IL_0066: Unknown result type (might be due to invalid IL or missing references) + //IL_0070: Expected O, but got Unknown + //IL_0072: Unknown result type (might be due to invalid IL or missing references) + //IL_007e: Unknown result type (might be due to invalid IL or missing references) + //IL_0088: Expected O, but got Unknown + //IL_008a: Unknown result type (might be due to invalid IL or missing references) + //IL_0096: Unknown result type (might be due to invalid IL or missing references) + //IL_00a0: Expected O, but got Unknown + switch (connectionId) + { + case 3: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirNota_OnClick); + break; + case 4: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(NotaConcluida_OnClick); + break; + case 5: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(SarvarNota_OnClick); + break; + case 9: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirNota_OnClick); + break; + case 10: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(SarvarNota_OnClick); + break; + case 6: + case 7: + case 8: + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.BI/PainelBiView.cs b/Decompiler/Gestor.Application.Views.BI/PainelBiView.cs new file mode 100644 index 0000000..4512167 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.BI/PainelBiView.cs @@ -0,0 +1,450 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using System.Windows.Markup; +using Gestor.Application.ViewModels.BI; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using LiveCharts.Wpf; + +namespace Gestor.Application.Views.BI; + +public class PainelBiView : BaseUserControl, IComponentConnector +{ + public PainelBiViewModel ViewModel; + + internal ProgressBar ProgressProducao; + + internal DatePicker InicioBox; + + internal DatePicker FimBox; + + internal Button Anterior; + + internal Button Gerada; + + internal Button Apolices; + + internal Button Endossos; + + internal Button NovosNegocios; + + internal Button Faturas; + + internal Button Renovacoes; + + internal Button Cancelamentos; + + internal ProgressBar ProgressClientes; + + internal DatePicker InicioClientesBox; + + internal DatePicker FimClientesBox; + + internal Button Aniversariantes; + + internal Button VencimentoCnh; + + internal ProgressBar ProgressPendencia; + + internal DatePicker InicioPendenciaBox; + + internal DatePicker FimPendenciaBox; + + internal Button VencimentoApolices; + + internal Button ParcelasAVencer; + + internal Button ApolicesPendentes; + + internal Button ParcelasPendentes; + + private bool _contentLoaded; + + public PainelBiView() + { + ViewModel = new PainelBiViewModel(); + ((FrameworkElement)this).DataContext = ViewModel; + ((FrameworkElement)this).Tag = "PAINEL B.I."; + InitializeComponent(); + } + + private async void Atualizar_Click(object sender, RoutedEventArgs e) + { + InicioBox.Text = ValidationHelper.FormatDate(InicioBox.Text); + FimBox.Text = ValidationHelper.FormatDate(FimBox.Text); + try + { + ViewModel.Inicio = Convert.ToDateTime(InicioBox.Text); + ViewModel.Fim = Convert.ToDateTime(FimBox.Text); + } + catch (Exception) + { + return; + } + await ViewModel.GerarProducao(); + } + + private void Grafico_OnPreviewMouseDoubleClick(object sender, MouseButtonEventArgs e) + { + ViewModel.Detalhar(0); + } + + private async void AtualizarClientes_OnClick(object sender, RoutedEventArgs e) + { + InicioClientesBox.Text = ValidationHelper.FormatDate(InicioClientesBox.Text); + FimClientesBox.Text = ValidationHelper.FormatDate(FimClientesBox.Text); + try + { + ViewModel.Inicio = Convert.ToDateTime(InicioClientesBox.Text); + ViewModel.Fim = Convert.ToDateTime(FimClientesBox.Text); + } + catch (Exception) + { + return; + } + await ViewModel.GerarClientes(); + } + + private async void AtualizarPendencias_OnClick(object sender, RoutedEventArgs e) + { + InicioPendenciaBox.Text = ValidationHelper.FormatDate(InicioPendenciaBox.Text); + FimPendenciaBox.Text = ValidationHelper.FormatDate(FimPendenciaBox.Text); + try + { + ViewModel.Inicio = Convert.ToDateTime(InicioPendenciaBox.Text); + ViewModel.Fim = Convert.ToDateTime(FimPendenciaBox.Text); + } + catch (Exception) + { + return; + } + await ViewModel.GerarVencimento(); + } + + private void Fechamento_OnPreviewMouseDoubleClick(object sender, MouseButtonEventArgs e) + { + ViewModel.Detalhar(1); + } + + private void DetalharProducao_OnClick(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + switch (((FrameworkElement)(Button)sender).Name) + { + default: + ViewModel.Detalhar(0); + break; + case "NovosNegocios": + ViewModel.Detalhar(2); + break; + case "Renovacoes": + ViewModel.Detalhar(3); + break; + case "Cancelamentos": + ViewModel.Detalhar(4); + break; + case "Aniversariantes": + ViewModel.Detalhar(5); + break; + case "VencimentoCnh": + ViewModel.Detalhar(6); + break; + case "VencimentoApolices": + ViewModel.Detalhar(7); + break; + case "ParcelasAVencer": + ViewModel.Detalhar(8); + break; + case "ApolicesPendentes": + ViewModel.Detalhar(9); + break; + case "ParcelasPendentes": + ViewModel.Detalhar(10); + break; + case "Faturas": + ViewModel.Detalhar(12); + break; + case "Endossos": + ViewModel.Detalhar(11); + break; + case "Apolices": + ViewModel.Detalhar(13); + break; + case "Anterior": + ViewModel.Detalhar(14); + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/bi/painelbiview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_008b: Unknown result type (might be due to invalid IL or missing references) + //IL_0095: Expected O, but got Unknown + //IL_0098: Unknown result type (might be due to invalid IL or missing references) + //IL_00a2: Expected O, but got Unknown + //IL_00af: Unknown result type (might be due to invalid IL or missing references) + //IL_00b9: Expected O, but got Unknown + //IL_00c6: Unknown result type (might be due to invalid IL or missing references) + //IL_00d0: Expected O, but got Unknown + //IL_00d3: Unknown result type (might be due to invalid IL or missing references) + //IL_00dd: Expected O, but got Unknown + //IL_00ea: Unknown result type (might be due to invalid IL or missing references) + //IL_00f4: Expected O, but got Unknown + //IL_0101: Unknown result type (might be due to invalid IL or missing references) + //IL_010b: Expected O, but got Unknown + //IL_010d: Unknown result type (might be due to invalid IL or missing references) + //IL_0119: Unknown result type (might be due to invalid IL or missing references) + //IL_0123: Expected O, but got Unknown + //IL_0125: Unknown result type (might be due to invalid IL or missing references) + //IL_0131: Unknown result type (might be due to invalid IL or missing references) + //IL_013b: Expected O, but got Unknown + //IL_013d: Unknown result type (might be due to invalid IL or missing references) + //IL_0149: Unknown result type (might be due to invalid IL or missing references) + //IL_0153: Expected O, but got Unknown + //IL_0156: Unknown result type (might be due to invalid IL or missing references) + //IL_0160: Expected O, but got Unknown + //IL_016d: Unknown result type (might be due to invalid IL or missing references) + //IL_0177: Expected O, but got Unknown + //IL_017a: Unknown result type (might be due to invalid IL or missing references) + //IL_0184: Expected O, but got Unknown + //IL_0191: Unknown result type (might be due to invalid IL or missing references) + //IL_019b: Expected O, but got Unknown + //IL_019e: Unknown result type (might be due to invalid IL or missing references) + //IL_01a8: Expected O, but got Unknown + //IL_01b5: Unknown result type (might be due to invalid IL or missing references) + //IL_01bf: Expected O, but got Unknown + //IL_01c2: Unknown result type (might be due to invalid IL or missing references) + //IL_01cc: Expected O, but got Unknown + //IL_01d9: Unknown result type (might be due to invalid IL or missing references) + //IL_01e3: Expected O, but got Unknown + //IL_01e6: Unknown result type (might be due to invalid IL or missing references) + //IL_01f0: Expected O, but got Unknown + //IL_01fd: Unknown result type (might be due to invalid IL or missing references) + //IL_0207: Expected O, but got Unknown + //IL_020a: Unknown result type (might be due to invalid IL or missing references) + //IL_0214: Expected O, but got Unknown + //IL_0221: Unknown result type (might be due to invalid IL or missing references) + //IL_022b: Expected O, but got Unknown + //IL_022e: Unknown result type (might be due to invalid IL or missing references) + //IL_0238: Expected O, but got Unknown + //IL_0245: Unknown result type (might be due to invalid IL or missing references) + //IL_024f: Expected O, but got Unknown + //IL_0252: Unknown result type (might be due to invalid IL or missing references) + //IL_025c: Expected O, but got Unknown + //IL_0269: Unknown result type (might be due to invalid IL or missing references) + //IL_0273: Expected O, but got Unknown + //IL_0275: Unknown result type (might be due to invalid IL or missing references) + //IL_0281: Unknown result type (might be due to invalid IL or missing references) + //IL_028b: Expected O, but got Unknown + //IL_028d: Unknown result type (might be due to invalid IL or missing references) + //IL_0299: Unknown result type (might be due to invalid IL or missing references) + //IL_02a3: Expected O, but got Unknown + //IL_02a5: Unknown result type (might be due to invalid IL or missing references) + //IL_02b1: Unknown result type (might be due to invalid IL or missing references) + //IL_02bb: Expected O, but got Unknown + //IL_02be: Unknown result type (might be due to invalid IL or missing references) + //IL_02c8: Expected O, but got Unknown + //IL_02cb: Unknown result type (might be due to invalid IL or missing references) + //IL_02d5: Expected O, but got Unknown + //IL_02e2: Unknown result type (might be due to invalid IL or missing references) + //IL_02ec: Expected O, but got Unknown + //IL_02f9: Unknown result type (might be due to invalid IL or missing references) + //IL_0303: Expected O, but got Unknown + //IL_0306: Unknown result type (might be due to invalid IL or missing references) + //IL_0310: Expected O, but got Unknown + //IL_031d: Unknown result type (might be due to invalid IL or missing references) + //IL_0327: Expected O, but got Unknown + //IL_0334: Unknown result type (might be due to invalid IL or missing references) + //IL_033e: Expected O, but got Unknown + //IL_0340: Unknown result type (might be due to invalid IL or missing references) + //IL_034c: Unknown result type (might be due to invalid IL or missing references) + //IL_0356: Expected O, but got Unknown + //IL_0359: Unknown result type (might be due to invalid IL or missing references) + //IL_0363: Expected O, but got Unknown + //IL_0370: Unknown result type (might be due to invalid IL or missing references) + //IL_037a: Expected O, but got Unknown + //IL_037d: Unknown result type (might be due to invalid IL or missing references) + //IL_0387: Expected O, but got Unknown + //IL_0394: Unknown result type (might be due to invalid IL or missing references) + //IL_039e: Expected O, but got Unknown + //IL_03a1: Unknown result type (might be due to invalid IL or missing references) + //IL_03ab: Expected O, but got Unknown + //IL_03ae: Unknown result type (might be due to invalid IL or missing references) + //IL_03b8: Expected O, but got Unknown + //IL_03c5: Unknown result type (might be due to invalid IL or missing references) + //IL_03cf: Expected O, but got Unknown + //IL_03dc: Unknown result type (might be due to invalid IL or missing references) + //IL_03e6: Expected O, but got Unknown + //IL_03e9: Unknown result type (might be due to invalid IL or missing references) + //IL_03f3: Expected O, but got Unknown + //IL_0400: Unknown result type (might be due to invalid IL or missing references) + //IL_040a: Expected O, but got Unknown + //IL_0417: Unknown result type (might be due to invalid IL or missing references) + //IL_0421: Expected O, but got Unknown + //IL_0423: Unknown result type (might be due to invalid IL or missing references) + //IL_042f: Unknown result type (might be due to invalid IL or missing references) + //IL_0439: Expected O, but got Unknown + //IL_043c: Unknown result type (might be due to invalid IL or missing references) + //IL_0446: Expected O, but got Unknown + //IL_0453: Unknown result type (might be due to invalid IL or missing references) + //IL_045d: Expected O, but got Unknown + //IL_0460: Unknown result type (might be due to invalid IL or missing references) + //IL_046a: Expected O, but got Unknown + //IL_0477: Unknown result type (might be due to invalid IL or missing references) + //IL_0481: Expected O, but got Unknown + //IL_0484: Unknown result type (might be due to invalid IL or missing references) + //IL_048e: Expected O, but got Unknown + //IL_049b: Unknown result type (might be due to invalid IL or missing references) + //IL_04a5: Expected O, but got Unknown + //IL_04a8: Unknown result type (might be due to invalid IL or missing references) + //IL_04b2: Expected O, but got Unknown + //IL_04bf: Unknown result type (might be due to invalid IL or missing references) + //IL_04c9: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ProgressProducao = (ProgressBar)target; + break; + case 2: + InicioBox = (DatePicker)target; + ((UIElement)InicioBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((Control)InicioBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 3: + FimBox = (DatePicker)target; + ((UIElement)FimBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((Control)FimBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 4: + ((Control)(CartesianChart)target).PreviewMouseDoubleClick += new MouseButtonEventHandler(Grafico_OnPreviewMouseDoubleClick); + break; + case 5: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Atualizar_Click); + break; + case 6: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(DetalharProducao_OnClick); + break; + case 7: + Anterior = (Button)target; + ((ButtonBase)Anterior).Click += new RoutedEventHandler(DetalharProducao_OnClick); + break; + case 8: + Gerada = (Button)target; + ((ButtonBase)Gerada).Click += new RoutedEventHandler(DetalharProducao_OnClick); + break; + case 9: + Apolices = (Button)target; + ((ButtonBase)Apolices).Click += new RoutedEventHandler(DetalharProducao_OnClick); + break; + case 10: + Endossos = (Button)target; + ((ButtonBase)Endossos).Click += new RoutedEventHandler(DetalharProducao_OnClick); + break; + case 11: + NovosNegocios = (Button)target; + ((ButtonBase)NovosNegocios).Click += new RoutedEventHandler(DetalharProducao_OnClick); + break; + case 12: + Faturas = (Button)target; + ((ButtonBase)Faturas).Click += new RoutedEventHandler(DetalharProducao_OnClick); + break; + case 13: + Renovacoes = (Button)target; + ((ButtonBase)Renovacoes).Click += new RoutedEventHandler(DetalharProducao_OnClick); + break; + case 14: + Cancelamentos = (Button)target; + ((ButtonBase)Cancelamentos).Click += new RoutedEventHandler(DetalharProducao_OnClick); + break; + case 15: + ((Control)(PieChart)target).PreviewMouseDoubleClick += new MouseButtonEventHandler(Grafico_OnPreviewMouseDoubleClick); + break; + case 16: + ((Control)(PieChart)target).PreviewMouseDoubleClick += new MouseButtonEventHandler(Grafico_OnPreviewMouseDoubleClick); + break; + case 17: + ((Control)(CartesianChart)target).PreviewMouseDoubleClick += new MouseButtonEventHandler(Fechamento_OnPreviewMouseDoubleClick); + break; + case 18: + ProgressClientes = (ProgressBar)target; + break; + case 19: + InicioClientesBox = (DatePicker)target; + ((UIElement)InicioClientesBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((Control)InicioClientesBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 20: + FimClientesBox = (DatePicker)target; + ((UIElement)FimClientesBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((Control)FimClientesBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 21: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AtualizarClientes_OnClick); + break; + case 22: + Aniversariantes = (Button)target; + ((ButtonBase)Aniversariantes).Click += new RoutedEventHandler(DetalharProducao_OnClick); + break; + case 23: + VencimentoCnh = (Button)target; + ((ButtonBase)VencimentoCnh).Click += new RoutedEventHandler(DetalharProducao_OnClick); + break; + case 24: + ProgressPendencia = (ProgressBar)target; + break; + case 25: + InicioPendenciaBox = (DatePicker)target; + ((UIElement)InicioPendenciaBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((Control)InicioPendenciaBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 26: + FimPendenciaBox = (DatePicker)target; + ((UIElement)FimPendenciaBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((Control)FimPendenciaBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 27: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AtualizarPendencias_OnClick); + break; + case 28: + VencimentoApolices = (Button)target; + ((ButtonBase)VencimentoApolices).Click += new RoutedEventHandler(DetalharProducao_OnClick); + break; + case 29: + ParcelasAVencer = (Button)target; + ((ButtonBase)ParcelasAVencer).Click += new RoutedEventHandler(DetalharProducao_OnClick); + break; + case 30: + ApolicesPendentes = (Button)target; + ((ButtonBase)ApolicesPendentes).Click += new RoutedEventHandler(DetalharProducao_OnClick); + break; + case 31: + ParcelasPendentes = (Button)target; + ((ButtonBase)ParcelasPendentes).Click += new RoutedEventHandler(DetalharProducao_OnClick); + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.BI/ProspeccaoView.cs b/Decompiler/Gestor.Application.Views.BI/ProspeccaoView.cs new file mode 100644 index 0000000..fa3513d --- /dev/null +++ b/Decompiler/Gestor.Application.Views.BI/ProspeccaoView.cs @@ -0,0 +1,403 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Threading; +using Gestor.Application.Drawers; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.ViewModels.BI; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Views.BI; + +public class ProspeccaoView : BaseUserControl, IComponentConnector, IStyleConnector +{ + private bool openProsceccao; + + internal DatePicker InicioBox; + + internal DatePicker FimBox; + + internal AutoCompleteBox AutoCompleteFornecedor; + + internal MenuItem MaisOpcoesButton; + + private bool _contentLoaded; + + public ProspeccaoViewModel ViewModel { get; set; } + + public ProspeccaoView() + { + ((FrameworkElement)this).Tag = "PROSPECTAR"; + ViewModel = new ProspeccaoViewModel(); + ((FrameworkElement)this).DataContext = ViewModel; + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + InitializeComponent(); + } + + private async void ContentLoad() + { + await ViewModel.CarregaProspeccao(); + await ViewModel.CarregarPermissao(); + } + + private async void Periodo_OnSelectedDateChanged(object sender, SelectionChangedEventArgs e) + { + await ViewModel.CarregarProspeccoes(); + } + + private async void Vendedor_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + await ViewModel.CarregarProspeccoes(); + } + + private async void StatusProspeccao_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + await ViewModel.CarregarProspeccoes(); + } + + private async void CriarProspeccao_OnClick(object sender, RoutedEventArgs e) + { + if (!(await ViewModel.BuscaPermissao("Incluir"))) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA INCLUIR PROSPECÇÃO. CONTATE O ADMINISTRADOR DO SISTEMA."); + } + else if (!openProsceccao) + { + openProsceccao = true; + Prospeccao data = new Prospeccao + { + Status = (StatusProspeccao)1, + Renovacao = true + }; + ViewModel.Loading(isLoading: true); + await AbrirProspeccao(data); + openProsceccao = false; + ViewModel.Loading(isLoading: false); + } + } + + private async Task AbrirProspeccao(Prospeccao data) + { + if (!(await ViewModel.BuscaPermissao("Alterar"))) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ALTERAR PROSPECÇÃO. CONTATE O ADMINISTRADOR DO SISTEMA."); + return; + } + InicioBox.Text = ValidationHelper.FormatDate(InicioBox.Text); + FimBox.Text = ValidationHelper.FormatDate(FimBox.Text); + try + { + ViewModel.Inicio = Convert.ToDateTime(InicioBox.Text); + ViewModel.Fim = Convert.ToDateTime(FimBox.Text); + } + catch (Exception) + { + return; + } + Prospeccao tarefa; + while (true) + { + bool inclusao = ((DomainBase)data).Id == 0; + tarefa = await ViewModel.ShowProspeccaoDialog(data); + if (tarefa == null) + { + if (!inclusao) + { + await ViewModel.CarregarProspeccoes(); + ViewModel.SelectedProspeccao = ((IEnumerable<Prospeccao>)ViewModel.ProspeccoesFiltradas).FirstOrDefault((Func<Prospeccao, bool>)((Prospeccao x) => ((DomainBase)x).Id == ((DomainBase)data).Id)); + } + return; + } + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(data); + if (list == null || list.Count == 0) + { + break; + } + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + string text = ((((DomainBase)tarefa).Id == 0L) ? "INCLUIU" : "ALTEROU"); + ViewModel.RegistrarAcao(text + " PROSPECÇÃO \"" + tarefa.Nome + "\"", ((DomainBase)tarefa).Id, (TipoTela)33, $"CLIENTE \"{tarefa.Nome}\", ID: {((DomainBase)tarefa).Id}"); + ViewModel.ToggleSnackBar("PROSPECÇÃO SALVA COM SUCESSO."); + await ViewModel.CarregarProspeccoes(); + } + + private void AutoCompleteBoxDetalhe_Populating(object sender, PopulatingEventArgs e) + { + e.Cancel = true; + ViewModel.FiltrarProspecao(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Prospeccao>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private async void Control_OnMouseDoubleClick(object sender, MouseButtonEventArgs e) + { + DataGrid val = (DataGrid)sender; + if (val == null || ((Selector)val).SelectedIndex >= 0) + { + Prospeccao data = (Prospeccao)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null); + ViewModel.Loading(isLoading: true); + await AbrirProspeccao(data); + ViewModel.Loading(isLoading: false); + } + } + + private async void EditarProspeccao_OnClick(object sender, RoutedEventArgs e) + { + Prospeccao data = (Prospeccao)((FrameworkElement)(Button)sender).DataContext; + ViewModel.Loading(isLoading: true); + await AbrirProspeccao(data); + ViewModel.Loading(isLoading: false); + } + + private async void AbrirAquivoDigital_Click(object sender, RoutedEventArgs e) + { + if (!(await ViewModel.BuscaPermissao("Alterar"))) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ALTERAR PROSPECÇÃO. CONTATE O ADMINISTRADOR DO SISTEMA."); + return; + } + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)11).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)11) + "."); + return; + } + Prospeccao val = (Prospeccao)((FrameworkElement)(Button)sender).DataContext; + FiltroArquivoDigital filtro = new FiltroArquivoDigital + { + Id = ((DomainBase)val).Id, + Tipo = (TipoArquivoDigital)11, + Parente = val + }; + ViewModel.ShowDrawer(new ArquivoDigitalDrawer(filtro), 0, close: false); + } + + private async void ExcluirProspeccao_OnClick(object sender, RoutedEventArgs e) + { + if (!(await ViewModel.BuscaPermissao("Excluir"))) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA EXCLUIR PROSPECÇÃO. CONTATE O ADMINISTRADOR DO SISTEMA."); + return; + } + Prospeccao prospeccao = (Prospeccao)((FrameworkElement)(Button)sender).DataContext; + ViewModel.Excluir(prospeccao); + } + + private void AbrirLog_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLog((TipoTela)33, ((DomainBase)ViewModel.SelectedProspeccao).Id); + } + + private void AbrirLogEmail_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLogEmail((TipoTela)33, ((DomainBase)ViewModel.SelectedProspeccao).Id); + } + + private async void Imprimir_OnClick(object sender, RoutedEventArgs e) + { + InicioBox.Text = ValidationHelper.FormatDate(InicioBox.Text); + FimBox.Text = ValidationHelper.FormatDate(FimBox.Text); + try + { + ViewModel.Inicio = Convert.ToDateTime(InicioBox.Text); + ViewModel.Fim = Convert.ToDateTime(FimBox.Text); + } + catch (Exception) + { + return; + } + await ViewModel.Print(); + } + + private async void Excel_OnClick(object sender, RoutedEventArgs e) + { + InicioBox.Text = ValidationHelper.FormatDate(InicioBox.Text); + FimBox.Text = ValidationHelper.FormatDate(FimBox.Text); + try + { + ViewModel.Inicio = Convert.ToDateTime(InicioBox.Text); + ViewModel.Fim = Convert.ToDateTime(FimBox.Text); + } + catch (Exception) + { + return; + } + await ViewModel.GerarExcel(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/bi/prospeccaoview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_003e: Unknown result type (might be due to invalid IL or missing references) + //IL_004a: Unknown result type (might be due to invalid IL or missing references) + //IL_0054: Expected O, but got Unknown + //IL_0056: Unknown result type (might be due to invalid IL or missing references) + //IL_0062: Unknown result type (might be due to invalid IL or missing references) + //IL_006c: Expected O, but got Unknown + //IL_006f: Unknown result type (might be due to invalid IL or missing references) + //IL_0079: Expected O, but got Unknown + //IL_0086: Unknown result type (might be due to invalid IL or missing references) + //IL_0090: Expected O, but got Unknown + //IL_009d: Unknown result type (might be due to invalid IL or missing references) + //IL_00a7: Expected O, but got Unknown + //IL_00b4: Unknown result type (might be due to invalid IL or missing references) + //IL_00be: Expected O, but got Unknown + //IL_00d8: Unknown result type (might be due to invalid IL or missing references) + //IL_00e2: Expected O, but got Unknown + //IL_00ef: Unknown result type (might be due to invalid IL or missing references) + //IL_00f9: Expected O, but got Unknown + //IL_0106: Unknown result type (might be due to invalid IL or missing references) + //IL_0110: Expected O, but got Unknown + //IL_011d: Unknown result type (might be due to invalid IL or missing references) + //IL_0127: Expected O, but got Unknown + //IL_0141: Unknown result type (might be due to invalid IL or missing references) + //IL_014b: Expected O, but got Unknown + //IL_0158: Unknown result type (might be due to invalid IL or missing references) + //IL_0162: Expected O, but got Unknown + //IL_0164: Unknown result type (might be due to invalid IL or missing references) + //IL_0170: Unknown result type (might be due to invalid IL or missing references) + //IL_017a: Expected O, but got Unknown + //IL_017c: Unknown result type (might be due to invalid IL or missing references) + //IL_0188: Unknown result type (might be due to invalid IL or missing references) + //IL_0192: Expected O, but got Unknown + //IL_0194: Unknown result type (might be due to invalid IL or missing references) + //IL_01a0: Unknown result type (might be due to invalid IL or missing references) + //IL_01aa: Expected O, but got Unknown + //IL_01ad: Unknown result type (might be due to invalid IL or missing references) + //IL_01b7: Expected O, but got Unknown + //IL_01b9: Unknown result type (might be due to invalid IL or missing references) + //IL_01c5: Unknown result type (might be due to invalid IL or missing references) + //IL_01cf: Expected O, but got Unknown + //IL_01d1: Unknown result type (might be due to invalid IL or missing references) + //IL_01dd: Unknown result type (might be due to invalid IL or missing references) + //IL_01e7: Expected O, but got Unknown + //IL_01e9: Unknown result type (might be due to invalid IL or missing references) + //IL_01f5: Unknown result type (might be due to invalid IL or missing references) + //IL_01ff: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((Selector)(ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(Vendedor_OnSelectionChanged); + break; + case 2: + ((Selector)(ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(StatusProspeccao_OnSelectionChanged); + break; + case 3: + InicioBox = (DatePicker)target; + ((UIElement)InicioBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)InicioBox).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)InicioBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + InicioBox.SelectedDateChanged += Periodo_OnSelectedDateChanged; + break; + case 4: + FimBox = (DatePicker)target; + ((UIElement)FimBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)FimBox).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)FimBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + FimBox.SelectedDateChanged += Periodo_OnSelectedDateChanged; + break; + case 5: + AutoCompleteFornecedor = (AutoCompleteBox)target; + AutoCompleteFornecedor.Populating += new PopulatingEventHandler(AutoCompleteBoxDetalhe_Populating); + break; + case 6: + ((MenuItem)target).Click += new RoutedEventHandler(Imprimir_OnClick); + break; + case 7: + ((MenuItem)target).Click += new RoutedEventHandler(Excel_OnClick); + break; + case 8: + ((MenuItem)target).Click += new RoutedEventHandler(CriarProspeccao_OnClick); + break; + case 9: + MaisOpcoesButton = (MenuItem)target; + break; + case 10: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick); + break; + case 11: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLogEmail_OnClick); + break; + case 12: + ((Control)(DataGrid)target).MouseDoubleClick += new MouseButtonEventHandler(Control_OnMouseDoubleClick); + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + //IL_0023: Unknown result type (might be due to invalid IL or missing references) + //IL_002d: Expected O, but got Unknown + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_003b: Unknown result type (might be due to invalid IL or missing references) + //IL_0045: Expected O, but got Unknown + //IL_0047: Unknown result type (might be due to invalid IL or missing references) + //IL_0053: Unknown result type (might be due to invalid IL or missing references) + //IL_005d: Expected O, but got Unknown + switch (connectionId) + { + case 13: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirProspeccao_OnClick); + break; + case 14: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AbrirAquivoDigital_Click); + break; + case 15: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(EditarProspeccao_OnClick); + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.BI/TarefaView.cs b/Decompiler/Gestor.Application.Views.BI/TarefaView.cs new file mode 100644 index 0000000..4d574e2 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.BI/TarefaView.cs @@ -0,0 +1,601 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Data; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Threading; +using Gestor.Application.Actions; +using Gestor.Application.Componentes; +using Gestor.Application.Drawers; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.ViewModels.BI; +using Gestor.Application.Views.Ferramentas; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.MalaDireta; +using Gestor.Model.Domain.Seguros; +using MaterialDesignThemes.Wpf; +using Xceed.Wpf.AvalonDock.Controls; + +namespace Gestor.Application.Views.BI; + +public class TarefaView : BaseUserControl, IComponentConnector, IStyleConnector +{ + internal ComboBox UsuarioBox; + + internal DatePicker InicioBox; + + internal DatePicker FimBox; + + internal TextBox TituloTarefaLabel; + + internal DatePicker AgendamentoBox; + + internal ComboBox ResponsavelBox; + + internal RadioButton AnotacoesButton; + + internal RadioButton AnotacoesInternasButton; + + internal WebEditor Anotacoes; + + internal WebEditor Historico; + + internal WebEditor AnotacoesInternas; + + internal WebEditor HistoricoInterno; + + private bool _contentLoaded; + + public TarefaBIViewModel ViewModel { get; set; } + + public TarefaView() + { + ViewModel = new TarefaBIViewModel(); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + } + + private void ContentLoad() + { + //IL_0046: Unknown result type (might be due to invalid IL or missing references) + //IL_0050: Expected O, but got Unknown + //IL_005d: Unknown result type (might be due to invalid IL or missing references) + //IL_0067: Expected O, but got Unknown + ((ToggleButton)AnotacoesButton).IsChecked = ViewModel.IsAnotacoes; + ((ToggleButton)AnotacoesInternasButton).IsChecked = !ViewModel.IsAnotacoes; + ((ToggleButton)AnotacoesButton).Checked += new RoutedEventHandler(Anotacoes_OnChecked); + ((ToggleButton)AnotacoesInternasButton).Checked += new RoutedEventHandler(AnotacoesInternas_OnChecked); + } + + private async void ExcluirTarefa_OnClick(object sender, RoutedEventArgs e) + { + if (!(await ViewModel.ValidaPermissaoParaExcluirTarefa())) + { + await ViewModel.ShowMessage($"APENAS O USUÁRIO {ViewModel.SelectedTarefa.UsuarioCadastro.Nome} (ID: {((DomainBase)ViewModel.SelectedTarefa.UsuarioCadastro).Id}) PODE EXCLUIR ESSA TAREFA."); + } + else + { + await ViewModel.Excluir(); + } + } + + private async void TarefaConcluida_OnClick(object sender, RoutedEventArgs e) + { + object dataContext = ((FrameworkElement)(Button)sender).DataContext; + Tarefa tarefa = (Tarefa)((dataContext is Tarefa) ? dataContext : null); + if (tarefa != null) + { + if (!(await ViewModel.ValidaPermissaoParaEditarTarefa())) + { + await ViewModel.ShowMessage($"APENAS O USUÁRIO {ViewModel.SelectedTarefa.UsuarioCadastro.Nome} (ID: {((DomainBase)ViewModel.SelectedTarefa.UsuarioCadastro).Id}) PODE CONCLUIR ESSA TAREFA."); + return; + } + tarefa.Conclusao = Funcoes.GetNetworkTime(); + tarefa.Status = (StatusTarefa)2; + await ViewModel.ConcluirTarefa(tarefa); + await ViewModel.CarregarTarefas(); + Gestor.Application.Actions.Actions.AtualizaTrilhas?.Invoke(); + } + } + + private async void Concluida_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.SelectedTarefa == null) + { + await ViewModel.ShowMessage("NECESSÁRIO SELECIONAR UMA TAREFA ANTES DE CONCLUIR."); + return; + } + if (!(await ViewModel.ValidaPermissaoParaEditarTarefa())) + { + await ViewModel.ShowMessage($"APENAS O USUÁRIO {ViewModel.SelectedTarefa.UsuarioCadastro.Nome} (ID: {((DomainBase)ViewModel.SelectedTarefa.UsuarioCadastro).Id}) PODE CONCLUIR ESSA TAREFA."); + return; + } + ViewModel.SelectedTarefa.Conclusao = Funcoes.GetNetworkTime(); + ViewModel.SelectedTarefa.Status = (StatusTarefa)2; + await ViewModel.ConcluirTarefa(ViewModel.SelectedTarefa); + await ViewModel.CarregarTarefas(); + } + + private async void NaoConcluida_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.SelectedTarefa == null) + { + await ViewModel.ShowMessage("NECESSÁRIO SELECIONAR UMA TAREFA ANTES DE MARCAR COMO NÃO CONCLUÍDO."); + return; + } + ViewModel.SelectedTarefa.Conclusao = null; + ViewModel.SelectedTarefa.Status = (StatusTarefa)0; + await ViewModel.ConcluirTarefa(ViewModel.SelectedTarefa); + await ViewModel.CarregarTarefas(); + } + + private async void Salvar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.SelectedTarefa.Anotacoes = Anotacoes.GetHtml(); + ViewModel.SelectedTarefa.AnotacoesInternas = AnotacoesInternas.GetHtml(); + ViewModel.SelectedTarefa.Usuario = (Usuario)((Selector)ResponsavelBox).SelectedItem; + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(TituloTarefaLabel.Text); + bool num = list == null || list.Count == 0; + ViewModel.Loading(isLoading: false); + if (num) + { + ViewModel.ToggleSnackBar("TAREFA SALVA COM SUCESSO."); + ViewModel.Alterar(alterar: false); + } + else + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + } + + private async void Cancelar_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.Cancelar(); + } + + private async void Excluir_OnClick(object sender, RoutedEventArgs e) + { + if (!ViewModel.SelectedTarefa.Restrito.HasValue || !ViewModel.SelectedTarefa.Restrito.Value || ((DomainBase)ViewModel.SelectedTarefa.UsuarioCadastro).Id == ((DomainBase)Recursos.Usuario).Id || Recursos.Usuario.Administrador) + { + await ViewModel.Excluir(); + } + else + { + await ViewModel.ShowMessage($"APENAS O USUÁRIO {ViewModel.SelectedTarefa.UsuarioCadastro.Nome} (ID: {((DomainBase)ViewModel.SelectedTarefa.UsuarioCadastro).Id}) PODE EXCLUIR ESSA TAREFA."); + } + } + + private void AdicionarFiltro_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AdcionarFiltro(); + } + + private void ExcluirFiltro_onClick(object sender, RoutedEventArgs e) + { + Chip val = (Chip)((sender is Chip) ? sender : null); + if (val != null) + { + ListBox val2 = Extentions.FindVisualAncestor<ListBox>((DependencyObject)(object)val); + string text = (string)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)]; + if (text != null) + { + ViewModel.ExcluirFiltro(text); + } + } + } + + private void Alterar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AlterarTarefa(); + Anotacoes.Initialize(); + AnotacoesInternas.Initialize(); + } + + private void CopyTelefoneToClipBoard_Click(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + Button val = (Button)sender; + if (((FrameworkElement)val).DataContext != null) + { + object dataContext = ((FrameworkElement)val).DataContext; + TelefoneBase val2 = (TelefoneBase)((dataContext is TelefoneBase) ? dataContext : null); + if (val2 != null) + { + (val2.Prefixo + ValidationHelper.OnlyNumber(val2.Numero)).CopyToClipboard(); + ViewModel.ToggleSnackBar("COPIADO - " + val2.Prefixo + ValidationHelper.OnlyNumber(val2.Numero)); + } + } + } + + private async void WhatsAppMessage_Click(object sender, RoutedEventArgs e) + { + Button val = (Button)sender; + if (((FrameworkElement)val).DataContext != null) + { + object dataContext = ((FrameworkElement)val).DataContext; + TelefoneBase val2 = (TelefoneBase)((dataContext is TelefoneBase) ? dataContext : null); + if (val2 != null && !((val2.Tipo.HasValue && (int)val2.Tipo.GetValueOrDefault() == 8) ? (val2.Prefixo + val2.Numero).Clear() : ("55" + val2.Prefixo + val2.Numero.Clear())).EnviarWhatsapp()) + { + await ViewModel.ShowMessage("HOUVE UM PROBLEMA AO ABRIR LINK DO WHATSAPP, O LINK FOI COPIADO EM SUA MAQUINA, BASTA ABRIR O NAVEGADOR DE INTERNET E COLAR NA BARRA DE ENDEREÇOS"); + } + } + } + + private async void Email_OnClick(object sender, RoutedEventArgs e) + { + MalaDireta val = await ViewModel.CriarMalaDireta(ViewModel.SelectedTarefa.Entidade); + if (val == null) + { + await ViewModel.ShowMessage("NECESSÁRIO SELECIONAR AO MENOS UM CLIENTE PARA PROSSEGUIR."); + return; + } + if (Funcoes.IsWindowOpen<HosterWindow>("ENVIO DE E-MAIL")) + { + Funcoes.Destroy<HosterWindow>("ENVIO DE E-MAIL"); + } + string text = "Cliente: " + ViewModel.SelectedTarefa.Cliente + "<br>"; + text += $"Número do Atendimento: {((DomainBase)ViewModel.SelectedTarefa).Id}<br>"; + text += $"Data/Hora da Solicitação: {ViewModel.SelectedTarefa.Agendamento}<br>"; + if (ViewModel.SelectedTarefa.Conclusao.HasValue) + { + text += $"Data/Hora da Conclusão: {ViewModel.SelectedTarefa.Conclusao}<br>"; + } + if (ViewModel.SelectedTarefa.Usuario != null) + { + text = text + "Atendente: " + ViewModel.SelectedTarefa.Usuario.Nome + "<br>"; + } + if (ViewModel.SelectedTarefa.TipoDeTarefa != null) + { + text = text + "Tipo: " + ViewModel.SelectedTarefa.TipoDeTarefa.Nome + "<br>"; + } + text = text + "Assunto: " + ViewModel.SelectedTarefa.Titulo + "<br>"; + text = text + "Situação do Atendimento: " + ValidationHelper.GetDescription((Enum)(object)ViewModel.SelectedTarefa.Status) + "<br><br>"; + text += "Prezado cliente,<br>"; + text += "Segue, abaixo, a descrição do seu atendimento prestado pela corretora.<br><hr>"; + ((Window)new HosterWindow((ContentControl)(object)new MalaDiretaView(new List<MalaDireta> { val }, ViewModel.SelectedTarefa.Titulo, text + ViewModel.Descricao), "ENVIO DE E-MAIL", 1200.0, 600.0, canMaximize: true)).Show(); + } + + private void Imprimir_OnClick(object sender, RoutedEventArgs e) + { + if (((DomainBase)ViewModel.SelectedTarefa).Id != 0L) + { + ViewModel.Print(); + } + } + + private void Cliente_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Abrir((TipoTarefa)2); + } + + private void Apolice_OnClick(object sender, RoutedEventArgs e) + { + //IL_0011: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Invalid comparison between Unknown and I4 + ViewModel.Abrir((TipoTarefa)(((int)ViewModel.SelectedTarefa.Entidade == 3) ? 3 : 0)); + } + + private void Sinistro_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Abrir((TipoTarefa)4); + } + + private void AbrirLog_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLog((TipoTela)38, ((DomainBase)ViewModel.SelectedTarefa).Id); + } + + private void ArquivoDigital_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirArquivoDigital(); + } + + private async void AnexoTarefa_OnClick(object sender, RoutedEventArgs e) + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)15).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)15) + "."); + return; + } + FiltroArquivoDigital filtro = new FiltroArquivoDigital + { + Id = ((DomainBase)ViewModel.SelectedTarefa).Id, + Tipo = (TipoArquivoDigital)15, + Parente = ViewModel.SelectedTarefa + }; + ViewModel.ShowDrawer(new ArquivoDigitalDrawer(filtro), 0, close: false); + } + + private void Anotacoes_OnChecked(object sender, RoutedEventArgs e) + { + ViewModel.IsAnotacoes = true; + } + + private void AnotacoesInternas_OnChecked(object sender, RoutedEventArgs e) + { + ViewModel.IsAnotacoes = false; + } + + private void ExcluirResponsavel_OnClick(object sender, RoutedEventArgs e) + { + //IL_0011: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Expected O, but got Unknown + Chip val = (Chip)((sender is Chip) ? sender : null); + if (val == null) + { + return; + } + ResponsavelTarefa val2 = (ResponsavelTarefa)((FrameworkElement)val).DataContext; + if (val2 != null) + { + ViewModel.Responsaveis.Remove(val2); + ViewModel.Usuarios.Add(val2.Usuario); + ViewModel.Usuarios = new ObservableCollection<Usuario>(ViewModel.Usuarios.OrderBy((Usuario x) => x.Nome)); + } + } + + private void AdicionarResponsavel_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AdcionarResponsavel(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/bi/tarefaview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0097: Unknown result type (might be due to invalid IL or missing references) + //IL_00a1: Expected O, but got Unknown + //IL_00a4: Unknown result type (might be due to invalid IL or missing references) + //IL_00ae: Expected O, but got Unknown + //IL_00bb: Unknown result type (might be due to invalid IL or missing references) + //IL_00c5: Expected O, but got Unknown + //IL_00d2: Unknown result type (might be due to invalid IL or missing references) + //IL_00dc: Expected O, but got Unknown + //IL_00df: Unknown result type (might be due to invalid IL or missing references) + //IL_00e9: Expected O, but got Unknown + //IL_00f6: Unknown result type (might be due to invalid IL or missing references) + //IL_0100: Expected O, but got Unknown + //IL_010d: Unknown result type (might be due to invalid IL or missing references) + //IL_0117: Expected O, but got Unknown + //IL_0119: Unknown result type (might be due to invalid IL or missing references) + //IL_0125: Unknown result type (might be due to invalid IL or missing references) + //IL_012f: Expected O, but got Unknown + //IL_0131: Unknown result type (might be due to invalid IL or missing references) + //IL_013d: Unknown result type (might be due to invalid IL or missing references) + //IL_0147: Expected O, but got Unknown + //IL_0149: Unknown result type (might be due to invalid IL or missing references) + //IL_0155: Unknown result type (might be due to invalid IL or missing references) + //IL_015f: Expected O, but got Unknown + //IL_0161: Unknown result type (might be due to invalid IL or missing references) + //IL_016d: Unknown result type (might be due to invalid IL or missing references) + //IL_0177: Expected O, but got Unknown + //IL_0179: Unknown result type (might be due to invalid IL or missing references) + //IL_0185: Unknown result type (might be due to invalid IL or missing references) + //IL_018f: Expected O, but got Unknown + //IL_0191: Unknown result type (might be due to invalid IL or missing references) + //IL_019d: Unknown result type (might be due to invalid IL or missing references) + //IL_01a7: Expected O, but got Unknown + //IL_01a9: Unknown result type (might be due to invalid IL or missing references) + //IL_01b5: Unknown result type (might be due to invalid IL or missing references) + //IL_01bf: Expected O, but got Unknown + //IL_01c1: Unknown result type (might be due to invalid IL or missing references) + //IL_01cd: Unknown result type (might be due to invalid IL or missing references) + //IL_01d7: Expected O, but got Unknown + //IL_01d9: Unknown result type (might be due to invalid IL or missing references) + //IL_01e5: Unknown result type (might be due to invalid IL or missing references) + //IL_01ef: Expected O, but got Unknown + //IL_01f1: Unknown result type (might be due to invalid IL or missing references) + //IL_01fd: Unknown result type (might be due to invalid IL or missing references) + //IL_0207: Expected O, but got Unknown + //IL_0209: Unknown result type (might be due to invalid IL or missing references) + //IL_0215: Unknown result type (might be due to invalid IL or missing references) + //IL_021f: Expected O, but got Unknown + //IL_0221: Unknown result type (might be due to invalid IL or missing references) + //IL_022d: Unknown result type (might be due to invalid IL or missing references) + //IL_0237: Expected O, but got Unknown + //IL_0239: Unknown result type (might be due to invalid IL or missing references) + //IL_0245: Unknown result type (might be due to invalid IL or missing references) + //IL_024f: Expected O, but got Unknown + //IL_0251: Unknown result type (might be due to invalid IL or missing references) + //IL_025d: Unknown result type (might be due to invalid IL or missing references) + //IL_0267: Expected O, but got Unknown + //IL_0269: Unknown result type (might be due to invalid IL or missing references) + //IL_0275: Unknown result type (might be due to invalid IL or missing references) + //IL_027f: Expected O, but got Unknown + //IL_0282: Unknown result type (might be due to invalid IL or missing references) + //IL_028c: Expected O, but got Unknown + //IL_028f: Unknown result type (might be due to invalid IL or missing references) + //IL_0299: Expected O, but got Unknown + //IL_02a6: Unknown result type (might be due to invalid IL or missing references) + //IL_02b0: Expected O, but got Unknown + //IL_02b3: Unknown result type (might be due to invalid IL or missing references) + //IL_02bd: Expected O, but got Unknown + //IL_02bf: Unknown result type (might be due to invalid IL or missing references) + //IL_02cb: Unknown result type (might be due to invalid IL or missing references) + //IL_02d5: Expected O, but got Unknown + //IL_02d8: Unknown result type (might be due to invalid IL or missing references) + //IL_02e2: Expected O, but got Unknown + //IL_02e5: Unknown result type (might be due to invalid IL or missing references) + //IL_02ef: Expected O, but got Unknown + switch (connectionId) + { + case 1: + UsuarioBox = (ComboBox)target; + break; + case 2: + InicioBox = (DatePicker)target; + ((UIElement)InicioBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((Control)InicioBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 3: + FimBox = (DatePicker)target; + ((UIElement)FimBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((Control)FimBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 4: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AdicionarFiltro_OnClick); + break; + case 8: + ((MenuItem)target).Click += new RoutedEventHandler(Concluida_OnClick); + break; + case 9: + ((MenuItem)target).Click += new RoutedEventHandler(NaoConcluida_OnClick); + break; + case 10: + ((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick); + break; + case 11: + ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick); + break; + case 12: + ((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick); + break; + case 13: + ((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick); + break; + case 14: + ((MenuItem)target).Click += new RoutedEventHandler(AnexoTarefa_OnClick); + break; + case 15: + ((MenuItem)target).Click += new RoutedEventHandler(Cliente_OnClick); + break; + case 16: + ((MenuItem)target).Click += new RoutedEventHandler(Apolice_OnClick); + break; + case 17: + ((MenuItem)target).Click += new RoutedEventHandler(ArquivoDigital_OnClick); + break; + case 18: + ((MenuItem)target).Click += new RoutedEventHandler(Sinistro_OnClick); + break; + case 19: + ((MenuItem)target).Click += new RoutedEventHandler(Imprimir_OnClick); + break; + case 20: + ((MenuItem)target).Click += new RoutedEventHandler(Email_OnClick); + break; + case 21: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick); + break; + case 24: + TituloTarefaLabel = (TextBox)target; + break; + case 25: + AgendamentoBox = (DatePicker)target; + ((UIElement)AgendamentoBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + break; + case 26: + ResponsavelBox = (ComboBox)target; + break; + case 27: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AdicionarResponsavel_OnClick); + break; + case 29: + AnotacoesButton = (RadioButton)target; + break; + case 30: + AnotacoesInternasButton = (RadioButton)target; + break; + case 31: + Anotacoes = (WebEditor)target; + break; + case 32: + Historico = (WebEditor)target; + break; + case 33: + AnotacoesInternas = (WebEditor)target; + break; + case 34: + HistoricoInterno = (WebEditor)target; + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_008b: Unknown result type (might be due to invalid IL or missing references) + //IL_0097: Unknown result type (might be due to invalid IL or missing references) + //IL_00a1: Expected O, but got Unknown + //IL_002b: Unknown result type (might be due to invalid IL or missing references) + //IL_0037: Unknown result type (might be due to invalid IL or missing references) + //IL_0041: Expected O, but got Unknown + //IL_0043: Unknown result type (might be due to invalid IL or missing references) + //IL_004f: Unknown result type (might be due to invalid IL or missing references) + //IL_0059: Expected O, but got Unknown + //IL_005b: Unknown result type (might be due to invalid IL or missing references) + //IL_0067: Unknown result type (might be due to invalid IL or missing references) + //IL_0071: Expected O, but got Unknown + //IL_00a3: Unknown result type (might be due to invalid IL or missing references) + //IL_00af: Unknown result type (might be due to invalid IL or missing references) + //IL_00b9: Expected O, but got Unknown + //IL_0073: Unknown result type (might be due to invalid IL or missing references) + //IL_007f: Unknown result type (might be due to invalid IL or missing references) + //IL_0089: Expected O, but got Unknown + switch (connectionId) + { + case 5: + ((Chip)target).DeleteClick += new RoutedEventHandler(ExcluirFiltro_onClick); + break; + case 6: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirTarefa_OnClick); + break; + case 7: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(TarefaConcluida_OnClick); + break; + case 22: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(CopyTelefoneToClipBoard_Click); + break; + case 23: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(WhatsAppMessage_Click); + break; + case 28: + ((Chip)target).DeleteClick += new RoutedEventHandler(ExcluirResponsavel_OnClick); + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Ferramentas/CadastroEmailView.cs b/Decompiler/Gestor.Application.Views.Ferramentas/CadastroEmailView.cs new file mode 100644 index 0000000..bf93bab --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Ferramentas/CadastroEmailView.cs @@ -0,0 +1,407 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Threading; +using Gestor.Application.Componentes; +using Gestor.Application.Helpers; +using Gestor.Application.ViewModels.Ferramentas; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; + +namespace Gestor.Application.Views.Ferramentas; + +public class CadastroEmailView : UserControl, IComponentConnector +{ + internal DataGrid CredenciaisGrid; + + internal MenuItem SalvarApoliceButton; + + internal MenuItem CancelarApoliceButton; + + internal MenuItem MaisOpcoesButton; + + internal TextBox DescricaoBox; + + internal TextBox HeaderBox; + + internal ComboBox TipoBox; + + internal TextBox PortaBox; + + internal TextBox DominioBox; + + internal TextBox EmailBox; + + internal CustomPasswordBox SenhaBox; + + internal TextBox LoginBox; + + internal TextBlock CabecalhoTitulo; + + internal WebEditor Cabecalho; + + internal TextBlock AssinaturaTitulo; + + internal WebEditor Assinatura; + + private bool _contentLoaded; + + public CadastroEmailViewModel ViewModel { get; set; } + + public CadastroEmailView() + { + ((FrameworkElement)this).Tag = "CADASTRO DE E-MAIL"; + ViewModel = new CadastroEmailViewModel(); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + } + + private async void ContentLoad() + { + ViewModel.Loading(isLoading: true); + await ViewModel.SelecionaCredenciais(); + ViewModel.Loading(isLoading: false); + } + + private void Incluir_OnClick(object sender, RoutedEventArgs e) + { + ((UIElement)Assinatura).Visibility = (Visibility)0; + ((UIElement)AssinaturaTitulo).Visibility = (Visibility)0; + ViewModel.Incluir(); + ValidarTela(); + } + + private async void Cancelar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + await ViewModel.CancelarAlteracao(); + Assinatura.Initialize(); + ((UIElement)Assinatura).Visibility = (Visibility)2; + ((UIElement)AssinaturaTitulo).Visibility = (Visibility)2; + Cabecalho.Initialize(); + ((UIElement)Cabecalho).Visibility = (Visibility)2; + ((UIElement)CabecalhoTitulo).Visibility = (Visibility)2; + ViewModel.Loading(isLoading: false); + ScrollToItem(); + } + + private void ScrollToItem() + { + if (((Selector)CredenciaisGrid).SelectedItem != null) + { + ((UIElement)CredenciaisGrid).UpdateLayout(); + CredenciaisGrid.ScrollIntoView(((Selector)CredenciaisGrid).SelectedItem); + } + } + + private async void Salvar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + ViewModel.SelectedCredencial.Assinatura = ReplaceLocalImages(Assinatura.GetHtml()); + ViewModel.SelectedCredencial.Cabecalho = ReplaceLocalImages(Cabecalho.GetHtml()); + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(); + ((DependencyObject)(object)this).ValidateFields(list); + bool num = list == null || list.Count == 0; + ViewModel.Loading(isLoading: false); + if (num) + { + ((UIElement)Assinatura).Visibility = (Visibility)2; + ((UIElement)AssinaturaTitulo).Visibility = (Visibility)2; + ((UIElement)Cabecalho).Visibility = (Visibility)2; + ((UIElement)CabecalhoTitulo).Visibility = (Visibility)2; + ScrollToItem(); + } + else + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + } + + public string ReplaceLocalImages(string mailBody) + { + string[] array = (from Match m in Regex.Matches(mailBody, "<img(.*?)src=\"file:(///).*?>", RegexOptions.IgnoreCase) + select m.Groups[0].Value).ToArray(); + for (int i = 0; i < array.Length; i++) + { + string value = Regex.Match(array[i], "(?<=src=\")(.*?)(?=\")", RegexOptions.IgnoreCase).Value; + string text = Regex.Match(value, "file:(///).*\\.(.*)", RegexOptions.IgnoreCase).Groups[2].Value; + if (text == "jpg") + { + text = "jpeg"; + } + if (Uri.IsWellFormedUriString(value, UriKind.Absolute)) + { + Uri uri = new Uri(value); + if (File.Exists(uri.LocalPath)) + { + mailBody = mailBody.Replace(value, "data:image/" + text + ";base64," + Convert.ToBase64String(File.ReadAllBytes(uri.LocalPath))); + } + } + } + return mailBody; + } + + private void Alterar_OnClick(object sender, RoutedEventArgs e) + { + ((UIElement)Assinatura).Visibility = (Visibility)0; + ((UIElement)AssinaturaTitulo).Visibility = (Visibility)0; + ((UIElement)Cabecalho).Visibility = (Visibility)0; + ((UIElement)CabecalhoTitulo).Visibility = (Visibility)0; + ViewModel.Alterar(alterar: true); + ValidarTela(); + ((DomainBase)ViewModel.SelectedCredencial).Initialize(); + } + + private async void Excluir_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.Excluir(); + ScrollToItem(); + } + + private void AutoCompleteBox_Populating(object sender, PopulatingEventArgs e) + { + e.Cancel = true; + ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Credencial>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void AutoCompleteBox_OnTextChanged(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + if (string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).Text)) + { + ViewModel.FiltrarCredenciais(""); + } + } + + private void AbrirLog_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLog((TipoTela)17, ((DomainBase)ViewModel.SelectedCredencial).Id); + } + + private async void ButtonBase_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + bool num = await ViewModel.EnviarTesteEmail(); + ViewModel.Loading(isLoading: false); + if (num) + { + ViewModel.ToggleSnackBar("E-MAIL ENVIADO COM SUCESSO."); + } + } + + private void ValidarTela() + { + if (ViewModel.SelectedCredencial != null) + { + List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedCredencial.Validate(); + ((DependencyObject)(object)this).ValidateFields(errorMessages, focusField: false); + } + } + + private void Tipo_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Unknown result type (might be due to invalid IL or missing references) + //IL_0015: Unknown result type (might be due to invalid IL or missing references) + //IL_001a: Unknown result type (might be due to invalid IL or missing references) + if ((TipoEmail?)((Selector)(ComboBox)sender).SelectedItem == (TipoEmail?)0 && ViewModel.SelectedCredencial.Email != null && ViewModel.SelectedCredencial.Email.Contains("@gmail.com")) + { + EmailBox.Text = ""; + } + } + + private void EmailBox_OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + if (((TextBox)sender).Text.Contains("@gmail.com")) + { + ((Selector)TipoBox).SelectedItem = (object)(TipoEmail)1; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/ferramentas/cadastroemailview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0066: Unknown result type (might be due to invalid IL or missing references) + //IL_0072: Unknown result type (might be due to invalid IL or missing references) + //IL_007c: Expected O, but got Unknown + //IL_007d: Unknown result type (might be due to invalid IL or missing references) + //IL_0089: Unknown result type (might be due to invalid IL or missing references) + //IL_0093: Expected O, but got Unknown + //IL_0096: Unknown result type (might be due to invalid IL or missing references) + //IL_00a0: Expected O, but got Unknown + //IL_00a2: Unknown result type (might be due to invalid IL or missing references) + //IL_00ae: Unknown result type (might be due to invalid IL or missing references) + //IL_00b8: Expected O, but got Unknown + //IL_00ba: Unknown result type (might be due to invalid IL or missing references) + //IL_00c6: Unknown result type (might be due to invalid IL or missing references) + //IL_00d0: Expected O, but got Unknown + //IL_00d3: Unknown result type (might be due to invalid IL or missing references) + //IL_00dd: Expected O, but got Unknown + //IL_00ea: Unknown result type (might be due to invalid IL or missing references) + //IL_00f4: Expected O, but got Unknown + //IL_00f7: Unknown result type (might be due to invalid IL or missing references) + //IL_0101: Expected O, but got Unknown + //IL_010e: Unknown result type (might be due to invalid IL or missing references) + //IL_0118: Expected O, but got Unknown + //IL_011a: Unknown result type (might be due to invalid IL or missing references) + //IL_0126: Unknown result type (might be due to invalid IL or missing references) + //IL_0130: Expected O, but got Unknown + //IL_0133: Unknown result type (might be due to invalid IL or missing references) + //IL_013d: Expected O, but got Unknown + //IL_013f: Unknown result type (might be due to invalid IL or missing references) + //IL_014b: Unknown result type (might be due to invalid IL or missing references) + //IL_0155: Expected O, but got Unknown + //IL_0157: Unknown result type (might be due to invalid IL or missing references) + //IL_0163: Unknown result type (might be due to invalid IL or missing references) + //IL_016d: Expected O, but got Unknown + //IL_0170: Unknown result type (might be due to invalid IL or missing references) + //IL_017a: Expected O, but got Unknown + //IL_017d: Unknown result type (might be due to invalid IL or missing references) + //IL_0187: Expected O, but got Unknown + //IL_018a: Unknown result type (might be due to invalid IL or missing references) + //IL_0194: Expected O, but got Unknown + //IL_01a1: Unknown result type (might be due to invalid IL or missing references) + //IL_01ab: Expected O, but got Unknown + //IL_01ae: Unknown result type (might be due to invalid IL or missing references) + //IL_01b8: Expected O, but got Unknown + //IL_01bb: Unknown result type (might be due to invalid IL or missing references) + //IL_01c5: Expected O, but got Unknown + //IL_01c8: Unknown result type (might be due to invalid IL or missing references) + //IL_01d2: Expected O, but got Unknown + //IL_01df: Unknown result type (might be due to invalid IL or missing references) + //IL_01e9: Expected O, but got Unknown + //IL_01f9: Unknown result type (might be due to invalid IL or missing references) + //IL_0203: Expected O, but got Unknown + //IL_0206: Unknown result type (might be due to invalid IL or missing references) + //IL_0210: Expected O, but got Unknown + //IL_0220: Unknown result type (might be due to invalid IL or missing references) + //IL_022a: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBox_Populating); + ((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBox_OnTextChanged); + break; + case 2: + CredenciaisGrid = (DataGrid)target; + break; + case 3: + ((MenuItem)target).Click += new RoutedEventHandler(Incluir_OnClick); + break; + case 4: + ((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick); + break; + case 5: + SalvarApoliceButton = (MenuItem)target; + SalvarApoliceButton.Click += new RoutedEventHandler(Salvar_OnClick); + break; + case 6: + CancelarApoliceButton = (MenuItem)target; + CancelarApoliceButton.Click += new RoutedEventHandler(Cancelar_OnClick); + break; + case 7: + ((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick); + break; + case 8: + MaisOpcoesButton = (MenuItem)target; + break; + case 9: + ((MenuItem)target).Click += new RoutedEventHandler(ButtonBase_OnClick); + break; + case 10: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick); + break; + case 11: + DescricaoBox = (TextBox)target; + break; + case 12: + HeaderBox = (TextBox)target; + break; + case 13: + TipoBox = (ComboBox)target; + ((Selector)TipoBox).SelectionChanged += new SelectionChangedEventHandler(Tipo_OnSelectionChanged); + break; + case 14: + PortaBox = (TextBox)target; + break; + case 15: + DominioBox = (TextBox)target; + break; + case 16: + EmailBox = (TextBox)target; + ((UIElement)EmailBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(EmailBox_OnLostKeyboardFocus); + break; + case 17: + SenhaBox = (CustomPasswordBox)target; + break; + case 18: + LoginBox = (TextBox)target; + break; + case 19: + CabecalhoTitulo = (TextBlock)target; + break; + case 20: + Cabecalho = (WebEditor)target; + break; + case 21: + AssinaturaTitulo = (TextBlock)target; + break; + case 22: + Assinatura = (WebEditor)target; + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Ferramentas/CadastroParceiroView.cs b/Decompiler/Gestor.Application.Views.Ferramentas/CadastroParceiroView.cs new file mode 100644 index 0000000..3212dae --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Ferramentas/CadastroParceiroView.cs @@ -0,0 +1,442 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Threading; +using Gestor.Application.Helpers; +using Gestor.Application.ViewModels.Ferramentas; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Views.Ferramentas; + +public class CadastroParceiroView : BaseUserControl, IComponentConnector +{ + [Serializable] + [CompilerGenerated] + private sealed class _003C_003Ec + { + public static readonly _003C_003Ec _003C_003E9 = new _003C_003Ec(); + + public static MouseButtonEventHandler _003C_003E9__5_0; + + internal void _003CContentLoad_003Eb__5_0(object sender, MouseButtonEventArgs args) + { + } + } + + internal DataGrid ParceiroGrid; + + internal MenuItem MaisOpcoesButton; + + internal TextBox NomeBox; + + internal TextBox DocumentoPrincipalBox; + + internal TextBox PrimeiroPrefixo; + + internal TextBox PrimeiroTelefone; + + internal TextBox SegundoPrefixo; + + internal TextBox SegundoTelefone; + + internal TextBox TerceiroPrefixo; + + internal TextBox TerceiroTelefone; + + internal TextBox EmailBox; + + internal TextBox CepBox; + + internal TextBox EnderecoBox; + + internal TextBox NumeroBox; + + internal TextBox BairroBox; + + internal TextBox CidadeBox; + + internal TextBox EstadoBox; + + private bool _contentLoaded; + + public CadastroParceiroViewModel ViewModel { get; set; } + + public CadastroParceiroView(Parceiro parceiro = null) + { + CadastroParceiroView cadastroParceiroView = this; + ((FrameworkElement)this).Tag = "CADASTRO DE PARCEIROS"; + ViewModel = new CadastroParceiroViewModel(parceiro); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)(Action)delegate + { + cadastroParceiroView.ContentLoad(parceiro); + }); + } + } + + private void ContentLoad(Parceiro parceiro) + { + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0026: Expected O, but got Unknown + //IL_0040: Unknown result type (might be due to invalid IL or missing references) + //IL_0045: Unknown result type (might be due to invalid IL or missing references) + //IL_004b: Expected O, but got Unknown + if (parceiro == null) + { + ((Selector)ParceiroGrid).SelectedIndex = -1; + } + ((Selector)ParceiroGrid).SelectionChanged += new SelectionChangedEventHandler(ParceiroGrid_OnSelectionChanged); + DataGrid parceiroGrid = ParceiroGrid; + object obj = _003C_003Ec._003C_003E9__5_0; + if (obj == null) + { + MouseButtonEventHandler val = delegate + { + }; + _003C_003Ec._003C_003E9__5_0 = val; + obj = (object)val; + } + ((Control)parceiroGrid).MouseDoubleClick += (MouseButtonEventHandler)obj; + } + + private void Incluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Incluir(); + ValidarTela(); + } + + private void Alterar_OnClick(object sender, RoutedEventArgs e) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Expected O, but got Unknown + ViewModel.CancelParceiro = (Parceiro)((DomainBase)ViewModel.SelectedParceiro).Clone(); + ViewModel.Alterar(alterar: true); + ValidarTela(); + ((DomainBase)ViewModel.SelectedParceiro).Initialize(); + } + + private void Excluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Excluir(); + } + + private async void Salvar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + ((UIElement)NomeBox).Focus(); + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(); + ((DependencyObject)(object)this).ValidateFields(list); + bool num = list == null || list.Count == 0; + ViewModel.Loading(isLoading: false); + if (!num) + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + } + + private void Cancelar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.CancelarAlteracao(); + } + + private void AutoCompleteBoxParceiro_Populating(object sender, PopulatingEventArgs e) + { + e.Cancel = true; + ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Parceiro>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void AutoCompleteBox_OnTextChanged(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + if (string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).Text)) + { + ViewModel.FiltrarParceiro(""); + } + } + + private void ParceiroGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_0031: Unknown result type (might be due to invalid IL or missing references) + //IL_003b: Expected O, but got Unknown + DataGrid val = (DataGrid)sender; + if (val == null || ((Selector)val).SelectedIndex >= 0) + { + ViewModel.SelecionarParceiro((Parceiro)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null)); + } + } + + private void AbrirLog_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLog((TipoTela)22, ((DomainBase)ViewModel.SelectedParceiro).Id); + } + + private async void PostcodeBox_OnLostFocus(object sender, RoutedEventArgs e) + { + string text = ValidationHelper.FormatPostCode(((TextBox)sender).Text); + CepBox.Text = text; + if (ValidationHelper.ValidatePostCode(text)) + { + EnderecoBase val = await ViewModel.BuscaCep(text); + if (val != null) + { + EnderecoBox.Text = val.Endereco; + CidadeBox.Text = val.Cidade; + EstadoBox.Text = val.Estado; + BairroBox.Text = val.Bairro; + } + } + } + + private void DocumentoPrincipalBox_LostFocus(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + if (!((TextBoxBase)(TextBox)sender).IsReadOnly) + { + string text = ValidationHelper.Clear(DocumentoPrincipalBox.Text); + if (!string.IsNullOrEmpty(text)) + { + DocumentoPrincipalBox.Text = ((text.Length == 11) ? ValidationHelper.FormatDocument(text.PadLeft(11, '0').Substring(0, 11)) : ValidationHelper.FormatDocument(text.PadLeft(14, '0').Substring(0, 14))); + } + } + } + + private void ValidarTela() + { + if (ViewModel.SelectedParceiro != null) + { + List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedParceiro.Validate(); + ((DependencyObject)(object)this).ValidateFields(errorMessages, focusField: false); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/ferramentas/cadastroparceiroview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_006e: Unknown result type (might be due to invalid IL or missing references) + //IL_007a: Unknown result type (might be due to invalid IL or missing references) + //IL_0084: Expected O, but got Unknown + //IL_0085: Unknown result type (might be due to invalid IL or missing references) + //IL_0091: Unknown result type (might be due to invalid IL or missing references) + //IL_009b: Expected O, but got Unknown + //IL_009e: Unknown result type (might be due to invalid IL or missing references) + //IL_00a8: Expected O, but got Unknown + //IL_00aa: Unknown result type (might be due to invalid IL or missing references) + //IL_00b6: Unknown result type (might be due to invalid IL or missing references) + //IL_00c0: Expected O, but got Unknown + //IL_00c2: Unknown result type (might be due to invalid IL or missing references) + //IL_00ce: Unknown result type (might be due to invalid IL or missing references) + //IL_00d8: Expected O, but got Unknown + //IL_00da: Unknown result type (might be due to invalid IL or missing references) + //IL_00e6: Unknown result type (might be due to invalid IL or missing references) + //IL_00f0: Expected O, but got Unknown + //IL_00f2: Unknown result type (might be due to invalid IL or missing references) + //IL_00fe: Unknown result type (might be due to invalid IL or missing references) + //IL_0108: Expected O, but got Unknown + //IL_010a: Unknown result type (might be due to invalid IL or missing references) + //IL_0116: Unknown result type (might be due to invalid IL or missing references) + //IL_0120: Expected O, but got Unknown + //IL_0123: Unknown result type (might be due to invalid IL or missing references) + //IL_012d: Expected O, but got Unknown + //IL_012f: Unknown result type (might be due to invalid IL or missing references) + //IL_013b: Unknown result type (might be due to invalid IL or missing references) + //IL_0145: Expected O, but got Unknown + //IL_0148: Unknown result type (might be due to invalid IL or missing references) + //IL_0152: Expected O, but got Unknown + //IL_0155: Unknown result type (might be due to invalid IL or missing references) + //IL_015f: Expected O, but got Unknown + //IL_016c: Unknown result type (might be due to invalid IL or missing references) + //IL_0176: Expected O, but got Unknown + //IL_0184: Unknown result type (might be due to invalid IL or missing references) + //IL_018e: Expected O, but got Unknown + //IL_0191: Unknown result type (might be due to invalid IL or missing references) + //IL_019b: Expected O, but got Unknown + //IL_01a9: Unknown result type (might be due to invalid IL or missing references) + //IL_01b3: Expected O, but got Unknown + //IL_01b6: Unknown result type (might be due to invalid IL or missing references) + //IL_01c0: Expected O, but got Unknown + //IL_01ce: Unknown result type (might be due to invalid IL or missing references) + //IL_01d8: Expected O, but got Unknown + //IL_01e6: Unknown result type (might be due to invalid IL or missing references) + //IL_01f0: Expected O, but got Unknown + //IL_01f3: Unknown result type (might be due to invalid IL or missing references) + //IL_01fd: Expected O, but got Unknown + //IL_020b: Unknown result type (might be due to invalid IL or missing references) + //IL_0215: Expected O, but got Unknown + //IL_0218: Unknown result type (might be due to invalid IL or missing references) + //IL_0222: Expected O, but got Unknown + //IL_0230: Unknown result type (might be due to invalid IL or missing references) + //IL_023a: Expected O, but got Unknown + //IL_0248: Unknown result type (might be due to invalid IL or missing references) + //IL_0252: Expected O, but got Unknown + //IL_0255: Unknown result type (might be due to invalid IL or missing references) + //IL_025f: Expected O, but got Unknown + //IL_026d: Unknown result type (might be due to invalid IL or missing references) + //IL_0277: Expected O, but got Unknown + //IL_027a: Unknown result type (might be due to invalid IL or missing references) + //IL_0284: Expected O, but got Unknown + //IL_0292: Unknown result type (might be due to invalid IL or missing references) + //IL_029c: Expected O, but got Unknown + //IL_02aa: Unknown result type (might be due to invalid IL or missing references) + //IL_02b4: Expected O, but got Unknown + //IL_02b7: Unknown result type (might be due to invalid IL or missing references) + //IL_02c1: Expected O, but got Unknown + //IL_02c4: Unknown result type (might be due to invalid IL or missing references) + //IL_02ce: Expected O, but got Unknown + //IL_02db: Unknown result type (might be due to invalid IL or missing references) + //IL_02e5: Expected O, but got Unknown + //IL_02f3: Unknown result type (might be due to invalid IL or missing references) + //IL_02fd: Expected O, but got Unknown + //IL_0300: Unknown result type (might be due to invalid IL or missing references) + //IL_030a: Expected O, but got Unknown + //IL_030d: Unknown result type (might be due to invalid IL or missing references) + //IL_0317: Expected O, but got Unknown + //IL_031a: Unknown result type (might be due to invalid IL or missing references) + //IL_0324: Expected O, but got Unknown + //IL_0327: Unknown result type (might be due to invalid IL or missing references) + //IL_0331: Expected O, but got Unknown + //IL_0334: Unknown result type (might be due to invalid IL or missing references) + //IL_033e: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBoxParceiro_Populating); + ((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBox_OnTextChanged); + break; + case 2: + ParceiroGrid = (DataGrid)target; + break; + case 3: + ((MenuItem)target).Click += new RoutedEventHandler(Incluir_OnClick); + break; + case 4: + ((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick); + break; + case 5: + ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick); + break; + case 6: + ((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick); + break; + case 7: + ((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick); + break; + case 8: + MaisOpcoesButton = (MenuItem)target; + break; + case 9: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick); + break; + case 10: + NomeBox = (TextBox)target; + break; + case 11: + DocumentoPrincipalBox = (TextBox)target; + ((UIElement)DocumentoPrincipalBox).LostFocus += new RoutedEventHandler(DocumentoPrincipalBox_LostFocus); + ((UIElement)DocumentoPrincipalBox).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 12: + PrimeiroPrefixo = (TextBox)target; + ((UIElement)PrimeiroPrefixo).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 13: + PrimeiroTelefone = (TextBox)target; + ((UIElement)PrimeiroTelefone).LostFocus += new RoutedEventHandler(FormatarTelefone); + ((UIElement)PrimeiroTelefone).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 14: + SegundoPrefixo = (TextBox)target; + ((UIElement)SegundoPrefixo).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 15: + SegundoTelefone = (TextBox)target; + ((UIElement)SegundoTelefone).LostFocus += new RoutedEventHandler(FormatarTelefone); + ((UIElement)SegundoTelefone).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 16: + TerceiroPrefixo = (TextBox)target; + ((UIElement)TerceiroPrefixo).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 17: + TerceiroTelefone = (TextBox)target; + ((UIElement)TerceiroTelefone).LostFocus += new RoutedEventHandler(FormatarTelefone); + ((UIElement)TerceiroTelefone).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 18: + EmailBox = (TextBox)target; + break; + case 19: + CepBox = (TextBox)target; + ((UIElement)CepBox).LostFocus += new RoutedEventHandler(PostcodeBox_OnLostFocus); + ((UIElement)CepBox).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 20: + EnderecoBox = (TextBox)target; + break; + case 21: + NumeroBox = (TextBox)target; + break; + case 22: + BairroBox = (TextBox)target; + break; + case 23: + CidadeBox = (TextBox)target; + break; + case 24: + EstadoBox = (TextBox)target; + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Ferramentas/DownloadWindow.cs b/Decompiler/Gestor.Application.Views.Ferramentas/DownloadWindow.cs new file mode 100644 index 0000000..0c208ad --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Ferramentas/DownloadWindow.cs @@ -0,0 +1,217 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Media; +using System.Windows.Shapes; +using System.Windows.Shell; +using System.Windows.Threading; +using Gestor.Application.ViewModels.Ferramentas; +using Gestor.Model.API; + +namespace Gestor.Application.Views.Ferramentas; + +public class DownloadWindow : Window, IComponentConnector +{ + internal DownloadViewModel ViewModel; + + private bool _buttonClickable; + + internal WindowChrome WindowChrome; + + internal Grid MinimizeButton; + + internal Grid MaximizeButton; + + internal Grid CloseButton; + + private bool _contentLoaded; + + private void TopControls_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + //IL_0008: Unknown result type (might be due to invalid IL or missing references) + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + //IL_0030: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_003f: Expected O, but got Unknown + _buttonClickable = true; + ((Panel)(Grid)sender).Background = (Brush)((((FrameworkElement)(Grid)sender).Name == "CloseButton") ? new SolidColorBrush(Colors.Red) : new SolidColorBrush(Colors.DimGray)); + } + + private void TopControls_OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + if (_buttonClickable) + { + ((object)this).GetType().GetMethod(((FrameworkElement)(Grid)sender).Name + "_Click")?.Invoke(this, null); + } + } + + private static void TopControls_OnMouseEnter(object sender, MouseEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Unknown result type (might be due to invalid IL or missing references) + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_001d: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Unknown result type (might be due to invalid IL or missing references) + //IL_0038: Expected O, but got Unknown + //IL_0039: Unknown result type (might be due to invalid IL or missing references) + //IL_0044: Expected O, but got Unknown + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_0053: Unknown result type (might be due to invalid IL or missing references) + //IL_005d: Expected O, but got Unknown + ((Panel)(Grid)sender).Background = (Brush)((((FrameworkElement)(Grid)sender).Name == "CloseButton") ? new SolidColorBrush(Colors.IndianRed) : new SolidColorBrush(Colors.Gray)); + DependencyObject child = VisualTreeHelper.GetChild((DependencyObject)(Grid)sender, 0); + Path val = (Path)(object)((child is Path) ? child : null); + if (val != null) + { + ((Shape)val).Stroke = (Brush)new SolidColorBrush(Colors.White); + } + } + + private void TopControls_OnMouseLeave(object sender, MouseEventArgs e) + { + //IL_0008: Unknown result type (might be due to invalid IL or missing references) + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Unknown result type (might be due to invalid IL or missing references) + //IL_001c: Expected O, but got Unknown + //IL_001d: Unknown result type (might be due to invalid IL or missing references) + //IL_0028: Expected O, but got Unknown + //IL_0032: Unknown result type (might be due to invalid IL or missing references) + //IL_0037: Unknown result type (might be due to invalid IL or missing references) + //IL_0041: Expected O, but got Unknown + _buttonClickable = false; + ((Panel)(Grid)sender).Background = (Brush)new SolidColorBrush(Colors.Transparent); + DependencyObject child = VisualTreeHelper.GetChild((DependencyObject)(Grid)sender, 0); + Path val = (Path)(object)((child is Path) ? child : null); + if (val != null) + { + ((Shape)val).Stroke = (Brush)new SolidColorBrush(Colors.White); + } + } + + public void MinimizeButton_Click() + { + ((Window)this).WindowState = (WindowState)1; + } + + public void CloseButton_Click() + { + ((Window)this).Close(); + } + + public DownloadWindow(Parameters parameters) + { + ViewModel = new DownloadViewModel(parameters); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + } + + private void ContentLoad() + { + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Expected O, but got Unknown + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Expected O, but got Unknown + //IL_003b: Unknown result type (might be due to invalid IL or missing references) + //IL_0045: Expected O, but got Unknown + //IL_0052: Unknown result type (might be due to invalid IL or missing references) + //IL_005c: Expected O, but got Unknown + //IL_0069: Unknown result type (might be due to invalid IL or missing references) + //IL_0073: Expected O, but got Unknown + //IL_0080: Unknown result type (might be due to invalid IL or missing references) + //IL_008a: Expected O, but got Unknown + ((UIElement)MinimizeButton).MouseEnter += new MouseEventHandler(TopControls_OnMouseEnter); + ((UIElement)MinimizeButton).MouseLeave += new MouseEventHandler(TopControls_OnMouseLeave); + ((UIElement)MaximizeButton).MouseEnter += new MouseEventHandler(TopControls_OnMouseEnter); + ((UIElement)MaximizeButton).MouseLeave += new MouseEventHandler(TopControls_OnMouseLeave); + ((UIElement)CloseButton).MouseEnter += new MouseEventHandler(TopControls_OnMouseEnter); + ((UIElement)CloseButton).MouseLeave += new MouseEventHandler(TopControls_OnMouseLeave); + } + + private async void DownloadWindow_OnLoaded(object sender, RoutedEventArgs e) + { + ViewModel.IsEnabled = false; + await ViewModel.Atualizar(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/ferramentas/downloadwindow.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_0038: Expected O, but got Unknown + //IL_003b: Unknown result type (might be due to invalid IL or missing references) + //IL_0045: Expected O, but got Unknown + //IL_0048: Unknown result type (might be due to invalid IL or missing references) + //IL_0052: Expected O, but got Unknown + //IL_005f: Unknown result type (might be due to invalid IL or missing references) + //IL_0069: Expected O, but got Unknown + //IL_0076: Unknown result type (might be due to invalid IL or missing references) + //IL_0080: Expected O, but got Unknown + //IL_0083: Unknown result type (might be due to invalid IL or missing references) + //IL_008d: Expected O, but got Unknown + //IL_009a: Unknown result type (might be due to invalid IL or missing references) + //IL_00a4: Expected O, but got Unknown + //IL_00b1: Unknown result type (might be due to invalid IL or missing references) + //IL_00bb: Expected O, but got Unknown + //IL_00be: Unknown result type (might be due to invalid IL or missing references) + //IL_00c8: Expected O, but got Unknown + //IL_00d5: Unknown result type (might be due to invalid IL or missing references) + //IL_00df: Expected O, but got Unknown + //IL_00ec: Unknown result type (might be due to invalid IL or missing references) + //IL_00f6: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((FrameworkElement)(DownloadWindow)target).Loaded += new RoutedEventHandler(DownloadWindow_OnLoaded); + break; + case 2: + WindowChrome = (WindowChrome)target; + break; + case 3: + MinimizeButton = (Grid)target; + ((UIElement)MinimizeButton).MouseLeftButtonDown += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonDown); + ((UIElement)MinimizeButton).MouseLeftButtonUp += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonUp); + break; + case 4: + MaximizeButton = (Grid)target; + ((UIElement)MaximizeButton).MouseLeftButtonDown += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonDown); + ((UIElement)MaximizeButton).MouseLeftButtonUp += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonUp); + break; + case 5: + CloseButton = (Grid)target; + ((UIElement)CloseButton).MouseLeftButtonDown += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonDown); + ((UIElement)CloseButton).MouseLeftButtonUp += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonUp); + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Ferramentas/EmpresaView.cs b/Decompiler/Gestor.Application.Views.Ferramentas/EmpresaView.cs new file mode 100644 index 0000000..f940576 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Ferramentas/EmpresaView.cs @@ -0,0 +1,469 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Threading; +using Gestor.Application.Componentes; +using Gestor.Application.Drawers; +using Gestor.Application.Drawers.Configuracoes; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.ViewModels.Ferramentas; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; + +namespace Gestor.Application.Views.Ferramentas; + +public class EmpresaView : BaseUserControl, IComponentConnector +{ + [Serializable] + [CompilerGenerated] + private sealed class _003C_003Ec + { + public static readonly _003C_003Ec _003C_003E9 = new _003C_003Ec(); + + public static MouseButtonEventHandler _003C_003E9__5_0; + + internal void _003CContentLoad_003Eb__5_0(object sender, MouseButtonEventArgs args) + { + } + } + + internal DataGrid EmpresaGrid; + + internal MenuItem Alterar; + + internal TextBox DocumentoPrincipalBox; + + internal TextBox NomeBox; + + internal TextBox CepBox; + + internal TextBox EnderecoBox; + + internal TextBox BairroBox; + + internal TextBox CidadeBox; + + internal TextBox EstadoBox; + + internal CustomPasswordBox SenhaBox; + + private bool _contentLoaded; + + public EmpresaViewModel ViewModel { get; set; } + + public EmpresaView() + { + ((FrameworkElement)this).Tag = "CADASTRO DE EMPRESA E FILIAIS"; + ViewModel = new EmpresaViewModel(); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + } + + private void ContentLoad() + { + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_0023: Expected O, but got Unknown + //IL_003d: Unknown result type (might be due to invalid IL or missing references) + //IL_0042: Unknown result type (might be due to invalid IL or missing references) + //IL_0048: Expected O, but got Unknown + ((Selector)EmpresaGrid).SelectedIndex = 0; + ((Selector)EmpresaGrid).SelectionChanged += new SelectionChangedEventHandler(EmpresaGrid_OnSelectionChanged); + DataGrid empresaGrid = EmpresaGrid; + object obj = _003C_003Ec._003C_003E9__5_0; + if (obj == null) + { + MouseButtonEventHandler val = delegate + { + }; + _003C_003Ec._003C_003E9__5_0 = val; + obj = (object)val; + } + ((Control)empresaGrid).MouseDoubleClick += (MouseButtonEventHandler)obj; + if (((DomainBase)Recursos.Usuario).Id == 0L) + { + ((UIElement)Alterar).IsEnabled = true; + } + } + + private void Cancelar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.CancelarAlteracao(); + if (((DomainBase)Recursos.Usuario).Id == 0L) + { + ((UIElement)Alterar).IsEnabled = true; + } + ((TextBoxBase)NomeBox).IsReadOnly = true; + ((TextBoxBase)DocumentoPrincipalBox).IsReadOnly = true; + ViewModel.PassWordReadOnly = ViewModel.EnableFields; + ViewModel.ConfirmacaoSenha = (Visibility)2; + } + + private async void Salvar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(); + ((DependencyObject)(object)this).ValidateFields(list); + bool num = list == null || list.Count == 0; + ViewModel.Loading(isLoading: false); + ViewModel.PassWordReadOnly = ViewModel.EnableFields; + ViewModel.ConfirmacaoSenha = (Visibility)((list == null || list.Count <= 0) ? 2 : 0); + if (((DomainBase)Recursos.Usuario).Id == 0L) + { + ((UIElement)Alterar).IsEnabled = true; + ((TextBoxBase)NomeBox).IsReadOnly = true; + ((TextBoxBase)DocumentoPrincipalBox).IsReadOnly = true; + } + if (!num) + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + } + + private void Alterar_OnClick(object sender, RoutedEventArgs e) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Expected O, but got Unknown + ViewModel.CancelEmpresa = (Empresa)((DomainBase)ViewModel.SelectedEmpresa).Clone(); + ViewModel.Alterar(alterar: true); + PermissaoAuteracao(); + ViewModel.PassWordReadOnly = ViewModel.EnableFields; + ViewModel.ConfirmacaoSenha = (Visibility)((((DomainBase)ViewModel.SelectedEmpresa).Id != 1) ? 2 : 0); + } + + public void PermissaoAuteracao() + { + if (((DomainBase)Recursos.Usuario).Id != 0L) + { + ((TextBoxBase)DocumentoPrincipalBox).IsReadOnly = true; + ((TextBoxBase)NomeBox).IsReadOnly = true; + return; + } + ViewModel.ConfirmacaoSenha = (Visibility)((((DomainBase)ViewModel.SelectedEmpresa).Id != 1) ? 2 : 0); + ViewModel.PassWordReadOnly = true; + ((UIElement)Alterar).IsEnabled = false; + ((TextBoxBase)DocumentoPrincipalBox).IsReadOnly = false; + ((TextBoxBase)NomeBox).IsReadOnly = false; + } + + private async void PostcodeBox_OnLostFocus(object sender, RoutedEventArgs e) + { + if (!ViewModel.EnableFields) + { + return; + } + string text = ValidationHelper.FormatPostCode(((TextBox)sender).Text); + CepBox.Text = text; + if (ValidationHelper.ValidatePostCode(text)) + { + EnderecoBase val = await ViewModel.BuscaCep(text); + if (val != null) + { + EnderecoBox.Text = val.Endereco; + CidadeBox.Text = val.Cidade; + EstadoBox.Text = val.Estado; + BairroBox.Text = val.Bairro; + } + } + } + + private void AutoCompleteBoxEmpresa_Populating(object sender, PopulatingEventArgs e) + { + e.Cancel = true; + ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Empresa>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void AutoCompleteBox_OnTextChanged(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + if (string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).Text)) + { + ViewModel.FiltrarEmpresa(""); + } + } + + private void EmpresaGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_0031: Unknown result type (might be due to invalid IL or missing references) + //IL_003b: Expected O, but got Unknown + DataGrid val = (DataGrid)sender; + if (val == null || ((Selector)val).SelectedIndex >= 0) + { + ViewModel.SelecionaEmpresa((Empresa)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null)); + } + } + + private async void AbrirAquivoDigital_Click(object sender, RoutedEventArgs e) + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)13).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)13) + "."); + return; + } + FiltroArquivoDigital filtro = new FiltroArquivoDigital + { + Id = ((DomainBase)ViewModel.SelectedEmpresa).Id, + Tipo = (TipoArquivoDigital)13, + Parente = ViewModel.SelectedEmpresa + }; + ViewModel.ShowDrawer(new ArquivoDigitalDrawer(filtro), 0, close: false); + } + + private void AbrirLog_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLog((TipoTela)18, ((DomainBase)ViewModel.SelectedEmpresa).Id); + } + + private void AbrirLogEmail_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLogEmail((TipoTela)18, ((DomainBase)ViewModel.SelectedEmpresa).Id); + } + + private async void Configuracoes_OnClick(object sender, RoutedEventArgs e) + { + if (await ViewModel.VerificarRestricao((TipoRestricao)64)) + { + ViewModel.ShowDrawer(new ConfiguracoesDrawer(), 0, close: false); + } + } + + private void DocumentoPrincipalBox_LostFocus(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + if (!((TextBoxBase)(TextBox)sender).IsReadOnly) + { + string text = DocumentoPrincipalBox.Text.Clear(); + if (!string.IsNullOrEmpty(text)) + { + DocumentoPrincipalBox.Text = ((text.Length == 11) ? ValidationHelper.FormatDocument(text.PadLeft(11, '0').Substring(0, 11)) : ValidationHelper.FormatDocument(text.PadLeft(14, '0').Substring(0, 14))); + } + } + } + + private async void AnexarLogo_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + await ViewModel.AnexarLogo(); + ViewModel.Loading(isLoading: false); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/ferramentas/empresaview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_006e: Unknown result type (might be due to invalid IL or missing references) + //IL_007a: Unknown result type (might be due to invalid IL or missing references) + //IL_0084: Expected O, but got Unknown + //IL_0085: Unknown result type (might be due to invalid IL or missing references) + //IL_0091: Unknown result type (might be due to invalid IL or missing references) + //IL_009b: Expected O, but got Unknown + //IL_009e: Unknown result type (might be due to invalid IL or missing references) + //IL_00a8: Expected O, but got Unknown + //IL_00ab: Unknown result type (might be due to invalid IL or missing references) + //IL_00b5: Expected O, but got Unknown + //IL_00c2: Unknown result type (might be due to invalid IL or missing references) + //IL_00cc: Expected O, but got Unknown + //IL_00ce: Unknown result type (might be due to invalid IL or missing references) + //IL_00da: Unknown result type (might be due to invalid IL or missing references) + //IL_00e4: Expected O, but got Unknown + //IL_00e6: Unknown result type (might be due to invalid IL or missing references) + //IL_00f2: Unknown result type (might be due to invalid IL or missing references) + //IL_00fc: Expected O, but got Unknown + //IL_00fe: Unknown result type (might be due to invalid IL or missing references) + //IL_010a: Unknown result type (might be due to invalid IL or missing references) + //IL_0114: Expected O, but got Unknown + //IL_0116: Unknown result type (might be due to invalid IL or missing references) + //IL_0122: Unknown result type (might be due to invalid IL or missing references) + //IL_012c: Expected O, but got Unknown + //IL_012e: Unknown result type (might be due to invalid IL or missing references) + //IL_013a: Unknown result type (might be due to invalid IL or missing references) + //IL_0144: Expected O, but got Unknown + //IL_0146: Unknown result type (might be due to invalid IL or missing references) + //IL_0152: Unknown result type (might be due to invalid IL or missing references) + //IL_015c: Expected O, but got Unknown + //IL_015e: Unknown result type (might be due to invalid IL or missing references) + //IL_016a: Unknown result type (might be due to invalid IL or missing references) + //IL_0174: Expected O, but got Unknown + //IL_0177: Unknown result type (might be due to invalid IL or missing references) + //IL_0181: Expected O, but got Unknown + //IL_018e: Unknown result type (might be due to invalid IL or missing references) + //IL_0198: Expected O, but got Unknown + //IL_01a6: Unknown result type (might be due to invalid IL or missing references) + //IL_01b0: Expected O, but got Unknown + //IL_01b3: Unknown result type (might be due to invalid IL or missing references) + //IL_01bd: Expected O, but got Unknown + //IL_01c0: Unknown result type (might be due to invalid IL or missing references) + //IL_01ca: Expected O, but got Unknown + //IL_01d7: Unknown result type (might be due to invalid IL or missing references) + //IL_01e1: Expected O, but got Unknown + //IL_01ef: Unknown result type (might be due to invalid IL or missing references) + //IL_01f9: Expected O, but got Unknown + //IL_01fc: Unknown result type (might be due to invalid IL or missing references) + //IL_0206: Expected O, but got Unknown + //IL_0209: Unknown result type (might be due to invalid IL or missing references) + //IL_0213: Expected O, but got Unknown + //IL_0216: Unknown result type (might be due to invalid IL or missing references) + //IL_0220: Expected O, but got Unknown + //IL_0223: Unknown result type (might be due to invalid IL or missing references) + //IL_022d: Expected O, but got Unknown + //IL_023c: Unknown result type (might be due to invalid IL or missing references) + //IL_0249: Unknown result type (might be due to invalid IL or missing references) + //IL_0253: Expected O, but got Unknown + //IL_0255: Unknown result type (might be due to invalid IL or missing references) + //IL_0262: Unknown result type (might be due to invalid IL or missing references) + //IL_026c: Expected O, but got Unknown + //IL_026d: Unknown result type (might be due to invalid IL or missing references) + //IL_027a: Unknown result type (might be due to invalid IL or missing references) + //IL_0284: Expected O, but got Unknown + //IL_0286: Unknown result type (might be due to invalid IL or missing references) + //IL_0293: Unknown result type (might be due to invalid IL or missing references) + //IL_029d: Expected O, but got Unknown + //IL_029f: Unknown result type (might be due to invalid IL or missing references) + //IL_02ac: Unknown result type (might be due to invalid IL or missing references) + //IL_02b6: Expected O, but got Unknown + //IL_02b7: Unknown result type (might be due to invalid IL or missing references) + //IL_02c4: Unknown result type (might be due to invalid IL or missing references) + //IL_02ce: Expected O, but got Unknown + //IL_02d0: Unknown result type (might be due to invalid IL or missing references) + //IL_02dd: Unknown result type (might be due to invalid IL or missing references) + //IL_02e7: Expected O, but got Unknown + //IL_02e9: Unknown result type (might be due to invalid IL or missing references) + //IL_02f6: Unknown result type (might be due to invalid IL or missing references) + //IL_0300: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBoxEmpresa_Populating); + ((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBox_OnTextChanged); + break; + case 2: + EmpresaGrid = (DataGrid)target; + break; + case 3: + Alterar = (MenuItem)target; + Alterar.Click += new RoutedEventHandler(Alterar_OnClick); + break; + case 4: + ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick); + break; + case 5: + ((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick); + break; + case 6: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirAquivoDigital_Click); + break; + case 7: + ((MenuItem)target).Click += new RoutedEventHandler(AnexarLogo_OnClick); + break; + case 8: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick); + break; + case 9: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLogEmail_OnClick); + break; + case 10: + ((MenuItem)target).Click += new RoutedEventHandler(Configuracoes_OnClick); + break; + case 11: + DocumentoPrincipalBox = (TextBox)target; + ((UIElement)DocumentoPrincipalBox).LostFocus += new RoutedEventHandler(DocumentoPrincipalBox_LostFocus); + ((UIElement)DocumentoPrincipalBox).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 12: + NomeBox = (TextBox)target; + break; + case 13: + CepBox = (TextBox)target; + ((UIElement)CepBox).LostFocus += new RoutedEventHandler(PostcodeBox_OnLostFocus); + ((UIElement)CepBox).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 14: + EnderecoBox = (TextBox)target; + break; + case 15: + BairroBox = (TextBox)target; + break; + case 16: + CidadeBox = (TextBox)target; + break; + case 17: + EstadoBox = (TextBox)target; + break; + case 18: + SenhaBox = (CustomPasswordBox)target; + break; + case 19: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 20: + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(FormatarTelefone); + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 21: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 22: + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(FormatarTelefone); + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 23: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 24: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Ferramentas/EstipulanteView.cs b/Decompiler/Gestor.Application.Views.Ferramentas/EstipulanteView.cs new file mode 100644 index 0000000..b352d2f --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Ferramentas/EstipulanteView.cs @@ -0,0 +1,448 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Threading; +using Gestor.Application.Drawers; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.ViewModels.Ferramentas; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Views.Ferramentas; + +public class EstipulanteView : BaseUserControl, IComponentConnector +{ + [Serializable] + [CompilerGenerated] + private sealed class _003C_003Ec + { + public static readonly _003C_003Ec _003C_003E9 = new _003C_003Ec(); + + public static MouseButtonEventHandler _003C_003E9__2_0; + + internal void _003CContentLoad_003Eb__2_0(object sender, MouseButtonEventArgs args) + { + } + } + + public EstipulanteViewModel ViewModel; + + internal DataGrid EstipulanteGrid; + + internal MenuItem MaisOpcoesButton; + + internal TextBox EmpresaBox; + + internal TextBox NomeBox; + + internal TextBox DocumentoPrincipalBox; + + internal ToggleButton AtivoBox; + + internal TextBox PrimeiroPrefixo; + + internal TextBox PrimeiroTelefone; + + internal TextBox SegundoPrefixo; + + internal TextBox SegundoTelefone; + + internal TextBox EmailBox; + + internal TextBox CepBox; + + internal TextBox EnderecoBox; + + internal TextBox NumeroBox; + + internal TextBox BairroBox; + + internal TextBox CidadeBox; + + internal TextBox EstadoBox; + + private bool _contentLoaded; + + public EstipulanteView() + { + ((FrameworkElement)this).Tag = "CADASTRO DE ESTIPULANTE"; + ViewModel = new EstipulanteViewModel(); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + } + + private void ContentLoad() + { + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_0023: Expected O, but got Unknown + //IL_003d: Unknown result type (might be due to invalid IL or missing references) + //IL_0042: Unknown result type (might be due to invalid IL or missing references) + //IL_0048: Expected O, but got Unknown + ((Selector)EstipulanteGrid).SelectedIndex = 0; + ((Selector)EstipulanteGrid).SelectionChanged += new SelectionChangedEventHandler(EstipulanteGrid_OnSelectionChanged); + DataGrid estipulanteGrid = EstipulanteGrid; + object obj = _003C_003Ec._003C_003E9__2_0; + if (obj == null) + { + MouseButtonEventHandler val = delegate + { + }; + _003C_003Ec._003C_003E9__2_0 = val; + obj = (object)val; + } + ((Control)estipulanteGrid).MouseDoubleClick += (MouseButtonEventHandler)obj; + } + + private void Incluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Incluir(); + ValidarTela(); + } + + private void Cancelar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.CancelarAlteracao(); + } + + private async void Salvar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(); + ((DependencyObject)(object)this).ValidateFields(list); + bool num = list == null || list.Count == 0; + ViewModel.Loading(isLoading: false); + if (!num) + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + } + + private void Alterar_OnClick(object sender, RoutedEventArgs e) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Expected O, but got Unknown + ViewModel.CancelEstipulante = (Estipulante)((DomainBase)ViewModel.SelectedEstipulante).Clone(); + ViewModel.Alterar(alterar: true); + ValidarTela(); + } + + private void Excluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Excluir(); + } + + private async void PostcodeBox_OnLostFocus(object sender, RoutedEventArgs e) + { + string text = ValidationHelper.FormatPostCode(((TextBox)sender).Text); + CepBox.Text = text; + if (ValidationHelper.ValidatePostCode(text)) + { + EnderecoBase val = await ViewModel.BuscaCep(text); + if (val != null) + { + EnderecoBox.Text = val.Endereco; + CidadeBox.Text = val.Cidade; + EstadoBox.Text = val.Estado; + BairroBox.Text = val.Bairro; + } + } + } + + private void AutoCompleteBoxEstipulante_Populating(object sender, PopulatingEventArgs e) + { + e.Cancel = true; + ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Estipulante>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void AutoCompleteBox_OnTextChanged(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + if (string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).Text)) + { + ViewModel.FiltrarEstipulante(""); + } + } + + private void EstipulanteGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_0031: Unknown result type (might be due to invalid IL or missing references) + //IL_003b: Expected O, but got Unknown + DataGrid val = (DataGrid)sender; + if (val == null || ((Selector)val).SelectedIndex >= 0) + { + ViewModel.SelecionaEstipulante((Estipulante)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null)); + } + } + + private void AbrirLog_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLog((TipoTela)9, ((DomainBase)ViewModel.SelectedEstipulante).Id); + } + + private void DocumentoPrincipalBox_LostFocus(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + if (!((TextBoxBase)(TextBox)sender).IsReadOnly) + { + string text = ValidationHelper.Clear(DocumentoPrincipalBox.Text); + if (!string.IsNullOrEmpty(text)) + { + DocumentoPrincipalBox.Text = ((text.Length == 11) ? ValidationHelper.FormatDocument(text.PadLeft(11, '0').Substring(0, 11)) : ValidationHelper.FormatDocument(text.PadLeft(14, '0').Substring(0, 14))); + } + } + } + + private void ValidarTela() + { + if (ViewModel.SelectedEstipulante != null) + { + List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedEstipulante.Validate(); + ((DependencyObject)(object)this).ValidateFields(errorMessages, focusField: false); + } + } + + private async void ArquivoDigital_OnClick(object sender, RoutedEventArgs e) + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)5).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)17) + "."); + return; + } + FiltroArquivoDigital filtro = new FiltroArquivoDigital + { + Id = ((DomainBase)ViewModel.SelectedEstipulante).Id, + Tipo = (TipoArquivoDigital)17, + Parente = ViewModel.SelectedEstipulante + }; + ViewModel.ShowDrawer(new ArquivoDigitalDrawer(filtro), 0, close: false); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/ferramentas/estipulanteview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0072: Unknown result type (might be due to invalid IL or missing references) + //IL_007e: Unknown result type (might be due to invalid IL or missing references) + //IL_0088: Expected O, but got Unknown + //IL_0089: Unknown result type (might be due to invalid IL or missing references) + //IL_0095: Unknown result type (might be due to invalid IL or missing references) + //IL_009f: Expected O, but got Unknown + //IL_00a2: Unknown result type (might be due to invalid IL or missing references) + //IL_00ac: Expected O, but got Unknown + //IL_00ae: Unknown result type (might be due to invalid IL or missing references) + //IL_00ba: Unknown result type (might be due to invalid IL or missing references) + //IL_00c4: Expected O, but got Unknown + //IL_00c6: Unknown result type (might be due to invalid IL or missing references) + //IL_00d2: Unknown result type (might be due to invalid IL or missing references) + //IL_00dc: Expected O, but got Unknown + //IL_00de: Unknown result type (might be due to invalid IL or missing references) + //IL_00ea: Unknown result type (might be due to invalid IL or missing references) + //IL_00f4: Expected O, but got Unknown + //IL_00f6: Unknown result type (might be due to invalid IL or missing references) + //IL_0102: Unknown result type (might be due to invalid IL or missing references) + //IL_010c: Expected O, but got Unknown + //IL_010e: Unknown result type (might be due to invalid IL or missing references) + //IL_011a: Unknown result type (might be due to invalid IL or missing references) + //IL_0124: Expected O, but got Unknown + //IL_0127: Unknown result type (might be due to invalid IL or missing references) + //IL_0131: Expected O, but got Unknown + //IL_0133: Unknown result type (might be due to invalid IL or missing references) + //IL_013f: Unknown result type (might be due to invalid IL or missing references) + //IL_0149: Expected O, but got Unknown + //IL_014b: Unknown result type (might be due to invalid IL or missing references) + //IL_0157: Unknown result type (might be due to invalid IL or missing references) + //IL_0161: Expected O, but got Unknown + //IL_0164: Unknown result type (might be due to invalid IL or missing references) + //IL_016e: Expected O, but got Unknown + //IL_0171: Unknown result type (might be due to invalid IL or missing references) + //IL_017b: Expected O, but got Unknown + //IL_017e: Unknown result type (might be due to invalid IL or missing references) + //IL_0188: Expected O, but got Unknown + //IL_0196: Unknown result type (might be due to invalid IL or missing references) + //IL_01a0: Expected O, but got Unknown + //IL_01ad: Unknown result type (might be due to invalid IL or missing references) + //IL_01b7: Expected O, but got Unknown + //IL_01ba: Unknown result type (might be due to invalid IL or missing references) + //IL_01c4: Expected O, but got Unknown + //IL_01c7: Unknown result type (might be due to invalid IL or missing references) + //IL_01d1: Expected O, but got Unknown + //IL_01df: Unknown result type (might be due to invalid IL or missing references) + //IL_01e9: Expected O, but got Unknown + //IL_01ec: Unknown result type (might be due to invalid IL or missing references) + //IL_01f6: Expected O, but got Unknown + //IL_0204: Unknown result type (might be due to invalid IL or missing references) + //IL_020e: Expected O, but got Unknown + //IL_021c: Unknown result type (might be due to invalid IL or missing references) + //IL_0226: Expected O, but got Unknown + //IL_0229: Unknown result type (might be due to invalid IL or missing references) + //IL_0233: Expected O, but got Unknown + //IL_0241: Unknown result type (might be due to invalid IL or missing references) + //IL_024b: Expected O, but got Unknown + //IL_024e: Unknown result type (might be due to invalid IL or missing references) + //IL_0258: Expected O, but got Unknown + //IL_0266: Unknown result type (might be due to invalid IL or missing references) + //IL_0270: Expected O, but got Unknown + //IL_027e: Unknown result type (might be due to invalid IL or missing references) + //IL_0288: Expected O, but got Unknown + //IL_028b: Unknown result type (might be due to invalid IL or missing references) + //IL_0295: Expected O, but got Unknown + //IL_0298: Unknown result type (might be due to invalid IL or missing references) + //IL_02a2: Expected O, but got Unknown + //IL_02af: Unknown result type (might be due to invalid IL or missing references) + //IL_02b9: Expected O, but got Unknown + //IL_02c7: Unknown result type (might be due to invalid IL or missing references) + //IL_02d1: Expected O, but got Unknown + //IL_02d4: Unknown result type (might be due to invalid IL or missing references) + //IL_02de: Expected O, but got Unknown + //IL_02e1: Unknown result type (might be due to invalid IL or missing references) + //IL_02eb: Expected O, but got Unknown + //IL_02ee: Unknown result type (might be due to invalid IL or missing references) + //IL_02f8: Expected O, but got Unknown + //IL_02fb: Unknown result type (might be due to invalid IL or missing references) + //IL_0305: Expected O, but got Unknown + //IL_0308: Unknown result type (might be due to invalid IL or missing references) + //IL_0312: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBoxEstipulante_Populating); + ((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBox_OnTextChanged); + break; + case 2: + EstipulanteGrid = (DataGrid)target; + break; + case 3: + ((MenuItem)target).Click += new RoutedEventHandler(Incluir_OnClick); + break; + case 4: + ((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick); + break; + case 5: + ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick); + break; + case 6: + ((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick); + break; + case 7: + ((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick); + break; + case 8: + MaisOpcoesButton = (MenuItem)target; + break; + case 9: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick); + break; + case 10: + ((MenuItem)target).Click += new RoutedEventHandler(ArquivoDigital_OnClick); + break; + case 11: + EmpresaBox = (TextBox)target; + break; + case 12: + NomeBox = (TextBox)target; + break; + case 13: + DocumentoPrincipalBox = (TextBox)target; + ((UIElement)DocumentoPrincipalBox).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + ((UIElement)DocumentoPrincipalBox).LostFocus += new RoutedEventHandler(DocumentoPrincipalBox_LostFocus); + break; + case 14: + AtivoBox = (ToggleButton)target; + break; + case 15: + PrimeiroPrefixo = (TextBox)target; + ((UIElement)PrimeiroPrefixo).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 16: + PrimeiroTelefone = (TextBox)target; + ((UIElement)PrimeiroTelefone).LostFocus += new RoutedEventHandler(FormatarTelefone); + ((UIElement)PrimeiroTelefone).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 17: + SegundoPrefixo = (TextBox)target; + ((UIElement)SegundoPrefixo).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 18: + SegundoTelefone = (TextBox)target; + ((UIElement)SegundoTelefone).LostFocus += new RoutedEventHandler(FormatarTelefone); + ((UIElement)SegundoTelefone).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 19: + EmailBox = (TextBox)target; + break; + case 20: + CepBox = (TextBox)target; + ((UIElement)CepBox).LostFocus += new RoutedEventHandler(PostcodeBox_OnLostFocus); + ((UIElement)CepBox).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 21: + EnderecoBox = (TextBox)target; + break; + case 22: + NumeroBox = (TextBox)target; + break; + case 23: + BairroBox = (TextBox)target; + break; + case 24: + CidadeBox = (TextBox)target; + break; + case 25: + EstadoBox = (TextBox)target; + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Ferramentas/EtiquetaView.cs b/Decompiler/Gestor.Application.Views.Ferramentas/EtiquetaView.cs new file mode 100644 index 0000000..ec115cb --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Ferramentas/EtiquetaView.cs @@ -0,0 +1,164 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using System.Windows.Markup; +using Gestor.Application.ViewModels.Ferramentas; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Views.Ferramentas; + +public class EtiquetaView : BaseUserControl, IComponentConnector +{ + internal EtiquetaViewModel ViewModel; + + internal AutoCompleteBox AutoCompleteBox; + + internal ProgressBar ProgressRing; + + internal DataGrid DataGrid; + + internal Grid Botoes; + + internal ComboBox CboTipoEtiqueta; + + private bool _contentLoaded; + + public EtiquetaView(List<Documento> list, bool apenasCliente) + { + ViewModel = new EtiquetaViewModel(); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + ((UIElement)CboTipoEtiqueta).IsEnabled = !apenasCliente; + CarregarClientes(list, apenasCliente); + } + + private async void CarregarClientes(List<Documento> list, bool apenasCliente) + { + ((UIElement)ProgressRing).Visibility = (Visibility)0; + ((UIElement)DataGrid).Visibility = (Visibility)2; + ((UIElement)Botoes).IsEnabled = false; + ((UIElement)AutoCompleteBox).IsEnabled = false; + await ViewModel.CarregarDados(list, apenasCliente); + ((UIElement)ProgressRing).Visibility = (Visibility)2; + ((UIElement)DataGrid).Visibility = (Visibility)0; + ((UIElement)Botoes).IsEnabled = true; + ((UIElement)AutoCompleteBox).IsEnabled = true; + } + + private void Emitir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.EmitirEtiquetas(); + } + + private void AutoCompleteBox_Populating(object sender, PopulatingEventArgs e) + { + if (e.Parameter.Length < 3) + { + return; + } + e.Cancel = true; + ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Documento>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void AutoCompleteBox_OnTextChanged(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + if (string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).Text)) + { + ViewModel.FiltrarApolice(""); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/ferramentas/etiquetaview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_002b: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Expected O, but got Unknown + //IL_0042: Unknown result type (might be due to invalid IL or missing references) + //IL_004c: Expected O, but got Unknown + //IL_0059: Unknown result type (might be due to invalid IL or missing references) + //IL_0063: Expected O, but got Unknown + //IL_0066: Unknown result type (might be due to invalid IL or missing references) + //IL_0070: Expected O, but got Unknown + //IL_0073: Unknown result type (might be due to invalid IL or missing references) + //IL_007d: Expected O, but got Unknown + //IL_0080: Unknown result type (might be due to invalid IL or missing references) + //IL_008a: Expected O, but got Unknown + //IL_008c: Unknown result type (might be due to invalid IL or missing references) + //IL_0099: Unknown result type (might be due to invalid IL or missing references) + //IL_00a3: Expected O, but got Unknown + //IL_00a6: Unknown result type (might be due to invalid IL or missing references) + //IL_00b0: Expected O, but got Unknown + //IL_00b2: Unknown result type (might be due to invalid IL or missing references) + //IL_00be: Unknown result type (might be due to invalid IL or missing references) + //IL_00c8: Expected O, but got Unknown + switch (connectionId) + { + case 1: + AutoCompleteBox = (AutoCompleteBox)target; + AutoCompleteBox.Populating += new PopulatingEventHandler(AutoCompleteBox_Populating); + AutoCompleteBox.TextChanged += new RoutedEventHandler(AutoCompleteBox_OnTextChanged); + break; + case 2: + ProgressRing = (ProgressBar)target; + break; + case 3: + DataGrid = (DataGrid)target; + break; + case 4: + Botoes = (Grid)target; + break; + case 5: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 6: + CboTipoEtiqueta = (ComboBox)target; + break; + case 7: + ((MenuItem)target).Click += new RoutedEventHandler(Emitir_OnClick); + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Ferramentas/IncluirRamoView.cs b/Decompiler/Gestor.Application.Views.Ferramentas/IncluirRamoView.cs new file mode 100644 index 0000000..27d4df5 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Ferramentas/IncluirRamoView.cs @@ -0,0 +1,137 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Threading; +using Gestor.Application.Actions; +using Gestor.Application.ViewModels.Ferramentas; +using Gestor.Application.Views.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Views.Ferramentas; + +public class IncluirRamoView : BaseUserControl, IComponentConnector +{ + public IncluirRamoViewModel ViewModel; + + internal DataGrid RamoGrid; + + private bool _contentLoaded; + + public IncluirRamoView(List<Ramo> ramos) + { + ViewModel = new IncluirRamoViewModel(ramos); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + } + + private void ContentLoad() + { + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Expected O, but got Unknown + ((Selector)RamoGrid).SelectionChanged += new SelectionChangedEventHandler(RamoGrid_OnSelectionChanged); + } + + private void RamoGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_0031: Unknown result type (might be due to invalid IL or missing references) + //IL_003b: Expected O, but got Unknown + DataGrid val = (DataGrid)sender; + if (val == null || ((Selector)val).SelectedIndex >= 0) + { + ViewModel.SelectedRamo = (Ramo)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null); + } + } + + private void Pesquisar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Pesquisar(); + } + + private void Incluir_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.SelectedRamo != null) + { + ViewModel.AdicionarRamo = ViewModel.SelectedRamo; + Gestor.Application.Actions.Actions.CloseHoster?.Invoke(); + } + } + + private void Pesquisar_OnPreviewKeyDown(object sender, KeyEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Invalid comparison between Unknown and I4 + if ((int)e.Key == 6) + { + ViewModel.Pesquisar(); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/ferramentas/incluirramoview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_001b: Unknown result type (might be due to invalid IL or missing references) + //IL_0027: Unknown result type (might be due to invalid IL or missing references) + //IL_0031: Expected O, but got Unknown + //IL_0033: Unknown result type (might be due to invalid IL or missing references) + //IL_003f: Unknown result type (might be due to invalid IL or missing references) + //IL_0049: Expected O, but got Unknown + //IL_004c: Unknown result type (might be due to invalid IL or missing references) + //IL_0056: Expected O, but got Unknown + //IL_0058: Unknown result type (might be due to invalid IL or missing references) + //IL_0064: Unknown result type (might be due to invalid IL or missing references) + //IL_006e: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((UIElement)(TextBox)target).PreviewKeyDown += new KeyEventHandler(Pesquisar_OnPreviewKeyDown); + break; + case 2: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Pesquisar_OnClick); + break; + case 3: + RamoGrid = (DataGrid)target; + break; + case 4: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Incluir_OnClick); + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Ferramentas/IncluirSeguradoraView.cs b/Decompiler/Gestor.Application.Views.Ferramentas/IncluirSeguradoraView.cs new file mode 100644 index 0000000..90c0bd8 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Ferramentas/IncluirSeguradoraView.cs @@ -0,0 +1,137 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Threading; +using Gestor.Application.Actions; +using Gestor.Application.ViewModels.Ferramentas; +using Gestor.Application.Views.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Views.Ferramentas; + +public class IncluirSeguradoraView : BaseUserControl, IComponentConnector +{ + public IncluirSeguradoraViewModel ViewModel; + + internal DataGrid SeguradoraGrid; + + private bool _contentLoaded; + + public IncluirSeguradoraView(List<Seguradora> seguradoras) + { + ViewModel = new IncluirSeguradoraViewModel(seguradoras); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + } + + private void ContentLoad() + { + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Expected O, but got Unknown + ((Selector)SeguradoraGrid).SelectionChanged += new SelectionChangedEventHandler(SeguradoraGrid_OnSelectionChanged); + } + + private void SeguradoraGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_0031: Unknown result type (might be due to invalid IL or missing references) + //IL_003b: Expected O, but got Unknown + DataGrid val = (DataGrid)sender; + if (val == null || ((Selector)val).SelectedIndex >= 0) + { + ViewModel.SelectedSeguradora = (Seguradora)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null); + } + } + + private void Pesquisar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Pesquisar(); + } + + private void Incluir_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.SelectedSeguradora != null) + { + ViewModel.AdicionarSeguradora = ViewModel.SelectedSeguradora; + Gestor.Application.Actions.Actions.CloseHoster?.Invoke(); + } + } + + private void Pesquisar_OnPreviewKeyDown(object sender, KeyEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Invalid comparison between Unknown and I4 + if ((int)e.Key == 6) + { + ViewModel.Pesquisar(); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/ferramentas/incluirseguradoraview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_001b: Unknown result type (might be due to invalid IL or missing references) + //IL_0027: Unknown result type (might be due to invalid IL or missing references) + //IL_0031: Expected O, but got Unknown + //IL_0033: Unknown result type (might be due to invalid IL or missing references) + //IL_003f: Unknown result type (might be due to invalid IL or missing references) + //IL_0049: Expected O, but got Unknown + //IL_004c: Unknown result type (might be due to invalid IL or missing references) + //IL_0056: Expected O, but got Unknown + //IL_0058: Unknown result type (might be due to invalid IL or missing references) + //IL_0064: Unknown result type (might be due to invalid IL or missing references) + //IL_006e: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((UIElement)(TextBox)target).PreviewKeyDown += new KeyEventHandler(Pesquisar_OnPreviewKeyDown); + break; + case 2: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Pesquisar_OnClick); + break; + case 3: + SeguradoraGrid = (DataGrid)target; + break; + case 4: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Incluir_OnClick); + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Ferramentas/MalaDiretaView.cs b/Decompiler/Gestor.Application.Views.Ferramentas/MalaDiretaView.cs new file mode 100644 index 0000000..ca1fce5 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Ferramentas/MalaDiretaView.cs @@ -0,0 +1,308 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Data; +using System.Windows.Markup; +using Gestor.Application.Componentes; +using Gestor.Application.Helpers; +using Gestor.Application.ViewModels.Ferramentas; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.MalaDireta; +using MaterialDesignThemes.Wpf; +using Xceed.Wpf.AvalonDock.Controls; + +namespace Gestor.Application.Views.Ferramentas; + +public class MalaDiretaView : BaseUserControl, IComponentConnector, IStyleConnector +{ + internal MalaDiretaViewModel ViewModel; + + internal DataGrid Grid; + + internal TextBox AssuntoBox; + + internal WebEditor WebEditor; + + private bool _contentLoaded; + + public MalaDiretaView(List<MalaDireta> maladireta, string assunto = null, string corpo = null, FiltroArquivoDigital filtro = null) + { + ViewModel = new MalaDiretaViewModel(filtro); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + CarregarClientes(maladireta, assunto, corpo); + } + + private async void CarregarClientes(List<MalaDireta> maladireta, string assunto = null, string corpo = null) + { + ViewModel.IsEnabled = false; + await ViewModel.CarregarEmails(maladireta, assunto, corpo); + ViewModel.IsEnabled = true; + } + + private void Fechar_OnClick(object sender, RoutedEventArgs e) + { + Funcoes.Destroy<HosterWindow>("ENVIO DE E-MAIL"); + } + + private async void Enviar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.IsEnabled = false; + ViewModel.Corpo = WebEditor.GetHtml(); + await ViewModel.Enviar(); + ViewModel.IsEnabled = true; + } + + private void CheckBox_Checked(object sender, RoutedEventArgs e) + { + ViewModel.Selecionar(); + } + + private void AnexarArquivos_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Anexar(); + } + + private void DeleteArquivo_OnDeleteClick(object sender, RoutedEventArgs e) + { + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_0034: Expected O, but got Unknown + Chip val = (Chip)((sender is Chip) ? sender : null); + if (val != null) + { + ListBox val2 = Extentions.FindVisualAncestor<ListBox>((DependencyObject)(object)val); + ArquivoDigital val3 = (ArquivoDigital)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)]; + if (val3 != null) + { + ViewModel.Delete(val3); + } + } + } + + private void Incluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Incluir(); + ((UIElement)AssuntoBox).Focus(); + } + + private void Alterar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Alterar(alterar: true); + } + + private async void Salvar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + ViewModel.Corpo = WebEditor.GetHtml(); + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(); + bool num = list == null || list.Count == 0; + ViewModel.Loading(isLoading: false); + if (!num) + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + } + + private void Cancelar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.CancelarAlteracao(); + } + + private void Excluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Excluir(); + } + + private void VariaveisBox_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_001b: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Unknown result type (might be due to invalid IL or missing references) + //IL_0027: Unknown result type (might be due to invalid IL or missing references) + ComboBox val = (ComboBox)sender; + if (((Selector)val).SelectedItem != null) + { + VariaveisMalaDireta variaveisMalaDireta = ((ComboVariavel)((Selector)val).SelectedItem).VariaveisMalaDireta; + WebEditor.InsertText(ValidationHelper.GetEntity((Enum)(object)variaveisMalaDireta) + " "); + ((Selector)val).SelectedItem = null; + } + } + + private void ModelosBox_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + ComboBox val = (ComboBox)sender; + if (((Selector)val).SelectedItem != null) + { + ModeloMalaDireta modeloMalaDireta = ((ComboModelo)((Selector)val).SelectedItem).ModeloMalaDireta; + if (((DomainBase)modeloMalaDireta).Id != 0L) + { + ViewModel.Corpo = modeloMalaDireta.Corpo; + ViewModel.Assunto = modeloMalaDireta.Assunto; + } + } + } + + private async void AdicionarCC_OnClick(object sender, RoutedEventArgs e) + { + Button box = (Button)sender; + if (((FrameworkElement)box).DataContext != null) + { + ((UIElement)WebEditor).Visibility = (Visibility)2; + Copia val = await ViewModel.ShowCopiaDialog(((MalaDireta)((FrameworkElement)box).DataContext).Copia); + ((UIElement)WebEditor).Visibility = (Visibility)0; + if (val != null) + { + ((MalaDireta)((FrameworkElement)box).DataContext).Copia = val; + } + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/ferramentas/maladiretaview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_004f: Unknown result type (might be due to invalid IL or missing references) + //IL_0059: Expected O, but got Unknown + //IL_005b: Unknown result type (might be due to invalid IL or missing references) + //IL_0067: Unknown result type (might be due to invalid IL or missing references) + //IL_0071: Expected O, but got Unknown + //IL_0073: Unknown result type (might be due to invalid IL or missing references) + //IL_007f: Unknown result type (might be due to invalid IL or missing references) + //IL_0089: Expected O, but got Unknown + //IL_008b: Unknown result type (might be due to invalid IL or missing references) + //IL_0097: Unknown result type (might be due to invalid IL or missing references) + //IL_00a1: Expected O, but got Unknown + //IL_00a3: Unknown result type (might be due to invalid IL or missing references) + //IL_00af: Unknown result type (might be due to invalid IL or missing references) + //IL_00b9: Expected O, but got Unknown + //IL_00bb: Unknown result type (might be due to invalid IL or missing references) + //IL_00c7: Unknown result type (might be due to invalid IL or missing references) + //IL_00d1: Expected O, but got Unknown + //IL_00d3: Unknown result type (might be due to invalid IL or missing references) + //IL_00df: Unknown result type (might be due to invalid IL or missing references) + //IL_00e9: Expected O, but got Unknown + //IL_00ec: Unknown result type (might be due to invalid IL or missing references) + //IL_00f6: Expected O, but got Unknown + //IL_00f8: Unknown result type (might be due to invalid IL or missing references) + //IL_0104: Unknown result type (might be due to invalid IL or missing references) + //IL_010e: Expected O, but got Unknown + //IL_011d: Unknown result type (might be due to invalid IL or missing references) + //IL_0129: Unknown result type (might be due to invalid IL or missing references) + //IL_0133: Expected O, but got Unknown + //IL_0135: Unknown result type (might be due to invalid IL or missing references) + //IL_0141: Unknown result type (might be due to invalid IL or missing references) + //IL_014b: Expected O, but got Unknown + //IL_014d: Unknown result type (might be due to invalid IL or missing references) + //IL_0159: Unknown result type (might be due to invalid IL or missing references) + //IL_0163: Expected O, but got Unknown + switch (connectionId) + { + case 1: + Grid = (DataGrid)target; + break; + case 4: + ((MenuItem)target).Click += new RoutedEventHandler(Incluir_OnClick); + break; + case 5: + ((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick); + break; + case 6: + ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick); + break; + case 7: + ((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick); + break; + case 8: + ((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick); + break; + case 9: + ((Selector)(ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(ModelosBox_SelectionChanged); + break; + case 10: + AssuntoBox = (TextBox)target; + break; + case 11: + ((Selector)(ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(VariaveisBox_SelectionChanged); + break; + case 13: + WebEditor = (WebEditor)target; + break; + case 14: + ((MenuItem)target).Click += new RoutedEventHandler(AnexarArquivos_OnClick); + break; + case 15: + ((MenuItem)target).Click += new RoutedEventHandler(Enviar_OnClick); + break; + case 16: + ((MenuItem)target).Click += new RoutedEventHandler(Fechar_OnClick); + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Unknown result type (might be due to invalid IL or missing references) + //IL_0025: Expected O, but got Unknown + //IL_0026: Unknown result type (might be due to invalid IL or missing references) + //IL_0032: Unknown result type (might be due to invalid IL or missing references) + //IL_003c: Expected O, but got Unknown + //IL_003e: Unknown result type (might be due to invalid IL or missing references) + //IL_004a: Unknown result type (might be due to invalid IL or missing references) + //IL_0054: Expected O, but got Unknown + //IL_0056: Unknown result type (might be due to invalid IL or missing references) + //IL_0062: Unknown result type (might be due to invalid IL or missing references) + //IL_006c: Expected O, but got Unknown + switch (connectionId) + { + case 2: + ((ToggleButton)(CheckBox)target).Checked += new RoutedEventHandler(CheckBox_Checked); + ((ToggleButton)(CheckBox)target).Unchecked += new RoutedEventHandler(CheckBox_Checked); + break; + case 3: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AdicionarCC_OnClick); + break; + case 12: + ((Chip)target).DeleteClick += new RoutedEventHandler(DeleteArquivo_OnDeleteClick); + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Ferramentas/ManutencaoPagamentosView.cs b/Decompiler/Gestor.Application.Views.Ferramentas/ManutencaoPagamentosView.cs new file mode 100644 index 0000000..a6d7bb5 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Ferramentas/ManutencaoPagamentosView.cs @@ -0,0 +1,266 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Data; +using System.Windows.Input; +using System.Windows.Markup; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.ViewModels.Ferramentas; +using Gestor.Application.Views.Generic; +using Gestor.Application.Views.Seguros; +using Gestor.Model.Common; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Relatorios; +using Gestor.Model.Domain.Seguros; +using MaterialDesignThemes.Wpf; +using Xceed.Wpf.AvalonDock.Controls; + +namespace Gestor.Application.Views.Ferramentas; + +public class ManutencaoPagamentosView : BaseUserControl, IComponentConnector, IStyleConnector +{ + private bool _contentLoaded; + + public ManutencaoPagamentosViewModel ViewModel { get; set; } + + public ManutencaoPagamentosView() + { + ((FrameworkElement)this).Tag = "MANUTENÇÃO DE PAGAMENTOS"; + ViewModel = new ManutencaoPagamentosViewModel(); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + private async void Buscar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + await ViewModel.Buscar(); + ViewModel.Loading(isLoading: false); + } + + private async void Excluir_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.Pagamentos == null || ViewModel.Pagamentos.All((ManutencaoPagamentos x) => !x.Selecionado)) + { + await ViewModel.ShowMessage("NECESSÁRIO SELECIONAR OS PAGAMENTOS QUE DESEJA EXCLUIR ANTES DE PROSSEGUIR"); + return; + } + bool? flag = await ViewModel.ShowSenha("DESEJA REALMENTE EXCLUIR OS PAGAMENTOS SELECIONADOS?\nESSE PROCEDIMENTO É IRREVERSÍVEL."); + if (flag.HasValue) + { + if (!flag.GetValueOrDefault()) + { + await ViewModel.ShowMessage("SENHA INVÁLIDA"); + return; + } + ViewModel.Loading(isLoading: true); + await ViewModel.Excluir(); + ViewModel.Loading(isLoading: false); + } + } + + private void CheckBox_Checked(object sender, RoutedEventArgs e) + { + ViewModel.Selecionar(value: true); + } + + private async void Apolice_OnClick(object sender, RoutedEventArgs e) + { + Button val = (Button)sender; + ManutencaoPagamentos manutencao = (ManutencaoPagamentos)((FrameworkElement)val).DataContext; + if (manutencao != null) + { + ViewModel.Loading(isLoading: true); + long idDocumento = manutencao.IdDocumento; + Documento val2 = await new ApoliceServico().BuscarApoliceAsync(idDocumento); + if (val2 == null) + { + ViewModel.Loading(isLoading: false); + return; + } + ((Window)new HosterWindow((ContentControl)(object)new ApoliceView(val2, lockInsert: true, invoke: false, (AcessoApolice)1, manutencao.IdParcela), "CADASTRO DE APÓLICES - " + val2.Controle.Cliente.Nome)).Show(); + ViewModel.Loading(isLoading: false); + } + } + + private void UnCheckBox_Checked(object sender, RoutedEventArgs e) + { + ViewModel.Selecionar(value: false); + } + + private void FecharFiltro_OnClick(object sender, RoutedEventArgs e) + { + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Invalid comparison between Unknown and I4 + ViewModel.VisibilityFiltroPersonalizado = (Visibility)(((int)ViewModel.VisibilityFiltroPersonalizado != 2) ? 2 : 0); + } + + private void AdicionarFiltro_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AdcionarFiltroPersonalizado(); + } + + private void ExcluirFiltro_OnClick(object sender, RoutedEventArgs e) + { + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_0034: Expected O, but got Unknown + Chip val = (Chip)((sender is Chip) ? sender : null); + if (val != null) + { + ListBox val2 = Extentions.FindVisualAncestor<ListBox>((DependencyObject)(object)val); + FiltroPersonalizado val3 = (FiltroPersonalizado)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)]; + if (val3 != null) + { + ViewModel.FiltroPersonalizadoSelecionado.Remove(val3); + ViewModel.PesquisaPersonalizada(); + } + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/ferramentas/manutencaopagamentosview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0032: Unknown result type (might be due to invalid IL or missing references) + //IL_003e: Unknown result type (might be due to invalid IL or missing references) + //IL_0048: Expected O, but got Unknown + //IL_0049: Unknown result type (might be due to invalid IL or missing references) + //IL_0055: Unknown result type (might be due to invalid IL or missing references) + //IL_005f: Expected O, but got Unknown + //IL_0060: Unknown result type (might be due to invalid IL or missing references) + //IL_006c: Unknown result type (might be due to invalid IL or missing references) + //IL_0076: Expected O, but got Unknown + //IL_0078: Unknown result type (might be due to invalid IL or missing references) + //IL_0084: Unknown result type (might be due to invalid IL or missing references) + //IL_008e: Expected O, but got Unknown + //IL_008f: Unknown result type (might be due to invalid IL or missing references) + //IL_009b: Unknown result type (might be due to invalid IL or missing references) + //IL_00a5: Expected O, but got Unknown + //IL_00a6: Unknown result type (might be due to invalid IL or missing references) + //IL_00b2: Unknown result type (might be due to invalid IL or missing references) + //IL_00bc: Expected O, but got Unknown + //IL_00be: Unknown result type (might be due to invalid IL or missing references) + //IL_00ca: Unknown result type (might be due to invalid IL or missing references) + //IL_00d4: Expected O, but got Unknown + //IL_00d6: Unknown result type (might be due to invalid IL or missing references) + //IL_00e2: Unknown result type (might be due to invalid IL or missing references) + //IL_00ec: Expected O, but got Unknown + //IL_00ee: Unknown result type (might be due to invalid IL or missing references) + //IL_00fa: Unknown result type (might be due to invalid IL or missing references) + //IL_0104: Expected O, but got Unknown + //IL_0106: Unknown result type (might be due to invalid IL or missing references) + //IL_0112: Unknown result type (might be due to invalid IL or missing references) + //IL_011c: Expected O, but got Unknown + //IL_011e: Unknown result type (might be due to invalid IL or missing references) + //IL_012a: Unknown result type (might be due to invalid IL or missing references) + //IL_0134: Expected O, but got Unknown + //IL_0135: Unknown result type (might be due to invalid IL or missing references) + //IL_0141: Unknown result type (might be due to invalid IL or missing references) + //IL_014b: Expected O, but got Unknown + //IL_014d: Unknown result type (might be due to invalid IL or missing references) + //IL_0159: Unknown result type (might be due to invalid IL or missing references) + //IL_0163: Expected O, but got Unknown + //IL_0164: Unknown result type (might be due to invalid IL or missing references) + //IL_0170: Unknown result type (might be due to invalid IL or missing references) + //IL_017a: Expected O, but got Unknown + //IL_017c: Unknown result type (might be due to invalid IL or missing references) + //IL_0188: Unknown result type (might be due to invalid IL or missing references) + //IL_0192: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 2: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 3: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Buscar_OnClick); + break; + case 4: + ((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick); + break; + case 5: + ((MenuItem)target).Click += new RoutedEventHandler(FecharFiltro_OnClick); + break; + case 6: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(FecharFiltro_OnClick); + break; + case 7: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 8: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 9: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AdicionarFiltro_OnClick); + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + //IL_0023: Unknown result type (might be due to invalid IL or missing references) + //IL_002d: Expected O, but got Unknown + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_003b: Unknown result type (might be due to invalid IL or missing references) + //IL_0045: Expected O, but got Unknown + //IL_0046: Unknown result type (might be due to invalid IL or missing references) + //IL_0052: Unknown result type (might be due to invalid IL or missing references) + //IL_005c: Expected O, but got Unknown + //IL_005e: Unknown result type (might be due to invalid IL or missing references) + //IL_006a: Unknown result type (might be due to invalid IL or missing references) + //IL_0074: Expected O, but got Unknown + switch (connectionId) + { + case 10: + ((Chip)target).DeleteClick += new RoutedEventHandler(ExcluirFiltro_OnClick); + break; + case 11: + ((ToggleButton)(CheckBox)target).Checked += new RoutedEventHandler(CheckBox_Checked); + ((ToggleButton)(CheckBox)target).Unchecked += new RoutedEventHandler(UnCheckBox_Checked); + break; + case 12: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Apolice_OnClick); + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Ferramentas/NotaFiscalView.cs b/Decompiler/Gestor.Application.Views.Ferramentas/NotaFiscalView.cs new file mode 100644 index 0000000..662d646 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Ferramentas/NotaFiscalView.cs @@ -0,0 +1,352 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Threading; +using CurrencyTextBoxControl; +using Gestor.Application.Drawers; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.ViewModels.Ferramentas; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; + +namespace Gestor.Application.Views.Ferramentas; + +public class NotaFiscalView : BaseUserControl, IComponentConnector +{ + public NotaFiscalViewModel ViewModel; + + internal DataGrid NotaFiscalGrid; + + internal DataGridTextColumn NomeField; + + internal DataGridTextColumn ApelidoField; + + internal MenuItem MaisOpcoesButton; + + internal DatePicker DataPicker; + + internal CurrencyTextBox ValorBrutoBox; + + internal CurrencyTextBox ValorIssBox; + + internal CurrencyTextBox ValorIrBox; + + internal CurrencyTextBox ValorLiquidoBox; + + internal TextBox ExtratoBox; + + internal ComboBox EstipulanteBox; + + private bool _contentLoaded; + + public NotaFiscalView() + { + ((FrameworkElement)this).Tag = "CADASTRO DE NOTA FISCAL"; + ViewModel = new NotaFiscalViewModel(); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + } + + private void ContentLoad() + { + ((DataGridColumn)NomeField).Visibility = (Visibility)(ViewModel.Apelido ? 2 : 0); + ((DataGridColumn)ApelidoField).Visibility = (Visibility)((!ViewModel.Apelido) ? 2 : 0); + } + + private void AutoCompleteBoxNotaFiscal_Populating(object sender, PopulatingEventArgs e) + { + e.Cancel = true; + ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<NotaFiscal>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void AutoCompleteBox_OnTextChanged(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + if (string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).Text)) + { + ViewModel.FiltrarNotaFiscal(""); + } + } + + private void Incluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Incluir(); + } + + private void Alterar_OnClick(object sender, RoutedEventArgs e) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Expected O, but got Unknown + ViewModel.CancelNotaFiscal = (NotaFiscal)((DomainBase)ViewModel.SelectedNotaFiscal).Clone(); + ViewModel.Alterar(alterar: true); + ((DomainBase)ViewModel.SelectedNotaFiscal).Initialize(); + } + + private async void Salvar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + DataPicker.SelectedDate = Convert.ToDateTime(DataPicker.Text); + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(); + ((DependencyObject)(object)this).ValidateFields(list); + bool num = list == null || list.Count == 0; + ViewModel.Loading(isLoading: false); + if (!num) + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + } + + private void Cancelar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.CancelarAlteracao(); + } + + private void Excluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Excluir(); + } + + private void AbrirLog_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLog((TipoTela)55, ((DomainBase)ViewModel.SelectedNotaFiscal).Id); + } + + private async void UIElement_OnLostFocus(object sender, RoutedEventArgs e) + { + if (ViewModel.SelectedNotaFiscal != null && ViewModel.EnableFields) + { + bool flag = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 5); + if (((FrameworkElement)(CurrencyTextBox)sender).Name == "ValorBrutoBox" && flag && ValorIssBox.Number == 0m) + { + decimal num = await ViewModel.BuscarImposto(); + ValorIssBox.Number = ValorBrutoBox.Number * num; + } + ValorLiquidoBox.Number = ValorBrutoBox.Number - ValorIssBox.Number - ValorIrBox.Number; + } + } + + private async void Importar_Click(object sender, RoutedEventArgs e) + { + ViewModel.IsEnabled = false; + ViewModel.EnableMenu = false; + ViewModel.EnableMainMenu = false; + List<NotaFiscal> list = await ViewModel.ShowExtratoComissaoDialog(ViewModel.Seguradoras); + if (list != null) + { + await ViewModel.SalvarLote(list); + } + ViewModel.EnableMainMenu = true; + ViewModel.EnableMenu = true; + ViewModel.IsEnabled = true; + } + + private async void ArquivoDigital_OnClick(object sender, RoutedEventArgs e) + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)16).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)16) + "."); + return; + } + FiltroArquivoDigital filtro = new FiltroArquivoDigital + { + Id = ((DomainBase)ViewModel.SelectedNotaFiscal).Id, + Tipo = (TipoArquivoDigital)16, + Parente = ViewModel.SelectedNotaFiscal + }; + ViewModel.ShowDrawer(new ArquivoDigitalDrawer(filtro), 0, close: false); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/ferramentas/notafiscalview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_005e: Unknown result type (might be due to invalid IL or missing references) + //IL_006a: Unknown result type (might be due to invalid IL or missing references) + //IL_0074: Expected O, but got Unknown + //IL_0075: Unknown result type (might be due to invalid IL or missing references) + //IL_0081: Unknown result type (might be due to invalid IL or missing references) + //IL_008b: Expected O, but got Unknown + //IL_008e: Unknown result type (might be due to invalid IL or missing references) + //IL_0098: Expected O, but got Unknown + //IL_009b: Unknown result type (might be due to invalid IL or missing references) + //IL_00a5: Expected O, but got Unknown + //IL_00a8: Unknown result type (might be due to invalid IL or missing references) + //IL_00b2: Expected O, but got Unknown + //IL_00b4: Unknown result type (might be due to invalid IL or missing references) + //IL_00c0: Unknown result type (might be due to invalid IL or missing references) + //IL_00ca: Expected O, but got Unknown + //IL_00cc: Unknown result type (might be due to invalid IL or missing references) + //IL_00d8: Unknown result type (might be due to invalid IL or missing references) + //IL_00e2: Expected O, but got Unknown + //IL_00e4: Unknown result type (might be due to invalid IL or missing references) + //IL_00f0: Unknown result type (might be due to invalid IL or missing references) + //IL_00fa: Expected O, but got Unknown + //IL_00fc: Unknown result type (might be due to invalid IL or missing references) + //IL_0108: Unknown result type (might be due to invalid IL or missing references) + //IL_0112: Expected O, but got Unknown + //IL_0114: Unknown result type (might be due to invalid IL or missing references) + //IL_0120: Unknown result type (might be due to invalid IL or missing references) + //IL_012a: Expected O, but got Unknown + //IL_012c: Unknown result type (might be due to invalid IL or missing references) + //IL_0138: Unknown result type (might be due to invalid IL or missing references) + //IL_0142: Expected O, but got Unknown + //IL_0145: Unknown result type (might be due to invalid IL or missing references) + //IL_014f: Expected O, but got Unknown + //IL_0151: Unknown result type (might be due to invalid IL or missing references) + //IL_015d: Unknown result type (might be due to invalid IL or missing references) + //IL_0167: Expected O, but got Unknown + //IL_0169: Unknown result type (might be due to invalid IL or missing references) + //IL_0175: Unknown result type (might be due to invalid IL or missing references) + //IL_017f: Expected O, but got Unknown + //IL_0182: Unknown result type (might be due to invalid IL or missing references) + //IL_018c: Expected O, but got Unknown + //IL_0199: Unknown result type (might be due to invalid IL or missing references) + //IL_01a3: Expected O, but got Unknown + //IL_01b0: Unknown result type (might be due to invalid IL or missing references) + //IL_01ba: Expected O, but got Unknown + //IL_01c7: Unknown result type (might be due to invalid IL or missing references) + //IL_01d1: Expected O, but got Unknown + //IL_01d4: Unknown result type (might be due to invalid IL or missing references) + //IL_01de: Expected O, but got Unknown + //IL_01eb: Unknown result type (might be due to invalid IL or missing references) + //IL_01f5: Expected O, but got Unknown + //IL_01f8: Unknown result type (might be due to invalid IL or missing references) + //IL_0202: Expected O, but got Unknown + //IL_020f: Unknown result type (might be due to invalid IL or missing references) + //IL_0219: Expected O, but got Unknown + //IL_021c: Unknown result type (might be due to invalid IL or missing references) + //IL_0226: Expected O, but got Unknown + //IL_0233: Unknown result type (might be due to invalid IL or missing references) + //IL_023d: Expected O, but got Unknown + //IL_0240: Unknown result type (might be due to invalid IL or missing references) + //IL_024a: Expected O, but got Unknown + //IL_0257: Unknown result type (might be due to invalid IL or missing references) + //IL_0261: Expected O, but got Unknown + //IL_0264: Unknown result type (might be due to invalid IL or missing references) + //IL_026e: Expected O, but got Unknown + //IL_0271: Unknown result type (might be due to invalid IL or missing references) + //IL_027b: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBoxNotaFiscal_Populating); + ((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBox_OnTextChanged); + break; + case 2: + NotaFiscalGrid = (DataGrid)target; + break; + case 3: + NomeField = (DataGridTextColumn)target; + break; + case 4: + ApelidoField = (DataGridTextColumn)target; + break; + case 5: + ((MenuItem)target).Click += new RoutedEventHandler(Incluir_OnClick); + break; + case 6: + ((MenuItem)target).Click += new RoutedEventHandler(Importar_Click); + break; + case 7: + ((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick); + break; + case 8: + ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick); + break; + case 9: + ((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick); + break; + case 10: + ((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick); + break; + case 11: + MaisOpcoesButton = (MenuItem)target; + break; + case 12: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick); + break; + case 13: + ((MenuItem)target).Click += new RoutedEventHandler(ArquivoDigital_OnClick); + break; + case 14: + DataPicker = (DatePicker)target; + ((UIElement)DataPicker).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((Control)DataPicker).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + ((UIElement)DataPicker).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + break; + case 15: + ValorBrutoBox = (CurrencyTextBox)target; + ((UIElement)ValorBrutoBox).LostFocus += new RoutedEventHandler(UIElement_OnLostFocus); + break; + case 16: + ValorIssBox = (CurrencyTextBox)target; + ((UIElement)ValorIssBox).LostFocus += new RoutedEventHandler(UIElement_OnLostFocus); + break; + case 17: + ValorIrBox = (CurrencyTextBox)target; + ((UIElement)ValorIrBox).LostFocus += new RoutedEventHandler(UIElement_OnLostFocus); + break; + case 18: + ValorLiquidoBox = (CurrencyTextBox)target; + ((UIElement)ValorLiquidoBox).LostFocus += new RoutedEventHandler(UIElement_OnLostFocus); + break; + case 19: + ExtratoBox = (TextBox)target; + break; + case 20: + EstipulanteBox = (ComboBox)target; + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Ferramentas/ProdutoView.cs b/Decompiler/Gestor.Application.Views.Ferramentas/ProdutoView.cs new file mode 100644 index 0000000..c976d02 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Ferramentas/ProdutoView.cs @@ -0,0 +1,256 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Threading; +using Gestor.Application.Helpers; +using Gestor.Application.ViewModels.Ferramentas; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Views.Ferramentas; + +public class ProdutoView : BaseUserControl, IComponentConnector +{ + [Serializable] + [CompilerGenerated] + private sealed class _003C_003Ec + { + public static readonly _003C_003Ec _003C_003E9 = new _003C_003Ec(); + + public static MouseButtonEventHandler _003C_003E9__2_0; + + internal void _003CContentLoad_003Eb__2_0(object sender, MouseButtonEventArgs args) + { + } + } + + public ProdutoViewModel ViewModel; + + internal DataGrid ProdutoGrid; + + internal MenuItem MaisOpcoesButton; + + internal ToggleButton AtivoBox; + + private bool _contentLoaded; + + public ProdutoView() + { + ((FrameworkElement)this).Tag = "CADASTRO DE PRODUTOS"; + ViewModel = new ProdutoViewModel(); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + } + + private void ContentLoad() + { + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_0023: Expected O, but got Unknown + //IL_003d: Unknown result type (might be due to invalid IL or missing references) + //IL_0042: Unknown result type (might be due to invalid IL or missing references) + //IL_0048: Expected O, but got Unknown + ((Selector)ProdutoGrid).SelectedIndex = 0; + ((Selector)ProdutoGrid).SelectionChanged += new SelectionChangedEventHandler(EstipulanteGrid_OnSelectionChanged); + DataGrid produtoGrid = ProdutoGrid; + object obj = _003C_003Ec._003C_003E9__2_0; + if (obj == null) + { + MouseButtonEventHandler val = delegate + { + }; + _003C_003Ec._003C_003E9__2_0 = val; + obj = (object)val; + } + ((Control)produtoGrid).MouseDoubleClick += (MouseButtonEventHandler)obj; + } + + private void Incluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Incluir(); + ValidarTela(); + } + + private void Cancelar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.CancelarAlteracao(); + } + + private async void Salvar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(); + ((DependencyObject)(object)this).ValidateFields(list); + bool num = list == null || list.Count == 0; + ViewModel.Loading(isLoading: false); + if (!num) + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + } + + private void Alterar_OnClick(object sender, RoutedEventArgs e) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Expected O, but got Unknown + ViewModel.CancelProduto = (Produto)((DomainBase)ViewModel.SelectedProduto).Clone(); + ViewModel.Alterar(alterar: true); + ValidarTela(); + ((DomainBase)ViewModel.SelectedProduto).Initialize(); + } + + private void AutoCompleteBoxProduto_Populating(object sender, PopulatingEventArgs e) + { + e.Cancel = true; + ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Produto>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void AutoCompleteBox_OnTextChanged(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + if (string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).Text)) + { + ViewModel.FiltrarProduto(""); + } + } + + private void EstipulanteGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_0031: Unknown result type (might be due to invalid IL or missing references) + //IL_003b: Expected O, but got Unknown + DataGrid val = (DataGrid)sender; + if (val == null || ((Selector)val).SelectedIndex >= 0) + { + ViewModel.SelecionaProduto((Produto)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null)); + } + } + + private void AbrirLog_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLog((TipoTela)10, ((DomainBase)ViewModel.SelectedProduto).Id); + } + + private void ValidarTela() + { + if (ViewModel.SelectedProduto != null) + { + List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedProduto.Validate(); + ((DependencyObject)(object)this).ValidateFields(errorMessages, focusField: false); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/ferramentas/produtoview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0032: Unknown result type (might be due to invalid IL or missing references) + //IL_003e: Unknown result type (might be due to invalid IL or missing references) + //IL_0048: Expected O, but got Unknown + //IL_0049: Unknown result type (might be due to invalid IL or missing references) + //IL_0055: Unknown result type (might be due to invalid IL or missing references) + //IL_005f: Expected O, but got Unknown + //IL_0062: Unknown result type (might be due to invalid IL or missing references) + //IL_006c: Expected O, but got Unknown + //IL_006e: Unknown result type (might be due to invalid IL or missing references) + //IL_007a: Unknown result type (might be due to invalid IL or missing references) + //IL_0084: Expected O, but got Unknown + //IL_0086: Unknown result type (might be due to invalid IL or missing references) + //IL_0092: Unknown result type (might be due to invalid IL or missing references) + //IL_009c: Expected O, but got Unknown + //IL_009e: Unknown result type (might be due to invalid IL or missing references) + //IL_00aa: Unknown result type (might be due to invalid IL or missing references) + //IL_00b4: Expected O, but got Unknown + //IL_00b6: Unknown result type (might be due to invalid IL or missing references) + //IL_00c2: Unknown result type (might be due to invalid IL or missing references) + //IL_00cc: Expected O, but got Unknown + //IL_00cf: Unknown result type (might be due to invalid IL or missing references) + //IL_00d9: Expected O, but got Unknown + //IL_00db: Unknown result type (might be due to invalid IL or missing references) + //IL_00e7: Unknown result type (might be due to invalid IL or missing references) + //IL_00f1: Expected O, but got Unknown + //IL_00f4: Unknown result type (might be due to invalid IL or missing references) + //IL_00fe: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBoxProduto_Populating); + ((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBox_OnTextChanged); + break; + case 2: + ProdutoGrid = (DataGrid)target; + break; + case 3: + ((MenuItem)target).Click += new RoutedEventHandler(Incluir_OnClick); + break; + case 4: + ((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick); + break; + case 5: + ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick); + break; + case 6: + ((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick); + break; + case 7: + MaisOpcoesButton = (MenuItem)target; + break; + case 8: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick); + break; + case 9: + AtivoBox = (ToggleButton)target; + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Ferramentas/ProtocoloDocumentosView.cs b/Decompiler/Gestor.Application.Views.Ferramentas/ProtocoloDocumentosView.cs new file mode 100644 index 0000000..23b871e --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Ferramentas/ProtocoloDocumentosView.cs @@ -0,0 +1,196 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Markup; +using Gestor.Application.ViewModels.Ferramentas; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Views.Ferramentas; + +public class ProtocoloDocumentosView : UserControl, IComponentConnector, IStyleConnector +{ + private bool _contentLoaded; + + public ProtocoloDocumentosViewModel ViewModel { get; set; } + + public ProtocoloDocumentosView() + { + ((FrameworkElement)this).Tag = "PROTOCOLOS E ETIQUETAS"; + ViewModel = new ProtocoloDocumentosViewModel(); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + private void AutoCompleteClienteBox_Populating(object sender, PopulatingEventArgs e) + { + if (e.Parameter.Length < 3) + { + return; + } + e.Cancel = true; + ViewModel.BuscarCliente(ValidationHelper.RemoveDiacritics(e.Parameter.Trim()), null, (TipoFiltroCliente)2).ContinueWith(delegate(Task<List<Cliente>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void AdicionarProtocolo_OnClick(object sender, RoutedEventArgs e) + { + //IL_0020: Unknown result type (might be due to invalid IL or missing references) + //IL_002a: Expected O, but got Unknown + Button val = (Button)((sender is Button) ? sender : null); + if (val != null && ((FrameworkElement)val).DataContext != null) + { + ViewModel.AdicionarProtocolo((Documento)((FrameworkElement)val).DataContext); + } + } + + private void AdicionarEtiqueta_OnClick(object sender, RoutedEventArgs e) + { + //IL_0020: Unknown result type (might be due to invalid IL or missing references) + //IL_002a: Expected O, but got Unknown + Button val = (Button)((sender is Button) ? sender : null); + if (val != null && ((FrameworkElement)val).DataContext != null) + { + ViewModel.AdicionarEtiqueta((Documento)((FrameworkElement)val).DataContext); + } + } + + private void AdicionarEtiquetaCliente_OnClick(object sender, RoutedEventArgs e) + { + MenuItem val = (MenuItem)((sender is MenuItem) ? sender : null); + if (val != null && ((FrameworkElement)val).DataContext != null) + { + ViewModel.AdicionarEtiquetaCliente(); + } + } + + private void Remover_OnClick(object sender, RoutedEventArgs e) + { + Button val = (Button)((sender is Button) ? sender : null); + if (val != null && ((FrameworkElement)val).DataContext != null) + { + ViewModel.Remover((ProtocoloEtiqueta)((FrameworkElement)val).DataContext); + } + } + + private void ImprimirProtocolo_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Imprimir((TipoProtocoloEtiqueta)0); + } + + private void ImprimirEtiqueta_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Imprimir((TipoProtocoloEtiqueta)1); + } + + private void AdicionarEtiquetaCorretora_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AdicionarEtiquetaCorretora(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/ferramentas/protocolodocumentosview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + //IL_002b: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Expected O, but got Unknown + //IL_0037: Unknown result type (might be due to invalid IL or missing references) + //IL_0043: Unknown result type (might be due to invalid IL or missing references) + //IL_004d: Expected O, but got Unknown + //IL_004f: Unknown result type (might be due to invalid IL or missing references) + //IL_005b: Unknown result type (might be due to invalid IL or missing references) + //IL_0065: Expected O, but got Unknown + //IL_0067: Unknown result type (might be due to invalid IL or missing references) + //IL_0073: Unknown result type (might be due to invalid IL or missing references) + //IL_007d: Expected O, but got Unknown + //IL_007f: Unknown result type (might be due to invalid IL or missing references) + //IL_008b: Unknown result type (might be due to invalid IL or missing references) + //IL_0095: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteClienteBox_Populating); + break; + case 2: + ((MenuItem)target).Click += new RoutedEventHandler(AdicionarEtiquetaCliente_OnClick); + break; + case 3: + ((MenuItem)target).Click += new RoutedEventHandler(AdicionarEtiquetaCorretora_OnClick); + break; + case 4: + ((MenuItem)target).Click += new RoutedEventHandler(ImprimirProtocolo_OnClick); + break; + case 5: + ((MenuItem)target).Click += new RoutedEventHandler(ImprimirEtiqueta_OnClick); + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Unknown result type (might be due to invalid IL or missing references) + //IL_002c: Expected O, but got Unknown + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_003a: Unknown result type (might be due to invalid IL or missing references) + //IL_0044: Expected O, but got Unknown + //IL_0046: Unknown result type (might be due to invalid IL or missing references) + //IL_0052: Unknown result type (might be due to invalid IL or missing references) + //IL_005c: Expected O, but got Unknown + switch (connectionId) + { + case 6: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AdicionarProtocolo_OnClick); + break; + case 7: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AdicionarEtiqueta_OnClick); + break; + case 8: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Remover_OnClick); + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Ferramentas/QualificacaoView.cs b/Decompiler/Gestor.Application.Views.Ferramentas/QualificacaoView.cs new file mode 100644 index 0000000..c61b7f6 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Ferramentas/QualificacaoView.cs @@ -0,0 +1,210 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; +using CurrencyTextBoxControl; +using Gestor.Application.Helpers; +using Gestor.Application.ViewModels.Ferramentas; +using Gestor.Application.Views.Generic; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Views.Ferramentas; + +public class QualificacaoView : BaseUserControl, IComponentConnector +{ + public QualificacaoViewModel ViewModel; + + internal MenuItem MaisOpcoesButton; + + private bool _contentLoaded; + + public QualificacaoView() + { + ((FrameworkElement)this).Tag = "CADASTRO DE QUALIFICAÇÃO"; + ViewModel = new QualificacaoViewModel(); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + private void Cancelar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.CancelarAlteracao(); + } + + private async void Salvar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(); + ((DependencyObject)(object)this).ValidateFields(list); + bool num = list == null || list.Count == 0; + ViewModel.Loading(isLoading: false); + if (!num) + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + } + + private void Alterar_OnClick(object sender, RoutedEventArgs e) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Expected O, but got Unknown + ViewModel.CancelQualificacao = (Qualificacao)((DomainBase)ViewModel.SelectedQualificacao).Clone(); + ViewModel.Alterar(alterar: true); + ((DomainBase)ViewModel.SelectedQualificacao).Initialize(); + } + + private void AbrirLog_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLog((TipoTela)48, ((DomainBase)ViewModel.SelectedQualificacao).Id); + } + + private void CurrencyTextBox_OnLostFocus(object sender, RoutedEventArgs e) + { + if (ViewModel.SelectedQualificacao.Liquido2 <= ViewModel.SelectedQualificacao.Liquido1) + { + ViewModel.SelectedQualificacao.Liquido2 = ViewModel.SelectedQualificacao.Liquido1 + 0.01m; + } + if (ViewModel.SelectedQualificacao.Liquido3 <= ViewModel.SelectedQualificacao.Liquido2) + { + ViewModel.SelectedQualificacao.Liquido3 = ViewModel.SelectedQualificacao.Liquido2 + 0.01m; + } + if (ViewModel.SelectedQualificacao.Comissao2 <= ViewModel.SelectedQualificacao.Comissao1) + { + ViewModel.SelectedQualificacao.Comissao2 = ViewModel.SelectedQualificacao.Comissao1 + 0.01m; + } + if (ViewModel.SelectedQualificacao.Comissao3 <= ViewModel.SelectedQualificacao.Comissao2) + { + ViewModel.SelectedQualificacao.Comissao3 = ViewModel.SelectedQualificacao.Comissao2 + 0.01m; + } + if (ViewModel.SelectedQualificacao.Resultado2 <= ViewModel.SelectedQualificacao.Resultado1) + { + ViewModel.SelectedQualificacao.Resultado2 = ViewModel.SelectedQualificacao.Resultado1 + 0.01m; + } + if (ViewModel.SelectedQualificacao.Resultado3 <= ViewModel.SelectedQualificacao.Resultado2) + { + ViewModel.SelectedQualificacao.Resultado3 = ViewModel.SelectedQualificacao.Resultado2 + 0.01m; + } + ViewModel.SelectedQualificacao = ViewModel.SelectedQualificacao; + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/ferramentas/qualificacaoview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0046: Unknown result type (might be due to invalid IL or missing references) + //IL_0052: Unknown result type (might be due to invalid IL or missing references) + //IL_005c: Expected O, but got Unknown + //IL_005e: Unknown result type (might be due to invalid IL or missing references) + //IL_006a: Unknown result type (might be due to invalid IL or missing references) + //IL_0074: Expected O, but got Unknown + //IL_0076: Unknown result type (might be due to invalid IL or missing references) + //IL_0082: Unknown result type (might be due to invalid IL or missing references) + //IL_008c: Expected O, but got Unknown + //IL_008f: Unknown result type (might be due to invalid IL or missing references) + //IL_0099: Expected O, but got Unknown + //IL_009b: Unknown result type (might be due to invalid IL or missing references) + //IL_00a7: Unknown result type (might be due to invalid IL or missing references) + //IL_00b1: Expected O, but got Unknown + //IL_00b3: Unknown result type (might be due to invalid IL or missing references) + //IL_00bf: Unknown result type (might be due to invalid IL or missing references) + //IL_00c9: Expected O, but got Unknown + //IL_00cb: Unknown result type (might be due to invalid IL or missing references) + //IL_00d7: Unknown result type (might be due to invalid IL or missing references) + //IL_00e1: Expected O, but got Unknown + //IL_00e3: Unknown result type (might be due to invalid IL or missing references) + //IL_00ef: Unknown result type (might be due to invalid IL or missing references) + //IL_00f9: Expected O, but got Unknown + //IL_00fb: Unknown result type (might be due to invalid IL or missing references) + //IL_0107: Unknown result type (might be due to invalid IL or missing references) + //IL_0111: Expected O, but got Unknown + //IL_0113: Unknown result type (might be due to invalid IL or missing references) + //IL_011f: Unknown result type (might be due to invalid IL or missing references) + //IL_0129: Expected O, but got Unknown + //IL_012b: Unknown result type (might be due to invalid IL or missing references) + //IL_0137: Unknown result type (might be due to invalid IL or missing references) + //IL_0141: Expected O, but got Unknown + //IL_0143: Unknown result type (might be due to invalid IL or missing references) + //IL_014f: Unknown result type (might be due to invalid IL or missing references) + //IL_0159: Expected O, but got Unknown + //IL_015b: Unknown result type (might be due to invalid IL or missing references) + //IL_0167: Unknown result type (might be due to invalid IL or missing references) + //IL_0171: Expected O, but got Unknown + //IL_0173: Unknown result type (might be due to invalid IL or missing references) + //IL_017f: Unknown result type (might be due to invalid IL or missing references) + //IL_0189: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick); + break; + case 2: + ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick); + break; + case 3: + ((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick); + break; + case 4: + MaisOpcoesButton = (MenuItem)target; + break; + case 5: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick); + break; + case 6: + ((UIElement)(CurrencyTextBox)target).LostFocus += new RoutedEventHandler(CurrencyTextBox_OnLostFocus); + break; + case 7: + ((UIElement)(CurrencyTextBox)target).LostFocus += new RoutedEventHandler(CurrencyTextBox_OnLostFocus); + break; + case 8: + ((UIElement)(CurrencyTextBox)target).LostFocus += new RoutedEventHandler(CurrencyTextBox_OnLostFocus); + break; + case 9: + ((UIElement)(CurrencyTextBox)target).LostFocus += new RoutedEventHandler(CurrencyTextBox_OnLostFocus); + break; + case 10: + ((UIElement)(CurrencyTextBox)target).LostFocus += new RoutedEventHandler(CurrencyTextBox_OnLostFocus); + break; + case 11: + ((UIElement)(CurrencyTextBox)target).LostFocus += new RoutedEventHandler(CurrencyTextBox_OnLostFocus); + break; + case 12: + ((UIElement)(CurrencyTextBox)target).LostFocus += new RoutedEventHandler(CurrencyTextBox_OnLostFocus); + break; + case 13: + ((UIElement)(CurrencyTextBox)target).LostFocus += new RoutedEventHandler(CurrencyTextBox_OnLostFocus); + break; + case 14: + ((UIElement)(CurrencyTextBox)target).LostFocus += new RoutedEventHandler(CurrencyTextBox_OnLostFocus); + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Ferramentas/RamoView.cs b/Decompiler/Gestor.Application.Views.Ferramentas/RamoView.cs new file mode 100644 index 0000000..6d45419 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Ferramentas/RamoView.cs @@ -0,0 +1,351 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Threading; +using CurrencyTextBoxControl; +using Gestor.Application.Drawers; +using Gestor.Application.Helpers; +using Gestor.Application.ViewModels.Ferramentas; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Views.Ferramentas; + +public class RamoView : BaseUserControl, IComponentConnector +{ + [Serializable] + [CompilerGenerated] + private sealed class _003C_003Ec + { + public static readonly _003C_003Ec _003C_003E9 = new _003C_003Ec(); + + public static MouseButtonEventHandler _003C_003E9__5_0; + + public static MouseButtonEventHandler _003C_003E9__5_1; + + public static Func<ConfiguracaoSistema, bool> _003C_003E9__16_0; + + internal void _003CContentLoad_003Eb__5_0(object sender, MouseButtonEventArgs args) + { + } + + internal void _003CContentLoad_003Eb__5_1(object sender, MouseButtonEventArgs args) + { + } + + internal bool _003CImpostos_OnClick_003Eb__16_0(ConfiguracaoSistema x) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Invalid comparison between Unknown and I4 + return (int)x.Configuracao != 5; + } + } + + internal DataGrid RamoGrid; + + internal MenuItem MaisOpcoesButton; + + internal TextBox ApoliceBox; + + internal CurrencyTextBox IofBox; + + internal DataGrid CoberturaGrid; + + private bool _contentLoaded; + + public RamoViewModel ViewModel { get; set; } + + public RamoView() + { + ((FrameworkElement)this).Tag = "RAMOS"; + ViewModel = new RamoViewModel(); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + ((FrameworkElement)RamoGrid).DataContext = ((FrameworkElement)this).DataContext; + ((FrameworkElement)CoberturaGrid).DataContext = ((FrameworkElement)this).DataContext; + } + + private void ContentLoad() + { + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_0023: Expected O, but got Unknown + //IL_003d: Unknown result type (might be due to invalid IL or missing references) + //IL_0042: Unknown result type (might be due to invalid IL or missing references) + //IL_0048: Expected O, but got Unknown + //IL_0067: Unknown result type (might be due to invalid IL or missing references) + //IL_006c: Unknown result type (might be due to invalid IL or missing references) + //IL_0072: Expected O, but got Unknown + ((Selector)RamoGrid).SelectedIndex = 0; + ((Selector)RamoGrid).SelectionChanged += new SelectionChangedEventHandler(RamoGrid_OnSelectionChanged); + DataGrid ramoGrid = RamoGrid; + object obj = _003C_003Ec._003C_003E9__5_0; + if (obj == null) + { + MouseButtonEventHandler val = delegate + { + }; + _003C_003Ec._003C_003E9__5_0 = val; + obj = (object)val; + } + ((Control)ramoGrid).MouseDoubleClick += (MouseButtonEventHandler)obj; + DataGrid coberturaGrid = CoberturaGrid; + object obj2 = _003C_003Ec._003C_003E9__5_1; + if (obj2 == null) + { + MouseButtonEventHandler val2 = delegate + { + }; + _003C_003Ec._003C_003E9__5_1 = val2; + obj2 = (object)val2; + } + ((Control)coberturaGrid).MouseDoubleClick += (MouseButtonEventHandler)obj2; + } + + private async void Salvar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(); + ((DependencyObject)(object)this).ValidateFields(list); + bool num = list == null || list.Count == 0; + ViewModel.Loading(isLoading: false); + if (!num) + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + } + + private void Cancelar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.CancelarAlteracao(); + } + + private void AutoCompleteBoxRamo_Populating(object sender, PopulatingEventArgs e) + { + e.Cancel = true; + ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Ramo>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void AutoCompleteBoxCobertura_Populating(object sender, PopulatingEventArgs e) + { + e.Cancel = true; + ViewModel.FiltrarCobertura(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<CoberturaPadrao>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void AutoCompleteBox_OnTextChanged(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + if (string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).Text)) + { + ViewModel.FiltrarRamo(""); + } + } + + private void AutoCompleteBoxCobertura_OnTextChanged(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + if (string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).Text)) + { + ViewModel.FiltrarCoberturaRamo(""); + } + } + + private void Alterar_OnClick(object sender, RoutedEventArgs e) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Expected O, but got Unknown + ViewModel.CancelRamo = (Ramo)((DomainBase)ViewModel.SelectedRamo).Clone(); + ViewModel.Alterar(alterar: true); + } + + private void RamoGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_0031: Unknown result type (might be due to invalid IL or missing references) + //IL_003b: Expected O, but got Unknown + DataGrid val = (DataGrid)sender; + if (val == null || ((Selector)val).SelectedIndex >= 0) + { + ViewModel.SelecionaRamo((Ramo)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null)); + } + } + + private void AbrirLog_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLog((TipoTela)12, ((DomainBase)ViewModel.SelectedRamo).Id); + } + + private void Incluir_OnClick(object sender, RoutedEventArgs e) + { + IncluirRamoView incluirRamoView = new IncluirRamoView(ViewModel.Ramos); + ((Window)new HosterWindow((ContentControl)(object)incluirRamoView, "INCLUIR RAMO", 500.0, 600.0)).ShowDialog(); + if (incluirRamoView.ViewModel.AdicionarRamo != null) + { + ViewModel.Incluir(incluirRamoView.ViewModel.AdicionarRamo); + } + } + + private async void Impostos_OnClick(object sender, RoutedEventArgs e) + { + if (Recursos.Configuracoes.All((ConfiguracaoSistema x) => (int)x.Configuracao != 5)) + { + await ViewModel.ShowMessage("RECURSO NÃO HABILITADO, ACESSE AS CONFIGURAÇÕES DENTRO DO CADASTRO DE EMPRESAS E FILIAIS PARA HABILITAR O RECURSO."); + } + else if (await ViewModel.VerificarPermissao((TipoTela)56)) + { + ViewModel.ShowDrawer(new ImpostoDrawer(1, ((DomainBase)ViewModel.SelectedRamo).Id), 0, close: false); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/ferramentas/ramoview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0042: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_0058: Expected O, but got Unknown + //IL_0059: Unknown result type (might be due to invalid IL or missing references) + //IL_0065: Unknown result type (might be due to invalid IL or missing references) + //IL_006f: Expected O, but got Unknown + //IL_0072: Unknown result type (might be due to invalid IL or missing references) + //IL_007c: Expected O, but got Unknown + //IL_007e: Unknown result type (might be due to invalid IL or missing references) + //IL_008a: Unknown result type (might be due to invalid IL or missing references) + //IL_0094: Expected O, but got Unknown + //IL_0096: Unknown result type (might be due to invalid IL or missing references) + //IL_00a2: Unknown result type (might be due to invalid IL or missing references) + //IL_00ac: Expected O, but got Unknown + //IL_00ae: Unknown result type (might be due to invalid IL or missing references) + //IL_00ba: Unknown result type (might be due to invalid IL or missing references) + //IL_00c4: Expected O, but got Unknown + //IL_00c6: Unknown result type (might be due to invalid IL or missing references) + //IL_00d2: Unknown result type (might be due to invalid IL or missing references) + //IL_00dc: Expected O, but got Unknown + //IL_00df: Unknown result type (might be due to invalid IL or missing references) + //IL_00e9: Expected O, but got Unknown + //IL_00eb: Unknown result type (might be due to invalid IL or missing references) + //IL_00f7: Unknown result type (might be due to invalid IL or missing references) + //IL_0101: Expected O, but got Unknown + //IL_0103: Unknown result type (might be due to invalid IL or missing references) + //IL_010f: Unknown result type (might be due to invalid IL or missing references) + //IL_0119: Expected O, but got Unknown + //IL_011c: Unknown result type (might be due to invalid IL or missing references) + //IL_0126: Expected O, but got Unknown + //IL_0129: Unknown result type (might be due to invalid IL or missing references) + //IL_0133: Expected O, but got Unknown + //IL_0135: Unknown result type (might be due to invalid IL or missing references) + //IL_0141: Unknown result type (might be due to invalid IL or missing references) + //IL_014b: Expected O, but got Unknown + //IL_014c: Unknown result type (might be due to invalid IL or missing references) + //IL_0158: Unknown result type (might be due to invalid IL or missing references) + //IL_0162: Expected O, but got Unknown + //IL_0165: Unknown result type (might be due to invalid IL or missing references) + //IL_016f: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBoxRamo_Populating); + ((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBox_OnTextChanged); + break; + case 2: + RamoGrid = (DataGrid)target; + break; + case 3: + ((MenuItem)target).Click += new RoutedEventHandler(Incluir_OnClick); + break; + case 4: + ((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick); + break; + case 5: + ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick); + break; + case 6: + ((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick); + break; + case 7: + MaisOpcoesButton = (MenuItem)target; + break; + case 8: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick); + break; + case 9: + ((MenuItem)target).Click += new RoutedEventHandler(Impostos_OnClick); + break; + case 10: + ApoliceBox = (TextBox)target; + break; + case 11: + IofBox = (CurrencyTextBox)target; + break; + case 12: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBoxCobertura_Populating); + ((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBoxCobertura_OnTextChanged); + break; + case 13: + CoberturaGrid = (DataGrid)target; + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Ferramentas/ReciboView.cs b/Decompiler/Gestor.Application.Views.Ferramentas/ReciboView.cs new file mode 100644 index 0000000..268adc7 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Ferramentas/ReciboView.cs @@ -0,0 +1,334 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Threading; +using Gestor.Application.Helpers; +using Gestor.Application.ViewModels.Ferramentas; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Views.Ferramentas; + +public class ReciboView : BaseUserControl, IComponentConnector +{ + [Serializable] + [CompilerGenerated] + private sealed class _003C_003Ec + { + public static readonly _003C_003Ec _003C_003E9 = new _003C_003Ec(); + + public static MouseButtonEventHandler _003C_003E9__2_0; + + internal void _003CContentLoad_003Eb__2_0(object sender, MouseButtonEventArgs args) + { + } + } + + public ReciboViewModel ViewModel; + + internal DataGrid ReciboGrid; + + internal MenuItem MaisOpcoesButton; + + private bool _contentLoaded; + + public ReciboView() + { + ((FrameworkElement)this).Tag = "CADASTRO DE RECIBOS"; + ViewModel = new ReciboViewModel(); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + } + + private void ContentLoad() + { + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_0023: Expected O, but got Unknown + //IL_003d: Unknown result type (might be due to invalid IL or missing references) + //IL_0042: Unknown result type (might be due to invalid IL or missing references) + //IL_0048: Expected O, but got Unknown + ((Selector)ReciboGrid).SelectedIndex = 0; + ((Selector)ReciboGrid).SelectionChanged += new SelectionChangedEventHandler(ReciboGrid_OnSelectionChanged); + DataGrid reciboGrid = ReciboGrid; + object obj = _003C_003Ec._003C_003E9__2_0; + if (obj == null) + { + MouseButtonEventHandler val = delegate + { + }; + _003C_003Ec._003C_003E9__2_0 = val; + obj = (object)val; + } + ((Control)reciboGrid).MouseDoubleClick += (MouseButtonEventHandler)obj; + } + + private async void Salvar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(); + ((DependencyObject)(object)this).ValidateFields(list); + bool num = list == null || list.Count == 0; + ViewModel.Loading(isLoading: false); + if (num) + { + ReciboGrid.ScrollIntoView(((Selector)ReciboGrid).SelectedItem); + } + else + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + } + + private void Alterar_OnClick(object sender, RoutedEventArgs e) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Expected O, but got Unknown + ViewModel.CancelRecibo = (Recibo)((DomainBase)ViewModel.SelectedRecibo).Clone(); + ViewModel.Alterar(alterar: true); + ValidarTela(); + ((DomainBase)ViewModel.SelectedRecibo).Initialize(); + } + + private void Cancelar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.CancelarAlteracao(); + } + + private void AutoCompleteBoxRecibo_Populating(object sender, PopulatingEventArgs e) + { + e.Cancel = true; + ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Recibo>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void AutoCompleteBox_OnTextChanged(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + if (string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).Text)) + { + ViewModel.FiltrarRecibo(""); + } + } + + private void ReciboGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_0031: Unknown result type (might be due to invalid IL or missing references) + //IL_003b: Expected O, but got Unknown + DataGrid val = (DataGrid)sender; + if (val == null || ((Selector)val).SelectedIndex >= 0) + { + ViewModel.SelectedRecibo = (Recibo)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null); + } + } + + private void AbrirLog_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLog((TipoTela)42, ((DomainBase)ViewModel.SelectedRecibo).Id); + } + + private void Incluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Incluir(); + ValidarTela(); + } + + private void Excluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Excluir(); + } + + private void Imprimir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Print(); + } + + private void AutoCompleteBox_Populating(object sender, PopulatingEventArgs e) + { + if (e.Parameter.Trim().Length < 3) + { + return; + } + e.Cancel = true; + ViewModel.BuscarClienteEmpresa(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Cliente>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void ValidarTela() + { + if (ViewModel.SelectedRecibo != null) + { + List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedRecibo.Validate(); + ((DependencyObject)(object)this).ValidateFields(errorMessages, focusField: false); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/ferramentas/reciboview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_004a: Unknown result type (might be due to invalid IL or missing references) + //IL_0056: Unknown result type (might be due to invalid IL or missing references) + //IL_0060: Expected O, but got Unknown + //IL_0061: Unknown result type (might be due to invalid IL or missing references) + //IL_006d: Unknown result type (might be due to invalid IL or missing references) + //IL_0077: Expected O, but got Unknown + //IL_007a: Unknown result type (might be due to invalid IL or missing references) + //IL_0084: Expected O, but got Unknown + //IL_0086: Unknown result type (might be due to invalid IL or missing references) + //IL_0092: Unknown result type (might be due to invalid IL or missing references) + //IL_009c: Expected O, but got Unknown + //IL_009e: Unknown result type (might be due to invalid IL or missing references) + //IL_00aa: Unknown result type (might be due to invalid IL or missing references) + //IL_00b4: Expected O, but got Unknown + //IL_00b6: Unknown result type (might be due to invalid IL or missing references) + //IL_00c2: Unknown result type (might be due to invalid IL or missing references) + //IL_00cc: Expected O, but got Unknown + //IL_00ce: Unknown result type (might be due to invalid IL or missing references) + //IL_00da: Unknown result type (might be due to invalid IL or missing references) + //IL_00e4: Expected O, but got Unknown + //IL_00e6: Unknown result type (might be due to invalid IL or missing references) + //IL_00f2: Unknown result type (might be due to invalid IL or missing references) + //IL_00fc: Expected O, but got Unknown + //IL_00ff: Unknown result type (might be due to invalid IL or missing references) + //IL_0109: Expected O, but got Unknown + //IL_010b: Unknown result type (might be due to invalid IL or missing references) + //IL_0117: Unknown result type (might be due to invalid IL or missing references) + //IL_0121: Expected O, but got Unknown + //IL_0123: Unknown result type (might be due to invalid IL or missing references) + //IL_012f: Unknown result type (might be due to invalid IL or missing references) + //IL_0139: Expected O, but got Unknown + //IL_013b: Unknown result type (might be due to invalid IL or missing references) + //IL_0147: Unknown result type (might be due to invalid IL or missing references) + //IL_0151: Expected O, but got Unknown + //IL_0152: Unknown result type (might be due to invalid IL or missing references) + //IL_015e: Unknown result type (might be due to invalid IL or missing references) + //IL_0168: Expected O, but got Unknown + //IL_0169: Unknown result type (might be due to invalid IL or missing references) + //IL_0175: Unknown result type (might be due to invalid IL or missing references) + //IL_017f: Expected O, but got Unknown + //IL_0181: Unknown result type (might be due to invalid IL or missing references) + //IL_018d: Unknown result type (might be due to invalid IL or missing references) + //IL_0197: Expected O, but got Unknown + //IL_0199: Unknown result type (might be due to invalid IL or missing references) + //IL_01a6: Unknown result type (might be due to invalid IL or missing references) + //IL_01b0: Expected O, but got Unknown + //IL_01b2: Unknown result type (might be due to invalid IL or missing references) + //IL_01be: Unknown result type (might be due to invalid IL or missing references) + //IL_01c8: Expected O, but got Unknown + //IL_01ca: Unknown result type (might be due to invalid IL or missing references) + //IL_01d7: Unknown result type (might be due to invalid IL or missing references) + //IL_01e1: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBoxRecibo_Populating); + ((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBox_OnTextChanged); + break; + case 2: + ReciboGrid = (DataGrid)target; + break; + case 3: + ((MenuItem)target).Click += new RoutedEventHandler(Incluir_OnClick); + break; + case 4: + ((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick); + break; + case 5: + ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick); + break; + case 6: + ((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick); + break; + case 7: + ((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick); + break; + case 8: + MaisOpcoesButton = (MenuItem)target; + break; + case 9: + ((MenuItem)target).Click += new RoutedEventHandler(Imprimir_OnClick); + break; + case 10: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick); + break; + case 11: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 12: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBox_Populating); + break; + case 13: + ((UIElement)(TextBox)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(FormatarDocumento); + break; + case 14: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBox_Populating); + break; + case 15: + ((UIElement)(TextBox)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(FormatarDocumento); + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Ferramentas/SeguradoraView.cs b/Decompiler/Gestor.Application.Views.Ferramentas/SeguradoraView.cs new file mode 100644 index 0000000..34e7151 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Ferramentas/SeguradoraView.cs @@ -0,0 +1,665 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Data; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Threading; +using CurrencyTextBoxControl; +using Gestor.Application.Drawers; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.ViewModels.Ferramentas; +using Gestor.Application.Views.Generic; +using Gestor.Common.Helpers; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Xceed.Wpf.AvalonDock.Controls; + +namespace Gestor.Application.Views.Ferramentas; + +public class SeguradoraView : BaseUserControl, IComponentConnector, IStyleConnector +{ + [Serializable] + [CompilerGenerated] + private sealed class _003C_003Ec + { + public static readonly _003C_003Ec _003C_003E9 = new _003C_003Ec(); + + public static MouseButtonEventHandler _003C_003E9__2_0; + + public static Func<ConfiguracaoSistema, bool> _003C_003E9__21_0; + + internal void _003CContentLoad_003Eb__2_0(object sender, MouseButtonEventArgs args) + { + } + + internal bool _003CImpostos_OnClick_003Eb__21_0(ConfiguracaoSistema x) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Invalid comparison between Unknown and I4 + return (int)x.Configuracao != 5; + } + } + + public SeguradoraViewModel ViewModel; + + internal DataGrid SeguradoraGrid; + + internal DataGridTextColumn NomeField; + + internal DataGridTextColumn ApelidoField; + + internal MenuItem MaisOpcoesButton; + + internal ToggleButton AtivoBox; + + internal TextBox DocumentoPrincipalBox; + + internal TextBox AssistenciaBox; + + internal TextBox SusepBox; + + internal TextBox CodigoCiaBox; + + internal TextBox LinkAppAndroidBox; + + internal TextBox LinkAppIosBox; + + internal CurrencyTextBox ToleranciaComissaoBox; + + internal CurrencyTextBox ToleranciaPremioBox; + + internal TextBox ObservacaoBox; + + internal ListBox ContatosListBox; + + internal ListBox EnderecoSeguradoraBox; + + private bool _contentLoaded; + + public SeguradoraView() + { + ((FrameworkElement)this).Tag = "CADASTRO DE SEGURADORA"; + Tela = (TipoTela)13; + ViewModel = new SeguradoraViewModel(); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + } + + private void ContentLoad() + { + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_0023: Expected O, but got Unknown + //IL_003d: Unknown result type (might be due to invalid IL or missing references) + //IL_0042: Unknown result type (might be due to invalid IL or missing references) + //IL_0048: Expected O, but got Unknown + ((Selector)SeguradoraGrid).SelectedIndex = 0; + ((Selector)SeguradoraGrid).SelectionChanged += new SelectionChangedEventHandler(SeguradoraGrid_OnSelectionChanged); + DataGrid seguradoraGrid = SeguradoraGrid; + object obj = _003C_003Ec._003C_003E9__2_0; + if (obj == null) + { + MouseButtonEventHandler val = delegate + { + }; + _003C_003Ec._003C_003E9__2_0 = val; + obj = (object)val; + } + ((Control)seguradoraGrid).MouseDoubleClick += (MouseButtonEventHandler)obj; + ((DataGridColumn)NomeField).Visibility = (Visibility)(ViewModel.Apelido ? 2 : 0); + ((DataGridColumn)ApelidoField).Visibility = (Visibility)((!ViewModel.Apelido) ? 2 : 0); + } + + private async void Salvar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + ViewModel.SelectedSeguradora.NomeSocial = ViewModel.SelectedSeguradora.NomeSocialBanco.Trim(); + if ((ToleranciaComissaoBox.Number > 2m || ToleranciaPremioBox.Number > 2m) && (ViewModel.Tolerancia != ToleranciaComissaoBox.Number || ViewModel.Tolerancia != ToleranciaPremioBox.Number)) + { + bool? flag = await ViewModel.ShowSenha("TOLERÂNCIA DE COMISSÃO, DIFERENÇA IMPORTAÇÃO OU REPASSE MAIOR QUE R$2,00, PREENCHA A SENHA ADM PARA PROSSEGUIR."); + if (!flag.HasValue) + { + ViewModel.Loading(isLoading: false); + return; + } + if (!flag.GetValueOrDefault()) + { + await ViewModel.ShowMessage("SENHA INVÁLIDA"); + ViewModel.Loading(isLoading: false); + return; + } + } + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(); + ((DependencyObject)(object)this).ValidateFields(list); + bool num = list == null || list.Count == 0; + ViewModel.Loading(isLoading: false); + if (!num) + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + } + + private void Alterar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Clonar(); + ViewModel.Alterar(alterar: true); + ValidarTela(); + } + + private void Cancelar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.CancelarAlteracao(); + } + + private void IncluirTelefone_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.IncluirTelefone(); + ValidarTela(); + } + + private void ExcluirTelefone_OnClick(object sender, RoutedEventArgs e) + { + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_0034: Expected O, but got Unknown + Button val = (Button)((sender is Button) ? sender : null); + if (val != null) + { + ListBox val2 = Extentions.FindVisualAncestor<ListBox>((DependencyObject)(object)val); + SeguradoraContato contato = (SeguradoraContato)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)]; + ViewModel.ExcluirTelefone(contato); + } + } + + private void ExcluirEndereco_OnClick(object sender, RoutedEventArgs e) + { + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_0034: Expected O, but got Unknown + Button val = (Button)((sender is Button) ? sender : null); + if (val != null) + { + ListBox val2 = Extentions.FindVisualAncestor<ListBox>((DependencyObject)(object)val); + SeguradoraEndereco endereco = (SeguradoraEndereco)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)]; + ViewModel.ExcluirEndereco(endereco); + } + } + + private void IncluirEndereco_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.IncluirEndereco(); + ValidarTela(); + } + + public async void Metas_Click(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + if (await ViewModel.VerificarPermissao((TipoTela)31)) + { + ViewModel.ShowDrawer(new MetaSeguradoraView(ViewModel.SelectedSeguradora), 0, close: false); + ViewModel.Loading(isLoading: false); + } + } + + private async void PostcodeBox_OnLostFocus(object sender, RoutedEventArgs e) + { + TextBox val = (TextBox)sender; + string text = ValidationHelper.FormatPostCode(val.Text); + if (ValidationHelper.ValidatePostCode(text)) + { + ListBox val2 = Extentions.FindVisualAncestor<ListBox>((DependencyObject)(object)val); + ListBoxItem val3 = (ListBoxItem)((ItemsControl)val2).ItemContainerGenerator.ContainerFromIndex(((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)); + ContentPresenter contentPresenter = FindVisualChild.Find<ContentPresenter>((DependencyObject)(object)val3); + DataTemplate dataTemplate = contentPresenter.ContentTemplate; + ((TextBox)((FrameworkTemplate)dataTemplate).FindName("CepBox", (FrameworkElement)(object)contentPresenter)).Text = text; + EnderecoBase val4 = await ViewModel.BuscaCep(text); + if (val4 != null) + { + TextBox val5 = (TextBox)((FrameworkTemplate)dataTemplate).FindName("EnderecoBox", (FrameworkElement)(object)contentPresenter); + TextBox val6 = (TextBox)((FrameworkTemplate)dataTemplate).FindName("CidadeBox", (FrameworkElement)(object)contentPresenter); + TextBox val7 = (TextBox)((FrameworkTemplate)dataTemplate).FindName("EstadoBox", (FrameworkElement)(object)contentPresenter); + TextBox val8 = (TextBox)((FrameworkTemplate)dataTemplate).FindName("BairroBox", (FrameworkElement)(object)contentPresenter); + val5.Text = val4.Endereco; + val6.Text = val4.Cidade; + val7.Text = val4.Estado; + val8.Text = val4.Bairro; + } + } + } + + private void AutoCompleteBoxSeguradora_Populating(object sender, PopulatingEventArgs e) + { + e.Cancel = true; + ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Seguradora>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void AutoCompleteBox_OnTextChanged(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + if (string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).Text)) + { + ViewModel.FiltrarSeguradora(""); + } + } + + private void AutoCompleteBoxDescricao_Populating(object sender, PopulatingEventArgs e) + { + e.Cancel = true; + ViewModel.FiltrarConfig(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<ConfigExtratoImport>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void AutoCompleteBoxDescricao_OnTextChanged(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + if (string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).Text)) + { + ViewModel.FiltrarDescricao(""); + } + } + + private void SeguradoraGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_0031: Unknown result type (might be due to invalid IL or missing references) + //IL_003b: Expected O, but got Unknown + DataGrid val = (DataGrid)sender; + if (val == null || ((Selector)val).SelectedIndex >= 0) + { + ViewModel.SelecionaSeguradora((Seguradora)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null)); + } + } + + private async void AbrirAquivoDigital_Click(object sender, RoutedEventArgs e) + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)8).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + EnumHelper.GetDescription<TipoArquivoDigital>((TipoArquivoDigital)8) + "."); + return; + } + FiltroArquivoDigital filtro = new FiltroArquivoDigital + { + Id = ((DomainBase)ViewModel.SelectedSeguradora).Id, + Tipo = (TipoArquivoDigital)8, + Parente = ViewModel.SelectedSeguradora + }; + ViewModel.ShowDrawer(new ArquivoDigitalDrawer(filtro), 0, close: false); + } + + private void AbrirLog_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLog((TipoTela)13, ((DomainBase)ViewModel.SelectedSeguradora).Id); + } + + private void Incluir_OnClick(object sender, RoutedEventArgs e) + { + IncluirSeguradoraView incluirSeguradoraView = new IncluirSeguradoraView(ViewModel.Seguradoras); + ((Window)new HosterWindow((ContentControl)(object)incluirSeguradoraView, "INCLUIR SEGURADORA", 500.0, 600.0)).ShowDialog(); + if (incluirSeguradoraView.ViewModel.AdicionarSeguradora != null) + { + ViewModel.Incluir(incluirSeguradoraView.ViewModel.AdicionarSeguradora); + } + } + + private void AbrirLogEmail_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLogEmail((TipoTela)13, ((DomainBase)ViewModel.SelectedSeguradora).Id); + } + + private async void Impostos_OnClick(object sender, RoutedEventArgs e) + { + if (Recursos.Configuracoes.All((ConfiguracaoSistema x) => (int)x.Configuracao != 5)) + { + await ViewModel.ShowMessage("RECURSO NÃO HABILITADO, ACESSE AS CONFIGURAÇÕES DENTRO DO CADASTRO DE EMPRESAS E FILIAIS PARA HABILITAR O RECURSO."); + } + else if (await ViewModel.VerificarPermissao((TipoTela)56)) + { + ViewModel.ShowDrawer(new ImpostoDrawer(0, ((DomainBase)ViewModel.SelectedSeguradora).Id), 0, close: false); + } + } + + private void DocumentoPrincipalBox_LostFocus(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + if (!((TextBoxBase)(TextBox)sender).IsReadOnly) + { + string text = ValidationHelper.Clear(DocumentoPrincipalBox.Text); + if (!string.IsNullOrEmpty(text)) + { + DocumentoPrincipalBox.Text = ((text.Length == 11) ? ValidationHelper.FormatDocument(text.PadLeft(11, '0').Substring(0, 11)) : ValidationHelper.FormatDocument(text.PadLeft(14, '0').Substring(0, 14))); + } + } + } + + private void ValidarTela() + { + if (ViewModel.SelectedSeguradora != null) + { + List<KeyValuePair<string, string>> list = ViewModel.SelectedSeguradora.Validate(); + SeguradoraContato? obj = ViewModel.Contatos.FirstOrDefault(); + list.AddRange(((obj != null) ? obj.Validate() : null) ?? new List<KeyValuePair<string, string>>()); + SeguradoraEndereco? obj2 = ViewModel.Enderecos.FirstOrDefault(); + list.AddRange(((obj2 != null) ? obj2.Validate() : null) ?? new List<KeyValuePair<string, string>>()); + ((DependencyObject)(object)this).ValidateFields(list, focusField: false); + } + } + + public void Selector_ContactChanged(object sender, SelectionChangedEventArgs e) + { + ViewModel.TipoTelefoneVisibility = (Visibility)0; + ViewModel.TelefoneVisibility = (Visibility)0; + ViewModel.PrefixoVisibility = (Visibility)0; + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/ferramentas/seguradoraview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_00a2: Unknown result type (might be due to invalid IL or missing references) + //IL_00ae: Unknown result type (might be due to invalid IL or missing references) + //IL_00b8: Expected O, but got Unknown + //IL_00b9: Unknown result type (might be due to invalid IL or missing references) + //IL_00c5: Unknown result type (might be due to invalid IL or missing references) + //IL_00cf: Expected O, but got Unknown + //IL_00d1: Unknown result type (might be due to invalid IL or missing references) + //IL_00dd: Unknown result type (might be due to invalid IL or missing references) + //IL_00e7: Expected O, but got Unknown + //IL_00e8: Unknown result type (might be due to invalid IL or missing references) + //IL_00f4: Unknown result type (might be due to invalid IL or missing references) + //IL_00fe: Expected O, but got Unknown + //IL_0101: Unknown result type (might be due to invalid IL or missing references) + //IL_010b: Expected O, but got Unknown + //IL_010e: Unknown result type (might be due to invalid IL or missing references) + //IL_0118: Expected O, but got Unknown + //IL_011b: Unknown result type (might be due to invalid IL or missing references) + //IL_0125: Expected O, but got Unknown + //IL_0127: Unknown result type (might be due to invalid IL or missing references) + //IL_0133: Unknown result type (might be due to invalid IL or missing references) + //IL_013d: Expected O, but got Unknown + //IL_013f: Unknown result type (might be due to invalid IL or missing references) + //IL_014b: Unknown result type (might be due to invalid IL or missing references) + //IL_0155: Expected O, but got Unknown + //IL_0157: Unknown result type (might be due to invalid IL or missing references) + //IL_0163: Unknown result type (might be due to invalid IL or missing references) + //IL_016d: Expected O, but got Unknown + //IL_016f: Unknown result type (might be due to invalid IL or missing references) + //IL_017b: Unknown result type (might be due to invalid IL or missing references) + //IL_0185: Expected O, but got Unknown + //IL_0187: Unknown result type (might be due to invalid IL or missing references) + //IL_0193: Unknown result type (might be due to invalid IL or missing references) + //IL_019d: Expected O, but got Unknown + //IL_01a0: Unknown result type (might be due to invalid IL or missing references) + //IL_01aa: Expected O, but got Unknown + //IL_01ac: Unknown result type (might be due to invalid IL or missing references) + //IL_01b8: Unknown result type (might be due to invalid IL or missing references) + //IL_01c2: Expected O, but got Unknown + //IL_01c4: Unknown result type (might be due to invalid IL or missing references) + //IL_01d0: Unknown result type (might be due to invalid IL or missing references) + //IL_01da: Expected O, but got Unknown + //IL_01dc: Unknown result type (might be due to invalid IL or missing references) + //IL_01e8: Unknown result type (might be due to invalid IL or missing references) + //IL_01f2: Expected O, but got Unknown + //IL_01f4: Unknown result type (might be due to invalid IL or missing references) + //IL_0200: Unknown result type (might be due to invalid IL or missing references) + //IL_020a: Expected O, but got Unknown + //IL_020d: Unknown result type (might be due to invalid IL or missing references) + //IL_0217: Expected O, but got Unknown + //IL_021a: Unknown result type (might be due to invalid IL or missing references) + //IL_0224: Expected O, but got Unknown + //IL_0232: Unknown result type (might be due to invalid IL or missing references) + //IL_023c: Expected O, but got Unknown + //IL_0249: Unknown result type (might be due to invalid IL or missing references) + //IL_0253: Expected O, but got Unknown + //IL_0256: Unknown result type (might be due to invalid IL or missing references) + //IL_0260: Expected O, but got Unknown + //IL_0263: Unknown result type (might be due to invalid IL or missing references) + //IL_026d: Expected O, but got Unknown + //IL_0270: Unknown result type (might be due to invalid IL or missing references) + //IL_027a: Expected O, but got Unknown + //IL_027d: Unknown result type (might be due to invalid IL or missing references) + //IL_0287: Expected O, but got Unknown + //IL_028a: Unknown result type (might be due to invalid IL or missing references) + //IL_0294: Expected O, but got Unknown + //IL_0297: Unknown result type (might be due to invalid IL or missing references) + //IL_02a1: Expected O, but got Unknown + //IL_02a4: Unknown result type (might be due to invalid IL or missing references) + //IL_02ae: Expected O, but got Unknown + //IL_02b1: Unknown result type (might be due to invalid IL or missing references) + //IL_02bb: Expected O, but got Unknown + //IL_02bd: Unknown result type (might be due to invalid IL or missing references) + //IL_02c9: Unknown result type (might be due to invalid IL or missing references) + //IL_02d3: Expected O, but got Unknown + //IL_02d6: Unknown result type (might be due to invalid IL or missing references) + //IL_02e0: Expected O, but got Unknown + //IL_02e2: Unknown result type (might be due to invalid IL or missing references) + //IL_02ee: Unknown result type (might be due to invalid IL or missing references) + //IL_02f8: Expected O, but got Unknown + //IL_02fb: Unknown result type (might be due to invalid IL or missing references) + //IL_0305: Expected O, but got Unknown + //IL_0307: Unknown result type (might be due to invalid IL or missing references) + //IL_0313: Unknown result type (might be due to invalid IL or missing references) + //IL_031d: Expected O, but got Unknown + //IL_031e: Unknown result type (might be due to invalid IL or missing references) + //IL_032a: Unknown result type (might be due to invalid IL or missing references) + //IL_0334: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBoxSeguradora_Populating); + ((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBox_OnTextChanged); + break; + case 2: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBoxSeguradora_Populating); + ((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBox_OnTextChanged); + break; + case 3: + SeguradoraGrid = (DataGrid)target; + break; + case 4: + NomeField = (DataGridTextColumn)target; + break; + case 5: + ApelidoField = (DataGridTextColumn)target; + break; + case 6: + ((MenuItem)target).Click += new RoutedEventHandler(Incluir_OnClick); + break; + case 7: + ((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick); + break; + case 8: + ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick); + break; + case 9: + ((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick); + break; + case 10: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirAquivoDigital_Click); + break; + case 11: + MaisOpcoesButton = (MenuItem)target; + break; + case 12: + ((MenuItem)target).Click += new RoutedEventHandler(Metas_Click); + break; + case 13: + ((MenuItem)target).Click += new RoutedEventHandler(Impostos_OnClick); + break; + case 14: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick); + break; + case 15: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLogEmail_OnClick); + break; + case 16: + AtivoBox = (ToggleButton)target; + break; + case 17: + DocumentoPrincipalBox = (TextBox)target; + ((UIElement)DocumentoPrincipalBox).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + ((UIElement)DocumentoPrincipalBox).LostFocus += new RoutedEventHandler(DocumentoPrincipalBox_LostFocus); + break; + case 18: + AssistenciaBox = (TextBox)target; + break; + case 19: + SusepBox = (TextBox)target; + break; + case 20: + CodigoCiaBox = (TextBox)target; + break; + case 21: + LinkAppAndroidBox = (TextBox)target; + break; + case 22: + LinkAppIosBox = (TextBox)target; + break; + case 23: + ToleranciaComissaoBox = (CurrencyTextBox)target; + break; + case 24: + ToleranciaPremioBox = (CurrencyTextBox)target; + break; + case 25: + ObservacaoBox = (TextBox)target; + break; + case 26: + ((MenuItem)target).Click += new RoutedEventHandler(IncluirTelefone_OnClick); + break; + case 27: + ContatosListBox = (ListBox)target; + break; + case 32: + ((MenuItem)target).Click += new RoutedEventHandler(IncluirEndereco_OnClick); + break; + case 33: + EnderecoSeguradoraBox = (ListBox)target; + break; + case 37: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBoxDescricao_Populating); + ((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBoxDescricao_OnTextChanged); + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_003b: Unknown result type (might be due to invalid IL or missing references) + //IL_0045: Expected O, but got Unknown + //IL_0047: Unknown result type (might be due to invalid IL or missing references) + //IL_0054: Unknown result type (might be due to invalid IL or missing references) + //IL_005e: Expected O, but got Unknown + //IL_0060: Unknown result type (might be due to invalid IL or missing references) + //IL_006d: Unknown result type (might be due to invalid IL or missing references) + //IL_0077: Expected O, but got Unknown + //IL_0078: Unknown result type (might be due to invalid IL or missing references) + //IL_0085: Unknown result type (might be due to invalid IL or missing references) + //IL_008f: Expected O, but got Unknown + //IL_0091: Unknown result type (might be due to invalid IL or missing references) + //IL_009d: Unknown result type (might be due to invalid IL or missing references) + //IL_00a7: Expected O, but got Unknown + //IL_00a9: Unknown result type (might be due to invalid IL or missing references) + //IL_00b5: Unknown result type (might be due to invalid IL or missing references) + //IL_00bf: Expected O, but got Unknown + //IL_00c0: Unknown result type (might be due to invalid IL or missing references) + //IL_00cd: Unknown result type (might be due to invalid IL or missing references) + //IL_00d7: Expected O, but got Unknown + //IL_00d9: Unknown result type (might be due to invalid IL or missing references) + //IL_00e6: Unknown result type (might be due to invalid IL or missing references) + //IL_00f0: Expected O, but got Unknown + //IL_00f2: Unknown result type (might be due to invalid IL or missing references) + //IL_00fe: Unknown result type (might be due to invalid IL or missing references) + //IL_0108: Expected O, but got Unknown + switch (connectionId) + { + case 28: + ((Selector)(ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(Selector_ContactChanged); + break; + case 29: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 30: + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(FormatarTelefone); + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 31: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirTelefone_OnClick); + break; + case 34: + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(PostcodeBox_OnLostFocus); + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 35: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 36: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirEndereco_OnClick); + break; + case 32: + case 33: + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Ferramentas/SocioView.cs b/Decompiler/Gestor.Application.Views.Ferramentas/SocioView.cs new file mode 100644 index 0000000..065adb8 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Ferramentas/SocioView.cs @@ -0,0 +1,277 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using System.Windows.Markup; +using Gestor.Application.Drawers; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.ViewModels.Ferramentas; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; + +namespace Gestor.Application.Views.Ferramentas; + +public class SocioView : BaseUserControl, IComponentConnector +{ + internal ComboBox EmpresaFilialBox; + + internal DataGrid SocioGrid; + + internal MenuItem MaisOpcoesButton; + + internal TextBox NomeBox; + + internal TextBox PrimeiroPrefixo; + + internal TextBox PrimeiroTelefone; + + internal TextBox EmailBox; + + private bool _contentLoaded; + + public SocioViewModel ViewModel { get; set; } + + public SocioView() + { + ((FrameworkElement)this).Tag = "CADASTRO DE SÓCIOS"; + ViewModel = new SocioViewModel(); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + private void AutoCompleteBoxSocio_Populating(object sender, PopulatingEventArgs e) + { + e.Cancel = true; + ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Socio>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void AutoCompleteBox_OnTextChanged(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + if (string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).Text)) + { + ViewModel.FiltrarSocio(""); + } + } + + private void Alterar_OnClick(object sender, RoutedEventArgs e) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Expected O, but got Unknown + ViewModel.CancelSocio = (Socio)((DomainBase)ViewModel.SelectedSocio).Clone(); + ViewModel.Alterar(alterar: true); + ValidarTela(); + ((DomainBase)ViewModel.SelectedSocio).Initialize(); + } + + private async void Salvar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(); + ((DependencyObject)(object)this).ValidateFields(list); + bool num = list == null || list.Count == 0; + ViewModel.Loading(isLoading: false); + if (!num) + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + } + + private void Cancelar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.CancelarAlteracao(); + } + + private async void AbrirAquivoDigital_Click(object sender, RoutedEventArgs e) + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)14).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)14) + "."); + return; + } + if (ViewModel.SelectedSocio == null) + { + await ViewModel.ShowMessage("É NECESSÁRIO SELECIONAR UM SÓCIO PARA ABRIR SEU ARQUIVO DIGITAL"); + return; + } + FiltroArquivoDigital filtro = new FiltroArquivoDigital + { + Id = ((DomainBase)ViewModel.SelectedSocio).Id, + Tipo = (TipoArquivoDigital)14, + Parente = ViewModel.SelectedSocio + }; + ViewModel.ShowDrawer(new ArquivoDigitalDrawer(filtro), 0, close: false); + } + + private void AbrirLog_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLog((TipoTela)19, ((DomainBase)ViewModel.SelectedSocio).Id); + } + + private void Incluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Incluir(); + ValidarTela(); + } + + private void Excluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Excluir(); + } + + private void ValidarTela() + { + if (ViewModel.SelectedSocio != null) + { + List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedSocio.Validate(); + ((DependencyObject)(object)this).ValidateFields(errorMessages, focusField: false); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/ferramentas/socioview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_004b: Unknown result type (might be due to invalid IL or missing references) + //IL_0055: Expected O, but got Unknown + //IL_0057: Unknown result type (might be due to invalid IL or missing references) + //IL_0063: Unknown result type (might be due to invalid IL or missing references) + //IL_006d: Expected O, but got Unknown + //IL_006e: Unknown result type (might be due to invalid IL or missing references) + //IL_007a: Unknown result type (might be due to invalid IL or missing references) + //IL_0084: Expected O, but got Unknown + //IL_0087: Unknown result type (might be due to invalid IL or missing references) + //IL_0091: Expected O, but got Unknown + //IL_0093: Unknown result type (might be due to invalid IL or missing references) + //IL_009f: Unknown result type (might be due to invalid IL or missing references) + //IL_00a9: Expected O, but got Unknown + //IL_00ab: Unknown result type (might be due to invalid IL or missing references) + //IL_00b7: Unknown result type (might be due to invalid IL or missing references) + //IL_00c1: Expected O, but got Unknown + //IL_00c3: Unknown result type (might be due to invalid IL or missing references) + //IL_00cf: Unknown result type (might be due to invalid IL or missing references) + //IL_00d9: Expected O, but got Unknown + //IL_00db: Unknown result type (might be due to invalid IL or missing references) + //IL_00e7: Unknown result type (might be due to invalid IL or missing references) + //IL_00f1: Expected O, but got Unknown + //IL_00f3: Unknown result type (might be due to invalid IL or missing references) + //IL_00ff: Unknown result type (might be due to invalid IL or missing references) + //IL_0109: Expected O, but got Unknown + //IL_010b: Unknown result type (might be due to invalid IL or missing references) + //IL_0117: Unknown result type (might be due to invalid IL or missing references) + //IL_0121: Expected O, but got Unknown + //IL_0124: Unknown result type (might be due to invalid IL or missing references) + //IL_012e: Expected O, but got Unknown + //IL_0130: Unknown result type (might be due to invalid IL or missing references) + //IL_013c: Unknown result type (might be due to invalid IL or missing references) + //IL_0146: Expected O, but got Unknown + //IL_0149: Unknown result type (might be due to invalid IL or missing references) + //IL_0153: Expected O, but got Unknown + //IL_0156: Unknown result type (might be due to invalid IL or missing references) + //IL_0160: Expected O, but got Unknown + //IL_016e: Unknown result type (might be due to invalid IL or missing references) + //IL_0178: Expected O, but got Unknown + //IL_017b: Unknown result type (might be due to invalid IL or missing references) + //IL_0185: Expected O, but got Unknown + //IL_0193: Unknown result type (might be due to invalid IL or missing references) + //IL_019d: Expected O, but got Unknown + //IL_01ab: Unknown result type (might be due to invalid IL or missing references) + //IL_01b5: Expected O, but got Unknown + //IL_01b8: Unknown result type (might be due to invalid IL or missing references) + //IL_01c2: Expected O, but got Unknown + switch (connectionId) + { + case 1: + EmpresaFilialBox = (ComboBox)target; + break; + case 2: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBoxSocio_Populating); + ((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBox_OnTextChanged); + break; + case 3: + SocioGrid = (DataGrid)target; + break; + case 4: + ((MenuItem)target).Click += new RoutedEventHandler(Incluir_OnClick); + break; + case 5: + ((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick); + break; + case 6: + ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick); + break; + case 7: + ((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick); + break; + case 8: + ((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick); + break; + case 9: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirAquivoDigital_Click); + break; + case 10: + MaisOpcoesButton = (MenuItem)target; + break; + case 11: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick); + break; + case 12: + NomeBox = (TextBox)target; + break; + case 13: + PrimeiroPrefixo = (TextBox)target; + ((UIElement)PrimeiroPrefixo).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 14: + PrimeiroTelefone = (TextBox)target; + ((UIElement)PrimeiroTelefone).LostFocus += new RoutedEventHandler(FormatarTelefone); + ((UIElement)PrimeiroTelefone).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 15: + EmailBox = (TextBox)target; + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Ferramentas/StatusProspeccaoView.cs b/Decompiler/Gestor.Application.Views.Ferramentas/StatusProspeccaoView.cs new file mode 100644 index 0000000..03d9d7c --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Ferramentas/StatusProspeccaoView.cs @@ -0,0 +1,225 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Markup; +using Gestor.Application.Helpers; +using Gestor.Application.ViewModels.Ferramentas; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; + +namespace Gestor.Application.Views.Ferramentas; + +public class StatusProspeccaoView : BaseUserControl, IComponentConnector +{ + public StatusProspeccaoViewModel ViewModel; + + internal DataGrid StatusProspeccaoGrid; + + internal MenuItem MaisOpcoesButton; + + internal TextBox NomeBox; + + internal ToggleButton AtivoBox; + + internal TextBox ObsBox; + + private bool _contentLoaded; + + public StatusProspeccaoView() + { + ((FrameworkElement)this).Tag = "CADASTRO DE STATUS DE PROSPECÇÃO"; + ViewModel = new StatusProspeccaoViewModel(); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + private void AutoCompleteBoxStatusProspeccao_Populating(object sender, PopulatingEventArgs e) + { + e.Cancel = true; + ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<StatusDeProspeccao>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void AutoCompleteBox_OnTextChanged(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + if (string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).Text)) + { + ViewModel.FiltrarStatusProspeccao(""); + } + } + + private void Incluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Incluir(); + ValidarTela(); + } + + private void Alterar_OnClick(object sender, RoutedEventArgs e) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Expected O, but got Unknown + ViewModel.CancelStatusProspeccao = (StatusDeProspeccao)((DomainBase)ViewModel.SelectedStatusProspeccao).Clone(); + ViewModel.Alterar(alterar: true); + ValidarTela(); + ((DomainBase)ViewModel.SelectedStatusProspeccao).Initialize(); + } + + private async void Salvar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(); + ((DependencyObject)(object)this).ValidateFields(list); + bool num = list == null || list.Count == 0; + ViewModel.Loading(isLoading: false); + if (!num) + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + } + + private void Cancelar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.CancelarAlteracao(); + } + + private void Excluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Excluir(); + } + + private void AbrirLog_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLog((TipoTela)57, ((DomainBase)ViewModel.SelectedStatusProspeccao).Id); + } + + private void ValidarTela() + { + if (ViewModel.SelectedStatusProspeccao != null) + { + List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedStatusProspeccao.Validate(); + ((DependencyObject)(object)this).ValidateFields(errorMessages, focusField: false); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/ferramentas/statusprospeccaoview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_003e: Unknown result type (might be due to invalid IL or missing references) + //IL_004a: Unknown result type (might be due to invalid IL or missing references) + //IL_0054: Expected O, but got Unknown + //IL_0055: Unknown result type (might be due to invalid IL or missing references) + //IL_0061: Unknown result type (might be due to invalid IL or missing references) + //IL_006b: Expected O, but got Unknown + //IL_006e: Unknown result type (might be due to invalid IL or missing references) + //IL_0078: Expected O, but got Unknown + //IL_007a: Unknown result type (might be due to invalid IL or missing references) + //IL_0086: Unknown result type (might be due to invalid IL or missing references) + //IL_0090: Expected O, but got Unknown + //IL_0092: Unknown result type (might be due to invalid IL or missing references) + //IL_009e: Unknown result type (might be due to invalid IL or missing references) + //IL_00a8: Expected O, but got Unknown + //IL_00aa: Unknown result type (might be due to invalid IL or missing references) + //IL_00b6: Unknown result type (might be due to invalid IL or missing references) + //IL_00c0: Expected O, but got Unknown + //IL_00c2: Unknown result type (might be due to invalid IL or missing references) + //IL_00ce: Unknown result type (might be due to invalid IL or missing references) + //IL_00d8: Expected O, but got Unknown + //IL_00da: Unknown result type (might be due to invalid IL or missing references) + //IL_00e6: Unknown result type (might be due to invalid IL or missing references) + //IL_00f0: Expected O, but got Unknown + //IL_00f3: Unknown result type (might be due to invalid IL or missing references) + //IL_00fd: Expected O, but got Unknown + //IL_00ff: Unknown result type (might be due to invalid IL or missing references) + //IL_010b: Unknown result type (might be due to invalid IL or missing references) + //IL_0115: Expected O, but got Unknown + //IL_0118: Unknown result type (might be due to invalid IL or missing references) + //IL_0122: Expected O, but got Unknown + //IL_0125: Unknown result type (might be due to invalid IL or missing references) + //IL_012f: Expected O, but got Unknown + //IL_0132: Unknown result type (might be due to invalid IL or missing references) + //IL_013c: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBoxStatusProspeccao_Populating); + ((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBox_OnTextChanged); + break; + case 2: + StatusProspeccaoGrid = (DataGrid)target; + break; + case 3: + ((MenuItem)target).Click += new RoutedEventHandler(Incluir_OnClick); + break; + case 4: + ((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick); + break; + case 5: + ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick); + break; + case 6: + ((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick); + break; + case 7: + ((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick); + break; + case 8: + MaisOpcoesButton = (MenuItem)target; + break; + case 9: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick); + break; + case 10: + NomeBox = (TextBox)target; + break; + case 11: + AtivoBox = (ToggleButton)target; + break; + case 12: + ObsBox = (TextBox)target; + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Ferramentas/StatusView.cs b/Decompiler/Gestor.Application.Views.Ferramentas/StatusView.cs new file mode 100644 index 0000000..1eaa3b9 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Ferramentas/StatusView.cs @@ -0,0 +1,274 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Threading; +using Gestor.Application.Helpers; +using Gestor.Application.ViewModels.Ferramentas; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Views.Ferramentas; + +public class StatusView : BaseUserControl, IComponentConnector +{ + [Serializable] + [CompilerGenerated] + private sealed class _003C_003Ec + { + public static readonly _003C_003Ec _003C_003E9 = new _003C_003Ec(); + + public static MouseButtonEventHandler _003C_003E9__2_0; + + internal void _003CContentLoad_003Eb__2_0(object sender, MouseButtonEventArgs args) + { + } + } + + public StatusViewModel ViewModel; + + internal DataGrid StatusGrid; + + internal MenuItem MaisOpcoesButton; + + internal TextBox NomeBox; + + internal ToggleButton AtivoBox; + + private bool _contentLoaded; + + public StatusView() + { + ((FrameworkElement)this).Tag = "CADASTRO DE STATUS"; + ViewModel = new StatusViewModel(); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + } + + private void ContentLoad() + { + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_0023: Expected O, but got Unknown + //IL_003d: Unknown result type (might be due to invalid IL or missing references) + //IL_0042: Unknown result type (might be due to invalid IL or missing references) + //IL_0048: Expected O, but got Unknown + ((Selector)StatusGrid).SelectedIndex = 0; + ((Selector)StatusGrid).SelectionChanged += new SelectionChangedEventHandler(EstipulanteGrid_OnSelectionChanged); + DataGrid statusGrid = StatusGrid; + object obj = _003C_003Ec._003C_003E9__2_0; + if (obj == null) + { + MouseButtonEventHandler val = delegate + { + }; + _003C_003Ec._003C_003E9__2_0 = val; + obj = (object)val; + } + ((Control)statusGrid).MouseDoubleClick += (MouseButtonEventHandler)obj; + } + + private void Incluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Incluir(); + ValidarTela(); + } + + private void Cancelar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.CancelarAlteracao(); + } + + private async void Salvar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(); + ((DependencyObject)(object)this).ValidateFields(list); + bool num = list == null || list.Count == 0; + ViewModel.Loading(isLoading: false); + if (!num) + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + } + + private void Alterar_OnClick(object sender, RoutedEventArgs e) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Expected O, but got Unknown + ViewModel.CancelStatus = (Status)((DomainBase)ViewModel.SelectedStatus).Clone(); + ViewModel.Alterar(alterar: true); + ValidarTela(); + ((DomainBase)ViewModel.SelectedStatus).Initialize(); + } + + private void AutoCompleteBoxStatus_Populating(object sender, PopulatingEventArgs e) + { + e.Cancel = true; + ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Status>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void AutoCompleteBox_OnTextChanged(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + if (string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).Text)) + { + ViewModel.FiltrarStatus(""); + } + } + + private void EstipulanteGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_0031: Unknown result type (might be due to invalid IL or missing references) + //IL_003b: Expected O, but got Unknown + DataGrid val = (DataGrid)sender; + if (val == null || ((Selector)val).SelectedIndex >= 0) + { + ViewModel.SelecionaStatus((Status)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null)); + } + } + + private void AbrirLog_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLog((TipoTela)11, ((DomainBase)ViewModel.SelectedStatus).Id); + } + + private void Excluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Excluir(); + } + + private void ValidarTela() + { + if (ViewModel.SelectedStatus != null) + { + List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedStatus.Validate(); + ((DependencyObject)(object)this).ValidateFields(errorMessages, focusField: false); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/ferramentas/statusview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_003a: Unknown result type (might be due to invalid IL or missing references) + //IL_0046: Unknown result type (might be due to invalid IL or missing references) + //IL_0050: Expected O, but got Unknown + //IL_0051: Unknown result type (might be due to invalid IL or missing references) + //IL_005d: Unknown result type (might be due to invalid IL or missing references) + //IL_0067: Expected O, but got Unknown + //IL_006a: Unknown result type (might be due to invalid IL or missing references) + //IL_0074: Expected O, but got Unknown + //IL_0076: Unknown result type (might be due to invalid IL or missing references) + //IL_0082: Unknown result type (might be due to invalid IL or missing references) + //IL_008c: Expected O, but got Unknown + //IL_008e: Unknown result type (might be due to invalid IL or missing references) + //IL_009a: Unknown result type (might be due to invalid IL or missing references) + //IL_00a4: Expected O, but got Unknown + //IL_00a6: Unknown result type (might be due to invalid IL or missing references) + //IL_00b2: Unknown result type (might be due to invalid IL or missing references) + //IL_00bc: Expected O, but got Unknown + //IL_00be: Unknown result type (might be due to invalid IL or missing references) + //IL_00ca: Unknown result type (might be due to invalid IL or missing references) + //IL_00d4: Expected O, but got Unknown + //IL_00d6: Unknown result type (might be due to invalid IL or missing references) + //IL_00e2: Unknown result type (might be due to invalid IL or missing references) + //IL_00ec: Expected O, but got Unknown + //IL_00ef: Unknown result type (might be due to invalid IL or missing references) + //IL_00f9: Expected O, but got Unknown + //IL_00fb: Unknown result type (might be due to invalid IL or missing references) + //IL_0107: Unknown result type (might be due to invalid IL or missing references) + //IL_0111: Expected O, but got Unknown + //IL_0114: Unknown result type (might be due to invalid IL or missing references) + //IL_011e: Expected O, but got Unknown + //IL_0121: Unknown result type (might be due to invalid IL or missing references) + //IL_012b: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBoxStatus_Populating); + ((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBox_OnTextChanged); + break; + case 2: + StatusGrid = (DataGrid)target; + break; + case 3: + ((MenuItem)target).Click += new RoutedEventHandler(Incluir_OnClick); + break; + case 4: + ((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick); + break; + case 5: + ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick); + break; + case 6: + ((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick); + break; + case 7: + ((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick); + break; + case 8: + MaisOpcoesButton = (MenuItem)target; + break; + case 9: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick); + break; + case 10: + NomeBox = (TextBox)target; + break; + case 11: + AtivoBox = (ToggleButton)target; + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Ferramentas/TipoTarefaView.cs b/Decompiler/Gestor.Application.Views.Ferramentas/TipoTarefaView.cs new file mode 100644 index 0000000..aaa0e67 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Ferramentas/TipoTarefaView.cs @@ -0,0 +1,225 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Markup; +using Gestor.Application.Helpers; +using Gestor.Application.ViewModels.Ferramentas; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; + +namespace Gestor.Application.Views.Ferramentas; + +public class TipoTarefaView : BaseUserControl, IComponentConnector +{ + public TipoTarefaViewModel ViewModel; + + internal DataGrid TipoTarefaGrid; + + internal MenuItem MaisOpcoesButton; + + internal TextBox NomeBox; + + internal ToggleButton AtivoBox; + + internal TextBox ObsBox; + + private bool _contentLoaded; + + public TipoTarefaView() + { + ((FrameworkElement)this).Tag = "CADASTRO DO TIPO DE TAREFA"; + ViewModel = new TipoTarefaViewModel(); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + private void AutoCompleteBoxTipoTarefa_Populating(object sender, PopulatingEventArgs e) + { + e.Cancel = true; + ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<TipoDeTarefa>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void AutoCompleteBox_OnTextChanged(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + if (string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).Text)) + { + ViewModel.FiltrarTipoTarefa(""); + } + } + + private void Incluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Incluir(); + ValidarTela(); + } + + private void Alterar_OnClick(object sender, RoutedEventArgs e) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Expected O, but got Unknown + ViewModel.CancelTipoTarefa = (TipoDeTarefa)((DomainBase)ViewModel.SelectedTipoTarefa).Clone(); + ViewModel.Alterar(alterar: true); + ValidarTela(); + ((DomainBase)ViewModel.SelectedTipoTarefa).Initialize(); + } + + private async void Salvar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(); + ((DependencyObject)(object)this).ValidateFields(list); + bool num = list == null || list.Count == 0; + ViewModel.Loading(isLoading: false); + if (!num) + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + } + + private void Cancelar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.CancelarAlteracao(); + } + + private void Excluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Excluir(); + } + + private void AbrirLog_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLog((TipoTela)52, ((DomainBase)ViewModel.SelectedTipoTarefa).Id); + } + + private void ValidarTela() + { + if (ViewModel.SelectedTipoTarefa != null) + { + List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedTipoTarefa.Validate(); + ((DependencyObject)(object)this).ValidateFields(errorMessages, focusField: false); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/ferramentas/tipotarefaview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_003e: Unknown result type (might be due to invalid IL or missing references) + //IL_004a: Unknown result type (might be due to invalid IL or missing references) + //IL_0054: Expected O, but got Unknown + //IL_0055: Unknown result type (might be due to invalid IL or missing references) + //IL_0061: Unknown result type (might be due to invalid IL or missing references) + //IL_006b: Expected O, but got Unknown + //IL_006e: Unknown result type (might be due to invalid IL or missing references) + //IL_0078: Expected O, but got Unknown + //IL_007a: Unknown result type (might be due to invalid IL or missing references) + //IL_0086: Unknown result type (might be due to invalid IL or missing references) + //IL_0090: Expected O, but got Unknown + //IL_0092: Unknown result type (might be due to invalid IL or missing references) + //IL_009e: Unknown result type (might be due to invalid IL or missing references) + //IL_00a8: Expected O, but got Unknown + //IL_00aa: Unknown result type (might be due to invalid IL or missing references) + //IL_00b6: Unknown result type (might be due to invalid IL or missing references) + //IL_00c0: Expected O, but got Unknown + //IL_00c2: Unknown result type (might be due to invalid IL or missing references) + //IL_00ce: Unknown result type (might be due to invalid IL or missing references) + //IL_00d8: Expected O, but got Unknown + //IL_00da: Unknown result type (might be due to invalid IL or missing references) + //IL_00e6: Unknown result type (might be due to invalid IL or missing references) + //IL_00f0: Expected O, but got Unknown + //IL_00f3: Unknown result type (might be due to invalid IL or missing references) + //IL_00fd: Expected O, but got Unknown + //IL_00ff: Unknown result type (might be due to invalid IL or missing references) + //IL_010b: Unknown result type (might be due to invalid IL or missing references) + //IL_0115: Expected O, but got Unknown + //IL_0118: Unknown result type (might be due to invalid IL or missing references) + //IL_0122: Expected O, but got Unknown + //IL_0125: Unknown result type (might be due to invalid IL or missing references) + //IL_012f: Expected O, but got Unknown + //IL_0132: Unknown result type (might be due to invalid IL or missing references) + //IL_013c: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBoxTipoTarefa_Populating); + ((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBox_OnTextChanged); + break; + case 2: + TipoTarefaGrid = (DataGrid)target; + break; + case 3: + ((MenuItem)target).Click += new RoutedEventHandler(Incluir_OnClick); + break; + case 4: + ((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick); + break; + case 5: + ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick); + break; + case 6: + ((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick); + break; + case 7: + ((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick); + break; + case 8: + MaisOpcoesButton = (MenuItem)target; + break; + case 9: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick); + break; + case 10: + NomeBox = (TextBox)target; + break; + case 11: + AtivoBox = (ToggleButton)target; + break; + case 12: + ObsBox = (TextBox)target; + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Ferramentas/TipoVendedorView.cs b/Decompiler/Gestor.Application.Views.Ferramentas/TipoVendedorView.cs new file mode 100644 index 0000000..6bb42d7 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Ferramentas/TipoVendedorView.cs @@ -0,0 +1,267 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Threading; +using Gestor.Application.Helpers; +using Gestor.Application.ViewModels.Ferramentas; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Views.Ferramentas; + +public class TipoVendedorView : BaseUserControl, IComponentConnector +{ + [Serializable] + [CompilerGenerated] + private sealed class _003C_003Ec + { + public static readonly _003C_003Ec _003C_003E9 = new _003C_003Ec(); + + public static MouseButtonEventHandler _003C_003E9__2_0; + + internal void _003CContentLoad_003Eb__2_0(object sender, MouseButtonEventArgs args) + { + } + } + + public TipoVendedorViewModel ViewModel; + + internal DataGrid TipoVendedorGrid; + + internal MenuItem MaisOpcoesButton; + + internal ToggleButton AtivoBox; + + private bool _contentLoaded; + + public TipoVendedorView() + { + ((FrameworkElement)this).Tag = "CADASTRO DE TIPO DE VENDEDOR"; + ViewModel = new TipoVendedorViewModel(); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + } + + private void ContentLoad() + { + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_0023: Expected O, but got Unknown + //IL_003d: Unknown result type (might be due to invalid IL or missing references) + //IL_0042: Unknown result type (might be due to invalid IL or missing references) + //IL_0048: Expected O, but got Unknown + ((Selector)TipoVendedorGrid).SelectedIndex = 0; + ((Selector)TipoVendedorGrid).SelectionChanged += new SelectionChangedEventHandler(TipoVendedorGrid_OnSelectionChanged); + DataGrid tipoVendedorGrid = TipoVendedorGrid; + object obj = _003C_003Ec._003C_003E9__2_0; + if (obj == null) + { + MouseButtonEventHandler val = delegate + { + }; + _003C_003Ec._003C_003E9__2_0 = val; + obj = (object)val; + } + ((Control)tipoVendedorGrid).MouseDoubleClick += (MouseButtonEventHandler)obj; + } + + private void Incluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Incluir(); + ValidarTela(); + } + + private async void Salvar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(); + ((DependencyObject)(object)this).ValidateFields(list); + bool num = list == null || list.Count == 0; + ViewModel.Loading(isLoading: false); + if (!num) + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + } + + private void Cancelar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.CancelarAlteracao(); + } + + private void Excluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Excluir(); + } + + private void AutoCompleteBoxTipoVendedor_Populating(object sender, PopulatingEventArgs e) + { + e.Cancel = true; + ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<TipoVendedor>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void AutoCompleteBox_OnTextChanged(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + if (string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).Text)) + { + ViewModel.FiltrarTipoVendedor(""); + } + } + + private void Alterar_OnClick(object sender, RoutedEventArgs e) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Expected O, but got Unknown + ViewModel.CancelTipoVendedor = (TipoVendedor)((DomainBase)ViewModel.SelectedTipoVendedor).Clone(); + ViewModel.Alterar(alterar: true); + ValidarTela(); + ((DomainBase)ViewModel.SelectedTipoVendedor).Initialize(); + } + + private void TipoVendedorGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_0031: Unknown result type (might be due to invalid IL or missing references) + //IL_003b: Expected O, but got Unknown + DataGrid val = (DataGrid)sender; + if (val == null || ((Selector)val).SelectedIndex >= 0) + { + ViewModel.SelecionaTipoVendedor((TipoVendedor)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null)); + } + } + + private void AbrirLog_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLog((TipoTela)14, ((DomainBase)ViewModel.SelectedTipoVendedor).Id); + } + + private void ValidarTela() + { + if (ViewModel.SelectedTipoVendedor != null) + { + List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedTipoVendedor.Validate(); + ((DependencyObject)(object)this).ValidateFields(errorMessages, focusField: false); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/ferramentas/tipovendedorview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0036: Unknown result type (might be due to invalid IL or missing references) + //IL_0042: Unknown result type (might be due to invalid IL or missing references) + //IL_004c: Expected O, but got Unknown + //IL_004d: Unknown result type (might be due to invalid IL or missing references) + //IL_0059: Unknown result type (might be due to invalid IL or missing references) + //IL_0063: Expected O, but got Unknown + //IL_0066: Unknown result type (might be due to invalid IL or missing references) + //IL_0070: Expected O, but got Unknown + //IL_0072: Unknown result type (might be due to invalid IL or missing references) + //IL_007e: Unknown result type (might be due to invalid IL or missing references) + //IL_0088: Expected O, but got Unknown + //IL_008a: Unknown result type (might be due to invalid IL or missing references) + //IL_0096: Unknown result type (might be due to invalid IL or missing references) + //IL_00a0: Expected O, but got Unknown + //IL_00a2: Unknown result type (might be due to invalid IL or missing references) + //IL_00ae: Unknown result type (might be due to invalid IL or missing references) + //IL_00b8: Expected O, but got Unknown + //IL_00ba: Unknown result type (might be due to invalid IL or missing references) + //IL_00c6: Unknown result type (might be due to invalid IL or missing references) + //IL_00d0: Expected O, but got Unknown + //IL_00d2: Unknown result type (might be due to invalid IL or missing references) + //IL_00de: Unknown result type (might be due to invalid IL or missing references) + //IL_00e8: Expected O, but got Unknown + //IL_00eb: Unknown result type (might be due to invalid IL or missing references) + //IL_00f5: Expected O, but got Unknown + //IL_00f7: Unknown result type (might be due to invalid IL or missing references) + //IL_0103: Unknown result type (might be due to invalid IL or missing references) + //IL_010d: Expected O, but got Unknown + //IL_0110: Unknown result type (might be due to invalid IL or missing references) + //IL_011a: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBoxTipoVendedor_Populating); + ((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBox_OnTextChanged); + break; + case 2: + TipoVendedorGrid = (DataGrid)target; + break; + case 3: + ((MenuItem)target).Click += new RoutedEventHandler(Incluir_OnClick); + break; + case 4: + ((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick); + break; + case 5: + ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick); + break; + case 6: + ((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick); + break; + case 7: + ((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick); + break; + case 8: + MaisOpcoesButton = (MenuItem)target; + break; + case 9: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick); + break; + case 10: + AtivoBox = (ToggleButton)target; + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Ferramentas/UsuarioView.cs b/Decompiler/Gestor.Application.Views.Ferramentas/UsuarioView.cs new file mode 100644 index 0000000..e0fef14 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Ferramentas/UsuarioView.cs @@ -0,0 +1,570 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Threading; +using Gestor.Application.Drawers; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.ViewModels.Ferramentas; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.License; + +namespace Gestor.Application.Views.Ferramentas; + +public class UsuarioView : BaseUserControl, IComponentConnector +{ + private bool _abrindoPermissao; + + private bool _firstTime = true; + + private bool _setting; + + internal DataGrid UsuarioGrid; + + internal MenuItem CancelarApoliceButton; + + internal TextBox NomeBox; + + internal TextBox CepBox; + + internal TextBox EnderecoBox; + + internal TextBox NumeroBox; + + internal TextBox BairroBox; + + internal TextBox CidadeBox; + + internal TextBox EstadoBox; + + private bool _contentLoaded; + + public UsuarioViewModel ViewModel { get; set; } + + public UsuarioView() + { + ((FrameworkElement)this).Tag = "CADASTRO DE USUÁRIOS"; + ViewModel = new UsuarioViewModel(); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + } + + private void ScrollToItem() + { + if (((Selector)UsuarioGrid).SelectedItem != null) + { + ((UIElement)UsuarioGrid).UpdateLayout(); + UsuarioGrid.ScrollIntoView(((Selector)UsuarioGrid).SelectedItem); + } + } + + private async void ContentLoad() + { + ViewModel.Loading(isLoading: true); + await ViewModel.Seleciona(); + ViewModel.Loading(isLoading: false); + } + + private void Incluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Incluir(); + List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedUsuario.Validate(); + ((DependencyObject)(object)this).ValidateFields(errorMessages); + ViewModel.IsExpanded = false; + ((UIElement)NomeBox).Focus(); + } + + private async void Cancelar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + await ViewModel.CancelarAlteracao(); + ViewModel.Loading(isLoading: false); + ScrollToItem(); + } + + private async void Salvar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(); + ((DependencyObject)(object)this).ValidateFields(list); + bool num = list == null || list.Count == 0; + ViewModel.Loading(isLoading: false); + if (num) + { + ScrollToItem(); + } + else + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + } + + private async void Alterar_OnClick(object sender, RoutedEventArgs e) + { + if (LicenseHelper.Produtos.Any((Licenca produto) => (int)produto.Produto == 91) && ViewModel.SelectedUsuario.Login.Contains("@")) + { + await ViewModel.ShowMessage("ALTERAÇÃO DESSE USUARIO TEM QUE SER FEITO NO PAINEL DO AGGILIZADOR."); + return; + } + await ViewModel.AlterarUsuario(); + ((DomainBase)ViewModel.SelectedUsuario).Initialize(); + ViewModel.CancelUsuario = (Usuario)((DomainBase)ViewModel.SelectedUsuario).Clone(); + ViewModel.Alterar(alterar: true); + ViewModel.IsExpanded = false; + ((UIElement)NomeBox).Focus(); + } + + private async void Excluir_OnClick(object sender, RoutedEventArgs e) + { + if (LicenseHelper.Produtos.Any((Licenca produto) => (int)produto.Produto == 91) && ViewModel.SelectedUsuario.Login.Contains("@")) + { + await ViewModel.ShowMessage("EXCLUSÃO DESSE USUARIO TEM QUE SER FEITO NO PAINEL DO AGGILIZADOR."); + return; + } + await ViewModel.Excluir(); + ScrollToItem(); + } + + private void AutoCompleteBancoBox_Populating(object sender, PopulatingEventArgs e) + { + if (e.Parameter.Length < 3) + { + return; + } + e.Cancel = true; + ViewModel.BuscarBanco(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Banco>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private async void PostcodeBox_OnLostFocus(object sender, RoutedEventArgs e) + { + string text = ValidationHelper.FormatPostCode(((TextBox)sender).Text); + CepBox.Text = text; + if (ValidationHelper.ValidatePostCode(text)) + { + EnderecoBase val = await ViewModel.BuscaCep(text); + if (val != null) + { + EnderecoBox.Text = val.Endereco; + CidadeBox.Text = val.Cidade; + EstadoBox.Text = val.Estado; + BairroBox.Text = val.Bairro; + } + } + } + + private void AutoCompleteBoxUsuario_Populating(object sender, PopulatingEventArgs e) + { + e.Cancel = true; + ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Usuario>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void AutoCompleteBox_OnTextChanged(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + if (string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).Text)) + { + ViewModel.FiltrarUsuario(""); + } + } + + private async void UsuarioGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + if (ViewModel.EnableGrid) + { + DataGrid val = (DataGrid)sender; + if (val == null || ((Selector)val).SelectedIndex >= 0) + { + ViewModel.EnableGrid = false; + await ViewModel.SelecionaUsuario((Usuario)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null)); + ViewModel.EnableGrid = true; + } + } + } + + private async void Permissoes_OnClick(object sender, RoutedEventArgs e) + { + if (!_abrindoPermissao) + { + PermissaoUsuario val = ((IEnumerable<PermissaoUsuario>)ViewModel.PermissaoUsuario).FirstOrDefault((Func<PermissaoUsuario, bool>)((PermissaoUsuario permissao) => (int)permissao.Tela == 43)); + int num; + if (!Recursos.Usuario.Administrador && ((DomainBase)Recursos.Usuario).Id != 0L && !Recursos.Usuario.Nome.Contains("ACESSO AGGER") && val != null) + { + _ = val.Consultar; + num = ((!val.Consultar) ? 1 : 0); + } + else + { + num = 0; + } + bool flag = (byte)num != 0; + if (flag) + { + flag = await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR PERMISSÕES."); + } + if (!flag) + { + _abrindoPermissao = true; + await ViewModel.OpenPermissao(); + await Task.Delay(1000); + _abrindoPermissao = false; + } + } + } + + private async void Vinculo_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.OpenVinculo(); + } + + private async void AbrirAquivoDigital_Click(object sender, RoutedEventArgs e) + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)12).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)12) + "."); + return; + } + ViewModel.EnableAlterar = false; + FiltroArquivoDigital filtro = new FiltroArquivoDigital + { + Id = ((DomainBase)ViewModel.SelectedUsuario).Id, + Tipo = (TipoArquivoDigital)12, + Parente = ViewModel.SelectedUsuario + }; + ViewModel.ShowDrawer(new ArquivoDigitalDrawer(filtro), 0, close: false); + ViewModel.EnableAlterar = true; + } + + private void AbrirLog_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLog((TipoTela)16, ((DomainBase)ViewModel.SelectedUsuario).Id); + } + + private async void AbrirLogAcesso_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.ShowLogAcessoDialog((TipoTela)49, ViewModel.SelectedUsuario); + } + + private async void TelaInicial_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + if (_setting || ((Selector)(ComboBox)sender).SelectedItem == null) + { + return; + } + if ((int)(TipoTelaInicial)((Selector)(ComboBox)sender).SelectedItem == 1 && ViewModel.Restricao((TipoRestricao)47)) + { + _setting = true; + ((Selector)(ComboBox)sender).SelectedItem = (object)(TipoTelaInicial)0; + _setting = false; + if (_firstTime) + { + _firstTime = false; + return; + } + await ViewModel.ShowMessage("FAVOR DESABILITAR A RESTRIÇÃO AO PAINEL B.I. ANTES."); + } + _firstTime = false; + } + + private void CpfBox_OnLostFocus(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + TextBox val = (TextBox)sender; + val.Text = ValidationHelper.FormatDocument(val.Text); + } + + private async void CriarCartao_OnClick(object sender, RoutedEventArgs e) + { + bool dadosUsuario = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 30); + await ViewModel.CriarCartao(dadosUsuario); + } + + private async void Click_VerificaAdmCentralSegurado(object sender, RoutedEventArgs e) + { + await ViewModel.VerificaUsuarioAdmCentralSegurado(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/ferramentas/usuarioview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0086: Unknown result type (might be due to invalid IL or missing references) + //IL_0092: Unknown result type (might be due to invalid IL or missing references) + //IL_009c: Expected O, but got Unknown + //IL_009d: Unknown result type (might be due to invalid IL or missing references) + //IL_00a9: Unknown result type (might be due to invalid IL or missing references) + //IL_00b3: Expected O, but got Unknown + //IL_00b6: Unknown result type (might be due to invalid IL or missing references) + //IL_00c0: Expected O, but got Unknown + //IL_00c2: Unknown result type (might be due to invalid IL or missing references) + //IL_00ce: Unknown result type (might be due to invalid IL or missing references) + //IL_00d8: Expected O, but got Unknown + //IL_00da: Unknown result type (might be due to invalid IL or missing references) + //IL_00e6: Unknown result type (might be due to invalid IL or missing references) + //IL_00f0: Expected O, but got Unknown + //IL_00f2: Unknown result type (might be due to invalid IL or missing references) + //IL_00fe: Unknown result type (might be due to invalid IL or missing references) + //IL_0108: Expected O, but got Unknown + //IL_010b: Unknown result type (might be due to invalid IL or missing references) + //IL_0115: Expected O, but got Unknown + //IL_0122: Unknown result type (might be due to invalid IL or missing references) + //IL_012c: Expected O, but got Unknown + //IL_012e: Unknown result type (might be due to invalid IL or missing references) + //IL_013a: Unknown result type (might be due to invalid IL or missing references) + //IL_0144: Expected O, but got Unknown + //IL_0146: Unknown result type (might be due to invalid IL or missing references) + //IL_0152: Unknown result type (might be due to invalid IL or missing references) + //IL_015c: Expected O, but got Unknown + //IL_015e: Unknown result type (might be due to invalid IL or missing references) + //IL_016a: Unknown result type (might be due to invalid IL or missing references) + //IL_0174: Expected O, but got Unknown + //IL_0176: Unknown result type (might be due to invalid IL or missing references) + //IL_0182: Unknown result type (might be due to invalid IL or missing references) + //IL_018c: Expected O, but got Unknown + //IL_018e: Unknown result type (might be due to invalid IL or missing references) + //IL_019a: Unknown result type (might be due to invalid IL or missing references) + //IL_01a4: Expected O, but got Unknown + //IL_01a6: Unknown result type (might be due to invalid IL or missing references) + //IL_01b2: Unknown result type (might be due to invalid IL or missing references) + //IL_01bc: Expected O, but got Unknown + //IL_01be: Unknown result type (might be due to invalid IL or missing references) + //IL_01ca: Unknown result type (might be due to invalid IL or missing references) + //IL_01d4: Expected O, but got Unknown + //IL_01d7: Unknown result type (might be due to invalid IL or missing references) + //IL_01e1: Expected O, but got Unknown + //IL_01e3: Unknown result type (might be due to invalid IL or missing references) + //IL_01f0: Unknown result type (might be due to invalid IL or missing references) + //IL_01fa: Expected O, but got Unknown + //IL_01fb: Unknown result type (might be due to invalid IL or missing references) + //IL_0207: Unknown result type (might be due to invalid IL or missing references) + //IL_0211: Expected O, but got Unknown + //IL_0213: Unknown result type (might be due to invalid IL or missing references) + //IL_021f: Unknown result type (might be due to invalid IL or missing references) + //IL_0229: Expected O, but got Unknown + //IL_022b: Unknown result type (might be due to invalid IL or missing references) + //IL_0237: Unknown result type (might be due to invalid IL or missing references) + //IL_0241: Expected O, but got Unknown + //IL_0242: Unknown result type (might be due to invalid IL or missing references) + //IL_024e: Unknown result type (might be due to invalid IL or missing references) + //IL_0258: Expected O, but got Unknown + //IL_0259: Unknown result type (might be due to invalid IL or missing references) + //IL_0265: Unknown result type (might be due to invalid IL or missing references) + //IL_026f: Expected O, but got Unknown + //IL_0271: Unknown result type (might be due to invalid IL or missing references) + //IL_027d: Unknown result type (might be due to invalid IL or missing references) + //IL_0287: Expected O, but got Unknown + //IL_0288: Unknown result type (might be due to invalid IL or missing references) + //IL_0294: Unknown result type (might be due to invalid IL or missing references) + //IL_029e: Expected O, but got Unknown + //IL_029f: Unknown result type (might be due to invalid IL or missing references) + //IL_02ab: Unknown result type (might be due to invalid IL or missing references) + //IL_02b5: Expected O, but got Unknown + //IL_02b7: Unknown result type (might be due to invalid IL or missing references) + //IL_02c3: Unknown result type (might be due to invalid IL or missing references) + //IL_02cd: Expected O, but got Unknown + //IL_02d0: Unknown result type (might be due to invalid IL or missing references) + //IL_02da: Expected O, but got Unknown + //IL_02e7: Unknown result type (might be due to invalid IL or missing references) + //IL_02f1: Expected O, but got Unknown + //IL_02ff: Unknown result type (might be due to invalid IL or missing references) + //IL_0309: Expected O, but got Unknown + //IL_030c: Unknown result type (might be due to invalid IL or missing references) + //IL_0316: Expected O, but got Unknown + //IL_0319: Unknown result type (might be due to invalid IL or missing references) + //IL_0323: Expected O, but got Unknown + //IL_0326: Unknown result type (might be due to invalid IL or missing references) + //IL_0330: Expected O, but got Unknown + //IL_0333: Unknown result type (might be due to invalid IL or missing references) + //IL_033d: Expected O, but got Unknown + //IL_0340: Unknown result type (might be due to invalid IL or missing references) + //IL_034a: Expected O, but got Unknown + //IL_034c: Unknown result type (might be due to invalid IL or missing references) + //IL_0359: Unknown result type (might be due to invalid IL or missing references) + //IL_0363: Expected O, but got Unknown + //IL_0365: Unknown result type (might be due to invalid IL or missing references) + //IL_0372: Unknown result type (might be due to invalid IL or missing references) + //IL_037c: Expected O, but got Unknown + //IL_037d: Unknown result type (might be due to invalid IL or missing references) + //IL_038a: Unknown result type (might be due to invalid IL or missing references) + //IL_0394: Expected O, but got Unknown + //IL_0396: Unknown result type (might be due to invalid IL or missing references) + //IL_03a3: Unknown result type (might be due to invalid IL or missing references) + //IL_03ad: Expected O, but got Unknown + //IL_03af: Unknown result type (might be due to invalid IL or missing references) + //IL_03bc: Unknown result type (might be due to invalid IL or missing references) + //IL_03c6: Expected O, but got Unknown + //IL_03c7: Unknown result type (might be due to invalid IL or missing references) + //IL_03d4: Unknown result type (might be due to invalid IL or missing references) + //IL_03de: Expected O, but got Unknown + //IL_03e0: Unknown result type (might be due to invalid IL or missing references) + //IL_03ec: Unknown result type (might be due to invalid IL or missing references) + //IL_03f6: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBoxUsuario_Populating); + ((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBox_OnTextChanged); + break; + case 2: + UsuarioGrid = (DataGrid)target; + break; + case 3: + ((MenuItem)target).Click += new RoutedEventHandler(Incluir_OnClick); + break; + case 4: + ((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick); + break; + case 5: + ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick); + break; + case 6: + CancelarApoliceButton = (MenuItem)target; + CancelarApoliceButton.Click += new RoutedEventHandler(Cancelar_OnClick); + break; + case 7: + ((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick); + break; + case 8: + ((MenuItem)target).Click += new RoutedEventHandler(Permissoes_OnClick); + break; + case 9: + ((MenuItem)target).Click += new RoutedEventHandler(Vinculo_OnClick); + break; + case 10: + ((MenuItem)target).Click += new RoutedEventHandler(CriarCartao_OnClick); + break; + case 11: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick); + break; + case 12: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirAquivoDigital_Click); + break; + case 13: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLogAcesso_OnClick); + break; + case 14: + NomeBox = (TextBox)target; + break; + case 15: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(CpfBox_OnLostFocus); + break; + case 16: + ((Selector)(ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(TelaInicial_OnSelectionChanged); + break; + case 17: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + break; + case 18: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + break; + case 19: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBancoBox_Populating); + break; + case 20: + CepBox = (TextBox)target; + ((UIElement)CepBox).LostFocus += new RoutedEventHandler(PostcodeBox_OnLostFocus); + ((UIElement)CepBox).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 21: + EnderecoBox = (TextBox)target; + break; + case 22: + NumeroBox = (TextBox)target; + break; + case 23: + BairroBox = (TextBox)target; + break; + case 24: + CidadeBox = (TextBox)target; + break; + case 25: + EstadoBox = (TextBox)target; + break; + case 26: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 27: + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(FormatarTelefone); + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 28: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 29: + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(FormatarTelefone); + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 30: + ((ButtonBase)(ToggleButton)target).Click += new RoutedEventHandler(Click_VerificaAdmCentralSegurado); + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Ferramentas/VendedorView.cs b/Decompiler/Gestor.Application.Views.Ferramentas/VendedorView.cs new file mode 100644 index 0000000..a0715bd --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Ferramentas/VendedorView.cs @@ -0,0 +1,896 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Data; +using System.Windows.Input; +using System.Windows.Markup; +using CurrencyTextBoxControl; +using Gestor.Application.Drawers; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.Servicos.Ferramentas; +using Gestor.Application.ViewModels.Ferramentas; +using Gestor.Application.Views.Generic; +using Gestor.Common.Helpers; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Xceed.Wpf.AvalonDock.Controls; + +namespace Gestor.Application.Views.Ferramentas; + +public class VendedorView : BaseUserControl, IComponentConnector, IStyleConnector +{ + public VendedorViewModel ViewModel; + + internal DataGrid VendedorGrid; + + internal MenuItem IncluirButton; + + internal MenuItem AlterarButton; + + internal MenuItem SalvarButton; + + internal MenuItem CancelarButton; + + internal MenuItem MaisOpcoesButton; + + internal TextBox EmpresaBox; + + internal TextBox IdBox; + + internal TextBox NomeBox; + + internal TextBox DocumentoPrincipalBox; + + internal AutoCompleteBox AutoCompleteBanco; + + internal TextBox AgenciaBox; + + internal ComboBox TipoBox; + + internal TextBox ContaBox; + + internal TextBox TitularBox; + + internal TextBox TitularDocBox; + + internal ComboBox TipoIncidenciaDescontoBox; + + internal ToggleButton AtivoBox; + + internal Grid GridContatos; + + private bool _contentLoaded; + + public bool UpdatingScroll { get; set; } + + public VendedorView() + { + ((FrameworkElement)this).Tag = "CADASTRO DE VENDEDOR"; + ViewModel = new VendedorViewModel(); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + private void Incluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Incluir(); + AutoCompleteBanco.Text = ""; + ValidarTela(); + } + + private void Cancelar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.CancelarAlteracao(); + ViewModel.IsExpanded = true; + if (((DomainBase)Recursos.Usuario).Id == 0L) + { + AlterarPropriaCorretora(); + } + } + + private async void Salvar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + ViewModel.IsExpanded = true; + if (!ViewModel.SelectedVendedor.Ativo && await BuscaVinculo(ViewModel.SelectedVendedor)) + { + return; + } + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(); + ((DependencyObject)(object)this).ValidateFields(list); + bool num = list == null || list.Count == 0; + ViewModel.Loading(isLoading: false); + if (num) + { + if (((DomainBase)Recursos.Usuario).Id == 0L) + { + AlterarPropriaCorretora(); + } + ScrollVendedor(); + } + else + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + } + + private async Task<bool> BuscaVinculo(Vendedor vendedor) + { + if (!(await new VendedorUsuarioServico().FindVinculo(vendedor))) + { + return false; + } + await ViewModel.ShowMessage("NÃO É POSSÍVEL INATIVAR VENDEDOR QUE POSSUI VINCULO DE USUÁRIO."); + ViewModel.Loading(isLoading: false); + return true; + } + + private async void Adiantamento_Click(object sender, RoutedEventArgs e) + { + if (ViewModel.SelectedVendedor != null && ViewModel.SelectedVendedor.Corretora) + { + await ViewModel.ShowMessage("NÃO É POSSÍVEL ADICIONAR ADIANTAMENTOS PARA O VENDEDOR PRÓPRIA CORRETORA."); + } + else + { + ViewModel.ShowDrawer(new AdiantamentoDrawerView(ViewModel.SelectedVendedor), 0, close: false); + } + } + + private void IncluirRepasse_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.IncluirRepasse(); + ValidarTela(); + } + + private void IncluirTelefone_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.IncluirTelefone(); + ValidarTela(); + } + + private void ExcluirTelefone_OnClick(object sender, RoutedEventArgs e) + { + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_0034: Expected O, but got Unknown + Button val = (Button)((sender is Button) ? sender : null); + if (val != null) + { + ListBox val2 = Extentions.FindVisualAncestor<ListBox>((DependencyObject)(object)val); + VendedorTelefone telefone = (VendedorTelefone)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)]; + ViewModel.ExcluirTelefone(telefone); + } + } + + private async void Alterar_OnClick(object sender, RoutedEventArgs e) + { + Vendedor selectedVendedor = ViewModel.SelectedVendedor; + bool flag = selectedVendedor != null && selectedVendedor.Corretora; + if (flag) + { + if (((DomainBase)Recursos.Usuario).Id != 0L) + { + await ViewModel.ShowMessage("NÃO É POSSÍVEL ALTERAR O VENDEDOR PRÓPRIA CORRETORA."); + return; + } + AlterarPropriaCorretora(habilitar: true); + } + ViewModel.IsExpanded = false; + VendedorViewModel viewModel = ViewModel; + Vendedor selectedVendedor2 = ViewModel.SelectedVendedor; + viewModel.CancelVendedor = (Vendedor)((selectedVendedor2 != null) ? ((DomainBase)selectedVendedor2).Clone() : null); + if (!flag) + { + ViewModel.Alterar(alterar: true); + } + ValidarTela(); + } + + public async void Button_Click(object sender, RoutedEventArgs e) + { + if (ViewModel.SelectedVendedor != null && ViewModel.SelectedVendedor.Corretora) + { + await ViewModel.ShowMessage("NÃO É POSSÍVEL CRIAR METAS DE VENDEDOR PARA O VENDEDOR PRÓPRIA CORRETORA."); + return; + } + ViewModel.Loading(isLoading: true); + if (await ViewModel.VerificarPermissao((TipoTela)30)) + { + ViewModel.ShowDrawer(new MetaVendedorView(ViewModel.SelectedVendedor), 0, close: false); + ViewModel.Loading(isLoading: false); + } + } + + private void TipoBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_0030: Unknown result type (might be due to invalid IL or missing references) + //IL_0036: Expected O, but got Unknown + //IL_004a: Unknown result type (might be due to invalid IL or missing references) + //IL_0050: Expected O, but got Unknown + //IL_0060: Unknown result type (might be due to invalid IL or missing references) + //IL_0067: Expected O, but got Unknown + //IL_006d: Unknown result type (might be due to invalid IL or missing references) + //IL_0072: Unknown result type (might be due to invalid IL or missing references) + //IL_0080: Unknown result type (might be due to invalid IL or missing references) + //IL_0083: Invalid comparison between Unknown and I4 + //IL_0085: Unknown result type (might be due to invalid IL or missing references) + //IL_0088: Invalid comparison between Unknown and I4 + ComboBox val = (ComboBox)sender; + if (((Selector)val).SelectedItem == null) + { + return; + } + ListBoxItem val2 = ((DependencyObject)(object)val).FindAncestor<ListBoxItem>().FirstOrDefault(); + if (val2 == null) + { + return; + } + ComboBox val3 = (ComboBox)((FrameworkElement)FindVisualChild.Find<ComboBox>((DependencyObject)(object)val2)).FindName("FormaPagtoBox"); + if (val3 == null) + { + return; + } + CurrencyTextBox val4 = (CurrencyTextBox)((FrameworkElement)FindVisualChild.Find<CurrencyTextBox>((DependencyObject)(object)val2)).FindName("ValorBox"); + CurrencyTextBox val5 = (CurrencyTextBox)((FrameworkElement)FindVisualChild.Find<CurrencyTextBox>((DependencyObject)(object)val2)).FindName("RenovacoesBox"); + TipoRepasse val6 = (TipoRepasse)((Selector)val).SelectedItem; + ((Selector)val3).SelectedItem = (object)(FormaRepasse)1; + if ((int)val6 != 1) + { + if ((int)val6 == 2) + { + if (val4 != null) + { + val4.MaximumValue = 100m; + } + if (val5 != null) + { + val5.MaximumValue = 100m; + } + } + } + else + { + if (val4 != null) + { + val4.MaximumValue = 10000m; + } + if (val5 != null) + { + val5.MaximumValue = 10000m; + } + } + } + + private void FormaPagtoBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_0030: Unknown result type (might be due to invalid IL or missing references) + //IL_0036: Expected O, but got Unknown + //IL_003c: Unknown result type (might be due to invalid IL or missing references) + //IL_0041: Unknown result type (might be due to invalid IL or missing references) + //IL_004d: Unknown result type (might be due to invalid IL or missing references) + //IL_004f: Unknown result type (might be due to invalid IL or missing references) + //IL_0061: Expected I4, but got Unknown + ComboBox val = (ComboBox)sender; + if (((Selector)val).SelectedItem == null) + { + return; + } + Grid val2 = ((DependencyObject)(object)val).FindAncestor<Grid>().FirstOrDefault(); + if (val2 == null) + { + return; + } + ComboBox val3 = (ComboBox)((FrameworkElement)FindVisualChild.Find<ComboBox>((DependencyObject)(object)val2)).FindName("BasePagtoBox"); + FormaRepasse val4 = (FormaRepasse)((Selector)val).SelectedItem; + if (val3 != null) + { + ((UIElement)val3).IsEnabled = true; + switch (val4 - 1) + { + case 0: + ((Selector)val3).SelectedItem = null; + break; + case 1: + ((Selector)val3).SelectedItem = (object)(BaseRepasse)1; + break; + case 2: + ((Selector)val3).SelectedItem = (object)(BaseRepasse)3; + ((UIElement)val3).IsEnabled = false; + break; + } + } + } + + private void AutoCompleteBancoBox_Populating(object sender, PopulatingEventArgs e) + { + if (e.Parameter.Length < 3) + { + return; + } + e.Cancel = true; + ViewModel.BuscarBanco(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Banco>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void AutoCompleteBoxVendedor_Populating(object sender, PopulatingEventArgs e) + { + e.Cancel = true; + ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Vendedor>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void AutoCompleteBox_OnTextChanged(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + if (string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).Text)) + { + ViewModel.FiltrarVendedor(""); + } + } + + private async void AbrirAquivoDigital_Click(object sender, RoutedEventArgs e) + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)6).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + EnumHelper.GetDescription<TipoArquivoDigital>((TipoArquivoDigital)6) + "."); + return; + } + FiltroArquivoDigital filtro = new FiltroArquivoDigital + { + Id = ((DomainBase)ViewModel.SelectedVendedor).Id, + Tipo = (TipoArquivoDigital)6, + Parente = ViewModel.SelectedVendedor + }; + ViewModel.ShowDrawer(new ArquivoDigitalDrawer(filtro), 0, close: false); + } + + private void AbrirLog_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLog((TipoTela)15, ((DomainBase)ViewModel.SelectedVendedor).Id); + } + + private void AbrirLogEmail_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLogEmail((TipoTela)15, ((DomainBase)ViewModel.SelectedVendedor).Id); + } + + private async void IncluirVinculo_OnClick(object sender, RoutedEventArgs e) + { + Button btn = (Button)sender; + if (((btn != null) ? ((FrameworkElement)btn).DataContext : null) == null) + { + return; + } + ViewModel.Loading(isLoading: true); + List<Repasse> repasses = await new VendedorServico().BuscaRepasses(); + Repasse repasse = (Repasse)((FrameworkElement)btn).DataContext; + VinculoRepasse vinculo = new VinculoRepasse + { + IdRepasse = ((DomainBase)repasse).Id + }; + if (!repasse.Ativo) + { + await ViewModel.ShowMessage("POR FAVOR, ATIVE O REPASSE PARA VINCULÁ-LO"); + ViewModel.Loading(isLoading: false); + return; + } + VinculoRepasse response = await ViewModel.ShowVinculoDialog(vinculo, repasses, repasse); + if (response == null) + { + ViewModel.Loading(isLoading: false); + return; + } + List<KeyValuePair<string, string>> list = response.Validate(repasse.Vinculo, repasse); + while (list != null && list.Count > 0) + { + await ViewModel.ShowMessage(list, "OS CAMPOS ABAIXO ESTÃO INVÁLIDOS.", "OK"); + response = await ViewModel.ShowVinculoDialog(response, repasses, repasse); + if (response == null) + { + ViewModel.Loading(isLoading: false); + return; + } + list = response.Validate(repasse.Vinculo, repasse); + } + await ViewModel.SalvarVinculo(response); + ViewModel.Loading(isLoading: false); + } + + private async void ExcluirVinculo_OnClick(object sender, RoutedEventArgs e) + { + Button val = (Button)sender; + if (val != null && ((FrameworkElement)val).DataContext != null) + { + VinculoRepasse vinculo = (VinculoRepasse)((FrameworkElement)val).DataContext; + ViewModel.Loading(isLoading: true); + await ViewModel.ExcluirVinculo(vinculo); + ViewModel.Loading(isLoading: false); + } + } + + private void AbrirLogRepasse_OnClick(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Expected O, but got Unknown + Button val = (Button)sender; + if (val != null && ((FrameworkElement)val).DataContext != null) + { + Repasse val2 = (Repasse)((FrameworkElement)val).DataContext; + ViewModel.AbrirLog((TipoTela)54, ((DomainBase)val2).Id); + } + } + + private void DocumentoPrincipalBox_LostFocus(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + if (!((TextBoxBase)(TextBox)sender).IsReadOnly) + { + string text = ValidationHelper.Clear(DocumentoPrincipalBox.Text); + if (!string.IsNullOrEmpty(text)) + { + DocumentoPrincipalBox.Text = ((text.Length == 11) ? ValidationHelper.FormatDocument(text.PadLeft(11, '0').Substring(0, 11)) : ValidationHelper.FormatDocument(text.PadLeft(14, '0').Substring(0, 14))); + } + } + } + + private void AutoCompleteBanco_OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Expected O, but got Unknown + AutoCompleteBox val = (AutoCompleteBox)sender; + SetValid(val, string.IsNullOrWhiteSpace(val.Text) || ViewModel.SelectedVendedor.Banco != null); + } + + private static void SetValid(AutoCompleteBox autocomplete, bool valid) + { + ViewHelper.SetInvalid((Control)(object)autocomplete, "BANCO INVÁLIDO", valid); + } + + private void ValidarTela() + { + if (ViewModel.SelectedVendedor != null) + { + List<KeyValuePair<string, string>> list = ViewModel.SelectedVendedor.Validate(); + List<VendedorTelefone> telefones = ViewModel.SelectedVendedor.Telefones; + object obj; + if (telefones == null) + { + obj = null; + } + else + { + VendedorTelefone? obj2 = telefones.FirstOrDefault(); + obj = ((obj2 != null) ? obj2.Validate() : null); + } + if (obj == null) + { + obj = new List<KeyValuePair<string, string>>(); + } + list.AddRange((IEnumerable<KeyValuePair<string, string>>)obj); + ObservableCollection<Repasse> repasses = ViewModel.Repasses; + object obj3; + if (repasses == null) + { + obj3 = null; + } + else + { + Repasse? obj4 = repasses.FirstOrDefault(); + obj3 = ((obj4 != null) ? obj4.Validate() : null); + } + if (obj3 == null) + { + obj3 = new List<KeyValuePair<string, string>>(); + } + list.AddRange((IEnumerable<KeyValuePair<string, string>>)obj3); + ((DependencyObject)(object)this).ValidateFields(list, focusField: false); + } + } + + private void VendedorView_SizeChanged(object sender, SizeChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_005b: Unknown result type (might be due to invalid IL or missing references) + //IL_0028: Unknown result type (might be due to invalid IL or missing references) + Size newSize = e.NewSize; + if (((Size)(ref newSize)).Width > 1260.0) + { + ViewModel.GridHeight2 = new GridLength(0.0); + Grid.SetRow((UIElement)(object)GridContatos, 0); + Grid.SetColumn((UIElement)(object)GridContatos, 1); + } + else + { + ViewModel.GridHeight2 = new GridLength(1.0, (GridUnitType)2); + Grid.SetRow((UIElement)(object)GridContatos, 1); + Grid.SetColumn((UIElement)(object)GridContatos, 0); + } + } + + private async void AtivarInativarVendedor_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.SelectedVendedor != null) + { + if (ViewModel.SelectedVendedor.Corretora) + { + await ViewModel.ShowMessage("NÃO É POSSÍVEL ALTERAR O VENDEDOR PRÓPRIA CORRETORA."); + } + else if (!(await BuscaVinculo(ViewModel.SelectedVendedor))) + { + ViewModel.Loading(isLoading: true); + await ViewModel.AtivarInativarVendedor(ViewModel.SelectedVendedor); + ScrollVendedor(); + ViewModel.Loading(isLoading: false); + } + } + } + + private async void AtivarInativarRepasse_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.SelectedVendedor.Corretora) + { + await ViewModel.ShowMessage("NÃO É POSSÍVEL ALTERAR O VENDEDOR PRÓPRIA CORRETORA."); + return; + } + Repasse val = (Repasse)((FrameworkElement)(Button)sender).DataContext; + if (val != null) + { + ViewModel.Loading(isLoading: true); + await ViewModel.AtivarInativarRepasse(val); + ScrollVendedor(); + ViewModel.Loading(isLoading: false); + } + } + + private void ScrollVendedor() + { + if (!UpdatingScroll && ((Selector)VendedorGrid).SelectedItem != null) + { + VendedorGrid.ScrollIntoView(((Selector)VendedorGrid).SelectedItem); + } + UpdatingScroll = false; + } + + public void AlterarPropriaCorretora(bool habilitar = false) + { + if (habilitar) + { + ((TextBoxBase)NomeBox).IsReadOnly = false; + ((TextBoxBase)DocumentoPrincipalBox).IsReadOnly = false; + ((UIElement)AlterarButton).IsEnabled = false; + ((UIElement)SalvarButton).IsEnabled = true; + ((UIElement)CancelarButton).IsEnabled = true; + ((UIElement)IncluirButton).IsEnabled = false; + } + else + { + ((TextBoxBase)NomeBox).IsReadOnly = true; + ((TextBoxBase)DocumentoPrincipalBox).IsReadOnly = true; + ((UIElement)AlterarButton).IsEnabled = true; + ((UIElement)SalvarButton).IsEnabled = false; + ((UIElement)CancelarButton).IsEnabled = false; + ((UIElement)IncluirButton).IsEnabled = false; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/ferramentas/vendedorview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0096: Unknown result type (might be due to invalid IL or missing references) + //IL_00a2: Unknown result type (might be due to invalid IL or missing references) + //IL_00ac: Expected O, but got Unknown + //IL_00ad: Unknown result type (might be due to invalid IL or missing references) + //IL_00b9: Unknown result type (might be due to invalid IL or missing references) + //IL_00c3: Expected O, but got Unknown + //IL_00c6: Unknown result type (might be due to invalid IL or missing references) + //IL_00d0: Expected O, but got Unknown + //IL_00d3: Unknown result type (might be due to invalid IL or missing references) + //IL_00dd: Expected O, but got Unknown + //IL_00ea: Unknown result type (might be due to invalid IL or missing references) + //IL_00f4: Expected O, but got Unknown + //IL_00f7: Unknown result type (might be due to invalid IL or missing references) + //IL_0101: Expected O, but got Unknown + //IL_010e: Unknown result type (might be due to invalid IL or missing references) + //IL_0118: Expected O, but got Unknown + //IL_011b: Unknown result type (might be due to invalid IL or missing references) + //IL_0125: Expected O, but got Unknown + //IL_0132: Unknown result type (might be due to invalid IL or missing references) + //IL_013c: Expected O, but got Unknown + //IL_013f: Unknown result type (might be due to invalid IL or missing references) + //IL_0149: Expected O, but got Unknown + //IL_0156: Unknown result type (might be due to invalid IL or missing references) + //IL_0160: Expected O, but got Unknown + //IL_0162: Unknown result type (might be due to invalid IL or missing references) + //IL_016e: Unknown result type (might be due to invalid IL or missing references) + //IL_0178: Expected O, but got Unknown + //IL_017a: Unknown result type (might be due to invalid IL or missing references) + //IL_0186: Unknown result type (might be due to invalid IL or missing references) + //IL_0190: Expected O, but got Unknown + //IL_0192: Unknown result type (might be due to invalid IL or missing references) + //IL_019e: Unknown result type (might be due to invalid IL or missing references) + //IL_01a8: Expected O, but got Unknown + //IL_01ab: Unknown result type (might be due to invalid IL or missing references) + //IL_01b5: Expected O, but got Unknown + //IL_01b7: Unknown result type (might be due to invalid IL or missing references) + //IL_01c3: Unknown result type (might be due to invalid IL or missing references) + //IL_01cd: Expected O, but got Unknown + //IL_01cf: Unknown result type (might be due to invalid IL or missing references) + //IL_01db: Unknown result type (might be due to invalid IL or missing references) + //IL_01e5: Expected O, but got Unknown + //IL_01e8: Unknown result type (might be due to invalid IL or missing references) + //IL_01f2: Expected O, but got Unknown + //IL_01f5: Unknown result type (might be due to invalid IL or missing references) + //IL_01ff: Expected O, but got Unknown + //IL_0202: Unknown result type (might be due to invalid IL or missing references) + //IL_020c: Expected O, but got Unknown + //IL_020f: Unknown result type (might be due to invalid IL or missing references) + //IL_0219: Expected O, but got Unknown + //IL_0227: Unknown result type (might be due to invalid IL or missing references) + //IL_0231: Expected O, but got Unknown + //IL_023e: Unknown result type (might be due to invalid IL or missing references) + //IL_0248: Expected O, but got Unknown + //IL_024b: Unknown result type (might be due to invalid IL or missing references) + //IL_0255: Expected O, but got Unknown + //IL_0262: Unknown result type (might be due to invalid IL or missing references) + //IL_026c: Expected O, but got Unknown + //IL_0279: Unknown result type (might be due to invalid IL or missing references) + //IL_0283: Expected O, but got Unknown + //IL_0286: Unknown result type (might be due to invalid IL or missing references) + //IL_0290: Expected O, but got Unknown + //IL_0293: Unknown result type (might be due to invalid IL or missing references) + //IL_029d: Expected O, but got Unknown + //IL_02a0: Unknown result type (might be due to invalid IL or missing references) + //IL_02aa: Expected O, but got Unknown + //IL_02ad: Unknown result type (might be due to invalid IL or missing references) + //IL_02b7: Expected O, but got Unknown + //IL_02ba: Unknown result type (might be due to invalid IL or missing references) + //IL_02c4: Expected O, but got Unknown + //IL_02d2: Unknown result type (might be due to invalid IL or missing references) + //IL_02dc: Expected O, but got Unknown + //IL_02df: Unknown result type (might be due to invalid IL or missing references) + //IL_02e9: Expected O, but got Unknown + //IL_02ec: Unknown result type (might be due to invalid IL or missing references) + //IL_02f6: Expected O, but got Unknown + //IL_02f8: Unknown result type (might be due to invalid IL or missing references) + //IL_0304: Unknown result type (might be due to invalid IL or missing references) + //IL_030e: Expected O, but got Unknown + //IL_0310: Unknown result type (might be due to invalid IL or missing references) + //IL_031c: Unknown result type (might be due to invalid IL or missing references) + //IL_0326: Expected O, but got Unknown + //IL_0329: Unknown result type (might be due to invalid IL or missing references) + //IL_0333: Expected O, but got Unknown + //IL_0335: Unknown result type (might be due to invalid IL or missing references) + //IL_0341: Unknown result type (might be due to invalid IL or missing references) + //IL_034b: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBoxVendedor_Populating); + ((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBox_OnTextChanged); + break; + case 2: + VendedorGrid = (DataGrid)target; + break; + case 3: + IncluirButton = (MenuItem)target; + IncluirButton.Click += new RoutedEventHandler(Incluir_OnClick); + break; + case 4: + AlterarButton = (MenuItem)target; + AlterarButton.Click += new RoutedEventHandler(Alterar_OnClick); + break; + case 5: + SalvarButton = (MenuItem)target; + SalvarButton.Click += new RoutedEventHandler(Salvar_OnClick); + break; + case 6: + CancelarButton = (MenuItem)target; + CancelarButton.Click += new RoutedEventHandler(Cancelar_OnClick); + break; + case 7: + ((MenuItem)target).Click += new RoutedEventHandler(Adiantamento_Click); + break; + case 8: + ((MenuItem)target).Click += new RoutedEventHandler(Button_Click); + break; + case 9: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirAquivoDigital_Click); + break; + case 10: + MaisOpcoesButton = (MenuItem)target; + break; + case 11: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick); + break; + case 12: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLogEmail_OnClick); + break; + case 13: + EmpresaBox = (TextBox)target; + break; + case 14: + IdBox = (TextBox)target; + break; + case 15: + NomeBox = (TextBox)target; + break; + case 16: + DocumentoPrincipalBox = (TextBox)target; + ((UIElement)DocumentoPrincipalBox).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + ((UIElement)DocumentoPrincipalBox).LostFocus += new RoutedEventHandler(DocumentoPrincipalBox_LostFocus); + break; + case 17: + AutoCompleteBanco = (AutoCompleteBox)target; + AutoCompleteBanco.Populating += new PopulatingEventHandler(AutoCompleteBancoBox_Populating); + ((UIElement)AutoCompleteBanco).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(AutoCompleteBanco_OnLostKeyboardFocus); + break; + case 18: + AgenciaBox = (TextBox)target; + break; + case 19: + TipoBox = (ComboBox)target; + break; + case 20: + ContaBox = (TextBox)target; + break; + case 21: + TitularBox = (TextBox)target; + break; + case 22: + TitularDocBox = (TextBox)target; + ((UIElement)TitularDocBox).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 23: + TipoIncidenciaDescontoBox = (ComboBox)target; + break; + case 24: + AtivoBox = (ToggleButton)target; + break; + case 25: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AtivarInativarVendedor_OnClick); + break; + case 26: + ((MenuItem)target).Click += new RoutedEventHandler(IncluirRepasse_OnClick); + break; + case 33: + GridContatos = (Grid)target; + break; + case 34: + ((MenuItem)target).Click += new RoutedEventHandler(IncluirTelefone_OnClick); + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_0037: Unknown result type (might be due to invalid IL or missing references) + //IL_0043: Unknown result type (might be due to invalid IL or missing references) + //IL_004d: Expected O, but got Unknown + //IL_004f: Unknown result type (might be due to invalid IL or missing references) + //IL_005b: Unknown result type (might be due to invalid IL or missing references) + //IL_0065: Expected O, but got Unknown + //IL_0067: Unknown result type (might be due to invalid IL or missing references) + //IL_0073: Unknown result type (might be due to invalid IL or missing references) + //IL_007d: Expected O, but got Unknown + //IL_007f: Unknown result type (might be due to invalid IL or missing references) + //IL_008b: Unknown result type (might be due to invalid IL or missing references) + //IL_0095: Expected O, but got Unknown + //IL_0097: Unknown result type (might be due to invalid IL or missing references) + //IL_00a3: Unknown result type (might be due to invalid IL or missing references) + //IL_00ad: Expected O, but got Unknown + //IL_00af: Unknown result type (might be due to invalid IL or missing references) + //IL_00bb: Unknown result type (might be due to invalid IL or missing references) + //IL_00c5: Expected O, but got Unknown + //IL_00c7: Unknown result type (might be due to invalid IL or missing references) + //IL_00d3: Unknown result type (might be due to invalid IL or missing references) + //IL_00dd: Expected O, but got Unknown + //IL_00df: Unknown result type (might be due to invalid IL or missing references) + //IL_00ec: Unknown result type (might be due to invalid IL or missing references) + //IL_00f6: Expected O, but got Unknown + //IL_00f8: Unknown result type (might be due to invalid IL or missing references) + //IL_0105: Unknown result type (might be due to invalid IL or missing references) + //IL_010f: Expected O, but got Unknown + //IL_0110: Unknown result type (might be due to invalid IL or missing references) + //IL_011d: Unknown result type (might be due to invalid IL or missing references) + //IL_0127: Expected O, but got Unknown + switch (connectionId) + { + case 27: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(IncluirVinculo_OnClick); + break; + case 28: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AbrirLogRepasse_OnClick); + break; + case 29: + ((Selector)(ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(TipoBox_OnSelectionChanged); + break; + case 30: + ((Selector)(ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(FormaPagtoBox_OnSelectionChanged); + break; + case 31: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AtivarInativarRepasse_OnClick); + break; + case 32: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirVinculo_OnClick); + break; + case 35: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirTelefone_OnClick); + break; + case 36: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 37: + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(FormatarTelefone); + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 33: + case 34: + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Financeiro.Relatorios/FechamentoFinanceiroView.cs b/Decompiler/Gestor.Application.Views.Financeiro.Relatorios/FechamentoFinanceiroView.cs new file mode 100644 index 0000000..3b09d24 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Financeiro.Relatorios/FechamentoFinanceiroView.cs @@ -0,0 +1,319 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Threading; +using Gestor.Application.Componentes; +using Gestor.Application.ViewModels.Financeiro.Relatorios; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Domain.Financeiro; +using Gestor.Model.Domain.Financeiro.Relatorios; + +namespace Gestor.Application.Views.Financeiro.Relatorios; + +public class FechamentoFinanceiroView : BaseUserControl, IComponentConnector, IStyleConnector +{ + public FechamentoFinanceiroViewModel ViewModel; + + internal ProgressBar ProgressRing; + + internal DatePicker InicioBox; + + internal DatePicker FimBox; + + internal WebEditor WebEditor; + + internal TextBlock NaoHaDados; + + private bool _contentLoaded; + + public FechamentoFinanceiroView() + { + ViewModel = new FechamentoFinanceiroViewModel(); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + } + + private void ContentLoad() + { + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Expected O, but got Unknown + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Expected O, but got Unknown + //IL_0052: Unknown result type (might be due to invalid IL or missing references) + //IL_005c: Expected O, but got Unknown + //IL_0069: Unknown result type (might be due to invalid IL or missing references) + //IL_0073: Expected O, but got Unknown + ((UIElement)InicioBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)InicioBox).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + InicioBox.SelectedDateChanged += Periodo_OnSelectedDateChanged; + ((UIElement)FimBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)FimBox).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + FimBox.SelectedDateChanged += Periodo_OnSelectedDateChanged; + } + + private void Periodo_OnSelectedDateChanged(object sender, SelectionChangedEventArgs e) + { + ViewModel.Fechamento = new List<FechamentoFinanceiro>(); + ViewModel.HtmlContent = string.Empty; + WebEditor.Initialize(""); + } + + private async void GerarResultados_OnClick(object sender, RoutedEventArgs e) + { + InicioBox.Text = ValidationHelper.FormatDate(InicioBox.Text); + FimBox.Text = ValidationHelper.FormatDate(FimBox.Text); + try + { + ViewModel.Inicio = Convert.ToDateTime(InicioBox.Text); + ViewModel.Fim = Convert.ToDateTime(FimBox.Text); + } + catch (Exception) + { + return; + } + if (ViewModel.Inicio > ViewModel.Fim) + { + await ViewModel.ShowMessage("A DATA FINAL NÃO PODE SER MENOR QUE A DATA INICIAL DO FILTRO."); + return; + } + ((UIElement)ProgressRing).Visibility = (Visibility)0; + ViewModel.IsEnabled = false; + ViewModel.HtmlContent = string.Empty; + ViewModel.Fechamento = new List<FechamentoFinanceiro>(); + await ViewModel.GerarRelatorio(); + if (ViewModel.HtmlContent == string.Empty) + { + ((UIElement)NaoHaDados).Visibility = (Visibility)0; + ViewModel.IsEnabled = true; + ((UIElement)ProgressRing).Visibility = (Visibility)2; + } + WebEditor.Initialize(ViewModel.HtmlContent); + ((UIElement)NaoHaDados).Visibility = (Visibility)2; + ViewModel.IsEnabled = true; + ((UIElement)ProgressRing).Visibility = (Visibility)2; + } + + private async void Imprimir_OnClick(object sender, RoutedEventArgs e) + { + ((UIElement)ProgressRing).Visibility = (Visibility)0; + ViewModel.IsEnabled = false; + await ViewModel.Print(); + ((UIElement)ProgressRing).Visibility = (Visibility)2; + ViewModel.IsEnabled = true; + } + + private async void ExportarExcel_OnClick(object sender, RoutedEventArgs e) + { + ((UIElement)ProgressRing).Visibility = (Visibility)0; + ViewModel.IsEnabled = false; + await ViewModel.GerarExcel(); + ((UIElement)ProgressRing).Visibility = (Visibility)2; + ViewModel.IsEnabled = true; + } + + private void CheckBox_Checked(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + switch (((FrameworkElement)(CheckBox)sender).Name) + { + default: + ViewModel.Plano.ForEach(delegate(Plano x) + { + x.Selecionado = !x.Selecionado; + }); + ViewModel.Plano = new List<Plano>(ViewModel.Plano); + break; + case "GridPlanos": + ViewModel.Planos.ForEach(delegate(Planos x) + { + x.Selecionado = !x.Selecionado; + }); + ViewModel.Planos = new List<Planos>(ViewModel.Planos); + break; + case "GridCentro": + ViewModel.Centro.ForEach(delegate(Centro x) + { + x.Selecionado = !x.Selecionado; + }); + ViewModel.Centro = new List<Centro>(ViewModel.Centro); + break; + case "GridConta": + ViewModel.Conta.ForEach(delegate(BancosContas x) + { + x.Selecionado = !x.Selecionado; + }); + ViewModel.Conta = new List<BancosContas>(ViewModel.Conta); + break; + } + } + + private void Filtros_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.IsExpanded = !ViewModel.IsExpanded; + } + + private void Fechar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.IsExpanded = !ViewModel.IsExpanded; + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/financeiro/relatorios/fechamentofinanceiroview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0037: Unknown result type (might be due to invalid IL or missing references) + //IL_0041: Expected O, but got Unknown + //IL_0044: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Expected O, but got Unknown + //IL_005b: Unknown result type (might be due to invalid IL or missing references) + //IL_0065: Expected O, but got Unknown + //IL_0072: Unknown result type (might be due to invalid IL or missing references) + //IL_007c: Expected O, but got Unknown + //IL_007f: Unknown result type (might be due to invalid IL or missing references) + //IL_0089: Expected O, but got Unknown + //IL_0096: Unknown result type (might be due to invalid IL or missing references) + //IL_00a0: Expected O, but got Unknown + //IL_00ad: Unknown result type (might be due to invalid IL or missing references) + //IL_00b7: Expected O, but got Unknown + //IL_00b9: Unknown result type (might be due to invalid IL or missing references) + //IL_00c5: Unknown result type (might be due to invalid IL or missing references) + //IL_00cf: Expected O, but got Unknown + //IL_00d1: Unknown result type (might be due to invalid IL or missing references) + //IL_00dd: Unknown result type (might be due to invalid IL or missing references) + //IL_00e7: Expected O, but got Unknown + //IL_00e9: Unknown result type (might be due to invalid IL or missing references) + //IL_00f5: Unknown result type (might be due to invalid IL or missing references) + //IL_00ff: Expected O, but got Unknown + //IL_0101: Unknown result type (might be due to invalid IL or missing references) + //IL_010d: Unknown result type (might be due to invalid IL or missing references) + //IL_0117: Expected O, but got Unknown + //IL_0127: Unknown result type (might be due to invalid IL or missing references) + //IL_0131: Expected O, but got Unknown + //IL_0133: Unknown result type (might be due to invalid IL or missing references) + //IL_013f: Unknown result type (might be due to invalid IL or missing references) + //IL_0149: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ProgressRing = (ProgressBar)target; + break; + case 2: + InicioBox = (DatePicker)target; + ((UIElement)InicioBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((Control)InicioBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 3: + FimBox = (DatePicker)target; + ((UIElement)FimBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((Control)FimBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 4: + ((MenuItem)target).Click += new RoutedEventHandler(GerarResultados_OnClick); + break; + case 5: + ((MenuItem)target).Click += new RoutedEventHandler(Filtros_OnClick); + break; + case 6: + ((MenuItem)target).Click += new RoutedEventHandler(Imprimir_OnClick); + break; + case 7: + ((MenuItem)target).Click += new RoutedEventHandler(ExportarExcel_OnClick); + break; + case 8: + WebEditor = (WebEditor)target; + break; + case 9: + NaoHaDados = (TextBlock)target; + break; + case 10: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Fechar_OnClick); + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_001b: Unknown result type (might be due to invalid IL or missing references) + //IL_0027: Unknown result type (might be due to invalid IL or missing references) + //IL_0031: Expected O, but got Unknown + //IL_0032: Unknown result type (might be due to invalid IL or missing references) + //IL_003e: Unknown result type (might be due to invalid IL or missing references) + //IL_0048: Expected O, but got Unknown + //IL_004a: Unknown result type (might be due to invalid IL or missing references) + //IL_0056: Unknown result type (might be due to invalid IL or missing references) + //IL_0060: Expected O, but got Unknown + //IL_0061: Unknown result type (might be due to invalid IL or missing references) + //IL_006d: Unknown result type (might be due to invalid IL or missing references) + //IL_0077: Expected O, but got Unknown + //IL_0079: Unknown result type (might be due to invalid IL or missing references) + //IL_0085: Unknown result type (might be due to invalid IL or missing references) + //IL_008f: Expected O, but got Unknown + //IL_0090: Unknown result type (might be due to invalid IL or missing references) + //IL_009c: Unknown result type (might be due to invalid IL or missing references) + //IL_00a6: Expected O, but got Unknown + //IL_00a8: Unknown result type (might be due to invalid IL or missing references) + //IL_00b4: Unknown result type (might be due to invalid IL or missing references) + //IL_00be: Expected O, but got Unknown + //IL_00bf: Unknown result type (might be due to invalid IL or missing references) + //IL_00cb: Unknown result type (might be due to invalid IL or missing references) + //IL_00d5: Expected O, but got Unknown + switch (connectionId) + { + case 11: + ((ToggleButton)(CheckBox)target).Checked += new RoutedEventHandler(CheckBox_Checked); + ((ToggleButton)(CheckBox)target).Unchecked += new RoutedEventHandler(CheckBox_Checked); + break; + case 12: + ((ToggleButton)(CheckBox)target).Checked += new RoutedEventHandler(CheckBox_Checked); + ((ToggleButton)(CheckBox)target).Unchecked += new RoutedEventHandler(CheckBox_Checked); + break; + case 13: + ((ToggleButton)(CheckBox)target).Checked += new RoutedEventHandler(CheckBox_Checked); + ((ToggleButton)(CheckBox)target).Unchecked += new RoutedEventHandler(CheckBox_Checked); + break; + case 14: + ((ToggleButton)(CheckBox)target).Checked += new RoutedEventHandler(CheckBox_Checked); + ((ToggleButton)(CheckBox)target).Unchecked += new RoutedEventHandler(CheckBox_Checked); + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Financeiro/BancosContasView.cs b/Decompiler/Gestor.Application.Views.Financeiro/BancosContasView.cs new file mode 100644 index 0000000..04f388a --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Financeiro/BancosContasView.cs @@ -0,0 +1,411 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Threading; +using CurrencyTextBoxControl; +using Gestor.Application.Helpers; +using Gestor.Application.ViewModels.Financeiro; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Financeiro; +using Gestor.Model.Domain.Generic; + +namespace Gestor.Application.Views.Financeiro; + +public class BancosContasView : BaseUserControl, IComponentConnector, IStyleConnector +{ + [Serializable] + [CompilerGenerated] + private sealed class _003C_003Ec + { + public static readonly _003C_003Ec _003C_003E9 = new _003C_003Ec(); + + public static MouseButtonEventHandler _003C_003E9__5_0; + + internal void _003CContentLoad_003Eb__5_0(object sender, MouseButtonEventArgs args) + { + } + } + + internal DataGrid BancosContasGrid; + + internal AutoCompleteBox AutoCompleteBanco; + + internal CurrencyTextBox ValorSaldoBox; + + private bool _contentLoaded; + + public BancosContasViewModel ViewModel { get; set; } + + public BancosContasView() + { + ((FrameworkElement)this).Tag = "BANCOS E CONTAS"; + ViewModel = new BancosContasViewModel(); + ((FrameworkElement)this).DataContext = ViewModel; + ViewModel.Alterar(alterar: false); + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + } + + private void ContentLoad() + { + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_0023: Expected O, but got Unknown + //IL_003d: Unknown result type (might be due to invalid IL or missing references) + //IL_0042: Unknown result type (might be due to invalid IL or missing references) + //IL_0048: Expected O, but got Unknown + ((Selector)BancosContasGrid).SelectedIndex = 0; + ((Selector)BancosContasGrid).SelectionChanged += new SelectionChangedEventHandler(BancosContasGrid_OnSelectionChanged); + DataGrid bancosContasGrid = BancosContasGrid; + object obj = _003C_003Ec._003C_003E9__5_0; + if (obj == null) + { + MouseButtonEventHandler val = delegate + { + }; + _003C_003Ec._003C_003E9__5_0 = val; + obj = (object)val; + } + ((Control)bancosContasGrid).MouseDoubleClick += (MouseButtonEventHandler)obj; + } + + private void Incluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Incluir(); + AutoCompleteBanco.Text = ""; + List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedBancosContas.Validate(); + ((DependencyObject)(object)this).ValidateFields(errorMessages); + } + + private void Cancelar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.CancelarAlteracao(); + } + + private async void Salvar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(); + ((DependencyObject)(object)this).ValidateFields(list); + bool num = list == null || list.Count == 0; + ViewModel.Loading(isLoading: false); + if (!num) + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + } + + private void Excluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Excluir(); + } + + private void Alterar_OnClick(object sender, RoutedEventArgs e) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Expected O, but got Unknown + ViewModel.CancelBancosContas = (BancosContas)((DomainBase)ViewModel.SelectedBancosContas).Clone(); + ViewModel.Alterar(alterar: true); + ((DomainBase)ViewModel.SelectedBancosContas).Initialize(); + } + + private void InfoExtrato_OnClick(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Expected O, but got Unknown + Button val = (Button)sender; + if (val != null && ((FrameworkElement)val).DataContext != null) + { + ((Window)new HosterWindow((ContentControl)(object)new InfoExtratoView((Saldo)((FrameworkElement)val).DataContext, telaBancos: true), "INFORMAÇÕES DO EXTRATO", 800.0, 450.0)).ShowDialog(); + ViewModel.Loading(isLoading: true); + ViewModel.CarregarSaldos(ViewModel.SelectedBancosContas); + ViewModel.Loading(isLoading: false); + } + } + + private void AutoCompleteBancoBox_Populating(object sender, PopulatingEventArgs e) + { + if (e.Parameter.Length < 3) + { + return; + } + e.Cancel = true; + ViewModel.BuscarBanco(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Banco>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void AutoCompleteBancosContasBox_Populating(object sender, PopulatingEventArgs e) + { + if (e.Parameter.Length < 3) + { + return; + } + e.Cancel = true; + ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<BancosContas>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void AutoCompleteBox_OnTextChanged(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + if (string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).Text)) + { + ViewModel.FiltrarBancosContas(""); + } + } + + private void BancosContasGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_0031: Unknown result type (might be due to invalid IL or missing references) + //IL_003b: Expected O, but got Unknown + DataGrid val = (DataGrid)sender; + if (val == null || ((Selector)val).SelectedIndex >= 0) + { + ViewModel.SelectedBancosContas = (BancosContas)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null); + } + } + + private void ExcluirSaldo_OnClick(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Expected O, but got Unknown + //IL_0023: Unknown result type (might be due to invalid IL or missing references) + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0039: Expected O, but got Unknown + ((MenuItem)sender).Click -= new RoutedEventHandler(ExcluirSaldo_OnClick); + ViewModel.ExcluirSaldo(); + ((MenuItem)sender).Click += new RoutedEventHandler(ExcluirSaldo_OnClick); + } + + private async void FecharSaldo_OnClick(object sender, RoutedEventArgs e) + { + if (!ViewModel.SelectedSaldo.DataFinal.HasValue) + { + await ViewModel.ShowMessage("NECESSÁRIO PREENCHER A DATA DE FECHAMENTO."); + return; + } + if (ViewModel.SelectedSaldo.DataInicio >= ViewModel.SelectedSaldo.DataFinal.Value) + { + await ViewModel.ShowMessage("A DATA DE FECHAMENTO DEVE SER MAIOR QUE A DATA DE ABERTURA DO SALDO."); + return; + } + DateTime value = ViewModel.SelectedSaldo.DataFinal.Value; + DateTime? dataInicio = ViewModel.SelectedSaldo.DataInicio; + TimeSpan? timeSpan = value - dataInicio; + bool flag = timeSpan.HasValue && (timeSpan.Value.TotalDays < 28.0 || timeSpan.Value.TotalDays > 31.0); + if (flag) + { + flag = !(await ViewModel.ShowMessage("O INTERVALO DE FECHAMENTO É RECOMENDADO 1 MÊS. DESEJA CONTINUAR?", "SIM", "NÃO")); + } + if (!flag) + { + ViewModel.Loading(isLoading: true); + await ViewModel.FecharSaldo(); + ViewModel.Loading(isLoading: false); + } + } + + private async void FechamentoBox_OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) + { + DatePicker val = (DatePicker)sender; + val.Text = ValidationHelper.FormatDate(val.Text); + if (DateTime.TryParse(val.Text, out var _)) + { + CurrencyTextBox valorSaldoBox = ValorSaldoBox; + valorSaldoBox.Number = await ViewModel.CalcularValor(); + } + } + + private void AbrirLog_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLog((TipoTela)26, ((DomainBase)ViewModel.SelectedBancosContas).Id); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/financeiro/bancoscontasview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0046: Unknown result type (might be due to invalid IL or missing references) + //IL_0052: Unknown result type (might be due to invalid IL or missing references) + //IL_005c: Expected O, but got Unknown + //IL_005d: Unknown result type (might be due to invalid IL or missing references) + //IL_0069: Unknown result type (might be due to invalid IL or missing references) + //IL_0073: Expected O, but got Unknown + //IL_0076: Unknown result type (might be due to invalid IL or missing references) + //IL_0080: Expected O, but got Unknown + //IL_0082: Unknown result type (might be due to invalid IL or missing references) + //IL_008e: Unknown result type (might be due to invalid IL or missing references) + //IL_0098: Expected O, but got Unknown + //IL_009a: Unknown result type (might be due to invalid IL or missing references) + //IL_00a6: Unknown result type (might be due to invalid IL or missing references) + //IL_00b0: Expected O, but got Unknown + //IL_00b2: Unknown result type (might be due to invalid IL or missing references) + //IL_00be: Unknown result type (might be due to invalid IL or missing references) + //IL_00c8: Expected O, but got Unknown + //IL_00ca: Unknown result type (might be due to invalid IL or missing references) + //IL_00d6: Unknown result type (might be due to invalid IL or missing references) + //IL_00e0: Expected O, but got Unknown + //IL_00e2: Unknown result type (might be due to invalid IL or missing references) + //IL_00ee: Unknown result type (might be due to invalid IL or missing references) + //IL_00f8: Expected O, but got Unknown + //IL_00fa: Unknown result type (might be due to invalid IL or missing references) + //IL_0106: Unknown result type (might be due to invalid IL or missing references) + //IL_0110: Expected O, but got Unknown + //IL_0113: Unknown result type (might be due to invalid IL or missing references) + //IL_011d: Expected O, but got Unknown + //IL_012a: Unknown result type (might be due to invalid IL or missing references) + //IL_0134: Expected O, but got Unknown + //IL_0136: Unknown result type (might be due to invalid IL or missing references) + //IL_0142: Unknown result type (might be due to invalid IL or missing references) + //IL_014c: Expected O, but got Unknown + //IL_014d: Unknown result type (might be due to invalid IL or missing references) + //IL_0159: Unknown result type (might be due to invalid IL or missing references) + //IL_0163: Expected O, but got Unknown + //IL_0164: Unknown result type (might be due to invalid IL or missing references) + //IL_0170: Unknown result type (might be due to invalid IL or missing references) + //IL_017a: Expected O, but got Unknown + //IL_017c: Unknown result type (might be due to invalid IL or missing references) + //IL_0188: Unknown result type (might be due to invalid IL or missing references) + //IL_0192: Expected O, but got Unknown + //IL_0193: Unknown result type (might be due to invalid IL or missing references) + //IL_019f: Unknown result type (might be due to invalid IL or missing references) + //IL_01a9: Expected O, but got Unknown + //IL_01aa: Unknown result type (might be due to invalid IL or missing references) + //IL_01b6: Unknown result type (might be due to invalid IL or missing references) + //IL_01c0: Expected O, but got Unknown + //IL_01c3: Unknown result type (might be due to invalid IL or missing references) + //IL_01cd: Expected O, but got Unknown + //IL_01cf: Unknown result type (might be due to invalid IL or missing references) + //IL_01db: Unknown result type (might be due to invalid IL or missing references) + //IL_01e5: Expected O, but got Unknown + //IL_01e7: Unknown result type (might be due to invalid IL or missing references) + //IL_01f3: Unknown result type (might be due to invalid IL or missing references) + //IL_01fd: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBancosContasBox_Populating); + ((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBox_OnTextChanged); + break; + case 2: + BancosContasGrid = (DataGrid)target; + break; + case 3: + ((MenuItem)target).Click += new RoutedEventHandler(Incluir_OnClick); + break; + case 4: + ((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick); + break; + case 5: + ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick); + break; + case 6: + ((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick); + break; + case 7: + ((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick); + break; + case 8: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick); + break; + case 9: + AutoCompleteBanco = (AutoCompleteBox)target; + AutoCompleteBanco.Populating += new PopulatingEventHandler(AutoCompleteBancoBox_Populating); + break; + case 10: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + break; + case 11: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(FechamentoBox_OnLostKeyboardFocus); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + break; + case 12: + ValorSaldoBox = (CurrencyTextBox)target; + break; + case 13: + ((MenuItem)target).Click += new RoutedEventHandler(FecharSaldo_OnClick); + break; + case 14: + ((MenuItem)target).Click += new RoutedEventHandler(ExcluirSaldo_OnClick); + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Unknown result type (might be due to invalid IL or missing references) + //IL_001c: Expected O, but got Unknown + if (connectionId == 15) + { + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(InfoExtrato_OnClick); + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Financeiro/CentroDeCustoView.cs b/Decompiler/Gestor.Application.Views.Financeiro/CentroDeCustoView.cs new file mode 100644 index 0000000..8b21f29 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Financeiro/CentroDeCustoView.cs @@ -0,0 +1,237 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Threading; +using Gestor.Application.Helpers; +using Gestor.Application.ViewModels.Financeiro; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Financeiro; +using Gestor.Model.Domain.Generic; + +namespace Gestor.Application.Views.Financeiro; + +public class CentroDeCustoView : UserControl, IComponentConnector +{ + [Serializable] + [CompilerGenerated] + private sealed class _003C_003Ec + { + public static readonly _003C_003Ec _003C_003E9 = new _003C_003Ec(); + + public static MouseButtonEventHandler _003C_003E9__5_0; + + internal void _003CContentLoad_003Eb__5_0(object sender, MouseButtonEventArgs args) + { + } + } + + private bool _seleciona = true; + + internal DataGrid CentroDeCustoGrid; + + private bool _contentLoaded; + + private CentroDeCustoViewmodel ViewModel { get; } + + public CentroDeCustoView() + { + ((FrameworkElement)this).Tag = "CENTRO DE CUSTO"; + ViewModel = new CentroDeCustoViewmodel(); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + } + + private void ContentLoad() + { + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_0023: Expected O, but got Unknown + //IL_003d: Unknown result type (might be due to invalid IL or missing references) + //IL_0042: Unknown result type (might be due to invalid IL or missing references) + //IL_0048: Expected O, but got Unknown + ((Selector)CentroDeCustoGrid).SelectedIndex = 0; + ((Selector)CentroDeCustoGrid).SelectionChanged += new SelectionChangedEventHandler(CentroDeCustoGrid_OnSelectionChanged); + DataGrid centroDeCustoGrid = CentroDeCustoGrid; + object obj = _003C_003Ec._003C_003E9__5_0; + if (obj == null) + { + MouseButtonEventHandler val = delegate + { + }; + _003C_003Ec._003C_003E9__5_0 = val; + obj = (object)val; + } + ((Control)centroDeCustoGrid).MouseDoubleClick += (MouseButtonEventHandler)obj; + } + + private void CentroDeCustoGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_000a: Unknown result type (might be due to invalid IL or missing references) + //IL_0010: Expected O, but got Unknown + //IL_003a: Unknown result type (might be due to invalid IL or missing references) + //IL_0044: Expected O, but got Unknown + if (_seleciona) + { + DataGrid val = (DataGrid)sender; + if (val == null || ((Selector)val).SelectedIndex >= 0) + { + ViewModel.SelecionaCentroDeCusto((Centro)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null)); + } + } + } + + private void Cancelar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.CancelarAlteracao(); + } + + private async void Salvar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(); + ((DependencyObject)(object)this).ValidateFields(list); + bool num = list == null || list.Count == 0; + ViewModel.Loading(isLoading: false); + if (!num) + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + } + + private void Alterar_OnClick(object sender, RoutedEventArgs e) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Expected O, but got Unknown + ViewModel.CancelCentro = (Centro)((DomainBase)ViewModel.SelectedCentro).Clone(); + ViewModel.Alterar(alterar: true); + ((DomainBase)ViewModel.SelectedCentro).Initialize(); + } + + private void Incluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Incluir(); + List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedCentro.Validate(); + ((DependencyObject)(object)this).ValidateFields(errorMessages); + } + + private void AutoCompleteBox_OnTextChanged(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + if (string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).Text)) + { + ViewModel.FiltrarCentro(""); + } + } + + private void AutoCompleteBoxCentro_Populating(object sender, PopulatingEventArgs e) + { + e.Cancel = true; + ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Centro>> searchResult) + { + //IL_000a: Unknown result type (might be due to invalid IL or missing references) + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + if (searchResult != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void AbrirLog_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLog((TipoTela)29, ((DomainBase)ViewModel.SelectedCentro).Id); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/financeiro/centrodecustoview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_002a: Unknown result type (might be due to invalid IL or missing references) + //IL_0036: Unknown result type (might be due to invalid IL or missing references) + //IL_0040: Expected O, but got Unknown + //IL_0041: Unknown result type (might be due to invalid IL or missing references) + //IL_004d: Unknown result type (might be due to invalid IL or missing references) + //IL_0057: Expected O, but got Unknown + //IL_005a: Unknown result type (might be due to invalid IL or missing references) + //IL_0064: Expected O, but got Unknown + //IL_0066: Unknown result type (might be due to invalid IL or missing references) + //IL_0072: Unknown result type (might be due to invalid IL or missing references) + //IL_007c: Expected O, but got Unknown + //IL_007e: Unknown result type (might be due to invalid IL or missing references) + //IL_008a: Unknown result type (might be due to invalid IL or missing references) + //IL_0094: Expected O, but got Unknown + //IL_0096: Unknown result type (might be due to invalid IL or missing references) + //IL_00a2: Unknown result type (might be due to invalid IL or missing references) + //IL_00ac: Expected O, but got Unknown + //IL_00ae: Unknown result type (might be due to invalid IL or missing references) + //IL_00ba: Unknown result type (might be due to invalid IL or missing references) + //IL_00c4: Expected O, but got Unknown + //IL_00c6: Unknown result type (might be due to invalid IL or missing references) + //IL_00d2: Unknown result type (might be due to invalid IL or missing references) + //IL_00dc: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBoxCentro_Populating); + ((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBox_OnTextChanged); + break; + case 2: + CentroDeCustoGrid = (DataGrid)target; + break; + case 3: + ((MenuItem)target).Click += new RoutedEventHandler(Incluir_OnClick); + break; + case 4: + ((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick); + break; + case 5: + ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick); + break; + case 6: + ((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick); + break; + case 7: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick); + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Financeiro/ExtratoWindow.cs b/Decompiler/Gestor.Application.Views.Financeiro/ExtratoWindow.cs new file mode 100644 index 0000000..15ac4d9 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Financeiro/ExtratoWindow.cs @@ -0,0 +1,562 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Runtime.InteropServices; +using System.Threading; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Forms; +using System.Windows.Input; +using System.Windows.Interop; +using System.Windows.Markup; +using System.Windows.Media; +using System.Windows.Shapes; +using System.Windows.Shell; +using System.Windows.Threading; +using Gestor.Application.Helpers; +using Gestor.Application.ViewModels.Financeiro; +using Gestor.Common.Validation; +using MaterialDesignThemes.Wpf; + +namespace Gestor.Application.Views.Financeiro; + +public class ExtratoWindow : Window, IComponentConnector +{ + private enum MonitorOptions : uint + { + MonitorDefaulttoprimary = 1u, + MonitorDefaulttonearest + } + + public struct Point + { + public int X; + + public int Y; + + public Point(int x, int y) + { + X = x; + Y = y; + } + } + + private struct Minmaxinfo + { + private readonly MainWindow.Point ptReserved; + + public Point ptMaxSize; + + public Point ptMaxPosition; + + private readonly MainWindow.Point ptMinTrackSize; + + private readonly MainWindow.Point ptMaxTrackSize; + } + + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] + private class Monitorinfo + { + private readonly int cbSize = Marshal.SizeOf(typeof(Monitorinfo)); + + public readonly Rect rcMonitor; + + public readonly Rect rcWork; + + private readonly int dwFlags; + } + + public struct Rect + { + public int Left; + + public int Top; + + public int Right; + + public int Bottom; + } + + private bool _buttonClickable; + + public ExtratoContaViewModel ViewModel; + + internal WindowChrome WindowChrome; + + internal Grid MinimizeButton; + + internal Grid MaximizeButton; + + internal Grid CloseButton; + + internal ProgressBar ProgressRing; + + internal ComboBox ContaBox; + + internal DatePicker InicioBox; + + internal DatePicker FimBox; + + internal DataGrid LancamentoGrid; + + internal TextBlock NaoHaDados; + + internal Snackbar Snackbar; + + private bool _contentLoaded; + + private IntPtr WindowProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) + { + if (msg == 36) + { + WmGetMinMaxInfo(lParam); + } + return IntPtr.Zero; + } + + private void WmGetMinMaxInfo(IntPtr lParam) + { + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + ((FrameworkElement)this).MaxHeight = Screen.FromHandle(new WindowInteropHelper((Window)(object)this).Handle).WorkingArea.Height; + GetCursorPos(out var lpPoint); + IntPtr hMonitor = MonitorFromPoint(new MainWindow.Point(0, 0), MonitorOptions.MonitorDefaulttoprimary); + Monitorinfo monitorinfo = new Monitorinfo(); + if (GetMonitorInfo(hMonitor, monitorinfo)) + { + IntPtr intPtr = MonitorFromPoint(lpPoint, MonitorOptions.MonitorDefaulttonearest); + Minmaxinfo structure = (Minmaxinfo)Marshal.PtrToStructure(lParam, typeof(Minmaxinfo)); + if (hMonitor.Equals((object?)(nint)intPtr)) + { + structure.ptMaxPosition.X = monitorinfo.rcWork.Left; + structure.ptMaxPosition.Y = monitorinfo.rcWork.Top; + structure.ptMaxSize.X = monitorinfo.rcWork.Right - monitorinfo.rcWork.Left; + structure.ptMaxSize.Y = monitorinfo.rcWork.Bottom - monitorinfo.rcWork.Top; + } + else + { + structure.ptMaxPosition.X = monitorinfo.rcMonitor.Left; + structure.ptMaxPosition.Y = monitorinfo.rcMonitor.Top; + structure.ptMaxSize.X = monitorinfo.rcMonitor.Right - monitorinfo.rcMonitor.Left; + structure.ptMaxSize.Y = monitorinfo.rcMonitor.Bottom - monitorinfo.rcMonitor.Top; + } + Marshal.StructureToPtr(structure, lParam, fDeleteOld: true); + } + } + + [DllImport("user32.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + private static extern bool GetCursorPos(out MainWindow.Point lpPoint); + + [DllImport("user32.dll", SetLastError = true)] + private static extern IntPtr MonitorFromPoint(MainWindow.Point pt, MonitorOptions dwFlags); + + [DllImport("user32.dll")] + private static extern bool GetMonitorInfo(IntPtr hMonitor, Monitorinfo lpmi); + + private void TopControls_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + //IL_0008: Unknown result type (might be due to invalid IL or missing references) + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + //IL_0030: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_003f: Expected O, but got Unknown + _buttonClickable = true; + ((Panel)(Grid)sender).Background = (Brush)((((FrameworkElement)(Grid)sender).Name == "CloseButton") ? new SolidColorBrush(Colors.Red) : new SolidColorBrush(Colors.DimGray)); + } + + private void TopControls_OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + if (_buttonClickable) + { + ((object)this).GetType().GetMethod(((FrameworkElement)(Grid)sender).Name + "_Click")?.Invoke(this, null); + } + } + + private static void TopControls_OnMouseEnter(object sender, MouseEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Unknown result type (might be due to invalid IL or missing references) + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_001d: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Unknown result type (might be due to invalid IL or missing references) + //IL_0038: Expected O, but got Unknown + //IL_0039: Unknown result type (might be due to invalid IL or missing references) + //IL_0044: Expected O, but got Unknown + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_0053: Unknown result type (might be due to invalid IL or missing references) + //IL_005d: Expected O, but got Unknown + ((Panel)(Grid)sender).Background = (Brush)((((FrameworkElement)(Grid)sender).Name == "CloseButton") ? new SolidColorBrush(Colors.IndianRed) : new SolidColorBrush(Colors.Gray)); + DependencyObject child = VisualTreeHelper.GetChild((DependencyObject)(Grid)sender, 0); + Path val = (Path)(object)((child is Path) ? child : null); + if (val != null) + { + ((Shape)val).Stroke = (Brush)new SolidColorBrush(Colors.White); + } + } + + private void TopControls_OnMouseLeave(object sender, MouseEventArgs e) + { + //IL_0008: Unknown result type (might be due to invalid IL or missing references) + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Unknown result type (might be due to invalid IL or missing references) + //IL_001c: Expected O, but got Unknown + //IL_001d: Unknown result type (might be due to invalid IL or missing references) + //IL_0028: Expected O, but got Unknown + //IL_0032: Unknown result type (might be due to invalid IL or missing references) + //IL_0037: Unknown result type (might be due to invalid IL or missing references) + //IL_0041: Expected O, but got Unknown + _buttonClickable = false; + ((Panel)(Grid)sender).Background = (Brush)new SolidColorBrush(Colors.Transparent); + DependencyObject child = VisualTreeHelper.GetChild((DependencyObject)(Grid)sender, 0); + Path val = (Path)(object)((child is Path) ? child : null); + if (val != null) + { + ((Shape)val).Stroke = (Brush)new SolidColorBrush(Colors.White); + } + } + + public void MinimizeButton_Click() + { + ((Window)this).WindowState = (WindowState)1; + } + + public void MaximizeButton_Click() + { + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + ((Window)this).WindowState = (WindowState)(((int)((Window)this).WindowState == 0) ? 2 : 0); + } + + public void CloseButton_Click() + { + ((Window)this).Close(); + } + + protected sealed override void OnStateChanged(EventArgs e) + { + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + //IL_0008: Invalid comparison between Unknown and I4 + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + //IL_0025: Invalid comparison between Unknown and I4 + //IL_002c: Unknown result type (might be due to invalid IL or missing references) + //IL_003d: Unknown result type (might be due to invalid IL or missing references) + //IL_0043: Invalid comparison between Unknown and I4 + //IL_0058: Unknown result type (might be due to invalid IL or missing references) + //IL_005e: Invalid comparison between Unknown and I4 + ((Control)this).BorderThickness = new Thickness((double)(((int)((Window)this).WindowState != 2) ? 1 : 0)); + WindowChrome.ResizeBorderThickness = new Thickness((double)(((int)((Window)this).WindowState != 2) ? 4 : 0)); + WindowChrome.CaptionHeight = (((int)((Window)this).WindowState == 2) ? 33 : 30); + ViewModel.MaximizeRestore = (((int)((Window)this).WindowState == 2) ? Geometry.Parse((string)Application.Current.Resources[(object)"Restore"]) : Geometry.Parse((string)Application.Current.Resources[(object)"Maximize"])); + ((Window)this).OnStateChanged(e); + } + + public ExtratoWindow(long id = 0L) + { + ViewModel = new ExtratoContaViewModel(id); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + string text = ApplicationHelper.Versao.ToString(); + ViewModel.Head = Recursos.Usuario.Nome + " - " + Recursos.Empresa.Nome + ", VOCÊ ESTÁ EM RELATÓRIOS DE CONTA CORRENTE | VERSÃO GESTOR " + text; + } + + private void ContentLoad() + { + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Expected O, but got Unknown + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Expected O, but got Unknown + //IL_003b: Unknown result type (might be due to invalid IL or missing references) + //IL_0045: Expected O, but got Unknown + //IL_0052: Unknown result type (might be due to invalid IL or missing references) + //IL_005c: Expected O, but got Unknown + //IL_0069: Unknown result type (might be due to invalid IL or missing references) + //IL_0073: Expected O, but got Unknown + //IL_0080: Unknown result type (might be due to invalid IL or missing references) + //IL_008a: Expected O, but got Unknown + //IL_0097: Unknown result type (might be due to invalid IL or missing references) + //IL_00a1: Expected O, but got Unknown + //IL_00ae: Unknown result type (might be due to invalid IL or missing references) + //IL_00b8: Expected O, but got Unknown + //IL_00dc: Unknown result type (might be due to invalid IL or missing references) + //IL_00e6: Expected O, but got Unknown + //IL_00f3: Unknown result type (might be due to invalid IL or missing references) + //IL_00fd: Expected O, but got Unknown + ((UIElement)MinimizeButton).MouseEnter += new MouseEventHandler(TopControls_OnMouseEnter); + ((UIElement)MinimizeButton).MouseLeave += new MouseEventHandler(TopControls_OnMouseLeave); + ((UIElement)MaximizeButton).MouseEnter += new MouseEventHandler(TopControls_OnMouseEnter); + ((UIElement)MaximizeButton).MouseLeave += new MouseEventHandler(TopControls_OnMouseLeave); + ((UIElement)CloseButton).MouseEnter += new MouseEventHandler(TopControls_OnMouseEnter); + ((UIElement)CloseButton).MouseLeave += new MouseEventHandler(TopControls_OnMouseLeave); + ((UIElement)InicioBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(DatePicker_OnLostKeyboardFocus); + ((UIElement)InicioBox).PreviewKeyDown += new KeyEventHandler(DatePicker_PreviewKeyDown); + InicioBox.SelectedDateChanged += Periodo_OnSelectedDateChanged; + ((UIElement)FimBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(DatePicker_OnLostKeyboardFocus); + ((UIElement)FimBox).PreviewKeyDown += new KeyEventHandler(DatePicker_PreviewKeyDown); + FimBox.SelectedDateChanged += Periodo_OnSelectedDateChanged; + } + + private void Periodo_OnSelectedDateChanged(object sender, SelectionChangedEventArgs e) + { + ViewModel.LimparRelatorio(); + } + + private void Window_OnInitialized(object sender, EventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_0023: Unknown result type (might be due to invalid IL or missing references) + //IL_002d: Expected O, but got Unknown + WindowInteropHelper val = new WindowInteropHelper((Window)(object)this); + val.EnsureHandle(); + HwndSource obj = HwndSource.FromHwnd(val.Handle); + if (obj != null) + { + obj.AddHook(new HwndSourceHook(WindowProc)); + } + } + + private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e) + { + Snackbar.IsActive = false; + } + + public void ToggleSnackBar(string message, bool active = true) + { + ((ContentControl)Snackbar.Message).Content = message; + Snackbar.IsActive = active; + if (active) + { + Task.Factory.StartNew(CloseSlackBar); + } + } + + private void CloseSlackBar() + { + Thread.Sleep(3000); + Dispatcher dispatcher = ((DispatcherObject)App.ProgressRing).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)4, (Delegate)(Action)delegate + { + ToggleSnackBar("", active: false); + }); + } + } + + private void DatePicker_PreviewKeyDown(object sender, KeyEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Invalid comparison between Unknown and I4 + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + if ((int)e.Key == 6) + { + ((DatePicker)sender).Text = Funcoes.GetNetworkTime().Date.ToString("dd/MM/yyyy"); + } + } + + private void DatePicker_OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + DatePicker val = (DatePicker)sender; + val.Text = ValidationHelper.FormatDate(val.Text); + } + + private async void GerarResultados_OnClick(object sender, RoutedEventArgs e) + { + if (ValidationHelper.ValidateDate(ValidationHelper.FormatDate(InicioBox.Text))) + { + InicioBox.SelectedDate = DateTime.Parse(ValidationHelper.FormatDate(InicioBox.Text)); + } + if (ValidationHelper.ValidateDate(ValidationHelper.FormatDate(FimBox.Text))) + { + FimBox.SelectedDate = DateTime.Parse(ValidationHelper.FormatDate(FimBox.Text)); + } + if (!InicioBox.SelectedDate.HasValue || !FimBox.SelectedDate.HasValue) + { + await ViewModel.ShowMessage("NECESSÁRIO PREENCHER O PERIODO INICIAL E FINAL PARA O FILTRO."); + return; + } + if (InicioBox.SelectedDate > FimBox.SelectedDate) + { + await ViewModel.ShowMessage("A DATA FINAL NÃO PODE SER MENOR QUE A DATA INICIAL DO FILTRO."); + return; + } + ((UIElement)ProgressRing).Visibility = (Visibility)0; + ViewModel.IsEnabled = false; + await ViewModel.GerarRelatorio(); + ViewModel.IsEnabled = true; + ((UIElement)ProgressRing).Visibility = (Visibility)2; + } + + private async void Imprimir_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.Print(); + } + + private async void ExportarExcel_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.GerarExcel(); + } + + private void DataAtual_OnDoubleClick(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + ((DatePicker)sender).SelectedDate = Funcoes.GetNetworkTime().Date; + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/financeiro/extratowindow.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0067: Unknown result type (might be due to invalid IL or missing references) + //IL_0071: Expected O, but got Unknown + //IL_0074: Unknown result type (might be due to invalid IL or missing references) + //IL_007e: Expected O, but got Unknown + //IL_008b: Unknown result type (might be due to invalid IL or missing references) + //IL_0095: Expected O, but got Unknown + //IL_00a2: Unknown result type (might be due to invalid IL or missing references) + //IL_00ac: Expected O, but got Unknown + //IL_00af: Unknown result type (might be due to invalid IL or missing references) + //IL_00b9: Expected O, but got Unknown + //IL_00c6: Unknown result type (might be due to invalid IL or missing references) + //IL_00d0: Expected O, but got Unknown + //IL_00dd: Unknown result type (might be due to invalid IL or missing references) + //IL_00e7: Expected O, but got Unknown + //IL_00ea: Unknown result type (might be due to invalid IL or missing references) + //IL_00f4: Expected O, but got Unknown + //IL_0101: Unknown result type (might be due to invalid IL or missing references) + //IL_010b: Expected O, but got Unknown + //IL_0118: Unknown result type (might be due to invalid IL or missing references) + //IL_0122: Expected O, but got Unknown + //IL_0125: Unknown result type (might be due to invalid IL or missing references) + //IL_012f: Expected O, but got Unknown + //IL_0132: Unknown result type (might be due to invalid IL or missing references) + //IL_013c: Expected O, but got Unknown + //IL_013f: Unknown result type (might be due to invalid IL or missing references) + //IL_0149: Expected O, but got Unknown + //IL_0156: Unknown result type (might be due to invalid IL or missing references) + //IL_0160: Expected O, but got Unknown + //IL_016d: Unknown result type (might be due to invalid IL or missing references) + //IL_0177: Expected O, but got Unknown + //IL_017a: Unknown result type (might be due to invalid IL or missing references) + //IL_0184: Expected O, but got Unknown + //IL_0191: Unknown result type (might be due to invalid IL or missing references) + //IL_019b: Expected O, but got Unknown + //IL_01a8: Unknown result type (might be due to invalid IL or missing references) + //IL_01b2: Expected O, but got Unknown + //IL_01b4: Unknown result type (might be due to invalid IL or missing references) + //IL_01c0: Unknown result type (might be due to invalid IL or missing references) + //IL_01ca: Expected O, but got Unknown + //IL_01cc: Unknown result type (might be due to invalid IL or missing references) + //IL_01d8: Unknown result type (might be due to invalid IL or missing references) + //IL_01e2: Expected O, but got Unknown + //IL_01e4: Unknown result type (might be due to invalid IL or missing references) + //IL_01f0: Unknown result type (might be due to invalid IL or missing references) + //IL_01fa: Expected O, but got Unknown + //IL_01fd: Unknown result type (might be due to invalid IL or missing references) + //IL_0207: Expected O, but got Unknown + //IL_020a: Unknown result type (might be due to invalid IL or missing references) + //IL_0214: Expected O, but got Unknown + //IL_0217: Unknown result type (might be due to invalid IL or missing references) + //IL_0221: Expected O, but got Unknown + //IL_0223: Unknown result type (might be due to invalid IL or missing references) + //IL_022f: Unknown result type (might be due to invalid IL or missing references) + //IL_0239: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((FrameworkElement)(ExtratoWindow)target).Initialized += Window_OnInitialized; + break; + case 2: + WindowChrome = (WindowChrome)target; + break; + case 3: + MinimizeButton = (Grid)target; + ((UIElement)MinimizeButton).MouseLeftButtonDown += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonDown); + ((UIElement)MinimizeButton).MouseLeftButtonUp += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonUp); + break; + case 4: + MaximizeButton = (Grid)target; + ((UIElement)MaximizeButton).MouseLeftButtonDown += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonDown); + ((UIElement)MaximizeButton).MouseLeftButtonUp += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonUp); + break; + case 5: + CloseButton = (Grid)target; + ((UIElement)CloseButton).MouseLeftButtonDown += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonDown); + ((UIElement)CloseButton).MouseLeftButtonUp += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonUp); + break; + case 6: + ProgressRing = (ProgressBar)target; + break; + case 7: + ContaBox = (ComboBox)target; + break; + case 8: + InicioBox = (DatePicker)target; + ((UIElement)InicioBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(DatePicker_OnLostKeyboardFocus); + ((Control)InicioBox).MouseDoubleClick += new MouseButtonEventHandler(DataAtual_OnDoubleClick); + break; + case 9: + FimBox = (DatePicker)target; + ((UIElement)FimBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(DatePicker_OnLostKeyboardFocus); + ((Control)FimBox).MouseDoubleClick += new MouseButtonEventHandler(DataAtual_OnDoubleClick); + break; + case 10: + ((MenuItem)target).Click += new RoutedEventHandler(GerarResultados_OnClick); + break; + case 11: + ((MenuItem)target).Click += new RoutedEventHandler(Imprimir_OnClick); + break; + case 12: + ((MenuItem)target).Click += new RoutedEventHandler(ExportarExcel_OnClick); + break; + case 13: + LancamentoGrid = (DataGrid)target; + break; + case 14: + NaoHaDados = (TextBlock)target; + break; + case 15: + Snackbar = (Snackbar)target; + break; + case 16: + ((SnackbarMessage)target).ActionClick += new RoutedEventHandler(SnackbarMessage_ActionClick); + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Financeiro/FinanceiroView.cs b/Decompiler/Gestor.Application.Views.Financeiro/FinanceiroView.cs new file mode 100644 index 0000000..e2499cf --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Financeiro/FinanceiroView.cs @@ -0,0 +1,1548 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Data; +using System.Windows.Input; +using System.Windows.Markup; +using Gestor.Application.Actions; +using Gestor.Application.Drawers; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.ViewModels.Financeiro; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Financeiro; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Relatorios; +using MaterialDesignThemes.Wpf; +using Xceed.Wpf.AvalonDock.Controls; + +namespace Gestor.Application.Views.Financeiro; + +public class FinanceiroView : BaseUserControl, IComponentConnector, IStyleConnector +{ + private bool _selecionando; + + private List<ListSortDirection?> _sortDirections; + + private List<SortDescription> _sortDescriptions; + + internal AutoCompleteBox AutoCompleteFornecedor; + + internal MenuItem MenuFiltros; + + internal Grid GridFiltros; + + internal DataGrid LancamentoGrid; + + internal AutoCompleteBox AutoCompleteFornecedorInclusao; + + private bool _contentLoaded; + + public FinanceiroViewModel ViewModel { get; set; } + + private string OriginalValue { get; set; } + + private TipoPagamento? tipoPagamento { get; set; } + + public FinanceiroView() + { + ((FrameworkElement)this).Tag = "CONSULTA DE FINANÇAS"; + ViewModel = new FinanceiroViewModel(); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Gestor.Application.Actions.Actions.SortLancamentos = (Action)Delegate.Combine(Gestor.Application.Actions.Actions.SortLancamentos, new Action(SortLancamentos)); + Gestor.Application.Actions.Actions.SaveSortLancamentos = (Action)Delegate.Combine(Gestor.Application.Actions.Actions.SaveSortLancamentos, new Action(SaveSortLancamentos)); + } + + private async void Buscar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + await ViewModel.Buscar(); + ViewModel.Loading(isLoading: false); + } + + private void AutoCompleteFornecedor_OnPopulating(object sender, PopulatingEventArgs e) + { + if (e.Parameter.Length < 3) + { + return; + } + e.Cancel = true; + ViewModel.BuscarFornecedor(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Fornecedor>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void AutoCompleteFornecedorAtivo_OnPopulating(object sender, PopulatingEventArgs e) + { + if (e.Parameter.Length < 3) + { + return; + } + e.Cancel = true; + ViewModel.BuscarFornecedorAtivo(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Fornecedor>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void AutoCompleteLancamento_OnPopulating(object sender, PopulatingEventArgs e) + { + if (e.Parameter.Length < 3) + { + return; + } + e.Cancel = true; + ViewModel.FiltrarLancamento(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Lancamento>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void AutoCompleteLancamento_OnTextChanged(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + if (string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).Text)) + { + ViewModel.Filtrar(""); + } + } + + private void TipoFiltrosBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_0098: Unknown result type (might be due to invalid IL or missing references) + //IL_009d: Unknown result type (might be due to invalid IL or missing references) + //IL_009e: Unknown result type (might be due to invalid IL or missing references) + //IL_00a0: Unknown result type (might be due to invalid IL or missing references) + //IL_00ba: Expected I4, but got Unknown + ComboBox val = (ComboBox)sender; + if (val != null && ((Selector)val).SelectedItem != null) + { + ViewModel.IsvisibleStatus = (Visibility)0; + ViewModel.IsVisibleData = (Visibility)2; + ViewModel.IsVisibleFornecedor = (Visibility)2; + ViewModel.IsVisiblePersonalizado = (Visibility)2; + ViewModel.IsVisibleFiltros = (Visibility)0; + ViewModel.LimparFiltros(); + ViewModel.SelectedFornecedor = null; + if (AutoCompleteFornecedor != null) + { + AutoCompleteFornecedor.Text = string.Empty; + } + ViewModel.DropDownHeight = 0.0; + FiltroLancamento val2 = (FiltroLancamento)((Selector)val).SelectedItem; + switch (val2 - 1) + { + default: + ViewModel.IsVisibleData = (Visibility)0; + break; + case 0: + case 1: + ViewModel.IsvisibleStatus = (Visibility)2; + ViewModel.IsVisibleData = (Visibility)0; + break; + case 2: + ViewModel.IsVisibleFornecedor = (Visibility)0; + break; + case 4: + ViewModel.IsVisiblePersonalizado = (Visibility)0; + ViewModel.IsVisibleFiltros = (Visibility)2; + ((UIElement)GridFiltros).Visibility = (Visibility)2; + ((HeaderedItemsControl)MenuFiltros).Header = "MOSTRAR FILTROS"; + ViewModel.IsVisibleData = (Visibility)0; + ViewModel.DropDownHeight = 200.0; + break; + } + } + } + + private async void DataGrid_OnCellEditEnding(object sender, DataGridCellEditEndingEventArgs e) + { + if (!(e.EditingElement is TextBox)) + { + return; + } + FrameworkElement editingElement = e.EditingElement; + TextBox box = (TextBox)(object)((editingElement is TextBox) ? editingElement : null); + bool atualizar = true; + string stringFormat = e.Column.ClipboardContentBinding.StringFormat; + if (!(stringFormat == "d")) + { + if (!(stringFormat == "c")) + { + if (string.IsNullOrEmpty((box != null) ? box.Text : null)) + { + return; + } + switch (e.Column.SortMemberPath) + { + case "Documento": + if (box.Text.Length <= 50) + { + if (OriginalValue == box.Text) + { + break; + } + if (!(await ViewModel.ShowMessage("DESEJA REPLICAR PARA OS DEMAIS LANÇAMENTOS FILTRADOS?", "SIM", "NÃO"))) + { + atualizar = false; + } + foreach (Lancamento item in ((IEnumerable)((ItemsControl)LancamentoGrid).Items).Cast<Lancamento>()) + { + if (((DomainBase)item).Id == ((DomainBase)(Lancamento)((Selector)LancamentoGrid).SelectedItem).Id || atualizar) + { + item.Documento = box.Text; + } + } + ((CollectionView)((ItemsControl)LancamentoGrid).Items).Refresh(); + } + else + { + box.Text = string.Empty; + await ViewModel.ShowMessage("LIMITE DE CARACTERES: 50"); + } + break; + case "Competencia": + if (box.Text.Length <= 7) + { + box.Text = ValidationHelper.FormatCompetencia(box.Text); + break; + } + box.Text = ""; + await ViewModel.ShowMessage("LIMITE DE CARACTERES: 7"); + break; + case "Complemento": + if (box.Text.Length > 15) + { + box.Text = ""; + await ViewModel.ShowMessage("LIMITE DE CARACTERES: 15"); + } + break; + } + } + else if (box != null) + { + box.Text = ValidationHelper.FormatCurrency(box.Text); + } + } + else + { + if (box == null) + { + return; + } + box.Text = (string.IsNullOrEmpty(box.Text) ? null : ValidationHelper.FormatDate(box.Text)); + if (e.Column.SortMemberPath == "Vencimento" && string.IsNullOrWhiteSpace(box.Text)) + { + box.Text = ViewModel.SelectedLancamento.Vencimento.ToShortDateString(); + await ViewModel.ShowMessage("VENCIMENTO NÃO PODE SER EM BRANCO"); + return; + } + if (!string.IsNullOrWhiteSpace(box.Text) && !ValidationHelper.ValidateDate(box.Text)) + { + box.Text = ((e.Column.SortMemberPath == "Vencimento") ? ViewModel.SelectedLancamento.Vencimento.ToShortDateString() : null); + await ViewModel.ShowMessage("DATA INVÁLIDA"); + return; + } + string sortMemberPath = e.Column.SortMemberPath; + if (!(sortMemberPath == "Baixa")) + { + if (!(sortMemberPath == "Pagamento") || OriginalValue == box.Text) + { + return; + } + if (!(await ViewModel.ShowMessage("DESEJA REPLICAR PARA OS DEMAIS LANÇAMENTOS FILTRADOS?", "SIM", "NÃO"))) + { + atualizar = false; + } + foreach (Lancamento item2 in ((IEnumerable)((ItemsControl)LancamentoGrid).Items).Cast<Lancamento>()) + { + if (((DomainBase)item2).Id == ((DomainBase)(Lancamento)((Selector)LancamentoGrid).SelectedItem).Id || atualizar) + { + item2.Pagamento = (string.IsNullOrEmpty(box.Text) ? null : new DateTime?(DateTime.Parse(box.Text))); + } + } + ((CollectionView)((ItemsControl)LancamentoGrid).Items).Refresh(); + } + else + { + if (OriginalValue == box.Text) + { + return; + } + if (!(await ViewModel.ShowMessage("DESEJA REPLICAR PARA OS DEMAIS LANÇAMENTOS FILTRADOS?", "SIM", "NÃO"))) + { + atualizar = false; + } + foreach (Lancamento item3 in ((IEnumerable)((ItemsControl)LancamentoGrid).Items).Cast<Lancamento>()) + { + if (((DomainBase)item3).Id == ((DomainBase)(Lancamento)((Selector)LancamentoGrid).SelectedItem).Id || atualizar) + { + item3.Baixa = (string.IsNullOrEmpty(box.Text) ? null : new DateTime?(DateTime.Parse(box.Text))); + } + } + ((CollectionView)((ItemsControl)LancamentoGrid).Items).Refresh(); + } + } + } + + private void CheckBox_Checked(object sender, RoutedEventArgs e) + { + //IL_0011: Unknown result type (might be due to invalid IL or missing references) + if (!_selecionando) + { + _selecionando = true; + ((ToggleButton)(CheckBox)sender).IsChecked = false; + ViewModel.SelecionarTodos(); + _selecionando = false; + } + } + + private void CheckBoxFiltros_Checked(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + switch (((FrameworkElement)(CheckBox)sender).Name) + { + case "GridPlanos": + ViewModel.PlanosFiltro.ForEach(delegate(Planos x) + { + x.Selecionado = !x.Selecionado; + }); + ViewModel.PlanosFiltro = new List<Planos>(ViewModel.PlanosFiltro); + break; + case "GridCentro": + ViewModel.CentroFiltro.ForEach(delegate(Centro x) + { + x.Selecionado = !x.Selecionado; + }); + ViewModel.CentroFiltro = new List<Centro>(ViewModel.CentroFiltro); + break; + case "GridConta": + ViewModel.ContaFiltro.ForEach(delegate(BancosContas x) + { + x.Selecionado = !x.Selecionado; + }); + ViewModel.ContaFiltro = new List<BancosContas>(ViewModel.ContaFiltro); + break; + } + } + + private async void Imprimir_OnClick(object sender, RoutedEventArgs e) + { + List<Lancamento> relatorio = ((IEnumerable)((ItemsControl)LancamentoGrid).Items).Cast<Lancamento>().ToList(); + if (await ViewModel.ShowMessage("DESEJA CONTINUAR COM A IMPRESSÃO?", "SIM", "NÃO")) + { + bool posicao = await ViewModel.ShowMessage("EM QUAL POSIÇÂO DESEJA IMPRIMIR?", "PAISAGEM (horizontal)", "RETRATO (vertical)"); + await ViewModel.Print(relatorio, posicao); + } + } + + private async void ExportarExcel_OnClick(object sender, RoutedEventArgs e) + { + List<Lancamento> relatorioGrid = ((IEnumerable)((ItemsControl)LancamentoGrid).Items).Cast<Lancamento>().ToList(); + await ViewModel.GerarExcel(relatorioGrid); + } + + private async void AbrirLancamento(Lancamento lancamento) + { + if (ViewModel.SelectedLancamento == null) + { + await ViewModel.ShowMessage("SELECIONE UM LANCAMENTO ANTES DE PROSSEGUIR"); + } + else if (((DomainBase)lancamento).Id <= 0 || lancamento.Controle.Plano != null) + { + ViewModel.SelectedLancamento = lancamento; + ViewModel.VencimentoAlterado = false; + ViewModel.VencimentoAnt = ViewModel.SelectedLancamento.Vencimento; + if (((DomainBase)lancamento).Id > 0) + { + ViewModel.FiltrarLancamento(((DomainBase)lancamento).Id); + } + else + { + ViewModel.FiltrarLancamento(lancamento); + } + ViewModel.Alterando = (Visibility)0; + ViewModel.BuscaHabilitada = false; + ValidarLancamento(); + } + } + + private void ValidarLancamento() + { + if (ViewModel.SelectedLancamento != null) + { + List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedLancamento.Validate(); + ((DependencyObject)(object)this).ValidateFields(errorMessages, focusField: false); + } + } + + private void Incluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.IncluirLancamento(); + ViewModel.IdLancamento = 0L; + ValidarLancamento(); + } + + private async void SalvarLancamento_OnClick(object sender, RoutedEventArgs e) + { + await Salvar(fechar: true); + } + + private async Task Salvar(bool fechar) + { + IInputElement focusedElement = Keyboard.FocusedElement; + DatePickerTextBox val = (DatePickerTextBox)(object)((focusedElement is DatePickerTextBox) ? focusedElement : null); + if (val != null) + { + ((DatePicker)((FrameworkElement)val).TemplatedParent).SelectedDate = ValidationHelper.ToDateTime(ValidationHelper.FormatDate(((TextBox)val).Text)); + if (((DatePicker)((FrameworkElement)val).TemplatedParent).SelectedDate.ToString() == "01/01/0001 00:00:00") + { + ((DatePicker)((FrameworkElement)val).TemplatedParent).SelectedDate = null; + } + } + bool flag = ViewModel.Importando && ViewModel.Parcelas > 1; + if (flag) + { + flag = !(await ViewModel.ShowMessage($"SERÁ CRIADO COM {ViewModel.Parcelas} PARCELAS, INICIADO POR ESSE LANÇAMENTO, DESEJA PROSSEGUIR?", "SIM", "NÃO")); + } + if (flag) + { + return; + } + ViewModel.Loading(isLoading: true); + if (ViewModel.Importando) + { + ViewModel.BindImportando(); + List<KeyValuePair<string, string>> list = ViewModel.SelectedLancamento.Validate() ?? new List<KeyValuePair<string, string>>(); + if (list.Count > 0) + { + ViewModel.Loading(isLoading: false); + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + return; + } + ViewModel.LancamentosFiltrados = ViewModel.Lancamentos; + AutoCompleteFornecedorInclusao.Text = string.Empty; + ViewModel.Alterando = (Visibility)2; + ViewModel.BuscaHabilitada = true; + ViewModel.Loading(isLoading: false); + return; + } + ViewModel.Bind(); + List<KeyValuePair<string, string>> list2 = await ViewModel.Salvar(); + bool num = list2 == null || list2.Count == 0; + ViewModel.Loading(isLoading: false); + if (num) + { + if (fechar) + { + AutoCompleteFornecedorInclusao.Text = string.Empty; + ViewModel.Alterando = (Visibility)2; + ViewModel.BuscaHabilitada = true; + await ViewModel.Buscar(); + return; + } + Fornecedor fornecedorInclusao = ViewModel.FornecedorInclusao; + string historico = ViewModel.Historico; + string documento = ViewModel.Documento; + string competencia = ViewModel.Competencia; + string complemento = ViewModel.Complemento; + Planos plano = ViewModel.Plano; + Centro centro = ViewModel.Centro; + BancosContas conta = ViewModel.Conta; + Sinal sinal = ViewModel.Sinal; + int parcelas = ViewModel.Parcelas; + int parcela = ViewModel.Parcela; + DateTime vencimento = ViewModel.Vencimento; + decimal valor = ViewModel.Valor; + DateTime? baixa = ViewModel.Baixa; + decimal? valorPago = ViewModel.ValorPago; + DateTime? pagamento = ViewModel.Pagamento; + TipoPagamento val2 = ViewModel.TipoPagamento; + string observacao = ViewModel.Observacao; + ViewModel.FornecedorInclusao = fornecedorInclusao; + ViewModel.Historico = historico; + ViewModel.Documento = documento; + ViewModel.Competencia = competencia; + ViewModel.Complemento = complemento; + ViewModel.Plano = plano; + ViewModel.Centro = centro; + ViewModel.Conta = conta; + ViewModel.Sinal = sinal; + ViewModel.Parcelas = parcelas; + ViewModel.Parcela = parcela; + ViewModel.Vencimento = vencimento; + ViewModel.Valor = valor; + ViewModel.Baixa = baixa; + ViewModel.ValorPago = valorPago; + ViewModel.Pagamento = pagamento; + ViewModel.TipoPagamento = val2; + ViewModel.Observacao = observacao; + ViewModel.EnableIncluirNovo = true; + } + else + { + await ViewModel.ShowMessage(list2, ViewModel.ErroCamposInvalidos, "OK"); + } + } + + private void CancelarAlteracao_OnClick(object sender, RoutedEventArgs e) + { + AutoCompleteFornecedorInclusao.Text = string.Empty; + ViewModel.Alterando = (Visibility)2; + ViewModel.BuscaHabilitada = true; + ViewModel.CancelarAlteracao(); + ViewModel.EnableIncluirNovo = false; + } + + private void AutoCompleteBoxDetalhe_Populating(object sender, PopulatingEventArgs e) + { + if (e.Parameter.Length < 3) + { + return; + } + e.Cancel = true; + ViewModel.FiltroPersonalizadoTask(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<FiltroPersonalizado>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void FiltroDetalhes_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_0028: Unknown result type (might be due to invalid IL or missing references) + //IL_0032: Expected O, but got Unknown + AutoCompleteBox val = (AutoCompleteBox)sender; + if (val != null && val.SelectedItem != null && val.IsDropDownOpen) + { + ViewModel.AdicionarFiltro((FiltroPersonalizado)val.SelectedItem); + val.Text = string.Empty; + } + } + + private void ExcluirFiltro_onDeleteClick(object sender, RoutedEventArgs e) + { + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_0034: Expected O, but got Unknown + Chip val = (Chip)((sender is Chip) ? sender : null); + if (val != null) + { + ListBox val2 = Extentions.FindVisualAncestor<ListBox>((DependencyObject)(object)val); + FiltroPersonalizado val3 = (FiltroPersonalizado)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)]; + if (val3 != null) + { + ViewModel.ExcluirFiltro(val3); + } + } + } + + private void LimparFiltros_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.LimparFiltros(); + ViewModel.FiltrarPersonalizado(); + } + + private void EsconderFiltros_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.VisibleFiltros = (Visibility)2; + ViewModel.VisibleOlho = (Visibility)0; + } + + private void MostrarFiltros_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.VisibleFiltros = (Visibility)0; + ViewModel.VisibleOlho = (Visibility)2; + } + + private async void ExcluirRange_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.ExcluirRange(); + } + + private async void Excluir_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.Excluir(); + ViewModel.Alterando = (Visibility)2; + ViewModel.BuscaHabilitada = true; + ViewModel.CancelarAlteracao(); + } + + private async void ArquivoDigital_OnClick(object sender, RoutedEventArgs e) + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)9).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)9) + "."); + return; + } + FiltroArquivoDigital filtro = new FiltroArquivoDigital + { + Id = ((DomainBase)ViewModel.SelectedLancamento).Id, + Tipo = (TipoArquivoDigital)9, + Parente = ViewModel.SelectedLancamento + }; + ViewModel.ShowDrawer(new ArquivoDigitalDrawer(filtro), 0, close: false); + } + + private void Saldos_OnMouseDoubleClick(object sender, MouseButtonEventArgs e) + { + //IL_003a: Unknown result type (might be due to invalid IL or missing references) + //IL_0040: Invalid comparison between Unknown and I4 + //IL_0043: Unknown result type (might be due to invalid IL or missing references) + if (ViewModel.SelectedSaldo != null) + { + string text = "INFORMAÇÕES DO EXTRATO - " + ViewModel.SelectedSaldo.Conta.Descricao; + Window val = Funcoes.IsHosterOpen(text); + if (val != null) + { + val.WindowState = (WindowState)(((int)val.WindowState == 1) ? 2 : ((int)val.WindowState)); + val.Activate(); + } + else + { + ((Window)new HosterWindow((ContentControl)(object)new InfoExtratoView(ViewModel.SelectedSaldo), text, 800.0, 450.0, canMaximize: true)).Show(); + } + } + } + + private void IncluirParcela_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.IncluirParcela(); + ValidarLancamento(); + } + + private void Alterar_OnClick(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Expected O, but got Unknown + Lancamento lancamento = (Lancamento)((FrameworkElement)(Button)sender).DataContext; + ViewModel.VisibilityFornecedor = (Visibility)((!ViewModel.Importando) ? 2 : 0); + ViewModel.BotaoSalvarVisibility = (Visibility)(ViewModel.Importando ? 2 : 0); + AbrirLancamento(lancamento); + ViewModel.Loading(isLoading: false); + } + + private async void ExcluirBaixaRange_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.ExcluirBaixaRange(); + } + + private async void ExcluirBaixa_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.ExcluirBaixa(); + } + + private async void SalvarRange_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.Atualizar(((IEnumerable)((ItemsControl)LancamentoGrid).Items).Cast<Lancamento>().ToList()); + LancamentoGrid.CommitEdit(); + LancamentoGrid.CommitEdit(); + CollectionViewSource.GetDefaultView((object)((ItemsControl)LancamentoGrid).ItemsSource).Refresh(); + } + + private void TrocarFornecedor_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + AbrirLancamento(ViewModel.SelectedLancamento); + ViewModel.VisibilityFornecedor = (Visibility)0; + ViewModel.Loading(isLoading: false); + } + + private void Sintetizar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Sintetizar(); + } + + private void ExtratoConta_OnClick(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + Button val = (Button)sender; + if (val != null && ((FrameworkElement)val).DataContext != null) + { + ((Window)new ExtratoWindow(((DomainBase)((Saldo)((FrameworkElement)val).DataContext).Conta).Id)).Show(); + } + } + + private async void SalvarInclusao_Click(object sender, RoutedEventArgs e) + { + await Salvar(fechar: false); + } + + private async void Transferir_OnClick(object sender, RoutedEventArgs e) + { + Transferencia transferencia = new Transferencia + { + Data = Funcoes.GetNetworkTime().Date + }; + while (true) + { + transferencia = await ViewModel.ShowTransferencia(transferencia); + if (transferencia == null) + { + return; + } + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(transferencia); + bool num = list == null || list.Count == 0; + ViewModel.Loading(isLoading: false); + if (num) + { + break; + } + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + ViewModel.ToggleSnackBar("TRANSFERÊNCIA SALVA COM SUCESSO."); + ViewModel.Alterar(alterar: false); + } + + private void AbrirLogEmail_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLogEmail((TipoTela)25, ((DomainBase)ViewModel.SelectedLancamento).Id); + } + + private void Unchecked_OnHandler(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + DataGridCell val = (DataGridCell)sender; + if (((Selector)LancamentoGrid).SelectedItem != null) + { + object dataContext = ((FrameworkElement)val).DataContext; + Lancamento val2 = (Lancamento)((dataContext is Lancamento) ? dataContext : null); + if (val2 != null && val2.Selecionado) + { + ViewModel.DeSelecionarLancamento(val2); + LancamentoGrid.CommitEdit(); + LancamentoGrid.CommitEdit(); + CollectionViewSource.GetDefaultView((object)((ItemsControl)LancamentoGrid).ItemsSource).Refresh(); + } + } + } + + private void OnChecked_OnHandler(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + DataGridCell val = (DataGridCell)sender; + if (((Selector)LancamentoGrid).SelectedItem != null) + { + object dataContext = ((FrameworkElement)val).DataContext; + Lancamento val2 = (Lancamento)((dataContext is Lancamento) ? dataContext : null); + if (val2 != null && !val2.Selecionado) + { + ViewModel.SelecionarLancamento(val2); + LancamentoGrid.CommitEdit(); + LancamentoGrid.CommitEdit(); + CollectionViewSource.GetDefaultView((object)((ItemsControl)LancamentoGrid).ItemsSource).Refresh(); + } + } + } + + public void SaveSortLancamentos() + { + //IL_006e: Unknown result type (might be due to invalid IL or missing references) + //IL_0073: Unknown result type (might be due to invalid IL or missing references) + //IL_007a: Unknown result type (might be due to invalid IL or missing references) + _sortDirections = new List<ListSortDirection?>(); + _sortDescriptions = new List<SortDescription>(); + foreach (DataGridColumn column in LancamentoGrid.Columns) + { + _sortDirections.Add(column.SortDirection); + } + foreach (SortDescription item in (Collection<SortDescription>)(object)((CollectionView)((ItemsControl)LancamentoGrid).Items).SortDescriptions) + { + _sortDescriptions.Add(item); + } + } + + public void SortLancamentos() + { + //IL_009b: Unknown result type (might be due to invalid IL or missing references) + //IL_00a0: Unknown result type (might be due to invalid IL or missing references) + //IL_00b1: Unknown result type (might be due to invalid IL or missing references) + if (_sortDirections == null || _sortDirections.Count != LancamentoGrid.Columns.Count) + { + return; + } + foreach (DataGridColumn column in LancamentoGrid.Columns) + { + column.SortDirection = _sortDirections[LancamentoGrid.Columns.IndexOf(column)]; + } + ((Collection<SortDescription>)(object)((CollectionView)((ItemsControl)LancamentoGrid).Items).SortDescriptions).Clear(); + foreach (SortDescription sortDescription in _sortDescriptions) + { + ((Collection<SortDescription>)(object)((CollectionView)((ItemsControl)LancamentoGrid).Items).SortDescriptions).Add(sortDescription); + } + } + + private void LancamentoGrid_OnPreparingCellForEdit(object sender, DataGridPreparingCellForEditEventArgs e) + { + if (((object)e.Column).GetType().Name != "DataGridTextColumn") + { + LancamentoGrid.CancelEdit(); + LancamentoGrid.CancelEdit(); + } + FrameworkElement editingElement = e.EditingElement; + TextBox val = (TextBox)(object)((editingElement is TextBox) ? editingElement : null); + if (val != null) + { + OriginalValue = val.Text; + } + } + + private async void TipoPagamento_OnDropDownClosed(object sender, EventArgs e) + { + if (tipoPagamento == (TipoPagamento?)(TipoPagamento)((Selector)(ComboBox)sender).SelectedItem) + { + tipoPagamento = null; + } + else + { + if (!(await ViewModel.ShowMessage("DESEJA REPLICAR PARA OS DEMAIS LANÇAMENTOS FILTRADOS?", "SIM", "NÃO"))) + { + return; + } + tipoPagamento = null; + foreach (Lancamento item in ((IEnumerable)((ItemsControl)LancamentoGrid).Items).Cast<Lancamento>()) + { + item.TipoPagamento = (TipoPagamento)((Selector)(ComboBox)sender).SelectedItem; + } + LancamentoGrid.CommitEdit(); + LancamentoGrid.CommitEdit(); + ((CollectionView)((ItemsControl)LancamentoGrid).Items).Refresh(); + } + } + + private void TipoPagamento_DropDownOpened(object sender, EventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + if (((Selector)(ComboBox)sender).SelectedItem != null) + { + tipoPagamento = (TipoPagamento)((Selector)(ComboBox)sender).SelectedItem; + } + else + { + tipoPagamento = null; + } + } + + private async void ImportarOfx_Click(object sender, RoutedEventArgs e) + { + await ImportarOfx(); + } + + private async Task ImportarOfx() + { + if (ViewModel.ContasFiltradas == null || ViewModel.ContasFiltradas.Count == 0) + { + await ViewModel.ShowMessage("NÃO HÁ CONTAS CADASTRADAS PARA REALIZAR A IMPORTAÇÃO."); + return; + } + BancosContas val = ((ViewModel.ContasFiltradas.Count <= 1) ? ViewModel.ContasFiltradas.First() : (await ViewModel.ShowContas(ViewModel.ContasFiltradas.ToList()))); + BancosContas val2 = val; + if (val2 != null) + { + ViewModel.Loading(isLoading: true); + await ViewModel.ParseOfx(val2); + ViewModel.Loading(isLoading: false); + } + } + + private async void SalvarImportacao_Click(object sender, RoutedEventArgs e) + { + if (await ViewModel.ShowMessage("DESEJA PROSSEGUIR COM A IMPORTAÇÃO?" + Environment.NewLine + Environment.NewLine + "SOMENTE OS LANÇAMENTOS VÁLIDOS SERÃO ALTERADOS OU INCLUÍDOS", "SIM", "NÃO")) + { + ViewModel.Loading(isLoading: true); + List<Lancamento> list = ViewModel.Lancamentos.Where((Lancamento x) => x.Validate().Count == 0).ToList(); + if (await ViewModel.SalvarImportacao(list)) + { + ViewModel.Importando = false; + } + ViewModel.Loading(isLoading: false); + } + } + + private async void CancelarImportacao_Click(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + ViewModel.Importando = false; + await ViewModel.Buscar(); + ViewModel.Loading(isLoading: false); + } + + private async void BuscarLancamentos_Click(object sender, RoutedEventArgs e) + { + if (ViewModel.FornecedorInclusao == null || ViewModel.FornecedorInclusao.Id == 0L) + { + await ViewModel.ShowMessage("É NECESSÁRIO PESQUISAR O FORNECEDOR AO LADO PARA VINCULAR UM LANÇAMENTO A ESSA MOVIMENTAÇÃO."); + return; + } + ViewModel.Loading(isLoading: true); + await ViewModel.BuscarLancamentosVinculo(); + ViewModel.Loading(isLoading: false); + await AbrirVinculo(); + } + + private async Task AbrirVinculo() + { + if (ViewModel.LancamentosVinculo.Count == 0) + { + await ViewModel.ShowMessage("NÃO HÁ LANÇAMENTOS CRIADOS PARA O FORNECEDOR SELECIONADO."); + return; + } + Lancamento lancamento = await ViewModel.ShowVinculo(ViewModel); + if (lancamento != null) + { + if (!(await ViewModel.ShowMessage($"DESEJA VINCULAR O LANÇAMENTO {((DomainBase)ViewModel.LancamentoVinculo).Id} A MOVIMENTAÇÃO SELECIONADA?", "SIM", "NÃO"))) + { + await AbrirVinculo(); + } + ViewModel.FeedImportando(lancamento); + ViewModel.BindImportando(); + } + } + + private void Pendentes_Click(object sender, RoutedEventArgs e) + { + ViewModel.SelectedStatusImportacao = (StatusLancamento)0; + ViewModel.FiltroImportacao(); + } + + private void Baixados_Click(object sender, RoutedEventArgs e) + { + ViewModel.SelectedStatusImportacao = (StatusLancamento)1; + ViewModel.FiltroImportacao(); + } + + private void Todos_Click(object sender, RoutedEventArgs e) + { + ViewModel.SelectedStatusImportacao = (StatusLancamento)2; + ViewModel.FiltroImportacao(); + } + + private void Filtrar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.IsExpanded = !ViewModel.IsExpanded; + } + + private void Fechar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.IsExpanded = !ViewModel.IsExpanded; + } + + private void AdicionarFiltros_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.LimparFiltros(); + ViewModel.AdicionarFiltros(); + ViewModel.IsExpanded = !ViewModel.IsExpanded; + } + + private void AbrirLog_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLog((TipoTela)25, ((DomainBase)ViewModel.SelectedLancamento).Id); + } + + private void AdicionarFiltro_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AdcionarFiltroPersonalizado(); + } + + private void ExcluirFiltro_OnClick(object sender, RoutedEventArgs e) + { + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_0034: Expected O, but got Unknown + Chip val = (Chip)((sender is Chip) ? sender : null); + if (val != null) + { + ListBox val2 = Extentions.FindVisualAncestor<ListBox>((DependencyObject)(object)val); + FiltroPersonalizado val3 = (FiltroPersonalizado)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)]; + if (val3 != null) + { + ViewModel.PersonalizadoSelecionado.Remove(val3); + ViewModel.PesquisaPersonalizada(); + } + } + } + + private void MostrarFiltros_Click(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Unknown result type (might be due to invalid IL or missing references) + //IL_0018: Invalid comparison between Unknown and I4 + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_002f: Invalid comparison between Unknown and I4 + MenuItem val = (MenuItem)sender; + ((UIElement)GridFiltros).Visibility = (Visibility)(((int)((UIElement)GridFiltros).Visibility != 2) ? 2 : 0); + ((HeaderedItemsControl)val).Header = (((int)((UIElement)GridFiltros).Visibility == 2) ? "MOSTRAR FILTROS" : "ESCONDER FILTROS"); + } + + private new void DatePicker_PreviewKeyDown(object sender, KeyEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Invalid comparison between Unknown and I4 + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + if ((int)e.Key == 6) + { + ((DatePicker)sender).Text = Funcoes.GetNetworkTime().Date.ToString("dd/MM/yyyy"); + } + } + + public new void DatePicker_OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + DatePicker val = (DatePicker)sender; + val.Text = ValidationHelper.FormatDate(val.Text); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/financeiro/financeiroview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0102: Unknown result type (might be due to invalid IL or missing references) + //IL_010e: Unknown result type (might be due to invalid IL or missing references) + //IL_0118: Expected O, but got Unknown + //IL_011a: Unknown result type (might be due to invalid IL or missing references) + //IL_0126: Unknown result type (might be due to invalid IL or missing references) + //IL_0130: Expected O, but got Unknown + //IL_0131: Unknown result type (might be due to invalid IL or missing references) + //IL_013d: Unknown result type (might be due to invalid IL or missing references) + //IL_0147: Expected O, but got Unknown + //IL_0148: Unknown result type (might be due to invalid IL or missing references) + //IL_0154: Unknown result type (might be due to invalid IL or missing references) + //IL_015e: Expected O, but got Unknown + //IL_0160: Unknown result type (might be due to invalid IL or missing references) + //IL_016c: Unknown result type (might be due to invalid IL or missing references) + //IL_0176: Expected O, but got Unknown + //IL_0177: Unknown result type (might be due to invalid IL or missing references) + //IL_0183: Unknown result type (might be due to invalid IL or missing references) + //IL_018d: Expected O, but got Unknown + //IL_018e: Unknown result type (might be due to invalid IL or missing references) + //IL_019a: Unknown result type (might be due to invalid IL or missing references) + //IL_01a4: Expected O, but got Unknown + //IL_01a7: Unknown result type (might be due to invalid IL or missing references) + //IL_01b1: Expected O, but got Unknown + //IL_01be: Unknown result type (might be due to invalid IL or missing references) + //IL_01c8: Expected O, but got Unknown + //IL_01ca: Unknown result type (might be due to invalid IL or missing references) + //IL_01d6: Unknown result type (might be due to invalid IL or missing references) + //IL_01e0: Expected O, but got Unknown + //IL_01e1: Unknown result type (might be due to invalid IL or missing references) + //IL_01ed: Unknown result type (might be due to invalid IL or missing references) + //IL_01f7: Expected O, but got Unknown + //IL_01f9: Unknown result type (might be due to invalid IL or missing references) + //IL_0205: Unknown result type (might be due to invalid IL or missing references) + //IL_020f: Expected O, but got Unknown + //IL_0212: Unknown result type (might be due to invalid IL or missing references) + //IL_021c: Expected O, but got Unknown + //IL_0229: Unknown result type (might be due to invalid IL or missing references) + //IL_0233: Expected O, but got Unknown + //IL_0235: Unknown result type (might be due to invalid IL or missing references) + //IL_0241: Unknown result type (might be due to invalid IL or missing references) + //IL_024b: Expected O, but got Unknown + //IL_024d: Unknown result type (might be due to invalid IL or missing references) + //IL_0259: Unknown result type (might be due to invalid IL or missing references) + //IL_0263: Expected O, but got Unknown + //IL_0265: Unknown result type (might be due to invalid IL or missing references) + //IL_0271: Unknown result type (might be due to invalid IL or missing references) + //IL_027b: Expected O, but got Unknown + //IL_027d: Unknown result type (might be due to invalid IL or missing references) + //IL_0289: Unknown result type (might be due to invalid IL or missing references) + //IL_0293: Expected O, but got Unknown + //IL_0295: Unknown result type (might be due to invalid IL or missing references) + //IL_02a1: Unknown result type (might be due to invalid IL or missing references) + //IL_02ab: Expected O, but got Unknown + //IL_02ad: Unknown result type (might be due to invalid IL or missing references) + //IL_02b9: Unknown result type (might be due to invalid IL or missing references) + //IL_02c3: Expected O, but got Unknown + //IL_02c5: Unknown result type (might be due to invalid IL or missing references) + //IL_02d1: Unknown result type (might be due to invalid IL or missing references) + //IL_02db: Expected O, but got Unknown + //IL_02dd: Unknown result type (might be due to invalid IL or missing references) + //IL_02e9: Unknown result type (might be due to invalid IL or missing references) + //IL_02f3: Expected O, but got Unknown + //IL_02f5: Unknown result type (might be due to invalid IL or missing references) + //IL_0301: Unknown result type (might be due to invalid IL or missing references) + //IL_030b: Expected O, but got Unknown + //IL_030d: Unknown result type (might be due to invalid IL or missing references) + //IL_0319: Unknown result type (might be due to invalid IL or missing references) + //IL_0323: Expected O, but got Unknown + //IL_0325: Unknown result type (might be due to invalid IL or missing references) + //IL_0331: Unknown result type (might be due to invalid IL or missing references) + //IL_033b: Expected O, but got Unknown + //IL_033d: Unknown result type (might be due to invalid IL or missing references) + //IL_0349: Unknown result type (might be due to invalid IL or missing references) + //IL_0353: Expected O, but got Unknown + //IL_0355: Unknown result type (might be due to invalid IL or missing references) + //IL_0361: Unknown result type (might be due to invalid IL or missing references) + //IL_036b: Expected O, but got Unknown + //IL_036d: Unknown result type (might be due to invalid IL or missing references) + //IL_0379: Unknown result type (might be due to invalid IL or missing references) + //IL_0383: Expected O, but got Unknown + //IL_0385: Unknown result type (might be due to invalid IL or missing references) + //IL_0391: Unknown result type (might be due to invalid IL or missing references) + //IL_039b: Expected O, but got Unknown + //IL_039d: Unknown result type (might be due to invalid IL or missing references) + //IL_03a9: Unknown result type (might be due to invalid IL or missing references) + //IL_03b3: Expected O, but got Unknown + //IL_03b5: Unknown result type (might be due to invalid IL or missing references) + //IL_03c1: Unknown result type (might be due to invalid IL or missing references) + //IL_03cb: Expected O, but got Unknown + //IL_03cd: Unknown result type (might be due to invalid IL or missing references) + //IL_03d9: Unknown result type (might be due to invalid IL or missing references) + //IL_03e3: Expected O, but got Unknown + //IL_03e5: Unknown result type (might be due to invalid IL or missing references) + //IL_03f1: Unknown result type (might be due to invalid IL or missing references) + //IL_03fb: Expected O, but got Unknown + //IL_03fd: Unknown result type (might be due to invalid IL or missing references) + //IL_0409: Unknown result type (might be due to invalid IL or missing references) + //IL_0413: Expected O, but got Unknown + //IL_0416: Unknown result type (might be due to invalid IL or missing references) + //IL_0420: Expected O, but got Unknown + //IL_0422: Unknown result type (might be due to invalid IL or missing references) + //IL_042e: Unknown result type (might be due to invalid IL or missing references) + //IL_0438: Expected O, but got Unknown + //IL_0439: Unknown result type (might be due to invalid IL or missing references) + //IL_0445: Unknown result type (might be due to invalid IL or missing references) + //IL_044f: Expected O, but got Unknown + //IL_0450: Unknown result type (might be due to invalid IL or missing references) + //IL_045c: Unknown result type (might be due to invalid IL or missing references) + //IL_0466: Expected O, but got Unknown + //IL_0468: Unknown result type (might be due to invalid IL or missing references) + //IL_0474: Unknown result type (might be due to invalid IL or missing references) + //IL_047e: Expected O, but got Unknown + //IL_047f: Unknown result type (might be due to invalid IL or missing references) + //IL_048b: Unknown result type (might be due to invalid IL or missing references) + //IL_0495: Expected O, but got Unknown + //IL_0496: Unknown result type (might be due to invalid IL or missing references) + //IL_04a2: Unknown result type (might be due to invalid IL or missing references) + //IL_04ac: Expected O, but got Unknown + //IL_04ae: Unknown result type (might be due to invalid IL or missing references) + //IL_04ba: Unknown result type (might be due to invalid IL or missing references) + //IL_04c4: Expected O, but got Unknown + //IL_04c6: Unknown result type (might be due to invalid IL or missing references) + //IL_04d2: Unknown result type (might be due to invalid IL or missing references) + //IL_04dc: Expected O, but got Unknown + //IL_04de: Unknown result type (might be due to invalid IL or missing references) + //IL_04ea: Unknown result type (might be due to invalid IL or missing references) + //IL_04f4: Expected O, but got Unknown + //IL_04f7: Unknown result type (might be due to invalid IL or missing references) + //IL_0501: Expected O, but got Unknown + //IL_0531: Unknown result type (might be due to invalid IL or missing references) + //IL_053d: Unknown result type (might be due to invalid IL or missing references) + //IL_0547: Expected O, but got Unknown + //IL_0549: Unknown result type (might be due to invalid IL or missing references) + //IL_0555: Unknown result type (might be due to invalid IL or missing references) + //IL_055f: Expected O, but got Unknown + //IL_0561: Unknown result type (might be due to invalid IL or missing references) + //IL_056d: Unknown result type (might be due to invalid IL or missing references) + //IL_0577: Expected O, but got Unknown + //IL_0579: Unknown result type (might be due to invalid IL or missing references) + //IL_0585: Unknown result type (might be due to invalid IL or missing references) + //IL_058f: Expected O, but got Unknown + //IL_0591: Unknown result type (might be due to invalid IL or missing references) + //IL_059d: Unknown result type (might be due to invalid IL or missing references) + //IL_05a7: Expected O, but got Unknown + //IL_05a9: Unknown result type (might be due to invalid IL or missing references) + //IL_05b5: Unknown result type (might be due to invalid IL or missing references) + //IL_05bf: Expected O, but got Unknown + //IL_05c1: Unknown result type (might be due to invalid IL or missing references) + //IL_05cd: Unknown result type (might be due to invalid IL or missing references) + //IL_05d7: Expected O, but got Unknown + //IL_05d9: Unknown result type (might be due to invalid IL or missing references) + //IL_05e5: Unknown result type (might be due to invalid IL or missing references) + //IL_05ef: Expected O, but got Unknown + //IL_05f1: Unknown result type (might be due to invalid IL or missing references) + //IL_05fd: Unknown result type (might be due to invalid IL or missing references) + //IL_0607: Expected O, but got Unknown + //IL_060a: Unknown result type (might be due to invalid IL or missing references) + //IL_0614: Expected O, but got Unknown + //IL_0621: Unknown result type (might be due to invalid IL or missing references) + //IL_062b: Expected O, but got Unknown + //IL_062d: Unknown result type (might be due to invalid IL or missing references) + //IL_0639: Unknown result type (might be due to invalid IL or missing references) + //IL_0643: Expected O, but got Unknown + //IL_0645: Unknown result type (might be due to invalid IL or missing references) + //IL_0651: Unknown result type (might be due to invalid IL or missing references) + //IL_065b: Expected O, but got Unknown + //IL_065c: Unknown result type (might be due to invalid IL or missing references) + //IL_0668: Unknown result type (might be due to invalid IL or missing references) + //IL_0672: Expected O, but got Unknown + //IL_0673: Unknown result type (might be due to invalid IL or missing references) + //IL_067f: Unknown result type (might be due to invalid IL or missing references) + //IL_0689: Expected O, but got Unknown + //IL_068b: Unknown result type (might be due to invalid IL or missing references) + //IL_0697: Unknown result type (might be due to invalid IL or missing references) + //IL_06a1: Expected O, but got Unknown + //IL_06a2: Unknown result type (might be due to invalid IL or missing references) + //IL_06ae: Unknown result type (might be due to invalid IL or missing references) + //IL_06b8: Expected O, but got Unknown + //IL_06b9: Unknown result type (might be due to invalid IL or missing references) + //IL_06c5: Unknown result type (might be due to invalid IL or missing references) + //IL_06cf: Expected O, but got Unknown + //IL_06d1: Unknown result type (might be due to invalid IL or missing references) + //IL_06dd: Unknown result type (might be due to invalid IL or missing references) + //IL_06e7: Expected O, but got Unknown + //IL_06e8: Unknown result type (might be due to invalid IL or missing references) + //IL_06f4: Unknown result type (might be due to invalid IL or missing references) + //IL_06fe: Expected O, but got Unknown + //IL_06ff: Unknown result type (might be due to invalid IL or missing references) + //IL_070b: Unknown result type (might be due to invalid IL or missing references) + //IL_0715: Expected O, but got Unknown + //IL_0717: Unknown result type (might be due to invalid IL or missing references) + //IL_0723: Unknown result type (might be due to invalid IL or missing references) + //IL_072d: Expected O, but got Unknown + //IL_072f: Unknown result type (might be due to invalid IL or missing references) + switch (connectionId) + { + case 1: + ((Selector)(ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(TipoFiltrosBox_OnSelectionChanged); + break; + case 2: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 3: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 4: + AutoCompleteFornecedor = (AutoCompleteBox)target; + AutoCompleteFornecedor.Populating += new PopulatingEventHandler(AutoCompleteFornecedor_OnPopulating); + break; + case 5: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBoxDetalhe_Populating); + ((AutoCompleteBox)target).SelectionChanged += new SelectionChangedEventHandler(FiltroDetalhes_OnSelectionChanged); + break; + case 6: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(MostrarFiltros_OnClick); + break; + case 7: + MenuFiltros = (MenuItem)target; + MenuFiltros.Click += new RoutedEventHandler(MostrarFiltros_Click); + break; + case 8: + ((MenuItem)target).Click += new RoutedEventHandler(Pendentes_Click); + break; + case 9: + ((MenuItem)target).Click += new RoutedEventHandler(Baixados_Click); + break; + case 10: + ((MenuItem)target).Click += new RoutedEventHandler(Todos_Click); + break; + case 11: + ((MenuItem)target).Click += new RoutedEventHandler(SalvarImportacao_Click); + break; + case 12: + ((MenuItem)target).Click += new RoutedEventHandler(CancelarImportacao_Click); + break; + case 13: + ((MenuItem)target).Click += new RoutedEventHandler(Buscar_OnClick); + break; + case 14: + ((MenuItem)target).Click += new RoutedEventHandler(Imprimir_OnClick); + break; + case 15: + ((MenuItem)target).Click += new RoutedEventHandler(ExportarExcel_OnClick); + break; + case 16: + ((MenuItem)target).Click += new RoutedEventHandler(Sintetizar_OnClick); + break; + case 17: + ((MenuItem)target).Click += new RoutedEventHandler(TrocarFornecedor_OnClick); + break; + case 18: + ((MenuItem)target).Click += new RoutedEventHandler(SalvarRange_OnClick); + break; + case 19: + ((MenuItem)target).Click += new RoutedEventHandler(Incluir_OnClick); + break; + case 20: + ((MenuItem)target).Click += new RoutedEventHandler(IncluirParcela_OnClick); + break; + case 21: + ((MenuItem)target).Click += new RoutedEventHandler(ExcluirBaixaRange_OnClick); + break; + case 22: + ((MenuItem)target).Click += new RoutedEventHandler(ExcluirRange_OnClick); + break; + case 23: + ((MenuItem)target).Click += new RoutedEventHandler(Transferir_OnClick); + break; + case 24: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick); + break; + case 25: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLogEmail_OnClick); + break; + case 26: + ((MenuItem)target).Click += new RoutedEventHandler(ImportarOfx_Click); + break; + case 27: + ((MenuItem)target).Click += new RoutedEventHandler(Filtrar_OnClick); + break; + case 28: + GridFiltros = (Grid)target; + break; + case 29: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 30: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 31: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AdicionarFiltro_OnClick); + break; + case 34: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(LimparFiltros_OnClick); + break; + case 35: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(EsconderFiltros_OnClick); + break; + case 36: + LancamentoGrid = (DataGrid)target; + LancamentoGrid.CellEditEnding += DataGrid_OnCellEditEnding; + LancamentoGrid.PreparingCellForEdit += LancamentoGrid_OnPreparingCellForEdit; + break; + case 42: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AdicionarFiltros_OnClick); + break; + case 43: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Fechar_OnClick); + break; + case 47: + ((MenuItem)target).Click += new RoutedEventHandler(Incluir_OnClick); + break; + case 48: + ((MenuItem)target).Click += new RoutedEventHandler(SalvarInclusao_Click); + break; + case 49: + ((MenuItem)target).Click += new RoutedEventHandler(SalvarLancamento_OnClick); + break; + case 50: + ((MenuItem)target).Click += new RoutedEventHandler(CancelarAlteracao_OnClick); + break; + case 51: + ((MenuItem)target).Click += new RoutedEventHandler(ExcluirBaixa_OnClick); + break; + case 52: + ((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick); + break; + case 53: + ((MenuItem)target).Click += new RoutedEventHandler(ArquivoDigital_OnClick); + break; + case 54: + AutoCompleteFornecedorInclusao = (AutoCompleteBox)target; + AutoCompleteFornecedorInclusao.Populating += new PopulatingEventHandler(AutoCompleteFornecedorAtivo_OnPopulating); + break; + case 55: + ((MenuItem)target).Click += new RoutedEventHandler(BuscarLancamentos_Click); + break; + case 56: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 57: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 58: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 59: + ((Control)(DataGrid)target).MouseDoubleClick += new MouseButtonEventHandler(Saldos_OnMouseDoubleClick); + break; + case 61: + ((DataGrid)target).CellEditEnding += DataGrid_OnCellEditEnding; + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_004f: Unknown result type (might be due to invalid IL or missing references) + //IL_005b: Unknown result type (might be due to invalid IL or missing references) + //IL_0065: Expected O, but got Unknown + //IL_0067: Unknown result type (might be due to invalid IL or missing references) + //IL_0073: Unknown result type (might be due to invalid IL or missing references) + //IL_007d: Expected O, but got Unknown + //IL_007f: Unknown result type (might be due to invalid IL or missing references) + //IL_008b: Unknown result type (might be due to invalid IL or missing references) + //IL_0095: Expected O, but got Unknown + //IL_0096: Unknown result type (might be due to invalid IL or missing references) + //IL_00a2: Unknown result type (might be due to invalid IL or missing references) + //IL_00ac: Expected O, but got Unknown + //IL_00ad: Unknown result type (might be due to invalid IL or missing references) + //IL_00b3: Expected O, but got Unknown + //IL_00c6: Unknown result type (might be due to invalid IL or missing references) + //IL_00d0: Expected O, but got Unknown + //IL_00d1: Unknown result type (might be due to invalid IL or missing references) + //IL_00e1: Unknown result type (might be due to invalid IL or missing references) + //IL_00e7: Expected O, but got Unknown + //IL_00fa: Unknown result type (might be due to invalid IL or missing references) + //IL_0104: Expected O, but got Unknown + //IL_0105: Unknown result type (might be due to invalid IL or missing references) + //IL_0117: Unknown result type (might be due to invalid IL or missing references) + //IL_0123: Unknown result type (might be due to invalid IL or missing references) + //IL_012d: Expected O, but got Unknown + //IL_012f: Unknown result type (might be due to invalid IL or missing references) + //IL_013b: Unknown result type (might be due to invalid IL or missing references) + //IL_0145: Expected O, but got Unknown + //IL_0147: Unknown result type (might be due to invalid IL or missing references) + //IL_015e: Unknown result type (might be due to invalid IL or missing references) + //IL_0176: Unknown result type (might be due to invalid IL or missing references) + //IL_0182: Unknown result type (might be due to invalid IL or missing references) + //IL_018c: Expected O, but got Unknown + //IL_018d: Unknown result type (might be due to invalid IL or missing references) + //IL_0199: Unknown result type (might be due to invalid IL or missing references) + //IL_01a3: Expected O, but got Unknown + //IL_01a5: Unknown result type (might be due to invalid IL or missing references) + //IL_01b1: Unknown result type (might be due to invalid IL or missing references) + //IL_01bb: Expected O, but got Unknown + //IL_01bc: Unknown result type (might be due to invalid IL or missing references) + //IL_01c8: Unknown result type (might be due to invalid IL or missing references) + //IL_01d2: Expected O, but got Unknown + //IL_01d4: Unknown result type (might be due to invalid IL or missing references) + //IL_01e0: Unknown result type (might be due to invalid IL or missing references) + //IL_01ea: Expected O, but got Unknown + //IL_01eb: Unknown result type (might be due to invalid IL or missing references) + //IL_01f7: Unknown result type (might be due to invalid IL or missing references) + //IL_0201: Expected O, but got Unknown + //IL_0203: Unknown result type (might be due to invalid IL or missing references) + //IL_020f: Unknown result type (might be due to invalid IL or missing references) + //IL_0219: Expected O, but got Unknown + switch (connectionId) + { + case 32: + ((Chip)target).DeleteClick += new RoutedEventHandler(ExcluirFiltro_OnClick); + break; + case 33: + ((Chip)target).DeleteClick += new RoutedEventHandler(ExcluirFiltro_onDeleteClick); + break; + case 37: + ((ToggleButton)(CheckBox)target).Checked += new RoutedEventHandler(CheckBox_Checked); + ((ToggleButton)(CheckBox)target).Unchecked += new RoutedEventHandler(CheckBox_Checked); + break; + case 38: + { + EventSetter val = new EventSetter(); + val.Event = ToggleButton.CheckedEvent; + val.Handler = (Delegate)new RoutedEventHandler(OnChecked_OnHandler); + ((Collection<SetterBase>)(object)((Style)target).Setters).Add((SetterBase)(object)val); + val = new EventSetter(); + val.Event = ToggleButton.UncheckedEvent; + val.Handler = (Delegate)new RoutedEventHandler(Unchecked_OnHandler); + ((Collection<SetterBase>)(object)((Style)target).Setters).Add((SetterBase)(object)val); + break; + } + case 39: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ArquivoDigital_OnClick); + break; + case 40: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Alterar_OnClick); + break; + case 41: + ((ComboBox)target).DropDownOpened += TipoPagamento_DropDownOpened; + ((ComboBox)target).DropDownClosed += TipoPagamento_OnDropDownClosed; + break; + case 44: + ((ToggleButton)(CheckBox)target).Checked += new RoutedEventHandler(CheckBoxFiltros_Checked); + ((ToggleButton)(CheckBox)target).Unchecked += new RoutedEventHandler(CheckBoxFiltros_Checked); + break; + case 45: + ((ToggleButton)(CheckBox)target).Checked += new RoutedEventHandler(CheckBoxFiltros_Checked); + ((ToggleButton)(CheckBox)target).Unchecked += new RoutedEventHandler(CheckBoxFiltros_Checked); + break; + case 46: + ((ToggleButton)(CheckBox)target).Checked += new RoutedEventHandler(CheckBoxFiltros_Checked); + ((ToggleButton)(CheckBox)target).Unchecked += new RoutedEventHandler(CheckBoxFiltros_Checked); + break; + case 60: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExtratoConta_OnClick); + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Financeiro/FornecedorView.cs b/Decompiler/Gestor.Application.Views.Financeiro/FornecedorView.cs new file mode 100644 index 0000000..bd3728d --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Financeiro/FornecedorView.cs @@ -0,0 +1,432 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using System.Windows.Markup; +using Gestor.Application.Drawers; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.ViewModels.Financeiro; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Financeiro; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Views.Financeiro; + +public class FornecedorView : BaseUserControl, IComponentConnector +{ + internal DataGrid FornecedorGrid; + + internal TextBox NomeBox; + + internal TextBox DocumentoPrincipalBox; + + internal ToggleButton AtivoBox; + + internal TextBox CepBox; + + internal ProgressBar ProgressCep; + + internal TextBox EnderecoBox; + + internal TextBox BairroBox; + + internal TextBox CidadeBox; + + internal TextBox EstadoBox; + + internal ComboBox PlanoBox; + + internal ComboBox CentroBox; + + internal ComboBox ContaBox; + + internal ComboBox TipoPagamentoBox; + + private bool _contentLoaded; + + public FornecedorViewModel ViewModel { get; set; } + + public FornecedorView() + { + ((FrameworkElement)this).Tag = "CADASTRO DE FORNECEDORES"; + ViewModel = new FornecedorViewModel(); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + private void AutoCompleteFornecedor_OnPopulating(object sender, PopulatingEventArgs e) + { + if (e.Parameter.Length < 3) + { + return; + } + e.Cancel = true; + ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Fornecedor>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void AutoCompleteBox_OnTextChanged(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + if (string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).Text)) + { + ViewModel.FiltrarFornecedor(""); + } + } + + private void Incluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Incluir(); + } + + private void ScrollToItem() + { + if (((Selector)FornecedorGrid).SelectedItem != null) + { + ((UIElement)FornecedorGrid).UpdateLayout(); + FornecedorGrid.ScrollIntoView(((Selector)FornecedorGrid).SelectedItem); + } + } + + private void Alterar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Alterar(alterar: true); + ((DomainBase)ViewModel.SelectedFornecedor).Initialize(); + } + + private async void Salvar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(); + ((DependencyObject)(object)this).ValidateFields(list); + bool num = list == null || list.Count == 0; + ViewModel.Loading(isLoading: false); + if (num) + { + ScrollToItem(); + } + else + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + } + + private void Cancelar_OnClick(object sender, RoutedEventArgs e) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Expected O, but got Unknown + ViewModel.CancelProduto = (Fornecedor)((DomainBase)ViewModel.SelectedFornecedor).Clone(); + ViewModel.CancelarAlteracao(); + ScrollToItem(); + } + + private async void Excluir_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.Delete(); + ScrollToItem(); + } + + private void DocumentoPrincipalBox_OnLostFocus(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + TextBox val = (TextBox)sender; + val.Text = ValidationHelper.FormatDocument(val.Text); + } + + private async void AbrirAquivoDigital_Click(object sender, RoutedEventArgs e) + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)10).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)10) + "."); + return; + } + FiltroArquivoDigital filtro = new FiltroArquivoDigital + { + Id = ViewModel.SelectedFornecedor.Id, + Tipo = (TipoArquivoDigital)10, + Parente = ViewModel.SelectedFornecedor + }; + ViewModel.ShowDrawer(new ArquivoDigitalDrawer(filtro), 0, close: false); + } + + private async void PostcodeBox_OnLostFocus(object sender, RoutedEventArgs e) + { + TextBox val = (TextBox)sender; + if (string.IsNullOrWhiteSpace(val.Text)) + { + return; + } + string text = ValidationHelper.FormatPostCode(val.Text); + if (ValidationHelper.ValidatePostCode(text)) + { + CepBox.Text = text; + EnderecoBase val2 = await ViewModel.BuscaCep(text); + if (val2 != null) + { + EnderecoBox.Text = val2.Endereco; + CidadeBox.Text = val2.Cidade; + EstadoBox.Text = val2.Estado; + BairroBox.Text = val2.Bairro; + } + } + } + + private void AbrirLog_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLog((TipoTela)24, ViewModel.SelectedFornecedor.Id); + } + + private void AbrirLogEmail_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLogEmail((TipoTela)24, ViewModel.SelectedFornecedor.Id); + } + + private async void CopiarDados_OnClick(object sender, RoutedEventArgs e) + { + Cliente cliente = await ViewModel.ShowCopiarCliente(); + if (cliente != null) + { + ViewModel.Incluir(); + Cliente val = cliente; + val.Enderecos = await new ClienteServico().BuscarEnderecosAsync(((DomainBase)cliente).Id); + val = cliente; + val.Telefones = await new ClienteServico().BuscarTelefonesAsync(((DomainBase)cliente).Id); + val = cliente; + val.Emails = await new ClienteServico().BuscarEmailsAsync(((DomainBase)cliente).Id); + ViewModel.Copiar(cliente); + } + } + + private void Excel_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Excel(); + } + + private void Imprimir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Imprimir(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/financeiro/fornecedorview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_007e: Unknown result type (might be due to invalid IL or missing references) + //IL_008a: Unknown result type (might be due to invalid IL or missing references) + //IL_0094: Expected O, but got Unknown + //IL_0095: Unknown result type (might be due to invalid IL or missing references) + //IL_00a1: Unknown result type (might be due to invalid IL or missing references) + //IL_00ab: Expected O, but got Unknown + //IL_00ad: Unknown result type (might be due to invalid IL or missing references) + //IL_00b9: Unknown result type (might be due to invalid IL or missing references) + //IL_00c3: Expected O, but got Unknown + //IL_00c5: Unknown result type (might be due to invalid IL or missing references) + //IL_00d1: Unknown result type (might be due to invalid IL or missing references) + //IL_00db: Expected O, but got Unknown + //IL_00de: Unknown result type (might be due to invalid IL or missing references) + //IL_00e8: Expected O, but got Unknown + //IL_00ea: Unknown result type (might be due to invalid IL or missing references) + //IL_00f6: Unknown result type (might be due to invalid IL or missing references) + //IL_0100: Expected O, but got Unknown + //IL_0102: Unknown result type (might be due to invalid IL or missing references) + //IL_010e: Unknown result type (might be due to invalid IL or missing references) + //IL_0118: Expected O, but got Unknown + //IL_011a: Unknown result type (might be due to invalid IL or missing references) + //IL_0126: Unknown result type (might be due to invalid IL or missing references) + //IL_0130: Expected O, but got Unknown + //IL_0132: Unknown result type (might be due to invalid IL or missing references) + //IL_013e: Unknown result type (might be due to invalid IL or missing references) + //IL_0148: Expected O, but got Unknown + //IL_014a: Unknown result type (might be due to invalid IL or missing references) + //IL_0156: Unknown result type (might be due to invalid IL or missing references) + //IL_0160: Expected O, but got Unknown + //IL_0162: Unknown result type (might be due to invalid IL or missing references) + //IL_016e: Unknown result type (might be due to invalid IL or missing references) + //IL_0178: Expected O, but got Unknown + //IL_017a: Unknown result type (might be due to invalid IL or missing references) + //IL_0186: Unknown result type (might be due to invalid IL or missing references) + //IL_0190: Expected O, but got Unknown + //IL_0192: Unknown result type (might be due to invalid IL or missing references) + //IL_019e: Unknown result type (might be due to invalid IL or missing references) + //IL_01a8: Expected O, but got Unknown + //IL_01aa: Unknown result type (might be due to invalid IL or missing references) + //IL_01b6: Unknown result type (might be due to invalid IL or missing references) + //IL_01c0: Expected O, but got Unknown + //IL_01c3: Unknown result type (might be due to invalid IL or missing references) + //IL_01cd: Expected O, but got Unknown + //IL_01d0: Unknown result type (might be due to invalid IL or missing references) + //IL_01da: Expected O, but got Unknown + //IL_01e8: Unknown result type (might be due to invalid IL or missing references) + //IL_01f2: Expected O, but got Unknown + //IL_01ff: Unknown result type (might be due to invalid IL or missing references) + //IL_0209: Expected O, but got Unknown + //IL_020c: Unknown result type (might be due to invalid IL or missing references) + //IL_0216: Expected O, but got Unknown + //IL_0219: Unknown result type (might be due to invalid IL or missing references) + //IL_0223: Expected O, but got Unknown + //IL_0230: Unknown result type (might be due to invalid IL or missing references) + //IL_023a: Expected O, but got Unknown + //IL_0248: Unknown result type (might be due to invalid IL or missing references) + //IL_0252: Expected O, but got Unknown + //IL_0255: Unknown result type (might be due to invalid IL or missing references) + //IL_025f: Expected O, but got Unknown + //IL_0262: Unknown result type (might be due to invalid IL or missing references) + //IL_026c: Expected O, but got Unknown + //IL_026f: Unknown result type (might be due to invalid IL or missing references) + //IL_0279: Expected O, but got Unknown + //IL_027c: Unknown result type (might be due to invalid IL or missing references) + //IL_0286: Expected O, but got Unknown + //IL_0289: Unknown result type (might be due to invalid IL or missing references) + //IL_0293: Expected O, but got Unknown + //IL_0295: Unknown result type (might be due to invalid IL or missing references) + //IL_02a2: Unknown result type (might be due to invalid IL or missing references) + //IL_02ac: Expected O, but got Unknown + //IL_02ae: Unknown result type (might be due to invalid IL or missing references) + //IL_02bb: Unknown result type (might be due to invalid IL or missing references) + //IL_02c5: Expected O, but got Unknown + //IL_02c8: Unknown result type (might be due to invalid IL or missing references) + //IL_02d2: Expected O, but got Unknown + //IL_02d5: Unknown result type (might be due to invalid IL or missing references) + //IL_02df: Expected O, but got Unknown + //IL_02e2: Unknown result type (might be due to invalid IL or missing references) + //IL_02ec: Expected O, but got Unknown + //IL_02ef: Unknown result type (might be due to invalid IL or missing references) + //IL_02f9: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteFornecedor_OnPopulating); + ((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBox_OnTextChanged); + break; + case 2: + ((MenuItem)target).Click += new RoutedEventHandler(Imprimir_OnClick); + break; + case 3: + ((MenuItem)target).Click += new RoutedEventHandler(Excel_OnClick); + break; + case 4: + FornecedorGrid = (DataGrid)target; + break; + case 5: + ((MenuItem)target).Click += new RoutedEventHandler(Incluir_OnClick); + break; + case 6: + ((MenuItem)target).Click += new RoutedEventHandler(CopiarDados_OnClick); + break; + case 7: + ((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick); + break; + case 8: + ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick); + break; + case 9: + ((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick); + break; + case 10: + ((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick); + break; + case 11: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirAquivoDigital_Click); + break; + case 12: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick); + break; + case 13: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLogEmail_OnClick); + break; + case 14: + NomeBox = (TextBox)target; + break; + case 15: + DocumentoPrincipalBox = (TextBox)target; + ((UIElement)DocumentoPrincipalBox).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + ((UIElement)DocumentoPrincipalBox).LostFocus += new RoutedEventHandler(DocumentoPrincipalBox_OnLostFocus); + break; + case 16: + AtivoBox = (ToggleButton)target; + break; + case 17: + CepBox = (TextBox)target; + ((UIElement)CepBox).LostFocus += new RoutedEventHandler(PostcodeBox_OnLostFocus); + ((UIElement)CepBox).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 18: + ProgressCep = (ProgressBar)target; + break; + case 19: + EnderecoBox = (TextBox)target; + break; + case 20: + BairroBox = (TextBox)target; + break; + case 21: + CidadeBox = (TextBox)target; + break; + case 22: + EstadoBox = (TextBox)target; + break; + case 23: + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(FormatarTelefone); + break; + case 24: + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(FormatarTelefone); + break; + case 25: + PlanoBox = (ComboBox)target; + break; + case 26: + CentroBox = (ComboBox)target; + break; + case 27: + ContaBox = (ComboBox)target; + break; + case 28: + TipoPagamentoBox = (ComboBox)target; + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Financeiro/InfoExtratoView.cs b/Decompiler/Gestor.Application.Views.Financeiro/InfoExtratoView.cs new file mode 100644 index 0000000..387a9f0 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Financeiro/InfoExtratoView.cs @@ -0,0 +1,148 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Media; +using System.Windows.Shapes; +using Gestor.Application.ViewModels.Financeiro; +using Gestor.Application.Views.Generic; +using Gestor.Model.Domain.Financeiro; + +namespace Gestor.Application.Views.Financeiro; + +public class InfoExtratoView : BaseUserControl, IComponentConnector +{ + private bool _buttonClickable; + + private bool _contentLoaded; + + public InfoExtratoViewModel ViewModel { get; set; } + + public InfoExtratoView(Saldo saldo, bool telaBancos = false) + { + ViewModel = new InfoExtratoViewModel(telaBancos); + ((FrameworkElement)this).DataContext = ViewModel; + ViewModel.SelectedSaldo = saldo; + InitializeComponent(); + } + + private void TopControls_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + //IL_0008: Unknown result type (might be due to invalid IL or missing references) + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + //IL_0030: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_003f: Expected O, but got Unknown + _buttonClickable = true; + ((Panel)(Grid)sender).Background = (Brush)((((FrameworkElement)(Grid)sender).Name == "CloseButton") ? new SolidColorBrush(Colors.Red) : new SolidColorBrush(Colors.DimGray)); + } + + private void TopControls_OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + if (_buttonClickable) + { + ((object)this).GetType().GetMethod(((FrameworkElement)(Grid)sender).Name + "_Click")?.Invoke(this, null); + } + } + + private static void TopControls_OnMouseEnter(object sender, MouseEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Unknown result type (might be due to invalid IL or missing references) + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_001d: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Unknown result type (might be due to invalid IL or missing references) + //IL_0038: Expected O, but got Unknown + //IL_0039: Unknown result type (might be due to invalid IL or missing references) + //IL_0044: Expected O, but got Unknown + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_0053: Unknown result type (might be due to invalid IL or missing references) + //IL_005d: Expected O, but got Unknown + ((Panel)(Grid)sender).Background = (Brush)((((FrameworkElement)(Grid)sender).Name == "CloseButton") ? new SolidColorBrush(Colors.IndianRed) : new SolidColorBrush(Colors.Gray)); + DependencyObject child = VisualTreeHelper.GetChild((DependencyObject)(Grid)sender, 0); + Path val = (Path)(object)((child is Path) ? child : null); + if (val != null) + { + ((Shape)val).Stroke = (Brush)new SolidColorBrush(Colors.White); + } + } + + private void TopControls_OnMouseLeave(object sender, MouseEventArgs e) + { + //IL_0008: Unknown result type (might be due to invalid IL or missing references) + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Unknown result type (might be due to invalid IL or missing references) + //IL_001c: Expected O, but got Unknown + //IL_001d: Unknown result type (might be due to invalid IL or missing references) + //IL_0028: Expected O, but got Unknown + //IL_0032: Unknown result type (might be due to invalid IL or missing references) + //IL_0037: Unknown result type (might be due to invalid IL or missing references) + //IL_0041: Expected O, but got Unknown + _buttonClickable = false; + ((Panel)(Grid)sender).Background = (Brush)new SolidColorBrush(Colors.Transparent); + DependencyObject child = VisualTreeHelper.GetChild((DependencyObject)(Grid)sender, 0); + Path val = (Path)(object)((child is Path) ? child : null); + if (val != null) + { + ((Shape)val).Stroke = (Brush)new SolidColorBrush(Colors.White); + } + } + + private async void Salvar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(); + bool num = list == null || list.Count == 0; + ViewModel.Loading(isLoading: false); + if (!num) + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/financeiro/infoextratoview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Expected O, but got Unknown + if (connectionId == 1) + { + ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick); + } + else + { + _contentLoaded = true; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Financeiro/PlanoView.cs b/Decompiler/Gestor.Application.Views.Financeiro/PlanoView.cs new file mode 100644 index 0000000..eaf4fca --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Financeiro/PlanoView.cs @@ -0,0 +1,116 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; +using Gestor.Application.Helpers; +using Gestor.Application.ViewModels.Financeiro; +using Gestor.Application.Views.Generic; +using Gestor.Model.Domain.Financeiro; +using Gestor.Model.Domain.Generic; + +namespace Gestor.Application.Views.Financeiro; + +public class PlanoView : BaseUserControl, IComponentConnector +{ + private bool _contentLoaded; + + public PlanoViewModel ViewModel { get; set; } + + public PlanoView(Plano plano) + { + ViewModel = new PlanoViewModel(plano); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + private void Incluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Incluir(); + } + + private void Alterar_OnClick(object sender, RoutedEventArgs e) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Expected O, but got Unknown + ViewModel.Cancel = (Plano)((DomainBase)ViewModel.SelectedPlano).Clone(); + ViewModel.Alterar(alterar: true); + } + + private void Cancelar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Cancelar(); + } + + private async void Salvar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(); + ((DependencyObject)(object)this).ValidateFields(list); + bool num = list == null || list.Count == 0; + ViewModel.Loading(isLoading: false); + if (!num) + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/financeiro/planoview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_001b: Unknown result type (might be due to invalid IL or missing references) + //IL_0027: Unknown result type (might be due to invalid IL or missing references) + //IL_0031: Expected O, but got Unknown + //IL_0033: Unknown result type (might be due to invalid IL or missing references) + //IL_003f: Unknown result type (might be due to invalid IL or missing references) + //IL_0049: Expected O, but got Unknown + //IL_004b: Unknown result type (might be due to invalid IL or missing references) + //IL_0057: Unknown result type (might be due to invalid IL or missing references) + //IL_0061: Expected O, but got Unknown + //IL_0063: Unknown result type (might be due to invalid IL or missing references) + //IL_006f: Unknown result type (might be due to invalid IL or missing references) + //IL_0079: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((MenuItem)target).Click += new RoutedEventHandler(Incluir_OnClick); + break; + case 2: + ((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick); + break; + case 3: + ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick); + break; + case 4: + ((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick); + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Financeiro/PlanosView.cs b/Decompiler/Gestor.Application.Views.Financeiro/PlanosView.cs new file mode 100644 index 0000000..42abf6d --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Financeiro/PlanosView.cs @@ -0,0 +1,326 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Threading; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels.Financeiro; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Financeiro; +using Gestor.Model.Domain.Generic; + +namespace Gestor.Application.Views.Financeiro; + +public class PlanosView : BaseUserControl, IComponentConnector +{ + [Serializable] + [CompilerGenerated] + private sealed class _003C_003Ec + { + public static readonly _003C_003Ec _003C_003E9 = new _003C_003Ec(); + + public static MouseButtonEventHandler _003C_003E9__3_0; + + public static Func<Plano, bool> _003C_003E9__3_1; + + public static Func<Plano, string> _003C_003E9__3_2; + + public static Func<Plano, bool> _003C_003E9__11_6; + + public static Func<Plano, string> _003C_003E9__11_7; + + public static Func<Planos, bool> _003C_003E9__11_0; + + public static Func<Planos, string> _003C_003E9__11_1; + + public static Func<Planos, string> _003C_003E9__11_2; + + public static Func<Planos, long> _003C_003E9__11_3; + + internal void _003CContentLoad_003Eb__3_0(object sender, MouseButtonEventArgs args) + { + } + + internal bool _003CContentLoad_003Eb__3_1(Plano x) + { + return x.Ativo; + } + + internal string _003CContentLoad_003Eb__3_2(Plano x) + { + return x.Descricao; + } + + internal bool _003CPlanoButton_OnClick_003Eb__11_6(Plano x) + { + return x.Ativo; + } + + internal string _003CPlanoButton_OnClick_003Eb__11_7(Plano x) + { + return x.Descricao; + } + + internal bool _003CPlanoButton_OnClick_003Eb__11_0(Planos x) + { + return x.Ativo; + } + + internal string _003CPlanoButton_OnClick_003Eb__11_1(Planos x) + { + Plano plano = x.Plano; + if (plano == null) + { + return null; + } + return plano.Descricao; + } + + internal string _003CPlanoButton_OnClick_003Eb__11_2(Planos x) + { + return x.Descricao; + } + + internal long _003CPlanoButton_OnClick_003Eb__11_3(Planos p) + { + return ((DomainBase)p).Id; + } + } + + private bool _seleciona = true; + + public PlanosViewModel ViewModel; + + internal DataGrid PlanosGrid; + + private bool _contentLoaded; + + public PlanosView() + { + ((FrameworkElement)this).Tag = "PLANO DE CONTAS"; + ViewModel = new PlanosViewModel(); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + } + + private async void ContentLoad() + { + ((Selector)PlanosGrid).SelectedIndex = 0; + ((Selector)PlanosGrid).SelectionChanged += new SelectionChangedEventHandler(PlanosGrid_OnSelectionChanged); + DataGrid planosGrid = PlanosGrid; + object obj = _003C_003Ec._003C_003E9__3_0; + if (obj == null) + { + MouseButtonEventHandler val = delegate + { + }; + _003C_003Ec._003C_003E9__3_0 = val; + obj = (object)val; + } + ((Control)planosGrid).MouseDoubleClick += (MouseButtonEventHandler)obj; + PlanosViewModel viewModel = ViewModel; + viewModel.Plano = new ObservableCollection<Plano>((from x in await new BaseServico().BuscarPlanoAsync() + orderby x.Ativo descending, x.Descricao + select x).ToList()); + } + + private async void PlanosGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + if (_seleciona) + { + DataGrid val = (DataGrid)sender; + if (val == null || ((Selector)val).SelectedIndex >= 0) + { + await ViewModel.SelecionaPlanos((Planos)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null)); + } + } + } + + private void CancelarPlanos_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.CancelarAlteracao(); + } + + private async void SalvarPlanos_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(); + ((DependencyObject)(object)this).ValidateFields(list); + bool num = list == null || list.Count == 0; + ViewModel.Loading(isLoading: false); + if (!num) + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + } + + private void AlterarPlanos_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Alterar(alterar: true); + ((DomainBase)ViewModel.SelectedPlanos).Initialize(); + } + + private void IncluirPlanos_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Incluir(); + } + + private void AutoCompleteBoxPlanos_OnTextChanged(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + if (string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).Text)) + { + ViewModel.FiltrarPlanos(""); + } + } + + private void AutoCompleteBoxPlanos_Populating(object sender, PopulatingEventArgs e) + { + e.Cancel = true; + ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<ObservableCollection<Planos>> searchResult) + { + //IL_000a: Unknown result type (might be due to invalid IL or missing references) + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + if (searchResult != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private async void PlanoButton_OnClick(object sender, RoutedEventArgs e) + { + PlanoView planoView = new PlanoView(ViewModel.SelectedPlanos.Plano); + ((Window)new HosterWindow((ContentControl)(object)planoView, "PLANO", 500.0, 200.0)).ShowDialog(); + ViewModel.Loading(isLoading: true); + if (((DomainBase)planoView.ViewModel.SelectedPlano).Id != 0L) + { + PlanosViewModel viewModel = ViewModel; + viewModel.Plano = new ObservableCollection<Plano>((from x in await new BaseServico().BuscarPlanoAsync() + orderby x.Ativo descending, x.Descricao + select x).ToList()); + List<Planos> source = await new BaseServico().BuscarPlanosAsync(); + ViewModel.Planos = source.OrderByDescending((Planos x) => x.Ativo).ThenBy(delegate(Planos x) + { + Plano plano = x.Plano; + return (plano == null) ? null : plano.Descricao; + }).ThenBy((Planos x) => x.Descricao) + .ToList(); + List<long> ids = ViewModel.PlanosFiltrados.Select((Planos p) => ((DomainBase)p).Id).ToList(); + ViewModel.PlanosFiltrados = new ObservableCollection<Planos>(ViewModel.Planos.Where((Planos x) => ids.Contains(((DomainBase)x).Id))); + _seleciona = false; + ((Selector)PlanosGrid).SelectedItem = ViewModel.SelectedPlanos; + ViewModel.SelectedPlano = ViewModel.Plano.First((Plano x) => ((DomainBase)x).Id == ((DomainBase)planoView.ViewModel.SelectedPlano).Id); + _seleciona = true; + } + ViewModel.Loading(isLoading: false); + } + + private void AbrirLog_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLog((TipoTela)28, ((DomainBase)ViewModel.SelectedPlanos).Id); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/financeiro/planosview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_003a: Unknown result type (might be due to invalid IL or missing references) + //IL_0044: Expected O, but got Unknown + //IL_0045: Unknown result type (might be due to invalid IL or missing references) + //IL_0051: Unknown result type (might be due to invalid IL or missing references) + //IL_005b: Expected O, but got Unknown + //IL_005e: Unknown result type (might be due to invalid IL or missing references) + //IL_0068: Expected O, but got Unknown + //IL_006a: Unknown result type (might be due to invalid IL or missing references) + //IL_0076: Unknown result type (might be due to invalid IL or missing references) + //IL_0080: Expected O, but got Unknown + //IL_0082: Unknown result type (might be due to invalid IL or missing references) + //IL_008e: Unknown result type (might be due to invalid IL or missing references) + //IL_0098: Expected O, but got Unknown + //IL_009a: Unknown result type (might be due to invalid IL or missing references) + //IL_00a6: Unknown result type (might be due to invalid IL or missing references) + //IL_00b0: Expected O, but got Unknown + //IL_00b2: Unknown result type (might be due to invalid IL or missing references) + //IL_00be: Unknown result type (might be due to invalid IL or missing references) + //IL_00c8: Expected O, but got Unknown + //IL_00ca: Unknown result type (might be due to invalid IL or missing references) + //IL_00d6: Unknown result type (might be due to invalid IL or missing references) + //IL_00e0: Expected O, but got Unknown + //IL_00e2: Unknown result type (might be due to invalid IL or missing references) + //IL_00ee: Unknown result type (might be due to invalid IL or missing references) + //IL_00f8: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBoxPlanos_Populating); + ((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBoxPlanos_OnTextChanged); + break; + case 2: + PlanosGrid = (DataGrid)target; + break; + case 3: + ((MenuItem)target).Click += new RoutedEventHandler(IncluirPlanos_OnClick); + break; + case 4: + ((MenuItem)target).Click += new RoutedEventHandler(AlterarPlanos_OnClick); + break; + case 5: + ((MenuItem)target).Click += new RoutedEventHandler(SalvarPlanos_OnClick); + break; + case 6: + ((MenuItem)target).Click += new RoutedEventHandler(CancelarPlanos_OnClick); + break; + case 7: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick); + break; + case 8: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(PlanoButton_OnClick); + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Generic/BaseUserControl.cs b/Decompiler/Gestor.Application.Views.Generic/BaseUserControl.cs new file mode 100644 index 0000000..db2278d --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Generic/BaseUserControl.cs @@ -0,0 +1,102 @@ +using System; +using System.Text.RegularExpressions; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using Gestor.Application.Helpers; +using Gestor.Common.Validation; +using Gestor.Model.Common; + +namespace Gestor.Application.Views.Generic; + +public class BaseUserControl : UserControl +{ + public virtual TipoTela Tela { get; set; } + + public virtual void SomenteNumeros(object sender, TextCompositionEventArgs e) + { + Regex regex = new Regex("[^0-9]+"); + ((RoutedEventArgs)e).Handled = regex.IsMatch(e.Text); + } + + public virtual void LetrasHabilitacao(object sender, TextCompositionEventArgs e) + { + Regex regex = new Regex("[^a-eA-E]+"); + ((RoutedEventArgs)e).Handled = regex.IsMatch(e.Text); + } + + public virtual void Placa(object sender, TextCompositionEventArgs e) + { + Regex regex = new Regex("[^a-zA-Z0-9]+"); + ((RoutedEventArgs)e).Handled = regex.IsMatch(e.Text); + } + + public virtual void FormatarTelefone(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + TextBox val = (TextBox)sender; + if (!string.IsNullOrWhiteSpace(val.Text)) + { + val.Text = ValidationHelper.FormatarTelefone(val.Text); + } + } + + public virtual void FormatarDocumento(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + TextBox val = (TextBox)sender; + val.Text = ValidationHelper.FormatDocument(val.Text); + } + + public void DatePicker_OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + DatePicker val = (DatePicker)sender; + val.Text = ValidationHelper.FormatDate(val.Text); + if (string.IsNullOrEmpty(val.Text)) + { + val.DisplayDate = DateTime.Today; + } + } + + public void DataAtual_OnDoubleClick(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + ((DatePicker)sender).SelectedDate = Funcoes.GetNetworkTime().Date; + } + + public void DatePicker_PreviewKeyDown(object sender, KeyEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Invalid comparison between Unknown and I4 + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + if ((int)e.Key == 6) + { + ((DatePicker)sender).Text = Funcoes.GetNetworkTime().Date.ToString("dd/MM/yyyy"); + } + } + + public void ScrollViewer_PreviewMouseWheel(object sender, MouseWheelEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + ScrollViewer val = (ScrollViewer)sender; + val.ScrollToVerticalOffset(val.VerticalOffset - (double)e.Delta); + ((RoutedEventArgs)e).Handled = true; + } + + public void SomenteCaracteres(object sender, TextCompositionEventArgs e) + { + Regex regex = new Regex("[^a-zA-Z]+$"); + ((RoutedEventArgs)e).Handled = regex.IsMatch(e.Text); + } + + public void SomenteData(object sender, TextCompositionEventArgs e) + { + Regex regex = new Regex("[^0-9/-]+"); + ((RoutedEventArgs)e).Handled = regex.IsMatch(e.Text); + } +} diff --git a/Decompiler/Gestor.Application.Views.Generic/DragOverPopup.cs b/Decompiler/Gestor.Application.Views.Generic/DragOverPopup.cs new file mode 100644 index 0000000..22d7b65 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Generic/DragOverPopup.cs @@ -0,0 +1,61 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; +using Gestor.Model.Domain.Ferramentas; + +namespace Gestor.Application.Views.Generic; + +public class DragOverPopup : UserControl, IComponentConnector +{ + internal TextBlock Titulo; + + internal TextBlock Descricao; + + private bool _contentLoaded; + + public DragOverPopup(Tarefa tarefa) + { + InitializeComponent(); + Titulo.Text = tarefa.Titulo; + Descricao.Text = tarefa.Descricao; + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/generic/dragoverpopup.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_0016: Expected O, but got Unknown + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_0023: Expected O, but got Unknown + switch (connectionId) + { + case 1: + Titulo = (TextBlock)target; + break; + case 2: + Descricao = (TextBlock)target; + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Generic/ErrorWindow.cs b/Decompiler/Gestor.Application.Views.Generic/ErrorWindow.cs new file mode 100644 index 0000000..180c775 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Generic/ErrorWindow.cs @@ -0,0 +1,110 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Markup; +using Gestor.Application.Helpers; +using Gestor.Common.Validation; +using Gestor.Model.API; + +namespace Gestor.Application.Views.Generic; + +public class ErrorWindow : Window, IComponentConnector +{ + internal TextBlock DescricaoErro; + + internal RepeatButton ContinuarButton; + + private bool _contentLoaded; + + public ErrorWindow(TipoErro tipo, bool fecharSistema = false) + { + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + InitializeComponent(); + HanddleErro(tipo); + if (fecharSistema) + { + ((UIElement)ContinuarButton).Visibility = (Visibility)2; + } + } + + private void HanddleErro(TipoErro tipo) + { + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0018: Invalid comparison between Unknown and I4 + DescricaoErro.Text = ValidationHelper.GetCategory((Enum)(object)tipo); + if ((int)tipo != 3) + { + ((UIElement)ContinuarButton).Visibility = (Visibility)0; + } + else + { + ((UIElement)ContinuarButton).Visibility = (Visibility)2; + } + } + + private void ContinuarButton_OnClick(object sender, RoutedEventArgs e) + { + ((Window)this).Close(); + } + + private void Reiniciar_OnClick(object sender, RoutedEventArgs e) + { + Shutdown(); + } + + private void Shutdown() + { + Instancia.ExcluirCfg(); + Process.Start(Application.ResourceAssembly.Location, ApplicationHelper.Conectado ? "INICIAR CONECTADO" : "INICIAR"); + Application.Current.Shutdown(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/generic/errorwindow.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0018: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Expected O, but got Unknown + //IL_0025: Unknown result type (might be due to invalid IL or missing references) + //IL_002f: Expected O, but got Unknown + //IL_003c: Unknown result type (might be due to invalid IL or missing references) + //IL_0046: Expected O, but got Unknown + //IL_0048: Unknown result type (might be due to invalid IL or missing references) + //IL_0054: Unknown result type (might be due to invalid IL or missing references) + //IL_005e: Expected O, but got Unknown + switch (connectionId) + { + case 1: + DescricaoErro = (TextBlock)target; + break; + case 2: + ContinuarButton = (RepeatButton)target; + ((ButtonBase)ContinuarButton).Click += new RoutedEventHandler(ContinuarButton_OnClick); + break; + case 3: + ((ButtonBase)(RepeatButton)target).Click += new RoutedEventHandler(Reiniciar_OnClick); + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Generic/HosterWindow.cs b/Decompiler/Gestor.Application.Views.Generic/HosterWindow.cs new file mode 100644 index 0000000..322b115 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Generic/HosterWindow.cs @@ -0,0 +1,524 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Runtime.InteropServices; +using System.Threading; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Forms; +using System.Windows.Input; +using System.Windows.Interop; +using System.Windows.Markup; +using System.Windows.Media; +using System.Windows.Shapes; +using System.Windows.Shell; +using System.Windows.Threading; +using Gestor.Application.Actions; +using MaterialDesignThemes.Wpf; + +namespace Gestor.Application.Views.Generic; + +public class HosterWindow : Window, IComponentConnector +{ + private enum MonitorOptions : uint + { + MonitorDefaulttoprimary = 1u, + MonitorDefaulttonearest + } + + public struct Point + { + public int X; + + public int Y; + + public Point(int x, int y) + { + X = x; + Y = y; + } + } + + private struct Minmaxinfo + { + private readonly Point ptReserved; + + public Point ptMaxSize; + + public Point ptMaxPosition; + + private readonly Point ptMinTrackSize; + + private readonly Point ptMaxTrackSize; + } + + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] + private class Monitorinfo + { + private readonly int cbSize = Marshal.SizeOf(typeof(Monitorinfo)); + + public readonly Rect rcMonitor; + + public readonly Rect rcWork; + + private readonly int dwFlags; + } + + public struct Rect + { + public int Left; + + public int Top; + + public int Right; + + public int Bottom; + } + + private bool _buttonClickable; + + internal WindowChrome WindowChrome; + + internal Grid Menu; + + internal Grid MinimizeButton; + + internal Path MinimizeButtonPath; + + internal Grid MaximizeButton; + + internal Path MaximizeButtonPath; + + internal Grid CloseButton; + + internal ContentControl ContentControl; + + internal DialogHost HosterDialog; + + internal DrawerHost DrawerHost; + + internal Snackbar Snackbar; + + private bool _contentLoaded; + + public string Tela { get; set; } + + private IntPtr WindowProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) + { + if (msg == 36) + { + WmGetMinMaxInfo(lParam); + } + return IntPtr.Zero; + } + + private void WmGetMinMaxInfo(IntPtr lParam) + { + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + ((FrameworkElement)this).MaxHeight = Screen.FromHandle(new WindowInteropHelper((Window)(object)this).Handle).WorkingArea.Height; + GetCursorPos(out var lpPoint); + IntPtr hMonitor = MonitorFromPoint(new Point(0, 0), MonitorOptions.MonitorDefaulttoprimary); + Monitorinfo monitorinfo = new Monitorinfo(); + if (GetMonitorInfo(hMonitor, monitorinfo)) + { + IntPtr intPtr = MonitorFromPoint(lpPoint, MonitorOptions.MonitorDefaulttonearest); + Minmaxinfo structure = (Minmaxinfo)Marshal.PtrToStructure(lParam, typeof(Minmaxinfo)); + if (hMonitor.Equals((object?)(nint)intPtr)) + { + structure.ptMaxPosition.X = monitorinfo.rcWork.Left; + structure.ptMaxPosition.Y = monitorinfo.rcWork.Top; + structure.ptMaxSize.X = monitorinfo.rcWork.Right - monitorinfo.rcWork.Left; + structure.ptMaxSize.Y = monitorinfo.rcWork.Bottom - monitorinfo.rcWork.Top; + } + else + { + structure.ptMaxPosition.X = monitorinfo.rcMonitor.Left; + structure.ptMaxPosition.Y = monitorinfo.rcMonitor.Top; + structure.ptMaxSize.X = monitorinfo.rcMonitor.Right - monitorinfo.rcMonitor.Left; + structure.ptMaxSize.Y = monitorinfo.rcMonitor.Bottom - monitorinfo.rcMonitor.Top; + } + Marshal.StructureToPtr(structure, lParam, fDeleteOld: true); + } + } + + [DllImport("user32.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + private static extern bool GetCursorPos(out Point lpPoint); + + [DllImport("user32.dll", SetLastError = true)] + private static extern IntPtr MonitorFromPoint(Point pt, MonitorOptions dwFlags); + + [DllImport("user32.dll")] + private static extern bool GetMonitorInfo(IntPtr hMonitor, Monitorinfo lpmi); + + private void TopControls_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + //IL_0008: Unknown result type (might be due to invalid IL or missing references) + //IL_005a: Unknown result type (might be due to invalid IL or missing references) + //IL_005f: Unknown result type (might be due to invalid IL or missing references) + //IL_0064: Unknown result type (might be due to invalid IL or missing references) + //IL_006e: Expected O, but got Unknown + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_0033: Expected O, but got Unknown + //IL_0034: Unknown result type (might be due to invalid IL or missing references) + //IL_003f: Expected O, but got Unknown + //IL_0049: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_0058: Expected O, but got Unknown + _buttonClickable = true; + if (((FrameworkElement)(Grid)sender).Name == "CloseButton") + { + ((Panel)(Grid)sender).Background = (Brush)new SolidColorBrush(Colors.Red); + DependencyObject child = VisualTreeHelper.GetChild((DependencyObject)(Grid)sender, 0); + Path val = (Path)(object)((child is Path) ? child : null); + if (val != null) + { + ((Shape)val).Stroke = (Brush)new SolidColorBrush(Colors.Black); + } + } + else + { + ((Panel)(Grid)sender).Background = (Brush)new SolidColorBrush(Colors.DimGray); + } + } + + private void TopControls_OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + if (_buttonClickable) + { + ((object)this).GetType().GetMethod(((FrameworkElement)(Grid)sender).Name + "_Click")?.Invoke(this, null); + } + } + + private static void TopControls_OnMouseEnter(object sender, MouseEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Unknown result type (might be due to invalid IL or missing references) + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_001d: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Unknown result type (might be due to invalid IL or missing references) + //IL_0038: Expected O, but got Unknown + //IL_0039: Unknown result type (might be due to invalid IL or missing references) + //IL_0044: Expected O, but got Unknown + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_0053: Unknown result type (might be due to invalid IL or missing references) + //IL_005d: Expected O, but got Unknown + ((Panel)(Grid)sender).Background = (Brush)((((FrameworkElement)(Grid)sender).Name == "CloseButton") ? new SolidColorBrush(Colors.IndianRed) : new SolidColorBrush(Colors.Gray)); + DependencyObject child = VisualTreeHelper.GetChild((DependencyObject)(Grid)sender, 0); + Path val = (Path)(object)((child is Path) ? child : null); + if (val != null) + { + ((Shape)val).Stroke = (Brush)new SolidColorBrush(Colors.White); + } + } + + private void TopControls_OnMouseLeave(object sender, MouseEventArgs e) + { + //IL_0008: Unknown result type (might be due to invalid IL or missing references) + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Unknown result type (might be due to invalid IL or missing references) + //IL_001c: Expected O, but got Unknown + //IL_001d: Unknown result type (might be due to invalid IL or missing references) + //IL_0028: Expected O, but got Unknown + //IL_0032: Unknown result type (might be due to invalid IL or missing references) + //IL_0037: Unknown result type (might be due to invalid IL or missing references) + //IL_0041: Expected O, but got Unknown + _buttonClickable = false; + ((Panel)(Grid)sender).Background = (Brush)new SolidColorBrush(Colors.Transparent); + DependencyObject child = VisualTreeHelper.GetChild((DependencyObject)(Grid)sender, 0); + Path val = (Path)(object)((child is Path) ? child : null); + if (val != null) + { + ((Shape)val).Stroke = (Brush)new SolidColorBrush(Colors.White); + } + } + + public void MinimizeButton_Click() + { + ((Window)this).WindowState = (WindowState)1; + } + + public void MaximizeButton_Click() + { + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + ((Window)this).WindowState = (WindowState)(((int)((Window)this).WindowState == 0) ? 2 : 0); + } + + public void CloseButton_Click() + { + ((Window)this).Close(); + } + + protected sealed override void OnStateChanged(EventArgs e) + { + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + //IL_0008: Invalid comparison between Unknown and I4 + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + //IL_0025: Invalid comparison between Unknown and I4 + //IL_002c: Unknown result type (might be due to invalid IL or missing references) + //IL_003d: Unknown result type (might be due to invalid IL or missing references) + //IL_0043: Invalid comparison between Unknown and I4 + //IL_0058: Unknown result type (might be due to invalid IL or missing references) + //IL_005e: Invalid comparison between Unknown and I4 + ((Control)this).BorderThickness = new Thickness((double)(((int)((Window)this).WindowState != 2) ? 1 : 0)); + WindowChrome.ResizeBorderThickness = new Thickness((double)(((int)((Window)this).WindowState != 2) ? 4 : 0)); + WindowChrome.CaptionHeight = (((int)((Window)this).WindowState == 2) ? 32 : 29); + MaximizeButtonPath.Data = (((int)((Window)this).WindowState == 2) ? Geometry.Parse((string)Application.Current.Resources[(object)"Restore"]) : Geometry.Parse((string)Application.Current.Resources[(object)"Maximize"])); + ((Window)this).OnStateChanged(e); + } + + private void Window_OnInitialized(object sender, EventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_0023: Unknown result type (might be due to invalid IL or missing references) + //IL_002d: Expected O, but got Unknown + WindowInteropHelper val = new WindowInteropHelper((Window)(object)this); + val.EnsureHandle(); + HwndSource obj = HwndSource.FromHwnd(val.Handle); + if (obj != null) + { + obj.AddHook(new HwndSourceHook(WindowProc)); + } + } + + public HosterWindow(ContentControl control, string titulo, double? x = null, double? y = null, bool canMaximize = false) + { + //IL_0059: Unknown result type (might be due to invalid IL or missing references) + //IL_0063: Expected O, but got Unknown + //IL_0070: Unknown result type (might be due to invalid IL or missing references) + //IL_007a: Expected O, but got Unknown + //IL_0087: Unknown result type (might be due to invalid IL or missing references) + //IL_0091: Expected O, but got Unknown + //IL_009e: Unknown result type (might be due to invalid IL or missing references) + //IL_00a8: Expected O, but got Unknown + //IL_00b5: Unknown result type (might be due to invalid IL or missing references) + //IL_00bf: Expected O, but got Unknown + //IL_00cc: Unknown result type (might be due to invalid IL or missing references) + //IL_00d6: Expected O, but got Unknown + //IL_0154: Unknown result type (might be due to invalid IL or missing references) + //IL_016d: Unknown result type (might be due to invalid IL or missing references) + //IL_02c8: Unknown result type (might be due to invalid IL or missing references) + //IL_02cd: Unknown result type (might be due to invalid IL or missing references) + //IL_02d7: Expected O, but got Unknown + //IL_02dd: Unknown result type (might be due to invalid IL or missing references) + //IL_02e2: Unknown result type (might be due to invalid IL or missing references) + //IL_02ec: Expected O, but got Unknown + InitializeComponent(); + Gestor.Application.Actions.Actions.EnableMainMenu = (Action<bool>)Delegate.Combine(Gestor.Application.Actions.Actions.EnableMainMenu, new Action<bool>(HabilitarMenu)); + Gestor.Application.Actions.Actions.CloseHoster = (Action)Delegate.Combine(Gestor.Application.Actions.Actions.CloseHoster, new Action(base.Close)); + ((UIElement)MinimizeButton).MouseEnter += new MouseEventHandler(TopControls_OnMouseEnter); + ((UIElement)MinimizeButton).MouseLeave += new MouseEventHandler(TopControls_OnMouseLeave); + ((UIElement)MaximizeButton).MouseEnter += new MouseEventHandler(TopControls_OnMouseEnter); + ((UIElement)MaximizeButton).MouseLeave += new MouseEventHandler(TopControls_OnMouseLeave); + ((UIElement)CloseButton).MouseEnter += new MouseEventHandler(TopControls_OnMouseEnter); + ((UIElement)CloseButton).MouseLeave += new MouseEventHandler(TopControls_OnMouseLeave); + ContentControl.Content = control.Content; + ((FrameworkElement)ContentControl).DataContext = ((FrameworkElement)control).DataContext; + ((FrameworkElement)ContentControl).Tag = titulo; + MaximizeButtonPath.Data = Geometry.Parse((string)Application.Current.Resources[(object)"Restore"]); + if ((x.HasValue || y.HasValue) && !canMaximize) + { + ((Window)this).WindowState = (WindowState)0; + ((Control)this).BorderThickness = new Thickness(1.0); + WindowChrome.ResizeBorderThickness = new Thickness(4.0); + WindowChrome.CaptionHeight = 30.0; + MaximizeButtonPath.Data = Geometry.Parse((string)Application.Current.Resources[(object)"Maximize"]); + } + if (x.HasValue) + { + if (x.Value < ((FrameworkElement)this).Width) + { + ((FrameworkElement)this).MinWidth = x.Value; + if (!canMaximize) + { + ((FrameworkElement)this).Width = x.Value; + ((FrameworkElement)this).MaxWidth = x.Value; + } + } + else + { + if (!canMaximize) + { + ((FrameworkElement)this).MaxWidth = x.Value; + ((FrameworkElement)this).Width = x.Value; + } + ((FrameworkElement)this).MinWidth = x.Value; + } + } + if (y.HasValue) + { + if (y.Value < ((FrameworkElement)this).Height) + { + ((FrameworkElement)this).MinHeight = y.Value; + if (!canMaximize) + { + ((FrameworkElement)this).Height = y.Value; + ((FrameworkElement)this).MaxHeight = y.Value; + } + } + else + { + if (!canMaximize) + { + ((FrameworkElement)this).MaxHeight = y.Value; + ((FrameworkElement)this).Height = y.Value; + } + ((FrameworkElement)this).MinHeight = y.Value; + } + } + if (x.HasValue && y.HasValue && !canMaximize) + { + ((UIElement)MaximizeButton).IsEnabled = false; + ((UIElement)MinimizeButton).IsEnabled = false; + ((Shape)MaximizeButtonPath).Stroke = (Brush)new SolidColorBrush(Colors.Gray); + ((Shape)MinimizeButtonPath).Stroke = (Brush)new SolidColorBrush(Colors.Gray); + } + else + { + ((Window)this).ResizeMode = (ResizeMode)2; + } + ((Window)this).Title = titulo; + Tela = ((object)control).GetType().Name; + HosterDialog.Identifier = $"Dialog{Tela}{Guid.NewGuid()}"; + } + + private void HabilitarMenu(bool enable) + { + ((UIElement)Menu).IsEnabled = enable; + } + + private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e) + { + Snackbar.IsActive = false; + } + + private void HosterWindow_OnLoaded(object sender, RoutedEventArgs e) + { + Task.Run(delegate + { + Thread.Sleep(500); + ((DispatcherObject)Application.Current).Dispatcher.Invoke((Action)delegate + { + ((Window)this).Topmost = false; + }); + }); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/generic/hosterwindow.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0065: Unknown result type (might be due to invalid IL or missing references) + //IL_006f: Expected O, but got Unknown + //IL_0072: Unknown result type (might be due to invalid IL or missing references) + //IL_007c: Expected O, but got Unknown + //IL_007f: Unknown result type (might be due to invalid IL or missing references) + //IL_0089: Expected O, but got Unknown + //IL_008c: Unknown result type (might be due to invalid IL or missing references) + //IL_0096: Expected O, but got Unknown + //IL_00a3: Unknown result type (might be due to invalid IL or missing references) + //IL_00ad: Expected O, but got Unknown + //IL_00ba: Unknown result type (might be due to invalid IL or missing references) + //IL_00c4: Expected O, but got Unknown + //IL_00c7: Unknown result type (might be due to invalid IL or missing references) + //IL_00d1: Expected O, but got Unknown + //IL_00d4: Unknown result type (might be due to invalid IL or missing references) + //IL_00de: Expected O, but got Unknown + //IL_00eb: Unknown result type (might be due to invalid IL or missing references) + //IL_00f5: Expected O, but got Unknown + //IL_0102: Unknown result type (might be due to invalid IL or missing references) + //IL_010c: Expected O, but got Unknown + //IL_010f: Unknown result type (might be due to invalid IL or missing references) + //IL_0119: Expected O, but got Unknown + //IL_011c: Unknown result type (might be due to invalid IL or missing references) + //IL_0126: Expected O, but got Unknown + //IL_0133: Unknown result type (might be due to invalid IL or missing references) + //IL_013d: Expected O, but got Unknown + //IL_014a: Unknown result type (might be due to invalid IL or missing references) + //IL_0154: Expected O, but got Unknown + //IL_0157: Unknown result type (might be due to invalid IL or missing references) + //IL_0161: Expected O, but got Unknown + //IL_0164: Unknown result type (might be due to invalid IL or missing references) + //IL_016e: Expected O, but got Unknown + //IL_0171: Unknown result type (might be due to invalid IL or missing references) + //IL_017b: Expected O, but got Unknown + //IL_017e: Unknown result type (might be due to invalid IL or missing references) + //IL_0188: Expected O, but got Unknown + //IL_018a: Unknown result type (might be due to invalid IL or missing references) + //IL_0196: Unknown result type (might be due to invalid IL or missing references) + //IL_01a0: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((FrameworkElement)(HosterWindow)target).Initialized += Window_OnInitialized; + ((FrameworkElement)(HosterWindow)target).Loaded += new RoutedEventHandler(HosterWindow_OnLoaded); + break; + case 2: + WindowChrome = (WindowChrome)target; + break; + case 3: + Menu = (Grid)target; + break; + case 4: + MinimizeButton = (Grid)target; + ((UIElement)MinimizeButton).MouseLeftButtonDown += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonDown); + ((UIElement)MinimizeButton).MouseLeftButtonUp += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonUp); + break; + case 5: + MinimizeButtonPath = (Path)target; + break; + case 6: + MaximizeButton = (Grid)target; + ((UIElement)MaximizeButton).MouseLeftButtonDown += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonDown); + ((UIElement)MaximizeButton).MouseLeftButtonUp += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonUp); + break; + case 7: + MaximizeButtonPath = (Path)target; + break; + case 8: + CloseButton = (Grid)target; + ((UIElement)CloseButton).MouseLeftButtonDown += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonDown); + ((UIElement)CloseButton).MouseLeftButtonUp += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonUp); + break; + case 9: + ContentControl = (ContentControl)target; + break; + case 10: + HosterDialog = (DialogHost)target; + break; + case 11: + DrawerHost = (DrawerHost)target; + break; + case 12: + Snackbar = (Snackbar)target; + break; + case 13: + ((SnackbarMessage)target).ActionClick += new RoutedEventHandler(SnackbarMessage_ActionClick); + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Menus/DashboardView.cs b/Decompiler/Gestor.Application.Views.Menus/DashboardView.cs new file mode 100644 index 0000000..5c2ffe1 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Menus/DashboardView.cs @@ -0,0 +1,926 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Threading; +using Gestor.Application.Drawers; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.ViewModels; +using Gestor.Application.Views.Generic; +using Gestor.Application.Views.Seguros; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Relatorios.ClientesAtivosInativos; +using Gestor.Model.Domain.Relatorios.Dashboard; +using Gestor.Model.Domain.Relatorios.Renovacao; +using Gestor.Model.Domain.Seguros; +using MaterialDesignThemes.Wpf; + +namespace Gestor.Application.Views.Menus; + +public class DashboardView : BaseUserControl, IComponentConnector, IStyleConnector +{ + internal Chip UsuarioChip; + + internal Button TileRenovacao; + + internal Button TileAniversariantes; + + internal Button TileTarefas; + + internal Button TileSinistro; + + internal Button TileProspeccao; + + internal TextBox TituloBox; + + internal TextBox DescricaoBox; + + internal Grid RenovacaoGrid; + + internal Grid AniversariantesGrid; + + internal Grid TarefasGrid; + + internal Grid ProspeccaoGrid; + + internal DatePicker InicioBox; + + internal DatePicker FimBox; + + internal ComboBox FiltroDocumento; + + internal Grid SinistroGrid; + + internal DatePicker InicioBox2; + + internal DatePicker FimBox2; + + private bool _contentLoaded; + + public DashboardViewModel ViewModel { get; set; } + + public DashboardView(DashboardViewModel viewModel) + { + ((FrameworkElement)this).Tag = "DASHBOARD"; + ViewModel = viewModel; + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + } + + private async void ContentLoad() + { + ((ContentControl)UsuarioChip).Content = Recursos.Usuario.Nome; + await ViewModel.BuscarRestricoes(); + await ViewModel.CarregarNotas(); + await ViewModel.CarregarFiltros(); + bool num = ViewModel.Restricoes.Any((RestricaoUsuario x) => (int)x.Tipo == 24 && x.Restricao); + bool num2 = ViewModel.Restricoes.Any((RestricaoUsuario x) => (int)x.Tipo == 49 && x.Restricao); + bool num3 = ViewModel.Permissoes.Any((PermissaoUsuario x) => (int)x.Tela == 38 && !x.Consultar); + bool num4 = !Recursos.Usuario.PermissaoAggilizador.HasValue; + bool flag = ViewModel.Restricoes.Any((RestricaoUsuario x) => (int)x.Tipo == 25 && x.Restricao); + ((Selector)FiltroDocumento).SelectedIndex = 0; + List<Task> list = new List<Task>(); + if (!num4) + { + ViewModel.CarregarRamos(); + ((UIElement)TileProspeccao).Visibility = (Visibility)0; + if (!InicioBox.SelectedDate.HasValue) + { + InicioBox.SelectedDate = DateTime.Today; + } + if (!FimBox.SelectedDate.HasValue) + { + FimBox.SelectedDate = InicioBox.SelectedDate.Value; + } + list.Add(ViewModel.CarregarProspect(InicioBox.SelectedDate.Value, FimBox.SelectedDate.Value)); + } + else + { + ((UIElement)TileProspeccao).Visibility = (Visibility)2; + } + if (!num3) + { + ((UIElement)TileTarefas).Visibility = (Visibility)0; + ViewModel.SelectedTile = 3; + list.Add(ViewModel.CarregarTarefas()); + } + else + { + ((UIElement)TileTarefas).Visibility = (Visibility)2; + } + if (!num2) + { + ((UIElement)TileAniversariantes).Visibility = (Visibility)0; + ViewModel.SelectedTile = 2; + list.Add(ViewModel.CarregarAniversariantes()); + } + else + { + ((UIElement)TileAniversariantes).Visibility = (Visibility)2; + } + if (!flag) + { + ((UIElement)TileSinistro).Visibility = (Visibility)0; + ViewModel.SelectedTile = 5; + list.Add(ViewModel.CarregarSinistros()); + } + else + { + ((UIElement)TileSinistro).Visibility = (Visibility)2; + } + if (!num) + { + ((UIElement)TileRenovacao).Visibility = (Visibility)0; + ViewModel.SelectedTile = 1; + list.Add(ViewModel.CarregarRenovacoes()); + } + else + { + ((UIElement)TileRenovacao).Visibility = (Visibility)2; + } + await Task.WhenAll(list); + ViewModel.Load = false; + } + + private async void ExcluirNota_OnClick(object sender, RoutedEventArgs e) + { + object dataContext = ((FrameworkElement)(Button)sender).DataContext; + Tarefa val = (Tarefa)((dataContext is Tarefa) ? dataContext : null); + if (val != null) + { + await ViewModel.ExcluirNota(val); + await ViewModel.CarregarNotas(); + } + } + + private async void SarvarNota_OnClick(object sender, RoutedEventArgs e) + { + object dataContext = ((FrameworkElement)(Button)sender).DataContext; + Tarefa val = (Tarefa)((dataContext is Tarefa) ? dataContext : null); + if (val != null) + { + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(val); + if (list != null && list.Count != 0) + { + await ViewModel.CarregarNotas(); + } + } + } + + private async void NotaConcluida_OnClick(object sender, RoutedEventArgs e) + { + object dataContext = ((FrameworkElement)(Button)sender).DataContext; + Tarefa val = (Tarefa)((dataContext is Tarefa) ? dataContext : null); + if (val != null) + { + val.Conclusao = Funcoes.GetNetworkTime(); + val.Status = (StatusTarefa)2; + await ViewModel.SalvarNota(val); + await ViewModel.CarregarNotas(); + } + } + + private void AdicionarNota_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.EnableFields = true; + TituloBox.Text = string.Empty; + DescricaoBox.Text = string.Empty; + ViewModel.Publica = false; + } + + private async void SalvarNota_OnClick(object sender, RoutedEventArgs e) + { + Tarefa destino = new Tarefa + { + Agendamento = Funcoes.GetNetworkTime(), + Titulo = TituloBox.Text, + Anotacoes = DescricaoBox.Text, + Usuario = Recursos.Usuario, + UsuarioCadastro = Recursos.Usuario, + Entidade = (TipoTarefa)1, + Status = (StatusTarefa)0 + }; + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(destino); + if (list == null || list.Count == 0) + { + ViewModel.ToggleSnackBar("NOTA SALVA COM SUCESSO."); + ViewModel.EnableFields = false; + await ViewModel.CarregarNotas(); + } + else + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + } + + private void Cancelar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.EnableFields = false; + } + + private async void TileRenovacao_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.SelectedTile = 1; + await Carregar(); + } + + private async Task Carregar() + { + ViewModel.Loading(isLoading: true); + ((UIElement)RenovacaoGrid).Visibility = (Visibility)2; + ((UIElement)AniversariantesGrid).Visibility = (Visibility)2; + ((UIElement)TarefasGrid).Visibility = (Visibility)2; + ((UIElement)ProspeccaoGrid).Visibility = (Visibility)2; + ((UIElement)SinistroGrid).Visibility = (Visibility)2; + if (ViewModel.Filtros == null) + { + await ViewModel.CarregarFiltros(); + } + await ViewModel.CarregarNotas(); + switch (ViewModel.SelectedTile) + { + case 1: + await ViewModel.CarregarRenovacoes(); + ((UIElement)RenovacaoGrid).Visibility = (Visibility)0; + break; + case 2: + await ViewModel.CarregarAniversariantes(); + ((UIElement)AniversariantesGrid).Visibility = (Visibility)0; + break; + case 3: + await ViewModel.CarregarTarefas(); + ((UIElement)TarefasGrid).Visibility = (Visibility)0; + break; + case 4: + await ViewModel.CarregarProspect(InicioBox.SelectedDate.Value, FimBox.SelectedDate.Value); + ((UIElement)ProspeccaoGrid).Visibility = (Visibility)0; + break; + case 5: + await ViewModel.CarregarSinistros(); + ((UIElement)SinistroGrid).Visibility = (Visibility)0; + break; + } + ViewModel.Loading(isLoading: false); + } + + private async Task CarregarForce() + { + ViewModel.Loading(isLoading: true); + ((UIElement)RenovacaoGrid).Visibility = (Visibility)2; + ((UIElement)AniversariantesGrid).Visibility = (Visibility)2; + ((UIElement)TarefasGrid).Visibility = (Visibility)2; + ((UIElement)ProspeccaoGrid).Visibility = (Visibility)2; + ((UIElement)SinistroGrid).Visibility = (Visibility)2; + await ViewModel.CarregarFiltros(); + bool num = ViewModel.Restricoes.Any((RestricaoUsuario x) => (int)x.Tipo == 24 && x.Restricao); + bool restricaoAniversariantes = ViewModel.Restricoes.Any((RestricaoUsuario x) => (int)x.Tipo == 49 && x.Restricao); + bool restricaoTarefas = ViewModel.Restricoes.Any((RestricaoUsuario x) => (int)x.Tipo == 19 && x.Restricao); + bool restricaoSinistro = ViewModel.Restricoes.Any((RestricaoUsuario x) => (int)x.Tipo == 25 && x.Restricao); + if (!num) + { + await ViewModel.CarregarRenovacoes(force: true); + } + if (!restricaoAniversariantes) + { + await ViewModel.CarregarAniversariantes(force: true); + } + if (!restricaoTarefas) + { + await ViewModel.CarregarTarefas(force: true); + } + if (!restricaoSinistro) + { + await ViewModel.CarregarSinistros(force: true); + } + await ViewModel.CarregarNotas(); + switch (ViewModel.SelectedTile) + { + case 1: + ((UIElement)RenovacaoGrid).Visibility = (Visibility)0; + break; + case 2: + ((UIElement)AniversariantesGrid).Visibility = (Visibility)0; + break; + case 3: + ((UIElement)TarefasGrid).Visibility = (Visibility)0; + break; + case 4: + ((UIElement)ProspeccaoGrid).Visibility = (Visibility)0; + break; + case 5: + ((UIElement)SinistroGrid).Visibility = (Visibility)0; + break; + } + ViewModel.Loading(isLoading: false); + } + + private async void TileAniversariantes_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.SelectedTile = 2; + await Carregar(); + } + + private async void TileTarefas_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.SelectedTile = 3; + await Carregar(); + } + + private void PopupBoxRenovacao_OnOpened(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Expected O, but got Unknown + //IL_004a: Unknown result type (might be due to invalid IL or missing references) + //IL_004f: Unknown result type (might be due to invalid IL or missing references) + //IL_0060: Unknown result type (might be due to invalid IL or missing references) + //IL_0076: Expected O, but got Unknown + //IL_0089: Unknown result type (might be due to invalid IL or missing references) + //IL_008e: Unknown result type (might be due to invalid IL or missing references) + //IL_009f: Unknown result type (might be due to invalid IL or missing references) + //IL_00b5: Expected O, but got Unknown + PopupBox val = (PopupBox)sender; + ObservableCollection<ClienteTelefone> observableCollection = new ObservableCollection<ClienteTelefone>(); + Renovacao val2 = (Renovacao)((FrameworkElement)val).DataContext; + if (val2.Documento != null) + { + observableCollection = val2.Documento.Controle.Cliente.Telefones; + } + else + { + if (!string.IsNullOrEmpty(val2.Prospeccao.Telefone1)) + { + observableCollection.Add(new ClienteTelefone + { + Prefixo = val2.Prospeccao.Prefixo1, + Numero = val2.Prospeccao.Telefone1 + }); + } + if (!string.IsNullOrEmpty(val2.Prospeccao.Telefone2)) + { + observableCollection.Add(new ClienteTelefone + { + Prefixo = val2.Prospeccao.Prefixo2, + Numero = val2.Prospeccao.Telefone2 + }); + } + } + ViewModel.Telefones = observableCollection; + } + + private void PopupBoxProspeccao_OnOpened(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Expected O, but got Unknown + Prospectar val = (Prospectar)((FrameworkElement)(PopupBox)sender).DataContext; + ViewModel.Telefones = val.EntidadeCliente.Telefones; + } + + private void PopupBox_OnClosed(object sender, RoutedEventArgs e) + { + ViewModel.Anotacoes = ""; + } + + private void PopupBoxAniversariante_OnOpened(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Expected O, but got Unknown + ClientesAtivosInativos val = (ClientesAtivosInativos)((FrameworkElement)(PopupBox)sender).DataContext; + ViewModel.Telefones = val.EntidadeCliente.Telefones; + } + + private async void EnviarPorWhatsApp_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.Restricao((TipoRestricao)32)) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR O WHATSAPP"); + return; + } + Button val = (Button)sender; + if (((FrameworkElement)val).DataContext != null) + { + object dataContext = ((FrameworkElement)val).DataContext; + ClienteTelefone val2 = (ClienteTelefone)((dataContext is ClienteTelefone) ? dataContext : null); + if (val2 != null && !((((TelefoneBase)val2).Tipo.HasValue && (int)((TelefoneBase)val2).Tipo.GetValueOrDefault() == 8) ? (((TelefoneBase)val2).Prefixo + ((TelefoneBase)val2).Numero).Clear() : ("55" + ((TelefoneBase)val2).Prefixo + ((TelefoneBase)val2).Numero.Clear())).EnviarWhatsapp(ViewModel.Anotacoes)) + { + await ViewModel.ShowMessage("HOUVE UM PROBLEMA AO ABRIR LINK DO WHATSAPP, O LINK FOI COPIADO EM SUA MAQUINA, BASTA ABRIR O NAVEGADOR DE INTERNET E COLAR NA BARRA DE ENDEREÇOS"); + } + } + } + + private async void AbrirAniversariante_OnClick(object sender, RoutedEventArgs e) + { + ClientesAtivosInativos val = (ClientesAtivosInativos)((FrameworkElement)(Button)sender).DataContext; + Cliente val2 = await new ClienteServico().BuscarClienteAsync(((DomainBase)val.EntidadeCliente).Id); + ((Window)new HosterWindow((ContentControl)(object)new ClienteView(val2, lockInsert: true), "CADASTRO DE CLIENTES - " + val2.Nome)).ShowDialog(); + } + + private async void AbrirRenovacao_OnClick(object sender, RoutedEventArgs e) + { + Renovacao val = (Renovacao)((FrameworkElement)(Button)sender).DataContext; + if (val.Documento == null) + { + ViewModel.Loading(isLoading: true); + await AbrirProspeccao(val.Prospeccao); + ViewModel.Loading(isLoading: false); + } + else + { + Documento val2 = await new ApoliceServico().BuscarApoliceAsync(((DomainBase)val.Documento).Id); + ((Window)new HosterWindow((ContentControl)(object)new ApoliceView(val2, lockInsert: true, invoke: false, (AcessoApolice)0, 0L), "CADASTRO DE APÓLICES - " + val2.Controle.Cliente.Nome)).Show(); + } + } + + private async Task AbrirProspeccao(Prospeccao data) + { + InicioBox.Text = ValidationHelper.FormatDate(InicioBox.Text); + FimBox.Text = ValidationHelper.FormatDate(FimBox.Text); + while (true) + { + data = await ViewModel.ShowProspeccaoDialog(data); + if (data == null) + { + return; + } + List<KeyValuePair<string, string>> list = await ViewModel.SalvarProspeccao(data); + if (list == null || list.Count == 0) + { + break; + } + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + ViewModel.ToggleSnackBar("PROSPECÇÃO SALVA COM SUCESSO."); + await CarregarForce(); + } + + private void AbrirTarefa_OnClick(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Expected O, but got Unknown + Tarefa tarefa = (Tarefa)((FrameworkElement)(Button)sender).DataContext; + ViewModel.ShowDrawer(new TarefaDrawer(tarefa), 0, close: false); + } + + private async void Refresh_OnClick(object sender, RoutedEventArgs e) + { + await CarregarForce(); + } + + private async void TileProspeccao_OnClick(object sender, RoutedEventArgs e) + { + if (!InicioBox.SelectedDate.HasValue) + { + InicioBox.SelectedDate = DateTime.Today; + } + if (!FimBox.SelectedDate.HasValue) + { + FimBox.SelectedDate = InicioBox.SelectedDate.Value; + } + ViewModel.SelectedTile = 4; + await Carregar(); + } + + private void Ramo_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + ViewModel.LimparProspeccao(); + } + + private async void RefreshProspectar_OnClick(object sender, RoutedEventArgs e) + { + if (!InicioBox.SelectedDate.HasValue || !FimBox.SelectedDate.HasValue) + { + await ViewModel.ShowMessage("INÍCIO E FIM DEVEM ESTAR PREENCHIDOS."); + return; + } + if (InicioBox.SelectedDate.Value > FimBox.SelectedDate.Value) + { + await ViewModel.ShowMessage("INÍCIO NÃO DEVE SER MAIOR QUE O FIM."); + return; + } + if ((FimBox.SelectedDate.Value - InicioBox.SelectedDate.Value).TotalDays > 31.0) + { + await ViewModel.ShowMessage("O PERIODO TOTAL DO RELATÓRIO NÃO PODE SER MAIOR QUE 30 DIAS."); + return; + } + ViewModel.Loading(isLoading: true); + await ViewModel.CarregarProspect(InicioBox.SelectedDate.Value, FimBox.SelectedDate.Value); + ((UIElement)ProspeccaoGrid).Visibility = (Visibility)0; + ViewModel.Loading(isLoading: false); + } + + private void Referencia_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + ViewModel.LimparProspeccao(); + } + + private void DatePicker_OnSelectedDateChanged(object sender, SelectionChangedEventArgs e) + { + ViewModel.LimparProspeccao(); + } + + private async void TileSinistro_OnClick(object sender, RoutedEventArgs e) + { + if (!InicioBox2.SelectedDate.HasValue) + { + InicioBox2.SelectedDate = DateTime.Today; + } + if (!FimBox2.SelectedDate.HasValue) + { + FimBox2.SelectedDate = DateTime.Today; + } + ViewModel.SelectedTile = 5; + await Carregar(); + } + + private async void AbrirSinistro_OnClick(object sender, RoutedEventArgs e) + { + Button val = (Button)sender; + if (((FrameworkElement)val).DataContext != null) + { + Sinistro val2 = (Sinistro)((FrameworkElement)val).DataContext; + if (val2 != null) + { + Item item = (await ViewModel.CarregaSinistroApolice(((DomainBase)val2).Id)).ControleSinistro.Item; + ((Window)new HosterWindow((ContentControl)(object)new SinistroView(item, attached: false), "CADASTRO DE SINISTROS - " + item.Documento.Controle.Cliente.Nome + " - " + item.Documento.Apolice + " " + item.Documento.Endosso)).Show(); + } + } + } + + private async void RefreshSinsitro_OnClick(object sender, RoutedEventArgs e) + { + if (!InicioBox2.SelectedDate.HasValue || !FimBox2.SelectedDate.HasValue) + { + await ViewModel.ShowMessage("INÍCIO E FIM DEVEM ESTAR PREENCHIDOS."); + return; + } + if (InicioBox2.SelectedDate.Value > FimBox2.SelectedDate.Value) + { + await ViewModel.ShowMessage("INÍCIO NÃO DEVE SER MAIOR QUE O FIM."); + return; + } + if ((FimBox2.SelectedDate.Value - InicioBox2.SelectedDate.Value).TotalDays > 31.0) + { + await ViewModel.ShowMessage("O PERIODO TOTAL DO RELATÓRIO NÃO PODE SER MAIOR QUE 30 DIAS."); + return; + } + ViewModel.Loading(isLoading: true); + await ViewModel.CarregarSinistros(InicioBox2.SelectedDate.Value, FimBox2.SelectedDate.Value); + ((UIElement)SinistroGrid).Visibility = (Visibility)0; + ViewModel.Loading(isLoading: false); + } + + private void FiltroCliente_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + ViewModel.LimparProspeccao(); + } + + private async void GerarCsv_OnClick(object sender, RoutedEventArgs e) + { + _ = "NovosNegocios" + DateTime.Now.Date.ToString("d").Replace("/", "") + ".csv"; + if (ViewModel.Prospeccoes.Count == 0) + { + await ViewModel.ShowMessage("NÃO HÁ DADOS A SEREM EXPORTADOS NO .CSV"); + return; + } + ViewModel.Loading(isLoading: true); + await ViewModel.GerarCsv(); + ViewModel.Loading(isLoading: false); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/menus/dashboardview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_00a7: Unknown result type (might be due to invalid IL or missing references) + //IL_00b1: Expected O, but got Unknown + //IL_00b3: Unknown result type (might be due to invalid IL or missing references) + //IL_00bf: Unknown result type (might be due to invalid IL or missing references) + //IL_00c9: Expected O, but got Unknown + //IL_00cc: Unknown result type (might be due to invalid IL or missing references) + //IL_00d6: Expected O, but got Unknown + //IL_00e3: Unknown result type (might be due to invalid IL or missing references) + //IL_00ed: Expected O, but got Unknown + //IL_00f0: Unknown result type (might be due to invalid IL or missing references) + //IL_00fa: Expected O, but got Unknown + //IL_0107: Unknown result type (might be due to invalid IL or missing references) + //IL_0111: Expected O, but got Unknown + //IL_0114: Unknown result type (might be due to invalid IL or missing references) + //IL_011e: Expected O, but got Unknown + //IL_012b: Unknown result type (might be due to invalid IL or missing references) + //IL_0135: Expected O, but got Unknown + //IL_0138: Unknown result type (might be due to invalid IL or missing references) + //IL_0142: Expected O, but got Unknown + //IL_014f: Unknown result type (might be due to invalid IL or missing references) + //IL_0159: Expected O, but got Unknown + //IL_015c: Unknown result type (might be due to invalid IL or missing references) + //IL_0166: Expected O, but got Unknown + //IL_0173: Unknown result type (might be due to invalid IL or missing references) + //IL_017d: Expected O, but got Unknown + //IL_017f: Unknown result type (might be due to invalid IL or missing references) + //IL_018b: Unknown result type (might be due to invalid IL or missing references) + //IL_0195: Expected O, but got Unknown + //IL_0197: Unknown result type (might be due to invalid IL or missing references) + //IL_01a3: Unknown result type (might be due to invalid IL or missing references) + //IL_01ad: Expected O, but got Unknown + //IL_01af: Unknown result type (might be due to invalid IL or missing references) + //IL_01bb: Unknown result type (might be due to invalid IL or missing references) + //IL_01c5: Expected O, but got Unknown + //IL_01c8: Unknown result type (might be due to invalid IL or missing references) + //IL_01d2: Expected O, but got Unknown + //IL_01d5: Unknown result type (might be due to invalid IL or missing references) + //IL_01df: Expected O, but got Unknown + //IL_01e2: Unknown result type (might be due to invalid IL or missing references) + //IL_01ec: Expected O, but got Unknown + //IL_01ef: Unknown result type (might be due to invalid IL or missing references) + //IL_01f9: Expected O, but got Unknown + //IL_01fc: Unknown result type (might be due to invalid IL or missing references) + //IL_0206: Expected O, but got Unknown + //IL_0209: Unknown result type (might be due to invalid IL or missing references) + //IL_0213: Expected O, but got Unknown + //IL_0215: Unknown result type (might be due to invalid IL or missing references) + //IL_0221: Unknown result type (might be due to invalid IL or missing references) + //IL_022b: Expected O, but got Unknown + //IL_022d: Unknown result type (might be due to invalid IL or missing references) + //IL_0239: Unknown result type (might be due to invalid IL or missing references) + //IL_0243: Expected O, but got Unknown + //IL_0246: Unknown result type (might be due to invalid IL or missing references) + //IL_0250: Expected O, but got Unknown + //IL_025d: Unknown result type (might be due to invalid IL or missing references) + //IL_0267: Expected O, but got Unknown + //IL_0274: Unknown result type (might be due to invalid IL or missing references) + //IL_027e: Expected O, but got Unknown + //IL_0298: Unknown result type (might be due to invalid IL or missing references) + //IL_02a2: Expected O, but got Unknown + //IL_02af: Unknown result type (might be due to invalid IL or missing references) + //IL_02b9: Expected O, but got Unknown + //IL_02c6: Unknown result type (might be due to invalid IL or missing references) + //IL_02d0: Expected O, but got Unknown + //IL_02ea: Unknown result type (might be due to invalid IL or missing references) + //IL_02f4: Expected O, but got Unknown + //IL_0301: Unknown result type (might be due to invalid IL or missing references) + //IL_030b: Expected O, but got Unknown + //IL_030d: Unknown result type (might be due to invalid IL or missing references) + //IL_0319: Unknown result type (might be due to invalid IL or missing references) + //IL_0323: Expected O, but got Unknown + //IL_0325: Unknown result type (might be due to invalid IL or missing references) + //IL_0331: Unknown result type (might be due to invalid IL or missing references) + //IL_033b: Expected O, but got Unknown + //IL_033e: Unknown result type (might be due to invalid IL or missing references) + //IL_0348: Expected O, but got Unknown + //IL_034b: Unknown result type (might be due to invalid IL or missing references) + //IL_0355: Expected O, but got Unknown + //IL_0362: Unknown result type (might be due to invalid IL or missing references) + //IL_036c: Expected O, but got Unknown + //IL_0379: Unknown result type (might be due to invalid IL or missing references) + //IL_0383: Expected O, but got Unknown + //IL_039d: Unknown result type (might be due to invalid IL or missing references) + //IL_03a7: Expected O, but got Unknown + //IL_03b4: Unknown result type (might be due to invalid IL or missing references) + //IL_03be: Expected O, but got Unknown + //IL_03cb: Unknown result type (might be due to invalid IL or missing references) + //IL_03d5: Expected O, but got Unknown + //IL_03ee: Unknown result type (might be due to invalid IL or missing references) + //IL_03fa: Unknown result type (might be due to invalid IL or missing references) + //IL_0404: Expected O, but got Unknown + switch (connectionId) + { + case 1: + UsuarioChip = (Chip)target; + break; + case 2: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Refresh_OnClick); + break; + case 3: + TileRenovacao = (Button)target; + ((ButtonBase)TileRenovacao).Click += new RoutedEventHandler(TileRenovacao_OnClick); + break; + case 4: + TileAniversariantes = (Button)target; + ((ButtonBase)TileAniversariantes).Click += new RoutedEventHandler(TileAniversariantes_OnClick); + break; + case 5: + TileTarefas = (Button)target; + ((ButtonBase)TileTarefas).Click += new RoutedEventHandler(TileTarefas_OnClick); + break; + case 6: + TileSinistro = (Button)target; + ((ButtonBase)TileSinistro).Click += new RoutedEventHandler(TileSinistro_OnClick); + break; + case 7: + TileProspeccao = (Button)target; + ((ButtonBase)TileProspeccao).Click += new RoutedEventHandler(TileProspeccao_OnClick); + break; + case 8: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AdicionarNota_OnClick); + break; + case 9: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(SalvarNota_OnClick); + break; + case 10: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Cancelar_OnClick); + break; + case 11: + TituloBox = (TextBox)target; + break; + case 12: + DescricaoBox = (TextBox)target; + break; + case 15: + RenovacaoGrid = (Grid)target; + break; + case 19: + AniversariantesGrid = (Grid)target; + break; + case 23: + TarefasGrid = (Grid)target; + break; + case 25: + ProspeccaoGrid = (Grid)target; + break; + case 26: + ((Selector)(ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(Ramo_OnSelectionChanged); + break; + case 27: + ((Selector)(ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(Referencia_OnSelectionChanged); + break; + case 28: + InicioBox = (DatePicker)target; + ((UIElement)InicioBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((Control)InicioBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + InicioBox.SelectedDateChanged += DatePicker_OnSelectedDateChanged; + break; + case 29: + FimBox = (DatePicker)target; + ((UIElement)FimBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((Control)FimBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + FimBox.SelectedDateChanged += DatePicker_OnSelectedDateChanged; + break; + case 30: + FiltroDocumento = (ComboBox)target; + ((Selector)FiltroDocumento).SelectionChanged += new SelectionChangedEventHandler(FiltroCliente_OnSelectionChanged); + break; + case 31: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(RefreshProspectar_OnClick); + break; + case 32: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(GerarCsv_OnClick); + break; + case 35: + SinistroGrid = (Grid)target; + break; + case 36: + InicioBox2 = (DatePicker)target; + ((UIElement)InicioBox2).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((Control)InicioBox2).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + InicioBox2.SelectedDateChanged += DatePicker_OnSelectedDateChanged; + break; + case 37: + FimBox2 = (DatePicker)target; + ((UIElement)FimBox2).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((Control)FimBox2).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + FimBox2.SelectedDateChanged += DatePicker_OnSelectedDateChanged; + break; + case 38: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(RefreshSinsitro_OnClick); + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_018e: Unknown result type (might be due to invalid IL or missing references) + //IL_019a: Unknown result type (might be due to invalid IL or missing references) + //IL_01a4: Expected O, but got Unknown + //IL_0059: Unknown result type (might be due to invalid IL or missing references) + //IL_0065: Unknown result type (might be due to invalid IL or missing references) + //IL_006f: Expected O, but got Unknown + //IL_0071: Unknown result type (might be due to invalid IL or missing references) + //IL_007d: Unknown result type (might be due to invalid IL or missing references) + //IL_0087: Expected O, but got Unknown + //IL_0089: Unknown result type (might be due to invalid IL or missing references) + //IL_0095: Unknown result type (might be due to invalid IL or missing references) + //IL_009f: Expected O, but got Unknown + //IL_00a1: Unknown result type (might be due to invalid IL or missing references) + //IL_00ad: Unknown result type (might be due to invalid IL or missing references) + //IL_00b7: Expected O, but got Unknown + //IL_00b8: Unknown result type (might be due to invalid IL or missing references) + //IL_00c4: Unknown result type (might be due to invalid IL or missing references) + //IL_00ce: Expected O, but got Unknown + //IL_00d0: Unknown result type (might be due to invalid IL or missing references) + //IL_00dc: Unknown result type (might be due to invalid IL or missing references) + //IL_00e6: Expected O, but got Unknown + //IL_00e8: Unknown result type (might be due to invalid IL or missing references) + //IL_00f4: Unknown result type (might be due to invalid IL or missing references) + //IL_00fe: Expected O, but got Unknown + //IL_0100: Unknown result type (might be due to invalid IL or missing references) + //IL_010c: Unknown result type (might be due to invalid IL or missing references) + //IL_0116: Expected O, but got Unknown + //IL_0117: Unknown result type (might be due to invalid IL or missing references) + //IL_0123: Unknown result type (might be due to invalid IL or missing references) + //IL_012d: Expected O, but got Unknown + //IL_012f: Unknown result type (might be due to invalid IL or missing references) + //IL_013b: Unknown result type (might be due to invalid IL or missing references) + //IL_0145: Expected O, but got Unknown + //IL_0147: Unknown result type (might be due to invalid IL or missing references) + //IL_0153: Unknown result type (might be due to invalid IL or missing references) + //IL_015d: Expected O, but got Unknown + //IL_01a6: Unknown result type (might be due to invalid IL or missing references) + //IL_01b2: Unknown result type (might be due to invalid IL or missing references) + //IL_01bc: Expected O, but got Unknown + //IL_015f: Unknown result type (might be due to invalid IL or missing references) + //IL_016b: Unknown result type (might be due to invalid IL or missing references) + //IL_0175: Expected O, but got Unknown + //IL_0176: Unknown result type (might be due to invalid IL or missing references) + //IL_0182: Unknown result type (might be due to invalid IL or missing references) + //IL_018c: Expected O, but got Unknown + switch (connectionId) + { + case 13: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirNota_OnClick); + break; + case 14: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(NotaConcluida_OnClick); + break; + case 16: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AbrirRenovacao_OnClick); + break; + case 17: + ((PopupBox)target).Opened += new RoutedEventHandler(PopupBoxRenovacao_OnOpened); + ((PopupBox)target).Closed += new RoutedEventHandler(PopupBox_OnClosed); + break; + case 18: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(EnviarPorWhatsApp_OnClick); + break; + case 20: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AbrirAniversariante_OnClick); + break; + case 21: + ((PopupBox)target).Opened += new RoutedEventHandler(PopupBoxAniversariante_OnOpened); + ((PopupBox)target).Closed += new RoutedEventHandler(PopupBox_OnClosed); + break; + case 22: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(EnviarPorWhatsApp_OnClick); + break; + case 24: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AbrirTarefa_OnClick); + break; + case 33: + ((PopupBox)target).Opened += new RoutedEventHandler(PopupBoxProspeccao_OnOpened); + ((PopupBox)target).Closed += new RoutedEventHandler(PopupBox_OnClosed); + break; + case 34: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(EnviarPorWhatsApp_OnClick); + break; + case 39: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AbrirSinistro_OnClick); + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Menus/MenuItensView.cs b/Decompiler/Gestor.Application.Views.Menus/MenuItensView.cs new file mode 100644 index 0000000..a35af4e --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Menus/MenuItensView.cs @@ -0,0 +1,374 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Media; +using System.Windows.Threading; +using Gestor.Application.Actions; +using Gestor.Application.ViewModels; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Views.Menus; + +public class MenuItensView : BaseUserControl, IComponentConnector, IStyleConnector +{ + [Serializable] + [CompilerGenerated] + private sealed class _003C_003Ec + { + public static readonly _003C_003Ec _003C_003E9 = new _003C_003Ec(); + + public static MouseButtonEventHandler _003C_003E9__9_0; + + internal void _003CContentLoad_003Eb__9_0(object sender, MouseButtonEventArgs args) + { + } + } + + internal MenuItem ManterTodosButton; + + internal DataGrid ItemGrid; + + internal DataGridCheckBoxColumn CheckBoxColumn; + + internal DataGridTemplateColumn RenovarColumn; + + internal DataGridTemplateColumn CancelarColumn; + + internal DataGridTemplateColumn SubstituirColumn; + + internal DataGridTemplateColumn ReativarColumn; + + private bool _contentLoaded; + + public MenuItemViewModel ViewModel { get; set; } + + public MenuItensView(long ramo, ManutencaoItem manutencao = null) + { + ((FrameworkElement)this).Tag = "CADASTRO DE ITEM"; + ViewModel = new MenuItemViewModel(ramo, manutencao); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + ((FrameworkElement)ItemGrid).DataContext = ((FrameworkElement)this).DataContext; + HabilitarManutencao(manutencao); + Gestor.Application.Actions.Actions.ScrollToItem = (Action)Delegate.Remove(Gestor.Application.Actions.Actions.ScrollToItem, new Action(ScrollToIndex)); + Gestor.Application.Actions.Actions.ScrollToItem = (Action)Delegate.Combine(Gestor.Application.Actions.Actions.ScrollToItem, new Action(ScrollToIndex)); + } + + public void ScrollToIndex() + { + ScrollToIndex(ItemGrid, ((Selector)ItemGrid).SelectedIndex); + } + + public void ScrollToIndex(DataGrid grid, int index) + { + Visual descendantByType = GetDescendantByType((Visual)(object)grid, typeof(ScrollViewer)); + Visual obj = ((descendantByType is ScrollViewer) ? descendantByType : null); + int num = ((index - 5 > 0) ? (index - 5) : 0); + if (obj != null) + { + ((ScrollViewer)obj).ScrollToVerticalOffset((double)num); + } + } + + public Visual GetDescendantByType(Visual element, Type type) + { + if (element == null) + { + return null; + } + if (((object)element).GetType() == type) + { + return element; + } + Visual val = null; + FrameworkElement val2 = (FrameworkElement)(object)((element is FrameworkElement) ? element : null); + if (val2 != null) + { + val2.ApplyTemplate(); + } + for (int i = 0; i < VisualTreeHelper.GetChildrenCount((DependencyObject)(object)element); i++) + { + DependencyObject child = VisualTreeHelper.GetChild((DependencyObject)(object)element, i); + Visual element2 = (Visual)(object)((child is Visual) ? child : null); + val = GetDescendantByType(element2, type); + if (val != null) + { + break; + } + } + return val; + } + + private void HabilitarManutencao(ManutencaoItem manutencao) + { + //IL_004d: Unknown result type (might be due to invalid IL or missing references) + //IL_0052: Unknown result type (might be due to invalid IL or missing references) + //IL_0053: Unknown result type (might be due to invalid IL or missing references) + //IL_0065: Expected I4, but got Unknown + ((DataGridColumn)RenovarColumn).Visibility = (Visibility)2; + ((DataGridColumn)CancelarColumn).Visibility = (Visibility)2; + ((DataGridColumn)SubstituirColumn).Visibility = (Visibility)2; + ((DataGridColumn)ReativarColumn).Visibility = (Visibility)2; + ((DataGridColumn)CheckBoxColumn).Visibility = (Visibility)2; + ((UIElement)ManterTodosButton).Visibility = (Visibility)2; + if (manutencao != null) + { + TipoManutencao tipo = manutencao.Tipo; + switch ((int)tipo) + { + case 1: + ((DataGridColumn)RenovarColumn).Visibility = (Visibility)0; + ((DataGridColumn)CancelarColumn).Visibility = (Visibility)0; + ((DataGridColumn)SubstituirColumn).Visibility = (Visibility)0; + ViewModel.EndossoRenovacao = true; + break; + case 2: + ((DataGridColumn)CancelarColumn).Visibility = (Visibility)0; + ((DataGridColumn)ReativarColumn).Visibility = (Visibility)0; + break; + case 0: + ((DataGridColumn)RenovarColumn).Visibility = (Visibility)0; + ((DataGridColumn)CheckBoxColumn).Visibility = (Visibility)0; + ((UIElement)ManterTodosButton).Visibility = (Visibility)0; + ViewModel.EndossoRenovacao = true; + break; + } + } + } + + private void ContentLoad() + { + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Expected O, but got Unknown + //IL_0031: Unknown result type (might be due to invalid IL or missing references) + //IL_0036: Unknown result type (might be due to invalid IL or missing references) + //IL_003c: Expected O, but got Unknown + ((Selector)ItemGrid).SelectionChanged += new SelectionChangedEventHandler(ItemGrid_OnSelectionChanged); + DataGrid itemGrid = ItemGrid; + object obj = _003C_003Ec._003C_003E9__9_0; + if (obj == null) + { + MouseButtonEventHandler val = delegate + { + }; + _003C_003Ec._003C_003E9__9_0 = val; + obj = (object)val; + } + ((Control)itemGrid).MouseDoubleClick += (MouseButtonEventHandler)obj; + } + + private void ItemGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_003e: Unknown result type (might be due to invalid IL or missing references) + //IL_0048: Expected O, but got Unknown + DataGrid val = (DataGrid)sender; + if ((val == null || ((Selector)val).SelectedIndex >= 0) && !ViewModel.AlterandoSelectedItem) + { + ViewModel.SelecionaItem((Item)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null)); + } + } + + private void AutoCompleteBox_Populating(object sender, PopulatingEventArgs e) + { + e.Cancel = true; + ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Item>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void AutoCompleteBox_OnTextChanged(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + if (string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).Text)) + { + ViewModel.FiltrarItem(""); + } + } + + private void CancelarItem_OnClick(object sender, RoutedEventArgs e) + { + //IL_0020: Unknown result type (might be due to invalid IL or missing references) + //IL_002a: Expected O, but got Unknown + Button val = (Button)((sender is Button) ? sender : null); + if (val != null && ((FrameworkElement)val).DataContext != null) + { + ViewModel.CancelarItem((Item)((FrameworkElement)val).DataContext); + } + } + + private void SubstituirItem_OnClick(object sender, RoutedEventArgs e) + { + //IL_0020: Unknown result type (might be due to invalid IL or missing references) + //IL_002a: Expected O, but got Unknown + Button val = (Button)((sender is Button) ? sender : null); + if (val != null && ((FrameworkElement)val).DataContext != null) + { + ViewModel.Substituir((Item)((FrameworkElement)val).DataContext); + } + } + + private void ManterItem_OnClick(object sender, RoutedEventArgs e) + { + //IL_0020: Unknown result type (might be due to invalid IL or missing references) + //IL_002a: Expected O, but got Unknown + Button val = (Button)((sender is Button) ? sender : null); + if (val != null && ((FrameworkElement)val).DataContext != null) + { + ViewModel.Manter((Item)((FrameworkElement)val).DataContext); + } + } + + private void ManterItens_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.ManterItens(); + } + + private void ReativarItem_OnClick(object sender, RoutedEventArgs e) + { + //IL_0020: Unknown result type (might be due to invalid IL or missing references) + //IL_002a: Expected O, but got Unknown + Button val = (Button)((sender is Button) ? sender : null); + if (val != null && ((FrameworkElement)val).DataContext != null) + { + ViewModel.Reativar((Item)((FrameworkElement)val).DataContext); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/menus/menuitensview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_003a: Unknown result type (might be due to invalid IL or missing references) + //IL_0046: Unknown result type (might be due to invalid IL or missing references) + //IL_0050: Expected O, but got Unknown + //IL_0051: Unknown result type (might be due to invalid IL or missing references) + //IL_005d: Unknown result type (might be due to invalid IL or missing references) + //IL_0067: Expected O, but got Unknown + //IL_006a: Unknown result type (might be due to invalid IL or missing references) + //IL_0074: Expected O, but got Unknown + //IL_0081: Unknown result type (might be due to invalid IL or missing references) + //IL_008b: Expected O, but got Unknown + //IL_008e: Unknown result type (might be due to invalid IL or missing references) + //IL_0098: Expected O, but got Unknown + //IL_009b: Unknown result type (might be due to invalid IL or missing references) + //IL_00a5: Expected O, but got Unknown + //IL_00a8: Unknown result type (might be due to invalid IL or missing references) + //IL_00b2: Expected O, but got Unknown + //IL_00b5: Unknown result type (might be due to invalid IL or missing references) + //IL_00bf: Expected O, but got Unknown + //IL_00c2: Unknown result type (might be due to invalid IL or missing references) + //IL_00cc: Expected O, but got Unknown + //IL_00cf: Unknown result type (might be due to invalid IL or missing references) + //IL_00d9: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBox_Populating); + ((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBox_OnTextChanged); + break; + case 2: + ManterTodosButton = (MenuItem)target; + ManterTodosButton.Click += new RoutedEventHandler(ManterItens_OnClick); + break; + case 3: + ItemGrid = (DataGrid)target; + break; + case 4: + CheckBoxColumn = (DataGridCheckBoxColumn)target; + break; + case 5: + RenovarColumn = (DataGridTemplateColumn)target; + break; + case 7: + CancelarColumn = (DataGridTemplateColumn)target; + break; + case 9: + SubstituirColumn = (DataGridTemplateColumn)target; + break; + case 11: + ReativarColumn = (DataGridTemplateColumn)target; + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_0026: Unknown result type (might be due to invalid IL or missing references) + //IL_0032: Unknown result type (might be due to invalid IL or missing references) + //IL_003c: Expected O, but got Unknown + //IL_003e: Unknown result type (might be due to invalid IL or missing references) + //IL_004a: Unknown result type (might be due to invalid IL or missing references) + //IL_0054: Expected O, but got Unknown + //IL_0056: Unknown result type (might be due to invalid IL or missing references) + //IL_0062: Unknown result type (might be due to invalid IL or missing references) + //IL_006c: Expected O, but got Unknown + //IL_006e: Unknown result type (might be due to invalid IL or missing references) + //IL_007a: Unknown result type (might be due to invalid IL or missing references) + //IL_0084: Expected O, but got Unknown + switch (connectionId) + { + case 6: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ManterItem_OnClick); + break; + case 8: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(CancelarItem_OnClick); + break; + case 10: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(SubstituirItem_OnClick); + break; + case 12: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ReativarItem_OnClick); + break; + case 7: + case 9: + case 11: + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Relatorios/RelatorioView.cs b/Decompiler/Gestor.Application.Views.Relatorios/RelatorioView.cs new file mode 100644 index 0000000..ba0fe27 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Relatorios/RelatorioView.cs @@ -0,0 +1,1116 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Data; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Threading; +using CurrencyTextBoxControl; +using Gestor.Application.Actions; +using Gestor.Application.Componentes; +using Gestor.Application.Drawers.Relatorios; +using Gestor.Application.Helpers; +using Gestor.Application.ViewModels.Relatorios; +using Gestor.Application.Views.Ferramentas; +using Gestor.Application.Views.Generic; +using Gestor.Common.Helpers; +using Gestor.Common.Validation; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.MalaDireta; +using Gestor.Model.Domain.Relatorios; +using Gestor.Model.Domain.Relatorios.ApolicePendente; +using Gestor.Model.Domain.Relatorios.Auditoria; +using Gestor.Model.Domain.Relatorios.Classificacao; +using Gestor.Model.Domain.Relatorios.ClientesAtivosInativos; +using Gestor.Model.Domain.Relatorios.Comissao; +using Gestor.Model.Domain.Relatorios.CriticaApolice; +using Gestor.Model.Domain.Relatorios.EndossoCancelamento; +using Gestor.Model.Domain.Relatorios.ExtratoBaixado; +using Gestor.Model.Domain.Relatorios.FaturaPendente; +using Gestor.Model.Domain.Relatorios.Licenciamento; +using Gestor.Model.Domain.Relatorios.Log; +using Gestor.Model.Domain.Relatorios.LogsEnvio; +using Gestor.Model.Domain.Relatorios.MetaSeguradora; +using Gestor.Model.Domain.Relatorios.MetaVendedor; +using Gestor.Model.Domain.Relatorios.NotaFiscal; +using Gestor.Model.Domain.Relatorios.Pendente; +using Gestor.Model.Domain.Relatorios.Placa; +using Gestor.Model.Domain.Relatorios.Producao; +using Gestor.Model.Domain.Relatorios.Renovacao; +using Gestor.Model.Domain.Relatorios.Sinistro; +using Gestor.Model.Domain.Relatorios.Tarefa; +using Gestor.Model.Domain.Seguros; +using MaterialDesignThemes.Wpf; +using Xceed.Wpf.AvalonDock.Controls; + +namespace Gestor.Application.Views.Relatorios; + +public class RelatorioView : BaseUserControl, IComponentConnector, IStyleConnector +{ + internal RelatorioViewModel ViewModel; + + internal Image ProgressRing; + + internal ComboBox RelatorioBox; + + internal CurrencyTextBox ValorInicioBox; + + internal CurrencyTextBox ValorFimBox; + + internal DatePicker InicioBox; + + internal DatePicker FimBox; + + internal ToggleButton VisualizarRamosVendedoresTooltip; + + internal MenuItem GerarRelatorioButton; + + internal ComboBox RamoBox; + + internal ContentControl ReportControl; + + internal WebEditor WebEditor; + + internal PopupBox HelpPopup; + + internal TextBlock NaoHaDados; + + private bool _contentLoaded; + + public RelatorioView(string opcao) + { + ViewModel = new RelatorioViewModel(opcao); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + ViewModel.Head = Recursos.Usuario.Nome + ", VOCÊ ESTÁ EM RELATÓRIOS"; + Gestor.Application.Actions.Actions.RecarregarRelatorios = (Action<string>)Delegate.Combine(Gestor.Application.Actions.Actions.RecarregarRelatorios, new Action<string>(Recarregar)); + } + + private void Recarregar(string sessao) + { + //IL_001b: Unknown result type (might be due to invalid IL or missing references) + //IL_0025: Expected O, but got Unknown + if (!(ViewModel.Sessao != sessao)) + { + GerarResultados_OnClick(GerarRelatorioButton, new RoutedEventArgs()); + } + } + + private void ContentLoad() + { + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Expected O, but got Unknown + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Expected O, but got Unknown + //IL_0052: Unknown result type (might be due to invalid IL or missing references) + //IL_005c: Expected O, but got Unknown + //IL_0069: Unknown result type (might be due to invalid IL or missing references) + //IL_0073: Expected O, but got Unknown + //IL_0097: Unknown result type (might be due to invalid IL or missing references) + //IL_00a1: Expected O, but got Unknown + ((UIElement)InicioBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)InicioBox).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + InicioBox.SelectedDateChanged += Periodo_OnSelectedDateChanged; + ((UIElement)FimBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)FimBox).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + FimBox.SelectedDateChanged += Periodo_OnSelectedDateChanged; + ((Selector)RelatorioBox).SelectionChanged += new SelectionChangedEventHandler(TipoRelatorio_OnSelectionChanged); + } + + private async void GerarResultados_OnClick(object sender, RoutedEventArgs e) + { + InicioBox.Text = ValidationHelper.FormatDate(InicioBox.Text); + FimBox.Text = ValidationHelper.FormatDate(FimBox.Text); + try + { + ViewModel.Inicio = Convert.ToDateTime(InicioBox.Text); + ViewModel.Fim = Convert.ToDateTime(FimBox.Text); + } + catch (Exception) + { + return; + } + if (ViewModel.Inicio > ViewModel.Fim) + { + await ViewModel.ShowMessage("A DATA FINAL NÃO PODE SER MENOR QUE A DATA INICIAL DO FILTRO."); + return; + } + if (((CollectionView)((ItemsControl)RelatorioBox).Items).Count == 0) + { + await ViewModel.ShowMessage("NÃO HÁ RELATÓRIOS QUE VOCÊ POSSA GERAR."); + return; + } + if (ViewModel.InicioValor > ViewModel.FimValor) + { + await ViewModel.ShowMessage("O VALOR FINAL NÃO PODE SER MENOR QUE O VALOR INICIAL DO FILTRO."); + return; + } + ViewModel.Carregando = true; + ViewModel.IsEnabled = false; + ViewModel.VisibilityHtml = false; + if (ViewModel.Report != null) + { + ViewModel.Report = null; + } + ViewModel.LimparRelatorio(); + if (!(await ViewModel.GerarRelatorio(ViewModel.Inicio, ViewModel.Fim))) + { + ((UIElement)NaoHaDados).Visibility = (Visibility)0; + ((UIElement)ReportControl).Visibility = (Visibility)2; + ViewModel.IsEnabled = true; + ViewModel.ExtratosEnabled = false; + ViewModel.Carregando = false; + ViewModel.VisibilityHtml = false; + return; + } + ((FrameworkElement)ReportControl).DataContext = ViewModel; + Relatorio relatorioTipo = ViewModel.Relatorio; + GridRelatorio gridRelatorio = new GridRelatorio(ViewModel); + switch ((int)relatorioTipo) + { + case 3: + await gridRelatorio.DataGrid.ContruirLista<ApolicePendente>(ViewModel.Relatorio); + ((ItemsControl)gridRelatorio.DataGrid).ItemsSource = ViewModel.ApolicePendenteFiltrado; + break; + case 17: + await gridRelatorio.DataGrid.ContruirLista<Licenciamento>(ViewModel.Relatorio); + ((ItemsControl)gridRelatorio.DataGrid).ItemsSource = ViewModel.LicenciamentoFiltrado; + break; + case 27: + await gridRelatorio.DataGrid.ContruirLista<Placas>(ViewModel.Relatorio); + ((ItemsControl)gridRelatorio.DataGrid).ItemsSource = ViewModel.PlacaFiltrado; + break; + case 18: + await gridRelatorio.DataGrid.ContruirLista<Tarefa>(ViewModel.Relatorio); + ((ItemsControl)gridRelatorio.DataGrid).ItemsSource = ViewModel.TarefaFiltrado; + break; + case 2: + await gridRelatorio.DataGrid.ContruirLista<Producao>(ViewModel.Relatorio); + ((ItemsControl)gridRelatorio.DataGrid).ItemsSource = ViewModel.ProducaoFiltrado; + break; + case 4: + await gridRelatorio.DataGrid.ContruirLista<Renovacao>(ViewModel.Relatorio); + ((ItemsControl)gridRelatorio.DataGrid).ItemsSource = ViewModel.RenovacaoFiltrado; + break; + case 5: + await gridRelatorio.DataGrid.ContruirLista<Comissao>(ViewModel.Relatorio); + ((ItemsControl)gridRelatorio.DataGrid).ItemsSource = ViewModel.ComissaoFiltrado; + break; + case 6: + case 16: + await gridRelatorio.DataGrid.ContruirLista<Pendente>(ViewModel.Relatorio); + ((ItemsControl)gridRelatorio.DataGrid).ItemsSource = ViewModel.PendenteFiltrado; + break; + case 9: + case 10: + await gridRelatorio.DataGrid.ContruirLista<Sinistro>(ViewModel.Relatorio); + ((ItemsControl)gridRelatorio.DataGrid).ItemsSource = ViewModel.SinistroFiltrado; + break; + case 23: + ((UIElement)gridRelatorio.Totalizacao).Visibility = (Visibility)2; + await gridRelatorio.DataGrid.ContruirLista<LogsEnvio>(ViewModel.Relatorio); + ((ItemsControl)gridRelatorio.DataGrid).ItemsSource = ViewModel.LogsEnvioFiltrado; + break; + case 0: + case 1: + ViewModel.NovosNegocios = (int)relatorioTipo == 0; + await gridRelatorio.DataGrid.ContruirLista<ClientesAtivosInativos>(ViewModel.Relatorio); + ((ItemsControl)gridRelatorio.DataGrid).ItemsSource = ViewModel.ClientesAtivosInativosFiltrado; + break; + case 7: + case 11: + case 20: + WebEditor.Initialize(ViewModel.HtmlContent); + break; + case 8: + await gridRelatorio.DataGrid.ContruirLista<Auditoria>(ViewModel.Relatorio); + ((ItemsControl)gridRelatorio.DataGrid).ItemsSource = ViewModel.AuditoriaFiltrado; + break; + case 13: + await gridRelatorio.DataGrid.ContruirLista<ExtratoBaixadoRelatorio>(ViewModel.Relatorio); + ((ItemsControl)gridRelatorio.DataGrid).ItemsSource = ViewModel.ExtratosFiltrado; + break; + case 12: + await gridRelatorio.DataGrid.ContruirLista<FaturaPendente>(ViewModel.Relatorio); + ((ItemsControl)gridRelatorio.DataGrid).ItemsSource = ViewModel.FaturaPendenteFiltrado; + break; + case 14: + await gridRelatorio.DataGrid.ContruirLista<MetaSeguradoraRelatorio>(ViewModel.Relatorio); + ((ItemsControl)gridRelatorio.DataGrid).ItemsSource = ViewModel.MetaSeguradoraFiltrado; + break; + case 15: + await gridRelatorio.DataGrid.ContruirLista<MetaVendedorRelatorio>(ViewModel.Relatorio); + ((ItemsControl)gridRelatorio.DataGrid).ItemsSource = ViewModel.MetaVendedorFiltrado; + break; + case 19: + await gridRelatorio.DataGrid.ContruirLista<NotaFiscalRelatorio>(ViewModel.Relatorio); + ((ItemsControl)gridRelatorio.DataGrid).ItemsSource = ViewModel.NotaFiscalFiltrado; + break; + case 24: + case 25: + await gridRelatorio.DataGrid.ContruirLista<LogAcaoRelatorio>(ViewModel.Relatorio); + ((ItemsControl)gridRelatorio.DataGrid).ItemsSource = ViewModel.LogUtilizacaoFiltrado; + break; + case 26: + await gridRelatorio.DataGrid.ContruirLista<ApoliceCritica>(ViewModel.Relatorio); + ((ItemsControl)gridRelatorio.DataGrid).ItemsSource = ViewModel.ApoliceCriticaFiltrado; + break; + case 28: + await gridRelatorio.DataGrid.ContruirLista<Endosso>(ViewModel.Relatorio); + ((ItemsControl)gridRelatorio.DataGrid).ItemsSource = ViewModel.EndossoFiltrado; + break; + case 29: + await gridRelatorio.DataGrid.ContruirLista<Classificacao>(ViewModel.Relatorio); + ((ItemsControl)gridRelatorio.DataGrid).ItemsSource = ViewModel.Classificacao; + break; + } + gridRelatorio.SinteticoGrid.ItemsSource = ViewModel.Sintetic; + ViewModel.Report = (((int)relatorioTipo == 11 || (int)relatorioTipo == 7 || (int)relatorioTipo == 20) ? null : gridRelatorio); + ViewModel.VisibilityHtml = (int)relatorioTipo == 11 || (int)relatorioTipo == 7 || (int)relatorioTipo == 20; + ((UIElement)NaoHaDados).Visibility = (Visibility)2; + ((UIElement)ReportControl).Visibility = (Visibility)0; + ViewModel.RelatorioVisibility = true; + ViewModel.IsEnabled = true; + ViewModel.ExtratosEnabled = true; + ViewModel.Carregando = false; + } + + private async void Imprimir_OnClick(object sender, RoutedEventArgs e) + { + bool flag = ((int)ViewModel.VisibilityAgrupamento == 0 && (int)ViewModel.Agrupamento != 0) || ViewModel.NotaFiscalPorSeguradora; + if (flag) + { + flag = await ViewModel.ShowMessage("DESEJA SEPARAR GRUPOS POR PÁGINA?", "SIM", "NÃO"); + } + bool pageBreak = flag; + ViewModel.Carregando = true; + ViewModel.IsEnabled = false; + bool html = ViewModel.VisibilityHtml; + if (html) + { + ViewModel.VisibilityHtml = false; + } + await ViewModel.Print(pageBreak); + if (html) + { + ViewModel.VisibilityHtml = true; + } + ViewModel.Carregando = false; + ViewModel.IsEnabled = true; + if ((int)ViewModel.Relatorio == 7 || (int)ViewModel.Relatorio == 20) + { + ((UIElement)WebEditor).Visibility = (Visibility)0; + } + } + + private async void Sintetico_OnClick(object sender, RoutedEventArgs e) + { + if ((int)ViewModel.Relatorio == 7 || (int)ViewModel.Agrupamento != 0 || (int)ViewModel.Relatorio == 11) + { + await ViewModel.Sintetico(); + } + else + { + await ViewModel.ShowMessage("NECESSÁRIO SELECIONAR UM AGRUPAMENTO PARA SINTETIZAR OS RESULTADOS."); + } + } + + private void MaisFiltros_OnClick(object sender, RoutedEventArgs e) + { + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_000d: Invalid comparison between Unknown and I4 + //IL_0015: Unknown result type (might be due to invalid IL or missing references) + //IL_001c: Invalid comparison between Unknown and I4 + //IL_00ea: Unknown result type (might be due to invalid IL or missing references) + if ((int)ViewModel.Relatorio == 24 || (int)ViewModel.Relatorio == 25) + { + ViewModel.VisibilityUsuarios = true; + return; + } + ViewModel.Seguradoras = new List<Seguradora>(ViewModel.Seguradoras); + ViewModel.Ramos = new List<Ramo>(ViewModel.Ramos); + ViewModel.Vendedores = new List<Vendedor>(ViewModel.Vendedores); + ViewModel.Produtos = new List<Produto>(ViewModel.Produtos); + ViewModel.Estipulantes = new List<Estipulante>(ViewModel.Estipulantes); + ViewModel.TipoSeguros = new List<StatusRelatorio>(ViewModel.TipoSeguros); + ViewModel.RecheckAllLists(); + ViewModel.ShowDrawer(new FiltroRelatorio(ViewModel, ViewModel.Relatorio), 0, close: false); + } + + private void Periodo_OnSelectedDateChanged(object sender, SelectionChangedEventArgs e) + { + LimparRelatorio(); + } + + private void LimparRelatorio() + { + ViewModel.LimparRelatorio(); + if (ReportControl != null) + { + ReportControl.Content = null; + ((FrameworkElement)ReportControl).DataContext = null; + } + } + + private async void ShowHelp(Relatorio relatorio) + { + if (!(await ViewModel.VerificarRestricao((TipoRestricao)61, root: true, showmessage: false))) + { + ((UIElement)HelpPopup).Visibility = (Visibility)2; + return; + } + bool flag = true; + if (HelpPopup != null) + { + ((UIElement)HelpPopup).Visibility = (Visibility)((!flag) ? 2 : 0); + } + } + + private void TipoRelatorio_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_001d: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Unknown result type (might be due to invalid IL or missing references) + //IL_0038: Unknown result type (might be due to invalid IL or missing references) + //IL_003e: Unknown result type (might be due to invalid IL or missing references) + //IL_00a4: Expected I4, but got Unknown + LimparRelatorio(); + VisualizarRamosVendedoresTooltip.IsChecked = false; + Relatorio relatorio = ViewModel.Relatorio; + if (NaoHaDados != null) + { + ((UIElement)NaoHaDados).Visibility = (Visibility)2; + } + ShowHelp(relatorio); + switch ((int)relatorio) + { + case 0: + ViewModel.PlanilhaVisibility = (Visibility)2; + break; + case 8: + ViewModel.PlanilhaVisibility = (Visibility)2; + break; + case 1: + ViewModel.PlanilhaVisibility = (Visibility)2; + break; + case 2: + ViewModel.PlanilhaVisibility = (Visibility)0; + break; + case 3: + ViewModel.PlanilhaVisibility = (Visibility)2; + break; + case 4: + ViewModel.PlanilhaVisibility = (Visibility)0; + break; + case 5: + ViewModel.PlanilhaVisibility = (Visibility)2; + break; + case 6: + ViewModel.PlanilhaVisibility = (Visibility)2; + break; + case 7: + ViewModel.PlanilhaVisibility = (Visibility)2; + break; + case 9: + ViewModel.PlanilhaVisibility = (Visibility)2; + break; + case 10: + ViewModel.PlanilhaVisibility = (Visibility)2; + break; + case 11: + ViewModel.PlanilhaVisibility = (Visibility)2; + ViewModel.Info = ""; + ViewModel.InfoVisibility = (Visibility)2; + break; + case 13: + ViewModel.VisibilityAgrupamento = (Visibility)2; + ViewModel.PlanilhaVisibility = (Visibility)2; + break; + case 23: + ViewModel.VisibilityAgrupamento = (Visibility)2; + ViewModel.PlanilhaVisibility = (Visibility)2; + break; + case 12: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + case 20: + case 21: + case 22: + break; + } + } + + private async void ExportarExcel_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Carregando = true; + ViewModel.IsEnabled = false; + await ViewModel.GerarExcel(); + ViewModel.IsEnabled = true; + ViewModel.Carregando = false; + } + + private async void Tarefas_OnClick(object sender, RoutedEventArgs e) + { + if (!(await ViewModel.ValidateTarefa())) + { + Tarefa data = new Tarefa + { + Entidade = (TipoTarefa)1, + Titulo = EnumHelper.GetDescription<Relatorio>(ViewModel.Relatorio), + Usuario = Recursos.Usuario, + Agendamento = Funcoes.GetNetworkTime() + }; + await AbrirTarefa(data); + } + } + + private async Task AbrirTarefa(Tarefa data) + { + ViewModel.IsEnabled = false; + ViewModel.Carregando = true; + Tarefa tarefa; + while (true) + { + tarefa = await ViewModel.ShowTarefaDialog(data, nota: true); + if (tarefa == null) + { + ViewModel.IsEnabled = true; + ViewModel.Carregando = false; + return; + } + if (tarefa.Usuario == null) + { + tarefa.Usuario = tarefa.UsuariosVinculados.FirstOrDefault(); + } + List<ResponsavelTarefa> responsaveis = ((IEnumerable<Usuario>)tarefa.UsuariosVinculados).Select((Func<Usuario, ResponsavelTarefa>)((Usuario x) => new ResponsavelTarefa + { + IdTarefa = ((DomainBase)tarefa).Id, + Usuario = x + })).ToList(); + tarefa.Responsaveis = responsaveis; + tarefa.Anotacoes = "<p>" + tarefa.Anotacoes + "</p>"; + tarefa.AgendamentoRetroativo = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 45); + List<KeyValuePair<string, string>> list = tarefa.Validate(); + if (string.IsNullOrWhiteSpace(tarefa.Anotacoes)) + { + list.Add(new KeyValuePair<string, string>("ANOTAÇÕES", "OBRIGATÓRIO")); + } + if (list == null || list.Count == 0) + { + break; + } + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + List<Tarefa> list2 = ViewModel.GerarTarefas(tarefa); + if (list2 == null || list2.Count == 0) + { + ViewModel.IsEnabled = true; + ViewModel.Carregando = false; + await ViewModel.ShowMessage("FALHA AO CRIAR TAREFA."); + } + else + { + await ViewModel.SalvarTarefas(list2); + ViewModel.ToggleSnackBar("TAREFA SALVA COM SUCESSO."); + ViewModel.Alterar(alterar: false); + ViewModel.IsEnabled = true; + ViewModel.Carregando = false; + } + } + + private async void Acompanhamento_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.Acompanhamento(); + } + + private async void Email_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + List<MalaDireta> list = await ViewModel.CriarLista(); + if (list == null || list.Count == 0) + { + await ViewModel.ShowMessage("NECESSÁRIO SELECIONAR AO MENOS UM CLIENTE PARA PROSSEGUIR."); + ViewModel.Loading(isLoading: false); + return; + } + if (Funcoes.IsWindowOpen<HosterWindow>("ENVIO DE E-MAIL")) + { + Funcoes.Destroy<HosterWindow>("ENVIO DE E-MAIL"); + } + ViewModel.Loading(isLoading: false); + ((Window)new HosterWindow((ContentControl)(object)new MalaDiretaView(list), "ENVIO DE E-MAIL", 1200.0, 600.0, canMaximize: true)).Show(); + } + + private async void Etiquetas_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + List<Documento> list = await ViewModel.CriarListaEtiqueta(); + if (list == null || list.Count == 0) + { + await ViewModel.ShowMessage("NECESSÁRIO SELECIONAR AO MENOS UM CLIENTE PARA PROSSEGUIR."); + ViewModel.Loading(isLoading: false); + } + else if (!Funcoes.IsWindowOpen<HosterWindow>("ETIQUETAS")) + { + bool apenasCliente = (int)ViewModel.Relatorio == 0 || (int)ViewModel.Relatorio == 1; + ViewModel.Loading(isLoading: false); + ((Window)new HosterWindow((ContentControl)(object)new EtiquetaView(list, apenasCliente), "ETIQUETAS", 900.0, 600.0)).Show(); + } + } + + private void Extrato_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.ExibirExtratoDrawer(); + } + + private void Protocolo_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.MostrarProtocolo(); + } + + private void AdicionarFiltro_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AdcionarFiltroPersonalizado(); + } + + private void ExcluirFiltro_OnClick(object sender, RoutedEventArgs e) + { + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_0034: Expected O, but got Unknown + Chip val = (Chip)((sender is Chip) ? sender : null); + if (val != null) + { + ListBox val2 = Extentions.FindVisualAncestor<ListBox>((DependencyObject)(object)val); + FiltroPersonalizado val3 = (FiltroPersonalizado)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)]; + if (val3 != null) + { + ViewModel.FiltroPersonalizadoSelecionado.Remove(val3); + ViewModel.PesquisaPersonalizada(); + } + } + } + + private void FecharFiltro_OnClick(object sender, RoutedEventArgs e) + { + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Invalid comparison between Unknown and I4 + ViewModel.VisibilityFiltroPersonalizado = (Visibility)(((int)ViewModel.VisibilityFiltroPersonalizado != 2) ? 2 : 0); + } + + private async void Apolice_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + List<MalaDireta> list = await ViewModel.CriarLista(); + list = ((list == null) ? new List<MalaDireta>() : list.Where((MalaDireta x) => (x.Apolice.Tipo == 0 && !string.IsNullOrWhiteSpace(x.Apolice.Apolice)) || (x.Apolice.Tipo == 1 && !string.IsNullOrWhiteSpace(x.Apolice.Endosso))).ToList()); + if (list.Count == 0) + { + await ViewModel.ShowMessage("NECESSÁRIO SELECIONAR AO MENOS UM CLIENTE PARA PROSSEGUIR."); + ViewModel.Loading(isLoading: false); + return; + } + if (Funcoes.IsWindowOpen<HosterWindow>("ENVIO DE E-MAIL")) + { + Funcoes.Destroy<HosterWindow>("ENVIO DE E-MAIL"); + } + ViewModel.Loading(isLoading: false); + ((Window)new HosterWindow((ContentControl)(object)new MalaDiretaView(list), "ENVIO DE E-MAIL", 1200.0, 600.0, canMaximize: true)).Show(); + } + + private async void Sincronizar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Carregando = true; + ViewModel.IsEnabled = false; + await ViewModel.Sincronizar(); + ViewModel.IsEnabled = true; + ViewModel.Carregando = false; + } + + private async void ToggleComparativo_OnChecked(object sender, RoutedEventArgs e) + { + if ((int)ViewModel.Relatorio == 11) + { + ViewModel.Carregando = true; + ViewModel.IsEnabled = false; + RelatorioViewModel viewModel = ViewModel; + viewModel.HtmlContent = await ViewModel.GerarHtml(screen: true); + WebEditor.Initialize(ViewModel.HtmlContent); + ViewModel.IsEnabled = true; + ViewModel.Carregando = false; + } + } + + private async void HelpPopup_Opened(object sender, RoutedEventArgs e) + { + await ViewModel.CarregarAjuda(); + } + + private void OcultarAjuda_OnClick(object sender, RoutedEventArgs e) + { + ((UIElement)HelpPopup).Visibility = (Visibility)2; + } + + private void Fechar_OnClick(object sender, RoutedEventArgs e) + { + HelpPopup.IsPopupOpen = !HelpPopup.IsPopupOpen; + } + + private void FecharFiltroUsuario_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.VisibilityUsuarios = false; + } + + private void CopyLink_OnClick(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Expected O, but got Unknown + Button val = (Button)sender; + if (val != null && ((FrameworkElement)val).DataContext != null) + { + AjudaTela val2 = (AjudaTela)((FrameworkElement)val).DataContext; + string text = ""; + if (val2.Minuto > 0 || val2.Segundo > 0) + { + text = $"&start={val2.Minuto * 60 + val2.Segundo}"; + } + (val2.Link + text).CopyToClipboard(); + ViewModel.ToggleSnackBar("LINK COPIADO"); + } + } + + private void Play_Click(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Expected O, but got Unknown + Button val = (Button)sender; + if (val != null && ((FrameworkElement)val).DataContext != null) + { + AjudaTela val2 = (AjudaTela)((FrameworkElement)val).DataContext; + string text = ""; + if (val2.Minuto > 0 || val2.Segundo > 0) + { + text = $"&start={val2.Minuto * 60 + val2.Segundo}"; + } + Process.Start(val2.Link + text); + } + } + + private async void PlanilhaCompleta_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Carregando = true; + await ViewModel.GerarPlanilhaCompleta(); + ViewModel.Carregando = false; + } + + private void ConfigurarRelatorio_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.ShowDrawer(new ConfiguracaoRelatorio(ViewModel), 0, close: false); + } + + private void AdicionarRamo_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AdicionarRamo(); + } + + private void ExcluirRamo_onClick(object sender, RoutedEventArgs e) + { + //IL_0011: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Expected O, but got Unknown + Chip val = (Chip)((sender is Chip) ? sender : null); + if (val != null) + { + Ramo val2 = (Ramo)((FrameworkElement)val).DataContext; + if (val2 != null) + { + ViewModel.RemoverRamo(val2); + } + } + } + + private void FecharInfo_Click(object sender, RoutedEventArgs e) + { + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Invalid comparison between Unknown and I4 + ViewModel.InfoVisibility = (Visibility)(((int)ViewModel.InfoVisibility != 2) ? 2 : 0); + } + + private void AbrirInfo_Click(object sender, RoutedEventArgs e) + { + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Invalid comparison between Unknown and I4 + ViewModel.InfoVisibility = (Visibility)(((int)ViewModel.InfoVisibility != 2) ? 2 : 0); + } + + private void AutoCompleteBoxUsuario_Populating(object sender, PopulatingEventArgs e) + { + e.Cancel = true; + ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Usuario>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void AutoCompleteBox_OnTextChanged(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + if (string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).Text)) + { + ViewModel.FiltrarUsuario(""); + } + } + + private void ReloadWindow_Click(object sender, RoutedEventArgs e) + { + LimparRelatorio(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/relatorios/relatorioview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_00bb: Unknown result type (might be due to invalid IL or missing references) + //IL_00c5: Expected O, but got Unknown + //IL_00c8: Unknown result type (might be due to invalid IL or missing references) + //IL_00d2: Expected O, but got Unknown + //IL_00df: Unknown result type (might be due to invalid IL or missing references) + //IL_00e9: Expected O, but got Unknown + //IL_00eb: Unknown result type (might be due to invalid IL or missing references) + //IL_00f7: Unknown result type (might be due to invalid IL or missing references) + //IL_0101: Expected O, but got Unknown + //IL_0104: Unknown result type (might be due to invalid IL or missing references) + //IL_010e: Expected O, but got Unknown + //IL_0111: Unknown result type (might be due to invalid IL or missing references) + //IL_011b: Expected O, but got Unknown + //IL_011e: Unknown result type (might be due to invalid IL or missing references) + //IL_0128: Expected O, but got Unknown + //IL_0135: Unknown result type (might be due to invalid IL or missing references) + //IL_013f: Expected O, but got Unknown + //IL_014c: Unknown result type (might be due to invalid IL or missing references) + //IL_0156: Expected O, but got Unknown + //IL_0159: Unknown result type (might be due to invalid IL or missing references) + //IL_0163: Expected O, but got Unknown + //IL_0170: Unknown result type (might be due to invalid IL or missing references) + //IL_017a: Expected O, but got Unknown + //IL_0187: Unknown result type (might be due to invalid IL or missing references) + //IL_0191: Expected O, but got Unknown + //IL_0194: Unknown result type (might be due to invalid IL or missing references) + //IL_019e: Expected O, but got Unknown + //IL_01ab: Unknown result type (might be due to invalid IL or missing references) + //IL_01b5: Expected O, but got Unknown + //IL_01b8: Unknown result type (might be due to invalid IL or missing references) + //IL_01c2: Expected O, but got Unknown + //IL_01cf: Unknown result type (might be due to invalid IL or missing references) + //IL_01d9: Expected O, but got Unknown + //IL_01db: Unknown result type (might be due to invalid IL or missing references) + //IL_01e7: Unknown result type (might be due to invalid IL or missing references) + //IL_01f1: Expected O, but got Unknown + //IL_01f3: Unknown result type (might be due to invalid IL or missing references) + //IL_01ff: Unknown result type (might be due to invalid IL or missing references) + //IL_0209: Expected O, but got Unknown + //IL_020b: Unknown result type (might be due to invalid IL or missing references) + //IL_0217: Unknown result type (might be due to invalid IL or missing references) + //IL_0221: Expected O, but got Unknown + //IL_0223: Unknown result type (might be due to invalid IL or missing references) + //IL_022f: Unknown result type (might be due to invalid IL or missing references) + //IL_0239: Expected O, but got Unknown + //IL_023b: Unknown result type (might be due to invalid IL or missing references) + //IL_0247: Unknown result type (might be due to invalid IL or missing references) + //IL_0251: Expected O, but got Unknown + //IL_0253: Unknown result type (might be due to invalid IL or missing references) + //IL_025f: Unknown result type (might be due to invalid IL or missing references) + //IL_0269: Expected O, but got Unknown + //IL_026b: Unknown result type (might be due to invalid IL or missing references) + //IL_0277: Unknown result type (might be due to invalid IL or missing references) + //IL_0281: Expected O, but got Unknown + //IL_0283: Unknown result type (might be due to invalid IL or missing references) + //IL_028f: Unknown result type (might be due to invalid IL or missing references) + //IL_0299: Expected O, but got Unknown + //IL_029b: Unknown result type (might be due to invalid IL or missing references) + //IL_02a7: Unknown result type (might be due to invalid IL or missing references) + //IL_02b1: Expected O, but got Unknown + //IL_02b3: Unknown result type (might be due to invalid IL or missing references) + //IL_02bf: Unknown result type (might be due to invalid IL or missing references) + //IL_02c9: Expected O, but got Unknown + //IL_02cb: Unknown result type (might be due to invalid IL or missing references) + //IL_02d7: Unknown result type (might be due to invalid IL or missing references) + //IL_02e1: Expected O, but got Unknown + //IL_02e3: Unknown result type (might be due to invalid IL or missing references) + //IL_02ef: Unknown result type (might be due to invalid IL or missing references) + //IL_02f9: Expected O, but got Unknown + //IL_02fb: Unknown result type (might be due to invalid IL or missing references) + //IL_0307: Unknown result type (might be due to invalid IL or missing references) + //IL_0311: Expected O, but got Unknown + //IL_0313: Unknown result type (might be due to invalid IL or missing references) + //IL_031f: Unknown result type (might be due to invalid IL or missing references) + //IL_0329: Expected O, but got Unknown + //IL_032b: Unknown result type (might be due to invalid IL or missing references) + //IL_0337: Unknown result type (might be due to invalid IL or missing references) + //IL_0341: Expected O, but got Unknown + //IL_0343: Unknown result type (might be due to invalid IL or missing references) + //IL_034f: Unknown result type (might be due to invalid IL or missing references) + //IL_0359: Expected O, but got Unknown + //IL_035b: Unknown result type (might be due to invalid IL or missing references) + //IL_0367: Unknown result type (might be due to invalid IL or missing references) + //IL_0371: Expected O, but got Unknown + //IL_0372: Unknown result type (might be due to invalid IL or missing references) + //IL_037e: Unknown result type (might be due to invalid IL or missing references) + //IL_0388: Expected O, but got Unknown + //IL_038a: Unknown result type (might be due to invalid IL or missing references) + //IL_0396: Unknown result type (might be due to invalid IL or missing references) + //IL_03a0: Expected O, but got Unknown + //IL_03a1: Unknown result type (might be due to invalid IL or missing references) + //IL_03ad: Unknown result type (might be due to invalid IL or missing references) + //IL_03b7: Expected O, but got Unknown + //IL_03b9: Unknown result type (might be due to invalid IL or missing references) + //IL_03c5: Unknown result type (might be due to invalid IL or missing references) + //IL_03cf: Expected O, but got Unknown + //IL_03d2: Unknown result type (might be due to invalid IL or missing references) + //IL_03dc: Expected O, but got Unknown + //IL_03de: Unknown result type (might be due to invalid IL or missing references) + //IL_03ea: Unknown result type (might be due to invalid IL or missing references) + //IL_03f4: Expected O, but got Unknown + //IL_03f7: Unknown result type (might be due to invalid IL or missing references) + //IL_0401: Expected O, but got Unknown + //IL_0411: Unknown result type (might be due to invalid IL or missing references) + //IL_041b: Expected O, but got Unknown + //IL_0428: Unknown result type (might be due to invalid IL or missing references) + //IL_0432: Expected O, but got Unknown + //IL_0434: Unknown result type (might be due to invalid IL or missing references) + //IL_0440: Unknown result type (might be due to invalid IL or missing references) + //IL_044a: Expected O, but got Unknown + //IL_044c: Unknown result type (might be due to invalid IL or missing references) + //IL_0458: Unknown result type (might be due to invalid IL or missing references) + //IL_0462: Expected O, but got Unknown + //IL_0464: Unknown result type (might be due to invalid IL or missing references) + //IL_0470: Unknown result type (might be due to invalid IL or missing references) + //IL_047a: Expected O, but got Unknown + //IL_047c: Unknown result type (might be due to invalid IL or missing references) + //IL_0488: Unknown result type (might be due to invalid IL or missing references) + //IL_0492: Expected O, but got Unknown + //IL_0493: Unknown result type (might be due to invalid IL or missing references) + //IL_049f: Unknown result type (might be due to invalid IL or missing references) + //IL_04a9: Expected O, but got Unknown + //IL_04ab: Unknown result type (might be due to invalid IL or missing references) + //IL_04b7: Unknown result type (might be due to invalid IL or missing references) + //IL_04c1: Expected O, but got Unknown + //IL_04c4: Unknown result type (might be due to invalid IL or missing references) + //IL_04ce: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ProgressRing = (Image)target; + break; + case 2: + RelatorioBox = (ComboBox)target; + ((Selector)RelatorioBox).SelectionChanged += new SelectionChangedEventHandler(TipoRelatorio_OnSelectionChanged); + break; + case 3: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AbrirInfo_Click); + break; + case 4: + ValorInicioBox = (CurrencyTextBox)target; + break; + case 5: + ValorFimBox = (CurrencyTextBox)target; + break; + case 6: + InicioBox = (DatePicker)target; + ((UIElement)InicioBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((Control)InicioBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 7: + FimBox = (DatePicker)target; + ((UIElement)FimBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((Control)FimBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 8: + VisualizarRamosVendedoresTooltip = (ToggleButton)target; + ((ButtonBase)VisualizarRamosVendedoresTooltip).Click += new RoutedEventHandler(ReloadWindow_Click); + break; + case 9: + GerarRelatorioButton = (MenuItem)target; + GerarRelatorioButton.Click += new RoutedEventHandler(GerarResultados_OnClick); + break; + case 10: + ((MenuItem)target).Click += new RoutedEventHandler(Imprimir_OnClick); + break; + case 11: + ((MenuItem)target).Click += new RoutedEventHandler(ExportarExcel_OnClick); + break; + case 12: + ((MenuItem)target).Click += new RoutedEventHandler(PlanilhaCompleta_OnClick); + break; + case 13: + ((MenuItem)target).Click += new RoutedEventHandler(Extrato_OnClick); + break; + case 14: + ((MenuItem)target).Click += new RoutedEventHandler(MaisFiltros_OnClick); + break; + case 15: + ((MenuItem)target).Click += new RoutedEventHandler(ConfigurarRelatorio_OnClick); + break; + case 16: + ((MenuItem)target).Click += new RoutedEventHandler(Sintetico_OnClick); + break; + case 17: + ((MenuItem)target).Click += new RoutedEventHandler(Tarefas_OnClick); + break; + case 18: + ((MenuItem)target).Click += new RoutedEventHandler(Etiquetas_OnClick); + break; + case 19: + ((MenuItem)target).Click += new RoutedEventHandler(Acompanhamento_OnClick); + break; + case 20: + ((MenuItem)target).Click += new RoutedEventHandler(Email_OnClick); + break; + case 21: + ((MenuItem)target).Click += new RoutedEventHandler(Apolice_OnClick); + break; + case 22: + ((MenuItem)target).Click += new RoutedEventHandler(Protocolo_OnClick); + break; + case 23: + ((MenuItem)target).Click += new RoutedEventHandler(Sincronizar_OnClick); + break; + case 24: + ((MenuItem)target).Click += new RoutedEventHandler(FecharFiltro_OnClick); + break; + case 25: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(FecharFiltro_OnClick); + break; + case 26: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 27: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 28: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AdicionarFiltro_OnClick); + break; + case 30: + RamoBox = (ComboBox)target; + break; + case 31: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AdicionarRamo_OnClick); + break; + case 33: + ReportControl = (ContentControl)target; + break; + case 34: + WebEditor = (WebEditor)target; + break; + case 35: + HelpPopup = (PopupBox)target; + HelpPopup.Opened += new RoutedEventHandler(HelpPopup_Opened); + break; + case 36: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(OcultarAjuda_OnClick); + break; + case 37: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Fechar_OnClick); + break; + case 40: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(FecharFiltroUsuario_OnClick); + break; + case 41: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBoxUsuario_Populating); + ((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBox_OnTextChanged); + break; + case 42: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(FecharInfo_Click); + break; + case 43: + NaoHaDados = (TextBlock)target; + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_004c: Unknown result type (might be due to invalid IL or missing references) + //IL_0058: Unknown result type (might be due to invalid IL or missing references) + //IL_0062: Expected O, but got Unknown + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0028: Unknown result type (might be due to invalid IL or missing references) + //IL_0032: Expected O, but got Unknown + //IL_0064: Unknown result type (might be due to invalid IL or missing references) + //IL_0070: Unknown result type (might be due to invalid IL or missing references) + //IL_007a: Expected O, but got Unknown + //IL_0034: Unknown result type (might be due to invalid IL or missing references) + //IL_0040: Unknown result type (might be due to invalid IL or missing references) + //IL_004a: Expected O, but got Unknown + switch (connectionId) + { + case 29: + ((Chip)target).DeleteClick += new RoutedEventHandler(ExcluirFiltro_OnClick); + break; + case 32: + ((Chip)target).DeleteClick += new RoutedEventHandler(ExcluirRamo_onClick); + break; + case 38: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(CopyLink_OnClick); + break; + case 39: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Play_Click); + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Relatorios/SinteticoView.cs b/Decompiler/Gestor.Application.Views.Relatorios/SinteticoView.cs new file mode 100644 index 0000000..0cde0a8 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Relatorios/SinteticoView.cs @@ -0,0 +1,509 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Runtime.InteropServices; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Forms; +using System.Windows.Input; +using System.Windows.Interop; +using System.Windows.Markup; +using System.Windows.Media; +using System.Windows.Shapes; +using System.Windows.Shell; +using Gestor.Application.Helpers; +using Gestor.Application.Model; +using Gestor.Application.ViewModels.Relatorios; +using Gestor.Model.Domain.Relatorios; + +namespace Gestor.Application.Views.Relatorios; + +public class SinteticoView : Window, IComponentConnector, IStyleConnector +{ + private enum MonitorOptions : uint + { + MonitorDefaulttoprimary = 1u, + MonitorDefaulttonearest + } + + public struct Point + { + public int X; + + public int Y; + + public Point(int x, int y) + { + X = x; + Y = y; + } + } + + private struct Minmaxinfo + { + private readonly MainWindow.Point ptReserved; + + public Point ptMaxSize; + + public Point ptMaxPosition; + + private readonly MainWindow.Point ptMinTrackSize; + + private readonly MainWindow.Point ptMaxTrackSize; + } + + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] + private class Monitorinfo + { + private readonly int cbSize = Marshal.SizeOf(typeof(Monitorinfo)); + + public readonly Rect rcMonitor; + + public readonly Rect rcWork; + + private readonly int dwFlags; + } + + public struct Rect + { + public int Left; + + public int Top; + + public int Right; + + public int Bottom; + } + + internal SinteticoViewModel ViewModel; + + private bool _buttonClickable; + + private ListSortDirection _ascending; + + private string _member; + + internal WindowChrome WindowChrome; + + internal TextBlock SubTitulo; + + internal Grid MinimizeButton; + + internal Grid MaximizeButton; + + internal Grid CloseButton; + + internal TabControl Tab; + + private bool _contentLoaded; + + public DateTime? DateStart { get; set; } + + public DateTime? DateFinal { get; set; } + + private IntPtr WindowProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) + { + if (msg == 36) + { + WmGetMinMaxInfo(lParam); + } + return IntPtr.Zero; + } + + private void WmGetMinMaxInfo(IntPtr lParam) + { + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + ((FrameworkElement)this).MaxHeight = Screen.FromHandle(new WindowInteropHelper((Window)(object)this).Handle).WorkingArea.Height; + GetCursorPos(out var lpPoint); + IntPtr hMonitor = MonitorFromPoint(new MainWindow.Point(0, 0), MonitorOptions.MonitorDefaulttoprimary); + Monitorinfo monitorinfo = new Monitorinfo(); + if (GetMonitorInfo(hMonitor, monitorinfo)) + { + IntPtr intPtr = MonitorFromPoint(lpPoint, MonitorOptions.MonitorDefaulttonearest); + Minmaxinfo structure = (Minmaxinfo)Marshal.PtrToStructure(lParam, typeof(Minmaxinfo)); + if (hMonitor.Equals((object?)(nint)intPtr)) + { + structure.ptMaxPosition.X = monitorinfo.rcWork.Left; + structure.ptMaxPosition.Y = monitorinfo.rcWork.Top; + structure.ptMaxSize.X = monitorinfo.rcWork.Right - monitorinfo.rcWork.Left; + structure.ptMaxSize.Y = monitorinfo.rcWork.Bottom - monitorinfo.rcWork.Top; + } + else + { + structure.ptMaxPosition.X = monitorinfo.rcMonitor.Left; + structure.ptMaxPosition.Y = monitorinfo.rcMonitor.Top; + structure.ptMaxSize.X = monitorinfo.rcMonitor.Right - monitorinfo.rcMonitor.Left; + structure.ptMaxSize.Y = monitorinfo.rcMonitor.Bottom - monitorinfo.rcMonitor.Top; + } + Marshal.StructureToPtr(structure, lParam, fDeleteOld: true); + } + } + + [DllImport("user32.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + private static extern bool GetCursorPos(out MainWindow.Point lpPoint); + + [DllImport("user32.dll", SetLastError = true)] + private static extern IntPtr MonitorFromPoint(MainWindow.Point pt, MonitorOptions dwFlags); + + [DllImport("user32.dll")] + private static extern bool GetMonitorInfo(IntPtr hMonitor, Monitorinfo lpmi); + + public SinteticoView(List<Sintetico> sintetico, string relatorio, DateTime? inicio, DateTime? fim) + { + //IL_00d5: Unknown result type (might be due to invalid IL or missing references) + //IL_00df: Expected O, but got Unknown + //IL_00ec: Unknown result type (might be due to invalid IL or missing references) + //IL_00f6: Expected O, but got Unknown + //IL_0103: Unknown result type (might be due to invalid IL or missing references) + //IL_010d: Expected O, but got Unknown + //IL_011a: Unknown result type (might be due to invalid IL or missing references) + //IL_0124: Expected O, but got Unknown + //IL_0131: Unknown result type (might be due to invalid IL or missing references) + //IL_013b: Expected O, but got Unknown + //IL_0148: Unknown result type (might be due to invalid IL or missing references) + //IL_0152: Expected O, but got Unknown + ViewModel = new SinteticoViewModel(sintetico, relatorio); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + SubTitulo.Text = "VALORES BASEADOS NA RELAÇÃO EMITIDA ANTERIORMENTE - INICIO: " + inicio?.ToString("dd/MM/yyyy") + " FIM: " + fim?.ToString("dd/MM/yyyy"); + DateStart = inicio ?? DateTime.MinValue; + DateFinal = fim ?? DateTime.MinValue; + ((UIElement)MinimizeButton).MouseEnter += new MouseEventHandler(TopControls_OnMouseEnter); + ((UIElement)MinimizeButton).MouseLeave += new MouseEventHandler(TopControls_OnMouseLeave); + ((UIElement)MaximizeButton).MouseEnter += new MouseEventHandler(TopControls_OnMouseEnter); + ((UIElement)MaximizeButton).MouseLeave += new MouseEventHandler(TopControls_OnMouseLeave); + ((UIElement)CloseButton).MouseEnter += new MouseEventHandler(TopControls_OnMouseEnter); + ((UIElement)CloseButton).MouseLeave += new MouseEventHandler(TopControls_OnMouseLeave); + } + + private void TopControls_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + //IL_0008: Unknown result type (might be due to invalid IL or missing references) + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + //IL_0030: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_003f: Expected O, but got Unknown + _buttonClickable = true; + ((Panel)(Grid)sender).Background = (Brush)((((FrameworkElement)(Grid)sender).Name == "CloseButton") ? new SolidColorBrush(Colors.Red) : new SolidColorBrush(Colors.DimGray)); + } + + private void TopControls_OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + if (_buttonClickable) + { + ((object)this).GetType().GetMethod(((FrameworkElement)(Grid)sender).Name + "_Click")?.Invoke(this, null); + } + } + + private static void TopControls_OnMouseEnter(object sender, MouseEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Unknown result type (might be due to invalid IL or missing references) + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_001d: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Unknown result type (might be due to invalid IL or missing references) + //IL_0038: Expected O, but got Unknown + //IL_0039: Unknown result type (might be due to invalid IL or missing references) + //IL_0044: Expected O, but got Unknown + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_0053: Unknown result type (might be due to invalid IL or missing references) + //IL_005d: Expected O, but got Unknown + ((Panel)(Grid)sender).Background = (Brush)((((FrameworkElement)(Grid)sender).Name == "CloseButton") ? new SolidColorBrush(Colors.IndianRed) : new SolidColorBrush(Colors.Gray)); + DependencyObject child = VisualTreeHelper.GetChild((DependencyObject)(Grid)sender, 0); + Path val = (Path)(object)((child is Path) ? child : null); + if (val != null) + { + ((Shape)val).Stroke = (Brush)new SolidColorBrush(Colors.White); + } + } + + private void TopControls_OnMouseLeave(object sender, MouseEventArgs e) + { + //IL_0008: Unknown result type (might be due to invalid IL or missing references) + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Unknown result type (might be due to invalid IL or missing references) + //IL_001c: Expected O, but got Unknown + //IL_001d: Unknown result type (might be due to invalid IL or missing references) + //IL_0028: Expected O, but got Unknown + //IL_0032: Unknown result type (might be due to invalid IL or missing references) + //IL_0037: Unknown result type (might be due to invalid IL or missing references) + //IL_0041: Expected O, but got Unknown + _buttonClickable = false; + ((Panel)(Grid)sender).Background = (Brush)new SolidColorBrush(Colors.Transparent); + DependencyObject child = VisualTreeHelper.GetChild((DependencyObject)(Grid)sender, 0); + Path val = (Path)(object)((child is Path) ? child : null); + if (val != null) + { + ((Shape)val).Stroke = (Brush)new SolidColorBrush(Colors.White); + } + } + + public void MinimizeButton_Click() + { + ((Window)this).WindowState = (WindowState)1; + } + + public void MaximizeButton_Click() + { + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + ((Window)this).WindowState = (WindowState)(((int)((Window)this).WindowState == 0) ? 2 : 0); + } + + public void CloseButton_Click() + { + ((Window)this).Close(); + } + + protected sealed override void OnStateChanged(EventArgs e) + { + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + //IL_0008: Invalid comparison between Unknown and I4 + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + //IL_0025: Invalid comparison between Unknown and I4 + //IL_002c: Unknown result type (might be due to invalid IL or missing references) + //IL_003d: Unknown result type (might be due to invalid IL or missing references) + //IL_0043: Invalid comparison between Unknown and I4 + //IL_0058: Unknown result type (might be due to invalid IL or missing references) + //IL_005e: Invalid comparison between Unknown and I4 + ((Control)this).BorderThickness = new Thickness((double)(((int)((Window)this).WindowState != 2) ? 1 : 0)); + WindowChrome.ResizeBorderThickness = new Thickness((double)(((int)((Window)this).WindowState != 2) ? 4 : 0)); + WindowChrome.CaptionHeight = (((int)((Window)this).WindowState == 2) ? 33 : 30); + ViewModel.MaximizeRestore = (((int)((Window)this).WindowState == 2) ? Geometry.Parse((string)Application.Current.Resources[(object)"Restore"]) : Geometry.Parse((string)Application.Current.Resources[(object)"Maximize"])); + ((Window)this).OnStateChanged(e); + } + + private void Window_OnInitialized(object sender, EventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_0023: Unknown result type (might be due to invalid IL or missing references) + //IL_002d: Expected O, but got Unknown + WindowInteropHelper val = new WindowInteropHelper((Window)(object)this); + val.EnsureHandle(); + HwndSource obj = HwndSource.FromHwnd(val.Handle); + if (obj != null) + { + obj.AddHook(new HwndSourceHook(WindowProc)); + } + } + + private async void Imprimir_OnClick(object sender, RoutedEventArgs e) + { + MenuItem val = (MenuItem)sender; + if (val != null && ((FrameworkElement)val).DataContext != null) + { + SinteticoSource sinteticoSource = (SinteticoSource)((FrameworkElement)val).DataContext; + if (DateStart != DateTime.MinValue) + { + sinteticoSource.DateStart = DateStart; + sinteticoSource.DateFinal = DateFinal; + } + await ViewModel.Print(sinteticoSource); + } + } + + private async void ImprimirUnicaPagina_OnClick(object sender, RoutedEventArgs e) + { + MenuItem val = (MenuItem)sender; + if (val != null && ((FrameworkElement)val).DataContext != null) + { + SinteticoSource sinteticoSource = (SinteticoSource)((FrameworkElement)val).DataContext; + if (DateStart != DateTime.MinValue) + { + sinteticoSource.DateStart = DateStart; + sinteticoSource.DateFinal = DateFinal; + } + await ViewModel.PrintUnica(sinteticoSource); + } + } + + private void AjustaNome(SinteticoSource source) + { + foreach (ValorSintetico listum in source.Lista) + { + if (!string.IsNullOrEmpty(listum.Porcentagem) && !listum.Indice.Contains(listum.Porcentagem)) + { + listum.Indice = listum.Indice + " - " + listum.Porcentagem + "%"; + } + } + } + + private async void ExportarPdf_OnClick(object sender, RoutedEventArgs e) + { + MenuItem val = (MenuItem)sender; + if (val != null && ((FrameworkElement)val).DataContext != null) + { + SinteticoSource sintetico = (SinteticoSource)((FrameworkElement)val).DataContext; + await ViewModel.GerarPdf(sintetico); + } + } + + private async void ExportarExcel_OnClick(object sender, RoutedEventArgs e) + { + MenuItem val = (MenuItem)sender; + if (val != null && ((FrameworkElement)val).DataContext != null) + { + SinteticoSource sintetico = (SinteticoSource)((FrameworkElement)val).DataContext; + await ViewModel.GerarExcel(sintetico); + } + } + + private void DataGrid_Sorting(object sender, DataGridSortingEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + DataGrid val = (DataGrid)sender; + if (val == null || ((FrameworkElement)val).DataContext == null) + { + return; + } + if (_member == ((DataGridColumnEventArgs)e).Column.SortMemberPath) + { + _ascending = ((_ascending == ListSortDirection.Ascending) ? ListSortDirection.Descending : ListSortDirection.Ascending); + } + else + { + _ascending = ListSortDirection.Ascending; + } + if (!(((ItemsControl)val).ItemsSource is ObservableCollection<ValorSintetico> observableCollection)) + { + return; + } + IQueryable<ValorSintetico> source = observableCollection.AsQueryable(); + List<ValorSintetico> list = ((_ascending == ListSortDirection.Ascending) ? source.OrderBy(((DataGridColumnEventArgs)e).Column.SortMemberPath).ToList() : source.OrderByDescending(((DataGridColumnEventArgs)e).Column.SortMemberPath).ToList()).OrderBy((ValorSintetico x) => x.Indice == "TOTAL").ToList(); + observableCollection.Clear(); + foreach (ValorSintetico item in list) + { + observableCollection.Add(item); + } + ViewModel.OnPropertyChanged("DataGrid_Sorting"); + _member = ((DataGridColumnEventArgs)e).Column.SortMemberPath; + e.Handled = true; + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/relatorios/sinteticoview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0043: Unknown result type (might be due to invalid IL or missing references) + //IL_004d: Expected O, but got Unknown + //IL_0050: Unknown result type (might be due to invalid IL or missing references) + //IL_005a: Expected O, but got Unknown + //IL_005d: Unknown result type (might be due to invalid IL or missing references) + //IL_0067: Expected O, but got Unknown + //IL_0074: Unknown result type (might be due to invalid IL or missing references) + //IL_007e: Expected O, but got Unknown + //IL_008b: Unknown result type (might be due to invalid IL or missing references) + //IL_0095: Expected O, but got Unknown + //IL_0098: Unknown result type (might be due to invalid IL or missing references) + //IL_00a2: Expected O, but got Unknown + //IL_00af: Unknown result type (might be due to invalid IL or missing references) + //IL_00b9: Expected O, but got Unknown + //IL_00c6: Unknown result type (might be due to invalid IL or missing references) + //IL_00d0: Expected O, but got Unknown + //IL_00d3: Unknown result type (might be due to invalid IL or missing references) + //IL_00dd: Expected O, but got Unknown + //IL_00ea: Unknown result type (might be due to invalid IL or missing references) + //IL_00f4: Expected O, but got Unknown + //IL_0101: Unknown result type (might be due to invalid IL or missing references) + //IL_010b: Expected O, but got Unknown + //IL_010e: Unknown result type (might be due to invalid IL or missing references) + //IL_0118: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((FrameworkElement)(SinteticoView)target).Initialized += Window_OnInitialized; + break; + case 2: + WindowChrome = (WindowChrome)target; + break; + case 3: + SubTitulo = (TextBlock)target; + break; + case 4: + MinimizeButton = (Grid)target; + ((UIElement)MinimizeButton).MouseLeftButtonDown += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonDown); + ((UIElement)MinimizeButton).MouseLeftButtonUp += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonUp); + break; + case 5: + MaximizeButton = (Grid)target; + ((UIElement)MaximizeButton).MouseLeftButtonDown += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonDown); + ((UIElement)MaximizeButton).MouseLeftButtonUp += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonUp); + break; + case 6: + CloseButton = (Grid)target; + ((UIElement)CloseButton).MouseLeftButtonDown += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonDown); + ((UIElement)CloseButton).MouseLeftButtonUp += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonUp); + break; + case 7: + Tab = (TabControl)target; + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_001e: Unknown result type (might be due to invalid IL or missing references) + //IL_002a: Unknown result type (might be due to invalid IL or missing references) + //IL_0034: Expected O, but got Unknown + //IL_0036: Unknown result type (might be due to invalid IL or missing references) + //IL_0042: Unknown result type (might be due to invalid IL or missing references) + //IL_004c: Expected O, but got Unknown + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_005a: Unknown result type (might be due to invalid IL or missing references) + //IL_0064: Expected O, but got Unknown + //IL_0066: Unknown result type (might be due to invalid IL or missing references) + //IL_0072: Unknown result type (might be due to invalid IL or missing references) + //IL_007c: Expected O, but got Unknown + //IL_007e: Unknown result type (might be due to invalid IL or missing references) + //IL_008a: Unknown result type (might be due to invalid IL or missing references) + //IL_0094: Expected O, but got Unknown + switch (connectionId) + { + case 8: + ((MenuItem)target).Click += new RoutedEventHandler(Imprimir_OnClick); + break; + case 9: + ((MenuItem)target).Click += new RoutedEventHandler(ExportarPdf_OnClick); + break; + case 10: + ((MenuItem)target).Click += new RoutedEventHandler(ExportarExcel_OnClick); + break; + case 11: + ((MenuItem)target).Click += new RoutedEventHandler(ImprimirUnicaPagina_OnClick); + break; + case 12: + ((DataGrid)target).Sorting += new DataGridSortingEventHandler(DataGrid_Sorting); + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Seguros.Itens/AeronauticoView.cs b/Decompiler/Gestor.Application.Views.Seguros.Itens/AeronauticoView.cs new file mode 100644 index 0000000..b4314ea --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Seguros.Itens/AeronauticoView.cs @@ -0,0 +1,373 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Threading; +using Gestor.Application.Componentes; +using Gestor.Application.Drawers; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.ViewModels; +using Gestor.Application.ViewModels.Seguros; +using Gestor.Application.ViewModels.Seguros.Itens; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Views.Seguros.Itens; + +public class AeronauticoView : BaseUserControl, IComponentConnector +{ + public AeronauticoViewModel ViewModel; + + private readonly MenuItemViewModel _menuItemViewModel; + + private string _lastCategory = ""; + + internal MenuItem IncluirItemButton; + + internal MenuItem SinistroButton; + + internal RadioButton CoberturasRadioButton; + + internal RadioButton MaisInformacoesRadioButton; + + internal ContentControl ContentControl; + + internal CustomItemValidation MaisInformacoes; + + private bool _contentLoaded; + + public AeronauticoView(MenuItemViewModel menuItemViewModel, bool lockInsert = false, bool substituir = false, ManutencaoItem manutencao = null, Item itemSelecionado = null, Ramo ramo = null, bool endossoRenovacao = false) + { + _menuItemViewModel = menuItemViewModel; + ViewModel = new AeronauticoViewModel(substituir, manutencao, itemSelecionado, ramo, endossoRenovacao); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + if (lockInsert) + { + ((UIElement)IncluirItemButton).IsEnabled = false; + ((UIElement)SinistroButton).Visibility = (Visibility)2; + } + } + + public async Task Selecionar(Item item) + { + await ViewModel.SelecionaItem(item); + } + + public void Manter(ManutencaoItem manutencao) + { + ViewModel.Manter(ConsultaViewModel.ItemSelecionado, manutencao); + } + + public void Substituir() + { + ViewModel.Substituir(ConsultaViewModel.ItemSelecionado); + } + + private void ContentLoad() + { + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Expected O, but got Unknown + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Expected O, but got Unknown + ((ToggleButton)CoberturasRadioButton).Checked += new RoutedEventHandler(Documento_OnChecked); + ((ToggleButton)MaisInformacoesRadioButton).Checked += new RoutedEventHandler(Documento_OnChecked); + } + + private void Documento_OnChecked(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + RadioButton val = (RadioButton)sender; + if (!string.IsNullOrEmpty(val.GroupName)) + { + ViewModel.Descarregar(); + ((UIElement)ContentControl).Visibility = (Visibility)2; + ((UIElement)MaisInformacoes).Visibility = (Visibility)2; + ((DependencyObject)(object)MaisInformacoes).ClearInvalid(); + ((DependencyObject)(object)ContentControl).ClearInvalid(); + if (!(((FrameworkElement)val).Name == "MaisInformacoesRadioButton")) + { + ((UIElement)ContentControl).Visibility = (Visibility)0; + ViewModel.CarregaCobertura(); + } + else + { + ((UIElement)MaisInformacoes).Visibility = (Visibility)0; + } + } + } + + private async void Incluir_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.Incluir(); + List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedItem.Validate(); + ((DependencyObject)(object)this).ValidateFields(errorMessages); + } + + private async void Excluir_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.Excluir(); + _menuItemViewModel?.RecarregarItens(null); + } + + private void Cancelar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.CancelarAlteracao(); + } + + public async void Salvar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(); + ((DependencyObject)(object)this).ValidateFields(list); + bool num = list == null || list.Count == 0; + ViewModel.Loading(isLoading: false); + if (num) + { + if (((DomainBase)ViewModel.SelectedItem).Id > 0) + { + _menuItemViewModel?.RecarregarItens(ViewModel.SelectedItem); + } + } + else + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + } + + private void Tipo_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_0047: Unknown result type (might be due to invalid IL or missing references) + //IL_0051: Unknown result type (might be due to invalid IL or missing references) + //IL_008e: Unknown result type (might be due to invalid IL or missing references) + if (((Selector)(ComboBox)sender).SelectedItem != null && !(ValidationHelper.GetCategory((Enum)(object)(TipoAeronautico)((Selector)(ComboBox)sender).SelectedItem) == _lastCategory)) + { + ViewModel.SelectedItem.Aeronautico.Tipo = (TipoAeronautico)((Selector)(ComboBox)sender).SelectedItem; + ViewModel.UpdateAero(); + ((DependencyObject)(object)this).ValidateFields(ViewModel.SelectedItem.Validate()); + _lastCategory = ValidationHelper.GetCategory((Enum)(object)ViewModel.SelectedItem.Aeronautico.Tipo); + } + } + + private void Alterar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Alterar(alterar: true); + } + + private async void AbrirAquivoDigital_Click(object sender, RoutedEventArgs e) + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)4).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)4) + "."); + return; + } + FiltroArquivoDigital filtro = new FiltroArquivoDigital + { + Id = ((DomainBase)ViewModel.SelectedItem).Id, + IdApolice = ((DomainBase)ViewModel.SelectedItem.Documento).Id, + Tipo = (TipoArquivoDigital)4, + Parente = ViewModel.SelectedItem + }; + ViewModel.ShowDrawer(new ArquivoDigitalDrawer(filtro), 0, close: false); + } + + private void AbrirLog_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLog((TipoTela)3, ((DomainBase)ViewModel.SelectedItem).Id); + } + + private void AbrirLogEmail_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLogEmail((TipoTela)3, ((DomainBase)ViewModel.SelectedItem).Id); + } + + private void MenuItem_OnClick(object sender, RoutedEventArgs e) + { + ((Window)new HosterWindow((ContentControl)(object)new SinistroView(ViewModel.SelectedItem, attached: false), "CADASTRO DE SINISTROS - " + ViewModel.SelectedItem.Descricao)).ShowDialog(); + _menuItemViewModel?.RecarregarItens(ViewModel.SelectedItem); + } + + private void CopyCodItem(object sender, MouseButtonEventArgs e) + { + ViewModel.CodigoItem.CopyToClipboard(); + ViewModel.ToggleSnackBar("COPIADO - " + ViewModel.CodigoItem); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/seguros/itens/aeronauticoview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_005f: Unknown result type (might be due to invalid IL or missing references) + //IL_0069: Expected O, but got Unknown + //IL_0076: Unknown result type (might be due to invalid IL or missing references) + //IL_0080: Expected O, but got Unknown + //IL_0082: Unknown result type (might be due to invalid IL or missing references) + //IL_008e: Unknown result type (might be due to invalid IL or missing references) + //IL_0098: Expected O, but got Unknown + //IL_009a: Unknown result type (might be due to invalid IL or missing references) + //IL_00a6: Unknown result type (might be due to invalid IL or missing references) + //IL_00b0: Expected O, but got Unknown + //IL_00b2: Unknown result type (might be due to invalid IL or missing references) + //IL_00be: Unknown result type (might be due to invalid IL or missing references) + //IL_00c8: Expected O, but got Unknown + //IL_00ca: Unknown result type (might be due to invalid IL or missing references) + //IL_00d6: Unknown result type (might be due to invalid IL or missing references) + //IL_00e0: Expected O, but got Unknown + //IL_00e2: Unknown result type (might be due to invalid IL or missing references) + //IL_00ee: Unknown result type (might be due to invalid IL or missing references) + //IL_00f8: Expected O, but got Unknown + //IL_00fa: Unknown result type (might be due to invalid IL or missing references) + //IL_0106: Unknown result type (might be due to invalid IL or missing references) + //IL_0110: Expected O, but got Unknown + //IL_0113: Unknown result type (might be due to invalid IL or missing references) + //IL_011d: Expected O, but got Unknown + //IL_012a: Unknown result type (might be due to invalid IL or missing references) + //IL_0134: Expected O, but got Unknown + //IL_0136: Unknown result type (might be due to invalid IL or missing references) + //IL_0142: Unknown result type (might be due to invalid IL or missing references) + //IL_014c: Expected O, but got Unknown + //IL_014e: Unknown result type (might be due to invalid IL or missing references) + //IL_015a: Unknown result type (might be due to invalid IL or missing references) + //IL_0164: Expected O, but got Unknown + //IL_0166: Unknown result type (might be due to invalid IL or missing references) + //IL_0172: Unknown result type (might be due to invalid IL or missing references) + //IL_017c: Expected O, but got Unknown + //IL_017e: Unknown result type (might be due to invalid IL or missing references) + //IL_018b: Unknown result type (might be due to invalid IL or missing references) + //IL_0195: Expected O, but got Unknown + //IL_0197: Unknown result type (might be due to invalid IL or missing references) + //IL_01a4: Unknown result type (might be due to invalid IL or missing references) + //IL_01ae: Expected O, but got Unknown + //IL_01b0: Unknown result type (might be due to invalid IL or missing references) + //IL_01bd: Unknown result type (might be due to invalid IL or missing references) + //IL_01c7: Expected O, but got Unknown + //IL_01c9: Unknown result type (might be due to invalid IL or missing references) + //IL_01d6: Unknown result type (might be due to invalid IL or missing references) + //IL_01e0: Expected O, but got Unknown + //IL_01e2: Unknown result type (might be due to invalid IL or missing references) + //IL_01ee: Unknown result type (might be due to invalid IL or missing references) + //IL_01f8: Expected O, but got Unknown + //IL_01f9: Unknown result type (might be due to invalid IL or missing references) + //IL_0205: Unknown result type (might be due to invalid IL or missing references) + //IL_020f: Expected O, but got Unknown + //IL_0210: Unknown result type (might be due to invalid IL or missing references) + //IL_021c: Unknown result type (might be due to invalid IL or missing references) + //IL_0226: Expected O, but got Unknown + //IL_0229: Unknown result type (might be due to invalid IL or missing references) + //IL_0233: Expected O, but got Unknown + //IL_0236: Unknown result type (might be due to invalid IL or missing references) + //IL_0240: Expected O, but got Unknown + //IL_0243: Unknown result type (might be due to invalid IL or missing references) + //IL_024d: Expected O, but got Unknown + switch (connectionId) + { + case 1: + IncluirItemButton = (MenuItem)target; + IncluirItemButton.Click += new RoutedEventHandler(Incluir_OnClick); + break; + case 2: + ((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick); + break; + case 3: + ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick); + break; + case 4: + ((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick); + break; + case 5: + ((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick); + break; + case 6: + ((Control)(TextBox)target).MouseDoubleClick += new MouseButtonEventHandler(CopyCodItem); + break; + case 7: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirAquivoDigital_Click); + break; + case 8: + SinistroButton = (MenuItem)target; + SinistroButton.Click += new RoutedEventHandler(MenuItem_OnClick); + break; + case 9: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick); + break; + case 10: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLogEmail_OnClick); + break; + case 11: + ((Selector)(ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(Tipo_OnSelectionChanged); + break; + case 12: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 13: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 14: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 15: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 16: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 17: + CoberturasRadioButton = (RadioButton)target; + break; + case 18: + MaisInformacoesRadioButton = (RadioButton)target; + break; + case 19: + ContentControl = (ContentControl)target; + break; + case 20: + MaisInformacoes = (CustomItemValidation)target; + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Seguros.Itens/AutoView.cs b/Decompiler/Gestor.Application.Views.Seguros.Itens/AutoView.cs new file mode 100644 index 0000000..f5a5284 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Seguros.Itens/AutoView.cs @@ -0,0 +1,660 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Threading; +using Gestor.Application.Actions; +using Gestor.Application.Componentes; +using Gestor.Application.Drawers; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.ViewModels; +using Gestor.Application.ViewModels.Seguros; +using Gestor.Application.ViewModels.Seguros.Itens; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.Helper; + +namespace Gestor.Application.Views.Seguros.Itens; + +public class AutoView : BaseUserControl, IComponentConnector +{ + public AutoViewModel ViewModel; + + private readonly MenuItemViewModel _menuItemViewModel; + + internal MenuItem IncluirItemButton; + + internal MenuItem SinistroButton; + + internal WrapPanel PainelDadosAuto; + + internal TextBox FipeBox; + + internal AutoCompleteBox AutoCompleteFabricacao; + + internal TextBox ModeloBox; + + internal TextBox AnoModeloBox; + + internal TextBox CepCirculacaoBox; + + internal TextBox CepPernoiteBox; + + internal ComboBox ComboBoxTipoCorrecao; + + internal RadioButton CoberturasRadioButton; + + internal RadioButton MaisInformacoesRadioButton; + + internal ContentControl ContentControl; + + internal CustomItemValidation MaisInformacoes; + + private bool _contentLoaded; + + public AutoView(MenuItemViewModel menuItemViewModel, bool lockInsert = false, bool substituir = false, ManutencaoItem manutencao = null, Item itemSelecionado = null, Ramo ramo = null, bool endossoRenovacao = false) + { + _menuItemViewModel = menuItemViewModel; + ViewModel = new AutoViewModel(substituir, manutencao, itemSelecionado, ramo, endossoRenovacao); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + if (lockInsert) + { + ((UIElement)IncluirItemButton).IsEnabled = false; + ((UIElement)SinistroButton).Visibility = (Visibility)2; + } + } + + public async Task Selecionar(Item item) + { + await ViewModel.SelecionaItem(item); + } + + public void Manter(ManutencaoItem manutencao) + { + ViewModel.Manter(ConsultaViewModel.ItemSelecionado, manutencao); + } + + public void Substituir() + { + ViewModel.Substituir(ConsultaViewModel.ItemSelecionado); + } + + private void ContentLoad() + { + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Expected O, but got Unknown + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Expected O, but got Unknown + ((ToggleButton)CoberturasRadioButton).Checked += new RoutedEventHandler(Documento_OnChecked); + ((ToggleButton)MaisInformacoesRadioButton).Checked += new RoutedEventHandler(Documento_OnChecked); + } + + private void Documento_OnChecked(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + RadioButton val = (RadioButton)sender; + if (!string.IsNullOrEmpty(val.GroupName)) + { + ViewModel.Descarregar(); + ((UIElement)ContentControl).Visibility = (Visibility)2; + ((UIElement)MaisInformacoes).Visibility = (Visibility)2; + ((DependencyObject)(object)MaisInformacoes).ClearInvalid(); + ((DependencyObject)(object)ContentControl).ClearInvalid(); + if (!(((FrameworkElement)val).Name == "MaisInformacoesRadioButton")) + { + ((UIElement)ContentControl).Visibility = (Visibility)0; + ViewModel.CarregaCobertura(); + } + else + { + ((UIElement)MaisInformacoes).Visibility = (Visibility)0; + } + } + } + + private async void Incluir_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.Incluir(); + List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedItem.Validate(Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 18), Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 27)); + ((DependencyObject)(object)this).ValidateFields(errorMessages); + } + + private async void Excluir_OnClick(object sender, RoutedEventArgs e) + { + if (await ViewModel.Excluir()) + { + _menuItemViewModel?.RecarregarItens(null); + } + } + + private void Cancelar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.CancelarAlteracao(); + } + + public async void Salvar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + ((UIElement)FipeBox).Focus(); + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(); + ((DependencyObject)(object)this).ValidateFields(list); + bool num = list == null || list.Count == 0; + ViewModel.Loading(isLoading: false); + if (num) + { + if (((DomainBase)ViewModel.SelectedItem).Id > 0) + { + _menuItemViewModel?.RecarregarItens(ViewModel.SelectedItem); + } + } + else + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + } + + private void Alterar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Alterar(alterar: true); + } + + private async void AbrirAquivoDigital_Click(object sender, RoutedEventArgs e) + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)4).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)4) + "."); + return; + } + FiltroArquivoDigital filtro = new FiltroArquivoDigital + { + Id = ((DomainBase)ViewModel.SelectedItem).Id, + IdApolice = ((DomainBase)ViewModel.SelectedItem.Documento).Id, + Tipo = (TipoArquivoDigital)4, + Parente = ViewModel.SelectedItem + }; + ViewModel.ShowDrawer(new ArquivoDigitalDrawer(filtro), 0, close: false); + } + + private void Cep_OnLostFocus(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + TextBox val = (TextBox)sender; + Item selectedItem = ViewModel.SelectedItem; + if (((selectedItem != null) ? selectedItem.Auto : null) != null && !string.IsNullOrWhiteSpace(val.Text) && ((!(((FrameworkElement)val).Name == "CepCirculacaoBox") && !(((FrameworkElement)val).Name == "CepPernoiteBox")) || !ValidationHelper.ValidaCep(val.Text)) && ValidationHelper.ValidacaoCep(ValidationHelper.FormatPostCode(val.Text))) + { + val.Text = ValidationHelper.FormatPostCode(val.Text); + } + } + + private void AutoCompleteFabricanteBox_Populating(object sender, PopulatingEventArgs e) + { + if (e.Parameter.Length < 3) + { + return; + } + e.Cancel = true; + ViewModel.BuscaFabricante(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Fabricante>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private async void Fipe_LostFocus(object sender, RoutedEventArgs e) + { + TextBox box = (TextBox)sender; + Item selectedItem = ViewModel.SelectedItem; + if (((selectedItem != null) ? selectedItem.Auto : null) == null || string.IsNullOrWhiteSpace(box.Text)) + { + return; + } + string text = ValidationHelper.FormataFipe(box.Text.Replace("-", "")); + if (!ValidationHelper.ValidaFipe(text)) + { + return; + } + box.Text = text; + if (int.TryParse(ValidationHelper.OnlyNumber(text), out var result) && result == 0) + { + return; + } + Fipe modelo = await ViewModel.BuscaModelo(box.Text); + if (modelo == null) + { + ViewModel.ToggleSnackBar("MODELO NÃO ENCONTRADO PARA O CÓDIGO FIPE " + box.Text); + return; + } + ModeloBox.Text = modelo.Modelo; + AutoCompleteFabricacao.SelectedItem = ViewModel.Fabricantes?.FirstOrDefault((Func<Fabricante, bool>)((Fabricante x) => x.Descricao == modelo.Marca)); + } + + private async void BuscarModelo_OnClick(object sender, RoutedEventArgs e) + { + Fipe fipe = await ViewModel.ShowBuscaModeloDialog(ModeloBox.Text, AnoModeloBox.Text); + if (fipe != null) + { + FipeBox.Text = fipe.Codigo; + ModeloBox.Text = fipe.Modelo; + AutoCompleteFabricacao.Text = fipe.Marca; + ViewModel.SelectedItem.Auto.Fabricante = ((IEnumerable<Fabricante>)ViewModel.Fabricantes).FirstOrDefault((Func<Fabricante, bool>)((Fabricante x) => x.Descricao == fipe.Marca)); + } + } + + private void AbrirLog_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLog((TipoTela)3, ((DomainBase)ViewModel.SelectedItem).Id); + } + + private void AbrirLogEmail_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLogEmail((TipoTela)3, ((DomainBase)ViewModel.SelectedItem).Id); + } + + private void ZeroKmToggleButton_Changed(object sender, RoutedEventArgs e) + { + if (ViewModel.SelectedItem != null) + { + List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedItem.Validate(); + ((DependencyObject)(object)this).ValidateFields(errorMessages); + } + } + + private void ComboBoxTipoCorrecao_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + if (((Selector)ComboBoxTipoCorrecao).SelectedItem != null) + { + ViewModel.Atualiza(((Selector)ComboBoxTipoCorrecao).SelectedItem.ToString().ToUpper()); + } + } + + private async void ImportarXls_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + Gestor.Application.Actions.Actions.EnablePesquisarClientes?.Invoke(obj: false); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: false); + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: false); + List<KeyValuePair<string, string>> list = await ViewModel.ImportarXls(); + bool num = list == null || list.Count == 0; + Gestor.Application.Actions.Actions.EnablePesquisarClientes?.Invoke(obj: true); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: true); + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: true); + ViewModel.Loading(isLoading: false); + if (num) + { + if (((DomainBase)ViewModel.SelectedItem).Id > 0) + { + _menuItemViewModel?.RecarregarItens(ViewModel.SelectedItem); + } + } + else + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + } + + private void BaixarXls_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.BaixarXls(); + } + + private void MenuItem_OnClick(object sender, RoutedEventArgs e) + { + ((Window)new HosterWindow((ContentControl)(object)new SinistroView(ViewModel.SelectedItem, attached: false), "CADASTRO DE SINISTROS - " + ViewModel.SelectedItem.Descricao)).ShowDialog(); + _menuItemViewModel?.RecarregarItens(ViewModel.SelectedItem); + } + + private void Renavam_OnLostFocus(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + TextBox val = (TextBox)sender; + string text = ValidationHelper.FormatRenavam(val.Text); + val.Text = text; + } + + private void Ci_OnLostFocus(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + TextBox val = (TextBox)sender; + string text = ValidationHelper.FormatCi(val.Text); + val.Text = text; + } + + private void CopyCodItem(object sender, MouseButtonEventArgs e) + { + ViewModel.CodigoItem.CopyToClipboard(); + ViewModel.ToggleSnackBar("COPIADO - " + ViewModel.CodigoItem); + } + + private void SelecionaUsoVeiculo(object sender, SelectionChangedEventArgs e) + { + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Invalid comparison between Unknown and I4 + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_002a: Invalid comparison between Unknown and I4 + if ((int)ViewModel.UsoVeiculo.GetValueOrDefault() == 2 || (int)ViewModel.UsoVeiculo.GetValueOrDefault() == 3) + { + ViewModel.SelectedItem.Auto.Categoria = (Categoria)3; + } + } + + private void KeyUpBase_OnKeyUp(object sender, KeyEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + TextBox val = (TextBox)sender; + if (!Regex.IsMatch(val.Text.Replace(".", ""), "^[0-9.]{11}$")) + { + val.Text = Regex.Replace(val.Text, "[^\\d]*", ""); + } + } + + private void Placa(object sender, KeyEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + ValidationHelper.FormataPlaca(((TextBox)sender).Text); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/seguros/itens/autoview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0097: Unknown result type (might be due to invalid IL or missing references) + //IL_00a1: Expected O, but got Unknown + //IL_00ae: Unknown result type (might be due to invalid IL or missing references) + //IL_00b8: Expected O, but got Unknown + //IL_00ba: Unknown result type (might be due to invalid IL or missing references) + //IL_00c6: Unknown result type (might be due to invalid IL or missing references) + //IL_00d0: Expected O, but got Unknown + //IL_00d2: Unknown result type (might be due to invalid IL or missing references) + //IL_00de: Unknown result type (might be due to invalid IL or missing references) + //IL_00e8: Expected O, but got Unknown + //IL_00ea: Unknown result type (might be due to invalid IL or missing references) + //IL_00f6: Unknown result type (might be due to invalid IL or missing references) + //IL_0100: Expected O, but got Unknown + //IL_0102: Unknown result type (might be due to invalid IL or missing references) + //IL_010e: Unknown result type (might be due to invalid IL or missing references) + //IL_0118: Expected O, but got Unknown + //IL_011a: Unknown result type (might be due to invalid IL or missing references) + //IL_0126: Unknown result type (might be due to invalid IL or missing references) + //IL_0130: Expected O, but got Unknown + //IL_0132: Unknown result type (might be due to invalid IL or missing references) + //IL_013e: Unknown result type (might be due to invalid IL or missing references) + //IL_0148: Expected O, but got Unknown + //IL_014b: Unknown result type (might be due to invalid IL or missing references) + //IL_0155: Expected O, but got Unknown + //IL_0162: Unknown result type (might be due to invalid IL or missing references) + //IL_016c: Expected O, but got Unknown + //IL_016e: Unknown result type (might be due to invalid IL or missing references) + //IL_017a: Unknown result type (might be due to invalid IL or missing references) + //IL_0184: Expected O, but got Unknown + //IL_0186: Unknown result type (might be due to invalid IL or missing references) + //IL_0192: Unknown result type (might be due to invalid IL or missing references) + //IL_019c: Expected O, but got Unknown + //IL_019e: Unknown result type (might be due to invalid IL or missing references) + //IL_01aa: Unknown result type (might be due to invalid IL or missing references) + //IL_01b4: Expected O, but got Unknown + //IL_01b6: Unknown result type (might be due to invalid IL or missing references) + //IL_01c2: Unknown result type (might be due to invalid IL or missing references) + //IL_01cc: Expected O, but got Unknown + //IL_01cf: Unknown result type (might be due to invalid IL or missing references) + //IL_01d9: Expected O, but got Unknown + //IL_01dc: Unknown result type (might be due to invalid IL or missing references) + //IL_01e6: Expected O, but got Unknown + //IL_01f4: Unknown result type (might be due to invalid IL or missing references) + //IL_01fe: Expected O, but got Unknown + //IL_020b: Unknown result type (might be due to invalid IL or missing references) + //IL_0215: Expected O, but got Unknown + //IL_0217: Unknown result type (might be due to invalid IL or missing references) + //IL_0224: Unknown result type (might be due to invalid IL or missing references) + //IL_022e: Expected O, but got Unknown + //IL_022f: Unknown result type (might be due to invalid IL or missing references) + //IL_023b: Unknown result type (might be due to invalid IL or missing references) + //IL_0245: Expected O, but got Unknown + //IL_0248: Unknown result type (might be due to invalid IL or missing references) + //IL_0252: Expected O, but got Unknown + //IL_025f: Unknown result type (might be due to invalid IL or missing references) + //IL_0269: Expected O, but got Unknown + //IL_026c: Unknown result type (might be due to invalid IL or missing references) + //IL_0276: Expected O, but got Unknown + //IL_0278: Unknown result type (might be due to invalid IL or missing references) + //IL_0284: Unknown result type (might be due to invalid IL or missing references) + //IL_028e: Expected O, but got Unknown + //IL_0290: Unknown result type (might be due to invalid IL or missing references) + //IL_029c: Unknown result type (might be due to invalid IL or missing references) + //IL_02a6: Expected O, but got Unknown + //IL_02a8: Unknown result type (might be due to invalid IL or missing references) + //IL_02b5: Unknown result type (might be due to invalid IL or missing references) + //IL_02bf: Expected O, but got Unknown + //IL_02c0: Unknown result type (might be due to invalid IL or missing references) + //IL_02cc: Unknown result type (might be due to invalid IL or missing references) + //IL_02d6: Expected O, but got Unknown + //IL_02d7: Unknown result type (might be due to invalid IL or missing references) + //IL_02e3: Unknown result type (might be due to invalid IL or missing references) + //IL_02ed: Expected O, but got Unknown + //IL_02ef: Unknown result type (might be due to invalid IL or missing references) + //IL_02fb: Unknown result type (might be due to invalid IL or missing references) + //IL_0305: Expected O, but got Unknown + //IL_0306: Unknown result type (might be due to invalid IL or missing references) + //IL_0312: Unknown result type (might be due to invalid IL or missing references) + //IL_031c: Expected O, but got Unknown + //IL_031e: Unknown result type (might be due to invalid IL or missing references) + //IL_032b: Unknown result type (might be due to invalid IL or missing references) + //IL_0335: Expected O, but got Unknown + //IL_0338: Unknown result type (might be due to invalid IL or missing references) + //IL_0342: Expected O, but got Unknown + //IL_0350: Unknown result type (might be due to invalid IL or missing references) + //IL_035a: Expected O, but got Unknown + //IL_035c: Unknown result type (might be due to invalid IL or missing references) + //IL_0369: Unknown result type (might be due to invalid IL or missing references) + //IL_0373: Expected O, but got Unknown + //IL_0375: Unknown result type (might be due to invalid IL or missing references) + //IL_0382: Unknown result type (might be due to invalid IL or missing references) + //IL_038c: Expected O, but got Unknown + //IL_038f: Unknown result type (might be due to invalid IL or missing references) + //IL_0399: Expected O, but got Unknown + //IL_03a6: Unknown result type (might be due to invalid IL or missing references) + //IL_03b0: Expected O, but got Unknown + //IL_03be: Unknown result type (might be due to invalid IL or missing references) + //IL_03c8: Expected O, but got Unknown + //IL_03cb: Unknown result type (might be due to invalid IL or missing references) + //IL_03d5: Expected O, but got Unknown + //IL_03e2: Unknown result type (might be due to invalid IL or missing references) + //IL_03ec: Expected O, but got Unknown + //IL_03fa: Unknown result type (might be due to invalid IL or missing references) + //IL_0404: Expected O, but got Unknown + //IL_0407: Unknown result type (might be due to invalid IL or missing references) + //IL_0411: Expected O, but got Unknown + //IL_041e: Unknown result type (might be due to invalid IL or missing references) + //IL_0428: Expected O, but got Unknown + //IL_042a: Unknown result type (might be due to invalid IL or missing references) + //IL_0436: Unknown result type (might be due to invalid IL or missing references) + //IL_0440: Expected O, but got Unknown + //IL_0441: Unknown result type (might be due to invalid IL or missing references) + //IL_044e: Unknown result type (might be due to invalid IL or missing references) + //IL_0458: Expected O, but got Unknown + //IL_045a: Unknown result type (might be due to invalid IL or missing references) + //IL_0467: Unknown result type (might be due to invalid IL or missing references) + //IL_0471: Expected O, but got Unknown + //IL_0474: Unknown result type (might be due to invalid IL or missing references) + //IL_047e: Expected O, but got Unknown + //IL_0481: Unknown result type (might be due to invalid IL or missing references) + //IL_048b: Expected O, but got Unknown + //IL_048e: Unknown result type (might be due to invalid IL or missing references) + //IL_0498: Expected O, but got Unknown + switch (connectionId) + { + case 1: + IncluirItemButton = (MenuItem)target; + IncluirItemButton.Click += new RoutedEventHandler(Incluir_OnClick); + break; + case 2: + ((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick); + break; + case 3: + ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick); + break; + case 4: + ((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick); + break; + case 5: + ((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick); + break; + case 6: + ((Control)(TextBox)target).MouseDoubleClick += new MouseButtonEventHandler(CopyCodItem); + break; + case 7: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirAquivoDigital_Click); + break; + case 8: + SinistroButton = (MenuItem)target; + SinistroButton.Click += new RoutedEventHandler(MenuItem_OnClick); + break; + case 9: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick); + break; + case 10: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLogEmail_OnClick); + break; + case 11: + ((MenuItem)target).Click += new RoutedEventHandler(ImportarXls_OnClick); + break; + case 12: + ((MenuItem)target).Click += new RoutedEventHandler(BaixarXls_OnClick); + break; + case 13: + PainelDadosAuto = (WrapPanel)target; + break; + case 14: + FipeBox = (TextBox)target; + ((UIElement)FipeBox).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + ((UIElement)FipeBox).LostFocus += new RoutedEventHandler(Fipe_LostFocus); + break; + case 15: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(((BaseUserControl)this).Placa); + ((UIElement)(TextBox)target).PreviewKeyDown += new KeyEventHandler(Placa); + break; + case 16: + AutoCompleteFabricacao = (AutoCompleteBox)target; + AutoCompleteFabricacao.Populating += new PopulatingEventHandler(AutoCompleteFabricanteBox_Populating); + break; + case 17: + ModeloBox = (TextBox)target; + break; + case 18: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(BuscarModelo_OnClick); + break; + case 19: + ((Selector)(ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(SelecionaUsoVeiculo); + break; + case 20: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(Renavam_OnLostFocus); + ((UIElement)(TextBox)target).PreviewKeyUp += new KeyEventHandler(KeyUpBase_OnKeyUp); + break; + case 21: + ((ToggleButton)target).Checked += new RoutedEventHandler(ZeroKmToggleButton_Changed); + ((ToggleButton)target).Unchecked += new RoutedEventHandler(ZeroKmToggleButton_Changed); + break; + case 22: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 23: + AnoModeloBox = (TextBox)target; + ((UIElement)AnoModeloBox).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 24: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 25: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 26: + CepCirculacaoBox = (TextBox)target; + ((UIElement)CepCirculacaoBox).LostFocus += new RoutedEventHandler(Cep_OnLostFocus); + ((UIElement)CepCirculacaoBox).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 27: + CepPernoiteBox = (TextBox)target; + ((UIElement)CepPernoiteBox).LostFocus += new RoutedEventHandler(Cep_OnLostFocus); + ((UIElement)CepPernoiteBox).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 28: + ComboBoxTipoCorrecao = (ComboBox)target; + ((Selector)ComboBoxTipoCorrecao).SelectionChanged += new SelectionChangedEventHandler(ComboBoxTipoCorrecao_SelectionChanged); + break; + case 29: + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(Ci_OnLostFocus); + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 30: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 31: + CoberturasRadioButton = (RadioButton)target; + break; + case 32: + MaisInformacoesRadioButton = (RadioButton)target; + break; + case 33: + ContentControl = (ContentControl)target; + break; + case 34: + MaisInformacoes = (CustomItemValidation)target; + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Seguros.Itens/BuscarModeloView.cs b/Decompiler/Gestor.Application.Views.Seguros.Itens/BuscarModeloView.cs new file mode 100644 index 0000000..387c028 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Seguros.Itens/BuscarModeloView.cs @@ -0,0 +1,83 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using System.Windows.Markup; +using Gestor.Application.ViewModels.Seguros.Itens; +using Gestor.Application.Views.Generic; + +namespace Gestor.Application.Views.Seguros.Itens; + +public class BuscarModeloView : BaseUserControl, IComponentConnector +{ + internal DataGrid BuscaModeloGrid; + + private bool _contentLoaded; + + public BuscarModeloViewModel ViewModel { get; set; } + + public BuscarModeloView(BuscarModeloViewModel viewModel) + { + ViewModel = viewModel; + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + private void Pesquisar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Pesquisar(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/seguros/itens/buscarmodeloview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Expected O, but got Unknown + //IL_0030: Unknown result type (might be due to invalid IL or missing references) + //IL_003c: Unknown result type (might be due to invalid IL or missing references) + //IL_0046: Expected O, but got Unknown + //IL_0049: Unknown result type (might be due to invalid IL or missing references) + //IL_0053: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 2: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Pesquisar_OnClick); + break; + case 3: + BuscaModeloGrid = (DataGrid)target; + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Seguros.Itens/ConsorcioView.cs b/Decompiler/Gestor.Application.Views.Seguros.Itens/ConsorcioView.cs new file mode 100644 index 0000000..4c3b910 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Seguros.Itens/ConsorcioView.cs @@ -0,0 +1,312 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Threading; +using Gestor.Application.Componentes; +using Gestor.Application.Drawers; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.ViewModels; +using Gestor.Application.ViewModels.Seguros; +using Gestor.Application.ViewModels.Seguros.Itens; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Views.Seguros.Itens; + +public class ConsorcioView : BaseUserControl, IComponentConnector +{ + public ConsorcioViewModel ViewModel; + + private readonly MenuItemViewModel _menuItemViewModel; + + private bool _salvando; + + internal MenuItem IncluirItemButton; + + internal MenuItem SinistroButton; + + internal RadioButton CoberturasRadioButton; + + internal RadioButton MaisInformacoesRadioButton; + + internal ContentControl ContentControl; + + internal CustomItemValidation MaisInformacoes; + + private bool _contentLoaded; + + public ConsorcioView(MenuItemViewModel menuItemViewModel, bool lockInsert = false, bool substituir = false, ManutencaoItem manutencao = null, Item itemSelecionado = null, Ramo ramo = null, bool endossoRenovacao = false) + { + _menuItemViewModel = menuItemViewModel; + ViewModel = new ConsorcioViewModel(substituir, manutencao, itemSelecionado, ramo, endossoRenovacao); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + if (lockInsert) + { + ((UIElement)IncluirItemButton).IsEnabled = false; + ((UIElement)SinistroButton).Visibility = (Visibility)2; + } + } + + public async Task Selecionar(Item item) + { + await ViewModel.SelecionaItem(item); + } + + public void Manter(ManutencaoItem manutencao) + { + ViewModel.Manter(ConsultaViewModel.ItemSelecionado, manutencao); + } + + public void Substituir() + { + ViewModel.Substituir(ConsultaViewModel.ItemSelecionado); + } + + private void ContentLoad() + { + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Expected O, but got Unknown + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Expected O, but got Unknown + ((ToggleButton)CoberturasRadioButton).Checked += new RoutedEventHandler(Documento_OnChecked); + ((ToggleButton)MaisInformacoesRadioButton).Checked += new RoutedEventHandler(Documento_OnChecked); + } + + private void Documento_OnChecked(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + RadioButton val = (RadioButton)sender; + if (!string.IsNullOrEmpty(val.GroupName)) + { + ViewModel.Descarregar(); + ((UIElement)ContentControl).Visibility = (Visibility)2; + ((UIElement)MaisInformacoes).Visibility = (Visibility)2; + ((DependencyObject)(object)MaisInformacoes).ClearInvalid(); + ((DependencyObject)(object)ContentControl).ClearInvalid(); + if (!(((FrameworkElement)val).Name == "MaisInformacoesRadioButton")) + { + ((UIElement)ContentControl).Visibility = (Visibility)0; + ViewModel.CarregaCobertura(); + } + else + { + ((UIElement)MaisInformacoes).Visibility = (Visibility)0; + } + } + } + + private async void Incluir_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.Incluir(); + List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedItem.Validate(); + ((DependencyObject)(object)this).ValidateFields(errorMessages); + } + + private async void Excluir_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.Excluir(); + _menuItemViewModel?.RecarregarItens(null); + } + + private void Cancelar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.CancelarAlteracao(); + } + + public async void Salvar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(); + ((DependencyObject)(object)this).ValidateFields(list); + bool num = list == null || list.Count == 0; + ViewModel.Loading(isLoading: false); + if (num) + { + if (((DomainBase)ViewModel.SelectedItem).Id > 0) + { + _menuItemViewModel?.RecarregarItens(ViewModel.SelectedItem); + } + } + else + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + } + + private void Alterar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Alterar(alterar: true); + } + + private async void AbrirAquivoDigital_Click(object sender, RoutedEventArgs e) + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)4).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)4) + "."); + return; + } + FiltroArquivoDigital filtro = new FiltroArquivoDigital + { + Id = ((DomainBase)ViewModel.SelectedItem).Id, + IdApolice = ((DomainBase)ViewModel.SelectedItem.Documento).Id, + Tipo = (TipoArquivoDigital)4, + Parente = ViewModel.SelectedItem + }; + ViewModel.ShowDrawer(new ArquivoDigitalDrawer(filtro), 0, close: false); + } + + private void AbrirLog_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLog((TipoTela)3, ((DomainBase)ViewModel.SelectedItem).Id); + } + + private void AbrirLogEmail_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLogEmail((TipoTela)3, ((DomainBase)ViewModel.SelectedItem).Id); + } + + private void MenuItem_OnClick(object sender, RoutedEventArgs e) + { + ((Window)new HosterWindow((ContentControl)(object)new SinistroView(ViewModel.SelectedItem, attached: false), "CADASTRO DE SINISTROS - " + ViewModel.SelectedItem.Descricao)).ShowDialog(); + _menuItemViewModel?.RecarregarItens(ViewModel.SelectedItem); + } + + private void CopyCodItem(object sender, MouseButtonEventArgs e) + { + ViewModel.CodigoItem.CopyToClipboard(); + ViewModel.ToggleSnackBar("COPIADO - " + ViewModel.CodigoItem); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/seguros/itens/consorcioview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0047: Unknown result type (might be due to invalid IL or missing references) + //IL_0051: Expected O, but got Unknown + //IL_005e: Unknown result type (might be due to invalid IL or missing references) + //IL_0068: Expected O, but got Unknown + //IL_006a: Unknown result type (might be due to invalid IL or missing references) + //IL_0076: Unknown result type (might be due to invalid IL or missing references) + //IL_0080: Expected O, but got Unknown + //IL_0082: Unknown result type (might be due to invalid IL or missing references) + //IL_008e: Unknown result type (might be due to invalid IL or missing references) + //IL_0098: Expected O, but got Unknown + //IL_009a: Unknown result type (might be due to invalid IL or missing references) + //IL_00a6: Unknown result type (might be due to invalid IL or missing references) + //IL_00b0: Expected O, but got Unknown + //IL_00b2: Unknown result type (might be due to invalid IL or missing references) + //IL_00be: Unknown result type (might be due to invalid IL or missing references) + //IL_00c8: Expected O, but got Unknown + //IL_00ca: Unknown result type (might be due to invalid IL or missing references) + //IL_00d6: Unknown result type (might be due to invalid IL or missing references) + //IL_00e0: Expected O, but got Unknown + //IL_00e2: Unknown result type (might be due to invalid IL or missing references) + //IL_00ee: Unknown result type (might be due to invalid IL or missing references) + //IL_00f8: Expected O, but got Unknown + //IL_00fb: Unknown result type (might be due to invalid IL or missing references) + //IL_0105: Expected O, but got Unknown + //IL_0112: Unknown result type (might be due to invalid IL or missing references) + //IL_011c: Expected O, but got Unknown + //IL_011e: Unknown result type (might be due to invalid IL or missing references) + //IL_012a: Unknown result type (might be due to invalid IL or missing references) + //IL_0134: Expected O, but got Unknown + //IL_0136: Unknown result type (might be due to invalid IL or missing references) + //IL_0142: Unknown result type (might be due to invalid IL or missing references) + //IL_014c: Expected O, but got Unknown + //IL_014f: Unknown result type (might be due to invalid IL or missing references) + //IL_0159: Expected O, but got Unknown + //IL_015c: Unknown result type (might be due to invalid IL or missing references) + //IL_0166: Expected O, but got Unknown + //IL_0169: Unknown result type (might be due to invalid IL or missing references) + //IL_0173: Expected O, but got Unknown + switch (connectionId) + { + case 1: + IncluirItemButton = (MenuItem)target; + IncluirItemButton.Click += new RoutedEventHandler(Incluir_OnClick); + break; + case 2: + ((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick); + break; + case 3: + ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick); + break; + case 4: + ((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick); + break; + case 5: + ((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick); + break; + case 6: + ((Control)(TextBox)target).MouseDoubleClick += new MouseButtonEventHandler(CopyCodItem); + break; + case 7: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirAquivoDigital_Click); + break; + case 8: + SinistroButton = (MenuItem)target; + SinistroButton.Click += new RoutedEventHandler(MenuItem_OnClick); + break; + case 9: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick); + break; + case 10: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLogEmail_OnClick); + break; + case 11: + CoberturasRadioButton = (RadioButton)target; + break; + case 12: + MaisInformacoesRadioButton = (RadioButton)target; + break; + case 13: + ContentControl = (ContentControl)target; + break; + case 14: + MaisInformacoes = (CustomItemValidation)target; + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Seguros.Itens/GranizoView.cs b/Decompiler/Gestor.Application.Views.Seguros.Itens/GranizoView.cs new file mode 100644 index 0000000..4754b35 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Seguros.Itens/GranizoView.cs @@ -0,0 +1,378 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Threading; +using Gestor.Application.Componentes; +using Gestor.Application.Drawers; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.ViewModels; +using Gestor.Application.ViewModels.Seguros; +using Gestor.Application.ViewModels.Seguros.Itens; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Views.Seguros.Itens; + +public class GranizoView : BaseUserControl, IComponentConnector +{ + public GranizoViewModel ViewModel; + + private readonly MenuItemViewModel _menuItemViewModel; + + internal MenuItem IncluirItemButton; + + internal MenuItem SinistroButton; + + internal TextBox CepBox; + + internal TextBox EnderecoBox; + + internal TextBox BairroBox; + + internal TextBox CidadeBox; + + internal TextBox EstadoBox; + + internal RadioButton CoberturasRadioButton; + + internal RadioButton MaisInformacoesRadioButton; + + internal ContentControl ContentControl; + + internal CustomItemValidation MaisInformacoes; + + private bool _contentLoaded; + + public GranizoView(MenuItemViewModel menuItemViewModel, bool lockInsert = false, bool substituir = false, ManutencaoItem manutencao = null, Item itemSelecionado = null, Ramo ramo = null, bool endossoRenovacao = false) + { + _menuItemViewModel = menuItemViewModel; + ViewModel = new GranizoViewModel(substituir, manutencao, itemSelecionado, ramo, endossoRenovacao); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + if (lockInsert) + { + ((UIElement)IncluirItemButton).IsEnabled = false; + ((UIElement)SinistroButton).Visibility = (Visibility)2; + } + } + + public async Task Selecionar(Item item) + { + await ViewModel.SelecionaItem(item); + } + + public void Manter(ManutencaoItem manutencao) + { + ViewModel.Manter(ConsultaViewModel.ItemSelecionado, manutencao); + } + + public void Substituir() + { + ViewModel.Substituir(ConsultaViewModel.ItemSelecionado); + } + + private void ContentLoad() + { + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Expected O, but got Unknown + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Expected O, but got Unknown + ((ToggleButton)CoberturasRadioButton).Checked += new RoutedEventHandler(Documento_OnChecked); + ((ToggleButton)MaisInformacoesRadioButton).Checked += new RoutedEventHandler(Documento_OnChecked); + } + + private void Documento_OnChecked(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + RadioButton val = (RadioButton)sender; + if (!string.IsNullOrEmpty(val.GroupName)) + { + ViewModel.Descarregar(); + ((UIElement)ContentControl).Visibility = (Visibility)2; + ((UIElement)MaisInformacoes).Visibility = (Visibility)2; + ((DependencyObject)(object)MaisInformacoes).ClearInvalid(); + ((DependencyObject)(object)ContentControl).ClearInvalid(); + if (!(((FrameworkElement)val).Name == "MaisInformacoesRadioButton")) + { + ((UIElement)ContentControl).Visibility = (Visibility)0; + ViewModel.CarregaCobertura(); + } + else + { + ((UIElement)MaisInformacoes).Visibility = (Visibility)0; + } + } + } + + private async void Incluir_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.IncluirItem(); + List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedItem.Validate(); + ((DependencyObject)(object)this).ValidateFields(errorMessages); + } + + private async void Excluir_OnClick(object sender, RoutedEventArgs e) + { + if (await ViewModel.Excluir()) + { + _menuItemViewModel?.RecarregarItens(null); + } + } + + private void Cancelar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.CancelarAlteracao(); + } + + public async void Salvar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(); + ((DependencyObject)(object)this).ValidateFields(list); + bool num = list == null || list.Count == 0; + ViewModel.Loading(isLoading: false); + if (num) + { + if (((DomainBase)ViewModel.SelectedItem).Id > 0) + { + _menuItemViewModel?.RecarregarItens(ViewModel.SelectedItem); + } + } + else + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + } + + private void Alterar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Alterar(alterar: true); + } + + private async void AbrirAquivoDigital_Click(object sender, RoutedEventArgs e) + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)4).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)4) + "."); + return; + } + FiltroArquivoDigital filtro = new FiltroArquivoDigital + { + Id = ((DomainBase)ViewModel.SelectedItem).Id, + IdApolice = ((DomainBase)ViewModel.SelectedItem.Documento).Id, + Tipo = (TipoArquivoDigital)4, + Parente = ViewModel.SelectedItem + }; + ViewModel.ShowDrawer(new ArquivoDigitalDrawer(filtro), 0, close: false); + } + + private async void PostcodeBox_OnLostFocus(object sender, RoutedEventArgs e) + { + TextBox val = (TextBox)sender; + if (string.IsNullOrWhiteSpace(val.Text)) + { + return; + } + string text = ValidationHelper.FormatPostCode(val.Text); + CepBox.Text = text; + if (ValidationHelper.ValidatePostCode(text)) + { + EnderecoBase val2 = await ViewModel.BuscaCep(text); + if (val2 != null) + { + EnderecoBox.Text = val2.Endereco; + CidadeBox.Text = val2.Cidade; + EstadoBox.Text = val2.Estado; + BairroBox.Text = val2.Bairro; + } + } + } + + private void AbrirLog_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLog((TipoTela)3, ((DomainBase)ViewModel.SelectedItem).Id); + } + + private void AbrirLogEmail_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLogEmail((TipoTela)3, ((DomainBase)ViewModel.SelectedItem).Id); + } + + private void MenuItem_OnClick(object sender, RoutedEventArgs e) + { + ((Window)new HosterWindow((ContentControl)(object)new SinistroView(ViewModel.SelectedItem, attached: false), "CADASTRO DE SINISTROS - " + ViewModel.SelectedItem.Descricao)).ShowDialog(); + _menuItemViewModel?.RecarregarItens(ViewModel.SelectedItem); + } + + private void CopyCodItem(object sender, MouseButtonEventArgs e) + { + ViewModel.CodigoItem.CopyToClipboard(); + ViewModel.ToggleSnackBar("COPIADO - " + ViewModel.CodigoItem); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/seguros/itens/granizoview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_005f: Unknown result type (might be due to invalid IL or missing references) + //IL_0069: Expected O, but got Unknown + //IL_0076: Unknown result type (might be due to invalid IL or missing references) + //IL_0080: Expected O, but got Unknown + //IL_0082: Unknown result type (might be due to invalid IL or missing references) + //IL_008e: Unknown result type (might be due to invalid IL or missing references) + //IL_0098: Expected O, but got Unknown + //IL_009a: Unknown result type (might be due to invalid IL or missing references) + //IL_00a6: Unknown result type (might be due to invalid IL or missing references) + //IL_00b0: Expected O, but got Unknown + //IL_00b2: Unknown result type (might be due to invalid IL or missing references) + //IL_00be: Unknown result type (might be due to invalid IL or missing references) + //IL_00c8: Expected O, but got Unknown + //IL_00ca: Unknown result type (might be due to invalid IL or missing references) + //IL_00d6: Unknown result type (might be due to invalid IL or missing references) + //IL_00e0: Expected O, but got Unknown + //IL_00e2: Unknown result type (might be due to invalid IL or missing references) + //IL_00ee: Unknown result type (might be due to invalid IL or missing references) + //IL_00f8: Expected O, but got Unknown + //IL_00fa: Unknown result type (might be due to invalid IL or missing references) + //IL_0106: Unknown result type (might be due to invalid IL or missing references) + //IL_0110: Expected O, but got Unknown + //IL_0113: Unknown result type (might be due to invalid IL or missing references) + //IL_011d: Expected O, but got Unknown + //IL_012a: Unknown result type (might be due to invalid IL or missing references) + //IL_0134: Expected O, but got Unknown + //IL_0136: Unknown result type (might be due to invalid IL or missing references) + //IL_0142: Unknown result type (might be due to invalid IL or missing references) + //IL_014c: Expected O, but got Unknown + //IL_014e: Unknown result type (might be due to invalid IL or missing references) + //IL_015a: Unknown result type (might be due to invalid IL or missing references) + //IL_0164: Expected O, but got Unknown + //IL_0167: Unknown result type (might be due to invalid IL or missing references) + //IL_0171: Expected O, but got Unknown + //IL_017e: Unknown result type (might be due to invalid IL or missing references) + //IL_0188: Expected O, but got Unknown + //IL_018b: Unknown result type (might be due to invalid IL or missing references) + //IL_0195: Expected O, but got Unknown + //IL_0197: Unknown result type (might be due to invalid IL or missing references) + //IL_01a4: Unknown result type (might be due to invalid IL or missing references) + //IL_01ae: Expected O, but got Unknown + //IL_01b1: Unknown result type (might be due to invalid IL or missing references) + //IL_01bb: Expected O, but got Unknown + //IL_01be: Unknown result type (might be due to invalid IL or missing references) + //IL_01c8: Expected O, but got Unknown + //IL_01cb: Unknown result type (might be due to invalid IL or missing references) + //IL_01d5: Expected O, but got Unknown + //IL_01d8: Unknown result type (might be due to invalid IL or missing references) + //IL_01e2: Expected O, but got Unknown + //IL_01e5: Unknown result type (might be due to invalid IL or missing references) + //IL_01ef: Expected O, but got Unknown + //IL_01f2: Unknown result type (might be due to invalid IL or missing references) + //IL_01fc: Expected O, but got Unknown + switch (connectionId) + { + case 1: + IncluirItemButton = (MenuItem)target; + IncluirItemButton.Click += new RoutedEventHandler(Incluir_OnClick); + break; + case 2: + ((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick); + break; + case 3: + ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick); + break; + case 4: + ((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick); + break; + case 5: + ((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick); + break; + case 6: + ((Control)(TextBox)target).MouseDoubleClick += new MouseButtonEventHandler(CopyCodItem); + break; + case 7: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirAquivoDigital_Click); + break; + case 8: + SinistroButton = (MenuItem)target; + SinistroButton.Click += new RoutedEventHandler(MenuItem_OnClick); + break; + case 9: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick); + break; + case 10: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLogEmail_OnClick); + break; + case 11: + CepBox = (TextBox)target; + ((UIElement)CepBox).LostFocus += new RoutedEventHandler(PostcodeBox_OnLostFocus); + break; + case 12: + EnderecoBox = (TextBox)target; + break; + case 13: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 14: + BairroBox = (TextBox)target; + break; + case 15: + CidadeBox = (TextBox)target; + break; + case 16: + EstadoBox = (TextBox)target; + break; + case 17: + CoberturasRadioButton = (RadioButton)target; + break; + case 18: + MaisInformacoesRadioButton = (RadioButton)target; + break; + case 19: + ContentControl = (ContentControl)target; + break; + case 20: + MaisInformacoes = (CustomItemValidation)target; + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Seguros.Itens/PatrimonialView.cs b/Decompiler/Gestor.Application.Views.Seguros.Itens/PatrimonialView.cs new file mode 100644 index 0000000..682228f --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Seguros.Itens/PatrimonialView.cs @@ -0,0 +1,480 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Threading; +using Gestor.Application.Componentes; +using Gestor.Application.Drawers; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.ViewModels; +using Gestor.Application.ViewModels.Seguros; +using Gestor.Application.ViewModels.Seguros.Itens; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Views.Seguros.Itens; + +public class PatrimonialView : BaseUserControl, IComponentConnector +{ + public PatrimonialViewModel ViewModel; + + private readonly MenuItemViewModel _menuItemViewModel; + + internal MenuItem IncluirItemButton; + + internal MenuItem SinistroButton; + + internal TextBox CepBox; + + internal TextBox EnderecoBox; + + internal TextBox BairroBox; + + internal TextBox CidadeBox; + + internal TextBox EstadoBox; + + internal RadioButton CoberturasRadioButton; + + internal RadioButton MaisInformacoesRadioButton; + + internal ContentControl ContentControl; + + internal CustomItemValidation MaisInformacoes; + + private bool _contentLoaded; + + public PatrimonialView(MenuItemViewModel menuItemViewModel, bool lockInsert = false, bool substituir = false, ManutencaoItem manutencao = null, Item itemSelecionado = null, Ramo ramo = null, bool endossoRenovacao = false) + { + _menuItemViewModel = menuItemViewModel; + ViewModel = new PatrimonialViewModel(substituir, manutencao, itemSelecionado, ramo, endossoRenovacao); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + if (lockInsert) + { + ((UIElement)IncluirItemButton).IsEnabled = false; + ((UIElement)SinistroButton).Visibility = (Visibility)2; + } + } + + public async Task Selecionar(Item item) + { + await ViewModel.SelecionaItem(item); + } + + public void Manter(ManutencaoItem manutencao) + { + ViewModel.Manter(ConsultaViewModel.ItemSelecionado, manutencao); + } + + public void Substituir() + { + ViewModel.Substituir(ConsultaViewModel.ItemSelecionado); + } + + private void ContentLoad() + { + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Expected O, but got Unknown + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Expected O, but got Unknown + ((ToggleButton)CoberturasRadioButton).Checked += new RoutedEventHandler(Documento_OnChecked); + ((ToggleButton)MaisInformacoesRadioButton).Checked += new RoutedEventHandler(Documento_OnChecked); + } + + private void Documento_OnChecked(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + RadioButton val = (RadioButton)sender; + if (!string.IsNullOrEmpty(val.GroupName)) + { + ViewModel.Descarregar(); + ((UIElement)ContentControl).Visibility = (Visibility)2; + ((UIElement)MaisInformacoes).Visibility = (Visibility)2; + ((DependencyObject)(object)MaisInformacoes).ClearInvalid(); + ((DependencyObject)(object)ContentControl).ClearInvalid(); + if (!(((FrameworkElement)val).Name == "MaisInformacoesRadioButton")) + { + ((UIElement)ContentControl).Visibility = (Visibility)0; + ViewModel.CarregaCobertura(); + } + else + { + ((UIElement)MaisInformacoes).Visibility = (Visibility)0; + } + } + } + + private async void Incluir_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.Incluir(); + List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedItem.Validate(); + ((DependencyObject)(object)this).ValidateFields(errorMessages); + } + + private async void Excluir_OnClick(object sender, RoutedEventArgs e) + { + if (await ViewModel.Excluir()) + { + _menuItemViewModel?.RecarregarItens(null); + } + } + + private void Cancelar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.CancelarAlteracao(); + } + + public async void Salvar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(); + ((DependencyObject)(object)this).ValidateFields(list); + bool num = list == null || list.Count == 0; + ViewModel.Loading(isLoading: false); + if (num) + { + if (((DomainBase)ViewModel.SelectedItem).Id > 0) + { + _menuItemViewModel?.RecarregarItens(ViewModel.SelectedItem); + } + } + else + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + } + + private void Alterar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Alterar(alterar: true); + } + + private async void AbrirAquivoDigital_Click(object sender, RoutedEventArgs e) + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)4).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)4) + "."); + return; + } + FiltroArquivoDigital filtro = new FiltroArquivoDigital + { + Id = ((DomainBase)ViewModel.SelectedItem).Id, + IdApolice = ((DomainBase)ViewModel.SelectedItem.Documento).Id, + Tipo = (TipoArquivoDigital)4, + Parente = ViewModel.SelectedItem + }; + ViewModel.ShowDrawer(new ArquivoDigitalDrawer(filtro), 0, close: false); + } + + private async void PostcodeBox_OnLostFocus(object sender, RoutedEventArgs e) + { + TextBox val = (TextBox)sender; + if (string.IsNullOrWhiteSpace(val.Text)) + { + return; + } + string text = ValidationHelper.FormatPostCode(val.Text); + if (ValidationHelper.ValidatePostCode(text)) + { + CepBox.Text = text; + EnderecoBase val2 = await ViewModel.BuscaCep(text); + if (val2 != null) + { + EnderecoBox.Text = val2.Endereco; + CidadeBox.Text = val2.Cidade; + EstadoBox.Text = val2.Estado; + BairroBox.Text = val2.Bairro; + } + } + } + + private void AbrirLog_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLog((TipoTela)3, ((DomainBase)ViewModel.SelectedItem).Id); + } + + private void CpfBox_OnLostFocus(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + TextBox val = (TextBox)sender; + val.Text = ValidationHelper.FormatDocument(val.Text); + } + + private void AbrirLogEmail_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLogEmail((TipoTela)3, ((DomainBase)ViewModel.SelectedItem).Id); + } + + private void MenuItem_OnClick(object sender, RoutedEventArgs e) + { + ((Window)new HosterWindow((ContentControl)(object)new SinistroView(ViewModel.SelectedItem, attached: false), "CADASTRO DE SINISTROS - " + ViewModel.SelectedItem.Descricao)).ShowDialog(); + _menuItemViewModel?.RecarregarItens(ViewModel.SelectedItem); + } + + private void CopyCodItem(object sender, MouseButtonEventArgs e) + { + ViewModel.CodigoItem.CopyToClipboard(); + ViewModel.ToggleSnackBar("COPIADO - " + ViewModel.CodigoItem); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/seguros/itens/patrimonialview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_008b: Unknown result type (might be due to invalid IL or missing references) + //IL_0095: Expected O, but got Unknown + //IL_00a2: Unknown result type (might be due to invalid IL or missing references) + //IL_00ac: Expected O, but got Unknown + //IL_00ae: Unknown result type (might be due to invalid IL or missing references) + //IL_00ba: Unknown result type (might be due to invalid IL or missing references) + //IL_00c4: Expected O, but got Unknown + //IL_00c6: Unknown result type (might be due to invalid IL or missing references) + //IL_00d2: Unknown result type (might be due to invalid IL or missing references) + //IL_00dc: Expected O, but got Unknown + //IL_00de: Unknown result type (might be due to invalid IL or missing references) + //IL_00ea: Unknown result type (might be due to invalid IL or missing references) + //IL_00f4: Expected O, but got Unknown + //IL_00f6: Unknown result type (might be due to invalid IL or missing references) + //IL_0102: Unknown result type (might be due to invalid IL or missing references) + //IL_010c: Expected O, but got Unknown + //IL_010e: Unknown result type (might be due to invalid IL or missing references) + //IL_011a: Unknown result type (might be due to invalid IL or missing references) + //IL_0124: Expected O, but got Unknown + //IL_0126: Unknown result type (might be due to invalid IL or missing references) + //IL_0132: Unknown result type (might be due to invalid IL or missing references) + //IL_013c: Expected O, but got Unknown + //IL_013f: Unknown result type (might be due to invalid IL or missing references) + //IL_0149: Expected O, but got Unknown + //IL_0156: Unknown result type (might be due to invalid IL or missing references) + //IL_0160: Expected O, but got Unknown + //IL_0162: Unknown result type (might be due to invalid IL or missing references) + //IL_016e: Unknown result type (might be due to invalid IL or missing references) + //IL_0178: Expected O, but got Unknown + //IL_017a: Unknown result type (might be due to invalid IL or missing references) + //IL_0186: Unknown result type (might be due to invalid IL or missing references) + //IL_0190: Expected O, but got Unknown + //IL_0193: Unknown result type (might be due to invalid IL or missing references) + //IL_019d: Expected O, but got Unknown + //IL_01aa: Unknown result type (might be due to invalid IL or missing references) + //IL_01b4: Expected O, but got Unknown + //IL_01b7: Unknown result type (might be due to invalid IL or missing references) + //IL_01c1: Expected O, but got Unknown + //IL_01c3: Unknown result type (might be due to invalid IL or missing references) + //IL_01d0: Unknown result type (might be due to invalid IL or missing references) + //IL_01da: Expected O, but got Unknown + //IL_01dd: Unknown result type (might be due to invalid IL or missing references) + //IL_01e7: Expected O, but got Unknown + //IL_01ea: Unknown result type (might be due to invalid IL or missing references) + //IL_01f4: Expected O, but got Unknown + //IL_01f7: Unknown result type (might be due to invalid IL or missing references) + //IL_0201: Expected O, but got Unknown + //IL_0203: Unknown result type (might be due to invalid IL or missing references) + //IL_0210: Unknown result type (might be due to invalid IL or missing references) + //IL_021a: Expected O, but got Unknown + //IL_021c: Unknown result type (might be due to invalid IL or missing references) + //IL_0229: Unknown result type (might be due to invalid IL or missing references) + //IL_0233: Expected O, but got Unknown + //IL_0234: Unknown result type (might be due to invalid IL or missing references) + //IL_0241: Unknown result type (might be due to invalid IL or missing references) + //IL_024b: Expected O, but got Unknown + //IL_024d: Unknown result type (might be due to invalid IL or missing references) + //IL_025a: Unknown result type (might be due to invalid IL or missing references) + //IL_0264: Expected O, but got Unknown + //IL_0265: Unknown result type (might be due to invalid IL or missing references) + //IL_0271: Unknown result type (might be due to invalid IL or missing references) + //IL_027b: Expected O, but got Unknown + //IL_027d: Unknown result type (might be due to invalid IL or missing references) + //IL_028a: Unknown result type (might be due to invalid IL or missing references) + //IL_0294: Expected O, but got Unknown + //IL_0296: Unknown result type (might be due to invalid IL or missing references) + //IL_02a3: Unknown result type (might be due to invalid IL or missing references) + //IL_02ad: Expected O, but got Unknown + //IL_02ae: Unknown result type (might be due to invalid IL or missing references) + //IL_02bb: Unknown result type (might be due to invalid IL or missing references) + //IL_02c5: Expected O, but got Unknown + //IL_02c7: Unknown result type (might be due to invalid IL or missing references) + //IL_02d4: Unknown result type (might be due to invalid IL or missing references) + //IL_02de: Expected O, but got Unknown + //IL_02df: Unknown result type (might be due to invalid IL or missing references) + //IL_02eb: Unknown result type (might be due to invalid IL or missing references) + //IL_02f5: Expected O, but got Unknown + //IL_02f7: Unknown result type (might be due to invalid IL or missing references) + //IL_0304: Unknown result type (might be due to invalid IL or missing references) + //IL_030e: Expected O, but got Unknown + //IL_0310: Unknown result type (might be due to invalid IL or missing references) + //IL_031d: Unknown result type (might be due to invalid IL or missing references) + //IL_0327: Expected O, but got Unknown + //IL_0328: Unknown result type (might be due to invalid IL or missing references) + //IL_0335: Unknown result type (might be due to invalid IL or missing references) + //IL_033f: Expected O, but got Unknown + //IL_0341: Unknown result type (might be due to invalid IL or missing references) + //IL_034e: Unknown result type (might be due to invalid IL or missing references) + //IL_0358: Expected O, but got Unknown + //IL_0359: Unknown result type (might be due to invalid IL or missing references) + //IL_0365: Unknown result type (might be due to invalid IL or missing references) + //IL_036f: Expected O, but got Unknown + //IL_0371: Unknown result type (might be due to invalid IL or missing references) + //IL_037e: Unknown result type (might be due to invalid IL or missing references) + //IL_0388: Expected O, but got Unknown + //IL_038a: Unknown result type (might be due to invalid IL or missing references) + //IL_0397: Unknown result type (might be due to invalid IL or missing references) + //IL_03a1: Expected O, but got Unknown + //IL_03a2: Unknown result type (might be due to invalid IL or missing references) + //IL_03af: Unknown result type (might be due to invalid IL or missing references) + //IL_03b9: Expected O, but got Unknown + //IL_03bc: Unknown result type (might be due to invalid IL or missing references) + //IL_03c6: Expected O, but got Unknown + //IL_03c9: Unknown result type (might be due to invalid IL or missing references) + //IL_03d3: Expected O, but got Unknown + //IL_03d6: Unknown result type (might be due to invalid IL or missing references) + //IL_03e0: Expected O, but got Unknown + switch (connectionId) + { + case 1: + IncluirItemButton = (MenuItem)target; + IncluirItemButton.Click += new RoutedEventHandler(Incluir_OnClick); + break; + case 2: + ((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick); + break; + case 3: + ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick); + break; + case 4: + ((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick); + break; + case 5: + ((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick); + break; + case 6: + ((Control)(TextBox)target).MouseDoubleClick += new MouseButtonEventHandler(CopyCodItem); + break; + case 7: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirAquivoDigital_Click); + break; + case 8: + SinistroButton = (MenuItem)target; + SinistroButton.Click += new RoutedEventHandler(MenuItem_OnClick); + break; + case 9: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick); + break; + case 10: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLogEmail_OnClick); + break; + case 11: + CepBox = (TextBox)target; + ((UIElement)CepBox).LostFocus += new RoutedEventHandler(PostcodeBox_OnLostFocus); + break; + case 12: + EnderecoBox = (TextBox)target; + break; + case 13: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 14: + BairroBox = (TextBox)target; + break; + case 15: + CidadeBox = (TextBox)target; + break; + case 16: + EstadoBox = (TextBox)target; + break; + case 17: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 18: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(FormatarTelefone); + break; + case 19: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(CpfBox_OnLostFocus); + break; + case 20: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 21: + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(FormatarTelefone); + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 22: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(CpfBox_OnLostFocus); + break; + case 23: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 24: + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(FormatarTelefone); + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 25: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(CpfBox_OnLostFocus); + break; + case 26: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 27: + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(FormatarTelefone); + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 28: + CoberturasRadioButton = (RadioButton)target; + break; + case 29: + MaisInformacoesRadioButton = (RadioButton)target; + break; + case 30: + ContentControl = (ContentControl)target; + break; + case 31: + MaisInformacoes = (CustomItemValidation)target; + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Seguros.Itens/RiscosDiversosView.cs b/Decompiler/Gestor.Application.Views.Seguros.Itens/RiscosDiversosView.cs new file mode 100644 index 0000000..64e95ee --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Seguros.Itens/RiscosDiversosView.cs @@ -0,0 +1,670 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Media; +using System.Windows.Threading; +using Gestor.Application.Drawers; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.ViewModels; +using Gestor.Application.ViewModels.Seguros; +using Gestor.Application.ViewModels.Seguros.Itens; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Views.Seguros.Itens; + +public class RiscosDiversosView : BaseUserControl, IComponentConnector, IStyleConnector +{ + public RiscosDiversosViewModel ViewModel; + + private readonly MenuItemViewModel _menuItemViewModel; + + private bool _salvando; + + internal MenuItem IncluirItemButton; + + internal MenuItem SinistroButton; + + internal RadioButton CoberturasRadioButton; + + internal RadioButton MaisInformacoesRadioButton; + + internal Menu BotoesTitulares; + + internal Separator SeparadorMaisInformacoes; + + internal ContentControl ContentControl; + + internal DataGrid DataGridTitulares; + + private bool _contentLoaded; + + public RiscosDiversosView(MenuItemViewModel menuItemViewModel, bool lockInsert = false, bool substituir = false, ManutencaoItem manutencao = null, Item itemSelecionado = null, Ramo ramo = null, bool endossoRenovacao = false) + { + _menuItemViewModel = menuItemViewModel; + ViewModel = new RiscosDiversosViewModel(substituir, manutencao, itemSelecionado, ramo, endossoRenovacao); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + if (lockInsert) + { + ((UIElement)IncluirItemButton).IsEnabled = false; + ((UIElement)SinistroButton).Visibility = (Visibility)2; + } + } + + public async Task Selecionar(Item item) + { + await ViewModel.SelecionaItem(item); + } + + public void Manter(ManutencaoItem manutencao) + { + ViewModel.Manter(ConsultaViewModel.ItemSelecionado, manutencao); + } + + public void Substituir() + { + ViewModel.Substituir(ConsultaViewModel.ItemSelecionado); + } + + private void ContentLoad() + { + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Expected O, but got Unknown + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Expected O, but got Unknown + ((ToggleButton)CoberturasRadioButton).Checked += new RoutedEventHandler(Documento_OnChecked); + ((ToggleButton)MaisInformacoesRadioButton).Checked += new RoutedEventHandler(Documento_OnChecked); + } + + private void AutoCompleteBox_Populating(object sender, PopulatingEventArgs e) + { + if (e.Parameter.Trim().Length < 3) + { + return; + } + e.Cancel = true; + ViewModel.BuscarTitulares(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<TitularesVida>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void Documento_OnChecked(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + RadioButton val = (RadioButton)sender; + if (!string.IsNullOrEmpty(val.GroupName)) + { + ViewModel.Descarregar(); + ((UIElement)ContentControl).Visibility = (Visibility)2; + ((UIElement)DataGridTitulares).Visibility = (Visibility)2; + ((UIElement)SeparadorMaisInformacoes).Visibility = (Visibility)2; + ((UIElement)BotoesTitulares).Visibility = (Visibility)2; + ((DependencyObject)(object)DataGridTitulares).ClearInvalid(); + ((DependencyObject)(object)ContentControl).ClearInvalid(); + if (!(((FrameworkElement)val).Name == "MaisInformacoesRadioButton")) + { + ((UIElement)ContentControl).Visibility = (Visibility)0; + ViewModel.CarregaCobertura(); + } + else + { + ((UIElement)SeparadorMaisInformacoes).Visibility = (Visibility)0; + ((UIElement)DataGridTitulares).Visibility = (Visibility)0; + ((UIElement)BotoesTitulares).Visibility = (Visibility)0; + } + } + } + + private async void Incluir_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.Incluir(); + List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedItem.Validate(); + ((DependencyObject)(object)this).ValidateFields(errorMessages); + } + + private async void Excluir_OnClick(object sender, RoutedEventArgs e) + { + if (await ViewModel.Excluir()) + { + _menuItemViewModel?.RecarregarItens(null); + } + } + + private void Cancelar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.CancelarAlteracao(); + } + + public async void Salvar_OnClick(object sender, RoutedEventArgs e) + { + _salvando = true; + ViewModel.Loading(isLoading: true); + ((UIElement)DataGridTitulares).Focus(); + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(((IEnumerable)((ItemsControl)DataGridTitulares).Items).Cast<TitularesVida>().ToList()); + ((DependencyObject)(object)this).ValidateFields(list); + bool num = list == null || list.Count == 0; + ViewModel.Loading(isLoading: false); + _salvando = false; + if (num) + { + if (((DomainBase)ViewModel.SelectedItem).Id > 0) + { + _menuItemViewModel?.RecarregarItens(ViewModel.SelectedItem); + } + } + else + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + } + + private void Alterar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Alterar(alterar: true); + } + + private async void AbrirAquivoDigital_Click(object sender, RoutedEventArgs e) + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)4).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)4) + "."); + return; + } + FiltroArquivoDigital filtro = new FiltroArquivoDigital + { + Id = ((DomainBase)ViewModel.SelectedItem).Id, + IdApolice = ((DomainBase)ViewModel.SelectedItem.Documento).Id, + Tipo = (TipoArquivoDigital)4, + Parente = ViewModel.SelectedItem + }; + ViewModel.ShowDrawer(new ArquivoDigitalDrawer(filtro), 0, close: false); + } + + private void AbrirLog_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLog((TipoTela)3, ((DomainBase)ViewModel.SelectedItem).Id); + } + + private void AbrirLogEmail_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLogEmail((TipoTela)3, ((DomainBase)ViewModel.SelectedItem).Id); + } + + private void MenuItem_OnClick(object sender, RoutedEventArgs e) + { + ((Window)new HosterWindow((ContentControl)(object)new SinistroView(ViewModel.SelectedItem, attached: false), "CADASTRO DE SINISTROS - " + ViewModel.SelectedItem.Descricao)).ShowDialog(); + _menuItemViewModel?.RecarregarItens(ViewModel.SelectedItem); + } + + private void BotoesTitulares_OnIsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0044: Unknown result type (might be due to invalid IL or missing references) + if (!((UIElement)(Menu)sender).IsEnabled) + { + ViewModel.AlteracaoTitularesVisibility = (Visibility)2; + } + DataGrid dataGridTitulares = DataGridTitulares; + if (((dataGridTitulares != null) ? dataGridTitulares.Columns.First() : null) != null) + { + DataGridTitulares.Columns.First().Visibility = (Visibility)((!((UIElement)(Menu)sender).IsEnabled) ? 2 : 0); + } + } + + private void IncluirTitular_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.IncluirTitular(); + UpdateAutocompleteDependente(((IEnumerable)((ItemsControl)DataGridTitulares).Items).Cast<TitularesVida>().First()); + } + + private void ExcluirTitular_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.ExcluirTitular(); + } + + private async void ImportarTitulares_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.ImportarTitulares(); + } + + private void UpdateAutocompleteDependente(TitularesVida item) + { + //IL_0057: Unknown result type (might be due to invalid IL or missing references) + //IL_005d: Expected O, but got Unknown + //IL_0073: Unknown result type (might be due to invalid IL or missing references) + //IL_0081: Unknown result type (might be due to invalid IL or missing references) + //IL_0087: Invalid comparison between Unknown and I4 + DataGridTitulares.ScrollIntoView((object)item, DataGridTitulares.Columns.First((DataGridColumn x) => (string)x.Header == "TITULAR DEPENDENTE")); + ((UIElement)DataGridTitulares).UpdateLayout(); + DataGridRow val = (DataGridRow)((ItemsControl)DataGridTitulares).ItemContainerGenerator.ContainerFromItem((object)item); + if (val != null) + { + ((UIElement)(DataGridCell)((ItemsControl)DataGridExtensions.GetVisualChild<DataGridCellsPresenter>((Visual)(object)val)).ItemContainerGenerator.ContainerFromIndex(12)).Visibility = (Visibility)(((int)item.Tipo.GetValueOrDefault() != 2) ? 2 : 0); + DataGridTitulares.ScrollIntoView((object)item, DataGridTitulares.Columns.First()); + ((UIElement)DataGridTitulares).UpdateLayout(); + } + } + + private void Dependente_CellLoaded(object sender, RoutedEventArgs e) + { + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + //IL_0015: Unknown result type (might be due to invalid IL or missing references) + //IL_001a: Unknown result type (might be due to invalid IL or missing references) + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_002f: Invalid comparison between Unknown and I4 + if (sender != null) + { + DataGridCell val = (DataGridCell)sender; + TitularesVida val2 = (TitularesVida)((FrameworkElement)(DataGridCell)sender).DataContext; + ((UIElement)val).Visibility = (Visibility)(((int)val2 == 0 || (int)val2.Tipo.GetValueOrDefault() != 2) ? 2 : 0); + } + } + + private void AlterarTitular_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AlterarTitular(); + } + + private void AplicarTitular_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AplicarTitular(); + } + + private void DataGridTitulares_OnCellEditEnding(object sender, DataGridCellEditEndingEventArgs e) + { + if (!(e.EditingElement is TextBox)) + { + return; + } + FrameworkElement editingElement = e.EditingElement; + TextBox val = (TextBox)(object)((editingElement is TextBox) ? editingElement : null); + string stringFormat = e.Column.ClipboardContentBinding.StringFormat; + if (!(stringFormat == "d")) + { + if (!(stringFormat == "c")) + { + if (!string.IsNullOrEmpty((val != null) ? val.Text : null)) + { + if (e.Column.SortMemberPath == "Cpf") + { + val.Text = ValidationHelper.FormatDocument(val.Text); + } + } + else if (val != null) + { + val.Text = null; + } + } + else if (!string.IsNullOrEmpty((val != null) ? val.Text : null)) + { + val.Text = ValidationHelper.FormatCurrency(val.Text); + } + else if (val != null) + { + val.Text = null; + } + } + else if (!string.IsNullOrEmpty((val != null) ? val.Text : null)) + { + val.Text = ValidationHelper.FormatDate(val.Text); + } + else if (val != null) + { + val.Text = null; + } + } + + private async void TipoComboBoxSelectionChanged(object sender, SelectionChangedEventArgs e) + { + ComboBox val = (ComboBox)sender; + if ((((int)val != 0) ? ((FrameworkElement)val).DataContext : null) != null) + { + if ((int)((TitularesVida)((FrameworkElement)(ComboBox)sender).DataContext).Tipo.GetValueOrDefault() == 2 && !_salvando && !ViewModel.Titulares.Any((TitularesVida x) => (int)x.Tipo.GetValueOrDefault() == 1 || x.Tipo == (TipoTitular?)0)) + { + ((Selector)(ComboBox)sender).SelectedIndex = -1; + ((TitularesVida)((FrameworkElement)(ComboBox)sender).DataContext).Tipo = null; + await ViewModel.ShowMessage("É NECESSÁRIO ADICIONAR PELO MENOS UM TITULAR DO TIPO SÓCIO OU FUNCIONÁRIO\nANTES DE ADICIONAR UM DEPENDENTE."); + } + else + { + UpdateAutocompleteDependente((TitularesVida)((FrameworkElement)(ComboBox)sender).DataContext); + } + } + } + + private void CopyCodItem(object sender, MouseButtonEventArgs e) + { + ViewModel.CodigoItem.CopyToClipboard(); + ViewModel.ToggleSnackBar("COPIADO - " + ViewModel.CodigoItem); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/seguros/itens/riscosdiversosview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0073: Unknown result type (might be due to invalid IL or missing references) + //IL_007d: Expected O, but got Unknown + //IL_008a: Unknown result type (might be due to invalid IL or missing references) + //IL_0094: Expected O, but got Unknown + //IL_0096: Unknown result type (might be due to invalid IL or missing references) + //IL_00a2: Unknown result type (might be due to invalid IL or missing references) + //IL_00ac: Expected O, but got Unknown + //IL_00ae: Unknown result type (might be due to invalid IL or missing references) + //IL_00ba: Unknown result type (might be due to invalid IL or missing references) + //IL_00c4: Expected O, but got Unknown + //IL_00c6: Unknown result type (might be due to invalid IL or missing references) + //IL_00d2: Unknown result type (might be due to invalid IL or missing references) + //IL_00dc: Expected O, but got Unknown + //IL_00de: Unknown result type (might be due to invalid IL or missing references) + //IL_00ea: Unknown result type (might be due to invalid IL or missing references) + //IL_00f4: Expected O, but got Unknown + //IL_00f6: Unknown result type (might be due to invalid IL or missing references) + //IL_0102: Unknown result type (might be due to invalid IL or missing references) + //IL_010c: Expected O, but got Unknown + //IL_010e: Unknown result type (might be due to invalid IL or missing references) + //IL_011a: Unknown result type (might be due to invalid IL or missing references) + //IL_0124: Expected O, but got Unknown + //IL_0127: Unknown result type (might be due to invalid IL or missing references) + //IL_0131: Expected O, but got Unknown + //IL_013e: Unknown result type (might be due to invalid IL or missing references) + //IL_0148: Expected O, but got Unknown + //IL_014a: Unknown result type (might be due to invalid IL or missing references) + //IL_0156: Unknown result type (might be due to invalid IL or missing references) + //IL_0160: Expected O, but got Unknown + //IL_0162: Unknown result type (might be due to invalid IL or missing references) + //IL_016e: Unknown result type (might be due to invalid IL or missing references) + //IL_0178: Expected O, but got Unknown + //IL_017b: Unknown result type (might be due to invalid IL or missing references) + //IL_0185: Expected O, but got Unknown + //IL_0188: Unknown result type (might be due to invalid IL or missing references) + //IL_0192: Expected O, but got Unknown + //IL_0195: Unknown result type (might be due to invalid IL or missing references) + //IL_019f: Expected O, but got Unknown + //IL_01ac: Unknown result type (might be due to invalid IL or missing references) + //IL_01b6: Expected O, but got Unknown + //IL_01b8: Unknown result type (might be due to invalid IL or missing references) + //IL_01c4: Unknown result type (might be due to invalid IL or missing references) + //IL_01ce: Expected O, but got Unknown + //IL_01d0: Unknown result type (might be due to invalid IL or missing references) + //IL_01dc: Unknown result type (might be due to invalid IL or missing references) + //IL_01e6: Expected O, but got Unknown + //IL_01e8: Unknown result type (might be due to invalid IL or missing references) + //IL_01f4: Unknown result type (might be due to invalid IL or missing references) + //IL_01fe: Expected O, but got Unknown + //IL_0200: Unknown result type (might be due to invalid IL or missing references) + //IL_020c: Unknown result type (might be due to invalid IL or missing references) + //IL_0216: Expected O, but got Unknown + //IL_0219: Unknown result type (might be due to invalid IL or missing references) + //IL_0223: Expected O, but got Unknown + //IL_0225: Unknown result type (might be due to invalid IL or missing references) + //IL_0231: Unknown result type (might be due to invalid IL or missing references) + //IL_023b: Expected O, but got Unknown + //IL_023c: Unknown result type (might be due to invalid IL or missing references) + //IL_0248: Unknown result type (might be due to invalid IL or missing references) + //IL_0252: Expected O, but got Unknown + //IL_0253: Unknown result type (might be due to invalid IL or missing references) + //IL_025f: Unknown result type (might be due to invalid IL or missing references) + //IL_0269: Expected O, but got Unknown + //IL_026b: Unknown result type (might be due to invalid IL or missing references) + //IL_0277: Unknown result type (might be due to invalid IL or missing references) + //IL_0281: Expected O, but got Unknown + //IL_0282: Unknown result type (might be due to invalid IL or missing references) + //IL_028e: Unknown result type (might be due to invalid IL or missing references) + //IL_0298: Expected O, but got Unknown + //IL_0299: Unknown result type (might be due to invalid IL or missing references) + //IL_02a5: Unknown result type (might be due to invalid IL or missing references) + //IL_02af: Expected O, but got Unknown + //IL_02b1: Unknown result type (might be due to invalid IL or missing references) + //IL_02bd: Unknown result type (might be due to invalid IL or missing references) + //IL_02c7: Expected O, but got Unknown + //IL_02c8: Unknown result type (might be due to invalid IL or missing references) + //IL_02d4: Unknown result type (might be due to invalid IL or missing references) + //IL_02de: Expected O, but got Unknown + //IL_02df: Unknown result type (might be due to invalid IL or missing references) + //IL_02eb: Unknown result type (might be due to invalid IL or missing references) + //IL_02f5: Expected O, but got Unknown + //IL_02f7: Unknown result type (might be due to invalid IL or missing references) + //IL_0304: Unknown result type (might be due to invalid IL or missing references) + //IL_030e: Expected O, but got Unknown + //IL_030f: Unknown result type (might be due to invalid IL or missing references) + //IL_031c: Unknown result type (might be due to invalid IL or missing references) + //IL_0326: Expected O, but got Unknown + //IL_0328: Unknown result type (might be due to invalid IL or missing references) + //IL_0334: Unknown result type (might be due to invalid IL or missing references) + //IL_033e: Expected O, but got Unknown + //IL_0341: Unknown result type (might be due to invalid IL or missing references) + //IL_034b: Expected O, but got Unknown + //IL_034e: Unknown result type (might be due to invalid IL or missing references) + //IL_0358: Expected O, but got Unknown + switch (connectionId) + { + case 1: + IncluirItemButton = (MenuItem)target; + IncluirItemButton.Click += new RoutedEventHandler(Incluir_OnClick); + break; + case 2: + ((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick); + break; + case 3: + ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick); + break; + case 4: + ((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick); + break; + case 5: + ((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick); + break; + case 6: + ((Control)(TextBox)target).MouseDoubleClick += new MouseButtonEventHandler(CopyCodItem); + break; + case 7: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirAquivoDigital_Click); + break; + case 8: + SinistroButton = (MenuItem)target; + SinistroButton.Click += new RoutedEventHandler(MenuItem_OnClick); + break; + case 9: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick); + break; + case 10: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLogEmail_OnClick); + break; + case 11: + CoberturasRadioButton = (RadioButton)target; + break; + case 12: + MaisInformacoesRadioButton = (RadioButton)target; + break; + case 13: + BotoesTitulares = (Menu)target; + ((UIElement)BotoesTitulares).IsEnabledChanged += new DependencyPropertyChangedEventHandler(BotoesTitulares_OnIsEnabledChanged); + break; + case 14: + ((MenuItem)target).Click += new RoutedEventHandler(IncluirTitular_OnClick); + break; + case 15: + ((MenuItem)target).Click += new RoutedEventHandler(AlterarTitular_OnClick); + break; + case 16: + ((MenuItem)target).Click += new RoutedEventHandler(ExcluirTitular_OnClick); + break; + case 17: + ((MenuItem)target).Click += new RoutedEventHandler(ImportarTitulares_OnClick); + break; + case 18: + SeparadorMaisInformacoes = (Separator)target; + break; + case 19: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 20: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 21: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 22: + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(FormatarDocumento); + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 23: + ((MenuItem)target).Click += new RoutedEventHandler(AplicarTitular_OnClick); + break; + case 24: + ContentControl = (ContentControl)target; + break; + case 25: + DataGridTitulares = (DataGrid)target; + DataGridTitulares.CellEditEnding += DataGridTitulares_OnCellEditEnding; + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_0027: Unknown result type (might be due to invalid IL or missing references) + //IL_0033: Unknown result type (might be due to invalid IL or missing references) + //IL_003d: Expected O, but got Unknown + //IL_003e: Unknown result type (might be due to invalid IL or missing references) + //IL_004a: Unknown result type (might be due to invalid IL or missing references) + //IL_0054: Expected O, but got Unknown + //IL_0055: Unknown result type (might be due to invalid IL or missing references) + //IL_0061: Unknown result type (might be due to invalid IL or missing references) + //IL_006b: Expected O, but got Unknown + //IL_006d: Unknown result type (might be due to invalid IL or missing references) + //IL_0079: Unknown result type (might be due to invalid IL or missing references) + //IL_0083: Expected O, but got Unknown + //IL_0084: Unknown result type (might be due to invalid IL or missing references) + //IL_0090: Unknown result type (might be due to invalid IL or missing references) + //IL_009a: Expected O, but got Unknown + //IL_009b: Unknown result type (might be due to invalid IL or missing references) + //IL_00a7: Unknown result type (might be due to invalid IL or missing references) + //IL_00b1: Expected O, but got Unknown + //IL_00b3: Unknown result type (might be due to invalid IL or missing references) + //IL_00bf: Unknown result type (might be due to invalid IL or missing references) + //IL_00c9: Expected O, but got Unknown + //IL_00ca: Unknown result type (might be due to invalid IL or missing references) + //IL_00d6: Unknown result type (might be due to invalid IL or missing references) + //IL_00e0: Expected O, but got Unknown + //IL_00e1: Unknown result type (might be due to invalid IL or missing references) + //IL_00ed: Unknown result type (might be due to invalid IL or missing references) + //IL_00f7: Expected O, but got Unknown + //IL_00f9: Unknown result type (might be due to invalid IL or missing references) + //IL_0106: Unknown result type (might be due to invalid IL or missing references) + //IL_0110: Expected O, but got Unknown + //IL_0111: Unknown result type (might be due to invalid IL or missing references) + //IL_011e: Unknown result type (might be due to invalid IL or missing references) + //IL_0128: Expected O, but got Unknown + //IL_012a: Unknown result type (might be due to invalid IL or missing references) + //IL_0136: Unknown result type (might be due to invalid IL or missing references) + //IL_0140: Expected O, but got Unknown + //IL_0142: Unknown result type (might be due to invalid IL or missing references) + //IL_014e: Unknown result type (might be due to invalid IL or missing references) + //IL_0158: Expected O, but got Unknown + //IL_0159: Unknown result type (might be due to invalid IL or missing references) + //IL_015f: Expected O, but got Unknown + //IL_0172: Unknown result type (might be due to invalid IL or missing references) + //IL_017c: Expected O, but got Unknown + //IL_017d: Unknown result type (might be due to invalid IL or missing references) + switch (connectionId) + { + case 26: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 27: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 28: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 29: + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(FormatarDocumento); + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 30: + ((Selector)(ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(TipoComboBoxSelectionChanged); + break; + case 31: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBox_Populating); + break; + case 32: + { + EventSetter val = new EventSetter(); + val.Event = FrameworkElement.LoadedEvent; + val.Handler = (Delegate)new RoutedEventHandler(Dependente_CellLoaded); + ((Collection<SetterBase>)(object)((Style)target).Setters).Add((SetterBase)(object)val); + break; + } + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Seguros.Itens/VidaView.cs b/Decompiler/Gestor.Application.Views.Seguros.Itens/VidaView.cs new file mode 100644 index 0000000..1bf66fe --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Seguros.Itens/VidaView.cs @@ -0,0 +1,690 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Media; +using System.Windows.Threading; +using Gestor.Application.Drawers; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.ViewModels; +using Gestor.Application.ViewModels.Seguros; +using Gestor.Application.ViewModels.Seguros.Itens; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Views.Seguros.Itens; + +public class VidaView : BaseUserControl, IComponentConnector, IStyleConnector +{ + public VidaViewModel ViewModel; + + private readonly MenuItemViewModel _menuItemViewModel; + + private bool _salvando; + + internal MenuItem IncluirItemButton; + + internal MenuItem SinistroButton; + + internal TextBox PlanoBox; + + internal RadioButton CoberturasRadioButton; + + internal RadioButton MaisInformacoesRadioButton; + + internal Menu BotoesTitulares; + + internal Separator SeparadorMaisInformacoes; + + internal ContentControl ContentControl; + + internal DataGrid DataGridTitulares; + + private bool _contentLoaded; + + public VidaView(MenuItemViewModel menuItemViewModel, bool lockInsert = false, bool substituir = false, ManutencaoItem manutencao = null, Item itemSelecionado = null, Ramo ramo = null, bool endossoRenovacao = false) + { + _menuItemViewModel = menuItemViewModel; + ViewModel = new VidaViewModel(substituir, manutencao, itemSelecionado, ramo, endossoRenovacao); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + if (lockInsert) + { + ((UIElement)IncluirItemButton).IsEnabled = false; + ((UIElement)SinistroButton).Visibility = (Visibility)2; + } + } + + public async Task Selecionar(Item item) + { + await ViewModel.SelecionaItem(item); + } + + public void Manter(ManutencaoItem manutencao) + { + ViewModel.Manter(ConsultaViewModel.ItemSelecionado, manutencao); + } + + public void Substituir() + { + ViewModel.Substituir(ConsultaViewModel.ItemSelecionado); + } + + private void ContentLoad() + { + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Expected O, but got Unknown + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Expected O, but got Unknown + ((ToggleButton)CoberturasRadioButton).Checked += new RoutedEventHandler(Documento_OnChecked); + ((ToggleButton)MaisInformacoesRadioButton).Checked += new RoutedEventHandler(Documento_OnChecked); + } + + private void Documento_OnChecked(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + RadioButton val = (RadioButton)sender; + if (!string.IsNullOrEmpty(val.GroupName)) + { + ViewModel.Descarregar(); + ((UIElement)ContentControl).Visibility = (Visibility)2; + ((UIElement)DataGridTitulares).Visibility = (Visibility)2; + ((UIElement)SeparadorMaisInformacoes).Visibility = (Visibility)2; + ((UIElement)BotoesTitulares).Visibility = (Visibility)2; + ((DependencyObject)(object)DataGridTitulares).ClearInvalid(); + ((DependencyObject)(object)ContentControl).ClearInvalid(); + if (!(((FrameworkElement)val).Name == "MaisInformacoesRadioButton")) + { + ((UIElement)ContentControl).Visibility = (Visibility)0; + ViewModel.CarregaCobertura(); + } + else + { + ((UIElement)SeparadorMaisInformacoes).Visibility = (Visibility)0; + ((UIElement)DataGridTitulares).Visibility = (Visibility)0; + ((UIElement)BotoesTitulares).Visibility = (Visibility)0; + } + } + } + + private async void Incluir_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.Incluir(); + List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedItem.Validate(); + ((DependencyObject)(object)this).ValidateFields(errorMessages); + } + + private async void IncluirTitular_OnClick(object sender, RoutedEventArgs e) + { + TitularesVida val = ((IEnumerable)((ItemsControl)DataGridTitulares).Items).Cast<TitularesVida>().FirstOrDefault(); + if (val != null && !val.Inicio.HasValue && !val.Fim.HasValue && val.Nome == null && val.Fatura == null && val.Cpf == null && !val.Tipo.HasValue && val.Observacao == null) + { + await ViewModel.ShowMessage("JÁ EXISTE UM CAMPO DE CADASTRO DE TITULAR CRIADO"); + return; + } + ViewModel.IncluirTitular(); + UpdateAutocompleteDependente(((IEnumerable)((ItemsControl)DataGridTitulares).Items).Cast<TitularesVida>().First(), scroll: false); + } + + private void ExcluirTitular_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.ExcluirTitular(); + } + + private async void ImportarTitulares_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.ImportarTitulares(); + } + + private async void Excluir_OnClick(object sender, RoutedEventArgs e) + { + if (await ViewModel.Excluir()) + { + _menuItemViewModel?.RecarregarItens(null); + } + } + + private void Cancelar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.CancelarAlteracao(); + } + + public async void Salvar_OnClick(object sender, RoutedEventArgs e) + { + _salvando = true; + ViewModel.Loading(isLoading: true); + ViewModel.SelectedItem.Vida.Plano = PlanoBox.Text; + ((UIElement)DataGridTitulares).Focus(); + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(((IEnumerable)((ItemsControl)DataGridTitulares).Items).Cast<TitularesVida>().ToList()); + ((DependencyObject)(object)this).ValidateFields(list); + bool num = list == null || list.Count == 0; + ViewModel.Loading(isLoading: false); + _salvando = false; + if (num) + { + if (((DomainBase)ViewModel.SelectedItem).Id > 0) + { + _menuItemViewModel?.RecarregarItens(ViewModel.SelectedItem); + } + } + else + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + } + + private void Alterar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Alterar(alterar: true); + } + + private async void AbrirAquivoDigital_Click(object sender, RoutedEventArgs e) + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)4).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)4) + "."); + return; + } + FiltroArquivoDigital filtro = new FiltroArquivoDigital + { + Id = ((DomainBase)ViewModel.SelectedItem).Id, + IdApolice = ((DomainBase)ViewModel.SelectedItem.Documento).Id, + Tipo = (TipoArquivoDigital)4, + Parente = ViewModel.SelectedItem + }; + ViewModel.ShowDrawer(new ArquivoDigitalDrawer(filtro), 0, close: false); + } + + private void AbrirLog_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLog((TipoTela)3, ((DomainBase)ViewModel.SelectedItem).Id); + } + + private void AbrirLogEmail_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLogEmail((TipoTela)3, ((DomainBase)ViewModel.SelectedItem).Id); + } + + private void BotoesTitulares_OnIsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0044: Unknown result type (might be due to invalid IL or missing references) + if (!((UIElement)(Menu)sender).IsEnabled) + { + ViewModel.AlteracaoTitularesVisibility = (Visibility)2; + } + DataGrid dataGridTitulares = DataGridTitulares; + if (((dataGridTitulares != null) ? dataGridTitulares.Columns.First() : null) != null) + { + DataGridTitulares.Columns.First().Visibility = (Visibility)((!((UIElement)(Menu)sender).IsEnabled) ? 2 : 0); + } + } + + private void AlterarTitular_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AlterarTitular(); + } + + private void AplicarTitular_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AplicarTitular(); + } + + private void DataGridTitulares_OnCellEditEnding(object sender, DataGridCellEditEndingEventArgs e) + { + if (!(e.EditingElement is TextBox)) + { + return; + } + FrameworkElement editingElement = e.EditingElement; + TextBox val = (TextBox)(object)((editingElement is TextBox) ? editingElement : null); + string stringFormat = e.Column.ClipboardContentBinding.StringFormat; + if (!(stringFormat == "d")) + { + if (!(stringFormat == "c")) + { + if (!string.IsNullOrEmpty((val != null) ? val.Text : null)) + { + if (e.Column.SortMemberPath == "Cpf") + { + val.Text = ValidationHelper.FormatDocument(val.Text); + } + } + else if (val != null) + { + val.Text = null; + } + } + else if (!string.IsNullOrEmpty((val != null) ? val.Text : null)) + { + val.Text = ValidationHelper.FormatCurrency(val.Text); + } + else if (val != null) + { + val.Text = null; + } + } + else if (!string.IsNullOrEmpty((val != null) ? val.Text : null)) + { + val.Text = ValidationHelper.FormatDate(val.Text); + } + else if (val != null) + { + val.Text = null; + } + } + + private void AutoCompleteBox_Populating(object sender, PopulatingEventArgs e) + { + if (e.Parameter.Trim().Length < 3) + { + return; + } + e.Cancel = true; + ViewModel.BuscarTitulares(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<TitularesVida>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private async void TipoComboBoxSelectionChanged(object sender, SelectionChangedEventArgs e) + { + ComboBox val = (ComboBox)sender; + if ((((int)val != 0) ? ((FrameworkElement)val).DataContext : null) != null) + { + if ((int)((TitularesVida)((FrameworkElement)(ComboBox)sender).DataContext).Tipo.GetValueOrDefault() == 2 && !_salvando && ((DomainBase)ViewModel.SelectedItem.Documento.Controle.Ramo).Id != 6 && !ViewModel.Titulares.Any((TitularesVida x) => (int)x.Tipo.GetValueOrDefault() == 1 || x.Tipo == (TipoTitular?)0)) + { + ((Selector)(ComboBox)sender).SelectedIndex = -1; + ((TitularesVida)((FrameworkElement)(ComboBox)sender).DataContext).Tipo = null; + await ViewModel.ShowMessage("É NECESSÁRIO ADICIONAR PELO MENOS UM TITULAR DO TIPO SÓCIO OU FUNCIONÁRIO\nANTES DE ADICIONAR UM DEPENDENTE."); + } + else + { + UpdateAutocompleteDependente((TitularesVida)((FrameworkElement)(ComboBox)sender).DataContext, scroll: false); + } + } + } + + private void UpdateAutocompleteDependente(TitularesVida item, bool scroll = true) + { + //IL_005a: Unknown result type (might be due to invalid IL or missing references) + //IL_0060: Expected O, but got Unknown + //IL_0076: Unknown result type (might be due to invalid IL or missing references) + //IL_0084: Unknown result type (might be due to invalid IL or missing references) + //IL_008a: Invalid comparison between Unknown and I4 + if (scroll) + { + DataGridTitulares.ScrollIntoView((object)item, DataGridTitulares.Columns.First((DataGridColumn x) => (string)x.Header == "TITULAR DEPENDENTE")); + } + ((UIElement)DataGridTitulares).UpdateLayout(); + DataGridRow val = (DataGridRow)((ItemsControl)DataGridTitulares).ItemContainerGenerator.ContainerFromItem((object)item); + if (val != null) + { + ((UIElement)(DataGridCell)((ItemsControl)DataGridExtensions.GetVisualChild<DataGridCellsPresenter>((Visual)(object)val)).ItemContainerGenerator.ContainerFromIndex(12)).Visibility = (Visibility)(((int)item.Tipo.GetValueOrDefault() != 2) ? 2 : 0); + if (scroll) + { + DataGridTitulares.ScrollIntoView((object)item, DataGridTitulares.Columns.First()); + } + ((UIElement)DataGridTitulares).UpdateLayout(); + } + } + + private void Dependente_CellLoaded(object sender, RoutedEventArgs e) + { + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + //IL_0015: Unknown result type (might be due to invalid IL or missing references) + //IL_001a: Unknown result type (might be due to invalid IL or missing references) + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_002f: Invalid comparison between Unknown and I4 + if (sender != null) + { + DataGridCell val = (DataGridCell)sender; + TitularesVida val2 = (TitularesVida)((FrameworkElement)(DataGridCell)sender).DataContext; + ((UIElement)val).Visibility = (Visibility)(((int)val2 == 0 || (int)val2.Tipo.GetValueOrDefault() != 2) ? 2 : 0); + } + } + + private void MenuItem_OnClick(object sender, RoutedEventArgs e) + { + ((Window)new HosterWindow((ContentControl)(object)new SinistroView(ViewModel.SelectedItem, attached: false), "CADASTRO DE SINISTROS - " + ViewModel.SelectedItem.Descricao)).ShowDialog(); + _menuItemViewModel?.RecarregarItens(ViewModel.SelectedItem); + } + + private void CopyCodItem(object sender, MouseButtonEventArgs e) + { + ViewModel.CodigoItem.CopyToClipboard(); + ViewModel.ToggleSnackBar("COPIADO - " + ViewModel.CodigoItem); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/seguros/itens/vidaview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0077: Unknown result type (might be due to invalid IL or missing references) + //IL_0081: Expected O, but got Unknown + //IL_008e: Unknown result type (might be due to invalid IL or missing references) + //IL_0098: Expected O, but got Unknown + //IL_009a: Unknown result type (might be due to invalid IL or missing references) + //IL_00a6: Unknown result type (might be due to invalid IL or missing references) + //IL_00b0: Expected O, but got Unknown + //IL_00b2: Unknown result type (might be due to invalid IL or missing references) + //IL_00be: Unknown result type (might be due to invalid IL or missing references) + //IL_00c8: Expected O, but got Unknown + //IL_00ca: Unknown result type (might be due to invalid IL or missing references) + //IL_00d6: Unknown result type (might be due to invalid IL or missing references) + //IL_00e0: Expected O, but got Unknown + //IL_00e2: Unknown result type (might be due to invalid IL or missing references) + //IL_00ee: Unknown result type (might be due to invalid IL or missing references) + //IL_00f8: Expected O, but got Unknown + //IL_00fa: Unknown result type (might be due to invalid IL or missing references) + //IL_0106: Unknown result type (might be due to invalid IL or missing references) + //IL_0110: Expected O, but got Unknown + //IL_0112: Unknown result type (might be due to invalid IL or missing references) + //IL_011e: Unknown result type (might be due to invalid IL or missing references) + //IL_0128: Expected O, but got Unknown + //IL_012b: Unknown result type (might be due to invalid IL or missing references) + //IL_0135: Expected O, but got Unknown + //IL_0142: Unknown result type (might be due to invalid IL or missing references) + //IL_014c: Expected O, but got Unknown + //IL_014e: Unknown result type (might be due to invalid IL or missing references) + //IL_015a: Unknown result type (might be due to invalid IL or missing references) + //IL_0164: Expected O, but got Unknown + //IL_0166: Unknown result type (might be due to invalid IL or missing references) + //IL_0172: Unknown result type (might be due to invalid IL or missing references) + //IL_017c: Expected O, but got Unknown + //IL_017f: Unknown result type (might be due to invalid IL or missing references) + //IL_0189: Expected O, but got Unknown + //IL_018c: Unknown result type (might be due to invalid IL or missing references) + //IL_0196: Expected O, but got Unknown + //IL_0199: Unknown result type (might be due to invalid IL or missing references) + //IL_01a3: Expected O, but got Unknown + //IL_01a6: Unknown result type (might be due to invalid IL or missing references) + //IL_01b0: Expected O, but got Unknown + //IL_01bd: Unknown result type (might be due to invalid IL or missing references) + //IL_01c7: Expected O, but got Unknown + //IL_01c9: Unknown result type (might be due to invalid IL or missing references) + //IL_01d5: Unknown result type (might be due to invalid IL or missing references) + //IL_01df: Expected O, but got Unknown + //IL_01e1: Unknown result type (might be due to invalid IL or missing references) + //IL_01ed: Unknown result type (might be due to invalid IL or missing references) + //IL_01f7: Expected O, but got Unknown + //IL_01f9: Unknown result type (might be due to invalid IL or missing references) + //IL_0205: Unknown result type (might be due to invalid IL or missing references) + //IL_020f: Expected O, but got Unknown + //IL_0211: Unknown result type (might be due to invalid IL or missing references) + //IL_021d: Unknown result type (might be due to invalid IL or missing references) + //IL_0227: Expected O, but got Unknown + //IL_022a: Unknown result type (might be due to invalid IL or missing references) + //IL_0234: Expected O, but got Unknown + //IL_0236: Unknown result type (might be due to invalid IL or missing references) + //IL_0242: Unknown result type (might be due to invalid IL or missing references) + //IL_024c: Expected O, but got Unknown + //IL_024d: Unknown result type (might be due to invalid IL or missing references) + //IL_0259: Unknown result type (might be due to invalid IL or missing references) + //IL_0263: Expected O, but got Unknown + //IL_0264: Unknown result type (might be due to invalid IL or missing references) + //IL_0270: Unknown result type (might be due to invalid IL or missing references) + //IL_027a: Expected O, but got Unknown + //IL_027c: Unknown result type (might be due to invalid IL or missing references) + //IL_0288: Unknown result type (might be due to invalid IL or missing references) + //IL_0292: Expected O, but got Unknown + //IL_0293: Unknown result type (might be due to invalid IL or missing references) + //IL_029f: Unknown result type (might be due to invalid IL or missing references) + //IL_02a9: Expected O, but got Unknown + //IL_02aa: Unknown result type (might be due to invalid IL or missing references) + //IL_02b6: Unknown result type (might be due to invalid IL or missing references) + //IL_02c0: Expected O, but got Unknown + //IL_02c2: Unknown result type (might be due to invalid IL or missing references) + //IL_02ce: Unknown result type (might be due to invalid IL or missing references) + //IL_02d8: Expected O, but got Unknown + //IL_02d9: Unknown result type (might be due to invalid IL or missing references) + //IL_02e5: Unknown result type (might be due to invalid IL or missing references) + //IL_02ef: Expected O, but got Unknown + //IL_02f0: Unknown result type (might be due to invalid IL or missing references) + //IL_02fc: Unknown result type (might be due to invalid IL or missing references) + //IL_0306: Expected O, but got Unknown + //IL_0308: Unknown result type (might be due to invalid IL or missing references) + //IL_0315: Unknown result type (might be due to invalid IL or missing references) + //IL_031f: Expected O, but got Unknown + //IL_0320: Unknown result type (might be due to invalid IL or missing references) + //IL_032d: Unknown result type (might be due to invalid IL or missing references) + //IL_0337: Expected O, but got Unknown + //IL_0339: Unknown result type (might be due to invalid IL or missing references) + //IL_0345: Unknown result type (might be due to invalid IL or missing references) + //IL_034f: Expected O, but got Unknown + //IL_0352: Unknown result type (might be due to invalid IL or missing references) + //IL_035c: Expected O, but got Unknown + //IL_035f: Unknown result type (might be due to invalid IL or missing references) + //IL_0369: Expected O, but got Unknown + switch (connectionId) + { + case 1: + IncluirItemButton = (MenuItem)target; + IncluirItemButton.Click += new RoutedEventHandler(Incluir_OnClick); + break; + case 2: + ((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick); + break; + case 3: + ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick); + break; + case 4: + ((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick); + break; + case 5: + ((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick); + break; + case 6: + ((Control)(TextBox)target).MouseDoubleClick += new MouseButtonEventHandler(CopyCodItem); + break; + case 7: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirAquivoDigital_Click); + break; + case 8: + SinistroButton = (MenuItem)target; + SinistroButton.Click += new RoutedEventHandler(MenuItem_OnClick); + break; + case 9: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick); + break; + case 10: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLogEmail_OnClick); + break; + case 11: + PlanoBox = (TextBox)target; + break; + case 12: + CoberturasRadioButton = (RadioButton)target; + break; + case 13: + MaisInformacoesRadioButton = (RadioButton)target; + break; + case 14: + BotoesTitulares = (Menu)target; + ((UIElement)BotoesTitulares).IsEnabledChanged += new DependencyPropertyChangedEventHandler(BotoesTitulares_OnIsEnabledChanged); + break; + case 15: + ((MenuItem)target).Click += new RoutedEventHandler(IncluirTitular_OnClick); + break; + case 16: + ((MenuItem)target).Click += new RoutedEventHandler(AlterarTitular_OnClick); + break; + case 17: + ((MenuItem)target).Click += new RoutedEventHandler(ExcluirTitular_OnClick); + break; + case 18: + ((MenuItem)target).Click += new RoutedEventHandler(ImportarTitulares_OnClick); + break; + case 19: + SeparadorMaisInformacoes = (Separator)target; + break; + case 20: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 21: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 22: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 23: + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(FormatarDocumento); + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 24: + ((MenuItem)target).Click += new RoutedEventHandler(AplicarTitular_OnClick); + break; + case 25: + ContentControl = (ContentControl)target; + break; + case 26: + DataGridTitulares = (DataGrid)target; + DataGridTitulares.CellEditEnding += DataGridTitulares_OnCellEditEnding; + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_0027: Unknown result type (might be due to invalid IL or missing references) + //IL_0033: Unknown result type (might be due to invalid IL or missing references) + //IL_003d: Expected O, but got Unknown + //IL_003e: Unknown result type (might be due to invalid IL or missing references) + //IL_004a: Unknown result type (might be due to invalid IL or missing references) + //IL_0054: Expected O, but got Unknown + //IL_0055: Unknown result type (might be due to invalid IL or missing references) + //IL_0061: Unknown result type (might be due to invalid IL or missing references) + //IL_006b: Expected O, but got Unknown + //IL_006d: Unknown result type (might be due to invalid IL or missing references) + //IL_0079: Unknown result type (might be due to invalid IL or missing references) + //IL_0083: Expected O, but got Unknown + //IL_0084: Unknown result type (might be due to invalid IL or missing references) + //IL_0090: Unknown result type (might be due to invalid IL or missing references) + //IL_009a: Expected O, but got Unknown + //IL_009b: Unknown result type (might be due to invalid IL or missing references) + //IL_00a7: Unknown result type (might be due to invalid IL or missing references) + //IL_00b1: Expected O, but got Unknown + //IL_00b3: Unknown result type (might be due to invalid IL or missing references) + //IL_00bf: Unknown result type (might be due to invalid IL or missing references) + //IL_00c9: Expected O, but got Unknown + //IL_00ca: Unknown result type (might be due to invalid IL or missing references) + //IL_00d6: Unknown result type (might be due to invalid IL or missing references) + //IL_00e0: Expected O, but got Unknown + //IL_00e1: Unknown result type (might be due to invalid IL or missing references) + //IL_00ed: Unknown result type (might be due to invalid IL or missing references) + //IL_00f7: Expected O, but got Unknown + //IL_00f9: Unknown result type (might be due to invalid IL or missing references) + //IL_0106: Unknown result type (might be due to invalid IL or missing references) + //IL_0110: Expected O, but got Unknown + //IL_0111: Unknown result type (might be due to invalid IL or missing references) + //IL_011e: Unknown result type (might be due to invalid IL or missing references) + //IL_0128: Expected O, but got Unknown + //IL_012a: Unknown result type (might be due to invalid IL or missing references) + //IL_0136: Unknown result type (might be due to invalid IL or missing references) + //IL_0140: Expected O, but got Unknown + //IL_0142: Unknown result type (might be due to invalid IL or missing references) + //IL_014e: Unknown result type (might be due to invalid IL or missing references) + //IL_0158: Expected O, but got Unknown + //IL_0159: Unknown result type (might be due to invalid IL or missing references) + //IL_015f: Expected O, but got Unknown + //IL_0172: Unknown result type (might be due to invalid IL or missing references) + //IL_017c: Expected O, but got Unknown + //IL_017d: Unknown result type (might be due to invalid IL or missing references) + switch (connectionId) + { + case 27: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 28: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 29: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 30: + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(FormatarDocumento); + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 31: + ((Selector)(ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(TipoComboBoxSelectionChanged); + break; + case 32: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBox_Populating); + break; + case 33: + { + EventSetter val = new EventSetter(); + val.Event = FrameworkElement.LoadedEvent; + val.Handler = (Delegate)new RoutedEventHandler(Dependente_CellLoaded); + ((Collection<SetterBase>)(object)((Style)target).Setters).Add((SetterBase)(object)val); + break; + } + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Seguros/ApoliceView.cs b/Decompiler/Gestor.Application.Views.Seguros/ApoliceView.cs new file mode 100644 index 0000000..d1bb049 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Seguros/ApoliceView.cs @@ -0,0 +1,3255 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Threading; +using CurrencyTextBoxControl; +using Gestor.Application.Actions; +using Gestor.Application.Componentes; +using Gestor.Application.Drawers; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.Servicos.Seguros.Itens; +using Gestor.Application.ViewModels.Seguros; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Views.Seguros; + +public class ApoliceView : BaseUserControl, IComponentConnector, IStyleConnector +{ + private string _vencimentoCartaoOld = ""; + + private bool _calculando; + + internal DockPanel MenuApolice; + + internal MenuItem IncluirpoliceButton; + + internal MenuItem AlterarApoliceButton; + + internal MenuItem SalvarApoliceButton; + + internal MenuItem CancelarApoliceButton; + + internal MenuItem ExcluirpoliceButton; + + internal Button ButtonImportado; + + internal MenuItem ArquivoDigitalButton; + + internal MenuItem MaisOpcoesButton; + + internal MenuItem EditarParcelasButton; + + internal WrapPanel ApoliceControl1; + + internal ComboBox ProdutoBox; + + internal ComboBox SituacaoBox; + + internal ComboBox NegocioCorretoraBox; + + internal ComboBox TipoRecebimentoBox; + + internal ComboBox TipoEndossoBox; + + internal TextBox ApoliceBox; + + internal TextBox EndossoBox; + + internal DatePicker Vigencia2Box; + + internal DatePicker TransmissaoBox; + + internal DatePicker EmissaoBox; + + internal ComboBox FormaPagamentoBox; + + internal Grid PremiosBox; + + internal ToggleButton AdicionalBox; + + internal CustomIsReadOnlyControl Comissao; + + internal CurrencyTextBox ComissaoBox; + + internal CurrencyTextBox PremioLiquidoBox; + + internal CurrencyTextBox PremioAdicionalBox; + + internal CurrencyTextBox IofBox; + + internal CurrencyTextBox DiferencaBox; + + internal CurrencyTextBox PremioTotalBox; + + internal CurrencyTextBox ParcelasBox; + + internal CustomIsReadOnlyControl ComissaoOriginal; + + internal CustomIsReadOnlyControl Gerada; + + internal CustomIsReadOnlyControl Recebida; + + internal CustomIsReadOnlyControl Pendente; + + internal CustomIsReadOnlyControl Repasse; + + internal Menu BaixarParcelaButton; + + internal Menu SalvarParcelaButton; + + internal StackPanel EditarParcelasFields; + + internal CustomItemValidation TipoParcelaField; + + internal ComboBox TipoParcelaBox; + + internal CustomItemControl QuantidadeFaturaField; + + internal CurrencyTextBox QuantidadeFaturaBox; + + internal CustomItemValidation FaturaField; + + internal TextBox FaturaBox; + + internal CustomItemValidation VigenciaInicialField; + + internal CustomItemValidation VigenciaFinalField; + + internal DatePicker VigenciaFinalParcelaBox; + + internal CustomItemValidation VencimentoField; + + internal CustomItemControl EmissaoField; + + internal DatePicker EmissaoParcelaBox; + + internal CustomItemValidation PercentualComissaoField; + + internal CurrencyTextBox ComissaoParcelaBox; + + internal TextBlock ComissaoIcon; + + internal CustomItemControl ValorLiquidoField; + + internal CurrencyTextBox ValorLiquidoParcelaBox; + + internal CustomItemControl ValorField; + + internal CurrencyTextBox ValorParcelaBox; + + internal CustomItemValidation RecebimentoField; + + internal DatePicker RecebimentoParcelaBox; + + internal CustomItemControl QuitacaoField; + + internal CustomItemControl DataControleParcelaField; + + internal CustomItemValidation CreditoField; + + internal DatePicker CreditoParcelaBox; + + internal CustomItemValidation ValorRealizadoField; + + internal CurrencyTextBox ValorRealizadoParcelaBox; + + internal CustomItemValidation ValorComissaoField; + + internal CurrencyTextBox ValorComissaoParcelaBox; + + internal WrapPanel ImpostosField; + + internal CustomItemControl PorcentagemIrField; + + internal CurrencyTextBox PorcentagemIrBox; + + internal CustomItemControl ValorIrField; + + internal CurrencyTextBox ValorIrBox; + + internal CustomItemControl PorcentagemIssField; + + internal CurrencyTextBox PorcentagemIssBox; + + internal CustomItemControl ValorIssField; + + internal CurrencyTextBox ValorIssBox; + + internal CustomItemControl ValorOutrosField; + + internal CurrencyTextBox ValorOutrosBox; + + internal CustomItemControl ValorDescontoField; + + internal CurrencyTextBox ValorDescontoBox; + + internal CustomItemControl ValorComDescField; + + internal CurrencyTextBox ValorComDescBox; + + internal DataGrid ParcelaGrid; + + internal DataGridTextColumn ParcelaColumn; + + internal DataGridTextColumn FaturaColumn; + + internal DataGridTextColumn VigenciaInicialColumn; + + internal DataGridTextColumn VigenciaFinalColumn; + + internal DataGridTextColumn ParcelasComissaoColumn; + + internal DataGridTextColumn ParcelasValorComissaoColumn; + + internal DataGridTextColumn ParcelasValorComissaoDescColumn; + + internal DataGridTemplateColumn MaisInformacoesColumn; + + internal MenuItem EditarVendedorButton; + + internal MenuItem SalvarVendedorButton; + + internal MenuItem CancelarVendedorButton; + + internal WrapPanel EditarVendedorFields; + + internal ToggleButton CoCorretagemToogle; + + internal ComboBox TipoVendedorBox; + + internal ComboBox VendedorBox; + + internal CustomItemValidation ComissaoNovoBox; + + internal ComboBox ComissaoNovoComboBox; + + internal CustomItemValidation ComissaoRenovacaoBox; + + internal ComboBox ComissaoRenovacaoComboBox; + + internal CurrencyTextBox ValorRepasseBox; + + internal TextBox FormaRecebidaBox; + + internal TextBox FormaIncidenciaBox; + + internal DataGrid VendedorGrid; + + internal DataGridTextColumn VendedorGridColumn; + + internal DataGridTextColumn PagamentosPorcentagemRepasseColumn; + + internal DataGridTextColumn PagamentosValorRepasseColumn; + + internal TextBox ProponenteBox; + + internal AutoCompleteBox AutoCompleteBanco; + + internal TextBox AgenciaBox; + + internal TextBox ContaBox; + + internal TextBox CartaoBox; + + internal ComboBox BandeiraBox; + + internal TextBox VencimentoCartaoBox; + + internal DatePicker DataBox; + + internal TextBox PastaBox; + + private bool _contentLoaded; + + public ApoliceViewModel ViewModel { get; set; } + + private int EditarParcelaTipo { get; set; } + + private AcessoApolice AcessoApolice { get; } + + public ApoliceView(Documento documentoSelecionado, bool lockInsert = false, bool invoke = true, AcessoApolice acesso = 0, long idparcela = 0L, bool consultaTela = false) + { + //IL_001d: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + //IL_0045: Unknown result type (might be due to invalid IL or missing references) + ((FrameworkElement)this).Tag = "CADASTRO DE APÓLICE"; + AcessoApolice = acesso; + Gestor.Application.Actions.Actions.Redimencionar = (Action<bool>)Delegate.Combine(Gestor.Application.Actions.Actions.Redimencionar, new Action<bool>(Redimencionar)); + ViewModel = new ApoliceViewModel(acesso, documentoSelecionado, invoke, idparcela); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + ((FrameworkElement)ParcelaGrid).DataContext = ViewModel; + if (consultaTela) + { + ((UIElement)ExcluirpoliceButton).IsEnabled = false; + } + Restricao(); + if (lockInsert) + { + ((UIElement)IncluirpoliceButton).IsEnabled = false; + } + if (documentoSelecionado != null) + { + string text = ((documentoSelecionado.Tipo == 0 && string.IsNullOrEmpty(documentoSelecionado.Apolice)) ? ("PROPOSTA \"" + documentoSelecionado.Proposta + "\"") : ((documentoSelecionado.Tipo == 0 && !string.IsNullOrEmpty(documentoSelecionado.Apolice)) ? ("APÓLICE \"" + documentoSelecionado.Apolice + "\"") : (string.IsNullOrEmpty(documentoSelecionado.Endosso) ? ("PROPOSTA DE ENDOSSO \"" + documentoSelecionado.PropostaEndosso + "\"") : ("ENDOSSO \"" + documentoSelecionado.Endosso + "\"")))); + ViewModel.RegistrarAcao("ACESSOU " + text, ((DomainBase)documentoSelecionado).Id, (TipoTela)2, ViewModel.GerarObs(documentoSelecionado)); + } + } + + private void ValidarTela() + { + if (ViewModel.SelectedDocumento != null) + { + List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedDocumento.Validate(); + ((DependencyObject)(object)this).ValidateFields(errorMessages, focusField: false); + } + } + + private void Redimencionar(bool invoke) + { + Window? obj = ((IEnumerable)Application.Current.Windows).OfType<Window>().SingleOrDefault((Func<Window, bool>)((Window x) => x.IsActive)); + double num = ((obj != null) ? ((FrameworkElement)obj).ActualWidth : 1366.0); + Redimencionar(num - (double)(invoke ? 40 : 0)); + Gestor.Application.Actions.Actions.Redimencionar = (Action<bool>)Delegate.Remove(Gestor.Application.Actions.Actions.Redimencionar, new Action<bool>(Redimencionar)); + } + + private async void ApoliceView_OnLoaded(object sender, RoutedEventArgs e) + { + while (!ViewModel.Loaded) + { + await Task.Delay(100); + } + AcessarApolice(AcessoApolice); + } + + private void AcessarApolice(AcessoApolice acesso) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Invalid comparison between Unknown and I4 + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + //IL_0015: Expected O, but got Unknown + //IL_0004: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Invalid comparison between Unknown and I4 + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + //IL_0029: Expected O, but got Unknown + if ((int)acesso != 2) + { + if ((int)acesso == 3) + { + Renovar_OnClick(this, new RoutedEventArgs()); + Restricao(insert: true); + } + } + else + { + Endossar_OnClick(this, new RoutedEventArgs()); + Restricao(insert: true); + } + } + + private void ContentLoad() + { + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Expected O, but got Unknown + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Expected O, but got Unknown + //IL_003b: Unknown result type (might be due to invalid IL or missing references) + //IL_0045: Expected O, but got Unknown + //IL_0052: Unknown result type (might be due to invalid IL or missing references) + //IL_005c: Expected O, but got Unknown + //IL_0069: Unknown result type (might be due to invalid IL or missing references) + //IL_0073: Expected O, but got Unknown + //IL_0080: Unknown result type (might be due to invalid IL or missing references) + //IL_008a: Expected O, but got Unknown + //IL_0097: Unknown result type (might be due to invalid IL or missing references) + //IL_00a1: Expected O, but got Unknown + //IL_00ae: Unknown result type (might be due to invalid IL or missing references) + //IL_00b8: Expected O, but got Unknown + //IL_00c5: Unknown result type (might be due to invalid IL or missing references) + //IL_00cf: Expected O, but got Unknown + //IL_00dc: Unknown result type (might be due to invalid IL or missing references) + //IL_00e6: Expected O, but got Unknown + //IL_00f3: Unknown result type (might be due to invalid IL or missing references) + //IL_00fd: Expected O, but got Unknown + //IL_010a: Unknown result type (might be due to invalid IL or missing references) + //IL_0114: Expected O, but got Unknown + //IL_0121: Unknown result type (might be due to invalid IL or missing references) + //IL_012b: Expected O, but got Unknown + //IL_0138: Unknown result type (might be due to invalid IL or missing references) + //IL_0142: Expected O, but got Unknown + //IL_014f: Unknown result type (might be due to invalid IL or missing references) + //IL_0159: Expected O, but got Unknown + //IL_0166: Unknown result type (might be due to invalid IL or missing references) + //IL_0170: Expected O, but got Unknown + //IL_017d: Unknown result type (might be due to invalid IL or missing references) + //IL_0187: Expected O, but got Unknown + //IL_0194: Unknown result type (might be due to invalid IL or missing references) + //IL_019e: Expected O, but got Unknown + //IL_01ab: Unknown result type (might be due to invalid IL or missing references) + //IL_01b5: Expected O, but got Unknown + //IL_01c2: Unknown result type (might be due to invalid IL or missing references) + //IL_01cc: Expected O, but got Unknown + //IL_01d9: Unknown result type (might be due to invalid IL or missing references) + //IL_01e3: Expected O, but got Unknown + //IL_01f0: Unknown result type (might be due to invalid IL or missing references) + //IL_01fa: Expected O, but got Unknown + //IL_0207: Unknown result type (might be due to invalid IL or missing references) + //IL_0211: Expected O, but got Unknown + //IL_021e: Unknown result type (might be due to invalid IL or missing references) + //IL_0228: Expected O, but got Unknown + //IL_0235: Unknown result type (might be due to invalid IL or missing references) + //IL_023f: Expected O, but got Unknown + //IL_0283: Unknown result type (might be due to invalid IL or missing references) + //IL_028d: Expected O, but got Unknown + //IL_02dc: Unknown result type (might be due to invalid IL or missing references) + //IL_02e2: Invalid comparison between Unknown and I4 + ((Selector)ParcelaGrid).SelectionChanged += new SelectionChangedEventHandler(ParcelaGrid_OnSelectionChanged); + ((UIElement)ApoliceBox).LostFocus += new RoutedEventHandler(ValidacaoDocumento); + ((UIElement)EndossoBox).LostFocus += new RoutedEventHandler(ValidacaoDocumento); + ((Selector)TipoEndossoBox).SelectionChanged += new SelectionChangedEventHandler(TipoEndossoBox_OnSelectionChanged); + ((Selector)TipoRecebimentoBox).SelectionChanged += new SelectionChangedEventHandler(TipoRecebimentoBox_OnSelectionChanged); + ((Selector)SituacaoBox).SelectionChanged += new SelectionChangedEventHandler(SituacaoBox_OnSelectionChanged); + ((UIElement)PremioLiquidoBox).LostFocus += new RoutedEventHandler(AlteracaoDePremio_LostFocus); + ((UIElement)PremioAdicionalBox).LostFocus += new RoutedEventHandler(AlteracaoDePremio_LostFocus); + ((UIElement)IofBox).LostFocus += new RoutedEventHandler(AlteracaoDePremio_LostFocus); + ((UIElement)DiferencaBox).LostFocus += new RoutedEventHandler(AlteracaoDePremio_LostFocus); + AdicionalBox.Unchecked += new RoutedEventHandler(AdicionalBox_OnChecked); + AdicionalBox.Checked += new RoutedEventHandler(AdicionalBox_OnChecked); + ((UIElement)ParcelasBox).LostFocus += new RoutedEventHandler(AlteracaoParcela_LostFocus); + ((Selector)NegocioCorretoraBox).SelectionChanged += new SelectionChangedEventHandler(NegocioCorretoraBox_OnSelectionChanged); + ((UIElement)ComissaoBox).LostFocus += new RoutedEventHandler(AlteracaoDePremio_LostFocus); + ((UIElement)DataBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)DataBox).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Selector)VendedorBox).SelectionChanged += new SelectionChangedEventHandler(VendedorBox_OnSelectionChanged); + ((Selector)TipoVendedorBox).SelectionChanged += new SelectionChangedEventHandler(TipoVendedorBox_OnSelectionChanged); + ((UIElement)ValorLiquidoParcelaBox).LostFocus += new RoutedEventHandler(ValorParcelaBox_OnLostFocus); + ((UIElement)ComissaoParcelaBox).LostFocus += new RoutedEventHandler(Recalcula); + ((UIElement)ValorLiquidoParcelaBox).LostFocus += new RoutedEventHandler(Recalcula); + ((UIElement)ValorComissaoParcelaBox).LostFocus += new RoutedEventHandler(Recalcula); + ((UIElement)ValorRealizadoParcelaBox).LostFocus += new RoutedEventHandler(Recalcula); + ((UIElement)ValorParcelaBox).LostFocus += new RoutedEventHandler(Recalcula); + bool flag = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 5); + ((UIElement)ValorDescontoField).Visibility = (Visibility)((!flag) ? 2 : 0); + ((FrameworkElement)this).SizeChanged += new SizeChangedEventHandler(ApoliceControl_SizeChanged); + if (ViewModel.SelectedDocumento != null) + { + AutoCompleteBox autoCompleteBanco = AutoCompleteBanco; + Banco banco = ViewModel.SelectedDocumento.Banco; + autoCompleteBanco.Text = ((banco != null) ? banco.Nome : null); + ViewModel.IsFatura = (int)ViewModel.SelectedDocumento.TipoRecebimento.GetValueOrDefault((TipoRecebimento)1) == 2; + Parcelas(!ViewModel.IsFatura); + } + } + + private async void ExcluirVendedor_Click(object sender, RoutedEventArgs e) + { + ((ButtonBase)(Button)sender).Click -= new RoutedEventHandler(ExcluirVendedor_Click); + Button val = (Button)sender; + if (val == null || ((FrameworkElement)val).DataContext == null) + { + return; + } + VendedorParcela pagamento = (VendedorParcela)((FrameworkElement)val).DataContext; + int num; + if (pagamento == null) + { + num = 0; + } + else + { + Repasse repasse = pagamento.Repasse; + num = (((int)((repasse != null) ? repasse.Tipo : null).GetValueOrDefault() == 3) ? 1 : 0); + } + bool deleteCoCorretagem = (byte)num != 0; + if (!((UIElement)AlterarApoliceButton).IsEnabled && ((UIElement)SalvarApoliceButton).IsEnabled) + { + await ViewModel.ShowMessage("NÃO É POSSÍVEL EXCLUIR VENDEDOR DURANTE ALTERAÇÃO DE DOCUMENTO."); + return; + } + if (pagamento != null && !pagamento.DataPagamento.HasValue) + { + if (!ViewModel._excluirPermissEnabled) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA EXCLUIR VENDEDORES. ENTRE EM CONTATO COM O ADMINISTRADOR DO SISTEMA."); + return; + } + if (pagamento.CoCorretagem) + { + IEnumerable<VendedorParcela> enumerable = ViewModel.Pagamentos.Where(delegate(VendedorParcela pgt) + { + //IL_0015: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Invalid comparison between Unknown and I4 + Repasse repasse2 = pgt.Repasse; + return (repasse2 == null || (int)repasse2.Tipo.GetValueOrDefault() != 3) && !pgt.Vendedor.Corretora; + }); + if (enumerable != null && enumerable.Count() >= 1) + { + await ViewModel.ShowMessage("NÃO É POSSÍVEL EXCLUIR O VENDEDOR CO-CORRETAGEM. HÁ VENDEDORES CADASTRADOS NO DOCUMENTO"); + return; + } + } + await ViewModel.ExcluirVendedor(pagamento); + } + else if ((await ViewModel.ShowSenha($"DESEJA REALMENTE EXCLUIR O PAGAMENTO DO VENDEDOR {pagamento.Vendedor.Nome} {pagamento.DataPagamento:d}?\nESSE PROCEDIMENTO É IRREVERSÍVEL.")).GetValueOrDefault()) + { + await ViewModel.ExcluirPagamento(pagamento); + } + ((TextBoxBase)ComissaoBox).IsReadOnly = ViewModel.VerificaCoCorretagem(); + ViewModel.ComissOriginalVisibility = (Visibility)((!((TextBoxBase)ComissaoBox).IsReadOnly) ? 2 : 0); + if (deleteCoCorretagem) + { + await ViewModel.AjusteComissãoCoCorretagem(removido: true); + } + ((ButtonBase)(Button)sender).Click += new RoutedEventHandler(ExcluirVendedor_Click); + } + + private async void BaixarParcelas_Click(object sender, RoutedEventArgs e) + { + ((UIElement)ParcelaGrid).IsEnabled = false; + ((MenuItem)sender).Click -= new RoutedEventHandler(BaixarParcelas_Click); + ViewModel.QuantidadeFaturas = 1; + if (await ViewModel.SelecionarParcelaBaixa()) + { + ToggleBotoesParcela(habilitar: true); + ViewModel.BaixarParcelas = true; + await ViewModel.CarregarImposto(); + EditarParcelaTipo = 2; + BaixarParcelas(); + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: false); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: false); + ((MenuItem)sender).Click += new RoutedEventHandler(BaixarParcelas_Click); + ViewModel.AllowEditVendedor = false; + } + } + + private async Task SalvarParcela() + { + bool flag = EditarParcelaTipo == 3 && ViewModel.QuantidadeFaturas > 1; + if (flag) + { + flag = !(await ViewModel.ShowMessage($"O SISTEMA IRÁ INCLUIR/REPLICAR A FATURA {ViewModel.QuantidadeFaturas} VEZES. DESEJA PROSSEGUIR?", "SIM", "NÃO")); + } + if (flag) + { + return; + } + List<KeyValuePair<string, string>> list = await ViewModel.SalvarParcelas(EditarParcelaTipo); + ((DependencyObject)(object)this).ValidateFields(list); + if (list != null && list.Count != 0) + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + return; + } + EditarVendedor(editar: false); + ((UIElement)SalvarParcelaButton).Visibility = (Visibility)2; + ViewModel.EditandoParcela = false; + ((UIElement)BaixarParcelaButton).Visibility = (Visibility)0; + ViewModel.BaixarParcelas = false; + EditarParcelaTipo = 0; + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: true); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: true); + ToggleBotoesParcela(habilitar: false); + if (ViewModel.UltimaFatura) + { + ViewModel.UltimaFatura = false; + ToggleBotoesParcela(habilitar: true); + EditarParcelaTipo = 3; + ReplicarFatura(); + ViewModel.QuantidadeFaturas = 0; + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: false); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: false); + EditandoParcela(!ViewModel.UltimaFatura); + } + } + + private async void SalvarParcela_Click(object sender, RoutedEventArgs e) + { + ((MenuItem)((ItemsControl)SalvarParcelaButton).Items[0]).Click -= new RoutedEventHandler(SalvarParcela_Click); + LostFocusValorRealizado(); + ViewModel.Loading(isLoading: true); + if (!ViewModel.CriandoParcelaEspecial) + { + await SalvarParcela(); + } + ViewModel.Loading(isLoading: false); + ((UIElement)SalvarParcelaButton).IsEnabled = true; + ((MenuItem)((ItemsControl)SalvarParcelaButton).Items[0]).Click += new RoutedEventHandler(SalvarParcela_Click); + } + + private void AlterarParcela_Click(object sender, RoutedEventArgs e) + { + ViewModel.QuantidadeFaturas = 1; + if (ViewModel.Parcelas.Count != 0) + { + ToggleBotoesParcela(habilitar: true); + EditarParcelaTipo = 1; + ViewModel.SelecionaPrimeiraParcela(); + AlterarParcela(); + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: false); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: false); + ViewModel.AllowEditVendedor = ViewModel.IsFatura; + } + } + + private void AlterarParcela() + { + ((UIElement)FaturaField).Visibility = (Visibility)((!ViewModel.IsFatura) ? 2 : 0); + ((UIElement)QuantidadeFaturaField).Visibility = (Visibility)((!ViewModel.IsFatura) ? 2 : 0); + ((UIElement)VigenciaInicialField).Visibility = (Visibility)((!ViewModel.IsFatura) ? 2 : 0); + ((UIElement)VigenciaFinalField).Visibility = (Visibility)((!ViewModel.IsFatura) ? 2 : 0); + ((UIElement)ValorLiquidoField).Visibility = (Visibility)((!ViewModel.IsFatura) ? 2 : 0); + ((UIElement)PercentualComissaoField).Visibility = (Visibility)((!ViewModel.IsFatura) ? 2 : 0); + ((UIElement)ComissaoIcon).Visibility = (Visibility)((!ViewModel.IsFatura) ? 2 : 0); + ((UIElement)EmissaoField).Visibility = (Visibility)((!ViewModel.IsFatura) ? 2 : 0); + ((UIElement)RecebimentoField).Visibility = (Visibility)2; + ((UIElement)QuitacaoField).Visibility = (Visibility)0; + ((UIElement)DataControleParcelaField).Visibility = (Visibility)0; + ((UIElement)ValorRealizadoField).Visibility = (Visibility)2; + ((UIElement)CreditoField).Visibility = (Visibility)2; + ((UIElement)ValorComissaoField).Visibility = (Visibility)2; + ((UIElement)VencimentoField).Visibility = (Visibility)0; + ((UIElement)ValorField).Visibility = (Visibility)0; + ((UIElement)TipoParcelaField).Visibility = (Visibility)2; + ((UIElement)VencimentoField).Visibility = (Visibility)0; + ((UIElement)ValorField).Visibility = (Visibility)0; + ((UIElement)EditarParcelasFields).Visibility = (Visibility)0; + ValidarParcela(); + } + + private void BaixarParcelas() + { + ((UIElement)FaturaField).Visibility = (Visibility)((!ViewModel.IsFatura) ? 2 : 0); + ((UIElement)VigenciaInicialField).Visibility = (Visibility)((!ViewModel.IsFatura) ? 2 : 0); + ((UIElement)VigenciaFinalField).Visibility = (Visibility)((!ViewModel.IsFatura) ? 2 : 0); + ((UIElement)PercentualComissaoField).Visibility = (Visibility)((!ViewModel.IsFatura) ? 2 : 0); + ((UIElement)ComissaoIcon).Visibility = (Visibility)((!ViewModel.IsFatura) ? 2 : 0); + ((UIElement)QuantidadeFaturaField).Visibility = (Visibility)2; + ((UIElement)QuitacaoField).Visibility = (Visibility)2; + ((UIElement)DataControleParcelaField).Visibility = (Visibility)2; + ((UIElement)EmissaoField).Visibility = (Visibility)2; + ((UIElement)ValorLiquidoField).Visibility = (Visibility)0; + ((UIElement)VencimentoField).Visibility = (Visibility)2; + ((UIElement)ValorField).Visibility = (Visibility)2; + ((UIElement)TipoParcelaField).Visibility = (Visibility)2; + ((UIElement)RecebimentoField).Visibility = (Visibility)0; + ((UIElement)CreditoField).Visibility = (Visibility)0; + ((UIElement)ValorRealizadoField).Visibility = (Visibility)0; + ((UIElement)ValorComissaoField).Visibility = (Visibility)0; + ((UIElement)EditarParcelasFields).Visibility = (Visibility)0; + if (Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 5)) + { + ((UIElement)ImpostosField).Visibility = (Visibility)0; + } + ((UIElement)ParcelaGrid).IsEnabled = false; + ValidarParcela(); + ((UIElement)RecebimentoParcelaBox).Focus(); + } + + private async void ExcluirParcela_Click(object sender, RoutedEventArgs e) + { + if (await ViewModel.PagamentoVendedor(ViewModel.SelectedParcela)) + { + bool? flag = await ViewModel.ShowSenha("HÁ PAGAMENTOS DE VENDEDORES REALIZADOS PARA ESSA PARCELA. DESEJA PROSSEGUIR COM A EXCLUSÃO?"); + if (!flag.HasValue) + { + return; + } + if (!flag.GetValueOrDefault()) + { + await ViewModel.ShowMessage("SENHA INVÁLIDA"); + return; + } + } + if (!ViewModel.SelectedParcela.DataRecebimento.HasValue) + { + await ViewModel.ExcluirParcela(); + } + else + { + await ViewModel.ExcluirBaixa(); + } + EditandoParcela(enable: true); + } + + private void MenuItem_OnClick(object sender, RoutedEventArgs e) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0025: Unknown result type (might be due to invalid IL or missing references) + //IL_0045: Unknown result type (might be due to invalid IL or missing references) + //IL_004c: Unknown result type (might be due to invalid IL or missing references) + //IL_0062: Unknown result type (might be due to invalid IL or missing references) + //IL_009d: Expected O, but got Unknown + Tarefa tarefa = new Tarefa + { + IdCliente = ((DomainBase)ViewModel.SelectedDocumento.Controle.Cliente).Id, + Cliente = ViewModel.SelectedDocumento.Controle.Cliente.Nome, + Entidade = (TipoTarefa)0, + IdEntidade = ((DomainBase)ViewModel.SelectedDocumento).Id, + Titulo = ViewModel.SelectedDocumento.Controle.Cliente.Nome + " APÓLICE " + ViewModel.SelectedDocumento.Apolice + }; + ViewModel.ShowDrawer(new TarefaDrawer(tarefa), 0, close: false); + } + + private async void AbrirAquivoDigital_Click(object sender, RoutedEventArgs e) + { + FiltroArquivoDigital filtro = null; + string text = ""; + Button val = (Button)((sender is Button) ? sender : null); + if (val == null) + { + MenuItem val2 = (MenuItem)((sender is MenuItem) ? sender : null); + if (val2 != null) + { + text = ((FrameworkElement)val2).Name; + } + } + else + { + text = ((FrameworkElement)val).Name; + } + if (!(text == "ArquivoDigitalButton")) + { + if (text == "Parcela") + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)3).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)3) + "."); + return; + } + filtro = new FiltroArquivoDigital + { + Id = ((DomainBase)ViewModel.SelectedParcela).Id, + IdApolice = ((DomainBase)ViewModel.SelectedParcela.Documento).Id, + Tipo = (TipoArquivoDigital)3, + Parente = ViewModel.SelectedParcela + }; + } + } + else + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)2).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)2) + "."); + return; + } + filtro = new FiltroArquivoDigital + { + Id = ((DomainBase)ViewModel.SelectedDocumento).Id, + Tipo = (TipoArquivoDigital)2, + Parente = ViewModel.SelectedDocumento + }; + } + ViewModel.ShowDrawer(new ArquivoDigitalDrawer(filtro), 0, close: false); + } + + private async void ExcluirDocumento_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.ExcluirApolice(); + } + + private async void RecusarDocumento_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.Restricao((TipoRestricao)18)) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA RECUSAR. PROCURE O ADMINSTRADOR DO SISTEMA."); + } + else + { + await ViewModel.RecusarApolice(); + } + } + + private async void Renovar_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.Restricao((TipoRestricao)17)) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA RENOVAR. PROCURE O ADMINSTRADOR DO SISTEMA."); + return; + } + if (!ViewModel.EnableRenovar) + { + await ViewModel.ShowMessage("NÃO É POSSÍVEL RENOVAR UM DOCUMENTO SEM EMISSÃO OU SEM FINAL DE VIGÊNCIA."); + } + if (await ViewModel.IncluirApolice(renovar: true)) + { + ViewModel.BotoesParcelaEnabled = false; + ViewModel.AllowEditEmissao = true; + Restricao(insert: true); + } + } + + private async void Endossar_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.Restricao((TipoRestricao)33)) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ENDOSSAR. PROCURE O ADMINSTRADOR DO SISTEMA."); + } + else if (!ViewModel.EnableEndossar) + { + List<KeyValuePair<string, string>> pairs = ViewModel.SelectedDocumento.ValidateEndossar(); + await ViewModel.ShowMessage(pairs, ViewModel.ErroCamposInvalidos, "OK"); + } + else if (await ViewModel.IncluirEndosso()) + { + ViewModel.BotoesParcelaEnabled = false; + Endossar(); + Restricao(insert: true); + } + } + + private async void CancelarApolice_OnClick(object sender, RoutedEventArgs e) + { + CancelarAlteracao(); + await ViewModel.CancelarAlteracao(); + AlterandoDocumento(alterando: false); + EditandoVendedor(enable: false); + Restricao(); + } + + private void CancelarAlteracao() + { + SetValid(AutoCompleteBanco, valid: true); + AutoCompleteBanco.Text = string.Empty; + ViewModel.BotoesParcelaEnabled = true; + ViewModel.AlteracaoEnabled = true; + EditarVendedor(editar: false); + ValidarDocumento(); + } + + private static void SetValid(AutoCompleteBox autocomplete, bool valid) + { + ViewHelper.SetInvalid((Control)(object)autocomplete, "BANCO INVÁLIDO", valid); + } + + private async void SalvarApolice_OnClick(object sender, RoutedEventArgs e) + { + SalvarApoliceButton.Click -= new RoutedEventHandler(SalvarApolice_OnClick); + if (ViewModel.CompararValores()) + { + PremioTotalBox.Number = PremioLiquidoBox.Number + PremioAdicionalBox.Number + IofBox.Number + DiferencaBox.Number; + } + ExecutarValidacaoDataApolice(); + if (!(await SalvarDocumento())) + { + SalvarApoliceButton.Click += new RoutedEventHandler(SalvarApolice_OnClick); + return; + } + try + { + await ViewModel.CreateLinkAssistencia(ViewModel.SelectedDocumento, null, retorno: false); + } + catch (Exception) + { + } + AlterandoDocumento(alterando: false); + EditandoVendedor(enable: false); + ViewModel.BotoesParcelaEnabled = true; + Restricao(); + SalvarApoliceButton.Click += new RoutedEventHandler(SalvarApolice_OnClick); + } + + public void AlterandoDocumento(bool alterando) + { + PermissaoUsuario val = ViewModel.ServicoPermissUsuario.BuscarPermissao(Recursos.Usuario, (TipoTela)2); + ((UIElement)EditarVendedorButton).IsEnabled = (val == null || val.Incluir) && !alterando; + } + + private void ExecutarValidacaoDataApolice() + { + ViewModel.SelectedDocumento.Vigencia2 = (DateTime.TryParse(ValidationHelper.FormatDate(Vigencia2Box.Text), out var result) ? new DateTime?(result) : null); + ViewModel.SelectedDocumento.Remessa = (DateTime.TryParse(ValidationHelper.FormatDate(TransmissaoBox.Text), out result) ? new DateTime?(result) : null); + ViewModel.SelectedDocumento.Emissao = (DateTime.TryParse(ValidationHelper.FormatDate(EmissaoBox.Text), out result) ? new DateTime?(result) : null); + ViewModel.SelectedDocumento.DataControle = (DateTime.TryParse(ValidationHelper.FormatDate(DataBox.Text), out result) ? new DateTime?(result) : null); + } + + private async Task<bool> SalvarDocumento() + { + ViewModel.Loading(isLoading: true); + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(); + bool num = list == null || list.Count == 0; + ViewModel.Loading(isLoading: false); + if (num) + { + EditarVendedor(editar: false); + SetValid(AutoCompleteBanco, valid: true); + return true; + } + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + return false; + } + + private async void IncluirApolice_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.IncluirApolice(); + ViewModel.BotoesParcelaEnabled = false; + ViewModel.AllowEditEmissao = true; + ValidarDocumento(); + Restricao(insert: true); + ValidarTela(); + ((UIElement)IncluirpoliceButton).IsEnabled = false; + ((UIElement)AlterarApoliceButton).IsEnabled = false; + ((UIElement)ExcluirpoliceButton).IsEnabled = false; + AlterandoDocumento(alterando: true); + } + + private async void SalvarVendedor_Click(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + bool num = ViewModel.SelectedParcela == null || ((int)ViewModel.SelectedParcela.SubTipo == 1 && (int)ViewModel.SelectedDocumento.TipoRecebimento.GetValueOrDefault() == 1); + if (Recursos.Configuracoes.Any((ConfiguracaoSistema config) => (int)config.Configuracao == 56)) + { + ToggleButton coCorretagemToogle = CoCorretagemToogle; + if (coCorretagemToogle != null && coCorretagemToogle.IsChecked.GetValueOrDefault()) + { + VendedorParcela selectedPagamento = ViewModel.SelectedPagamento; + ToggleButton coCorretagemToogle2 = CoCorretagemToogle; + selectedPagamento.CoCorretagem = ((coCorretagemToogle2 != null) ? coCorretagemToogle2.IsChecked : null).GetValueOrDefault(true); + } + } + List<KeyValuePair<string, string>> list = ((!num) ? (await ViewModel.AdicionarVendedorParcelaEspecial()) : (await ViewModel.AdicionarVendedor())); + List<KeyValuePair<string, string>> list2 = list; + bool flag = list2 == null || list2.Count == 0; + ViewModel.Loading(isLoading: false); + if (flag) + { + EditarVendedor(editar: false); + EditandoVendedor(enable: false); + if (ViewModel.VerificaCoCorretagem()) + { + ((TextBoxBase)ComissaoBox).IsReadOnly = true; + ViewModel.ComissOriginalVisibility = (Visibility)0; + } + ViewModel.AllowEditParcela = flag; + } + else + { + ViewModel.AllowEditParcela = flag; + await ViewModel.ShowMessage(list2, ViewModel.ErroCamposInvalidos, "OK"); + } + } + + private void CancelarVendedor_Click(object sender, RoutedEventArgs e) + { + EditarVendedor(editar: false); + ViewModel.SelectedPagamento = null; + ViewModel.AllowEditParcela = true; + EditandoVendedor(enable: false); + } + + private void EditarVendedor(bool editar) + { + //IL_015f: Unknown result type (might be due to invalid IL or missing references) + //IL_0165: Invalid comparison between Unknown and I4 + //IL_010a: Unknown result type (might be due to invalid IL or missing references) + //IL_0110: Invalid comparison between Unknown and I4 + //IL_013f: Unknown result type (might be due to invalid IL or missing references) + //IL_0145: Invalid comparison between Unknown and I4 + ((UIElement)SalvarVendedorButton).Visibility = (Visibility)((!editar) ? 2 : 0); + ((UIElement)CancelarVendedorButton).Visibility = (Visibility)((!editar) ? 2 : 0); + ((UIElement)EditarVendedorButton).Visibility = (Visibility)(editar ? 2 : 0); + ((UIElement)EditarVendedorFields).Visibility = (Visibility)((!editar) ? 2 : 0); + ((UIElement)VendedorGrid).IsEnabled = !editar; + if (editar && Recursos.Configuracoes.Any((ConfiguracaoSistema config) => (int)config.Configuracao == 56)) + { + bool isEnabled = ViewModel.Pagamentos.Count == 1 && ViewModel.Pagamentos.Any((VendedorParcela vendedor) => vendedor.Repasse == null) && !IsFatura(); + ((UIElement)CoCorretagemToogle).IsEnabled = isEnabled; + } + bool flag = (ViewModel.SelectedDocumento.NegocioCorretora.HasValue ? ((int)ViewModel.SelectedDocumento.NegocioCorretora.GetValueOrDefault() == 1) : ((int)ViewModel.SelectedDocumento.Situacao == 2 && ViewModel.SelectedDocumento.Negocio.HasValue && (int)ViewModel.SelectedDocumento.Negocio.GetValueOrDefault() == 1)); + ((UIElement)ComissaoNovoBox).Visibility = (Visibility)((!editar || flag) ? 2 : 0); + ((UIElement)ComissaoRenovacaoBox).Visibility = (Visibility)((!(editar && flag)) ? 2 : 0); + CoCorretagemToogle.IsChecked = false; + } + + private async void IncluirVendedor_Click(object sender, RoutedEventArgs e) + { + ViewModel.AllowEditParcela = false; + List<KeyValuePair<string, string>> list = ViewModel.HabilitarVendedor(EditarParcelaTipo); + if (list != null && list.Count != 0) + { + ((DependencyObject)(object)this).ValidateFields(list); + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + return; + } + ViewModel.IncluirVendedor(); + EditarVendedor(editar: true); + ValidarVendedor(); + EditandoVendedor(enable: true); + ViewModel.VendedorCoCorretagem(); + } + + public void EditandoVendedor(bool enable) + { + PermissaoUsuario val = ViewModel.ServicoPermissUsuario.BuscarPermissao(Recursos.Usuario, (TipoTela)2); + ((UIElement)IncluirpoliceButton).IsEnabled = (val == null || val.Incluir) && !enable; + ((UIElement)AlterarApoliceButton).IsEnabled = (val == null || val.Alterar) && !enable; + ((UIElement)ExcluirpoliceButton).IsEnabled = (val == null || val.Excluir) && !enable; + } + + public void EditandoParcela(bool enable) + { + PermissaoUsuario val = ViewModel.ServicoPermissUsuario.BuscarPermissao(Recursos.Usuario, (TipoTela)2); + ViewModel.AllowEditVendedor = (val == null || val.Incluir) && !enable; + } + + private void TipoVendedorBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_003e: Unknown result type (might be due to invalid IL or missing references) + //IL_0048: Expected O, but got Unknown + //IL_0023: Unknown result type (might be due to invalid IL or missing references) + //IL_002d: Expected O, but got Unknown + ComboBox val = (ComboBox)sender; + if (((Selector)val).SelectedItem != null) + { + if (ViewModel.SelectedPagamento == null) + { + ViewModel.SelectedPagamento = new VendedorParcela(); + } + ViewModel.SelectedPagamento.TipoVendedor = (TipoVendedor)((Selector)val).SelectedItem; + } + } + + private void TipoRecebimentoBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Invalid comparison between Unknown and I4 + ComboBox val = (ComboBox)sender; + if (((Selector)val).SelectedItem != null) + { + ViewModel.IsFatura = (int)(TipoRecebimento)((Selector)val).SelectedItem == 2; + Parcelas(!ViewModel.IsFatura); + if (ViewModel.EnableFields) + { + ((Selector)FormaPagamentoBox).SelectedItem = (ViewModel.IsFatura ? new FormaPagamento?((FormaPagamento)5) : ViewModel.SelectedDocumento.FormaPagamento); + } + } + } + + private void Parcelas(bool premios) + { + ViewModel.AllowEditVendedor = ((DomainBase)ViewModel.SelectedDocumento).Id == 0; + ((UIElement)PremiosBox).Visibility = (Visibility)((!premios) ? 2 : 0); + ((DataGridColumn)FaturaColumn).Visibility = (Visibility)((!ViewModel.IsFatura) ? 2 : 0); + ((DataGridColumn)VigenciaInicialColumn).Visibility = (Visibility)((!ViewModel.IsFatura) ? 2 : 0); + ((DataGridColumn)VigenciaFinalColumn).Visibility = (Visibility)((!ViewModel.IsFatura) ? 2 : 0); + ValidarDocumento(); + if (!premios) + { + ParcelasBox.Number = 0m; + ComissaoBox.Number = 0m; + PremioLiquidoBox.Number = 0m; + PremioTotalBox.Number = 0m; + IofBox.Number = 0m; + DiferencaBox.Number = 0m; + PremioAdicionalBox.Number = 0m; + ((Selector)FormaPagamentoBox).SelectedItem = (object)(FormaPagamento)4; + Vigencia2Box.SelectedDate = ((((DomainBase)ViewModel.SelectedDocumento).Id == 0L && ViewModel.SelectedDocumento.Tipo == 0) ? null : Vigencia2Box.SelectedDate); + ViewModel.AllowEditVendedor = ((DomainBase)ViewModel.SelectedDocumento).Id != 0; + } + } + + private async void ParcelaGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + DataGrid val = (DataGrid)sender; + if (val == null || ((Selector)val).SelectedIndex >= 0) + { + await ViewModel.SelecionaParcela((Parcela)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null)); + } + } + + private void SituacaoBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Unknown result type (might be due to invalid IL or missing references) + ComboBox val = (ComboBox)sender; + if (((Selector)val).SelectedItem != null) + { + TipoSeguro situacao = (TipoSeguro)((Selector)val).SelectedItem; + ViewModel.ToggleSeguradoraAnterior(situacao); + } + } + + private void Recalcula(object sender, RoutedEventArgs e) + { + ViewModel.RecalculaRepasse(); + } + + private void AlteracaoParcela_LostFocus(object sender, RoutedEventArgs e) + { + ValidarDocumento(); + } + + private void AlteracaoDePremio_LostFocus(object sender, RoutedEventArgs e) + { + //IL_001d: Unknown result type (might be due to invalid IL or missing references) + //IL_0023: Expected O, but got Unknown + if (!ViewModel.AllowEditApolice || ViewModel.SelectedDocumento == null) + { + return; + } + CurrencyTextBox val = (CurrencyTextBox)sender; + if (val == null) + { + return; + } + string name = ((FrameworkElement)val).Name; + if ((name == "PremioLiquidoBox" || name == "PremioAdicionalBox") && IofBox.Number == 0m) + { + decimal num = PremioLiquidoBox.Number + PremioAdicionalBox.Number; + Ramo ramo = ViewModel.SelectedDocumento.Controle.Ramo; + decimal num2 = num * ((ramo != null) ? ramo.Iof : 0m); + IofBox.Number = num2; + CurrencyTextBox premioTotalBox = PremioTotalBox; + premioTotalBox.Number += num2; + } + PremioTotalBox.Number = PremioLiquidoBox.Number + PremioAdicionalBox.Number + IofBox.Number + DiferencaBox.Number; + switch (((FrameworkElement)val).Name) + { + case "PremioLiquidoBox": + case "PremioAdicionalBox": + case "ComissaoBox": + if (ViewModel.HabilitarVendedor().Count == 0) + { + ViewModel.RecalculaRepasses(); + } + break; + } + ValidarDocumento(); + } + + private void CancelarParcela_Click(object sender, RoutedEventArgs e) + { + ToggleBotoesParcela(habilitar: false); + ViewModel.BaixarParcelas = false; + ViewModel.CancelPagamento(); + ValidarDocumento(); + EditarVendedor(editar: false); + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: true); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: true); + EditandoParcela(enable: false); + } + + private bool IsFatura() + { + //IL_0013: Unknown result type (might be due to invalid IL or missing references) + //IL_0019: Invalid comparison between Unknown and I4 + return (int)ViewModel.SelectedDocumento.TipoRecebimento.GetValueOrDefault() == 2; + } + + private void Vigencia_DatePicker_OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) + { + //IL_0009: Unknown result type (might be due to invalid IL or missing references) + //IL_000f: Expected O, but got Unknown + DatePicker_OnLostKeyboardFocus(sender, e); + DatePicker val = (DatePicker)sender; + if (!string.IsNullOrEmpty(val.Text) && DateTime.TryParse(ValidationHelper.FormatDate(val.Text), out var result)) + { + VigenciaFinalParcelaBox.SelectedDate = result.AddMonths(1); + EmissaoParcelaBox.SelectedDate = result; + } + } + + private void Vencimento_OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) + { + //IL_0009: Unknown result type (might be due to invalid IL or missing references) + //IL_000f: Expected O, but got Unknown + DatePicker_OnLostKeyboardFocus(sender, e); + DatePicker val = (DatePicker)sender; + if (!string.IsNullOrEmpty(val.Text) && DateTime.TryParse(ValidationHelper.FormatDate(val.Text), out var result)) + { + CreditoParcelaBox.SelectedDate = result; + } + } + + private void ToggleBotoesParcela(bool habilitar) + { + ((UIElement)SalvarParcelaButton).Visibility = (Visibility)((!habilitar) ? 2 : 0); + ViewModel.EditandoParcela = habilitar; + ((UIElement)BaixarParcelaButton).Visibility = (Visibility)(habilitar ? 2 : 0); + ((UIElement)MenuApolice).IsEnabled = !habilitar; + ViewModel.IsEnabled = !habilitar; + ((UIElement)PremiosBox).IsEnabled = !habilitar; + ((UIElement)DataControleParcelaField).Visibility = (Visibility)2; + if (!habilitar) + { + ((UIElement)QuantidadeFaturaField).Visibility = (Visibility)2; + ((UIElement)TipoParcelaField).Visibility = (Visibility)2; + ((UIElement)VencimentoField).Visibility = (Visibility)2; + ((UIElement)ValorField).Visibility = (Visibility)2; + ((UIElement)RecebimentoField).Visibility = (Visibility)2; + ((UIElement)QuitacaoField).Visibility = (Visibility)2; + ((UIElement)CreditoField).Visibility = (Visibility)2; + ((UIElement)ValorRealizadoField).Visibility = (Visibility)2; + ((UIElement)ValorComissaoField).Visibility = (Visibility)2; + ((UIElement)PercentualComissaoField).Visibility = (Visibility)2; + ((UIElement)ComissaoIcon).Visibility = (Visibility)2; + ((UIElement)EmissaoField).Visibility = (Visibility)2; + ((UIElement)ValorLiquidoField).Visibility = (Visibility)2; + ((UIElement)FaturaField).Visibility = (Visibility)2; + ((UIElement)VigenciaInicialField).Visibility = (Visibility)2; + ((UIElement)VigenciaFinalField).Visibility = (Visibility)2; + ((UIElement)EditarParcelasFields).Visibility = (Visibility)2; + ((UIElement)ImpostosField).Visibility = (Visibility)2; + ((UIElement)ParcelaGrid).IsEnabled = true; + } + } + + private async void IncluirNovaFatura_Click(object sender, RoutedEventArgs e) + { + ViewModel.QuantidadeFaturas = 1; + bool flag = IsFatura(); + if (flag && ViewModel.SelectedDocumento.Ordem > 0) + { + await ViewModel.ShowMessage("NÃO É POSSÍVEL ADICIONAR FATURAS AO ENDOSSO, TODAS AS FATURAS DEVEM SER ADICIONADAS SOBRE A APÓLICE."); + return; + } + ToggleBotoesParcela(habilitar: true); + EditarParcelaTipo = 3; + ViewModel.QuantidadeFaturas = 1; + NovaFatura(); + ViewModel.AllowEditVendedor = flag; + ViewModel.BaixarParcelas = true; + ViewModel.VisibilityAlterarVencimento = (Visibility)0; + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: false); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: false); + } + + private void IncluirParcelaEspecial_Click(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Expected O, but got Unknown + //IL_0071: Unknown result type (might be due to invalid IL or missing references) + //IL_007d: Unknown result type (might be due to invalid IL or missing references) + //IL_0087: Expected O, but got Unknown + ((MenuItem)sender).Click -= new RoutedEventHandler(IncluirParcelaEspecial_Click); + ViewModel.QuantidadeFaturas = 1; + ToggleBotoesParcela(habilitar: true); + EditarParcelaTipo = 4; + NovaParcelaEspecial(); + ViewModel.EditarParcelaEspecial(); + ViewModel.BaixarParcelas = true; + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: false); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: false); + ((MenuItem)sender).Click += new RoutedEventHandler(IncluirParcelaEspecial_Click); + EditandoParcela(enable: true); + } + + private void NovaParcelaEspecial() + { + //IL_0055: Unknown result type (might be due to invalid IL or missing references) + //IL_005b: Invalid comparison between Unknown and I4 + ((UIElement)FaturaField).Visibility = (Visibility)2; + ((UIElement)VigenciaInicialField).Visibility = (Visibility)2; + ((UIElement)VigenciaFinalField).Visibility = (Visibility)2; + ((UIElement)EmissaoField).Visibility = (Visibility)2; + ((UIElement)ValorLiquidoField).Visibility = (Visibility)2; + ((UIElement)QuantidadeFaturaField).Visibility = (Visibility)(((int)ViewModel.SelectedDocumento.TipoRecebimento.GetValueOrDefault() != 2) ? 2 : 0); + ((UIElement)TipoParcelaField).Visibility = (Visibility)0; + ((UIElement)VencimentoField).Visibility = (Visibility)0; + ((UIElement)ValorField).Visibility = (Visibility)0; + ((UIElement)RecebimentoField).Visibility = (Visibility)0; + ((UIElement)QuitacaoField).Visibility = (Visibility)0; + ((UIElement)CreditoField).Visibility = (Visibility)0; + ((UIElement)ValorRealizadoField).Visibility = (Visibility)0; + ((UIElement)ValorComissaoField).Visibility = (Visibility)0; + ((UIElement)PercentualComissaoField).Visibility = (Visibility)0; + ((UIElement)ComissaoIcon).Visibility = (Visibility)0; + ((UIElement)EditarParcelasFields).Visibility = (Visibility)0; + ((UIElement)ParcelaGrid).IsEnabled = false; + if (Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 5)) + { + ((UIElement)ImpostosField).Visibility = (Visibility)0; + } + ViewModel.IncluirParcelaEspecial(); + ValidarParcela(); + ((UIElement)ValorParcelaBox).Focus(); + } + + private void NovaFatura() + { + ((UIElement)VigenciaInicialField).Visibility = (Visibility)0; + ((UIElement)VigenciaFinalField).Visibility = (Visibility)0; + ((UIElement)EmissaoField).Visibility = (Visibility)0; + ((UIElement)ValorLiquidoField).Visibility = (Visibility)0; + ((UIElement)QuantidadeFaturaField).Visibility = (Visibility)0; + ((UIElement)RecebimentoField).Visibility = (Visibility)0; + ((UIElement)QuitacaoField).Visibility = (Visibility)0; + ((UIElement)DataControleParcelaField).Visibility = (Visibility)0; + ((UIElement)CreditoField).Visibility = (Visibility)0; + ((UIElement)ValorRealizadoField).Visibility = (Visibility)0; + ((UIElement)ValorComissaoField).Visibility = (Visibility)0; + ((UIElement)VencimentoField).Visibility = (Visibility)0; + ((UIElement)ValorField).Visibility = (Visibility)0; + ((UIElement)TipoParcelaField).Visibility = (Visibility)2; + ((UIElement)PercentualComissaoField).Visibility = (Visibility)0; + ((UIElement)ComissaoIcon).Visibility = (Visibility)0; + ((UIElement)FaturaField).Visibility = (Visibility)0; + ((UIElement)EditarParcelasFields).Visibility = (Visibility)0; + ((UIElement)ParcelaGrid).IsEnabled = false; + if (ViewModel.Restricao((TipoRestricao)15)) + { + ((UIElement)RecebimentoField).Visibility = (Visibility)2; + ((UIElement)QuitacaoField).Visibility = (Visibility)2; + ((UIElement)CreditoField).Visibility = (Visibility)2; + ((UIElement)ValorRealizadoField).Visibility = (Visibility)2; + ((UIElement)ValorComissaoField).Visibility = (Visibility)2; + } + ViewModel.IncluirFatura(); + ValidarParcela(); + ((UIElement)QuantidadeFaturaBox).Focus(); + EditandoParcela(enable: true); + } + + private void ReplicarFatura() + { + ((UIElement)VigenciaInicialField).Visibility = (Visibility)0; + ((UIElement)VigenciaFinalField).Visibility = (Visibility)0; + ((UIElement)EmissaoField).Visibility = (Visibility)0; + ((UIElement)ValorLiquidoField).Visibility = (Visibility)0; + ((UIElement)QuantidadeFaturaField).Visibility = (Visibility)0; + ((UIElement)RecebimentoField).Visibility = (Visibility)0; + ((UIElement)QuitacaoField).Visibility = (Visibility)0; + ((UIElement)DataControleParcelaField).Visibility = (Visibility)0; + ((UIElement)CreditoField).Visibility = (Visibility)0; + ((UIElement)ValorRealizadoField).Visibility = (Visibility)0; + ((UIElement)ValorComissaoField).Visibility = (Visibility)0; + ((UIElement)VencimentoField).Visibility = (Visibility)0; + ((UIElement)ValorField).Visibility = (Visibility)0; + ((UIElement)TipoParcelaField).Visibility = (Visibility)2; + ((UIElement)PercentualComissaoField).Visibility = (Visibility)0; + ((UIElement)ComissaoIcon).Visibility = (Visibility)0; + ((UIElement)FaturaField).Visibility = (Visibility)0; + if (!ViewModel.Restricao((TipoRestricao)15)) + { + ViewModel.BaixarParcelas = true; + if (Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 5)) + { + ((UIElement)ImpostosField).Visibility = (Visibility)0; + } + } + if (((IEnumerable<Parcela>)ViewModel.Parcelas.OrderBy((Parcela x) => x.NumeroParcela)).LastOrDefault((Func<Parcela, bool>)((Parcela x) => (int)x.SubTipo == 1)).NumeroParcela != 999) + { + ((UIElement)EditarParcelasFields).Visibility = (Visibility)0; + ((UIElement)ParcelaGrid).IsEnabled = false; + } + ViewModel.ReplicarFatura(); + ValidarParcela(); + ((UIElement)QuantidadeFaturaBox).Focus(); + } + + private void AutoCompleteBancoBox_Populating(object sender, PopulatingEventArgs e) + { + if (e.Parameter.Length < 3) + { + return; + } + e.Cancel = true; + ViewModel.BuscarBanco(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Banco>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void Endossar() + { + ViewModel.AlteracaoEnabled = false; + ViewModel.Situacao.Add((TipoSeguro)3); + ValidarDocumento(); + } + + private void TipoEndossoBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0021: Unknown result type (might be due to invalid IL or missing references) + //IL_0027: Expected O, but got Unknown + //IL_0043: Unknown result type (might be due to invalid IL or missing references) + //IL_0049: Invalid comparison between Unknown and I4 + //IL_0068: Unknown result type (might be due to invalid IL or missing references) + //IL_0075: Unknown result type (might be due to invalid IL or missing references) + //IL_007b: Invalid comparison between Unknown and I4 + if (ViewModel.SelectedDocumento != null && ViewModel.SelectedDocumento.Tipo == 0) + { + return; + } + ComboBox val = (ComboBox)sender; + if (((Selector)val).SelectedItem == null) + { + return; + } + bool premios = !ViewModel.IsFatura && (int)(TipoEndosso)((Selector)val).SelectedItem != 1; + if (ViewModel.EnableFields) + { + if ((int)(TipoEndosso)((Selector)val).SelectedItem == 0 || (int)(TipoEndosso)((Selector)val).SelectedItem == 4) + { + if (ViewModel.SelectedDocumento != null) + { + Documento selectedDocumento = ViewModel.SelectedDocumento; + Documento cancelDocumento = ViewModel.CancelDocumento; + selectedDocumento.Comissao = ((cancelDocumento != null) ? cancelDocumento.Comissao : 0m); + } + } + else if (ViewModel.SelectedDocumento != null) + { + ViewModel.SelectedDocumento.Comissao = 0m; + } + ViewModel.OnPropertyChanged("SelectedDocumento"); + } + Parcelas(premios); + } + + private void VendedorBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0026: Expected O, but got Unknown + ComboBox val = (ComboBox)sender; + if (((Selector)val).SelectedItem != null) + { + ViewModel.FiltrarRepasse((Vendedor)((Selector)val).SelectedItem); + if (ViewModel.CoCorretagem) + { + ((UIElement)ComissaoNovoBox).Visibility = (Visibility)0; + ((UIElement)ComissaoRenovacaoBox).Visibility = (Visibility)2; + } + } + } + + private void ComissaoVendedorBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_001c: Expected O, but got Unknown + //IL_0028: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Invalid comparison between Unknown and I4 + //IL_00f2: Unknown result type (might be due to invalid IL or missing references) + //IL_00f8: Invalid comparison between Unknown and I4 + //IL_009a: Unknown result type (might be due to invalid IL or missing references) + //IL_00a0: Invalid comparison between Unknown and I4 + //IL_00d1: Unknown result type (might be due to invalid IL or missing references) + //IL_00d7: Invalid comparison between Unknown and I4 + //IL_0145: Unknown result type (might be due to invalid IL or missing references) + //IL_014a: Unknown result type (might be due to invalid IL or missing references) + //IL_0156: Expected O, but got Unknown + //IL_01a0: Unknown result type (might be due to invalid IL or missing references) + //IL_01a6: Invalid comparison between Unknown and I4 + ComboBox val = (ComboBox)sender; + if (((Selector)val).SelectedItem == null) + { + return; + } + Repasse val2 = (Repasse)((Selector)val).SelectedItem; + if (val2 != null && (int)val2.Tipo.GetValueOrDefault() == 3) + { + ViewModel.SelectedPagamento.ValorRepasse = 0.00m; + ValorRepasseBox.Number = ViewModel.SelectedPagamento.ValorRepasse.Value; + return; + } + bool flag = (ViewModel.SelectedDocumento.NegocioCorretora.HasValue ? ((int)ViewModel.SelectedDocumento.NegocioCorretora.GetValueOrDefault() == 1) : ((int)ViewModel.SelectedDocumento.Situacao == 2 && ViewModel.SelectedDocumento.Negocio.HasValue && (int)ViewModel.SelectedDocumento.Negocio.GetValueOrDefault() == 1)); + ViewModel.SelectedPagamento.Repasse = val2; + ViewModel.SelectedPagamento.PorcentagemRepasse = (flag ? val2.ValorRenovacao : val2.ValorNovo); + if (ViewModel.SelectedParcela == null) + { + ViewModel.SelectedParcela = new Parcela + { + SubTipo = (SubTipo)1 + }; + } + ViewModel.SelectedParcela.Documento = ViewModel.SelectedDocumento; + ViewModel.SelectedPagamento.ValorRepasse = Funcoes.CalculaRepasse(val2, ViewModel.SelectedParcela, ViewModel.SelectedParcela == null || (int)ViewModel.SelectedParcela.SubTipo == 1); + ViewModel.SelectedPagamento.ValorTotal = ViewModel.SelectedPagamento.ValorRepasse; + ValorRepasseBox.Number = ViewModel.SelectedPagamento.ValorRepasse.Value; + FormaRecebidaBox.Text = ValidationHelper.GetDescription((Enum)(object)val2.Forma); + FormaIncidenciaBox.Text = ValidationHelper.GetDescription((Enum)(object)val2.Incidencia); + } + + private void ValidacaoDocumento(object sender, RoutedEventArgs e) + { + ValidarDocumento(); + } + + private void ValidarDocumento() + { + if (ViewModel.SelectedDocumento != null) + { + List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedDocumento.Validate(ViewModel.IsEndosso, Recursos.Configuracoes.Any((ConfiguracaoSistema c) => (int)c.Configuracao == 11)); + ((DependencyObject)(object)this).ValidateFields(errorMessages, focusField: false); + } + } + + private void ValidacaoParcela(object sender, RoutedEventArgs e) + { + ValidarParcela(); + } + + private void ValidarParcela() + { + if (ViewModel.SelectedParcela != null) + { + if (ViewModel.SelectedParcela.Documento == null) + { + ViewModel.SelectedParcela.Documento = ViewModel.SelectedDocumento; + } + ViewModel.SelectedParcela.Documento.Parcelas = ViewModel.Parcelas; + List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedParcela.Validate(Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 9), Recursos.Configuracoes.Any((ConfiguracaoSistema y) => (int)y.Configuracao == 11), ViewModel.EditandoParcela, Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 16)); + ((DependencyObject)(object)this).ValidateFields(errorMessages, focusField: false); + } + } + + private void ValidarVendedor() + { + if (ViewModel.SelectedPagamento != null) + { + List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedPagamento.Validate(); + ((DependencyObject)(object)this).ValidateFields(errorMessages, focusField: false); + } + } + + private void ValorRealizadoParcelaBox_OnLostFocus(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + CurrencyTextBox val = (CurrencyTextBox)sender; + if (val != null && val.Number != 0m && ViewModel.SelectedParcela != null) + { + decimal number = val.Number; + decimal num = ViewModel.SelectedParcela.Comissao * 0.01m; + ValorComissaoParcelaBox.Number = number * num; + } + } + + private void LostFocusValorRealizado() + { + if (!(ValorRealizadoParcelaBox.Number == 0m) && ViewModel.SelectedParcela != null && ((UIElement)ValorRealizadoParcelaBox).IsFocused) + { + decimal number = ValorRealizadoParcelaBox.Number; + decimal num = ViewModel.SelectedParcela.Comissao * 0.01m; + ValorComissaoParcelaBox.Number = number * num; + } + } + + private void Restricao(bool insert = false) + { + //IL_00c8: Unknown result type (might be due to invalid IL or missing references) + //IL_00e0: Unknown result type (might be due to invalid IL or missing references) + //IL_00f2: Unknown result type (might be due to invalid IL or missing references) + //IL_0104: Unknown result type (might be due to invalid IL or missing references) + //IL_0116: Unknown result type (might be due to invalid IL or missing references) + //IL_0128: Unknown result type (might be due to invalid IL or missing references) + //IL_013a: Unknown result type (might be due to invalid IL or missing references) + //IL_014e: Unknown result type (might be due to invalid IL or missing references) + //IL_0163: Unknown result type (might be due to invalid IL or missing references) + //IL_016f: Unknown result type (might be due to invalid IL or missing references) + //IL_017b: Unknown result type (might be due to invalid IL or missing references) + //IL_018a: Unknown result type (might be due to invalid IL or missing references) + bool flag = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 5); + if (insert) + { + ((UIElement)Comissao).Visibility = (Visibility)0; + ((UIElement)Gerada).Visibility = (Visibility)0; + ((UIElement)Recebida).Visibility = (Visibility)0; + ((UIElement)Pendente).Visibility = (Visibility)0; + ((UIElement)Repasse).Visibility = (Visibility)0; + ((DataGridColumn)ParcelasComissaoColumn).Visibility = (Visibility)0; + ((DataGridColumn)ParcelasValorComissaoColumn).Visibility = (Visibility)(flag ? 2 : 0); + ((DataGridColumn)ParcelasValorComissaoDescColumn).Visibility = (Visibility)((!flag) ? 2 : 0); + ((DataGridColumn)PagamentosPorcentagemRepasseColumn).Visibility = (Visibility)0; + ((DataGridColumn)PagamentosValorRepasseColumn).Visibility = (Visibility)0; + } + else + { + Visibility val = (Visibility)(ViewModel.Restricao((TipoRestricao)14) ? 2 : 0); + bool flag2 = ViewModel.Restricao((TipoRestricao)95); + ((UIElement)Comissao).Visibility = (Visibility)((!flag2) ? ((int)val) : 0); + ((UIElement)Gerada).Visibility = (Visibility)(flag2 ? 2 : ((int)val)); + ((UIElement)Recebida).Visibility = (Visibility)(flag2 ? 2 : ((int)val)); + ((UIElement)Pendente).Visibility = (Visibility)(flag2 ? 2 : ((int)val)); + ((UIElement)Repasse).Visibility = (Visibility)(flag2 ? 2 : ((int)val)); + ((DataGridColumn)ParcelasComissaoColumn).Visibility = (Visibility)((!flag2) ? ((int)val) : 0); + ((DataGridColumn)ParcelasValorComissaoColumn).Visibility = (Visibility)((flag || flag2) ? 2 : ((int)val)); + ((DataGridColumn)ParcelasValorComissaoDescColumn).Visibility = (Visibility)((!flag) ? 2 : ((int)val)); + ((DataGridColumn)MaisInformacoesColumn).Visibility = val; + ((DataGridColumn)PagamentosPorcentagemRepasseColumn).Visibility = val; + ((DataGridColumn)PagamentosValorRepasseColumn).Visibility = (Visibility)(flag2 ? 2 : ((int)val)); + } + } + + private void AdicionalBox_OnChecked(object sender, RoutedEventArgs e) + { + //IL_0015: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Expected O, but got Unknown + if (ViewModel.SelectedDocumento != null) + { + AlteracaoDePremio_LostFocus(PremioAdicionalBox, new RoutedEventArgs()); + } + } + + private async void Button_Click(object sender, RoutedEventArgs e) + { + bool num = ViewModel.Restricao((TipoRestricao)97); + if (!num) + { + Documento documento = ViewModel.AbrirDetalhes(); + ViewModel.ShowDrawer(new ValoresApoliceDrawer(documento), 0); + } + if (num) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR MAIS INFORMAÇÕES."); + } + } + + private void ReplicarFatura_Click(object sender, RoutedEventArgs e) + { + ViewModel.QuantidadeFaturas = 1; + ToggleBotoesParcela(habilitar: true); + EditarParcelaTipo = 3; + ReplicarFatura(); + ViewModel.QuantidadeFaturas = 1; + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: false); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: false); + } + + private async void Alterar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.UpdatePremio = false; + Restricao(); + ViewModel.EnableControle = Recursos.Configuracoes.All((ConfiguracaoSistema x) => (int)x.Configuracao != 34) || ViewModel.Repasses.All((VendedorParcela x) => !x.DataPagamento.HasValue); + ViewModel.CoCorretagem = ViewModel.Repasses.Any(delegate(VendedorParcela x) + { + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + //IL_001a: Invalid comparison between Unknown and I4 + Repasse repasse = x.Repasse; + return repasse != null && (int)repasse.Tipo.GetValueOrDefault() == 3; + }); + ViewModel.VerificaCoCorretagem(); + await ViewModel.Alteracao(alterar: true); + ViewModel.Alterar(alterar: true); + ValidarTela(); + AlterandoDocumento(alterando: true); + ((UIElement)ExcluirpoliceButton).IsEnabled = false; + ((UIElement)IncluirpoliceButton).IsEnabled = false; + ((UIElement)AlterarApoliceButton).IsEnabled = false; + ViewModel.Inclusao = false; + } + + private void ValorParcelaBox_OnLostFocus(object sender, RoutedEventArgs e) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0015: Expected O, but got Unknown + if (!ViewModel.IsFatura) + { + return; + } + CurrencyTextBox val = (CurrencyTextBox)sender; + if (!(ValorParcelaBox.Number > 0m)) + { + decimal obj; + if (!Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 46)) + { + obj = 0m; + } + else + { + Ramo ramo = ViewModel.SelectedDocumento.Controle.Ramo; + obj = ((ramo != null) ? ramo.Iof : 0m); + } + decimal num = obj + 1m; + ValorParcelaBox.Number = val.Number * num; + ((UIElement)ValorParcelaBox).Focus(); + } + } + + private void ValoresParcelaInfo_OnClick(object sender, RoutedEventArgs e) + { + Parcela parcela = ViewModel.AbrirDetalhesParcela(); + ViewModel.ShowDrawer(new ValoresParcelaDrawer(parcela, ViewModel.SelectedDocumento), 0); + } + + private void ManutecaoItens_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.ManutecaoItens(); + } + + private void VencimentoCartaoBox_OnTextChanged(object sender, TextChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0013: Expected O, but got Unknown + int num = ((TextBox)sender).CaretIndex; + TextBox val = (TextBox)sender; + if (val.Text.Contains("/") && new Regex("/").Match(val.Text).Index < num) + { + num--; + } + string text = val.Text.Replace("/", ""); + string text2 = text.Substring(0, (text.Length > 4) ? 4 : text.Length); + if (new Regex("^0").IsMatch(text2)) + { + if (new Regex("^00").IsMatch(text2)) + { + val.Text = _vencimentoCartaoOld; + val.CaretIndex = num; + return; + } + } + else if (new Regex("^1").IsMatch(text2)) + { + if (new Regex("^1[^0-2]").IsMatch(text2)) + { + val.Text = _vencimentoCartaoOld; + val.CaretIndex = num; + return; + } + } + else if (new Regex("^[^01]").IsMatch(text2)) + { + val.Text = _vencimentoCartaoOld; + val.CaretIndex = num; + return; + } + if (text2.Length > 2) + { + val.Text = text2.Insert(2, "/"); + num++; + } + else if (val.Text.Contains("/")) + { + val.Text = text2; + } + val.CaretIndex = num; + _vencimentoCartaoOld = text2; + } + + private void VencimentoCartaoBox_OnGotFocus(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + string text = ((TextBox)sender).Text.Replace("/", ""); + _vencimentoCartaoOld = text.Substring(0, (text.Length > 4) ? 4 : text.Length); + } + + private async void AbrirPerfil_OnClick(object sender, RoutedEventArgs e) + { + if (await ViewModel.VerificarPermissao((TipoTela)32)) + { + if (((DomainBase)ViewModel.SelectedDocumento.Controle.Ramo).Id == 5) + { + ((Window)new HosterWindow((ContentControl)(object)new PerfilView(ViewModel.SelectedDocumento.Controle), "PERFIL", 900.0, 500.0)).ShowDialog(); + } + else + { + ((Window)new HosterWindow((ContentControl)(object)new PerfilEmpresaView(ViewModel.SelectedDocumento.Controle), "QUESTIONÁRIO EMPRESA", 900.0, 500.0)).ShowDialog(); + } + ViewModel.Alterar(alterar: false); + } + } + + private void NegocioCorretoraBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + //IL_002a: Unknown result type (might be due to invalid IL or missing references) + //IL_0034: Expected O, but got Unknown + //IL_003a: Unknown result type (might be due to invalid IL or missing references) + //IL_0050: Unknown result type (might be due to invalid IL or missing references) + if (!ViewModel.EnableFields) + { + return; + } + ComboBox val = (ComboBox)sender; + if ((((int)val != 0) ? ((Selector)val).SelectedItem : null) != null) + { + AlteracaoDePremio_LostFocus(PremioLiquidoBox, new RoutedEventArgs()); + if ((int)((UIElement)SalvarVendedorButton).Visibility == 0) + { + EditarVendedor(editar: true); + ComissaoVendedorBox_OnSelectionChanged(((int)((UIElement)ComissaoNovoBox).Visibility == 0) ? ComissaoNovoComboBox : ComissaoRenovacaoComboBox, e); + } + } + } + + private void AbrirLog_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.SelectedDocumento != null && ((DomainBase)ViewModel.SelectedDocumento).Id != 0L) + { + ViewModel.AbrirLog((TipoTela)2, ((DomainBase)ViewModel.SelectedDocumento).Id); + } + } + + private async void AbrirLogParcelas_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.SelectedDocumento == null) + { + return; + } + ApoliceViewModel viewModel = ViewModel; + if (viewModel != null && viewModel.Parcelas.Count > 0) + { + List<long> listaParcelas = new List<long>(); + ViewModel.Parcelas.ToList().ForEach(delegate(Parcela x) + { + listaParcelas.Add(((DomainBase)x).Id); + }); + ViewModel.AbrirLogParcela(listaParcelas, ((DomainBase)ViewModel.SelectedDocumento).Id); + } + } + + private void AbrirLogParcelaSelecionada_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.SelectedParcela != null && ((DomainBase)ViewModel.SelectedParcela).Id != 0L) + { + List<long> parcelas = new List<long> { ((DomainBase)ViewModel.SelectedParcela).Id }; + if (ViewModel.SelectedDocumento != null && ((DomainBase)ViewModel.SelectedDocumento).Id != 0L) + { + ViewModel.AbrirLogParcela(parcelas, ((DomainBase)ViewModel.SelectedDocumento).Id, ViewModel.SelectedParcela.NumeroParcela); + } + } + } + + private void AbrirLogVendedor_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.SelectedParcela != null && ((DomainBase)ViewModel.SelectedParcela).Id != 0L) + { + ViewModel.AbrirLog((TipoTela)37, ((DomainBase)ViewModel.SelectedParcela).Id); + } + } + + private void AbrirLogEmail_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.SelectedDocumento != null && ((DomainBase)ViewModel.SelectedDocumento).Id != 0L) + { + ViewModel.AbrirLogEmail((TipoTela)2, ((DomainBase)ViewModel.SelectedDocumento).Id); + } + } + + private void AbrirLogEmailPF_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.SelectedParcela != null && ((DomainBase)ViewModel.SelectedParcela).Id != 0L) + { + ViewModel.AbrirLogEmail((TipoTela)5, ((DomainBase)ViewModel.SelectedParcela).Id); + } + } + + private void AbrirLogTrocaCliente_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.SelectedDocumento != null && ((DomainBase)ViewModel.SelectedDocumento).Id != 0L) + { + ViewModel.AbrirLog((TipoTela)41, ((DomainBase)ViewModel.SelectedDocumento).Id); + } + } + + private void Importacao_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.SelectedDocumento != null && ((DomainBase)ViewModel.SelectedDocumento).Id != 0L) + { + AbrirImportacao(); + } + } + + private async void AbrirImportacao() + { + await ViewModel.Importacao(); + ((ToolTip)((FrameworkElement)ButtonImportado).ToolTip).PlacementTarget = (UIElement)(object)ButtonImportado; + ((ToolTip)((FrameworkElement)ButtonImportado).ToolTip).Placement = (PlacementMode)3; + ((ToolTip)((FrameworkElement)ButtonImportado).ToolTip).IsOpen = true; + await Task.Run(async delegate + { + await Task.Delay(5000); + }); + ((ToolTip)((FrameworkElement)ButtonImportado).ToolTip).IsOpen = false; + } + + private void AbrirInfo_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirInfo(); + } + + private void Initial_DatePicker_OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) + { + //IL_0009: Unknown result type (might be due to invalid IL or missing references) + //IL_001e: Unknown result type (might be due to invalid IL or missing references) + //IL_00d1: Unknown result type (might be due to invalid IL or missing references) + //IL_007f: Unknown result type (might be due to invalid IL or missing references) + DatePicker_OnLostKeyboardFocus(sender, e); + if (string.IsNullOrEmpty(((DatePicker)sender).Text)) + { + ((DatePicker)sender).SelectedDate = DateTime.MinValue; + ViewModel.SelectedDocumento.Vigencia1 = DateTime.MinValue; + Documento selectedDocumento = ViewModel.SelectedDocumento; + if (selectedDocumento != null) + { + _ = selectedDocumento.Vigencia1; + if (true && ViewModel.SelectedDocumento.Vigencia1 == DateTime.MinValue) + { + ((DatePicker)sender).SelectedDate = DateTime.Now.Date; + ViewModel.SelectedDocumento.Vigencia1 = DateTime.Now.Date; + } + } + } + if (string.IsNullOrWhiteSpace(Vigencia2Box.Text)) + { + Vigencia2Box.DisplayDate = ValidationHelper.ToDateTime(((DatePicker)sender).Text).AddYears(1); + Vigencia2Box.Text = Vigencia2Box.DisplayDate.ToShortDateString(); + } + } + + private void Vencimento_DatePicker_OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) + { + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_0049: Unknown result type (might be due to invalid IL or missing references) + DatePicker_OnLostKeyboardFocus(sender, e); + if (ViewModel.SelectedDocumento != null) + { + if (string.IsNullOrEmpty(((DatePicker)sender).Text)) + { + ((DatePicker)sender).SelectedDate = ViewModel.SelectedDocumento.Vigencia1; + ((DatePicker)sender).Text = ViewModel.SelectedDocumento.Vigencia1.ToString("dd/MM/yyyy"); + } + DatePicker_OnLostKeyboardFocus(sender, e); + } + } + + private void CalculoComissao_OnNumberChanged(object sender, EventArgs e) + { + if (ViewModel.BaixarParcelas && !_calculando) + { + _calculando = true; + decimal number = ValorComissaoParcelaBox.Number; + PorcentagemIrBox.NumberChanged -= PorcentagemIrBox_OnNumberChanged; + PorcentagemIssBox.NumberChanged -= PorcentagemIssBox_OnNumberChanged; + Imposto imposto = ViewModel.Imposto; + if (imposto != null && ((DomainBase)imposto).Id > 0) + { + PorcentagemIrBox.Number = ViewModel.Imposto.Ir * 100m; + } + Imposto imposto2 = ViewModel.Imposto; + if (imposto2 != null && ((DomainBase)imposto2).Id > 0) + { + PorcentagemIssBox.Number = ViewModel.Imposto.Iss * 100m; + } + PorcentagemIrBox.NumberChanged += PorcentagemIrBox_OnNumberChanged; + PorcentagemIssBox.NumberChanged += PorcentagemIssBox_OnNumberChanged; + Imposto imposto3 = ViewModel.Imposto; + decimal num = ((imposto3 != null && ((DomainBase)imposto3).Id > 0) ? (number * ViewModel.Imposto.Ir) : ValorIrBox.Number); + if (ValorIrBox.Number != num) + { + ViewModel.SelectedParcela.Irr = num; + } + Imposto imposto4 = ViewModel.Imposto; + decimal num2 = ((imposto4 != null && ((DomainBase)imposto4).Id > 0) ? (number * ViewModel.Imposto.Iss) : ValorIssBox.Number); + if (ValorIssBox.Number != num2) + { + ViewModel.SelectedParcela.Iss = num2; + } + Imposto imposto5 = ViewModel.Imposto; + decimal num3 = ((imposto5 != null && ((DomainBase)imposto5).Id > 0) ? (number * ViewModel.Imposto.Outros) : ValorOutrosBox.Number); + if (ValorOutrosBox.Number != num3) + { + ViewModel.SelectedParcela.Outros = num3; + } + Imposto imposto6 = ViewModel.Imposto; + decimal num4 = ((imposto6 != null && ((DomainBase)imposto6).Id > 0) ? (number * ViewModel.Imposto.Desconto) : ValorDescontoBox.Number); + if (ValorDescontoBox.Number != num4) + { + ViewModel.SelectedParcela.Desconto = num4; + } + ValorComDescBox.Number = number - num - num2 - num3 - num4; + ViewModel.OnPropertyChanged("SelectedParcela"); + _calculando = false; + } + } + + private void PorcentagemIrBox_OnNumberChanged(object sender, EventArgs e) + { + if (ViewModel.BaixarParcelas && !_calculando) + { + _calculando = true; + ValorIrBox.Number = ValorComissaoParcelaBox.Number * (PorcentagemIrBox.Number / 100m); + _calculando = false; + ValorImposto_OnNumberChanged(ValorIrBox, new EventArgs()); + } + } + + private void PorcentagemIssBox_OnNumberChanged(object sender, EventArgs e) + { + if (ViewModel.BaixarParcelas && !_calculando) + { + _calculando = true; + ValorIssBox.Number = ValorComissaoParcelaBox.Number * (PorcentagemIssBox.Number / 100m); + _calculando = false; + ValorImposto_OnNumberChanged(ValorIssBox, new EventArgs()); + } + } + + private void ValorImposto_OnNumberChanged(object sender, EventArgs e) + { + //IL_001e: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Expected O, but got Unknown + if (ViewModel.BaixarParcelas && !_calculando) + { + _calculando = true; + CurrencyTextBox val = (CurrencyTextBox)sender; + decimal num = ((ValorComissaoParcelaBox.Number == 0m) ? 1m : ValorComissaoParcelaBox.Number); + decimal number = ValorComissaoParcelaBox.Number; + switch (((FrameworkElement)val).Name) + { + case "ValorIrBox": + PorcentagemIrBox.Number = ValorIrBox.Number * 100m / num; + number = num - val.Number - ValorIssBox.Number - ValorOutrosBox.Number - ValorDescontoBox.Number; + break; + case "ValorIssBox": + PorcentagemIssBox.Number = ValorIssBox.Number * 100m / num; + number = num - val.Number - ValorIrBox.Number - ValorOutrosBox.Number - ValorDescontoBox.Number; + break; + case "ValorOutrosBox": + number = num - val.Number - ValorIrBox.Number - ValorIrBox.Number - ValorDescontoBox.Number; + break; + case "ValorDescontoBox": + number = num - val.Number - ValorIrBox.Number - ValorIrBox.Number - ValorOutrosBox.Number; + break; + } + ValorComDescBox.Number = number; + _calculando = false; + } + } + + private void AutoCompleteBanco_OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Expected O, but got Unknown + AutoCompleteBox val = (AutoCompleteBox)sender; + SetValid(val, string.IsNullOrWhiteSpace(val.Text) || ViewModel.SelectedDocumento.Banco != null); + } + + private void Redimencionar(double width) + { + ViewModel.TamanhoGrid = (width - 17.0) / 2.0; + int num = (ViewModel.IsFatura ? 620 : 450); + if (ViewModel.TamanhoGrid < (double)num) + { + ViewModel.TamanhoGrid = width; + } + } + + private void ApoliceControl_SizeChanged(object sender, SizeChangedEventArgs e) + { + //IL_0007: Unknown result type (might be due to invalid IL or missing references) + //IL_0013: Unknown result type (might be due to invalid IL or missing references) + //IL_0018: Unknown result type (might be due to invalid IL or missing references) + if (e != null) + { + _ = e.NewSize; + if (0 == 0) + { + Size newSize = e.NewSize; + Redimencionar(((Size)(ref newSize)).Width); + } + } + } + + private async void Ramo_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + if (!Recursos.Configuracoes.All((ConfiguracaoSistema x) => (int)x.Configuracao != 20) && ViewModel.SelectedDocumento != null) + { + EditarVendedor(editar: false); + ViewModel.SelectedPagamento = null; + await ViewModel.BuscarVendedores(); + await ViewModel.LimparRepasses(); + } + } + + private async void EditarParcelas_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.EditarParcelas(); + } + + private void MenuItem_Click(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLogAntigo(); + } + + private async void Perdido_OnClick(object sender, RoutedEventArgs e) + { + if ((int)ViewModel.SelectedDocumento.Situacao == 7) + { + await ViewModel.ShowMessage("NÃO É POSSÍVEL ALTERAR O STATUS PARA PERDIDO DE UM DOCUMENTO RECUSADO."); + return; + } + if (!(await ViewModel.ShowMessage("DESEJA REALMENTE ALTERAR O STATUS DO SEGURO PARA PERDIDO?", "SIM", "NÃO"))) + { + return; + } + ViewModel.Loading(isLoading: true); + Cliente cliente = await new ClienteServico().BuscarCliente(((DomainBase)ViewModel.SelectedDocumento.Controle.Cliente).Id); + Cliente val = cliente; + val.Telefones = await new ClienteServico().BuscarTelefonesAsync(((DomainBase)ViewModel.SelectedDocumento.Controle.Cliente).Id); + val = cliente; + val.Emails = await new ClienteServico().BuscarEmailsAsync(((DomainBase)ViewModel.SelectedDocumento.Controle.Cliente).Id); + ObservableCollection<Item> itens = await new ItemServico().BuscarItems(((DomainBase)ViewModel.SelectedDocumento.Controle).Id, (StatusItem)0); + if (!(await new ApoliceServico().Perdido(((DomainBase)ViewModel.SelectedDocumento.Controle).Id))) + { + ViewModel.Loading(isLoading: false); + return; + } + Prospeccao val2 = new Prospeccao + { + Nome = cliente.Nome, + Documento = cliente.Documento, + Nascimento = cliente.Nascimento + }; + ObservableCollection<ClienteTelefone> telefones = cliente.Telefones; + object obj; + if (telefones == null) + { + obj = null; + } + else + { + ClienteTelefone? obj2 = telefones.FirstOrDefault(); + obj = ((obj2 != null) ? ((TelefoneBase)obj2).Prefixo : null); + } + if (obj == null) + { + obj = ""; + } + val2.Prefixo1 = (string)obj; + ObservableCollection<ClienteTelefone> telefones2 = cliente.Telefones; + object obj3; + if (telefones2 == null) + { + obj3 = null; + } + else + { + ClienteTelefone? obj4 = telefones2.FirstOrDefault(); + obj3 = ((obj4 != null) ? ((TelefoneBase)obj4).Numero : null); + } + if (obj3 == null) + { + obj3 = ""; + } + val2.Telefone1 = (string)obj3; + val2.Prefixo2 = ((cliente.Telefones != null && cliente.Telefones.Count > 1) ? ((TelefoneBase)cliente.Telefones[1]).Prefixo : ""); + object telefone; + if (cliente.Telefones != null) + { + ObservableCollection<ClienteTelefone> telefones3 = cliente.Telefones; + if (telefones3 != null && telefones3.Count > 1) + { + telefone = ((TelefoneBase)cliente.Telefones[1]).Numero; + goto IL_0536; + } + } + telefone = ""; + goto IL_0536; + IL_0536: + val2.Telefone2 = (string)telefone; + ObservableCollection<ClienteEmail> emails = cliente.Emails; + object obj5; + if (emails == null) + { + obj5 = null; + } + else + { + ClienteEmail? obj6 = emails.FirstOrDefault(); + obj5 = ((obj6 != null) ? ((EmailBase)obj6).Email : null); + } + if (obj5 == null) + { + obj5 = ""; + } + val2.Email = (string)obj5; + val2.VigenciaFinal = (ViewModel.SelectedDocumento.Vigencia2 ?? Funcoes.GetNetworkTime().Date).AddYears(1); + val2.Vendedor = ViewModel.SelectedDocumento.VendedorPrincipal; + Item? obj7 = itens.FirstOrDefault(); + val2.Item = ((obj7 != null) ? obj7.Descricao : null); + val2.Tipo = "SEGURO PERDIDO"; + val2.Observacao = "SEGURO PERDIDO: PROPOSTA: " + ViewModel.SelectedDocumento.Proposta + ", APÓLICE: " + ViewModel.SelectedDocumento.Apolice; + val2.Status = (StatusProspeccao)1; + val2.Renovacao = true; + Prospeccao data = val2; + await AbrirProspeccao(data); + await ViewModel.SelecionaDocumento(ViewModel.SelectedDocumento); + ViewModel.Loading(isLoading: false); + } + + private async Task AbrirProspeccao(Prospeccao data) + { + while (true) + { + if (await ViewModel.ShowProspeccaoDialog(data) == null) + { + if (await ViewModel.ShowMessage("DESEJA REALMENTE NÃO CADASTRAR UMA PROSPECÇÃO PARA ESSE DOCUMENTO?", "SIM", "NÃO")) + { + return; + } + continue; + } + List<KeyValuePair<string, string>> list = await ViewModel.SalvarProspeccao(data); + if (list == null || list.Count == 0) + { + break; + } + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + ViewModel.ToggleSnackBar("PROSPECÇÃO SALVA COM SUCESSO."); + } + + private void FocusPremios(object sender, RoutedEventArgs e) + { + ViewModel.UpdatePremio = true; + } + + private void AbrirLogParcelaAntigo_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLogAntigoParcela(); + } + + private void AdicionarCoCorretagem_OnClick(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + ToggleButton val = (ToggleButton)sender; + bool flag = (int)val != 0 && val.IsChecked.GetValueOrDefault(); + ComboBox comissaoNovoComboBox = ComissaoNovoComboBox; + if (((comissaoNovoComboBox != null) ? ((Selector)comissaoNovoComboBox).SelectedItem : null) != null) + { + ((Selector)ComissaoNovoComboBox).SelectedItem = null; + } + if (flag) + { + ((Selector)TipoVendedorBox).SelectedIndex = 0; + } + else if (((Selector)TipoVendedorBox).SelectedItem != null) + { + ((Selector)TipoVendedorBox).SelectedItem = null; + } + ComboBox vendedorBox = VendedorBox; + if (((vendedorBox != null) ? ((Selector)vendedorBox).SelectedItem : null) != null) + { + ((Selector)VendedorBox).SelectedItem = null; + } + if (ValidationHelper.IsNotNullOrEmpty(((TextBox)ValorRepasseBox).Text)) + { + ((TextBox)ValorRepasseBox).Text = ""; + } + ViewModel.VendedorCoCorretagem(flag); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/seguros/apoliceview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_027b: Unknown result type (might be due to invalid IL or missing references) + //IL_0285: Expected O, but got Unknown + //IL_0288: Unknown result type (might be due to invalid IL or missing references) + //IL_0292: Expected O, but got Unknown + //IL_029f: Unknown result type (might be due to invalid IL or missing references) + //IL_02a9: Expected O, but got Unknown + //IL_02ac: Unknown result type (might be due to invalid IL or missing references) + //IL_02b6: Expected O, but got Unknown + //IL_02c3: Unknown result type (might be due to invalid IL or missing references) + //IL_02cd: Expected O, but got Unknown + //IL_02d0: Unknown result type (might be due to invalid IL or missing references) + //IL_02da: Expected O, but got Unknown + //IL_02e7: Unknown result type (might be due to invalid IL or missing references) + //IL_02f1: Expected O, but got Unknown + //IL_02f4: Unknown result type (might be due to invalid IL or missing references) + //IL_02fe: Expected O, but got Unknown + //IL_030b: Unknown result type (might be due to invalid IL or missing references) + //IL_0315: Expected O, but got Unknown + //IL_0318: Unknown result type (might be due to invalid IL or missing references) + //IL_0322: Expected O, but got Unknown + //IL_032f: Unknown result type (might be due to invalid IL or missing references) + //IL_0339: Expected O, but got Unknown + //IL_033c: Unknown result type (might be due to invalid IL or missing references) + //IL_0346: Expected O, but got Unknown + //IL_0353: Unknown result type (might be due to invalid IL or missing references) + //IL_035d: Expected O, but got Unknown + //IL_035f: Unknown result type (might be due to invalid IL or missing references) + //IL_036b: Unknown result type (might be due to invalid IL or missing references) + //IL_0375: Expected O, but got Unknown + //IL_0378: Unknown result type (might be due to invalid IL or missing references) + //IL_0382: Expected O, but got Unknown + //IL_038f: Unknown result type (might be due to invalid IL or missing references) + //IL_0399: Expected O, but got Unknown + //IL_039c: Unknown result type (might be due to invalid IL or missing references) + //IL_03a6: Expected O, but got Unknown + //IL_03a9: Unknown result type (might be due to invalid IL or missing references) + //IL_03b3: Expected O, but got Unknown + //IL_03c0: Unknown result type (might be due to invalid IL or missing references) + //IL_03ca: Expected O, but got Unknown + //IL_03cc: Unknown result type (might be due to invalid IL or missing references) + //IL_03d8: Unknown result type (might be due to invalid IL or missing references) + //IL_03e2: Expected O, but got Unknown + //IL_03e4: Unknown result type (might be due to invalid IL or missing references) + //IL_03f0: Unknown result type (might be due to invalid IL or missing references) + //IL_03fa: Expected O, but got Unknown + //IL_03fc: Unknown result type (might be due to invalid IL or missing references) + //IL_0408: Unknown result type (might be due to invalid IL or missing references) + //IL_0412: Expected O, but got Unknown + //IL_0414: Unknown result type (might be due to invalid IL or missing references) + //IL_0420: Unknown result type (might be due to invalid IL or missing references) + //IL_042a: Expected O, but got Unknown + //IL_042c: Unknown result type (might be due to invalid IL or missing references) + //IL_0438: Unknown result type (might be due to invalid IL or missing references) + //IL_0442: Expected O, but got Unknown + //IL_0444: Unknown result type (might be due to invalid IL or missing references) + //IL_0450: Unknown result type (might be due to invalid IL or missing references) + //IL_045a: Expected O, but got Unknown + //IL_045c: Unknown result type (might be due to invalid IL or missing references) + //IL_0468: Unknown result type (might be due to invalid IL or missing references) + //IL_0472: Expected O, but got Unknown + //IL_0474: Unknown result type (might be due to invalid IL or missing references) + //IL_0480: Unknown result type (might be due to invalid IL or missing references) + //IL_048a: Expected O, but got Unknown + //IL_048c: Unknown result type (might be due to invalid IL or missing references) + //IL_0498: Unknown result type (might be due to invalid IL or missing references) + //IL_04a2: Expected O, but got Unknown + //IL_04a4: Unknown result type (might be due to invalid IL or missing references) + //IL_04b0: Unknown result type (might be due to invalid IL or missing references) + //IL_04ba: Expected O, but got Unknown + //IL_04bc: Unknown result type (might be due to invalid IL or missing references) + //IL_04c8: Unknown result type (might be due to invalid IL or missing references) + //IL_04d2: Expected O, but got Unknown + //IL_04d4: Unknown result type (might be due to invalid IL or missing references) + //IL_04e0: Unknown result type (might be due to invalid IL or missing references) + //IL_04ea: Expected O, but got Unknown + //IL_04ed: Unknown result type (might be due to invalid IL or missing references) + //IL_04f7: Expected O, but got Unknown + //IL_04f9: Unknown result type (might be due to invalid IL or missing references) + //IL_0505: Unknown result type (might be due to invalid IL or missing references) + //IL_050f: Expected O, but got Unknown + //IL_0512: Unknown result type (might be due to invalid IL or missing references) + //IL_051c: Expected O, but got Unknown + //IL_051f: Unknown result type (might be due to invalid IL or missing references) + //IL_0529: Expected O, but got Unknown + //IL_052c: Unknown result type (might be due to invalid IL or missing references) + //IL_0536: Expected O, but got Unknown + //IL_0539: Unknown result type (might be due to invalid IL or missing references) + //IL_0543: Expected O, but got Unknown + //IL_0546: Unknown result type (might be due to invalid IL or missing references) + //IL_0550: Expected O, but got Unknown + //IL_0553: Unknown result type (might be due to invalid IL or missing references) + //IL_055d: Expected O, but got Unknown + //IL_0560: Unknown result type (might be due to invalid IL or missing references) + //IL_056a: Expected O, but got Unknown + //IL_056c: Unknown result type (might be due to invalid IL or missing references) + //IL_0578: Unknown result type (might be due to invalid IL or missing references) + //IL_0582: Expected O, but got Unknown + //IL_0583: Unknown result type (might be due to invalid IL or missing references) + //IL_058f: Unknown result type (might be due to invalid IL or missing references) + //IL_0599: Expected O, but got Unknown + //IL_059a: Unknown result type (might be due to invalid IL or missing references) + //IL_05a6: Unknown result type (might be due to invalid IL or missing references) + //IL_05b0: Expected O, but got Unknown + //IL_05b1: Unknown result type (might be due to invalid IL or missing references) + //IL_05ca: Unknown result type (might be due to invalid IL or missing references) + //IL_05d4: Expected O, but got Unknown + //IL_05e1: Unknown result type (might be due to invalid IL or missing references) + //IL_05eb: Expected O, but got Unknown + //IL_05f8: Unknown result type (might be due to invalid IL or missing references) + //IL_0602: Expected O, but got Unknown + //IL_061c: Unknown result type (might be due to invalid IL or missing references) + //IL_0626: Expected O, but got Unknown + //IL_0633: Unknown result type (might be due to invalid IL or missing references) + //IL_063d: Expected O, but got Unknown + //IL_064a: Unknown result type (might be due to invalid IL or missing references) + //IL_0654: Expected O, but got Unknown + //IL_0661: Unknown result type (might be due to invalid IL or missing references) + //IL_066b: Expected O, but got Unknown + //IL_066e: Unknown result type (might be due to invalid IL or missing references) + //IL_0678: Expected O, but got Unknown + //IL_0685: Unknown result type (might be due to invalid IL or missing references) + //IL_068f: Expected O, but got Unknown + //IL_069c: Unknown result type (might be due to invalid IL or missing references) + //IL_06a6: Expected O, but got Unknown + //IL_06b3: Unknown result type (might be due to invalid IL or missing references) + //IL_06bd: Expected O, but got Unknown + //IL_06d7: Unknown result type (might be due to invalid IL or missing references) + //IL_06e1: Expected O, but got Unknown + //IL_06e4: Unknown result type (might be due to invalid IL or missing references) + //IL_06ee: Expected O, but got Unknown + //IL_06f1: Unknown result type (might be due to invalid IL or missing references) + //IL_06fb: Expected O, but got Unknown + //IL_070b: Unknown result type (might be due to invalid IL or missing references) + //IL_0715: Expected O, but got Unknown + //IL_0718: Unknown result type (might be due to invalid IL or missing references) + //IL_0722: Expected O, but got Unknown + //IL_0725: Unknown result type (might be due to invalid IL or missing references) + //IL_072f: Expected O, but got Unknown + //IL_073c: Unknown result type (might be due to invalid IL or missing references) + //IL_0746: Expected O, but got Unknown + //IL_0749: Unknown result type (might be due to invalid IL or missing references) + //IL_0753: Expected O, but got Unknown + //IL_0756: Unknown result type (might be due to invalid IL or missing references) + //IL_0760: Expected O, but got Unknown + //IL_0763: Unknown result type (might be due to invalid IL or missing references) + //IL_076d: Expected O, but got Unknown + //IL_0770: Unknown result type (might be due to invalid IL or missing references) + //IL_077a: Expected O, but got Unknown + //IL_07bd: Unknown result type (might be due to invalid IL or missing references) + //IL_07c9: Unknown result type (might be due to invalid IL or missing references) + //IL_07d3: Expected O, but got Unknown + //IL_07d6: Unknown result type (might be due to invalid IL or missing references) + //IL_07e0: Expected O, but got Unknown + //IL_07e2: Unknown result type (might be due to invalid IL or missing references) + //IL_07ee: Unknown result type (might be due to invalid IL or missing references) + //IL_07f8: Expected O, but got Unknown + //IL_07fa: Unknown result type (might be due to invalid IL or missing references) + //IL_0806: Unknown result type (might be due to invalid IL or missing references) + //IL_0810: Expected O, but got Unknown + //IL_0812: Unknown result type (might be due to invalid IL or missing references) + //IL_081e: Unknown result type (might be due to invalid IL or missing references) + //IL_0828: Expected O, but got Unknown + //IL_082a: Unknown result type (might be due to invalid IL or missing references) + //IL_0836: Unknown result type (might be due to invalid IL or missing references) + //IL_0840: Expected O, but got Unknown + //IL_0842: Unknown result type (might be due to invalid IL or missing references) + //IL_084e: Unknown result type (might be due to invalid IL or missing references) + //IL_0858: Expected O, but got Unknown + //IL_085a: Unknown result type (might be due to invalid IL or missing references) + //IL_0866: Unknown result type (might be due to invalid IL or missing references) + //IL_0870: Expected O, but got Unknown + //IL_0873: Unknown result type (might be due to invalid IL or missing references) + //IL_087d: Expected O, but got Unknown + //IL_087f: Unknown result type (might be due to invalid IL or missing references) + //IL_088b: Unknown result type (might be due to invalid IL or missing references) + //IL_0895: Expected O, but got Unknown + //IL_0897: Unknown result type (might be due to invalid IL or missing references) + //IL_08a3: Unknown result type (might be due to invalid IL or missing references) + //IL_08ad: Expected O, but got Unknown + //IL_08af: Unknown result type (might be due to invalid IL or missing references) + //IL_08bb: Unknown result type (might be due to invalid IL or missing references) + //IL_08c5: Expected O, but got Unknown + //IL_08c7: Unknown result type (might be due to invalid IL or missing references) + //IL_08d3: Unknown result type (might be due to invalid IL or missing references) + //IL_08dd: Expected O, but got Unknown + //IL_08df: Unknown result type (might be due to invalid IL or missing references) + //IL_08eb: Unknown result type (might be due to invalid IL or missing references) + //IL_08f5: Expected O, but got Unknown + //IL_08f8: Unknown result type (might be due to invalid IL or missing references) + //IL_0902: Expected O, but got Unknown + //IL_0912: Unknown result type (might be due to invalid IL or missing references) + //IL_091c: Expected O, but got Unknown + //IL_092c: Unknown result type (might be due to invalid IL or missing references) + //IL_0936: Expected O, but got Unknown + //IL_0946: Unknown result type (might be due to invalid IL or missing references) + //IL_0950: Expected O, but got Unknown + //IL_095f: Unknown result type (might be due to invalid IL or missing references) + //IL_096b: Unknown result type (might be due to invalid IL or missing references) + //IL_0975: Expected O, but got Unknown + //IL_0976: Unknown result type (might be due to invalid IL or missing references) + //IL_0982: Unknown result type (might be due to invalid IL or missing references) + //IL_098c: Expected O, but got Unknown + //IL_098d: Unknown result type (might be due to invalid IL or missing references) + //IL_0999: Unknown result type (might be due to invalid IL or missing references) + //IL_09a3: Expected O, but got Unknown + //IL_09b3: Unknown result type (might be due to invalid IL or missing references) + //IL_09bd: Expected O, but got Unknown + //IL_09ca: Unknown result type (might be due to invalid IL or missing references) + //IL_09d4: Expected O, but got Unknown + //IL_09e1: Unknown result type (might be due to invalid IL or missing references) + //IL_09eb: Expected O, but got Unknown + //IL_09f8: Unknown result type (might be due to invalid IL or missing references) + //IL_0a02: Expected O, but got Unknown + //IL_0a11: Unknown result type (might be due to invalid IL or missing references) + //IL_0a1d: Unknown result type (might be due to invalid IL or missing references) + //IL_0a27: Expected O, but got Unknown + //IL_0a28: Unknown result type (might be due to invalid IL or missing references) + //IL_0a34: Unknown result type (might be due to invalid IL or missing references) + //IL_0a3e: Expected O, but got Unknown + //IL_0a3f: Unknown result type (might be due to invalid IL or missing references) + //IL_0a4b: Unknown result type (might be due to invalid IL or missing references) + //IL_0a55: Expected O, but got Unknown + //IL_0a65: Unknown result type (might be due to invalid IL or missing references) + //IL_0a6f: Expected O, but got Unknown + //IL_0a7c: Unknown result type (might be due to invalid IL or missing references) + //IL_0a86: Expected O, but got Unknown + //IL_0a93: Unknown result type (might be due to invalid IL or missing references) + //IL_0a9d: Expected O, but got Unknown + //IL_0aaa: Unknown result type (might be due to invalid IL or missing references) + //IL_0ab4: Expected O, but got Unknown + //IL_0ac4: Unknown result type (might be due to invalid IL or missing references) + //IL_0ace: Expected O, but got Unknown + //IL_0ad1: Unknown result type (might be due to invalid IL or missing references) + //IL_0adb: Expected O, but got Unknown + //IL_0aeb: Unknown result type (might be due to invalid IL or missing references) + //IL_0af5: Expected O, but got Unknown + //IL_0b05: Unknown result type (might be due to invalid IL or missing references) + //IL_0b0f: Expected O, but got Unknown + //IL_0b1f: Unknown result type (might be due to invalid IL or missing references) + //IL_0b29: Expected O, but got Unknown + //IL_0b36: Unknown result type (might be due to invalid IL or missing references) + //IL_0b40: Expected O, but got Unknown + //IL_0b4d: Unknown result type (might be due to invalid IL or missing references) + //IL_0b57: Expected O, but got Unknown + //IL_0b64: Unknown result type (might be due to invalid IL or missing references) + //IL_0b6e: Expected O, but got Unknown + //IL_0b94: Unknown result type (might be due to invalid IL or missing references) + //IL_0ba0: Unknown result type (might be due to invalid IL or missing references) + //IL_0baa: Expected O, but got Unknown + //IL_0bab: Unknown result type (might be due to invalid IL or missing references) + //IL_0bb7: Unknown result type (might be due to invalid IL or missing references) + //IL_0bc1: Expected O, but got Unknown + //IL_0bc2: Unknown result type (might be due to invalid IL or missing references) + //IL_0bce: Unknown result type (might be due to invalid IL or missing references) + //IL_0bd8: Expected O, but got Unknown + //IL_0bd9: Unknown result type (might be due to invalid IL or missing references) + //IL_0bfe: Unknown result type (might be due to invalid IL or missing references) + //IL_0c0a: Unknown result type (might be due to invalid IL or missing references) + //IL_0c14: Expected O, but got Unknown + //IL_0c15: Unknown result type (might be due to invalid IL or missing references) + //IL_0c21: Unknown result type (might be due to invalid IL or missing references) + //IL_0c2b: Expected O, but got Unknown + //IL_0c2c: Unknown result type (might be due to invalid IL or missing references) + //IL_0c38: Unknown result type (might be due to invalid IL or missing references) + //IL_0c42: Expected O, but got Unknown + //IL_0c43: Unknown result type (might be due to invalid IL or missing references) + //IL_0c69: Unknown result type (might be due to invalid IL or missing references) + //IL_0c73: Expected O, but got Unknown + //IL_0c80: Unknown result type (might be due to invalid IL or missing references) + //IL_0c8a: Expected O, but got Unknown + //IL_0c97: Unknown result type (might be due to invalid IL or missing references) + //IL_0ca1: Expected O, but got Unknown + //IL_0cae: Unknown result type (might be due to invalid IL or missing references) + //IL_0cb8: Expected O, but got Unknown + //IL_0cdf: Unknown result type (might be due to invalid IL or missing references) + //IL_0ce9: Expected O, but got Unknown + //IL_0cf6: Unknown result type (might be due to invalid IL or missing references) + //IL_0d00: Expected O, but got Unknown + //IL_0d10: Unknown result type (might be due to invalid IL or missing references) + //IL_0d1a: Expected O, but got Unknown + //IL_0d34: Unknown result type (might be due to invalid IL or missing references) + //IL_0d3e: Expected O, but got Unknown + //IL_0d4e: Unknown result type (might be due to invalid IL or missing references) + //IL_0d58: Expected O, but got Unknown + //IL_0d7f: Unknown result type (might be due to invalid IL or missing references) + //IL_0d89: Expected O, but got Unknown + //IL_0db0: Unknown result type (might be due to invalid IL or missing references) + //IL_0dba: Expected O, but got Unknown + //IL_0de1: Unknown result type (might be due to invalid IL or missing references) + //IL_0deb: Expected O, but got Unknown + //IL_0e12: Unknown result type (might be due to invalid IL or missing references) + //IL_0e1c: Expected O, but got Unknown + //IL_0e43: Unknown result type (might be due to invalid IL or missing references) + //IL_0e4d: Expected O, but got Unknown + //IL_0e74: Unknown result type (might be due to invalid IL or missing references) + //IL_0e7e: Expected O, but got Unknown + //IL_0e98: Unknown result type (might be due to invalid IL or missing references) + //IL_0ea2: Expected O, but got Unknown + //IL_0ea5: Unknown result type (might be due to invalid IL or missing references) + //IL_0eaf: Expected O, but got Unknown + //IL_0eb2: Unknown result type (might be due to invalid IL or missing references) + //IL_0ebc: Expected O, but got Unknown + //IL_0ebf: Unknown result type (might be due to invalid IL or missing references) + //IL_0ec9: Expected O, but got Unknown + //IL_0ecc: Unknown result type (might be due to invalid IL or missing references) + //IL_0ed6: Expected O, but got Unknown + //IL_0ed9: Unknown result type (might be due to invalid IL or missing references) + //IL_0ee3: Expected O, but got Unknown + //IL_0ee6: Unknown result type (might be due to invalid IL or missing references) + //IL_0ef0: Expected O, but got Unknown + //IL_0ef3: Unknown result type (might be due to invalid IL or missing references) + //IL_0efd: Expected O, but got Unknown + //IL_0f00: Unknown result type (might be due to invalid IL or missing references) + //IL_0f0a: Expected O, but got Unknown + //IL_0f0d: Unknown result type (might be due to invalid IL or missing references) + //IL_0f17: Expected O, but got Unknown + //IL_0f24: Unknown result type (might be due to invalid IL or missing references) + //IL_0f2e: Expected O, but got Unknown + //IL_0f31: Unknown result type (might be due to invalid IL or missing references) + //IL_0f3b: Expected O, but got Unknown + //IL_0f48: Unknown result type (might be due to invalid IL or missing references) + //IL_0f52: Expected O, but got Unknown + //IL_0f55: Unknown result type (might be due to invalid IL or missing references) + //IL_0f5f: Expected O, but got Unknown + //IL_0f6c: Unknown result type (might be due to invalid IL or missing references) + //IL_0f76: Expected O, but got Unknown + //IL_0f78: Unknown result type (might be due to invalid IL or missing references) + //IL_0f84: Unknown result type (might be due to invalid IL or missing references) + //IL_0f8e: Expected O, but got Unknown + //IL_0f91: Unknown result type (might be due to invalid IL or missing references) + //IL_0f9b: Expected O, but got Unknown + //IL_0f9e: Unknown result type (might be due to invalid IL or missing references) + //IL_0fa8: Expected O, but got Unknown + //IL_0fb5: Unknown result type (might be due to invalid IL or missing references) + //IL_0fbf: Expected O, but got Unknown + //IL_0fc2: Unknown result type (might be due to invalid IL or missing references) + //IL_0fcc: Expected O, but got Unknown + //IL_0fcf: Unknown result type (might be due to invalid IL or missing references) + //IL_0fd9: Expected O, but got Unknown + //IL_0fe9: Unknown result type (might be due to invalid IL or missing references) + //IL_0ff3: Expected O, but got Unknown + //IL_1000: Unknown result type (might be due to invalid IL or missing references) + //IL_100a: Expected O, but got Unknown + //IL_101a: Unknown result type (might be due to invalid IL or missing references) + //IL_1024: Expected O, but got Unknown + //IL_1031: Unknown result type (might be due to invalid IL or missing references) + //IL_103b: Expected O, but got Unknown + //IL_103e: Unknown result type (might be due to invalid IL or missing references) + //IL_1048: Expected O, but got Unknown + //IL_1062: Unknown result type (might be due to invalid IL or missing references) + //IL_106c: Expected O, but got Unknown + //IL_106f: Unknown result type (might be due to invalid IL or missing references) + //IL_1079: Expected O, but got Unknown + //IL_107c: Unknown result type (might be due to invalid IL or missing references) + //IL_1086: Expected O, but got Unknown + //IL_1089: Unknown result type (might be due to invalid IL or missing references) + //IL_1093: Expected O, but got Unknown + //IL_1096: Unknown result type (might be due to invalid IL or missing references) + //IL_10a0: Expected O, but got Unknown + //IL_10a3: Unknown result type (might be due to invalid IL or missing references) + //IL_10ad: Expected O, but got Unknown + //IL_10b0: Unknown result type (might be due to invalid IL or missing references) + //IL_10ba: Expected O, but got Unknown + //IL_10bd: Unknown result type (might be due to invalid IL or missing references) + //IL_10c7: Expected O, but got Unknown + //IL_10d4: Unknown result type (might be due to invalid IL or missing references) + //IL_10de: Expected O, but got Unknown + //IL_10eb: Unknown result type (might be due to invalid IL or missing references) + //IL_10f5: Expected O, but got Unknown + //IL_10f8: Unknown result type (might be due to invalid IL or missing references) + //IL_1102: Expected O, but got Unknown + //IL_1105: Unknown result type (might be due to invalid IL or missing references) + //IL_110f: Expected O, but got Unknown + //IL_1112: Unknown result type (might be due to invalid IL or missing references) + //IL_111c: Expected O, but got Unknown + //IL_111f: Unknown result type (might be due to invalid IL or missing references) + //IL_1129: Expected O, but got Unknown + //IL_112c: Unknown result type (might be due to invalid IL or missing references) + //IL_1136: Expected O, but got Unknown + //IL_1144: Unknown result type (might be due to invalid IL or missing references) + //IL_114e: Expected O, but got Unknown + //IL_115b: Unknown result type (might be due to invalid IL or missing references) + //IL_1165: Expected O, but got Unknown + //IL_1172: Unknown result type (might be due to invalid IL or missing references) + //IL_117c: Expected O, but got Unknown + //IL_117f: Unknown result type (might be due to invalid IL or missing references) + //IL_1189: Expected O, but got Unknown + //IL_1196: Unknown result type (might be due to invalid IL or missing references) + //IL_11a0: Expected O, but got Unknown + //IL_11a3: Unknown result type (might be due to invalid IL or missing references) + //IL_11ad: Expected O, but got Unknown + switch (connectionId) + { + case 1: + MenuApolice = (DockPanel)target; + break; + case 2: + IncluirpoliceButton = (MenuItem)target; + IncluirpoliceButton.Click += new RoutedEventHandler(IncluirApolice_OnClick); + break; + case 3: + AlterarApoliceButton = (MenuItem)target; + AlterarApoliceButton.Click += new RoutedEventHandler(Alterar_OnClick); + break; + case 4: + SalvarApoliceButton = (MenuItem)target; + SalvarApoliceButton.Click += new RoutedEventHandler(SalvarApolice_OnClick); + break; + case 5: + CancelarApoliceButton = (MenuItem)target; + CancelarApoliceButton.Click += new RoutedEventHandler(CancelarApolice_OnClick); + break; + case 6: + ExcluirpoliceButton = (MenuItem)target; + ExcluirpoliceButton.Click += new RoutedEventHandler(ExcluirDocumento_OnClick); + break; + case 7: + ButtonImportado = (Button)target; + ((ButtonBase)ButtonImportado).Click += new RoutedEventHandler(Importacao_OnClick); + break; + case 8: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirPerfil_OnClick); + break; + case 9: + ArquivoDigitalButton = (MenuItem)target; + ArquivoDigitalButton.Click += new RoutedEventHandler(AbrirAquivoDigital_Click); + break; + case 10: + MaisOpcoesButton = (MenuItem)target; + break; + case 11: + EditarParcelasButton = (MenuItem)target; + EditarParcelasButton.Click += new RoutedEventHandler(EditarParcelas_OnClick); + break; + case 12: + ((MenuItem)target).Click += new RoutedEventHandler(Renovar_OnClick); + break; + case 13: + ((MenuItem)target).Click += new RoutedEventHandler(Perdido_OnClick); + break; + case 14: + ((MenuItem)target).Click += new RoutedEventHandler(Endossar_OnClick); + break; + case 15: + ((MenuItem)target).Click += new RoutedEventHandler(RecusarDocumento_OnClick); + break; + case 16: + ((MenuItem)target).Click += new RoutedEventHandler(ManutecaoItens_OnClick); + break; + case 17: + ((MenuItem)target).Click += new RoutedEventHandler(MenuItem_OnClick); + break; + case 18: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick); + break; + case 19: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLogEmail_OnClick); + break; + case 20: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLogEmailPF_OnClick); + break; + case 21: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLogTrocaCliente_OnClick); + break; + case 22: + ((MenuItem)target).Click += new RoutedEventHandler(MenuItem_Click); + break; + case 23: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirInfo_OnClick); + break; + case 24: + ApoliceControl1 = (WrapPanel)target; + break; + case 25: + ((Selector)(ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(Ramo_OnSelectionChanged); + break; + case 26: + ProdutoBox = (ComboBox)target; + break; + case 27: + SituacaoBox = (ComboBox)target; + break; + case 28: + NegocioCorretoraBox = (ComboBox)target; + break; + case 29: + TipoRecebimentoBox = (ComboBox)target; + break; + case 30: + TipoEndossoBox = (ComboBox)target; + break; + case 31: + ApoliceBox = (TextBox)target; + break; + case 32: + EndossoBox = (TextBox)target; + break; + case 33: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(Initial_DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + ((DatePicker)target).SelectedDateChanged += ValidacaoDocumento; + break; + case 34: + Vigencia2Box = (DatePicker)target; + ((UIElement)Vigencia2Box).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((Control)Vigencia2Box).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + Vigencia2Box.SelectedDateChanged += ValidacaoDocumento; + break; + case 35: + TransmissaoBox = (DatePicker)target; + ((UIElement)TransmissaoBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)TransmissaoBox).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)TransmissaoBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 36: + EmissaoBox = (DatePicker)target; + ((UIElement)EmissaoBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)EmissaoBox).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)EmissaoBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + EmissaoBox.SelectedDateChanged += ValidacaoDocumento; + break; + case 37: + FormaPagamentoBox = (ComboBox)target; + break; + case 38: + PremiosBox = (Grid)target; + break; + case 39: + AdicionalBox = (ToggleButton)target; + break; + case 40: + Comissao = (CustomIsReadOnlyControl)target; + break; + case 41: + ComissaoBox = (CurrencyTextBox)target; + break; + case 42: + PremioLiquidoBox = (CurrencyTextBox)target; + break; + case 43: + PremioAdicionalBox = (CurrencyTextBox)target; + ((UIElement)PremioAdicionalBox).GotFocus += new RoutedEventHandler(FocusPremios); + break; + case 44: + IofBox = (CurrencyTextBox)target; + break; + case 45: + DiferencaBox = (CurrencyTextBox)target; + break; + case 46: + PremioTotalBox = (CurrencyTextBox)target; + break; + case 47: + ParcelasBox = (CurrencyTextBox)target; + break; + case 48: + ComissaoOriginal = (CustomIsReadOnlyControl)target; + break; + case 49: + Gerada = (CustomIsReadOnlyControl)target; + break; + case 50: + Recebida = (CustomIsReadOnlyControl)target; + break; + case 51: + Pendente = (CustomIsReadOnlyControl)target; + break; + case 52: + Repasse = (CustomIsReadOnlyControl)target; + break; + case 53: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Button_Click); + break; + case 54: + BaixarParcelaButton = (Menu)target; + break; + case 55: + ((MenuItem)target).Click += new RoutedEventHandler(BaixarParcelas_Click); + break; + case 56: + ((MenuItem)target).Click += new RoutedEventHandler(AlterarParcela_Click); + break; + case 57: + ((MenuItem)target).Click += new RoutedEventHandler(IncluirNovaFatura_Click); + break; + case 58: + ((MenuItem)target).Click += new RoutedEventHandler(ReplicarFatura_Click); + break; + case 59: + ((MenuItem)target).Click += new RoutedEventHandler(IncluirParcelaEspecial_Click); + break; + case 60: + ((MenuItem)target).Click += new RoutedEventHandler(ExcluirParcela_Click); + break; + case 61: + SalvarParcelaButton = (Menu)target; + break; + case 62: + ((MenuItem)target).Click += new RoutedEventHandler(SalvarParcela_Click); + break; + case 63: + ((MenuItem)target).Click += new RoutedEventHandler(CancelarParcela_Click); + break; + case 64: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLogParcelas_OnClick); + break; + case 65: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLogParcelaSelecionada_OnClick); + break; + case 66: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLogParcelaAntigo_OnClick); + break; + case 67: + EditarParcelasFields = (StackPanel)target; + break; + case 68: + TipoParcelaField = (CustomItemValidation)target; + break; + case 69: + TipoParcelaBox = (ComboBox)target; + break; + case 70: + QuantidadeFaturaField = (CustomItemControl)target; + break; + case 71: + QuantidadeFaturaBox = (CurrencyTextBox)target; + break; + case 72: + FaturaField = (CustomItemValidation)target; + break; + case 73: + FaturaBox = (TextBox)target; + break; + case 74: + VigenciaInicialField = (CustomItemValidation)target; + break; + case 75: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(Vigencia_DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 76: + VigenciaFinalField = (CustomItemValidation)target; + break; + case 77: + VigenciaFinalParcelaBox = (DatePicker)target; + ((UIElement)VigenciaFinalParcelaBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)VigenciaFinalParcelaBox).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)VigenciaFinalParcelaBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 78: + VencimentoField = (CustomItemValidation)target; + break; + case 79: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(Vencimento_DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 80: + EmissaoField = (CustomItemControl)target; + break; + case 81: + EmissaoParcelaBox = (DatePicker)target; + ((UIElement)EmissaoParcelaBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)EmissaoParcelaBox).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)EmissaoParcelaBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 82: + PercentualComissaoField = (CustomItemValidation)target; + break; + case 83: + ComissaoParcelaBox = (CurrencyTextBox)target; + break; + case 84: + ComissaoIcon = (TextBlock)target; + break; + case 85: + ValorLiquidoField = (CustomItemControl)target; + break; + case 86: + ValorLiquidoParcelaBox = (CurrencyTextBox)target; + break; + case 87: + ValorField = (CustomItemControl)target; + break; + case 88: + ValorParcelaBox = (CurrencyTextBox)target; + break; + case 89: + RecebimentoField = (CustomItemValidation)target; + break; + case 90: + RecebimentoParcelaBox = (DatePicker)target; + ((UIElement)RecebimentoParcelaBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(Vencimento_OnLostKeyboardFocus); + ((UIElement)RecebimentoParcelaBox).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)RecebimentoParcelaBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + RecebimentoParcelaBox.SelectedDateChanged += ValidacaoParcela; + break; + case 91: + QuitacaoField = (CustomItemControl)target; + break; + case 92: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + ((DatePicker)target).SelectedDateChanged += ValidacaoParcela; + break; + case 93: + DataControleParcelaField = (CustomItemControl)target; + break; + case 94: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + ((DatePicker)target).SelectedDateChanged += ValidacaoParcela; + break; + case 95: + CreditoField = (CustomItemValidation)target; + break; + case 96: + CreditoParcelaBox = (DatePicker)target; + ((UIElement)CreditoParcelaBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)CreditoParcelaBox).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)CreditoParcelaBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + CreditoParcelaBox.SelectedDateChanged += ValidacaoParcela; + break; + case 97: + ValorRealizadoField = (CustomItemValidation)target; + break; + case 98: + ValorRealizadoParcelaBox = (CurrencyTextBox)target; + ((UIElement)ValorRealizadoParcelaBox).LostFocus += new RoutedEventHandler(ValorRealizadoParcelaBox_OnLostFocus); + break; + case 99: + ValorComissaoField = (CustomItemValidation)target; + break; + case 100: + ValorComissaoParcelaBox = (CurrencyTextBox)target; + ValorComissaoParcelaBox.NumberChanged += CalculoComissao_OnNumberChanged; + break; + case 101: + ImpostosField = (WrapPanel)target; + break; + case 102: + PorcentagemIrField = (CustomItemControl)target; + break; + case 103: + PorcentagemIrBox = (CurrencyTextBox)target; + PorcentagemIrBox.NumberChanged += PorcentagemIrBox_OnNumberChanged; + break; + case 104: + ValorIrField = (CustomItemControl)target; + break; + case 105: + ValorIrBox = (CurrencyTextBox)target; + ValorIrBox.NumberChanged += ValorImposto_OnNumberChanged; + break; + case 106: + PorcentagemIssField = (CustomItemControl)target; + break; + case 107: + PorcentagemIssBox = (CurrencyTextBox)target; + PorcentagemIssBox.NumberChanged += PorcentagemIssBox_OnNumberChanged; + break; + case 108: + ValorIssField = (CustomItemControl)target; + break; + case 109: + ValorIssBox = (CurrencyTextBox)target; + ValorIssBox.NumberChanged += ValorImposto_OnNumberChanged; + break; + case 110: + ValorOutrosField = (CustomItemControl)target; + break; + case 111: + ValorOutrosBox = (CurrencyTextBox)target; + ValorOutrosBox.NumberChanged += ValorImposto_OnNumberChanged; + break; + case 112: + ValorDescontoField = (CustomItemControl)target; + break; + case 113: + ValorDescontoBox = (CurrencyTextBox)target; + ValorDescontoBox.NumberChanged += ValorImposto_OnNumberChanged; + break; + case 114: + ValorComDescField = (CustomItemControl)target; + break; + case 115: + ValorComDescBox = (CurrencyTextBox)target; + ValorComDescBox.NumberChanged += ValorImposto_OnNumberChanged; + break; + case 116: + ParcelaGrid = (DataGrid)target; + break; + case 117: + ParcelaColumn = (DataGridTextColumn)target; + break; + case 118: + FaturaColumn = (DataGridTextColumn)target; + break; + case 119: + VigenciaInicialColumn = (DataGridTextColumn)target; + break; + case 120: + VigenciaFinalColumn = (DataGridTextColumn)target; + break; + case 121: + ParcelasComissaoColumn = (DataGridTextColumn)target; + break; + case 122: + ParcelasValorComissaoColumn = (DataGridTextColumn)target; + break; + case 123: + ParcelasValorComissaoDescColumn = (DataGridTextColumn)target; + break; + case 124: + MaisInformacoesColumn = (DataGridTemplateColumn)target; + break; + case 127: + EditarVendedorButton = (MenuItem)target; + EditarVendedorButton.Click += new RoutedEventHandler(IncluirVendedor_Click); + break; + case 128: + SalvarVendedorButton = (MenuItem)target; + SalvarVendedorButton.Click += new RoutedEventHandler(SalvarVendedor_Click); + break; + case 129: + CancelarVendedorButton = (MenuItem)target; + CancelarVendedorButton.Click += new RoutedEventHandler(CancelarVendedor_Click); + break; + case 130: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLogVendedor_OnClick); + break; + case 131: + EditarVendedorFields = (WrapPanel)target; + break; + case 132: + CoCorretagemToogle = (ToggleButton)target; + ((ButtonBase)CoCorretagemToogle).Click += new RoutedEventHandler(AdicionarCoCorretagem_OnClick); + break; + case 133: + TipoVendedorBox = (ComboBox)target; + break; + case 134: + VendedorBox = (ComboBox)target; + break; + case 135: + ComissaoNovoBox = (CustomItemValidation)target; + break; + case 136: + ComissaoNovoComboBox = (ComboBox)target; + ((Selector)ComissaoNovoComboBox).SelectionChanged += new SelectionChangedEventHandler(ComissaoVendedorBox_OnSelectionChanged); + break; + case 137: + ComissaoRenovacaoBox = (CustomItemValidation)target; + break; + case 138: + ComissaoRenovacaoComboBox = (ComboBox)target; + ((Selector)ComissaoRenovacaoComboBox).SelectionChanged += new SelectionChangedEventHandler(ComissaoVendedorBox_OnSelectionChanged); + break; + case 139: + ValorRepasseBox = (CurrencyTextBox)target; + ValorRepasseBox.NumberChanged += CalculoComissao_OnNumberChanged; + break; + case 140: + FormaRecebidaBox = (TextBox)target; + break; + case 141: + FormaIncidenciaBox = (TextBox)target; + break; + case 142: + VendedorGrid = (DataGrid)target; + break; + case 143: + VendedorGridColumn = (DataGridTextColumn)target; + break; + case 144: + PagamentosPorcentagemRepasseColumn = (DataGridTextColumn)target; + break; + case 145: + PagamentosValorRepasseColumn = (DataGridTextColumn)target; + break; + case 147: + ProponenteBox = (TextBox)target; + break; + case 148: + AutoCompleteBanco = (AutoCompleteBox)target; + AutoCompleteBanco.Populating += new PopulatingEventHandler(AutoCompleteBancoBox_Populating); + ((UIElement)AutoCompleteBanco).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(AutoCompleteBanco_OnLostKeyboardFocus); + break; + case 149: + AgenciaBox = (TextBox)target; + break; + case 150: + ContaBox = (TextBox)target; + break; + case 151: + CartaoBox = (TextBox)target; + break; + case 152: + BandeiraBox = (ComboBox)target; + break; + case 153: + VencimentoCartaoBox = (TextBox)target; + ((UIElement)VencimentoCartaoBox).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + ((TextBoxBase)VencimentoCartaoBox).TextChanged += new TextChangedEventHandler(VencimentoCartaoBox_OnTextChanged); + ((UIElement)VencimentoCartaoBox).GotFocus += new RoutedEventHandler(VencimentoCartaoBox_OnGotFocus); + break; + case 154: + DataBox = (DatePicker)target; + ((Control)DataBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 155: + PastaBox = (TextBox)target; + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Unknown result type (might be due to invalid IL or missing references) + //IL_002a: Expected O, but got Unknown + //IL_002c: Unknown result type (might be due to invalid IL or missing references) + //IL_0038: Unknown result type (might be due to invalid IL or missing references) + //IL_0042: Expected O, but got Unknown + //IL_0044: Unknown result type (might be due to invalid IL or missing references) + //IL_0050: Unknown result type (might be due to invalid IL or missing references) + //IL_005a: Expected O, but got Unknown + switch (connectionId) + { + case 125: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ValoresParcelaInfo_OnClick); + break; + case 126: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AbrirAquivoDigital_Click); + break; + case 146: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirVendedor_Click); + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Seguros/ClienteView.cs b/Decompiler/Gestor.Application.Views.Seguros/ClienteView.cs new file mode 100644 index 0000000..a05df26 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Seguros/ClienteView.cs @@ -0,0 +1,1261 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Data; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Threading; +using CurrencyTextBoxControl; +using Gestor.Application.Componentes; +using Gestor.Application.Drawers; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.ViewModels.Seguros; +using Gestor.Application.Views.Generic; +using Gestor.Common.Helpers; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Xceed.Wpf.AvalonDock.Controls; + +namespace Gestor.Application.Views.Seguros; + +public class ClienteView : BaseUserControl, IComponentConnector, IStyleConnector +{ + public ClienteViewModel ViewModel; + + internal Grid MainGrid; + + internal MenuItem IncluirClienteButton; + + internal ComboBox TipoDocumentoPrincipalBox; + + internal TextBox DocumentoPrincipalBox; + + internal TextBox NomeBox; + + internal TextBox NomeSocialBox; + + internal TextBox CaepfBox; + + internal TextBox RneBox; + + internal TextBox CeiBox; + + internal TextBox IdentidadeBox; + + internal TextBox EmissorBox; + + internal TextBox EstadoEmissorBox; + + internal TextBox HabilitacaoBox; + + internal TextBox CategoriaHabilitacaooBox; + + internal ComboBox SexoBox; + + internal ComboBox EstadoCivilBox; + + internal AutoCompleteBox AutoCompleteProfissao; + + internal AutoCompleteBox AutoCompleteAtividade; + + internal TextBox ResponsavelBox; + + internal TextBox DocumentoResponsavel; + + internal TextBox EmailBox; + + internal TextBox PastaBox; + + internal AutoCompleteBox AutoCompleteBanco; + + internal TextBox AgenciaBox; + + internal TextBox TipoContaBox; + + internal TextBox ContaBox; + + internal CurrencyTextBox RendaMensalBox; + + internal ListBox TelefoneListBox; + + internal ListBox EmailListBox; + + internal ListBox EnderecoListBox; + + internal AutoCompleteBox VinculoBox; + + internal TextBox NomeOrigemBox; + + internal ListBox ContatosListBox; + + private bool _contentLoaded; + + private static int Ordem { get; set; } + + public ClienteView(Cliente cliente = null, bool lockInsert = false, ClienteViewModel viewModel = null) + { + ((FrameworkElement)this).Tag = "CADASTRO DE CLIENTES"; + ViewModel = viewModel ?? new ClienteViewModel(cliente, !lockInsert); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + if (lockInsert) + { + ((UIElement)IncluirClienteButton).IsEnabled = false; + } + if (cliente != null) + { + ViewModel.RegistrarAcao("ACESSOU CLIENTE \"" + cliente.Nome + "\"", ((DomainBase)cliente).Id, (TipoTela)1, $"ID CLIENTE: {((DomainBase)cliente).Id}"); + } + } + + private void ContentLoad() + { + //IL_0051: Unknown result type (might be due to invalid IL or missing references) + //IL_005b: Expected O, but got Unknown + ((FrameworkElement)TelefoneListBox).DataContext = ViewModel; + ((FrameworkElement)EmailListBox).DataContext = ViewModel; + ((FrameworkElement)EnderecoListBox).DataContext = ViewModel; + ((FrameworkElement)ContatosListBox).DataContext = ViewModel; + ((UIElement)DocumentoResponsavel).LostFocus += new RoutedEventHandler(Validar_LostFocus); + if (ViewModel.SelectedCliente != null) + { + AutoCompleteBox autoCompleteBanco = AutoCompleteBanco; + Banco banco = ViewModel.SelectedCliente.Banco; + autoCompleteBanco.Text = ((banco != null) ? banco.Nome : null); + AutoCompleteBox autoCompleteAtividade = AutoCompleteAtividade; + Atividade atividade = ViewModel.SelectedCliente.Atividade; + autoCompleteAtividade.Text = ((atividade != null) ? atividade.Nome : null); + AutoCompleteBox autoCompleteProfissao = AutoCompleteProfissao; + Profissao profissao = ViewModel.SelectedCliente.Profissao; + autoCompleteProfissao.Text = ((profissao != null) ? profissao.Nome : null); + } + } + + private void DocumentoPrincipalBox_LostFocus(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0015: Expected O, but got Unknown + //IL_0098: Unknown result type (might be due to invalid IL or missing references) + if (((TextBoxBase)(TextBox)sender).IsReadOnly) + { + return; + } + TextBox val = (TextBox)sender; + string text = ValidationHelper.Clear(val.Text); + if (string.IsNullOrEmpty(text)) + { + return; + } + val.Text = ((text.Length == 11) ? ValidationHelper.FormatDocument(text.PadLeft(11, '0').Substring(0, 11)) : ValidationHelper.FormatDocument(text.PadLeft(14, '0').Substring(0, 14))); + if (((FrameworkElement)val).Name == "DocumentoPrincipalBox") + { + ViewModel.JuridicaouFisica(DocumentoPrincipalBox.Text); + if ((int)ViewModel.VisibilityFisica == 0) + { + ResponsavelBox.Text = string.Empty; + DocumentoResponsavel.Text = string.Empty; + EmailBox.Text = string.Empty; + } + } + } + + private void IncluirEmail_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.IncluirEmail(); + ValidarTela(); + } + + private void IncluirEndereco_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.IncluirEndereco(); + ValidarTela(); + } + + private void IncluirTelefone_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.IncluirTelefone(); + } + + private void ExcluirTelefone_OnClick(object sender, RoutedEventArgs e) + { + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_0034: Expected O, but got Unknown + Button val = (Button)((sender is Button) ? sender : null); + if (val != null) + { + ListBox val2 = Extentions.FindVisualAncestor<ListBox>((DependencyObject)(object)val); + ClienteTelefone telefone = (ClienteTelefone)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)]; + ViewModel.ExcluirTelefone(telefone); + } + } + + private void ExcluirEmail_OnClick(object sender, RoutedEventArgs e) + { + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_0034: Expected O, but got Unknown + Button val = (Button)((sender is Button) ? sender : null); + if (val != null) + { + ListBox val2 = Extentions.FindVisualAncestor<ListBox>((DependencyObject)(object)val); + ClienteEmail email = (ClienteEmail)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)]; + ViewModel.ExcluirEmail(email); + } + } + + private void ExcluirEndereco_OnClick(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_000b: Expected O, but got Unknown + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Expected O, but got Unknown + Grid val = Extentions.FindVisualAncestor<Grid>((DependencyObject)(Button)sender); + ListBox val2 = Extentions.FindVisualAncestor<ListBox>((DependencyObject)(object)val); + ClienteEndereco endereco = (ClienteEndereco)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)]; + ViewModel.ExcluirEndereco(endereco); + } + + private void IncluirMaisContatos_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.IncluirContato(); + } + + private void IncluirVinculo_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.IncluirVinculo()) + { + VinculoBox.Text = ""; + } + } + + private void ExcluirMaisContatos_OnClick(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Expected O, but got Unknown + Button val = (Button)sender; + if (val != null && ((FrameworkElement)val).DataContext != null) + { + MaisContato contato = (MaisContato)((FrameworkElement)val).DataContext; + ViewModel.ExcluirContato(contato); + } + } + + private void ExcluirVinculo_OnClick(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Expected O, but got Unknown + Button val = (Button)sender; + if (val != null && ((FrameworkElement)val).DataContext != null) + { + ClienteVinculo vinculo = (ClienteVinculo)((FrameworkElement)val).DataContext; + ViewModel.ExcluirVinculo(vinculo); + } + } + + private void Incluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.IncluirCliente(); + DocumentoPrincipalBox.Text = ""; + AutoCompleteBanco.Text = ""; + AutoCompleteProfissao.Text = ""; + AutoCompleteAtividade.Text = ""; + ((UIElement)DocumentoPrincipalBox).Focus(); + ValidarTela(); + } + + private void Alterar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Alterar(alterar: true); + ClearInputFields(); + ValidarTela(); + ((DomainBase)ViewModel.SelectedCliente).Initialize(); + InitializeResponsavelAssinatura(); + ViewModel.Salvando = false; + } + + private void InitializeResponsavelAssinatura() + { + TextBox responsavelBox = ResponsavelBox; + ResponsavelAssinatura responsavelAssinatura = ViewModel.SelectedCliente.ResponsavelAssinatura; + responsavelBox.Text = ((responsavelAssinatura != null) ? responsavelAssinatura.NomeResponsavel : null) ?? string.Empty; + TextBox documentoResponsavel = DocumentoResponsavel; + ResponsavelAssinatura responsavelAssinatura2 = ViewModel.SelectedCliente.ResponsavelAssinatura; + documentoResponsavel.Text = ((responsavelAssinatura2 != null) ? responsavelAssinatura2.DocumentoResponsavel : null) ?? string.Empty; + TextBox emailBox = EmailBox; + ResponsavelAssinatura responsavelAssinatura3 = ViewModel.SelectedCliente.ResponsavelAssinatura; + emailBox.Text = ((responsavelAssinatura3 != null) ? responsavelAssinatura3.EmailResponsavel : null) ?? string.Empty; + } + + private void Cancelar_OnClick(object sender, RoutedEventArgs e) + { + ClearInputFields(); + SetValid(AutoCompleteBanco, valid: true); + ViewModel.CancelarAlteracao(); + } + + private void ClearInputFields() + { + AutoCompleteBox autoCompleteBanco = AutoCompleteBanco; + Banco banco = ViewModel.SelectedCliente.Banco; + autoCompleteBanco.Text = ((banco != null) ? banco.Nome : null) ?? string.Empty; + AutoCompleteBox autoCompleteProfissao = AutoCompleteProfissao; + Profissao profissao = ViewModel.SelectedCliente.Profissao; + autoCompleteProfissao.Text = ((profissao != null) ? profissao.Nome : null) ?? string.Empty; + AutoCompleteBox autoCompleteProfissao2 = AutoCompleteProfissao; + Profissao profissao2 = ViewModel.SelectedCliente.Profissao; + autoCompleteProfissao2.Text = ((profissao2 != null) ? profissao2.Nome : null) ?? string.Empty; + AutoCompleteBox autoCompleteAtividade = AutoCompleteAtividade; + Atividade atividade = ViewModel.SelectedCliente.Atividade; + autoCompleteAtividade.Text = ((atividade != null) ? atividade.Nome : null) ?? string.Empty; + } + + private void Excluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Excluir(); + } + + private async void Salvar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + ViewModel.ProfissaoText = AutoCompleteProfissao.Text; + ViewModel.AtividadeText = AutoCompleteAtividade.Text; + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(); + ((DependencyObject)(object)this).ValidateFields(list); + bool num = list == null || list.Count == 0; + ViewModel.Loading(isLoading: false); + if (num) + { + SetValid(AutoCompleteBanco, valid: true); + } + else + { + await ViewModel.ShowMessage(list.Distinct().ToList(), ViewModel.ErroCamposInvalidos, "OK"); + } + } + + private async void AbrirAquivoDigital_Click(object sender, RoutedEventArgs e) + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)1).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + EnumHelper.GetDescription<TipoArquivoDigital>((TipoArquivoDigital)1) + "."); + return; + } + FiltroArquivoDigital filtro = new FiltroArquivoDigital + { + Id = ((DomainBase)ViewModel.SelectedCliente).Id, + Tipo = (TipoArquivoDigital)1, + Parente = ViewModel.SelectedCliente + }; + ViewModel.ShowDrawer(new ArquivoDigitalDrawer(filtro), 0, close: false); + } + + private async void PostcodeBox_OnLostFocus(object sender, RoutedEventArgs e) + { + TextBox val = (TextBox)sender; + if (((TextBoxBase)val).IsReadOnly || string.IsNullOrWhiteSpace(val.Text)) + { + return; + } + string text = ValidationHelper.FormatPostCode(val.Text); + WrapPanel val2 = Extentions.FindVisualAncestor<WrapPanel>((DependencyObject)(object)val); + ListBox val3 = Extentions.FindVisualAncestor<ListBox>((DependencyObject)(object)val2); + ListBoxItem val4 = (ListBoxItem)((ItemsControl)val3).ItemContainerGenerator.ContainerFromIndex(((CollectionView)((ItemsControl)val3).Items).IndexOf(((FrameworkElement)val2).DataContext)); + ContentPresenter contentPresenter = FindVisualChild.Find<ContentPresenter>((DependencyObject)(object)val4); + DataTemplate dataTemplate = contentPresenter.ContentTemplate; + TextBox val5 = (TextBox)((FrameworkTemplate)dataTemplate).FindName("CepBox", (FrameworkElement)(object)contentPresenter); + ProgressBar progress = (ProgressBar)((FrameworkTemplate)dataTemplate).FindName("ProgressCep", (FrameworkElement)(object)contentPresenter); + ((UIElement)progress).Visibility = (Visibility)0; + val5.Text = text; + if (!ValidationHelper.ValidatePostCode(text)) + { + ((UIElement)progress).Visibility = (Visibility)2; + return; + } + EnderecoBase val6 = await ViewModel.BuscaCep(text); + if (val6 == null) + { + ((UIElement)progress).Visibility = (Visibility)2; + return; + } + TextBox val7 = (TextBox)((FrameworkTemplate)dataTemplate).FindName("EnderecoBox", (FrameworkElement)(object)contentPresenter); + TextBox val8 = (TextBox)((FrameworkTemplate)dataTemplate).FindName("CidadeBox", (FrameworkElement)(object)contentPresenter); + TextBox val9 = (TextBox)((FrameworkTemplate)dataTemplate).FindName("EstadoBox", (FrameworkElement)(object)contentPresenter); + TextBox val10 = (TextBox)((FrameworkTemplate)dataTemplate).FindName("BairroBox", (FrameworkElement)(object)contentPresenter); + val7.Text = val6.Endereco; + val8.Text = val6.Cidade; + val9.Text = val6.Estado; + val10.Text = val6.Bairro; + ((UIElement)progress).Visibility = (Visibility)2; + } + + public override void FormatarDocumento(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + TextBox val = (TextBox)sender; + val.Text = ValidationHelper.FormatDocument(val.Text); + ViewModel.JuridicaouFisica(val.Text); + } + + private void ValidarTela() + { + if (ViewModel.SelectedCliente != null) + { + List<KeyValuePair<string, string>> list = ViewModel.SelectedCliente.Validate(); + if (Recursos.Configuracoes.All((ConfiguracaoSistema x) => (int)x.Configuracao != 29)) + { + ClienteEmail? obj = ViewModel.Emails.FirstOrDefault(); + list.AddRange(((obj != null) ? obj.Validate() : null) ?? new List<KeyValuePair<string, string>>()); + } + ClienteTelefone? obj2 = ViewModel.Telefones.FirstOrDefault(); + list.AddRange(((obj2 != null) ? obj2.Validate() : null) ?? new List<KeyValuePair<string, string>>()); + ClienteEndereco? obj3 = ViewModel.Enderecos.FirstOrDefault(); + list.AddRange(((obj3 != null) ? obj3.Validate() : null) ?? new List<KeyValuePair<string, string>>()); + ((DependencyObject)(object)this).ValidateFields(list, focusField: false); + } + } + + private void AutoCompleteProfissaoBox_Populating(object sender, PopulatingEventArgs e) + { + if (e.Parameter.Length < 1) + { + return; + } + e.Cancel = true; + ViewModel.BuscarProfissao(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Profissao>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void AutoCompleteAtividadeBox_Populating(object sender, PopulatingEventArgs e) + { + if (e.Parameter.Length < 1) + { + return; + } + e.Cancel = true; + ViewModel.BuscarAtividade(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Atividade>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void AutoCompleteBancoBox_Populating(object sender, PopulatingEventArgs e) + { + if (e.Parameter.Length < 3) + { + return; + } + e.Cancel = true; + ViewModel.BuscarBanco(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Banco>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void AutoCompleteParentescoBox_Populating(object sender, PopulatingEventArgs e) + { + if (e.Parameter.Length < 3) + { + return; + } + e.Cancel = true; + ViewModel.BuscarClienteVinculo(ValidationHelper.RemoveDiacritics(e.Parameter.Trim()), ((DomainBase)ViewModel.SelectedCliente).Id).ContinueWith(delegate(Task<List<Cliente>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void OrdemBox_OnLostFocus(object sender, RoutedEventArgs e) + { + //IL_0064: Unknown result type (might be due to invalid IL or missing references) + //IL_006e: Expected O, but got Unknown + //IL_0083: Unknown result type (might be due to invalid IL or missing references) + //IL_008a: Expected O, but got Unknown + TextBox val = (TextBox)((sender is TextBox) ? sender : null); + if (val == null || ((TextBoxBase)val).IsReadOnly || !int.TryParse(val.Text, out var result)) + { + return; + } + WrapPanel val2 = Extentions.FindVisualAncestor<WrapPanel>((DependencyObject)(object)Extentions.FindVisualAncestor<CustomItemValidation>((DependencyObject)(object)val)); + ListBox val3 = Extentions.FindVisualAncestor<ListBox>((DependencyObject)(object)val2); + if (val3 == null) + { + return; + } + for (int i = 0; i < ((CollectionView)((ItemsControl)val3).Items).Count; i++) + { + if (i != ((CollectionView)((ItemsControl)val3).Items).IndexOf(((FrameworkElement)val2).DataContext)) + { + ContentPresenter val4 = FindVisualChild.Find<ContentPresenter>((DependencyObject)(ListBoxItem)((ItemsControl)val3).ItemContainerGenerator.ContainerFromIndex(i)); + TextBox val5 = (TextBox)((FrameworkTemplate)val4.ContentTemplate).FindName("OrdemBox", (FrameworkElement)(object)val4); + if (int.TryParse(val5.Text, out var result2) && result2 == result) + { + val5.Text = Ordem.ToString(); + } + } + } + } + + private void OrdemBox_OnPreviewGotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) + { + TextBox val = (TextBox)((sender is TextBox) ? sender : null); + if (val != null && int.TryParse(val.Text, out var result)) + { + Ordem = result; + } + } + + private void AbrirLog_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLog((TipoTela)1, ((DomainBase)ViewModel.SelectedCliente).Id); + } + + private void AbrirLogEmail_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLogEmail((TipoTela)1, ((DomainBase)ViewModel.SelectedCliente).Id); + } + + private void TipoComboBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_003c: Unknown result type (might be due to invalid IL or missing references) + //IL_0046: Expected O, but got Unknown + //IL_009d: Unknown result type (might be due to invalid IL or missing references) + //IL_00a3: Invalid comparison between Unknown and I4 + ComboBox val = (ComboBox)sender; + CustomIsReadOnlyControl customIsReadOnlyControl = Extentions.FindVisualAncestor<CustomIsReadOnlyControl>((DependencyObject)(object)val); + if (customIsReadOnlyControl == null) + { + return; + } + WrapPanel val2 = Extentions.FindVisualAncestor<WrapPanel>((DependencyObject)(object)customIsReadOnlyControl); + ListBox val3 = Extentions.FindVisualAncestor<ListBox>((DependencyObject)(object)val2); + ContentPresenter val4 = FindVisualChild.Find<ContentPresenter>((DependencyObject)(ListBoxItem)((ItemsControl)val3).ItemContainerGenerator.ContainerFromIndex(((CollectionView)((ItemsControl)val3).Items).IndexOf(((FrameworkElement)val2).DataContext))); + DataTemplate contentTemplate = val4.ContentTemplate; + CustomItemValidation customItemValidation = (CustomItemValidation)((FrameworkTemplate)contentTemplate).FindName("Prefixo", (FrameworkElement)(object)val4); + CustomItemValidation depObj = (CustomItemValidation)((FrameworkTemplate)contentTemplate).FindName("Telefone", (FrameworkElement)(object)val4); + TextBox? obj = ((DependencyObject)(object)customItemValidation).FindChildren<TextBox>().FirstOrDefault(); + TextBox val5 = ((DependencyObject)(object)depObj).FindChildren<TextBox>().FirstOrDefault(); + if (obj != null && val5 != null) + { + if ((int)(TipoTelefone)((Selector)val).SelectedValue != 8) + { + ((UIElement)customItemValidation).Visibility = (Visibility)0; + val5.MaxLength = 10; + int length = ((val5.Text.Length >= 10) ? 10 : val5.Text.Length); + val5.Text = val5.Text.Substring(0, length); + } + else + { + ((UIElement)customItemValidation).Visibility = (Visibility)2; + val5.MaxLength = 20; + } + } + } + + private void AutoCompleteBanco_OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Expected O, but got Unknown + AutoCompleteBox val = (AutoCompleteBox)sender; + SetValid(val, string.IsNullOrWhiteSpace(val.Text) || ViewModel.SelectedCliente.Banco != null); + } + + private static void SetValid(AutoCompleteBox autocomplete, bool valid) + { + ViewHelper.SetInvalid((Control)(object)autocomplete, "BANCO INVÁLIDO", valid); + } + + private void Tarefa_Click(object sender, RoutedEventArgs e) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Unknown result type (might be due to invalid IL or missing references) + //IL_0031: Unknown result type (might be due to invalid IL or missing references) + //IL_0038: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_0065: Expected O, but got Unknown + Tarefa tarefa = new Tarefa + { + IdCliente = ((DomainBase)ViewModel.SelectedCliente).Id, + Cliente = ViewModel.SelectedCliente.Nome, + Entidade = (TipoTarefa)2, + IdEntidade = ((DomainBase)ViewModel.SelectedCliente).Id, + Titulo = ViewModel.SelectedCliente.Nome + }; + ViewModel.ShowDrawer(new TarefaDrawer(tarefa), 0, close: false); + } + + private void Validar_LostFocus(object sender, RoutedEventArgs e) + { + ValidarTela(); + } + + private async void ExcluirOrigem_OnClick(object sender, RoutedEventArgs e) + { + Button val = (Button)sender; + if (((FrameworkElement)val).DataContext != null) + { + ViewModel.Loading(isLoading: true); + await ViewModel.ExcluirOrigem((OrigemCliente)((FrameworkElement)val).DataContext); + ViewModel.Loading(isLoading: false); + } + } + + private async void IncluirOrigem_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + await ViewModel.IncluirOrigem(NomeOrigemBox.Text.Trim()); + NomeOrigemBox.Text = string.Empty; + ViewModel.Loading(isLoading: false); + } + + private void MenuItem_Click(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLogAntigo(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/seguros/clienteview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0113: Unknown result type (might be due to invalid IL or missing references) + //IL_011d: Expected O, but got Unknown + //IL_0120: Unknown result type (might be due to invalid IL or missing references) + //IL_012a: Expected O, but got Unknown + //IL_0137: Unknown result type (might be due to invalid IL or missing references) + //IL_0141: Expected O, but got Unknown + //IL_0143: Unknown result type (might be due to invalid IL or missing references) + //IL_014f: Unknown result type (might be due to invalid IL or missing references) + //IL_0159: Expected O, but got Unknown + //IL_015b: Unknown result type (might be due to invalid IL or missing references) + //IL_0167: Unknown result type (might be due to invalid IL or missing references) + //IL_0171: Expected O, but got Unknown + //IL_0173: Unknown result type (might be due to invalid IL or missing references) + //IL_017f: Unknown result type (might be due to invalid IL or missing references) + //IL_0189: Expected O, but got Unknown + //IL_018b: Unknown result type (might be due to invalid IL or missing references) + //IL_0197: Unknown result type (might be due to invalid IL or missing references) + //IL_01a1: Expected O, but got Unknown + //IL_01a3: Unknown result type (might be due to invalid IL or missing references) + //IL_01af: Unknown result type (might be due to invalid IL or missing references) + //IL_01b9: Expected O, but got Unknown + //IL_01bb: Unknown result type (might be due to invalid IL or missing references) + //IL_01c7: Unknown result type (might be due to invalid IL or missing references) + //IL_01d1: Expected O, but got Unknown + //IL_01d3: Unknown result type (might be due to invalid IL or missing references) + //IL_01df: Unknown result type (might be due to invalid IL or missing references) + //IL_01e9: Expected O, but got Unknown + //IL_01eb: Unknown result type (might be due to invalid IL or missing references) + //IL_01f7: Unknown result type (might be due to invalid IL or missing references) + //IL_0201: Expected O, but got Unknown + //IL_0203: Unknown result type (might be due to invalid IL or missing references) + //IL_020f: Unknown result type (might be due to invalid IL or missing references) + //IL_0219: Expected O, but got Unknown + //IL_021c: Unknown result type (might be due to invalid IL or missing references) + //IL_0226: Expected O, but got Unknown + //IL_0229: Unknown result type (might be due to invalid IL or missing references) + //IL_0233: Expected O, but got Unknown + //IL_0241: Unknown result type (might be due to invalid IL or missing references) + //IL_024b: Expected O, but got Unknown + //IL_0258: Unknown result type (might be due to invalid IL or missing references) + //IL_0262: Expected O, but got Unknown + //IL_0265: Unknown result type (might be due to invalid IL or missing references) + //IL_026f: Expected O, but got Unknown + //IL_0272: Unknown result type (might be due to invalid IL or missing references) + //IL_027c: Expected O, but got Unknown + //IL_027e: Unknown result type (might be due to invalid IL or missing references) + //IL_028a: Unknown result type (might be due to invalid IL or missing references) + //IL_0294: Expected O, but got Unknown + //IL_0295: Unknown result type (might be due to invalid IL or missing references) + //IL_02a1: Unknown result type (might be due to invalid IL or missing references) + //IL_02ab: Expected O, but got Unknown + //IL_02ac: Unknown result type (might be due to invalid IL or missing references) + //IL_02b8: Unknown result type (might be due to invalid IL or missing references) + //IL_02c2: Expected O, but got Unknown + //IL_02c3: Unknown result type (might be due to invalid IL or missing references) + //IL_02cf: Unknown result type (might be due to invalid IL or missing references) + //IL_02d9: Expected O, but got Unknown + //IL_02dc: Unknown result type (might be due to invalid IL or missing references) + //IL_02e6: Expected O, but got Unknown + //IL_02e9: Unknown result type (might be due to invalid IL or missing references) + //IL_02f3: Expected O, but got Unknown + //IL_02f6: Unknown result type (might be due to invalid IL or missing references) + //IL_0300: Expected O, but got Unknown + //IL_0303: Unknown result type (might be due to invalid IL or missing references) + //IL_030d: Expected O, but got Unknown + //IL_0310: Unknown result type (might be due to invalid IL or missing references) + //IL_031a: Expected O, but got Unknown + //IL_0327: Unknown result type (might be due to invalid IL or missing references) + //IL_0331: Expected O, but got Unknown + //IL_0334: Unknown result type (might be due to invalid IL or missing references) + //IL_033e: Expected O, but got Unknown + //IL_034b: Unknown result type (might be due to invalid IL or missing references) + //IL_0355: Expected O, but got Unknown + //IL_0357: Unknown result type (might be due to invalid IL or missing references) + //IL_0363: Unknown result type (might be due to invalid IL or missing references) + //IL_036d: Expected O, but got Unknown + //IL_036e: Unknown result type (might be due to invalid IL or missing references) + //IL_037a: Unknown result type (might be due to invalid IL or missing references) + //IL_0384: Expected O, but got Unknown + //IL_0385: Unknown result type (might be due to invalid IL or missing references) + //IL_0391: Unknown result type (might be due to invalid IL or missing references) + //IL_039b: Expected O, but got Unknown + //IL_039c: Unknown result type (might be due to invalid IL or missing references) + //IL_03a8: Unknown result type (might be due to invalid IL or missing references) + //IL_03b2: Expected O, but got Unknown + //IL_03b5: Unknown result type (might be due to invalid IL or missing references) + //IL_03bf: Expected O, but got Unknown + //IL_03cd: Unknown result type (might be due to invalid IL or missing references) + //IL_03d7: Expected O, but got Unknown + //IL_03da: Unknown result type (might be due to invalid IL or missing references) + //IL_03e4: Expected O, but got Unknown + //IL_03f2: Unknown result type (might be due to invalid IL or missing references) + //IL_03fc: Expected O, but got Unknown + //IL_03fe: Unknown result type (might be due to invalid IL or missing references) + //IL_040a: Unknown result type (might be due to invalid IL or missing references) + //IL_0414: Expected O, but got Unknown + //IL_0415: Unknown result type (might be due to invalid IL or missing references) + //IL_0421: Unknown result type (might be due to invalid IL or missing references) + //IL_042b: Expected O, but got Unknown + //IL_042c: Unknown result type (might be due to invalid IL or missing references) + //IL_0438: Unknown result type (might be due to invalid IL or missing references) + //IL_0442: Expected O, but got Unknown + //IL_0444: Unknown result type (might be due to invalid IL or missing references) + //IL_0450: Unknown result type (might be due to invalid IL or missing references) + //IL_045a: Expected O, but got Unknown + //IL_045b: Unknown result type (might be due to invalid IL or missing references) + //IL_0467: Unknown result type (might be due to invalid IL or missing references) + //IL_0471: Expected O, but got Unknown + //IL_0472: Unknown result type (might be due to invalid IL or missing references) + //IL_047e: Unknown result type (might be due to invalid IL or missing references) + //IL_0488: Expected O, but got Unknown + //IL_048b: Unknown result type (might be due to invalid IL or missing references) + //IL_0495: Expected O, but got Unknown + //IL_0498: Unknown result type (might be due to invalid IL or missing references) + //IL_04a2: Expected O, but got Unknown + //IL_04a5: Unknown result type (might be due to invalid IL or missing references) + //IL_04af: Expected O, but got Unknown + //IL_04bc: Unknown result type (might be due to invalid IL or missing references) + //IL_04c6: Expected O, but got Unknown + //IL_04c9: Unknown result type (might be due to invalid IL or missing references) + //IL_04d3: Expected O, but got Unknown + //IL_04e0: Unknown result type (might be due to invalid IL or missing references) + //IL_04ea: Expected O, but got Unknown + //IL_04ed: Unknown result type (might be due to invalid IL or missing references) + //IL_04f7: Expected O, but got Unknown + //IL_0504: Unknown result type (might be due to invalid IL or missing references) + //IL_050e: Expected O, but got Unknown + //IL_0511: Unknown result type (might be due to invalid IL or missing references) + //IL_051b: Expected O, but got Unknown + //IL_0529: Unknown result type (might be due to invalid IL or missing references) + //IL_0533: Expected O, but got Unknown + //IL_0540: Unknown result type (might be due to invalid IL or missing references) + //IL_054a: Expected O, but got Unknown + //IL_054d: Unknown result type (might be due to invalid IL or missing references) + //IL_0557: Expected O, but got Unknown + //IL_0564: Unknown result type (might be due to invalid IL or missing references) + //IL_056e: Expected O, but got Unknown + //IL_0570: Unknown result type (might be due to invalid IL or missing references) + //IL_057c: Unknown result type (might be due to invalid IL or missing references) + //IL_0586: Expected O, but got Unknown + //IL_0587: Unknown result type (might be due to invalid IL or missing references) + //IL_0593: Unknown result type (might be due to invalid IL or missing references) + //IL_059d: Expected O, but got Unknown + //IL_059e: Unknown result type (might be due to invalid IL or missing references) + //IL_05aa: Unknown result type (might be due to invalid IL or missing references) + //IL_05b4: Expected O, but got Unknown + //IL_05b7: Unknown result type (might be due to invalid IL or missing references) + //IL_05c1: Expected O, but got Unknown + //IL_05c4: Unknown result type (might be due to invalid IL or missing references) + //IL_05ce: Expected O, but got Unknown + //IL_05db: Unknown result type (might be due to invalid IL or missing references) + //IL_05e5: Expected O, but got Unknown + //IL_05f2: Unknown result type (might be due to invalid IL or missing references) + //IL_05fc: Expected O, but got Unknown + //IL_05ff: Unknown result type (might be due to invalid IL or missing references) + //IL_0609: Expected O, but got Unknown + //IL_060c: Unknown result type (might be due to invalid IL or missing references) + //IL_0616: Expected O, but got Unknown + //IL_0619: Unknown result type (might be due to invalid IL or missing references) + //IL_0623: Expected O, but got Unknown + //IL_0626: Unknown result type (might be due to invalid IL or missing references) + //IL_0630: Expected O, but got Unknown + //IL_0632: Unknown result type (might be due to invalid IL or missing references) + //IL_063e: Unknown result type (might be due to invalid IL or missing references) + //IL_0648: Expected O, but got Unknown + //IL_064b: Unknown result type (might be due to invalid IL or missing references) + //IL_0655: Expected O, but got Unknown + //IL_0657: Unknown result type (might be due to invalid IL or missing references) + //IL_0663: Unknown result type (might be due to invalid IL or missing references) + //IL_066d: Expected O, but got Unknown + //IL_0670: Unknown result type (might be due to invalid IL or missing references) + //IL_067a: Expected O, but got Unknown + //IL_067c: Unknown result type (might be due to invalid IL or missing references) + //IL_0688: Unknown result type (might be due to invalid IL or missing references) + //IL_0692: Expected O, but got Unknown + //IL_0695: Unknown result type (might be due to invalid IL or missing references) + //IL_069f: Expected O, but got Unknown + //IL_06a2: Unknown result type (might be due to invalid IL or missing references) + //IL_06ac: Expected O, but got Unknown + //IL_06b9: Unknown result type (might be due to invalid IL or missing references) + //IL_06c3: Expected O, but got Unknown + //IL_06c5: Unknown result type (might be due to invalid IL or missing references) + //IL_06d1: Unknown result type (might be due to invalid IL or missing references) + //IL_06db: Expected O, but got Unknown + //IL_06de: Unknown result type (might be due to invalid IL or missing references) + //IL_06e8: Expected O, but got Unknown + //IL_06ea: Unknown result type (might be due to invalid IL or missing references) + //IL_06f6: Unknown result type (might be due to invalid IL or missing references) + //IL_0700: Expected O, but got Unknown + //IL_0702: Unknown result type (might be due to invalid IL or missing references) + //IL_070e: Unknown result type (might be due to invalid IL or missing references) + //IL_0718: Expected O, but got Unknown + //IL_071b: Unknown result type (might be due to invalid IL or missing references) + //IL_0725: Expected O, but got Unknown + switch (connectionId) + { + case 1: + MainGrid = (Grid)target; + break; + case 2: + IncluirClienteButton = (MenuItem)target; + IncluirClienteButton.Click += new RoutedEventHandler(Incluir_OnClick); + break; + case 3: + ((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick); + break; + case 4: + ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick); + break; + case 5: + ((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick); + break; + case 6: + ((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick); + break; + case 7: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirAquivoDigital_Click); + break; + case 8: + ((MenuItem)target).Click += new RoutedEventHandler(Tarefa_Click); + break; + case 9: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick); + break; + case 10: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLogEmail_OnClick); + break; + case 11: + ((MenuItem)target).Click += new RoutedEventHandler(MenuItem_Click); + break; + case 12: + TipoDocumentoPrincipalBox = (ComboBox)target; + break; + case 13: + DocumentoPrincipalBox = (TextBox)target; + ((UIElement)DocumentoPrincipalBox).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + ((UIElement)DocumentoPrincipalBox).LostFocus += new RoutedEventHandler(DocumentoPrincipalBox_LostFocus); + break; + case 14: + NomeBox = (TextBox)target; + break; + case 15: + NomeSocialBox = (TextBox)target; + break; + case 16: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + ((UIElement)(DatePicker)target).PreviewTextInput += new TextCompositionEventHandler(base.SomenteData); + break; + case 17: + CaepfBox = (TextBox)target; + break; + case 18: + RneBox = (TextBox)target; + break; + case 19: + CeiBox = (TextBox)target; + break; + case 20: + IdentidadeBox = (TextBox)target; + break; + case 21: + EmissorBox = (TextBox)target; + ((UIElement)EmissorBox).PreviewTextInput += new TextCompositionEventHandler(base.SomenteCaracteres); + break; + case 22: + EstadoEmissorBox = (TextBox)target; + ((UIElement)EstadoEmissorBox).PreviewTextInput += new TextCompositionEventHandler(base.SomenteCaracteres); + break; + case 23: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + ((UIElement)(DatePicker)target).PreviewTextInput += new TextCompositionEventHandler(base.SomenteData); + break; + case 24: + HabilitacaoBox = (TextBox)target; + ((UIElement)HabilitacaoBox).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 25: + CategoriaHabilitacaooBox = (TextBox)target; + ((UIElement)CategoriaHabilitacaooBox).PreviewTextInput += new TextCompositionEventHandler(LetrasHabilitacao); + break; + case 26: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + break; + case 27: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + break; + case 28: + SexoBox = (ComboBox)target; + break; + case 29: + EstadoCivilBox = (ComboBox)target; + break; + case 30: + AutoCompleteProfissao = (AutoCompleteBox)target; + AutoCompleteProfissao.Populating += new PopulatingEventHandler(AutoCompleteProfissaoBox_Populating); + break; + case 31: + AutoCompleteAtividade = (AutoCompleteBox)target; + AutoCompleteAtividade.Populating += new PopulatingEventHandler(AutoCompleteAtividadeBox_Populating); + break; + case 32: + ResponsavelBox = (TextBox)target; + ((UIElement)ResponsavelBox).LostFocus += new RoutedEventHandler(Validar_LostFocus); + break; + case 33: + DocumentoResponsavel = (TextBox)target; + ((UIElement)DocumentoResponsavel).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + ((UIElement)DocumentoResponsavel).LostFocus += new RoutedEventHandler(DocumentoPrincipalBox_LostFocus); + break; + case 34: + EmailBox = (TextBox)target; + ((UIElement)EmailBox).LostFocus += new RoutedEventHandler(Validar_LostFocus); + break; + case 35: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + break; + case 36: + PastaBox = (TextBox)target; + break; + case 37: + AutoCompleteBanco = (AutoCompleteBox)target; + AutoCompleteBanco.Populating += new PopulatingEventHandler(AutoCompleteBancoBox_Populating); + ((UIElement)AutoCompleteBanco).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(AutoCompleteBanco_OnLostKeyboardFocus); + break; + case 38: + AgenciaBox = (TextBox)target; + break; + case 39: + TipoContaBox = (TextBox)target; + break; + case 40: + ContaBox = (TextBox)target; + break; + case 41: + RendaMensalBox = (CurrencyTextBox)target; + break; + case 42: + ((MenuItem)target).Click += new RoutedEventHandler(IncluirTelefone_OnClick); + break; + case 43: + TelefoneListBox = (ListBox)target; + break; + case 49: + ((MenuItem)target).Click += new RoutedEventHandler(IncluirEmail_OnClick); + break; + case 50: + EmailListBox = (ListBox)target; + break; + case 53: + ((MenuItem)target).Click += new RoutedEventHandler(IncluirEndereco_OnClick); + break; + case 54: + EnderecoListBox = (ListBox)target; + break; + case 58: + VinculoBox = (AutoCompleteBox)target; + VinculoBox.Populating += new PopulatingEventHandler(AutoCompleteParentescoBox_Populating); + break; + case 59: + ((MenuItem)target).Click += new RoutedEventHandler(IncluirVinculo_OnClick); + break; + case 61: + NomeOrigemBox = (TextBox)target; + break; + case 62: + ((MenuItem)target).Click += new RoutedEventHandler(IncluirOrigem_OnClick); + break; + case 64: + ((MenuItem)target).Click += new RoutedEventHandler(IncluirMaisContatos_OnClick); + break; + case 65: + ContatosListBox = (ListBox)target; + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_007b: Unknown result type (might be due to invalid IL or missing references) + //IL_0087: Unknown result type (might be due to invalid IL or missing references) + //IL_0091: Expected O, but got Unknown + //IL_0093: Unknown result type (might be due to invalid IL or missing references) + //IL_00a0: Unknown result type (might be due to invalid IL or missing references) + //IL_00aa: Expected O, but got Unknown + //IL_00ac: Unknown result type (might be due to invalid IL or missing references) + //IL_00b9: Unknown result type (might be due to invalid IL or missing references) + //IL_00c3: Expected O, but got Unknown + //IL_00c4: Unknown result type (might be due to invalid IL or missing references) + //IL_00d1: Unknown result type (might be due to invalid IL or missing references) + //IL_00db: Expected O, but got Unknown + //IL_00dd: Unknown result type (might be due to invalid IL or missing references) + //IL_00e9: Unknown result type (might be due to invalid IL or missing references) + //IL_00f3: Expected O, but got Unknown + //IL_00f4: Unknown result type (might be due to invalid IL or missing references) + //IL_0100: Unknown result type (might be due to invalid IL or missing references) + //IL_010a: Expected O, but got Unknown + //IL_010b: Unknown result type (might be due to invalid IL or missing references) + //IL_0118: Unknown result type (might be due to invalid IL or missing references) + //IL_0122: Expected O, but got Unknown + //IL_0124: Unknown result type (might be due to invalid IL or missing references) + //IL_0130: Unknown result type (might be due to invalid IL or missing references) + //IL_013a: Expected O, but got Unknown + //IL_013c: Unknown result type (might be due to invalid IL or missing references) + //IL_0148: Unknown result type (might be due to invalid IL or missing references) + //IL_0152: Expected O, but got Unknown + //IL_0153: Unknown result type (might be due to invalid IL or missing references) + //IL_015f: Unknown result type (might be due to invalid IL or missing references) + //IL_0169: Expected O, but got Unknown + //IL_016a: Unknown result type (might be due to invalid IL or missing references) + //IL_0177: Unknown result type (might be due to invalid IL or missing references) + //IL_0181: Expected O, but got Unknown + //IL_0183: Unknown result type (might be due to invalid IL or missing references) + //IL_018f: Unknown result type (might be due to invalid IL or missing references) + //IL_0199: Expected O, but got Unknown + //IL_019b: Unknown result type (might be due to invalid IL or missing references) + //IL_01a7: Unknown result type (might be due to invalid IL or missing references) + //IL_01b1: Expected O, but got Unknown + //IL_01b2: Unknown result type (might be due to invalid IL or missing references) + //IL_01bf: Unknown result type (might be due to invalid IL or missing references) + //IL_01c9: Expected O, but got Unknown + //IL_01cb: Unknown result type (might be due to invalid IL or missing references) + //IL_01d7: Unknown result type (might be due to invalid IL or missing references) + //IL_01e1: Expected O, but got Unknown + //IL_01e2: Unknown result type (might be due to invalid IL or missing references) + //IL_01ee: Unknown result type (might be due to invalid IL or missing references) + //IL_01f8: Expected O, but got Unknown + //IL_01f9: Unknown result type (might be due to invalid IL or missing references) + //IL_0206: Unknown result type (might be due to invalid IL or missing references) + //IL_0210: Expected O, but got Unknown + //IL_0212: Unknown result type (might be due to invalid IL or missing references) + //IL_021e: Unknown result type (might be due to invalid IL or missing references) + //IL_0228: Expected O, but got Unknown + //IL_022a: Unknown result type (might be due to invalid IL or missing references) + //IL_0236: Unknown result type (might be due to invalid IL or missing references) + //IL_0240: Expected O, but got Unknown + //IL_0242: Unknown result type (might be due to invalid IL or missing references) + //IL_024e: Unknown result type (might be due to invalid IL or missing references) + //IL_0258: Expected O, but got Unknown + //IL_025a: Unknown result type (might be due to invalid IL or missing references) + //IL_0267: Unknown result type (might be due to invalid IL or missing references) + //IL_0271: Expected O, but got Unknown + //IL_0273: Unknown result type (might be due to invalid IL or missing references) + //IL_027f: Unknown result type (might be due to invalid IL or missing references) + //IL_0289: Expected O, but got Unknown + //IL_028a: Unknown result type (might be due to invalid IL or missing references) + //IL_0296: Unknown result type (might be due to invalid IL or missing references) + //IL_02a0: Expected O, but got Unknown + //IL_02a1: Unknown result type (might be due to invalid IL or missing references) + //IL_02ad: Unknown result type (might be due to invalid IL or missing references) + //IL_02b7: Expected O, but got Unknown + //IL_02b8: Unknown result type (might be due to invalid IL or missing references) + //IL_02c4: Unknown result type (might be due to invalid IL or missing references) + //IL_02ce: Expected O, but got Unknown + //IL_02d0: Unknown result type (might be due to invalid IL or missing references) + //IL_02dc: Unknown result type (might be due to invalid IL or missing references) + //IL_02e6: Expected O, but got Unknown + //IL_02e8: Unknown result type (might be due to invalid IL or missing references) + //IL_02f5: Unknown result type (might be due to invalid IL or missing references) + //IL_02ff: Expected O, but got Unknown + //IL_0301: Unknown result type (might be due to invalid IL or missing references) + //IL_030e: Unknown result type (might be due to invalid IL or missing references) + //IL_0318: Expected O, but got Unknown + //IL_0319: Unknown result type (might be due to invalid IL or missing references) + //IL_0326: Unknown result type (might be due to invalid IL or missing references) + //IL_0330: Expected O, but got Unknown + //IL_0332: Unknown result type (might be due to invalid IL or missing references) + //IL_033e: Unknown result type (might be due to invalid IL or missing references) + //IL_0348: Expected O, but got Unknown + switch (connectionId) + { + case 44: + ((Selector)(ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(TipoComboBox_OnSelectionChanged); + break; + case 45: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 46: + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(FormatarTelefone); + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 47: + ((UIElement)(TextBox)target).PreviewGotKeyboardFocus += new KeyboardFocusChangedEventHandler(OrdemBox_OnPreviewGotKeyboardFocus); + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(OrdemBox_OnLostFocus); + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 48: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirTelefone_OnClick); + break; + case 51: + ((UIElement)(TextBox)target).PreviewGotKeyboardFocus += new KeyboardFocusChangedEventHandler(OrdemBox_OnPreviewGotKeyboardFocus); + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(OrdemBox_OnLostFocus); + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 52: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirEmail_OnClick); + break; + case 55: + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(PostcodeBox_OnLostFocus); + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 56: + ((UIElement)(TextBox)target).PreviewGotKeyboardFocus += new KeyboardFocusChangedEventHandler(OrdemBox_OnPreviewGotKeyboardFocus); + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(OrdemBox_OnLostFocus); + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 57: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirEndereco_OnClick); + break; + case 60: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirVinculo_OnClick); + break; + case 63: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirOrigem_OnClick); + break; + case 66: + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(FormatarDocumento); + break; + case 67: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + ((UIElement)(DatePicker)target).PreviewTextInput += new TextCompositionEventHandler(base.SomenteData); + break; + case 68: + ((Selector)(ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(TipoComboBox_OnSelectionChanged); + break; + case 69: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 70: + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(FormatarTelefone); + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 71: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirMaisContatos_OnClick); + break; + case 49: + case 50: + case 53: + case 54: + case 58: + case 59: + case 61: + case 62: + case 64: + case 65: + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Seguros/ComissaoView.cs b/Decompiler/Gestor.Application.Views.Seguros/ComissaoView.cs new file mode 100644 index 0000000..b5b4178 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Seguros/ComissaoView.cs @@ -0,0 +1,1028 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Data; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Threading; +using Gestor.Application.Actions; +using Gestor.Application.Drawers; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.ViewModels.Comissao; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using MaterialDesignThemes.Wpf; +using Xceed.Wpf.AvalonDock.Controls; + +namespace Gestor.Application.Views.Seguros; + +public class ComissaoView : BaseUserControl, IComponentConnector, IStyleConnector +{ + [Serializable] + [CompilerGenerated] + private sealed class _003C_003Ec + { + public static readonly _003C_003Ec _003C_003E9 = new _003C_003Ec(); + + public static MouseButtonEventHandler _003C_003E9__5_0; + + internal void _003CContentLoad_003Eb__5_0(object sender, MouseButtonEventArgs args) + { + } + } + + internal ComboBox UsuarioBox; + + internal ComboBox StatusBox; + + internal ComboBox SeguradoraBox; + + internal ComboBox Seguradora2Box; + + internal DatePicker InicioBox; + + internal DatePicker FimBox; + + internal DataGrid ExtratoGrid; + + internal Card ProgressBar2; + + internal Card ProgressBar; + + internal MenuItem DesfazerExtratoButton; + + internal DatePicker DataBaixaBox; + + internal TextBox FiltroDetalhes; + + internal DataGrid DetalhesGrid; + + internal Grid PainelCritica; + + internal AutoCompleteBox AutoCompleteCliente; + + internal TextBox TipoDocumentoPrincipalBox; + + internal TextBox DocumentoPrincipalBox; + + internal TextBox FiltroApoliceBox; + + internal DataGrid ApoliceGrid; + + internal DataGrid ParcelaGrid; + + internal DataGridTextColumn ParcelaColumn; + + internal DataGrid FaturaGrid; + + private bool _contentLoaded; + + public ComissaoViewModel ViewModel { get; set; } + + public SubTipo _previousSubTipo { get; set; } = (SubTipo)2; + + + public ComissaoView() + { + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + ((FrameworkElement)this).Tag = "COMISSÃO AUTOMÁTICA"; + ViewModel = new ComissaoViewModel(); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + ((FrameworkElement)ExtratoGrid).DataContext = ((FrameworkElement)this).DataContext; + } + + private void ContentLoad() + { + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Expected O, but got Unknown + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Expected O, but got Unknown + //IL_003b: Unknown result type (might be due to invalid IL or missing references) + //IL_0045: Expected O, but got Unknown + //IL_0052: Unknown result type (might be due to invalid IL or missing references) + //IL_005c: Expected O, but got Unknown + //IL_0080: Unknown result type (might be due to invalid IL or missing references) + //IL_008a: Expected O, but got Unknown + //IL_0097: Unknown result type (might be due to invalid IL or missing references) + //IL_00a1: Expected O, but got Unknown + //IL_00c5: Unknown result type (might be due to invalid IL or missing references) + //IL_00cf: Expected O, but got Unknown + //IL_0106: Unknown result type (might be due to invalid IL or missing references) + //IL_0110: Expected O, but got Unknown + //IL_011d: Unknown result type (might be due to invalid IL or missing references) + //IL_0127: Expected O, but got Unknown + //IL_00e9: Unknown result type (might be due to invalid IL or missing references) + //IL_00ee: Unknown result type (might be due to invalid IL or missing references) + //IL_00f4: Expected O, but got Unknown + ((UIElement)DataBaixaBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)DataBaixaBox).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((UIElement)InicioBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)InicioBox).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + InicioBox.SelectedDateChanged += FiltroDataBox_OnSelectedDateChanged; + ((UIElement)FimBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)FimBox).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + FimBox.SelectedDateChanged += FiltroDataBox_OnSelectedDateChanged; + ((Selector)ExtratoGrid).SelectionChanged += new SelectionChangedEventHandler(Grid_OnSelectionChanged); + DataGrid extratoGrid = ExtratoGrid; + object obj = _003C_003Ec._003C_003E9__5_0; + if (obj == null) + { + MouseButtonEventHandler val = delegate + { + }; + _003C_003Ec._003C_003E9__5_0 = val; + obj = (object)val; + } + ((Control)extratoGrid).MouseDoubleClick += (MouseButtonEventHandler)obj; + ((Control)DetalhesGrid).MouseDoubleClick += new MouseButtonEventHandler(DetalhesGrid_OnMouseDoubleClick); + ((Selector)ApoliceGrid).SelectionChanged += new SelectionChangedEventHandler(ApoliceGrid_OnSelectionChanged); + } + + private async void ApoliceGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + DataGrid val = (DataGrid)sender; + if (val == null || ((Selector)val).SelectedIndex >= 0) + { + await ViewModel.SelecionaDocumento((Documento)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null)); + } + } + + private async void Grid_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + DataGrid val = (DataGrid)sender; + if (val != null && ((Selector)val).SelectedIndex >= 0) + { + await ViewModel.SelecionaExtrato((Extrato)((ItemsControl)val).Items[((Selector)val).SelectedIndex]); + } + } + + private async void AutoCompleteBoxDetalhe_OnTextChanged(object sender, RoutedEventArgs e) + { + TextBox val = (TextBox)sender; + await ViewModel.FiltrarDetalhe(((val != null) ? val.Text : null) ?? ""); + } + + private async void AutoCompleteBoxDocumento_OnTextChanged(object sender, RoutedEventArgs e) + { + TextBox val = (TextBox)sender; + await ViewModel.FiltrarApolices(((val != null) ? val.Text : null) ?? ""); + } + + private async void DetalhesGrid_OnMouseDoubleClick(object sender, MouseButtonEventArgs e) + { + DataGrid val = (DataGrid)sender; + if (val == null || ((Selector)val).SelectedIndex >= 0) + { + ViewModel.Loading(isLoading: true); + ViewModel.IsVisibleDetalhes = (Visibility)2; + DetalheExtrato val2 = (DetalheExtrato)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null); + if (val2 != null) + { + await AbrirCritica(val2); + ViewModel.IsVisibleDetalhes = (Visibility)0; + ViewModel.Loading(isLoading: false); + } + } + } + + private async Task AbrirCritica(DetalheExtrato detalhe) + { + List<StatusParcela> list = new List<StatusParcela> + { + (StatusParcela)1, + (StatusParcela)10, + (StatusParcela)12, + (StatusParcela)13 + }; + if (detalhe.Status.HasValue && list.Contains(detalhe.Status.Value)) + { + await ViewModel.ShowMessage("NÃO É POSSÍVEL CRITICAR UMA PARCELA JÁ BAIXADA"); + return; + } + ViewModel.FiltrarDetalheExtrato(((DomainBase)detalhe).Id); + await ViewModel.BuscarCriticado(detalhe); + if (!detalhe.Parcela.HasValue && !detalhe.Documento.HasValue) + { + AutoCompleteCliente.Text = detalhe.Cliente.Trim(); + } + ViewModel.Criticando = true; + ((UIElement)PainelCritica).Visibility = (Visibility)0; + ((UIElement)FiltroDetalhes).Visibility = (Visibility)2; + ((UIElement)DetalhesGrid).Visibility = (Visibility)2; + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: false); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: false); + ViewModel.FiltroApolice = string.Empty; + } + + private void AutoCompleteBox_Populating(object sender, PopulatingEventArgs e) + { + if (e.Parameter.Length < 3) + { + return; + } + e.Cancel = true; + ViewModel.BuscarCliente(ValidationHelper.RemoveDiacritics(e.Parameter.Trim()), null, (TipoFiltroCliente)2).ContinueWith(delegate(Task<List<Cliente>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private async void AtualizarExtrato_OnClick(object sender, RoutedEventArgs e) + { + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: false); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: false); + ViewModel.EnableButtons = false; + await ViewModel.AtualizarExtrato(); + await ViewModel.SelecionaExtrato(ViewModel.SelectedExtrato); + ViewModel.EnableButtons = true; + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: true); + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: true); + } + + private async void CriticarDocumento_OnClick(object sender, RoutedEventArgs e) + { + if (((Selector)DetalhesGrid).SelectedIndex < 0) + { + await ViewModel.ShowMessage("NECESSÁRIO SELECIONAR UMA PARCELA PARA CRITICAR."); + return; + } + SubTipo? subTipo = ViewModel.SelectedDetalhe.SubTipo; + if (subTipo.HasValue && (int)subTipo.GetValueOrDefault() == 1) + { + if (ViewModel.SelectedParcela == null || ((DomainBase)ViewModel.SelectedParcela).Id == 0L) + { + await ViewModel.ShowMessage("PARA CRITICAR ESSE DOCUMENTO É NECESSÁRIO SELECIONAR UMA PARCELA"); + return; + } + } + else if (ViewModel.SelectedDocumento == null || ((DomainBase)ViewModel.SelectedDocumento).Id == 0L) + { + await ViewModel.ShowMessage("PARA CRITICAR ESSE DOCUMENTO É NECESSÁRIO SELECIONAR UM DOCUMENTO"); + return; + } + object obj; + if (((Selector)DetalhesGrid).SelectedIndex < 0) + { + DataGrid detalhesGrid = DetalhesGrid; + if (((detalhesGrid != null) ? new int?(((CollectionView)((ItemsControl)detalhesGrid).Items).Count) : null) >= ((Selector)DetalhesGrid).SelectedIndex) + { + DataGrid detalhesGrid2 = DetalhesGrid; + obj = (object)(DetalheExtrato)((detalhesGrid2 != null) ? ((ItemsControl)detalhesGrid2).Items[((Selector)DetalhesGrid).SelectedIndex] : null); + goto IL_028e; + } + } + obj = ViewModel.SelectedDetalhe; + goto IL_028e; + IL_028e: + DetalheExtrato val = (DetalheExtrato)obj; + if (val != null) + { + await ViewModel.Criticar(val, critica: true); + LimparFiltros(); + } + } + + private async void Desconsiderar_OnClick(object sender, RoutedEventArgs e) + { + if (((Selector)DetalhesGrid).SelectedIndex < 0) + { + await ViewModel.ShowMessage("PARA DESCONSIDERAR O DOCUMENTO É NECESSÁRIO SELECIONAR UMA PARCELA"); + return; + } + DataGrid detalhesGrid = DetalhesGrid; + DetalheExtrato val = (DetalheExtrato)((detalhesGrid != null) ? ((ItemsControl)detalhesGrid).Items[((Selector)DetalhesGrid).SelectedIndex] : null); + if (val != null) + { + await ViewModel.Criticar(val, critica: false); + LimparFiltros(); + } + } + + private void CancelarCritica_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.SelectedDetalhe != null) + { + ViewModel.SelectedDetalhe.Corrigir = false; + } + LimparFiltros(); + } + + private void LimparFiltros() + { + ViewModel.Criticando = false; + ViewModel.FiltrarDetalheExtrato(""); + ((UIElement)PainelCritica).Visibility = (Visibility)2; + ((UIElement)FiltroDetalhes).Visibility = (Visibility)0; + AutoCompleteCliente.Text = string.Empty; + ((UIElement)DetalhesGrid).Visibility = (Visibility)0; + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: true); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: true); + } + + private async void AbrirCritica_OnClick(object sender, RoutedEventArgs e) + { + if (((Selector)DetalhesGrid).SelectedIndex < 0) + { + await ViewModel.ShowMessage("PARA CRITICAR O DOCUMENTO É NECESSÁRIO SELECIONAR UMA PARCELA"); + return; + } + DataGrid detalhesGrid = DetalhesGrid; + DetalheExtrato val = (DetalheExtrato)((detalhesGrid != null) ? ((ItemsControl)detalhesGrid).Items[((Selector)DetalhesGrid).SelectedIndex] : null); + if (val != null) + { + ViewModel.Loading(isLoading: true); + ViewModel.IsVisibleDetalhes = (Visibility)2; + await AbrirCritica(val); + ViewModel.IsVisibleDetalhes = (Visibility)0; + ViewModel.Loading(isLoading: false); + } + } + + private async void BaixarSelecionado_OnClick(object sender, RoutedEventArgs e) + { + ((MenuItem)sender).Click -= new RoutedEventHandler(BaixarSelecionado_OnClick); + if (ViewModel.SelectedExtrato == null) + { + ((MenuItem)sender).Click += new RoutedEventHandler(BaixarSelecionado_OnClick); + return; + } + if (!(await ViewModel.ShowMessage("DESEJA BAIXAR TODAS AS PARCELAS PENDENTES DO EXTRATO " + ViewModel.SelectedExtrato.Numero + "?", "SIM", "NÃO"))) + { + ((MenuItem)sender).Click += new RoutedEventHandler(BaixarSelecionado_OnClick); + return; + } + ViewModel.IsVisible = (Visibility)2; + ViewModel.IsVisibleDetalhes = (Visibility)2; + ((UIElement)ProgressBar).Visibility = (Visibility)0; + ViewModel.EnableButtons = false; + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: false); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: false); + ViewModel.EnableButtons = false; + await ViewModel.BaixarExtrato(); + ViewModel.EnableButtons = true; + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: true); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: true); + ViewModel.EnableButtons = true; + ((UIElement)ProgressBar).Visibility = (Visibility)2; + ViewModel.IsVisibleDetalhes = (Visibility)0; + ViewModel.IsVisible = (Visibility)0; + ((MenuItem)sender).Click += new RoutedEventHandler(BaixarSelecionado_OnClick); + } + + private async void ExcluirExtrato_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.SelectedExtrato != null && await ViewModel.ShowMessage("DESEJA EXCLUIR O EXTRATO " + ViewModel.SelectedExtrato.Numero + "?", "SIM", "NÃO")) + { + ViewModel.IsVisible = (Visibility)2; + ViewModel.IsVisibleDetalhes = (Visibility)2; + ((UIElement)ProgressBar).Visibility = (Visibility)0; + ViewModel.EnableButtons = false; + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: false); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: false); + await ViewModel.ExcluirExtrato(); + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: true); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: true); + ViewModel.EnableButtons = true; + ((UIElement)ProgressBar).Visibility = (Visibility)2; + ViewModel.IsVisibleDetalhes = (Visibility)0; + ViewModel.IsVisible = (Visibility)0; + } + } + + private async void DesfazerExtrato_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.SelectedExtrato != null && await ViewModel.ShowMessage("DESEJA DESFAZER A BAIXA DO EXTRATO " + ViewModel.SelectedExtrato.Numero + "?", "SIM", "NÃO")) + { + ViewModel.IsVisible = (Visibility)2; + ViewModel.IsVisibleDetalhes = (Visibility)2; + ((UIElement)ProgressBar).Visibility = (Visibility)0; + ViewModel.EnableButtons = false; + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: false); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: false); + await ViewModel.DesfazerExtrato(); + ViewModel.EnableButtons = true; + ((UIElement)ProgressBar).Visibility = (Visibility)2; + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: true); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: true); + ViewModel.IsVisibleDetalhes = (Visibility)0; + ViewModel.IsVisible = (Visibility)0; + } + } + + private async void DesfazerParcela_OnClick(object sender, RoutedEventArgs e) + { + DataGrid detalhesGrid = DetalhesGrid; + DetalheExtrato detalhe = (DetalheExtrato)((detalhesGrid != null) ? ((ItemsControl)detalhesGrid).Items[((Selector)DetalhesGrid).SelectedIndex] : null); + if (detalhe != null && await ViewModel.ShowMessage("DESEJA DESFAZER A BAIXA DA PARCELA DO CLIENTE " + detalhe.Cliente + "?", "SIM", "NÃO")) + { + ViewModel.Loading(isLoading: true); + ViewModel.IsVisibleDetalhes = (Visibility)2; + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: false); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: false); + ViewModel.EnableButtons = false; + bool desfeito = await ViewModel.DesfazerParcela(detalhe); + await ViewModel.CarregaDetalhes(ViewModel.SelectedExtrato); + ViewModel.ToggleSnackBar(desfeito ? "PARCELA DESFEITA COM SUCESSO" : "NÃO FOI POSSÍVEL DESFAZER A BAIXA DA PARCELA"); + if (desfeito && detalhe.Parcela.HasValue) + { + ViewModel.RegistrarAcao($"DESFEZ PARCELA DE ID \"{detalhe.Parcela}\"", detalhe.Parcela.Value, (TipoTela)35); + } + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: true); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: true); + ViewModel.EnableButtons = true; + ViewModel.IsVisibleDetalhes = (Visibility)0; + ViewModel.Loading(isLoading: false); + } + } + + private void FiltroDataBox_OnSelectedDateChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_0037: Unknown result type (might be due to invalid IL or missing references) + DatePicker val = (DatePicker)sender; + if ((int)val != 0 && val.SelectedDate.HasValue) + { + ViewModel.SelecionaSeguradora(ViewModel.SelectedSeguradora, ViewModel.SelectedStatusExtrato); + } + } + + private async void AbrirAquivoDigital_Click(object sender, RoutedEventArgs e) + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)7).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)7) + "."); + return; + } + if (ViewModel.SelectedExtrato == null) + { + await ViewModel.ShowMessage("SELECIONE ALGUM EXTRATO PARA VISUALIZAR O ARQUIVO DIGITAL"); + return; + } + List<IndiceArquivoDigital> list = await new ArquivoDigitalServico().BuscarPorTipo((TipoArquivoDigital)7, ((DomainBase)ViewModel.SelectedExtrato).Id); + if (list.Count == 1) + { + ViewModel.Download(list.First()); + return; + } + FiltroArquivoDigital filtro = new FiltroArquivoDigital + { + Id = ((DomainBase)ViewModel.SelectedExtrato).Id, + Tipo = (TipoArquivoDigital)7, + Parente = ViewModel.SelectedExtrato + }; + ViewModel.ShowDrawer(new ArquivoDigitalDrawer(filtro), 0, close: false); + } + + private void AdicionarFiltro_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AdcionarFiltro(); + } + + private void ExcluirFiltro_onClick(object sender, RoutedEventArgs e) + { + Chip val = (Chip)((sender is Chip) ? sender : null); + if (val != null) + { + ListBox val2 = Extentions.FindVisualAncestor<ListBox>((DependencyObject)(object)val); + string text = (string)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)]; + if (text != null) + { + ViewModel.ExcluirFiltro(text); + } + } + } + + private async void AcessarApolice_OnClick(object sender, RoutedEventArgs e) + { + Button val = (Button)sender; + if (((FrameworkElement)val).DataContext == null || !((FrameworkElement)val).DataContext.GetType().Name.Equals("DetalheExtrato")) + { + return; + } + DetalheExtrato val2 = (DetalheExtrato)((FrameworkElement)val).DataContext; + if ((val2 == null || !val2.Documento.HasValue) && (val2 == null || !val2.Parcela.HasValue)) + { + return; + } + Documento val3; + if (val2.Documento.HasValue) + { + val3 = await ViewModel.CarregaApolice(val2.Documento.Value); + } + else + { + Documento val4 = ((!val2.Parcela.HasValue) ? null : (await ViewModel.CarregaApoliceParcela(val2.Parcela.Value))); + val3 = val4; + } + Documento val5 = val3; + if (val5 != null) + { + if (val5.Excluido) + { + await ViewModel.ShowMessage("NÃO É POSSIVE VISUALIZAR UM DOCUMENTO EXCLUIDO."); + } + else + { + ((Window)new HosterWindow((ContentControl)(object)new ApoliceView(val5, lockInsert: true, invoke: false, (AcessoApolice)0, 0L, consultaTela: true), "CADASTRO DE APÓLICE - " + val5.Controle.Cliente.Nome + " - " + val5.Apolice)).Show(); + } + } + } + + private async void AcessarApoliceCritica_OnClick(object sender, RoutedEventArgs e) + { + ((Window)new HosterWindow((ContentControl)(object)new ApoliceView(await ViewModel.CarregaApolice(((DomainBase)ViewModel.SelectedDocumento).Id), lockInsert: true, invoke: false, (AcessoApolice)0, 0L), "CADASTRO DE APÓLICE - " + ViewModel.SelectedCliente.Nome + " - " + ViewModel.SelectedDocumento.Apolice)).Show(); + } + + private async void DesconsiderarTodas_Click(object sender, RoutedEventArgs e) + { + if (await ViewModel.ShowMessage("ESSA OPÇÃO DESCONSIDERA TODAS AS PARCELAS COM O STATUS DE DOCUMENTO NÃO ENCONTRADO OU PARCELA NÃO ENCONTRADA DO EXTRATO." + Environment.NewLine + "DESEJA CONTINUAR?", "SIM", "NÃO")) + { + await ViewModel.CriticarTodos(((DomainBase)ViewModel.SelectedExtrato).Id); + LimparFiltros(); + } + } + + private async void DesconsiderarSelacionadas_Click(object sender, RoutedEventArgs e) + { + if (await ViewModel.ShowMessage("ESSA OPÇÃO DESCONSIDERA TODAS AS PARCELAS QUE FORAM SELECIONADAS, COLOCANDO STATUS DE DESCONSIDERADA PELO USUÁRIO" + Environment.NewLine + "DESEJA CONTINUAR?", "SIM", "NÃO")) + { + await ViewModel.DesconsiderarSelecionadas(); + } + } + + private async void ArquivoDigitalButton_OnClick(object sender, RoutedEventArgs e) + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)2).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)2) + "."); + return; + } + ViewModel.SelectedDocumento.Controle.Cliente = ViewModel.SelectedCliente; + FiltroArquivoDigital filtro = new FiltroArquivoDigital + { + Id = ((DomainBase)ViewModel.SelectedDocumento).Id, + Tipo = (TipoArquivoDigital)2, + Parente = ViewModel.SelectedDocumento + }; + ViewModel.ShowDrawer(new ArquivoDigitalDrawer(filtro), 0, close: false); + } + + private void Atualizar_OnClick(object sender, RoutedEventArgs e) + { + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + ViewModel.SelecionaSeguradora(ViewModel.SelectedSeguradora, ViewModel.SelectedStatusExtrato, ViewModel.SelectedExtrato); + } + + private async void Imprimir_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.SelectedExtrato != null) + { + string value = await ViewModel.GerarHtml(); + if (!string.IsNullOrEmpty(value)) + { + string tempPath = Path.GetTempPath(); + string text = string.Format("{0}{1}_{2:ddMMyyyyhhmmss}.html", tempPath, new Regex("[" + Regex.Escape(new string(Path.GetInvalidFileNameChars()) + new string(Path.GetInvalidPathChars())) + "]").Replace("EXTRATO COMISSÃO", ""), Funcoes.GetNetworkTime()); + StreamWriter streamWriter = new StreamWriter(text, append: true, Encoding.UTF8); + streamWriter.Write(value); + streamWriter.Close(); + Process.Start(text); + ViewModel.RegistrarAcao($"IMPRIMIU EXTRATO DE ID \"{((DomainBase)ViewModel.SelectedExtrato).Id}\"", ((DomainBase)ViewModel.SelectedExtrato).Id, (TipoTela)35); + } + } + } + + private async void FinalizarSelecionado_OnClick(object sender, RoutedEventArgs e) + { + ((MenuItem)sender).Click -= new RoutedEventHandler(FinalizarSelecionado_OnClick); + if (ViewModel.SelectedExtrato == null) + { + ((MenuItem)sender).Click += new RoutedEventHandler(FinalizarSelecionado_OnClick); + return; + } + if (!(await ViewModel.ShowMessage("DESEJA FINALIZAR O EXTRATO " + ViewModel.SelectedExtrato.Numero + "?" + Environment.NewLine + "O EXTRATO SERÁ MARCADO COMO BAIXADO.", "SIM", "NÃO"))) + { + ((MenuItem)sender).Click += new RoutedEventHandler(FinalizarSelecionado_OnClick); + return; + } + ViewModel.IsVisible = (Visibility)2; + ViewModel.IsVisibleDetalhes = (Visibility)2; + ((UIElement)ProgressBar).Visibility = (Visibility)0; + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: false); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: false); + ViewModel.EnableButtons = false; + await ViewModel.FinalizarExtrato(); + ViewModel.EnableButtons = true; + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: true); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: true); + ((UIElement)ProgressBar).Visibility = (Visibility)2; + ViewModel.IsVisibleDetalhes = (Visibility)0; + ViewModel.IsVisible = (Visibility)0; + ((MenuItem)sender).Click += new RoutedEventHandler(FinalizarSelecionado_OnClick); + } + + private void Subtipo_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0015: Expected O, but got Unknown + //IL_001b: Unknown result type (might be due to invalid IL or missing references) + //IL_0021: Invalid comparison between Unknown and I4 + //IL_002a: Unknown result type (might be due to invalid IL or missing references) + //IL_0030: Expected O, but got Unknown + //IL_0036: Unknown result type (might be due to invalid IL or missing references) + //IL_003c: Invalid comparison between Unknown and I4 + //IL_0061: Unknown result type (might be due to invalid IL or missing references) + //IL_0067: Invalid comparison between Unknown and I4 + //IL_006b: Unknown result type (might be due to invalid IL or missing references) + if (!ViewModel.IsEnabled) + { + return; + } + ComboBox val = (ComboBox)sender; + if ((int)(SubTipo)((Selector)val).SelectedItem == 1) + { + DetalheExtrato val2 = (DetalheExtrato)((FrameworkElement)val).DataContext; + if (((int)(SubTipo)((Selector)val).SelectedItem == 1 && val2.NumeroParcela == "999") || (!val2.IsNormal && (int)val2.SubTipo.GetValueOrDefault() == 1)) + { + ((Selector)val).SelectedItem = _previousSubTipo; + } + } + } + + private void Subtipo_OnDropDownOpened(object sender, EventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + ComboBox val = (ComboBox)sender; + _previousSubTipo = (SubTipo)((Selector)val).SelectedItem; + } + + private async void BaixarParcelasSelecionadas_OnClick(object sender, RoutedEventArgs e) + { + ((MenuItem)sender).Click -= new RoutedEventHandler(BaixarParcelasSelecionadas_OnClick); + if (ViewModel.SelectedExtrato == null) + { + ((MenuItem)sender).Click += new RoutedEventHandler(BaixarParcelasSelecionadas_OnClick); + return; + } + if (!(await ViewModel.ShowMessage("DESEJA BAIXAR TODAS AS PARCELAS SELECIONADAS DO EXTRATO " + ViewModel.SelectedExtrato.Numero + "?", "SIM", "NÃO"))) + { + ((MenuItem)sender).Click += new RoutedEventHandler(BaixarParcelasSelecionadas_OnClick); + return; + } + ViewModel.IsVisible = (Visibility)2; + ViewModel.IsVisibleDetalhes = (Visibility)2; + ((UIElement)ProgressBar).Visibility = (Visibility)0; + ViewModel.EnableButtons = false; + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: false); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: false); + ViewModel.EnableButtons = false; + await ViewModel.BaixarExtrato(selecionados: true); + ViewModel.EnableButtons = true; + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: true); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: true); + ViewModel.EnableButtons = true; + ((UIElement)ProgressBar).Visibility = (Visibility)2; + ViewModel.IsVisibleDetalhes = (Visibility)0; + ViewModel.IsVisible = (Visibility)0; + ViewModel.WorkOnSelectedStatus(); + ((MenuItem)sender).Click += new RoutedEventHandler(BaixarParcelasSelecionadas_OnClick); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/seguros/comissaoview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_00bf: Unknown result type (might be due to invalid IL or missing references) + //IL_00c9: Expected O, but got Unknown + //IL_00cc: Unknown result type (might be due to invalid IL or missing references) + //IL_00d6: Expected O, but got Unknown + //IL_00d9: Unknown result type (might be due to invalid IL or missing references) + //IL_00e3: Expected O, but got Unknown + //IL_00e6: Unknown result type (might be due to invalid IL or missing references) + //IL_00f0: Expected O, but got Unknown + //IL_00f3: Unknown result type (might be due to invalid IL or missing references) + //IL_00fd: Expected O, but got Unknown + //IL_010a: Unknown result type (might be due to invalid IL or missing references) + //IL_0114: Expected O, but got Unknown + //IL_0117: Unknown result type (might be due to invalid IL or missing references) + //IL_0121: Expected O, but got Unknown + //IL_012e: Unknown result type (might be due to invalid IL or missing references) + //IL_0138: Expected O, but got Unknown + //IL_013a: Unknown result type (might be due to invalid IL or missing references) + //IL_0146: Unknown result type (might be due to invalid IL or missing references) + //IL_0150: Expected O, but got Unknown + //IL_0152: Unknown result type (might be due to invalid IL or missing references) + //IL_015e: Unknown result type (might be due to invalid IL or missing references) + //IL_0168: Expected O, but got Unknown + //IL_016b: Unknown result type (might be due to invalid IL or missing references) + //IL_0175: Expected O, but got Unknown + //IL_0178: Unknown result type (might be due to invalid IL or missing references) + //IL_0182: Expected O, but got Unknown + //IL_0185: Unknown result type (might be due to invalid IL or missing references) + //IL_018f: Expected O, but got Unknown + //IL_0191: Unknown result type (might be due to invalid IL or missing references) + //IL_019d: Unknown result type (might be due to invalid IL or missing references) + //IL_01a7: Expected O, but got Unknown + //IL_01a9: Unknown result type (might be due to invalid IL or missing references) + //IL_01b5: Unknown result type (might be due to invalid IL or missing references) + //IL_01bf: Expected O, but got Unknown + //IL_01c1: Unknown result type (might be due to invalid IL or missing references) + //IL_01cd: Unknown result type (might be due to invalid IL or missing references) + //IL_01d7: Expected O, but got Unknown + //IL_01d9: Unknown result type (might be due to invalid IL or missing references) + //IL_01e5: Unknown result type (might be due to invalid IL or missing references) + //IL_01ef: Expected O, but got Unknown + //IL_01f1: Unknown result type (might be due to invalid IL or missing references) + //IL_01fd: Unknown result type (might be due to invalid IL or missing references) + //IL_0207: Expected O, but got Unknown + //IL_0209: Unknown result type (might be due to invalid IL or missing references) + //IL_0215: Unknown result type (might be due to invalid IL or missing references) + //IL_021f: Expected O, but got Unknown + //IL_0222: Unknown result type (might be due to invalid IL or missing references) + //IL_022c: Expected O, but got Unknown + //IL_0239: Unknown result type (might be due to invalid IL or missing references) + //IL_0243: Expected O, but got Unknown + //IL_0245: Unknown result type (might be due to invalid IL or missing references) + //IL_0251: Unknown result type (might be due to invalid IL or missing references) + //IL_025b: Expected O, but got Unknown + //IL_025d: Unknown result type (might be due to invalid IL or missing references) + //IL_0269: Unknown result type (might be due to invalid IL or missing references) + //IL_0273: Expected O, but got Unknown + //IL_0275: Unknown result type (might be due to invalid IL or missing references) + //IL_0281: Unknown result type (might be due to invalid IL or missing references) + //IL_028b: Expected O, but got Unknown + //IL_028d: Unknown result type (might be due to invalid IL or missing references) + //IL_0299: Unknown result type (might be due to invalid IL or missing references) + //IL_02a3: Expected O, but got Unknown + //IL_02a6: Unknown result type (might be due to invalid IL or missing references) + //IL_02b0: Expected O, but got Unknown + //IL_02bd: Unknown result type (might be due to invalid IL or missing references) + //IL_02c7: Expected O, but got Unknown + //IL_02ca: Unknown result type (might be due to invalid IL or missing references) + //IL_02d4: Expected O, but got Unknown + //IL_02e1: Unknown result type (might be due to invalid IL or missing references) + //IL_02eb: Expected O, but got Unknown + //IL_02ed: Unknown result type (might be due to invalid IL or missing references) + //IL_02f9: Unknown result type (might be due to invalid IL or missing references) + //IL_0303: Expected O, but got Unknown + //IL_0305: Unknown result type (might be due to invalid IL or missing references) + //IL_0311: Unknown result type (might be due to invalid IL or missing references) + //IL_031b: Expected O, but got Unknown + //IL_031e: Unknown result type (might be due to invalid IL or missing references) + //IL_0328: Expected O, but got Unknown + //IL_032b: Unknown result type (might be due to invalid IL or missing references) + //IL_0335: Expected O, but got Unknown + //IL_0338: Unknown result type (might be due to invalid IL or missing references) + //IL_0342: Expected O, but got Unknown + //IL_034f: Unknown result type (might be due to invalid IL or missing references) + //IL_0359: Expected O, but got Unknown + //IL_035c: Unknown result type (might be due to invalid IL or missing references) + //IL_0366: Expected O, but got Unknown + //IL_0369: Unknown result type (might be due to invalid IL or missing references) + //IL_0373: Expected O, but got Unknown + //IL_0376: Unknown result type (might be due to invalid IL or missing references) + //IL_0380: Expected O, but got Unknown + //IL_038d: Unknown result type (might be due to invalid IL or missing references) + //IL_0397: Expected O, but got Unknown + //IL_039a: Unknown result type (might be due to invalid IL or missing references) + //IL_03a4: Expected O, but got Unknown + //IL_03a7: Unknown result type (might be due to invalid IL or missing references) + //IL_03b1: Expected O, but got Unknown + //IL_03b4: Unknown result type (might be due to invalid IL or missing references) + //IL_03be: Expected O, but got Unknown + //IL_03c1: Unknown result type (might be due to invalid IL or missing references) + //IL_03cb: Expected O, but got Unknown + switch (connectionId) + { + case 1: + UsuarioBox = (ComboBox)target; + break; + case 2: + StatusBox = (ComboBox)target; + break; + case 3: + SeguradoraBox = (ComboBox)target; + break; + case 4: + Seguradora2Box = (ComboBox)target; + break; + case 5: + InicioBox = (DatePicker)target; + ((UIElement)InicioBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + break; + case 6: + FimBox = (DatePicker)target; + ((UIElement)FimBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + break; + case 7: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Atualizar_OnClick); + break; + case 8: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AdicionarFiltro_OnClick); + break; + case 10: + ExtratoGrid = (DataGrid)target; + break; + case 11: + ProgressBar2 = (Card)target; + break; + case 12: + ProgressBar = (Card)target; + break; + case 13: + ((MenuItem)target).Click += new RoutedEventHandler(AtualizarExtrato_OnClick); + break; + case 14: + ((MenuItem)target).Click += new RoutedEventHandler(FinalizarSelecionado_OnClick); + break; + case 15: + ((MenuItem)target).Click += new RoutedEventHandler(BaixarParcelasSelecionadas_OnClick); + break; + case 16: + ((MenuItem)target).Click += new RoutedEventHandler(BaixarSelecionado_OnClick); + break; + case 17: + ((MenuItem)target).Click += new RoutedEventHandler(DesconsiderarTodas_Click); + break; + case 18: + ((MenuItem)target).Click += new RoutedEventHandler(DesconsiderarSelacionadas_Click); + break; + case 19: + DesfazerExtratoButton = (MenuItem)target; + DesfazerExtratoButton.Click += new RoutedEventHandler(DesfazerExtrato_OnClick); + break; + case 20: + ((MenuItem)target).Click += new RoutedEventHandler(ExcluirExtrato_OnClick); + break; + case 21: + ((MenuItem)target).Click += new RoutedEventHandler(CriticarDocumento_OnClick); + break; + case 22: + ((MenuItem)target).Click += new RoutedEventHandler(Desconsiderar_OnClick); + break; + case 23: + ((MenuItem)target).Click += new RoutedEventHandler(CancelarCritica_OnClick); + break; + case 24: + DataBaixaBox = (DatePicker)target; + ((UIElement)DataBaixaBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + break; + case 25: + FiltroDetalhes = (TextBox)target; + ((TextBoxBase)FiltroDetalhes).TextChanged += new TextChangedEventHandler(AutoCompleteBoxDetalhe_OnTextChanged); + break; + case 26: + ((MenuItem)target).Click += new RoutedEventHandler(Imprimir_OnClick); + break; + case 27: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirAquivoDigital_Click); + break; + case 28: + DetalhesGrid = (DataGrid)target; + break; + case 34: + PainelCritica = (Grid)target; + break; + case 35: + AutoCompleteCliente = (AutoCompleteBox)target; + AutoCompleteCliente.Populating += new PopulatingEventHandler(AutoCompleteBox_Populating); + break; + case 36: + TipoDocumentoPrincipalBox = (TextBox)target; + break; + case 37: + DocumentoPrincipalBox = (TextBox)target; + break; + case 38: + FiltroApoliceBox = (TextBox)target; + ((TextBoxBase)FiltroApoliceBox).TextChanged += new TextChangedEventHandler(AutoCompleteBoxDocumento_OnTextChanged); + break; + case 39: + ApoliceGrid = (DataGrid)target; + break; + case 42: + ParcelaGrid = (DataGrid)target; + break; + case 43: + ParcelaColumn = (DataGridTextColumn)target; + break; + case 44: + FaturaGrid = (DataGrid)target; + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_0044: Unknown result type (might be due to invalid IL or missing references) + //IL_0050: Unknown result type (might be due to invalid IL or missing references) + //IL_005a: Expected O, but got Unknown + //IL_005c: Unknown result type (might be due to invalid IL or missing references) + //IL_0068: Unknown result type (might be due to invalid IL or missing references) + //IL_0072: Expected O, but got Unknown + //IL_0074: Unknown result type (might be due to invalid IL or missing references) + //IL_008b: Unknown result type (might be due to invalid IL or missing references) + //IL_0097: Unknown result type (might be due to invalid IL or missing references) + //IL_00a1: Expected O, but got Unknown + //IL_00a3: Unknown result type (might be due to invalid IL or missing references) + //IL_00af: Unknown result type (might be due to invalid IL or missing references) + //IL_00b9: Expected O, but got Unknown + //IL_00bb: Unknown result type (might be due to invalid IL or missing references) + //IL_00c7: Unknown result type (might be due to invalid IL or missing references) + //IL_00d1: Expected O, but got Unknown + //IL_00d3: Unknown result type (might be due to invalid IL or missing references) + //IL_00df: Unknown result type (might be due to invalid IL or missing references) + //IL_00e9: Expected O, but got Unknown + //IL_00eb: Unknown result type (might be due to invalid IL or missing references) + //IL_00f7: Unknown result type (might be due to invalid IL or missing references) + //IL_0101: Expected O, but got Unknown + //IL_0103: Unknown result type (might be due to invalid IL or missing references) + //IL_010f: Unknown result type (might be due to invalid IL or missing references) + //IL_0119: Expected O, but got Unknown + switch (connectionId) + { + case 9: + ((Chip)target).DeleteClick += new RoutedEventHandler(ExcluirFiltro_onClick); + break; + case 29: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AcessarApolice_OnClick); + break; + case 30: + ((ComboBox)target).DropDownOpened += Subtipo_OnDropDownOpened; + ((Selector)(ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(Subtipo_OnSelectionChanged); + break; + case 31: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AbrirCritica_OnClick); + break; + case 32: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Desconsiderar_OnClick); + break; + case 33: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(DesfazerParcela_OnClick); + break; + case 40: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AcessarApoliceCritica_OnClick); + break; + case 41: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ArquivoDigitalButton_OnClick); + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Seguros/ConsultaOriginalView.cs b/Decompiler/Gestor.Application.Views.Seguros/ConsultaOriginalView.cs new file mode 100644 index 0000000..ccc4de0 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Seguros/ConsultaOriginalView.cs @@ -0,0 +1,1317 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Data; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Media; +using System.Windows.Threading; +using Gestor.Application.Actions; +using Gestor.Application.Drawers; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.ViewModels; +using Gestor.Application.ViewModels.Seguros; +using Gestor.Application.Views.Ferramentas; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.MalaDireta; +using Gestor.Model.Domain.Relatorios.ClientesAtivosInativos; +using Gestor.Model.Domain.Seguros; +using MaterialDesignThemes.Wpf; + +namespace Gestor.Application.Views.Seguros; + +public class ConsultaOriginalView : BaseUserControl, IComponentConnector, IStyleConnector +{ + public ConsultaViewModel ViewModel; + + private bool _carregarDocumetos = true; + + internal RadioButton ApoliceRadioButton; + + internal RadioButton EndossoRadioButton; + + internal MenuItem AcessarDocumentoMenuItem; + + internal DataGrid ApoliceGrid; + + internal DataGridTextColumn NomeField; + + internal DataGridTextColumn ApelidoField; + + internal DataGridTextColumn ApolicesComissaoColumn; + + internal DataGrid EndossoGrid; + + internal DataGridTextColumn EndossosComissaoColumn; + + internal WrapPanel Comissao; + + internal DataGrid ParcelaGrid; + + internal DataGridTextColumn ParcelasTotalColumn; + + internal DataGridTextColumn ParcelasRealizadoColumn; + + internal DataGridTextColumn ParcelasComissaoColumn; + + internal DataGridTextColumn ParcelasReciboColumn; + + internal DataGridTextColumn ParcelasValorComissaoDescColumn; + + internal DataGridTemplateColumn MaisInformacoesColumn; + + internal RadioButton AtivosRadioButton; + + internal RadioButton ApoliceItensRadioButton; + + internal RadioButton EndossoItensRadioButton; + + internal RadioButton InativosRadioButton; + + internal DataGrid ItemGrid; + + private bool _contentLoaded; + + private Documento _documentoAssistencia { get; set; } + + private string _linkAssistencia { get; set; } + + public ConsultaOriginalView(ConsultaViewModel viewModel) + { + ((FrameworkElement)this).Tag = "CONSULTA DE DOCUMENTOS"; + ViewModel = viewModel ?? new ConsultaViewModel(); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Gestor.Application.Actions.Actions.UpdateRadioApolice = (Action<int>)Delegate.Combine(Gestor.Application.Actions.Actions.UpdateRadioApolice, new Action<int>(SelecionarRadios)); + Gestor.Application.Actions.Actions.ScrollDocumento = (Action)Delegate.Combine(Gestor.Application.Actions.Actions.ScrollDocumento, new Action(ScrollDocumento)); + Gestor.Application.Actions.Actions.ScrollToItem = ScrollToItem; + Gestor.Application.Actions.Actions.ScrollToItem = (Action)Delegate.Combine(Gestor.Application.Actions.Actions.ScrollToItem, new Action(ScrollToItem)); + ((FrameworkElement)ItemGrid).DataContext = ViewModel; + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + } + + private void ScrollToItem() + { + if (((Selector)ItemGrid).SelectedItem != null) + { + ScrollToIndex(ItemGrid, ((Selector)ItemGrid).SelectedIndex); + } + } + + private void ContentLoad() + { + //IL_00a6: Unknown result type (might be due to invalid IL or missing references) + //IL_00b0: Expected O, but got Unknown + //IL_00bd: Unknown result type (might be due to invalid IL or missing references) + //IL_00c7: Expected O, but got Unknown + //IL_00d4: Unknown result type (might be due to invalid IL or missing references) + //IL_00de: Expected O, but got Unknown + //IL_00eb: Unknown result type (might be due to invalid IL or missing references) + //IL_00f5: Expected O, but got Unknown + //IL_0102: Unknown result type (might be due to invalid IL or missing references) + //IL_010c: Expected O, but got Unknown + //IL_0119: Unknown result type (might be due to invalid IL or missing references) + //IL_0123: Expected O, but got Unknown + //IL_0130: Unknown result type (might be due to invalid IL or missing references) + //IL_013a: Expected O, but got Unknown + //IL_0147: Unknown result type (might be due to invalid IL or missing references) + //IL_0151: Expected O, but got Unknown + //IL_015e: Unknown result type (might be due to invalid IL or missing references) + //IL_0168: Expected O, but got Unknown + //IL_0175: Unknown result type (might be due to invalid IL or missing references) + //IL_017f: Expected O, but got Unknown + //IL_018c: Unknown result type (might be due to invalid IL or missing references) + //IL_0196: Expected O, but got Unknown + //IL_01a3: Unknown result type (might be due to invalid IL or missing references) + //IL_01ad: Expected O, but got Unknown + //IL_01c0: Unknown result type (might be due to invalid IL or missing references) + //IL_01f6: Unknown result type (might be due to invalid IL or missing references) + //IL_0208: Unknown result type (might be due to invalid IL or missing references) + //IL_0217: Unknown result type (might be due to invalid IL or missing references) + //IL_024d: Unknown result type (might be due to invalid IL or missing references) + //IL_025c: Unknown result type (might be due to invalid IL or missing references) + //IL_026e: Unknown result type (might be due to invalid IL or missing references) + //IL_0283: Unknown result type (might be due to invalid IL or missing references) + //IL_028f: Unknown result type (might be due to invalid IL or missing references) + if (ConsultaViewModel.DocumentoSelecionado != null && ConsultaViewModel.DocumentoSelecionado.Tipo != 0) + { + ViewModel.FilterDocumento = 1; + } + ((DataGridColumn)NomeField).Visibility = (Visibility)(ViewModel.Apelido ? 2 : 0); + ((DataGridColumn)ApelidoField).Visibility = (Visibility)((!ViewModel.Apelido) ? 2 : 0); + ((ToggleButton)ApoliceRadioButton).IsChecked = ViewModel.FilterDocumento == 0; + ((ToggleButton)EndossoRadioButton).IsChecked = ViewModel.FilterDocumento == 1; + AjustaItem(); + ((Selector)ApoliceGrid).SelectionChanged += new SelectionChangedEventHandler(ApoliceGrid_OnSelectionChanged); + ((Control)ParcelaGrid).MouseDoubleClick += new MouseButtonEventHandler(ParcelaGrid_OnMouseDoubleClick); + ((Selector)EndossoGrid).SelectionChanged += new SelectionChangedEventHandler(EndossoGrid_OnSelectionChanged); + ((Control)EndossoGrid).MouseDoubleClick += new MouseButtonEventHandler(EndossoGrid_OnMouseDoubleClick); + ((ToggleButton)AtivosRadioButton).Checked += new RoutedEventHandler(Documento_OnChecked); + ((ToggleButton)ApoliceItensRadioButton).Checked += new RoutedEventHandler(Documento_OnChecked); + ((ToggleButton)EndossoItensRadioButton).Checked += new RoutedEventHandler(Documento_OnChecked); + ((ToggleButton)InativosRadioButton).Checked += new RoutedEventHandler(Documento_OnChecked); + ((ToggleButton)ApoliceRadioButton).Checked += new RoutedEventHandler(Documento_OnChecked); + ((ToggleButton)EndossoRadioButton).Checked += new RoutedEventHandler(Documento_OnChecked); + ((Selector)ItemGrid).SelectionChanged += new SelectionChangedEventHandler(ItemGrid_OnSelectionChanged); + ((Control)ItemGrid).MouseDoubleClick += new MouseButtonEventHandler(ItemGrid_OnMouseDoubleClick); + Visibility val = (Visibility)(ViewModel.Restricao((TipoRestricao)14) ? 2 : 0); + ViewModel.ComissaoValorVisibility = (Visibility)(ViewModel.Restricao((TipoRestricao)14) ? 2 : 0); + bool flag = ViewModel.Restricao((TipoRestricao)95); + ((DataGridColumn)ApolicesComissaoColumn).Visibility = (Visibility)((!flag) ? ((int)val) : 0); + ((DataGridColumn)EndossosComissaoColumn).Visibility = (Visibility)((!flag) ? ((int)val) : 0); + ((UIElement)Comissao).Visibility = val; + bool flag2 = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 5); + ((DataGridColumn)ParcelasRealizadoColumn).Visibility = val; + ((DataGridColumn)ParcelasComissaoColumn).Visibility = (Visibility)((!flag) ? ((int)val) : 0); + ((DataGridColumn)ParcelasReciboColumn).Visibility = (Visibility)(flag2 ? 2 : ((int)val)); + ((DataGridColumn)ParcelasValorComissaoDescColumn).Visibility = (Visibility)((!flag2) ? 2 : ((int)val)); + ((DataGridColumn)MaisInformacoesColumn).Visibility = val; + } + + private void AjustaItem() + { + ((ToggleButton)AtivosRadioButton).IsChecked = ViewModel.FilterItens == 0; + ((ToggleButton)ApoliceItensRadioButton).IsChecked = ViewModel.FilterItens == 1; + ((ToggleButton)EndossoItensRadioButton).IsChecked = ViewModel.FilterItens == 2; + ((ToggleButton)InativosRadioButton).IsChecked = ViewModel.FilterItens == 3; + } + + private async void EndossoGrid_OnMouseDoubleClick(object sender, MouseButtonEventArgs e) + { + DataGrid val = (DataGrid)sender; + if (val == null || ((Selector)val).SelectedIndex >= 0) + { + ((ToggleButton)AtivosRadioButton).IsChecked = true; + await ViewModel.SelecionaDocumento(1, (Documento)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null)); + Gestor.Application.Actions.Actions.AcessaTela?.Invoke((TipoTela)2, ""); + } + } + + private void ItemGrid_OnMouseDoubleClick(object sender, MouseButtonEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_0031: Unknown result type (might be due to invalid IL or missing references) + //IL_003b: Expected O, but got Unknown + DataGrid val = (DataGrid)sender; + if (val == null || ((Selector)val).SelectedIndex >= 0) + { + ViewModel.SelecionaItem((Item)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null)); + Gestor.Application.Actions.Actions.AcessaTela?.Invoke((TipoTela)3, ""); + } + } + + private void ItemGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_001a: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Expected O, but got Unknown + //IL_0063: Unknown result type (might be due to invalid IL or missing references) + //IL_006d: Expected O, but got Unknown + DataGrid val = (DataGrid)sender; + if (val == null || ((Selector)val).SelectedIndex >= 0) + { + Item val2 = (Item)((Selector)val).SelectedItem; + if (!val2.Cancelado && !val2.Substituido.HasValue && val2.Status != null) + { + AjustaItem(); + } + ViewModel.SelecionaItem((Item)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null)); + } + } + + private void SelecionarRadios(int filter) + { + _carregarDocumetos = false; + ((ToggleButton)ApoliceRadioButton).IsChecked = filter == 0; + ((ToggleButton)EndossoRadioButton).IsChecked = filter == 1; + _carregarDocumetos = true; + } + + private void ScrollDocumento() + { + if (ViewModel.UpdatingScroll && ((Selector)ApoliceGrid).SelectedItem != null) + { + ApoliceGrid.ScrollIntoView(((Selector)ApoliceGrid).SelectedItem); + } + ViewModel.UpdatingScroll = false; + } + + private async void Documento_OnChecked(object sender, RoutedEventArgs e) + { + ((HeaderedItemsControl)AcessarDocumentoMenuItem).Header = ((ViewModel.FilterDocumento == 0) ? "ACESSAR APÓLICE" : "ACESSAR ENDOSSO"); + ((FrameworkElement)AcessarDocumentoMenuItem).ToolTip = ((ViewModel.FilterDocumento == 0) ? "CLIQUE PARA ACESSAR A TELA DA APÓLICE" : "CLIQUE PARA ACESSAR A TELA DE ENDOSSO"); + RadioButton val = (RadioButton)sender; + if (string.IsNullOrEmpty(val.GroupName)) + { + return; + } + string groupName = val.GroupName; + if (!(groupName == "Apolices")) + { + if (groupName == "Itens") + { + switch (((FrameworkElement)val).Name) + { + default: + await ViewModel.SelecionaItens(0, null, 0L); + break; + case "ApoliceItensRadioButton": + await ViewModel.SelecionaItens(1, null, 0L); + break; + case "EndossoItensRadioButton": + await ViewModel.SelecionaItens(2, null, 0L); + break; + case "InativosRadioButton": + await ViewModel.SelecionaItens(3, null, 0L); + break; + } + } + } + else + { + if (!_carregarDocumetos) + { + return; + } + if (!(((FrameworkElement)val).Name == "EndossoRadioButton")) + { + ((HeaderedItemsControl)AcessarDocumentoMenuItem).Header = "ACESSAR APÓLICE"; + ((FrameworkElement)AcessarDocumentoMenuItem).ToolTip = "CLIQUE PARA ACESSAR A TELA DA APÓLICE"; + ViewModel.CarregaDocumentos(0); + if (((Selector)ApoliceGrid).SelectedItem == null && ((CollectionView)((ItemsControl)ApoliceGrid).Items).Count > 0) + { + ((Selector)ApoliceGrid).SelectedItem = ((ItemsControl)ApoliceGrid).Items[0]; + } + if (((Selector)ApoliceGrid).SelectedItem != null) + { + await ViewModel.SelecionaDocumento(0, (Documento)((Selector)ApoliceGrid).SelectedItem); + } + } + else + { + ((HeaderedItemsControl)AcessarDocumentoMenuItem).Header = "ACESSAR ENDOSSO"; + ((FrameworkElement)AcessarDocumentoMenuItem).ToolTip = "CLIQUE PARA ACESSAR A TELA DE ENDOSSO"; + ViewModel.CarregaDocumentos(1); + if (((Selector)EndossoGrid).SelectedItem == null && ((CollectionView)((ItemsControl)EndossoGrid).Items).Count > 0) + { + ((Selector)EndossoGrid).SelectedItem = ((ItemsControl)EndossoGrid).Items[0]; + } + if (((Selector)EndossoGrid).SelectedItem != null) + { + await ViewModel.SelecionaDocumento(1, (Documento)((Selector)EndossoGrid).SelectedItem); + } + } + } + } + + public void ScrollToIndex(DataGrid grid, int index) + { + Visual descendantByType = GetDescendantByType((Visual)(object)grid, typeof(ScrollViewer)); + Visual obj = ((descendantByType is ScrollViewer) ? descendantByType : null); + int num = ((index - 5 > 0) ? (index - 5) : 0); + if (obj != null) + { + ((ScrollViewer)obj).ScrollToVerticalOffset((double)num); + } + } + + public Visual GetDescendantByType(Visual element, Type type) + { + if (element == null) + { + return null; + } + if (((object)element).GetType() == type) + { + return element; + } + Visual val = null; + FrameworkElement val2 = (FrameworkElement)(object)((element is FrameworkElement) ? element : null); + if (val2 != null) + { + val2.ApplyTemplate(); + } + for (int i = 0; i < VisualTreeHelper.GetChildrenCount((DependencyObject)(object)element); i++) + { + DependencyObject child = VisualTreeHelper.GetChild((DependencyObject)(object)element, i); + Visual element2 = (Visual)(object)((child is Visual) ? child : null); + val = GetDescendantByType(element2, type); + if (val != null) + { + break; + } + } + return val; + } + + private async void ApoliceGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + DataGrid val = (DataGrid)sender; + if (val == null || ((Selector)val).SelectedIndex >= 0) + { + await ViewModel.SelecionaDocumento(0, (Documento)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null)); + VisibilityValorPago(); + } + } + + private async void EndossoGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + DataGrid val = (DataGrid)sender; + if (val == null || ((Selector)val).SelectedIndex >= 0) + { + await ViewModel.SelecionaDocumento(1, (Documento)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null)); + VisibilityValorPago(); + } + } + + private void VisibilityValorPago() + { + DataGridTextColumn parcelasTotalColumn = ParcelasTotalColumn; + ObservableCollection<Parcela> parcelas = ViewModel.Parcelas; + ((DataGridColumn)parcelasTotalColumn).Visibility = (Visibility)((parcelas == null || !(parcelas.Sum((Parcela p) => p.ValorPago) > default(decimal))) ? 2 : 0); + } + + public async void Pesquisar(PesquisaAvancada pesquisa) + { + await ViewModel.Pesquisar(pesquisa); + if (ViewModel.SelectedControle != null) + { + ScrollToIndex(ApoliceGrid, ((Selector)ApoliceGrid).SelectedIndex); + } + if (ViewModel.SelectedEndosso != null) + { + ScrollToIndex(EndossoGrid, ((Selector)EndossoGrid).SelectedIndex); + } + if (ViewModel.SelectedItem != null) + { + ScrollToIndex(ItemGrid, ((Selector)ItemGrid).SelectedIndex); + } + if (ViewModel.SelectedParcela != null) + { + ScrollToIndex(ParcelaGrid, ((Selector)ParcelaGrid).SelectedIndex); + } + } + + private void ClienteView_Click(object sender, RoutedEventArgs e) + { + Gestor.Application.Actions.Actions.AcessaTela?.Invoke((TipoTela)1, ""); + } + + private async void ApoliceGrid_OnMouseDoubleClick(object sender, MouseButtonEventArgs e) + { + DataGridRow val = (DataGridRow)sender; + if (val != null && !(((FrameworkElement)val).DataContext.GetType() != typeof(Documento))) + { + ((ToggleButton)AtivosRadioButton).IsChecked = true; + Documento val2 = (Documento)((val != null) ? val.Item : null); + if ((((int)val2 != 0) ? new long?(((DomainBase)val2).Id) : null) != ((DomainBase)ViewModel.SelectedControle).Id) + { + await ViewModel.SelecionaDocumento(0, (Documento)((val != null) ? val.Item : null)); + } + Gestor.Application.Actions.Actions.AcessaTela?.Invoke((TipoTela)2, ""); + } + } + + private static void ParcelaGrid_OnMouseDoubleClick(object sender, MouseButtonEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_002b: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Expected O, but got Unknown + DataGrid val = (DataGrid)sender; + if (val == null || ((Selector)val).SelectedIndex >= 0) + { + ConsultaViewModel.ParcelaSelecionada = (Parcela)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null); + Gestor.Application.Actions.Actions.AcessaTela?.Invoke((TipoTela)2, "Parcela"); + } + } + + private void ApoliceView_Click(object sender, RoutedEventArgs e) + { + Gestor.Application.Actions.Actions.AcessaTela?.Invoke((TipoTela)2, ""); + } + + private async void AbrirAquivoDigital_Click(object sender, RoutedEventArgs e) + { + FiltroArquivoDigital filtro = null; + ConsultaViewModel.DocumentoSelecionado.Controle.Cliente = ViewModel.SelectedCliente; + switch (((FrameworkElement)(Button)sender).Name) + { + case "Apolice": + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)2).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)2) + "."); + return; + } + ViewModel.SelectedControle.Controle.Cliente = ViewModel.SelectedCliente; + filtro = new FiltroArquivoDigital + { + Id = ((DomainBase)ViewModel.SelectedControle).Id, + Tipo = (TipoArquivoDigital)2, + Parente = ViewModel.SelectedControle + }; + break; + case "Endosso": + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)2).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)2) + "."); + return; + } + ViewModel.SelectedEndosso.Controle.Cliente = ViewModel.SelectedCliente; + filtro = new FiltroArquivoDigital + { + Id = ((DomainBase)ViewModel.SelectedEndosso).Id, + Tipo = (TipoArquivoDigital)2, + Parente = ViewModel.SelectedEndosso + }; + break; + case "Parcela": + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)3).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)3) + "."); + return; + } + ViewModel.SelectedParcela.Documento = ConsultaViewModel.DocumentoSelecionado; + filtro = new FiltroArquivoDigital + { + Id = ((DomainBase)ViewModel.SelectedParcela).Id, + IdApolice = ((DomainBase)ViewModel.SelectedParcela.Documento).Id, + Tipo = (TipoArquivoDigital)3, + Parente = ViewModel.SelectedParcela + }; + break; + case "Item": + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)4).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)4) + "."); + return; + } + ViewModel.SelectedItem.Documento = ConsultaViewModel.DocumentoSelecionado; + filtro = new FiltroArquivoDigital + { + Id = ((DomainBase)ViewModel.SelectedItem).Id, + IdApolice = ((DomainBase)ViewModel.SelectedItem.Documento).Id, + Tipo = (TipoArquivoDigital)4, + Parente = ViewModel.SelectedItem + }; + break; + } + ViewModel.ShowDrawer(new ArquivoDigitalDrawer(filtro), 0, close: false); + } + + private void Item_Click(object sender, RoutedEventArgs e) + { + Gestor.Application.Actions.Actions.AcessaTela?.Invoke((TipoTela)3, ""); + } + + private async void ReordenarItem_Click(object sender, RoutedEventArgs e) + { + List<long> ids = ViewModel.Itens.Select((Item x) => ((DomainBase)x).Id).ToList(); + ConsultaViewModel viewModel = ViewModel; + viewModel.SalvarOrdem(await ViewModel.ShowReordenarItensDialog(ids)); + } + + private void Parcela_Click(object sender, RoutedEventArgs e) + { + Gestor.Application.Actions.Actions.AcessaTela?.Invoke((TipoTela)2, "Parcela"); + } + + private async void ValoresInfo_OnClick(object sender, RoutedEventArgs e) + { + bool restricaoInformacaoValores = ViewModel.Restricao((TipoRestricao)97); + if (!restricaoInformacaoValores) + { + Documento documento = await ViewModel.AbrirDetalhes(); + ViewModel.ShowDrawer(new ValoresApoliceDrawer(documento), 0); + } + if (restricaoInformacaoValores) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR MAIS INFORMAÇÕES."); + } + } + + private async void Renovar_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.Restricao((TipoRestricao)17)) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA RENOVAR. PROCURE O ADMINSTRADOR DO SISTEMA."); + } + else if (!ViewModel.EnableRenovar) + { + await ViewModel.ShowMessage("NÃO É POSSÍVEL RENOVAR UM DOCUMENTO SEM EMISSÃO OU SEM FINAL DE VIGÊNCIA."); + } + else if ((int)ConsultaViewModel.DocumentoSelecionado.Situacao == 7) + { + await ViewModel.ShowMessage("NÃO É POSSÍVEL RENOVAR UM DOCUMENTO RECUSADO."); + } + else + { + Gestor.Application.Actions.Actions.AcessaTela?.Invoke((TipoTela)2, "Renovar"); + } + } + + private async void Endossar_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.Restricao((TipoRestricao)33)) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ENDOSSAR. PROCURE O ADMINSTRADOR DO SISTEMA."); + } + else if (!ViewModel.EnableEndossar) + { + List<KeyValuePair<string, string>> pairs = ViewModel.SelectedControle.ValidateEndossar(); + await ViewModel.ShowMessage(pairs, ViewModel.ErroCamposInvalidos, "OK"); + } + else if ((int)ConsultaViewModel.DocumentoSelecionado.Situacao == 7) + { + await ViewModel.ShowMessage("NÃO É POSSÍVEL ENDOSSAR UM DOCUMENTO RECUSADO."); + } + else + { + Gestor.Application.Actions.Actions.AcessaTela?.Invoke((TipoTela)2, "Endossar"); + } + } + + private async void Recusar_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.Restricao((TipoRestricao)18)) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA RECUSAR. PROCURE O ADMINSTRADOR DO SISTEMA."); + } + else + { + await ViewModel.RecusarDocumento(); + } + } + + private async void EditarParcelas_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.EditarParcelas(); + } + + private async void ValoresParcelaInfo_OnClick(object sender, RoutedEventArgs e) + { + Parcela parcela = await ViewModel.AbrirDetalhesParcela(); + ViewModel.ShowDrawer(new ValoresParcelaDrawer(parcela, ViewModel.SelectedControle), 0); + } + + private async void ManutecaoItens_OnClick(object sender, RoutedEventArgs e) + { + if ((ViewModel.FilterDocumento == 0 && (int)ViewModel.SelectedControle.Situacao == 7) || (ViewModel.FilterDocumento == 1 && (int)ViewModel.SelectedEndosso.Situacao == 7)) + { + await ViewModel.ShowMessage("NÃO É POSSÍVEL FAZER A MANUTENÇÃO DE ITENS DE UM DOCUMENTO RECUSADO."); + } + else + { + ViewModel.ManutecaoItens(); + } + } + + private void MenuItem_OnClick(object sender, RoutedEventArgs e) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Unknown result type (might be due to invalid IL or missing references) + //IL_0031: Unknown result type (might be due to invalid IL or missing references) + //IL_0038: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_007f: Expected O, but got Unknown + Tarefa tarefa = new Tarefa + { + IdCliente = ((DomainBase)ViewModel.SelectedCliente).Id, + Cliente = ViewModel.SelectedCliente.Nome, + Entidade = (TipoTarefa)0, + IdEntidade = ((DomainBase)ViewModel.SelectedControle).Id, + Titulo = ViewModel.SelectedCliente.Nome + " APÓLICE " + ViewModel.SelectedControle.Apolice + }; + ViewModel.ShowDrawer(new TarefaDrawer(tarefa), 0, close: false); + } + + private async void TrocarCliente_OnClick(object sender, RoutedEventArgs e) + { + ((Window)new HosterWindow((ContentControl)(object)new TrocarClienteView(ViewModel.SelectedControle), "TROCAR CLIENTE", 500.0, 200.0)).ShowDialog(); + await ViewModel.SelecionaCliente(MainViewModel.ClienteSelecionado); + Gestor.Application.Actions.Actions.RecarregarDocumentos?.Invoke(null); + } + + private async void Extratos_OnClick(object sender, RoutedEventArgs e) + { + if (!(await ViewModel.VerificarRestricao((TipoRestricao)13)) || ((DomainBase)ViewModel.SelectedCliente).Id == 0L) + { + return; + } + ViewModel.Loading(isLoading: true); + if (ViewModel.SelectedControle == null) + { + ViewModel.ShowDrawer(new ExtratosDrawer(new List<ClientesAtivosInativos> + { + new ClientesAtivosInativos + { + Selecionado = true, + EntidadeCliente = ViewModel.SelectedCliente, + Id = ((DomainBase)ViewModel.SelectedCliente).Id, + Nome = ViewModel.SelectedCliente.Nome, + Documento = ViewModel.SelectedCliente.Documento + } + }, null, (Relatorio)0), 0, close: false); + ViewModel.Loading(isLoading: false); + return; + } + switch (ViewModel.FilterDocumento) + { + case 0: + if (ViewModel.SelectedControle != null) + { + ViewModel.ShowDrawer(new ExtratosDrawer(null, new List<Documento> { ViewModel.SelectedControle }, null, new List<long> { ((DomainBase)ViewModel.SelectedControle).Id }), 0, close: false); + } + break; + case 1: + if (ViewModel.SelectedEndosso != null) + { + ViewModel.ShowDrawer(new ExtratosDrawer(null, new List<Documento> { ViewModel.SelectedEndosso }, null, new List<long> { ((DomainBase)ViewModel.SelectedEndosso).Id }), 0, close: false); + } + break; + } + ViewModel.Loading(isLoading: false); + } + + private async void Perdido_OnClick(object sender, RoutedEventArgs e) + { + if ((int)ConsultaViewModel.DocumentoSelecionado.Situacao == 7) + { + await ViewModel.ShowMessage("NÃO É POSSÍVEL ALTERAR O STATUS PARA PERDIDO DE UM DOCUMENTO RECUSADO."); + return; + } + if (!(await ViewModel.ShowMessage("DESEJA REALMENTE ALTERAR O STATUS DO SEGURO PARA PERDIDO?", "SIM", "NÃO"))) + { + return; + } + ViewModel.Loading(isLoading: true); + Cliente cliente = await new ClienteServico().BuscarCliente(((DomainBase)ViewModel.SelectedControle.Controle.Cliente).Id); + Cliente val = cliente; + val.Telefones = await new ClienteServico().BuscarTelefonesAsync(((DomainBase)ViewModel.SelectedControle.Controle.Cliente).Id); + val = cliente; + val.Emails = await new ClienteServico().BuscarEmailsAsync(((DomainBase)ViewModel.SelectedControle.Controle.Cliente).Id); + if (!(await new ApoliceServico().Perdido(((DomainBase)ViewModel.SelectedControle.Controle).Id))) + { + ViewModel.Loading(isLoading: false); + return; + } + Prospeccao val2 = new Prospeccao + { + Nome = cliente.Nome, + Documento = cliente.Documento, + Nascimento = cliente.Nascimento + }; + ObservableCollection<ClienteTelefone> telefones = cliente.Telefones; + object obj; + if (telefones == null) + { + obj = null; + } + else + { + ClienteTelefone? obj2 = telefones.FirstOrDefault(); + obj = ((obj2 != null) ? ((TelefoneBase)obj2).Prefixo : null); + } + if (obj == null) + { + obj = ""; + } + val2.Prefixo1 = (string)obj; + ObservableCollection<ClienteTelefone> telefones2 = cliente.Telefones; + object obj3; + if (telefones2 == null) + { + obj3 = null; + } + else + { + ClienteTelefone? obj4 = telefones2.FirstOrDefault(); + obj3 = ((obj4 != null) ? ((TelefoneBase)obj4).Numero : null); + } + if (obj3 == null) + { + obj3 = ""; + } + val2.Telefone1 = (string)obj3; + val2.Prefixo2 = ((cliente.Telefones != null && cliente.Telefones.Count > 1) ? ((TelefoneBase)cliente.Telefones[1]).Prefixo : ""); + object telefone; + if (cliente.Telefones != null) + { + ObservableCollection<ClienteTelefone> telefones3 = cliente.Telefones; + if (telefones3 != null && telefones3.Count > 1) + { + telefone = ((TelefoneBase)cliente.Telefones[1]).Numero; + goto IL_04ad; + } + } + telefone = ""; + goto IL_04ad; + IL_04ad: + val2.Telefone2 = (string)telefone; + ObservableCollection<ClienteEmail> emails = cliente.Emails; + object obj5; + if (emails == null) + { + obj5 = null; + } + else + { + ClienteEmail? obj6 = emails.FirstOrDefault(); + obj5 = ((obj6 != null) ? ((EmailBase)obj6).Email : null); + } + if (obj5 == null) + { + obj5 = ""; + } + val2.Email = (string)obj5; + val2.VigenciaFinal = (ViewModel.SelectedControle.Vigencia2 ?? Funcoes.GetNetworkTime().Date).AddYears(1); + val2.Vendedor = ViewModel.SelectedControle.VendedorPrincipal; + Item? obj7 = ViewModel.Itens.FirstOrDefault(); + val2.Item = ((obj7 != null) ? obj7.Descricao : null); + val2.Tipo = "SEGURO PERDIDO"; + val2.Observacao = "SEGURO PERDIDO: PROPOSTA: " + ViewModel.SelectedControle.Proposta + ", APÓLICE: " + ViewModel.SelectedControle.Apolice; + val2.Status = (StatusProspeccao)1; + val2.Renovacao = true; + Prospeccao data = val2; + await AbrirProspeccao(data); + ViewModel.CarregaDocumentos(0); + await ViewModel.SelecionaCliente(ViewModel.SelectedCliente); + ((ToggleButton)ApoliceItensRadioButton).IsChecked = true; + if (ApoliceGrid != null && ((CollectionView)((ItemsControl)ApoliceGrid).Items).Count > 0 && ((Selector)ApoliceGrid).SelectedItem == null) + { + ((Selector)ApoliceGrid).SelectedItem = ((ItemsControl)ApoliceGrid).Items[0]; + ConsultaViewModel viewModel = ViewModel; + DataGrid apoliceGrid = ApoliceGrid; + await viewModel.SelecionaDocumento(0, (Documento)((apoliceGrid != null) ? ((Selector)apoliceGrid).SelectedItem : null)); + } + ViewModel.Loading(isLoading: false); + } + + private async Task AbrirProspeccao(Prospeccao data) + { + while (true) + { + if (await ViewModel.ShowProspeccaoDialog(data) == null) + { + if (await ViewModel.ShowMessage("DESEJA REALMENTE NÃO CADASTRAR UMA PROSPECÇÃO PARA ESSE DOCUMENTO?", "SIM", "NÃO")) + { + return; + } + continue; + } + List<KeyValuePair<string, string>> list = await ViewModel.SalvarProspeccao(data); + if (list == null || list.Count == 0) + { + break; + } + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + ViewModel.ToggleSnackBar("PROSPECÇÃO SALVA COM SUCESSO."); + } + + private void Sinistros_OnClick(object sender, RoutedEventArgs e) + { + Gestor.Application.Actions.Actions.AcessaTela?.Invoke((TipoTela)7, ""); + } + + private void Observacoes_OnClick(object sender, RoutedEventArgs e) + { + //IL_0004: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_004c: Unknown result type (might be due to invalid IL or missing references) + //IL_007e: Unknown result type (might be due to invalid IL or missing references) + //IL_0061: Unknown result type (might be due to invalid IL or missing references) + //IL_0076: Unknown result type (might be due to invalid IL or missing references) + long id = 0L; + TipoTela tipo = (TipoTela)0; + switch (((FrameworkElement)(Button)sender).Name) + { + case "ObservacaoApolice": + id = ((DomainBase)ViewModel.SelectedControle).Id; + tipo = (TipoTela)2; + break; + case "EndossoInfo": + id = ((DomainBase)ViewModel.SelectedEndosso).Id; + tipo = (TipoTela)2; + break; + case "ObservacaoParcela": + id = ((DomainBase)ViewModel.SelectedParcela).Id; + tipo = (TipoTela)5; + break; + } + ViewModel.ShowDrawer(new ObservacoesDrawer(id, tipo), 0); + } + + private async void RelacaoItens_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.GerarExcel(ViewModel.FilterItens); + } + + private async void ExpedicaoInfo_OnClick(object sender, RoutedEventArgs e) + { + if (await ViewModel.VerificarPermissao((TipoTela)46)) + { + if (ConsultaViewModel.DocumentoSelecionado == null) + { + await ViewModel.ShowMessage("NECESSÁRIO SELECIONAR UM DOCUMENTO PARA EXIBIR AS INFORMAÇÕES DE EXPEDIÇÃO."); + } + else + { + ViewModel.ShowDrawer(new ExpedicaoDrawer(ConsultaViewModel.DocumentoSelecionado), 0, close: false); + } + } + } + + private async void PopupBox_OnOpened(object sender, RoutedEventArgs e) + { + PopupBox val = (PopupBox)sender; + _documentoAssistencia = (Documento)((FrameworkElement)val).DataContext; + _linkAssistencia = await ViewModel.CreateLink(_documentoAssistencia); + if (!string.IsNullOrEmpty(_linkAssistencia)) + { + string anotacoes = "Prezado(a) " + ValidationHelper.Captalize(ViewModel.SelectedCliente.Nome) + ", segue o link do seu Cartão Assistência 24 horas." + Environment.NewLine + Environment.NewLine + "LINK CARTÃO ASSISTÊNCIA 24 HORAS" + Environment.NewLine + _linkAssistencia; + ViewModel.Anotacoes = anotacoes; + } + } + + private async void EnviarPorWhatsApp_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.Restricao((TipoRestricao)32)) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR O WHATSAPP"); + return; + } + Button val = (Button)sender; + if (((FrameworkElement)val).DataContext != null) + { + object dataContext = ((FrameworkElement)val).DataContext; + ClienteTelefone val2 = (ClienteTelefone)((dataContext is ClienteTelefone) ? dataContext : null); + if (val2 != null && !((((TelefoneBase)val2).Tipo.HasValue && (int)((TelefoneBase)val2).Tipo.GetValueOrDefault() == 8) ? (((TelefoneBase)val2).Prefixo + ((TelefoneBase)val2).Numero).Clear() : ("55" + ((TelefoneBase)val2).Prefixo + ((TelefoneBase)val2).Numero.Clear())).EnviarWhatsapp(ViewModel.Anotacoes)) + { + await ViewModel.ShowMessage("HOUVE UM PROBLEMA AO ABRIR LINK DO WHATSAPP, O LINK FOI COPIADO EM SUA MAQUINA, BASTA ABRIR O NAVEGADOR DE INTERNET E COLAR NA BARRA DE ENDEREÇOS"); + } + } + } + + private void EnviarPorEmail_OnClick(object sender, RoutedEventArgs e) + { + //IL_0009: Unknown result type (might be due to invalid IL or missing references) + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + //IL_002c: Expected O, but got Unknown + if (_documentoAssistencia != null) + { + MalaDireta val = new MalaDireta + { + Cliente = ViewModel.SelectedCliente, + Apolice = _documentoAssistencia + }; + if (Funcoes.IsWindowOpen<HosterWindow>("ENVIO DE E-MAIL")) + { + Funcoes.Destroy<HosterWindow>("ENVIO DE E-MAIL"); + } + ((Window)new HosterWindow((ContentControl)(object)new MalaDiretaView(new List<MalaDireta> { val }, "CARTÃO ASSISTÊNCIA 24 HORAS - " + val.Cliente.Nome + " " + val.Apolice.Apolice, "<p>Prezado(a) " + ValidationHelper.Captalize(ViewModel.SelectedCliente.Nome) + ", segue o link do seu Cartão Assistência 24 horas.</p><p><a target='_blank' href='" + _linkAssistencia + "'>LINK CARTÃO ASSITÊNCIA</a></p>"), "ENVIO DE E-MAIL", 1200.0, 600.0, canMaximize: true)).ShowDialog(); + } + } + + private void PopupBox_OnClosed(object sender, RoutedEventArgs e) + { + _documentoAssistencia = null; + ViewModel.Anotacoes = ""; + _linkAssistencia = ""; + } + + private async void MostrarItens_Click(object sender, RoutedEventArgs e) + { + int type = 0; + if (!((UIElement)ApoliceRadioButton).IsFocused) + { + RadioButton apoliceItensRadioButton = ApoliceItensRadioButton; + if (apoliceItensRadioButton == null || !((ToggleButton)apoliceItensRadioButton).IsChecked.GetValueOrDefault()) + { + goto IL_0041; + } + } + type = 1; + goto IL_0041; + IL_0041: + if (!((UIElement)EndossoRadioButton).IsFocused) + { + RadioButton endossoItensRadioButton = EndossoItensRadioButton; + if (endossoItensRadioButton == null || !((ToggleButton)endossoItensRadioButton).IsChecked.GetValueOrDefault()) + { + goto IL_006c; + } + } + type = 2; + goto IL_006c; + IL_006c: + if (((UIElement)InativosRadioButton).IsFocused) + { + type = 3; + } + await ViewModel.MostrarItens(type); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/seguros/consultaoriginalview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_00db: Unknown result type (might be due to invalid IL or missing references) + //IL_00e5: Expected O, but got Unknown + //IL_00e8: Unknown result type (might be due to invalid IL or missing references) + //IL_00f2: Expected O, but got Unknown + //IL_00f4: Unknown result type (might be due to invalid IL or missing references) + //IL_0100: Unknown result type (might be due to invalid IL or missing references) + //IL_010a: Expected O, but got Unknown + //IL_010d: Unknown result type (might be due to invalid IL or missing references) + //IL_0117: Expected O, but got Unknown + //IL_0124: Unknown result type (might be due to invalid IL or missing references) + //IL_012e: Expected O, but got Unknown + //IL_0130: Unknown result type (might be due to invalid IL or missing references) + //IL_013c: Unknown result type (might be due to invalid IL or missing references) + //IL_0146: Expected O, but got Unknown + //IL_0148: Unknown result type (might be due to invalid IL or missing references) + //IL_0154: Unknown result type (might be due to invalid IL or missing references) + //IL_015e: Expected O, but got Unknown + //IL_0160: Unknown result type (might be due to invalid IL or missing references) + //IL_016c: Unknown result type (might be due to invalid IL or missing references) + //IL_0176: Expected O, but got Unknown + //IL_0178: Unknown result type (might be due to invalid IL or missing references) + //IL_0184: Unknown result type (might be due to invalid IL or missing references) + //IL_018e: Expected O, but got Unknown + //IL_0190: Unknown result type (might be due to invalid IL or missing references) + //IL_019c: Unknown result type (might be due to invalid IL or missing references) + //IL_01a6: Expected O, but got Unknown + //IL_01a8: Unknown result type (might be due to invalid IL or missing references) + //IL_01b4: Unknown result type (might be due to invalid IL or missing references) + //IL_01be: Expected O, but got Unknown + //IL_01c0: Unknown result type (might be due to invalid IL or missing references) + //IL_01cc: Unknown result type (might be due to invalid IL or missing references) + //IL_01d6: Expected O, but got Unknown + //IL_01d8: Unknown result type (might be due to invalid IL or missing references) + //IL_01e4: Unknown result type (might be due to invalid IL or missing references) + //IL_01ee: Expected O, but got Unknown + //IL_01f0: Unknown result type (might be due to invalid IL or missing references) + //IL_01fc: Unknown result type (might be due to invalid IL or missing references) + //IL_0206: Expected O, but got Unknown + //IL_0208: Unknown result type (might be due to invalid IL or missing references) + //IL_0214: Unknown result type (might be due to invalid IL or missing references) + //IL_021e: Expected O, but got Unknown + //IL_0220: Unknown result type (might be due to invalid IL or missing references) + //IL_022c: Unknown result type (might be due to invalid IL or missing references) + //IL_0236: Expected O, but got Unknown + //IL_0238: Unknown result type (might be due to invalid IL or missing references) + //IL_0244: Unknown result type (might be due to invalid IL or missing references) + //IL_024e: Expected O, but got Unknown + //IL_0251: Unknown result type (might be due to invalid IL or missing references) + //IL_025b: Expected O, but got Unknown + //IL_025e: Unknown result type (might be due to invalid IL or missing references) + //IL_0268: Expected O, but got Unknown + //IL_026b: Unknown result type (might be due to invalid IL or missing references) + //IL_0275: Expected O, but got Unknown + //IL_0278: Unknown result type (might be due to invalid IL or missing references) + //IL_0282: Expected O, but got Unknown + //IL_0285: Unknown result type (might be due to invalid IL or missing references) + //IL_028f: Expected O, but got Unknown + //IL_0292: Unknown result type (might be due to invalid IL or missing references) + //IL_029c: Expected O, but got Unknown + //IL_029e: Unknown result type (might be due to invalid IL or missing references) + //IL_02aa: Unknown result type (might be due to invalid IL or missing references) + //IL_02b4: Expected O, but got Unknown + //IL_02b7: Unknown result type (might be due to invalid IL or missing references) + //IL_02c1: Expected O, but got Unknown + //IL_02c4: Unknown result type (might be due to invalid IL or missing references) + //IL_02ce: Expected O, but got Unknown + //IL_02d1: Unknown result type (might be due to invalid IL or missing references) + //IL_02db: Expected O, but got Unknown + //IL_02de: Unknown result type (might be due to invalid IL or missing references) + //IL_02e8: Expected O, but got Unknown + //IL_02eb: Unknown result type (might be due to invalid IL or missing references) + //IL_02f5: Expected O, but got Unknown + //IL_02f8: Unknown result type (might be due to invalid IL or missing references) + //IL_0302: Expected O, but got Unknown + //IL_0305: Unknown result type (might be due to invalid IL or missing references) + //IL_030f: Expected O, but got Unknown + //IL_0312: Unknown result type (might be due to invalid IL or missing references) + //IL_031c: Expected O, but got Unknown + //IL_031e: Unknown result type (might be due to invalid IL or missing references) + //IL_032a: Unknown result type (might be due to invalid IL or missing references) + //IL_0334: Expected O, but got Unknown + //IL_0336: Unknown result type (might be due to invalid IL or missing references) + //IL_0342: Unknown result type (might be due to invalid IL or missing references) + //IL_034c: Expected O, but got Unknown + //IL_034f: Unknown result type (might be due to invalid IL or missing references) + //IL_0359: Expected O, but got Unknown + //IL_035c: Unknown result type (might be due to invalid IL or missing references) + //IL_0366: Expected O, but got Unknown + //IL_0369: Unknown result type (might be due to invalid IL or missing references) + //IL_0373: Expected O, but got Unknown + //IL_0376: Unknown result type (might be due to invalid IL or missing references) + //IL_0380: Expected O, but got Unknown + //IL_0382: Unknown result type (might be due to invalid IL or missing references) + //IL_038e: Unknown result type (might be due to invalid IL or missing references) + //IL_0398: Expected O, but got Unknown + //IL_039a: Unknown result type (might be due to invalid IL or missing references) + //IL_03a6: Unknown result type (might be due to invalid IL or missing references) + //IL_03b0: Expected O, but got Unknown + //IL_03b3: Unknown result type (might be due to invalid IL or missing references) + //IL_03bd: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ApoliceRadioButton = (RadioButton)target; + break; + case 2: + EndossoRadioButton = (RadioButton)target; + break; + case 3: + ((MenuItem)target).Click += new RoutedEventHandler(ClienteView_Click); + break; + case 4: + AcessarDocumentoMenuItem = (MenuItem)target; + AcessarDocumentoMenuItem.Click += new RoutedEventHandler(ApoliceView_Click); + break; + case 5: + ((MenuItem)target).Click += new RoutedEventHandler(Renovar_OnClick); + break; + case 6: + ((MenuItem)target).Click += new RoutedEventHandler(Perdido_OnClick); + break; + case 7: + ((MenuItem)target).Click += new RoutedEventHandler(Endossar_OnClick); + break; + case 8: + ((MenuItem)target).Click += new RoutedEventHandler(Recusar_OnClick); + break; + case 9: + ((MenuItem)target).Click += new RoutedEventHandler(MenuItem_OnClick); + break; + case 10: + ((MenuItem)target).Click += new RoutedEventHandler(Extratos_OnClick); + break; + case 11: + ((MenuItem)target).Click += new RoutedEventHandler(TrocarCliente_OnClick); + break; + case 12: + ((MenuItem)target).Click += new RoutedEventHandler(EditarParcelas_OnClick); + break; + case 13: + ((MenuItem)target).Click += new RoutedEventHandler(ExpedicaoInfo_OnClick); + break; + case 14: + ((MenuItem)target).Click += new RoutedEventHandler(ValoresInfo_OnClick); + break; + case 15: + ((MenuItem)target).Click += new RoutedEventHandler(ManutecaoItens_OnClick); + break; + case 16: + ((MenuItem)target).Click += new RoutedEventHandler(RelacaoItens_OnClick); + break; + case 17: + ApoliceGrid = (DataGrid)target; + break; + case 19: + NomeField = (DataGridTextColumn)target; + break; + case 20: + ApelidoField = (DataGridTextColumn)target; + break; + case 21: + ApolicesComissaoColumn = (DataGridTextColumn)target; + break; + case 27: + EndossoGrid = (DataGrid)target; + break; + case 28: + EndossosComissaoColumn = (DataGridTextColumn)target; + break; + case 31: + ((MenuItem)target).Click += new RoutedEventHandler(Parcela_Click); + break; + case 32: + Comissao = (WrapPanel)target; + break; + case 33: + ParcelaGrid = (DataGrid)target; + break; + case 34: + ParcelasTotalColumn = (DataGridTextColumn)target; + break; + case 35: + ParcelasRealizadoColumn = (DataGridTextColumn)target; + break; + case 36: + ParcelasComissaoColumn = (DataGridTextColumn)target; + break; + case 37: + ParcelasReciboColumn = (DataGridTextColumn)target; + break; + case 38: + ParcelasValorComissaoDescColumn = (DataGridTextColumn)target; + break; + case 39: + MaisInformacoesColumn = (DataGridTemplateColumn)target; + break; + case 43: + ((MenuItem)target).Click += new RoutedEventHandler(Item_Click); + break; + case 44: + ((MenuItem)target).Click += new RoutedEventHandler(Sinistros_OnClick); + break; + case 45: + AtivosRadioButton = (RadioButton)target; + break; + case 46: + ApoliceItensRadioButton = (RadioButton)target; + break; + case 47: + EndossoItensRadioButton = (RadioButton)target; + break; + case 48: + InativosRadioButton = (RadioButton)target; + break; + case 49: + ((MenuItem)target).Click += new RoutedEventHandler(MostrarItens_Click); + break; + case 50: + ((MenuItem)target).Click += new RoutedEventHandler(ReordenarItem_Click); + break; + case 51: + ItemGrid = (DataGrid)target; + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_005b: Unknown result type (might be due to invalid IL or missing references) + //IL_0061: Expected O, but got Unknown + //IL_0074: Unknown result type (might be due to invalid IL or missing references) + //IL_007e: Expected O, but got Unknown + //IL_007f: Unknown result type (might be due to invalid IL or missing references) + //IL_0091: Unknown result type (might be due to invalid IL or missing references) + //IL_009d: Unknown result type (might be due to invalid IL or missing references) + //IL_00a7: Expected O, but got Unknown + //IL_00a9: Unknown result type (might be due to invalid IL or missing references) + //IL_00b5: Unknown result type (might be due to invalid IL or missing references) + //IL_00bf: Expected O, but got Unknown + //IL_00c1: Unknown result type (might be due to invalid IL or missing references) + //IL_00cd: Unknown result type (might be due to invalid IL or missing references) + //IL_00d7: Expected O, but got Unknown + //IL_00d8: Unknown result type (might be due to invalid IL or missing references) + //IL_00e4: Unknown result type (might be due to invalid IL or missing references) + //IL_00ee: Expected O, but got Unknown + //IL_00f0: Unknown result type (might be due to invalid IL or missing references) + //IL_00fc: Unknown result type (might be due to invalid IL or missing references) + //IL_0106: Expected O, but got Unknown + //IL_0108: Unknown result type (might be due to invalid IL or missing references) + //IL_0114: Unknown result type (might be due to invalid IL or missing references) + //IL_011e: Expected O, but got Unknown + //IL_0120: Unknown result type (might be due to invalid IL or missing references) + //IL_012c: Unknown result type (might be due to invalid IL or missing references) + //IL_0136: Expected O, but got Unknown + //IL_0138: Unknown result type (might be due to invalid IL or missing references) + //IL_0144: Unknown result type (might be due to invalid IL or missing references) + //IL_014e: Expected O, but got Unknown + //IL_0150: Unknown result type (might be due to invalid IL or missing references) + //IL_015c: Unknown result type (might be due to invalid IL or missing references) + //IL_0166: Expected O, but got Unknown + //IL_0168: Unknown result type (might be due to invalid IL or missing references) + //IL_0174: Unknown result type (might be due to invalid IL or missing references) + //IL_017e: Expected O, but got Unknown + //IL_0180: Unknown result type (might be due to invalid IL or missing references) + //IL_018c: Unknown result type (might be due to invalid IL or missing references) + //IL_0196: Expected O, but got Unknown + //IL_0198: Unknown result type (might be due to invalid IL or missing references) + //IL_01a4: Unknown result type (might be due to invalid IL or missing references) + //IL_01ae: Expected O, but got Unknown + switch (connectionId) + { + case 18: + { + EventSetter val = new EventSetter(); + val.Event = Control.MouseDoubleClickEvent; + val.Handler = (Delegate)new MouseButtonEventHandler(ApoliceGrid_OnMouseDoubleClick); + ((Collection<SetterBase>)(object)((Style)target).Setters).Add((SetterBase)(object)val); + break; + } + case 22: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AbrirAquivoDigital_Click); + break; + case 23: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Observacoes_OnClick); + break; + case 24: + ((PopupBox)target).Opened += new RoutedEventHandler(PopupBox_OnOpened); + ((PopupBox)target).Closed += new RoutedEventHandler(PopupBox_OnClosed); + break; + case 25: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(EnviarPorWhatsApp_OnClick); + break; + case 26: + ((MenuItem)target).Click += new RoutedEventHandler(EnviarPorEmail_OnClick); + break; + case 29: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AbrirAquivoDigital_Click); + break; + case 30: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Observacoes_OnClick); + break; + case 40: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ValoresParcelaInfo_OnClick); + break; + case 41: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AbrirAquivoDigital_Click); + break; + case 42: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Observacoes_OnClick); + break; + case 52: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AbrirAquivoDigital_Click); + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Seguros/CriticaApoliceView.cs b/Decompiler/Gestor.Application.Views.Seguros/CriticaApoliceView.cs new file mode 100644 index 0000000..296bea8 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Seguros/CriticaApoliceView.cs @@ -0,0 +1,1658 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Data; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Threading; +using CsQuery.ExtensionMethods; +using CurrencyTextBoxControl; +using Gestor.Application.Componentes; +using Gestor.Application.Drawers; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.ViewModels.Seguros; +using Gestor.Application.Views.Generic; +using Gestor.Application.Views.Seguros.Itens; +using Gestor.Common.Helpers; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using MaterialDesignThemes.Wpf; +using Xceed.Wpf.AvalonDock.Controls; + +namespace Gestor.Application.Views.Seguros; + +public class CriticaApoliceView : BaseUserControl, IComponentConnector, IStyleConnector +{ + internal ComboBox UsuarioBox; + + internal ComboBox SeguradoraBox; + + internal DatePicker InicioBox; + + internal DatePicker FimBox; + + internal ToggleButton CriticadoBox; + + internal DataGrid CriticaGrid; + + internal MenuItem ConcluirCriticaButton; + + internal MenuItem CancelarDocumento; + + internal ComboBox ProdutoBox; + + internal ComboBox NegocioCorretoraBox; + + internal ComboBox SituacaoBox; + + internal DatePicker TransmissaoBox; + + internal TextBox ApoliceBox; + + internal TextBox EndossoBox; + + internal DatePicker EmissaoBox; + + internal DatePicker Vigencia1Box; + + internal DatePicker Vigencia2Box; + + internal ToggleButton AdicionalBox; + + internal CustomIsReadOnlyControl Comissao; + + internal CurrencyTextBox ComissaoBox; + + internal CurrencyTextBox PremioLiquidoBox; + + internal CurrencyTextBox PremioAdicionalBox; + + internal CurrencyTextBox IofBox; + + internal CurrencyTextBox DiferencaBox; + + internal CurrencyTextBox PremioTotalBox; + + internal CurrencyTextBox ParcelasBox; + + internal ToggleButton SeguroCombinadoBox; + + internal MenuItem EditarVendedorButton; + + internal MenuItem SalvarVendedorButton; + + internal MenuItem CancelarVendedorButton; + + internal WrapPanel VendedorFields; + + internal ToggleButton CoCorretagemToogle; + + internal ComboBox TipoVendedorBox; + + internal ComboBox VendedorBox; + + internal CustomItemValidation ComissaoNovoBox; + + internal ComboBox ComissaoNovoComboBox; + + internal CustomItemValidation ComissaoRenovacaoBox; + + internal ComboBox ComissaoRenovacaoComboBox; + + internal CurrencyTextBox ValorRepasseBox; + + internal TextBox FormaRecebidaBox; + + internal DataGrid VendedorGrid; + + internal DataGridTextColumn RepasseVendedor; + + internal TextBox NomeBox; + + internal ComboBox TipoDocumentoPrincipalBox; + + internal TextBox DocumentoPrincipalBox; + + internal DatePicker NascimentoBox; + + internal TextBox IdentidadeBox; + + internal TextBox EmissorBox; + + internal TextBox EstadoEmissorBox; + + internal ListBox TelefoneListBox; + + internal ListBox EmailListBox; + + internal DataGrid ItemGrid; + + private bool _contentLoaded; + + public CriticaApoliceViewModel ViewModel { get; set; } + + private bool AdicionandoVendedor { get; set; } + + private int Ordem { get; set; } = 1; + + + public CriticaApoliceView() + { + ((FrameworkElement)this).Tag = "CRÍTICA DE IMPORTAÇÃO"; + ViewModel = new CriticaApoliceViewModel(); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + } + + private async void ContentLoad() + { + ((UIElement)DocumentoPrincipalBox).LostFocus += new RoutedEventHandler(DocumentoPrincipalBox_OnLostFocus); + TextBox documentoPrincipalBox = DocumentoPrincipalBox; + CriticaApoliceView criticaApoliceView = this; + ((UIElement)documentoPrincipalBox).PreviewTextInput += new TextCompositionEventHandler(criticaApoliceView.SomenteNumeros); + CriticadoBox.Checked += new RoutedEventHandler(Criticado_OnChecked); + CriticadoBox.Unchecked += new RoutedEventHandler(Criticado_OnChecked); + ((Selector)UsuarioBox).SelectionChanged += new SelectionChangedEventHandler(Usuario_OnSelectionChanged); + ((Selector)SeguradoraBox).SelectionChanged += new SelectionChangedEventHandler(Seguradora_OnSelectionChanged); + ((UIElement)InicioBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)InicioBox).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + InicioBox.SelectedDateChanged += FiltroDataBox_OnSelectedDateChanged; + ((UIElement)FimBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)FimBox).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + FimBox.SelectedDateChanged += FiltroDataBox_OnSelectedDateChanged; + ((UIElement)TransmissaoBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)TransmissaoBox).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((UIElement)EmissaoBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)EmissaoBox).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((UIElement)Vigencia1Box).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)Vigencia1Box).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((UIElement)Vigencia2Box).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)Vigencia2Box).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Selector)NegocioCorretoraBox).SelectionChanged += new SelectionChangedEventHandler(NegocioCorretoraBox_OnSelectionChanged); + ((UIElement)PremioLiquidoBox).LostFocus += new RoutedEventHandler(AlteracaoDePremio_LostFocus); + ((UIElement)PremioAdicionalBox).LostFocus += new RoutedEventHandler(AlteracaoDePremio_LostFocus); + ((UIElement)IofBox).LostFocus += new RoutedEventHandler(AlteracaoDePremio_LostFocus); + ((UIElement)DiferencaBox).LostFocus += new RoutedEventHandler(AlteracaoDePremio_LostFocus); + AdicionalBox.Unchecked += new RoutedEventHandler(AdicionalBox_OnChecked); + AdicionalBox.Checked += new RoutedEventHandler(AdicionalBox_OnChecked); + ((Selector)VendedorBox).SelectionChanged += new SelectionChangedEventHandler(VendedorBox_OnSelectionChanged); + ((Selector)TipoVendedorBox).SelectionChanged += new SelectionChangedEventHandler(TipoVendedorBox_OnSelectionChanged); + ((Selector)TipoDocumentoPrincipalBox).SelectionChanged += new SelectionChangedEventHandler(TipoDocumentoPrincipalBox_OnSelectionChanged); + ((Selector)CriticaGrid).SelectionChanged += new SelectionChangedEventHandler(Grid_OnSelectionChanged); + ((DataGridColumn)RepasseVendedor).Visibility = (Visibility)(ViewModel.Restricao((TipoRestricao)95) ? 2 : 0); + await ViewModel.InitialLoad(); + } + + private void NegocioCorretoraBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0026: Expected O, but got Unknown + //IL_002c: Unknown result type (might be due to invalid IL or missing references) + //IL_0042: Unknown result type (might be due to invalid IL or missing references) + ComboBox val = (ComboBox)sender; + if ((((int)val != 0) ? ((Selector)val).SelectedItem : null) != null) + { + AlteracaoDePremio_LostFocus(PremioLiquidoBox, new RoutedEventArgs()); + if ((int)((UIElement)SalvarVendedorButton).Visibility == 0) + { + EditarVendedor(editar: true); + ComissaoVendedorBox_OnSelectionChanged(((int)((UIElement)ComissaoNovoBox).Visibility == 0) ? ComissaoNovoComboBox : ComissaoRenovacaoComboBox, e); + } + } + } + + private void DocumentoPrincipalBox_OnLostFocus(object sender, RoutedEventArgs e) + { + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_0031: Unknown result type (might be due to invalid IL or missing references) + //IL_0036: Unknown result type (might be due to invalid IL or missing references) + if (((Selector)TipoDocumentoPrincipalBox).SelectedItem == null) + { + ((Selector)TipoDocumentoPrincipalBox).SelectedItem = (object)(TipoDocumento)0; + } + if ((int)(TipoDocumento)((Selector)TipoDocumentoPrincipalBox).SelectedItem == 0) + { + TextBox val = (TextBox)sender; + val.Text = ValidationHelper.FormatDocument(val.Text); + } + } + + private void AlteracaoDePremio_LostFocus(object sender, RoutedEventArgs e) + { + //IL_001d: Unknown result type (might be due to invalid IL or missing references) + //IL_0023: Expected O, but got Unknown + if (!ViewModel.AllowEditApolice || ViewModel.SelectedDocumento == null) + { + return; + } + CurrencyTextBox val = (CurrencyTextBox)sender; + if (val == null) + { + return; + } + string name = ((FrameworkElement)val).Name; + if ((name == "PremioLiquidoBox" || name == "PremioAdicionalBox") && IofBox.Number == 0m) + { + decimal num = PremioLiquidoBox.Number + PremioAdicionalBox.Number; + Ramo ramo = ViewModel.SelectedDocumento.Controle.Ramo; + decimal num2 = num * ((ramo != null) ? ramo.Iof : 0m); + IofBox.Number = num2; + CurrencyTextBox premioTotalBox = PremioTotalBox; + premioTotalBox.Number += num2; + } + PremioTotalBox.Number = PremioLiquidoBox.Number + PremioAdicionalBox.Number + IofBox.Number + DiferencaBox.Number; + switch (((FrameworkElement)val).Name) + { + case "PremioLiquidoBox": + case "PremioAdicionalBox": + case "ComissaoBox": + if (ViewModel.HabilitarVendedor().Count == 0) + { + ViewModel.RecalculaRepasses(); + } + break; + } + ValidarDocumento(); + } + + private void AdicionalBox_OnChecked(object sender, RoutedEventArgs e) + { + //IL_0015: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Expected O, but got Unknown + if (ViewModel.SelectedDocumento != null) + { + AlteracaoDePremio_LostFocus(PremioAdicionalBox, new RoutedEventArgs()); + } + } + + private void ValidarDocumento() + { + if (ViewModel.SelectedDocumento == null) + { + return; + } + List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedDocumento.Validate(); + if (ViewModel.Telefones != null) + { + ExtensionMethods.ForEach<ClienteTelefone>((IEnumerable<ClienteTelefone>)ViewModel.Telefones, (Action<ClienteTelefone>)delegate(ClienteTelefone x) + { + List<KeyValuePair<string, string>> collection = x.Validate(); + errorMessages.AddRange(collection); + }); + } + ((DependencyObject)(object)this).ValidateFields(errorMessages, focusField: false); + ExtensionMethods.ForEach<DependencyObject>(Extentions.FindVisualChildren<DependencyObject>((DependencyObject)(object)TelefoneListBox), (Action<DependencyObject>)delegate(DependencyObject child) + { + child.ValidateFields(errorMessages, focusField: false); + }); + } + + private async void Criticado_OnChecked(object sender, RoutedEventArgs e) + { + ToggleButton val = (ToggleButton)sender; + if (val != null && val.IsChecked.HasValue) + { + ComboBox usuarioBox = UsuarioBox; + if (((usuarioBox != null) ? ((Selector)usuarioBox).SelectedItem : null) != null && !ViewModel.IsLoading) + { + bool ischecked = val.IsChecked.Value; + ((Selector)SeguradoraBox).SelectionChanged -= new SelectionChangedEventHandler(Seguradora_OnSelectionChanged); + ((Selector)UsuarioBox).SelectionChanged -= new SelectionChangedEventHandler(Usuario_OnSelectionChanged); + CriticadoBox.Checked -= new RoutedEventHandler(Criticado_OnChecked); + await ViewModel.CarregarUsuarios(((DomainBase)(Usuario)((Selector)UsuarioBox).SelectedItem).Id, ischecked); + await ViewModel.CarregaCritica(((DomainBase)ViewModel.SelectedUsuario).Id, ((DomainBase)ViewModel.SelectedSeguradora).Id, ischecked); + ((Selector)SeguradoraBox).SelectionChanged += new SelectionChangedEventHandler(Seguradora_OnSelectionChanged); + ((Selector)UsuarioBox).SelectionChanged += new SelectionChangedEventHandler(Usuario_OnSelectionChanged); + CriticadoBox.Checked += new RoutedEventHandler(Criticado_OnChecked); + } + } + } + + private async void Usuario_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + ComboBox val = (ComboBox)sender; + if (val != null && ((Selector)val).SelectedItem != null) + { + ToggleButton criticadoBox = CriticadoBox; + if (criticadoBox != null && criticadoBox.IsChecked.HasValue && ViewModel.SelectedSeguradora != null) + { + ((Selector)SeguradoraBox).SelectionChanged -= new SelectionChangedEventHandler(Seguradora_OnSelectionChanged); + ((Selector)UsuarioBox).SelectionChanged -= new SelectionChangedEventHandler(Usuario_OnSelectionChanged); + CriticadoBox.Checked -= new RoutedEventHandler(Criticado_OnChecked); + ViewModel.SelectedUsuario = (Usuario)((Selector)val).SelectedItem; + await ViewModel.CarregaCritica(((DomainBase)(Usuario)((Selector)val).SelectedItem).Id, ((DomainBase)ViewModel.SelectedSeguradora).Id, ViewModel.Criticado); + ((Selector)SeguradoraBox).SelectionChanged += new SelectionChangedEventHandler(Seguradora_OnSelectionChanged); + ((Selector)UsuarioBox).SelectionChanged += new SelectionChangedEventHandler(Usuario_OnSelectionChanged); + CriticadoBox.Checked += new RoutedEventHandler(Criticado_OnChecked); + } + } + } + + private async void Seguradora_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + ComboBox val = (ComboBox)sender; + if (val != null && ((Selector)val).SelectedItem != null) + { + ToggleButton criticadoBox = CriticadoBox; + if (criticadoBox != null && criticadoBox.IsChecked.HasValue) + { + ((Selector)SeguradoraBox).SelectionChanged -= new SelectionChangedEventHandler(Seguradora_OnSelectionChanged); + ((Selector)UsuarioBox).SelectionChanged -= new SelectionChangedEventHandler(Usuario_OnSelectionChanged); + CriticadoBox.Checked -= new RoutedEventHandler(Criticado_OnChecked); + ViewModel.SelectedSeguradora = (Seguradora)((Selector)val).SelectedItem; + await ViewModel.CarregaCritica(((DomainBase)ViewModel.SelectedUsuario).Id, ((DomainBase)(Seguradora)((Selector)val).SelectedItem).Id, ViewModel.Criticado); + ((Selector)SeguradoraBox).SelectionChanged += new SelectionChangedEventHandler(Seguradora_OnSelectionChanged); + ((Selector)UsuarioBox).SelectionChanged += new SelectionChangedEventHandler(Usuario_OnSelectionChanged); + CriticadoBox.Checked += new RoutedEventHandler(Criticado_OnChecked); + } + } + } + + private async void FiltroDataBox_OnSelectedDateChanged(object sender, SelectionChangedEventArgs e) + { + DatePicker val = (DatePicker)sender; + if ((int)val != 0 && val.SelectedDate.HasValue) + { + ComboBox usuarioBox = UsuarioBox; + if (((usuarioBox != null) ? ((Selector)usuarioBox).SelectedItem : null) != null) + { + ((Selector)SeguradoraBox).SelectionChanged -= new SelectionChangedEventHandler(Seguradora_OnSelectionChanged); + ((Selector)UsuarioBox).SelectionChanged -= new SelectionChangedEventHandler(Usuario_OnSelectionChanged); + CriticadoBox.Checked -= new RoutedEventHandler(Criticado_OnChecked); + await ViewModel.CarregarUsuarios(((DomainBase)(Usuario)((Selector)UsuarioBox).SelectedItem).Id, ViewModel.Criticado); + await ViewModel.CarregaCritica(((DomainBase)ViewModel.SelectedUsuario).Id, ((DomainBase)ViewModel.SelectedSeguradora).Id, ViewModel.Criticado); + ((Selector)SeguradoraBox).SelectionChanged += new SelectionChangedEventHandler(Seguradora_OnSelectionChanged); + ((Selector)UsuarioBox).SelectionChanged += new SelectionChangedEventHandler(Usuario_OnSelectionChanged); + CriticadoBox.Checked += new RoutedEventHandler(Criticado_OnChecked); + } + } + } + + private async void EditarVendedorButton_OnClick(object sender, RoutedEventArgs e) + { + List<KeyValuePair<string, string>> list = ViewModel.SelectedDocumento.Validate(); + bool flag = list == null || list.Count == 0; + if (flag) + { + Parcela selectedParcela = ViewModel.SelectedParcela; + if (selectedParcela != null && selectedParcela.DataRecebimento.HasValue) + { + await ViewModel.ShowMessage("DOCUMENTO COM PARCELA(S) JÁ BAIXADA(S), NÃO É POSSÍVEL ALTERAR VENDEDORES!"); + return; + } + } + if (!flag) + { + ((DependencyObject)(object)this).ValidateFields(list); + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + else + { + ViewModel.IncluirVendedor(); + EditarVendedor(editar: true); + ViewModel.VendedorCoCorretagem(); + } + } + + private void EditarVendedor(bool editar) + { + //IL_0154: Unknown result type (might be due to invalid IL or missing references) + //IL_015a: Invalid comparison between Unknown and I4 + AdicionandoVendedor = editar; + ((UIElement)SalvarVendedorButton).Visibility = (Visibility)((!editar) ? 2 : 0); + ((UIElement)CancelarVendedorButton).Visibility = (Visibility)((!editar) ? 2 : 0); + ((UIElement)EditarVendedorButton).Visibility = (Visibility)(editar ? 2 : 0); + ((UIElement)VendedorFields).Visibility = (Visibility)((!editar) ? 2 : 0); + ((UIElement)VendedorGrid).IsEnabled = !editar; + if (ViewModel.SelectedDocumento == null) + { + return; + } + if (editar && Recursos.Configuracoes.Any((ConfiguracaoSistema config) => (int)config.Configuracao == 56)) + { + ObservableCollection<VendedorParcela> pagamentos = ViewModel.Pagamentos; + int num; + if (pagamentos == null || pagamentos.Count != 1 || !ViewModel.Pagamentos.Any((VendedorParcela vendedor) => vendedor.Repasse == null)) + { + ObservableCollection<VendedorParcela> pagamentos2 = ViewModel.Pagamentos; + num = ((pagamentos2 != null && pagamentos2.Count == 0) ? 1 : 0); + } + else + { + num = 1; + } + bool isEnabled = (byte)num != 0; + ((UIElement)CoCorretagemToogle).IsEnabled = isEnabled; + ((UIElement)ComissaoNovoBox).Visibility = (Visibility)0; + ((UIElement)ComissaoRenovacaoBox).Visibility = (Visibility)2; + CoCorretagemToogle.IsChecked = false; + } + else + { + bool flag = (int)ViewModel.SelectedDocumento.NegocioCorretora.GetValueOrDefault() == 1; + ((UIElement)ComissaoNovoBox).Visibility = (Visibility)((!editar || flag) ? 2 : 0); + ((UIElement)ComissaoRenovacaoBox).Visibility = (Visibility)((!(editar && flag)) ? 2 : 0); + } + } + + private void VendedorBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0026: Expected O, but got Unknown + //IL_0039: Unknown result type (might be due to invalid IL or missing references) + //IL_003f: Invalid comparison between Unknown and I4 + ComboBox val = (ComboBox)sender; + if (((Selector)val).SelectedItem != null) + { + ViewModel.FiltrarRepasse((Vendedor)((Selector)val).SelectedItem); + bool flag = (int)ViewModel.SelectedDocumento.NegocioCorretora.GetValueOrDefault() == 1; + if (flag && ViewModel.CoCorretagem) + { + ((UIElement)ComissaoNovoBox).Visibility = (Visibility)0; + ((UIElement)ComissaoRenovacaoBox).Visibility = (Visibility)2; + } + else + { + ((UIElement)ComissaoNovoBox).Visibility = (Visibility)(flag ? 2 : 0); + ((UIElement)ComissaoRenovacaoBox).Visibility = (Visibility)((!flag) ? 2 : 0); + } + } + } + + private void ComissaoVendedorBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_001c: Expected O, but got Unknown + //IL_00e7: Unknown result type (might be due to invalid IL or missing references) + //IL_00ed: Invalid comparison between Unknown and I4 + //IL_002b: Unknown result type (might be due to invalid IL or missing references) + //IL_0031: Invalid comparison between Unknown and I4 + //IL_0103: Unknown result type (might be due to invalid IL or missing references) + //IL_0109: Invalid comparison between Unknown and I4 + //IL_0136: Unknown result type (might be due to invalid IL or missing references) + //IL_013b: Unknown result type (might be due to invalid IL or missing references) + //IL_0147: Expected O, but got Unknown + //IL_0191: Unknown result type (might be due to invalid IL or missing references) + //IL_0197: Invalid comparison between Unknown and I4 + ComboBox val = (ComboBox)sender; + if (((Selector)val).SelectedItem == null) + { + return; + } + Repasse val2 = (Repasse)((Selector)val).SelectedItem; + if (val2 != null && (int)val2.Tipo.GetValueOrDefault() == 3) + { + decimal num = ViewModel.SelectedDocumento.Comissao * (val2.ValorNovo * 0.01m) * 0.01m; + ViewModel.SelectedPagamento.ValorRepasse = ViewModel.SelectedDocumento.PremioTotal * num; + ValorRepasseBox.Number = ViewModel.SelectedPagamento.ValorRepasse.Value; + return; + } + ViewModel.SelectedPagamento.Repasse = val2; + ViewModel.SelectedPagamento.PorcentagemRepasse = (((int)ViewModel.SelectedDocumento.Situacao == 2 && (int)ViewModel.SelectedDocumento.Negocio.GetValueOrDefault() == 1) ? val2.ValorRenovacao : val2.ValorNovo); + if (ViewModel.SelectedParcela == null) + { + ViewModel.SelectedParcela = new Parcela + { + SubTipo = (SubTipo)1 + }; + } + ViewModel.SelectedParcela.Documento = ViewModel.SelectedDocumento; + ViewModel.SelectedPagamento.ValorRepasse = Funcoes.CalculaRepasse(val2, ViewModel.SelectedParcela, ViewModel.SelectedParcela == null || (int)ViewModel.SelectedParcela.SubTipo == 1); + ViewModel.SelectedPagamento.ValorTotal = ViewModel.SelectedPagamento.ValorRepasse; + ValorRepasseBox.Number = ViewModel.SelectedPagamento.ValorRepasse.Value; + FormaRecebidaBox.Text = EnumHelper.GetDescription<FormaRepasse?>(val2.Forma); + } + + private void TipoVendedorBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_003e: Unknown result type (might be due to invalid IL or missing references) + //IL_0048: Expected O, but got Unknown + //IL_0023: Unknown result type (might be due to invalid IL or missing references) + //IL_002d: Expected O, but got Unknown + ComboBox val = (ComboBox)sender; + if (((Selector)val).SelectedItem != null) + { + if (ViewModel.SelectedPagamento == null) + { + ViewModel.SelectedPagamento = new VendedorParcela(); + } + ViewModel.SelectedPagamento.TipoVendedor = (TipoVendedor)((Selector)val).SelectedItem; + } + } + + private async void SalvarVendedor_Click(object sender, RoutedEventArgs e) + { + ((MenuItem)sender).Click -= new RoutedEventHandler(SalvarVendedor_Click); + bool flag = ViewModel.CoCorretagem; + if (flag) + { + flag = !(await ViewModel.ShowMessage("AO ADICIONAR CO-CORRETAGEM COMO VENDEDOR, O DOCUMENTO ACIMA SERÁ SALVO.\nDESEJÁ CONTINUAR?", "SIM", "NÃO")); + } + if (flag) + { + ((MenuItem)sender).Click += new RoutedEventHandler(SalvarVendedor_Click); + return; + } + bool flag2 = ViewModel.SelectedParcela == null || ((int)ViewModel.SelectedParcela.SubTipo == 1 && (int)ViewModel.SelectedDocumento.TipoRecebimento.GetValueOrDefault() == 1); + bool flag3 = (int)ViewModel.SelectedDocumento.NegocioCorretora.GetValueOrDefault() == 1; + if (((Selector)ComissaoRenovacaoComboBox).SelectedItem == null && ((Selector)ComissaoNovoComboBox).SelectedItem == null) + { + await ViewModel.ShowMessage("NECESSÁRIOS ESCOLHER O VALOR DE REPASSE ANTES DE ADICIONAR O VENDEDOR"); + ((MenuItem)sender).Click += new RoutedEventHandler(SalvarVendedor_Click); + return; + } + VendedorParcela selectedPagamento = ViewModel.SelectedPagamento; + int num; + if (selectedPagamento == null) + { + num = 0; + } + else + { + Repasse repasse = selectedPagamento.Repasse; + num = (((int)((repasse != null) ? repasse.Tipo : null).GetValueOrDefault() == 3) ? 1 : 0); + } + if (num != 0) + { + flag3 = false; + } + object obj = ((Selector)ComissaoRenovacaoComboBox).SelectedItem ?? ((Selector)ComissaoNovoComboBox).SelectedItem; + ViewModel.SelectedPagamento.PorcentagemRepasse = (flag3 ? ((Repasse)obj).ValorRenovacao : ((Repasse)obj).ValorNovo); + List<KeyValuePair<string, string>> list = ((!flag2) ? (await ViewModel.AdicionarVendedorParcelaEspecial()) : (await ViewModel.AdicionarVendedor())); + List<KeyValuePair<string, string>> list2 = list; + if (list2 == null || list2.Count == 0) + { + EditarVendedor(editar: false); + if (ViewModel.VerificaCoCorretagem()) + { + ((TextBoxBase)ComissaoBox).IsReadOnly = true; + ViewModel.ComissOriginalVisibility = (Visibility)0; + } + ((MenuItem)sender).Click += new RoutedEventHandler(SalvarVendedor_Click); + } + else + { + await ViewModel.ShowMessage(list2, ViewModel.ErroCamposInvalidos, "OK"); + ((MenuItem)sender).Click += new RoutedEventHandler(SalvarVendedor_Click); + } + } + + private void CancelarVendedor_Click(object sender, RoutedEventArgs e) + { + EditarVendedor(editar: false); + ViewModel.SelectedPagamento = null; + ViewModel.SelecionarVendedor(); + } + + private async void ConcluirCritica_OnClick(object sender, RoutedEventArgs e) + { + ConcluirCriticaButton.Click -= new RoutedEventHandler(ConcluirCritica_OnClick); + ViewModel.EnableGrid = false; + ExecutarValidacaoData(); + ((UIElement)NomeBox).Focus(); + if (ViewModel.CompararValores()) + { + PremioTotalBox.Number = PremioLiquidoBox.Number + PremioAdicionalBox.Number + IofBox.Number + DiferencaBox.Number; + } + await SalvarDocumento(); + ConcluirCriticaButton.Click += new RoutedEventHandler(ConcluirCritica_OnClick); + } + + private void ExecutarValidacaoData() + { + ViewModel.SelectedCliente.Nascimento = ((NascimentoBox.Text != null && DateTime.TryParse(ValidationHelper.FormatDate(NascimentoBox.Text), out var result)) ? new DateTime?(result) : null); + ViewModel.SelectedDocumento.Remessa = ((TransmissaoBox.Text != null && DateTime.TryParse(ValidationHelper.FormatDate(TransmissaoBox.Text), out result)) ? new DateTime?(result) : null); + ViewModel.SelectedDocumento.Emissao = ((EmissaoBox.Text != null && DateTime.TryParse(ValidationHelper.FormatDate(EmissaoBox.Text), out result)) ? new DateTime?(result) : null); + ViewModel.SelectedDocumento.Vigencia1 = ((Vigencia1Box.Text != null && DateTime.TryParse(ValidationHelper.FormatDate(Vigencia1Box.Text), out result)) ? result : Funcoes.GetNetworkTime().Date); + ViewModel.SelectedDocumento.Vigencia2 = ((Vigencia2Box.Text != null && DateTime.TryParse(ValidationHelper.FormatDate(Vigencia2Box.Text), out result)) ? new DateTime?(result) : null); + } + + private async Task SalvarDocumento() + { + ViewModel.Loading(isLoading: true); + List<KeyValuePair<string, string>> list = null; + if (AdicionandoVendedor) + { + list = await ViewModel.AdicionarVendedor(); + } + if (list != null && list.Count != 0) + { + ViewModel.Loading(isLoading: false); + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + return; + } + list = await ViewModel.SalvarCliente(); + if (list != null && list.Count != 0) + { + ViewModel.Loading(isLoading: false); + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + return; + } + if (!ViewModel.StatusDocumento.HasValue) + { + list = new List<KeyValuePair<string, string>> + { + new KeyValuePair<string, string>("STATUS DO SEGURO", "OBRIGATÓRIO") + }; + } + if (list != null && list.Count != 0) + { + ViewModel.Loading(isLoading: false); + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + return; + } + if (!ViewModel.StatusDocumento.HasValue) + { + ViewModel.SelectedDocumento.Situacao = (TipoSeguro)1; + } + list = await ViewModel.Salvar(critica: true); + if (list != null && list.Count != 0) + { + if (list.Any((KeyValuePair<string, string> x) => x.Value == "VIGENCIANAOACEITA")) + { + ViewModel.Loading(isLoading: false); + return; + } + ViewModel.Loading(isLoading: false); + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + else + { + await ViewModel.ConcluirCritica(); + EditarVendedor(editar: false); + ViewModel.EnableGrid = true; + SeguroCombinadoBox.IsChecked = false; + } + } + + private void OrdemBox_OnPreviewGotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) + { + TextBox val = (TextBox)((sender is TextBox) ? sender : null); + if (val != null && int.TryParse(val.Text, out var result)) + { + Ordem = result; + } + } + + private void ExcluirTelefone_OnClick(object sender, RoutedEventArgs e) + { + //IL_001a: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Expected O, but got Unknown + Button val = (Button)((sender is Button) ? sender : null); + if (val != null && ((FrameworkElement)val).DataContext != null) + { + ClienteTelefone telefone = (ClienteTelefone)((FrameworkElement)val).DataContext; + ViewModel.ExcluirTelefone(telefone); + } + } + + private void ExcluirEmail_OnClick(object sender, RoutedEventArgs e) + { + //IL_001a: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Expected O, but got Unknown + Button val = (Button)((sender is Button) ? sender : null); + if (val != null && ((FrameworkElement)val).DataContext != null) + { + ClienteEmail email = (ClienteEmail)((FrameworkElement)val).DataContext; + ViewModel.ExcluirEmail(email); + } + } + + private void TipoDocumentoPrincipalBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + ViewModel.AlteraDocumentoPrincipal(); + } + + private async void AbrirAquivoDigital_Click(object sender, RoutedEventArgs e) + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)2).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + EnumHelper.GetDescription<TipoArquivoDigital>((TipoArquivoDigital)2) + "."); + return; + } + FiltroArquivoDigital filtro = new FiltroArquivoDigital + { + Id = ((DomainBase)ViewModel.SelectedCritica.Documento).Id, + Tipo = (TipoArquivoDigital)2, + Parente = ViewModel.SelectedCritica.Documento + }; + ViewModel.ShowDrawer(new ArquivoDigitalDrawer(filtro), 0, close: false); + } + + private async void ExcluirVendedor_OnClick(object sender, RoutedEventArgs e) + { + DataGrid vendedorGrid = VendedorGrid; + if (vendedorGrid == null || ((Selector)vendedorGrid).SelectedIndex >= 0) + { + DataGrid vendedorGrid2 = VendedorGrid; + VendedorParcela val = (VendedorParcela)((vendedorGrid2 != null) ? ((ItemsControl)vendedorGrid2).Items[((Selector)VendedorGrid).SelectedIndex] : null); + int num; + if (val == null) + { + num = 0; + } + else + { + Repasse repasse = val.Repasse; + num = (((int)((repasse != null) ? repasse.Tipo : null).GetValueOrDefault() == 3) ? 1 : 0); + } + bool deleteCoCorretagem = (byte)num != 0; + CriticaApoliceViewModel viewModel = ViewModel; + DataGrid vendedorGrid3 = VendedorGrid; + await viewModel.ExcluirVendedor((VendedorParcela)((vendedorGrid3 != null) ? ((ItemsControl)vendedorGrid3).Items[((Selector)VendedorGrid).SelectedIndex] : null)); + await ViewModel.SelecionaParcela(ViewModel.Parcelas.FirstOrDefault()); + ((TextBoxBase)ComissaoBox).IsReadOnly = ViewModel.VerificaCoCorretagem(); + ViewModel.ComissOriginalVisibility = (Visibility)((!((TextBoxBase)ComissaoBox).IsReadOnly) ? 2 : 0); + if (deleteCoCorretagem) + { + await ViewModel.AjusteComissãoCoCorretagem(removido: true); + } + } + } + + private async void Cliente_OnClick(object sender, RoutedEventArgs e) + { + ((Window)new HosterWindow((ContentControl)(object)new ClienteView(ViewModel.SelectedDocumento.Controle.Cliente, lockInsert: true), "CADASTRO DE CLIENTES - " + ViewModel.SelectedDocumento.Controle.Cliente.Nome)).ShowDialog(); + CriticaApoliceViewModel viewModel = ViewModel; + viewModel.SelectedCliente = await ViewModel.CarregaCliente(((DomainBase)ViewModel.SelectedCliente).Id); + await ViewModel.SelecionaCliente(ViewModel.SelectedCliente); + } + + private async void Apolice_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.SelectedDocumento != null) + { + ((Window)new HosterWindow((ContentControl)(object)new ApoliceView(ViewModel.SelectedDocumento, lockInsert: true, invoke: false, (AcessoApolice)0, 0L, consultaTela: true), "CADASTRO DE APÓLICES - " + ViewModel.SelectedDocumento.Controle.Cliente.Nome + " - " + ViewModel.SelectedDocumento.Apolice)).ShowDialog(); + await ViewModel.SelecionaDocumento(ViewModel.SelectedDocumento); + } + } + + private async void Item_Click(object sender, RoutedEventArgs e) + { + Button val = (Button)sender; + if (((FrameworkElement)val).DataContext == null) + { + return; + } + Item val2 = (Item)((FrameworkElement)val).DataContext; + val2.Documento = ViewModel.SelectedDocumento; + long id = ((DomainBase)ViewModel.SelectedDocumento.Controle.Ramo).Id; + long num = id - 1; + if ((ulong)num <= 19uL) + { + switch (num) + { + case 4L: + goto IL_00f9; + case 0L: + case 1L: + case 2L: + case 14L: + case 17L: + goto IL_0120; + case 12L: + goto IL_0147; + case 19L: + goto IL_016e; + case 5L: + case 6L: + case 8L: + case 9L: + goto IL_0192; + case 3L: + case 7L: + case 10L: + case 11L: + case 13L: + case 15L: + case 16L: + case 18L: + goto IL_01da; + } + } + long num2 = id - 36; + if ((ulong)num2 <= 2uL) + { + switch (num2) + { + case 1L: + goto IL_00f9; + case 2L: + goto IL_0120; + case 0L: + goto IL_01b6; + } + } + if (id == 53) + { + goto IL_0192; + } + goto IL_01da; + IL_01b6: + UserControl control = (UserControl)(object)new ConsorcioView(null, lockInsert: true, substituir: false, null, val2, ViewModel.SelectedDocumento.Controle.Ramo); + goto IL_01fc; + IL_0192: + control = (UserControl)(object)new VidaView(null, lockInsert: true, substituir: false, null, val2, ViewModel.SelectedDocumento.Controle.Ramo); + goto IL_01fc; + IL_0147: + control = (UserControl)(object)new AeronauticoView(null, lockInsert: true, substituir: false, null, val2, ViewModel.SelectedDocumento.Controle.Ramo); + goto IL_01fc; + IL_016e: + control = (UserControl)(object)new GranizoView(null, lockInsert: true, substituir: false, null, val2, ViewModel.SelectedDocumento.Controle.Ramo); + goto IL_01fc; + IL_01da: + control = (UserControl)(object)new RiscosDiversosView(null, lockInsert: false, substituir: false, null, val2, ViewModel.SelectedDocumento.Controle.Ramo); + goto IL_01fc; + IL_01fc: + ((Window)new HosterWindow((ContentControl)(object)control, "CADASTRO DE CLIENTES - " + ViewModel.SelectedDocumento.Controle.Cliente.Nome)).ShowDialog(); + await ViewModel.SelecionaItens(((DomainBase)ViewModel.SelectedDocumento.Controle).Id); + return; + IL_00f9: + control = (UserControl)(object)new AutoView(null, lockInsert: true, substituir: false, null, val2, ViewModel.SelectedDocumento.Controle.Ramo); + goto IL_01fc; + IL_0120: + control = (UserControl)(object)new PatrimonialView(null, lockInsert: true, substituir: false, null, val2, ViewModel.SelectedDocumento.Controle.Ramo); + goto IL_01fc; + } + + private async void Perfil_OnClick(object sender, RoutedEventArgs e) + { + PerfilView perfilView = new PerfilView(ViewModel.SelectedDocumento.Controle); + if (await ViewModel.VerificarPermissao((TipoTela)32)) + { + ((Window)new HosterWindow((ContentControl)(object)perfilView, "PERFIL", 800.0, 370.0)).ShowDialog(); + } + } + + private void Tarefa_OnClick(object sender, RoutedEventArgs e) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0025: Unknown result type (might be due to invalid IL or missing references) + //IL_0045: Unknown result type (might be due to invalid IL or missing references) + //IL_004c: Unknown result type (might be due to invalid IL or missing references) + //IL_0062: Unknown result type (might be due to invalid IL or missing references) + //IL_009d: Expected O, but got Unknown + Tarefa tarefa = new Tarefa + { + IdCliente = ((DomainBase)ViewModel.SelectedDocumento.Controle.Cliente).Id, + Cliente = ViewModel.SelectedDocumento.Controle.Cliente.Nome, + Entidade = (TipoTarefa)0, + IdEntidade = ((DomainBase)ViewModel.SelectedDocumento).Id, + Titulo = ViewModel.SelectedDocumento.Controle.Cliente.Nome + " APÓLICE " + ViewModel.SelectedDocumento.Apolice + }; + ViewModel.ShowDrawer(new TarefaDrawer(tarefa), 0, close: false); + } + + private void Pesquisa_OnPreviewKeyDown(object sender, KeyEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Invalid comparison between Unknown and I4 + if ((int)e.Key == 6) + { + ViewModel.AdcionarFiltro(); + } + } + + private void AdicionarFiltro_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AdcionarFiltro(); + } + + private void ExcluirFiltro_OnClick(object sender, RoutedEventArgs e) + { + Chip val = (Chip)((sender is Chip) ? sender : null); + if (val != null) + { + ListBox val2 = Extentions.FindVisualAncestor<ListBox>((DependencyObject)(object)val); + string text = (string)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)]; + if (text != null) + { + ViewModel.PesquisaCritica.Remove(text); + ViewModel.Pesquisar(); + } + } + } + + private async void Atualizar_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.CarregaCritica(((DomainBase)ViewModel.SelectedUsuario).Id, ((DomainBase)ViewModel.SelectedSeguradora).Id, ViewModel.Criticado); + } + + private async void Alterar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Alterar(alterar: true); + ViewModel.EnableGrid = false; + if (Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 3)) + { + ((Selector)SituacaoBox).SelectedIndex = -1; + } + await ViewModel.SelecionaCritica(ViewModel.SelectedCritica); + ValidarDocumento(); + } + + private async void Cancelar_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.Repasses.Where((VendedorParcela repasse) => !repasse.Vendedor.Corretora).Any()) + { + await ViewModel.ShowMessage("PARA CANCELAR AS ALTERAÇÕES É NECESSÁRIO REMOVER OS VENDEDORES COM REPASSE CONFIGURADO."); + } + else if ((!ViewModel.HasChange && (ViewModel.SelectedDocumento == null || !((DomainBase)ViewModel.SelectedDocumento).HasChange()) && (ViewModel.SelectedCliente == null || !((DomainBase)ViewModel.SelectedCliente).HasChange()) && (ViewModel.Telefones == null || !ViewModel.Telefones.Any((ClienteTelefone x) => ((DomainBase)x).HasChange()))) || await ViewModel.ShowMessage("HÁ ALTERAÇÕES PENDENTES AINDA NÃO SALVAS, DESEJA CONTINUAR? " + Environment.NewLine + "O PROCEDIMENTO IRÁ CANCELAR AS ALTERAÇÕES REALIZADAS.", "SIM", "NÃO")) + { + await ViewModel.SelecionaCritica(ViewModel.SelectedCritica); + ViewModel.Alterar(alterar: false); + ViewModel.EnableGrid = true; + } + } + + private void Initial_DatePicker_OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) + { + DatePicker_OnLostKeyboardFocus(sender, e); + if (string.IsNullOrEmpty(Vigencia1Box.Text)) + { + Vigencia1Box.SelectedDate = DateTime.MinValue; + ViewModel.SelectedDocumento.Vigencia1 = DateTime.MinValue; + } + if (string.IsNullOrWhiteSpace(Vigencia2Box.Text)) + { + Vigencia2Box.DisplayDate = ValidationHelper.ToDateTime(Vigencia1Box.Text).AddYears(1); + Vigencia2Box.Text = Vigencia2Box.DisplayDate.ToShortDateString(); + } + } + + private async void Grid_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + if (ViewModel.EnableGrid) + { + DataGrid val = (DataGrid)sender; + if (val != null && ((Selector)val).SelectedIndex >= 0) + { + ViewModel.EnableGrid = false; + ViewModel.Index = ((Selector)val).SelectedIndex; + await ViewModel.SelecionaCritica((CriticaApolice)((ItemsControl)val).Items[((Selector)val).SelectedIndex]); + ViewModel.EnableGrid = true; + } + } + } + + private void DocumentoPrincipalBox_LostFocus(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + if (!((TextBoxBase)(TextBox)sender).IsReadOnly) + { + string text = ValidationHelper.Clear(DocumentoPrincipalBox.Text); + if (!string.IsNullOrEmpty(text)) + { + DocumentoPrincipalBox.Text = ((text.Length == 11) ? ValidationHelper.FormatDocument(text.PadLeft(11, '0').Substring(0, 11)) : ValidationHelper.FormatDocument(text.PadLeft(14, '0').Substring(0, 14))); + ViewModel.JuridicaouFisica(DocumentoPrincipalBox.Text); + } + } + } + + private void OrdemBox_OnLostFocus(object sender, RoutedEventArgs e) + { + //IL_0064: Unknown result type (might be due to invalid IL or missing references) + //IL_006e: Expected O, but got Unknown + //IL_0083: Unknown result type (might be due to invalid IL or missing references) + //IL_008a: Expected O, but got Unknown + TextBox val = (TextBox)((sender is TextBox) ? sender : null); + if (val == null || ((TextBoxBase)val).IsReadOnly || !int.TryParse(val.Text, out var result)) + { + return; + } + WrapPanel val2 = Extentions.FindVisualAncestor<WrapPanel>((DependencyObject)(object)Extentions.FindVisualAncestor<CustomItemValidation>((DependencyObject)(object)val)); + ListBox val3 = Extentions.FindVisualAncestor<ListBox>((DependencyObject)(object)val2); + if (val3 == null) + { + return; + } + for (int i = 0; i < ((CollectionView)((ItemsControl)val3).Items).Count; i++) + { + if (i != ((CollectionView)((ItemsControl)val3).Items).IndexOf(((FrameworkElement)val2).DataContext)) + { + ContentPresenter val4 = FindVisualChild.Find<ContentPresenter>((DependencyObject)(ListBoxItem)((ItemsControl)val3).ItemContainerGenerator.ContainerFromIndex(i)); + TextBox val5 = (TextBox)((FrameworkTemplate)val4.ContentTemplate).FindName("OrdemBox", (FrameworkElement)(object)val4); + if (int.TryParse(val5.Text, out var result2) && result2 == result) + { + val5.Text = Ordem.ToString(); + } + } + } + } + + private void TipoComboBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_003c: Unknown result type (might be due to invalid IL or missing references) + //IL_0046: Expected O, but got Unknown + //IL_009d: Unknown result type (might be due to invalid IL or missing references) + //IL_00a3: Invalid comparison between Unknown and I4 + ComboBox val = (ComboBox)sender; + CustomIsReadOnlyControl customIsReadOnlyControl = Extentions.FindVisualAncestor<CustomIsReadOnlyControl>((DependencyObject)(object)val); + if (customIsReadOnlyControl == null) + { + return; + } + WrapPanel val2 = Extentions.FindVisualAncestor<WrapPanel>((DependencyObject)(object)customIsReadOnlyControl); + ListBox val3 = Extentions.FindVisualAncestor<ListBox>((DependencyObject)(object)val2); + ContentPresenter val4 = FindVisualChild.Find<ContentPresenter>((DependencyObject)(ListBoxItem)((ItemsControl)val3).ItemContainerGenerator.ContainerFromIndex(((CollectionView)((ItemsControl)val3).Items).IndexOf(((FrameworkElement)val2).DataContext))); + DataTemplate contentTemplate = val4.ContentTemplate; + CustomItemValidation customItemValidation = (CustomItemValidation)((FrameworkTemplate)contentTemplate).FindName("Prefixo", (FrameworkElement)(object)val4); + CustomItemValidation depObj = (CustomItemValidation)((FrameworkTemplate)contentTemplate).FindName("Telefone", (FrameworkElement)(object)val4); + TextBox? obj = ((DependencyObject)(object)customItemValidation).FindChildren<TextBox>().FirstOrDefault(); + TextBox val5 = ((DependencyObject)(object)depObj).FindChildren<TextBox>().FirstOrDefault(); + if (obj != null && val5 != null) + { + if ((int)(TipoTelefone)((Selector)val).SelectedValue != 8) + { + ((UIElement)customItemValidation).Visibility = (Visibility)0; + val5.MaxLength = 10; + int length = ((val5.Text.Length >= 10) ? 10 : val5.Text.Length); + val5.Text = val5.Text.Substring(0, length); + } + else + { + ((UIElement)customItemValidation).Visibility = (Visibility)2; + val5.MaxLength = 20; + } + } + } + + private void SituacaoBox_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + ComboBox val = (ComboBox)sender; + if (ViewModel.EnableFields) + { + ViewModel.StatusDocumento = (TipoSeguro?)((Selector)val).SelectedItem; + } + } + + private void AdicionarCoCorretagem_OnClick(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + ToggleButton val = (ToggleButton)sender; + bool flag = (int)val != 0 && val.IsChecked.GetValueOrDefault(); + ComboBox comissaoNovoComboBox = ComissaoNovoComboBox; + if (((comissaoNovoComboBox != null) ? ((Selector)comissaoNovoComboBox).SelectedItem : null) != null) + { + ((Selector)ComissaoNovoComboBox).SelectedItem = null; + } + if (flag) + { + ((Selector)TipoVendedorBox).SelectedIndex = 0; + } + else if (((Selector)TipoVendedorBox).SelectedItem != null) + { + ((Selector)TipoVendedorBox).SelectedItem = null; + } + ComboBox vendedorBox = VendedorBox; + if (((vendedorBox != null) ? ((Selector)vendedorBox).SelectedItem : null) != null) + { + ((Selector)VendedorBox).SelectedItem = null; + } + if (ValidationHelper.IsNotNullOrEmpty(((TextBox)ValorRepasseBox).Text)) + { + ((TextBox)ValorRepasseBox).Text = ""; + } + ViewModel.VendedorCoCorretagem(flag); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/seguros/criticaapoliceview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_012b: Unknown result type (might be due to invalid IL or missing references) + //IL_0135: Expected O, but got Unknown + //IL_0138: Unknown result type (might be due to invalid IL or missing references) + //IL_0142: Expected O, but got Unknown + //IL_0145: Unknown result type (might be due to invalid IL or missing references) + //IL_014f: Expected O, but got Unknown + //IL_015c: Unknown result type (might be due to invalid IL or missing references) + //IL_0166: Expected O, but got Unknown + //IL_0173: Unknown result type (might be due to invalid IL or missing references) + //IL_017d: Expected O, but got Unknown + //IL_018a: Unknown result type (might be due to invalid IL or missing references) + //IL_0194: Expected O, but got Unknown + //IL_0197: Unknown result type (might be due to invalid IL or missing references) + //IL_01a1: Expected O, but got Unknown + //IL_01ae: Unknown result type (might be due to invalid IL or missing references) + //IL_01b8: Expected O, but got Unknown + //IL_01c5: Unknown result type (might be due to invalid IL or missing references) + //IL_01cf: Expected O, but got Unknown + //IL_01dc: Unknown result type (might be due to invalid IL or missing references) + //IL_01e6: Expected O, but got Unknown + //IL_01e9: Unknown result type (might be due to invalid IL or missing references) + //IL_01f3: Expected O, but got Unknown + //IL_01f5: Unknown result type (might be due to invalid IL or missing references) + //IL_0201: Unknown result type (might be due to invalid IL or missing references) + //IL_020b: Expected O, but got Unknown + //IL_020d: Unknown result type (might be due to invalid IL or missing references) + //IL_0219: Unknown result type (might be due to invalid IL or missing references) + //IL_0223: Expected O, but got Unknown + //IL_0225: Unknown result type (might be due to invalid IL or missing references) + //IL_0231: Unknown result type (might be due to invalid IL or missing references) + //IL_023b: Expected O, but got Unknown + //IL_023e: Unknown result type (might be due to invalid IL or missing references) + //IL_0248: Expected O, but got Unknown + //IL_024a: Unknown result type (might be due to invalid IL or missing references) + //IL_0256: Unknown result type (might be due to invalid IL or missing references) + //IL_0260: Expected O, but got Unknown + //IL_0263: Unknown result type (might be due to invalid IL or missing references) + //IL_026d: Expected O, but got Unknown + //IL_027a: Unknown result type (might be due to invalid IL or missing references) + //IL_0284: Expected O, but got Unknown + //IL_0287: Unknown result type (might be due to invalid IL or missing references) + //IL_0291: Expected O, but got Unknown + //IL_029e: Unknown result type (might be due to invalid IL or missing references) + //IL_02a8: Expected O, but got Unknown + //IL_02aa: Unknown result type (might be due to invalid IL or missing references) + //IL_02b6: Unknown result type (might be due to invalid IL or missing references) + //IL_02c0: Expected O, but got Unknown + //IL_02c2: Unknown result type (might be due to invalid IL or missing references) + //IL_02ce: Unknown result type (might be due to invalid IL or missing references) + //IL_02d8: Expected O, but got Unknown + //IL_02da: Unknown result type (might be due to invalid IL or missing references) + //IL_02e6: Unknown result type (might be due to invalid IL or missing references) + //IL_02f0: Expected O, but got Unknown + //IL_02f2: Unknown result type (might be due to invalid IL or missing references) + //IL_02fe: Unknown result type (might be due to invalid IL or missing references) + //IL_0308: Expected O, but got Unknown + //IL_030a: Unknown result type (might be due to invalid IL or missing references) + //IL_0316: Unknown result type (might be due to invalid IL or missing references) + //IL_0320: Expected O, but got Unknown + //IL_0323: Unknown result type (might be due to invalid IL or missing references) + //IL_032d: Expected O, but got Unknown + //IL_0330: Unknown result type (might be due to invalid IL or missing references) + //IL_033a: Expected O, but got Unknown + //IL_033d: Unknown result type (might be due to invalid IL or missing references) + //IL_0347: Expected O, but got Unknown + //IL_0354: Unknown result type (might be due to invalid IL or missing references) + //IL_035e: Expected O, but got Unknown + //IL_0361: Unknown result type (might be due to invalid IL or missing references) + //IL_036b: Expected O, but got Unknown + //IL_0378: Unknown result type (might be due to invalid IL or missing references) + //IL_0382: Expected O, but got Unknown + //IL_038f: Unknown result type (might be due to invalid IL or missing references) + //IL_0399: Expected O, but got Unknown + //IL_039c: Unknown result type (might be due to invalid IL or missing references) + //IL_03a6: Expected O, but got Unknown + //IL_03a9: Unknown result type (might be due to invalid IL or missing references) + //IL_03b3: Expected O, but got Unknown + //IL_03b6: Unknown result type (might be due to invalid IL or missing references) + //IL_03c0: Expected O, but got Unknown + //IL_03cd: Unknown result type (might be due to invalid IL or missing references) + //IL_03d7: Expected O, but got Unknown + //IL_03e4: Unknown result type (might be due to invalid IL or missing references) + //IL_03ee: Expected O, but got Unknown + //IL_03f1: Unknown result type (might be due to invalid IL or missing references) + //IL_03fb: Expected O, but got Unknown + //IL_0408: Unknown result type (might be due to invalid IL or missing references) + //IL_0412: Expected O, but got Unknown + //IL_041f: Unknown result type (might be due to invalid IL or missing references) + //IL_0429: Expected O, but got Unknown + //IL_042c: Unknown result type (might be due to invalid IL or missing references) + //IL_0436: Expected O, but got Unknown + //IL_0443: Unknown result type (might be due to invalid IL or missing references) + //IL_044d: Expected O, but got Unknown + //IL_045a: Unknown result type (might be due to invalid IL or missing references) + //IL_0464: Expected O, but got Unknown + //IL_0467: Unknown result type (might be due to invalid IL or missing references) + //IL_0471: Expected O, but got Unknown + //IL_0481: Unknown result type (might be due to invalid IL or missing references) + //IL_048b: Expected O, but got Unknown + //IL_048e: Unknown result type (might be due to invalid IL or missing references) + //IL_0498: Expected O, but got Unknown + //IL_049b: Unknown result type (might be due to invalid IL or missing references) + //IL_04a5: Expected O, but got Unknown + //IL_04a8: Unknown result type (might be due to invalid IL or missing references) + //IL_04b2: Expected O, but got Unknown + //IL_04b5: Unknown result type (might be due to invalid IL or missing references) + //IL_04bf: Expected O, but got Unknown + //IL_04c2: Unknown result type (might be due to invalid IL or missing references) + //IL_04cc: Expected O, but got Unknown + //IL_04cf: Unknown result type (might be due to invalid IL or missing references) + //IL_04d9: Expected O, but got Unknown + //IL_04dc: Unknown result type (might be due to invalid IL or missing references) + //IL_04e6: Expected O, but got Unknown + //IL_04e9: Unknown result type (might be due to invalid IL or missing references) + //IL_04f3: Expected O, but got Unknown + //IL_0500: Unknown result type (might be due to invalid IL or missing references) + //IL_050a: Expected O, but got Unknown + //IL_050d: Unknown result type (might be due to invalid IL or missing references) + //IL_0517: Expected O, but got Unknown + //IL_0524: Unknown result type (might be due to invalid IL or missing references) + //IL_052e: Expected O, but got Unknown + //IL_0531: Unknown result type (might be due to invalid IL or missing references) + //IL_053b: Expected O, but got Unknown + //IL_0548: Unknown result type (might be due to invalid IL or missing references) + //IL_0552: Expected O, but got Unknown + //IL_0555: Unknown result type (might be due to invalid IL or missing references) + //IL_055f: Expected O, but got Unknown + //IL_0562: Unknown result type (might be due to invalid IL or missing references) + //IL_056c: Expected O, but got Unknown + //IL_0579: Unknown result type (might be due to invalid IL or missing references) + //IL_0583: Expected O, but got Unknown + //IL_0586: Unknown result type (might be due to invalid IL or missing references) + //IL_0590: Expected O, but got Unknown + //IL_0593: Unknown result type (might be due to invalid IL or missing references) + //IL_059d: Expected O, but got Unknown + //IL_05ad: Unknown result type (might be due to invalid IL or missing references) + //IL_05b7: Expected O, but got Unknown + //IL_05c4: Unknown result type (might be due to invalid IL or missing references) + //IL_05ce: Expected O, but got Unknown + //IL_05de: Unknown result type (might be due to invalid IL or missing references) + //IL_05e8: Expected O, but got Unknown + //IL_05f5: Unknown result type (might be due to invalid IL or missing references) + //IL_05ff: Expected O, but got Unknown + //IL_0602: Unknown result type (might be due to invalid IL or missing references) + //IL_060c: Expected O, but got Unknown + //IL_060f: Unknown result type (might be due to invalid IL or missing references) + //IL_0619: Expected O, but got Unknown + //IL_061c: Unknown result type (might be due to invalid IL or missing references) + //IL_0626: Expected O, but got Unknown + //IL_0629: Unknown result type (might be due to invalid IL or missing references) + //IL_0633: Expected O, but got Unknown + //IL_0636: Unknown result type (might be due to invalid IL or missing references) + //IL_0640: Expected O, but got Unknown + //IL_0643: Unknown result type (might be due to invalid IL or missing references) + //IL_064d: Expected O, but got Unknown + //IL_0650: Unknown result type (might be due to invalid IL or missing references) + //IL_065a: Expected O, but got Unknown + //IL_0668: Unknown result type (might be due to invalid IL or missing references) + //IL_0672: Expected O, but got Unknown + //IL_067f: Unknown result type (might be due to invalid IL or missing references) + //IL_0689: Expected O, but got Unknown + //IL_068c: Unknown result type (might be due to invalid IL or missing references) + //IL_0696: Expected O, but got Unknown + //IL_06a3: Unknown result type (might be due to invalid IL or missing references) + //IL_06ad: Expected O, but got Unknown + //IL_06ba: Unknown result type (might be due to invalid IL or missing references) + //IL_06c4: Expected O, but got Unknown + //IL_06c7: Unknown result type (might be due to invalid IL or missing references) + //IL_06d1: Expected O, but got Unknown + //IL_06d4: Unknown result type (might be due to invalid IL or missing references) + //IL_06de: Expected O, but got Unknown + //IL_06e1: Unknown result type (might be due to invalid IL or missing references) + //IL_06eb: Expected O, but got Unknown + //IL_06ed: Unknown result type (might be due to invalid IL or missing references) + //IL_06f9: Unknown result type (might be due to invalid IL or missing references) + //IL_0703: Expected O, but got Unknown + //IL_0704: Unknown result type (might be due to invalid IL or missing references) + //IL_0710: Unknown result type (might be due to invalid IL or missing references) + //IL_071a: Expected O, but got Unknown + //IL_071b: Unknown result type (might be due to invalid IL or missing references) + //IL_0727: Unknown result type (might be due to invalid IL or missing references) + //IL_0731: Expected O, but got Unknown + //IL_0732: Unknown result type (might be due to invalid IL or missing references) + //IL_073e: Unknown result type (might be due to invalid IL or missing references) + //IL_0748: Expected O, but got Unknown + //IL_074b: Unknown result type (might be due to invalid IL or missing references) + //IL_0755: Expected O, but got Unknown + //IL_0758: Unknown result type (might be due to invalid IL or missing references) + //IL_0762: Expected O, but got Unknown + //IL_0765: Unknown result type (might be due to invalid IL or missing references) + //IL_076f: Expected O, but got Unknown + switch (connectionId) + { + case 1: + UsuarioBox = (ComboBox)target; + break; + case 2: + SeguradoraBox = (ComboBox)target; + break; + case 3: + InicioBox = (DatePicker)target; + ((UIElement)InicioBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)InicioBox).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)InicioBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 4: + FimBox = (DatePicker)target; + ((UIElement)FimBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)FimBox).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)FimBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 5: + CriticadoBox = (ToggleButton)target; + break; + case 6: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Atualizar_OnClick); + break; + case 7: + ((UIElement)(TextBox)target).PreviewKeyDown += new KeyEventHandler(Pesquisa_OnPreviewKeyDown); + break; + case 8: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AdicionarFiltro_OnClick); + break; + case 10: + CriticaGrid = (DataGrid)target; + break; + case 11: + ((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick); + break; + case 12: + ConcluirCriticaButton = (MenuItem)target; + ConcluirCriticaButton.Click += new RoutedEventHandler(ConcluirCritica_OnClick); + break; + case 13: + CancelarDocumento = (MenuItem)target; + CancelarDocumento.Click += new RoutedEventHandler(Cancelar_OnClick); + break; + case 14: + ((MenuItem)target).Click += new RoutedEventHandler(Cliente_OnClick); + break; + case 15: + ((MenuItem)target).Click += new RoutedEventHandler(Apolice_OnClick); + break; + case 16: + ((MenuItem)target).Click += new RoutedEventHandler(Tarefa_OnClick); + break; + case 17: + ((MenuItem)target).Click += new RoutedEventHandler(Perfil_OnClick); + break; + case 18: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirAquivoDigital_Click); + break; + case 19: + ProdutoBox = (ComboBox)target; + break; + case 20: + NegocioCorretoraBox = (ComboBox)target; + break; + case 21: + SituacaoBox = (ComboBox)target; + ((Selector)SituacaoBox).SelectionChanged += new SelectionChangedEventHandler(SituacaoBox_SelectionChanged); + break; + case 22: + TransmissaoBox = (DatePicker)target; + ((UIElement)TransmissaoBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((Control)TransmissaoBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 23: + ApoliceBox = (TextBox)target; + break; + case 24: + EndossoBox = (TextBox)target; + break; + case 25: + EmissaoBox = (DatePicker)target; + ((UIElement)EmissaoBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((Control)EmissaoBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 26: + Vigencia1Box = (DatePicker)target; + ((UIElement)Vigencia1Box).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(Initial_DatePicker_OnLostKeyboardFocus); + ((Control)Vigencia1Box).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 27: + Vigencia2Box = (DatePicker)target; + ((UIElement)Vigencia2Box).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((Control)Vigencia2Box).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 28: + AdicionalBox = (ToggleButton)target; + break; + case 29: + Comissao = (CustomIsReadOnlyControl)target; + break; + case 30: + ComissaoBox = (CurrencyTextBox)target; + break; + case 31: + PremioLiquidoBox = (CurrencyTextBox)target; + break; + case 32: + PremioAdicionalBox = (CurrencyTextBox)target; + break; + case 33: + IofBox = (CurrencyTextBox)target; + break; + case 34: + DiferencaBox = (CurrencyTextBox)target; + break; + case 35: + PremioTotalBox = (CurrencyTextBox)target; + break; + case 36: + ParcelasBox = (CurrencyTextBox)target; + break; + case 37: + SeguroCombinadoBox = (ToggleButton)target; + break; + case 38: + EditarVendedorButton = (MenuItem)target; + EditarVendedorButton.Click += new RoutedEventHandler(EditarVendedorButton_OnClick); + break; + case 39: + SalvarVendedorButton = (MenuItem)target; + SalvarVendedorButton.Click += new RoutedEventHandler(SalvarVendedor_Click); + break; + case 40: + CancelarVendedorButton = (MenuItem)target; + CancelarVendedorButton.Click += new RoutedEventHandler(CancelarVendedor_Click); + break; + case 41: + VendedorFields = (WrapPanel)target; + break; + case 42: + CoCorretagemToogle = (ToggleButton)target; + ((ButtonBase)CoCorretagemToogle).Click += new RoutedEventHandler(AdicionarCoCorretagem_OnClick); + break; + case 43: + TipoVendedorBox = (ComboBox)target; + break; + case 44: + VendedorBox = (ComboBox)target; + break; + case 45: + ComissaoNovoBox = (CustomItemValidation)target; + break; + case 46: + ComissaoNovoComboBox = (ComboBox)target; + ((Selector)ComissaoNovoComboBox).SelectionChanged += new SelectionChangedEventHandler(ComissaoVendedorBox_OnSelectionChanged); + break; + case 47: + ComissaoRenovacaoBox = (CustomItemValidation)target; + break; + case 48: + ComissaoRenovacaoComboBox = (ComboBox)target; + ((Selector)ComissaoRenovacaoComboBox).SelectionChanged += new SelectionChangedEventHandler(ComissaoVendedorBox_OnSelectionChanged); + break; + case 49: + ValorRepasseBox = (CurrencyTextBox)target; + break; + case 50: + FormaRecebidaBox = (TextBox)target; + break; + case 51: + VendedorGrid = (DataGrid)target; + break; + case 52: + RepasseVendedor = (DataGridTextColumn)target; + break; + case 54: + NomeBox = (TextBox)target; + break; + case 55: + TipoDocumentoPrincipalBox = (ComboBox)target; + break; + case 56: + DocumentoPrincipalBox = (TextBox)target; + ((UIElement)DocumentoPrincipalBox).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + ((UIElement)DocumentoPrincipalBox).LostFocus += new RoutedEventHandler(DocumentoPrincipalBox_LostFocus); + break; + case 57: + NascimentoBox = (DatePicker)target; + ((UIElement)NascimentoBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((Control)NascimentoBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 58: + IdentidadeBox = (TextBox)target; + break; + case 59: + EmissorBox = (TextBox)target; + break; + case 60: + EstadoEmissorBox = (TextBox)target; + break; + case 61: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + ((UIElement)(DatePicker)target).PreviewTextInput += new TextCompositionEventHandler(base.SomenteData); + break; + case 62: + TelefoneListBox = (ListBox)target; + break; + case 68: + EmailListBox = (ListBox)target; + break; + case 71: + ItemGrid = (DataGrid)target; + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_003d: Unknown result type (might be due to invalid IL or missing references) + //IL_0049: Unknown result type (might be due to invalid IL or missing references) + //IL_0053: Expected O, but got Unknown + //IL_0055: Unknown result type (might be due to invalid IL or missing references) + //IL_0061: Unknown result type (might be due to invalid IL or missing references) + //IL_006b: Expected O, but got Unknown + //IL_006d: Unknown result type (might be due to invalid IL or missing references) + //IL_0079: Unknown result type (might be due to invalid IL or missing references) + //IL_0083: Expected O, but got Unknown + //IL_0085: Unknown result type (might be due to invalid IL or missing references) + //IL_0092: Unknown result type (might be due to invalid IL or missing references) + //IL_009c: Expected O, but got Unknown + //IL_009e: Unknown result type (might be due to invalid IL or missing references) + //IL_00ab: Unknown result type (might be due to invalid IL or missing references) + //IL_00b5: Expected O, but got Unknown + //IL_00b6: Unknown result type (might be due to invalid IL or missing references) + //IL_00c3: Unknown result type (might be due to invalid IL or missing references) + //IL_00cd: Expected O, but got Unknown + //IL_00cf: Unknown result type (might be due to invalid IL or missing references) + //IL_00db: Unknown result type (might be due to invalid IL or missing references) + //IL_00e5: Expected O, but got Unknown + //IL_00e6: Unknown result type (might be due to invalid IL or missing references) + //IL_00f2: Unknown result type (might be due to invalid IL or missing references) + //IL_00fc: Expected O, but got Unknown + //IL_00fd: Unknown result type (might be due to invalid IL or missing references) + //IL_010a: Unknown result type (might be due to invalid IL or missing references) + //IL_0114: Expected O, but got Unknown + //IL_0116: Unknown result type (might be due to invalid IL or missing references) + //IL_0122: Unknown result type (might be due to invalid IL or missing references) + //IL_012c: Expected O, but got Unknown + //IL_012e: Unknown result type (might be due to invalid IL or missing references) + //IL_013a: Unknown result type (might be due to invalid IL or missing references) + //IL_0144: Expected O, but got Unknown + //IL_0145: Unknown result type (might be due to invalid IL or missing references) + //IL_0151: Unknown result type (might be due to invalid IL or missing references) + //IL_015b: Expected O, but got Unknown + //IL_015c: Unknown result type (might be due to invalid IL or missing references) + //IL_0169: Unknown result type (might be due to invalid IL or missing references) + //IL_0173: Expected O, but got Unknown + //IL_0175: Unknown result type (might be due to invalid IL or missing references) + //IL_0181: Unknown result type (might be due to invalid IL or missing references) + //IL_018b: Expected O, but got Unknown + //IL_018d: Unknown result type (might be due to invalid IL or missing references) + //IL_0199: Unknown result type (might be due to invalid IL or missing references) + //IL_01a3: Expected O, but got Unknown + switch (connectionId) + { + case 9: + ((Chip)target).DeleteClick += new RoutedEventHandler(ExcluirFiltro_OnClick); + break; + case 53: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirVendedor_OnClick); + break; + case 63: + ((Selector)(ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(TipoComboBox_OnSelectionChanged); + break; + case 64: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 65: + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(FormatarTelefone); + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 66: + ((UIElement)(TextBox)target).PreviewGotKeyboardFocus += new KeyboardFocusChangedEventHandler(OrdemBox_OnPreviewGotKeyboardFocus); + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(OrdemBox_OnLostFocus); + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 67: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirTelefone_OnClick); + break; + case 69: + ((UIElement)(TextBox)target).PreviewGotKeyboardFocus += new KeyboardFocusChangedEventHandler(OrdemBox_OnPreviewGotKeyboardFocus); + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(OrdemBox_OnLostFocus); + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 70: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirEmail_OnClick); + break; + case 72: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Item_Click); + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Seguros/PerfilEmpresaView.cs b/Decompiler/Gestor.Application.Views.Seguros/PerfilEmpresaView.cs new file mode 100644 index 0000000..518ff56 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Seguros/PerfilEmpresaView.cs @@ -0,0 +1,261 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using System.Windows.Markup; +using Gestor.Application.Componentes; +using Gestor.Application.Helpers; +using Gestor.Application.ViewModels.Seguros; +using Gestor.Application.Views.Generic; +using Gestor.Common.Helpers; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Xceed.Wpf.Toolkit; + +namespace Gestor.Application.Views.Seguros; + +public class PerfilEmpresaView : BaseUserControl, IComponentConnector +{ + public PerfilEmpresaViewModel ViewModel; + + private Controle _controle; + + internal MenuItem CancelarApoliceButton; + + internal TextBox TextAtividade; + + internal CustomIsReadOnlyControl ComboSegurancaControl; + + internal CheckComboBox ComboSeguranca; + + internal CustomIsReadOnlyControl ComboIncendioControl; + + internal CheckComboBox ComboIncendio; + + internal CheckBox ExclusivoDeposito; + + internal CheckBox DivisaTerrenoBaldio; + + internal CheckBox PatrimonioHistorio; + + internal CheckBox PossuiTelhado; + + internal CheckBox CaixasEletronicos; + + internal CheckBox Isopainel; + + internal CheckBox ConstrucaoReforma; + + private bool _contentLoaded; + + public PerfilEmpresaView(Controle controle) + { + _controle = controle; + ((FrameworkElement)this).Tag = "CADASTRO DE PERFIL"; + ViewModel = new PerfilEmpresaViewModel(controle); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + LoadData(); + } + + private void LoadData() + { + ComboSeguranca.BindData<EquipamentoSeguranca>(withSelect: false); + ComboIncendio.BindData<EquipamentoIncendio>(withSelect: false); + } + + private void Incluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.EnableIncluirPerfil = false; + ViewModel.Incluir(); + } + + private void Alterar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Alterar(alterar: true); + } + + private async void Salvar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(); + ViewModel.Loading(isLoading: false); + if (list != null) + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + } + + private void Cancelar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.CancelarAlteracao(); + PerfilEmpresa selectedPerfilEmpresa = ViewModel.SelectedPerfilEmpresa; + if ((selectedPerfilEmpresa != null && ((DomainBase)selectedPerfilEmpresa).Id == 0) || ViewModel.SelectedPerfilEmpresa == null) + { + ViewModel.EnableIncluirPerfil = true; + } + } + + private async void Excluir_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.Excluir(); + } + + private void VerificaOnSelected(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_003b: Unknown result type (might be due to invalid IL or missing references) + ComboBox val = (ComboBox)sender; + if (((Selector)val).SelectedItem != null) + { + if (EnumHelper.GetDescription<object>(((Selector)val).SelectedItem) == EnumHelper.GetDescription<AtividadeEmpresa>((AtividadeEmpresa)0)) + { + ViewModel.AtivaCampos = (Visibility)0; + } + else if ((int)ViewModel.AtivaCampos == 0) + { + TextAtividade.Text = ""; + ViewModel.AtivaCampos = (Visibility)2; + } + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/seguros/perfilempresaview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_005a: Unknown result type (might be due to invalid IL or missing references) + //IL_0066: Unknown result type (might be due to invalid IL or missing references) + //IL_0070: Expected O, but got Unknown + //IL_0072: Unknown result type (might be due to invalid IL or missing references) + //IL_007e: Unknown result type (might be due to invalid IL or missing references) + //IL_0088: Expected O, but got Unknown + //IL_008a: Unknown result type (might be due to invalid IL or missing references) + //IL_0096: Unknown result type (might be due to invalid IL or missing references) + //IL_00a0: Expected O, but got Unknown + //IL_00a3: Unknown result type (might be due to invalid IL or missing references) + //IL_00ad: Expected O, but got Unknown + //IL_00ba: Unknown result type (might be due to invalid IL or missing references) + //IL_00c4: Expected O, but got Unknown + //IL_00c6: Unknown result type (might be due to invalid IL or missing references) + //IL_00d2: Unknown result type (might be due to invalid IL or missing references) + //IL_00dc: Expected O, but got Unknown + //IL_00de: Unknown result type (might be due to invalid IL or missing references) + //IL_00eb: Unknown result type (might be due to invalid IL or missing references) + //IL_00f5: Expected O, but got Unknown + //IL_00f7: Unknown result type (might be due to invalid IL or missing references) + //IL_0103: Unknown result type (might be due to invalid IL or missing references) + //IL_010d: Expected O, but got Unknown + //IL_0110: Unknown result type (might be due to invalid IL or missing references) + //IL_011a: Expected O, but got Unknown + //IL_012a: Unknown result type (might be due to invalid IL or missing references) + //IL_0134: Expected O, but got Unknown + //IL_0144: Unknown result type (might be due to invalid IL or missing references) + //IL_014e: Expected O, but got Unknown + //IL_0151: Unknown result type (might be due to invalid IL or missing references) + //IL_015b: Expected O, but got Unknown + //IL_015e: Unknown result type (might be due to invalid IL or missing references) + //IL_0168: Expected O, but got Unknown + //IL_016b: Unknown result type (might be due to invalid IL or missing references) + //IL_0175: Expected O, but got Unknown + //IL_0178: Unknown result type (might be due to invalid IL or missing references) + //IL_0182: Expected O, but got Unknown + //IL_0185: Unknown result type (might be due to invalid IL or missing references) + //IL_018f: Expected O, but got Unknown + //IL_0192: Unknown result type (might be due to invalid IL or missing references) + //IL_019c: Expected O, but got Unknown + //IL_019f: Unknown result type (might be due to invalid IL or missing references) + //IL_01a9: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((MenuItem)target).Click += new RoutedEventHandler(Incluir_OnClick); + break; + case 2: + ((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick); + break; + case 3: + ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick); + break; + case 4: + CancelarApoliceButton = (MenuItem)target; + CancelarApoliceButton.Click += new RoutedEventHandler(Cancelar_OnClick); + break; + case 5: + ((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick); + break; + case 6: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 7: + ((Selector)(ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(VerificaOnSelected); + break; + case 8: + TextAtividade = (TextBox)target; + break; + case 9: + ComboSegurancaControl = (CustomIsReadOnlyControl)target; + break; + case 10: + ComboSeguranca = (CheckComboBox)target; + break; + case 11: + ComboIncendioControl = (CustomIsReadOnlyControl)target; + break; + case 12: + ComboIncendio = (CheckComboBox)target; + break; + case 13: + ExclusivoDeposito = (CheckBox)target; + break; + case 14: + DivisaTerrenoBaldio = (CheckBox)target; + break; + case 15: + PatrimonioHistorio = (CheckBox)target; + break; + case 16: + PossuiTelhado = (CheckBox)target; + break; + case 17: + CaixasEletronicos = (CheckBox)target; + break; + case 18: + Isopainel = (CheckBox)target; + break; + case 19: + ConstrucaoReforma = (CheckBox)target; + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Seguros/PerfilView.cs b/Decompiler/Gestor.Application.Views.Seguros/PerfilView.cs new file mode 100644 index 0000000..54d6784 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Seguros/PerfilView.cs @@ -0,0 +1,363 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Text.RegularExpressions; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Threading; +using Gestor.Application.Helpers; +using Gestor.Application.ViewModels.Seguros; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Views.Seguros; + +public class PerfilView : BaseUserControl, IComponentConnector +{ + public PerfilViewModel ViewModel; + + private Controle _controle; + + internal MenuItem CancelarApoliceButton; + + internal DatePicker NascimentoBox; + + private bool _contentLoaded; + + public PerfilView(Controle controle) + { + _controle = controle; + ((FrameworkElement)this).Tag = "CADASTRO DE PERFIL"; + ViewModel = new PerfilViewModel(controle); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + } + + private void ContentLoad() + { + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Expected O, but got Unknown + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Expected O, but got Unknown + ((UIElement)NascimentoBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(Funcoes.DatePicker_OnLostKeyboardFocus); + ((UIElement)NascimentoBox).PreviewKeyDown += new KeyEventHandler(Funcoes.DatePicker_PreviewKeyDown); + } + + private void Incluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Incluir(); + ValidarTela(); + } + + private void Alterar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Alterar(alterar: true); + ValidarTela(); + } + + private async void Salvar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(); + ((DependencyObject)(object)this).ValidateFields(list); + bool num = list == null || list.Count == 0; + ViewModel.Loading(isLoading: false); + if (!num) + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + } + + private void Cancelar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.CancelarAlteracao(); + } + + private async void Excluir_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.Excluir(); + } + + private void CpfBox_OnLostFocus(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + TextBox val = (TextBox)sender; + val.Text = ValidationHelper.FormatDocument(val.Text); + } + + private void RelacaoComboBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_0054: Expected O, but got Unknown + if (((Selector)(ComboBox)sender).SelectedIndex != 0) + { + return; + } + Cliente cliente = _controle.Cliente; + string text = ValidationHelper.FormatDocument(ValidationHelper.Clear((cliente != null) ? cliente.Documento : null)); + bool flag = Regex.IsMatch(text, "\\d{3}\\.\\d{3}\\.\\d{3}-\\d{2}"); + Perfil val = (Perfil)((DomainBase)ViewModel.SelectedPerfil).Clone(); + val.Cpf = (flag ? text : ""); + val.Nome = _controle.Cliente.Nome; + val.Nascimento = _controle.Cliente.Nascimento; + val.Sexo = _controle.Cliente.Sexo; + val.EstadoCivil = _controle.Cliente.EstadoCivil; + val.Habilitacao = _controle.Cliente.Habilitacao; + if (_controle.Cliente.PrimeiraHabilitacao.HasValue) + { + DateTime networkTime = Funcoes.GetNetworkTime(); + DateTime? primeiraHabilitacao = _controle.Cliente.PrimeiraHabilitacao; + TimeSpan? timeSpan = networkTime - primeiraHabilitacao; + TimeSpan? timeSpan2 = timeSpan; + if (timeSpan2.Value.Days > 3650) + { + val.TempoHabilitacao = (TempoHabilitacao)10; + } + else + { + TimeSpan? timeSpan3 = timeSpan; + if (timeSpan3.Value.Days > 3285) + { + val.TempoHabilitacao = (TempoHabilitacao)9; + } + else + { + TimeSpan? timeSpan4 = timeSpan; + if (timeSpan4.Value.Days > 2920) + { + val.TempoHabilitacao = (TempoHabilitacao)8; + } + else + { + TimeSpan? timeSpan5 = timeSpan; + if (timeSpan5.Value.Days > 2555) + { + val.TempoHabilitacao = (TempoHabilitacao)7; + } + else + { + TimeSpan? timeSpan6 = timeSpan; + if (timeSpan6.Value.Days > 2190) + { + val.TempoHabilitacao = (TempoHabilitacao)6; + } + else + { + TimeSpan? timeSpan7 = timeSpan; + if (timeSpan7.Value.Days > 1825) + { + val.TempoHabilitacao = (TempoHabilitacao)5; + } + else + { + TimeSpan? timeSpan8 = timeSpan; + if (timeSpan8.Value.Days > 1460) + { + val.TempoHabilitacao = (TempoHabilitacao)4; + } + else + { + TimeSpan? timeSpan9 = timeSpan; + if (timeSpan9.Value.Days > 1095) + { + val.TempoHabilitacao = (TempoHabilitacao)3; + } + else + { + TimeSpan? timeSpan10 = timeSpan; + if (timeSpan10.Value.Days > 730) + { + val.TempoHabilitacao = (TempoHabilitacao)2; + } + else + { + TimeSpan? timeSpan11 = timeSpan; + if (timeSpan11.Value.Days > 365) + { + val.TempoHabilitacao = (TempoHabilitacao)1; + } + else + { + val.TempoHabilitacao = (TempoHabilitacao)0; + } + } + } + } + } + } + } + } + } + } + } + ViewModel.SelectedPerfil = val; + } + + private void ValidarTela() + { + if (ViewModel.SelectedPerfil != null) + { + List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedPerfil.Validate(); + ((DependencyObject)(object)this).ValidateFields(errorMessages, focusField: false); + } + } + + private void PostcodeBox_OnLostFocus(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + TextBox val = (TextBox)sender; + if (!string.IsNullOrWhiteSpace(val.Text)) + { + string text = ValidationHelper.FormatPostCode(val.Text); + if (ValidationHelper.ValidatePostCode(text)) + { + val.Text = text; + } + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/seguros/perfilview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0042: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_0058: Expected O, but got Unknown + //IL_005a: Unknown result type (might be due to invalid IL or missing references) + //IL_0066: Unknown result type (might be due to invalid IL or missing references) + //IL_0070: Expected O, but got Unknown + //IL_0072: Unknown result type (might be due to invalid IL or missing references) + //IL_007e: Unknown result type (might be due to invalid IL or missing references) + //IL_0088: Expected O, but got Unknown + //IL_008b: Unknown result type (might be due to invalid IL or missing references) + //IL_0095: Expected O, but got Unknown + //IL_00a2: Unknown result type (might be due to invalid IL or missing references) + //IL_00ac: Expected O, but got Unknown + //IL_00ae: Unknown result type (might be due to invalid IL or missing references) + //IL_00ba: Unknown result type (might be due to invalid IL or missing references) + //IL_00c4: Expected O, but got Unknown + //IL_00c6: Unknown result type (might be due to invalid IL or missing references) + //IL_00d2: Unknown result type (might be due to invalid IL or missing references) + //IL_00dc: Expected O, but got Unknown + //IL_00de: Unknown result type (might be due to invalid IL or missing references) + //IL_00ea: Unknown result type (might be due to invalid IL or missing references) + //IL_00f4: Expected O, but got Unknown + //IL_00f5: Unknown result type (might be due to invalid IL or missing references) + //IL_0102: Unknown result type (might be due to invalid IL or missing references) + //IL_010c: Expected O, but got Unknown + //IL_010f: Unknown result type (might be due to invalid IL or missing references) + //IL_0119: Expected O, but got Unknown + //IL_0126: Unknown result type (might be due to invalid IL or missing references) + //IL_0130: Expected O, but got Unknown + //IL_013d: Unknown result type (might be due to invalid IL or missing references) + //IL_0147: Expected O, but got Unknown + //IL_0149: Unknown result type (might be due to invalid IL or missing references) + //IL_0156: Unknown result type (might be due to invalid IL or missing references) + //IL_0160: Expected O, but got Unknown + //IL_0162: Unknown result type (might be due to invalid IL or missing references) + //IL_016f: Unknown result type (might be due to invalid IL or missing references) + //IL_0179: Expected O, but got Unknown + //IL_017b: Unknown result type (might be due to invalid IL or missing references) + //IL_0188: Unknown result type (might be due to invalid IL or missing references) + //IL_0192: Expected O, but got Unknown + //IL_0194: Unknown result type (might be due to invalid IL or missing references) + //IL_01a0: Unknown result type (might be due to invalid IL or missing references) + //IL_01aa: Expected O, but got Unknown + //IL_01ab: Unknown result type (might be due to invalid IL or missing references) + //IL_01b8: Unknown result type (might be due to invalid IL or missing references) + //IL_01c2: Expected O, but got Unknown + //IL_01c4: Unknown result type (might be due to invalid IL or missing references) + //IL_01d0: Unknown result type (might be due to invalid IL or missing references) + //IL_01da: Expected O, but got Unknown + //IL_01db: Unknown result type (might be due to invalid IL or missing references) + //IL_01e8: Unknown result type (might be due to invalid IL or missing references) + //IL_01f2: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((MenuItem)target).Click += new RoutedEventHandler(Incluir_OnClick); + break; + case 2: + ((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick); + break; + case 3: + ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick); + break; + case 4: + CancelarApoliceButton = (MenuItem)target; + CancelarApoliceButton.Click += new RoutedEventHandler(Cancelar_OnClick); + break; + case 5: + ((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick); + break; + case 6: + ((Selector)(ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(RelacaoComboBox_OnSelectionChanged); + break; + case 7: + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(CpfBox_OnLostFocus); + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 8: + NascimentoBox = (DatePicker)target; + ((UIElement)NascimentoBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((Control)NascimentoBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 9: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 10: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 11: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 12: + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(PostcodeBox_OnLostFocus); + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 13: + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(PostcodeBox_OnLostFocus); + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Seguros/SinistroView.cs b/Decompiler/Gestor.Application.Views.Seguros/SinistroView.cs new file mode 100644 index 0000000..6bee58a --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Seguros/SinistroView.cs @@ -0,0 +1,862 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Threading; +using Gestor.Application.Componentes; +using Gestor.Application.Drawers; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.ViewModels.Seguros; +using Gestor.Application.Views.Ferramentas; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using MaterialDesignThemes.Wpf; + +namespace Gestor.Application.Views.Seguros; + +public class SinistroView : BaseUserControl, IComponentConnector +{ + public SinistroViewModel ViewModel; + + internal DataGrid ControleGrid; + + internal MenuItem SalvarSinistroButton; + + internal MenuItem CancelarApoliceButton; + + internal CustomIsReadOnlyControl TipoSinistroBox; + + internal ComboBox ParceiroMecanica; + + internal ComboBox ParceiroFunilaria; + + internal RadioButton AnotacoesButton; + + internal RadioButton AnotacoesInternasButton; + + internal CustomItemControl AnotacoesHoster; + + internal WebEditor Anotacoes; + + internal CustomItemControl ObservacoesHoster; + + internal WebEditor Observacoes; + + internal CustomItemControl AnotacoesInternasHoster; + + internal WebEditor AnotacoesInternas; + + internal CustomItemControl ObservacoesInternasHoster; + + internal WebEditor ObservacoesInternas; + + internal Snackbar Snackbar; + + private bool _contentLoaded; + + public SinistroView(Item item = null, bool attached = true) + { + item = item ?? ConsultaViewModel.ItemSelecionado; + ((FrameworkElement)this).Tag = "CADASTRO DE SINISTRO"; + ViewModel = new SinistroViewModel(item, attached); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + } + + private void ContentLoad() + { + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Expected O, but got Unknown + //IL_006f: Unknown result type (might be due to invalid IL or missing references) + //IL_0079: Expected O, but got Unknown + //IL_0086: Unknown result type (might be due to invalid IL or missing references) + //IL_0090: Expected O, but got Unknown + ((Selector)ControleGrid).SelectionChanged += new SelectionChangedEventHandler(SinistroGrid_OnSelectionChanged); + ((ToggleButton)AnotacoesButton).IsChecked = ViewModel.IsAnotacoes; + ((ToggleButton)AnotacoesInternasButton).IsChecked = !ViewModel.IsAnotacoes; + ToggleAnotacoes(ViewModel.IsAnotacoes); + ((ToggleButton)AnotacoesButton).Checked += new RoutedEventHandler(Anotacoes_OnChecked); + ((ToggleButton)AnotacoesInternasButton).Checked += new RoutedEventHandler(AnotacoesInternas_OnChecked); + } + + private void ToggleAnotacoes(bool anotacoes, bool inclusao = false) + { + if (anotacoes) + { + ViewModel.IsAnotacoes = true; + if (ViewModel.EnableFields || inclusao) + { + ((UIElement)AnotacoesHoster).Visibility = (Visibility)0; + ((UIElement)AnotacoesInternasHoster).Visibility = (Visibility)2; + } + else + { + ((UIElement)AnotacoesHoster).Visibility = (Visibility)2; + ((UIElement)AnotacoesInternasHoster).Visibility = (Visibility)2; + } + } + else + { + ViewModel.IsAnotacoes = false; + if (ViewModel.EnableFields || inclusao) + { + ((UIElement)AnotacoesHoster).Visibility = (Visibility)2; + ((UIElement)AnotacoesInternasHoster).Visibility = (Visibility)0; + } + else + { + ((UIElement)AnotacoesHoster).Visibility = (Visibility)2; + ((UIElement)AnotacoesInternasHoster).Visibility = (Visibility)2; + } + } + } + + private void Anotacoes_OnChecked(object sender, RoutedEventArgs e) + { + ToggleAnotacoes(anotacoes: true); + } + + private void AnotacoesInternas_OnChecked(object sender, RoutedEventArgs e) + { + ToggleAnotacoes(anotacoes: false); + } + + private void ItemGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_0031: Unknown result type (might be due to invalid IL or missing references) + //IL_003b: Expected O, but got Unknown + DataGrid val = (DataGrid)sender; + if (val == null || ((Selector)val).SelectedIndex >= 0) + { + ViewModel.SelecionaItem((Item)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null)); + } + } + + private void AutoCompleteBoxItem_Populating(object sender, PopulatingEventArgs e) + { + e.Cancel = true; + ViewModel.ItemFiltrar(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Item>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void AutoCompleteBoxItem_OnTextChanged(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + if (string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).Text)) + { + ViewModel.FiltrarItem(""); + } + } + + private void SinistroGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_0031: Unknown result type (might be due to invalid IL or missing references) + //IL_003b: Expected O, but got Unknown + DataGrid val = (DataGrid)sender; + if (val == null || ((Selector)val).SelectedIndex >= 0) + { + ViewModel.SelecionaControle((ControleSinistro)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null)); + } + } + + private void AutoCompleteBoxSinistro_Populating(object sender, PopulatingEventArgs e) + { + e.Cancel = true; + ViewModel.SinistroFiltrar(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<ControleSinistro>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void AutoCompleteBoxSinistro_OnTextChanged(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + if (string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).Text)) + { + ViewModel.FiltrarSinistro(""); + } + } + + private async void Incluir_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.SelectedItem == null) + { + await ViewModel.ShowMessage("NECESSÁRIO INCLUIR O ITEM ANTES DE INCLUIR UM SINISTRO."); + return; + } + await ViewModel.IncluirSinistro(); + List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedSinistro.Validate(); + ((DependencyObject)(object)this).ValidateFields(errorMessages); + ToggleAnotacoes(ViewModel.IsAnotacoes); + } + + private void IncluirEnvolvido_OnClick(object sender, RoutedEventArgs e) + { + //IL_0091: Unknown result type (might be due to invalid IL or missing references) + //IL_0095: Unknown result type (might be due to invalid IL or missing references) + //IL_009a: Unknown result type (might be due to invalid IL or missing references) + ViewModel.IncluirEnvolvido(); + CustomIsReadOnlyControl tipoSinistroBox = TipoSinistroBox; + ControleSinistro selectedControle = ViewModel.SelectedControle; + int isEnabled; + if (selectedControle == null || selectedControle.Sinistros?.Any((Sinistro x) => x.TipoSinistro == (TipoSinistro?)0) != false) + { + Sinistro selectedSinistro = ViewModel.SelectedSinistro; + isEnabled = ((selectedSinistro != null && selectedSinistro.TipoSinistro == (TipoSinistro?)0) ? 1 : 0); + } + else + { + isEnabled = 1; + } + ((UIElement)tipoSinistroBox).IsEnabled = (byte)isEnabled != 0; + Sinistro selectedSinistro2 = ViewModel.SelectedSinistro; + List<KeyValuePair<string, string>> errorMessages = ((selectedSinistro2 != null) ? selectedSinistro2.Validate() : null); + ((DependencyObject)(object)this).ValidateFields(errorMessages); + ToggleAnotacoes(ViewModel.IsAnotacoes, inclusao: true); + } + + private void Alterar_OnClick(object sender, RoutedEventArgs e) + { + //IL_009f: Unknown result type (might be due to invalid IL or missing references) + //IL_00a3: Unknown result type (might be due to invalid IL or missing references) + //IL_00a8: Unknown result type (might be due to invalid IL or missing references) + if (ViewModel.SelectedSinistro != null) + { + ViewModel.Alterar(alterar: true); + CustomIsReadOnlyControl tipoSinistroBox = TipoSinistroBox; + ControleSinistro selectedControle = ViewModel.SelectedControle; + int isEnabled; + if (selectedControle == null || selectedControle.Sinistros?.Any((Sinistro x) => x.TipoSinistro == (TipoSinistro?)0) != false) + { + Sinistro selectedSinistro = ViewModel.SelectedSinistro; + isEnabled = ((selectedSinistro != null && selectedSinistro.TipoSinistro == (TipoSinistro?)0) ? 1 : 0); + } + else + { + isEnabled = 1; + } + ((UIElement)tipoSinistroBox).IsEnabled = (byte)isEnabled != 0; + ToggleAnotacoes(ViewModel.IsAnotacoes); + Sinistro selectedSinistro2 = ViewModel.SelectedSinistro; + if (selectedSinistro2 != null) + { + ((DomainBase)selectedSinistro2).Initialize(); + } + } + } + + private async void Salvar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + ViewModel.Anotacoes = Anotacoes.GetHtml(); + ViewModel.AnotacoesInternas = AnotacoesInternas.GetHtml(); + if (ViewModel.EditarObservacao) + { + ViewModel.SelectedSinistro.ObservacaoInterna = ObservacoesInternas.GetHtml(); + ViewModel.SelectedSinistro.Observacao = Observacoes.GetHtml(); + } + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(); + ((DependencyObject)(object)this).ValidateFields(list); + bool num = list == null || list.Count == 0; + ViewModel.Loading(isLoading: false); + if (num) + { + Anotacoes.Initialize(); + AnotacoesInternas.Initialize(); + ToggleAnotacoes(ViewModel.IsAnotacoes); + } + else + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + } + + private void Cancelar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.CancelarAlteracao(); + Anotacoes.Initialize(); + AnotacoesInternas.Initialize(); + ViewModel.EnableFields = false; + ToggleAnotacoes(ViewModel.IsAnotacoes); + } + + private void Excluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Excluir(); + } + + private async void ArquivoDigital_OnClick(object sender, RoutedEventArgs e) + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)5).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)5) + "."); + return; + } + FiltroArquivoDigital filtro = new FiltroArquivoDigital + { + Id = ((DomainBase)ViewModel.SelectedSinistro).Id, + IdApolice = ((DomainBase)ViewModel.SelectedSinistro.ControleSinistro.Item.Documento).Id, + Tipo = (TipoArquivoDigital)5, + Parente = ViewModel.SelectedSinistro + }; + ViewModel.ShowDrawer(new ArquivoDigitalDrawer(filtro), 0, close: false); + } + + private async void Tarefas_OnClick(object sender, RoutedEventArgs e) + { + Cliente val = await ViewModel.BuscarClienteSinistro(); + Tarefa tarefa = new Tarefa + { + IdCliente = ((DomainBase)ViewModel.SelectedSinistro).Id, + Cliente = val.Nome, + Entidade = (TipoTarefa)4, + IdEntidade = ((DomainBase)ViewModel.SelectedSinistro).Id, + Titulo = "SINISTRO " + ViewModel.SelectedSinistro.Numero + " ITEM " + ViewModel.SelectedSinistro.ItemSinistrado + }; + ViewModel.ShowDrawer(new TarefaDrawer(tarefa), 0, close: false); + } + + private void ParceiroBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Expected O, but got Unknown + ComboBox val = (ComboBox)sender; + if (val == null || ((Selector)val).SelectedItem == null) + { + return; + } + Parceiro val2 = (Parceiro)((Selector)val).SelectedItem; + if (((FrameworkElement)val).Name == "ParceiroMecanica") + { + if (ViewModel.SelectedSinistro.SinistroAuto.ParceiroMecanica == null) + { + ViewModel.SelectedSinistro.SinistroAuto.ParceiroMecanica = val2; + } + ParceiroMecanica.Text = val2.Nome; + ViewModel.TelefonesMecanica = ""; + bool flag = true; + if (!string.IsNullOrWhiteSpace(val2.Ddd1) || !string.IsNullOrWhiteSpace(val2.Telefone1)) + { + flag = false; + SinistroViewModel viewModel = ViewModel; + viewModel.TelefonesMecanica = viewModel.TelefonesMecanica + "TELEFONE 1: (" + val2.Ddd1 + ") " + ValidationHelper.FormatarTelefone(val2.Telefone1); + } + if (!string.IsNullOrWhiteSpace(val2.Ddd2) || !string.IsNullOrWhiteSpace(val2.Telefone2)) + { + flag = false; + SinistroViewModel viewModel = ViewModel; + viewModel.TelefonesMecanica = viewModel.TelefonesMecanica + "\nTELEFONE 2: (" + val2.Ddd2 + ") " + ValidationHelper.FormatarTelefone(val2.Telefone2); + } + if (!string.IsNullOrWhiteSpace(val2.Ddd3) || !string.IsNullOrWhiteSpace(val2.Telefone3)) + { + flag = false; + SinistroViewModel viewModel = ViewModel; + viewModel.TelefonesMecanica = viewModel.TelefonesMecanica + "\nTELEFONE 3: (" + val2.Ddd3 + ") " + ValidationHelper.FormatarTelefone(val2.Telefone3); + } + if (!string.IsNullOrWhiteSpace(val2.Endereco) || !string.IsNullOrWhiteSpace(val2.Cidade) || !string.IsNullOrWhiteSpace(val2.Uf) || !string.IsNullOrWhiteSpace(val2.Bairro) || !string.IsNullOrWhiteSpace(val2.Cep) || !string.IsNullOrWhiteSpace(val2.Numero) || !string.IsNullOrWhiteSpace(val2.Complemento)) + { + flag = false; + SinistroViewModel viewModel = ViewModel; + viewModel.TelefonesMecanica = viewModel.TelefonesMecanica + "\nENDEREÇO: " + val2.Endereco + ", " + val2.Numero + ", " + (string.IsNullOrWhiteSpace(val2.Complemento) ? "-" : (val2.Complemento ?? "")) + ", " + val2.Bairro + ", " + val2.Cidade + "/" + val2.Uf + " - " + val2.Cep; + } + if (!string.IsNullOrWhiteSpace(val2.Email)) + { + flag = false; + SinistroViewModel viewModel2 = ViewModel; + viewModel2.TelefonesMecanica = viewModel2.TelefonesMecanica + "\nEMAIL: " + val2.Email; + } + if (!string.IsNullOrWhiteSpace(val2.Cgccpf)) + { + flag = false; + SinistroViewModel viewModel3 = ViewModel; + viewModel3.TelefonesMecanica = viewModel3.TelefonesMecanica + "\nDOCUMENTO: " + val2.Cgccpf; + } + if (flag) + { + ViewModel.TelefonesMecanica = "PARCEIRO SEM MAIS INFORMAÇÕES"; + } + } + else + { + if (ViewModel.SelectedSinistro.SinistroAuto.ParceiroFunilaria == null) + { + ViewModel.SelectedSinistro.SinistroAuto.ParceiroFunilaria = val2; + } + ParceiroFunilaria.Text = val2.Nome; + ViewModel.TelefonesFunileiro = ""; + bool flag2 = true; + if (!string.IsNullOrWhiteSpace(val2.Ddd1) || !string.IsNullOrWhiteSpace(val2.Telefone1)) + { + flag2 = false; + SinistroViewModel viewModel = ViewModel; + viewModel.TelefonesFunileiro = viewModel.TelefonesFunileiro + "TELEFONE 1: (" + val2.Ddd1 + ") " + ValidationHelper.FormatarTelefone(val2.Telefone1); + } + if (!string.IsNullOrWhiteSpace(val2.Ddd2) || !string.IsNullOrWhiteSpace(val2.Telefone2)) + { + flag2 = false; + SinistroViewModel viewModel = ViewModel; + viewModel.TelefonesFunileiro = viewModel.TelefonesFunileiro + "\nTELEFONE 2: (" + val2.Ddd2 + ") " + ValidationHelper.FormatarTelefone(val2.Telefone2); + } + if (!string.IsNullOrWhiteSpace(val2.Ddd3) || !string.IsNullOrWhiteSpace(val2.Telefone3)) + { + flag2 = false; + SinistroViewModel viewModel = ViewModel; + viewModel.TelefonesFunileiro = viewModel.TelefonesFunileiro + "\nTELEFONE 3: (" + val2.Ddd3 + ") " + ValidationHelper.FormatarTelefone(val2.Telefone3); + } + if (!string.IsNullOrWhiteSpace(val2.Endereco) || !string.IsNullOrWhiteSpace(val2.Cidade) || !string.IsNullOrWhiteSpace(val2.Uf) || !string.IsNullOrWhiteSpace(val2.Bairro) || !string.IsNullOrWhiteSpace(val2.Cep) || !string.IsNullOrWhiteSpace(val2.Numero) || !string.IsNullOrWhiteSpace(val2.Complemento)) + { + flag2 = false; + SinistroViewModel viewModel = ViewModel; + viewModel.TelefonesFunileiro = viewModel.TelefonesFunileiro + "\nENDEREÇO: " + val2.Endereco + ", " + val2.Numero + ", " + (string.IsNullOrWhiteSpace(val2.Complemento) ? "-" : (val2.Complemento ?? "")) + ", " + val2.Bairro + ", " + val2.Cidade + "/" + val2.Uf + " - " + val2.Cep; + } + if (!string.IsNullOrWhiteSpace(val2.Email)) + { + flag2 = false; + SinistroViewModel viewModel4 = ViewModel; + viewModel4.TelefonesFunileiro = viewModel4.TelefonesFunileiro + "\nEMAIL: " + val2.Email; + } + if (!string.IsNullOrWhiteSpace(val2.Cgccpf)) + { + flag2 = false; + SinistroViewModel viewModel5 = ViewModel; + viewModel5.TelefonesFunileiro = viewModel5.TelefonesFunileiro + "\nDOCUMENTO: " + val2.Cgccpf; + } + if (flag2) + { + ViewModel.TelefonesFunileiro = "PARCEIRO SEM MAIS INFORMAÇÕES"; + } + } + } + + private void SituacaoBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Invalid comparison between Unknown and I4 + ComboBox val = (ComboBox)sender; + if (val != null && ((Selector)val).SelectedItem != null) + { + if ((int)(StatusSinistro)((Selector)val).SelectedItem != 1) + { + ViewModel.LiquidacaoVisibility = (Visibility)0; + } + else + { + ViewModel.SelectedSinistro.DataLiquidacao = null; + ViewModel.LiquidacaoVisibility = (Visibility)2; + } + Validar(); + } + } + + private void Validar() + { + if (ViewModel.SelectedSinistro != null) + { + List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedSinistro.Validate(); + ((DependencyObject)(object)this).ValidateFields(errorMessages, focusField: false); + } + } + + private void ImprimirHistorico_OnClick(object sender, RoutedEventArgs e) + { + if (((DomainBase)ViewModel.SelectedSinistro).Id != 0L) + { + ViewModel.ImprimirHistorico(); + } + } + + private void AbrirLogEmail_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.SelectedSinistro != null) + { + ViewModel.AbrirLogEmail((TipoTela)7, ((DomainBase)ViewModel.SelectedSinistro).Id); + } + } + + private void EnviarHistorico_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.EnviarLogEmail(); + } + + private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e) + { + Snackbar.IsActive = false; + } + + private void MecanicaButton_OnClick(object sender, RoutedEventArgs e) + { + //IL_0095: Unknown result type (might be due to invalid IL or missing references) + //IL_009a: Unknown result type (might be due to invalid IL or missing references) + CadastroParceiroView view = new CadastroParceiroView((ViewModel.SelectedSinistro.SinistroAuto.ParceiroMecanica == null || ((DomainBase)ViewModel.SelectedSinistro.SinistroAuto.ParceiroMecanica).Id == 0L) ? null : ViewModel.SelectedSinistro.SinistroAuto.ParceiroMecanica); + ((Window)new HosterWindow((ContentControl)(object)view, "CADASTRO DE PARCEIROS", 1000.0, 600.0)).ShowDialog(); + Parceiro val = (Parceiro)((Selector)ParceiroFunilaria).SelectedItem; + long id = (((int)val != 0) ? ((DomainBase)val).Id : 0); + ViewModel.CarregarParceiros(); + ((Selector)ParceiroFunilaria).SelectedItem = ((id <= 0) ? null : ViewModel.Parceiros?.FirstOrDefault((Func<Parceiro, bool>)((Parceiro x) => ((DomainBase)x).Id == id))); + ((Selector)ParceiroMecanica).SelectedItem = ViewModel.Parceiros?.FirstOrDefault((Func<Parceiro, bool>)delegate(Parceiro x) + { + long id2 = ((DomainBase)x).Id; + Parceiro selectedParceiro = view.ViewModel.SelectedParceiro; + return id2 == ((selectedParceiro != null) ? new long?(((DomainBase)selectedParceiro).Id) : null); + }); + } + + private void FunilariaButton_OnClick(object sender, RoutedEventArgs e) + { + //IL_0095: Unknown result type (might be due to invalid IL or missing references) + //IL_009a: Unknown result type (might be due to invalid IL or missing references) + CadastroParceiroView view = new CadastroParceiroView((ViewModel.SelectedSinistro.SinistroAuto.ParceiroFunilaria == null || ((DomainBase)ViewModel.SelectedSinistro.SinistroAuto.ParceiroFunilaria).Id == 0L) ? null : ViewModel.SelectedSinistro.SinistroAuto.ParceiroFunilaria); + ((Window)new HosterWindow((ContentControl)(object)view, "CADASTRO DE PARCEIROS", 1000.0, 600.0)).ShowDialog(); + Parceiro val = (Parceiro)((Selector)ParceiroMecanica).SelectedItem; + long id = (((int)val != 0) ? ((DomainBase)val).Id : 0); + ViewModel.CarregarParceiros(); + ((Selector)ParceiroMecanica).SelectedItem = ((id <= 0) ? null : ViewModel.Parceiros?.FirstOrDefault((Func<Parceiro, bool>)((Parceiro x) => ((DomainBase)x).Id == id))); + ((Selector)ParceiroFunilaria).SelectedItem = ViewModel.Parceiros?.FirstOrDefault((Func<Parceiro, bool>)delegate(Parceiro x) + { + long id2 = ((DomainBase)x).Id; + Parceiro selectedParceiro = view.ViewModel.SelectedParceiro; + return id2 == ((selectedParceiro != null) ? new long?(((DomainBase)selectedParceiro).Id) : null); + }); + } + + private void AbrirInfo_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirInfo(); + } + + private void Log_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLog((TipoTela)7, ((DomainBase)ViewModel.SelectedSinistro).Id); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/seguros/sinistroview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_00ae: Unknown result type (might be due to invalid IL or missing references) + //IL_00ba: Unknown result type (might be due to invalid IL or missing references) + //IL_00c4: Expected O, but got Unknown + //IL_00c5: Unknown result type (might be due to invalid IL or missing references) + //IL_00d1: Unknown result type (might be due to invalid IL or missing references) + //IL_00db: Expected O, but got Unknown + //IL_00de: Unknown result type (might be due to invalid IL or missing references) + //IL_00e8: Expected O, but got Unknown + //IL_00ea: Unknown result type (might be due to invalid IL or missing references) + //IL_00f6: Unknown result type (might be due to invalid IL or missing references) + //IL_0100: Expected O, but got Unknown + //IL_0102: Unknown result type (might be due to invalid IL or missing references) + //IL_010e: Unknown result type (might be due to invalid IL or missing references) + //IL_0118: Expected O, but got Unknown + //IL_011a: Unknown result type (might be due to invalid IL or missing references) + //IL_0126: Unknown result type (might be due to invalid IL or missing references) + //IL_0130: Expected O, but got Unknown + //IL_0132: Unknown result type (might be due to invalid IL or missing references) + //IL_013e: Unknown result type (might be due to invalid IL or missing references) + //IL_0148: Expected O, but got Unknown + //IL_014b: Unknown result type (might be due to invalid IL or missing references) + //IL_0155: Expected O, but got Unknown + //IL_0162: Unknown result type (might be due to invalid IL or missing references) + //IL_016c: Expected O, but got Unknown + //IL_016f: Unknown result type (might be due to invalid IL or missing references) + //IL_0179: Expected O, but got Unknown + //IL_0186: Unknown result type (might be due to invalid IL or missing references) + //IL_0190: Expected O, but got Unknown + //IL_0192: Unknown result type (might be due to invalid IL or missing references) + //IL_019e: Unknown result type (might be due to invalid IL or missing references) + //IL_01a8: Expected O, but got Unknown + //IL_01aa: Unknown result type (might be due to invalid IL or missing references) + //IL_01b6: Unknown result type (might be due to invalid IL or missing references) + //IL_01c0: Expected O, but got Unknown + //IL_01c2: Unknown result type (might be due to invalid IL or missing references) + //IL_01ce: Unknown result type (might be due to invalid IL or missing references) + //IL_01d8: Expected O, but got Unknown + //IL_01da: Unknown result type (might be due to invalid IL or missing references) + //IL_01e6: Unknown result type (might be due to invalid IL or missing references) + //IL_01f0: Expected O, but got Unknown + //IL_01f2: Unknown result type (might be due to invalid IL or missing references) + //IL_01fe: Unknown result type (might be due to invalid IL or missing references) + //IL_0208: Expected O, but got Unknown + //IL_020a: Unknown result type (might be due to invalid IL or missing references) + //IL_0216: Unknown result type (might be due to invalid IL or missing references) + //IL_0220: Expected O, but got Unknown + //IL_0222: Unknown result type (might be due to invalid IL or missing references) + //IL_022e: Unknown result type (might be due to invalid IL or missing references) + //IL_0238: Expected O, but got Unknown + //IL_023a: Unknown result type (might be due to invalid IL or missing references) + //IL_0246: Unknown result type (might be due to invalid IL or missing references) + //IL_0250: Expected O, but got Unknown + //IL_025f: Unknown result type (might be due to invalid IL or missing references) + //IL_026b: Unknown result type (might be due to invalid IL or missing references) + //IL_0275: Expected O, but got Unknown + //IL_0276: Unknown result type (might be due to invalid IL or missing references) + //IL_0282: Unknown result type (might be due to invalid IL or missing references) + //IL_028c: Expected O, but got Unknown + //IL_028d: Unknown result type (might be due to invalid IL or missing references) + //IL_0299: Unknown result type (might be due to invalid IL or missing references) + //IL_02a3: Expected O, but got Unknown + //IL_02a5: Unknown result type (might be due to invalid IL or missing references) + //IL_02b1: Unknown result type (might be due to invalid IL or missing references) + //IL_02bb: Expected O, but got Unknown + //IL_02bc: Unknown result type (might be due to invalid IL or missing references) + //IL_02c8: Unknown result type (might be due to invalid IL or missing references) + //IL_02d2: Expected O, but got Unknown + //IL_02d3: Unknown result type (might be due to invalid IL or missing references) + //IL_02df: Unknown result type (might be due to invalid IL or missing references) + //IL_02e9: Expected O, but got Unknown + //IL_02eb: Unknown result type (might be due to invalid IL or missing references) + //IL_02f7: Unknown result type (might be due to invalid IL or missing references) + //IL_0301: Expected O, but got Unknown + //IL_0302: Unknown result type (might be due to invalid IL or missing references) + //IL_030e: Unknown result type (might be due to invalid IL or missing references) + //IL_0318: Expected O, but got Unknown + //IL_0319: Unknown result type (might be due to invalid IL or missing references) + //IL_0325: Unknown result type (might be due to invalid IL or missing references) + //IL_032f: Expected O, but got Unknown + //IL_0331: Unknown result type (might be due to invalid IL or missing references) + //IL_033d: Unknown result type (might be due to invalid IL or missing references) + //IL_0347: Expected O, but got Unknown + //IL_0349: Unknown result type (might be due to invalid IL or missing references) + //IL_0355: Unknown result type (might be due to invalid IL or missing references) + //IL_035f: Expected O, but got Unknown + //IL_0360: Unknown result type (might be due to invalid IL or missing references) + //IL_036c: Unknown result type (might be due to invalid IL or missing references) + //IL_0376: Expected O, but got Unknown + //IL_0377: Unknown result type (might be due to invalid IL or missing references) + //IL_0383: Unknown result type (might be due to invalid IL or missing references) + //IL_038d: Expected O, but got Unknown + //IL_038f: Unknown result type (might be due to invalid IL or missing references) + //IL_039c: Unknown result type (might be due to invalid IL or missing references) + //IL_03a6: Expected O, but got Unknown + //IL_03a8: Unknown result type (might be due to invalid IL or missing references) + //IL_03b5: Unknown result type (might be due to invalid IL or missing references) + //IL_03bf: Expected O, but got Unknown + //IL_03c0: Unknown result type (might be due to invalid IL or missing references) + //IL_03cd: Unknown result type (might be due to invalid IL or missing references) + //IL_03d7: Expected O, but got Unknown + //IL_03da: Unknown result type (might be due to invalid IL or missing references) + //IL_03e4: Expected O, but got Unknown + //IL_03f1: Unknown result type (might be due to invalid IL or missing references) + //IL_03fb: Expected O, but got Unknown + //IL_03fd: Unknown result type (might be due to invalid IL or missing references) + //IL_0409: Unknown result type (might be due to invalid IL or missing references) + //IL_0413: Expected O, but got Unknown + //IL_0416: Unknown result type (might be due to invalid IL or missing references) + //IL_0420: Expected O, but got Unknown + //IL_042d: Unknown result type (might be due to invalid IL or missing references) + //IL_0437: Expected O, but got Unknown + //IL_0439: Unknown result type (might be due to invalid IL or missing references) + //IL_0445: Unknown result type (might be due to invalid IL or missing references) + //IL_044f: Expected O, but got Unknown + //IL_0452: Unknown result type (might be due to invalid IL or missing references) + //IL_045c: Expected O, but got Unknown + //IL_045f: Unknown result type (might be due to invalid IL or missing references) + //IL_0469: Expected O, but got Unknown + //IL_04d4: Unknown result type (might be due to invalid IL or missing references) + //IL_04de: Expected O, but got Unknown + //IL_04e0: Unknown result type (might be due to invalid IL or missing references) + //IL_04ec: Unknown result type (might be due to invalid IL or missing references) + //IL_04f6: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBoxSinistro_Populating); + ((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBoxSinistro_OnTextChanged); + break; + case 2: + ControleGrid = (DataGrid)target; + break; + case 3: + ((MenuItem)target).Click += new RoutedEventHandler(Incluir_OnClick); + break; + case 4: + ((MenuItem)target).Click += new RoutedEventHandler(Incluir_OnClick); + break; + case 5: + ((MenuItem)target).Click += new RoutedEventHandler(IncluirEnvolvido_OnClick); + break; + case 6: + ((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick); + break; + case 7: + SalvarSinistroButton = (MenuItem)target; + SalvarSinistroButton.Click += new RoutedEventHandler(Salvar_OnClick); + break; + case 8: + CancelarApoliceButton = (MenuItem)target; + CancelarApoliceButton.Click += new RoutedEventHandler(Cancelar_OnClick); + break; + case 9: + ((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick); + break; + case 10: + ((MenuItem)target).Click += new RoutedEventHandler(Tarefas_OnClick); + break; + case 11: + ((MenuItem)target).Click += new RoutedEventHandler(ArquivoDigital_OnClick); + break; + case 12: + ((MenuItem)target).Click += new RoutedEventHandler(ImprimirHistorico_OnClick); + break; + case 13: + ((MenuItem)target).Click += new RoutedEventHandler(EnviarHistorico_OnClick); + break; + case 14: + ((MenuItem)target).Click += new RoutedEventHandler(Log_OnClick); + break; + case 15: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLogEmail_OnClick); + break; + case 16: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirInfo_OnClick); + break; + case 17: + TipoSinistroBox = (CustomIsReadOnlyControl)target; + break; + case 18: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 19: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 20: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 21: + ((Selector)(ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(SituacaoBox_OnSelectionChanged); + break; + case 22: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 23: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 24: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(FormatarTelefone); + break; + case 25: + ParceiroMecanica = (ComboBox)target; + ((Selector)ParceiroMecanica).SelectionChanged += new SelectionChangedEventHandler(ParceiroBox_OnSelectionChanged); + break; + case 26: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(MecanicaButton_OnClick); + break; + case 27: + ParceiroFunilaria = (ComboBox)target; + ((Selector)ParceiroFunilaria).SelectionChanged += new SelectionChangedEventHandler(ParceiroBox_OnSelectionChanged); + break; + case 28: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(FunilariaButton_OnClick); + break; + case 29: + AnotacoesButton = (RadioButton)target; + break; + case 30: + AnotacoesInternasButton = (RadioButton)target; + break; + case 31: + AnotacoesHoster = (CustomItemControl)target; + break; + case 32: + Anotacoes = (WebEditor)target; + break; + case 33: + ObservacoesHoster = (CustomItemControl)target; + break; + case 34: + Observacoes = (WebEditor)target; + break; + case 35: + AnotacoesInternasHoster = (CustomItemControl)target; + break; + case 36: + AnotacoesInternas = (WebEditor)target; + break; + case 37: + ObservacoesInternasHoster = (CustomItemControl)target; + break; + case 38: + ObservacoesInternas = (WebEditor)target; + break; + case 39: + Snackbar = (Snackbar)target; + break; + case 40: + ((SnackbarMessage)target).ActionClick += new RoutedEventHandler(SnackbarMessage_ActionClick); + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Seguros/TrocarClienteView.cs b/Decompiler/Gestor.Application.Views.Seguros/TrocarClienteView.cs new file mode 100644 index 0000000..c8c26bb --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Seguros/TrocarClienteView.cs @@ -0,0 +1,160 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; +using System.Windows.Threading; +using Gestor.Application.ViewModels.Seguros; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Seguros; +using MaterialDesignThemes.Wpf; + +namespace Gestor.Application.Views.Seguros; + +public class TrocarClienteView : BaseUserControl, IComponentConnector +{ + public TrocarClienteViewModel ViewModel; + + internal ProgressBar ProgressBar; + + internal Snackbar Snackbar; + + private bool _contentLoaded; + + public TrocarClienteView(Documento documento) + { + ViewModel = new TrocarClienteViewModel + { + SelectedDocumento = documento + }; + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + private void AutoCompleteBox_Populating(object sender, PopulatingEventArgs e) + { + if (e.Parameter.Length < 3) + { + return; + } + e.Cancel = true; + ViewModel.BuscarCliente(ValidationHelper.RemoveDiacritics(e.Parameter.Trim()), null, (TipoFiltroCliente)2).ContinueWith(delegate(Task<List<Cliente>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private async void Salvar_OnClick(object sender, RoutedEventArgs e) + { + if (await ViewModel.Salvar()) + { + ToggleSnackBar("CLIENTE TROCADO COM SUCESSO."); + } + else + { + ToggleSnackBar("ERRO AO TROCAR CLIENTE."); + } + } + + private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e) + { + Snackbar.IsActive = false; + } + + public void ToggleSnackBar(string message, bool active = true) + { + ((ContentControl)Snackbar.Message).Content = message; + Snackbar.IsActive = active; + if (active) + { + Task.Factory.StartNew(CloseSlackBar); + } + } + + private void CloseSlackBar() + { + Thread.Sleep(5000); + Dispatcher dispatcher = ((DispatcherObject)ProgressBar).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)4, (Delegate)(Action)delegate + { + ToggleSnackBar("", active: false); + }); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/seguros/trocarclienteview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0020: Unknown result type (might be due to invalid IL or missing references) + //IL_002a: Expected O, but got Unknown + //IL_002c: Unknown result type (might be due to invalid IL or missing references) + //IL_0038: Unknown result type (might be due to invalid IL or missing references) + //IL_0042: Expected O, but got Unknown + //IL_0044: Unknown result type (might be due to invalid IL or missing references) + //IL_0050: Unknown result type (might be due to invalid IL or missing references) + //IL_005a: Expected O, but got Unknown + //IL_005d: Unknown result type (might be due to invalid IL or missing references) + //IL_0067: Expected O, but got Unknown + //IL_0069: Unknown result type (might be due to invalid IL or missing references) + //IL_0075: Unknown result type (might be due to invalid IL or missing references) + //IL_007f: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ProgressBar = (ProgressBar)target; + break; + case 2: + ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick); + break; + case 3: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBox_Populating); + break; + case 4: + Snackbar = (Snackbar)target; + break; + case 5: + ((SnackbarMessage)target).ActionClick += new RoutedEventHandler(SnackbarMessage_ActionClick); + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views/ConnectionRetryView.cs b/Decompiler/Gestor.Application.Views/ConnectionRetryView.cs new file mode 100644 index 0000000..b76f86c --- /dev/null +++ b/Decompiler/Gestor.Application.Views/ConnectionRetryView.cs @@ -0,0 +1,267 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Media; +using System.Windows.Shapes; +using System.Windows.Shell; +using Gestor.Application.Helpers; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; + +namespace Gestor.Application.Views; + +public class ConnectionRetryView : Window, IComponentConnector +{ + public TaskCompletionSource<object> CloseTask = new TaskCompletionSource<object>(); + + private bool _buttonClickable; + + internal WindowChrome WindowChrome; + + internal Grid MinimizeButton; + + internal Grid CloseButton; + + internal ProgressBar ProgressRing; + + internal ItemsControl Controls; + + private bool _contentLoaded; + + public UnitOfWork UnitOfWOrk { get; set; } + + public ConnectionRetryView() + { + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Expected O, but got Unknown + //IL_003b: Unknown result type (might be due to invalid IL or missing references) + //IL_0045: Expected O, but got Unknown + //IL_0052: Unknown result type (might be due to invalid IL or missing references) + //IL_005c: Expected O, but got Unknown + //IL_0069: Unknown result type (might be due to invalid IL or missing references) + //IL_0073: Expected O, but got Unknown + InitializeComponent(); + ((UIElement)MinimizeButton).MouseEnter += new MouseEventHandler(TopControls_OnMouseEnter); + ((UIElement)MinimizeButton).MouseLeave += new MouseEventHandler(TopControls_OnMouseLeave); + ((UIElement)CloseButton).MouseEnter += new MouseEventHandler(TopControls_OnMouseEnter); + ((UIElement)CloseButton).MouseLeave += new MouseEventHandler(TopControls_OnMouseLeave); + ((Window)this).Closed += delegate + { + CloseTask.SetResult(null); + }; + } + + private void TopControls_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + //IL_0008: Unknown result type (might be due to invalid IL or missing references) + //IL_0063: Unknown result type (might be due to invalid IL or missing references) + //IL_0068: Unknown result type (might be due to invalid IL or missing references) + //IL_006d: Unknown result type (might be due to invalid IL or missing references) + //IL_0077: Expected O, but got Unknown + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + //IL_002d: Unknown result type (might be due to invalid IL or missing references) + //IL_0032: Unknown result type (might be due to invalid IL or missing references) + //IL_003c: Expected O, but got Unknown + //IL_003d: Unknown result type (might be due to invalid IL or missing references) + //IL_0048: Expected O, but got Unknown + //IL_0052: Unknown result type (might be due to invalid IL or missing references) + //IL_0057: Unknown result type (might be due to invalid IL or missing references) + //IL_0061: Expected O, but got Unknown + _buttonClickable = true; + if (((FrameworkElement)(Grid)sender).Name == "CloseButton") + { + ((Panel)(Grid)sender).Background = (Brush)new SolidColorBrush(Color.FromRgb((byte)241, (byte)112, (byte)123)); + DependencyObject child = VisualTreeHelper.GetChild((DependencyObject)(Grid)sender, 0); + Path val = (Path)(object)((child is Path) ? child : null); + if (val != null) + { + ((Shape)val).Stroke = (Brush)new SolidColorBrush(Colors.Black); + } + } + else + { + ((Panel)(Grid)sender).Background = (Brush)new SolidColorBrush(Colors.Blue); + } + } + + private void TopControls_OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + if (_buttonClickable) + { + ((object)this).GetType().GetMethod(((FrameworkElement)(Grid)sender).Name + "_Click")?.Invoke(this, null); + } + } + + private static void TopControls_OnMouseEnter(object sender, MouseEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Unknown result type (might be due to invalid IL or missing references) + //IL_0032: Unknown result type (might be due to invalid IL or missing references) + //IL_0037: Unknown result type (might be due to invalid IL or missing references) + //IL_001d: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Unknown result type (might be due to invalid IL or missing references) + //IL_0041: Expected O, but got Unknown + //IL_0042: Unknown result type (might be due to invalid IL or missing references) + //IL_004d: Expected O, but got Unknown + //IL_0057: Unknown result type (might be due to invalid IL or missing references) + //IL_005c: Unknown result type (might be due to invalid IL or missing references) + //IL_0066: Expected O, but got Unknown + ((Panel)(Grid)sender).Background = (Brush)((((FrameworkElement)(Grid)sender).Name == "CloseButton") ? new SolidColorBrush(Color.FromRgb((byte)232, (byte)17, (byte)35)) : new SolidColorBrush(Colors.Blue)); + DependencyObject child = VisualTreeHelper.GetChild((DependencyObject)(Grid)sender, 0); + Path val = (Path)(object)((child is Path) ? child : null); + if (val != null) + { + ((Shape)val).Stroke = (Brush)new SolidColorBrush(Colors.White); + } + } + + private void TopControls_OnMouseLeave(object sender, MouseEventArgs e) + { + //IL_0008: Unknown result type (might be due to invalid IL or missing references) + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Unknown result type (might be due to invalid IL or missing references) + //IL_001c: Expected O, but got Unknown + //IL_001d: Unknown result type (might be due to invalid IL or missing references) + //IL_0028: Expected O, but got Unknown + //IL_0032: Unknown result type (might be due to invalid IL or missing references) + //IL_0037: Unknown result type (might be due to invalid IL or missing references) + //IL_0041: Expected O, but got Unknown + _buttonClickable = false; + ((Panel)(Grid)sender).Background = (Brush)new SolidColorBrush(Colors.Transparent); + DependencyObject child = VisualTreeHelper.GetChild((DependencyObject)(Grid)sender, 0); + Path val = (Path)(object)((child is Path) ? child : null); + if (val != null) + { + ((Shape)val).Stroke = (Brush)new SolidColorBrush(Colors.White); + } + } + + public void MinimizeButton_Click() + { + ((Window)this).WindowState = (WindowState)1; + } + + public void CloseButton_Click() + { + ((Window)this).Close(); + } + + private void Loading(bool isLoading) + { + ((UIElement)Controls).Visibility = (Visibility)(isLoading ? 2 : 0); + ((UIElement)ProgressRing).Visibility = (Visibility)((!isLoading) ? 2 : 0); + ((UIElement)this).IsEnabled = !isLoading; + } + + private async void btnRetry_Click(object sender, RoutedEventArgs e) + { + Loading(isLoading: true); + UnitOfWork val = await Task.Run((Func<UnitOfWork>)delegate + { + //IL_001a: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Expected O, but got Unknown + try + { + Instancia.Conexao = Instancia.Conexao ?? Connection.GetConnection(); + return new UnitOfWork(Instancia.Conexao, true); + } + catch (Exception) + { + return (UnitOfWork)null; + } + }); + Loading(isLoading: false); + if (val != null && ((GenericUnitOfWork)val).HasSession) + { + UnitOfWOrk = val; + ((Window)this).Close(); + } + } + + private void btnRestart_OnClick(object sender, RoutedEventArgs e) + { + Instancia.App.Restart(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/connectionretryview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_002b: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Expected O, but got Unknown + //IL_0038: Unknown result type (might be due to invalid IL or missing references) + //IL_0042: Expected O, but got Unknown + //IL_004f: Unknown result type (might be due to invalid IL or missing references) + //IL_0059: Expected O, but got Unknown + //IL_0066: Unknown result type (might be due to invalid IL or missing references) + //IL_0070: Expected O, but got Unknown + //IL_0073: Unknown result type (might be due to invalid IL or missing references) + //IL_007d: Expected O, but got Unknown + //IL_008a: Unknown result type (might be due to invalid IL or missing references) + //IL_0094: Expected O, but got Unknown + //IL_00a1: Unknown result type (might be due to invalid IL or missing references) + //IL_00ab: Expected O, but got Unknown + //IL_00ae: Unknown result type (might be due to invalid IL or missing references) + //IL_00b8: Expected O, but got Unknown + //IL_00bb: Unknown result type (might be due to invalid IL or missing references) + //IL_00c5: Expected O, but got Unknown + //IL_00c7: Unknown result type (might be due to invalid IL or missing references) + //IL_00d3: Unknown result type (might be due to invalid IL or missing references) + //IL_00dd: Expected O, but got Unknown + //IL_00df: Unknown result type (might be due to invalid IL or missing references) + //IL_00eb: Unknown result type (might be due to invalid IL or missing references) + //IL_00f5: Expected O, but got Unknown + switch (connectionId) + { + case 1: + WindowChrome = (WindowChrome)target; + break; + case 2: + MinimizeButton = (Grid)target; + ((UIElement)MinimizeButton).MouseLeftButtonDown += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonDown); + ((UIElement)MinimizeButton).MouseLeftButtonUp += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonUp); + break; + case 3: + CloseButton = (Grid)target; + ((UIElement)CloseButton).MouseLeftButtonDown += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonDown); + ((UIElement)CloseButton).MouseLeftButtonUp += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonUp); + break; + case 4: + ProgressRing = (ProgressBar)target; + break; + case 5: + Controls = (ItemsControl)target; + break; + case 6: + ((ButtonBase)(RepeatButton)target).Click += new RoutedEventHandler(btnRetry_Click); + break; + case 7: + ((ButtonBase)(RepeatButton)target).Click += new RoutedEventHandler(btnRestart_OnClick); + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views/ImportView.cs b/Decompiler/Gestor.Application.Views/ImportView.cs new file mode 100644 index 0000000..c9d8cf4 --- /dev/null +++ b/Decompiler/Gestor.Application.Views/ImportView.cs @@ -0,0 +1,72 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Markup; +using Gestor.Application.ViewModels; + +namespace Gestor.Application.Views; + +public class ImportView : UserControl, IComponentConnector +{ + private bool _contentLoaded; + + private ImportViewModel ViewModel { get; } + + public ImportView() + { + ViewModel = new ImportViewModel(); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + private void ButtonBase_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Importar(); + } + + private void ButtonBase2_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.CarregarArquivos(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/importview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + //IL_0021: Expected O, but got Unknown + //IL_0023: Unknown result type (might be due to invalid IL or missing references) + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0039: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ButtonBase2_OnClick); + break; + case 2: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ButtonBase_OnClick); + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views/LoginWindow.cs b/Decompiler/Gestor.Application.Views/LoginWindow.cs new file mode 100644 index 0000000..297c643 --- /dev/null +++ b/Decompiler/Gestor.Application.Views/LoginWindow.cs @@ -0,0 +1,752 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Net.Sockets; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Media; +using System.Windows.Shapes; +using System.Windows.Threading; +using Agger.Registro; +using Gestor.Application.Componentes; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Ajuda; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels; +using Gestor.Application.Views.Ferramentas; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.License; +using Newtonsoft.Json.Linq; + +namespace Gestor.Application.Views; + +public class LoginWindow : Window, IComponentConnector +{ + internal LoginViewModel ViewModel; + + private bool _buttonClickable; + + private DispatcherTimer _carouselTimer; + + internal Image ProgressRing; + + internal TextBox UserBox; + + internal CustomSenhaLoginBox PasswordBox; + + internal TextBlock TrocaSenha; + + internal CustomSenhaLoginBox SenhaBox; + + internal CustomSenhaLoginBox ConfirmacaoBox; + + internal TextBox ChaveBox; + + internal Grid MinimizeButton; + + internal Grid CloseButton; + + private bool _contentLoaded; + + public bool Bloquear { get; set; } + + private JArray LoginSettings { get; set; } + + public LoginWindow() + { + //IL_003a: Unknown result type (might be due to invalid IL or missing references) + //IL_0044: Expected O, but got Unknown + //IL_0051: Unknown result type (might be due to invalid IL or missing references) + //IL_005b: Expected O, but got Unknown + //IL_0068: Unknown result type (might be due to invalid IL or missing references) + //IL_0072: Expected O, but got Unknown + //IL_007f: Unknown result type (might be due to invalid IL or missing references) + //IL_0089: Expected O, but got Unknown + ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; + ViewModel = new LoginViewModel(); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + ((UIElement)MinimizeButton).MouseEnter += new MouseEventHandler(TopControls_OnMouseEnter); + ((UIElement)MinimizeButton).MouseLeave += new MouseEventHandler(TopControls_OnMouseLeave); + ((UIElement)CloseButton).MouseEnter += new MouseEventHandler(TopControls_OnMouseEnter); + ((UIElement)CloseButton).MouseLeave += new MouseEventHandler(TopControls_OnMouseLeave); + ViewModel.Head = "AGGER GESTOR " + ViewModel.Version + " - AGUARDE ESTAMOS INICIALIZANDO"; + } + + protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo) + { + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0025: Unknown result type (might be due to invalid IL or missing references) + //IL_002a: Unknown result type (might be due to invalid IL or missing references) + //IL_0053: Unknown result type (might be due to invalid IL or missing references) + //IL_0058: Unknown result type (might be due to invalid IL or missing references) + //IL_0061: Unknown result type (might be due to invalid IL or missing references) + //IL_0066: Unknown result type (might be due to invalid IL or missing references) + ((FrameworkElement)this).OnRenderSizeChanged(sizeInfo); + Size val; + if (sizeInfo.HeightChanged) + { + double top = ((Window)this).Top; + val = sizeInfo.PreviousSize; + double height = ((Size)(ref val)).Height; + val = sizeInfo.NewSize; + ((Window)this).Top = top + (height - ((Size)(ref val)).Height) / 2.0; + } + if (sizeInfo.WidthChanged) + { + double left = ((Window)this).Left; + val = sizeInfo.PreviousSize; + double width = ((Size)(ref val)).Width; + val = sizeInfo.NewSize; + ((Window)this).Left = left + (width - ((Size)(ref val)).Width) / 2.0; + } + } + + private void TopControls_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + //IL_0008: Unknown result type (might be due to invalid IL or missing references) + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + //IL_0030: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_003f: Expected O, but got Unknown + _buttonClickable = true; + ((Panel)(Grid)sender).Background = (Brush)((((FrameworkElement)(Grid)sender).Name == "CloseButton") ? new SolidColorBrush(Colors.DarkGoldenrod) : new SolidColorBrush(Colors.DimGray)); + } + + private void TopControls_OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + if (_buttonClickable) + { + ((object)this).GetType().GetMethod(((FrameworkElement)(Grid)sender).Name + "_Click")?.Invoke(this, null); + } + } + + private static void TopControls_OnMouseEnter(object sender, MouseEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Unknown result type (might be due to invalid IL or missing references) + //IL_003d: Unknown result type (might be due to invalid IL or missing references) + //IL_0042: Unknown result type (might be due to invalid IL or missing references) + //IL_001d: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Unknown result type (might be due to invalid IL or missing references) + //IL_004c: Expected O, but got Unknown + //IL_004d: Unknown result type (might be due to invalid IL or missing references) + //IL_0058: Expected O, but got Unknown + //IL_0062: Unknown result type (might be due to invalid IL or missing references) + //IL_0067: Unknown result type (might be due to invalid IL or missing references) + //IL_0071: Expected O, but got Unknown + ((Panel)(Grid)sender).Background = (Brush)((((FrameworkElement)(Grid)sender).Name == "CloseButton") ? new SolidColorBrush((Color)Application.Current.Resources[(object)"AggerYellow100"]) : new SolidColorBrush(Colors.Gray)); + DependencyObject child = VisualTreeHelper.GetChild((DependencyObject)(Grid)sender, 0); + Path val = (Path)(object)((child is Path) ? child : null); + if (val != null) + { + ((Shape)val).Stroke = (Brush)new SolidColorBrush(Colors.White); + } + } + + private void TopControls_OnMouseLeave(object sender, MouseEventArgs e) + { + //IL_0008: Unknown result type (might be due to invalid IL or missing references) + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Unknown result type (might be due to invalid IL or missing references) + //IL_001c: Expected O, but got Unknown + //IL_001d: Unknown result type (might be due to invalid IL or missing references) + //IL_0028: Expected O, but got Unknown + //IL_0033: Unknown result type (might be due to invalid IL or missing references) + //IL_0069: Unknown result type (might be due to invalid IL or missing references) + //IL_006e: Unknown result type (might be due to invalid IL or missing references) + //IL_0049: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_0078: Expected O, but got Unknown + _buttonClickable = false; + ((Panel)(Grid)sender).Background = (Brush)new SolidColorBrush(Colors.Transparent); + DependencyObject child = VisualTreeHelper.GetChild((DependencyObject)(Grid)sender, 0); + Path val = (Path)(object)((child is Path) ? child : null); + if (val != null) + { + ((Shape)val).Stroke = (Brush)((((FrameworkElement)(Grid)sender).Name == "CloseButton") ? new SolidColorBrush((Color)Application.Current.Resources[(object)"AggerYellow100"]) : new SolidColorBrush(Colors.DimGray)); + } + } + + public void MinimizeButton_Click() + { + ((Window)this).WindowState = (WindowState)1; + } + + public void CloseButton_Click() + { + ((Window)this).Close(); + } + + private void Loading(bool isLoading) + { + ViewModel.EnableFields = !isLoading; + ViewModel.LoadingVisibility = isLoading; + ViewModel.FieldsVisibility = !isLoading; + ((UIElement)this).IsEnabled = !isLoading; + } + + private async void LoginWindow_OnLoaded(object sender, RoutedEventArgs e) + { + Loading(isLoading: true); + await ViewModel.GetCfgJson(); + await SearchImage(); + ViewModel.EnableButtons = false; + LicenseHelper license = new LicenseHelper(); + bool registro = await license.VerificarRegistro(); + if (!registro) + { + string key = await license.FindKey(); + bool flag = false; + if (key != null) + { + await license.Registrar(key); + flag = true; + } + if (key == null && !string.IsNullOrWhiteSpace(Recursos.Registrar)) + { + await license.Registrar(Recursos.Registrar); + flag = true; + } + if (flag) + { + registro = await license.VerificarRegistro(); + } + } + if (registro) + { + Tuple<bool, string> tuple = await license.VerificarAcesso(); + if (!tuple.Item1) + { + Loading(isLoading: false); + ViewModel.AcessoNegado(tuple.Item2); + return; + } + ConnectionHelper connectionHelper = new ConnectionHelper(); + Tuple<bool, bool> tuple2 = await connectionHelper.PrimeiroAcesso(); + if (Connection.ConnectionAddress == null || Connection.ConnectionAddress.Type == 4) + { + Loading(isLoading: false); + ViewModel.AcessoNegado("Erro de conexão com Banco Gestor.\nEntre em contato com Suporte!"); + } + else if (tuple2.Item1 && tuple2.Item2) + { + Tuple<bool, string> tuple3 = await license.VerificarVersao(); + if (!tuple3.Item1) + { + Loading(isLoading: false); + ViewModel.AcessoNegado(tuple3.Item2); + return; + } + Task.Run(delegate + { + try + { + if (!connectionHelper.BDConvertido()) + { + new BaseServico().BuscarEmpresa(1L); + } + } + catch + { + } + }); + Loading(isLoading: false); + if (string.IsNullOrWhiteSpace(UserBox.Text)) + { + ((UIElement)UserBox).Focus(); + } + else + { + ((UIElement)PasswordBox.PasswordBox).Focus(); + } + ViewModel.EnableButtons = true; + string result = Connection.Get<string>("Customer/Name/" + ApplicationHelper.NumeroSerial).Result; + ViewModel.Head = result; + } + else + { + ((Window)new TutorialView(tuple2)).Show(); + ((Window)this).Close(); + } + } + else + { + Loading(isLoading: false); + ViewModel.AbrirRegistro(); + ViewModel.EnableButtons = true; + } + } + + private async Task SearchImage() + { + try + { + HttpClient client = new HttpClient(); + try + { + ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; + client.Timeout = TimeSpan.FromSeconds(30.0); + LoginSettings = JArray.Parse(await client.GetStringAsync(Address.LoginJsonV2)); + DateTime now = DateTime.Now; + foreach (JToken item in ((IEnumerable<JToken>)LoginSettings).Where(delegate(JToken x) + { + JToken obj2 = x[(object)"Ativo"]; + if (obj2 == null || !Extensions.Value<bool>((IEnumerable<JToken>)obj2)) + { + return false; + } + JToken obj3 = x[(object)"Produto"]; + List<int> list = ((obj3 != null) ? obj3.Values<int>().ToList() : null); + if (list == null || !list.Any((int p) => p == 0 || p == 3)) + { + return false; + } + DateTime result; + bool flag = DateTime.TryParse(((object)x[(object)"Inicio"])?.ToString(), out result); + DateTime result2; + bool flag2 = DateTime.TryParse(((object)x[(object)"Fim"])?.ToString(), out result2); + if (flag && flag2) + { + if (now >= result) + { + return now <= result2; + } + return false; + } + if (flag) + { + return now >= result; + } + return !flag2 || now <= result2; + })) + { + ViewModel.LoginImages.Add(new LoginImageModel + { + Imagem = ((object)item[(object)"Imagem"])?.ToString(), + UrlFixa = ((object)item[(object)"UrlFixa"])?.ToString() + }); + } + ViewModel.SelectedImage = ViewModel.LoginImages.FirstOrDefault(); + ((DispatcherObject)this).Dispatcher.Invoke((Action)StartCarousel); + } + finally + { + ((IDisposable)client)?.Dispose(); + } + } + catch + { + } + } + + private void StartCarousel() + { + //IL_0015: Unknown result type (might be due to invalid IL or missing references) + //IL_001a: Unknown result type (might be due to invalid IL or missing references) + //IL_0033: Expected O, but got Unknown + if (ViewModel.LoginImages.Count > 1) + { + _carouselTimer = new DispatcherTimer + { + Interval = TimeSpan.FromSeconds(10.0) + }; + _carouselTimer.Tick += delegate + { + int index = (ViewModel.LoginImages.IndexOf(ViewModel.SelectedImage) + 1) % ViewModel.LoginImages.Count; + ViewModel.SelectedImage = ViewModel.LoginImages[index]; + }; + _carouselTimer.Start(); + } + } + + private async Task<bool> VerificarAcesso() + { + LicenseHelper license = new LicenseHelper(); + Tuple<bool, string> tuple = await license.VerificarAcesso(); + if (!tuple.Item1) + { + Loading(isLoading: false); + ViewModel.AcessoNegado(tuple.Item2); + return true; + } + if (!ViewModel.Login.Contains("AGGER@")) + { + bool registrar = false; + if (!(await license.VerificarMaquina())) + { + Loading(isLoading: false); + while (!registrar) + { + List<Instalacao> licencas = await license.GetInstalacoes(); + if (licencas.Count == 0) + { + ViewModel.AcessoNegado("ACESSO NEGADO, NÃO EXISTEM LICENÇAS VÁLIDAS."); + return true; + } + Instalacao instalacaoUsuario = ((IEnumerable<Instalacao>)licencas.OrderByDescending((Instalacao x) => x.UltimoAcesso)).FirstOrDefault((Func<Instalacao, bool>)((Instalacao x) => x.UsuarioId == ((DomainBase)Recursos.Usuario).Id)); + bool flag = instalacaoUsuario != null; + if (flag) + { + flag = await ViewModel.ShowMessage("SEU ULTIMO ACESSO FOI NA MAQUINA " + instalacaoUsuario.NomeMaquina + ". DESEJA SUBSTITUIR A LICENÇA PARA ESSA MAQUINA?", "SIM", "NÃO"); + } + Instalacao val = ((!flag) ? (await ViewModel.ShowInstalacoes(licencas)) : instalacaoUsuario); + Instalacao val2 = val; + if (val2 == null) + { + ViewModel.AcessoNegado("MÁQUINA NÃO REGISTRADA"); + return true; + } + Loading(isLoading: true); + await new AjudaServico().ExcluirInstalacao(((DomainBase)val2).Id); + await Task.Delay(15000); + registrar = await license.VerificarMaquina(); + Loading(isLoading: false); + } + } + } + Tuple<bool, string> tuple2 = await license.VerificarVersao(); + if (!tuple2.Item1) + { + Loading(isLoading: false); + ViewModel.AcessoNegado(tuple2.Item2); + return true; + } + string text = await new ConnectionHelper().AtualizarBanco(); + if (text != null) + { + await ViewModel.ShowMessage(text); + return false; + } + if (!(await ViewModel.Load())) + { + ((Window)this).Close(); + } + return false; + } + + private async void Acessar_Click(object sender, RoutedEventArgs e) + { + ((ButtonBase)(RepeatButton)sender).Click -= new RoutedEventHandler(Acessar_Click); + await Access(); + ((ButtonBase)(RepeatButton)sender).Click += new RoutedEventHandler(Acessar_Click); + } + + private async void PasswordBox_OnKeyDown(object sender, KeyEventArgs e) + { + if ((int)e.Key == 6) + { + await Access(); + } + } + + private async Task Access(bool error = true) + { + if (string.IsNullOrEmpty(ViewModel.Login) || string.IsNullOrEmpty(ViewModel.Senha)) + { + if (error) + { + ViewModel.ErrorLoginVisibility = (Visibility)0; + } + ((UIElement)UserBox).Focus(); + return; + } + Loading(isLoading: true); + if (!(await ViewModel.Validate(ViewModel.Login, ViewModel.Senha))) + { + Loading(isLoading: false); + ((UIElement)UserBox).Focus(); + return; + } + bool flag = Bloquear; + if (!flag) + { + flag = await VerificarAcesso(); + } + Bloquear = flag; + if (Bloquear) + { + return; + } + DateTime networkTime = Funcoes.GetNetworkTime(); + if (((DomainBase)Recursos.Usuario).Id > 0) + { + RegistroLog keyValues = new RegistroLog + { + Acao = (TipoAcao)0, + Usuario = Recursos.Usuario, + DataHora = networkTime, + Descricao = $"O USUÁRIO {Recursos.Usuario.Nome} LOGOU NO SISTEMA, EM {networkTime}.", + EntidadeId = ((DomainBase)Recursos.Usuario).Id, + Tela = (TipoTela)49, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = Dns.GetHostEntry(Dns.GetHostName()).AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + UnitOfWork commited = Instancia.Commited; + try + { + new BaseServico().SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + ((Window)new DownloadWindow(new Parameters + { + Beta = ApplicationHelper.Beta, + Type = 7, + Application = "Agger.Gestor.exe", + Directory = "", + Run = false + })).Show(); + ((Window)new MainWindow()).Show(); + ((Window)this).Close(); + } + + private async void Registrar_OnClick(object sender, RoutedEventArgs e) + { + Loading(isLoading: true); + LicenseHelper license = new LicenseHelper(); + string text = await license.Registrar(ViewModel.Chave); + if (text == "false") + { + await ViewModel.ShowMessage("CHAVE INVÁLIDA"); + Loading(isLoading: false); + ViewModel.AbrirRegistro(); + return; + } + if (text == "root") + { + await ViewModel.ShowMessage("CHAVE JÁ REGISTRADA ANTERIORMENTE."); + } + ViewModel.FecharRegistro(); + string result = Connection.Get<string>("Customer/Name/" + ApplicationHelper.NumeroSerial).Result; + ViewModel.Head = result; + Tuple<bool, string> tuple = await license.VerificarAcesso(); + if (!tuple.Item1) + { + Loading(isLoading: false); + ViewModel.AcessoNegado(tuple.Item2); + return; + } + Tuple<bool, bool> tuple2 = await new ConnectionHelper().PrimeiroAcesso(); + if (!tuple2.Item1 || !tuple2.Item2) + { + ((Window)new TutorialView(tuple2)).Show(); + ((Window)this).Close(); + } + else + { + Loading(isLoading: false); + await Access(error: false); + } + } + + private async void TrocarSenha_OnPreviewMouseDown(object sender, MouseButtonEventArgs e) + { + Loading(isLoading: true); + await ViewModel.AbrirTrocaSenha(); + Loading(isLoading: false); + } + + private async void TrocarSenha_OnClick(object sender, RoutedEventArgs e) + { + Loading(isLoading: true); + bool num = await ViewModel.TrocaSenha(); + Loading(isLoading: false); + if (num) + { + await Access(); + } + } + + private void CancelarTrocaSenha_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.TrocaSenhaVisibility = (Visibility)2; + ViewModel.LoginVisibility = (Visibility)0; + } + + private void NovoPerfil_OnPreviewMouseDown(object sender, MouseButtonEventArgs e) + { + ViewModel.AbrirRegistro(); + ViewModel.EnableButtons = true; + } + + private void CancelarRegistro(object sender, RoutedEventArgs e) + { + ViewModel.FecharRegistro(); + } + + private void LinkImage_MouseDown(object sender, MouseButtonEventArgs e) + { + Process.Start(new ProcessStartInfo + { + FileName = ViewModel.ImagemLink, + UseShellExecute = true + }); + } + + private void CentralAtendimento_OnPreviewMouseDown(object sender, MouseButtonEventArgs e) + { + Process.Start(new ProcessStartInfo + { + FileName = ViewModel.CentralAtendimento, + UseShellExecute = true + }); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/loginwindow.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_005e: Unknown result type (might be due to invalid IL or missing references) + //IL_0068: Expected O, but got Unknown + //IL_006b: Unknown result type (might be due to invalid IL or missing references) + //IL_0075: Expected O, but got Unknown + //IL_0078: Unknown result type (might be due to invalid IL or missing references) + //IL_0082: Expected O, but got Unknown + //IL_0092: Unknown result type (might be due to invalid IL or missing references) + //IL_009c: Expected O, but got Unknown + //IL_00a9: Unknown result type (might be due to invalid IL or missing references) + //IL_00b3: Expected O, but got Unknown + //IL_00b5: Unknown result type (might be due to invalid IL or missing references) + //IL_00c1: Unknown result type (might be due to invalid IL or missing references) + //IL_00cb: Expected O, but got Unknown + //IL_00cd: Unknown result type (might be due to invalid IL or missing references) + //IL_00d9: Unknown result type (might be due to invalid IL or missing references) + //IL_00e3: Expected O, but got Unknown + //IL_00ff: Unknown result type (might be due to invalid IL or missing references) + //IL_010b: Unknown result type (might be due to invalid IL or missing references) + //IL_0115: Expected O, but got Unknown + //IL_0117: Unknown result type (might be due to invalid IL or missing references) + //IL_0123: Unknown result type (might be due to invalid IL or missing references) + //IL_012d: Expected O, but got Unknown + //IL_012f: Unknown result type (might be due to invalid IL or missing references) + //IL_013b: Unknown result type (might be due to invalid IL or missing references) + //IL_0145: Expected O, but got Unknown + //IL_0148: Unknown result type (might be due to invalid IL or missing references) + //IL_0152: Expected O, but got Unknown + //IL_0154: Unknown result type (might be due to invalid IL or missing references) + //IL_0160: Unknown result type (might be due to invalid IL or missing references) + //IL_016a: Expected O, but got Unknown + //IL_016c: Unknown result type (might be due to invalid IL or missing references) + //IL_0178: Unknown result type (might be due to invalid IL or missing references) + //IL_0182: Expected O, but got Unknown + //IL_0185: Unknown result type (might be due to invalid IL or missing references) + //IL_018f: Expected O, but got Unknown + //IL_019c: Unknown result type (might be due to invalid IL or missing references) + //IL_01a6: Expected O, but got Unknown + //IL_01b3: Unknown result type (might be due to invalid IL or missing references) + //IL_01bd: Expected O, but got Unknown + //IL_01c0: Unknown result type (might be due to invalid IL or missing references) + //IL_01ca: Expected O, but got Unknown + //IL_01d7: Unknown result type (might be due to invalid IL or missing references) + //IL_01e1: Expected O, but got Unknown + //IL_01ee: Unknown result type (might be due to invalid IL or missing references) + //IL_01f8: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((FrameworkElement)(LoginWindow)target).Loaded += new RoutedEventHandler(LoginWindow_OnLoaded); + break; + case 2: + ProgressRing = (Image)target; + break; + case 3: + UserBox = (TextBox)target; + break; + case 4: + PasswordBox = (CustomSenhaLoginBox)target; + break; + case 5: + TrocaSenha = (TextBlock)target; + ((UIElement)TrocaSenha).PreviewMouseDown += new MouseButtonEventHandler(TrocarSenha_OnPreviewMouseDown); + break; + case 6: + ((ButtonBase)(RepeatButton)target).Click += new RoutedEventHandler(Acessar_Click); + break; + case 7: + ((UIElement)(TextBlock)target).PreviewMouseDown += new MouseButtonEventHandler(NovoPerfil_OnPreviewMouseDown); + break; + case 8: + SenhaBox = (CustomSenhaLoginBox)target; + break; + case 9: + ConfirmacaoBox = (CustomSenhaLoginBox)target; + break; + case 10: + ((ButtonBase)(RepeatButton)target).Click += new RoutedEventHandler(CancelarTrocaSenha_OnClick); + break; + case 11: + ((ButtonBase)(RepeatButton)target).Click += new RoutedEventHandler(TrocarSenha_OnClick); + break; + case 12: + ((UIElement)(TextBlock)target).PreviewMouseDown += new MouseButtonEventHandler(CentralAtendimento_OnPreviewMouseDown); + break; + case 13: + ChaveBox = (TextBox)target; + break; + case 14: + ((ButtonBase)(RepeatButton)target).Click += new RoutedEventHandler(CancelarRegistro); + break; + case 15: + ((ButtonBase)(RepeatButton)target).Click += new RoutedEventHandler(Registrar_OnClick); + break; + case 16: + MinimizeButton = (Grid)target; + ((UIElement)MinimizeButton).MouseLeftButtonDown += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonDown); + ((UIElement)MinimizeButton).MouseLeftButtonUp += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonUp); + break; + case 17: + CloseButton = (Grid)target; + ((UIElement)CloseButton).MouseLeftButtonDown += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonDown); + ((UIElement)CloseButton).MouseLeftButtonUp += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonUp); + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views/TutorialView.cs b/Decompiler/Gestor.Application.Views/TutorialView.cs new file mode 100644 index 0000000..a09e452 --- /dev/null +++ b/Decompiler/Gestor.Application.Views/TutorialView.cs @@ -0,0 +1,395 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Media; +using System.Windows.Shapes; +using System.Windows.Shell; +using System.Windows.Threading; +using Gestor.Application.Componentes; +using Gestor.Application.ViewModels; + +namespace Gestor.Application.Views; + +public class TutorialView : Window, IComponentConnector +{ + public TutorialViewModel ViewModel; + + private bool _buttonClickable; + + internal WindowChrome WindowChrome; + + internal Grid CloseButton; + + internal Grid ProgressRing; + + internal Image ProgressBar; + + internal TextBox NomeBox; + + internal TextBox UserBox; + + internal CustomSenhaLoginBox PasswordBox; + + internal CustomSenhaLoginBox ConfirmacaoBox; + + private bool _contentLoaded; + + private Tuple<bool, bool> PrimeiroAcesso { get; set; } + + public TutorialView(Tuple<bool, bool> primeiroacesso) + { + //IL_0056: Unknown result type (might be due to invalid IL or missing references) + //IL_0060: Expected O, but got Unknown + //IL_006d: Unknown result type (might be due to invalid IL or missing references) + //IL_0077: Expected O, but got Unknown + PrimeiroAcesso = primeiroacesso; + ViewModel = new TutorialViewModel(); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + ((UIElement)CloseButton).MouseEnter += new MouseEventHandler(TopControls_OnMouseEnter); + ((UIElement)CloseButton).MouseLeave += new MouseEventHandler(TopControls_OnMouseLeave); + } + + private async void ContentLoad() + { + string erro2 = null; + Loading(loading: true); + if (PrimeiroAcesso.Item1) + { + await ViewModel.VerificarUsuario(); + } + else + { + erro2 = await ViewModel.CriarBanco(); + } + Loading(loading: false); + if (erro2 != null) + { + await ViewModel.ShowMessage(erro2); + return; + } + erro2 = await ViewModel.VerificaEmpresa(); + if (erro2 != null) + { + await ViewModel.ShowMessage(erro2); + return; + } + ViewModel.Fase1 = true; + await ViewModel.IniciarConfiguracoes(); + } + + protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo) + { + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0025: Unknown result type (might be due to invalid IL or missing references) + //IL_002a: Unknown result type (might be due to invalid IL or missing references) + //IL_0053: Unknown result type (might be due to invalid IL or missing references) + //IL_0058: Unknown result type (might be due to invalid IL or missing references) + //IL_0061: Unknown result type (might be due to invalid IL or missing references) + //IL_0066: Unknown result type (might be due to invalid IL or missing references) + ((FrameworkElement)this).OnRenderSizeChanged(sizeInfo); + Size val; + if (sizeInfo.HeightChanged) + { + double top = ((Window)this).Top; + val = sizeInfo.PreviousSize; + double height = ((Size)(ref val)).Height; + val = sizeInfo.NewSize; + ((Window)this).Top = top + (height - ((Size)(ref val)).Height) / 2.0; + } + if (sizeInfo.WidthChanged) + { + double left = ((Window)this).Left; + val = sizeInfo.PreviousSize; + double width = ((Size)(ref val)).Width; + val = sizeInfo.NewSize; + ((Window)this).Left = left + (width - ((Size)(ref val)).Width) / 2.0; + } + } + + private void TopControls_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + //IL_0008: Unknown result type (might be due to invalid IL or missing references) + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + //IL_0030: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_003f: Expected O, but got Unknown + _buttonClickable = true; + ((Panel)(Grid)sender).Background = (Brush)((((FrameworkElement)(Grid)sender).Name == "CloseButton") ? new SolidColorBrush(Colors.Red) : new SolidColorBrush(Colors.DimGray)); + } + + private void TopControls_OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + if (_buttonClickable) + { + ((object)this).GetType().GetMethod(((FrameworkElement)(Grid)sender).Name + "_Click")?.Invoke(this, null); + } + } + + private static void TopControls_OnMouseEnter(object sender, MouseEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Unknown result type (might be due to invalid IL or missing references) + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_001d: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Unknown result type (might be due to invalid IL or missing references) + //IL_0038: Expected O, but got Unknown + //IL_0039: Unknown result type (might be due to invalid IL or missing references) + //IL_0044: Expected O, but got Unknown + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_0053: Unknown result type (might be due to invalid IL or missing references) + //IL_005d: Expected O, but got Unknown + ((Panel)(Grid)sender).Background = (Brush)((((FrameworkElement)(Grid)sender).Name == "CloseButton") ? new SolidColorBrush(Colors.IndianRed) : new SolidColorBrush(Colors.Gray)); + DependencyObject child = VisualTreeHelper.GetChild((DependencyObject)(Grid)sender, 0); + Path val = (Path)(object)((child is Path) ? child : null); + if (val != null) + { + ((Shape)val).Stroke = (Brush)new SolidColorBrush(Colors.White); + } + } + + private void TopControls_OnMouseLeave(object sender, MouseEventArgs e) + { + //IL_0008: Unknown result type (might be due to invalid IL or missing references) + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Unknown result type (might be due to invalid IL or missing references) + //IL_001c: Expected O, but got Unknown + //IL_001d: Unknown result type (might be due to invalid IL or missing references) + //IL_0028: Expected O, but got Unknown + //IL_0032: Unknown result type (might be due to invalid IL or missing references) + //IL_0037: Unknown result type (might be due to invalid IL or missing references) + //IL_0041: Expected O, but got Unknown + _buttonClickable = false; + ((Panel)(Grid)sender).Background = (Brush)new SolidColorBrush(Colors.Transparent); + DependencyObject child = VisualTreeHelper.GetChild((DependencyObject)(Grid)sender, 0); + Path val = (Path)(object)((child is Path) ? child : null); + if (val != null) + { + ((Shape)val).Stroke = (Brush)new SolidColorBrush(Colors.White); + } + } + + public void CloseButton_Click() + { + ((Window)this).Close(); + } + + private async void ProsseguirFase1_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.EnableFields = false; + Loading(loading: true); + if (!(await ViewModel.ValidarLogin())) + { + ((Window)this).Close(); + } + Loading(loading: false); + ViewModel.EnableFields = true; + } + + private void VoltarFase2_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Fase1 = true; + ViewModel.Fase2 = false; + } + + private async void ProsseguirFase2_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.EnableFields = false; + Loading(loading: true); + await ViewModel.ValidarSeguradoras(); + Loading(loading: false); + ViewModel.EnableFields = true; + } + + private void VoltarFase3_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Fase2 = true; + ViewModel.Fase3 = false; + } + + private void DestativarTodosOsRamos_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.DesativarRamos(); + } + + private void DestativarTodasAsSeguradoras_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.DesativarSeguradoras(); + } + + private async void Concluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.EnableFields = false; + Loading(loading: true); + bool num = await ViewModel.Concluir(); + Loading(loading: false); + ViewModel.EnableFields = true; + if (!num) + { + ((Window)this).Close(); + return; + } + if (!(await ViewModel.VerificaAcesso())) + { + ((Window)this).Close(); + return; + } + ((Window)new MainWindow()).Show(); + ((Window)this).Close(); + } + + private void ConfirmacaoBox_LostFocus(object sender, RoutedEventArgs e) + { + ViewModel.ConfirmacaoSenha = ConfirmacaoBox.Text; + } + + private void PasswordBox_LostFocus(object sender, RoutedEventArgs e) + { + ViewModel.Senha = PasswordBox.Text; + } + + private void Loading(bool loading) + { + if (loading) + { + TutorialViewModel viewModel = ViewModel; + TutorialViewModel viewModel2 = ViewModel; + bool flag2 = (ViewModel.Fase3 = false); + bool fase = (viewModel2.Fase2 = flag2); + viewModel.Fase1 = fase; + } + ViewModel.LoadingVisibility = loading; + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/tutorialview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_004b: Unknown result type (might be due to invalid IL or missing references) + //IL_0055: Expected O, but got Unknown + //IL_0058: Unknown result type (might be due to invalid IL or missing references) + //IL_0062: Expected O, but got Unknown + //IL_006f: Unknown result type (might be due to invalid IL or missing references) + //IL_0079: Expected O, but got Unknown + //IL_0086: Unknown result type (might be due to invalid IL or missing references) + //IL_0090: Expected O, but got Unknown + //IL_0093: Unknown result type (might be due to invalid IL or missing references) + //IL_009d: Expected O, but got Unknown + //IL_00a0: Unknown result type (might be due to invalid IL or missing references) + //IL_00aa: Expected O, but got Unknown + //IL_00ad: Unknown result type (might be due to invalid IL or missing references) + //IL_00b7: Expected O, but got Unknown + //IL_00ba: Unknown result type (might be due to invalid IL or missing references) + //IL_00c4: Expected O, but got Unknown + //IL_00e0: Unknown result type (might be due to invalid IL or missing references) + //IL_00ec: Unknown result type (might be due to invalid IL or missing references) + //IL_00f6: Expected O, but got Unknown + //IL_00f8: Unknown result type (might be due to invalid IL or missing references) + //IL_0104: Unknown result type (might be due to invalid IL or missing references) + //IL_010e: Expected O, but got Unknown + //IL_0110: Unknown result type (might be due to invalid IL or missing references) + //IL_011c: Unknown result type (might be due to invalid IL or missing references) + //IL_0126: Expected O, but got Unknown + //IL_0128: Unknown result type (might be due to invalid IL or missing references) + //IL_0134: Unknown result type (might be due to invalid IL or missing references) + //IL_013e: Expected O, but got Unknown + //IL_0140: Unknown result type (might be due to invalid IL or missing references) + //IL_014c: Unknown result type (might be due to invalid IL or missing references) + //IL_0156: Expected O, but got Unknown + //IL_0158: Unknown result type (might be due to invalid IL or missing references) + //IL_0164: Unknown result type (might be due to invalid IL or missing references) + //IL_016e: Expected O, but got Unknown + //IL_0170: Unknown result type (might be due to invalid IL or missing references) + //IL_017c: Unknown result type (might be due to invalid IL or missing references) + //IL_0186: Expected O, but got Unknown + switch (connectionId) + { + case 1: + WindowChrome = (WindowChrome)target; + break; + case 2: + CloseButton = (Grid)target; + ((UIElement)CloseButton).MouseLeftButtonDown += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonDown); + ((UIElement)CloseButton).MouseLeftButtonUp += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonUp); + break; + case 3: + ProgressRing = (Grid)target; + break; + case 4: + ProgressBar = (Image)target; + break; + case 5: + NomeBox = (TextBox)target; + break; + case 6: + UserBox = (TextBox)target; + break; + case 7: + PasswordBox = (CustomSenhaLoginBox)target; + break; + case 8: + ConfirmacaoBox = (CustomSenhaLoginBox)target; + break; + case 9: + ((ButtonBase)(RepeatButton)target).Click += new RoutedEventHandler(ProsseguirFase1_OnClick); + break; + case 10: + ((ButtonBase)(RepeatButton)target).Click += new RoutedEventHandler(DestativarTodasAsSeguradoras_OnClick); + break; + case 11: + ((ButtonBase)(RepeatButton)target).Click += new RoutedEventHandler(VoltarFase2_OnClick); + break; + case 12: + ((ButtonBase)(RepeatButton)target).Click += new RoutedEventHandler(ProsseguirFase2_OnClick); + break; + case 13: + ((ButtonBase)(RepeatButton)target).Click += new RoutedEventHandler(DestativarTodosOsRamos_OnClick); + break; + case 14: + ((ButtonBase)(RepeatButton)target).Click += new RoutedEventHandler(VoltarFase3_OnClick); + break; + case 15: + ((ButtonBase)(RepeatButton)target).Click += new RoutedEventHandler(Concluir_OnClick); + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.csproj b/Decompiler/Gestor.Application.csproj new file mode 100644 index 0000000..b91e087 --- /dev/null +++ b/Decompiler/Gestor.Application.csproj @@ -0,0 +1,949 @@ +<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop"> + <PropertyGroup> + <AssemblyName>Gestor.Application</AssemblyName> + <GenerateAssemblyInfo>False</GenerateAssemblyInfo> + <OutputType>WinExe</OutputType> + <UseWPF>True</UseWPF> + <TargetFramework>net48</TargetFramework> + <Prefer32Bit>True</Prefer32Bit> + </PropertyGroup> + <PropertyGroup> + <LangVersion>11.0</LangVersion> + <AllowUnsafeBlocks>True</AllowUnsafeBlocks> + </PropertyGroup> + <PropertyGroup> + <ApplicationIcon>app.ico</ApplicationIcon> + <RootNamespace /> + </PropertyGroup> + <ItemGroup> + <None Remove="componentes/dialogextratocomissao.baml" /> + <None Remove="componentes/gridrelatorio.baml" /> + <None Remove="views/seguros/itens/riscosdiversosview.baml" /> + <None Remove="drawers/infodrawer.baml" /> + <None Remove="views/bi/agendabiview.baml" /> + <None Remove="views/ferramentas/empresaview.baml" /> + <None Remove="componentes/custompasswordbox.baml" /> + <None Remove="drawers/inclusaoarquivodigitaldrawer.baml" /> + <None Remove="componentes/webbrowser.baml" /> + <None Remove="views/ferramentas/tipotarefaview.baml" /> + <None Remove="views/relatorios/sinteticoview.baml" /> + <None Remove="assets/images/siggner_logo.png" /> + <None Remove="views/seguros/perfilempresaview.baml" /> + <None Remove="drawers/arquivodigitaldrawer.baml" /> + <None Remove="views/financeiro/infoextratoview.baml" /> + <None Remove="componentes/progressdialog.baml" /> + <None Remove="views/seguros/itens/granizoview.baml" /> + <None Remove="componentes/dialoganexar.baml" /> + <None Remove="componentes/dialogselecionaritens.baml" /> + <None Remove="assets/images/calculoiconoff.png" /> + <None Remove="views/seguros/itens/consorcioview.baml" /> + <None Remove="views/bi/prospeccaoview.baml" /> + <None Remove="drawers/observacoesdrawer.baml" /> + <None Remove="drawers/adiantamentodrawerview.baml" /> + <None Remove="drawers/vinculovendedordrawer.baml" /> + <None Remove="views/bi/acompanhamentoview.baml" /> + <None Remove="assets/images/backgroung_gestor.png" /> + <None Remove="componentes/prospeccaodialog.baml" /> + <None Remove="views/seguros/itens/autoview.baml" /> + <None Remove="drawers/valoresapolicedrawer.baml" /> + <None Remove="componentes/coberturaview.baml" /> + <None Remove="views/ferramentas/etiquetaview.baml" /> + <None Remove="componentes/customlegendchart.baml" /> + <None Remove="componentes/webeditor.baml" /> + <None Remove="assets/images/logo_novo_gestor_branco.png" /> + <None Remove="views/ferramentas/ramoview.baml" /> + <None Remove="views/ferramentas/usuarioview.baml" /> + <None Remove="drawers/agendadrawer.baml" /> + <None Remove="componentes/calculocontrol.baml" /> + <None Remove="componentes/errordialog.baml" /> + <None Remove="componentes/dialogexportarpermissao.baml" /> + <None Remove="componentes/loading.baml" /> + <None Remove="drawers/logdrawer.baml" /> + <None Remove="drawers/metavendedorview.baml" /> + <None Remove="iconesistema.ico" /> + <None Remove="styles/fonts.baml" /> + <None Remove="views/ferramentas/maladiretaview.baml" /> + <None Remove="drawers/permissaousuariodrawer.baml" /> + <None Remove="assets/images/logo_novo_agger.png" /> + <None Remove="assets/images/calculoicon.png" /> + <None Remove="componentes/dialoglogacesso.baml" /> + <None Remove="assets/images/loading.gif" /> + <None Remove="views/financeiro/planoview.baml" /> + <None Remove="views/seguros/itens/vidaview.baml" /> + <None Remove="views/financeiro/bancoscontasview.baml" /> + <None Remove="views/bi/painelbiview.baml" /> + <None Remove="drawers/impostodrawer.baml" /> + <None Remove="componentes/defaultdialog.baml" /> + <None Remove="componentes/dialogcopiarpermissao.baml" /> + <None Remove="componentes/dialogtransferencia.baml" /> + <None Remove="views/ferramentas/seguradoraview.baml" /> + <None Remove="assets/images/playstore.png" /> + <None Remove="componentes/vincularlancamentodialog.baml" /> + <None Remove="views/ferramentas/cadastroemailview.baml" /> + <None Remove="views/seguros/consultaoriginalview.baml" /> + <None Remove="iconesistema2024.ico" /> + <None Remove="views/ferramentas/incluirramoview.baml" /> + <None Remove="views/ferramentas/incluirseguradoraview.baml" /> + <None Remove="views/ferramentas/cadastroparceiroview.baml" /> + <None Remove="drawers/tarefadrawer.baml" /> + <None Remove="componentes/dialogsenhaadm.baml" /> + <None Remove="views/seguros/comissaoview.baml" /> + <None Remove="views/seguros/perfilview.baml" /> + <None Remove="componentes/dialoginstalacoes.baml" /> + <None Remove="componentes/dialogobservacao.baml" /> + <None Remove="componentes/dialoggrafico.baml" /> + <None Remove="views/ferramentas/reciboview.baml" /> + <None Remove="views/financeiro/extratowindow.baml" /> + <None Remove="componentes/dialogreordenaritens.baml" /> + <None Remove="componentes/dialogdetalheextrato.baml" /> + <None Remove="componentes/dialoghoster.baml" /> + <None Remove="views/ferramentas/estipulanteview.baml" /> + <None Remove="assets/images/gestor_loading.gif" /> + <None Remove="views/tutorialview.baml" /> + <None Remove="componentes/dialogenviaremails.baml" /> + <None Remove="drawers/configuracoes/configuracoesdrawer.baml" /> + <None Remove="views/seguros/clienteview.baml" /> + <None Remove="views/ferramentas/produtoview.baml" /> + <None Remove="views/financeiro/centrodecustoview.baml" /> + <None Remove="views/seguros/itens/aeronauticoview.baml" /> + <None Remove="componentes/customsenhaloginbox.baml" /> + <None Remove="componentes/dialogpesquisaavancada.baml" /> + <None Remove="views/ferramentas/statusprospeccaoview.baml" /> + <None Remove="drawers/logsistemaantigo.baml" /> + <None Remove="views/ferramentas/tipovendedorview.baml" /> + <None Remove="views/relatorios/relatorioview.baml" /> + <None Remove="componentes/dialogcopiarcliente.baml" /> + <None Remove="drawers/ajuda/contratosdrawerview.baml" /> + <None Remove="assets/images/aggilizadoricon.png" /> + <None Remove="assets/images/background_novo_gestor.png" /> + <None Remove="componentes/dialogprint.baml" /> + <None Remove="views/financeiro/financeiroview.baml" /> + <None Remove="views/ferramentas/statusview.baml" /> + <None Remove="componentes/dialogtarefa.baml" /> + <None Remove="views/importview.baml" /> + <None Remove="mainwindow.baml" /> + <None Remove="componentes/dialogvinculo.baml" /> + <None Remove="componentes/passbox.baml" /> + <None Remove="views/ferramentas/qualificacaoview.baml" /> + <None Remove="views/menus/dashboardview.baml" /> + <None Remove="views/connectionretryview.baml" /> + <None Remove="views/seguros/itens/buscarmodeloview.baml" /> + <None Remove="drawers/valoresparceladrawer.baml" /> + <None Remove="views/financeiro/planosview.baml" /> + <None Remove="views/seguros/criticaapoliceview.baml" /> + <None Remove="drawers/logutilizacaodrawer.baml" /> + <None Remove="views/ferramentas/manutencaopagamentosview.baml" /> + <None Remove="drawers/extratosdrawer.baml" /> + <None Remove="componentes/dialogeditarparcelas.baml" /> + <None Remove="drawers/relatorios/configuracaorelatorio.baml" /> + <None Remove="assets/images/aggilizadordimgrayicon.png" /> + <None Remove="drawers/logemaildrawer.baml" /> + <None Remove="assets/images/appstore.png" /> + <None Remove="views/financeiro/relatorios/fechamentofinanceiroview.baml" /> + <None Remove="drawers/relatorios/filtrorelatorio.baml" /> + <None Remove="componentes/contasdialog.baml" /> + <None Remove="views/ferramentas/socioview.baml" /> + <None Remove="views/seguros/sinistroview.baml" /> + <None Remove="views/generic/dragoverpopup.baml" /> + <None Remove="drawers/expedicaodrawer.baml" /> + <None Remove="componentes/dialogmedalha.baml" /> + <None Remove="componentes/dialogcopia.baml" /> + <None Remove="views/bi/tarefaview.baml" /> + <None Remove="views/bi/notasview.baml" /> + <None Remove="assets/images/gestor_splash_branco.gif" /> + <None Remove="views/seguros/itens/patrimonialview.baml" /> + <None Remove="views/menus/menuitensview.baml" /> + <None Remove="views/seguros/apoliceview.baml" /> + <None Remove="views/financeiro/fornecedorview.baml" /> + <None Remove="componentes/dialogtrilha.baml" /> + <None Remove="componentes/dialogprotocolo.baml" /> + <None Remove="views/generic/errorwindow.baml" /> + <None Remove="views/ferramentas/notafiscalview.baml" /> + <None Remove="assets/images/calculoiconok.png" /> + <None Remove="styles/buttons.baml" /> + <None Remove="drawers/metaseguradoraview.baml" /> + <None Remove="views/ferramentas/vendedorview.baml" /> + <None Remove="views/seguros/trocarclienteview.baml" /> + <None Remove="views/generic/hosterwindow.baml" /> + <None Remove="views/loginwindow.baml" /> + <None Remove="componentes/dialogadvertising.baml" /> + <None Remove="app.baml" /> + <None Remove="componentes/dialoganaliticobi.baml" /> + <None Remove="styles/colors.baml" /> + <None Remove="drawers/ajuda/boletosnotasdrawerview.baml" /> + <None Remove="views/ferramentas/protocolodocumentosview.baml" /> + <None Remove="drawers/ajuda/instalacaodrawerview.baml" /> + <None Remove="styles/texts.baml" /> + <None Remove="views/ferramentas/downloadwindow.baml" /> + <None Remove="views/ajuda/atendimentosview.baml" /> + <None Remove="Gestor.Application.Migration.Files.20200505_37.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200505_39.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20220929_213-.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20221007_214-.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20221018_215-.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20221028_216.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20221110_217.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20221110_218.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20230208_219.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20230301_220.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20230308_221.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20230502_222.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20230619_223.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20230619_224.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20230705_225.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20230718_226.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20230727_227.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20230807_228-.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20230829_229-.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20231011_230.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20231024_231.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20231031_232.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20240131_233.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20240131_234.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20240322_235.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20240322_236.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20240325_237.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20240415_238.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20240422_239.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20240521_240.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20240522_241.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20240604_242.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20240708_243.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20240722_244.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20240723_245.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20240724_246.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20240729_247.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20240816_248.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20240821_250.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20240821_249.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20240826_251.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20240902_252.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20240919_253.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20241015_254.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20250204_255.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20250210_256.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20250307_257-.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20250314_259-.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20250314_258-.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20250328_260.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20250331_261.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20250401_262-.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20250423_263.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20250424_264.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20250425_265.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20250523_266.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20250625_267.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20250625_268.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20250728_269.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20250815_270.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20250905_271.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20250908_272.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20250909_273.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20250919_274.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20250926_275.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20251002_276.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20251010_277.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20251014_278.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20251030_279.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20220926_212-.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20220817_211.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20220804_210.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20220726_209.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20220608_208.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20220603_207.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20220502_206-.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20220502_205-.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20220429_204.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20220419_203.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20220419_202.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20220413_201.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20220408_200.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20220404_199.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20220404_198.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20220330_197.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20220329_196.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20220325_195.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20220321_194.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20220315_193.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20220307_192.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20220225_191.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20220225_190.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20220131_187.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20220119_186.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20220119_185.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20220112_184.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20220105_183.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20220104_182.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20211230_181.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20211230_180.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20211223_179.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20211104_178.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210916_177.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210916_176.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210910_175.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210825_174.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210825_173.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210823_172.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210820_171.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210819_170.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210722_169.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210708_168-.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210708_167.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210708_166-.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210629_165.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210622_163.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210622_164.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210622_161.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210622_162.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210615_160.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210615_158.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210615_159.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210615_157.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210615_156.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210615_154.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210615_152.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210615_150.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210615_148.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210615_155.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210615_153.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210615_151.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210615_149.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210615_147.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210614_146.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210614_145.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210614_144.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210614_143.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210614_142.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210614_141.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210614_140.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210614_139.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210614_136.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210614_138.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210614_135.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210614_137.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210614_134.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210614_133-.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210610_131.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210610_132.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210610_130.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210610_129.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210610_128.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210610_127.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210610_126.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210610_125.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210610_124.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210610_123.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210607_122.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210525_121.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210524_120.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210512_119.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210510_118.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210426_117.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210415_116.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210415_115-.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210415_114-.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210408_113.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210329_112.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210324_111.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210324_110.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210323_109.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210323_108.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210315_107-.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210315_106.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210309_104.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210309_105.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210302_103.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210302_102.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210302_101.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210301_100.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210217_98.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210217_99.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210209_97.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210118_96.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20201230_94.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20210107_95.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20201210_93.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20201203_92.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20201203_91.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20201201_90.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20201127_89.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20201127_88.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20201127_85.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20201127_86.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20201127_87.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20201127_84.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20201117_83.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20201113_82.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20201112_81.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20201104_80.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20201030_79.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20201028_78.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20201027_77.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20201026_76.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20201015_75.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20201008_74.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20201007_73.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20201007_72.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20201001_71.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200929_70.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200925_69.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200924_68.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200915_67.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200914_66.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200831_65.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200825_64.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200820_63.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200820_61.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200820_62.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200818_60.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200817_59.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200811_58.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200730_57.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200716_56.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200714_55.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200714_54.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200709_53.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200702_52.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200612_51.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200527_49.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200527_50.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200525_48.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200520_47.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200520_46.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200512_43.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200514_44.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200514_45.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200512_41.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200512_42.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200506_40.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200505_38.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200505_36.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200430_35.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200419_33.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200419_34.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200408_31.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200408_32.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200408_30.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200408_29.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200408_28.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200408_27.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200406_25.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200406_26.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200406_24.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200403_23.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200403_22.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200403_21.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200403_18.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200403_19.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200403_20.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200403_17.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200403_16.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200403_10.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200403_11.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200403_12.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200403_13.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200403_14.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200403_15.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200403_09.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200311_08.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200311_07.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200219_06.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200219_05.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200219_03.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200219_02.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200219_01.SQL" /> + <None Remove="Gestor.Application.Migration.Files.20200219_04.SQL" /> + <EmbeddedResource Include="componentes/dialogextratocomissao.baml" LogicalName="componentes/dialogextratocomissao.baml" /> + <EmbeddedResource Include="componentes/gridrelatorio.baml" LogicalName="componentes/gridrelatorio.baml" /> + <EmbeddedResource Include="views/seguros/itens/riscosdiversosview.baml" LogicalName="views/seguros/itens/riscosdiversosview.baml" /> + <EmbeddedResource Include="drawers/infodrawer.baml" LogicalName="drawers/infodrawer.baml" /> + <EmbeddedResource Include="views/bi/agendabiview.baml" LogicalName="views/bi/agendabiview.baml" /> + <EmbeddedResource Include="views/ferramentas/empresaview.baml" LogicalName="views/ferramentas/empresaview.baml" /> + <EmbeddedResource Include="componentes/custompasswordbox.baml" LogicalName="componentes/custompasswordbox.baml" /> + <EmbeddedResource Include="drawers/inclusaoarquivodigitaldrawer.baml" LogicalName="drawers/inclusaoarquivodigitaldrawer.baml" /> + <EmbeddedResource Include="componentes/webbrowser.baml" LogicalName="componentes/webbrowser.baml" /> + <EmbeddedResource Include="views/ferramentas/tipotarefaview.baml" LogicalName="views/ferramentas/tipotarefaview.baml" /> + <EmbeddedResource Include="views/relatorios/sinteticoview.baml" LogicalName="views/relatorios/sinteticoview.baml" /> + <EmbeddedResource Include="assets/images/siggner_logo.png" LogicalName="assets/images/siggner_logo.png" /> + <EmbeddedResource Include="views/seguros/perfilempresaview.baml" LogicalName="views/seguros/perfilempresaview.baml" /> + <EmbeddedResource Include="drawers/arquivodigitaldrawer.baml" LogicalName="drawers/arquivodigitaldrawer.baml" /> + <EmbeddedResource Include="views/financeiro/infoextratoview.baml" LogicalName="views/financeiro/infoextratoview.baml" /> + <EmbeddedResource Include="componentes/progressdialog.baml" LogicalName="componentes/progressdialog.baml" /> + <EmbeddedResource Include="views/seguros/itens/granizoview.baml" LogicalName="views/seguros/itens/granizoview.baml" /> + <EmbeddedResource Include="componentes/dialoganexar.baml" LogicalName="componentes/dialoganexar.baml" /> + <EmbeddedResource Include="componentes/dialogselecionaritens.baml" LogicalName="componentes/dialogselecionaritens.baml" /> + <EmbeddedResource Include="assets/images/calculoiconoff.png" LogicalName="assets/images/calculoiconoff.png" /> + <EmbeddedResource Include="views/seguros/itens/consorcioview.baml" LogicalName="views/seguros/itens/consorcioview.baml" /> + <EmbeddedResource Include="views/bi/prospeccaoview.baml" LogicalName="views/bi/prospeccaoview.baml" /> + <EmbeddedResource Include="drawers/observacoesdrawer.baml" LogicalName="drawers/observacoesdrawer.baml" /> + <EmbeddedResource Include="drawers/adiantamentodrawerview.baml" LogicalName="drawers/adiantamentodrawerview.baml" /> + <EmbeddedResource Include="drawers/vinculovendedordrawer.baml" LogicalName="drawers/vinculovendedordrawer.baml" /> + <EmbeddedResource Include="views/bi/acompanhamentoview.baml" LogicalName="views/bi/acompanhamentoview.baml" /> + <EmbeddedResource Include="assets/images/backgroung_gestor.png" LogicalName="assets/images/backgroung_gestor.png" /> + <EmbeddedResource Include="componentes/prospeccaodialog.baml" LogicalName="componentes/prospeccaodialog.baml" /> + <EmbeddedResource Include="views/seguros/itens/autoview.baml" LogicalName="views/seguros/itens/autoview.baml" /> + <EmbeddedResource Include="drawers/valoresapolicedrawer.baml" LogicalName="drawers/valoresapolicedrawer.baml" /> + <EmbeddedResource Include="componentes/coberturaview.baml" LogicalName="componentes/coberturaview.baml" /> + <EmbeddedResource Include="views/ferramentas/etiquetaview.baml" LogicalName="views/ferramentas/etiquetaview.baml" /> + <EmbeddedResource Include="componentes/customlegendchart.baml" LogicalName="componentes/customlegendchart.baml" /> + <EmbeddedResource Include="componentes/webeditor.baml" LogicalName="componentes/webeditor.baml" /> + <EmbeddedResource Include="assets/images/logo_novo_gestor_branco.png" LogicalName="assets/images/logo_novo_gestor_branco.png" /> + <EmbeddedResource Include="views/ferramentas/ramoview.baml" LogicalName="views/ferramentas/ramoview.baml" /> + <EmbeddedResource Include="views/ferramentas/usuarioview.baml" LogicalName="views/ferramentas/usuarioview.baml" /> + <EmbeddedResource Include="drawers/agendadrawer.baml" LogicalName="drawers/agendadrawer.baml" /> + <EmbeddedResource Include="componentes/calculocontrol.baml" LogicalName="componentes/calculocontrol.baml" /> + <EmbeddedResource Include="componentes/errordialog.baml" LogicalName="componentes/errordialog.baml" /> + <EmbeddedResource Include="componentes/dialogexportarpermissao.baml" LogicalName="componentes/dialogexportarpermissao.baml" /> + <EmbeddedResource Include="componentes/loading.baml" LogicalName="componentes/loading.baml" /> + <EmbeddedResource Include="drawers/logdrawer.baml" LogicalName="drawers/logdrawer.baml" /> + <EmbeddedResource Include="drawers/metavendedorview.baml" LogicalName="drawers/metavendedorview.baml" /> + <EmbeddedResource Include="iconesistema.ico" LogicalName="iconesistema.ico" /> + <EmbeddedResource Include="styles/fonts.baml" LogicalName="styles/fonts.baml" /> + <EmbeddedResource Include="views/ferramentas/maladiretaview.baml" LogicalName="views/ferramentas/maladiretaview.baml" /> + <EmbeddedResource Include="drawers/permissaousuariodrawer.baml" LogicalName="drawers/permissaousuariodrawer.baml" /> + <EmbeddedResource Include="assets/images/logo_novo_agger.png" LogicalName="assets/images/logo_novo_agger.png" /> + <EmbeddedResource Include="assets/images/calculoicon.png" LogicalName="assets/images/calculoicon.png" /> + <EmbeddedResource Include="componentes/dialoglogacesso.baml" LogicalName="componentes/dialoglogacesso.baml" /> + <EmbeddedResource Include="assets/images/loading.gif" LogicalName="assets/images/loading.gif" /> + <EmbeddedResource Include="views/financeiro/planoview.baml" LogicalName="views/financeiro/planoview.baml" /> + <EmbeddedResource Include="views/seguros/itens/vidaview.baml" LogicalName="views/seguros/itens/vidaview.baml" /> + <EmbeddedResource Include="views/financeiro/bancoscontasview.baml" LogicalName="views/financeiro/bancoscontasview.baml" /> + <EmbeddedResource Include="views/bi/painelbiview.baml" LogicalName="views/bi/painelbiview.baml" /> + <EmbeddedResource Include="drawers/impostodrawer.baml" LogicalName="drawers/impostodrawer.baml" /> + <EmbeddedResource Include="componentes/defaultdialog.baml" LogicalName="componentes/defaultdialog.baml" /> + <EmbeddedResource Include="componentes/dialogcopiarpermissao.baml" LogicalName="componentes/dialogcopiarpermissao.baml" /> + <EmbeddedResource Include="componentes/dialogtransferencia.baml" LogicalName="componentes/dialogtransferencia.baml" /> + <EmbeddedResource Include="views/ferramentas/seguradoraview.baml" LogicalName="views/ferramentas/seguradoraview.baml" /> + <EmbeddedResource Include="assets/images/playstore.png" LogicalName="assets/images/playstore.png" /> + <EmbeddedResource Include="componentes/vincularlancamentodialog.baml" LogicalName="componentes/vincularlancamentodialog.baml" /> + <EmbeddedResource Include="views/ferramentas/cadastroemailview.baml" LogicalName="views/ferramentas/cadastroemailview.baml" /> + <EmbeddedResource Include="views/seguros/consultaoriginalview.baml" LogicalName="views/seguros/consultaoriginalview.baml" /> + <EmbeddedResource Include="iconesistema2024.ico" LogicalName="iconesistema2024.ico" /> + <EmbeddedResource Include="views/ferramentas/incluirramoview.baml" LogicalName="views/ferramentas/incluirramoview.baml" /> + <EmbeddedResource Include="views/ferramentas/incluirseguradoraview.baml" LogicalName="views/ferramentas/incluirseguradoraview.baml" /> + <EmbeddedResource Include="views/ferramentas/cadastroparceiroview.baml" LogicalName="views/ferramentas/cadastroparceiroview.baml" /> + <EmbeddedResource Include="drawers/tarefadrawer.baml" LogicalName="drawers/tarefadrawer.baml" /> + <EmbeddedResource Include="componentes/dialogsenhaadm.baml" LogicalName="componentes/dialogsenhaadm.baml" /> + <EmbeddedResource Include="views/seguros/comissaoview.baml" LogicalName="views/seguros/comissaoview.baml" /> + <EmbeddedResource Include="views/seguros/perfilview.baml" LogicalName="views/seguros/perfilview.baml" /> + <EmbeddedResource Include="componentes/dialoginstalacoes.baml" LogicalName="componentes/dialoginstalacoes.baml" /> + <EmbeddedResource Include="componentes/dialogobservacao.baml" LogicalName="componentes/dialogobservacao.baml" /> + <EmbeddedResource Include="componentes/dialoggrafico.baml" LogicalName="componentes/dialoggrafico.baml" /> + <EmbeddedResource Include="views/ferramentas/reciboview.baml" LogicalName="views/ferramentas/reciboview.baml" /> + <EmbeddedResource Include="views/financeiro/extratowindow.baml" LogicalName="views/financeiro/extratowindow.baml" /> + <EmbeddedResource Include="componentes/dialogreordenaritens.baml" LogicalName="componentes/dialogreordenaritens.baml" /> + <EmbeddedResource Include="componentes/dialogdetalheextrato.baml" LogicalName="componentes/dialogdetalheextrato.baml" /> + <EmbeddedResource Include="componentes/dialoghoster.baml" LogicalName="componentes/dialoghoster.baml" /> + <EmbeddedResource Include="views/ferramentas/estipulanteview.baml" LogicalName="views/ferramentas/estipulanteview.baml" /> + <EmbeddedResource Include="assets/images/gestor_loading.gif" LogicalName="assets/images/gestor_loading.gif" /> + <EmbeddedResource Include="views/tutorialview.baml" LogicalName="views/tutorialview.baml" /> + <EmbeddedResource Include="componentes/dialogenviaremails.baml" LogicalName="componentes/dialogenviaremails.baml" /> + <EmbeddedResource Include="drawers/configuracoes/configuracoesdrawer.baml" LogicalName="drawers/configuracoes/configuracoesdrawer.baml" /> + <EmbeddedResource Include="views/seguros/clienteview.baml" LogicalName="views/seguros/clienteview.baml" /> + <EmbeddedResource Include="views/ferramentas/produtoview.baml" LogicalName="views/ferramentas/produtoview.baml" /> + <EmbeddedResource Include="views/financeiro/centrodecustoview.baml" LogicalName="views/financeiro/centrodecustoview.baml" /> + <EmbeddedResource Include="views/seguros/itens/aeronauticoview.baml" LogicalName="views/seguros/itens/aeronauticoview.baml" /> + <EmbeddedResource Include="componentes/customsenhaloginbox.baml" LogicalName="componentes/customsenhaloginbox.baml" /> + <EmbeddedResource Include="componentes/dialogpesquisaavancada.baml" LogicalName="componentes/dialogpesquisaavancada.baml" /> + <EmbeddedResource Include="views/ferramentas/statusprospeccaoview.baml" LogicalName="views/ferramentas/statusprospeccaoview.baml" /> + <EmbeddedResource Include="drawers/logsistemaantigo.baml" LogicalName="drawers/logsistemaantigo.baml" /> + <EmbeddedResource Include="views/ferramentas/tipovendedorview.baml" LogicalName="views/ferramentas/tipovendedorview.baml" /> + <EmbeddedResource Include="views/relatorios/relatorioview.baml" LogicalName="views/relatorios/relatorioview.baml" /> + <EmbeddedResource Include="componentes/dialogcopiarcliente.baml" LogicalName="componentes/dialogcopiarcliente.baml" /> + <EmbeddedResource Include="drawers/ajuda/contratosdrawerview.baml" LogicalName="drawers/ajuda/contratosdrawerview.baml" /> + <EmbeddedResource Include="assets/images/aggilizadoricon.png" LogicalName="assets/images/aggilizadoricon.png" /> + <EmbeddedResource Include="assets/images/background_novo_gestor.png" LogicalName="assets/images/background_novo_gestor.png" /> + <EmbeddedResource Include="componentes/dialogprint.baml" LogicalName="componentes/dialogprint.baml" /> + <EmbeddedResource Include="views/financeiro/financeiroview.baml" LogicalName="views/financeiro/financeiroview.baml" /> + <EmbeddedResource Include="views/ferramentas/statusview.baml" LogicalName="views/ferramentas/statusview.baml" /> + <EmbeddedResource Include="componentes/dialogtarefa.baml" LogicalName="componentes/dialogtarefa.baml" /> + <EmbeddedResource Include="views/importview.baml" LogicalName="views/importview.baml" /> + <EmbeddedResource Include="mainwindow.baml" LogicalName="mainwindow.baml" /> + <EmbeddedResource Include="componentes/dialogvinculo.baml" LogicalName="componentes/dialogvinculo.baml" /> + <EmbeddedResource Include="componentes/passbox.baml" LogicalName="componentes/passbox.baml" /> + <EmbeddedResource Include="views/ferramentas/qualificacaoview.baml" LogicalName="views/ferramentas/qualificacaoview.baml" /> + <EmbeddedResource Include="views/menus/dashboardview.baml" LogicalName="views/menus/dashboardview.baml" /> + <EmbeddedResource Include="views/connectionretryview.baml" LogicalName="views/connectionretryview.baml" /> + <EmbeddedResource Include="views/seguros/itens/buscarmodeloview.baml" LogicalName="views/seguros/itens/buscarmodeloview.baml" /> + <EmbeddedResource Include="drawers/valoresparceladrawer.baml" LogicalName="drawers/valoresparceladrawer.baml" /> + <EmbeddedResource Include="views/financeiro/planosview.baml" LogicalName="views/financeiro/planosview.baml" /> + <EmbeddedResource Include="views/seguros/criticaapoliceview.baml" LogicalName="views/seguros/criticaapoliceview.baml" /> + <EmbeddedResource Include="drawers/logutilizacaodrawer.baml" LogicalName="drawers/logutilizacaodrawer.baml" /> + <EmbeddedResource Include="views/ferramentas/manutencaopagamentosview.baml" LogicalName="views/ferramentas/manutencaopagamentosview.baml" /> + <EmbeddedResource Include="drawers/extratosdrawer.baml" LogicalName="drawers/extratosdrawer.baml" /> + <EmbeddedResource Include="componentes/dialogeditarparcelas.baml" LogicalName="componentes/dialogeditarparcelas.baml" /> + <EmbeddedResource Include="drawers/relatorios/configuracaorelatorio.baml" LogicalName="drawers/relatorios/configuracaorelatorio.baml" /> + <EmbeddedResource Include="assets/images/aggilizadordimgrayicon.png" LogicalName="assets/images/aggilizadordimgrayicon.png" /> + <EmbeddedResource Include="drawers/logemaildrawer.baml" LogicalName="drawers/logemaildrawer.baml" /> + <EmbeddedResource Include="assets/images/appstore.png" LogicalName="assets/images/appstore.png" /> + <EmbeddedResource Include="views/financeiro/relatorios/fechamentofinanceiroview.baml" LogicalName="views/financeiro/relatorios/fechamentofinanceiroview.baml" /> + <EmbeddedResource Include="drawers/relatorios/filtrorelatorio.baml" LogicalName="drawers/relatorios/filtrorelatorio.baml" /> + <EmbeddedResource Include="componentes/contasdialog.baml" LogicalName="componentes/contasdialog.baml" /> + <EmbeddedResource Include="views/ferramentas/socioview.baml" LogicalName="views/ferramentas/socioview.baml" /> + <EmbeddedResource Include="views/seguros/sinistroview.baml" LogicalName="views/seguros/sinistroview.baml" /> + <EmbeddedResource Include="views/generic/dragoverpopup.baml" LogicalName="views/generic/dragoverpopup.baml" /> + <EmbeddedResource Include="drawers/expedicaodrawer.baml" LogicalName="drawers/expedicaodrawer.baml" /> + <EmbeddedResource Include="componentes/dialogmedalha.baml" LogicalName="componentes/dialogmedalha.baml" /> + <EmbeddedResource Include="componentes/dialogcopia.baml" LogicalName="componentes/dialogcopia.baml" /> + <EmbeddedResource Include="views/bi/tarefaview.baml" LogicalName="views/bi/tarefaview.baml" /> + <EmbeddedResource Include="views/bi/notasview.baml" LogicalName="views/bi/notasview.baml" /> + <EmbeddedResource Include="assets/images/gestor_splash_branco.gif" LogicalName="assets/images/gestor_splash_branco.gif" /> + <EmbeddedResource Include="views/seguros/itens/patrimonialview.baml" LogicalName="views/seguros/itens/patrimonialview.baml" /> + <EmbeddedResource Include="views/menus/menuitensview.baml" LogicalName="views/menus/menuitensview.baml" /> + <EmbeddedResource Include="views/seguros/apoliceview.baml" LogicalName="views/seguros/apoliceview.baml" /> + <EmbeddedResource Include="views/financeiro/fornecedorview.baml" LogicalName="views/financeiro/fornecedorview.baml" /> + <EmbeddedResource Include="componentes/dialogtrilha.baml" LogicalName="componentes/dialogtrilha.baml" /> + <EmbeddedResource Include="componentes/dialogprotocolo.baml" LogicalName="componentes/dialogprotocolo.baml" /> + <EmbeddedResource Include="views/generic/errorwindow.baml" LogicalName="views/generic/errorwindow.baml" /> + <EmbeddedResource Include="views/ferramentas/notafiscalview.baml" LogicalName="views/ferramentas/notafiscalview.baml" /> + <EmbeddedResource Include="assets/images/calculoiconok.png" LogicalName="assets/images/calculoiconok.png" /> + <EmbeddedResource Include="styles/buttons.baml" LogicalName="styles/buttons.baml" /> + <EmbeddedResource Include="drawers/metaseguradoraview.baml" LogicalName="drawers/metaseguradoraview.baml" /> + <EmbeddedResource Include="views/ferramentas/vendedorview.baml" LogicalName="views/ferramentas/vendedorview.baml" /> + <EmbeddedResource Include="views/seguros/trocarclienteview.baml" LogicalName="views/seguros/trocarclienteview.baml" /> + <EmbeddedResource Include="views/generic/hosterwindow.baml" LogicalName="views/generic/hosterwindow.baml" /> + <EmbeddedResource Include="views/loginwindow.baml" LogicalName="views/loginwindow.baml" /> + <EmbeddedResource Include="componentes/dialogadvertising.baml" LogicalName="componentes/dialogadvertising.baml" /> + <EmbeddedResource Include="app.baml" LogicalName="app.baml" /> + <EmbeddedResource Include="componentes/dialoganaliticobi.baml" LogicalName="componentes/dialoganaliticobi.baml" /> + <EmbeddedResource Include="styles/colors.baml" LogicalName="styles/colors.baml" /> + <EmbeddedResource Include="drawers/ajuda/boletosnotasdrawerview.baml" LogicalName="drawers/ajuda/boletosnotasdrawerview.baml" /> + <EmbeddedResource Include="views/ferramentas/protocolodocumentosview.baml" LogicalName="views/ferramentas/protocolodocumentosview.baml" /> + <EmbeddedResource Include="drawers/ajuda/instalacaodrawerview.baml" LogicalName="drawers/ajuda/instalacaodrawerview.baml" /> + <EmbeddedResource Include="styles/texts.baml" LogicalName="styles/texts.baml" /> + <EmbeddedResource Include="views/ferramentas/downloadwindow.baml" LogicalName="views/ferramentas/downloadwindow.baml" /> + <EmbeddedResource Include="views/ajuda/atendimentosview.baml" LogicalName="views/ajuda/atendimentosview.baml" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200505_37.SQL" LogicalName="Gestor.Application.Migration.Files.20200505_37.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200505_39.SQL" LogicalName="Gestor.Application.Migration.Files.20200505_39.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20220929_213-.SQL" LogicalName="Gestor.Application.Migration.Files.20220929_213 .SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20221007_214-.SQL" LogicalName="Gestor.Application.Migration.Files.20221007_214 .SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20221018_215-.SQL" LogicalName="Gestor.Application.Migration.Files.20221018_215 .SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20221028_216.SQL" LogicalName="Gestor.Application.Migration.Files.20221028_216.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20221110_217.SQL" LogicalName="Gestor.Application.Migration.Files.20221110_217.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20221110_218.SQL" LogicalName="Gestor.Application.Migration.Files.20221110_218.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20230208_219.SQL" LogicalName="Gestor.Application.Migration.Files.20230208_219.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20230301_220.SQL" LogicalName="Gestor.Application.Migration.Files.20230301_220.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20230308_221.SQL" LogicalName="Gestor.Application.Migration.Files.20230308_221.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20230502_222.SQL" LogicalName="Gestor.Application.Migration.Files.20230502_222.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20230619_223.SQL" LogicalName="Gestor.Application.Migration.Files.20230619_223.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20230619_224.SQL" LogicalName="Gestor.Application.Migration.Files.20230619_224.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20230705_225.SQL" LogicalName="Gestor.Application.Migration.Files.20230705_225.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20230718_226.SQL" LogicalName="Gestor.Application.Migration.Files.20230718_226.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20230727_227.SQL" LogicalName="Gestor.Application.Migration.Files.20230727_227.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20230807_228-.SQL" LogicalName="Gestor.Application.Migration.Files.20230807_228 .SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20230829_229-.SQL" LogicalName="Gestor.Application.Migration.Files.20230829_229 .SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20231011_230.SQL" LogicalName="Gestor.Application.Migration.Files.20231011_230.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20231024_231.SQL" LogicalName="Gestor.Application.Migration.Files.20231024_231.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20231031_232.SQL" LogicalName="Gestor.Application.Migration.Files.20231031_232.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20240131_233.SQL" LogicalName="Gestor.Application.Migration.Files.20240131_233.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20240131_234.SQL" LogicalName="Gestor.Application.Migration.Files.20240131_234.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20240322_235.SQL" LogicalName="Gestor.Application.Migration.Files.20240322_235.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20240322_236.SQL" LogicalName="Gestor.Application.Migration.Files.20240322_236.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20240325_237.SQL" LogicalName="Gestor.Application.Migration.Files.20240325_237.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20240415_238.SQL" LogicalName="Gestor.Application.Migration.Files.20240415_238.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20240422_239.SQL" LogicalName="Gestor.Application.Migration.Files.20240422_239.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20240521_240.SQL" LogicalName="Gestor.Application.Migration.Files.20240521_240.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20240522_241.SQL" LogicalName="Gestor.Application.Migration.Files.20240522_241.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20240604_242.SQL" LogicalName="Gestor.Application.Migration.Files.20240604_242.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20240708_243.SQL" LogicalName="Gestor.Application.Migration.Files.20240708_243.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20240722_244.SQL" LogicalName="Gestor.Application.Migration.Files.20240722_244.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20240723_245.SQL" LogicalName="Gestor.Application.Migration.Files.20240723_245.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20240724_246.SQL" LogicalName="Gestor.Application.Migration.Files.20240724_246.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20240729_247.SQL" LogicalName="Gestor.Application.Migration.Files.20240729_247.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20240816_248.SQL" LogicalName="Gestor.Application.Migration.Files.20240816_248.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20240821_250.SQL" LogicalName="Gestor.Application.Migration.Files.20240821_250.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20240821_249.SQL" LogicalName="Gestor.Application.Migration.Files.20240821_249.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20240826_251.SQL" LogicalName="Gestor.Application.Migration.Files.20240826_251.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20240902_252.SQL" LogicalName="Gestor.Application.Migration.Files.20240902_252.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20240919_253.SQL" LogicalName="Gestor.Application.Migration.Files.20240919_253.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20241015_254.SQL" LogicalName="Gestor.Application.Migration.Files.20241015_254.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20250204_255.SQL" LogicalName="Gestor.Application.Migration.Files.20250204_255.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20250210_256.SQL" LogicalName="Gestor.Application.Migration.Files.20250210_256.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20250307_257-.SQL" LogicalName="Gestor.Application.Migration.Files.20250307_257 .SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20250314_259-.SQL" LogicalName="Gestor.Application.Migration.Files.20250314_259 .SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20250314_258-.SQL" LogicalName="Gestor.Application.Migration.Files.20250314_258 .SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20250328_260.SQL" LogicalName="Gestor.Application.Migration.Files.20250328_260.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20250331_261.SQL" LogicalName="Gestor.Application.Migration.Files.20250331_261.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20250401_262-.SQL" LogicalName="Gestor.Application.Migration.Files.20250401_262 .SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20250423_263.SQL" LogicalName="Gestor.Application.Migration.Files.20250423_263.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20250424_264.SQL" LogicalName="Gestor.Application.Migration.Files.20250424_264.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20250425_265.SQL" LogicalName="Gestor.Application.Migration.Files.20250425_265.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20250523_266.SQL" LogicalName="Gestor.Application.Migration.Files.20250523_266.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20250625_267.SQL" LogicalName="Gestor.Application.Migration.Files.20250625_267.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20250625_268.SQL" LogicalName="Gestor.Application.Migration.Files.20250625_268.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20250728_269.SQL" LogicalName="Gestor.Application.Migration.Files.20250728_269.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20250815_270.SQL" LogicalName="Gestor.Application.Migration.Files.20250815_270.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20250905_271.SQL" LogicalName="Gestor.Application.Migration.Files.20250905_271.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20250908_272.SQL" LogicalName="Gestor.Application.Migration.Files.20250908_272.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20250909_273.SQL" LogicalName="Gestor.Application.Migration.Files.20250909_273.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20250919_274.SQL" LogicalName="Gestor.Application.Migration.Files.20250919_274.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20250926_275.SQL" LogicalName="Gestor.Application.Migration.Files.20250926_275.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20251002_276.SQL" LogicalName="Gestor.Application.Migration.Files.20251002_276.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20251010_277.SQL" LogicalName="Gestor.Application.Migration.Files.20251010_277.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20251014_278.SQL" LogicalName="Gestor.Application.Migration.Files.20251014_278.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20251030_279.SQL" LogicalName="Gestor.Application.Migration.Files.20251030_279.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20220926_212-.SQL" LogicalName="Gestor.Application.Migration.Files.20220926_212 .SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20220817_211.SQL" LogicalName="Gestor.Application.Migration.Files.20220817_211.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20220804_210.SQL" LogicalName="Gestor.Application.Migration.Files.20220804_210.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20220726_209.SQL" LogicalName="Gestor.Application.Migration.Files.20220726_209.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20220608_208.SQL" LogicalName="Gestor.Application.Migration.Files.20220608_208.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20220603_207.SQL" LogicalName="Gestor.Application.Migration.Files.20220603_207.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20220502_206-.SQL" LogicalName="Gestor.Application.Migration.Files.20220502_206 .SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20220502_205-.SQL" LogicalName="Gestor.Application.Migration.Files.20220502_205 .SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20220429_204.SQL" LogicalName="Gestor.Application.Migration.Files.20220429_204.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20220419_203.SQL" LogicalName="Gestor.Application.Migration.Files.20220419_203.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20220419_202.SQL" LogicalName="Gestor.Application.Migration.Files.20220419_202.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20220413_201.SQL" LogicalName="Gestor.Application.Migration.Files.20220413_201.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20220408_200.SQL" LogicalName="Gestor.Application.Migration.Files.20220408_200.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20220404_199.SQL" LogicalName="Gestor.Application.Migration.Files.20220404_199.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20220404_198.SQL" LogicalName="Gestor.Application.Migration.Files.20220404_198.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20220330_197.SQL" LogicalName="Gestor.Application.Migration.Files.20220330_197.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20220329_196.SQL" LogicalName="Gestor.Application.Migration.Files.20220329_196.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20220325_195.SQL" LogicalName="Gestor.Application.Migration.Files.20220325_195.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20220321_194.SQL" LogicalName="Gestor.Application.Migration.Files.20220321_194.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20220315_193.SQL" LogicalName="Gestor.Application.Migration.Files.20220315_193.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20220307_192.SQL" LogicalName="Gestor.Application.Migration.Files.20220307_192.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20220225_191.SQL" LogicalName="Gestor.Application.Migration.Files.20220225_191.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20220225_190.SQL" LogicalName="Gestor.Application.Migration.Files.20220225_190.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20220131_187.SQL" LogicalName="Gestor.Application.Migration.Files.20220131_187.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20220119_186.SQL" LogicalName="Gestor.Application.Migration.Files.20220119_186.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20220119_185.SQL" LogicalName="Gestor.Application.Migration.Files.20220119_185.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20220112_184.SQL" LogicalName="Gestor.Application.Migration.Files.20220112_184.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20220105_183.SQL" LogicalName="Gestor.Application.Migration.Files.20220105_183.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20220104_182.SQL" LogicalName="Gestor.Application.Migration.Files.20220104_182.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20211230_181.SQL" LogicalName="Gestor.Application.Migration.Files.20211230_181.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20211230_180.SQL" LogicalName="Gestor.Application.Migration.Files.20211230_180.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20211223_179.SQL" LogicalName="Gestor.Application.Migration.Files.20211223_179.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20211104_178.SQL" LogicalName="Gestor.Application.Migration.Files.20211104_178.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210916_177.SQL" LogicalName="Gestor.Application.Migration.Files.20210916_177.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210916_176.SQL" LogicalName="Gestor.Application.Migration.Files.20210916_176.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210910_175.SQL" LogicalName="Gestor.Application.Migration.Files.20210910_175.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210825_174.SQL" LogicalName="Gestor.Application.Migration.Files.20210825_174.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210825_173.SQL" LogicalName="Gestor.Application.Migration.Files.20210825_173.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210823_172.SQL" LogicalName="Gestor.Application.Migration.Files.20210823_172.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210820_171.SQL" LogicalName="Gestor.Application.Migration.Files.20210820_171.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210819_170.SQL" LogicalName="Gestor.Application.Migration.Files.20210819_170.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210722_169.SQL" LogicalName="Gestor.Application.Migration.Files.20210722_169.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210708_168-.SQL" LogicalName="Gestor.Application.Migration.Files.20210708_168 .SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210708_167.SQL" LogicalName="Gestor.Application.Migration.Files.20210708_167.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210708_166-.SQL" LogicalName="Gestor.Application.Migration.Files.20210708_166 .SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210629_165.SQL" LogicalName="Gestor.Application.Migration.Files.20210629_165.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210622_163.SQL" LogicalName="Gestor.Application.Migration.Files.20210622_163.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210622_164.SQL" LogicalName="Gestor.Application.Migration.Files.20210622_164.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210622_161.SQL" LogicalName="Gestor.Application.Migration.Files.20210622_161.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210622_162.SQL" LogicalName="Gestor.Application.Migration.Files.20210622_162.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210615_160.SQL" LogicalName="Gestor.Application.Migration.Files.20210615_160.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210615_158.SQL" LogicalName="Gestor.Application.Migration.Files.20210615_158.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210615_159.SQL" LogicalName="Gestor.Application.Migration.Files.20210615_159.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210615_157.SQL" LogicalName="Gestor.Application.Migration.Files.20210615_157.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210615_156.SQL" LogicalName="Gestor.Application.Migration.Files.20210615_156.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210615_154.SQL" LogicalName="Gestor.Application.Migration.Files.20210615_154.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210615_152.SQL" LogicalName="Gestor.Application.Migration.Files.20210615_152.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210615_150.SQL" LogicalName="Gestor.Application.Migration.Files.20210615_150.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210615_148.SQL" LogicalName="Gestor.Application.Migration.Files.20210615_148.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210615_155.SQL" LogicalName="Gestor.Application.Migration.Files.20210615_155.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210615_153.SQL" LogicalName="Gestor.Application.Migration.Files.20210615_153.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210615_151.SQL" LogicalName="Gestor.Application.Migration.Files.20210615_151.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210615_149.SQL" LogicalName="Gestor.Application.Migration.Files.20210615_149.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210615_147.SQL" LogicalName="Gestor.Application.Migration.Files.20210615_147.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210614_146.SQL" LogicalName="Gestor.Application.Migration.Files.20210614_146.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210614_145.SQL" LogicalName="Gestor.Application.Migration.Files.20210614_145.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210614_144.SQL" LogicalName="Gestor.Application.Migration.Files.20210614_144.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210614_143.SQL" LogicalName="Gestor.Application.Migration.Files.20210614_143.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210614_142.SQL" LogicalName="Gestor.Application.Migration.Files.20210614_142.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210614_141.SQL" LogicalName="Gestor.Application.Migration.Files.20210614_141.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210614_140.SQL" LogicalName="Gestor.Application.Migration.Files.20210614_140.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210614_139.SQL" LogicalName="Gestor.Application.Migration.Files.20210614_139.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210614_136.SQL" LogicalName="Gestor.Application.Migration.Files.20210614_136.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210614_138.SQL" LogicalName="Gestor.Application.Migration.Files.20210614_138.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210614_135.SQL" LogicalName="Gestor.Application.Migration.Files.20210614_135.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210614_137.SQL" LogicalName="Gestor.Application.Migration.Files.20210614_137.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210614_134.SQL" LogicalName="Gestor.Application.Migration.Files.20210614_134.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210614_133-.SQL" LogicalName="Gestor.Application.Migration.Files.20210614_133 .SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210610_131.SQL" LogicalName="Gestor.Application.Migration.Files.20210610_131.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210610_132.SQL" LogicalName="Gestor.Application.Migration.Files.20210610_132.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210610_130.SQL" LogicalName="Gestor.Application.Migration.Files.20210610_130.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210610_129.SQL" LogicalName="Gestor.Application.Migration.Files.20210610_129.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210610_128.SQL" LogicalName="Gestor.Application.Migration.Files.20210610_128.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210610_127.SQL" LogicalName="Gestor.Application.Migration.Files.20210610_127.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210610_126.SQL" LogicalName="Gestor.Application.Migration.Files.20210610_126.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210610_125.SQL" LogicalName="Gestor.Application.Migration.Files.20210610_125.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210610_124.SQL" LogicalName="Gestor.Application.Migration.Files.20210610_124.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210610_123.SQL" LogicalName="Gestor.Application.Migration.Files.20210610_123.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210607_122.SQL" LogicalName="Gestor.Application.Migration.Files.20210607_122.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210525_121.SQL" LogicalName="Gestor.Application.Migration.Files.20210525_121.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210524_120.SQL" LogicalName="Gestor.Application.Migration.Files.20210524_120.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210512_119.SQL" LogicalName="Gestor.Application.Migration.Files.20210512_119.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210510_118.SQL" LogicalName="Gestor.Application.Migration.Files.20210510_118.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210426_117.SQL" LogicalName="Gestor.Application.Migration.Files.20210426_117.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210415_116.SQL" LogicalName="Gestor.Application.Migration.Files.20210415_116.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210415_115-.SQL" LogicalName="Gestor.Application.Migration.Files.20210415_115 .SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210415_114-.SQL" LogicalName="Gestor.Application.Migration.Files.20210415_114 .SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210408_113.SQL" LogicalName="Gestor.Application.Migration.Files.20210408_113.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210329_112.SQL" LogicalName="Gestor.Application.Migration.Files.20210329_112.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210324_111.SQL" LogicalName="Gestor.Application.Migration.Files.20210324_111.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210324_110.SQL" LogicalName="Gestor.Application.Migration.Files.20210324_110.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210323_109.SQL" LogicalName="Gestor.Application.Migration.Files.20210323_109.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210323_108.SQL" LogicalName="Gestor.Application.Migration.Files.20210323_108.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210315_107-.SQL" LogicalName="Gestor.Application.Migration.Files.20210315_107 .SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210315_106.SQL" LogicalName="Gestor.Application.Migration.Files.20210315_106.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210309_104.SQL" LogicalName="Gestor.Application.Migration.Files.20210309_104.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210309_105.SQL" LogicalName="Gestor.Application.Migration.Files.20210309_105.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210302_103.SQL" LogicalName="Gestor.Application.Migration.Files.20210302_103.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210302_102.SQL" LogicalName="Gestor.Application.Migration.Files.20210302_102.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210302_101.SQL" LogicalName="Gestor.Application.Migration.Files.20210302_101.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210301_100.SQL" LogicalName="Gestor.Application.Migration.Files.20210301_100.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210217_98.SQL" LogicalName="Gestor.Application.Migration.Files.20210217_98.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210217_99.SQL" LogicalName="Gestor.Application.Migration.Files.20210217_99.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210209_97.SQL" LogicalName="Gestor.Application.Migration.Files.20210209_97.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210118_96.SQL" LogicalName="Gestor.Application.Migration.Files.20210118_96.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20201230_94.SQL" LogicalName="Gestor.Application.Migration.Files.20201230_94.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20210107_95.SQL" LogicalName="Gestor.Application.Migration.Files.20210107_95.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20201210_93.SQL" LogicalName="Gestor.Application.Migration.Files.20201210_93.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20201203_92.SQL" LogicalName="Gestor.Application.Migration.Files.20201203_92.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20201203_91.SQL" LogicalName="Gestor.Application.Migration.Files.20201203_91.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20201201_90.SQL" LogicalName="Gestor.Application.Migration.Files.20201201_90.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20201127_89.SQL" LogicalName="Gestor.Application.Migration.Files.20201127_89.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20201127_88.SQL" LogicalName="Gestor.Application.Migration.Files.20201127_88.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20201127_85.SQL" LogicalName="Gestor.Application.Migration.Files.20201127_85.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20201127_86.SQL" LogicalName="Gestor.Application.Migration.Files.20201127_86.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20201127_87.SQL" LogicalName="Gestor.Application.Migration.Files.20201127_87.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20201127_84.SQL" LogicalName="Gestor.Application.Migration.Files.20201127_84.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20201117_83.SQL" LogicalName="Gestor.Application.Migration.Files.20201117_83.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20201113_82.SQL" LogicalName="Gestor.Application.Migration.Files.20201113_82.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20201112_81.SQL" LogicalName="Gestor.Application.Migration.Files.20201112_81.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20201104_80.SQL" LogicalName="Gestor.Application.Migration.Files.20201104_80.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20201030_79.SQL" LogicalName="Gestor.Application.Migration.Files.20201030_79.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20201028_78.SQL" LogicalName="Gestor.Application.Migration.Files.20201028_78.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20201027_77.SQL" LogicalName="Gestor.Application.Migration.Files.20201027_77.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20201026_76.SQL" LogicalName="Gestor.Application.Migration.Files.20201026_76.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20201015_75.SQL" LogicalName="Gestor.Application.Migration.Files.20201015_75.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20201008_74.SQL" LogicalName="Gestor.Application.Migration.Files.20201008_74.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20201007_73.SQL" LogicalName="Gestor.Application.Migration.Files.20201007_73.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20201007_72.SQL" LogicalName="Gestor.Application.Migration.Files.20201007_72.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20201001_71.SQL" LogicalName="Gestor.Application.Migration.Files.20201001_71.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200929_70.SQL" LogicalName="Gestor.Application.Migration.Files.20200929_70.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200925_69.SQL" LogicalName="Gestor.Application.Migration.Files.20200925_69.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200924_68.SQL" LogicalName="Gestor.Application.Migration.Files.20200924_68.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200915_67.SQL" LogicalName="Gestor.Application.Migration.Files.20200915_67.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200914_66.SQL" LogicalName="Gestor.Application.Migration.Files.20200914_66.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200831_65.SQL" LogicalName="Gestor.Application.Migration.Files.20200831_65.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200825_64.SQL" LogicalName="Gestor.Application.Migration.Files.20200825_64.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200820_63.SQL" LogicalName="Gestor.Application.Migration.Files.20200820_63.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200820_61.SQL" LogicalName="Gestor.Application.Migration.Files.20200820_61.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200820_62.SQL" LogicalName="Gestor.Application.Migration.Files.20200820_62.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200818_60.SQL" LogicalName="Gestor.Application.Migration.Files.20200818_60.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200817_59.SQL" LogicalName="Gestor.Application.Migration.Files.20200817_59.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200811_58.SQL" LogicalName="Gestor.Application.Migration.Files.20200811_58.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200730_57.SQL" LogicalName="Gestor.Application.Migration.Files.20200730_57.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200716_56.SQL" LogicalName="Gestor.Application.Migration.Files.20200716_56.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200714_55.SQL" LogicalName="Gestor.Application.Migration.Files.20200714_55.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200714_54.SQL" LogicalName="Gestor.Application.Migration.Files.20200714_54.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200709_53.SQL" LogicalName="Gestor.Application.Migration.Files.20200709_53.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200702_52.SQL" LogicalName="Gestor.Application.Migration.Files.20200702_52.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200612_51.SQL" LogicalName="Gestor.Application.Migration.Files.20200612_51.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200527_49.SQL" LogicalName="Gestor.Application.Migration.Files.20200527_49.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200527_50.SQL" LogicalName="Gestor.Application.Migration.Files.20200527_50.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200525_48.SQL" LogicalName="Gestor.Application.Migration.Files.20200525_48.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200520_47.SQL" LogicalName="Gestor.Application.Migration.Files.20200520_47.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200520_46.SQL" LogicalName="Gestor.Application.Migration.Files.20200520_46.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200512_43.SQL" LogicalName="Gestor.Application.Migration.Files.20200512_43.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200514_44.SQL" LogicalName="Gestor.Application.Migration.Files.20200514_44.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200514_45.SQL" LogicalName="Gestor.Application.Migration.Files.20200514_45.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200512_41.SQL" LogicalName="Gestor.Application.Migration.Files.20200512_41.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200512_42.SQL" LogicalName="Gestor.Application.Migration.Files.20200512_42.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200506_40.SQL" LogicalName="Gestor.Application.Migration.Files.20200506_40.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200505_38.SQL" LogicalName="Gestor.Application.Migration.Files.20200505_38.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200505_36.SQL" LogicalName="Gestor.Application.Migration.Files.20200505_36.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200430_35.SQL" LogicalName="Gestor.Application.Migration.Files.20200430_35.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200419_33.SQL" LogicalName="Gestor.Application.Migration.Files.20200419_33.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200419_34.SQL" LogicalName="Gestor.Application.Migration.Files.20200419_34.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200408_31.SQL" LogicalName="Gestor.Application.Migration.Files.20200408_31.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200408_32.SQL" LogicalName="Gestor.Application.Migration.Files.20200408_32.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200408_30.SQL" LogicalName="Gestor.Application.Migration.Files.20200408_30.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200408_29.SQL" LogicalName="Gestor.Application.Migration.Files.20200408_29.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200408_28.SQL" LogicalName="Gestor.Application.Migration.Files.20200408_28.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200408_27.SQL" LogicalName="Gestor.Application.Migration.Files.20200408_27.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200406_25.SQL" LogicalName="Gestor.Application.Migration.Files.20200406_25.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200406_26.SQL" LogicalName="Gestor.Application.Migration.Files.20200406_26.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200406_24.SQL" LogicalName="Gestor.Application.Migration.Files.20200406_24.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200403_23.SQL" LogicalName="Gestor.Application.Migration.Files.20200403_23.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200403_22.SQL" LogicalName="Gestor.Application.Migration.Files.20200403_22.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200403_21.SQL" LogicalName="Gestor.Application.Migration.Files.20200403_21.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200403_18.SQL" LogicalName="Gestor.Application.Migration.Files.20200403_18.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200403_19.SQL" LogicalName="Gestor.Application.Migration.Files.20200403_19.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200403_20.SQL" LogicalName="Gestor.Application.Migration.Files.20200403_20.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200403_17.SQL" LogicalName="Gestor.Application.Migration.Files.20200403_17.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200403_16.SQL" LogicalName="Gestor.Application.Migration.Files.20200403_16.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200403_10.SQL" LogicalName="Gestor.Application.Migration.Files.20200403_10.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200403_11.SQL" LogicalName="Gestor.Application.Migration.Files.20200403_11.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200403_12.SQL" LogicalName="Gestor.Application.Migration.Files.20200403_12.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200403_13.SQL" LogicalName="Gestor.Application.Migration.Files.20200403_13.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200403_14.SQL" LogicalName="Gestor.Application.Migration.Files.20200403_14.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200403_15.SQL" LogicalName="Gestor.Application.Migration.Files.20200403_15.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200403_09.SQL" LogicalName="Gestor.Application.Migration.Files.20200403_09.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200311_08.SQL" LogicalName="Gestor.Application.Migration.Files.20200311_08.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200311_07.SQL" LogicalName="Gestor.Application.Migration.Files.20200311_07.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200219_06.SQL" LogicalName="Gestor.Application.Migration.Files.20200219_06.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200219_05.SQL" LogicalName="Gestor.Application.Migration.Files.20200219_05.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200219_03.SQL" LogicalName="Gestor.Application.Migration.Files.20200219_03.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200219_02.SQL" LogicalName="Gestor.Application.Migration.Files.20200219_02.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200219_01.SQL" LogicalName="Gestor.Application.Migration.Files.20200219_01.SQL" /> + <EmbeddedResource Include="Gestor.Application.Migration.Files.20200219_04.SQL" LogicalName="Gestor.Application.Migration.Files.20200219_04.SQL" /> + </ItemGroup> + <ItemGroup> + <Reference Include="PresentationCore" /> + <Reference Include="WindowsBase"> + <HintPath>../../../../usr/share/dotnet/shared/Microsoft.NETCore.App/6.0.25/WindowsBase.dll</HintPath> + </Reference> + <Reference Include="MaterialDesignThemes.Wpf" /> + <Reference Include="Gestor.Model" /> + <Reference Include="Gestor.Infrastructure" /> + <Reference Include="Agger.Application.Menu" /> + <Reference Include="System.Windows.Controls.Input.Toolkit" /> + <Reference Include="Assinador.Model" /> + <Reference Include="Gestor.Common" /> + <Reference Include="QRCoder" /> + <Reference Include="System.Net.Http" /> + <Reference Include="Newtonsoft.Json" /> + <Reference Include="CurrencyTextbox" /> + <Reference Include="Xceed.Wpf.Toolkit" /> + <Reference Include="System.Core"> + <HintPath>../../../../usr/share/dotnet/shared/Microsoft.NETCore.App/6.0.25/System.Core.dll</HintPath> + </Reference> + <Reference Include="ClosedXML" /> + <Reference Include="System.Data"> + <HintPath>../../../../usr/share/dotnet/shared/Microsoft.NETCore.App/6.0.25/System.Data.dll</HintPath> + </Reference> + <Reference Include="LiveCharts" /> + <Reference Include="LiveCharts.Wpf" /> + <Reference Include="OfxSharpLib" /> + <Reference Include="System.IO.Compression" /> + <Reference Include="Assinador.Infrastructure" /> + <Reference Include="Assinador" /> + <Reference Include="ArquivoDigital.Infrastructure" /> + <Reference Include="Agger.Registro" /> + <Reference Include="HtmlAgilityPack" /> + <Reference Include="MimeKit" /> + <Reference Include="Google.Apis.Auth" /> + <Reference Include="Google.Apis.Gmail.v1" /> + <Reference Include="Microsoft.Identity.Client" /> + <Reference Include="NReco.PdfGenerator" /> + <Reference Include="Xceed.Wpf.AvalonDock" /> + <Reference Include="CsQuery" /> + <Reference Include="System.Data.DataSetExtensions"> + <HintPath>../../../../usr/share/dotnet/shared/Microsoft.NETCore.App/6.0.25/System.Data.DataSetExtensions.dll</HintPath> + </Reference> + <Reference Include="System.IO.Compression.FileSystem"> + <HintPath>../../../../usr/share/dotnet/shared/Microsoft.NETCore.App/6.0.25/System.IO.Compression.FileSystem.dll</HintPath> + </Reference> + <Reference Include="Microsoft.CSharp"> + <HintPath>../../../../usr/share/dotnet/shared/Microsoft.NETCore.App/6.0.25/Microsoft.CSharp.dll</HintPath> + </Reference> + <Reference Include="System.Web"> + <HintPath>../../../../usr/share/dotnet/shared/Microsoft.NETCore.App/6.0.25/System.Web.dll</HintPath> + </Reference> + <Reference Include="Google.Apis.Core" /> + <Reference Include="Google.Apis" /> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/Decompiler/Gestor.Application/App.cs b/Decompiler/Gestor.Application/App.cs new file mode 100644 index 0000000..500ff9e --- /dev/null +++ b/Decompiler/Gestor.Application/App.cs @@ -0,0 +1,241 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Globalization; +using System.Linq; +using System.Net; +using System.Runtime.InteropServices; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Forms; +using System.Windows.Markup; +using System.Windows.Threading; +using Agger.Registro; +using Gestor.Application.Helpers; +using Gestor.Application.Views; +using Gestor.Common.Validation; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using MaterialDesignThemes.Wpf; +using Xceed.Wpf.AvalonDock.Controls; + +namespace Gestor.Application; + +[Serializable] +public class App : Application, IStyleConnector +{ + private bool _contentLoaded; + + public static Grid ProgressRing { get; set; } + + public static Snackbar SnackBar { get; set; } + + protected override void OnStartup(StartupEventArgs e) + { + //IL_00bd: Unknown result type (might be due to invalid IL or missing references) + SetLanguage(); + RegisterLogException(); + Instancia.App = this; + Recursos.Parametros = e.Args.ToList(); + Recursos.Registrar = Recursos.Parametros.Find((string x) => x.Contains("REGISTRAR_"))?.Replace("REGISTRAR_", ""); + if (!string.IsNullOrWhiteSpace(Recursos.Registrar)) + { + Recursos.Parametros.Remove(Recursos.Parametros.Find((string x) => x.Contains("REGISTRAR_"))); + } + if (Recursos.Parametros.Count > 2) + { + ApplicationHelper.Subkey = (new RegistryHelper(Recursos.Parametros[2]).Registrado ? Recursos.Parametros[2] : string.Empty); + } + Recursos.Host = Dns.GetHostEntry(Dns.GetHostName()); + ApplicationHelper.Conectado = Recursos.Parametros.Contains("CONECTADO"); + if (Recursos.Parametros.Contains("INICIAR")) + { + ((Application)this).StartupUri = new Uri("pack://application:,,,/Views/LoginWindow.xaml"); + ((Application)this).OnStartup(e); + } + } + + private void RegisterLogException() + { + //IL_001e: Unknown result type (might be due to invalid IL or missing references) + //IL_0028: Expected O, but got Unknown + AppDomain.CurrentDomain.UnhandledException += delegate(object s, UnhandledExceptionEventArgs exception) + { + Registrar((Exception)exception.ExceptionObject, (TipoErro)1000); + }; + ((Application)this).DispatcherUnhandledException += (DispatcherUnhandledExceptionEventHandler)delegate(object s, DispatcherUnhandledExceptionEventArgs exception) + { + DispatcherUnhandled(exception); + }; + TaskScheduler.UnobservedTaskException += delegate(object s, UnobservedTaskExceptionEventArgs exception) + { + Registrar(exception.Exception, (TipoErro)1000); + }; + } + + private void DispatcherUnhandled(DispatcherUnhandledExceptionEventArgs exception) + { + Registrar(exception.Exception, (TipoErro)1000); + if (exception.Exception is COMException { ErrorCode: -2147221040 }) + { + exception.Handled = true; + } + Instancia.ExcluirCfg(); + } + + private void Registrar(Exception e, TipoErro erro) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0010: Unknown result type (might be due to invalid IL or missing references) + //IL_0027: Unknown result type (might be due to invalid IL or missing references) + //IL_003e: Unknown result type (might be due to invalid IL or missing references) + //IL_0056: Unknown result type (might be due to invalid IL or missing references) + //IL_0066: Unknown result type (might be due to invalid IL or missing references) + //IL_0071: Unknown result type (might be due to invalid IL or missing references) + //IL_0072: Unknown result type (might be due to invalid IL or missing references) + //IL_0078: Expected I4, but got Unknown + //IL_0078: Unknown result type (might be due to invalid IL or missing references) + //IL_0079: Unknown result type (might be due to invalid IL or missing references) + //IL_0089: Unknown result type (might be due to invalid IL or missing references) + //IL_0095: Unknown result type (might be due to invalid IL or missing references) + //IL_00b3: Unknown result type (might be due to invalid IL or missing references) + //IL_00bf: Unknown result type (might be due to invalid IL or missing references) + //IL_00cb: Unknown result type (might be due to invalid IL or missing references) + //IL_00d7: Unknown result type (might be due to invalid IL or missing references) + //IL_00e3: Unknown result type (might be due to invalid IL or missing references) + //IL_00ee: Unknown result type (might be due to invalid IL or missing references) + //IL_00ff: Expected O, but got Unknown + LogError val = new LogError + { + IdFornecedor = ApplicationHelper.IdFornecedor + }; + Empresa empresa = Recursos.Empresa; + val.Fornecedor = ((empresa != null) ? empresa.Nome : null); + Usuario usuario = Recursos.Usuario; + val.UsuarioLogado = ((usuario != null) ? usuario.Nome : null); + Usuario usuario2 = Recursos.Usuario; + val.IdUsuarioLogado = ((usuario2 != null) ? ((DomainBase)usuario2).Id : 0); + val.Versao = ApplicationHelper.Versao.ToString(); + val.Data = Funcoes.GetNetworkTime(); + val.IdErro = (int)erro; + val.Erro = ValidationHelper.GetDescription((Enum)(object)erro); + val.HResult = e.HResult; + val.InnerException = e?.InnerException?.ToString(); + val.HelpLink = e.HelpLink; + val.Message = e.Message; + val.Source = e.Source; + val.StackTrace = e.StackTrace; + val.Maquina = Environment.MachineName; + val.UsuarioMaquina = Environment.UserName; + Erro.RegistrarErro(val); + } + + private static void SetLanguage() + { + //IL_0025: Unknown result type (might be due to invalid IL or missing references) + //IL_002f: Expected O, but got Unknown + XmlLanguage language = XmlLanguage.GetLanguage(CultureInfo.GetCultureInfo("pt-BR").IetfLanguageTag); + FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), (PropertyMetadata)new FrameworkPropertyMetadata((object)language)); + } + + public void Restart() + { + Application.Restart(); + Application.Current.Shutdown(); + } + + public void Close() + { + Application.Current.Shutdown(); + } + + public Task<UnitOfWork> ConnectionRetry() + { + return ((DispatcherObject)this).Dispatcher.Invoke<Task<UnitOfWork>>((Func<Task<UnitOfWork>>)async delegate + { + ConnectionRetryView connectionRetryView = ViewHelper.Window<ConnectionRetryView>(); + if (connectionRetryView != null) + { + await connectionRetryView.CloseTask.Task; + return Instancia.Commited; + } + ConnectionRetryView connectionRetryView2 = new ConnectionRetryView(); + ((Window)connectionRetryView2).ShowDialog(); + return connectionRetryView2.UnitOfWOrk; + }); + } + + public void CloseToolTip_Click(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_000b: Expected O, but got Unknown + ToolTip val = Extentions.FindVisualAncestor<ToolTip>((DependencyObject)(Button)sender); + if (val != null) + { + val.IsOpen = false; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/app.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_001a: Unknown result type (might be due to invalid IL or missing references) + //IL_0026: Unknown result type (might be due to invalid IL or missing references) + //IL_0030: Expected O, but got Unknown + //IL_0032: Unknown result type (might be due to invalid IL or missing references) + //IL_003e: Unknown result type (might be due to invalid IL or missing references) + //IL_0048: Expected O, but got Unknown + //IL_004a: Unknown result type (might be due to invalid IL or missing references) + //IL_0056: Unknown result type (might be due to invalid IL or missing references) + //IL_0060: Expected O, but got Unknown + //IL_0062: Unknown result type (might be due to invalid IL or missing references) + //IL_006e: Unknown result type (might be due to invalid IL or missing references) + //IL_0078: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(CloseToolTip_Click); + break; + case 2: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(CloseToolTip_Click); + break; + case 3: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(CloseToolTip_Click); + break; + case 4: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(CloseToolTip_Click); + break; + } + } + + [STAThread] + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public static void Main() + { + App app = new App(); + app.InitializeComponent(); + ((Application)app).Run(); + } +} diff --git a/Decompiler/Gestor.Application/MainWindow.cs b/Decompiler/Gestor.Application/MainWindow.cs new file mode 100644 index 0000000..0887959 --- /dev/null +++ b/Decompiler/Gestor.Application/MainWindow.cs @@ -0,0 +1,2788 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Drawing; +using System.Drawing.Imaging; +using System.IO; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Net.Sockets; +using System.Runtime.InteropServices; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Forms; +using System.Windows.Input; +using System.Windows.Interop; +using System.Windows.Markup; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; +using System.Windows.Shell; +using System.Windows.Threading; +using Agger.Application.Menu; +using Agger.Registro; +using Assinador.Model.Common; +using Gestor.Application.Actions; +using Gestor.Application.Componentes; +using Gestor.Application.Drawers; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.Servicos.Ferramentas; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.ViewModels; +using Gestor.Application.ViewModels.Seguros; +using Gestor.Application.Views.BI; +using Gestor.Application.Views.Ferramentas; +using Gestor.Application.Views.Financeiro; +using Gestor.Application.Views.Financeiro.Relatorios; +using Gestor.Application.Views.Generic; +using Gestor.Application.Views.Menus; +using Gestor.Application.Views.Relatorios; +using Gestor.Application.Views.Seguros; +using Gestor.Common.Helpers; +using Gestor.Common.Security; +using Gestor.Common.Validation; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.License; +using MaterialDesignThemes.Wpf; +using QRCoder; + +namespace Gestor.Application; + +public class MainWindow : Window, IComponentConnector, IStyleConnector +{ + private enum MonitorOptions : uint + { + MonitorDefaulttoprimary = 1u, + MonitorDefaulttonearest + } + + public struct Point + { + public int X; + + public int Y; + + public Point(int x, int y) + { + X = x; + Y = y; + } + } + + private struct Minmaxinfo + { + private readonly Point ptReserved; + + public Point ptMaxSize; + + public Point ptMaxPosition; + + private readonly Point ptMinTrackSize; + + private readonly Point ptMaxTrackSize; + } + + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] + private class Monitorinfo + { + private readonly int cbSize = Marshal.SizeOf(typeof(Monitorinfo)); + + public readonly Rect rcMonitor; + + public readonly Rect rcWork; + + private readonly int dwFlags; + } + + public struct Rect + { + public int Left; + + public int Top; + + public int Right; + + public int Bottom; + } + + internal MainViewModel ViewModel; + + private bool _buttonClickable; + + private string _lastSearch; + + private DateTime? lastSearchTime; + + private TextBox _textBox; + + internal WindowChrome WindowChrome; + + internal Grid MinimizeButton; + + internal Grid MaximizeButton; + + internal Grid CloseButton; + + internal HamburgerMenu MainMenu; + + internal HamburgerMenuItem CentralDeNegociosMenu; + + internal HamburgerMenuItem DashBoard; + + internal HamburgerMenuItem PainelBi; + + internal HamburgerMenuItem Prospeccao; + + internal HamburgerMenuItem SegurosMenu; + + internal HamburgerMenuItem Consulta; + + internal HamburgerMenuItem Clientes; + + internal HamburgerMenuItem Apolices; + + internal HamburgerMenuItem Itens; + + internal HamburgerMenuItem Sinistros; + + internal HamburgerMenuItem ImportPdf; + + internal HamburgerMenuItem CriticaPdf; + + internal HamburgerMenuItem Comissao; + + internal HamburgerMenuItem RelatoriosMenu; + + internal HamburgerMenuItem RelatoriosCliente; + + internal HamburgerMenuItem RelatoriosDocumentos; + + internal HamburgerMenuItem RelatoriosParcelas; + + internal HamburgerMenuItem RelatoriosSinistros; + + internal HamburgerMenuItem RelatoriosFechamento; + + internal HamburgerMenuItem RelatoriosExtrato; + + internal HamburgerMenuItem RelatoriosNotas; + + internal HamburgerMenuItem RelatoriosTarefas; + + internal HamburgerMenuItem RelatoriosLogs; + + internal HamburgerMenuItem ExtratoConta; + + internal HamburgerMenuItem FechamentoFinanceiro; + + internal HamburgerMenuItem Assinatura; + + internal HamburgerMenuItem Aggilizador; + + internal HamburgerMenuItem Epic; + + internal HamburgerMenuItem FinanceiroMenu; + + internal HamburgerMenuItem Conta; + + internal HamburgerMenuItem Centro; + + internal HamburgerMenuItem Fornecedor; + + internal HamburgerMenuItem Plano; + + internal HamburgerMenuItem FerramentasMenu; + + internal HamburgerMenuItem Emails; + + internal HamburgerMenuItem Empresa; + + internal HamburgerMenuItem Estipulantes; + + internal HamburgerMenuItem ManutencaoPagamentos; + + internal HamburgerMenuItem NotaFiscal; + + internal HamburgerMenuItem Parceiro; + + internal HamburgerMenuItem Produtos; + + internal HamburgerMenuItem Qualificacao; + + internal HamburgerMenuItem Ramos; + + internal HamburgerMenuItem Recibo; + + internal HamburgerMenuItem Seguradoras; + + internal HamburgerMenuItem Socio; + + internal HamburgerMenuItem Statuses; + + internal HamburgerMenuItem StatusProspeccao; + + internal HamburgerMenuItem TipoTarefa; + + internal HamburgerMenuItem TipoVendedor; + + internal HamburgerMenuItem Usuarios; + + internal HamburgerMenuItem Vendedores; + + internal RowDefinition Area; + + internal ComboBox Status; + + internal ComboBox FiltroClienteTipoBox; + + internal AutoCompleteBox PesquisaCliente; + + internal AutoCompleteBox PesquisaClienteNome; + + internal Loading LoadingAutoComplete; + + internal TextBox DocumentoPrincipalBox; + + internal Button ObservacaoApolice; + + internal MenuItem PesquisaAvancada; + + internal MenuItem Voltar; + + internal ContentControl ContentControl; + + internal PopupBox QrCode; + + internal Image ImageAppStore; + + internal Image ImageGooglePlay; + + internal TextBlock SessionNumber; + + internal PopupBox BoletoPopup; + + internal PopupBox HelpPopup; + + internal StackPanel TarefaPopup; + + internal Snackbar Snackbar; + + internal Grid ProgressRing; + + internal DrawerHost DrawerHost; + + private bool _contentLoaded; + + public static WindowState ApplicationState { get; set; } + + private ManutencaoItem ManutencaoItem { get; set; } + + private AcessoApolice Acesso { get; set; } + + private string PipeName { get; set; } + + public object _lastCustomer { get; set; } + + private Key? lastKey { get; set; } + + private string lastSearch + { + get + { + return _lastSearch; + } + set + { + _lastSearch = value; + lastSearchTime = DateTime.Now; + } + } + + private IntPtr WindowProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) + { + if (msg == 36) + { + WmGetMinMaxInfo(lParam); + } + return IntPtr.Zero; + } + + private void WmGetMinMaxInfo(IntPtr lParam) + { + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + ((FrameworkElement)this).MaxHeight = Screen.FromHandle(new WindowInteropHelper((Window)(object)this).Handle).WorkingArea.Height; + GetCursorPos(out var lpPoint); + IntPtr hMonitor = MonitorFromPoint(new Point(0, 0), MonitorOptions.MonitorDefaulttoprimary); + Monitorinfo monitorinfo = new Monitorinfo(); + if (GetMonitorInfo(hMonitor, monitorinfo)) + { + IntPtr intPtr = MonitorFromPoint(lpPoint, MonitorOptions.MonitorDefaulttonearest); + Minmaxinfo structure = (Minmaxinfo)Marshal.PtrToStructure(lParam, typeof(Minmaxinfo)); + if (hMonitor.Equals((object?)(nint)intPtr)) + { + structure.ptMaxPosition.X = monitorinfo.rcWork.Left; + structure.ptMaxPosition.Y = monitorinfo.rcWork.Top; + structure.ptMaxSize.X = monitorinfo.rcWork.Right - monitorinfo.rcWork.Left; + structure.ptMaxSize.Y = monitorinfo.rcWork.Bottom - monitorinfo.rcWork.Top; + } + else + { + structure.ptMaxPosition.X = monitorinfo.rcMonitor.Left; + structure.ptMaxPosition.Y = monitorinfo.rcMonitor.Top; + structure.ptMaxSize.X = monitorinfo.rcMonitor.Right - monitorinfo.rcMonitor.Left; + structure.ptMaxSize.Y = monitorinfo.rcMonitor.Bottom - monitorinfo.rcMonitor.Top; + } + Marshal.StructureToPtr(structure, lParam, fDeleteOld: true); + } + } + + [DllImport("user32.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + private static extern bool GetCursorPos(out Point lpPoint); + + [DllImport("user32.dll", SetLastError = true)] + private static extern IntPtr MonitorFromPoint(Point pt, MonitorOptions dwFlags); + + [DllImport("user32.dll")] + private static extern bool GetMonitorInfo(IntPtr hMonitor, Monitorinfo lpmi); + + public MainWindow() + { + //IL_00f3: Unknown result type (might be due to invalid IL or missing references) + //IL_00fd: Expected O, but got Unknown + //IL_010a: Unknown result type (might be due to invalid IL or missing references) + //IL_0114: Expected O, but got Unknown + //IL_0121: Unknown result type (might be due to invalid IL or missing references) + //IL_012b: Expected O, but got Unknown + //IL_0138: Unknown result type (might be due to invalid IL or missing references) + //IL_0142: Expected O, but got Unknown + //IL_014f: Unknown result type (might be due to invalid IL or missing references) + //IL_0159: Expected O, but got Unknown + //IL_0166: Unknown result type (might be due to invalid IL or missing references) + //IL_0170: Expected O, but got Unknown + //IL_01b4: Unknown result type (might be due to invalid IL or missing references) + //IL_01be: Expected O, but got Unknown + ViewModel = new MainViewModel(); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Gestor.Application.Actions.Actions.AcessaTela = AcessarTela; + Gestor.Application.Actions.Actions.IniciarAggilizador = IniciarAggilizador; + App.SnackBar = Snackbar; + App.ProgressRing = ProgressRing; + ((UIElement)App.ProgressRing).Visibility = (Visibility)2; + Gestor.Application.Actions.Actions.NomeTela = (Action<string>)Delegate.Combine(Gestor.Application.Actions.Actions.NomeTela, new Action<string>(DefinirNomeTela)); + Gestor.Application.Actions.Actions.EnablePesquisarClientes = (Action<bool>)Delegate.Combine(Gestor.Application.Actions.Actions.EnablePesquisarClientes, new Action<bool>(HabilitarPesquisarClientes)); + Gestor.Application.Actions.Actions.EnableMainMenu = (Action<bool>)Delegate.Combine(Gestor.Application.Actions.Actions.EnableMainMenu, new Action<bool>(HabilitarMenu)); + Gestor.Application.Actions.Actions.AcessarHoster = (Action<PipeMessageResult>)Delegate.Combine(Gestor.Application.Actions.Actions.AcessarHoster, new Action<PipeMessageResult>(AcessarHoster)); + ((UIElement)MinimizeButton).MouseEnter += new MouseEventHandler(TopControls_OnMouseEnter); + ((UIElement)MinimizeButton).MouseLeave += new MouseEventHandler(TopControls_OnMouseLeave); + ((UIElement)MaximizeButton).MouseEnter += new MouseEventHandler(TopControls_OnMouseEnter); + ((UIElement)MaximizeButton).MouseLeave += new MouseEventHandler(TopControls_OnMouseLeave); + ((UIElement)CloseButton).MouseEnter += new MouseEventHandler(TopControls_OnMouseEnter); + ((UIElement)CloseButton).MouseLeave += new MouseEventHandler(TopControls_OnMouseLeave); + ViewModel.Head = "BEM VINDO, " + Recursos.Usuario.Nome; + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + ((Window)this).Icon = (ImageSource)new BitmapImage(Address.IconeGestor); + } + + private async void ContentLoad() + { + if (!(await VerificarLicenca((Produto)1, (TipoTela)21))) + { + return; + } + ViewModel.PermissaoWhatsapp = ViewModel.Restricao((TipoRestricao)32); + TipoTelaInicial? telaInicial = Recursos.Usuario.TelaInicial; + if (!telaInicial.HasValue) + { + goto IL_00d8; + } + TipoTelaInicial valueOrDefault = telaInicial.GetValueOrDefault(); + if ((int)valueOrDefault != 1) + { + if ((int)valueOrDefault != 2) + { + goto IL_00d8; + } + SetControl(ViewModel.Restricao((TipoRestricao)35) ? typeof(ConsultaOriginalView) : typeof(FinanceiroView)); + } + else + { + SetControl(ViewModel.Restricao((TipoRestricao)47) ? typeof(ConsultaOriginalView) : typeof(PainelBiView)); + } + goto IL_0145; + IL_00d8: + SetControl(typeof(ConsultaOriginalView)); + goto IL_0145; + IL_0145: + ViewModel.VisibleChaveInstalacao = (Visibility)((!Recursos.Usuario.Administrador) ? 2 : 0); + GerarQrCode(); + if (Recursos.Usuario.IdEmpresa > 1) + { + ((UIElement)Comissao).Visibility = (Visibility)2; + ((UIElement)FinanceiroMenu).Visibility = (Visibility)2; + ((UIElement)FechamentoFinanceiro).Visibility = (Visibility)2; + ((UIElement)ExtratoConta).Visibility = (Visibility)2; + } + MainViewModel viewModel = ViewModel; + viewModel.VendedorUsuario = await ViewModel.VerificaVinculoVendedor(Recursos.Usuario); + await ViewModel.ShowDialogAdvertising(); + } + + private void TopControls_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + //IL_0008: Unknown result type (might be due to invalid IL or missing references) + //IL_005a: Unknown result type (might be due to invalid IL or missing references) + //IL_005f: Unknown result type (might be due to invalid IL or missing references) + //IL_0064: Unknown result type (might be due to invalid IL or missing references) + //IL_006e: Expected O, but got Unknown + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_0033: Expected O, but got Unknown + //IL_0034: Unknown result type (might be due to invalid IL or missing references) + //IL_003f: Expected O, but got Unknown + //IL_0049: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_0058: Expected O, but got Unknown + _buttonClickable = true; + if (((FrameworkElement)(Grid)sender).Name == "CloseButton") + { + ((Panel)(Grid)sender).Background = (Brush)new SolidColorBrush(Colors.Red); + DependencyObject child = VisualTreeHelper.GetChild((DependencyObject)(Grid)sender, 0); + Path val = (Path)(object)((child is Path) ? child : null); + if (val != null) + { + ((Shape)val).Stroke = (Brush)new SolidColorBrush(Colors.Black); + } + } + else + { + ((Panel)(Grid)sender).Background = (Brush)new SolidColorBrush(Colors.DimGray); + } + } + + private void TopControls_OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + if (_buttonClickable) + { + ((object)this).GetType().GetMethod(((FrameworkElement)(Grid)sender).Name + "_Click")?.Invoke(this, null); + } + } + + private static void TopControls_OnMouseEnter(object sender, MouseEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Unknown result type (might be due to invalid IL or missing references) + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_001d: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Unknown result type (might be due to invalid IL or missing references) + //IL_0038: Expected O, but got Unknown + //IL_0039: Unknown result type (might be due to invalid IL or missing references) + //IL_0044: Expected O, but got Unknown + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_0053: Unknown result type (might be due to invalid IL or missing references) + //IL_005d: Expected O, but got Unknown + ((Panel)(Grid)sender).Background = (Brush)((((FrameworkElement)(Grid)sender).Name == "CloseButton") ? new SolidColorBrush(Colors.IndianRed) : new SolidColorBrush(Colors.Gray)); + DependencyObject child = VisualTreeHelper.GetChild((DependencyObject)(Grid)sender, 0); + Path val = (Path)(object)((child is Path) ? child : null); + if (val != null) + { + ((Shape)val).Stroke = (Brush)new SolidColorBrush(Colors.White); + } + } + + private void TopControls_OnMouseLeave(object sender, MouseEventArgs e) + { + //IL_0008: Unknown result type (might be due to invalid IL or missing references) + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Unknown result type (might be due to invalid IL or missing references) + //IL_001c: Expected O, but got Unknown + //IL_001d: Unknown result type (might be due to invalid IL or missing references) + //IL_0028: Expected O, but got Unknown + //IL_0032: Unknown result type (might be due to invalid IL or missing references) + //IL_0037: Unknown result type (might be due to invalid IL or missing references) + //IL_0041: Expected O, but got Unknown + _buttonClickable = false; + ((Panel)(Grid)sender).Background = (Brush)new SolidColorBrush(Colors.Transparent); + DependencyObject child = VisualTreeHelper.GetChild((DependencyObject)(Grid)sender, 0); + Path val = (Path)(object)((child is Path) ? child : null); + if (val != null) + { + ((Shape)val).Stroke = (Brush)new SolidColorBrush(Colors.White); + } + } + + public void MinimizeButton_Click() + { + ((Window)this).WindowState = (WindowState)1; + } + + public void MaximizeButton_Click() + { + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + ((Window)this).WindowState = (WindowState)(((int)((Window)this).WindowState == 0) ? 2 : 0); + } + + public async void CloseButton_Click() + { + if (!(await ViewModel.ShowMessage("DESEJA REALMENTE FECHAR O SISTEMA?", "SIM", "NÃO"))) + { + return; + } + if (((DomainBase)Recursos.Usuario).Id > 0) + { + DateTime networkTime = Funcoes.GetNetworkTime(); + RegistroLog keyValues = new RegistroLog + { + Acao = (TipoAcao)0, + Usuario = Recursos.Usuario, + DataHora = networkTime, + Descricao = $"O USUÁRIO {Recursos.Usuario.Nome} SAIU DO SISTEMA, EM {networkTime}.", + EntidadeId = ((DomainBase)Recursos.Usuario).Id, + Tela = (TipoTela)49, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = Dns.GetHostEntry(Dns.GetHostName()).AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + UnitOfWork commited = Instancia.Commited; + try + { + new BaseServico().SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + Environment.Exit(0); + } + + protected sealed override void OnStateChanged(EventArgs e) + { + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + //IL_0008: Invalid comparison between Unknown and I4 + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + //IL_0025: Invalid comparison between Unknown and I4 + //IL_002c: Unknown result type (might be due to invalid IL or missing references) + //IL_003d: Unknown result type (might be due to invalid IL or missing references) + //IL_0043: Invalid comparison between Unknown and I4 + //IL_0058: Unknown result type (might be due to invalid IL or missing references) + //IL_005e: Invalid comparison between Unknown and I4 + ((Control)this).BorderThickness = new Thickness((double)(((int)((Window)this).WindowState != 2) ? 1 : 0)); + WindowChrome.ResizeBorderThickness = new Thickness((double)(((int)((Window)this).WindowState != 2) ? 4 : 0)); + WindowChrome.CaptionHeight = (((int)((Window)this).WindowState == 2) ? 32 : 29); + ViewModel.MaximizeRestore = (((int)((Window)this).WindowState == 2) ? Geometry.Parse((string)Application.Current.Resources[(object)"Restore"]) : Geometry.Parse((string)Application.Current.Resources[(object)"Maximize"])); + ((Window)this).OnStateChanged(e); + } + + private void HabilitarMenu(bool enable) + { + ((UIElement)MainMenu).IsEnabled = enable; + ((UIElement)Voltar).IsEnabled = enable; + } + + private void HabilitarPesquisarClientes(bool enable) + { + if (ViewModel.Content is ConsultaOriginalView || ViewModel.Content is ClienteView) + { + ViewModel.EnableSeguros = enable; + } + } + + private void DefinirNomeTela(string tela) + { + ViewModel.Tela = tela; + } + + private void ContentControl_GotFocus(object sender, RoutedEventArgs e) + { + MainMenu.Close(); + } + + private void ContentControl_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + MainMenu.Close(); + } + + private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e) + { + Snackbar.IsActive = false; + } + + private void ExpandirMenu() + { + MainMenu.IsOpen = true; + CentralDeNegociosMenu.ContentVisible = (Visibility)0; + SegurosMenu.ContentVisible = (Visibility)0; + FerramentasMenu.ContentVisible = (Visibility)0; + FinanceiroMenu.ContentVisible = (Visibility)0; + } + + private void Relatorios_OnClick(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + HamburgerMenuItem val = (HamburgerMenuItem)sender; + string opcao = "DOCUMENTO"; + switch (((FrameworkElement)val).Name) + { + case "RelatoriosCliente": + opcao = "CLIENTE"; + break; + case "RelatoriosParcelas": + opcao = "PARCELA"; + break; + case "RelatoriosSinistros": + opcao = "SINISTRO"; + break; + case "RelatoriosFechamento": + opcao = "FECHAMENTO"; + break; + case "RelatoriosNotas": + opcao = "NOTA FISCAL"; + break; + case "RelatoriosTarefas": + opcao = "TAREFA"; + break; + case "RelatoriosExtrato": + opcao = "EXTRATO"; + break; + case "RelatoriosLogs": + opcao = "LOGS"; + break; + } + string text = $"VOCÊ ESTÁ EM RELATÓRIOS | VERSÃO GESTOR {ApplicationHelper.Versao}"; + ((Window)new HosterWindow((ContentControl)(object)new RelatorioView(opcao), "OLÁ, " + Recursos.Usuario.Nome + " - " + Recursos.Empresa.Nome + ", " + text, 1024.0, 600.0, canMaximize: true)).Show(); + } + + private async void Agenda_OnClick(object sender, RoutedEventArgs e) + { + if (await ViewModel.VerificarPermissao((TipoTela)34)) + { + ViewModel.ShowDrawer(new AgendaDrawer(), 0, close: false); + } + } + + private async Task PostMonitor(string tela) + { + try + { + if (!ValidationHelper.IsNullOrEmpty(tela)) + { + HttpClient client = new HttpClient(); + try + { + ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; + client.Timeout = TimeSpan.FromSeconds(10.0); + TipoTela enumFromEntity = ValidationHelper.GetEnumFromEntity<TipoTela>(tela); + string value = $"{ApplicationHelper.IdFornecedor}:{(int)enumFromEntity}:{Funcoes.GetNetworkTime().ToUniversalTime().Ticks}".EncodeBase64(); + Uri uri = Address.ApiMonitor.Append("screen").AddQuery("screenQuery", value); + await client.GetAsync(uri); + } + finally + { + ((IDisposable)client)?.Dispose(); + } + } + } + catch + { + } + } + + private void SetControl(Type tipo, object arguments = null) + { + //IL_017d: Unknown result type (might be due to invalid IL or missing references) + //IL_0183: Expected O, but got Unknown + //IL_0221: Unknown result type (might be due to invalid IL or missing references) + //IL_0270: Unknown result type (might be due to invalid IL or missing references) + //IL_027a: Expected O, but got Unknown + Gestor.Application.Actions.Actions.AtualizaBadges(); + if (ViewModel.Content != null && ViewModel.Content.GetType() == tipo) + { + return; + } + lastSearch = null; + MainViewModel.ViewAberta = tipo.Name; + ViewModel.VisibleSeguros = (Visibility)2; + ViewModel.VisibilityVoltar = (Visibility)2; + ViewModel.EnableBuscar = false; + ViewModel.EnableSeguros = false; + UserControl val; + switch (tipo.Name) + { + default: + val = (UserControl)Activator.CreateInstance(tipo); + break; + case "CadastroParceiroView": + val = (UserControl)(object)new CadastroParceiroView(); + break; + case "ClienteView": + ViewModel.ClienteViewModel = new ClienteViewModel(); + val = (UserControl)(object)new ClienteView(ViewModel.SelectedCliente, lockInsert: false, ViewModel.ClienteViewModel); + ViewModel.VisibilityVoltar = (Visibility)0; + ViewModel.VisibleSeguros = (Visibility)0; + ViewModel.EnableBuscar = false; + ViewModel.EnableSeguros = true; + break; + case "FinanceiroView": + ViewModel.FinanceiroView = new FinanceiroView(); + val = (UserControl)(object)ViewModel.FinanceiroView; + break; + case "ApoliceView": + val = (UserControl)(object)new ApoliceView(ConsultaViewModel.DocumentoSelecionado, lockInsert: false, invoke: true, Acesso, 0L); + ViewModel.VisibilityVoltar = (Visibility)0; + ViewModel.VisibleSeguros = (Visibility)0; + ViewModel.EnableBuscar = false; + ViewModel.EnableSeguros = false; + break; + case "MenuItensView": + val = (UserControl)(object)new MenuItensView(ViewModel.SelectedRamo, (ManutencaoItem)arguments); + ViewModel.VisibilityVoltar = (Visibility)0; + ViewModel.VisibleSeguros = (Visibility)0; + ViewModel.EnableBuscar = false; + ViewModel.EnableSeguros = false; + break; + case "SinistroView": + val = (UserControl)(object)new SinistroView(); + ViewModel.VisibilityVoltar = (Visibility)0; + ViewModel.VisibleSeguros = (Visibility)0; + ViewModel.EnableBuscar = false; + ViewModel.EnableSeguros = false; + break; + case "DashboardView": + if (ViewModel.DashboardViewModel == null) + { + ViewModel.DashboardViewModel = new DashboardViewModel(); + } + val = (UserControl)(object)new DashboardView(ViewModel.DashboardViewModel); + break; + case "ConsultaOriginalView": + { + int num; + if (ViewModel.ConsultaViewModel == null && !ViewModel.Restricao((TipoRestricao)108)) + { + Usuario usuario = Recursos.Usuario; + num = (((usuario != null) ? usuario.Dashboard : null).GetValueOrDefault() ? 1 : 0); + } + else + { + num = 0; + } + ViewModel.ConsultaViewModel = new ConsultaViewModel(); + if (num != 0) + { + ViewModel.DashboardViewModel = new DashboardViewModel(); + val = (UserControl)(object)new DashboardView(ViewModel.DashboardViewModel); + } + else + { + val = (UserControl)(object)new ConsultaOriginalView(ViewModel.ConsultaViewModel); + } + ViewModel.VisibleSeguros = (Visibility)0; + ViewModel.EnableBuscar = true; + ViewModel.EnableSeguros = true; + break; + } + } + ShowHelp(tipo.Name); + DefinirNomeTela((((FrameworkElement)val).Tag == null) ? "" : ((FrameworkElement)val).Tag.ToString()); + PostMonitor(tipo.Name); + (((FrameworkElement)ContentControl).DataContext as IDisposable)?.Dispose(); + ViewModel.Content = val; + } + + private async void ShowHelp(string name) + { + if (!(await ViewModel.VerificarRestricao((TipoRestricao)61, root: true, showmessage: false))) + { + ((UIElement)HelpPopup).Visibility = (Visibility)2; + return; + } + TipoTela? val = Funcoes.ConvertTela(name); + bool flag = val.HasValue && val != (TipoTela?)0; + ((UIElement)HelpPopup).Visibility = (Visibility)((!flag) ? 2 : 0); + ViewModel.TelaAberta = val; + } + + private async Task<bool> VerificarLicenca(Produto? produto = null, TipoTela? tela = null, TipoRestricao? restricao = null) + { + string text = await ViewModel.VerificarAcesso(((DomainBase)Recursos.Usuario).Id); + if (((DomainBase)Recursos.Usuario).Id != 0L && text != null) + { + await ViewModel.ShowMessage(text + " O SISTEMA SERÁ ENCERRADO."); + Environment.Exit(0); + return false; + } + bool flag; + if ((int)produto.GetValueOrDefault() != 83 || (int)produto.GetValueOrDefault() == 86) + { + flag = produto.HasValue; + if (flag) + { + flag = !(await ViewModel.VerificarContrato(produto.Value, message: true, root: true)); + } + if (flag) + { + return false; + } + } + flag = restricao.HasValue; + if (flag) + { + flag = !(await ViewModel.VerificarRestricao(restricao.Value, root: true)); + } + if (flag) + { + return false; + } + flag = tela.HasValue; + if (flag) + { + flag = !(await ViewModel.VerificarPermissao(tela.Value, root: true)); + } + if (flag) + { + return false; + } + if ((int)tela.GetValueOrDefault() == 58) + { + if (!Recursos.Usuario.Administrador && ((DomainBase)Recursos.Usuario).Id > 0) + { + await ViewModel.ShowMessage("VOCÊ PRECISA SER ADMINISTRADOR PARA ACESSAR ESSA TELA."); + return false; + } + if ((await ViewModel.VerificaVinculoVendedor(Recursos.Usuario)).Count > 0) + { + await ViewModel.ShowMessage("PARA ACESSAR ESSA TELA, REMOVA QUALQUER VÍNCULO DE VENDEDOR DO SEU USUÁRIO."); + return false; + } + } + flag = (int)restricao.GetValueOrDefault() == 44; + if (flag) + { + flag = !(await ViewModel.VerificarPermissao((TipoTela)60, root: true)); + } + if (flag) + { + return false; + } + return true; + } + + private async void FinanceiroMenu_OnClick(object sender, RoutedEventArgs e) + { + if (Recursos.Usuario.IdEmpresa > 1) + { + await ViewModel.ShowMessage("SOMENTE A MATRIZ POSSUI ACESSO AO FINANCEIRO."); + return; + } + bool num = (MainMenu.IsOpen && ViewModel.Content == null) || ViewModel.Content.GetType() != typeof(FinanceiroView); + SetControl(typeof(FinanceiroView)); + if (num) + { + ((HamburgerMenuItem)sender).ContentVisible = (Visibility)0; + } + } + + private async void Fornecedor_OnClick(object sender, RoutedEventArgs e) + { + if (Recursos.Usuario.IdEmpresa > 1) + { + await ViewModel.ShowMessage("SOMENTE A MATRIZ POSSUI ACESSO AO FINANCEIRO."); + } + else + { + SetControl(typeof(FornecedorView)); + } + } + + private async void Conta_OnClick(object sender, RoutedEventArgs e) + { + if (Recursos.Usuario.IdEmpresa > 1) + { + await ViewModel.ShowMessage("SOMENTE A MATRIZ POSSUI ACESSO AO FINANCEIRO."); + } + else + { + SetControl(typeof(BancosContasView)); + } + } + + private async void Plano_OnClick(object sender, RoutedEventArgs e) + { + if (Recursos.Usuario.IdEmpresa > 1) + { + await ViewModel.ShowMessage("SOMENTE A MATRIZ POSSUI ACESSO AO FINANCEIRO."); + } + else + { + SetControl(typeof(PlanosView)); + } + } + + private async void Centro_OnClick(object sender, RoutedEventArgs e) + { + if (Recursos.Usuario.IdEmpresa > 1) + { + await ViewModel.ShowMessage("SOMENTE A MATRIZ POSSUI ACESSO AO FINANCEIRO."); + } + else + { + SetControl(typeof(CentroDeCustoView)); + } + } + + private async void AcessarTela(TipoTela tela, string subTela = "") + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + switch (tela - 1) + { + default: + if ((int)tela == 21) + { + Consultar_OnClick(SegurosMenu, new RoutedEventArgs()); + } + break; + case 6: + if (await VerificarDocumento(Sinistros.Produto, Sinistros.Tela)) + { + Sinistros_OnClick(Clientes, new RoutedEventArgs()); + } + break; + case 0: + if (await VerificarLicenca(Clientes.Produto, Clientes.Tela)) + { + Clientes_OnClick(Clientes, new RoutedEventArgs()); + } + break; + case 1: + { + bool flag = (int)Acesso > 0; + if (flag) + { + flag = !(await VerificarDocumento(Apolices.Produto, Apolices.Tela)); + } + bool flag2 = flag; + if (!flag2) + { + flag2 = !(await VerificarCliente(Apolices.Produto, Apolices.Tela)); + } + if (!flag2) + { + switch (subTela) + { + default: + Acesso = (AcessoApolice)0; + break; + case "Parcela": + Acesso = (AcessoApolice)1; + break; + case "Renovar": + Acesso = (AcessoApolice)3; + break; + case "Endossar": + Acesso = (AcessoApolice)2; + break; + } + Apolices_OnClick(Apolices, new RoutedEventArgs()); + } + break; + } + case 2: + if (await VerificarDocumento(Itens.Produto, Itens.Tela)) + { + switch (subTela) + { + default: + ManutencaoItem = null; + break; + case "Renovação": + ManutencaoItem = new ManutencaoItem + { + Documento = ConsultaViewModel.DocumentoRenovado, + Tipo = (TipoManutencao)0 + }; + ConsultaViewModel.DocumentoRenovado = null; + break; + case "Endosso": + ManutencaoItem = new ManutencaoItem + { + Documento = ConsultaViewModel.DocumentoSelecionado, + Tipo = (TipoManutencao)1 + }; + break; + case "Manutencao": + ManutencaoItem = new ManutencaoItem + { + Documento = ConsultaViewModel.DocumentoSelecionado, + Tipo = (TipoManutencao)2 + }; + break; + } + Itens_OnClick(Itens, new RoutedEventArgs()); + } + break; + case 3: + case 4: + case 5: + break; + } + } + + private void Consultar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.PermissaoWhatsapp = ViewModel.Restricao((TipoRestricao)32); + SetControl(typeof(ConsultaOriginalView)); + } + + private void AutoCompleteBox_Populating(object sender, PopulatingEventArgs e) + { + //IL_0087: Unknown result type (might be due to invalid IL or missing references) + //IL_008d: Invalid comparison between Unknown and I4 + //IL_00e3: Unknown result type (might be due to invalid IL or missing references) + if (e.Parameter.Trim().Length < 3) + { + return; + } + e.Cancel = true; + lastSearch = e.Parameter.Trim(); + ((UIElement)LoadingAutoComplete).Visibility = (Visibility)0; + List<long> vinculos = ViewModel.VendedorUsuario.Select((VendedorUsuario vu) => ((DomainBase)vu.Vendedor).Id).ToList(); + if ((int)ViewModel.SelectedFiltroCliente != 1) + { + ViewModel.SelectedFiltroCliente = (TipoFiltroCliente)(Regex.Replace(e.Parameter.Trim(), "[.\\-\\/]", "").All(char.IsDigit) ? 2 : 0); + } + ViewModel.BuscarCliente(e.Parameter.Trim(), vinculos, ViewModel.SelectedFiltroCliente).ContinueWith(delegate(Task<List<Cliente>> searchResult) + { + //IL_0036: Unknown result type (might be due to invalid IL or missing references) + //IL_003b: Unknown result type (might be due to invalid IL or missing references) + ((UIElement)LoadingAutoComplete).Visibility = (Visibility)2; + if (searchResult.Result != null) + { + ViewModel.ClientesEncontrados = searchResult.Result; + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void AutoCompleteNomeBox_Populating(object sender, PopulatingEventArgs e) + { + //IL_011b: Unknown result type (might be due to invalid IL or missing references) + //IL_008a: Unknown result type (might be due to invalid IL or missing references) + //IL_008f: Unknown result type (might be due to invalid IL or missing references) + if (e.Parameter.Trim().Length < 3) + { + return; + } + e.Cancel = true; + if (lastSearch != null && lastSearchTime.HasValue && e.Parameter.Trim().Contains(lastSearch) && (DateTime.Now - lastSearchTime.Value).TotalSeconds < 10.0) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = ViewModel.FiltrarClientes(e.Parameter.Trim()); + val.PopulateComplete(); + return; + } + lastSearch = e.Parameter.Trim(); + ((UIElement)LoadingAutoComplete).Visibility = (Visibility)0; + List<long> vinculos = ViewModel.VendedorUsuario.Select((VendedorUsuario vu) => ((DomainBase)vu.Vendedor).Id).ToList(); + ViewModel.BuscarCliente(e.Parameter.Trim(), vinculos, ViewModel.SelectedFiltroCliente).ContinueWith(delegate(Task<List<Cliente>> searchResult) + { + //IL_0036: Unknown result type (might be due to invalid IL or missing references) + //IL_003b: Unknown result type (might be due to invalid IL or missing references) + ((UIElement)LoadingAutoComplete).Visibility = (Visibility)2; + if (searchResult.Result != null) + { + ViewModel.ClientesEncontrados = searchResult.Result; + AutoCompleteBox val2 = (AutoCompleteBox)sender; + val2.ItemsSource = searchResult.Result; + val2.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private async void PesquisaAvancada_OnClick(object sender, RoutedEventArgs e) + { + PesquisaAvancada pesquisa = await ViewModel.ShowPesquisaAvancadaDialog(); + if (pesquisa != null) + { + ViewModel.Invoke = false; + ViewModel.SelectedCliente = null; + ViewModel.SelectedStatus = pesquisa.Status; + ViewModel.PesquisaAvançada = true; + Cliente val = await new ClienteServico().BuscarCliente(pesquisa.IdCliente); + ViewModel.ClientesFiltrados = new List<Cliente> { val }; + ViewModel.SelectedCliente = val; + ViewModel.PesquisaAvançada = false; + MainViewModel.ClienteSelecionado = ViewModel.SelectedCliente; + ViewModel.Pesquisa = ViewModel.SelectedCliente.NomeSocial; + ViewModel.Invoke = true; + ((ConsultaOriginalView)ViewModel.Content).Pesquisar(pesquisa); + } + } + + private async void WhatsAppMessage_Click(object sender, RoutedEventArgs e) + { + if (ViewModel.Restricao((TipoRestricao)32)) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR O WHATSAPP"); + return; + } + bool flag = await ViewModel.ShowMessage("DESEJA ENVIAR SEU CARTÃO DE VISITA ELETRÔNICO VIA WHATSAPP?", "SIM", "NÃO"); + string text = $"Prezado {ViewModel.SelectedCliente.Nome} abaixo o link para meu Cartão de Visita.{Environment.NewLine}{Environment.NewLine}{Address.Card}{((DomainBase)Recursos.Usuario).Id.GeraCartaoVisita()}"; + Button val = (Button)sender; + if (((FrameworkElement)val).DataContext != null) + { + object dataContext = ((FrameworkElement)val).DataContext; + Contato val2 = (Contato)((dataContext is Contato) ? dataContext : null); + if (val2 != null && !("55" + val2.Numero.Clear()).EnviarWhatsapp((!flag) ? null : text)) + { + await ViewModel.ShowMessage("HOUVE UM PROBLEMA AO ABRIR LINK DO WHATSAPP, O LINK FOI COPIADO EM SUA MAQUINA, BASTA ABRIR O NAVEGADOR DE INTERNET E COLAR NA BARRA DE ENDEREÇOS"); + } + } + } + + private void CopyTelefoneToClipBoard_Click(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + Button val = (Button)sender; + if (((FrameworkElement)val).DataContext != null) + { + object dataContext = ((FrameworkElement)val).DataContext; + Contato val2 = (Contato)((dataContext is Contato) ? dataContext : null); + if (val2 != null) + { + val2.Numero.CopyToClipboard(); + ViewModel.ToggleSnackBar("COPIADO - " + val2.Numero); + } + } + } + + private void AutoCompleteCliente_OnGotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + AutoCompleteBox val = (AutoCompleteBox)sender; + MainMenu.Close(); + lastKey = (string.IsNullOrEmpty(val.Text) ? null : ((val.Text.ToArray().LastOrDefault().ToString() == " ") ? new Key?((Key)18) : null)); + } + + private void Apolices_OnClick(object sender, RoutedEventArgs e) + { + if (MainViewModel.ClienteSelecionado != null) + { + SetControl(typeof(ApoliceView)); + Acesso = (AcessoApolice)0; + } + } + + private async void AcessarHoster(PipeMessageResult pipeMessage) + { + if ((int)pipeMessage.Funcao == 0) + { + Documento documento = await new ApoliceServico().BuscarApoliceAsync(long.Parse(pipeMessage.Json)); + HosterWindow hoster; + ((DispatcherObject)this).Dispatcher.Invoke((Action)delegate + { + ApoliceView control = new ApoliceView(documento, lockInsert: true, invoke: false, (AcessoApolice)0, 0L); + hoster = new HosterWindow((ContentControl)(object)control, "CADASTRO DE APÓLICES - " + documento.Controle.Cliente.Nome); + ((Window)hoster).Show(); + }); + } + } + + private void Itens_OnClick(object sender, RoutedEventArgs e) + { + if (MainViewModel.ClienteSelecionado != null) + { + SetControl(typeof(MenuItensView), ManutencaoItem); + } + } + + private void Clientes_OnClick(object sender, RoutedEventArgs e) + { + SetControl(typeof(ClienteView)); + } + + private async Task<bool> VerificarCliente(Produto? produto, TipoTela? tela) + { + if (MainViewModel.ClienteSelecionado == null || ((DomainBase)MainViewModel.ClienteSelecionado).Id == 0L) + { + return false; + } + return await VerificarLicenca(produto, tela); + } + + private async Task<bool> VerificarDocumento(Produto? produto, TipoTela? tela) + { + if (ConsultaViewModel.DocumentoSelecionado == null || ((DomainBase)ConsultaViewModel.DocumentoSelecionado).Id == 0L) + { + return false; + } + return await VerificarLicenca(produto, tela); + } + + private void Sinistros_OnClick(object sender, RoutedEventArgs e) + { + if (MainViewModel.ClienteSelecionado != null) + { + SetControl(typeof(SinistroView)); + } + } + + private void Seguradoras_OnClick(object sender, RoutedEventArgs e) + { + SetControl(typeof(SeguradoraView)); + } + + private void Ramos_OnClick(object sender, RoutedEventArgs e) + { + SetControl(typeof(RamoView)); + } + + private void Produtos_OnClick(object sender, RoutedEventArgs e) + { + SetControl(typeof(ProdutoView)); + } + + private void Protocolos_OnClick(object sender, RoutedEventArgs e) + { + SetControl(typeof(ProtocoloDocumentosView)); + } + + private void Qualificacao_OnClick(object sender, RoutedEventArgs e) + { + SetControl(typeof(QualificacaoView)); + } + + private void Status_OnClick(object sender, RoutedEventArgs e) + { + SetControl(typeof(StatusView)); + } + + private void Estipulantes_OnClick(object sender, RoutedEventArgs e) + { + SetControl(typeof(EstipulanteView)); + } + + private void Vendedores_OnClick(object sender, RoutedEventArgs e) + { + SetControl(typeof(VendedorView)); + } + + private void TipoVendedor_OnClick(object sender, RoutedEventArgs e) + { + SetControl(typeof(TipoVendedorView)); + } + + private void Usuarios_OnClick(object sender, RoutedEventArgs e) + { + SetControl(typeof(UsuarioView)); + } + + private void Emails_OnClick(object sender, RoutedEventArgs e) + { + SetControl(typeof(CadastroEmailView)); + } + + private void Manutencao_OnClick(object sender, RoutedEventArgs e) + { + SetControl(typeof(ManutencaoPagamentosView)); + } + + private void Empresa_OnClick(object sender, RoutedEventArgs e) + { + SetControl(typeof(EmpresaView)); + } + + private void Socio_OnClick(object sender, RoutedEventArgs e) + { + SetControl(typeof(SocioView)); + } + + private void Parceiro_OnClick(object sender, RoutedEventArgs e) + { + SetControl(typeof(CadastroParceiroView)); + } + + private async void ImportPdf_OnClick(object sender, RoutedEventArgs e) + { + Parameters val = new Parameters(); + val.Beta = false; + val.Type = 4; + val.Application = "Agger.ImportPDF.exe"; + val.Directory = "Agger.Import"; + val.Arguments = $"{((DomainBase)Recursos.Empresa).Id} {((DomainBase)Recursos.Usuario).Id} NOVOGESTOR PERFIL:{ApplicationHelper.Subkey} SERIAL:{ApplicationHelper.NumeroSerial}"; + val.Run = true; + Parameters parameters = val; + await new ArquivoDigitalServico().Criar(); + ((Window)new DownloadWindow(parameters)).Show(); + } + + private async void Comissao_OnClick(object sender, RoutedEventArgs e) + { + if (Recursos.Usuario.IdEmpresa > 1) + { + await ViewModel.ShowMessage("SOMENTE A MATRIZ POSSUI ACESSO A TELA DE COMISSÃO AUTOMÁTICA."); + } + else + { + SetControl(typeof(ComissaoView)); + } + } + + private void Voltar_OnClick(object sender, RoutedEventArgs e) + { + VoltarAction(); + } + + private void VoltarAction() + { + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + //IL_0018: Expected O, but got Unknown + ManutencaoItem = null; + Consultar_OnClick(SegurosMenu, new RoutedEventArgs()); + } + + private void CriticaPdf_OnClick(object sender, RoutedEventArgs e) + { + SetControl(typeof(CriticaApoliceView)); + } + + private void IniciarAggilizador() + { + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Unknown result type (might be due to invalid IL or missing references) + //IL_0018: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + //IL_002a: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Unknown result type (might be due to invalid IL or missing references) + //IL_0063: Unknown result type (might be due to invalid IL or missing references) + //IL_006f: Expected O, but got Unknown + //IL_0074: Unknown result type (might be due to invalid IL or missing references) + //IL_007a: Expected O, but got Unknown + //IL_00f6: Unknown result type (might be due to invalid IL or missing references) + //IL_00fb: Unknown result type (might be due to invalid IL or missing references) + //IL_0102: Unknown result type (might be due to invalid IL or missing references) + //IL_010a: Unknown result type (might be due to invalid IL or missing references) + //IL_0115: Unknown result type (might be due to invalid IL or missing references) + //IL_0120: Unknown result type (might be due to invalid IL or missing references) + //IL_014f: Unknown result type (might be due to invalid IL or missing references) + //IL_0158: Expected O, but got Unknown + //IL_015d: Unknown result type (might be due to invalid IL or missing references) + StringBuilder stringBuilder = new StringBuilder(); + StringBuilder stringBuilder2 = new StringBuilder(); + ((Window)new DownloadWindow(new Parameters + { + Beta = false, + Type = 4, + Application = "Agger.ImportPDF.exe", + Directory = "Agger.Import", + Arguments = $"{((DomainBase)Recursos.Empresa).Id} {((DomainBase)Recursos.Usuario).Id} NOVOGESTOR", + Run = false + })).Show(); + Token val = new Token(); + long num = ((DomainBase)Recursos.Usuario).Id; + if (num == 0L) + { + Usuario? obj = ((IEnumerable<Usuario>)Recursos.Usuarios).FirstOrDefault((Func<Usuario, bool>)((Usuario x) => x.PermissaoAggilizador == 1)); + num = ((obj != null) ? ((DomainBase)obj).Id : 0); + } + stringBuilder.Append(val.AggerEncrypt(num.ToString())); + if (((DomainBase)Recursos.Usuario).Id != 0L) + { + stringBuilder2.Append(val.AggerEncrypt(Recursos.Usuario.TokenSso)); + } + Parameters parameters = new Parameters + { + Beta = false, + Type = 88, + Application = "Instalador.exe", + Directory = "", + Arguments = string.Format("/CALCULATION {0} {1}", stringBuilder, (((DomainBase)Recursos.Usuario).Id == 0L) ? "" : $" /SSO {stringBuilder2}"), + Run = true + }; + new RegistryHelper("").Write<string>("NSP", EncryptionHelper.Encrypt(ApplicationHelper.NumeroSerial), true); + try + { + ((Window)new DownloadWindow(parameters)).Show(); + } + catch (Exception) + { + } + } + + private async void Aggilizador_OnClick(object sender, RoutedEventArgs e) + { + if (!Recursos.Usuario.PermissaoAggilizador.HasValue || Recursos.Usuario.PermissaoAggilizador == 0) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR O AGGILIZADOR"); + } + else if (LicenseHelper.Produtos.Any((Licenca produto) => (int)produto.Produto == 91)) + { + Process.Start(Address.CalculoWeb.ToString()); + if (LicenseHelper.Produtos.Any((Licenca produto) => (int)produto.Produto != 77)) + { + IniciarAggilizador(); + } + } + else + { + IniciarAggilizador(); + } + } + + private void Prospeccao_OnClick(object sender, RoutedEventArgs e) + { + SetControl(typeof(ProspeccaoView)); + } + + private void Notas_OnClick(object sender, RoutedEventArgs e) + { + string text = $"VOCÊ ESTÁ EM CADASTRO DE NOTAS | VERSÃO GESTOR {ApplicationHelper.Versao}"; + ((Window)new HosterWindow((ContentControl)(object)new NotasView(), "OLÁ, " + Recursos.Usuario.Nome + " - " + Recursos.Empresa.Nome + ", " + text)).Show(); + } + + private async void Tarefas_OnClick(object sender, RoutedEventArgs e) + { + if (await ViewModel.VerificarPermissao((TipoTela)38)) + { + ViewModel.MensagemTarefasVisibility = (Visibility)2; + AbrirTarefas(); + } + } + + private static void AbrirTarefas() + { + string text = $"VOCÊ ESTÁ EM CONSULTA DE TAREFAS | VERSÃO GESTOR {ApplicationHelper.Versao}"; + ((Window)new HosterWindow((ContentControl)(object)new TarefaView(), "OLÁ, " + Recursos.Usuario.Nome + " - " + Recursos.Empresa.Nome + ", " + text)).Show(); + } + + private void PainelBi_OnClick(object sender, RoutedEventArgs e) + { + SetControl(typeof(PainelBiView)); + ViewModel.VisibleBi = (Visibility)0; + } + + private async void Atendimentos_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.Restricao((TipoRestricao)54)) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ATENDIMENTOS."); + } + else + { + AbrirAtendimento(); + } + } + + private void AbrirAtendimento() + { + if (Recursos.Usuario != null && ((DomainBase)Recursos.Usuario).Id != 0L) + { + string arg = (ValidationHelper.IsNotNullOrEmpty(Recursos.Usuario.SsoId) ? $"{Recursos.Usuario.SsoId}:{((DomainBase)Recursos.Usuario).Id}:SSO" : EncryptionHelper.Encrypt(Recursos.Usuario.Senha)); + string value = EncryptionHelper.Encrypt($"{ApplicationHelper.IdFornecedor}:{Recursos.Usuario.Login}:{arg}"); + Process.Start(Address.CentralAtendimento.Append("Acessar").AddQuery("id", value).ToString()); + } + } + + private async void BoletosNotas_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.Restricao((TipoRestricao)55)) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA BOLETOS E NOTAS."); + } + else + { + AbrirAtendimento(); + } + } + + private async void Contratos_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.Restricao((TipoRestricao)56)) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA CONTRATOS."); + } + else + { + AbrirAtendimento(); + } + } + + private async void Instalacao_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.Restricao((TipoRestricao)57)) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA INSTALAÇÕES."); + } + else + { + AbrirAtendimento(); + } + } + + private async void AcessoRemoto_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.Restricao((TipoRestricao)58)) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSO REMOTO."); + return; + } + string text = "c:\\AggerSeguros\\Remoto.exe"; + if (File.Exists(text)) + { + Process.Start(text); + return; + } + ((Window)new DownloadWindow(new Parameters + { + Beta = false, + Type = 99, + Application = "Remoto.exe", + Directory = "", + Run = true + })).Show(); + } + + private void Recibo_OnClick(object sender, RoutedEventArgs e) + { + SetControl(typeof(ReciboView)); + } + + private async void Assinatura_OnClick(object sender, RoutedEventArgs e) + { + if (await ViewModel.ShowMessage("DESEJA ABRIR O SIGGNER PARA ASSINATURAS ELETRÔNICAS?", "SIM", "NÃO")) + { + string text = (new PipeServer().CreateServer(PipeName) ? (":" + PipeName) : ""); + string arguments = new Token().Encrypt(string.Format("{0}:{1}:{2}:{3}:{4}", ApplicationHelper.NumeroSerial, ApplicationHelper.IdFornecedor, ((DomainBase)Recursos.Usuario).Id, ApplicationHelper.Beta ? "1" : "0", text)); + ((Window)new DownloadWindow(new Parameters + { + Beta = ApplicationHelper.Beta, + Type = 8, + Application = "Assinador.Application.exe", + Directory = "Assinador.Application", + Arguments = arguments, + Run = true + })).Show(); + } + } + + private void Epic_OnClick(object sender, RoutedEventArgs e) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_0013: Unknown result type (might be due to invalid IL or missing references) + //IL_001e: Unknown result type (might be due to invalid IL or missing references) + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_004d: Unknown result type (might be due to invalid IL or missing references) + //IL_0059: Expected O, but got Unknown + ((Window)new DownloadWindow(new Parameters + { + Beta = false, + Type = 5, + Application = "Agger.Epic.exe", + Directory = "Agger.Epic", + Arguments = $"{ApplicationHelper.NumeroSerial}|{((DomainBase)Recursos.Usuario).Id}", + Run = true + })).Show(); + } + + private async void MainWindow_OnInitialized(object sender, EventArgs e) + { + WindowInteropHelper val = new WindowInteropHelper((Window)(object)this); + val.EnsureHandle(); + HwndSource obj = HwndSource.FromHwnd(val.Handle); + if (obj != null) + { + obj.AddHook(new HwndSourceHook(WindowProc)); + } + ExpandirMenu(); + await new BaseServico().Sincronizar(Funcoes.GetNetworkTime()); + if (Recursos.Usuario.Administrador) + { + MainViewModel viewModel = ViewModel; + viewModel.Boletos = await Connection.Get<List<Payment>>($"Billet/{ApplicationHelper.IdFornecedor}"); + if (ViewModel.Boletos != null && ViewModel.Boletos.Any((Payment x) => x.Vencimento <= Funcoes.GetNetworkTime().Date.AddDays(7.0))) + { + ((UIElement)BoletoPopup).Visibility = (Visibility)0; + } + } + } + + private void CopiarChave_OnClick(object sender, RoutedEventArgs e) + { + if (!string.IsNullOrEmpty(ApplicationHelper.NumeroSerial)) + { + EncryptionHelper.Encrypt($"{ApplicationHelper.NumeroSerial} {Funcoes.GetNetworkTime().Date:d}").CopyToClipboard(); + ViewModel.ToggleSnackBar("CHAVE DE INSTALAÇÃO COPIADA!"); + } + } + + private void Medalha_OnMouseDown(object sender, MouseButtonEventArgs e) + { + ViewModel.Medalha(); + } + + private void MainWindow_OnSizeChanged(object sender, SizeChangedEventArgs e) + { + ViewModel.HeadMaxWidth = 300.0 + ((FrameworkElement)this).ActualWidth - 1024.0; + } + + private async void HelpPopup_Opened(object sender, RoutedEventArgs e) + { + await ViewModel.CarregarAjuda(); + } + + private void Play_Click(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Expected O, but got Unknown + Button val = (Button)sender; + if (val != null && ((FrameworkElement)val).DataContext != null) + { + AjudaTela val2 = (AjudaTela)((FrameworkElement)val).DataContext; + string text = ""; + if (val2.Minuto > 0 || val2.Segundo > 0) + { + text = $"&start={val2.Minuto * 60 + val2.Segundo}"; + } + Process.Start(val2.Link + text); + } + } + + private void Fechar_OnClick(object sender, RoutedEventArgs e) + { + HelpPopup.IsPopupOpen = !HelpPopup.IsPopupOpen; + } + + private void CopyLink_OnClick(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Expected O, but got Unknown + Button val = (Button)sender; + if (val != null && ((FrameworkElement)val).DataContext != null) + { + AjudaTela val2 = (AjudaTela)((FrameworkElement)val).DataContext; + string text = ""; + if (val2.Minuto > 0 || val2.Segundo > 0) + { + text = $"&start={val2.Minuto * 60 + val2.Segundo}"; + } + (val2.Link + text).CopyToClipboard(); + ViewModel.ToggleSnackBar("LINK COPIADO"); + } + } + + private async void ExtratoConta_OnClick(object sender, RoutedEventArgs e) + { + if (Recursos.Usuario.IdEmpresa > 1) + { + await ViewModel.ShowMessage("SOMENTE A MATRIZ POSSUI ACESSO AO FINANCEIRO."); + } + else + { + ((Window)new ExtratoWindow(0L)).Show(); + } + } + + private async void FechamentoFinanceiro_OnClick(object sender, RoutedEventArgs e) + { + if (Recursos.Usuario.IdEmpresa > 1) + { + await ViewModel.ShowMessage("SOMENTE A MATRIZ POSSUI ACESSO AO FINANCEIRO."); + return; + } + string text = $"VOCÊ ESTÁ EM FECHAMENTO FINANCEIRO | VERSÃO GESTOR {ApplicationHelper.Versao}"; + ((Window)new HosterWindow((ContentControl)(object)new FechamentoFinanceiroView(), "OLÁ, " + Recursos.Usuario.Nome + " - " + Recursos.Empresa.Nome + ", " + text, 1024.0, 600.0, canMaximize: true)).Show(); + } + + private void OcultarAjuda_OnClick(object sender, RoutedEventArgs e) + { + ((UIElement)HelpPopup).Visibility = (Visibility)2; + } + + private void OcultarTarefas_OnClick(object sender, RoutedEventArgs e) + { + ((UIElement)TarefaPopup).Visibility = (Visibility)2; + } + + private void OcultarBoleto_OnClick(object sender, RoutedEventArgs e) + { + ((UIElement)BoletoPopup).Visibility = (Visibility)2; + } + + private void Boleto_OnClick(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Expected O, but got Unknown + Button val = (Button)sender; + if (val != null && ((FrameworkElement)val).DataContext != null) + { + Payment val2 = (Payment)((FrameworkElement)val).DataContext; + Process.Start($"{Address.ApiBoletoAgger}billet/id/{val2.Id}"); + } + } + + private void TipoTarefa_OnClick(object sender, RoutedEventArgs e) + { + SetControl(typeof(TipoTarefaView)); + } + + private void StatusProspeccao_OnClick(object sender, RoutedEventArgs e) + { + SetControl(typeof(StatusProspeccaoView)); + } + + private void NotaFiscal_OnClick(object sender, RoutedEventArgs e) + { + SetControl(typeof(NotaFiscalView)); + } + + private void Window_Loaded(object sender, RoutedEventArgs e) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Expected O, but got Unknown + //IL_0036: Unknown result type (might be due to invalid IL or missing references) + //IL_0040: Expected O, but got Unknown + EventManager.RegisterClassHandler(typeof(CustomItemValidation), UIElement.LostFocusEvent, (Delegate)new RoutedEventHandler(ViewHelper.ControlLostFocus)); + EventManager.RegisterClassHandler(typeof(CustomIsReadOnlyControl), UIElement.LostFocusEvent, (Delegate)new RoutedEventHandler(ViewHelper.ControlLostFocus)); + PipeName = $"GESTORPIPE{ApplicationHelper.NumeroSerial}{((DomainBase)Recursos.Usuario).Id}"; + new PipeServer().CreateServer(PipeName); + } + + private async void GerarQrCode() + { + try + { + QRCodeGenerator qrGenerator = new QRCodeGenerator(); + Usuario val = await new UsuarioServico().BuscarUsuarioPorId(((DomainBase)Recursos.Usuario).Id); + if (val == null) + { + ((UIElement)QrCode).Visibility = (Visibility)2; + return; + } + ViewModel.Code = EncryptionHelper.Encrypt($"{ApplicationHelper.NumeroSerial}:{val.IdEmpresa}:{val.Login}:{new Token().AggerDecrypt(val.Senha)}"); + Bitmap graphic = new QRCode(qrGenerator.CreateQrCode(ViewModel.Code, (ECCLevel)2, false, false, (EciMode)0, -1)).GetGraphic(20); + BitmapImage val2; + using (MemoryStream memoryStream = new MemoryStream()) + { + ((Image)graphic).Save((Stream)memoryStream, ImageFormat.Png); + memoryStream.Position = 0L; + val2 = new BitmapImage(); + val2.BeginInit(); + val2.StreamSource = memoryStream; + val2.CacheOption = (BitmapCacheOption)1; + val2.EndInit(); + } + ViewModel.QrCode = val2; + ((UIElement)QrCode).Visibility = (Visibility)0; + ViewModel.Code = ApplicationHelper.NumeroSerial ?? ""; + } + catch (Exception) + { + await ViewModel.ShowMessage("ERRO AO GERAR QRCODE"); + } + } + + private void ImageAppStore_OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e) + { + Process.Start(new ProcessStartInfo("https://apps.apple.com/br/app/agger-mobile/id1463091598")); + } + + private void ImageGooglePlay_OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e) + { + Process.Start(new ProcessStartInfo("https://play.google.com/store/apps/details?id=br.com.aggermobile&hl=pt&gl=US")); + } + + private void CopyCode_Click(object sender, RoutedEventArgs e) + { + ViewModel.Code.CopyToClipboard(); + ViewModel.ToggleSnackBar("CÓDIGO COPIADO - " + ViewModel.Code); + } + + private void MenuGestorMobile_OnClick(object sender, RoutedEventArgs e) + { + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + ((UIElement)QrCode).Visibility = (Visibility)(((int)((UIElement)QrCode).Visibility == 0) ? 2 : 0); + QrCode.IsPopupOpen = !QrCode.IsPopupOpen; + } + + private async Task<bool> VerificarComissao(Produto? produto = null, TipoTela? tela = null, TipoRestricao? restricao = null) + { + if (tela.HasValue && (int)tela.GetValueOrDefault() == 35 && ViewModel.MatrizFilial && ((DomainBase)Recursos.Empresa).Id > 1) + { + await ViewModel.ShowMessage("FILIAL NÃO POSSUI AUTORIZAÇÃO PARA BAIXA DE COMISSÃO AUTOMÁTICA, TODA BAIXA DE COMISSÃO AUTOMÁTICA DEVE SER FEITA PELA MATRIZ."); + return false; + } + return await VerificarLicenca(produto, tela, restricao); + } + + private async void PesquisaCliente_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + if (ViewModel.SelectedCliente == null) + { + _lastCustomer = null; + ViewModel.LimparDocumentos(); + } + else if (_lastCustomer != null && !(ViewModel.Content is ClienteView)) + { + object lastCustomer = _lastCustomer; + Cliente selectedCliente = (Cliente)((lastCustomer is Cliente) ? lastCustomer : null); + ViewModel.SelectedCliente = selectedCliente; + if (ViewModel.Content is DashboardView) + { + ViewModel.Content = new ConsultaOriginalView(ViewModel.ConsultaViewModel); + } + } + else + { + _lastCustomer = ViewModel.SelectedCliente; + await ViewModel.SelecionarCliente(ViewModel.SelectedCliente); + if (ViewModel.Content is DashboardView) + { + ViewModel.Content = new ConsultaOriginalView(ViewModel.ConsultaViewModel); + } + } + } + + private void PesquisaCliente_PreviewKeyDown(object sender, KeyEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0008: Invalid comparison between Unknown and I4 + //IL_0039: Unknown result type (might be due to invalid IL or missing references) + //IL_006b: Unknown result type (might be due to invalid IL or missing references) + //IL_0075: Expected O, but got Unknown + //IL_0023: Unknown result type (might be due to invalid IL or missing references) + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + if ((int)e.Key == 18 && lastKey.HasValue && lastKey.Value == e.Key) + { + ((RoutedEventArgs)e).Handled = true; + } + lastKey = e.Key; + if (((RoutedEventArgs)e).OriginalSource.GetType() == typeof(TextBox)) + { + _textBox = (TextBox)((RoutedEventArgs)e).OriginalSource; + } + } + + private void PesquisaCliente_MouseDoubleClick(object sender, MouseButtonEventArgs e) + { + TextBox textBox = _textBox; + if (textBox != null) + { + ((TextBoxBase)textBox).SelectAll(); + } + } + + private async void CartaoVisita_OnClick(object sender, RoutedEventArgs e) + { + Process.Start($"{Address.Card}{((DomainBase)Recursos.Usuario).Id.GeraCartaoVisita()}"); + } + + private void DashBoard_OnClick(object sender, RoutedEventArgs e) + { + SetControl(typeof(DashboardView)); + } + + private void Observacoes_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.SelectedCliente != null && ((DomainBase)ViewModel.SelectedCliente).Id != 0L) + { + ViewModel.ShowDrawer(new ObservacoesDrawer(((DomainBase)ViewModel.SelectedCliente).Id, (TipoTela)1), 0); + } + } + + private void DocumentoPrincipal_MouseDoubleClick(object sender, MouseButtonEventArgs e) + { + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + try + { + ((TextBoxBase)(TextBox)((RoutedEventArgs)e).Source).SelectAll(); + } + catch + { + } + } + + private void CopiarDocumento_Click(object sender, MouseButtonEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + try + { + TextBox val = (TextBox)sender; + string text = (((int)val != 0) ? val.Text : null) ?? string.Empty; + if (!ValidationHelper.IsNullOrEmpty(text)) + { + text.CopyToClipboard(); + ((RoutedEventArgs)e).Handled = true; + ViewModel.ToggleSnackBar("COPIADO - " + text); + } + } + catch (Exception) + { + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/mainwindow.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_01c2: Unknown result type (might be due to invalid IL or missing references) + //IL_01cc: Expected O, but got Unknown + //IL_01f0: Unknown result type (might be due to invalid IL or missing references) + //IL_01fa: Expected O, but got Unknown + //IL_01fd: Unknown result type (might be due to invalid IL or missing references) + //IL_0207: Expected O, but got Unknown + //IL_0209: Unknown result type (might be due to invalid IL or missing references) + //IL_0215: Unknown result type (might be due to invalid IL or missing references) + //IL_021f: Expected O, but got Unknown + //IL_0221: Unknown result type (might be due to invalid IL or missing references) + //IL_022d: Unknown result type (might be due to invalid IL or missing references) + //IL_0237: Expected O, but got Unknown + //IL_0239: Unknown result type (might be due to invalid IL or missing references) + //IL_0245: Unknown result type (might be due to invalid IL or missing references) + //IL_024f: Expected O, but got Unknown + //IL_0251: Unknown result type (might be due to invalid IL or missing references) + //IL_025d: Unknown result type (might be due to invalid IL or missing references) + //IL_0267: Expected O, but got Unknown + //IL_0269: Unknown result type (might be due to invalid IL or missing references) + //IL_0275: Unknown result type (might be due to invalid IL or missing references) + //IL_027f: Expected O, but got Unknown + //IL_0281: Unknown result type (might be due to invalid IL or missing references) + //IL_028d: Unknown result type (might be due to invalid IL or missing references) + //IL_0297: Expected O, but got Unknown + //IL_0299: Unknown result type (might be due to invalid IL or missing references) + //IL_02a5: Unknown result type (might be due to invalid IL or missing references) + //IL_02af: Expected O, but got Unknown + //IL_02b1: Unknown result type (might be due to invalid IL or missing references) + //IL_02bd: Unknown result type (might be due to invalid IL or missing references) + //IL_02c7: Expected O, but got Unknown + //IL_02c9: Unknown result type (might be due to invalid IL or missing references) + //IL_02d5: Unknown result type (might be due to invalid IL or missing references) + //IL_02df: Expected O, but got Unknown + //IL_02e1: Unknown result type (might be due to invalid IL or missing references) + //IL_02ed: Unknown result type (might be due to invalid IL or missing references) + //IL_02f7: Expected O, but got Unknown + //IL_02f9: Unknown result type (might be due to invalid IL or missing references) + //IL_0305: Unknown result type (might be due to invalid IL or missing references) + //IL_030f: Expected O, but got Unknown + //IL_0312: Unknown result type (might be due to invalid IL or missing references) + //IL_031c: Expected O, but got Unknown + //IL_0329: Unknown result type (might be due to invalid IL or missing references) + //IL_0333: Expected O, but got Unknown + //IL_0340: Unknown result type (might be due to invalid IL or missing references) + //IL_034a: Expected O, but got Unknown + //IL_034d: Unknown result type (might be due to invalid IL or missing references) + //IL_0357: Expected O, but got Unknown + //IL_0364: Unknown result type (might be due to invalid IL or missing references) + //IL_036e: Expected O, but got Unknown + //IL_037b: Unknown result type (might be due to invalid IL or missing references) + //IL_0385: Expected O, but got Unknown + //IL_0388: Unknown result type (might be due to invalid IL or missing references) + //IL_0392: Expected O, but got Unknown + //IL_039f: Unknown result type (might be due to invalid IL or missing references) + //IL_03a9: Expected O, but got Unknown + //IL_03b6: Unknown result type (might be due to invalid IL or missing references) + //IL_03c0: Expected O, but got Unknown + //IL_03c3: Unknown result type (might be due to invalid IL or missing references) + //IL_03cd: Expected O, but got Unknown + //IL_03d0: Unknown result type (might be due to invalid IL or missing references) + //IL_03da: Expected O, but got Unknown + //IL_03dd: Unknown result type (might be due to invalid IL or missing references) + //IL_03e7: Expected O, but got Unknown + //IL_03f4: Unknown result type (might be due to invalid IL or missing references) + //IL_03fe: Expected O, but got Unknown + //IL_0401: Unknown result type (might be due to invalid IL or missing references) + //IL_040b: Expected O, but got Unknown + //IL_0418: Unknown result type (might be due to invalid IL or missing references) + //IL_0422: Expected O, but got Unknown + //IL_0425: Unknown result type (might be due to invalid IL or missing references) + //IL_042f: Expected O, but got Unknown + //IL_043c: Unknown result type (might be due to invalid IL or missing references) + //IL_0446: Expected O, but got Unknown + //IL_0449: Unknown result type (might be due to invalid IL or missing references) + //IL_0453: Expected O, but got Unknown + //IL_0460: Unknown result type (might be due to invalid IL or missing references) + //IL_046a: Expected O, but got Unknown + //IL_046d: Unknown result type (might be due to invalid IL or missing references) + //IL_0477: Expected O, but got Unknown + //IL_0484: Unknown result type (might be due to invalid IL or missing references) + //IL_048e: Expected O, but got Unknown + //IL_0491: Unknown result type (might be due to invalid IL or missing references) + //IL_049b: Expected O, but got Unknown + //IL_04a8: Unknown result type (might be due to invalid IL or missing references) + //IL_04b2: Expected O, but got Unknown + //IL_04b5: Unknown result type (might be due to invalid IL or missing references) + //IL_04bf: Expected O, but got Unknown + //IL_04cc: Unknown result type (might be due to invalid IL or missing references) + //IL_04d6: Expected O, but got Unknown + //IL_04d9: Unknown result type (might be due to invalid IL or missing references) + //IL_04e3: Expected O, but got Unknown + //IL_04f0: Unknown result type (might be due to invalid IL or missing references) + //IL_04fa: Expected O, but got Unknown + //IL_04fd: Unknown result type (might be due to invalid IL or missing references) + //IL_0507: Expected O, but got Unknown + //IL_0514: Unknown result type (might be due to invalid IL or missing references) + //IL_051e: Expected O, but got Unknown + //IL_0521: Unknown result type (might be due to invalid IL or missing references) + //IL_052b: Expected O, but got Unknown + //IL_0538: Unknown result type (might be due to invalid IL or missing references) + //IL_0542: Expected O, but got Unknown + //IL_0545: Unknown result type (might be due to invalid IL or missing references) + //IL_054f: Expected O, but got Unknown + //IL_055c: Unknown result type (might be due to invalid IL or missing references) + //IL_0566: Expected O, but got Unknown + //IL_0569: Unknown result type (might be due to invalid IL or missing references) + //IL_0573: Expected O, but got Unknown + //IL_0580: Unknown result type (might be due to invalid IL or missing references) + //IL_058a: Expected O, but got Unknown + //IL_058d: Unknown result type (might be due to invalid IL or missing references) + //IL_0597: Expected O, but got Unknown + //IL_059a: Unknown result type (might be due to invalid IL or missing references) + //IL_05a4: Expected O, but got Unknown + //IL_05b1: Unknown result type (might be due to invalid IL or missing references) + //IL_05bb: Expected O, but got Unknown + //IL_05be: Unknown result type (might be due to invalid IL or missing references) + //IL_05c8: Expected O, but got Unknown + //IL_05d5: Unknown result type (might be due to invalid IL or missing references) + //IL_05df: Expected O, but got Unknown + //IL_05e2: Unknown result type (might be due to invalid IL or missing references) + //IL_05ec: Expected O, but got Unknown + //IL_05f9: Unknown result type (might be due to invalid IL or missing references) + //IL_0603: Expected O, but got Unknown + //IL_0606: Unknown result type (might be due to invalid IL or missing references) + //IL_0610: Expected O, but got Unknown + //IL_061d: Unknown result type (might be due to invalid IL or missing references) + //IL_0627: Expected O, but got Unknown + //IL_062a: Unknown result type (might be due to invalid IL or missing references) + //IL_0634: Expected O, but got Unknown + //IL_0641: Unknown result type (might be due to invalid IL or missing references) + //IL_064b: Expected O, but got Unknown + //IL_064e: Unknown result type (might be due to invalid IL or missing references) + //IL_0658: Expected O, but got Unknown + //IL_0665: Unknown result type (might be due to invalid IL or missing references) + //IL_066f: Expected O, but got Unknown + //IL_0672: Unknown result type (might be due to invalid IL or missing references) + //IL_067c: Expected O, but got Unknown + //IL_0689: Unknown result type (might be due to invalid IL or missing references) + //IL_0693: Expected O, but got Unknown + //IL_0696: Unknown result type (might be due to invalid IL or missing references) + //IL_06a0: Expected O, but got Unknown + //IL_06ad: Unknown result type (might be due to invalid IL or missing references) + //IL_06b7: Expected O, but got Unknown + //IL_06ba: Unknown result type (might be due to invalid IL or missing references) + //IL_06c4: Expected O, but got Unknown + //IL_06d1: Unknown result type (might be due to invalid IL or missing references) + //IL_06db: Expected O, but got Unknown + //IL_06de: Unknown result type (might be due to invalid IL or missing references) + //IL_06e8: Expected O, but got Unknown + //IL_06f5: Unknown result type (might be due to invalid IL or missing references) + //IL_06ff: Expected O, but got Unknown + //IL_0702: Unknown result type (might be due to invalid IL or missing references) + //IL_070c: Expected O, but got Unknown + //IL_0719: Unknown result type (might be due to invalid IL or missing references) + //IL_0723: Expected O, but got Unknown + //IL_0726: Unknown result type (might be due to invalid IL or missing references) + //IL_0730: Expected O, but got Unknown + //IL_073d: Unknown result type (might be due to invalid IL or missing references) + //IL_0747: Expected O, but got Unknown + //IL_074a: Unknown result type (might be due to invalid IL or missing references) + //IL_0754: Expected O, but got Unknown + //IL_0761: Unknown result type (might be due to invalid IL or missing references) + //IL_076b: Expected O, but got Unknown + //IL_076e: Unknown result type (might be due to invalid IL or missing references) + //IL_0778: Expected O, but got Unknown + //IL_0785: Unknown result type (might be due to invalid IL or missing references) + //IL_078f: Expected O, but got Unknown + //IL_0792: Unknown result type (might be due to invalid IL or missing references) + //IL_079c: Expected O, but got Unknown + //IL_07a9: Unknown result type (might be due to invalid IL or missing references) + //IL_07b3: Expected O, but got Unknown + //IL_07b6: Unknown result type (might be due to invalid IL or missing references) + //IL_07c0: Expected O, but got Unknown + //IL_07cd: Unknown result type (might be due to invalid IL or missing references) + //IL_07d7: Expected O, but got Unknown + //IL_07da: Unknown result type (might be due to invalid IL or missing references) + //IL_07e4: Expected O, but got Unknown + //IL_07f1: Unknown result type (might be due to invalid IL or missing references) + //IL_07fb: Expected O, but got Unknown + //IL_07fe: Unknown result type (might be due to invalid IL or missing references) + //IL_0808: Expected O, but got Unknown + //IL_0815: Unknown result type (might be due to invalid IL or missing references) + //IL_081f: Expected O, but got Unknown + //IL_0822: Unknown result type (might be due to invalid IL or missing references) + //IL_082c: Expected O, but got Unknown + //IL_0839: Unknown result type (might be due to invalid IL or missing references) + //IL_0843: Expected O, but got Unknown + //IL_0846: Unknown result type (might be due to invalid IL or missing references) + //IL_0850: Expected O, but got Unknown + //IL_0853: Unknown result type (might be due to invalid IL or missing references) + //IL_085d: Expected O, but got Unknown + //IL_086a: Unknown result type (might be due to invalid IL or missing references) + //IL_0874: Expected O, but got Unknown + //IL_0877: Unknown result type (might be due to invalid IL or missing references) + //IL_0881: Expected O, but got Unknown + //IL_088e: Unknown result type (might be due to invalid IL or missing references) + //IL_0898: Expected O, but got Unknown + //IL_089b: Unknown result type (might be due to invalid IL or missing references) + //IL_08a5: Expected O, but got Unknown + //IL_08b2: Unknown result type (might be due to invalid IL or missing references) + //IL_08bc: Expected O, but got Unknown + //IL_08bf: Unknown result type (might be due to invalid IL or missing references) + //IL_08c9: Expected O, but got Unknown + //IL_08d6: Unknown result type (might be due to invalid IL or missing references) + //IL_08e0: Expected O, but got Unknown + //IL_08e3: Unknown result type (might be due to invalid IL or missing references) + //IL_08ed: Expected O, but got Unknown + //IL_08fa: Unknown result type (might be due to invalid IL or missing references) + //IL_0904: Expected O, but got Unknown + //IL_0907: Unknown result type (might be due to invalid IL or missing references) + //IL_0911: Expected O, but got Unknown + //IL_091e: Unknown result type (might be due to invalid IL or missing references) + //IL_0928: Expected O, but got Unknown + //IL_092b: Unknown result type (might be due to invalid IL or missing references) + //IL_0935: Expected O, but got Unknown + //IL_0942: Unknown result type (might be due to invalid IL or missing references) + //IL_094c: Expected O, but got Unknown + //IL_094e: Unknown result type (might be due to invalid IL or missing references) + //IL_095a: Unknown result type (might be due to invalid IL or missing references) + //IL_0964: Expected O, but got Unknown + //IL_0967: Unknown result type (might be due to invalid IL or missing references) + //IL_0971: Expected O, but got Unknown + //IL_097e: Unknown result type (might be due to invalid IL or missing references) + //IL_0988: Expected O, but got Unknown + //IL_098b: Unknown result type (might be due to invalid IL or missing references) + //IL_0995: Expected O, but got Unknown + //IL_09a2: Unknown result type (might be due to invalid IL or missing references) + //IL_09ac: Expected O, but got Unknown + //IL_09af: Unknown result type (might be due to invalid IL or missing references) + //IL_09b9: Expected O, but got Unknown + //IL_09c6: Unknown result type (might be due to invalid IL or missing references) + //IL_09d0: Expected O, but got Unknown + //IL_09d3: Unknown result type (might be due to invalid IL or missing references) + //IL_09dd: Expected O, but got Unknown + //IL_09ea: Unknown result type (might be due to invalid IL or missing references) + //IL_09f4: Expected O, but got Unknown + //IL_09f7: Unknown result type (might be due to invalid IL or missing references) + //IL_0a01: Expected O, but got Unknown + //IL_0a0e: Unknown result type (might be due to invalid IL or missing references) + //IL_0a18: Expected O, but got Unknown + //IL_0a1b: Unknown result type (might be due to invalid IL or missing references) + //IL_0a25: Expected O, but got Unknown + //IL_0a32: Unknown result type (might be due to invalid IL or missing references) + //IL_0a3c: Expected O, but got Unknown + //IL_0a3f: Unknown result type (might be due to invalid IL or missing references) + //IL_0a49: Expected O, but got Unknown + //IL_0a56: Unknown result type (might be due to invalid IL or missing references) + //IL_0a60: Expected O, but got Unknown + //IL_0a63: Unknown result type (might be due to invalid IL or missing references) + //IL_0a6d: Expected O, but got Unknown + //IL_0a7a: Unknown result type (might be due to invalid IL or missing references) + //IL_0a84: Expected O, but got Unknown + //IL_0a87: Unknown result type (might be due to invalid IL or missing references) + //IL_0a91: Expected O, but got Unknown + //IL_0a9e: Unknown result type (might be due to invalid IL or missing references) + //IL_0aa8: Expected O, but got Unknown + //IL_0aab: Unknown result type (might be due to invalid IL or missing references) + //IL_0ab5: Expected O, but got Unknown + //IL_0ac2: Unknown result type (might be due to invalid IL or missing references) + //IL_0acc: Expected O, but got Unknown + //IL_0acf: Unknown result type (might be due to invalid IL or missing references) + //IL_0ad9: Expected O, but got Unknown + //IL_0ae6: Unknown result type (might be due to invalid IL or missing references) + //IL_0af0: Expected O, but got Unknown + //IL_0af3: Unknown result type (might be due to invalid IL or missing references) + //IL_0afd: Expected O, but got Unknown + //IL_0b00: Unknown result type (might be due to invalid IL or missing references) + //IL_0b0a: Expected O, but got Unknown + //IL_0b0c: Unknown result type (might be due to invalid IL or missing references) + //IL_0b18: Unknown result type (might be due to invalid IL or missing references) + //IL_0b22: Expected O, but got Unknown + //IL_0b25: Unknown result type (might be due to invalid IL or missing references) + //IL_0b2f: Expected O, but got Unknown + //IL_0b32: Unknown result type (might be due to invalid IL or missing references) + //IL_0b3c: Expected O, but got Unknown + //IL_0b49: Unknown result type (might be due to invalid IL or missing references) + //IL_0b53: Expected O, but got Unknown + //IL_0b60: Unknown result type (might be due to invalid IL or missing references) + //IL_0b6a: Expected O, but got Unknown + //IL_0b77: Unknown result type (might be due to invalid IL or missing references) + //IL_0b81: Expected O, but got Unknown + //IL_0b8e: Unknown result type (might be due to invalid IL or missing references) + //IL_0b98: Expected O, but got Unknown + //IL_0ba5: Unknown result type (might be due to invalid IL or missing references) + //IL_0baf: Expected O, but got Unknown + //IL_0bb2: Unknown result type (might be due to invalid IL or missing references) + //IL_0bbc: Expected O, but got Unknown + //IL_0bc9: Unknown result type (might be due to invalid IL or missing references) + //IL_0bd3: Expected O, but got Unknown + //IL_0be0: Unknown result type (might be due to invalid IL or missing references) + //IL_0bea: Expected O, but got Unknown + //IL_0bf7: Unknown result type (might be due to invalid IL or missing references) + //IL_0c01: Expected O, but got Unknown + //IL_0c0e: Unknown result type (might be due to invalid IL or missing references) + //IL_0c18: Expected O, but got Unknown + //IL_0c25: Unknown result type (might be due to invalid IL or missing references) + //IL_0c2f: Expected O, but got Unknown + //IL_0c3f: Unknown result type (might be due to invalid IL or missing references) + //IL_0c49: Expected O, but got Unknown + //IL_0c56: Unknown result type (might be due to invalid IL or missing references) + //IL_0c60: Expected O, but got Unknown + //IL_0c6d: Unknown result type (might be due to invalid IL or missing references) + //IL_0c77: Expected O, but got Unknown + //IL_0c7a: Unknown result type (might be due to invalid IL or missing references) + //IL_0c84: Expected O, but got Unknown + //IL_0c91: Unknown result type (might be due to invalid IL or missing references) + //IL_0c9b: Expected O, but got Unknown + //IL_0c9e: Unknown result type (might be due to invalid IL or missing references) + //IL_0ca8: Expected O, but got Unknown + //IL_0cb5: Unknown result type (might be due to invalid IL or missing references) + //IL_0cbf: Expected O, but got Unknown + //IL_0cc2: Unknown result type (might be due to invalid IL or missing references) + //IL_0ccc: Expected O, but got Unknown + //IL_0cd9: Unknown result type (might be due to invalid IL or missing references) + //IL_0ce3: Expected O, but got Unknown + //IL_0ce6: Unknown result type (might be due to invalid IL or missing references) + //IL_0cf0: Expected O, but got Unknown + //IL_0cfd: Unknown result type (might be due to invalid IL or missing references) + //IL_0d07: Expected O, but got Unknown + //IL_0d14: Unknown result type (might be due to invalid IL or missing references) + //IL_0d1e: Expected O, but got Unknown + //IL_0d21: Unknown result type (might be due to invalid IL or missing references) + //IL_0d2b: Expected O, but got Unknown + //IL_0d2d: Unknown result type (might be due to invalid IL or missing references) + //IL_0d39: Unknown result type (might be due to invalid IL or missing references) + //IL_0d43: Expected O, but got Unknown + //IL_0d46: Unknown result type (might be due to invalid IL or missing references) + //IL_0d50: Expected O, but got Unknown + //IL_0d5d: Unknown result type (might be due to invalid IL or missing references) + //IL_0d67: Expected O, but got Unknown + //IL_0d6a: Unknown result type (might be due to invalid IL or missing references) + //IL_0d74: Expected O, but got Unknown + //IL_0d81: Unknown result type (might be due to invalid IL or missing references) + //IL_0d8b: Expected O, but got Unknown + //IL_0d8e: Unknown result type (might be due to invalid IL or missing references) + //IL_0d98: Expected O, but got Unknown + //IL_0d9a: Unknown result type (might be due to invalid IL or missing references) + //IL_0da6: Unknown result type (might be due to invalid IL or missing references) + //IL_0db0: Expected O, but got Unknown + //IL_0db3: Unknown result type (might be due to invalid IL or missing references) + //IL_0dbd: Expected O, but got Unknown + //IL_0dbf: Unknown result type (might be due to invalid IL or missing references) + //IL_0dcb: Unknown result type (might be due to invalid IL or missing references) + //IL_0dd5: Expected O, but got Unknown + //IL_0dd7: Unknown result type (might be due to invalid IL or missing references) + //IL_0de3: Unknown result type (might be due to invalid IL or missing references) + //IL_0ded: Expected O, but got Unknown + //IL_0df0: Unknown result type (might be due to invalid IL or missing references) + //IL_0dfa: Expected O, but got Unknown + //IL_0e07: Unknown result type (might be due to invalid IL or missing references) + //IL_0e11: Expected O, but got Unknown + //IL_0e13: Unknown result type (might be due to invalid IL or missing references) + //IL_0e1f: Unknown result type (might be due to invalid IL or missing references) + //IL_0e29: Expected O, but got Unknown + //IL_0e2b: Unknown result type (might be due to invalid IL or missing references) + //IL_0e37: Unknown result type (might be due to invalid IL or missing references) + //IL_0e41: Expected O, but got Unknown + //IL_0e44: Unknown result type (might be due to invalid IL or missing references) + //IL_0e4e: Expected O, but got Unknown + //IL_0e50: Unknown result type (might be due to invalid IL or missing references) + //IL_0e5c: Unknown result type (might be due to invalid IL or missing references) + //IL_0e66: Expected O, but got Unknown + //IL_0e68: Unknown result type (might be due to invalid IL or missing references) + //IL_0e74: Unknown result type (might be due to invalid IL or missing references) + //IL_0e7e: Expected O, but got Unknown + //IL_0e81: Unknown result type (might be due to invalid IL or missing references) + //IL_0e8b: Expected O, but got Unknown + //IL_0e8d: Unknown result type (might be due to invalid IL or missing references) + //IL_0e99: Unknown result type (might be due to invalid IL or missing references) + //IL_0ea3: Expected O, but got Unknown + //IL_0ea6: Unknown result type (might be due to invalid IL or missing references) + //IL_0eb0: Expected O, but got Unknown + //IL_0eb3: Unknown result type (might be due to invalid IL or missing references) + //IL_0ebd: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((FrameworkElement)(MainWindow)target).Loaded += new RoutedEventHandler(Window_Loaded); + ((FrameworkElement)(MainWindow)target).Initialized += MainWindow_OnInitialized; + ((FrameworkElement)(MainWindow)target).SizeChanged += new SizeChangedEventHandler(MainWindow_OnSizeChanged); + break; + case 2: + WindowChrome = (WindowChrome)target; + break; + case 3: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(CartaoVisita_OnClick); + break; + case 4: + ((MenuItem)target).Click += new RoutedEventHandler(Notas_OnClick); + break; + case 5: + ((MenuItem)target).Click += new RoutedEventHandler(Tarefas_OnClick); + break; + case 6: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Agenda_OnClick); + break; + case 7: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(MenuGestorMobile_OnClick); + break; + case 8: + ((MenuItem)target).Click += new RoutedEventHandler(Atendimentos_OnClick); + break; + case 9: + ((MenuItem)target).Click += new RoutedEventHandler(BoletosNotas_OnClick); + break; + case 10: + ((MenuItem)target).Click += new RoutedEventHandler(Contratos_OnClick); + break; + case 11: + ((MenuItem)target).Click += new RoutedEventHandler(Instalacao_OnClick); + break; + case 12: + ((MenuItem)target).Click += new RoutedEventHandler(CopiarChave_OnClick); + break; + case 13: + ((MenuItem)target).Click += new RoutedEventHandler(AcessoRemoto_OnClick); + break; + case 14: + MinimizeButton = (Grid)target; + ((UIElement)MinimizeButton).MouseLeftButtonDown += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonDown); + ((UIElement)MinimizeButton).MouseLeftButtonUp += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonUp); + break; + case 15: + MaximizeButton = (Grid)target; + ((UIElement)MaximizeButton).MouseLeftButtonDown += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonDown); + ((UIElement)MaximizeButton).MouseLeftButtonUp += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonUp); + break; + case 16: + CloseButton = (Grid)target; + ((UIElement)CloseButton).MouseLeftButtonDown += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonDown); + ((UIElement)CloseButton).MouseLeftButtonUp += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonUp); + break; + case 17: + MainMenu = (HamburgerMenu)target; + break; + case 18: + CentralDeNegociosMenu = (HamburgerMenuItem)target; + break; + case 19: + DashBoard = (HamburgerMenuItem)target; + DashBoard.Click += new RoutedEventHandler(DashBoard_OnClick); + break; + case 20: + PainelBi = (HamburgerMenuItem)target; + PainelBi.Click += new RoutedEventHandler(PainelBi_OnClick); + break; + case 21: + Prospeccao = (HamburgerMenuItem)target; + Prospeccao.Click += new RoutedEventHandler(Prospeccao_OnClick); + break; + case 22: + SegurosMenu = (HamburgerMenuItem)target; + SegurosMenu.DoubleClick += new RoutedEventHandler(Consultar_OnClick); + break; + case 23: + Consulta = (HamburgerMenuItem)target; + Consulta.Click += new RoutedEventHandler(Consultar_OnClick); + break; + case 24: + Clientes = (HamburgerMenuItem)target; + Clientes.Click += new RoutedEventHandler(Clientes_OnClick); + break; + case 25: + Apolices = (HamburgerMenuItem)target; + Apolices.Click += new RoutedEventHandler(Apolices_OnClick); + break; + case 26: + Itens = (HamburgerMenuItem)target; + Itens.Click += new RoutedEventHandler(Itens_OnClick); + break; + case 27: + Sinistros = (HamburgerMenuItem)target; + Sinistros.Click += new RoutedEventHandler(Sinistros_OnClick); + break; + case 28: + ImportPdf = (HamburgerMenuItem)target; + ImportPdf.Click += new RoutedEventHandler(ImportPdf_OnClick); + break; + case 29: + CriticaPdf = (HamburgerMenuItem)target; + CriticaPdf.Click += new RoutedEventHandler(CriticaPdf_OnClick); + break; + case 30: + Comissao = (HamburgerMenuItem)target; + Comissao.Click += new RoutedEventHandler(Comissao_OnClick); + break; + case 31: + RelatoriosMenu = (HamburgerMenuItem)target; + break; + case 32: + RelatoriosCliente = (HamburgerMenuItem)target; + RelatoriosCliente.Click += new RoutedEventHandler(Relatorios_OnClick); + break; + case 33: + RelatoriosDocumentos = (HamburgerMenuItem)target; + RelatoriosDocumentos.Click += new RoutedEventHandler(Relatorios_OnClick); + break; + case 34: + RelatoriosParcelas = (HamburgerMenuItem)target; + RelatoriosParcelas.Click += new RoutedEventHandler(Relatorios_OnClick); + break; + case 35: + RelatoriosSinistros = (HamburgerMenuItem)target; + RelatoriosSinistros.Click += new RoutedEventHandler(Relatorios_OnClick); + break; + case 36: + RelatoriosFechamento = (HamburgerMenuItem)target; + RelatoriosFechamento.Click += new RoutedEventHandler(Relatorios_OnClick); + break; + case 37: + RelatoriosExtrato = (HamburgerMenuItem)target; + RelatoriosExtrato.Click += new RoutedEventHandler(Relatorios_OnClick); + break; + case 38: + RelatoriosNotas = (HamburgerMenuItem)target; + RelatoriosNotas.Click += new RoutedEventHandler(Relatorios_OnClick); + break; + case 39: + RelatoriosTarefas = (HamburgerMenuItem)target; + RelatoriosTarefas.Click += new RoutedEventHandler(Relatorios_OnClick); + break; + case 40: + RelatoriosLogs = (HamburgerMenuItem)target; + RelatoriosLogs.Click += new RoutedEventHandler(Relatorios_OnClick); + break; + case 41: + ExtratoConta = (HamburgerMenuItem)target; + ExtratoConta.Click += new RoutedEventHandler(ExtratoConta_OnClick); + break; + case 42: + FechamentoFinanceiro = (HamburgerMenuItem)target; + FechamentoFinanceiro.Click += new RoutedEventHandler(FechamentoFinanceiro_OnClick); + break; + case 43: + Assinatura = (HamburgerMenuItem)target; + Assinatura.Click += new RoutedEventHandler(Assinatura_OnClick); + break; + case 44: + Aggilizador = (HamburgerMenuItem)target; + Aggilizador.Click += new RoutedEventHandler(Aggilizador_OnClick); + break; + case 45: + Epic = (HamburgerMenuItem)target; + Epic.Click += new RoutedEventHandler(Epic_OnClick); + break; + case 46: + FinanceiroMenu = (HamburgerMenuItem)target; + FinanceiroMenu.Click += new RoutedEventHandler(FinanceiroMenu_OnClick); + break; + case 47: + Conta = (HamburgerMenuItem)target; + Conta.Click += new RoutedEventHandler(Conta_OnClick); + break; + case 48: + Centro = (HamburgerMenuItem)target; + Centro.Click += new RoutedEventHandler(Centro_OnClick); + break; + case 49: + Fornecedor = (HamburgerMenuItem)target; + Fornecedor.Click += new RoutedEventHandler(Fornecedor_OnClick); + break; + case 50: + Plano = (HamburgerMenuItem)target; + Plano.Click += new RoutedEventHandler(Plano_OnClick); + break; + case 51: + FerramentasMenu = (HamburgerMenuItem)target; + break; + case 52: + Emails = (HamburgerMenuItem)target; + Emails.Click += new RoutedEventHandler(Emails_OnClick); + break; + case 53: + Empresa = (HamburgerMenuItem)target; + Empresa.Click += new RoutedEventHandler(Empresa_OnClick); + break; + case 54: + Estipulantes = (HamburgerMenuItem)target; + Estipulantes.Click += new RoutedEventHandler(Estipulantes_OnClick); + break; + case 55: + ManutencaoPagamentos = (HamburgerMenuItem)target; + ManutencaoPagamentos.Click += new RoutedEventHandler(Manutencao_OnClick); + break; + case 56: + NotaFiscal = (HamburgerMenuItem)target; + NotaFiscal.Click += new RoutedEventHandler(NotaFiscal_OnClick); + break; + case 57: + Parceiro = (HamburgerMenuItem)target; + Parceiro.Click += new RoutedEventHandler(Parceiro_OnClick); + break; + case 58: + Produtos = (HamburgerMenuItem)target; + Produtos.Click += new RoutedEventHandler(Produtos_OnClick); + break; + case 59: + ((HamburgerMenuItem)target).Click += new RoutedEventHandler(Protocolos_OnClick); + break; + case 60: + Qualificacao = (HamburgerMenuItem)target; + Qualificacao.Click += new RoutedEventHandler(Qualificacao_OnClick); + break; + case 61: + Ramos = (HamburgerMenuItem)target; + Ramos.Click += new RoutedEventHandler(Ramos_OnClick); + break; + case 62: + Recibo = (HamburgerMenuItem)target; + Recibo.Click += new RoutedEventHandler(Recibo_OnClick); + break; + case 63: + Seguradoras = (HamburgerMenuItem)target; + Seguradoras.Click += new RoutedEventHandler(Seguradoras_OnClick); + break; + case 64: + Socio = (HamburgerMenuItem)target; + Socio.Click += new RoutedEventHandler(Socio_OnClick); + break; + case 65: + Statuses = (HamburgerMenuItem)target; + Statuses.Click += new RoutedEventHandler(Status_OnClick); + break; + case 66: + StatusProspeccao = (HamburgerMenuItem)target; + StatusProspeccao.Click += new RoutedEventHandler(StatusProspeccao_OnClick); + break; + case 67: + TipoTarefa = (HamburgerMenuItem)target; + TipoTarefa.Click += new RoutedEventHandler(TipoTarefa_OnClick); + break; + case 68: + TipoVendedor = (HamburgerMenuItem)target; + TipoVendedor.Click += new RoutedEventHandler(TipoVendedor_OnClick); + break; + case 69: + Usuarios = (HamburgerMenuItem)target; + Usuarios.Click += new RoutedEventHandler(Usuarios_OnClick); + break; + case 70: + Vendedores = (HamburgerMenuItem)target; + Vendedores.Click += new RoutedEventHandler(Vendedores_OnClick); + break; + case 71: + Area = (RowDefinition)target; + break; + case 72: + Status = (ComboBox)target; + break; + case 73: + ((UIElement)(PackIcon)target).MouseDown += new MouseButtonEventHandler(Medalha_OnMouseDown); + break; + case 74: + FiltroClienteTipoBox = (ComboBox)target; + break; + case 75: + PesquisaCliente = (AutoCompleteBox)target; + PesquisaCliente.Populating += new PopulatingEventHandler(AutoCompleteBox_Populating); + ((UIElement)PesquisaCliente).GotKeyboardFocus += new KeyboardFocusChangedEventHandler(AutoCompleteCliente_OnGotKeyboardFocus); + PesquisaCliente.SelectionChanged += new SelectionChangedEventHandler(PesquisaCliente_SelectionChanged); + ((UIElement)PesquisaCliente).PreviewKeyDown += new KeyEventHandler(PesquisaCliente_PreviewKeyDown); + ((Control)PesquisaCliente).MouseDoubleClick += new MouseButtonEventHandler(PesquisaCliente_MouseDoubleClick); + break; + case 76: + PesquisaClienteNome = (AutoCompleteBox)target; + PesquisaClienteNome.Populating += new PopulatingEventHandler(AutoCompleteNomeBox_Populating); + ((UIElement)PesquisaClienteNome).GotKeyboardFocus += new KeyboardFocusChangedEventHandler(AutoCompleteCliente_OnGotKeyboardFocus); + PesquisaClienteNome.SelectionChanged += new SelectionChangedEventHandler(PesquisaCliente_SelectionChanged); + ((UIElement)PesquisaClienteNome).PreviewKeyDown += new KeyEventHandler(PesquisaCliente_PreviewKeyDown); + ((Control)PesquisaClienteNome).MouseDoubleClick += new MouseButtonEventHandler(PesquisaCliente_MouseDoubleClick); + break; + case 77: + LoadingAutoComplete = (Loading)target; + break; + case 78: + DocumentoPrincipalBox = (TextBox)target; + ((Control)DocumentoPrincipalBox).MouseDoubleClick += new MouseButtonEventHandler(DocumentoPrincipal_MouseDoubleClick); + ((UIElement)DocumentoPrincipalBox).MouseRightButtonUp += new MouseButtonEventHandler(CopiarDocumento_Click); + break; + case 79: + ObservacaoApolice = (Button)target; + ((ButtonBase)ObservacaoApolice).Click += new RoutedEventHandler(Observacoes_OnClick); + break; + case 80: + PesquisaAvancada = (MenuItem)target; + PesquisaAvancada.Click += new RoutedEventHandler(PesquisaAvancada_OnClick); + break; + case 81: + Voltar = (MenuItem)target; + Voltar.Click += new RoutedEventHandler(Voltar_OnClick); + break; + case 84: + ContentControl = (ContentControl)target; + ((UIElement)ContentControl).GotFocus += new RoutedEventHandler(ContentControl_GotFocus); + ((UIElement)ContentControl).MouseLeftButtonDown += new MouseButtonEventHandler(ContentControl_MouseLeftButtonDown); + break; + case 85: + QrCode = (PopupBox)target; + break; + case 86: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(MenuGestorMobile_OnClick); + break; + case 87: + ImageAppStore = (Image)target; + ((UIElement)ImageAppStore).MouseLeftButtonUp += new MouseButtonEventHandler(ImageAppStore_OnMouseLeftButtonUp); + break; + case 88: + ImageGooglePlay = (Image)target; + ((UIElement)ImageGooglePlay).MouseLeftButtonUp += new MouseButtonEventHandler(ImageGooglePlay_OnMouseLeftButtonUp); + break; + case 89: + SessionNumber = (TextBlock)target; + break; + case 90: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(CopyCode_Click); + break; + case 91: + BoletoPopup = (PopupBox)target; + break; + case 92: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(OcultarBoleto_OnClick); + break; + case 93: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Fechar_OnClick); + break; + case 95: + HelpPopup = (PopupBox)target; + HelpPopup.Opened += new RoutedEventHandler(HelpPopup_Opened); + break; + case 96: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(OcultarAjuda_OnClick); + break; + case 97: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Fechar_OnClick); + break; + case 100: + TarefaPopup = (StackPanel)target; + break; + case 101: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Tarefas_OnClick); + break; + case 102: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(OcultarTarefas_OnClick); + break; + case 103: + Snackbar = (Snackbar)target; + break; + case 104: + ((SnackbarMessage)target).ActionClick += new RoutedEventHandler(SnackbarMessage_ActionClick); + break; + case 105: + ProgressRing = (Grid)target; + break; + case 106: + DrawerHost = (DrawerHost)target; + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_0051: Unknown result type (might be due to invalid IL or missing references) + //IL_005d: Unknown result type (might be due to invalid IL or missing references) + //IL_0067: Expected O, but got Unknown + //IL_0021: Unknown result type (might be due to invalid IL or missing references) + //IL_002d: Unknown result type (might be due to invalid IL or missing references) + //IL_0037: Expected O, but got Unknown + //IL_0069: Unknown result type (might be due to invalid IL or missing references) + //IL_0075: Unknown result type (might be due to invalid IL or missing references) + //IL_007f: Expected O, but got Unknown + //IL_0039: Unknown result type (might be due to invalid IL or missing references) + //IL_0045: Unknown result type (might be due to invalid IL or missing references) + //IL_004f: Expected O, but got Unknown + //IL_0081: Unknown result type (might be due to invalid IL or missing references) + //IL_008d: Unknown result type (might be due to invalid IL or missing references) + //IL_0097: Expected O, but got Unknown + switch (connectionId) + { + case 82: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(CopyTelefoneToClipBoard_Click); + break; + case 83: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(WhatsAppMessage_Click); + break; + case 94: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Boleto_OnClick); + break; + case 98: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(CopyLink_OnClick); + break; + case 99: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Play_Click); + break; + } + } +} diff --git a/Decompiler/IWshRuntimeLibrary/IWshShell.cs b/Decompiler/IWshRuntimeLibrary/IWshShell.cs new file mode 100644 index 0000000..b3475be --- /dev/null +++ b/Decompiler/IWshRuntimeLibrary/IWshShell.cs @@ -0,0 +1,12 @@ +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace IWshRuntimeLibrary; + +[ComImport] +[CompilerGenerated] +[Guid("F935DC21-1CF0-11D0-ADB9-00C04FD58A0B")] +[TypeIdentifier] +public interface IWshShell +{ +} diff --git a/Decompiler/IWshRuntimeLibrary/IWshShell2.cs b/Decompiler/IWshRuntimeLibrary/IWshShell2.cs new file mode 100644 index 0000000..53975b4 --- /dev/null +++ b/Decompiler/IWshRuntimeLibrary/IWshShell2.cs @@ -0,0 +1,12 @@ +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace IWshRuntimeLibrary; + +[ComImport] +[CompilerGenerated] +[Guid("24BE5A30-EDFE-11D2-B933-00104B365C9F")] +[TypeIdentifier] +public interface IWshShell2 : IWshShell +{ +} diff --git a/Decompiler/IWshRuntimeLibrary/IWshShell3.cs b/Decompiler/IWshRuntimeLibrary/IWshShell3.cs new file mode 100644 index 0000000..5ead586 --- /dev/null +++ b/Decompiler/IWshRuntimeLibrary/IWshShell3.cs @@ -0,0 +1,18 @@ +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace IWshRuntimeLibrary; + +[ComImport] +[CompilerGenerated] +[Guid("41904400-BE18-11D3-A28B-00104BD35090")] +[TypeIdentifier] +public interface IWshShell3 : IWshShell2 +{ + void _VtblGap1_4(); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + [DispId(1002)] + [return: MarshalAs(UnmanagedType.IDispatch)] + object CreateShortcut([In][MarshalAs(UnmanagedType.BStr)] string PathLink); +} diff --git a/Decompiler/IWshRuntimeLibrary/IWshShortcut.cs b/Decompiler/IWshRuntimeLibrary/IWshShortcut.cs new file mode 100644 index 0000000..65516b5 --- /dev/null +++ b/Decompiler/IWshRuntimeLibrary/IWshShortcut.cs @@ -0,0 +1,102 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace IWshRuntimeLibrary; + +[ComImport] +[CompilerGenerated] +[DefaultMember("FullName")] +[Guid("F935DC23-1CF0-11D0-ADB9-00C04FD58A0B")] +[TypeIdentifier] +public interface IWshShortcut +{ + [DispId(0)] + string FullName + { + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + [DispId(0)] + [return: MarshalAs(UnmanagedType.BStr)] + get; + } + + void _VtblGap1_2(); + + [DispId(1001)] + string Description + { + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + [DispId(1001)] + [return: MarshalAs(UnmanagedType.BStr)] + get; + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + [DispId(1001)] + [param: In] + [param: MarshalAs(UnmanagedType.BStr)] + set; + } + + void _VtblGap2_2(); + + [DispId(1003)] + string IconLocation + { + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + [DispId(1003)] + [return: MarshalAs(UnmanagedType.BStr)] + get; + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + [DispId(1003)] + [param: In] + [param: MarshalAs(UnmanagedType.BStr)] + set; + } + + void _VtblGap3_1(); + + [DispId(1005)] + string TargetPath + { + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + [DispId(1005)] + [return: MarshalAs(UnmanagedType.BStr)] + get; + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + [DispId(1005)] + [param: In] + [param: MarshalAs(UnmanagedType.BStr)] + set; + } + + [DispId(1006)] + int WindowStyle + { + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + [DispId(1006)] + get; + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + [DispId(1006)] + [param: In] + set; + } + + [DispId(1007)] + string WorkingDirectory + { + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + [DispId(1007)] + [return: MarshalAs(UnmanagedType.BStr)] + get; + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + [DispId(1007)] + [param: In] + [param: MarshalAs(UnmanagedType.BStr)] + set; + } + + void _VtblGap4_1(); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + [DispId(2001)] + void Save(); +} diff --git a/Decompiler/IWshRuntimeLibrary/WshShell.cs b/Decompiler/IWshRuntimeLibrary/WshShell.cs new file mode 100644 index 0000000..ebb0a18 --- /dev/null +++ b/Decompiler/IWshRuntimeLibrary/WshShell.cs @@ -0,0 +1,13 @@ +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace IWshRuntimeLibrary; + +[ComImport] +[CompilerGenerated] +[Guid("41904400-BE18-11D3-A28B-00104BD35090")] +[CoClass(typeof(object))] +[TypeIdentifier] +public interface WshShell : IWshShell3 +{ +} diff --git a/Decompiler/Microsoft.Office.Interop.Excel/AppEvents.cs b/Decompiler/Microsoft.Office.Interop.Excel/AppEvents.cs new file mode 100644 index 0000000..80fdb96 --- /dev/null +++ b/Decompiler/Microsoft.Office.Interop.Excel/AppEvents.cs @@ -0,0 +1,13 @@ +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace Microsoft.Office.Interop.Excel; + +[ComImport] +[CompilerGenerated] +[InterfaceType(2)] +[Guid("00024413-0000-0000-C000-000000000046")] +[TypeIdentifier] +public interface AppEvents +{ +} diff --git a/Decompiler/Microsoft.Office.Interop.Excel/AppEvents_Event.cs b/Decompiler/Microsoft.Office.Interop.Excel/AppEvents_Event.cs new file mode 100644 index 0000000..912e61f --- /dev/null +++ b/Decompiler/Microsoft.Office.Interop.Excel/AppEvents_Event.cs @@ -0,0 +1,12 @@ +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace Microsoft.Office.Interop.Excel; + +[ComImport] +[CompilerGenerated] +[ComEventInterface(typeof(AppEvents), typeof(AppEvents))] +[TypeIdentifier("00020813-0000-0000-c000-000000000046", "Microsoft.Office.Interop.Excel.AppEvents_Event")] +public interface AppEvents_Event +{ +} diff --git a/Decompiler/Microsoft.Office.Interop.Excel/Application.cs b/Decompiler/Microsoft.Office.Interop.Excel/Application.cs new file mode 100644 index 0000000..4314dec --- /dev/null +++ b/Decompiler/Microsoft.Office.Interop.Excel/Application.cs @@ -0,0 +1,13 @@ +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace Microsoft.Office.Interop.Excel; + +[ComImport] +[CompilerGenerated] +[Guid("000208D5-0000-0000-C000-000000000046")] +[CoClass(typeof(object))] +[TypeIdentifier] +public interface Application : _Application, AppEvents_Event +{ +} diff --git a/Decompiler/Microsoft.Office.Interop.Excel/DocEvents.cs b/Decompiler/Microsoft.Office.Interop.Excel/DocEvents.cs new file mode 100644 index 0000000..b9cbb1c --- /dev/null +++ b/Decompiler/Microsoft.Office.Interop.Excel/DocEvents.cs @@ -0,0 +1,13 @@ +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace Microsoft.Office.Interop.Excel; + +[ComImport] +[CompilerGenerated] +[InterfaceType(2)] +[Guid("00024411-0000-0000-C000-000000000046")] +[TypeIdentifier] +public interface DocEvents +{ +} diff --git a/Decompiler/Microsoft.Office.Interop.Excel/DocEvents_Event.cs b/Decompiler/Microsoft.Office.Interop.Excel/DocEvents_Event.cs new file mode 100644 index 0000000..657534c --- /dev/null +++ b/Decompiler/Microsoft.Office.Interop.Excel/DocEvents_Event.cs @@ -0,0 +1,12 @@ +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace Microsoft.Office.Interop.Excel; + +[ComImport] +[CompilerGenerated] +[ComEventInterface(typeof(DocEvents), typeof(DocEvents))] +[TypeIdentifier("00020813-0000-0000-c000-000000000046", "Microsoft.Office.Interop.Excel.DocEvents_Event")] +public interface DocEvents_Event +{ +} diff --git a/Decompiler/Microsoft.Office.Interop.Excel/Range.cs b/Decompiler/Microsoft.Office.Interop.Excel/Range.cs new file mode 100644 index 0000000..fa51b07 --- /dev/null +++ b/Decompiler/Microsoft.Office.Interop.Excel/Range.cs @@ -0,0 +1,63 @@ +using System.Collections; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace Microsoft.Office.Interop.Excel; + +[ComImport] +[CompilerGenerated] +[InterfaceType(2)] +[DefaultMember("_Default")] +[Guid("00020846-0000-0000-C000-000000000046")] +[TypeIdentifier] +public interface Range : IEnumerable +{ + void _VtblGap1_31(); + + [DispId(241)] + Range Columns + { + [MethodImpl(MethodImplOptions.PreserveSig | MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + [DispId(241)] + [return: MarshalAs(UnmanagedType.Interface)] + get; + } + + void _VtblGap2_6(); + + [DispId(118)] + int Count + { + [MethodImpl(MethodImplOptions.PreserveSig | MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + [DispId(118)] + get; + } + + void _VtblGap3_104(); + + [DispId(258)] + Range Rows + { + [MethodImpl(MethodImplOptions.PreserveSig | MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + [DispId(258)] + [return: MarshalAs(UnmanagedType.Interface)] + get; + } + + void _VtblGap4_31(); + + [DispId(1388)] + object Value2 + { + [MethodImpl(MethodImplOptions.PreserveSig | MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + [DispId(1388)] + [return: MarshalAs(UnmanagedType.Struct)] + get; + [MethodImpl(MethodImplOptions.PreserveSig | MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + [DispId(1388)] + [param: In] + [param: MarshalAs(UnmanagedType.Struct)] + set; + } +} diff --git a/Decompiler/Microsoft.Office.Interop.Excel/Sheets.cs b/Decompiler/Microsoft.Office.Interop.Excel/Sheets.cs new file mode 100644 index 0000000..e039c61 --- /dev/null +++ b/Decompiler/Microsoft.Office.Interop.Excel/Sheets.cs @@ -0,0 +1,21 @@ +using System.Collections; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace Microsoft.Office.Interop.Excel; + +[ComImport] +[CompilerGenerated] +[DefaultMember("_Default")] +[Guid("000208D7-0000-0000-C000-000000000046")] +[TypeIdentifier] +public interface Sheets : IEnumerable +{ + void _VtblGap1_10(); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + [DispId(-4)] + [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "System.Runtime.InteropServices.CustomMarshalers.EnumeratorToEnumVariantMarshaler, CustomMarshalers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + new IEnumerator GetEnumerator(); +} diff --git a/Decompiler/Microsoft.Office.Interop.Excel/Workbook.cs b/Decompiler/Microsoft.Office.Interop.Excel/Workbook.cs new file mode 100644 index 0000000..64f4515 --- /dev/null +++ b/Decompiler/Microsoft.Office.Interop.Excel/Workbook.cs @@ -0,0 +1,13 @@ +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace Microsoft.Office.Interop.Excel; + +[ComImport] +[CompilerGenerated] +[Guid("000208DA-0000-0000-C000-000000000046")] +[CoClass(typeof(object))] +[TypeIdentifier] +public interface Workbook : _Workbook, WorkbookEvents_Event +{ +} diff --git a/Decompiler/Microsoft.Office.Interop.Excel/WorkbookEvents.cs b/Decompiler/Microsoft.Office.Interop.Excel/WorkbookEvents.cs new file mode 100644 index 0000000..f9ccc2e --- /dev/null +++ b/Decompiler/Microsoft.Office.Interop.Excel/WorkbookEvents.cs @@ -0,0 +1,13 @@ +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace Microsoft.Office.Interop.Excel; + +[ComImport] +[CompilerGenerated] +[Guid("00024412-0000-0000-C000-000000000046")] +[InterfaceType(2)] +[TypeIdentifier] +public interface WorkbookEvents +{ +} diff --git a/Decompiler/Microsoft.Office.Interop.Excel/WorkbookEvents_Event.cs b/Decompiler/Microsoft.Office.Interop.Excel/WorkbookEvents_Event.cs new file mode 100644 index 0000000..1ac91de --- /dev/null +++ b/Decompiler/Microsoft.Office.Interop.Excel/WorkbookEvents_Event.cs @@ -0,0 +1,12 @@ +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace Microsoft.Office.Interop.Excel; + +[ComImport] +[CompilerGenerated] +[ComEventInterface(typeof(WorkbookEvents), typeof(WorkbookEvents))] +[TypeIdentifier("00020813-0000-0000-c000-000000000046", "Microsoft.Office.Interop.Excel.WorkbookEvents_Event")] +public interface WorkbookEvents_Event +{ +} diff --git a/Decompiler/Microsoft.Office.Interop.Excel/Workbooks.cs b/Decompiler/Microsoft.Office.Interop.Excel/Workbooks.cs new file mode 100644 index 0000000..f97d94b --- /dev/null +++ b/Decompiler/Microsoft.Office.Interop.Excel/Workbooks.cs @@ -0,0 +1,22 @@ +using System.Collections; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace Microsoft.Office.Interop.Excel; + +[ComImport] +[CompilerGenerated] +[Guid("000208DB-0000-0000-C000-000000000046")] +[DefaultMember("_Default")] +[TypeIdentifier] +public interface Workbooks : IEnumerable +{ + void _VtblGap1_12(); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + [DispId(1923)] + [LCIDConversion(15)] + [return: MarshalAs(UnmanagedType.Interface)] + Workbook Open([In][MarshalAs(UnmanagedType.BStr)] string Filename, [Optional][In][MarshalAs(UnmanagedType.Struct)] object UpdateLinks, [Optional][In][MarshalAs(UnmanagedType.Struct)] object ReadOnly, [Optional][In][MarshalAs(UnmanagedType.Struct)] object Format, [Optional][In][MarshalAs(UnmanagedType.Struct)] object Password, [Optional][In][MarshalAs(UnmanagedType.Struct)] object WriteResPassword, [Optional][In][MarshalAs(UnmanagedType.Struct)] object IgnoreReadOnlyRecommended, [Optional][In][MarshalAs(UnmanagedType.Struct)] object Origin, [Optional][In][MarshalAs(UnmanagedType.Struct)] object Delimiter, [Optional][In][MarshalAs(UnmanagedType.Struct)] object Editable, [Optional][In][MarshalAs(UnmanagedType.Struct)] object Notify, [Optional][In][MarshalAs(UnmanagedType.Struct)] object Converter, [Optional][In][MarshalAs(UnmanagedType.Struct)] object AddToMru, [Optional][In][MarshalAs(UnmanagedType.Struct)] object Local, [Optional][In][MarshalAs(UnmanagedType.Struct)] object CorruptLoad); +} diff --git a/Decompiler/Microsoft.Office.Interop.Excel/Worksheet.cs b/Decompiler/Microsoft.Office.Interop.Excel/Worksheet.cs new file mode 100644 index 0000000..99dbc8f --- /dev/null +++ b/Decompiler/Microsoft.Office.Interop.Excel/Worksheet.cs @@ -0,0 +1,13 @@ +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace Microsoft.Office.Interop.Excel; + +[ComImport] +[CompilerGenerated] +[CoClass(typeof(object))] +[Guid("000208D8-0000-0000-C000-000000000046")] +[TypeIdentifier] +public interface Worksheet : _Worksheet, DocEvents_Event +{ +} diff --git a/Decompiler/Microsoft.Office.Interop.Excel/_Application.cs b/Decompiler/Microsoft.Office.Interop.Excel/_Application.cs new file mode 100644 index 0000000..59b2cf5 --- /dev/null +++ b/Decompiler/Microsoft.Office.Interop.Excel/_Application.cs @@ -0,0 +1,41 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace Microsoft.Office.Interop.Excel; + +[ComImport] +[CompilerGenerated] +[DefaultMember("_Default")] +[Guid("000208D5-0000-0000-C000-000000000046")] +[TypeIdentifier] +public interface _Application +{ + void _VtblGap1_45(); + + [DispId(572)] + Workbooks Workbooks + { + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + [DispId(572)] + [return: MarshalAs(UnmanagedType.Interface)] + get; + } + + void _VtblGap2_60(); + + [DispId(0)] + string _Default + { + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + [DispId(0)] + [return: MarshalAs(UnmanagedType.BStr)] + get; + } + + void _VtblGap3_116(); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + [DispId(302)] + void Quit(); +} diff --git a/Decompiler/Microsoft.Office.Interop.Excel/_Workbook.cs b/Decompiler/Microsoft.Office.Interop.Excel/_Workbook.cs new file mode 100644 index 0000000..f862220 --- /dev/null +++ b/Decompiler/Microsoft.Office.Interop.Excel/_Workbook.cs @@ -0,0 +1,22 @@ +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace Microsoft.Office.Interop.Excel; + +[ComImport] +[CompilerGenerated] +[Guid("000208DA-0000-0000-C000-000000000046")] +[TypeIdentifier] +public interface _Workbook +{ + void _VtblGap1_124(); + + [DispId(494)] + Sheets Worksheets + { + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + [DispId(494)] + [return: MarshalAs(UnmanagedType.Interface)] + get; + } +} diff --git a/Decompiler/Microsoft.Office.Interop.Excel/_Worksheet.cs b/Decompiler/Microsoft.Office.Interop.Excel/_Worksheet.cs new file mode 100644 index 0000000..b68fdab --- /dev/null +++ b/Decompiler/Microsoft.Office.Interop.Excel/_Worksheet.cs @@ -0,0 +1,23 @@ +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace Microsoft.Office.Interop.Excel; + +[ComImport] +[CompilerGenerated] +[Guid("000208D8-0000-0000-C000-000000000046")] +[TypeIdentifier] +public interface _Worksheet +{ + void _VtblGap1_110(); + + [DispId(412)] + Range UsedRange + { + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + [DispId(412)] + [LCIDConversion(0)] + [return: MarshalAs(UnmanagedType.Interface)] + get; + } +} diff --git a/Decompiler/Properties/AssemblyInfo.cs b/Decompiler/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..5d8d62d --- /dev/null +++ b/Decompiler/Properties/AssemblyInfo.cs @@ -0,0 +1,27 @@ +using System.Diagnostics; +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Versioning; +using System.Windows; +using System.Windows.Resources; + +[assembly: AssemblyTitle("Gestor.Application")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Gestor.Application")] +[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyTrademark("")] +[assembly: NeutralResourcesLanguage("pt-BR", UltimateResourceFallbackLocation.MainAssembly)] +[assembly: ComVisible(false)] +[assembly: ThemeInfo(/*Could not decode attribute arguments.*/)] +[assembly: AssemblyFileVersion("8.4.0.0")] +[assembly: AssemblyAssociatedContentFile("migration/files/20251230_282.sql")] +[assembly: AssemblyAssociatedContentFile("migration/files/20251202_281.sql")] +[assembly: AssemblyAssociatedContentFile("migration/files/20251202_280.sql")] +[assembly: AssemblyAssociatedContentFile("resources/relatoriomultipletemplate.html")] +[assembly: AssemblyAssociatedContentFile("resources/tablemultipletemplate.html")] +[assembly: AssemblyAssociatedContentFile("assets/new.html")] +[assembly: AssemblyVersion("8.4.0.0")] diff --git a/Decompiler/app.baml b/Decompiler/app.baml new file mode 100644 index 0000000..cceb302 Binary files /dev/null and b/Decompiler/app.baml differ diff --git a/Decompiler/app.ico b/Decompiler/app.ico new file mode 100644 index 0000000..b03c339 Binary files /dev/null and b/Decompiler/app.ico differ diff --git a/Decompiler/assets/images/aggilizadordimgrayicon.png b/Decompiler/assets/images/aggilizadordimgrayicon.png new file mode 100644 index 0000000..a4fdb7d Binary files /dev/null and b/Decompiler/assets/images/aggilizadordimgrayicon.png differ diff --git a/Decompiler/assets/images/aggilizadoricon.png b/Decompiler/assets/images/aggilizadoricon.png new file mode 100644 index 0000000..79fc130 Binary files /dev/null and b/Decompiler/assets/images/aggilizadoricon.png differ diff --git a/Decompiler/assets/images/appstore.png b/Decompiler/assets/images/appstore.png new file mode 100644 index 0000000..8a1f416 Binary files /dev/null and b/Decompiler/assets/images/appstore.png differ diff --git a/Decompiler/assets/images/background_novo_gestor.png b/Decompiler/assets/images/background_novo_gestor.png new file mode 100644 index 0000000..3c89783 Binary files /dev/null and b/Decompiler/assets/images/background_novo_gestor.png differ diff --git a/Decompiler/assets/images/backgroung_gestor.png b/Decompiler/assets/images/backgroung_gestor.png new file mode 100644 index 0000000..fbe4fd9 Binary files /dev/null and b/Decompiler/assets/images/backgroung_gestor.png differ diff --git a/Decompiler/assets/images/calculoicon.png b/Decompiler/assets/images/calculoicon.png new file mode 100644 index 0000000..968681d Binary files /dev/null and b/Decompiler/assets/images/calculoicon.png differ diff --git a/Decompiler/assets/images/calculoiconoff.png b/Decompiler/assets/images/calculoiconoff.png new file mode 100644 index 0000000..eaa1b8c Binary files /dev/null and b/Decompiler/assets/images/calculoiconoff.png differ diff --git a/Decompiler/assets/images/calculoiconok.png b/Decompiler/assets/images/calculoiconok.png new file mode 100644 index 0000000..daf2aed Binary files /dev/null and b/Decompiler/assets/images/calculoiconok.png differ diff --git a/Decompiler/assets/images/gestor_loading.gif b/Decompiler/assets/images/gestor_loading.gif new file mode 100644 index 0000000..1d5e9a0 Binary files /dev/null and b/Decompiler/assets/images/gestor_loading.gif differ diff --git a/Decompiler/assets/images/gestor_splash_branco.gif b/Decompiler/assets/images/gestor_splash_branco.gif new file mode 100644 index 0000000..917d187 Binary files /dev/null and b/Decompiler/assets/images/gestor_splash_branco.gif differ diff --git a/Decompiler/assets/images/loading.gif b/Decompiler/assets/images/loading.gif new file mode 100644 index 0000000..e982ba0 Binary files /dev/null and b/Decompiler/assets/images/loading.gif differ diff --git a/Decompiler/assets/images/logo_novo_agger.png b/Decompiler/assets/images/logo_novo_agger.png new file mode 100644 index 0000000..97d7710 Binary files /dev/null and b/Decompiler/assets/images/logo_novo_agger.png differ diff --git a/Decompiler/assets/images/logo_novo_gestor_branco.png b/Decompiler/assets/images/logo_novo_gestor_branco.png new file mode 100644 index 0000000..36a5cec Binary files /dev/null and b/Decompiler/assets/images/logo_novo_gestor_branco.png differ diff --git a/Decompiler/assets/images/playstore.png b/Decompiler/assets/images/playstore.png new file mode 100644 index 0000000..234e243 Binary files /dev/null and b/Decompiler/assets/images/playstore.png differ diff --git a/Decompiler/assets/images/siggner_logo.png b/Decompiler/assets/images/siggner_logo.png new file mode 100644 index 0000000..26611ce Binary files /dev/null and b/Decompiler/assets/images/siggner_logo.png differ diff --git a/Decompiler/componentes/calculocontrol.baml b/Decompiler/componentes/calculocontrol.baml new file mode 100644 index 0000000..426386b Binary files /dev/null and b/Decompiler/componentes/calculocontrol.baml differ diff --git a/Decompiler/componentes/coberturaview.baml b/Decompiler/componentes/coberturaview.baml new file mode 100644 index 0000000..59fd2af Binary files /dev/null and b/Decompiler/componentes/coberturaview.baml differ diff --git a/Decompiler/componentes/contasdialog.baml b/Decompiler/componentes/contasdialog.baml new file mode 100644 index 0000000..c580ce9 Binary files /dev/null and b/Decompiler/componentes/contasdialog.baml differ diff --git a/Decompiler/componentes/customlegendchart.baml b/Decompiler/componentes/customlegendchart.baml new file mode 100644 index 0000000..7d1edba Binary files /dev/null and b/Decompiler/componentes/customlegendchart.baml differ diff --git a/Decompiler/componentes/custompasswordbox.baml b/Decompiler/componentes/custompasswordbox.baml new file mode 100644 index 0000000..b1e6af1 Binary files /dev/null and b/Decompiler/componentes/custompasswordbox.baml differ diff --git a/Decompiler/componentes/customsenhaloginbox.baml b/Decompiler/componentes/customsenhaloginbox.baml new file mode 100644 index 0000000..efc2665 Binary files /dev/null and b/Decompiler/componentes/customsenhaloginbox.baml differ diff --git a/Decompiler/componentes/defaultdialog.baml b/Decompiler/componentes/defaultdialog.baml new file mode 100644 index 0000000..12d3914 Binary files /dev/null and b/Decompiler/componentes/defaultdialog.baml differ diff --git a/Decompiler/componentes/dialogadvertising.baml b/Decompiler/componentes/dialogadvertising.baml new file mode 100644 index 0000000..56e0fe7 Binary files /dev/null and b/Decompiler/componentes/dialogadvertising.baml differ diff --git a/Decompiler/componentes/dialoganaliticobi.baml b/Decompiler/componentes/dialoganaliticobi.baml new file mode 100644 index 0000000..6609bf5 Binary files /dev/null and b/Decompiler/componentes/dialoganaliticobi.baml differ diff --git a/Decompiler/componentes/dialoganexar.baml b/Decompiler/componentes/dialoganexar.baml new file mode 100644 index 0000000..3a6e5b8 Binary files /dev/null and b/Decompiler/componentes/dialoganexar.baml differ diff --git a/Decompiler/componentes/dialogcopia.baml b/Decompiler/componentes/dialogcopia.baml new file mode 100644 index 0000000..15ed7c5 Binary files /dev/null and b/Decompiler/componentes/dialogcopia.baml differ diff --git a/Decompiler/componentes/dialogcopiarcliente.baml b/Decompiler/componentes/dialogcopiarcliente.baml new file mode 100644 index 0000000..b93601e Binary files /dev/null and b/Decompiler/componentes/dialogcopiarcliente.baml differ diff --git a/Decompiler/componentes/dialogcopiarpermissao.baml b/Decompiler/componentes/dialogcopiarpermissao.baml new file mode 100644 index 0000000..1f0a7b1 Binary files /dev/null and b/Decompiler/componentes/dialogcopiarpermissao.baml differ diff --git a/Decompiler/componentes/dialogdetalheextrato.baml b/Decompiler/componentes/dialogdetalheextrato.baml new file mode 100644 index 0000000..d6707e7 Binary files /dev/null and b/Decompiler/componentes/dialogdetalheextrato.baml differ diff --git a/Decompiler/componentes/dialogeditarparcelas.baml b/Decompiler/componentes/dialogeditarparcelas.baml new file mode 100644 index 0000000..0a8664a Binary files /dev/null and b/Decompiler/componentes/dialogeditarparcelas.baml differ diff --git a/Decompiler/componentes/dialogenviaremails.baml b/Decompiler/componentes/dialogenviaremails.baml new file mode 100644 index 0000000..4c400de Binary files /dev/null and b/Decompiler/componentes/dialogenviaremails.baml differ diff --git a/Decompiler/componentes/dialogexportarpermissao.baml b/Decompiler/componentes/dialogexportarpermissao.baml new file mode 100644 index 0000000..2d4cf95 Binary files /dev/null and b/Decompiler/componentes/dialogexportarpermissao.baml differ diff --git a/Decompiler/componentes/dialogextratocomissao.baml b/Decompiler/componentes/dialogextratocomissao.baml new file mode 100644 index 0000000..aea15b2 Binary files /dev/null and b/Decompiler/componentes/dialogextratocomissao.baml differ diff --git a/Decompiler/componentes/dialoggrafico.baml b/Decompiler/componentes/dialoggrafico.baml new file mode 100644 index 0000000..35ea9a0 Binary files /dev/null and b/Decompiler/componentes/dialoggrafico.baml differ diff --git a/Decompiler/componentes/dialoghoster.baml b/Decompiler/componentes/dialoghoster.baml new file mode 100644 index 0000000..dc86fb5 Binary files /dev/null and b/Decompiler/componentes/dialoghoster.baml differ diff --git a/Decompiler/componentes/dialoginstalacoes.baml b/Decompiler/componentes/dialoginstalacoes.baml new file mode 100644 index 0000000..68aa88d Binary files /dev/null and b/Decompiler/componentes/dialoginstalacoes.baml differ diff --git a/Decompiler/componentes/dialoglogacesso.baml b/Decompiler/componentes/dialoglogacesso.baml new file mode 100644 index 0000000..fb74be5 Binary files /dev/null and b/Decompiler/componentes/dialoglogacesso.baml differ diff --git a/Decompiler/componentes/dialogmedalha.baml b/Decompiler/componentes/dialogmedalha.baml new file mode 100644 index 0000000..b09c660 Binary files /dev/null and b/Decompiler/componentes/dialogmedalha.baml differ diff --git a/Decompiler/componentes/dialogobservacao.baml b/Decompiler/componentes/dialogobservacao.baml new file mode 100644 index 0000000..6fd0be2 Binary files /dev/null and b/Decompiler/componentes/dialogobservacao.baml differ diff --git a/Decompiler/componentes/dialogpesquisaavancada.baml b/Decompiler/componentes/dialogpesquisaavancada.baml new file mode 100644 index 0000000..1471b7e Binary files /dev/null and b/Decompiler/componentes/dialogpesquisaavancada.baml differ diff --git a/Decompiler/componentes/dialogprint.baml b/Decompiler/componentes/dialogprint.baml new file mode 100644 index 0000000..2ffe5f5 Binary files /dev/null and b/Decompiler/componentes/dialogprint.baml differ diff --git a/Decompiler/componentes/dialogprotocolo.baml b/Decompiler/componentes/dialogprotocolo.baml new file mode 100644 index 0000000..d309632 Binary files /dev/null and b/Decompiler/componentes/dialogprotocolo.baml differ diff --git a/Decompiler/componentes/dialogreordenaritens.baml b/Decompiler/componentes/dialogreordenaritens.baml new file mode 100644 index 0000000..e05963d Binary files /dev/null and b/Decompiler/componentes/dialogreordenaritens.baml differ diff --git a/Decompiler/componentes/dialogselecionaritens.baml b/Decompiler/componentes/dialogselecionaritens.baml new file mode 100644 index 0000000..5422b9a Binary files /dev/null and b/Decompiler/componentes/dialogselecionaritens.baml differ diff --git a/Decompiler/componentes/dialogsenhaadm.baml b/Decompiler/componentes/dialogsenhaadm.baml new file mode 100644 index 0000000..f439b36 Binary files /dev/null and b/Decompiler/componentes/dialogsenhaadm.baml differ diff --git a/Decompiler/componentes/dialogtarefa.baml b/Decompiler/componentes/dialogtarefa.baml new file mode 100644 index 0000000..4f75ff8 Binary files /dev/null and b/Decompiler/componentes/dialogtarefa.baml differ diff --git a/Decompiler/componentes/dialogtransferencia.baml b/Decompiler/componentes/dialogtransferencia.baml new file mode 100644 index 0000000..41271b3 Binary files /dev/null and b/Decompiler/componentes/dialogtransferencia.baml differ diff --git a/Decompiler/componentes/dialogtrilha.baml b/Decompiler/componentes/dialogtrilha.baml new file mode 100644 index 0000000..1ccf8a5 Binary files /dev/null and b/Decompiler/componentes/dialogtrilha.baml differ diff --git a/Decompiler/componentes/dialogvinculo.baml b/Decompiler/componentes/dialogvinculo.baml new file mode 100644 index 0000000..3ba67d1 Binary files /dev/null and b/Decompiler/componentes/dialogvinculo.baml differ diff --git a/Decompiler/componentes/errordialog.baml b/Decompiler/componentes/errordialog.baml new file mode 100644 index 0000000..8eb2aa3 Binary files /dev/null and b/Decompiler/componentes/errordialog.baml differ diff --git a/Decompiler/componentes/gridrelatorio.baml b/Decompiler/componentes/gridrelatorio.baml new file mode 100644 index 0000000..e1a9b07 Binary files /dev/null and b/Decompiler/componentes/gridrelatorio.baml differ diff --git a/Decompiler/componentes/loading.baml b/Decompiler/componentes/loading.baml new file mode 100644 index 0000000..0a4d438 Binary files /dev/null and b/Decompiler/componentes/loading.baml differ diff --git a/Decompiler/componentes/passbox.baml b/Decompiler/componentes/passbox.baml new file mode 100644 index 0000000..d334524 Binary files /dev/null and b/Decompiler/componentes/passbox.baml differ diff --git a/Decompiler/componentes/progressdialog.baml b/Decompiler/componentes/progressdialog.baml new file mode 100644 index 0000000..4445580 Binary files /dev/null and b/Decompiler/componentes/progressdialog.baml differ diff --git a/Decompiler/componentes/prospeccaodialog.baml b/Decompiler/componentes/prospeccaodialog.baml new file mode 100644 index 0000000..27e7008 Binary files /dev/null and b/Decompiler/componentes/prospeccaodialog.baml differ diff --git a/Decompiler/componentes/vincularlancamentodialog.baml b/Decompiler/componentes/vincularlancamentodialog.baml new file mode 100644 index 0000000..50bdb4d Binary files /dev/null and b/Decompiler/componentes/vincularlancamentodialog.baml differ diff --git a/Decompiler/componentes/webbrowser.baml b/Decompiler/componentes/webbrowser.baml new file mode 100644 index 0000000..6b5a667 Binary files /dev/null and b/Decompiler/componentes/webbrowser.baml differ diff --git a/Decompiler/componentes/webeditor.baml b/Decompiler/componentes/webeditor.baml new file mode 100644 index 0000000..79fe4ba Binary files /dev/null and b/Decompiler/componentes/webeditor.baml differ diff --git a/Decompiler/drawers/adiantamentodrawerview.baml b/Decompiler/drawers/adiantamentodrawerview.baml new file mode 100644 index 0000000..dd83539 Binary files /dev/null and b/Decompiler/drawers/adiantamentodrawerview.baml differ diff --git a/Decompiler/drawers/agendadrawer.baml b/Decompiler/drawers/agendadrawer.baml new file mode 100644 index 0000000..722c7ba Binary files /dev/null and b/Decompiler/drawers/agendadrawer.baml differ diff --git a/Decompiler/drawers/ajuda/boletosnotasdrawerview.baml b/Decompiler/drawers/ajuda/boletosnotasdrawerview.baml new file mode 100644 index 0000000..3128dce Binary files /dev/null and b/Decompiler/drawers/ajuda/boletosnotasdrawerview.baml differ diff --git a/Decompiler/drawers/ajuda/contratosdrawerview.baml b/Decompiler/drawers/ajuda/contratosdrawerview.baml new file mode 100644 index 0000000..d18664f Binary files /dev/null and b/Decompiler/drawers/ajuda/contratosdrawerview.baml differ diff --git a/Decompiler/drawers/ajuda/instalacaodrawerview.baml b/Decompiler/drawers/ajuda/instalacaodrawerview.baml new file mode 100644 index 0000000..501a9b5 Binary files /dev/null and b/Decompiler/drawers/ajuda/instalacaodrawerview.baml differ diff --git a/Decompiler/drawers/arquivodigitaldrawer.baml b/Decompiler/drawers/arquivodigitaldrawer.baml new file mode 100644 index 0000000..ed7aa83 Binary files /dev/null and b/Decompiler/drawers/arquivodigitaldrawer.baml differ diff --git a/Decompiler/drawers/configuracoes/configuracoesdrawer.baml b/Decompiler/drawers/configuracoes/configuracoesdrawer.baml new file mode 100644 index 0000000..c9296ad Binary files /dev/null and b/Decompiler/drawers/configuracoes/configuracoesdrawer.baml differ diff --git a/Decompiler/drawers/expedicaodrawer.baml b/Decompiler/drawers/expedicaodrawer.baml new file mode 100644 index 0000000..6915512 Binary files /dev/null and b/Decompiler/drawers/expedicaodrawer.baml differ diff --git a/Decompiler/drawers/extratosdrawer.baml b/Decompiler/drawers/extratosdrawer.baml new file mode 100644 index 0000000..e09b286 Binary files /dev/null and b/Decompiler/drawers/extratosdrawer.baml differ diff --git a/Decompiler/drawers/impostodrawer.baml b/Decompiler/drawers/impostodrawer.baml new file mode 100644 index 0000000..ddde801 Binary files /dev/null and b/Decompiler/drawers/impostodrawer.baml differ diff --git a/Decompiler/drawers/inclusaoarquivodigitaldrawer.baml b/Decompiler/drawers/inclusaoarquivodigitaldrawer.baml new file mode 100644 index 0000000..5d486f3 Binary files /dev/null and b/Decompiler/drawers/inclusaoarquivodigitaldrawer.baml differ diff --git a/Decompiler/drawers/infodrawer.baml b/Decompiler/drawers/infodrawer.baml new file mode 100644 index 0000000..4cc8d2b Binary files /dev/null and b/Decompiler/drawers/infodrawer.baml differ diff --git a/Decompiler/drawers/logdrawer.baml b/Decompiler/drawers/logdrawer.baml new file mode 100644 index 0000000..377bf1e Binary files /dev/null and b/Decompiler/drawers/logdrawer.baml differ diff --git a/Decompiler/drawers/logemaildrawer.baml b/Decompiler/drawers/logemaildrawer.baml new file mode 100644 index 0000000..6428a73 Binary files /dev/null and b/Decompiler/drawers/logemaildrawer.baml differ diff --git a/Decompiler/drawers/logsistemaantigo.baml b/Decompiler/drawers/logsistemaantigo.baml new file mode 100644 index 0000000..12b53d9 Binary files /dev/null and b/Decompiler/drawers/logsistemaantigo.baml differ diff --git a/Decompiler/drawers/logutilizacaodrawer.baml b/Decompiler/drawers/logutilizacaodrawer.baml new file mode 100644 index 0000000..918b3af Binary files /dev/null and b/Decompiler/drawers/logutilizacaodrawer.baml differ diff --git a/Decompiler/drawers/metaseguradoraview.baml b/Decompiler/drawers/metaseguradoraview.baml new file mode 100644 index 0000000..778cc63 Binary files /dev/null and b/Decompiler/drawers/metaseguradoraview.baml differ diff --git a/Decompiler/drawers/metavendedorview.baml b/Decompiler/drawers/metavendedorview.baml new file mode 100644 index 0000000..b28b240 Binary files /dev/null and b/Decompiler/drawers/metavendedorview.baml differ diff --git a/Decompiler/drawers/observacoesdrawer.baml b/Decompiler/drawers/observacoesdrawer.baml new file mode 100644 index 0000000..ec5a5e6 Binary files /dev/null and b/Decompiler/drawers/observacoesdrawer.baml differ diff --git a/Decompiler/drawers/permissaousuariodrawer.baml b/Decompiler/drawers/permissaousuariodrawer.baml new file mode 100644 index 0000000..5ab3e9e Binary files /dev/null and b/Decompiler/drawers/permissaousuariodrawer.baml differ diff --git a/Decompiler/drawers/relatorios/configuracaorelatorio.baml b/Decompiler/drawers/relatorios/configuracaorelatorio.baml new file mode 100644 index 0000000..d91062e Binary files /dev/null and b/Decompiler/drawers/relatorios/configuracaorelatorio.baml differ diff --git a/Decompiler/drawers/relatorios/filtrorelatorio.baml b/Decompiler/drawers/relatorios/filtrorelatorio.baml new file mode 100644 index 0000000..47ed3a9 Binary files /dev/null and b/Decompiler/drawers/relatorios/filtrorelatorio.baml differ diff --git a/Decompiler/drawers/tarefadrawer.baml b/Decompiler/drawers/tarefadrawer.baml new file mode 100644 index 0000000..07d4b3d Binary files /dev/null and b/Decompiler/drawers/tarefadrawer.baml differ diff --git a/Decompiler/drawers/valoresapolicedrawer.baml b/Decompiler/drawers/valoresapolicedrawer.baml new file mode 100644 index 0000000..beb1ca2 Binary files /dev/null and b/Decompiler/drawers/valoresapolicedrawer.baml differ diff --git a/Decompiler/drawers/valoresparceladrawer.baml b/Decompiler/drawers/valoresparceladrawer.baml new file mode 100644 index 0000000..86e53b5 Binary files /dev/null and b/Decompiler/drawers/valoresparceladrawer.baml differ diff --git a/Decompiler/drawers/vinculovendedordrawer.baml b/Decompiler/drawers/vinculovendedordrawer.baml new file mode 100644 index 0000000..47d093e Binary files /dev/null and b/Decompiler/drawers/vinculovendedordrawer.baml differ diff --git a/Decompiler/iconesistema.ico b/Decompiler/iconesistema.ico new file mode 100644 index 0000000..b03c339 Binary files /dev/null and b/Decompiler/iconesistema.ico differ diff --git a/Decompiler/iconesistema2024.ico b/Decompiler/iconesistema2024.ico new file mode 100644 index 0000000..f92c703 Binary files /dev/null and b/Decompiler/iconesistema2024.ico differ diff --git a/Decompiler/mainwindow.baml b/Decompiler/mainwindow.baml new file mode 100644 index 0000000..e3cf0a8 Binary files /dev/null and b/Decompiler/mainwindow.baml differ diff --git a/Decompiler/mshtml/DispHTMLDocument.cs b/Decompiler/mshtml/DispHTMLDocument.cs new file mode 100644 index 0000000..c839c26 --- /dev/null +++ b/Decompiler/mshtml/DispHTMLDocument.cs @@ -0,0 +1,85 @@ +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace mshtml; + +[ComImport] +[CompilerGenerated] +[InterfaceType(2)] +[Guid("3050F55F-98B5-11CF-BB82-00AA00BDCE0B")] +[TypeIdentifier] +public interface DispHTMLDocument +{ + void _VtblGap1_2(); + + [DispId(1004)] + IHTMLElement body + { + [MethodImpl(MethodImplOptions.PreserveSig | MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + [DispId(1004)] + [return: MarshalAs(UnmanagedType.Interface)] + get; + } + + void _VtblGap2_9(); + + [DispId(1014)] + string designMode + { + [MethodImpl(MethodImplOptions.PreserveSig | MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + [DispId(1014)] + [return: MarshalAs(UnmanagedType.BStr)] + get; + [MethodImpl(MethodImplOptions.PreserveSig | MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + [DispId(1014)] + [param: MarshalAs(UnmanagedType.BStr)] + set; + } + + [DispId(1017)] + IHTMLSelectionObject selection + { + [MethodImpl(MethodImplOptions.PreserveSig | MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + [DispId(1017)] + [return: MarshalAs(UnmanagedType.Interface)] + get; + } + + void _VtblGap3_25(); + + [DispId(1032)] + string charset + { + [MethodImpl(MethodImplOptions.PreserveSig | MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + [DispId(1032)] + [return: MarshalAs(UnmanagedType.BStr)] + get; + [MethodImpl(MethodImplOptions.PreserveSig | MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + [DispId(1032)] + [param: MarshalAs(UnmanagedType.BStr)] + set; + } + + void _VtblGap4_14(); + + [MethodImpl(MethodImplOptions.PreserveSig | MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + [DispId(1058)] + void clear(); + + void _VtblGap5_6(); + + [MethodImpl(MethodImplOptions.PreserveSig | MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + [DispId(1065)] + bool execCommand([In][MarshalAs(UnmanagedType.BStr)] string cmdID, [In] bool showUI = false, [Optional][In][MarshalAs(UnmanagedType.Struct)] object value); + + void _VtblGap6_48(); + + [DispId(1075)] + IHTMLElement documentElement + { + [MethodImpl(MethodImplOptions.PreserveSig | MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + [DispId(1075)] + [return: MarshalAs(UnmanagedType.Interface)] + get; + } +} diff --git a/Decompiler/mshtml/HTMLDocument.cs b/Decompiler/mshtml/HTMLDocument.cs new file mode 100644 index 0000000..acd8fe8 --- /dev/null +++ b/Decompiler/mshtml/HTMLDocument.cs @@ -0,0 +1,13 @@ +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace mshtml; + +[ComImport] +[CompilerGenerated] +[Guid("3050F55F-98B5-11CF-BB82-00AA00BDCE0B")] +[CoClass(typeof(object))] +[TypeIdentifier] +public interface HTMLDocument : DispHTMLDocument, HTMLDocumentEvents_Event +{ +} diff --git a/Decompiler/mshtml/HTMLDocumentEvents.cs b/Decompiler/mshtml/HTMLDocumentEvents.cs new file mode 100644 index 0000000..5118a08 --- /dev/null +++ b/Decompiler/mshtml/HTMLDocumentEvents.cs @@ -0,0 +1,13 @@ +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace mshtml; + +[ComImport] +[CompilerGenerated] +[InterfaceType(2)] +[Guid("3050F260-98B5-11CF-BB82-00AA00BDCE0B")] +[TypeIdentifier] +public interface HTMLDocumentEvents +{ +} diff --git a/Decompiler/mshtml/HTMLDocumentEvents_Event.cs b/Decompiler/mshtml/HTMLDocumentEvents_Event.cs new file mode 100644 index 0000000..64315c3 --- /dev/null +++ b/Decompiler/mshtml/HTMLDocumentEvents_Event.cs @@ -0,0 +1,12 @@ +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace mshtml; + +[ComImport] +[CompilerGenerated] +[ComEventInterface(typeof(HTMLDocumentEvents), typeof(HTMLDocumentEvents))] +[TypeIdentifier("3050f1c5-98b5-11cf-bb82-00aa00bdce0b", "mshtml.HTMLDocumentEvents_Event")] +public interface HTMLDocumentEvents_Event +{ +} diff --git a/Decompiler/mshtml/IHTMLElement.cs b/Decompiler/mshtml/IHTMLElement.cs new file mode 100644 index 0000000..1cfbc05 --- /dev/null +++ b/Decompiler/mshtml/IHTMLElement.cs @@ -0,0 +1,41 @@ +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace mshtml; + +[ComImport] +[CompilerGenerated] +[Guid("3050F1FF-98B5-11CF-BB82-00AA00BDCE0B")] +[TypeIdentifier] +public interface IHTMLElement +{ + void _VtblGap1_50(); + + [DispId(-2147417086)] + string innerHTML + { + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + [DispId(-2147417086)] + [return: MarshalAs(UnmanagedType.BStr)] + get; + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + [DispId(-2147417086)] + [param: In] + [param: MarshalAs(UnmanagedType.BStr)] + set; + } + + [DispId(-2147417085)] + string innerText + { + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + [DispId(-2147417085)] + [return: MarshalAs(UnmanagedType.BStr)] + get; + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + [DispId(-2147417085)] + [param: In] + [param: MarshalAs(UnmanagedType.BStr)] + set; + } +} diff --git a/Decompiler/mshtml/IHTMLSelectionObject.cs b/Decompiler/mshtml/IHTMLSelectionObject.cs new file mode 100644 index 0000000..25c6073 --- /dev/null +++ b/Decompiler/mshtml/IHTMLSelectionObject.cs @@ -0,0 +1,16 @@ +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace mshtml; + +[ComImport] +[CompilerGenerated] +[Guid("3050F25A-98B5-11CF-BB82-00AA00BDCE0B")] +[TypeIdentifier] +public interface IHTMLSelectionObject +{ + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + [DispId(1001)] + [return: MarshalAs(UnmanagedType.IDispatch)] + object createRange(); +} diff --git a/Decompiler/mshtml/IHTMLTxtRange.cs b/Decompiler/mshtml/IHTMLTxtRange.cs new file mode 100644 index 0000000..0149bad --- /dev/null +++ b/Decompiler/mshtml/IHTMLTxtRange.cs @@ -0,0 +1,26 @@ +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace mshtml; + +[ComImport] +[CompilerGenerated] +[Guid("3050F220-98B5-11CF-BB82-00AA00BDCE0B")] +[TypeIdentifier] +public interface IHTMLTxtRange +{ + [DispId(1003)] + string htmlText + { + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + [DispId(1003)] + [return: MarshalAs(UnmanagedType.BStr)] + get; + } + + void _VtblGap1_13(); + + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + [DispId(1026)] + void pasteHTML([In][MarshalAs(UnmanagedType.BStr)] string html); +} diff --git a/Decompiler/styles/buttons.baml b/Decompiler/styles/buttons.baml new file mode 100644 index 0000000..b0859f9 Binary files /dev/null and b/Decompiler/styles/buttons.baml differ diff --git a/Decompiler/styles/colors.baml b/Decompiler/styles/colors.baml new file mode 100644 index 0000000..cf1353a Binary files /dev/null and b/Decompiler/styles/colors.baml differ diff --git a/Decompiler/styles/fonts.baml b/Decompiler/styles/fonts.baml new file mode 100644 index 0000000..84957b8 Binary files /dev/null and b/Decompiler/styles/fonts.baml differ diff --git a/Decompiler/styles/texts.baml b/Decompiler/styles/texts.baml new file mode 100644 index 0000000..0e489e1 Binary files /dev/null and b/Decompiler/styles/texts.baml differ diff --git a/Decompiler/views/ajuda/atendimentosview.baml b/Decompiler/views/ajuda/atendimentosview.baml new file mode 100644 index 0000000..b8460ce Binary files /dev/null and b/Decompiler/views/ajuda/atendimentosview.baml differ diff --git a/Decompiler/views/bi/acompanhamentoview.baml b/Decompiler/views/bi/acompanhamentoview.baml new file mode 100644 index 0000000..f49cded Binary files /dev/null and b/Decompiler/views/bi/acompanhamentoview.baml differ diff --git a/Decompiler/views/bi/agendabiview.baml b/Decompiler/views/bi/agendabiview.baml new file mode 100644 index 0000000..5af0ad6 Binary files /dev/null and b/Decompiler/views/bi/agendabiview.baml differ diff --git a/Decompiler/views/bi/notasview.baml b/Decompiler/views/bi/notasview.baml new file mode 100644 index 0000000..b5acb51 Binary files /dev/null and b/Decompiler/views/bi/notasview.baml differ diff --git a/Decompiler/views/bi/painelbiview.baml b/Decompiler/views/bi/painelbiview.baml new file mode 100644 index 0000000..0c9726e Binary files /dev/null and b/Decompiler/views/bi/painelbiview.baml differ diff --git a/Decompiler/views/bi/prospeccaoview.baml b/Decompiler/views/bi/prospeccaoview.baml new file mode 100644 index 0000000..22b7c83 Binary files /dev/null and b/Decompiler/views/bi/prospeccaoview.baml differ diff --git a/Decompiler/views/bi/tarefaview.baml b/Decompiler/views/bi/tarefaview.baml new file mode 100644 index 0000000..5cd116b Binary files /dev/null and b/Decompiler/views/bi/tarefaview.baml differ diff --git a/Decompiler/views/connectionretryview.baml b/Decompiler/views/connectionretryview.baml new file mode 100644 index 0000000..fb1d3c8 Binary files /dev/null and b/Decompiler/views/connectionretryview.baml differ diff --git a/Decompiler/views/ferramentas/cadastroemailview.baml b/Decompiler/views/ferramentas/cadastroemailview.baml new file mode 100644 index 0000000..0e14686 Binary files /dev/null and b/Decompiler/views/ferramentas/cadastroemailview.baml differ diff --git a/Decompiler/views/ferramentas/cadastroparceiroview.baml b/Decompiler/views/ferramentas/cadastroparceiroview.baml new file mode 100644 index 0000000..d5a1fb4 Binary files /dev/null and b/Decompiler/views/ferramentas/cadastroparceiroview.baml differ diff --git a/Decompiler/views/ferramentas/downloadwindow.baml b/Decompiler/views/ferramentas/downloadwindow.baml new file mode 100644 index 0000000..e26916b Binary files /dev/null and b/Decompiler/views/ferramentas/downloadwindow.baml differ diff --git a/Decompiler/views/ferramentas/empresaview.baml b/Decompiler/views/ferramentas/empresaview.baml new file mode 100644 index 0000000..264abfc Binary files /dev/null and b/Decompiler/views/ferramentas/empresaview.baml differ diff --git a/Decompiler/views/ferramentas/estipulanteview.baml b/Decompiler/views/ferramentas/estipulanteview.baml new file mode 100644 index 0000000..2d524ef Binary files /dev/null and b/Decompiler/views/ferramentas/estipulanteview.baml differ diff --git a/Decompiler/views/ferramentas/etiquetaview.baml b/Decompiler/views/ferramentas/etiquetaview.baml new file mode 100644 index 0000000..934dbf1 Binary files /dev/null and b/Decompiler/views/ferramentas/etiquetaview.baml differ diff --git a/Decompiler/views/ferramentas/incluirramoview.baml b/Decompiler/views/ferramentas/incluirramoview.baml new file mode 100644 index 0000000..f2bc378 Binary files /dev/null and b/Decompiler/views/ferramentas/incluirramoview.baml differ diff --git a/Decompiler/views/ferramentas/incluirseguradoraview.baml b/Decompiler/views/ferramentas/incluirseguradoraview.baml new file mode 100644 index 0000000..5f615c8 Binary files /dev/null and b/Decompiler/views/ferramentas/incluirseguradoraview.baml differ diff --git a/Decompiler/views/ferramentas/maladiretaview.baml b/Decompiler/views/ferramentas/maladiretaview.baml new file mode 100644 index 0000000..ee121e8 Binary files /dev/null and b/Decompiler/views/ferramentas/maladiretaview.baml differ diff --git a/Decompiler/views/ferramentas/manutencaopagamentosview.baml b/Decompiler/views/ferramentas/manutencaopagamentosview.baml new file mode 100644 index 0000000..113cc9a Binary files /dev/null and b/Decompiler/views/ferramentas/manutencaopagamentosview.baml differ diff --git a/Decompiler/views/ferramentas/notafiscalview.baml b/Decompiler/views/ferramentas/notafiscalview.baml new file mode 100644 index 0000000..9c43d9d Binary files /dev/null and b/Decompiler/views/ferramentas/notafiscalview.baml differ diff --git a/Decompiler/views/ferramentas/produtoview.baml b/Decompiler/views/ferramentas/produtoview.baml new file mode 100644 index 0000000..699645f Binary files /dev/null and b/Decompiler/views/ferramentas/produtoview.baml differ diff --git a/Decompiler/views/ferramentas/protocolodocumentosview.baml b/Decompiler/views/ferramentas/protocolodocumentosview.baml new file mode 100644 index 0000000..5f1ff0f Binary files /dev/null and b/Decompiler/views/ferramentas/protocolodocumentosview.baml differ diff --git a/Decompiler/views/ferramentas/qualificacaoview.baml b/Decompiler/views/ferramentas/qualificacaoview.baml new file mode 100644 index 0000000..d7be4b5 Binary files /dev/null and b/Decompiler/views/ferramentas/qualificacaoview.baml differ diff --git a/Decompiler/views/ferramentas/ramoview.baml b/Decompiler/views/ferramentas/ramoview.baml new file mode 100644 index 0000000..afa0825 Binary files /dev/null and b/Decompiler/views/ferramentas/ramoview.baml differ diff --git a/Decompiler/views/ferramentas/reciboview.baml b/Decompiler/views/ferramentas/reciboview.baml new file mode 100644 index 0000000..9343176 Binary files /dev/null and b/Decompiler/views/ferramentas/reciboview.baml differ diff --git a/Decompiler/views/ferramentas/seguradoraview.baml b/Decompiler/views/ferramentas/seguradoraview.baml new file mode 100644 index 0000000..10273f3 Binary files /dev/null and b/Decompiler/views/ferramentas/seguradoraview.baml differ diff --git a/Decompiler/views/ferramentas/socioview.baml b/Decompiler/views/ferramentas/socioview.baml new file mode 100644 index 0000000..6094171 Binary files /dev/null and b/Decompiler/views/ferramentas/socioview.baml differ diff --git a/Decompiler/views/ferramentas/statusprospeccaoview.baml b/Decompiler/views/ferramentas/statusprospeccaoview.baml new file mode 100644 index 0000000..2a04176 Binary files /dev/null and b/Decompiler/views/ferramentas/statusprospeccaoview.baml differ diff --git a/Decompiler/views/ferramentas/statusview.baml b/Decompiler/views/ferramentas/statusview.baml new file mode 100644 index 0000000..06e8cd7 Binary files /dev/null and b/Decompiler/views/ferramentas/statusview.baml differ diff --git a/Decompiler/views/ferramentas/tipotarefaview.baml b/Decompiler/views/ferramentas/tipotarefaview.baml new file mode 100644 index 0000000..344fb27 Binary files /dev/null and b/Decompiler/views/ferramentas/tipotarefaview.baml differ diff --git a/Decompiler/views/ferramentas/tipovendedorview.baml b/Decompiler/views/ferramentas/tipovendedorview.baml new file mode 100644 index 0000000..66e6797 Binary files /dev/null and b/Decompiler/views/ferramentas/tipovendedorview.baml differ diff --git a/Decompiler/views/ferramentas/usuarioview.baml b/Decompiler/views/ferramentas/usuarioview.baml new file mode 100644 index 0000000..07ac3bf Binary files /dev/null and b/Decompiler/views/ferramentas/usuarioview.baml differ diff --git a/Decompiler/views/ferramentas/vendedorview.baml b/Decompiler/views/ferramentas/vendedorview.baml new file mode 100644 index 0000000..5862b7f Binary files /dev/null and b/Decompiler/views/ferramentas/vendedorview.baml differ diff --git a/Decompiler/views/financeiro/bancoscontasview.baml b/Decompiler/views/financeiro/bancoscontasview.baml new file mode 100644 index 0000000..b479f53 Binary files /dev/null and b/Decompiler/views/financeiro/bancoscontasview.baml differ diff --git a/Decompiler/views/financeiro/centrodecustoview.baml b/Decompiler/views/financeiro/centrodecustoview.baml new file mode 100644 index 0000000..4928a65 Binary files /dev/null and b/Decompiler/views/financeiro/centrodecustoview.baml differ diff --git a/Decompiler/views/financeiro/extratowindow.baml b/Decompiler/views/financeiro/extratowindow.baml new file mode 100644 index 0000000..ee9cb14 Binary files /dev/null and b/Decompiler/views/financeiro/extratowindow.baml differ diff --git a/Decompiler/views/financeiro/financeiroview.baml b/Decompiler/views/financeiro/financeiroview.baml new file mode 100644 index 0000000..b87833f Binary files /dev/null and b/Decompiler/views/financeiro/financeiroview.baml differ diff --git a/Decompiler/views/financeiro/fornecedorview.baml b/Decompiler/views/financeiro/fornecedorview.baml new file mode 100644 index 0000000..b7b0c9d Binary files /dev/null and b/Decompiler/views/financeiro/fornecedorview.baml differ diff --git a/Decompiler/views/financeiro/infoextratoview.baml b/Decompiler/views/financeiro/infoextratoview.baml new file mode 100644 index 0000000..cac251a Binary files /dev/null and b/Decompiler/views/financeiro/infoextratoview.baml differ diff --git a/Decompiler/views/financeiro/planosview.baml b/Decompiler/views/financeiro/planosview.baml new file mode 100644 index 0000000..dc5b03b Binary files /dev/null and b/Decompiler/views/financeiro/planosview.baml differ diff --git a/Decompiler/views/financeiro/planoview.baml b/Decompiler/views/financeiro/planoview.baml new file mode 100644 index 0000000..54ca901 Binary files /dev/null and b/Decompiler/views/financeiro/planoview.baml differ diff --git a/Decompiler/views/financeiro/relatorios/fechamentofinanceiroview.baml b/Decompiler/views/financeiro/relatorios/fechamentofinanceiroview.baml new file mode 100644 index 0000000..4feef94 Binary files /dev/null and b/Decompiler/views/financeiro/relatorios/fechamentofinanceiroview.baml differ diff --git a/Decompiler/views/generic/dragoverpopup.baml b/Decompiler/views/generic/dragoverpopup.baml new file mode 100644 index 0000000..030b9df Binary files /dev/null and b/Decompiler/views/generic/dragoverpopup.baml differ diff --git a/Decompiler/views/generic/errorwindow.baml b/Decompiler/views/generic/errorwindow.baml new file mode 100644 index 0000000..4a3c81c Binary files /dev/null and b/Decompiler/views/generic/errorwindow.baml differ diff --git a/Decompiler/views/generic/hosterwindow.baml b/Decompiler/views/generic/hosterwindow.baml new file mode 100644 index 0000000..cc8b534 Binary files /dev/null and b/Decompiler/views/generic/hosterwindow.baml differ diff --git a/Decompiler/views/importview.baml b/Decompiler/views/importview.baml new file mode 100644 index 0000000..f17b21d Binary files /dev/null and b/Decompiler/views/importview.baml differ diff --git a/Decompiler/views/loginwindow.baml b/Decompiler/views/loginwindow.baml new file mode 100644 index 0000000..0e7af5b Binary files /dev/null and b/Decompiler/views/loginwindow.baml differ diff --git a/Decompiler/views/menus/dashboardview.baml b/Decompiler/views/menus/dashboardview.baml new file mode 100644 index 0000000..ab132aa Binary files /dev/null and b/Decompiler/views/menus/dashboardview.baml differ diff --git a/Decompiler/views/menus/menuitensview.baml b/Decompiler/views/menus/menuitensview.baml new file mode 100644 index 0000000..afd01a8 Binary files /dev/null and b/Decompiler/views/menus/menuitensview.baml differ diff --git a/Decompiler/views/relatorios/relatorioview.baml b/Decompiler/views/relatorios/relatorioview.baml new file mode 100644 index 0000000..e5019d8 Binary files /dev/null and b/Decompiler/views/relatorios/relatorioview.baml differ diff --git a/Decompiler/views/relatorios/sinteticoview.baml b/Decompiler/views/relatorios/sinteticoview.baml new file mode 100644 index 0000000..28ec7a6 Binary files /dev/null and b/Decompiler/views/relatorios/sinteticoview.baml differ diff --git a/Decompiler/views/seguros/apoliceview.baml b/Decompiler/views/seguros/apoliceview.baml new file mode 100644 index 0000000..c5397b8 Binary files /dev/null and b/Decompiler/views/seguros/apoliceview.baml differ diff --git a/Decompiler/views/seguros/clienteview.baml b/Decompiler/views/seguros/clienteview.baml new file mode 100644 index 0000000..1100245 Binary files /dev/null and b/Decompiler/views/seguros/clienteview.baml differ diff --git a/Decompiler/views/seguros/comissaoview.baml b/Decompiler/views/seguros/comissaoview.baml new file mode 100644 index 0000000..93c9368 Binary files /dev/null and b/Decompiler/views/seguros/comissaoview.baml differ diff --git a/Decompiler/views/seguros/consultaoriginalview.baml b/Decompiler/views/seguros/consultaoriginalview.baml new file mode 100644 index 0000000..06f8b6f Binary files /dev/null and b/Decompiler/views/seguros/consultaoriginalview.baml differ diff --git a/Decompiler/views/seguros/criticaapoliceview.baml b/Decompiler/views/seguros/criticaapoliceview.baml new file mode 100644 index 0000000..2f3e70d Binary files /dev/null and b/Decompiler/views/seguros/criticaapoliceview.baml differ diff --git a/Decompiler/views/seguros/itens/aeronauticoview.baml b/Decompiler/views/seguros/itens/aeronauticoview.baml new file mode 100644 index 0000000..e5d735d Binary files /dev/null and b/Decompiler/views/seguros/itens/aeronauticoview.baml differ diff --git a/Decompiler/views/seguros/itens/autoview.baml b/Decompiler/views/seguros/itens/autoview.baml new file mode 100644 index 0000000..455113c Binary files /dev/null and b/Decompiler/views/seguros/itens/autoview.baml differ diff --git a/Decompiler/views/seguros/itens/buscarmodeloview.baml b/Decompiler/views/seguros/itens/buscarmodeloview.baml new file mode 100644 index 0000000..60ae56f Binary files /dev/null and b/Decompiler/views/seguros/itens/buscarmodeloview.baml differ diff --git a/Decompiler/views/seguros/itens/consorcioview.baml b/Decompiler/views/seguros/itens/consorcioview.baml new file mode 100644 index 0000000..188fef3 Binary files /dev/null and b/Decompiler/views/seguros/itens/consorcioview.baml differ diff --git a/Decompiler/views/seguros/itens/granizoview.baml b/Decompiler/views/seguros/itens/granizoview.baml new file mode 100644 index 0000000..0424c7d Binary files /dev/null and b/Decompiler/views/seguros/itens/granizoview.baml differ diff --git a/Decompiler/views/seguros/itens/patrimonialview.baml b/Decompiler/views/seguros/itens/patrimonialview.baml new file mode 100644 index 0000000..2cbd1dc Binary files /dev/null and b/Decompiler/views/seguros/itens/patrimonialview.baml differ diff --git a/Decompiler/views/seguros/itens/riscosdiversosview.baml b/Decompiler/views/seguros/itens/riscosdiversosview.baml new file mode 100644 index 0000000..72d3df9 Binary files /dev/null and b/Decompiler/views/seguros/itens/riscosdiversosview.baml differ diff --git a/Decompiler/views/seguros/itens/vidaview.baml b/Decompiler/views/seguros/itens/vidaview.baml new file mode 100644 index 0000000..89f8216 Binary files /dev/null and b/Decompiler/views/seguros/itens/vidaview.baml differ diff --git a/Decompiler/views/seguros/perfilempresaview.baml b/Decompiler/views/seguros/perfilempresaview.baml new file mode 100644 index 0000000..177eb0d Binary files /dev/null and b/Decompiler/views/seguros/perfilempresaview.baml differ diff --git a/Decompiler/views/seguros/perfilview.baml b/Decompiler/views/seguros/perfilview.baml new file mode 100644 index 0000000..f033e8a Binary files /dev/null and b/Decompiler/views/seguros/perfilview.baml differ diff --git a/Decompiler/views/seguros/sinistroview.baml b/Decompiler/views/seguros/sinistroview.baml new file mode 100644 index 0000000..39c3233 Binary files /dev/null and b/Decompiler/views/seguros/sinistroview.baml differ diff --git a/Decompiler/views/seguros/trocarclienteview.baml b/Decompiler/views/seguros/trocarclienteview.baml new file mode 100644 index 0000000..63dc807 Binary files /dev/null and b/Decompiler/views/seguros/trocarclienteview.baml differ diff --git a/Decompiler/views/tutorialview.baml b/Decompiler/views/tutorialview.baml new file mode 100644 index 0000000..e40e2e7 Binary files /dev/null and b/Decompiler/views/tutorialview.baml differ -- cgit v1.2.3