Example #1
0
 private void btnConfirmPay_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(this.txtTradePassword.Text))
     {
         this.ShowMsg("请输入交易密码", false);
     }
     else
     {
         int num;
         int.TryParse(base.Request["PayMode"], out num);
         SubsiteStoreHelper.GetPaymentMode(num);
         if (((decimal)this.lblUseableBalance.Money) < ((decimal)this.lblTotalPrice.Money))
         {
             this.ShowMsg("您的预付款金额不足", false);
         }
         else
         {
             Distributor user = SubsiteStoreHelper.GetDistributor();
             if ((user.Balance - user.RequestBalance) < this.purchaseOrder.GetPurchaseTotal())
             {
                 this.ShowMsg("您的预付款金额不足", false);
             }
             else
             {
                 BalanceDetailInfo balance = new BalanceDetailInfo();
                 balance.UserId     = user.UserId;
                 balance.UserName   = user.Username;
                 balance.TradeType  = TradeTypes.Consume;
                 balance.TradeDate  = DateTime.Now;
                 balance.Expenses   = new decimal?(this.purchaseOrder.GetPurchaseTotal());
                 balance.Balance    = user.Balance - this.purchaseOrder.GetPurchaseTotal();
                 balance.Remark     = string.Format("采购单{0}的付款", this.purchaseOrder.PurchaseOrderId);
                 user.TradePassword = this.txtTradePassword.Text;
                 if (Users.ValidTradePassword(user))
                 {
                     if (!SubsiteSalesHelper.ConfirmPay(balance, this.purchaseOrder))
                     {
                         this.ShowMsg("付款失败", false);
                     }
                     else
                     {
                         PurchaseDebitNote note = new PurchaseDebitNote();
                         note.NoteId          = Globals.GetGenerateId();
                         note.PurchaseOrderId = this.purchaseOrderId;
                         note.Operator        = HiContext.Current.User.Username;
                         note.Remark          = "分销商采购单预付款支付成功";
                         SubsiteSalesHelper.SavePurchaseDebitNote(note);
                         this.ShowMsg("采购单预付款支付成功", true);
                     }
                 }
                 else
                 {
                     this.ShowMsg("交易密码错误", false);
                 }
             }
         }
     }
 }
Example #2
0
        private void btnConfirmPay_Click(object sender, System.EventArgs e)
        {
            if (string.IsNullOrEmpty(this.txtTradePassword.Text))
            {
                this.ShowMsg("请输入交易密码", false);
                return;
            }
            int modeId;

            int.TryParse(base.Request["PayMode"], out modeId);
            SubsiteStoreHelper.GetPaymentMode(modeId);
            if ((decimal)this.lblUseableBalance.Money < (decimal)this.lblTotalPrice.Money)
            {
                this.ShowMsg("您的预付款金额不足", false);
                return;
            }
            Hidistro.Membership.Context.Distributor distributor = SubsiteStoreHelper.GetDistributor();
            if (distributor.Balance - distributor.RequestBalance < this.purchaseOrder.GetPurchaseTotal())
            {
                this.ShowMsg("您的预付款金额不足", false);
                return;
            }
            BalanceDetailInfo balanceDetailInfo = new BalanceDetailInfo();

            balanceDetailInfo.UserId    = distributor.UserId;
            balanceDetailInfo.UserName  = distributor.Username;
            balanceDetailInfo.TradeType = TradeTypes.Consume;
            balanceDetailInfo.TradeDate = System.DateTime.Now;
            balanceDetailInfo.Expenses  = new decimal?(this.purchaseOrder.GetPurchaseTotal());
            balanceDetailInfo.Balance   = distributor.Balance - this.purchaseOrder.GetPurchaseTotal();
            balanceDetailInfo.Remark    = string.Format("采购单{0}的付款", this.purchaseOrder.PurchaseOrderId);
            distributor.TradePassword   = this.txtTradePassword.Text;
            if (!Hidistro.Membership.Context.Users.ValidTradePassword(distributor))
            {
                this.ShowMsg("交易密码错误", false);
                return;
            }
            if (!SubsiteSalesHelper.ConfirmPay(balanceDetailInfo, this.purchaseOrder))
            {
                this.ShowMsg("付款失败", false);
                return;
            }
            SubsiteSalesHelper.SavePurchaseDebitNote(new PurchaseDebitNote
            {
                NoteId          = Globals.GetGenerateId(),
                PurchaseOrderId = this.purchaseOrderId,
                Operator        = Hidistro.Membership.Context.HiContext.Current.User.Username,
                Remark          = "分销商采购单预付款支付成功"
            });
            this.ShowMsg("采购单预付款支付成功", true);
        }
