Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.btnAcceptRefund.Click += this.btnAcceptRefund_Click;
            this.btnRefuseRefund.Click += this.btnRefuseRefund_Click;
            int refundId = this.Page.Request["RefundId"].ToInt(0);

            this.refund     = TradeHelper.GetRefundInfo(refundId);
            this.RefundData = this.refund;
            if (this.refund == null)
            {
                this.ShowMsg("退款信息错误!", false);
            }
            else
            {
                this.order = TradeHelper.GetOrderInfo(this.refund.OrderId);
                if (this.order == null)
                {
                    this.ShowMsg("错误的订单信息!", false);
                }
                else if (!this.Page.IsPostBack)
                {
                    this.bindRefundInfo();
                }
            }
        }
        private void JudgeOrderStatus(OrderInfo order)
        {
            this.lkbtnConfirmOrder.Visible = (order.OrderStatus == OrderStatus.SellerAlreadySent && order.ItemStatus == OrderItemStatus.Nomarl);
            if (order.PreSaleId > 0)
            {
                if (order.OrderStatus == OrderStatus.WaitBuyerPay && order.ItemStatus == OrderItemStatus.Nomarl && !order.DepositDate.HasValue)
                {
                    this.lkbtnCloseOrder.Visible = true;
                }
                else
                {
                    this.lkbtnCloseOrder.Visible = false;
                }
            }
            else
            {
                this.lkbtnCloseOrder.Visible = (order.OrderStatus == OrderStatus.WaitBuyerPay && order.ItemStatus == OrderItemStatus.Nomarl);
            }
            RefundInfo   refundInfo     = TradeHelper.GetRefundInfo(order.OrderId);
            ReturnInfo   returnInfo     = TradeHelper.GetReturnInfo(order.OrderId, "");
            ReplaceInfo  replaceInfo    = TradeHelper.GetReplaceInfo(order.OrderId, "");
            DateTime     finishDate     = order.FinishDate;
            OrderStatus  orderStatus    = order.OrderStatus;
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();
            HtmlAnchor   htmlAnchor     = this.lkbtnApplyForRefund;
            int          visible;

            if (order.GetTotal(false) > decimal.Zero && !TradeHelper.OrderHasRefundOrReturning(order))
            {
                if ((refundInfo == null || refundInfo.HandleStatus == RefundStatus.Refused) && returnInfo == null && replaceInfo == null)
                {
                    visible = ((order.OrderStatus == OrderStatus.BuyerAlreadyPaid && order.ItemStatus == OrderItemStatus.Nomarl) ? 1 : 0);
                    goto IL_0136;
                }
                visible = 0;
            }
            else
            {
                visible = 0;
            }
            goto IL_0136;
IL_0136:
            htmlAnchor.Visible = ((byte)visible != 0);
            this.lkbtnApplyForRefund.Attributes.Add("orderId", this.orderId);
            if (!masterSettings.OpenMultStore && masterSettings.IsOpenPickeupInStore && order.SupplierId == 0 && order.ShippingModeId == -2)
            {
                this.litGetGoodsRemark.Text = masterSettings.PickeupInStoreRemark;
            }
            else
            {
                this.divPickUpRemark.Visible = false;
            }
        }
Example #3
0
 public void GetRefundInfo(HttpContext context)
 {
     if (!this.CheckUserRole())
     {
         this.ShowMessage_New(context, "请先登录会员!", true);
     }
     else
     {
         int num = 0;
         if (context.Request["RefundId"] != null)
         {
             int.TryParse(context.Request["refundId"], out num);
         }
         string text = "";
         text = context.Request["orderId"];
         RefundInfo refundInfo = null;
         if (num > 0)
         {
             refundInfo = TradeHelper.GetRefundInfo(num);
         }
         if (refundInfo == null && !string.IsNullOrEmpty(text))
         {
             refundInfo = TradeHelper.GetRefundInfo(text);
         }
         if (refundInfo == null)
         {
             this.ShowMessage_New(context, "参数不正确", true);
         }
         else
         {
             string s = JsonConvert.SerializeObject(new
             {
                 Result = new
                 {
                     success = "true",
                     Refund  = new
                     {
                         RefundId      = refundInfo.RefundId,
                         OrderId       = refundInfo.OrderId,
                         RefundAmount  = refundInfo.RefundAmount.F2ToString("f2"),
                         RefundOrderId = refundInfo.RefundOrderId,
                         RefundType    = (int)refundInfo.RefundType,
                         UserRemark    = refundInfo.UserRemark,
                         AdminRemark   = refundInfo.AdminRemark
                     }
                 }
             });
             context.Response.Write(s);
             context.Response.End();
         }
     }
 }
Example #4
0
 protected override void AttachChildControls()
 {
     this.credentialsImg     = (HtmlImage)this.FindControl("credentialsImg");
     this.divCredentials     = (HtmlGenericControl)this.FindControl("divCredentials");
     this.litRefundReason    = (Literal)this.FindControl("litRefundReason");
     this.refundId           = base.GetParameter("RefundId", false).ToInt(0);
     this.products           = (Common_OrderItems_AfterSales)this.FindControl("Common_OrderItems_AfterSales");
     this.txtOrderId         = (Literal)this.FindControl("txtOrderId");
     this.txtAfterSaleId     = (Literal)this.FindControl("txtAfterSaleId");
     this.litRemark          = (Literal)this.FindControl("litRemark");
     this.litAdminRemark     = (Literal)this.FindControl("litAdminRemark");
     this.litWeight          = (Literal)this.FindControl("litWeight");
     this.litType            = (Literal)this.FindControl("litType");
     this.litUserRemark      = (Literal)this.FindControl("litUserRemark");
     this.litTotalPrice      = (FormatedMoneyLabel)this.FindControl("litTotalPrice");
     this.litRefundTotal     = (FormatedMoneyLabel)this.FindControl("litRefundTotal");
     this.litOrderTotal      = (FormatedMoneyLabel)this.FindControl("litOrderTotal");
     this.litStep            = (Literal)this.FindControl("litStep");
     this.litTime            = (Literal)this.FindControl("litTime");
     this.litProcess         = (Literal)this.FindControl("litProcess");
     this.lnkReApply         = (HtmlAnchor)this.FindControl("lnkReApply");
     this.litBankName        = (Literal)this.FindControl("litBankName");
     this.litBankAccountName = (Literal)this.FindControl("litBankAccountName");
     this.litBankAccountNo   = (Literal)this.FindControl("litBankAccountNo");
     this.bankRow1           = (HtmlGenericControl)this.FindControl("bankRow1");
     this.bankRow2           = (HtmlGenericControl)this.FindControl("bankRow2");
     this.bankRow3           = (HtmlGenericControl)this.FindControl("bankRow3");
     this.AdminRemarkRow     = (HtmlGenericControl)this.FindControl("AdminRemarkRow");
     this.refund             = TradeHelper.GetRefundInfo(this.refundId);
     if (this.refund == null)
     {
         this.Page.Response.Redirect("/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("退款信息不存在或者不属于当前用户"));
     }
     else
     {
         this.order = TradeHelper.GetOrderInfo(this.refund.OrderId);
         if (this.order == null || this.order.UserId != HiContext.Current.UserId)
         {
             this.Page.Response.Redirect("/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("该订单不存在或者不属于当前用户的订单"));
         }
         else if (!this.Page.IsPostBack)
         {
             this.BindOrderRefund(this.refund);
             this.BindOrderItems(this.order);
             this.BindProducts(this.order);
         }
     }
 }
Example #5
0
        private void btnRefuseRefund_Click(object sender, EventArgs e)
        {
            int        refundId   = this.Page.Request.QueryString["RefundId"].ToInt(0);
            string     text       = Globals.StripAllTags(this.txtAdminRemark.Text);
            RefundInfo refundInfo = TradeHelper.GetRefundInfo(refundId);

            if (refundInfo == null)
            {
                this.ShowMsg("退款信息错误!", false);
            }
            else
            {
                OrderInfo orderInfo = OrderHelper.GetOrderInfo(refundInfo.OrderId);
                if (orderInfo == null)
                {
                    this.ShowMsg("错误的订单信息", false);
                }
                else if (string.IsNullOrEmpty(text))
                {
                    this.ShowMsg("请填写拒绝退款的原因", false);
                }
                else
                {
                    refundInfo.AdminRemark = text;
                    decimal num = refundInfo.RefundAmount;
                    if (num == decimal.Zero)
                    {
                        num = orderInfo.GetTotal(false);
                    }
                    string userName = HiContext.Current.Manager.UserName;
                    OrderHelper.CheckRefund(orderInfo, refundInfo, num, userName, text, false, false);
                    MemberInfo user = Users.GetUser(orderInfo.UserId);
                    Messenger.OrderRefundRefused(user, orderInfo, refundInfo);
                    this.ShowMsg("成功的拒绝了订单退款", true, HttpContext.Current.Request.Url.ToString());
                }
            }
        }
Example #6
0
        protected void listOrders_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                OrderStatus orderStatus = (OrderStatus)DataBinder.Eval(e.Item.DataItem, "OrderStatus");
                string      text        = DataBinder.Eval(e.Item.DataItem, "OrderId").ToString();
                OrderInfo   orderInfo   = TradeHelper.GetOrderInfo(text);
                if (orderInfo != null)
                {
                    if (orderInfo.PreSaleId > 0)
                    {
                        Literal literal = (Literal)e.Item.FindControl("litPresale");
                        literal.Text    = "(预售)";
                        literal.Visible = true;
                    }
                    OrderItemStatus itemStatus = orderInfo.ItemStatus;
                    DateTime        dateTime   = (DataBinder.Eval(e.Item.DataItem, "FinishDate") == DBNull.Value) ? DateTime.Now.AddYears(-1) : ((DateTime)DataBinder.Eval(e.Item.DataItem, "FinishDate"));
                    string          text2      = "";
                    if (DataBinder.Eval(e.Item.DataItem, "Gateway") != null && !(DataBinder.Eval(e.Item.DataItem, "Gateway") is DBNull))
                    {
                        text2 = (string)DataBinder.Eval(e.Item.DataItem, "Gateway");
                    }
                    HyperLink       hyperLink        = (HyperLink)e.Item.FindControl("hplinkorderreview");
                    HtmlAnchor      htmlAnchor       = (HtmlAnchor)e.Item.FindControl("hlinkPay");
                    ImageLinkButton imageLinkButton  = (ImageLinkButton)e.Item.FindControl("lkbtnConfirmOrder");
                    ImageLinkButton imageLinkButton2 = (ImageLinkButton)e.Item.FindControl("lkbtnCloseOrder");
                    HtmlAnchor      htmlAnchor2      = (HtmlAnchor)e.Item.FindControl("lkbtnApplyForRefund");
                    HtmlAnchor      htmlAnchor3      = (HtmlAnchor)e.Item.FindControl("lkbtnUserRealNameVerify");
                    HyperLink       hyperLink2       = (HyperLink)e.Item.FindControl("hlinkOrderDetails");
                    Repeater        repeater         = (Repeater)e.Item.FindControl("rpProduct");
                    Repeater        repeater2        = (Repeater)e.Item.FindControl("rpGift");
                    Label           label            = (Label)e.Item.FindControl("Logistics");
                    HtmlAnchor      htmlAnchor4      = (HtmlAnchor)e.Item.FindControl("lkbtnViewMessage");
                    HtmlAnchor      htmlAnchor5      = (HtmlAnchor)e.Item.FindControl("lkbtnRefundDetail");
                    htmlAnchor2.Attributes.Add("OrderId", text);
                    htmlAnchor2.Attributes.Add("SkuId", "");
                    htmlAnchor2.Attributes.Add("GateWay", text2);
                    OrderStatusLabel orderStatusLabel = (OrderStatusLabel)e.Item.FindControl("lblOrderStatus");
                    Literal          literal2         = (Literal)e.Item.FindControl("lblGiftTitle");
                    orderStatusLabel.order = orderInfo;
                    if (orderInfo.LineItems.Count <= 0)
                    {
                        Literal literal3 = literal2;
                        literal3.Text += "(礼)";
                    }
                    if (hyperLink != null)
                    {
                        if (orderInfo.GetGiftQuantity() > 0 && orderInfo.LineItems.Count() == 0)
                        {
                            hyperLink.Visible = false;
                        }
                        else
                        {
                            HyperLink hyperLink3 = hyperLink;
                            int       visible;
                            switch (orderStatus)
                            {
                            case OrderStatus.Closed:
                                visible = ((orderInfo.OnlyReturnedCount == orderInfo.LineItems.Count) ? 1 : 0);
                                break;

                            default:
                                visible = 0;
                                break;

                            case OrderStatus.Finished:
                                visible = 1;
                                break;
                            }
                            hyperLink3.Visible = ((byte)visible != 0);
                            if (hyperLink.Visible)
                            {
                                DataTable    productReviewAll = ProductBrowser.GetProductReviewAll(orderInfo.OrderId);
                                LineItemInfo lineItemInfo     = new LineItemInfo();
                                int          num  = 0;
                                int          num2 = 0;
                                int          num3 = 0;
                                bool         flag = false;
                                foreach (KeyValuePair <string, LineItemInfo> lineItem in orderInfo.LineItems)
                                {
                                    flag         = false;
                                    lineItemInfo = lineItem.Value;
                                    for (int i = 0; i < productReviewAll.Rows.Count; i++)
                                    {
                                        if (lineItemInfo.ProductId.ToString() == productReviewAll.Rows[i][0].ToString() && lineItemInfo.SkuId.ToString().Trim() == productReviewAll.Rows[i][1].ToString().Trim())
                                        {
                                            flag = true;
                                        }
                                    }
                                    if (!flag)
                                    {
                                        num2++;
                                    }
                                    else
                                    {
                                        num3++;
                                    }
                                }
                                if (num + num2 == orderInfo.LineItems.Count)
                                {
                                    hyperLink.Text = "查看评论";
                                }
                                else
                                {
                                    SiteSettings masterSettings = SettingsManager.GetMasterSettings();
                                    if (masterSettings != null)
                                    {
                                        if (masterSettings.ProductCommentPoint <= 0)
                                        {
                                            hyperLink.Text = "评价";
                                        }
                                        else
                                        {
                                            hyperLink.Text = $"评价得{num3 * masterSettings.ProductCommentPoint}积分";
                                        }
                                    }
                                }
                            }
                        }
                    }
                    if (orderInfo.PreSaleId > 0)
                    {
                        FormatedMoneyLabel formatedMoneyLabel = (FormatedMoneyLabel)e.Item.FindControl("FormatedMoneyLabel2");
                        formatedMoneyLabel.Money = orderInfo.Deposit + orderInfo.FinalPayment;
                        formatedMoneyLabel.Text  = (orderInfo.Deposit + orderInfo.FinalPayment).F2ToString("f2");
                        if (orderStatus == OrderStatus.WaitBuyerPay && text2 != "hishop.plugins.payment.podrequest" && text2 != "hishop.plugins.payment.bankrequest" && orderInfo.PaymentTypeId != -3)
                        {
                            if (!orderInfo.DepositDate.HasValue)
                            {
                                htmlAnchor.Visible = true;
                            }
                            else if (orderInfo.DepositDate.HasValue)
                            {
                                ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId);
                                if (productPreSaleInfo.PaymentStartDate <= DateTime.Now && DateTime.Now <= productPreSaleInfo.PaymentEndDate)
                                {
                                    htmlAnchor.Visible = true;
                                }
                                else
                                {
                                    htmlAnchor.Visible = false;
                                }
                            }
                            else
                            {
                                htmlAnchor.Visible = false;
                            }
                        }
                        else
                        {
                            htmlAnchor.Visible = false;
                        }
                    }
                    else
                    {
                        htmlAnchor.Visible = (orderStatus == OrderStatus.WaitBuyerPay && text2 != "hishop.plugins.payment.podrequest" && text2 != "hishop.plugins.payment.bankrequest" && orderInfo.PaymentTypeId != -3);
                    }
                    imageLinkButton.Visible = (orderStatus == OrderStatus.SellerAlreadySent && itemStatus == OrderItemStatus.Nomarl);
                    if (orderInfo.PreSaleId > 0)
                    {
                        imageLinkButton2.Visible = (orderStatus == OrderStatus.WaitBuyerPay && itemStatus == OrderItemStatus.Nomarl && !orderInfo.DepositDate.HasValue);
                    }
                    else
                    {
                        imageLinkButton2.Visible = (orderStatus == OrderStatus.WaitBuyerPay && itemStatus == OrderItemStatus.Nomarl);
                    }
                    RefundInfo refundInfo = TradeHelper.GetRefundInfo(text);
                    htmlAnchor2.Visible = ((orderInfo.FightGroupId > 0 && VShopHelper.IsFightGroupCanRefund(orderInfo.FightGroupId) && orderInfo.IsCanRefund) || (orderInfo.FightGroupId <= 0 && orderInfo.IsCanRefund));
                    htmlAnchor3.Visible = (HiContext.Current.SiteSettings.IsOpenCertification && orderInfo.IDStatus == 0 && orderInfo.IsincludeCrossBorderGoods);
                    if (htmlAnchor3.Visible)
                    {
                        htmlAnchor3.Attributes.Add("OrderId", text);
                    }
                    if (repeater != null && repeater2 != null)
                    {
                        repeater.ItemDataBound += this.listProduct_ItemDataBound;
                        IList <NewLineItemInfo> list = new List <NewLineItemInfo>();
                        foreach (LineItemInfo value in orderInfo.LineItems.Values)
                        {
                            NewLineItemInfo newLineItemInfo = this.GetNewLineItemInfo(value, orderInfo.OrderId);
                            list.Add(newLineItemInfo);
                        }
                        if (list == null || list.Count == 0)
                        {
                            repeater.Visible = false;
                            DataTable dataTable = (DataTable)(repeater2.DataSource = TradeHelper.GetOrderGiftsThumbnailsUrl(((DataRowView)e.Item.DataItem).Row["OrderId"].ToString()));
                            repeater2.DataBind();
                            repeater2.Visible = true;
                        }
                        else
                        {
                            repeater.DataSource = list;
                            repeater.DataBind();
                            repeater2.Visible = false;
                            repeater.Visible  = true;
                        }
                    }
                    if (refundInfo != null && orderInfo.ItemStatus == OrderItemStatus.Nomarl && (orderInfo.OrderStatus == OrderStatus.ApplyForRefund || orderInfo.OrderStatus == OrderStatus.RefundRefused || orderInfo.OrderStatus == OrderStatus.Closed))
                    {
                        htmlAnchor5.HRef    = "/user/UserRefundApplyDetails/" + refundInfo.RefundId;
                        htmlAnchor5.Visible = true;
                    }
                    hyperLink2.NavigateUrl = "/user/OrderDetails/" + orderInfo.OrderId;
                    if ((orderStatus == OrderStatus.SellerAlreadySent || orderStatus == OrderStatus.Finished) && !string.IsNullOrEmpty(orderInfo.ExpressCompanyAbb) && !string.IsNullOrEmpty(orderInfo.ShipOrderNumber) && orderInfo.ShippingModeId != -2)
                    {
                        label.Attributes.Add("action", "order");
                        label.Attributes.Add("orderId", text);
                        label.Visible = true;
                    }
                    if (orderInfo.FightGroupId > 0)
                    {
                        FightGroupInfo fightGroup = VShopHelper.GetFightGroup(orderInfo.FightGroupId);
                        htmlAnchor2.Visible = (fightGroup.Status != 0 && orderInfo.GetPayTotal() > decimal.Zero && (refundInfo == null || refundInfo.HandleStatus == RefundStatus.Refused) && orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid);
                    }
                    if (orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid || orderInfo.OrderStatus == OrderStatus.Finished || orderInfo.OrderStatus == OrderStatus.WaitReview || orderInfo.OrderStatus == OrderStatus.History)
                    {
                        WeiXinRedEnvelopeInfo openedWeiXinRedEnvelope = WeiXinRedEnvelopeProcessor.GetOpenedWeiXinRedEnvelope();
                        bool flag2 = false;
                        if (openedWeiXinRedEnvelope != null && openedWeiXinRedEnvelope.EnableIssueMinAmount <= orderInfo.GetPayTotal() && orderInfo.OrderDate >= openedWeiXinRedEnvelope.ActiveStartTime && orderInfo.OrderDate <= openedWeiXinRedEnvelope.ActiveEndTime)
                        {
                            flag2 = true;
                        }
                        if (flag2)
                        {
                            Image image = (Image)e.Item.FindControl("imgRedEnvelope");
                            image.ImageUrl = "../../../../common/images/SendRedEnvelope.png";
                            image.Attributes.Add("class", "ztitle_RedEnvelope");
                            image.Attributes.Add("onclick", "GetRedEnvelope(" + orderInfo.OrderId + ")");
                            image.Visible = true;
                        }
                    }
                    if (orderInfo.OrderStatus != OrderStatus.WaitBuyerPay || !(orderInfo.ParentOrderId == "-1") || !orderInfo.OrderId.Contains("P"))
                    {
                        Label label2 = (Label)e.Item.FindControl("lblsupplier");
                        if (label2 != null)
                        {
                            string empty = string.Empty;
                            if (HiContext.Current.SiteSettings.OpenMultStore && orderInfo.StoreId > 0 && !string.IsNullOrWhiteSpace(orderInfo.StoreName))
                            {
                                label2.Text = orderInfo.StoreName;
                                empty       = "mtitle_1";
                            }
                            else if (orderInfo.StoreId == 0 && HiContext.Current.SiteSettings.OpenSupplier && orderInfo.SupplierId > 0)
                            {
                                label2.Text = orderInfo.ShipperName;
                                empty       = "stitle_1";
                            }
                            else
                            {
                                label2.Text = "平台";
                                empty       = "ztitle_1_new";
                            }
                            label2.Attributes.Add("style", string.IsNullOrWhiteSpace(label2.Text) ? "display:none" : "display:inline");
                            label2.Attributes.Add("class", empty);
                            label2.Visible = true;
                        }
                    }
                }
            }
        }
