DefaultContext.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using DataAnalysisControl.Core;
  6. using Aitex.DataAnalysis.Log;
  7. namespace DataAnalysisControl.Core
  8. {
  9. class DefaultContext : IDataAnalysisControlContext
  10. {
  11. LogManager _log = new LogManager();
  12. public DefaultContext()
  13. {
  14. }
  15. public Dictionary<string, string> GetChamberList()
  16. {
  17. Dictionary<string, string> lst = new Dictionary<string, string>();
  18. lst["Transfer"] = "传送腔";
  19. lst["ReactorA"] = "A腔";
  20. lst["ReactorB"] = "B腔";
  21. lst["ReactorC"] = "C腔";
  22. lst["ReactorD"] = "D腔";
  23. return lst;
  24. }
  25. public Dictionary<string, string> GetRecipeChamberList()
  26. {
  27. Dictionary<string, string> lst = new Dictionary<string, string>();
  28. lst["ReactorA"] = "A腔";
  29. lst["ReactorB"] = "B腔";
  30. lst["ReactorC"] = "C腔";
  31. lst["ReactorD"] = "D腔";
  32. return lst;
  33. }
  34. public void Write(string info)
  35. {
  36. _log.Info(info);
  37. }
  38. public void Write(Exception ex,string error)
  39. {
  40. _log.Error(error, ex);
  41. }
  42. public string GetDBConnString()
  43. {
  44. string connString = string.Empty;
  45. try
  46. {
  47. connString = System.Configuration.ConfigurationManager.ConnectionStrings["DataAnalysisPostgreSQL"].ConnectionString;
  48. }
  49. catch (Exception ex)
  50. {
  51. LOG.Write(ex);
  52. }
  53. if (string.IsNullOrEmpty(connString))
  54. connString = "Server=localhost;Port=5432;User Id=postgres;Password=123456;Database=postgres;Enlist=true;";
  55. return connString;
  56. }
  57. }
  58. }