Exemple #1
0
        private void FinishTrade(HttpContext context)
        {
            SiteSettings currentSiteSetting = base.CurrentSiteSetting;
            string       text = context.Request.Form["id"];

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

            if (orderInfo == null)
            {
                throw new HidistroAshxException("异常的参数:订单编号");
            }
            if (!orderInfo.CheckAction(OrderActions.SELLER_FINISH_TRADE))
            {
                return;
            }
            if (OrderHelper.ConfirmOrderFinish(orderInfo))
            {
                base.ReturnResult(context, true, "成功的完成了该订单", 0, true);
                return;
            }
            throw new HidistroAshxException("完成订单失败");
        }
        protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            bool      flag      = false;
            OrderInfo orderInfo = OrderHelper.GetOrderInfo(e.CommandArgument.ToString());

            if (orderInfo != null)
            {
                if ((e.CommandName == "CONFIRM_PAY") && orderInfo.CheckAction(OrderActions.SELLER_CONFIRM_PAY))
                {
                    if (orderInfo.GroupBuyId <= 0)
                    {
                    }
                }
                else if ((e.CommandName == "FINISH_TRADE") && orderInfo.CheckAction(OrderActions.SELLER_FINISH_TRADE))
                {
                    Dictionary <string, LineItemInfo> lineItems = orderInfo.LineItems;
                    LineItemInfo info2 = new LineItemInfo();
                    foreach (KeyValuePair <string, LineItemInfo> pair in lineItems)
                    {
                        info2 = pair.Value;
                        if ((info2.OrderItemsStatus == OrderStatus.ApplyForRefund) || (info2.OrderItemsStatus == OrderStatus.ApplyForReturns))
                        {
                            flag = true;
                            break;
                        }
                    }
                    if (!flag)
                    {
                        if (OrderHelper.ConfirmOrderFinish(orderInfo))
                        {
                            this.BindOrders();
                            this.myNotifier.updateAction = UpdateAction.OrderUpdate;
                            this.myNotifier.actionDesc   = "订单已完成";
                            if (orderInfo.PayDate.HasValue)
                            {
                                this.myNotifier.RecDateUpdate = orderInfo.PayDate.Value;
                            }
                            else
                            {
                                this.myNotifier.RecDateUpdate = DateTime.Today;
                            }
                            this.myNotifier.DataUpdated += new StatisticNotifier.DataUpdatedEventHandler(this.myEvent.Update);
                            this.myNotifier.UpdateDB();
                            this.ShowMsg("订单确认收货成功!", true);
                        }
                        else
                        {
                            this.ShowMsg("完成订单失败", false);
                        }
                    }
                    else
                    {
                        this.ShowMsg("订单中商品有退货(款)不允许完成!", false);
                    }
                }
            }
        }