Example #7
0
        private DataGridViewModel <Dictionary <string, object> > GetOrderList(OrderQuery query)
        {
            DataGridViewModel <Dictionary <string, object> > dataGridViewModel = new DataGridViewModel <Dictionary <string, object> >();
            DbQueryResult orders = OrderHelper.GetOrders(query);

            dataGridViewModel.rows  = DataHelper.DataTableToDictionary(orders.Data);
            dataGridViewModel.total = orders.TotalRecords;
            string[] orderIds = (from d in dataGridViewModel.rows
                                 select d["OrderId"].ToString()).ToArray();
            List <RefundInfo> refundInfos = TradeHelper.GetRefundInfos(orderIds);

            foreach (Dictionary <string, object> row in dataGridViewModel.rows)
            {
                OrderInfo order = TradeHelper.GetOrderInfo(row["OrderId"].ToString());
                row.Add("OrderStatusText", OrderHelper.GetOrderStatusText(order.OrderStatus, order.ShippingModeId, order.IsConfirm, order.Gateway, 0, order.PreSaleId, order.DepositDate, false, order.ItemStatus, OrderType.NormalOrder));
                row.Add("CanConfirmOrder", order.CanConfirmOrder());
                row.Add("canCheckTake", order.CanConfirmTakeCode());
                row.Add("canCloseOrder", order.CanClose(base.CurrentSiteSetting.OpenMultStore, true));
                row.Add("canOfflineReceipt", OrderHelper.CanConfirmOfflineReceipt(order, true));
                row.Add("canSendGoods", order.CanSendGoods(base.CurrentSiteSetting.OpenMultStore));
                row.Add("canFinishTrade", order.OrderStatus == OrderStatus.SellerAlreadySent && order.ItemStatus == OrderItemStatus.Nomarl);
                row.Add("SupplierOrderTotals", order.OrderCostPrice + order.Freight);
                if (order.IsStoreCollect)
                {
                    row.Add("isShowCheckRefund", order.OrderStatus == OrderStatus.ApplyForRefund && order.StoreId == base.CurrentManager.StoreId);
                }
                row.Add("InvoiceTypeText", string.IsNullOrEmpty(order.InvoiceTitle) ? "" : EnumDescription.GetEnumDescription((Enum)(object)order.InvoiceType, 0));
                bool flag = false;
                if (order.FightGroupId > 0)
                {
                    FightGroupInfo fightGroup = VShopHelper.GetFightGroup(order.FightGroupId);
                    if (fightGroup != null)
                    {
                        row.Add("FightGroupActivityId", fightGroup.FightGroupActivityId);
                        if (fightGroup.Status == FightGroupStatus.FightGroupIn && order.OrderStatus != OrderStatus.WaitBuyerPay && order.OrderStatus != OrderStatus.Closed)
                        {
                            flag = true;
                        }
                    }
                }
                row.Add("FightGrouping", flag);
                row.Add("isGiftOrder", order.LineItems.Count <= 0);
                row["IsError"]      = order.IsError;
                row["ErrorMessage"] = order.ErrorMessage;
                RefundInfo refundInfo = refundInfos.FirstOrDefault((RefundInfo d) => d.OrderId == order.OrderId);
                if (refundInfo != null)
                {
                    row.Add("RefundId", refundInfo.RefundId);
                }
                int            num      = 0;
                int            num2     = 0;
                bool           flag2    = false;
                string         value    = "订单中有商品正在进行退货/退款";
                AfterSaleTypes?nullable = null;
                if (order.ItemStatus != 0 || order.OrderStatus == OrderStatus.ApplyForRefund)
                {
                    if (order.OrderStatus == OrderStatus.ApplyForRefund)
                    {
                        RefundInfo refundInfo2 = TradeHelper.GetRefundInfo(order.OrderId);
                        if (refundInfo2 != null)
                        {
                            flag2 = true;
                            value = "订单已申请退款";
                        }
                    }
                    else
                    {
                        int            num3           = 0;
                        AfterSaleTypes afterSaleTypes = AfterSaleTypes.ReturnAndRefund;
                        int            num4           = 0;
                        foreach (LineItemInfo value2 in order.LineItems.Values)
                        {
                            if (value2.ReturnInfo != null || value2.ReplaceInfo != null)
                            {
                                ReturnInfo  returnInfo  = value2.ReturnInfo;
                                ReplaceInfo replaceInfo = value2.ReplaceInfo;
                                if (num3 == 0 || (returnInfo != null && returnInfo.HandleStatus != ReturnStatus.Refused && returnInfo.HandleStatus != ReturnStatus.Returned) || (replaceInfo != null && (replaceInfo.HandleStatus != ReplaceStatus.Refused || replaceInfo.HandleStatus != ReplaceStatus.Replaced)))
                                {
                                    if (value2.ReturnInfo != null)
                                    {
                                        afterSaleTypes = AfterSaleTypes.ReturnAndRefund;
                                        num4           = value2.ReturnInfo.ReturnId;
                                    }
                                    else
                                    {
                                        afterSaleTypes = AfterSaleTypes.Replace;
                                        num4           = value2.ReplaceInfo.ReplaceId;
                                    }
                                }
                                num3++;
                            }
                        }
                        if (order.ItemStatus == OrderItemStatus.HasReturnOrReplace)
                        {
                            value = "订单中有商品正在退货/换货中";
                        }
                        else if (order.ItemStatus == OrderItemStatus.HasReplace)
                        {
                            value = "订单中有商品正在进行换货";
                        }
                        else if (order.ItemStatus == OrderItemStatus.HasReturn)
                        {
                            value = "订单中有商品在进行退货/退款操作";
                        }
                        else if (order.ReturnedCount > 0)
                        {
                            value = "订单中有商品已退货完成";
                        }
                        if (num3 > 0)
                        {
                            flag2    = true;
                            nullable = afterSaleTypes;
                            if (afterSaleTypes == AfterSaleTypes.ReturnAndRefund)
                            {
                                num = num4;
                            }
                            else
                            {
                                num2 = num4;
                            }
                        }
                    }
                }
                row.Add("ReturnId", num);
                row.Add("ReplaceId", num2);
                row.Add("AfterSaleType", nullable);
                row.Add("isShowRefund", flag2);
                row.Add("RefundStatus", value);
            }
            return(dataGridViewModel);
        }
