Esempio n. 1
0
        protected override void PageLoad()
        {
            base.PageLoad();

            string action = RequestHelper.GetQueryString <string>("Action");

            if (action == "ReceiveShipping")
            {
                this.ReceiveShipping();
            }
            int currentPage = RequestHelper.GetQueryString <int>("Page");

            if (currentPage < 1)
            {
                currentPage = 1;
            }
            int count = 0, pageSize = 10;

            orderList = PointProductOrderBLL.ReadList(base.UserId);
            orderList = PointProductOrderBLL.SearchList(currentPage, pageSize, new PointProductOrderSearchInfo {
                UserId = base.UserId
            }, ref count);
            pager.Init(currentPage, pageSize, count, !string.IsNullOrEmpty(isMobile));
            Title = "兑换记录";
        }
Esempio n. 2
0
        private void ReceiveShipping()
        {
            int id = RequestHelper.GetQueryString <int>("orderId");
            var pointProductOrder = PointProductOrderBLL.Read(id);

            if (pointProductOrder.OrderStatus == (int)PointProductOrderStatus.HasShipping)
            {
                pointProductOrder.OrderStatus = (int)PointProductOrderStatus.ReceiveShipping;
                PointProductOrderBLL.Update(pointProductOrder);
            }

            ResponseHelper.End();
        }
Esempio n. 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                CheckAdminPower("ManagePointProductOrder", PowerCheckType.Single);

                string action = RequestHelper.GetQueryString <string>("Action");
                if (action == "Shipping")
                {
                    int    shippingId     = RequestHelper.GetForm <int>("OrderId");
                    string shippingName   = RequestHelper.GetForm <string>("ShippingName");
                    string shippingNumber = RequestHelper.GetForm <string>("ShippingNumber");

                    var pointProductOrder = PointProductOrderBLL.Read(shippingId);
                    if (pointProductOrder.OrderStatus == (int)PointProductOrderStatus.Shipping)
                    {
                        pointProductOrder.OrderStatus    = (int)PointProductOrderStatus.HasShipping;
                        pointProductOrder.ShippingName   = shippingName;
                        pointProductOrder.ShippingNumber = shippingNumber;
                        pointProductOrder.ShippingDate   = DateTime.Now;
                        PointProductOrderBLL.Update(pointProductOrder);
                    }

                    ResponseHelper.End();
                }
                if (action == "Cancel")
                {
                    int orderId           = RequestHelper.GetQueryString <int>("OrderId");
                    var pointProductOrder = PointProductOrderBLL.Read(orderId);
                    if (pointProductOrder.OrderStatus == (int)PointProductOrderStatus.Shipping)
                    {
                        pointProductOrder.OrderStatus = (int)PointProductOrderStatus.Cancel;
                        PointProductOrderBLL.Update(pointProductOrder);

                        //恢复用户积分
                        UserAccountRecordBLL.Add(new UserAccountRecordInfo
                        {
                            RecordType = (int)AccountRecordType.Point,
                            Money      = 0,
                            Point      = pointProductOrder.Point,
                            Date       = DateTime.Now,
                            IP         = ClientHelper.IP,
                            Note       = "取消兑取礼品:" + pointProductOrder.ProductName + " 订单号:" + pointProductOrder.OrderNumber,
                            UserId     = pointProductOrder.UserId,
                            UserName   = pointProductOrder.UserName
                        });

                        //恢复兑换数量
                        PointProductBLL.ChangeSendCount(pointProductOrder.ProductId, ChangeAction.Minus);
                    }

                    ResponseHelper.End();
                }

                orderStatus        = RequestHelper.GetQueryString <int>("OrderStatus");
                hOrderStatus.Value = orderStatus.ToString();

                PointProductOrderSearchInfo searchInfo = new PointProductOrderSearchInfo();
                searchInfo.OrderStatus  = orderStatus;
                searchInfo.ProductName  = RequestHelper.GetQueryString <string>("ProductName");
                searchInfo.OrderNumber  = RequestHelper.GetQueryString <string>("OrderNumber");
                searchInfo.UserName     = RequestHelper.GetQueryString <string>("UserName");
                searchInfo.StartAddDate = RequestHelper.GetQueryString <DateTime>("StartAddDate");
                searchInfo.EndAddDate   = ShopCommon.SearchEndDate(RequestHelper.GetQueryString <DateTime>("EndAddDate"));
                var data = PointProductOrderBLL.SearchList(CurrentPage, PageSize, searchInfo, ref Count);

                ProductName.Text  = searchInfo.ProductName;
                OrderNumber.Text  = searchInfo.OrderNumber;
                UserName.Text     = searchInfo.UserName;
                StartAddDate.Text = RequestHelper.GetQueryString <string>("StartAddDate");
                EndAddDate.Text   = RequestHelper.GetQueryString <string>("EndAddDate");

                BindControl(data, RecordList, MyPager);
            }
        }
