protected void CheckPoint()
        {
            if (base.UserId <= 0)
            {
                ResponseHelper.Write("error|还未登录");
                ResponseHelper.End();
            }



            int pointLeft = UserAccountRecordBLL.SumPoint(base.UserId);
            int id        = RequestHelper.GetQueryString <int>("id");
            var gift      = PointProductBLL.Read(id);

            if (gift.IsSale != (int)BoolType.True)
            {
                ResponseHelper.Write("error|该商品已下架");
                ResponseHelper.End();
            }
            if (gift.Point > pointLeft)
            {
                ResponseHelper.Write("error|您当前的积分不足以兑取该商品");
                ResponseHelper.End();
            }

            ResponseHelper.Write("ok|");
            ResponseHelper.End();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                int id = RequestHelper.GetQueryString <int>("Id");
                if (id != int.MinValue)
                {
                    CheckAdminPower("ReadPointProduct", PowerCheckType.Single);
                    pointProduct = PointProductBLL.Read(id);

                    Name.Text     = pointProduct.Name;
                    SubTitle.Text = pointProduct.SubTitle;

                    Point.Text      = pointProduct.Point.ToString();
                    TotalCount.Text = pointProduct.TotalStorageCount.ToString();
                    BeginDate.Text  = pointProduct.BeginDate.ToString("yyyy-MM-dd");
                    EndDate.Text    = pointProduct.EndDate.ToString("yyyy-MM-dd");

                    MarketPrice.Text          = pointProduct.MarketPrice.ToString();
                    Photo.Text                = pointProduct.Photo;
                    Introduction.Value        = pointProduct.Introduction1;
                    Introduction_Mobile.Value = pointProduct.Introduction1_Mobile;

                    productPhotoList = ProductPhotoBLL.ReadList(pointProduct.Id, 0);
                }
            }
        }
Exemple #3
0
        protected override void PageLoad()
        {
            base.PageLoad();

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

            if (action == "Submit")
            {
                this.Submit();
            }
            if (action == "CheckPoint")
            {
                this.CheckPoint();
            }

            int id = RequestHelper.GetQueryString <int>("Id");

            if (base.UserId == 0)
            {
                string redirectUrl = string.IsNullOrEmpty(isMobile)
                    ? "/user/login.html?RedirectUrl=/gift/exchange/" + id.ToString() + ".html"
                    : "/mobile/login.html?RedirectUrl=/mobile/gift/exchange/" + id.ToString() + ".html";
                ResponseHelper.Redirect(redirectUrl);
                ResponseHelper.End();
            }

            CurrentUser = UserBLL.Read(base.UserId);
            Gift        = PointProductBLL.Read(id);
            userPoint   = UserAccountRecordBLL.SumPoint(base.UserId);

            singleUnlimitClass.DataSource = RegionBLL.ReadRegionUnlimitClass();
            singleUnlimitClass.ClassID    = "|1" + CurrentUser.RegionId;

            Title = Gift.Name + " - 奖品兑换";
        }
        protected override void PageLoad()
        {
            base.PageLoad();
            if (base.UserId > 0)
            {
                CurrentUser = UserBLL.ReadUserMore(base.UserId);
            }
            int currentPage = RequestHelper.GetQueryString <int>("Page");

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

            pointProductList = PointProductBLL.SearchList(currentPage, pageSize, new PointProductSearchInfo {
                IsSale = (int)BoolType.True, ValidDate = DateTime.Now
            }, ref count);

            Title = "积分兑换商品";
            if (RequestHelper.GetQueryString <string>("Action") == "LoadProducts")
            {
                this.LoadProdcuts();
            }
        }
Exemple #5
0
        protected override void PageLoad()
        {
            base.PageLoad();

            int id = RequestHelper.GetQueryString <int>("Id");

            Gift = PointProductBLL.Read(id);

            //产品图片
            ProductPhotoList.Add(new ProductPhotoInfo {
                Name = Gift.Name, ImageUrl = Gift.Photo
            });
            ProductPhotoList.AddRange(ProductPhotoBLL.ReadList(Gift.Id, 0));
        }
