DailyReport.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. using System;
  2. using System.Collections.Generic;
  3. using Oracle.ManagedDataAccess.Client;
  4. namespace ReportWeb.Models
  5. {
  6. public class DailyReport
  7. {
  8. public DailyReport()
  9. { }
  10. public int service_id { get; set; }
  11. public string service_name { get; set; }
  12. public string report_date { get; set; }
  13. public long revenue { get; set; }
  14. public long revenue_buy { get; set; }
  15. public long count_reg { get; set; }
  16. public long paid_money { get; set; }
  17. public long count_active { get; set; }
  18. public long count_deactive { get; set; }
  19. public static List<DailyReport> Parse(OracleDataReader reader)
  20. {
  21. List<DailyReport> result = new List<DailyReport>();
  22. try
  23. {
  24. while (reader.Read())
  25. {
  26. DailyReport report = new DailyReport();
  27. for (int i = 0; i < reader.FieldCount; i++)
  28. {
  29. if (reader.GetName(i).ToUpper() == "SERVICE_ID")
  30. {
  31. try
  32. {
  33. report.service_id = int.Parse(reader.GetValue(i).ToString());
  34. }
  35. catch { }
  36. }
  37. else if (reader.GetName(i).ToUpper() == "SERVICE_NAME")
  38. try
  39. {
  40. report.service_name = reader.GetValue(i).ToString();
  41. }
  42. catch { }
  43. else if (reader.GetName(i).ToUpper() == "REPORT_DATE")
  44. try
  45. {
  46. report.report_date = reader.GetValue(i).ToString();
  47. }
  48. catch { }
  49. else if (reader.GetName(i).ToUpper() == "REVENUE")
  50. try
  51. {
  52. report.revenue = long.Parse(reader.GetValue(i).ToString());
  53. }
  54. catch { }
  55. else if (reader.GetName(i).ToUpper() == "REVENUE_BUY")
  56. try
  57. {
  58. report.revenue_buy = long.Parse(reader.GetValue(i).ToString());
  59. }
  60. catch { }
  61. else if (reader.GetName(i).ToUpper() == "COUNT_REG")
  62. try
  63. {
  64. report.count_reg = long.Parse(reader.GetValue(i).ToString());
  65. }
  66. catch { }
  67. else if (reader.GetName(i).ToUpper() == "PAID_MONEY")
  68. try
  69. {
  70. report.paid_money = long.Parse(reader.GetValue(i).ToString());
  71. }
  72. catch { }
  73. else if (reader.GetName(i).ToUpper() == "COUNT_ACTIVE")
  74. try
  75. {
  76. report.count_active = long.Parse(reader.GetValue(i).ToString());
  77. }
  78. catch { }
  79. else if (reader.GetName(i).ToUpper() == "COUNT_DEACTIVE")
  80. try
  81. {
  82. report.count_deactive = long.Parse(reader.GetValue(i).ToString());
  83. }
  84. catch { }
  85. }
  86. result.Add(report);
  87. }
  88. reader.Close();
  89. }
  90. catch (Exception ex)
  91. {
  92. result = null;
  93. }
  94. finally
  95. {
  96. try
  97. {
  98. reader.Close();
  99. }
  100. catch { }
  101. }
  102. return result;
  103. }
  104. }
  105. }