Example #8
0
        protected void btnAcceptRefund_Click(object sender, EventArgs e)
        {
            bool       flag        = true;
            string     userName    = HiContext.Current.Manager.UserName;
            string     adminRemark = Globals.StripAllTags(this.txtAdminRemark.Text);
            int        refundId    = this.Page.Request.QueryString["RefundId"].ToInt(0);
            RefundInfo refundInfo  = TradeHelper.GetRefundInfo(refundId);

            if (refundInfo == null)
            {
                this.ShowMsg("错误的退款申请信息", false);
            }
            else
            {
                OrderInfo orderInfo = OrderHelper.GetOrderInfo(refundInfo.OrderId);
                if (orderInfo == null)
                {
                    this.ShowMsg("错误的订单信息", false);
                }
                else
                {
                    decimal num = this.txtRefundMoney.Text.ToDecimal(0);
                    if (num < decimal.Zero)
                    {
                        this.ShowMsg("退款金额必须大于等于0", false);
                    }
                    else
                    {
                        if (!refundInfo.IsServiceProduct)
                        {
                            GroupBuyInfo groupbuy = null;
                            if (orderInfo.GroupBuyId > 0)
                            {
                                groupbuy = ProductBrowser.GetGroupBuy(orderInfo.GroupBuyId);
                            }
                            if (num > orderInfo.GetCanRefundAmount("", groupbuy, 0))
                            {
                                this.ShowMsg("退款金额不能大于订单/商品最大金额", false);
                                return;
                            }
                        }
                        else if (num > refundInfo.RefundAmount)
                        {
                            this.ShowMsg("退款金额不能大于可退款总额", false);
                            return;
                        }
                        if (refundInfo.HandleStatus != 0)
                        {
                            this.ShowMsg("退款状态不正确", false);
                        }
                        else if (refundInfo.IsServiceProduct || (!refundInfo.IsServiceProduct && OrderHelper.CanFinishRefund(orderInfo, refundInfo, num, false)))
                        {
                            RefundTypes refundType = refundInfo.RefundType;
                            string      userRemark = refundInfo.UserRemark;
                            MemberInfo  user       = Users.GetUser(orderInfo.UserId);
                            string      text       = "";
                            if (RefundHelper.IsBackReturn(orderInfo.Gateway) && refundInfo.RefundType == RefundTypes.BackReturn)
                            {
                                text = RefundHelper.SendRefundRequest(orderInfo, num, refundInfo.RefundOrderId, true);
                                if (text == "")
                                {
                                    if (OrderHelper.CheckRefund(orderInfo, refundInfo, num, userName, adminRemark, true, false))
                                    {
                                        VShopHelper.AppPushRecordForOrder(orderInfo.OrderId, "", EnumPushOrderAction.OrderRefund);
                                        Messenger.OrderRefund(user, orderInfo, "");
                                        this.ShowMsg("成功的完成退款并且已成功原路退回退款金额!", true, HttpContext.Current.Request.Url.ToString());
                                    }
                                }
                                else
                                {
                                    TradeHelper.SaveRefundErr(refundInfo.RefundId, text, true);
                                    this.ShowMsg("退款原路返回错误,错误信息" + text + ",请重新尝试!", false);
                                }
                            }
                            else if (OrderHelper.CheckRefund(orderInfo, refundInfo, num, userName, adminRemark, true, false))
                            {
                                Messenger.OrderRefund(user, orderInfo, "");
                                VShopHelper.AppPushRecordForOrder(orderInfo.OrderId, "", EnumPushOrderAction.OrderRefund);
                                if (refundInfo.RefundType == RefundTypes.InBalance)
                                {
                                    this.ShowMsg("成功确定了退款,退款金额已退回用户预付款帐号!", true, HttpContext.Current.Request.Url.ToString());
                                }
                                else
                                {
                                    this.ShowMsg("成功的完成了退款,请即时给用户退款", true, HttpContext.Current.Request.Url.ToString());
                                }
                            }
                        }
                    }
                }
            }
        }
Example #9
0
        private void dlstOrders_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                SiteSettings masterSettings = SettingsManager.GetMasterSettings();
                string       a = "";
                if (!(DataBinder.Eval(e.Item.DataItem, "Gateway") is DBNull))
                {
                    a = (string)DataBinder.Eval(e.Item.DataItem, "Gateway");
                }
                string          text             = DataBinder.Eval(e.Item.DataItem, "OrderId").ToString();
                OrderInfo       orderInfo        = TradeHelper.GetOrderInfo(text);
                OrderStatus     orderStatus      = (OrderStatus)DataBinder.Eval(e.Item.DataItem, "OrderStatus");
                int             num              = DataBinder.Eval(e.Item.DataItem, "ShippingModeId").ToInt(0);
                ImageLinkButton imageLinkButton  = (ImageLinkButton)e.Item.FindControl("lkbtnPayOrder");
                Literal         literal          = (Literal)e.Item.FindControl("litCloseOrder");
                HyperLink       hyperLink        = (HyperLink)e.Item.FindControl("lkbtnEditPrice");
                int             num2             = (int)((DataBinder.Eval(e.Item.DataItem, "GroupBuyId") is DBNull) ? ((object)0) : DataBinder.Eval(e.Item.DataItem, "GroupBuyId"));
                int             num3             = (int)((DataBinder.Eval(e.Item.DataItem, "CountDownBuyId") is DBNull) ? ((object)0) : DataBinder.Eval(e.Item.DataItem, "CountDownBuyId"));
                int             num4             = (int)((DataBinder.Eval(e.Item.DataItem, "BundlingId") is DBNull) ? ((object)0) : DataBinder.Eval(e.Item.DataItem, "BundlingId"));
                int             num5             = DataBinder.Eval(e.Item.DataItem, "ShippingModeId").ToInt(0);
                ImageLinkButton imageLinkButton2 = (ImageLinkButton)e.Item.FindControl("lkbtnConfirmOrder");
                Literal         literal2         = (Literal)e.Item.FindControl("litDivideStore");
                Literal         literal3         = (Literal)e.Item.FindControl("isGiftOrder");
                LinkButton      linkButton       = (LinkButton)e.Item.FindControl("lbtnFightGroup");
                Image           image            = (Image)e.Item.FindControl("imgError");
                HtmlAnchor      htmlAnchor       = (HtmlAnchor)e.Item.FindControl("lkbtnCheckRefund");
                HtmlInputHidden htmlInputHidden  = (HtmlInputHidden)e.Item.FindControl("hidFightGroup");
                HtmlAnchor      htmlAnchor2      = (HtmlAnchor)e.Item.FindControl("aftersaleImg");
                image.Visible = orderInfo.IsError;
                if (orderInfo.IsError)
                {
                    image.Attributes.Add("title", orderInfo.ErrorMessage);
                    image.ImageUrl = "\\Admin\\images\\orderError.png";
                }
                ProductPreSaleInfo productPreSaleInfo = null;
                if (orderInfo.PreSaleId > 0)
                {
                    Literal            literal4           = (Literal)e.Item.FindControl("litPreSale");
                    Literal            literal5           = (Literal)e.Item.FindControl("litSendGoods");
                    FormatedMoneyLabel formatedMoneyLabel = (FormatedMoneyLabel)e.Item.FindControl("lblOrderTotals");
                    e.Item.FindControl("lblAmount").Visible = true;
                    productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId);
                    literal4.Text      = "<font>定金:" + orderInfo.Deposit.F2ToString("f2") + "</font>";
                    Literal literal6 = literal4;
                    literal6.Text            = literal6.Text + "<font>尾款:" + orderInfo.FinalPayment.F2ToString("f2") + "</font>";
                    literal4.Visible         = true;
                    formatedMoneyLabel.Money = orderInfo.Deposit + orderInfo.FinalPayment;
                    formatedMoneyLabel.Text  = (orderInfo.Deposit + orderInfo.FinalPayment).ToString();
                    if (orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid)
                    {
                        literal5.Visible = true;
                        DateTime dateTime;
                        if (productPreSaleInfo.DeliveryDate.HasValue)
                        {
                            Literal literal7 = literal5;
                            dateTime      = productPreSaleInfo.DeliveryDate.Value;
                            literal7.Text = "<span>预计发货时间:" + dateTime.ToString("yyyy-MM-dd") + "</span>";
                        }
                        else
                        {
                            DateTime payDate = orderInfo.PayDate;
                            if (orderInfo.PayDate != DateTime.MinValue)
                            {
                                Literal literal8 = literal5;
                                dateTime      = orderInfo.PayDate;
                                dateTime      = dateTime.AddDays((double)productPreSaleInfo.DeliveryDays);
                                literal8.Text = "<span>预计发货时间:" + dateTime.ToString("yyyy-MM-dd") + "</span>";
                            }
                        }
                    }
                }
                RefundInfo refundInfo = TradeHelper.GetRefundInfo(orderInfo.OrderId);
                if (orderInfo.ItemStatus != 0 || orderInfo.OrderStatus == OrderStatus.ApplyForRefund)
                {
                    if (orderInfo.OrderStatus == OrderStatus.ApplyForRefund)
                    {
                        if (refundInfo != null)
                        {
                            htmlAnchor2.Visible = true;
                            htmlAnchor2.Title   = "订单已申请退款";
                            htmlAnchor2.HRef    = "/Admin/sales/RefundApplyDetail?RefundId=" + refundInfo.RefundId;
                        }
                    }
                    else
                    {
                        int            num6           = 0;
                        AfterSaleTypes afterSaleTypes = AfterSaleTypes.ReturnAndRefund;
                        int            num7           = 0;
                        foreach (LineItemInfo value in orderInfo.LineItems.Values)
                        {
                            if (value.ReturnInfo != null || value.ReplaceInfo != null)
                            {
                                ReturnInfo  returnInfo  = value.ReturnInfo;
                                ReplaceInfo replaceInfo = value.ReplaceInfo;
                                if (num6 == 0 || (returnInfo != null && returnInfo.HandleStatus != ReturnStatus.Refused && returnInfo.HandleStatus != ReturnStatus.Returned) || (replaceInfo != null && (replaceInfo.HandleStatus != ReplaceStatus.Refused || replaceInfo.HandleStatus != ReplaceStatus.Replaced)))
                                {
                                    if (value.ReturnInfo != null)
                                    {
                                        afterSaleTypes = AfterSaleTypes.ReturnAndRefund;
                                        num7           = value.ReturnInfo.ReturnId;
                                    }
                                    else
                                    {
                                        afterSaleTypes = AfterSaleTypes.Replace;
                                        num7           = value.ReplaceInfo.ReplaceId;
                                    }
                                }
                                num6++;
                            }
                        }
                        if (orderInfo.ItemStatus == OrderItemStatus.HasReturnOrReplace)
                        {
                            htmlAnchor2.Title = "订单中有商品正在退货/换货中";
                        }
                        else if (orderInfo.ReturnedCount > 0)
                        {
                            htmlAnchor2.Title = "订单中有商品已退货完成";
                        }
                        else if (orderInfo.ItemStatus == OrderItemStatus.HasReplace)
                        {
                            htmlAnchor2.Title = "订单中有商品正在进行换货操作";
                        }
                        else if (orderInfo.ItemStatus == OrderItemStatus.HasReturn)
                        {
                            htmlAnchor2.Title = "订单中有商品正在进行退货操作";
                        }
                        if (num6 > 0)
                        {
                            htmlAnchor2.Visible = true;
                            if (afterSaleTypes == AfterSaleTypes.ReturnAndRefund)
                            {
                                htmlAnchor2.HRef = "ReturnApplyDetail?ReturnId=" + num7;
                            }
                            else
                            {
                                htmlAnchor2.HRef = "ReplaceApplyDetail?ReplaceId=" + num7;
                            }
                        }
                    }
                }
                if (orderInfo.FightGroupId > 0)
                {
                    FightGroupInfo fightGroup = VShopHelper.GetFightGroup(orderInfo.FightGroupId);
                    if (fightGroup != null)
                    {
                        linkButton.PostBackUrl = "/Admin/promotion/FightGroupDetails.aspx?fightGroupActivityId=" + fightGroup.FightGroupActivityId;
                        if (fightGroup.Status == FightGroupStatus.FightGroupIn && orderInfo.OrderStatus != OrderStatus.WaitBuyerPay && orderInfo.OrderStatus != OrderStatus.Closed)
                        {
                            htmlInputHidden.Value = "1";
                        }
                        else
                        {
                            htmlInputHidden.Value = "0";
                        }
                    }
                }
                else
                {
                    linkButton.Visible = false;
                }
                OrderStatusLabel orderStatusLabel = (OrderStatusLabel)e.Item.FindControl("lblOrderStatus");
                if (orderStatusLabel != null)
                {
                    orderStatusLabel.OrderItemStatus = orderInfo.ItemStatus;
                    if (orderInfo.PreSaleId > 0)
                    {
                        orderStatusLabel.PreSaleId   = orderInfo.PreSaleId;
                        orderStatusLabel.DepositDate = orderInfo.DepositDate;
                    }
                }
                HtmlAnchor htmlAnchor3 = (HtmlAnchor)e.Item.FindControl("lkbtnToDetail");
                int        num8        = (int)((DataBinder.Eval(e.Item.DataItem, "StoreId") == DBNull.Value) ? ((object)0) : DataBinder.Eval(e.Item.DataItem, "StoreId"));
                bool       flag        = (bool)((DataBinder.Eval(e.Item.DataItem, "IsStoreCollect") == DBNull.Value) ? ((object)false) : DataBinder.Eval(e.Item.DataItem, "IsStoreCollect"));
                bool       flag2       = false;
                if (refundInfo != null)
                {
                    htmlAnchor.HRef = "/Admin/sales/RefundApplyDetail?RefundId=" + refundInfo.RefundId.ToString();
                    flag2           = true;
                }
                if (orderInfo.LineItems.Count <= 0)
                {
                    literal3.Text = "(礼)";
                }
                Literal literal9 = (Literal)e.Item.FindControl("group");
                if (literal9 != null)
                {
                    if (num2 > 0)
                    {
                        literal9.Text = "(团)";
                    }
                    if (num3 > 0)
                    {
                        literal9.Text = "(抢)";
                    }
                    if (orderInfo.PreSaleId > 0)
                    {
                        literal9.Text = "(预)";
                    }
                }
                if (orderStatus == OrderStatus.WaitBuyerPay)
                {
                    if (orderInfo.PreSaleId > 0)
                    {
                        if (!orderInfo.DepositDate.HasValue)
                        {
                            hyperLink.NavigateUrl = "javascript:DialogFrame('/Admin/sales/EditOrder.aspx?OrderId=" + text + "','修改订单价格',null,null,function(e){location.reload();})";
                            hyperLink.Visible     = true;
                            literal.Visible       = true;
                            if (a != "hishop.plugins.payment.podrequest" && num != -2 && orderInfo.FightGroupId == 0)
                            {
                                imageLinkButton.Visible = true;
                            }
                        }
                        else if (productPreSaleInfo.PaymentStartDate <= DateTime.Now && productPreSaleInfo.PaymentEndDate >= DateTime.Now && a != "hishop.plugins.payment.podrequest" && num != -2 && orderInfo.FightGroupId == 0)
                        {
                            imageLinkButton.Visible = true;
                        }
                    }
                    else
                    {
                        hyperLink.NavigateUrl = "javascript:DialogFrame('/Admin/sales/EditOrder.aspx?OrderId=" + text + "','修改订单价格',null,null,function(e){location.reload();})";
                        hyperLink.Visible     = true;
                        if (a != "hishop.plugins.payment.podrequest" && num != -2 && orderInfo.FightGroupId == 0 && (orderInfo.ParentOrderId == "0" || orderInfo.ParentOrderId == "-1"))
                        {
                            imageLinkButton.Visible = true;
                        }
                    }
                }
                if (a == "hishop.plugins.payment.podrequest")
                {
                    int num9;
                    switch (orderStatus)
                    {
                    case OrderStatus.SellerAlreadySent:
                        num9 = ((orderInfo.ParentOrderId == "0" || orderInfo.ParentOrderId == "-1") ? 1 : 0);
                        break;

                    default:
                        num9 = 0;
                        break;

                    case OrderStatus.WaitBuyerPay:
                        num9 = 1;
                        break;
                    }
                    if (num9 != 0)
                    {
                        literal.Visible = true;
                    }
                }
                if (orderStatus == OrderStatus.SellerAlreadySent && orderInfo.StoreId > 0 && masterSettings.OpenMultStore)
                {
                    literal.Visible = false;
                }
                if (orderStatus == OrderStatus.ApplyForRefund && !orderInfo.IsStoreCollect)
                {
                    htmlAnchor.Visible = true;
                }
                imageLinkButton2.Visible = (orderStatus == OrderStatus.SellerAlreadySent && orderInfo.ItemStatus == OrderItemStatus.Nomarl);
                if (masterSettings.OpenMultStore && num == -2 && orderStatus == OrderStatus.WaitBuyerPay)
                {
                    literal.Visible   = !orderInfo.IsConfirm;
                    hyperLink.Visible = true;
                    if (a != "hishop.plugins.payment.podrequest" && orderInfo.PaymentTypeId != -3 && orderInfo.FightGroupId == 0)
                    {
                        imageLinkButton.Visible = true;
                    }
                }
            }
        }
