protected void Page_Load(object sender, EventArgs e)
 {
     if (!int.TryParse(base.Request.QueryString["groupBuyId"], out groupBuyId))
     {
         base.GotoResourceNotFound();
     }
     else
     {
         btnUpdateGroupBuy.Click += new EventHandler(btnUpdateGroupBuy_Click);
         btnFail.Click           += new EventHandler(btnFail_Click);
         btnSuccess.Click        += new EventHandler(btnSuccess_Click);
         btnFinish.Click         += new EventHandler(btnFinish_Click);
         if (!base.IsPostBack)
         {
             dropGroupBuyProduct.DataBind();
             dropCategories.DataBind();
             GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy(groupBuyId);
             if (PromoteHelper.GetOrderCount(groupBuyId) > 0)
             {
                 dropGroupBuyProduct.Enabled = false;
             }
             if (groupBuy == null)
             {
                 base.GotoResourceNotFound();
             }
             else
             {
                 if (groupBuy.Status == GroupBuyStatus.EndUntreated)
                 {
                     btnFail.Visible    = true;
                     btnSuccess.Visible = true;
                 }
                 if (groupBuy.Status == GroupBuyStatus.UnderWay)
                 {
                     btnFinish.Visible = true;
                 }
                 LoadGroupBuy(groupBuy);
             }
         }
     }
 }
Beispiel #2
0
        protected void dlstOrders_ItemCommand(object sender, DataListCommandEventArgs e)
        {
            OrderInfo orderInfo = OrderHelper.GetOrderInfo(e.CommandArgument.ToString());

            if (orderInfo != null)
            {
                if ((e.CommandName == "CONFIRM_PAY") && orderInfo.CheckAction(OrderActions.SELLER_CONFIRM_PAY))
                {
                    int maxCount             = 0;
                    int orderCount           = 0;
                    int groupBuyOerderNumber = 0;
                    if (orderInfo.GroupBuyId > 0)
                    {
                        GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy(orderInfo.GroupBuyId);
                        if ((groupBuy == null) || (groupBuy.Status != GroupBuyStatus.UnderWay))
                        {
                            ShowMsg("当前的订单为团购订单,此团购活动已结束,所以不能支付", false);
                            return;
                        }
                        orderCount           = PromoteHelper.GetOrderCount(orderInfo.GroupBuyId);
                        maxCount             = groupBuy.MaxCount;
                        groupBuyOerderNumber = orderInfo.GetGroupBuyOerderNumber();
                        if (maxCount < (orderCount + groupBuyOerderNumber))
                        {
                            ShowMsg("当前的订单为团购订单,订购数量已超过订购总数,所以不能支付", false);
                            return;
                        }
                    }
                    if (OrderHelper.ConfirmPay(orderInfo))
                    {
                        if ((orderInfo.GroupBuyId > 0) && (maxCount == (orderCount + groupBuyOerderNumber)))
                        {
                            PromoteHelper.SetGroupBuyEndUntreated(orderInfo.GroupBuyId);
                        }
                        BindOrders();
                        int userId = orderInfo.UserId;
                        if (userId == 0x44c)
                        {
                            userId = 0;
                        }
                        Messenger.OrderPayment(Users.GetUser(userId), orderInfo.OrderId, orderInfo.GetTotal());
                        orderInfo.OnPayment();
                        ShowMsg("成功的确认了订单收款", true);
                    }
                    else
                    {
                        ShowMsg("确认订单收款失败", false);
                    }
                }
                else if ((e.CommandName == "FINISH_TRADE") && orderInfo.CheckAction(OrderActions.SELLER_FINISH_TRADE))
                {
                    if (OrderHelper.ConfirmOrderFinish(orderInfo))
                    {
                        BindOrders();
                        ShowMsg("成功的完成了该订单", true);
                    }
                    else
                    {
                        ShowMsg("完成订单失败", false);
                    }
                }
            }
        }
        protected void dlstOrders_ItemCommand(object sender, DataListCommandEventArgs e)
        {
            OrderInfo orderInfo = OrderHelper.GetOrderInfo(e.CommandArgument.ToString());

            if (orderInfo != null)
            {
                if ((e.CommandName == "CONFIRM_PAY") && orderInfo.CheckAction(OrderActions.SELLER_CONFIRM_PAY))
                {
                    int maxCount             = 0;
                    int orderCount           = 0;
                    int groupBuyOerderNumber = 0;
                    if (orderInfo.CountDownBuyId > 0)
                    {
                        CountDownInfo countDownBuy = TradeHelper.GetCountDownBuy(orderInfo.CountDownBuyId);
                        if ((countDownBuy == null) || (countDownBuy.EndDate < DateTime.Now))
                        {
                            this.ShowMsg("当前的订单为限时抢购订单,此活动已结束,所以不能支付", false);
                            return;
                        }
                    }
                    if (orderInfo.GroupBuyId > 0)
                    {
                        GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy(orderInfo.GroupBuyId);
                        if ((groupBuy == null) || (groupBuy.Status != GroupBuyStatus.UnderWay))
                        {
                            this.ShowMsg("当前的订单为团购订单,此团购活动已结束,所以不能支付", false);
                            return;
                        }
                        orderCount           = PromoteHelper.GetOrderCount(orderInfo.GroupBuyId);
                        maxCount             = groupBuy.MaxCount;
                        groupBuyOerderNumber = orderInfo.GetGroupBuyOerderNumber();
                        if (maxCount < (orderCount + groupBuyOerderNumber))
                        {
                            this.ShowMsg("当前的订单为团购订单,订购数量已超过订购总数,所以不能支付", false);
                            return;
                        }
                    }
                    if (OrderHelper.ConfirmPay(orderInfo))
                    {
                        DebitNote note = new DebitNote();
                        note.NoteId   = Globals.GetGenerateId();
                        note.OrderId  = e.CommandArgument.ToString();
                        note.Operator = HiContext.Current.User.Username;
                        note.Remark   = "后台" + note.Operator + "收款成功";
                        OrderHelper.SaveDebitNote(note);
                        if ((orderInfo.GroupBuyId > 0) && (maxCount == (orderCount + groupBuyOerderNumber)))
                        {
                            PromoteHelper.SetGroupBuyEndUntreated(orderInfo.GroupBuyId);
                        }
                        this.BindOrders();
                        int userId = orderInfo.UserId;
                        if (userId == 0x44c)
                        {
                            userId = 0;
                        }
                        Messenger.OrderPayment(Users.GetUser(userId), orderInfo.OrderId, orderInfo.GetTotal());
                        orderInfo.OnPayment();
                        this.ShowMsg("成功的确认了订单收款", true);
                    }
                    else
                    {
                        this.ShowMsg("确认订单收款失败", false);
                    }
                }
                else if ((e.CommandName == "FINISH_TRADE") && orderInfo.CheckAction(OrderActions.SELLER_FINISH_TRADE))
                {
                    if (OrderHelper.ConfirmOrderFinish(orderInfo))
                    {
                        this.BindOrders();
                        this.ShowMsg("成功的完成了该订单", true);
                    }
                    else
                    {
                        this.ShowMsg("完成订单失败", false);
                    }
                }
            }
        }
