public static bool Create(UserGroupFunction usrGroup) { List <UserGroupFunction> GroupList = new ConfigTool <List <UserGroupFunction> >().ReadFile("config/UserGroupFunction.json"); var groupInfo = from grp in GroupList where grp.userGroupId.ToUpper().Equals(usrGroup.userGroupId.ToUpper()) && grp.functionId.ToUpper().Equals(usrGroup.functionId.ToUpper()) select grp; if (groupInfo.Count() == 0) { GroupList.Add(usrGroup); new ConfigTool <List <UserGroupFunction> >().WriteFile("config/UserGroupFunction.json", GroupList); return(true); } else { return(false); } }
public static bool Create(DioSetting Setting) { List <DioSetting> result = new ConfigTool <List <DioSetting> >().ReadFile("config/DIO.json"); var DioInfo = from dio in result where dio.DeviceName.ToUpper().Equals(Setting.DeviceName.ToUpper()) && dio.address.Equals(Setting.address) && dio.Type.Equals(Setting.Type) select dio; if (DioInfo.Count() == 0) { result.Add(Setting); new ConfigTool <List <DioSetting> >().WriteFile("config/DIO.json", result); return(true); } else { return(false); } }