Example #10
0
        private void dlstOrders_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                SiteSettings masterSettings = SettingsManager.GetMasterSettings();
                string       text           = "";
                if (!(DataBinder.Eval(e.Item.DataItem, "Gateway") is DBNull))
                {
                    text = (string)DataBinder.Eval(e.Item.DataItem, "Gateway");
                }
                string          orderId         = DataBinder.Eval(e.Item.DataItem, "OrderId").ToString();
                OrderInfo       orderInfo       = TradeHelper.GetOrderInfo(orderId);
                OrderStatus     orderStatus     = (OrderStatus)DataBinder.Eval(e.Item.DataItem, "OrderStatus");
                int             num             = DataBinder.Eval(e.Item.DataItem, "ShippingModeId").ToInt(0);
                int             num2            = (int)((DataBinder.Eval(e.Item.DataItem, "GroupBuyId") is DBNull) ? ((object)0) : DataBinder.Eval(e.Item.DataItem, "GroupBuyId"));
                int             num3            = (int)((DataBinder.Eval(e.Item.DataItem, "CountDownBuyId") is DBNull) ? ((object)0) : DataBinder.Eval(e.Item.DataItem, "CountDownBuyId"));
                int             num4            = (int)((DataBinder.Eval(e.Item.DataItem, "BundlingId") is DBNull) ? ((object)0) : DataBinder.Eval(e.Item.DataItem, "BundlingId"));
                int             num5            = DataBinder.Eval(e.Item.DataItem, "ShippingModeId").ToInt(0);
                Label           label           = (Label)e.Item.FindControl("lkbtnSendGoods");
                Literal         literal         = (Literal)e.Item.FindControl("isGiftOrder");
                LinkButton      linkButton      = (LinkButton)e.Item.FindControl("lbtnFightGroup");
                Image           image           = (Image)e.Item.FindControl("imgError");
                HtmlInputHidden htmlInputHidden = (HtmlInputHidden)e.Item.FindControl("hidFightGroup");
                HtmlAnchor      htmlAnchor      = (HtmlAnchor)e.Item.FindControl("aftersaleImg");
                image.Visible = orderInfo.IsError;
                if (orderInfo.IsError)
                {
                    image.Attributes.Add("title", orderInfo.ErrorMessage);
                    image.ImageUrl = "\\Supplier\\images\\orderError.png";
                }
                if (orderInfo.ItemStatus != 0 || orderInfo.OrderStatus == OrderStatus.ApplyForRefund)
                {
                    if (orderInfo.OrderStatus == OrderStatus.ApplyForRefund)
                    {
                        RefundInfo refundInfo = TradeHelper.GetRefundInfo(orderInfo.OrderId);
                        if (refundInfo != null)
                        {
                            htmlAnchor.Visible = true;
                            htmlAnchor.Title   = "订单已申请退款";
                        }
                    }
                    else
                    {
                        int            num6           = 0;
                        AfterSaleTypes afterSaleTypes = AfterSaleTypes.ReturnAndRefund;
                        int            num7           = 0;
                        foreach (LineItemInfo value in orderInfo.LineItems.Values)
                        {
                            if (value.ReturnInfo != null || value.ReplaceInfo != null)
                            {
                                ReturnInfo  returnInfo  = value.ReturnInfo;
                                ReplaceInfo replaceInfo = value.ReplaceInfo;
                                if (num6 == 0 || (returnInfo != null && returnInfo.HandleStatus != ReturnStatus.Refused && returnInfo.HandleStatus != ReturnStatus.Returned) || (replaceInfo != null && (replaceInfo.HandleStatus != ReplaceStatus.Refused || replaceInfo.HandleStatus != ReplaceStatus.Replaced)))
                                {
                                    if (value.ReturnInfo != null)
                                    {
                                        afterSaleTypes = AfterSaleTypes.ReturnAndRefund;
                                        num7           = value.ReturnInfo.ReturnId;
                                    }
                                    else
                                    {
                                        afterSaleTypes = AfterSaleTypes.Replace;
                                        num7           = value.ReplaceInfo.ReplaceId;
                                    }
                                }
                                num6++;
                            }
                        }
                        if (orderInfo.ItemStatus == OrderItemStatus.HasReturnOrReplace)
                        {
                            htmlAnchor.Title = "订单中有商品正在退货/换货中";
                        }
                        else if (orderInfo.ItemStatus == OrderItemStatus.HasReplace)
                        {
                            htmlAnchor.Title = "订单中有商品正在进行换货";
                        }
                        else if (orderInfo.ItemStatus == OrderItemStatus.HasReturn)
                        {
                            htmlAnchor.Title = "订单中有商品在进行退货/退款操作";
                        }
                        else if (orderInfo.ReturnedCount > 0)
                        {
                            htmlAnchor.Title = "订单中有商品已退货完成";
                        }
                        if (num6 > 0)
                        {
                            htmlAnchor.Visible = true;
                            if (afterSaleTypes == AfterSaleTypes.ReturnAndRefund)
                            {
                                htmlAnchor.HRef = "ReturnApplyDetail?ReturnId=" + num7;
                            }
                            else
                            {
                                htmlAnchor.HRef = "ReplaceApplyDetail?ReplaceId=" + num7;
                            }
                        }
                    }
                }
                if (orderInfo.FightGroupId > 0)
                {
                    FightGroupInfo fightGroup = VShopHelper.GetFightGroup(orderInfo.FightGroupId);
                    if (fightGroup != null)
                    {
                        linkButton.PostBackUrl = "/Supplier/vshop/FightGroupDetails.aspx?fightGroupActivityId=" + fightGroup.FightGroupActivityId;
                        if (fightGroup.Status == FightGroupStatus.FightGroupIn && orderInfo.OrderStatus != OrderStatus.WaitBuyerPay && orderInfo.OrderStatus != OrderStatus.Closed)
                        {
                            htmlInputHidden.Value = "1";
                        }
                        else
                        {
                            htmlInputHidden.Value = "0";
                        }
                    }
                }
                else
                {
                    linkButton.Visible = false;
                }
                OrderStatusLabel orderStatusLabel = (OrderStatusLabel)e.Item.FindControl("lblOrderStatus");
                if (orderStatusLabel != null)
                {
                    orderStatusLabel.OrderItemStatus = orderInfo.ItemStatus;
                    if (orderInfo.PreSaleId > 0)
                    {
                        orderStatusLabel.PreSaleId   = orderInfo.PreSaleId;
                        orderStatusLabel.DepositDate = orderInfo.DepositDate;
                    }
                }
                HtmlAnchor htmlAnchor2 = (HtmlAnchor)e.Item.FindControl("lkbtnToDetail");
                int        num8        = (int)((DataBinder.Eval(e.Item.DataItem, "StoreId") == DBNull.Value) ? ((object)0) : DataBinder.Eval(e.Item.DataItem, "StoreId"));
                bool       flag        = (bool)((DataBinder.Eval(e.Item.DataItem, "IsStoreCollect") == DBNull.Value) ? ((object)false) : DataBinder.Eval(e.Item.DataItem, "IsStoreCollect"));
                if (orderInfo.LineItems.Count <= 0)
                {
                    literal.Text = "(礼)";
                }
                Literal literal2 = (Literal)e.Item.FindControl("group");
                if (literal2 != null)
                {
                    if (num2 > 0)
                    {
                        literal2.Text = "(团)";
                    }
                    if (num3 > 0)
                    {
                        literal2.Text = "(抢)";
                    }
                    if (orderInfo.PreSaleId > 0)
                    {
                        literal2.Text = "(预)";
                    }
                }
                if (num2 > 0)
                {
                    string[] source = new string[1]
                    {
                        "hishop.plugins.payment.podrequest"
                    };
                    GroupBuyStatus groupBuyStatus = (GroupBuyStatus)DataBinder.Eval(e.Item.DataItem, "GroupBuyStatus");
                    Label          label2         = label;
                    int            visible;
                    if (orderInfo.ItemStatus == OrderItemStatus.Nomarl)
                    {
                        switch (orderStatus)
                        {
                        case OrderStatus.WaitBuyerPay:
                            if (source.Contains(text))
                            {
                                goto case OrderStatus.BuyerAlreadyPaid;
                            }
                            goto default;

                        case OrderStatus.BuyerAlreadyPaid:
                            visible = ((groupBuyStatus == GroupBuyStatus.Success) ? 1 : 0);
                            break;

                        default:
                            visible = 0;
                            break;
                        }
                    }
                    else
                    {
                        visible = 0;
                    }
                    label2.Visible = ((byte)visible != 0);
                }
                else if (num3 > 0 || num4 > 0)
                {
                    Label label3 = label;
                    int   visible2;
                    if (orderInfo.ItemStatus == OrderItemStatus.Nomarl)
                    {
                        switch (orderStatus)
                        {
                        case OrderStatus.WaitBuyerPay:
                            visible2 = ((text == "hishop.plugins.payment.podrequest") ? 1 : 0);
                            break;

                        default:
                            visible2 = 0;
                            break;

                        case OrderStatus.BuyerAlreadyPaid:
                            visible2 = 1;
                            break;
                        }
                    }
                    else
                    {
                        visible2 = 0;
                    }
                    label3.Visible = ((byte)visible2 != 0);
                }
                else if (masterSettings.OpenMultStore)
                {
                    Label label4 = label;
                    int   visible3;
                    switch (orderStatus)
                    {
                    case OrderStatus.WaitBuyerPay:
                        if (text == "hishop.plugins.payment.podrequest")
                        {
                            goto case OrderStatus.BuyerAlreadyPaid;
                        }
                        goto default;

                    case OrderStatus.BuyerAlreadyPaid:
                        if (num5 != -2)
                        {
                            visible3 = ((orderInfo.ItemStatus == OrderItemStatus.Nomarl) ? 1 : 0);
                            break;
                        }
                        goto default;

                    default:
                        visible3 = 0;
                        break;
                    }
                    label4.Visible = ((byte)visible3 != 0);
                }
                else
                {
                    Label label5 = label;
                    int   visible4;
                    switch (orderStatus)
                    {
                    case OrderStatus.WaitBuyerPay:
                        if (text == "hishop.plugins.payment.podrequest")
                        {
                            goto case OrderStatus.BuyerAlreadyPaid;
                        }
                        goto default;

                    case OrderStatus.BuyerAlreadyPaid:
                        visible4 = ((orderInfo.ItemStatus == OrderItemStatus.Nomarl) ? 1 : 0);
                        break;

                    default:
                        visible4 = 0;
                        break;
                    }
                    label5.Visible = ((byte)visible4 != 0);
                }
            }
        }
