--
重复提交没有弹出提示,直接提交保存了
Dim e As RequestEventArgs = args(0)
Dim wb As New weui
Select Case e.Path
Case "bc.htm"
If e.PostValues.Count = 0 Then
wb.AddForm("","form1","bc.htm")
With wb.AddInputGroup("form1","ipg1","报餐日期")
.AddInput("报餐日期","报餐日期","date")
End With
With wb.AddCheckGroup("form1","选择","选择报餐")
.Add("早餐","早餐")
.Add("中餐","中餐")
.Add("晚餐","晚餐")
End With
With wb.AddButtonGroup("form1","btg1",True)
.Add("btn1", "确定", "submit")
End With
e.WriteString(wb.Build)
Else
Dim nms() As String = {"报餐日期"} \'不能为空的列名数组
For Each nm As String In nms
If e.PostValues.ContainsKey(nm) = False Then \'生成错误提示页
With wb.AddMsgPage("","msgpage","增加失败", nm & "报餐日期不能为空!")
.icon = "Warn" \'改变图标
.AddButton("btn1","返回").Attribute = ""
End With
e.WriteString(wb.Build)
\'Return \'必须返回
End If
Next
Dim hpr = DataTables("报餐").Find("[姓名] = \'" & e.PostValues("姓名") & "\' and [工号] = \'" & e.PostValues("工号") & "\'and [报餐日期] = \'" & e.PostValues("报餐日期") & "\'")
MessageBox.show(hpr)
If hpr IsNot Nothing Then \'在这里,再处理你网页提交过来的值
If e.values("早餐") = True Then
If hpr("早餐") = True Then
msgbox("早餐已经订过")
Else
hpr("早餐") = True
End If
End If
If e.values("午餐") = True Then
If hpr("午餐") = True Then
msgbox("午餐已经订过")
Else
hpr("午餐") = True
End If
End If
If e.values("晚餐") = True Then
If hpr("晚餐") = True Then
msgbox("晚餐已经订过")
Else
hpr("晚餐") = True
End If
End If
Else
Dim dr As DataRow = DataTables("报餐").AddNew() \'新增一行,录入各列数据
For Each nm As String In nms
If e.PostValues.ContainsKey(nm) Then
dr(nm) = e.PostValues(nm)
End If
Next
dr("早餐") = e.PostValues("早餐")
dr("中餐") = e.PostValues("中餐")
dr("晚餐") = e.PostValues("晚餐")
dr("报餐时间") = Date.Today
dr("姓名") = name
dr("工号") = gh
Dim tp As TimeSpan = dr("报餐日期") - dr("报餐时间")
dr("报餐") = tp.TotalDays
If dr("报餐")> =1 Then
dr.save()
With wb.AddMsgPage("","msgpage","报餐增加成功", "请按提交的报餐消费") \'生成成功提示页
.AddButton("btn1","继续报餐","bc.htm")
End With
Else
With wb.AddMsgPage("","msgpage","报餐不成功,您需要提前报餐", "请重新选择报餐日期") \'生成成功提示页
.icon = "Warn"
.AddButton("btn1","继续报餐","bc.htm")
End With
End If
End If
e.WriteString(wb.Build)
End If
End If
End If
End Select