示例#1
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            if (!Common.SessionValidate.IsLogin())
            {
                //need log in
                context.Response.Write(2);
                return;
            }
            int      bookId     = int.Parse(context.Request["id"]);
            decimal  priceNew   = Convert.ToDecimal(context.Request["priceNew"]);
            int      customerId = Convert.ToInt32(context.Session["id"]);
            int      count      = int.Parse(context.Request["count"]);
            CartInfo ci         = new CartInfo();

            ci.BookId        = bookId;
            ci.BookUnitPrice = priceNew;
            ci.BookCount     = count;
            ci.CustomerId    = customerId;

            CartInfoBLL bll = new CartInfoBLL();

            if (bll.InsertCartInfo(ci))
            {
                context.Response.Write(1);
            }
            else
            {
                context.Response.Write(0);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Common.SessionValidate.IsLogin())
            {
                Response.Redirect("/BookShop/Register.aspx");
            }
            CartInfoBLL bll        = new CartInfoBLL();
            int         customerId = Convert.ToInt32(Session["id"]);

            dt = bll.GetAllCartInfo(customerId);
        }
示例#3
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            int         cid = int.Parse(context.Request["cid"]);
            CartInfoBLL bll = new CartInfoBLL();

            if (bll.DeleteCartInfoById(cid))
            {
                context.Response.Write(1);
            }
            else
            {
                context.Response.Write(0);
            }
        }
示例#4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //if(!Common.SessionValidate.IsLogin())
            //{

            //}
            int CId = Convert.ToInt32(Session["id"]);

            if (!IsPostBack)
            {
                OrderCode = DateTime.Now.ToString("yyyyMMddHHmmss") + Session["id"];
                CartInfoBLL bll = new CartInfoBLL();
                DtCartInfo = bll.GetAllCartInfo(CId);
            }
            else
            {
                OrderMainBLL bll        = new OrderMainBLL();
                string       orderId    = Request["orderId"];
                int          customerId = Convert.ToInt32(Session["id"]);
                if (bll.ExecProc(orderId, customerId))
                {
                    //AliPay API

                    //partner: business id
                    //return_url:
                    //subject: product name
                    //body: product description
                    //out_trade_no: orderId
                    //total_fee: total price
                    //seller_email: email address
                    //sign: (total price, business id, order id, product name, business password,) use get method
                    StringBuilder sb = new StringBuilder("http://*****:*****@gmail.com");
                    //sign: total price, bisiness ID, orderId, product name, bisiness password,
                    //using MD5(utf-8, "x2", toLower)
                    string sign = total_fee + "lizhen325" + orderId + "book" + "123";
                    sign = Common.MD5Encrypt.EncryptAli(sign);
                    sb.Append("&sign=" + sign);

                    Response.Redirect(sb.ToString());
                }
                else
                {
                    Response.Redirect("Error.html");
                }
            }
        }