ScenarioPlay.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. using Oracle.ManagedDataAccess.Client;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Web;
  6. namespace ReportWeb.Models
  7. {
  8. public class ScenarioPlayObj
  9. {
  10. // scenario play
  11. public int id { get; set; }
  12. public int service_id { get; set; }
  13. public string hour_active { get; set; }
  14. public string date_active { get; set; }
  15. public string msisdn { get; set; }
  16. public double money_left { get; set; }
  17. public string status { get; set; }
  18. public int turn_left { get; set; }
  19. public int buying_time { get; set; }
  20. public static List<ScenarioPlayObj> Parse(OracleDataReader reader)
  21. {
  22. List<ScenarioPlayObj> result = new List<ScenarioPlayObj>();
  23. List<int> listId = new List<int>();
  24. try
  25. {
  26. while (reader.Read())
  27. {
  28. ScenarioPlayObj sv = new ScenarioPlayObj();
  29. SvAdv adv = new SvAdv();
  30. for (int i = 0; i < reader.FieldCount; i++)
  31. {
  32. if (reader.GetName(i).ToLower() == "id")
  33. try
  34. {
  35. sv.id = int.Parse(reader.GetValue(i).ToString());
  36. }
  37. catch { }
  38. else if (reader.GetName(i).ToLower() == "service_id")
  39. try
  40. {
  41. sv.service_id = int.Parse(reader.GetValue(i).ToString());
  42. }
  43. catch { }
  44. else if (reader.GetName(i).ToLower() == "hour_active")
  45. try
  46. {
  47. sv.hour_active = reader.GetValue(i).ToString();
  48. }
  49. catch { }
  50. else if (reader.GetName(i).ToLower() == "date_active")
  51. try
  52. {
  53. sv.date_active = reader.GetValue(i).ToString(); ;
  54. }
  55. catch { }
  56. else if (reader.GetName(i).ToLower() == "msisdn")
  57. try
  58. {
  59. sv.msisdn = reader.GetValue(i).ToString(); ;
  60. }
  61. catch { }
  62. else if (reader.GetName(i).ToLower() == "money_left")
  63. try
  64. {
  65. sv.money_left = double.Parse(reader.GetValue(i).ToString());
  66. }
  67. catch { }
  68. else if (reader.GetName(i).ToLower() == "status")
  69. try
  70. {
  71. sv.status = reader.GetValue(i).ToString(); ;
  72. }
  73. catch { }
  74. else if (reader.GetName(i).ToLower() == "turn_left")
  75. try
  76. {
  77. sv.turn_left = int.Parse(reader.GetValue(i).ToString());
  78. }
  79. catch { }
  80. else if (reader.GetName(i).ToLower() == "buying_time")
  81. try
  82. {
  83. sv.buying_time = int.Parse(reader.GetValue(i).ToString());
  84. }
  85. catch { }
  86. }
  87. result.Add(sv);
  88. }
  89. reader.Close();
  90. }
  91. catch
  92. {
  93. }
  94. finally
  95. {
  96. try
  97. {
  98. reader.Close();
  99. }
  100. catch { }
  101. }
  102. return result;
  103. }
  104. }
  105. }