Beispiel #4
0
        public void ConfirmPay(HttpContext context)
        {
            string text = context.Request["id"];

            if (string.IsNullOrWhiteSpace(text))
            {
                throw new HidistroAshxException("错误的编号");
            }
            OrderInfo orderInfo = new OrderDao().GetOrderInfo(text);

            if (orderInfo == null)
            {
                throw new HidistroAshxException("错误的编号");
            }
            if (!orderInfo.CheckAction(OrderActions.SELLER_CONFIRM_PAY))
            {
                throw new HidistroAshxException("权限不足");
            }
            PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode("hishop.plugins.payment.bankrequest");

            if (paymentMode != null)
            {
                orderInfo.Gateway       = paymentMode.Gateway;
                orderInfo.PaymentType   = paymentMode.Name;
                orderInfo.PaymentTypeId = paymentMode.ModeId;
            }
            else
            {
                orderInfo.Gateway       = "hishop.plugins.payment.bankrequest";
                orderInfo.PaymentType   = "线下支付";
                orderInfo.PaymentTypeId = 0;
            }
            int num  = 0;
            int num2 = 0;
            int num3 = 0;

            if (orderInfo.CountDownBuyId > 0)
            {
                string empty = string.Empty;
                foreach (KeyValuePair <string, LineItemInfo> lineItem in orderInfo.LineItems)
                {
                    CountDownInfo countDownInfo = TradeHelper.CheckUserCountDown(lineItem.Value.ProductId, orderInfo.CountDownBuyId, lineItem.Value.SkuId, orderInfo.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, out empty, orderInfo.StoreId);
                    if (countDownInfo == null)
                    {
                        throw new HidistroAshxException(empty);
                    }
                }
            }
            if (orderInfo.FightGroupId > 0)
            {
                string empty2 = string.Empty;
                foreach (KeyValuePair <string, LineItemInfo> lineItem2 in orderInfo.LineItems)
                {
                    FightGroupActivityInfo fightGroupActivityInfo = VShopHelper.CheckUserFightGroup(lineItem2.Value.ProductId, orderInfo.FightGroupActivityId, orderInfo.FightGroupId, lineItem2.Value.SkuId, orderInfo.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, lineItem2.Value.Quantity, out empty2);
                    if (fightGroupActivityInfo == null)
                    {
                        throw new HidistroAshxException(empty2);
                    }
                }
            }
            if (orderInfo.GroupBuyId > 0)
            {
                GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy(orderInfo.GroupBuyId);
                if (groupBuy == null || groupBuy.Status != GroupBuyStatus.UnderWay)
                {
                    throw new HidistroAshxException("当前的订单为团购订单,此团购活动已结束,所以不能支付");
                }
                num2 = PromoteHelper.GetOrderCount(orderInfo.GroupBuyId);
                num  = groupBuy.MaxCount;
                num3 = orderInfo.GetGroupBuyOerderNumber();
                if (num < num2 + num3)
                {
                    throw new HidistroAshxException("当前的订单为团购订单,订购数量已超过订购总数,所以不能支付");
                }
            }
            if (orderInfo.PreSaleId > 0)
            {
                ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId);
                if (productPreSaleInfo == null)
                {
                    throw new HidistroAshxException("预售活动不存在");
                }
                if (!orderInfo.DepositDate.HasValue && productPreSaleInfo.PreSaleEndDate < DateTime.Now)
                {
                    throw new HidistroAshxException("预售活动已结束不能支付定金,所以不能确认收款");
                }
            }
            string empty3 = string.Empty;

            switch (TradeHelper.CheckOrderBeforePay(orderInfo, out empty3))
            {
            case 1:
                throw new HidistroAshxException($"当前有商品{empty3}下架或者被删除,不能确认收款");

            case 2:
                if ((orderInfo.PreSaleId <= 0 || orderInfo.DepositDate.HasValue) && orderInfo.PreSaleId > 0)
                {
                    break;
                }
                throw new HidistroAshxException($"当前有商品{empty3}库存不足,不能确认收款");
            }
            if (OrderHelper.ConfirmPay(orderInfo))
            {
                if (orderInfo.GroupBuyId > 0 && num == num2 + num3)
                {
                    PromoteHelper.SetGroupBuyEndUntreated(orderInfo.GroupBuyId);
                }
                if (orderInfo.ParentOrderId == "-1")
                {
                    OrderQuery orderQuery = new OrderQuery();
                    orderQuery.ParentOrderId = orderInfo.OrderId;
                    IList <OrderInfo> listUserOrder = MemberProcessor.GetListUserOrder(orderInfo.UserId, orderQuery);
                    foreach (OrderInfo item in listUserOrder)
                    {
                        OrderHelper.OrderConfirmPaySendMessage(item);
                    }
                }
                else
                {
                    OrderHelper.OrderConfirmPaySendMessage(orderInfo);
                }
                base.ReturnSuccessResult(context, "成功的确认了订单收款", 0, true);
                return;
            }
            throw new HidistroAshxException("确认订单收款失败");
        }