Exemple #3
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 num2       = 0;
                    int num3       = 0;
                    int groupBuyId = orderInfo.GroupBuyId;
                    if (OrderHelper.ConfirmPay(orderInfo))
                    {
                        DebitNoteInfo info2 = new DebitNoteInfo();

                        info2.NoteId   = Globals.GetGenerateId();
                        info2.OrderId  = e.CommandArgument.ToString();
                        info2.Operator = ManagerHelper.GetCurrentManager().UserName;
                        info2.Remark   = "后台" + info2.Operator + "收款成功";

                        OrderHelper.SaveDebitNote(info2);
                        if (orderInfo.GroupBuyId > 0)
                        {
                            int num4 = num2 + num3;
                        }
                        this.BindOrders();
                        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))
                    {
                        MemberProcessor.RemoveUserCache(orderInfo.UserId);
                        this.BindOrders();
                        DistributorsBrower.UpdateCalculationCommission(orderInfo);
                        this.ShowMsg("成功的完成了该订单", true);
                    }
                    else
                    {
                        this.ShowMsg("完成订单失败", false);
                    }
                }
            }
        }
        protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            bool      flag      = false;
            OrderInfo orderInfo = OrderHelper.GetOrderInfo(e.CommandArgument.ToString());

            if (orderInfo != null)
            {
                if ((e.CommandName == "CONFIRM_PAY") && orderInfo.CheckAction(OrderActions.SELLER_CONFIRM_PAY))
                {
                    int num2       = 0;
                    int num3       = 0;
                    int groupBuyId = orderInfo.GroupBuyId;
                    if (OrderHelper.ConfirmPay(orderInfo))
                    {
                        DebitNoteInfo info2 = new DebitNoteInfo();
                        info2.NoteId   = Globals.GetGenerateId();
                        info2.OrderId  = e.CommandArgument.ToString();
                        info2.Operator = ManagerHelper.GetCurrentManager().UserName;
                        info2.Remark   = "后台" + info2.Operator + "收款成功";
                        OrderHelper.SaveDebitNote(info2);
                        if (orderInfo.GroupBuyId > 0)
                        {
                            int num4 = num2 + num3;
                        }
                        this.BindOrders();
                        orderInfo.OnPayment();
                        this.ShowMsg("成功的确认了订单收款", true);
                    }
                    else
                    {
                        this.ShowMsg("确认订单收款失败", false);
                    }
                }
                else if ((e.CommandName == "FINISH_TRADE") && orderInfo.CheckAction(OrderActions.SELLER_FINISH_TRADE))
                {
                    Dictionary <string, LineItemInfo> lineItems = orderInfo.LineItems;
                    LineItemInfo info3 = new LineItemInfo();
                    foreach (KeyValuePair <string, LineItemInfo> pair in lineItems)
                    {
                        info3 = pair.Value;
                        if ((info3.OrderItemsStatus == OrderStatus.ApplyForRefund) || (info3.OrderItemsStatus == OrderStatus.ApplyForReturns))
                        {
                            flag = true;
                        }
                    }
                    if (!flag)
                    {
                        if (OrderHelper.ConfirmOrderFinish(orderInfo))
                        {
                            this.BindOrders();
                            DistributorsBrower.UpdateCalculationCommission(orderInfo, wid);
                            foreach (LineItemInfo info4 in orderInfo.LineItems.Values)
                            {
                                if (info4.OrderItemsStatus.ToString() == OrderStatus.SellerAlreadySent.ToString())
                                {
                                    RefundHelper.UpdateOrderGoodStatu(orderInfo.OrderId, info4.SkuId, 5);
                                }
                            }
                            this.ShowMsg("成功的完成了该订单", true);
                        }
                        else
                        {
                            this.ShowMsg("完成订单失败", false);
                        }
                    }
                    else
                    {
                        this.ShowMsg("订单中商品有退货(款)不允许完成!", false);
                    }
                }
            }
        }
        protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            bool      flag      = false;
            OrderInfo orderInfo = OrderHelper.GetOrderInfo(e.CommandArgument.ToString());

            if (orderInfo != null)
            {
                if ((e.CommandName == "CONFIRM_PAY") && orderInfo.CheckAction(OrderActions.SELLER_CONFIRM_PAY))
                {
                    int num2       = 0;
                    int num3       = 0;
                    int groupBuyId = orderInfo.GroupBuyId;
                    if (OrderHelper.ConfirmPay(orderInfo))
                    {
                        DebitNoteInfo info2 = new DebitNoteInfo();
                        info2 = new DebitNoteInfo
                        {
                            NoteId   = Globals.GetGenerateId(),
                            OrderId  = e.CommandArgument.ToString(),
                            Operator = ManagerHelper.GetCurrentManager().UserName,
                            Remark   = "后台" + info2.Operator + "收款成功"
                        };
                        OrderHelper.SaveDebitNote(info2);
                        if (orderInfo.GroupBuyId > 0)
                        {
                            int num4 = num2 + num3;
                        }
                        this.BindOrders();
                        orderInfo.OnPayment();
                        this.ShowMsg("成功的确认了订单收款", true);
                    }
                    else
                    {
                        this.ShowMsg("确认订单收款失败", false);
                    }
                }
                else if ((e.CommandName == "FINISH_TRADE") && orderInfo.CheckAction(OrderActions.SELLER_FINISH_TRADE))
                {
                    Dictionary <string, LineItemInfo> lineItems = orderInfo.LineItems;
                    LineItemInfo info3 = new LineItemInfo();
                    foreach (KeyValuePair <string, LineItemInfo> pair in lineItems)
                    {
                        info3 = pair.Value;
                        if ((info3.OrderItemsStatus == OrderStatus.ApplyForRefund) || (info3.OrderItemsStatus == OrderStatus.ApplyForReturns))
                        {
                            flag = true;
                        }
                    }
                    if (!flag)
                    {
                        if (OrderHelper.ConfirmOrderFinish(orderInfo))
                        {
                            this.BindOrders();
                            this.myNotifier.updateAction = UpdateAction.OrderUpdate;
                            this.myNotifier.actionDesc   = "订单已完成";
                            if (orderInfo.PayDate.HasValue)
                            {
                                this.myNotifier.RecDateUpdate = orderInfo.PayDate.Value;
                            }
                            else
                            {
                                this.myNotifier.RecDateUpdate = DateTime.Today;
                            }
                            this.myNotifier.DataUpdated += new StatisticNotifier.DataUpdatedEventHandler(this.myEvent.Update);
                            this.myNotifier.UpdateDB();
                            this.ShowMsg("成功的完成了该订单", true);
                        }
                        else
                        {
                            this.ShowMsg("完成订单失败", false);
                        }
                    }
                    else
                    {
                        this.ShowMsg("订单中商品有退货(款)不允许完成!", false);
                    }
                }
            }
        }
