SmProject.cs 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. using ProjectBase.Data.BaseDAL;
  2. using SIMDP.Model;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. namespace SIMDP.BLL
  8. {
  9. public static class SmProject
  10. {
  11. public static List<MoModelContrast> ListModelContrast = BLLFactory<BlModelContrast>.Instance.GetAll();
  12. public static string displayFieldModel = "1";
  13. public static List<MoColorContrast> ListColorContrast = BLLFactory<BlColorContrast>.Instance.GetAll();
  14. public static string displayFieldColor = "1";
  15. public static Dictionary<int, string> ColorList = new Dictionary<int, string>();
  16. public static void InitColorList()
  17. {
  18. ColorList.Clear();
  19. foreach (MoColorContrast moColorContrast in ListColorContrast)
  20. {
  21. ColorList.Add(moColorContrast.Paint_Line, moColorContrast.Chinese_Name_H);
  22. }
  23. }
  24. public static string ModelDisplayFieldText(string oriValue)
  25. {
  26. if (displayFieldModel == "2")
  27. {
  28. return ListModelContrast.Find(p => p.PLC_Code.ToString() == oriValue.Trim())?.Model_Code ?? oriValue;
  29. }
  30. else if (displayFieldModel == "3")
  31. {
  32. return ListModelContrast.Find(p => p.PLC_Code.ToString() == oriValue.Trim())?.English_Name ?? oriValue;
  33. }
  34. else if (displayFieldModel == "4")
  35. {
  36. return ListModelContrast.Find(p => p.PLC_Code.ToString() == oriValue.Trim())?.Chinese_Name ?? oriValue;
  37. }
  38. else
  39. {
  40. return oriValue;
  41. }
  42. }
  43. public static string ColorDisplayFieldText(string oriValue)
  44. {
  45. if (displayFieldColor == "2")
  46. {
  47. return ListColorContrast.Find(p => p.Paint_Line.ToString() == oriValue.Trim())?.Color_Card ?? oriValue;
  48. }
  49. else if (displayFieldColor == "3")
  50. {
  51. return ListColorContrast.Find(p => p.Paint_Line.ToString() == oriValue.Trim())?.Chinese_Name_H ?? oriValue;
  52. }
  53. else if (displayFieldColor == "4")
  54. {
  55. return ListColorContrast.Find(p => p.Paint_Line.ToString() == oriValue.Trim())?.Chinese_Name_A ?? oriValue;
  56. }
  57. else
  58. {
  59. return oriValue;
  60. }
  61. }
  62. public static string TaskModelDisplay(string oriValue)
  63. {
  64. return ListModelContrast.Find(p => p.PLC_Code.ToString() == oriValue.Trim())?.English_Name ?? oriValue;
  65. }
  66. public static string TaskColorDisplay(string oriValue)
  67. {
  68. MoColorContrast model = ListColorContrast.Find(p => p.Paint_Line.ToString() == oriValue.Trim());
  69. return model != null ? model.Chinese_Name_H + " " + model.Color_Card : oriValue;
  70. }
  71. }
  72. }