string GetUrl( NameValueCollection parms )
        {
            StringBuilder sb = new StringBuilder();
            sb.Append( _url.AbsolutePath );

            string qs = parms.ToWwwQueryString();
            if( !string.IsNullOrEmpty( qs ) )
            {
                sb.Append( '?' );
                sb.Append( qs );
            }

            return sb.ToString();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //добавление товара в корзину
            if (SiteContext.Current.CurrentClient.Cart != null && !IsRestricted)
            {
                var queryArgs = new NameValueCollection(Request.QueryString);

                string partKey = queryArgs.GetAndRemove("p");
                string qty = queryArgs.GetAndRemove("q");

                if (!string.IsNullOrEmpty(partKey) && !string.IsNullOrEmpty(qty))
                {
                    SiteContext.Current.CurrentClient.Cart.Add(
                        SparePartPriceKey.Parse(partKey),
                        Convert.ToInt32(qty), true);
                    Response.Redirect(Request.Url.AbsolutePath + "?" + queryArgs.ToWwwQueryString());
                }
            }
        }
Beispiel #3
0
        protected void Page_Load( object sender, EventArgs e )
        {
            //добавление товара в корзину
            if( SiteContext.Current.CurrentClient.Cart != null && !IsRestricted )
            {
                var queryArgs = new NameValueCollection( Request.QueryString );

                string partKey = queryArgs.GetAndRemove( "p" );
                string qty = queryArgs.GetAndRemove( "q" );

                if( !string.IsNullOrEmpty( partKey ) && !string.IsNullOrEmpty( qty ) )
                {
                    // deas 27.04.2011 task3929 добавление в корзине флага отправить в заказ
                    SiteContext.Current.CurrentClient.Cart.Add(
                        SparePartPriceKey.Parse(partKey),
                        Convert.ToInt32( qty), true );
                    Response.Redirect( Request.Url.AbsolutePath + "?" + queryArgs.ToWwwQueryString() );
                }
            }
            //deas 16.03.2011 task3302
            //вывод сообщения пользователю
            if ( Session["FindRedirectMess"] != null )
            {
                ShowMessage( Session["FindRedirectMess"].ToString() );
                Session["FindRedirectMess"] = null;
            }
        }