1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- 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<MoModelContrast> ListModelContrast = BLLFactory<BlModelContrast>.Instance.GetAll();
- public static string displayFieldModel = "1";
- public static List<MoColorContrast> ListColorContrast = BLLFactory<BlColorContrast>.Instance.GetAll();
- public static string displayFieldColor = "1";
- public static Dictionary<int, string> ColorList = new Dictionary<int, string>();
- 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;
- }
- }
- }
|