<%@ Page ResponseEncoding ="big5" debug="True" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Web" %>
<%@ Register TagPrefix="Diss_Cate" Namespace="Diss_cs" Assembly="Diss_cs" %>
<%@ Import Namespace="DissData_cs" %>
<html>
<head>
	<script language="C#" runat="server">
	void page_load(object sender,EventArgs e){
		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 ){
			Msg.Text=FTarget.SelectedItem.Text;
		}
		else{
			Msg.Text="未指定类别";
		}
	}
	void ok_click(object sender,EventArgs e){
		if(Keyword.Text==""){
			Msg.Text="未输入关键字";
			return;
		}
		else{
			DissSql NewDiss = (DissSql)Session["NowDissSql"];			
			DataTable SearchRes = NewDiss.FullSearch(Keyword.Text,"全文");
			Msg.Text="符合条件的个数：" + SearchRes.Rows.Count.ToString();
			Resault.DataSource=SearchRes.DefaultView;
			Resault.DataBind();
			Resault.Visible=true;
		}
	}
	void Get_Click(object Sender,CommandEventArgs e){
		if(Session["StartDate"] == null){
			DateTime k =DateTime.Now;
			Session["StartDate"] = k;//'.AddDays(0 - y + 1)
		}
		Response.Redirect("Showsbj.aspx?NowCateID=" + GetCate.NowSelect.ToString() + "&StartDate=" + Session["StartDate"].ToString());
	}
	void ViewDetail(object sender,CommandEventArgs e){
		Response.Redirect("View.aspx?StartDate=" + GetCate.StartDate.ToString() + "&CID=" + e.CommandArgument + "&NowCateID=" + GetCate.NowSelect + "&NowCate=" + GetCate.NowCate);
	}
	</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>