SpinLog.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. 
  2. using System;
  3. using System.Collections.Generic;
  4. using Oracle.ManagedDataAccess.Client;
  5. using System.Linq;
  6. using System.Web;
  7. namespace ReportWeb.Models
  8. {
  9. public class SpinLog
  10. {
  11. public SpinLog()
  12. { }
  13. public string msisdn { get; set; }
  14. public DateTime? insert_time { get; set; }
  15. public DateTime? expire_time { get; set; }
  16. public DateTime? last_update { get; set; }
  17. public int added { get; set; }
  18. public int used { get; set; }
  19. public string channel_add { get; set; }
  20. public static List<SpinLog> Parse(OracleDataReader reader)
  21. {
  22. List<SpinLog> result = new List<SpinLog>();
  23. try
  24. {
  25. while (reader.Read())
  26. {
  27. SpinLog spinLog = new SpinLog();
  28. for (int i = 0; i < reader.FieldCount; i++)
  29. {
  30. if (reader.GetName(i).ToUpper() == "MSISDN")
  31. {
  32. try
  33. {
  34. spinLog.msisdn = reader.GetValue(i).ToString();
  35. }
  36. catch { }
  37. }
  38. else if (reader.GetName(i).ToUpper() == "INSERT_TIME")
  39. try
  40. {
  41. spinLog.insert_time = reader.GetDateTime(i);
  42. }
  43. catch { }
  44. else if (reader.GetName(i).ToUpper() == "EXPIRE_TIME")
  45. try
  46. {
  47. spinLog.expire_time = reader.GetDateTime(i);
  48. }
  49. catch { }
  50. else if (reader.GetName(i).ToUpper() == "LAST_UPDATE")
  51. try
  52. {
  53. spinLog.last_update = reader.GetDateTime(i);
  54. }
  55. catch { }
  56. else if (reader.GetName(i).ToUpper() == "ADDED")
  57. {
  58. try
  59. {
  60. spinLog.added = int.Parse(reader.GetValue(i).ToString());
  61. }
  62. catch { }
  63. }
  64. else if (reader.GetName(i).ToUpper() == "USED")
  65. {
  66. try
  67. {
  68. spinLog.used = int.Parse(reader.GetValue(i).ToString());
  69. }
  70. catch { }
  71. }
  72. else if (reader.GetName(i).ToUpper() == "CHANNEL_ADD")
  73. {
  74. try
  75. {
  76. spinLog.channel_add = reader.GetValue(i).ToString();
  77. }
  78. catch { }
  79. }
  80. }
  81. result.Add(spinLog);
  82. }
  83. reader.Close();
  84. }
  85. catch
  86. {
  87. }
  88. finally
  89. {
  90. try
  91. {
  92. reader.Close();
  93. }
  94. catch { }
  95. }
  96. return result;
  97. }
  98. }
  99. }