Example #11
0
        protected override void AttachChildControls()
        {
            this.hidUploadImages    = (HtmlInputHidden)this.FindControl("hidUploadImages");
            this.hidErrorMsg        = (HtmlInputHidden)this.FindControl("hidErrorMsg");
            this.hidOldImages       = (HtmlInputHidden)this.FindControl("hidOldImages");
            this.txtRefundId        = (HtmlInputHidden)this.FindControl("txtRefundId");
            this.txtOrderId         = (Literal)this.FindControl("txtOrderId");
            this.txtRefundMoney     = (Literal)this.FindControl("txtRefundMoney");
            this.txtRefundType      = (Literal)this.FindControl("txtRefundType");
            this.txtReturnReason    = (Literal)this.FindControl("txtReturnReason");
            this.txtMemo            = (Literal)this.FindControl("txtMemo");
            this.txtAfterSaleId     = (Literal)this.FindControl("litAfterSaleId");
            this.txtAdminRemark     = (Literal)this.FindControl("txtAdminRemark");
            this.txtRefuseReason    = (Literal)this.FindControl("txtRefuseReason");
            this.litStep            = (Literal)this.FindControl("litStep");
            this.litStatus          = (Literal)this.FindControl("litStatus");
            this.litBankName        = (Literal)this.FindControl("litBankName");
            this.litBankAccountName = (Literal)this.FindControl("litBankAccountName");
            this.litBankAccountNo   = (Literal)this.FindControl("litBankAccountNo");
            this.bankRow1           = (HtmlGenericControl)this.FindControl("bankRow1");
            this.bankRow2           = (HtmlGenericControl)this.FindControl("bankRow2");
            this.bankRow3           = (HtmlGenericControl)this.FindControl("bankRow3");
            this.AdminRemarkRow     = (HtmlGenericControl)this.FindControl("AdminRemarkRow");
            this.liRefundPassword   = (HtmlGenericControl)this.FindControl("liRefundPassword");
            this.txtRefundPassword  = (Literal)this.FindControl("txtRefundPassword");
            this.products           = (Common_OrderItem_AfterSales)this.FindControl("Common_OrderItemAfterSales");
            int refundId = 0;

            int.TryParse(HttpContext.Current.Request.QueryString["RefundId"], out refundId);
            RefundInfo refundInfo = TradeHelper.GetRefundInfo(refundId);

            if (refundInfo == null)
            {
                this.ShowError("错误的退款信息");
            }
            else
            {
                if (refundInfo.IsServiceProduct)
                {
                    this.txtRefundPassword.Text   = refundInfo.ValidCodes;
                    this.liRefundPassword.Visible = true;
                }
                else
                {
                    this.liRefundPassword.Visible = false;
                }
                this.litStatus.Text = EnumDescription.GetEnumDescription((Enum)(object)refundInfo.HandleStatus, 0);
                OrderInfo orderInfo = TradeHelper.GetOrderInfo(refundInfo.OrderId);
                if (orderInfo == null || orderInfo.UserId != HiContext.Current.UserId)
                {
                    this.ShowMessage("退款订单不存在或者不属于当前用户的订单", false, "", 1);
                    return;
                }
                HtmlInputHidden htmlInputHidden = this.txtRefundId;
                int             refundId2       = refundInfo.RefundId;
                htmlInputHidden.Value     = refundId2.ToString();
                this.txtOrderId.Text      = refundInfo.OrderId;
                this.txtRefundMoney.Text  = refundInfo.RefundAmount.F2ToString("f2");
                this.txtRefundType.Text   = EnumDescription.GetEnumDescription((Enum)(object)refundInfo.RefundType, 0);
                this.txtMemo.Text         = refundInfo.UserRemark;
                this.txtReturnReason.Text = refundInfo.RefundReason;
                if (!string.IsNullOrEmpty(refundInfo.AdminRemark))
                {
                    this.txtAdminRemark.Text = refundInfo.AdminRemark;
                    if (this.AdminRemarkRow != null)
                    {
                        this.AdminRemarkRow.Visible = true;
                    }
                }
                else if (this.AdminRemarkRow != null)
                {
                    this.AdminRemarkRow.Visible = false;
                }
                Literal literal = this.txtAfterSaleId;
                refundId2    = refundInfo.RefundId;
                literal.Text = refundId2.ToString();
                if (orderInfo != null)
                {
                    this.products.order      = orderInfo;
                    this.products.DataSource = orderInfo.LineItems.Values;
                    this.products.DataBind();
                }
                DateTime dateTime  = refundInfo.AgreedOrRefusedTime.HasValue ? refundInfo.AgreedOrRefusedTime.Value : refundInfo.ApplyForTime;
                DateTime dateTime2 = refundInfo.FinishTime.HasValue ? refundInfo.FinishTime.Value : dateTime;
                string   text      = "<ul>";
                refundInfo.AdminRemark = (string.IsNullOrEmpty(refundInfo.AdminRemark) ? "" : ("备注:" + refundInfo.AdminRemark));
                DateTime applyForTime;
                if (refundInfo.HandleStatus == RefundStatus.Applied)
                {
                    string str    = text;
                    string text2  = this.stepTemplate.Replace("{style}", this.activityStyle);
                    string format = this.timeTemplate;
                    applyForTime = refundInfo.ApplyForTime;
                    text         = str + text2.Replace("{time}", string.Format(format, applyForTime.ToString("yyyy-MM-dd HH:mm:ss"))).Replace("{remark}", string.Format(this.remarkTemplate, "")).Replace("{StatusText}", "退款申请中");
                    text        += this.stepTemplate.Replace("{style}", "").Replace("{time}", "").Replace("{remark}", "")
                                   .Replace("{StatusText}", "商家同意退款");
                    text += this.stepTemplate.Replace("{style}", "").Replace("{time}", "").Replace("{remark}", "")
                            .Replace("{StatusText}", "退款完成");
                }
                else if (refundInfo.HandleStatus == RefundStatus.Refunded)
                {
                    string str2    = text;
                    string text3   = this.stepTemplate.Replace("{style}", this.activityStyle);
                    string format2 = this.timeTemplate;
                    applyForTime = refundInfo.ApplyForTime;
                    text         = str2 + text3.Replace("{time}", string.Format(format2, applyForTime.ToString("yyyy-MM-dd HH:mm:ss"))).Replace("{remark}", string.Format(this.remarkTemplate, "")).Replace("{StatusText}", "退款申请中");
                    text        += this.stepTemplate.Replace("{style}", this.activityStyle).Replace("{time}", string.Format(this.timeTemplate, dateTime.ToString("yyyy-MM-dd HH:mm:ss"))).Replace("{remark}", string.Format(this.remarkTemplate, refundInfo.AdminRemark))
                                   .Replace("{StatusText}", "商家同意退款");
                    text += this.stepTemplate.Replace("{style}", this.activityStyle).Replace("{time}", string.Format(this.timeTemplate, dateTime2.ToString("yyyy-MM-dd HH:mm:ss"))).Replace("{remark}", "")
                            .Replace("{StatusText}", "退款完成");
                }
                else if (refundInfo.HandleStatus == RefundStatus.Refused)
                {
                    string str3    = text;
                    string text4   = this.stepTemplate.Replace("{style}", this.activityStyle);
                    string format3 = this.timeTemplate;
                    applyForTime = refundInfo.ApplyForTime;
                    text         = str3 + text4.Replace("{time}", string.Format(format3, applyForTime.ToString("yyyy-MM-dd HH:mm:ss"))).Replace("{remark}", string.Format(this.remarkTemplate, "")).Replace("{StatusText}", "退款申请中");
                    text        += this.stepTemplate.Replace("{style}", this.activityStyle).Replace("{time}", string.Format(this.timeTemplate, dateTime.ToString("yyyy-MM-dd HH:mm:ss"))).Replace("{remark}", string.Format(this.remarkTemplate, refundInfo.AdminRemark))
                                   .Replace("{StatusText}", "商家拒绝退款");
                    text += this.stepTemplate.Replace("{style}", this.activityStyle).Replace("{time}", string.Format(this.timeTemplate, dateTime.ToString("yyyy-MM-dd HH:mm:ss"))).Replace("{remark}", "")
                            .Replace("{StatusText}", "退款失败");
                }
                text += "</ul>";
                this.litStep.Text = text;
                if (refundInfo.RefundType == RefundTypes.InBankCard)
                {
                    this.bankRow1.Visible        = true;
                    this.bankRow2.Visible        = true;
                    this.bankRow3.Visible        = true;
                    this.litBankName.Text        = refundInfo.BankName;
                    this.litBankAccountName.Text = refundInfo.BankAccountName;
                    this.litBankAccountNo.Text   = refundInfo.BankAccountNo;
                }
            }
            PageTitle.AddSiteNameTitle("退款详情");
        }
Example #12
0
        private void dlstOrders_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem)
            {
                return;
            }
            string      orderId     = DataBinder.Eval(e.Item.DataItem, "OrderId").ToString();
            OrderInfo   orderInfo   = TradeHelper.GetOrderInfo(orderId);
            OrderStatus orderStatus = (OrderStatus)DataBinder.Eval(e.Item.DataItem, "OrderStatus");
            HtmlAnchor  htmlAnchor  = (HtmlAnchor)e.Item.FindControl("lkbtnCheckTake");
            Literal     literal     = (Literal)e.Item.FindControl("litCloseOrder");
            int         num         = DataBinder.Eval(e.Item.DataItem, "ShippingModeId").ToInt(0);
            string      text        = "";

            if (!(DataBinder.Eval(e.Item.DataItem, "Gateway") is DBNull))
            {
                text = (string)DataBinder.Eval(e.Item.DataItem, "Gateway");
            }
            int              num2             = (int)((DataBinder.Eval(e.Item.DataItem, "GroupBuyId") is DBNull) ? ((object)0) : DataBinder.Eval(e.Item.DataItem, "GroupBuyId"));
            int              num3             = (int)((DataBinder.Eval(e.Item.DataItem, "CountDownBuyId") is DBNull) ? ((object)0) : DataBinder.Eval(e.Item.DataItem, "CountDownBuyId"));
            Label            label            = (Label)e.Item.FindControl("lkbtnSendGoods");
            ImageLinkButton  imageLinkButton  = (ImageLinkButton)e.Item.FindControl("lkbtnPayOrder");
            ImageLinkButton  imageLinkButton2 = (ImageLinkButton)e.Item.FindControl("lkbtnConfirmOrder");
            HtmlAnchor       htmlAnchor2      = (HtmlAnchor)e.Item.FindControl("lkbtnCheckRefund");
            ImageLinkButton  imageLinkButton3 = (ImageLinkButton)e.Item.FindControl("lkbtnConfirm");
            int              num4             = (int)((DataBinder.Eval(e.Item.DataItem, "StoreId") == DBNull.Value) ? ((object)0) : DataBinder.Eval(e.Item.DataItem, "StoreId"));
            bool             flag             = (bool)((DataBinder.Eval(e.Item.DataItem, "IsStoreCollect") == DBNull.Value) ? ((object)false) : DataBinder.Eval(e.Item.DataItem, "IsStoreCollect"));
            OrderStatusLabel orderStatusLabel = (OrderStatusLabel)e.Item.FindControl("lblOrderStatus");

            if (orderStatusLabel != null)
            {
                orderStatusLabel.OrderItemStatus = orderInfo.ItemStatus;
                if (orderInfo.PreSaleId > 0)
                {
                    orderStatusLabel.PreSaleId   = orderInfo.PreSaleId;
                    orderStatusLabel.DepositDate = orderInfo.DepositDate;
                }
            }
            bool       flag2      = false;
            RefundInfo refundInfo = TradeHelper.GetRefundInfo(orderId);

            if (refundInfo != null && orderInfo.StoreId == this.UserStoreId)
            {
                htmlAnchor2.Attributes.Add("refundid", refundInfo.RefundId.ToString());
                flag2 = true;
            }
            Literal literal2 = (Literal)e.Item.FindControl("group");

            if (literal2 != null)
            {
                if (num2 > 0)
                {
                    literal2.Text = "(团)";
                }
                if (num3 > 0)
                {
                    literal2.Text = "(抢)";
                }
                if (orderInfo.PreSaleId > 0)
                {
                    literal2.Text = "(预)";
                }
            }
            if (orderStatus == OrderStatus.WaitBuyerPay)
            {
                if (orderInfo.PreSaleId > 0)
                {
                    if (!orderInfo.DepositDate.HasValue)
                    {
                        literal.Visible = true;
                        if (text != "hishop.plugins.payment.podrequest" && num != -2 && orderInfo.FightGroupId == 0)
                        {
                            imageLinkButton.Visible = true;
                        }
                    }
                    else
                    {
                        ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId);
                        if (productPreSaleInfo.PaymentStartDate <= DateTime.Now && productPreSaleInfo.PaymentEndDate >= DateTime.Now && text != "hishop.plugins.payment.podrequest" && num != -2 && orderInfo.FightGroupId == 0)
                        {
                            imageLinkButton.Visible = true;
                        }
                    }
                }
                else
                {
                    literal.Visible = true;
                    if (text != "hishop.plugins.payment.podrequest" && num != -2 && orderInfo.FightGroupId == 0)
                    {
                        imageLinkButton.Visible = true;
                    }
                }
            }
            if (text == "hishop.plugins.payment.podrequest" && (orderStatus == OrderStatus.WaitBuyerPay || orderStatus == OrderStatus.SellerAlreadySent))
            {
                literal.Visible = true;
            }
            if ((orderStatus == OrderStatus.ApplyForRefund && this.UserStoreId == num4) & flag)
            {
                htmlAnchor2.Visible = true;
            }
            if (num2 > 0)
            {
                string[] source = new string[1]
                {
                    "hishop.plugins.payment.podrequest"
                };
                GroupBuyStatus groupBuyStatus = (GroupBuyStatus)DataBinder.Eval(e.Item.DataItem, "GroupBuyStatus");
                Label          label2         = label;
                int            visible;
                switch (orderStatus)
                {
                case OrderStatus.WaitBuyerPay:
                    if (source.Contains(text))
                    {
                        goto case OrderStatus.BuyerAlreadyPaid;
                    }
                    goto default;

                case OrderStatus.BuyerAlreadyPaid:
                    if (groupBuyStatus == GroupBuyStatus.Success)
                    {
                        visible = ((orderInfo.ItemStatus == OrderItemStatus.Nomarl) ? 1 : 0);
                        break;
                    }
                    goto default;

                default:
                    visible = 0;
                    break;
                }
                label2.Visible = ((byte)visible != 0);
            }
            else
            {
                Label label3 = label;
                int   visible2;
                switch (orderStatus)
                {
                case OrderStatus.WaitBuyerPay:
                    if (text == "hishop.plugins.payment.podrequest")
                    {
                        goto case OrderStatus.BuyerAlreadyPaid;
                    }
                    goto default;

                case OrderStatus.BuyerAlreadyPaid:
                    visible2 = ((orderInfo.ItemStatus == OrderItemStatus.Nomarl) ? 1 : 0);
                    break;

                default:
                    visible2 = 0;
                    break;
                }
                label3.Visible = ((byte)visible2 != 0);
            }
            imageLinkButton2.Visible = (orderStatus == OrderStatus.SellerAlreadySent && orderInfo.ItemStatus == OrderItemStatus.Nomarl);
            HtmlAnchor htmlAnchor3;
            int        visible3;

            if (num == -2)
            {
                htmlAnchor3 = htmlAnchor;
                if ((orderStatus == OrderStatus.BuyerAlreadyPaid || orderStatus == OrderStatus.WaitBuyerPay) && orderInfo.ItemStatus == OrderItemStatus.Nomarl)
                {
                    visible3 = (orderInfo.IsConfirm ? 1 : 0);
                    goto IL_05d6;
                }
                visible3 = 0;
                goto IL_05d6;
            }
            goto IL_0644;
