以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]想写一段关于验证的代码 如果创建订单的时间不足30分钟,那么这个订单不允许被验证  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=102722)

--  作者:a87994078
--  发布时间:2017/6/24 16:43:00
--  [求助]想写一段关于验证的代码 如果创建订单的时间不足30分钟,那么这个订单不允许被验证
想写一段关于验证的代码


如果创建订单的时间不足30分钟,那么这个订单不允许被验证



Dim d1 As Date = DataTables("预定统计").DataRows.·····(不会写了)
Dim d2 As Date = Date.now
Dim t As TimeSpan = d2 - d1
If t.TotalMinutes >= 30  Then
    MessageBox.Show( "是否验证","提示",MessageBoxButtons.YesNo,MessageBoxIcon.Question)
Else
    MessageBox.Show("剩余时间:" & 30 - t.Minutes & "分钟")
End If


图片点击可在新窗口打开查看此主题相关图片如下:12123132.jpg
图片点击可在新窗口打开查看

[此贴子已经被作者于2017/6/24 16:46:48编辑过]

--  作者:狐狸爸爸
--  发布时间:2017/6/24 16:59:00
--  
你是怎么验证的? 做了一个验证按钮?
如果是按钮:


Dim d1 As Date = Tables("预定统计").Current("日期列名")
Dim d2 As Date = Date.now
Dim t As TimeSpan = d2 - d1
If t.TotalMinutes >= 30  Then
    MessageBox.Show( "是否验证","提示",MessageBoxButtons.YesNo,MessageBoxIcon.Question)
    ...
Else
    MessageBox.Show("剩余时间:" & 30 - t.Minutes & "分钟")
End If

--  作者:狐狸爸爸
--  发布时间:2017/6/24 17:01:00
--  
如果是在某一列打勾验证,设置DataColChanging事件:

If e.DataCol.Name = "打勾列名" And e.NewValue = True Then
    Dim d1 As Date = e.DataRow("日期列名")
    Dim d2 As Date = Date.now
    Dim t As TimeSpan = d2 - d1
    If t.TotalMinutes >= 30  Then
        MessageBox.Show( "是否验证","提示",MessageBoxButtons.YesNo,MessageBoxIcon.Question)
        ...
    Else
        MessageBox.Show("剩余时间:" & 30 - t.Minutes & "分钟")
        e.Cancel = True
    End If
End If

--  作者:a87994078
--  发布时间:2017/6/24 17:07:00
--  
If e.DataCol.Name = "打勾列名" And e.NewValue = True Then
就是这一句不会写
[此贴子已经被作者于2017/6/24 17:07:09编辑过]

--  作者:狐狸爸爸
--  发布时间:2017/6/24 17:10:00
--  
这是不应该的,看一下DataColChanging事件的说明就知道怎么写了
--  作者:a87994078
--  发布时间:2017/6/24 17:15:00
--  


 


此主题相关图片如下:777.jpg
按此在新窗口浏览图片

客房预定_BeforeSaveDataRow
此主题相关图片如下:1010.jpg
按此在新窗口浏览图片

 项目事件

 

计划管理

 

表事件

 


 

预定统计_DataColChanging

 

If e.DataCol.Name = "验证状态" And e.NewValue = False Then

    Dim d1 As Date

    d1 = e.DataRow("下单日期")

    Dim d2 As Date

    d2 = Date.now

    Dim t As TimeSpan = d2 - d1

    If t.TotalMinutes >= 30  Then

        MessageBox.Show( "是否验证","提示",MessageBoxButtons.YesNo,MessageBoxIcon.Question)

        

    Else

        MessageBox.Show("剩余时间:" & 30 - t.Minutes & "分钟")

        e.Cancel = True

    End If

End If

 

预定统计_DataColChanged

 

Select Case e.DataCol.Name

    Case "验证状态"

        If e.NewValue = True Then

            

            e.DataRow("验证员") = User.Name

        End If

End Select

 

Select Case e.DataCol.Name

    Case "撤销验证"

        If e.NewValue = True Then

            e.DataRow("验证状态")= False

            e.DataRow("撤销验证人") = User.Name

            e.DataRow("验证员") = Nothing

        End If

End Select

 

预定统计_DataRowAdding

 

e.DataRow("下单日期") = Date.Now

e.DataRow("代理商名称") = User.Name

 

窗口表事件

 

窗口与控件事件

 

自定义函数

 

全局代码

 

Default

 

 

 

菜单事件

 

 

[此贴子已经被作者于2017/6/24 17:59:20编辑过]

--  作者:有点蓝
--  发布时间:2017/6/24 17:43:00
--  
列名是否用对。贴出完整代码
--  作者:a87994078
--  发布时间:2017/6/24 17:47:00
--  
明天我再整理一下 ,思路乱了