//回傳一筆Order中 所有的商品數量
        public int GetCartAmount()
        {
            HttpCookie rqstCookie = HttpContext.Request.Cookies.Get("myaccount");

            if (rqstCookie != null)
            {
                var          memberDataObj = FormsAuthentication.Decrypt(rqstCookie.Value);
                var          memberData    = JsonConvert.DeserializeObject <Member>(memberDataObj.UserData);
                CartServices cartServices  = new CartServices();
                int          amount        = cartServices.GetCarQuantity(memberData.MemberID).CountAmount;
                return(amount);
            }
            else
            {
                return(0);
            }
        }
Esempio n. 2
0
        public Linedata PaymentInfo(int memberId, int price)
        {
            OrderDetailRepository orderDetail = new OrderDetailRepository();
            var          productInfo          = orderDetail.GetAllCart(memberId).FirstOrDefault();
            CartServices cartServices         = new CartServices();
            //數量
            int quantity            = cartServices.GetCarQuantity(memberId).CountAmount;
            JavaScriptSerializer js = new JavaScriptSerializer();
            JsonURL url             = js.Deserialize <JsonURL>(productInfo.PicUrl);

            LinePay  line     = new LinePay();
            Linedata linedata = new Linedata()
            {
                productName     = line.ProductName(quantity, productInfo.ProductName),
                currency        = "TWD",
                orderId         = productInfo.OrderID.ToString(),
                productImageUrl = url.Url1,
                amount          = price,
                confirmUrl      = Url + "Checkout"
            };

            return(linedata);
        }