ChargeLog.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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 ChargeLog
  10. {
  11. public ChargeLog()
  12. {
  13. //
  14. // TODO: Add constructor logic here
  15. //
  16. }
  17. public string description { get; set; }
  18. public string msisdn { get; set; }
  19. public long fee { get; set; }
  20. public DateTime? chargeTime { get; set; }
  21. public DateTime? fromDate { get; set; }
  22. public DateTime? toDate { get; set; }
  23. public string service { get; set; }
  24. public long count_reg { get; set; }
  25. public long count_active { get; set; }
  26. public long count_destroy { get; set; }
  27. public string channel { get; set; }
  28. public string product_name { get; set; }
  29. public static List<ChargeLog> Parse(OracleDataReader reader)
  30. {
  31. List<ChargeLog> result = new List<ChargeLog>();
  32. try
  33. {
  34. while (reader.Read())
  35. {
  36. ChargeLog chargeLog = new ChargeLog();
  37. for (int i = 0; i < reader.FieldCount; i++)
  38. {
  39. if (reader.GetName(i).ToUpper() == "DESCRIPTION")
  40. {
  41. try
  42. {
  43. chargeLog.description = reader.GetValue(i).ToString();
  44. }
  45. catch { }
  46. }
  47. else if (reader.GetName(i).ToUpper() == "MSISDN")
  48. {
  49. try
  50. {
  51. chargeLog.msisdn = reader.GetValue(i).ToString();
  52. }
  53. catch { }
  54. }
  55. else if (reader.GetName(i).ToUpper() == "CHARGE_TIME")
  56. try
  57. {
  58. chargeLog.chargeTime = reader.GetDateTime(i);
  59. }
  60. catch { }
  61. else if (reader.GetName(i).ToUpper() == "FEE")
  62. try
  63. {
  64. chargeLog.fee = long.Parse(reader.GetValue(i).ToString());
  65. }
  66. catch { }
  67. else if (reader.GetName(i).ToUpper() == "COUNT_REG")
  68. try
  69. {
  70. chargeLog.count_reg = long.Parse(reader.GetValue(i).ToString());
  71. }
  72. catch { }
  73. else if (reader.GetName(i).ToUpper() == "COUNT_DESTROY")
  74. try
  75. {
  76. chargeLog.count_destroy = long.Parse(reader.GetValue(i).ToString());
  77. }
  78. catch { }
  79. else if (reader.GetName(i).ToUpper() == "COUNT_ACTIVE")
  80. try
  81. {
  82. chargeLog.count_active = long.Parse(reader.GetValue(i).ToString());
  83. }
  84. catch { }
  85. else if (reader.GetName(i).ToUpper() == "CHANNEL")
  86. {
  87. try
  88. {
  89. chargeLog.channel = reader.GetValue(i).ToString();
  90. }
  91. catch { }
  92. }
  93. else if (reader.GetName(i).ToUpper() == "PRODUCT_NAME")
  94. {
  95. try
  96. {
  97. chargeLog.product_name = reader.GetValue(i).ToString();
  98. }
  99. catch { }
  100. }
  101. }
  102. result.Add(chargeLog);
  103. }
  104. reader.Close();
  105. }
  106. catch
  107. {
  108. }
  109. finally
  110. {
  111. try
  112. {
  113. reader.Close();
  114. }
  115. catch { }
  116. }
  117. return result;
  118. }
  119. }
  120. }