Example #3
0
        private void btnConfirmPay_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtTradePassword.Text))
            {
                ShowMsg("请输入交易密码", false);
            }
            else if (((decimal)lblUseableBalance.Money) < ((decimal)lblTotalPrice.Money))
            {
                ShowMsg("您的预付款金额不足", false);
            }
            else
            {
                Distributor user = SubsiteStoreHelper.GetDistributor();

                if ((user.Balance - user.RequestBalance) < purchaseOrder.GetPurchaseTotal())
                {
                    ShowMsg("您的预付款金额不足", false);
                }
                else
                {
                    BalanceDetailInfo balance = new BalanceDetailInfo();

                    balance.UserId     = user.UserId;
                    balance.UserName   = user.Username;
                    balance.TradeType  = TradeTypes.Consume;
                    balance.TradeDate  = DateTime.Now;
                    balance.Expenses   = new decimal?(purchaseOrder.GetPurchaseTotal());
                    balance.Balance    = user.Balance - purchaseOrder.GetPurchaseTotal();
                    user.TradePassword = txtTradePassword.Text;

                    if (Users.ValidTradePassword(user))
                    {
                        if (!SubsiteSalesHelper.ConfirmPay(balance, purchaseOrder))
                        {
                            ShowMsg("付款失败", false);
                        }
                        else
                        {
                            PaySucceess.Visible = true;
                        }
                    }
                    else
                    {
                        ShowMsg("交易密码错误", false);
                    }
                }
            }
        }
Example #4
0
 private void UserPayOrder()
 {
     if (this.PurchaseOrder.PurchaseStatus == OrderStatus.BuyerAlreadyPaid)
     {
         this.ResponseStatus(true, "success");
         return;
     }
     if (this.PurchaseOrder.CheckAction(PurchaseOrderActions.DISTRIBUTOR_CONFIRM_PAY) && SubsiteSalesHelper.ConfirmPay(this.PurchaseOrder))
     {
         SubsiteSalesHelper.SavePurchaseDebitNote(new PurchaseDebitNote
         {
             NoteId          = Globals.GetGenerateId(),
             PurchaseOrderId = this.PurchaseOrder.PurchaseOrderId,
             Operator        = this.PurchaseOrder.Distributorname,
             Remark          = "分销商采购单在线支付成功"
         });
         this.ResponseStatus(true, "success");
     }
 }
Example #5
0
        private void dlstOrders_ItemCommand(object sender, System.Web.UI.WebControls.DataListCommandEventArgs e)
        {
            OrderInfo orderInfo = SubsiteSalesHelper.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 countDownInfo = SubsitePromoteHelper.GetCountDownInfo(orderInfo.CountDownBuyId);
                        if (countDownInfo == null || countDownInfo.EndDate < System.DateTime.Now)
                        {
                            this.ShowMsg("当前的订单为限时抢购订单,此活动已结束,所以不能支付", false);
                            return;
                        }
                    }
                    if (orderInfo.GroupBuyId > 0)
                    {
                        GroupBuyInfo groupBuy = SubsitePromoteHelper.GetGroupBuy(orderInfo.GroupBuyId);
                        if (groupBuy != null)
                        {
                            if (groupBuy.Status == GroupBuyStatus.UnderWay)
                            {
                                num2 = SubsitePromoteHelper.GetOrderCount(orderInfo.GroupBuyId);
                                num  = groupBuy.MaxCount;
                                num3 = orderInfo.GetGroupBuyOerderNumber();
                                if (num < num2 + num3)
                                {
                                    this.ShowMsg("当前的订单为团购订单,订购数量已超过订购总数,所以不能支付", false);
                                    return;
                                }
                                goto IL_DB;
                            }
                        }
                        this.ShowMsg("当前的订单为团购订单,此团购活动已结束,所以不能支付", false);
                        return;
                    }
IL_DB:
                    if (SubsiteSalesHelper.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 + "支付成功";
                        SubsiteSalesHelper.SaveDebitNote(debitNote);
                        if (orderInfo.GroupBuyId > 0 && num == num2 + num3)
                        {
                            SubsitePromoteHelper.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 (SubsiteSalesHelper.ConfirmOrderFinish(orderInfo))
                        {
                            this.BindOrders();
                            this.ShowMsg("成功的完成了该订单", true);
                            return;
                        }
                        this.ShowMsg("完成订单失败", false);
                        return;
                    }
                    else
                    {
                        if (e.CommandName == "CREATE_PURCHASEORDER" && orderInfo.CheckAction(OrderActions.SUBSITE_CREATE_PURCHASEORDER))
                        {
                            if (SubsiteSalesHelper.CreatePurchaseOrder(orderInfo))
                            {
                                this.BindOrders();
                                this.ShowMsg("生成采购单成功", true);
                                return;
                            }
                            this.ShowMsg(" 生成采购单失败", false);
                        }
                    }
                }
            }
        }
