以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  TopicBar动态增加  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=103583)

--  作者:xiaohuli
--  发布时间:2017/7/12 10:50:00
--  TopicBar动态增加

在窗口上有一个复选框和textbox,当textbox中写入文字,并且复选框选中时,TopicPage自动增加任务。

Dim txt1 As WinForm.TextBox = e.Form.Controls("textbox1")
Dim dt1 As Date = Date.Today.Adddays(txt1.Value)

Dim Page As WinForm.TopicPage

If e.Sender.Checked = True Then
Dim
cnt1 As Integer = DataTables("产品").Compute("Count(主键列)","日期  >= \'" & Date.Today & "\' And 日期 <= \'" & dt1 & "\'")
Dim cnt2 As Integer = DataTables("产品").Compute("Count(主键列)","审核 = False Or 审核 IsNull")
Page
= e.Form.Controls("TopicBar1").Pages.Add("" & txt1.Value & " 天内提醒任务","" & txt1.Value & " 天内提醒任务")
Page
.Links.Add("今日新增产品","今日新增产品(" & cnt1 & ")" )
Page
.Links.Add("审核不通过产品","审核不通过产品(" & cnt2 & ")" )

  End If

这个是可以实现几天的任务动态增加的,但问题是,当1天内提醒任务已经有时,不能再次增加1天内的提醒任务,就是任务的name不能有相同的,这个该如何判断。


--  作者:有点甜
--  发布时间:2017/7/12 10:54:00
--  

Dim txt1 As WinForm.TextBox = e.Form.Controls("textbox1")
Dim dt1 As Date = Date.Today.Adddays(txt1.Value)

Dim Page As WinForm.TopicPage

If e.Sender.Checked = True Then
    Dim cnt1 As Integer = DataTables("产品").GetValues("name","日期  >= \'" & Date.Today & "\' And 日期 <= \'" & dt1 & "\'").count
    Dim cnt2 As Integer = DataTables("产品").GetValues("name","审核 = False Or 审核 IsNull").count
    Page = e.Form.Controls("TopicBar1").Pages.Add("" & txt1.Value & " 天内提醒任务","" & txt1.Value & " 天内提醒任务")
    Page.Links.Add("今日新增产品","今日新增产品(" & cnt1 & ")" )
    Page.Links.Add("审核不通过产品","审核不通过产品(" & cnt2 & ")" ) 
End If


--  作者:有点甜
--  发布时间:2017/7/12 10:56:00
--  

 不明白你说的意思,你是要这个?

 

http://www.foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=102584&skin=0

 


--  作者:xiaohuli
--  发布时间:2017/7/12 11:05:00
--  

老师,你看我这个界面,当我在文本框中输入1,然后点击复选框时,会自动增加一个任务,但是当第二次点击的时候还是能添加,我希望任务名称相同的只能增加一次。


[此贴子已经被作者于2017/7/12 11:44:00编辑过]

--  作者:有点甜
--  发布时间:2017/7/12 11:14:00
--  

Dim txt1 As WinForm.TextBox = e.Form.Controls("textbox1")
Dim dt1 As Date = Date.Today.Adddays(txt1.Value)

Dim Page As WinForm.TopicPage

If e.Sender.Checked = True Then
    Dim cnt1 As Integer = DataTables("产品").GetValues("name","日期  >= \'" & Date.Today & "\' And 日期 <= \'" & dt1 & "\'").count
    Dim cnt2 As Integer = DataTables("产品").GetValues("name","审核 = False Or 审核 IsNull").count
    Dim tpb As WinForm.TopicBar  = e.Form.Controls("TopicBar1")
    Dim name As String = txt1.Value & " 天内提醒任务"
    For Each p As WinForm.TopicPage In tpb.Pages
        If p.Name = name Then
            page = p
        End If
    Next
    If page IsNot Nothing Then
        page = tpb.Pages(name)
        Page.Links("今日新增产品").text = "今日新增产品(" & cnt1 & ")"
        Page.Links("审核不通过产品").text = "审核不通过产品(" & cnt2 & ")"
    Else
        Page = tpb.Pages.Add(name, name)
        Page.Links.Add("今日新增产品","今日新增产品(" & cnt1 & ")" )
        Page.Links.Add("审核不通过产品","审核不通过产品(" & cnt2 & ")" )
    End If
End If