1
yhj
2024-07-24 5e5d945e91568b973faa27d8ab0bcef99fc4a6c5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#region
 
using System.Collections.Generic;
using System.Linq;
 
#endregion
 
namespace CSFrameworkV5.Interfaces.InterfaceModels
{
    public class FormConfig
    {
        public FormConfig()
        {
            Fields = new List<FieldConfig>();
        }
 
        public string Account { get; set; }
 
        public string ApplyType { get; set; }
 
        /// <summary>
        ///     当前界面的字段配置信息
        /// </summary>
        public List<FieldConfig> Fields { get; set; }
 
        public string GroupsOrUsers { get; set; }
 
        public string ProgramID { get; set; }
 
        public string ProgramName { get; set; }
 
        public string Remark { get; set; }
 
        public string StyleID { get; set; }
 
        public string SystemID { get; set; }
 
        public string SystemName { get; set; }
 
        /// <summary>
        ///     应用策略:
        ///     1.Users,有指定用户的方案的,则先显示;
        ///     2.Groups,若是没有,则看有没有对应组的方案,有则显示;
        ///     3.AllUser,若还是没有,则再显示所有用户的方案;
        ///     4.若还没有,则就是显示程序原本的名称;
        /// </summary>
        /// <param name="configs"></param>
        /// <returns></returns>
        public static FormConfig GetCurrent(List<FormConfig> configs)
        {
            var F1 = from c in configs where c.ApplyType == "Users" select c;
            foreach (var o in F1) return o;
 
            var F2 = from c in configs where c.ApplyType == "Groups" select c;
            foreach (var o in F2) return o;
 
            var F3 = from c in configs where c.ApplyType == "AllUser" select c;
            foreach (var o in F3) return o;
 
            return null;
        }
 
        public FieldConfig GetFieldConfig(string fieldName)
        {
            var o = from c in Fields where c.FieldName == fieldName select c;
            foreach (var o1 in o) return o1;
 
            return null;
        }
 
        public void ReplaceCaption(List<FieldNameDef> list)
        {
            FieldConfig config;
            foreach (var F in list)
            {
                config = GetFieldConfig(F.FieldName);
                if (config != null && config.CaptionCustom != F.Caption)
                    F.Caption = config.CaptionCustom;
            }
        }
    }
}