Beispiel #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(base.Request["isCallback"]) && (base.Request["isCallback"] == "true"))
     {
         int num;
         if (int.TryParse(base.Request["productId"], out num))
         {
             string priceByProductId = PromoteHelper.GetPriceByProductId(num);
             if (priceByProductId.Length > 0)
             {
                 base.Response.Clear();
                 base.Response.ContentType = "application/json";
                 base.Response.Write("{ ");
                 base.Response.Write("\"Status\":\"OK\",");
                 base.Response.Write(string.Format("\"Price\":\"{0}\"", decimal.Parse(priceByProductId).ToString("F2")));
                 base.Response.Write("}");
                 base.Response.End();
             }
         }
     }
     else if (!int.TryParse(base.Request.QueryString["groupBuyId"], out this.groupBuyId))
     {
         base.GotoResourceNotFound();
     }
     else
     {
         this.btnUpdateGroupBuy.Click += new EventHandler(this.btnUpdateGroupBuy_Click);
         this.btnFail.Click           += new EventHandler(this.btnFail_Click);
         this.btnSuccess.Click        += new EventHandler(this.btnSuccess_Click);
         this.btnFinish.Click         += new EventHandler(this.btnFinish_Click);
         if (!base.IsPostBack)
         {
             this.dropGroupBuyProduct.DataBind();
             this.dropCategories.DataBind();
             this.HourDropDownList1.DataBind();
             this.drophours.DataBind();
             GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy(this.groupBuyId);
             if (PromoteHelper.GetOrderCount(this.groupBuyId) > 0)
             {
                 this.dropGroupBuyProduct.Enabled = false;
             }
             if (groupBuy == null)
             {
                 base.GotoResourceNotFound();
             }
             else
             {
                 if (groupBuy.Status == GroupBuyStatus.EndUntreated)
                 {
                     this.btnFail.Visible    = true;
                     this.btnSuccess.Visible = true;
                 }
                 if (groupBuy.Status == GroupBuyStatus.UnderWay)
                 {
                     this.btnFinish.Visible = true;
                 }
                 this.LoadGroupBuy(groupBuy);
             }
         }
     }
 }