Exemple #6
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);
                    }
                }
            }
        }
Exemple #8
0
        protected void rptList_ItemCommand(object source, System.Web.UI.WebControls.RepeaterCommandEventArgs e)
        {
            bool      flag      = false;
            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 arg_49_0 = orderInfo.GroupBuyId;
                    if (OrderHelper.ConfirmPay(orderInfo))
                    {
                        DebitNoteInfo debitNoteInfo = new DebitNoteInfo();
                        debitNoteInfo.NoteId   = Globals.GetGenerateId();
                        debitNoteInfo.OrderId  = e.CommandArgument.ToString();
                        debitNoteInfo.Operator = ManagerHelper.GetCurrentManager().UserName;
                        debitNoteInfo.Remark   = "后台" + debitNoteInfo.Operator + "收款成功";
                        OrderHelper.SaveDebitNote(debitNoteInfo);
                        if (orderInfo.GroupBuyId > 0)
                        {
                            int arg_BE_0 = num + num2;
                        }
                        this.BindOrders();
                        orderInfo.OnPayment();
                        this.ShowMsg("成功的确认了订单收款", true);
                        return;
                    }
                    this.ShowMsg("确认订单收款失败", false);
                    return;
                }
                else if (e.CommandName == "FINISH_TRADE" && orderInfo.CheckAction(OrderActions.SELLER_FINISH_TRADE))
                {
                    System.Collections.Generic.Dictionary <string, LineItemInfo> lineItems = orderInfo.LineItems;
                    LineItemInfo lineItemInfo = new LineItemInfo();
                    foreach (System.Collections.Generic.KeyValuePair <string, LineItemInfo> current in lineItems)
                    {
                        lineItemInfo = current.Value;
                        if (lineItemInfo.OrderItemsStatus == OrderStatus.ApplyForRefund || lineItemInfo.OrderItemsStatus == OrderStatus.ApplyForReturns)
                        {
                            flag = true;
                        }
                    }
                    if (!flag)
                    {
                        if (OrderHelper.ConfirmOrderFinish(orderInfo))
                        {
                            this.BindOrders();
                            DistributorsBrower.UpdateCalculationCommission(orderInfo);
                            foreach (LineItemInfo current2 in orderInfo.LineItems.Values)
                            {
                                if (current2.OrderItemsStatus.ToString() == OrderStatus.SellerAlreadySent.ToString())
                                {
                                    RefundHelper.UpdateOrderGoodStatu(orderInfo.OrderId, current2.SkuId, 5, current2.ID);
                                }
                            }
                            this.ShowMsg("成功的完成了该订单", true);
                            return;
                        }
                        this.ShowMsg("完成订单失败", false);
                        return;
                    }
                    else
                    {
                        this.ShowMsg("订单中商品有退货(款)不允许完成!", false);
                    }
                }
            }
        }
