Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.10 KB | None | 0 0
  1. try
  2. {
  3. using (StreamWriter sw = File.AppendText(strPath))
  4. {
  5. sw.WriteLine("=============PASO 1==========");
  6. sw.WriteLine("===========fecha============= " + DateTime.Now);
  7. }
  8. con = conex.f_getConexion();
  9. con.Open();
  10. using (StreamWriter sw = File.AppendText(strPath))
  11. {
  12. sw.WriteLine("=============PASO 2==========");
  13. sw.WriteLine("===========fecha============= " + DateTime.Now);
  14. }
  15. cmd = new SqlCommand("pa_man_EmpresaEmisorKey_Lis", con);
  16. cmd.CommandType = CommandType.StoredProcedure;
  17. cmd.Parameters.AddWithValue("@key", key);
  18.  
  19. using (StreamWriter sw = File.AppendText(strPath))
  20. {
  21. sw.WriteLine("=============PASO 3==========");
  22. sw.WriteLine("===========fecha============= " + DateTime.Now);
  23. }
  24. SqlDataReader registros = cmd.ExecuteReader();
  25. Contribuyente obj = new Contribuyente();
  26.  
  27. if (registros.Read())
  28. {
  29. using (StreamWriter sw = File.AppendText(strPath))
  30. {
  31. sw.WriteLine("=============PASO 4==========");
  32. sw.WriteLine("===========fecha============= " + DateTime.Now);
  33. }
  34. obj.IdContribuyente = Int32.Parse(registros["IdContribuyente"].ToString());
  35. using (StreamWriter sw = File.AppendText(strPath))
  36. {
  37. sw.WriteLine("=============PASO 5==========");
  38. sw.WriteLine("===========fecha============= " + DateTime.Now);
  39. }
  40. }
  41. using (StreamWriter sw = File.AppendText(strPath))
  42. {
  43. sw.WriteLine("=============PASO 6==========");
  44. sw.WriteLine("===========fecha============= " + DateTime.Now);
  45. }
  46. registros.Close();
  47. con.Close();
  48. return obj;
  49. }
  50. catch (Exception ex)
  51. {
  52. using (StreamWriter sw = File.AppendText(strPath))
  53. {
  54. sw.WriteLine("=============PASO 7==========");
  55. sw.WriteLine("===========fecha============= " + DateTime.Now);
  56. }
  57. throw;
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement