Пример #1
0
        protected override void PageLoad()
        {
            base.PageLoad();
            //检查待付款订单是否超时失效,超时则更新为失效状态
            OrderBLL.CheckOrderPayTime();
            //订单自动收货
            OrderBLL.CheckOrderRecieveTimeProg();
            OrderSearchInfo orderSearch = new OrderSearchInfo();

            orderSearch.OrderNumber = RequestHelper.GetQueryString <string>("OrderNumber");
            orderStatus             = RequestHelper.GetQueryString <int>("OrderStatus") <= 0?2: RequestHelper.GetQueryString <int>("OrderStatus");
            //如果查找已删除订单
            if (orderStatus == (int)Entity.OrderStatus.HasDelete)
            {
                orderSearch.IsDelete = (int)BoolType.True;//已删除
            }
            else
            {
                orderSearch.OrderStatus = orderStatus;
                orderSearch.IsDelete    = (int)BoolType.False;//未删除
            }
            orderSearch.Consignee    = RequestHelper.GetQueryString <string>("Consignee");
            orderSearch.StartAddDate = RequestHelper.GetQueryString <DateTime>("StartAddDate");
            orderSearch.EndAddDate   = RequestHelper.GetQueryString <DateTime>("EndAddDate");

            orderList = OrderBLL.SearchList(1, pageSize, orderSearch, ref Count);

            if (orderStatus == 2 || orderStatus == 4)
            {
                topNav = 0;
            }
        }
Пример #2
0
        protected override void PageLoad()
        {
            base.PageLoad();
            //检查待付款订单是否超时失效,超时则更新为失效状态
            OrderBLL.CheckOrderPayTime();
            //订单自动收货
            OrderBLL.CheckOrderRecieveTimeProg();

            OrderSearchInfo orderSearch = new OrderSearchInfo();

            //orderDate =string.IsNullOrEmpty(RequestHelper.GetQueryString<string>("orderDate"))?orderDate: RequestHelper.GetQueryString<DateTime>("orderDate")<=DateTime.MinValue?orderDate: RequestHelper.GetQueryString<DateTime>("orderDate");
            searchKey               = RequestHelper.GetQueryString <string>("searchKey");
            orderPeriod             = RequestHelper.GetQueryString <int>("orderPeriod");
            orderStatus             = RequestHelper.GetQueryString <int>("OrderStatus");
            orderSearch.OrderPeriod = orderPeriod;
            orderSearch.SearchKey   = searchKey;
            //orderSearch.OrderDate = orderDate;
            //如果查找已删除订单
            if (orderStatus == (int)Entity.OrderStatus.HasDelete)
            {
                orderSearch.IsDelete = (int)BoolType.True;//已删除
            }
            else
            {
                orderSearch.OrderStatus = orderStatus;
                orderSearch.IsDelete    = (int)BoolType.False;//未删除
            }
            orderSearch.Consignee    = RequestHelper.GetQueryString <string>("Consignee");
            orderSearch.StartAddDate = RequestHelper.GetQueryString <DateTime>("StartAddDate");
            orderSearch.EndAddDate   = RequestHelper.GetQueryString <DateTime>("EndAddDate");

            orderList = OrderBLL.SearchList(1, pageSize, orderSearch, ref Count);

            topNav = 1;
        }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                //检查待付款订单是否超时失效,超时则更新为失效状态
                OrderBLL.CheckOrderPayTime();
                //订单自动收货
                OrderBLL.CheckOrderRecieveTimeProg();

                CheckAdminPower("ReadOrder", PowerCheckType.Single);

                OrderNumber.Text  = RequestHelper.GetQueryString <string>("OrderNumber");
                Consignee.Text    = RequestHelper.GetQueryString <string>("Consignee");
                StartAddDate.Text = RequestHelper.GetQueryString <string>("StartAddDate");
                EndAddDate.Text   = RequestHelper.GetQueryString <string>("EndAddDate");
                SelfPick.Text     = RequestHelper.GetQueryString <string>("SelfPick");
                OrderSearchInfo orderSearch = new OrderSearchInfo();
                orderSearch.OrderNumber = RequestHelper.GetQueryString <string>("OrderNumber");

                orderSearch.OrderStatus = intOrderStatus;
                orderSearch.IsDelete    = (int)BoolType.False;//未删除

                orderSearch.Consignee    = RequestHelper.GetQueryString <string>("Consignee");
                orderSearch.StartAddDate = RequestHelper.GetQueryString <DateTime>("StartAddDate");
                orderSearch.EndAddDate   = RequestHelper.GetQueryString <DateTime>("EndAddDate");
                orderSearch.SelfPick     = RequestHelper.GetQueryString <int>("SelfPick");
                PageSize           = Session["AdminPageSize"] == null ? 20 : Convert.ToInt32(Session["AdminPageSize"]);
                AdminPageSize.Text = Session["AdminPageSize"] == null ? "20" : Session["AdminPageSize"].ToString();
                var orderList = OrderBLL.SearchList(CurrentPage, PageSize, orderSearch, ref Count);

                BindControl(orderList, RecordList, MyPager);
            }
        }
Пример #4
0
        public ActionResult Index()
        {
            int[] arrT = new int[5];
            //检查用户的待付款订单是否超时失效,超时则更新为失效状态
            OrderBLL.CheckOrderPayTime(user.Id);
            //订单自动收货
            OrderBLL.CheckOrderRecieveTimeProg(user.Id);

            OrderSearchInfo orderSearch = new OrderSearchInfo();

            orderSearch.OrderStatus = (int)(OrderStatus.WaitPay);
            orderSearch.UserId      = uid;
            orderSearch.IsDelete    = 0;
            arrT[0] = OrderBLL.SearchList(orderSearch).Count;
            orderSearch.OrderStatus = (int)(OrderStatus.WaitCheck);
            orderSearch.UserId      = uid;
            orderSearch.IsDelete    = 0;
            //待审核
            var orderList = OrderBLL.SearchList(orderSearch);

            arrT[1] = orderList.Count;
            #region 待分享
            var list1     = orderList.Where(k => k.IsActivity == (int)OrderKind.GroupBuy && k.FavorableActivityId > 0);
            var groupIds  = list1.Select(k => k.FavorableActivityId).ToArray();
            var groupList = GroupBuyBLL.ReadList(groupIds).Where(k => k.StartTime <= DateTime.Now && k.EndTime >= DateTime.Now && k.Quantity > k.SignCount);
            var ids       = groupList.Select(k => k.Id);
            var list2     = list1.Where(k => ids.Contains(k.FavorableActivityId));
            arrT[4] = list2.Count();
            #endregion

            orderSearch.OrderStatus = (int)(OrderStatus.HasShipping);
            orderSearch.UserId      = uid;
            orderSearch.IsDelete    = 0;
            arrT[2] = OrderBLL.SearchList(orderSearch).Count;
            orderSearch.OrderStatus = (int)(OrderStatus.ReceiveShipping);
            orderSearch.UserId      = uid;
            orderSearch.IsDelete    = 0;
            arrT[3] = OrderBLL.SearchList(orderSearch).Count;
            //是否填写手机号
            bool hasMobile = !string.IsNullOrEmpty(user.Mobile.Trim());
            #region 生日前后5天登录会员中心,自动发放本年度生日礼券。( 是否获取生日优惠券,本年生日前后5天出现提示)
            //判断是否能够获取本年度生日礼券
            bool     canGetBirthdayCoupon = true;
            DateTime birthday             = DateTime.MinValue;
            //如果用户已填写生日,则在生日前后5天提示领取生日礼券
            if (DateTime.TryParse(user.Birthday, out birthday) && (birthday.AddDays(-5).Month == DateTime.Now.Month && birthday.AddDays(-5).Day <= DateTime.Now.Day) && (birthday.AddDays(5).Month == DateTime.Now.Month && birthday.AddDays(5).Day >= DateTime.Now.Day))
            {
                int count      = 0;
                var couponlist = CouponBLL.SearchList(1, 1, new CouponSearchInfo {
                    Type = (int)CouponKind.BirthdayGet, CanUse = 1
                }, ref count);
                //如果有生日礼券活动进行中
                if (couponlist.Count > 0)
                {
                    ////如果本年度已获取,则不能再获取
                    //if (user.HasBirthdayCoupon != 0 && user.GetBirthdayCouponDate.Year == DateTime.Now.Year) canGetBirthdayCoupon = false;
                    #region 自动发放,每年度限领1次
                    if (user.HasBirthdayCoupon == 0 || (user.HasBirthdayCoupon != 0 && user.GetBirthdayCouponDate.Year != DateTime.Now.Year))
                    {
                        UserCouponInfo userCoupon = UserCouponBLL.ReadLast(couponlist[0].Id);
                        if (UserCouponBLL.UniqueUserCatch(user.Id, couponlist[0].Id))
                        {
                            int startNumber = 0;
                            if (userCoupon.Id > 0)
                            {
                                string tempNumber = userCoupon.Number.Substring(3, 5);
                                while (tempNumber.Substring(0, 1) == "0")
                                {
                                    tempNumber = tempNumber.Substring(1);
                                }
                                startNumber = Convert.ToInt32(tempNumber);
                            }
                            startNumber++;
                            int cpid = UserCouponBLL.Add(new UserCouponInfo
                            {
                                UserId   = user.Id,
                                UserName = user.UserName,
                                CouponId = couponlist[0].Id,
                                GetType  = (int)CouponType.BirthdayGet,
                                Number   = ShopCommon.CreateCouponNo(couponlist[0].Id, startNumber),
                                Password = ShopCommon.CreateCouponPassword(startNumber),
                                IsUse    = (int)BoolType.False,
                                OrderId  = 0
                            });
                            //领取成功改变user表标识
                            if (cpid > 0)
                            {
                                Dictionary <string, object> dict = new Dictionary <string, object>();
                                dict.Add("[HasBirthdayCoupon]", 1);
                                dict.Add("[GetBirthdayCouponDate]", DateTime.Now);
                                UserBLL.UpdatePart("[usr]", dict, user.Id);
                                //user对应的未使用优惠券数量加1
                                user.CouPonLeft++;
                            }
                        }
                    }
                    #endregion
                }
                else
                {
                    //如果商家后台没有设置正在进行中的会员生日券,则不能获取
                    canGetBirthdayCoupon = false;
                }
            }
            else
            {
                canGetBirthdayCoupon = false;
            }
            #endregion
            //计算是否
            return(Json(new { ordercount = arrT, hasmobile = hasMobile, usergrade = userGradeInfo, cangetbirthdaycoupon = canGetBirthdayCoupon, couponleft = user.CouPonLeft, pointleft = user.PointLeft }, JsonRequestBehavior.AllowGet));
        }
Пример #5
0
        protected override void PageLoad()
        {
            base.PageLoad();
            //检查用户的待付款订单是否超时失效,超时则更新为失效状态
            OrderBLL.CheckOrderPayTime(base.UserId);
            //订单自动收货
            OrderBLL.CheckOrderRecieveTimeProg(base.UserId);
            //cartList = CartBLL.ReadList(base.UserId);
            topNav = 7;

            string keywords = RequestHelper.GetQueryString <string>("keywords");

            int             count       = 0;
            OrderSearchInfo orderSearch = new OrderSearchInfo();

            orderSearch.UserId   = base.UserId;
            orderSearch.IsDelete = 0;
            if (!string.IsNullOrEmpty(keywords))
            {
                orderSearch.OrderNumber = keywords;
            }


            orderList = OrderBLL.SearchList(1, 5, orderSearch, ref count);

            //commonPagerClass.Init(currentPage, pageSize, count, !string.IsNullOrEmpty(isMobile));
            //热销商品
            proListHot = ProductBLL.SearchList(1, 8, new ProductSearchInfo {
                IsHot = 1, IsSale = 1, IsDelete = 0
            }, ref count);

            #region 对应状态个数

            arrT[0] = OrderBLL.SearchList(new OrderSearchInfo {
                UserId = base.UserId, IsDelete = 0
            }).Count;
            orderSearch.OrderStatus = (int)(OrderStatus.WaitPay);
            orderSearch.UserId      = base.UserId; orderSearch.IsDelete = 0;
            arrT[1] = OrderBLL.SearchList(orderSearch).Count;
            orderSearch.OrderStatus = (int)(OrderStatus.Shipping);
            orderSearch.UserId      = base.UserId; orderSearch.IsDelete = 0;
            arrT[2] = OrderBLL.SearchList(orderSearch).Count;
            orderSearch.OrderStatus = (int)(OrderStatus.HasShipping);
            orderSearch.UserId      = base.UserId; orderSearch.IsDelete = 0;
            arrT[3] = OrderBLL.SearchList(orderSearch).Count;
            orderSearch.OrderStatus = (int)(OrderStatus.WaitCheck);
            orderSearch.UserId      = base.UserId; orderSearch.IsDelete = 0;
            arrT[4] = OrderBLL.SearchList(orderSearch).Count;
            orderSearch.OrderStatus = (int)(OrderStatus.NoEffect);
            orderSearch.UserId      = base.UserId; orderSearch.IsDelete = 0;
            arrT[5] = OrderBLL.SearchList(orderSearch).Count;
            #endregion

            #region 浏览过的商品
            strHistoryProduct = Server.UrlDecode(CookiesHelper.ReadCookieValue("HistoryProduct"));
            if (strHistoryProduct.StartsWith(","))
            {
                strHistoryProduct = strHistoryProduct.Substring(1);
            }
            if (strHistoryProduct.EndsWith(","))
            {
                strHistoryProduct = strHistoryProduct.Substring(0, strHistoryProduct.Length - 1);
            }
            if (!string.IsNullOrEmpty(strHistoryProduct))
            {
                proHistoryList = ProductBLL.SearchList(1, 12, new ProductSearchInfo {
                    IsSale = 1, InProductId = strHistoryProduct, IsDelete = 0
                }, ref count);
            }
            #endregion
            #region 收藏的商品
            productCollectList = ProductCollectBLL.ReadListByUserId(base.UserId);
            string strProductID = string.Empty;
            foreach (ProductCollectInfo productCollect in productCollectList)
            {
                if (strProductID == string.Empty)
                {
                    strProductID = productCollect.ProductId.ToString();
                }
                else
                {
                    strProductID += "," + productCollect.ProductId.ToString();
                }
            }

            if (!string.IsNullOrEmpty(strProductID))
            {
                productList = ProductBLL.SearchList(1, 8, new ProductSearchInfo {
                    InProductId = strProductID, IsSale = 1, IsDelete = 0
                }, ref count);
            }
            #endregion
        }
Пример #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                //检查待付款订单是否超时失效,超时则更新为失效状态
                OrderBLL.CheckOrderPayTime();
                //订单自动收货
                OrderBLL.CheckOrderRecieveTimeProg();

                CheckAdminPower("ReadOrder", PowerCheckType.Single);

                OrderNumber.Text  = RequestHelper.GetQueryString <string>("OrderNumber");
                OrderStatus.Text  = RequestHelper.GetQueryString <string>("OrderStatus");
                Consignee.Text    = RequestHelper.GetQueryString <string>("Consignee");
                StartAddDate.Text = RequestHelper.GetQueryString <string>("StartAddDate");
                EndAddDate.Text   = RequestHelper.GetQueryString <string>("EndAddDate");
                SelfPick.Text     = RequestHelper.GetQueryString <string>("SelfPick");
                OrderSearchInfo orderSearch = new OrderSearchInfo();
                orderSearch.OrderNumber = RequestHelper.GetQueryString <string>("OrderNumber");
                intOrderStatus          = RequestHelper.GetQueryString <int>("OrderStatus");

                //如果查找已删除订单
                if (intOrderStatus == (int)Entity.OrderStatus.HasDelete)
                {
                    orderSearch.IsDelete = (int)BoolType.True;//已删除
                }
                else
                {
                    orderSearch.OrderStatus = intOrderStatus;
                    orderSearch.IsDelete    = (int)BoolType.False;//未删除
                }
                orderSearch.Consignee    = RequestHelper.GetQueryString <string>("Consignee");
                orderSearch.StartAddDate = RequestHelper.GetQueryString <DateTime>("StartAddDate");
                orderSearch.EndAddDate   = RequestHelper.GetQueryString <DateTime>("EndAddDate");
                orderSearch.SelfPick     = RequestHelper.GetQueryString <int>("SelfPick");
                PageSize           = Session["AdminPageSize"] == null ? 20 : Convert.ToInt32(Session["AdminPageSize"]);
                AdminPageSize.Text = Session["AdminPageSize"] == null ? "20" : Session["AdminPageSize"].ToString();
                var orderList = OrderBLL.SearchList(CurrentPage, PageSize, orderSearch, ref Count);

                //取得订单最后一次操作的时间
                var orderActinList = OrderActionBLL.ReadListLastDate(orderList.Select(k => k.Id).ToArray());
                foreach (var order in orderList)
                {
                    var orderAction = orderActinList.FirstOrDefault(k => k.OrderId == order.Id) ?? new OrderActionInfo();
                    //此处使用InvoiceTitle字段来临时存储
                    order.InvoiceTitle = orderAction.OrderId > 0 ? orderAction.Date.ToString() : "";
                }
                BindControl(orderList, RecordList, MyPager);
                #region  除订单
                if (RequestHelper.GetQueryString <string>("Action") == "delete")
                {
                    CheckAdminPower("DeleteOrder", PowerCheckType.Single);
                    int orderId = RequestHelper.GetQueryString <int>("orderId");
                    if (orderId > 0)
                    {
                        OrderInfo tmpOrder = OrderBLL.Read(orderId);
                        if (tmpOrder.OrderStatus == (int)JWShop.Entity.OrderStatus.WaitPay)
                        {//待付款直接删除退还积分库存
                            #region 退还积分
                            if (tmpOrder.Point > 0)
                            {
                                var accountRecord = new UserAccountRecordInfo
                                {
                                    RecordType = (int)AccountRecordType.Point,
                                    Money      = 0,
                                    Point      = tmpOrder.Point,
                                    Date       = DateTime.Now,
                                    IP         = ClientHelper.IP,
                                    Note       = "取消订单:" + tmpOrder.OrderNumber + ",退回用户积分",
                                    UserId     = tmpOrder.UserId,
                                    UserName   = tmpOrder.UserName,
                                };
                                UserAccountRecordBLL.Add(accountRecord);
                            }
                            #endregion
                            //更新商品库存数量
                            ProductBLL.ChangeOrderCountByOrder(tmpOrder.Id, ChangeAction.Minus);
                            OrderBLL.Delete(orderId);
                            AdminLogBLL.Add(ShopLanguage.ReadLanguage("DeleteRecordCompletely"), ShopLanguage.ReadLanguage("Order"), orderId);
                        }
                        else
                        { //已付款逻辑删除可恢复
                            if (tmpOrder.IsDelete == (int)BoolType.False)
                            {
                                tmpOrder.IsDelete = (int)BoolType.True;
                                OrderBLL.Update(tmpOrder);
                                AdminLogBLL.Add(ShopLanguage.ReadLanguage("DeleteRecord"), ShopLanguage.ReadLanguage("Order"), orderId);
                            }
                        }
                    }

                    ScriptHelper.Alert(ShopLanguage.ReadLanguage("DeleteOK"), Request.UrlReferrer.ToString());
                }
                #endregion
            }
        }