Exemple #9
0
        protected void btnSelOrdersFinish_Click(object sender, System.EventArgs e)
        {
            bool   flag = false;
            string text = "";

            if (!string.IsNullOrEmpty(base.Request["CheckBoxGroup"]))
            {
                text = base.Request["CheckBoxGroup"];
            }
            if (text.Length <= 0)
            {
                this.ShowMsg("请先选择要批量确认收货的订单", false);
                return;
            }
            string[] array = text.Trim(new char[]
            {
                ','
            }).Split(new char[]
            {
                ','
            });
            int num  = 0;
            int num2 = 0;

            string[] array2 = array;
            for (int i = 0; i < array2.Length; i++)
            {
                string text2 = array2[i];
                if (!string.IsNullOrEmpty(text2))
                {
                    OrderInfo orderInfo = OrderHelper.GetOrderInfo(text2);
                    if (orderInfo != null)
                    {
                        System.Collections.Generic.Dictionary <string, LineItemInfo> lineItems = orderInfo.LineItems;
                        LineItemInfo lineItemInfo = new LineItemInfo();
                        foreach (System.Collections.Generic.KeyValuePair <string, LineItemInfo> current in lineItems)
                        {
                            lineItemInfo = current.Value;
                            if (lineItemInfo.OrderItemsStatus == OrderStatus.ApplyForRefund || lineItemInfo.OrderItemsStatus == OrderStatus.ApplyForReturns)
                            {
                                flag = true;
                                break;
                            }
                        }
                        if (!flag)
                        {
                            if (OrderHelper.ConfirmOrderFinish(orderInfo))
                            {
                                num++;
                                DistributorsBrower.UpdateCalculationCommission(orderInfo);
                                foreach (LineItemInfo current2 in orderInfo.LineItems.Values)
                                {
                                    if (current2.OrderItemsStatus.ToString() == OrderStatus.SellerAlreadySent.ToString())
                                    {
                                        RefundHelper.UpdateOrderGoodStatu(orderInfo.OrderId, current2.SkuId, 5, current2.ID);
                                    }
                                }
                                this.myNotifier.updateAction = UpdateAction.OrderUpdate;
                                this.myNotifier.actionDesc   = "订单已完成";
                                if (orderInfo.PayDate.HasValue)
                                {
                                    this.myNotifier.RecDateUpdate = orderInfo.PayDate.Value;
                                }
                                else
                                {
                                    this.myNotifier.RecDateUpdate = System.DateTime.Today;
                                }
                                this.myNotifier.DataUpdated += new StatisticNotifier.DataUpdatedEventHandler(this.myEvent.Update);
                                this.myNotifier.UpdateDB();
                            }
                        }
                        else
                        {
                            num2++;
                        }
                    }
                }
                flag = false;
            }
            if (num > 0)
            {
                string text3 = "批量确认收货了" + num.ToString() + "个订单";
                if (num2 > 0)
                {
                    text3 = text3 + "," + num2.ToString() + "个订单中有退货(款)未完成";
                }
                this.ShowMsg(text3, true);
            }
            else
            {
                this.ShowMsg("订单中商品有退货(款)不允许完成!", false);
            }
            this.BindOrders();
        }
        protected void btnSelOrdersFinish_Click(object sender, EventArgs e)
        {
            bool   flag = false;
            string str  = "";

            if (!string.IsNullOrEmpty(base.Request["CheckBoxGroup"]))
            {
                str = base.Request["CheckBoxGroup"];
            }
            if (str.Length <= 0)
            {
                this.ShowMsg("请先选择要批量确认收货的订单", false);
            }
            else
            {
                string[] strArray = str.Trim(new char[] { ',' }).Split(new char[] { ',' });
                int      num      = 0;
                int      num2     = 0;
                foreach (string str2 in strArray)
                {
                    if (!string.IsNullOrEmpty(str2))
                    {
                        OrderInfo orderInfo = OrderHelper.GetOrderInfo(str2);
                        if (orderInfo != null)
                        {
                            Dictionary <string, LineItemInfo> lineItems = orderInfo.LineItems;
                            LineItemInfo info2 = new LineItemInfo();
                            foreach (KeyValuePair <string, LineItemInfo> pair in lineItems)
                            {
                                info2 = pair.Value;
                                if ((info2.OrderItemsStatus == OrderStatus.ApplyForRefund) || (info2.OrderItemsStatus == OrderStatus.ApplyForReturns))
                                {
                                    flag = true;
                                    break;
                                }
                            }
                            if (!flag)
                            {
                                if (OrderHelper.ConfirmOrderFinish(orderInfo))
                                {
                                    num++;
                                    this.myNotifier.updateAction = UpdateAction.OrderUpdate;
                                    this.myNotifier.actionDesc   = "订单已完成";
                                    if (orderInfo.PayDate.HasValue)
                                    {
                                        this.myNotifier.RecDateUpdate = orderInfo.PayDate.Value;
                                    }
                                    else
                                    {
                                        this.myNotifier.RecDateUpdate = DateTime.Today;
                                    }
                                    this.myNotifier.DataUpdated += new StatisticNotifier.DataUpdatedEventHandler(this.myEvent.Update);
                                    this.myNotifier.UpdateDB();
                                }
                            }
                            else
                            {
                                num2++;
                            }
                        }
                    }
                    flag = false;
                }
                if (num > 0)
                {
                    string msg = "批量确认收货了" + num.ToString() + "个订单";
                    if (num2 > 0)
                    {
                        msg = msg + "," + num2.ToString() + "个订单中有退货(款)未完成";
                    }
                    this.ShowMsg(msg, true);
                }
                else
                {
                    this.ShowMsg("订单中商品有退货(款)不允许完成!", false);
                }
                this.BindOrders();
            }
        }