IL_0631:
            int visible4 = (orderInfo.ItemStatus == OrderItemStatus.Nomarl) ? 1 : 0;

            goto IL_063d;
IL_0644:
            LinkButton linkButton = (LinkButton)e.Item.FindControl("lbtnFightGroup");
            Image           image           = (Image)e.Item.FindControl("imgError");
            HtmlInputHidden htmlInputHidden = (HtmlInputHidden)e.Item.FindControl("hidFightGroup");

            image.Visible = orderInfo.IsError;
            if (orderInfo.IsError)
            {
                image.Attributes.Add("title", orderInfo.ErrorMessage);
                image.ImageUrl = "\\Admin\\images\\orderError.png";
            }
            if (orderInfo.FightGroupId > 0)
            {
                FightGroupInfo fightGroup = VShopHelper.GetFightGroup(orderInfo.FightGroupId);
                if (fightGroup != null)
                {
                    if (fightGroup.Status == FightGroupStatus.FightGroupIn && orderInfo.OrderStatus != OrderStatus.WaitBuyerPay && orderInfo.OrderStatus != OrderStatus.Closed)
                    {
                        htmlInputHidden.Value = "1";
                    }
                    else
                    {
                        htmlInputHidden.Value = "0";
                    }
                }
            }
            else
            {
                linkButton.Visible = false;
            }
            return;

IL_05d6:
            htmlAnchor3.Visible = ((byte)visible3 != 0);
            literal.Visible     = (orderStatus == OrderStatus.WaitBuyerPay && orderInfo.ItemStatus == OrderItemStatus.Nomarl);
            label.Visible       = false;
            ImageLinkButton imageLinkButton4 = imageLinkButton3;

            if (!orderInfo.IsConfirm)
            {
                if (orderInfo.OrderStatus == OrderStatus.WaitBuyerPay && (text == "hishop.plugins.payment.podrequest" || orderInfo.PaymentTypeId == -3))
                {
                    goto IL_0631;
                }
                if (orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid)
                {
                    goto IL_0631;
                }
            }
            visible4 = 0;
            goto IL_063d;
IL_063d:
            imageLinkButton4.Visible = ((byte)visible4 != 0);
            goto IL_0644;
        }
