/// <summary> /// 个人单独校验方法 /// </summary> /// yaoy 16.09.27 /// <returns></returns> public bool Value008Validate() { var result = true; var infoTypeInfo = new InfoType().Get(infoTypeID); var segmentRulesInfo = new SegmentRules().GetSegmentRulesByInfoTypeIdAndMetaCodeAndCode(infoTypeID, 7121, "A"); var temp = validateUtil.GetValues(data, "A", segmentRulesInfo.SegmentRulesId.ToString()); if (temp == "2") { var times = validateUtil.GetTimes(data, "F"); if (times > 0) { throw new ApplicationException("新账户开立信息记录不能包含交易标识变更段!"); } var times1 = validateUtil.GetTimes(data, "B"); var times2 = validateUtil.GetTimes(data, "C"); var times3 = validateUtil.GetTimes(data, "D"); if (!(times1 > 0 && times2 > 0 && times3 > 0)) { throw new ApplicationException("新账户开立信息账户记录必须包括身份信息段、职业信息段、居住地址段!"); } } return(result); }
/// <summary> /// 个人单独校验方法 /// </summary> /// yaoy 16.09.27 public bool Value056Validate() { var result = true; int metaCode = 8105; // 根据信息记录类型获取数据段集合 var dataSegmentList = new DataSegment().GetByInfoTypeId(infoTypeID); // 根据数据元获取字典编码集合 var dicList = new string[] { "A", "B", "C", "D", "E", "F", "G", "" }; foreach (var dataSegmentInfo in dataSegmentList) { // 根据信息类型和元数据以及数据段名称获取数据段规则 var segmentRulesInfo = new SegmentRules().GetSegmentRulesByInfoTypeIdAndMetaCodeAndCode(infoTypeID, metaCode, dataSegmentInfo.ParagraphCode); // 根据数据段和数据段规则ID获取特定的值 var value = validateUtil.GetValues(data, dataSegmentInfo.ParagraphCode, segmentRulesInfo.SegmentRulesId.ToString()); //value值不在数据字典的集合中 if (!dicList.Contains(value)) { throw new ApplicationException("信息记录类型的值不在数据字典的集合中!"); } } return(result); }
public static string Create(string listID, string title, SegmentRules rules) { string json = ""; try { json = HttpHelper.Post(string.Format("/segments/{0}.json", listID), null, JavaScriptConvert.SerializeObject( new Dictionary <string, object>() { { "ListID", listID }, { "Title", title }, { "Rules", rules } }) ); } catch (CreatesendException ex) { if (!ex.Data.Contains("ErrorResult") && ex.Data.Contains("ErrorResponse")) { ErrorResult <RuleErrorResults> result = JavaScriptConvert.DeserializeObject <ErrorResult <RuleErrorResults> >(ex.Data["ErrorResponse"].ToString()); ex.Data.Add("ErrorResult", result); } throw ex; } catch (Exception ex) { throw ex; } return(JavaScriptConvert.DeserializeObject <string>(json)); }
/// <summary> /// 关联性性校验 /// </summary> /// yaoy 16.09.27 /// <param name="messageInfo"></param> /// <param name="infoTypeId"></param> /// <param name="metaCode"></param> /// <param name="code"></param> /// <param name="value1"></param> /// <param name="value2"></param> /// <returns></returns> public bool RelevanceValidate(MessageInfo messageInfo, int infoTypeId, int[] metaCode, string code, string[] value1, string[] value2) { var result = true; var dataSegmentInfo = new DataSegment().GetByInfoTypeIdAndCode(infoTypeId, code); var metaInfo = new Meta().Find(metaCode[1]); var segmentRulesInfo1 = new SegmentRules().GetSegmentRulesByInfoTypeIdAndMetaCodeAndCode(infoTypeId, metaCode[0], code); var segmentRulesInfo2 = new SegmentRules().GetSegmentRulesByInfoTypeIdAndMetaCodeAndCode(infoTypeId, metaCode[1], code); if (segmentRulesInfo1 != null) { var temp1 = GetValues(messageInfo, code, segmentRulesInfo1.SegmentRulesId.ToString()); // 判断第一个值取值范围是否在预期范围中 if (value1.Contains(temp1)) { if (segmentRulesInfo2 != null) { var temp2 = GetValues(messageInfo, code, segmentRulesInfo2.SegmentRulesId.ToString()); // 限定第二个值的取值范围 result &= value2.Contains(temp2); if (!result) { throw new ApplicationException(dataSegmentInfo.ParagraphName + metaInfo.Name + "不在预期范围内!"); } } } } return(result); }
public void Update(string title, SegmentRules rules) { HttpHelper.Put(string.Format("/segments/{0}.json", _segmentID), null, JavaScriptConvert.SerializeObject( new Dictionary <string, object>() { { "Title", title }, { "Rules", rules } }) ); }
public void Update(string title, SegmentRules rules) { HttpHelper.Put<Dictionary<string, object>, string>( string.Format("/segments/{0}.json", SegmentID), null, new Dictionary<string, object>() { { "Title", title }, { "Rules", rules } }); }
public static string Create(string listID, string title, SegmentRules rules) { return HttpHelper.Post<Dictionary<string, object>, string, ErrorResult<RuleErrorResults>>( string.Format("/segments/{0}.json", listID), null, new Dictionary<string, object>() { { "ListID", listID }, { "Title", title }, { "Rules", rules } }); }
/// <summary> /// 信息记录中对应数据段的值类型校验 /// </summary> /// yaoy 16.09.23 /// <param name="informationInfo"></param> /// <returns></returns> public bool ValuesValidate() { List <ValidateClass> validateList = new List <ValidateClass>(); List <string> segmentRulesIds = new List <string>(); // metaCode数组 int[] str = new int[] { 5101, 5107, 5109 }; foreach (var item in str) { var segmentRulesInfo = new SegmentRules().GetSegmentRulesByInfoTypeIdAndMetaCodeAndCode(infoTypeID, item, "E"); segmentRulesIds.Add("E" + segmentRulesInfo.SegmentRulesId.ToString()); } List <Dictionary <string, string> > list = validateUtil.GetList(data, "E"); if (list.Count > 1) { foreach (var item in list) { ValidateClass vc = new ValidateClass(); var temp = item.Where(m => segmentRulesIds.Contains(m.Key)).ToArray(); vc.first = temp[0].Value; vc.second = temp[1].Value; vc.third = temp[2].Value; validateList.Add(vc); } } if (validateList.Count > 0) { for (int i = 0; i < validateList.Count; i++) { for (int j = i + 1; j < validateList.Count; j++) { if (validateList[i].first == validateList[j].first && validateList[i].second == validateList[j].second && validateList[i].third == validateList[j].third) { throw new ApplicationException("任意两个担保信息段的姓名、证件类型、证件号码不能完全相同"); } } } } return(true); }
/// <summary> /// 数据段规则校验 /// </summary> /// yaoy 16.09.26 /// <param name="informationInfo"></param> /// <returns></returns> public bool SegmentValidate() { var result = true; // 获取数据段规则实体 var segmentRulesInfo = new SegmentRules().GetSegmentRulesIdByInfoTypeIdAndPosition(infoTypeID); // 获取数据段实体 var dataSegmentInfo = new DataSegment().Get(segmentRulesInfo.BDS_ID); result &= validateUtil.GetValues(data, dataSegmentInfo.ParagraphCode, segmentRulesInfo.SegmentRulesId.ToString()) == "A"; if (!result) { throw new ApplicationException("信息报文第五位必须为基础信息段标识!"); } return(result); }
/// <summary> /// 次数验证 /// </summary> /// yaoy 16.09.27 /// <returns></returns> public bool TimesValidate() { var code = "B"; var metaCode = 7511; var result = true; var segmentRulesInfo = new SegmentRules().GetSegmentRulesByInfoTypeIdAndMetaCodeAndCode(infoTypeID, metaCode, code); // 获取信息记录中数据段B段中数据元规则对应的值 var value = validateUtil.GetValues(data, code, segmentRulesInfo.SegmentRulesId.ToString()); // 信息记录操作类型不为删除 if (value != "4") { result &= validateUtil.TimesValidate(infoTypeID, data); } return(result); }
/// <summary> /// 189,190跨信息记录规则校验 /// </summary> /// yaoy 16.09.27 /// <param name="informationList"></param> /// <param name="infoType"></param> /// <param name="code"></param> /// <param name="metaCode"></param> /// <returns></returns> public bool Value1Proof(int reportId, MessageInfo messageInfo, int infoTypeId, string code, int metaCode) { //校验参数 //var metaCode = 2501; //var code = "B"; //var infoType = new int[] { 18, 17 }; //var metaCode = 2501; //var code = "B"; //var infoType = new int[] { 19, 17 }; // 融资业务还款信息记录集合 var segmentRulesInfo = new SegmentRules().GetSegmentRulesByInfoTypeIdAndMetaCodeAndCode(infoTypeId, metaCode, code); var temp1 = GetValues(messageInfo, code, segmentRulesInfo.SegmentRulesId.ToString()); // 获取不包括本身的所有报文集合 var reportList = new Report().GetReportList(reportId).Where(m => m.ReportID != reportId).ToList(); foreach (var reportInfo in reportList) { var informationList = new InformationRecord().GetByReportId(reportInfo.ReportID); if (informationList != null) { foreach (var informationRecordInfo in informationList) { MessageInfo messageInfo2 = Newtonsoft.Json.JsonConvert.DeserializeObject <MessageInfo>(informationRecordInfo.Context); var segment = new SegmentRules().GetSegmentRulesByInfoTypeIdAndMetaCodeAndCode(informationRecordInfo.InfoTypeID, metaCode, code); var temp2 = GetValues(messageInfo2, code, segment.SegmentRulesId.ToString()); if (temp1 != temp2) { throw new ApplicationException("该报文中业务发生时间必须和融资业务信息记录中业务发生时间保持一致!"); } } } } return(true); }
/// <summary> /// 根据数据段出现次数校验其他段中数据段规则对应的Value /// </summary> /// yaoy 16.09.26 /// <param name="informationInfo"></param> /// <returns></returns> public bool ValueAndTimeVildate() { bool result = true; var segment = new SegmentRules(); var dic = new Dictionary <string, string>(); var dictionary = new Dictionary <string, string>(); // 获取标识变更段出现次数 var time = validateUtil.GetTimes(data, "F"); if (time > 0) { var arr = new int[] { 6101, 7101 }; for (int i = 0; i < arr.Length; i++) { var segmentRulesInfo1 = segment.GetSegmentRulesByInfoTypeIdAndMetaCodeAndCode(infoTypeID, arr[i], "A"); var segmentRulesInfo2 = segment.GetSegmentRulesByInfoTypeIdAndMetaCodeAndCode(infoTypeID, arr[i], "F"); dic.Add("A" + segmentRulesInfo1.SegmentRulesId.ToString(), string.Empty); dictionary.Add("F" + segmentRulesInfo2.SegmentRulesId.ToString(), string.Empty); } dic = validateUtil.GetAllValues(data, "A", dic); dictionary = validateUtil.GetAllValues(data, "F", dictionary); foreach (var item in dic) { foreach (var temp in dictionary) { if (item.Key == temp.Key && item.Value == temp.Value) { throw new ApplicationException("交易标识变更段中 金融机构代码 + 业务号 不能和基础段中 金融机构代码 + 业务号相同"); } } } } return(result); }
public static string Create(string listID, string title, SegmentRules rules) { string json = ""; try { json = HttpHelper.Post(string.Format("/segments/{0}.json", listID), null, JavaScriptConvert.SerializeObject( new Dictionary<string, object>() { { "ListID", listID }, { "Title", title }, { "Rules", rules } }) ); } catch (CreatesendException ex) { if (!ex.Data.Contains("ErrorResult") && ex.Data.Contains("ErrorResponse")) { ErrorResult<RuleErrorResults> result = JavaScriptConvert.DeserializeObject<ErrorResult<RuleErrorResults>>(ex.Data["ErrorResponse"].ToString()); ex.Data.Add("ErrorResult", result); } throw ex; } catch (Exception ex) { throw ex; } return JavaScriptConvert.DeserializeObject<string>(json); }
/// <summary> /// 191,192规则校验 /// </summary> /// yaoy 16.09.27 /// <param name="infoTypeId"></param> /// <param name="messageInfo"></param> /// <param name="metaCode"></param> /// <param name="value"></param> /// <returns></returns> public bool Value2Proof(MessageInfo messageInfo, int infoTypeId, int metaCode, string[] value) { var temp = GetList(messageInfo, "C"); var infoTypeInfo = new InfoType().Get(infoTypeId); foreach (var dic in temp) { var segmentRulesInfo = new SegmentRules().GetSegmentRulesByInfoTypeIdAndMetaCodeAndCode(infoTypeId, metaCode, "C"); var metaInfo = new Meta().GetByInfoTypeIdAndSegmentRulesId(infoTypeId, segmentRulesInfo.SegmentRulesId); if (dic.ContainsKey("C" + segmentRulesInfo.SegmentRulesId.ToString())) { if (dic["C" + segmentRulesInfo.SegmentRulesId.ToString()] == "") { if (value.Contains(dic["C" + segmentRulesInfo.SegmentRulesId.ToString()])) { throw new ApplicationException(infoTypeInfo.InfoName + "标识变更段不能包括" + metaInfo.Name); } } } } return(true); }
/// <summary> /// 校验Value是否重复 /// </summary> /// yaoy 16.09.26 /// <param name="messageInfo"></param> /// <param name="infoTypeId"></param> /// <param name="metaCode"></param> /// <param name="code"></param> /// <returns></returns> public bool RepeatValidate(MessageInfo messageInfo, int infoTypeId, int metaCode, string code) { var temp = new List <string>(); // 获取合同段所有字典类型数据 var list = GetList(messageInfo, code); // 数据段实体 var dataSegmentInfo = new DataSegment().GetByInfoTypeIdAndCode(infoTypeId, code); // 数据元实体 var metaInfo = new Meta().Find(metaCode); // 数据段规则实体 var segmentRulesInfo = new SegmentRules().GetSegmentRulesByInfoTypeIdAndMetaCodeAndCode(infoTypeId, metaCode, code); var tmp = code + segmentRulesInfo.SegmentRulesId.ToString(); if (list != null) { foreach (var dic in list) { if (dic.ContainsKey(tmp)) { // 判断集合中是否存在该值,不存在则添加至集合 if (!IsContains(temp, dic[tmp])) { temp.Add(dic[tmp]); } else { throw new ApplicationException(dataSegmentInfo.ParagraphName + metaInfo.Name + "出现重复!"); } } } } return(true); }
/// <summary> /// 通用验证方法 /// </summary> /// yangj 2016.09.27 /// zouql 2016.10.14 代码整理及新增验证 /// <param name="infoTypeId">信息记录ID</param> /// <param name="data">数据</param> public override void Valid(int infoTypeId, MessageInfo data) { #region 元数据 // 授信额度 var value1101 = GetValue(1101, "A", data); // 最大负债额 var value1103 = GetValue(1103, "A", data); // 余额 var value1109 = GetValue(1109, "A", data); // 当前逾期总额 var value1111 = GetValue(1111, "A", data); // 逾期31-60天未归还贷款本金 var value1113 = GetValue(1113, "A", data); // 逾期61-90天未归还贷款本金 var value1115 = GetValue(1115, "A", data); // 逾期91-180天未归还贷款本金 var value1117 = GetValue(1117, "A", data); // 逾期180天以上未归还贷款本金 var value1119 = GetValue(1119, "A", data); // 开户日期 var value2101 = GetValue(2101, "A", data); // 到期日期 var value2103 = GetValue(2103, "A", data); // 最近一次实际还款日期 var value2107 = GetValue(2107, "A", data); // 结算/还款日期 var value2301 = GetValue(2301, "A", data); // 出生日期 var value2408 = GetValue(2408, "B", data); // 还款月数 var value4101 = GetValue(4101, "A", data); // 剩余还款月数 var value4105 = GetValue(4105, "A", data); // 最高逾期期数 var value4107 = GetValue(4107, "A", data); // 当前逾期期数 var value4109 = GetValue(4109, "A", data); // 还款频率 var value4111 = GetValue(4111, "A", data); // 累计逾期期数 var value4312 = GetValue(4312, "A", data); // 姓名 var value5101 = GetValue(5101, "E", data); // 证件类型 var value5107 = GetValue(5107, "E", data); // 证件号码 var value5109 = GetValue(5109, "E", data); // 金融机构代码 var value6101 = GetValue(6101, "A", data); // 金融机构代码[交易标识变更段] var value6101F = GetValue(6101, "F", data); // 业务号[基础段] var value7101 = GetValue(7101, "A", data); // 业务号[交易标识变更段] var value7101F = GetValue(7101, "F", data); // 24个月(账户)还款状态 var value7107 = GetValue(7107, "A", data); // 账号状态 var value7109 = GetValue(7109, "A", data); // 业务种类细分 var value7111 = GetValue(7111, "A", data); // 业务种类 var value7117 = GetValue(7117, "A", data); // 拥有者信息提示 var value7121 = GetValue(7121, "A", data); #endregion #region // 026 [还款月数] > [剩余还款月数] if (!string.IsNullOrEmpty(value4101) && !string.IsNullOrEmpty(value4105)) { if (value4101 != "O" && value4101 != "U" && value4101 != "C" && value4105 != "O" && value4105 != "U" && value4105 != "C") { if (Convert.ToInt32(value4101) <= Convert.ToInt32(value4105)) { ShowError(message: "基础段中“还款月数” > “剩余还款月数”"); } } } #endregion #region // 029 [余额] <= [最大负债额] if (!string.IsNullOrEmpty(value1109) && !string.IsNullOrEmpty(value1103)) { if (Convert.ToDouble(value1109) > Convert.ToDouble(value1103)) { ShowError(message: "基础段中“余额” <= “最大负债额”"); } } #endregion #region // 020 [还款频率] = '07-一次性', [还款月数] = 'O' [剩余还款月数] = 'O' [还款频率] = '08-不定期',[还款月数] = 'U' [剩余还款月数] = 'U' if (!string.IsNullOrEmpty(value4111) && !string.IsNullOrEmpty(value4101) && !string.IsNullOrEmpty(value4105)) { if (value4111 == "07" && value4101 != "O" && value4105 != "O") { ShowError(message: "基础段中,若“还款频率”为“一次性”,则“还款月数”、“剩余还款月数”用字母“O”填充"); } if (value4111 == "08" && value4101 != "U" && value4105 != "U") { ShowError(message: "基础段中,若“还款频率”为“不定期”,则“还款月数”、“剩余还款月数”用“U”填充"); } } #endregion #region // 028 [最近一次实际还款日期] > [开户日期] if (!string.IsNullOrEmpty(value2107) && !string.IsNullOrEmpty(value2101)) { if (Convert.ToInt32(value2107) < Convert.ToInt32(value2101)) { ShowError(message: "基础段中“最近一次实际还款日期” >= “开户日期”"); } } #endregion #region // 018 [业务种类] = '1-贷款',[授信额度] >= [最大负债额] if (value7117 == "1" && !string.IsNullOrEmpty(value1101) && !string.IsNullOrEmpty(value1103)) { if (Convert.ToDouble(value1101) < Convert.ToDouble(value1103)) { ShowError(message: "基础段中“授信额度” >= “最大负债额”"); } } #endregion #region // 015 [业务种类] = '2-信用卡',[到期日期] = '20991231' if (value7117 == "2" && !string.IsNullOrEmpty(value2103)) { if (value2103 != "20991231") { ShowError(message: "基础段中,当“业务种类”为“信用卡”时,“到期日期”必须为“20991231”"); } } #endregion #region // 017 [业务种类] = '2-信用卡',[业务种类细分] = '71-贷记卡' or [业务种类细分] = '81-准贷记卡' if (value7117 == "2" && !string.IsNullOrEmpty(value7111)) { if (value7111 != "71" && value7111 != "81") { ShowError(message: "基础段中,“业务种类”为“信用卡”时,“业务种类细分”只能填写“准贷记卡”、“贷记卡”"); } } #endregion #region // 015 [开户日期] <= [结算/应还款日期] if (!string.IsNullOrEmpty(value2101) && !string.IsNullOrEmpty(value2301)) { if (Convert.ToInt32(value2101) > Convert.ToInt32(value2301)) { ShowError(message: "基础段中“开户日期” <= “结算/还款日期”"); } } #endregion #region // 015 [开户日期] <= [到期日期] if (!string.IsNullOrEmpty(value2101) && !string.IsNullOrEmpty(value2103)) { if (Convert.ToInt32(value2101) > Convert.ToInt32(value2103)) { ShowError(message: "基础段中“开户日期” <= “到期日期”"); } } #endregion #region // 022 [业务种类] = '1-贷款' [账号状态] = '3-结算',[余额] = '0' [当前逾期期数] = '0' [当前逾期总额] = '0' if (value7117 == "1" && value7109 == "3") { if (value1109 != "0" || value4109 != "0" || value1111 != "0") { ShowError(message: "基础段中,“业务种类”为“贷款”,且“账户状态为”结清”时,“余额、当前逾期期数、当前逾期总额”必须为零"); } } #endregion #region // 021 [业务种类] = '1-贷款' [账号状态] = '2-逾期' or [账号状态] = '4-呆账',[当前逾期期数] != '0' [当前逾期总额] != '0' [累计逾期期数] != '0' [最高逾期期数] != '0' if (value7117 == "1" && (value7109 == "2" || value7109 == "4")) { if (value4109 == "0" || value1111 == "0" || value4312 == "0" || value4107 == "0") { ShowError(message: "基础段中,业务种类”为“贷款”时,若“账户状态”为“逾期”或“呆账”,则“当前逾期期数、当前逾期总额、累计逾期期数、最高逾期期数”不能为零"); } } #endregion #region // 030 [业务种类] = '2-信用卡' [业务种类细分] = '81-贷记卡',[余额] >= [当前逾期总额] if (value7117 == "2" && value7111 == "81" && !string.IsNullOrEmpty(value1109) && !string.IsNullOrEmpty(value1111)) { if (Convert.ToDouble(value1109) < Convert.ToDouble(value1111)) { ShowError(message: "基础段中,“业务种类”为“信用卡”,且“业务种类细分”为“贷记卡”时,”余额”>=“当前逾期总额”"); } } #endregion #region // 019 [业务种类] = "1-贷款",[还款频率] != "C" if (value7117 == "1" && !string.IsNullOrEmpty(value4111)) { if (value4111 == "C") { ShowError(message: "基础段中,“业务种类”为“贷款”时,“还款频率”必须为“信用卡还款频率”以外的数据字典中的值"); } } #endregion #region // 019 [业务种类] = "2-信用卡",[还款频率] = "C" if (value7117 == "2" && !string.IsNullOrEmpty(value4111)) { if (value4111 != "C") { ShowError(message: "基础段中,“业务种类”为“信用卡”时,“还款频率”填“信用卡还款频率”"); } } // 019 [业务种类] = "2-信用卡",[还款月数] = "C" [剩余还款月数] = "C" if (value7117 == "2" && !string.IsNullOrEmpty(value4101) && !string.IsNullOrEmpty(value4105)) { if (value4101 != "C" || value4105 != "C") { ShowError(message: "基础段中,“业务种类”为“信用卡”时,“还款月数”、“剩余还款月数”填“C”"); } } #endregion #region // 016 [业务种类] = "1-贷款",[业务种类细分] = "11-个人住房贷款" or "12-个人商用房贷款" or "13-个人住房公积金贷款" or "21-个人汽车贷款" or "31-个人助学贷款" or "41-个人经营性贷款" or "51-农户贷款" or "91-个人消费贷款" or "99-其他" if (value7117 == "1" && !string.IsNullOrEmpty(value7111)) { if (value7111 != "11" && value7111 != "12" && value7111 != "13" && value7111 != "21" && value7111 != "31" && value7111 != "41" && value7111 != "51" && value7111 != "91" && value7111 != "99") { ShowError(message: "基础段中,“业务种类”为“贷款”时,“业务种类细分”只能填写“个人住房贷款”、“个人商用房贷款”、“个人住房公积金贷款”、“个人汽车贷款”、“个人助学贷款”、“个人经营性贷款”、“农户贷款”、“个人消费贷款”、“其他”"); } } #endregion #region // 账户状态数据段规则ID,账户状态选项选中值 var accountStatusId = new SegmentRules().GetIdByMetaAndInfoType(infoTypeId, 7109, "A"); var accountStatusCode = value7109; // 016 [业务种类]= "1-贷款",[账户状态] 必须填写[贷款]项下的代码 if (value7117 == "1" && !string.IsNullOrEmpty(accountStatusId) && !string.IsNullOrEmpty(accountStatusCode)) { var result = new CodeProofMethod().CodePoorfMethod(Convert.ToInt32(accountStatusId), accountStatusCode); if (result == false) { ShowError(message: "基础段中,“业务种类”为“贷款”时,“账户状态”必须填写“贷款”项下的代码"); } } // 017 [业务种类]= "2-信用卡",[账户状态] 必须填写[信用卡]项下的代码 if (value7117 == "2" && !string.IsNullOrEmpty(accountStatusId) && !string.IsNullOrEmpty(accountStatusCode)) { var result = new CodeProofMethod().CodePoorfMethod(Convert.ToInt32(accountStatusId), accountStatusCode); if (result == false) { ShowError(message: "基础段中,“业务种类”为“信用卡”时,“账户状态”必须填写“信用卡”项下的代码"); } } #endregion #region // 031 [逾期31-60天未归还贷款本金]+[逾期61-90天未归还贷款本金]+[逾期91-180天未归还贷款本金]+[逾期180天以上未归还贷款本金] <= [余额]+2 if (!string.IsNullOrEmpty(value1113) && !string.IsNullOrEmpty(value1115) && !string.IsNullOrEmpty(value1117) && !string.IsNullOrEmpty(value1119) && !string.IsNullOrEmpty(value1109)) { var sum = Convert.ToInt32(value1113) + Convert.ToInt32(value1115) + Convert.ToInt32(value1117) + Convert.ToInt32(value1119); if (sum > (Convert.ToInt32(value1109) + 2)) { ShowError(message: "基础段中,“逾期31-60天未归还贷款本金”+“逾期61-90天未归还贷款本金”+“逾期91-180天未归还贷款本金”+“逾期180天以上未归还贷款本金” <= “余额”+2"); } } #endregion #region // 033 [逾期31-60天未归还贷款本金]+[逾期61-90天未归还贷款本金]+[逾期91-180天未归还贷款本金]+[逾期180天以上未归还贷款本金] <= [当前逾期总额]+2 if (!string.IsNullOrEmpty(value1113) && !string.IsNullOrEmpty(value1115) && !string.IsNullOrEmpty(value1117) && !string.IsNullOrEmpty(value1119) && !string.IsNullOrEmpty(value1111)) { var sum = Convert.ToInt32(value1113) + Convert.ToInt32(value1115) + Convert.ToInt32(value1117) + Convert.ToInt32(value1119); if (sum > (Convert.ToInt32(value1111) + 2)) { ShowError(message: "基础段中,“逾期31-60天未归还贷款本金”+“逾期61-90天未归还贷款本金”+“逾期91-180天未归还贷款本金”+“逾期180天以上未归还贷款本金” <= “当前逾期总额”+2"); } } #endregion #region // 032 [业务种类]= "1-贷款",[当前逾期期数] <= [最高逾期期数] <= [累计逾期期数] if (value7117 == "1" && !string.IsNullOrEmpty(value4109) && !string.IsNullOrEmpty(value4107) && !string.IsNullOrEmpty(value4312)) { var result = Convert.ToInt32(value4109) <= Convert.ToInt32(value4107) && Convert.ToInt32(value4107) <= Convert.ToInt32(value4312); if (!result) { ShowError(message: "基础段中“业务种类”为“贷款”时,“当前逾期期数” <= “最高逾期期数” <= “累计逾期期数”"); } } #endregion #region // 009 有效日期验证(出生日期不能大于当前日期) if (!string.IsNullOrEmpty(value2408)) { if (Convert.ToInt32(value2408) > Convert.ToInt32(string.Format("{0:yyyyMMdd}", DateTime.Now))) { ShowError(message: "出生日期不能大于当前日期"); } } #endregion #region // 040 担保信息段中“证件类型”为“0-身份证”时,担保信息段中“证件号码”必须为15位或18位,且15位身份证号码的每一位必须都是数字,18位身份证号码的前17位必须都是数字,18位身份证号码的最后一位必须都是数字或大写的X。 if (!string.IsNullOrEmpty(value5107) && !string.IsNullOrEmpty(value5109)) { var value5107Array = value5107.Split('.'); var value5109Array = value5109.Split('.'); for (var i = 0; i < value5107Array.Length; i++) { var reg = ValidFn.IdCard_Valid(value5109Array[i]); if (value5107Array[i] == "0" && !reg) { ShowError(message: "担保信息段中,证件号码错误"); } } } #endregion #region // 担保信息段中,任意两个担保信息段的“证件类型、“证件号码”不能完全相同 if (!string.IsNullOrEmpty(value5101) && !string.IsNullOrEmpty(value5107) && !string.IsNullOrEmpty(value5109)) { var value5101Array = value5101.Split('.'); var value5107Array = value5107.Split('.'); var value5109Array = value5109.Split('.'); var tempArray = new List <string>(); for (var i = 0; i < value5101Array.Length; i++) { if (!tempArray.Contains(value5107Array[i] + value5109Array[i])) { tempArray.Add(value5107Array[i] + value5109Array[i]); } } if (tempArray.Count != value5101Array.Length) { ShowError(message: "担保信息段中,任意两个担保信息段的“证件类型、“证件号码”不能完全相同"); } } #endregion #region // 交易标识变更段中“金融机构代码”+“业务号”不能和基础段中“金融机构代码”+“业务号”相同 if (!string.IsNullOrEmpty(value6101) && !string.IsNullOrEmpty(value6101F) && !string.IsNullOrEmpty(value7101) && !string.IsNullOrEmpty(value7101F)) { if (value6101.Equals(value6101F) && value7101.Equals(value7101F)) { ShowError(message: "交易标识变更段中“金融机构代码”+“业务号”不能和基础段中“金融机构代码”+“业务号”相同"); } } #endregion #region // 当基础段中的账户拥有者信息提示为“2-新账户开立”时,不能包含交易标识变更段 // 当基础段中的账户拥有者信息提示为“1-已开立账户”时,不能包含身份信息段、职业信息段、居住地址段 if (!string.IsNullOrEmpty(value7121)) { if (value7121.Equals("2") && data.F.Count > 0) { ShowError(message: "当基础段中的账户拥有者信息提示为“新账户开立”时,不能包含交易标识变更段"); } else if (value7121.Equals("1")) { if (data.B.Count > 0 || data.C.Count > 0 || data.D.Count > 0) { ShowError(message: "当基础段中的账户拥有者信息提示为“已开立账户”时,不能包含身份信息段、职业信息段、居住地址段"); } } } #endregion #region // 新增验证 #endregion }
public void Update(string title, SegmentRules rules) { HttpHelper.Put(string.Format("/segments/{0}.json", _segmentID), null, JavaScriptConvert.SerializeObject( new Dictionary<string, object>() { { "Title", title }, { "Rules", rules } }) ); }
public static string Create(string listID, string title, SegmentRules rules) { return Create(CreateSendOptions.ApiKey, listID, title, rules); }