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