Example #6
0
        private void dlstOrders_ItemCommand(object sender, DataListCommandEventArgs e)
        {
            OrderInfo orderInfo = SubsiteSalesHelper.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 = SubsitePromoteHelper.GetGroupBuy(orderInfo.GroupBuyId);
                        if ((groupBuy == null) || (groupBuy.Status != GroupBuyStatus.UnderWay))
                        {
                            ShowMsg("当前的订单为团购订单,此团购活动已结束,所以不能支付", false);
                            return;
                        }
                        orderCount           = SubsitePromoteHelper.GetOrderCount(orderInfo.GroupBuyId);
                        maxCount             = groupBuy.MaxCount;
                        groupBuyOerderNumber = orderInfo.GetGroupBuyOerderNumber();
                        if (maxCount < (orderCount + groupBuyOerderNumber))
                        {
                            ShowMsg("当前的订单为团购订单,订购数量已超过订购总数,所以不能支付", false);
                            return;
                        }
                    }
                    if (SubsiteSalesHelper.ConfirmPay(orderInfo))
                    {
                        if ((orderInfo.GroupBuyId > 0) && (maxCount == (orderCount + groupBuyOerderNumber)))
                        {
                            SubsitePromoteHelper.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 (SubsiteSalesHelper.ConfirmOrderFinish(orderInfo))
                    {
                        BindOrders();
                        ShowMsg("成功的完成了该订单", true);
                    }
                    else
                    {
                        ShowMsg("完成订单失败", false);
                    }
                }
                else if ((e.CommandName == "CREATE_PURCHASEORDER") && orderInfo.CheckAction(OrderActions.SUBSITE_CREATE_PURCHASEORDER))
                {
                    if (SubsiteSalesHelper.CreatePurchaseOrder(orderInfo))
                    {
                        BindOrders();
                        ShowMsg("生成采购单成功", true);
                    }
                    else
                    {
                        ShowMsg(" 生成采购单失败", false);
                    }
                }
            }
        }
        private void dlstOrders_ItemCommand(object sender, DataListCommandEventArgs e)
        {
            OrderInfo orderInfo = SubsiteSalesHelper.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 countDownInfo = SubsitePromoteHelper.GetCountDownInfo(orderInfo.CountDownBuyId);
                        if ((countDownInfo == null) || (countDownInfo.EndDate < DateTime.Now))
                        {
                            this.ShowMsg("当前的订单为限时抢购订单,此活动已结束,所以不能支付", false);
                            return;
                        }
                    }
                    if (orderInfo.GroupBuyId > 0)
                    {
                        GroupBuyInfo groupBuy = SubsitePromoteHelper.GetGroupBuy(orderInfo.GroupBuyId);
                        if ((groupBuy == null) || (groupBuy.Status != GroupBuyStatus.UnderWay))
                        {
                            this.ShowMsg("当前的订单为团购订单,此团购活动已结束,所以不能支付", false);
                            return;
                        }
                        orderCount           = SubsitePromoteHelper.GetOrderCount(orderInfo.GroupBuyId);
                        maxCount             = groupBuy.MaxCount;
                        groupBuyOerderNumber = orderInfo.GetGroupBuyOerderNumber();
                        if (maxCount < (orderCount + groupBuyOerderNumber))
                        {
                            this.ShowMsg("当前的订单为团购订单,订购数量已超过订购总数,所以不能支付", false);
                            return;
                        }
                    }
                    if (SubsiteSalesHelper.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 + "支付成功";
                        SubsiteSalesHelper.SaveDebitNote(note);
                        if ((orderInfo.GroupBuyId > 0) && (maxCount == (orderCount + groupBuyOerderNumber)))
                        {
                            SubsitePromoteHelper.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 (SubsiteSalesHelper.ConfirmOrderFinish(orderInfo))
                    {
                        this.BindOrders();
                        this.ShowMsg("成功的完成了该订单", true);
                    }
                    else
                    {
                        this.ShowMsg("完成订单失败", false);
                    }
                }
                else if ((e.CommandName == "CREATE_PURCHASEORDER") && orderInfo.CheckAction(OrderActions.SUBSITE_CREATE_PURCHASEORDER))
                {
                    if (SubsiteSalesHelper.CreatePurchaseOrder(orderInfo))
                    {
                        this.BindOrders();
                        this.ShowMsg("生成采购单成功", true);
                    }
                    else
                    {
                        this.ShowMsg(" 生成采购单失败", false);
                    }
                }
            }
        }