<%@ Page ResponseEncoding ="big5" debug="True" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Web" %>
<%@ Register TagPrefix="Diss_Cate" Namespace="Diss_vb" Assembly="Diss_vb" %>
<%@ Import Namespace="DissData_vb" %>
<html>
<head>
	<script language="vb" runat="server">
	sub page_load(sender as object,e as EventArgs)
		GetCate.ServerName=Session("NowSQLServer").ToString()
		GetCate.Uid=Session("Nowuid").ToString()
		GetCate.Pass=Session("NowPassword").ToString()
		GetCate.DBName=Session("NowDBName").ToString()
		GetCate.FirstLoad=true'第一次加载
		if FTarget.SelectedIndex > - 1  then
			Msg.Text=FTarget.SelectedItem.Text
		else
			Msg.Text="未指定类别"
		end if
	end sub
	sub ok_click(sender as object,e as EventArgs)
		if Keyword.Text="" then
			Msg.Text="未输入关键字"
			exit sub
		else
			dim NewDiss as DissSql = Ctype(Session("NowDissSqlvb"),DissSql)
			Dim SearchRes as DataTable = NewDiss.FullSearch(Keyword.Text,"全文")
			Msg.Text="符合条件的个数：" + SearchRes.Rows.Count.ToString()
			Resault.DataSource=SearchRes.DefaultView
			Resault.DataBind()
			Resault.Visible=true
		end if
	end sub
	sub Get_Click(sender as object,e as CommandEventArgs)
		if Session("StartDate") is nothing then
			dim k as DateTime =DateTime.Now
			Session("StartDate") = k''.AddDays(0 - y + 1)
		end if
		Response.Redirect("Showsbj.aspx?NowCateID=" & GetCate.NowSelect.ToString() & "&StartDate=" & Session("StartDate").ToString())
	end sub
	sub ViewDetail(sender as object,e as CommandEventArgs)
		Response.Redirect("View.aspx?StartDate=" & GetCate.StartDate.ToString() & "&CID=" & e.CommandArgument & "&NowCateID=" & GetCate.NowSelect & "&NowCate=" & GetCate.NowCate)
	end sub
	</script>
</head>
<body background="../../../../images/winback.gif">
<form runat="server">
<asp:label id="rr" runat="server" />
<p><Diss_Cate:GetCate ID="GetCate" oncommand="Get_Click" Runat="server" />
<p>请输入关键字：<asp:textbox id="Keyword" runat="server" />
<p>指定搜寻目标：
        <asp:RadioButtonList id="FTarget" runat="server">
            <asp:ListItem selected>全文</asp:ListItem>
        </asp:RadioButtonList>
<asp:button id="ok" text="执行搜寻" onclick="ok_click" runat="server" />
<asp:label id="Msg" runat="server" />
<hr>
<asp:DataGrid ID="Resault" Runat="server"
        BorderWidth="0"
        CellPadding="3"
        CellSpacing="0"
	width="540"
	Visible="True"
        Font-Name="Verdana"
        Font-Size="9pt"
        HeaderStyle-BackColor="Blue"
        HeaderStyle-ForeColor="White"
DataKeyfield="id"
AutoGenerateColumns="false"
 >
      <Columns>
<asp:TemplateColumn HeaderText="主题">
          <ItemTemplate>
<asp:LinkButton runat="server" Text=<%# DataBinder.Eval(Container.DataItem, "subject") %> CommandArgument=<%# DataBinder.Eval(Container.DataItem, "id") %> OnCommand="ViewDetail" id="d1"/>
          </ItemTemplate>
        </asp:TemplateColumn>
        <asp:BoundColumn HeaderText="发送人" DataField="send"/>
        <asp:BoundColumn HeaderText="发送时间" DataField="nowtime"/>
     </Columns>
</asp:Datagrid>
</form>
</body>