public void ConfirmPay(HttpContext context) { string text = context.Request["id"]; if (string.IsNullOrWhiteSpace(text)) { throw new HidistroAshxException("错误的编号"); } OrderInfo orderInfo = new OrderDao().GetOrderInfo(text); if (orderInfo == null) { throw new HidistroAshxException("错误的编号"); } if (!orderInfo.CheckAction(OrderActions.SELLER_CONFIRM_PAY)) { throw new HidistroAshxException("权限不足"); } PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode("hishop.plugins.payment.bankrequest"); if (paymentMode != null) { orderInfo.Gateway = paymentMode.Gateway; orderInfo.PaymentType = paymentMode.Name; orderInfo.PaymentTypeId = paymentMode.ModeId; } else { orderInfo.Gateway = "hishop.plugins.payment.bankrequest"; orderInfo.PaymentType = "线下支付"; orderInfo.PaymentTypeId = 0; } if (orderInfo.PaymentType.Length > 8) { orderInfo.PaymentType = orderInfo.PaymentType.Substring(0, 8) + "..."; } int num = 0; int num2 = 0; int num3 = 0; if (orderInfo.CountDownBuyId > 0) { string empty = string.Empty; foreach (KeyValuePair <string, LineItemInfo> lineItem in orderInfo.LineItems) { CountDownInfo countDownInfo = TradeHelper.CheckUserCountDown(lineItem.Value.ProductId, orderInfo.CountDownBuyId, lineItem.Value.SkuId, orderInfo.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, out empty, orderInfo.StoreId); if (countDownInfo == null) { throw new HidistroAshxException(empty); } } } if (orderInfo.FightGroupId > 0) { string empty2 = string.Empty; foreach (KeyValuePair <string, LineItemInfo> lineItem2 in orderInfo.LineItems) { FightGroupActivityInfo fightGroupActivityInfo = VShopHelper.CheckUserFightGroup(lineItem2.Value.ProductId, orderInfo.FightGroupActivityId, orderInfo.FightGroupId, lineItem2.Value.SkuId, orderInfo.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, lineItem2.Value.Quantity, out empty2); if (fightGroupActivityInfo == null) { throw new HidistroAshxException(empty2); } } } if (orderInfo.GroupBuyId > 0) { GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy(orderInfo.GroupBuyId); if (groupBuy == null || groupBuy.Status != GroupBuyStatus.UnderWay) { throw new HidistroAshxException("当前的订单为团购订单,此团购活动已结束,所以不能支付"); } num2 = PromoteHelper.GetOrderCount(orderInfo.GroupBuyId); num = groupBuy.MaxCount; num3 = orderInfo.GetGroupBuyOerderNumber(); if (num < num2 + num3) { throw new HidistroAshxException("当前的订单为团购订单,订购数量已超过订购总数,所以不能支付"); } } if (orderInfo.PreSaleId > 0) { ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId); if (productPreSaleInfo == null) { throw new HidistroAshxException("预售活动不存在"); } if (!orderInfo.DepositDate.HasValue && productPreSaleInfo.PreSaleEndDate < DateTime.Now) { throw new HidistroAshxException("预售活动已结束不能支付定金,所以不能确认收款"); } } string empty3 = string.Empty; switch (TradeHelper.CheckOrderBeforePay(orderInfo, out empty3)) { case 1: throw new HidistroAshxException($"当前有商品{empty3}下架或者被删除,不能确认收款"); case 2: if ((orderInfo.PreSaleId <= 0 || orderInfo.DepositDate.HasValue) && orderInfo.PreSaleId > 0) { break; } throw new HidistroAshxException($"当前有商品{empty3}库存不足,不能确认收款"); } if (OrderHelper.ConfirmPay(orderInfo)) { if (orderInfo.GroupBuyId > 0 && num == num2 + num3) { PromoteHelper.SetGroupBuyEndUntreated(orderInfo.GroupBuyId); } if (orderInfo.ParentOrderId == "-1") { OrderQuery orderQuery = new OrderQuery(); orderQuery.ParentOrderId = orderInfo.OrderId; IList <OrderInfo> listUserOrder = MemberProcessor.GetListUserOrder(orderInfo.UserId, orderQuery); foreach (OrderInfo item in listUserOrder) { OrderHelper.OrderConfirmPaySendMessage(item); } } else { OrderHelper.OrderConfirmPaySendMessage(orderInfo); } base.ReturnSuccessResult(context, "成功的确认了订单收款", 0, true); return; } throw new HidistroAshxException("确认订单收款失败"); }
protected override void AttachChildControls() { this.orderId = this.Page.Request.QueryString["orderId"]; OrderInfo orderInfo = ShoppingProcessor.GetOrderInfo(this.orderId); if (orderInfo == null || orderInfo.UserId != HiContext.Current.UserId) { base.GotoResourceNotFound(""); } this.litOrderId = (Literal)this.FindControl("litOrderId"); this.litOrderTotal = (Literal)this.FindControl("litOrderTotal"); this.litPaymentType = (HtmlInputHidden)this.FindControl("litPaymentType"); this.litPaymentName = (Literal)this.FindControl("litPaymentName"); this.litPaymentName.Text = orderInfo.PaymentType; this.litErrorMsg = (Literal)this.FindControl("litErrorMsg"); this.litPaymentType.SetWhenIsNotNull(orderInfo.PaymentTypeId.ToString()); this.litOrderId.SetWhenIsNotNull(this.orderId); this.litOrderTotal.SetWhenIsNotNull(orderInfo.GetTotal(false).F2ToString("f2")); this.divhelper = (HtmlGenericControl)this.FindControl("helper"); this.btnToPay = (HtmlAnchor)this.FindControl("btnToPay"); Dictionary <string, LineItemInfo> lineItems = orderInfo.LineItems; foreach (LineItemInfo value in lineItems.Values) { int productId = value.ProductId; SiteSettings masterSettings = SettingsManager.GetMasterSettings(); ProductInfo productSimpleInfo = ProductBrowser.GetProductSimpleInfo(productId); if (productSimpleInfo == null || productSimpleInfo.SaleStatus == ProductSaleStatus.Delete) { this.litErrorMsg.Text = "订单内商品已经被管理员删除"; this.btnToPay.Visible = false; } else if (productSimpleInfo.SaleStatus == ProductSaleStatus.OnStock) { this.litErrorMsg.Text = "订单内商品已入库"; this.btnToPay.Visible = false; } else { int num = 0; if (productSimpleInfo.Skus.ContainsKey(value.SkuId)) { SKUItem sKUItem = productSimpleInfo.Skus[value.SkuId]; num = sKUItem.MaxStock; continue; } this.litErrorMsg.Text = "订单中有商品规格不存在,不能进行支付"; this.btnToPay.Visible = false; } return; } string str = ""; if (orderInfo.PreSaleId > 0) { ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId); if (productPreSaleInfo == null) { this.litErrorMsg.Text = "预售活动不存在不能支付"; return; } if (!orderInfo.DepositDate.HasValue) { if (productPreSaleInfo.PreSaleEndDate < DateTime.Now) { this.litErrorMsg.Text = "您支付晚了,预售活动已经结束"; return; } if (!TradeHelper.CheckOrderStockBeforePay(orderInfo, out str)) { this.litErrorMsg.Text = str + ",库存不足,不能进行支付"; return; } } if (orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay) { if (productPreSaleInfo.PaymentStartDate > DateTime.Now) { this.litErrorMsg.Text = "尾款支付尚未开始"; return; } DateTime t = productPreSaleInfo.PaymentEndDate.AddDays(1.0); if (t <= DateTime.Now) { this.litErrorMsg.Text = "尾款支付已结束,不能支付!"; return; } } } else if (!TradeHelper.CheckOrderStockBeforePay(orderInfo, out str)) { this.litErrorMsg.Text = str + ",库存不足,不能进行支付"; return; } if (orderInfo.Gateway != "hishop.plugins.payment.bankrequest") { this.divhelper.Visible = false; } else { this.divhelper.Visible = true; this.litHelperText = (Literal)this.FindControl("litHelperText"); PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(ShoppingProcessor.GetPaymentGateway(EnumPaymentType.OfflinePay)); if (paymentMode != null) { this.litHelperText.SetWhenIsNotNull(paymentMode.Description); } } this.btnToPay = (HtmlAnchor)this.FindControl("btnToPay"); if (orderInfo.OrderStatus != OrderStatus.WaitBuyerPay) { this.btnToPay.Visible = false; } if (this.btnToPay != null) { this.btnToPay.HRef = "FinishOrder?orderId=" + this.orderId + "&action=topay"; } else { this.GotoPay(); } if (this.btnToPay != null && (orderInfo.Gateway == "hishop.plugins.payment.podrequest" || orderInfo.Gateway == "hishop.plugins.payment.bankrequest")) { this.btnToPay.Visible = false; } PageTitle.AddSiteNameTitle("下单成功"); if (!this.Page.IsPostBack) { string text = HttpContext.Current.Request.QueryString["action"]; if (!string.IsNullOrEmpty(text) && text == "topay") { this.GotoPay(); } } }
protected void Page_Load(object sender, EventArgs e) { string text = ""; PaymentModeInfo paymentModeInfo = null; NameValueCollection form = base.Request.Form; string parameter = this.GetParameter("FOR"); string parameter2 = this.GetParameter("HIGW"); if (string.IsNullOrEmpty(parameter2)) { parameter2 = this.GetParameter("Gateway"); } try { NameValueCollection param = new NameValueCollection { base.Request.Form, base.Request.QueryString }; if (string.IsNullOrEmpty(parameter2)) { base.Response.Write("fail"); Globals.WriteLog(param, "网关信息为空", "", "", "Outpay"); throw new Exception("网关信息为空-支付宝通知"); } paymentModeInfo = TradeHelper.GetPaymentMode(parameter2); if (paymentModeInfo == null) { base.Response.Write("fail"); Globals.WriteLog(param, "网关信息错误---" + parameter2, "", "", "Outpay"); throw new Exception("网关信息错误-支付宝通知"); } string configXml = HiCryptographer.Decrypt(paymentModeInfo.Settings); this.Notify = Hishop.Plugins.OutpayNotify.CreateInstance(parameter2, form); if (this.Notify == null) { base.Response.Write("fail"); Globals.WriteLog(param, "创建回调实例失败---" + parameter2, "", "", "Outpay"); throw new Exception("创建回调实例失败-支付宝通知"); } bool flag = false; try { flag = this.Notify.VerifyNotify(600, configXml); } catch (Exception ex) { Globals.AppendLog(param, "通知网关或者验签失败" + ex.Message + "-" + parameter2, "", "", "Outpay"); base.Response.Write("fail"); base.Response.End(); throw new Exception("通知网关或者验签失败-支付宝通知"); } if (flag) { IList <string> outpayId = this.Notify.GetOutpayId(); IList <string> gatewayOrderId = this.Notify.GetGatewayOrderId(); IList <decimal> orderAmount = this.Notify.GetOrderAmount(); IList <DateTime> payTime = this.Notify.GetPayTime(); IList <bool> status = this.Notify.GetStatus(); IList <string> errMsg = this.Notify.GetErrMsg(); if (outpayId == null || gatewayOrderId == null || orderAmount == null || payTime == null || outpayId.Count == 0 || gatewayOrderId.Count == 0 || orderAmount.Count == 0 || payTime.Count == 0) { Globals.AppendLog(param, "获取返回参数错误,参数为空-" + parameter2, "", "", "Outpay"); } else if (outpayId.Count != gatewayOrderId.Count || outpayId.Count != orderAmount.Count || outpayId.Count != payTime.Count) { Globals.AppendLog(param, "获取返回参数错误,参数不匹配-" + parameter2, "", "", "Outpay"); } else { string text2 = ""; string text3 = ""; string text4 = ""; string text5 = ""; string text6 = ""; string text7 = ""; string text8 = ""; for (int i = 0; i < outpayId.Count; i++) { if (outpayId[i].ToLower().StartsWith("pre")) { if (outpayId[i].Length > 5) { text8 = outpayId[i].Substring(5); } } else { text8 = outpayId[i]; } text = text + text8 + ","; text2 = text2 + ((i == 0) ? "" : ",") + text8; text3 = text3 + ((i == 0) ? "" : ",") + gatewayOrderId[i]; text4 = text4 + ((i == 0) ? "" : ",") + orderAmount[i]; text5 = text5 + ((i == 0) ? "" : ",") + payTime[i]; text6 = text6 + ((i == 0) ? "" : ",") + status[i].ToString(); text7 = text7 + ((i == 0) ? "" : ",") + errMsg[i]; if (status[i]) { this.CheckResult(parameter.ToNullString(), outpayId[i], true, ""); } else { this.CheckResult(parameter.ToNullString(), outpayId[i], false, errMsg[i]); } } text = text.TrimEnd(','); IDictionary <string, string> dictionary = new Dictionary <string, string>(); dictionary.Add("outpayIdLists", text2); dictionary.Add("getwayOrderIdLists", text3); dictionary.Add("payAmountLists", text4); dictionary.Add("payTimeLists", text5); dictionary.Add("IsSuccesss", text6); dictionary.Add("ErrMsgs", text7); base.Response.Write("success"); } goto end_IL_004c; } Globals.AppendLog(param, "验签失败-" + parameter2, "", "", "Outpay"); base.Response.Write("fail"); throw new Exception("验签失败-支付宝通知"); end_IL_004c :; } catch (Exception ex2) { if (parameter.ToLower().Equals("balancedraw")) { MemberHelper.OnLineBalanceDrawRequest_Alipay_AllError(text, ex2.Message); } else if (parameter.ToLower().Equals("splittin")) { MemberHelper.OnLineSplittinDraws_Alipay_AllError(text, ex2.Message); } else if (parameter.ToLower().Equals("balancedraw4supplier")) { BalanceHelper.OnLineBalanceDraws_Alipay_AllError(text, ex2.Message); } else if (parameter.ToLower().Equals("balancedraw4store")) { StoreBalanceHelper.OnLineBalanceDraws_Alipay_AllError(text, ex2.Message); } } }
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"); } }
private void UserPayOrder() { if (this.Order.OrderStatus == OrderStatus.Closed) { OrderHelper.SetExceptionOrder(this.Order.OrderId, "支付异常,请联系买家退款"); Messenger.OrderException(Users.GetUser(this.Order.UserId), this.Order, "订单支付异常,请联系卖家退款.订单号:" + this.Order.OrderId); } else if (this.Order.OrderStatus == OrderStatus.BuyerAlreadyPaid) { if (this.Order.FightGroupId > 0) { this.toFightGroupSuccess(); } else { base.Response.Write(string.Format("<p style=\"font-size:16px;\">恭喜您,订单已成功完成支付:{0}</br>支付金额:{1}<br><a href=\"{2}\">查看订单</a></p>", this.OrderId, this.Amount.ToString("F"), this.GetReturnLink(this.Order.OrderSource))); } } else { int maxCount = 0; int yetOrderNum = 0; int currentOrderNum = 0; if (this.Order.GroupBuyId > 0) { GroupBuyInfo groupBuy = TradeHelper.GetGroupBuy(this.Order.GroupBuyId); if (groupBuy == null || groupBuy.Status != GroupBuyStatus.UnderWay) { base.Response.Write($"<p style=\"font-size:16px;\">订单为团购订单,团购活动已结束,支付失败<br><a href=\"{this.GetReturnLink(this.Order.OrderSource)}\">查看订单</a></p>"); return; } yetOrderNum = TradeHelper.GetOrderCount(this.Order.GroupBuyId); currentOrderNum = this.Order.GetGroupBuyOerderNumber(); maxCount = groupBuy.MaxCount; if (maxCount < yetOrderNum + currentOrderNum) { base.Response.Write($"<p style=\"font-size:16px;\">订单为团购订单,订购数量超过订购总数,支付失败<br><a href=\"{this.GetReturnLink(this.Order.OrderSource)}\">查看订单</a></p>"); return; } } if (this.Order.CheckAction(OrderActions.BUYER_PAY) && TradeHelper.UpdateOrderStatus(this.Order)) { Task.Factory.StartNew(delegate { TradeHelper.UserPayOrder(this.Order, false, true); try { if (this.Order.FightGroupId > 0) { VShopHelper.SetFightGroupSuccess(this.Order.FightGroupId); } if (this.Order.GroupBuyId > 0 && maxCount == yetOrderNum + currentOrderNum) { TradeHelper.SetGroupBuyEndUntreated(this.Order.GroupBuyId); } if (this.Order.ParentOrderId == "-1") { OrderQuery orderQuery = new OrderQuery(); orderQuery.ParentOrderId = this.Order.OrderId; IList <OrderInfo> listUserOrder = MemberProcessor.GetListUserOrder(this.Order.UserId, orderQuery); foreach (OrderInfo item in listUserOrder) { OrderHelper.OrderConfirmPaySendMessage(item); } } else { OrderHelper.OrderConfirmPaySendMessage(this.Order); } } catch (Exception ex) { IDictionary <string, string> dictionary = new Dictionary <string, string>(); dictionary.Add("ErrorMessage", ex.Message); dictionary.Add("StackTrace", ex.StackTrace); if (ex.InnerException != null) { dictionary.Add("InnerException", ex.InnerException.ToString()); } if (ex.GetBaseException() != null) { dictionary.Add("BaseException", ex.GetBaseException().Message); } if (ex.TargetSite != (MethodBase)null) { dictionary.Add("TargetSite", ex.TargetSite.ToString()); } dictionary.Add("ExSource", ex.Source); Globals.AppendLog(dictionary, "支付更新订单收款记录或者消息通知时出错:" + ex.Message, "", "", "UserPay"); } this.Order.OnPayment(); }); if (this.Order.FightGroupId > 0) { this.toFightGroupSuccess(); } else { base.Response.Write(string.Format("<p style=\"font-size:16px;\">恭喜您,订单已成功完成支付:{0}</br>支付金额:{1}<br><a href=\"{2}\">查看订单</a></p>", this.OrderId, this.Amount.ToString("F"), this.GetReturnLink(this.Order.OrderSource))); } } else if (this.Order.GroupBuyId > 0) { this.toFightGroupSuccess(); } else { base.Response.Write(string.Format("<p style=\"font-size:16px;\">恭喜您,订单已成功完成支付:{0}</br>支付金额:{1}<br><a href=\"{2}\">查看订单</a></p>", this.OrderId, this.Amount.ToString("F"), this.GetReturnLink(this.Order.OrderSource))); } } }
private void btnSendGoodsReplace_Click(object sender, EventArgs e) { this.replaceId = Convert.ToInt32(base.GetParameter("ReplaceId", false)); ReplaceInfo replaceInfo = TradeHelper.GetReplaceInfo(this.replaceId); if (replaceInfo == null) { this.ShowMessage("错误的换货信息", false, "", 1); } else { OrderInfo orderInfo = TradeHelper.GetOrderInfo(replaceInfo.OrderId); if (orderInfo == null) { this.ShowMessage("错误的订单信息", false, "", 1); } else if (orderInfo.LineItems.ContainsKey(replaceInfo.SkuId)) { if (orderInfo.LineItems[replaceInfo.SkuId].Status != LineItemStatus.MerchantsAgreedForReplace && orderInfo.LineItems[replaceInfo.SkuId].Status != LineItemStatus.UserDeliveryForReplace) { this.ShowMessage("商品换货状态不正确", false, "", 1); } else { string value = this.hidExpressCompanyName.Value; string value2 = this.hidShipOrderNumber.Value; if (string.IsNullOrEmpty(value)) { this.ShowMessage("请选择一个快递公司!", false, "", 1); } else { string text = ""; string text2 = ""; ExpressCompanyInfo expressCompanyInfo = ExpressHelper.FindNode(value); if (value != null) { text = expressCompanyInfo.Kuaidi100Code; text2 = expressCompanyInfo.Name; if (value2.Trim() == "" || value2.Length > 20) { this.ShowMessage("请输入快递编号,长度为1-20位!", false, "", 1); } else if (TradeHelper.ReplaceUserSendGoods(replaceInfo.ReplaceId, text, text2, value2, orderInfo.OrderId, replaceInfo.SkuId)) { if (text.ToUpper() == "HTKY") { ExpressHelper.GetDataByKuaidi100(text, value2); } this.ShowMessage("发货成功", true, this.returnUrl, 2); } else { this.ShowMessage("发货失败!", false, "", 1); } } else { this.ShowMessage("请选择快递公司", false, "", 1); } } } } else { this.ShowMessage("订单中不包含商品信息", false, "", 1); } } }
protected override void AttachChildControls() { string text = ""; string text2 = ""; string text3 = ""; decimal num = default(decimal); bool flag = false; string a = (this.Page.Request["action"] == null) ? "" : this.Page.Request["action"].ToString().ToLower(); if (a == "getstatus") { HttpContext.Current.Response.Clear(); int num2 = 0; int num3 = 0; while (num2 != 1) { num3++; Thread.Sleep(500); text3 = ((this.Page.Request["orderId"] == null) ? "" : this.Page.Request["orderId"].ToString()); if (text3 != "") { if (this.Page.Request["isrecharge"].ToInt(0) == 1) { num2 = (MemberProcessor.IsRechargeSuccess(text3) ? 1 : (-1)); } else { int orderStatus = TradeHelper.GetOrderStatus(text3); num2 = ((orderStatus == 2) ? 1 : (-1)); } } else { num2 = -1; } if (num3 == 30) { break; } } StringBuilder stringBuilder = new StringBuilder("{"); stringBuilder.AppendFormat("\"Status\":\"{0}\"", num2); stringBuilder.Append("}"); HttpContext.Current.Response.ContentType = "application/json"; HttpContext.Current.Response.Write(stringBuilder.ToString()); HttpContext.Current.Response.End(); } else { text = HttpContext.Current.Request.QueryString["QRCodeImg"]; text2 = HttpContext.Current.Request.QueryString["QrCodeUrl"]; text3 = HttpContext.Current.Request.QueryString["OrderId"]; int num4 = 0; string text4 = ""; int.TryParse(HttpContext.Current.Request.QueryString["status"], out num4); if (string.IsNullOrEmpty(text) || string.IsNullOrEmpty(text2) || num4 != 1) { text4 = "错误的二维码信息"; } if (num4 == 1 && text4 == "") { OrderInfo orderInfo = TradeHelper.GetOrderInfo(text3); if (orderInfo == null) { text4 = "错误的订单信息"; } else if (orderInfo.OrderStatus != OrderStatus.WaitBuyerPay) { text4 = "订单当前状态不能支付"; } if (orderInfo != null) { if (orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid) { text4 = "订单已支付"; } num = orderInfo.GetTotal(true); } } this.divMessage = (HtmlGenericControl)this.FindControl("divMessage"); this.divSuccess = (HtmlGenericControl)this.FindControl("divSuccess"); this.divError = (HtmlGenericControl)this.FindControl("divError"); this.ErrorMsg = (HtmlGenericControl)this.FindControl("ErrorMsg"); this.QRCodeImg = (HtmlImage)this.FindControl("QRCodeImg"); this.paymoney = (HtmlGenericControl)this.FindControl("paymoney"); this.txt_OrderId = (HtmlInputHidden)this.FindControl("txt_OrderId"); this.defaultLink = (HtmlAnchor)this.FindControl("defaultLink"); this.userLink = (HtmlAnchor)this.FindControl("userLink"); this.orderLink = (HtmlAnchor)this.FindControl("orderLink"); if (this.txt_OrderId != null) { this.txt_OrderId.Value = text3; } if (this.orderLink != null) { this.orderLink.HRef = base.GetRouteUrl("user_OrderDetails", new { OrderId = text3 }); } if (this.userLink != null) { this.userLink.HRef = "/User/UserDefault"; } if (this.defaultLink != null) { this.defaultLink.HRef = "/"; } if (this.divError != null && this.divMessage != null) { if (text4 != "") { this.divError.Visible = true; this.divMessage.Visible = false; this.ErrorMsg.InnerHtml = text4; } else { this.divMessage.Visible = true; this.divError.Visible = false; if (this.paymoney != null) { this.paymoney.InnerHtml = "¥" + num.F2ToString("f2"); } if (this.QRCodeImg != null) { this.QRCodeImg.Src = text; } } } } }
protected override void Read(PacketStream stream) { // stream.ReadUInt32(); TradeHelper.TradeRequestCancel(Connection); }
private void UserPayOrder() { if (this.Order != null && this.Order.OrderStatus == OrderStatus.Closed) { OrderHelper.SetExceptionOrder(this.Order.OrderId, "支付异常,请联系买家退款"); Messenger.OrderException(Users.GetUser(this.Order.UserId), this.Order, "订单支付异常,请联系卖家退款.订单号:" + this.Order.OrderId); base.Response.Write("success"); } else if (this.Order.OrderStatus == OrderStatus.BuyerAlreadyPaid) { Globals.WriteLog(new NameValueCollection { this.Page.Request.Form, this.Page.Request.QueryString }, "订单状态为已支付", "", "", "alipay"); base.Response.Write("success"); } else { int maxCount = 0; int yetOrderNum = 0; int currentOrderNum = 0; if (this.Order.GroupBuyId > 0) { GroupBuyInfo groupBuy = TradeHelper.GetGroupBuy(this.Order.GroupBuyId); if (groupBuy == null || groupBuy.Status != GroupBuyStatus.UnderWay) { Globals.WriteLog(new NameValueCollection { this.Page.Request.Form, this.Page.Request.QueryString }, "错误的团购信息或者状态", "", "", "alipay"); base.Response.Write("success"); return; } yetOrderNum = TradeHelper.GetOrderCount(this.Order.GroupBuyId); currentOrderNum = this.Order.GetGroupBuyOerderNumber(); maxCount = groupBuy.MaxCount; if (maxCount < yetOrderNum + currentOrderNum) { Globals.WriteLog(new NameValueCollection { this.Page.Request.Form, this.Page.Request.QueryString }, "团购数量已超过指定数量错", "", "", "alipay"); base.Response.Write("success"); return; } } if (this.Order.CheckAction(OrderActions.BUYER_PAY) && TradeHelper.UpdateOrderStatus(this.Order)) { Task.Factory.StartNew(delegate { TradeHelper.UserPayOrder(this.Order, false, true); try { if (this.offlineOrder != null) { OrderHelper.UpdateOrderPaymentTypeOfAPI(this.Order); OrderHelper.ConfirmTakeGoods(this.Order, true); } if (this.Order.GroupBuyId > 0 && maxCount == yetOrderNum + currentOrderNum) { TradeHelper.SetGroupBuyEndUntreated(this.Order.GroupBuyId); } if (this.Order.UserId != 0 && this.Order.UserId != 1100) { Hidistro.Entities.Members.MemberInfo user = Users.GetUser(this.Order.UserId); string verificationPasswords = ""; if (this.Order.OrderType == OrderType.ServiceOrder) { verificationPasswords = OrderHelper.GetVerificationPasswordsOfOrderId(this.Order.OrderId); } if (user != null) { Messenger.OrderPayment(user, this.Order, this.Order.GetTotal(false), verificationPasswords); } } StoresInfo storesInfo = null; if (this.Order.StoreId > 0) { storesInfo = DepotHelper.GetStoreById(this.Order.StoreId); } if (storesInfo != null) { VShopHelper.AppPsuhRecordForStore(storesInfo.StoreId, this.Order.OrderId, "", EnumPushStoreAction.StoreOrderPayed); if (this.offlineOrder == null) { if (this.Order.ShippingModeId == -2) { VShopHelper.AppPsuhRecordForStore(storesInfo.StoreId, this.Order.OrderId, "", EnumPushStoreAction.TakeOnStoreOrderWaitConfirm); } else { VShopHelper.AppPsuhRecordForStore(storesInfo.StoreId, this.Order.OrderId, "", EnumPushStoreAction.StoreOrderWaitSendGoods); } } } if (this.offlineOrder == null) { ShippersInfo defaultOrFirstShipper = SalesHelper.GetDefaultOrFirstShipper(0); Messenger.OrderPaymentToShipper(defaultOrFirstShipper, storesInfo, null, this.Order, this.Order.GetTotal(false)); } this.Order.OnPayment(); } catch (Exception ex) { IDictionary<string, string> dictionary = new Dictionary<string, string>(); dictionary.Add("ErrorMessage", ex.Message); dictionary.Add("StackTrace", ex.StackTrace); if (ex.InnerException != null) { dictionary.Add("InnerException", ex.InnerException.ToString()); } if (ex.GetBaseException() != null) { dictionary.Add("BaseException", ex.GetBaseException().Message); } if (ex.TargetSite != (MethodBase)null) { dictionary.Add("TargetSite", ex.TargetSite.ToString()); } dictionary.Add("ExSource", ex.Source); Globals.AppendLog(dictionary, "支付更新订单收款记录或者消息通知时出错:" + ex.Message, "", "", "UserPay"); } }); base.Response.Write("success"); } else { Globals.WriteLog(new NameValueCollection { this.Page.Request.Form, this.Page.Request.QueryString }, "订单不是待支付状态,或者更新订单状态失败", "", "", "alipay"); base.Response.Write("success"); } } }
/// <summary> /// 订单退款 /// </summary> /// <param name="order"></param> /// <returns></returns> protected string OrderRefund(DataRow order) { try { ErrorLog.Write("进入退款中:" + order["PaymentType"].ToString()); #region 微信退款 if (order["PaymentType"].ToString().IndexOf("微信") >= 0)//微信退款 { ErrorLog.Write("【微信退款】开始:" + order["OrderId"].ToString()); PackageInfo packageInfo = new PackageInfo(); SiteSettings masterSettings = SettingsManager.GetMasterSettings(false); PayClient payClient = new PayClient(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, masterSettings.WeixinPartnerID, masterSettings.WeixinPartnerKey, masterSettings.WeixinPaySignKey); packageInfo.OutTradeNo = order["OrderId"].ToString(); packageInfo.OutRefundNo = order["OrderId"].ToString();//退款ID默认为订单号 decimal totle = 0; decimal.TryParse(order["OrderTotal"].ToString(), out totle); packageInfo.RefundFee = (decimal)Math.Round(totle, 2) * 100; packageInfo.TotalFee = (decimal)Math.Round(totle, 2) * 100; ErrorLog.Write("【微信退款】退款参数:" + Newtonsoft.Json.JsonConvert.SerializeObject(packageInfo)); string ret = string.Empty; int type = 1; if (order["SourceOrder"].ToString() == "11" || order["SourceOrder"].ToString() == "12") { type = 2; } ret = Refund.Run(order["GatewayOrderId"].ToString(), order["OrderId"].ToString(), packageInfo.TotalFee.ToString(), packageInfo.RefundFee.ToString(), type); //ret = payClient.RequestRefund(packageInfo); ErrorLog.Write("【微信退款】" + order["OrderId"].ToString() + "退款结果:" + ret); if (string.IsNullOrEmpty(ret) || ret.ToUpper().IndexOf("SUCCESS") >= 0) //退款成功 { Action ac = new Action(() => { TradeHelper.RefundOrder(order["OrderId"].ToString());//恢复库存及现金卷 TradeHelper.RefundOrder_Split(order["OrderId"].ToString(), order["SourceOrderId"].ToString()); TradeHelper.RefundSuccess(order["OrderId"].ToString(), 1); }); ac.BeginInvoke(null, ac); return("退款成功!"); } return("微信退款失败,请重试或联系客服退款!"); } #endregion #region 支付宝退款 if (order["PaymentType"].ToString().IndexOf("支付宝") >= 0)//支付宝退款 { //退款批次号 string batch_no = order["OrderId"].ToString(); //必填,每进行一次即时到账批量退款,都需要提供一个批次号,必须保证唯一性 //退款请求时间 string refund_date = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"); //必填,格式为:yyyy-MM-dd hh:mm:ss //退款总笔数 string batch_num = "1"; //必填,即参数detail_data的值中,“#”字符出现的数量加1,最大支持1000笔(即“#”字符出现的最大数量999个) //单笔数据集 decimal totle = 0; decimal.TryParse(order["OrderTotal"].ToString(), out totle); string detail_data = order["GatewayOrderId"] + "^" + totle + "^协商退款"; //必填,格式详见“4.3 单笔数据集参数说明” //////////////////////////////////////////////////////////////////////////////////////////////// Config.Key = "vec1v8gshy4mo8lz735boyupyuhotjct"; //把请求参数打包成数组 SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string>(); sParaTemp.Add("partner", "2088121134306407"); sParaTemp.Add("_input_charset", "utf-8"); sParaTemp.Add("service", "refund_fastpay_by_platform_nopwd"); sParaTemp.Add("batch_no", batch_no); sParaTemp.Add("refund_date", refund_date); sParaTemp.Add("batch_num", batch_num); sParaTemp.Add("detail_data", detail_data); ErrorLog.Write("【支付宝退款】退款参数:" + Newtonsoft.Json.JsonConvert.SerializeObject(sParaTemp)); //建立请求 string sHtmlText = Submit.BuildRequest(sParaTemp); ErrorLog.Write("【支付宝退款】" + order["OrderId"].ToString() + ";海美生活订单退款:" + sHtmlText); XmlDocument xmlDoc = new XmlDocument(); try { xmlDoc.LoadXml(sHtmlText); string strXmlResponse = xmlDoc.SelectSingleNode("/alipay/is_success").InnerText; if (strXmlResponse.ToLower() == "t")//退款成功 { Action ac = new Action(() => { //if (string.IsNullOrEmpty(order.SourceOrderId.ToString()))//非拆单 //{ TradeHelper.RefundOrder(order["OrderId"].ToString().ToString());//恢复库存及现金卷 //} //else //{ TradeHelper.RefundOrder_Split(order["OrderId"].ToString(), order["SourceOrderId"].ToString()); //} TradeHelper.RefundSuccess(order["OrderId"].ToString(), 1); }); ac.BeginInvoke(null, ac); //Action ac = new Action(() => //{ // if (string.IsNullOrEmpty(order["SourceOrderId"].ToString()))//非拆单 // { // TradeHelper.RefundOrder(order["OrderId"].ToString());//恢复库存及现金卷 // } // else // { // TradeHelper.RefundOrder_Split(order["OrderId"].ToString(), order["SourceOrderId"].ToString()); // } // TradeHelper.RefundSuccess(order["OrderId"].ToString(), 1); //}); //ac.BeginInvoke(null, ac); return("Ok"); } } catch (Exception exp) { ErrorLog.Write("【支付宝退款】" + exp.Message, exp); } } #endregion ErrorLog.Write("【支付宝退款】" + order["OrderId"].ToString() + "退款异常,请重试或联系客服退款!"); return("退款异常,请重试或联系客服退款!"); } catch (Exception ee) { ErrorLog.Write("【退款异常】" + Newtonsoft.Json.JsonConvert.SerializeObject(order), ee); return("退款执行异常"); } }
protected override void AttachChildControls() { this.isOffline = this.Page.Request["IsOffline"].ToBool(); this.orderId = Globals.StripAllTags(this.Page.Request.QueryString["orderId"].ToNullString()); this.litOrderId = (Literal)this.FindControl("litOrderId"); this.litOrderTotal = (Literal)this.FindControl("litOrderTotal"); this.litPaymentType = (HtmlInputHidden)this.FindControl("litPaymentType"); this.litPaymentName = (Literal)this.FindControl("litPaymentName"); this.linkToDetail = (HtmlAnchor)this.FindControl("linkToDetail"); this.litErrorMsg = (Literal)this.FindControl("litErrorMsg"); this.loadPanel = (HtmlGenericControl)this.FindControl("loadPanel"); this.errorPanel = (HtmlGenericControl)this.FindControl("errorPanel"); this.btnToPay = (HtmlAnchor)this.FindControl("btnToPay"); SiteSettings masterSettings = SettingsManager.GetMasterSettings(); string text = ""; string userAgent = HttpContext.Current.Request.UserAgent; this.loadPanel.Visible = true; StoreCollectionInfo storeCollectionInfo = null; if (this.isOffline) { storeCollectionInfo = StoresHelper.GetStoreCollectionInfo(this.orderId); if (storeCollectionInfo == null) { this.litErrorMsg.Text = "错误的订单编号"; this.loadPanel.Visible = false; this.errorPanel.Visible = true; return; } if (storeCollectionInfo.Status != 0) { this.litErrorMsg.Text = "订单状态不是待支付状态"; this.loadPanel.Visible = false; this.errorPanel.Visible = true; return; } if (this.linkToDetail != null) { this.linkToDetail.Visible = false; } } else { this.order = ShoppingProcessor.GetOrderInfo(this.orderId); if (this.order == null) { this.litErrorMsg.Text = "错误的订单编号"; this.loadPanel.Visible = false; this.errorPanel.Visible = true; return; } if (this.order.OrderStatus != OrderStatus.WaitBuyerPay) { this.litErrorMsg.Text = "订单状态不是待支付状态"; this.loadPanel.Visible = false; this.errorPanel.Visible = true; return; } storeCollectionInfo = StoresHelper.GetStoreCollectionInfoOfOrderId(this.orderId); this.litPaymentName.Text = this.order.PaymentType; this.litPaymentType.SetWhenIsNotNull(this.order.PaymentTypeId.ToString()); this.litOrderId.SetWhenIsNotNull(this.orderId); this.litOrderTotal.SetWhenIsNotNull(this.order.GetTotal(false).F2ToString("f2")); if (this.linkToDetail != null) { this.linkToDetail.Visible = true; this.linkToDetail.HRef = "MemberOrderDetails?OrderId=" + this.orderId; } } if (base.ClientType == ClientType.VShop) { if (!string.IsNullOrEmpty(masterSettings.WeixinAppId) && !string.IsNullOrEmpty(masterSettings.WeixinAppSecret) && !string.IsNullOrEmpty(masterSettings.WeixinPartnerID) && !string.IsNullOrEmpty(masterSettings.WeixinPartnerKey)) { if (!this.isOffline) { this.order.Gateway = "hishop.plugins.payment.weixinrequest"; this.order.PaymentTypeId = -2; this.order.PaymentType = "微信支付"; TradeHelper.UpdateOrderPaymentType(this.order); } if (storeCollectionInfo != null) { storeCollectionInfo.GateWay = "hishop.plugins.payment.weixinrequest"; storeCollectionInfo.PaymentTypeName = "微信支付"; storeCollectionInfo.PaymentTypeId = 1; StoresHelper.UpdateStoreCollectionInfo(storeCollectionInfo); } HttpContext.Current.Response.Redirect("~/pay/wx_Submit?orderId=" + this.orderId + "&IsOffline=" + this.isOffline.ToString() + "&from=appstore"); } else { this.litErrorMsg.Text = "未配置微信支付"; this.loadPanel.Visible = false; this.errorPanel.Visible = true; } } else { PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode("hishop.plugins.payment.ws_wappay.wswappayrequest"); if (paymentMode != null) { decimal amount = default(decimal); string subject = "门店APP订单支付"; string buyerEmail = ""; DateTime date = DateTime.Now; if (!this.isOffline) { subject = "门店APP线下支付"; text = paymentMode.Gateway; this.order.Gateway = paymentMode.Gateway; this.order.PaymentTypeId = paymentMode.ModeId; this.order.PaymentType = paymentMode.Name; TradeHelper.UpdateOrderPaymentType(this.order); amount = this.order.GetTotal(false); buyerEmail = this.order.EmailAddress; date = this.order.OrderDate; } if (storeCollectionInfo != null) { amount = storeCollectionInfo.PayAmount; storeCollectionInfo.GateWay = paymentMode.Gateway; storeCollectionInfo.PaymentTypeName = paymentMode.Name; storeCollectionInfo.PaymentTypeId = 2; StoresHelper.UpdateStoreCollectionInfo(storeCollectionInfo); date = storeCollectionInfo.CreateTime; } string attach = ""; string showUrl = string.Format("http://{0}/{1}/", HttpContext.Current.Request.Url.Host, "AliOH"); PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), this.orderId, amount, subject, "订单号-" + this.orderId, buyerEmail, date, showUrl, Globals.FullPath("/pay/appstore_wapalipay_return_url"), Globals.FullPath("/pay/appstore_wapalipay_notify_url"), attach); paymentRequest.SendRequest(); } else { this.litErrorMsg.Text = "未配置支付宝网页支付"; this.loadPanel.Visible = false; this.errorPanel.Visible = true; } } }
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); } } } } }
protected override void AttachChildControls() { this.hdorderId = (HtmlInputHidden)this.FindControl("hdorderId"); this.txtRemark = (TextBox)this.FindControl("txtRemark"); this.litRefundAmount = (Literal)this.FindControl("litRefundAmount"); this.dropRefundType = (RefundTypeRadioList)this.FindControl("dropRefundType"); this.DropRefundReason = (AfterSalesReasonDropDownList)this.FindControl("RefundReasonDropDownList"); this.btnRefund = ButtonManager.Create(this.FindControl("btnRefund")); this.groupbuyPanel = (HtmlGenericControl)this.FindControl("groupbuyPanel"); this.OrderId = HttpContext.Current.Request.QueryString["OrderId"].ToNullString(); this.txtBankName = (HtmlInputText)this.FindControl("txtBankName"); this.txtBankAccountName = (HtmlInputText)this.FindControl("txtBankAccountName"); this.txtBankAccountNo = (HtmlInputText)this.FindControl("txtBankAccountNo"); this.products = (Common_OrderItems_AfterSales)this.FindControl("Common_OrderItems_AfterSales"); this.hidRefundType = (HiddenField)this.FindControl("hidRefundType"); this.order = TradeHelper.GetOrderInfo(this.OrderId); if (this.order == null || this.order.UserId != HiContext.Current.UserId) { this.ShowMessage("错误的订单信息!", false, "", 1); } else { if (this.order.FightGroupId > 0) { FightGroupInfo fightGroup = VShopHelper.GetFightGroup(this.order.FightGroupId); if (fightGroup.Status != FightGroupStatus.FightGroupSuccess && fightGroup.Status != FightGroupStatus.FightGroupFail) { this.ShowMessage("火拼团订单成团之前不能进行退款操作!", false, "", 1); return; } } GroupBuyInfo groupBuyInfo = null; if (this.order.GroupBuyId > 0) { groupBuyInfo = ProductBrowser.GetGroupBuy(this.order.GroupBuyId); if (groupBuyInfo != null) { if (this.groupbuyPanel != null && groupBuyInfo.Status != GroupBuyStatus.Failed) { this.groupbuyPanel.Visible = true; } if (groupBuyInfo.NeedPrice >= this.order.GetTotal(false) && groupBuyInfo.Status != GroupBuyStatus.Failed) { this.ShowMessage("团购违约金大于等于订单总金额,不能进行退款申请!", false, "", 1); return; } } } decimal num = this.order.GetCanRefundAmount("", groupBuyInfo, 0); if (num < decimal.Zero) { num = default(decimal); } this.litRefundAmount.Text = num.F2ToString("f2"); this.products.DataSource = this.order.LineItems.Values; this.products.DataBind(); this.btnRefund.Click += this.btnRefund_Click; PageTitle.AddSiteNameTitle("申请退款"); if (!this.Page.IsPostBack) { this.DropRefundReason.IsRefund = true; this.DropRefundReason.DataBind(); string enumDescription = EnumDescription.GetEnumDescription((Enum)(object)EnumPaymentType.AdvancePay, 1); if (this.order.PreSaleId <= 0 || this.order.Gateway.ToLower() == enumDescription || this.order.DepositGatewayOrderId.ToNullString() == enumDescription) { this.dropRefundType.OrderGateWay = ((this.order.PreSaleId > 0) ? enumDescription : this.order.Gateway); } this.dropRefundType.BalanceAmount = this.order.BalanceAmount; this.dropRefundType.DataBind(); } } }
private void btnRefund_Click(object sender, EventArgs e) { string text = this.Page.Request.QueryString["returnUrl"].ToNullString(); if (string.IsNullOrEmpty(text)) { text = this.Page.Request.UrlReferrer.ToNullString(); if (text == this.Page.Request.Url.ToString()) { text = "/User/UserOrders"; } } string text2 = ""; string text3 = ""; string text4 = ""; text2 = Globals.StripAllTags(this.txtBankName.Value); text3 = Globals.StripAllTags(this.txtBankAccountName.Value); text4 = Globals.StripAllTags(this.txtBankAccountNo.Value); this.iRefundType = this.hidRefundType.Value.ToInt(0); if (!Enum.IsDefined(typeof(RefundTypes), this.iRefundType)) { this.ShowMessage("错误的退款方式", false, "", 1); } string enumDescription = EnumDescription.GetEnumDescription((Enum)(object)EnumPaymentType.AdvancePay, 1); if ((this.order.Gateway.ToLower() == enumDescription || this.order.DepositGatewayOrderId.ToNullString().ToLower() == enumDescription) && this.iRefundType != 1) { this.ShowMessage("预付款支付的订单只能退回到预付款帐号", false, "", 1); } else { if (this.order.FightGroupId > 0) { FightGroupInfo fightGroup = VShopHelper.GetFightGroup(this.order.FightGroupId); if (fightGroup != null && fightGroup.Status == FightGroupStatus.FightGroupIn) { this.ShowMessage("拼团过程中时,已完成支付的订单不能发起退款;", false, "", 1); return; } } if (!TradeHelper.CanRefund(this.order, "")) { this.ShowMessage("当前订单不能进行退款操作!", false, "", 1); } else { string userRemark = Globals.StripAllTags(this.txtRemark.Text.Trim()); if (this.iRefundType == 2 && (string.IsNullOrEmpty(text2) || string.IsNullOrEmpty(text3) || string.IsNullOrEmpty(text4))) { this.ShowMessage("您选择了银行退款,请在退款说明中输入退款的银行卡信息!", true, "", 1); } else if (!this.CanRefundBalance()) { this.ShowMessage("请先开通预付款账户", false, "", 1); } else { string selectedValue = this.DropRefundReason.SelectedValue; if (string.IsNullOrEmpty(selectedValue)) { this.ShowMessage("请选择退款原因", true, "", 1); } string refundGateWay = string.IsNullOrEmpty(this.order.Gateway) ? "" : this.order.Gateway.ToLower().Replace(".payment.", ".refund."); int num = 0; num = this.order.GetAllQuantity(true); GroupBuyInfo groupbuy = null; if (this.order.GroupBuyId > 0) { groupbuy = ProductBrowser.GetGroupBuy(this.order.GroupBuyId); } decimal canRefundAmount = this.order.GetCanRefundAmount("", groupbuy, 0); string orderId = this.order.OrderId; if (this.RefundItem != null) { orderId = this.RefundItem.ItemDescription + this.RefundItem.SKUContent; num = this.RefundItem.ShipmentQuantity; } string generateId = Globals.GetGenerateId(); RefundInfo refundInfo = new RefundInfo(); refundInfo.OrderId = this.order.OrderId; refundInfo.UserRemark = userRemark; refundInfo.RefundGateWay = refundGateWay; refundInfo.RefundOrderId = generateId; refundInfo.BankName = text2; refundInfo.BankAccountNo = text4; refundInfo.BankAccountName = text3; refundInfo.ApplyForTime = DateTime.Now; refundInfo.StoreId = this.order.StoreId; refundInfo.RefundReason = selectedValue; refundInfo.RefundType = (RefundTypes)this.iRefundType; refundInfo.RefundAmount = canRefundAmount; if (TradeHelper.ApplyForRefund(refundInfo)) { if (this.order.StoreId > 0) { VShopHelper.AppPsuhRecordForStore(this.order.StoreId, this.OrderId, "", EnumPushStoreAction.StoreOrderRefundApply); } this.ShowMessage("成功的申请了退款", true, text, 2); } else { this.ShowMessage("申请退款失败", false, "", 1); } } } } }
protected override void AttachChildControls() { string orderId = this.Page.Request.QueryString["orderId"]; this.LogisticsInfo = (HtmlGenericControl)this.FindControl("LogisticsInfoPanel"); Literal literal = this.FindControl("litLogisiticType") as Literal; this.hylExpress100Search = (HyperLink)this.FindControl("hylExpress100Search"); this.ulExpress = (HtmlGenericControl)this.FindControl("ulExpress"); int num = 0; int.TryParse(this.Page.Request.QueryString["returnsId"], out num); int num2 = 0; int.TryParse(this.Page.Request.QueryString["replaceId"], out num2); string text = ""; string text2 = ""; string text3 = ""; string text4 = ""; string text5 = ""; string text6 = ""; bool flag = false; HtmlInputHidden htmlInputHidden = this.FindControl("hidReplaceType") as HtmlInputHidden; OrderInfo orderInfo = ShoppingProcessor.GetOrderInfo(orderId); if (orderInfo == null || orderInfo.UserId != HiContext.Current.UserId) { if (num > 0) { ReturnInfo returnInfo = TradeHelper.GetReturnInfo(num); if (returnInfo != null && (returnInfo.HandleStatus == ReturnStatus.Deliverying || returnInfo.HandleStatus == ReturnStatus.GetGoods || returnInfo.HandleStatus == ReturnStatus.Returned)) { text = returnInfo.ExpressCompanyName; text2 = returnInfo.ShipOrderNumber; text3 = returnInfo.AdminShipTo; text4 = returnInfo.AdminCellPhone; text5 = returnInfo.AdminShipAddress; text6 = returnInfo.ExpressCompanyAbb; flag = true; } } if (num2 > 0) { ReplaceInfo replaceInfo = TradeHelper.GetReplaceInfo(num2); orderInfo = ShoppingProcessor.GetOrderInfo(replaceInfo.OrderId); if (orderInfo == null) { this.LogisticsInfo.InnerHtml = "订单不存在或已被删除"; return; } if (replaceInfo != null) { if (replaceInfo.HandleStatus == ReplaceStatus.UserDelivery) { htmlInputHidden.Value = "User"; text = replaceInfo.UserExpressCompanyName; text2 = replaceInfo.UserShipOrderNumber; text3 = replaceInfo.AdminShipTo; text4 = replaceInfo.AdminCellPhone; text5 = replaceInfo.AdminShipAddress; text6 = replaceInfo.ExpressCompanyAbb; flag = true; } if (replaceInfo.HandleStatus == ReplaceStatus.MerchantsDelivery || replaceInfo.HandleStatus == ReplaceStatus.Replaced) { htmlInputHidden.Value = "Mall"; text = replaceInfo.ExpressCompanyName; text2 = replaceInfo.ShipOrderNumber; text3 = orderInfo.ShipTo; text4 = (string.IsNullOrEmpty(orderInfo.CellPhone) ? orderInfo.TelPhone : orderInfo.CellPhone); text5 = orderInfo.ShippingRegion + " " + orderInfo.Address; text6 = orderInfo.ExpressCompanyAbb; } else { this.LogisticsInfo.InnerHtml = "商家还未发货"; } } } } else { flag = true; text = orderInfo.ExpressCompanyName; text2 = orderInfo.ShipOrderNumber; text3 = orderInfo.ShipTo; text4 = (string.IsNullOrEmpty(orderInfo.CellPhone) ? orderInfo.TelPhone : orderInfo.CellPhone); text5 = orderInfo.ShippingRegion + " " + orderInfo.Address; text6 = orderInfo.ExpressCompanyAbb; } if (!flag) { base.GotoResourceNotFound("错误的物流数据"); } Literal literal2 = this.FindControl("ltlExpressCompanyName") as Literal; Literal literal3 = this.FindControl("ltlShipOrderNumber") as Literal; Literal literal4 = this.FindControl("ltlReceiveName") as Literal; Literal literal5 = this.FindControl("ltlTel") as Literal; Literal literal6 = this.FindControl("ltlShipAddress") as Literal; Literal literal7 = this.FindControl("Repeater") as Literal; HtmlInputHidden htmlInputHidden2 = this.FindControl("hidOrderId") as HtmlInputHidden; htmlInputHidden2.Value = ((orderInfo != null) ? orderInfo.OrderId : string.Empty); HtmlInputHidden htmlInputHidden3 = this.FindControl("hidIsShowDadaGIS") as HtmlInputHidden; HtmlInputHidden htmlInputHidden4 = this.FindControl("hidUserLatlng") as HtmlInputHidden; HtmlInputHidden htmlInputHidden5 = this.FindControl("hidStoreLatlng") as HtmlInputHidden; HtmlInputHidden htmlInputHidden6 = this.FindControl("hidBaseURL") as HtmlInputHidden; htmlInputHidden6.Value = Globals.HostPath(this.Page.Request.Url); if (orderInfo != null) { if (orderInfo.ExpressCompanyName.ToNullString() == "同城物流配送") { htmlInputHidden3.Value = "1"; } if (orderInfo.ShippingId > 0) { ShippingAddressInfo shippingAddress = MemberProcessor.GetShippingAddress(orderInfo.ShippingId); if (shippingAddress != null && !string.IsNullOrWhiteSpace(shippingAddress.LatLng)) { htmlInputHidden4.Value = shippingAddress.LatLng; } } if (orderInfo.StoreId > 0) { StoresInfo storeById = StoresHelper.GetStoreById(orderInfo.StoreId); if (storeById != null && !string.IsNullOrWhiteSpace(storeById.LatLng)) { htmlInputHidden5.Value = storeById.LatLng; } } else { ShippersInfo defaultOrFirstShipper = SalesHelper.GetDefaultOrFirstShipper(0); if (defaultOrFirstShipper != null) { htmlInputHidden5.Value = defaultOrFirstShipper.Latitude + "," + defaultOrFirstShipper.Longitude; } } } literal2.Text = text; literal3.Text = text2; if (!string.IsNullOrEmpty(text2)) { string text7 = HttpContext.Current.Request.Url.ToString().ToLower(); if (text7.IndexOf("/wapshop/") != -1) { if (text6.ToLower() == "sf") { this.hylExpress100Search.NavigateUrl = $"http://www.sf-express.com/mobile/cn/sc/dynamic_function/waybill/waybill_query_info.html?billno={text2}"; this.hylExpress100Search.Text = "顺丰官网查询>"; } else { this.hylExpress100Search.NavigateUrl = $"https://m.kuaidi100.com/result.jsp?nu={text2}"; } } else if (text6.ToLower() == "sf") { this.hylExpress100Search.NavigateUrl = $"http://www.sf-express.com/mobile/cn/sc/dynamic_function/waybill/waybill_query_info.html?billno={text2}"; this.hylExpress100Search.Text = "顺丰官网查询>"; } else { this.hylExpress100Search.NavigateUrl = $"https://www.kuaidi100.com/chaxun?nu={text2}"; } } else { this.ulExpress.Visible = false; } literal4.Text = text3; literal5.Text = text4; literal6.Text = text5; PageTitle.AddSiteNameTitle("查看物流"); }
protected override void Read(PacketStream stream) { var targetConId = stream.ReadUInt16(); TradeHelper.TradeRequest(Connection, targetConId); }
protected override void AttachChildControls() { this.returnUrl = base.GetParameter("ReturnUrl", false).ToNullString(); if (string.IsNullOrEmpty(this.returnUrl)) { this.returnUrl = this.Page.Request.UrlReferrer.ToNullString(); if (this.returnUrl == this.Page.Request.Url.ToString()) { this.returnUrl = "/User/UserOrders"; } } this.divCredentials = (HtmlGenericControl)this.FindControl("divCredentials"); this.replaceId = base.GetParameter("ReplaceId", 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.litReplaceAmount = (Literal)this.FindControl("litReplaceAmount"); this.litTotalPrice = (FormatedMoneyLabel)this.FindControl("litTotalPrice"); this.lnkToSendGoods = (HtmlAnchor)this.FindControl("lnkToSendGoods"); this.lnkFinishReplace = (HtmlAnchor)this.FindControl("lnkFinishReplace"); this.litShipToDate = (Literal)this.FindControl("litShipToDate"); this.litWeight = (Literal)this.FindControl("litWeight"); this.litUserRemark = (Literal)this.FindControl("litUserRemark"); this.hidExpressCompanyName = (HiddenField)this.FindControl("hidExpressCompanyName"); this.hidShipOrderNumber = (HiddenField)this.FindControl("hidShipOrderNumber"); this.expresslist1 = (ExpressDropDownList)this.FindControl("expressDropDownList1"); this.txtShipOrderNumber1 = (TextBox)this.FindControl("txtShipOrderNumber1"); this.litCredentialsImg = (Literal)this.FindControl("litCredentialsImg"); this.litStep = (Literal)this.FindControl("litStep"); this.litTime = (Literal)this.FindControl("litTime"); this.litProcess = (Literal)this.FindControl("litProcess"); this.txtIsRefused = (HtmlInputHidden)this.FindControl("txtIsRefused"); this.lnkReApply = (HtmlAnchor)this.FindControl("lnkReApply"); this.AdminRemarkRow = (HtmlGenericControl)this.FindControl("AdminRemarkRow"); this.btnFinishReplace = ButtonManager.Create(this.FindControl("btnFinishReplace")); this.btnSendGoodsReplace = ButtonManager.Create(this.FindControl("btnSendGoodsReplace")); this.btnViewUserLogistic = (HtmlAnchor)this.FindControl("btnViewUserLogistic"); this.btnViewMallLogistic = (HtmlAnchor)this.FindControl("btnViewMallLogistic"); this.btnSendGoodsReplace.Click += this.btnSendGoodsReplace_Click; this.replace = TradeHelper.GetReplaceInfo(this.replaceId); if (this.replace == null) { this.Page.Response.Redirect("/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("换货信息不存在或者不属于当前用户")); } else { this.order = TradeHelper.GetOrderInfo(this.replace.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) { string a = this.Page.Request.QueryString["action"].ToNullString().ToLower(); if (a == "finishreplace") { this.FinishReplace(); } this.BindOrderReplace(this.replaceId); if (this.expresslist1 != null) { this.expresslist1.ShowAllExpress = true; this.expresslist1.DataBind(); } this.BindProducts(this.order, this.replace.SkuId); this.BindOrderItems(this.order); } } }
public void SubmitReview(HttpContext context) { string text = ""; string szJson = context.Request["DataJson"]; int num = 0; List <ProductReviewInfo> list = JsonHelper.ParseFormJson <List <ProductReviewInfo> >(szJson); if (list != null && list.Count > 0) { string orderId = list[0].OrderId; OrderInfo orderInfo = TradeHelper.GetOrderInfo(orderId); if (orderInfo.OrderStatus != OrderStatus.Finished && (orderInfo.OrderStatus != OrderStatus.Closed || orderInfo.OnlyReturnedCount != orderInfo.LineItems.Count)) { context.Response.Write(string.Format(this.Result, "false", "您的订单还未完成,因此不能对该商品进行评论!")); return; } int num2 = 0; int num3 = 0; foreach (ProductReviewInfo item in list) { ProductBrowser.LoadProductReview(item.ProductId, out num2, out num3, item.OrderId); if (num2 == 0) { context.Response.Write(string.Format(this.Result, "false", "您没有购买此商品(或此商品的订单尚未完成),因此不能进行评论!")); return; } if (num3 >= num2) { context.Response.Write(string.Format(this.Result, "false", "您已经对此商品进行过评论(或此商品的订单尚未完成),因此不能再次进行评论!")); return; } item.ReviewDate = DateTime.Now; item.UserId = HiContext.Current.UserId; item.UserName = HiContext.Current.User.UserName.ToNullString(); item.UserEmail = HiContext.Current.User.Email.ToNullString(); int num4 = 0; string[] array = item.ImageUrl1.Split(','); foreach (string text2 in array) { if (!string.IsNullOrEmpty(text2)) { string fileURL = text2.Replace("//", "/"); string text3 = Globals.SaveFile("review", fileURL, "/Storage/master/", true, false, ""); num4++; switch (num4) { case 1: item.ImageUrl1 = text3; break; case 2: item.ImageUrl2 = text3; break; case 3: item.ImageUrl3 = text3; break; case 4: item.ImageUrl4 = text3; break; case 5: item.ImageUrl5 = text3; break; } } } ValidationResults validationResults = Validation.Validate(item, "Refer"); text = string.Empty; if (!validationResults.IsValid) { foreach (ValidationResult item2 in (IEnumerable <ValidationResult>)validationResults) { text += Formatter.FormatErrorMessage(item2.Message); } break; } if (!ProductBrowser.InsertProductReview(item)) { text = "评论失败,请重试"; break; } MemberInfo user = Users.GetUser(HiContext.Current.UserId); SiteSettings masterSettings = SettingsManager.GetMasterSettings(); if (user != null && masterSettings != null && masterSettings.ProductCommentPoint > 0 && ReviewHandler.AddPoints(user, masterSettings.ProductCommentPoint, PointTradeType.ProductCommentPoint)) { num += masterSettings.ProductCommentPoint; } } } else { text = "请输入评价内容呀"; } if (text != "") { context.Response.Write(string.Format(this.Result, "false", text)); } else { context.Response.Write(string.Format(this.Result, "true", (num > 0) ? $"评价成功!<br/>恭喜您获得{num}积分奖励!" : "评价成功")); } }
private void BindOrderReplace(int replaceId) { ReplaceInfo replaceInfo = TradeHelper.GetReplaceInfo(replaceId); if (replaceInfo != null) { if (replaceInfo.HandleStatus == ReplaceStatus.Refused && (this.order.OrderStatus == OrderStatus.SellerAlreadySent || (this.order.OrderStatus == OrderStatus.Finished && !this.order.IsServiceOver))) { this.lnkReApply.Visible = true; this.lnkReApply.HRef = "/User/AfterSalesApply?OrderId=" + replaceInfo.OrderId + "&SkuId=" + replaceInfo.SkuId; } int quantity; if (replaceInfo.HandleStatus == ReplaceStatus.MerchantsAgreed || replaceInfo.HandleStatus == ReplaceStatus.UserDelivery) { AttributeCollection attributes = this.lnkToSendGoods.Attributes; quantity = replaceInfo.ReplaceId; attributes.Add("ReplaceId", quantity.ToString()); this.lnkToSendGoods.Visible = true; } if (replaceInfo.HandleStatus == ReplaceStatus.MerchantsDelivery) { this.lnkFinishReplace.Visible = true; this.lnkFinishReplace.HRef = "UserReplaceApplyDetails?ReplaceId=" + replaceInfo.ReplaceId + "&action=FinishReplace"; } Literal literal = this.litReplaceAmount; quantity = replaceInfo.Quantity; literal.Text = quantity.ToString(); this.txtAfterSaleId.Text = replaceId.ToString(); this.litRemark.Text = replaceInfo.ReplaceReason; if (!string.IsNullOrEmpty(replaceInfo.AdminRemark)) { this.litAdminRemark.Text = replaceInfo.AdminRemark; if (this.AdminRemarkRow != null) { this.AdminRemarkRow.Visible = true; } } else if (this.AdminRemarkRow != null) { this.AdminRemarkRow.Visible = false; } this.litUserRemark.Text = replaceInfo.UserRemark; this.orderId = replaceInfo.OrderId; string userCredentials = replaceInfo.UserCredentials; if (string.IsNullOrEmpty(userCredentials)) { this.divCredentials.Visible = false; } else { string[] array = userCredentials.Split('|'); userCredentials = ""; string[] array2 = array; foreach (string str in array2) { userCredentials += string.Format(this.credentialsImgHtml, Globals.GetImageServerUrl() + str); } this.litCredentialsImg.Text = userCredentials; } string text = ""; DateTime dateTime = replaceInfo.AgreedOrRefusedTime.HasValue ? replaceInfo.AgreedOrRefusedTime.Value : replaceInfo.ApplyForTime; DateTime dateTime2 = replaceInfo.UserSendGoodsTime.HasValue ? replaceInfo.UserSendGoodsTime.Value : dateTime; DateTime dateTime3 = replaceInfo.MerchantsConfirmGoodsTime.HasValue ? replaceInfo.MerchantsConfirmGoodsTime.Value : dateTime2; DateTime dateTime4 = replaceInfo.UserConfirmGoodsTime.HasValue ? replaceInfo.UserConfirmGoodsTime.Value : dateTime3; DateTime applyForTime; if (replaceInfo.HandleStatus == ReplaceStatus.Applied) { this.processTemplate = "<div class=\"node ready\"></div><div class=\"proce\"></div><div class=\"node\"></div><div class=\"proce\"></div><div class=\"node\"></div><div class=\"proce\"></div><div class=\"node\"></div><div class=\"proce\"></div><div class=\"node\"></div>"; string format = this.timeTemplate; applyForTime = replaceInfo.ApplyForTime; string arg = applyForTime.ToString("yyyy-MM-dd"); applyForTime = replaceInfo.ApplyForTime; text = string.Format(format, arg, applyForTime.ToString("HH:mm:ss")); } else if (replaceInfo.HandleStatus == ReplaceStatus.MerchantsAgreed) { this.processTemplate = "<div class=\"node ready\"></div><div class=\"proce done\"></div><div class=\"node now\"></div><div class=\"proce\"></div><div class=\"node\"></div><div class=\"proce\"></div><div class=\"node\"></div><div class=\"proce\"></div><div class=\"node\"></div>"; string format2 = this.timeTemplate; applyForTime = replaceInfo.ApplyForTime; string arg2 = applyForTime.ToString("yyyy-MM-dd"); applyForTime = replaceInfo.ApplyForTime; text = string.Format(format2, arg2, applyForTime.ToString("HH:mm:ss")); text += string.Format(this.timeTemplate, dateTime.ToString("yyyy-MM-dd"), dateTime.ToString("HH:mm:ss")); } else if (replaceInfo.HandleStatus == ReplaceStatus.UserDelivery) { this.processTemplate = "<div class=\"node ready\"></div><div class=\"proce done\"></div><div class=\"node done\"></div><div class=\"proce done\"></div><div class=\"node now\"></div><div class=\"proce\"></div><div class=\"node\"></div><div class=\"proce\"></div><div class=\"node\"></div>"; string format3 = this.timeTemplate; applyForTime = replaceInfo.ApplyForTime; string arg3 = applyForTime.ToString("yyyy-MM-dd"); applyForTime = replaceInfo.ApplyForTime; text = string.Format(format3, arg3, applyForTime.ToString("HH:mm:ss")); text += string.Format(this.timeTemplate, dateTime.ToString("yyyy-MM-dd"), dateTime.ToString("HH:mm:ss")); text += string.Format(this.timeTemplate, dateTime2.ToString("yyyy-MM-dd"), dateTime2.ToString("HH:mm:ss")); } else if (replaceInfo.HandleStatus == ReplaceStatus.MerchantsDelivery) { this.processTemplate = "<div class=\"node ready\"></div><div class=\"proce done\"></div><div class=\"node done\"></div><div class=\"proce done\"></div><div class=\"node done\"></div><div class=\"proce done\"></div><div class=\"node now\"></div><div class=\"proce\"></div><div class=\"node\"></div>"; string format4 = this.timeTemplate; applyForTime = replaceInfo.ApplyForTime; string arg4 = applyForTime.ToString("yyyy-MM-dd"); applyForTime = replaceInfo.ApplyForTime; text = string.Format(format4, arg4, applyForTime.ToString("HH:mm:ss")); text += string.Format(this.timeTemplate, dateTime.ToString("yyyy-MM-dd"), dateTime.ToString("HH:mm:ss")); text += string.Format(this.timeTemplate, dateTime2.ToString("yyyy-MM-dd"), dateTime2.ToString("HH:mm:ss")); text += string.Format(this.timeTemplate, dateTime3.ToString("yyyy-MM-dd"), dateTime3.ToString("HH:mm:ss")); } else if (replaceInfo.HandleStatus == ReplaceStatus.Replaced) { this.processTemplate = "<div class=\"node ready\"></div><div class=\"proce done\"></div><div class=\"node done\"></div><div class=\"proce done\"></div><div class=\"node done\"></div><div class=\"proce done\"></div><div class=\"node done\"></div><div class=\"proce done\"></div><div class=\"node now\"></div>"; string format5 = this.timeTemplate; applyForTime = replaceInfo.ApplyForTime; string arg5 = applyForTime.ToString("yyyy-MM-dd"); applyForTime = replaceInfo.ApplyForTime; text = string.Format(format5, arg5, applyForTime.ToString("HH:mm:ss")); text += string.Format(this.timeTemplate, dateTime.ToString("yyyy-MM-dd"), dateTime.ToString("HH:mm:ss")); text += string.Format(this.timeTemplate, dateTime2.ToString("yyyy-MM-dd"), dateTime4.ToString("HH:mm:ss")); text += string.Format(this.timeTemplate, dateTime3.ToString("yyyy-MM-dd"), dateTime3.ToString("HH:mm:ss")); text += string.Format(this.timeTemplate, dateTime4.ToString("yyyy-MM-dd"), dateTime4.ToString("HH:mm:ss")); } else if (replaceInfo.HandleStatus == ReplaceStatus.Refused) { this.txtIsRefused.Value = "1"; this.stepTemplate = "<span>买家申请换货</span><span>商家拒绝申请</span><span>换货失败</span>"; this.processTemplate = "<div class=\"node ready\"></div><div class=\"proce done\"></div><div class=\"node done\"></div><div class=\"proce done\"></div><div class=\"node now\"></div>"; string format6 = this.timeTemplate; applyForTime = replaceInfo.ApplyForTime; string arg6 = applyForTime.ToString("yyyy-MM-dd"); applyForTime = replaceInfo.ApplyForTime; text = string.Format(format6, arg6, applyForTime.ToString("HH:mm:ss")); text += string.Format(this.timeTemplate, dateTime.ToString("yyyy-MM-dd"), dateTime.ToString("HH:mm:ss")); text += string.Format(this.timeTemplate, dateTime.ToString("yyyy-MM-dd"), dateTime.ToString("HH:mm:ss")); } this.litProcess.Text = this.processTemplate; this.litTime.Text = text; this.litStep.Text = this.stepTemplate; if (replaceInfo.HandleStatus == ReplaceStatus.UserDelivery) { this.btnViewUserLogistic.Visible = true; AttributeCollection attributes2 = this.btnViewUserLogistic.Attributes; quantity = replaceInfo.ReplaceId; attributes2.Add("replaceid", quantity.ToString()); } if (replaceInfo.HandleStatus == ReplaceStatus.MerchantsDelivery || replaceInfo.HandleStatus == ReplaceStatus.Replaced) { this.btnViewMallLogistic.Visible = true; AttributeCollection attributes3 = this.btnViewMallLogistic.Attributes; quantity = replaceInfo.ReplaceId; attributes3.Add("replaceid", quantity.ToString()); } } }
private void QueryDeliverFee(HttpContext context) { StoresInfo storeById = StoresHelper.GetStoreById(HiContext.Current.Manager.StoreId); string text = context.Request["OrderId"].ToNullString(); SiteSettings masterSettings = SettingsManager.GetMasterSettings(); if (string.IsNullOrEmpty(text)) { context.Response.Write(this.GetFailResultJson("订单号不能为空")); } else { OrderInfo orderInfo = TradeHelper.GetOrderInfo(text); if (orderInfo == null) { context.Response.Write(this.GetFailResultJson("错误的订单号")); } else if (orderInfo.StoreId != HiContext.Current.Manager.StoreId) { context.Response.Write(this.GetFailResultJson("订单不是此门店的")); } else if ((orderInfo.OrderStatus != OrderStatus.BuyerAlreadyPaid && (orderInfo.OrderStatus != OrderStatus.WaitBuyerPay || !(orderInfo.Gateway == EnumDescription.GetEnumDescription((Enum)(object)EnumPaymentType.CashOnDelivery, 1)))) || orderInfo.RealShippingModeId == -2) { context.Response.Write(this.GetFailResultJson("错误的订单状态")); } else { DataTable dataTable = DepotHelper.SynchroDadaStoreList(storeById.StoreId); if (!orderInfo.ShippingRegion.Contains(dataTable.Rows[0]["CityName"].ToString())) { context.Response.Write(this.GetFailResultJson("配送范围超区,无法配送")); } else { string text2 = ""; try { string value = DadaHelper.cityCodeList(masterSettings.DadaSourceID); JObject jObject = JsonConvert.DeserializeObject(value) as JObject; JArray jArray = (JArray)jObject["result"]; foreach (JToken item in (IEnumerable <JToken>)jArray) { if (orderInfo.ShippingRegion.Contains(item["cityName"].ToString())) { text2 = item["cityCode"].ToString(); break; } } } catch { } if (text2 == "") { context.Response.Write(this.GetFailResultJson("配送范围超区,无法配送")); } else { string shop_no = orderInfo.StoreId.ToNullString(); string orderId = orderInfo.OrderId; string city_code = text2; double cargo_price = orderInfo.GetTotal(false).F2ToString("f2").ToDouble(0); int is_prepay = 0; long expected_fetch_time = Globals.DateTimeToUnixTimestamp(DateTime.Now.AddMinutes(15.0)); string shipTo = orderInfo.ShipTo; string address = orderInfo.Address; string latLng = orderInfo.LatLng; if (string.IsNullOrWhiteSpace(latLng)) { ShippingAddressInfo shippingAddress = MemberProcessor.GetShippingAddress(orderInfo.ShippingId); latLng = shippingAddress.LatLng; } double receiver_lat = latLng.Split(',')[0].ToDouble(0); double receiver_lng = latLng.Split(',')[1].ToDouble(0); string callback = Globals.FullPath("/pay/dadaOrderNotify"); string cellPhone = orderInfo.CellPhone; string telPhone = orderInfo.TelPhone; bool isQueryDeliverFee = true; string value2 = DadaHelper.addOrder(masterSettings.DadaSourceID, shop_no, orderId, city_code, cargo_price, is_prepay, expected_fetch_time, shipTo, address, receiver_lat, receiver_lng, callback, cellPhone, telPhone, -1.0, -1.0, -1.0, -1.0, -1L, "", -1, -1.0, -1, -1L, "", "", "", false, isQueryDeliverFee); JObject jObject2 = JsonConvert.DeserializeObject(value2) as JObject; string a = jObject2["status"].ToString(); if (a == "success") { JObject jObject3 = JsonConvert.DeserializeObject(jObject2["result"].ToString()) as JObject; string s = JsonConvert.SerializeObject(new { Result = new { Status = "SUCCESS", distance = jObject3["distance"].ToNullString(), fee = "预计运费:¥" + jObject3["fee"].ToNullString(), deliveryNo = jObject3["deliveryNo"].ToNullString() } }); context.Response.Write(s); context.Response.End(); } else { context.Response.Write(this.GetFailResultJson(jObject2["msg"].ToNullString())); } } } } } }
private void UserPayOrder() { if (this.Order.OrderStatus == OrderStatus.BuyerAlreadyPaid) { base.Response.Write("success"); return; } string json = Newtonsoft.Json.JsonConvert.SerializeObject(payNotify); //如果需要拆单 if (TradeHelper.CheckIsUnpack(OrderId) && Order.OrderStatus == OrderStatus.WaitBuyerPay) { ErrorLog.Write(string.Format("拆单,原订单{0},返回信息{1}", this.Order.OrderId, json)); if (this.Order.CheckAction(OrderActions.BUYER_PAY) && TradeHelper.UserPayOrder(this.Order, false, 1)) { OrderHelper.SetOrderPayStatus(OrderId, 2); if (this.Order.UserId != 0 && this.Order.UserId != 1100) { IUser user = Users.GetUser(this.Order.UserId); if (user != null && user.UserRole == UserRole.Member) { Messenger.OrderPayment(user, this.Order, this.Order.GetTotal()); } } this.Order.OnPayment(); base.Response.Write("success"); } } else if (Order.OrderType == (int)OrderType.WillMerge && Order.OrderStatus == OrderStatus.WaitBuyerPay)//合并单据 { ErrorLog.Write(string.Format("合并单据,原订单{0},返回信息{1}", this.Order.OrderId, json)); bool b = ShoppingProcessor.mergeOrder(this.Order); int flag = 0; if (b) { flag = 2; } if (this.Order.CheckAction(OrderActions.BUYER_PAY) && TradeHelper.UserPayOrder(this.Order, false, flag)) { OrderHelper.SetOrderPayStatus(OrderId, 2); if (this.Order.UserId != 0 && this.Order.UserId != 1100) { IUser user = Users.GetUser(this.Order.UserId); if (user != null && user.UserRole == UserRole.Member) { Messenger.OrderPayment(user, this.Order, this.Order.GetTotal()); } } this.Order.OnPayment(); base.Response.Write("success"); } } else { ErrorLog.Write(string.Format("正常单据,原订单{0},返回信息{1}", this.Order.OrderId, json)); if (this.Order.CheckAction(OrderActions.BUYER_PAY) && TradeHelper.UserPayOrder(this.Order, false)) { OrderHelper.SetOrderPayStatus(OrderId, 2); if (this.Order.UserId != 0 && this.Order.UserId != 1100) { IUser user = Users.GetUser(this.Order.UserId); if (user != null && user.UserRole == UserRole.Member) { Messenger.OrderPayment(user, this.Order, this.Order.GetTotal()); } } this.Order.OnPayment(); base.Response.Write("success"); } } }
private void UserPayOrder() { if (this.Order.OrderStatus == OrderStatus.Closed) { if (!this.hasNotify) { OrderHelper.SetExceptionOrder(this.Order.OrderId, "支付异常,请联系买家退款"); Messenger.OrderException(Users.GetUser(this.Order.UserId), this.Order, "订单支付异常,请联系卖家退款.订单号:" + this.Order.OrderId); TradeHelper.UpdateOrderGatewayOrderId(this.Order.OrderId, this.Order.GatewayOrderId); } base.Response.Write("success"); } else if (this.Order.OrderStatus == OrderStatus.BuyerAlreadyPaid) { Globals.WriteLog(new NameValueCollection { this.Page.Request.Form, this.Page.Request.QueryString }, "订单状态已支付", "", "", "wap_bankunion"); base.Response.Write("success"); } else { int maxCount = 0; int yetOrderNum = 0; int currentOrderNum = 0; if (this.Order.GroupBuyId > 0) { GroupBuyInfo groupBuy = TradeHelper.GetGroupBuy(this.Order.GroupBuyId); if (groupBuy == null || groupBuy.Status != GroupBuyStatus.UnderWay) { Globals.WriteLog(new NameValueCollection { this.Page.Request.Form, this.Page.Request.QueryString }, "错误的团购信息或者状态", "", "", "wap_bankunion"); base.Response.Write("success"); return; } yetOrderNum = TradeHelper.GetOrderCount(this.Order.GroupBuyId); currentOrderNum = this.Order.GetGroupBuyOerderNumber(); maxCount = groupBuy.MaxCount; if (maxCount < yetOrderNum + currentOrderNum) { Globals.WriteLog(new NameValueCollection { this.Page.Request.Form, this.Page.Request.QueryString }, "团购数量已超过指定数量", "", "", "wap_bankunion"); base.Response.Write("success"); return; } } if (this.Order.CheckAction(OrderActions.BUYER_PAY) && TradeHelper.UpdateOrderStatus(this.Order)) { Task.Factory.StartNew(delegate { TradeHelper.UserPayOrder(this.Order, false, true); try { if (this.Order.GroupBuyId > 0 && maxCount == yetOrderNum + currentOrderNum) { TradeHelper.SetGroupBuyEndUntreated(this.Order.GroupBuyId); } if (this.Order.ParentOrderId == "-1") { OrderQuery orderQuery = new OrderQuery(); orderQuery.ParentOrderId = this.Order.OrderId; IList <OrderInfo> listUserOrder = MemberProcessor.GetListUserOrder(this.Order.UserId, orderQuery); foreach (OrderInfo item in listUserOrder) { OrderHelper.OrderConfirmPaySendMessage(item); } } else { OrderHelper.OrderConfirmPaySendMessage(this.Order); } } catch (Exception ex) { Globals.AppendLog("支付更新订单收款记录或者消息通知时出错:" + ex.Message, "", "", "UserPay"); } this.Order.OnPayment(); }); base.Response.Write("success"); } else { base.Response.Write("success"); } } }
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; }
public void bindReplaceInfo() { int replaceId = this.Page.Request["replaceId"].ToInt(0); ReplaceInfo replaceInfo = TradeHelper.GetReplaceInfo(replaceId); if (replaceInfo == null) { this.ShowMsg("换货信息错误!", false); } else { OrderInfo orderInfo = TradeHelper.GetOrderInfo(replaceInfo.OrderId); HiddenField hiddenField = this.hidReplaceStatus; int num = (int)replaceInfo.HandleStatus; hiddenField.Value = num.ToString(); if (orderInfo == null) { this.ShowMsg("错误的订单信息!", false); } else if (orderInfo.SupplierId != HiContext.Current.Manager.StoreId) { this.ShowMsg("订单不是当前供应商订单,请勿非法访问。", false); } else { if (string.IsNullOrEmpty(replaceInfo.SkuId)) { this.listPrducts.DataSource = orderInfo.LineItems.Values; } else { Dictionary <string, LineItemInfo> dictionary = new Dictionary <string, LineItemInfo>(); foreach (LineItemInfo value in orderInfo.LineItems.Values) { if (value.SkuId == replaceInfo.SkuId) { dictionary.Add(value.SkuId, value); } } this.listPrducts.DataSource = dictionary.Values; } this.listPrducts.DataBind(); this.litAdminRemark.Text = replaceInfo.AdminRemark; this.litOrderId.Text = orderInfo.OrderId; this.litRefundReason.Text = replaceInfo.ReplaceReason; this.litRemark.Text = replaceInfo.UserRemark; Literal literal = this.litReturnQuantity; num = replaceInfo.Quantity; literal.Text = num.ToString(); string userCredentials = replaceInfo.UserCredentials; if (!string.IsNullOrEmpty(userCredentials)) { string[] array = userCredentials.Split('|'); userCredentials = ""; string[] array2 = array; foreach (string str in array2) { userCredentials += string.Format(this.credentialsImgHtml, Globals.GetImageServerUrl() + str); } this.litImageList.Text = userCredentials; } else { this.divCredentials.Visible = false; } if (replaceInfo.HandleStatus == ReplaceStatus.UserDelivery) { this.btnGetAndSendGoods.Visible = true; } if (replaceInfo.HandleStatus == ReplaceStatus.UserDelivery) { this.btnViewUserLogistic.Visible = true; AttributeCollection attributes = this.btnViewUserLogistic.Attributes; num = replaceInfo.ReplaceId; attributes.Add("replaceid", num.ToString()); this.btnViewUserLogistic.Attributes.Add("expresscompanyname", replaceInfo.UserExpressCompanyName.ToString()); this.btnViewUserLogistic.Attributes.Add("shipordernumber", replaceInfo.UserShipOrderNumber.ToString()); } if (replaceInfo.HandleStatus == ReplaceStatus.MerchantsDelivery || replaceInfo.HandleStatus == ReplaceStatus.Replaced) { this.btnViewMallLogistic.Visible = true; AttributeCollection attributes2 = this.btnViewMallLogistic.Attributes; num = replaceInfo.ReplaceId; attributes2.Add("replaceid", num.ToString()); this.btnViewMallLogistic.Attributes.Add("expresscompanyname", replaceInfo.ExpressCompanyName.ToString()); this.btnViewMallLogistic.Attributes.Add("shipordernumber", replaceInfo.ShipOrderNumber.ToString()); } string str2 = string.IsNullOrEmpty(orderInfo.RealName) ? "" : (orderInfo.RealName.Replace("\n\r", "").Replace("\n", "").Replace("\r", "") + " (" + (string.IsNullOrEmpty(orderInfo.CellPhone) ? orderInfo.TelPhone : orderInfo.CellPhone) + ")"); str2 = str2 + orderInfo.ShippingRegion + " " + orderInfo.Address; this.litUserAddress.Text = str2; this.txtStatus.Text = EnumDescription.GetEnumDescription((Enum)(object)replaceInfo.HandleStatus, 0); Literal literal2 = this.txtAfterSaleId; num = replaceInfo.ReplaceId; literal2.Text = num.ToString(); } } }
private void GotoPay() { SiteSettings masterSettings = SettingsManager.GetMasterSettings(); OrderInfo orderInfo = ShoppingProcessor.GetOrderInfo(this.orderId); string str = ""; if (orderInfo == null) { this.litErrorMsg.Text = "数据错误!"; } else { if (orderInfo.PreSaleId > 0) { ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId); if (productPreSaleInfo == null) { this.litErrorMsg.Text = "预售活动不存在不能支付"; return; } if (!orderInfo.DepositDate.HasValue) { if (productPreSaleInfo.PreSaleEndDate < DateTime.Now) { this.litErrorMsg.Text = "您支付晚了,预售活动已经结束"; return; } if (!TradeHelper.CheckOrderStockBeforePay(orderInfo, out str)) { this.litErrorMsg.Text = str + ",库存不足,不能进行支付"; return; } } if (orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay) { if (productPreSaleInfo.PaymentStartDate > DateTime.Now) { this.litErrorMsg.Text = "尾款支付尚未开始"; return; } DateTime t = productPreSaleInfo.PaymentEndDate.AddDays(1.0); if (t <= DateTime.Now) { this.litErrorMsg.Text = "尾款支付已结束,不能支付!"; return; } } } else if (!TradeHelper.CheckOrderStockBeforePay(orderInfo, out str)) { this.litErrorMsg.Text = str + ",库存不足,不能进行支付"; return; } if (orderInfo.CountDownBuyId > 0) { string empty = string.Empty; foreach (KeyValuePair <string, LineItemInfo> lineItem in orderInfo.LineItems) { CountDownInfo countDownInfo = TradeHelper.CheckUserCountDown(lineItem.Value.ProductId, orderInfo.CountDownBuyId, lineItem.Value.SkuId, HiContext.Current.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, out empty, orderInfo.StoreId); if (countDownInfo == null) { this.litErrorMsg.Text = empty; return; } } } if (orderInfo.FightGroupId > 0) { string empty2 = string.Empty; foreach (KeyValuePair <string, LineItemInfo> lineItem2 in orderInfo.LineItems) { FightGroupActivityInfo fightGroupActivityInfo = VShopHelper.CheckUserFightGroup(lineItem2.Value.ProductId, orderInfo.FightGroupActivityId, orderInfo.FightGroupId, lineItem2.Value.SkuId, HiContext.Current.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, lineItem2.Value.Quantity, out empty2); if (fightGroupActivityInfo == null) { this.litErrorMsg.Text = empty2; return; } } } string text = orderInfo.OrderId; decimal amount = orderInfo.GetTotal(true); text = orderInfo.PayOrderId; if (orderInfo.PreSaleId > 0) { if (!orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay) { amount = orderInfo.Deposit; } if (orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay) { amount = orderInfo.FinalPayment; } } this.litErrorMsg.Text = ""; if (orderInfo.Gateway == "hishop.plugins.payment.advancerequest") { this.Page.Response.Redirect("TransactionPwd?orderId=" + this.Page.Request.QueryString["orderId"] + "&totalAmount=" + orderInfo.GetTotal(false).F2ToString("f2")); } if (orderInfo.Gateway == "hishop.plugins.payment.ws_apppay.wswappayrequest") { HttpContext.Current.Response.Redirect("~/pay/app_alipay_Submit?orderId=" + orderInfo.OrderId); } PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(orderInfo.Gateway); if (orderInfo.Gateway == "hishop.plugins.payment.ws_wappay.wswappayrequest") { if (!masterSettings.EnableAppWapAliPay) { this.litErrorMsg.Text = "未开启支付宝网页支付"; } else { string attach = ""; string showUrl = $"http://{HttpContext.Current.Request.Url.Host}/AppShop/MemberOrderDetails?orderId={orderInfo.OrderId}"; PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), text, amount, "订单支付", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, showUrl, Globals.FullPath("/pay/wap_alipay_return_url"), Globals.FullPath("/pay/wap_alipay_notify_url"), attach); paymentRequest.SendRequest(); } } else if (orderInfo.Gateway == "Hishop.Plugins.Payment.ShengPayMobile.ShengPayMobileRequest") { if (!masterSettings.EnableAppShengPay) { this.litErrorMsg.Text = "未开启盛付通手机网页支付"; } else { string attach2 = ""; string text2 = $"http://{HttpContext.Current.Request.Url.Host}/AppShop/"; PaymentRequest paymentRequest2 = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), text, amount, "订单支付", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, text2, text2 + "MemberOrderDetails?orderId=" + orderInfo.OrderId, Globals.FullPath("/pay/wap_sheng_return_url"), attach2); paymentRequest2.SendRequest(); } } else if (orderInfo.Gateway == "hishop.plugins.payment.bankuniongateway.bankuniongetwayrequest") { if (!masterSettings.EnableAPPBankUnionPay) { this.litErrorMsg.Text = "未开启银联全渠道支付"; } else { string attach3 = ""; string showUrl2 = $"http://{HttpContext.Current.Request.Url.Host}/AppShop/"; PaymentRequest paymentRequest3 = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), text, amount, "订单支付", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, showUrl2, Globals.FullPath("/pay/wap_bankunion_return_url"), Globals.FullPath("/pay/wap_bankunion_notify_url"), attach3); paymentRequest3.SendRequest(); } } else { if (orderInfo.Gateway == "hishop.plugins.payment.weixinrequest" || orderInfo.Gateway == "hishop.plugins.payment.appwxrequest") { if (!masterSettings.OpenAppWxPay || string.IsNullOrEmpty(masterSettings.AppWxAppId) || string.IsNullOrEmpty(masterSettings.AppWxAppSecret) || string.IsNullOrEmpty(masterSettings.AppWxMchId) || string.IsNullOrEmpty(masterSettings.AppWxPartnerKey)) { this.litErrorMsg.Text = "APP未开通微信支付"; return; } HttpContext.Current.Response.Redirect("~/pay/H5WxPay_Submit?orderId=" + orderInfo.OrderId); } if (paymentMode == null) { this.litErrorMsg.Text = "错误的支付方式"; } else { this.litErrorMsg.Text = "APP不支持使用" + paymentMode.Name + "进行支付"; } } } }
private void GotoPay() { SiteSettings masterSettings = SettingsManager.GetMasterSettings(); string text = ""; string text2 = HttpContext.Current.Request.UserAgent; if (string.IsNullOrEmpty(text2)) { text2 = ""; } text2 = text2.ToLower(); string str = ""; if (this.order == null) { this.litErrorMsg.Text = "订单数据错误"; } else { DateTime dateTime; if (this.order.PreSaleId > 0) { ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(this.order.PreSaleId); if (productPreSaleInfo == null) { this.litErrorMsg.Text = "预售活动不存在不能支付"; return; } if (!this.order.DepositDate.HasValue) { if (productPreSaleInfo.PreSaleEndDate < DateTime.Now) { this.litErrorMsg.Text = "您支付晚了,预售活动已经结束"; return; } if (!TradeHelper.CheckOrderStockBeforePay(this.order, out str)) { this.litErrorMsg.Text = str + ",库存不足,不能进行支付"; return; } } if (this.order.DepositDate.HasValue && this.order.OrderStatus == OrderStatus.WaitBuyerPay) { if (productPreSaleInfo.PaymentStartDate > DateTime.Now) { this.litErrorMsg.Text = "尾款支付尚未开始"; return; } dateTime = productPreSaleInfo.PaymentEndDate; DateTime t = dateTime.AddDays(1.0); if (t <= DateTime.Now) { this.litErrorMsg.Text = "尾款支付已结束,不能支付!"; return; } } } else if (!TradeHelper.CheckOrderStockBeforePay(this.order, out str)) { this.litErrorMsg.Text = str + ",库存不足,不能进行支付"; return; } string getClientPath = HiContext.Current.GetClientPath; this.litErrorMsg.Text = ""; PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(this.order.Gateway); if (string.IsNullOrEmpty(text)) { text = this.order.Gateway; } if (this.order.CountDownBuyId > 0) { string empty = string.Empty; foreach (KeyValuePair <string, LineItemInfo> lineItem in this.order.LineItems) { CountDownInfo countDownInfo = TradeHelper.CheckUserCountDown(lineItem.Value.ProductId, this.order.CountDownBuyId, lineItem.Value.SkuId, HiContext.Current.UserId, this.order.GetAllQuantity(true), this.order.OrderId, out empty, this.order.StoreId); if (countDownInfo == null) { this.litErrorMsg.Text = empty; return; } } } if (this.order.FightGroupId > 0) { string empty2 = string.Empty; foreach (KeyValuePair <string, LineItemInfo> lineItem2 in this.order.LineItems) { FightGroupActivityInfo fightGroupActivityInfo = VShopHelper.CheckUserFightGroup(lineItem2.Value.ProductId, this.order.FightGroupActivityId, this.order.FightGroupId, lineItem2.Value.SkuId, HiContext.Current.UserId, this.order.GetAllQuantity(true), this.order.OrderId, lineItem2.Value.Quantity, out empty2); if (fightGroupActivityInfo == null) { this.litErrorMsg.Text = empty2; return; } } } if (!string.IsNullOrEmpty(text)) { text = text.ToLower(); } string text3 = this.order.OrderId; decimal num = this.order.GetTotal(true); text3 = this.order.PayOrderId; if (this.order.PreSaleId > 0) { if (!this.order.DepositDate.HasValue && this.order.OrderStatus == OrderStatus.WaitBuyerPay) { num = this.order.Deposit - this.order.BalanceAmount; } if (this.order.DepositDate.HasValue && this.order.OrderStatus == OrderStatus.WaitBuyerPay) { num = this.order.FinalPayment; } } if (this.order.Gateway == "hishop.plugins.payment.advancerequest") { this.Page.Response.Redirect("TransactionPwd?orderId=" + this.Page.Request.QueryString["orderId"] + "&totalAmount=" + num.F2ToString("f2")); } if (text == "hishop.plugins.payment.shengpaymobile.shengpaymobilerequest") { if (!masterSettings.EnableWapShengPay) { this.litErrorMsg.Text = "未开启盛付通手机网页支付"; } else { string text4 = "\"outMemberId\":\"{0}\",\"outMemberRegisterTime\":\"{1}\",\"outMemberRegisterIP\":\"{2}\",\"outMemberVerifyStatus\":{3},\"outMemberName\":\"{4}\",\"outMemberMobile\":\"{5}\",\"attach\":\"{6}\""; MemberInfo user = HiContext.Current.User; string format = text4; object[] obj = new object[7] { user.UserId, null, null, null, null, null, null }; dateTime = user.CreateDate; obj[1] = dateTime.ToString("yyyyMMddHHmmss"); obj[2] = ""; obj[3] = 0; obj[4] = (string.IsNullOrEmpty(user.NickName) ? user.UserName : user.NickName); obj[5] = (string.IsNullOrEmpty(user.CellPhone) ? "13566778899" : user.CellPhone); obj[6] = ""; string attach = "{" + string.Format(format, obj) + "}"; string text5 = $"http://{HttpContext.Current.Request.Url.Host}/{getClientPath}/default"; PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), text3, num, "订单支付", "订单号-" + this.order.OrderId, this.order.EmailAddress, this.order.OrderDate, text5, text5, Globals.FullPath("/pay/wap_sheng_return_url"), attach); paymentRequest.SendRequest(); } } else if (text == "hishop.plugins.payment.ws_wappay.wswappayrequest") { if ((!masterSettings.EnableWeixinWapAliPay && base.ClientType == ClientType.VShop) || (!masterSettings.EnableWapAliPay && (base.ClientType == ClientType.WAP || base.ClientType == ClientType.AliOH))) { this.litErrorMsg.Text = "未开启支付宝网页支付"; } else if (text2.IndexOf("micromessenger") > -1) { this.loadPanel.Visible = false; this.sharePanel.Visible = true; } else { this.loadPanel.Visible = true; this.sharePanel.Visible = false; string attach2 = ""; string showUrl = $"http://{HttpContext.Current.Request.Url.Host}/{getClientPath}/"; PaymentRequest paymentRequest2 = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), text3, num, "订单支付", "订单号-" + this.order.OrderId, this.order.EmailAddress, this.order.OrderDate, showUrl, Globals.FullPath("/pay/wap_alipay_return_url"), Globals.FullPath("/pay/wap_alipay_notify_url"), attach2); paymentRequest2.SendRequest(); } } else if (this.order.Gateway == "hishop.plugins.payment.alipaycrossbordermobilepayment.alipaycrossbordermobilepaymentrequest") { if (!masterSettings.EnableWapAliPayCrossBorder || base.ClientType != ClientType.WAP) { this.litErrorMsg.Text = "未开启支付宝跨境网页支付"; } else { string attach3 = ""; string showUrl2 = $"http://{HttpContext.Current.Request.Url.Host}/{getClientPath}/"; text3 = this.order.OrderId; text3 = this.order.PayOrderId; PaymentRequest paymentRequest3 = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), text3, num, "OrderPay", "Order_No-" + this.order.OrderId, this.order.EmailAddress, this.order.OrderDate, showUrl2, Globals.FullPath("/pay/wap_alipay_cross_border_return_url"), Globals.FullPath("/pay/wap_alipay_cross_border_notify_url"), attach3); paymentRequest3.SendRequest(); } } else if (base.ClientType == ClientType.VShop) { if (text == "hishop.plugins.payment.weixinrequest") { if (!masterSettings.EnableWeiXinRequest && this.order.OrderType == OrderType.ServiceOrder && !masterSettings.OpenWxAppletWxPay) { this.litErrorMsg.Text = "未开启支微信支付"; return; } HttpContext.Current.Response.Redirect("~/pay/wx_Submit?orderId=" + this.order.OrderId); } if (text == "hishop.plugins.payment.bankuniongateway.bankuniongetwayrequest") { if (!masterSettings.EnableBankUnionPay) { this.litErrorMsg.Text = "未开启银联全渠道支付"; } else { string attach4 = ""; string showUrl3 = $"http://{HttpContext.Current.Request.Url.Host}/vshop/"; PaymentRequest paymentRequest4 = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), text3, num, "订单支付", "订单号-" + this.order.OrderId, this.order.EmailAddress, this.order.OrderDate, showUrl3, Globals.FullPath("/pay/wap_bankunion_return_url"), Globals.FullPath("/pay/wap_bankunion_notify_url"), attach4); paymentRequest4.SendRequest(); } } else { if (text == "hishop.plugins.payment.alipaywx.alipaywxrequest") { if (!masterSettings.EnableWeixinWapAliPay) { this.litErrorMsg.Text = "未开启微信端支付宝支付"; return; } HttpContext.Current.Response.Redirect("~/vshop/WXAliPay?orderId=" + this.order.OrderId); } if (paymentMode == null) { this.litErrorMsg.Text = "错误的支付方式"; } else { this.litErrorMsg.Text = "微信商城不支持使用" + paymentMode.Name + "进行支付"; } } } else if (base.ClientType == ClientType.AliOH) { if (text == "hishop.plugins.payment.bankuniongateway.bankuniongetwayrequest") { this.litErrorMsg.Text = "生活号不支持银联全渠道支付"; } else { if (text == "hishop.plugins.payment.weixinrequest") { if (!masterSettings.EnableWapWeiXinPay) { this.litErrorMsg.Text = "未开启支微信支付"; return; } HttpContext.Current.Response.Redirect("~/pay/H5WxPay_Submit.aspx?orderId=" + this.order.OrderId); } if (paymentMode == null) { this.litErrorMsg.Text = "错误的支付方式"; } else { this.litErrorMsg.Text = "生活号不支持使用" + paymentMode.Name + "进行支付"; } } } else if (text == "hishop.plugins.payment.bankuniongateway.bankuniongetwayrequest") { if (!masterSettings.EnableBankUnionPay) { this.litErrorMsg.Text = "未开启银联全渠道支付"; } else { string attach5 = ""; string showUrl4 = $"http://{HttpContext.Current.Request.Url.Host}/{getClientPath}/"; PaymentRequest paymentRequest5 = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), text3, num, "订单支付", "订单号-" + this.order.OrderId, this.order.EmailAddress, this.order.OrderDate, showUrl4, Globals.FullPath("/pay/wap_bankunion_return_url"), Globals.FullPath("/pay/wap_bankunion_notify_url"), attach5); paymentRequest5.SendRequest(); } } else { if (text == "hishop.plugins.payment.weixinrequest") { if (!masterSettings.EnableWapWeiXinPay) { this.litErrorMsg.Text = "未开启支微信支付"; return; } HttpContext.Current.Response.Redirect("~/pay/H5WxPay_Submit.aspx?orderId=" + this.order.OrderId); } if (paymentMode == null) { this.litErrorMsg.Text = "错误的支付方式"; } else { this.litErrorMsg.Text = "触屏版不支持使用" + paymentMode.Name + "进行支付"; } } } }
public async Task Trades(CommandContext ctx, [Description("The player name or item name in question.")] string itemNameOrUserName = "") { try { var plugin = DiscordLink.Obj; if (plugin == null) { await ctx.RespondAsync( "The plugin was unable to be found on the server. Please report this to the plugin author."); return; } if (itemNameOrUserName == "") { await ctx.RespondAsync( "Please provide the name of an item or player to search for. " + "Usage: trades <item name or player name>"); return; } var embed = new DiscordEmbedBuilder() .WithColor(EmbedColor) .WithTitle("Trade Listings"); var match = TradeHelper.MatchItemOrUser(itemNameOrUserName); if (match.Is <Item>()) { var matchItem = match.Get <Item>(); embed.WithAuthor(matchItem.FriendlyName); previousQueryEnumerator[ctx.Member.Id] = TradeOffersBuySell(embed, (store, offer) => offer.Stack.Item == matchItem, t => t.Item1.Parent.OwnerUser.Name); } else if (match.Is <User>()) { var matchUser = match.Get <User>(); embed.WithAuthor(matchUser.Name); previousQueryEnumerator[ctx.Member.Id] = TradeOffersBuySell(embed, (store, offer) => store.Parent.OwnerUser == matchUser, t => t.Item2.Stack.Item.FriendlyName); } else { await ctx.RespondAsync( "The player or item was not found."); return; } var pagedEnumerator = previousQueryEnumerator[ctx.Member.Id]; if (pagedEnumerator.HasMorePages) { embed.WithFooter("More pages available. Use ?nextpage."); } await ctx.RespondAsync(null, false, embed); } catch (Exception e) { LogCommandException(e); } }
protected override void AttachChildControls() { PageTitle.AddSiteNameTitle("交易密码"); HtmlInputHidden htmlInputHidden = (HtmlInputHidden)this.FindControl("hidkey"); Literal literal = (Literal)this.FindControl("OrderId"); Literal literal2 = (Literal)this.FindControl("litOrderTotal"); string orderId = literal.Text = this.Page.Request.QueryString["orderId"].ToNullString(); OrderInfo orderInfo = ShoppingProcessor.GetOrderInfo(orderId); string str = ""; if (orderInfo == null) { base.GotoResourceNotFound("数据错误!"); } else { if (orderInfo.PreSaleId > 0) { ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId); if (productPreSaleInfo == null) { base.GotoResourceNotFound("预售活动不存在不能支付"); return; } if (!orderInfo.DepositDate.HasValue && productPreSaleInfo.PreSaleEndDate < DateTime.Now) { base.GotoResourceNotFound("您支付晚了,预售活动已经结束"); return; } if (orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay) { if (productPreSaleInfo.PaymentStartDate > DateTime.Now) { base.GotoResourceNotFound("尾款支付尚未开始"); return; } DateTime t = productPreSaleInfo.PaymentEndDate.AddDays(1.0); if (t <= DateTime.Now) { base.GotoResourceNotFound("尾款支付已结束"); return; } } } else if (!TradeHelper.CheckOrderStockBeforePay(orderInfo, out str)) { base.GotoResourceNotFound(str + ",库存不足,不能进行支付"); return; } HtmlInputHidden htmlInputHidden2 = (HtmlInputHidden)this.FindControl("txtIsFightGroup"); if (htmlInputHidden2 != null) { htmlInputHidden2.Value = ((orderInfo.FightGroupId > 0) ? "true" : "false"); } decimal num = default(decimal); if (decimal.TryParse(this.Page.Request.QueryString["totalAmount"], out num)) { literal2.Text = num.F2ToString("f2"); } else { base.GotoResourceNotFound("传入值有误"); } } }
private void Binding() { HtmlInputHidden htmlInputHidden = this.hidIsOpenCertification; int num = HiContext.Current.SiteSettings.IsOpenCertification ? 1 : 0; htmlInputHidden.Value = num.ToString(); HtmlInputHidden htmlInputHidden2 = this.hidCertificationModel; num = HiContext.Current.SiteSettings.CertificationModel; htmlInputHidden2.Value = num.ToString(); int.TryParse(this.Page.Request.QueryString["ShippingId"], out WAPSubmitIDInfo.shippingId); if (WAPSubmitIDInfo.shippingId > 0) { ShippingAddressInfo shippingAddress = MemberProcessor.GetShippingAddress(WAPSubmitIDInfo.shippingId); if (shippingAddress != null) { this.hidshippingId.Value = WAPSubmitIDInfo.shippingId.ToString(); this.lblShipTo.Text = shippingAddress.ShipTo; if (string.IsNullOrWhiteSpace(shippingAddress.IDNumber)) { this.txtIDNumber.Text = string.Empty; } else { try { this.txtIDNumber.Text = HiCryptographer.Decrypt(shippingAddress.IDNumber); } catch { this.txtIDNumber.Text = shippingAddress.IDNumber; } } if (HiContext.Current.SiteSettings.CertificationModel == 2) { this.fieldIDCardJust.Value = (string.IsNullOrWhiteSpace(shippingAddress.IDImage1) ? this.fieldIDCardJust.Value : shippingAddress.IDImage1); this.fieldIDCardAnti.Value = (string.IsNullOrWhiteSpace(shippingAddress.IDImage2) ? this.fieldIDCardAnti.Value : shippingAddress.IDImage2); } } } else if (!string.IsNullOrWhiteSpace(this.Page.Request.QueryString["OrderId"])) { OrderInfo orderInfo = TradeHelper.GetOrderInfo(this.Page.Request.QueryString["OrderId"]); if (orderInfo != null) { this.hidorderId.Value = orderInfo.OrderId; this.lblShipTo.Text = orderInfo.ShipTo; if (string.IsNullOrWhiteSpace(orderInfo.IDNumber)) { this.txtIDNumber.Text = string.Empty; } else { try { this.txtIDNumber.Text = HiCryptographer.Decrypt(orderInfo.IDNumber); } catch { this.txtIDNumber.Text = orderInfo.IDNumber; } } if (HiContext.Current.SiteSettings.CertificationModel == 2) { this.fieldIDCardJust.Value = (string.IsNullOrWhiteSpace(orderInfo.IDImage1) ? this.fieldIDCardJust.Value : orderInfo.IDImage1); this.fieldIDCardAnti.Value = (string.IsNullOrWhiteSpace(orderInfo.IDImage2) ? this.fieldIDCardAnti.Value : orderInfo.IDImage2); } } } }
private DataGridViewModel <Dictionary <string, object> > GetDataList(OrderQuery query) { DateTime now = DateTime.Now; DateTime now2 = DateTime.Now; PageModel <OrderModel> pageModel = null; DataGridViewModel <Dictionary <string, object> > dataGridViewModel = new DataGridViewModel <Dictionary <string, object> >(); TimeSpan timeSpan; double totalMilliseconds; if (query != null) { now = DateTime.Now; pageModel = OrderHelper.GetOrderList(query); now2 = DateTime.Now; timeSpan = now2 - now; totalMilliseconds = timeSpan.TotalMilliseconds; Globals.AppendLog("数据库查询花费时间", totalMilliseconds.ToString(), "", "GetDataList"); now = DateTime.Now; string[] orderIds = (from d in pageModel.Models select d.OrderId).ToArray(); List <RefundInfo> refundInfos = TradeHelper.GetRefundInfos(orderIds); dataGridViewModel.rows = DataHelper.ListToDictionary(pageModel.rows); now2 = DateTime.Now; dataGridViewModel.total = pageModel.total; int num = 0; now = DateTime.Now; foreach (Dictionary <string, object> row in dataGridViewModel.rows) { OrderModel order = (from o in pageModel.rows where o.OrderId == row["OrderId"].ToNullString() select o).FirstOrDefault(); row.Add("OrderStatusText", OrderHelper.GetOrderStatusText(order.OrderStatus, order.ShippingModeId, order.IsConfirm, order.Gateway, 0, order.PreSaleId, order.DepositDate, false, order.ItemStatus, order.OrderType)); row.Add("canCheckTake", order.CanConfirmTakeCode()); row.Add("canCloseOrder", order.CanClose(base.CurrentSiteSetting.OpenMultStore, false)); row.Add("canOfflineReceipt", this.CanConfirmOfflineReceipt(order, false)); row.Add("CanEditPrice", this.CanEditPrice(order)); row.Add("canCancelSendGoods", order.OrderStatus == OrderStatus.SellerAlreadySent && (order.DadaStatus == DadaStatus.WaitOrder || order.DadaStatus == DadaStatus.WaitTake)); row.Add("dadaState", (order.DadaStatus != 0) ? ((Enum)(object)order.DadaStatus).ToDescription() : ""); row.Add("InvoiceTypeText", string.IsNullOrEmpty(order.InvoiceTitle) ? "" : EnumDescription.GetEnumDescription((Enum)(object)order.InvoiceType, 0)); bool flag = this.CanSendGoods(order, base.CurrentSiteSetting.OpenMultStore); if (base.CurrentSiteSetting.OpenMultStore && order.StoreId != 0) { flag = false; } row.Add("canFinishTrade", order.OrderStatus == OrderStatus.SellerAlreadySent && order.ItemStatus == OrderItemStatus.Nomarl); bool flag2 = false; if (base.CurrentSiteSetting.OpenMultStore && order.CountDownBuyId == 0 && order.BundlingId == 0 && order.GroupBuyId == 0 && order.FightGroupId == 0 && order.PreSaleId == 0 && order.ItemStatus == OrderItemStatus.Nomarl && (order.OrderStatus == OrderStatus.BuyerAlreadyPaid || (order.OrderStatus == OrderStatus.WaitBuyerPay && order.Gateway == "hishop.plugins.payment.podrequest"))) { if (order.StoreId == -1) { flag2 = (order.BuyQuantity > 0); } else if (order.StoreId > 0) { flag2 = !order.IsConfirm; } else if (order.StoreId == 0) { flag2 = (order.ShippingModeId != -2 && order.BuyQuantity > 0); } } row.Add("CanAllotStore", flag2); RefundInfo refundInfo = refundInfos.FirstOrDefault((RefundInfo d) => d.OrderId == order.OrderId); if (refundInfo != null) { row.Add("IsCheckRefund", order.OrderStatus == OrderStatus.ApplyForRefund && !order.IsStoreCollect); row.Add("RefundId", refundInfo.RefundId); } bool flag3 = false; string value = string.Empty; string value2 = string.Empty; if (order.ItemStatus != 0 || order.OrderStatus == OrderStatus.ApplyForRefund) { if (refundInfo != null && order.OrderStatus == OrderStatus.ApplyForRefund) { flag3 = true; value2 = "订单已申请退款"; value = "RefundApplyDetail?RefundId=" + refundInfo.RefundId; } else { if (order.ItemStatus == OrderItemStatus.HasReturnOrReplace) { value2 = "订单中有商品正在退货/换货中"; } else if (order.ReturnedCount > 0) { value2 = "订单中有商品已退货完成"; } else if (order.ItemStatus == OrderItemStatus.HasReplace) { value2 = "订单中有商品正在进行换货操作"; } else if (order.ItemStatus == OrderItemStatus.HasReturn) { value2 = "订单中有商品正在进行退货操作"; } if (order.AfterSaleCount > 0) { flag3 = true; value = ((order.ReturnId <= 0) ? ("ReplaceApplyDetail?ReplaceId=" + order.ReplaceId) : ("ReturnApplyDetail?ReturnId=" + order.ReturnId)); } } } row.Add("IsShowRefundIcon", flag3); row.Add("RefundOperUrl", value); row.Add("RefundTips", value2); bool flag4 = false; if (order.FightGroupId > 0) { FightGroupInfo fightGroup = VShopHelper.GetFightGroup(order.FightGroupId); if (fightGroup != null) { row["FightGroupActivityId"] = fightGroup.FightGroupActivityId; if (fightGroup.Status == FightGroupStatus.FightGroupIn && order.OrderStatus != OrderStatus.WaitBuyerPay && order.OrderStatus != OrderStatus.Closed) { flag4 = true; } } } row.Add("FightGrouping", flag4); row.Add("canSendGoods", flag); if (order.BuyQuantity <= 0) { if (order.UserAwardRecordsId > 0) { row.Add("IsAwardOrder", true); } else { row.Add("IsGiftOrder", true); } } if (order.PreSaleId > 0 && order.OrderStatus == OrderStatus.BuyerAlreadyPaid) { ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(order.PreSaleId); if (productPreSaleInfo != null) { string value3 = ""; DateTime dateTime; if (productPreSaleInfo.DeliveryDate.HasValue) { dateTime = productPreSaleInfo.DeliveryDate.Value; value3 = "<span>预计发货时间:" + dateTime.ToString("yyyy-MM-dd") + "</span>"; } else { DateTime payDate = order.PayDate; if (order.PayDate != DateTime.MinValue) { dateTime = order.PayDate; dateTime = dateTime.AddDays((double)productPreSaleInfo.DeliveryDays); value3 = "<span>预计发货时间:" + dateTime.ToString("yyyy-MM-dd") + "</span>"; } } row.Add("SendGoodsTips", value3); } } row.Add("IsOpenCertification", HiContext.Current.SiteSettings.IsOpenCertification && order.IsincludeCrossBorderGoods); if (row["IDStatus"] != null) { row["IDStatus"] = order.IDStatus; } num++; } } now2 = DateTime.Now; timeSpan = now2 - now; totalMilliseconds = timeSpan.TotalMilliseconds; Globals.AppendLog("数据计算花费时间", totalMilliseconds.ToString(), "", "GetDataList2"); return(dataGridViewModel); }