Esempio n. 1
0
        private void btnOk_Click(object sender, System.EventArgs e)
        {
            if (!TradeHelper.CanRefund(this.hdorderId.Value))
            {
                this.ShowMessage("已有待确认的申请!", false);
                return;
            }
            if (!this.CanRefundBalance())
            {
                this.ShowMessage("请先开通预付款账户", false);
                return;
            }
            OrderInfo orderInfo = TradeHelper.GetOrderInfo(this.hdorderId.Value);
            //if (orderInfo.InClearance)
            //{
            //    this.ShowMessage("清关中,不支持退款", false);
            //    this.lkbtnApplyForReturn.Visible = true;
            //    this.lkbtnApplyForRefund.Visible = false;
            //    return;
            //}
            string reason = this.dropRefundReason.SelectedIndex == this.dropRefundReason.Items.Count - 1 ? this.txtRemark.Text : this.dropRefundReason.Text;

            string flagMsg = "";

            if (TradeHelper.ApplyForRefund(this.hdorderId.Value, reason, int.Parse(this.dropRefundType.SelectedValue), out flagMsg))
            {
                orderInfo = TradeHelper.GetOrderInfo(this.orderId);
                this.BindOrderBase(orderInfo);
                this.ShowMessage("成功的申请了退款", true);
                return;
            }
            this.ShowMessage("申请退款失败 " + flagMsg, false);
        }
Esempio n. 2
0
 private void btnOk_Click(object sender, System.EventArgs e)
 {
     if (!TradeHelper.CanRefund(this.hdorderId.Value))
     {
         this.ShowMessage("已有待确认的申请!", false);
     }
     else
     {
         if (!this.CanRefundBalance())
         {
             this.ShowMessage("请先开通预付款账户", false);
         }
         else
         {
             if (TradeHelper.ApplyForRefund(this.hdorderId.Value, this.txtRemark.Text, int.Parse(this.dropRefundType.SelectedValue)))
             {
                 this.BindOrders();
                 this.ShowMessage("成功的申请了退款", true);
             }
             else
             {
                 this.ShowMessage("申请退款失败", false);
             }
         }
     }
 }