Exemple #6
0
        protected void DeleteButton_Click(object sender, EventArgs e)
        {
            CheckAdminPower("DeletePointProduct", PowerCheckType.Single);
            string deleteID = RequestHelper.GetIntsForm("SelectID");

            if (deleteID != string.Empty)
            {
                foreach (var id in deleteID.Split(','))
                {
                    PointProductBLL.Delete(int.Parse(id));
                }
                AdminLogBLL.Add(ShopLanguage.ReadLanguage("DeleteRecord"), ShopLanguage.ReadLanguage("PointProduct"), deleteID);
                ScriptHelper.Alert(ShopLanguage.ReadLanguage("DeleteOK"), RequestHelper.RawUrl);
            }
        }
        protected void SubmitButton_Click(object sender, EventArgs e)
        {
            int productId = RequestHelper.GetQueryString <int>("Id");

            PointProductInfo pointProductSubmit = PointProductBLL.Read(productId);

            pointProductSubmit.Id                = productId;
            pointProductSubmit.Name              = Name.Text;
            pointProductSubmit.SubTitle          = SubTitle.Text;
            pointProductSubmit.Point             = Convert.ToInt32(Point.Text);
            pointProductSubmit.TotalStorageCount = Convert.ToInt32(TotalCount.Text);
            pointProductSubmit.BeginDate         = Convert.ToDateTime(BeginDate.Text);
            pointProductSubmit.EndDate           = Convert.ToDateTime(EndDate.Text);

            pointProductSubmit.MarketPrice          = Convert.ToDecimal(MarketPrice.Text);
            pointProductSubmit.Photo                = Photo.Text;
            pointProductSubmit.Introduction1        = Introduction.Value;
            pointProductSubmit.Introduction1_Mobile = Introduction_Mobile.Value;
            pointProductSubmit.IsSale               = RequestHelper.GetForm <int>("IsSale");
            pointProductSubmit.AddDate              = RequestHelper.DateNow;

            string alertMessage = ShopLanguage.ReadLanguage("AddOK");

            if (pointProductSubmit.Id <= 0)
            {
                CheckAdminPower("AddPointProduct", PowerCheckType.Single);

                int id = PointProductBLL.Add(pointProductSubmit);
                if (id > 0)
                {
                    AddProductPhoto(id);
                }
                AdminLogBLL.Add(ShopLanguage.ReadLanguage("AddRecord"), ShopLanguage.ReadLanguage("PointProduct"), id);
            }
            else
            {
                CheckAdminPower("UpdatePointProduct", PowerCheckType.Single);

                ProductPhotoBLL.DeleteList(productId, 0);
                AddProductPhoto(productId);
                PointProductBLL.Update(pointProductSubmit);
                AdminLogBLL.Add(ShopLanguage.ReadLanguage("UpdateRecord"), ShopLanguage.ReadLanguage("PointProduct"), pointProductSubmit.Id);
                alertMessage = ShopLanguage.ReadLanguage("UpdateOK");
            }
            ScriptHelper.Alert(alertMessage, RequestHelper.RawUrl);
        }
Exemple #8
0
        /// <summary>
        /// 页面加载
        /// </summary>
        protected override void PageLoad()
        {
            base.PageLoad();

            int currentPage = RequestHelper.GetQueryString <int>("Page");

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

            GiftList = PointProductBLL.SearchList(currentPage, pageSize, new PointProductSearchInfo {
            }, ref count);

            pager.CurrentPage = currentPage;
            pager.PageSize    = pageSize;
            pager.Count       = count;

            pager.CurrentPage = currentPage;
            pager.PageSize    = pageSize;
            pager.Count       = count;
            if (!string.IsNullOrEmpty(isMobile))
            {
                pager.ShowType    = 4;
                pager.PagerCSS    = "page_number";
                pager.PreviewPage = "上一页";
                pager.NextPage    = "下一页";
                pager.URL         = "/mobile/Gift.aspx?Page=$Page";
            }
            else
            {
                pager.ShowType    = 2;
                pager.PagerCSS    = "pagin";
                pager.CurrentCSS  = "current";
                pager.PreviewPage = "<<上一页";
                pager.NextPage    = "下一页>>";
                pager.URL         = "gift.html?Page=$Page";
            }
        }
Exemple #9
0
        protected override void PageLoad()
        {
            base.PageLoad();

            int id = RequestHelper.GetQueryString <int>("Id");

            gift = PointProductBLL.Read(id);
            //如果暂未开始或者已经结束
            if (gift.EndDate.Date < DateTime.Now.Date || gift.BeginDate.Date > DateTime.Now.Date)
            {
                ResponseHelper.Redirect("/pointproduct.html");
            }

            //产品图片
            photoList.Add(new ProductPhotoInfo {
                Name = gift.Name, ImageUrl = gift.Photo
            });
            photoList.AddRange(ProductPhotoBLL.ReadList(gift.Id, 0));

            Title = gift.Name + " - 积分商品兑换";
        }
