/// <summary> /// 检查单个户主 /// </summary> /// <param name="hz"></param> private void CheckHZ(JTCY hz, int cellIndex) { Dictionary <string, string> yhzgxDic = JTCYCustom.YHZGXDic; IList <JTCY> jtcys = hz.JTCies; foreach (JTCY jtcy in jtcys) { if (!Utils.CheckIDCard18(jtcy.GMSFHM)) { CheckZJDWriteError(jtcy.Row, cellIndex, "证件号码不符合规则"); } //检查关系 是否符合规则 string yhzgx = jtcy.YHZGX; if (yhzgx != null && !yhzgxDic.ContainsKey(yhzgx)) { CheckZJDWriteError(jtcy.Row, cellIndex, yhzgx + ":关系不是标准"); } } }
/// <summary> /// 检查重复的身份证 /// </summary> /// <param name="hzs"></param> /// <returns></returns> public IList <string> ChecSFZ(IList <JTCY> hzs, ZJDDataSourceViewModel model) { IList <string> errors = new List <string>(); IList <JTCY> jtcys = JTCYCustom.GetAllJTCY(hzs); Dictionary <string, IList <JTCY> > sfzDic = Utils.GetGroupDicToList("GMSFHM", jtcys); foreach (string sfz in sfzDic.Keys) { IList <JTCY> sfzList = sfzDic[sfz]; if (sfzList.Count > 1) { foreach (JTCY jtcy in sfzList) { if (sfz == "") { errors.Add(sfz + ",证件号码为空"); } else { CheckZJDWriteError(jtcy.Row, model.JTCYTableErrorCellIndex, "证件号码重复"); } } } else { if (!Utils.CheckIDCard18(sfz)) { if (sfz == "") { CheckZJDWriteError(sfzList[0].Row, model.JTCYTableErrorCellIndex, "证件号码为空"); } else { CheckZJDWriteError(sfzList[0].Row, model.JTCYTableErrorCellIndex, "证件号码不符合规则"); } } } } return(errors); }