Esempio n. 4
0
        protected void Submit()
        {
            if (base.UserId <= 0)
            {
                ResponseHelper.Write("error|还未登录");
                ResponseHelper.End();
            }



            int    pointLeft = UserAccountRecordBLL.SumPoint(base.UserId);
            string userName  = base.UserName;
            string userEmail = CookiesHelper.ReadCookieValue("UserEmail");

            //检测积分
            int id = RequestHelper.GetForm <int>("updateId");

            if (id < 1)
            {
                ResponseHelper.Write("error|无效的请求");
                ResponseHelper.End();
            }

            gift = PointProductBLL.Read(id);
            if (gift.IsSale != (int)BoolType.True)
            {
                ResponseHelper.Write("error|该商品已下架");
                ResponseHelper.End();
            }
            if (gift.Point > pointLeft)
            {
                ResponseHelper.Write("error|您当前的积分不足以兑取该商品");
                ResponseHelper.End();
            }
            if (gift.EndDate.Date < DateTime.Now.Date)
            {
                ResponseHelper.Write("error|该商品已过有效兑取时间");
                ResponseHelper.End();
            }

            //库存
            if (gift.TotalStorageCount - gift.SendCount < 1)
            {
                ResponseHelper.Write("error|该商品库存不足");
                ResponseHelper.End();
            }

            //添加订单
            var order = new PointProductOrderInfo();

            order.OrderNumber = ShopCommon.CreateOrderNumber();
            order.OrderStatus = (int)PointProductOrderStatus.Shipping;
            order.Point       = gift.Point;
            order.ProductId   = gift.Id;
            order.ProductName = gift.Name;
            order.BuyCount    = 1;
            order.Consignee   = StringHelper.AddSafe(RequestHelper.GetForm <string>("username"));
            SingleUnlimitClass singleUnlimitClass = new SingleUnlimitClass();

            order.RegionId = singleUnlimitClass.ClassID;
            order.Address  = StringHelper.AddSafe(RequestHelper.GetForm <string>("address"));
            order.Tel      = StringHelper.AddSafe(RequestHelper.GetForm <string>("mobile"));
            order.AddDate  = DateTime.Now;
            order.IP       = ClientHelper.IP;
            order.UserId   = base.UserId;
            order.UserName = base.UserName;
            order.Id       = PointProductOrderBLL.Add(order);

            if (order.Id > 0)
            {
                //扣减积分
                UserAccountRecordBLL.Add(new UserAccountRecordInfo
                {
                    RecordType = (int)AccountRecordType.Point,
                    Money      = 0,
                    Point      = -order.Point,
                    Date       = DateTime.Now,
                    IP         = ClientHelper.IP,
                    Note       = "兑取商品:" + order.ProductName + " 订单号:" + order.OrderNumber,
                    UserId     = order.UserId,
                    UserName   = order.UserName
                });

                //扣减库存
                PointProductBLL.ChangeSendCount(order.ProductId, ChangeAction.Plus);
            }

            ResponseHelper.Write("ok|" + order.Id);
            ResponseHelper.End();
        }