using CnasSynchrousModel; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace CnasSynchronusClient { public class SyncParamsOperation { private List lstTargetKeepField = new List() { "ID" }; private List lstSourceKeepField = new List() { }; /// /// 表名重复性验证【不允许存在多表结构】 /// /// /// /// /// public bool CheckTableIfRepeat(List lst, string strSourceTable, string strTargetTable) { bool IfRepeat = false; if (lst.Count>0&&lst.Where(s => s.SourceTable == strSourceTable && s.TargetTable == strTargetTable).Count() <= 0) IfRepeat = true; return IfRepeat; } /// /// 来源字段重复性验证【同一字段不允许配置多次】 /// /// /// /// /// public bool CheckSourceFieldRepeat(List lst, string strSourceTable, string strSourceField) { bool IfRepeat = false; if (lst.Where(s => s.SourceTable == strSourceTable && s.SourceField == strSourceField).Count() > 0) IfRepeat = true; return IfRepeat; } /// /// 目标字段重复性验证【同一字段不允许配置多次】 /// /// /// /// /// public bool CheckTargetFieldRepeat(List lst, string strTargetTable, string strTargetField) { bool IfRepeat = false; if (lst.Where(s => s.TargetTable == strTargetTable && s.TargetField == strTargetField).Count() > 0) IfRepeat = true; return IfRepeat; } /// /// 是否目标数据库的保留字段【比如自增字段,不允许同步】 /// /// /// public bool CheckTargetKeepField(string strTargetField) { if (lstTargetKeepField.Contains(strTargetField)) return true; else return false; } /// /// 是否来源数据库的保留字段 /// /// /// public bool CheckSourceKeepField(string strSourceField) { if (lstSourceKeepField.Contains(strSourceField)) return true; else return false; } } }