SvAdv.cs 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. using Newtonsoft.Json;
  2. using Oracle.ManagedDataAccess.Client;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Web;
  7. namespace ReportWeb.Models
  8. {
  9. public class ListAdv
  10. {
  11. public string id { get; set; }
  12. public string percent { get; set; }
  13. }
  14. public class Root
  15. {
  16. public List<ListAdv> listAdv { get; set; }
  17. }
  18. public class SvAdv
  19. {
  20. public int id { get; set; }
  21. public int schedule_detail_id { get; set; }
  22. public string sv_code { get; set; }
  23. public string msg_adv { get; set; }
  24. public string adv_name { get; set; }
  25. public string channel_adv { get; set; }
  26. public string message_type { get; set; }
  27. public string from_money { get; set; }
  28. public int status { get; set; }
  29. public int percent { get; set; }
  30. public int counter { get; set; }
  31. public DateTime report_date { get; set; }
  32. public DateTime start_time { get; set; }
  33. public DateTime end_time { get; set; }
  34. public static List<SvAdv> Parse(OracleDataReader reader)
  35. {
  36. List<SvAdv> result = new List<SvAdv>();
  37. try
  38. {
  39. while (reader.Read())
  40. {
  41. SvAdv sv = new SvAdv();
  42. for (int i = 0; i < reader.FieldCount; i++)
  43. {
  44. if (reader.GetName(i).ToUpper() == "ID")
  45. try
  46. {
  47. sv.id = int.Parse(reader.GetValue(i).ToString());
  48. }
  49. catch { }
  50. else if (reader.GetName(i).ToUpper() == "SV_CODE")
  51. {
  52. try
  53. {
  54. sv.sv_code = reader.GetValue(i).ToString();
  55. }
  56. catch { }
  57. }
  58. else if (reader.GetName(i).ToUpper() == "MSG_ADV")
  59. try
  60. {
  61. sv.msg_adv = reader.GetValue(i).ToString();
  62. }
  63. catch { }
  64. else if (reader.GetName(i).ToUpper() == "ADV_NAME")
  65. try
  66. {
  67. sv.adv_name = reader.GetValue(i).ToString();
  68. }
  69. catch { }
  70. else if (reader.GetName(i).ToUpper() == "MESSAGE_TYPE")
  71. try
  72. {
  73. sv.message_type = reader.GetValue(i).ToString();
  74. }
  75. catch { }
  76. else if (reader.GetName(i).ToUpper() == "CHANNEL_ADV")
  77. try
  78. {
  79. sv.channel_adv = reader.GetValue(i).ToString();
  80. }
  81. catch { }
  82. else if (reader.GetName(i).ToUpper() == "FROM_MONEY")
  83. try
  84. {
  85. sv.from_money = reader.GetValue(i).ToString();
  86. }
  87. catch { }
  88. else if (reader.GetName(i).ToUpper() == "STATUS")
  89. try
  90. {
  91. sv.status = int.Parse(reader.GetValue(i).ToString());
  92. }
  93. catch { }
  94. else if (reader.GetName(i).ToUpper() == "PERCENT")
  95. try
  96. {
  97. sv.percent = int.Parse(reader.GetValue(i).ToString());
  98. }
  99. catch { }
  100. else if (reader.GetName(i).ToUpper() == "COUNTER")
  101. try
  102. {
  103. sv.counter = int.Parse(reader.GetValue(i).ToString());
  104. }
  105. catch { }
  106. else if (reader.GetName(i).ToUpper() == "START_TIME")
  107. try
  108. {
  109. sv.start_time = reader.GetDateTime(i);
  110. }
  111. catch { }
  112. else if (reader.GetName(i).ToUpper() == "END_TIME")
  113. try
  114. {
  115. sv.end_time = reader.GetDateTime(i);
  116. }
  117. catch { }
  118. else if (reader.GetName(i).ToUpper() == "REPORT_DATE")
  119. try
  120. {
  121. sv.report_date = reader.GetDateTime(i);
  122. }
  123. catch { }
  124. else if (reader.GetName(i).ToUpper() == "SCHEDULE_DETAIL_ID")
  125. try
  126. {
  127. sv.schedule_detail_id = int.Parse(reader.GetValue(i).ToString());
  128. }
  129. catch { }
  130. }
  131. result.Add(sv);
  132. }
  133. reader.Close();
  134. }
  135. catch
  136. {
  137. }
  138. finally
  139. {
  140. try
  141. {
  142. reader.Close();
  143. }
  144. catch { }
  145. }
  146. return result;
  147. }
  148. }
  149. }