public override void Initialize(string name, NameValueCollection config)
        {
            base.Initialize(name, config);

            _to = config.GetAndRemove<string>("to", true);
            _from = config.GetAndRemove<string>("from", true);
            _subjectPrefix = config.GetAndRemove<string>("subjectPrefix", true);
        }
            public void ShouldReturnTheCorrectValueAndRemoveIt()
            {
                NameValueCollection config = new NameValueCollection {{"key1", "value1"}};

                Assert.AreEqual(1, config.Count);
                string actual = config.GetAndRemove<string>("key1",true);
                Assert.AreEqual("value1", actual);
                Assert.AreEqual(0, config.Count);
            }
        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());
                }
            }
        }
Example #4
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;
            }
        }