Foxtable(狐表)用户栏目专家坐堂 → 身份证审核


  共有1497人关注过本帖平板打印复制链接

主题:身份证审核

帅哥哟,离线,有人找我吗?
ayiken
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:童狐 帖子:266 积分:2166 威望:0 精华:0 注册:2014/12/16 12:25:00
身份证审核  发帖心情 Post By:2017/2/21 18:13:00 [只看该作者]

1.各位狐表专家!我用的这些代码虽然准确运作,但是顺序有点乱,本人水平有限,整理不了,请帮忙整理下
2.我想这些代码执行之前能审核身份证号是否正确的代码,正确执行,则不执行,要求充填、修改

If e.DataCol.Name = "身份证号码" Then '是身份证号码发生变化吗?
    If e.DataRow.IsNull("身份证号码") Then '身份证号码是否为空
        e.DataRow("出生日期") = Nothing '如果为空,则清除出生日期
    Else
        '否则从身份证号码列中提取出生日期
        e.DataRow("出生日期") = ReadBirthday(e.DataRow("身份证号码"))
    End If
ElseIf e.DataCol.name = "出生日期" Then
    If e.newvalue <> Nothing Then
        Dim y As Integer = e.NewValue.year
        If format(e.newvalue, "MMdd") <= Format(Date.Today, "MMdd") Then
            e.DataRow("年龄") = Date.Today.Year - y
        Else
            e.DataRow("年龄") = Date.Today.Year - y -1
        End If
    Else
        e.DataRow("年龄") = Nothing
    End If
End If

Select Case e.DataCol.name
    Case "身份证号码"
        If e.DataRow.IsNull("身份证号码") Then
            e.DataRow("出生地点") = Nothing
            e.DataRow("籍贯") = Nothing
            e.DataRow("国籍") = Nothing
        Else
            Dim szd As String = e.DataRow("身份证号码").SubString(0,6)
            Dim jg As String = e.DataRow("身份证号码").SubString(0,2)
            Dim gj As String = e.DataRow("身份证号码").SubString(0,1)
            Dim dr As DataRow = DataTables("身份证籍贯编码").Find("籍贯编码 = '" & szd & "'")
            Dim dc As DataRow = DataTables("身份证籍贯编码").Find("籍贯编码 = '" & jg & "'")
            Dim dt As DataRow = DataTables("身份证籍贯编码").Find("籍贯编码 = '" & gj & "'")
            If dr  IsNot Nothing Then
                e.DataRow("出生地点") = dr("哈文名称")
                e.DataRow("籍贯") = dc("哈文名称")
                e.DataRow("国籍") = dt("哈文名称")
                
            End If
        End If
End Select
Dim rq As DataRow = e.DataRow
Dim t As TimeSpan
If e.DataCol.Name = "出院日期" Then
    If rq.IsNull("入院日期") OrElse rq.IsNull("入院日期") Then
        rq("住院天数") = Nothing
    Else
        t = rq("出院日期")-rq("入院日期")
        rq("住院天数") = t.Days
    End If
End If


帮忙一下

 回到顶部