コード例 #1
0
    private void ProcessPost()
    {
        List<string> post = new List<string>(Request.Form.AllKeys);
        int title_id;
        if (post.Contains(Constants.QueryKeys.POST_TITLE_ID) && Int32.TryParse(Request.Form[Constants.QueryKeys.POST_TITLE_ID], out title_id) && post.Contains(Constants.QueryKeys.POST_SKU))
        {
            string sku = Request.Form[Constants.QueryKeys.POST_SKU];
            string w = Request.Form[Constants.QueryKeys.POST_WISHLIST_ID];

            int quantity = 1;
            if (Request.Form[Constants.QueryKeys.POST_QUANTITY] != null && Int32.TryParse(Request.Form[Constants.QueryKeys.POST_QUANTITY], out quantity)) { }

            SiteWish wish = new SiteWish();
            wish.Del_Whish_Header(Convert.ToInt32(w));

            AddResponse r = AddToCart(title_id, sku, quantity);

        Result result = new Result();
        string Sap = "0";
        Sap= result.Get_Title_by_Student_Pricing(title_id);

        string output;

            if (Sap=="1" && r == AddResponse.Success)
                output = this.BuildResponse(AddResponse.Student);
            else
                output = this.BuildResponse(r);

            Response.Write(output);
        }
    }
コード例 #2
0
    private void ProcessGet()
    {
        List<string> get = new List<string>(Request.QueryString.AllKeys);
        int title_id;
        if (get.Contains(Constants.QueryKeys.GET_TITLE_ID) && Int32.TryParse(Request.QueryString[Constants.QueryKeys.GET_TITLE_ID], out title_id) && get.Contains(Constants.QueryKeys.GET_SKU))
        {
            string sku = Request.QueryString[Constants.QueryKeys.GET_SKU];
            string w = Request.QueryString[Constants.QueryKeys.GET_WISHLIST_ID];

            int quantity = 1;
            if (Request.Form[Constants.QueryKeys.GET_QUANTITY] != null && Int32.TryParse(Request.Form[Constants.QueryKeys.GET_QUANTITY], out quantity)) { }

            SiteWish wish = new SiteWish();
            wish.Del_Whish_Header(Convert.ToInt32(w));

            AddResponse r = AddToCart(title_id, sku, quantity);

            //string output = this.BuildResponse(r);
            //Response.Write(output);
            Response.Redirect(String.Format("{0}?result={1}", Constants.Pages.CART, HttpUtility.UrlEncode(r.ToString())));
        }
    }