Exemple #11
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);
                        }
                    }
                }
            }
        }
Exemple #12
0
        protected void rptList_ItemCommand(object source, System.Web.UI.WebControls.RepeaterCommandEventArgs e)
        {
            bool      flag      = false;
            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 arg_49_0 = orderInfo.GroupBuyId;
                    if (OrderHelper.ConfirmPay(orderInfo))
                    {
                        DebitNoteInfo debitNoteInfo = new DebitNoteInfo();
                        debitNoteInfo.NoteId   = Globals.GetGenerateId();
                        debitNoteInfo.OrderId  = e.CommandArgument.ToString();
                        debitNoteInfo.Operator = ManagerHelper.GetCurrentManager().UserName;
                        debitNoteInfo.Remark   = "后台" + debitNoteInfo.Operator + "收款成功";
                        OrderHelper.SaveDebitNote(debitNoteInfo);
                        if (orderInfo.GroupBuyId > 0)
                        {
                            int arg_BE_0 = num + num2;
                        }
                        this.BindOrders();
                        orderInfo.OnPayment();
                        this.ShowMsg("成功的确认了订单收款", true);
                        return;
                    }
                    this.ShowMsg("确认订单收款失败", false);
                    return;
                }
                else if (e.CommandName == "FINISH_TRADE" && orderInfo.CheckAction(OrderActions.SELLER_FINISH_TRADE))
                {
                    System.Collections.Generic.Dictionary <string, LineItemInfo> lineItems = orderInfo.LineItems;
                    LineItemInfo lineItemInfo = new LineItemInfo();
                    foreach (System.Collections.Generic.KeyValuePair <string, LineItemInfo> current in lineItems)
                    {
                        lineItemInfo = current.Value;
                        if (lineItemInfo.OrderItemsStatus == OrderStatus.ApplyForRefund || lineItemInfo.OrderItemsStatus == OrderStatus.ApplyForReturns)
                        {
                            flag = true;
                        }
                    }
                    if (!flag)
                    {
                        if (OrderHelper.ConfirmOrderFinish(orderInfo))
                        {
                            this.BindOrders();
                            this.myNotifier.updateAction = UpdateAction.OrderUpdate;
                            this.myNotifier.actionDesc   = "订单已完成";
                            if (orderInfo.PayDate.HasValue)
                            {
                                this.myNotifier.RecDateUpdate = orderInfo.PayDate.Value;
                            }
                            else
                            {
                                this.myNotifier.RecDateUpdate = System.DateTime.Today;
                            }
                            this.myNotifier.DataUpdated += new StatisticNotifier.DataUpdatedEventHandler(this.myEvent.Update);
                            this.myNotifier.UpdateDB();
                            this.ShowMsg("成功的完成了该订单", true);
                            return;
                        }
                        this.ShowMsg("完成订单失败", false);
                        return;
                    }
                    else
                    {
                        this.ShowMsg("订单中商品有退货(款)不允许完成!", false);
                    }
                }
            }
        }