Beispiel #6
0
        protected void dlstOrders_ItemCommand(object sender, System.Web.UI.WebControls.DataListCommandEventArgs e)
        {
            OrderInfo orderInfo = OrderHelper.GetOrderInfo(e.CommandArgument.ToString());

            if (orderInfo != null)
            {
                if (e.CommandName == "CONFIRM_PAY" && orderInfo.CheckAction(OrderActions.SELLER_CONFIRM_PAY))
                {
                    int num  = 0;
                    int num2 = 0;
                    int num3 = 0;
                    if (orderInfo.CountDownBuyId > 0)
                    {
                        CountDownInfo countDownBuy = TradeHelper.GetCountDownBuy(orderInfo.CountDownBuyId);
                        if (countDownBuy == null || countDownBuy.EndDate < System.DateTime.Now)
                        {
                            this.ShowMsg("当前的订单为限时抢购订单,此活动已结束,所以不能支付", false);
                            return;
                        }
                    }
                    if (orderInfo.GroupBuyId > 0)
                    {
                        GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy(orderInfo.GroupBuyId);
                        if (groupBuy != null)
                        {
                            if (groupBuy.Status == GroupBuyStatus.UnderWay)
                            {
                                num2 = PromoteHelper.GetOrderCount(orderInfo.GroupBuyId);
                                num  = groupBuy.MaxCount;
                                num3 = orderInfo.GetGroupBuyOerderNumber();
                                if (num < num2 + num3)
                                {
                                    this.ShowMsg("当前的订单为团购订单,订购数量已超过订购总数,所以不能支付", false);
                                    return;
                                }
                                goto IL_E2;
                            }
                        }
                        this.ShowMsg("当前的订单为团购订单,此团购活动已结束,所以不能支付", false);
                        return;
                    }
IL_E2:
                    if (OrderHelper.ConfirmPay(orderInfo))
                    {
                        DebitNote debitNote = new DebitNote();
                        debitNote.NoteId   = Globals.GetGenerateId();
                        debitNote.OrderId  = e.CommandArgument.ToString();
                        debitNote.Operator = Hidistro.Membership.Context.HiContext.Current.User.Username;
                        debitNote.Remark   = "后台" + debitNote.Operator + "收款成功";
                        OrderHelper.SaveDebitNote(debitNote);
                        if (orderInfo.GroupBuyId > 0 && num == num2 + num3)
                        {
                            PromoteHelper.SetGroupBuyEndUntreated(orderInfo.GroupBuyId);
                        }
                        this.BindOrders();
                        int num4 = orderInfo.UserId;
                        if (num4 == 1100)
                        {
                            num4 = 0;
                        }
                        Hidistro.Membership.Core.IUser user = Hidistro.Membership.Context.Users.GetUser(num4);
                        Messenger.OrderPayment(user, orderInfo.OrderId, orderInfo.GetTotal());
                        orderInfo.OnPayment();
                        this.Page.ClientScript.RegisterClientScriptBlock(base.GetType(), "sucess", string.Format("<script language=\"javascript\" >alert('确认收款成功');window.location.href=\"{0}\"</script>", System.Web.HttpContext.Current.Request.RawUrl));
                        return;
                    }
                    this.ShowMsg("确认订单收款失败", false);
                    return;
                }
                else
                {
                    if (e.CommandName == "FINISH_TRADE" && orderInfo.CheckAction(OrderActions.SELLER_FINISH_TRADE))
                    {
                        if (OrderHelper.ConfirmOrderFinish(orderInfo))
                        {
                            this.BindOrders();
                            this.ShowMsg("成功的完成了该订单", true);
                            return;
                        }
                        this.ShowMsg("完成订单失败", false);
                        return;
                    }
                    else
                    {
                        if (e.CommandName == "Match_Order")
                        {
                            if (orderInfo == null)
                            {
                                return;
                            }
                            if (orderInfo.GroupBuyId > 0 && orderInfo.GroupBuyStatus != GroupBuyStatus.Success)
                            {
                                this.ShowMsg("当前订单为团购订单,团购活动还未成功结束,所以不能发货", false);
                                return;
                            }
                            if (!orderInfo.CheckAction(OrderActions.SELLER_SEND_GOODS))
                            {
                                this.ShowMsg("当前订单状态没有付款或不是等待发货的订单,所以不能发货", false);
                                return;
                            }
                            if (Methods.Supplier_OrderIsFenPei(e.CommandArgument.ToString()))
                            {
                                this.ShowMsg("生成成功", true);
                                return;
                            }
                            string text = Methods.Supplier_OrderItemSupplierUpdate(orderInfo);
                            if (text != "true")
                            {
                                this.ShowMsg(text, false);
                                return;
                            }
                            orderInfo.RealShippingModeId = 0;
                            orderInfo.RealModeName       = "配送方式(已实际发货单为准)";
                            orderInfo.ShipOrderNumber    = string.Format("{0}", string.Format(" <a style=\"color:red;cursor:pointer;\" target=\"_blank\" onclick=\"{0}\">物流详细</a>", "showWindow_ShipInfoPage('" + orderInfo.OrderId + "')"));
                            if (OrderHelper.SendGoods(orderInfo))
                            {
                                Methods.Supplier_OrderItemsSupplierFenPeiOverUpdate(orderInfo.OrderId);
                                if (!string.IsNullOrEmpty(orderInfo.GatewayOrderId) && orderInfo.GatewayOrderId.Trim().Length > 0)
                                {
                                    PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode(orderInfo.PaymentTypeId);
                                    if (paymentMode != null)
                                    {
                                        PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(), "订单发货", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, Globals.FullPath(Globals.GetSiteUrls().Home), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentReturn_url", new object[]
                                        {
                                            paymentMode.Gateway
                                        })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentNotify_url", new object[]
                                        {
                                            paymentMode.Gateway
                                        })), "");
                                        paymentRequest.SendGoods(orderInfo.GatewayOrderId, orderInfo.RealModeName, orderInfo.ShipOrderNumber, "EXPRESS");
                                    }
                                }
                                int num5 = orderInfo.UserId;
                                if (num5 == 1100)
                                {
                                    num5 = 0;
                                }
                                Hidistro.Membership.Core.IUser user2 = Hidistro.Membership.Context.Users.GetUser(num5);
                                Messenger.OrderShipping(orderInfo, user2);
                                orderInfo.OnDeliver();
                                this.ShowMsg("生成成功", true);
                                this.BindOrders();
                                return;
                            }
                            this.ShowMsg("发货失败", false);
                            this.ShowMsg("生成成功", true);
                        }
                    }
                }
            }
        }