Exemple #10
0
        protected void CheckPoint()
        {
            if (base.UserId == 0)
            {
                ResponseHelper.Write("还未登录");
                ResponseHelper.End();
            }

            int id          = RequestHelper.GetQueryString <int>("Id");
            var gift        = PointProductBLL.Read(id);
            var memberPoint = UserAccountRecordBLL.SumPoint(base.UserId);

            if (gift.Point > memberPoint)
            {
                ResponseHelper.Write("您当前的积分不足以兑取该礼品");
            }
            else
            {
                ResponseHelper.Write("ok");
            }
            ResponseHelper.End();
        }
Exemple #11
0
        protected void LoadProdcuts()
        {
            int pageNum  = RequestHelper.GetQueryString <int>("pageNum");
            int pageSize = RequestHelper.GetQueryString <int>("pageSize");
            int count    = 0;
            List <PointProductInfo> _pointProductList = new List <PointProductInfo>();

            if (pageNum > 1)
            {
                var resultlist = PointProductBLL.SearchList(pageNum, pageSize, new PointProductSearchInfo {
                    IsSale = (int)BoolType.True, ValidDate = DateTime.Now
                }, ref count);
                foreach (PointProductInfo item in resultlist)
                {
                    item.Photo = item.Photo.Replace("Original", "400-300");
                    _pointProductList.Add(item);
                }
            }
            Response.Clear();
            ResponseHelper.Write(JsonConvert.SerializeObject(new { count = _pointProductList.Count, dataList = _pointProductList }));
            ResponseHelper.End();
        }
        protected override void PageLoad()
        {
            base.PageLoad();

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

            if (action == "Submit")
            {
                this.Submit();
            }
            if (action == "CheckPoint")
            {
                this.CheckPoint();
            }

            int id = RequestHelper.GetQueryString <int>("Id");

            if (base.UserId <= 0)
            {
                ResponseHelper.Redirect("/user/login.html?RedirectUrl=/pointexchange/" + id.ToString() + ".html");
                ResponseHelper.End();
            }

            gift = PointProductBLL.Read(id);
            if (gift.EndDate.Date < DateTime.Now.Date)
            {
                ResponseHelper.Redirect("/pointproduct.html");
            }

            var currentUser = UserBLL.Read(base.UserId);

            userPoint = UserAccountRecordBLL.SumPoint(base.UserId);

            singleUnlimitClass.DataSource = RegionBLL.ReadRegionUnlimitClass();
            singleUnlimitClass.ClassID    = base.UserId > 0? currentUser.RegionId:"|1|";

            Title = gift.Name + " - 积分商品兑换";
        }
Exemple #13
0
        protected override void PageLoad()
        {
            base.PageLoad();
            if (base.UserId > 0)
            {
                CurrentUser = UserBLL.ReadUserMore(base.UserId);
            }
            int currentPage = RequestHelper.GetQueryString <int>("Page");

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

            pointProductList = PointProductBLL.SearchList(currentPage, pageSize, new PointProductSearchInfo {
                IsSale = (int)BoolType.True, ValidDate = DateTime.Now
            }, ref count);

            pager.Init(currentPage, pageSize, count, false);

            Title = "积分兑换商品";
        }
Exemple #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                CheckAdminPower("ReadPointProduct", PowerCheckType.Single);

                string   productName = RequestHelper.GetQueryString <string>("ProductName");
                DateTime beginDate   = RequestHelper.GetQueryString <DateTime>("BeginDate");
                DateTime endDate     = RequestHelper.GetQueryString <DateTime>("EndDate");

                ProductName.Text = productName;
                BeginDate.Text   = beginDate == DateTime.MinValue ? "" : beginDate.ToString("yyyy-MM-dd");
                EndDate.Text     = endDate == DateTime.MinValue ? "" : endDate.ToString("yyyy-MM-dd");

                PointProductSearchInfo searchPointProduct = new PointProductSearchInfo();
                searchPointProduct.ProductName = productName;
                searchPointProduct.BeginDate   = beginDate;
                searchPointProduct.EndDate     = endDate;
                List <PointProductInfo> pointProductInfoList = PointProductBLL.SearchList(CurrentPage, PageSize, searchPointProduct, ref Count);

                BindControl(pointProductInfoList, RecordList, MyPager);
            }
        }
