Dim e As RequestEventArgs = args(0)
Dim wb As New weui
If e.PostValues.Count = 0 Then
wb.AddPageTitle("","ph1","查询条件")
wb.AddForm("","form1","viewtest.htm")
With wb.AddButtonGroup("form1","btg1",True)
.Add("btn1", "查询信息","submit")
.Add("btn2", "新增信息","","addtest.htm?ordertype=weixin")
End With
e.WriteString(wb.Build)
End If
Dim e As RequestEventArgs = args(0)
Dim wb As New weui
If e.PostValues.Count = 0 Then '生成增加订单网页
wb.AddForm("","form1","addtest.htm")
With wb.AddInputGroup("form1","ipg1","录入资料")
.AddInput("姓名","姓名","text")
.AddSelect("性别","性别","男|女")
.AddInput("身份证号","身份证号","text")
.AddInput("手机号","手机号","text")
With .AddUploader("身份证照片","身份证照片",False)
.TextPosition = 0 '标题靠左
End With
With .AddUploader("操作证照片","操作证照片",False)
.TextPosition = 0 '标题靠左
End With
With .AddUploader("合同照片","合同照片",False)
.TextPosition = 0 '标题靠左
End With
End With
With wb.AddButtonGroup("form1","btg1",True)
.Add("btn1", "提交", "submit")
.Add("btn2", "返回", "","maintest.htm")
End With
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 Nothing '必须返回
End If
Next
Dim nms2() As String = {"身份证照片","操作证照片","合同照片"}
Dim dr As DataRow
dr = DataTables("员工资料").AddNew()
Dim orderType As String = e.Values("ordertype" )
Dim code As String = e.Values( "code" )
If orderType= "weixin" Then '微信授权的网页才会有code参数
Dim wechatserv = WeChat.WeChatServer.Server ("wxe491a3cc46a558fe")
Dim uinfo = wechatserv.UserController.GetOauth2UserInfo(code) '获取微信用户信息
If uinfo.Success Then
dr("openid") = uinfo.openid
End If
End If
For Each nm As String In nms
dr(nm) = e.PostValues(nm)
Next
For Each key As String In e.Files.Keys
For Each fln As String In e.Files(key)
e.SaveFile(key, fln, ProjectPath & "Attachments\" & fln)
Next
If key = "身份证照片" Then
dr.Lines("身份证照片") = e.Files(key)
ElseIf key = "操作证照片" Then
dr.Lines("操作证照片") = e.Files(key)
ElseIf key = "合同照片" Then
dr.Lines("合同照片") = e.Files(key)
End If
Next
dr.Save()
With wb.AddMsgPage("","msgpage","提交成功", "数据已上传到服务器") '增加订单成功提示信息
.AddButton("btn1","确定","maintest.htm")
End With
End If
e.WriteString(wb.Build) '生成网页