using ProjectBase.Data.BaseDAL; using SIMDP.Model; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace SIMDP.BLL { public static class SmProject { public static List ListModelContrast = BLLFactory.Instance.GetAll(); public static string displayFieldModel = "1"; public static List ListColorContrast = BLLFactory.Instance.GetAll(); public static string displayFieldColor = "1"; public static Dictionary ColorList = new Dictionary(); public static void InitColorList() { ColorList.Clear(); foreach (MoColorContrast moColorContrast in ListColorContrast) { ColorList.Add(moColorContrast.Paint_Line, moColorContrast.Chinese_Name_H); } } public static string ModelDisplayFieldText(string oriValue) { if (displayFieldModel == "2") { return ListModelContrast.Find(p => p.PLC_Code.ToString() == oriValue.Trim())?.Model_Code ?? oriValue; } else if (displayFieldModel == "3") { return ListModelContrast.Find(p => p.PLC_Code.ToString() == oriValue.Trim())?.English_Name ?? oriValue; } else if (displayFieldModel == "4") { return ListModelContrast.Find(p => p.PLC_Code.ToString() == oriValue.Trim())?.Chinese_Name ?? oriValue; } else { return oriValue; } } public static string ColorDisplayFieldText(string oriValue) { if (displayFieldColor == "2") { return ListColorContrast.Find(p => p.Paint_Line.ToString() == oriValue.Trim())?.Color_Card ?? oriValue; } else if (displayFieldColor == "3") { return ListColorContrast.Find(p => p.Paint_Line.ToString() == oriValue.Trim())?.Chinese_Name_H ?? oriValue; } else if (displayFieldColor == "4") { return ListColorContrast.Find(p => p.Paint_Line.ToString() == oriValue.Trim())?.Chinese_Name_A ?? oriValue; } else { return oriValue; } } public static string TaskModelDisplay(string oriValue) { return ListModelContrast.Find(p => p.PLC_Code.ToString() == oriValue.Trim())?.English_Name ?? oriValue; } public static string TaskColorDisplay(string oriValue) { MoColorContrast model = ListColorContrast.Find(p => p.Paint_Line.ToString() == oriValue.Trim()); return model != null ? model.Chinese_Name_H + " " + model.Color_Card : oriValue; } } }