using framework_business; using framework_library; using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class controls_module_search : System.Web.UI.UserControl { #region methods /// /// Search Site /// /// private void SearchSite(string keyword) { try { //fetch content ArrayList pages = xData.SearchPageContent(keyword, "sequence"); rptPageResults.DataSource = pages; rptPageResults.DataBind(); lblPageCount.Text = pages.Count.ToString(); //fetch products ArrayList products = xData.SearchProducts(keyword, 0, 0,0, "sequence"); rptProductResults.DataSource = products; rptProductResults.DataBind(); lblProductCount.Text = products.Count.ToString(); lblSearchResults.Text = "Search Results for: " + keyword; } catch (Exception ex) { exception.HandleException("search:", MethodBase.GetCurrentMethod().Name, ex, Session["user"]); Response.Redirect("/error", false); } } #endregion #region events /// /// Page Load Event /// /// /// protected void Page_Load(object sender, EventArgs e) { try { if (!Page.IsPostBack) { if (utils.verifySession("search")) { string search = Session["search"].ToString(); SearchSite(search); Session["search"] = null; } } } catch (Exception ex) { exception.HandleException("search:", MethodBase.GetCurrentMethod().Name, ex, Session["user"]); Response.Redirect("/error", false); } } /// /// Search site /// /// /// protected void btnSearch_Click(object sender, EventArgs e) { try { SearchSite(txbSearch.Text); } catch (Exception ex) { exception.HandleException("search:", MethodBase.GetCurrentMethod().Name, ex, Session["user"]); Response.Redirect("/error", false); } } #endregion }