Advertisement
gkpoll

Untitled

Feb 15th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.34 KB | None | 0 0
  1.  
  2. namespace Sat.Dtec.Job
  3. {
  4. class ComAuto_GEDRecebimentoProtocolos : ComunicacoesAutomaticas
  5. {
  6.  
  7. private List<DtoProtocolosDoDia> destinatariosAvisoRecebimento;
  8.  
  9. public ComAuto_GEDRecebimentoProtocolos()
  10. : base(
  11. "GED.RECEBIMENTO.PROTOCOLOS",
  12.  
  13. FcDtec.AreaComunicacao.GED,
  14. FcDtec.AssuntoComunicacao.GED_RECEBIMENTO_PROTOCOLOS,
  15. FcDtec.TipoComunicacao.AVISO,
  16.  
  17. "Aviso de recebimento de documentos no GED na data de " + DateTime.Now.AddDays(-1).ToShortDateString(),
  18. null,
  19. new PadraoDeRepeticao(PadraoDeRepeticao.tipoRepeticaoComParametroAdicional.ApenasEmDiasEspecificos,
  20. new List<DateTime> { DateTime.ParseExact("15/02/2019", "dd/MM/yyyy", CultureInfo.InvariantCulture)}
  21. ))
  22. { }
  23.  
  24.  
  25. protected override List<IdentificationNumber> ListarDestinatariosComunicacao()
  26. {
  27. List<IdentificationNumber> retorno = new List<IdentificationNumber>();
  28.  
  29. destinatariosAvisoRecebimento = FcGed.ListarProtocolosDoDia();
  30.  
  31. if (destinatariosAvisoRecebimento != null && destinatariosAvisoRecebimento.Count > 0)
  32. {
  33. foreach (DtoProtocolosDoDia destinatarioAviso in destinatariosAvisoRecebimento)
  34. {
  35. if(!jaConstaLevandoEmContaIEeCNPJ(retorno, destinatarioAviso.Requerente))
  36. {
  37. retorno.Add(destinatarioAviso.Requerente);
  38. }
  39. }
  40. }
  41. else
  42. {
  43. return null;
  44. }
  45. return retorno;
  46. }
  47.  
  48. protected override string getTextoComunicacaoEletronica()
  49. {
  50. String br = "\n";
  51.  
  52. return
  53.  
  54. //SvcCadastro.getNomeCPFCNPJIE(IdInteressado) + ", " +
  55. //SvcEmail.formataIdentificacao(IdInteressado.ToString(false)) + "," + br +
  56.  
  57. "["+FcDtec.DTEC_COLUNA_RESERVADA_DESTINATARIO +"]" +
  58.  
  59. br +
  60.  
  61. "Os documentos abaixo listados foram registrados no Gestor Eletrônico de " +
  62. "Documentos do SAT -- Sistema de Administração Tributária:" +
  63.  
  64. br + cPROTOCOLO1 + ": " + cDOCS_PROTOCOLO1 +
  65. br +
  66. br +
  67.  
  68. br + cPROTOCOLO2 + ": " + cDOCS_PROTOCOLO2 +
  69. br +
  70.  
  71. cENTRE_OUTROS + br +
  72.  
  73. br +
  74.  
  75. "Por gentileza, confira se as informações relacionados aos documentos " +
  76. "estão corretas e se os documentos em formato eletrônico correspondem aos originais." +
  77.  
  78. br +
  79. br +
  80. "Módulo GED -- Gestor Eletrônico de Documentos" + br +
  81. "SAT - Sistema de Administração Tributária" + br +
  82. "Secretaria de Estado da Fazenda";
  83. }
  84.  
  85.  
  86. protected string cPROTOCOLO1 = "[" + "PROTOCOLO1" + "]";
  87. protected string cDOCS_PROTOCOLO1 = "[" + "DOCS_PROTOCOLO1" + "]";
  88. protected string cPROTOCOLO2 = "[" + "PROTOCOLO2" + "]";
  89. protected string cDOCS_PROTOCOLO2 = "[" + "DOCS_PROTOCOLO2" + "]";
  90. protected string cENTRE_OUTROS = "[" + "ENTRE_OUTROS" + "]";
  91.  
  92. protected override DataTable criaESalvaArquivoCSV(List<IdentificationNumber> confirmadosParaReceber)
  93. {
  94. // colunas com nomes reservados:
  95. // FcDtec.DTEC_COLUNA_RESERVADA_ID_ORIGEM
  96. // FcDtec.DTEC_COLUNA_RESERVADA_ANEXO_1
  97.  
  98. List<string> listaNomesColunas = new List<string>
  99. {
  100. cPROTOCOLO1,
  101. cDOCS_PROTOCOLO1,
  102. cPROTOCOLO2,
  103. cDOCS_PROTOCOLO2,
  104. cENTRE_OUTROS,
  105. FcDtec.DTEC_COLUNA_RESERVADA_ID_ORIGEM
  106. //,FcDtec.DTEC_COLUNA_RESERVADA_ANEXO_1 <-- Se tivesse roteiro padrão
  107. };
  108. // remove os caracteres "[" e "]"
  109. listaNomesColunas = listaNomesColunas.Select(s => s.Replace("[", String.Empty).Replace("]", String.Empty)).ToList();
  110.  
  111.  
  112.  
  113. DataTable listaBaseCSV = this.criaNovaTabelaParaCSV(listaNomesColunas);
  114.  
  115. foreach(IdentificationNumber confirmado in confirmadosParaReceber)
  116. {
  117. ComAuto_GEDRecebimentoProtocolos_LinhaArquivoCSV novaLinha =
  118.  
  119. new ComAuto_GEDRecebimentoProtocolos_LinhaArquivoCSV(
  120. confirmado,
  121. "prot1",
  122. "docsprot1",
  123. "prot2",
  124. "docsprot2",
  125. "entre outros",
  126. montaIdentificadorOrigem(confirmado, DateTime.Now)
  127. );
  128.  
  129. novaLinha.adicionaNaTabelaBaseCSV(listaBaseCSV);
  130. }
  131.  
  132. return listaBaseCSV;
  133.  
  134. // e roteiro padrão?
  135.  
  136. //if (getIdentificadorRoteiro() != RoteirosJobs.SEM_ROTEIRO)
  137. //{
  138. // comunicacao.listaAnexos = new List<DtoAnexoDTEC>();
  139. // comunicacao.listaAnexos.Add(getRoteiroUltimaVersao());
  140. //}
  141. }
  142.  
  143. protected override bool naoEnviarParaEvitarRepeticao(IdentificationNumber IdInteressado)
  144. {
  145. // vamos usar a lógica de evitar reenvio com base na data
  146.  
  147. return this.jaRecebeuEssaComunicacaoPorData(IdInteressado, DateTime.Now);
  148. }
  149.  
  150.  
  151. }// fim classe
  152.  
  153.  
  154. public class ComAuto_GEDRecebimentoProtocolos_LinhaArquivoCSV
  155. {
  156. private IdentificationNumber DESTINATARIO;
  157. private string PROTOCOLO1;
  158. private string DOCS_PROTOCOLO1;
  159. private string PROTOCOLO2;
  160. private string DOCS_PROTOCOLO2;
  161. private string ENTRE_OUTROS;
  162. private string ID_ORIGEM;
  163.  
  164. public ComAuto_GEDRecebimentoProtocolos_LinhaArquivoCSV(
  165. IdentificationNumber pDESTINATARIO,
  166. string pPROTOCOLO1,
  167. string pDOCS_PROTOCOLO1,
  168. string pPROTOCOLO2,
  169. string pDOCS_PROTOCOLO2,
  170. string pENTRE_OUTROS,
  171. string pID_ORIGEM)
  172. {
  173. DESTINATARIO = pDESTINATARIO;
  174. PROTOCOLO1 = pPROTOCOLO1;
  175. DOCS_PROTOCOLO1 = pDOCS_PROTOCOLO1;
  176. PROTOCOLO2 = pPROTOCOLO2;
  177. DOCS_PROTOCOLO2 = pDOCS_PROTOCOLO2;
  178. ENTRE_OUTROS = pENTRE_OUTROS;
  179. ID_ORIGEM = pID_ORIGEM;
  180. }
  181.  
  182. public void adicionaNaTabelaBaseCSV(DataTable tabelaBase)
  183. {
  184. tabelaBase.Rows.Add(
  185. ComunicacoesAutomaticas.verificaPontoVirgula(DESTINATARIO.ToString(false)),
  186. ComunicacoesAutomaticas.verificaPontoVirgula(PROTOCOLO1),
  187. ComunicacoesAutomaticas.verificaPontoVirgula(DOCS_PROTOCOLO1),
  188. ComunicacoesAutomaticas.verificaPontoVirgula(PROTOCOLO2),
  189. ComunicacoesAutomaticas.verificaPontoVirgula(DOCS_PROTOCOLO2),
  190. ComunicacoesAutomaticas.verificaPontoVirgula(ENTRE_OUTROS),
  191. ComunicacoesAutomaticas.verificaPontoVirgula(ID_ORIGEM));
  192. }
  193. } // fim ComAuto_GEDRecebimentoProtocolos_LinhaArquivoCSV
  194.  
  195. }// fim namespace
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement