Foxtable(狐表)用户栏目专家坐堂 → 政治面貌 、入党时间、党龄的逻辑关系


  共有2227人关注过本帖树形打印复制链接

主题:政治面貌 、入党时间、党龄的逻辑关系

美女呀,离线,留言给我吧!
susu312
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:四尾狐 帖子:997 积分:6752 威望:0 精华:0 注册:2018/6/8 16:17:00
政治面貌 、入党时间、党龄的逻辑关系  发帖心情 Post By:2018/9/9 15:37:00 [只看该作者]

老师,我在政治面貌的validating事件中写如下代码,但是党龄老是写不上去,我大概应该写在入党时间的validating事件下?

 

Dim txt As String = e.Sender.Text
'If txt <> Nothing Then
If  txt > "" Then
     If txt.Length > 20 Then 
         e.Sender.Error = "政治面貌长度不允许超过20"
     Else
         e.Sender.Text= txt.Replace(" ","")
          If e.Form.Controls("politicalStatus").Value ="中共党员" Then
             If e.Form.Controls("partyTime").Value ="" Then
                e.Form.Controls("PartyTime").Error= "入党时间不允许为空"
             Else
                e.Form.Controls("PartyTime").Error= ""
                Dim d As Date = e.Form.Controls("partyTime").Value
                Dim y As Integer = d.year
                If format(d, "MMdd") <= Format(Date.Today, "MMdd") Then
                    y = Date.Today.Year - y-1
                Else
                    y = 0
                End If
                If y < 0 Then
                     e.Form.Controls("partyStanding").Value = 0
                 End If
             End If   
         End If
     End If
End If


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/9/9 16:47:00 [只看该作者]

改成

 

Dim txt As String = e.Sender.Text
'If txt <> Nothing Then
If  txt > "" Then
     If txt.Length > 20 Then 
         e.Sender.Error = "政治面貌长度不允许超过20"
     Else
         e.Sender.Text= txt.Replace(" ","")
          If e.Form.Controls("politicalStatus").Value ="中共党员" Then
             If e.Form.Controls("partyTime").Value ="" Then
                e.Form.Controls("PartyTime").Error= "入党时间不允许为空"
             Else
                e.Form.Controls("PartyTime").Error= ""
                Dim d As Date = e.Form.Controls("partyTime").text
                Dim y As Integer = d.year
                If format(d, "MMdd") <= Format(Date.Today, "MMdd") Then
                    y = Date.Today.Year - y-1
                Else
                    y = 0
                End If

msgbox(d)
                If y < 0 Then
                     e.Form.Controls("partyStanding").Value = 0

                 End If

e.Form.Controls("partyStanding").Value = y

e.Form.Controls("partyStanding").WriteValue
             End If   
         End If
     End If
End If


 回到顶部
帅哥哟,离线,有人找我吗?
shenyl0211
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:四尾狐 帖子:977 积分:6835 威望:0 精华:0 注册:2012/4/2 21:49:00
  发帖心情 Post By:2018/9/9 22:32:00 [只看该作者]

入党时间为空=政治面貌为群众
入党时间不为空=政治面貌为党员,并计算党龄

 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/9/9 22:53:00 [只看该作者]

实例发上来测试。

 回到顶部