Example #13
0
        public void ProcessorOrderVerificationItemsExpire()
        {
            StringBuilder stringBuilder = new StringBuilder();

            try
            {
                Database          obj = this.database;
                ProductSaleStatus productSaleStatus = ProductSaleStatus.UnSale;
                object            arg  = productSaleStatus.GetHashCode();
                object            arg2 = DateTime.Now;
                productSaleStatus = ProductSaleStatus.OnSale;
                obj.ExecuteNonQuery(CommandType.Text, string.Format("UPDATE Hishop_StoreProducts SET SaleStatus = {0} WHERE SaleStatus = {2} AND ProductId IN(SELECT ProductId FROM Hishop_Products WHERE ProductType = 1  AND ValidStartDate IS NOT NULL AND ValidEndDate IS NOT NULL AND ValidEndDate <= '{1}')", arg, arg2, productSaleStatus.GetHashCode()));
                StringBuilder stringBuilder2 = stringBuilder;
                productSaleStatus = ProductSaleStatus.UnSale;
                object arg3 = productSaleStatus.GetHashCode();
                object arg4 = DateTime.Now;
                productSaleStatus = ProductSaleStatus.OnSale;
                stringBuilder2.AppendLine(string.Format("UPDATE Hishop_StoreProducts SET SaleStatus = {0} WHERE SaleStatus = {2} AND ProductId IN(SELECT ProductId FROM Hishop_Products WHERE ProductType = 1  AND ValidStartDate IS NOT NULL AND ValidEndDate IS NOT NULL AND ValidEndDate <= '{1}')", arg3, arg4, productSaleStatus.GetHashCode()));
                this.database.ExecuteNonQuery(CommandType.Text, $"DELETE FROM Hishop_StoreSKUs WHERE  ProductId IN(SELECT ProductId FROM Hishop_Products WHERE ProductType = 1  AND ValidStartDate IS NOT NULL AND ValidEndDate IS NOT NULL AND ValidEndDate <= '{DateTime.Now}')");
                stringBuilder.AppendLine($"DELETE FROM Hishop_StoreSKUs WHERE  ProductId IN(SELECT ProductId FROM Hishop_Products WHERE ProductType = 1  AND ValidStartDate IS NOT NULL AND ValidEndDate IS NOT NULL AND ValidEndDate <= '{DateTime.Now}')");
                Database obj2 = this.database;
                productSaleStatus = ProductSaleStatus.UnSale;
                object arg5 = productSaleStatus.GetHashCode();
                object arg6 = DateTime.Now;
                productSaleStatus = ProductSaleStatus.OnSale;
                obj2.ExecuteNonQuery(CommandType.Text, string.Format("UPDATE Hishop_Products SET SaleStatus = {0} WHERE ProductType = 1 AND SaleStatus = {2} AND IsValid = 0 AND ValidStartDate IS NOT NULL AND ValidEndDate IS NOT NULL AND ValidEndDate <= '{1}'", arg5, arg6, productSaleStatus.GetHashCode()));
                StringBuilder stringBuilder3 = stringBuilder;
                productSaleStatus = ProductSaleStatus.UnSale;
                stringBuilder3.AppendLine($"UPDATE Hishop_Products SET SaleStatus = {productSaleStatus.GetHashCode()} WHERE ProductType = 1 AND ValidStartDate IS NOT NULL AND ValidEndDate IS NOT NULL AND ValidEndDate <= '{DateTime.Now}'");
                DbCommand sqlStringCommand = this.database.GetSqlStringCommand("UPDATE Hishop_OrderVerificationItems SET VerificationStatus = " + 3 + " WHERE OrderId IN(SELECT OrderId FROM Hishop_OrderItems WHERE(IsValid = 0 OR IsValid IS NULL)  AND ValidEndDate IS NOT NULL AND ValidEndDate < @Now) AND VerificationStatus = " + 0);
                this.database.AddInParameter(sqlStringCommand, "Now", DbType.DateTime, DateTime.Now);
                this.database.ExecuteNonQuery(sqlStringCommand);
                stringBuilder.AppendLine(string.Format("UPDATE Hishop_OrderVerificationItems SET VerificationStatus = " + 3 + " WHERE OrderId IN(SELECT OrderId FROM Hishop_OrderItems WHERE(IsValid = 0 OR IsValid IS NULL)  AND ValidEndDate IS NOT NULL AND ValidEndDate < '@Now') AND VerificationStatus = " + 0).Replace("@Now", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")));
                StringBuilder stringBuilder4 = new StringBuilder();
                StringBuilder stringBuilder5 = stringBuilder4;
                object[]      obj3           = new object[4];
                OrderStatus   orderStatus    = OrderStatus.Finished;
                obj3[0] = orderStatus.GetHashCode();
                OrderType orderType = OrderType.ServiceOrder;
                obj3[1] = orderType.GetHashCode();
                VerificationStatus verificationStatus = VerificationStatus.Expired;
                obj3[2]     = verificationStatus.GetHashCode();
                orderStatus = OrderStatus.BuyerAlreadyPaid;
                obj3[3]     = orderStatus.GetHashCode();
                stringBuilder5.Append(string.Format("UPDATE Hishop_Orders SET OrderStatus = {0} WHERE OrderStatus = {3} AND OrderType = {1} AND OrderId IN(SELECT OrderId FROM Hishop_OrderItems oi WHERE oi.Quantity = (SELECT COUNT(Id) FROM Hishop_OrderVerificationItems WHERE VerificationStatus =  {2} AND OrderId = oi.OrderId))", obj3));
                StringBuilder stringBuilder6 = stringBuilder4;
                object[]      obj4           = new object[4];
                orderStatus        = OrderStatus.Closed;
                obj4[0]            = orderStatus.GetHashCode();
                orderType          = OrderType.ServiceOrder;
                obj4[1]            = orderType.GetHashCode();
                verificationStatus = VerificationStatus.Expired;
                obj4[2]            = verificationStatus.GetHashCode();
                orderStatus        = OrderStatus.BuyerAlreadyPaid;
                obj4[3]            = orderStatus.GetHashCode();
                stringBuilder6.Append(string.Format("UPDATE Hishop_Orders SET OrderStatus = {0} WHERE OrderStatus = {3} AND OrderType = {1} AND OrderId IN(SELECT OrderId FROM Hishop_OrderItems oi WHERE oi.Quantity = (SELECT COUNT(Id) FROM Hishop_OrderVerificationItems WHERE (VerificationStatus =  {2}) AND OrderId = oi.OrderId AND oi.IsOverRefund = 0))", obj4));
                StringBuilder stringBuilder7 = stringBuilder4;
                object[]      obj5           = new object[6];
                orderStatus        = OrderStatus.Finished;
                obj5[0]            = orderStatus.GetHashCode();
                orderType          = OrderType.ServiceOrder;
                obj5[1]            = orderType.GetHashCode();
                verificationStatus = VerificationStatus.Expired;
                obj5[2]            = verificationStatus.GetHashCode();
                verificationStatus = VerificationStatus.Finished;
                obj5[3]            = verificationStatus.GetHashCode();
                orderStatus        = OrderStatus.BuyerAlreadyPaid;
                obj5[4]            = orderStatus.GetHashCode();
                verificationStatus = VerificationStatus.Refunded;
                obj5[5]            = verificationStatus.GetHashCode();
                stringBuilder7.Append(string.Format("UPDATE Hishop_Orders SET OrderStatus = {0} WHERE OrderStatus = {4} AND OrderType = {1} AND OrderId IN(SELECT OrderId FROM Hishop_OrderItems oi WHERE oi.Quantity = (SELECT COUNT(Id) FROM Hishop_OrderVerificationItems WHERE (VerificationStatus =  {2} OR VerificationStatus =  {3} OR VerificationStatus =  {5}) AND OrderId = oi.OrderId))", obj5));
                stringBuilder.AppendLine(stringBuilder4.ToString());
                this.database.ExecuteNonQuery(CommandType.Text, stringBuilder4.ToString());
                DbCommand sqlStringCommand2 = this.database.GetSqlStringCommand("SELECT oi.Quantity, oi.OrderId,oi.ProductId,StoreId,VerificationStatus,UserName,VerificationPassword FROM [Hishop_OrderItems] oi INNER JOIN Hishop_OrderVerificationItems ov ON ov.OrderId = oi.OrderId  WHERE (IsValid = 0 OR IsValid IS NULL) AND IsOverRefund = 1 AND VerificationStatus =" + 3 + ";");
                stringBuilder.AppendLine("SELECT oi.Quantity, oi.OrderId,oi.ProductId,StoreId,VerificationStatus,UserName FROM [Hishop_OrderItems] oi INNER JOIN Hishop_OrderVerificationItems ov ON ov.OrderId = oi.OrderId  WHERE (IsValid = 0 OR IsValid IS NULL) AND IsOverRefund = 1 AND VerificationStatus =" + 3 + ";");
                using (IDataReader objReader = this.database.ExecuteReader(sqlStringCommand2))
                {
                    IList <VerificationItemsExipreInfo> list = DataHelper.ReaderToList <VerificationItemsExipreInfo>(objReader);
                    if (list != null && list.Count > 0)
                    {
                        List <string> list2 = (from o in list
                                               select o.OrderId).Distinct().ToList();
                        foreach (string item in list2)
                        {
                            OrderInfo orderInfo = OrderHelper.GetOrderInfo(item);
                            if (orderInfo != null)
                            {
                                MemberInfo user = Users.GetUser(orderInfo.UserId);
                                if (user != null)
                                {
                                    IList <VerificationItemsExipreInfo> list3 = (from v in list
                                                                                 where v.OrderId == item
                                                                                 select v).ToList();
                                    decimal    num        = ((decimal)list3.Count * (orderInfo.GetTotal(false) / (decimal)orderInfo.GetBuyQuantity() * 1.0m) * 1.0m).F2ToString("f2").ToDecimal(0);
                                    string     generateId = Globals.GetGenerateId();
                                    RefundInfo refund     = new RefundInfo
                                    {
                                        UserRemark      = "",
                                        RefundReason    = "核销码过期自动退款",
                                        RefundType      = ((orderInfo.Gateway.ToNullString().ToLower() == EnumDescription.GetEnumDescription((Enum)(object)EnumPaymentType.AdvancePay, 1) || orderInfo.BalanceAmount > decimal.Zero) ? RefundTypes.InBalance : RefundTypes.BackReturn),
                                        RefundGateWay   = orderInfo.Gateway,
                                        RefundOrderId   = generateId,
                                        RefundAmount    = num,
                                        StoreId         = orderInfo.StoreId,
                                        ApplyForTime    = DateTime.Now,
                                        BankName        = "",
                                        BankAccountName = "",
                                        BankAccountNo   = "",
                                        OrderId         = item,
                                        HandleStatus    = RefundStatus.Applied,
                                        ValidCodes      = string.Join(",", from ii in list3
                                                                      select ii.VerificationPassword),
                                        IsServiceProduct = true,
                                        Quantity         = list3.Count
                                    };
                                    try
                                    {
                                        int num2 = TradeHelper.ServiceOrderApplyForRefund(refund);
                                        if (num2 > 0)
                                        {
                                            refund = TradeHelper.GetRefundInfo(num2);
                                            if (refund.Quantity == orderInfo.GetAllQuantity(true))
                                            {
                                                OrderHelper.UpdateOrderStatus(orderInfo, OrderStatus.ApplyForRefund);
                                            }
                                            SiteSettings masterSettings = SettingsManager.GetMasterSettings();
                                            if (masterSettings.IsAutoDealRefund)
                                            {
                                                if (orderInfo.GetTotal(false) == decimal.Zero)
                                                {
                                                    if (OrderHelper.CheckRefund(orderInfo, refund, decimal.Zero, "", "自动退款", true, true))
                                                    {
                                                        VShopHelper.AppPushRecordForOrder(orderInfo.OrderId, "", EnumPushOrderAction.OrderRefund);
                                                        Messenger.OrderRefund(user, orderInfo, "");
                                                    }
                                                    else
                                                    {
                                                        TradeHelper.SetOrderVerificationItemStatus(item, refund.ValidCodes, VerificationStatus.ApplyRefund);
                                                    }
                                                }
                                                else if (refund.RefundType == RefundTypes.InBalance)
                                                {
                                                    if (OrderHelper.CheckRefund(orderInfo, refund, num, "", "自动退款", true, true))
                                                    {
                                                        VShopHelper.AppPushRecordForOrder(orderInfo.OrderId, "", EnumPushOrderAction.OrderRefund);
                                                        Messenger.OrderRefund(user, orderInfo, "");
                                                    }
                                                    else
                                                    {
                                                        TradeHelper.SetOrderVerificationItemStatus(item, refund.ValidCodes, VerificationStatus.ApplyRefund);
                                                    }
                                                }
                                                else
                                                {
                                                    string text = TradeHelper.SendWxRefundRequest(orderInfo, num, refund.RefundOrderId);
                                                    if (text == "")
                                                    {
                                                        if (OrderHelper.CheckRefund(orderInfo, refund, num, "", "自动退款", true, true))
                                                        {
                                                            VShopHelper.AppPushRecordForOrder(orderInfo.OrderId, "", EnumPushOrderAction.OrderRefund);
                                                            Messenger.OrderRefund(user, orderInfo, "");
                                                        }
                                                        else
                                                        {
                                                            TradeHelper.SetOrderVerificationItemStatus(item, refund.ValidCodes, VerificationStatus.ApplyRefund);
                                                        }
                                                    }
                                                    else
                                                    {
                                                        TradeHelper.SaveRefundErr(num2, text, true);
                                                        TradeHelper.SetOrderVerificationItemStatus(item, refund.ValidCodes, VerificationStatus.ApplyRefund);
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                TradeHelper.SetOrderVerificationItemStatus(orderInfo.OrderId, refund.ValidCodes, VerificationStatus.ApplyRefund);
                                            }
                                            if (orderInfo.StoreId > 0)
                                            {
                                                VShopHelper.AppPsuhRecordForStore(orderInfo.StoreId, orderInfo.OrderId, "", EnumPushStoreAction.StoreOrderRefundApply);
                                            }
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        Globals.WriteExceptionLog_Page(ex, null, "O2OAutoRefundError");
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex2)
            {
                IDictionary <string, string> dictionary = new Dictionary <string, string>();
                dictionary.Add("Sql", stringBuilder.ToString());
                Globals.WriteExceptionLog(ex2, dictionary, "ProcessorOrderVerificationItemsExpire");
            }
        }
Example #14
0
 private void rptOrders_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
     {
         HtmlAnchor         htmlAnchor           = (HtmlAnchor)e.Item.FindControl("lkbtnCouponCode");
         HtmlAnchor         htmlAnchor2          = (HtmlAnchor)e.Item.FindControl("lkbtnApplyForRefund");
         HtmlAnchor         htmlAnchor3          = (HtmlAnchor)e.Item.FindControl("lnkClose");
         HtmlAnchor         htmlAnchor4          = (HtmlAnchor)e.Item.FindControl("lkbtnViewMessage");
         HtmlAnchor         htmlAnchor5          = (HtmlAnchor)e.Item.FindControl("lkbtnProductReview");
         Literal            literal              = (Literal)e.Item.FindControl("ltlOrderItems");
         Literal            literal2             = (Literal)e.Item.FindControl("ltlOrderGifts");
         HtmlGenericControl htmlGenericControl   = e.Item.FindControl("panelOperaters") as HtmlGenericControl;
         HtmlGenericControl htmlGenericControl2  = e.Item.FindControl("divToDetail") as HtmlGenericControl;
         HtmlGenericControl htmlGenericControl3  = e.Item.FindControl("divOrderStatus") as HtmlGenericControl;
         HtmlGenericControl htmlGenericControl4  = e.Item.FindControl("divOrderError") as HtmlGenericControl;
         HtmlGenericControl htmlGenericControl5  = e.Item.FindControl("divOrderGifts") as HtmlGenericControl;
         HtmlGenericControl htmlGenericControl6  = e.Item.FindControl("divOrderItems") as HtmlGenericControl;
         HtmlGenericControl htmlGenericControl7  = (HtmlGenericControl)e.Item.FindControl("OrderIdSpan");
         HtmlGenericControl htmlGenericControl8  = (HtmlGenericControl)e.Item.FindControl("PayMoneySpan");
         HtmlGenericControl htmlGenericControl9  = (HtmlGenericControl)e.Item.FindControl("TakeCodeDIV");
         HtmlAnchor         htmlAnchor6          = (HtmlAnchor)e.Item.FindControl("lnkViewLogistics");
         HtmlAnchor         htmlAnchor7          = (HtmlAnchor)e.Item.FindControl("lnkToPay");
         HtmlAnchor         htmlAnchor8          = (HtmlAnchor)e.Item.FindControl("lnkHelpLink");
         HtmlAnchor         htmlAnchor9          = (HtmlAnchor)e.Item.FindControl("lnkFinishOrder");
         HtmlAnchor         htmlAnchor10         = (HtmlAnchor)e.Item.FindControl("lnkViewTakeCodeQRCode");
         HtmlAnchor         htmlAnchor11         = (HtmlAnchor)e.Item.FindControl("lnkCertification");
         HtmlGenericControl htmlGenericControl10 = (HtmlGenericControl)e.Item.FindControl("divSendRedEnvelope");
         OrderStatus        orderStatus          = (OrderStatus)DataBinder.Eval(e.Item.DataItem, "OrderStatus");
         Repeater           repeater             = (Repeater)e.Item.FindControl("Repeater1");
         Repeater           repeater2            = (Repeater)e.Item.FindControl("rptPointGifts");
         this.paymenttypeselect = (Common_WAPPaymentTypeSelect)this.FindControl("paymenttypeselect");
         Literal   literal3  = (Literal)e.Item.FindControl("litGiftTitle");
         string    text      = DataBinder.Eval(e.Item.DataItem, "OrderId").ToString();
         OrderInfo orderInfo = TradeHelper.GetOrderInfo(text);
         if (orderInfo != null)
         {
             if (orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid || orderInfo.OrderStatus == OrderStatus.Finished || orderInfo.OrderStatus == OrderStatus.WaitReview || orderInfo.OrderStatus == OrderStatus.History)
             {
                 WeiXinRedEnvelopeInfo openedWeiXinRedEnvelope = WeiXinRedEnvelopeProcessor.GetOpenedWeiXinRedEnvelope();
                 bool visible = false;
                 if (openedWeiXinRedEnvelope != null && openedWeiXinRedEnvelope.EnableIssueMinAmount <= orderInfo.GetPayTotal() && orderInfo.OrderDate >= openedWeiXinRedEnvelope.ActiveStartTime && orderInfo.OrderDate <= openedWeiXinRedEnvelope.ActiveEndTime)
                 {
                     visible = true;
                 }
                 if (htmlGenericControl10 != null)
                 {
                     htmlGenericControl10.Visible = visible;
                     if (this.isVShop)
                     {
                         htmlGenericControl10.InnerHtml = "<a href=\"/vshop/SendRedEnvelope.aspx?OrderId=" + orderInfo.OrderId + "\"></a>";
                     }
                     else
                     {
                         htmlGenericControl10.InnerHtml = "";
                         string text2 = Globals.HttpsFullPath("/vshop/SendRedEnvelope.aspx?OrderId=" + orderInfo.OrderId);
                         htmlGenericControl10.Attributes.Add("onclick", string.Format("ShowMsg('{0}','{1}')", "代金红包请前往微信端领取!", "false"));
                     }
                 }
             }
             this.paymenttypeselect.ClientType = base.ClientType;
             htmlGenericControl4.Visible       = (orderInfo.IsError && orderInfo.CloseReason != "订单已退款完成");
             htmlGenericControl3.Visible       = !orderInfo.IsError;
             htmlGenericControl5.Visible       = (orderInfo.LineItems.Count() == 0);
             htmlGenericControl6.Visible       = (orderInfo.LineItems.Count() > 0);
             htmlAnchor2.HRef   = "ApplyRefund.aspx?OrderId=" + text;
             htmlAnchor.Visible = false;
             htmlAnchor.HRef    = "MemberOrdersVCode?OrderId=" + text;
             HtmlGenericControl htmlGenericControl11 = (HtmlGenericControl)e.Item.FindControl("OrderSupplierH3");
             string             text3 = string.Empty;
             if (htmlGenericControl11 != null)
             {
                 text3 = htmlGenericControl11.Attributes["class"];
                 text3 = ((!string.IsNullOrEmpty(text3)) ? text3.Replace(" ztitle", "").Replace("stitle", "") : "");
             }
             if (orderInfo.OrderStatus != OrderStatus.WaitBuyerPay || !(orderInfo.ParentOrderId == "-1") || !orderInfo.OrderId.Contains("P"))
             {
                 if (HiContext.Current.SiteSettings.OpenMultStore && orderInfo.StoreId > 0 && !string.IsNullOrWhiteSpace(orderInfo.StoreName))
                 {
                     htmlGenericControl7.InnerText = orderInfo.StoreName;
                     text3 += " mtitle";
                 }
                 else if (orderInfo.StoreId == 0 && HiContext.Current.SiteSettings.OpenSupplier && orderInfo.SupplierId > 0)
                 {
                     htmlGenericControl7.InnerText = orderInfo.ShipperName;
                     text3 += " stitle";
                 }
                 else
                 {
                     htmlGenericControl7.InnerText = "平台";
                     text3 += " ztitle";
                 }
                 htmlGenericControl11.Attributes["class"] = text3;
                 if (orderInfo.LineItems.Count <= 0)
                 {
                     literal3.Text = "(礼)";
                 }
             }
             else
             {
                 htmlGenericControl7.InnerText            = orderInfo.OrderId;
                 htmlGenericControl11.Attributes["class"] = text3;
             }
             if (orderInfo.PreSaleId > 0)
             {
                 htmlGenericControl8.InnerText = (orderInfo.Deposit + orderInfo.FinalPayment).F2ToString("f2");
             }
             else
             {
                 htmlGenericControl8.InnerText = Convert.ToDecimal(DataBinder.Eval(e.Item.DataItem, "OrderTotal")).F2ToString("f2");
             }
             if (htmlGenericControl2 != null)
             {
                 if (orderInfo.OrderType == OrderType.ServiceOrder)
                 {
                     htmlGenericControl2.Attributes.Add("onclick", "window.location.href='ServiceMemberOrderDetails.aspx?orderId=" + orderInfo.OrderId + "'");
                 }
                 else
                 {
                     htmlGenericControl2.Attributes.Add("onclick", "window.location.href='MemberOrderDetails.aspx?orderId=" + orderInfo.OrderId + "'");
                 }
             }
             if (htmlAnchor6 != null)
             {
                 if (orderInfo.OrderStatus == OrderStatus.SellerAlreadySent || orderInfo.OrderStatus == OrderStatus.Finished)
                 {
                     if (!string.IsNullOrEmpty(orderInfo.ExpressCompanyAbb) && !string.IsNullOrEmpty(orderInfo.ShipOrderNumber))
                     {
                         htmlAnchor6.HRef = "MyLogistics.aspx?OrderId=" + text;
                     }
                     else if (orderInfo.ExpressCompanyName == "同城物流配送")
                     {
                         htmlAnchor6.HRef = "MyLogistics.aspx?OrderId=" + text;
                     }
                     else
                     {
                         htmlAnchor6.Visible = false;
                     }
                 }
                 else
                 {
                     htmlAnchor6.Visible = false;
                 }
             }
             if (htmlAnchor10 != null)
             {
                 htmlAnchor10.HRef = "ViewQRCode.aspx?orderId=" + orderInfo.OrderId;
             }
             int num4;
             if (htmlAnchor5 != null && ((orderStatus == OrderStatus.Finished && orderInfo.LineItems.Count > 0) || (orderStatus == OrderStatus.Closed && orderInfo.OnlyReturnedCount == orderInfo.LineItems.Count && orderInfo.LineItems.Count > 0)))
             {
                 htmlAnchor5.Visible = true;
                 htmlAnchor5.HRef    = "MemberSubmitProductReview.aspx?orderId=" + text;
                 DataTable    productReviewAll = ProductBrowser.GetProductReviewAll(text);
                 LineItemInfo lineItemInfo     = new LineItemInfo();
                 int          num  = 0;
                 int          num2 = 0;
                 int          num3 = 0;
                 bool         flag = false;
                 foreach (KeyValuePair <string, LineItemInfo> lineItem in orderInfo.LineItems)
                 {
                     flag         = false;
                     lineItemInfo = lineItem.Value;
                     for (int i = 0; i < productReviewAll.Rows.Count; i++)
                     {
                         num4 = lineItemInfo.ProductId;
                         if (num4.ToString() == productReviewAll.Rows[i][0].ToString() && lineItemInfo.SkuId.ToString().Trim() == productReviewAll.Rows[i][1].ToString().Trim())
                         {
                             flag = true;
                         }
                     }
                     if (!flag)
                     {
                         num2++;
                     }
                     else
                     {
                         num3++;
                     }
                 }
                 if (num + num2 == orderInfo.LineItems.Count)
                 {
                     htmlAnchor5.InnerText = "查看评论";
                 }
                 else
                 {
                     SiteSettings masterSettings = SettingsManager.GetMasterSettings();
                     if (masterSettings != null)
                     {
                         if (masterSettings.ProductCommentPoint <= 0)
                         {
                             htmlAnchor5.InnerText = "评价";
                         }
                         else
                         {
                             htmlAnchor5.InnerText = $"评价得{num3 * masterSettings.ProductCommentPoint}积分";
                         }
                     }
                 }
             }
             if (htmlAnchor3 != null && orderStatus == OrderStatus.WaitBuyerPay)
             {
                 if (orderInfo.PreSaleId == 0 || (orderInfo.PreSaleId > 0 && !orderInfo.DepositDate.HasValue))
                 {
                     htmlAnchor3.Visible = true;
                 }
                 htmlAnchor3.Attributes.Add("onclick", $"closeOrder('{text}')");
             }
             DateTime dateTime;
             if (htmlAnchor7 != null)
             {
                 if (orderStatus == OrderStatus.WaitBuyerPay && orderInfo.ItemStatus == OrderItemStatus.Nomarl && orderInfo.PaymentTypeId != -3 && orderInfo.Gateway != "hishop.plugins.payment.bankrequest" && orderInfo.Gateway != "hishop.plugins.payment.podrequest")
                 {
                     htmlAnchor7.Attributes.Add("IsServiceOrder", (orderInfo.OrderType == OrderType.ServiceOrder).ToString().ToLower());
                     if (orderInfo.PreSaleId > 0)
                     {
                         ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId);
                         if (!orderInfo.DepositDate.HasValue)
                         {
                             htmlGenericControl8.InnerText = orderInfo.Deposit.F2ToString("f2");
                             (e.Item.FindControl("sptotal") as HtmlGenericControl).InnerText = "定金:¥";
                             if (productPreSaleInfo.PreSaleEndDate > DateTime.Now)
                             {
                                 AttributeCollection attributes = htmlAnchor7.Attributes;
                                 num4 = orderInfo.PaymentTypeId;
                                 attributes.Add("PaymentTypeId", num4.ToString());
                                 htmlAnchor7.Attributes.Add("OrderId", orderInfo.OrderId);
                                 htmlAnchor7.Attributes.Add("OrderTotal", orderInfo.Deposit.F2ToString("f2"));
                                 AttributeCollection attributes2 = htmlAnchor7.Attributes;
                                 num4 = orderInfo.FightGroupId;
                                 attributes2.Add("FightGroupId", num4.ToString());
                             }
                             else
                             {
                                 htmlAnchor7.Visible = false;
                                 (e.Item.FindControl("sptotal") as HtmlGenericControl).InnerText = "定金:¥";
                             }
                         }
                         else if (productPreSaleInfo.PaymentStartDate > DateTime.Now || productPreSaleInfo.PaymentEndDate < DateTime.Now)
                         {
                             (e.Item.FindControl("sptotal") as HtmlGenericControl).InnerText = "尾款:¥";
                             htmlGenericControl8.InnerText = orderInfo.FinalPayment.F2ToString("f2");
                             htmlAnchor7.Visible           = false;
                             htmlAnchor3.Visible           = false;
                             if (productPreSaleInfo.PaymentEndDate < DateTime.Now)
                             {
                                 (e.Item.FindControl("sptotal") as HtmlGenericControl).InnerText = "尾款支付结束";
                                 htmlGenericControl8.Visible = false;
                             }
                         }
                         else
                         {
                             AttributeCollection attributes3 = htmlAnchor7.Attributes;
                             num4 = orderInfo.PaymentTypeId;
                             attributes3.Add("PaymentTypeId", num4.ToString());
                             htmlAnchor7.Attributes.Add("OrderId", orderInfo.OrderId);
                             htmlAnchor7.Attributes.Add("OrderTotal", orderInfo.FinalPayment.F2ToString("f2"));
                             AttributeCollection attributes4 = htmlAnchor7.Attributes;
                             num4 = orderInfo.FightGroupId;
                             attributes4.Add("FightGroupId", num4.ToString());
                             htmlGenericControl8.InnerText = orderInfo.FinalPayment.F2ToString("f2");
                             (e.Item.FindControl("sptotal") as HtmlGenericControl).InnerText = "尾款:¥";
                             htmlAnchor3.Visible = false;
                         }
                     }
                     else
                     {
                         AttributeCollection attributes5 = htmlAnchor7.Attributes;
                         num4 = orderInfo.PaymentTypeId;
                         attributes5.Add("PaymentTypeId", num4.ToString());
                         htmlAnchor7.Attributes.Add("OrderId", orderInfo.OrderId);
                         htmlAnchor7.Attributes.Add("OrderTotal", orderInfo.GetTotal(false).F2ToString("f2"));
                         AttributeCollection attributes6 = htmlAnchor7.Attributes;
                         num4 = orderInfo.FightGroupId;
                         attributes6.Add("FightGroupId", num4.ToString());
                         if (HiContext.Current.SiteSettings.OpenMultStore && orderInfo.StoreId > 0 && !SettingsManager.GetMasterSettings().Store_IsOrderInClosingTime)
                         {
                             StoresInfo storeById = StoresHelper.GetStoreById(orderInfo.StoreId);
                             dateTime = DateTime.Now;
                             string str = dateTime.ToString("yyyy-MM-dd");
                             dateTime = storeById.OpenStartDate;
                             DateTime value = (str + " " + dateTime.ToString("HH:mm")).ToDateTime().Value;
                             dateTime = DateTime.Now;
                             string str2 = dateTime.ToString("yyyy-MM-dd");
                             dateTime = storeById.OpenEndDate;
                             DateTime dateTime2 = (str2 + " " + dateTime.ToString("HH:mm")).ToDateTime().Value;
                             if (dateTime2 <= value)
                             {
                                 dateTime2 = dateTime2.AddDays(1.0);
                             }
                             if (DateTime.Now < value || DateTime.Now > dateTime2)
                             {
                                 htmlAnchor7.Attributes.Add("NeedNotInTimeTip", "1");
                             }
                         }
                     }
                 }
                 else
                 {
                     htmlAnchor7.Visible = false;
                 }
             }
             if (htmlAnchor8 != null)
             {
                 if (orderInfo.Gateway == "hishop.plugins.payment.bankrequest" && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay)
                 {
                     htmlAnchor8.HRef = "FinishOrder.aspx?OrderId=" + text + "&onlyHelp=true";
                 }
                 else
                 {
                     htmlAnchor8.Visible = false;
                 }
             }
             if (htmlAnchor9 != null)
             {
                 if (orderInfo.OrderStatus == OrderStatus.SellerAlreadySent && orderInfo.ItemStatus == OrderItemStatus.Nomarl)
                 {
                     htmlAnchor9.Attributes.Add("onclick", $"FinishOrder('{text}','{orderInfo.PaymentType}',{orderInfo.LineItems.Count})");
                 }
                 else
                 {
                     htmlAnchor9.Visible = false;
                 }
             }
             if (htmlAnchor11 != null)
             {
                 if (HiContext.Current.SiteSettings.IsOpenCertification && orderInfo.IDStatus == 0 && orderInfo.IsincludeCrossBorderGoods)
                 {
                     htmlAnchor11.Attributes.Add("orderId", orderInfo.OrderId);
                     htmlAnchor11.Attributes.Add("onclick", "Certification(this)");
                     htmlAnchor11.Visible = true;
                 }
                 else
                 {
                     htmlAnchor11.Visible = false;
                 }
             }
             if (literal != null)
             {
                 Literal literal4 = literal;
                 num4          = this.GetGoodsNum(orderInfo);
                 literal4.Text = num4.ToString();
             }
             if (literal2 != null)
             {
                 Literal literal5 = literal2;
                 num4          = this.GetGiftsNum(orderInfo);
                 literal5.Text = num4.ToString();
             }
             if (orderInfo.OrderType == OrderType.ServiceOrder)
             {
                 Label label = (Label)e.Item.FindControl("OrderStatusLabel2");
                 IList <OrderVerificationItemInfo> orderVerificationItems = TradeHelper.GetOrderVerificationItems(orderInfo.OrderId);
                 ServiceOrderStatus orderStatus2 = this.GetOrderStatus(orderInfo, orderVerificationItems);
                 label.Text    = ((Enum)(object)orderStatus2).ToDescription();
                 label.Visible = true;
             }
             else
             {
                 OrderStatusLabel orderStatusLabel = (OrderStatusLabel)e.Item.FindControl("OrderStatusLabel1");
                 orderStatusLabel.OrderItemStatus    = ((orderInfo.ItemStatus != 0) ? OrderItemStatus.HasReturnOrReplace : OrderItemStatus.Nomarl);
                 orderStatusLabel.Gateway            = orderInfo.Gateway;
                 orderStatusLabel.OrderStatusCode    = orderInfo.OrderStatus;
                 orderStatusLabel.ShipmentModelId    = orderInfo.ShippingModeId;
                 orderStatusLabel.IsConfirm          = orderInfo.IsConfirm;
                 orderStatusLabel.ShipmentModelId    = orderInfo.ShippingModeId;
                 orderStatusLabel.PaymentTypeId      = orderInfo.PaymentTypeId;
                 orderStatusLabel.PreSaleId          = orderInfo.PreSaleId;
                 orderStatusLabel.DepositDate        = orderInfo.DepositDate;
                 orderStatusLabel.OrderType          = orderInfo.OrderType;
                 orderStatusLabel.ExpressCompanyName = orderInfo.ExpressCompanyName;
                 orderStatusLabel.DadaStatus         = orderInfo.DadaStatus;
                 orderStatusLabel.Visible            = true;
             }
             Dictionary <string, LineItemInfo> lineItems = orderInfo.LineItems;
             foreach (string key in lineItems.Keys)
             {
                 lineItems[key].IsValid = (orderInfo.OrderType == OrderType.ServiceOrder);
             }
             repeater.DataSource     = lineItems.Values;
             repeater.ItemDataBound += this.Repeater1_ItemDataBound;
             repeater.DataBind();
             if (orderInfo.LineItems.Count == 0)
             {
                 IEnumerable <OrderGiftInfo> enumerable = from a in orderInfo.Gifts
                                                          where a.PromoteType == 0 || a.PromoteType == 15
                                                          select a;
                 foreach (OrderGiftInfo item in enumerable)
                 {
                     item.NeedPoint = ((orderInfo.OrderType == OrderType.ServiceOrder) ? 1 : 0);
                 }
                 repeater2.DataSource     = enumerable;
                 repeater2.ItemDataBound += this.rptPointGifts_ItemDataBound;
                 repeater2.DataBind();
             }
             OrderItemStatus itemStatus = orderInfo.ItemStatus;
             DateTime        obj;
             if (DataBinder.Eval(e.Item.DataItem, "FinishDate") != DBNull.Value)
             {
                 obj = (DateTime)DataBinder.Eval(e.Item.DataItem, "FinishDate");
             }
             else
             {
                 dateTime = DateTime.Now;
                 obj      = dateTime.AddYears(-1);
             }
             DateTime dateTime3 = obj;
             string   text4     = "";
             if (DataBinder.Eval(e.Item.DataItem, "Gateway") != null && !(DataBinder.Eval(e.Item.DataItem, "Gateway") is DBNull))
             {
                 text4 = (string)DataBinder.Eval(e.Item.DataItem, "Gateway");
             }
             RefundInfo refundInfo = TradeHelper.GetRefundInfo(text);
             if (htmlAnchor2 != null)
             {
                 if (orderInfo.OrderType == OrderType.ServiceOrder)
                 {
                     htmlAnchor2.Visible = (orderStatus == OrderStatus.BuyerAlreadyPaid && orderInfo.ItemStatus == OrderItemStatus.Nomarl && orderInfo.LineItems.Count != 0);
                     if (htmlAnchor2.Visible)
                     {
                         LineItemInfo value2 = orderInfo.LineItems.FirstOrDefault().Value;
                         if (value2.IsRefund)
                         {
                             if (value2.IsOverRefund)
                             {
                                 htmlAnchor2.Visible = true;
                             }
                             else if (value2.IsValid)
                             {
                                 htmlAnchor2.Visible = true;
                             }
                             else if (DateTime.Now >= value2.ValidStartDate.Value && DateTime.Now <= value2.ValidEndDate.Value)
                             {
                                 htmlAnchor2.Visible = true;
                             }
                             else
                             {
                                 htmlAnchor2.Visible = false;
                             }
                         }
                         else
                         {
                             htmlAnchor2.Visible = false;
                         }
                     }
                 }
                 else
                 {
                     htmlAnchor2.Visible = (orderStatus == OrderStatus.BuyerAlreadyPaid && orderInfo.ItemStatus == OrderItemStatus.Nomarl && orderInfo.LineItems.Count != 0 && orderInfo.GetPayTotal() > decimal.Zero);
                 }
             }
             if (htmlAnchor != null)
             {
                 htmlAnchor.Visible = (orderInfo.OrderType == OrderType.ServiceOrder && orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid);
             }
             SiteSettings masterSettings2 = SettingsManager.GetMasterSettings();
             if (!string.IsNullOrEmpty(orderInfo.TakeCode) && (orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid || orderInfo.OrderStatus == OrderStatus.WaitBuyerPay))
             {
                 htmlAnchor10.Visible = true;
             }
             if (!htmlAnchor2.Visible && !htmlAnchor4.Visible && !htmlAnchor10.Visible && !htmlAnchor6.Visible && !htmlAnchor3.Visible && !htmlAnchor7.Visible && !htmlAnchor8.Visible && !htmlAnchor9.Visible && !htmlAnchor5.Visible && !htmlAnchor.Visible)
             {
                 htmlGenericControl.Visible = false;
             }
             if (orderInfo.FightGroupId > 0)
             {
                 FightGroupInfo fightGroup = VShopHelper.GetFightGroup(orderInfo.FightGroupId);
                 if (fightGroup != null)
                 {
                     htmlAnchor2.Visible = (fightGroup.Status != 0 && orderInfo.GetPayTotal() > decimal.Zero && (refundInfo == null || refundInfo.HandleStatus == RefundStatus.Refused) && orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid);
                 }
             }
         }
     }
 }