public NewLineItemInfo GetNewLineItemInfo(LineItemInfo item, string OrderId) { NewLineItemInfo newLineItemInfo = new NewLineItemInfo(); newLineItemInfo.OrderId = OrderId; newLineItemInfo.ThumbnailsUrl = (string.IsNullOrEmpty(item.ThumbnailsUrl) ? HiContext.Current.SiteSettings.DefaultProductThumbnail2 : item.ThumbnailsUrl.Replace("thumbs40/40", "thumbs60/60")); newLineItemInfo.ReplaceInfo = item.ReplaceInfo; newLineItemInfo.ReturnInfo = item.ReturnInfo; newLineItemInfo.ItemDescription = item.ItemDescription; newLineItemInfo.RealTotalPrice = decimal.Parse(item.RealTotalPrice.F2ToString("f2")); newLineItemInfo.ItemAdjustedPrice = item.ItemAdjustedPrice; newLineItemInfo.ShipmentQuantity = item.ShipmentQuantity; newLineItemInfo.ItemCostPrice = item.ItemCostPrice; newLineItemInfo.ItemDescription = item.ItemDescription; newLineItemInfo.ItemListPrice = item.ItemListPrice; newLineItemInfo.ItemWeight = item.ItemWeight; newLineItemInfo.ProductId = item.ProductId; newLineItemInfo.PromoteType = item.PromoteType; newLineItemInfo.PromotionId = item.PromotionId; newLineItemInfo.PromotionName = item.PromotionName; newLineItemInfo.RefundAmount = item.RefundAmount; newLineItemInfo.SKU = item.SKU; newLineItemInfo.SKUContent = item.SKUContent; newLineItemInfo.SkuId = item.SkuId; newLineItemInfo.ProductId = item.ProductId; newLineItemInfo.Quantity = item.Quantity; newLineItemInfo.OrderId = OrderId; newLineItemInfo.SkuId = item.SkuId; newLineItemInfo.Status = item.Status; newLineItemInfo.StatusText = item.StatusText; return(newLineItemInfo); }
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; } } } } }