Case "jihuo.htm" '激活卡号
If e.PostValues.Count = 0 Then
wb.AddTopTips("", "toptip1", "") '用于显示动态错误提示
wb.AddForm("", "form1", "jihuo.htm")
UserName = e.Cookies("username")
OpenID = e.Cookies("openid")
KHID = e.Cookies("KHID")
Dim dr2 As DataRow = DataTables("会员充值").SQLFind("openid ='" & Openid & "'")
If dr2 Is Nothing Then
If e.PostValues.ContainsKey("卡号") AndAlso e.PostValues.ContainsKey("激活码") Then '判断是否是验证失败后的重新登录
' Dim Verified As Boolean '用于标记用户是否通过了身份验证
Dim 卡号 As String
Dim 激活码 As String
卡号 = e.PostValues("卡号")
激活码 = e.PostValues("激活码")
Dim drtk As DataRow
drtk = DataTables("提卡明细").SQLFind("卡号 ='" & 卡号 & "'")
' Dim 激活码 As String
If drtk("卡号") IsNot Nothing AndAlso drtk("激活码") = DataTables("提卡明细").SQLFind("激活码 ='" & 激活码 & "' and 卡号 ='" & 卡号 & "'") Then
If e.PostValues("卡号") = drtk("卡号") AndAlso e.PostValues("激活码") = drtk("激活码") Then
'DataTables("提卡明细").SQLFind("卡号 ='" & 卡号 & "'") Then
Verified = True '验证正确
Else
wb.AddTopTips("", "toptip1", "卡号或密码错误!").msec = 2000 '如果用户通过登录按钮访问,则给用户一个2秒的提示.
End If
End If
End If
With wb.AddInputGroup("form1", "ipg1", "客户资料") '空行时候,从客户信息里引来的数据
.AddHiddenValue("openid", dr1("openid"))
.AddHiddenValue("KHID", dr1("KHID"))
.AddHiddenValue("nickname", dr1("nickname"))
.AddInput("姓名", "姓名", "Text").value = dr1("客户名") '前一个"姓名"是ID,后一个"姓名"是标题
.AddInput("电话", "电话", "number").value = dr1("电话")
With .AddInput("地址", "地址", "Text")
.value = dr1("客户住址_蓝牌地址")
.PlaceHolder = "唯一地址,不可更改"
End With
End With
With wb.AddInputGroup("form1", "ipg2", "会员类型")
With .AddSelect("类别", "类别", "|" & DataTables("会员类型").GetComboListString("类别"))
.Attribute = """
End With
.AddSelect("会员类型", "会员类型", "")
.AddHiddenValue("入会日期", Date.Today)
.AddInput("年费", "售价", "Text")
.AddInput("卡号", "卡号", "Text")
.AddInput("激活码", "密码", "password")
.AddInput("销售人", "推荐人", "Text")
End With
With wb.AddButtonGroup("form1", "btg1", True)
.Add("btn3", "提交绑卡信息", "submit")
End With
e.WriteString(wb.Build)
ElseIf dr2("姓名")IsNot Nothing AndAlso dr2("电话")IsNot Nothing AndAlso dr2("地址")IsNot Nothing AndAlso dr2("卡号")IsNot Nothing AndAlso dr2("销售人")IsNot Nothing AndAlso dr2("年费")IsNot Nothing Then
With wb.AddInputGroup("form1", "ipg1", "客户资料") '有值后,从记录信息里读取数据
' .AddInput("姓名", "姓名", "Text").value = dr2("姓名") '前一个"姓名"是ID,后一个"姓名"是标题
' .AddInput("openid", "openid", "Text").value = dr2("openid")
' .AddInput("nickname", "昵称", "Text").value = dr2("nickname")
' .AddInput("KHID", "KHID", "Text").value = dr2("KHID")
With .AddInput("电话", "电话", "number")
.value = dr2("电话")
.Readonly = True
End With
With .AddInput("地址", "地址", "Text")
.value = dr2("地址")
.Readonly = True
End With
End With
With wb.AddInputGroup("form1", "ipg2", "会员详情")
With .AddInput("入会日期", "日期", "Text")
.value = dr2("入会日期")
.Readonly = True
End With
.AddInput("到期日期", "到期", "Text").value = dr2("到期日期")
With .AddInput("会员类型", "类型", "Text")
.value = dr2("会员类型")
.Readonly = True
End With
With .AddInput("卡号", "卡号", "Text")
.value = dr2("卡号")
.Readonly = True
End With
With .AddInput("剩余天数", "剩余天数", "Text")
.value = dr2("剩余天数")
.Readonly = True
End With
With .AddInput("消费次数", "消费次数", "Text")
.value = dr2("消费次数")
.Readonly = True
End With
With .AddInput("状态", "状态", "Text")
.value = dr2("次状态")
.Readonly = True
End With
End With
With wb.AddButtonGroup("form1", "btg1", True)
' .Add("btn1", "不可修改", "submit").Kind = 1
.Add("btn2", "返回主页", "button", "default.htm")
End With
e.WriteString(wb.Build)
End If
Else
Dim nms() As String = {"openid", "姓名", "电话", "入会日期", "地址", "类别", "会员类型", "卡号", "年费", "销售人", "激活码"} '不能为空的列名数组
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
nms = New String() {"openid", "nickname", "KHID", "姓名", "电话", "入会日期", "类别", "地址", "会员类型", "卡号", "年费", "销售人"} '重新定义了nms数组,增加了两列.
Dim dr3 As DataRow = DataTables("会员充值").AddNew()
For Each nm As String In nms
If e.PostValues.ContainsKey(nm) Then
dr3(nm) = e.PostValues(nm)
End If
Next
'保存并生成增加成功提示页面
dr3.save()
With wb.AddMsgPage("", "msgpage", "增加成功", "好服务") '生成成功提示页
' .AddButton("btn1", "继续修改", "jihuo.htm").Kind = 1
.AddButton("btn2", "返回首页", "default.htm")
End With
e.WriteString(wb.Build)
End If