Exemple #1
0
        private void btn_OK_Click(object sender, System.EventArgs e)
        {
            tbl_Search.Visible  = false;
            dgrd_Result.Visible = true;

            SqlDataReader dr_result = null;

            UDS.Components.BBSClass bbs    = new UDS.Components.BBSClass();
            BBSSearchOption         option = new BBSSearchOption();

            option.searchtype = (rbtn_author.Checked)?BBSSearchType.author:BBSSearchType.title;
            switch (ddl_Time.SelectedValue)
            {
            case "0":
                option.TimeBound = TimeSpan.MaxValue;
                break;

            case "d":
                option.TimeBound = new TimeSpan(Int32.Parse((tbx_Time.Text.Trim() == "")?"1":tbx_Time.Text.Trim()), 0, 0, 0);
                break;

            case "w":
                option.TimeBound = new TimeSpan(Int32.Parse((tbx_Time.Text.Trim() == "")?"1":tbx_Time.Text.Trim()) * 7, 0, 0, 0);
                break;

            case "m":
                option.TimeBound = new TimeSpan(Int32.Parse((tbx_Time.Text.Trim() == "")?"1":tbx_Time.Text.Trim()) * 30, 0, 0, 0);
                break;

            case "y":
                option.TimeBound = new TimeSpan(Int32.Parse((tbx_Time.Text.Trim() == "")?"1":tbx_Time.Text.Trim()) * 365, 0, 0, 0);
                break;
            }

            option.BoardID = Int32.Parse(dll_Board.SelectedValue);

            UDS.Components.BBSClass bbs1 = new UDS.Components.BBSClass();
            if (Request.Cookies["UDSBBSAdmin"].Value == "1")
            {
                dr_board = bbs1.GetAllBBSBoard();
            }
            else
            {
                dr_board = bbs1.GetBBSBoard(Request.Cookies["UserName"].Value);
            }

            dr_result = bbs.Find(tbx_Key.Text.Trim(), option, UDS.Components.Tools.ConvertDataReaderToDataTable(dr_board));
            DataTable dt_result = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_result);

            dgrd_Result.DataSource = dt_result.DefaultView;
            dgrd_Result.DataBind();
        }
Exemple #2
0
        private void btn_OK_Click(object sender, System.EventArgs e)
        {
            tbl_Search.Visible = false;
            dgrd_Result.Visible = true;

            SqlDataReader dr_result = null;
            UDS.Components.BBSClass bbs = new UDS.Components.BBSClass();
            BBSSearchOption option = new BBSSearchOption();
            option.searchtype = (rbtn_author.Checked)?BBSSearchType.author:BBSSearchType.title;
            switch(ddl_Time.SelectedValue)
            {
                case "0":
                    option.TimeBound = TimeSpan.MaxValue;
                    break;
                case "d":
                    option.TimeBound = new TimeSpan(Int32.Parse((tbx_Time.Text.Trim()=="")?"1":tbx_Time.Text.Trim()),0,0,0);
                    break;
                case "w":
                    option.TimeBound = new TimeSpan(Int32.Parse((tbx_Time.Text.Trim()=="")?"1":tbx_Time.Text.Trim())*7,0,0,0);
                    break;
                case "m":
                    option.TimeBound = new TimeSpan(Int32.Parse((tbx_Time.Text.Trim()=="")?"1":tbx_Time.Text.Trim())*30,0,0,0);
                    break;
                case "y":
                    option.TimeBound = new TimeSpan(Int32.Parse((tbx_Time.Text.Trim()=="")?"1":tbx_Time.Text.Trim())*365,0,0,0);
                    break;
            }

            option.BoardID = Int32.Parse(dll_Board.SelectedValue);

            UDS.Components.BBSClass bbs1 = new UDS.Components.BBSClass();
            if(Request.Cookies["UDSBBSAdmin"].Value=="1")
                dr_board  = bbs1.GetAllBBSBoard();
            else
                dr_board  = bbs1.GetBBSBoard( Server.UrlDecode(Request.Cookies["UserName"].Value));

            dr_result = bbs.Find(tbx_Key.Text.Trim(),option,UDS.Components.Tools.ConvertDataReaderToDataTable(dr_board));
            DataTable dt_result = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_result);
            dgrd_Result.DataSource = dt_result.DefaultView;
            dgrd_Result.DataBind();
        }