Exemple #15
0
        protected void Submit()
        {
            string             userName           = base.UserName;
            string             userEmail          = CookiesHelper.ReadCookieValue("UserEmail");
            SingleUnlimitClass singleUnlimitClass = new SingleUnlimitClass();

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

            if (id < 1)
            {
                ResponseHelper.Write("error|无效的请求");
                ResponseHelper.End();
            }
            if (singleUnlimitClass.ClassID.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries).Length < 3)
            {
                ResponseHelper.Write("error|请填写完整的地区信息");
                ResponseHelper.End();
                ResponseHelper.End();
            }

            var pointLeft = UserAccountRecordBLL.SumPoint(base.UserId);

            Gift = PointProductBLL.Read(id);
            if (Gift.Point > pointLeft)
            {
                ResponseHelper.Write("error|您当前的积分不足以兑取该礼品");
                ResponseHelper.End();
            }
            //库存
            int num = RequestHelper.GetForm <int>("num");

            if (num > (Gift.TotalStorageCount - Gift.SendCount))
            {
                ResponseHelper.Write("error|该礼品库存不足");
                ResponseHelper.End();
            }

            //添加订单
            OrderInfo order = new OrderInfo();

            order.OrderNumber         = ShopCommon.CreateOrderNumber();
            order.IsActivity          = (int)BoolType.True;
            order.OrderStatus         = (int)OrderStatus.WaitCheck;
            order.OrderNote           = "积分兑换奖品";
            order.ProductMoney        = 0;
            order.Balance             = 0;
            order.FavorableMoney      = 0;
            order.OtherMoney          = 0;
            order.CouponMoney         = 0;
            order.Consignee           = StringHelper.AddSafe(RequestHelper.GetForm <string>("username"));
            order.RegionId            = singleUnlimitClass.ClassID;
            order.Address             = StringHelper.AddSafe(RequestHelper.GetForm <string>("address"));
            order.ZipCode             = StringHelper.AddSafe(RequestHelper.GetForm <string>("zipcode"));
            order.Tel                 = StringHelper.AddSafe(RequestHelper.GetForm <string>("tel"));
            order.Email               = userEmail;
            order.Mobile              = StringHelper.AddSafe(RequestHelper.GetForm <string>("mobile"));
            order.ShippingId          = 0;
            order.ShippingDate        = RequestHelper.DateNow;
            order.ShippingNumber      = string.Empty;
            order.ShippingMoney       = 0;
            order.PayKey              = string.Empty;
            order.PayName             = string.Empty;
            order.PayDate             = RequestHelper.DateNow;;
            order.IsRefund            = (int)BoolType.False;
            order.FavorableActivityId = 0;
            order.GiftId              = 0;
            order.InvoiceTitle        = string.Empty;
            order.InvoiceContent      = string.Empty;
            order.UserMessage         = string.Empty;
            order.AddDate             = RequestHelper.DateNow;
            order.IP            = ClientHelper.IP;
            order.UserId        = base.UserId;
            order.UserName      = userName;
            order.ActivityPoint = Gift.Point * num;
            int orderID = OrderBLL.Add(order);

            //添加订单详细
            OrderDetailInfo orderDetail = new OrderDetailInfo();

            orderDetail.OrderId       = orderID;
            orderDetail.ProductId     = Gift.Id;
            orderDetail.ProductName   = Gift.Name;
            orderDetail.ProductWeight = Gift.Weight;
            orderDetail.SendPoint     = 0;
            orderDetail.ProductPrice  = 0;
            orderDetail.ActivityPoint = Gift.Point;
            orderDetail.BuyCount      = num;
            orderDetail.ParentId      = 0;
            orderDetail.RandNumber    = string.Empty;
            orderDetail.GiftPackId    = 0;
            OrderDetailBLL.Add(orderDetail);

            //积分记录
            var accountRecord = new UserAccountRecordInfo
            {
                Money    = 0,
                Point    = -Gift.Point * num,
                Date     = DateTime.Now,
                IP       = ClientHelper.IP,
                Note     = "兑换礼品-" + Gift.Name,
                UserId   = base.UserId,
                UserName = base.UserName
            };

            UserAccountRecordBLL.Add(accountRecord);

            //更新商品的已兑换数量
            Dictionary <string, object> dict = new Dictionary <string, object>();

            dict.Add("SendCount", Gift.SendCount + num);
            PointProductBLL.UpdatePart(PointProductInfo.TABLENAME, dict, Gift.Id);

            ResponseHelper.Write("ok|" + orderID);
            ResponseHelper.End();
        }
Exemple #16
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);
            }
        }
        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();
        }