Guest User

Untitled

a guest
Jun 22nd, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.84 KB | None | 0 0
  1. //Erro neste ponto
  2. table = new DataTable();
  3. table = dst.Clone();
  4. table.Clear();
  5. set = new DataSet();
  6.  
  7.  
  8. public static void ImprimeCartas()
  9. {
  10.  
  11. try
  12. {
  13. List<Itens> list = new List<Itens>();
  14. Uteis.Status("Inicio Consulta", servico);
  15.  
  16. DataTable dst = new DataTable();
  17. string id = "0";
  18. ConsultaImpressao(dst, id, "0");
  19.  
  20. dst.TableName = "DADOS";
  21. Uteis.Status(string.Concat(new object[] { "Consulta : ", dst.Rows.Count, " - ", DateTime.Now.ToString() }), servico);
  22.  
  23.  
  24. if (dst.Rows.Count > 0)
  25. {
  26. string str2 = AppDomain.CurrentDomain.BaseDirectory + "//Relatorios/Notificacao/" + dst.Rows[0]["modelo"].ToString();
  27. Uteis.Status("Arquivo usado" + str2, servico);
  28. if (!string.IsNullOrEmpty(str2))
  29. {
  30. int num = 0;
  31. int itens = 1;
  32. Uteis.Status("Gerando PDF " + dst.Rows.Count + " Registros", servico);
  33. DataTable table = dst.Clone();
  34. table.Clear();
  35. table.TableName = "DADOS";
  36. DataSet set = new DataSet();
  37. string str3 = Uteis.TempName();
  38. int num3 = 0x31;
  39. Uteis.Status((dst.Rows.Count / num3) + " Arquivos", servico);
  40.  
  41. for (int i = 0; i < dst.Rows.Count; i++)
  42. {
  43.  
  44. num++;
  45. table.ImportRow(dst.Rows[i]);
  46. if (num > num3)
  47. {
  48. try
  49. {
  50. set.Tables.Add(table);
  51. DocumentContainer container = DocumentContainer.Load(str2);
  52. container.MergeWithRegions(set);
  53. container.SalvarPdf(string.Concat(new object[] { AppDomain.CurrentDomain.BaseDirectory, "//Temp//", str3, "_", itens, ".pdf" }));
  54. ApagaPaginasemBranco(string.Concat(new object[] { AppDomain.CurrentDomain.BaseDirectory, "//Temp//", str3, "_", itens, ".pdf" }));
  55. Uteis.Status(string.Concat(new object[] { "Gerando arquivo ", str3, "_", itens, ".pdf" }), servico);
  56. object[] objArray5 = new object[] { AppDomain.CurrentDomain.BaseDirectory, "//Temp//", str3, "_", itens, ".pdf" };
  57. list.Add(new Itens(string.Concat(objArray5)));
  58. num = 0;
  59. itens++;
  60.  
  61. //Erro neste ponto
  62. table = new DataTable();
  63. table = dst.Clone();
  64. table.Clear();
  65. set = new DataSet();
  66. }
  67. catch (Exception ex)
  68. {
  69. Uteis.GravaLogTxt("ImprimeCartas erro : ", ex.Message);
  70. }
  71.  
  72.  
  73. }
  74.  
  75.  
  76. }
  77.  
  78. }
  79. }
  80. else
  81. {
  82. Uteis.Status("sem registros", servico);
  83. }
  84. }
  85. catch (Exception exception)
  86. {
  87. Uteis.Status(exception.Message, servico);
  88. }
  89. servico = 0;
  90. Uteis.GravaLogTxt("ImprimeCartas", "final");
  91. }
Add Comment
Please, Sign In to add comment