Beispiel #7
0
        private void ConfirmPayOrder(HttpContext context)
        {
            SiteSettings currentSiteSetting = base.CurrentSiteSetting;
            string       text = context.Request.Form["orderId"];

            if (string.IsNullOrWhiteSpace(text))
            {
                throw new HidistroAshxException("异常的参数:订单编号");
            }
            OrderInfo orderInfo = OrderHelper.GetOrderInfo(text);

            if (orderInfo == null)
            {
                throw new HidistroAshxException("异常的参数:订单编号");
            }
            if (!orderInfo.CheckAction(OrderActions.SELLER_CONFIRM_PAY))
            {
                return;
            }
            PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode("hishop.plugins.payment.bankrequest");

            if (paymentMode != null)
            {
                orderInfo.Gateway       = paymentMode.Gateway;
                orderInfo.PaymentType   = paymentMode.Name;
                orderInfo.PaymentTypeId = paymentMode.ModeId;
            }
            else
            {
                orderInfo.Gateway       = "hishop.plugins.payment.bankrequest";
                orderInfo.PaymentType   = "线下支付";
                orderInfo.PaymentTypeId = 0;
            }
            orderInfo.IsStoreCollect = true;
            int num  = 0;
            int num2 = 0;
            int num3 = 0;

            if (orderInfo.CountDownBuyId > 0)
            {
                string empty = string.Empty;
                foreach (KeyValuePair <string, LineItemInfo> lineItem in orderInfo.LineItems)
                {
                    CountDownInfo countDownInfo = TradeHelper.CheckUserCountDown(lineItem.Value.ProductId, orderInfo.CountDownBuyId, lineItem.Value.SkuId, HiContext.Current.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, out empty, orderInfo.StoreId);
                    if (countDownInfo == null)
                    {
                        throw new HidistroAshxException(empty);
                    }
                }
            }
            if (orderInfo.GroupBuyId > 0)
            {
                GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy(orderInfo.GroupBuyId);
                if (groupBuy == null || groupBuy.Status != GroupBuyStatus.UnderWay)
                {
                    throw new HidistroAshxException("当前的订单为团购订单,此团购活动已结束,所以不能支付");
                }
                num2 = PromoteHelper.GetOrderCount(orderInfo.GroupBuyId);
                num  = groupBuy.MaxCount;
                num3 = orderInfo.GetGroupBuyOerderNumber();
                if (num < num2 + num3)
                {
                    throw new HidistroAshxException("当前的订单为团购订单,订购数量已超过订购总数,所以不能支付");
                }
            }
            if (orderInfo.PreSaleId > 0)
            {
                ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId);
                if (productPreSaleInfo == null)
                {
                    throw new HidistroAshxException("预售活动不存在");
                }
                if (!orderInfo.DepositDate.HasValue && productPreSaleInfo.PreSaleEndDate < DateTime.Now)
                {
                    throw new HidistroAshxException("预售活动已结束不能支付定金,所以不能确认收款");
                }
            }
            if (OrderHelper.ConfirmPay(orderInfo))
            {
                if (orderInfo.GroupBuyId > 0 && num == num2 + num3)
                {
                    PromoteHelper.SetGroupBuyEndUntreated(orderInfo.GroupBuyId);
                }
                if (orderInfo.ParentOrderId == "-1")
                {
                    OrderQuery orderQuery = new OrderQuery();
                    orderQuery.ParentOrderId = orderInfo.OrderId;
                    IList <OrderInfo> listUserOrder = MemberProcessor.GetListUserOrder(orderInfo.UserId, orderQuery);
                    foreach (OrderInfo item in listUserOrder)
                    {
                        OrderHelper.OrderConfirmPaySendMessage(item);
                    }
                }
                else
                {
                    OrderHelper.OrderConfirmPaySendMessage(orderInfo);
                }
                base.ReturnResult(context, true, "成功的确认了订单收款", 0, true);
                return;
            }
            throw new HidistroAshxException("确认订单收款失败");
        }
Beispiel #8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     this.productId = this.Page.Request["productId"].ToInt(0);
     if (!string.IsNullOrEmpty(base.Request["isCallback"]) && base.Request["isCallback"] == "true")
     {
         if (int.TryParse(base.Request["productId"], out this.productId))
         {
             string priceByProductId = PromoteHelper.GetPriceByProductId(this.productId);
             if (priceByProductId.Length > 0)
             {
                 base.Response.Clear();
                 base.Response.ContentType = "application/json";
                 base.Response.Write("{ ");
                 base.Response.Write("\"Status\":\"OK\",");
                 base.Response.Write(string.Format("\"Price\":\"{0}\"", decimal.Parse(priceByProductId).F2ToString("f2")));
                 base.Response.Write("}");
                 base.Response.End();
             }
         }
     }
     else if (!int.TryParse(base.Request.QueryString["groupBuyId"], out this.groupBuyId))
     {
         base.GotoResourceNotFound();
     }
     else
     {
         this.hfGroupId.Value          = base.Request.QueryString["groupBuyId"].ToString();
         this.btnUpdateGroupBuy.Click += this.btnUpdateGroupBuy_Click;
         this.btnFail.Click           += this.btnFail_Click;
         this.btnSuccess.Click        += this.btnSuccess_Click;
         this.btnFinish.Click         += this.btnFinish_Click;
         this.BindProduct();
         this.SetDateControl();
         if (!base.IsPostBack)
         {
             GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy(this.groupBuyId);
             if (PromoteHelper.GetOrderCount(this.groupBuyId) > 0)
             {
                 this.selectProductA.Disabled = true;
             }
             if (groupBuy == null)
             {
                 base.GotoResourceNotFound();
             }
             else
             {
                 if (groupBuy.Status == GroupBuyStatus.EndUntreated)
                 {
                     this.btnFail.Visible           = true;
                     this.btnSuccess.Visible        = true;
                     this.selectProductA.Disabled   = true;
                     this.calendarStartDate.Enabled = false;
                     this.calendarEndDate.Enabled   = false;
                     this.txtNeedPrice.Enabled      = false;
                     this.txtMaxCount.Enabled       = false;
                     this.txtCount.Enabled          = false;
                     this.txtPrice.Enabled          = false;
                     this.txtContent.Enabled        = false;
                     this.btnUpdateGroupBuy.Enabled = false;
                 }
                 if (groupBuy.Status == GroupBuyStatus.UnderWay)
                 {
                     this.selectProductA.Disabled = true;
                     this.btnFinish.Visible       = true;
                 }
                 this.LoadGroupBuy(groupBuy);
             }
         }
     }
 }
