Config.cs 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 Config
  10. {
  11. public Config()
  12. {
  13. //
  14. // TODO: Add constructor logic here
  15. //
  16. }
  17. public string module { get; set; }
  18. public string param_name { get; set; }
  19. public string param_value_0 { get; set; }
  20. public static List<Config> Parse(OracleDataReader reader)
  21. {
  22. List<Config> result = new List<Config>();
  23. try
  24. {
  25. while (reader.Read())
  26. {
  27. Config sv = new Config();
  28. for (int i = 0; i < reader.FieldCount; i++)
  29. {
  30. if (reader.GetName(i).ToLower() == "module")
  31. {
  32. try
  33. {
  34. sv.module = reader.GetValue(i).ToString();
  35. }
  36. catch { }
  37. }
  38. else if (reader.GetName(i).ToLower() == "param_name")
  39. {
  40. try
  41. {
  42. sv.param_name = reader.GetValue(i).ToString();
  43. }
  44. catch { }
  45. }
  46. else if (reader.GetName(i).ToLower() == "param_value_0")
  47. {
  48. try
  49. {
  50. sv.param_value_0 = reader.GetValue(i).ToString();
  51. }
  52. catch { }
  53. }
  54. }
  55. result.Add(sv);
  56. }
  57. reader.Close();
  58. }
  59. catch
  60. {
  61. }
  62. finally
  63. {
  64. try
  65. {
  66. reader.Close();
  67. }
  68. catch { }
  69. }
  70. return result;
  71. }
  72. }
  73. }