SvAdv.cs 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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 int max_number_msg { get; set; }
  32. public string active_hour { get; set; }
  33. public DateTime report_date { get; set; }
  34. public DateTime start_time { get; set; }
  35. public DateTime end_time { get; set; }
  36. public static List<SvAdv> Parse(OracleDataReader reader)
  37. {
  38. List<SvAdv> result = new List<SvAdv>();
  39. try
  40. {
  41. while (reader.Read())
  42. {
  43. SvAdv sv = new SvAdv();
  44. for (int i = 0; i < reader.FieldCount; i++)
  45. {
  46. if (reader.GetName(i).ToUpper() == "ID")
  47. try
  48. {
  49. sv.id = int.Parse(reader.GetValue(i).ToString());
  50. }
  51. catch { }
  52. else if (reader.GetName(i).ToUpper() == "SV_CODE")
  53. {
  54. try
  55. {
  56. sv.sv_code = reader.GetValue(i).ToString();
  57. }
  58. catch { }
  59. }
  60. else if (reader.GetName(i).ToUpper() == "MSG_ADV")
  61. try
  62. {
  63. sv.msg_adv = reader.GetValue(i).ToString();
  64. }
  65. catch { }
  66. else if (reader.GetName(i).ToUpper() == "ADV_NAME")
  67. try
  68. {
  69. sv.adv_name = reader.GetValue(i).ToString();
  70. }
  71. catch { }
  72. else if (reader.GetName(i).ToUpper() == "ACTIVE_HOUR")
  73. try
  74. {
  75. sv.active_hour = reader.GetValue(i).ToString();
  76. }
  77. catch { }
  78. else if (reader.GetName(i).ToUpper() == "MAX_NUMBER_MSG")
  79. try
  80. {
  81. sv.max_number_msg = int.Parse(reader.GetValue(i).ToString());
  82. }
  83. catch { }
  84. else if (reader.GetName(i).ToUpper() == "MESSAGE_TYPE")
  85. try
  86. {
  87. sv.message_type = reader.GetValue(i).ToString();
  88. }
  89. catch { }
  90. else if (reader.GetName(i).ToUpper() == "CHANNEL_ADV")
  91. try
  92. {
  93. sv.channel_adv = reader.GetValue(i).ToString();
  94. }
  95. catch { }
  96. else if (reader.GetName(i).ToUpper() == "FROM_MONEY")
  97. try
  98. {
  99. sv.from_money = reader.GetValue(i).ToString();
  100. }
  101. catch { }
  102. else if (reader.GetName(i).ToUpper() == "STATUS")
  103. try
  104. {
  105. sv.status = int.Parse(reader.GetValue(i).ToString());
  106. }
  107. catch { }
  108. else if (reader.GetName(i).ToUpper() == "PERCENT")
  109. try
  110. {
  111. sv.percent = int.Parse(reader.GetValue(i).ToString());
  112. }
  113. catch { }
  114. else if (reader.GetName(i).ToUpper() == "COUNTER")
  115. try
  116. {
  117. sv.counter = int.Parse(reader.GetValue(i).ToString());
  118. }
  119. catch { }
  120. else if (reader.GetName(i).ToUpper() == "START_TIME")
  121. try
  122. {
  123. sv.start_time = reader.GetDateTime(i);
  124. }
  125. catch { }
  126. else if (reader.GetName(i).ToUpper() == "END_TIME")
  127. try
  128. {
  129. sv.end_time = reader.GetDateTime(i);
  130. }
  131. catch { }
  132. else if (reader.GetName(i).ToUpper() == "REPORT_DATE")
  133. try
  134. {
  135. sv.report_date = reader.GetDateTime(i);
  136. }
  137. catch { }
  138. else if (reader.GetName(i).ToUpper() == "SCHEDULE_DETAIL_ID")
  139. try
  140. {
  141. sv.schedule_detail_id = int.Parse(reader.GetValue(i).ToString());
  142. }
  143. catch { }
  144. }
  145. result.Add(sv);
  146. }
  147. reader.Close();
  148. }
  149. catch
  150. {
  151. }
  152. finally
  153. {
  154. try
  155. {
  156. reader.Close();
  157. }
  158. catch { }
  159. }
  160. return result;
  161. }
  162. }
  163. }