Esempio n. 1
0
        protected void SearchButton_Click(SearchArea searchArea)
        {
            string safeSearchPhrase = StringHelper.StripHtml(SearchPhrase.Text);
            int    orderNumber      = AlwaysConvert.ToInt(safeSearchPhrase, 0);

            if (orderNumber > 0 && (searchArea == SearchArea.All || searchArea == SearchArea.Orders))
            {
                int orderId = CommerceBuilder.Orders.OrderDataSource.LookupOrderId(orderNumber);
                if (orderId > 0)
                {
                    Response.Redirect(string.Format("~/Admin/Orders/ViewOrder.aspx?OrderId={0}", orderId));
                }
            }

            string parameters = string.Empty;

            if (searchArea != SearchArea.All)
            {
                parameters = "?a=" + searchArea.ToString();
            }

            if (!string.IsNullOrEmpty(safeSearchPhrase))
            {
                parameters += (string.IsNullOrEmpty(parameters) ? "?" : "&") + "k=" + Server.UrlEncode(safeSearchPhrase);
            }

            Response.Redirect("~/Admin/Search.aspx" + parameters);
        }