예제 #1
0
        private void BookCart_Updatss()
        {
            BookCartBLL           cartBLL    = new BookCartBLL();
            MemberEntity          member     = (MemberEntity)Session["usr"];
            List <BookCartEntity> cartEntity = cartBLL.list(member.MemberId);
            var icv = from ic in cartEntity where ic.IsSelect == 0 select ic;

            if (Request["qxz"].ToLower().Equals("true"))
            {
                foreach (var item in icv)
                {
                    BookCartEntity entity = cartBLL.lists(item.CartId);
                    entity.IsSelect = entity.IsSelect == 0 ? 1 : 0;
                    cartBLL.Update(entity);
                }
            }
            else
            {
                if (icv.Count() == 0)
                {
                    foreach (BookCartEntity item in cartEntity)
                    {
                        BookCartEntity entity = cartBLL.lists(item.CartId);
                        entity.IsSelect = entity.IsSelect == 0 ? 1 : 0;
                        cartBLL.Update(entity);
                    }
                }
            }
            BookCart_list();
        }
예제 #2
0
        private void BookCart_Delete()
        {
            BookCartBLL bLL = new BookCartBLL();

            bLL.Delete(int.Parse(Request["CartId"]));
            BookCart_list();
        }
예제 #3
0
        private void BookCart_list()
        {
            BookCartBLL           bLL  = new BookCartBLL();
            List <BookCartEntity> list = bLL.list(((MemberEntity)Session["usr"]).MemberId);

            Response.Write(MyJson.ToJsJson(list));
            Response.End();
        }
예제 #4
0
        private void BookCart_Updatexz()
        {
            BookCartBLL    bLL    = new BookCartBLL();
            BookCartEntity entity = bLL.lists(int.Parse(Request["CartId"]));

            entity.IsSelect = entity.IsSelect == 0 ? 1 : 0;
            bLL.Update(entity);
            BookCart_list();
        }
예제 #5
0
        private void BookCart_Updatesz()
        {
            BookCartBLL    bLL    = new BookCartBLL();
            BookCartEntity entity = bLL.lists(int.Parse(Request["CartId"]));

            entity.BookCount = int.Parse(Request["BookCount"]);
            bLL.Update(entity);
            BookCart_list();
        }
예제 #6
0
        //绑定数据
        private void bindata()
        {
            int count = 1;

            if (string.IsNullOrWhiteSpace(Request.QueryString["Count"]))
            {
                count = 1;
            }
            else
            if (int.TryParse(Request.QueryString["Count"], out count) == false || count <= 0)
            {
                count = 1;
            }
            if (string.IsNullOrWhiteSpace(Request.QueryString["BookId"]))
            {
                return;
            }
            if (int.TryParse(Request.QueryString["BookId"], out int i))
            {
                BookInfoBLL    infoBLL    = new BookInfoBLL();
                BookInfoEntity infoEntity = new BookInfoEntity();
                MemberEntity   member     = (MemberEntity)Session["usr"];
                BookCartBLL    cartBLL    = new BookCartBLL();

                infoEntity = infoBLL.list(i);
                if (infoEntity == null)
                {
                    return;
                }
                ContentPlaceHolder1_imgBook.ImageUrl = "~/uploadfile/" + infoEntity.PicPath;
                lblTitle.Text      = "书名:" + infoEntity.BookName;
                lblInfo.Text       = "作者:" + infoEntity.BookAuthor + "&nbsp; &nbsp; 出版社:" + infoEntity.BookPress + "";
                lblPrice.InnerHtml = "<span style='text-decoration:line-through;'>原价:" + (infoEntity.BookPrice * count).ToString().Split('.')[0] + "元</span>&nbsp;&nbsp;现价:" + ((infoEntity.BookPrice * infoEntity.BookDisCount) * count).ToString("n") + "&nbsp;&nbsp;数量:" + count;

                //加入购物车

                BookCartEntity cartEntity = cartBLL.list(member.MemberId, infoEntity.BookId);
                if (cartEntity != null)
                {
                    cartEntity.BookCount += count;
                    cartBLL.Update(cartEntity);
                }
                else
                {
                    BookCartEntity bookCart = new BookCartEntity();
                    bookCart.MemberId  = member.MemberId;
                    bookCart.BookId    = infoEntity.BookId;
                    bookCart.BookCount = count;
                    cartBLL.Add(bookCart);
                }
            }
        }
예제 #7
0
        protected void lbtOrderSubmit_Click(object sender, EventArgs e)
        {
            MemberEntity          member            = (MemberEntity)Session["usr"];
            BookCartBLL           cartBLL           = new BookCartBLL();
            List <BookCartEntity> list              = cartBLL.list(member.MemberId);
            MyOrderEntity         orderEntity       = new MyOrderEntity();
            MyOrderBLL            orderBLL          = new MyOrderBLL();
            OrderDetailEntity     orderDetailEntity = new OrderDetailEntity();

            orderEntity.OrderCode    = DateTime.Now.ToString("yyyyMMddhhmmss") + member.MemberId;
            orderEntity.MemberId     = member.MemberId;
            orderEntity.OrderPeople  = txtMemberName.Text;
            orderEntity.OrderPhone   = txtPhone.Text;
            orderEntity.OrderAddress = txtAddress.Text;
            decimal counpic = 0;

            foreach (BookCartEntity item in list)
            {
                if (item.IsSelect == 1)
                {
                    counpic += (item.BookCount * (item.BookInfo.BookPrice * item.BookInfo.BookDisCount));
                }
            }
            orderEntity.OrderAllMoney = counpic;
            orderEntity.OrderStatus   = 1;
            orderBLL.Add(orderEntity);
            orderEntity = orderBLL.list(orderEntity.OrderCode);
            OrderDetailBLL orderDetailBLL = new OrderDetailBLL();

            foreach (BookCartEntity item in list)
            {
                if (item.IsSelect == 1)
                {
                    orderDetailEntity.OrderId       = orderEntity.OrderId;
                    orderDetailEntity.BookId        = item.BookId;
                    orderDetailEntity.BookSalePrice = (item.BookInfo.BookPrice * item.BookInfo.BookDisCount);
                    orderDetailEntity.BookSaleCount = item.BookCount;
                    orderDetailBLL.Add(orderDetailEntity);
                    cartBLL.Delete(item.CartId);
                }
            }
            Response.Redirect("~/Member/OrderList.aspx");
        }
예제 #8
0
        private void bindata()
        {
            MemberEntity          member  = (MemberEntity)Session["usr"];
            BookCartBLL           cartBLL = new BookCartBLL();
            List <BookCartEntity> list    = cartBLL.list(member.MemberId);
            decimal counpic = 0;

            foreach (BookCartEntity item in list)
            {
                if (item.IsSelect == 1)
                {
                    counpic += (item.BookCount * (item.BookInfo.BookPrice * item.BookInfo.BookDisCount));
                }
            }
            txtMemberName.Text     = member.MemberName;
            txtPhone.Text          = member.MemberPhone;
            txtAddress.Text        = member.MemberAddress;
            spanAllMoney.InnerHtml = counpic.ToString("n");
        }