#region using System.Collections.Generic; using System.Linq; #endregion namespace CSFrameworkV5.Interfaces.InterfaceModels { public class FormConfig { public FormConfig() { Fields = new List(); } public string Account { get; set; } public string ApplyType { get; set; } /// /// 当前界面的字段配置信息 /// public List 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; } /// /// 应用策略: /// 1.Users,有指定用户的方案的,则先显示; /// 2.Groups,若是没有,则看有没有对应组的方案,有则显示; /// 3.AllUser,若还是没有,则再显示所有用户的方案; /// 4.若还没有,则就是显示程序原本的名称; /// /// /// public static FormConfig GetCurrent(List 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 list) { FieldConfig config; foreach (var F in list) { config = GetFieldConfig(F.FieldName); if (config != null && config.CaptionCustom != F.Caption) F.Caption = config.CaptionCustom; } } } }