Esempio n. 3
0
        public void Execute(XmlNode node)
        {
            try
            {
                Database  database         = DatabaseFactory.CreateDatabase();
                DbCommand sqlStringCommand = database.GetSqlStringCommand("SELECT o.OrderId, o.UserId, o.StoreId, o.FightGroupId, o.Gateway, o.GatewayOrderId,o.OrderStatus,o.BalanceAmount, o.OrderTotal,(SELECT SUM(Quantity) FROM Hishop_OrderItems WHERE OrderId = o.OrderId) AS Quantity,(SELECT Top 1 ItemDescription FROM Hishop_OrderItems WHERE OrderId = o.OrderId) as ItemDescription FROM Hishop_FightGroups fg INNER JOIN Hishop_Orders o ON fg.FightGroupId = o.FightGroupId AND fg.EndTime < getdate () AND fg.Status = @Status");
                database.AddInParameter(sqlStringCommand, "Status", DbType.Int32, 0);
                DataTable dataTable = null;
                using (IDataReader reader = database.ExecuteReader(sqlStringCommand))
                {
                    dataTable = DataHelper.ConverDataReaderToDataTable(reader);
                }
                if (dataTable != null && dataTable.Rows.Count > 0)
                {
                    foreach (DataRow row in dataTable.Rows)
                    {
                        int     refundType    = 3;
                        string  text          = row["Gateway"].ToNullString();
                        string  orderId       = row["OrderId"].ToNullString();
                        string  refundOrderId = row["GatewayOrderId"].ToNullString();
                        decimal refundAmount  = row["OrderTotal"].ToDecimal(0);
                        decimal d             = row["BalanceAmount"].ToDecimal(0);
                        if (d > decimal.Zero)
                        {
                            refundType = 1;
                        }
                        int value          = row["StoreId"].ToInt(0);
                        int num            = row["Quantity"].ToInt(0);
                        int fightGroupFail = row["FightGroupId"].ToInt(0);
                        int num2           = VShopHelper.SetFightGroupFail(fightGroupFail);
                        switch (row["OrderStatus"].ToInt(0))
                        {
                        case 1:
                            TradeHelper.CloseOrder(orderId, "火拼团订单成团时限内未付款");
                            break;

                        case 2:
                        {
                            if (text == "hishop.plugins.payment.advancerequest")
                            {
                                refundType = 1;
                            }
                            RefundInfo refundInfo = new RefundInfo();
                            refundInfo.OrderId       = orderId;
                            refundInfo.RefundReason  = "拼团失败,自动退款";
                            refundInfo.RefundGateWay = (string.IsNullOrEmpty(text) ? "" : text.ToLower().Replace(".payment.", ".refund."));
                            refundInfo.RefundType    = (RefundTypes)refundType;
                            refundInfo.RefundOrderId = refundOrderId;
                            refundInfo.StoreId       = value;
                            refundInfo.AdminRemark   = "拼团失败,自动退款";
                            refundInfo.ApplyForTime  = DateTime.Now;
                            refundInfo.UserRemark    = "";
                            refundInfo.RefundAmount  = refundAmount;
                            TradeHelper.ApplyForRefund(refundInfo);
                            MemberInfo user           = Users.GetUser((int)row["UserId"]);
                            string     productInfo    = row["ItemDescription"].ToString();
                            string     fightGroupInfo = string.Format("{0}人团{1}元", num2, ((decimal)row["OrderTotal"]).F2ToString("f2"));
                            Messenger.FightGroupOrderFail(user, productInfo, fightGroupInfo, orderId);
                            break;
                        }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Globals.WriteExceptionLog(ex, null, "FightGroupJob");
            }
        }
Esempio n. 4
0
        private void btnRefund_Click(object sender, EventArgs e)
        {
            string text = this.Page.Request.QueryString["returnUrl"].ToNullString();

            if (string.IsNullOrEmpty(text))
            {
                text = this.Page.Request.UrlReferrer.ToNullString();
                if (text == this.Page.Request.Url.ToString())
                {
                    text = "/User/UserOrders";
                }
            }
            string text2 = "";
            string text3 = "";
            string text4 = "";

            text2            = Globals.StripAllTags(this.txtBankName.Value);
            text3            = Globals.StripAllTags(this.txtBankAccountName.Value);
            text4            = Globals.StripAllTags(this.txtBankAccountNo.Value);
            this.iRefundType = this.hidRefundType.Value.ToInt(0);
            if (!Enum.IsDefined(typeof(RefundTypes), this.iRefundType))
            {
                this.ShowMessage("错误的退款方式", false, "", 1);
            }
            string enumDescription = EnumDescription.GetEnumDescription((Enum)(object)EnumPaymentType.AdvancePay, 1);

            if ((this.order.Gateway.ToLower() == enumDescription || this.order.DepositGatewayOrderId.ToNullString().ToLower() == enumDescription) && this.iRefundType != 1)
            {
                this.ShowMessage("预付款支付的订单只能退回到预付款帐号", false, "", 1);
            }
            else
            {
                if (this.order.FightGroupId > 0)
                {
                    FightGroupInfo fightGroup = VShopHelper.GetFightGroup(this.order.FightGroupId);
                    if (fightGroup != null && fightGroup.Status == FightGroupStatus.FightGroupIn)
                    {
                        this.ShowMessage("拼团过程中时,已完成支付的订单不能发起退款;", false, "", 1);
                        return;
                    }
                }
                if (!TradeHelper.CanRefund(this.order, ""))
                {
                    this.ShowMessage("当前订单不能进行退款操作!", false, "", 1);
                }
                else
                {
                    string userRemark = Globals.StripAllTags(this.txtRemark.Text.Trim());
                    if (this.iRefundType == 2 && (string.IsNullOrEmpty(text2) || string.IsNullOrEmpty(text3) || string.IsNullOrEmpty(text4)))
                    {
                        this.ShowMessage("您选择了银行退款,请在退款说明中输入退款的银行卡信息!", true, "", 1);
                    }
                    else if (!this.CanRefundBalance())
                    {
                        this.ShowMessage("请先开通预付款账户", false, "", 1);
                    }
                    else
                    {
                        string selectedValue = this.DropRefundReason.SelectedValue;
                        if (string.IsNullOrEmpty(selectedValue))
                        {
                            this.ShowMessage("请选择退款原因", true, "", 1);
                        }
                        string refundGateWay = string.IsNullOrEmpty(this.order.Gateway) ? "" : this.order.Gateway.ToLower().Replace(".payment.", ".refund.");
                        int    num           = 0;
                        num = this.order.GetAllQuantity(true);
                        GroupBuyInfo groupbuy = null;
                        if (this.order.GroupBuyId > 0)
                        {
                            groupbuy = ProductBrowser.GetGroupBuy(this.order.GroupBuyId);
                        }
                        decimal canRefundAmount = this.order.GetCanRefundAmount("", groupbuy, 0);
                        string  orderId         = this.order.OrderId;
                        if (this.RefundItem != null)
                        {
                            orderId = this.RefundItem.ItemDescription + this.RefundItem.SKUContent;
                            num     = this.RefundItem.ShipmentQuantity;
                        }
                        string     generateId = Globals.GetGenerateId();
                        RefundInfo refundInfo = new RefundInfo();
                        refundInfo.OrderId         = this.order.OrderId;
                        refundInfo.UserRemark      = userRemark;
                        refundInfo.RefundGateWay   = refundGateWay;
                        refundInfo.RefundOrderId   = generateId;
                        refundInfo.BankName        = text2;
                        refundInfo.BankAccountNo   = text4;
                        refundInfo.BankAccountName = text3;
                        refundInfo.ApplyForTime    = DateTime.Now;
                        refundInfo.StoreId         = this.order.StoreId;
                        refundInfo.RefundReason    = selectedValue;
                        refundInfo.RefundType      = (RefundTypes)this.iRefundType;
                        refundInfo.RefundAmount    = canRefundAmount;
                        if (TradeHelper.ApplyForRefund(refundInfo))
                        {
                            if (this.order.StoreId > 0)
                            {
                                VShopHelper.AppPsuhRecordForStore(this.order.StoreId, this.OrderId, "", EnumPushStoreAction.StoreOrderRefundApply);
                            }
                            this.ShowMessage("成功的申请了退款", true, text, 2);
                        }
                        else
                        {
                            this.ShowMessage("申请退款失败", false, "", 1);
                        }
                    }
                }
            }
        }