Exemple #13
0
        protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            bool      flag      = false;
            OrderInfo orderInfo = OrderHelper.GetOrderInfo(e.CommandArgument.ToString());

            if (orderInfo != null)
            {
                if ((e.CommandName == "CONFIRM_PAY") && orderInfo.CheckAction(OrderActions.SELLER_CONFIRM_PAY))
                {
                    int num2       = 0;
                    int num3       = 0;
                    int groupBuyId = orderInfo.GroupBuyId;
                    if (OrderHelper.ConfirmPay(orderInfo))
                    {
                        DebitNoteInfo info2;
                        info2 = new DebitNoteInfo
                        {
                            NoteId   = Globals.GetGenerateId(),
                            OrderId  = e.CommandArgument.ToString(),
                            Operator = ManagerHelper.GetCurrentManager().UserName,
                            Remark   = "后台" + ManagerHelper.GetCurrentManager().UserName + "收款成功"
                        };
                        OrderHelper.SaveDebitNote(info2);
                        if (orderInfo.GroupBuyId > 0)
                        {
                            int num6 = num2 + num3;
                        }
                        this.BindOrders();
                        orderInfo.OnPayment();
                        this.ShowMsg("成功的确认了订单收款", true);
                    }
                    else
                    {
                        this.ShowMsg("确认订单收款失败", false);
                    }
                }
                else if ((e.CommandName == "FINISH_TRADE") && orderInfo.CheckAction(OrderActions.SELLER_FINISH_TRADE))
                {
                    Dictionary <string, LineItemInfo> lineItems = orderInfo.LineItems;
                    LineItemInfo info3 = new LineItemInfo();
                    foreach (KeyValuePair <string, LineItemInfo> pair in lineItems)
                    {
                        info3 = pair.Value;
                        if ((info3.OrderItemsStatus == OrderStatus.ApplyForRefund) || (info3.OrderItemsStatus == OrderStatus.ApplyForReturns))
                        {
                            flag = true;
                        }
                    }
                    if (!flag)
                    {
                        if (OrderHelper.ConfirmOrderFinish(orderInfo))
                        {
                            this.BindOrders();
                            DistributorsBrower.UpdateCalculationCommission(orderInfo);
                            foreach (LineItemInfo info4 in orderInfo.LineItems.Values)
                            {
                                if (info4.OrderItemsStatus.ToString() == OrderStatus.SellerAlreadySent.ToString())
                                {
                                    RefundHelper.UpdateOrderGoodStatu(orderInfo.OrderId, info4.SkuId, 5);
                                }
                            }
                            this.myNotifier.updateAction = UpdateAction.OrderUpdate;
                            this.myNotifier.actionDesc   = "订单已完成";
                            if (orderInfo.PayDate.HasValue)
                            {
                                this.myNotifier.RecDateUpdate = orderInfo.PayDate.Value;
                            }
                            else
                            {
                                this.myNotifier.RecDateUpdate = DateTime.Today;
                            }
                            this.ShowMsg("成功的完成了该订单", true);
                        }
                        else
                        {
                            this.ShowMsg("完成订单失败", false);
                        }
                    }
                    else
                    {
                        this.ShowMsg("订单中商品有退货(款)不允许完成!", false);
                    }
                }
                else if (e.CommandName == "delete")
                {
                    string str  = e.CommandArgument.ToString();
                    int    num4 = OrderHelper.RealDeleteOrders("'" + str.Replace(",", "','") + "'");
                    this.BindOrders();
                    this.ShowMsg(string.Format("成功删除了{0}个订单", num4), true);
                }
                else if (e.CommandName == "restore")
                {
                    string str2 = e.CommandArgument.ToString();
                    int    num5 = OrderHelper.RestoreOrders("'" + str2.Replace(",", "','") + "'");
                    this.BindOrders();
                    this.ShowMsg(string.Format("成功还原了订单", num5), true);
                }
            }
        }
Exemple #14
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);
                    }
                }
            }
        }