Beispiel #9
0
        protected void dlstOrders_ItemCommand(object sender, System.Web.UI.WebControls.DataListCommandEventArgs e)
        {
            OrderInfo orderInfo = OrderHelper.GetOrderInfo(e.CommandArgument.ToString());

            if (orderInfo != null)
            {
                if (e.CommandName == "CONFIRM_PAY" && orderInfo.CheckAction(OrderActions.SELLER_CONFIRM_PAY))
                {
                    int num  = 0;
                    int num2 = 0;
                    int num3 = 0;
                    if (orderInfo.CountDownBuyId > 0)
                    {
                        CountDownInfo countDownBuy = TradeHelper.GetCountDownBuy(orderInfo.CountDownBuyId);
                        if (countDownBuy == null || countDownBuy.EndDate < System.DateTime.Now)
                        {
                            this.ShowMsg("当前的订单为限时抢购订单,此活动已结束,所以不能支付", false);
                            return;
                        }
                    }
                    if (orderInfo.GroupBuyId > 0)
                    {
                        GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy(orderInfo.GroupBuyId);
                        if (groupBuy != null)
                        {
                            if (groupBuy.Status == GroupBuyStatus.UnderWay)
                            {
                                num2 = PromoteHelper.GetOrderCount(orderInfo.GroupBuyId);
                                num  = groupBuy.MaxCount;
                                num3 = orderInfo.GetGroupBuyOerderNumber();
                                if (num < num2 + num3)
                                {
                                    this.ShowMsg("当前的订单为团购订单,订购数量已超过订购总数,所以不能支付", false);
                                    return;
                                }
                                goto IL_D9;
                            }
                        }
                        this.ShowMsg("当前的订单为团购订单,此团购活动已结束,所以不能支付", false);
                        return;
                    }
IL_D9:
                    if (OrderHelper.ConfirmPay(orderInfo))
                    {
                        if (orderInfo.GroupBuyId > 0 && num == num2 + num3)
                        {
                            PromoteHelper.SetGroupBuyEndUntreated(orderInfo.GroupBuyId);
                        }
                        this.BindOrders();
                        int num4 = orderInfo.UserId;
                        if (num4 == 1100)
                        {
                            num4 = 0;
                        }
                        Hidistro.Membership.Core.IUser user = Hidistro.Membership.Context.Users.GetUser(num4);
                        Messenger.OrderPayment(user, orderInfo.OrderId, orderInfo.GetTotal());
                        orderInfo.OnPayment();
                        this.ShowMsg("成功的确认了订单收款", true);
                        return;
                    }
                    this.ShowMsg("确认订单收款失败", false);
                    return;
                }
                else
                {
                    if (e.CommandName == "FINISH_TRADE" && orderInfo.CheckAction(OrderActions.SELLER_FINISH_TRADE))
                    {
                        if (OrderHelper.ConfirmOrderFinish(orderInfo))
                        {
                            this.BindOrders();
                            this.ShowMsg("成功的完成了该订单", true);
                            return;
                        }
                        this.ShowMsg("完成订单失败", false);
                    }
                }
            }
        }