Dim e As RequestEventArgs = args(0)
Dim wb As New weui
Dim Pagetext As Integer = e.GetValues("page")
Dim PrimaryKey As Integer = e.GetValues("key")
wb.AppendHTML("<link rel='stylesheet' href='./lib/mark.css'/>",True)
If e.PostValues.Count = 0 Then '生成增加订单网页
Dim dr As DataRow = DataTables("订餐明细表").SQLFind("[_Identify]=" & PrimaryKey)
If dr IsNot Nothing Then
wb.AddForm("","form1","addnew.htm?key=" & PrimaryKey & "&page=" & Pagetext)
End If
wb.AddForm("","form1","addnew.htm")
With wb.AddInputGroup("form1","ipg1","增加订单主表")
' .AddHiddenValue("编号", dr("_Identify"))
.AddInput("xm","姓名","text") '.value= User.name 默认登录用户,已试可用
.AddInput("rq","日期","date").value = Date.today
.AddInput("fs","份数","text").value = 1
End With
With wb.AddButtonGroup("form1","btg1",True)
.Add("btn1", "确定", "submit")
End With
Else '保存新增的订单
Dim dr As DataRow = DataTables("订餐明细表").addnew()
Dim inms() As String = {"xm","rq","fs"} '输入框名称数组
Dim cnms() As String = {"姓名","日期","份数"} '列名数组,注意列名和输入框必须一一对应,位置不能错乱
For i As Integer = 0 To inms.Length -1
dr(cnms(i)) = e.PostValues(Inms(i))
Next
dr.Save()
With wb.AddMsgPage("","msgpage","增加成功", "不错!继续努力!!") '增加订单成功提示信息
.AddButton("btn1","继续增加","addnew.htm")
.AddButton("btn1","返回列表","list.htm")
End With
End If
wb.AppendHTML("<script src='./lib/order.js'></script>")
e.WriteString(wb.Build) '生成网页