Dim e As RequestEventArgs = args(0) Dim wb As New WeUI '定义一个基于weui框架的网页生成器 Select Case e.Path Case "kfsx.htm" Dim bm As String Dim gw As String Dim name As String Dim userid = Functions.Execute("验证函数",e,"kfsx.htm") If userid > "" Then wb.AppendCookie("userid",userid) '将用户名和密码写入cookie Dim wxdr As DataRow = DataTables("users").SQLFind("userid='" & userid & "'") If wxdr IsNot Nothing Then gw = wxdr("position") name = wxdr("name") Dim wxdr1 As DataRow = DataTables("departments").SQLFind("id='" & wxdr("department") & "'") If wxdr1 IsNot Nothing Then bm= wxdr1("name") End If 'e.WriteString(name & userid & "USERID获取成功" & gw & bm) ''------------------------------------------------------------------------------------------------------------------------------ 'wb.AddForm("","form1","list.htm") With wb.AddInputGroup("form1","ipg1","数据筛选") .AddSelect("product","客户类别","|A类客户|B类客户|C类客户") .AddInput("startdate","开始日期","date") .AddInput("enddate","结束时间","date") End With With wb.AddButtonGroup("form1","btg1",True) .Add("btn1", "确定", "submit") End With End If End If Case "list.htm" '合成条件 Dim flt As String If e.GetValues.ContainsKey("unfilter") Then '如果有unfilter参数,则清除cookie wb.ClearCookie() ElseIf e.PostValues.Count > 0 Then '如果是filter.htm访问,则根据用户输入合成条件表达式 If e.PostValues.ContainsKey("product") Then flt = "客户等级 = '" & e.PostValues("product") & "'" '合成条件 wb.AppendCookie("product", e.PostValues("product")) '将值写入cookie中 Else wb.DeleteCookie("product") '删除cookie End If If e.PostValues.ContainsKey("startdate") Then If flt > "" Then flt = flt & " and " End If flt = flt & "日期 >= '" & e.PostValues("startdate") & "'" wb.AppendCookie("startdate", e.PostValues("startdate")) Else wb.DeleteCookie("startdate") End If If e.PostValues.ContainsKey("enddate") Then If flt > "" Then flt = flt & " and " End If flt = flt & "日期 <= '" & e.PostValues("enddate") & "'" wb.AppendCookie("enddate", e.PostValues("enddate")) Else wb.DeleteCookie("enddate") End If Else '否则根据Cookie合成条件表达式 If e.Cookies.ContainsKey("product") Then flt = "客户等级 = '" & e.Cookies("product") & "'" End If If e.Cookies.ContainsKey("startdate") Then If flt > "" Then flt = flt & " and " End If flt = flt & "日期 >= '" & e.Cookies("startdate") & "'" End If If e.Cookies.ContainsKey("enddate") Then If flt > "" Then flt = flt & " and " End If flt = flt & "日期 <= '" & e.Cookies("enddate") & "'" End If End If End Select e.WriteString(wb.Build)
|